diff --git a/.gitignore b/.gitignore index 6be82eb..b5d9abe 100644 --- a/.gitignore +++ b/.gitignore @@ -58,6 +58,7 @@ dlldata.c *.pidb *.svclog *.scc +*.bsc # Chutzpah Test files _Chutzpah* @@ -194,4 +195,8 @@ _Pvt_Extensions/ ModelManifest.xml debug100/ debug100/* -release/ \ No newline at end of file +release/ + +#debug info files +IUpnpErrFile.txt +IUpnpInfoFile.txt \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index c2c64f3..c632c0e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "rapidjson"] - path = rapidjson + path = srchybrid/rapidjson url = https://github.com/miloyip/rapidjson.git diff --git a/Changelog.ScarAngel.txt b/Changelog.ScarAngel.txt new file mode 100644 index 0000000..9a969fa --- /dev/null +++ b/Changelog.ScarAngel.txt @@ -0,0 +1,755 @@ +CHANGELOG FOR EMULE ScarAngel MOD + + +eMule v0.50a ScarAngel v4.2: +------------------------ +- 22.06.2011 - +------------------------------------------------------------------------------- +based on eMule 0.50a Xtreme 8.1 compiled with vs2010 SP1 + +Changed: Pause UBT when moving down slots in upload [Stulle] - Stulle +Changed: Schedule blocking clients for removal [Stulle] - Stulle +Changed: Schedule clients for moving down [Stulle] - Stulle +Changed: Show ModID in systray dialog sidebar [Stulle] - Stulle +Changed: Display ratio activation in WebInterface [Stulle] - Stulle + +Fixed: Potential NULL-pointer bugs in Upload Bandwidth Throttler [Stulle] - Stulle + +Note: The schedule changes will delay removal of blocking or moving down clients so the action will + be done when going through the uploading sockets the next time to avoid exceptions due to + changes in the upload list done by another thread while going through the sockets. + + +eMule v0.50a ScarAngel v4.1: +------------------------ +- 01.06.2011 - +------------------------------------------------------------------------------- +based on eMule 0.50a Xtreme 8.1 compiled with vs2010 SP1 + +Added: Some more icons in DownloadListCtrl context menu [SiRoB] - Stulle +Added: "No to all" option for backup nagging dialog in Backup window [Stulle] - Stulle +Added: Downloading Chunk Detail Display (idea for usage in DlClients by JvA) [SiRoB] - Stulle +Added: Uploading Chunk Detail Display [SiRoB/Fafner] - Stulle +Added: Display remaining upload time (estimation!) [Stulle] - Stulle +Added: Option to optimize mod GUI addons & more feature optimization for NT Service [Stulle] - Stulle + + CPU/MEM information, TBH: MiniMule, Toolbar Speedmeter, Show queue count/progress bar +Added: requpfile optimization [SiRoB] - Stulle + +Changed: Download icons in SearchListCtrl context menu [SiRoB] - Stulle +Changed: Backup dialog strings can now be localized [Stulle] - Stulle +Changed: Show Client UL and DL in Transferred column of DownloadListCtrl [SiRoB] - Stulle +Changed: Show all clients that are not banned in On Queue list of WebInterface [Stulle] - Stulle +Changed: Display if a client has credits in On Queue list of WebInterface [Stulle] - Stulle +Changed: Hide file names in Multi WebInterface if file shared in unaccessable cat [Stulle] - Stulle +Changed: Do not allow downloading of files with hidden file name in WebInterface [Stulle] - Stulle +Changed: Clipboard ed2k link file watch now queues into category selection [leuk_he] - Stulle +Changed: Displayed ed2k link list in category selection can be scrolled through [Stulle] - Stulle +Changed: Allow incoming folder of default cat to be customized [Stulle] - Stulle +Changed: Show cat name for scheduler cat actions [Stulle] - Stulle +Changed: Cat related scheduler items are added with -1 (All) value [Stulle] +Changed: Open Incoming Folder Fix for incoming folders of categories [CommanderGER] - Stulle +Changed: Rewrote the code determining if a NTService optimization should be done [Stulle] - Stulle +Changed: Add superior clients after last superior client in upload [Stulle] - Stulle + + Until now superior clients were added in first position, regardlessly +Changed: Move Superior clients down in upload when they hit a chunk border [Stulle] - Stulle +Changed: Do not display PowerShare or Fair Play for bad clients [Stulle] - Stulle +Changed: Scale both upload and download to max in speed graph of TBH MiniMule [Stulle] - Stulle +Changed: Display if client is superior in WebInterface and sort accordingly [Stulle] - Stulle +Changed: Optimized code that checks if sup clients are on queue [Stulle] - Stulle +Changed: Stop searching for sup clients on queue if one was found [Stulle] - Stulle + + concerns: Keep Sup clients in up if there is no other sup client in queue +Changed: Take sup state into account when retrieving queue rank of enqueued clients [Stulle] - Stulle + +Fixed: On setting new Friendslots via WebInterface old Friendslots were not removed [Stulle] - Stulle +Fixed: Potential NULL-pointer around TBH: MiniMule in TrayDialog [Stulle] - Stulle +Fixed: MiniMule did not open when minimizing to tray with Static Tray activated [Stulle] - Stulle +Fixed: SOTN could be activated for partfiles when enabled in preferences [Stulle] - Stulle +Fixed: FairPlay was displayed for partfiles in Upload List [Stulle] - Stulle +Fixed: WebServer progress text did not work when file completed [Stulle] - Stulle + +Note: Following languages updated: German [Stulle]; Chinese (P.R.C.) [zz_fly]; + Chinese (Taiwan) [AndCycle]; French [jamjam]; Spanish [Rajil/mself563]; + Italian [xilolee/EvolutionCrazy]; Turkish (partially) [omeringen] + + +eMule v0.50a ScarAngel v4.0: +------------------------ +- 11.03.2011 - +------------------------------------------------------------------------------- +based on eMule 0.50a Xtreme 8.0 compiled with vs2010 SP1 +Merged to eMule v0.50a [Stulle] +Updated with code from zz_fly's Xtreme + +Added: Possibility to directly add incoming of removed cat to shared folders [Stulle] - Stulle +Added: Queue progress bar in Webserver (not in Light) [unknown/Stulle] - Stulle +Added: File Percentage in title of progress images in WebServer [unknown/Stulle] - Stulle +Added: More advanced official settings [Stulle] - Stulle + +Changed: Reworked coloring of windows (fixes some tab controls on Vista/7) [Stulle] - Stulle +Changed: Grouping of advanced official settings [Stulle] - Stulle +Changed: Refined dislpaying reasons for download limits in StatusBar [Stulle] - Stulle +Changed: Auto join Morph IRC help channel [Stulle] - Stulle +Changed: Improved picking correct download limit [Stulle] - Stulle + + Might be a little more restrictive but is is also cleaner + +Fixed: Reboot in webserver invoked shutdown instead of reboot [Stulle] - Stulle +Fixed: TxtEditor option in Advanced Preferences [Stulle] - Stulle +Fixed: Setting HOS was cancled when setting remained unchanged for one file [Stulle] - Stulle +Fixed: Minor display bug around default for PowerShare limit [Stulle] - Stulle +Fixed: AutoUpdateIP2Country differed on loading and saving preferences [jerryBG] - Stulle +Fixed: Localization of ScarAngel Settings was incomplete [Stulle] - Stulle +Fixed: Bad graph label display when Source Graph was disabled [Stulle] - Stulle +Fixed: Crashfix for reloading share via ASFU under certain circumstances [WiZaRd] - Stulle +Fixed: Current window was not entirely redrawn on changing window color [Stulle] - Stulle +Fixed: DLP version number was not updated on manual update in settings [Stulle] - Stulle + +Removed: New official Ask-On-Exit Dlg in favor of ScarAngel one (NTService) [Stulle] - Stulle + +Note: Following languages updated: German [Stulle]; Chinese (P.R.C.) [zz_fly]; + Chinese (Taiwan) [AndCycle]; French [jamjam]; Spanish [Rajil/mself563]; + Italian [xilolee/EvolutionCrazy]; Turkish (partially) [omeringen] +Note: Added existing Czech ScarAngel translations to Czech translation file + + +eMule v0.49c ScarAngel v3.3: +------------------------ +- 03.12.2009 - +------------------------------------------------------------------------------- +based on eMule 0.49c Xtreme 7.2 compiled with vs2008 SP1 + +Added: Date File Name Log (enabled by default) [AndCycle] - Stulle +Added: Ionix advanced (multiuser) webserver [iOniX/Aireoreion/wizard/leuk_he/Stulle] - Stulle +Added: Multiuser WebInterface (WI) Cookie settings [Aireoreion] - Stulle + + added code missing in MorphXT so it works +Added: New failed login handling for WI [MorphXT/leuk_he/dreamwalker/Stulle] - Stulle +Added: Failed login screen for WebInterface [SiRoB/CommanderGer/Stulle] - Stulle + + Also for multiuser WI +Added: Tabbed WebInterface settings panel [Stulle] - Stulle + + For multiuser settings +Added: Extra logging to notify of missing webserver files [leuk_he] - Stulle +Added: PowerShare support for WebInterface [Stulle] - Stulle + + fixed missing tick in menu and improper table display from StulleMule +Added: Rebind UPnP mappings (UDP, TCP and Webserver for now) like official [Stulle] - Stulle +Added: Run eMule as NT Service [leuk_he/Stulle] - Stulle + + localized logging, cleaned up code +Added: Adjustable NT Service Strings [Stulle] - Stulle +Added: Extended Prompt on Exit dialog [leuk_he] - Stulle +Added: Friendslot support for WebInterface [Stulle] - Stulle +Added: Installer for eMule ScarAngel [leuk_he/Stulle] - Stulle + + translations taken from eMule Morph so credits to the respective creators + +Changed: Disable FollowTheMajority per file when file is renamed manually [AndCycle] - Stulle +Changed: Disable ASFU if too many folders are shared [Stulle] - Stulle + + fixes related crashes; increases ASFU version number to 3.5 +Changed: Only display cat selection dialog if there is more than one cat [Stulle] - Stulle + +Fixed: Sorting priority descending failed for powershared files [Stulle] - Stulle +Fixed: UPnP setting in First Runtime Wizard [leuk_he] - Stulle +Fixed: Port settings in First Runtime Wizard for Random Ports feature [leuk_he] - Stulle +Fixed: Missing checkmark for PS limited by amount context menu [Stulle] - Stulle +Fixed: (Official) Malfunctioning search results in eMule Light template [Stulle] - Stulle +Fixed: Show last tab in ScarAngel prefs panel on reopening prefs dialog [Stulle] - Stulle +Fixed: Show friend menu in Friendlist of Webinterface [Stulle] - Stulle +Fixed: Design settings font colors overridden in UploadListCtrl [Stulle] - Stulle +Fixed: Personalize Feedback could not be turned off [Stulle] - Stulle + +Note: Following languages updated/added: German [Stulle]; French [Heaven]; +Chinese (P.R.C.) [jason_jiang]; Italian [Idro182]; Turkish [omeringen]; +Spanish [guijarrelson]; Chinese (Taiwan) [alisa/DargonD] + +Ionix advanced (multiuser) webserver: ++ You must select the multi user template to enable the multi user settings. ++ Changed user privileges (see below) ++ Added option to restrict user from downloading files via webserver. ++ Multiuser is enabled/disabled automatically on changing template. + +Ionix advanced (multiuser) webserver user privileges: ++ Guest: Viewing information from webinterface ++ Operator: Adding/Removing downloads and according to other settings ++ Admin: Like Operator plus privilege to close eMule ++ Hi-Admin: Like Admin plus privilege to shutdown/reboot windows + +Run as NT Service: ++ No need to login into windows ++ Keeps running after logging out/ switching users ++ New command line options: + - "emule -install" --> install as a service + - "emule -uninstall" --> uninstall as a service ++ Make sure all settings are correct before installing as a service ++ Links are passed to webservice ++ Option to set level of optimization (Full may cause errors!) ++ See Preferences->Web Server->NTservice tab + + +eMule v0.49c ScarAngel v3.2: +------------------------ +- 17.09.2009 - +------------------------------------------------------------------------------- +based on eMule 0.49c Xtreme 7.2 compiled with vs2005 SP1 +Merged to eMule v0.49c [Stulle] +Updated with code from zz_fly's Xtreme + +Added: Static Tray Icon [MorphXT] - MyTh88 +Added: (Design Settings) Shareable file style for SharedFilesCtrl [Stulle] - Stulle +Added: Feedback personalization [Stulle] - Stulle +Added: Advanced option to disable/enable MediaDet usage for media files [Stulle] - Stulle +Added: Display friendslot in UploadListCtrl (Status colum) [Stulle] - Stulle +Added: More media info related hidden options [Stulle] - Stulle + +Changed: Updated ASFU to v3.4 to work with single shared files [Stulle] - Stulle +Changed: Updated Design Settings for new code (also improves implementation) [Stulle] - Stulle +Changed: Always wait 5 sec after sending save req before saving file settings [Stulle] - Stulle +Changed: Write FileSettings.ini sequentially (faster) [Stulle] - Stulle +Changed: Global SysInfo RAM stats will support usage of more than 4GB [Stulle] - Stulle +Changed: Min small files push size to 1 kB [Stulle] - Stulle +Changed: Small files push size slider kB based (makes keyboard input usable) [Stulle] - Stulle +Changed: (Design Settings) Allow to use multiple font styles (B/U/I) at once [Stulle] - Stulle +Changed: (Design Settings) Changed version to v3 for above change [Stulle] - Stulle + + import of v2 is done automatically on startup +Changed: Localize ScarAngel string in Preferences panel list [Stulle] - Stulle +Changed: Updated Enhanced Client Recognition to v2 (minor change) [Spike2/WiZaRd] - Stulle + +Fixed: Save known or FileSettings threads were not terminated properly [Stulle] - Stulle +Fixed: Some glitches around Timer for ReAsk File Sources [Stulle] - Stulle +Fixed: Changing the small files push size reset changes in the Tree options [Stulle] - Stulle +Fixed: Some glitches around enabling/disabling the Speedbars in the toolbar [Stulle] - Stulle +Fixed: Don't reset Connection Settings for Webserver/CML/MM [Stulle] - Stulle + +Removed: Color Upload Feedback [MyTh88]- MyTh88 + +Feedback personalization: ++ integrated into Design Settings ++ allows you to change font style and color of the feedback ++ Label style will be applied to the whole feedback block ++ Default style will be applied if color is default and no font style is set + + +eMule v0.49b ScarAngel v3.1: +------------------------ +- 13.10.2008 - +------------------------------------------------------------------------------- +based on eMule 0.49b Xtreme 7.0 compiled with vs2005 SP1 +Merged to eMule v0.49b [Stulle] + +Added: IP Filter White list [Stulle] - Stulle +Added: TK4 CreditSystem [BlueSonicBoy] - Stulle +Added: ZZUL CreditSystem [ZZ] - Stulle +Added: Modified FineCS [CiccioBastardo/Stulle] - Stulle +Added: Advanced Transfer Window Layout [Stulle] - Stulle +Added: Completed in Tray [Stulle] - Stulle +Added: Threaded File Settings Saving [Stulle] - Stulle + + keeps the GUI responsive while saving +Added: Threaded Known Files Saving [Stulle] - Stulle + + keeps the GUI responsive while saving +Added: On Upload Queue in Copy Feedback feature [MyTh88] - MyTh88 +Added: New IPFilter (Maintained by Ozzy) [Stulle] - Stulle + + uses DynDNS to check version, mirrored at SourceForge, unrar.dll required! +Added: Show (un-)loading status of IPFilter [Stulle] - Stulle +Added: Sum up transferred stats on getting Feedback for multiple files [Stulle] - Stulle +Added: Color Upload Feedback [MyTh88]- MyTh88 + +Changed: Improved resizing of cats tab in SearchResultWnd [Stulle] - Stulle +Changed: Using official code for proper background of Icons with text [Officials] - Stulle +Changed: Cleaned up Static IP Filter code [Stulle] - Stulle + + only ipfilter.dat layout allowed! +Changed: Toolbar icons [Tango/schluepfer] - Stulle +Changed: Waiting Queue icon [Microsoft] - Stulle +Changed: Known Clients icon [Aha-Soft] - Stulle +Changed: Upload and Download icon [Studiomx] - Stulle +Changed: Downloading Files icon [Fast Icon] - Stulle +Changed: Increased font size for Sub Heading text in context menu [Stulle] - Stulle +Changed: Use proper English in some places ;) [ginger] - Stulle +Changed: Reworked the Feedback code a bit [Stulle] - Stulle +Changed: Enable List requested files only when needed [Stulle] - Stulle +Changed: Only identified and not available SUI clients can be superior [Stulle] - Stulle +Changed: Make code VS 2005 and VS 2008 ready [MorphXT] - Stulle +Changed: Some more changes for Advanced Options [MorphXT] - Stulle + +Fixed: InputBox for ResumeOrder [Stulle/fafner] - Stulle +Fixed: Crash when checking if sup client should not be kicked from UL [Stulle] - Stulle +Fixed: Improper use of FindBestClientInQueue when checking for sup client [Stulle] - Stulle +Fixed: No max time for clients that should be prevented [Stulle] - Stulle +Fixed: Not working chars for context menus [Stulle] - Stulle +Fixed: Scheduled DLP Update not working [Stulle] - Stulle +Fixed: Memleak FiX in SysInfo [WiZaRd] - Stulle +Fixed: Corrupted BarShaderInfo [fafner] - Stulle +Fixed: Corrupted SpreadBarInfo [fafner] - Stulle + +Removed: Second CryptTCPPaddingLength option from Advanced Options [Stulle] - Stulle +Removed: Last renmants of the Xtreme version check [Stulle] - Stulle +Removed: Drop Win95 support (for VS2008 compatibility) [MorphXT] - Stulle + +IP Filter White List: ++ IPs on this list will not be banned ++ use ipfilter_white.dat to add IPs to the White List + +Advanced Transfer Window Layout: ++ Any two lists can be viewed at the same time ++ Downloading file list can only be viewed in the upper part ++ If list shown in the upper half is already in the lower half the lower +list changes to next list ++ To disable/ enable press the split button/ item + + +eMule v0.49a ScarAngel v3.0: +------------------------ +- 06.07.2008 - +------------------------------------------------------------------------------- +based on eMule 0.48a Xtreme 6.1 compiled with vs2003 SP1 +Merged to eMule v0.49a [Stulle] + +- Xtreme's heir - + +Added: Auto download priority [tommy_gun/iONiX] - MyTh +Added: MenuXP Sub Heading [fafner] - MyTh + +Changed: Context menu Sidebars show mod version [Stulle] - MyTh +Changed: Context menu title shown as sub heading [Stulle] - MyTh +Changed: Localize Source Graph group box [Stulle/thx pennyliu123] - Stulle +Changed: Localize Push Small Files label above slider [Stulle/thx pennyliu123] - Stulle +Changed: Localize TBH: MM group item [Stulle/thx pennyliu123] - Stulle +Changed: Localize "12h" string for Release Bonus [Stulle/thx pennyliu123] - Stulle +Changed: Updated UPnP implementation, UPnP lib and PThread lib [leuk_he] - Stulle +Changed: Updated IP2Country implementation [MorphXT] - Stulle +Changed: Updated libping to 1.28 (which is same source as 1.27) [leuk_he] - Stulle +Changed: Updated CxImage to 6.00 (we use the rather complete lib) [Stulle] - Stulle +Changed: No increased reask time for Mephisto clients [Stulle] - Stulle +Changed: No Pay back First for non-SUI clients if client ident failed [Stulle] - Stulle +Changed: Only draw credits overlay icon for mods [Stulle] - Stulle +Changed: Creation of TBH: MiniMule (won't show up on startup now) [Stulle] - Stulle +Changed: Display warning in Design Panel for all Windows > XP [Stulle] - Stulle +Changed: Made Compat clients stats code prettier [WiZaRd] - Stulle +Changed: Ban clients with reduced score immediatly on setting changed [Stulle] - Stulle +Changed: Keep Sup clients in up if there is no other sup client in queue [Stulle] - Stulle + +Fixed: Do not restrict download if no upload possible [Stulle] - Stulle + + missed merging the proper version of this code on releasing +Fixed: Anti-Uploader-Ban case 2 and 3 (horribly old...) [Stulle] - Stulle + +Removed: Redundant File Settings code (old) [Stulle] - Stulle +Removed: Safe KAD code and thelike (for now) [Stulle] - Stulle +Removed: Xtreme version check (not working for now) [Stulle] - Stulle + + +eMule v0.48a ScarAngel v2.5: +------------------------ +- 28.12.2007 - +------------------------------------------------------------------------------- +based on eMule 0.48a Xtreme 6.1 compiled with vs2003 SP1 + +Added: Links for Server list and nodes file [Stulle] - Stulle +Added: High resolution speedmeter on toolbar [eFMod/Stulle] - Myth88 + +Changed: Do not restrict download if no upload possible [Stulle] - Stulle + +Fixed: Resume mode combobox in Categorie dialog [Stulle] - Stulle +Fixed: Auto Update IP2Country on startup [Stulle] - Stulle +Fixed: Do not reserve 1/3 of your uploadlimit (finally!) [Stulle] - Stulle +Fixed: URL input for updates [Stulle] - Stulle +Fixed: Design Settings (backgrounds and windows were broken) [Stulle] - Stulle + + +eMule v0.48a ScarAngel v2.4: +------------------------ +- 14.10.2007 - +------------------------------------------------------------------------------- +based on eMule 0.48a Xtreme 6.1 compiled with vs2003 SP1 + +Changed: Override max upload session time for PBF clients [Stulle] - Stulle +Changed: Override max upload session time for friends [Stulle] - Stulle +Changed: Keep friends in upload like PBF clients [Stulle] - Stulle +Changed: Do not reserve 1/3 if ratio is max 1:2 [Stulle] - Stulle +Changed: Only give back waitingtime if transferred < 9MB [Stulle] - Stulle +Changed: Do not give back waitingtime if it would be more than the old [Stulle] - Stulle +Changed: Only give back waitingtime if transfer completed [Stulle] - Stulle +Changed: Only give back waitingtime if SUQWT or FullChunk enabled [Stulle] - Stulle +Changed: Friends with friend slot always get superior status [Stulle] - Stulle +Changed: Updated Mod Icons [Stulle] - Stulle + +Fixed: Possible buffer overun in Enforce Ratio code [Stulle] - Stulle +Fixed: Do not reserve 1/3 of your uploadlimit for emule [Stulle] - Stulle +Fixed: Missed to enable Auto IPfilter update by default [Stulle] - Stulle + + +eMule v0.48a ScarAngel v2.3: +------------------------ +- 17.09.2007 - +------------------------------------------------------------------------------- +based on eMule 0.48a Xtreme 6.1 compiled with vs2003 SP1 + +Added: Advanced Options [Official/leuk_he] - Stulle +Added: handling of one-time-events for Scheduler [Mighty Knife] - Stulle +Added: Weekly IPFilter update [leuk_he] - Stulle +Added: IP2Country update [MorphXT] - Stulle +Added: One click update for antiLeech.dll [Stulle] - Stulle +Added: Auto update antiLeech.dll [Stulle] - Stulle +Added: Display data difference on PBF in UploadList [Stulle] - Stulle + +Changed: ASFU: Moved EndCall [Stulle] - Stulle +Changed: AFSU: Reset when en-/disabled [Stulle] - Stulle +Changed: Update IPFilter on every startup if enabled [Stulle] - Stulle +Changed: antiLeech.dll, ip-to-country.csv & ipfilter.dat not in BIN pack [Stulle] - Stulle + + files will be updated/ downloaded on startup by default +Changed: Auto update IPFilter migrated to Update tab [Stulle] - Stulle +Changed: Enforce Ratio will start when configured ratio-0.1 reached [Stulle] - Stulle + + Examples: 1:1 -> 1:0.9 ; 1:3 -> 1:2.9 ; 1:5 -> 1:4.9 ; ... +Changed: Enforce 1:1 ratio when configured enforce ratio exceeded [Stulle] - Stulle +Changed: Increased max slotspeed by 25% [Stulle] - Stulle + + WARNING: If upload is less stable decrease slotspeed and/or enable OpenMoreSlots! +Changed: Increased maximum possible slot speed to 19 (by 26.6666%) {Stulle] - Stulle +Changed: Decrease MinSlots value and minmum by one if UL-health >= 75% [Stulle] - Stulle +Changed: Decrease MaxSlots value by one if slotspeed > 4kbps [Stulle] - Stulle +Changed: MuleListCtrl context menu (column context) in XP Style [Stulle] - Stulle +Changed: Icon for share folder commands in context menu [Official] - Stulle + +Fixed: Loading of Cat version (fix default cat settings) [Stulle] - Stulle + + +eMule v0.48a ScarAngel v2.2: +------------------------ +- 08.09.2007 - +------------------------------------------------------------------------------- +based on eMule 0.48a Xtreme 6.1 compiled with vs2003 SP1 + +Changed: Recode of the file settings [Stulle] + +Fixed: Crashfix in Upload list (FairPlay code) [Stulle] - Stulle +Fixed: Odd word invention "constantinously" to "constantly" [LorenzC]- Stulle +Fixed: Some more mem leaks [fafner] - Stulle + +File Settings: ++ all .sivka files will be deleted ++ all settings will be stored in the FileSettings.ini ++ supports all current settings by StulleMule and ScarAngel ++ settings are saved on taking over SivkaFileSettings and on closing eMule + + +eMule v0.48a ScarAngel v2.1: +------------------------ +- 13.08.2007 - +------------------------------------------------------------------------------- +based on eMule 0.48a Xtreme 6.1 compiled with vs2003 SP1 + +Added: Do not reserve 1/3 of your uploadlimit for emule [Stulle] - Stulle +Added: Disable accepting only clients who asked within last 30min [Stulle] - Stulle + + Xtreme only grants upload to clients that asked within the last 30min +Added: Follow The Majority [AndCycle/Stulle] - Stulle +Added: Fair Play [AndCycle/Stulle] - Stulle +Added: Alwasy maximize slot speed [Stulle] - Stulle +Added: Timer for ReAsk File Sources [Stulle/ idea from sivka] - Stulle + + Due to Spread Reasks the actual ReAsk time is: [SetTime]+{-3...0.5 minutes} + +Changed: check mark superior to icon (MenuXP) [fafner] - Stulle +Changed: Quickstart for KAD-only connection [Stulle] - Stulle +Changed: No FunnyNick for bad guys [Stulle] - Stulle +Changed: Max enforced ratio to 1:10 [Stulle] - Stulle + +Fixed: Saving of Cat version (save default Cat viewfilters) [Stulle] - Stulle +Fixed: GDI-Leaks around the context menus [Stulle] - Stulle + +Do not reserve 1/3 of your uploadlimit for emule: ++ Only active if you upload more than download in this session. ++ Reserves only a minimum of 2 kB/s for eMule. + + +eMule v0.48a ScarAngel v2.0: +------------------------ +- 13.06.2007 - +------------------------------------------------------------------------------- +based on eMule 0.48a Xtreme 6.0 compiled with vs2003 SP1 + +Added: Anti fragmenting [netfinity] - Stulle +Added: KAD vista fix [godlaugh2007] - Stulle +Added: Safe KAD [netfinity] - Stulle +Added: KAD speed optimizations [netfinity] - Stulle +Added: Display reason for zero score [Stulle] - Stulle +Added: Automatic shared files updater [MoNKi] - Stulle +Added: Emulate others [WiZaRd/Spike/shadow2004] - Stulle +Added: Anti Uploader Ban (0 = disabled) [Stulle] +Added: Recognize MlDonkey XS Answer [Spike2/ideas by Wiz] - Stulle +Added: Spread Credits Slot [Stulle] - Stulle +Added: Pay Back First [AndCycle/SiRoB/Stulle] - Stulle + +Removed: WebCache [WC team/MorphXT] - Stulle/Max + +Anti Uploader Ban - Stulle ++ Case 1 - UL >= Limit: + - clients who uploaded more but the limit don't get banned ++ Case 2 - UL-DL >= Limit + - clients with a difference between up- and download which is higher but the + limit won't get banned until the difference reaches the limit ++ Case 3 - UL-DL >= Limit + - clients with a difference between up- and download which is higher but the + limit won't get banned until the difference reaches 0 (if session ends before + 0 is reached the client will have to reach the limit again in the next session + to have ban-prevention + +Spread Credits Slot - Stulle ++ every X slots a slot is given to a client that never uploaded to us, downloaded from us, + receives no small file push, is no leecher and does not request a PS file ++ Full Chunk Transfer has to be enabled! + +Spread Credits Slot debugging: ++ @ Spr N = usual Spread Credits Slot (0 up/ 0 down) ++ @ Spr O = got a SCS but was removed early + + +eMule v0.47c ScarAngel v1.9: +------------------------ +- 25.03.2007 - +------------------------------------------------------------------------------- +based on eMule 0.47c Xtreme 5.4.2 compiled with vs2003 SP1 + +Added: More icons in context menus [various] - Stulle +Added: Improved ICS-Firewall support [MoNKi] - Max +Added: Invisible Mode [TPT/MoNKi/SiRoB] - Stulle +Added: UPnP support [MoNKi/leuk_he] - leuk_he +Added: Random Ports [MoNKi] - Stulle +Added: Select window background color [MaxUpload] - Max +Added: Simple cleanup [MorphXT] - Stulle + remark: This is not in the Xtremes implementation, stick to older versions +Added: Support page in preferences [Stulle] - Stulle +Added: Default value for background colors [Stulle] - Stulle +Added: Design settings save version number (now v2) [Stulle] - Stulle + +Changed: Superior clients inserted at first position in UL [Stulle] - Stulle +Changed: Various things around XP-Style menus [Stulle] - Stulle +Changed: Reworked "give waiting time back"-code for SUQWT [Stulle] - Stulle +Changed: Rewrote Design settings (one enum per master item) [Stulle] - Stulle +Changed: List backgrounds unrelated to items in list (instant change) [Stulle] - Stulle + +Updated: Webcache [MorphXT] - Stulle + +Fixed: Columns with wrong background in DlClients and QueueList [Stulle] - Stulle +Fixed: Webcache information drawn in wrong column [Stulle] - Stulle +Fixed: Sometimes client's credits are not updated though they should [Stulle] - Stulle +Fixed: ScarAngel horizontally truncated in Splash [Stulle] - Stulle + +Removed: Unnecessary log line on Design settings changed [Stulle] - Stulle +Removed: UPnP support [Xtreme] - Stulle +Removed: Unused code of TBH: MiniMule implementation [Stulle] - Stulle + + +eMule v0.47c ScarAngel v1.8: +------------------------ +- 04.01.2007 - +------------------------------------------------------------------------------- +based on eMule 0.47c Xtreme 5.4 compiled with vs2003 SP1 + +Added: XP-Style menus [Xanatos/ eMule-web.de staff] - Stulle +Added: Design Settings [eWombat/Stulle] - Stulle +Added: Static IP Filter [Stulle] - Stulle + remark: save "ipfilter_static.dat" in config dir +Added: Limit PS by amount of data uploaded [Stulle] - Stulle +Added: Enhanced Client Recognition [Spike] +Added: Compat Client Stats [Stulle] - Stulle +Added: Enforce Ratio [Stulle] - Stulle + +Changed: Tabs in ScarAngel preferences dialog can be translated [Stulle] - Stulle + +Fixed: Reset Spread Bars command [Stulle] - Stulle +Fixed: second categories column in DownloadList removed [Stulle] - Stulle + +Removed: always one release slot [Xman] - Stulle + + use PowerShare instead + +Design Settings: ++ Only enabled styles will be applied ++ Styles sorted by importance in triggering (default excluded) ++ Combining two styles is impossible + +Enforce Ratio: ++ Download will be limited when 80% of the max ratio is reached ++ Example: Ratio = 1:1 --> Limit when 1:0.8 to download = upload*1 ++ Display details on ratio activation + + +eMule v0.47c ScarAngel v1.7: +------------------------ +- 30.10.2006 - +------------------------------------------------------------------------------- +based on eMule 0.47c Xtreme 5.3.1 compiled with vs2003 SP1 + +Added: Release Bonus (12h or up to 16 days) (not for partfiles) [sivka] +Added: Release Score assurance [Stulle] + +Fixed: Crash on renaming/ deleting shared file [Stulle] - Stulle + +Release Score assurance: ++ clients requesting complete files with release priority will not get + a score lower than the default unless they are Reduce Score clients + + +eMule v0.47c ScarAngel v1.6: +------------------------ +- 27.10.2006 - +------------------------------------------------------------------------------- +based on eMule 0.47c Xtreme 5.3.1 compiled with vs2003 SP1 + +Added: Spread bars [Slugfiller/MorphXT] - Stulle +Added: HideOS & SOTN [Slugfiller/MorphXT] - Stulle + + for complete files only! +Added: Anti Anti HideOS & SOTN [SiRoB] - Stulle +Added: See chunk that we hide [SiRoB] - Stulle +Added: Rare file ratio column in SharedList [Stulle] - Stulle +Added: Superior Client Handling [Stulle] - Stulle +Added: PowerShare [ZZ/MorphXT] - Stulle +Added: Draw PS file requesting clients red [Stulle] - Stulle + +Changed: Show Client Percentage optional [Stulle] - Stulle + +Fixed: WebCache working with obfuscation [MorphXT] - Stulle + +Removed: Spread bars (old version) [SlugFiller] - Stulle +Removed: Dynamic Hide OS [SlugFiller/Xman] - Stulle + +PowerShare: + + PowerShare only works on complete files + + Clients requesting PowerShare will get pushed to top of the queue + + +eMule v0.47c ScarAngel v1.5: +------------------------ +- 28.09.2006 - +------------------------------------------------------------------------------- +based on eMule 0.47c Xtreme 5.3 compiled with vs2003 SP1 + +Changed: Replaced CPU usage reader code [ejor] - Stulle +Changed: System Info settings resetted to default [Stulle] - Stulle +Changed: System Info updated every second instead of 2.5 seconds [Stulle] - Stulle + + +eMule v0.47a ScarAngel v1.4: +------------------------ +- 09.09.2006 - +------------------------------------------------------------------------------- +based on eMule 0.47a Xtreme 5.2.2 compiled with vs2003 and Netfinity's fix + +Fixed: Null-pointer crash in SCC (removed check due to some reason... wtf!) [Stulle] - Stulle + + +eMule v0.47a ScarAngel v1.3: +------------------------ +- 09.09.2006 - +------------------------------------------------------------------------------- +based on eMule 0.47a Xtreme 5.2.2 compiled with vs2003 and Netfinity's fix + +Added: Adjust compress level [Stulle] - Stulle + + You may reduce the compression default value or switch off with this +Added: Smart Category Control (SCC) [khaos/SiRoB/Stulle] - Stulle + +Fixed: Rare ratio column [Stulle] - Stulle +Fixed: SysInfo Memleak [WiZaRd] - Stulle +Fixed: SysInfo wasn't destroyed (pointed out by JvA) [Stulle] - Stulle +Fixed: Changelog dates! =D - Stulle + + +eMule v0.47a ScarAngel v1.2: +------------------------ +- 19.07.2006 - +------------------------------------------------------------------------------- +based on eMule 0.47a Xtreme 5.2.1 compiled with vs2003 and Netfinity's fix + +Added: Show Client Percentage [Commander/MorphXT] - Mondgott +Added: Tabbed Preferences [TPT] - Stulle +Added: TBH: Backup [TBH/EastShare/MorphXT] - Stulle +Added: TBH: MiniMule [TBH/Stulle] - Max +Added: Copy feedback feature [MorphXT] - Stulle +Added: Source Counts Are Cached derivated from Khaos [SiRoB] - Stulle +Added: MassRename [Dragon] - Stulle +Added: Startupsound [Commander] - Mav744 + +Changed: Enable/ Disable Sysinfo (complete and global) [Stulle/iONiX] - Stulle +Changed: added flag to return US Text for CastToXBytes [SiRoB] - Stulle + +Updated: Webcache [SiRoB] - Stulle + +Fixed: Xman Credit System [Stulle] - Stulle +Fixed: About dialog [Stulle] - Stulle + +Removed: Copy UL-Feedback feature [IcEcRacKer] - Stulle + + +eMule v0.47a ScarAngel v1.1: +------------------------ +- 21.04.2006 - +------------------------------------------------------------------------------- +based on eMule 0.47a Xtreme 5.1 compiled with vs2003 and Netfinity's fix + +Note: We need new alpha/ beta tester. If you are interested please contact me + Requirements: speaking English/ German; good eMule knowledge; time! + +Added: Quickstart [TPT] - Max + +Updated: WebCache [SiRoB] - Stulle + +Changed: Trayicon (red/yellow/green square indicating connection) [Stulle] - Stulle +Changed: last reask and next reask updated to match latest xtreme code [Max] - Max +Changed: #emule-deutschland default irc help channel [Max] - Max + +Fixed: (minor) Forgot to count Xtreme's manual drops for the dropped src column [Stulle] - Stulle +Fixed: (minor) Forgot to add UpdateDisplayedInfo(true) after new manual drops [Stulle] - Stulle + + +eMule v0.47a ScarAngel v1.0: +------------------------ +- 02.04.2006 - +------------------------------------------------------------------------------- +based on eMule 0.47a Xtreme 5.0.1 compiled with vs2003 and Netfinity's fix + +Added: Status color [EastShare] - Max +Added: Last asked time & next asked time in prio column [EastShare/Xman/Max] - Max +Added: WebCache [WC team/MorphXT] - Stulle/Max +Added: Active Connection Control [Obelix/Max] +Added: display CPU/MEM usage in transferwnd [$ick$/Stulle] - Max +Added: Relax on Startup [WiZaRd] - Max +Added: ScarAngel Preferences Window [Stulle] - Stulle +Added: Global Hardlimit [Stulle/many ideas by Max] - Stulle +Added: Push-small-files (boost can be configured manually) [Sivka/Stulle] - Stulle +Added: Push-rare-files [Tarod/ eF-Mod] - Stulle +Added: Different CreditSystems [EastShare/ MoprhXT/ Stulle] - Stulle + + lovelace, Pawcio, Ratio, EastShare, Sivka, S.W.A.T., Xman, official + + The CreditSystem is always enabled +Added: Save Upload Queue Waiting Time (SUQWT) [Moonlight/ EastShare/ MorphXT] - Stulle +Added: Show source on title [Stulle] - Stulle +Added: Show emules infos in your MSN7 (or above) message field v2 [MOnKi/ikabot/Stulle] - Stulle +Added: Show global HL [Stulle] - Stulle +Added: Draw friends blue [Stulle] - Stulle +Added: Show HL per file constantaniously [Stulle] - Stulle +Added: Show global HL [Stulle] - Stulle +Added: Sivka File Settings [Sivka/Stulle] - Stulle +Added: Customized source dropping [Sivka/Stulle] - Stulle +Added: show # of dropped sources per file in DownloadList [Stulle] - Stulle +Added: Several Mod Icons [Stulle] - Stulle + + note: supports ScarAngel, StulleMule, MAXmod, Xtreme, Morph, + EastShare, iONiX, Cyrex2001, NextEMF, Neo Mule +Added: Preferences Banner [TPT/ MorphXT/emule-web.de team] - Stulle +Added: Advanced manual dropping [Stulle] - Stulle +Added: Fake HighID check [netfinity] - Stulle +Added: FunnyNick [SiRoB/Stulle] - Stulle +Added: Client queue progress bar [Commander] - Stulle +Added: ScarAngel Version Check [Official/MorphXT/Stulle] - Stulle + +Changed: ModID [Maella] management replaced with ModID [itsonlyme/SiRoB] - Stulle +Changed: Startup Banner, Program Icon [emule-web.de team] - Stulle + +Sivka File Settings: + + You can customize time between src drops, enable/ disable src dropping and min src for dropping + + You can enable/ disable Global HL for a file + + Custom hardlimit moved to Sivka File Settings dialog + +customized source dropping: + + uses settings from Sivka File Settings + + uses seperate timer for Low2LowIP, NNS, FQ, HQR + + if not optional most dropping code is still Xtreme (not time...) + +advanced manual dropping: + + Low2LowIP + + unknown, error and banned + + high queue rating sources (Xman method) + + high queue rating sources (Sivka method) + + CleanUp => NNS, FQS, unknown, error and banned + +CPU/ Memory usage display in TransferWnd: ++ Display order: "CPU : CPU usage of eMule (CPU usage of the whole system)" + "Mem : Memory usage of eMule (currently used physical Mem/ RAM of System)" \ No newline at end of file diff --git a/EditBinX/EditBinX.cpp b/EditBinX/EditBinX.cpp new file mode 100644 index 0000000..3900724 --- /dev/null +++ b/EditBinX/EditBinX.cpp @@ -0,0 +1,113 @@ +//this file is part of eMule +//Copyright (C)2002-2008 Merkur ( strEmail.Format("%s@%s", "devteam", "emule-project.net") / http://www.emule-project.net ) +// +//This program is free software; you can redistribute it and/or +//modify it under the terms of the GNU General Public License +//as published by the Free Software Foundation; either +//version 2 of the License, or (at your option) any later version. +// +//This program is distributed in the hope that it will be useful, +//but WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//GNU General Public License for more details. +// +//You should have received a copy of the GNU General Public License +//along with this program; if not, write to the Free Software +//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#include "stdafx.h" + +int _tmain(int argc, _TCHAR *argv[]) +{ + PathStripPath(argv[0]); + PathRemoveExtension(argv[0]); + _tcsupr(argv[0]); + + bool errflag = false; + bool bVerbose = false; + bool bSetDynamicBase = false; + bool bSetNXCompat = false; + int c; + for (c = 1; !errflag && c < argc - 1; c++) + { + if (_tcsicmp(argv[c], _T("/verbose")) == 0) + bVerbose = true; + else if (_tcsicmp(argv[c], _T("/dynamicbase")) == 0) + bSetDynamicBase = true; + else if (_tcsicmp(argv[c], _T("/nxcompat")) == 0) + bSetNXCompat = true; + else + break; + } + + if (c+1 != argc || errflag) { + _tprintf(_T("Usage: %s [/dynamicbase | /nxcompat | /verbose] \n"), argv[0]); + return EXIT_FAILURE; + } + + _TCHAR *pszFilePath = argv[c]; + + LOADED_IMAGE LoadedImage; + if (!MapAndLoad(pszFilePath, NULL, &LoadedImage, FALSE, FALSE)) { + _ftprintf(stderr, _T("%s: Error: Failed to load \"%s\"\n"), argv[0], pszFilePath); + return EXIT_FAILURE; + } + + int iResult = EXIT_FAILURE; + if ( LoadedImage.FileHeader + && memcmp(&LoadedImage.FileHeader->Signature, "PE\0\0", 4) == 0 + && LoadedImage.FileHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) + { + if (bVerbose) + { + _tprintf(_T("File Header Characteristics\n")); + _tprintf(_T(" RELOCS_STRIPPED: %d\n"), !!(LoadedImage.FileHeader->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED)); + _tprintf(_T("Optional Header DLL Characteristics\n")); + _tprintf(_T(" DYNAMIC_BASE: %d\n"), !!(LoadedImage.FileHeader->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE)); + _tprintf(_T(" NX_COMPAT: %d\n"), !!(LoadedImage.FileHeader->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT)); + } + + if (bSetDynamicBase) + { + // VS2003: Linking with "/FIXED" (which is the default for EXE files), strips all relocations. + // VS2003: Linking with "/FIXED:NO" keeps the relocations. + if ((LoadedImage.FileHeader->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) != 0) + _ftprintf(stderr, _T("%s: Warning: 'DYNAMIC_BASE' will not have any effect unless EXE file gets linked with '/FIXED:NO'.\n"), argv[0]); + + // Setting the IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE flag for an VS2003 exe-file is + // exactly the same as when using the VS2005(!) linker and performing a: + // + // >link /edit /dynamicbase + // + // The VS2005 linker when used as shown above just sets the IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE + // flag. It also updates the CRC checksum of the EXE file, but apart from that there are no other + // modifications done in the EXE file. So, it is safe for EditBinX to use the Windows API for + // setting just that flag in the EXE file header. + if (bVerbose) + _tprintf(_T("Setting DYNAMIC_BASE\n")); + LoadedImage.FileHeader->OptionalHeader.DllCharacteristics |= IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE; + } + + if (bSetNXCompat) + { + // Could also set NXCOMPAT here, but this would lead to a DEP-Policy of 00000003 (PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION). + // NOTE: PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION is *not* to be used for a VS2003 application which is using ATL 7.1! + if (bVerbose) + _tprintf(_T("Setting NX_COMPAT\n")); + LoadedImage.FileHeader->OptionalHeader.DllCharacteristics |= IMAGE_DLLCHARACTERISTICS_NX_COMPAT; + } + + iResult = EXIT_SUCCESS; + } + else + { + _ftprintf(stderr, _T("%s: Error: Invalid EXE file header in \"%s\"\n"), argv[0], pszFilePath); + } + + if (!UnMapAndLoad(&LoadedImage)) { + _ftprintf(stderr, _T("%s: Error: Failed to unload \"%s\"\n"), argv[0], pszFilePath); + return EXIT_FAILURE; + } + + return iResult; +} diff --git a/EditBinX/EditBinX.sln b/EditBinX/EditBinX.sln new file mode 100644 index 0000000..f5da247 --- /dev/null +++ b/EditBinX/EditBinX.sln @@ -0,0 +1,23 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EditBinX", "EditBinX.vcproj", "{0D7BD925-80AE-40C4-98D7-B783A35B7228}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {0D7BD925-80AE-40C4-98D7-B783A35B7228}.Debug.ActiveCfg = Debug|Win32 + {0D7BD925-80AE-40C4-98D7-B783A35B7228}.Debug.Build.0 = Debug|Win32 + {0D7BD925-80AE-40C4-98D7-B783A35B7228}.Release.ActiveCfg = Release|Win32 + {0D7BD925-80AE-40C4-98D7-B783A35B7228}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/EditBinX/EditBinX.vcproj b/EditBinX/EditBinX.vcproj new file mode 100644 index 0000000..e5afd7b --- /dev/null +++ b/EditBinX/EditBinX.vcproj @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/EditBinX/stdafx.cpp b/EditBinX/stdafx.cpp new file mode 100644 index 0000000..54eb81c --- /dev/null +++ b/EditBinX/stdafx.cpp @@ -0,0 +1,25 @@ +//this file is part of eMule +//Copyright (C)2002-2008 Merkur ( strEmail.Format("%s@%s", "devteam", "emule-project.net") / http://www.emule-project.net ) +// +//This program is free software; you can redistribute it and/or +//modify it under the terms of the GNU General Public License +//as published by the Free Software Foundation; either +//version 2 of the License, or (at your option) any later version. +// +//This program is distributed in the hope that it will be useful, +//but WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//GNU General Public License for more details. +// +//You should have received a copy of the GNU General Public License +//along with this program; if not, write to the Free Software +//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +// stdafx.cpp : source file that includes just the standard includes +// EditBinX.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/EditBinX/stdafx.h b/EditBinX/stdafx.h new file mode 100644 index 0000000..d163e6e --- /dev/null +++ b/EditBinX/stdafx.h @@ -0,0 +1,40 @@ +//this file is part of eMule +//Copyright (C)2002-2008 Merkur ( strEmail.Format("%s@%s", "devteam", "emule-project.net") / http://www.emule-project.net ) +// +//This program is free software; you can redistribute it and/or +//modify it under the terms of the GNU General Public License +//as published by the Free Software Foundation; either +//version 2 of the License, or (at your option) any later version. +// +//This program is distributed in the hope that it will be useful, +//but WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//GNU General Public License for more details. +// +//You should have received a copy of the GNU General Public License +//along with this program; if not, write to the Free Software +//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include + +#ifndef IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE +#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040 // DLL can move. +#endif + +#ifndef IMAGE_DLLCHARACTERISTICS_NX_COMPAT +#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100 // Image is NX compatible +#endif + +#include +#include +#include diff --git a/How-To-Compile_VS05.txt b/How-To-Compile_VS05.txt new file mode 100644 index 0000000..6b6ba21 --- /dev/null +++ b/How-To-Compile_VS05.txt @@ -0,0 +1,30 @@ +------------------------------------------------------------------------- + How to compile eMule ScarAngel using Visual Studio 2005 SP1 +------------------------------------------------------------------------- + +1. Download Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 here: + + Full ISO Image: http://www.microsoft.com/downloads/details.aspx?familyid=71DEB800-C591-4F97-A900-BEA146E4FAE1&displaylang=en + + or + + Web Install: http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en + +2. Start Web Install or Setup.Exe on the ISO image. + +3. Decide on install folder. + +4. Check 'Windows Headers and Libaries'. This is just enough for compiling ScarAngel. If you want to install anything else + do it but it is not required. Basically, you will only waste space on your hard drive. + +5. Wait a quarter of a century for the installation to finish... Actually, it is pretty fast if you do as we suggest. + +6. When the installation is finished go to Start --> All Programs --> Microsoft Windows SDK v7.0 --> Visual Studio Registration + and start Windows SDK Configuration Tool. Follow the instructions and register the new SDK to Microsoft Visual Studio 2005. + +7. Start $Source Dir$\srchybrid\emule80.sln and pick build type you want to compile. + +8. Be happy with this new fine ScarAngel Release. + + +NOTE: The provided sources contain all additionally required Microsoft SDK includes and libs so this is just about ready to compile. \ No newline at end of file diff --git a/How-To-Compile_VS08.txt b/How-To-Compile_VS08.txt new file mode 100644 index 0000000..3175596 --- /dev/null +++ b/How-To-Compile_VS08.txt @@ -0,0 +1,30 @@ +------------------------------------------------------------------------- + How to compile eMule ScarAngel using Visual Studio 2008 SP1 +------------------------------------------------------------------------- + +1. Download Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 here: + + Full ISO Image: http://www.microsoft.com/downloads/details.aspx?familyid=71DEB800-C591-4F97-A900-BEA146E4FAE1&displaylang=en + + or + + Web Install: http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en + +2. Start Web Install or Setup.Exe on the ISO image. + +3. Decide on install folder. + +4. Check 'Windows Headers and Libaries'. This is just enough for compiling ScarAngel. If you want to install anything else + do it but it is not required. Basically, you will only waste space on your hard drive. + +5. Wait a quarter of a century for the installation to finish... Actually, it is pretty fast if you do as we suggest. + +6. When the installation is finished go to Start --> All Programs --> Microsoft Windows SDK v7.0 --> Visual Studio Registration + and start Windows SDK Configuration Tool. Follow the instructions and register the new SDK to Microsoft Visual Studio 2005. + +7. Start $Source Dir$\srchybrid\emule90.sln and pick build type you want to compile. + +8. Be happy with this new fine ScarAngel Release. + + +NOTE: The provided sources contain all additionally required Microsoft SDK includes and libs so this is just about ready to compile. \ No newline at end of file diff --git a/How-To-Compile_VS10.txt b/How-To-Compile_VS10.txt new file mode 100644 index 0000000..b6972bc --- /dev/null +++ b/How-To-Compile_VS10.txt @@ -0,0 +1,10 @@ +------------------------------------------------------------------------- + How to compile eMule ScarAngel using Visual Studio 2010 +------------------------------------------------------------------------- + +1. Start $Source Dir$\srchybrid\emule100.sln and pick build type you want to compile. + +2. Be happy with this new fine ScarAngel Release. + + +NOTE: The provided sources contain all additionally required Microsoft SDK includes and libs so this is just about ready to compile. \ No newline at end of file diff --git a/ReplaceVistaIcon/LICENSE.html b/ReplaceVistaIcon/LICENSE.html new file mode 100644 index 0000000..e5fe0d1 --- /dev/null +++ b/ReplaceVistaIcon/LICENSE.html @@ -0,0 +1,251 @@ + + +The Code Project Open License (COPL) + + + + +

The Code Project Open License (CPOL) 1.02

+
+ +
+
+ +

Preamble

+

+ This License governs Your use of the Work. This License is intended to allow developers + to use the Source Code and Executable Files provided as part of the Work in any + application in any form. +

+

+ The main points subject to the terms of the License are:

+
    +
  • Source Code and Executable Files can be used in commercial applications;
  • +
  • Source Code and Executable Files can be redistributed; and
  • +
  • Source Code can be modified to create derivative works.
  • +
  • No claim of suitability, guarantee, or any warranty whatsoever is provided. The software is + provided "as-is".
  • +
  • The Article accompanying the Work may not be distributed or republished without the + Author's consent
  • +
+ +

+ This License is entered between You, the individual or other entity reading or otherwise + making use of the Work licensed pursuant to this License and the individual or other + entity which offers the Work under the terms of this License ("Author").

+ +

License

+

+ THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CODE PROJECT OPEN + LICENSE ("LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE + LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT + LAW IS PROHIBITED.

+

+ BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HEREIN, YOU ACCEPT AND AGREE TO BE + BOUND BY THE TERMS OF THIS LICENSE. THE AUTHOR GRANTS YOU THE RIGHTS CONTAINED HEREIN + IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. IF YOU DO NOT + AGREE TO ACCEPT AND BE BOUND BY THE TERMS OF THIS LICENSE, YOU CANNOT MAKE ANY + USE OF THE WORK.

+ +
    +
  1. Definitions. + +
      +
    1. "Articles" means, collectively, all articles written by Author + which describes how the Source Code and Executable Files for the Work may be used + by a user.
    2. +
    3. "Author" means the individual or entity that offers the Work under the terms + of this License.
    4. +
    5. "Derivative Work" means a work based upon the Work or upon the + Work and other pre-existing works.
    6. +
    7. "Executable Files" refer to the executables, binary files, configuration + and any required data files included in the Work.
    8. +
    9. "Publisher" means the provider of the website, magazine, CD-ROM, DVD or other + medium from or by which the Work is obtained by You.
    10. +
    11. "Source Code" refers to the collection of source code and configuration files + used to create the Executable Files.
    12. +
    13. "Standard Version" refers to such a Work if it has not been modified, or + has been modified in accordance with the consent of the Author, such consent being + in the full discretion of the Author.
    14. +
    15. "Work" refers to the collection of files distributed by the Publisher, including + the Source Code, Executable Files, binaries, data files, documentation, whitepapers + and the Articles.
    16. +
    17. "You" is you, an individual or entity wishing to use the Work and exercise + your rights under this License. +
    18. +
    +
  2. + +
  3. Fair Use/Fair Use Rights. Nothing in this License is intended to + reduce, limit, or restrict any rights arising from fair use, fair dealing, first + sale or other limitations on the exclusive rights of the copyright owner under copyright + law or other applicable laws. +
  4. + +
  5. License Grant. Subject to the terms and conditions of this License, + the Author hereby grants You a worldwide, royalty-free, non-exclusive, perpetual + (for the duration of the applicable copyright) license to exercise the rights in + the Work as stated below: + +
      +
    1. You may use the standard version of the Source Code or Executable Files in Your + own applications.
    2. +
    3. You may apply bug fixes, portability fixes and other modifications obtained from + the Public Domain or from the Author. A Work modified in such a way shall still + be considered the standard version and will be subject to this License.
    4. +
    5. You may otherwise modify Your copy of this Work (excluding the Articles) in any + way to create a Derivative Work, provided that You insert a prominent notice in + each changed file stating how, when and where You changed that file.
    6. +
    7. You may distribute the standard version of the Executable Files and Source Code + or Derivative Work in aggregate with other (possibly commercial) programs as part + of a larger (possibly commercial) software distribution.
    8. +
    9. The Articles discussing the Work published in any form by the author may not be + distributed or republished without the Author's consent. The author retains + copyright to any such Articles. You may use the Executable Files and Source Code + pursuant to this License but you may not repost or republish or otherwise distribute + or make available the Articles, without the prior written consent of the Author.
    10. +
    + + Any subroutines or modules supplied by You and linked into the Source Code or Executable + Files this Work shall not be considered part of this Work and will not be subject + to the terms of this License. +
  6. + +
  7. Patent License. Subject to the terms and conditions of this License, + each Author hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, + irrevocable (except as stated in this section) patent license to make, have made, use, import, + and otherwise transfer the Work.
  8. + +
  9. Restrictions. The license granted in Section 3 above is expressly + made subject to and limited by the following restrictions: + +
      +
    1. You agree not to remove any of the original copyright, patent, trademark, and + attribution notices and associated disclaimers that may appear in the Source Code + or Executable Files.
    2. +
    3. You agree not to advertise or in any way imply that this Work is a product of Your + own.
    4. +
    5. The name of the Author may not be used to endorse or promote products derived from + the Work without the prior written consent of the Author.
    6. +
    7. You agree not to sell, lease, or rent any part of the Work. This does not restrict + you from including the Work or any part of the Work inside a larger software + distribution that itself is being sold. The Work by itself, though, cannot be sold, + leased or rented.
    8. +
    9. You may distribute the Executable Files and Source Code only under the terms of + this License, and You must include a copy of, or the Uniform Resource Identifier + for, this License with every copy of the Executable Files or Source Code You distribute + and ensure that anyone receiving such Executable Files and Source Code agrees that + the terms of this License apply to such Executable Files and/or Source Code. You + may not offer or impose any terms on the Work that alter or restrict the terms of + this License or the recipients' exercise of the rights granted hereunder. You + may not sublicense the Work. You must keep intact all notices that refer to this + License and to the disclaimer of warranties. You may not distribute the Executable + Files or Source Code with any technological measures that control access or use + of the Work in a manner inconsistent with the terms of this License.
    10. +
    11. You agree not to use the Work for illegal, immoral or improper purposes, or on pages + containing illegal, immoral or improper material. The Work is subject to applicable + export laws. You agree to comply with all such laws and regulations that may apply + to the Work after Your receipt of the Work. +
    12. +
    +
  10. + +
  11. Representations, Warranties and Disclaimer. THIS WORK IS PROVIDED + "AS IS", "WHERE IS" AND "AS AVAILABLE", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES + OR CONDITIONS OR GUARANTEES. YOU, THE USER, ASSUME ALL RISK IN ITS USE, INCLUDING + COPYRIGHT INFRINGEMENT, PATENT INFRINGEMENT, SUITABILITY, ETC. AUTHOR EXPRESSLY + DISCLAIMS ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES OR CONDITIONS, INCLUDING + WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF MERCHANTABILITY, MERCHANTABLE QUALITY + OR FITNESS FOR A PARTICULAR PURPOSE, OR ANY WARRANTY OF TITLE OR NON-INFRINGEMENT, + OR THAT THE WORK (OR ANY PORTION THEREOF) IS CORRECT, USEFUL, BUG-FREE OR FREE OF + VIRUSES. YOU MUST PASS THIS DISCLAIMER ON WHENEVER YOU DISTRIBUTE THE WORK OR DERIVATIVE + WORKS. +
  12. + +
  13. Indemnity. You agree to defend, indemnify and hold harmless the Author and + the Publisher from and against any claims, suits, losses, damages, liabilities, + costs, and expenses (including reasonable legal or attorneys fees) resulting from + or relating to any use of the Work by You. +
  14. + +
  15. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE + LAW, IN NO EVENT WILL THE AUTHOR OR THE PUBLISHER BE LIABLE TO YOU ON ANY LEGAL + THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES + ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK OR OTHERWISE, EVEN IF THE AUTHOR + OR THE PUBLISHER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +
  16. + +
  17. Termination. + +
      +
    1. This License and the rights granted hereunder will terminate automatically upon + any breach by You of any term of this License. Individuals or entities who have + received Derivative Works from You under this License, however, will not have their + licenses terminated provided such individuals or entities remain in full compliance + with those licenses. Sections 1, 2, 6, 7, 8, 9, 10 and 11 will survive any termination + of this License.
    2. + +
    3. If You bring a copyright, trademark, patent or any other infringement claim against + any contributor over infringements You claim are made by the Work, your License + from such contributor to the Work ends automatically.
    4. + +
    5. Subject to the above terms and conditions, this License is perpetual (for the duration + of the applicable copyright in the Work). Notwithstanding the above, the Author + reserves the right to release the Work under different license terms or to stop + distributing the Work at any time; provided, however that any such election will + not serve to withdraw this License (or any other license that has been, or is required + to be, granted under the terms of this License), and this License will continue + in full force and effect unless terminated as stated above. +
    6. +
    +
  18. + +
  19. Publisher. The parties hereby confirm that the Publisher shall + not, under any circumstances, be responsible for and shall not have any liability + in respect of the subject matter of this License. The Publisher makes no warranty + whatsoever in connection with the Work and shall not be liable to You or any party + on any legal theory for any damages whatsoever, including without limitation any + general, special, incidental or consequential damages arising in connection to this + license. The Publisher reserves the right to cease making the Work available to + You at any time without notice
  20. + +
  21. Miscellaneous + +
      +
    1. This License shall be governed by the laws of the location of the head office of + the Author or if the Author is an individual, the laws of location of the principal + place of residence of the Author.
    2. +
    3. If any provision of this License is invalid or unenforceable under applicable law, + it shall not affect the validity or enforceability of the remainder of the terms + of this License, and without further action by the parties to this License, such + provision shall be reformed to the minimum extent necessary to make such provision + valid and enforceable.
    4. +
    5. No term or provision of this License shall be deemed waived and no breach consented + to unless such waiver or consent shall be in writing and signed by the party to + be charged with such waiver or consent.
    6. +
    7. This License constitutes the entire agreement between the parties with respect to + the Work licensed herein. There are no understandings, agreements or representations + with respect to the Work not specified herein. The Author shall not be bound by + any additional provisions that may appear in any communication from You. This License + may not be modified without the mutual written agreement of the Author and You. +
    8. +
    + +
  22. +
+ +
+
+ + + diff --git a/ReplaceVistaIcon/README.txt b/ReplaceVistaIcon/README.txt new file mode 100644 index 0000000..c2cafe4 --- /dev/null +++ b/ReplaceVistaIcon/README.txt @@ -0,0 +1,8 @@ +The source code for the ReplaceVistaIcon tool was originally developed by + + Vlasta_@codeproject.com + http://www.codeproject.com/KB/GDI/using_vista_icons.aspx + +and is licensed under the The Code Project Open License (CPOL). + +See LICENSE.html for details. diff --git a/ReplaceVistaIcon/ReplaceVistaIcon_vc100.vcxproj b/ReplaceVistaIcon/ReplaceVistaIcon_vc100.vcxproj new file mode 100644 index 0000000..8aaffce --- /dev/null +++ b/ReplaceVistaIcon/ReplaceVistaIcon_vc100.vcxproj @@ -0,0 +1,119 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {58A54F98-FF3F-472F-9282-DA411EE850A2} + ReplaceVistaIcon + Win32Proj + ReplaceVistaIcon_vc100 + + + + Application + MultiByte + v140_xp + + + Application + MultiByte + v140_xp + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(Configuration)\ + $(Configuration)\ + true + $(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + Use + Level3 + EditAndContinue + true + + + $(OutDir)ReplaceVistaIcon.exe + true + $(OutDir)ReplaceVistaIcon.pdb + Console + false + + + MachineX86 + + + true + + + + + _ALLOW_KEYWORD_MACROS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + Use + Level3 + ProgramDatabase + + + $(OutDir)ReplaceVistaIcon.exe + Console + true + true + false + + + MachineX86 + + + + + + Create + Create + + + + + + + + + + + + + \ No newline at end of file diff --git a/ReplaceVistaIcon/ReplaceVistaIcon_vc100.vcxproj.filters b/ReplaceVistaIcon/ReplaceVistaIcon_vc100.vcxproj.filters new file mode 100644 index 0000000..5f6e1a8 --- /dev/null +++ b/ReplaceVistaIcon/ReplaceVistaIcon_vc100.vcxproj.filters @@ -0,0 +1,38 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/ReplaceVistaIcon/ReplaceVistaIcon_vc71.sln b/ReplaceVistaIcon/ReplaceVistaIcon_vc71.sln new file mode 100644 index 0000000..8572eb6 --- /dev/null +++ b/ReplaceVistaIcon/ReplaceVistaIcon_vc71.sln @@ -0,0 +1,23 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReplaceVistaIcon", "ReplaceVistaIcon_vc71.vcproj", "{58A54F98-FF3F-472F-9282-DA411EE850A2}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {58A54F98-FF3F-472F-9282-DA411EE850A2}.Debug.ActiveCfg = Debug|Win32 + {58A54F98-FF3F-472F-9282-DA411EE850A2}.Debug.Build.0 = Debug|Win32 + {58A54F98-FF3F-472F-9282-DA411EE850A2}.Release.ActiveCfg = Release|Win32 + {58A54F98-FF3F-472F-9282-DA411EE850A2}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/ReplaceVistaIcon/ReplaceVistaIcon_vc71.vcproj b/ReplaceVistaIcon/ReplaceVistaIcon_vc71.vcproj new file mode 100644 index 0000000..d043675 --- /dev/null +++ b/ReplaceVistaIcon/ReplaceVistaIcon_vc71.vcproj @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ReplaceVistaIcon/ReplaceVistaIcon_vc80.vcproj b/ReplaceVistaIcon/ReplaceVistaIcon_vc80.vcproj new file mode 100644 index 0000000..bc84910 --- /dev/null +++ b/ReplaceVistaIcon/ReplaceVistaIcon_vc80.vcproj @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ReplaceVistaIcon/ReplaceVistaIcon_vc90.vcproj b/ReplaceVistaIcon/ReplaceVistaIcon_vc90.vcproj new file mode 100644 index 0000000..629a3ef --- /dev/null +++ b/ReplaceVistaIcon/ReplaceVistaIcon_vc90.vcproj @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ReplaceVistaIcon/SetVistaIcon.cpp b/ReplaceVistaIcon/SetVistaIcon.cpp new file mode 100644 index 0000000..6349c57 --- /dev/null +++ b/ReplaceVistaIcon/SetVistaIcon.cpp @@ -0,0 +1,253 @@ +// SetVistaIcon.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" + +typedef std::vector > CExecutableRscs; + +BOOL CALLBACK EnumRscLangs(HMODULE UNREF(a_hModule), LPCTSTR UNREF(a_pszType), LPCTSTR a_pszName, WORD a_wIDLanguage, LONG_PTR a_lParam) +{ + CExecutableRscs* pIcons = reinterpret_cast(a_lParam); + if (IS_INTRESOURCE(a_pszName)) + { + pIcons->push_back(std::make_pair(a_pszName, a_wIDLanguage)); + } + else + { + LPCTSTR pszCopy = _tcsdup(a_pszName); + if (pszCopy != NULL) + { + pIcons->push_back(std::make_pair(pszCopy, a_wIDLanguage)); + } + } + return TRUE; +} +BOOL CALLBACK EnumRscs(HMODULE a_hModule, LPCTSTR a_pszType, LPTSTR a_pszName, LONG_PTR a_lParam) +{ + return EnumResourceLanguages(a_hModule, a_pszType, a_pszName, EnumRscLangs, a_lParam); +} + +void DeleteExecutableIcons(CExecutableRscs& a_cRscs) +{ + for (CExecutableRscs::iterator i = a_cRscs.begin(); i != a_cRscs.end(); i++) + { + if (!IS_INTRESOURCE(i->first)) + free(const_cast(i->first)); + } + a_cRscs.clear(); +} + + +#pragma pack( push ) +#pragma pack( 2 ) +typedef struct +{ + BYTE bWidth; // Width, in pixels, of the image + BYTE bHeight; // Height, in pixels, of the image + BYTE bColorCount; // Number of colors in image (0 if >=8bpp) + BYTE bReserved; // Reserved + WORD wPlanes; // Color Planes + WORD wBitCount; // Bits per pixel + DWORD dwBytesInRes; // how many bytes in this resource? + WORD nID; // the ID +} GRPICONDIRENTRY, *LPGRPICONDIRENTRY; + +typedef struct +{ + WORD idReserved; // Reserved (must be 0) + WORD idType; // Resource type (1 for icons) + WORD idCount; // How many images? + GRPICONDIRENTRY idEntries[1]; // The entries for each image +} GRPICONDIR, *LPGRPICONDIR; + +typedef struct +{ + BYTE bWidth; + BYTE bHeight; + BYTE bColorCount; + BYTE bReserved; + WORD wPlanes; + WORD wBitCount; + DWORD dwBytesInRes; + DWORD dwFileOffset; +} FILEGRPICONDIRENTRY; + +typedef struct +{ + WORD idReserved; + WORD idType; + WORD idCount; + FILEGRPICONDIRENTRY idEntries[1]; +} FILEGRPICONDIR; + +#pragma pack( pop ) + +void ReplaceIcon(BYTE const* a_pData, HANDLE a_hRes, LPCTSTR a_pszResID, WORD a_wLangID, CExecutableRscs const& a_cUsedImageIDs, std::set& a_cFreeImageIDs) +{ + UINT nNextImageID = 1; + FILEGRPICONDIR const* pFile = reinterpret_cast(a_pData); + int nDirSize = sizeof(GRPICONDIR)+(int(pFile->idCount)-1)*sizeof(GRPICONDIRENTRY); + GRPICONDIR* pHead = reinterpret_cast(new BYTE[nDirSize]); + pHead->idReserved = pFile->idReserved; + pHead->idType = pFile->idType; + pHead->idCount = pFile->idCount; + for (WORD i = 0; i < pFile->idCount; ++i) + { + pHead->idEntries[i].bWidth = pFile->idEntries[i].bWidth; + pHead->idEntries[i].bHeight = pFile->idEntries[i].bHeight; + pHead->idEntries[i].bColorCount = pFile->idEntries[i].bColorCount; + pHead->idEntries[i].bReserved = pFile->idEntries[i].bReserved; + pHead->idEntries[i].wPlanes = pFile->idEntries[i].wPlanes; + pHead->idEntries[i].wBitCount = pFile->idEntries[i].wBitCount; + pHead->idEntries[i].dwBytesInRes = pFile->idEntries[i].dwBytesInRes; + if (a_cFreeImageIDs.empty()) + { + // find free id + for (CExecutableRscs::const_iterator j = a_cUsedImageIDs.begin(); j != a_cUsedImageIDs.end(); ++j) + { + if (UINT(j->first) == nNextImageID) + { + ++nNextImageID; + j = a_cUsedImageIDs.begin(); + } + } + pHead->idEntries[i].nID = nNextImageID; + ++nNextImageID; + } + else + { + pHead->idEntries[i].nID = *a_cFreeImageIDs.begin(); + a_cFreeImageIDs.erase(a_cFreeImageIDs.begin()); + } + } + + UpdateResource(a_hRes, RT_GROUP_ICON, a_pszResID, a_wLangID, pHead, nDirSize); + for (WORD i = 0; i < pFile->idCount; ++i) + { + UpdateResource(a_hRes, RT_ICON, MAKEINTRESOURCE(pHead->idEntries[i].nID), a_wLangID, const_cast(a_pData)+pFile->idEntries[i].dwFileOffset, pFile->idEntries[i].dwBytesInRes); + } + for (std::set::const_iterator i = a_cFreeImageIDs.begin(); i != a_cFreeImageIDs.end(); ++i) + { + UpdateResource(a_hRes, RT_ICON, MAKEINTRESOURCE(*i), a_wLangID, NULL, 0); + } +} + +int _tmain(int argc, _TCHAR* argv[]) +{ + if (argc < 3 || argc > 5) + { + _tprintf(_T("\nUsage: SetVistaIcon.exe path_to_executable path_to_icon [icon_ID [language_ID]]\n\nMore info: http://www.rw-designer.com/compile-vista-icon\n\n")); + return 1; + } + + HMODULE hMod = LoadLibraryEx(argv[1], NULL, LOAD_LIBRARY_AS_DATAFILE); + if (NULL == hMod) + { + _tprintf(_T("\nFailed to open \"%s\"\n\n"), argv[1]); + return 1; + } + + CExecutableRscs cIconGroups; + EnumResourceNames(hMod, RT_GROUP_ICON, EnumRscs, reinterpret_cast(&cIconGroups)); + //for (CExecutableRscs::const_iterator i = cIconGroups.begin(); i != cIconGroups.end(); ++i) + //{ + // _tprintf(_T("Icon group %i, %i\n"), int(i->first), int(i->second)); + //} + + CExecutableRscs cIconImages; + EnumResourceNames(hMod, RT_ICON, EnumRscs, reinterpret_cast(&cIconImages)); + //for (CExecutableRscs::const_iterator i = cIconImages.begin(); i != cIconImages.end(); ++i) + //{ + // _tprintf(_T("Icon image %i, %i\n"), int(i->first), int(i->second)); + //} + + LPCTSTR resid; + WORD langid; + if (argc > 3) + { + int x = _ttoi(argv[3]); + resid = x ? MAKEINTRESOURCE(x) : argv[3]; + if (argc > 4) + { + langid = _ttoi(argv[4]); + } + else + { + langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); + for (CExecutableRscs::const_iterator i = cIconGroups.begin(); i != cIconGroups.end(); ++i) + { + if (!IS_INTRESOURCE(i->first) && !IS_INTRESOURCE(resid) ? 0 == _tcscmp(i->first, resid) : i->first == resid) + { + langid = i->second; + break; + } + } + } + } + else + { + if (cIconGroups.size()) + { + resid = cIconGroups[0].first; + langid = cIconGroups[0].second; + } + else + { + resid = MAKEINTRESOURCE(101); + langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); + } + } + + std::set cImagesToRemove; + HRSRC hIconDir = FindResourceEx(hMod, RT_GROUP_ICON, resid, langid); + if (hIconDir) + { + HGLOBAL hDirMem = LoadResource(hMod, hIconDir); + LPGRPICONDIR pDirMem = reinterpret_cast(LockResource(hDirMem)); + for (WORD i = 0; i != pDirMem->idCount; i++) + { + cImagesToRemove.insert(pDirMem->idEntries[i].nID); + } + } + + FreeLibrary(hMod); + + // access resources in executable file + HANDLE hRes = BeginUpdateResource(argv[1], FALSE); + if (NULL == hRes) + { + _tprintf(_T("\nFailed to access resources in \"%s\"\n\n"), argv[1]); + return 1; + } + + // read the icon file + HANDLE hIconFile = CreateFile(argv[2], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + if (INVALID_HANDLE_VALUE == hIconFile) + { + _tprintf(_T("\nFailed to open icon file \"%s\"\n\n"), argv[2]); + EndUpdateResource(hRes, TRUE); + return 1; + } + DWORD dwSize = GetFileSize(hIconFile, NULL); + CAutoVectorPtr pData(new BYTE[dwSize]); + DWORD dwRead = 0; + if (pData) + ReadFile(hIconFile, pData, dwSize, &dwRead, NULL); + CloseHandle(hIconFile); + if (dwSize == 0 || dwSize != dwRead) + { + _tprintf(_T("\nFailed to read icon file \"%s\"\n\n"), argv[2]); + if (pData) free(pData); + EndUpdateResource(hRes, TRUE); + return 1; + } + ReplaceIcon(pData, hRes, resid, langid, cIconImages, cImagesToRemove); + if (FALSE == EndUpdateResource(hRes, FALSE)) + { + _tprintf(_T("\nFailed to update resources\n\n")); + return 1; + } + + return 0; +} + diff --git a/ReplaceVistaIcon/SetVistaIcon.rc b/ReplaceVistaIcon/SetVistaIcon.rc new file mode 100644 index 0000000..1c4ef01 --- /dev/null +++ b/ReplaceVistaIcon/SetVistaIcon.rc @@ -0,0 +1,103 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "Latest version at http://www.rw-designer.com/compile-vista-icon" + VALUE "CompanyName", "RealWorld Graphics" + VALUE "FileDescription", "Replace or add Vista icons into executables." + VALUE "FileVersion", "1.0" + VALUE "InternalName", "ReplaceVistaIcon" + VALUE "LegalCopyright", "Copyright (C) 2006 Vlastimil Mil" + VALUE "OriginalFilename", "ReplaceVistaIcon.exe" + VALUE "ProductName", "ReplaceVistaIcon" + VALUE "ProductVersion", "1.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/ReplaceVistaIcon/resource.h b/ReplaceVistaIcon/resource.h new file mode 100644 index 0000000..8fd92cb --- /dev/null +++ b/ReplaceVistaIcon/resource.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by SetVistaIcon.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/ReplaceVistaIcon/stdafx.cpp b/ReplaceVistaIcon/stdafx.cpp new file mode 100644 index 0000000..2d0c34f --- /dev/null +++ b/ReplaceVistaIcon/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// SetVistaIcon.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/ReplaceVistaIcon/stdafx.h b/ReplaceVistaIcon/stdafx.h new file mode 100644 index 0000000..b15796e --- /dev/null +++ b/ReplaceVistaIcon/stdafx.h @@ -0,0 +1,17 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include + + +#include +#include +#include + +#define UNREF(x) diff --git a/ResizableLib/Artistic-License.txt b/ResizableLib/Artistic-License.txt new file mode 100644 index 0000000..5b5e855 --- /dev/null +++ b/ResizableLib/Artistic-License.txt @@ -0,0 +1,99 @@ +The Artistic License + +Preamble + +The intent of this document is to state the conditions under which a Package +may be copied, such that the Copyright Holder maintains some semblance of +artistic control over the development of the package, while giving the users of +the package the right to use and distribute the Package in a more-or-less +customary fashion, plus the right to make reasonable modifications. + +Definitions: + + * "Package" refers to the collection of files distributed by the Copyright + Holder, and derivatives of that collection of files created through textual + modification. + * "Standard Version" refers to such a Package if it has not been modified, + or has been modified in accordance with the wishes of the Copyright Holder. + * "Copyright Holder" is whoever is named in the copyright or copyrights for + the package. + * "You" is you, if you're thinking about copying or distributing this + Package. + * "Reasonable copying fee" is whatever you can justify on the basis of media + cost, duplication charges, time of people involved, and so on. (You will not + be required to justify it to the Copyright Holder, but only to the computing + community at large as a market that must bear the fee.) + * "Freely Available" means that no fee is charged for the item itself, + though there may be fees involved in handling the item. It also means that + recipients of the item may redistribute it under the same conditions they + received it. + +1. You may make and give away verbatim copies of the source form of the + Standard Version of this Package without restriction, provided that you + duplicate all of the original copyright notices and associated disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications derived + from the Public Domain or from the Copyright Holder. A Package modified in such + a way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided + that you insert a prominent notice in each changed file stating how and when you + changed that file, and provided that you do at least ONE of the following: + + a) place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet or an + equivalent medium, or placing the modifications on a major archive site such + as ftp.uu.net, or by allowing the Copyright Holder to include your + modifications in the Standard Version of the Package. + + b) use the modified Package only within your corporation or + organization. + + c) rename any non-standard executables so the names do not conflict with + standard executables, which must also be provided, and provide a separate + manual page for each non-standard executable that clearly documents how it + differs from the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or + executable form, provided that you do at least ONE of the following: + + a) distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on where to get + the Standard Version. + + b) accompany the distribution with the machine-readable source of the + Package with your modifications. + + c) accompany any non-standard executables with their corresponding Standard + Version executables, giving the non-standard executables non-standard names, + and clearly documenting the differences in manual pages (or equivalent), + together with instructions on where to get the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this + Package. You may charge any fee you choose for support of this Package. You may + not charge a fee for this Package itself. However, you may distribute this + Package in aggregate with other (possibly commercial) programs as part of a + larger (possibly commercial) software distribution provided that you do not + advertise this Package as a product of your own. + +6. The scripts and library files supplied as input to or produced as output + from the programs of this Package do not automatically fall under the copyright + of this Package, but belong to whomever generated them, and may be sold + commercially, and may be aggregated with this Package. + +7. C or perl subroutines supplied by you and linked into this Package shall + not be considered part of this Package. + +8. The name of the Copyright Holder may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +The End diff --git a/ResizableLib/ChangeLog.txt b/ResizableLib/ChangeLog.txt new file mode 100644 index 0000000..d8de2bc --- /dev/null +++ b/ResizableLib/ChangeLog.txt @@ -0,0 +1,475 @@ +2002-10-16 ppescher + * ResizableLayout.cpp 1.26: + fixed BS_TYPEMASK collision with Platform SDK + + * ResizableFormView.cpp 1.14: + adjusted a commented code part + + * ResizableDialog.cpp 1.18: + fixed border/grip issue with child dialogs + +2002-10-13 ppescher + * ResizableLib.dsp 1.10: + initial support for custom windows + + * ResizableSheet.cpp 1.22: + * ResizableSheetEx.cpp 1.19: + updated callback item, now using GetAnchorPosition + + * ResizableLayout.cpp 1.25: + * ResizableLayout.h 1.15: + added initial support for custom windows + unified repositioning of all windows (callback and non), now made all at once + +2002-10-12 ppescher + * ResizableMsgSupport.h 1.1: + * ResizableMsgSupport.inl 1.1: + initial support for custom windows + +2002-10-07 ppescher + * ResizableLayout.cpp 1.24: + fixed groupbox + (adding WS_CLIPSIBLINGS leads to uncorrect results when overlapping other controls) + +2002-10-06 ppescher + * ResizableFrame.cpp 1.2: + * ResizableFrame.h 1.2: + * ResizableMDIChild.cpp 1.2: + * ResizableMDIChild.h 1.2: + * ResizableMDIFrame.cpp 1.2: + * ResizableMDIFrame.h 1.2: + added support for state saving/restoring + min track size not fully working with splitters + + * ResizableDialog.cpp 1.17: + * ResizableSheet.cpp 1.21: + * ResizableSheetEx.cpp 1.18: + updated grip creation + + * ResizableGrip.cpp 1.11: + * ResizableGrip.h 1.12: + added shape customization + added listening for system parameters changes (to update grip size) + + * ResizableFormView.cpp 1.13: + * ResizableFormView.h 1.8: + added OnDestroy handler + updated grip creation + +2002-09-28 ppescher + * ResizableFormView.cpp 1.12: + * ResizableFormView.h 1.7: + changed grip handling + finished support for minmax handling + + * ResizableGrip.cpp 1.10: + * ResizableGrip.h 1.11: + changed hide/show functions + + * ResizableDialog.cpp 1.16: + * ResizableDialog.h 1.10: + * ResizableSheet.cpp 1.20: + * ResizableSheet.h 1.12: + * ResizableSheetEx.cpp 1.17: + * ResizableSheetEx.h 1.9: + updated grip handling when maximized according to latest grip implementation + + * ResizableLib.dsp 1.9: + added new classes + + * ResizableFrame.cpp 1.1: + * ResizableFrame.h 1.1: + * ResizableMDIChild.cpp 1.1: + * ResizableMDIChild.h 1.1: + * ResizableMDIFrame.cpp 1.1: + * ResizableMDIFrame.h 1.1: + added minmax implementation for Frame windows + +2002-09-23 ppescher + * ResizableGrip.cpp 1.9: + * ResizableGrip.h 1.10: + added transparency support + + * ResizableLayout.cpp 1.23: + fix for ownerdraw buttons + fixed duplicate additions to the layout (now ASSERTs) + + * ResizableFormView.cpp 1.11: + * ResizableFormView.h 1.6: + fixed the grip + +2002-09-21 ppescher + * ResizableLayout.cpp 1.22: + complete fix for scrolled parent + + * ResizableGrip.cpp 1.8: + * ResizableGrip.h 1.9: + enhanced grip: added support for temporarily hide/show the grip + + * ResizableFormView.cpp 1.10: + * ResizableFormView.h 1.5: + added grip support + + * ResizableDialog.cpp 1.15: + * ResizableSheet.cpp 1.19: + * ResizableSheetEx.cpp 1.16: + updated for the enhanced grip + +2002-09-19 ppescher + * ResizableFormView.cpp 1.9: + * ResizableLayout.cpp 1.21: + fixed FormView scroll problem + +2002-09-14 ppescher + * ResizableLayout.cpp 1.20: + cleaned up the code + updated copyright + +2002-08-23 ppescher + * ResizableDialog.cpp 1.14: + * ResizableDialog.h 1.9: + * ResizableFormView.cpp 1.8: + * ResizableFormView.h 1.4: + * ResizableGrip.cpp 1.7: + * ResizableGrip.h 1.8: + * ResizableLayout.cpp 1.19: + * ResizableLayout.h 1.14: + * ResizableMinMax.cpp 1.3: + * ResizableMinMax.h 1.3: + * ResizablePage.cpp 1.8: + * ResizablePage.h 1.7: + * ResizablePageEx.cpp 1.10: + * ResizablePageEx.h 1.7: + * ResizableSheet.cpp 1.18: + * ResizableSheet.h 1.11: + * ResizableSheetEx.cpp 1.15: + * ResizableSheetEx.h 1.8: + * ResizableState.cpp 1.5: + * ResizableState.h 1.5: + fixed copyright msg + +2002-07-11 ppescher + * ResizablePageEx.cpp 1.9: + * ResizablePageEx.h 1.6: + changes for new NeedsRefresh function + + * ResizableLayout.cpp 1.18: + * ResizableLayout.h 1.13: + many improvements for anti-flickering + changes in internal layout implementation + changes in clipping and refresh functions + +2002-07-01 ppescher + * ResizableDialog.cpp 1.13: + * ResizableDialog.h 1.8: + * ResizablePage.cpp 1.7: + * ResizablePage.h 1.6: + * ResizablePageEx.cpp 1.8: + * ResizablePageEx.h 1.5: + * ResizableSheet.cpp 1.17: + * ResizableSheet.h 1.10: + * ResizableSheetEx.cpp 1.14: + * ResizableSheetEx.h 1.7: + cleaned up the code + removed m_bInitDone (not needed) + + * ResizableGrip.cpp 1.6: + * ResizableGrip.h 1.7: + changed grip implementation (using MFC derived class) + +2002-06-27 ppescher + * ResizableLayout.cpp 1.17: + * ResizableLayout.h 1.12: + added remove anchor and get layout info functions + changed layout implementation + +2002-05-26 ppescher + * ResizableLayout.cpp 1.16: + fix for type of static control + +2002-05-16 ppescher + * ResizableSheet.cpp 1.16: + * ResizableSheet.h 1.9: + * ResizableSheetEx.cpp 1.13: + * ResizableSheetEx.h 1.6: + added refresh function for dynamic page changes + +2002-05-15 ppescher + * ResizableSheet.cpp 1.15: + * ResizableSheetEx.cpp 1.12: + partial fix for dynamic page changes (Add/RemovePage) + +2002-03-27 ppescher + * ResizableLayout.cpp 1.15: + * ResizableLib.dsp 1.8: + fix callbacks and project precompiled headers + +2002-03-12 ppescher + * ResizableLayout.h 1.11: + * ResizableLib.dsp 1.7: + * ResizablePageEx.cpp 1.7: + * ResizableSheetEx.cpp 1.11: + * StdAfx.h 1.4: + fix for VS.NET and commctls + +2002-02-27 ppescher + * ResizableComboBox.cpp [RCombo_NewList] 1.4.2.1: + * ResizableComboBox.h [RCombo_NewList] 1.4.2.1: + * ResizableComboLBox.cpp [RCombo_NewList] 1.6.2.1: + * ResizableComboLBox.h [RCombo_NewList] 1.6.2.1: + first attempt at a new list class + +2002-02-26 ppescher + * ResizableComboBox.cpp 1.4: + * ResizableComboBox.h 1.4: + * ResizableComboLBox.cpp 1.6: + * ResizableComboLBox.h 1.6: + moved some functions, fixed vscroll + +2002-02-25 ppescher + * ResizableComboBox.cpp 1.3: + * ResizableComboBox.h 1.3: + * ResizableComboLBox.cpp 1.5: + * ResizableComboLBox.h 1.5: + moved hscroll functions + +2002-02-24 ppescher + * ResizableComboLBox.cpp 1.4: + * ResizableComboLBox.h 1.4: + * ResizableGrip.cpp 1.5: + * ResizableGrip.h 1.6: + * ResizableLayout.cpp 1.14: + * StdAfx.h 1.3: + fixed RTL defines and functions and include files + +2002-02-23 ppescher + * ResizableDialog.cpp 1.12: + * ResizableFormView.cpp 1.7: + * ResizableLayout.cpp 1.13: + * ResizableLayout.h 1.10: + * ResizablePage.cpp 1.6: + * ResizablePageEx.cpp 1.6: + * ResizableSheet.cpp 1.14: + * ResizableSheetEx.cpp 1.10: + fixed background painting for RTL layouts + + * ResizableComboBox.cpp 1.2: + * ResizableComboBox.h 1.2: + * ResizableComboLBox.cpp 1.3: + * ResizableComboLBox.h 1.3: + added support for auto-hscroll + +2002-02-22 ppescher + * StdAfx.h 1.2: + fix WINVER with latest SDK, for Wizard97 to work properly + + * ResizableDialog.cpp 1.11: + * ResizableFormView.cpp 1.6: + * ResizablePage.cpp 1.5: + * ResizablePageEx.cpp 1.5: + * ResizableSheet.cpp 1.13: + * ResizableSheetEx.cpp 1.9: + fix for WinXP clipping region + +2002-02-21 ppescher + * ResizableDialog.cpp 1.10: + * ResizableDialog.h 1.7: + * ResizableFormView.cpp 1.5: + * ResizableFormView.h 1.3: + * ResizablePage.cpp 1.4: + * ResizablePage.h 1.5: + * ResizablePageEx.cpp 1.4: + * ResizablePageEx.h 1.4: + * ResizableSheet.cpp 1.12: + * ResizableSheet.h 1.8: + * ResizableSheetEx.cpp 1.8: + * ResizableSheetEx.h 1.5: + changed common constructor name + +2002-02-19 ppescher + * ResizableComboLBox.cpp 1.2: + * ResizableComboLBox.h 1.2: + second attempt (slightly better) + +2002-02-18 ppescher + * ResizableGrip.h 1.5: + fixed a define for compatibility with latest SDK + + * ResizableComboBox.cpp 1.1: + * ResizableComboBox.h 1.1: + * ResizableComboLBox.cpp 1.1: + * ResizableComboLBox.h 1.1: + * ResizableLib.dsp 1.6: + added resizable combobox classes + +2002-02-09 ppescher + * ResizableDialog.cpp 1.9: + possible fix for WinXP clipping region (commented) + + * ResizableLayout.cpp 1.12: + * ResizableLayout.h 1.9: + changed clipping method, working on a stand-alone region + +2002-02-04 ppescher + * ResizableLayout.cpp 1.11: + * ResizableSheet.cpp 1.11: + * ResizableSheetEx.cpp 1.7: + fix for RTL layouts + fix for maximum size clipping problem + +2001-10-06 ppescher + * ResizableFormView.cpp 1.4: + re-ordered GetTotalClientRect() code + +2001-10-05 ppescher + * ResizableLayout.cpp 1.10: + * ResizableLayout.h 1.8: + cosmetic stuff (variable names) + + * ResizableSheet.cpp 1.10: + * ResizableSheet.h 1.7: + * ResizableSheetEx.cpp 1.6: + * ResizableSheetEx.h 1.4: + fix for [CTRL+Tab] when switching pages + +2001-08-22 ppescher + * ResizableDialog.cpp 1.8: + * ResizableSheet.cpp 1.9: + * ResizableSheetEx.cpp 1.5: + fixed initialization for windows with menu bar + +2001-08-17 ppescher + * .cvsignore 1.2: + added static build configurations + +2001-08-16 ppescher + * ResizableLib.dsp 1.5: + added static build configurations + +2001-08-10 ppescher + * ResizableDialog.cpp 1.7: + * ResizableSheet.cpp 1.8: + * ResizableSheetEx.cpp 1.4: + fixed sizing border bug (client area preserved now) + +2001-08-05 Administrator + * Docs/DoDoxygen.bat 1.1: + * Docs/doxyfile.txt 1.1: + * ResizableDialog.cpp 1.6: + * ResizableDialog.h 1.6: + * ResizableFormView.cpp 1.3: + * ResizableFormView.h 1.2: + * ResizableGrip.cpp 1.4: + * ResizableGrip.h 1.4: + * ResizableLayout.cpp 1.9: + * ResizableLayout.h 1.7: + * ResizableLib.dsp 1.4: + * ResizableMinMax.cpp 1.2: + * ResizableMinMax.h 1.2: + * ResizablePage.cpp 1.3: + * ResizablePage.h 1.4: + * ResizablePageEx.cpp 1.3: + * ResizablePageEx.h 1.3: + * ResizableSheet.cpp 1.7: + * ResizableSheet.h 1.6: + * ResizableSheetEx.cpp 1.3: + * ResizableSheetEx.h 1.3: + * ResizableState.cpp 1.4: + * ResizableState.h 1.4: + added doc + + * Artistic-License.txt 1.1: + changed license to AL + + * ResizableFormView.cpp 1.2: + now uses documented function to calc total client area + fix for non-scrollable forms + +2001-08-01 Administrator + * ResizableLayout.cpp 1.8: + fixed transparent toolbars + +2001-07-21 Administrator + * ResizableLayout.cpp 1.7: + * ResizableLayout.h 1.6: + fixed problems with clipping overlapped controls + now you must add anchors in order of inclusion + fixed problem with transparent toolbars (I was clipping device units) + +2001-07-06 paolo + * ResizableDialog.cpp 1.5: + * ResizableDialog.h 1.5: + * ResizableGrip.cpp 1.3: + * ResizableGrip.h 1.3: + * ResizableLayout.cpp 1.6: + * ResizableLayout.h 1.5: + * ResizableLib.dsp 1.3: + * ResizablePageEx.cpp 1.2: + * ResizablePageEx.h 1.2: + * ResizableSheet.cpp 1.6: + * ResizableSheet.h 1.5: + * ResizableSheetEx.cpp 1.2: + * ResizableSheetEx.h 1.2: + global updates + +2001-06-18 paolo + * ResizableFormView.cpp 1.1: + * ResizableFormView.h 1.1: + * ResizableLayout.cpp 1.5: + * ResizableLayout.h 1.4: + * ResizableLib.dsp 1.2: + * ResizablePageEx.cpp 1.1: + * ResizablePageEx.h 1.1: + * ResizableSheet.cpp 1.5: + * ResizableSheet.h 1.4: + * ResizableSheetEx.cpp 1.1: + * ResizableSheetEx.h 1.1: + added wizard97 dialogs + added formviews + integration of property sheets + +2001-06-08 paolo + * ResizableDialog.cpp 1.4: + * ResizableDialog.h 1.4: + * ResizableLayout.cpp 1.3: + * ResizableLayout.h 1.3: + * ResizablePage.cpp 1.2: + * ResizablePage.h 1.3: + anti-flickering added + + * ResizableLayout.cpp 1.4: + * ResizableSheet.cpp 1.4: + corrections to DeferWindowPos (returned value incorrectly + discarded) + +2001-05-23 paolo + * ResizableDialog.cpp 1.3: + * ResizableDialog.h 1.3: + * ResizableSheet.cpp 1.3: + * ResizableSheet.h 1.3: + * ResizableState.cpp 1.3: + * ResizableState.h 1.3: + new save/restore version - if bRectOnly, uses screen coords + + * ResizableDialog.cpp 1.2: + * ResizableDialog.h 1.2: + * ResizableGrip.cpp 1.2: + * ResizableGrip.h 1.2: + * ResizableLayout.cpp 1.2: + * ResizableLayout.h 1.2: + * ResizablePage.h 1.2: + * ResizableSheet.cpp 1.2: + * ResizableSheet.h 1.2: + * ResizableState.cpp 1.2: + * ResizableState.h 1.2: + changed save/restore allowing to be performed on window rect only + changed GetLayoutParent to GetResizableWnd + added GetResizableWnd to CResizableState + +2001-05-18 paolo + * ResizableLib.dsp 1.1: + * ResizableLib.dsw 1.1: + * StdAfx.cpp 1.1: + * StdAfx.h 1.1: + new ResizableLib with project settings working + diff --git a/ResizableLib/ResizableDialog.cpp b/ResizableLib/ResizableDialog.cpp new file mode 100644 index 0000000..3e35040 --- /dev/null +++ b/ResizableLib/ResizableDialog.cpp @@ -0,0 +1,161 @@ +// ResizableDialog.cpp : implementation file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizableDialog.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CResizableDialog + +inline void CResizableDialog::PrivateConstruct() +{ + m_bEnableSaveRestore = FALSE; + m_dwGripTempState = 1; +} + +CResizableDialog::CResizableDialog() +{ + PrivateConstruct(); +} + +CResizableDialog::CResizableDialog(UINT nIDTemplate, CWnd* pParentWnd) + : CDialog(nIDTemplate, pParentWnd) +{ + PrivateConstruct(); +} + +CResizableDialog::CResizableDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd) + : CDialog(lpszTemplateName, pParentWnd) +{ + PrivateConstruct(); +} + +CResizableDialog::~CResizableDialog() +{ +} + + +BEGIN_MESSAGE_MAP(CResizableDialog, CDialog) + //{{AFX_MSG_MAP(CResizableDialog) + ON_WM_GETMINMAXINFO() + ON_WM_SIZE() + ON_WM_DESTROY() + ON_WM_CREATE() + ON_WM_ERASEBKGND() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + + +///////////////////////////////////////////////////////////////////////////// +// CResizableDialog message handlers + +int CResizableDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CDialog::OnCreate(lpCreateStruct) == -1) + return -1; + + // child dialogs don't want resizable border or size grip, + // nor they can handle the min/max size constraints + BOOL bChild = GetStyle() & WS_CHILD; + + if (!bChild) + { + // keep client area + CRect rect; + GetClientRect(&rect); + // set resizable style + ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME); + // adjust size to reflect new style + ::AdjustWindowRectEx(&rect, GetStyle(), + ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle()); + SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED| + SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION); + + // set the initial size as the min track size + SetMinTrackSize(rect.Size()); + } + + // create and init the size-grip + if (!CreateSizeGrip(!bChild)) + return -1; + + return 0; +} + +void CResizableDialog::OnDestroy() +{ + if (m_bEnableSaveRestore) + SaveWindowRect(m_sSection, m_bRectOnly); + + // remove child windows + RemoveAllAnchors(); + + CDialog::OnDestroy(); +} + +void CResizableDialog::OnSize(UINT nType, int cx, int cy) +{ + CWnd::OnSize(nType, cx, cy); + + if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW) + return; // arrangement not needed + + if (nType == SIZE_MAXIMIZED) + HideSizeGrip(&m_dwGripTempState); + else + ShowSizeGrip(&m_dwGripTempState); + + // update grip and layout + UpdateSizeGrip(); + ArrangeLayout(); +} + +void CResizableDialog::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +{ + MinMaxInfo(lpMMI); +} + +// NOTE: this must be called after setting the layout +// to have the dialog and its controls displayed properly +void CResizableDialog::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly) +{ + m_sSection = pszSection; + + m_bEnableSaveRestore = TRUE; + m_bRectOnly = bRectOnly; + + // restore immediately + LoadWindowRect(pszSection, bRectOnly); +} + + +BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC) +{ + // Windows XP doesn't like clipping regions ...try this! + EraseBackground(pDC); + return TRUE; + +/* ClipChildren(pDC); // old-method (for safety) + + return CDialog::OnEraseBkgnd(pDC); +*/ +} diff --git a/ResizableLib/ResizableDialog.h b/ResizableLib/ResizableDialog.h new file mode 100644 index 0000000..204458c --- /dev/null +++ b/ResizableLib/ResizableDialog.h @@ -0,0 +1,100 @@ +#if !defined(AFX_RESIZABLEDIALOG_H__INCLUDED_) +#define AFX_RESIZABLEDIALOG_H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +// ResizableDialog.h : header file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "ResizableLayout.h" +#include "ResizableGrip.h" +#include "ResizableMinMax.h" +#include "ResizableState.h" + +///////////////////////////////////////////////////////////////////////////// +// CResizableDialog window + +class CResizableDialog : public CDialog, public CResizableLayout, + public CResizableGrip, public CResizableMinMax, + public CResizableState +{ + +// Construction +public: + CResizableDialog(); + CResizableDialog(UINT nIDTemplate, CWnd* pParentWnd = NULL); + CResizableDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL); + +// Attributes +private: + // support for temporarily hiding the grip + DWORD m_dwGripTempState; + + // flags + BOOL m_bEnableSaveRestore; + BOOL m_bRectOnly; + + // internal status + CString m_sSection; // section name (identifies a parent window) + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CResizableDialog) + protected: + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CResizableDialog(); + +// used internally +private: + void PrivateConstruct(); + +// callable from derived classes +protected: + // section to use in app's profile + void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE); + + virtual CWnd* GetResizableWnd() + { + // make the layout know its parent window + return this; + }; + +// Generated message map functions +protected: + //{{AFX_MSG(CResizableDialog) + afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnDestroy(); + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_RESIZABLEDIALOG_H__INCLUDED_) diff --git a/ResizableLib/ResizableFormView.cpp b/ResizableLib/ResizableFormView.cpp new file mode 100644 index 0000000..bbebade --- /dev/null +++ b/ResizableLib/ResizableFormView.cpp @@ -0,0 +1,195 @@ +// ResizableFormView.cpp : implementation file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizableFormView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CResizableFormView + +IMPLEMENT_DYNAMIC(CResizableFormView, CFormView) + +inline void CResizableFormView::PrivateConstruct() +{ + m_bInitDone = FALSE; + m_dwGripTempState = GHR_SCROLLBAR | GHR_ALIGNMENT | GHR_MAXIMIZED; +} + +CResizableFormView::CResizableFormView(UINT nIDTemplate) + : CFormView(nIDTemplate) +{ + PrivateConstruct(); +} + +CResizableFormView::CResizableFormView(LPCTSTR lpszTemplateName) + : CFormView(lpszTemplateName) +{ + PrivateConstruct(); +} + +CResizableFormView::~CResizableFormView() +{ +} + + +BEGIN_MESSAGE_MAP(CResizableFormView, CFormView) + //{{AFX_MSG_MAP(CResizableFormView) + ON_WM_SIZE() + ON_WM_ERASEBKGND() + ON_WM_CREATE() + ON_WM_GETMINMAXINFO() + ON_WM_DESTROY() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CResizableFormView diagnostics + +#ifdef _DEBUG +void CResizableFormView::AssertValid() const +{ + CFormView::AssertValid(); +} + +void CResizableFormView::Dump(CDumpContext& dc) const +{ + CFormView::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CResizableFormView message handlers + +void CResizableFormView::OnSize(UINT nType, int cx, int cy) +{ + CFormView::OnSize(nType, cx, cy); + + CWnd* pParent = GetParent(); + + // hide zise grip when parent is maximized + if (pParent->IsZoomed()) + HideSizeGrip(&m_dwGripTempState, GHR_MAXIMIZED); + else + ShowSizeGrip(&m_dwGripTempState, GHR_MAXIMIZED); + + // hide size grip when there are scrollbars + CSize size = GetTotalSize(); + if (cx < size.cx || cy < size.cy) + HideSizeGrip(&m_dwGripTempState, GHR_SCROLLBAR); + else + ShowSizeGrip(&m_dwGripTempState, GHR_SCROLLBAR); + + // hide size grip when the parent window is not resizable + // or the form is not bottom-right aligned (e.g. there's a statusbar) + DWORD dwStyle = pParent->GetStyle(); + CRect rectParent, rectChild; + GetWindowRect(rectChild); + ::MapWindowPoints(NULL, pParent->GetSafeHwnd(), (LPPOINT)&rectChild, 2); + pParent->GetClientRect(rectParent); + if (!(dwStyle & WS_THICKFRAME) + || (rectChild.BottomRight() != rectParent.BottomRight())) + HideSizeGrip(&m_dwGripTempState, GHR_ALIGNMENT); + else + ShowSizeGrip(&m_dwGripTempState, GHR_ALIGNMENT); + + // update grip and layout + UpdateSizeGrip(); + ArrangeLayout(); +} + +void CResizableFormView::OnInitialUpdate() +{ + CFormView::OnInitialUpdate(); + + m_bInitDone = TRUE; + + // MDI child need this + ArrangeLayout(); +} + +void CResizableFormView::GetTotalClientRect(LPRECT lpRect) +{ + GetClientRect(lpRect); + + // get dialog template's size + // (this is set in CFormView::Create) + CSize size = GetTotalSize(); + + // before initialization use dialog's size + if (!m_bInitDone) + { + lpRect->right = lpRect->left + size.cx; + lpRect->bottom = lpRect->top + size.cy; + return; + } + + // otherwise, give the correct size if scrollbars active + + if (m_nMapMode < 0) // scrollbars disabled + return; + + // enlarge reported client area when needed + CRect rect(lpRect); + if (rect.Width() < size.cx) + rect.right = rect.left + size.cx; + if (rect.Height() < size.cy) + rect.bottom = rect.top + size.cy; + + rect.OffsetRect(-GetScrollPosition()); + *lpRect = rect; +} + +BOOL CResizableFormView::OnEraseBkgnd(CDC* pDC) +{ + // Windows XP doesn't like clipping regions ...try this! + EraseBackground(pDC); + return TRUE; + +/* ClipChildren(pDC); // old-method (for safety) + + return CFormView::OnEraseBkgnd(pDC); +*/ +} + +int CResizableFormView::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CFormView::OnCreate(lpCreateStruct) == -1) + return -1; + + // create and init the size-grip + if (!CreateSizeGrip()) + return -1; + + return 0; +} + +void CResizableFormView::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +{ + MinMaxInfo(lpMMI); +} + +void CResizableFormView::OnDestroy() +{ + RemoveAllAnchors(); + + CFormView::OnDestroy(); +} diff --git a/ResizableLib/ResizableFormView.h b/ResizableLib/ResizableFormView.h new file mode 100644 index 0000000..bbd2764 --- /dev/null +++ b/ResizableLib/ResizableFormView.h @@ -0,0 +1,109 @@ +#if !defined(AFX_RESIZABLEFORMVIEW_H__INCLUDED_) +#define AFX_RESIZABLEFORMVIEW_H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +// ResizableFormView.h : header file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "ResizableLayout.h" +#include "ResizableGrip.h" +#include "ResizableMinMax.h" + +///////////////////////////////////////////////////////////////////////////// +// CResizableFormView form view + +#ifndef __AFXEXT_H__ +#include +#endif + +class CResizableFormView : public CFormView, public CResizableLayout, + public CResizableGrip, public CResizableMinMax +{ + DECLARE_DYNAMIC(CResizableFormView) + +// Construction +protected: // must derive your own class + CResizableFormView(UINT nIDTemplate); + CResizableFormView(LPCTSTR lpszTemplateName); + virtual ~CResizableFormView(); + +private: + void PrivateConstruct(); + + BOOL m_bInitDone; // if all internal vars initialized + + // support for temporarily hiding the grip + DWORD m_dwGripTempState; + enum GripHideReason // bitmask + { + GHR_MAXIMIZED = 0x01, + GHR_SCROLLBAR = 0x02, + GHR_ALIGNMENT = 0x04, + }; + +// called from base class +protected: + + virtual void GetTotalClientRect(LPRECT lpRect); + + virtual CWnd* GetResizableWnd() + { + // make the layout know its parent window + return this; + }; + + +// Attributes +public: + +// Operations +public: + +// Overrides +public: + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CResizableFormView) + virtual void OnInitialUpdate(); + //}}AFX_VIRTUAL + +// Implementation +protected: + +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + + // Generated message map functions + //{{AFX_MSG(CResizableFormView) + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); + afx_msg void OnDestroy(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_RESIZABLEFORMVIEW_H__INCLUDED_) diff --git a/ResizableLib/ResizableFrame.cpp b/ResizableLib/ResizableFrame.cpp new file mode 100644 index 0000000..6a21274 --- /dev/null +++ b/ResizableLib/ResizableFrame.cpp @@ -0,0 +1,103 @@ +// ResizableFrame.cpp : implementation file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizableFrame.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CResizableFrame + +IMPLEMENT_DYNCREATE(CResizableFrame, CFrameWnd) + +CResizableFrame::CResizableFrame() +{ + m_bEnableSaveRestore = FALSE; +} + +CResizableFrame::~CResizableFrame() +{ +} + + +BEGIN_MESSAGE_MAP(CResizableFrame, CFrameWnd) + //{{AFX_MSG_MAP(CResizableFrame) + ON_WM_GETMINMAXINFO() + ON_WM_DESTROY() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CResizableFrame message handlers + +void CResizableFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +{ + MinMaxInfo(lpMMI); + + CView* pView = GetActiveView(); + if (pView == NULL) + return; + + // get the extra size from view to frame + CRect rectClient, rectWnd; + GetWindowRect(rectWnd); + RepositionBars(0, 0xFFFF, AFX_IDW_PANE_FIRST, reposQuery, rectClient); + CSize sizeExtra = rectWnd.Size() - rectClient.Size(); + + // ask the view for track size + MINMAXINFO mmiView = *lpMMI; + pView->SendMessage(WM_GETMINMAXINFO, 0, (LPARAM)&mmiView); + mmiView.ptMaxTrackSize = sizeExtra + mmiView.ptMaxTrackSize; + mmiView.ptMinTrackSize = sizeExtra + mmiView.ptMinTrackSize; + + // min size is the largest + lpMMI->ptMinTrackSize.x = __max(lpMMI->ptMinTrackSize.x, + mmiView.ptMinTrackSize.x); + lpMMI->ptMinTrackSize.y = __max(lpMMI->ptMinTrackSize.y, + mmiView.ptMinTrackSize.y); + + // max size is the shortest + lpMMI->ptMaxTrackSize.x = __min(lpMMI->ptMaxTrackSize.x, + mmiView.ptMaxTrackSize.x); + lpMMI->ptMaxTrackSize.y = __min(lpMMI->ptMaxTrackSize.y, + mmiView.ptMaxTrackSize.y); +} + +// NOTE: this must be called after setting the layout +// to have the view and its controls displayed properly +BOOL CResizableFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly) +{ + m_sSection = pszSection; + + m_bEnableSaveRestore = TRUE; + m_bRectOnly = bRectOnly; + + // restore immediately + return LoadWindowRect(pszSection, bRectOnly); +} + +void CResizableFrame::OnDestroy() +{ + if (m_bEnableSaveRestore) + SaveWindowRect(m_sSection, m_bRectOnly); + + CFrameWnd::OnDestroy(); +} diff --git a/ResizableLib/ResizableFrame.h b/ResizableLib/ResizableFrame.h new file mode 100644 index 0000000..6d2e4d9 --- /dev/null +++ b/ResizableLib/ResizableFrame.h @@ -0,0 +1,81 @@ +#if !defined(AFX_RESIZABLEFRAME_H__4BA07057_6EF3_43A4_A80B_A24FA3A8B5C7__INCLUDED_) +#define AFX_RESIZABLEFRAME_H__4BA07057_6EF3_43A4_A80B_A24FA3A8B5C7__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// ResizableFrame.h : header file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "ResizableMinMax.h" +#include "ResizableState.h" + +///////////////////////////////////////////////////////////////////////////// +// CResizableFrame frame + +class CResizableFrame : public CFrameWnd, public CResizableMinMax, + public CResizableState +{ + DECLARE_DYNCREATE(CResizableFrame) +protected: + CResizableFrame(); // protected constructor used by dynamic creation + +// Attributes +protected: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CResizableFrame) + //}}AFX_VIRTUAL + +// Implementation +protected: + virtual ~CResizableFrame(); + + BOOL EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE); + + virtual CWnd* GetResizableWnd() + { + // make the layout know its parent window + return this; + }; + +private: + // flags + BOOL m_bEnableSaveRestore; + BOOL m_bRectOnly; + + // internal status + CString m_sSection; // section name (identifies a parent window) + +protected: + // Generated message map functions + //{{AFX_MSG(CResizableFrame) + afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); + afx_msg void OnDestroy(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_RESIZABLEFRAME_H__4BA07057_6EF3_43A4_A80B_A24FA3A8B5C7__INCLUDED_) diff --git a/ResizableLib/ResizableGrip.cpp b/ResizableLib/ResizableGrip.cpp new file mode 100644 index 0000000..4f3290d --- /dev/null +++ b/ResizableLib/ResizableGrip.cpp @@ -0,0 +1,310 @@ +// ResizableGrip.cpp: implementation of the CResizableGrip class. +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizableGrip.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CResizableGrip::CResizableGrip() +{ + m_nShowCount = 0; +} + +CResizableGrip::~CResizableGrip() +{ + +} + +void CResizableGrip::UpdateSizeGrip() +{ + ASSERT(::IsWindow(m_wndGrip.m_hWnd)); + + // size-grip goes bottom right in the client area + // (any right-to-left adjustment should go here) + + RECT rect; + GetResizableWnd()->GetClientRect(&rect); + + rect.left = rect.right - m_wndGrip.m_size.cx; + rect.top = rect.bottom - m_wndGrip.m_size.cy; + + // must stay below other children + m_wndGrip.SetWindowPos(&CWnd::wndBottom, rect.left, rect.top, 0, 0, + SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREPOSITION + | (IsSizeGripVisible() ? SWP_SHOWWINDOW : SWP_HIDEWINDOW)); +} + +// pbStatus points to a variable, maintained by the caller, that +// holds its visibility status. Initialize the variable with 1 +// to allow to temporarily hide the grip, 0 to allow to +// temporarily show the grip (with respect to the dwMask bit). + +// NB: visibility is effective only after an update + +void CResizableGrip::ShowSizeGrip(DWORD* pStatus, DWORD dwMask /*= 1*/) +{ + ASSERT(pStatus != NULL); + + if (!(*pStatus & dwMask)) + { + m_nShowCount++; + (*pStatus) |= dwMask; + } +} + +void CResizableGrip::HideSizeGrip(DWORD* pStatus, DWORD dwMask /*= 1*/) +{ + ASSERT(pStatus != NULL); + + if (*pStatus & dwMask) + { + m_nShowCount--; + (*pStatus) &= ~dwMask; + } +} + +BOOL CResizableGrip::IsSizeGripVisible() +{ + // NB: visibility is effective only after an update + return (m_nShowCount > 0); +} + +void CResizableGrip::SetSizeGripVisibility(BOOL bVisible) +{ + if (bVisible) + m_nShowCount = 1; + else + m_nShowCount = 0; +} + +BOOL CResizableGrip::SetSizeGripBkMode(int nBkMode) +{ + if (::IsWindow(m_wndGrip.m_hWnd)) + { + if (nBkMode == OPAQUE) + m_wndGrip.SetTransparency(FALSE); + else if (nBkMode == TRANSPARENT) + m_wndGrip.SetTransparency(TRUE); + else + return FALSE; + return TRUE; + } + return FALSE; +} + +void CResizableGrip::SetSizeGripShape(BOOL bTriangular) +{ + m_wndGrip.SetTriangularShape(bTriangular); +} + +BOOL CResizableGrip::CreateSizeGrip(BOOL bVisible /*= TRUE*/, + BOOL bTriangular /*= TRUE*/, BOOL bTransparent /*= FALSE*/) +{ + // create grip + CRect rect(0 , 0, m_wndGrip.m_size.cx, m_wndGrip.m_size.cy); + BOOL bRet = m_wndGrip.Create(WS_CHILD | WS_CLIPSIBLINGS + | SBS_SIZEGRIP, rect, GetResizableWnd(), 0); + + if (bRet) + { + // set options + m_wndGrip.SetTriangularShape(bTriangular); + m_wndGrip.SetTransparency(bTransparent); + SetSizeGripVisibility(bVisible); + + // update position + UpdateSizeGrip(); + } + + return bRet; +} + +///////////////////////////////////////////////////////////////////////////// +// CSizeGrip implementation + +BOOL CResizableGrip::CSizeGrip::IsRTL() +{ + return GetExStyle() & WS_EX_LAYOUTRTL; +} + +BOOL CResizableGrip::CSizeGrip::PreCreateWindow(CREATESTRUCT& cs) +{ + // set window size + m_size.cx = GetSystemMetrics(SM_CXVSCROLL); + m_size.cy = GetSystemMetrics(SM_CYHSCROLL); + + cs.cx = m_size.cx; + cs.cy = m_size.cy; + + return CScrollBar::PreCreateWindow(cs); +} + +LRESULT CResizableGrip::CSizeGrip::WindowProc(UINT message, + WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_GETDLGCODE: + // fix to prevent the control to gain focus, using arrow keys + // (standard grip returns DLGC_WANTARROWS, like any standard scrollbar) + return DLGC_STATIC; + + case WM_NCHITTEST: + // choose proper cursor shape + if (IsRTL()) + return HTBOTTOMLEFT; + else + return HTBOTTOMRIGHT; + break; + + case WM_SETTINGCHANGE: + { + // update grip's size + CSize sizeOld = m_size; + m_size.cx = GetSystemMetrics(SM_CXVSCROLL); + m_size.cy = GetSystemMetrics(SM_CYHSCROLL); + + // resize transparency bitmaps + if (m_bTransparent) + { + CClientDC dc(this); + + // destroy bitmaps + m_bmGrip.DeleteObject(); + m_bmMask.DeleteObject(); + + // re-create bitmaps + m_bmGrip.CreateCompatibleBitmap(&dc, m_size.cx, m_size.cy); + m_bmMask.CreateBitmap(m_size.cx, m_size.cy, 1, 1, NULL); + } + + // re-calc shape + if (m_bTriangular) + SetTriangularShape(m_bTriangular); + + // reposition the grip + CRect rect; + GetWindowRect(rect); + rect.InflateRect(m_size.cx - sizeOld.cx, m_size.cy - sizeOld.cy, 0, 0); + ::MapWindowPoints(NULL, GetParent()->GetSafeHwnd(), (LPPOINT)&rect, 2); + MoveWindow(rect, TRUE); + } + break; + + case WM_DESTROY: + // perform clean up + if (m_bTransparent) + SetTransparency(FALSE); + break; + + case WM_PAINT: + if (m_bTransparent) + { + CPaintDC dc(this); + + // select bitmaps + CBitmap *pOldGrip, *pOldMask; + + pOldGrip = m_dcGrip.SelectObject(&m_bmGrip); + pOldMask = m_dcMask.SelectObject(&m_bmMask); + + // obtain original grip bitmap, make the mask and prepare masked bitmap + CScrollBar::WindowProc(WM_PAINT, (WPARAM)m_dcGrip.GetSafeHdc(), lParam); + m_dcGrip.SetBkColor(m_dcGrip.GetPixel(0, 0)); + m_dcMask.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcGrip, 0, 0, SRCCOPY); + m_dcGrip.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcMask, 0, 0, 0x00220326); + + // draw transparently + dc.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcMask, 0, 0, SRCAND); + dc.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcGrip, 0, 0, SRCPAINT); + + // unselect bitmaps + m_dcGrip.SelectObject(pOldGrip); + m_dcMask.SelectObject(pOldMask); + + return 0; + } + break; + } + + return CScrollBar::WindowProc(message, wParam, lParam); +} + +void CResizableGrip::CSizeGrip::SetTransparency(BOOL bActivate) +{ + // creates or deletes DCs and Bitmaps used for + // implementing a transparent size grip + + if (bActivate && !m_bTransparent) + { + m_bTransparent = TRUE; + + CClientDC dc(this); + + // create memory DCs and bitmaps + m_dcGrip.CreateCompatibleDC(&dc); + m_bmGrip.CreateCompatibleBitmap(&dc, m_size.cx, m_size.cy); + + m_dcMask.CreateCompatibleDC(&dc); + m_bmMask.CreateBitmap(m_size.cx, m_size.cy, 1, 1, NULL); + } + else if (!bActivate && m_bTransparent) + { + m_bTransparent = FALSE; + + // destroy memory DCs and bitmaps + m_dcGrip.DeleteDC(); + m_bmGrip.DeleteObject(); + + m_dcMask.DeleteDC(); + m_bmMask.DeleteObject(); + } +} + +void CResizableGrip::CSizeGrip::SetTriangularShape(BOOL bEnable) +{ + m_bTriangular = bEnable; + + if (bEnable) + { + // set a triangular window region + CRect rect; + GetWindowRect(rect); + rect.OffsetRect(-rect.TopLeft()); + POINT arrPoints[] = + { + { rect.left, rect.bottom }, + { rect.right, rect.bottom }, + { rect.right, rect.top } + }; + CRgn rgnGrip; + rgnGrip.CreatePolygonRgn(arrPoints, 3, WINDING); + SetWindowRgn((HRGN)rgnGrip.Detach(), IsWindowVisible()); + } + else + { + SetWindowRgn((HRGN)NULL, IsWindowVisible()); + } +} diff --git a/ResizableLib/ResizableGrip.h b/ResizableLib/ResizableGrip.h new file mode 100644 index 0000000..5645db8 --- /dev/null +++ b/ResizableLib/ResizableGrip.h @@ -0,0 +1,81 @@ +// ResizableGrip.h: interface for the CResizableGrip class. +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_RESIZABLEGRIP_H__INCLUDED_) +#define AFX_RESIZABLEGRIP_H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CResizableGrip +{ +private: + class CSizeGrip : public CScrollBar + { + public: + CSizeGrip() + { + m_bTransparent = FALSE; + m_bTriangular = FALSE; + m_size.cx = 0; + m_size.cy = 0; + } + + void SetTriangularShape(BOOL bEnable); + void SetTransparency(BOOL bActivate); + + BOOL IsRTL(); // right-to-left layout support + + virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); + + SIZE m_size; // holds grip size + + protected: + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + + BOOL m_bTriangular; // triangular shape active + BOOL m_bTransparent; // transparency active + + // memory DCs and bitmaps for transparent grip + CDC m_dcGrip, m_dcMask; + CBitmap m_bmGrip, m_bmMask; + }; + + CSizeGrip m_wndGrip; // grip control + int m_nShowCount; // support for hiding the grip + +protected: + // create a size grip, with options + BOOL CreateSizeGrip(BOOL bVisible = TRUE, + BOOL bTriangular = TRUE, BOOL bTransparent = FALSE); + + BOOL IsSizeGripVisible(); // TRUE if grip is set to be visible + void SetSizeGripVisibility(BOOL bVisible); // set default visibility + void UpdateSizeGrip(); // update the grip's visibility and position + void ShowSizeGrip(DWORD* pStatus, DWORD dwMask = 1); // temp show the size grip + void HideSizeGrip(DWORD* pStatus, DWORD dwMask = 1); // temp hide the size grip + BOOL SetSizeGripBkMode(int nBkMode); // like CDC::SetBkMode + void SetSizeGripShape(BOOL bTriangular); + + virtual CWnd* GetResizableWnd() = 0; + +public: + CResizableGrip(); + virtual ~CResizableGrip(); +}; + +#endif // !defined(AFX_RESIZABLEGRIP_H__INCLUDED_) diff --git a/ResizableLib/ResizableLayout.cpp b/ResizableLib/ResizableLayout.cpp new file mode 100644 index 0000000..2c8bf13 --- /dev/null +++ b/ResizableLib/ResizableLayout.cpp @@ -0,0 +1,517 @@ +// ResizableLayout.cpp: implementation of the CResizableLayout class. +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizableLayout.h" +#include "ResizableMsgSupport.inl" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +// In August 2002 Platform SDK, some guy at MS thought it was time to +// add the missing symbol BS_TYPEMASK, but forgot its original meaning +// and so now he's telling us not to use that symbol because its +// value is likely to change in the future SDK releases, including all +// the BS_* style bits in the mask, not just the button's type as the +// symbol's name suggests. So now we're forced to use another symbol! +#define _BS_TYPEMASK 0x0000000FL + +void CResizableLayout::AddAnchor(HWND hWnd, CSize sizeTypeTL, CSize sizeTypeBR) +{ + CWnd* pParent = GetResizableWnd(); + + // child window must be valid + ASSERT(::IsWindow(hWnd)); + // must be child of parent window +// ASSERT(::IsChild(pParent->GetSafeHwnd(), hWnd)); + // top-left anchor must be valid + ASSERT(sizeTypeTL != NOANCHOR); + + // get control's window class + CString sClassName; + GetClassName(hWnd, sClassName.GetBufferSetLength(MAX_PATH), MAX_PATH); + sClassName.ReleaseBuffer(); + + // get parent window's rect + CRect rectParent; + GetTotalClientRect(&rectParent); + // and child control's rect + CRect rectChild; + ::GetWindowRect(hWnd, &rectChild); + ::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2); + + // adjust position, if client area has been scrolled + rectChild.OffsetRect(-rectParent.TopLeft()); + + // go calculate margins + CSize sizeMarginTL, sizeMarginBR; + + if (sizeTypeBR == NOANCHOR) + sizeTypeBR = sizeTypeTL; + + // calculate margin for the top-left corner + + sizeMarginTL.cx = rectChild.left - rectParent.Width() * sizeTypeTL.cx / 100; + sizeMarginTL.cy = rectChild.top - rectParent.Height() * sizeTypeTL.cy / 100; + + // calculate margin for the bottom-right corner + + sizeMarginBR.cx = rectChild.right - rectParent.Width() * sizeTypeBR.cx / 100; + sizeMarginBR.cy = rectChild.bottom - rectParent.Height() * sizeTypeBR.cy / 100; + + // prepare the structure + LayoutInfo layout(hWnd, sizeTypeTL, sizeMarginTL, + sizeTypeBR, sizeMarginBR, sClassName); + + // initialize resize properties (overridable) + InitResizeProperties(layout); + + // must not be already there! + // (this is probably due to a duplicate call to AddAnchor) + POSITION pos; + ASSERT(!m_mapLayout.Lookup(hWnd, pos)); + + // add to the list and the map + pos = m_listLayout.AddTail(layout); + m_mapLayout.SetAt(hWnd, pos); +} + +void CResizableLayout::AddAnchorCallback(UINT nCallbackID) +{ + // one callback control cannot rely upon another callback control's + // size and/or position (they're updated all together at the end) + // it can however use a non-callback control, which is updated before + + // add to the list + LayoutInfo layout; + layout.nCallbackID = nCallbackID; + m_listLayoutCB.AddTail(layout); +} + +BOOL CResizableLayout::ArrangeLayoutCallback(CResizableLayout::LayoutInfo& /*layout*/) +{ + ASSERT(FALSE); + // must be overridden, if callback is used + + return FALSE; // no output data +} + +void CResizableLayout::ArrangeLayout() +{ + // common vars + UINT uFlags; + LayoutInfo layout; + CRect rectParent, rectChild; + GetTotalClientRect(&rectParent); // get parent window's rect + int count = m_listLayout.GetCount(); + int countCB = m_listLayoutCB.GetCount(); + + // reposition child windows + HDWP hdwp = ::BeginDeferWindowPos(count + countCB); + + POSITION pos = m_listLayout.GetHeadPosition(); + while (pos != NULL) + { + // get layout info + layout = m_listLayout.GetNext(pos); + + // calculate new child's position, size and flags for SetWindowPos + CalcNewChildPosition(layout, rectParent, rectChild, uFlags); + + // only if size or position changed + if ((uFlags & (SWP_NOMOVE|SWP_NOSIZE)) != (SWP_NOMOVE|SWP_NOSIZE)) + { + hdwp = ::DeferWindowPos(hdwp, layout.hWnd, NULL, rectChild.left, + rectChild.top, rectChild.Width(), rectChild.Height(), uFlags); + } + } + + // for callback items you may use GetAnchorPosition to know the + // new position and size of a non-callback item after resizing + + pos = m_listLayoutCB.GetHeadPosition(); + while (pos != NULL) + { + // get layout info + layout = m_listLayoutCB.GetNext(pos); + // request layout data + if (!ArrangeLayoutCallback(layout)) + continue; + + // calculate new child's position, size and flags for SetWindowPos + CalcNewChildPosition(layout, rectParent, rectChild, uFlags); + + // only if size or position changed + if ((uFlags & (SWP_NOMOVE|SWP_NOSIZE)) != (SWP_NOMOVE|SWP_NOSIZE)) + { + hdwp = ::DeferWindowPos(hdwp, layout.hWnd, NULL, rectChild.left, + rectChild.top, rectChild.Width(), rectChild.Height(), uFlags); + } + } + + // finally move all the windows at once + ::EndDeferWindowPos(hdwp); +} + +void CResizableLayout::ClipChildWindow(const CResizableLayout::LayoutInfo& layout, + CRgn* pRegion) +{ + // obtain window position + CRect rect; + ::GetWindowRect(layout.hWnd, &rect); + ::MapWindowPoints(NULL, GetResizableWnd()->m_hWnd, (LPPOINT)&rect, 2); + + // use window region if any + CRgn rgn; + rgn.CreateRectRgn(0,0,0,0); + switch (::GetWindowRgn(layout.hWnd, rgn)) + { + case COMPLEXREGION: + case SIMPLEREGION: + rgn.OffsetRgn(rect.TopLeft()); + break; + + default: + rgn.SetRectRgn(&rect); + } + + // get the clipping property + BOOL bClipping = layout.properties.bAskClipping ? + LikesClipping(layout) : layout.properties.bCachedLikesClipping; + + // modify region accordingly + if (bClipping) + pRegion->CombineRgn(pRegion, &rgn, RGN_DIFF); + else + pRegion->CombineRgn(pRegion, &rgn, RGN_OR); +} + +void CResizableLayout::GetClippingRegion(CRgn* pRegion) +{ + CWnd* pWnd = GetResizableWnd(); + + // System's default clipping area is screen's size, + // not enough for max track size, for example: + // if screen is 1024 x 768 and resizing border is 4 pixels, + // maximized size is 1024+4*2=1032 x 768+4*2=776, + // but max track size is 4 pixels bigger 1036 x 780 (don't ask me why!) + // So, if you resize the window to maximum size, the last 4 pixels + // are clipped out by the default clipping region, that gets created + // as soon as you call clipping functions (my guess). + + // reset clipping region to the whole client area + CRect rect; + pWnd->GetClientRect(&rect); + pRegion->CreateRectRgnIndirect(&rect); + + // clip only anchored controls + LayoutInfo layout; + POSITION pos = m_listLayout.GetHeadPosition(); + while (pos != NULL) + { + // get layout info + layout = m_listLayout.GetNext(pos); + + if (::IsWindowVisible(layout.hWnd)) + ClipChildWindow(layout, pRegion); + } + pos = m_listLayoutCB.GetHeadPosition(); + while (pos != NULL) + { + // get layout info + layout = m_listLayoutCB.GetNext(pos); + // request data + if (!ArrangeLayoutCallback(layout)) + continue; + + if (::IsWindowVisible(layout.hWnd)) + ClipChildWindow(layout, pRegion); + } + + // fix for RTL layouts (1 pixel of horz offset) + if (pWnd->GetExStyle() & WS_EX_LAYOUTRTL) + pRegion->OffsetRgn(-1,0); +} + +void CResizableLayout::EraseBackground(CDC* pDC) +{ + HWND hWnd = GetResizableWnd()->GetSafeHwnd(); + + // retrieve the background brush + HBRUSH hBrush = NULL; + + // is this a dialog box? + // (using class atom is quickier than using the class name) + ATOM atomWndClass = (ATOM)::GetClassLong(hWnd, GCW_ATOM); + if (atomWndClass == (ATOM)0x8002) + { + // send a message to the dialog box + hBrush = (HBRUSH)::SendMessage(hWnd, WM_CTLCOLORDLG, + (WPARAM)pDC->GetSafeHdc(), (LPARAM)hWnd); + } + else + { + // take the background brush from the window's class + hBrush = (HBRUSH)::GetClassLong(hWnd, GCL_HBRBACKGROUND); + } + + // fill the clipped background + CRgn rgn; + GetClippingRegion(&rgn); + + ::FillRgn(pDC->GetSafeHdc(), rgn, hBrush); +} + +// support legacy code (will disappear in future versions) +void CResizableLayout::ClipChildren(CDC* pDC) +{ + CRgn rgn; + GetClippingRegion(&rgn); + // the clipping region is in device units + rgn.OffsetRgn(-pDC->GetWindowOrg()); + pDC->SelectClipRgn(&rgn); +} + +void CResizableLayout::GetTotalClientRect(LPRECT lpRect) +{ + GetResizableWnd()->GetClientRect(lpRect); +} + +BOOL CResizableLayout::NeedsRefresh(const CResizableLayout::LayoutInfo& layout, + const CRect& rectOld, const CRect& rectNew) +{ + if (layout.bMsgSupport) + { + REFRESHPROPERTY refresh; + refresh.rcOld = rectOld; + refresh.rcNew = rectNew; + if (Send_NeedsRefresh(layout.hWnd, &refresh)) + return refresh.bNeedsRefresh; + } + + int nDiffWidth = (rectNew.Width() - rectOld.Width()); + int nDiffHeight = (rectNew.Height() - rectOld.Height()); + + // is the same size? + if (nDiffWidth == 0 && nDiffHeight == 0) + return FALSE; + + // optimistic, no need to refresh + BOOL bRefresh = FALSE; + + // window classes that need refresh when resized + if (layout.sWndClass == WC_STATIC) + { + DWORD style = ::GetWindowLong(layout.hWnd, GWL_STYLE); + + switch (style & SS_TYPEMASK) + { + case SS_LEFT: + case SS_CENTER: + case SS_RIGHT: + // word-wrapped text + bRefresh = bRefresh || (nDiffWidth != 0); + // vertically centered text + if (style & SS_CENTERIMAGE) + bRefresh = bRefresh || (nDiffHeight != 0); + break; + + case SS_LEFTNOWORDWRAP: + // text with ellipsis + if (style & SS_ELLIPSISMASK) + bRefresh = bRefresh || (nDiffWidth != 0); + // vertically centered text + if (style & SS_CENTERIMAGE) + bRefresh = bRefresh || (nDiffHeight != 0); + break; + + case SS_ENHMETAFILE: + case SS_BITMAP: + case SS_ICON: + // images + case SS_BLACKFRAME: + case SS_GRAYFRAME: + case SS_WHITEFRAME: + case SS_ETCHEDFRAME: + // and frames + bRefresh = TRUE; + break; + } + } + + // window classes that don't redraw client area correctly + // when the hor scroll pos changes due to a resizing + BOOL bHScroll = FALSE; + if (layout.sWndClass == WC_LISTBOX) + bHScroll = TRUE; + + // fix for horizontally scrollable windows + if (bHScroll && (nDiffWidth > 0)) + { + // get max scroll position + SCROLLINFO info; + info.cbSize = sizeof(SCROLLINFO); + info.fMask = SIF_PAGE | SIF_POS | SIF_RANGE; + if (::GetScrollInfo(layout.hWnd, SB_HORZ, &info)) + { + // subtract the page size + info.nMax -= __max(info.nPage-1,0); + } + + // resizing will cause the text to scroll on the right + // because the scrollbar is going beyond the right limit + if ((info.nMax > 0) && (info.nPos + nDiffWidth > info.nMax)) + { + // needs repainting, due to horiz scrolling + bRefresh = TRUE; + } + } + + return bRefresh; +} + +BOOL CResizableLayout::LikesClipping(const CResizableLayout::LayoutInfo& layout) +{ + if (layout.bMsgSupport) + { + CLIPPINGPROPERTY clipping; + if (Send_LikesClipping(layout.hWnd, &clipping)) + return clipping.bLikesClipping; + } + + DWORD style = ::GetWindowLong(layout.hWnd, GWL_STYLE); + + // skip windows that wants background repainted + if (layout.sWndClass == TOOLBARCLASSNAME && (style & TBSTYLE_TRANSPARENT)) + return FALSE; + else if (layout.sWndClass == WC_BUTTON) + { + CRect rect; + switch (style & _BS_TYPEMASK) + { + case BS_GROUPBOX: + return FALSE; + + case BS_OWNERDRAW: + // ownerdraw buttons must return correct hittest code + // to notify their transparency to the system and this library + ::GetWindowRect(layout.hWnd, &rect); + if ( HTTRANSPARENT == ::SendMessage(layout.hWnd, + WM_NCHITTEST, 0, MAKELPARAM(rect.left, rect.top)) ) + return FALSE; + break; + } + return TRUE; + } + else if (layout.sWndClass == WC_STATIC) + { + switch (style & SS_TYPEMASK) + { + case SS_LEFT: + case SS_CENTER: + case SS_RIGHT: + case SS_SIMPLE: + case SS_LEFTNOWORDWRAP: + // text + case SS_BLACKRECT: + case SS_GRAYRECT: + case SS_WHITERECT: + // filled rects + case SS_ETCHEDHORZ: + case SS_ETCHEDVERT: + // etched lines + case SS_BITMAP: + // bitmaps + return TRUE; + break; + + case SS_ICON: + case SS_ENHMETAFILE: + if (style & SS_CENTERIMAGE) + return FALSE; + return TRUE; + break; + + default: + return FALSE; + } + } + + // assume the others like clipping + return TRUE; +} + +void CResizableLayout::CalcNewChildPosition(const CResizableLayout::LayoutInfo& layout, + const CRect &rectParent, CRect &rectChild, UINT& uFlags) +{ + CWnd* pParent = GetResizableWnd(); + + ::GetWindowRect(layout.hWnd, &rectChild); + ::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2); + + CRect rectNew; + + // calculate new top-left corner + rectNew.left = layout.sizeMarginTL.cx + rectParent.Width() * layout.sizeTypeTL.cx / 100; + rectNew.top = layout.sizeMarginTL.cy + rectParent.Height() * layout.sizeTypeTL.cy / 100; + + // calculate new bottom-right corner + rectNew.right = layout.sizeMarginBR.cx + rectParent.Width() * layout.sizeTypeBR.cx / 100; + rectNew.bottom = layout.sizeMarginBR.cy + rectParent.Height() * layout.sizeTypeBR.cy / 100; + + // adjust position, if client area has been scrolled + rectNew.OffsetRect(rectParent.TopLeft()); + + // get the refresh property + BOOL bRefresh = layout.properties.bAskRefresh ? + NeedsRefresh(layout, rectChild, rectNew) : layout.properties.bCachedNeedsRefresh; + + // set flags + uFlags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION; + if (bRefresh) + uFlags |= SWP_NOCOPYBITS; + if (rectNew.TopLeft() == rectChild.TopLeft()) + uFlags |= SWP_NOMOVE; + if (rectNew.Size() == rectChild.Size()) + uFlags |= SWP_NOSIZE; + + // update rect + rectChild = rectNew; +} + +void CResizableLayout::InitResizeProperties(CResizableLayout::LayoutInfo &layout) +{ + // check if custom window supports this library + // (properties must be correctly set by the window) + layout.bMsgSupport = Send_QueryProperties(layout.hWnd, &layout.properties); + + // default properties + if (!layout.bMsgSupport) + { + // clipping property is assumed as static + layout.properties.bAskClipping = FALSE; + layout.properties.bCachedLikesClipping = LikesClipping(layout); + // refresh property is assumed as dynamic + layout.properties.bAskRefresh = TRUE; + } +} diff --git a/ResizableLib/ResizableLayout.h b/ResizableLib/ResizableLayout.h new file mode 100644 index 0000000..833da71 --- /dev/null +++ b/ResizableLib/ResizableLayout.h @@ -0,0 +1,196 @@ +// ResizableLayout.h: interface for the CResizableLayout class. +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_RESIZABLELAYOUT_H__INCLUDED_) +#define AFX_RESIZABLELAYOUT_H__INCLUDED_ + +#include +#include "ResizableMsgSupport.h" + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +// useful compatibility constants (the only one required is NOANCHOR) + +const CSize NOANCHOR(-1,-1), + TOP_LEFT(0,0), TOP_CENTER(50,0), TOP_RIGHT(100,0), + MIDDLE_LEFT(0,50), MIDDLE_CENTER(50,50), MIDDLE_RIGHT(100,50), + BOTTOM_LEFT(0,100), BOTTOM_CENTER(50,100), BOTTOM_RIGHT(100,100); + + +class CResizableLayout +{ +protected: + class LayoutInfo + { + public: + HWND hWnd; + UINT nCallbackID; + + CString sWndClass; + + // upper-left corner + SIZE sizeTypeTL; + SIZE sizeMarginTL; + + // bottom-right corner + SIZE sizeTypeBR; + SIZE sizeMarginBR; + + // custom window support + BOOL bMsgSupport; + RESIZEPROPERTIES properties; + + public: + LayoutInfo() : hWnd(NULL), nCallbackID(0), bMsgSupport(FALSE) + { + sizeTypeTL.cx = 0; + sizeTypeTL.cy = 0; + sizeMarginTL.cx = 0; + sizeMarginTL.cy = 0; + sizeTypeBR.cx = 0; + sizeTypeBR.cy = 0; + sizeMarginBR.cx = 0; + sizeMarginBR.cy = 0; + memset(&properties, 0, sizeof properties); + } + + LayoutInfo(HWND hwnd, SIZE tl_t, SIZE tl_m, + SIZE br_t, SIZE br_m, CString classname) + : hWnd(hwnd), nCallbackID(0), + sWndClass(classname), bMsgSupport(FALSE), + sizeTypeTL(tl_t), sizeMarginTL(tl_m), + sizeTypeBR(br_t), sizeMarginBR(br_m) + { + memset(&properties, 0, sizeof properties); + } + }; + +private: + // list of repositionable controls + CMap m_mapLayout; + CList m_listLayout; + CList m_listLayoutCB; + + void ClipChildWindow(const CResizableLayout::LayoutInfo &layout, CRgn* pRegion); + + void CalcNewChildPosition(const CResizableLayout::LayoutInfo &layout, + const CRect &rectParent, CRect &rectChild, UINT& uFlags); +public: + // remove an anchored control from the layout, given its HWND + BOOL RemoveAnchor(HWND hWnd) + { + POSITION pos; + if (!m_mapLayout.Lookup(hWnd, pos)) + return FALSE; + + m_listLayout.RemoveAt(pos); + return m_mapLayout.RemoveKey(hWnd); + } + + // add anchors to a control, given its HWND + void AddAnchor(HWND hWnd, CSize sizeTypeTL, CSize sizeTypeBR = NOANCHOR); + +protected: + // override to initialize resize properties (clipping, refresh) + virtual void InitResizeProperties(CResizableLayout::LayoutInfo& layout); + + // override to specify clipping for unsupported windows + virtual BOOL LikesClipping(const CResizableLayout::LayoutInfo &layout); + + // override to specify refresh for unsupported windows + virtual BOOL NeedsRefresh(const CResizableLayout::LayoutInfo &layout, + const CRect &rectOld, const CRect &rectNew); + + // paint the background on the given DC (for XP theme's compatibility) + void EraseBackground(CDC* pDC); + + // clip out child windows from the given DC (support old code) + void ClipChildren(CDC* pDC); + + // get the clipping region (without clipped child windows) + void GetClippingRegion(CRgn* pRegion); + + // override for scrollable or expanding parent windows + virtual void GetTotalClientRect(LPRECT lpRect); + + // add anchors to a control, given its ID + void AddAnchor(UINT nID, CSize sizeTypeTL, CSize sizeTypeBR = NOANCHOR) + { + AddAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID), + sizeTypeTL, sizeTypeBR); + } + + // add a callback (control ID or HWND is unknown or may change) + void AddAnchorCallback(UINT nCallbackID); + + // get rect of an anchored window, given the parent's client area + BOOL GetAnchorPosition(HWND hWnd, const CRect &rectParent, + CRect &rectChild, UINT* lpFlags = NULL) + { + POSITION pos; + if (!m_mapLayout.Lookup(hWnd, pos)) + return FALSE; + + UINT uTmpFlags; + CalcNewChildPosition(m_listLayout.GetAt(pos), rectParent, rectChild, + (lpFlags != NULL) ? (*lpFlags) : uTmpFlags); + return TRUE; + } + + // get rect of an anchored window, given the parent's client area + BOOL GetAnchorPosition(UINT nID, const CRect &rectParent, + CRect &rectChild, UINT* lpFlags = NULL) + { + return GetAnchorPosition(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID), + rectParent, rectChild, lpFlags); + } + + // remove an anchored control from the layout, given its HWND + BOOL RemoveAnchor(UINT nID) + { + return RemoveAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID)); + } + + // reset layout content + void RemoveAllAnchors() + { + m_mapLayout.RemoveAll(); + m_listLayout.RemoveAll(); + m_listLayoutCB.RemoveAll(); + } + + // adjust children's layout, when parent's size changes + void ArrangeLayout(); + + // override to provide dynamic control's layout info + virtual BOOL ArrangeLayoutCallback(CResizableLayout::LayoutInfo& layout); + + // override to provide the parent window + virtual CWnd* GetResizableWnd() = 0; + +public: + CResizableLayout() { } + + virtual ~CResizableLayout() + { + // just for safety + RemoveAllAnchors(); + } +}; + +#endif // !defined(AFX_RESIZABLELAYOUT_H__INCLUDED_) diff --git a/ResizableLib/ResizableLib.dsp b/ResizableLib/ResizableLib.dsp new file mode 100644 index 0000000..6cea2c7 --- /dev/null +++ b/ResizableLib/ResizableLib.dsp @@ -0,0 +1,281 @@ +# Microsoft Developer Studio Project File - Name="ResizableLib" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=ResizableLib - Win32 Debug Static +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ResizableLib.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ResizableLib.mak" CFG="ResizableLib - Win32 Debug Static" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ResizableLib - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "ResizableLib - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "ResizableLib - Win32 Debug Static" (based on "Win32 (x86) Static Library") +!MESSAGE "ResizableLib - Win32 Release Static" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ResizableLib - Win32 Release" + +# PROP BASE Use_MFC 2 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x410 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x410 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "ResizableLib - Win32 Debug" + +# PROP BASE Use_MFC 2 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x410 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x410 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "ResizableLib - Win32 Debug Static" + +# PROP BASE Use_MFC 2 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ResizableLib___Win32_Debug_Static" +# PROP BASE Intermediate_Dir "ResizableLib___Win32_Debug_Static" +# PROP BASE Target_Dir "" +# PROP Use_MFC 1 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_Static" +# PROP Intermediate_Dir "Debug_Static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x410 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x410 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "ResizableLib - Win32 Release Static" + +# PROP BASE Use_MFC 1 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ResizableLib___Win32_Release_Static" +# PROP BASE Intermediate_Dir "ResizableLib___Win32_Release_Static" +# PROP BASE Target_Dir "" +# PROP Use_MFC 1 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_Static" +# PROP Intermediate_Dir "Release_Static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x410 /d "NDEBUG" +# ADD RSC /l 0x410 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "ResizableLib - Win32 Release" +# Name "ResizableLib - Win32 Debug" +# Name "ResizableLib - Win32 Debug Static" +# Name "ResizableLib - Win32 Release Static" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\ResizableDialog.cpp +# End Source File +# Begin Source File + +SOURCE=.\ResizableFormView.cpp +# End Source File +# Begin Source File + +SOURCE=.\ResizableFrame.cpp +# End Source File +# Begin Source File + +SOURCE=.\ResizableGrip.cpp +# End Source File +# Begin Source File + +SOURCE=.\ResizableLayout.cpp +# End Source File +# Begin Source File + +SOURCE=.\ResizableMDIChild.cpp +# End Source File +# Begin Source File + +SOURCE=.\ResizableMDIFrame.cpp +# End Source File +# Begin Source File + +SOURCE=.\ResizableMinMax.cpp +# End Source File +# Begin Source File + +SOURCE=.\ResizablePage.cpp +# End Source File +# Begin Source File + +SOURCE=.\ResizablePageEx.cpp +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\ResizableSheet.cpp +# End Source File +# Begin Source File + +SOURCE=.\ResizableSheetEx.cpp +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=.\ResizableState.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\ResizableDialog.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableFormView.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableFrame.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableGrip.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableLayout.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableMDIChild.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableMDIFrame.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableMinMax.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableMsgSupport.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableMsgSupport.inl +# End Source File +# Begin Source File + +SOURCE=.\ResizablePage.h +# End Source File +# Begin Source File + +SOURCE=.\ResizablePageEx.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableSheet.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableSheetEx.h +# End Source File +# Begin Source File + +SOURCE=.\ResizableState.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Doc" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\Docs\DoDoxygen.bat +# End Source File +# Begin Source File + +SOURCE=.\Docs\doxyfile.txt +# End Source File +# End Group +# Begin Source File + +SOURCE=".\Artistic-License.txt" +# End Source File +# End Target +# End Project diff --git a/ResizableLib/ResizableLib.dsw b/ResizableLib/ResizableLib.dsw new file mode 100644 index 0000000..349ed06 --- /dev/null +++ b/ResizableLib/ResizableLib.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "ResizableLib"=.\ResizableLib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/ResizableLib/ResizableLib.sln b/ResizableLib/ResizableLib.sln new file mode 100644 index 0000000..96076a5 --- /dev/null +++ b/ResizableLib/ResizableLib.sln @@ -0,0 +1,33 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ResizableLib", "ResizableLib.vcproj", "{A5743026-DE7A-4C3D-86EA-46D6B6847F14}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Debug Static = Debug Static + Release = Release + Release Static = Release Static + Unicode Debug = Unicode Debug + Unicode Release = Unicode Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Debug.ActiveCfg = Debug|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Debug.Build.0 = Debug|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Debug Static.ActiveCfg = Debug Static|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Debug Static.Build.0 = Debug Static|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Release.ActiveCfg = Release|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Release.Build.0 = Release|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Release Static.ActiveCfg = Release Static|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Release Static.Build.0 = Release Static|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Unicode Debug.ActiveCfg = Unicode Debug|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Unicode Debug.Build.0 = Unicode Debug|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Unicode Release.ActiveCfg = Unicode Release|Win32 + {A5743026-DE7A-4C3D-86EA-46D6B6847F14}.Unicode Release.Build.0 = Unicode Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/ResizableLib/ResizableLib.vcproj b/ResizableLib/ResizableLib.vcproj new file mode 100644 index 0000000..78463a5 --- /dev/null +++ b/ResizableLib/ResizableLib.vcproj @@ -0,0 +1,574 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ResizableLib/ResizableLib100.vcxproj b/ResizableLib/ResizableLib100.vcxproj new file mode 100644 index 0000000..e30326f --- /dev/null +++ b/ResizableLib/ResizableLib100.vcxproj @@ -0,0 +1,451 @@ + + + + + Debug Static + Win32 + + + debug100 + Win32 + + + Debug + Win32 + + + Release Static + Win32 + + + Release + Win32 + + + Template + Win32 + + + Unicode Debug + Win32 + + + Unicode Release + Win32 + + + + {A5743026-DE7A-4C3D-86EA-46D6B6847F14} + MFCProj + ResizableLib100 + 8.1 + + + + StaticLibrary + Static + Unicode + v140 + + + StaticLibrary + Static + Unicode + v140_xp + + + StaticLibrary + Static + Unicode + v140_xp + + + StaticLibrary + Static + Unicode + true + v140_xp + + + StaticLibrary + Static + MultiByte + v140_xp + + + StaticLibrary + Static + Unicode + v140_xp + + + StaticLibrary + Static + Unicode + v140_xp + + + v140_xp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Release\ + .\Release\ + .\Debug\ + .\Debug\ + .\Debug\ + .\Debug\ + .\Release\ + .\Release\ + .\DebugUnicode\ + .\DebugUnicode\ + ReleaseUnicode\ + ReleaseUnicode\ + $(Configuration)\ + $(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + MaxSpeed + OnlyExplicitInline + _ALLOW_KEYWORD_MACROS;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Async + MultiThreaded + true + true + Use + stdafx.h + .\Release/ResizableLib.pch + .\Release/ + .\Release/ + .\Release/ + Level4 + true + + + _AFXDLL;NDEBUG;%(PreprocessorDefinitions) + 0x0410 + + + .\Release\ResizableLib.lib + true + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;NO_WARN_MBCS_MFC_DEPRECATION;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + Use + stdafx.h + .\Debug/ResizableLib.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + EditAndContinue + + + _AFXDLL;_DEBUG;%(PreprocessorDefinitions) + 0x0410 + + + .\Debug\ResizableLib.lib + true + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + Use + stdafx.h + .\Debug/ResizableLib.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0410 + + + .\Debug\ResizableLib.lib + true + + + + + Full + AnySuitable + true + Speed + true + true + WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + false + true + MultiThreaded + true + true + Use + stdafx.h + .\Release/ResizableLib.pch + .\Release/ + .\Release/ + .\Release/ + Level4 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0410 + + + /LTCG:STATUS %(AdditionalOptions) + .\Release\ResizableLib.lib + true + false + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + true + Use + stdafx.h + .\DebugUnicode/ResizableLib.pch + .\DebugUnicode/ + .\DebugUnicode/ + .\DebugUnicode/ + Level4 + true + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0410 + + + .\DebugUnicode\ResizableLib.lib + true + true + + + + + Full + AnySuitable + true + Speed + true + true + WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Async + MultiThreaded + true + true + Use + stdafx.h + .\ReleaseUnicode/ResizableLib.pch + .\ReleaseUnicode/ + .\ReleaseUnicode/ + .\ReleaseUnicode/ + Level4 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0410 + + + .\ReleaseUnicode\ResizableLib.lib + true + true + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + Async + EnableFastChecks + MultiThreadedDebug + Use + stdafx.h + .\Debug/ResizableLib.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level4 + true + EditAndContinue + true + + + _AFXDLL;_DEBUG;%(PreprocessorDefinitions) + 0x0410 + + + .\Debug\ResizableLib.lib + true + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ResizableLib/ResizableLib100.vcxproj.filters b/ResizableLib/ResizableLib100.vcxproj.filters new file mode 100644 index 0000000..9b94e9d --- /dev/null +++ b/ResizableLib/ResizableLib100.vcxproj.filters @@ -0,0 +1,119 @@ + + + + + {b1dc8b1d-da88-410a-9d3d-857d1ce6a705} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {e6cf7da1-9698-4487-9234-559e2ac29379} + h;hpp;hxx;hm;inl + + + {17495669-8579-4b27-abd9-ca4a69a52fe5} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Header Files + + + Doc + + + Doc + + + + \ No newline at end of file diff --git a/ResizableLib/ResizableLib80.vcproj b/ResizableLib/ResizableLib80.vcproj new file mode 100644 index 0000000..8220413 --- /dev/null +++ b/ResizableLib/ResizableLib80.vcproj @@ -0,0 +1,877 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ResizableLib/ResizableLib90.vcproj b/ResizableLib/ResizableLib90.vcproj new file mode 100644 index 0000000..a840b4b --- /dev/null +++ b/ResizableLib/ResizableLib90.vcproj @@ -0,0 +1,878 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ResizableLib/ResizableMDIChild.cpp b/ResizableLib/ResizableMDIChild.cpp new file mode 100644 index 0000000..cbd1142 --- /dev/null +++ b/ResizableLib/ResizableMDIChild.cpp @@ -0,0 +1,126 @@ +// ResizableMDIChild.cpp : implementation file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizableMDIChild.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CResizableMDIChild + +IMPLEMENT_DYNCREATE(CResizableMDIChild, CMDIChildWnd) + +CResizableMDIChild::CResizableMDIChild() +{ + m_bEnableSaveRestore = FALSE; +} + +CResizableMDIChild::~CResizableMDIChild() +{ +} + + +BEGIN_MESSAGE_MAP(CResizableMDIChild, CMDIChildWnd) + //{{AFX_MSG_MAP(CResizableMDIChild) + ON_WM_GETMINMAXINFO() + ON_WM_SIZE() + ON_WM_DESTROY() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CResizableMDIChild message handlers + +void CResizableMDIChild::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +{ + MinMaxInfo(lpMMI); + + CView* pView = GetActiveView(); + if (pView == NULL) + return; + + // get the extra size from view to frame + CRect rectClient, rectWnd; + if (IsZoomed()) + GetClientRect(rectWnd); + else + GetWindowRect(rectWnd); + RepositionBars(0, 0xFFFF, AFX_IDW_PANE_FIRST, reposQuery, rectClient); + CSize sizeExtra = rectWnd.Size() - rectClient.Size(); + + // ask the view for track size + MINMAXINFO mmiView = *lpMMI; + pView->SendMessage(WM_GETMINMAXINFO, 0, (LPARAM)&mmiView); + mmiView.ptMaxTrackSize = sizeExtra + mmiView.ptMaxTrackSize; + mmiView.ptMinTrackSize = sizeExtra + mmiView.ptMinTrackSize; + + // min size is the largest + lpMMI->ptMinTrackSize.x = __max(lpMMI->ptMinTrackSize.x, + mmiView.ptMinTrackSize.x); + lpMMI->ptMinTrackSize.y = __max(lpMMI->ptMinTrackSize.y, + mmiView.ptMinTrackSize.y); + + // max size is the shortest + lpMMI->ptMaxTrackSize.x = __min(lpMMI->ptMaxTrackSize.x, + mmiView.ptMaxTrackSize.x); + lpMMI->ptMaxTrackSize.y = __min(lpMMI->ptMaxTrackSize.y, + mmiView.ptMaxTrackSize.y); + + // MDI should call default implementation + CMDIChildWnd::OnGetMinMaxInfo(lpMMI); +} + +void CResizableMDIChild::OnSize(UINT nType, int cx, int cy) +{ + CMDIChildWnd::OnSize(nType, cx, cy); + + // make sure the MDI parent frame doesn't clip + // this child window when it is maximized + if (nType == SIZE_MAXIMIZED) + { + CMDIFrameWnd* pFrame = GetMDIFrame(); + + CRect rect; + pFrame->GetWindowRect(rect); + pFrame->MoveWindow(rect); + } +} + +// NOTE: this must be called after setting the layout +// to have the view and its controls displayed properly +BOOL CResizableMDIChild::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly) +{ + m_sSection = pszSection; + + m_bEnableSaveRestore = TRUE; + m_bRectOnly = bRectOnly; + + // restore immediately + return LoadWindowRect(pszSection, bRectOnly); +} + +void CResizableMDIChild::OnDestroy() +{ + if (m_bEnableSaveRestore) + SaveWindowRect(m_sSection, m_bRectOnly); + + CMDIChildWnd::OnDestroy(); +} diff --git a/ResizableLib/ResizableMDIChild.h b/ResizableLib/ResizableMDIChild.h new file mode 100644 index 0000000..87f029e --- /dev/null +++ b/ResizableLib/ResizableMDIChild.h @@ -0,0 +1,83 @@ +#if !defined(AFX_RESIZABLEMDICHILD_H__EA9AE112_0E99_4D6E_B42B_A3BA9DE3756E__INCLUDED_) +#define AFX_RESIZABLEMDICHILD_H__EA9AE112_0E99_4D6E_B42B_A3BA9DE3756E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// ResizableMDIChild.h : header file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "ResizableMinMax.h" +#include "ResizableState.h" + +///////////////////////////////////////////////////////////////////////////// +// CResizableMDIChild frame + +class CResizableMDIChild : public CMDIChildWnd, public CResizableMinMax, + public CResizableState +{ + DECLARE_DYNCREATE(CResizableMDIChild) +protected: + CResizableMDIChild(); // protected constructor used by dynamic creation + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CResizableMDIChild) + protected: + //}}AFX_VIRTUAL + +// Implementation +protected: + virtual ~CResizableMDIChild(); + + BOOL EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE); + + virtual CWnd* GetResizableWnd() + { + // make the layout know its parent window + return this; + }; + +private: + // flags + BOOL m_bEnableSaveRestore; + BOOL m_bRectOnly; + + // internal status + CString m_sSection; // section name (identifies a parent window) + +protected: + // Generated message map functions + //{{AFX_MSG(CResizableMDIChild) + afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnDestroy(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_RESIZABLEMDICHILD_H__EA9AE112_0E99_4D6E_B42B_A3BA9DE3756E__INCLUDED_) diff --git a/ResizableLib/ResizableMDIFrame.cpp b/ResizableLib/ResizableMDIFrame.cpp new file mode 100644 index 0000000..a12b23c --- /dev/null +++ b/ResizableLib/ResizableMDIFrame.cpp @@ -0,0 +1,107 @@ +// ResizableMDIFrame.cpp : implementation file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizableMDIFrame.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CResizableMDIFrame + +IMPLEMENT_DYNCREATE(CResizableMDIFrame, CMDIFrameWnd) + +CResizableMDIFrame::CResizableMDIFrame() +{ + m_bEnableSaveRestore = FALSE; +} + +CResizableMDIFrame::~CResizableMDIFrame() +{ +} + + +BEGIN_MESSAGE_MAP(CResizableMDIFrame, CMDIFrameWnd) + //{{AFX_MSG_MAP(CResizableMDIFrame) + ON_WM_GETMINMAXINFO() + ON_WM_DESTROY() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CResizableMDIFrame message handlers + +void CResizableMDIFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +{ + MinMaxInfo(lpMMI); + + BOOL bMaximized = FALSE; + CMDIChildWnd* pChild = MDIGetActive(&bMaximized); + if (pChild == NULL || !bMaximized) + return; + + // get the extra size from child to frame + CRect rectChild, rectWnd; + GetWindowRect(rectWnd); + RepositionBars(0, 0xFFFF, AFX_IDW_PANE_FIRST, reposQuery, rectChild); + CSize sizeExtra = rectWnd.Size() - rectChild.Size(); + + // ask the child frame for track size + MINMAXINFO mmiView = *lpMMI; + pChild->SendMessage(WM_GETMINMAXINFO, 0, (LPARAM)&mmiView); + mmiView.ptMaxTrackSize = sizeExtra + mmiView.ptMaxTrackSize; + mmiView.ptMinTrackSize = sizeExtra + mmiView.ptMinTrackSize; + + // min size is the largest + lpMMI->ptMinTrackSize.x = __max(lpMMI->ptMinTrackSize.x, + mmiView.ptMinTrackSize.x); + lpMMI->ptMinTrackSize.y = __max(lpMMI->ptMinTrackSize.y, + mmiView.ptMinTrackSize.y); + + // max size is the shortest + lpMMI->ptMaxTrackSize.x = __min(lpMMI->ptMaxTrackSize.x, + mmiView.ptMaxTrackSize.x); + lpMMI->ptMaxTrackSize.y = __min(lpMMI->ptMaxTrackSize.y, + mmiView.ptMaxTrackSize.y); + + // MDI should call default implementation + CMDIFrameWnd::OnGetMinMaxInfo(lpMMI); +} + +// NOTE: this must be called after setting the layout +// to have the view and its controls displayed properly +BOOL CResizableMDIFrame::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly) +{ + m_sSection = pszSection; + + m_bEnableSaveRestore = TRUE; + m_bRectOnly = bRectOnly; + + // restore immediately + return LoadWindowRect(pszSection, bRectOnly); +} + +void CResizableMDIFrame::OnDestroy() +{ + if (m_bEnableSaveRestore) + SaveWindowRect(m_sSection, m_bRectOnly); + + CMDIFrameWnd::OnDestroy(); +} diff --git a/ResizableLib/ResizableMDIFrame.h b/ResizableLib/ResizableMDIFrame.h new file mode 100644 index 0000000..e71f322 --- /dev/null +++ b/ResizableLib/ResizableMDIFrame.h @@ -0,0 +1,81 @@ +#if !defined(AFX_RESIZABLEMDIFRAME_H__4BA07057_6EF3_43A4_A80B_A24FA3A8B5C7__INCLUDED_) +#define AFX_RESIZABLEMDIFRAME_H__4BA07057_6EF3_43A4_A80B_A24FA3A8B5C7__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// ResizableMDIFrame.h : header file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "ResizableMinMax.h" +#include "ResizableState.h" + +///////////////////////////////////////////////////////////////////////////// +// CResizableMDIFrame frame + +class CResizableMDIFrame : public CMDIFrameWnd, public CResizableMinMax, + public CResizableState +{ + DECLARE_DYNCREATE(CResizableMDIFrame) +protected: + CResizableMDIFrame(); // protected constructor used by dynamic creation + +// Attributes +protected: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CResizableMDIFrame) + //}}AFX_VIRTUAL + +// Implementation +protected: + virtual ~CResizableMDIFrame(); + + BOOL EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE); + + virtual CWnd* GetResizableWnd() + { + // make the layout know its parent window + return this; + }; + +private: + // flags + BOOL m_bEnableSaveRestore; + BOOL m_bRectOnly; + + // internal status + CString m_sSection; // section name (identifies a parent window) + +protected: + // Generated message map functions + //{{AFX_MSG(CResizableMDIFrame) + afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); + afx_msg void OnDestroy(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_RESIZABLEMDIFRAME_H__4BA07057_6EF3_43A4_A80B_A24FA3A8B5C7__INCLUDED_) diff --git a/ResizableLib/ResizableMinMax.cpp b/ResizableLib/ResizableMinMax.cpp new file mode 100644 index 0000000..758b599 --- /dev/null +++ b/ResizableLib/ResizableMinMax.cpp @@ -0,0 +1,95 @@ +// ResizableMinMax.cpp: implementation of the CResizableMinMax class. +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizableMinMax.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CResizableMinMax::CResizableMinMax() +{ + m_bUseMinTrack = FALSE; + m_bUseMaxTrack = FALSE; + m_bUseMaxRect = FALSE; +} + +CResizableMinMax::~CResizableMinMax() +{ + +} + +void CResizableMinMax::MinMaxInfo(LPMINMAXINFO lpMMI) +{ + if (m_bUseMinTrack) + lpMMI->ptMinTrackSize = m_ptMinTrackSize; + + if (m_bUseMaxTrack) + lpMMI->ptMaxTrackSize = m_ptMaxTrackSize; + + if (m_bUseMaxRect) + { + lpMMI->ptMaxPosition = m_ptMaxPos; + lpMMI->ptMaxSize = m_ptMaxSize; + } +} + +void CResizableMinMax::SetMaximizedRect(const CRect& rc) +{ + m_bUseMaxRect = TRUE; + + m_ptMaxPos = rc.TopLeft(); + m_ptMaxSize.x = rc.Width(); + m_ptMaxSize.y = rc.Height(); +} + +void CResizableMinMax::ResetMaximizedRect() +{ + m_bUseMaxRect = FALSE; +} + +void CResizableMinMax::SetMinTrackSize(const CSize& size) +{ + m_bUseMinTrack = TRUE; + + m_ptMinTrackSize.x = size.cx; + m_ptMinTrackSize.y = size.cy; +} + +void CResizableMinMax::ResetMinTrackSize() +{ + m_bUseMinTrack = FALSE; +} + +void CResizableMinMax::SetMaxTrackSize(const CSize& size) +{ + m_bUseMaxTrack = TRUE; + + m_ptMaxTrackSize.x = size.cx; + m_ptMaxTrackSize.y = size.cy; +} + +void CResizableMinMax::ResetMaxTrackSize() +{ + m_bUseMaxTrack = FALSE; +} diff --git a/ResizableLib/ResizableMinMax.h b/ResizableLib/ResizableMinMax.h new file mode 100644 index 0000000..9964fdc --- /dev/null +++ b/ResizableLib/ResizableMinMax.h @@ -0,0 +1,53 @@ +// ResizableMinMax.h: interface for the CResizableMinMax class. +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_RESIZABLEMINMAX_H__INCLUDED_) +#define AFX_RESIZABLEMINMAX_H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CResizableMinMax +{ +// Attributes +private: + // flags + BOOL m_bUseMaxTrack; + BOOL m_bUseMinTrack; + BOOL m_bUseMaxRect; + + POINT m_ptMinTrackSize; // min tracking size + POINT m_ptMaxTrackSize; // max tracking size + POINT m_ptMaxPos; // maximized position + POINT m_ptMaxSize; // maximized size + +public: + CResizableMinMax(); + virtual ~CResizableMinMax(); + +protected: + void MinMaxInfo(LPMINMAXINFO lpMMI); + + void SetMaximizedRect(const CRect& rc); // set window rect when maximized + void ResetMaximizedRect(); // reset to default maximized rect + void SetMinTrackSize(const CSize& size); // set minimum tracking size + void ResetMinTrackSize(); // reset to default minimum tracking size + void SetMaxTrackSize(const CSize& size); // set maximum tracking size + void ResetMaxTrackSize(); // reset to default maximum tracking size +}; + +#endif // !defined(AFX_RESIZABLEMINMAX_H__INCLUDED_) diff --git a/ResizableLib/ResizableMsgSupport.h b/ResizableLib/ResizableMsgSupport.h new file mode 100644 index 0000000..91dbfec --- /dev/null +++ b/ResizableLib/ResizableMsgSupport.h @@ -0,0 +1,61 @@ +// ResizableMsgSupport.h: some declarations to support custom resizable wnds +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_RESIZABLEMSGSUPPORT_H__INCLUDED_) +#define AFX_RESIZABLEMSGSUPPORT_H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +typedef struct tagRESIZEPROPERTIES +{ + // wether to ask for resizing properties every time + BOOL bAskClipping; + BOOL bAskRefresh; + // otherwise, use the cached properties + BOOL bCachedLikesClipping; + BOOL bCachedNeedsRefresh; + + // initialize with valid data + tagRESIZEPROPERTIES() : bAskClipping(TRUE), bAskRefresh(TRUE) {} + +} RESIZEPROPERTIES, *PRESIZEPROPERTIES, *LPRESIZEPROPERTIES; + + +typedef struct tagCLIPPINGPROPERTY +{ + BOOL bLikesClipping; + + // initialize with valid data + tagCLIPPINGPROPERTY() : bLikesClipping(FALSE) {} + +} CLIPPINGPROPERTY, *PCLIPPINGPROPERTY, *LPCLIPPINGPROPERTY; + + +typedef struct tagREFRESHPROPERTY +{ + BOOL bNeedsRefresh; + RECT rcOld; + RECT rcNew; + + // initialize with valid data + tagREFRESHPROPERTY() : bNeedsRefresh(TRUE) {} + +} REFRESHPROPERTY, *PREFRESHPROPERTY, *LPREFRESHPROPERTY; + + +#endif // !defined(AFX_RESIZABLEMSGSUPPORT_H__INCLUDED_) diff --git a/ResizableLib/ResizableMsgSupport.inl b/ResizableLib/ResizableMsgSupport.inl new file mode 100644 index 0000000..16b84ce --- /dev/null +++ b/ResizableLib/ResizableMsgSupport.inl @@ -0,0 +1,56 @@ +// ResizableMsgSupport.inl: some definitions to support custom resizable wnds +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + + +// registered message to communicate with the library +// (defined so that in the same executable it is initialized only once) +const UINT WMU_RESIZESUPPORT = ::RegisterWindowMessage(_T("WMU_RESIZESUPPORT")); + +// if the message is implemented the returned value must be non-zero +// the default window procedure returns zero for unhandled messages + +// wParam is one of the following RSZSUP_* values, lParam as specified + +#define RSZSUP_QUERYPROPERTIES 101 // lParam = LPRESIZEPROPERTIES + +#define RSZSUP_LIKESCLIPPING 102 // lParam = LPCLIPPINGPROPERTY + +#define RSZSUP_NEEDSREFRESH 103 // lParam = LPREFRESHPROPERTY + + +///////////////////////////////////////////////////////////////////////////// +// utility functions + +inline BOOL Send_QueryProperties(HWND hWnd, LPRESIZEPROPERTIES pResizeProperties) +{ + ASSERT(::IsWindow(hWnd)); + return (0 != SendMessage(hWnd, WMU_RESIZESUPPORT, + RSZSUP_QUERYPROPERTIES, (LPARAM)pResizeProperties)); +} + +inline BOOL Send_LikesClipping(HWND hWnd, LPCLIPPINGPROPERTY pClippingProperty) +{ + ASSERT(::IsWindow(hWnd)); + return (0 != SendMessage(hWnd, WMU_RESIZESUPPORT, + RSZSUP_LIKESCLIPPING, (LPARAM)pClippingProperty)); +} + +inline BOOL Send_NeedsRefresh(HWND hWnd, LPREFRESHPROPERTY pRefreshProperty) +{ + ASSERT(::IsWindow(hWnd)); + return (0 != SendMessage(hWnd, WMU_RESIZESUPPORT, + RSZSUP_NEEDSREFRESH, (LPARAM)pRefreshProperty)); +} diff --git a/ResizableLib/ResizablePage.cpp b/ResizableLib/ResizablePage.cpp new file mode 100644 index 0000000..ae9fde9 --- /dev/null +++ b/ResizableLib/ResizablePage.cpp @@ -0,0 +1,78 @@ +// ResizablePage.cpp : implementation file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizablePage.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CResizablePage + +IMPLEMENT_DYNCREATE(CResizablePage, CPropertyPage) + +CResizablePage::CResizablePage() +{ +} + +CResizablePage::CResizablePage(UINT nIDTemplate, UINT nIDCaption) + : CPropertyPage(nIDTemplate, nIDCaption) +{ +} + +CResizablePage::CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption) + : CPropertyPage(lpszTemplateName, nIDCaption) +{ +} + +CResizablePage::~CResizablePage() +{ +} + + +BEGIN_MESSAGE_MAP(CResizablePage, CPropertyPage) + //{{AFX_MSG_MAP(CResizablePage) + ON_WM_SIZE() + ON_WM_ERASEBKGND() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + + +///////////////////////////////////////////////////////////////////////////// +// CResizablePage message handlers + +void CResizablePage::OnSize(UINT nType, int cx, int cy) +{ + CWnd::OnSize(nType, cx, cy); + + ArrangeLayout(); +} + +BOOL CResizablePage::OnEraseBkgnd(CDC* pDC) +{ + // Windows XP doesn't like clipping regions ...try this! + EraseBackground(pDC); + return TRUE; + +/* ClipChildren(pDC); // old-method (for safety) + + return CPropertyPage::OnEraseBkgnd(pDC); +*/ +} diff --git a/ResizableLib/ResizablePage.h b/ResizableLib/ResizablePage.h new file mode 100644 index 0000000..99d517c --- /dev/null +++ b/ResizableLib/ResizablePage.h @@ -0,0 +1,78 @@ +#if !defined(AFX_RESIZABLEPAGE_H__INCLUDED_) +#define AFX_RESIZABLEPAGE_H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +// ResizablePage.h : header file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "ResizableLayout.h" + + +///////////////////////////////////////////////////////////////////////////// +// CResizablePage window + +class CResizablePage : public CPropertyPage, public CResizableLayout +{ + DECLARE_DYNCREATE(CResizablePage) + +// Construction +public: + CResizablePage(); + CResizablePage(UINT nIDTemplate, UINT nIDCaption = 0); + CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption = 0); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CResizablePage) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CResizablePage(); + +// callable from derived classes +protected: + + virtual CWnd* GetResizableWnd() + { + // make the layout know its parent window + return this; + }; + +// Generated message map functions +protected: + //{{AFX_MSG(CResizablePage) + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_RESIZABLEPAGE_H__INCLUDED_) diff --git a/ResizableLib/ResizablePageEx.cpp b/ResizableLib/ResizablePageEx.cpp new file mode 100644 index 0000000..9fd6155 --- /dev/null +++ b/ResizableLib/ResizablePageEx.cpp @@ -0,0 +1,92 @@ +// ResizablePageEx.cpp : implementation file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#define _WIN32_IE 0x0600 // for CPropertyPageEx, CPropertySheetEx +#define _WIN32_WINNT 0x0501 // for CPropertyPageEx, CPropertySheetEx +#include // MFC core and standard components +#include // MFC extensions +#include // MFC support for Windows Common Controls + +#include "ResizablePageEx.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CResizablePageEx + +IMPLEMENT_DYNCREATE(CResizablePageEx, CPropertyPageEx) + +CResizablePageEx::CResizablePageEx() +{ +} + +CResizablePageEx::CResizablePageEx(UINT nIDTemplate, UINT nIDCaption, UINT nIDHeaderTitle, UINT nIDHeaderSubTitle) + : CPropertyPageEx(nIDTemplate, nIDCaption, nIDHeaderTitle, nIDHeaderSubTitle) +{ +} + +CResizablePageEx::CResizablePageEx(LPCTSTR lpszTemplateName, UINT nIDCaption, UINT nIDHeaderTitle, UINT nIDHeaderSubTitle) + : CPropertyPageEx(lpszTemplateName, nIDCaption, nIDHeaderTitle, nIDHeaderSubTitle) +{ +} + +CResizablePageEx::~CResizablePageEx() +{ +} + + +BEGIN_MESSAGE_MAP(CResizablePageEx, CPropertyPageEx) + //{{AFX_MSG_MAP(CResizablePageEx) + ON_WM_SIZE() + ON_WM_ERASEBKGND() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + + +///////////////////////////////////////////////////////////////////////////// +// CResizablePageEx message handlers + +void CResizablePageEx::OnSize(UINT nType, int cx, int cy) +{ + CWnd::OnSize(nType, cx, cy); + + ArrangeLayout(); +} + +BOOL CResizablePageEx::OnEraseBkgnd(CDC* pDC) +{ + // Windows XP doesn't like clipping regions ...try this! + EraseBackground(pDC); + return TRUE; + +/* ClipChildren(pDC); // old-method (for safety) + + return CPropertyPageEx::OnEraseBkgnd(pDC); +*/ +} + +BOOL CResizablePageEx::NeedsRefresh(const CResizableLayout::LayoutInfo& layout, + const CRect& rectOld, const CRect& rectNew) +{ + if (m_psp.dwFlags | PSP_HIDEHEADER) + return TRUE; + + return CResizableLayout::NeedsRefresh(layout, rectOld, rectNew); +} diff --git a/ResizableLib/ResizablePageEx.h b/ResizableLib/ResizablePageEx.h new file mode 100644 index 0000000..885045a --- /dev/null +++ b/ResizableLib/ResizablePageEx.h @@ -0,0 +1,81 @@ +#if !defined(AFX_RESIZABLEPAGEEX_H__INCLUDED_) +#define AFX_RESIZABLEPAGEEX_H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +// ResizablePageEx.h : header file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "ResizableLayout.h" + + +///////////////////////////////////////////////////////////////////////////// +// CResizablePageEx window + +class CResizablePageEx : public CPropertyPageEx, public CResizableLayout +{ + DECLARE_DYNCREATE(CResizablePageEx) + +// Construction +public: + CResizablePageEx(); + CResizablePageEx(UINT nIDTemplate, UINT nIDCaption = 0, UINT nIDHeaderTitle = 0, UINT nIDHeaderSubTitle = 0); + CResizablePageEx(LPCTSTR lpszTemplateName, UINT nIDCaption = 0, UINT nIDHeaderTitle = 0, UINT nIDHeaderSubTitle = 0); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CResizablePageEx) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CResizablePageEx(); + +// callable from derived classes +protected: + // override to specify refresh for custom or unsupported windows + virtual BOOL NeedsRefresh(const CResizableLayout::LayoutInfo &layout, + const CRect &rectOld, const CRect &rectNew); + + virtual CWnd* GetResizableWnd() + { + // make the layout know its parent window + return this; + }; + +// Generated message map functions +protected: + //{{AFX_MSG(CResizablePageEx) + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_RESIZABLEPAGEEX_H__INCLUDED_) diff --git a/ResizableLib/ResizableSheet.cpp b/ResizableLib/ResizableSheet.cpp new file mode 100644 index 0000000..dfcca3b --- /dev/null +++ b/ResizableLib/ResizableSheet.cpp @@ -0,0 +1,355 @@ +// ResizableSheet.cpp : implementation file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizableSheet.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CResizableSheet + +IMPLEMENT_DYNAMIC(CResizableSheet, CPropertySheet) + +inline void CResizableSheet::PrivateConstruct() +{ + m_bEnableSaveRestore = FALSE; + m_bSavePage = FALSE; + m_dwGripTempState = 1; +} + + +CResizableSheet::CResizableSheet() +{ + PrivateConstruct(); +} + +CResizableSheet::CResizableSheet(UINT nIDCaption, CWnd *pParentWnd, UINT iSelectPage) + : CPropertySheet(nIDCaption, pParentWnd, iSelectPage) +{ + PrivateConstruct(); +} + +CResizableSheet::CResizableSheet(LPCTSTR pszCaption, CWnd *pParentWnd, UINT iSelectPage) + : CPropertySheet(pszCaption, pParentWnd, iSelectPage) +{ + PrivateConstruct(); +} + +CResizableSheet::~CResizableSheet() +{ +} + +BEGIN_MESSAGE_MAP(CResizableSheet, CPropertySheet) + //{{AFX_MSG_MAP(CResizableSheet) + ON_WM_GETMINMAXINFO() + ON_WM_SIZE() + ON_WM_DESTROY() + ON_WM_CREATE() + ON_WM_ERASEBKGND() + //}}AFX_MSG_MAP + ON_NOTIFY_REFLECT_EX(PSN_SETACTIVE, OnPageChanging) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CResizableSheet message handlers + +int CResizableSheet::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CPropertySheet::OnCreate(lpCreateStruct) == -1) + return -1; + + // keep client area + CRect rect; + GetClientRect(&rect); + // set resizable style + ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME); + // adjust size to reflect new style + ::AdjustWindowRectEx(&rect, GetStyle(), + ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle()); + SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED| + SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION); + + // create and init the size-grip + if (!CreateSizeGrip()) + return -1; + + return 0; +} + +BOOL CResizableSheet::OnInitDialog() +{ + BOOL bResult = CPropertySheet::OnInitDialog(); + + // set the initial size as the min track size + CRect rc; + GetWindowRect(&rc); + SetMinTrackSize(rc.Size()); + + // initialize layout + PresetLayout(); + + // prevent flickering + GetTabControl()->ModifyStyle(0, WS_CLIPSIBLINGS); + + return bResult; +} + +void CResizableSheet::OnDestroy() +{ + if (m_bEnableSaveRestore) + { + SaveWindowRect(m_sSection, m_bRectOnly); + SavePage(); + } + + RemoveAllAnchors(); + + CPropertySheet::OnDestroy(); +} + +// maps an index to a button ID and vice-versa +static UINT _propButtons[] = +{ + IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP, + ID_WIZBACK, ID_WIZNEXT, ID_WIZFINISH +}; +const int _propButtonsCount = sizeof(_propButtons)/sizeof(UINT); + +// horizontal line in wizard mode +#define ID_WIZLINE ID_WIZFINISH+1 + +void CResizableSheet::PresetLayout() +{ + if (IsWizard()) // wizard mode + { + // hide tab control + GetTabControl()->ShowWindow(SW_HIDE); + + AddAnchor(ID_WIZLINE, BOTTOM_LEFT, BOTTOM_RIGHT); + } + else // tab mode + { + AddAnchor(AFX_IDC_TAB_CONTROL, TOP_LEFT, BOTTOM_RIGHT); + } + + // add a callback for active page (which can change at run-time) + AddAnchorCallback(1); + + // use *total* parent size to have correct margins + CRect rectPage, rectSheet; + GetTotalClientRect(&rectSheet); + + GetActivePage()->GetWindowRect(&rectPage); + ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectPage, 2); + + // pre-calculate margins + m_sizePageTL = rectPage.TopLeft() - rectSheet.TopLeft(); + m_sizePageBR = rectPage.BottomRight() - rectSheet.BottomRight(); + + // add all possible buttons, if they exist + for (int i = 0; i < _propButtonsCount; i++) + { + if (NULL != GetDlgItem(_propButtons[i])) + AddAnchor(_propButtons[i], BOTTOM_RIGHT); + } +} + +BOOL CResizableSheet::ArrangeLayoutCallback(LayoutInfo &layout) +{ + if (layout.nCallbackID != 1) // we only added 1 callback + return CResizableLayout::ArrangeLayoutCallback(layout); + + // set layout info for active page + layout.hWnd = (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0); + if (!::IsWindow(layout.hWnd)) + return FALSE; + + // set margins + if (IsWizard()) // wizard mode + { + // use pre-calculated margins + layout.sizeMarginTL = m_sizePageTL; + layout.sizeMarginBR = m_sizePageBR; + } + else // tab mode + { + CTabCtrl* pTab = GetTabControl(); + ASSERT(pTab != NULL); + + // get tab position after resizing and calc page rect + CRect rectPage, rectSheet; + GetTotalClientRect(&rectSheet); + + VERIFY(GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage)); + pTab->AdjustRect(FALSE, &rectPage); + + // set margins + layout.sizeMarginTL = rectPage.TopLeft() - rectSheet.TopLeft(); + layout.sizeMarginBR = rectPage.BottomRight() - rectSheet.BottomRight(); + } + + // set anchor types + layout.sizeTypeTL = TOP_LEFT; + layout.sizeTypeBR = BOTTOM_RIGHT; + + // use this layout info + return TRUE; +} + +void CResizableSheet::OnSize(UINT nType, int cx, int cy) +{ + CWnd::OnSize(nType, cx, cy); + + if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW) + return; // arrangement not needed + + if (nType == SIZE_MAXIMIZED) + HideSizeGrip(&m_dwGripTempState); + else + ShowSizeGrip(&m_dwGripTempState); + + // update grip and layout + UpdateSizeGrip(); + ArrangeLayout(); +} + +BOOL CResizableSheet::OnPageChanging(NMHDR* /*pNotifyStruct*/, LRESULT* /*pResult*/) +{ + // update new wizard page + // active page changes after this notification + PostMessage(WM_SIZE); + + return FALSE; // continue routing +} + +BOOL CResizableSheet::OnEraseBkgnd(CDC* pDC) +{ + // Windows XP doesn't like clipping regions ...try this! + EraseBackground(pDC); + return TRUE; + +/* ClipChildren(pDC); // old-method (for safety) + + return CPropertySheet::OnEraseBkgnd(pDC); +*/ +} + +void CResizableSheet::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +{ + MinMaxInfo(lpMMI); +} + +// protected members + +int CResizableSheet::GetMinWidth() +{ + CWnd* pWnd = NULL; + CRect rectWnd, rectSheet; + GetTotalClientRect(&rectSheet); + + int max = 0, min = rectSheet.Width(); + // search for leftmost and rightmost button margins + for (int i = 0; i < 7; i++) + { + pWnd = GetDlgItem(_propButtons[i]); + // exclude not present or hidden buttons + if (pWnd == NULL || !(pWnd->GetStyle() & WS_VISIBLE)) + continue; + + // left position is relative to the right border + // of the parent window (negative value) + pWnd->GetWindowRect(&rectWnd); + ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectWnd, 2); + int left = rectSheet.right - rectWnd.left; + int right = rectSheet.right - rectWnd.right; + + if (left > max) + max = left; + if (right < min) + min = right; + } + + // sizing border width + int border = GetSystemMetrics(SM_CXSIZEFRAME); + + // compute total width + return max + min + 2*border; +} + + +// NOTE: this must be called after all the other settings +// to have the window and its controls displayed properly +void CResizableSheet::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bWithPage) +{ + m_sSection = pszSection; + m_bSavePage = bWithPage; + + m_bEnableSaveRestore = TRUE; + m_bRectOnly = bRectOnly; + + // restore immediately + LoadWindowRect(pszSection, bRectOnly); + LoadPage(); +} + +// private memebers + +// used to save/restore active page +// either in the registry or a private .INI file +// depending on your application settings + +#define ACTIVEPAGE _T("ActivePage") + +void CResizableSheet::SavePage() +{ + if (!m_bSavePage) + return; + + // saves active page index, zero (the first) if problems + // cannot use GetActivePage, because it always fails + + CTabCtrl *pTab = GetTabControl(); + int page = 0; + + if (pTab != NULL) + page = pTab->GetCurSel(); + if (page < 0) + page = 0; + + AfxGetApp()->WriteProfileInt(m_sSection, ACTIVEPAGE, page); +} + +void CResizableSheet::LoadPage() +{ + // restore active page, zero (the first) if not found + int page = AfxGetApp()->GetProfileInt(m_sSection, ACTIVEPAGE, 0); + + if (m_bSavePage) + { + SetActivePage(page); + ArrangeLayout(); // needs refresh + } +} + +void CResizableSheet::RefreshLayout() +{ + SendMessage(WM_SIZE); +} diff --git a/ResizableLib/ResizableSheet.h b/ResizableLib/ResizableSheet.h new file mode 100644 index 0000000..9fc625d --- /dev/null +++ b/ResizableLib/ResizableSheet.h @@ -0,0 +1,114 @@ +#if !defined(AFX_RESIZABLESHEET_H__INCLUDED_) +#define AFX_RESIZABLESHEET_H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "ResizableLayout.h" +#include "ResizableGrip.h" +#include "ResizableMinMax.h" +#include "ResizableState.h" + +///////////////////////////////////////////////////////////////////////////// +// ResizableSheet.h : header file +// + +class CResizableSheet : public CPropertySheet, public CResizableLayout, + public CResizableGrip, public CResizableMinMax, + public CResizableState +{ + DECLARE_DYNAMIC(CResizableSheet) + +// Construction +public: + CResizableSheet(); + CResizableSheet(UINT nIDCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0); + CResizableSheet(LPCTSTR pszCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0); + +// Attributes +private: + // support for temporarily hiding the grip + DWORD m_dwGripTempState; + + // flags + BOOL m_bEnableSaveRestore; + BOOL m_bRectOnly; + BOOL m_bSavePage; + + // layout vars + CSize m_sizePageTL, m_sizePageBR; + + // internal status + CString m_sSection; // section name (identifies a parent window) + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CResizableSheet) + public: + virtual BOOL OnInitDialog(); + //}}AFX_VIRTUAL + protected: + +// Implementation +public: + void RefreshLayout(); + virtual ~CResizableSheet(); + +// used internally +private: + void PresetLayout(); + void PrivateConstruct(); + void SavePage(); + void LoadPage(); + + BOOL IsWizard() { return (m_psh.dwFlags & PSH_WIZARD); } + +// callable from derived classes +protected: + // section to use in app's profile + void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE, + BOOL bWithPage = FALSE); + int GetMinWidth(); // minimum width to display all buttons + + + virtual CWnd* GetResizableWnd() + { + // make the layout know its parent window + return this; + }; + +// Generated message map functions +protected: + virtual BOOL ArrangeLayoutCallback(LayoutInfo& layout); + //{{AFX_MSG(CResizableSheet) + afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnDestroy(); + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + //}}AFX_MSG + afx_msg BOOL OnPageChanging(NMHDR* pNotifyStruct, LRESULT* pResult); + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +#endif // AFX_RESIZABLESHEET_H__INCLUDED_ diff --git a/ResizableLib/ResizableSheetEx.cpp b/ResizableLib/ResizableSheetEx.cpp new file mode 100644 index 0000000..e076873 --- /dev/null +++ b/ResizableLib/ResizableSheetEx.cpp @@ -0,0 +1,385 @@ +// ResizableSheetEx.cpp : implementation file +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#define _WIN32_IE 0x0600 // for CPropertyPageEx, CPropertySheetEx +#define _WIN32_WINNT 0x0501 // for CPropertyPageEx, CPropertySheetEx +#include // MFC core and standard components +#include // MFC extensions +#include // MFC support for Windows Common Controls + +#include "ResizableSheetEx.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CResizableSheetEx + +IMPLEMENT_DYNAMIC(CResizableSheetEx, CPropertySheetEx) + +inline void CResizableSheetEx::PrivateConstruct() +{ + m_bEnableSaveRestore = FALSE; + m_bSavePage = FALSE; + m_dwGripTempState = 1; +} + + +CResizableSheetEx::CResizableSheetEx() +{ + PrivateConstruct(); +} + +CResizableSheetEx::CResizableSheetEx(UINT nIDCaption, CWnd* pParentWnd, + UINT iSelectPage, HBITMAP hbmWatermark, HPALETTE hpalWatermark, + HBITMAP hbmHeader) +: CPropertySheetEx(nIDCaption, pParentWnd, iSelectPage, + hbmWatermark, hpalWatermark, hbmHeader) +{ + PrivateConstruct(); +} + +CResizableSheetEx::CResizableSheetEx(LPCTSTR pszCaption, CWnd* pParentWnd, + UINT iSelectPage, HBITMAP hbmWatermark, HPALETTE hpalWatermark, + HBITMAP hbmHeader) +: CPropertySheetEx(pszCaption, pParentWnd, iSelectPage, + hbmWatermark, hpalWatermark, hbmHeader) +{ + PrivateConstruct(); +} + + +CResizableSheetEx::~CResizableSheetEx() +{ +} + +BEGIN_MESSAGE_MAP(CResizableSheetEx, CPropertySheetEx) + //{{AFX_MSG_MAP(CResizableSheetEx) + ON_WM_GETMINMAXINFO() + ON_WM_SIZE() + ON_WM_DESTROY() + ON_WM_CREATE() + ON_WM_ERASEBKGND() + //}}AFX_MSG_MAP + ON_NOTIFY_REFLECT_EX(PSN_SETACTIVE, OnPageChanging) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CResizableSheetEx message handlers + +int CResizableSheetEx::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CPropertySheetEx::OnCreate(lpCreateStruct) == -1) + return -1; + + // keep client area + CRect rect; + GetClientRect(&rect); + // set resizable style + ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME); + // adjust size to reflect new style + ::AdjustWindowRectEx(&rect, GetStyle(), + ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle()); + SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED| + SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION); + + // create and init the size-grip + if (!CreateSizeGrip()) + return -1; + + return 0; +} + +BOOL CResizableSheetEx::OnInitDialog() +{ + BOOL bResult = CPropertySheetEx::OnInitDialog(); + + // set the initial size as the min track size + CRect rc; + GetWindowRect(&rc); + SetMinTrackSize(rc.Size()); + + // initialize layout + PresetLayout(); + + // prevent flickering + GetTabControl()->ModifyStyle(0, WS_CLIPSIBLINGS); + + return bResult; +} + +void CResizableSheetEx::OnDestroy() +{ + if (m_bEnableSaveRestore) + { + SaveWindowRect(m_sSection, m_bRectOnly); + SavePage(); + } + + RemoveAllAnchors(); + + CPropertySheetEx::OnDestroy(); +} + +// maps an index to a button ID and vice-versa +static UINT _propButtons[] = +{ + IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP, + ID_WIZBACK, ID_WIZNEXT, ID_WIZFINISH +}; + +// horizontal line in wizard mode +#define ID_WIZLINE ID_WIZFINISH+1 +#define ID_WIZLINEHDR ID_WIZFINISH+2 + +void CResizableSheetEx::PresetLayout() +{ + if (IsWizard() || IsWizard97()) // wizard mode + { + // hide tab control + GetTabControl()->ShowWindow(SW_HIDE); + + AddAnchor(ID_WIZLINE, BOTTOM_LEFT, BOTTOM_RIGHT); + + if (IsWizard97()) // add header line for wizard97 dialogs + AddAnchor(ID_WIZLINEHDR, TOP_LEFT, TOP_RIGHT); + } + else // tab mode + { + AddAnchor(AFX_IDC_TAB_CONTROL, TOP_LEFT, BOTTOM_RIGHT); + } + + // add a callback for active page (which can change at run-time) + AddAnchorCallback(1); + + // use *total* parent size to have correct margins + CRect rectPage, rectSheet; + GetTotalClientRect(&rectSheet); + + GetActivePage()->GetWindowRect(&rectPage); + ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectPage, 2); + + // pre-calculate margins + m_sizePageTL = rectPage.TopLeft() - rectSheet.TopLeft(); + m_sizePageBR = rectPage.BottomRight() - rectSheet.BottomRight(); + + // add all possible buttons, if they exist + for (int i = 0; i < 7; i++) + { + if (NULL != GetDlgItem(_propButtons[i])) + AddAnchor(_propButtons[i], BOTTOM_RIGHT); + } +} + +BOOL CResizableSheetEx::ArrangeLayoutCallback(LayoutInfo &layout) +{ + if (layout.nCallbackID != 1) // we only added 1 callback + return CResizableLayout::ArrangeLayoutCallback(layout); + + // set layout info for active page + layout.hWnd = (HWND)::SendMessage(GetSafeHwnd(), PSM_GETCURRENTPAGEHWND, 0, 0); + if (!::IsWindow(layout.hWnd)) + return FALSE; + + // set margins + if (IsWizard()) // wizard mode + { + // use pre-calculated margins + layout.sizeMarginTL = m_sizePageTL; + layout.sizeMarginBR = m_sizePageBR; + } + else if (IsWizard97()) // wizard 97 + { + // use pre-calculated margins + layout.sizeMarginTL = m_sizePageTL; + layout.sizeMarginBR = m_sizePageBR; + + if (!(GetActivePage()->m_psp.dwFlags & PSP_HIDEHEADER)) + { + // add header vertical offset + CRect rectLine; + GetDlgItem(ID_WIZLINEHDR)->GetWindowRect(&rectLine); + ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectLine, 2); + + layout.sizeMarginTL.cy = rectLine.bottom; + } + } + else // tab mode + { + CTabCtrl* pTab = GetTabControl(); + ASSERT(pTab != NULL); + + // get tab position after resizing and calc page rect + CRect rectPage, rectSheet; + GetTotalClientRect(&rectSheet); + + VERIFY(GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage)); + pTab->AdjustRect(FALSE, &rectPage); + + // set margins + layout.sizeMarginTL = rectPage.TopLeft() - rectSheet.TopLeft(); + layout.sizeMarginBR = rectPage.BottomRight() - rectSheet.BottomRight(); + } + + // set anchor types + layout.sizeTypeTL = TOP_LEFT; + layout.sizeTypeBR = BOTTOM_RIGHT; + + // use this layout info + return TRUE; +} + +void CResizableSheetEx::OnSize(UINT nType, int cx, int cy) +{ + CWnd::OnSize(nType, cx, cy); + + if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW) + return; // arrangement not needed + + if (nType == SIZE_MAXIMIZED) + HideSizeGrip(&m_dwGripTempState); + else + ShowSizeGrip(&m_dwGripTempState); + + // update grip and layout + UpdateSizeGrip(); + ArrangeLayout(); +} + +BOOL CResizableSheetEx::OnPageChanging(NMHDR* /*pNotifyStruct*/, LRESULT* /*pResult*/) +{ + // update new wizard page + // active page changes after this notification + PostMessage(WM_SIZE); + + return FALSE; // continue routing +} + +BOOL CResizableSheetEx::OnEraseBkgnd(CDC* pDC) +{ + // Windows XP doesn't like clipping regions ...try this! + EraseBackground(pDC); + return TRUE; + +/* ClipChildren(pDC); // old-method (for safety) + + return CPropertySheetEx::OnEraseBkgnd(pDC); +*/ +} + +void CResizableSheetEx::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +{ + MinMaxInfo(lpMMI); +} + +// protected members + +int CResizableSheetEx::GetMinWidth() +{ + CWnd* pWnd = NULL; + CRect rectWnd, rectSheet; + GetTotalClientRect(&rectSheet); + + int max = 0, min = rectSheet.Width(); + // search for leftmost and rightmost button margins + for (int i = 0; i < 7; i++) + { + pWnd = GetDlgItem(_propButtons[i]); + // exclude not present or hidden buttons + if (pWnd == NULL || !(pWnd->GetStyle() & WS_VISIBLE)) + continue; + + // left position is relative to the right border + // of the parent window (negative value) + pWnd->GetWindowRect(&rectWnd); + ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectWnd, 2); + int left = rectSheet.right - rectWnd.left; + int right = rectSheet.right - rectWnd.right; + + if (left > max) + max = left; + if (right < min) + min = right; + } + + // sizing border width + int border = GetSystemMetrics(SM_CXSIZEFRAME); + + // compute total width + return max + min + 2*border; +} + +// NOTE: this must be called after all the other settings +// to have the window and its controls displayed properly +void CResizableSheetEx::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bWithPage) +{ + m_sSection = pszSection; + m_bSavePage = bWithPage; + + m_bEnableSaveRestore = TRUE; + m_bRectOnly = bRectOnly; + + // restore immediately + LoadWindowRect(pszSection, bRectOnly); + LoadPage(); +} + +// private memebers + +// used to save/restore active page +// either in the registry or a private .INI file +// depending on your application settings + +#define ACTIVEPAGE _T("ActivePage") + +void CResizableSheetEx::SavePage() +{ + if (!m_bSavePage) + return; + + // saves active page index, zero (the first) if problems + // cannot use GetActivePage, because it always fails + + CTabCtrl *pTab = GetTabControl(); + int page = 0; + + if (pTab != NULL) + page = pTab->GetCurSel(); + if (page < 0) + page = 0; + + AfxGetApp()->WriteProfileInt(m_sSection, ACTIVEPAGE, page); +} + +void CResizableSheetEx::LoadPage() +{ + // restore active page, zero (the first) if not found + int page = AfxGetApp()->GetProfileInt(m_sSection, ACTIVEPAGE, 0); + + if (m_bSavePage) + { + SetActivePage(page); + ArrangeLayout(); // needs refresh + } +} + +void CResizableSheetEx::RefreshLayout() +{ + SendMessage(WM_SIZE); +} diff --git a/ResizableLib/ResizableSheetEx.h b/ResizableLib/ResizableSheetEx.h new file mode 100644 index 0000000..1ac68c3 --- /dev/null +++ b/ResizableLib/ResizableSheetEx.h @@ -0,0 +1,117 @@ +#if !defined(AFX_RESIZABLESHEETEX_H__INCLUDED_) +#define AFX_RESIZABLESHEETEX_H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "ResizableLayout.h" +#include "ResizableGrip.h" +#include "ResizableMinMax.h" +#include "ResizableState.h" + +///////////////////////////////////////////////////////////////////////////// +// ResizableSheetEx.h : header file +// + +class CResizableSheetEx : public CPropertySheetEx, public CResizableLayout, + public CResizableGrip, public CResizableMinMax, + public CResizableState +{ + DECLARE_DYNAMIC(CResizableSheetEx) + +// Construction +public: + CResizableSheetEx(); + CResizableSheetEx(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0, + HBITMAP hbmWatermark = NULL, HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL); + CResizableSheetEx(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0, + HBITMAP hbmWatermark = NULL, HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL); + +// Attributes +private: + // support for temporarily hiding the grip + DWORD m_dwGripTempState; + + // flags + BOOL m_bEnableSaveRestore; + BOOL m_bRectOnly; + BOOL m_bSavePage; + + // layout vars + CSize m_sizePageTL, m_sizePageBR; + + // internal status + CString m_sSection; // section name (identifies a parent window) + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CResizableSheetEx) + public: + virtual BOOL OnInitDialog(); + protected: + //}}AFX_VIRTUAL + +// Implementation +public: + void RefreshLayout(); + virtual ~CResizableSheetEx(); + +// used internally +private: + void PresetLayout(); + void PrivateConstruct(); + void SavePage(); + void LoadPage(); + + BOOL IsWizard() { return (m_psh.dwFlags & PSH_WIZARD); } + BOOL IsWizard97() { return (m_psh.dwFlags & PSH_WIZARD97); } + +// callable from derived classes +protected: + // section to use in app's profile + void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE, + BOOL bWithPage = FALSE); + int GetMinWidth(); // minimum width to display all buttons + + + virtual CWnd* GetResizableWnd() + { + // make the layout know its parent window + return this; + }; + +// Generated message map functions +protected: + virtual BOOL ArrangeLayoutCallback(LayoutInfo& layout); + //{{AFX_MSG(CResizableSheetEx) + afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnDestroy(); + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + //}}AFX_MSG + afx_msg BOOL OnPageChanging(NMHDR* pNotifyStruct, LRESULT* pResult); + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +#endif // AFX_RESIZABLESHEETEX_H__INCLUDED_ diff --git a/ResizableLib/ResizableState.cpp b/ResizableLib/ResizableState.cpp new file mode 100644 index 0000000..410d1f5 --- /dev/null +++ b/ResizableLib/ResizableState.cpp @@ -0,0 +1,111 @@ +// ResizableState.cpp: implementation of the CResizableState class. +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ResizableState.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CResizableState::CResizableState() +{ + +} + +CResizableState::~CResizableState() +{ + +} + + +// used to save/restore window's size and position +// either in the registry or a private .INI file +// depending on your application settings + +#define PLACEMENT_ENT _T("WindowPlacement") +#define PLACEMENT_FMT _T("%d,%d,%d,%d,%d,%d") + +BOOL CResizableState::SaveWindowRect(LPCTSTR pszSection, BOOL bRectOnly) +{ + CString data; + WINDOWPLACEMENT wp; + + ZeroMemory(&wp, sizeof(WINDOWPLACEMENT)); + wp.length = sizeof(WINDOWPLACEMENT); + if (!GetResizableWnd()->GetWindowPlacement(&wp)) + return FALSE; + + RECT& rc = wp.rcNormalPosition; // alias + + if (bRectOnly) // save size/pos only (normal state) + { + // use screen coordinates + GetResizableWnd()->GetWindowRect(&rc); + + data.Format(PLACEMENT_FMT, rc.left, rc.top, + rc.right, rc.bottom, SW_NORMAL, 0); + } + else // save also min/max state + { + // use workspace coordinates + data.Format(PLACEMENT_FMT, rc.left, rc.top, + rc.right, rc.bottom, wp.showCmd, wp.flags); + } + + return AfxGetApp()->WriteProfileString(pszSection, PLACEMENT_ENT, data); +} + +BOOL CResizableState::LoadWindowRect(LPCTSTR pszSection, BOOL bRectOnly) +{ + CString data; + WINDOWPLACEMENT wp; + + data = AfxGetApp()->GetProfileString(pszSection, PLACEMENT_ENT); + + if (data.IsEmpty()) // never saved before + return FALSE; + + ZeroMemory(&wp, sizeof(WINDOWPLACEMENT)); + wp.length = sizeof(WINDOWPLACEMENT); + if (!GetResizableWnd()->GetWindowPlacement(&wp)) + return FALSE; + + RECT& rc = wp.rcNormalPosition; // alias + + if (_stscanf(data, PLACEMENT_FMT, &rc.left, &rc.top, + &rc.right, &rc.bottom, &wp.showCmd, &wp.flags) == 6) + { + if (bRectOnly) // restore size/pos only + { + CRect rect(rc); + return GetResizableWnd()->SetWindowPos(NULL, rect.left, rect.top, + rect.Width(), rect.Height(), SWP_NOACTIVATE | SWP_NOZORDER | + SWP_NOREPOSITION); + } + else // restore also min/max state + { + return GetResizableWnd()->SetWindowPlacement(&wp); + } + } + return FALSE; +} diff --git a/ResizableLib/ResizableState.h b/ResizableLib/ResizableState.h new file mode 100644 index 0000000..57a9ce4 --- /dev/null +++ b/ResizableLib/ResizableState.h @@ -0,0 +1,38 @@ +// ResizableState.h: interface for the CResizableState class. +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2000-2002 by Paolo Messina +// (http://www.geocities.com/ppescher - ppescher@yahoo.com) +// +// The contents of this file are subject to the Artistic License (the "License"). +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// http://www.opensource.org/licenses/artistic-license.html +// +// If you find this code useful, credits would be nice! +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_RESIZABLESTATE_H__INCLUDED_) +#define AFX_RESIZABLESTATE_H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CResizableState +{ +protected: + // non-zero if successful + BOOL LoadWindowRect(LPCTSTR pszSection, BOOL bRectOnly); + BOOL SaveWindowRect(LPCTSTR pszSection, BOOL bRectOnly); + + virtual CWnd* GetResizableWnd() = 0; + +public: + CResizableState(); + virtual ~CResizableState(); +}; + +#endif // !defined(AFX_RESIZABLESTATE_H__INCLUDED_) diff --git a/ResizableLib/StdAfx.cpp b/ResizableLib/StdAfx.cpp new file mode 100644 index 0000000..a7c3002 --- /dev/null +++ b/ResizableLib/StdAfx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes +// ResizableLib.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/ResizableLib/StdAfx.h b/ResizableLib/StdAfx.h new file mode 100644 index 0000000..84f2ee6 --- /dev/null +++ b/ResizableLib/StdAfx.h @@ -0,0 +1,30 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__0A781DD9_5C37_49E2_A4F5_E517F5B8A621__INCLUDED_) +#define AFX_STDAFX_H__0A781DD9_5C37_49E2_A4F5_E517F5B8A621__INCLUDED_ +#define _WIN32_WINNT 0x0501 +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#ifndef WS_EX_LAYOUTRTL +#pragma message("Please update your Windows header files, get the latest SDK") +#define WS_EX_LAYOUTRTL 0x00400000 +#endif + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__0A781DD9_5C37_49E2_A4F5_E517F5B8A621__INCLUDED_) diff --git a/_Fake_Free__Server-List_and_MET.url b/_Fake_Free__Server-List_and_MET.url new file mode 100644 index 0000000..aaae3f9 --- /dev/null +++ b/_Fake_Free__Server-List_and_MET.url @@ -0,0 +1,3 @@ +[InternetShortcut] +URL=http://www.server-met.de/ +Modified=7006C30EE9F7C501ED diff --git a/_eMule-MODs__Infos_Ratings_Downloads.url b/_eMule-MODs__Infos_Ratings_Downloads.url new file mode 100644 index 0000000..7807127 --- /dev/null +++ b/_eMule-MODs__Infos_Ratings_Downloads.url @@ -0,0 +1,5 @@ +[DEFAULT] +BASEURL=http://www.emule-mods.de/ +[InternetShortcut] +URL=http://www.emule-mods.de/ +Modified=404CBD70D3F7C30147 diff --git a/_eMule_Support__german_english.url b/_eMule_Support__german_english.url new file mode 100644 index 0000000..ef37865 --- /dev/null +++ b/_eMule_Support__german_english.url @@ -0,0 +1,5 @@ +[InternetShortcut] +URL=http://www.emule-web.de/board +Modified=C06CDE086911C50152 +IconFile=http://www.emule-web.de/favicon.ico +IconIndex=1 diff --git a/_get_updated_IP-Filter.url b/_get_updated_IP-Filter.url new file mode 100644 index 0000000..713c11f --- /dev/null +++ b/_get_updated_IP-Filter.url @@ -0,0 +1,3 @@ +[InternetShortcut] +URL=http://www.emule-mods.de/?mods=ipfilter +Modified=2053B1C8C3FEC60174 diff --git a/_get_updated_nodes-dat.url b/_get_updated_nodes-dat.url new file mode 100644 index 0000000..713c11f --- /dev/null +++ b/_get_updated_nodes-dat.url @@ -0,0 +1,3 @@ +[InternetShortcut] +URL=http://www.emule-mods.de/?mods=ipfilter +Modified=2053B1C8C3FEC60174 diff --git a/changelog xtreme.txt b/changelog xtreme.txt new file mode 100644 index 0000000..4e6299d --- /dev/null +++ b/changelog xtreme.txt @@ -0,0 +1,1007 @@ +Xtreme 8.1 +---------------- + +Main Features: + +- Maella Bandwidthcontrol, caculates the real Overhead +- NAFC (network adapter feedback control) +- advanced Uploadbandwidththrottler with adjustable slotspeed +- Xtreme Downloadmanager for a clever source-handling +- improved Xtreme-Creditsystem +- Powerrelease with dynamic Hide OS +- IP to country - show country-flags +- Dynamic Leecher Protection (DLP) +- Multi-threaded disc access with threading-queue +- hundrets of code improvements + + +supported languages: +german, english, spanish, french, italian, chinese, turkish, czech + + +based on emule 0.50a +compiled with: +libpng 1.4.3 +zlib 1.2.5 +crypto 5.6.0 +CxImage version 6.00 +EditBinX +ReplaceVistaIcon +Windows Media SDK +DirectX SDK +MiniUPnP Lib (as of official) + + +Xtreme 8.1 +* this version is modded by Stulle +- improved: Check if upload should be ended frequently called twice (Stulle) +- changed: Moved Known2Split setting to Files preferences panel (zz_fly) +- changed: Determine read buffer limit based on slot speed (SiRoB) +partially updated to 8.1 by zz_fly: +- fixed: Client is always highid if we are connecting to them (Enig123) +- fixed: Collection double extension (leuk_he) +- fixed: don't reconnect to banned clients (Enig123) + +Xtreme 8.0 +* this version is modded by Stulle +- updated to 0.50a codebase +- updated cryptolib Version to 5.6.0 (3/15/2009) (Stulle) +- updated libpng to 1.4.3 (Stulle) +- updated zlib to 1.2.5 (Stulle) +- add: Some more countries to country flags feature (tomchen1989) +- add: ATL Server code for VS2008/2010 compilation (Stulle) +- add: added VS10 solution and project files (Stulle) +- add: Ability to translate "Network Adapter" and "eMule control + data" for graphs (Stulle) +- add: Own color option for Network Adapter graph line (Stulle) + requires Network Adapter color to be configured on update +- improved: Made SafeHash ready for new AICH based file identifier (like official) (Stulle) +- improved: update SafeHash from Morph (Stulle) +- improved: update Flush Thread and Read Block From File Thread (Morph/Sirob) +- improved: Visual Studio 2010 Compatibility [Stulle/Avi-3k/ied] +- improved: Don't reset Connection Settings for SysTrayIconMenu (Stulle) +- improved: Sort progress bars by percentage (Fafner/Xman) +- improved: Also include modstring when sorting by software for aMule (Stulle) +- improved: Optimize Process Kad client list (WiZaRd) +- changed: only use narrow font in TransferWnd if enabled (like in 6.1) (Stulle) +- changed: Store antiLeech.dll in config directory (Stulle) + antiLeech.dll.new should henceforth also be placed in config dir +- fixed: Reset for BkColor after coloring LowID clients was broken (zz_fly) +- fixed: Possibly crash fix on ShowComment (WiZaRd) +- fixed: Fix broken HTTP downloads from SourceForge (WiZaRd) +- fixed: Only resolve hostnames for downloads if partfile found (WiZaRd) +- fixed: Remove client from DownloadClientsList on RemoveSource (WiZaRd) +- fixed: Don't publish incomplete small files (WiZaRd) +- fixed: Fix for setting buddy state on removing buddy (WiZaRd) +- fixed: Potential devision by zero in UploadBandwidthThrottler (Stulle) +- removed: Send user agent for http downloads only when obfusc enabled code (redundant) (Xman) +partially updated to 8.0 by zz_fly: +- add: Fincan community hash detection (WiZaRd) +- add: retrieve MTU from system (netfinity) +- add: dual upnp lib support (in code only)(zz_fly) +- add: AICHHashset write buffer, reduce diskio while hashing (zz_fly) +- add: let unshared hashsets in a single file, reduce the size of Known2_64.met (zz_fly) +- add: save URL source (DolphinX) +- improved: Reduced CPU usage in CUInt128 (netfinity) +- improved: better clients.met file backup and recovery (Enig123) +- improved: remove useless sort process in downloadqueue (Enig123) +- improved: optimized in download queue balance (Enig123) +- improved: don't Failed-Download-Ban http sources (DolphinX) +- fixed: a splash-screen UI problem in Vista (WiZaRd) +- fixed: don't transmit for nested/overlapping data requests (emuleplus) +- fixed: a possible crash when username contain %s (DolphinX) +- fixed: don't reload sharedfiles when we need not (DolphinX) +- removed: Xman's Multi-threaded disc access with threading-queue. see emule.h for details. +- removed: MediaInfo 0.4 support + +Xtreme 7.2 second source edit +* this version is modded by Stulle +- add: added VS08 solution and project files (Stulle) +- add: display network speed in WebInterface if NAFC enabled (Stulle) + Displayed like this: Current speed / Network speed (Speed limit) +- improved: Don't reset Connection Settings for Webserver/CML/MM (Stulle) +- fixed: MassRename in SharedFilesCtrl was broken (Stulle) +- fixed: HistoryListCtrl threw error when clicking a shared file (Stulle) +- change: cleaned up VS03 and VS05 solution and project files (Stulle) +- change: revert to original tray right-click dialog and adapted it for 0.1 increase (Stulle) +- change: only show 1 decimal fraction for speed limits in WebInterface (Stulle) + +Xtreme 7.2 +* this version is modded by Stulle +- updated to 0.49c codebase +- improved: simply unsharing single shared files instead of excluding them +- improved: greatly simplified remove unused AICH-hashes code while keeping original idea +- fixed: official problem with downloading from webserver +- fixed: Don't reset Connection Settings for Webserver/CML/MM (Stulle) +partially updated to 7.2 by zz_fly: +- change: switch to official UPnP lib +- add: support Ctrl+C and Delete handling in downloaded history list (Stulle) + Copy ed2k links into clipboard using Ctrl+C and Delete files on hitting the del key. +- add: support dynamic ip servers in server list (DolphinX) +- improved: reduce the memory usage of Client Credits (DolphinX, Enig123) +- improved: optimized Xman's extened credit-table-arragement (Enig123) +- improved: better .part.met file backup and recovery (Enig123) +- improved: do not compress .mkv\.mp4 and .7z files +- fixed: fix crash in downloading sources handling (Enig123) +- fixed: fix possible overflow in processing of upload queue and download queue +- fixed: fix crash at shutdown (MorphXT) +- fixed: fix cat assign (Avi3k) +- fixed: memleak when serverconnection fail (DolphinX) +- fixed: memleak in statistics dialog (DolphinX) +- fixed: minor issue in case of shutdown while still hashing (WiZaRd) +- fixed: minor issue with friends handling (WiZaRd) +- fixed: minor code fix and improvement by DolphinX +- fixed: fix possible crash in uploading clients handling (thanks Enig123) + this fix removed from FINAL build, test some more time. +- restore: Xman's improved socket closing + Althought it use more memory(10~20MB), but it is necessary to some kind of user. + + + +Xtreme 7.1 +* this version is modded by Stulle +partially updated to 7.1 by zz_fly: +- add: faster end game: drop stalled downloads (netfinity) +- add: Friend Links (MorphXT) and fixed a memleak (dolphin87) +- add: H.264 and 3vid FourCC Codes to the MediaInfo Detection (X-Ray) +- add: SR13-Import-Parts (roversr13/MorphXT) +- fixed: disable preallocate while eMule allocating (dolphin87) +- fixed: official bug around userhash initialization (Enig123) +- fixed: avoid userhash collision (DreaMule) +- fixed: Special case when socket is closing but data still in buffer (netfinity) +- fixed: minor official draw bug around SharedFiles Filter on Language change (X-Ray) +- improved: free unused memory when a download is completed/cancelled (Enig123) +- improved: optimized Upload Bandwidth Throttler +- improved: make source add action thread safe (Enig123) +- improved: use a prime table to initiate ClientCreditsList +- change: let nick name and location controls resize together with the source detail dialog +- change: support 24k send buffer + You can enable this option via prefercence.ini by "sendbuffersize=24000". + + + +Xtreme 7.0 +* this version is modded by Stulle +- updated to 0.49b codebase +- updated crypto lib to 5.5.2 +- change: make code VS 2005 and VS 2008 ready (MorphXT) +- fixed: corrupted BarShaderInfo (fafner) +- fixed: improper English (ginger) +- remove: Drop Win95 support (for VS2008 compatibility) (MorphXT) +Changes by zz_fly: +- updated UPnP (thanks CN_Mod Team and ACAT) +- updated simp. chinese language file +- adjusted some parameters +- add: show UPnP status in network info dialog (idea from ScarAngel) +- add: rebind UPnP on IP-change (idea from X-RAY) +- add: Fake Shareaza detection +- add: open a default website when nodesURL is invalid +- add: safehash: installation dir unsharing (MorphXT) +- change: no reserved release-slot for partfiles + you can release any files. but reserved release-slot only work for completed files. +- change: UPnP Internal Search: send more request +- fixed: stop rehashing of files with foreign language name (Borschtsch) +- fixed: avoid deadlock when disable network adapter +- remove: Fix Connection Collision (no more needed in .49b codebase) +- remove: always call setLinked_client (no more needed in .49b codebase) +- remove: improved socket closing, it would cause high memory usage (thanks Enig123) + + + +Xtreme 6.1 +- added AJ-community-detection by userhash* (by anonymous anti-leecher) +* this option will detect and ban really a lot of bad mods! +- added filefaker check +- added T-DSL 16000 to the wizard + +- improved NAFC adapter finding: find the right adapter even with exotic network configurations +- improved wizard to choose better download / uploadlimits +- improved: prevent busy popup during windows startup (leuk_he) +- improved: kadliscontrol: show the filename immedately +- a lot of other small improvements + +- changed: skip loading of saved sources if you only allow obfuscated connections +- changed: for uploadlimit > 16 one more Low-ID client is allowed to enter the upload +- changed: do not ask exit from command prompt (leuk_he) + +- fixed official kad bug under vista (leuk_he/godlaugh2007) +- fixed an official crashbug when shutting down while AICH-Syncthread is running +- fixed an official crashbug: reapplied division by zero fix at taskbarnotifier +- fixed a bug when changing ports but don't restart emule +- fixed an UPNP bug +- fixed an official bug: sometimes banning didn't work properly +- fixed a bug if you got a IP with ends with 0 + + +Xtreme 6.0 +- updated to 0.48a codebase +- made the NAFC-adapter-selection-code vista-compatible +- replaced official UPNP withXtreme UPNP (still at extended preferences) +- added: Obfuscation-PaddingLength to Extended preferences + +- changed Xtreme Creditsystem: linier calculatio from 4.5 MB to 9.3 MB like official +- changed: remote credits are also calculated with 0.48a methode +- changed sourcesaver: don't save obfuscation required sources (would need to also store the userhash) +- changed: increased possible filebuffersize to 2 MB + +- improved: iptocountry shows now 32 Bits flags for windows >= XP +- improved some code for closing sockets +- improved code that was responsable for creating two clients instances for one client +- improved: moveitem in mulelistcontrol (netfinity) + +- fixed official bug when dis/enabling Queuelist/Clientslist +- fixed official bug when checking for empty userhash (ilmira) +- fixed official bug: update system-menu after changing bandwidth-capacity +- adjusted some parameters + +- updated all languagefiles + + +Xtreme 5.4.2 +- added: resizable massrename (Morph) +- reworked reask sources after IP-change (new v4) +- improved the internal connection checker +- changed some code around DBR +- imroved advanced auto uploadpriority: the longer a file wasn't uploaded the less "old" upload is counted +- imroved auto uploadpriority: option "share files with auto upload-priority" is now applied when a file is shared the first time +- improved: a bit faster switching from trickle to full when filling the uploadqueue +- changed Xtreme Icon: now it is high resolution (emule-web.de) + +- fixed a bug with sourcesaver when multi temp dirs was used +- fix a bug when a file is hashed sooner than AICH-Syncthread got the mutex +- fixed/improved official code for calculating complete sources +- fixed an official bug showing wrong Kad-Id at networkinfodialog +- many more minor fixes + +- updated languagefiles: german, spain, turkish, french, italian, cinese (thx unomas, Alpin, gigatoaster, LorenzoC, welldl) + + + +Xtreme 5.4.1 +- improved dynamic block request +- improved safehash: Complete pending hashing at shutdown to prevent rehash (Morph) +- improved new advanced auto-upload-priority (but still beta / experimental) +new (advanced) auto-upload-priority-system is taking into account: ++ how many complete sources are reported ++ how many requesters on your uploadqueue ++ how rare the chunks are from the requesters ++ how much you have uploaded and downloaded of a file + +- added more infos to uploadfeedback +- added flexible splittingsize of uploadpackets +- added find menu to historylist +- added new column to shared files: sharefactor. ++ first value is the value which the new auto-upload-priority oriented towards (only visable when advanced auto-prio is used) ++ second value is the relationship between transferred data and file-size + +- changed: 1 minute waitingtime after downloadtimeout to prevent source to stack in asking +- changed: the reduced half open connection is now also detected for win 2003 SP1 and vista (leuk_he) +- changed: increased reask-time for some LowID-sources +- fixed: destroy splashscreen when you close emule right after start + +- more minor improvements and fixes + + +Xtreme 5.4 +- added: extended statistics: Mod + Country statistics (partically taken from emule plus) +- added new leecher-community detection code +- added: Dynamic block request (netfinity/morph/Xman) +- added: whenever Xtreme decides to give you a lower downloadlimit than wanted "R" is displayed at statusbar +- added: advanced auto uploadpriority (experimental) ++ this new priority system sets the uploadpriority in relation to the avarage amount of uploaded data. This means, the more you have shared of a special file, the less it is its priority +- added: always one release slot +- added: show virtual sources at shared files (morph) +- added: give back some waitingtime when an uploadsession was shorter than 9 MB and the session was canceled because of reached chunk boarder +- fixed a bug if you started emule via ed2k-link + + + +Xtreme 5.3.1 +- added client percentage (enabled if you enable the file percentage) +- added Send user agent as firefox for http downloads when obfucscation enabled (leuk_he) +- fixed a bug at UPNP if you didnt restart emule after portchange +- fixed: possible crashfix for connecting server sockets +- Fixed Copying Of Comments In Commentlist (Avi3k/Wizard) +- fixed memleak in slugfillers savehash (Wizard) +- Fix For Exit Comand Line Option (DreamWalker) +- changed at clientlist: sorting by IP is now done by value not by string +- fixed: choose the corrcect chatitem on context-menu (Wizard) + +- added czech translation (poutnik) + + +5.3 final +- small changes + fixes + + +5.3 beta 1 +- adapted all Xtreme features to Codebase 0.47c +- added calculation of obfuscation data to the bandwidthcontrol +- added option to choose the method how chunks are selected for downloading ++ Maella = traditional or zz = new in 0.47c +- changed: obfuscation icon is displayed for all clients which enabled it +- fixed an official bug in source-exchange (Xanatos) +- fixed few minor bugs + + + +5.2.2 +- compiled now with VS2003 SP1 +- added additional Ghost-Mod-Checks (Morph) +- added: Avoid Credits Accumulate Fakers (morph) +- added manual file allocation (Xanatos) +- added: you can disable the compression at preferences.ini Xtreme-Section by adding the Line +UseCompression=0 + +- Fix for false Corruption-Banning (Xanatos) +- fixed a crash-bug at turkish language-file +- fixed wrong Splitbars at statistic-graphs (BlueSonicBoy) +- fixed bug in sendblockrequest +- fixed minor memleaks (Wizard) +- fixed a bug for hidden columns (Wizard) +- fixed a bug, when there is an exception at file allocation +- fixed a bug in FlushBuffer + +- changed some NAFC-code for accounting networkdata when adapter is changed +- changed: process timer code via messages to find unkown errors (Xanatos) + + +- removed netfinity patch (no more needed) + + +changelog Xtreme 5.2.1 +- workaround to avoid crash on exit at some systems when sockets are closed +- fixed a small issue on uploading just completing files +- changed: the check if you lost the connection to internet is now less sensitive. +Also you can specify at preferences.ini, Xtreme-section: internetdownreactiontime=x +the number of seconds without upload, until Xtreme asumes the internetconnection may be lost. Standard is 2. + + + +changelog Xtreme 5.2 +- added: disc access with threading-queue for best IO-performance +- recoded some parts of uploadbandwiththrottler. The throttler isn't anymore the bottleneck but can handle unlimited slotspeed. +- added: show blocking-ratio and upload health +- added option to remove too oftenly blocking sockets +- added: friendslots visualization (Morph) +- added two new internal methods to detect leechers +- added the leecher-detection-reason to clientdetail-window +- added FunnyNick (xrmb/Stulle/Morph/Xman) +- added Sidebanner (thx emule-web.de) +- added auto update ipfilter (own implementation + some coees and ideas from morph) +- added option to log the part-count/size-mismtach +- added option to use narrow font at transferwindow (good if your monitor use low resolution) +- added UPNP-support (new implementation without any additionally library) (by ACAT for Xtreme-Mod) +- added ipfilter kad patch (leuk_he) +- added Safe-Hash-compatibility-patch to write a compatible known.met format (thx David Xanatos) + +- changed: reask sources after IP-change v3 now works also with Kad only connection +- changed: NAFC-adapter will be found with Kad only connection +- changed: hashes (known.met) without AICH-Hashset (known2.met) are internal marked now to keep the data integrity +- changed: don't continue sending after banning +- changed: the HighResTimer isn't used anymore in standard-configuration. Only if you write HighresTimer=1 into preferences.ini + +- improved: simplified the emsocket::Send() +- improved: ip-to-country optimazion (less CPU & RAM) (thx lolo for ideas and codes) +- code-improvement for HasCollectionExtention-function +- improved: don't update to often statistic-file +- update libpng to 1.2.12 +- updated flush-thread (Morph) + few improvements + +- fixed show wrong clientdatarate if clientspeed > 400 kb/s +- fixed a small bug that in some circumstances a lowid client could get a uploadslots although it has a low waiting-time +- fixed a crash on close when flush-thread was running +- fixed a bug when you tried to connect to an ipfiltered server (greyed out) +- fixed Unable To Open Completed File After Rename (Sirob) +- fixed two small bugs in downloaded-history (thx welldl) +- fixed a bug in auto-update-priority (thx poutnik) +- fixed: possible crashfix for emules friendhandling (leuk_he) + +- many more small fixes and improvements + +- updated language-files: chinese (welldl), polish(colder), french (firnus), italian (frankie4), spanish (unomas) +- new language added: turkish (alpin) + + +Release-Notes: +blocking-ratio and upload health: +after turning on this option in Xtreme I you will see some new values at the transferwindow. The first value inside the uploadtoolbar is your upload-health. This value should always be 100% if not, please review your upload-settings. The second value is the 20sec-avg-blocking-count of all sockets. +At your uploadslots you'll also find a new value, the 20-sec-avg-blocking-ratio. This is the ratio how oftenly the socket blocked our try to send at the last 20 sec. E.g. 95% would mean: only 5% of our sending-tries was successful. + + +option to remove blocking sockets: +works only if you enabled the option to open more sockets if needed. Now if your uploadslots grow three slots over the minimum-slots Xtreme looks if there is a slot uploading >3 minutes and has a high blocking-ratio. This slot will be removed. +Please use this option with caution! + + +auto-update-ipfilter works like this: +- after you enabled the option... the next restart of the client the ipfilter will be downloaded and the date of this version will be stored +- on next restart of you clients the ipfilter will be checked in the same interval as versions-check (you can set it at general settings). If it is time to do a check Xtreme will connect to the URL you specified at security-settings. After connection is established Xtreme checks if the version on server is newer than your installed version. If so, your ipfilter will be updated. + + + +changelog xtreme 5.1.2 +- fixed a bug in socket-queuing (my stupidy) +- fixed crash when we canceled a file and Flush thread runing (SiRoB) +- fix: emule fortget to publish known files to server (official bug) + + +changelog Xtreme 5.1.1 +- added proper cleaning of temporary handle-maps + + because official emule doesn't delete this maps emule eats more and more CPU after longer runingtime +- added variable compression. (idea netfinity) + + If your upload is > 80 kb/s emule switch to lower compression = less CPU for high-speed uploaders +- added: show filename to IPFiltered-messages if possible +- added new Kad-Patch by unknown1 +- added: filter outgoing server connections (bluesonicboy) + +- fixed a small bug in Auto-Downlaodpriority +- Fix Connection Collision (Sirob) +- fixed unicode problem around some error messages +- fixed: objects in oscopecontrol are safed and restored via handle = proper GUI-coding +- few fixes to statistic-graph (bluesonicBoy) + +- improved socket queuing +- improved: taking a connected socket on filereask +- updated flushthread (Sirob) + + +changelog Xtreme 5.1 +This version includes really many patches and improvements for less CPU load and memory consumption. +because most changes are internal, they aren't listed here. +By the way, this is the first chinese translated official mod ;-) + +- added: Extened credit- table-arragement (less memory) +- added: Anti-Nick-Changer, bans permamently nick-changers (e.g. Ketamine) +- added: new slpash-screen arrangement (inspired by KTS) +- added: don't overwrite bak files if last sessions crashed (idea blomy) +- added: show complete up/down in queuelist +- added: slugfiller safehash modified by Sirob +- added: ReadBlockFromFileThread by Sirob + Improvements for Xtreme-Full-Chunk +- added: Flush Thread (Sirob) +- added: readded patch(slightly modified) from previous version for redownloading already downloaded files. +- added: chinese translation (welldl) + +- changed: grant credits only > 1.65 MB uploaded +- changed: failed tcp-connection (statistik) now also count the cennected but not responding clients +- changed: increased reasktime for non UDP-clients to give them a chance to first connect +- changed: increased the time until a socket will be deleted (maybe this helps against some crashes)* +* you will see more open sockets at statistic +- changed: don't add passive sources with wrong filesize +- changed: show IP of denied reqeusted share files +- changed some message strings + +- improved: few Improvements to IP to country +- improved: Init-Hashtable optimization +- improved: some code-optimaztions at Xtreme-Creditsystem (less memory) +- Some Code Improvements by Sirob, eklmn, avi-3k and Wizard +- and many more imrovements + +- fixed: in sharefilelist the AddsearchtoCancelled-Menu didn't appear +- fixed file rating string Aenarion[ITA] +- fixed a small bug, that peercachesockets could stop upload to early +- fixed a problem that good sourcen could be filtered, if a file is finished sooner than the sources can answer +- fixed wrong displaying of files-count in sharefilelistctrl in some cases +- fixed: summary not updated after deleting shared file (raccoonI) +- fixed: eMule steals focus when message from new client is received (raccoonI) +- minor fixes to progressbar by Sirob + + +changelog 5.0.1 +- fixed an official Gui Bug In Settings Wizard (FrankyFive) +- changed creditsytsem: use linear function until half of a chunk is transferred. reduce leeching by only giving 1-2 MB +- changed the sleeptiming of uploadbandwidththrottler a bit +- changed some leecher-detection code. Some clients will now be banned instead of reduce score, because they are responsable for many failed downloadsessions +- changed some icons at toolbar (thx emule-web.de) +- removed a patch for handling duplicate shared files which could lead to crash +- few other small improvements +- added unrar.dll and new mediainfo.dll to the archive + + +changelog 5.0 +- merged all Xtreme-features to 0.47a +- kad-patch from unknown1 +- some improvements / bugfixes and adjustments +- changed default nick to http://xtreme-mod.net +- changed max slotspeed to 15 kbs +- always use high resolution timer +- removed unsued code from emsocket +- fixed all issues of xtreme 5.0 beta +- added languagefiles: german, spain, frensh, italian, polish (thx Colder) +- changed toolbaricons (thx emule-web.de) + + +the Xtreme-Hompage is also updated. Now you find explainings to all features and settings in german and english + +Features: +- Bandwidthcontrol for accurate measure +- NAFC - Network adapter Feedback Control - +- automatic NAFC-Adapter-Selection +- adjustable slotspeed +- MTU-configuration +- DLP (Dynamic Leecher Protection) +- Anti-Credit-Hack +- Detect manipulated Hello-Tags (used by communities) +- Detect Bad Tags (snafu) +- Detect Ghost Mods +- Detect Leechermods by Nickname (some community mods use an encrypted nick-addon) +- Detect Leechermods by Modstring +- Detect Nick-Thiefs +- Detect Mod-Thiefs +- Detect XS-Exploiter +- Detect Spammer +- Detect emcrypt (0.44d) +- clients wich timeout on US_CONNECTING get a second changed on reconnect +- Xtreme Full Chunk +- Allow Bandwidth Settings in <1KB Incremements- +- Mod-ID +- improved sockethandling / Exceptionhandling in Listensocket +- dynamic IP-filters (clients wich cause an exception are filtered 12 houers) +- adjustable slotspeed +- closed two backdoors +- spread reasks +- codeimprovement to the quelistupdating +- show time until next UDP-reask/TCP-reask in downloadlistctrl-Client-Info-Tip +- retry connection attempt before adding to deadsource-list +- reworked the maintimer (avoid doing too many actions at the same time) +- winsock2 (ewombat) +- Reask sources after IP change- v2 +- reconnect Kad on IP-change +- askfordownload priority first ask the sources which are most urgent +- Smart Low ID check +- accepting download from non ONQUEUE-clients if emule is connected +- allow queue overflow with minimumcontingent +- SLS +- see own credits (VQB) +- Xtreme Credit System +- see sourcecount found per categorie in transferwindow +- changed format of data (bytes/kb/Mb...) +- see how many clients are waiting for each file at sharedfilelist +- changed auto-upload-prios. (>100->Low, >20->nowmal, <=20 High) +- Show AVGQR +- Xman Chunk Selection Patch +- PowerRelease +- Log Dropping messages +- color LowID-clients in downloadlistctrl +- IP to country (Eastshare/ morph) +- friendhandling from all windows +- Anti-Leecher-Log +- Mighty Knife: Static server handling (morph) +- show requested files (sivka/Xman) +- option to change process prio +- option at statistics where you can choose if you want accurate or smooth graph +- don't answer wrong filereaskpings +- menu-entry in searchlist->mark as cancelled which allow you to mark a file +- remove unused AICH-hashes +- option which allow you to decide, if a failed TCP-connection should be retryed +- statistic for failed/successful file-reaks per TCP-connection +- one queue per file (multiqueue) +- Reload shared files on filenotfound exception +- see clientversion in every window +- allow to configure the sendbuffersize +- check already downloaded files (monki/Xman) +- Download History (monki/Xman) +- Xtreme Download Manager +- just in time swapping +- show complete internettraffic in statistic-tree +- hardlimit for emule collections is 5! +- clients your are uploading and downloading the same time are marked with << and >> +- Auto-A4AF-check +- show partical downloaded chunk in grey (from zz) +- MultiSort (Slugfiller) +- Don't draw hidden Rect (morph) +- show progress hash (O2/Xman) +- reworked the shared-file-progress-bar of completed files. you see now better which chunks are really missing +- check completed sources which want to download their "complete" file +- Codeimprovement for better passive sourcefinding +- added SharedView Ed2kType-filter (Avi3k) +- Copy Upload-Feedback (IcEcRacKer/Xman) +- DiffQR +- 80% score for non SI-clients +- accept only clients which asked the last 30 minutes +- uploadtoolbar +- Xtreme-Versionscheck, DLP-Versionscheck +- show Queuerank in clientdetailwindow +- show complete up/down in uploadlist +- checkmark to catogory at contextmenu of downloadlist +- active downloads bold +- sourcecache +- max global sourcelimit to avoid overheadleeching +- P2PThreat - Detect worms that could be harmful to the network or eMule (netfinity) +- grey out dead servers (BlueSonicBoy) +- don't print logline for spam-messages +- hundrets of code improvements +- and many more featres. More info at www.xtreme-mod.net + + + + +changelog 4.8.2 +- major XS-bugfix of official client +- one more XS-bugfix of official client (david/Neo) +- bugfix at XS-exploiter due to the official xs-bug +- small bugfix in p2pthread +- fixed an official small bug, when NoNeeded-sources was wrong sorted in Downloadlist +(this also fixes issues with DiffQR,AvgQR and AskForDownloadPriority) +- fixed crash on F1 in Xtreme-Settings +- fixed reask-time on tooltip for NNP-Sources +- fixed small bug in reask sources after IP-change which didn't asked NNP-Sources +- don't answer UDP-Filerequest for LowID-clients which can get a slot now +- Threadsafe socket-disconnect, should fix some crashes (thx Wizard / Sirob) +- codeimprovement to fill uploadqueue faster after server reconnect +- added Anti-Leecher-Option for detecting emcrypt-clients +- other minor bugfixes and improvements + + +changelog 4.8.1 +- fixed: show additional graph-lines wasn't saved +- fixed some translations and codepage-errors in polish translation (Colder) +- grey out dead servers (BlueSonicBoy) +- don't print logline for spam-messages (forgot this in changelog of 4.8) +- updated IP-Filter to v 98. This update is important for all german users, because v97 filters out two german ip-ranges (thx rumpelzuck) + + +changelog 4.8 +- added sourcecache = finding more sources with less overhead +- added max global sourcelimit to avoid overheadleeching * +- added an option to show additional graph lines +- added P2PThreat - Detect worms that could be harmful to the network or eMule (netfinity) +- added extra option fr Xtreme Versionscheck +- changed slotregulation ->less slots with high overhead +- changed calculation for downloadlimits to get a smoother download +- fixed and changed score-calculation for MultiQueue +- changed clientbantime to 4 hours +- changed some default values +- adjusted fileprio a bit +- Fix Log Scrollbar Redraw (Sirob) +- Fix: Failure In Atl Leading To Uncatched Exception Fix (Kro) +- crashfix for reloading downloaded history +- fixed small bug in downloadlimit calculation +- fixed: few ban messages wasn't shown in leecherlog +- more small fixes and improvements +- updated translation string (thx: charlesdewei,erazah,unomas,hornetzone) +- added polish translation (thx wilam) + +*max global sourcelimit: +depending on your uploadlimit you'll get a max global sourcelimit. (e.g. for 10kbs upload: sourcelimit = 4000) +This shell avoid overheadleeching, which means: users with only a small upload like 12 kbs, are using 10000 and more sources. Which such an amount of sources, all your bandwidth is wasted with filerequests and there isn't enough bandwidth left for uploading of data. With the max global source limit, xtreme avoids this kind of leeching. +You have two new options: +- accept the source limit, which means Xtreme won't find more sources +or +- accept a session 1:3 ratio if you are using more sources than global source limit +remark: Xtreme session/amount 1:3 ratio always means: no downloadlimit until you reach a 1:3 ratio. After reaching this, you'll get a downloadlmit of 4*current upload. Overall you'll should reach a ratio between 1:3 and 1:4 + + + +changelog 4.7.2 +- added: show Queuerank in clientdetailwindow +- added: show complete up/down in uploadlist +- added: checkmark to catogory at contextmenu of downloadlist +- added: checkbox for "active downloads bold" +- removed a part of wizards anti xs-exploiter, because it's unfair to some non emule clients +- changed: ghost-mods always get a hard-ban(both side) (until there is an official rule) + + +changelog 4.7.1 +- fixed: a bug, you couldn't upload to a leecher, although you wanted to +- fixed: in rare cases a (tricky) spammer wasn't banned +- changed: leecher can be unbaned when changing to a good mod + + +changelog 4.7 ++++ fight the leechers +++ +new redesigned Anti-Leecher-Protection now detects most of the common leechers. +E.g. darkmule, united community, pimp and many more +Also spammers were detected and banned, like ketamine or zambor. + +The new Leecher-Protection provides folowing features: +- Anti-Credit-Hack +- Detect manipulated Hello-Tags (used by communities) +- Detect Bad Tags (snafu) +- Detect Ghost Mods +- Detect Leechermods by Nickname (some community mods use an encrypted nick-addon) +- Detect Leechermods by Modstring +- Detect Nick-Thiefs +- Detect Mod-Thiefs (100% detection) +- Detect XS-Exploiter (by Wizard/Xman) +- Detect Spammer + +- Leechermods are marked in all lists +- new menu-item "drop leecher" + +- changed defaultsetting: receive server from servers/clients to false (see security information on Xtreme-HP - currently only german language) +- fixed listsearch: it only shows now the columns which works for searching (thx David for the hint) +- removed fake check from webservices (project is closed) +- added / changed some links +- some translations (thx unomas, wolf_79, erazah, Firnus) +- few small bugfixes + + + +changelog 4.6 +- Xtreme-Versionscheck, DLP-Versionscheck (thx Sirob) +- added uploadtoolbar (inspired by Ionix) +- manual NAFC-adapter-selection ++ you should only use this, if the automatic-detection fail, although you are connected to a server ++ you see the failure, if the yellow-network-statistic-line is always at the bottom ++ write: ForceNAFCAdapter= number of the NAFC-adapter to preferences.ini at Xtreme-section ++ ForceNAFCAdapter=0 means automatic (recommend) +- added Anti-Nick-Thief +- added List-search for all lists (use CTRL+F) +- added dlp check own usernick if valid / not a leecher-name +- fixed wrong value at Uploadfeedback +- fixed the issue, if only one client is at upload, this slot kept trickle +- fixed some sorting issues +- some more fixes & improvements + + +changelog 4.5 +- new Anti-Leecher-Feature: DLP (Dynamic Leecher Protection) ++ most of the leecher-code is stored in a dll ++ this dll can be updated during emule runtime (hot swap) ++ new leecher-dedecting-code find 25% more bad mods +- (FAF) DiffQR (Xman version) +- (FAF) allow to set more than one file to Powerrelease simultaneously +- (FAF) readded remaining-column +- (FAF) Copy Upload-Feedback (IcEcRacKer/Xman) +- Show connected server in bluebold +- added SharedView Ed2kType-filter (Avi3k) +- Fix CreatBlockRequest (morph) +- UDP-FNF FiX (wizard) +- maxfilesize fix ( Avi3k) +- Codeimprovement for better passive sourcefinding +- Codeimprovement: atfer ip-change, the reconnection is detected faster +- changed trayicon +- Code Improvement for choosing to use compression +- fixed a small bug which could let emule forget to use NAFC on next start +- check completed sources which want to download their "complete" file + + +changelog 4.4 +- minimum upload for NAFC: +if NAFC is enabled 1/3 of your uploadlimit is reserved for emule. This prevents timeouts. +- reworked the shared-file-progress-bar of completed files. you see now better which chunks are really missing +- added support for power-release to the webinterface +- show progress hash (O2) +- fixed a bug showing wrong time on statistic-graph-tooltip if graph was zoomed +- Code-Improvement in CUint128::toBinaryString function (netfinity) +- fixed some bugs at the wizard +- few code-improvements/fixes to powerrelease +- fixed a bug at client-speed-calculation if average datarate-calculation was set to 1 second +- new "simple Anti-Thief": new code should now filter out all fake Xtreme-Versions +- big update of Leecher-List +- many other fixes and improvements + + +changelog 4.3 +- ported to 0.46c +- Fix For Shared Files "open Folder" (Avi-3k) +- show partical downloaded chunk in grey (from zz) +- MultiSort (Slugfiller) +- Don't draw hidden Rect (morph) +- Code Improvement: FillSolidRect +- Code Improvement for ShowFilesCount + + +changelog 4.2 +- readded to Xtreme Downloadmanager: Auto-A4AF-check +- added ef-mod 2.0 to the leecher-list, because this mod can be abused as full leecher +- updated ip-to-country-list +- updated ipfilter.dat +- several small bugfixes + + +changelog 4.2 beta 1 +- ported to 0.46b +- adapted downloaded-history to 0.46b shared-files-tree +- Xtreme-Downloadmanager improvement: just in time swapping ++ when you are downloading from a client and this client doesn't have anymore chunks for you, the download is continued with an A4AF +- added: show complete internettraffic in statistic-tree (second value after downloaded / uploaded) +- changed: hardlimit for emule collections is 5! +- fixed an overflowbug in bandwidthcontrol on adapterchange +- clients your are uploading and downloading the same time are marked with << and >> + + +changelog 4.1.1 +- fixed a crash-bug in downloadhistory when redownloading aa already shared file +- fixed an official crashbug when resharing a file you are just downloading +- a few more small bugfixes + +changelog xtreme 4.1 +- new feature: check already downloaded files (monki/Xman) +- new feature: Download History (monki) +- new feature: Nice Hashe ++ doesn't take all CPU on file-hasing (idea CiccioBastardo) (Tag: //Xman Nice Hash) +- modified Xtreme Downloadmanager: go over hardlimit when swapping the sources after file completion +- modified Xtreme Upload: allow to configure the sendbuffersize ++ remark: small sendbuffer gives emule more control about the upload ++ bigger sendbuffer can solve problems with constant slotspeed ++ if you don't have problems uploading with high slotspeed a small sendbuffer is reccomend + +- doublelucas (slugfiller) +- fixed wrong NAFC-state-remaining with windows2000 +- update CxImage to 5.99c +- updated a few leecher-signatures +- translated all Xtreme-Features/Settings to german, spain, french and italian language +(thx to ofenheizer, ikabot, Firnus and maraglio16) + + +changelog xtreme 4.0 final +- fixed an official crash-bug, when closing emule in systray (thx pildo) +- added: see clientversion in every window (TAG: //Xman see clientversion in every window) +- added: Reload shared files on filenotfound exception (TAG: //Xman Reload shared files on filenotfound exception) +- new option: doublesendbuffersize (experimental) ++ if you have problems with a constant slotspeed you can try to insert the line: + doublesendbuffersize=1 +into your preferences.ini section xtreme +do this before starting emule + +- changed: only one opening uploadslot if emule assuming internetconnection is down +- changed: 30% slot-speed-tolerance if more than minimum slots are open + +- code improvement: uploadbandwidththrottler replace peercachesockets, instead of resorting all slots +- updated ip to country database +- already included in beta1: up to date ipfilter + + + +changelog Xtreme 4.0 beta1 +- ported Xtreme3.0 to codebase 0.46a +- bugfix: if "open more slots if needed" is deactivated, only one LowID-client is allowed to get an uploadslot +- readded: one queue per file (multiqueue) (Maella / Xman) ++ remark: if this option is used, it makes no sence to give rare files a higher uploadpriority. Therefore Autouploadriority sets alle files to "normal" +- some small changes to the upload-slot-opening-conditions +- bugfix: after IP-Change last nafc-status wasn't remembered correctly +- improvement: bettere care of existing TCP-connections on source-reasking +- added new statistik for failed/successful file-reaks per TCP-connection +- added anti-ghost-mod (as an option) (idea morph) +- added an option which allow you to decide, if a failed TCP-connection should be retryed ++ remark: this option was always enabled in Xtreme 3.0, offcial doesn't retry a connection attempt ++ if this option is selected you need more connections and half opend connections, but you loos 10% - 30% less sources, good especially when you are downloading rare files +- few codeimprovements to uploadbandwidththrottler +- remove unused AICH-hashes (TAG: //Xman remove unused AICH-hashes) ++ with official client if you enabled "remember downloaded files" it keeps normal hash + AICH hash ++ Xtreme Mod now has an option (at files) "remember unused AICH-hashes" ++ if this option is disabled at next mod-start all unused AICH-hashes of known2.met are deleted, but your downloadhistory (known.met) is untouched +- added Links to preferences +- fixed an official sorting bug in downloadclients +- fixed an official bug which forgot to count filtered ips +- added new menu-entry in searchlist->mark as cancelled which allow you to mark a file (TAG: //Xman add search to cancelled) +- added Don't Refresh item if not needed (morph) +- save second sort criterion for downloadlistcontrol (TAG: //Xman save second sort criterion for downloadlistcontrol) +- Netfinity Patch for VS 2003 + +Xtreme 3.0 +---------------- + +based on emule 0.45b +compiled with: +libpng 1.2.7 +zlib 1.2.1 +crypto 52.1 +CxImage version 5.99a + + +changelog Xtreme 3.0 (final) +- fixed two sorting bugs +- disabled new Xtreme-Splashscreen on Win9x (crashed on that OS) +- removed many Verbose-Messages which are only usefull on beta-state +- changed: use more UDP - less TCP (need now less connections) +- changed: the real slotspeed should now be closer to the wanted +- patch: don't answer wrong filereaskpings, (remote client using incorrect protocol) + + +changelog Xtreme3.0 beta2 +- changed few default settings +- avoid "silly window syndrome" on limited download (= receive always n*MAXFRAGSIZE) +- added an option to statistics where you can choose if you want accurate or smooth graph +- tweaked few slot-opening conditions +- few internal bugfixes + + + +changelog Xtreme 3.0 beta1 + +- rewritten most parts of Uploadbandwidthtrottler +- Threadsave Bandwidthcontrol (thx Maella) +- Maella -Accurate measure of bandwidth: eDonkey data + control, network adapter- +- NAFC - Network adapter Feedback Control - (Maella) +- Include ACK to Overhead (TAG: //XMan Include ACK) +- automatic NAFC-Adapter-Selection (only works if you are connected to server) (TAG: Xman new Adapter Selection) +- possible bugfix of official code InsertIntoUploadlist +- 80% score for non SI-clients +- accept only clients which asked the last 30 minutes +- clients wich timeout on US_CONNECTING get a second changed on reconnect (TAG: //Xman uploading problem client) +- increased queue-purgetime to 80 minutes +- min 11 upload for unlimited download! +- friend-uploads get an slot on connect under same conditions as LowIDs +- MTU-configuration (Maella/Xman) +- changed uploading-sendbuffersize to 6000 +- don't accept uploads if no internetconnection +- Xtreme Full Chunk (TAG: //Xman full chunk) + + full block system: upload doesn't stop befor a complete block (180kb) isn't transfered (other than in official) + + lower CPU + + FullChunkMode: min 2,5 MB will transfered, after that, emule looks at the chunkboarder. uploads ends if either a chunk at the downloader is completed, or 9.30MB are completed + + anticipate if a new slot is needed: if a slot is near the end , new slot is opend if needed +- Allow Bandwidth Settings in <1KB Incremements- (Maella) +- New bandwidth control (downloading) (Maella/Xman) +- Support for tag ET_MOD_VERSION 0x55 (Maella/Slugfiller/Xman) +- improved sockethandling / Exceptionhandling in Listensocket +- dynamic IP-filters (clients wich cause an exception are filtered 12 houers) +- option to not open more slots (recommend setting: open more slots if needed) +- fixed an official bug in emsocket (don't try to send until socket is ready for sending) +- adjusted the score calculatoin.. should now also work with high slotspeeds +- added an option to preferences->Xtreme to use doublesendsize + remark: you can try to use this, if you have choosen a high slotspeed(>5), this can help to increase the datarate, given to each client + but this option let your uploadgraph show a little "unstable".. this is a technical reaction +- closed two backdoors (TAG: //Xman close Backdoor v2) +- spread reasks (Maella/Xman) +- reworked statistics (few parts taken from TPT) +- codeimprovement to the quelistupdating (TAG: //Xman faster Updating of Queuelist) +- added //Xman Xtreme Downloadmanager (many changes!) + + includeds all features of Xtreme2.2 + + manual/automatic dropping (without refinding same sources right after that) + + manual A4AF Handling (without the risk to get banned) + + manual stoping of single downloading source +- Maella -Unnecessary Protocol Overload- (modiefied by Xman) (this feature is used by Xtreme Downloadmanager) +- Maella -Extended clean-up II- (modiefied by Xman) (this feature is used by Xtreme Downloadmanager) +- show time until next UDP-reask/TCP-reask in downloadlistctrl-Client-Info-Tip +- retry connection attempt before adding to deadsource-list +- some timeout improvemets (didn't touched the peercache-sockets) +- reworked the maintimer (avoid doing too many actions at the same time) +- winsock2 (ewombat) +- Reask sources after IP change- v2 (Maella/Xman) (TAG: //Xman -Reask sources after IP change- v2) + + new version take care of kad. If the IP(HighID) received from server was already detected by Kad for more than 5 minutes, reask sources doesn't trigger. This prevents a fail-trigger, if you are only connected to kad and decide later to also connect to a server +- reconnect Kad on IP-change (TAG: //Xman reconnect Kad on IP-change) +- askfordownload priority first ask the sources which are most urgent (TAG: //Xman askfordownload priority ) +- Maella Smart Low ID check +- accepting download from non ONQUEUE-clients if emule is connected +- allow queue overflow with minimumcontingent (TAG: //Xman allow queue overflow with minimumcontingent) +- SLS + some improvements (Xman, Maella, enkeyDEV(Ottavio84) +- see own credits (VQB) +- Xtreme Credit System +- see sourcecount found per categorie in transferwindow (TAG: //Xman see all sources) +- changed format of data (bytes/kb/Mb...) +- see how many clients are waiting for each file at sharedfilelist (TAG: //Xman see on uploadqueue) +- changed auto-upload-prios. (>100->Low, >20->nowmal, <=20 High) +- shared-files-AvailPartFrequency is initialized with 0 (better to see which chunks are missing) +- Show AVGQR instead of remaining-time +- bugfix of official emule, which shows wrong source-count in statistics if a file was stopped +- Xman Chunk Selection Patch +- fixed a official bug in banning clients +- fixed: memory exception when sources of a server where added +- PowerRelease (TAG: //Xman PowerRelease) + + only avaiable for complete files: + + increased release-prio: if transfered <100MB or < 1.5 of filesize, very very high Prio, otherwise very high prio + + dynamic hide overshares: start with hideos=1, after 2/3 of the chunks are hidden, hideos will be increased + + (some parts of code from slugfiller) +- cleaned up Preferences->Tweaks, removed USS +- added an option to Log Dropping messages +- color LowID-clients in downloadlistctrl +- some codeimprovements in drawing of chunkbars (Maella/Xman) +- IP to country (Eastshare/ morph) +- friendhandling from all windows (TAG: //Xman friendhandling) +- Preferences Fix (tHeWiZaRdOfDoS) +- added Xtreme Icons +- Fixed UTF-8 strings on web searchs (Monki) +- always enabled createcrashdump during the alpha/beta-test +- Anti-Leecher-Log (TAG: //Xman Anti-Leecher-Log) +- Anti-Leecher with codes of Morph, ewombat and IONIX (TAG: //Xman Anti-Leecher) +- Mighty Knife: Static server handling (morph) +- show requested files (sivka/Xman) +- Fix For Incorrect Corruption Stats (netfinity) +- searchCatch (SLUGFILLER) +- option to change process prio (parts of code from TPT) (TAG: //Xman process prio) +- many other improvements + + +remark: +- this mod has no USS (use nafc instead!) +- this mod doesn't allow unlimited uploadspeed +- the adjustable slotspeed is not an accurate speed, but a tolerant(can go 25% over the settings). Xtreme Mod decide itself how much slots are needed to best fit your slotspeed +- the uploadlimit is applied to overhead + data +- if you use NAFC, the uploadlimit is applied to whole networktraffic (also other applications) and downloadlimit is automatically adjusted +- the overhead includes TCP/IP + UDP-Header + blockpackage-header + ACK-packets +- because the uploadlimit is applied to data + whole overhead, you have to set your upload to min 11kbs to get unlimited download, but please set it to about 90% of your uploadcapacity + + +Download: http://www.xtreme-mod.net \ No newline at end of file diff --git a/cryptopp/3way.cpp b/cryptopp/3way.cpp new file mode 100644 index 0000000..725b682 --- /dev/null +++ b/cryptopp/3way.cpp @@ -0,0 +1,139 @@ +// 3way.cpp - modifed by Wei Dai from Joan Daemen's 3way.c +// The original code and all modifications are in the public domain. + +#include "pch.h" +#include "3way.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +void ThreeWay_TestInstantiations() +{ + ThreeWay::Encryption x1; + ThreeWay::Decryption x2; +} + +static const word32 START_E = 0x0b0b; // round constant of first encryption round +static const word32 START_D = 0xb1b1; // round constant of first decryption round +static const word32 RC_MODULUS = 0x11011; + +static inline word32 reverseBits(word32 a) +{ + a = ((a & 0xAAAAAAAA) >> 1) | ((a & 0x55555555) << 1); + a = ((a & 0xCCCCCCCC) >> 2) | ((a & 0x33333333) << 2); + return ((a & 0xF0F0F0F0) >> 4) | ((a & 0x0F0F0F0F) << 4); +} + +#define mu(a0, a1, a2) \ +{ \ + a1 = reverseBits(a1); \ + word32 t = reverseBits(a0); \ + a0 = reverseBits(a2); \ + a2 = t; \ +} + +#define pi_gamma_pi(a0, a1, a2) \ +{ \ + word32 b0, b2; \ + b2 = rotlFixed(a2, 1U); \ + b0 = rotlFixed(a0, 22U); \ + a0 = rotlFixed(b0 ^ (a1|(~b2)), 1U); \ + a2 = rotlFixed(b2 ^ (b0|(~a1)), 22U);\ + a1 ^= (b2|(~b0)); \ +} + +// thanks to Paulo Barreto for this optimized theta() +#define theta(a0, a1, a2) \ +{ \ + word32 b0, b1, c; \ + c = a0 ^ a1 ^ a2; \ + c = rotlFixed(c, 16U) ^ rotlFixed(c, 8U); \ + b0 = (a0 << 24) ^ (a2 >> 8) ^ (a1 << 8) ^ (a0 >> 24); \ + b1 = (a1 << 24) ^ (a0 >> 8) ^ (a2 << 8) ^ (a1 >> 24); \ + a0 ^= c ^ b0; \ + a1 ^= c ^ b1; \ + a2 ^= c ^ (b0 >> 16) ^ (b1 << 16); \ +} + +#define rho(a0, a1, a2) \ +{ \ + theta(a0, a1, a2); \ + pi_gamma_pi(a0, a1, a2); \ +} + +void ThreeWay::Base::UncheckedSetKey(const byte *uk, unsigned int length, const NameValuePairs ¶ms) +{ + AssertValidKeyLength(length); + + m_rounds = GetRoundsAndThrowIfInvalid(params, this); + + for (unsigned int i=0; i<3; i++) + m_k[i] = (word32)uk[4*i+3] | ((word32)uk[4*i+2]<<8) | ((word32)uk[4*i+1]<<16) | ((word32)uk[4*i]<<24); + + if (!IsForwardTransformation()) + { + theta(m_k[0], m_k[1], m_k[2]); + mu(m_k[0], m_k[1], m_k[2]); + m_k[0] = ByteReverse(m_k[0]); + m_k[1] = ByteReverse(m_k[1]); + m_k[2] = ByteReverse(m_k[2]); + } +} + +void ThreeWay::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + typedef BlockGetAndPut Block; + + word32 a0, a1, a2; + Block::Get(inBlock)(a0)(a1)(a2); + + word32 rc = START_E; + + for(unsigned i=0; i Block; + + word32 a0, a1, a2; + Block::Get(inBlock)(a0)(a1)(a2); + + word32 rc = START_D; + + mu(a0, a1, a2); + for(unsigned i=0; i, public FixedKeyLength<12>, public VariableRounds<11> +{ + static const char *StaticAlgorithmName() {return "3-Way";} +}; + +/// 3-Way +class ThreeWay : public ThreeWay_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); + + protected: + unsigned int m_rounds; + FixedSizeSecBlock m_k; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef ThreeWay::Encryption ThreeWayEncryption; +typedef ThreeWay::Decryption ThreeWayDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/Doxyfile b/cryptopp/Doxyfile new file mode 100644 index 0000000..1fb9d81 --- /dev/null +++ b/cryptopp/Doxyfile @@ -0,0 +1,1109 @@ +# Doxyfile 1.3.7 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = Crypto++ + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 2 levels of 10 sub-directories under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of source +# files, where putting all generated files in the same directory would otherwise +# cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, +# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en +# (Japanese with English messages), Korean, Korean-en, Norwegian, Polish, Portuguese, +# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is used +# as the annotated text. Otherwise, the brief description is used as-is. If left +# blank, the following values are used ("$name" is automatically replaced with the +# name of the entity): "The $name class" "The $name widget" "The $name file" +# "is" "provides" "specifies" "contains" "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited +# members of a class in the documentation of that class as if those members were +# ordinary class members. Constructors, destructors and assignment operators of +# the base classes will not be shown. + +INLINE_INHERITED_MEMB = YES + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = Yes + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources +# only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = No + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = No + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = . + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp +# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm + +FILE_PATTERNS = *.h \ + *.cpp + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = adhoc.cpp + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories +# that are symbolic links (a Unix filesystem feature) are excluded from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = . + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 3 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = . + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = _WIN32 \ + _WINDOWS \ + __FreeBSD__ \ + CRYPTOPP_DOXYGEN_PROCESSING + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse the +# parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. Note that this +# option is superseded by the HAVE_DOT option below. This is only a fallback. It is +# recommended to install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/cryptopp/GNUmakefile b/cryptopp/GNUmakefile new file mode 100644 index 0000000..4f73103 --- /dev/null +++ b/cryptopp/GNUmakefile @@ -0,0 +1,168 @@ +CXXFLAGS = -DNDEBUG -g -O2 +#CXXFLAGS = -g +# -fPIC is supported. Please report any breakage of -fPIC as a bug. +# CXXFLAGS += -fPIC +# the following options reduce code size, but breaks link or makes link very slow on some systems +# CXXFLAGS += -ffunction-sections -fdata-sections +# LDFLAGS += -Wl,--gc-sections +ARFLAGS = -cr # ar needs the dash on OpenBSD +RANLIB = ranlib +CP = cp +MKDIR = mkdir +EGREP = egrep +UNAME = $(shell uname) +ISX86 = $(shell uname -m | $(EGREP) -c "i.86|x86|i86|amd64") +ISMINGW = $(shell uname | $(EGREP) -c "MINGW32") + +# Default prefix for make install +ifeq ($(PREFIX),) +PREFIX = /usr +endif + +ifeq ($(CXX),gcc) # for some reason CXX is gcc on cygwin 1.1.4 +CXX = g++ +endif + +ifeq ($(ISX86),1) + +GCC42_OR_LATER = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(GCC\) (4.[2-9]|[5-9])") +INTEL_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\)") +GAS210_OR_LATER = $(shell echo "" | $(AS) -v 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-9]|[3-9])") +GAS217_OR_LATER = $(shell echo "" | $(AS) -v 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])") + +ifneq ($(GCC42_OR_LATER),0) +ifneq ($(UNAME),Darwin) +CXXFLAGS += -march=native -mtune=native +endif +endif + +ifneq ($(INTEL_COMPILER),0) +# "internal error: backend signals" occurs on some x86 inline assembly with ICC 9 and some x64 inline assembly with ICC 11 +# if you want to use Crypto++'s assembly code with ICC, try enabling it on individual files +CXXFLAGS += -DCRYPTOPP_DISABLE_ASM +endif + +ifeq ($(GAS210_OR_LATER),0) # .intel_syntax wasn't supported until GNU assembler 2.10 +CXXFLAGS += -DCRYPTOPP_DISABLE_ASM +else +ifeq ($(GAS217_OR_LATER),0) +CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3 +endif +ifeq ($(UNAME),SunOS) +CXXFLAGS += -Wa,--divide # allow use of "/" operator +endif +endif + +endif # ISX86 + +ifeq ($(ISMINGW),1) +LDLIBS += -lws2_32 +endif + +ifeq ($(UNAME),) # for DJGPP, where uname doesn't exist +CXXFLAGS += -mbnu210 +else +CXXFLAGS += -pipe +endif + +ifeq ($(UNAME),Linux) +LDFLAGS += -pthread +endif + +ifeq ($(UNAME),Darwin) +AR = libtool +ARFLAGS = -static -o +CXX = c++ +IS_GCC2 = $(shell $(CXX) -v 2>&1 | $(EGREP) -c gcc-932) +ifeq ($(IS_GCC2),1) +CXXFLAGS += -fno-coalesce-templates -fno-coalesce-static-vtables +LDLIBS += -lstdc++ +LDFLAGS += -flat_namespace -undefined suppress -m +endif +endif + +ifeq ($(UNAME),SunOS) +LDLIBS += -lnsl -lsocket +ifeq ($(CXX),CC) # override flags for CC (Solaris native C++ compiler) +CXXFLAGS = -DNDEBUG -O -g0 -native -template=no%extdef -m$(shell isainfo -b) +LDFLAGS = +ifeq ($(ISX86),1) +# SSE2 intrinsics should work in Sun Studio 12, but we're not using SSE2 intrinsics anymore +# CXXFLAGS += -xarch=sse2 -D__SSE2__ +endif +endif +endif + +SRCS = $(wildcard *.cpp) +ifeq ($(SRCS),) # workaround wildcard function bug in GNU Make 3.77 +SRCS = $(shell echo *.cpp) +endif + +OBJS = $(SRCS:.cpp=.o) +# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?) +TESTOBJS = bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o +LIBOBJS = $(filter-out $(TESTOBJS),$(OBJS)) + +DLLSRCS = algebra.cpp algparam.cpp asn.cpp basecode.cpp cbcmac.cpp channels.cpp cryptlib.cpp des.cpp dessp.cpp dh.cpp dll.cpp dsa.cpp ec2n.cpp eccrypto.cpp ecp.cpp eprecomp.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gf2n.cpp gfpcrypt.cpp hex.cpp hmac.cpp integer.cpp iterhash.cpp misc.cpp modes.cpp modexppc.cpp mqueue.cpp nbtheory.cpp oaep.cpp osrng.cpp pch.cpp pkcspad.cpp pubkey.cpp queue.cpp randpool.cpp rdtables.cpp rijndael.cpp rng.cpp rsa.cpp sha.cpp simple.cpp skipjack.cpp strciphr.cpp trdlocal.cpp +DLLOBJS = $(DLLSRCS:.cpp=.export.o) +LIBIMPORTOBJS = $(LIBOBJS:.o=.import.o) +TESTIMPORTOBJS = $(TESTOBJS:.o=.import.o) +DLLTESTOBJS = dlltest.dllonly.o + +all: cryptest.exe + +test: cryptest.exe + ./cryptest.exe v + +clean: + $(RM) cryptest.exe libcryptopp.a $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS) + +install: + $(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin + $(CP) *.h $(PREFIX)/include/cryptopp + $(CP) *.a $(PREFIX)/lib + $(CP) *.exe $(PREFIX)/bin + +libcryptopp.a: $(LIBOBJS) + $(AR) $(ARFLAGS) $@ $(LIBOBJS) + $(RANLIB) $@ + +cryptest.exe: libcryptopp.a $(TESTOBJS) + $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) -L. -lcryptopp $(LDFLAGS) $(LDLIBS) + +nolib: $(OBJS) # makes it faster to test changes + $(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) + +dll: cryptest.import.exe dlltest.exe + +cryptopp.dll: $(DLLOBJS) + $(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a + +libcryptopp.import.a: $(LIBIMPORTOBJS) + $(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS) + $(RANLIB) $@ + +cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS) + $(CXX) -o $@ $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS) + +dlltest.exe: cryptopp.dll $(DLLTESTOBJS) + $(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS) + +adhoc.cpp: adhoc.cpp.proto +ifeq ($(wildcard adhoc.cpp),) + cp adhoc.cpp.proto adhoc.cpp +else + touch adhoc.cpp +endif + +%.dllonly.o : %.cpp + $(CXX) $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c $< -o $@ + +%.import.o : %.cpp + $(CXX) $(CXXFLAGS) -DCRYPTOPP_IMPORTS -c $< -o $@ + +%.export.o : %.cpp + $(CXX) $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c $< -o $@ + +%.o : %.cpp + $(CXX) $(CXXFLAGS) -c $< diff --git a/cryptopp/License.txt b/cryptopp/License.txt new file mode 100644 index 0000000..fc3f054 --- /dev/null +++ b/cryptopp/License.txt @@ -0,0 +1,67 @@ +Compilation Copyright (c) 1995-2009 by Wei Dai. All rights reserved. +This copyright applies only to this software distribution package +as a compilation, and does not imply a copyright on any particular +file in the package. + +The following files are copyrighted by their respective original authors, +and their use is subject to additional licenses included in these files. + +mars.cpp - Copyright 1998 Brian Gladman. + +All other files in this compilation are placed in the public domain by +Wei Dai and other contributors. + +I would like to thank the following authors for placing their works into +the public domain: + +Joan Daemen - 3way.cpp +Leonard Janke - cast.cpp, seal.cpp +Steve Reid - cast.cpp +Phil Karn - des.cpp +Andrew M. Kuchling - md2.cpp, md4.cpp +Colin Plumb - md5.cpp +Seal Woods - rc6.cpp +Chris Morgan - rijndael.cpp +Paulo Baretto - rijndael.cpp, skipjack.cpp, square.cpp +Richard De Moliner - safer.cpp +Matthew Skala - twofish.cpp +Kevin Springle - camellia.cpp, shacal2.cpp, ttmac.cpp, whrlpool.cpp, ripemd.cpp + +Permission to use, copy, modify, and distribute this compilation for +any purpose, including commercial applications, is hereby granted +without fee, subject to the following restrictions: + +1. Any copy or modification of this compilation in any form, except +in object code form as part of an application software, must include +the above copyright notice and this license. + +2. Users of this software agree that any modification or extension +they provide to Wei Dai will be considered public domain and not +copyrighted unless it includes an explicit copyright notice. + +3. Wei Dai makes no warranty or representation that the operation of the +software in this compilation will be error-free, and Wei Dai is under no +obligation to provide any services, by way of maintenance, update, or +otherwise. THE SOFTWARE AND ANY DOCUMENTATION ARE PROVIDED "AS IS" +WITHOUT EXPRESS OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. IN NO EVENT WILL WEI DAI OR ANY OTHER CONTRIBUTOR BE LIABLE FOR +DIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +4. Users will not use Wei Dai or any other contributor's name in any +publicity or advertising, without prior written consent in each case. + +5. Export of this software from the United States may require a +specific license from the United States Government. It is the +responsibility of any person or organization contemplating export +to obtain such a license before exporting. + +6. Certain parts of this software may be protected by patents. It +is the users' responsibility to obtain the appropriate +licenses before using those parts. + +If this compilation is used in object code form in an application +software, acknowledgement of the author is not required but would be +appreciated. The contribution of any useful modifications or extensions +to Wei Dai is not required but would also be appreciated. diff --git a/cryptopp/Readme.txt b/cryptopp/Readme.txt new file mode 100644 index 0000000..861c036 --- /dev/null +++ b/cryptopp/Readme.txt @@ -0,0 +1,429 @@ +Crypto++: a C++ Class Library of Cryptographic Schemes +Version 5.6.0 (3/15/2009) + +Crypto++ Library is a free C++ class library of cryptographic schemes. +Currently the library contains the following algorithms: + + algorithm type name + + authenticated encryption schemes GCM, CCM, EAX + + high speed stream ciphers Panama, Sosemanuk, Salsa20, XSalsa20 + + AES and AES candidates AES (Rijndael), RC6, MARS, Twofish, Serpent, + CAST-256 + + IDEA, Triple-DES (DES-EDE2 and DES-EDE3), + other block ciphers Camellia, SEED, RC5, Blowfish, TEA, XTEA, + Skipjack, SHACAL-2 + + block cipher modes of operation ECB, CBC, CBC ciphertext stealing (CTS), + CFB, OFB, counter mode (CTR) + + message authentication codes VMAC, HMAC, CMAC, CBC-MAC, DMAC, + Two-Track-MAC + + SHA-1, SHA-2 (SHA-224, SHA-256, SHA-384, and + hash functions SHA-512), Tiger, WHIRLPOOL, RIPEMD-128, + RIPEMD-256, RIPEMD-160, RIPEMD-320 + + RSA, DSA, ElGamal, Nyberg-Rueppel (NR), + public-key cryptography Rabin, Rabin-Williams (RW), LUC, LUCELG, + DLIES (variants of DHAES), ESIGN + + padding schemes for public-key PKCS#1 v2.0, OAEP, PSS, PSSR, IEEE P1363 + systems EMSA2 and EMSA5 + + Diffie-Hellman (DH), Unified Diffie-Hellman + key agreement schemes (DH2), Menezes-Qu-Vanstone (MQV), LUCDIF, + XTR-DH + + elliptic curve cryptography ECDSA, ECNR, ECIES, ECDH, ECMQV + + insecure or obsolescent MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL +algorithms retained for backwards 3.0, WAKE, WAKE-OFB, DESX (DES-XEX3), RC2, + compatibility and historical SAFER, 3-WAY, GOST, SHARK, CAST-128, Square + value + +Other features include: + + * pseudo random number generators (PRNG): ANSI X9.17 appendix C, RandomPool + * password based key derivation functions: PBKDF1 and PBKDF2 from PKCS #5, + PBKDF from PKCS #12 appendix B + * Shamir's secret sharing scheme and Rabin's information dispersal algorithm + (IDA) + * fast multi-precision integer (bignum) and polynomial operations + * finite field arithmetics, including GF(p) and GF(2^n) + * prime number generation and verification + * useful non-cryptographic algorithms + + DEFLATE (RFC 1951) compression/decompression with gzip (RFC 1952) and + zlib (RFC 1950) format support + + hex, base-32, and base-64 coding/decoding + + 32-bit CRC and Adler32 checksum + * class wrappers for these operating system features (optional): + + high resolution timers on Windows, Unix, and Mac OS + + Berkeley and Windows style sockets + + Windows named pipes + + /dev/random, /dev/urandom, /dev/srandom + + Microsoft's CryptGenRandom on Windows + * A high level interface for most of the above, using a filter/pipeline + metaphor + * benchmarks and validation testing + * x86, x86-64 (x64), MMX, and SSE2 assembly code for the most commonly used + algorithms, with run-time CPU feature detection and code selection + * some versions are available in FIPS 140-2 validated form + +You are welcome to use it for any purpose without paying me, but see +License.txt for the fine print. + +The following compilers are supported for this release. Please visit +http://www.cryptopp.com the most up to date build instructions and porting notes. + + * MSVC 6.0 - 2008 + * GCC 3.3 - 4.3 + * C++Builder 2009 + * Intel C++ Compiler 9 - 11 + * Sun Studio 12 (CC 5.9) + +*** Important Usage Notes *** + +1. If a constructor for A takes a pointer to an object B (except primitive +types such as int and char), then A owns B and will delete B at A's +destruction. If a constructor for A takes a reference to an object B, +then the caller retains ownership of B and should not destroy it until +A no longer needs it. + +2. Crypto++ is thread safe at the class level. This means you can use +Crypto++ safely in a multithreaded application, but you must provide +synchronization when multiple threads access a common Crypto++ object. + +*** MSVC-Specific Information *** + +On Windows, Crypto++ can be compiled into 3 forms: a static library +including all algorithms, a DLL with only FIPS Approved algorithms, and +a static library with only algorithms not in the DLL. +(FIPS Approved means Approved according to the FIPS 140-2 standard.) +The DLL may be used by itself, or it may be used together with the second +form of the static library. MSVC project files are included to build +all three forms, and sample applications using each of the three forms +are also included. + +To compile Crypto++ with MSVC, open the "cryptest.dsw" (for MSVC 6 and MSVC .NET +2003) or "cryptest.sln" (for MSVC .NET 2005) workspace file and build one or +more of the following projects: + +cryptdll - This builds the DLL. Please note that if you wish to use Crypto++ + as a FIPS validated module, you must use a pre-built DLL that has undergone + the FIPS validation process instead of building your own. +dlltest - This builds a sample application that only uses the DLL. +cryptest Non-DLL-Import Configuration - This builds the full static library + along with a full test driver. +cryptest DLL-Import Configuration - This builds a static library containing + only algorithms not in the DLL, along with a full test driver that uses + both the DLL and the static library. + +To use the Crypto++ DLL in your application, #include "dll.h" before including +any other Crypto++ header files, and place the DLL in the same directory as +your .exe file. dll.h includes the line #pragma comment(lib, "cryptopp") +so you don't have to explicitly list the import library in your project +settings. To use a static library form of Crypto++, specify it as +an additional library to link with in your project settings. +In either case you should check the compiler options to +make sure that the library and your application are using the same C++ +run-time libraries and calling conventions. + +*** DLL Memory Management *** + +Because it's possible for the Crypto++ DLL to delete objects allocated +by the calling application, they must use the same C++ memory heap. Three +methods are provided to achieve this. +1. The calling application can tell Crypto++ what heap to use. This method + is required when the calling application uses a non-standard heap. +2. Crypto++ can tell the calling application what heap to use. This method + is required when the calling application uses a statically linked C++ Run + Time Library. (Method 1 does not work in this case because the Crypto++ DLL + is initialized before the calling application's heap is initialized.) +3. Crypto++ can automatically use the heap provided by the calling application's + dynamically linked C++ Run Time Library. The calling application must + make sure that the dynamically linked C++ Run Time Library is initialized + before Crypto++ is loaded. (At this time it is not clear if it is possible + to control the order in which DLLs are initialized on Windows 9x machines, + so it might be best to avoid using this method.) + +When Crypto++ attaches to a new process, it searches all modules loaded +into the process space for exported functions "GetNewAndDeleteForCryptoPP" +and "SetNewAndDeleteFromCryptoPP". If one of these functions is found, +Crypto++ uses methods 1 or 2, respectively, by calling the function. +Otherwise, method 3 is used. + +*** GCC-Specific Information *** + +A makefile is included for you to compile Crypto++ with GCC. Make sure +you are using GNU Make and GNU ld. The make process will produce two files, +libcryptopp.a and cryptest.exe. Run "cryptest.exe v" for the validation +suite. + +*** Documentation and Support *** + +Crypto++ is documented through inline comments in header files, which are +processed through Doxygen to produce an HTML reference manual. You can find +a link to the manual from http://www.cryptopp.com. Also at that site is +the Crypto++ FAQ, which you should browse through before attempting to +use this library, because it will likely answer many of questions that +may come up. + +If you run into any problems, please try the Crypto++ mailing list. +The subscription information and the list archive are available on +http://www.cryptopp.com. You can also email me directly by visiting +http://www.weidai.com, but you will probably get a faster response through +the mailing list. + +*** History *** + +1.0 - First public release. Withdrawn at the request of RSA DSI. + - included Blowfish, BBS, DES, DH, Diamond, DSA, ElGamal, IDEA, + MD5, RC4, RC5, RSA, SHA, WAKE, secret sharing, DEFLATE compression + - had a serious bug in the RSA key generation code. + +1.1 - Removed RSA, RC4, RC5 + - Disabled calls to RSAREF's non-public functions + - Minor bugs fixed + +2.0 - a completely new, faster multiprecision integer class + - added MD5-MAC, HAVAL, 3-WAY, TEA, SAFER, LUC, Rabin, BlumGoldwasser, + elliptic curve algorithms + - added the Lucas strong probable primality test + - ElGamal encryption and signature schemes modified to avoid weaknesses + - Diamond changed to Diamond2 because of key schedule weakness + - fixed bug in WAKE key setup + - SHS class renamed to SHA + - lots of miscellaneous optimizations + +2.1 - added Tiger, HMAC, GOST, RIPE-MD160, LUCELG, LUCDIF, XOR-MAC, + OAEP, PSSR, SHARK + - added precomputation to DH, ElGamal, DSA, and elliptic curve algorithms + - added back RC5 and a new RSA + - optimizations in elliptic curves over GF(p) + - changed Rabin to use OAEP and PSSR + - changed many classes to allow copy constructors to work correctly + - improved exception generation and handling + +2.2 - added SEAL, CAST-128, Square + - fixed bug in HAVAL (padding problem) + - fixed bug in triple-DES (decryption order was reversed) + - fixed bug in RC5 (couldn't handle key length not a multiple of 4) + - changed HMAC to conform to RFC-2104 (which is not compatible + with the original HMAC) + - changed secret sharing and information dispersal to use GF(2^32) + instead of GF(65521) + - removed zero knowledge prover/verifier for graph isomorphism + - removed several utility classes in favor of the C++ standard library + +2.3 - ported to EGCS + - fixed incomplete workaround of min/max conflict in MSVC + +3.0 - placed all names into the "CryptoPP" namespace + - added MD2, RC2, RC6, MARS, RW, DH2, MQV, ECDHC, CBC-CTS + - added abstract base classes PK_SimpleKeyAgreementDomain and + PK_AuthenticatedKeyAgreementDomain + - changed DH and LUCDIF to implement the PK_SimpleKeyAgreementDomain + interface and to perform domain parameter and key validation + - changed interfaces of PK_Signer and PK_Verifier to sign and verify + messages instead of message digests + - changed OAEP to conform to PKCS#1 v2.0 + - changed benchmark code to produce HTML tables as output + - changed PSSR to track IEEE P1363a + - renamed ElGamalSignature to NR and changed it to track IEEE P1363 + - renamed ECKEP to ECMQVC and changed it to track IEEE P1363 + - renamed several other classes for clarity + - removed support for calling RSAREF + - removed option to compile old SHA (SHA-0) + - removed option not to throw exceptions + +3.1 - added ARC4, Rijndael, Twofish, Serpent, CBC-MAC, DMAC + - added interface for querying supported key lengths of symmetric ciphers + and MACs + - added sample code for RSA signature and verification + - changed CBC-CTS to be compatible with RFC 2040 + - updated SEAL to version 3.0 of the cipher specification + - optimized multiprecision squaring and elliptic curves over GF(p) + - fixed bug in MARS key setup + - fixed bug with attaching objects to Deflator + +3.2 - added DES-XEX3, ECDSA, DefaultEncryptorWithMAC + - renamed DES-EDE to DES-EDE2 and TripleDES to DES-EDE3 + - optimized ARC4 + - generalized DSA to allow keys longer than 1024 bits + - fixed bugs in GF2N and ModularArithmetic that can cause calculation errors + - fixed crashing bug in Inflator when given invalid inputs + - fixed endian bug in Serpent + - fixed padding bug in Tiger + +4.0 - added Skipjack, CAST-256, Panama, SHA-2 (SHA-256, SHA-384, and SHA-512), + and XTR-DH + - added a faster variant of Rabin's Information Dispersal Algorithm (IDA) + - added class wrappers for these operating system features: + - high resolution timers on Windows, Unix, and MacOS + - Berkeley and Windows style sockets + - Windows named pipes + - /dev/random and /dev/urandom on Linux and FreeBSD + - Microsoft's CryptGenRandom on Windows + - added support for SEC 1 elliptic curve key format and compressed points + - added support for X.509 public key format (subjectPublicKeyInfo) for + RSA, DSA, and elliptic curve schemes + - added support for DER and OpenPGP signature format for DSA + - added support for ZLIB compressed data format (RFC 1950) + - changed elliptic curve encryption to use ECIES (as defined in SEC 1) + - changed MARS key schedule to reflect the latest specification + - changed BufferedTransformation interface to support multiple channels + and messages + - changed CAST and SHA-1 implementations to use public domain source code + - fixed bug in StringSource + - optmized multi-precision integer code for better performance + +4.1 - added more support for the recommended elliptic curve parameters in SEC 2 + - added Panama MAC, MARC4 + - added IV stealing feature to CTS mode + - added support for PKCS #8 private key format for RSA, DSA, and elliptic + curve schemes + - changed Deflate, MD5, Rijndael, and Twofish to use public domain code + - fixed a bug with flushing compressed streams + - fixed a bug with decompressing stored blocks + - fixed a bug with EC point decompression using non-trinomial basis + - fixed a bug in NetworkSource::GeneralPump() + - fixed a performance issue with EC over GF(p) decryption + - fixed syntax to allow GCC to compile without -fpermissive + - relaxed some restrictions in the license + +4.2 - added support for longer HMAC keys + - added MD4 (which is not secure so use for compatibility purposes only) + - added compatibility fixes/workarounds for STLport 4.5, GCC 3.0.2, + and MSVC 7.0 + - changed MD2 to use public domain code + - fixed a bug with decompressing multiple messages with the same object + - fixed a bug in CBC-MAC with MACing multiple messages with the same object + - fixed a bug in RC5 and RC6 with zero-length keys + - fixed a bug in Adler32 where incorrect checksum may be generated + +5.0 - added ESIGN, DLIES, WAKE-OFB, PBKDF1 and PBKDF2 from PKCS #5 + - added key validation for encryption and signature public/private keys + - renamed StreamCipher interface to SymmetricCipher, which is now implemented + by both stream ciphers and block cipher modes including ECB and CBC + - added keying interfaces to support resetting of keys and IVs without + having to destroy and recreate objects + - changed filter interface to support non-blocking input/output + - changed SocketSource and SocketSink to use overlapped I/O on Microsoft Windows + - grouped related classes inside structs to help templates, for example + AESEncryption and AESDecryption are now AES::Encryption and AES::Decryption + - where possible, typedefs have been added to improve backwards + compatibility when the CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY macro is defined + - changed Serpent, HAVAL and IDEA to use public domain code + - implemented SSE2 optimizations for Integer operations + - fixed a bug in HMAC::TruncatedFinal() + - fixed SKIPJACK byte ordering following NIST clarification dated 5/9/02 + +5.01 - added known answer test for X9.17 RNG in FIPS 140 power-up self test + - submitted to NIST/CSE, but not publicly released + +5.02 - changed EDC test to MAC integrity check using HMAC/SHA1 + - improved performance of integrity check + - added blinding to defend against RSA timing attack + +5.03 - created DLL version of Crypto++ for FIPS 140-2 validation + - fixed vulnerabilities in GetNextIV for CTR and OFB modes + +5.0.4 - Removed DES, SHA-256, SHA-384, SHA-512 from DLL + +5.1 - added PSS padding and changed PSSR to track IEEE P1363a draft standard + - added blinding for RSA and Rabin to defend against timing attacks + on decryption operations + - changed signing and decryption APIs to support the above + - changed WaitObjectContainer to allow waiting for more than 64 + objects at a time on Win32 platforms + - fixed a bug in CBC and ECB modes with processing non-aligned data + - fixed standard conformance bugs in DLIES (DHAES mode) and RW/EMSA2 + signature scheme (these fixes are not backwards compatible) + - fixed a number of compiler warnings, minor bugs, and portability problems + - removed Sapphire + +5.2 - merged in changes for 5.01 - 5.0.4 + - added support for using encoding parameters and key derivation parameters + with public key encryption (implemented by OAEP and DL/ECIES) + - added Camellia, SHACAL-2, Two-Track-MAC, Whirlpool, RIPEMD-320, + RIPEMD-128, RIPEMD-256, Base-32 coding, FIPS variant of CFB mode + - added ThreadUserTimer for timing thread CPU usage + - added option for password-based key derivation functions + to iterate until a mimimum elapsed thread CPU time is reached + - added option (on by default) for DEFLATE compression to detect + uncompressible files and process them more quickly + - improved compatibility and performance on 64-bit platforms, + including Alpha, IA-64, x86-64, PPC64, Sparc64, and MIPS64 + - fixed ONE_AND_ZEROS_PADDING to use 0x80 instead 0x01 as padding. + - fixed encoding/decoding of PKCS #8 privateKeyInfo to properly + handle optional attributes + +5.2.1 - fixed bug in the "dlltest" DLL testing program + - fixed compiling with STLport using VC .NET + - fixed compiling with -fPIC using GCC + - fixed compiling with -msse2 on systems without memalign() + - fixed inability to instantiate PanamaMAC + - fixed problems with inline documentation + +5.2.2 - added SHA-224 + - put SHA-256, SHA-384, SHA-512, RSASSA-PSS into DLL + +5.2.3 - fixed issues with FIPS algorithm test vectors + - put RSASSA-ISO into DLL + +5.3 - ported to MSVC 2005 with support for x86-64 + - added defense against AES timing attacks, and more AES test vectors + - changed StaticAlgorithmName() of Rijndael to "AES", CTR to "CTR" + +5.4 - added Salsa20 + - updated Whirlpool to version 3.0 + - ported to GCC 4.1, Sun C++ 5.8, and Borland C++Builder 2006 + +5.5 - added VMAC and Sosemanuk (with x86-64 and SSE2 assembly) + - improved speed of integer arithmetic, AES, SHA-512, Tiger, Salsa20, + Whirlpool, and PANAMA cipher using assembly (x86-64, MMX, SSE2) + - optimized Camellia and added defense against timing attacks + - updated benchmarks code to show cycles per byte and to time key/IV setup + - started using OpenMP for increased multi-core speed + - enabled GCC optimization flags by default in GNUmakefile + - added blinding and computational error checking for RW signing + - changed RandomPool, X917RNG, GetNextIV, DSA/NR/ECDSA/ECNR to reduce + the risk of reusing random numbers and IVs after virtual machine state + rollback + - changed default FIPS mode RNG from AutoSeededX917RNG to + AutoSeededX917RNG + - fixed PANAMA cipher interface to accept 256-bit key and 256-bit IV + - moved MD2, MD4, MD5, PanamaHash, ARC4, WAKE_CFB into the namespace "Weak" + - removed HAVAL, MD5-MAC, XMAC + +5.5.1 - fixed VMAC validation failure on 32-bit big-endian machines + +5.5.2 - ported x64 assembly language code for AES, Salsa20, Sosemanuk, and Panama + to MSVC 2005 (using MASM since MSVC doesn't support inline assembly on x64) + - fixed Salsa20 initialization crash on non-SSE2 machines + - fixed Whirlpool crash on Pentium 2 machines + - fixed possible branch prediction analysis (BPA) vulnerability in + MontgomeryReduce(), which may affect security of RSA, RW, LUC + - fixed link error with MSVC 2003 when using "debug DLL" form of runtime library + - fixed crash in SSE2_Add on P4 machines when compiled with + MSVC 6.0 SP5 with Processor Pack + - ported to MSVC 2008, GCC 4.2, Sun CC 5.9, Intel C++ Compiler 10.0, + and Borland C++Builder 2007 + +5.6 - added AuthenticatedSymmetricCipher interface class and Filter wrappers + - added CCM, GCM (with SSE2 assembly), EAX, CMAC, XSalsa20, and SEED + - added support for variable length IVs + - improved AES and SHA-256 speed on x86 and x64 + - fixed incorrect VMAC computation on message lengths + that are >64 mod 128 (x86 assembly version is not affected) + - fixed compiler error in vmac.cpp on x86 with GCC -fPIC + - fixed run-time validation error on x86-64 with GCC 4.3.2 -O2 + - fixed HashFilter bug when putMessage=true + - removed WORD64_AVAILABLE; compiler support for 64-bit int is now required + - ported to GCC 4.3, C++Builder 2009, Sun CC 5.10, Intel C++ Compiler 11 + +Written by Wei Dai diff --git a/cryptopp/TestVectors/Readme.txt b/cryptopp/TestVectors/Readme.txt new file mode 100644 index 0000000..755a046 --- /dev/null +++ b/cryptopp/TestVectors/Readme.txt @@ -0,0 +1,72 @@ +Test Data Format + +A test data file is an ASCII text file composed of sections separated by +blank lines. Each section is stand-alone and independent of other +sections that may be in the same file, and contains one or more tests. + +A section is composed of a sequence of fields. Each field is one or more +lines composed of a field name, followed by a colon (":"), followed by a +field body. All but the last line of a field must end with a backslash +("\"). If any line contains a hash mark ("#"), the hash mark and +everything after it on the same line is not considered part of the field +body. + +Each section must contain fields named AlgorithmType, Name, Source, and +Test. The presence and semantics of other fields depend on the algorithm +being tested and the tests to be run. + +Each section may contain more than one test and therefore more than one +field named Test. In that case the order of the fields is significant. A +test should always use the last field with any given name that occurs +before the Test field. + +Data Types + +int - small integer (less than 2^32) in decimal representation +string - human readable string +encoded string - can be one of the following + - quoted string: "message" means "message" without the quotes + or terminating '\0' + - hex encoded string: 0x74657374 or 74657374 means "test" + - repeated string: r100 "message" to repeat "message" 100 times, or + r256 0x0011 to repeat 0x0011 256 times + +Field Types + +AlgorithmType - string, for example "Signature", "AsymmetricCipher", +"SymmetricCipher", "MAC", "MessageDigest", or "KeyFactory" +Name - string, an algorithm name from SCAN +Test - string, identifies the test to run +Source - string, text explaining where the test data came from +Comment - string, other comments about the test data +KeyFormat - string, specifies the key format. "Component" here means +each component of the key or key pair is specified separately as a name, +value pair, with the names depending on the algorithm being tested. +Otherwise the value names "Key", or "PublicKey" and "PrivateKey" are +used. +Key - encoded string +PublicKey - encoded string +PrivateKey - encoded string +Message - encoded string, message to be signed or verified +Signature - encoded string, signature to be verified or compared +with +Plaintext - encoded string +Ciphertext - encoded string +Digest - encoded string +TruncatedSize - int, size of truncated digest in bytes +Seek - int, seek location for random access ciphers +(more to come here) + +Possible Tests + +KeyPairValidAndConsistent - public and private keys are both valid and +consistent with each other +PublicKeyInvalid - public key validation should not pass +PrivateKeyInvalid - private key validation should not pass +Verify - signature/digest/MAC verification should pass +VerifyTruncated - truncated digest/MAC verification should pass +NotVerify - signature/digest/MAC verification should not pass +DeterministicSign - sign message using given seed, and the resulting +signature should be equal to the given signature +DecryptMatch - ciphertext decrypts to plaintext +(more to come here) diff --git a/cryptopp/TestVectors/aes.txt b/cryptopp/TestVectors/aes.txt new file mode 100644 index 0000000..0012629 --- /dev/null +++ b/cryptopp/TestVectors/aes.txt @@ -0,0 +1,189 @@ +AlgorithmType: SymmetricCipher +Name: AES/ECB +Source: NIST Special Publication 800-38A +Plaintext: 6bc1bee22e409f96e93d7e117393172a ae2d8a571e03ac9c9eb76fac45af8e51 30c81c46a35ce411e5fbc1191a0a52ef f69f2445df4f9b17ad2b417be66c3710 +Comment: F.1.1 ECB-AES128.Encrypt +Key: 2b7e151628aed2a6abf7158809cf4f3c +Ciphertext: 3ad77bb40d7a3660a89ecaf32466ef97 f5d3d58503b9699de785895a96fdbaaf 43b1cd7f598ece23881b00e3ed030688 7b0c785e27e8ad3f8223207104725dd4 +Test: Encrypt +Comment: F.1.3 ECB-AES192.Encrypt +Key: 8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b +Ciphertext: bd334f1d6e45f25ff712a214571fa5cc 974104846d0ad3ad7734ecb3ecee4eef ef7afd2270e2e60adce0ba2face6444e 9a4b41ba738d6c72fb16691603c18e0e +Test: Encrypt +Comment: F.1.5 ECB-AES256.Encrypt +Key: 603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4 +Ciphertext: f3eed1bdb5d2a03c064b5a7e3db181f8 591ccb10d410ed26dc5ba74a31362870 b6ed21b99ca6f4f9f153e7b1beafed1d 23304b7a39f9f3ff067d8d8f9e24ecc7 +Test: Encrypt + +AlgorithmType: SymmetricCipher +Name: AES/CBC +Source: NIST Special Publication 800-38A +IV: 000102030405060708090a0b0c0d0e0f +Plaintext: 6bc1bee22e409f96e93d7e117393172a ae2d8a571e03ac9c9eb76fac45af8e51 30c81c46a35ce411e5fbc1191a0a52ef f69f2445df4f9b17ad2b417be66c3710 +Comment: F.2.1 CBC-AES128.Encrypt +Key: 2b7e151628aed2a6abf7158809cf4f3c +Ciphertext: 7649abac8119b246cee98e9b12e9197d 5086cb9b507219ee95db113a917678b2 73bed6b8e3c1743b7116e69e22229516 3ff1caa1681fac09120eca307586e1a7 +Test: Encrypt +Comment: F.2.3 CBC-AES192.Encrypt +Key: 8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b +Ciphertext: 4f021db243bc633d7178183a9fa071e8 b4d9ada9ad7dedf4e5e738763f69145a 571b242012fb7ae07fa9baac3df102e0 08b0e27988598881d920a9e64f5615cd +Test: Encrypt +Comment: F.2.5 CBC-AES256.Encrypt +Key: 603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4 +Ciphertext: f58c4c04d6e5f1ba779eabfb5f7bfbd6 9cfc4e967edb808d679f777bc6702c7d 39f23369a9d9bacfa530e26304231461 b2eb05e2c39be9fcda6c19078c6a9d1b +Test: Encrypt + +AlgorithmType: SymmetricCipher +Name: AES/CBC +Source: RFC 3602 +Comment: Case 1: Encrypting 16 bytes (1 block) using AES-CBC with 128-bit key +Key : 0x06a9214036b8a15b512e03d534120006 +IV : 0x3dafba429d9eb430b422da802c9fac41 +Plaintext : "Single block msg" +Ciphertext: 0xe353779c1079aeb82708942dbe77181a +Test: Encrypt +Comment: Case 2: Encrypting 32 bytes (2 blocks) using AES-CBC with 128-bit key +Key : 0xc286696d887c9aa0611bbb3e2025a45a +IV : 0x562e17996d093d28ddb3ba695a2e6f58 +Plaintext : 0x000102030405060708090a0b0c0d0e0f 101112131415161718191a1b1c1d1e1f +Ciphertext: 0xd296cd94c2cccf8a3a863028b5e1dc0a 7586602d253cfff91b8266bea6d61ab1 +Test: Encrypt +Comment: Case 3: Encrypting 48 bytes (3 blocks) using AES-CBC with 128-bit key +Key : 0x6c3ea0477630ce21a2ce334aa746c2cd +IV : 0xc782dc4c098c66cbd9cd27d825682c81 +Plaintext : "This is a 48-byte message (exactly 3 AES blocks)" +Ciphertext: 0xd0a02b3836451753d493665d33f0e886 2dea54cdb293abc7506939276772f8d5 021c19216bad525c8579695d83ba2684 +Test: Encrypt +Comment: Case 4: Encrypting 64 bytes (4 blocks) using AES-CBC with 128-bit key +Key : 0x56e47a38c5598974bc46903dba290349 +IV : 0x8ce82eefbea0da3c44699ed7db51b7d9 +Plaintext : 0xa0a1a2a3a4a5a6a7a8a9aaabacadaeaf b0b1b2b3b4b5b6b7b8b9babbbcbdbebf c0c1c2c3c4c5c6c7c8c9cacbcccdcecf d0d1d2d3d4d5d6d7d8d9dadbdcdddedf +Ciphertext: 0xc30e32ffedc0774e6aff6af0869f71aa 0f3af07a9a31a9c684db207eb0ef8e4e 35907aa632c3ffdf868bb7b29d3d46ad 83ce9f9a102ee99d49a53e87f4c3da55 +Test: Encrypt + +AlgorithmType: SymmetricCipher +Name: AES/CFB +Source: NIST Special Publication 800-38A +IV: 000102030405060708090a0b0c0d0e0f +Plaintext: 6bc1bee22e409f96e93d7e117393172aae2d8 +FeedbackSize: 1 +Comment: F.3.7 CFB8-AES128.Encrypt +Key: 2b7e151628aed2a6abf7158809cf4f3c +Ciphertext: 3b79424c9c0dd436bace9e0ed4586a4f32b9 +Test: Encrypt +Comment: F.3.9 CFB8-AES192.Encrypt +Key: 8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b +Ciphertext: cda2521ef0a905ca44cd057cbf0d47a0678a +Test: Encrypt +Comment: F.3.11 CFB8-AES256.Encrypt +Key: 603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4 +Ciphertext: dc1f1a8520a64db55fcc8ac554844e889700 +Test: Encrypt +Plaintext: 6bc1bee22e409f96e93d7e117393172a ae2d8a571e03ac9c9eb76fac45af8e51 30c81c46a35ce411e5fbc1191a0a52ef f69f2445df4f9b17ad2b417be66c3710 +FeedbackSize: 16 +Comment: F.3.13 CFB128-AES128.Encrypt +Key: 2b7e151628aed2a6abf7158809cf4f3c +Ciphertext: 3b3fd92eb72dad20333449f8e83cfb4a c8a64537a0b3a93fcde3cdad9f1ce58b 26751f67a3cbb140b1808cf187a4f4df c04b05357c5d1c0eeac4c66f9ff7f2e6 +Test: Encrypt +Comment: F.3.15 CFB128-AES192.Encrypt +Key: 8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b +Ciphertext: cdc80d6fddf18cab34c25909c99a4174 67ce7f7f81173621961a2b70171d3d7a 2e1e8a1dd59b88b1c8e60fed1efac4c9 c05f9f9ca9834fa042ae8fba584b09ff +Test: Encrypt +Comment: F.3.17 CFB128-AES256.Encrypt +Key: 603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4 +Ciphertext: dc7e84bfda79164b7ecd8486985d3860 39ffed143b28b1c832113c6331e5407b df10132415e54b92a13ed0a8267ae2f9 75a385741ab9cef82031623d55b1e471 +Test: Encrypt + +AlgorithmType: SymmetricCipher +Name: AES/OFB +Source: NIST Special Publication 800-38A +IV: 000102030405060708090a0b0c0d0e0f +Plaintext: 6bc1bee22e409f96e93d7e117393172a ae2d8a571e03ac9c9eb76fac45af8e51 30c81c46a35ce411e5fbc1191a0a52ef f69f2445df4f9b17ad2b417be66c3710 +Comment: F.4.1 OFB-AES128.Encrypt +Key: 2b7e151628aed2a6abf7158809cf4f3c +Ciphertext: 3b3fd92eb72dad20333449f8e83cfb4a 7789508d16918f03f53c52dac54ed825 9740051e9c5fecf64344f7a82260edcc 304c6528f659c77866a510d9c1d6ae5e +Test: Encrypt +Comment: F.4.3 OFB-AES192.Encrypt +Key: 8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b +Ciphertext: cdc80d6fddf18cab34c25909c99a4174 fcc28b8d4c63837c09e81700c1100401 8d9a9aeac0f6596f559c6d4daf59a5f2 6d9f200857ca6c3e9cac524bd9acc92a +Test: Encrypt +Comment: F.4.5 OFB-AES256.Encrypt +Key: 603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4 +Ciphertext: dc7e84bfda79164b7ecd8486985d3860 4febdc6740d20b3ac88f6ad82a4fb08d 71ab47a086e86eedf39d1c5bba97c408 0126141d67f37be8538f5a8be740e484 +Test: Encrypt + +AlgorithmType: SymmetricCipher +Name: AES/CTR +Source: NIST Special Publication 800-38A +IV: f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Plaintext: 6bc1bee22e409f96e93d7e117393172a ae2d8a571e03ac9c9eb76fac45af8e51 30c81c46a35ce411e5fbc1191a0a52ef f69f2445df4f9b17ad2b417be66c3710 +Comment: F.5.1 CTR-AES128.Encrypt +Key: 2b7e151628aed2a6abf7158809cf4f3c +Ciphertext: 874d6191b620e3261bef6864990db6ce 9806f66b7970fdff8617187bb9fffdff 5ae4df3edbd5d35e5b4f09020db03eab 1e031dda2fbe03d1792170a0f3009cee +Test: Encrypt +Comment: F.5.3 CTR-AES192.Encrypt +Key: 8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b +Ciphertext: 1abc932417521ca24f2b0459fe7e6e0b 090339ec0aa6faefd5ccc2c6f4ce8e94 1e36b26bd1ebc670d1bd1d665620abf7 4f78a7f6d29809585a97daec58c6b050 +Test: Encrypt +Comment: F.5.5 CTR-AES256.Encrypt +Key: 603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4 +Ciphertext: 601ec313775789a5b7a7f504bbf3d228 f443e3ca4d62b59aca84e990cacaf5c5 2b0930daa23de94ce87017ba2d84988d dfc9c58db67aada613c2dd08457941a6 +Test: Encrypt + +AlgorithmType: SymmetricCipher +Name: AES/CTR +Source: RFC 3686 +#Test Vector #1: Encrypting 16 octets using AES-CTR with 128-bit key +Key : AE 68 52 F8 12 10 67 CC 4B F7 A5 76 55 77 F3 9E +Plaintext : 53 69 6E 67 6C 65 20 62 6C 6F 63 6B 20 6D 73 67 +IV: 00 00 00 30 00 00 00 00 00 00 00 00 00 00 00 01 +Ciphertext : E4 09 5D 4F B7 A7 B3 79 2D 61 75 A3 26 13 11 B8 +Test: Encrypt +#Test Vector #2: Encrypting 32 octets using AES-CTR with 128-bit key +Key : 7E 24 06 78 17 FA E0 D7 43 D6 CE 1F 32 53 91 63 +Plaintext : 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F +IV: 00 6C B6 DB C0 54 3B 59 DA 48 D9 0B 00 00 00 01 +Ciphertext : 51 04 A1 06 16 8A 72 D9 79 0D 41 EE 8E DA D3 88 EB 2E 1E FC 46 DA 57 C8 FC E6 30 DF 91 41 BE 28 +Test: Encrypt +#Test Vector #3: Encrypting 36 octets using AES-CTR with 128-bit key +Key : 76 91 BE 03 5E 50 20 A8 AC 6E 61 85 29 F9 A0 DC +Plaintext : 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 +IV: 00 E0 01 7B 27 77 7F 3F 4A 17 86 F0 00 00 00 01 +Ciphertext : C1 CF 48 A8 9F 2F FD D9 CF 46 52 E9 EF DB 72 D7 45 40 A4 2B DE 6D 78 36 D5 9A 5C EA AE F3 10 53 25 B2 07 2F +Test: Encrypt +#Test Vector #4: Encrypting 16 octets using AES-CTR with 192-bit key +Key : 16 AF 5B 14 5F C9 F5 79 C1 75 F9 3E 3B FB 0E ED 86 3D 06 CC FD B7 85 15 +Plaintext : 53 69 6E 67 6C 65 20 62 6C 6F 63 6B 20 6D 73 67 +IV: 00 00 00 48 36 73 3C 14 7D 6D 93 CB 00 00 00 01 +Ciphertext : 4B 55 38 4F E2 59 C9 C8 4E 79 35 A0 03 CB E9 28 +Test: Encrypt +#Test Vector #5: Encrypting 32 octets using AES-CTR with 192-bit key +Key : 7C 5C B2 40 1B 3D C3 3C 19 E7 34 08 19 E0 F6 9C 67 8C 3D B8 E6 F6 A9 1A +Plaintext : 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F +IV: 00 96 B0 3B 02 0C 6E AD C2 CB 50 0D 00 00 00 01 +Ciphertext : 45 32 43 FC 60 9B 23 32 7E DF AA FA 71 31 CD 9F 84 90 70 1C 5A D4 A7 9C FC 1F E0 FF 42 F4 FB 00 +Test: Encrypt +#Test Vector #6: Encrypting 36 octets using AES-CTR with 192-bit key +Key : 02 BF 39 1E E8 EC B1 59 B9 59 61 7B 09 65 27 9B F5 9B 60 A7 86 D3 E0 FE +Plaintext : 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 +IV: 00 07 BD FD 5C BD 60 27 8D CC 09 12 00 00 00 01 +Ciphertext : 96 89 3F C5 5E 5C 72 2F 54 0B 7D D1 DD F7 E7 58 D2 88 BC 95 C6 91 65 88 45 36 C8 11 66 2F 21 88 AB EE 09 35 +Test: Encrypt +#Test Vector #7: Encrypting 16 octets using AES-CTR with 256-bit key +Key : 77 6B EF F2 85 1D B0 6F 4C 8A 05 42 C8 69 6F 6C 6A 81 AF 1E EC 96 B4 D3 7F C1 D6 89 E6 C1 C1 04 +Plaintext : 53 69 6E 67 6C 65 20 62 6C 6F 63 6B 20 6D 73 67 +IV: 00 00 00 60 DB 56 72 C9 7A A8 F0 B2 00 00 00 01 +Ciphertext : 14 5A D0 1D BF 82 4E C7 56 08 63 DC 71 E3 E0 C0 +Test: Encrypt +#Test Vector #8: Encrypting 32 octets using AES-CTR with 256-bit key +Key : F6 D6 6D 6B D5 2D 59 BB 07 96 36 58 79 EF F8 86 C6 6D D5 1A 5B 6A 99 74 4B 50 59 0C 87 A2 38 84 +Plaintext : 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F +IV: 00 FA AC 24 C1 58 5E F1 5A 43 D8 75 00 00 00 01 +Ciphertext : F0 5E 23 1B 38 94 61 2C 49 EE 00 0B 80 4E B2 A9 B8 30 6B 50 8F 83 9D 6A 55 30 83 1D 93 44 AF 1C +Test: Encrypt +#Test Vector #9: Encrypting 36 octets using AES-CTR with 256-bit key +Key : FF 7A 61 7C E6 91 48 E4 F1 72 6E 2F 43 58 1D E2 AA 62 D9 F8 05 53 2E DF F1 EE D6 87 FB 54 15 3D +Plaintext : 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 +IV: 00 1C C5 B7 51 A5 1D 70 A1 C1 11 48 00 00 00 01 +Ciphertext : EB 6C 52 82 1D 0B BB F7 CE 75 94 46 2A CA 4F AA B4 07 DF 86 65 69 FD 07 F4 8C C0 B5 83 D6 07 1F 1E C0 E6 B8 +Test: Encrypt diff --git a/cryptopp/TestVectors/all.txt b/cryptopp/TestVectors/all.txt new file mode 100644 index 0000000..dcffeef --- /dev/null +++ b/cryptopp/TestVectors/all.txt @@ -0,0 +1,28 @@ +AlgorithmType: FileList +Name: all.txt collection +Test: TestVectors/tea.txt +Test: TestVectors/camellia.txt +Test: TestVectors/shacal2.txt +Test: TestVectors/ttmac.txt +Test: TestVectors/whrlpool.txt +Test: TestVectors/dlies.txt +Test: TestVectors/dsa.txt +Test: TestVectors/dsa_1363.txt +Test: TestVectors/esign.txt +Test: TestVectors/hmac.txt +Test: TestVectors/nr.txt +Test: TestVectors/rsa_oaep.txt +Test: TestVectors/rsa_pkcs1_1_5.txt +Test: TestVectors/rsa_pss.txt +Test: TestVectors/rw.txt +Test: TestVectors/seal.txt +Test: TestVectors/sha.txt +Test: TestVectors/panama.txt +Test: TestVectors/aes.txt +Test: TestVectors/salsa.txt +Test: TestVectors/vmac.txt +Test: TestVectors/sosemanuk.txt +Test: TestVectors/ccm.txt +Test: TestVectors/gcm.txt +Test: TestVectors/cmac.txt +Test: TestVectors/eax.txt diff --git a/cryptopp/TestVectors/camellia.txt b/cryptopp/TestVectors/camellia.txt new file mode 100644 index 0000000..f88d05b --- /dev/null +++ b/cryptopp/TestVectors/camellia.txt @@ -0,0 +1,8646 @@ +AlgorithmType: SymmetricCipher +Name: Camellia/ECB +Source: NESSIE submission +Comment: Tests with 128-bit keys +Comment: Set 1, vector 0 +Key: 80000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6C227F749319A3AA7DA235A9BBA05A2C +Test: Encrypt +Comment: Set 1, vector 1 +Key: 40000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F04D51E45E70FB6DEE0D16A204FBBA16 +Test: Encrypt +Comment: Set 1, vector 2 +Key: 20000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: ED44242E619F8C32EAA2D3641DA47EA4 +Test: Encrypt +Comment: Set 1, vector 3 +Key: 10000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AC640BBBF84CD3B8E8258BF66C210AE2 +Test: Encrypt +Comment: Set 1, vector 4 +Key: 08000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8A42BDA76C84B8960B23530100AFB748 +Test: Encrypt +Comment: Set 1, vector 5 +Key: 04000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1D20D15F3EE21EE6051803ADF83E31D7 +Test: Encrypt +Comment: Set 1, vector 6 +Key: 02000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6896B2FB85D26A243BB5697F6A764307 +Test: Encrypt +Comment: Set 1, vector 7 +Key: 01000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 43A865A61E1117008372932EA9CE8BB2 +Test: Encrypt +Comment: Set 1, vector 8 +Key: 00800000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CB5ECC200DDE8E9076A8AEA2250F49E4 +Test: Encrypt +Comment: Set 1, vector 9 +Key: 00400000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0B2A489718DC0B0E11F11C1D3913F4A8 +Test: Encrypt +Comment: Set 1, vector 10 +Key: 00200000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1D28A0A70B3C72ADC5B77487AD442873 +Test: Encrypt +Comment: Set 1, vector 11 +Key: 00100000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 26D344959095765A3DD6986B656F353D +Test: Encrypt +Comment: Set 1, vector 12 +Key: 00080000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 048248D32A74DB80DAF5642417F7832A +Test: Encrypt +Comment: Set 1, vector 13 +Key: 00040000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 44D400F8752F16B20DB95A959917B650 +Test: Encrypt +Comment: Set 1, vector 14 +Key: 00020000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E885DD9B2794459B2133BC84B59C2DED +Test: Encrypt +Comment: Set 1, vector 15 +Key: 00010000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 89D6E4182FD0DD7E4038710F597DD242 +Test: Encrypt +Comment: Set 1, vector 16 +Key: 00008000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7FE5BA5FF1D0EB81132A3DA0CD8E829D +Test: Encrypt +Comment: Set 1, vector 17 +Key: 00004000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 470FEDAAA6FFFCBC48AF8B3859B1E45F +Test: Encrypt +Comment: Set 1, vector 18 +Key: 00002000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B6FA2D9F41110E6914890AF888C36091 +Test: Encrypt +Comment: Set 1, vector 19 +Key: 00001000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 46D2C0FD0C3A4D2B5CA6BA5E14382DCA +Test: Encrypt +Comment: Set 1, vector 20 +Key: 00000800000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 730D700DCC5AB632DD9D92C6D1C18E5A +Test: Encrypt +Comment: Set 1, vector 21 +Key: 00000400000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 067D56D80AF5D2F24D84F518B8FC7920 +Test: Encrypt +Comment: Set 1, vector 22 +Key: 00000200000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 027F6EE9F54534E4C21F9263B68BAEA0 +Test: Encrypt +Comment: Set 1, vector 23 +Key: 00000100000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: D115CB2324E8FDA3576DEE57E49CC315 +Test: Encrypt +Comment: Set 1, vector 24 +Key: 00000080000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0976DB57B27E4136743E58BCECFBC056 +Test: Encrypt +Comment: Set 1, vector 25 +Key: 00000040000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0C889DF89972EB42DB2BD2AAC335CCC8 +Test: Encrypt +Comment: Set 1, vector 26 +Key: 00000020000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CB6B80177047A3B2AC290A41B94174EF +Test: Encrypt +Comment: Set 1, vector 27 +Key: 00000010000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F816631F8FBC54ECDC1AB5323FF8424E +Test: Encrypt +Comment: Set 1, vector 28 +Key: 00000008000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 40CB64DF57D2A6BBCBD82DFCC749707D +Test: Encrypt +Comment: Set 1, vector 29 +Key: 00000004000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 885BD3C2DD560765B11F5A2D238E9F9A +Test: Encrypt +Comment: Set 1, vector 30 +Key: 00000002000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 877AAEF064555DE89C99B7C5A1326C62 +Test: Encrypt +Comment: Set 1, vector 31 +Key: 00000001000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AA4FBBE7A02020F5D81030E0EF7A460D +Test: Encrypt +Comment: Set 1, vector 32 +Key: 00000000800000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AA2759BC215E49F26008206F6F65B7AC +Test: Encrypt +Comment: Set 1, vector 33 +Key: 00000000400000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 419A8069C3D531475FF7F29AE049D57C +Test: Encrypt +Comment: Set 1, vector 34 +Key: 00000000200000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 455588067DB9088130C861F5BE9E15BF +Test: Encrypt +Comment: Set 1, vector 35 +Key: 00000000100000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FDD6967ADA65ED3E20718C451AE5AE34 +Test: Encrypt +Comment: Set 1, vector 36 +Key: 00000000080000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1C74228D2A82248CD29800B64BEFF97A +Test: Encrypt +Comment: Set 1, vector 37 +Key: 00000000040000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4B88B7FFB32B05840BE7B497377AFDAA +Test: Encrypt +Comment: Set 1, vector 38 +Key: 00000000020000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4D4EC4C728524DA2F366FC272AB2666A +Test: Encrypt +Comment: Set 1, vector 39 +Key: 00000000010000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4FA8A27ED16BF36FA296D8AB2B423C77 +Test: Encrypt +Comment: Set 1, vector 40 +Key: 00000000008000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 943B9D570D371A3D823B680BBDA9477D +Test: Encrypt +Comment: Set 1, vector 41 +Key: 00000000004000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DCC390F5E1CAADBE061D02929473D084 +Test: Encrypt +Comment: Set 1, vector 42 +Key: 00000000002000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9655F00C4A5C40DF401A3FF806575834 +Test: Encrypt +Comment: Set 1, vector 43 +Key: 00000000001000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FCC9F6B36DE6DD6AA578AD0B59DF5996 +Test: Encrypt +Comment: Set 1, vector 44 +Key: 00000000000800000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F573FF52ACAA16609E5B3C3C7353DA75 +Test: Encrypt +Comment: Set 1, vector 45 +Key: 00000000000400000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 203EF49006A7FC856FF7A7A3B953D999 +Test: Encrypt +Comment: Set 1, vector 46 +Key: 00000000000200000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 16659E823D942E99C83926C4055D896D +Test: Encrypt +Comment: Set 1, vector 47 +Key: 00000000000100000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 139D5DB9EF0119F4E5D11256C5ECB8B0 +Test: Encrypt +Comment: Set 1, vector 48 +Key: 00000000000080000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 63FB244962CCE915425EF1B31DE6AAE2 +Test: Encrypt +Comment: Set 1, vector 49 +Key: 00000000000040000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6F771C2DC848A106E907A990DABA0272 +Test: Encrypt +Comment: Set 1, vector 50 +Key: 00000000000020000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CFA1F114CF0D9C7DAD301B833962ABF2 +Test: Encrypt +Comment: Set 1, vector 51 +Key: 00000000000010000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 58A3BE61DA53D0AA8F33DE95E6F38A3F +Test: Encrypt +Comment: Set 1, vector 52 +Key: 00000000000008000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2FE96FCB3D845B568AE804B217F3498F +Test: Encrypt +Comment: Set 1, vector 53 +Key: 00000000000004000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FD74EB6621127D58FA44BA3E6EE7835D +Test: Encrypt +Comment: Set 1, vector 54 +Key: 00000000000002000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 834C0C5D8D88EE63C989AA1E66F4E18C +Test: Encrypt +Comment: Set 1, vector 55 +Key: 00000000000001000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FEF8E0097B9EB5CE6DE710F5742F7E4F +Test: Encrypt +Comment: Set 1, vector 56 +Key: 00000000000000800000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 75FCC55F284311B81D967618C2D35700 +Test: Encrypt +Comment: Set 1, vector 57 +Key: 00000000000000400000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 91AE4E35623A7F10383BF7448F1F74AD +Test: Encrypt +Comment: Set 1, vector 58 +Key: 00000000000000200000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8928B2B6967BA1B4230AA1EBA49D1A08 +Test: Encrypt +Comment: Set 1, vector 59 +Key: 00000000000000100000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 707EA08174ED5C0AD0A74363B403F02D +Test: Encrypt +Comment: Set 1, vector 60 +Key: 00000000000000080000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7C0C13410DDE30C0AD3565FFAA33E8AD +Test: Encrypt +Comment: Set 1, vector 61 +Key: 00000000000000040000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 56DA72C545C490A749C66BCC5D90AACD +Test: Encrypt +Comment: Set 1, vector 62 +Key: 00000000000000020000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2CC0CF6E2AAA7916AF636B1546BA1179 +Test: Encrypt +Comment: Set 1, vector 63 +Key: 00000000000000010000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A19FE617883D409B1F78882E0D5EF39C +Test: Encrypt +Comment: Set 1, vector 64 +Key: 00000000000000008000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2B8586BBB979CFFAC5A76C25D77C1E2C +Test: Encrypt +Comment: Set 1, vector 65 +Key: 00000000000000004000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5A08C9B5A2940E3ACD1086867E3E4733 +Test: Encrypt +Comment: Set 1, vector 66 +Key: 00000000000000002000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7443F1072833BFC8AA38CBF6963CF880 +Test: Encrypt +Comment: Set 1, vector 67 +Key: 00000000000000001000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6809A1F2D2B5367D5E8442E7972BD1D4 +Test: Encrypt +Comment: Set 1, vector 68 +Key: 00000000000000000800000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A61D4FE41D5DBB7A6BCE5984502CD767 +Test: Encrypt +Comment: Set 1, vector 69 +Key: 00000000000000000400000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 30D86F43B81F4D2098A4D43AB2637549 +Test: Encrypt +Comment: Set 1, vector 70 +Key: 00000000000000000200000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5B16E9033FA40BF141D3EE73FF7E2564 +Test: Encrypt +Comment: Set 1, vector 71 +Key: 00000000000000000100000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 15574EF70C880682DBFBD93FAE8023F6 +Test: Encrypt +Comment: Set 1, vector 72 +Key: 00000000000000000080000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0D8D220DB69B15FFE2001B3F42E910EA +Test: Encrypt +Comment: Set 1, vector 73 +Key: 00000000000000000040000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 030AB24DA9E4ADD4E350E692077A948C +Test: Encrypt +Comment: Set 1, vector 74 +Key: 00000000000000000020000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7F6509A9FD8525126BFB69AFE8624A96 +Test: Encrypt +Comment: Set 1, vector 75 +Key: 00000000000000000010000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9600EB0B7E38A5ABEBBDADD3DFC70298 +Test: Encrypt +Comment: Set 1, vector 76 +Key: 00000000000000000008000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3CF0F71B4687AAABEB9FA8CDE00B17D7 +Test: Encrypt +Comment: Set 1, vector 77 +Key: 00000000000000000004000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8B1C549A655C0041D866B7875A2736CB +Test: Encrypt +Comment: Set 1, vector 78 +Key: 00000000000000000002000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8F507233FBC9E1DBF716FB4C828DBF06 +Test: Encrypt +Comment: Set 1, vector 79 +Key: 00000000000000000001000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 14A45A121DC8996020C29A040FE8E52D +Test: Encrypt +Comment: Set 1, vector 80 +Key: 00000000000000000000800000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 32390FB6FC15BB4B37D1CD8817BAEB09 +Test: Encrypt +Comment: Set 1, vector 81 +Key: 00000000000000000000400000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9E61986F3F4C31132D436CCFCF751043 +Test: Encrypt +Comment: Set 1, vector 82 +Key: 00000000000000000000200000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 24E63FAD370974C60330F7C3071938F1 +Test: Encrypt +Comment: Set 1, vector 83 +Key: 00000000000000000000100000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3CE71D4E9F2F7EF9A6F9F2548C5489CC +Test: Encrypt +Comment: Set 1, vector 84 +Key: 00000000000000000000080000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E42436B8E076A00600DFD67B8C427DB1 +Test: Encrypt +Comment: Set 1, vector 85 +Key: 00000000000000000000040000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5C2577FA8104DCC58ACE852B4D11FE24 +Test: Encrypt +Comment: Set 1, vector 86 +Key: 00000000000000000000020000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 12FC9DD7132B3BB346C53FD193531638 +Test: Encrypt +Comment: Set 1, vector 87 +Key: 00000000000000000000010000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5D91F775E26599F26B21F9FB1F67DA38 +Test: Encrypt +Comment: Set 1, vector 88 +Key: 00000000000000000000008000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: D4B3683AA62D2EF0331A960A0BF01A29 +Test: Encrypt +Comment: Set 1, vector 89 +Key: 00000000000000000000004000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EE32582D35DDF3A82142ED18FEE38014 +Test: Encrypt +Comment: Set 1, vector 90 +Key: 00000000000000000000002000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 148632AE69514D5776DA4AF38E1AE4FD +Test: Encrypt +Comment: Set 1, vector 91 +Key: 00000000000000000000001000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 30A3EE1AA1CA17B128DAAF06AF9025BD +Test: Encrypt +Comment: Set 1, vector 92 +Key: 00000000000000000000000800000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 88D82D9E508CBFB392E47E524BB33019 +Test: Encrypt +Comment: Set 1, vector 93 +Key: 00000000000000000000000400000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0C20870A9FC751F6E41F92305B7C4D92 +Test: Encrypt +Comment: Set 1, vector 94 +Key: 00000000000000000000000200000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6A4EDE5FD13F3676C1BCF8B73AB273CB +Test: Encrypt +Comment: Set 1, vector 95 +Key: 00000000000000000000000100000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5A62CE50EA837CA4FD0F7304D1572D22 +Test: Encrypt +Comment: Set 1, vector 96 +Key: 00000000000000000000000080000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 84DB8599B48ED4F39E872F13F7FCDF0B +Test: Encrypt +Comment: Set 1, vector 97 +Key: 00000000000000000000000040000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CDD25F8276411E892035C9703C7588EE +Test: Encrypt +Comment: Set 1, vector 98 +Key: 00000000000000000000000020000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 73BCFB16436B5C52CD4BC9629F75C5C8 +Test: Encrypt +Comment: Set 1, vector 99 +Key: 00000000000000000000000010000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 03752D935029B09699C29CA5C6E79553 +Test: Encrypt +Comment: Set 1, vector 100 +Key: 00000000000000000000000008000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EF439A1B86698409E91D992BDB3F54E5 +Test: Encrypt +Comment: Set 1, vector 101 +Key: 00000000000000000000000004000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2A34BDE7EC74221BFF58B251E54F089F +Test: Encrypt +Comment: Set 1, vector 102 +Key: 00000000000000000000000002000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 35FBB78716B78FB57F96BC8A5D869B72 +Test: Encrypt +Comment: Set 1, vector 103 +Key: 00000000000000000000000001000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AC3A7363DFB6C3F06CCCA1A46F44A5F8 +Test: Encrypt +Comment: Set 1, vector 104 +Key: 00000000000000000000000000800000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4895E1B7E54CA168CE42E3994D564B62 +Test: Encrypt +Comment: Set 1, vector 105 +Key: 00000000000000000000000000400000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E98956EFC457FE8AA103DB303A3B1DF1 +Test: Encrypt +Comment: Set 1, vector 106 +Key: 00000000000000000000000000200000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 276646992D6E752A649183DB05073422 +Test: Encrypt +Comment: Set 1, vector 107 +Key: 00000000000000000000000000100000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 82F36DE401E21D01A476A163A92F4B16 +Test: Encrypt +Comment: Set 1, vector 108 +Key: 00000000000000000000000000080000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E54DD90800B92153C314F8B1590B17E5 +Test: Encrypt +Comment: Set 1, vector 109 +Key: 00000000000000000000000000040000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F4A146DFB33405EC6B8F37AEB10F5198 +Test: Encrypt +Comment: Set 1, vector 110 +Key: 00000000000000000000000000020000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C332ADBC2D44FA1A1A4F7C8EAE2CED29 +Test: Encrypt +Comment: Set 1, vector 111 +Key: 00000000000000000000000000010000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 21AA542624DA9F2363404CE42BC2BAEF +Test: Encrypt +Comment: Set 1, vector 112 +Key: 00000000000000000000000000008000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E101DBEF627038AE819441D133AEE068 +Test: Encrypt +Comment: Set 1, vector 113 +Key: 00000000000000000000000000004000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7A9B635E6AA5D273DE697747FE6BB08E +Test: Encrypt +Comment: Set 1, vector 114 +Key: 00000000000000000000000000002000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0541AA347D36F03D9177FC91398874DB +Test: Encrypt +Comment: Set 1, vector 115 +Key: 00000000000000000000000000001000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BE27D6FE099AB98BF07A74A1ABF5C945 +Test: Encrypt +Comment: Set 1, vector 116 +Key: 00000000000000000000000000000800 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 472ACD81A6626822E220F431C4491704 +Test: Encrypt +Comment: Set 1, vector 117 +Key: 00000000000000000000000000000400 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2D5152F19E29AD7D5823CDCA188E0CD8 +Test: Encrypt +Comment: Set 1, vector 118 +Key: 00000000000000000000000000000200 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 875C90B3669DF8F4867B6769689656E7 +Test: Encrypt +Comment: Set 1, vector 119 +Key: 00000000000000000000000000000100 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 59641CA52EEBC2C229930CE42529277F +Test: Encrypt +Comment: Set 1, vector 120 +Key: 00000000000000000000000000000080 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A3B4D666AC56C284D40DC27FDB0F787C +Test: Encrypt +Comment: Set 1, vector 121 +Key: 00000000000000000000000000000040 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0511D526FC5F255F51F1914B4B12AD84 +Test: Encrypt +Comment: Set 1, vector 122 +Key: 00000000000000000000000000000020 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2D14332989F629DA4720ECC916B4DAF0 +Test: Encrypt +Comment: Set 1, vector 123 +Key: 00000000000000000000000000000010 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C44EAC8457E2F17E9BC86EB4C436E8DB +Test: Encrypt +Comment: Set 1, vector 124 +Key: 00000000000000000000000000000008 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 022F3EB45AAA39F785FF80B6A3006BF6 +Test: Encrypt +Comment: Set 1, vector 125 +Key: 00000000000000000000000000000004 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B8A714C8F8427767B384B0E2F6BAF619 +Test: Encrypt +Comment: Set 1, vector 126 +Key: 00000000000000000000000000000002 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 01F745A7C09FECD3497F087BD52A9A0F +Test: Encrypt +Comment: Set 1, vector 127 +Key: 00000000000000000000000000000001 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 41E0E6DC2DDEC65D8B8120E60977B82D +Test: Encrypt +Comment: Set 2, vector 0 +Key: 00000000000000000000000000000000 +Plaintext: 80000000000000000000000000000000 +Ciphertext: 07923A39EB0A817D1C4D87BDB82D1F1C +Test: Encrypt +Comment: Set 2, vector 1 +Key: 00000000000000000000000000000000 +Plaintext: 40000000000000000000000000000000 +Ciphertext: 48CD6419809672D2349260D89A08D3D3 +Test: Encrypt +Comment: Set 2, vector 2 +Key: 00000000000000000000000000000000 +Plaintext: 20000000000000000000000000000000 +Ciphertext: D07493CCB2E95CE0B4945A05ACC97D82 +Test: Encrypt +Comment: Set 2, vector 3 +Key: 00000000000000000000000000000000 +Plaintext: 10000000000000000000000000000000 +Ciphertext: 5DBE1EAC9F7080A88DBED7F6DA101448 +Test: Encrypt +Comment: Set 2, vector 4 +Key: 00000000000000000000000000000000 +Plaintext: 08000000000000000000000000000000 +Ciphertext: F01EE477D199DF2701027034B229622F +Test: Encrypt +Comment: Set 2, vector 5 +Key: 00000000000000000000000000000000 +Plaintext: 04000000000000000000000000000000 +Ciphertext: C841587ABD9A912E563774CB569D051E +Test: Encrypt +Comment: Set 2, vector 6 +Key: 00000000000000000000000000000000 +Plaintext: 02000000000000000000000000000000 +Ciphertext: 1D9BC0C04546F0915C8CCD11391A455C +Test: Encrypt +Comment: Set 2, vector 7 +Key: 00000000000000000000000000000000 +Plaintext: 01000000000000000000000000000000 +Ciphertext: 05E6EBB4BA167F5C479CEFF3152F943B +Test: Encrypt +Comment: Set 2, vector 8 +Key: 00000000000000000000000000000000 +Plaintext: 00800000000000000000000000000000 +Ciphertext: 93211E0F788845B9FC0E4551FFE92AC9 +Test: Encrypt +Comment: Set 2, vector 9 +Key: 00000000000000000000000000000000 +Plaintext: 00400000000000000000000000000000 +Ciphertext: B6D35701CD8FADDE383BBE8E6B70BAF7 +Test: Encrypt +Comment: Set 2, vector 10 +Key: 00000000000000000000000000000000 +Plaintext: 00200000000000000000000000000000 +Ciphertext: 8358F9F4EBCFEE348CB30551ACB151A0 +Test: Encrypt +Comment: Set 2, vector 11 +Key: 00000000000000000000000000000000 +Plaintext: 00100000000000000000000000000000 +Ciphertext: D57516EB5AD93C523E40521BF447AFCE +Test: Encrypt +Comment: Set 2, vector 12 +Key: 00000000000000000000000000000000 +Plaintext: 00080000000000000000000000000000 +Ciphertext: 66B2534C279C439133F52E5AD8B439A9 +Test: Encrypt +Comment: Set 2, vector 13 +Key: 00000000000000000000000000000000 +Plaintext: 00040000000000000000000000000000 +Ciphertext: A71C69184A9F63C2992A5F18F77C1FE9 +Test: Encrypt +Comment: Set 2, vector 14 +Key: 00000000000000000000000000000000 +Plaintext: 00020000000000000000000000000000 +Ciphertext: 1ADCBE49AEACB9ECEBBD492B10E82C7B +Test: Encrypt +Comment: Set 2, vector 15 +Key: 00000000000000000000000000000000 +Plaintext: 00010000000000000000000000000000 +Ciphertext: 27E3BCFB227C5561DB6CF7FC30387036 +Test: Encrypt +Comment: Set 2, vector 16 +Key: 00000000000000000000000000000000 +Plaintext: 00008000000000000000000000000000 +Ciphertext: F4AE20365CC9D06B0CAE6B695ED2CEC1 +Test: Encrypt +Comment: Set 2, vector 17 +Key: 00000000000000000000000000000000 +Plaintext: 00004000000000000000000000000000 +Ciphertext: 3DD682F0B641ED32AD3D43EA2A0456E4 +Test: Encrypt +Comment: Set 2, vector 18 +Key: 00000000000000000000000000000000 +Plaintext: 00002000000000000000000000000000 +Ciphertext: 6E5D14A95ECC290B509EA6B673652E3A +Test: Encrypt +Comment: Set 2, vector 19 +Key: 00000000000000000000000000000000 +Plaintext: 00001000000000000000000000000000 +Ciphertext: F1CDF0F8D7B3FFD95422D7CC0CF40B7B +Test: Encrypt +Comment: Set 2, vector 20 +Key: 00000000000000000000000000000000 +Plaintext: 00000800000000000000000000000000 +Ciphertext: A9253D459A34C385A1F1B2CFFA3935C5 +Test: Encrypt +Comment: Set 2, vector 21 +Key: 00000000000000000000000000000000 +Plaintext: 00000400000000000000000000000000 +Ciphertext: 291024D99FF09A47A1DEE45BA700AE52 +Test: Encrypt +Comment: Set 2, vector 22 +Key: 00000000000000000000000000000000 +Plaintext: 00000200000000000000000000000000 +Ciphertext: 49241D9459B277187BB10081C60361C0 +Test: Encrypt +Comment: Set 2, vector 23 +Key: 00000000000000000000000000000000 +Plaintext: 00000100000000000000000000000000 +Ciphertext: AD9BA365CC4DD5553D2D9FE303841D88 +Test: Encrypt +Comment: Set 2, vector 24 +Key: 00000000000000000000000000000000 +Plaintext: 00000080000000000000000000000000 +Ciphertext: C2ECA616664A249DC622CC11196B4AE1 +Test: Encrypt +Comment: Set 2, vector 25 +Key: 00000000000000000000000000000000 +Plaintext: 00000040000000000000000000000000 +Ciphertext: 6E1A2D4794BB0DC08777A0BC7523E70E +Test: Encrypt +Comment: Set 2, vector 26 +Key: 00000000000000000000000000000000 +Plaintext: 00000020000000000000000000000000 +Ciphertext: 6DB1F0CF59656BDD235E82B8CEF0BE8E +Test: Encrypt +Comment: Set 2, vector 27 +Key: 00000000000000000000000000000000 +Plaintext: 00000010000000000000000000000000 +Ciphertext: 52F239C5EAF401EBDC54D2F011FF4B6A +Test: Encrypt +Comment: Set 2, vector 28 +Key: 00000000000000000000000000000000 +Plaintext: 00000008000000000000000000000000 +Ciphertext: 6B58A08F648414B67FD6847D2AA51CBF +Test: Encrypt +Comment: Set 2, vector 29 +Key: 00000000000000000000000000000000 +Plaintext: 00000004000000000000000000000000 +Ciphertext: 2959DD5367885A75EB48053CF3251A36 +Test: Encrypt +Comment: Set 2, vector 30 +Key: 00000000000000000000000000000000 +Plaintext: 00000002000000000000000000000000 +Ciphertext: 630B292E3B88EF641CDFD531E206605E +Test: Encrypt +Comment: Set 2, vector 31 +Key: 00000000000000000000000000000000 +Plaintext: 00000001000000000000000000000000 +Ciphertext: 4BBB88EF82B70593FCC56AFD91540FDB +Test: Encrypt +Comment: Set 2, vector 32 +Key: 00000000000000000000000000000000 +Plaintext: 00000000800000000000000000000000 +Ciphertext: 0A13055B118A45C606999257BD191426 +Test: Encrypt +Comment: Set 2, vector 33 +Key: 00000000000000000000000000000000 +Plaintext: 00000000400000000000000000000000 +Ciphertext: 5CF8E5C9F15D7E4F865020224853EB77 +Test: Encrypt +Comment: Set 2, vector 34 +Key: 00000000000000000000000000000000 +Plaintext: 00000000200000000000000000000000 +Ciphertext: 3898805042C7A4315C5EE51AF2DE47E2 +Test: Encrypt +Comment: Set 2, vector 35 +Key: 00000000000000000000000000000000 +Plaintext: 00000000100000000000000000000000 +Ciphertext: 8D3F96372E87CBB0B375425B3A10B9E7 +Test: Encrypt +Comment: Set 2, vector 36 +Key: 00000000000000000000000000000000 +Plaintext: 00000000080000000000000000000000 +Ciphertext: 4D9510A378BD784A70A66BCC75B7D3C8 +Test: Encrypt +Comment: Set 2, vector 37 +Key: 00000000000000000000000000000000 +Plaintext: 00000000040000000000000000000000 +Ciphertext: 70DB1902D37CFBDFB98F7C516F79D416 +Test: Encrypt +Comment: Set 2, vector 38 +Key: 00000000000000000000000000000000 +Plaintext: 00000000020000000000000000000000 +Ciphertext: 383C6C2AABEF7FDE25CD470BF774A331 +Test: Encrypt +Comment: Set 2, vector 39 +Key: 00000000000000000000000000000000 +Plaintext: 00000000010000000000000000000000 +Ciphertext: 47CBCB5288349B1A15DC9F81FBEE6B8F +Test: Encrypt +Comment: Set 2, vector 40 +Key: 00000000000000000000000000000000 +Plaintext: 00000000008000000000000000000000 +Ciphertext: 21DA34D4468EEB13AED95DAE0FF48310 +Test: Encrypt +Comment: Set 2, vector 41 +Key: 00000000000000000000000000000000 +Plaintext: 00000000004000000000000000000000 +Ciphertext: 021C9A8E6BD36FBD036411E5D852A80F +Test: Encrypt +Comment: Set 2, vector 42 +Key: 00000000000000000000000000000000 +Plaintext: 00000000002000000000000000000000 +Ciphertext: 6A459E2F839AF60ACDE83774D0BB5574 +Test: Encrypt +Comment: Set 2, vector 43 +Key: 00000000000000000000000000000000 +Plaintext: 00000000001000000000000000000000 +Ciphertext: C19255121F1B933CAE09E58AEC0E9977 +Test: Encrypt +Comment: Set 2, vector 44 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000800000000000000000000 +Ciphertext: 7BA949E27B2BE148A6B801F9305F43D5 +Test: Encrypt +Comment: Set 2, vector 45 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000400000000000000000000 +Ciphertext: E8CEB1026BCF7BCEA32E8A380EA76DB7 +Test: Encrypt +Comment: Set 2, vector 46 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000200000000000000000000 +Ciphertext: 63F97747ED56A8F521B20CC65F6F9465 +Test: Encrypt +Comment: Set 2, vector 47 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000100000000000000000000 +Ciphertext: 2091CFDC629819106188424AC694F75B +Test: Encrypt +Comment: Set 2, vector 48 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000080000000000000000000 +Ciphertext: A91BDF8E8B88407942423CCE000527C4 +Test: Encrypt +Comment: Set 2, vector 49 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000040000000000000000000 +Ciphertext: 73F9B44B9635A3FD683DBF8D49E9825B +Test: Encrypt +Comment: Set 2, vector 50 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000020000000000000000000 +Ciphertext: 9DC64B2133FAD5069FD9A7CC2FFFD1CC +Test: Encrypt +Comment: Set 2, vector 51 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000010000000000000000000 +Ciphertext: 28240F81FEC36B71E13F1FEA7A7641E3 +Test: Encrypt +Comment: Set 2, vector 52 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000008000000000000000000 +Ciphertext: 20DD39FEE96CD2EFF972872A692B28FD +Test: Encrypt +Comment: Set 2, vector 53 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000004000000000000000000 +Ciphertext: 47A9E40483EC1925B635E47E964E8E93 +Test: Encrypt +Comment: Set 2, vector 54 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000002000000000000000000 +Ciphertext: 9C0EBD822C49FB3D853DF5B315A87BA0 +Test: Encrypt +Comment: Set 2, vector 55 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000001000000000000000000 +Ciphertext: C18D813FDB45A594C6DC24E5A1F6CE32 +Test: Encrypt +Comment: Set 2, vector 56 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000800000000000000000 +Ciphertext: 7E5467FF245ECF80CB55C2D8E91F0711 +Test: Encrypt +Comment: Set 2, vector 57 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000400000000000000000 +Ciphertext: 394D4365B77954FDEA4145FCF7A7A041 +Test: Encrypt +Comment: Set 2, vector 58 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000200000000000000000 +Ciphertext: B1D8311A492ED11F11E57B29221610C4 +Test: Encrypt +Comment: Set 2, vector 59 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000100000000000000000 +Ciphertext: E5FBB947A63AEA90163AF04AD6951EF8 +Test: Encrypt +Comment: Set 2, vector 60 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000080000000000000000 +Ciphertext: CA0627DDF580F0E7D59562825C9D0492 +Test: Encrypt +Comment: Set 2, vector 61 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000040000000000000000 +Ciphertext: EF98FFD1AED295AAE1860F0274C8F555 +Test: Encrypt +Comment: Set 2, vector 62 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000020000000000000000 +Ciphertext: 8C698E5CFFF08FACE10C2DC5FF1E2A81 +Test: Encrypt +Comment: Set 2, vector 63 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000010000000000000000 +Ciphertext: 35A7767E02032C35B5CE1A6F49C57C28 +Test: Encrypt +Comment: Set 2, vector 64 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000008000000000000000 +Ciphertext: AB36F8734E76EBA306CF00D6763D90B0 +Test: Encrypt +Comment: Set 2, vector 65 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000004000000000000000 +Ciphertext: E854EB66D4EC66889B5E6CD4F44A5806 +Test: Encrypt +Comment: Set 2, vector 66 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000002000000000000000 +Ciphertext: 15B66DF1455ACD640B8716BCF5DB2D69 +Test: Encrypt +Comment: Set 2, vector 67 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000001000000000000000 +Ciphertext: 4C57AB5333E5C2D4B7E30A007E449F48 +Test: Encrypt +Comment: Set 2, vector 68 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000800000000000000 +Ciphertext: BA3E7FF28EB38EA09D8DB1440A9A3552 +Test: Encrypt +Comment: Set 2, vector 69 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000400000000000000 +Ciphertext: 64E60227AFD80C40C70186CC94804C1A +Test: Encrypt +Comment: Set 2, vector 70 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000200000000000000 +Ciphertext: CEB4423C20B4C91C2551F6FC227C9514 +Test: Encrypt +Comment: Set 2, vector 71 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000100000000000000 +Ciphertext: F736894B843EF32DA28576DE500D448C +Test: Encrypt +Comment: Set 2, vector 72 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000080000000000000 +Ciphertext: 58FDA98B678D15053D4B6C060368108C +Test: Encrypt +Comment: Set 2, vector 73 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000040000000000000 +Ciphertext: E28CAE384E578F47657755EBCD97996C +Test: Encrypt +Comment: Set 2, vector 74 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000020000000000000 +Ciphertext: 0A64617BD4B5B166668240D105B7B6A2 +Test: Encrypt +Comment: Set 2, vector 75 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000010000000000000 +Ciphertext: 4BD090C7E3D365B5EA80F19B4798881E +Test: Encrypt +Comment: Set 2, vector 76 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000008000000000000 +Ciphertext: BC7B6CB9BFF4F72973BB2CD20A512C06 +Test: Encrypt +Comment: Set 2, vector 77 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000004000000000000 +Ciphertext: 4C7ADDC5C867594E9EE75F0AA6AB9C23 +Test: Encrypt +Comment: Set 2, vector 78 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000002000000000000 +Ciphertext: 1FBD05C71A36691AC6566A5298101D53 +Test: Encrypt +Comment: Set 2, vector 79 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000001000000000000 +Ciphertext: 42D7D6B1F499D412F8793972BD968DA2 +Test: Encrypt +Comment: Set 2, vector 80 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000800000000000 +Ciphertext: 260EC86E2786FC68824576B934F32814 +Test: Encrypt +Comment: Set 2, vector 81 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000400000000000 +Ciphertext: 576C26DFD7046F9357F34BEA7DFB26A0 +Test: Encrypt +Comment: Set 2, vector 82 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000200000000000 +Ciphertext: 6D55E54BFB6F927174A02294C95E0F8F +Test: Encrypt +Comment: Set 2, vector 83 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000100000000000 +Ciphertext: 1A6CE91DD458229C7675A34950D10E23 +Test: Encrypt +Comment: Set 2, vector 84 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000080000000000 +Ciphertext: DAD0D5E7E000652825AA34D228EA8D8F +Test: Encrypt +Comment: Set 2, vector 85 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000040000000000 +Ciphertext: E68013F48D75EAD2BBC0B0BDA5E690BF +Test: Encrypt +Comment: Set 2, vector 86 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000020000000000 +Ciphertext: A07D92312FBAE37BFE8A834210AE4F9C +Test: Encrypt +Comment: Set 2, vector 87 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000010000000000 +Ciphertext: 6EEE5F8544CD7D456366EB448813989A +Test: Encrypt +Comment: Set 2, vector 88 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000008000000000 +Ciphertext: F8E5C7FF4B79D7ABE8BFA2DD148820A8 +Test: Encrypt +Comment: Set 2, vector 89 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000004000000000 +Ciphertext: C6349D75C7472BBD66F95B3A07C79C91 +Test: Encrypt +Comment: Set 2, vector 90 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000002000000000 +Ciphertext: B85713C12D8658951CD1AD21C74D2CD2 +Test: Encrypt +Comment: Set 2, vector 91 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000001000000000 +Ciphertext: 907AA00B9F7D47A97623FB55BA911F29 +Test: Encrypt +Comment: Set 2, vector 92 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000800000000 +Ciphertext: DC3CD0ED23D11776FAB43A2A6A8F3557 +Test: Encrypt +Comment: Set 2, vector 93 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000400000000 +Ciphertext: 4BFE58A8FD69179C14765B09AB70B705 +Test: Encrypt +Comment: Set 2, vector 94 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000200000000 +Ciphertext: A23996E0EA67EC280356E5F77130A551 +Test: Encrypt +Comment: Set 2, vector 95 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000100000000 +Ciphertext: CDEADE859B3AACD273CCA85A3E2E45F2 +Test: Encrypt +Comment: Set 2, vector 96 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000080000000 +Ciphertext: E0FC78489857D84DA03F40CE97147174 +Test: Encrypt +Comment: Set 2, vector 97 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000040000000 +Ciphertext: 7615EA6351F6BB12855E8579C6995D8E +Test: Encrypt +Comment: Set 2, vector 98 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000020000000 +Ciphertext: 13E184344FE28C2E70ED0E4D0A8037F9 +Test: Encrypt +Comment: Set 2, vector 99 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000010000000 +Ciphertext: A5FE395F568482B87BC3EB208C81C942 +Test: Encrypt +Comment: Set 2, vector 100 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000008000000 +Ciphertext: B3103E11AF06C85565823F8CAA3159F6 +Test: Encrypt +Comment: Set 2, vector 101 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000004000000 +Ciphertext: 7EBC2234D271B89C519C396985300030 +Test: Encrypt +Comment: Set 2, vector 102 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000002000000 +Ciphertext: 0661D338F2E0C939BA1687820A768467 +Test: Encrypt +Comment: Set 2, vector 103 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000001000000 +Ciphertext: EC2B42667C0195A90715499617884DA5 +Test: Encrypt +Comment: Set 2, vector 104 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000800000 +Ciphertext: AE077BA19D24E7188DDD3682FF196892 +Test: Encrypt +Comment: Set 2, vector 105 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000400000 +Ciphertext: 98823C24B9C65A66073C7952DC2B4B5E +Test: Encrypt +Comment: Set 2, vector 106 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000200000 +Ciphertext: 6AB58432CBB3C2F503DA2D16796CC297 +Test: Encrypt +Comment: Set 2, vector 107 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000100000 +Ciphertext: EEB5EBB3A53E4196C2F22BC1A4DDF5E8 +Test: Encrypt +Comment: Set 2, vector 108 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000080000 +Ciphertext: 33DC40AC5FDC126D38878416AF6C0FA6 +Test: Encrypt +Comment: Set 2, vector 109 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000040000 +Ciphertext: 38EDDC08E18B4AD982CEA921D2765A9A +Test: Encrypt +Comment: Set 2, vector 110 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000020000 +Ciphertext: 7D6BEA038E9347C642E18631660A9558 +Test: Encrypt +Comment: Set 2, vector 111 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000010000 +Ciphertext: FDA57921A473B5EE3700AD5ADF035019 +Test: Encrypt +Comment: Set 2, vector 112 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000008000 +Ciphertext: 699B4812E200337E9C1D2C397F0DFE4E +Test: Encrypt +Comment: Set 2, vector 113 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000004000 +Ciphertext: 7A1EADF68B0807145D6C414852DECFC8 +Test: Encrypt +Comment: Set 2, vector 114 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000002000 +Ciphertext: 1645FFAA8AD76689C01DA8C40882781F +Test: Encrypt +Comment: Set 2, vector 115 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000001000 +Ciphertext: BA0C053BE702FA62FC66D8FEB12FC97E +Test: Encrypt +Comment: Set 2, vector 116 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000800 +Ciphertext: 841FD8AF69CF2C31F7D4D7B6959662B5 +Test: Encrypt +Comment: Set 2, vector 117 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000400 +Ciphertext: F675D59BDB33231861268F539829DA0B +Test: Encrypt +Comment: Set 2, vector 118 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000200 +Ciphertext: A4967F45ABB4E8C7DC5E3806680F35E0 +Test: Encrypt +Comment: Set 2, vector 119 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000100 +Ciphertext: 4D7E08081CC82F92ABA7C58C99F8343F +Test: Encrypt +Comment: Set 2, vector 120 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000080 +Ciphertext: 9AEFDB287C119B82353612B60ECCBFD8 +Test: Encrypt +Comment: Set 2, vector 121 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000040 +Ciphertext: 979BB6A1553A17592A86E78DF144A699 +Test: Encrypt +Comment: Set 2, vector 122 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000020 +Ciphertext: A6FA8CAB06FD2E5BF3A858983C01757A +Test: Encrypt +Comment: Set 2, vector 123 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000010 +Ciphertext: BE8511254C31E25420B91D6FEF1710ED +Test: Encrypt +Comment: Set 2, vector 124 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000008 +Ciphertext: F589A908D18A21894971C0433581E1A5 +Test: Encrypt +Comment: Set 2, vector 125 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000004 +Ciphertext: 4237585130E7C9F715235EB1D8C94DE7 +Test: Encrypt +Comment: Set 2, vector 126 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000002 +Ciphertext: DEFE3E0B5C54C94B4F2A0F5A46F6210D +Test: Encrypt +Comment: Set 2, vector 127 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000001 +Ciphertext: F5574ACC3148DFCB9015200631024DF9 +Test: Encrypt +Comment: Set 3, vector 0 +Key: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3D028025B156327C17F762C1F2CBCA71 +Test: Encrypt +Comment: Set 3, vector 1 +Key: 01010101010101010101010101010101 +Plaintext: 01010101010101010101010101010101 +Ciphertext: 637084CB1120D6F25DB618893040AA27 +Test: Encrypt +Comment: Set 3, vector 2 +Key: 02020202020202020202020202020202 +Plaintext: 02020202020202020202020202020202 +Ciphertext: 612834AAC9EF906BAEAA076E1C75179D +Test: Encrypt +Comment: Set 3, vector 3 +Key: 03030303030303030303030303030303 +Plaintext: 03030303030303030303030303030303 +Ciphertext: AECEE4C59E91366360923654C17140A9 +Test: Encrypt +Comment: Set 3, vector 4 +Key: 04040404040404040404040404040404 +Plaintext: 04040404040404040404040404040404 +Ciphertext: B24FAF8A579E4EFE986571FB2F68B5B4 +Test: Encrypt +Comment: Set 3, vector 5 +Key: 05050505050505050505050505050505 +Plaintext: 05050505050505050505050505050505 +Ciphertext: C102E40B5E584CF6AA16108D93DA26E3 +Test: Encrypt +Comment: Set 3, vector 6 +Key: 06060606060606060606060606060606 +Plaintext: 06060606060606060606060606060606 +Ciphertext: 962F98098E6CEA968FA568C5A32ADA50 +Test: Encrypt +Comment: Set 3, vector 7 +Key: 07070707070707070707070707070707 +Plaintext: 07070707070707070707070707070707 +Ciphertext: 27E9AB0117A37D228B77B29B38B3836F +Test: Encrypt +Comment: Set 3, vector 8 +Key: 08080808080808080808080808080808 +Plaintext: 08080808080808080808080808080808 +Ciphertext: 3E5CAFBB70545AABB1109293A1C44C14 +Test: Encrypt +Comment: Set 3, vector 9 +Key: 09090909090909090909090909090909 +Plaintext: 09090909090909090909090909090909 +Ciphertext: E4AC7417ECB8B2871B0EF12CECD20F46 +Test: Encrypt +Comment: Set 3, vector 10 +Key: 0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A +Plaintext: 0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A +Ciphertext: B29D18DD34C1CC00257838F1B8BD43DB +Test: Encrypt +Comment: Set 3, vector 11 +Key: 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B +Plaintext: 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B +Ciphertext: FC1094A0A2850499D874B6DDC1EBA0B7 +Test: Encrypt +Comment: Set 3, vector 12 +Key: 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C +Plaintext: 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C +Ciphertext: AD062A5D53BB0478F17DA5528839F9FF +Test: Encrypt +Comment: Set 3, vector 13 +Key: 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D +Plaintext: 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D +Ciphertext: 2C9DFEC27363BD0E651CC91FC05FDADF +Test: Encrypt +Comment: Set 3, vector 14 +Key: 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E +Plaintext: 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E +Ciphertext: 487C72BD251D4566AE6119A70A95B79F +Test: Encrypt +Comment: Set 3, vector 15 +Key: 0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F +Plaintext: 0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F +Ciphertext: 18CE9F8E752F787051CB8E407EB16C12 +Test: Encrypt +Comment: Set 3, vector 16 +Key: 10101010101010101010101010101010 +Plaintext: 10101010101010101010101010101010 +Ciphertext: E1FA5FD3F40B766BBE3DF469AF41B420 +Test: Encrypt +Comment: Set 3, vector 17 +Key: 11111111111111111111111111111111 +Plaintext: 11111111111111111111111111111111 +Ciphertext: 09628EDC6CD69F4F85483DC37633F732 +Test: Encrypt +Comment: Set 3, vector 18 +Key: 12121212121212121212121212121212 +Plaintext: 12121212121212121212121212121212 +Ciphertext: 2E6C94A96F6744C4E8D4146B4ECCD815 +Test: Encrypt +Comment: Set 3, vector 19 +Key: 13131313131313131313131313131313 +Plaintext: 13131313131313131313131313131313 +Ciphertext: 800996B5B363ACAB3FB8982F9BBE767F +Test: Encrypt +Comment: Set 3, vector 20 +Key: 14141414141414141414141414141414 +Plaintext: 14141414141414141414141414141414 +Ciphertext: C254C27642167B8FF363EAAD41A165A8 +Test: Encrypt +Comment: Set 3, vector 21 +Key: 15151515151515151515151515151515 +Plaintext: 15151515151515151515151515151515 +Ciphertext: 0B43A548CFFE916BAD7AB58B5F51B1E2 +Test: Encrypt +Comment: Set 3, vector 22 +Key: 16161616161616161616161616161616 +Plaintext: 16161616161616161616161616161616 +Ciphertext: 6C753853277756B8E0578FDC371A8738 +Test: Encrypt +Comment: Set 3, vector 23 +Key: 17171717171717171717171717171717 +Plaintext: 17171717171717171717171717171717 +Ciphertext: A278A500B02D8B2C7E829F1816872B1A +Test: Encrypt +Comment: Set 3, vector 24 +Key: 18181818181818181818181818181818 +Plaintext: 18181818181818181818181818181818 +Ciphertext: 67DD5353E13CDD51FC52716BC6BAB258 +Test: Encrypt +Comment: Set 3, vector 25 +Key: 19191919191919191919191919191919 +Plaintext: 19191919191919191919191919191919 +Ciphertext: 1B2DF65083662590F49719D7721D7C61 +Test: Encrypt +Comment: Set 3, vector 26 +Key: 1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A +Plaintext: 1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A +Ciphertext: B12E384030DE7B77866E758FB251CCFF +Test: Encrypt +Comment: Set 3, vector 27 +Key: 1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B +Plaintext: 1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B +Ciphertext: C37B3145C36FE5B95AC1392BEB81C9D8 +Test: Encrypt +Comment: Set 3, vector 28 +Key: 1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C +Plaintext: 1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C +Ciphertext: 5C25502EF79A5792DEE9359EDF7BA8BC +Test: Encrypt +Comment: Set 3, vector 29 +Key: 1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D +Plaintext: 1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D +Ciphertext: F0D899AEF42F226605E6A61A650F00A1 +Test: Encrypt +Comment: Set 3, vector 30 +Key: 1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E +Plaintext: 1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E +Ciphertext: 12096937A3474FE4D87C77581C09380B +Test: Encrypt +Comment: Set 3, vector 31 +Key: 1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F +Plaintext: 1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F +Ciphertext: CFC3A30819A45111983ABBF16CC61E9A +Test: Encrypt +Comment: Set 3, vector 32 +Key: 20202020202020202020202020202020 +Plaintext: 20202020202020202020202020202020 +Ciphertext: 7E724027BB2F591C63254D936FCC4B43 +Test: Encrypt +Comment: Set 3, vector 33 +Key: 21212121212121212121212121212121 +Plaintext: 21212121212121212121212121212121 +Ciphertext: FC9893DACCE806419957685270D5BF13 +Test: Encrypt +Comment: Set 3, vector 34 +Key: 22222222222222222222222222222222 +Plaintext: 22222222222222222222222222222222 +Ciphertext: F6C372A2AE2C03D7A9E0597DBEDFE961 +Test: Encrypt +Comment: Set 3, vector 35 +Key: 23232323232323232323232323232323 +Plaintext: 23232323232323232323232323232323 +Ciphertext: 4EE3CD585BD7A498DE93DDE42FDCBE73 +Test: Encrypt +Comment: Set 3, vector 36 +Key: 24242424242424242424242424242424 +Plaintext: 24242424242424242424242424242424 +Ciphertext: 71D0FFA714D70B5A3CDCE26BC91D93EE +Test: Encrypt +Comment: Set 3, vector 37 +Key: 25252525252525252525252525252525 +Plaintext: 25252525252525252525252525252525 +Ciphertext: 918EB6A7FA54EE795DE68EB5C0011BFD +Test: Encrypt +Comment: Set 3, vector 38 +Key: 26262626262626262626262626262626 +Plaintext: 26262626262626262626262626262626 +Ciphertext: 3A3DBFD37FB057816485BA948034E25E +Test: Encrypt +Comment: Set 3, vector 39 +Key: 27272727272727272727272727272727 +Plaintext: 27272727272727272727272727272727 +Ciphertext: 1FAD9F63890CF5475F3557B83924427C +Test: Encrypt +Comment: Set 3, vector 40 +Key: 28282828282828282828282828282828 +Plaintext: 28282828282828282828282828282828 +Ciphertext: 63F70DD87B9D63FC79628DECC6F34605 +Test: Encrypt +Comment: Set 3, vector 41 +Key: 29292929292929292929292929292929 +Plaintext: 29292929292929292929292929292929 +Ciphertext: D8FE7DF75B51024B69BDAB4844233CBB +Test: Encrypt +Comment: Set 3, vector 42 +Key: 2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A +Plaintext: 2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A +Ciphertext: D927B8DB454BEECFEE2F89ACD2D26F1A +Test: Encrypt +Comment: Set 3, vector 43 +Key: 2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B +Plaintext: 2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B +Ciphertext: 958B7CFABED67123D21541083FA90EB8 +Test: Encrypt +Comment: Set 3, vector 44 +Key: 2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C +Plaintext: 2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C +Ciphertext: 2F220AA3BB400736F3D0295E3C6D9052 +Test: Encrypt +Comment: Set 3, vector 45 +Key: 2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D +Plaintext: 2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D +Ciphertext: A14F57CE4D9EA4C5E282108DF8FDE00E +Test: Encrypt +Comment: Set 3, vector 46 +Key: 2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E +Plaintext: 2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E +Ciphertext: 23E437F93E0BE22B4C54BC187D70BCC1 +Test: Encrypt +Comment: Set 3, vector 47 +Key: 2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F +Plaintext: 2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F +Ciphertext: 615B6706E39E4A55EA8BFA4EFB8EBAEA +Test: Encrypt +Comment: Set 3, vector 48 +Key: 30303030303030303030303030303030 +Plaintext: 30303030303030303030303030303030 +Ciphertext: 5354CC9F7CAA08298C9A8AD471B39235 +Test: Encrypt +Comment: Set 3, vector 49 +Key: 31313131313131313131313131313131 +Plaintext: 31313131313131313131313131313131 +Ciphertext: DA2512B115E748580B7D198BFF01A537 +Test: Encrypt +Comment: Set 3, vector 50 +Key: 32323232323232323232323232323232 +Plaintext: 32323232323232323232323232323232 +Ciphertext: AEF890FCDEC04BFB0C4724558688810B +Test: Encrypt +Comment: Set 3, vector 51 +Key: 33333333333333333333333333333333 +Plaintext: 33333333333333333333333333333333 +Ciphertext: AEC153899584F8B9FC9836B86A40BA4A +Test: Encrypt +Comment: Set 3, vector 52 +Key: 34343434343434343434343434343434 +Plaintext: 34343434343434343434343434343434 +Ciphertext: E86D0DBEBD69030C0654656E0D348A8E +Test: Encrypt +Comment: Set 3, vector 53 +Key: 35353535353535353535353535353535 +Plaintext: 35353535353535353535353535353535 +Ciphertext: 3EFFEE758220F7138D31564D5CDA82EF +Test: Encrypt +Comment: Set 3, vector 54 +Key: 36363636363636363636363636363636 +Plaintext: 36363636363636363636363636363636 +Ciphertext: A0A57A825008700B246CEE9821803321 +Test: Encrypt +Comment: Set 3, vector 55 +Key: 37373737373737373737373737373737 +Plaintext: 37373737373737373737373737373737 +Ciphertext: 318692397CD421D958D142299AE24E5E +Test: Encrypt +Comment: Set 3, vector 56 +Key: 38383838383838383838383838383838 +Plaintext: 38383838383838383838383838383838 +Ciphertext: 1B949505033DB5554BBBBBB9488970DE +Test: Encrypt +Comment: Set 3, vector 57 +Key: 39393939393939393939393939393939 +Plaintext: 39393939393939393939393939393939 +Ciphertext: 20600DB3471001F93837F8EB50F7EB2B +Test: Encrypt +Comment: Set 3, vector 58 +Key: 3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A +Plaintext: 3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A +Ciphertext: 004C126190B7D20ADCA7331EA26AC487 +Test: Encrypt +Comment: Set 3, vector 59 +Key: 3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B +Plaintext: 3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B +Ciphertext: 7F535656FE3113A61D21BE216365D9FD +Test: Encrypt +Comment: Set 3, vector 60 +Key: 3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C +Plaintext: 3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C +Ciphertext: A7DA48E8AD71B1DC583A895A8CC85FF2 +Test: Encrypt +Comment: Set 3, vector 61 +Key: 3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D +Plaintext: 3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D +Ciphertext: 02E8CB85E9DDEDFAB4D9DB7106C6C38F +Test: Encrypt +Comment: Set 3, vector 62 +Key: 3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E +Plaintext: 3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E +Ciphertext: 44ACE8B20DF2DBA70C0287362D51ED5C +Test: Encrypt +Comment: Set 3, vector 63 +Key: 3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F +Plaintext: 3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F +Ciphertext: 8ABDD80D977FAF208FDFC69AA70E9810 +Test: Encrypt +Comment: Set 3, vector 64 +Key: 40404040404040404040404040404040 +Plaintext: 40404040404040404040404040404040 +Ciphertext: 538ADCBE104A3483B3C2A3D8CE72FBD6 +Test: Encrypt +Comment: Set 3, vector 65 +Key: 41414141414141414141414141414141 +Plaintext: 41414141414141414141414141414141 +Ciphertext: 7F757894F1A04645BCB523E925A937C7 +Test: Encrypt +Comment: Set 3, vector 66 +Key: 42424242424242424242424242424242 +Plaintext: 42424242424242424242424242424242 +Ciphertext: FA4304C7D16E164E000461B2550207B1 +Test: Encrypt +Comment: Set 3, vector 67 +Key: 43434343434343434343434343434343 +Plaintext: 43434343434343434343434343434343 +Ciphertext: 5B8E43BF0CACBCB80933B4061F9702B2 +Test: Encrypt +Comment: Set 3, vector 68 +Key: 44444444444444444444444444444444 +Plaintext: 44444444444444444444444444444444 +Ciphertext: 4DB11630D8CD9390797EE30EE9A25CB3 +Test: Encrypt +Comment: Set 3, vector 69 +Key: 45454545454545454545454545454545 +Plaintext: 45454545454545454545454545454545 +Ciphertext: 61150375D22621E9DD7AB45227E4ADC1 +Test: Encrypt +Comment: Set 3, vector 70 +Key: 46464646464646464646464646464646 +Plaintext: 46464646464646464646464646464646 +Ciphertext: 825AA0A2275496EA00BE2C75982EC24E +Test: Encrypt +Comment: Set 3, vector 71 +Key: 47474747474747474747474747474747 +Plaintext: 47474747474747474747474747474747 +Ciphertext: 1EA3F70E26F079CE37801787B5F3655C +Test: Encrypt +Comment: Set 3, vector 72 +Key: 48484848484848484848484848484848 +Plaintext: 48484848484848484848484848484848 +Ciphertext: F46E712267A6CA8DA8AC044A4E3ADC69 +Test: Encrypt +Comment: Set 3, vector 73 +Key: 49494949494949494949494949494949 +Plaintext: 49494949494949494949494949494949 +Ciphertext: 00FCF96BD11DB90E045B948C2658FC07 +Test: Encrypt +Comment: Set 3, vector 74 +Key: 4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A +Plaintext: 4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A +Ciphertext: 08E264CCDA07442DD6FB5BC8AF05A9C1 +Test: Encrypt +Comment: Set 3, vector 75 +Key: 4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B +Plaintext: 4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B +Ciphertext: 35C189E86440D125B0CAF6C62CA0E4F9 +Test: Encrypt +Comment: Set 3, vector 76 +Key: 4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C +Plaintext: 4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C +Ciphertext: 7FC2F545C0DE78664218F4F635CC8D10 +Test: Encrypt +Comment: Set 3, vector 77 +Key: 4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D +Plaintext: 4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D +Ciphertext: 9DC067581AD80555C6E46C6594A626F5 +Test: Encrypt +Comment: Set 3, vector 78 +Key: 4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E +Plaintext: 4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E +Ciphertext: D33A3E8035B42D76A483BE06B62054A6 +Test: Encrypt +Comment: Set 3, vector 79 +Key: 4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F +Plaintext: 4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F +Ciphertext: 7CA26FD5D6DB7EAA785FCCA1E2854910 +Test: Encrypt +Comment: Set 3, vector 80 +Key: 50505050505050505050505050505050 +Plaintext: 50505050505050505050505050505050 +Ciphertext: E9A672BD5401539C1C8F2AB21A83B26B +Test: Encrypt +Comment: Set 3, vector 81 +Key: 51515151515151515151515151515151 +Plaintext: 51515151515151515151515151515151 +Ciphertext: 2948CB8989780E74BA525CC2FDDC42CF +Test: Encrypt +Comment: Set 3, vector 82 +Key: 52525252525252525252525252525252 +Plaintext: 52525252525252525252525252525252 +Ciphertext: A3A8308145C318D42F4E8310DF6D97E0 +Test: Encrypt +Comment: Set 3, vector 83 +Key: 53535353535353535353535353535353 +Plaintext: 53535353535353535353535353535353 +Ciphertext: 1757125D19851062D7782A2200A813E9 +Test: Encrypt +Comment: Set 3, vector 84 +Key: 54545454545454545454545454545454 +Plaintext: 54545454545454545454545454545454 +Ciphertext: 9BC4FC94FF7A09F9D4C23A3BDEAF498E +Test: Encrypt +Comment: Set 3, vector 85 +Key: 55555555555555555555555555555555 +Plaintext: 55555555555555555555555555555555 +Ciphertext: B36C8A8DC251A4D08B38160011498AB2 +Test: Encrypt +Comment: Set 3, vector 86 +Key: 56565656565656565656565656565656 +Plaintext: 56565656565656565656565656565656 +Ciphertext: 6C6058C8D5F2A32E31988239C4A657F1 +Test: Encrypt +Comment: Set 3, vector 87 +Key: 57575757575757575757575757575757 +Plaintext: 57575757575757575757575757575757 +Ciphertext: B8B914785FD465FB0F83FE4A676C3A6B +Test: Encrypt +Comment: Set 3, vector 88 +Key: 58585858585858585858585858585858 +Plaintext: 58585858585858585858585858585858 +Ciphertext: 00BBEEC24412F8A2C4291B5F1F32E662 +Test: Encrypt +Comment: Set 3, vector 89 +Key: 59595959595959595959595959595959 +Plaintext: 59595959595959595959595959595959 +Ciphertext: AF8353C84504526068884176D45CC8A0 +Test: Encrypt +Comment: Set 3, vector 90 +Key: 5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A +Plaintext: 5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A +Ciphertext: F84DF1519736174F6F23B4CC3FC939F1 +Test: Encrypt +Comment: Set 3, vector 91 +Key: 5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B +Plaintext: 5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B +Ciphertext: 320326E1024C9156B0E4C483065F0D94 +Test: Encrypt +Comment: Set 3, vector 92 +Key: 5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C +Plaintext: 5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C +Ciphertext: 80AFE13AEC30894E8B772E73F367A148 +Test: Encrypt +Comment: Set 3, vector 93 +Key: 5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D +Plaintext: 5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D +Ciphertext: 5F0D8BE9294D27DB7E6CD4D4F8A08D48 +Test: Encrypt +Comment: Set 3, vector 94 +Key: 5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E +Plaintext: 5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E +Ciphertext: B6D8E7EF37171F6271AC274411E26867 +Test: Encrypt +Comment: Set 3, vector 95 +Key: 5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F +Plaintext: 5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F +Ciphertext: 23DEBDDF60703AE0F8E9337C73C6FDC3 +Test: Encrypt +Comment: Set 3, vector 96 +Key: 60606060606060606060606060606060 +Plaintext: 60606060606060606060606060606060 +Ciphertext: D03B4696B0DCC56C37F7038747BEF222 +Test: Encrypt +Comment: Set 3, vector 97 +Key: 61616161616161616161616161616161 +Plaintext: 61616161616161616161616161616161 +Ciphertext: 201E6A1FA7898892DA1D3148766F7939 +Test: Encrypt +Comment: Set 3, vector 98 +Key: 62626262626262626262626262626262 +Plaintext: 62626262626262626262626262626262 +Ciphertext: D9643DBC3C373D300DB5AC3E699F7DDE +Test: Encrypt +Comment: Set 3, vector 99 +Key: 63636363636363636363636363636363 +Plaintext: 63636363636363636363636363636363 +Ciphertext: 1B04DAF08A764C09DFFE140403F4EC5D +Test: Encrypt +Comment: Set 3, vector 100 +Key: 64646464646464646464646464646464 +Plaintext: 64646464646464646464646464646464 +Ciphertext: 0510AA045E35862885AEEB1752328032 +Test: Encrypt +Comment: Set 3, vector 101 +Key: 65656565656565656565656565656565 +Plaintext: 65656565656565656565656565656565 +Ciphertext: 894E5FE4164A0B9CC2C50D95F18329E6 +Test: Encrypt +Comment: Set 3, vector 102 +Key: 66666666666666666666666666666666 +Plaintext: 66666666666666666666666666666666 +Ciphertext: 99D16D251893E474CD8A18C10798D418 +Test: Encrypt +Comment: Set 3, vector 103 +Key: 67676767676767676767676767676767 +Plaintext: 67676767676767676767676767676767 +Ciphertext: B41A0DEEA15FCB419E00318752503FA8 +Test: Encrypt +Comment: Set 3, vector 104 +Key: 68686868686868686868686868686868 +Plaintext: 68686868686868686868686868686868 +Ciphertext: 8BDDFBD29844F3EED1E02FB76628E877 +Test: Encrypt +Comment: Set 3, vector 105 +Key: 69696969696969696969696969696969 +Plaintext: 69696969696969696969696969696969 +Ciphertext: E71C41B95412E2ED6BC6B5693BC445E5 +Test: Encrypt +Comment: Set 3, vector 106 +Key: 6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A +Plaintext: 6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A +Ciphertext: 566E5667E9BDDCE13F3B6DE0DEF06305 +Test: Encrypt +Comment: Set 3, vector 107 +Key: 6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B +Plaintext: 6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B +Ciphertext: 49372FDCE8DC81E45A9E6FBFB8952F76 +Test: Encrypt +Comment: Set 3, vector 108 +Key: 6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C +Plaintext: 6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C +Ciphertext: 034EAB9E0E881ABF0C4F9B7933E7F1B2 +Test: Encrypt +Comment: Set 3, vector 109 +Key: 6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D +Plaintext: 6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D +Ciphertext: 56FFE171E45816C5808380530F3F9F23 +Test: Encrypt +Comment: Set 3, vector 110 +Key: 6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E +Plaintext: 6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E +Ciphertext: 5FE59EE65A0321F3B09A1748CF18CC02 +Test: Encrypt +Comment: Set 3, vector 111 +Key: 6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F +Plaintext: 6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F +Ciphertext: 8C13790203280B652614D224178C4289 +Test: Encrypt +Comment: Set 3, vector 112 +Key: 70707070707070707070707070707070 +Plaintext: 70707070707070707070707070707070 +Ciphertext: 52D7C5111B52E5356C8EF2B629BA6166 +Test: Encrypt +Comment: Set 3, vector 113 +Key: 71717171717171717171717171717171 +Plaintext: 71717171717171717171717171717171 +Ciphertext: 4FB997235548FB5C202A1514FF408068 +Test: Encrypt +Comment: Set 3, vector 114 +Key: 72727272727272727272727272727272 +Plaintext: 72727272727272727272727272727272 +Ciphertext: 8DDE9345FEDAB8D8D2DE5E2577756F16 +Test: Encrypt +Comment: Set 3, vector 115 +Key: 73737373737373737373737373737373 +Plaintext: 73737373737373737373737373737373 +Ciphertext: C1B39136F69B2044C30E38023EB6E7D2 +Test: Encrypt +Comment: Set 3, vector 116 +Key: 74747474747474747474747474747474 +Plaintext: 74747474747474747474747474747474 +Ciphertext: 6032D1B3844BEA4ACE81142A013C42BC +Test: Encrypt +Comment: Set 3, vector 117 +Key: 75757575757575757575757575757575 +Plaintext: 75757575757575757575757575757575 +Ciphertext: 985A9D8DDE048107368028AA24F5D70B +Test: Encrypt +Comment: Set 3, vector 118 +Key: 76767676767676767676767676767676 +Plaintext: 76767676767676767676767676767676 +Ciphertext: 5343E03D587A538475BB92F23E96FDF8 +Test: Encrypt +Comment: Set 3, vector 119 +Key: 77777777777777777777777777777777 +Plaintext: 77777777777777777777777777777777 +Ciphertext: 98253AF78B8DA7E5AE98E7B4E9FA74F9 +Test: Encrypt +Comment: Set 3, vector 120 +Key: 78787878787878787878787878787878 +Plaintext: 78787878787878787878787878787878 +Ciphertext: 8404DDA01CC702790B8B31408205E128 +Test: Encrypt +Comment: Set 3, vector 121 +Key: 79797979797979797979797979797979 +Plaintext: 79797979797979797979797979797979 +Ciphertext: C782C96911F30723AB90E3A0BA59B808 +Test: Encrypt +Comment: Set 3, vector 122 +Key: 7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A +Plaintext: 7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A +Ciphertext: 471270191B1BB659804CEAE818793167 +Test: Encrypt +Comment: Set 3, vector 123 +Key: 7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B +Plaintext: 7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B +Ciphertext: 2B27BBF7E47DA05F72EED52D038A3241 +Test: Encrypt +Comment: Set 3, vector 124 +Key: 7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C +Plaintext: 7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C +Ciphertext: 0BD3B3F3F6F404B6B7C6D436605640B7 +Test: Encrypt +Comment: Set 3, vector 125 +Key: 7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D +Plaintext: 7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D +Ciphertext: 74578268B9D9AD5D9819E51CA288F81D +Test: Encrypt +Comment: Set 3, vector 126 +Key: 7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E +Plaintext: 7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E +Ciphertext: A77A67CC08111CE41B817176859675B5 +Test: Encrypt +Comment: Set 3, vector 127 +Key: 7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F +Plaintext: 7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F +Ciphertext: 9BE99EFDAF9CCCB4D879173EA2197FEF +Test: Encrypt +Comment: Set 3, vector 128 +Key: 80808080808080808080808080808080 +Plaintext: 80808080808080808080808080808080 +Ciphertext: AA7627F70F6B54C217C3EF232D362459 +Test: Encrypt +Comment: Set 3, vector 129 +Key: 81818181818181818181818181818181 +Plaintext: 81818181818181818181818181818181 +Ciphertext: EE41F8DC661C2A8B95667CB1F908367A +Test: Encrypt +Comment: Set 3, vector 130 +Key: 82828282828282828282828282828282 +Plaintext: 82828282828282828282828282828282 +Ciphertext: AF2D71AC4D7E482E8134A65F2841101A +Test: Encrypt +Comment: Set 3, vector 131 +Key: 83838383838383838383838383838383 +Plaintext: 83838383838383838383838383838383 +Ciphertext: 98CFCAA37D3B1825C55FA94825BBC91A +Test: Encrypt +Comment: Set 3, vector 132 +Key: 84848484848484848484848484848484 +Plaintext: 84848484848484848484848484848484 +Ciphertext: 2ACFCBC772417EBD445F8B272857578C +Test: Encrypt +Comment: Set 3, vector 133 +Key: 85858585858585858585858585858585 +Plaintext: 85858585858585858585858585858585 +Ciphertext: 424DE49A69767A539E26581A19CD4F17 +Test: Encrypt +Comment: Set 3, vector 134 +Key: 86868686868686868686868686868686 +Plaintext: 86868686868686868686868686868686 +Ciphertext: F25ED7239B234E58AE40F7612E3CE6BA +Test: Encrypt +Comment: Set 3, vector 135 +Key: 87878787878787878787878787878787 +Plaintext: 87878787878787878787878787878787 +Ciphertext: 4BF44DBA1E6E80DE3554F7EEF0621EBF +Test: Encrypt +Comment: Set 3, vector 136 +Key: 88888888888888888888888888888888 +Plaintext: 88888888888888888888888888888888 +Ciphertext: 6B87409975816BC8480985D079B08594 +Test: Encrypt +Comment: Set 3, vector 137 +Key: 89898989898989898989898989898989 +Plaintext: 89898989898989898989898989898989 +Ciphertext: D026A866DD55C02EE77DF1E93405A751 +Test: Encrypt +Comment: Set 3, vector 138 +Key: 8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A +Plaintext: 8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A +Ciphertext: A45F7212DD04352DEF319D58922C44CE +Test: Encrypt +Comment: Set 3, vector 139 +Key: 8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B +Plaintext: 8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B +Ciphertext: 4600AD219EE97A7BFF629D8F6E337C79 +Test: Encrypt +Comment: Set 3, vector 140 +Key: 8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C +Plaintext: 8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C +Ciphertext: A26CEFEC7612A89E8543503A678D921F +Test: Encrypt +Comment: Set 3, vector 141 +Key: 8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D +Plaintext: 8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D +Ciphertext: 5CA126B9342723816C82AC1D41F97EFB +Test: Encrypt +Comment: Set 3, vector 142 +Key: 8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E +Plaintext: 8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E +Ciphertext: 76DC82C091F5691C35E8735EB901B788 +Test: Encrypt +Comment: Set 3, vector 143 +Key: 8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F +Plaintext: 8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F +Ciphertext: 2F8AA5E8D7D90B3E7FCC20128F462AAD +Test: Encrypt +Comment: Set 3, vector 144 +Key: 90909090909090909090909090909090 +Plaintext: 90909090909090909090909090909090 +Ciphertext: 67B8B189FCD886FD2160005C93D9F3B2 +Test: Encrypt +Comment: Set 3, vector 145 +Key: 91919191919191919191919191919191 +Plaintext: 91919191919191919191919191919191 +Ciphertext: 8DFBD0B7D8B614E15B56571A6A5B443D +Test: Encrypt +Comment: Set 3, vector 146 +Key: 92929292929292929292929292929292 +Plaintext: 92929292929292929292929292929292 +Ciphertext: F10DA9ABD28359461A3BB271C2037D1A +Test: Encrypt +Comment: Set 3, vector 147 +Key: 93939393939393939393939393939393 +Plaintext: 93939393939393939393939393939393 +Ciphertext: 5A53C6ADF38E807BC03CC53193133CDE +Test: Encrypt +Comment: Set 3, vector 148 +Key: 94949494949494949494949494949494 +Plaintext: 94949494949494949494949494949494 +Ciphertext: 298AF9909A89241F34DB6BF6ACC6A909 +Test: Encrypt +Comment: Set 3, vector 149 +Key: 95959595959595959595959595959595 +Plaintext: 95959595959595959595959595959595 +Ciphertext: DAA5C134BDD34A775DEC219F6DE219BE +Test: Encrypt +Comment: Set 3, vector 150 +Key: 96969696969696969696969696969696 +Plaintext: 96969696969696969696969696969696 +Ciphertext: 2514903F8ABA0F65CA22C8AD82FF2574 +Test: Encrypt +Comment: Set 3, vector 151 +Key: 97979797979797979797979797979797 +Plaintext: 97979797979797979797979797979797 +Ciphertext: 11696CB06D2F97B1A2CB380E2887AB7E +Test: Encrypt +Comment: Set 3, vector 152 +Key: 98989898989898989898989898989898 +Plaintext: 98989898989898989898989898989898 +Ciphertext: E70BAE913D953A66AC35DE9CAA6D205D +Test: Encrypt +Comment: Set 3, vector 153 +Key: 99999999999999999999999999999999 +Plaintext: 99999999999999999999999999999999 +Ciphertext: 20BC3C8F4E81EEA320189E6063017706 +Test: Encrypt +Comment: Set 3, vector 154 +Key: 9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A +Plaintext: 9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A +Ciphertext: 53A956A32B4B532F5E9BE8C94278EC57 +Test: Encrypt +Comment: Set 3, vector 155 +Key: 9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B +Plaintext: 9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B +Ciphertext: 2562236E541426B29A4232E592237CAD +Test: Encrypt +Comment: Set 3, vector 156 +Key: 9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C +Plaintext: 9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C +Ciphertext: 0F8A9DEDA85B0A1CF7487C6ED823B869 +Test: Encrypt +Comment: Set 3, vector 157 +Key: 9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D +Plaintext: 9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D +Ciphertext: 8917CF4F1A25A500440CF0665BB517A0 +Test: Encrypt +Comment: Set 3, vector 158 +Key: 9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E +Plaintext: 9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E +Ciphertext: F5C065F3821FA664724BF6AFF1039430 +Test: Encrypt +Comment: Set 3, vector 159 +Key: 9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F +Plaintext: 9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F +Ciphertext: F5D5131F0D2F4859EC38F8999A93E74D +Test: Encrypt +Comment: Set 3, vector 160 +Key: A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0 +Plaintext: A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0 +Ciphertext: 9A02DF44F2194E94B7E34F1DCC234685 +Test: Encrypt +Comment: Set 3, vector 161 +Key: A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1 +Plaintext: A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1 +Ciphertext: 59491E467432E6147EAFE37BCD93DA01 +Test: Encrypt +Comment: Set 3, vector 162 +Key: A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2 +Plaintext: A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2 +Ciphertext: 4D0B317CE4AE577CF87B225C53DDF352 +Test: Encrypt +Comment: Set 3, vector 163 +Key: A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3 +Plaintext: A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3 +Ciphertext: 73E082DC996995BDDD1F5544326D56D6 +Test: Encrypt +Comment: Set 3, vector 164 +Key: A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4 +Plaintext: A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4 +Ciphertext: 46C5C6E23A72C9DF410EF979F93CF266 +Test: Encrypt +Comment: Set 3, vector 165 +Key: A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5 +Plaintext: A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5 +Ciphertext: 1F55093C234648C5C9C781E8C9FD42C4 +Test: Encrypt +Comment: Set 3, vector 166 +Key: A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6 +Plaintext: A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6 +Ciphertext: BFA2702CF3DAE25705D1DE1CCDBDC49E +Test: Encrypt +Comment: Set 3, vector 167 +Key: A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7 +Plaintext: A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7 +Ciphertext: 3223365425C1ADE87FF766AB048D9ADB +Test: Encrypt +Comment: Set 3, vector 168 +Key: A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8 +Plaintext: A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8 +Ciphertext: 5449889254C565DF3ADDFB7A86A93DA9 +Test: Encrypt +Comment: Set 3, vector 169 +Key: A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9 +Plaintext: A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9 +Ciphertext: 7D21880CCA919B0CE3917A8C598025FA +Test: Encrypt +Comment: Set 3, vector 170 +Key: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +Plaintext: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +Ciphertext: 5EE203A6739E822A54D9678B604EFD4F +Test: Encrypt +Comment: Set 3, vector 171 +Key: ABABABABABABABABABABABABABABABAB +Plaintext: ABABABABABABABABABABABABABABABAB +Ciphertext: 07038EFBEFDE2228F79A6B526306483A +Test: Encrypt +Comment: Set 3, vector 172 +Key: ACACACACACACACACACACACACACACACAC +Plaintext: ACACACACACACACACACACACACACACACAC +Ciphertext: 78447EBF959FFBD120283CE319FF6005 +Test: Encrypt +Comment: Set 3, vector 173 +Key: ADADADADADADADADADADADADADADADAD +Plaintext: ADADADADADADADADADADADADADADADAD +Ciphertext: 76769D40A286F0FD1C1C6F8895000DE8 +Test: Encrypt +Comment: Set 3, vector 174 +Key: AEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAE +Plaintext: AEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAE +Ciphertext: 7E163343CA44FADFAFDE5386CC111437 +Test: Encrypt +Comment: Set 3, vector 175 +Key: AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF +Plaintext: AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF +Ciphertext: 4B1E7FE684222BF783142B5DC396F61D +Test: Encrypt +Comment: Set 3, vector 176 +Key: B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0 +Plaintext: B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0 +Ciphertext: 4ECF97472658AC941EC99B255CF95535 +Test: Encrypt +Comment: Set 3, vector 177 +Key: B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 +Plaintext: B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 +Ciphertext: 23EE9DF24C8DC126A04586EFF27DBEAC +Test: Encrypt +Comment: Set 3, vector 178 +Key: B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 +Plaintext: B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 +Ciphertext: 4B06EE28B7769C4318D509F91D691F39 +Test: Encrypt +Comment: Set 3, vector 179 +Key: B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3 +Plaintext: B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3 +Ciphertext: 51994EF8283D1D29711F602A7ACDA3CA +Test: Encrypt +Comment: Set 3, vector 180 +Key: B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4 +Plaintext: B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4 +Ciphertext: DCBFBE6BE3234BBB61EA68218C89D098 +Test: Encrypt +Comment: Set 3, vector 181 +Key: B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5 +Plaintext: B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5 +Ciphertext: B84BFA0883546D912BD14807253F8892 +Test: Encrypt +Comment: Set 3, vector 182 +Key: B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6 +Plaintext: B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6 +Ciphertext: 90C1745C0DB97E70BA362CF2C1D376DF +Test: Encrypt +Comment: Set 3, vector 183 +Key: B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7 +Plaintext: B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7 +Ciphertext: 064743C2E8293C1B7619F6E6DEC13B04 +Test: Encrypt +Comment: Set 3, vector 184 +Key: B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8 +Plaintext: B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8 +Ciphertext: 38D913C68ABEE287368CBA38D8FE9F0D +Test: Encrypt +Comment: Set 3, vector 185 +Key: B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9 +Plaintext: B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9 +Ciphertext: B2279D520B33258B7DB221ECDD3C4EBB +Test: Encrypt +Comment: Set 3, vector 186 +Key: BABABABABABABABABABABABABABABABA +Plaintext: BABABABABABABABABABABABABABABABA +Ciphertext: 8AD710DDAE51BE6D4BE7ABC5443B7F9B +Test: Encrypt +Comment: Set 3, vector 187 +Key: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +Plaintext: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +Ciphertext: 246BA7624BBF83702764CC1B214A0691 +Test: Encrypt +Comment: Set 3, vector 188 +Key: BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC +Plaintext: BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC +Ciphertext: 80E0360B03FA048A892CD47BD7FE948A +Test: Encrypt +Comment: Set 3, vector 189 +Key: BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD +Plaintext: BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD +Ciphertext: 09D5D35BB6DBAE0CC9982D6955EAA01C +Test: Encrypt +Comment: Set 3, vector 190 +Key: BEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBE +Plaintext: BEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBE +Ciphertext: EEBDCE2BDE1F25A40184B9C57DD4E49D +Test: Encrypt +Comment: Set 3, vector 191 +Key: BFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBF +Plaintext: BFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBF +Ciphertext: 22706CFCCD2B0BB15ED30E373FA4E945 +Test: Encrypt +Comment: Set 3, vector 192 +Key: C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +Plaintext: C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +Ciphertext: D2A4EEACB5F41D12908DD1E069EC14DC +Test: Encrypt +Comment: Set 3, vector 193 +Key: C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1 +Plaintext: C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1 +Ciphertext: E78F614BC7F53C9298098DFEE8ADFB09 +Test: Encrypt +Comment: Set 3, vector 194 +Key: C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2 +Plaintext: C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2 +Ciphertext: B53E3865A8B28A36EF3A505102A6329D +Test: Encrypt +Comment: Set 3, vector 195 +Key: C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3 +Plaintext: C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3 +Ciphertext: 9B32AA8673DFFC47CF8C9B35DDE08DD3 +Test: Encrypt +Comment: Set 3, vector 196 +Key: C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4 +Plaintext: C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4 +Ciphertext: CE70E7257E6C8686C7407E22ACB3E94B +Test: Encrypt +Comment: Set 3, vector 197 +Key: C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5 +Plaintext: C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5 +Ciphertext: 677DB939CA272D717DB4B03EFB70F988 +Test: Encrypt +Comment: Set 3, vector 198 +Key: C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6 +Plaintext: C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6 +Ciphertext: 6582B069058FA86898A3B12B617C27FD +Test: Encrypt +Comment: Set 3, vector 199 +Key: C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7 +Plaintext: C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7 +Ciphertext: 4DFB68486ECF9833FCE74BD663E20768 +Test: Encrypt +Comment: Set 3, vector 200 +Key: C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8 +Plaintext: C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8 +Ciphertext: 6A3840D2780BABD68A73FAC89C4E8D91 +Test: Encrypt +Comment: Set 3, vector 201 +Key: C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9 +Plaintext: C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9 +Ciphertext: 44C79926D7EAB9DE5A2B95472A79A7BC +Test: Encrypt +Comment: Set 3, vector 202 +Key: CACACACACACACACACACACACACACACACA +Plaintext: CACACACACACACACACACACACACACACACA +Ciphertext: 3813E774EE9EFA8FDB2646E607B2A434 +Test: Encrypt +Comment: Set 3, vector 203 +Key: CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB +Plaintext: CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB +Ciphertext: FCA748E6AE5678A047E806F8FF103A65 +Test: Encrypt +Comment: Set 3, vector 204 +Key: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +Plaintext: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +Ciphertext: 3E3CC9CBE6952AB968FBBEE0C08BF667 +Test: Encrypt +Comment: Set 3, vector 205 +Key: CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD +Plaintext: CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD +Ciphertext: 4FFF3EDC7BCB70E7846DCC4688F9CB3A +Test: Encrypt +Comment: Set 3, vector 206 +Key: CECECECECECECECECECECECECECECECE +Plaintext: CECECECECECECECECECECECECECECECE +Ciphertext: 5728481E82E0DC1631EC611F63B9DD3C +Test: Encrypt +Comment: Set 3, vector 207 +Key: CFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCF +Plaintext: CFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCF +Ciphertext: 182BB0D3C52E56248FDA1D343844891D +Test: Encrypt +Comment: Set 3, vector 208 +Key: D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0 +Plaintext: D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0 +Ciphertext: 6B984FC45D0352F3336E7895ECB6DE0E +Test: Encrypt +Comment: Set 3, vector 209 +Key: D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1 +Plaintext: D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1 +Ciphertext: 8DD24A1B23D845E7A6C6D416C7C5B595 +Test: Encrypt +Comment: Set 3, vector 210 +Key: D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2 +Plaintext: D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2 +Ciphertext: 4F4D69B4563373962007945C3197806C +Test: Encrypt +Comment: Set 3, vector 211 +Key: D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3 +Plaintext: D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3 +Ciphertext: DD333390213EB632A51EAE0334A5AEA2 +Test: Encrypt +Comment: Set 3, vector 212 +Key: D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4 +Plaintext: D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4 +Ciphertext: D352ACE83BF6A3BC39EA10D751853009 +Test: Encrypt +Comment: Set 3, vector 213 +Key: D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5 +Plaintext: D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5 +Ciphertext: F2E118276BFCCF6DCDD47E1EAB919BDC +Test: Encrypt +Comment: Set 3, vector 214 +Key: D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6 +Plaintext: D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6 +Ciphertext: 688E877D8B69050F2736D0768571E9A0 +Test: Encrypt +Comment: Set 3, vector 215 +Key: D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7 +Plaintext: D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7 +Ciphertext: DE6F098E56985B7DCFEC52C897F2E735 +Test: Encrypt +Comment: Set 3, vector 216 +Key: D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8 +Plaintext: D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8 +Ciphertext: 398FA1FE47E3971DA3F9DFD479C9B1AA +Test: Encrypt +Comment: Set 3, vector 217 +Key: D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9 +Plaintext: D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9 +Ciphertext: 6F17B7D7C899B48DAEAD1E90F22AB180 +Test: Encrypt +Comment: Set 3, vector 218 +Key: DADADADADADADADADADADADADADADADA +Plaintext: DADADADADADADADADADADADADADADADA +Ciphertext: D39EBBA5B742F15FCB75D6E656BBF2DA +Test: Encrypt +Comment: Set 3, vector 219 +Key: DBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDB +Plaintext: DBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDB +Ciphertext: 1C6D82247D0BAB18B52CA5293A2C1050 +Test: Encrypt +Comment: Set 3, vector 220 +Key: DCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDC +Plaintext: DCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDC +Ciphertext: B54F248DF57060E40A6A2FA4688C7082 +Test: Encrypt +Comment: Set 3, vector 221 +Key: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +Plaintext: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +Ciphertext: 1BB5EB8732CBAB2E3FC334FAAB8BBFBC +Test: Encrypt +Comment: Set 3, vector 222 +Key: DEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDE +Plaintext: DEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDE +Ciphertext: 3734B4B21B50C4740B90FD863EF8627B +Test: Encrypt +Comment: Set 3, vector 223 +Key: DFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDF +Plaintext: DFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDF +Ciphertext: E22E22E60F981D64B7CB341F12F2B362 +Test: Encrypt +Comment: Set 3, vector 224 +Key: E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0 +Plaintext: E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0 +Ciphertext: A2A40EB448D87E39B20460E8CB07515A +Test: Encrypt +Comment: Set 3, vector 225 +Key: E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1 +Plaintext: E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1 +Ciphertext: 88E6AC929D4D7858015B35D509882C5C +Test: Encrypt +Comment: Set 3, vector 226 +Key: E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2 +Plaintext: E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2 +Ciphertext: FFE4B3B5D0E8229F5428FA2945DBD5EE +Test: Encrypt +Comment: Set 3, vector 227 +Key: E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3 +Plaintext: E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3 +Ciphertext: FCD5F897398A7796A0DAA1809CA7D870 +Test: Encrypt +Comment: Set 3, vector 228 +Key: E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4 +Plaintext: E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4 +Ciphertext: 7F3556B18EC8F04D953DCD27549AF1FC +Test: Encrypt +Comment: Set 3, vector 229 +Key: E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5 +Plaintext: E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5 +Ciphertext: 4433546A8E63AE841CD78B074ED0B91F +Test: Encrypt +Comment: Set 3, vector 230 +Key: E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6 +Plaintext: E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6 +Ciphertext: 2E04671C718BD6C3D115DB2D827A6669 +Test: Encrypt +Comment: Set 3, vector 231 +Key: E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7 +Plaintext: E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7 +Ciphertext: AAE7DA4B977F5EED28F9AF01F8FD47B4 +Test: Encrypt +Comment: Set 3, vector 232 +Key: E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8 +Plaintext: E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8 +Ciphertext: 84AD8F52D51BD3D8E4D8318AF6DB9786 +Test: Encrypt +Comment: Set 3, vector 233 +Key: E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9 +Plaintext: E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9 +Ciphertext: 95EFA65090BD603A1F65A21A43104F79 +Test: Encrypt +Comment: Set 3, vector 234 +Key: EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA +Plaintext: EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA +Ciphertext: 1B83F51E157BBA004CC5BD05986017C8 +Test: Encrypt +Comment: Set 3, vector 235 +Key: EBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB +Plaintext: EBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB +Ciphertext: A0C37A641126D5801C4259DFD38E8E8A +Test: Encrypt +Comment: Set 3, vector 236 +Key: ECECECECECECECECECECECECECECECEC +Plaintext: ECECECECECECECECECECECECECECECEC +Ciphertext: 3153A212C2E4727C1032223134342B31 +Test: Encrypt +Comment: Set 3, vector 237 +Key: EDEDEDEDEDEDEDEDEDEDEDEDEDEDEDED +Plaintext: EDEDEDEDEDEDEDEDEDEDEDEDEDEDEDED +Ciphertext: C680D98CAF4409CF31BABCF67352E1D5 +Test: Encrypt +Comment: Set 3, vector 238 +Key: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +Plaintext: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +Ciphertext: A7FC85C8459274B836B6F0CBED80AF49 +Test: Encrypt +Comment: Set 3, vector 239 +Key: EFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEF +Plaintext: EFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEF +Ciphertext: 5CA8B8A4B8AF15A6184259831B18BBB5 +Test: Encrypt +Comment: Set 3, vector 240 +Key: F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 +Plaintext: F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 +Ciphertext: F118089963B9AB37776B10B0D4CCEBA4 +Test: Encrypt +Comment: Set 3, vector 241 +Key: F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1 +Plaintext: F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1 +Ciphertext: C233B864E78E9EC272112A34FF7AADBA +Test: Encrypt +Comment: Set 3, vector 242 +Key: F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2 +Plaintext: F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2 +Ciphertext: 2B1C503E7F755A47CC4C57BEB4135B46 +Test: Encrypt +Comment: Set 3, vector 243 +Key: F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3 +Plaintext: F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3 +Ciphertext: 60D8177BE1044FC5F46DA2B3CAA33102 +Test: Encrypt +Comment: Set 3, vector 244 +Key: F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4 +Plaintext: F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4 +Ciphertext: BA1CBC06977ECE57C5CBC12D99324E00 +Test: Encrypt +Comment: Set 3, vector 245 +Key: F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5 +Plaintext: F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5 +Ciphertext: 01C8561E24A32F53FBAF8864AEE803E3 +Test: Encrypt +Comment: Set 3, vector 246 +Key: F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6 +Plaintext: F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6 +Ciphertext: 797ECFA429014F26B9E62D58B4C1B84E +Test: Encrypt +Comment: Set 3, vector 247 +Key: F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7 +Plaintext: F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7 +Ciphertext: 6AD7FA698A7F3EA8AE13B1DF537BF6EA +Test: Encrypt +Comment: Set 3, vector 248 +Key: F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8 +Plaintext: F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8 +Ciphertext: 49157343BE8B8ED4E59C1AEC3CAB1B94 +Test: Encrypt +Comment: Set 3, vector 249 +Key: F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9 +Plaintext: F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9 +Ciphertext: D33C742DEA4A2C64983766E3068EC200 +Test: Encrypt +Comment: Set 3, vector 250 +Key: FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA +Plaintext: FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA +Ciphertext: 66AE1EAFB45091982E40000BADE002C9 +Test: Encrypt +Comment: Set 3, vector 251 +Key: FBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFB +Plaintext: FBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFB +Ciphertext: B6614B0FF5924D0C1EB2C461560BFC01 +Test: Encrypt +Comment: Set 3, vector 252 +Key: FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC +Plaintext: FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC +Ciphertext: 5B4DFBE2BB7666425A858C4769D8DAD0 +Test: Encrypt +Comment: Set 3, vector 253 +Key: FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFD +Plaintext: FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFD +Ciphertext: 2F142B9044DEC39915ED9347E7B0ED1E +Test: Encrypt +Comment: Set 3, vector 254 +Key: FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE +Plaintext: FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE +Ciphertext: 17E02528D6655CEA7BE6B8548FC2DA65 +Test: Encrypt +Comment: Set 3, vector 255 +Key: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +Plaintext: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +Ciphertext: 25DD9EB9DD67FBC6E8431F56F4FBE651 +Test: Encrypt +Comment: Tests with 192-bit keys +Comment: Set 1, vector 0 +Key: 800000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1B6220D365C2176C1D41A5826520FCA1 +Test: Encrypt +Comment: Set 1, vector 1 +Key: 400000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0F6DAEEA95CFC8925F23AFA932DF489B +Test: Encrypt +Comment: Set 1, vector 2 +Key: 200000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7330199225AD384F8DD39582D61389BB +Test: Encrypt +Comment: Set 1, vector 3 +Key: 100000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2CC5A47D5C62F70634E27BA332D37D53 +Test: Encrypt +Comment: Set 1, vector 4 +Key: 080000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CDF1D23AB15E20AE8E9A2FE380920897 +Test: Encrypt +Comment: Set 1, vector 5 +Key: 040000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CE995A8AF1FD7E0F5FA07ED654841EEE +Test: Encrypt +Comment: Set 1, vector 6 +Key: 020000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0678BA4335E44354363005F278AF83A4 +Test: Encrypt +Comment: Set 1, vector 7 +Key: 010000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6162ED593434D738B44D642254066FB4 +Test: Encrypt +Comment: Set 1, vector 8 +Key: 008000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F7F146E61396EC9AB9F7D04BFA6D37F5 +Test: Encrypt +Comment: Set 1, vector 9 +Key: 004000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8BF96FE41906AF2CC702726B963E56A6 +Test: Encrypt +Comment: Set 1, vector 10 +Key: 002000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B164168F7D6BADBCCBE19B2BCF4EAA91 +Test: Encrypt +Comment: Set 1, vector 11 +Key: 001000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5A81508260797F7BCFD4E0DB62F5E3A7 +Test: Encrypt +Comment: Set 1, vector 12 +Key: 000800000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 36641169D53E61CB32B97B98C37DF262 +Test: Encrypt +Comment: Set 1, vector 13 +Key: 000400000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EFFEC137ECEE5D439F8B21ACE1D863F8 +Test: Encrypt +Comment: Set 1, vector 14 +Key: 000200000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7462DEB8C153EECB6C78CE690E764B53 +Test: Encrypt +Comment: Set 1, vector 15 +Key: 000100000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 34F873BD3D6FF62B18C3778B123B15C5 +Test: Encrypt +Comment: Set 1, vector 16 +Key: 000080000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9850C8E08F952EE1D173B1A4A78686F5 +Test: Encrypt +Comment: Set 1, vector 17 +Key: 000040000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3285534795E8547B68580343DC5BF330 +Test: Encrypt +Comment: Set 1, vector 18 +Key: 000020000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E0495AA72CB3C27233850F3192254232 +Test: Encrypt +Comment: Set 1, vector 19 +Key: 000010000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 33ED350E83B7FE34E74C22A883EC6728 +Test: Encrypt +Comment: Set 1, vector 20 +Key: 000008000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 912D73428CBA7F631AE577854C111C91 +Test: Encrypt +Comment: Set 1, vector 21 +Key: 000004000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 76E747DC49B25D8E6EBE5DE83980AB57 +Test: Encrypt +Comment: Set 1, vector 22 +Key: 000002000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 82A2ED3BE0371C98C176AA7E7DF9FF8D +Test: Encrypt +Comment: Set 1, vector 23 +Key: 000001000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 96282A04DD3405294F9714B396D5219A +Test: Encrypt +Comment: Set 1, vector 24 +Key: 000000800000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 86ECD349003006A6DE29D4AAC1ACE296 +Test: Encrypt +Comment: Set 1, vector 25 +Key: 000000400000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7A9A9F2BBEA203ECE7C9F531B6D41B6A +Test: Encrypt +Comment: Set 1, vector 26 +Key: 000000200000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BA5FE8CD976DEA118728C2950D325042 +Test: Encrypt +Comment: Set 1, vector 27 +Key: 000000100000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 46F29ADE35C839AE69454CB0C9EEBF71 +Test: Encrypt +Comment: Set 1, vector 28 +Key: 000000080000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E5B83E23535FC32DD8153C46EC894FAD +Test: Encrypt +Comment: Set 1, vector 29 +Key: 000000040000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 877CC6280A8E7740F710AEA535DADFD4 +Test: Encrypt +Comment: Set 1, vector 30 +Key: 000000020000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 284D6EEC89721D40BDCFD260AF4FF052 +Test: Encrypt +Comment: Set 1, vector 31 +Key: 000000010000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6482ED6C71B60F1ED92B9913B5EAF6B3 +Test: Encrypt +Comment: Set 1, vector 32 +Key: 000000008000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 30135C97C9C23C8C64612D6BB813AD61 +Test: Encrypt +Comment: Set 1, vector 33 +Key: 000000004000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 336F70CF867920BBC00699CA8DBDF6DA +Test: Encrypt +Comment: Set 1, vector 34 +Key: 000000002000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3F4003C9600469670DE0B1B20ED5F33D +Test: Encrypt +Comment: Set 1, vector 35 +Key: 000000001000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9D5FFEDF7166F74DCAF2D643E2934ABE +Test: Encrypt +Comment: Set 1, vector 36 +Key: 000000000800000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9BFAC0EEB78A21F006DB6847CC7D7929 +Test: Encrypt +Comment: Set 1, vector 37 +Key: 000000000400000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B64332DC813BE982897C1E14DA808F5D +Test: Encrypt +Comment: Set 1, vector 38 +Key: 000000000200000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AB8FCEB76C37E5FE5737DA4382F14347 +Test: Encrypt +Comment: Set 1, vector 39 +Key: 000000000100000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C9C121859975147145AF6CAE313BA00D +Test: Encrypt +Comment: Set 1, vector 40 +Key: 000000000080000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9B1307BF36B6FF5BA4AD9C6574B63955 +Test: Encrypt +Comment: Set 1, vector 41 +Key: 000000000040000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8842C3EBB26C1863440D52DC3B26414B +Test: Encrypt +Comment: Set 1, vector 42 +Key: 000000000020000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: ADEADD3E035D591B2197D5B9C9B06ADA +Test: Encrypt +Comment: Set 1, vector 43 +Key: 000000000010000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4F36AD57F9BA5FB6624E504D0FC2DC93 +Test: Encrypt +Comment: Set 1, vector 44 +Key: 000000000008000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 92A364EEB2D964949210C7FF14BAE7B5 +Test: Encrypt +Comment: Set 1, vector 45 +Key: 000000000004000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EA027B9653456B8A41910FE19A90FD50 +Test: Encrypt +Comment: Set 1, vector 46 +Key: 000000000002000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 254A41CA04427C9E87F65BB52A0ACF74 +Test: Encrypt +Comment: Set 1, vector 47 +Key: 000000000001000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F935FD318C08AC6CD57A028384FA447B +Test: Encrypt +Comment: Set 1, vector 48 +Key: 000000000000800000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E5BA10850CBCFF8F42FEC0E658685096 +Test: Encrypt +Comment: Set 1, vector 49 +Key: 000000000000400000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6F145C7015923CE515D78CEF0157CCC6 +Test: Encrypt +Comment: Set 1, vector 50 +Key: 000000000000200000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3A6FCA03EA6DBF6996FD2CE99EC17C31 +Test: Encrypt +Comment: Set 1, vector 51 +Key: 000000000000100000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 21E2ED82498B110EAEAD90F1BBEA03A6 +Test: Encrypt +Comment: Set 1, vector 52 +Key: 000000000000080000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6B16ED3CBADC3151323891C373C43DFB +Test: Encrypt +Comment: Set 1, vector 53 +Key: 000000000000040000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B621A20E0CA41620C2A483154DB6102C +Test: Encrypt +Comment: Set 1, vector 54 +Key: 000000000000020000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8C754011BD3B87AA1EB3607B98E6CE86 +Test: Encrypt +Comment: Set 1, vector 55 +Key: 000000000000010000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FEEE2DFBA1DD3DBF4017B13833117816 +Test: Encrypt +Comment: Set 1, vector 56 +Key: 000000000000008000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 62A9C6CC76519FCF8FAD9EED0552CEB3 +Test: Encrypt +Comment: Set 1, vector 57 +Key: 000000000000004000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FF822FAFB79035AB813246BA5234D675 +Test: Encrypt +Comment: Set 1, vector 58 +Key: 000000000000002000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F3E17F2406DF31E7074DF97B062396B9 +Test: Encrypt +Comment: Set 1, vector 59 +Key: 000000000000001000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3F4F81B3573B6756ADD3005087EDE501 +Test: Encrypt +Comment: Set 1, vector 60 +Key: 000000000000000800000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 65A03A1A1C44191B73D576B7C75B5C32 +Test: Encrypt +Comment: Set 1, vector 61 +Key: 000000000000000400000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B08EBB2097DA76C34E2D8A869DCD3D7D +Test: Encrypt +Comment: Set 1, vector 62 +Key: 000000000000000200000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BA7B88E1B1FCFA03C3DBB2EDE047F5DC +Test: Encrypt +Comment: Set 1, vector 63 +Key: 000000000000000100000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1B3CB3884C12691CC66202EDB0838106 +Test: Encrypt +Comment: Set 1, vector 64 +Key: 000000000000000080000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4A85BE25546958B1E91801A35C7386E2 +Test: Encrypt +Comment: Set 1, vector 65 +Key: 000000000000000040000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F14CAACDD919872396DBCDCBEF9A384C +Test: Encrypt +Comment: Set 1, vector 66 +Key: 000000000000000020000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 23B0D4FC870309DFEF7AFC04C46AF26A +Test: Encrypt +Comment: Set 1, vector 67 +Key: 000000000000000010000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C93604723C3DBBC66AFF87AB1864C76C +Test: Encrypt +Comment: Set 1, vector 68 +Key: 000000000000000008000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6C14E822857BA0983AAC42995D973092 +Test: Encrypt +Comment: Set 1, vector 69 +Key: 000000000000000004000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 700AFEA175DBEAE688F90B8D32990560 +Test: Encrypt +Comment: Set 1, vector 70 +Key: 000000000000000002000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 54AE9EFA09FC70A852212752B83AF1F2 +Test: Encrypt +Comment: Set 1, vector 71 +Key: 000000000000000001000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2474EF8E660333FC9763E137DDB1AA1F +Test: Encrypt +Comment: Set 1, vector 72 +Key: 000000000000000000800000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E52ECE1281186644B6A2228A89BD2304 +Test: Encrypt +Comment: Set 1, vector 73 +Key: 000000000000000000400000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 610A02ECEC1B5BA0C6EC7CE8D6197722 +Test: Encrypt +Comment: Set 1, vector 74 +Key: 000000000000000000200000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8A8AB3DA5CE37E1D68B496F110E4F941 +Test: Encrypt +Comment: Set 1, vector 75 +Key: 000000000000000000100000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6961F3A7E6550753C55E4C03FA7869E9 +Test: Encrypt +Comment: Set 1, vector 76 +Key: 000000000000000000080000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: D8F149C207FAD4480BA2FC609BEB4471 +Test: Encrypt +Comment: Set 1, vector 77 +Key: 000000000000000000040000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DE9DC95336F2088935881DD57C0A4B98 +Test: Encrypt +Comment: Set 1, vector 78 +Key: 000000000000000000020000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DC4EA3B0F76439DB8847FE61C1A64F7A +Test: Encrypt +Comment: Set 1, vector 79 +Key: 000000000000000000010000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 21D4802EB72232AD2B0B46C50C98445B +Test: Encrypt +Comment: Set 1, vector 80 +Key: 000000000000000000008000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: D6C32522B546BAC316E5F3A07F83FFE6 +Test: Encrypt +Comment: Set 1, vector 81 +Key: 000000000000000000004000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4B07B02C86B579A0C68D916DF8A1EB76 +Test: Encrypt +Comment: Set 1, vector 82 +Key: 000000000000000000002000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 060B15735C978DF9F4F3ED503B95D6C3 +Test: Encrypt +Comment: Set 1, vector 83 +Key: 000000000000000000001000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3040B3C9C560C968FE14664E3496D5D1 +Test: Encrypt +Comment: Set 1, vector 84 +Key: 000000000000000000000800000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8971CFB236598BBD46E47E172B0690F7 +Test: Encrypt +Comment: Set 1, vector 85 +Key: 000000000000000000000400000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8D7FAB4985A0BAC4CAEE341972D49CF4 +Test: Encrypt +Comment: Set 1, vector 86 +Key: 000000000000000000000200000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: ED29003D83CB7D7747C17A8691323021 +Test: Encrypt +Comment: Set 1, vector 87 +Key: 000000000000000000000100000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 98EBFDA32C99438F0A549B7BFAAC0635 +Test: Encrypt +Comment: Set 1, vector 88 +Key: 000000000000000000000080000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A59AB8EAF03BCDFD7CB0A9650E59F27B +Test: Encrypt +Comment: Set 1, vector 89 +Key: 000000000000000000000040000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 71422297CE93952D46FFC27530D6255D +Test: Encrypt +Comment: Set 1, vector 90 +Key: 000000000000000000000020000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 519E2607543C3AFE49190EBCA12ADBBC +Test: Encrypt +Comment: Set 1, vector 91 +Key: 000000000000000000000010000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8989C908C50E008E70EA5B897DC3544C +Test: Encrypt +Comment: Set 1, vector 92 +Key: 000000000000000000000008000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 981C174277F29F8DD06E1D4C97D9816F +Test: Encrypt +Comment: Set 1, vector 93 +Key: 000000000000000000000004000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0279DEC16A532E160AA5B4FF7682F696 +Test: Encrypt +Comment: Set 1, vector 94 +Key: 000000000000000000000002000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C3BFFB31FCB0A61188DE9AA606CB286C +Test: Encrypt +Comment: Set 1, vector 95 +Key: 000000000000000000000001000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5C1C4966B387A41D52F83BBF322D25DF +Test: Encrypt +Comment: Set 1, vector 96 +Key: 000000000000000000000000800000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6602ECC6AF62EF1EB4D17E2487A64F7A +Test: Encrypt +Comment: Set 1, vector 97 +Key: 000000000000000000000000400000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2DA725366BD7774BA235183CC9B273B4 +Test: Encrypt +Comment: Set 1, vector 98 +Key: 000000000000000000000000200000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 71B29CF87C313F0B89B75251EFC4FF7F +Test: Encrypt +Comment: Set 1, vector 99 +Key: 000000000000000000000000100000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4D9BDBCBA04C54AEAA7F48470428ECA2 +Test: Encrypt +Comment: Set 1, vector 100 +Key: 000000000000000000000000080000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C6BC53A3C6D6C8A6F12B97B151BFBB3F +Test: Encrypt +Comment: Set 1, vector 101 +Key: 000000000000000000000000040000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FD3E8D6732BBC2AA13F03F9AB0BCEC14 +Test: Encrypt +Comment: Set 1, vector 102 +Key: 000000000000000000000000020000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7D5ED8FEF289FF7F8953278E0A0297A1 +Test: Encrypt +Comment: Set 1, vector 103 +Key: 000000000000000000000000010000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 84A20023EF5E31771802E8A2FFBA485B +Test: Encrypt +Comment: Set 1, vector 104 +Key: 000000000000000000000000008000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7BD6E573AE79F0FA9FE38ECF6011D756 +Test: Encrypt +Comment: Set 1, vector 105 +Key: 000000000000000000000000004000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EB58EA6B6DE1282A7BB9EA1A2254A542 +Test: Encrypt +Comment: Set 1, vector 106 +Key: 000000000000000000000000002000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 30A697E325C4D3BEC8E69A2DAD2AE5BB +Test: Encrypt +Comment: Set 1, vector 107 +Key: 000000000000000000000000001000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3205F6FEAA38500AC74BE66FEDF3231E +Test: Encrypt +Comment: Set 1, vector 108 +Key: 000000000000000000000000000800000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 83C007676041E81B836886ABED807A71 +Test: Encrypt +Comment: Set 1, vector 109 +Key: 000000000000000000000000000400000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 24B33B3138855437CC11D3792A1FD00F +Test: Encrypt +Comment: Set 1, vector 110 +Key: 000000000000000000000000000200000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 26324D7E2C055366910464699D73608A +Test: Encrypt +Comment: Set 1, vector 111 +Key: 000000000000000000000000000100000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F9A94A959AE7CD2A9D5FB7274703906B +Test: Encrypt +Comment: Set 1, vector 112 +Key: 000000000000000000000000000080000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AD13D85E47EFC76B67ED25791E119A5C +Test: Encrypt +Comment: Set 1, vector 113 +Key: 000000000000000000000000000040000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5FB689176B296F2E579FC69A18FA07EB +Test: Encrypt +Comment: Set 1, vector 114 +Key: 000000000000000000000000000020000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 936DFBA0A052A299C195F34A66C0CEDF +Test: Encrypt +Comment: Set 1, vector 115 +Key: 000000000000000000000000000010000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 486C03278BB30F26D25AE0D6348C9491 +Test: Encrypt +Comment: Set 1, vector 116 +Key: 000000000000000000000000000008000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FCE14E6CE2073B5E8D1572A1EC1BD502 +Test: Encrypt +Comment: Set 1, vector 117 +Key: 000000000000000000000000000004000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5F15B8A64EDBF0E55C3B8BB67BC9B2E1 +Test: Encrypt +Comment: Set 1, vector 118 +Key: 000000000000000000000000000002000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7BDC738A342891C7BE06E87E12F71418 +Test: Encrypt +Comment: Set 1, vector 119 +Key: 000000000000000000000000000001000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 31C6FEDABBC8C8AD64C27505F02BC7CC +Test: Encrypt +Comment: Set 1, vector 120 +Key: 000000000000000000000000000000800000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 33CCD97EB8C3C06B7BCD16659E1F9837 +Test: Encrypt +Comment: Set 1, vector 121 +Key: 000000000000000000000000000000400000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 12C3089895D4A1C1D03DB0071F88AB1B +Test: Encrypt +Comment: Set 1, vector 122 +Key: 000000000000000000000000000000200000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8EB4796C7F7C3B0858750EBE3BAA335C +Test: Encrypt +Comment: Set 1, vector 123 +Key: 000000000000000000000000000000100000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 67169AF324151E92C6B7C31687B83783 +Test: Encrypt +Comment: Set 1, vector 124 +Key: 000000000000000000000000000000080000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AB0E10564D41594B55CE3D5B088D93B4 +Test: Encrypt +Comment: Set 1, vector 125 +Key: 000000000000000000000000000000040000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 45228986B08E63728239ADC9C249E475 +Test: Encrypt +Comment: Set 1, vector 126 +Key: 000000000000000000000000000000020000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CA7E48D5A4CD15984CA9EF99EC789EFD +Test: Encrypt +Comment: Set 1, vector 127 +Key: 000000000000000000000000000000010000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B4DD56FF85F7ABBEB9E0F5AE6B0E491D +Test: Encrypt +Comment: Set 1, vector 128 +Key: 000000000000000000000000000000008000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 044BE36D2F5A3D0FEA74443538F55393 +Test: Encrypt +Comment: Set 1, vector 129 +Key: 000000000000000000000000000000004000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 531EC401FB7C3BFADF64BB08E0DD9992 +Test: Encrypt +Comment: Set 1, vector 130 +Key: 000000000000000000000000000000002000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EA8D6B6963EC2267050F8CF5D1D1D939 +Test: Encrypt +Comment: Set 1, vector 131 +Key: 000000000000000000000000000000001000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CF5D7F27462FF7415D4E5ECBAEE0797C +Test: Encrypt +Comment: Set 1, vector 132 +Key: 000000000000000000000000000000000800000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DF28B8322D4B8606FF3EFF09D39697B0 +Test: Encrypt +Comment: Set 1, vector 133 +Key: 000000000000000000000000000000000400000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 956EF889AAB218E21FAF8E9CC2AE41F9 +Test: Encrypt +Comment: Set 1, vector 134 +Key: 000000000000000000000000000000000200000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AD0CF3C46F420E96B876DD55515B4B80 +Test: Encrypt +Comment: Set 1, vector 135 +Key: 000000000000000000000000000000000100000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EC8620D3B9B456633AD174573CF82ABD +Test: Encrypt +Comment: Set 1, vector 136 +Key: 000000000000000000000000000000000080000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A7CC6C810C1433B8D130594A48A36F69 +Test: Encrypt +Comment: Set 1, vector 137 +Key: 000000000000000000000000000000000040000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B02C5AF13D523A2A62E9F3829F9E3364 +Test: Encrypt +Comment: Set 1, vector 138 +Key: 000000000000000000000000000000000020000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5AC8368EC6150F08CC2C44DBA8A9D84F +Test: Encrypt +Comment: Set 1, vector 139 +Key: 000000000000000000000000000000000010000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3BD51735D6087217EEF17B40750D701F +Test: Encrypt +Comment: Set 1, vector 140 +Key: 000000000000000000000000000000000008000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 330CC76A5529364B08F722C6206214E7 +Test: Encrypt +Comment: Set 1, vector 141 +Key: 000000000000000000000000000000000004000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 13CA2152CB81267D8429670A8D983592 +Test: Encrypt +Comment: Set 1, vector 142 +Key: 000000000000000000000000000000000002000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3943D67CE79CB8519EB9A5D1021988ED +Test: Encrypt +Comment: Set 1, vector 143 +Key: 000000000000000000000000000000000001000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 642858D825E8640718ABE6174BD04A32 +Test: Encrypt +Comment: Set 1, vector 144 +Key: 000000000000000000000000000000000000800000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F22616DE88A4CCBF97CF2DB709237EC7 +Test: Encrypt +Comment: Set 1, vector 145 +Key: 000000000000000000000000000000000000400000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B90D7F6BF0D9FC11A01F2B33194806DB +Test: Encrypt +Comment: Set 1, vector 146 +Key: 000000000000000000000000000000000000200000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C161D350DC897B210D0D0CE8CE78F4B4 +Test: Encrypt +Comment: Set 1, vector 147 +Key: 000000000000000000000000000000000000100000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 66E46482150E7CF9BCBE60AF7BCA6892 +Test: Encrypt +Comment: Set 1, vector 148 +Key: 000000000000000000000000000000000000080000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B17C912E085D8854F220555EB0FA89BD +Test: Encrypt +Comment: Set 1, vector 149 +Key: 000000000000000000000000000000000000040000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6FD6A99633FBD3A6D238CADF37824AD2 +Test: Encrypt +Comment: Set 1, vector 150 +Key: 000000000000000000000000000000000000020000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9DE6D76D9A7E4AAB7A58EECE0E153D73 +Test: Encrypt +Comment: Set 1, vector 151 +Key: 000000000000000000000000000000000000010000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B4716A7DB10E3B8D1475C7EFB929F93A +Test: Encrypt +Comment: Set 1, vector 152 +Key: 000000000000000000000000000000000000008000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3D0F65F16AD143FB2FABDF4DFE621398 +Test: Encrypt +Comment: Set 1, vector 153 +Key: 000000000000000000000000000000000000004000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 249F1415D963DE146F4141C200B81D1D +Test: Encrypt +Comment: Set 1, vector 154 +Key: 000000000000000000000000000000000000002000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 454CD7040ED3851C3894F6259CE0D3FE +Test: Encrypt +Comment: Set 1, vector 155 +Key: 000000000000000000000000000000000000001000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4D613EE6FA78A573ECBE989A64193E0C +Test: Encrypt +Comment: Set 1, vector 156 +Key: 000000000000000000000000000000000000000800000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B39384E429291B9C22005BC9B3FF2DEF +Test: Encrypt +Comment: Set 1, vector 157 +Key: 000000000000000000000000000000000000000400000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 957D0B27740C952E45DB97C8814F49C0 +Test: Encrypt +Comment: Set 1, vector 158 +Key: 000000000000000000000000000000000000000200000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2879F58F238865D877D8C276CA9E9102 +Test: Encrypt +Comment: Set 1, vector 159 +Key: 000000000000000000000000000000000000000100000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EA5B920037608FC9D51F39488D4666F7 +Test: Encrypt +Comment: Set 1, vector 160 +Key: 000000000000000000000000000000000000000080000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7659A705ABCA25205078541E713088BC +Test: Encrypt +Comment: Set 1, vector 161 +Key: 000000000000000000000000000000000000000040000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 47E340BB8BF2E8E1015BEFB68C7B1100 +Test: Encrypt +Comment: Set 1, vector 162 +Key: 000000000000000000000000000000000000000020000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 777E3E572CA33076B2CB34226CC70158 +Test: Encrypt +Comment: Set 1, vector 163 +Key: 000000000000000000000000000000000000000010000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1FEC7C6719C7CA2E9A981851C5CEE204 +Test: Encrypt +Comment: Set 1, vector 164 +Key: 000000000000000000000000000000000000000008000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9AF07DABE083EFDA75708A36AEB74CAF +Test: Encrypt +Comment: Set 1, vector 165 +Key: 000000000000000000000000000000000000000004000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5D1482F8EF9CB18911BB7F78BC3B89FC +Test: Encrypt +Comment: Set 1, vector 166 +Key: 000000000000000000000000000000000000000002000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5242753E01D470DD8C2B73A986BA009F +Test: Encrypt +Comment: Set 1, vector 167 +Key: 000000000000000000000000000000000000000001000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 83AE5BC112B73AB7978D13DD534B770B +Test: Encrypt +Comment: Set 1, vector 168 +Key: 000000000000000000000000000000000000000000800000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 848EB7330A82B91D36FBEFF6E6CE1347 +Test: Encrypt +Comment: Set 1, vector 169 +Key: 000000000000000000000000000000000000000000400000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F1B14465EFFD3E14DD1BAC6E0FA4E5BD +Test: Encrypt +Comment: Set 1, vector 170 +Key: 000000000000000000000000000000000000000000200000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5ACD25AA05AFD21F43F6A51709FD0B6A +Test: Encrypt +Comment: Set 1, vector 171 +Key: 000000000000000000000000000000000000000000100000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 12321AEFA53F1503E3A473F729388CBD +Test: Encrypt +Comment: Set 1, vector 172 +Key: 000000000000000000000000000000000000000000080000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1602DBA20E2ACFDDCC78390B473B322B +Test: Encrypt +Comment: Set 1, vector 173 +Key: 000000000000000000000000000000000000000000040000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 14C1853C3CF3CDFCE3799D5C130138EC +Test: Encrypt +Comment: Set 1, vector 174 +Key: 000000000000000000000000000000000000000000020000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DC17F9E8236350BDC285F9B2F88F670F +Test: Encrypt +Comment: Set 1, vector 175 +Key: 000000000000000000000000000000000000000000010000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: ABA03FEE8133DD4ED9B8194B643E20CE +Test: Encrypt +Comment: Set 1, vector 176 +Key: 000000000000000000000000000000000000000000008000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5822E80530C7CECCE4F56CF1691B386F +Test: Encrypt +Comment: Set 1, vector 177 +Key: 000000000000000000000000000000000000000000004000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 25CFA6F1B9BE5E14DFAF87A44B3B2E3D +Test: Encrypt +Comment: Set 1, vector 178 +Key: 000000000000000000000000000000000000000000002000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5ED866CBC298B4DEE46C1A02F958F1F5 +Test: Encrypt +Comment: Set 1, vector 179 +Key: 000000000000000000000000000000000000000000001000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BD2B63C026EB0E58D26ED16D2ED64A3E +Test: Encrypt +Comment: Set 1, vector 180 +Key: 000000000000000000000000000000000000000000000800 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9FFCFF9CF9E1483BC7971888246AF9FE +Test: Encrypt +Comment: Set 1, vector 181 +Key: 000000000000000000000000000000000000000000000400 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 367C409AEE218E02DEAC8751698BA1B8 +Test: Encrypt +Comment: Set 1, vector 182 +Key: 000000000000000000000000000000000000000000000200 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 248E3A3C0360B44C512A9AC3CAAEC21B +Test: Encrypt +Comment: Set 1, vector 183 +Key: 000000000000000000000000000000000000000000000100 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 49B47C542CA396260B53A34372985612 +Test: Encrypt +Comment: Set 1, vector 184 +Key: 000000000000000000000000000000000000000000000080 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CE35FDBDBE086EA8A501A4571925A95F +Test: Encrypt +Comment: Set 1, vector 185 +Key: 000000000000000000000000000000000000000000000040 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 873442FAE891B0767220742B84A32A4E +Test: Encrypt +Comment: Set 1, vector 186 +Key: 000000000000000000000000000000000000000000000020 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2C90E17AD13E4E84686BC5B369F0FA8F +Test: Encrypt +Comment: Set 1, vector 187 +Key: 000000000000000000000000000000000000000000000010 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0E7AAAA67D8593A9DFC55083B48B381A +Test: Encrypt +Comment: Set 1, vector 188 +Key: 000000000000000000000000000000000000000000000008 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1D8B58EE529AB17B10AC15D0E6E7ECB2 +Test: Encrypt +Comment: Set 1, vector 189 +Key: 000000000000000000000000000000000000000000000004 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1C10FAC725B905AD93B6F4B2430A8D18 +Test: Encrypt +Comment: Set 1, vector 190 +Key: 000000000000000000000000000000000000000000000002 +Plaintext: 00000000000000000000000000000000 +Ciphertext: D36CF625EE94AB029CD23253C77C0E15 +Test: Encrypt +Comment: Set 1, vector 191 +Key: 000000000000000000000000000000000000000000000001 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E37577F71E0E643C4D3F55219ABA1394 +Test: Encrypt +Comment: Set 2, vector 0 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 80000000000000000000000000000000 +Ciphertext: 3EB6CC5618EFC98455B5992050D474E7 +Test: Encrypt +Comment: Set 2, vector 1 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 40000000000000000000000000000000 +Ciphertext: A2C645044CBC74DE5A4A161C6B2E98B9 +Test: Encrypt +Comment: Set 2, vector 2 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 20000000000000000000000000000000 +Ciphertext: 36A9A8C164BD90D4972AB1BE56C96A0B +Test: Encrypt +Comment: Set 2, vector 3 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 10000000000000000000000000000000 +Ciphertext: 38965592D728F9B765140C0A36A1BCCD +Test: Encrypt +Comment: Set 2, vector 4 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 08000000000000000000000000000000 +Ciphertext: 94CDECA78E10827914A49B5AE7F15643 +Test: Encrypt +Comment: Set 2, vector 5 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 04000000000000000000000000000000 +Ciphertext: 11C0DF672B45CDCD311EB86A7560EDA1 +Test: Encrypt +Comment: Set 2, vector 6 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 02000000000000000000000000000000 +Ciphertext: 030CAA9B8DE6F8AB88882F9596D9B1B4 +Test: Encrypt +Comment: Set 2, vector 7 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 01000000000000000000000000000000 +Ciphertext: FA02C8D1CDDD08B1FE3650DBD8E43C4F +Test: Encrypt +Comment: Set 2, vector 8 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00800000000000000000000000000000 +Ciphertext: 10ACEC25736340600D712338357C7FD4 +Test: Encrypt +Comment: Set 2, vector 9 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00400000000000000000000000000000 +Ciphertext: BBEF172E9E18679C6546EA2D9357BDD1 +Test: Encrypt +Comment: Set 2, vector 10 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00200000000000000000000000000000 +Ciphertext: 707CF6F582F5921765DBC6E1C79C45B6 +Test: Encrypt +Comment: Set 2, vector 11 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00100000000000000000000000000000 +Ciphertext: 3E9206A85F9FE99CD5538FA196E58147 +Test: Encrypt +Comment: Set 2, vector 12 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00080000000000000000000000000000 +Ciphertext: 6758B118659E9BB40BB7DC8C3D15ECEC +Test: Encrypt +Comment: Set 2, vector 13 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00040000000000000000000000000000 +Ciphertext: 9BCA6C88B928C1B0F57F99866583A9BC +Test: Encrypt +Comment: Set 2, vector 14 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00020000000000000000000000000000 +Ciphertext: 53D60CF8CA0B41B3991EF892917FA26F +Test: Encrypt +Comment: Set 2, vector 15 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00010000000000000000000000000000 +Ciphertext: 49E438685E189FB95791C655FBF40B3B +Test: Encrypt +Comment: Set 2, vector 16 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00008000000000000000000000000000 +Ciphertext: 6BFE6661C074077EF95DC499CA30A6B9 +Test: Encrypt +Comment: Set 2, vector 17 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00004000000000000000000000000000 +Ciphertext: FE82A6754DD56ACBD1895F8257597B74 +Test: Encrypt +Comment: Set 2, vector 18 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00002000000000000000000000000000 +Ciphertext: AF4551CFCEAEF2AEE1933C4AB5F036F5 +Test: Encrypt +Comment: Set 2, vector 19 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00001000000000000000000000000000 +Ciphertext: 5175E53EA4CA77E085363B2948B77B17 +Test: Encrypt +Comment: Set 2, vector 20 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000800000000000000000000000000 +Ciphertext: 19F544B2B2AAE4AF00DE2853F83349A5 +Test: Encrypt +Comment: Set 2, vector 21 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000400000000000000000000000000 +Ciphertext: 45A4379AC855738F6FEE3AFFBB2D839F +Test: Encrypt +Comment: Set 2, vector 22 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000200000000000000000000000000 +Ciphertext: 73A390407DD07D4ABEB299A5051A8DD1 +Test: Encrypt +Comment: Set 2, vector 23 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000100000000000000000000000000 +Ciphertext: 923B1E3525217E5C7A41CE3BCAE7C083 +Test: Encrypt +Comment: Set 2, vector 24 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000080000000000000000000000000 +Ciphertext: F58098D6E68E975C922B05354C0E2094 +Test: Encrypt +Comment: Set 2, vector 25 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000040000000000000000000000000 +Ciphertext: 371631601CE2BED9B7706FA4254BBAE5 +Test: Encrypt +Comment: Set 2, vector 26 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000020000000000000000000000000 +Ciphertext: 794F34CD64B44095BAB5C470B36E60BE +Test: Encrypt +Comment: Set 2, vector 27 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000010000000000000000000000000 +Ciphertext: 1A4CE8CBFEDB4F64B1A64D926B9BE3A1 +Test: Encrypt +Comment: Set 2, vector 28 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000008000000000000000000000000 +Ciphertext: 11C391C85F8FCF72EB03E1C4CC40B529 +Test: Encrypt +Comment: Set 2, vector 29 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000004000000000000000000000000 +Ciphertext: 9D8ADDC48EC36BB449234C7C06BEDC0F +Test: Encrypt +Comment: Set 2, vector 30 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000002000000000000000000000000 +Ciphertext: 952A1FAD7FAEA148FA31B50C244CF5C4 +Test: Encrypt +Comment: Set 2, vector 31 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000001000000000000000000000000 +Ciphertext: 613E5E9BBBF1B9943B3B5CBD3E69C98F +Test: Encrypt +Comment: Set 2, vector 32 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000800000000000000000000000 +Ciphertext: 5ABF9CB600BB50DB64211DE2DEAEEDBA +Test: Encrypt +Comment: Set 2, vector 33 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000400000000000000000000000 +Ciphertext: 14697658FDA5B1F14C3303F5951CAE70 +Test: Encrypt +Comment: Set 2, vector 34 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000200000000000000000000000 +Ciphertext: 2A29179C05F2F5F5909A34130B92BB25 +Test: Encrypt +Comment: Set 2, vector 35 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000100000000000000000000000 +Ciphertext: 60A9DAB8068CC085F3B9853D0C1FCF07 +Test: Encrypt +Comment: Set 2, vector 36 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000080000000000000000000000 +Ciphertext: D625356ACCE7B9F874754AE52FD1C7BF +Test: Encrypt +Comment: Set 2, vector 37 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000040000000000000000000000 +Ciphertext: 31196A29DAA0A41E982819C26AF0567A +Test: Encrypt +Comment: Set 2, vector 38 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000020000000000000000000000 +Ciphertext: D1763FC019D77CC930BFF2A56F7C9364 +Test: Encrypt +Comment: Set 2, vector 39 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000010000000000000000000000 +Ciphertext: BBC9D3C96666B01D0C33CC067ADDA228 +Test: Encrypt +Comment: Set 2, vector 40 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000008000000000000000000000 +Ciphertext: 4FC9284574F433DD6C5ADEAB6DC64A06 +Test: Encrypt +Comment: Set 2, vector 41 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000004000000000000000000000 +Ciphertext: 7176B9E3628380ADDCF02493DB254B01 +Test: Encrypt +Comment: Set 2, vector 42 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000002000000000000000000000 +Ciphertext: C6B124A17B3AB55A983DC2B6E8253FF1 +Test: Encrypt +Comment: Set 2, vector 43 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000001000000000000000000000 +Ciphertext: 5853A6B6AB0FC47DEBA33526B628DF6E +Test: Encrypt +Comment: Set 2, vector 44 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000800000000000000000000 +Ciphertext: 416945C1D1902238C42955CFF166D705 +Test: Encrypt +Comment: Set 2, vector 45 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000400000000000000000000 +Ciphertext: 2478F40DC7B7FA98E59DA21F1D2140F9 +Test: Encrypt +Comment: Set 2, vector 46 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000200000000000000000000 +Ciphertext: 6A912316499FBECA17D1683EAF79FDC9 +Test: Encrypt +Comment: Set 2, vector 47 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000100000000000000000000 +Ciphertext: 8A41DB2271FD345BC1DDE61A427E4E3E +Test: Encrypt +Comment: Set 2, vector 48 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000080000000000000000000 +Ciphertext: B6C62C6A14D2276C8FE8D1062C1E8080 +Test: Encrypt +Comment: Set 2, vector 49 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000040000000000000000000 +Ciphertext: D23F90169810210A45BD9B8681B24C34 +Test: Encrypt +Comment: Set 2, vector 50 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000020000000000000000000 +Ciphertext: EDB2A77815A074B50D88C6C2B15AF814 +Test: Encrypt +Comment: Set 2, vector 51 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000010000000000000000000 +Ciphertext: 2D6D81C8FDD2C7D5B98317488846969D +Test: Encrypt +Comment: Set 2, vector 52 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000008000000000000000000 +Ciphertext: 92F2805613A82EE25568B32ED7550DCC +Test: Encrypt +Comment: Set 2, vector 53 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000004000000000000000000 +Ciphertext: E321480A1DE5F36040F1FD170F24802B +Test: Encrypt +Comment: Set 2, vector 54 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000002000000000000000000 +Ciphertext: 3188FFADE35652067E6E2228130762D6 +Test: Encrypt +Comment: Set 2, vector 55 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000001000000000000000000 +Ciphertext: B3A3A43D68A82EC54B5D437346375584 +Test: Encrypt +Comment: Set 2, vector 56 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000800000000000000000 +Ciphertext: 023ECF3BD9FEB4891366ABE45EC1728B +Test: Encrypt +Comment: Set 2, vector 57 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000400000000000000000 +Ciphertext: 50D8160676748E1718A030F4F512C1C2 +Test: Encrypt +Comment: Set 2, vector 58 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000200000000000000000 +Ciphertext: 30DF20541978D9C96D43D609DEF39C00 +Test: Encrypt +Comment: Set 2, vector 59 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000100000000000000000 +Ciphertext: BA1AA1682750C0CEB2A87E1A46A7CE0E +Test: Encrypt +Comment: Set 2, vector 60 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000080000000000000000 +Ciphertext: 03AC8261D8F98C90B9CE9C9E47A39AA5 +Test: Encrypt +Comment: Set 2, vector 61 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000040000000000000000 +Ciphertext: 4C6C2FDC2693F2A43EAEB180AD8190F8 +Test: Encrypt +Comment: Set 2, vector 62 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000020000000000000000 +Ciphertext: B65D2C8CEE12BB4FA127356632CB0ECA +Test: Encrypt +Comment: Set 2, vector 63 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000010000000000000000 +Ciphertext: 6D785867F379BCE03580ED9DE83C0EFD +Test: Encrypt +Comment: Set 2, vector 64 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000008000000000000000 +Ciphertext: D2B25B3EECB454DCE070D11C408D73B2 +Test: Encrypt +Comment: Set 2, vector 65 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000004000000000000000 +Ciphertext: 8035FF5E625955D6328F570D53188C0C +Test: Encrypt +Comment: Set 2, vector 66 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000002000000000000000 +Ciphertext: A8BECF868B0D964E04012BE5F8121A9C +Test: Encrypt +Comment: Set 2, vector 67 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000001000000000000000 +Ciphertext: AA76DF2E83C0D31ECFE66A62E16A91D3 +Test: Encrypt +Comment: Set 2, vector 68 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000800000000000000 +Ciphertext: BAA324177EA5AF61ADBD27F594297278 +Test: Encrypt +Comment: Set 2, vector 69 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000400000000000000 +Ciphertext: 40BBEB33938AFA9BD566991B53B0FDA7 +Test: Encrypt +Comment: Set 2, vector 70 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000200000000000000 +Ciphertext: 6F58204780BEA9102506C477CBB3C8FE +Test: Encrypt +Comment: Set 2, vector 71 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000100000000000000 +Ciphertext: D296BCA9261A3410E47FA289BD70B955 +Test: Encrypt +Comment: Set 2, vector 72 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000080000000000000 +Ciphertext: 4C57FB4234A64462C6D441A782723777 +Test: Encrypt +Comment: Set 2, vector 73 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000040000000000000 +Ciphertext: 33478DE51DBDA949E17CB82373DAF866 +Test: Encrypt +Comment: Set 2, vector 74 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000020000000000000 +Ciphertext: 7CC11B9A6A9E2CE13D3596686C624AF0 +Test: Encrypt +Comment: Set 2, vector 75 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000010000000000000 +Ciphertext: 0C55ACA2BDA80E8F84A3879FF077802A +Test: Encrypt +Comment: Set 2, vector 76 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000008000000000000 +Ciphertext: 885B84843BADC6501CBDCBEA4386AB7F +Test: Encrypt +Comment: Set 2, vector 77 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000004000000000000 +Ciphertext: DCF23815FEF1697B0618E205B637648A +Test: Encrypt +Comment: Set 2, vector 78 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000002000000000000 +Ciphertext: BF5EBE09157E65743AAD033473B0DFED +Test: Encrypt +Comment: Set 2, vector 79 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000001000000000000 +Ciphertext: 1E9E5E1032307B75915E9BD48205FEB8 +Test: Encrypt +Comment: Set 2, vector 80 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000800000000000 +Ciphertext: 0EB8AC09A10303A7CE9762C1B029F0E0 +Test: Encrypt +Comment: Set 2, vector 81 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000400000000000 +Ciphertext: 2A42627713BFC603A88AD1D66292B80C +Test: Encrypt +Comment: Set 2, vector 82 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000200000000000 +Ciphertext: D7E9512485B9E5E409FB51E26D269795 +Test: Encrypt +Comment: Set 2, vector 83 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000100000000000 +Ciphertext: 57CC59F8B92D73E1B38EEE405A8EC12F +Test: Encrypt +Comment: Set 2, vector 84 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000080000000000 +Ciphertext: 161783F5FFC9A383E36B80A2032A71F1 +Test: Encrypt +Comment: Set 2, vector 85 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000040000000000 +Ciphertext: F5B24CE20FFD8702AC63F9C844BC5730 +Test: Encrypt +Comment: Set 2, vector 86 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000020000000000 +Ciphertext: 440930601D4013076587D882A1958280 +Test: Encrypt +Comment: Set 2, vector 87 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000010000000000 +Ciphertext: AEA4C3F9E520651C5FE38B915423843F +Test: Encrypt +Comment: Set 2, vector 88 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000008000000000 +Ciphertext: E300D7417C4F547DBCD5FC84E3833A7B +Test: Encrypt +Comment: Set 2, vector 89 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000004000000000 +Ciphertext: 5543860CE9247B38E8D0E7B216C0B5A5 +Test: Encrypt +Comment: Set 2, vector 90 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000002000000000 +Ciphertext: C20449053BF90C899899EE02794DB3C5 +Test: Encrypt +Comment: Set 2, vector 91 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000001000000000 +Ciphertext: AC0CB3B34AC32244CF196AE49E94D380 +Test: Encrypt +Comment: Set 2, vector 92 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000800000000 +Ciphertext: 0CDF3F25852287E3BAFAF490DE18D125 +Test: Encrypt +Comment: Set 2, vector 93 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000400000000 +Ciphertext: 583BB44512CE75268F72E6BC6682901B +Test: Encrypt +Comment: Set 2, vector 94 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000200000000 +Ciphertext: 217140522F0C505FDAC4BFDE6E9D9A81 +Test: Encrypt +Comment: Set 2, vector 95 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000100000000 +Ciphertext: CFA59EB13DDD780A2EAEF89E83737C9A +Test: Encrypt +Comment: Set 2, vector 96 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000080000000 +Ciphertext: 75E473CCD4D116426753B44900D919A6 +Test: Encrypt +Comment: Set 2, vector 97 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000040000000 +Ciphertext: E15E4627F7F8A3F09424D3D5CAC1C777 +Test: Encrypt +Comment: Set 2, vector 98 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000020000000 +Ciphertext: B83E20A23802D8755A2E850242B64EEF +Test: Encrypt +Comment: Set 2, vector 99 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000010000000 +Ciphertext: E6790AF3911360F28FD17886DD311F88 +Test: Encrypt +Comment: Set 2, vector 100 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000008000000 +Ciphertext: 0A6304DF33E409C8A21E1C19187183FF +Test: Encrypt +Comment: Set 2, vector 101 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000004000000 +Ciphertext: 51966561DA7ED5F30130B55CD108B5BE +Test: Encrypt +Comment: Set 2, vector 102 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000002000000 +Ciphertext: 0ECA40693BF4CB41FDD15BCFD8C9D9B9 +Test: Encrypt +Comment: Set 2, vector 103 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000001000000 +Ciphertext: 8731B42742ADBA2D89C9BA90EBD4E42A +Test: Encrypt +Comment: Set 2, vector 104 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000800000 +Ciphertext: BE4C6C18AA231E9BB13909242CC92EE3 +Test: Encrypt +Comment: Set 2, vector 105 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000400000 +Ciphertext: 39AC45537E9AFDC6C8BDD4204039A218 +Test: Encrypt +Comment: Set 2, vector 106 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000200000 +Ciphertext: AEA354F16E1E8EECEB5A98D88418B1A0 +Test: Encrypt +Comment: Set 2, vector 107 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000100000 +Ciphertext: 4F5D37D7D0DC7714E62BE4A0331DB07B +Test: Encrypt +Comment: Set 2, vector 108 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000080000 +Ciphertext: 9603F03C3CAA8C2F0ECFBA1374891007 +Test: Encrypt +Comment: Set 2, vector 109 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000040000 +Ciphertext: C58768944996884B46A8FFDDB9AB87EF +Test: Encrypt +Comment: Set 2, vector 110 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000020000 +Ciphertext: 3BCCF2396A97FC1C0CFFFB6ED41716DB +Test: Encrypt +Comment: Set 2, vector 111 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000010000 +Ciphertext: DC299278DCA45AC1B6B08ED4B62D9BC9 +Test: Encrypt +Comment: Set 2, vector 112 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000008000 +Ciphertext: E195AECA31E10241BD0EC4AC5418A25D +Test: Encrypt +Comment: Set 2, vector 113 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000004000 +Ciphertext: B397A4983ED647A0EB806ACDFE7BCB34 +Test: Encrypt +Comment: Set 2, vector 114 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000002000 +Ciphertext: BC8F7224B0447E8A1CF0F5506A060F3C +Test: Encrypt +Comment: Set 2, vector 115 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000001000 +Ciphertext: FFD3ED02E7F64A5D6B37A9DC5E531646 +Test: Encrypt +Comment: Set 2, vector 116 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000800 +Ciphertext: BC6019EB208B7AF8EFA6AE7B4CA0556B +Test: Encrypt +Comment: Set 2, vector 117 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000400 +Ciphertext: D2915AE2779F8F70E17CE953C6C1A380 +Test: Encrypt +Comment: Set 2, vector 118 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000200 +Ciphertext: B2AA4B1ED2285C9DA4088B6E9681C690 +Test: Encrypt +Comment: Set 2, vector 119 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000100 +Ciphertext: BE0D64EA88A3FF27C8DFCE13F13A4E1F +Test: Encrypt +Comment: Set 2, vector 120 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000080 +Ciphertext: D7629F1DD395A985AF9497F6ACB4EDA1 +Test: Encrypt +Comment: Set 2, vector 121 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000040 +Ciphertext: 33FDF72DA1D8815DE2DBE81D97DDC6F8 +Test: Encrypt +Comment: Set 2, vector 122 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000020 +Ciphertext: D35742045F3DF8D184D6CC58EB9DE323 +Test: Encrypt +Comment: Set 2, vector 123 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000010 +Ciphertext: DE6469D10C044ED53CFEB523C8DF34A2 +Test: Encrypt +Comment: Set 2, vector 124 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000008 +Ciphertext: 2FAEAC3A41CCEABA8140BDA9C7AC7740 +Test: Encrypt +Comment: Set 2, vector 125 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000004 +Ciphertext: 7BA6691787BF0C526F3697E2ED659B0D +Test: Encrypt +Comment: Set 2, vector 126 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000002 +Ciphertext: 8F9C0AA2549714C88BB2665E8AF86D41 +Test: Encrypt +Comment: Set 2, vector 127 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000001 +Ciphertext: BA9AE89FDDCE4B51131E17C4D65CE587 +Test: Encrypt +Comment: Set 3, vector 0 +Key: 000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 56E1E129CA5C02C7F9AC6AFDEF86ADC3 +Test: Encrypt +Comment: Set 3, vector 1 +Key: 010101010101010101010101010101010101010101010101 +Plaintext: 01010101010101010101010101010101 +Ciphertext: 8F764397C10BE84BA876CEEFA4225BFF +Test: Encrypt +Comment: Set 3, vector 2 +Key: 020202020202020202020202020202020202020202020202 +Plaintext: 02020202020202020202020202020202 +Ciphertext: 60B00674BFD444D07B5A19851E6151CD +Test: Encrypt +Comment: Set 3, vector 3 +Key: 030303030303030303030303030303030303030303030303 +Plaintext: 03030303030303030303030303030303 +Ciphertext: CF431D70E25D5450B9979C52E4ECF590 +Test: Encrypt +Comment: Set 3, vector 4 +Key: 040404040404040404040404040404040404040404040404 +Plaintext: 04040404040404040404040404040404 +Ciphertext: 81B26FF4F6B4377CC555873504B3A38B +Test: Encrypt +Comment: Set 3, vector 5 +Key: 050505050505050505050505050505050505050505050505 +Plaintext: 05050505050505050505050505050505 +Ciphertext: 8C864C445E6B9312E6F3843C53BF7870 +Test: Encrypt +Comment: Set 3, vector 6 +Key: 060606060606060606060606060606060606060606060606 +Plaintext: 06060606060606060606060606060606 +Ciphertext: 28C1EABB23C2A04E7A37BB0EF42D45A2 +Test: Encrypt +Comment: Set 3, vector 7 +Key: 070707070707070707070707070707070707070707070707 +Plaintext: 07070707070707070707070707070707 +Ciphertext: 0068C08827CBD904A3C0AF89A35CD8E6 +Test: Encrypt +Comment: Set 3, vector 8 +Key: 080808080808080808080808080808080808080808080808 +Plaintext: 08080808080808080808080808080808 +Ciphertext: A2AA1C6693DC2B70D75C9B39B9B214D0 +Test: Encrypt +Comment: Set 3, vector 9 +Key: 090909090909090909090909090909090909090909090909 +Plaintext: 09090909090909090909090909090909 +Ciphertext: 0423A756A133734C66944536033B978C +Test: Encrypt +Comment: Set 3, vector 10 +Key: 0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A +Plaintext: 0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A +Ciphertext: 279B7FA09352F4194B2C33089267BD2E +Test: Encrypt +Comment: Set 3, vector 11 +Key: 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B +Plaintext: 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B +Ciphertext: 7788EEE46AC2927434A93D3B5D295DF3 +Test: Encrypt +Comment: Set 3, vector 12 +Key: 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C +Plaintext: 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C +Ciphertext: 3A2D0C1F30AE1E50A61102D2DF5BEAE5 +Test: Encrypt +Comment: Set 3, vector 13 +Key: 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D +Plaintext: 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D +Ciphertext: 320FB708B47319484538CD73F8773526 +Test: Encrypt +Comment: Set 3, vector 14 +Key: 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E +Plaintext: 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E +Ciphertext: 6213EB688C8CDA5152A65BFC007BCAEA +Test: Encrypt +Comment: Set 3, vector 15 +Key: 0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F +Plaintext: 0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F +Ciphertext: D1904ACDB021DDCCCBE436CA7B5A4264 +Test: Encrypt +Comment: Set 3, vector 16 +Key: 101010101010101010101010101010101010101010101010 +Plaintext: 10101010101010101010101010101010 +Ciphertext: A907BFDAEEF8C81D05855235E8D3BE08 +Test: Encrypt +Comment: Set 3, vector 17 +Key: 111111111111111111111111111111111111111111111111 +Plaintext: 11111111111111111111111111111111 +Ciphertext: DB23D9326A998A4CB06AE04A8C592217 +Test: Encrypt +Comment: Set 3, vector 18 +Key: 121212121212121212121212121212121212121212121212 +Plaintext: 12121212121212121212121212121212 +Ciphertext: 472427C234EAE3082E84F493C9559792 +Test: Encrypt +Comment: Set 3, vector 19 +Key: 131313131313131313131313131313131313131313131313 +Plaintext: 13131313131313131313131313131313 +Ciphertext: EE4E318D27820F691BD3BDA9617561A0 +Test: Encrypt +Comment: Set 3, vector 20 +Key: 141414141414141414141414141414141414141414141414 +Plaintext: 14141414141414141414141414141414 +Ciphertext: 221E909D7B259C098480DBDE71BCF9BF +Test: Encrypt +Comment: Set 3, vector 21 +Key: 151515151515151515151515151515151515151515151515 +Plaintext: 15151515151515151515151515151515 +Ciphertext: 8702C6A150F2DD2E1736F09518C1A267 +Test: Encrypt +Comment: Set 3, vector 22 +Key: 161616161616161616161616161616161616161616161616 +Plaintext: 16161616161616161616161616161616 +Ciphertext: 7E8DAEBBA15C7B9705B501998F61CC6E +Test: Encrypt +Comment: Set 3, vector 23 +Key: 171717171717171717171717171717171717171717171717 +Plaintext: 17171717171717171717171717171717 +Ciphertext: 3DD555C7277FA156330D05CD621394D5 +Test: Encrypt +Comment: Set 3, vector 24 +Key: 181818181818181818181818181818181818181818181818 +Plaintext: 18181818181818181818181818181818 +Ciphertext: E5575CDC315F1C244441E6D1DE25ED20 +Test: Encrypt +Comment: Set 3, vector 25 +Key: 191919191919191919191919191919191919191919191919 +Plaintext: 19191919191919191919191919191919 +Ciphertext: 434859EB42087F83B9849DC23ABB7C1D +Test: Encrypt +Comment: Set 3, vector 26 +Key: 1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A +Plaintext: 1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A +Ciphertext: 1EA1A5CC662DCA0B56B2BBF560A1B032 +Test: Encrypt +Comment: Set 3, vector 27 +Key: 1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B +Plaintext: 1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B +Ciphertext: A3AC0CD9342242A72005F8E6DBF50DE8 +Test: Encrypt +Comment: Set 3, vector 28 +Key: 1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C +Plaintext: 1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C +Ciphertext: AF6251A285EBEA9408315822F2072D86 +Test: Encrypt +Comment: Set 3, vector 29 +Key: 1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D +Plaintext: 1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D +Ciphertext: FA084220DB82A88E6D7B6E7849550183 +Test: Encrypt +Comment: Set 3, vector 30 +Key: 1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E +Plaintext: 1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E +Ciphertext: E7AABEAA3F669E0D963A19C3BDE43676 +Test: Encrypt +Comment: Set 3, vector 31 +Key: 1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F +Plaintext: 1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F +Ciphertext: ED7C11A689A72FF834A777013DBEC50A +Test: Encrypt +Comment: Set 3, vector 32 +Key: 202020202020202020202020202020202020202020202020 +Plaintext: 20202020202020202020202020202020 +Ciphertext: 87F8EA30332036F17CEAC0097CE33BC1 +Test: Encrypt +Comment: Set 3, vector 33 +Key: 212121212121212121212121212121212121212121212121 +Plaintext: 21212121212121212121212121212121 +Ciphertext: E83CC178B21703D1BDFA0A1350A587F3 +Test: Encrypt +Comment: Set 3, vector 34 +Key: 222222222222222222222222222222222222222222222222 +Plaintext: 22222222222222222222222222222222 +Ciphertext: 581CF260A93B67E27BBA6D6D68C645B6 +Test: Encrypt +Comment: Set 3, vector 35 +Key: 232323232323232323232323232323232323232323232323 +Plaintext: 23232323232323232323232323232323 +Ciphertext: D7155FD4BABA5DAA1E0576BAF4BB3BDE +Test: Encrypt +Comment: Set 3, vector 36 +Key: 242424242424242424242424242424242424242424242424 +Plaintext: 24242424242424242424242424242424 +Ciphertext: 0C2382377892DC0CA4B1C7753CDB2753 +Test: Encrypt +Comment: Set 3, vector 37 +Key: 252525252525252525252525252525252525252525252525 +Plaintext: 25252525252525252525252525252525 +Ciphertext: 9E568ACFE44E1926BE207D25107EBD90 +Test: Encrypt +Comment: Set 3, vector 38 +Key: 262626262626262626262626262626262626262626262626 +Plaintext: 26262626262626262626262626262626 +Ciphertext: 1F9C7FEF0BA7D4C38555B957FA9FDAC8 +Test: Encrypt +Comment: Set 3, vector 39 +Key: 272727272727272727272727272727272727272727272727 +Plaintext: 27272727272727272727272727272727 +Ciphertext: 2C00730AAB18247D4F79C8BA0107E759 +Test: Encrypt +Comment: Set 3, vector 40 +Key: 282828282828282828282828282828282828282828282828 +Plaintext: 28282828282828282828282828282828 +Ciphertext: 26150BB68C5529903D3624CB8F36D717 +Test: Encrypt +Comment: Set 3, vector 41 +Key: 292929292929292929292929292929292929292929292929 +Plaintext: 29292929292929292929292929292929 +Ciphertext: C6F9CD75F9DC3DF5C945E028038660AB +Test: Encrypt +Comment: Set 3, vector 42 +Key: 2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A +Plaintext: 2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A +Ciphertext: 9D90F692A1149E3E7F19BE419038F42F +Test: Encrypt +Comment: Set 3, vector 43 +Key: 2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B +Plaintext: 2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B +Ciphertext: 9981F6F8C071F4CAF3E25884B8749FD3 +Test: Encrypt +Comment: Set 3, vector 44 +Key: 2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C +Plaintext: 2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C +Ciphertext: 62957FC449C78B7EABA9C41B335F731E +Test: Encrypt +Comment: Set 3, vector 45 +Key: 2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D +Plaintext: 2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D +Ciphertext: 265E17BD08B2E34BC879D5BC801D1217 +Test: Encrypt +Comment: Set 3, vector 46 +Key: 2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E +Plaintext: 2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E +Ciphertext: 55BBE8CE99907AC77D4F009EABA6B8D9 +Test: Encrypt +Comment: Set 3, vector 47 +Key: 2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F +Plaintext: 2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F +Ciphertext: EECB495C2F81243857D0A1A8919F9C7E +Test: Encrypt +Comment: Set 3, vector 48 +Key: 303030303030303030303030303030303030303030303030 +Plaintext: 30303030303030303030303030303030 +Ciphertext: E3BA996DF81895C86E30500CE9F7ED01 +Test: Encrypt +Comment: Set 3, vector 49 +Key: 313131313131313131313131313131313131313131313131 +Plaintext: 31313131313131313131313131313131 +Ciphertext: E507914B7CDDB2A3A915EB5663CE43CE +Test: Encrypt +Comment: Set 3, vector 50 +Key: 323232323232323232323232323232323232323232323232 +Plaintext: 32323232323232323232323232323232 +Ciphertext: AA2E53FC2D073DE62554691F507B23FF +Test: Encrypt +Comment: Set 3, vector 51 +Key: 333333333333333333333333333333333333333333333333 +Plaintext: 33333333333333333333333333333333 +Ciphertext: 875707D7E4FA8028D878DFB8338160FF +Test: Encrypt +Comment: Set 3, vector 52 +Key: 343434343434343434343434343434343434343434343434 +Plaintext: 34343434343434343434343434343434 +Ciphertext: 1158285A6787F8B6500E9FB046D88FB7 +Test: Encrypt +Comment: Set 3, vector 53 +Key: 353535353535353535353535353535353535353535353535 +Plaintext: 35353535353535353535353535353535 +Ciphertext: 6BFF4FB554ADD3F4321E6BA6029CD48A +Test: Encrypt +Comment: Set 3, vector 54 +Key: 363636363636363636363636363636363636363636363636 +Plaintext: 36363636363636363636363636363636 +Ciphertext: 8F2077CE672419A3AE15CA8800D5ACF8 +Test: Encrypt +Comment: Set 3, vector 55 +Key: 373737373737373737373737373737373737373737373737 +Plaintext: 37373737373737373737373737373737 +Ciphertext: 80ECE69E3EEBD391FCAEA8B3B38578D9 +Test: Encrypt +Comment: Set 3, vector 56 +Key: 383838383838383838383838383838383838383838383838 +Plaintext: 38383838383838383838383838383838 +Ciphertext: A23A2ADDE21BDB44EF99072331FA8EAB +Test: Encrypt +Comment: Set 3, vector 57 +Key: 393939393939393939393939393939393939393939393939 +Plaintext: 39393939393939393939393939393939 +Ciphertext: 8E41065415264354D4DC276F6ED582B9 +Test: Encrypt +Comment: Set 3, vector 58 +Key: 3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A +Plaintext: 3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A +Ciphertext: D591D51BA578836C7D3945991FD0184A +Test: Encrypt +Comment: Set 3, vector 59 +Key: 3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B +Plaintext: 3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B +Ciphertext: B88105C11F9FFCA9037E1F90FAE1C61E +Test: Encrypt +Comment: Set 3, vector 60 +Key: 3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C +Plaintext: 3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C +Ciphertext: F8A1A047994B4363028BC1B3B6339954 +Test: Encrypt +Comment: Set 3, vector 61 +Key: 3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D +Plaintext: 3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D +Ciphertext: EFB57CEA359E1F9F68729B156BEBDCB8 +Test: Encrypt +Comment: Set 3, vector 62 +Key: 3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E +Plaintext: 3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E +Ciphertext: 2323D15570873D4E5616CDDC466B1D34 +Test: Encrypt +Comment: Set 3, vector 63 +Key: 3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F +Plaintext: 3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F +Ciphertext: 842C7B6C67BB38B508558058531B37FE +Test: Encrypt +Comment: Set 3, vector 64 +Key: 404040404040404040404040404040404040404040404040 +Plaintext: 40404040404040404040404040404040 +Ciphertext: A2C32EA499E41A248565253BACC11E3B +Test: Encrypt +Comment: Set 3, vector 65 +Key: 414141414141414141414141414141414141414141414141 +Plaintext: 41414141414141414141414141414141 +Ciphertext: CF72033A0BA3E03A8B1E336F85100489 +Test: Encrypt +Comment: Set 3, vector 66 +Key: 424242424242424242424242424242424242424242424242 +Plaintext: 42424242424242424242424242424242 +Ciphertext: 0A194208C1B722A5719C14231EE4C532 +Test: Encrypt +Comment: Set 3, vector 67 +Key: 434343434343434343434343434343434343434343434343 +Plaintext: 43434343434343434343434343434343 +Ciphertext: 7365018F7A2564165EC162F948C4824A +Test: Encrypt +Comment: Set 3, vector 68 +Key: 444444444444444444444444444444444444444444444444 +Plaintext: 44444444444444444444444444444444 +Ciphertext: 20AC87CE21C47D99D6D2202B0C62E52D +Test: Encrypt +Comment: Set 3, vector 69 +Key: 454545454545454545454545454545454545454545454545 +Plaintext: 45454545454545454545454545454545 +Ciphertext: 72D32F7C4D03529C7DBF6865E36E7C84 +Test: Encrypt +Comment: Set 3, vector 70 +Key: 464646464646464646464646464646464646464646464646 +Plaintext: 46464646464646464646464646464646 +Ciphertext: 18E88EF941A7D1793B8D545323CCBD7E +Test: Encrypt +Comment: Set 3, vector 71 +Key: 474747474747474747474747474747474747474747474747 +Plaintext: 47474747474747474747474747474747 +Ciphertext: C87B12CD28646842FCE0C8658EA8A6C9 +Test: Encrypt +Comment: Set 3, vector 72 +Key: 484848484848484848484848484848484848484848484848 +Plaintext: 48484848484848484848484848484848 +Ciphertext: 03347AC4B4D0AE9C208B1B12802E6562 +Test: Encrypt +Comment: Set 3, vector 73 +Key: 494949494949494949494949494949494949494949494949 +Plaintext: 49494949494949494949494949494949 +Ciphertext: A5F9E726E53A74C9CF59E7CBBCE507D1 +Test: Encrypt +Comment: Set 3, vector 74 +Key: 4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A +Plaintext: 4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A +Ciphertext: 228C852461BBB0BB12B3F9192311DFDD +Test: Encrypt +Comment: Set 3, vector 75 +Key: 4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B +Plaintext: 4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B +Ciphertext: DFD5B30B1401FBE49EA0C725E64B91A3 +Test: Encrypt +Comment: Set 3, vector 76 +Key: 4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C +Plaintext: 4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C +Ciphertext: 38D59DD18C98488451070B28F91A15C0 +Test: Encrypt +Comment: Set 3, vector 77 +Key: 4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D +Plaintext: 4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D +Ciphertext: E6A73709A37C7B00484BD54EED3A6128 +Test: Encrypt +Comment: Set 3, vector 78 +Key: 4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E +Plaintext: 4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E +Ciphertext: 12A6AD3ED9A3BA4FBA285B64D4823706 +Test: Encrypt +Comment: Set 3, vector 79 +Key: 4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F +Plaintext: 4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F +Ciphertext: CCB3FFAD253207DFB312A8B4FE0F390D +Test: Encrypt +Comment: Set 3, vector 80 +Key: 505050505050505050505050505050505050505050505050 +Plaintext: 50505050505050505050505050505050 +Ciphertext: A1C7DFA83502CE5558242F83CC12BF82 +Test: Encrypt +Comment: Set 3, vector 81 +Key: 515151515151515151515151515151515151515151515151 +Plaintext: 51515151515151515151515151515151 +Ciphertext: C9C8FCD1E4E482AF47555FEA823DE62A +Test: Encrypt +Comment: Set 3, vector 82 +Key: 525252525252525252525252525252525252525252525252 +Plaintext: 52525252525252525252525252525252 +Ciphertext: 5F9DD3265B6B043BF4CE8E11A3DAE4E1 +Test: Encrypt +Comment: Set 3, vector 83 +Key: 535353535353535353535353535353535353535353535353 +Plaintext: 53535353535353535353535353535353 +Ciphertext: 79D02BFAD35C67C8586694A068662F1D +Test: Encrypt +Comment: Set 3, vector 84 +Key: 545454545454545454545454545454545454545454545454 +Plaintext: 54545454545454545454545454545454 +Ciphertext: 361AC03A4827F590A5DDE28A5FFF723A +Test: Encrypt +Comment: Set 3, vector 85 +Key: 555555555555555555555555555555555555555555555555 +Plaintext: 55555555555555555555555555555555 +Ciphertext: 1758AC2E8DDE2126621AEB5759FC93D0 +Test: Encrypt +Comment: Set 3, vector 86 +Key: 565656565656565656565656565656565656565656565656 +Plaintext: 56565656565656565656565656565656 +Ciphertext: 14422A052A86DC0033B70F77D46A7E3C +Test: Encrypt +Comment: Set 3, vector 87 +Key: 575757575757575757575757575757575757575757575757 +Plaintext: 57575757575757575757575757575757 +Ciphertext: 154457A732BC11F0A4C43BEC607B9B91 +Test: Encrypt +Comment: Set 3, vector 88 +Key: 585858585858585858585858585858585858585858585858 +Plaintext: 58585858585858585858585858585858 +Ciphertext: 789BBC53CBE8A7D6119F61C8DC5DAEAB +Test: Encrypt +Comment: Set 3, vector 89 +Key: 595959595959595959595959595959595959595959595959 +Plaintext: 59595959595959595959595959595959 +Ciphertext: 6F8CDA92BF849BE59858544689DA2ACE +Test: Encrypt +Comment: Set 3, vector 90 +Key: 5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A +Plaintext: 5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A +Ciphertext: CCA696D494AF8877C0753106D5AD07A6 +Test: Encrypt +Comment: Set 3, vector 91 +Key: 5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B +Plaintext: 5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B +Ciphertext: E76884CA9F00DCF95BBB15C5FBB26D1C +Test: Encrypt +Comment: Set 3, vector 92 +Key: 5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C +Plaintext: 5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C +Ciphertext: CD3FA7BC9EC9EC0B0CF4F5A82A98550E +Test: Encrypt +Comment: Set 3, vector 93 +Key: 5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D +Plaintext: 5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D +Ciphertext: BC2FB535DC0D8C86682E32AC3761F299 +Test: Encrypt +Comment: Set 3, vector 94 +Key: 5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E +Plaintext: 5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E +Ciphertext: AB19152E1788D8B2878357484832BB27 +Test: Encrypt +Comment: Set 3, vector 95 +Key: 5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F +Plaintext: 5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F +Ciphertext: 87D1D7E297CED2C6606A171794FE1BB2 +Test: Encrypt +Comment: Set 3, vector 96 +Key: 606060606060606060606060606060606060606060606060 +Plaintext: 60606060606060606060606060606060 +Ciphertext: 6BF6F1728474F1050F712A0FF3F59319 +Test: Encrypt +Comment: Set 3, vector 97 +Key: 616161616161616161616161616161616161616161616161 +Plaintext: 61616161616161616161616161616161 +Ciphertext: 46646FF0ED8A8EDB395BA4B3DC97A35F +Test: Encrypt +Comment: Set 3, vector 98 +Key: 626262626262626262626262626262626262626262626262 +Plaintext: 62626262626262626262626262626262 +Ciphertext: F558C5F67CDF59374F5426D5846A622E +Test: Encrypt +Comment: Set 3, vector 99 +Key: 636363636363636363636363636363636363636363636363 +Plaintext: 63636363636363636363636363636363 +Ciphertext: E06CC0A3436C80F5F0271ACFC8F535D3 +Test: Encrypt +Comment: Set 3, vector 100 +Key: 646464646464646464646464646464646464646464646464 +Plaintext: 64646464646464646464646464646464 +Ciphertext: 903AA2EA9F99C3CCDD1EF1CD906FC800 +Test: Encrypt +Comment: Set 3, vector 101 +Key: 656565656565656565656565656565656565656565656565 +Plaintext: 65656565656565656565656565656565 +Ciphertext: EAE1010E86CF45476CEB180E78608841 +Test: Encrypt +Comment: Set 3, vector 102 +Key: 666666666666666666666666666666666666666666666666 +Plaintext: 66666666666666666666666666666666 +Ciphertext: 341F33B7FB7C5807BFB4C2C497565817 +Test: Encrypt +Comment: Set 3, vector 103 +Key: 676767676767676767676767676767676767676767676767 +Plaintext: 67676767676767676767676767676767 +Ciphertext: 4DA345AB1B3F7575F8D01BED5C17AF26 +Test: Encrypt +Comment: Set 3, vector 104 +Key: 686868686868686868686868686868686868686868686868 +Plaintext: 68686868686868686868686868686868 +Ciphertext: 1613C2DE21E7082312BF414C88310FAB +Test: Encrypt +Comment: Set 3, vector 105 +Key: 696969696969696969696969696969696969696969696969 +Plaintext: 69696969696969696969696969696969 +Ciphertext: 474D73001BD4BF9A9B79CFF79198E2F3 +Test: Encrypt +Comment: Set 3, vector 106 +Key: 6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A +Plaintext: 6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A +Ciphertext: 9C487E0BFB6FE07C521C663D03F175CF +Test: Encrypt +Comment: Set 3, vector 107 +Key: 6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B +Plaintext: 6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B +Ciphertext: 39F5672BEFCFCC072F292D47AD481DC7 +Test: Encrypt +Comment: Set 3, vector 108 +Key: 6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C +Plaintext: 6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C +Ciphertext: D9B86F02C3CB07CEF53834924A01DF14 +Test: Encrypt +Comment: Set 3, vector 109 +Key: 6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D +Plaintext: 6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D +Ciphertext: B42C9F4A33C5425FB20425889ECFFB9D +Test: Encrypt +Comment: Set 3, vector 110 +Key: 6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E +Plaintext: 6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E +Ciphertext: 832D535E3B4C40113C82AE10A7E1B78A +Test: Encrypt +Comment: Set 3, vector 111 +Key: 6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F +Plaintext: 6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F +Ciphertext: E9A8F63AAF1B1FFF05CFEB7E22E519DF +Test: Encrypt +Comment: Set 3, vector 112 +Key: 707070707070707070707070707070707070707070707070 +Plaintext: 70707070707070707070707070707070 +Ciphertext: C61B4EF13F07576701B1018AC9F01863 +Test: Encrypt +Comment: Set 3, vector 113 +Key: 717171717171717171717171717171717171717171717171 +Plaintext: 71717171717171717171717171717171 +Ciphertext: B098DBE07C3528931F14D40AC9F99ACC +Test: Encrypt +Comment: Set 3, vector 114 +Key: 727272727272727272727272727272727272727272727272 +Plaintext: 72727272727272727272727272727272 +Ciphertext: 3FCC0182E96BC01863EB161967D6482A +Test: Encrypt +Comment: Set 3, vector 115 +Key: 737373737373737373737373737373737373737373737373 +Plaintext: 73737373737373737373737373737373 +Ciphertext: D8F20E80F4AC4666066B0E3F1966C8DA +Test: Encrypt +Comment: Set 3, vector 116 +Key: 747474747474747474747474747474747474747474747474 +Plaintext: 74747474747474747474747474747474 +Ciphertext: 4E96D8CC1A34E3C38C37B5339CF26A5D +Test: Encrypt +Comment: Set 3, vector 117 +Key: 757575757575757575757575757575757575757575757575 +Plaintext: 75757575757575757575757575757575 +Ciphertext: 266EDB14B89857636C0F8E8C7D2FACD8 +Test: Encrypt +Comment: Set 3, vector 118 +Key: 767676767676767676767676767676767676767676767676 +Plaintext: 76767676767676767676767676767676 +Ciphertext: 1D060BD61CFA82764CE4DF283FCB2278 +Test: Encrypt +Comment: Set 3, vector 119 +Key: 777777777777777777777777777777777777777777777777 +Plaintext: 77777777777777777777777777777777 +Ciphertext: 4734355A933BFC1F2918CDF1A4E2BAAE +Test: Encrypt +Comment: Set 3, vector 120 +Key: 787878787878787878787878787878787878787878787878 +Plaintext: 78787878787878787878787878787878 +Ciphertext: DADBACBB42FEB35635A8DEBBFA93F5BA +Test: Encrypt +Comment: Set 3, vector 121 +Key: 797979797979797979797979797979797979797979797979 +Plaintext: 79797979797979797979797979797979 +Ciphertext: 8BB5C2E0B44B986EF523870C41721B7D +Test: Encrypt +Comment: Set 3, vector 122 +Key: 7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A +Plaintext: 7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A +Ciphertext: F66844E5DC500F43FF95E05965BAFD63 +Test: Encrypt +Comment: Set 3, vector 123 +Key: 7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B +Plaintext: 7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B +Ciphertext: ECC75A2BE7E27481907621A1796DC821 +Test: Encrypt +Comment: Set 3, vector 124 +Key: 7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C +Plaintext: 7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C +Ciphertext: D195666137F49B67F80EBC8C3ED824BF +Test: Encrypt +Comment: Set 3, vector 125 +Key: 7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D +Plaintext: 7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D +Ciphertext: 2F1ACC482BE5DEFD3EC1AD1F3A064A60 +Test: Encrypt +Comment: Set 3, vector 126 +Key: 7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E +Plaintext: 7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E +Ciphertext: 5FDDFA05A7F72D294DC386260DC59009 +Test: Encrypt +Comment: Set 3, vector 127 +Key: 7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F +Plaintext: 7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F +Ciphertext: FE94D733BABEB5A5382C2816311E515E +Test: Encrypt +Comment: Set 3, vector 128 +Key: 808080808080808080808080808080808080808080808080 +Plaintext: 80808080808080808080808080808080 +Ciphertext: F602BA7F515B082983B8F7A27F92408F +Test: Encrypt +Comment: Set 3, vector 129 +Key: 818181818181818181818181818181818181818181818181 +Plaintext: 81818181818181818181818181818181 +Ciphertext: 48E95062B889D83CC72767E303329710 +Test: Encrypt +Comment: Set 3, vector 130 +Key: 828282828282828282828282828282828282828282828282 +Plaintext: 82828282828282828282828282828282 +Ciphertext: 0D98319B8ED1E612F063591AAFA95962 +Test: Encrypt +Comment: Set 3, vector 131 +Key: 838383838383838383838383838383838383838383838383 +Plaintext: 83838383838383838383838383838383 +Ciphertext: 6D987B21F8072C09514C711819BDF42D +Test: Encrypt +Comment: Set 3, vector 132 +Key: 848484848484848484848484848484848484848484848484 +Plaintext: 84848484848484848484848484848484 +Ciphertext: 56C6CA23BC6A52C9967D70C6471A0788 +Test: Encrypt +Comment: Set 3, vector 133 +Key: 858585858585858585858585858585858585858585858585 +Plaintext: 85858585858585858585858585858585 +Ciphertext: 03C1004551B9B74D96CC3F9F7D11B04A +Test: Encrypt +Comment: Set 3, vector 134 +Key: 868686868686868686868686868686868686868686868686 +Plaintext: 86868686868686868686868686868686 +Ciphertext: 6356481250E8D52A0D922985BB2BED27 +Test: Encrypt +Comment: Set 3, vector 135 +Key: 878787878787878787878787878787878787878787878787 +Plaintext: 87878787878787878787878787878787 +Ciphertext: BC51A66892A956F44BF75168E935720E +Test: Encrypt +Comment: Set 3, vector 136 +Key: 888888888888888888888888888888888888888888888888 +Plaintext: 88888888888888888888888888888888 +Ciphertext: 73FAAAFB0517BD4D459A250E2CA4F017 +Test: Encrypt +Comment: Set 3, vector 137 +Key: 898989898989898989898989898989898989898989898989 +Plaintext: 89898989898989898989898989898989 +Ciphertext: 160C7D6510CCEB35318629FFFE1E8BA7 +Test: Encrypt +Comment: Set 3, vector 138 +Key: 8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A +Plaintext: 8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A +Ciphertext: 785ECC6F1A9415EBB05A4990786865A5 +Test: Encrypt +Comment: Set 3, vector 139 +Key: 8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B +Plaintext: 8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B +Ciphertext: 210498B4AC4D909CC7D6DAD6B8851C1A +Test: Encrypt +Comment: Set 3, vector 140 +Key: 8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C +Plaintext: 8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C +Ciphertext: 7094C31A06ED2AA0B3B63C210DEB96E2 +Test: Encrypt +Comment: Set 3, vector 141 +Key: 8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D +Plaintext: 8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D +Ciphertext: F8426DAE3B7C3FF568456EB4D4EB623B +Test: Encrypt +Comment: Set 3, vector 142 +Key: 8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E +Plaintext: 8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E +Ciphertext: 090487421369DED8EAC9812B544A29BE +Test: Encrypt +Comment: Set 3, vector 143 +Key: 8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F +Plaintext: 8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F +Ciphertext: 1AFA1FC5ECA8EAD74F9FE9B67993CB6F +Test: Encrypt +Comment: Set 3, vector 144 +Key: 909090909090909090909090909090909090909090909090 +Plaintext: 90909090909090909090909090909090 +Ciphertext: 38124FCE77189341DE7B225951CDE6E9 +Test: Encrypt +Comment: Set 3, vector 145 +Key: 919191919191919191919191919191919191919191919191 +Plaintext: 91919191919191919191919191919191 +Ciphertext: 059A775350A44BB880A750B32B19E179 +Test: Encrypt +Comment: Set 3, vector 146 +Key: 929292929292929292929292929292929292929292929292 +Plaintext: 92929292929292929292929292929292 +Ciphertext: 7CFA631E8BABF7DEE00DAB0754C385DD +Test: Encrypt +Comment: Set 3, vector 147 +Key: 939393939393939393939393939393939393939393939393 +Plaintext: 93939393939393939393939393939393 +Ciphertext: 0632ED71BA440232DECE4F1B38F94323 +Test: Encrypt +Comment: Set 3, vector 148 +Key: 949494949494949494949494949494949494949494949494 +Plaintext: 94949494949494949494949494949494 +Ciphertext: D049FF03ACF47C866A4209E7588E0CFA +Test: Encrypt +Comment: Set 3, vector 149 +Key: 959595959595959595959595959595959595959595959595 +Plaintext: 95959595959595959595959595959595 +Ciphertext: 910408E331C64A71D50A149DFD50C242 +Test: Encrypt +Comment: Set 3, vector 150 +Key: 969696969696969696969696969696969696969696969696 +Plaintext: 96969696969696969696969696969696 +Ciphertext: 0829C2DD4AF8F06C30978A0199A43C3C +Test: Encrypt +Comment: Set 3, vector 151 +Key: 979797979797979797979797979797979797979797979797 +Plaintext: 97979797979797979797979797979797 +Ciphertext: C70D286C18D2A0EA5D16FEB97F35DE6F +Test: Encrypt +Comment: Set 3, vector 152 +Key: 989898989898989898989898989898989898989898989898 +Plaintext: 98989898989898989898989898989898 +Ciphertext: A220CD3CD177BDD73D44B6D4A7A9ED0E +Test: Encrypt +Comment: Set 3, vector 153 +Key: 999999999999999999999999999999999999999999999999 +Plaintext: 99999999999999999999999999999999 +Ciphertext: 74EC1A68010A0D5FA9688F1552E70EF5 +Test: Encrypt +Comment: Set 3, vector 154 +Key: 9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A +Plaintext: 9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A +Ciphertext: C1C0EE9EEA079CCE8544BA9940963720 +Test: Encrypt +Comment: Set 3, vector 155 +Key: 9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B +Plaintext: 9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B +Ciphertext: 500418F7142C273CCADBDAD8831619D2 +Test: Encrypt +Comment: Set 3, vector 156 +Key: 9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C +Plaintext: 9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C +Ciphertext: 703A0223D3ABA658C531F9BE03F6E842 +Test: Encrypt +Comment: Set 3, vector 157 +Key: 9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D +Plaintext: 9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D +Ciphertext: EBC65558CD43197D87CFF645FDBA1661 +Test: Encrypt +Comment: Set 3, vector 158 +Key: 9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E +Plaintext: 9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E +Ciphertext: 6F6E140E44934DA754F008EB5597BDA3 +Test: Encrypt +Comment: Set 3, vector 159 +Key: 9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F +Plaintext: 9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F +Ciphertext: 3D533A98B85CDD624541956E348ACBD3 +Test: Encrypt +Comment: Set 3, vector 160 +Key: A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0 +Plaintext: A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0 +Ciphertext: 13833D60F1D247019258C457E9F2292A +Test: Encrypt +Comment: Set 3, vector 161 +Key: A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1 +Plaintext: A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1 +Ciphertext: FC13CECE4F5E2467427582595EDB6B87 +Test: Encrypt +Comment: Set 3, vector 162 +Key: A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2 +Plaintext: A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2 +Ciphertext: 2772A4E636F01514949D47B037825AF9 +Test: Encrypt +Comment: Set 3, vector 163 +Key: A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3 +Plaintext: A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3 +Ciphertext: F13DC1CCF105212AF8BC4F73F0AEF272 +Test: Encrypt +Comment: Set 3, vector 164 +Key: A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4 +Plaintext: A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4 +Ciphertext: A6EB0CABBBA03DB1B2425E6FC559B06A +Test: Encrypt +Comment: Set 3, vector 165 +Key: A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5 +Plaintext: A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5 +Ciphertext: 32222D875D9E73DE72848EA88AC9B259 +Test: Encrypt +Comment: Set 3, vector 166 +Key: A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6 +Plaintext: A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6 +Ciphertext: 7DA6BC64D1E71FFE2D24C1A2FF7405BF +Test: Encrypt +Comment: Set 3, vector 167 +Key: A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7 +Plaintext: A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7 +Ciphertext: AD5129092054880300AFCF09A2921DAF +Test: Encrypt +Comment: Set 3, vector 168 +Key: A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8 +Plaintext: A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8 +Ciphertext: FCF2E0AA207754597C8C00A4615B5B5B +Test: Encrypt +Comment: Set 3, vector 169 +Key: A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9 +Plaintext: A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9 +Ciphertext: 83D1475128C93C79BFE2AC9DA7E5D7BC +Test: Encrypt +Comment: Set 3, vector 170 +Key: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +Plaintext: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +Ciphertext: 9BA09846E13568B746B7D6A43364915F +Test: Encrypt +Comment: Set 3, vector 171 +Key: ABABABABABABABABABABABABABABABABABABABABABABABAB +Plaintext: ABABABABABABABABABABABABABABABAB +Ciphertext: 387BDB77D285F9E59CB88CD830CB31E2 +Test: Encrypt +Comment: Set 3, vector 172 +Key: ACACACACACACACACACACACACACACACACACACACACACACACAC +Plaintext: ACACACACACACACACACACACACACACACAC +Ciphertext: 82BFCC439310DD5DC411CCD4451E789B +Test: Encrypt +Comment: Set 3, vector 173 +Key: ADADADADADADADADADADADADADADADADADADADADADADADAD +Plaintext: ADADADADADADADADADADADADADADADAD +Ciphertext: 34C4240853DA191DF1D63E83401CE0E2 +Test: Encrypt +Comment: Set 3, vector 174 +Key: AEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAE +Plaintext: AEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAE +Ciphertext: B3CE3C38C10A667F5FD67BC8B7037283 +Test: Encrypt +Comment: Set 3, vector 175 +Key: AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF +Plaintext: AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF +Ciphertext: BEF04E726DC1D5D1D4AB0A025CFDFD7D +Test: Encrypt +Comment: Set 3, vector 176 +Key: B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0 +Plaintext: B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0 +Ciphertext: 725D70D564E78095739EA7980B481056 +Test: Encrypt +Comment: Set 3, vector 177 +Key: B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 +Plaintext: B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 +Ciphertext: CAB9293C9E3A82D40E85558F9DA488C1 +Test: Encrypt +Comment: Set 3, vector 178 +Key: B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 +Plaintext: B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 +Ciphertext: B433CACA5FF9F5AADB6BAFB7D4BE81FC +Test: Encrypt +Comment: Set 3, vector 179 +Key: B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3 +Plaintext: B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3 +Ciphertext: 3910F153098B638696101E04022A7849 +Test: Encrypt +Comment: Set 3, vector 180 +Key: B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4 +Plaintext: B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4 +Ciphertext: 1D7FF785CFC6AF98C5C81CDA2ABC9816 +Test: Encrypt +Comment: Set 3, vector 181 +Key: B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5 +Plaintext: B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5 +Ciphertext: 4A30C5521BAC28E5942808CB536376C7 +Test: Encrypt +Comment: Set 3, vector 182 +Key: B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6 +Plaintext: B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6 +Ciphertext: 17B908EF18EB7703DDB667C7A8DBA777 +Test: Encrypt +Comment: Set 3, vector 183 +Key: B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7 +Plaintext: B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7 +Ciphertext: 3222E0228F29C9F27467CB7047838E39 +Test: Encrypt +Comment: Set 3, vector 184 +Key: B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8 +Plaintext: B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8 +Ciphertext: E422497D1FD54DF8F9CEE11548D77303 +Test: Encrypt +Comment: Set 3, vector 185 +Key: B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9 +Plaintext: B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9 +Ciphertext: B26A00606A375B1A64B7F0C333D81A50 +Test: Encrypt +Comment: Set 3, vector 186 +Key: BABABABABABABABABABABABABABABABABABABABABABABABA +Plaintext: BABABABABABABABABABABABABABABABA +Ciphertext: D5032B06E290F6B76327E47E519F8F6D +Test: Encrypt +Comment: Set 3, vector 187 +Key: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +Plaintext: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +Ciphertext: 2CED7355B82DF3B88C4417149FFA1783 +Test: Encrypt +Comment: Set 3, vector 188 +Key: BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC +Plaintext: BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC +Ciphertext: FC7B4D95C62CA6D33862D56768EA9A1A +Test: Encrypt +Comment: Set 3, vector 189 +Key: BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD +Plaintext: BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD +Ciphertext: 375A9C1E1FCFA6F2369306D966F82156 +Test: Encrypt +Comment: Set 3, vector 190 +Key: BEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBE +Plaintext: BEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBE +Ciphertext: BA4C218D8691D5D9CE15ECCC75C75D8B +Test: Encrypt +Comment: Set 3, vector 191 +Key: BFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBF +Plaintext: BFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBF +Ciphertext: 4D5C53279B76A6F74195C65F09DF85D9 +Test: Encrypt +Comment: Set 3, vector 192 +Key: C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +Plaintext: C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +Ciphertext: 75CF5E6B3B0BFFF2290A5E58A85CF994 +Test: Encrypt +Comment: Set 3, vector 193 +Key: C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1 +Plaintext: C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1 +Ciphertext: 3482A5C83234E75CB443E09BA17EE3A0 +Test: Encrypt +Comment: Set 3, vector 194 +Key: C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2 +Plaintext: C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2 +Ciphertext: DA592D849C1BFBBEF5C3D0D8DA0F4B9A +Test: Encrypt +Comment: Set 3, vector 195 +Key: C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3 +Plaintext: C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3 +Ciphertext: 6656047376A76ED53FFF8C5DE1B6F886 +Test: Encrypt +Comment: Set 3, vector 196 +Key: C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4 +Plaintext: C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4 +Ciphertext: F86FD06864804515B17B453F8A42A44D +Test: Encrypt +Comment: Set 3, vector 197 +Key: C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5 +Plaintext: C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5 +Ciphertext: E57CD8E81BBF5B42446A7880B32A9A2F +Test: Encrypt +Comment: Set 3, vector 198 +Key: C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6 +Plaintext: C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6 +Ciphertext: A17219F7DEFF2985BDFADD62A6854947 +Test: Encrypt +Comment: Set 3, vector 199 +Key: C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7 +Plaintext: C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7 +Ciphertext: FF288A92FB408DA875531D163CE0105A +Test: Encrypt +Comment: Set 3, vector 200 +Key: C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8 +Plaintext: C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8 +Ciphertext: 11828CD066FD12620DFA16358CF1A705 +Test: Encrypt +Comment: Set 3, vector 201 +Key: C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9 +Plaintext: C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9 +Ciphertext: 6FA5DCBD14D2520E7F8147EDBEBBEAEE +Test: Encrypt +Comment: Set 3, vector 202 +Key: CACACACACACACACACACACACACACACACACACACACACACACACA +Plaintext: CACACACACACACACACACACACACACACACA +Ciphertext: F365CE3849AFB23AF3B62D7CFF80B19B +Test: Encrypt +Comment: Set 3, vector 203 +Key: CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB +Plaintext: CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB +Ciphertext: 74BE047CAAE10D095B3BDA14016EA262 +Test: Encrypt +Comment: Set 3, vector 204 +Key: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +Plaintext: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +Ciphertext: DC7A7D66AD1ABF1C7AA28891BE685AB5 +Test: Encrypt +Comment: Set 3, vector 205 +Key: CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD +Plaintext: CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD +Ciphertext: 8BED9C5BAD5C4A4AFB41CDFD7E88BB97 +Test: Encrypt +Comment: Set 3, vector 206 +Key: CECECECECECECECECECECECECECECECECECECECECECECECE +Plaintext: CECECECECECECECECECECECECECECECE +Ciphertext: 915FF93DC6A3984F11AB60BD2AA3DC61 +Test: Encrypt +Comment: Set 3, vector 207 +Key: CFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCF +Plaintext: CFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCF +Ciphertext: 43DFEEBBFB3692763752E6EA8931A9B8 +Test: Encrypt +Comment: Set 3, vector 208 +Key: D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0 +Plaintext: D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0 +Ciphertext: 2BB966115263DF2296C5D23E02D9C335 +Test: Encrypt +Comment: Set 3, vector 209 +Key: D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1 +Plaintext: D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1 +Ciphertext: FCCA1E3616236F0D5A1A9D035A35049D +Test: Encrypt +Comment: Set 3, vector 210 +Key: D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2 +Plaintext: D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2 +Ciphertext: 2E7246518C923B2AE23C61C99D7E6CE7 +Test: Encrypt +Comment: Set 3, vector 211 +Key: D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3 +Plaintext: D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3 +Ciphertext: 8D19232494905BAF83F4230395C8E09B +Test: Encrypt +Comment: Set 3, vector 212 +Key: D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4 +Plaintext: D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4 +Ciphertext: 6BC0BBCC76A7F8DF2A03BAB1CDE47FB6 +Test: Encrypt +Comment: Set 3, vector 213 +Key: D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5 +Plaintext: D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5 +Ciphertext: BD3D30B62DC0B0FEED0CC760879DB806 +Test: Encrypt +Comment: Set 3, vector 214 +Key: D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6 +Plaintext: D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6 +Ciphertext: 647388D8E6A9C8D09828041F4E338D47 +Test: Encrypt +Comment: Set 3, vector 215 +Key: D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7 +Plaintext: D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7 +Ciphertext: 4861CFC3FDDC434F2742E45B97FBB270 +Test: Encrypt +Comment: Set 3, vector 216 +Key: D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8 +Plaintext: D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8 +Ciphertext: 4426BC1C3990A5DE10760D0C10A3BB9A +Test: Encrypt +Comment: Set 3, vector 217 +Key: D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9 +Plaintext: D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9 +Ciphertext: 805211D0BD914F07AB1579EF9E3827EE +Test: Encrypt +Comment: Set 3, vector 218 +Key: DADADADADADADADADADADADADADADADADADADADADADADADA +Plaintext: DADADADADADADADADADADADADADADADA +Ciphertext: 519DB5AA8DA219224EDA77F77B96C135 +Test: Encrypt +Comment: Set 3, vector 219 +Key: DBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDB +Plaintext: DBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDB +Ciphertext: 7A96F769BF260E6D91A070BA7766D3E3 +Test: Encrypt +Comment: Set 3, vector 220 +Key: DCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDC +Plaintext: DCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDC +Ciphertext: 902222F1779476A44CEEDACEDA72B3EC +Test: Encrypt +Comment: Set 3, vector 221 +Key: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +Plaintext: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +Ciphertext: 99859E56FE0DAB67CDE755E4790ED51D +Test: Encrypt +Comment: Set 3, vector 222 +Key: DEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDE +Plaintext: DEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDE +Ciphertext: C2F4EE121941873763F302ECE6D8DF9E +Test: Encrypt +Comment: Set 3, vector 223 +Key: DFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDF +Plaintext: DFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDF +Ciphertext: FE1E93DBF071E2280130E169C9E5254A +Test: Encrypt +Comment: Set 3, vector 224 +Key: E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0 +Plaintext: E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0 +Ciphertext: 58F45B5E30D9DE7038EC405B601521AB +Test: Encrypt +Comment: Set 3, vector 225 +Key: E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1 +Plaintext: E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1 +Ciphertext: 8783BD662F65899EF61E113B7CC6505D +Test: Encrypt +Comment: Set 3, vector 226 +Key: E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2 +Plaintext: E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2 +Ciphertext: A3F6BBB2C3403F433203E0E18DB3E4C0 +Test: Encrypt +Comment: Set 3, vector 227 +Key: E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3 +Plaintext: E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3 +Ciphertext: D3EE663795362A0D2E7A8DB784F95A33 +Test: Encrypt +Comment: Set 3, vector 228 +Key: E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4 +Plaintext: E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4 +Ciphertext: 1B75895E7FCEEEA5ECA62E14F77ECF6A +Test: Encrypt +Comment: Set 3, vector 229 +Key: E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5 +Plaintext: E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5 +Ciphertext: 5040525E4F3B78D2036539C1C463A48B +Test: Encrypt +Comment: Set 3, vector 230 +Key: E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6 +Plaintext: E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6 +Ciphertext: A48E63494241AEACB0EF7B18A431E50D +Test: Encrypt +Comment: Set 3, vector 231 +Key: E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7 +Plaintext: E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7 +Ciphertext: 9DAF4DBBBC81465BC4270129C522ABCB +Test: Encrypt +Comment: Set 3, vector 232 +Key: E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8 +Plaintext: E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8 +Ciphertext: 20B118C870AF1A85C683C60A31ED24E4 +Test: Encrypt +Comment: Set 3, vector 233 +Key: E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9 +Plaintext: E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9 +Ciphertext: 52FF30830000A72FA2CB030539550F06 +Test: Encrypt +Comment: Set 3, vector 234 +Key: EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA +Plaintext: EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA +Ciphertext: 797ED3DB1B9A4BF4122EA0FF667BC36D +Test: Encrypt +Comment: Set 3, vector 235 +Key: EBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB +Plaintext: EBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB +Ciphertext: 708CE40FC810F5E84B6EE8FC2E0A46FA +Test: Encrypt +Comment: Set 3, vector 236 +Key: ECECECECECECECECECECECECECECECECECECECECECECECEC +Plaintext: ECECECECECECECECECECECECECECECEC +Ciphertext: 0BA7446B1D3D803BB80CDE94E096E79C +Test: Encrypt +Comment: Set 3, vector 237 +Key: EDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDED +Plaintext: EDEDEDEDEDEDEDEDEDEDEDEDEDEDEDED +Ciphertext: 6B0E95AED4DC9E923EDF3DDD5BAEEA0C +Test: Encrypt +Comment: Set 3, vector 238 +Key: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +Plaintext: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +Ciphertext: DE45D435FD6F8A240AD8DCE5A4BD8CC3 +Test: Encrypt +Comment: Set 3, vector 239 +Key: EFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEF +Plaintext: EFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEF +Ciphertext: 8823002161D635ADA686D85B087F3022 +Test: Encrypt +Comment: Set 3, vector 240 +Key: F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 +Plaintext: F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 +Ciphertext: C00F367B98CC819F5F6ADADEA8513DD8 +Test: Encrypt +Comment: Set 3, vector 241 +Key: F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1 +Plaintext: F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1 +Ciphertext: 9C25269FB7FA889FBD9E55AAD4C92DE0 +Test: Encrypt +Comment: Set 3, vector 242 +Key: F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2 +Plaintext: F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2 +Ciphertext: 5DD1D60A62B551FFA18CFF8263C5FCE4 +Test: Encrypt +Comment: Set 3, vector 243 +Key: F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3 +Plaintext: F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3 +Ciphertext: D183A9113393C1EEC7170331C65D2547 +Test: Encrypt +Comment: Set 3, vector 244 +Key: F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4 +Plaintext: F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4 +Ciphertext: FADF9E4AF6C1D7A6965D5DBA03194F18 +Test: Encrypt +Comment: Set 3, vector 245 +Key: F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5 +Plaintext: F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5 +Ciphertext: F2E9E5BE04D7B47B93D2B81DBCDA8BF3 +Test: Encrypt +Comment: Set 3, vector 246 +Key: F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6 +Plaintext: F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6 +Ciphertext: 7A04D513A59636ECA8A8608F10F21910 +Test: Encrypt +Comment: Set 3, vector 247 +Key: F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7 +Plaintext: F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7 +Ciphertext: 659552FCEF0E90F77050CF3902A22475 +Test: Encrypt +Comment: Set 3, vector 248 +Key: F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8 +Plaintext: F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8 +Ciphertext: F81709C989061D4439BDD47E71DBB457 +Test: Encrypt +Comment: Set 3, vector 249 +Key: F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9 +Plaintext: F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9 +Ciphertext: E05425C950E298F31FC6751375B48B66 +Test: Encrypt +Comment: Set 3, vector 250 +Key: FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA +Plaintext: FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA +Ciphertext: 6E90B365BEBAFA5C49DC4D6AB1593F94 +Test: Encrypt +Comment: Set 3, vector 251 +Key: FBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFB +Plaintext: FBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFB +Ciphertext: B2469C08D0F878579E162E8ACC5EF802 +Test: Encrypt +Comment: Set 3, vector 252 +Key: FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC +Plaintext: FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC +Ciphertext: C1DCAB694C7FDBEC88C6FC2597EAC180 +Test: Encrypt +Comment: Set 3, vector 253 +Key: FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFD +Plaintext: FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFD +Ciphertext: 6651FFBD3C30A496D072493A519D44D9 +Test: Encrypt +Comment: Set 3, vector 254 +Key: FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE +Plaintext: FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE +Ciphertext: A2F5A98929658AF4A9700B9923DAF014 +Test: Encrypt +Comment: Set 3, vector 255 +Key: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +Plaintext: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +Ciphertext: 3F8D5676F51CE23DC3BDB627F8B3883E +Test: Encrypt +Comment: Tests with 256-bit keys +Comment: Set 1, vector 0 +Key: 8000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2136FABDA091DFB5171B94B8EFBB5D08 +Test: Encrypt +Comment: Set 1, vector 1 +Key: 4000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6EBC4F33B3EADA5DBF25130F3D02CD34 +Test: Encrypt +Comment: Set 1, vector 2 +Key: 2000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3A7BCDC53A1F02EF20C79CFCE107D38B +Test: Encrypt +Comment: Set 1, vector 3 +Key: 1000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 88A96052B61C5A621EE9A6316A42ED4A +Test: Encrypt +Comment: Set 1, vector 4 +Key: 0800000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CBD7A2D8354B2DA972A0950BDFFF2CBD +Test: Encrypt +Comment: Set 1, vector 5 +Key: 0400000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 690BEB5FBEA12A4861E826F568E9F8F3 +Test: Encrypt +Comment: Set 1, vector 6 +Key: 0200000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 799A6FA3B78846E424F41370654ABD6F +Test: Encrypt +Comment: Set 1, vector 7 +Key: 0100000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DD7E24E12F391C5FEDE40136F8DE3731 +Test: Encrypt +Comment: Set 1, vector 8 +Key: 0080000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F7412D526E9244574F9933F602595385 +Test: Encrypt +Comment: Set 1, vector 9 +Key: 0040000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FD9D0174A83BEC3E7E1C3372CB5E7C9B +Test: Encrypt +Comment: Set 1, vector 10 +Key: 0020000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FCA62D360A7DFE54DB8D53819A407E71 +Test: Encrypt +Comment: Set 1, vector 11 +Key: 0010000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AC821C68913DCE3E74A20DB8E902CC4C +Test: Encrypt +Comment: Set 1, vector 12 +Key: 0008000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 80633F6CB8F10863E0A7FDE4C35D50E9 +Test: Encrypt +Comment: Set 1, vector 13 +Key: 0004000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: D417D1D94869EE2364FCE869C0C1114E +Test: Encrypt +Comment: Set 1, vector 14 +Key: 0002000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0FA96DCEA2ACB849490CD5A1488A2FD9 +Test: Encrypt +Comment: Set 1, vector 15 +Key: 0001000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3E99BCB51CAEB9147DCF8643771D1C83 +Test: Encrypt +Comment: Set 1, vector 16 +Key: 0000800000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 25EA413BBC3C2579D3F7CBFD9E378091 +Test: Encrypt +Comment: Set 1, vector 17 +Key: 0000400000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C0433C1AD2E468FC679988CFBFCA5CD4 +Test: Encrypt +Comment: Set 1, vector 18 +Key: 0000200000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 05108B7D7C2871D9DE1F22232CF6966B +Test: Encrypt +Comment: Set 1, vector 19 +Key: 0000100000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8ABE085B75333946450F2D1D162E8650 +Test: Encrypt +Comment: Set 1, vector 20 +Key: 0000080000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 487A9C50152B44F5B009D8682EA1FD22 +Test: Encrypt +Comment: Set 1, vector 21 +Key: 0000040000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 739207A812F142B545798BA85170AF25 +Test: Encrypt +Comment: Set 1, vector 22 +Key: 0000020000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E40B90A5840591FEC98A24B23E73892B +Test: Encrypt +Comment: Set 1, vector 23 +Key: 0000010000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0258BFB0DC942F6A9139D3C00EBBEB35 +Test: Encrypt +Comment: Set 1, vector 24 +Key: 0000008000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 650CD6035752320B8252F44AEEBEC9E4 +Test: Encrypt +Comment: Set 1, vector 25 +Key: 0000004000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FABFFBB7028B53E0BB88E3E4462ACF0D +Test: Encrypt +Comment: Set 1, vector 26 +Key: 0000002000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C48D3416904896E2F2307EA26FB8CF1C +Test: Encrypt +Comment: Set 1, vector 27 +Key: 0000001000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2237452352F488F1DA3F1619FC6A7F85 +Test: Encrypt +Comment: Set 1, vector 28 +Key: 0000000800000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: D3E6ECF4A3F70E672AABEE0C2ECA3960 +Test: Encrypt +Comment: Set 1, vector 29 +Key: 0000000400000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7A3EFC8AC6A82E8AEF377D8D96D8E830 +Test: Encrypt +Comment: Set 1, vector 30 +Key: 0000000200000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7278F0441F5AA34C0B7CDB076B453225 +Test: Encrypt +Comment: Set 1, vector 31 +Key: 0000000100000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 382E61EAC044E2151906F936CC9D33AE +Test: Encrypt +Comment: Set 1, vector 32 +Key: 0000000080000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C51147F4AD33C35647DF7E856C2965D4 +Test: Encrypt +Comment: Set 1, vector 33 +Key: 0000000040000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DAFE261154ADF63EA3F75B1253A9F77C +Test: Encrypt +Comment: Set 1, vector 34 +Key: 0000000020000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B1A0B0E765C1D0379CA538ED0EFB9649 +Test: Encrypt +Comment: Set 1, vector 35 +Key: 0000000010000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 78F7D01D7795ACA0846CCE835E71FBC2 +Test: Encrypt +Comment: Set 1, vector 36 +Key: 0000000008000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E001A545AC71F53D3AD99C84D7F5B062 +Test: Encrypt +Comment: Set 1, vector 37 +Key: 0000000004000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 58E3907C56BF5ADFDBAE61C172B8F488 +Test: Encrypt +Comment: Set 1, vector 38 +Key: 0000000002000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 16F77C9515B473167BD7ABA7C97B1CCA +Test: Encrypt +Comment: Set 1, vector 39 +Key: 0000000001000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4BC9F687C7757CDF5A5E94D69E5EA173 +Test: Encrypt +Comment: Set 1, vector 40 +Key: 0000000000800000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 804261A34F26A87694F70C35F338989D +Test: Encrypt +Comment: Set 1, vector 41 +Key: 0000000000400000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E8D8BF002738D7067CD06437C4459365 +Test: Encrypt +Comment: Set 1, vector 42 +Key: 0000000000200000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E131137F7EA2AEAB37F72AF3644FFCCE +Test: Encrypt +Comment: Set 1, vector 43 +Key: 0000000000100000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 542A1FD5CB4BE8485FA83AA14FAAD4A8 +Test: Encrypt +Comment: Set 1, vector 44 +Key: 0000000000080000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BEC6C8C1A9E5E7982A990B8F9BA0ADE3 +Test: Encrypt +Comment: Set 1, vector 45 +Key: 0000000000040000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DE55BE1AA823A9F7474C65BD50D55095 +Test: Encrypt +Comment: Set 1, vector 46 +Key: 0000000000020000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: D67CC199AF361A07A0DBD8F6700A4744 +Test: Encrypt +Comment: Set 1, vector 47 +Key: 0000000000010000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DBAD180017184EF80D398D8D22AAC4A1 +Test: Encrypt +Comment: Set 1, vector 48 +Key: 0000000000008000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 27E68691F10EEFD1B594682DC3EF65A5 +Test: Encrypt +Comment: Set 1, vector 49 +Key: 0000000000004000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6D4EF0587B948AD62B703D3D7CCEA229 +Test: Encrypt +Comment: Set 1, vector 50 +Key: 0000000000002000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C0F443758F239E3A3E31E6F93AD4766B +Test: Encrypt +Comment: Set 1, vector 51 +Key: 0000000000001000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BEB5CB1D8EB3A9EA795A4B43CA1567A9 +Test: Encrypt +Comment: Set 1, vector 52 +Key: 0000000000000800000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: D89A97957F1979C63459A385E21B4A84 +Test: Encrypt +Comment: Set 1, vector 53 +Key: 0000000000000400000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 39A6615147FF571F2FABAD5BE9800A10 +Test: Encrypt +Comment: Set 1, vector 54 +Key: 0000000000000200000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E18B0CB1980124504B46A46A6F4273F3 +Test: Encrypt +Comment: Set 1, vector 55 +Key: 0000000000000100000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1E13C8034ED53FD4E3F433E1CF4B5CE1 +Test: Encrypt +Comment: Set 1, vector 56 +Key: 0000000000000080000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 71FA53EAADBA0C9BCF86A3071408966D +Test: Encrypt +Comment: Set 1, vector 57 +Key: 0000000000000040000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E50502EC84BB024C7466FE225C7FD8BA +Test: Encrypt +Comment: Set 1, vector 58 +Key: 0000000000000020000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DEB33581D79C9D4294E315998377BCBF +Test: Encrypt +Comment: Set 1, vector 59 +Key: 0000000000000010000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A713C2503CE44A04C9108FA160659945 +Test: Encrypt +Comment: Set 1, vector 60 +Key: 0000000000000008000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 520E9E8DB8A67601B02E369916FAB8CC +Test: Encrypt +Comment: Set 1, vector 61 +Key: 0000000000000004000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8FDC11B74D17D79C6B2DFF2D6A561258 +Test: Encrypt +Comment: Set 1, vector 62 +Key: 0000000000000002000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3EA497AD2FC8F2587EFAA7D49121F26C +Test: Encrypt +Comment: Set 1, vector 63 +Key: 0000000000000001000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3340905F7413C979E5AED11D71B9294E +Test: Encrypt +Comment: Set 1, vector 64 +Key: 0000000000000000800000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 067FAC22E16205FF209B1760ABDE0565 +Test: Encrypt +Comment: Set 1, vector 65 +Key: 0000000000000000400000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BECA010BAB7BDD7E8A8084DA9853A0F4 +Test: Encrypt +Comment: Set 1, vector 66 +Key: 0000000000000000200000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 146F5A4A7B2880F5AF57333C7F129028 +Test: Encrypt +Comment: Set 1, vector 67 +Key: 0000000000000000100000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F773C1BD724955109A8B4EA3DA1C2197 +Test: Encrypt +Comment: Set 1, vector 68 +Key: 0000000000000000080000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B427EFAC8C656AB6F4DF7F420A177B8E +Test: Encrypt +Comment: Set 1, vector 69 +Key: 0000000000000000040000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B3D1BDB29010DB5FC81B66E2F7189D54 +Test: Encrypt +Comment: Set 1, vector 70 +Key: 0000000000000000020000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 676EEA415693F303ACF5CD84C50816AB +Test: Encrypt +Comment: Set 1, vector 71 +Key: 0000000000000000010000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BA21C564E52961DEB4B3A3CA9E0B70EF +Test: Encrypt +Comment: Set 1, vector 72 +Key: 0000000000000000008000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A60FB5DBD17EA92E303492E3F54D0BF2 +Test: Encrypt +Comment: Set 1, vector 73 +Key: 0000000000000000004000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F4F5A0540107D66F32FB289B14EF4299 +Test: Encrypt +Comment: Set 1, vector 74 +Key: 0000000000000000002000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8D9B4A19F391175CF7DA42FEF313EDD8 +Test: Encrypt +Comment: Set 1, vector 75 +Key: 0000000000000000001000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B0AFAB0183A9FC69DA8BBE9B8FAF653A +Test: Encrypt +Comment: Set 1, vector 76 +Key: 0000000000000000000800000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 68FFD91FD5AD1F1AC176D639694FEA29 +Test: Encrypt +Comment: Set 1, vector 77 +Key: 0000000000000000000400000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 97EC38070014494A2E97EFE354BA2865 +Test: Encrypt +Comment: Set 1, vector 78 +Key: 0000000000000000000200000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E3EC51F889C63AD2C708F22AFC42D18C +Test: Encrypt +Comment: Set 1, vector 79 +Key: 0000000000000000000100000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8CC5BDB49037DC1D3D8DADFA0B8ECD96 +Test: Encrypt +Comment: Set 1, vector 80 +Key: 0000000000000000000080000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 14F5C3D75BA0397D7436E1479F78435B +Test: Encrypt +Comment: Set 1, vector 81 +Key: 0000000000000000000040000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FF3B01851C8254967E4DFAA2A0F0C057 +Test: Encrypt +Comment: Set 1, vector 82 +Key: 0000000000000000000020000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B8C8E9AFF66FFEC9D0342FF297A543B1 +Test: Encrypt +Comment: Set 1, vector 83 +Key: 0000000000000000000010000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A95A113F088FFE17A79050C46377545E +Test: Encrypt +Comment: Set 1, vector 84 +Key: 0000000000000000000008000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EA4C3AFA65016D057EC1DFDD0411ED06 +Test: Encrypt +Comment: Set 1, vector 85 +Key: 0000000000000000000004000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7D535C84DFAD692D0F89AB73C1F42F60 +Test: Encrypt +Comment: Set 1, vector 86 +Key: 0000000000000000000002000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E857DF0CEBAB1E03CB9AF73CBF9C19D1 +Test: Encrypt +Comment: Set 1, vector 87 +Key: 0000000000000000000001000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7A59BCF6FAC80379EB7E8E2EFAB147D4 +Test: Encrypt +Comment: Set 1, vector 88 +Key: 0000000000000000000000800000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 43EF17F87BAF7536DDE734F885C4CE85 +Test: Encrypt +Comment: Set 1, vector 89 +Key: 0000000000000000000000400000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2B71CE14089741A1EF1E99DC9E22E739 +Test: Encrypt +Comment: Set 1, vector 90 +Key: 0000000000000000000000200000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9283885622781998186B7DACBFF68ED2 +Test: Encrypt +Comment: Set 1, vector 91 +Key: 0000000000000000000000100000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 756A184F392D8C821479EFF930338C0A +Test: Encrypt +Comment: Set 1, vector 92 +Key: 0000000000000000000000080000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CE848D49BB76CA30B607C9539793DA41 +Test: Encrypt +Comment: Set 1, vector 93 +Key: 0000000000000000000000040000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 50F2D5238991EEA9654C8895AFC0AC37 +Test: Encrypt +Comment: Set 1, vector 94 +Key: 0000000000000000000000020000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 561564103E13F4CBB58A9E096DB1958B +Test: Encrypt +Comment: Set 1, vector 95 +Key: 0000000000000000000000010000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EF2BB05AC6868C15D66D956BD580D467 +Test: Encrypt +Comment: Set 1, vector 96 +Key: 0000000000000000000000008000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C7B1A5A3A201DF25FD97A47B1FC3569E +Test: Encrypt +Comment: Set 1, vector 97 +Key: 0000000000000000000000004000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0A1873FF47B38095CF6A8BABF3901FF2 +Test: Encrypt +Comment: Set 1, vector 98 +Key: 0000000000000000000000002000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A96F8F977DC45ABF55518EA10C598E10 +Test: Encrypt +Comment: Set 1, vector 99 +Key: 0000000000000000000000001000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 778C644278689EC0577BDDB2154AE635 +Test: Encrypt +Comment: Set 1, vector 100 +Key: 0000000000000000000000000800000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DEF97DBCF02648E7BCE6A368F7F34C14 +Test: Encrypt +Comment: Set 1, vector 101 +Key: 0000000000000000000000000400000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 71B85362022D53AF03A17870D8F66614 +Test: Encrypt +Comment: Set 1, vector 102 +Key: 0000000000000000000000000200000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3593FC550A2950C2EF94F6E8F6E90BB3 +Test: Encrypt +Comment: Set 1, vector 103 +Key: 0000000000000000000000000100000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 29E64004DBF1E7833A7CD82EDACD932A +Test: Encrypt +Comment: Set 1, vector 104 +Key: 0000000000000000000000000080000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 715E700DF74A8680F04A48B18AEDB99C +Test: Encrypt +Comment: Set 1, vector 105 +Key: 0000000000000000000000000040000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 72E3288FFB02D1100F84FA605855D812 +Test: Encrypt +Comment: Set 1, vector 106 +Key: 0000000000000000000000000020000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9021082D3C4CB202936FD76F1392446B +Test: Encrypt +Comment: Set 1, vector 107 +Key: 0000000000000000000000000010000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1552BD181EE0FB914558053F2662F9AE +Test: Encrypt +Comment: Set 1, vector 108 +Key: 0000000000000000000000000008000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 599D87052322E19141057F0EF3C47508 +Test: Encrypt +Comment: Set 1, vector 109 +Key: 0000000000000000000000000004000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 505AC03CEB2ECA1C9D411B4A1CF2011C +Test: Encrypt +Comment: Set 1, vector 110 +Key: 0000000000000000000000000002000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DD639574D8FFCD24EA68B2243C5AA7D6 +Test: Encrypt +Comment: Set 1, vector 111 +Key: 0000000000000000000000000001000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 45F5371B714D2652BA4AD083EDB65BEE +Test: Encrypt +Comment: Set 1, vector 112 +Key: 0000000000000000000000000000800000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DEAB9C368B21FE41E709554340E87C0B +Test: Encrypt +Comment: Set 1, vector 113 +Key: 0000000000000000000000000000400000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3A981045526766BD13943F11CE917AF9 +Test: Encrypt +Comment: Set 1, vector 114 +Key: 0000000000000000000000000000200000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 35CDF30A485CE21F0D005EE0C2BCF315 +Test: Encrypt +Comment: Set 1, vector 115 +Key: 0000000000000000000000000000100000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F561A8C91820252580317385F8336305 +Test: Encrypt +Comment: Set 1, vector 116 +Key: 0000000000000000000000000000080000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0789680D27735220798079572BF4ECF6 +Test: Encrypt +Comment: Set 1, vector 117 +Key: 0000000000000000000000000000040000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B4F16729D7AB16C9AE44FB61291920DE +Test: Encrypt +Comment: Set 1, vector 118 +Key: 0000000000000000000000000000020000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FB83BF9B1D983CA7FB3718E22D9A2155 +Test: Encrypt +Comment: Set 1, vector 119 +Key: 0000000000000000000000000000010000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CEC5C5D13E59508D3DA431F1479730F3 +Test: Encrypt +Comment: Set 1, vector 120 +Key: 0000000000000000000000000000008000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 09BEA932E60A4AD34271FF11A2B2AA02 +Test: Encrypt +Comment: Set 1, vector 121 +Key: 0000000000000000000000000000004000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B102F72FD89452C0CD1C6897071F903E +Test: Encrypt +Comment: Set 1, vector 122 +Key: 0000000000000000000000000000002000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A469F9411F0A3A6E1A8076416C6B55CB +Test: Encrypt +Comment: Set 1, vector 123 +Key: 0000000000000000000000000000001000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6C3F88FCB538699547A1CF07A529993F +Test: Encrypt +Comment: Set 1, vector 124 +Key: 0000000000000000000000000000000800000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 493E8CC2A63534632A6456ED47BF233C +Test: Encrypt +Comment: Set 1, vector 125 +Key: 0000000000000000000000000000000400000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1FD81E905F7055C4B04DB1F9718A6861 +Test: Encrypt +Comment: Set 1, vector 126 +Key: 0000000000000000000000000000000200000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B22882E01D7A1BF2D7F0E3BFBFC87156 +Test: Encrypt +Comment: Set 1, vector 127 +Key: 0000000000000000000000000000000100000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 86C9822E849322FB00DF89233D33935D +Test: Encrypt +Comment: Set 1, vector 128 +Key: 0000000000000000000000000000000080000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 12012E8E028D0D3D8DC00847130D424C +Test: Encrypt +Comment: Set 1, vector 129 +Key: 0000000000000000000000000000000040000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 182A96CC3BF10035B9DB292D1399F993 +Test: Encrypt +Comment: Set 1, vector 130 +Key: 0000000000000000000000000000000020000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 91E0E6991989D1FC4CBD754E4E7D0590 +Test: Encrypt +Comment: Set 1, vector 131 +Key: 0000000000000000000000000000000010000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F3EFC4E6F207E370C8CAE39408C4BF1B +Test: Encrypt +Comment: Set 1, vector 132 +Key: 0000000000000000000000000000000008000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AA767AB2EC6FA2FA183DAF9C0F3BAE5E +Test: Encrypt +Comment: Set 1, vector 133 +Key: 0000000000000000000000000000000004000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: D1FF11F4D1AEEAAE01A115081AF886EF +Test: Encrypt +Comment: Set 1, vector 134 +Key: 0000000000000000000000000000000002000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5390139711090B56B28338FEA98FCC82 +Test: Encrypt +Comment: Set 1, vector 135 +Key: 0000000000000000000000000000000001000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 13E693CCF6EBF0E6061B92B7ED0B95B6 +Test: Encrypt +Comment: Set 1, vector 136 +Key: 0000000000000000000000000000000000800000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 588FB2F95861D3C427669C68D04ADB25 +Test: Encrypt +Comment: Set 1, vector 137 +Key: 0000000000000000000000000000000000400000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F472ECDF8DEBC416313AAF7C8AAFB43E +Test: Encrypt +Comment: Set 1, vector 138 +Key: 0000000000000000000000000000000000200000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EAA654BE38E857941A921C70AC7FC7CE +Test: Encrypt +Comment: Set 1, vector 139 +Key: 0000000000000000000000000000000000100000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F2A4E47AE80CDF506B9513C510EA0954 +Test: Encrypt +Comment: Set 1, vector 140 +Key: 0000000000000000000000000000000000080000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F08EC7ED8FBB99F175A990C3E4DECB6B +Test: Encrypt +Comment: Set 1, vector 141 +Key: 0000000000000000000000000000000000040000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5C767BC584CA3653EDE27CD8B209A0AD +Test: Encrypt +Comment: Set 1, vector 142 +Key: 0000000000000000000000000000000000020000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AFF9A8BA92A40B2BF42FDB4089B1F9CC +Test: Encrypt +Comment: Set 1, vector 143 +Key: 0000000000000000000000000000000000010000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BFC1E9198BBE22266712EB1ECB17D748 +Test: Encrypt +Comment: Set 1, vector 144 +Key: 0000000000000000000000000000000000008000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 235184136A29208BD041E60BCB9F7464 +Test: Encrypt +Comment: Set 1, vector 145 +Key: 0000000000000000000000000000000000004000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 83DC48F9177C5C94CBC22E83A2B76829 +Test: Encrypt +Comment: Set 1, vector 146 +Key: 0000000000000000000000000000000000002000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 72CD31ACB7A1A459E4D27C1F26039FA7 +Test: Encrypt +Comment: Set 1, vector 147 +Key: 0000000000000000000000000000000000001000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 139AC4734C3136FD9982FCC7A569B9D3 +Test: Encrypt +Comment: Set 1, vector 148 +Key: 0000000000000000000000000000000000000800000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 12FFA3EF4346F4C57A03A36F9938B251 +Test: Encrypt +Comment: Set 1, vector 149 +Key: 0000000000000000000000000000000000000400000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 43DDB100CE22E5553CF4DCF814BF3CAC +Test: Encrypt +Comment: Set 1, vector 150 +Key: 0000000000000000000000000000000000000200000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: ABDADF4C948BB61C0A917885ADE4C7C5 +Test: Encrypt +Comment: Set 1, vector 151 +Key: 0000000000000000000000000000000000000100000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 197391E089DE173B522DDD8CBEEC3118 +Test: Encrypt +Comment: Set 1, vector 152 +Key: 0000000000000000000000000000000000000080000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 43FBE8BF2728C55C9368D01E40C1CF96 +Test: Encrypt +Comment: Set 1, vector 153 +Key: 0000000000000000000000000000000000000040000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0F5DE5F67EC84F2CB253A0BC48991C71 +Test: Encrypt +Comment: Set 1, vector 154 +Key: 0000000000000000000000000000000000000020000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 52BA4666B972EAE3D2E960D7372D3C48 +Test: Encrypt +Comment: Set 1, vector 155 +Key: 0000000000000000000000000000000000000010000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0735AE765BC079A93B451D873FA93702 +Test: Encrypt +Comment: Set 1, vector 156 +Key: 0000000000000000000000000000000000000008000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 89D988508A4569E2232F72412AE50B65 +Test: Encrypt +Comment: Set 1, vector 157 +Key: 0000000000000000000000000000000000000004000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BCF0EE2403BC9344030C0FF065B6FD88 +Test: Encrypt +Comment: Set 1, vector 158 +Key: 0000000000000000000000000000000000000002000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 25D76D36F3376D6FD835BA012C7DD2E5 +Test: Encrypt +Comment: Set 1, vector 159 +Key: 0000000000000000000000000000000000000001000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EF364A31E8551732D4B2098281D4E2C9 +Test: Encrypt +Comment: Set 1, vector 160 +Key: 0000000000000000000000000000000000000000800000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 64B1F927C0A7315EA60BC5F2A0DCCFE2 +Test: Encrypt +Comment: Set 1, vector 161 +Key: 0000000000000000000000000000000000000000400000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CA99E0EDFA0E121F27659346BCDCC443 +Test: Encrypt +Comment: Set 1, vector 162 +Key: 0000000000000000000000000000000000000000200000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1816D9D23D1069BC6DEC195F60994C05 +Test: Encrypt +Comment: Set 1, vector 163 +Key: 0000000000000000000000000000000000000000100000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9819575F6890E093091378AED0612051 +Test: Encrypt +Comment: Set 1, vector 164 +Key: 0000000000000000000000000000000000000000080000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 41903DE72A486B823842FBA2840E265C +Test: Encrypt +Comment: Set 1, vector 165 +Key: 0000000000000000000000000000000000000000040000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 30651D416912A01EDEC4290D34B4A605 +Test: Encrypt +Comment: Set 1, vector 166 +Key: 0000000000000000000000000000000000000000020000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0949AD8AB2E85995686D6D495ABA1028 +Test: Encrypt +Comment: Set 1, vector 167 +Key: 0000000000000000000000000000000000000000010000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3789C2D08E122BE204662FE9A0FDF77A +Test: Encrypt +Comment: Set 1, vector 168 +Key: 0000000000000000000000000000000000000000008000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A0C66EE031FF045123475E6F5FA64F57 +Test: Encrypt +Comment: Set 1, vector 169 +Key: 0000000000000000000000000000000000000000004000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1BACCDD314AF39124709013C94CAD1AC +Test: Encrypt +Comment: Set 1, vector 170 +Key: 0000000000000000000000000000000000000000002000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2FB5DF5527A8E06AED03D683EDF14E9A +Test: Encrypt +Comment: Set 1, vector 171 +Key: 0000000000000000000000000000000000000000001000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FF2C61AD63CDA6207605C18C888B383D +Test: Encrypt +Comment: Set 1, vector 172 +Key: 0000000000000000000000000000000000000000000800000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 71CE4A5B48671AB9A6561B7109FB8345 +Test: Encrypt +Comment: Set 1, vector 173 +Key: 0000000000000000000000000000000000000000000400000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 37299C12377E9CB8DF5FE730DFFCB5CA +Test: Encrypt +Comment: Set 1, vector 174 +Key: 0000000000000000000000000000000000000000000200000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C5454350A7CB0EC5CA3932A3948F48BC +Test: Encrypt +Comment: Set 1, vector 175 +Key: 0000000000000000000000000000000000000000000100000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8AB40D09FFBD0C82E9091FC80D2A63C9 +Test: Encrypt +Comment: Set 1, vector 176 +Key: 0000000000000000000000000000000000000000000080000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9CB3FE43EAE3DC7AC4F97E609FDE9F10 +Test: Encrypt +Comment: Set 1, vector 177 +Key: 0000000000000000000000000000000000000000000040000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 51369DC689B25C3AC593B578BAEA046E +Test: Encrypt +Comment: Set 1, vector 178 +Key: 0000000000000000000000000000000000000000000020000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 13D9D885A24AE8B859F239890DF438C9 +Test: Encrypt +Comment: Set 1, vector 179 +Key: 0000000000000000000000000000000000000000000010000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CEACAE376290D5C62D2DAE422CA6E5C0 +Test: Encrypt +Comment: Set 1, vector 180 +Key: 0000000000000000000000000000000000000000000008000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6AE17D621F97B62F4571AB165CE0A11F +Test: Encrypt +Comment: Set 1, vector 181 +Key: 0000000000000000000000000000000000000000000004000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C91318F8FD17E9BC656E639A0D648B3A +Test: Encrypt +Comment: Set 1, vector 182 +Key: 0000000000000000000000000000000000000000000002000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BFF1BC1C935E40FB0C20DED5985F1910 +Test: Encrypt +Comment: Set 1, vector 183 +Key: 0000000000000000000000000000000000000000000001000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 96F0B387F487BBDD5227B595A506F963 +Test: Encrypt +Comment: Set 1, vector 184 +Key: 0000000000000000000000000000000000000000000000800000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 62265B7EFB73A77205ECBBFD166B3EAE +Test: Encrypt +Comment: Set 1, vector 185 +Key: 0000000000000000000000000000000000000000000000400000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 016E8F3087757E8F576B19A58D356FB6 +Test: Encrypt +Comment: Set 1, vector 186 +Key: 0000000000000000000000000000000000000000000000200000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 456FAF632EA07797CEC23DC6553988F9 +Test: Encrypt +Comment: Set 1, vector 187 +Key: 0000000000000000000000000000000000000000000000100000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 147694E2231FA00D6B62D3E51CC8201D +Test: Encrypt +Comment: Set 1, vector 188 +Key: 0000000000000000000000000000000000000000000000080000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2299D31F3D747838C65FE7C6C0C59214 +Test: Encrypt +Comment: Set 1, vector 189 +Key: 0000000000000000000000000000000000000000000000040000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: C5A669612A23E4F7551D79650071E040 +Test: Encrypt +Comment: Set 1, vector 190 +Key: 0000000000000000000000000000000000000000000000020000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F0A32D722EDFD2BA628C781DACD5FC50 +Test: Encrypt +Comment: Set 1, vector 191 +Key: 0000000000000000000000000000000000000000000000010000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 422C8E2A0DFF095E40654CB2B7176A9B +Test: Encrypt +Comment: Set 1, vector 192 +Key: 0000000000000000000000000000000000000000000000008000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 99DEF168961D4AB9E63157E60F76399C +Test: Encrypt +Comment: Set 1, vector 193 +Key: 0000000000000000000000000000000000000000000000004000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 49C92ACC622A00BCFF7DFDCABF33CB4C +Test: Encrypt +Comment: Set 1, vector 194 +Key: 0000000000000000000000000000000000000000000000002000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 517117A096B2EE66D4BEF2D1EE570CE7 +Test: Encrypt +Comment: Set 1, vector 195 +Key: 0000000000000000000000000000000000000000000000001000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9DAECC0E82559BC2CDB8A01AB30BA605 +Test: Encrypt +Comment: Set 1, vector 196 +Key: 0000000000000000000000000000000000000000000000000800000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 50B2882928DAB54488413ABA5743535E +Test: Encrypt +Comment: Set 1, vector 197 +Key: 0000000000000000000000000000000000000000000000000400000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E6725F73ED920F473E1442ABEC7DB722 +Test: Encrypt +Comment: Set 1, vector 198 +Key: 0000000000000000000000000000000000000000000000000200000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CB4F06002C5864E40C80F97157452575 +Test: Encrypt +Comment: Set 1, vector 199 +Key: 0000000000000000000000000000000000000000000000000100000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8DF72D7C8AE547F2AA3E9AFAAD1D62F0 +Test: Encrypt +Comment: Set 1, vector 200 +Key: 0000000000000000000000000000000000000000000000000080000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0DA429E486F5ED9460B7C54460B0A699 +Test: Encrypt +Comment: Set 1, vector 201 +Key: 0000000000000000000000000000000000000000000000000040000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 24832DB462328D93306C6714E100ADAB +Test: Encrypt +Comment: Set 1, vector 202 +Key: 0000000000000000000000000000000000000000000000000020000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 3170D82FEC3D2A58C7D2F28BAC4C7809 +Test: Encrypt +Comment: Set 1, vector 203 +Key: 0000000000000000000000000000000000000000000000000010000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 638A46425AEA9C808AC752EE69F56822 +Test: Encrypt +Comment: Set 1, vector 204 +Key: 0000000000000000000000000000000000000000000000000008000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F98954D90C5E3DB2EEC8A86078D70763 +Test: Encrypt +Comment: Set 1, vector 205 +Key: 0000000000000000000000000000000000000000000000000004000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8D5868451617FB145B8F7F91712A7AA0 +Test: Encrypt +Comment: Set 1, vector 206 +Key: 0000000000000000000000000000000000000000000000000002000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2292BA337A4F465E0DFB85DAAC266AE6 +Test: Encrypt +Comment: Set 1, vector 207 +Key: 0000000000000000000000000000000000000000000000000001000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F2560D5063A2F928D699005012A0C839 +Test: Encrypt +Comment: Set 1, vector 208 +Key: 0000000000000000000000000000000000000000000000000000800000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 44968AEABB2852075F83FB942E05099D +Test: Encrypt +Comment: Set 1, vector 209 +Key: 0000000000000000000000000000000000000000000000000000400000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: EB339742AB40B5627A7CB60D4F54DD2E +Test: Encrypt +Comment: Set 1, vector 210 +Key: 0000000000000000000000000000000000000000000000000000200000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9AAA6FC3BBDE523E9FCD9D5C0255F912 +Test: Encrypt +Comment: Set 1, vector 211 +Key: 0000000000000000000000000000000000000000000000000000100000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E6E25CBAFF57F4C6056706FD13E6A2E3 +Test: Encrypt +Comment: Set 1, vector 212 +Key: 0000000000000000000000000000000000000000000000000000080000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 8A9628166922E8EC6FC28F5E847B9C71 +Test: Encrypt +Comment: Set 1, vector 213 +Key: 0000000000000000000000000000000000000000000000000000040000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 97CF8FF5D1337DA8602F8AB6C0224AF7 +Test: Encrypt +Comment: Set 1, vector 214 +Key: 0000000000000000000000000000000000000000000000000000020000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DDBBE09A93364599E9233969ADBEBA63 +Test: Encrypt +Comment: Set 1, vector 215 +Key: 0000000000000000000000000000000000000000000000000000010000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: E772954B9DA3DA8A005582C4E9E5B6FA +Test: Encrypt +Comment: Set 1, vector 216 +Key: 0000000000000000000000000000000000000000000000000000008000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 507DFD30F7EEF807F994B298D487FDE6 +Test: Encrypt +Comment: Set 1, vector 217 +Key: 0000000000000000000000000000000000000000000000000000004000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6FF09F69AED61F091F92503547A19B68 +Test: Encrypt +Comment: Set 1, vector 218 +Key: 0000000000000000000000000000000000000000000000000000002000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 1141E6BB725E09640DD6971F4EF1A886 +Test: Encrypt +Comment: Set 1, vector 219 +Key: 0000000000000000000000000000000000000000000000000000001000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9C0E8061BA0361B730D24675EF128705 +Test: Encrypt +Comment: Set 1, vector 220 +Key: 0000000000000000000000000000000000000000000000000000000800000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7D0137240D0D3D086198E83BC0CF22D0 +Test: Encrypt +Comment: Set 1, vector 221 +Key: 0000000000000000000000000000000000000000000000000000000400000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: BC4460FF55EBFAA1171B0CE249830281 +Test: Encrypt +Comment: Set 1, vector 222 +Key: 0000000000000000000000000000000000000000000000000000000200000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CDBE93ADCF1867B952FB82C42DF60CFD +Test: Encrypt +Comment: Set 1, vector 223 +Key: 0000000000000000000000000000000000000000000000000000000100000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 007AA375E4402B8A5657C01259AF3D49 +Test: Encrypt +Comment: Set 1, vector 224 +Key: 0000000000000000000000000000000000000000000000000000000080000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: F5C2B13998E5687C773017C14EB01FE4 +Test: Encrypt +Comment: Set 1, vector 225 +Key: 0000000000000000000000000000000000000000000000000000000040000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0AE71BFDD72FBC4576305E4B0807E17C +Test: Encrypt +Comment: Set 1, vector 226 +Key: 0000000000000000000000000000000000000000000000000000000020000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 35FB1CE6CB7449DF115D3AC6BA656439 +Test: Encrypt +Comment: Set 1, vector 227 +Key: 0000000000000000000000000000000000000000000000000000000010000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6D64CEC5D9D74BD40FBC0BE69C70B777 +Test: Encrypt +Comment: Set 1, vector 228 +Key: 0000000000000000000000000000000000000000000000000000000008000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7257851ACD3E3E3AE50048973C3A2AE8 +Test: Encrypt +Comment: Set 1, vector 229 +Key: 0000000000000000000000000000000000000000000000000000000004000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 50852661D5BD7960412B29A86F549619 +Test: Encrypt +Comment: Set 1, vector 230 +Key: 0000000000000000000000000000000000000000000000000000000002000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CDF3561D971D40521CD46BAE98F5867A +Test: Encrypt +Comment: Set 1, vector 231 +Key: 0000000000000000000000000000000000000000000000000000000001000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FA3C84185B9ABF9887DD501B3B0F52D3 +Test: Encrypt +Comment: Set 1, vector 232 +Key: 0000000000000000000000000000000000000000000000000000000000800000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 40A5B434F81574733D00F25511109E08 +Test: Encrypt +Comment: Set 1, vector 233 +Key: 0000000000000000000000000000000000000000000000000000000000400000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DA0D248315C527572F1673BDE26A475E +Test: Encrypt +Comment: Set 1, vector 234 +Key: 0000000000000000000000000000000000000000000000000000000000200000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0F8366D8EFB9AB63B0299F278C55CFB4 +Test: Encrypt +Comment: Set 1, vector 235 +Key: 0000000000000000000000000000000000000000000000000000000000100000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 25A089C523CD153EC094862B5923F492 +Test: Encrypt +Comment: Set 1, vector 236 +Key: 0000000000000000000000000000000000000000000000000000000000080000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7268A4628C6A0BE6A8391ABE70986176 +Test: Encrypt +Comment: Set 1, vector 237 +Key: 0000000000000000000000000000000000000000000000000000000000040000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7C11E6478CC688FE707454DF4AB5B666 +Test: Encrypt +Comment: Set 1, vector 238 +Key: 0000000000000000000000000000000000000000000000000000000000020000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 7601B6EBD5CE578973E949C21BFA8CAA +Test: Encrypt +Comment: Set 1, vector 239 +Key: 0000000000000000000000000000000000000000000000000000000000010000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0FCE9CCDF89F2EB139DBEB09B55375D5 +Test: Encrypt +Comment: Set 1, vector 240 +Key: 0000000000000000000000000000000000000000000000000000000000008000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AAABFDD9E28A3ADCA1212F3D7F53A269 +Test: Encrypt +Comment: Set 1, vector 241 +Key: 0000000000000000000000000000000000000000000000000000000000004000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: FC6B4304423917E41677768BD7A8D402 +Test: Encrypt +Comment: Set 1, vector 242 +Key: 0000000000000000000000000000000000000000000000000000000000002000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2AA3239D19ADBA9A4190E3653875C589 +Test: Encrypt +Comment: Set 1, vector 243 +Key: 0000000000000000000000000000000000000000000000000000000000001000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 4F4AB0DB2F3D3EA1E5FCBF99651485DC +Test: Encrypt +Comment: Set 1, vector 244 +Key: 0000000000000000000000000000000000000000000000000000000000000800 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B542CEF08D13E300B282CE6A74C51C96 +Test: Encrypt +Comment: Set 1, vector 245 +Key: 0000000000000000000000000000000000000000000000000000000000000400 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 9955E16433B0D58BFC4B35EE9F44734C +Test: Encrypt +Comment: Set 1, vector 246 +Key: 0000000000000000000000000000000000000000000000000000000000000200 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 5027A7DDC6F99A112E45D3090C7C3465 +Test: Encrypt +Comment: Set 1, vector 247 +Key: 0000000000000000000000000000000000000000000000000000000000000100 +Plaintext: 00000000000000000000000000000000 +Ciphertext: CB14EBD24FC63194495FACFFB5C3A07B +Test: Encrypt +Comment: Set 1, vector 248 +Key: 0000000000000000000000000000000000000000000000000000000000000080 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 2BCBE64545A08F59178242452566B997 +Test: Encrypt +Comment: Set 1, vector 249 +Key: 0000000000000000000000000000000000000000000000000000000000000040 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DE428FF12360A0C8FAE73E9D8E6A0657 +Test: Encrypt +Comment: Set 1, vector 250 +Key: 0000000000000000000000000000000000000000000000000000000000000020 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 6425603FCB0F088D87D3AC7078C7014C +Test: Encrypt +Comment: Set 1, vector 251 +Key: 0000000000000000000000000000000000000000000000000000000000000010 +Plaintext: 00000000000000000000000000000000 +Ciphertext: A837813C9436F4C48C45B6C85A4EAF84 +Test: Encrypt +Comment: Set 1, vector 252 +Key: 0000000000000000000000000000000000000000000000000000000000000008 +Plaintext: 00000000000000000000000000000000 +Ciphertext: B95F9010E694BA44B812D6A7A59E027A +Test: Encrypt +Comment: Set 1, vector 253 +Key: 0000000000000000000000000000000000000000000000000000000000000004 +Plaintext: 00000000000000000000000000000000 +Ciphertext: DF2746A2D9ED707DCC686BB64B77C9DD +Test: Encrypt +Comment: Set 1, vector 254 +Key: 0000000000000000000000000000000000000000000000000000000000000002 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 40DD304C3FC8FEF5D7D08FD467E018F6 +Test: Encrypt +Comment: Set 1, vector 255 +Key: 0000000000000000000000000000000000000000000000000000000000000001 +Plaintext: 00000000000000000000000000000000 +Ciphertext: AFCD38B195E0A736304E89B9AE3019D3 +Test: Encrypt +Comment: Set 2, vector 0 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 80000000000000000000000000000000 +Ciphertext: B0C6B88AEA518AB09E847248E91B1B9D +Test: Encrypt +Comment: Set 2, vector 1 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 40000000000000000000000000000000 +Ciphertext: B8D7684E35FA1DB15BDCEE7A48659858 +Test: Encrypt +Comment: Set 2, vector 2 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 20000000000000000000000000000000 +Ciphertext: F0CAD59AF92FBB79F36951E697492750 +Test: Encrypt +Comment: Set 2, vector 3 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 10000000000000000000000000000000 +Ciphertext: 117100F6635389560DC4A2DA24EBA70F +Test: Encrypt +Comment: Set 2, vector 4 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 08000000000000000000000000000000 +Ciphertext: DBDD62355553019ED84C35886421E532 +Test: Encrypt +Comment: Set 2, vector 5 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 04000000000000000000000000000000 +Ciphertext: 9CB8D04FA506F19848F7B9110518BFC8 +Test: Encrypt +Comment: Set 2, vector 6 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 02000000000000000000000000000000 +Ciphertext: E4308E253BC3444D293500701BA82C6A +Test: Encrypt +Comment: Set 2, vector 7 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 01000000000000000000000000000000 +Ciphertext: EA2FAE53F7F30C0170A20E95A068503E +Test: Encrypt +Comment: Set 2, vector 8 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00800000000000000000000000000000 +Ciphertext: 14B14839EA221880B2C64D1FE000B93D +Test: Encrypt +Comment: Set 2, vector 9 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00400000000000000000000000000000 +Ciphertext: A5CFC075B342D5101AACC334E73058BB +Test: Encrypt +Comment: Set 2, vector 10 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00200000000000000000000000000000 +Ciphertext: 477EA56B2EBAD0F8AC5E1936866560FF +Test: Encrypt +Comment: Set 2, vector 11 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00100000000000000000000000000000 +Ciphertext: 107E8598418404196EC59F63E45B7F6D +Test: Encrypt +Comment: Set 2, vector 12 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00080000000000000000000000000000 +Ciphertext: FF6A891E7C1C074A68FEC291928FDD8D +Test: Encrypt +Comment: Set 2, vector 13 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00040000000000000000000000000000 +Ciphertext: F64C250A13F45D377ADB7545B2B157A9 +Test: Encrypt +Comment: Set 2, vector 14 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00020000000000000000000000000000 +Ciphertext: FAD0F252086F11C830C65B63197CBC38 +Test: Encrypt +Comment: Set 2, vector 15 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00010000000000000000000000000000 +Ciphertext: 9DCB89B209441F02AD0D25C6AB826629 +Test: Encrypt +Comment: Set 2, vector 16 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00008000000000000000000000000000 +Ciphertext: E62E4ED4E4F34EDC563710D960E09D4C +Test: Encrypt +Comment: Set 2, vector 17 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00004000000000000000000000000000 +Ciphertext: 98A1B926BA06895C3F2E84CCBACBC356 +Test: Encrypt +Comment: Set 2, vector 18 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00002000000000000000000000000000 +Ciphertext: 29BE0BE4DB7F4D196718AEA38F3B0BFD +Test: Encrypt +Comment: Set 2, vector 19 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00001000000000000000000000000000 +Ciphertext: F670C4EBECBA0B43E71F6D752BFD4854 +Test: Encrypt +Comment: Set 2, vector 20 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000800000000000000000000000000 +Ciphertext: 7D7666B4484CDB7E3605468E093A787C +Test: Encrypt +Comment: Set 2, vector 21 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000400000000000000000000000000 +Ciphertext: 562D06B181C091DA6C43642AE99460C6 +Test: Encrypt +Comment: Set 2, vector 22 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000200000000000000000000000000 +Ciphertext: AB0EFB5975E6186B7D76BC9672453488 +Test: Encrypt +Comment: Set 2, vector 23 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000100000000000000000000000000 +Ciphertext: 10C0756538E7BFF88D19AE2B1F7B859A +Test: Encrypt +Comment: Set 2, vector 24 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000080000000000000000000000000 +Ciphertext: AF7FCD5248F8C72F1695AA05DD1CADE0 +Test: Encrypt +Comment: Set 2, vector 25 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000040000000000000000000000000 +Ciphertext: 9841E555655609A75D7BE20B8A90EF1E +Test: Encrypt +Comment: Set 2, vector 26 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000020000000000000000000000000 +Ciphertext: 27F9546E6A1B7464780000561783569C +Test: Encrypt +Comment: Set 2, vector 27 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000010000000000000000000000000 +Ciphertext: 8671D935D7A8354EECB7288803D42D7A +Test: Encrypt +Comment: Set 2, vector 28 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000008000000000000000000000000 +Ciphertext: 0DA44F508DEBC6F044394624FCEB8EBE +Test: Encrypt +Comment: Set 2, vector 29 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000004000000000000000000000000 +Ciphertext: AB137369BE6D93FBB18006BDB236EC09 +Test: Encrypt +Comment: Set 2, vector 30 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000002000000000000000000000000 +Ciphertext: EB90C4E597A7E1779FFA260886E26F75 +Test: Encrypt +Comment: Set 2, vector 31 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000001000000000000000000000000 +Ciphertext: 618CF3588D5C128EAF252616230E08F7 +Test: Encrypt +Comment: Set 2, vector 32 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000800000000000000000000000 +Ciphertext: 98DC4DB49D197AB9152D12B9DE2D73CA +Test: Encrypt +Comment: Set 2, vector 33 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000400000000000000000000000 +Ciphertext: 5BDDE24B15702A35E1F140C57D206443 +Test: Encrypt +Comment: Set 2, vector 34 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000200000000000000000000000 +Ciphertext: CF755809882BED8BA2F9F1A4ED296A2B +Test: Encrypt +Comment: Set 2, vector 35 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000100000000000000000000000 +Ciphertext: F1A8DBB999538AE89D16F92A7F4D1DF1 +Test: Encrypt +Comment: Set 2, vector 36 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000080000000000000000000000 +Ciphertext: 775222FDDAAECB81CF675C4E0B98179E +Test: Encrypt +Comment: Set 2, vector 37 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000040000000000000000000000 +Ciphertext: 12A648CADCD153C760A965826683119A +Test: Encrypt +Comment: Set 2, vector 38 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000020000000000000000000000 +Ciphertext: 0503FB10AB241E7CF45D8CDEEE474335 +Test: Encrypt +Comment: Set 2, vector 39 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000010000000000000000000000 +Ciphertext: 3D299C0070CBBD831B802690B8E7CA24 +Test: Encrypt +Comment: Set 2, vector 40 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000008000000000000000000000 +Ciphertext: 33105BD4D11D66753DC34D128BEFE3F4 +Test: Encrypt +Comment: Set 2, vector 41 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000004000000000000000000000 +Ciphertext: 5EFCE2B4B987C0F77D27B44836881682 +Test: Encrypt +Comment: Set 2, vector 42 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000002000000000000000000000 +Ciphertext: 7835449454128035D7F0EA99E327577B +Test: Encrypt +Comment: Set 2, vector 43 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000001000000000000000000000 +Ciphertext: 27BEDDA0601BE35122FB1D272D73AB3E +Test: Encrypt +Comment: Set 2, vector 44 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000800000000000000000000 +Ciphertext: 54C3F99FF48E318CC515EDE75800C4B3 +Test: Encrypt +Comment: Set 2, vector 45 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000400000000000000000000 +Ciphertext: C627C329F8E48299F6FDB23B9DBEA0BB +Test: Encrypt +Comment: Set 2, vector 46 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000200000000000000000000 +Ciphertext: 1B6578F9E23BD8C1845A02431C5F9AA3 +Test: Encrypt +Comment: Set 2, vector 47 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000100000000000000000000 +Ciphertext: 6DB2FB8C0B9344D0547C0FF1292020C6 +Test: Encrypt +Comment: Set 2, vector 48 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000080000000000000000000 +Ciphertext: 4FAD9B2C37C131493FBEF53581FA4F83 +Test: Encrypt +Comment: Set 2, vector 49 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000040000000000000000000 +Ciphertext: 47502A01E93D2C87BD5584F6AFD3D99D +Test: Encrypt +Comment: Set 2, vector 50 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000020000000000000000000 +Ciphertext: 056E1C6F651BFE50271B3B7A18E76D84 +Test: Encrypt +Comment: Set 2, vector 51 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000010000000000000000000 +Ciphertext: 5632BAF6627B3D96AD4E06FA6A561F55 +Test: Encrypt +Comment: Set 2, vector 52 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000008000000000000000000 +Ciphertext: E29807CAACDFA2D41A7D9E91FA7FD8EB +Test: Encrypt +Comment: Set 2, vector 53 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000004000000000000000000 +Ciphertext: 81DD44BB5D1822DEE605F9E6FF01D7B3 +Test: Encrypt +Comment: Set 2, vector 54 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000002000000000000000000 +Ciphertext: 5C3649925E47D7FF96482A8FBD9666FD +Test: Encrypt +Comment: Set 2, vector 55 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000001000000000000000000 +Ciphertext: 695415A836E66E737887845EC08A1ADB +Test: Encrypt +Comment: Set 2, vector 56 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000800000000000000000 +Ciphertext: F5416BCE292D9E2CEA5D1CC70BBAEED1 +Test: Encrypt +Comment: Set 2, vector 57 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000400000000000000000 +Ciphertext: 7AEC4F1388FC29C47F7FED74ADDE8485 +Test: Encrypt +Comment: Set 2, vector 58 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000200000000000000000 +Ciphertext: 82A9F1A6CE08BC4876E649D8A8EA7EB6 +Test: Encrypt +Comment: Set 2, vector 59 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000100000000000000000 +Ciphertext: B6296C88ADF1A792908B065EEB04BFC2 +Test: Encrypt +Comment: Set 2, vector 60 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000080000000000000000 +Ciphertext: E766A39AECCA40BDBFBE6FF3FA292913 +Test: Encrypt +Comment: Set 2, vector 61 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000040000000000000000 +Ciphertext: C6D081454EA00D83C23B5A62C84359E1 +Test: Encrypt +Comment: Set 2, vector 62 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000020000000000000000 +Ciphertext: 85D259A79CCA80484504D1603F7A8F53 +Test: Encrypt +Comment: Set 2, vector 63 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000010000000000000000 +Ciphertext: D8291FA1C6DC250078824B2D0A20883F +Test: Encrypt +Comment: Set 2, vector 64 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000008000000000000000 +Ciphertext: 95387CB74C48FFBD1F8D64A6CC45E074 +Test: Encrypt +Comment: Set 2, vector 65 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000004000000000000000 +Ciphertext: A17F975F538F56CDF629B516011DE837 +Test: Encrypt +Comment: Set 2, vector 66 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000002000000000000000 +Ciphertext: B50B615A1654C6E1CB6AB33716C097FE +Test: Encrypt +Comment: Set 2, vector 67 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000001000000000000000 +Ciphertext: 7BBB2CBB874DF6C8B821DA7FB0F9011B +Test: Encrypt +Comment: Set 2, vector 68 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000800000000000000 +Ciphertext: E9EFE074D096A275E47CD2E6206DF6A1 +Test: Encrypt +Comment: Set 2, vector 69 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000400000000000000 +Ciphertext: 88F2F8D5A836406AE8BBB98C65BBDA55 +Test: Encrypt +Comment: Set 2, vector 70 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000200000000000000 +Ciphertext: F64620D8D87585A3EF038B9AD58F5EA0 +Test: Encrypt +Comment: Set 2, vector 71 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000100000000000000 +Ciphertext: 694438EC141C8ED5F2F898B4554A298F +Test: Encrypt +Comment: Set 2, vector 72 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000080000000000000 +Ciphertext: 3E6226EC7726A1EE5F5FA9B18CCE8C44 +Test: Encrypt +Comment: Set 2, vector 73 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000040000000000000 +Ciphertext: 8AB6949E79911647800B9E87362AB97A +Test: Encrypt +Comment: Set 2, vector 74 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000020000000000000 +Ciphertext: 093C5CF24EDAF7F9F1C8A80DE4FF50A9 +Test: Encrypt +Comment: Set 2, vector 75 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000010000000000000 +Ciphertext: 28A36E50061F19E240351ED0E378CBF4 +Test: Encrypt +Comment: Set 2, vector 76 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000008000000000000 +Ciphertext: B93BB36CB88BF26EA79198652AA51D3C +Test: Encrypt +Comment: Set 2, vector 77 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000004000000000000 +Ciphertext: DE4948083D044FAC9BCA6DA8CD67B8A6 +Test: Encrypt +Comment: Set 2, vector 78 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000002000000000000 +Ciphertext: 6E778B5BDA6CA118117E47470D080D3C +Test: Encrypt +Comment: Set 2, vector 79 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000001000000000000 +Ciphertext: 0A9107324DA32B4281D032A3487EF875 +Test: Encrypt +Comment: Set 2, vector 80 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000800000000000 +Ciphertext: 18ED5635312D71ABD123CCE779D4D68A +Test: Encrypt +Comment: Set 2, vector 81 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000400000000000 +Ciphertext: 2E3C63F95C4BC1F944BAB06DEDC9AA8E +Test: Encrypt +Comment: Set 2, vector 82 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000200000000000 +Ciphertext: ACCC869EF07004C8C3C709083BE7BA2F +Test: Encrypt +Comment: Set 2, vector 83 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000100000000000 +Ciphertext: DF60B34FB1A59147CC1FB049C1578206 +Test: Encrypt +Comment: Set 2, vector 84 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000080000000000 +Ciphertext: 4228DC636C08E41021054AA0E1E2227A +Test: Encrypt +Comment: Set 2, vector 85 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000040000000000 +Ciphertext: 7CE27F66EFD735FFD6B3E1738C50495B +Test: Encrypt +Comment: Set 2, vector 86 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000020000000000 +Ciphertext: F8E74B33A9CDE351DA0BBC06D69093D7 +Test: Encrypt +Comment: Set 2, vector 87 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000010000000000 +Ciphertext: AE0D22A5B37B8DC5D81CC641EED334D0 +Test: Encrypt +Comment: Set 2, vector 88 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000008000000000 +Ciphertext: C181C6CA5E163743458B9167A0B6A16A +Test: Encrypt +Comment: Set 2, vector 89 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000004000000000 +Ciphertext: 5171F4F6095E4B276CFBA1F07223FBE6 +Test: Encrypt +Comment: Set 2, vector 90 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000002000000000 +Ciphertext: 2732F4D3A8C9D1D8D493840D6E0B864F +Test: Encrypt +Comment: Set 2, vector 91 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000001000000000 +Ciphertext: 3EF04E0059A061D973532CA5C1DFBE7B +Test: Encrypt +Comment: Set 2, vector 92 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000800000000 +Ciphertext: 6D9A8F23579E4978EBAA87B5ADEB77E5 +Test: Encrypt +Comment: Set 2, vector 93 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000400000000 +Ciphertext: BBD08873CC44BA4253C0C41FEEB7F124 +Test: Encrypt +Comment: Set 2, vector 94 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000200000000 +Ciphertext: 72E4B2437CBD283F3809CE686F6A591E +Test: Encrypt +Comment: Set 2, vector 95 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000100000000 +Ciphertext: 6E5580514B92512B1BF4B1B987B9AA1B +Test: Encrypt +Comment: Set 2, vector 96 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000080000000 +Ciphertext: 5EF5D0C5BCBDCB604D3A083B68CE0FA3 +Test: Encrypt +Comment: Set 2, vector 97 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000040000000 +Ciphertext: 9D991FDD723AD2182777A15CA0E0F665 +Test: Encrypt +Comment: Set 2, vector 98 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000020000000 +Ciphertext: 24440626EFC8F86BEA7DE78085AB8A22 +Test: Encrypt +Comment: Set 2, vector 99 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000010000000 +Ciphertext: 17C3630D62D13C1E826C0FCCBD74A864 +Test: Encrypt +Comment: Set 2, vector 100 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000008000000 +Ciphertext: 4CF5AB86A56AB134A7FE46CCE3F9FCE9 +Test: Encrypt +Comment: Set 2, vector 101 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000004000000 +Ciphertext: 3E6B9C0388F6D9B8F458F30221907607 +Test: Encrypt +Comment: Set 2, vector 102 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000002000000 +Ciphertext: AD9C926B8A5CD98EEE88200617E59958 +Test: Encrypt +Comment: Set 2, vector 103 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000001000000 +Ciphertext: AFF8AED5E075E02AF720CA4BF0028B3B +Test: Encrypt +Comment: Set 2, vector 104 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000800000 +Ciphertext: D90EAFF909202BB209BB3BB8C7F9A954 +Test: Encrypt +Comment: Set 2, vector 105 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000400000 +Ciphertext: 2C709B00E6A22F00F64A7D8EE341853F +Test: Encrypt +Comment: Set 2, vector 106 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000200000 +Ciphertext: CCEC598F0D9F0BF201B2F487136D54A4 +Test: Encrypt +Comment: Set 2, vector 107 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000100000 +Ciphertext: 73B2883A0A166AAE1BF14E60A5195FA3 +Test: Encrypt +Comment: Set 2, vector 108 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000080000 +Ciphertext: E676867BD9AD5EF915143388496779D7 +Test: Encrypt +Comment: Set 2, vector 109 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000040000 +Ciphertext: CDCB73D1BFCFD4BE7F1DAA9B1C6A4055 +Test: Encrypt +Comment: Set 2, vector 110 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000020000 +Ciphertext: 02A3A5C89DAA24CD2C517F7A73286A89 +Test: Encrypt +Comment: Set 2, vector 111 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000010000 +Ciphertext: C0FA2AC9E92EE58C2DD12D6D43AB7035 +Test: Encrypt +Comment: Set 2, vector 112 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000008000 +Ciphertext: EDC2CB1F7291353BDBF2385519E6AE16 +Test: Encrypt +Comment: Set 2, vector 113 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000004000 +Ciphertext: B4B62D16D197A98CD3B978812B9D9884 +Test: Encrypt +Comment: Set 2, vector 114 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000002000 +Ciphertext: 5CDFC95A529A905101CEA26BC1B891ED +Test: Encrypt +Comment: Set 2, vector 115 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000001000 +Ciphertext: CC7150CD3650B98363296C7C4ED368D1 +Test: Encrypt +Comment: Set 2, vector 116 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000800 +Ciphertext: CC57706B0C6526B8E25A5DBD32EACBDB +Test: Encrypt +Comment: Set 2, vector 117 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000400 +Ciphertext: 30D30456AD98B182D64C649648F6AEC9 +Test: Encrypt +Comment: Set 2, vector 118 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000200 +Ciphertext: D7E9DA7F631938EB649A08AF82FBD75F +Test: Encrypt +Comment: Set 2, vector 119 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000100 +Ciphertext: B8DA2AF6600B07895B5D0FFAF4991469 +Test: Encrypt +Comment: Set 2, vector 120 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000080 +Ciphertext: 0F6F64F930BA6C178943322B98114599 +Test: Encrypt +Comment: Set 2, vector 121 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000040 +Ciphertext: 8B1F247802E47C91BEE2AA34ECFD7A01 +Test: Encrypt +Comment: Set 2, vector 122 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000020 +Ciphertext: 7A6985778D3A66E97F23E01F0D0E45E7 +Test: Encrypt +Comment: Set 2, vector 123 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000010 +Ciphertext: BA664AC39855518DFDEE10D1B3111FAE +Test: Encrypt +Comment: Set 2, vector 124 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000008 +Ciphertext: 7C92854D801A1648F65CA81813DDBF83 +Test: Encrypt +Comment: Set 2, vector 125 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000004 +Ciphertext: 6A3F25AAB7E92D9CF378E5D9C040F26B +Test: Encrypt +Comment: Set 2, vector 126 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000002 +Ciphertext: 3D4B2CDE666761BA5DFB305178E667FB +Test: Encrypt +Comment: Set 2, vector 127 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000001 +Ciphertext: 9CDB269B5D293BC5DB9C55B057D9B591 +Test: Encrypt +Comment: Set 3, vector 0 +Key: 0000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 396154111ADEFC500CF6E5C99038BC17 +Test: Encrypt +Comment: Set 3, vector 1 +Key: 0101010101010101010101010101010101010101010101010101010101010101 +Plaintext: 01010101010101010101010101010101 +Ciphertext: 438D0C2E7E86869B56EBA23B66086A01 +Test: Encrypt +Comment: Set 3, vector 2 +Key: 0202020202020202020202020202020202020202020202020202020202020202 +Plaintext: 02020202020202020202020202020202 +Ciphertext: D4F553BFA794F55EF3B7A578629F6DEA +Test: Encrypt +Comment: Set 3, vector 3 +Key: 0303030303030303030303030303030303030303030303030303030303030303 +Plaintext: 03030303030303030303030303030303 +Ciphertext: B1EB06630CF3E25AEF18FA34709232F7 +Test: Encrypt +Comment: Set 3, vector 4 +Key: 0404040404040404040404040404040404040404040404040404040404040404 +Plaintext: 04040404040404040404040404040404 +Ciphertext: 5E858730ABC9823A93CA4CAB67F0B423 +Test: Encrypt +Comment: Set 3, vector 5 +Key: 0505050505050505050505050505050505050505050505050505050505050505 +Plaintext: 05050505050505050505050505050505 +Ciphertext: 9FC988D43FE3712CF6D2DB552FE3C80F +Test: Encrypt +Comment: Set 3, vector 6 +Key: 0606060606060606060606060606060606060606060606060606060606060606 +Plaintext: 06060606060606060606060606060606 +Ciphertext: 6109500D59414C9974D15818A2BA6DD0 +Test: Encrypt +Comment: Set 3, vector 7 +Key: 0707070707070707070707070707070707070707070707070707070707070707 +Plaintext: 07070707070707070707070707070707 +Ciphertext: 5F6BF9AC53A680EACAE7583A8933DA8E +Test: Encrypt +Comment: Set 3, vector 8 +Key: 0808080808080808080808080808080808080808080808080808080808080808 +Plaintext: 08080808080808080808080808080808 +Ciphertext: F9A9C1540AE1B314DBEDF9A49054DC9D +Test: Encrypt +Comment: Set 3, vector 9 +Key: 0909090909090909090909090909090909090909090909090909090909090909 +Plaintext: 09090909090909090909090909090909 +Ciphertext: 6D66755ACDB9D90BEC599A0BC0C7BF48 +Test: Encrypt +Comment: Set 3, vector 10 +Key: 0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A +Plaintext: 0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A +Ciphertext: 5527F328AF93C2D5CCC80AF7A3E8DF3D +Test: Encrypt +Comment: Set 3, vector 11 +Key: 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B +Plaintext: 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B +Ciphertext: 27AA99F8E6EA08D8E8D5A528EE4774B6 +Test: Encrypt +Comment: Set 3, vector 12 +Key: 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C +Plaintext: 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C +Ciphertext: 46F7D660A22232F5E3664EF355098CE4 +Test: Encrypt +Comment: Set 3, vector 13 +Key: 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D +Plaintext: 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D +Ciphertext: BDC0AEC72B53B747AB5C7BD62062826A +Test: Encrypt +Comment: Set 3, vector 14 +Key: 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E +Plaintext: 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E +Ciphertext: A0CAB391DC8BFF0281F3E1C70C1CE33B +Test: Encrypt +Comment: Set 3, vector 15 +Key: 0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F +Plaintext: 0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F +Ciphertext: 5CBFB3E894AE1428549CCF777A9F0A73 +Test: Encrypt +Comment: Set 3, vector 16 +Key: 1010101010101010101010101010101010101010101010101010101010101010 +Plaintext: 10101010101010101010101010101010 +Ciphertext: 6693FC130669F194F81E8D175194DDA2 +Test: Encrypt +Comment: Set 3, vector 17 +Key: 1111111111111111111111111111111111111111111111111111111111111111 +Plaintext: 11111111111111111111111111111111 +Ciphertext: A6A72472F8C04329C0E2FB56982A33C7 +Test: Encrypt +Comment: Set 3, vector 18 +Key: 1212121212121212121212121212121212121212121212121212121212121212 +Plaintext: 12121212121212121212121212121212 +Ciphertext: 6321875C5F89CCE16C6FF5E85E759C9A +Test: Encrypt +Comment: Set 3, vector 19 +Key: 1313131313131313131313131313131313131313131313131313131313131313 +Plaintext: 13131313131313131313131313131313 +Ciphertext: 8819C97D05C91A23062E9851F07EF6F7 +Test: Encrypt +Comment: Set 3, vector 20 +Key: 1414141414141414141414141414141414141414141414141414141414141414 +Plaintext: 14141414141414141414141414141414 +Ciphertext: F894FEB12164BB32AC846DD9530604CE +Test: Encrypt +Comment: Set 3, vector 21 +Key: 1515151515151515151515151515151515151515151515151515151515151515 +Plaintext: 15151515151515151515151515151515 +Ciphertext: 61B02392CD3F571B35C862E703DB2053 +Test: Encrypt +Comment: Set 3, vector 22 +Key: 1616161616161616161616161616161616161616161616161616161616161616 +Plaintext: 16161616161616161616161616161616 +Ciphertext: 6269E137F8480D555D1B24F392162DBA +Test: Encrypt +Comment: Set 3, vector 23 +Key: 1717171717171717171717171717171717171717171717171717171717171717 +Plaintext: 17171717171717171717171717171717 +Ciphertext: B6662F56AA3D23DE1DFDE165B2D63FA0 +Test: Encrypt +Comment: Set 3, vector 24 +Key: 1818181818181818181818181818181818181818181818181818181818181818 +Plaintext: 18181818181818181818181818181818 +Ciphertext: C8271ACE969013EE2C9EF1512FFABAE5 +Test: Encrypt +Comment: Set 3, vector 25 +Key: 1919191919191919191919191919191919191919191919191919191919191919 +Plaintext: 19191919191919191919191919191919 +Ciphertext: 6982E764E750CDF3E5F9C4E40A5DFE28 +Test: Encrypt +Comment: Set 3, vector 26 +Key: 1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A +Plaintext: 1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A +Ciphertext: 23172E86AF4A140A78CB1DC776270FFF +Test: Encrypt +Comment: Set 3, vector 27 +Key: 1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B +Plaintext: 1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B +Ciphertext: BA0BD958FC1DE142EC40326B2C315AA5 +Test: Encrypt +Comment: Set 3, vector 28 +Key: 1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C +Plaintext: 1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C +Ciphertext: 7FB2B8A4B95CBFB74BFD5F7A5641261C +Test: Encrypt +Comment: Set 3, vector 29 +Key: 1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D +Plaintext: 1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D +Ciphertext: 56B261D89F8978041E2602DF97386BF7 +Test: Encrypt +Comment: Set 3, vector 30 +Key: 1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E +Plaintext: 1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E +Ciphertext: A2D74F5148C84C1F990290E17DD3EDFA +Test: Encrypt +Comment: Set 3, vector 31 +Key: 1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F +Plaintext: 1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F +Ciphertext: 7D8BC76F1D941FC3C7E4C6F17AC03FF4 +Test: Encrypt +Comment: Set 3, vector 32 +Key: 2020202020202020202020202020202020202020202020202020202020202020 +Plaintext: 20202020202020202020202020202020 +Ciphertext: F3E1FDA6B9C8314799F4654C29F1C690 +Test: Encrypt +Comment: Set 3, vector 33 +Key: 2121212121212121212121212121212121212121212121212121212121212121 +Plaintext: 21212121212121212121212121212121 +Ciphertext: 9BB8499B8631F6211D22DE555010E482 +Test: Encrypt +Comment: Set 3, vector 34 +Key: 2222222222222222222222222222222222222222222222222222222222222222 +Plaintext: 22222222222222222222222222222222 +Ciphertext: B098D857086ABC425B437BD63E8A53D2 +Test: Encrypt +Comment: Set 3, vector 35 +Key: 2323232323232323232323232323232323232323232323232323232323232323 +Plaintext: 23232323232323232323232323232323 +Ciphertext: F157E2B1298A205C7EF526F3E3196BF4 +Test: Encrypt +Comment: Set 3, vector 36 +Key: 2424242424242424242424242424242424242424242424242424242424242424 +Plaintext: 24242424242424242424242424242424 +Ciphertext: 91FE4F664ED2FE0097D8B95703694BBE +Test: Encrypt +Comment: Set 3, vector 37 +Key: 2525252525252525252525252525252525252525252525252525252525252525 +Plaintext: 25252525252525252525252525252525 +Ciphertext: 742EF3C2DC4490F7D1BDB3031137B6C1 +Test: Encrypt +Comment: Set 3, vector 38 +Key: 2626262626262626262626262626262626262626262626262626262626262626 +Plaintext: 26262626262626262626262626262626 +Ciphertext: 79302D9C8DBBBDAD7B8D8B9E7A60E42D +Test: Encrypt +Comment: Set 3, vector 39 +Key: 2727272727272727272727272727272727272727272727272727272727272727 +Plaintext: 27272727272727272727272727272727 +Ciphertext: 4F4DA48026B809452E7FFB1C3DAFBD99 +Test: Encrypt +Comment: Set 3, vector 40 +Key: 2828282828282828282828282828282828282828282828282828282828282828 +Plaintext: 28282828282828282828282828282828 +Ciphertext: 6D9DF175ED0DAFE550619CF8362B98E8 +Test: Encrypt +Comment: Set 3, vector 41 +Key: 2929292929292929292929292929292929292929292929292929292929292929 +Plaintext: 29292929292929292929292929292929 +Ciphertext: 5D4A406E3C89612AA89A9D38A80ECFEF +Test: Encrypt +Comment: Set 3, vector 42 +Key: 2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A +Plaintext: 2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A +Ciphertext: 51CE933AD1EB3117A129788D3D0B815A +Test: Encrypt +Comment: Set 3, vector 43 +Key: 2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B +Plaintext: 2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B +Ciphertext: DD39326230AC02767866ADE07AED1DAA +Test: Encrypt +Comment: Set 3, vector 44 +Key: 2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C +Plaintext: 2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C +Ciphertext: DC493BAD40D435273B18026DE5412278 +Test: Encrypt +Comment: Set 3, vector 45 +Key: 2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D +Plaintext: 2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D +Ciphertext: 8A61E9750E1DAC58C92F5E243CA7465B +Test: Encrypt +Comment: Set 3, vector 46 +Key: 2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E +Plaintext: 2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E +Ciphertext: 57A7641E6A7B61A86AFD7A23578DFBC5 +Test: Encrypt +Comment: Set 3, vector 47 +Key: 2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F +Plaintext: 2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F +Ciphertext: 019A8F9D38B4B92B077D08B025C15550 +Test: Encrypt +Comment: Set 3, vector 48 +Key: 3030303030303030303030303030303030303030303030303030303030303030 +Plaintext: 30303030303030303030303030303030 +Ciphertext: 9F6EEA9C215C273135C53A3F4208469E +Test: Encrypt +Comment: Set 3, vector 49 +Key: 3131313131313131313131313131313131313131313131313131313131313131 +Plaintext: 31313131313131313131313131313131 +Ciphertext: 7BF3D63D790CAB57EA8354B10FEBDE18 +Test: Encrypt +Comment: Set 3, vector 50 +Key: 3232323232323232323232323232323232323232323232323232323232323232 +Plaintext: 32323232323232323232323232323232 +Ciphertext: AB30751ED4052A1D916E50C4073DFCB5 +Test: Encrypt +Comment: Set 3, vector 51 +Key: 3333333333333333333333333333333333333333333333333333333333333333 +Plaintext: 33333333333333333333333333333333 +Ciphertext: C39180F205BBA8BEE9832BF56FCC75C0 +Test: Encrypt +Comment: Set 3, vector 52 +Key: 3434343434343434343434343434343434343434343434343434343434343434 +Plaintext: 34343434343434343434343434343434 +Ciphertext: 3BEDE5E09CB9CCFC8BE38F8378D49AE9 +Test: Encrypt +Comment: Set 3, vector 53 +Key: 3535353535353535353535353535353535353535353535353535353535353535 +Plaintext: 35353535353535353535353535353535 +Ciphertext: 448AE4ADF7070A8B8C4AB0FE7277E8D7 +Test: Encrypt +Comment: Set 3, vector 54 +Key: 3636363636363636363636363636363636363636363636363636363636363636 +Plaintext: 36363636363636363636363636363636 +Ciphertext: 095A361F2243FC39F4ECD94A5AC0F94A +Test: Encrypt +Comment: Set 3, vector 55 +Key: 3737373737373737373737373737373737373737373737373737373737373737 +Plaintext: 37373737373737373737373737373737 +Ciphertext: AD77D7D2A7F3AF5732CE5A51E83D7025 +Test: Encrypt +Comment: Set 3, vector 56 +Key: 3838383838383838383838383838383838383838383838383838383838383838 +Plaintext: 38383838383838383838383838383838 +Ciphertext: 930DA09C18DF5F6D072AA662CC8F7751 +Test: Encrypt +Comment: Set 3, vector 57 +Key: 3939393939393939393939393939393939393939393939393939393939393939 +Plaintext: 39393939393939393939393939393939 +Ciphertext: F3B3871B66FE8A1FA4AE2150EC8B7060 +Test: Encrypt +Comment: Set 3, vector 58 +Key: 3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A +Plaintext: 3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A +Ciphertext: 62DD93CFA7EFC223A822A6F754B6298D +Test: Encrypt +Comment: Set 3, vector 59 +Key: 3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B +Plaintext: 3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B +Ciphertext: C86A0377B3C45C2B1896829D7B0610F3 +Test: Encrypt +Comment: Set 3, vector 60 +Key: 3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C +Plaintext: 3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C +Ciphertext: 8CCFC961EBAB55C0ECB1B10EDEDD9C61 +Test: Encrypt +Comment: Set 3, vector 61 +Key: 3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D +Plaintext: 3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D +Ciphertext: D828E857BDBD6192300764A2084E0680 +Test: Encrypt +Comment: Set 3, vector 62 +Key: 3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E +Plaintext: 3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E +Ciphertext: 24C0DC84D72EA678201534CE8DC22A45 +Test: Encrypt +Comment: Set 3, vector 63 +Key: 3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F +Plaintext: 3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F +Ciphertext: D65F340A25D35E5D0B08C63FA44F9898 +Test: Encrypt +Comment: Set 3, vector 64 +Key: 4040404040404040404040404040404040404040404040404040404040404040 +Plaintext: 40404040404040404040404040404040 +Ciphertext: 4A30476F1141FBF303ED63FCD3CB0536 +Test: Encrypt +Comment: Set 3, vector 65 +Key: 4141414141414141414141414141414141414141414141414141414141414141 +Plaintext: 41414141414141414141414141414141 +Ciphertext: 78246080B38B5283960E0253E2FF6A5E +Test: Encrypt +Comment: Set 3, vector 66 +Key: 4242424242424242424242424242424242424242424242424242424242424242 +Plaintext: 42424242424242424242424242424242 +Ciphertext: 475E8388EE3D3EE111DD0E816B244DD2 +Test: Encrypt +Comment: Set 3, vector 67 +Key: 4343434343434343434343434343434343434343434343434343434343434343 +Plaintext: 43434343434343434343434343434343 +Ciphertext: D40D3FECE8B05875F2FCD23526CCD6B2 +Test: Encrypt +Comment: Set 3, vector 68 +Key: 4444444444444444444444444444444444444444444444444444444444444444 +Plaintext: 44444444444444444444444444444444 +Ciphertext: CD9846E1B120482E6B6D71C4F5D704FE +Test: Encrypt +Comment: Set 3, vector 69 +Key: 4545454545454545454545454545454545454545454545454545454545454545 +Plaintext: 45454545454545454545454545454545 +Ciphertext: E707C35474257CE52617B5889ECB974B +Test: Encrypt +Comment: Set 3, vector 70 +Key: 4646464646464646464646464646464646464646464646464646464646464646 +Plaintext: 46464646464646464646464646464646 +Ciphertext: 9A79D57FD89D938F4B4CACA52E8CB544 +Test: Encrypt +Comment: Set 3, vector 71 +Key: 4747474747474747474747474747474747474747474747474747474747474747 +Plaintext: 47474747474747474747474747474747 +Ciphertext: 34F9B98AC130F7E7B123ECBF8910735C +Test: Encrypt +Comment: Set 3, vector 72 +Key: 4848484848484848484848484848484848484848484848484848484848484848 +Plaintext: 48484848484848484848484848484848 +Ciphertext: BF75CC83FE76E8A15981DA738E5A8513 +Test: Encrypt +Comment: Set 3, vector 73 +Key: 4949494949494949494949494949494949494949494949494949494949494949 +Plaintext: 49494949494949494949494949494949 +Ciphertext: 4A452EFBE634441444FB50641CB2EFC1 +Test: Encrypt +Comment: Set 3, vector 74 +Key: 4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A +Plaintext: 4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A +Ciphertext: 3D5ED11F0C81E81BAB97B7148D67BA55 +Test: Encrypt +Comment: Set 3, vector 75 +Key: 4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B +Plaintext: 4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B +Ciphertext: DBBAE78B177C27954DEDBAD5D98E7BEE +Test: Encrypt +Comment: Set 3, vector 76 +Key: 4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C +Plaintext: 4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C +Ciphertext: F52D16EFC5DE991430F6E7D13983DEB8 +Test: Encrypt +Comment: Set 3, vector 77 +Key: 4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D +Plaintext: 4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D +Ciphertext: B6C98EBC320B3BDD927C2FE57F8180B5 +Test: Encrypt +Comment: Set 3, vector 78 +Key: 4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E +Plaintext: 4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E +Ciphertext: D510C35680C9B958C81599F3665FBEC1 +Test: Encrypt +Comment: Set 3, vector 79 +Key: 4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F +Plaintext: 4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F +Ciphertext: 72DAD08BF510CDFEEC76FEAB908829B4 +Test: Encrypt +Comment: Set 3, vector 80 +Key: 5050505050505050505050505050505050505050505050505050505050505050 +Plaintext: 50505050505050505050505050505050 +Ciphertext: AC7B447EDB38F935469309E766BCB1F6 +Test: Encrypt +Comment: Set 3, vector 81 +Key: 5151515151515151515151515151515151515151515151515151515151515151 +Plaintext: 51515151515151515151515151515151 +Ciphertext: 18B937F666BF580F9CDB60A935427459 +Test: Encrypt +Comment: Set 3, vector 82 +Key: 5252525252525252525252525252525252525252525252525252525252525252 +Plaintext: 52525252525252525252525252525252 +Ciphertext: 6A08B38202685E610CA9584725D6092A +Test: Encrypt +Comment: Set 3, vector 83 +Key: 5353535353535353535353535353535353535353535353535353535353535353 +Plaintext: 53535353535353535353535353535353 +Ciphertext: 1CA09E9C14C2A833A7B7ACB1C9C12AC1 +Test: Encrypt +Comment: Set 3, vector 84 +Key: 5454545454545454545454545454545454545454545454545454545454545454 +Plaintext: 54545454545454545454545454545454 +Ciphertext: 8AB7ED64FE477B7D9A6B5B5056EA1E02 +Test: Encrypt +Comment: Set 3, vector 85 +Key: 5555555555555555555555555555555555555555555555555555555555555555 +Plaintext: 55555555555555555555555555555555 +Ciphertext: D610D6199D4FE03ED09AD568664F709A +Test: Encrypt +Comment: Set 3, vector 86 +Key: 5656565656565656565656565656565656565656565656565656565656565656 +Plaintext: 56565656565656565656565656565656 +Ciphertext: D400C1E6109F04AE50C1C341BA4E3175 +Test: Encrypt +Comment: Set 3, vector 87 +Key: 5757575757575757575757575757575757575757575757575757575757575757 +Plaintext: 57575757575757575757575757575757 +Ciphertext: DF888CBB7DBD8DE3F0BE6C6EDC72060F +Test: Encrypt +Comment: Set 3, vector 88 +Key: 5858585858585858585858585858585858585858585858585858585858585858 +Plaintext: 58585858585858585858585858585858 +Ciphertext: 9C3B100466C63AA93D420EDF54381BF4 +Test: Encrypt +Comment: Set 3, vector 89 +Key: 5959595959595959595959595959595959595959595959595959595959595959 +Plaintext: 59595959595959595959595959595959 +Ciphertext: 0BE794F0233BE9A7DB7C41A1CA4BA7E3 +Test: Encrypt +Comment: Set 3, vector 90 +Key: 5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A +Plaintext: 5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A +Ciphertext: 2C8D04D6B9DA81D07174729A07F25BB9 +Test: Encrypt +Comment: Set 3, vector 91 +Key: 5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B +Plaintext: 5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B +Ciphertext: FFCEB69835E2E5EF4C867CE28540F91F +Test: Encrypt +Comment: Set 3, vector 92 +Key: 5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C +Plaintext: 5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C +Ciphertext: A7F7F8437918BEFF5DCFCFB366CDFABD +Test: Encrypt +Comment: Set 3, vector 93 +Key: 5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D +Plaintext: 5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D +Ciphertext: 14C9736F407AE78D7D3ED18B875B940D +Test: Encrypt +Comment: Set 3, vector 94 +Key: 5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E +Plaintext: 5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E +Ciphertext: 1668A0C6A5734B98D9D641E0B6FAD80C +Test: Encrypt +Comment: Set 3, vector 95 +Key: 5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F +Plaintext: 5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F +Ciphertext: DA8775267C9722BA743A085F8591F06D +Test: Encrypt +Comment: Set 3, vector 96 +Key: 6060606060606060606060606060606060606060606060606060606060606060 +Plaintext: 60606060606060606060606060606060 +Ciphertext: 5F8172C28603C80206C276E0979EA40E +Test: Encrypt +Comment: Set 3, vector 97 +Key: 6161616161616161616161616161616161616161616161616161616161616161 +Plaintext: 61616161616161616161616161616161 +Ciphertext: E4938D0078D29E0247BF2EA0C1FCB85F +Test: Encrypt +Comment: Set 3, vector 98 +Key: 6262626262626262626262626262626262626262626262626262626262626262 +Plaintext: 62626262626262626262626262626262 +Ciphertext: A48FEE4F9FA4597303C2CF92061304A1 +Test: Encrypt +Comment: Set 3, vector 99 +Key: 6363636363636363636363636363636363636363636363636363636363636363 +Plaintext: 63636363636363636363636363636363 +Ciphertext: 3C8F6CF66C73684DDB09D1AA57CD0950 +Test: Encrypt +Comment: Set 3, vector 100 +Key: 6464646464646464646464646464646464646464646464646464646464646464 +Plaintext: 64646464646464646464646464646464 +Ciphertext: B3D9EE0337253E9C4027FEA938AB399C +Test: Encrypt +Comment: Set 3, vector 101 +Key: 6565656565656565656565656565656565656565656565656565656565656565 +Plaintext: 65656565656565656565656565656565 +Ciphertext: 3BE933A85E5997573077903CEB481AFA +Test: Encrypt +Comment: Set 3, vector 102 +Key: 6666666666666666666666666666666666666666666666666666666666666666 +Plaintext: 66666666666666666666666666666666 +Ciphertext: 06AFED96C6E7130EB3311D81CCE69F9C +Test: Encrypt +Comment: Set 3, vector 103 +Key: 6767676767676767676767676767676767676767676767676767676767676767 +Plaintext: 67676767676767676767676767676767 +Ciphertext: 183C3606139211F90F4849E93DB7DDEE +Test: Encrypt +Comment: Set 3, vector 104 +Key: 6868686868686868686868686868686868686868686868686868686868686868 +Plaintext: 68686868686868686868686868686868 +Ciphertext: 217C34184950DE7B43E46EE4BE88A9BE +Test: Encrypt +Comment: Set 3, vector 105 +Key: 6969696969696969696969696969696969696969696969696969696969696969 +Plaintext: 69696969696969696969696969696969 +Ciphertext: CA447ED204F2A4B2ED6B82E3926967B1 +Test: Encrypt +Comment: Set 3, vector 106 +Key: 6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A +Plaintext: 6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A +Ciphertext: B447F4BEBA7D88A5C62E5F9C316A4523 +Test: Encrypt +Comment: Set 3, vector 107 +Key: 6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B +Plaintext: 6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B +Ciphertext: DEDF599C54D0009795303013CD933B49 +Test: Encrypt +Comment: Set 3, vector 108 +Key: 6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C +Plaintext: 6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C +Ciphertext: B06280650C77C83AF3D71874AE00D3DA +Test: Encrypt +Comment: Set 3, vector 109 +Key: 6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D +Plaintext: 6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D +Ciphertext: 1BB5B9E9C7DC8AD690F5FC217B7B53C1 +Test: Encrypt +Comment: Set 3, vector 110 +Key: 6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E +Plaintext: 6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E +Ciphertext: FEECFCF0C172C6152F33E4DEE206EBCF +Test: Encrypt +Comment: Set 3, vector 111 +Key: 6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F +Plaintext: 6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F +Ciphertext: FA4C7EA42C425F37588CD273320940C9 +Test: Encrypt +Comment: Set 3, vector 112 +Key: 7070707070707070707070707070707070707070707070707070707070707070 +Plaintext: 70707070707070707070707070707070 +Ciphertext: 563AE5884FC374C4E45B96A6431E51E3 +Test: Encrypt +Comment: Set 3, vector 113 +Key: 7171717171717171717171717171717171717171717171717171717171717171 +Plaintext: 71717171717171717171717171717171 +Ciphertext: 0669E609578A33DBE637C5B86C7F425D +Test: Encrypt +Comment: Set 3, vector 114 +Key: 7272727272727272727272727272727272727272727272727272727272727272 +Plaintext: 72727272727272727272727272727272 +Ciphertext: B2AD99D3941924DDD2A73C4725A08EC3 +Test: Encrypt +Comment: Set 3, vector 115 +Key: 7373737373737373737373737373737373737373737373737373737373737373 +Plaintext: 73737373737373737373737373737373 +Ciphertext: 72C8239B5F4E5319EE05B6E39C9BD336 +Test: Encrypt +Comment: Set 3, vector 116 +Key: 7474747474747474747474747474747474747474747474747474747474747474 +Plaintext: 74747474747474747474747474747474 +Ciphertext: BAD014C4B0A5734AA48E7E80A42E80AF +Test: Encrypt +Comment: Set 3, vector 117 +Key: 7575757575757575757575757575757575757575757575757575757575757575 +Plaintext: 75757575757575757575757575757575 +Ciphertext: BBE294CDB3582B3C1F61ACD43A0E5DB5 +Test: Encrypt +Comment: Set 3, vector 118 +Key: 7676767676767676767676767676767676767676767676767676767676767676 +Plaintext: 76767676767676767676767676767676 +Ciphertext: C231DC35D38F5857BD3449D3E0A1EF1F +Test: Encrypt +Comment: Set 3, vector 119 +Key: 7777777777777777777777777777777777777777777777777777777777777777 +Plaintext: 77777777777777777777777777777777 +Ciphertext: B19E0BACBF3EC295AA6F99B0817B99F3 +Test: Encrypt +Comment: Set 3, vector 120 +Key: 7878787878787878787878787878787878787878787878787878787878787878 +Plaintext: 78787878787878787878787878787878 +Ciphertext: 0E81D1133E74F1A9425237377890584C +Test: Encrypt +Comment: Set 3, vector 121 +Key: 7979797979797979797979797979797979797979797979797979797979797979 +Plaintext: 79797979797979797979797979797979 +Ciphertext: E1149AA17A8B6499E0FA5C45F05D6582 +Test: Encrypt +Comment: Set 3, vector 122 +Key: 7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A +Plaintext: 7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A +Ciphertext: D9208954D8D28335E6F45FFB9D1B92D4 +Test: Encrypt +Comment: Set 3, vector 123 +Key: 7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B +Plaintext: 7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B +Ciphertext: DFABDB0594208A2902703E85C4A657FF +Test: Encrypt +Comment: Set 3, vector 124 +Key: 7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C +Plaintext: 7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C +Ciphertext: E05B6C6E90E852229BF0EFDC4FEB851E +Test: Encrypt +Comment: Set 3, vector 125 +Key: 7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D +Plaintext: 7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D +Ciphertext: 6834CCFDC940452CF40A0866009E58CC +Test: Encrypt +Comment: Set 3, vector 126 +Key: 7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E +Plaintext: 7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E +Ciphertext: 91449066A1966246636D9085E02002B0 +Test: Encrypt +Comment: Set 3, vector 127 +Key: 7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F +Plaintext: 7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F +Ciphertext: 235C2D836B2025CCCDAE4B26264132E2 +Test: Encrypt +Comment: Set 3, vector 128 +Key: 8080808080808080808080808080808080808080808080808080808080808080 +Plaintext: 80808080808080808080808080808080 +Ciphertext: 0C765AA494E048FC8BB23139F2124CB6 +Test: Encrypt +Comment: Set 3, vector 129 +Key: 8181818181818181818181818181818181818181818181818181818181818181 +Plaintext: 81818181818181818181818181818181 +Ciphertext: ED970D660C84642D0EAFF188F55CC33C +Test: Encrypt +Comment: Set 3, vector 130 +Key: 8282828282828282828282828282828282828282828282828282828282828282 +Plaintext: 82828282828282828282828282828282 +Ciphertext: E124EB4A8BE05CA633238DD69E81E057 +Test: Encrypt +Comment: Set 3, vector 131 +Key: 8383838383838383838383838383838383838383838383838383838383838383 +Plaintext: 83838383838383838383838383838383 +Ciphertext: 4653FBDD6CA7C13CE2DF31B1279B3D5A +Test: Encrypt +Comment: Set 3, vector 132 +Key: 8484848484848484848484848484848484848484848484848484848484848484 +Plaintext: 84848484848484848484848484848484 +Ciphertext: 2D4D87CFB763C3974CEBF6AE1C6269D4 +Test: Encrypt +Comment: Set 3, vector 133 +Key: 8585858585858585858585858585858585858585858585858585858585858585 +Plaintext: 85858585858585858585858585858585 +Ciphertext: F153B13F57F1AE16186EF3B1E98549B8 +Test: Encrypt +Comment: Set 3, vector 134 +Key: 8686868686868686868686868686868686868686868686868686868686868686 +Plaintext: 86868686868686868686868686868686 +Ciphertext: 5451DB2B141B894B4892C7F12BE3F389 +Test: Encrypt +Comment: Set 3, vector 135 +Key: 8787878787878787878787878787878787878787878787878787878787878787 +Plaintext: 87878787878787878787878787878787 +Ciphertext: 61B2185653CFF14EE873DBD3CB663E79 +Test: Encrypt +Comment: Set 3, vector 136 +Key: 8888888888888888888888888888888888888888888888888888888888888888 +Plaintext: 88888888888888888888888888888888 +Ciphertext: C17ACB243808B86349D4176EECF602DF +Test: Encrypt +Comment: Set 3, vector 137 +Key: 8989898989898989898989898989898989898989898989898989898989898989 +Plaintext: 89898989898989898989898989898989 +Ciphertext: 6FCE3ED2207D58A5976FE8B20B247275 +Test: Encrypt +Comment: Set 3, vector 138 +Key: 8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A +Plaintext: 8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A +Ciphertext: 403F73CC70C7F9A5E96CD77D61140961 +Test: Encrypt +Comment: Set 3, vector 139 +Key: 8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B +Plaintext: 8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B +Ciphertext: DE2B34DECB33550C97D6C074032F3333 +Test: Encrypt +Comment: Set 3, vector 140 +Key: 8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C +Plaintext: 8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C +Ciphertext: FB395AE4F537F8FB7C98BAD54BDB86A0 +Test: Encrypt +Comment: Set 3, vector 141 +Key: 8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D +Plaintext: 8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D +Ciphertext: 258E83BB639D0BEDE648F3AF96CC8E75 +Test: Encrypt +Comment: Set 3, vector 142 +Key: 8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E +Plaintext: 8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E +Ciphertext: A1B5E73720E43FA0871EAAE245B55A0E +Test: Encrypt +Comment: Set 3, vector 143 +Key: 8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F +Plaintext: 8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F +Ciphertext: 774A9ABE1FAB9E3B85A91C0F86758B0E +Test: Encrypt +Comment: Set 3, vector 144 +Key: 9090909090909090909090909090909090909090909090909090909090909090 +Plaintext: 90909090909090909090909090909090 +Ciphertext: 0A6EC1CF2056076933259AE6A337B185 +Test: Encrypt +Comment: Set 3, vector 145 +Key: 9191919191919191919191919191919191919191919191919191919191919191 +Plaintext: 91919191919191919191919191919191 +Ciphertext: C96729F87D62104F941DC21448756F95 +Test: Encrypt +Comment: Set 3, vector 146 +Key: 9292929292929292929292929292929292929292929292929292929292929292 +Plaintext: 92929292929292929292929292929292 +Ciphertext: 1CB85A610C2250A78143A31BB1C19094 +Test: Encrypt +Comment: Set 3, vector 147 +Key: 9393939393939393939393939393939393939393939393939393939393939393 +Plaintext: 93939393939393939393939393939393 +Ciphertext: 16194ABEDEA340C6D57E4C4F50640FBE +Test: Encrypt +Comment: Set 3, vector 148 +Key: 9494949494949494949494949494949494949494949494949494949494949494 +Plaintext: 94949494949494949494949494949494 +Ciphertext: 379A5A54C198FB03178EE841D67F3502 +Test: Encrypt +Comment: Set 3, vector 149 +Key: 9595959595959595959595959595959595959595959595959595959595959595 +Plaintext: 95959595959595959595959595959595 +Ciphertext: A25119AD8A0F6654ECDB2696CF4F8225 +Test: Encrypt +Comment: Set 3, vector 150 +Key: 9696969696969696969696969696969696969696969696969696969696969696 +Plaintext: 96969696969696969696969696969696 +Ciphertext: 264B7FAAD26DEC203D0DE29CE4F0F45B +Test: Encrypt +Comment: Set 3, vector 151 +Key: 9797979797979797979797979797979797979797979797979797979797979797 +Plaintext: 97979797979797979797979797979797 +Ciphertext: 2EBD2A2CD16284D206D81ACF18122E2E +Test: Encrypt +Comment: Set 3, vector 152 +Key: 9898989898989898989898989898989898989898989898989898989898989898 +Plaintext: 98989898989898989898989898989898 +Ciphertext: 25FB2B75B6915C0543412DF9EBD20FC3 +Test: Encrypt +Comment: Set 3, vector 153 +Key: 9999999999999999999999999999999999999999999999999999999999999999 +Plaintext: 99999999999999999999999999999999 +Ciphertext: 21B89B53845A828E0A14F4AE45940284 +Test: Encrypt +Comment: Set 3, vector 154 +Key: 9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A +Plaintext: 9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A +Ciphertext: 4CE809A241E8E59E231F2D00BE0EA285 +Test: Encrypt +Comment: Set 3, vector 155 +Key: 9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B +Plaintext: 9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B +Ciphertext: F914E06D9F7889DC71974DFF104F94D4 +Test: Encrypt +Comment: Set 3, vector 156 +Key: 9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C +Plaintext: 9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C +Ciphertext: AF08BADB48FF961FD5EB663FA3766FC6 +Test: Encrypt +Comment: Set 3, vector 157 +Key: 9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D +Plaintext: 9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D +Ciphertext: 05DDDE95AE659D6BBBD2B4E394399B53 +Test: Encrypt +Comment: Set 3, vector 158 +Key: 9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E +Plaintext: 9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E +Ciphertext: 25E6FE1C89F811D827BDF8D4E977071C +Test: Encrypt +Comment: Set 3, vector 159 +Key: 9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F +Plaintext: 9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F +Ciphertext: 3D00A9143A1829D05F787A904C48C75B +Test: Encrypt +Comment: Set 3, vector 160 +Key: A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0 +Plaintext: A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0 +Ciphertext: 391DF944B0E0BCB84483AF5C4F34D754 +Test: Encrypt +Comment: Set 3, vector 161 +Key: A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1 +Plaintext: A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1 +Ciphertext: BB2D2E556210A7C0EBA3165F63A74967 +Test: Encrypt +Comment: Set 3, vector 162 +Key: A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2 +Plaintext: A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2 +Ciphertext: A1B0BB24291B259AC4A1CDE9A3B817C9 +Test: Encrypt +Comment: Set 3, vector 163 +Key: A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3 +Plaintext: A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3 +Ciphertext: 6F798763B6ED7F8BB234D2CA78D026DC +Test: Encrypt +Comment: Set 3, vector 164 +Key: A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4 +Plaintext: A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4 +Ciphertext: 038443760056AB3D23BC70ECE6FB4397 +Test: Encrypt +Comment: Set 3, vector 165 +Key: A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5 +Plaintext: A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5 +Ciphertext: C75ECE40A7AE9BB38F604615C873EF02 +Test: Encrypt +Comment: Set 3, vector 166 +Key: A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6 +Plaintext: A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6 +Ciphertext: 2D308C2078842EDBBB35ABCA3F41E467 +Test: Encrypt +Comment: Set 3, vector 167 +Key: A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7 +Plaintext: A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7 +Ciphertext: 393C0E3350B3219DD8FD851C48E28C63 +Test: Encrypt +Comment: Set 3, vector 168 +Key: A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8 +Plaintext: A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8 +Ciphertext: 964BD4A28DB1434570E27FB3AD880398 +Test: Encrypt +Comment: Set 3, vector 169 +Key: A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9 +Plaintext: A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9 +Ciphertext: B668D17C027B550C0C22BDE151EB6EB1 +Test: Encrypt +Comment: Set 3, vector 170 +Key: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +Plaintext: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +Ciphertext: E14186F8205957B243CE522C16453621 +Test: Encrypt +Comment: Set 3, vector 171 +Key: ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB +Plaintext: ABABABABABABABABABABABABABABABAB +Ciphertext: 0E352BEB6B6BCAFDAE61BBE86F8F1D0E +Test: Encrypt +Comment: Set 3, vector 172 +Key: ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC +Plaintext: ACACACACACACACACACACACACACACACAC +Ciphertext: 4BCF038D9458EAAA3D279CCAC3F5D693 +Test: Encrypt +Comment: Set 3, vector 173 +Key: ADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADAD +Plaintext: ADADADADADADADADADADADADADADADAD +Ciphertext: D5EF17646A481C3B79AAB3C08B4F1611 +Test: Encrypt +Comment: Set 3, vector 174 +Key: AEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAE +Plaintext: AEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAE +Ciphertext: 37642DA589775C2FFA40A7274E9D56E2 +Test: Encrypt +Comment: Set 3, vector 175 +Key: AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF +Plaintext: AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF +Ciphertext: F829FA6B756F1B1D16B49CB7C8AFFA22 +Test: Encrypt +Comment: Set 3, vector 176 +Key: B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0 +Plaintext: B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0 +Ciphertext: 6FE1450D48D611031E81C70478DB5326 +Test: Encrypt +Comment: Set 3, vector 177 +Key: B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 +Plaintext: B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 +Ciphertext: 68C5ECE7F525F69DABF63288533C5C60 +Test: Encrypt +Comment: Set 3, vector 178 +Key: B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 +Plaintext: B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 +Ciphertext: 5DF627500627E59A5BAB5D30B6C93219 +Test: Encrypt +Comment: Set 3, vector 179 +Key: B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3 +Plaintext: B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3 +Ciphertext: AD3A4AC8F666C0FCA5D7995783D0986D +Test: Encrypt +Comment: Set 3, vector 180 +Key: B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4 +Plaintext: B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4 +Ciphertext: A3AEE54D09357B187622109296534F88 +Test: Encrypt +Comment: Set 3, vector 181 +Key: B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5 +Plaintext: B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5 +Ciphertext: 7D1D9A73DB386A717862C4F5089970E1 +Test: Encrypt +Comment: Set 3, vector 182 +Key: B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6 +Plaintext: B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6 +Ciphertext: 916347935FBD0D868A0127D602B91BD5 +Test: Encrypt +Comment: Set 3, vector 183 +Key: B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7 +Plaintext: B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7 +Ciphertext: 4F167893651993D9150ED9E0B780BF82 +Test: Encrypt +Comment: Set 3, vector 184 +Key: B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8 +Plaintext: B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8 +Ciphertext: 488352470ACF9361F22FAC1B3ED67003 +Test: Encrypt +Comment: Set 3, vector 185 +Key: B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9 +Plaintext: B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9 +Ciphertext: 4BBD307FCDE0F89C9A663A0F9C9358C5 +Test: Encrypt +Comment: Set 3, vector 186 +Key: BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA +Plaintext: BABABABABABABABABABABABABABABABA +Ciphertext: E402E706D262078113D6626E7071589E +Test: Encrypt +Comment: Set 3, vector 187 +Key: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +Plaintext: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +Ciphertext: 422D6FA4519F2E72420685CD4ED2CC8E +Test: Encrypt +Comment: Set 3, vector 188 +Key: BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC +Plaintext: BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC +Ciphertext: 6D14CC5F618DF7E0B2210F6C5DD62C92 +Test: Encrypt +Comment: Set 3, vector 189 +Key: BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD +Plaintext: BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD +Ciphertext: 5CC4A5E81F7D7EC528C150437AC2B027 +Test: Encrypt +Comment: Set 3, vector 190 +Key: BEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBE +Plaintext: BEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBE +Ciphertext: B3BE0F996494323504946446EDE489FC +Test: Encrypt +Comment: Set 3, vector 191 +Key: BFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBF +Plaintext: BFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBF +Ciphertext: ABC7DB10FE04BEE94F5887E539C1D235 +Test: Encrypt +Comment: Set 3, vector 192 +Key: C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +Plaintext: C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +Ciphertext: B18BE6FB1D04E76F21C0678A4333D255 +Test: Encrypt +Comment: Set 3, vector 193 +Key: C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1 +Plaintext: C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1 +Ciphertext: FC5802BAFEDC03088BBA0A5F22402968 +Test: Encrypt +Comment: Set 3, vector 194 +Key: C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2 +Plaintext: C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2 +Ciphertext: 8EA96801643AE7BF649EAC22812214D5 +Test: Encrypt +Comment: Set 3, vector 195 +Key: C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3 +Plaintext: C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3 +Ciphertext: F7683FCDDC2BB0BCFD1350F8E3D76602 +Test: Encrypt +Comment: Set 3, vector 196 +Key: C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4 +Plaintext: C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4 +Ciphertext: 08D0345431AE120CAD6C6D4275E00CA8 +Test: Encrypt +Comment: Set 3, vector 197 +Key: C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5 +Plaintext: C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5 +Ciphertext: 7CD50A623DA79EC84D61CD7FBDBA4153 +Test: Encrypt +Comment: Set 3, vector 198 +Key: C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6 +Plaintext: C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6 +Ciphertext: 42ACA2B048E5C58D8F004F0E8A2C6DEF +Test: Encrypt +Comment: Set 3, vector 199 +Key: C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7 +Plaintext: C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7 +Ciphertext: E03AD353225F76121D130740C75B839B +Test: Encrypt +Comment: Set 3, vector 200 +Key: C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8 +Plaintext: C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8 +Ciphertext: 26807D0A6D6330A77804B4B1AE84432B +Test: Encrypt +Comment: Set 3, vector 201 +Key: C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9 +Plaintext: C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9 +Ciphertext: 864CE880AE89660474F64B93AF4CE043 +Test: Encrypt +Comment: Set 3, vector 202 +Key: CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA +Plaintext: CACACACACACACACACACACACACACACACA +Ciphertext: 82EAD2C033986CAC1F4C3EEEEA1D1892 +Test: Encrypt +Comment: Set 3, vector 203 +Key: CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB +Plaintext: CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB +Ciphertext: 53F1A5C39DD062DF8D133B3A0FB3DA02 +Test: Encrypt +Comment: Set 3, vector 204 +Key: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +Plaintext: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +Ciphertext: E913208594B288125EEAE0EFEC764D39 +Test: Encrypt +Comment: Set 3, vector 205 +Key: CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD +Plaintext: CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD +Ciphertext: 7DAE4BD638A36A794A73E9B945BEF4D4 +Test: Encrypt +Comment: Set 3, vector 206 +Key: CECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECE +Plaintext: CECECECECECECECECECECECECECECECE +Ciphertext: 04E8155E3E81C261D3A9D4A800182A62 +Test: Encrypt +Comment: Set 3, vector 207 +Key: CFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCF +Plaintext: CFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCF +Ciphertext: F466172A8C4C7854F59388474098F441 +Test: Encrypt +Comment: Set 3, vector 208 +Key: D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0 +Plaintext: D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0 +Ciphertext: E95DBB0B366E77D7BC1BF206B95DAEBA +Test: Encrypt +Comment: Set 3, vector 209 +Key: D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1 +Plaintext: D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1 +Ciphertext: 76490E6DD8380855E26BCACF8746978F +Test: Encrypt +Comment: Set 3, vector 210 +Key: D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2 +Plaintext: D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2 +Ciphertext: 3C3B73C8FBDA8CAE5E0D7D0070735DA1 +Test: Encrypt +Comment: Set 3, vector 211 +Key: D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3 +Plaintext: D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3 +Ciphertext: B039EBC9C48828C3913A3BC346CAEAE3 +Test: Encrypt +Comment: Set 3, vector 212 +Key: D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4 +Plaintext: D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4 +Ciphertext: 0AFCC6A58BD3ADB2C0B2A1586C9FA8DE +Test: Encrypt +Comment: Set 3, vector 213 +Key: D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5 +Plaintext: D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5 +Ciphertext: C2187D0E74CE2307BC4DF249EA6E57F1 +Test: Encrypt +Comment: Set 3, vector 214 +Key: D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6 +Plaintext: D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6 +Ciphertext: F3F4AEA2492106A45C12D0029F58ACE1 +Test: Encrypt +Comment: Set 3, vector 215 +Key: D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7 +Plaintext: D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7 +Ciphertext: 3FFADF96B37B67D62D71387C52C41AE9 +Test: Encrypt +Comment: Set 3, vector 216 +Key: D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8 +Plaintext: D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8 +Ciphertext: 4C1644AD69F7D0D3A1E2B4B0E7F0A592 +Test: Encrypt +Comment: Set 3, vector 217 +Key: D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9 +Plaintext: D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9 +Ciphertext: 68FD6F6592AE5BD9245FA959FE1CA849 +Test: Encrypt +Comment: Set 3, vector 218 +Key: DADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADA +Plaintext: DADADADADADADADADADADADADADADADA +Ciphertext: 7AB97B70C2CCC7D0D1AA7A6D8B7C48CA +Test: Encrypt +Comment: Set 3, vector 219 +Key: DBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDB +Plaintext: DBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDB +Ciphertext: 961BF9E037E303B9B494C2EE063FC4CC +Test: Encrypt +Comment: Set 3, vector 220 +Key: DCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDC +Plaintext: DCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDC +Ciphertext: 0FBF042B227603DB4A1CC8EE62E93DF3 +Test: Encrypt +Comment: Set 3, vector 221 +Key: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +Plaintext: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +Ciphertext: 71360ED44C9FAF8F1139D31252A35F49 +Test: Encrypt +Comment: Set 3, vector 222 +Key: DEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDE +Plaintext: DEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDE +Ciphertext: 5E806BD29351AE456549E73B8DDC0026 +Test: Encrypt +Comment: Set 3, vector 223 +Key: DFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDF +Plaintext: DFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDF +Ciphertext: C7908A288B86C1C4FCE5A8A59457EFD3 +Test: Encrypt +Comment: Set 3, vector 224 +Key: E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0 +Plaintext: E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0 +Ciphertext: AAC45B53F6292082B93F949BD77E5776 +Test: Encrypt +Comment: Set 3, vector 225 +Key: E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1 +Plaintext: E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1 +Ciphertext: 231150ED4D85B4217B3EFC3E71A522C6 +Test: Encrypt +Comment: Set 3, vector 226 +Key: E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2 +Plaintext: E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2 +Ciphertext: 639D9C5EEC8D9569C6DF24630CA8257D +Test: Encrypt +Comment: Set 3, vector 227 +Key: E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3 +Plaintext: E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3 +Ciphertext: 0E7F8C538946D87A01AD49A8CC981B58 +Test: Encrypt +Comment: Set 3, vector 228 +Key: E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4 +Plaintext: E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4 +Ciphertext: 09A293907E499502D78569230D3F1A97 +Test: Encrypt +Comment: Set 3, vector 229 +Key: E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5 +Plaintext: E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5 +Ciphertext: ACF67CC086E386DA064EDBF97F7E889A +Test: Encrypt +Comment: Set 3, vector 230 +Key: E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6 +Plaintext: E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6 +Ciphertext: E7C44DB1A9FCAC410253A7E2674C54F6 +Test: Encrypt +Comment: Set 3, vector 231 +Key: E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7 +Plaintext: E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7 +Ciphertext: B99BA33ECB86DA790FF0CC4F0D41A065 +Test: Encrypt +Comment: Set 3, vector 232 +Key: E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8 +Plaintext: E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8 +Ciphertext: 73405114FDBDB81B1A54C4EFED1BB3FE +Test: Encrypt +Comment: Set 3, vector 233 +Key: E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9 +Plaintext: E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9 +Ciphertext: 80152E139834B3CC01EBF7E6417C5537 +Test: Encrypt +Comment: Set 3, vector 234 +Key: EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA +Plaintext: EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA +Ciphertext: 05CE579D4804FF3C7874571730D81CEC +Test: Encrypt +Comment: Set 3, vector 235 +Key: EBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB +Plaintext: EBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB +Ciphertext: F984801E7A806A130325E152DF60012E +Test: Encrypt +Comment: Set 3, vector 236 +Key: ECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECEC +Plaintext: ECECECECECECECECECECECECECECECEC +Ciphertext: 92CBB121474A307505425B4DD1B7F803 +Test: Encrypt +Comment: Set 3, vector 237 +Key: EDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDED +Plaintext: EDEDEDEDEDEDEDEDEDEDEDEDEDEDEDED +Ciphertext: 2DEB2F282D60EFCDB300EADB15C798D8 +Test: Encrypt +Comment: Set 3, vector 238 +Key: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +Plaintext: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +Ciphertext: 0F4D7D59B535E29D315D2A5C7BFE4973 +Test: Encrypt +Comment: Set 3, vector 239 +Key: EFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEF +Plaintext: EFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEF +Ciphertext: 61E391F7C29B5AD705121CF9559E5C04 +Test: Encrypt +Comment: Set 3, vector 240 +Key: F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 +Plaintext: F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 +Ciphertext: 65BCBE179D19A5BCF12D141A21E0F7A8 +Test: Encrypt +Comment: Set 3, vector 241 +Key: F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1 +Plaintext: F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1 +Ciphertext: FDB75C659B72AE81E51204CFCB86E631 +Test: Encrypt +Comment: Set 3, vector 242 +Key: F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2 +Plaintext: F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2 +Ciphertext: 5643ED3A3679B9E33E21CD0F95580877 +Test: Encrypt +Comment: Set 3, vector 243 +Key: F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3 +Plaintext: F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3 +Ciphertext: 618EFEB4C6E4270B81FF7DE786E68420 +Test: Encrypt +Comment: Set 3, vector 244 +Key: F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4 +Plaintext: F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4 +Ciphertext: 75A2A9CC91F006059CA873E5D73C2CCC +Test: Encrypt +Comment: Set 3, vector 245 +Key: F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5 +Plaintext: F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5 +Ciphertext: B55840B5001D1875C29A56EDFDE10E55 +Test: Encrypt +Comment: Set 3, vector 246 +Key: F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6 +Plaintext: F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6 +Ciphertext: 6DD9BDEA7EC0E622DE8B83460BDEA719 +Test: Encrypt +Comment: Set 3, vector 247 +Key: F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7 +Plaintext: F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7 +Ciphertext: D164075BD4CDC95288D896C7CC98285D +Test: Encrypt +Comment: Set 3, vector 248 +Key: F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8 +Plaintext: F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8 +Ciphertext: 8420071C55241802D88FB7AF17EBE43F +Test: Encrypt +Comment: Set 3, vector 249 +Key: F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9 +Plaintext: F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9 +Ciphertext: 03D1D5646E4B2B8A924AB242E485C5D1 +Test: Encrypt +Comment: Set 3, vector 250 +Key: FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA +Plaintext: FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA +Ciphertext: 29106DFB63F4CD6EF5D82CF07C0DBB3A +Test: Encrypt +Comment: Set 3, vector 251 +Key: FBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFB +Plaintext: FBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFB +Ciphertext: E9DC1CDD5011E00E0C5699201E1EA002 +Test: Encrypt +Comment: Set 3, vector 252 +Key: FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC +Plaintext: FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC +Ciphertext: 8006C8BD5B210F2FC5B3538F66A6BE0B +Test: Encrypt +Comment: Set 3, vector 253 +Key: FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFD +Plaintext: FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFD +Ciphertext: 2C6386229480E806D0CD21CDA0EA6B53 +Test: Encrypt +Comment: Set 3, vector 254 +Key: FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE +Plaintext: FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE +Ciphertext: ACDBB0F5A00E3CF63A89D9C09B44A058 +Test: Encrypt +Comment: Set 3, vector 255 +Key: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +Plaintext: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +Ciphertext: 4F05F28CA23EEAE205B67B1C95CD5280 +Test: Encrypt diff --git a/cryptopp/TestVectors/ccm.txt b/cryptopp/TestVectors/ccm.txt new file mode 100644 index 0000000..165350b --- /dev/null +++ b/cryptopp/TestVectors/ccm.txt @@ -0,0 +1,240 @@ +AlgorithmType: AuthenticatedSymmetricCipher +Name: AES/CCM +Source: aes-modes-src-07-10-08/Testvals/ccm.1, Basic Tests for CCM (compiled by B. R. Gladman) +Key: 404142434445464748494a4b4c4d4e4f +IV: 10111213141516 +Header: 0001020304050607 +Plaintext: 20212223 +Ciphertext: 7162015b +MAC: 4dac255d +Test: Encrypt +Key: 404142434445464748494a4b4c4d4e4f +IV: 1011121314151617 +Header: 000102030405060708090a0b0c0d0e0f +Plaintext: 202122232425262728292a2b2c2d2e2f +Ciphertext: d2a1f0e051ea5f62081a7792073d593d +MAC: 1fc64fbfaccd +Test: Encrypt +Key: 404142434445464748494a4b4c4d4e4f +IV: 101112131415161718191a1b +Header: 000102030405060708090a0b0c0d0e0f10111213 +Plaintext: 202122232425262728292a2b2c2d2e2f3031323334353637 +Ciphertext: e3b201a9f5b71a7a9b1ceaeccd97e70b6176aad9a4428aa5 +MAC: 484392fbc1b09951 +Test: Encrypt +Key: 404142434445464748494a4b4c4d4e4f +IV: 101112131415161718191a1b1c +Header: r256 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Plaintext: 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f +Ciphertext: 69915dad1e84c6376a68c2967e4dab615ae0fd1faec44cc484828529463ccf72 +MAC: b4ac6bec93e8598e7f0dadbcea5b +Test: Encrypt +Key: c97c1f67ce371185514a8a19f2bdd52f +IV: 005030f1844408b5039776e70c +Header: 08400fd2e128a57c5030f1844408abaea5b8fcba0000 +Plaintext: f8ba1a55d02f85ae967bb62fb6cda8eb7e78a050 +Ciphertext: f3d0a2fe9a3dbf2342a643e43246e80c3c04d019 +MAC: 7845ce0b16f97623 +Test: Encrypt +Key: 8f7a053fa577a5597529272097a603d5 +IV: 00eec1762c88de31f3cbba97ea +Header: 08c0ea100c846850eec1762c88deaf2ee9f46a070000 +Plaintext: 83a0634b5ed7627eb9df225e05740342de194117 +Ciphertext: 814b6965d05bf2b2ed38d4beb069fe82714a610b +MAC: 542fbf8da06aa4ae +Test: Encrypt +Key: 40cfb7a62e88013bd6d3affcc191041e +IV: 00b6a88adf36912fdca0f3a5ae +Header: 88c0d9577df763c8b6a88adf3691dc4a8bca94dd00000000 +Plaintext: 2c1bd036831c95496c5f4dbf3d559e72de802a18 +Ciphertext: 89d8580340b626a0b6d4d013bf18f291b89646c8 +MAC: fd1f1f61a9fb4bb3 +Test: Encrypt +Key: 8c89a2ebc96c7602707fcf24b32d3833 +IV: 078ef822734701f670a55a0fe3 +Header: 88c2712a9ddf11db8ef82273470159140dd646a200000700 +Plaintext: 4fad2b1c290fa5ebd872fbc3f3a074898f8b2fbb +Ciphertext: 9d59b15f371448c230f4d739052e13ab3b1a7b10 +MAC: 31fc88004f35ee3d +Test: Encrypt +Key: a574d5143bb25efddeff30122fdfd066 +IV: 0bf351946bc96ba7ffe03c0e37 +Header: 88c245dec69a7480f351946bc96be276fbe6c12700000b00 +Plaintext: 28969b954f263a8018a9ef70a8b051462481922e +Ciphertext: eb4ae4956a801da9624b7e0c18b23e615ec03af6 +MAC: ce0c3be197d305eb +Test: Encrypt +Key: f71eea4e1f58804b9717230ad0614641 +IV: 0dbff943b9f9a66b81eca48989 +Header: 88425af28430fdabbff943b9f9a6ab1d98c7fe7300000d00 +Plaintext: abfda22d3a0bfc9cc1fc079363c2fca143e6eb1d +Ciphertext: 9a709b60a39d40b1dfb612e18b5f114badb6cc86 +MAC: 309a8d5c466bbb71 +Test: Encrypt +Key: 1bdb34980e038124a1db1a892bec366a +IV: 00efec952016915eec4073e723 +Header: 08419b50f4fd56f6efec9520169183570c4ccdee0000 +Plaintext: 98beca86f4b38da20cfdf24724c58eb835665339 +Ciphertext: 12c537ebf3ab584ef1fef9a1f3547a8c13b3225a +MAC: 2d0957ecfabe95b9 +Test: Encrypt +Key: 6eac1bf54bd54edb2321754303024c71 +IV: 0aca3f3aae60c4cefd996eccdd +Header: 88c1552d5f72bb70ca3f3aae60c48ba9b5f82c2f00000a00 +Plaintext: 57cb5c0e5fcd885e9a4239e9b9cad60d64375979 +Ciphertext: 4bf281ef8ec7739f91591b97a87dc14b3fa17462 +MAC: 6dba8ef7f08087dd +Test: Encrypt +Key: 494b501e194675971a48d08c5bc353cb +IV: 0aa4ad6d319985ba82e93437b3 +Header: 88c19afb798b8a4ba4ad6d319985bc429e8f0afa00000a00 +Plaintext: 25a98f9c1bd9c93cf383ab9d98152d76cb4a32c6 +Ciphertext: 561a0d068eac2eadb0c57fe2d0a6cc7398b6ddbf +MAC: cfe438cbea61fa9a +Test: Encrypt +Key: 489e49bc3cfe3fce3895820e872ee1a3 +IV: 0053f869fe279acf1d3e75fea9 +Header: 084340ec29fa759b53f869fe279af0f9f8a65416000052bfd2703d24 +Plaintext: 7f91f2472d7a121c9cdd4b6c9080675a1020aa00 +Ciphertext: 25df5173835e4fba23bc05a253885ebed3ac4871 +MAC: c868a725552c5565 +Test: Encrypt +Key: 02be5c4545672a07e4e314d70f1f9e85 +IV: 0d347ceb9aabffd2d6596e55d4 +Header: 88c3298c0baa9190347ceb9aabffd83d4886e5c20000e29d524ae1960d00 +Plaintext: f9a812e4a28af7f3714d4bf6622e5932f2184509 +Ciphertext: 6315500f924295cd3eafbdc3e151b1df46465b71 +MAC: 681fdee8513c62dc +Test: Encrypt +Key: 77077ed79453e4a18d60438cc6484d6e +IV: 00d8ac5a7ec44450b01e77fd8e +Header: 0843aa288b8435bcd8ac5a7ec444e8b46250538b0000e81402c2ee11 +Plaintext: 431981a2336d02f8cb8448d5428916be95293537 +Ciphertext: cf71b2ccbd590b20800792f359ed1cfd74d800b4 +MAC: fd0f41f426bb8f30 +Test: Encrypt +Source: aes-modes-src-07-10-08/Testvals/ccm.2, Vectors for IEEE P1619.1 CCM Mode +Header: +Key: 0000000000000000000000000000000000000000000000000000000000000000 +IV: 000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: c1944044c8e7aa95d2de9513c7f3dd8c +MAC: 4b0a3e5e51f151eb0ffae7c43d010fdb +Test: Encrypt +Plaintext: +Ciphertext: +Key: 0000000000000000000000000000000000000000000000000000000000000000 +IV: 000000000000000000000000 +Header: 00000000000000000000000000000000 +MAC: 904704e89fb216443cb9d584911fc3c2 +Test: Encrypt +Key: 0000000000000000000000000000000000000000000000000000000000000000 +IV: 000000000000000000000000 +Header: 00000000000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: c1944044c8e7aa95d2de9513c7f3dd8c +MAC: 87314e9c1fa01abe6a6415943dc38521 +Test: Encrypt +Header: +Key: fb7615b23d80891dd470980bc79584c8b2fb64ce60978f4d17fce45a49e830b7 +IV: dbd1a3636024b7b402da7d6f +Plaintext: a845348ec8c5b5f126f50e76fefd1b1e +Ciphertext: cc881261c6a7fa72b96a1739176b277f +MAC: 3472e1145f2c0cbe146349062cf0e423 +Test: Encrypt +Key: 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f +IV: 101112131415161718191a1b +Header: 000102030405060708090a0b0c0d0e0f10111213 +Plaintext: 202122232425262728292a2b2c2d2e2f3031323334353637 +Ciphertext: 04f883aeb3bd0730eaf50bb6de4fa2212034e4e41b0e75e5 +MAC: 9bba3f3a107f3239bd63902923f80371 +Test: Encrypt +Key: 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f +IV: 101112131415161718191a1b +Header: r256 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Plaintext: 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f +Ciphertext: 04f883aeb3bd0730eaf50bb6de4fa2212034e4e41b0e75e577f6bf2422c0f6d2 +MAC: 3376d2cf256ef613c56454cbb5265834 +Test: Encrypt +Key: 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f +IV: 101112131415161718191a1b +Header: 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f +Plaintext: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Ciphertext: 24d8a38e939d2710cad52b96fe6f82010014c4c43b2e55c557d69f0402e0d6f2 06c53d6cbd3f1c3c6de5dcdcad9fb74f25741dea741149fe4278a0cc24741e86 58cc0523b8d7838c60fb1de4b7c3941f5b26dea9322aa29656ec37ac18a9b108 a6f38b7917f5a9c398838b22afbd17252e96694a9e6237964a0eae21c0a6e152 15a0e82022926be97268249599e456e05029c3ebc07d78fc5b4a0862e04e68c2 9514c7bdafc4b52e04833bf30622e4eb42504a44a9dcbc774752de7bb82891ad 1eba9dc3281422a8aba8654268d3d9c81705f4c5a531ef856df5609a159af738 eb753423ed2001b8f20c23725f2bef18c409f7e52132341f27cb8f0e79894dd9 +MAC: ebb1fa9d28ccfe21bdfea7e6d91e0bab +Test: Encrypt +Key: fb7615b23d80891dd470980bc79584c8b2fb64ce6097878d17fce45a49e830b7 +IV: dbd1a3636024b7b402da7d6f +Header: 36 +Plaintext: a9 +Ciphertext: 9d +MAC: 3261b1cf931431e99a32806738ecbd2a +Test: Encrypt +Key: f8d476cfd646ea6c2384cb1c27d6195dfef1a9f37b9c8d21a79c21f8cb90d289 +IV: dbd1a3636024b7b402da7d6f +Header: 7bd859a247961a21823b380e9fe8b65082ba61d3 +Plaintext: 90ae61cf7baebd4cade494c54a29ae70269aec71 +Ciphertext: 6c05313e45dc8ec10bea6c670bd94f31569386a6 +MAC: 8f3829e8e76ee23c04f566189e63c686 +Test: Encrypt +Source: RFC 3610 +Key: C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF +IV: 00 00 00 03 02 01 00 A0 A1 A2 A3 A4 A5 +Header: 00 01 02 03 04 05 06 07 +Plaintext: 08 09 0A 0B 0C 0D 0E 0F\ + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E +Ciphertext: 58 8C 97 9A 61 C6 63 D2\ + F0 66 D0 C2 C0 F9 89 80 6D 5F 6B 61 DA C3 84 +MAC: 17 E8 D1 2C FD F9 26 E0 +Test: Encrypt +MAC: 17 E8 D1 2C FD F9 26 00 +Test: NotVerify +Key: C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF +IV: 00 00 00 04 03 02 01 A0 A1 A2 A3 A4 A5 +Header: 00 01 02 03 04 05 06 07 +Plaintext: 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F +Ciphertext: 72 C9 1A 36 E1 35 F8 CF 29 1C A8 94 08 5C 87 E3 CC 15 C4 39 C9 E4 3A 3B +MAC: A0 91 D5 6E 10 40 09 16 +Test: Encrypt +Key: C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF +IV: 00 00 00 05 04 03 02 A0 A1 A2 A3 A4 A5 +Header: 00 01 02 03 04 05 06 07 +Plaintext: 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 +Ciphertext: 51 B1 E5 F4 4A 19 7D 1D A4 6B 0F 8E 2D 28 2A E8 71 E8 38 BB 64 DA 85 96 57 +MAC: 4A DA A7 6F BD 9F B0 C5 +Test: Encrypt +Key: C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF +IV: 00 00 00 06 05 04 03 A0 A1 A2 A3 A4 A5 +Header: 00 01 02 03 04 05 06 07 08 09 0A 0B +Plaintext: 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E +Ciphertext: A2 8C 68 65 93 9A 9A 79 FA AA 5C 4C 2A 9D 4A 91 CD AC 8C +MAC: 96 C8 61 B9 C9 E6 1E F1 +Test: Encrypt +Key: C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF +IV: 00 00 00 07 06 05 04 A0 A1 A2 A3 A4 A5 +Header: 00 01 02 03 04 05 06 07 08 09 0A 0B +Plaintext: 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F +Ciphertext: DC F1 FB 7B 5D 9E 23 FB 9D 4E 13 12 53 65 8A D8 6E BD CA 3E +MAC: 51 E8 3F 07 7D 9C 2D 93 +Test: Encrypt +Key: C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF +IV: 00 00 00 08 07 06 05 A0 A1 A2 A3 A4 A5 +Header: 00 01 02 03 04 05 06 07 08 09 0A 0B +Plaintext: 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 +Ciphertext: 6F C1 B0 11 F0 06 56 8B 51 71 A4 2D 95 3D 46 9B 25 70 A4 BD 87 +MAC: 40 5A 04 43 AC 91 CB 94 +Test: Encrypt +Key: C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF +IV: 00 00 00 09 08 07 06 A0 A1 A2 A3 A4 A5 +Header: 00 01 02 03 04 05 06 07 +Plaintext: 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E +Ciphertext: 01 35 D1 B2 C9 5F 41 D5 D1 D4 FE C1 85 D1 66 B8 09 4E 99 9D FE D9 6C +MAC: 04 8C 56 60 2C 97 AC BB 74 90 +Test: Encrypt +Key: C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF +IV: 00 00 00 0A 09 08 07 A0 A1 A2 A3 A4 A5 +Header: 00 01 02 03 04 05 06 07 +Plaintext: 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F +Ciphertext: 7B 75 39 9A C0 83 1D D2 F0 BB D7 58 79 A2 FD 8F 6C AE 6B 6C D9 B7 DB 24 +MAC: C1 7B 44 33 F4 34 96 3F 34 B4 +Test: Encrypt diff --git a/cryptopp/TestVectors/cmac.txt b/cryptopp/TestVectors/cmac.txt new file mode 100644 index 0000000..b00ba34 --- /dev/null +++ b/cryptopp/TestVectors/cmac.txt @@ -0,0 +1,38 @@ +AlgorithmType: MAC +Name: CMAC(AES) +Source: RFC 4493 +Key: 2b7e1516 28aed2a6 abf71588 09cf4f3c +Message: +MAC: bb1d6929 e9593728 7fa37d12 9b756746 +Test: Verify +Message: 6bc1bee2 2e409f96 e93d7e11 7393172a +MAC: 070a16b4 6b4d4144 f79bdd9d d04a287c +Test: Verify +Message: 6bc1bee2 2e409f96 e93d7e11 7393172a ae2d8a57 1e03ac9c 9eb76fac 45af8e51 30c81c46 a35ce411 +MAC: dfa66747 de9ae630 30ca3261 1497c827 +Test: Verify +Message: 6bc1bee2 2e409f96 e93d7e11 7393172a ae2d8a57 1e03ac9c 9eb76fac 45af8e51 30c81c46 a35ce411 e5fbc119 1a0a52ef f69f2445 df4f9b17 ad2b417b e66c3710 +MAC: 51f0bebf 7e3b9d92 fc497417 79363cfe +Test: Verify +MAC: 51f0bebf 7e3b9d92 fc497417 79363cff +Test: NotVerify + +AlgorithmType: MAC +Name: CMAC(DES-EDE3) +Source: http://csrc.nist.gov/groups/STM/cavp/documents/mac/cmactestvectors.zip +Key: f8fba7b9b3e9d68a 2f70bfd304d32a15 9e13453e0d16928a +Message: +MAC: eb61515b +Test: VerifyTruncated +Key: 344a6732dc5e5431 e98a4f7c323dc1c4 6b0275dc150e68e9 +Message: 25db0710fb165d316e7c32dd25648ed0 +MAC: 862f0e2b +Test: VerifyTruncated +Key: 20ae32c49bab3bf8 f86bb66173fb54d5 3e700868c46bc291 +Message: 582bd9c8c36ec815d0a9 +MAC: 0d62f14f +Test: VerifyTruncated +Key: 62232501b9e9c1b5 54209d7c075d2c31 73a2f289a84c49ce +Message: adaf4bfffab79ffb60b94647faac634929c56e694052881881e60b1149b6 +MAC: a05674f2c905d153 +Test: Verify diff --git a/cryptopp/TestVectors/dlies.txt b/cryptopp/TestVectors/dlies.txt new file mode 100644 index 0000000..aa71155 --- /dev/null +++ b/cryptopp/TestVectors/dlies.txt @@ -0,0 +1,542 @@ +AlgorithmType: AsymmetricCipher +Name: DLIES(NoCofactorMultiplication, KDF2(SHA-1), XOR, HMAC(SHA-1), DHAES) +Source: generated by Wei Dai using Crypto++ 5.1 +Comment: keys are encoded as DSA keys, with OID id-dsa +KeyFormat: DER +Comment: 1024-bit DLIES key +PrivateKey: \ + 308201370201003082011706072a8648ce3804013082010a02818100ba3ed941\ + 10332be99b77a345da72a33146ca960498a6fc2e0e207fdeaadf69c3e5650df7\ + 3255475854900b75af7f6aac021de687a1c166ecb2ab6ec6b9da82ad4fb0f48a\ + 966a2b968406e18ba50947d7ee3bb1f13511cb4dde191f0ade1933d089c5e82a\ + b8d283943d85ef0102e173abf2635aeac2f84cfc9ec6c4e8f3fbc4130281805d\ + 1f6ca0881995f4cdbbd1a2ed395198a3654b024c537e1707103fef556fb4e1f2\ + b286fb992aa3ac2a4805bad7bfb556010ef343d0e0b3765955b7635ced4156a7\ + d87a454b3515cb420370c5d284a3ebf71dd8f89a88e5a6ef0c8f856f0c99e844\ + e2f4155c6941ca1ec2f7808170b9d5f931ad75617c267e4f63627479fde20902\ + 01030417021501fdc788cd93f07dba3af2de42ae5aa3ede219919d +PublicKey: \ + 308201a23082011706072a8648ce3804013082010a02818100ba3ed94110332b\ + e99b77a345da72a33146ca960498a6fc2e0e207fdeaadf69c3e5650df7325547\ + 5854900b75af7f6aac021de687a1c166ecb2ab6ec6b9da82ad4fb0f48a966a2b\ + 968406e18ba50947d7ee3bb1f13511cb4dde191f0ade1933d089c5e82ab8d283\ + 943d85ef0102e173abf2635aeac2f84cfc9ec6c4e8f3fbc4130281805d1f6ca0\ + 881995f4cdbbd1a2ed395198a3654b024c537e1707103fef556fb4e1f2b286fb\ + 992aa3ac2a4805bad7bfb556010ef343d0e0b3765955b7635ced4156a7d87a45\ + 4b3515cb420370c5d284a3ebf71dd8f89a88e5a6ef0c8f856f0c99e844e2f415\ + 5c6941ca1ec2f7808170b9d5f931ad75617c267e4f63627479fde20902010303\ + 81840002818029eaa5b193357c200e0d42f374d4c003c633c77f4778fe40ad0b\ + d035b87ae5da4e74110ec2b15eefe1bd8b9357534c85328382946d314e15b79f\ + 7b854227012dfaac9bd862e73a5630e01327b36319765a3eb1434e108ef6421c\ + 659e3f9223966759611429b3c86ed9937563efbfad8bfedcfa92db3d7d2157fe\ + 2c8a33f08636 +Test: KeyPairValidAndConsistent +Plaintext: 76 +Ciphertext: B11D906CC5A8E71CA8962A8CC0AC4CAFF2DA00DC130C370F42D11FCF5C37DE046EBC07C7D457CA351CE456A043695D14ED055ADAD2B58BE0DF992685EF8B0D21597A43D7B3D9634A077CB70C4590CD73C20FAAACBC5649413EECA0C7B3CBF469E531299398F61496C51FE9FFE48AE9FE6034F104EFC562DE9529C776B86ADD4025AD6B0C3687B012F92C7B9E82F794E4FBE247D644 +Test: DecryptMatch +Plaintext: 89338CE80AFB62E9577A310E40311BB3F77F +Ciphertext: 8A33B0E212DB8155CA796B472F55CD77267C9106229B6055141EA3AAAE42AD27249D90E70F892B0CDC80D29D3D586A5CA6FE67D4BB44C58B03496708F80681125DCEF983B7453B1E4F927438BD2E3E506C1951E9F19BA70F9B687012440CD75C0BB78BDCFAB22AF535D3E2670ABD1F4D44ED95F3360536612B1A7DF35E2A88F66BD6E8C813EB9DC89D93A85C9A0BA13E4862B91171B681E64A0750197C6467B22566BC640E11 +Test: DecryptMatch +Plaintext: 0835455ABD53E6FB11ED9B0C00485D3C6845DB +Ciphertext: A81181517BD270B0D921AF735052898932008DF00D501EDE0D2D564871D61A6A837776E8D7C7F9B0E5F9181C1FC68BC430F30ABB1A64D62B444C0AC5AAE588B4481AEF08B38E466155F10CA04C8202F281186016AE35212A2C7815A22DB2750ABD526D285BDBC598672BFB52E95CE33A0D3E5DCF4CF5F46224CFBB85297F3AB170C8B9478994E32D9A21A452B095D3D902E92C7E444A3307FDD7256FE49341142E5FF7A616475A +Test: DecryptMatch +Plaintext: 1EBED48EC47B6987091C52BC +Ciphertext: 1DF446FF43AAAAAC8E3F7D70C912E2D45AB832BCA3D0FBD17AF864B9EA878C45B9E2902804171A739A0552BB7CE0CD46DC16343714CC9C2E71AE26304885EEEB242665814DD9E33C480ABA214755D5449F16CD8870D1AB3A8E64E45E463AB3F4D3031FA3ECD395B61B372602665FCF218D9C51E8C791FA1E5BCC2916EFBB482E1814632CDF0F1852EE4943D9652DAA4E1F3B22F17F57F51D52A0997BED5B04ED +Test: DecryptMatch +Plaintext: 65D8 +Ciphertext: 4385797FD38AD5DFBB4F613BC87637B0051501E57699A5880E235DB7A6994A04A1613D0C8E07E36AFD08F2E47D018951B22E7625DA647AA1A0791DB3B2FA794610892D9A3D3F173CF95277B4B1EB92579A229510B67E171CB5BBA8B3AA732047BA038816A30124AF1C4C57CA80E93AACCC8EC70BCF7867914E7DE2C403568F9778F8DBEAF08FDB9F48452054C9735DC84F012DF8FE17 +Test: DecryptMatch +Plaintext: F86D8ED91E9934125DA6E9B4E97545C83A +Ciphertext: 13B0AE03AB532D5E31C9384B4E726A9AC73583CFBB0643EC322E3D2D45D9358CAF745B0541C136E8AA2220C42CEC9E1ED174886475538732AA6D6417DA89FA411AEDEADCD9F15D25D27D0AE252F77E888470AE696D5805CE8CCCB40B45D4AA835E97C7BF2CD6A2B4FEC6FCF858606CE4695DCE998C518360068ED028FC882478BF96096D92C166899EB51778BC4B7DA1BA8C4B6CEBA1139F17CEE484EA104A0325420A3D56 +Test: DecryptMatch +Comment: 1025-bit DLIES key +PrivateKey: \ + 308201380201003082011806072a8648ce3804013082010b028181015dd79808\ + 07a15e557e3a39466eb2987828c536a871d4fc7f3723d52f8145a0d10d996295\ + 64aca54fd567c0509ef3c428fac68d916551e77a5ca0ed6d9f12cc96262b1f11\ + 49f398ef9f0f17fc0ed92bb917f890d1e6a4f62b91a7978d0aa1bf53b89805c1\ + 06ebebd0924cb99a4168a38dad65238236d4d166d38a3dfd5359ec5f02818100\ + aeebcc0403d0af2abf1d1ca337594c3c14629b5438ea7e3f9b91ea97c0a2d068\ + 86ccb14ab25652a7eab3e0284f79e2147d6346c8b2a8f3bd2e5076b6cf89664b\ + 13158f88a4f9cc77cf878bfe076c95dc8bfc4868f3527b15c8d3cbc68550dfa9\ + dc4c02e08375f5e849265ccd20b451c6d6b291c11b6a68b369c51efea9acf62f\ + 020102041702150f514282f489098f1df0c7be02ccbb3f23bed00376 +PublicKey: \ + 308201a43082011806072a8648ce3804013082010b028181015dd7980807a15e\ + 557e3a39466eb2987828c536a871d4fc7f3723d52f8145a0d10d99629564aca5\ + 4fd567c0509ef3c428fac68d916551e77a5ca0ed6d9f12cc96262b1f1149f398\ + ef9f0f17fc0ed92bb917f890d1e6a4f62b91a7978d0aa1bf53b89805c106ebeb\ + d0924cb99a4168a38dad65238236d4d166d38a3dfd5359ec5f02818100aeebcc\ + 0403d0af2abf1d1ca337594c3c14629b5438ea7e3f9b91ea97c0a2d06886ccb1\ + 4ab25652a7eab3e0284f79e2147d6346c8b2a8f3bd2e5076b6cf89664b13158f\ + 88a4f9cc77cf878bfe076c95dc8bfc4868f3527b15c8d3cbc68550dfa9dc4c02\ + e08375f5e849265ccd20b451c6d6b291c11b6a68b369c51efea9acf62f020102\ + 038185000281810107143658b98a3725010d3631a3f4f7448cb967ac0118e4ca\ + 8fc8871eb4fb872d55c52d93a4f21eed98b6499db74315956a268f38a288958b\ + f7c4d548662c668669d69375e0cb710ff3a1a9f43e49add1f7ae58b836b6444e\ + 419e40474c27066cb03aae8132e65f3fead0109307ab1c7f0254eb14e9d76639\ + 1a66ca1ba442b425 +Test: KeyPairValidAndConsistent +Plaintext: 256F07E0D37D69BE542BD17FA98CE4CFC3DA849B +Ciphertext: 01269CE30DE12430904CEC9D8B91A6D8860B4F8D37FCE7DBDCE8FA18AC521684F4C1CD5C38BF3B42C259033CD36A53F0376A0CDD801979CF1B76ADD72AFDD27830BD85B373C4D451B84926ABA34012EB98331F0B81CCF8E801ACCDEE88A35DF60EFADABA1F395250A15463203FDCCEDAB7DD6CD1271B38A5E0946F8D189B225E8A307D198AC5E4EB33BCF26A02C0C602AA14592AEA01452E4F8AE46E7A032BABD1BA8ACB0919F2EA18 +Test: DecryptMatch +Plaintext: A992 +Ciphertext: 007822B0BDF45CC5B15102B5E21F7656C8896E98FAD6C2AF6CD55D0DB90B7A6B05E36D260C7A5C070526813290BCA722959B9B9BF00041B4B7F3E3EAFA9B5376A1E02944EDA55B99202601AE6D402D56617B56B28BAC1B405016053CDC78AB4D372B0D58E7380D50F1CD0E31B8CB77FD2F6BA3E7A436A5B35552B9974EA5AB30AC0C4989E34F5FD7D272417FF2094B97119BEB2C73C68B +Test: DecryptMatch +Plaintext: 1D20C118C894EFDC67DAC33E56179C5D262C83 +Ciphertext: 001587AFEC265C244875371B680521FF93F0B1196901A7D580785B62A257B1736C86D1D9E59A31E62F53B92B209B45A7952776C6AC839243B0BBF3A059E6CEE99B120BBD45922B4E813DDE0F5793A42B3AF2DDDAA357136A010519D884589A1F9912110020A8C16E9B91C753EB8842B3224FE9C9A22AE2B82251CFF7799E78885B0B67B27DAAC6A7B58013C31115C2B8C0C0176BC2A7B96A299CC75693B4F2138B2B4053CB5320D5 +Test: DecryptMatch +Plaintext: 83BC82A4F7A4DFC96CD7798BAC52254CD6E9 +Ciphertext: 0085E83465997BFED9CAE63B04B0419578D0BD85B1A65285E5537F4367E5E7E11DD8762BD3335916A13B8CF9D5BC651E762458E9879363B06748BEA0CA86D32CBC4F1B0C0BF67E616B872A64F7356241CD052944F6594A570522EF2BCC53D90E3326D2ECFA036C46256D9B678C93BE5877749AF8FF8FEDB6E1E17B67C7B6C6098D0C71D5B2AB503AFD7739ABCC8DE67DAC056AFE99D8A107230BA88C282FB8FD46E9E9E2C6874A +Test: DecryptMatch +Plaintext: 157597899A950A32 +Ciphertext: 013623199FFDD0D4689A4C50A9FEA3C2250D0C73F209F33BF3EF13E6035976D6F3EAFBA3D83A3862E4B6DFC7581EA43B62F49BC85392B7EAB854F92DA8DD5921A6A4C42777E89004EB7E6D479BD028F758171C324168DC0814369C6BCD8471D9620C4E9BED785A220EF9C0DCF1201311A16C51341E0551043C6EAB45E04A81C9280633F58621D8D3492864FFF6A39EDC48450ABFE0C7AABAEB9A86CFFD +Test: DecryptMatch +Plaintext: CDE651 +Ciphertext: 0040308CCDAB105426597D84A64665200A93208713004DB38594C490F7B85F08ADB67BBE47B7FB7BBDA435A6B6A2CA0B4CBE0FDCBD4FF078FD052213CBCAA4580D1C7962A3505DAA9BEA2957718AB36D061E61B9DEB3D7DD726975C6E7FD79AADBF649F5ABE51AC384E967D3CDAFD9EAA18EEB69774961E439F54844FA22DA1B6892E86471DAE6F7E74CACC944123234826621C7634AE34E +Test: DecryptMatch +Comment: 1026-bit DLIES key +PrivateKey: \ + 308201380201003082011806072a8648ce3804013082010b028181031e7d8589\ + b9fa11e77204b8c1b27ad66b39863978d26912a65de306dcb32a0c7c96bb431d\ + c4a14204a8f01a65b0fe56a4d016716914c21576f10d63dac5f49287636519ac\ + f9be56c9f58eeb90ba3240d4cce26f647bfd86360cf0f6b8ff609ae2ef736558\ + 155a1498adf4e92dc90f34169123a5fcd8ddfc763c81658a4d08383702818101\ + 8f3ec2c4dcfd08f3b9025c60d93d6b359cc31cbc693489532ef1836e5995063e\ + 4b5da18ee250a10254780d32d87f2b52680b38b48a610abb7886b1ed62fa4943\ + b1b28cd67cdf2b64fac775c85d19206a667137b23dfec31b06787b5c7fb04d71\ + 77b9b2ac0aad0a4c56fa7496e4879a0b4891d2fe6c6efe3b1e40b2c526841c1b\ + 020102041702151fa3003b00efad22ecc26c5115e6d036d13d3b2f7e +PublicKey: \ + 308201a33082011806072a8648ce3804013082010b028181031e7d8589b9fa11\ + e77204b8c1b27ad66b39863978d26912a65de306dcb32a0c7c96bb431dc4a142\ + 04a8f01a65b0fe56a4d016716914c21576f10d63dac5f49287636519acf9be56\ + c9f58eeb90ba3240d4cce26f647bfd86360cf0f6b8ff609ae2ef736558155a14\ + 98adf4e92dc90f34169123a5fcd8ddfc763c81658a4d083837028181018f3ec2\ + c4dcfd08f3b9025c60d93d6b359cc31cbc693489532ef1836e5995063e4b5da1\ + 8ee250a10254780d32d87f2b52680b38b48a610abb7886b1ed62fa4943b1b28c\ + d67cdf2b64fac775c85d19206a667137b23dfec31b06787b5c7fb04d7177b9b2\ + ac0aad0a4c56fa7496e4879a0b4891d2fe6c6efe3b1e40b2c526841c1b020102\ + 038184000281802c6360e6e3eba6da6efb5bce8d07a99e42949b68b3c2900583\ + c2eb34498081c7212d8dc95a631d63edeafc625f8faf063e57b41d7b662ba9c1\ + a99b3f2506fdf5e59116a0e93e7e94aab55691abae75eaac9637a713949360a4\ + 5f6908f23ba5503d4760bcd6f7abceb8351a66bb14fae05f03b1494e7ef4154c\ + 99a9cb6a9bfe12 +Test: KeyPairValidAndConsistent +Plaintext: DEC85711F12C0D1D6C26797E91B0F39B37 +Ciphertext: 0215D75DD99B8A59DEA3FBA9B0F8A621EFFBFD831E9543749B04B495147CE9B56D519EE71BDF56D86FD1D9C1AE8BC1D7F29DC469A05221E4A31C726971731CF627E63FAB269FC92DEDDFF3319819373F299D55F4CABE08DADF29A7C60E9B4E2806899371B93A853F828EC4312D94CFDADFDEF2037D9C1FCE21A3E451006AC542E1BC36D3C33AEAC0D1666C26AA886F4C118836EDCA7C5A428E407C4ACD62A885C03202230FA6 +Test: DecryptMatch +Plaintext: 0E665CD2CF75C2E6E24908448F29E9A198EF +Ciphertext: 00A4583FF3A9451C6F8970E53D95EC74F41F709F5156B4FC9C698B1E43C7B5F3230D5417AED2C7447455009CE8381A30BE400EC15BBB1D7BCB9461E593D416421157541479FE1DCEAAE635728C68C58D260337A25D0CF9FA291D84E9E1DF4FF96822CA1F05CDD247AD14E5AFB231A0AF0F2E79FB9A0528CA2FE9431724C0AC9F0A2ABCED9A20EC1203DE2A835D90EA5FB1447EC722456B6F4C75D0645CEC5BECCE35B79FF3071A +Test: DecryptMatch +Plaintext: BE2A +Ciphertext: 02823CB4ABD598FC5D36300306460886BBECFAE6F56E02708A96EFB27EF7E3D8F08442FC819EAB1DC35CC70A074984A149F209EB285C6064DDDBC7781CEF7358F384D592BFC75D346A6D97D8524CB35060A35E3B3145199F4968677FA22BB468DBFF63E3E366D778B3042D5858699D9FE5D6F53D0CB084E107111B572AE9B933B94FF37F2681DC50CDED2714668375DA90787CF0144F1B +Test: DecryptMatch +Plaintext: 20D57B7E074BFFF8F54AF3E69C9B632253B3B5C0 +Ciphertext: 00D18C24BF39CD527455737B4B214BADDE99B070181C1E4729CC7B6EAC82298417FFAE7BDA1F41A7D74D6969BF9CAF3A7F9EC9397DB75F5E53D0282F793D601A28E8B3CA8730CD9D7A0ABA338E2DB3EB5314321EEBA2F16C8072DA6AD9A887AA5AED0EC5EF3DC7E5726626511F8F23B0BA4D83BA358DF0951B07399C7515349E3DE2938D2AA53AB11A4D1C07213E091CD3FB6453AF7DFB6799D45DA44B060F7BF5ACA5A25B3892BBB6 +Test: DecryptMatch +Plaintext: CC47935F7976 +Ciphertext: 02366250DE032B147BCEABCB576ED39F4993251D25010FAEEB41BDDA4301B890063247EEDC041539488E70B977091BF581033EE6EF75C224C8046EE3E7D2330383A30BA07FF33D10F07FF6E1EE20FA4D112CAB1BF457B50DC301DE5C6DBFACE227903379A41DC4D92517A547968D3F147D6435C3DF6A3D0D13635360716CBAC322EBD295593865C3A117050059FBEC83D112C5C3727377EBA7778A +Test: DecryptMatch +Plaintext: 3A370FAFD82869FEC40117 +Ciphertext: 026AE53843D3EFE36D8E52D9FD55DC6F0A0F51584BF81529914DAB6E380A6C9716828A7254307440B6A0CD16BF0D9D713939AE7F6C4D82D5AA70F33C9531E4071B9CB415C7622A23DBF4C81820BE04272874549F081B57D40B27BC1879BF134A2CF5D15203D326F9F97BCAC8606082A50A755CAE6FE2B72060EB1E0B72EF5AFAE8A823B3F0F91877C931CA64A06F3888DD4E2C823B3FCF529407255BE2AAD36A +Test: DecryptMatch +Comment: 1027-bit DLIES key +PrivateKey: \ + 308201380201003082011806072a8648ce3804013082010b028181072c45d24e\ + de76df2a03270413d8ab37645c8d6301ea76bb6cedea97142df7aa422b83043f\ + 8cfd8874dd684f47138433f5832c83c8c811d3c6d477b088006381ffb066402c\ + 951670f1927b1b67883451202f456bdb975d8bb2cde9b43c178ecfe788a0a0ab\ + df2cbfc700fbb97ef71e52221bc054fbd3cf8c04175e4841a45b89cf02818103\ + 9622e9276f3b6f9501938209ec559bb22e46b180f53b5db676f54b8a16fbd521\ + 15c1821fc67ec43a6eb427a389c219fac19641e46408e9e36a3bd8440031c0ff\ + d83320164a8b3878c93d8db3c41a289017a2b5edcbaec5d966f4da1e0bc767f3\ + c4505055ef965fe3807ddcbf7b8f29110de02a7de9e7c6020baf2420d22dc4e7\ + 0201020417021506533f6f0886a8a44137598adb93aeee548c9af303 +PublicKey: \ + 308201a43082011806072a8648ce3804013082010b028181072c45d24ede76df\ + 2a03270413d8ab37645c8d6301ea76bb6cedea97142df7aa422b83043f8cfd88\ + 74dd684f47138433f5832c83c8c811d3c6d477b088006381ffb066402c951670\ + f1927b1b67883451202f456bdb975d8bb2cde9b43c178ecfe788a0a0abdf2cbf\ + c700fbb97ef71e52221bc054fbd3cf8c04175e4841a45b89cf028181039622e9\ + 276f3b6f9501938209ec559bb22e46b180f53b5db676f54b8a16fbd52115c182\ + 1fc67ec43a6eb427a389c219fac19641e46408e9e36a3bd8440031c0ffd83320\ + 164a8b3878c93d8db3c41a289017a2b5edcbaec5d966f4da1e0bc767f3c45050\ + 55ef965fe3807ddcbf7b8f29110de02a7de9e7c6020baf2420d22dc4e7020102\ + 03818500028181056bf5dcced97da0ddd23c1f1294f97431e323f9719fc9bed6\ + 352d08a88ceb13a06b559b8ef7dc04c5a04a761a9631aa1000f32f885fb0de56\ + 505524ae89462079631f438284c8e5225c021d7731087ec0aad11aba9bba95de\ + 03f5c99ac228861a3ee6a7b47617cec687a58255321694b923e63ed247e65ff1\ + 4c279bec5282bc1b +Test: KeyPairValidAndConsistent +Plaintext: D391B4F3B53EB9B035C3AB1E3C6E +Ciphertext: 05D90F9892F6DD3DC3654130CAA312D2287D9E57607C301BE58607BB19FC78D67F2082C907FACA819A0D946AD16B46FE1E7264BE7D25D4EAB4F80D136E89EE7BC53B65CC1692581E3ABFA3C15482A6FEEB607AD1765897E67BCEDAED0E03FDE18E05330A99BEBB8710C77E7735CBB747EB507FE1EC04F239E964B509A4FEE8463478E28BF5338AE016DED9FE6B2DDBD3FDE467C45F0FA619E039FEF085D2F1544EA3CD +Test: DecryptMatch +Plaintext: 28 +Ciphertext: 066BBCB2D9E474A2C6CD514663BDA7AECA1F79136A00C1F9BDBAEDE344872093E67102307C96BF824999D86543121CC3D99B5CC4B511153A42E8A1569D063C27788E105858AF8EEB0766FAD9E0EDEFAEFFC733BE6824644CEE03AEE5FF15860CB3CBF4A46F95988D5E010FB844F944628043C830E575964EC36E2C38326C771085D796F2C22C0969E58665626415463A3CA1F56C357B +Test: DecryptMatch +Plaintext: D2C349F40A24230689EA15736C3AEFB1588A +Ciphertext: 019A66A4ADFED556BBD1E58728A3B7A3631458DCF677BB155DA989827C2240A586783D8C5DB98E266C39FCDF6FB016BBB25D53A6B30F3BC9D1109CB908B54F1932335F3DFC2C80847D94D13C5933953EA1D212107AB42189536171069621403681CAAB2A13EEAEC847193FA6A0234FA8F107E2C1747425584EBB4F4D702E29A3A09580E25B34413208009F9643327A636DF622B7F0267D3169A64646F301C584F64066801383ED +Test: DecryptMatch +Plaintext: 85D75863811C6F574222B577 +Ciphertext: 02C6FFDB38965F3061C736E633B497192862677CB247A37C5FA1FEB4F2C021EA94C65AD9506C73C2E98ADF0F340DAFAD2BF6F6CC906C93655594D093D4B0F6867755013C25ED0AD75DC9A04DD0666E6340BDD6C1E748479F3D64129F76B5BAB37D26319287EC9D65CE9E2243D4CCC7BCEA4065623C4D388A7BD779941EE541DD29E070F7356ED1A1ADAE947D79F8421FA717F933F08CBB8B699B551F1EFF75B8F5 +Test: DecryptMatch +Plaintext: DD07A91D32C26D3258AA4ABBD82E81 +Ciphertext: 05669E0777B003CC2EBE9BF3981160806A8B416A2DEAB4058497C5AF6A5C8F8D1ADF1225CC6FF7D292320E9C98CEDA144862FB4E32EE11AD9CC76A5C85FAE56A2567E6C9D168586F288CF4D525C94FF9F0ED6C3DBD08787768B90F8CD776520EFB920E61FB0E4463BE8D5AAE2683D31F392229A9554E0977BF25BCBBAAC7BB4FCCB009630D0203451A7A2AF847BA60AA0CE8C4D656DBED02353B92025925E1A0A6DF490F +Test: DecryptMatch +Plaintext: 0AA6B9FB846D1230F521F2624127 +Ciphertext: 01A9D56F1547728782D4F80BB0EBC8890BAEFE994900F41D56094F4734ABA2BB371060B2A69C6B7BC8944358519D141FC277E1195B3A78F7068731C3AF3C604A062A0D551397CD804168B7F400F786BC5CC3F912457AEAD56873AEF1A2378F34E953E240C20FFD7DDA229D4C020BDC68684A53C0AB3ACF9B44581353C60CE9854E3451645A604BB7AB3EB44088A07F59CE0FEB6454CC5A83BE5E939B317D4D8537CAFA +Test: DecryptMatch +Comment: 1028-bit DLIES key +PrivateKey: \ + 308201380201003082011806072a8648ce3804013082010b0281810cb31a78b6\ + 6dafe2dd020483aec0cad421e4a3df2a81b827009dd74f5ef0468fc508477190\ + f628033471ee2d56f913d45a94a8ad1582b29785a7ead06c88ce73812e653797\ + 921d3c4a8fba91c1423d6609e85625b2f41494546500237151958b13d1cc0f90\ + 586b0233290d052a18c2aa3ec2bdc32adb4676cbeb30309e330b823702818106\ + 598d3c5b36d7f16e810241d760656a10f251ef9540dc13804eeba7af782347e2\ + 8423b8c87b14019a38f716ab7c89ea2d4a54568ac1594bc2d3f56836446739c0\ + 97329bcbc90e9e2547dd48e0a11eb304f42b12d97a0a4a2a328011b8a8cac589\ + e8e607c82c358119948682950c61551f615ee1956da33b65f598184f1985c11b\ + 020102041702151c0cefd22a713385985cacb5fe84cd40e724ce9587 +PublicKey: \ + 308201a43082011806072a8648ce3804013082010b0281810cb31a78b66dafe2\ + dd020483aec0cad421e4a3df2a81b827009dd74f5ef0468fc508477190f62803\ + 3471ee2d56f913d45a94a8ad1582b29785a7ead06c88ce73812e653797921d3c\ + 4a8fba91c1423d6609e85625b2f41494546500237151958b13d1cc0f90586b02\ + 33290d052a18c2aa3ec2bdc32adb4676cbeb30309e330b823702818106598d3c\ + 5b36d7f16e810241d760656a10f251ef9540dc13804eeba7af782347e28423b8\ + c87b14019a38f716ab7c89ea2d4a54568ac1594bc2d3f56836446739c097329b\ + cbc90e9e2547dd48e0a11eb304f42b12d97a0a4a2a328011b8a8cac589e8e607\ + c82c358119948682950c61551f615ee1956da33b65f598184f1985c11b020102\ + 038185000281810aacd80676c540b97f74d2a94c2f389795c9f696d2a1fa934d\ + 20e93d49d0099d9312552e6e310da5d97cef87c9a5a4c47e7acd195293b09adf\ + db8e0cac95139446aba60fd625d17eaa102c7c26568b34891edb38226f949656\ + 44a9d52ff299cd007ab3dbc15779d4388431a66774ffaae5c6be04526b28c620\ + ac97e8618cb09d46 +Test: KeyPairValidAndConsistent +Plaintext: +Ciphertext: 0194C64DEB9CB401573730A29359456F4E9528347ED80F24E5AEC4441E896E38047EF95AAD9AD7A25AED6CC89FD95CAAEF27F3C814C26FE43F6D65288D87E372A204D1A66C3BCF0346CE89E9D2D7646E90BACB9A85022ACFEF8903C72A663BAED9A346E1A6B2B2FCF70E239EE70A34385F8C76CDD121F6B190085BAB3300E6B811906CE38AC740FE88A3DF8DCA1C6DF73A03236D51 +Test: DecryptMatch +Plaintext: 9498EB7300 +Ciphertext: 0A38C373F6A96D87528D2D55F6391A9E801252A65F622F36A130ABD140E1858024E31F247C3BC8C07D9500CBE7A8A3D6C0670AF0FA14D020DC54B201E657C233F8031DF990AE801077D4D3AD9B861F4C32D36FFB9E8BD5E2651169BC4560CC7FD02159929AA50882F8B4C8508BB98F6BE8A6A7C0E21A2A81AF781447ABEC85C170F3F6256C3B6C5E2D3A01BB5EA8B502D37561C06F1DA536BD59 +Test: DecryptMatch +Plaintext: F07FFAC9794BD8D528F750D50C05 +Ciphertext: 03DAF7F6C2BEBF8D0B380EB71BD8BEE9D649AD7647DF6DE4CBCE00D0363E31F11E0DC0331409863E3C069EE3F975E7F623B55D7F4690C7419C5AD97EB52BBC0212D3FF0A83A031591A31481116B2CD232A9C86A20EA40BD13A53BB73E644A6C7DC1E6C767756E7235538E9D5B155B3173416E99F121E96E02034C6DB9129489A050740F603DEFF96EF1D99E7EB4A32083D0D946670B1AEF30E1E38D3F076D6BCB57255 +Test: DecryptMatch +Plaintext: 85916A46E0965C69C4773C7DF9AF +Ciphertext: 053D29F0878C68FF55FFC8E6E0E03044AE23B79588034F0236A49A5B6D00EFE8C564D2D29ACB61FE49C0E984EFC3A48A96EAF22AF3032D8D0FD3B3BB16A0157C161F2B3D3DF802FDD6B61899212F44493383DDDEA8B2463BACD0C5E1F4F9E4063DE5E52032E7DA8B79E04C5F03144CD710ADA74506CEC2D448BEA0F2B59AB63FCC443BBE920748E122DDD6123BDDAE484DBD02088817D999FDF80D5ED4B308AF4C2DCC +Test: DecryptMatch +Plaintext: EB632C72F563174E680961BCF26EC7 +Ciphertext: 0BBE666C02191F668A2DB000646A14385A8E9199BD887913BA587DA4C683535801853186673AD7C43EFA5B65902559BA5345EFA111E0514D461C1B1EFFAE58708EE6C17F1758EBED31F0B3206B0EC1B4BEB2EF911C589E25CDC3B0020C47119B5F33EA2FB7C332CA6B1FDA2F350A4CB0D6844637F2CCA71EFB036C7400957AE093B21BE90E30A8672847C9BA5266EBBF9D62341F67A4D09FFA196A817DD2F5EE1A9654EC +Test: DecryptMatch +Plaintext: 42B5D2DB89374231 +Ciphertext: 0085B6894D887B59393F9D7365411DF239BE1104FD86CC63A52C990A84FC4660FF9B60CF0641E44A8224C169A9FD1B35EAF78008E34F14B5311CB5D725096D9DE92F35BE6E71E3AC3E3B3D68BDD5351A5AF93F0B3BCDB00B9B126D8DA07E5F42107181F9580CCD0D6F086C94177FD48ECFAE3FCF2F26D64940D749E8A964275290A247AF700210500517BEB2175326F4CD3016AB175B352F9BD3289079 +Test: DecryptMatch +Comment: 1029-bit DLIES key +PrivateKey: \ + 308201380201003082011806072a8648ce3804013082010b0281811b02fc18f7\ + ba0ae7f84ebcaf319294fa2bad52e47e1926267ad38b2f1b2566145bbc190cb5\ + c39a8d6229eb238d3742bbd234b0f28eac92363a31ac96c5b08eaeb1963de59a\ + 3b2d0295c0266a7da4ca92b64f96c497f262e98df7f20ec55814b8441acfb639\ + 7abf9c4e42ab9bd6dda6ae180b12e12ead68672f9d56b98ee40e2b630281810d\ + 817e0c7bdd0573fc275e5798c94a7d15d6a9723f0c93133d69c5978d92b30a2d\ + de0c865ae1cd46b114f591c69ba15de91a58794756491b1d18d64b62d8475758\ + cb1ef2cd1d96814ae013353ed265495b27cb624bf93174c6fbf90762ac0a5c22\ + 0d67db1cbd5fce272155cdeb6ed3570c0589709756b43397ceab5cc7720715b1\ + 020103041702152c7c60166a1bfebb17831e65b8e1f61f3ef9ed9ff7 +PublicKey: \ + 308201a43082011806072a8648ce3804013082010b0281811b02fc18f7ba0ae7\ + f84ebcaf319294fa2bad52e47e1926267ad38b2f1b2566145bbc190cb5c39a8d\ + 6229eb238d3742bbd234b0f28eac92363a31ac96c5b08eaeb1963de59a3b2d02\ + 95c0266a7da4ca92b64f96c497f262e98df7f20ec55814b8441acfb6397abf9c\ + 4e42ab9bd6dda6ae180b12e12ead68672f9d56b98ee40e2b630281810d817e0c\ + 7bdd0573fc275e5798c94a7d15d6a9723f0c93133d69c5978d92b30a2dde0c86\ + 5ae1cd46b114f591c69ba15de91a58794756491b1d18d64b62d8475758cb1ef2\ + cd1d96814ae013353ed265495b27cb624bf93174c6fbf90762ac0a5c220d67db\ + 1cbd5fce272155cdeb6ed3570c0589709756b43397ceab5cc7720715b1020103\ + 038185000281810e6e9c7b74e33a1f4683ddfa35509c39a75b75c10f438efad0\ + 82caad08a7418990983150a9a5ffe3f8e340443dfbabf82fe060da487f94afdd\ + 1e713d491b983fc4fb69d4405a12e356808c5cf6a7bd397c1a5637ba8e168b7e\ + d3f549a9f39f343e8fe3992706e782a1dde5c5e9e6a950f7d980835c1bc1742d\ + c2840cb2e61086d7 +Test: KeyPairValidAndConsistent +Plaintext: 03C57B87 +Ciphertext: 1440C6776914314A1DA161EAA41D52B283E2C0B487C801CEC33DCDB639F579F69D12FD029C994A311913EB6869C7A5659EE8BD9F5D7225BBB2EB77CF6F3D24A5E9866BD2CC50E593EC5CEBA4A96C59FE8B98B5EE2121E5892F2436F98B5C4E4A12077A1A64F1FCEB783D05453A657BB91909637063813CC00754402DE24F4AD6C0D9D4C15B7F4E485AF3538D391CF5993A59F6D1FE6C76E2A7 +Test: DecryptMatch +Plaintext: C5598C0FE0D90B10E7125079E2EDA32E531C2EBF +Ciphertext: 129FC863B70BB82C1C59EE2DA37FF3909F1DAB4B55D9727EE0CA3311BE5797F93446ACA0409CBFA848A90756D2598B6ECA56F6341C6E9F716A62380CB5D47400CF392A5441DA5AD2C1D066F894942837EA7B6237D7BE2E94FFE0A106148C2B7B9AF624242A945BF3B217D89FDBB070FA5940C1C899AD83AF1F865DEADFF0F4E48A7E00BF7AC5625F6E32F8B01394AE90284AFA061AF6DD61ECA1B8FA77CBC172573A9938332D7AEE41 +Test: DecryptMatch +Plaintext: +Ciphertext: 068117F2BCF29C72CDA3F4560A2165B7DB7C29314EFEC8D110425D5AA02F35C0F9A2304A0554C097944EF3A615BD70F5461E6549C319AC1207B100FEF022410C46284CEA9CA103685A18EC944DEA0BAE8E06D2489A3E2D1D9B255F192677664CA6FF44130C28CDE1FD437E85396503DFF305BA2D64E8BF9C75B00CA1595A1AED2C60865C0DF03F408EF95517E70552B2D5A8C190DC +Test: DecryptMatch +Plaintext: 8DDB5FC737283E5B +Ciphertext: 0B3E0CE51E1D3AE240EB34787DB5D49D6786B3BCC29C37EF8B9155F342C4D226CE1D07F7BAE09DFF7E8CD89915E1312F43540A26F03D918BF56B07E6D07A96870362643092F24FBCC6A2DE62F637B5F5F807E430DAF9B7AFE1890143591BBA035538FB419BE4CBADFCED5EB8BE2471B39CFCFBB2BA854C9E0F52E67524ECB80F9FBB3173D2A18C9F4C43F4E20866428A9256AB8AD199BA0BAD55A18896 +Test: DecryptMatch +Plaintext: +Ciphertext: 197D4DC43B0716191F926DC806A1B707ABD6684735144AFE07E0EAEEDD9BB3C89B9D0076859DACE6FFF9E2685592ECB010909910DCA50D2FB1B15EB9B9CFF4F71250D807EDDC2EFB2033BDFD93FD10E117683E3E4E8A5D3308572D4852954BD51251279A79092E3DCB95F1FCEC8310931933F47998DDB61438478CD80864F08D3370C863BE6E7E1CD22E38BC512D9A160478814057 +Test: DecryptMatch +Plaintext: 53AC983CEE599A17261C53 +Ciphertext: 0E31EAACA9E8A86ACEFD1CB817869F48EAB342EAD0DAFE17B848CA9CB72B92567987B929F655B8D601EB1384BE380C8E4BA8B4E274F724F02FC5C00479C308813A3963E2D8AC88ACE92AEB00AB024A4EC5560857310E03009752B86793B356DA344B4AEF01F3ACCD9CBFBE399D0016260C006FCA5443359EA1E012D43921B8D2B8CFD31B94972ECE9C0031420238C76514635E9B40F17D9AF25A1009DB75E4C0 +Test: DecryptMatch +Comment: 1030-bit DLIES key +PrivateKey: \ + 308201380201003082011806072a8648ce3804013082010b02818127b35992d0\ + 8edcc7aaa6ca70365afa8ffacb4a9bef0ea348e27414c2100b81827fbf1abd3f\ + 14150bb5d85ab13b2aca21304365f150511a68c90f4a4eac0bfef0c548e3076b\ + 30a24929c4482f42f2b03ce122b3a251e685a3fe3dbb539932bf8d2b117b1b08\ + dbceb78c84966270657164fe6f20c6d27dca270dd4417f843fdfb23302818113\ + d9acc968476e63d55365381b2d7d47fd65a54df78751a4713a0a610805c0c13f\ + df8d5e9f8a0a85daec2d589d9565109821b2f8a8288d346487a5275605ff7862\ + a47183b598512494e22417a179581e709159d128f342d1ff1edda9cc995fc695\ + 88bd8d846de75bc6424b313832b8b27f379063693ee51386ea20bfc21fefd919\ + 0201030417021513560b35fe90d01a106b1e6ccba4cec953421d48cb +PublicKey: \ + 308201a43082011806072a8648ce3804013082010b02818127b35992d08edcc7\ + aaa6ca70365afa8ffacb4a9bef0ea348e27414c2100b81827fbf1abd3f14150b\ + b5d85ab13b2aca21304365f150511a68c90f4a4eac0bfef0c548e3076b30a249\ + 29c4482f42f2b03ce122b3a251e685a3fe3dbb539932bf8d2b117b1b08dbceb7\ + 8c84966270657164fe6f20c6d27dca270dd4417f843fdfb23302818113d9acc9\ + 68476e63d55365381b2d7d47fd65a54df78751a4713a0a610805c0c13fdf8d5e\ + 9f8a0a85daec2d589d9565109821b2f8a8288d346487a5275605ff7862a47183\ + b598512494e22417a179581e709159d128f342d1ff1edda9cc995fc69588bd8d\ + 846de75bc6424b313832b8b27f379063693ee51386ea20bfc21fefd919020103\ + 0381850002818117f468e3d38f1198556447bc16fb6c6ffe98b31f9042e59602\ + c71286db3e0780601e47372e6eb4a570f2059a7a87ee4471eaf94bcf23e34017\ + 5a377333d39dc64b7eaefcc065bef4a92d0d10acbba71082852c2014d9d3eb2f\ + 8583947c2cbf52865730d2b9511ed8a68367e4d89eca4589b836889cd424485c\ + 9305bc0386b16619 +Test: KeyPairValidAndConsistent +Plaintext: 4424 +Ciphertext: 0C570D0317363DB43DEB295D49A3BC937116F2ECAC9226415952CE634679272B7041A4B806164F12E87A0050AC2D60D393F845965CB3A56FF0CF28D31CFA0285015452C59949E3D96C5C6D1DBE38F6EE98E2C93357E6C036053DF920C7CA5E2EA1617AE44434A347FCE426C55295172ADDE9CAC3AEF2C6D6AB2C8F0FAB1B146FF1A10D5EC2191C99D6418519443EEE2A198BFD159BCC63 +Test: DecryptMatch +Plaintext: 5092C5D9FA398EE31AE27C97 +Ciphertext: 196476CA0E6622569F233780EE0C449C2CAAD3819B348D01B4DE5425EBCDEAEA739C6D9CCACE4DDF06520E83C94D237AFD46A4EFED635112CC78534E2FA6046ED6C06806EA8F4B9F3FC3F87DC55F63B9E14F9ABD82E9CC80A298DB281C9F690391F5B064880CF35C5A0BC7537DE9F65DEB2467FAB5CE8F41529A5B06BFA6B587ED661849BC7388277AE7F7E5EFA3F2526E503ECB106B718275BF32C4F83278CA30 +Test: DecryptMatch +Plaintext: 89BB350DC43CB3 +Ciphertext: 13844D63B45821E8704A9C1F6E9166B5EB7FD98DE5369E5DBB9DECE506EE467294282B5B174EF2F81B6766A3616AC5A974F06D9C47163C69668F4C1C78F8A6716A4EC28A6AE25F615A838B9C747EE857AA2AC92DEDC575AC568A78E8A86EF78D55EDB88707F7B6D558E8A760095BE8BCD066FC57396E67C9D8654245676DAE9FC4BC9D578496CA450B35E179410A5DB443C2026FFF0E5F7E54821E39 +Test: DecryptMatch +Plaintext: +Ciphertext: 040E084ED4A1C135C8867BAFF219A0092855E1E9FC96F38277E16B96986FDEABDC22F3B02CC53B655369DDE3356EA6FE49B77C8EAA49815CD5B1DFDC6E7D0AF6AA985483345BBA8A251F1EC7658DF708C8EED8AB6B953393C03BA2EEDB8B6391D921C9EAD2AA61DBE724B15C9C664EC4EFF83A535E46BF768FD519B043DBF46A36FA03921224281A826F6F43DEA6DF38749D600317 +Test: DecryptMatch +Plaintext: BB296D4FF04AE0171F1F24AE +Ciphertext: 0AA9A85958D9F1BB06E3DB48DACC842534915A7E42715057BD33523EE756F62AD973E37128BB8031358A1DC583F40598B74F079AD667C037D4BE89938233BFE1C167EFE764724F97F2EA42479FB455B1166AAB26A43440867ACE77472CCB13643D5BC9532F68C5368825BF225DF49E2D3BD023447A795AFFE927A796C70E5D6359537A9CE2B4B9323D7FE208540CC32447940ACD91F4718FC7A7CAD45A524B6DA6 +Test: DecryptMatch +Plaintext: 87A2C6B33856C6A096EE +Ciphertext: 12D17080AD0E7FD426E02B6A90736AB4B566F31E937B2D3E642D663D6ABFEB903FC9C4763AE492191E0C15B264CEF321DC8747C590F751A9BA2825D9250F72BA85EEB45B1F1D7B2BA972455DCE7DAE6CBD7B5BFBFB88FCEF52910F9B28D3DCD6BB5D479BBFC73896C3D1C44AB387989DE4D77855F6B8C7A8C12969D51DC6B10BA15C2B19E91A55BD5542853EC6F8F13260E8774C706958B1C9866114FADA1D +Test: DecryptMatch +Comment: 1031-bit DLIES key +PrivateKey: \ + 308201380201003082011806072a8648ce3804013082010b0281814ff13b3664\ + f5c527c36120159d9b9a82054f9ade6866b379e13d03e76cb63b25731132d5f7\ + ec6e95186ed83c793b5d63189dac30c6e6a655605f885fe73d2ae5433c80e660\ + c5d985ad6d12783082861829355c25cd7a7ff84b3033cb7fb530a7baa4000830\ + 2c1eb24b866cf467f570e782bceee66e15585f70b0633965c870530302818127\ + f89d9b327ae293e1b0900acecdcd4102a7cd6f343359bcf09e81f3b65b1d92b9\ + 88996afbf6374a8c376c1e3c9daeb18c4ed6186373532ab02fc42ff39e9572a1\ + 9e40733062ecc2d6b6893c1841430c149aae12e6bd3ffc259819e5bfda9853dd\ + 52000418160f5925c3367a33fab873c15e7773370aac2fb858319cb2e4382981\ + 020103041702150910a291c216ca5f944c5f3eaaa1535c3b8a1f0b15 +PublicKey: \ + 308201a43082011806072a8648ce3804013082010b0281814ff13b3664f5c527\ + c36120159d9b9a82054f9ade6866b379e13d03e76cb63b25731132d5f7ec6e95\ + 186ed83c793b5d63189dac30c6e6a655605f885fe73d2ae5433c80e660c5d985\ + ad6d12783082861829355c25cd7a7ff84b3033cb7fb530a7baa40008302c1eb2\ + 4b866cf467f570e782bceee66e15585f70b0633965c870530302818127f89d9b\ + 327ae293e1b0900acecdcd4102a7cd6f343359bcf09e81f3b65b1d92b988996a\ + fbf6374a8c376c1e3c9daeb18c4ed6186373532ab02fc42ff39e9572a19e4073\ + 3062ecc2d6b6893c1841430c149aae12e6bd3ffc259819e5bfda9853dd520004\ + 18160f5925c3367a33fab873c15e7773370aac2fb858319cb2e4382981020103\ + 038185000281812e9a62ec280cf5ee7d09e5e5675b67a4c325c7565a1129c079\ + 095d0f078e7b8a5b3c947c21c022f01c0b9267a45fdd9f267e63c7f674a02d39\ + 6fc59a960d7991d2e3552d01deb2784f26ec4c9355c0df0497271cb583d157db\ + 90b0634180578ac85005143dda75a33a127df96639e275cee8fe9c02db62d2ed\ + 879f3caae11d6e00 +Test: KeyPairValidAndConsistent +Plaintext: 1FBE21CDBCEBA28625584CB1EA0D9627A919A6CA +Ciphertext: 2CFC251CB2A397880EFD0077D9CEF817A6D69EB6278CD82998C5988DD18D6ED15FC8CAFD1611DE58BB46BA8A87013C7BBD4A8DCFC454F13DB282BBBD4E1594E6AF17AB6219E91D7354EB88515007B58BF0D8FF4BD4C387FF6E02BF81455803E6A936F25245863F1580F00ADFA4BDE052BEC72739B88042CF99480AB6F4489F9C8B9319828A000FDDC4D1A6E49868E3B39DBF7DCDADD9B882B755E330C762FCC023EBBCBD0330D28DB6 +Test: DecryptMatch +Plaintext: DCF33FA5BEDFDD93DA +Ciphertext: 14BA927F10262B134AC43F6787EAEC3546C17EFE3F6D54AD2A245A0EE732B749B7312521372F21716E1DE29AF8FB329C25ADEDE2DADE3A455235DAC6C1F347C2A052893DBA6511C3760384935D68C7808D23CB194E6A19F579782B22C3D8880736BECE89FD75E7E69022E9B2500E5A044105B832C9BFC5F18A807889B401E61A9888276B31FD299D604AEA85091578D41E5B36D66C4510F4B147C5E59615 +Test: DecryptMatch +Plaintext: 217B0E +Ciphertext: 37B50EFF3A3FDA419988CA44CCA3AE95F465A18C89CE2DF025F565DAF0F833E198DAEEB46517FBDE47AA3D5DC5039B873A31D0DEE1EBC63F3E97C0A63CC05A8F877FE70EB7F6198C088FF35C1C369616D3EACB013F295F764146A5AAA2D21CD36B9DA4490CF1B37D379ED7713B955C3B0581650B5C7F4F5B8F45B89B94DC364D3340414B491C29AAF2E197AD6F59B0DD687F2E60F8826169 +Test: DecryptMatch +Plaintext: 36DA002D110CD632A9969DC42409B478A3AD3B +Ciphertext: 37126F749ACDF2B6BF667DE9635CC0BBD61753B30931C847B612936C1AE122D6F0E409B4E9454852540C5FD8DD3DA8BA4026FBE8CC8449CA0071409DB47165907202DC078E5A8F6B0E9C8D3497A2D02F53DC3A47389C1B3778EDDEE980055BC4B7EBAC0B95C0CC4783A4B202CE127FA0D7B65B252492A1847FAA9D1ABE893376917BCD46DB4FFADC06C880AD848683B874F7CDFBF0E4BD87AFC39303C512C44EF58B510702C1129C +Test: DecryptMatch +Plaintext: FAFD +Ciphertext: 0F63F22B7817F2449388E0422C6122200D76BA8D4CEDE63DE950ED26768E6779BA0A238C8C3F2CC5C87C7926F1247A7067E27245423EEEFABCDB606976BA2FD9977320F903733FB57D02620682820B1AEE165604410157C5ECFAB7090EE83638A99E4CA36CA0879D3C14856A3417690A52F14F33CC50FE44503FC47F2D90C096C03F62A85D88891E9568911AF61DF916C3677DCF152FD3 +Test: DecryptMatch +Plaintext: 9E9145E890FEEADC706AE1 +Ciphertext: 0B60A14F132D21E47E2FA20633DE43694EC0394115DB297C1B68D1A7EE7722B6AF5D149A2EF5D0EA05761C0FABCF8C0862AF320E9D273AE743717F78A46F15B640C87F4AD0C25865EA3453B0FB59D997E41A31B6C1669F14639E2F70F7D4324B8729A26C8869D97B432740F7CE28A74EFFC82AD7EF172A02AC678C13235BA2C6EF79143D189838E1F101385BD7098AE3B5B78A80964D5C0A3D7DBA7FD7328BE8 +Test: DecryptMatch +Comment: 1032-bit DLIES key +PrivateKey: \ + 308201390201003082011906072a8648ce3804013082010c02818200b98458f5\ + ada1f23f4ae8a3a519c27fde91efd1f201e386aa6119749aaf6ed389079ae49c\ + c76317f81f14164673e8f0be00edd4db4792d446e7bf84b30200626b442af3f7\ + c9a6ee6fb0f95807e62fa5b2d171a4b326cd60c82b20d63ef00b408ea337f50f\ + a51f07549dc4f9a660842724566b94d6e2a58980d2d20281ce6c327643028181\ + 5cc22c7ad6d0f91fa57451d28ce13fef48f7e8f900f1c355308cba4d57b769c4\ + 83cd724e63b18bfc0f8a0b2339f4785f0076ea6da3c96a2373dfc25981003135\ + a21579fbe4d37737d87cac03f317d2d968b8d2599366b06415906b1f7805a047\ + 519bfa87d28f83aa4ee27cd3304213922b35ca6b7152c4c069690140e736193b\ + 210201030417021534999c0e7b17cc3c110cff71571e8d4708c3122a1a +PublicKey: \ + 308201a53082011906072a8648ce3804013082010c02818200b98458f5ada1f2\ + 3f4ae8a3a519c27fde91efd1f201e386aa6119749aaf6ed389079ae49cc76317\ + f81f14164673e8f0be00edd4db4792d446e7bf84b30200626b442af3f7c9a6ee\ + 6fb0f95807e62fa5b2d171a4b326cd60c82b20d63ef00b408ea337f50fa51f07\ + 549dc4f9a660842724566b94d6e2a58980d2d20281ce6c3276430281815cc22c\ + 7ad6d0f91fa57451d28ce13fef48f7e8f900f1c355308cba4d57b769c483cd72\ + 4e63b18bfc0f8a0b2339f4785f0076ea6da3c96a2373dfc25981003135a21579\ + fbe4d37737d87cac03f317d2d968b8d2599366b06415906b1f7805a047519bfa\ + 87d28f83aa4ee27cd3304213922b35ca6b7152c4c069690140e736193b210201\ + 03038185000281813c42dc88e1e15b9a737bfd64b96a7448983da5242a6cf43e\ + 1cc72e8886db723b681c291f772bfe33de5ba735404581c839341969a691c199\ + 229c2849c1c8c80396837c71d711ce34129d3006aef9d16cac504543c6e570bc\ + 3d730d5cd35d8a375edacf591b2837f9a705d63dd62754365d13c103961161dd\ + 984d89792985ad688f +Test: KeyPairValidAndConsistent +Plaintext: 23 +Ciphertext: 0BE692E3384A784AD01D80A65D22B48449AFC0281B36085B0D8FA03574B4BAD05F754D6FFB8E3F4B4BFE60FC7EA2BC1F11253505C753BEFB1D3BDA0084E6CC1FD82454A601F1C0ADB52B3FFC4895D36542FE0139465B490102C7B6A75C9273B737536DD122CC8C3EA0F32900C82C45B0FEE97D995AC5B4345A8899DD6888D1E814BB5A1141A86E636D31FA05689ABA512DE869D12BB4 +Test: DecryptMatch +Plaintext: 4F571384FD52A9041C8F3094 +Ciphertext: AB7942750662F0FA422F4628B558938545FBF7C749995B4D5B32BBF392292FD1B4EF02E5A2EEF6874BCA9F0D4CBCB92D684CDA821829850BD4CAE110E78E42909CF069B54B4BC7D742E113E57C85BCF54AA5CAE1005516BADA834A857315DD6C3DEF4AEBBBF6CB4AE217107E16E83F884B2933EE618F22C45B78092B2EFF7D5C33DB7D89FED4E134921DFD9DA999FB8AFBFD094D77BD887D2C86AACC401A621905 +Test: DecryptMatch +Plaintext: E421A467654B3B88C93C8E5384FE2B85D4E340 +Ciphertext: 7485B8E5360BC1383FCE1C586E126D5DE89FF1CA7CC8146C37A1E6582A564C4588984915CCE9635EA6ED434C80CAE138FBC1EB15D16B294AC1E59CDE544E4DFBF276D30A7F51461C2B7E7F076222DE6AC534DC47E015BA85062694FD78DC37E9460C10FDAF2C61FC7EE0669E99793A657543B881B50B0D3916E395A959EF55B02DB8E7B4C5B5B653AE2D11CCE639342C8C77C667625116D9E6B6C6AE822CDDF2AA503EC3FAD53D80 +Test: DecryptMatch +Plaintext: 3D6C941B1F03E5C9A4 +Ciphertext: 684AA8D2AD35D2775BC30794A078CFC931096A37D472FE511F72B03B33E87AB1E7B958C3447AF6285AC379379E0D1F1BEC535E4032E186573742A75C1B42BDC52F679DCA13B2B9E67CC73461084DE1777FAAED93C7C1E4A6B19473EDF6A57CD88C076574A356748D501A05AF66A136E908993A0A70538FEB03109C62A41540EB4E166596887B4860E3AB0BF9C1AFD02C67D4BFF28BAECD31D1CEB207A245 +Test: DecryptMatch +Plaintext: +Ciphertext: 111C252A9E64FB777F09AF6AEF9C4210B9644C3A66D5528C631D5348E30B146A6225783DE1FB796DBAB3A901E37818B5AE49BF1F8CC0A6C8909D2DB06D651CB08009A25E13A89653DBBA5959674E37BD72039D4E7BFFB3A2395DF8C36164C3FA71334DBFF2FACA090F1C349BF68443838A0D893B9B498D3B6CC86646F935D5ADED81967A387506688B6478492129534F3A651C9985 +Test: DecryptMatch +Plaintext: DE5F0B92C45A0C1530 +Ciphertext: AE6BAEF52B43EE88AEA7796D667D044887407ED07E7618358243A0108514FE9793EB28EB42B4BA2F28F6687FE7973FB8DBF825541010F1BC1FC7350CBEC0B055C0C71FF2C4D2634582C966C1CFD3449AF8AC956BEC3EE797F7E81E589450EA13C1A8C99116E05E49F4BB87C9B95EFDBEB35B21C36711CEC8A1ECF3E4F194251563F88C056749B835FC19A7CD560FEC785207DD14D43C6104D83BB05F1DA1 +Test: DecryptMatch +Comment: 1536-bit DLIES key +PrivateKey: \ + 308201bb0201003082019706072a8648ce3804013082018a0281c100f9566c8d\ + 687a5ead7c780617d3ed37b4afc46582e9fc0d75ae217fb506f5c2024c2a0e6d\ + 7e042544235b4de63047a33940d772721e895f9d4e92790bef0d3668ec7f6cad\ + e7f9b18049b33efa773c83e97b35ef7ebf18934b48dd4700a48c1f76ffc20684\ + 521bad52834086ccdf1e3d5c9128fef52f6a9444d8e9944d49e5ab411f46b63b\ + 290b7fdc8f48fab24c2059510bb7247e0930d5043802522d67f2b69ac18b82bd\ + 0229e53bf6769fe83c469188d600e6afa6686bd9725afb9ce39bbd9f0281c07c\ + ab3646b43d2f56be3c030be9f69bda57e232c174fe06bad710bfda837ae10126\ + 150736bf0212a211ada6f31823d19ca06bb9390f44afcea7493c85f7869b3476\ + 3fb656f3fcd8c024d99f7d3b9e41f4bd9af7bf5f8c49a5a46ea38052460fbb7f\ + e10342290dd6a941a043666f8f1eae48947f7a97b54a226c74ca26a4f2d5a08f\ + a35b1d9485bfee47a47d5926102ca885db923f04986a821c012916b3f95b4d60\ + c5c15e8114f29dfb3b4ff41e2348c46b007357d33435ecb92d7dce71cddecf02\ + 0102041b02191d78b208d09b23e859be7e79ca76e612d8e5ac75a5ca02c506 +PublicKey: \ + 308202623082019706072a8648ce3804013082018a0281c100f9566c8d687a5e\ + ad7c780617d3ed37b4afc46582e9fc0d75ae217fb506f5c2024c2a0e6d7e0425\ + 44235b4de63047a33940d772721e895f9d4e92790bef0d3668ec7f6cade7f9b1\ + 8049b33efa773c83e97b35ef7ebf18934b48dd4700a48c1f76ffc20684521bad\ + 52834086ccdf1e3d5c9128fef52f6a9444d8e9944d49e5ab411f46b63b290b7f\ + dc8f48fab24c2059510bb7247e0930d5043802522d67f2b69ac18b82bd0229e5\ + 3bf6769fe83c469188d600e6afa6686bd9725afb9ce39bbd9f0281c07cab3646\ + b43d2f56be3c030be9f69bda57e232c174fe06bad710bfda837ae10126150736\ + bf0212a211ada6f31823d19ca06bb9390f44afcea7493c85f7869b34763fb656\ + f3fcd8c024d99f7d3b9e41f4bd9af7bf5f8c49a5a46ea38052460fbb7fe10342\ + 290dd6a941a043666f8f1eae48947f7a97b54a226c74ca26a4f2d5a08fa35b1d\ + 9485bfee47a47d5926102ca885db923f04986a821c012916b3f95b4d60c5c15e\ + 8114f29dfb3b4ff41e2348c46b007357d33435ecb92d7dce71cddecf02010203\ + 81c4000281c07a5b4ddf442b2cd7fd925be84f2ef4c4032d61c5a55c5949b30a\ + 765cd4d5d4566af37ffa7f814f51bdd71c3e5575c6fd0203f14d3ded4e14baa8\ + 2747a6437d35ebc81e2035bfb0e04087fb5fe449163377d47b045b680b394962\ + 20b3138e85f6d24e06f955ec7a1b785ce34c2926cda441bfc86ba2f44a489a41\ + ee1740ab5ec3daf6d2c598e1d143654c05ce61792b47ac92c8d6ba0711419e41\ + 221743b768eeec2601f66d277fba154a62dc996537a0caccfa313cc9fde0194c\ + 05493aab1f07 +Test: KeyPairValidAndConsistent +Plaintext: 9302C420D137C310 +Ciphertext: EEF64A81C754B2EF543A19549AC0FF3F44E4B548284ABAA1E5F1EB704B0D246749D7F1CEF7B20A5226384DBE8FB596101591BE2B53E9909EE3723CB70A385FC2DAF6CE15629EBA21E7F26223B0A2428D8931CBB4F1B281E318A540F38A809C8BAD92D10FDD63305DBBE972E6CB973FC4F2FDF0BB9CC37FC42C7AD76E8DE3FA91E5E79B09796652BFCD62A28A59D9A97759032A0A78E0E1B081DF212A15AA44E35DE9E291EDA499DDB631486C029D56052246C9E37FF24EE9E86465B3B55BC4BAD77B9AC873B6F36EA65892B202E320756540009C81B9C6747BDAF40E +Test: DecryptMatch +Plaintext: 9FD4F26B7317BBD1B235 +Ciphertext: 514DB5C63AD9707197B4F0B2A30CDA18369B963E62F7ABBA1E030E08D3DE4E6C17D4BD7CB8097C2E641FBB0AED6A9FE7FBEAAC1C6B85BB3570D0E86FF6105B9F8C9B562A4EFE4AE3AECA26978C514129006D22C108B1C8A0FA55864EED3D3F81643AAFE36DF1CBC3B4E1B1AD6D5E0612214938A55114589B97286A7EE5B04E39254696DA91453027F07346984423FE2784DEA9375C236E6640504B5BCAC32062836E5BE1695CE73285CD77CE9717FA38E080C28C2959D9E32A589C04ACE5E52970ED49BE34703AD6B9F024DDA176C631EF5EE76833B427E233A5DAEC4328 +Test: DecryptMatch +Plaintext: 337D8BDD32 +Ciphertext: A4EFBF2151DAC683F0C51D60A647151A1EA0C0DAA8CF3497D7116439E6AEEC62A36D06F89AB2F1886FB9F62403E3DA8D6F67F66DA2436EE20FFBADD698DF87EF40470749C0BE0414A7AE4D2755459F8A17F6C7D8920236400313D7846532C391A0A4D99C26C556772E2D3C74E0119C4CEC7EF224488BFEBA017A910E5FD167B4486E436F7481DC5A46F3FF0536193C75A857DC53C5242C11AB911BD21926462C5060BB89F71D99FDEAD3D16B1E21E0D0791B59ED0F49871F744B13F23EF5028C238B895532F90B0ABE9912644EC079604939A0CF519BA9D185 +Test: DecryptMatch +Plaintext: 25549A5AE844ABEAA694E3F6 +Ciphertext: E2B30DD7781DB7EE7B2EE3FEB77F7360A6069396D8BF1DFD85D5429DA5A156677679085D612D0FCCA0979C97E924E77C43D3702940DBB556A5BB6EA33D650E078B1CDF8E5F76DA6591D0AFF4389A3A982A9AC581BFF393B35D36894E407AA56B493C2F7C4CBB75AEC72394AC4F8A99089702F3AEDB2FC7486F5CD01691C3C8F8FF3E951CEC70A4E172B763124BE1D9F96DBBFBA8FA0EBD1A71067A20F68DA6AAAE849880DD7F88901DF051715E240BF0F5B49EEFE35B9B0ED2B69757111080DCE2E2A933CFBE8FB9E6E9A2C2C75E0A4228D06689796AB919EF80405CBF648137 +Test: DecryptMatch +Plaintext: 5E61EB24085019F4A76893517C0A13 +Ciphertext: B13E45F9288FD2C5C0FEE230D1A09DE376ADADB5A4330F33BEC04C6F14C4A1CF3789B976F402F11611AB8345B2EB1069CFEE1E2F482A02A0ED9A3B9D94EB78C7BD7222ECD48A598E34D1F0B6205331CB20E0B2C6C146FB29CC11BAD5CA06BCA3EE39DD536FF330663A817ADECCC284B92F6AE3EB75B00316992BEF8A955EBB4DDE2CEF504E9298AC243C00FDB64B6AE96FD7B2135E6BCEFA7CBFEE135A650AA3D8CD095D1C9156232DCFE1904BC4CCE58B455CEFDDEC1D201B07ED4F999D6281AE21C2008525DB24BEA2D9FDAC1BFEADC3E6E6B1181F1A55A75976C565BC28F177CF02 +Test: DecryptMatch +Plaintext: 87 +Ciphertext: 174E5CFE167D4F6FB9A8FCC0FBEFC12864745900F5A18EA92282C8B6689EF53BBB87B30FC21DB101D93E9FFCED05538EDAB59F9FA07FB176407651DD0C4CD8269B1DBB70F24C8177EC6E16294CF5E87A3070A077B1CE84B612C3E3B1D4FD60D732C4D2CAEF5AC442A358AD0F323E60F58FC8B29894F3EAD3AE0DB8FD08BEBCCD4220CEE6B7C43A5E769D1F890A6B6505EE7FCDC7E399FE5321C2792D7AE094D13EC493CC0911B3EDBA6DAA037E2EA0CD3642784FFF2CB1BE04E5B12AC9D2871F016D8BCCE6DF25C1C04D912CBE707FD4DB0F9E89C4 +Test: DecryptMatch +Comment: 2048-bit DLIES key +PrivateKey: \ + 308202400201003082021906072a8648ce3804013082020c028201010096411b\ + e93e733637e91b1d74f808f4c9c528293e3123ac1d3d2f94c462ff38d0cd2fde\ + c0eb03bc5e54b6df41e9bbe9127a1b3a7f47cfb513340664829ffae26f832b48\ + e2d660d10e4debc1bfb412f331ab7b2f88c0d31fb587ed5c5256e0ebf7da698a\ + fd3cfa0443af91bab8c539376fcbad72bfa6985b6e64250e6b546b07a4575b08\ + 449d383b5650083c637d2452e7d1b9227adfd328ce473bb4374fa31e0ad52e56\ + 7feff6a9c4842d24d069e7babb35313ad63ca5d33d572bb309689a571e9ffe25\ + 38816bd7bde7bb11c10752e6a842751f594f50cf4b8111f387134e30c6c03ba6\ + 40be7cd5b6574c0d0b571a98fcdc292070595dcf6e8d034cc0ef92e8ef028201\ + 004b208df49f399b1bf48d8eba7c047a64e294149f1891d60e9e97ca62317f9c\ + 686697ef607581de2f2a5b6fa0f4ddf4893d0d9d3fa3e7da899a0332414ffd71\ + 37c195a4716b30688726f5e0dfda097998d5bd97c460698fdac3f6ae292b7075\ + fbed34c57e9e7d0221d7c8dd5c629c9bb7e5d6b95fd34c2db732128735aa3583\ + d22bad84224e9c1dab28041e31be922973e8dc913d6fe99467239dda1ba7d18f\ + 056a972b3ff7fb54e24216926834f3dd5d9a989d6b1e52e99eab95d984b44d2b\ + 8f4fff129c40b5ebdef3dd88e083a97354213a8faca7a867a5c088f9c389a718\ + 63601dd3205f3e6adb2ba60685ab8d4c7e6e1490382caee7b74681a66077c974\ + 77020102041e021c614682228a4bea799d01008a4bca099e7cf7711d7914a81c\ + 39d2407f +PublicKey: \ + 308203263082021906072a8648ce3804013082020c028201010096411be93e73\ + 3637e91b1d74f808f4c9c528293e3123ac1d3d2f94c462ff38d0cd2fdec0eb03\ + bc5e54b6df41e9bbe9127a1b3a7f47cfb513340664829ffae26f832b48e2d660\ + d10e4debc1bfb412f331ab7b2f88c0d31fb587ed5c5256e0ebf7da698afd3cfa\ + 0443af91bab8c539376fcbad72bfa6985b6e64250e6b546b07a4575b08449d38\ + 3b5650083c637d2452e7d1b9227adfd328ce473bb4374fa31e0ad52e567feff6\ + a9c4842d24d069e7babb35313ad63ca5d33d572bb309689a571e9ffe2538816b\ + d7bde7bb11c10752e6a842751f594f50cf4b8111f387134e30c6c03ba640be7c\ + d5b6574c0d0b571a98fcdc292070595dcf6e8d034cc0ef92e8ef028201004b20\ + 8df49f399b1bf48d8eba7c047a64e294149f1891d60e9e97ca62317f9c686697\ + ef607581de2f2a5b6fa0f4ddf4893d0d9d3fa3e7da899a0332414ffd7137c195\ + a4716b30688726f5e0dfda097998d5bd97c460698fdac3f6ae292b7075fbed34\ + c57e9e7d0221d7c8dd5c629c9bb7e5d6b95fd34c2db732128735aa3583d22bad\ + 84224e9c1dab28041e31be922973e8dc913d6fe99467239dda1ba7d18f056a97\ + 2b3ff7fb54e24216926834f3dd5d9a989d6b1e52e99eab95d984b44d2b8f4fff\ + 129c40b5ebdef3dd88e083a97354213a8faca7a867a5c088f9c389a71863601d\ + d3205f3e6adb2ba60685ab8d4c7e6e1490382caee7b74681a66077c974770201\ + 020382010500028201001eb30132e415358b7d3f726b93e2eeb083fe7add7abb\ + 6ca352c9e09b365e5768ce032ee52d59f1c65311045c490c42c36ae08cd0264a\ + 26199aeec8c3a8882a363397b4d7e0b6c4abc407f27847be0e8477993069a1a3\ + a3fe68093e09ce55bbedf97c91e741ad2eceb7a0f4be6ff87f68deb03c5280d4\ + 8fdf4900485bf5ca20257b176f58fcee1f0451b3716862488b0642bcd76654ec\ + 4874512538976967a545cdc208a0050f26e541ca70343f653222e6df7aaa07cb\ + cf354a5ab910eb8447382d7f512c440982ab37a402c87d2888eecb35c636ba6c\ + 84a5cce917f234fc7f8d9167167e30f2840407e13751f1944f6aceae3f5a7025\ + 36723c1d88c8c04981e4 +Test: KeyPairValidAndConsistent +Plaintext: 5EE1 +Ciphertext: 73279829369404A1B68D5E86FF334259936133CB04C9186CFF733972054918C3285EE907C2863DEE872252BF03EC9FB088B8DCE6D69D78C6BCD6B3FF87E683C6CF3CA05FA6AF0C068D964BE01030A3AB4E19575811D141A59CFBC9D3558E48CB771D88CB1E0E6C7ABED041077D24005E337AFCFE8531569FE56E2CE97C40693C071409888AE46DAC8BD739AE0E1C392586917FE07A66F7D3AAF0DDC398117B594481D0D5CD19C8708DAED6338EAA552564C31F9548FFC7E5C641FDA95B252EF637C6CF708979948A3E6B4F37A9ADCD60BDD841F3B0945CFF55E2F13468EC71C550CC2AD48E7E1FB444F132AADB1EF2A7C5A22450D0E0CFE9E37D999B4794B5A594A4EB7ED406DB24ED541E575B9F2756545DDD34F6DB +Test: DecryptMatch +Plaintext: 0252EE2E1C603017 +Ciphertext: 0E742D794904D05C0F0B6F60E9655337F8C110F289C6E4A0D6FBA6A2A8EB0FBB566A7F9B9862175C7A00A8205E8C8012366023FD8DDB6EB713DEF86917233DC5D16C2822707230169C183FD3A714806220D7DBA735C4F747A23E4131CE12C5572BD5E659F967A8B7DAD0EB6138D1BB569C6F04EAD79F9A6301609697F73F6FD8CCE934FAC6FC138B4C552E211FB1CC242805C035815F462D0291537DE10632141ED0A7C22439C7270AF0A6244C073CE9E2654FED918C86697988B0B341C5EAD2CD6DE75EAFDB1DFFCC5FE465E8D8C9A34D5B7F0E9DDE62204FD12EE2F99435DD58F3254268F8E6CFFADEA9205DDFCC943004887C405859866A0A40456A6C50B57FCED319AE0EC92B9069F765013436FC9A0253481CBE12B707A2B20D +Test: DecryptMatch +Plaintext: 01AE +Ciphertext: 6AB2E26D99942CEEE4844632355BB3B7713DF000DA11099D4E1BF9EDD1781A9396032E9D96BA0DF21B309A9CABCE9AE3D022C33A931183DEC5A3721EA5CEB39C18935A43E3B0BC153E4469AEB604D031A0084BE5927478AF8EA652D0A4AF455BDC57EDF26E2C6F9A01C91F29984C11D3C60313A53D8AC65D9FA504742868AD3D313506EB4FDD0E9799B111F3041F4C0547BBB06BF7DB20D18B427BCA1BA5099821A5F0997EF08C319B851F0C88B4814CAC7BAA4290B3182738C37B6ABFC2C4770A633F70E6FA4FA53AB286384FFC2AF9B64DECBE12C8EEB97862F76296D13D889E864418056420DCCD0DF9B76FB32FA6BDEE149585F427F133972DB7281D91D6E78B6BC46151901179D186CAAC784D6271023FD6E84B +Test: DecryptMatch +Plaintext: D52A1E0E3253FE281A9471 +Ciphertext: 63F60818E399024073EAF02A7A419229EA4E2FA4126C910AE7D31DE7EB6C9502752F5B7241F2A133E9D71C1A75E23A6F5DBE36C1B661935B0F20123BF434153B1F81BBDE278611C9FAF9F56BE8C78116823AC5B5F355B88A82AD6A73D2B63BECFC7D3B39DB2A6B393E23826235AB76653EDF65DD7A94BD27E221E9D511041340FE83A27F7B26CCF3FA40B2BD786BB9D67D2BCED415F2F76D116E8F3EDC953B8A327D2846F247D91626F643F8DB800F5E1DF0CDAE2369AA8969A938E0BB5A44F0A9C0BBC7D15A34DAF4713531A7B6B59CCCA2282952B16A7E1A1D1CD47D8B2AC6A88BC6A85E692FED89BB3D1F16AC2A922836152059433A29F786F2386A74DD6F555CC8D06C890A4A93E9FE88CEB078333A631E9E3EED0610F0A17F2A4F8DAF +Test: DecryptMatch +Plaintext: 53 +Ciphertext: 7F820C0C9A5709C6026E58446623B5D4B323BACE54724F456684526BD1966A360944227D04824B3C9BAF19A602EBAD25B8047FB6BF9997EBDE6B854140C032481F1479E4B994FC5A2DE8128375099A7A0024AE1CB985D73BB2B806B20E0751EA154BE2A70ECBCA49335BA57694DF1E0EA4566304B8DF4BBFE5AA41D0B767AE1679BDDE70F95E1C0C7E06F4A635F987E2858407BCA2133C3EC5620D58F1AB7FE1426B615959009A4706797FE4060E1C690DA373E48D6BA684F69E981DEE5DB9A58C504DED4D4CA6CD9B776DA03E55DEBA97E541A300465FFC68C5417A10ACED061023ADE00FEED4099180948F26F10D2F9470978469F67AE1092100C16D8FC4104DD1E711CF67D5842DE4102869E96E817F9C9FF520 +Test: DecryptMatch +Plaintext: CEA6026338 +Ciphertext: 13D877F0F00D01125447982639AC82AACF30FA0573001DD809C72D0F811138088C6D6D0569E63AB001CEB0339BFB90F7B71F339CA2F75859920370C622C0C4930B79B99DAC0560C763A1162AB46F58D1409E25301AE6D70DD4FA64984FE894DAD2B6401F8864580132664DDC2A57D1AF8AAE43C2759780C8587475F21275D61765251DA8FE91921703DC8DD279DFF4260D8AFE69257BB43EC609DA30DC33526D66E46365F399AA04F34FA7BA6469CA964AD6F2299233424E7342F1BF493C0BBB31FA1C713543D758219AB0F73B9C24F4699415F96C32E2A700669FCAE7EA6921F96288723ECEDF9677EF35702C8C0B71AC27A57624A7667580A2FBFF72818B2BCBA3589DCB686486FDDB50E29E75EBC8AD3DEDC8B741AF80F7 +Test: DecryptMatch diff --git a/cryptopp/TestVectors/dsa.txt b/cryptopp/TestVectors/dsa.txt new file mode 100644 index 0000000..8f31ee9 --- /dev/null +++ b/cryptopp/TestVectors/dsa.txt @@ -0,0 +1,337 @@ +AlgorithmType: Signature +Name: DSA(1363) +Source: sent by CygnaCom during Crypto++ 5.0 FIPS 140-2 evaluation +KeyFormat: Component +Modulus: 8fbb9edf2fd2834b1a9fe97c25999fbc381ae165d932aa521592c2cdcb4318bfb99a2408f118ea874b73704e2cc557fc89a01ecfb5bc412951e86613b0b2fad2389e81ef42f79705fcdc87a9b9dcb1afb44c37d971aeffc1c859be367457ea19d71f22bcaa29752f15242f59b295125e9e01ab582887fa869e4b0f4a308167a7 +SubgroupOrder: cd6c675f1d22c771e7f59020ca0e94078950df9b +SubgroupGenerator: 7b473ffda9ed6e10f85177ac05f43ec666dc6d42310151053ae83369de9f9b331232cbc83bef31166e19b111e46e57703fc6666ac9a571ff053e18f3c2fbc4c2f32521750a941981a55379a2fe13bc78c6a3787f44dea397af63a7ce432704657feb57295ab9711ac7070ca5b7344bcaaedfd8bbddecd8de9c67e7cffa2fa20d +PublicElement: 64f31bc4d5b42622b41326361fb0d67f9feb364b34be67f6b2e4dc1f928fc70e6fe42cd9cd6ce3dc40113e7b4742d4af6fbe04d962adc5238d4d95b7bb67f0ec6592e966517d0a34137a45dc82ebe282c904750e1aa31b62c919b250d4d8ef922b0b0574cb2ccf1b451d7facd075e77fa532626602b32fee6fb334e1c2911388 +Test: PublicKeyValid +Message: 699c4211bcba049ac8d73c37fc3d02241f70b8ccbd6a1225d813664bcd043660847dfba3dca434cf5600afb60036171ea402bfdc3279ae2f6b7deb5fd0810a96ca7ff7ff1a36021d84a92b6db7d4b03f80b1d5d2306cf3af4be2c448725fedd09399cd5d4fe8853cabc84895fb91e4400c7591e691bafa5cd0398a3c8d18f8c5 +Signature: c0aa11b2571acf6fb78dd85148d97ae04877ea1a05d27ab73783ba4efa3a4b7f110cc44c7ba2c842 +Test: Verify +Message: f5373216e55156d66524e39dd8a345cc519edd8cee2b7cdb755222d42ef8f843000e8b69cffa4b0c154543c3bf871b804a904b5e1ed8a1ad2a29f63bc28b2ce5b5706c5fb2219e40dd682951ad7fed1709397d9ea36fa18894ad0c57391e5af74db54d8f479d4989f6e40de05b63b4a9c7f0ebe535c87485ea36dcbf4b897890 +Signature: 33e28ca5be57567a880c52451ec72f27d25b6e26c38216900ef17f0c307fd7614b399ff5febfd7e6 +Test: Verify +Message: 92fe48a60045104207970b674f800f67cabbba0dbc8d1d120b64a4ddc9b149800003f9efbd6446825ff84fae21d4ed00e61d1f5b4562b872d53b4788ba2247677091889fd75ddd017f52075b3610e275d025ce4c366c608eb2a64a567a5688287ae2cd3066e72db701dc0ce6a7eb46bf210c9f59aa646e5c3ddd86bc210665ba +Signature: 95616a85b6d9ff3c9af7264cbbf8b9cdb71404eec47fa7c91291fb93ddd8b0327df74cfae6698e0d +Test: Verify +Message: 18b8baa09b84cf8ec77a1d34d68b0971fa71016ad5b71838350ce9d114c8aa34d0bf8fd9a747615876845f58b2fb55bba757fb08f176901838b7b7042f87924fcf2a1c50d1c7cce36ab768514b0f277cd86b0a4fa7fe7c653cd729f803751b0d8f8f1cde121d47871caaf0f598deb70c0447e718f0671576ba04f68488ab80c5 +Signature: 23c6fde5fd9a2478d99c3abaa61363d90b2c161e847be181af07276e376ce4f76db56dfc3a1f2425 +Test: Verify +Message: 598660449d62f60b1e0581b0c493803d3ba5cb49a5c5d5917f2a41d6d1b6a8f69a2ea94e7bb8334fa29a0f5ffa32b1f291313fe9491ce32ac3044e8188848db77afd10f17a0ef84b5b56a1b5076d700df021de7ebaeec51827c0eab042ecccfacf6bace5f35add3820b04e6a443e55c632ecbec05032149182d52e1a57e4fef8 +Signature: 2c07790afcaf89768f1d1492345510d937e65bca5621811e1b705651a861be1f88f52090036cc1ce +Test: Verify +Message: e37395964c3c1f7b37c99c2f56070cf9672de2f7cf63bc6778ae6532e81f09baa23cb7e5c2af1c6ad32e7e5bf4aaf7f42cbbf4a20a4bed578182660d02f22799db04b8b2cfa31f41f727ddebd88326ddc6b361d77860e07cedd6e1d87e28c53244a28f14ad6fa099598cb1f73bec114ceded21ad53fa0d6d7482ccaa951a5b1e +Signature: 58697e6dad83ddfe43817e5534535ecd78a985d3928e271212165dec4e76c8025d531ee84ba8caf3 +Test: Verify +Message: 24976d350993351696b33cf2db5440303d5a722cc2d25eeb9ccf1e20f57ec060fa8bf4a22ab9fafbe0bdcb971f5b86fb9ec41e79142e42f4c6b58dd54e71ef4eadd95cce9458b3c5ef2df19ab38896e9e9e35801fb9e079e3fdec0e3c1a7559b5638fdb1dea738edd9bd06f12d144873366f76bc0f5a83621f030d42e857cac0 +Signature: 7488f2ca5fe2bec2c7a83e73407411c9e89bf8cd594d4a03a736423ebd913c2b98a21e445bdf70f6 +Test: NotVerify +Message: 430cde2feba0256295b6366211252174a29c9bd2b8e6db8fe97fb9ce35580a247be8364a37741b077e9f275d3b34b1f2ab3397c2171b1e04d177065972aced3c5201e6a648ef5900a3ab1e4f69f2d59bcf1488a0f84485b8f21e7508ef7ac1eac070269b97ac9726fef3539012f647450557a6c2d4fac685448d3e32235a3e06 +Signature: 7500d2fe4b2943b4da93490d3bac5c344bb18eb550975ead0e461ec33485e11714b4ceab478644b0 +Test: Verify +Message: 81bd412f4f9c8f8b7885d9fec9b013be8246d4284121dc9c2fbfe59a6987af1db141463855cf96ef6031325800b961f2378a6a46c65722bc565ab3c0e993ae15814354790fa8217a9efa9a98c0a6599c39c95638ebf077e0010f5be860bf63df4abc032a559e47e58bd8a9f6e3ee1173e0fb2d378762f4bf87d4764aa483e631 +Signature: 37cb9d9adb92a7e74365f9e4c4857a88a6fabd200d955dc76333b0ea9c1b2f05fee9117c79b10d09 +Test: Verify +Message: 84652beae6fec221ab800bf6303f17a47a84278a1274a2b11f40569bc58ff34ebe28c5a138e4b1c7eed4731989ae1728397db5038f8970c59e84b16353f8a1b411ede5c290de9e50f7de9fab3807f1b6ad238530f09e384900ac0c6591b6a530b30b03e2a8c47ed4fff80744f5219e650cce0eaaed8bf0547b0edf3a39a3f8d9 +Signature: 194a79f399087d977a29a3eab308670b7b133acf4e8b43068639e0e5e37d7ed305e32b85e30a0a22 +Test: Verify +Message: 9cdf6e966c37794c7b3dd6234e76d715099128caff3d03917a4a96a2c703b19386cab41830f5b8ffe9e9fd6b88759450e4714d2f6298e413bca267cc13a5ea6c38ae6fff379b0f8e253b6e562ca95f45d4e6d3b694b6076e99bdeed7d5d9dc7b4bc275c49ae0d5f2c86c015d51cb8eed702790d7ad50c59aa8d203392456dfba +Signature: 7b427233d9e49dbfd8ff2a7814dd99cbd4533d67155696b215d593d5ac3989c8927850601c0d453d +Test: Verify +Message: df577c9f2370b362f86a928e40106d7b0a511d5d8ec619776b82d57e1f195b4bc7f328c619d2490e9fa2b6ed3681ef7cc60fd51343f7cb74e5be0d37a3cb5078f6b89bc0ccd86532ca09f0f7c6bbe5eb85413088b1571e131ef5b6063e5355bfe23d8d6733993f24f036f682ead7871fbd7fe796d0ff4dae90be88c4e8c9a276 +Signature: 39a7efc692685eed0c3cea8838c026b39367c6f446a16258906787af9447329ab99e821eba53cb89 +Test: Verify +Message: 91042eb63d47c10f678bec836f98630e13e707b29c98b28d47b1443cf699e97018d4aecfd500440e7f11134c35c982b1d97b86473500691869fadc89974840f7d2ca319045565573a0fb630bc87576a8bff09460d1027a2500e3ab28b2eeb86d995dd1afe3418c76a4c0f5778094d72c9dc04ab4c8947eede6e3c6cf9d83e80c +Signature: a813d89e3de90f1ce1b77a7d6c629e8f83296aefb8bfe1194f914797d08b53fb59cb9186935dc10e +Test: Verify +Message: e644b9a45009da8248611de174b5613dfb4aafc0a772740c38f1ff480bb23e69ecabb5c2380dbfcf37b1093eb8bf4c3feea04a0d8b270cbd1bfb5a46a2487bd279a62e446649e80afb6b502431f6f97544765f4ad13f24282edb8bdb0ab635bc460d1c421314cdcc4c66eaad16b3e078b6a4e48eb21234e62b688c1d7a56e6be +Signature: 4e4fbbd84fc44f0ecd6c163fa292cd96051ca51764fb5626f8ecbd8470faf6ae5d79c731d9a3497e +Test: NotVerify +Message: d30ac577ac767ce6eee34ccfe09f0278f2faf8d28f657cb424ca7f53712b7f040f7eb63643c784ab02771af64405693a8eca4a21ba22ee1b09c189d96c533a0910583e53283e5693ffc076593d7eaf9e79de5ec9002296e2e4cacc15492cc26beb52b5c4f414ca17fd77b6ee6245ad1ccbec8ec2f89c4c81cc9ca0019deeeda3 +Signature: 4ee3704d4bff39aff0efded0930cf28ff7641f089280f1d0e38a186075e91d73a5b1e7d028340fe5 +Test: Verify +Message: 82bb8073af3e53b8ae158f342c4cae3c039dc830703bf0e893dacf5d280284948596bbd0d3a00cf8915f96464693dc328507df9e27607d43c426095b74102c90c494fc24fbaf5a628ef29146e1ce2c684020182f1e00fb338cc6d4f2fd5ed3b739ce7bc89e05f6cf9fe6b88b769558b72c01ab3accb22291e3d5667a3c8532e3 +Signature: 0b0b366b23090265e75752fdcde1a7d76113653246e0da762e25012cceb13859313e469f4dc31680 +Test: Verify +Message: 12da3a70153655976cba8144f67dc21719410fd136aa69ab4cc11df9eaa955005ba0e5140d3955f643d82a6cfc6e7a222376afc1f8309b4dbe1dbdc4a6bcd2f5fc839f9e9020fec967f12768a3c14130b0c529b3b0d682c129f1fd00eeeceac94b7a0046746269ca30fc1171c2ed30f9182416df371436bde63376e49ab2b635 +Signature: b43f325f82eb07dd2cb3a03a022e8c89216e820da743c216ec6eec5bf445f12b2d326d52e38b90ab +Test: Verify +Message: 45a2799fb193f3adbef66b8035318c5f7eb3610dfc64dbd1a84b87c0f082884ed257db1435c4cce38711b30b9dc8f4e5c7d936a7330ee36984b2e172b37d8ec925c401f80ede802305d93d4ae85e56dbf3e20c7b1c0f4216b17238253465893f773f63e3f4bb07846fa781d6cfcea858382658226e3eeff166e306702e1271c9 +Signature: 238f01011e1b3e7d027af353e06e2138f5a40ffd3d7a78d55c95ea3b94ad82b8ed58c308f7db5ef3 +Test: Verify +Message: 6cff32791fa0d15947fdedf67508fee334d1739512e15ce3ecdb5ac17f56c43e2cf51bbb0bc8b06d34e894164a4dc0ff48f3863a902d3716314916e278667de7bb914ea061279d3c36679b57ee56c6f4f7d84fbe830bcb80d6e71ee2cd15a565b00ca3a13972eebfe4b2da3279d966bad8b7a69a0533701873ed4a36951b94b0 +Signature: c9194d5ca3dbb424faae51f66377836a93bc55ab1d481e5eb9663c7033329d82c13af868f4a24efd +Test: Verify +Message: 37a363f2ebaa01fd1ed7902a4804c8fa46845b63d82b947e59a23073c0e97da2d72db113bbcc8d2095a6336197a744d83a923d5eb610134dc1f80d6f8de1e327fce615de26b88db10dea78599f79615aed9b906fabcaa236e8106a180e94077b1c65462c23863a07003b19e858935ad7d9360d6fae717a8f4480fd443c1a21f7 +Signature: 9ca210249d306006ecffd384f87c4dfcb1d466e005d877c2508475bf0074c4c6fffad6e123bd5dab +Test: Verify +Message: d3b14dfc79ab30cae8e40dcda6bafd6434741e6ab1b9e0d2cd4e8d80f10f176aac3126ef61b662772f31fe4d21bc85b99737e961f5c2c9e28a7d02aac27f7a19901529d8163c687997617e509f576890719ae9aab1c3d3e3524b9434c384036655d56d6ef035db06f7eaa68e78843e22981437fc3eb2950bff2e59d54a154b8a +Signature: 30cffe077d2330f111eaff346634237473feb83cc522a5d20c75db7b4c90c4e21583e1cec8e00f29 +Test: NotVerify +Message: 69d5980a58474652bf27388ea6041f9e0fe688ea95f59fa745682c69bcb1c7ea82e75f19a773eb669cff6e4d549b31219b323c1bb62d16a33c65bfdd344feb77706280b229cc51afdc571dfc6495c35f5953c8e1a83d0b1e73cec7cd2b7bca8beb20f4ec18abf2c437073cb20f4b4def00232255a27ff6b3a17b3b50d88fdcbd +Signature: 18eeda64cc75f18f58d43ce6b95eb3918a521bfb40c1745a38f985d294caf2d86879528678881191 +Test: NotVerify +Message: e0ac66b23eabe745886613c4698c79478f484a43f8dc444e7e7ee215a673c29ba56a56b4b41bcfc1962046ad66132d28a6eaf623858f028c71c3cc4bdd34567d54ddd4f0bf9f97dff31e3def7edd1769b39cdbbaf3f28b283e27a5d7fb548cfc04be365ff66f1717b7164e8148210f83cd1951ffda3db89a0062c5af980a3c8e +Signature: 6db33727b795d286a69ddebadd6e09c527bcb1ee596915b6fc950549beed350fda40a4c1f52c6a34 +Test: Verify +Message: f9cec4d6e1f2c2285dfb17d3ec5d16edec0da9b05ad12d62cbcd8f84ab4ba73eb6cad40ab44ad9a079d7f8221c544d89778a6d50df713f5f25bd1a3acdac1f6a8d0fd92c0a971459ce62fb958dc675bc995dc189a3515088b3e9e33f6b54e59978b60b9359712a2954b55883b54b475c4a9ddeb31c0a19b66f6922ebfcdbb0a1 +Signature: 947428406add226d1dd8db3245d00617b152921404ee5ab8d4e840c87d26073cc4d144a0b51e19a5 +Test: Verify +Message: 966d6fa1ea1ae8d344037a48420d6379278133fbc0c25450974fd9105bf988398f652ad373c511c830d2eb02470dc7c63b3865507d0fc3b0994ce4e4a0dae337d55839d99bd14bbf9eba37be412de0e348653815c77acdee4b5d97d646170062c03e35ec3cb8ac73e8b3f6b40ae5c78aa7014383757a8bc4037c881f2727f772 +Signature: 63137ff0730f28235e87cd5122d22a973035869332ec538d5be6e2c9c0db94f3c012ae4abf3af9fd +Test: Verify +Message: 43a8f0b5992db54d1d65acbf72780493d1af881fe95f9f14f61b834f201ac1df16e5f252eb46b845306efc2b5365655d38b71c63155dbf8193e9a48623f64fd19ecf36a4205fb4ad26594bd2e6a81e3cee19aea80147d4ea2fc700c23395b0e411bf3342f050a09c357f114be21925492e2cb58564f5d666010c0f9e09cedc31 +Signature: 1bf8e80c8183d00907ce80e74989d84815db85dd1654a6d49f74c020a83e8bc931a178ce18056f57 +Test: Verify +Message: c4aaf1632b1438752e9790c89cff4773932d3fab0ef710bcaf41794bcf5c0ccac49e1a3c7143dd2b1484e4e74cf6c4006925fd06f9702a8090276e2ad7e41b74d727a3378835c4ba9533efe5727efac4a14d073f4089b418d7ec8526605a8ed0987c65cc85a3471948dc893b254f41b7d0dd36cefafa057d1cc796b58374bfd7 +Signature: 5fa8964b471c76211e2743c4d993e793dfa7239dc84a19bb3fdad2162a8c98a2434c94213f3a163d +Test: Verify +Message: 739d44364282b7bc61c62188d07e0ef12b907960a740f1764ff8ed7981586c04a47ed0ef2b97fc7dcfa6adc508941762cd79c05f8d2aa15d6e037a06c5f676b7d6d40069cddbe4e0fc81aa18578030ed2d22860929cf0f1389d4d5159d762c2f82378b7a2067a73f62efd159b55a91e8c3248438714773f01704b57fffefc7c3 +Signature: 1b61d79c6b33e3c3394fff6efd641405652033690d7219da8475faaabce3e395bc720d70c60e12f0 +Test: Verify +Message: fc205229f11c877b617739d9ac191773c207ac714c5e2a061a917ad2cde4827ec628b5924eb8e19a06b4357a927d920e8171130580e8dfffc06f2ee5a4449a89af12a87faeed963b2291676cf0d72d984c7997f8e207ba96472924a5a0161f21915542a769b33e978b85e7681f20814bfb964d03ccb25404893674cb1954a87d +Signature: 283d55c038d4270e71ae39db618390f17675478b704764d1fe352550054076f4461eb6da6174dd17 +Test: Verify +Message: c343029ce5d70a70251b50cc5e784126dd65e35080940f450d5cf435d567c9ce8a9dd2cd5d5096c55ba95f2f0952f2b33f6490b642942d24259aef7f62e2ea29b4771bee372ca2d5c30c4428850421c1e0cfb2978323068acb1a3d6b5be34550f9a9d416acc3a637141ef8ce09e845e7787f400d7a99120eb5b4d611f8c051db +Signature: 0cdabb09213e0f09cf01e0329bba5661753950fc92e681173a6eb46c02d00224b50ebca62a248faa +Test: Verify +Message: 5e126ef683f3b61a39065574bece4ad82dbf4d34495f40cb899dd2b163717588ddb683795244ac758252a3adde0a0950126e9984d26a96a7e93b72c780ffbf60ac9d5b553cd8d831c1af2a9edef79426d13cd42942d48e204c45f611cadac252e3804f81d8e612c40dd5423e56cdc3d285e1561b31d400acc875b885d73854d5 +Signature: 01dde9613b9ce3c29b3503c19c13f863f27ab71bc0844476b3860ac891f9ce374aea6c24f517b8ab +Test: Verify +Message: f799a6b5a7bf7c32847fc243cbe0166f5244a377c43682c41b75530e6342174fade751e751885d10692e10858b11926ec626788fdfe925b2cd6d625272a13c899ce41e3c3ccc2f84e533ef6088840d9a6e448bf777e415a291c59ddb7b8d3cdcbca9450bde23ab67f0a6952c3bcf3fc944b6140502bc0a6d60983d00f69dcf1e +Signature: 0fc64023e095044c9d2d003a555e2da7aa5daf413896cd4e7ac774ecbaa0e4ece8e8ccfa053ab62e +Test: Verify +Message: ae0424ff8fb19e8842828a3cd51c93e1123e0c4ce9f9fbbc1b326979295be9ad7c6e6783d62b337ef8924e1b95a3f4aa77546a6af0d409e483ff8b89d422958fcdf0860912c47f45a819b36be047f0538a806ea6580bd83990bf99a6f6c2682cf98316c91df69796a80f50639082a093a5b9b139fb1580739a692b0769b47b3d +Signature: 6fbe751842e02a3fc3726a5d8298d1a7adb799a02d897597f4c459d28e9e25cf447b8cdf50001d21 +Test: Verify +Message: fc5837b228cd6c963b52cabd227cf61b5a1e6ccb4baff71ae4f971da7904bce5d94201efb3fc28912bfc9894b87c307a414f8653784e5fbe76056e3d989f51bf990fca68f0813aa36c00646a0e685fd5278fdce1b2af9a83f41726ed5212d82072180bb396339ce235b5a5dadb187b434335e50fb2aa9f829685108260354721 +Signature: 5bb80b35dad17648220dbe980a660effaddd7c43ad3584318e835c355dd7bf2f5510091389c42914 +Test: Verify +Message: 689eec3b665d72447abe64d4ddd79b7b73cd171bd22fa8689395e0a3d9793997205583d449fe912be240246ababb1859a5fdcdf48ce1d9ebb928ec58615503c073ced04ca0306948abf231ddf33e040b3e0ca7eac8816e218b872fa7d1ad67b9f841ab1c85ab52956d0c61a69f18b78ad5317a739dc6c102a2ea82084038bf7c +Signature: 3cb07367288036891a8861931e5b2104734a6e7e70ffaa32a49032b968805dd0bfc9f1989da22b12 +Test: Verify +Message: bc4828ec0810c7a43cbf028dced7a5890803681f86238a28f296aebeffc7f561a4fa5d6c9a595ab7193ab38eceb39fd220601f6ea5739efddffec8b93b7da7a74ba705014376fde4b375e33a844a57ea3583a43f56a55f9745723c4d287b34e82be7d584fb82e98183094b6be6b4052abd05ae6b92d0034d9d8cc550bdd8d27b +Signature: 67b214ed56ba44ced95d3d9e8c25c99331e3e973a3099e524473ccc8d4256f4ff7de9674a369cb57 +Test: Verify +PublicElement: 19b80e6f0132bd24dc0f26acc6a30445c4deb4fe7394440ce1ea0039d9c8137ec962e54b09d4383989baa288129e551e027477965ba1dbca0b6d586e482325f09a0fb16236d7b4ac3a3bb822a7a329aefeb91936f4b8cae38fd1e369db4f3f97421277533724d27e39248de3618a662c4b757cbbea2e3d805116d3e9d0ab3547 +Test: PublicKeyValid +Message: ceba9387e7ba8d55f8010aa2e8ed7de2c8310df67951e1c49c5fad18baf47dbbb571c2d26f779a79b8a564a07d9184252f097432728b0cda080212effcc3052612c8266e6f2bc88e85e6dafd42cab20679bd1b1d9038a27b6b001e0199237e4cbe37d81441ceaeca363d82728d8f9ebe7dc41d6c2b4f3ee19fcfea07e90c8364 +Signature: 84d8e940de14bfb65b8c0e0999e296a1d3c51f18b8bd79c57d826d9d200a6e38e52490722c6ee201 +Test: Verify +Message: 7b9058ef673b23e5b6a3d97784b898e0d912c990449be876b77b768da6443ba95b5fc1849db70e0482a4a1cf901aaf111b129e8dda38c3e2ccd758204a03c18b6d0500aea30b76a48c11dca21b0a82c9ea54c62bdd5bd71bfb8bacba897c3fbf68590f86b191d55c8ec285095ce2899fffb03983845a9eb9fe6f68749a082ddd +Signature: 7d07f3033c1c841466eeb641ad899ee247757ca067ab38f6f698ad0cce5f26517da7bc51b8e630fa +Test: Verify +Message: 2404a0e4c5ff8fa11c40f9932c8bfd3bac118eee53085c8e658cff857eb56b029ffa907876c65054f258a7fd07e01512bfd850df82a02820a65dbafb3a13d9380f01b9c3093ddd64a49044bcc994cf84d30cf602dd84accc4f2a8fc1a8eb55458ed173bc139c0f494aa028c80ade040a0166da50fdecc00a77aad8d16175b7a2 +Signature: 793e491940787f4e76495575616901c1c77d023342569cb8bc96efcfbc9746b3f51c31e29b221b02 +Test: Verify +Message: 5c311c167d2e3ebc19fbf7ab1c619d8ac1611152527a953d2137eaecc6fdaed79c13f4fa76f224bea7cf162531676a3a4c0a2ab81beba3f9aaa681222b122a8d724a5c77aef60aeb69df73eec3b384eceb157063dee88dce64dd72d4473b4fb2d6ee8de59bd3a61d5843465e48dea37894991aaa130a0b9246f3f659940ed61c +Signature: 7f76e9d084a9afd5c390271261b316cbd1095e710d1b7e4503188c99b8a8d851b130ad240e31f0c3 +Test: NotVerify +Message: 9dc221be2ab612b2ce6c7fc8b739af7fe740e9601f3201d3094a2444a488e076f52c7727ec7665e5949d2f307f0e6ed171e71c7a4cb21f9f3c661494239b5de7470e6d003a5553f80ae385b6aa3fef50a0803ca1f10d64264a93761e6f47a8e2e95e9c82ecc9f5a186361a930e434ab5cc05e10ce5b9e9218bc9e41b6203d81e +Signature: 332a2daa48681410763f13c3b127516c861bf1f187504d8b3bb1bd11ecbf9a9821f18466c10f1859 +Test: Verify +Message: e4354b9c9bd98d62fe629486b6856c96f34d2fa2460200c5c25746f454d32a065f8153049bdbe1b32ff4a8600de6aeeb8f7be7174f1f2f114c06893e3a9997492927596d5bc92a005f96f8417209c36316af59d9f41450e4eff0445b8a8e52ba7d7ed56e927b6060c59ffcc09bc5a313c33ffc80ecba5957e56deee2fc895471 +Signature: 65c2fd8a2635d6942b4b833682b29637eff64d80ac5ba18491bdc26d1c34d70a2c4b680900347d1d +Test: Verify +Message: a090ca3eecf8677a7699f42b16428445a3cbe74981efd6436d66620185469e959b9c8c0dbb464672fa136dff821ed7a2db6874b97bb5810691a9f1f30f22180df6d89abae633943ee56c08ee6fe88eb3bfd139c25df7c899e8e60e3d2647a3b3497cccbd8477a9d7cfdb9d71f657036ee83f0fdc3e6b01f60a559157e36e9781 +Signature: 19b4876e4043fe5f5a58e70b1560b0942ff4fdba842266a6653a6aa1550b91f4ba85a3b676a3659b +Test: Verify +Message: 8e2ecbfb35ae99dd004f2305cb2fe98c81edcccc13372e86b98f4e526d5dde4da43ae6fd4f7cdd8812fd0516c43107832767cf49e95faaaddb0e9f2a70ad0b1b790880ac1f05df022172b3a94f14d13f47ee2e5f70cf01d0341f19ef82ea805a832e51de9b61d7a3a346e89665f280175919a0e59f9e69463d5b757a9a2d7662 +Signature: 6d67367aa1caef2722c125a30e9e08ef7dad05a015893ec3c395c35d81944fe2db2a660e4e60913e +Test: Verify +Message: 6d3ba912c4bc10feb611e15965fe814bb2d5e5de67705a1ca46e8e6a8cb2e3243018f57abb7a698bdfe3f9c08012bd6aa033bc9f8bd9b351433f24b12ec0a3c3fe945c42e1cce9b6eb9153d4c099661686ea3a9b0ad3ff4131280800a2bd1b8ab125f7218fac27b8b092064d7d8a13863c73788a3c56d52344a051113ea1e3b1 +Signature: c56d1aa9f30790bec01fc07e5816fc6f44ab659898a959ecb061b4347e7f2be6f2df97ba33043a00 +Test: Verify +Message: cf2010dec81c60bbe408df2bf20f465d259a5a8d2f7920ce9c566318705c69950423f1281edf713f50ca8eda93cedbdc2378d6929d192081573efd7500520cc6799247edf3323e4849cd902aa013aa273daec49ea6741887fcd4657e987aa511e5450a467e6c3f7088ebdc3451342ad729141aca81e3807843f0944e712bab0c +Signature: a6640671721cb21d86265e30cabbc09ba20cf6081b4a5c7928ab3a53d4e291bf6049e8bf8418f6d6 +Test: Verify +Message: 4b00e4324ff7fbeb0fc48a6c83de82d52da1bcd1eb6669cffbe2bd824fc1d7971383f4b67d96d5bcd4b56e36c480d021e05d58e0788e197f9e93882773c267e1b725f38f919451289b143633316ed687fb131041b930d7064e0de47a10ac9a014f9e39b5232847a87b973c5b63e16d7f957d3aea43847cdd24092975bdb5496f +Signature: ab2f5b0d5237ec1b7e6297700a7c06647a526cb069c8162c513100008fe0dc37d4a8c9639ac94cb0 +Test: Verify +Message: 20f18b1eb4ccf98fa68c10d680f1536bd5c7c3307cb13ede0e3717afa213f74dc8b8f4fbc324ef020ce7335e03744baaf8a824495a9964d63ea00ace13a9467ca4ba9b264fc2337684a4822b81841f004c51dfdcf193333cfd77c4de3a184db0ad10b8f8ce3f7cc407da369470b88647c8d92d43b73864e942d37f388ff7c3c0 +Signature: ae23d943a56fc60ef381a2a5c056d24e472e9e906e4af1bcc91a27800b99b7cbbae8d4fc303ada82 +Test: Verify +Message: c9db3284c5b9a283f38da98655485939d5662045b325ccae3207df72838a1660f22634364f8814fe9f0eeeaa0483e9efea1ce25f74b37bca264268d6d3a3f6dcc986dc063cb347a7f08220db2b97a060dae317b302d8f86e6aec29e287518af0a8f2c32d62b153363ee0d650a2fe9744fdb3567a370e5a5458fdbbce770de953 +Signature: 06bd46f7ec091697c86e82497dc184139a988e3b9adee67ce3d87d739871fb1cdcef9dc6de421615 +Test: Verify +Message: e2e5fc81619b215141e12ea9544184e5ebabcb3834e96dbad2464fb5be7bd22c5dda0aade2be3d59e732a03147e04da33f3c8854c4f23330278e8fb0e76b356bd7de54e071a22c827987cb05d65708e8ac09bd43be2948d304874443881f84bd874852b1c421e6e52f3929bdb77eabcd6c68e29dda66a4bba189e807596fb93b +Signature: c86708f91828158b1c129e48ccc6adfdccf4997e8eb2214c24fd4bf4edd8ac1f3411d77ec65321c2 +Test: Verify +Message: b9a5127b9995a063f3422d3069a4b22ff9b7816e01ceeb3f933733f1fc11b3ca8f694d49b79c159a3ce93c59d555408befc452dabd54071181fd43d8196863b1cc0caa32568fee84335c841c298068b919cbb19e06233412662b7815a916da6408c501af8f2885196ed3dbf17cdf84af0c047632f5f4ca39dcfaa81fc5d370db +Signature: 0461b5dfdcfa1f9be6e7528478e2785903f0b8990f2354209554aeedd246d231567b06c5f81e0842 +Test: Verify +Message: 38da1e2a517a87304f85291a67e7a7ea0e637e797fa1a122707b58ac10845b7d44da2afe232eaf49b011171ad781edf4aab47992dc2358927eda5d5df9ffa75a4da2035389c484278aaa60b1f7630ef97d979e9a48935873c2929892904ee95dc9c7610279533c2256e7bcb9c1a4405100a5a367ba08d81db43bc322cb885adf +Signature: 3e7f697603dd770218ff55f027a8fc980763b6b9bbe84a766e0e55fc7c23e4f734d28f67fd73e14c +Test: Verify +Message: e431f4fc91ec6111098c5de4532c76bdd3ab9a42e92c6c10e7ccc69539a38f31cffdbe8dcedaaf3b78a3a68f592fa1bcb4f663332d94bd38b8811fc7c10f60a69da5cacb303a6af0e0159675bac3bf76e459782d43ebc7896c4dac0fd009f0f224a0306e0f06296a1858454ecee06722394bf4e88129223adda68528bf87d74c +Signature: 2b2111694dd96095c76bd18fbce8f720ddcffe6c8d9c194e880b0abfa44bcaee6b97addc84c519de +Test: NotVerify +Message: 2f3e3407e1c3e585d3f87ecdf8ee45321c8d46ed84410565c7e282c1ece573acc5c2bd688ba53416bb5894433070bfb782b7397b9edae229a653f2780b993a07e887996aa20bbd73be101bc203ad318fd18efbb7c0a3b4057c08cfc3e03535825167c0255d4ef73495f80c60a8fd1352c1ec85b822f6f59201da10baa310dbb2 +Signature: 88ed45212439c0cb86f513026b72002cdae6317544b95fcf4dd1eeaf460edb6f5891080272a3b31c +Test: Verify +Message: b3b7c629f3f5e85b35f7b95d9757a8dd980a2acc68fd9f1b74ee82af328cd5a62ad2ccce45a1b8625a9c3706f6499a066c6597cb1e88309f0afae3a298d4130ca25bb6a5c5994181e73dd00109b59a074e8a95794cfb65f993dd8be27cb2cb863409dea709155933f391dd4466d38058562f7ccd8c8f17a02850d267775fd58c +Signature: b2101fe80d5d71592eae972be0cb7f67e0fc2950bf60fb12b91a1a63d9f4747c1d92d2712cc33300 +Test: Verify +Message: cbf84e9aefa950d9c997dcb571a50e25c09c7ba40e730a1c28e112109621b4090b057b442c3e339a86ea07afc95fde5f4a37f765b99cc34e1fd5039d1b1122405d74d5336360f17273058c25da2b5807633f3c181a9d3483421d6ad294e09550bb5c93bf0ca6423b8affa46e1aa232f603cd8113a90e13958ad080057925c612 +Signature: bb80dfc840147d79654ed993f5266da74985e2225e7f5d61266fb1caa2deb06fa3bebd930122cfe4 +Test: Verify +Message: 3f1ba8edcc9ff1dfe2c25c860202f927af2188fe5bde071b8fef797c5f42f96c0d75001bfc94f37ed912f06a040adaec45b6a3ebac30d901c96974960d67de3f80c34456a5621cdaab73f788d5a9893b2bbaf68162185f7f09efad07f6609df7f0fb0cd59e8284a8b0dd08194c591dcbbb2519f7540fb04ca97bbc06f1a44d4d +Signature: 06c8b4f82b1e5429a07857ad5a1753f1d7cb43b345bd935a1f203ca2e69fcbd2321b295b1ed3c2a2 +Test: Verify +Message: d0b56cf1a2bf4845544090bc5440efaf864b8ba6205a03e5cbffac3af8d50d067f28988a7fe0ab7472b3c7aa8f8b0f5664350432b44c80168f65f0bfb07cd6e11b9f7e70f7d9ff2ca961766b33047f2bcbd0f458bf02e95a8932e8e22ebd69f6dc73953bc3823d8333a21597f8833546f374d1aefa5438c9f1be0b3c2970c05d +Signature: 035b9d105cbcce5d24fc186ff52ca07663ca774e057e6de4f5cba8df8b24cbd361df4878c6ebd3c8 +Test: Verify +Message: 82f8b357919acf5ac548e01bbe97782acc131a157d1b616364ff6dd32c5993d1dea9453a6f343e518e1ef301abc636554b632d368cdc7363f3ec8cb67e768e95e6260eb7354a491989ef9440274005b0c31b63ac0ef54c3081efa52d6939470433a8e745fa9346a94ff39b4e47ba3d31cb7495f11c1c44c2a54190b0055a1416 +Signature: a4e3cd2cbd2151d2033d0a56fa7d388af1e050efbc23bdd5fd17061234244d0a9511b84525e719bc +Test: Verify +Message: 5e5dc7a9fad7608fa377eee0d126a5377bfc0b9c11cd19b3b7f88f25c36c984f78fb9f2a05e3707bb99a933b88dae649c4ed794e143aaff1b911923d02b3764f0da5d244bf375b61064f62854e7b6fcc42371f85c57b3b562f891aaeccf5396c93f518cd23ea579b032f12941b2279186e71b4181aa7f63b91f7df51194718fd +Signature: a96a7dffb16216ec93857df38b10fc73c4792e61055a3d5c2aea3e5193113b7d0bfd81f6c3b0d01c +Test: NotVerify +Message: 9f8215298027d29e4128e75b86e6343bdebfd7f0f60bf417ff57c49a5ce1e14b9154d0be68c5cf6765ede1f56ca818eeb1af228be19217d68ef98202e01cad0b7a7f328eabf3bfebd6ca2999245ab4c968b4a13e52a6f96cd8ef99d0e1c17f8f347d5352a1aa39616e36d6fe04f1a104db476cc0a33e3210b4b022bab7c9ed0f +Signature: 7956b42cf6762bfa1d84425dbde83554a598caeb6e3298db6c225befa59a9840faab00f16b662ca5 +Test: Verify +Message: c196e14d01a2abd6dc046801d766e076cae2539afa2ab5597af92c35c4bbcd8f9378923503069f2dec6fb6c17ba1f7cc1355dd4363417607c881e2e9e5430ffe80b2b326a0258ad7e589d22f270c043a530cd480823f6bd35a23e357aaa804d2411c3d360f58e66c7f29b56314017e5942df2f698f7c0b56eab727964b4222a2 +Signature: caee28fd1cc548ceeb7141e3255c6043751425f2c344e1ddfe08ee2d42ae77391ed03f9baa195aef +Test: Verify +Message: 7d8df5288388272a7473d757c078a6de15994fe827c215d0bf2f6aa50701e1e2141c566cb5445bcd7b78e6b0098d399c9d0f12f5df541530eae276569803ebbc13a7d101997a9d488f4686b7c98b7130185c1c4f157c8fa42ebac032ee8a852891e5c0dec862c513c9950f659aa824129f39c5ee63735ba4a36f9e31a1cd889d +Signature: 75bb8dd4118b861c56c6a56bf00f194b9296bb677ea7ca4f5cda2855253f880473d5aaa8196c39b3 +Test: Verify +Message: fca73579a6d91eabb3401ed9b9145c2bc94a7066a85eba514a62046a95485bca536c2a5678659828970d253c9fce805fda30ab5527a0514a7783677b867b0325dbf979ae0303bc120947f3913a615a9717695ceb9ac1ef1cae1d2f29e9d33e6f8c655bd8bd4c41420307c22e0365a4aa790fbc80795849a0e84993cb36e8c482 +Signature: bb488822df803c1b8b424169ebc82e4638af6d567a7d2adfeaff0861631adc4c602a95a7ea8a0c00 +Test: Verify +Message: 2e5dd807911f65df6c7b71c9727137156df8fe02af3c1e19bb1d51cb35e43d4e07483eb5d5a1784ea46b1d41c6fefc66088c4b661f5bb5165044a710606dd893bb43179de8ba59472cc902617d20744eab2cd621ca4e26f8e2578299da47b24ca247faf8a0e41f815e8eb8617150b785acd1376a868c8878c94c799e7debe530 +Signature: 02bd342623b4f7cadbd88af72c8ccfb29f85042d4d2d6853d6a7769f2ed879fbed85cc6c7440fcd3 +Test: Verify +Message: fd149580b4d7b1e3799006d6c37974de79658e074d2d1cf4585ed124f7204986e569464099642cbde21cbaf5c16d0a01872dccde2f96bf81fef7711c599b37b0e6fa6fd3e71ff5c4d359e4ac36258e37cb5bbe53d7992d48c8ed42f90fc60e793a1d88d156e00510849ffb94da79f7987d49dcfffc0e5d60ef98bd52d07ac6f9 +Signature: 52c97e4fd456b9a2141afde95fc0ebf4ee2a509f274e31f5a6ee2730194eb09532d7c12583b2413f +Test: Verify +Message: d1197e08ba9f4654452e42783e664e3c7ad5cd9de2565149c0aa8d5a49547d576cb9d369da79a5da560856d33e91c2565b0cae7ae59e6ee7da31d891815469b93954b621879c168e5f4a8e84b313fd3d3a5989eb828b493039bc33dab88749e3d12200a9dac0f16afa2dc303b3a557e9b0f53668d1d5381b748477ad07a573ce +Signature: 41b31f1faac06a781ce424ab9ec6cff44f1e015bc7237a3019af5d73774a0b60345b6ed2293b7fa3 +Test: Verify +Message: 78cb9e8764eae88cc7bcfecb525617286955348da2e9c0958124677a7285334108c0ee2475d0b3404940d6806fb5f7c965c06166bbe3a9b7cfe18316c74be80acf4766af95a4c765011ce6b839e8cd90d58a139a60d675f60f42b421c570ae2647fac001bb7d5b5367e8e44da806d2d6324a03ff87db5ea9b9e0af75630dbfed +Signature: 62a367ef341b27a22c1ecb52dcfc34180902479129796872ce1b0cdbb678fcb0df10b1f37da5ac9f +Test: Verify +Message: f0e673b363e13da716f3288bf4b4993d6ff109e72a28529ce9453a2eb69b3d5256249ff7ebfdb3e3ea1d659040550e46c08d7979d03d3165552a0ee8db63ffa0097b19454508e148a35cd6ad14834226cc7d4371f3bc14f391e1a196b3b44be0e361f854c7fa5f0d18299399c635cd1469387e86eb9f947e74e20dee9785ba4a +Signature: bd8054b1502e66908555110fc569ac6ddccdea0285a04c81b9ed46ff160a26eedfeb4a8255147239 +Test: NotVerify +Message: dcbaca556bcbfcc70d2164b348b037467071dc423c11a549aad8d06716ddbee49668724899a84daebf96084efb29f246e7bb6ca967bba2ca82948bca7dde246039c4e8e8cfb593af694f197d6488e164a41f46c8364250b02d81af4cb6f2f9c67da6254d454c4860c3248e58bb277c395d7564bae2fe299263753405f972b7af +Signature: cc52d6498a412d0b801d243e37a0291644135294bb91fd182f3458c59e60725b21436a401d534497 +Test: Verify +Message: 901bc4215934ede2f6835d615c38953a95cd48bc09a249a30edcb412b37f5cd4c9ca75d433d383da706382886614579471a97647acaed5377f511241697fe0c90f42b735865abca8dd1beefcef86930267abe2fd143ef25c6f79e2b86a314a0e7b3ce23ee90271c35661f9b58ec721fc8f8ae2d6d88b768cf70c7e704dce721b +Signature: 69fe1c37cddc2db194719f80d9db24c60618f5e99cda4d645d1be7c3c4ba192c5d8606dc9c2cdc61 +Test: Verify +Message: e524024ea5f5ef7baaf30efbfadbffd9ca00ccd03d91c23a612e8d3c67ab933023239253c4417cb0d5cb934c7370c193d0d23a03e8d75417832da6766c1c605df090eb4a9966c1ea2cf68e45e0e28828e11f0bd305417ae4ce0b5283a0378fcf438243899cfb75ffa88e383cbacc0c6ef5fd7a970c68ea7839e1c8bb7c94d760 +Signature: 41bfc6a00915f9a7e24e0d4a7a1220aa0c0f3127b0286f8333c9b002a4acba9673717ffb09368caa +Test: Verify +PublicElement: 1dd203bc368c505fafbc02d560b4b9f003d93be0f78a11fe60e94c406890ce920be3fab9d9ffe84b80f3fdb9071dc602d7c8165fb62e346847b3918d450b3dcccb4bcff0ab98e3052ae36d1a65caa37c7187bb620c5147870ef676091f5199be871dce4fcda065da9f3568fa70edd637450acaa7e42f128b6a3a0519d86784d4 +Test: PublicKeyValid +Message: 691699d5c945a8508a41c3c83f768406a904e3bcad75c75e76becc40e67857f0435fd8d61f0b5f0b88ee6276718fcd2d60064b0b5ab7d48d0c5377f23b0c69936d174f80d968c95c8ca93f7bde7cef3914f2379e574c202fd5f12c1735af62774136970acfd2fefdf068f20e5cb403e31dc140ad7caac5fd298f84e6aeda5855 +Signature: 9c2687d271c475a3ca252997642f12c2494e6e1612ca7c28dcebefb178a72071de741a27699cbb58 +Test: Verify +Message: ad15c247a6d92417670bb015e2c56b2170d449feaea127d898600517e37d88639f43b0f80ecfd52cbf34e83deff0e860208fa308fb9eaf7463d2a87cdb79ab9c1a221341ed8973544dc5d405c0b530d9f5a72ff69a4b20af81d83b4bf47c151b560a65bbfbdff6a74915ec020fec3ba325746462458072a12ac8351de75dbef7 +Signature: 3edf3214d7492ead518c21641cdeeaf11955cf2c9fd41dd6990a3d93b5b996dc65b4480102910be6 +Test: Verify +Message: fe8aa91c3ff17c55cfeb6ca7d7934f00e1ea15bb63b4fb9d8a94f410486b559ea1eebfb131865289026c0f7e8d058e780e7be2ac0d9dca9929f91942283868ad3cbafa9c9872ef8a3303ade9dc1c8b9b7f11c0afb6ba8b5d9391a444ac07e4e2682730548a6eab50fbe91c60dc909d61cce2853b76c398e25f926e8def8f2136 +Signature: 454f59ad954b584350b19484ee93f3fac35e5a21025acec86b4d2cedb998a838f9c3d801acf7ff52 +Test: Verify +Message: 53bd313ad31f55de5bf21a35c1a6291bca8e6e0b206736489726884da107c1770fd273f10a707fe051af70d0b5521b5fd25d75280f9fb5f2d880aa1a1b0c5e3e0140ec2bee959f09bccb4cc633f7f2c0ccd08fb6a73645f0ca04aeae9c177ccea19f55c277a5eeb212dd66ed34aee5963080758bdf452099e34a4bdf1b405280 +Signature: 7408d817a92cce7b17409ca4a522ee8d2a05bc6ab21cfaa6c48819dde84f86090139f18c389ec906 +Test: Verify +Message: 8d67b965319d7ea31ecc8f7538b0042c8175e4de45b0eb7d869b9e3aaa918d1964cae8d5e05846f63261b131009ef5006f152a824c137f957c6c4a31a6f64d081e444b5c159fcc20004b2c5245f8ea982d862f1906fd9d9f98cd5beaca425e57954bf9b22a6ca8585f00199160b47c2c93410c5ccb69ded3b135ea1d706d573e +Signature: 3c2251163492bf6e777793020a5010959d84a258b28ebc211aeffb54f4f99500f88cf0b2eee180ca +Test: NotVerify +Message: 8fa0b50bd675f973a529cb90f5a7be4302794ed969f31dda80a16e0ef6efe2d1ac177399d350aec5463535a82a7374d6c4b7a3ae9ad7fd28cd3f3fe0b69e6363c0d29eba861297352d5bea7a031cddcd582561a29dcd4c60bc63d678b7d751a683a92d8727132c5c1172e11db8fb6fc2789b80cdaa2e841b03e52ced2ff12632 +Signature: 4d6e667824358fe066bf44377146bf2f5f2d92d2adc0aa673fc3912c3ae67bf8d0c529fb1c25776d +Test: Verify +Message: 17aeab19d1ee54e4aaaa66144a82f1a348dc53f8f1fa9d1b575c44389e580c5883f8315b2d14d83838b1b679009800f12b3a92c179c4638ad07e28f4836a475fe21900e908d0d6a0e0dc44097a339ed18d4c45d24c400f496e22f556789bffb54dca6dbbf95b2794bae667bb508aa4bb86cac22401a779d049ff035715250ad1 +Signature: 570867e6fd129769612e82d31a833ddfbb9a07833815df754b1db1c729e7a85fa4bee867dbcd42ce +Test: Verify +Message: cbdcecd18c9984a189ddd576261b6aebaf3030639731cd79ef7a3faa2af4b9420fa6bb84ff7f701d69624ccb8b73e6496ba1137f157444e81618224339ab687d81c300de67436173556028bd62eff59850f1896dc3611d9cc43c052476d28695174df4383a7f107c43f0a0a4232750af5539c98719900f6ef0fe20a65802cb60 +Signature: bed7f5866b9ec24dc7f0ec818262aa7a2197926c314a353cfdb5d11c7e57685ddc0c1863b7915521 +Test: Verify +Message: e8cac9ce0ef12933d72bb5ec654590ae24739b0b378f75d32293d3acb85902ef4791b9c603032484b0072f45944210c79ca21787cd9dba1feea5dcdf74ef5dabae66e81531eaf9bb86ce2de21390ce5347da9f760abae4ad641eb5f46c9385b6733feef2721cbf8eb27748fbbaa8e40b7d13c80fc55f0c35daf6f82078bd90c9 +Signature: 35dc7ce798a62cf86653c31306ee9dc5a8ffef2a8c086ebe25b001f990e5f511f780ad9d7eeed027 +Test: Verify +Message: 95f01262b79dfb8fc98a0217a661456a8b97042d6dd524499daae53a9a70e096377c44dcee8a528083671634dce0677820eb21640f14a2b4a22b8316e32c98b10f6f2af6e91073aa61a15b34660f722408d22e05d359666567b50e225c8434f655203c46620958279c914bb1fbc65e897ba4a2a96f7c697325a0fff6bb50ae7f +Signature: 9e75e572e76eca4859c954248a01d31921da32e371ecee37eb40aa9c13ca2e65961359e4466e9e72 +Test: Verify +Message: 64414cf10d118df7436add5cbd54ba23e8af55f7f79d44a22b1369ce64ba21fce90cb1c274acee4981062d07d9276ab859debca30814f90b5969a5f3bd1120176ced102775ed0d4604a58cc3f42e0e179540891fbf8d179a1760dde6a1763ef7861d4298288b41e66481d30a2620fd36330b94e333bff649fe2fea1e28a3d493 +Signature: 212c24985e37ee89e71cbe6d6012b89fa181db569227db91fc0b6f557f377e380cc56c271f7cb77f +Test: Verify +Message: 8dcf3f1d21a4d1e15238b6db0e89798e66cc62b60e7d0eee15a550a2e56b47387ddec07aee02cd471418a77a9733c21b22f82ec5e1b4365741a533dfe382b1c3e24cc6314659aecac89eab8ac93c1cfb8d4edc9abcf2de891b95067786844acd32b0091b21c2abc2e65f7be29bbdc1862066230e954c3edd1a0e8044c68a49af +Signature: 7add75db81ef8d210f6dad09da3d11381324430bc473f003495c0288a42fd93957dfa5321bdc3d82 +Test: Verify +Message: 0ee654428677f6fd59e6cdcd1406dae8f753dcbca966a88e1db8ab5abf9bbde6e47528287040f8dac93f865cfd023fca2f9dba5d4725fa07da6b004a57fc955a73595573d773007c096afddd9987309e8c78fdc10dca9de053aca00bcde3c3dc9508f5dc1409a41bf1e04c0a408d429ce85abe9d554f285260f3a4527b46e0a4 +Signature: ccfd740744131a05fbfebb26edf96572d3475d6441c042287c109e0aaa4e9db694d074889cb55dfc +Test: Verify +Message: 1a21fb1ded7d167c9a590c8bfc4abc10ab1aab159476b834d9d91e24ebb8aa84e5ee3ee72c6b87214519fbd2f70f1630a2fad519dec7735857966237e8db8d46f6d6cd6b0f36aa2bc4095337c4e7e03a3a60c6e268a29b2d846f0cf6d33e1cbf04b09fc1cf37f631ce010cd59b2b91c82b2376896b5ea94b193c1278e438ce87 +Signature: a07b8566ada6bbd54b5fc36b4a3b698cbf60c1ee912a5197ba6e98bd4777a884d6bc66022020de8f +Test: Verify +Message: ffc7c4abcca3dae4c21b311e6fb51da2262e53dd491ed515d6cd216d34549a1c40f836ea93c36aec17645380c949258bd0fbd9f2bfb9135727585115615a5a7e9a4ee6541f678a86eb60e72c6e8f14c4a04848af4675cce784732002a42f6c6c25812be108c8132956c74718f6c0c0c5adcff80a7689d93c05d5e62c960aa95e +Signature: 60b09ca0f393d3398635c5075d114429b6cdc8bcc7e66888f49148be9a9f96edc5014b106de6afe6 +Test: Verify +Message: 88fb1d5c4fe552db3d7213c906f74702fc102d41cfe636138ac123fbcbce5fe743319fd36e4eb8bc9355c0c7fe0c69b27de19a7c182f4e5016d0b2b82de57aff08e284e7ffdcb18c1217009826cbeba9843706ff8fe9d66ac64bf073fa7253cad02307f07927f625b1d10994f6cd87bd0b2aac23acab8638934a1485ab0ea11e +Signature: a4e8a3e21168f000ced52e3a35573fb6ba82eaa164813969ad388163d2cb861f472e7cbee985e0e1 +Test: Verify +Message: 4593c65d5e569a3d1369a916c8e6d4f541080dc192e7e51447745056d5b7bc1c404852c00e0d8b406d32f75ca06e4aecaf74a87f4fb7323a0f63d1efc598427c38e963670f15bcb7fa0451151f05a724c747141d49954caf37562916c8c4ba7a866c908a38e7445912d74d781b240055e078e8d457f9492b1646ef03b5b43ccd +Signature: 8c8e17b621fc67bbf36704f2356e7755d960fce3a52357c84b778376dcca9f92c91b9be575daf7b0 +Test: Verify +Message: 6180fb71de61a23cbe0d4383386e0170da515bbd67512b41ef03e0bc2d63fbdf257fc89ffe625fbb1d43da8c84efd80d6974322a1a0ffd4d1158c02753acf7bc0edbc8b2721304dacf0d6100f176f6efb9a0f8c8fd69b385a16cccc9f667b5ea52ed7141f14c8ab10cc1507638db532f012d232fc6384700d7977b39ce6c2f82 +Signature: 4156c005b5e099e4cae1d24a4ef35ae0749e4cdeade8929a74ef00f4f57e18c864ae6a376d8bdb55 +Test: Verify +Message: e52be63c5733b8e9860af61ee50f73e7f679522cd72f31af10ec93469c938e5b35d0b7a1e4f14b18c9039f442831caa9b659908b22ef92e4e617b4a54ffecf32ca7a981872e2d011d72fae3a11538a9306d9cbb7f8bf12de5291a710b3c625ab3b5f621816bea1ca48c4fb78b82f0b9b7e32d92a71560994ec9145ffe1a4e7c0 +Signature: b07e9d17a45cc2ceeb1fde1299ba0d6b3bcbe7dcc50e823d12ae5d86972fc6e21d499d38120d7638 +Test: Verify +Message: 1b223eeb3cebfc1575b37c5eba339ca55ab86c9300a64fcfe94d4f6467f1c06f9714190d5f060f84abb0f3b0e89d4db0c04abad218af03bd480d7fdd9afaab1405ab079e2a82334590d84ac71c0c7f85d4ccf76dd5a3e62992c4ec894f15b22edd7fc0789775a2b29dc33c7d5099697a0ed7db3b2f9b2f6c40084f3e7e590d15 +Signature: 199d5f32d2645a1d46ef1cb3ecb15a34eab59b9a8c3cbf5810966097bb9c280e812c22ac298e156a +Test: Verify +Message: 7296f7fd229c0893a84a5b7ee87a034416e5ae1edf1e7416d6c9df5f20213cf564aa2175ed32403f220e6aca2893e747d5d3f579d8999ed427a7bfd5aa2f55a1258f0be16b5102dcc163e0d790931baa504e87a3b1991ea00b501067089f0b498fbeccf8f4f1e7a55fbfd35d7a7239a55fcf7d55c0178eb2583eebcf936af626 +Signature: 5e2044f956599ab077c91e0f9f9408dfd3c458c61fe6edfab105b1f711919c0b43bbb7557252b193 +Test: Verify +Message: 7279097dcfe09b8615d3275b713dced645da08ef435fe783c5e888676fa3daad07bb933594886f78b6f4ab914530c28d2e9967f48ae5c398ff92f09d5c90b6c9702d850d2b42b355f89cf68d5aad25f4c5742ba5bfaa4c62372e9ca425b3bce164a8d81dcc67deb494a20066e60b6da3c4434b191a06f87c249482950362658e +Signature: c2b345d1c28a149215db60952dac2854103f0260bd4994a0b35394474ab82958d7ceb406f6285f4c +Test: Verify +Message: 7c9b50842db0de693441a2c13323de1369e251c07cd49c41877ff69b672d142642ce53805a0e28cd11b7ca313c491e8facd7e382fa241e9d93ffc8df05dcb67a89b4cac6d01e587f12aedb47558ed958fb5b14898f43f284d15c2f46ff47c1d866050b4c2a1947fa52df2dfc172ce9e86d273ccdd368f070584f82c8eea60bb7 +Signature: 363c61fe40b4c0a4f06908df5c46d8a9c98dee71cd1c56f8d7a16c081712cb1b8c92cfd00464a3e7 +Test: Verify +Message: 0bf43670b5fe01cb48e75a19b519f324451ccbb3d85d8ef15c41311b906aca6efb48ad5027e4cdbd23e951f538f47564ea1da4d133c6d4cbfba32151db0aadc1137db703c975faf58471481ae93f677fb48a2ceffaa5d6579d97ad7c1067dbdb4da98ae01349404c659777e04093804f9b7b9a63a5934e6e3a340df4a7180d96 +Signature: bbefc869907609019f4a85294aa854961e51c4884c235f4cdf85c4c3e0ff34069183ebf0ef50bb9f +Test: Verify +Message: 419ff761987d7257a0bc8817abb4077986972726e6ac93f311cab67ac91747fa7d021871b37f1bf8b082b55e6bbf4709b1a0fa099986cc7d2b44d82b4cd9ea5bec6e43f47490a9da6aafb38767d753e83bada47a5eacf6a59aa11758f665e4e6e7db1121b22a35b5253b19c7767542ce7bb7bcb10c972922b6da0b3aa1334e56 +Signature: 29becc5afb5ea31a71b4169b91f9594d0819de2d409e4c0c3bfe8e2ea53e98dc1ad4a72f3e3081b9 +Test: NotVerify +Message: 31c4c31942471dd6583810807472b62ce7cbbddbac7de47f08d7bb4b6024973f5adcd3f4380a4ea571fd227f9133a22a53829698fc88ba0dfa55746fbe58d6d0d687d43a4fd3c7ba4acb21afdd8f72542df89c8cc90553ee4989d8112713f619dd1e3d82407a7d2c1cfa87a8115f20c1ad84454ecbcca6382bc95dc6532eef31 +Signature: 3c999e56f7ba49e48cb72c76bb7848d4562aa96dbb8c5a3adc19533b00cb2a421fa107b0b956452d +Test: Verify +Message: 64a5d78514c2e26b011e7bca8ae480a2770cb50b03bb6fac29db817c30fb6bb87a68c225898ddb885288bb62c70e43f19f8198646850d15dd08ee5ad30d6d34b595e1395a4593dcb3493f8c98e4825055d454dc87f4249b1537e3067469c869e9cbda24d7cdf602d3f760876fa497fd5498facb15f492d9f4be23c238d05dbaa +Signature: c3a0e8c6df40bb4d672d2438f4f770c141054f1e0b6cd25a0f9d0de138d6c8eb028ae0b23dbd2720 +Test: Verify +Message: c4d9d647a62a699ce00ac9c55b2197a796fd1e8e2120f2d75a50cadf671a9c2c74a8f7db2ec5a549802e81058d1c95f6ee0e78c92ddce79e82f9a3f3cc088ad0d3a2f934bd6661c0ce4327a26402c2c432171036bca8f8da13df464ed36dc31f5a5f942b4a25d55741e07673d8ec556adaae9caec69f5ee387996dca72617e71 +Signature: 1145693d535af4e7b13ed5801c2539db279007dca94800d15c4f2d184c71cf793feab7e46c52121b +Test: Verify +Message: 9981198067ce9d394f53f1233ee06b86075ed7d61142c04f3e54fdcf1ea280f454bf5b76494113c6107a2ae89a76e78e1b356876bc2aeb0582f459257e5b145b368e022d539bdab38d2fae7cd490baa4c1d86b333c74b3b86edd8c25e995cbee1664275ddfd489399eea969746277b00d0c0f8c5e919b09eda88af89b7473ce2 +Signature: 57f2c2fd72f077ef67ceaf46d99753bf796a4712a018b08a786d4c40136256ac0a8618db7dd1eb28 +Test: Verify +Message: bfcbe3e18f4423b9f21b33fadb4763c2e4221126f11b6c79099e6bd9714008000a2fc249edda520144dcacf16c2e3929488e540ee82a03a65c92f723d2dcc6aff61967778bf8eefa46b98a94eb55bc45aaecd9c7bc6fc3d13a8ee4a53de46be03c61cb82a2f8703cae8bc4fa901362b1c2149a6aa440258f5b6a2a76ebae712c +Signature: 5c141ab2f4ee5a513c4ee7e9a5e770f294859b1f6551d44ed78029dbbebe181a73e2726f1b553022 +Test: Verify +Message: 839331e55e6928503c36c0530394dea50f46f78d7bd8fea1ae7894c02a136b4e91b3fbaff91869067196b42fd32e22fbcdf0eaab2b9023af6747ec9f73eddd7bc555ae1fa4e8260ab2844750ba97b8ddbc7773ec3705afc6b68310c09eb20d6f362fa22ef71038d316bad1ae500678c2f594e847386e7c60b6e157194499d4a4 +Signature: 0ad3d7f5ea209ad35ba4a0a17e16483c50f5e4953a692ea71730d7c5c4c13feed38ed90759aa2e86 +Test: Verify +Message: d4fdc830db8cef7540b6b3ab242cfe3bb59004a3f3c61b60a37cda1890fc7108093249ae98f9dcb7ffaad62b79e76dd72fa4fdfbf878e8355523aeadac5f4882c5ecc97583d638d5e309a8aa3a189925ab4a9348e7e601d129c14b6d7005381bff4383dd13bcbba6e4ec6081df583bfe229afee237aa1d0e156eecb05485f9a9 +Signature: 189c08e378bc9feb81891706f80a9fcd1f10725564e3814342937391e39f8830eaed6702b8579e3d +Test: NotVerify +Message: 3fb043ac04c26a1d06fa3f3638e0ab0a218b5a74c36243f4ce1278c606d02b44f1d1027ec6069c17931c6463adb495be5de08e2fc8de583e1f187513085bebd04d579130c4589a607e445f1e33d57110ee17df67f524c4b4fb1f150a896fa955aa3d8afbd6307bb12168c99fa4b957b72c29e45222aca00dba1eefe460827d8c +Signature: 65ab093718776e0b945e5fa24014468ee40422b3688c00beb21593dd4785c90b350e9471a5dff538 +Test: Verify +Message: 155f0682c1d481571fd2d93a6bd70e5e2a6fee3702270f03d7b40d9c2c65057eb8c6521448968747d5ebac49e5a4be9f270f616d49dce8061d4287b4ed6fd7c41c368bd6fef47163f9c3ac8fdce330317f657e209c19a2c1eeba6ace8858e86877072a609cc638c2c3b24fa3086c5d2d6cc7bde8b3b6344b80762c83b4f73082 +Signature: 90e0b86567a2b176a74a817d52009c2bb553eb9ac3694f997c5f70ca3936b6d57f1908868ffc7518 +Test: Verify +Message: 4b03e4a77dd910d51e6c170faa228f3d5c258c96bc44cc986a0d244629292ca62ff8277aab6d353e982bbc62c1e113c815e371812d0916c41ccdb83076a03043a38c651b6511796ba83933c18afdadf6abdc3ef6b6baaab230f6896280d0f50040f97801c37c3456e7cd54a31c2eb3bfb54bcc6c6e0de2583fc270536071d3d3 +Signature: 999adeab789df72dab3c86e115140d0dbb4905adbebe59a1995fbc73fc678a8ca89d7b6cb644569f +Test: Verify +Message: a59d6636f5dc1fbe82ec2df71a90657f5ccbbcf1af6e69157de03b45b42e3c227f53877942c96770d450b1f500fd64683e877e87aece219a56ace7e19d01823b07f9981733a1dea012aa7324697c7fc68a7e0c654fa524cb573b2c1a84f18074b52850eac17cbba7b4932a5e4d24eef1b84b1d62880ba9fff824c2ca63186f26 +Signature: 30f81281e18c995d53f02e6d04eb988bb0b8bd3f1af1a7c8447c704f06d7379dae2ccf95ec13edd9 +Test: NotVerify diff --git a/cryptopp/TestVectors/dsa_1363.txt b/cryptopp/TestVectors/dsa_1363.txt new file mode 100644 index 0000000..712e5ea --- /dev/null +++ b/cryptopp/TestVectors/dsa_1363.txt @@ -0,0 +1,553 @@ +AlgorithmType: Signature +Name: DSA-1363/EMSA1(SHA-1) +Source: generated by Wei Dai using Crypto++ 5.0 +KeyFormat: DER +Comment: 1024-bit DSA key +PrivateKey: \ + 3082014c0201003082012c06072a8648ce3804013082011f02818100bd670f79\ + b0cde98a84fd97e54d5d5c81525a016d222a3986dd7af3f32cde8a9f6564e43a\ + 559a0c9f8bad36cc25330548b347ac158a345631fa90f7b873c36effae2f7823\ + 227a3f580b5dd18304d5932751e743e922eebfbb4289c389d9019c36f96c6b81\ + fffbf20be062182104e3c4b7d02b872d9a21e0fb5f10ded64420951b021509b2\ + 940496d6d9a43bb7ec642c57b302e59b3a515502818100a1c379ba91fe1f9d52\ + 83807b809c698bce4aee6f405f4de8c46becf33c08a63bc5f8088f75b5b6bcfb\ + 0847ccbdee700e4e698652317bbd7a3056404c541136d7332c2b835ef0d1508e\ + f57b437de60675f20f75df0483f242ddeb57efacd180418790f4dec0a8250593\ + ba36f17316580d50db1383ea93a21247650a2e04af904d041702150355dc8843\ + 45c08fb399b23b161831e94dbe61571e +PublicKey: \ + 308201b73082012c06072a8648ce3804013082011f02818100bd670f79b0cde9\ + 8a84fd97e54d5d5c81525a016d222a3986dd7af3f32cde8a9f6564e43a559a0c\ + 9f8bad36cc25330548b347ac158a345631fa90f7b873c36effae2f7823227a3f\ + 580b5dd18304d5932751e743e922eebfbb4289c389d9019c36f96c6b81fffbf2\ + 0be062182104e3c4b7d02b872d9a21e0fb5f10ded64420951b021509b2940496\ + d6d9a43bb7ec642c57b302e59b3a515502818100a1c379ba91fe1f9d5283807b\ + 809c698bce4aee6f405f4de8c46becf33c08a63bc5f8088f75b5b6bcfb0847cc\ + bdee700e4e698652317bbd7a3056404c541136d7332c2b835ef0d1508ef57b43\ + 7de60675f20f75df0483f242ddeb57efacd180418790f4dec0a8250593ba36f1\ + 7316580d50db1383ea93a21247650a2e04af904d03818400028180255cf6b0a3\ + 3f80cab614eafd5f7b2a6d83b3eafe27cd97b77ae70c7b966707d823f0e6aaaa\ + 41dc005aaefd3a0c269e60a665d2642f5d631ff1a3b8701bc06be9c44ab7367f\ + 77fefeec4c5959cd07e50d74a05af60b059ad3fc75249ecf44774b88b46860d9\ + c3fa35d033bcfc7b0b2d48dc180d192d4918cddff4f7ebcdaaa198 +Test: KeyPairValidAndConsistent +Message: 66B92E1E2C44B80F7BFA +Signature: 06418D4F24A8059553951CA062BBD6E0833ED1745608E1158CA4B8F8FE1CD2AF087B5EEE08FCA0D7A63C +Test: Verify +Message: 973266BB0A492248082A +Signature: 02BA236FE800EECABB85698A76B5485865454B3016010755F0E1BF7CE26FB62BE4FD01141F5CA4144811 +Test: Verify +Message: 9A6D079ED0CA9D8B40E8 +Signature: 045BA3DB16E6B910DC89A2D26096625F757D62077D049886B85EBC7500884B4DDD1898BC52746C54F68D +Test: Verify +Message: AA34DCE67BCDAC927DA6 +Signature: 0835C94121313842ABF04D4960E711D1F0904612BC09840989EEAFF2071522B75957DEAC801574BD22EB +Test: Verify +Message: 4EDAC08816AFDBF284DA +Signature: 08E1574E5299C910694D17075136F41EBD558D1B1805CAA3B6E98DCCC3702F286E76BBD29435CA2CEA5C +Test: Verify +Message: D82F2E903230962B8174 +Signature: 0366F1AE94FD2CDEBA4EE879BB8923F0E49CFB921008E6A5C7457E88811D46DC7F297D6A96E909268244 +Test: Verify +Comment: 1025-bit DSA key +PrivateKey: \ + 3082014c0201003082012c06072a8648ce3804013082011f028181017310bf02\ + d70ef2cee45d1cc47ec8ce8cabdd6bf32a560975a42ef057bf9dfd553bc9368d\ + db154a55d855edaa755e69f511a4c69ba78571cc4b14ddbb0f32a4a9c56c2863\ + 05aa21ec4e35de7390747477b3bd574e7b87cbebde2f665703137a1172350ad2\ + f48a0884d076ada9db82f104e6b0ad86693cd4adbd0067639102fcf102150b39\ + 49dadf3196f08bca0606f06443afce2fb1d02f028181015f0f6d1729ef2af723\ + c00e36450a04c7e7681d65b74a6417a53b3eb6036989eff8e0ab11a7ec3ce234\ + 0b7c7a92e1a977aee52555c06c12c4cc28496ddc2598feeb7539ce90d3888e21\ + f61d7f14746cf67d9fed373afd97e2483700e300ed9da25e7200b363a4727ad2\ + 01194b36ea5f816cf83488c3e527d3a5515870d2da63d6041702150696b0f255\ + 468b7ac18e11632f208ca86383a46724 +PublicKey: \ + 308201b73082012c06072a8648ce3804013082011f028181017310bf02d70ef2\ + cee45d1cc47ec8ce8cabdd6bf32a560975a42ef057bf9dfd553bc9368ddb154a\ + 55d855edaa755e69f511a4c69ba78571cc4b14ddbb0f32a4a9c56c286305aa21\ + ec4e35de7390747477b3bd574e7b87cbebde2f665703137a1172350ad2f48a08\ + 84d076ada9db82f104e6b0ad86693cd4adbd0067639102fcf102150b3949dadf\ + 3196f08bca0606f06443afce2fb1d02f028181015f0f6d1729ef2af723c00e36\ + 450a04c7e7681d65b74a6417a53b3eb6036989eff8e0ab11a7ec3ce2340b7c7a\ + 92e1a977aee52555c06c12c4cc28496ddc2598feeb7539ce90d3888e21f61d7f\ + 14746cf67d9fed373afd97e2483700e300ed9da25e7200b363a4727ad201194b\ + 36ea5f816cf83488c3e527d3a5515870d2da63d60381840002818045bf83e62f\ + 50190374b23de5e4a1d0278e9e8e6c8335577d62e80662a380c206e326819c50\ + 82d321dfda1f905fa5a3ead9a2dc769885a27b1fd6a133185dc5a7876a76ab0a\ + 09fe02b7071a924169e4d2d2a67e67ed3628800134183b962c0b313463aa154e\ + 6437d644e025ab234e63d19c129842a61c5e5ea5a06466c858c81c +Test: KeyPairValidAndConsistent +Message: 2F585D0CE4FA1CD93880 +Signature: 0643ABF8D3C2F4BAB02CF79D698948A1A416BEC05D00F33CC3D41CA9117E6CD99E5DCBBD4425DA12E98E +Test: Verify +Message: 4F09A1F217B8393199EE +Signature: 052DE620B5628EECCF7C56410CAC2B72A5AD1B5A67072ABF369453BC28A386ACD5939C9985C09338FD03 +Test: Verify +Message: 03D7110A753B008A76A0 +Signature: 01D44D16B5FDFB8C39AACEA72391A889EECBFFB5E701EB8F46E4FAB96326F73E0CC698E1F66C32FE5C2E +Test: Verify +Message: 129F4781D417671F886D +Signature: 00CE142CE967BA951B9DE26DEFB5B341CB49247C1308515315449B5533ED469B6470C4E3A3751E35E7BB +Test: Verify +Message: 3E1594F559D1248D1112 +Signature: 07B192657E256B60567BF6EB399D8A2DE8FFF7AE8A031A655BEC911A82049155CDB4F2A76A8004AE646D +Test: Verify +Message: D6F0354F1B6B253B6997 +Signature: 07FE18E0C00F6AC3CBCB95874AB66A98E34DF74F37059178C920C5D13CE173B8D2832310B9587940F6D9 +Test: Verify +Comment: 1026-bit DSA key +PrivateKey: \ + 3082014c0201003082012c06072a8648ce3804013082011f0281810250988282\ + 17d00108030801e5f135fc6fd3010be39e49060a96addc8a081198803402c4b4\ + 6e4ce0750fcbab8cf084c7ca8cae09f1b5482d336fa3af47b96791d02d8143e2\ + 74b1325f2213e17f9384c805f479e52a3117cf84869d395f1bc025c918484478\ + d2da1880d32bc519f4e6b2fd2d46958795550ce1765f725626f3fc17021536bb\ + 68cd95dab195f14c4534283e7ea50b00cc31a302818100e2782ad6992f4b7e88\ + 787b4d616744b60e095575a177569c4a069e311e38b7240c43343367e23574c3\ + 0e4d9f05afe1fbe61423bab715915c4ccf28aa0ed2f52b092b86c8ec1f9d4795\ + d6e91c88ba41297625c11a9e1f4f182da13cf51e541038a1266bf32b2dd81ecd\ + 84bb80be8fdf97689942e944b7fbb6981e00cd680ee25f041702152db270c284\ + 328353f979cad99f4133c53acaa6ee71 +PublicKey: \ + 308201b83082012c06072a8648ce3804013082011f028181025098828217d001\ + 08030801e5f135fc6fd3010be39e49060a96addc8a081198803402c4b46e4ce0\ + 750fcbab8cf084c7ca8cae09f1b5482d336fa3af47b96791d02d8143e274b132\ + 5f2213e17f9384c805f479e52a3117cf84869d395f1bc025c918484478d2da18\ + 80d32bc519f4e6b2fd2d46958795550ce1765f725626f3fc17021536bb68cd95\ + dab195f14c4534283e7ea50b00cc31a302818100e2782ad6992f4b7e88787b4d\ + 616744b60e095575a177569c4a069e311e38b7240c43343367e23574c30e4d9f\ + 05afe1fbe61423bab715915c4ccf28aa0ed2f52b092b86c8ec1f9d4795d6e91c\ + 88ba41297625c11a9e1f4f182da13cf51e541038a1266bf32b2dd81ecd84bb80\ + be8fdf97689942e944b7fbb6981e00cd680ee25f038185000281810179b283f6\ + 7868aeded3a0c5633d0e6c18fad77174e2c89c03452593d05e77a9fb029c0ccb\ + 2b6f2328e79c286ee392713f12d9d45578348383b81d11b0e0f7e89965a7785d\ + 5ab64ea25bb73e8acaa8e84cb9897985015757a48c0b1dac3a6a606fe671ea07\ + 3ec434a46f227b8d4b02a46fbba2f6c6216736d669f55778d81004d8 +Test: KeyPairValidAndConsistent +Message: 7E4F2ED4E79062778A2D +Signature: 03DF91D560884BAA90258F0F78A7AB61F9A4A5CF3D363E8DE2EAAB389B9492C2B80C44509BF2372BDEE0 +Test: Verify +Message: A0E35846B5CF1B5BF560 +Signature: 21DF9C60877B6D7F531AAF1C39122779436029685109B2D736A45F51A80099041AA5F118D7D6025AD30E +Test: Verify +Message: 3B138785EFC6F520EAE0 +Signature: 10A38520BAC07202DD1CB5A9C88B15B9579B9A1344025E4C4B9D1BC3AAA8C97AA90121D52E42E59A0A99 +Test: Verify +Message: 0F6BE2AA764B485145D4 +Signature: 0233267173F284737B68D15A500D23F3C86988E3DB28DD55AE3DFEAAA7251D354CB44315D6024CBE3E36 +Test: Verify +Message: 6CD9FBD23EA58826FB04 +Signature: 15A1B0DDA6BDB62D96AC557E3F1F24DCAD0C51EF3523B01EA2A8FD93761D0E4D070BA6352A81F31B776A +Test: Verify +Message: 473A82649565109E9E89 +Signature: 1FE31C3A3EF6F57DE2586A5F2EBD48A5C707092D230E1D217EE0A752EFD9ACA8BF0B9EE9424184B8F8F2 +Test: Verify +Comment: 1027-bit DSA key +PrivateKey: \ + 3082014c0201003082012c06072a8648ce3804013082011f028181055402a8ab\ + e9cda3072ca8601d68032651feb0335856e57f8f8d4ec949098a6459151cefee\ + f91b7aa733668c8cf0e9b96c93c61f3528d4036daa6565646f65d74c4552817d\ + f7e5fb1cc421cfd885e27bb811ad227e81b3fa02f7a00bf01ee6e23fb5572a75\ + f8f29b58bd5f7db435e8a92a923f15d50f34213d29816921bf195b2d0215291d\ + 0ba731a4303070504d8b9615640a5e1345e00f028181051c9d0270b69ceef82a\ + f5aed5f91dc88d585096609d835d03d39cf3ce74f5a3402d4e8e192455493da6\ + 1cc58ee6f54dd941172be3d7642169cbc52273f4b725f1d6c820c3333336c64d\ + 32fb6238121b3ccb7c71b847764946bb0887a44ca9de802cda62efa9dda57375\ + 1084225353f11ed837f3dc25de8374b6fdbfb6e313e46d0417021513b27094d9\ + a5a3a9704cebdbe890da325fa26ad555 +PublicKey: \ + 308201b83082012c06072a8648ce3804013082011f028181055402a8abe9cda3\ + 072ca8601d68032651feb0335856e57f8f8d4ec949098a6459151cefeef91b7a\ + a733668c8cf0e9b96c93c61f3528d4036daa6565646f65d74c4552817df7e5fb\ + 1cc421cfd885e27bb811ad227e81b3fa02f7a00bf01ee6e23fb5572a75f8f29b\ + 58bd5f7db435e8a92a923f15d50f34213d29816921bf195b2d0215291d0ba731\ + a4303070504d8b9615640a5e1345e00f028181051c9d0270b69ceef82af5aed5\ + f91dc88d585096609d835d03d39cf3ce74f5a3402d4e8e192455493da61cc58e\ + e6f54dd941172be3d7642169cbc52273f4b725f1d6c820c3333336c64d32fb62\ + 38121b3ccb7c71b847764946bb0887a44ca9de802cda62efa9dda57375108422\ + 5353f11ed837f3dc25de8374b6fdbfb6e313e46d0381850002818103b06b9909\ + 7cd7145c7d7782b02e247a4741f3c7f39233627f17e13ebff89a18cad6a454c3\ + f32f7ef2910384030da71ae47e1c3fa79c2141dad107f8e715e47fb0bb626baa\ + fc35db769852ebbec2d339c3c3d5f2287cfdd20b3b78ea4607086c42558ae463\ + 7eddd6a74bc1072d0f34d9c0130cbc9e84f537e7ce50df502d17b5c3 +Test: KeyPairValidAndConsistent +Message: AE6DCD9535AEEE3ECC89 +Signature: 1BB090DC4573AA79F34181020C4D5B582BBA67062C23E5DD6913CE91482A05716784BA680F7F4AC1684B +Test: Verify +Message: C83A14EAC016D659F9FE +Signature: 182AC27BC4B77B145BF90E73A2CEEC5325941507F925279DF5B6280664CE82248348C3EDC59DCD428B64 +Test: Verify +Message: 745E02041EB487D16CE6 +Signature: 13C4F9AC03EA094CF7F60B96CAAA29053706E93DEC1024EAA1606E13B2C3062F2D6082846D29E6E60829 +Test: Verify +Message: 62F019655A83501FC4E7 +Signature: 077E19089B0BB32A7B21B0D27218C6E1F14AD432181BB76FF5E7EC35EC01CA47595F4C7ABB8ABD6064A9 +Test: Verify +Message: 351D37A4B5046E885EAA +Signature: 21962B09FF030A41251AD592F8D2AF24144B3AC713245AF18BE28F192FD29326D91F12A76A01477C8788 +Test: Verify +Message: 4073D33915F595F4FF9D +Signature: 1F4CF158E806AFE59139E2A9840BCEF79237800C521E49B7DBDF9830C86E7653FC716B43224EA00C883F +Test: Verify +Comment: 1028-bit DSA key +PrivateKey: \ + 3082014c0201003082012c06072a8648ce3804013082011f0281810abdeff64b\ + 6f28256e4562109bffed29cb5aa95d89cc0ec95da0e773dbff3467c271bbb1e1\ + fbb6af058517fdacdf26b5919674c625eced6317d8631c063f43b3ade2cd633d\ + 554913339071d6ebed5fd665fc5dd7d47b80721a976c3b14fbd253f0f988c354\ + 725289f2897df0a15985c92b2d4da8d087870c251c72d979b8304d5102152368\ + e2b864b250ad45406391e7eeaa3d27cd053c2b02818107c325695dfe315a77ad\ + 7b42f0d18f9d4821b5c153fee7385877602fa54477bb8c0639d2438f34352b97\ + c22d02a7295d2b53d5286a01caa919d6283614690624240af922675ccd4a0534\ + ec336cb79cde31b02b5988cc5a53ca17790d67d803a27bb927b9c59bdc6ac794\ + 175e285cafdece6778ab19a0b444747fee20d5bf929e70041702150771305163\ + 506b2b83bd5279935df1b5fcf180b004 +PublicKey: \ + 308201b83082012c06072a8648ce3804013082011f0281810abdeff64b6f2825\ + 6e4562109bffed29cb5aa95d89cc0ec95da0e773dbff3467c271bbb1e1fbb6af\ + 058517fdacdf26b5919674c625eced6317d8631c063f43b3ade2cd633d554913\ + 339071d6ebed5fd665fc5dd7d47b80721a976c3b14fbd253f0f988c354725289\ + f2897df0a15985c92b2d4da8d087870c251c72d979b8304d5102152368e2b864\ + b250ad45406391e7eeaa3d27cd053c2b02818107c325695dfe315a77ad7b42f0\ + d18f9d4821b5c153fee7385877602fa54477bb8c0639d2438f34352b97c22d02\ + a7295d2b53d5286a01caa919d6283614690624240af922675ccd4a0534ec336c\ + b79cde31b02b5988cc5a53ca17790d67d803a27bb927b9c59bdc6ac794175e28\ + 5cafdece6778ab19a0b444747fee20d5bf929e7003818500028181043e4ae624\ + 4408879264fe6b859b578218705b9a45af22efded27141b7f090cbcbe42dcf48\ + 1df3e41b13920ae02b694eaa6bfd62f2d3c5d677b8c4ce783cbe2789e088b044\ + 89ef535ad4a517351c8835cf128f7ec677a1b1dbe3ae9cc4198ddb6e1cef8e97\ + 8c0725f5063797bc43eb9ae496286cccbad5d4e026e9edb997d2f918 +Test: KeyPairValidAndConsistent +Message: 4867852C83F181CDD010 +Signature: 1D0F4F49AFA0448163604847C9308A824ECE928E05066D47892256DB725FCB31F93F38B9E02C71E100EE +Test: Verify +Message: DA6493C86D6B62C5961C +Signature: 1BB4A8A1B8D81EEE9AB291C49F688F27D2191EA51B15A5DA66A6367D931DAB338E595C80E70CEE4BB644 +Test: Verify +Message: AE2C1136BFE966794A6C +Signature: 02AFAB91234D08FCEC22E57AB5718FBF41A86D2469012F8476BFCF4EA4E03D9F7A6E467ABDD0B5626784 +Test: Verify +Message: B20160E0442E726BE749 +Signature: 140A45F4933F05807A533628962E42A8BEFAF5977917F2A8D8706B8BE83EE6B6CEBCC951553B4E3203B5 +Test: Verify +Message: 3638935C4492F5CA42F2 +Signature: 234F78EF68343E77710E17285E47994AB599F3646315C37B8CC01CF6BE9C803D6B81B232DE9171DA7967 +Test: Verify +Message: DFB674CA6E0FDC0CBE99 +Signature: 1DF9B1B9F78F5FCCCCC5F698EDDBC8EB28C0F4D10002A052284AA4FBA601D3047E3AA97F8CF73731A44B +Test: Verify +Comment: 1029-bit DSA key +PrivateKey: \ + 3082014c0201003082012c06072a8648ce3804013082011f0281811d0f176b67\ + 99b36724c92954c38d0288fa95400c2b14e064f76a6338fccaebca8d978b93bb\ + 76507bc150a50f9fe799fffe12ae2875b13ac1084ffcfde9f62b86185a72f04f\ + f80538d6eac177edc98d61a517b1275bcf4b57aa262e1702d623bc344db7e562\ + 1c949a9b12e9936e88fae9b200a1f8ad5b40ec8220aa301267f38dd702153357\ + 536531dec150be0ef8747f69ea30d987ff7df1028181067dd80dbc6b41f58d08\ + f077a9a3dcbfe12a62065fe6b4691c457f506b56dcab0433b3aad6ef96250163\ + 3d0f3947b491a1317e7e6b632f062c53104d609c9222b056f08a0c83662a7074\ + 4331fd09b2b42fb0768e52da27e92732106fbd41ec737373fd080b56b543d808\ + d49eeb6e1bb0a8619b1edee8fb8295dc042423f684af8a041702152dcdc00a86\ + ecc2a60ebfa6660a83af1d7c3e570b85 +PublicKey: \ + 308201b83082012c06072a8648ce3804013082011f0281811d0f176b6799b367\ + 24c92954c38d0288fa95400c2b14e064f76a6338fccaebca8d978b93bb76507b\ + c150a50f9fe799fffe12ae2875b13ac1084ffcfde9f62b86185a72f04ff80538\ + d6eac177edc98d61a517b1275bcf4b57aa262e1702d623bc344db7e5621c949a\ + 9b12e9936e88fae9b200a1f8ad5b40ec8220aa301267f38dd702153357536531\ + dec150be0ef8747f69ea30d987ff7df1028181067dd80dbc6b41f58d08f077a9\ + a3dcbfe12a62065fe6b4691c457f506b56dcab0433b3aad6ef962501633d0f39\ + 47b491a1317e7e6b632f062c53104d609c9222b056f08a0c83662a70744331fd\ + 09b2b42fb0768e52da27e92732106fbd41ec737373fd080b56b543d808d49eeb\ + 6e1bb0a8619b1edee8fb8295dc042423f684af8a0381850002818113834f0fa1\ + f42abf7dbd264cb7d2eb5798da8972df67f517c62d7ae5070fd588d61db62e49\ + 2f9654833e876ed5737df35069f5ee01a45de881d8f5e68ec52ad9ef32780e8c\ + 453a5f1e38cc17bc5cd061a3c122080f6e1b82d31877e8b08f634f497bd90b06\ + 824eaa0416c64104ce5622c272673d0dedb836ac7d47e0cea0673902 +Test: KeyPairValidAndConsistent +Message: 1E34034C47FE533F8FF5 +Signature: 04E171B845E602A871CD5DACA5738BC4585A452A86108D03D70C3D2D605FAE90DB8D339AADB692EB1ABE +Test: Verify +Message: 53D2CA23AF7DF95634F0 +Signature: 1327D4C32DFB874EA2104A9B30EAF288C7016146D1217C237E0201482E483EBC7F0A713748547F9B6B21 +Test: Verify +Message: 0F056E08AE77B3B30F33 +Signature: 1B4A688745F3D86B0D8A5D97FFA0E31C322EFAAD0A0FCD907B2D49EB8150539E81FF29341EC34440425C +Test: Verify +Message: F08C80E8FD38A3867B76 +Signature: 0972705B5E84A8BA57226C770CCB0ECDEBC816EA162FCB3BA5B3C235105EA75F379EE84187E27A86D21D +Test: Verify +Message: 6D392690B92B3E75020F +Signature: 185968475C67C936CB152F76E80EE22FB82A27ED120C5C0ADB2D750D2C38F0A9671EBFEC2815F675C24C +Test: Verify +Message: 10AE0E091A267641FACF +Signature: 1AC3C2010BFB10CA6889120A23F984FE0D4CF79D1B07578217E5A3C68EDF05006C1F3F1BFB3848E4ECE5 +Test: Verify +Comment: 1030-bit DSA key +PrivateKey: \ + 3082014c0201003082012c06072a8648ce3804013082011f0281812a32d68d31\ + 248024053bf628a94404b9a49d91ade4d7a45b071e93292a7f8c2661d9165f0a\ + b85491d4b0dc67d335fa7d7dd172cb17193390a55eb000aa97e2b8ed3ee64b73\ + aa43ea9b8979132c2d966ab03c42cc14782c96e4284ee1136b8515007ed1b1a5\ + 708b5e8d81304fa651edc715918e2299cfe9016dfec5f454d907f59f021527c7\ + 996c1d3729c4cf1de06529e5619771e27ad9eb0281810d87a4b01385da7f43b6\ + 277933c5f0dc8072dcacd5252e1b29f588114a7ac56e377050aa8174b5dda400\ + f043234e4a746442792734dc80274a00a3676101be94759fc2630b9a85896648\ + 8b12611d03d0b31e7243e124497a754544cee1db10bb0a81cf0b2a68045b76fe\ + 935f641c666fdc788a2b968c6668c669115756b961d9fe04170215091155581e\ + cb7a0a792ba95c772d9382298bfdfa6f +PublicKey: \ + 308201b83082012c06072a8648ce3804013082011f0281812a32d68d31248024\ + 053bf628a94404b9a49d91ade4d7a45b071e93292a7f8c2661d9165f0ab85491\ + d4b0dc67d335fa7d7dd172cb17193390a55eb000aa97e2b8ed3ee64b73aa43ea\ + 9b8979132c2d966ab03c42cc14782c96e4284ee1136b8515007ed1b1a5708b5e\ + 8d81304fa651edc715918e2299cfe9016dfec5f454d907f59f021527c7996c1d\ + 3729c4cf1de06529e5619771e27ad9eb0281810d87a4b01385da7f43b6277933\ + c5f0dc8072dcacd5252e1b29f588114a7ac56e377050aa8174b5dda400f04323\ + 4e4a746442792734dc80274a00a3676101be94759fc2630b9a858966488b1261\ + 1d03d0b31e7243e124497a754544cee1db10bb0a81cf0b2a68045b76fe935f64\ + 1c666fdc788a2b968c6668c669115756b961d9fe038185000281810d7d22c931\ + 422fc46505887559a51490c2e367cdb40242cdbaeb23024693fd5c68f6a3307c\ + a34b224457d5aa610b90eca3b39905481daaba7151318f09f974ad664546d14c\ + 87f797e38139ee1e07adba9c775e07b7f7b3edba87d886920d6b2cef5f084359\ + 566b0a3b8b940a65b9ad93fd7ccd1354cdcee3c43c6bd315180498ad +Test: KeyPairValidAndConsistent +Message: 23EEE1D0EA8950B8F322 +Signature: 1800356929B316D1E4FA886CAE0CAD56E32506522D0B8440BB7695D522F31CD87079BEA4CA9F18ED4288 +Test: Verify +Message: 13FA6F2816FB83190A21 +Signature: 207830C2DE87296BC39CD21630F26228F00CF60BC3150CBC82CFA9006534A6C5E354AA281C434A8C2077 +Test: Verify +Message: D071CCC0C6E4CAE82E5A +Signature: 054C9C0C30C6B73AAB9E54C11D4EFC82BD6E8680932501D78A58EE305930E72ACD3BB2565023455DEAEA +Test: Verify +Message: 22CE83F4803BF3EA2C48 +Signature: 07065A6F5C9A086CB83F2F113895730C1B2FE0DCD90FD6AA887B066D685D3DD6C3C0D95CB8C8A48FBFF1 +Test: Verify +Message: 7A927EC7BB9CA16C1B0A +Signature: 24BF344DC7B25F831428078AC0D929A72A29160B6205A1BD4B1B2C5BD8BEFCB650DE23652701DDD4F4EF +Test: Verify +Message: 9591B069993E10BC0B84 +Signature: 0E6E6BF91BBC9FB91FCD3CE32907F5B6AB5E88928C1E3BC92649EDFDFE672AFB654C765F2758DE4BD78F +Test: Verify +Comment: 1031-bit DSA key +PrivateKey: \ + 3082014c0201003082012c06072a8648ce3804013082011f0281814d58515f7b\ + 41c4fc87e4fcefe5cf6d84b2d74a9d6f498ae9605fcbf1c59217422001a272ef\ + 91dbd09e7af5ee54126dd4fc44bb1ed624d0dd5dafb984d52781140bba40600c\ + bd4752d2c32b43253efee57af6964c339570edb24195502e6d424b84bed65ac9\ + 8c6fc52ec90e40a525f1863a53f2fbe2a0a133342eff4337f26ceb93021526f8\ + 6a81a6bb530c2f9b63e3690e95a0894575f4450281811e24828adb4ebf2becdb\ + dcadf6706631293ad6566803d12479f04a7bb20b6086fe81df164f8bd02c5f41\ + 8c1140d143f11a71170b42d0753c952bfff951b9ca4204868375efaa4afad50b\ + 75787e41c5ab9ce8adcbccecd3716f350bb8aaeca9b6098bd0002d789e1f7db9\ + c19d9045499877b93ecb4e7c64808b742063bbecf60e29041702150e61a054ee\ + 6510734a80f67a54d8c4151c957ef16f +PublicKey: \ + 308201b83082012c06072a8648ce3804013082011f0281814d58515f7b41c4fc\ + 87e4fcefe5cf6d84b2d74a9d6f498ae9605fcbf1c59217422001a272ef91dbd0\ + 9e7af5ee54126dd4fc44bb1ed624d0dd5dafb984d52781140bba40600cbd4752\ + d2c32b43253efee57af6964c339570edb24195502e6d424b84bed65ac98c6fc5\ + 2ec90e40a525f1863a53f2fbe2a0a133342eff4337f26ceb93021526f86a81a6\ + bb530c2f9b63e3690e95a0894575f4450281811e24828adb4ebf2becdbdcadf6\ + 706631293ad6566803d12479f04a7bb20b6086fe81df164f8bd02c5f418c1140\ + d143f11a71170b42d0753c952bfff951b9ca4204868375efaa4afad50b75787e\ + 41c5ab9ce8adcbccecd3716f350bb8aaeca9b6098bd0002d789e1f7db9c19d90\ + 45499877b93ecb4e7c64808b742063bbecf60e290381850002818119b50f1eea\ + 45bfaa22352a38f3c3b86d6f670747ac2fd94359608e25f2bb9f602506bc3572\ + 45deeb4c3c702d435c557da4f4a9fd37330a75547c91681fdbb51f286adb498d\ + 1e489e89b2e6a4eb9ff30222c51fefbeac7435f629f536ac2d6b87664d80e5c9\ + 7398cf489a1d1ca217f7f21ea8e409f938378875cf5f528162e3bc07 +Test: KeyPairValidAndConsistent +Message: B4B3C8FBE82013228A21 +Signature: 0E08FE696A4C70B16A127CAE8C61E5B38B7A1F34402584D1F21F71016054E820E3B1BB866309D93A7DA5 +Test: Verify +Message: 17D2D18302173E2CE992 +Signature: 0203C3869E15F8847B58BD158CB746433AA05F201317C0541908ACD5EA78A02D1FAB79380619199CC5B8 +Test: Verify +Message: 8032AE177D6DF38C7E27 +Signature: 1F436F5BC73A3402221B539F1D7CCBD4C3AE948418216122809E062ACF5D6086546FCBB293B4C7510CBD +Test: Verify +Message: 768640A60A3C62E02428 +Signature: 0A5D52C534A9BF1175247538638077489537025975254955F8A96B0CA2E7985D5D6E3DD54EE298C90100 +Test: Verify +Message: B0999CA45B77ED63639D +Signature: 144DDD0C1BE6D96FC3AFFA240FCD6D2AD0748C848F0C8A25AE8AC2E55A38DE9DBBAFF90CF464547365E2 +Test: Verify +Message: 587EDB968FA82C12C930 +Signature: 01FC4F6F98898F3639E8D93E7C2E6F3945120AD19D15EA13EDC96BED7E73A7D5D161217F1C67F3048BE3 +Test: Verify +Comment: 1032-bit DSA key +PrivateKey: \ + 3082014e0201003082012e06072a8648ce3804013082012102818200d551680a\ + 62ebf98f0ed8930cc5b12de86d0a0c29a0d7e5524c24672a25428833f4c19ac8\ + 83ead22efcc0c6823f2e942c17adb7ab763ff2c7cc2698fa8b6448e514d4628b\ + 197721bdaec780e126ac80ac83f24fef5c154f7690ceba903748be5212e3180e\ + a718ca7a71a49dee939bf9bc5b7845c9648d074587ccd3724493b91f0902152e\ + 802b5369c3f1ddfa789bf8f2ad2e048ced3bf35502818200a9aebee7d29f90b0\ + 81afc4d496a6a78210e918bb57a8a21c5995586c0bf20f7a56bb10a97e05a3a7\ + 23e7db64612b12bb591b1fe7d2e46be8c96a7b2ce7c66076aeded938775ae222\ + 3900adaf52a93f52d62173c82d4b67388c85d4c1127e1edf4643cf09f5375b60\ + c19316c4f8f8fd7daea1d8b44a2d03e97c2741537f63d86b4a041702150f66e0\ + 4c5a75d3eac03d744e5432f23e3aea066a63 +PublicKey: \ + 308201ba3082012e06072a8648ce3804013082012102818200d551680a62ebf9\ + 8f0ed8930cc5b12de86d0a0c29a0d7e5524c24672a25428833f4c19ac883ead2\ + 2efcc0c6823f2e942c17adb7ab763ff2c7cc2698fa8b6448e514d4628b197721\ + bdaec780e126ac80ac83f24fef5c154f7690ceba903748be5212e3180ea718ca\ + 7a71a49dee939bf9bc5b7845c9648d074587ccd3724493b91f0902152e802b53\ + 69c3f1ddfa789bf8f2ad2e048ced3bf35502818200a9aebee7d29f90b081afc4\ + d496a6a78210e918bb57a8a21c5995586c0bf20f7a56bb10a97e05a3a723e7db\ + 64612b12bb591b1fe7d2e46be8c96a7b2ce7c66076aeded938775ae2223900ad\ + af52a93f52d62173c82d4b67388c85d4c1127e1edf4643cf09f5375b60c19316\ + c4f8f8fd7daea1d8b44a2d03e97c2741537f63d86b4a038185000281812640c1\ + 88055329f0b44aaf80f82f7fc7f0e421031834dfbd1fb6d6af6ab3e1c173c901\ + 370a4ce2793c1b88d12f764c58ff064905da9c5001f679c7508972f237bccca5\ + 6524787466a7c9c2d6bb6392963008ed1a3e4cf3b13e66086bce3a4ca04d8cab\ + cf0cadb4c403c7d02a858460d04350e730289cb5adf200b5fdf1198168b5 +Test: KeyPairValidAndConsistent +Message: 909068BEFFA43331FDC7 +Signature: 2CCCFF8A67073E5DF643B61A5AE7A5BC216FE267E713B9005F69797B44ECD33BA5DD87461B5C72C50390 +Test: Verify +Message: AC8AFC7A1D9105539E10 +Signature: 0A2BEB58D806EECDDCBD590EBE4AE5AE7BDA326EA0072ADB9FA6A6FEBF40488C80690A2B1DF141BACF91 +Test: Verify +Message: 310E40311BB3F77F9483 +Signature: 28726153B52FE75F1FAA4C97124EE042065D2C90B50B43F885FC45C42C3ED9BDC4EC2D36A2799A041C67 +Test: Verify +Message: 35455ABD53E6FB11ED9B +Signature: 15B3D6ACA9EAD5AA1501ED201335AF9B46657A4CBF00D19328018D82624D4BD9B22D645429B385DADBCA +Test: Verify +Message: 95FFA73B52F0D06A0C1E +Signature: 2904FA8F78B6DF0D15A08714C8F86B97532A9D13B617EC03F329DA20E42816CCF45DBACB432B1F5011C8 +Test: Verify +Message: 1E9934125DA6E9B4E975 +Signature: 1666A3B9DBE26F2AE3F9BF7CBF47989D87AF82F580147BEC8350E21D4DB0691074F63B85A3A7D8E82A8D +Test: Verify +Comment: 1536-bit DSA key +PrivateKey: \ + 308201d4020100308201b006072a8648ce380401308201a30281c100fada6e4b\ + ecef964a85caf9e129639a5616ac000dbac59bd50b84bc8d464114079c34c5b5\ + 8d7d40027faaf037c6a649c527cb002d3a716bdef62b6c94d7a47a8b65c2ebac\ + 05da09e40cdc417024cccba267a98f4eb69701a276b4f117662b566605c36054\ + e7f015d2e5f81331e5666ec17ebf71907788b40cbcea0f24aaffb029ef5c25c5\ + 5ae998f28a2ddb091d262c32ad324f4e64c7b4b50a19e9d92f6d8024188627cf\ + 5ce68674e7ec7da38fd6cf4ec29a6ce2f17e3188d8ef6b0e50d77d5b0219232c\ + f9bee9d56c8bd8252d1edb59d99c40cf32d07d9e5a48930281c100f028143e3f\ + 9d1317aafb814215ffda9c584da8943e96212c90a082c3d2f335e8a6b64d1c89\ + 0aa2224ebf158bec2b6fe6bad236417acd517a4907331e0be0dd0b801218ac27\ + 0acdd45579290be1b94bc418b8f82c651d82a19d2f0e1cbb0fbc0f054d95150a\ + f96f9a7488010787a799c544883ff76a4e3092f2ca9aa9000cecb88dda343c97\ + 2c8192a83820727b1945c1a270cf913ab932457e8e6e207d06cd0efdf265b762\ + b9fa15c9a14633af17204ba2b755ed1b3b421ac596a2a04e64be43041b02191d\ + 4cedc87d55eea31bd702139b90be08d58692a1f97628a01b +PublicKey: \ + 3082027c308201b006072a8648ce380401308201a30281c100fada6e4becef96\ + 4a85caf9e129639a5616ac000dbac59bd50b84bc8d464114079c34c5b58d7d40\ + 027faaf037c6a649c527cb002d3a716bdef62b6c94d7a47a8b65c2ebac05da09\ + e40cdc417024cccba267a98f4eb69701a276b4f117662b566605c36054e7f015\ + d2e5f81331e5666ec17ebf71907788b40cbcea0f24aaffb029ef5c25c55ae998\ + f28a2ddb091d262c32ad324f4e64c7b4b50a19e9d92f6d8024188627cf5ce686\ + 74e7ec7da38fd6cf4ec29a6ce2f17e3188d8ef6b0e50d77d5b0219232cf9bee9\ + d56c8bd8252d1edb59d99c40cf32d07d9e5a48930281c100f028143e3f9d1317\ + aafb814215ffda9c584da8943e96212c90a082c3d2f335e8a6b64d1c890aa222\ + 4ebf158bec2b6fe6bad236417acd517a4907331e0be0dd0b801218ac270acdd4\ + 5579290be1b94bc418b8f82c651d82a19d2f0e1cbb0fbc0f054d95150af96f9a\ + 7488010787a799c544883ff76a4e3092f2ca9aa9000cecb88dda343c972c8192\ + a83820727b1945c1a270cf913ab932457e8e6e207d06cd0efdf265b762b9fa15\ + c9a14633af17204ba2b755ed1b3b421ac596a2a04e64be430381c5000281c100\ + 819c8cedb9c014aa577e9046b90795accbebe81bef68b1b5c37c68cb357e1a5f\ + f92761bc26cb0953956b6c0aec05acfc9d1a27c50789793b13d9eaf2361760c9\ + 7a7d86e7d922f4809a5d2d01448e938190bbc24c150e03ef8305365ddbf5ca19\ + 6857314e3b3023f8ddc9d209bd7dad1ee763e7003fd1b0c53057d2e9acadd23a\ + a18f83d20143bc41a2dfa4a164c82621fc0f800052ec01bec7c99c66fe20ec57\ + 67e6fbbe8810cd5aa75eff3d8a4cb53e1259ebcfebcc2fcf21ba7f3589cd525a +Test: KeyPairValidAndConsistent +Message: 9F6DC301DF53FE22CAC0 +Signature: 15B22111FEFA4AC1E53F2FEC346559E3613BB94F7BB3E2B7551D8B982FA10C38E7F182834DFC7391155FFA42AB945A29E118 +Test: Verify +Message: 2D7B5B9A27EAB468331E +Signature: 029EEA97097FE926DD09821284BCA3F45750B1F8102380D20100596D914DBF6BEFBE1B7A938E3AA5D656B6FD99E8EEE7C606 +Test: Verify +Message: F552FCBBA04FFCCC5CB6 +Signature: 115DE3CC1553CD5E4D40CCED80146DB1D76C10D992AACBCBCB05375C5FDA9F65B9A19DF7E51E6A36A3F2830AEA433AFD4F8B +Test: Verify +Message: 0D52B894153A4BB74068 +Signature: 0F6B8CC28D82E22B9B87D62CFF5C7B2289BB2F8008C42F105B2322CF95BC6D443A9D89A292F482490D94693A44DDF7AC4BD3 +Test: Verify +Message: 294442E103CC0CBA32A6 +Signature: 0FBD8768A18C2B28CE95775AD734157C34C1C3961C1DBBAFDD0A3E92A312A7925AFC9F7F4760FB0C56B42A2042C6B8B37C0E +Test: Verify +Message: E993D8FE1E6F6C3914ED +Signature: 0559D66BAC906C607BBA769AAFEB93E9AEC55FDD4597E432870CDC8A3DF9778301A0B218C886F6B08A414C51BD2F8214201A +Test: Verify +Comment: 2048-bit DSA key +PrivateKey: \ + 3082025d0201003082023506072a8648ce3804013082022802820101009a0886\ + 5d2bc9e0cf03d2500b2a08402bb9dc953d5fcd73f04be61236efc0998a8f012f\ + 00e52f7a6e91e81b88a4c9f985a2da523cbe7caff08cae44963d2035eda72e1f\ + 31f82c8d64c86e686899d53c0200282f407ceb1507db480f1db223606a57466c\ + f60fe9fc5f7ea7d5fd82ed3ab2cf5e35491dfaef0aa2e10fbfa3cdfeb5ebf65e\ + 4dfc2837e1f6399db06cc2e0420c7b14a4c0d483b742ca58b31fec9f26a64e9b\ + fcaa82334e644f4b954e2a9c7eeae096b8864ecd223ead3bcf9e8c1f68f6678f\ + accdb7f26d8f33d8a5fb0cb156cc7daf4a96ec2b730c0d7f666d699f7345a37d\ + dc1ccdea6d8f439ddb23de04a941b246bc257b0aef544a8e868bc8444f021d03\ + f35f80fcd896f03eda9ff07f2e35295384c4f3b8f8c4821369ab541702820100\ + 75c5d8c8f72302d92be3bf486b8648330ff86954de5e6e83efef624a277574c1\ + 6757684d3874ee303fa08343fe82dae484e5dda6781280b434c4090044cc7ff9\ + b6e962594d3ca069815c0f0b6bfd25215a419420d0ef8a1595c6eb1b44a719b4\ + 0131081f75cc15cb09a5d5a029c8546230c30b4af2d4a9f4374c93a095c83b59\ + 4b1774d635d4aee965f1d094469f7bbf8bdc93216a6b8a6c5753b48962335bf2\ + 092aa583c897878c8a7ce61186b592b05d2aea710b673d5994cedb5f117fdb6b\ + 8ad4d89f443c4eb662b428a34a7522c69794cc0274f3eba837e90da86acbc707\ + 4ee3a0b029d970efa48b3d582b740ae0e585d175a5f63a385f8b6b8878b44e1a\ + 041f021d0212c34d3d17b96a899548ebf43bb886676acebd2f040f5b33a4e88d\ + 2d +PublicKey: \ + 308203423082023506072a8648ce3804013082022802820101009a08865d2bc9\ + e0cf03d2500b2a08402bb9dc953d5fcd73f04be61236efc0998a8f012f00e52f\ + 7a6e91e81b88a4c9f985a2da523cbe7caff08cae44963d2035eda72e1f31f82c\ + 8d64c86e686899d53c0200282f407ceb1507db480f1db223606a57466cf60fe9\ + fc5f7ea7d5fd82ed3ab2cf5e35491dfaef0aa2e10fbfa3cdfeb5ebf65e4dfc28\ + 37e1f6399db06cc2e0420c7b14a4c0d483b742ca58b31fec9f26a64e9bfcaa82\ + 334e644f4b954e2a9c7eeae096b8864ecd223ead3bcf9e8c1f68f6678faccdb7\ + f26d8f33d8a5fb0cb156cc7daf4a96ec2b730c0d7f666d699f7345a37ddc1ccd\ + ea6d8f439ddb23de04a941b246bc257b0aef544a8e868bc8444f021d03f35f80\ + fcd896f03eda9ff07f2e35295384c4f3b8f8c4821369ab54170282010075c5d8\ + c8f72302d92be3bf486b8648330ff86954de5e6e83efef624a277574c1675768\ + 4d3874ee303fa08343fe82dae484e5dda6781280b434c4090044cc7ff9b6e962\ + 594d3ca069815c0f0b6bfd25215a419420d0ef8a1595c6eb1b44a719b4013108\ + 1f75cc15cb09a5d5a029c8546230c30b4af2d4a9f4374c93a095c83b594b1774\ + d635d4aee965f1d094469f7bbf8bdc93216a6b8a6c5753b48962335bf2092aa5\ + 83c897878c8a7ce61186b592b05d2aea710b673d5994cedb5f117fdb6b8ad4d8\ + 9f443c4eb662b428a34a7522c69794cc0274f3eba837e90da86acbc7074ee3a0\ + b029d970efa48b3d582b740ae0e585d175a5f63a385f8b6b8878b44e1a038201\ + 050002820100267f9c3ff3ee3cbc0f9e94dc7e6837e1ff65175e967987b90b9a\ + ea7eef1de6e4c342bebb5dbd0c4e2f6514f2d487857a146dda6cfdbc8b56ed25\ + 4cd65754d84dd21a271cd15fc656274725643728b41ce3f0e6872b6dfb4c289e\ + 03f9b903880ce3d7d745dfbb641c8c42ec0bfb6951ca2611fd877c32248c9725\ + 2bdb42d7bd65ebc50653dff389526c546d1e6ebaf6bd8b3298c01935901b7efb\ + 288b78730d89fba7f46f2a642aee0dbc93aa29c190b201acf89d4f8ba28f3e3f\ + 54a1c5a48294dda908f904afb7db398682c809ce13abd49279221d5b40ad7621\ + 6bad7ca256d718d3552344c481b20da5aac3e637fb7edeaf7960b532ef761376\ + 489f02fa8c10 +Test: KeyPairValidAndConsistent +Message: 5F3914F7AE0F6C76D152 +Signature: 03D30B7EAADDCB384CECDBB7541DFE57187242C836A6C72AF6C2525E1A01DB97DF3F41156089162FAFC87361F2F28E55616A50633637FB13EFE3 +Test: Verify +Message: 769583D4E7EAD14C137A +Signature: 01DC2815FD4918B8D314526066A03AD6593C8CED9E1ED04252B1BBA59D019F1C965028DA88BF4DB35AEDBA2C3C963B7933E5C07C590EF78BDFA1 +Test: Verify +Message: 6441D5239F50C71DE0F5 +Signature: 013F6D395DE56832F72F17F7F7572BB6DD1C48BADCBDEA91F0A634486E034B617DA8F5AB5E6F78C691313F822C599B6400A0A119A5DA330C6830 +Test: Verify +Message: F1C2D4F7C3ECDF2C17B7 +Signature: 006441A8B3517613F950BC1C84504082C0C3EA10CC08DCC1DA22E05480036D78345B17244F0DE41DA8342AF3441489CF9880BAA01BF2745CAB3A +Test: Verify +Message: 752A1F2B8D9A717A882F +Signature: 0127027984402F5B8C7DB1B7666FFA787548E4200D26B9D3B20EA9B4370298A9BDC901F324844613E8B5F34F2BFE40D9E6513D0E207B5105A9B1 +Test: Verify +Message: 666DC6B1E871026EDE56 +Signature: 03E87B55A7E81318B6B7057C901F8E3DC564053C1EA08B1F1FD965453803F21C20CE7FCCF606FB1328EC987666E87AF16ABE6B42DB854BFAA019 +Test: Verify diff --git a/cryptopp/TestVectors/eax.txt b/cryptopp/TestVectors/eax.txt new file mode 100644 index 0000000..b6fe641 --- /dev/null +++ b/cryptopp/TestVectors/eax.txt @@ -0,0 +1,75 @@ +AlgorithmType: AuthenticatedSymmetricCipher +Name: AES/EAX +Source: http://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf +Plaintext: +Key: 233952DEE4D5ED5F9B9C6D6FF80FF478 +IV: 62EC67F9C3A4A407FCB2A8C49031A8B3 +Header: 6BFB914FD07EAE6B +Ciphertext: E037830E8389F27B025A2D6527E79D01 +Test: Encrypt +Plaintext: F7FB +Key: 91945D3F4DCBEE0BF45EF52255F095A4 +IV: BECAF043B0A23D843194BA972C66DEBD +Header: FA3BFD4806EB53FA +Ciphertext: 19DD5C4C9331049D0BDAB0277408F67967E5 +Test: Encrypt +Plaintext: 1A47CB4933 +Key: 01F74AD64077F2E704C0F60ADA3DD523 +IV: 70C3DB4F0D26368400A10ED05D2BFF5E +Header: 234A3463C1264AC6 +Ciphertext: D851D5BAE03A59F238A23E39199DC9266626C40F80 +Test: Encrypt +Plaintext: 481C9E39B1 +Key: D07CF6CBB7F313BDDE66B727AFD3C5E8 +IV: 8408DFFF3C1A2B1292DC199E46B7D617 +Header: 33CCE2EABFF5A79D +Ciphertext: 632A9D131AD4C168A4225D8E1FF755939974A7BEDE +Test: Encrypt +Plaintext: 40D0C07DA5E4 +Key: 35B6D0580005BBC12B0587124557D2C2 +IV: FDB6B06676EEDC5C61D74276E1F8E816 +Header: AEB96EAEBE2970E9 +Ciphertext: 071DFE16C675CB0677E536F73AFE6A14B74EE49844DD +Test: Encrypt +Plaintext: 4DE3B35C3FC039245BD1FB7D +Key: BD8E6E11475E60B268784C38C62FEB22 +IV: 6EAC5C93072D8E8513F750935E46DA1B +Header: D4482D1CA78DCE0F +Ciphertext: 835BB4F15D743E350E728414ABB8644FD6CCB86947C5E10590210A4F +Test: Encrypt +Plaintext: 8B0A79306C9CE7ED99DAE4F87F8DD61636 +Key: 7C77D6E813BED5AC98BAA417477A2E7D +IV: 1A8C98DCD73D38393B2BF1569DEEFC19 +Header: 65D2017990D62528 +Ciphertext: 02083E3979DA014812F59F11D52630DA30137327D10649B0AA6E1C181DB617D7F2 +Test: Encrypt +Plaintext: 1BDA122BCE8A8DBAF1877D962B8592DD2D56 +Key: 5FFF20CAFAB119CA2FC73549E20F5B0D +IV: DDE59B97D722156D4D9AFF2BC7559826 +Header: 54B9F04E6A09189A +Ciphertext: 2EC47B2C4954A489AFC7BA4897EDCDAE8CC33B60450599BD02C96382902AEF7F832A +Test: Encrypt +Plaintext: 6CF36720872B8513F6EAB1A8A44438D5EF11 +Key: A4A4782BCFFD3EC5E7EF6D8C34A56123 +IV: B781FCF2F75FA5A8DE97A9CA48E522EC +Header: 899A175897561D7E +Ciphertext: 0DE18FD0FDD91E7AF19F1D8EE8733938B1E8E7F6D2231618102FDB7FE55FF1991700 +Test: Encrypt +Plaintext: CA40D7446E545FFAED3BD12A740A659FFBBB3CEAB7 +Key: 8395FCF1E95BEBD697BD010BC766AAC3 +IV: 22E7ADD93CFC6393C57EC0B3C17D6B44 +Header: 126735FCC320D25A +Ciphertext: CB8920F87A6C75CFF39627B56E3ED197C552D295A7CFC46AFC253B4652B1AF3795B124AB6E +Test: Encrypt +Plaintext: CA40D7446E545FFAED3BD12A740A659FFBBB3CEAB7 +Key: 8395FCF1E95BEBD697BD010BC766AAC3 +IV: 22E7ADD93CFC6393C57EC0B3C17D6B44 +Header: 126735FCC320D25A +Ciphertext: CB8920F87A6C75CFF39627B56E3ED197C552D295A7CFC46AFC253B4652B1AF3795B124AB6E +Test: Encrypt +Plaintext: CA40D7446E545FFAED3BD12A740A659FFBBB3CEAB7 +Key: 8395FCF1E95BEBD697BD010BC766AAC3 +IV: 22E7ADD93CFC6393C57EC0B3C17D6B44 +Header: 126735FCC320D25A +Ciphertext: 0B8920F87A6C75CFF39627B56E3ED197C552D295A7CFC46AFC253B4652B1AF3795B124AB6E +Test: NotVerify diff --git a/cryptopp/TestVectors/esign.txt b/cryptopp/TestVectors/esign.txt new file mode 100644 index 0000000..6370671 --- /dev/null +++ b/cryptopp/TestVectors/esign.txt @@ -0,0 +1,93 @@ +AlgorithmType: Signature +Name: ESIGN/EMSA5-MGF1(SHA-1) +Source: Crypto++ 5.0 test vectors, generated by Wei Dai +Comment: 1536-bit key +KeyFormat: DER +PrivateKey: \ + 3082014D0281C100E2A6788AB3CC986AEC06C51690143D3677141645D0628165EE924B9AFB7E6EDD\ + 52D90145B2F6031522C7A6CEC05E358F42B7837DACEA589F868F8DCA1C0F5FD8E5EDB8BBBAFCFF6D\ + 64CFCFBE68F46FBA6EFF45BC9D0CBB4F7F6075F5FFC2049C2F304B51C417764E18D182926E02D411\ + 6CE5C5C010E3D0AA6872A49B0D1FF4B37D54689C31F5821D04E9D4DB34D7536EE7F88B8C481B0EC1\ + F93193A0B70567E6FD76E9FAC4F67BB47DACD356D0C8015261E068DDF8C34C0CAFCF3FA775577FEB\ + 020120024100FAF0F292EE96D4F449024F86C0A104E0633C722586EC00AD33E0234629825D2081BA\ + 337597889CAC55DC6BEBDD8F13FE3AA2133D6371601A37D195DA7BC45EF3024100EBE16F88887A42\ + 5AA08E271467CC2220DC44012AB24ED4FF3512A96E8CB600C8BBCB771459FF0EE63D4B6786952A83\ + A7143A775073F0A1D69B6D0B5817755673 +PublicKey: \ + 3081C70281C100E2A6788AB3CC986AEC06C51690143D3677141645D0628165EE924B9AFB7E6EDD52\ + D90145B2F6031522C7A6CEC05E358F42B7837DACEA589F868F8DCA1C0F5FD8E5EDB8BBBAFCFF6D64\ + CFCFBE68F46FBA6EFF45BC9D0CBB4F7F6075F5FFC2049C2F304B51C417764E18D182926E02D4116C\ + E5C5C010E3D0AA6872A49B0D1FF4B37D54689C31F5821D04E9D4DB34D7536EE7F88B8C481B0EC1F9\ + 3193A0B70567E6FD76E9FAC4F67BB47DACD356D0C8015261E068DDF8C34C0CAFCF3FA775577FEB02\ + 0120 +Test: KeyPairValidAndConsistent +Message: "test" +Signature: \ + A3E32065DEDAE7EC05C1BFCD25797D99CDD5739D9DF3A4AA9AA45AC8233D0D37FEBC763FF184F659\ + 14914F0C341BAE9A5C2E2E38087877CBDC3C7EA034445B0F67D9352A79471A523771DB1267C1B6C6\ + 6673B3402ED6F21A840AB67B0FEB8B88AB33DDE4832190632D512AB16FABA75CFD7799F2E1EF671A\ + 7402370EED0A06ADF41565B8E1D145AE3919B4FF5DF1457BE0FE72ED11928F61414F0200F2766F7C\ + 79A2E552205D975EFE39AE2110FB35F480814113DDE85FCA1E4FF89BB268FB28 +Test: Verify +Message: "test1" +Test: NotVerify + +AlgorithmType: Signature +Name: ESIGN/EMSA5-MGF1(SHA-1) +Source: http://www.nttmcl.com/sec/Esign/esign_emsa5_data_ntt.txt, \ + ESIGN ( IFSSA-ESIGN-EMSA5 ) Test Vector No.1-3 ( 1152 bits ) +KeyFormat: Component +Prime1: ec8b4bdc9a56ae7b60619814ec45d617246063b5aac39c286f7c82ec2824c245001b678217a7cf178979c7270eb510db +Prime2: e7b1c3ae3494d0ac7b6868a53a5fe3ba19471437c54b25699e8c348a003e5e1d4c6d244d4f6a78f260c98fc54795a6a3 +Modulus: c5d0b8fac0cc6acc9d52c61200b541f7b4f8ff9f1bda97e0ebf78a3df768ba70ade59306d6ae65655bff7c6a94518c91e43dc0003b6f8730acc244799bdacb1e5070c6ea3089ea83bd5ef0a533adf3d9d63c0e88ce74545cfb21213fc33813fd913c6a6cf84b5adabc7d74751e9945521ac76a790bba95ad48d9d3fb2fbc4b0ed2ddee7d5ea6aa61633eccdac6381fab +PublicExponent: 0400 +Test: KeyPairValidAndConsistent +Message: 86f28c1cb5e640548309b85dc6e64c1a +Signature: 348dc9a0943b1e2ba7ef501cbe970a023b37ca4019b9a5cb35ffc3bcdb28dcbd4193d7817d418bbaf291d97a1eeb918a03ee65caa7ad26c24f9ef807c8798ade5b70d7328cd36ac0844bf63f511bb63067e8236d084cf8af68e88155ea94b978aab6bd0339c55d976434423fc779d549779e81f528d028c7343e060544410e528814fb0874417d1eedf38d6db4b97dd6 +Test: Verify +Message: 2fd87bfa6c8a965c9e1aaa8e3574202b +Signature: 561ad8bd11270c71f00af0e0cf256d858c757e8b55b9c4d6fb6bf71598ab59352992656348c1ff1ccda14fb7c5c3b53be49727c07422b78ffc380eeb03be7bdf07b279337af8a1eb7c5bdb725b33a82926b6afb7a1fff0750cc2532c6f96e28d7f1e621cf222b42bb850312f1a5fb7d99acd1c6f6d2347a121dd478374d6a40a7b0cd42e430f01b926135fc8d850366a +Test: Verify +Message: 888330ef1dc1588d578badde35c98d1e +Signature: 915d64d7b9b811fe8b58eaff4c2bf9ce2ad886eef95b28093f8c21f4ca950fdb2f6e77f97d0f2f8158445347f5b3ce33e082f3b5204522e15614d1891078d9557796726b5555cbd8d5489638ecf4738257dea70175fe27de54b1f45c0a96c229bd59260bebfb241e8eacb8a1a23b9a9a79b6d1f52cfed8cca2f1968e37d76c435ad1acd44131ef2c5f5e4ea8a33aee4e +Test: Verify + +AlgorithmType: Signature +Name: ESIGN/EMSA5-MGF1(SHA-1) +Source: http://www.nttmcl.com/sec/Esign/esign_emsa5_data_ntt.txt, \ + ESIGN ( IFSSA-ESIGN-EMSA5 ) Test Vector No.4-6 ( 1152 bits ) +KeyFormat: Component +Prime1: d64dac2fb3506111bbac11a04e138d2d6f32df119f2f259065cf5785a46aaf404ad887f0a310b36be4a3a1a33c8a054f +Prime2: d1158628ed1e0695c02a821ab8590f59fc1a3fb1e19ee192ab789e9d963766d78f55cfef9bf58c0c774a32d8a8943955 +Modulus: 92855120174c4a115bf525fa1f2ebf68d8328162149a5a6751b2512584eab7e5582d38d0e5029e01ece85a484030bb884a29121d8924f0195b22842b16436cd36c33bbe843e1cf7a585e89894b14595641d081a3077d667096df251bd93c86ebd94e0d555601794fa66fa2bcea920287c19922bed486a4f631390d1e36cc3635b509cb14c44d50313919a6cbb75eff35 +PublicExponent: 0400 +Test: KeyPairValidAndConsistent +Message: 16a3632339c463e243a4909f8a3810a8 +Signature: 7d8790ee852a4f3ba8bb3fa0f6fc30c29b6bc2bc538195826544138dcb92500122148ac2cf0dc77dd37182c2267a73317ce5b2ae26db79204abe0e10c7212ba8de99fdc5cf498f7ee689588541fb78291afb9b65242f725a4aa32b119957b4314a58b4239a0235b9b1a8a6efbaa3601961d4b0730a6d9e5659f20105931d473daf3d378b39b7f3f01516d72ade9ef68a +Test: Verify +Message: ef8bcad6c164a86b0e0a3c011d556744 +Signature: 6ce6024f64a7f04a0fe29b65cf2ec2ac49d9f90078a77db8bc260d3cfef233165a90b29d5787218b4d05a0e9321f2e802a8ed6d1a4201feb982a5d06bef051d60436d8c61a249432e662e625806526075f02b60d198142b96b67a4ac31d0071a1f971dae5a6a1b6db177591edfe80f7e51c7335441490f05f214b5a1aec94de572e3ec11ef4bebeb42f27037d38a186f +Test: Verify +Message: 29023889c79230c1c479820c5ff2e006 +Signature: 85f0b648ee0f6d30a18666e2da8bcda319ede91ca18e018548e2a1c21b0e0049b91528eba4da3be4551b26c4e59e6aba25312874f2320eaf7c94c541e17fb16fb0d9d9928ea526b0fc0c0fb2d12e425a5917e4039a5366585327bc3456107ff31c889c5e04259457dfe65952dc43cd35f4ca689272769096b9583bbffad4a057673f938fa7192bbca44598cf5600e3eb +Test: Verify + +AlgorithmType: Signature +Name: ESIGN/EMSA5-MGF1(SHA-1) +Source: http://www.nttmcl.com/sec/Esign/esign_emsa5_data_ntt.txt, \ + ESIGN ( IFSSA-ESIGN-EMSA5 ) Test Vector No.7-9 ( 1152 bits ) +KeyFormat: Component +Prime1: fd5708b30e8ee342bacaeb01c0d3baa91a833dacff2878c7df62e04a65afe770acdcefeaf8a72a5809387e5ed97756ef +Prime2: fa335563d5da151e3ab025f3b77d3f1eaf4a0d431012e79b12ca8ec433d347bd9a2b5179f2ed332a19ea2cad694c97dd +Modulus: f5072ba25e7df2c0e0a0abde031dda9534a493396ab895e6132abc90f993535ce55d6395e1fd548371228decc1cfefa9737344243ddb1eccbbc22d68571617afb23638c3f0222a84b0a8c9889ab934aa84cc92e14d972670db6d2105bbd0212c1843ff0ccbae19535ac01cf02ad98aa941fce32fac874cea7f1f83969fbaf025fb562a087efb4652210d45279312da7d +PublicExponent: 0400 +Test: KeyPairValidAndConsistent +Message: abbf5c71245af5d272e627ec845e9ed4 +Signature: b75e2869c052df20d6c008dd911a5bd752d5a23ee42ae47def37f76f6b2d5f04eb8d9b0783c502e0abd30bc567a6672292c3a6736fe8d4034fad857456cd599259d09f42f1d4c64d244fd149f6316f0b763be0de4f9da7f9649a76b984fe2ae99293d406904a9df59d28cc8a58b7ad0029657a47ac0e28d6353287df1ea8feef2fbb65d86425e80487420c1c9c1bda7e +Test: Verify +Message: cf2c943bc4c23175b43ba128c75339d1 +Signature: 64616eb627bf49c2a5a183479a66b7dae12cd1a0982baa0cc12329f594196b9de47909e6b5cf4653bfccdeeb5478fd88c31c197c9adc335a84ec58664ce5fc55c7b2f17b0f32ffac4ff3f3b4ddb3ce125ab7e43efc0be6ae8357895ab5f118a4ec71b57cc1b252373fecd4a1f404ed295f2d97868e3737fdd6fdf124bc2f1e083b57d5c237db775d429d08d5b5ced857 +Test: Verify +Message: 4d011f09f665d5f4a12595900e3827ec +Signature: 1911d3df18bdd9907b69ce6b655086c952c92d826bbef199fb1e0dcb7209a1b28d0a03beabc9e7d8df052febe26f691ff808caaac697c3005d524f3da8c700bf620aa37fd0793b3f22c6a488d733336d040642e0767755391951a754a1111345b912b4c0228ab154eb4baac0383a54023bd7c7ea2ed4bb894444b80d7e5f18407f51c3af858b9fa9198190b4b540fce8 +Test: Verify diff --git a/cryptopp/TestVectors/gcm.txt b/cryptopp/TestVectors/gcm.txt new file mode 100644 index 0000000..691b085 --- /dev/null +++ b/cryptopp/TestVectors/gcm.txt @@ -0,0 +1,139 @@ +AlgorithmType: AuthenticatedSymmetricCipher +Name: AES/GCM +Source: aes-modes-src-07-10-08/Testvals/gcm.1, Basic Tests for GCM (compiled by B. R. Gladman) +Key: 00000000000000000000000000000000 +IV: 000000000000000000000000 +MAC: 00000000000000000000000000000000 +Test: NotVerify +Key: 00000000000000000000000000000000 +IV: 000000000000000000000000 +MAC: 58e2fccefa7e3061367f1d57a4e7455a +Test: Encrypt +Key: 00000000000000000000000000000000 +IV: 000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 0388dace60b6a392f328c2b971b2fe78 +MAC: ab6e47d42cec13bdf53a67b21257bddf +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308 +IV: cafebabefacedbaddecaf888 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255 +Ciphertext: 42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e 21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091473f5985 +MAC: 4d5c2af327cd64a62cf35abd2ba6fab4 +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308 +IV: cafebabefacedbaddecaf888 +Header: feedfacedeadbeeffeedfacedeadbeefabaddad2 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39 +Ciphertext: 42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e 21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091 +MAC: 5bc94fbc3221a5db94fae95ae7121a47 +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308 +IV: cafebabefacedbad +Header: feedfacedeadbeeffeedfacedeadbeefabaddad2 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39 +Ciphertext: 61353b4c2806934a777ff51fa22a4755699b2a714fcdc6f83766e5f97b6c7423 73806900e49f24b22b097544d4896b424989b5e1ebac0f07c23f4598 +MAC: 3612d2e79e3b0785561be14aaca2fccb +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308 +IV: 9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728 c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b +Header: feedfacedeadbeeffeedfacedeadbeefabaddad2 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39 +Ciphertext: 8ce24998625615b603a033aca13fb894be9112a5c3a211a8ba262a3cca7e2ca7 01e4a9a4fba43c90ccdcb281d48c7c6fd62875d2aca417034c34aee5 +MAC: 619cc5aefffe0bfa462af43c1699d050 +Test: Encrypt +Header: +Plaintext: +Ciphertext: +Key: 000000000000000000000000000000000000000000000000 +IV: 000000000000000000000000 +MAC: cd33b28ac773f74ba00ed1f312572435 +Test: Encrypt +Key: 000000000000000000000000000000000000000000000000 +IV: 000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: 98e7247c07f0fe411c267e4384b0f600 +MAC: 2ff58d80033927ab8ef4d4587514f0fb +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308feffe9928665731c +IV: cafebabefacedbaddecaf888 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255 +Ciphertext: 3980ca0b3c00e841eb06fac4872a2757859e1ceaa6efd984628593b40ca1e19c 7d773d00c144c525ac619d18c84a3f4718e2448b2fe324d9ccda2710acade256 +MAC: 9924a7c8587336bfb118024db8674a14 +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308feffe9928665731c +IV: cafebabefacedbaddecaf888 +Header: feedfacedeadbeeffeedfacedeadbeefabaddad2 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39 +Ciphertext: 3980ca0b3c00e841eb06fac4872a2757859e1ceaa6efd984628593b40ca1e19c 7d773d00c144c525ac619d18c84a3f4718e2448b2fe324d9ccda2710 +MAC: 2519498e80f1478f37ba55bd6d27618c +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308feffe9928665731c +IV: cafebabefacedbad +Header: feedfacedeadbeeffeedfacedeadbeefabaddad2 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39 +Ciphertext: 0f10f599ae14a154ed24b36e25324db8c566632ef2bbb34f8347280fc4507057 fddc29df9a471f75c66541d4d4dad1c9e93a19a58e8b473fa0f062f7 +MAC: 65dcc57fcf623a24094fcca40d3533f8 +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308feffe9928665731c +IV: 9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728 c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b +Header: feedfacedeadbeeffeedfacedeadbeefabaddad2 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39 +Ciphertext: d27e88681ce3243c4830165a8fdcf9ff1de9a1d8e6b447ef6ef7b79828666e45 81e79012af34ddd9e2f037589b292db3e67c036745fa22e7e9b7373b +MAC: dcf566ff291c25bbb8568fc3d376a6d9 +Test: Encrypt +Header: +Plaintext: +Ciphertext: +Key: 0000000000000000000000000000000000000000000000000000000000000000 +IV: 000000000000000000000000 +MAC: 530f8afbc74536b9a963b4f1c4cb738b +Test: Encrypt +Key: 0000000000000000000000000000000000000000000000000000000000000000 +IV: 000000000000000000000000 +Plaintext: 00000000000000000000000000000000 +Ciphertext: cea7403d4d606b6e074ec5d3baf39d18 +MAC: d0d1c8a799996bf0265b98b5d48ab919 +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308 +IV: cafebabefacedbaddecaf888 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255 +Ciphertext: 522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa 8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad +MAC: b094dac5d93471bdec1a502270e3cc6c +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308 +IV: cafebabefacedbaddecaf888 +Header: feedfacedeadbeeffeedfacedeadbeefabaddad2 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39 +Ciphertext: 522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa 8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662 +MAC: 76fc6ece0f4e1768cddf8853bb2d551b +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308 +IV: cafebabefacedbad +Header: feedfacedeadbeeffeedfacedeadbeefabaddad2 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39 +Ciphertext: c3762df1ca787d32ae47c13bf19844cbaf1ae14d0b976afac52ff7d79bba9de0 feb582d33934a4f0954cc2363bc73f7862ac430e64abe499f47c9b1f +MAC: 3a337dbf46a792c45e454913fe2ea8f2 +Test: Encrypt +Key: feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308 +IV: 9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728 c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b +Header: feedfacedeadbeeffeedfacedeadbeefabaddad2 +Plaintext: d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a72 1c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39 +Ciphertext: 5a8def2f0c9e53f1f75d7853659e2a20eeb2b22aafde6419a058ab4f6f746bf4 0fc0c3b780f244452da3ebf1c5d82cdea2418997200ef82e44ae7e3f +MAC: a44a8266ee1c8eb0c8b5d4cf5ae9f19a +Test: Encrypt +Header: +Plaintext: +Ciphertext: +Key: 00000000000000000000000000000000 +IV: 000000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f 101112131415161718191a1b1c1d1e1f 202122232425262728292a2b2c2d2e2f 303132333435363738393a3b3c3d3e3f 404142434445464748494a4b4c4d4e4f 505152535455565758595a5b5c5d5e5f 606162636465666768696a6b6c6d6e6f 707172737475767778797a7b7c7d7e7f 808182838485868788898a8b8c8d8e8f 909192939495969798999a9b9c9d9e9f a0a1a2a3a4a5a6a7a8a9aaabacadaeaf b0b1b2b3b4b5b6b7b8b9babbbcbdbebf c0c1c2c3c4c5c6c7c8c9cacbcccdcecf d0d1d2d3d4d5d6d7d8d9dadbdcdddedf +Ciphertext: 0389d8cd64b3a595fb21c8b27dbff077 e784b8b85d5e4f34efe493e48896dfff 002333026a56b2fd08a09c87fcbe85cf f97c902a25bb1f4a43478687f5feb6cd ca9f3fc6ecab732627386ee2996a4cde c5e91f48c293c6a87774b950aeb1d7bf 62321a0d76006297b2d06623cf6e4fb1 433494c3326b0ae914120085a195413f 5e3278e4107d7b08dd2107405610e67d 83ed5b5ba0b591e9e46b1029f5f6936f fdb0e788fc09f60d861a0b3e1ab6294a 76ebdf6663421ef7dd6c1bc448dfcdb7 a0c38bae72fa627ed327f2b46fcec25a 77ee5fd7e3354788643c0d7df15075d5 +MAC: 6b385f3012eafda4189da7ad3b6eafbf +Test: Encrypt +Key: 00000000000000000000000000000000 +IV: 000000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f 101112131415161718191a1b1c1d1e1f 202122232425262728292a2b2c2d2e2f 303132333435363738393a3b3c3d3e3f 404142434445464748494a4b4c4d4e4f 505152535455565758595a5b5c5d5e5f 606162636465666768696a6b6c6d6e6f 707172737475767778797a7b7c7d7e7f 808182838485868788898a8b8c8d8e8f 909192939495969798999a9b9c9d9e9f a0a1a2a3a4a5a6a7a8a9aaabacadaeaf b0b1b2b3b4b5b6b7b8b9babbbcbdbebf c0c1c2c3c4c5c6c7c8c9cacbcccdcecf d0d1d2d3d4d5d6d7d8d9dadbdcdddedf +Ciphertext: 0389d8cd64b3a595fb21c8b27dbff077 e784b8b85d5e4f34efe493e48896dfff 002333026a56b2fd08a09c87fcbe85cf f97c902a25bb1f4a43478687f5feb6cd ca9f3fc6ecab732627386ee2996a4cde c5e91f48c293c6a87774b950aeb1d7bf 62321a0d76006297b2d06623cf6e4fb1 433494c3326b0ae914120085a195413f 5e3278e4107d7b08dd2107405610e67d 83ed5b5ba0b591e9e46b1029f5f6936f fdb0e788fc09f60d861a0b3e1ab6294a 76ebdf6663421ef7dd6c1bc448dfcdb7 a0c38bae72fa627ed327f2b46fcec25a 77ee5fd7e3354788643c0d7df15075d5 +MAC: 6b385f3012eafda4189da7ad3b6eafbf +Test: Encrypt diff --git a/cryptopp/TestVectors/hmac.txt b/cryptopp/TestVectors/hmac.txt new file mode 100644 index 0000000..52f85fd --- /dev/null +++ b/cryptopp/TestVectors/hmac.txt @@ -0,0 +1,125 @@ +AlgorithmType: MAC +Name: HMAC(MD5) +Source: RFC 2202 +Comment: Test Case 1 +Key: 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b +Message: "Hi There" +MAC: 0x9294727a3638bb1c13f48ef8158bfc9d +Test: Verify +Comment: Test Case 2 +Key: "Jefe" +Message: "what do ya want for nothing?" +MAC: 0x750c783e6ab0b503eaa86e310a5db738 +Test: Verify +Comment: Test Case 3 +Key: 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +Message: r50 0xdd +MAC: 0x56be34521d144c88dbb8c733f0e8b3f6 +Test: Verify +Comment: Test Case 4 +Key: 0x0102030405060708090a0b0c0d0e0f10111213141516171819 +Message: r50 0xcd +MAC: 0x697eaf0aca3a3aea3a75164746ffaa79 +Test: Verify +Comment: Test Case 5 +Key: 0x0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c +Message: "Test With Truncation" +MAC: 0x56461ef2342edc00f9bab995690efd4c +Test: Verify +MAC: 0x56461ef2342edc00f9bab995 +#TruncatedSize: 12 +Test: VerifyTruncated +Comment: Test Case 6 +Key: r80 0xaa +Message: "Test Using Larger Than Block-Size Key - Hash Key First" +MAC: 0x6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd +Test: Verify +Comment: Test Case 7 +Key: r80 0xaa +Message: "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" +MAC: 0x6f630fad67cda0ee1fb1f562db3aa53e +Test: Verify + +AlgorithmType: MAC +Name: HMAC(SHA-1) +Source: RFC 2202 +Comment: Test Case 1 +Key: 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b +Message: "Hi There" +MAC: 0xb617318655057264e28bc0b6fb378c8ef146be00 +Test: Verify +Comment: Test Case 2 +Key: "Jefe" +Message: "what do ya want for nothing?" +MAC: 0xeffcdf6ae5eb2fa2d27416d5f184df9c259a7c79 +Test: Verify +Comment: Test Case 3 +Key: 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +Message: r50 0xdd +MAC: 0x125d7342b9ac11cd91a39af48aa17b4f63f175d3 +Test: Verify +Comment: Test Case 4 +Key: 0x0102030405060708090a0b0c0d0e0f10111213141516171819 +Message: r50 0xcd +MAC: 0x4c9007f4026250c6bc8414f9bf50c86c2d7235da +Test: Verify +Comment: Test Case 5 +Key: 0x0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c +Message: "Test With Truncation" +MAC: 0x4c1a03424b55e07fe7f27be1d58bb9324a9a5a04 +Test: Verify +MAC: 0x4c1a03424b55e07fe7f27be1 +#TruncatedSize: 12 +Test: VerifyTruncated +Comment: Test Case 6 +Key: r80 0xaa +Message: "Test Using Larger Than Block-Size Key - Hash Key First" +MAC: 0xaa4ae5e15272d00e95705637ce8a3b55ed402112 +Test: Verify +Comment: Test Case 7 +Key: r80 0xaa +Message: "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" +MAC: 0xe8e99d0f45237d786d6bbaa7965c7808bbff1a91 +Test: Verify + +AlgorithmType: MAC +Name: HMAC(RIPEMD-160) +Source: RFC 2286 +Comment: Test Case 1 +Key: 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b +Message: "Hi There" +MAC: 0x24cb4bd67d20fc1a5d2ed7732dcc39377f0a5668 +Test: Verify +Comment: Test Case 2 +Key: "Jefe" +Message: "what do ya want for nothing?" +MAC: 0xdda6c0213a485a9e24f4742064a7f033b43c4069 +Test: Verify +Comment: Test Case 3 +Key: 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +Message: r50 0xdd +MAC: 0xb0b105360de759960ab4f35298e116e295d8e7c1 +Test: Verify +Comment: Test Case 4 +Key: 0x0102030405060708090a0b0c0d0e0f10111213141516171819 +Message: r50 0xcd +MAC: 0xd5ca862f4d21d5e610e18b4cf1beb97a4365ecf4 +Test: Verify +Comment: Test Case 5 +Key: 0x0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c +Message: "Test With Truncation" +MAC: 0x7619693978f91d90539ae786500ff3d8e0518e39 +Test: Verify +MAC: 0x7619693978f91d90539ae786 +#TruncatedSize: 12 +Test: VerifyTruncated +Comment: Test Case 6 +Key: r80 0xaa +Message: "Test Using Larger Than Block-Size Key - Hash Key First" +MAC: 0x6466ca07ac5eac29e1bd523e5ada7605b791fd8b +Test: Verify +Comment: Test Case 7 +Key: r80 0xaa +Message: "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" +MAC: 0x69ea60798d71616cce5fd0871e23754cd75d5a0a +Test: Verify diff --git a/cryptopp/TestVectors/nr.txt b/cryptopp/TestVectors/nr.txt new file mode 100644 index 0000000..f08bb6a --- /dev/null +++ b/cryptopp/TestVectors/nr.txt @@ -0,0 +1,615 @@ +AlgorithmType: Signature +Name: NR(1363)/EMSA1(SHA-1) +Source: generated by Wei Dai using Crypto++ 5.0 +Comment: 1024-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 09b2940496d6d9a43bb7ec642c57b302e59b3a5155 +SubgroupGenerator: \ + a1c379ba91fe1f9d5283807b809c698bce4aee6f405f4de8c46becf33c08a63b\ + c5f8088f75b5b6bcfb0847ccbdee700e4e698652317bbd7a3056404c541136d7\ + 332c2b835ef0d1508ef57b437de60675f20f75df0483f242ddeb57efacd18041\ + 8790f4dec0a8250593ba36f17316580d50db1383ea93a21247650a2e04af904d +Modulus: \ + bd670f79b0cde98a84fd97e54d5d5c81525a016d222a3986dd7af3f32cde8a9f\ + 6564e43a559a0c9f8bad36cc25330548b347ac158a345631fa90f7b873c36eff\ + ae2f7823227a3f580b5dd18304d5932751e743e922eebfbb4289c389d9019c36\ + f96c6b81fffbf20be062182104e3c4b7d02b872d9a21e0fb5f10ded64420951b +PrivateExponent: \ + 0355dc884345c08fb399b23b161831e94dbe61571e +PublicElement: \ + 255cf6b0a33f80cab614eafd5f7b2a6d83b3eafe27cd97b77ae70c7b966707d8\ + 23f0e6aaaa41dc005aaefd3a0c269e60a665d2642f5d631ff1a3b8701bc06be9\ + c44ab7367f77fefeec4c5959cd07e50d74a05af60b059ad3fc75249ecf44774b\ + 88b46860d9c3fa35d033bcfc7b0b2d48dc180d192d4918cddff4f7ebcdaaa198 +Test: KeyPairValidAndConsistent +Message: 66B92E1E2C44B80F7BFA +Signature: \ + 06e7586b76d5a8270155cce2d3ff4495237eed29a101eb1341fce0b43d95397b\ + 053d93772b0a9cf3117b +Test: Verify +Message: 973266BB0A492248082A +Signature: \ + 02de44ed2233f0f11dcf567217d2089ec039a211bf000d42e04900a66ce45c58\ + 526a97d7f4cfba29e43d +Test: Verify +Message: 9A6D079ED0CA9D8B40E8 +Signature: \ + 04f59dbb2712926b3bc1d3c428f16203f3443f88db0669adda94dcb54e1fff71\ + fb51bb603e7adff13f84 +Test: Verify +Message: AA34DCE67BCDAC927DA6 +Signature: \ + 08ad21bf9d0cc598a214329d3544685d39487988bb01aced68ad0a4831affbff\ + 3b14df6c0f4ac4d2e967 +Test: Verify +Message: 4EDAC08816AFDBF284DA +Signature: \ + 09a9d5aa9bd1b6b61fe8825128c8e52a6213692b2504c8c6951299b5ca51b03d\ + ea0a5e56f9a7c4cd44f7 +Test: Verify +Message: D82F2E903230962B8174 +Signature: \ + 0441c8d089e690a7fab391de07073326d443a0d9d806a3997ac1641175310890\ + 1e55582a582541330539 +Test: Verify +Comment: 1025-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 0b3949dadf3196f08bca0606f06443afce2fb1d02f +SubgroupGenerator: \ + 015f0f6d1729ef2af723c00e36450a04c7e7681d65b74a6417a53b3eb6036989\ + eff8e0ab11a7ec3ce2340b7c7a92e1a977aee52555c06c12c4cc28496ddc2598\ + feeb7539ce90d3888e21f61d7f14746cf67d9fed373afd97e2483700e300ed9d\ + a25e7200b363a4727ad201194b36ea5f816cf83488c3e527d3a5515870d2da63\ + d6 +Modulus: \ + 017310bf02d70ef2cee45d1cc47ec8ce8cabdd6bf32a560975a42ef057bf9dfd\ + 553bc9368ddb154a55d855edaa755e69f511a4c69ba78571cc4b14ddbb0f32a4\ + a9c56c286305aa21ec4e35de7390747477b3bd574e7b87cbebde2f665703137a\ + 1172350ad2f48a0884d076ada9db82f104e6b0ad86693cd4adbd0067639102fc\ + f1 +PrivateExponent: \ + 0696b0f255468b7ac18e11632f208ca86383a46724 +PublicElement: \ + 45bf83e62f50190374b23de5e4a1d0278e9e8e6c8335577d62e80662a380c206\ + e326819c5082d321dfda1f905fa5a3ead9a2dc769885a27b1fd6a133185dc5a7\ + 876a76ab0a09fe02b7071a924169e4d2d2a67e67ed3628800134183b962c0b31\ + 3463aa154e6437d644e025ab234e63d19c129842a61c5e5ea5a06466c858c81c +Test: KeyPairValidAndConsistent +Message: 2F585D0CE4FA1CD93880 +Signature: \ + 06586d8a703cdc27200d5261853f50effa8ebbdfc905f5becb68b81eca506992\ + 50fb54e46d557c6095dd +Test: Verify +Message: 4F09A1F217B8393199EE +Signature: \ + 0622cd33b1d715829d8fae104759ed449f95becb5e03d36f5578fd6a2951d2e6\ + 26cfce85ba6563990d64 +Test: Verify +Message: 03D7110A753B008A76A0 +Signature: \ + 02925630b4c80e604fc1d8680bfd0e3d878e22b3a30ab8b10da7fc38816a8c5f\ + 1e06927c68f9d3db60d9 +Test: Verify +Message: 129F4781D417671F886D +Signature: \ + 016c2c4ce845b4d412828cbb8a396d080c7eb93bcb01f7010410198c8bac96df\ + 8ab8761cebdb7d87f3a2 +Test: Verify +Message: 3E1594F559D1248D1112 +Signature: \ + 080bab68c62be86ab2c1bfd0edf10387a7cd66b69f054e254218e01f650e4e8c\ + 6bfa10054e367893e59e +Test: Verify +Message: D6F0354F1B6B253B6997 +Signature: \ + 08755c7e8012e8160db75c6160686351e5c577207f01602b4dda2fa56b864374\ + 703c83bb323c7bb34f5f +Test: Verify +Comment: 1026-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 36bb68cd95dab195f14c4534283e7ea50b00cc31a3 +SubgroupGenerator: \ + e2782ad6992f4b7e88787b4d616744b60e095575a177569c4a069e311e38b724\ + 0c43343367e23574c30e4d9f05afe1fbe61423bab715915c4ccf28aa0ed2f52b\ + 092b86c8ec1f9d4795d6e91c88ba41297625c11a9e1f4f182da13cf51e541038\ + a1266bf32b2dd81ecd84bb80be8fdf97689942e944b7fbb6981e00cd680ee25f +Modulus: \ + 025098828217d00108030801e5f135fc6fd3010be39e49060a96addc8a081198\ + 803402c4b46e4ce0750fcbab8cf084c7ca8cae09f1b5482d336fa3af47b96791\ + d02d8143e274b1325f2213e17f9384c805f479e52a3117cf84869d395f1bc025\ + c918484478d2da1880d32bc519f4e6b2fd2d46958795550ce1765f725626f3fc\ + 17 +PrivateExponent: \ + 2db270c284328353f979cad99f4133c53acaa6ee71 +PublicElement: \ + 0179b283f67868aeded3a0c5633d0e6c18fad77174e2c89c03452593d05e77a9\ + fb029c0ccb2b6f2328e79c286ee392713f12d9d45578348383b81d11b0e0f7e8\ + 9965a7785d5ab64ea25bb73e8acaa8e84cb9897985015757a48c0b1dac3a6a60\ + 6fe671ea073ec434a46f227b8d4b02a46fbba2f6c6216736d669f55778d81004\ + d8 +Test: KeyPairValidAndConsistent +Message: 7E4F2ED4E79062778A2D +Signature: \ + 03f523873462ee1513833e2853c3b62e30c5c1cc3224f1a42dc154fa84ecce04\ + 487069530d76e0574a38 +Test: Verify +Message: A0E35846B5CF1B5BF560 +Signature: \ + 2264285d75a55c431a7adb9347bc07d58efbeb1dd9354d01b0b86f2875f8dec0\ + 294d20289d39369c5afa +Test: Verify +Message: 3B138785EFC6F520EAE0 +Signature: \ + 116e45961ca73f3ccf08b35f94877fef88772cf0fa2ab196c85a91104d8fbde6\ + 65b7032b2fb4011a88cc +Test: Verify +Message: 0F6BE2AA764B485145D4 +Signature: \ + 027ad753bde13c7f2fcd7571e5558f8af756cdb9463237fb0e285cb633cc86be\ + 1b410188d701f6ca83c6 +Test: Verify +Message: 6CD9FBD23EA58826FB04 +Signature: \ + 1651decd376899104e3fdbe40ab2d9bfd3c8577f3b092b66e3760678ecb3fc35\ + 23a59107e0bdccb76a73 +Test: Verify +Message: 473A82649565109E9E89 +Signature: \ + 2045ef56d92f89a214d76cca6b591068ac5f0d008c121ec4e5c4c1e8ca9b67cd\ + bb5ecc776a23b6d54ba5 +Test: Verify +Comment: 1027-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 291d0ba731a4303070504d8b9615640a5e1345e00f +SubgroupGenerator: \ + 051c9d0270b69ceef82af5aed5f91dc88d585096609d835d03d39cf3ce74f5a3\ + 402d4e8e192455493da61cc58ee6f54dd941172be3d7642169cbc52273f4b725\ + f1d6c820c3333336c64d32fb6238121b3ccb7c71b847764946bb0887a44ca9de\ + 802cda62efa9dda573751084225353f11ed837f3dc25de8374b6fdbfb6e313e4\ + 6d +Modulus: \ + 055402a8abe9cda3072ca8601d68032651feb0335856e57f8f8d4ec949098a64\ + 59151cefeef91b7aa733668c8cf0e9b96c93c61f3528d4036daa6565646f65d7\ + 4c4552817df7e5fb1cc421cfd885e27bb811ad227e81b3fa02f7a00bf01ee6e2\ + 3fb5572a75f8f29b58bd5f7db435e8a92a923f15d50f34213d29816921bf195b\ + 2d +PrivateExponent: \ + 13b27094d9a5a3a9704cebdbe890da325fa26ad555 +PublicElement: \ + 03b06b99097cd7145c7d7782b02e247a4741f3c7f39233627f17e13ebff89a18\ + cad6a454c3f32f7ef2910384030da71ae47e1c3fa79c2141dad107f8e715e47f\ + b0bb626baafc35db769852ebbec2d339c3c3d5f2287cfdd20b3b78ea4607086c\ + 42558ae4637eddd6a74bc1072d0f34d9c0130cbc9e84f537e7ce50df502d17b5\ + c3 +Test: KeyPairValidAndConsistent +Message: AE6DCD9535AEEE3ECC89 +Signature: \ + 1c6794878aabf07cf9f59b685d4a3a6e51c9135dc101a4a6a62c95a20902e2fa\ + 23db7d15293f595f86ab +Test: Verify +Message: C83A14EAC016D659F9FE +Signature: \ + 18ed4812925dca6a9c30e2e3566433e202be2d305414e1e6583905ad845cbc63\ + 2049804932aac79b858c +Test: Verify +Message: 745E02041EB487D16CE6 +Signature: \ + 13d4ef1de59ef0fe9bc4ecc6d382908642f6f5793e255b819e25ed124f7fa574\ + d91fc2e9b258f0514b15 +Test: Verify +Message: 62F019655A83501FC4E7 +Signature: \ + 07f797768984ecc792f366ece16f5102aec2aac6d31fdaf3972839cac2c99a2b\ + f5b347c887d37943383c +Test: Verify +Message: 351D37A4B5046E885EAA +Signature: \ + 22064cd5179ff1551dbf73c5220e17a9dfa1aa8f7f22f44a6c70f13c6d0a21f8\ + 7e53278251037a6cdc5e +Test: Verify +Message: 4073D33915F595F4FF9D +Signature: \ + 1f902ea2c9521b8c7f11619d35dd22a4667e2eb89a017194bb68ec0a9df762c9\ + 377c1c075b5f09566048 +Test: Verify +Comment: 1028-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 2368e2b864b250ad45406391e7eeaa3d27cd053c2b +SubgroupGenerator: \ + 07c325695dfe315a77ad7b42f0d18f9d4821b5c153fee7385877602fa54477bb\ + 8c0639d2438f34352b97c22d02a7295d2b53d5286a01caa919d6283614690624\ + 240af922675ccd4a0534ec336cb79cde31b02b5988cc5a53ca17790d67d803a2\ + 7bb927b9c59bdc6ac794175e285cafdece6778ab19a0b444747fee20d5bf929e\ + 70 +Modulus: \ + 0abdeff64b6f28256e4562109bffed29cb5aa95d89cc0ec95da0e773dbff3467\ + c271bbb1e1fbb6af058517fdacdf26b5919674c625eced6317d8631c063f43b3\ + ade2cd633d554913339071d6ebed5fd665fc5dd7d47b80721a976c3b14fbd253\ + f0f988c354725289f2897df0a15985c92b2d4da8d087870c251c72d979b8304d\ + 51 +PrivateExponent: \ + 0771305163506b2b83bd5279935df1b5fcf180b004 +PublicElement: \ + 043e4ae6244408879264fe6b859b578218705b9a45af22efded27141b7f090cb\ + cbe42dcf481df3e41b13920ae02b694eaa6bfd62f2d3c5d677b8c4ce783cbe27\ + 89e088b04489ef535ad4a517351c8835cf128f7ec677a1b1dbe3ae9cc4198ddb\ + 6e1cef8e978c0725f5063797bc43eb9ae496286cccbad5d4e026e9edb997d2f9\ + 18 +Test: KeyPairValidAndConsistent +Message: 4867852C83F181CDD010 +Signature: \ + 1db6a5661b20c9289428c3b9ebf65d5a8f757f3a3b1eb15dfaf0c8cefc891954\ + b48279eb45910a141ec3 +Test: Verify +Message: DA6493C86D6B62C5961C +Signature: \ + 1c05300a56319ba4a8ace1206f5f37b5bbefc9d80a171a57b6da3c02aa1f3079\ + 70583c008f073996d932 +Test: Verify +Message: AE2C1136BFE966794A6C +Signature: \ + 02dfd79eb18f3a862b11a5d199a7db1dc53580ade90517a7739cbd8ab1849c44\ + 54ba17a69b8d03ecc4f9 +Test: Verify +Message: B20160E0442E726BE749 +Signature: \ + 14c0cf809174d39f1324b7dd0d6d1fb3be5b5577c10048b12def39772fa60cd5\ + a9d2cca9075f12e5a3c1 +Test: Verify +Message: 3638935C4492F5CA42F2 +Signature: \ + 0081d7216636bc6fb9bc7a637a377ebf4f9048826e0360c8faf03dd28c4ee4a4\ + da82689259f140b3d918 +Test: Verify +Message: DFB674CA6E0FDC0CBE99 +Signature: \ + 1e3e21aa3dcccddb8cf3e360631fc36956263951ff18fec553531252b4dbe753\ + 6ed5fc62897d51500c38 +Test: Verify +Comment: 1029-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 3357536531dec150be0ef8747f69ea30d987ff7df1 +SubgroupGenerator: \ + 067dd80dbc6b41f58d08f077a9a3dcbfe12a62065fe6b4691c457f506b56dcab\ + 0433b3aad6ef962501633d0f3947b491a1317e7e6b632f062c53104d609c9222\ + b056f08a0c83662a70744331fd09b2b42fb0768e52da27e92732106fbd41ec73\ + 7373fd080b56b543d808d49eeb6e1bb0a8619b1edee8fb8295dc042423f684af\ + 8a +Modulus: \ + 1d0f176b6799b36724c92954c38d0288fa95400c2b14e064f76a6338fccaebca\ + 8d978b93bb76507bc150a50f9fe799fffe12ae2875b13ac1084ffcfde9f62b86\ + 185a72f04ff80538d6eac177edc98d61a517b1275bcf4b57aa262e1702d623bc\ + 344db7e5621c949a9b12e9936e88fae9b200a1f8ad5b40ec8220aa301267f38d\ + d7 +PrivateExponent: \ + 2dcdc00a86ecc2a60ebfa6660a83af1d7c3e570b85 +PublicElement: \ + 13834f0fa1f42abf7dbd264cb7d2eb5798da8972df67f517c62d7ae5070fd588\ + d61db62e492f9654833e876ed5737df35069f5ee01a45de881d8f5e68ec52ad9\ + ef32780e8c453a5f1e38cc17bc5cd061a3c122080f6e1b82d31877e8b08f634f\ + 497bd90b06824eaa0416c64104ce5622c272673d0dedb836ac7d47e0cea06739\ + 02 +Test: KeyPairValidAndConsistent +Message: 1E34034C47FE533F8FF5 +Signature: \ + 05c110848feacc9ac762ffa14943f9ce9a111777de0502d9f364ad9b2df4e1a8\ + 17bc15a602579b3a6a25 +Test: Verify +Message: 53D2CA23AF7DF95634F0 +Signature: \ + 14009997efeb3fd246956e44b5b0e48581ac5f414613b41fe5842c85b031ab8a\ + e68f66f8e1f1f9fc1d74 +Test: Verify +Message: 0F056E08AE77B3B30F33 +Signature: \ + 1beedf85b426d36a657f422ab9a9132986eaf415332816d33d70c726c3066158\ + c6481fd00503ffb65518 +Test: Verify +Message: F08C80E8FD38A3867B76 +Signature: \ + 0a23b8d8f920cfb0dec93725e4972080445647c54227fb987dd9f80fab446c75\ + 1c2594276168aa68f318 +Test: Verify +Message: 6D392690B92B3E75020F +Signature: \ + 18668f59c6974dad551a89bec5cacf0bf8617e8f43052eb97d7a1b12411b27b7\ + 4248b3d1f5070823e951 +Test: Verify +Message: 10AE0E091A267641FACF +Signature: \ + 1b3d10f74fdaed3d4d61fedfa3f6ad3a37c0cf6687166a312d5b280724c3545d\ + 225e1fe0639cfb1113d6 +Test: Verify +Comment: 1030-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 27c7996c1d3729c4cf1de06529e5619771e27ad9eb +SubgroupGenerator: \ + 0d87a4b01385da7f43b6277933c5f0dc8072dcacd5252e1b29f588114a7ac56e\ + 377050aa8174b5dda400f043234e4a746442792734dc80274a00a3676101be94\ + 759fc2630b9a858966488b12611d03d0b31e7243e124497a754544cee1db10bb\ + 0a81cf0b2a68045b76fe935f641c666fdc788a2b968c6668c669115756b961d9\ + fe +Modulus: \ + 2a32d68d31248024053bf628a94404b9a49d91ade4d7a45b071e93292a7f8c26\ + 61d9165f0ab85491d4b0dc67d335fa7d7dd172cb17193390a55eb000aa97e2b8\ + ed3ee64b73aa43ea9b8979132c2d966ab03c42cc14782c96e4284ee1136b8515\ + 007ed1b1a5708b5e8d81304fa651edc715918e2299cfe9016dfec5f454d907f5\ + 9f +PrivateExponent: \ + 091155581ecb7a0a792ba95c772d9382298bfdfa6f +PublicElement: \ + 0d7d22c931422fc46505887559a51490c2e367cdb40242cdbaeb23024693fd5c\ + 68f6a3307ca34b224457d5aa610b90eca3b39905481daaba7151318f09f974ad\ + 664546d14c87f797e38139ee1e07adba9c775e07b7f7b3edba87d886920d6b2c\ + ef5f084359566b0a3b8b940a65b9ad93fd7ccd1354cdcee3c43c6bd315180498\ + ad +Test: KeyPairValidAndConsistent +Message: 23EEE1D0EA8950B8F322 +Signature: \ + 18fe1a5f61c4946810e82a1e30fb6c87ce4ad9cebb1ae27eebfa8779fe292b2a\ + 451be3506bb65519dfd0 +Test: Verify +Message: 13FA6F2816FB83190A21 +Signature: \ + 2161a5be85f7ffe806df00f4bd50915e4b0674e7591f1c0902153823f881bc7b\ + 3f093d92bf86b74b5b3e +Test: Verify +Message: D071CCC0C6E4CAE82E5A +Signature: \ + 059158b2cf143f38eb8c51088dd79bf45990e596c8026fa3de5e668368b9d8d7\ + fe9ffdbdecf66aaf02bb +Test: Verify +Message: 22CE83F4803BF3EA2C48 +Signature: \ + 073b56d72a5b706455cfdcbf85b75ee45c40e96dd21a5460542ade665e51a85c\ + 510315a50307c2bbdb2d +Test: Verify +Message: 7A927EC7BB9CA16C1B0A +Signature: \ + 254c7525aad9b4b3807b3900a963fbf42f9ff2144820ea69abe5ba2c80613510\ + e1429ebc726fd0a87a4c +Test: Verify +Message: 9591B069993E10BC0B84 +Signature: \ + 0ed4210e5e4f2f9546ea181c4a61d062a1158810071905b180dbf070b480f436\ + 0b1f66065ecf111741cf +Test: Verify +Comment: 1031-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 26f86a81a6bb530c2f9b63e3690e95a0894575f445 +SubgroupGenerator: \ + 1e24828adb4ebf2becdbdcadf6706631293ad6566803d12479f04a7bb20b6086\ + fe81df164f8bd02c5f418c1140d143f11a71170b42d0753c952bfff951b9ca42\ + 04868375efaa4afad50b75787e41c5ab9ce8adcbccecd3716f350bb8aaeca9b6\ + 098bd0002d789e1f7db9c19d9045499877b93ecb4e7c64808b742063bbecf60e\ + 29 +Modulus: \ + 4d58515f7b41c4fc87e4fcefe5cf6d84b2d74a9d6f498ae9605fcbf1c5921742\ + 2001a272ef91dbd09e7af5ee54126dd4fc44bb1ed624d0dd5dafb984d5278114\ + 0bba40600cbd4752d2c32b43253efee57af6964c339570edb24195502e6d424b\ + 84bed65ac98c6fc52ec90e40a525f1863a53f2fbe2a0a133342eff4337f26ceb\ + 93 +PrivateExponent: \ + 0e61a054ee6510734a80f67a54d8c4151c957ef16f +PublicElement: \ + 19b50f1eea45bfaa22352a38f3c3b86d6f670747ac2fd94359608e25f2bb9f60\ + 2506bc357245deeb4c3c702d435c557da4f4a9fd37330a75547c91681fdbb51f\ + 286adb498d1e489e89b2e6a4eb9ff30222c51fefbeac7435f629f536ac2d6b87\ + 664d80e5c97398cf489a1d1ca217f7f21ea8e409f938378875cf5f528162e3bc\ + 07 +Test: KeyPairValidAndConsistent +Message: B4B3C8FBE82013228A21 +Signature: \ + 0e1003dd216194ded89f7d10b35a266ca7587d8cfb06a1fe3dd43f07dea4a6d6\ + acaa1477f2552c9b3114 +Test: Verify +Message: 17D2D18302173E2CE992 +Signature: \ + 027b40cd9a159257a57efae3a657399a3b6d8b06f707ba3a323abc383a93f919\ + 1246c38c03b028be05df +Test: Verify +Message: 8032AE177D6DF38C7E27 +Signature: \ + 1f5e3d759e3b832f5a6c57b055764ff5b8ad942dd819610ef94cfec296cd1b56\ + 4fd0b18bfa08c3645db3 +Test: Verify +Message: 768640A60A3C62E02428 +Signature: \ + 0abe2dfabc81ab677d2cbd781ef9768325a5d6d15a22f41b32972bd67058e617\ + e28c7e0dfbaae535d655 +Test: Verify +Message: B0999CA45B77ED63639D +Signature: \ + 1525539cd207d5f6f915eb2731b6451e38e11e0a031d7e420e0bb95d6616d8ef\ + 35d20eb43c111f8f9ca1 +Test: Verify +Message: 587EDB968FA82C12C930 +Signature: \ + 024ed20dc19a07e00158aa2fe9cb6353f0112b8fab0e6775667115e1c92e5eb4\ + 29876c12ed48e996f4f7 +Test: Verify +Comment: 1032-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 2e802b5369c3f1ddfa789bf8f2ad2e048ced3bf355 +SubgroupGenerator: \ + a9aebee7d29f90b081afc4d496a6a78210e918bb57a8a21c5995586c0bf20f7a\ + 56bb10a97e05a3a723e7db64612b12bb591b1fe7d2e46be8c96a7b2ce7c66076\ + aeded938775ae2223900adaf52a93f52d62173c82d4b67388c85d4c1127e1edf\ + 4643cf09f5375b60c19316c4f8f8fd7daea1d8b44a2d03e97c2741537f63d86b\ + 4a +Modulus: \ + d551680a62ebf98f0ed8930cc5b12de86d0a0c29a0d7e5524c24672a25428833\ + f4c19ac883ead22efcc0c6823f2e942c17adb7ab763ff2c7cc2698fa8b6448e5\ + 14d4628b197721bdaec780e126ac80ac83f24fef5c154f7690ceba903748be52\ + 12e3180ea718ca7a71a49dee939bf9bc5b7845c9648d074587ccd3724493b91f\ + 09 +PrivateExponent: \ + 0f66e04c5a75d3eac03d744e5432f23e3aea066a63 +PublicElement: \ + 2640c188055329f0b44aaf80f82f7fc7f0e421031834dfbd1fb6d6af6ab3e1c1\ + 73c901370a4ce2793c1b88d12f764c58ff064905da9c5001f679c7508972f237\ + bccca56524787466a7c9c2d6bb6392963008ed1a3e4cf3b13e66086bce3a4ca0\ + 4d8cabcf0cadb4c403c7d02a858460d04350e730289cb5adf200b5fdf1198168\ + b5 +Test: KeyPairValidAndConsistent +Message: 909068BEFFA43331FDC7 +Signature: \ + 2d557d8fae420880640dd9f60a524db48980c80d8b0179dd3c1892f02e87c9f6\ + a04a8aa731be05aaffef +Test: Verify +Message: AC8AFC7A1D9105539E10 +Signature: \ + 0ae7f23328453fdb03c090c09ee69d787ee7dfaccd047445b1026a9a7cacdd1f\ + 91455db7299538817894 +Test: Verify +Message: 310E40311BB3F77F9483 +Signature: \ + 28a8d8de06dc0011b044d19a163d350535d6ca91a023c9687557690ddf102d8c\ + 7558246ced311f2fc444 +Test: Verify +Message: 35455ABD53E6FB11ED9B +Signature: \ + 162156e476cba65e767b4db942bb35cdc6293cf4360f1801a215bb2c726c22af\ + f3a711d3c6473f1eb985 +Test: Verify +Message: 95FFA73B52F0D06A0C1E +Signature: \ + 29bf4f13e6aff528aa1b060c2baed865c442e0472422b4bd485aa5ba2a09ad0d\ + 732637bb3ee520f6bc0b +Test: Verify +Message: 1E9934125DA6E9B4E975 +Signature: \ + 1674975d0a97e799d113ff9cad06b7f70a33f5ca5f1916cee07b525270284fbb\ + 1c0428666987ad7e2116 +Test: Verify +Comment: 1536-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 232cf9bee9d56c8bd8252d1edb59d99c40cf32d07d9e5a4893 +SubgroupGenerator: \ + f028143e3f9d1317aafb814215ffda9c584da8943e96212c90a082c3d2f335e8\ + a6b64d1c890aa2224ebf158bec2b6fe6bad236417acd517a4907331e0be0dd0b\ + 801218ac270acdd45579290be1b94bc418b8f82c651d82a19d2f0e1cbb0fbc0f\ + 054d95150af96f9a7488010787a799c544883ff76a4e3092f2ca9aa9000cecb8\ + 8dda343c972c8192a83820727b1945c1a270cf913ab932457e8e6e207d06cd0e\ + fdf265b762b9fa15c9a14633af17204ba2b755ed1b3b421ac596a2a04e64be43 +Modulus: \ + fada6e4becef964a85caf9e129639a5616ac000dbac59bd50b84bc8d46411407\ + 9c34c5b58d7d40027faaf037c6a649c527cb002d3a716bdef62b6c94d7a47a8b\ + 65c2ebac05da09e40cdc417024cccba267a98f4eb69701a276b4f117662b5666\ + 05c36054e7f015d2e5f81331e5666ec17ebf71907788b40cbcea0f24aaffb029\ + ef5c25c55ae998f28a2ddb091d262c32ad324f4e64c7b4b50a19e9d92f6d8024\ + 188627cf5ce68674e7ec7da38fd6cf4ec29a6ce2f17e3188d8ef6b0e50d77d5b +PrivateExponent: \ + 1d4cedc87d55eea31bd702139b90be08d58692a1f97628a01b +PublicElement: \ + 819c8cedb9c014aa577e9046b90795accbebe81bef68b1b5c37c68cb357e1a5f\ + f92761bc26cb0953956b6c0aec05acfc9d1a27c50789793b13d9eaf2361760c9\ + 7a7d86e7d922f4809a5d2d01448e938190bbc24c150e03ef8305365ddbf5ca19\ + 6857314e3b3023f8ddc9d209bd7dad1ee763e7003fd1b0c53057d2e9acadd23a\ + a18f83d20143bc41a2dfa4a164c82621fc0f800052ec01bec7c99c66fe20ec57\ + 67e6fbbe8810cd5aa75eff3d8a4cb53e1259ebcfebcc2fcf21ba7f3589cd525a +Test: KeyPairValidAndConsistent +Message: 9F6DC301DF53FE22CAC0 +Signature: \ + 15b22111ffa1b733979cd9d8944b1291ce09468ccbd05040de0f83023c8fe083\ + 734ec39a542011643e448b01429c4bae06d1 +Test: Verify +Message: 2D7B5B9A27EAB468331E +Signature: \ + 029eea970a049ffcb4c6117c97d181bec7a27557ceb88d422b2212ca36238380\ + 87cd52d2445f539c9c03705ba4b485f56e19 +Test: Verify +Message: F552FCBBA04FFCCC5CB6 +Signature: \ + 115de3cc15d9a066c00fed43f583f6a9c984d4b8f4c93c3d72094a4b04dda506\ + 7d460c3d1ae33ba66ceaac676256c1e73001 +Test: Verify +Message: 0D52B894153A4BB74068 +Signature: \ + 0f6b8cc28e2068a3fe14d220177793daf3512ba6942e9d16ef1571fa34926c27\ + edd1bfa94723a663425f5c2d01eaddaa972e +Test: Verify +Message: 294442E103CC0CBA32A6 +Signature: \ + 0fbd8768a1b3025c0d0d309cc448320e086318772bb9485a5a0a2afa1eb2afb2\ + d1818aa7b1c55b9dc424e654524278f0ddbc +Test: Verify +Message: E993D8FE1E6F6C3914ED +Signature: \ + 0559d66bad3a51520bbb85827a257ab09dfa33938127c69bf40f08339b2f2251\ + c0e50b63d2a4d05225dea7f58f67de3071e9 +Test: Verify +Comment: 2048-bit NR key +KeyFormat: Component +SubgroupOrder: \ + 03f35f80fcd896f03eda9ff07f2e35295384c4f3b8f8c4821369ab5417 +SubgroupGenerator: \ + 75c5d8c8f72302d92be3bf486b8648330ff86954de5e6e83efef624a277574c1\ + 6757684d3874ee303fa08343fe82dae484e5dda6781280b434c4090044cc7ff9\ + b6e962594d3ca069815c0f0b6bfd25215a419420d0ef8a1595c6eb1b44a719b4\ + 0131081f75cc15cb09a5d5a029c8546230c30b4af2d4a9f4374c93a095c83b59\ + 4b1774d635d4aee965f1d094469f7bbf8bdc93216a6b8a6c5753b48962335bf2\ + 092aa583c897878c8a7ce61186b592b05d2aea710b673d5994cedb5f117fdb6b\ + 8ad4d89f443c4eb662b428a34a7522c69794cc0274f3eba837e90da86acbc707\ + 4ee3a0b029d970efa48b3d582b740ae0e585d175a5f63a385f8b6b8878b44e1a +Modulus: \ + 9a08865d2bc9e0cf03d2500b2a08402bb9dc953d5fcd73f04be61236efc0998a\ + 8f012f00e52f7a6e91e81b88a4c9f985a2da523cbe7caff08cae44963d2035ed\ + a72e1f31f82c8d64c86e686899d53c0200282f407ceb1507db480f1db223606a\ + 57466cf60fe9fc5f7ea7d5fd82ed3ab2cf5e35491dfaef0aa2e10fbfa3cdfeb5\ + ebf65e4dfc2837e1f6399db06cc2e0420c7b14a4c0d483b742ca58b31fec9f26\ + a64e9bfcaa82334e644f4b954e2a9c7eeae096b8864ecd223ead3bcf9e8c1f68\ + f6678faccdb7f26d8f33d8a5fb0cb156cc7daf4a96ec2b730c0d7f666d699f73\ + 45a37ddc1ccdea6d8f439ddb23de04a941b246bc257b0aef544a8e868bc8444f +PrivateExponent: \ + 0212c34d3d17b96a899548ebf43bb886676acebd2f040f5b33a4e88d2d +PublicElement: \ + 267f9c3ff3ee3cbc0f9e94dc7e6837e1ff65175e967987b90b9aea7eef1de6e4\ + c342bebb5dbd0c4e2f6514f2d487857a146dda6cfdbc8b56ed254cd65754d84d\ + d21a271cd15fc656274725643728b41ce3f0e6872b6dfb4c289e03f9b903880c\ + e3d7d745dfbb641c8c42ec0bfb6951ca2611fd877c32248c97252bdb42d7bd65\ + ebc50653dff389526c546d1e6ebaf6bd8b3298c01935901b7efb288b78730d89\ + fba7f46f2a642aee0dbc93aa29c190b201acf89d4f8ba28f3e3f54a1c5a48294\ + dda908f904afb7db398682c809ce13abd49279221d5b40ad76216bad7ca256d7\ + 18d3552344c481b20da5aac3e637fb7edeaf7960b532ef761376489f02fa8c10 +Test: KeyPairValidAndConsistent +Message: 5F3914F7AE0F6C76D152 +Signature: \ + 03d30b7eaaddcb384dce378f806e88d646419bbedbc2c0c5cae32f3c3b02e0e1\ + a3c3ab04b31e2c25db713db539a65c9419a846aea88aaa707cb4 +Test: Verify +Message: 769583D4E7EAD14C137A +Signature: \ + 01dc2815fd4918b8d3bd1743f5ab4546313b1fa8044b4737b2c485eeb0016bcc\ + cc084be064b6a8934a28011167eebbc33513ce609aa206810aa1 +Test: Verify +Message: 6441D5239F50C71DE0F5 +Signature: \ + 013f6d395de56832f82ee813b574002c36e551aaeffbb28ddebb84da7f01ff6f\ + 4c3d0f3519d548e2ec1a0b36f12ac1e4fedc83071bbbbce024a6 +Test: Verify +Message: F1C2D4F7C3ECDF2C17B7 +Signature: \ + 006441a8b3517613f9a8c2e7a89c492e7f49300d901ad01b92167c1fce02453d\ + 52b69dc1fc6532e792ad6366eae7fb14de3ad3f6f3132b0519fc +Test: Verify +Message: 752A1F2B8D9A717A882F +Signature: \ + 0127027984402f5b8cc069decc1bd611f0bb59c6eee86da7d334e3f8b903c5f3\ + 02c65aaf16a837963bf772931235f81e963e4d692699dfd4f7e1 +Test: Verify +Message: 666DC6B1E871026EDE56 +Signature: \ + 03e87b55a7e81318b7599da3fa8f18d46253b6546814fd1ae19318820100c297\ + 4de2624da0d54ca27e7fe3477913a6df35bf925de3f3d9a06849 +Test: Verify diff --git a/cryptopp/TestVectors/panama.txt b/cryptopp/TestVectors/panama.txt new file mode 100644 index 0000000..bd4d4ee --- /dev/null +++ b/cryptopp/TestVectors/panama.txt @@ -0,0 +1,76 @@ +AlgorithmType: MessageDigest +Name: Panama-LE +Source: Panama reference implementation +Message: "" +Digest: aa0cc954d757d7ac7779ca3342334ca471abd47d5952ac91ed837ecd5b16922b +Test: Verify +Message: "The quick brown fox jumps over the lazy dog" +Digest: 5f5ca355b90ac622b0aa7e654ef5f27e9e75111415b48b8afe3add1c6b89cba1 +Test: Verify +Source: generated by Crypto++ 5.2.1 +Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +Digest: af9c66fb6058e2232a5dfba063ee14b0f86f0e334e165812559435464dd9bb60 +Test: Verify + +AlgorithmType: MessageDigest +Name: Panama-BE +Source: Panama reference implementation +Message: "" +Digest: e81aa04523532dd7267e5c5bc3ba0e289837a62ba032350351980e960a84b0af +Test: Verify +Message: "The quick brown fox jumps over the lazy dog" +Digest: 8fa7dadce0110f979a0b795e76b2c25628d8bda88747758149c42e3bc13f85bc +Test: Verify +Source: generated by Crypto++ 5.2.1 +Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +Digest: cb34f0937e8d870d3bd7ff6311765f2c229a6c2154e4db119538db5159437cab +Test: Verify + +AlgorithmType: MAC +Name: Panama-LE +Source: modified from Panama hash test vectors +Key: "" +Message: "" +MAC: aa0cc954d757d7ac7779ca3342334ca471abd47d5952ac91ed837ecd5b16922b +Test: Verify +Message: "The quick brown fox jumps over the lazy dog" +MAC: 5f5ca355b90ac622b0aa7e654ef5f27e9e75111415b48b8afe3add1c6b89cba1 +Test: Verify +Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +MAC: af9c66fb6058e2232a5dfba063ee14b0f86f0e334e165812559435464dd9bb60 +Test: Verify +Key: "The " +Message: "quick brown fox jumps over the lazy dog" +MAC: 5f5ca355b90ac622b0aa7e654ef5f27e9e75111415b48b8afe3add1c6b89cba1 +Test: Verify + +AlgorithmType: MAC +Name: Panama-BE +Source: modified from Panama hash test vectors +Key: "" +Message: "" +MAC: e81aa04523532dd7267e5c5bc3ba0e289837a62ba032350351980e960a84b0af +Test: Verify +Message: "The quick brown fox jumps over the lazy dog" +MAC: 8fa7dadce0110f979a0b795e76b2c25628d8bda88747758149c42e3bc13f85bc +Test: Verify +Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +MAC: cb34f0937e8d870d3bd7ff6311765f2c229a6c2154e4db119538db5159437cab +Test: Verify +Key: "The " +Message: "quick brown fox jumps over the lazy dog" +MAC: 8fa7dadce0110f979a0b795e76b2c25628d8bda88747758149c42e3bc13f85bc +Test: Verify + +AlgorithmType: SymmetricCipher +Source: generated by Crypto++ 5.2.1 +Key: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f +IV: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f +Name: Panama-LE +Plaintext: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f +Ciphertext: F07F5FF2CCD01A0A7D44ACD6D239C2AF0DA1FF35275BAF5DFA6E09411B79D8B9 +Test: Encrypt +Name: Panama-BE +Plaintext: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f +Ciphertext: E12E2F6BA41AE832D888DA9FA6863BC37C0E996F190A1711330322D37BD98CA4 +Test: Encrypt diff --git a/cryptopp/TestVectors/rsa_oaep.txt b/cryptopp/TestVectors/rsa_oaep.txt new file mode 100644 index 0000000..4e4cdd3 --- /dev/null +++ b/cryptopp/TestVectors/rsa_oaep.txt @@ -0,0 +1,1765 @@ +AlgorithmType: AsymmetricCipher +Name: RSA/OAEP-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 1: A 1024-bit RSA Key Pair +Modulus: \ +a8 b3 b2 84 af 8e b5 0b 38 70 34 a8 60 f1 46 c4 \ +91 9f 31 87 63 cd 6c 55 98 c8 ae 48 11 a1 e0 ab \ +c4 c7 e0 b0 82 d6 93 a5 e7 fc ed 67 5c f4 66 85 \ +12 77 2c 0c bc 64 a7 42 c6 c6 30 f5 33 c8 cc 72 \ +f6 2a e8 33 c4 0b f2 58 42 e9 84 bb 78 bd bf 97 \ +c0 10 7d 55 bd b6 62 f5 c4 e0 fa b9 84 5c b5 14 \ +8e f7 39 2d d3 aa ff 93 ae 1e 6b 66 7b b3 d4 24 \ +76 16 d4 f5 ba 10 d4 cf d2 26 de 88 d3 9f 16 fb +PublicExponent: 01 00 01 +PrivateExponent: \ +53 33 9c fd b7 9f c8 46 6a 65 5c 73 16 ac a8 5c \ +55 fd 8f 6d d8 98 fd af 11 95 17 ef 4f 52 e8 fd \ +8e 25 8d f9 3f ee 18 0f a0 e4 ab 29 69 3c d8 3b \ +15 2a 55 3d 4a c4 d1 81 2b 8b 9f a5 af 0e 7f 55 \ +fe 73 04 df 41 57 09 26 f3 31 1f 15 c4 d6 5a 73 \ +2c 48 31 16 ee 3d 3d 2d 0a f3 54 9a d9 bf 7c bf \ +b7 8a d8 84 f8 4d 5b eb 04 72 4d c7 36 9b 31 de \ +f3 7d 0c f5 39 e9 cf cd d3 de 65 37 29 ea d5 d1 +Prime1: \ +d3 27 37 e7 26 7f fe 13 41 b2 d5 c0 d1 50 a8 1b \ +58 6f b3 13 2b ed 2f 8d 52 62 86 4a 9c b9 f3 0a \ +f3 8b e4 48 59 8d 41 3a 17 2e fb 80 2c 21 ac f1 \ +c1 1c 52 0c 2f 26 a4 71 dc ad 21 2e ac 7c a3 9d +Prime2: \ +cc 88 53 d1 d5 4d a6 30 fa c0 04 f4 71 f2 81 c7 \ +b8 98 2d 82 24 a4 90 ed be b3 3d 3e 3d 5c c9 3c \ +47 65 70 3d 1d d7 91 64 2f 1f 11 6a 0d d8 52 be \ +24 19 b2 af 72 bf e9 a0 30 e8 60 b0 28 8b 5d 77 +ModPrime1PrivateExponent: \ +0e 12 bf 17 18 e9 ce f5 59 9b a1 c3 88 2f e8 04 \ +6a 90 87 4e ef ce 8f 2c cc 20 e4 f2 74 1f b0 a3 \ +3a 38 48 ae c9 c9 30 5f be cb d2 d7 68 19 96 7d \ +46 71 ac c6 43 1e 40 37 96 8d b3 78 78 e6 95 c1 +ModPrime2PrivateExponent: \ +95 29 7b 0f 95 a2 fa 67 d0 07 07 d6 09 df d4 fc \ +05 c8 9d af c2 ef 6d 6e a5 5b ec 77 1e a3 33 73 \ +4d 92 51 e7 90 82 ec da 86 6e fe f1 3c 45 9e 1a \ +63 13 86 b7 e3 54 c8 99 f5 f1 12 ca 85 d7 15 83 +MultiplicativeInverseOfPrime2ModPrime1: \ +4f 45 6c 50 24 93 bd c0 ed 2a b7 56 a3 a6 ed 4d \ +67 35 2a 69 7d 42 16 e9 32 12 b1 27 a6 3d 54 11 \ +ce 6f a9 8d 5d be fd 73 26 3e 37 28 14 27 43 81 \ +81 66 ed 7d d6 36 87 dd 2a 8c a1 d2 f4 fb d8 e1 +Test: KeyPairValidAndConsistent +Comment: RSAES-OAEP Encryption Example 1.1 +Plaintext: \ +66 28 19 4e 12 07 3d b0 3b a9 4c da 9e f9 53 23 \ +97 d5 0d ba 79 b9 87 00 4a fe fe 34 +Seed: # not used yet\ +18 b7 76 ea 21 06 9d 69 77 6a 33 e9 6b ad 48 e1 \ +dd a0 a5 ef +Ciphertext: \ +35 4f e6 7b 4a 12 6d 5d 35 fe 36 c7 77 79 1a 3f \ +7b a1 3d ef 48 4e 2d 39 08 af f7 22 fa d4 68 fb \ +21 69 6d e9 5d 0b e9 11 c2 d3 17 4f 8a fc c2 01 \ +03 5f 7b 6d 8e 69 40 2d e5 45 16 18 c2 1a 53 5f \ +a9 d7 bf c5 b8 dd 9f c2 43 f8 cf 92 7d b3 13 22 \ +d6 e8 81 ea a9 1a 99 61 70 e6 57 a0 5a 26 64 26 \ +d9 8c 88 00 3f 84 77 c1 22 70 94 a0 d9 fa 1e 8c \ +40 24 30 9c e1 ec cc b5 21 00 35 d4 7a c7 2e 8a +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 1.2 +Plaintext: \ +75 0c 40 47 f5 47 e8 e4 14 11 85 65 23 29 8a c9\ +ba e2 45 ef af 13 97 fb e5 6f 9d d5 +Seed: # not used yet\ +0c c7 42 ce 4a 9b 7f 32 f9 51 bc b2 51 ef d9 25\ +fe 4f e3 5f +Ciphertext: \ +64 0d b1 ac c5 8e 05 68 fe 54 07 e5 f9 b7 01 df\ +f8 c3 c9 1e 71 6c 53 6f c7 fc ec 6c b5 b7 1c 11\ +65 98 8d 4a 27 9e 15 77 d7 30 fc 7a 29 93 2e 3f\ +00 c8 15 15 23 6d 8d 8e 31 01 7a 7a 09 df 43 52\ +d9 04 cd eb 79 aa 58 3a dc c3 1e a6 98 a4 c0 52\ +83 da ba 90 89 be 54 91 f6 7c 1a 4e e4 8d c7 4b\ +bb e6 64 3a ef 84 66 79 b4 cb 39 5a 35 2d 5e d1\ +15 91 2d f6 96 ff e0 70 29 32 94 6d 71 49 2b 44 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 1.3 +Plaintext: \ +d9 4a e0 83 2e 64 45 ce 42 33 1c b0 6d 53 1a 82\ +b1 db 4b aa d3 0f 74 6d c9 16 df 24 d4 e3 c2 45\ +1f ff 59 a6 42 3e b0 e1 d0 2d 4f e6 46 cf 69 9d\ +fd 81 8c 6e 97 b0 51 +Seed: # not used yet\ +25 14 df 46 95 75 5a 67 b2 88 ea f4 90 5c 36 ee\ +c6 6f d2 fd +Ciphertext: \ +42 37 36 ed 03 5f 60 26 af 27 6c 35 c0 b3 74 1b\ +36 5e 5f 76 ca 09 1b 4e 8c 29 e2 f0 be fe e6 03\ +59 5a a8 32 2d 60 2d 2e 62 5e 95 eb 81 b2 f1 c9\ +72 4e 82 2e ca 76 db 86 18 cf 09 c5 34 35 03 a4\ +36 08 35 b5 90 3b c6 37 e3 87 9f b0 5e 0e f3 26\ +85 d5 ae c5 06 7c d7 cc 96 fe 4b 26 70 b6 ea c3\ +06 6b 1f cf 56 86 b6 85 89 aa fb 7d 62 9b 02 d8\ +f8 62 5c a3 83 36 24 d4 80 0f b0 81 b1 cf 94 eb +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 1.4 +Plaintext: \ +52 e6 50 d9 8e 7f 2a 04 8b 4f 86 85 21 53 b9 7e\ +01 dd 31 6f 34 6a 19 f6 7a 85 +Seed: # not used yet\ +c4 43 5a 3e 1a 18 a6 8b 68 20 43 62 90 a3 7c ef\ +b8 5d b3 fb +Ciphertext: \ +45 ea d4 ca 55 1e 66 2c 98 00 f1 ac a8 28 3b 05\ +25 e6 ab ae 30 be 4b 4a ba 76 2f a4 0f d3 d3 8e\ +22 ab ef c6 97 94 f6 eb bb c0 5d db b1 12 16 24\ +7d 2f 41 2f d0 fb a8 7c 6e 3a cd 88 88 13 64 6f\ +d0 e4 8e 78 52 04 f9 c3 f7 3d 6d 82 39 56 27 22\ +dd dd 87 71 fe c4 8b 83 a3 1e e6 f5 92 c4 cf d4\ +bc 88 17 4f 3b 13 a1 12 aa e3 b9 f7 b8 0e 0f c6\ +f7 25 5b a8 80 dc 7d 80 21 e2 2a d6 a8 5f 07 55 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 1.5 +Plaintext: \ +8d a8 9f d9 e5 f9 74 a2 9f ef fb 46 2b 49 18 0f\ +6c f9 e8 02 +Seed: # not used yet\ +b3 18 c4 2d f3 be 0f 83 fe a8 23 f5 a7 b4 7e d5\ +e4 25 a3 b5 +Ciphertext: \ +36 f6 e3 4d 94 a8 d3 4d aa cb a3 3a 21 39 d0 0a\ +d8 5a 93 45 a8 60 51 e7 30 71 62 00 56 b9 20 e2\ +19 00 58 55 a2 13 a0 f2 38 97 cd cd 73 1b 45 25\ +7c 77 7f e9 08 20 2b ef dd 0b 58 38 6b 12 44 ea\ +0c f5 39 a0 5d 5d 10 32 9d a4 4e 13 03 0f d7 60\ +dc d6 44 cf ef 20 94 d1 91 0d 3f 43 3e 1c 7c 6d\ +d1 8b c1 f2 df 7f 64 3d 66 2f b9 dd 37 ea d9 05\ +91 90 f4 fa 66 ca 39 e8 69 c4 eb 44 9c bd c4 39 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 1.6 +Plaintext: \ +26 52 10 50 84 42 71 +Seed: # not used yet\ +e4 ec 09 82 c2 33 6f 3a 67 7f 6a 35 61 74 eb 0c\ +e8 87 ab c2 +Ciphertext: \ +42 ce e2 61 7b 1e ce a4 db 3f 48 29 38 6f bd 61\ +da fb f0 38 e1 80 d8 37 c9 63 66 df 24 c0 97 b4\ +ab 0f ac 6b df 59 0d 82 1c 9f 10 64 2e 68 1a d0\ +5b 8d 78 b3 78 c0 f4 6c e2 fa d6 3f 74 e0 ad 3d\ +f0 6b 07 5d 7e b5 f5 63 6f 8d 40 3b 90 59 ca 76\ +1b 5c 62 bb 52 aa 45 00 2e a7 0b aa ce 08 de d2\ +43 b9 d8 cb d6 2a 68 ad e2 65 83 2b 56 56 4e 43\ +a6 fa 42 ed 19 9a 09 97 69 74 2d f1 53 9e 82 55 +Test: DecryptMatch + +AlgorithmType: AsymmetricCipher +Name: RSA/OAEP-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 2: A 1025-bit RSA Key Pair +Modulus: \ +01 94 7c 7f ce 90 42 5f 47 27 9e 70 85 1f 25 d5\ +e6 23 16 fe 8a 1d f1 93 71 e3 e6 28 e2 60 54 3e\ +49 01 ef 60 81 f6 8c 0b 81 41 19 0d 2a e8 da ba\ +7d 12 50 ec 6d b6 36 e9 44 ec 37 22 87 7c 7c 1d\ +0a 67 f1 4b 16 94 c5 f0 37 94 51 a4 3e 49 a3 2d\ +de 83 67 0b 73 da 91 a1 c9 9b c2 3b 43 6a 60 05\ +5c 61 0f 0b af 99 c1 a0 79 56 5b 95 a3 f1 52 66\ +32 d1 d4 da 60 f2 0e da 25 e6 53 c4 f0 02 76 6f\ +45 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +08 23 f2 0f ad b5 da 89 08 8a 9d 00 89 3e 21 fa\ +4a 1b 11 fb c9 3c 64 a3 be 0b aa ea 97 fb 3b 93\ +c3 ff 71 37 04 c1 9c 96 3c 1d 10 7a ae 99 05 47\ +39 f7 9e 02 e1 86 de 86 f8 7a 6d de fe a6 d8 cc\ +d1 d3 c8 1a 47 bf a7 25 5b e2 06 01 a4 a4 b2 f0\ +8a 16 7b 5e 27 9d 71 5b 1b 45 5b dd 7e ab 24 59\ +41 d9 76 8b 9a ce fb 3c cd a5 95 2d a3 ce e7 25\ +25 b4 50 16 63 a8 ee 15 c9 e9 92 d9 24 62 fe 39 +Prime1: \ +01 59 db de 04 a3 3e f0 6f b6 08 b8 0b 19 0f 4d\ +3e 22 bc c1 3a c8 e4 a0 81 03 3a bf a4 16 ed b0\ +b3 38 aa 08 b5 73 09 ea 5a 52 40 e7 dc 6e 54 37\ +8c 69 41 4c 31 d9 7d db 1f 40 6d b3 76 9c c4 1a\ +43 +Prime2: \ +01 2b 65 2f 30 40 3b 38 b4 09 95 fd 6f f4 1a 1a\ +cc 8a da 70 37 32 36 b7 20 2d 39 b2 ee 30 cf b4\ +6d b0 95 11 f6 f3 07 cc 61 cc 21 60 6c 18 a7 5b\ +8a 62 f8 22 df 03 1b a0 df 0d af d5 50 6f 56 8b\ +d7 +ModPrime1PrivateExponent: \ +43 6e f5 08 de 73 65 19 c2 da 4c 58 0d 98 c8 2c\ +b7 45 2a 3f b5 ef ad c3 b9 c7 78 9a 1b c6 58 4f\ +79 5a dd bb d3 24 39 c7 46 86 55 2e cb 6c 2c 30\ +7a 4d 3a f7 f5 39 ee c1 57 24 8c 7b 31 f1 a2 55 +ModPrime2PrivateExponent: \ +01 2b 15 a8 9f 3d fb 2b 39 07 3e 73 f0 2b dd 0c\ +1a 7b 37 9d d4 35 f0 5c dd e2 ef f9 e4 62 94 8b\ +7c ec 62 ee 90 50 d5 e0 81 6e 07 85 a8 56 b4 91\ +08 dc b7 5f 36 83 87 4d 1c a6 32 9a 19 01 30 66\ +ff +MultiplicativeInverseOfPrime2ModPrime1: \ +02 70 db 17 d5 91 4b 01 8d 76 11 8b 24 38 9a 73\ +50 ec 83 6b 00 63 a2 17 21 23 6f d8 ed b6 d8 9b\ +51 e7 ee b8 7b 61 1b 71 32 cb 7e a7 35 6c 23 15\ +1c 1e 77 51 50 7c 78 6d 9e e1 79 41 70 a8 c8 e8 +Test: KeyPairValidAndConsistent +Comment: RSAES-OAEP Encryption Example 2.1 +Plaintext: \ +8f f0 0c aa 60 5c 70 28 30 63 4d 9a 6c 3d 42 c6\ +52 b5 8c f1 d9 2f ec 57 0b ee e7 +Seed: # not used yet\ +8c 40 7b 5e c2 89 9e 50 99 c5 3e 8c e7 93 bf 94\ +e7 1b 17 82 +Ciphertext: \ +01 81 af 89 22 b9 fc b4 d7 9d 92 eb e1 98 15 99\ +2f c0 c1 43 9d 8b cd 49 13 98 a0 f4 ad 3a 32 9a\ +5b d9 38 55 60 db 53 26 83 c8 b7 da 04 e4 b1 2a\ +ed 6a ac df 47 1c 34 c9 cd a8 91 ad dc c2 df 34\ +56 65 3a a6 38 2e 9a e5 9b 54 45 52 57 eb 09 9d\ +56 2b be 10 45 3f 2b 6d 13 c5 9c 02 e1 0f 1f 8a\ +bb 5d a0 d0 57 09 32 da cf 2d 09 01 db 72 9d 0f\ +ef cc 05 4e 70 96 8e a5 40 c8 1b 04 bc ae fe 72\ +0e +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 2.2 +Plaintext: \ +2d +Seed: # not used yet\ +b6 00 cf 3c 2e 50 6d 7f 16 77 8c 91 0d 3a 8b 00\ +3e ee 61 d5 +Ciphertext: \ +01 87 59 ff 1d f6 3b 27 92 41 05 62 31 44 16 a8\ +ae af 2a c6 34 b4 6f 94 0a b8 2d 64 db f1 65 ee\ +e3 30 11 da 74 9d 4b ab 6e 2f cd 18 12 9c 9e 49\ +27 7d 84 53 11 2b 42 9a 22 2a 84 71 b0 70 99 39\ +98 e7 58 86 1c 4d 3f 6d 74 9d 91 c4 29 0d 33 2c\ +7a 4a b3 f7 ea 35 ff 3a 07 d4 97 c9 55 ff 0f fc\ +95 00 6b 62 c6 d2 96 81 0d 9b fa b0 24 19 6c 79\ +34 01 2c 2d f9 78 ef 29 9a ba 23 99 40 cb a1 02\ +45 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 2.3 +Plaintext: \ +74 fc 88 c5 1b c9 0f 77 af 9d 5e 9a 4a 70 13 3d\ +4b 4e 0b 34 da 3c 37 c7 ef 8e +Seed: # not used yet\ +a7 37 68 ae ea a9 1f 9d 8c 1e d6 f9 d2 b6 34 67\ +f0 7c ca e3 +Ciphertext: \ +01 88 02 ba b0 4c 60 32 5e 81 c4 96 23 11 f2 be\ +7c 2a dc e9 30 41 a0 07 19 c8 8f 95 75 75 f2 c7\ +9f 1b 7b c8 ce d1 15 c7 06 b3 11 c0 8a 2d 98 6c\ +a3 b6 a9 33 6b 14 7c 29 c6 f2 29 40 9d de c6 51\ +bd 1f dd 5a 0b 7f 61 0c 99 37 fd b4 a3 a7 62 36\ +4b 8b 32 06 b4 ea 48 5f d0 98 d0 8f 63 d4 aa 8b\ +b2 69 7d 02 7b 75 0c 32 d7 f7 4e af 51 80 d2 e9\ +b6 6b 17 cb 2f a5 55 23 bc 28 0d a1 0d 14 be 20\ +53 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 2.4 +Plaintext: \ +a7 eb 2a 50 36 93 1d 27 d4 e8 91 32 6d 99 69 2f\ +fa dd a9 bf 7e fd 3e 34 e6 22 c4 ad c0 85 f7 21\ +df e8 85 07 2c 78 a2 03 b1 51 73 9b e5 40 fa 8c\ +15 3a 10 f0 0a +Seed: # not used yet\ +9a 7b 3b 0e 70 8b d9 6f 81 90 ec ab 4f b9 b2 b3\ +80 5a 81 56 +Ciphertext: \ +00 a4 57 8c bc 17 63 18 a6 38 fb a7 d0 1d f1 57\ +46 af 44 d4 f6 cd 96 d7 e7 c4 95 cb f4 25 b0 9c\ +64 9d 32 bf 88 6d a4 8f ba f9 89 a2 11 71 87 ca\ +fb 1f b5 80 31 76 90 e3 cc d4 46 92 0b 7a f8 2b\ +31 db 58 04 d8 7d 01 51 4a cb fa 91 56 e7 82 f8\ +67 f6 be d9 44 9e 0e 9a 2c 09 bc ec c6 aa 08 76\ +36 96 5e 34 b3 ec 76 6f 2f e2 e4 30 18 a2 fd de\ +b1 40 61 6a 0e 9d 82 e5 33 10 24 ee 06 52 fc 76\ +41 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 2.5 +Plaintext: \ +2e f2 b0 66 f8 54 c3 3f 3b dc bb 59 94 a4 35 e7\ +3d 6c 6c +Seed: # not used yet\ +eb 3c eb bc 4a dc 16 bb 48 e8 8c 8a ec 0e 34 af\ +7f 42 7f d3 +Ciphertext: \ +00 eb c5 f5 fd a7 7c fd ad 3c 83 64 1a 90 25 e7\ +7d 72 d8 a6 fb 33 a8 10 f5 95 0f 8d 74 c7 3e 8d\ +93 1e 86 34 d8 6a b1 24 62 56 ae 07 b6 00 5b 71\ +b7 f2 fb 98 35 12 18 33 1c e6 9b 8f fb dc 9d a0\ +8b bc 9c 70 4f 87 6d eb 9d f9 fc 2e c0 65 ca d8\ +7f 90 90 b0 7a cc 17 aa 7f 99 7b 27 ac a4 88 06\ +e8 97 f7 71 d9 51 41 fe 45 26 d8 a5 30 1b 67 86\ +27 ef ab 70 7f d4 0f be bd 6e 79 2a 25 61 3e 7a\ +ec +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 2.6 +Plaintext: \ +8a 7f b3 44 c8 b6 cb 2c f2 ef 1f 64 3f 9a 32 18\ +f6 e1 9b ba 89 c0 +Seed: # not used yet\ +4c 45 cf 4d 57 c9 8e 3d 6d 20 95 ad c5 1c 48 9e\ +b5 0d ff 84 +Ciphertext: \ +01 08 39 ec 20 c2 7b 90 52 e5 5b ef b9 b7 7e 6f\ +c2 6e 90 75 d7 a5 43 78 c6 46 ab df 51 e4 45 bd\ +57 15 de 81 78 9f 56 f1 80 3d 91 70 76 4a 9e 93\ +cb 78 79 86 94 02 3e e7 39 3c e0 4b c5 d8 f8 c5\ +a5 2c 17 1d 43 83 7e 3a ca 62 f6 09 eb 0a a5 ff\ +b0 96 0e f0 41 98 dd 75 4f 57 f7 fb e6 ab f7 65\ +cf 11 8b 4c a4 43 b2 3b 5a ab 26 6f 95 23 26 ac\ +45 81 10 06 44 32 5f 8b 72 1a cd 5d 04 ff 14 ef\ +3a +Test: DecryptMatch + +AlgorithmType: AsymmetricCipher +Name: RSA/OAEP-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 3: A 1026-bit RSA Key Pair +Modulus: \ +02 b5 8f ec 03 9a 86 07 00 a4 d7 b6 46 2f 93 e6\ +cd d4 91 16 1d dd 74 f4 e8 10 b4 0e 3c 16 52 00\ +6a 5c 27 7b 27 74 c1 13 05 a4 cb ab 5a 78 ef a5\ +7e 17 a8 6d f7 a3 fa 36 fc 4b 1d 22 49 f2 2e c7\ +c2 dd 6a 46 32 32 ac ce a9 06 d6 6e be 80 b5 70\ +4b 10 72 9d a6 f8 33 23 4a bb 5e fd d4 a2 92 cb\ +fa d3 3b 4d 33 fa 7a 14 b8 c3 97 b5 6e 3a cd 21\ +20 34 28 b7 7c df a3 3a 6d a7 06 b3 d8 b0 fc 43\ +e9 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +15 b4 8a 5b 56 83 a9 46 70 e2 3b 57 18 f8 14 fa\ +0e 13 f8 50 38 f5 07 11 18 2c ba 61 51 05 81 f3\ +d2 2c 7e 23 2e f9 37 e2 2e 55 1d 68 b8 6e 2f 8c\ +b1 aa d8 be 2e 48 8f 5d f7 ef d2 79 e3 f5 68 d4\ +ea f3 6f 80 cf 71 41 ac e6 0f cc 91 13 fb 6c 4a\ +84 1f d5 0b bc 7c 51 2f fc be ff 21 48 7a a8 11\ +eb 3c a8 c6 20 05 34 6a 86 de 86 bf a1 d8 a9 48\ +fd 3f 34 8c 22 ea ad f3 33 c3 ce 6c e1 32 08 fd +Prime1: \ +01 bf 01 d2 16 d7 35 95 cf 02 70 c2 be b7 8d 40\ +a0 d8 44 7d 31 da 91 9a 98 3f 7e ea 78 1b 77 d8\ +5f e3 71 b3 e9 37 3e 7b 69 21 7d 31 50 a0 2d 89\ +58 de 7f ad 9d 55 51 60 95 8b 44 54 12 7e 0e 7e\ +af +Prime2: \ +01 8d 33 99 65 81 66 db 38 29 81 6d 7b 29 54 16\ +75 9e 9c 91 98 7f 5b 2d 8a ec d6 3b 04 b4 8b d7\ +b2 fc f2 29 bb 7f 8a 6d c8 8b a1 3d d2 e3 9a d5\ +5b 6d 1a 06 16 07 08 f9 70 0b e8 0b 8f d3 74 4c\ +e7 +ModPrime1PrivateExponent: \ +06 c0 a2 49 d2 0a 6f 2e e7 5c 88 b4 94 d5 3f 6a\ +ae 99 aa 42 7c 88 c2 8b 16 3a 76 94 45 e5 f3 90\ +cf 40 c2 74 fd 6e a6 32 9a 5c e7 c7 ce 03 a2 15\ +83 96 ee 2a 78 45 78 6e 09 e2 88 5a 97 28 e4 e5 +ModPrime2PrivateExponent: \ +d1 d2 7c 29 fe dd 92 d8 6c 34 8e dd 0c cb fa c1\ +4f 74 6e 05 1c e1 d1 81 1d f3 5d 61 f2 ee 1c 97\ +d4 bf 28 04 80 2f 64 27 18 7b a8 e9 0a 8a f4 42\ +43 b4 07 9b 03 44 5e 60 2e 29 fa 51 93 e6 4f e9 +MultiplicativeInverseOfPrime2ModPrime1: \ +8c b2 f7 56 bd 89 41 b1 d3 b7 70 e5 ad 31 ee 37\ +3b 28 ac da 69 ff 9b 6f 40 fe 57 8b 9f 1a fb 85\ +83 6f 96 27 d3 7a cf f7 3c 27 79 e6 34 bb 26 01\ +1c 2c 8f 7f 33 61 ae 2a 9e a6 5e d6 89 e3 63 9a +Test: KeyPairValidAndConsistent +Comment: RSAES-OAEP Encryption Example 3.1 +Plaintext: \ +08 78 20 b5 69 e8 fa 8d +Seed: # not used yet\ +8c ed 6b 19 62 90 80 57 90 e9 09 07 40 15 e6 a2\ +0b 0c 48 94 +Ciphertext: \ +02 6a 04 85 d9 6a eb d9 6b 43 82 08 50 99 b9 62\ +e6 a2 bd ec 3d 90 c8 db 62 5e 14 37 2d e8 5e 2d\ +5b 7b aa b6 5c 8f af 91 bb 55 04 fb 49 5a fc e5\ +c9 88 b3 f6 a5 2e 20 e1 d6 cb d3 56 6c 5c d1 f2\ +b8 31 8b b5 42 cc 0e a2 5c 4a ab 99 32 af a2 07\ +60 ea dd ec 78 43 96 a0 7e a0 ef 24 d4 e6 f4 d3\ +7e 50 52 a7 a3 1e 14 6a a4 80 a1 11 bb e9 26 40\ +13 07 e0 0f 41 00 33 84 2b 6d 82 fe 5c e4 df ae\ +80 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 3.2 +Plaintext: \ +46 53 ac af 17 19 60 b0 1f 52 a7 be 63 a3 ab 21\ +dc 36 8e c4 3b 50 d8 2e c3 78 1e 04 +Seed: # not used yet\ +b4 29 1d 65 67 55 08 48 cc 15 69 67 c8 09 ba ab\ +6c a5 07 f0 +Ciphertext: \ +02 4d b8 9c 78 02 98 9b e0 78 38 47 86 30 84 94\ +1b f2 09 d7 61 98 7e 38 f9 7c b5 f6 f1 bc 88 da\ +72 a5 0b 73 eb af 11 c8 79 c4 f9 5d f3 7b 85 0b\ +8f 65 d7 62 2e 25 b1 b8 89 e8 0f e8 0b ac a2 06\ +9d 6e 0e 1d 82 99 53 fc 45 90 69 de 98 ea 97 98\ +b4 51 e5 57 e9 9a bf 8f e3 d9 cc f9 09 6e bb f3\ +e5 25 5d 3b 4e 1c 6d 2e ca df 06 7a 35 9e ea 86\ +40 5a cd 47 d5 e1 65 51 7c ca fd 47 d6 db ee 4b\ +f5 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 3.3 +Plaintext: \ +d9 4c d0 e0 8f a4 04 ed 89 +Seed: # not used yet\ +ce 89 28 f6 05 95 58 25 40 08 ba dd 97 94 fa dc\ +d2 fd 1f 65 +Ciphertext: \ +02 39 bc e6 81 03 24 41 52 88 77 d6 d1 c8 bb 28\ +aa 3b c9 7f 1d f5 84 56 36 18 99 57 97 68 38 44\ +ca 86 66 47 32 f4 be d7 a0 aa b0 83 aa ab fb 72\ +38 f5 82 e3 09 58 c2 02 4e 44 e5 70 43 b9 79 50\ +fd 54 3d a9 77 c9 0c dd e5 33 7d 61 84 42 f9 9e\ +60 d7 78 3a b5 9c e6 dd 9d 69 c4 7a d1 e9 62 be\ +c2 2d 05 89 5c ff 8d 3f 64 ed 52 61 d9 2b 26 78\ +51 03 93 48 49 90 ba 3f 7f 06 81 8a e6 ff ce 8a\ +3a +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 3.4 +Plaintext: \ +6c c6 41 b6 b6 1e 6f 96 39 74 da d2 3a 90 13 28\ +4e f1 +Seed: # not used yet\ +6e 29 79 f5 2d 68 14 a5 7d 83 b0 90 05 48 88 f1\ +19 a5 b9 a3 +Ciphertext: \ +02 99 4c 62 af d7 6f 49 8b a1 fd 2c f6 42 85 7f\ +ca 81 f4 37 3c b0 8f 1c ba ee 6f 02 5c 3b 51 2b\ +42 c3 e8 77 91 13 47 66 48 03 9d be 04 93 f9 24\ +62 92 fa c2 89 50 60 0e 7c 0f 32 ed f9 c8 1b 9d\ +ec 45 c3 bd e0 cc 8d 88 47 59 01 69 90 7b 7d c5\ +99 1c eb 29 bb 07 14 d6 13 d9 6d f0 f1 2e c5 d8\ +d3 50 7c 8e e7 ae 78 dd 83 f2 16 fa 61 de 10 03\ +63 ac a4 8a 7e 91 4a e9 f4 2d df be 94 3b 09 d9\ +a0 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 3.5 +Plaintext: \ +df 51 51 83 2b 61 f4 f2 58 91 fb 41 72 f3 28 d2\ +ed df 83 71 ff cf db e9 97 93 92 95 f3 0e ca 69\ +18 01 7c fd a1 15 3b f7 a6 af 87 59 32 23 +Seed: # not used yet\ +2d 76 0b fe 38 c5 9d e3 4c dc 8b 8c 78 a3 8e 66\ +28 4a 2d 27 +Ciphertext: \ +01 62 04 2f f6 96 95 92 a6 16 70 31 81 1a 23 98\ +34 ce 63 8a bf 54 fe c8 b9 94 78 12 2a fe 2e e6\ +7f 8c 5b 18 b0 33 98 05 bf db c5 a4 e6 72 0b 37\ +c5 9c fb a9 42 46 4c 59 7f f5 32 a1 19 82 15 45\ +fd 2e 59 b1 14 e6 1d af 71 82 05 29 f5 02 9c f5\ +24 95 43 27 c3 4e c5 e6 f5 ba 7e fc c4 de 94 3a\ +b8 ad 4e d7 87 b1 45 43 29 f7 0d b7 98 a3 a8 f4\ +d9 2f 82 74 e2 b2 94 8a de 62 7c e8 ee 33 e4 3c\ +60 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 3.6 +Plaintext: \ +3c 3b ad 89 3c 54 4a 6d 52 0a b0 22 31 91 88 c8\ +d5 04 b7 a7 88 b8 50 90 3b 85 97 2e aa 18 55 2e\ +11 34 a7 ad 60 98 82 62 54 ff 7a b6 72 b3 d8 eb\ +31 58 fa c6 d4 cb ae f1 +Seed: # not used yet\ +f1 74 77 9c 5f d3 cf e0 07 ba dc b7 a3 6c 9b 55\ +bf cf bf 0e +Ciphertext: \ +00 11 20 51 e7 5d 06 49 43 bc 44 78 07 5e 43 48\ +2f d5 9c ee 06 79 de 68 93 ee c3 a9 43 da a4 90\ +b9 69 1c 93 df c0 46 4b 66 23 b9 f3 db d3 e7 00\ +83 26 4f 03 4b 37 4f 74 16 4e 1a 00 76 37 25 e5\ +74 74 4b a0 b9 db 83 43 4f 31 df 96 f6 e2 a2 6f\ +6d 8e ba 34 8b d4 68 6c 22 38 ac 07 c3 7a ac 37\ +85 d1 c7 ee a2 f8 19 fd 91 49 17 98 ed 8e 9c ef\ +5e 43 b7 81 b0 e0 27 6e 37 c4 3f f9 49 2d 00 57\ +30 +Test: DecryptMatch + +AlgorithmType: AsymmetricCipher +Name: RSA/OAEP-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 4: A 1027-bit RSA Key Pair +Modulus: \ +05 12 40 b6 cc 00 04 fa 48 d0 13 46 71 c0 78 c7\ +c8 de c3 b3 e2 f2 5b c2 56 44 67 33 9d b3 88 53\ +d0 6b 85 ee a5 b2 de 35 3b ff 42 ac 2e 46 bc 97\ +fa e6 ac 96 18 da 95 37 a5 c8 f5 53 c1 e3 57 62\ +59 91 d6 10 8d cd 78 85 fb 3a 25 41 3f 53 ef ca\ +d9 48 cb 35 cd 9b 9a e9 c1 c6 76 26 d1 13 d5 7d\ +de 4c 5b ea 76 bb 5b b7 de 96 c0 0d 07 37 2e 96\ +85 a6 d7 5c f9 d2 39 fa 14 8d 70 93 1b 5f 3f b0\ +39 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +04 11 ff ca 3b 7c a5 e9 e9 be 7f e3 8a 85 10 5e\ +35 38 96 db 05 c5 79 6a ec d2 a7 25 16 1e b3 65\ +1c 86 29 a9 b8 62 b9 04 d7 b0 c7 b3 7f 8c b5 a1\ +c2 b5 40 01 01 8a 00 a1 eb 2c af e4 ee 4e 94 92\ +c3 48 bc 2b ed ab 4b 9e bb f0 64 e8 ef f3 22 b9\ +00 9f 8e ec 65 39 05 f4 0d f8 8a 3c dc 49 d4 56\ +7f 75 62 7d 41 ac a6 24 12 9b 46 a0 b7 c6 98 e5\ +e6 5f 2b 7b a1 02 c7 49 a1 01 35 b6 54 0d 04 01 +Prime1: \ +02 74 58 c1 9e c1 63 69 19 e7 36 c9 af 25 d6 09\ +a5 1b 8f 56 1d 19 c6 bf 69 43 dd 1e e1 ab 8a 4a\ +3f 23 21 00 bd 40 b8 8d ec c6 ba 23 55 48 b6 ef\ +79 2a 11 c9 de 82 3d 0a 79 22 c7 09 5b 6e ba 57\ +01 +Prime2: \ +02 10 ee 9b 33 ab 61 71 6e 27 d2 51 bd 46 5f 4b\ +35 a1 a2 32 e2 da 00 90 1c 29 4b f2 23 50 ce 49\ +0d 09 9f 64 2b 53 75 61 2d b6 3b a1 f2 03 86 49\ +2b f0 4d 34 b3 c2 2b ce b9 09 d1 34 41 b5 3b 51\ +39 +ModPrime1PrivateExponent: \ +39 fa 02 8b 82 6e 88 c1 12 1b 75 0a 8b 24 2f a9\ +a3 5c 5b 66 bd fd 1f a6 37 d3 cc 48 a8 4a 4f 45\ +7a 19 4e 77 27 e4 9f 7b cc 6e 5a 5a 41 26 57 fc\ +47 0c 73 22 eb c3 74 16 ef 45 8c 30 7a 8c 09 01 +ModPrime2PrivateExponent: \ +01 5d 99 a8 41 95 94 39 79 fa 9e 1b e2 c3 c1 b6\ +9f 43 2f 46 fd 03 e4 7d 5b ef bb bf d6 b1 d1 37\ +1d 83 ef b3 30 a3 e0 20 94 2b 2f ed 11 5e 5d 02\ +be 24 fd 92 c9 01 9d 1c ec d6 dd 4c f1 e5 4c c8\ +99 +MultiplicativeInverseOfPrime2ModPrime1: \ +01 f0 b7 01 51 70 b3 f5 e4 22 23 ba 30 30 1c 41\ +a6 d8 7c bb 70 e3 0c b7 d3 c6 7d 25 47 3d b1 f6\ +cb f0 3e 3f 91 26 e3 e9 79 68 27 9a 86 5b 2c 2b\ +42 65 24 cf c5 2a 68 3d 31 ed 30 eb 98 4b e4 12\ +ba +Test: KeyPairValidAndConsistent +Comment: RSAES-OAEP Encryption Example 4.1 +Plaintext: \ +4a 86 60 95 34 ee 43 4a 6c bc a3 f7 e9 62 e7 6d\ +45 5e 32 64 c1 9f 60 5f 6e 5f f6 13 7c 65 c5 6d\ +7f b3 44 cd 52 bc 93 37 4f 3d 16 6c 9f 0c 6f 9c\ +50 6b ad 19 33 09 72 d2 +Seed: # not used yet\ +1c ac 19 ce 99 3d ef 55 f9 82 03 f6 85 28 96 c9\ +5c cc a1 f3 +Ciphertext: \ +04 cc e1 96 14 84 5e 09 41 52 a3 fe 18 e5 4e 33\ +30 c4 4e 5e fb c6 4a e1 68 86 cb 18 69 01 4c c5\ +78 1b 1f 8f 9e 04 53 84 d0 11 2a 13 5c a0 d1 2e\ +9c 88 a8 e4 06 34 16 de aa e3 84 4f 60 d6 e9 6f\ +e1 55 14 5f 45 25 b9 a3 44 31 ca 37 66 18 0f 70\ +e1 5a 5e 5d 8e 8b 1a 51 6f f8 70 60 9f 13 f8 96\ +93 5c ed 18 82 79 a5 8e d1 3d 07 11 42 77 d7 5c\ +65 68 60 7e 0a b0 92 fd 80 3a 22 3e 4a 8e e0 b1\ +a8 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 4.2 +Plaintext: \ +b0 ad c4 f3 fe 11 da 59 ce 99 27 73 d9 05 99 43\ +c0 30 46 49 7e e9 d9 f9 a0 6d f1 16 6d b4 6d 98\ +f5 8d 27 ec 07 4c 02 ee e6 cb e2 44 9c 8b 9f c5\ +08 0c 5c 3f 44 33 09 25 12 ec 46 aa 79 37 43 c8 +Seed: # not used yet\ +f5 45 d5 89 75 85 e3 db 71 aa 0c b8 da 76 c5 1d\ +03 2a e9 63 +Ciphertext: \ +00 97 b6 98 c6 16 56 45 b3 03 48 6f bf 5a 2a 44\ +79 c0 ee 85 88 9b 54 1a 6f 0b 85 8d 6b 65 97 b1\ +3b 85 4e b4 f8 39 af 03 39 9a 80 d7 9b da 65 78\ +c8 41 f9 0d 64 57 15 b2 80 d3 71 43 99 2d d1 86\ +c8 0b 94 9b 77 5c ae 97 37 0e 4e c9 74 43 13 6c\ +6d a4 84 e9 70 ff db 13 23 a2 08 47 82 1d 3b 18\ +38 1d e1 3b b4 9a ae a6 65 30 c4 a4 b8 27 1f 3e\ +ae 17 2c d3 66 e0 7e 66 36 f1 01 9d 2a 28 ae d1\ +5e +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 4.3 +Plaintext: \ +bf 6d 42 e7 01 70 7b 1d 02 06 b0 c8 b4 5a 1c 72\ +64 1f f1 28 89 21 9a 82 bd ea 96 5b 5e 79 a9 6b\ +0d 01 63 ed 9d 57 8e c9 ad a2 0f 2f bc f1 ea 3c\ +40 89 d8 34 19 ba 81 b0 c6 0f 36 06 da 99 +Seed: # not used yet\ +ad 99 7f ee f7 30 d6 ea 7b e6 0d 0d c5 2e 72 ea\ +cb fd d2 75 +Ciphertext: \ +03 01 f9 35 e9 c4 7a bc b4 8a cb be 09 89 5d 9f\ +59 71 af 14 83 9d a4 ff 95 41 7e e4 53 d1 fd 77\ +31 90 72 bb 72 97 e1 b5 5d 75 61 cd 9d 1b b2 4c\ +1a 9a 37 c6 19 86 43 08 24 28 04 87 9d 86 eb d0\ +01 dc e5 18 39 75 e1 50 69 89 b7 0e 5a 83 43 41\ +54 d5 cb fd 6a 24 78 7e 60 eb 0c 65 8d 2a c1 93\ +30 2d 11 92 c6 e6 22 d4 a1 2a d4 b5 39 23 bc a2\ +46 df 31 c6 39 5e 37 70 2c 6a 78 ae 08 1f b9 d0\ +65 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 4.4 +Plaintext: \ +fb 2e f1 12 f5 e7 66 eb 94 01 92 97 93 47 94 f7\ +be 2f 6f c1 c5 8e +Seed: # not used yet\ +13 64 54 df 57 30 f7 3c 80 7a 7e 40 d8 c1 a3 12\ +ac 5b 9d d3 +Ciphertext: \ +02 d1 10 ad 30 af b7 27 be b6 91 dd 0c f1 7d 0a\ +f1 a1 e7 fa 0c c0 40 ec 1a 4b a2 6a 42 c5 9d 0a\ +79 6a 2e 22 c8 f3 57 cc c9 8b 65 19 ac eb 68 2e\ +94 5e 62 cb 73 46 14 a5 29 40 7c d4 52 be e3 e4\ +4f ec e8 42 3c c1 9e 55 54 8b 8b 99 4b 84 9c 7e\ +cd e4 93 3e 76 03 7e 1d 0c e4 42 75 b0 87 10 c6\ +8e 43 01 30 b9 29 73 0e d7 7e 09 b0 15 64 2c 55\ +93 f0 4e 4f fb 94 10 79 81 02 a8 e9 6f fd fe 11\ +e4 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 4.5 +Plaintext: \ +28 cc d4 47 bb 9e 85 16 6d ab b9 e5 b7 d1 ad ad\ +c4 b9 d3 9f 20 4e 96 d5 e4 40 ce 9a d9 28 bc 1c\ +22 84 +Seed: # not used yet\ +bc a8 05 7f 82 4b 2e a2 57 f2 86 14 07 ee f6 3d\ +33 20 86 81 +Ciphertext: \ +00 db b8 a7 43 9d 90 ef d9 19 a3 77 c5 4f ae 8f\ +e1 1e c5 8c 3b 85 83 62 e2 3a d1 b8 a4 43 10 79\ +90 66 b9 93 47 aa 52 56 91 d2 ad c5 8d 9b 06 e3\ +4f 28 8c 17 03 90 c5 f0 e1 1c 0a a3 64 59 59 f1\ +8e e7 9e 8f 2b e8 d7 ac 5c 23 d0 61 f1 8d d7 4b\ +8c 5f 2a 58 fc b5 eb 0c 54 f9 9f 01 a8 32 47 56\ +82 92 53 65 83 34 09 48 d7 a8 c9 7c 4a cd 1e 98\ +d1 e2 9d c3 20 e9 7a 26 05 32 a8 aa 7a 75 8a 1e\ +c2 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 4.6 +Plaintext: \ +f2 22 42 75 1e c6 b1 +Seed: # not used yet\ +2e 7e 1e 17 f6 47 b5 dd d0 33 e1 54 72 f9 0f 68\ +12 f3 ac 4e +Ciphertext: \ +00 a5 ff a4 76 8c 8b be ca ee 2d b7 7e 8f 2e ec\ +99 59 59 33 54 55 20 83 5e 5b a7 db 94 93 d3 e1\ +7c dd ef e6 a5 f5 67 62 44 71 90 8d b4 e2 d8 3a\ +0f be e6 06 08 fc 84 04 95 03 b2 23 4a 07 dc 83\ +b2 7b 22 84 7a d8 92 0f f4 2f 67 4e f7 9b 76 28\ +0b 00 23 3d 2b 51 b8 cb 27 03 a9 d4 2b fb c8 25\ +0c 96 ec 32 c0 51 e5 7f 1b 4b a5 28 db 89 c3 7e\ +4c 54 e2 7e 6e 64 ac 69 63 5a e8 87 d9 54 16 19\ +a9 +Test: DecryptMatch + +AlgorithmType: AsymmetricCipher +Name: RSA/OAEP-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 5: A 1028-bit RSA Key Pair +Modulus: \ +0a ad f3 f9 c1 25 e5 d8 91 f3 1a c4 48 e9 93 de\ +fe 58 0f 80 2b 45 f9 d7 f2 2b a5 02 1e 9c 47 57\ +6b 5a 1e 68 03 1b a9 db 4e 6d ab e4 d9 6a 1d 6f\ +3d 26 72 68 cf f4 08 00 5f 11 8e fc ad b9 98 88\ +d1 c2 34 46 71 66 b2 a2 b8 49 a0 5a 88 9c 06 0a\ +c0 da 0c 5f ae 8b 55 f3 09 ba 62 e7 03 74 2f a0\ +32 6f 2d 10 b0 11 02 14 89 ff 49 77 70 19 0d 89\ +5f d3 9f 52 29 3c 39 ef d7 3a 69 8b da b9 f1 0e\ +d9 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +02 56 eb 4c ba 70 67 f2 d2 be 54 0d cd ff 45 82\ +a3 6b 7d 31 d1 c9 09 9b b2 14 b7 98 48 46 6a 26\ +8f 80 f5 8a 49 ac 04 c0 e3 64 89 34 a0 20 6c 04\ +53 7c 19 b2 36 64 3a 60 82 73 21 44 df 75 fa 21\ +75 88 f7 94 68 2b e8 91 68 27 6d c7 26 c5 c0 cb\ +db 84 d3 1b bf 26 d0 a4 3a f4 95 71 7f 7d 52 8a\ +cf ee 34 15 61 f6 ff 3c ae 05 c5 78 f8 47 0d 96\ +82 f9 c0 d0 72 f9 f6 06 8b 56 d5 88 0f 68 2b e2\ +c5 +Prime1: \ +03 b0 d3 96 2f 6d 17 54 9c bf ca 11 29 43 48 dc\ +f0 e7 e3 9f 8c 2b c6 82 4f 21 64 b6 06 d6 87 86\ +0d ae 1e 63 23 93 cf ed f5 13 22 82 29 06 9e 2f\ +60 e4 ac d7 e6 33 a4 36 06 3f 82 38 5f 48 99 37\ +07 +Prime2: \ +02 e4 c3 2e 2f 51 72 69 b7 07 23 09 f0 0c 0e 31\ +36 5f 7c e2 8b 23 6b 82 91 2d f2 39 ab f3 95 72\ +cf 0e d6 04 b0 29 82 e5 35 64 c5 2d 6a 05 39 7d\ +e5 c0 52 a2 fd dc 14 1e f7 18 98 36 34 6a eb 33\ +1f +ModPrime1PrivateExponent: \ +01 e8 4b 11 9d 25 16 1f a6 7b 00 25 6a 5b d9 b6\ +45 d2 b2 32 ec b0 5b 01 51 80 02 9a 88 62 2a dc\ +3f 09 b3 ae ac de 61 61 ab 7c de 22 c2 ad 26 e7\ +79 7d f5 4e 07 2c bd 3b 26 73 80 0b 3e 43 38 db\ +d5 +ModPrime2PrivateExponent: \ +eb 90 aa 1a 40 13 5b 4c ea 07 19 7c ed c8 81 9b\ +e1 e7 cb ff 25 47 66 21 16 f4 65 a4 a9 f4 87 ab\ +12 f3 ba 4f ef 13 82 22 65 a6 52 97 d9 8b 7b de\ +d9 37 2e 3f fe 81 a3 8b 3e 96 00 fe d0 55 75 4f +MultiplicativeInverseOfPrime2ModPrime1: \ +01 2f 7f 81 38 f9 40 40 62 eb 85 a4 29 24 52 0b\ +38 f5 bb 88 6a 01 96 f4 8b b8 dc ea 60 fd 92 cc\ +02 7f 18 e7 81 58 a3 4a 5c 5d 5f 86 0a 0f 6c 04\ +07 1a 7d 01 31 2c 06 50 62 f1 eb 48 b7 9d 1c 83\ +cb +Test: KeyPairValidAndConsistent +Comment: RSAES-OAEP Encryption Example 5.1 +Plaintext: \ +af 71 a9 01 e3 a6 1d 31 32 f0 fc 1f db 47 4f 9e\ +a6 57 92 57 ff c2 4d 16 41 70 14 5b 3d bd e8 +Seed: # not used yet\ +44 c9 2e 28 3f 77 b9 49 9c 60 3d 96 36 60 c8 7d\ +2f 93 94 61 +Ciphertext: \ +03 60 46 a4 a4 7d 9e d3 ba 9a 89 13 9c 10 50 38\ +eb 74 92 b0 5a 5d 68 bf d5 3a cc ff 45 97 f7 a6\ +86 51 b4 7b 4a 46 27 d9 27 e4 85 ee d7 b4 56 64\ +20 e8 b4 09 87 9e 5d 60 6e ae 25 1d 22 a5 df 79\ +9f 79 20 bf c1 17 b9 92 57 2a 53 b1 26 31 46 bc\ +ea 03 38 5c c5 e8 53 c9 a1 01 c8 c3 e1 bd a3 1a\ +51 98 07 49 6c 6c b5 e5 ef b4 08 82 3a 35 2b 8f\ +a0 66 1f b6 64 ef ad d5 93 de b9 9f ff 5e d0 00\ +e5 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 5.2 +Plaintext: \ +a3 b8 44 a0 82 39 a8 ac 41 60 5a f1 7a 6c fd a4\ +d3 50 13 65 85 90 3a 41 7a 79 26 87 60 51 9a 4b\ +4a c3 30 3e c7 3f 0f 87 cf b3 23 99 +Seed: # not used yet\ +cb 28 f5 86 06 59 fc ee e4 9c 3e ea fc e6 25 a7\ +08 03 bd 32 +Ciphertext: \ +03 d6 eb 65 4e dc e6 15 bc 59 f4 55 26 5e d4 e5\ +a1 82 23 cb b9 be 4e 40 69 b4 73 80 4d 5d e9 6f\ +54 dc aa a6 03 d0 49 c5 d9 4a a1 47 0d fc d2 25\ +40 66 b7 c7 b6 1f f1 f6 f6 77 0e 32 15 c5 13 99\ +fd 4e 34 ec 50 82 bc 48 f0 89 84 0a d0 43 54 ae\ +66 dc 0f 1b d1 8e 46 1a 33 cc 12 58 b4 43 a2 83\ +7a 6d f2 67 59 aa 23 02 33 49 86 f8 73 80 c9 cc\ +9d 53 be 9f 99 60 5d 2c 9a 97 da 7b 09 15 a4 a7\ +ad +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 5.3 +Plaintext: \ +30 8b 0e cb d2 c7 6c b7 7f c6 f7 0c 5e dd 23 3f\ +d2 f2 09 29 d6 29 f0 26 95 3b b6 2a 8f 4a 3a 31\ +4b de 19 5d e8 5b 5f 81 6d a2 aa b0 74 d2 6c b6\ +ac dd f3 23 ae 3b 9c 67 8a c3 cf 12 fb dd e7 +Seed: # not used yet\ +22 85 f4 0d 77 04 82 f9 a9 ef a2 c7 2c b3 ac 55\ +71 6d c0 ca +Ciphertext: \ +07 70 95 21 81 64 9f 9f 9f 07 ff 62 6f f3 a2 2c\ +35 c4 62 44 3d 90 5d 45 6a 9f d0 bf f4 3c ac 2c\ +a7 a9 f5 54 e9 47 8b 9a cc 3a c8 38 b0 20 40 ff\ +d3 e1 84 7d e2 e4 25 39 29 f9 dd 9e e4 04 43 25\ +a9 b0 5c ab b8 08 b2 ee 84 0d 34 e1 5d 10 5a 3f\ +1f 7b 27 69 5a 1a 07 a2 d7 3f e0 8e ca aa 3c 9c\ +9d 4d 5a 89 ff 89 0d 54 72 7d 7a e4 0c 0e c1 a8\ +dd 86 16 5d 8e e2 c6 36 81 41 01 6a 48 b5 5b 69\ +67 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 5.4 +Plaintext: \ +15 c5 b9 ee 11 85 +Seed: # not used yet\ +49 fa 45 d3 a7 8d d1 0d fd 57 73 99 d1 eb 00 af\ +7e ed 55 13 +Ciphertext: \ +08 12 b7 67 68 eb cb 64 2d 04 02 58 e5 f4 44 1a\ +01 85 21 bd 96 68 7e 6c 5e 89 9f cd 6c 17 58 8f\ +f5 9a 82 cc 8a e0 3a 4b 45 b3 12 99 af 17 88 c3\ +29 f7 dc d2 85 f8 cf 4c ed 82 60 6b 97 61 26 71\ +a4 5b ed ca 13 34 42 14 4d 16 17 d1 14 f8 02 85\ +7f 0f 9d 73 97 51 c5 7a 3f 9e e4 00 91 2c 61 e2\ +e6 99 2b e0 31 a4 3d d4 8f a6 ba 14 ee f7 c4 22\ +b5 ed c4 e7 af a0 4f dd 38 f4 02 d1 c8 bb 71 9a\ +bf +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 5.5 +Plaintext: \ +21 02 6e 68 00 c7 fa 72 8f ca ab a0 d1 96 ae 28\ +d7 a2 ac 4f fd 8a bc e7 94 f0 98 5f 60 c8 a6 73\ +72 77 36 5d 3f ea 11 db 89 23 a2 02 9a +Seed: # not used yet\ +f0 28 74 13 23 4c c5 03 47 24 a0 94 c4 58 6b 87\ +af f1 33 fc +Ciphertext: \ +07 b6 0e 14 ec 95 4b fd 29 e6 0d 00 47 e7 89 f5\ +1d 57 18 6c 63 58 99 03 30 67 93 ce d3 f6 82 41\ +c7 43 52 9a ba 6a 63 74 f9 2e 19 e0 16 3e fa 33\ +69 7e 19 6f 76 61 df aa a4 7a ac 6b de 5e 51 de\ +b5 07 c7 2c 58 9a 2c a1 69 3d 96 b1 46 03 81 24\ +9b 2c db 9e ac 44 76 9f 24 89 c5 d3 d2 f9 9f 0e\ +e3 c7 ee 5b f6 4a 5a c7 9c 42 bd 43 3f 14 9b e8\ +cb 59 54 83 61 64 05 95 51 3c 97 af 7b c2 50 97\ +23 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 5.6 +Plaintext: \ +54 1e 37 b6 8b 6c 88 72 b8 4c 02 +Seed: # not used yet\ +d9 fb a4 5c 96 f2 1e 6e 26 d2 9e b2 cd cb 65 85\ +be 9c b3 41 +Ciphertext: \ +08 c3 6d 4d da 33 42 3b 2e d6 83 0d 85 f6 41 1b\ +a1 dc f4 70 a1 fa e0 eb ef ee 7c 08 9f 25 6c ef\ +74 cb 96 ea 69 c3 8f 60 f3 9a be e4 41 29 bc b4\ +c9 2d e7 f7 97 62 3b 20 07 4e 3d 9c 28 99 70 1e\ +d9 07 1e 1e fa 0b dd 84 d4 c3 e5 13 03 02 d8 f0\ +24 0b ab a4 b8 4a 71 cc 03 2f 22 35 a5 ff 0f ae\ +27 7c 3e 8f 91 12 be f4 4c 9a e2 0d 17 5f c9 a4\ +05 8b fc 93 0b a3 1b 02 e2 e4 f4 44 48 37 10 f2\ +4a +Test: DecryptMatch + +AlgorithmType: AsymmetricCipher +Name: RSA/OAEP-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 6: A 1029-bit RSA Key Pair +Modulus: \ +12 b1 7f 6d ad 2e cd 19 ff 46 dc 13 f7 86 0f 09\ +e0 e0 cf b6 77 b3 8a 52 59 23 05 ce af 02 2c 16\ +6d b9 0d 04 ac 29 e3 3f 7d d1 2d 9f af 66 e0 81\ +6b b6 3e ad 26 7c c7 d4 6c 17 c3 7b e2 14 bc a2\ +a2 2d 72 3a 64 e4 44 07 43 6b 6f c9 65 72 9a ef\ +c2 55 4f 37 6c d5 dc ea 68 29 37 80 a6 2b f3 9d\ +00 29 48 5a 16 0b bb 9e 5d c0 97 2d 21 a5 04 f5\ +2e 5e e0 28 aa 41 63 32 f5 10 b2 e9 cf f5 f7 22\ +af +PublicExponent: \ +01 00 01 +PrivateExponent: \ +02 95 ec a3 56 06 18 36 95 59 ce cd 30 3a a9 cf\ +da fc 1d 9f 06 95 9d f7 5f fe f9 29 aa 89 69 61\ +bc d1 90 dc 69 97 ed a7 f5 96 3e 72 4d 07 b4 dc\ +11 f3 06 5e 5a e9 7d 96 83 51 12 28 0b 90 84 bb\ +14 f2 a2 1e bd 4e 88 9d 41 b9 c4 13 2e c1 95 6f\ +ca b8 bb 2f ed 05 75 88 49 36 52 2c 5f f7 d3 32\ +61 90 48 24 e7 ca de e4 e0 bb 37 2d 24 57 cf 78\ +e2 bd 12 86 22 8f f8 3f 10 73 1c e6 3c 90 cf f3\ +f9 +Prime1: \ +04 a6 ce 8b 73 58 df a6 9b dc f7 42 61 70 05 af\ +b5 38 5f 5f 3a 58 a2 4e f7 4a 22 a8 c0 5c b7 cc\ +38 eb d4 cc 9d 9a 9d 78 9a 62 cd 0f 60 f0 cb 94\ +1d 34 23 c9 69 2e fa 4f e3 ad ff 29 0c 47 49 a3\ +8b +Prime2: \ +04 04 c9 a8 03 37 1f ed b4 c5 be 39 f3 c0 0b 00\ +9e 5e 08 a6 3b e1 e4 00 35 cd ac a5 01 1c c7 01\ +cf 7e eb cb 99 f0 ff e1 7c fd 0a 4b f7 be fd 2d\ +d5 36 ac 94 6d b7 97 fd bc 4a be 8f 29 34 9b 91\ +ed +ModPrime1PrivateExponent: \ +03 96 1c 8f 76 0a a2 bd 51 54 c7 aa fd 77 22 5b\ +3b ac d0 13 9a e7 b5 94 8e a3 31 1f cc d8 6f b9\ +5c 75 af a7 67 28 4b 9b 2d e5 59 57 2f 15 d8 d0\ +44 c7 eb 83 a1 be 5f ad f2 cc 37 7c 0d 84 75 29\ +4b +ModPrime2PrivateExponent: \ +02 21 97 e0 66 74 21 96 aa bc 03 fa 2f ee b4 e7\ +0b 15 cb 78 7d 61 7a cd 31 bb 75 c7 bc 23 4a d7\ +06 f7 c4 8d 21 82 d1 f0 ff 9c 22 8d cf 41 96 7b\ +6c 0b a6 d2 c0 ad 11 0a 1b 85 78 31 ec 24 5e 2c\ +b1 +MultiplicativeInverseOfPrime2ModPrime1: \ +04 01 c4 c0 c5 3d 45 db db 5e 9d 96 d0 fe cf 42\ +75 df 09 74 bc 4a 07 36 b4 a7 4c 32 69 05 3e fb\ +68 6a ce 24 06 e2 2c 9e 05 8d db 4a e5 40 62 7a\ +e2 fd b0 82 61 e8 e7 e4 bc bc 99 4d aa fa 30 5c\ +45 +Test: KeyPairValidAndConsistent +Comment: RSAES-OAEP Encryption Example 6.1 +Plaintext: \ +40 46 ca 8b aa 33 47 ca 27 f4 9e 0d 81 f9 cc 1d\ +71 be 9b a5 17 d4 +Seed: # not used yet\ +dd 0f 6c fe 41 5e 88 e5 a4 69 a5 1f bb a6 df d4\ +0a db 43 84 +Ciphertext: \ +06 30 ee bc d2 85 6c 24 f7 98 80 6e 41 f9 e6 73\ +45 ed a9 ce da 38 6a cc 9f ac ae a1 ee ed 06 ac\ +e5 83 70 97 18 d9 d1 69 fa df 41 4d 5c 76 f9 29\ +96 83 3e f3 05 b7 5b 1e 4b 95 f6 62 a2 0f ae dc\ +3b ae 0c 48 27 a8 bf 8a 88 ed bd 57 ec 20 3a 27\ +a8 41 f0 2e 43 a6 15 ba b1 a8 ca c0 70 1d e3 4d\ +eb de f6 2a 08 80 89 b5 5e c3 6e a7 52 2f d3 ec\ +8d 06 b6 a0 73 e6 df 83 31 53 bc 0a ef d9 3b d1\ +a3 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 6.2 +Plaintext: \ +5c c7 2c 60 23 1d f0 3b 3d 40 f9 b5 79 31 bc 31\ +10 9f 97 25 27 f2 8b 19 e7 48 0c 72 88 cb 3c 92\ +b2 25 12 21 4e 4b e6 c9 14 79 2d da bd f5 7f aa\ +8a a7 +Seed: # not used yet\ +8d 14 bd 94 6a 13 51 14 8f 5c ae 2e d9 a0 c6 53\ +e8 5e bd 85 +Ciphertext: \ +0e bc 37 37 61 73 a4 fd 2f 89 cc 55 c2 ca 62 b2\ +6b 11 d5 1c 3c 7c e4 9e 88 45 f7 4e 76 07 31 7c\ +43 6b c8 d2 3b 96 67 df eb 9d 08 72 34 b4 7b c6\ +83 71 75 ae 5c 05 59 f6 b8 1d 7d 22 41 6d 3e 50\ +f4 ac 53 3d 8f 08 12 f2 db 9e 79 1f e9 c7 75 ac\ +8b 6a d0 f5 35 ad 9c eb 23 a4 a0 20 14 c5 8a b3\ +f8 d3 16 14 99 a2 60 f3 93 48 e7 14 ae 2a 1d 34\ +43 20 8f d8 b7 22 cc fd fb 39 3e 98 01 1f 99 e6\ +3f +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 6.3 +Plaintext: \ +b2 0e 65 13 03 09 2f 4b cc b4 30 70 c0 f8 6d 23\ +04 93 62 ed 96 64 2f c5 63 2c 27 db 4a 52 e3 d8\ +31 f2 ab 06 8b 23 b1 49 87 9c 00 2f 6b f3 fe ee\ +97 59 11 12 56 2c +Seed: # not used yet\ +6c 07 5b c4 55 20 f1 65 c0 bf 5e a4 c5 df 19 1b\ +c9 ef 0e 44 +Ciphertext: \ +0a 98 bf 10 93 61 93 94 43 6c f6 8d 8f 38 e2 f1\ +58 fd e8 ea 54 f3 43 5f 23 9b 8d 06 b8 32 18 44\ +20 24 76 ae ed 96 00 94 92 48 0c e3 a8 d7 05 49\ +8c 4c 8c 68 f0 15 01 dc 81 db 60 8f 60 08 73 50\ +c8 c3 b0 bd 2e 9e f6 a8 14 58 b7 c8 01 b8 9f 2e\ +4f e9 9d 49 00 ba 6a 4b 5e 5a 96 d8 65 dc 67 6c\ +77 55 92 87 94 13 0d 62 80 a8 16 0a 19 0f 2d f3\ +ea 7c f9 aa 02 71 d8 8e 9e 69 05 ec f1 c5 15 2d\ +65 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 6.4 +Plaintext: \ +68 4e 30 38 c5 c0 41 f7 +Seed: # not used yet\ +3b bc 3b d6 63 7d fe 12 84 69 01 02 9b f5 b0 c0\ +71 03 43 9c +Ciphertext: \ +00 8e 7a 67 ca cf b5 c4 e2 4b ec 7d ee 14 91 17\ +f1 95 98 ce 8c 45 80 8f ef 88 c6 08 ff 9c d6 e6\ +95 26 3b 9a 3c 0a d4 b8 ba 4c 95 23 8e 96 a8 42\ +2b 85 35 62 9c 8d 53 82 37 44 79 ad 13 fa 39 97\ +4b 24 2f 9a 75 9e ea f9 c8 3a d5 a8 ca 18 94 0a\ +01 62 ba 75 58 76 df 26 3f 4b d5 0c 65 25 c5 60\ +90 26 7c 1f 0e 09 ce 08 99 a0 cf 35 9e 88 12 0a\ +bd 9b f8 93 44 5b 3c ae 77 d3 60 73 59 ae 9a 52\ +f8 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 6.5 +Plaintext: \ +32 48 8c b2 62 d0 41 d6 e4 dd 35 f9 87 bf 3c a6\ +96 db 1f 06 ac 29 a4 46 93 +Seed: # not used yet\ +b4 6b 41 89 3e 8b ef 32 6f 67 59 38 3a 83 07 1d\ +ae 7f ca bc +Ciphertext: \ +00 00 34 74 41 6c 7b 68 bd f9 61 c3 85 73 79 44\ +d7 f1 f4 0c b3 95 34 3c 69 3c c0 b4 fe 63 b3 1f\ +ed f1 ea ee ac 9c cc 06 78 b3 1d c3 2e 09 77 48\ +95 14 c4 f0 90 85 f6 29 8a 96 53 f0 1a ea 40 45\ +ff 58 2e e8 87 be 26 ae 57 5b 73 ee f7 f3 77 49\ +21 e3 75 a3 d1 9a dd a0 ca 31 aa 18 49 88 7c 1f\ +42 ca c9 67 7f 7a 2f 4e 92 3f 6e 5a 86 8b 38 c0\ +84 ef 18 75 94 dc 9f 7f 04 8f ea 2e 02 95 53 84\ +ab +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 6.6 +Plaintext: \ +50 ba 14 be 84 62 72 02 79 c3 06 ba +Seed: # not used yet\ +0a 24 03 31 2a 41 e3 d5 2f 06 0f bc 13 a6 7d e5\ +cf 76 09 a7 +Ciphertext: \ +0a 02 6d da 5f c8 78 5f 7b d9 bf 75 32 7b 63 e8\ +5e 2c 0f de e5 da db 65 eb dc ac 9a e1 de 95 c9\ +2c 67 2a b4 33 aa 7a 8e 69 ce 6a 6d 88 97 fa c4\ +ac 4a 54 de 84 1a e5 e5 bb ce 76 87 87 9d 79 63\ +4c ea 7a 30 68 40 65 c7 14 d5 24 09 b9 28 25 6b\ +bf 53 ea bc d5 23 1e b7 25 95 04 53 73 99 bd 29\ +16 4b 72 6d 33 a4 6d a7 01 36 0a 41 68 a0 91 cc\ +ab 72 d4 4a 62 fe d2 46 c0 ff ea 5b 13 48 ab 54\ +70 +Test: DecryptMatch + +AlgorithmType: AsymmetricCipher +Name: RSA/OAEP-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 7: A 1030-bit RSA Key Pair +Modulus: \ +31 11 79 f0 bc fc 9b 9d 3c a3 15 d0 0e f3 0d 7b\ +dd 3a 2c fa e9 91 1b fe dc b9 48 b3 a4 78 2d 07\ +32 b6 ab 44 aa 4b f0 37 41 a6 44 dc 01 be c3 e6\ +9b 01 a0 33 e6 75 d8 ac d7 c4 92 5c 6b 1a ec 31\ +19 05 1d fd 89 76 2d 21 5d 45 47 5f fc b5 9f 90\ +81 48 62 3f 37 17 71 56 f6 ae 86 dd 7a 7c 5f 43\ +dc 1e 1f 90 82 54 05 8a 28 4a 5f 06 c0 02 17 93\ +a8 7f 1a c5 fe ff 7d ca ee 69 c5 e5 1a 37 89 e3\ +73 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +07 0c fc ff 2f eb 82 76 e2 74 32 c4 5d fe e4 8f\ +49 b7 91 7d 65 30 e1 f0 ca 34 60 f3 2e 02 76 17\ +44 87 c5 6e 22 a4 5d 25 00 d7 77 54 95 21 9d 7d\ +16 5a 9c f3 bd 92 c3 2a f9 a9 8d 8d c9 cc 29 68\ +00 ad c9 4a 0a 54 fb 40 f3 42 91 bf 84 ee 8e a1\ +2b 6f 10 93 59 c6 d3 54 2a 50 f9 c7 67 f5 cf ff\ +05 a6 81 c2 e6 56 fb 77 ca aa db 4b e9 46 8d 8a\ +bc d4 df 98 f5 8e 86 d2 05 3f a1 34 9f 74 8e 21\ +b1 +Prime1: \ +07 49 26 2c 11 1c d4 70 ec 25 66 e6 b3 73 2f c0\ +93 29 46 9a a1 90 71 d3 b9 c0 19 06 51 4c 6f 1d\ +26 ba a1 4b ea b0 97 1c 8b 7e 61 1a 4f 79 00 9d\ +6f ea 77 69 28 ca 25 28 5b 0d e3 64 3d 1a 3f 8c\ +71 +Prime2: \ +06 bc 1e 50 e9 6c 02 bf 63 6e 9e ea 8b 89 9b be\ +bf 76 51 de 77 dd 47 4c 3e 9b c2 3b ad 81 82 b6\ +19 04 c7 d9 7d fb eb fb 1e 00 10 88 78 b6 e6 7e\ +41 53 91 d6 79 42 c2 b2 bf 9b 44 35 f8 8b 0c b0\ +23 +ModPrime1PrivateExponent: \ +03 bc 7e a7 f0 aa b1 43 ab c6 ce 8b 97 11 86 36\ +a3 01 72 e4 cf e0 2c 8f a0 dd a3 b7 ba af 90 f8\ +09 29 82 98 55 25 f4 88 bd fc b4 bd 72 6e 22 63\ +9a c6 4a 30 92 ab 7f fc bf 1d 53 34 cf a5 0b 5b\ +f1 +ModPrime2PrivateExponent: \ +02 62 a6 aa 29 c2 a3 c6 7d c5 34 6c 06 38 1a fd\ +98 7a a3 cc 93 cf bf ec f5 4f dd 9f 9d 78 7d 7f\ +59 a5 23 d3 98 97 9d a1 37 a2 f6 38 1f e9 48 01\ +f7 c9 4d a2 15 18 dc 34 cb 40 87 0c 46 97 99 4a\ +d9 +MultiplicativeInverseOfPrime2ModPrime1: \ +64 9d 4c 17 b6 ee 17 21 e7 72 d0 38 9a 55 9c 3d\ +3c df 95 50 d4 57 c4 6b 03 7b 74 64 1b 1d 52 16\ +6a f8 a2 13 c8 39 62 06 cd fb a4 42 2f 18 d6 f6\ +1d bc b5 d2 14 c9 71 bf 48 2a eb 97 6a 73 70 c2 +Test: KeyPairValidAndConsistent +Comment: RSAES-OAEP Encryption Example 7.1 +Plaintext: \ +47 aa e9 09 +Seed: # not used yet\ +43 dd 09 a0 7f f4 ca c7 1c aa 46 32 ee 5e 1c 1d\ +ae e4 cd 8f +Ciphertext: \ +16 88 e4 ce 77 94 bb a6 cb 70 14 16 9e cd 55 9c\ +ed e2 a3 0b 56 a5 2b 68 d9 fe 18 cf 19 73 ef 97\ +b2 a0 31 53 95 1c 75 5f 62 94 aa 49 ad bd b5 58\ +45 ab 68 75 fb 39 86 c9 3e cf 92 79 62 84 0d 28\ +2f 9e 54 ce 8b 69 0f 7c 0c b8 bb d7 34 40 d9 57\ +1d 1b 16 cd 92 60 f9 ea b4 78 3c c4 82 e5 22 3d\ +c6 09 73 87 17 83 ec 27 b0 ae 0f d4 77 32 cb c2\ +86 a1 73 fc 92 b0 0f b4 ba 68 24 64 7c d9 3c 85\ +c1 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 7.2 +Plaintext: \ +1d 9b 2e 22 23 d9 bc 13 bf b9 f1 62 ce 73 5d b4\ +8b a7 c6 8f 68 22 a0 a1 a7 b6 ae 16 58 34 e7 +Seed: # not used yet\ +3a 9c 3c ec 7b 84 f9 bd 3a de cb c6 73 ec 99 d5\ +4b 22 bc 9b +Ciphertext: \ +10 52 ed 39 7b 2e 01 e1 d0 ee 1c 50 bf 24 36 3f\ +95 e5 04 f4 a0 34 34 a0 8f d8 22 57 4e d6 b9 73\ +6e db b5 f3 90 db 10 32 14 79 a8 a1 39 35 0e 2b\ +d4 97 7c 37 78 ef 33 1f 3e 78 ae 11 8b 26 84 51\ +f2 0a 2f 01 d4 71 f5 d5 3c 56 69 37 17 1b 2d bc\ +2d 4b de 45 9a 57 99 f0 37 2d 65 74 23 9b 23 23\ +d2 45 d0 bb 81 c2 86 b6 3c 89 a3 61 01 73 37 e4\ +90 2f 88 a4 67 f4 c7 f2 44 bf d5 ab 46 43 7f f3\ +b6 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 7.3 +Plaintext: \ +d9 76 fc +Seed: # not used yet\ +76 a7 5e 5b 61 57 a5 56 cf 88 84 bb 2e 45 c2 93\ +dd 54 5c f5 +Ciphertext: \ +21 55 cd 84 3f f2 4a 4e e8 ba db 76 94 26 00 28\ +a4 90 81 3b a8 b3 69 a4 cb f1 06 ec 14 8e 52 98\ +70 7f 59 65 be 7d 10 1c 10 49 ea 85 84 c2 4c d6\ +34 55 ad 9c 10 4d 68 62 82 d3 fb 80 3a 4c 11 c1\ +c2 e9 b9 1c 71 78 80 1d 1b 66 40 f0 03 f5 72 8d\ +f0 07 b8 a4 cc c9 2b ce 05 e4 1a 27 27 8d 7c 85\ +01 8c 52 41 43 13 a5 07 77 89 00 1d 4f 01 91 0b\ +72 aa d0 5d 22 0a a1 4a 58 73 3a 74 89 bc 54 55\ +6b +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 7.4 +Plaintext: \ +d4 73 86 23 df 22 3a a4 38 43 df 84 67 53 4c 41\ +d0 13 e0 c8 03 c6 24 e2 63 66 6b 23 9b de 40 a5\ +f2 9a eb 8d e7 9e 3d aa 61 dd 03 70 f4 9b d4 b0\ +13 83 4b 98 21 2a ef 6b 1c 5e e3 73 b3 cb +Seed: # not used yet\ +78 66 31 4a 6a d6 f2 b2 50 a3 59 41 db 28 f5 86\ +4b 58 58 59 +Ciphertext: \ +0a b1 4c 37 3a eb 7d 43 28 d0 aa ad 8c 09 4d 88\ +b9 eb 09 8b 95 f2 10 54 a2 90 82 52 2b e7 c2 7a\ +31 28 78 b6 37 91 7e 3d 81 9e 6c 3c 56 8d b5 d8\ +43 80 2b 06 d5 1d 9e 98 a2 be 0b f4 0c 03 14 23\ +b0 0e df bf f8 32 0e fb 91 71 bd 20 44 65 3a 4c\ +b9 c5 12 2f 6c 65 e8 3c da 2e c3 c1 26 02 7a 9c\ +1a 56 ba 87 4d 0f ea 23 f3 80 b8 2c f2 40 b8 cf\ +54 00 04 75 8c 4c 77 d9 34 15 7a 74 f3 fc 12 bf\ +ac +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 7.5 +Plaintext: \ +bb 47 23 1c a5 ea 1d 3a d4 6c 99 34 5d 9a 8a 61 +Seed: # not used yet\ +b2 16 6e d4 72 d5 8d b1 0c ab 2c 6b 00 0c cc f1\ +0a 7d c5 09 +Ciphertext: \ +02 83 87 a3 18 27 74 34 79 8b 4d 97 f4 60 06 8d\ +f5 29 8f ab a5 04 1b a1 17 61 a1 cb 73 16 b2 41\ +84 11 4e c5 00 25 7e 25 89 ed 3b 60 7a 1e bb e9\ +7a 6c c2 e0 2b f1 b6 81 f4 23 12 a3 3b 7a 77 d8\ +e7 85 5c 4a 6d e0 3e 3c 04 64 3f 78 6b 91 a2 64\ +a0 d6 80 5e 2c ea 91 e6 81 77 eb 7a 64 d9 25 5e\ +4f 27 e7 13 b7 cc ec 00 dc 20 0e bd 21 c2 ea 2b\ +b8 90 fe ae 49 42 df 94 1d c3 f9 78 90 ed 34 74\ +78 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 7.6 +Plaintext: \ +21 84 82 70 95 d3 5c 3f 86 f6 00 e8 e5 97 54 01\ +32 96 +Seed: # not used yet\ +52 67 3b de 2c a1 66 c2 aa 46 13 1a c1 dc 80 8d\ +67 d7 d3 b1 +Ciphertext: \ +14 c6 78 a9 4a d6 05 25 ef 39 e9 59 b2 f3 ba 5c\ +09 7a 94 ff 91 2b 67 db ac e8 05 35 c1 87 ab d4\ +7d 07 54 20 b1 87 21 52 bb a0 8f 7f c3 1f 31 3b\ +bf 92 73 c9 12 fc 4c 01 49 a9 b0 cf b7 98 07 e3\ +46 eb 33 20 69 61 1b ec 0f f9 bc d1 68 f1 f7 c3\ +3e 77 31 3c ea 45 4b 94 e2 54 9e ec f0 02 e2 ac\ +f7 f6 f2 d2 84 5d 4f e0 aa b2 e5 a9 2d df 68 c4\ +80 ae 11 24 79 35 d1 f6 25 74 84 22 16 ae 67 41\ +15 +Test: DecryptMatch + +AlgorithmType: AsymmetricCipher +Name: RSA/OAEP-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 8: A 1031-bit RSA Key Pair +Modulus: \ +5b df 0e 30 d3 21 dd a5 14 7f 88 24 08 fa 69 19\ +54 80 df 8f 80 d3 f6 e8 bf 58 18 50 4f 36 42 7c\ +a9 b1 f5 54 0b 9c 65 a8 f6 97 4c f8 44 7a 24 4d\ +92 80 20 1b b4 9f cb be 63 78 d1 94 4c d2 27 e2\ +30 f9 6e 3d 10 f8 19 dc ef 27 6c 64 a0 0b 2a 4b\ +67 01 e7 d0 1d e5 fa bd e3 b1 e9 a0 df 82 f4 63\ +13 59 cd 22 66 96 47 fb b1 71 72 46 13 4e d7 b4\ +97 cf ff bd c4 2b 59 c7 3a 96 ed 90 16 62 12 df\ +f7 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +0f 7d 1e 9e 5a aa 25 fd 13 e4 a0 66 3a e1 44 e0\ +d1 5f 5c d1 8b cd b0 9d f2 cc 7e 64 e3 c5 e9 15\ +ad 62 64 53 04 16 1d 09 8c 71 5b b7 ab 8b d0 1d\ +07 ea f3 fe d7 c7 ed 08 af 2a 8a 62 ef 44 ab 16\ +b3 20 e1 4a f7 2a 48 f9 6a fe 26 2a 0a e4 cf 65\ +e6 35 e9 10 79 0c d4 ee 5c ea 76 8a 4b 26 39 f7\ +e6 f6 77 b3 f0 bb 6b e3 2b 75 74 7d 89 09 03 6f\ +02 64 f5 8d 40 1c db a1 31 71 61 57 a7 5e cf 63\ +31 +Prime1: \ +0a 02 ef 84 48 d9 fa d8 bb d0 d0 04 c8 c2 aa 97\ +51 ef 97 21 c1 b0 d0 32 36 a5 4b 0d f9 47 cb ae\ +d5 a2 55 ee 9e 8e 20 d4 91 ea 17 23 fe 09 47 04\ +a9 76 2e 88 af d1 6e bb 59 94 41 2c a9 66 dc 4f\ +9f +Prime2: \ +09 2d 36 2e 7e d3 a0 bf d9 e9 fd 0e 6c 03 01 b6\ +df 29 15 9c f5 0c c8 3b 9b 0c f4 d6 ee a7 1a 61\ +e0 02 b4 6e 0a e9 f2 de 62 d2 5b 5d 74 52 d4 98\ +b8 1c 9a c6 fc 58 59 3d 4c 3f b4 f5 d7 2d fb b0\ +a9 +ModPrime1PrivateExponent: \ +07 c7 14 10 af 10 39 62 db 36 74 04 e3 7a e8 50\ +ba a4 e9 c2 9d d9 21 45 81 52 94 a6 7c 7d 1c 6d\ +ed 26 3a a0 30 a9 b6 33 ae 50 30 3e 14 03 5d 1a\ +f0 14 12 3e ba 68 78 20 30 8d 8e bc 85 b6 95 7d\ +7d +ModPrime2PrivateExponent: \ +ae 2c 75 38 0c 02 c0 16 ad 05 89 1b 33 01 de 88\ +1f 28 ae 11 71 18 2b 6b 2c 83 be a7 c5 15 ec a9\ +ca 29 8c 7b 1c ab 58 17 a5 97 06 8f c8 50 60 de\ +4d a8 a0 16 37 8a ae 43 c7 f9 67 bc c3 79 04 b9 +MultiplicativeInverseOfPrime2ModPrime1: \ +05 98 d1 05 9e 3a da 4f 63 20 75 2c 09 d8 05 ff\ +7d 1f 1a e0 d0 17 ae ee e9 ce fa 0d 7d d7 ff 77\ +5e 44 b5 78 32 2f 64 05 d6 21 1d a1 95 19 66 6a\ +a8 7f dc 4c d8 c8 8f 6b 6e 3d 67 e9 61 dc bb a3\ +d0 +Test: KeyPairValidAndConsistent +Comment: RSAES-OAEP Encryption Example 8.1 +Plaintext: \ +05 0b 75 5e 5e 68 80 f7 b9 e9 d6 92 a7 4c 37 aa\ +e4 49 b3 1b fe a6 de ff 83 74 7a 89 7f 6c 2c 82\ +5b b1 ad bf 85 0a 3c 96 99 4b 5d e5 b3 3c bc 7d\ +4a 17 91 3a 79 67 +Seed: # not used yet\ +77 06 ff ca 1e cf b1 eb ee 2a 55 e5 c6 e2 4c d2\ +79 7a 41 25 +Ciphertext: \ +09 b3 68 3d 8a 2e b0 fb 29 5b 62 ed 1f b9 29 0b\ +71 44 57 b7 82 53 19 f4 64 78 72 af 88 9b 30 40\ +94 72 02 0a d1 29 12 bf 19 b1 1d 48 19 f4 96 14\ +82 4f fd 84 d0 9c 0a 17 e7 d1 73 09 d1 29 19 79\ +04 10 aa 29 95 69 9f 6a 86 db e3 24 2b 5a cc 23\ +af 45 69 10 80 d6 b1 ae 81 0f b3 e3 05 70 87 f0\ +97 00 92 ce 00 be 95 62 ff 40 53 b6 26 2c e0 ca\ +a9 3e 13 72 3d 2e 3a 5b a0 75 d4 5f 0d 61 b5 4b\ +61 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 8.2 +Plaintext: \ +4e b6 8d cd 93 ca 9b 19 df 11 1b d4 36 08 f5 57\ +02 6f e4 aa 1d 5c fa c2 27 a3 eb 5a b9 54 8c 18\ +a0 6d de d2 3f 81 82 59 86 b2 fc d7 11 09 ec ef\ +7e ff 88 87 3f 07 5c 2a a0 c4 69 f6 9c 92 bc +Seed: # not used yet\ +a3 71 7d a1 43 b4 dc ff bc 74 26 65 a8 fa 95 05\ +85 54 83 43 +Ciphertext: \ +2e cf 15 c9 7c 5a 15 b1 47 6a e9 86 b3 71 b5 7a\ +24 28 4f 4a 16 2a 8d 0c 81 82 e7 90 5e 79 22 56\ +f1 81 2b a5 f8 3f 1f 7a 13 0e 42 dc c0 22 32 84\ +4e dc 14 a3 1a 68 ee 97 ae 56 4a 38 3a 34 11 65\ +64 24 c5 f6 2d db 64 60 93 c3 67 be 1f cd a4 26\ +cf 00 a0 6d 8a cb 7e 57 77 6f bb d8 55 ac 3d f5\ +06 fc 16 b1 d7 c3 f2 11 0f 3d 80 68 e9 1e 18 63\ +63 83 1c 84 09 68 0d 8d a9 ec d8 cf 1f a2 0e e3\ +9d +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 8.3 +Plaintext: \ +86 04 ac 56 32 8c 1a b5 ad 91 78 61 +Seed: # not used yet\ +ee 06 20 90 73 cc a0 26 bb 26 4e 51 85 bf 8c 68\ +b7 73 9f 86 +Ciphertext: \ +4b c8 91 30 a5 b2 da bb 7c 2f cf 90 eb 5d 0e af\ +9e 68 1b 71 46 a3 8f 31 73 a3 d9 cf ec 52 ea 9e\ +0a 41 93 2e 64 8a 9d 69 34 4c 50 da 76 3f 51 a0\ +3c 95 76 21 31 e8 05 22 54 dc d2 24 8c ba 40 fd\ +31 66 77 86 ce 05 a2 b7 b5 31 ac 9d ac 9e d5 84\ +a5 9b 67 7c 1a 8a ed 8c 5d 15 d6 8c 05 56 9e 2b\ +e7 80 bf 7d b6 38 fd 2b fd 2a 85 ab 27 68 60 f3\ +77 73 38 fc a9 89 ff d7 43 d1 3e e0 8e 0c a9 89\ +3f +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 8.4 +Plaintext: \ +fd da 5f bf 6e c3 61 a9 d9 a4 ac 68 af 21 6a 06\ +86 f4 38 b1 e0 e5 c3 6b 95 5f 74 e1 07 f3 9c 0d\ +dd cc +Seed: # not used yet\ +99 0a d5 73 dc 48 a9 73 23 5b 6d 82 54 36 18 f2\ +e9 55 10 5d +Ciphertext: \ +2e 45 68 47 d8 fc 36 ff 01 47 d6 99 35 94 b9 39\ +72 27 d5 77 75 2c 79 d0 f9 04 fc b0 39 d4 d8 12\ +fe a6 05 a7 b5 74 dd 82 ca 78 6f 93 75 23 48 43\ +8e e9 f5 b5 45 49 85 d5 f0 e1 69 9e 3e 7a d1 75\ +a3 2e 15 f0 3d eb 04 2a b9 fe 1d d9 db 1b b8 6f\ +8c 08 9c cb 45 e7 ef 0c 5e e7 ca 9b 72 90 ca 6b\ +15 be d4 70 39 78 8a 8a 93 ff 83 e0 e8 d6 24 4c\ +71 00 63 62 de ef 69 b6 f4 16 fb 3c 68 43 83 fb\ +d0 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 8.5 +Plaintext: \ +4a 5f 49 14 be e2 5d e3 c6 93 41 de 07 +Seed: # not used yet\ +ec c6 3b 28 f0 75 6f 22 f5 2a c8 e6 ec 12 51 a6\ +ec 30 47 18 +Ciphertext: \ +1f b9 35 6f d5 c4 b1 79 6d b2 eb f7 d0 d3 93 cc\ +81 0a df 61 45 de fc 2f ce 71 4f 79 d9 38 00 d5\ +e2 ac 21 1e a8 bb ec ca 4b 65 4b 94 c3 b1 8b 30\ +dd 57 6c e3 4d c9 54 36 ef 57 a0 94 15 64 59 23\ +35 9a 5d 7b 41 71 ef 22 c2 46 70 f1 b2 29 d3 60\ +3e 91 f7 66 71 b7 df 97 e7 31 7c 97 73 44 76 d5\ +f3 d1 7d 21 cf 82 b5 ba 9f 83 df 2e 58 8d 36 98\ +4f d1 b5 84 46 8b d2 3b 2e 87 5f 32 f6 89 53 f7\ +b2 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 8.6 +Plaintext: \ +8e 07 d6 6f 7b 88 0a 72 56 3a bc d3 f3 50 92 bc\ +33 40 9f b7 f8 8f 24 72 be +Seed: # not used yet\ +39 25 c7 1b 36 2d 40 a0 a6 de 42 14 55 79 ba 1e\ +7d d4 59 fc +Ciphertext: \ +3a fd 9c 66 00 14 7b 21 79 8d 81 8c 65 5a 0f 4c\ +92 12 db 26 d0 b0 df dc 2a 75 94 cc b3 d2 2f 5b\ +f1 d7 c3 e1 12 cd 73 fc 7d 50 9c 7a 8b af dd 3c\ +27 4d 13 99 00 9f 96 09 ec 4b e6 47 7e 45 3f 07\ +5a a3 3d b3 82 87 0c 1c 34 09 ae f3 92 d7 38 6a\ +e3 a6 96 b9 9a 94 b4 da 05 89 44 7e 95 5d 16 c9\ +8b 17 60 2a 59 bd 73 62 79 fc d8 fb 28 0c 44 62\ +d5 90 bf a9 bf 13 fe d5 70 ea fd e9 73 30 a2 c2\ +10 +Test: DecryptMatch + +AlgorithmType: AsymmetricCipher +Name: RSA/OAEP-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 9: A 1536-bit RSA Key Pair +Modulus: \ +cf 2c d4 1e 34 ca 3a 72 8e a5 cb 8a ff 64 c3 6d\ +27 bd ef 53 64 e3 36 fd 68 d3 12 3c 5a 19 6a 8c\ +28 70 13 e8 53 d5 15 6d 58 d1 51 95 45 20 fb 4f\ +6d 7b 17 ab b6 81 77 65 90 9c 57 61 19 65 9d 90\ +2b 19 06 ed 8a 2b 10 c1 55 c2 4d 12 45 28 da b9\ +ee ae 37 9b ea c6 6e 4a 41 17 86 dc b8 fd 00 62\ +eb c0 30 de 12 19 a0 4c 2a 8c 1b 7d d3 13 1e 4d\ +6b 6c ae e2 e3 1a 5e d4 1a c1 50 9b 2e f1 ee 2a\ +b1 83 64 be 56 8c a9 41 c2 5e cc 84 ff 9d 64 3b\ +5e c1 aa ae 10 2a 20 d7 3f 47 9b 78 0f d6 da 91\ +07 52 12 d9 ea c0 3a 06 74 d8 99 eb a2 e4 31 f4\ +c4 4b 61 5b 6b a2 23 2b d4 b3 3b ae d7 3d 62 5d +PublicExponent: \ +01 00 01 +PrivateExponent: \ +19 8c 14 1e 23 71 5a 92 bc cf 6a 11 9a 5b c1 13\ +89 46 8d 28 11 f5 48 d7 27 e1 7b 4a b0 eb 98 6d\ +6f 21 1e fb 53 b7 1f 7c cb ea 87 ee 69 c7 5e e6\ +15 00 8c 53 32 de b5 2b f3 90 ab df bf e3 7d 72\ +05 36 81 59 b2 63 8c 1d e3 26 e2 1d 22 25 1f 0f\ +b5 84 8b 3b f1 50 05 d2 a7 43 30 f0 af e9 16 ee\ +62 cc c1 34 4d 1d 83 a7 09 e6 06 76 27 38 40 f7\ +f3 77 42 4a 5e 0a 4d a7 5f 01 b3 1f f7 68 19 cf\ +9c bf dd 21 52 43 c3 91 7c 03 ef 38 19 93 12 e5\ +67 b3 bf 7a ed 3a b4 57 f3 71 ef 8a 14 23 f4 5b\ +68 c6 e2 82 ec 11 1b ba 28 33 b9 87 fd 69 fa d8\ +3b c1 b8 c6 13 c5 e1 ea 16 c1 1e d1 25 ea 7e c1 +Prime1: \ +fc 8d 6c 04 be c4 eb 9a 81 92 ca 79 00 cb e5 36\ +e2 e8 b5 19 de cf 33 b2 45 97 98 c6 90 9d f4 f1\ +76 db 7d 23 19 0f c7 2b 88 65 a7 18 af 89 5f 1b\ +cd 91 45 29 80 27 42 3b 60 5e 70 a4 7c f5 83 90\ +a8 c3 e8 8f c8 c4 8e 8b 32 e3 da 21 0d fb e3 e8\ +81 ea 56 74 b6 a3 48 c2 1e 93 f9 e5 5e a6 5e fd +Prime2: \ +d2 00 d4 5e 78 8a ac ea 60 6a 40 1d 04 60 f8 7d\ +d5 c1 02 7e 12 dc 1a 0d 75 86 e8 93 9d 9c f7 89\ +b4 0f 51 ac 04 42 96 1d e7 d2 1c c2 1e 05 c8 31\ +55 c1 f2 aa 91 93 38 7c fd f9 56 cb 48 d1 53 ba\ +27 04 06 f9 bb ba 53 7d 49 87 d9 e2 f9 94 2d 7a\ +14 cb ff fe a7 4f ec dd a9 28 d2 3e 25 9f 5e e1 +ModPrime1PrivateExponent: \ +db 16 80 2f 79 a2 f0 d4 5f 35 8d 69 fd 33 e4 4b\ +81 fa e8 28 62 2e 93 a5 42 53 e9 97 d0 1b 07 43\ +75 9d a0 e8 12 b4 aa 4e 6c 8b ea b2 32 8d 54 31\ +95 5a 41 8a 67 ff 26 a8 c5 c8 07 a5 da 35 4e 05\ +ef 31 cc 8c f7 58 f4 63 73 29 50 b0 3e 26 57 26\ +fb 94 e3 9d 6a 57 2a 26 24 4a b0 8d b7 57 52 ad +ModPrime2PrivateExponent: \ +a0 a3 17 cf e7 df 14 23 f8 7a 6d ee 84 51 f4 e2\ +b4 a6 7e 54 97 f2 9b 4f 1e 4e 83 0b 9f ad d9 40\ +11 67 02 6f 55 96 e5 a3 9c 97 81 7e 0f 5f 16 e2\ +7e 19 ec 99 02 e0 1d 7e a6 fb 9a a3 c7 60 af ee\ +1e 38 1b 69 de 6a c9 c0 75 85 a0 6a d9 c4 ba 00\ +bf 75 c8 ad 2f a8 98 a4 79 e8 0a e2 94 fe d2 a1 +MultiplicativeInverseOfPrime2ModPrime1: \ +0b 21 f3 35 c3 53 34 2e b4 4c 3a a2 44 45 78 0c\ +2d 65 5b 94 01 74 ca e3 8c 7c 8a 4e 64 93 c0 ba\ +9f d3 03 74 82 67 b0 83 b9 a7 a6 cb 61 e4 2d b3\ +62 b8 c9 89 6d b7 06 4e 02 ad 5a e6 15 87 da 15\ +b4 64 9c 90 59 49 09 fe b3 7d bc b6 54 be b7 26\ +8e c8 01 e5 a8 b4 aa 39 11 be bd 88 54 2f 05 be +Test: KeyPairValidAndConsistent +Comment: RSAES-OAEP Encryption Example 9.1 +Plaintext: \ +f7 35 fd 55 ba 92 59 2c 3b 52 b8 f9 c4 f6 9a aa\ +1c be f8 fe 88 ad d0 95 59 54 12 46 7f 9c f4 ec\ +0b 89 6c 59 ed a1 62 10 e7 54 9c 8a bb 10 cd bc\ +21 a1 2e c9 b6 b5 b8 fd 2f 10 39 9e b6 +Seed: # not used yet\ +8e c9 65 f1 34 a3 ec 99 31 e9 2a 1c a0 dc 81 69\ +d5 ea 70 5c +Ciphertext: \ +26 7b cd 11 8a ca b1 fc 8b a8 1c 85 d7 30 03 cb\ +86 10 fa 55 c1 d9 7d a8 d4 8a 7c 7f 06 89 6a 4d\ +b7 51 aa 28 42 55 b9 d3 6a d6 5f 37 65 3d 82 9f\ +1b 37 f9 7b 80 01 94 25 45 b2 fc 2c 55 a7 37 6c\ +a7 a1 be 4b 17 60 c8 e0 5a 33 e5 aa 25 26 b8 d9\ +8e 31 70 88 e7 83 4c 75 5b 2a 59 b1 26 31 a1 82\ +c0 5d 5d 43 ab 17 79 26 4f 84 56 f5 15 ce 57 df\ +df 51 2d 54 93 da b7 b7 33 8d c4 b7 d7 8d b9 c0\ +91 ac 3b af 53 7a 69 fc 7f 54 9d 97 9f 0e ff 9a\ +94 fd a4 16 9b d4 d1 d1 9a 69 c9 9e 33 c3 b5 54\ +90 d5 01 b3 9b 1e da e1 18 ff 67 93 a1 53 26 15\ +84 d3 a5 f3 9f 6e 68 2e 3d 17 c8 cd 12 61 fa 72 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 9.2 +Plaintext: \ +81 b9 06 60 50 15 a6 3a ab e4 2d df 11 e1 97 89\ +12 f5 40 4c 74 74 b2 6d ce 3e d4 82 bf 96 1e cc\ +81 8b f4 20 c5 46 59 +Seed: # not used yet\ +ec b1 b8 b2 5f a5 0c da b0 8e 56 04 28 67 f4 af\ +58 26 d1 6c +Ciphertext: \ +93 ac 9f 06 71 ec 29 ac bb 44 4e ff c1 a5 74 13\ +51 d6 0f db 0e 39 3f bf 75 4a cf 0d e4 97 61 a1\ +48 41 df 77 72 e9 bc 82 77 39 66 a1 58 4c 4d 72\ +ba ea 00 11 8f 83 f3 5c ca 6e 53 7c bd 4d 81 1f\ +55 83 b2 97 83 d8 a6 d9 4c d3 1b e7 0d 6f 52 6c\ +10 ff 09 c6 fa 7c e0 69 79 5a 3f cd 05 11 fd 5f\ +cb 56 4b cc 80 ea 9c 78 f3 8b 80 01 25 39 d8 a4\ +dd f6 fe 81 e9 cd db 7f 50 db bb bc c7 e5 d8 60\ +97 cc f4 ec 49 18 9f b8 bf 31 8b e6 d5 a0 71 5d\ +51 6b 49 af 19 12 58 cd 32 dc 83 3c e6 eb 46 73\ +c0 3a 19 bb ac e8 8c c5 48 95 f6 36 cc 0c 1e c8\ +90 96 d1 1c e2 35 a2 65 ca 17 64 23 2a 68 9a e8 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 9.3 +Plaintext: \ +fd 32 64 29 df 9b 89 0e 09 b5 4b 18 b8 f3 4f 1e\ +24 +Seed: # not used yet\ +e8 9b b0 32 c6 ce 62 2c bd b5 3b c9 46 60 14 ea\ +77 f7 77 c0 +Ciphertext: \ +81 eb dd 95 05 4b 0c 82 2e f9 ad 76 93 f5 a8 7a\ +df b4 b4 c4 ce 70 df 2d f8 4e d4 9c 04 da 58 ba\ +5f c2 0a 19 e1 a6 e8 b7 a3 90 0b 22 79 6d c4 e8\ +69 ee 6b 42 79 2d 15 a8 ec eb 56 c0 9c 69 91 4e\ +81 3c ea 8f 69 31 e4 b8 ed 6f 42 1a f2 98 d5 95\ +c9 7f 47 89 c7 ca a6 12 c7 ef 36 09 84 c2 1b 93\ +ed c5 40 10 68 b5 af 4c 78 a8 77 1b 98 4d 53 b8\ +ea 8a df 2f 6a 7d 4a 0b a7 6c 75 e1 dd 9f 65 8f\ +20 de d4 a4 60 71 d4 6d 77 91 b5 68 03 d8 fe a7\ +f0 b0 f8 e4 1a e3 f0 93 83 a6 f9 58 5f e7 75 3e\ +aa ff d2 bf 94 56 31 08 be ec c2 07 bb b5 35 f5\ +fc c7 05 f0 dd e9 f7 08 c6 2f 49 a9 c9 03 71 d3 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 9.4 +Plaintext: \ +f1 45 9b 5f 0c 92 f0 1a 0f 72 3a 2e 56 62 48 4d\ +8f 8c 0a 20 fc 29 da d6 ac d4 3b b5 f3 ef fd f4\ +e1 b6 3e 07 fd fe 66 28 d0 d7 4c a1 9b f2 d6 9e\ +4a 0a bf 86 d2 93 92 5a 79 67 72 f8 08 8e +Seed: # not used yet\ +60 6f 3b 99 c0 b9 cc d7 71 ea a2 9e a0 e4 c8 84\ +f3 18 9c cc +Ciphertext: \ +bc c3 5f 94 cd e6 6c b1 13 66 25 d6 25 b9 44 32\ +a3 5b 22 f3 d2 fa 11 a6 13 ff 0f ca 5b d5 7f 87\ +b9 02 cc dc 1c d0 ae bc b0 71 5e e8 69 d1 d1 fe\ +39 5f 67 93 00 3f 5e ca 46 50 59 c8 86 60 d4 46\ +ff 5f 08 18 55 20 22 55 7e 38 c0 8a 67 ea d9 91\ +26 22 54 f1 06 82 97 5e c5 63 97 76 85 37 f4 97\ +7a f6 d5 f6 aa ce b7 fb 25 de c5 93 72 30 23 1f\ +d8 97 8a f4 91 19 a2 9f 29 e4 24 ab 82 72 b4 75\ +62 79 2d 5c 94 f7 74 b8 82 9d 0b 0d 9f 1a 8c 9e\ +dd f3 75 74 d5 fa 24 8e ef a9 c5 27 1f c5 ec 25\ +79 c8 1b dd 61 b4 10 fa 61 fe 36 e4 24 22 1c 11\ +3a dd b2 75 66 4c 80 1d 34 ca 8c 63 51 e4 a8 58 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 9.5 +Plaintext: \ +53 e6 e8 c7 29 d6 f9 c3 19 dd 31 7e 74 b0 db 8e\ +4c cc a2 5f 3c 83 05 74 6e 13 7a c6 3a 63 ef 37\ +39 e7 b5 95 ab b9 6e 8d 55 e5 4f 7b d4 1a b4 33\ +37 8f fb 91 1d +Seed: # not used yet\ +fc bc 42 14 02 e9 ec ab c6 08 2a fa 40 ba 5f 26\ +52 2c 84 0e +Ciphertext: \ +23 2a fb c9 27 fa 08 c2 f6 a2 7b 87 d4 a5 cb 09\ +c0 7d c2 6f ae 73 d7 3a 90 55 88 39 f4 fd 66 d2\ +81 b8 7e c7 34 bc e2 37 ba 16 66 98 ed 82 91 06\ +a7 de 69 42 cd 6c dc e7 8f ed 8d 2e 4d 81 42 8e\ +66 49 0d 03 62 64 ce f9 2a f9 41 d3 e3 50 55 fe\ +39 81 e1 4d 29 cb b9 a4 f6 74 73 06 3b ae c7 9a\ +11 79 f5 a1 7c 9c 18 32 f2 83 8f d7 d5 e5 9b b9\ +65 9d 56 dc e8 a0 19 ed ef 1b b3 ac cc 69 7c c6\ +cc 7a 77 8f 60 a0 64 c7 f6 f5 d5 29 c6 21 02 62\ +e0 03 de 58 3e 81 e3 16 7b 89 97 1f b8 c0 e1 5d\ +44 ff fe f8 9b 53 d8 d6 4d d7 97 d1 59 b5 6d 2b\ +08 ea 53 07 ea 12 c2 41 bd 58 d4 ee 27 8a 1f 2e +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 9.6 +Plaintext: \ +b6 b2 8e a2 19 8d 0c 10 08 bc 64 +Seed: # not used yet\ +23 aa de 0e 1e 08 bb 9b 9a 78 d2 30 2a 52 f9 c2\ +1b 2e 1b a2 +Ciphertext: \ +43 8c c7 dc 08 a6 8d a2 49 e4 25 05 f8 57 3b a6\ +0e 2c 27 73 d5 b2 90 f4 cf 9d ff 71 8e 84 20 81\ +c3 83 e6 70 24 a0 f2 95 94 ea 98 7b 9d 25 e4 b7\ +38 f2 85 97 0d 19 5a bb 3a 8c 80 54 e3 d7 9d 6b\ +9c 9a 83 27 ba 59 6f 12 59 e2 71 26 67 47 66 90\ +7d 8d 58 2f f3 a8 47 61 54 92 9a db 1e 6d 12 35\ +b2 cc b4 ec 8f 66 3b a9 cc 67 0a 92 be bd 85 3c\ +8d bf 69 c6 43 6d 01 6f 61 ad d8 36 e9 47 32 45\ +04 34 20 7f 9f d4 c4 3d ec 2a 12 a9 58 ef a0 1e\ +fe 26 69 89 9b 5e 60 4c 25 5c 55 fb 71 66 de 55\ +89 e3 69 59 7b b0 91 68 c0 6d d5 db 17 7e 06 a1\ +74 0e b2 d5 c8 2f ae ca 6d 92 fc ee 99 31 ba 9f +Test: DecryptMatch + +AlgorithmType: AsymmetricCipher +Name: RSA/OAEP-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 10: A 2048-bit RSA Key Pair +Modulus: \ +ae 45 ed 56 01 ce c6 b8 cc 05 f8 03 93 5c 67 4d\ +db e0 d7 5c 4c 09 fd 79 51 fc 6b 0c ae c3 13 a8\ +df 39 97 0c 51 8b ff ba 5e d6 8f 3f 0d 7f 22 a4\ +02 9d 41 3f 1a e0 7e 4e be 9e 41 77 ce 23 e7 f5\ +40 4b 56 9e 4e e1 bd cf 3c 1f b0 3e f1 13 80 2d\ +4f 85 5e b9 b5 13 4b 5a 7c 80 85 ad ca e6 fa 2f\ +a1 41 7e c3 76 3b e1 71 b0 c6 2b 76 0e de 23 c1\ +2a d9 2b 98 08 84 c6 41 f5 a8 fa c2 6b da d4 a0\ +33 81 a2 2f e1 b7 54 88 50 94 c8 25 06 d4 01 9a\ +53 5a 28 6a fe b2 71 bb 9b a5 92 de 18 dc f6 00\ +c2 ae ea e5 6e 02 f7 cf 79 fc 14 cf 3b dc 7c d8\ +4f eb bb f9 50 ca 90 30 4b 22 19 a7 aa 06 3a ef\ +a2 c3 c1 98 0e 56 0c d6 4a fe 77 95 85 b6 10 76\ +57 b9 57 85 7e fd e6 01 09 88 ab 7d e4 17 fc 88\ +d8 f3 84 c4 e6 e7 2c 3f 94 3e 0c 31 c0 c4 a5 cc\ +36 f8 79 d8 a3 ac 9d 7d 59 86 0e aa da 6b 83 bb +PublicExponent: \ +01 00 01 +PrivateExponent: \ +05 6b 04 21 6f e5 f3 54 ac 77 25 0a 4b 6b 0c 85\ +25 a8 5c 59 b0 bd 80 c5 64 50 a2 2d 5f 43 8e 59\ +6a 33 3a a8 75 e2 91 dd 43 f4 8c b8 8b 9d 5f c0\ +d4 99 f9 fc d1 c3 97 f9 af c0 70 cd 9e 39 8c 8d\ +19 e6 1d b7 c7 41 0a 6b 26 75 df bf 5d 34 5b 80\ +4d 20 1a dd 50 2d 5c e2 df cb 09 1c e9 99 7b be\ +be 57 30 6f 38 3e 4d 58 81 03 f0 36 f7 e8 5d 19\ +34 d1 52 a3 23 e4 a8 db 45 1d 6f 4a 5b 1b 0f 10\ +2c c1 50 e0 2f ee e2 b8 8d ea 4a d4 c1 ba cc b2\ +4d 84 07 2d 14 e1 d2 4a 67 71 f7 40 8e e3 05 64\ +fb 86 d4 39 3a 34 bc f0 b7 88 50 1d 19 33 03 f1\ +3a 22 84 b0 01 f0 f6 49 ea f7 93 28 d4 ac 5c 43\ +0a b4 41 49 20 a9 46 0e d1 b7 bc 40 ec 65 3e 87\ +6d 09 ab c5 09 ae 45 b5 25 19 01 16 a0 c2 61 01\ +84 82 98 50 9c 1c 3b f3 a4 83 e7 27 40 54 e1 5e\ +97 07 50 36 e9 89 f6 09 32 80 7b 52 57 75 1e 79 +Prime1: \ +ec f5 ae cd 1e 55 15 ff fa cb d7 5a 28 16 c6 eb\ +f4 90 18 cd fb 46 38 e1 85 d6 6a 73 96 b6 f8 09\ +0f 80 18 c7 fd 95 cc 34 b8 57 dc 17 f0 cc 65 16\ +bb 13 46 ab 4d 58 2c ad ad 7b 41 03 35 23 87 b7\ +03 38 d0 84 04 7c 9d 95 39 b6 49 62 04 b3 dd 6e\ +a4 42 49 92 07 be c0 1f 96 42 87 ff 63 36 c3 98\ +46 58 33 68 46 f5 6e 46 86 18 81 c1 02 33 d2 17\ +6b f1 5a 5e 96 dd c7 80 bc 86 8a a7 7d 3c e7 69 +Prime2: \ +bc 46 c4 64 fc 6a c4 ca 78 3b 0e b0 8a 3c 84 1b\ +77 2f 7e 9b 2f 28 ba bd 58 8a e8 85 e1 a0 c6 1e\ +48 58 a0 fb 25 ac 29 99 90 f3 5b e8 51 64 c2 59\ +ba 11 75 cd d7 19 27 07 13 51 84 99 2b 6c 29 b7\ +46 dd 0d 2c ab e1 42 83 5f 7d 14 8c c1 61 52 4b\ +4a 09 94 6d 48 b8 28 47 3f 1c e7 6b 6c b6 88 6c\ +34 5c 03 e0 5f 41 d5 1b 5c 3a 90 a3 f2 40 73 c7\ +d7 4a 4f e2 5d 9c f2 1c 75 96 0f 3f c3 86 31 83 +ModPrime1PrivateExponent: \ +c7 35 64 57 1d 00 fb 15 d0 8a 3d e9 95 7a 50 91\ +5d 71 26 e9 44 2d ac f4 2b c8 2e 86 2e 56 73 ff\ +6a 00 8e d4 d2 e3 74 61 7d f8 9f 17 a1 60 b4 3b\ +7f da 9c b6 b6 b7 42 18 60 98 15 f7 d4 5c a2 63\ +c1 59 aa 32 d2 72 d1 27 fa f4 bc 8c a2 d7 73 78\ +e8 ae b1 9b 0a d7 da 3c b3 de 0a e7 31 49 80 f6\ +2b 6d 4b 0a 87 5d 1d f0 3c 1b ae 39 cc d8 33 ef\ +6c d7 e2 d9 52 8b f0 84 d1 f9 69 e7 94 e9 f6 c1 +ModPrime2PrivateExponent: \ +26 58 b3 7f 6d f9 c1 03 0b e1 db 68 11 7f a9 d8\ +7e 39 ea 2b 69 3b 7e 6d 3a 2f 70 94 74 13 ee c6\ +14 2e 18 fb 8d fc b6 ac 54 5d 7c 86 a0 ad 48 f8\ +45 71 70 f0 ef b2 6b c4 81 26 c5 3e fd 1d 16 92\ +01 98 dc 2a 11 07 dc 28 2d b6 a8 0c d3 06 23 60\ +ba 3f a1 3f 70 e4 31 2f f1 a6 cd 6b 8f c4 cd 9c\ +5c 3d b1 7c 6d 6a 57 21 2f 73 ae 29 f6 19 32 7b\ +ad 59 b1 53 85 85 85 ba 4e 28 b6 0a 62 a4 5e 49 +MultiplicativeInverseOfPrime2ModPrime1: \ +6f 38 52 6b 39 25 08 55 34 ef 3e 41 5a 83 6e de\ +8b 86 15 8a 2c 7c bf ec cb 0b d8 34 30 4f ec 68\ +3b a8 d4 f4 79 c4 33 d4 34 16 e6 32 69 62 3c ea\ +10 07 76 d8 5a ff 40 1d 3f ff 61 0e e6 54 11 ce\ +3b 13 63 d6 3a 97 09 ee de 42 64 7c ea 56 14 93\ +d5 45 70 a8 79 c1 86 82 cd 97 71 0b 96 20 5e c3\ +11 17 d7 3b 5f 36 22 3f ad d6 e8 ba 90 dd 7c 0e\ +e6 1d 44 e1 63 25 1e 20 c7 f6 6e b3 05 11 7c b8 +Test: KeyPairValidAndConsistent +Comment: RSAES-OAEP Encryption Example 10.1 +Plaintext: \ +8b ba 6b f8 2a 6c 0f 86 d5 f1 75 6e 97 95 68 70\ +b0 89 53 b0 6b 4e b2 05 bc 16 94 ee +Seed: # not used yet\ +47 e1 ab 71 19 fe e5 6c 95 ee 5e aa d8 6f 40 d0\ +aa 63 bd 33 +Ciphertext: \ +53 ea 5d c0 8c d2 60 fb 3b 85 85 67 28 7f a9 15\ +52 c3 0b 2f eb fb a2 13 f0 ae 87 70 2d 06 8d 19\ +ba b0 7f e5 74 52 3d fb 42 13 9d 68 c3 c5 af ee\ +e0 bf e4 cb 79 69 cb f3 82 b8 04 d6 e6 13 96 14\ +4e 2d 0e 60 74 1f 89 93 c3 01 4b 58 b9 b1 95 7a\ +8b ab cd 23 af 85 4f 4c 35 6f b1 66 2a a7 2b fc\ +c7 e5 86 55 9d c4 28 0d 16 0c 12 67 85 a7 23 eb\ +ee be ff 71 f1 15 94 44 0a ae f8 7d 10 79 3a 87\ +74 a2 39 d4 a0 4c 87 fe 14 67 b9 da f8 52 08 ec\ +6c 72 55 79 4a 96 cc 29 14 2f 9a 8b d4 18 e3 c1\ +fd 67 34 4b 0c d0 82 9d f3 b2 be c6 02 53 19 62\ +93 c6 b3 4d 3f 75 d3 2f 21 3d d4 5c 62 73 d5 05\ +ad f4 cc ed 10 57 cb 75 8f c2 6a ee fa 44 12 55\ +ed 4e 64 c1 99 ee 07 5e 7f 16 64 61 82 fd b4 64\ +73 9b 68 ab 5d af f0 e6 3e 95 52 01 68 24 f0 54\ +bf 4d 3c 8c 90 a9 7b b6 b6 55 32 84 eb 42 9f cc +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 10.2 +Plaintext: \ +e6 ad 18 1f 05 3b 58 a9 04 f2 45 75 10 37 3e 57 +Seed: # not used yet\ +6d 17 f5 b4 c1 ff ac 35 1d 19 5b f7 b0 9d 09 f0\ +9a 40 79 cf +Ciphertext: \ +a2 b1 a4 30 a9 d6 57 e2 fa 1c 2b b5 ed 43 ff b2\ +5c 05 a3 08 fe 90 93 c0 10 31 79 5f 58 74 40 01\ +10 82 8a e5 8f b9 b5 81 ce 9d dd d3 e5 49 ae 04\ +a0 98 54 59 bd e6 c6 26 59 4e 7b 05 dc 42 78 b2\ +a1 46 5c 13 68 40 88 23 c8 5e 96 dc 66 c3 a3 09\ +83 c6 39 66 4f c4 56 9a 37 fe 21 e5 a1 95 b5 77\ +6e ed 2d f8 d8 d3 61 af 68 6e 75 02 29 bb d6 63\ +f1 61 86 8a 50 61 5e 0c 33 7b ec 0c a3 5f ec 0b\ +b1 9c 36 eb 2e 0b bc c0 58 2f a1 d9 3a ac db 06\ +10 63 f5 9f 2c e1 ee 43 60 5e 5d 89 ec a1 83 d2\ +ac df e9 f8 10 11 02 2a d3 b4 3a 3d d4 17 da c9\ +4b 4e 11 ea 81 b1 92 96 6e 96 6b 18 20 82 e7 19\ +64 60 7b 4f 80 02 f3 62 99 84 4a 11 f2 ae 0f ae\ +ac 2e ae 70 f8 f4 f9 80 88 ac dc d0 ac 55 6e 9f\ +cc c5 11 52 19 08 fa d2 6f 04 c6 42 01 45 03 05\ +77 87 58 b0 53 8b f8 b5 bb 14 4a 82 8e 62 97 95 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 10.3 +Plaintext: \ +51 0a 2c f6 0e 86 6f a2 34 05 53 c9 4e a3 9f bc\ +25 63 11 e8 3e 94 45 4b 41 24 +Seed: # not used yet\ +38 53 87 51 4d ec cc 7c 74 0d d8 cd f9 da ee 49\ +a1 cb fd 54 +Ciphertext: \ +98 86 c3 e6 76 4a 8b 9a 84 e8 41 48 eb d8 c3 b1\ +aa 80 50 38 1a 78 f6 68 71 4c 16 d9 cf d2 a6 ed\ +c5 69 79 c5 35 d9 de e3 b4 4b 85 c1 8b e8 92 89\ +92 37 17 11 47 22 16 d9 5d da 98 d2 ee 83 47 c9\ +b1 4d ff df f8 4a a4 8d 25 ac 06 f7 d7 e6 53 98\ +ac 96 7b 1c e9 09 25 f6 7d ce 04 9b 7f 81 2d b0\ +74 29 97 a7 4d 44 fe 81 db e0 e7 a3 fe af 2e 5c\ +40 af 88 8d 55 0d db be 3b c2 06 57 a2 95 43 f8\ +fc 29 13 b9 bd 1a 61 b2 ab 22 56 ec 40 9b bd 7d\ +c0 d1 77 17 ea 25 c4 3f 42 ed 27 df 87 38 bf 4a\ +fc 67 66 ff 7a ff 08 59 55 5e e2 83 92 0f 4c 8a\ +63 c4 a7 34 0c ba fd dc 33 9e cd b4 b0 51 50 02\ +f9 6c 93 2b 5b 79 16 7a f6 99 c0 ad 3f cc fd f0\ +f4 4e 85 a7 02 62 bf 2e 18 fe 34 b8 50 58 99 75\ +e8 67 ff 96 9d 48 ea bf 21 22 71 54 6c dc 05 a6\ +9e cb 52 6e 52 87 0c 83 6f 30 7b d7 98 78 0e de +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 10.4 +Plaintext: \ +bc dd 19 0d a3 b7 d3 00 df 9a 06 e2 2c aa e2 a7\ +5f 10 c9 1f f6 67 b7 c1 6b de 8b 53 06 4a 26 49\ +a9 40 45 c9 +Seed: # not used yet\ +5c ac a6 a0 f7 64 16 1a 96 84 f8 5d 92 b6 e0 ef\ +37 ca 8b 65 +Ciphertext: \ +63 18 e9 fb 5c 0d 05 e5 30 7e 16 83 43 6e 90 32\ +93 ac 46 42 35 8a aa 22 3d 71 63 01 3a ba 87 e2\ +df da 8e 60 c6 86 0e 29 a1 e9 26 86 16 3e a0 b9\ +17 5f 32 9c a3 b1 31 a1 ed d3 a7 77 59 a8 b9 7b\ +ad 6a 4f 8f 43 96 f2 8c f6 f3 9c a5 81 12 e4 81\ +60 d6 e2 03 da a5 85 6f 3a ca 5f fe d5 77 af 49\ +94 08 e3 df d2 33 e3 e6 04 db e3 4a 9c 4c 90 82\ +de 65 52 7c ac 63 31 d2 9d c8 0e 05 08 a0 fa 71\ +22 e7 f3 29 f6 cc a5 cf a3 4d 4d 1d a4 17 80 54\ +57 e0 08 be c5 49 e4 78 ff 9e 12 a7 63 c4 77 d1\ +5b bb 78 f5 b6 9b d5 78 30 fc 2c 4e d6 86 d7 9b\ +c7 2a 95 d8 5f 88 13 4c 6b 0a fe 56 a8 cc fb c8\ +55 82 8b b3 39 bd 17 90 9c f1 d7 0d e3 33 5a e0\ +70 39 09 3e 60 6d 65 53 65 de 65 50 b8 72 cd 6d\ +e1 d4 40 ee 03 1b 61 94 5f 62 9a d8 a3 53 b0 d4\ +09 39 e9 6a 3c 45 0d 2a 8d 5e ee 9f 67 80 93 c8 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 10.5 +Plaintext: \ +a7 dd 6c 7d c2 4b 46 f9 dd 5f 1e 91 ad a4 c3 b3\ +df 94 7e 87 72 32 a9 +Seed: # not used yet\ +95 bc a9 e3 85 98 94 b3 dd 86 9f a7 ec d5 bb c6\ +40 1b f3 e4 +Ciphertext: \ +75 29 08 72 cc fd 4a 45 05 66 0d 65 1f 56 da 6d\ +aa 09 ca 13 01 d8 90 63 2f 6a 99 2f 3d 56 5c ee\ +46 4a fd ed 40 ed 3b 5b e9 35 67 14 ea 5a a7 65\ +5f 4a 13 66 c2 f1 7c 72 8f 6f 2c 5a 5d 1f 8e 28\ +42 9b c4 e6 f8 f2 cf f8 da 8d c0 e0 a9 80 8e 45\ +fd 09 ea 2f a4 0c b2 b6 ce 6f ff f5 c0 e1 59 d1\ +1b 68 d9 0a 85 f7 b8 4e 10 3b 09 e6 82 66 64 80\ +c6 57 50 5c 09 29 25 94 68 a3 14 78 6d 74 ea b1\ +31 57 3c f2 34 bf 57 db 7d 9e 66 cc 67 48 19 2e\ +00 2d c0 de ea 93 05 85 f0 83 1f dc d9 bc 33 d5\ +1f 79 ed 2f fc 16 bc f4 d5 98 12 fc eb ca a3 f9\ +06 9b 0e 44 56 86 d6 44 c2 5c cf 63 b4 56 ee 5f\ +a6 ff e9 6f 19 cd f7 51 fe d9 ea f3 59 57 75 4d\ +bf 4b fe a5 21 6a a1 84 4d c5 07 cb 2d 08 0e 72\ +2e ba 15 03 08 c2 b5 ff 11 93 62 0f 17 66 ec f4\ +48 1b af b9 43 bd 29 28 77 f2 13 6c a4 94 ab a0 +Test: DecryptMatch +Comment: RSAES-OAEP Encryption Example 10.6 +Plaintext: \ +ea f1 a7 3a 1b 0c 46 09 53 7d e6 9c d9 22 8b bc\ +fb 9a 8c a8 c6 c3 ef af 05 6f e4 a7 f4 63 4e d0\ +0b 7c 39 ec 69 22 d7 b8 ea 2c 04 eb ac +Seed: # not used yet\ +9f 47 dd f4 2e 97 ee a8 56 a9 bd bc 71 4e b3 ac\ +22 f6 eb 32 +Ciphertext: \ +2d 20 7a 73 43 2a 8f b4 c0 30 51 b3 f7 3b 28 a6\ +17 64 09 8d fa 34 c4 7a 20 99 5f 81 15 aa 68 16\ +67 9b 55 7e 82 db ee 58 49 08 c6 e6 97 82 d7 de\ +b3 4d bd 65 af 06 3d 57 fc a7 6a 5f d0 69 49 2f\ +d6 06 8d 99 84 d2 09 35 05 65 a6 2e 5c 77 f2 30\ +38 c1 2c b1 0c 66 34 70 9b 54 7c 46 f6 b4 a7 09\ +bd 85 ca 12 2d 74 46 5e f9 77 62 c2 97 63 e0 6d\ +bc 7a 9e 73 8c 78 bf ca 01 02 dc 5e 79 d6 5b 97\ +3f 28 24 0c aa b2 e1 61 a7 8b 57 d2 62 45 7e d8\ +19 5d 53 e3 c7 ae 9d a0 21 88 3c 6d b7 c2 4a fd\ +d2 32 2e ac 97 2a d3 c3 54 c5 fc ef 1e 14 6c 3a\ +02 90 fb 67 ad f0 07 06 6e 00 42 8d 2c ec 18 ce\ +58 f9 32 86 98 de fe f4 b2 eb 5e c7 69 18 fd e1\ +c1 98 cb b3 8b 7a fc 67 62 6a 9a ef ec 43 22 bf\ +d9 0d 25 63 48 1c 9a 22 1f 78 c8 27 2c 82 d1 b6\ +2a b9 14 e1 c6 9f 6a f6 ef 30 ca 52 60 db 4a 46 +Test: DecryptMatch diff --git a/cryptopp/TestVectors/rsa_pkcs1_1_5.txt b/cryptopp/TestVectors/rsa_pkcs1_1_5.txt new file mode 100644 index 0000000..2272b7c --- /dev/null +++ b/cryptopp/TestVectors/rsa_pkcs1_1_5.txt @@ -0,0 +1,89 @@ +AlgorithmType: Signature +Name: RSA/PKCS1-1.5(MD2) +KeyFormat: DER +Source: http://www.rsasecurity.com/rsalabs/pkcs/index.html, \ + Some Examples of the PKCS Standards +PrivateKey: \ + 30 82 01 50\ + 02 01 00 #version = 0\ + 30 0d #privateKeyAlgorithmIdentifier\ + 06 09 #algorithm = rsaEncryption\ + 2a 86 48 86 f7 0d 01 01 01\ + 05 00 #parameters = NULL\ + 04 82 01 3a #privateKey = RSAPrivateKey encoding\ + 30 82 01 36\ + 02 01 00 #version = 0\ + 02 40 #modulus = n\ + 0a 66 79 1d c6 98 81 68 de 7a b7 74 19 bb 7f b0\ + c0 01 c6 27 10 27 00 75 14 29 42 e1 9a 8d 8c 51\ + d0 53 b3 e3 78 2a 1d e5 dc 5a f4 eb e9 94 68 17\ + 01 14 a1 df e6 7c dc 9a 9a f5 5d 65 56 20 bb ab\ + 02 03 01 00 01 #publicExponent = e\ + 02 40 #privateExponent = d\ + 01 23 c5 b6 1b a3 6e db 1d 36 79 90 41 99 a8 9e\ + a8 0c 09 b9 12 2e 14 00 c0 9a dc f7 78 46 76 d0\ + 1d 23 35 6a 7d 44 d6 bd 8b d5 0e 94 bf c7 23 fa\ + 87 d8 86 2b 75 17 76 91 c1 1d 75 76 92 df 88 81\ + 02 20 #prime1 = p\ + 33 d4 84 45 c8 59 e5 23 40 de 70 4b cd da 06 5f\ + bb 40 58 d7 40 bd 1d 67 d2 9e 9c 14 6c 11 cf 61\ + 02 20 #prime2 = q\ + 33 5e 84 08 86 6b 0f d3 8d c7 00 2d 3f 97 2c 67\ + 38 9a 65 d5 d8 30 65 66 d5 c4 f2 a5 aa 52 62 8b\ + 02 20 #exponent1 = d mod p-1\ + 04 5e c9 00 71 52 53 25 d3 d4 6d b7 96 95 e9 af\ + ac c4 52 39 64 36 0e 02 b1 19 ba a3 66 31 62 41\ + 02 20 #exponent2 = d mod q-1\ + 15 eb 32 73 60 c7 b6 0d 12 e5 e2 d1 6b dc d9 79\ + 81 d1 7f ba 6b 70 db 13 b2 0b 43 6e 24 ea da 59\ + 02 20 #coefficient = q-1 mod p\ + 2c a6 36 6d 72 78 1d fa 24 d3 4a 9a 24 cb c2 ae\ + 92 7a 99 58 af 42 65 63 ff 63 fb 11 65 8a 46 1d +PublicKey: \ + 30 5b #subjectPublicKeyInfo\ + 30 0d #algorithm\ + 06 09 #algorithm = rsaEncryption\ + 2a 86 48 86 f7 0d 01 01 01\ + 05 00 #parameters = NULL\ + 03 4a #subjectPublicKey = RSAPublicKey encoding\ + 00\ + 30 47\ + 02 40 #modulus = n\ + 0a 66 79 1d c6 98 81 68 de 7a b7 74 19 bb 7f b0\ + c0 01 c6 27 10 27 00 75 14 29 42 e1 9a 8d 8c 51\ + d0 53 b3 e3 78 2a 1d e5 dc 5a f4 eb e9 94 68 17\ + 01 14 a1 df e6 7c dc 9a 9a f5 5d 65 56 20 bb ab\ + 02 03 01 00 01 #publicExponent = e +Test: KeyPairValidAndConsistent +Message: # "Everyone gets Friday off."\ + 45 76 65 72 79 6f 6e 65 20 67 65 74 73 20 46 72 69 64 61 79 20 6f 66 66 2e +Signature: \ + 05fa6a812fc7df8bf4f2542509e03e84\ + 6e11b9c620be2009efb440efbcc66921\ + 6994ac04f341b57d05202d428fb2a27b\ + 5c77dfd9b15bfc3d559353503410c1e1 +Test: Verify +Name: RSA/PKCS1-1.5(SHA-1) +Source: generated by Wei Dai using Crypto++ 5.0 +Signature: 0610761F95FFD1B8F29DA34212947EC2AA0E358866A722F03CC3C41487ADC604A48FF54F5C6BEDB9FB7BD59F82D6E55D8F3174BA361B2214B2D74E8825E04E81 +Test: Verify +Message: 00 +Test: NotVerify + +AlgorithmType: Signature +Name: RSA/PKCS1-1.5(SHA-1) +Source: http://islab.oregonstate.edu/emails/pkcs-tng-02/0152 +KeyFormat: Component +Modulus: A885B6F851A8079AB8A281DB0297148511EE0D8C07C0D4AE6D6FED461488E0D41E3FF8F281B06A3240B5007A5C2AB4FB6BE8AF88F119DB998368DDDC9710ABED +PublicExponent: 010001 +PrivateExponent: 2B259D2CA3DF851EE891F6F4678BDDFD9A131C95D3305C63D2723B4A5B9C960F5EC8BB7DCDDBEBD8B6A38767D64AD451E9383E0891E4EE7506100481F2B49323 +Prime1: D7103CD676E39824E2BE50B8E6533FE7CB7484348E283802AD2B8D00C80D19DF +Prime2: C89996DC169CEB3F227958275968804D4BE9FC4012C3219662F1A438C9950BB3 +ModPrime1PrivateExponent: 5D8EA4C8AF83A70634D5920C3DB66D908AC3AF57A597FD75BC9BBB856181C185 +ModPrime2PrivateExponent: C598E54DAEC8ABC1E907769A6C2BD01653ED0C9960E1EDB7E186FDA922883A99 +MultiplicativeInverseOfPrime2ModPrime1: 7C6F27B5B51B78AD80FB36E700990CF307866F2943124CBD93D97C137794C104 +Test: KeyPairValidAndConsistent +Source: generated by Wei Dai using Crypto++ 5.0 +Message: 74657374 # "test" +Signature: A7E00CE4391F914D82158D9B732759808E25A1C6383FE87A5199157650D4296CF612E9FF809E686A0AF328238306E79965F6D0138138829D9A1A22764306F6CE +Test: Verify diff --git a/cryptopp/TestVectors/rsa_pss.txt b/cryptopp/TestVectors/rsa_pss.txt new file mode 100644 index 0000000..1b5fc9c --- /dev/null +++ b/cryptopp/TestVectors/rsa_pss.txt @@ -0,0 +1,2083 @@ +AlgorithmType: Signature +Name: RSA/PSS-MGF1(SHA-1) +Source: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/, PKCS #1 test vectors +KeyFormat: Component +Comment: Example 1: A 1024-bit RSA Key Pair +Modulus: \ +a5 6e 4a 0e 70 10 17 58 9a 51 87 dc 7e a8 41 d1\ +56 f2 ec 0e 36 ad 52 a4 4d fe b1 e6 1f 7a d9 91\ +d8 c5 10 56 ff ed b1 62 b4 c0 f2 83 a1 2a 88 a3\ +94 df f5 26 ab 72 91 cb b3 07 ce ab fc e0 b1 df\ +d5 cd 95 08 09 6d 5b 2b 8b 6d f5 d6 71 ef 63 77\ +c0 92 1c b2 3c 27 0a 70 e2 59 8e 6f f8 9d 19 f1\ +05 ac c2 d3 f0 cb 35 f2 92 80 e1 38 6b 6f 64 c4\ +ef 22 e1 e1 f2 0d 0c e8 cf fb 22 49 bd 9a 21 37 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +33 a5 04 2a 90 b2 7d 4f 54 51 ca 9b bb d0 b4 47\ +71 a1 01 af 88 43 40 ae f9 88 5f 2a 4b be 92 e8\ +94 a7 24 ac 3c 56 8c 8f 97 85 3a d0 7c 02 66 c8\ +c6 a3 ca 09 29 f1 e8 f1 12 31 88 44 29 fc 4d 9a\ +e5 5f ee 89 6a 10 ce 70 7c 3e d7 e7 34 e4 47 27\ +a3 95 74 50 1a 53 26 83 10 9c 2a ba ca ba 28 3c\ +31 b4 bd 2f 53 c3 ee 37 e3 52 ce e3 4f 9e 50 3b\ +d8 0c 06 22 ad 79 c6 dc ee 88 35 47 c6 a3 b3 25 +Prime1: \ +e7 e8 94 27 20 a8 77 51 72 73 a3 56 05 3e a2 a1\ +bc 0c 94 aa 72 d5 5c 6e 86 29 6b 2d fc 96 79 48\ +c0 a7 2c bc cc a7 ea cb 35 70 6e 09 a1 df 55 a1\ +53 5b d9 b3 cc 34 16 0b 3b 6d cd 3e da 8e 64 43 +Prime2: \ +b6 9d ca 1c f7 d4 d7 ec 81 e7 5b 90 fc ca 87 4a\ +bc de 12 3f d2 70 01 80 aa 90 47 9b 6e 48 de 8d\ +67 ed 24 f9 f1 9d 85 ba 27 58 74 f5 42 cd 20 dc\ +72 3e 69 63 36 4a 1f 94 25 45 2b 26 9a 67 99 fd +ModPrime1PrivateExponent: \ +28 fa 13 93 86 55 be 1f 8a 15 9c ba ca 5a 72 ea\ +19 0c 30 08 9e 19 cd 27 4a 55 6f 36 c4 f6 e1 9f\ +55 4b 34 c0 77 79 04 27 bb dd 8d d3 ed e2 44 83\ +28 f3 85 d8 1b 30 e8 e4 3b 2f ff a0 27 86 19 79 +ModPrime2PrivateExponent: \ +1a 8b 38 f3 98 fa 71 20 49 89 8d 7f b7 9e e0 a7\ +76 68 79 12 99 cd fa 09 ef c0 e5 07 ac b2 1e d7\ +43 01 ef 5b fd 48 be 45 5e ae b6 e1 67 82 55 82\ +75 80 a8 e4 e8 e1 41 51 d1 51 0a 82 a3 f2 e7 29 +MultiplicativeInverseOfPrime2ModPrime1: \ +27 15 6a ba 41 26 d2 4a 81 f3 a5 28 cb fb 27 f5\ +68 86 f8 40 a9 f6 e8 6e 17 a4 4b 94 fe 93 19 58\ +4b 8e 22 fd de 1e 5a 2e 3b d8 aa 5b a8 d8 58 41\ +94 eb 21 90 ac f8 32 b8 47 f1 3a 3d 24 a7 9f 4d +Test: KeyPairValidAndConsistent +Comment: RSASSA-PSS Signature Example 1.1 +Message: \ +cd c8 7d a2 23 d7 86 df 3b 45 e0 bb bc 72 13 26\ +d1 ee 2a f8 06 cc 31 54 75 cc 6f 0d 9c 66 e1 b6\ +23 71 d4 5c e2 39 2e 1a c9 28 44 c3 10 10 2f 15\ +6a 0d 8d 52 c1 f4 c4 0b a3 aa 65 09 57 86 cb 76\ +97 57 a6 56 3b a9 58 fe d0 bc c9 84 e8 b5 17 a3\ +d5 f5 15 b2 3b 8a 41 e7 4a a8 67 69 3f 90 df b0\ +61 a6 e8 6d fa ae e6 44 72 c0 0e 5f 20 94 57 29\ +cb eb e7 7f 06 ce 78 e0 8f 40 98 fb a4 1f 9d 61\ +93 c0 31 7e 8b 60 d4 b6 08 4a cb 42 d2 9e 38 08\ +a3 bc 37 2d 85 e3 31 17 0f cb f7 cc 72 d0 b7 1c\ +29 66 48 b3 a4 d1 0f 41 62 95 d0 80 7a a6 25 ca\ +b2 74 4f d9 ea 8f d2 23 c4 25 37 02 98 28 bd 16\ +be 02 54 6f 13 0f d2 e3 3b 93 6d 26 76 e0 8a ed\ +1b 73 31 8b 75 0a 01 67 d0 +Salt: \ +de e9 59 c7 e0 64 11 36 14 20 ff 80 18 5e d5 7f\ +3e 67 76 af +Signature: \ +90 74 30 8f b5 98 e9 70 1b 22 94 38 8e 52 f9 71\ +fa ac 2b 60 a5 14 5a f1 85 df 52 87 b5 ed 28 87\ +e5 7c e7 fd 44 dc 86 34 e4 07 c8 e0 e4 36 0b c2\ +26 f3 ec 22 7f 9d 9e 54 63 8e 8d 31 f5 05 12 15\ +df 6e bb 9c 2f 95 79 aa 77 59 8a 38 f9 14 b5 b9\ +c1 bd 83 c4 e2 f9 f3 82 a0 d0 aa 35 42 ff ee 65\ +98 4a 60 1b c6 9e b2 8d eb 27 dc a1 2c 82 c2 d4\ +c3 f6 6c d5 00 f1 ff 2b 99 4d 8a 4e 30 cb b3 3c +Test: Verify +Comment: RSASSA-PSS Signature Example 1.2 +Message: \ +85 13 84 cd fe 81 9c 22 ed 6c 4c cb 30 da eb 5c\ +f0 59 bc 8e 11 66 b7 e3 53 0c 4c 23 3e 2b 5f 8f\ +71 a1 cc a5 82 d4 3e cc 72 b1 bc a1 6d fc 70 13\ +22 6b 9e +Salt: \ +ef 28 69 fa 40 c3 46 cb 18 3d ab 3d 7b ff c9 8f\ +d5 6d f4 2d +Signature: \ +3e f7 f4 6e 83 1b f9 2b 32 27 41 42 a5 85 ff ce\ +fb dc a7 b3 2a e9 0d 10 fb 0f 0c 72 99 84 f0 4e\ +f2 9a 9d f0 78 07 75 ce 43 73 9b 97 83 83 90 db\ +0a 55 05 e6 3d e9 27 02 8d 9d 29 b2 19 ca 2c 45\ +17 83 25 58 a5 5d 69 4a 6d 25 b9 da b6 60 03 c4\ +cc cd 90 78 02 19 3b e5 17 0d 26 14 7d 37 b9 35\ +90 24 1b e5 1c 25 05 5f 47 ef 62 75 2c fb e2 14\ +18 fa fe 98 c2 2c 4d 4d 47 72 4f db 56 69 e8 43 +Test: Verify +Comment: RSASSA-PSS Signature Example 1.3 +Message: \ +a4 b1 59 94 17 61 c4 0c 6a 82 f2 b8 0d 1b 94 f5\ +aa 26 54 fd 17 e1 2d 58 88 64 67 9b 54 cd 04 ef\ +8b d0 30 12 be 8d c3 7f 4b 83 af 79 63 fa ff 0d\ +fa 22 54 77 43 7c 48 01 7f f2 be 81 91 cf 39 55\ +fc 07 35 6e ab 3f 32 2f 7f 62 0e 21 d2 54 e5 db\ +43 24 27 9f e0 67 e0 91 0e 2e 81 ca 2c ab 31 c7\ +45 e6 7a 54 05 8e b5 0d 99 3c db 9e d0 b4 d0 29\ +c0 6d 21 a9 4c a6 61 c3 ce 27 fa e1 d6 cb 20 f4\ +56 4d 66 ce 47 67 58 3d 0e 5f 06 02 15 b5 90 17\ +be 85 ea 84 89 39 12 7b d8 c9 c4 d4 7b 51 05 6c\ +03 1c f3 36 f1 7c 99 80 f3 b8 f5 b9 b6 87 8e 8b\ +79 7a a4 3b 88 26 84 33 3e 17 89 3f e9 ca a6 aa\ +29 9f 7e d1 a1 8e e2 c5 48 64 b7 b2 b9 9b 72 61\ +8f b0 25 74 d1 39 ef 50 f0 19 c9 ee f4 16 97 13\ +38 e7 d4 70 +Salt: \ +71 0b 9c 47 47 d8 00 d4 de 87 f1 2a fd ce 6d f1\ +81 07 cc 77 +Signature: \ +66 60 26 fb a7 1b d3 e7 cf 13 15 7c c2 c5 1a 8e\ +4a a6 84 af 97 78 f9 18 49 f3 43 35 d1 41 c0 01\ +54 c4 19 76 21 f9 62 4a 67 5b 5a bc 22 ee 7d 5b\ +aa ff aa e1 c9 ba ca 2c c3 73 b3 f3 3e 78 e6 14\ +3c 39 5a 91 aa 7f ac a6 64 eb 73 3a fd 14 d8 82\ +72 59 d9 9a 75 50 fa ca 50 1e f2 b0 4e 33 c2 3a\ +a5 1f 4b 9e 82 82 ef db 72 8c c0 ab 09 40 5a 91\ +60 7c 63 69 96 1b c8 27 0d 2d 4f 39 fc e6 12 b1 +Test: Verify +Comment: RSASSA-PSS Signature Example 1.4 +Message: \ +bc 65 67 47 fa 9e af b3 f0 +Salt: \ +05 6f 00 98 5d e1 4d 8e f5 ce a9 e8 2f 8c 27 be\ +f7 20 33 5e +Signature: \ +46 09 79 3b 23 e9 d0 93 62 dc 21 bb 47 da 0b 4f\ +3a 76 22 64 9a 47 d4 64 01 9b 9a ea fe 53 35 9c\ +17 8c 91 cd 58 ba 6b cb 78 be 03 46 a7 bc 63 7f\ +4b 87 3d 4b ab 38 ee 66 1f 19 96 34 c5 47 a1 ad\ +84 42 e0 3d a0 15 b1 36 e5 43 f7 ab 07 c0 c1 3e\ +42 25 b8 de 8c ce 25 d4 f6 eb 84 00 f8 1f 7e 18\ +33 b7 ee 6e 33 4d 37 09 64 ca 79 fd b8 72 b4 d7\ +52 23 b5 ee b0 81 01 59 1f b5 32 d1 55 a6 de 87 +Test: Verify +Comment: RSASSA-PSS Signature Example 1.5 +Message: \ +b4 55 81 54 7e 54 27 77 0c 76 8e 8b 82 b7 55 64\ +e0 ea 4e 9c 32 59 4d 6b ff 70 65 44 de 0a 87 76\ +c7 a8 0b 45 76 55 0e ee 1b 2a ca bc 7e 8b 7d 3e\ +f7 bb 5b 03 e4 62 c1 10 47 ea dd 00 62 9a e5 75\ +48 0a c1 47 0f e0 46 f1 3a 2b f5 af 17 92 1d c4\ +b0 aa 8b 02 be e6 33 49 11 65 1d 7f 85 25 d1 0f\ +32 b5 1d 33 be 52 0d 3d df 5a 70 99 55 a3 df e7\ +82 83 b9 e0 ab 54 04 6d 15 0c 17 7f 03 7f dc cc\ +5b e4 ea 5f 68 b5 e5 a3 8c 9d 7e dc cc c4 97 5f\ +45 5a 69 09 b4 +Salt: \ +80 e7 0f f8 6a 08 de 3e c6 09 72 b3 9b 4f bf dc\ +ea 67 ae 8e +Signature: \ +1d 2a ad 22 1c a4 d3 1d df 13 50 92 39 01 93 98\ +e3 d1 4b 32 dc 34 dc 5a f4 ae ae a3 c0 95 af 73\ +47 9c f0 a4 5e 56 29 63 5a 53 a0 18 37 76 15 b1\ +6c b9 b1 3b 3e 09 d6 71 eb 71 e3 87 b8 54 5c 59\ +60 da 5a 64 77 6e 76 8e 82 b2 c9 35 83 bf 10 4c\ +3f db 23 51 2b 7b 4e 89 f6 33 dd 00 63 a5 30 db\ +45 24 b0 1c 3f 38 4c 09 31 0e 31 5a 79 dc d3 d6\ +84 02 2a 7f 31 c8 65 a6 64 e3 16 97 8b 75 9f ad +Test: Verify +Comment: RSASSA-PSS Signature Example 1.6 +Message: \ +10 aa e9 a0 ab 0b 59 5d 08 41 20 7b 70 0d 48 d7\ +5f ae dd e3 b7 75 cd 6b 4c c8 8a e0 6e 46 94 ec\ +74 ba 18 f8 52 0d 4f 5e a6 9c bb e7 cc 2b eb a4\ +3e fd c1 02 15 ac 4e b3 2d c3 02 a1 f5 3d c6 c4\ +35 22 67 e7 93 6c fe bf 7c 8d 67 03 57 84 a3 90\ +9f a8 59 c7 b7 b5 9b 8e 39 c5 c2 34 9f 18 86 b7\ +05 a3 02 67 d4 02 f7 48 6a b4 f5 8c ad 5d 69 ad\ +b1 7a b8 cd 0c e1 ca f5 02 5a f4 ae 24 b1 fb 87\ +94 c6 07 0c c0 9a 51 e2 f9 91 13 11 e3 87 7d 00\ +44 c7 1c 57 a9 93 39 50 08 80 6b 72 3a c3 83 73\ +d3 95 48 18 18 52 8c 1e 70 53 73 92 82 05 35 29\ +51 0e 93 5c d0 fa 77 b8 fa 53 cc 2d 47 4b d4 fb\ +3c c5 c6 72 d6 ff dc 90 a0 0f 98 48 71 2c 4b cf\ +e4 6c 60 57 36 59 b1 1e 64 57 e8 61 f0 f6 04 b6\ +13 8d 14 4f 8c e4 e2 da 73 +Salt: \ +a8 ab 69 dd 80 1f 00 74 c2 a1 fc 60 64 98 36 c6\ +16 d9 96 81 +Signature: \ +2a 34 f6 12 5e 1f 6b 0b f9 71 e8 4f bd 41 c6 32\ +be 8f 2c 2a ce 7d e8 b6 92 6e 31 ff 93 e9 af 98\ +7f bc 06 e5 1e 9b e1 4f 51 98 f9 1f 3f 95 3b d6\ +7d a6 0a 9d f5 97 64 c3 dc 0f e0 8e 1c be f0 b7\ +5f 86 8d 10 ad 3f ba 74 9f ef 59 fb 6d ac 46 a0\ +d6 e5 04 36 93 31 58 6f 58 e4 62 8f 39 aa 27 89\ +82 54 3b c0 ee b5 37 dc 61 95 80 19 b3 94 fb 27\ +3f 21 58 58 a0 a0 1a c4 d6 50 b9 55 c6 7f 4c 58 +Test: Verify +Comment: Example 2: A 1025-bit RSA Key Pair +Modulus: \ +01 d4 0c 1b cf 97 a6 8a e7 cd bd 8a 7b f3 e3 4f\ +a1 9d cc a4 ef 75 a4 74 54 37 5f 94 51 4d 88 fe\ +d0 06 fb 82 9f 84 19 ff 87 d6 31 5d a6 8a 1f f3\ +a0 93 8e 9a bb 34 64 01 1c 30 3a d9 91 99 cf 0c\ +7c 7a 8b 47 7d ce 82 9e 88 44 f6 25 b1 15 e5 e9\ +c4 a5 9c f8 f8 11 3b 68 34 33 6a 2f d2 68 9b 47\ +2c bb 5e 5c ab e6 74 35 0c 59 b6 c1 7e 17 68 74\ +fb 42 f8 fc 3d 17 6a 01 7e dc 61 fd 32 6c 4b 33\ +c9 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +02 7d 14 7e 46 73 05 73 77 fd 1e a2 01 56 57 72\ +17 6a 7d c3 83 58 d3 76 04 56 85 a2 e7 87 c2 3c\ +15 57 6b c1 6b 9f 44 44 02 d6 bf c5 d9 8a 3e 88\ +ea 13 ef 67 c3 53 ec a0 c0 dd ba 92 55 bd 7b 8b\ +b5 0a 64 4a fd fd 1d d5 16 95 b2 52 d2 2e 73 18\ +d1 b6 68 7a 1c 10 ff 75 54 5f 3d b0 fe 60 2d 5f\ +2b 7f 29 4e 36 01 ea b7 b9 d1 ce cd 76 7f 64 69\ +2e 3e 53 6c a2 84 6c b0 c2 dd 48 6a 39 fa 75 b1 +Prime1: \ +01 66 01 e9 26 a0 f8 c9 e2 6e ca b7 69 ea 65 a5\ +e7 c5 2c c9 e0 80 ef 51 94 57 c6 44 da 68 91 c5\ +a1 04 d3 ea 79 55 92 9a 22 e7 c6 8a 7a f9 fc ad\ +77 7c 3c cc 2b 9e 3d 36 50 bc e4 04 39 9b 7e 59\ +d1 +Prime2: \ +01 4e af a1 d4 d0 18 4d a7 e3 1f 87 7d 12 81 dd\ +da 62 56 64 86 9e 83 79 e6 7a d3 b7 5e ae 74 a5\ +80 e9 82 7a bd 6e b7 a0 02 cb 54 11 f5 26 67 97\ +76 8f b8 e9 5a e4 0e 3e 8a 01 f3 5f f8 9e 56 c0\ +79 +ModPrime1PrivateExponent: \ +e2 47 cc e5 04 93 9b 8f 0a 36 09 0d e2 00 93 87\ +55 e2 44 4b 29 53 9a 7d a7 a9 02 f6 05 68 35 c0\ +db 7b 52 55 94 97 cf e2 c6 1a 80 86 d0 21 3c 47\ +2c 78 85 18 00 b1 71 f6 40 1d e2 e9 c2 75 6f 31 +ModPrime2PrivateExponent: \ +b1 2f ba 75 78 55 e5 86 e4 6f 64 c3 8a 70 c6 8b\ +3f 54 8d 93 d7 87 b3 99 99 9d 4c 8f 0b bd 25 81\ +c2 1e 19 ed 00 18 a6 d5 d3 df 86 42 4b 3a bc ad\ +40 19 9d 31 49 5b 61 30 9f 27 c1 bf 55 d4 87 c1 +MultiplicativeInverseOfPrime2ModPrime1: \ +56 4b 1e 1f a0 03 bd a9 1e 89 09 04 25 aa c0 5b\ +91 da 9e e2 50 61 e7 62 8d 5f 51 30 4a 84 99 2f\ +dc 33 76 2b d3 78 a5 9f 03 0a 33 4d 53 2b d0 da\ +e8 f2 98 ea 9e d8 44 63 6a d5 fb 8c bd c0 3c ad +Test: KeyPairValidAndConsistent +Comment: RSASSA-PSS Signature Example 2.1 +Message: \ +da ba 03 20 66 26 3f ae db 65 98 48 11 52 78 a5\ +2c 44 fa a3 a7 6f 37 51 5e d3 36 32 10 72 c4 0a\ +9d 9b 53 bc 05 01 40 78 ad f5 20 87 51 46 aa e7\ +0f f0 60 22 6d cb 7b 1f 1f c2 7e 93 60 +Salt: \ +57 bf 16 0b cb 02 bb 1d c7 28 0c f0 45 85 30 b7\ +d2 83 2f f7 +Signature: \ +01 4c 5b a5 33 83 28 cc c6 e7 a9 0b f1 c0 ab 3f\ +d6 06 ff 47 96 d3 c1 2e 4b 63 9e d9 13 6a 5f ec\ +6c 16 d8 88 4b dd 99 cf dc 52 14 56 b0 74 2b 73\ +68 68 cf 90 de 09 9a db 8d 5f fd 1d ef f3 9b a4\ +00 7a b7 46 ce fd b2 2d 7d f0 e2 25 f5 46 27 dc\ +65 46 61 31 72 1b 90 af 44 53 63 a8 35 8b 9f 60\ +76 42 f7 8f ab 0a b0 f4 3b 71 68 d6 4b ae 70 d8\ +82 78 48 d8 ef 1e 42 1c 57 54 dd f4 2c 25 89 b5\ +b3 +Test: Verify +Comment: RSASSA-PSS Signature Example 2.2 +Message: \ +e4 f8 60 1a 8a 6d a1 be 34 44 7c 09 59 c0 58 57\ +0c 36 68 cf d5 1d d5 f9 cc d6 ad 44 11 fe 82 13\ +48 6d 78 a6 c4 9f 93 ef c2 ca 22 88 ce bc 2b 9b\ +60 bd 04 b1 e2 20 d8 6e 3d 48 48 d7 09 d0 32 d1\ +e8 c6 a0 70 c6 af 9a 49 9f cf 95 35 4b 14 ba 61\ +27 c7 39 de 1b b0 fd 16 43 1e 46 93 8a ec 0c f8\ +ad 9e b7 2e 83 2a 70 35 de 9b 78 07 bd c0 ed 8b\ +68 eb 0f 5a c2 21 6b e4 0c e9 20 c0 db 0e dd d3\ +86 0e d7 88 ef ac ca ca 50 2d 8f 2b d6 d1 a7 c1\ +f4 1f f4 6f 16 81 c8 f1 f8 18 e9 c4 f6 d9 1a 0c\ +78 03 cc c6 3d 76 a6 54 4d 84 3e 08 4e 36 3b 8a\ +cc 55 aa 53 17 33 ed b5 de e5 b5 19 6e 9f 03 e8\ +b7 31 b3 77 64 28 d9 e4 57 fe 3f bc b3 db 72 74\ +44 2d 78 58 90 e9 cb 08 54 b6 44 4d ac e7 91 d7\ +27 3d e1 88 97 19 33 8a 77 fe +Salt: \ +7f 6d d3 59 e6 04 e6 08 70 e8 98 e4 7b 19 bf 2e\ +5a 7b 2a 90 +Signature: \ +01 09 91 65 6c ca 18 2b 7f 29 d2 db c0 07 e7 ae\ +0f ec 15 8e b6 75 9c b9 c4 5c 5f f8 7c 76 35 dd\ +46 d1 50 88 2f 4d e1 e9 ae 65 e7 f7 d9 01 8f 68\ +36 95 4a 47 c0 a8 1a 8a 6b 6f 83 f2 94 4d 60 81\ +b1 aa 7c 75 9b 25 4b 2c 34 b6 91 da 67 cc 02 26\ +e2 0b 2f 18 b4 22 12 76 1d cd 4b 90 8a 62 b3 71\ +b5 91 8c 57 42 af 4b 53 7e 29 69 17 67 4f b9 14\ +19 47 61 62 1c c1 9a 41 f6 fb 95 3f bc bb 64 9d\ +ea +Test: Verify +Comment: RSASSA-PSS Signature Example 2.3 +Message: \ +52 a1 d9 6c 8a c3 9e 41 e4 55 80 98 01 b9 27 a5\ +b4 45 c1 0d 90 2a 0d cd 38 50 d2 2a 66 d2 bb 07\ +03 e6 7d 58 67 11 45 95 aa bf 5a 7a eb 5a 8f 87\ +03 4b bb 30 e1 3c fd 48 17 a9 be 76 23 00 23 60\ +6d 02 86 a3 fa f8 a4 d2 2b 72 8e c5 18 07 9f 9e\ +64 52 6e 3a 0c c7 94 1a a3 38 c4 37 99 7c 68 0c\ +ca c6 7c 66 bf a1 +Salt: \ +fc a8 62 06 8b ce 22 46 72 4b 70 8a 05 19 da 17\ +e6 48 68 8c +Signature: \ +00 7f 00 30 01 8f 53 cd c7 1f 23 d0 36 59 fd e5\ +4d 42 41 f7 58 a7 50 b4 2f 18 5f 87 57 85 20 c3\ +07 42 af d8 43 59 b6 e6 e8 d3 ed 95 9d c6 fe 48\ +6b ed c8 e2 cf 00 1f 63 a7 ab e1 62 56 a1 b8 4d\ +f0 d2 49 fc 05 d3 19 4c e5 f0 91 27 42 db bf 80\ +dd 17 4f 6c 51 f6 ba d7 f1 6c f3 36 4e ba 09 5a\ +06 26 7d c3 79 38 03 ac 75 26 ae be 0a 47 5d 38\ +b8 c2 24 7a b5 1c 48 98 df 70 47 dc 6a df 52 c6\ +c4 +Test: Verify +Comment: RSASSA-PSS Signature Example 2.4 +Message: \ +a7 18 2c 83 ac 18 be 65 70 a1 06 aa 9d 5c 4e 3d\ +bb d4 af ae b0 c6 0c 4a 23 e1 96 9d 79 ff +Salt: \ +80 70 ef 2d e9 45 c0 23 87 68 4b a0 d3 30 96 73\ +22 35 d4 40 +Signature: \ +00 9c d2 f4 ed be 23 e1 23 46 ae 8c 76 dd 9a d3\ +23 0a 62 07 61 41 f1 6c 15 2b a1 85 13 a4 8e f6\ +f0 10 e0 e3 7f d3 df 10 a1 ec 62 9a 0c b5 a3 b5\ +d2 89 30 07 29 8c 30 93 6a 95 90 3b 6b a8 55 55\ +d9 ec 36 73 a0 61 08 fd 62 a2 fd a5 6d 1c e2 e8\ +5c 4d b6 b2 4a 81 ca 3b 49 6c 36 d4 fd 06 eb 7c\ +91 66 d8 e9 48 77 c4 2b ea 62 2b 3b fe 92 51 fd\ +c2 1d 8d 53 71 ba da d7 8a 48 82 14 79 63 35 b4\ +0b +Test: Verify +Comment: RSASSA-PSS Signature Example 2.5 +Message: \ +86 a8 3d 4a 72 ee 93 2a 4f 56 30 af 65 79 a3 86\ +b7 8f e8 89 99 e0 ab d2 d4 90 34 a4 bf c8 54 dd\ +94 f1 09 4e 2e 8c d7 a1 79 d1 95 88 e4 ae fc 1b\ +1b d2 5e 95 e3 dd 46 1f +Salt: \ +17 63 9a 4e 88 d7 22 c4 fc a2 4d 07 9a 8b 29 c3\ +24 33 b0 c9 +Signature: \ +00 ec 43 08 24 93 1e bd 3b aa 43 03 4d ae 98 ba\ +64 6b 8c 36 01 3d 16 71 c3 cf 1c f8 26 0c 37 4b\ +19 f8 e1 cc 8d 96 50 12 40 5e 7e 9b f7 37 86 12\ +df cc 85 fc e1 2c da 11 f9 50 bd 0b a8 87 67 40\ +43 6c 1d 25 95 a6 4a 1b 32 ef cf b7 4a 21 c8 73\ +b3 cc 33 aa f4 e3 dc 39 53 de 67 f0 67 4c 04 53\ +b4 fd 9f 60 44 06 d4 41 b8 16 09 8c b1 06 fe 34\ +72 bc 25 1f 81 5f 59 db 2e 43 78 a3 ad dc 18 1e\ +cf +Test: Verify +Comment: RSASSA-PSS Signature Example 2.6 +Message: \ +04 9f 91 54 d8 71 ac 4a 7c 7a b4 53 25 ba 75 45\ +a1 ed 08 f7 05 25 b2 66 7c f1 +Salt: \ +37 81 0d ef 10 55 ed 92 2b 06 3d f7 98 de 5d 0a\ +ab f8 86 ee +Signature: \ +00 47 5b 16 48 f8 14 a8 dc 0a bd c3 7b 55 27 f5\ +43 b6 66 bb 6e 39 d3 0e 5b 49 d3 b8 76 dc cc 58\ +ea c1 4e 32 a2 d5 5c 26 16 01 44 56 ad 2f 24 6f\ +c8 e3 d5 60 da 3d df 37 9a 1c 0b d2 00 f1 02 21\ +df 07 8c 21 9a 15 1b c8 d4 ec 9d 2f c2 56 44 67\ +81 10 14 ef 15 d8 ea 01 c2 eb bf f8 c2 c8 ef ab\ +38 09 6e 55 fc be 32 85 c7 aa 55 88 51 25 4f af\ +fa 92 c1 c7 2b 78 75 86 63 ef 45 82 84 31 39 d7\ +a6 +Test: Verify +Comment: Example 3: A 1026-bit RSA Key Pair +Modulus: \ +02 f2 46 ef 45 1e d3 ee bb 9a 31 02 00 cc 25 85\ +9c 04 8e 4b e7 98 30 29 91 11 2e b6 8c e6 db 67\ +4e 28 0d a2 1f ed ed 1a e7 48 80 ca 52 2b 18 db\ +24 93 85 01 28 27 c5 15 f0 e4 66 a1 ff a6 91 d9\ +81 70 57 4e 9d 0e ad b0 87 58 6c a4 89 33 da 3c\ +c9 53 d9 5b d0 ed 50 de 10 dd cb 67 36 10 7d 6c\ +83 1c 7f 66 3e 83 3c a4 c0 97 e7 00 ce 0f b9 45\ +f8 8f b8 5f e8 e5 a7 73 17 25 65 b9 14 a4 71 a4\ +43 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +65 14 51 73 3b 56 de 5a c0 a6 89 a4 ae b6 e6 89\ +4a 69 01 4e 07 6c 88 dd 7a 66 7e ab 32 32 bb cc\ +d2 fc 44 ba 2f a9 c3 1d b4 6f 21 ed d1 fd b2 3c\ +5c 12 8a 5d a5 ba b9 1e 7f 95 2b 67 75 9c 7c ff\ +70 54 15 ac 9f a0 90 7c 7c a6 17 8f 66 8f b9 48\ +d8 69 da 4c c3 b7 35 6f 40 08 df d5 44 9d 32 ee\ +02 d9 a4 77 eb 69 fc 29 26 6e 5d 90 70 51 23 75\ +a5 0f bb cc 27 e2 38 ad 98 42 5f 6e bb f8 89 91 +Prime1: \ +01 bd 36 e1 8e ce 4b 0f db 2e 9c 9d 54 8b d1 a7\ +d6 e2 c2 1c 6f dc 35 07 4a 1d 05 b1 c6 c8 b3 d5\ +58 ea 26 39 c9 a9 a4 21 68 01 69 31 72 52 55 8b\ +d1 48 ad 21 5a ac 55 0e 2d cf 12 a8 2d 0e bf e8\ +53 +Prime2: \ +01 b1 b6 56 ad 86 d8 e1 9d 5d c8 62 92 b3 a1 92\ +fd f6 e0 dd 37 87 7b ad 14 82 2f a0 01 90 ca b2\ +65 f9 0d 3f 02 05 7b 6f 54 d6 ec b1 44 91 e5 ad\ +ea ce bc 48 bf 0e bd 2a 2a d2 6d 40 2e 54 f6 16\ +51 +ModPrime1PrivateExponent: \ +1f 27 79 fd 2e 3e 5e 6b ae 05 53 95 18 fb a0 cd\ +0e ad 1a a4 51 3a 7c ba 18 f1 cf 10 e3 f6 81 95\ +69 3d 27 8a 0f 0e e7 2f 89 f9 bc 76 0d 80 e2 f9\ +d0 26 1d 51 65 01 c6 ae 39 f1 4a 47 6c e2 cc f5 +ModPrime2PrivateExponent: \ +01 1a 0d 36 79 4b 04 a8 54 aa b4 b2 46 2d 43 9a\ +50 46 c9 1d 94 0b 2b c6 f7 5b 62 95 6f ef 35 a2\ +a6 e6 3c 53 09 81 7f 30 7b bf f9 d5 9e 7e 33 1b\ +d3 63 f6 d6 68 49 b1 83 46 ad ea 16 9f 0a e9 ae\ +c1 +MultiplicativeInverseOfPrime2ModPrime1: \ +0b 30 f0 ec f5 58 75 2f b3 a6 ce 4b a2 b8 c6 75\ +f6 59 eb a6 c3 76 58 5a 1b 39 71 2d 03 8a e3 d2\ +b4 6f cb 41 8a e1 5d 09 05 da 64 40 e1 51 3a 30\ +b9 b7 d6 66 8f bc 5e 88 e5 ab 7a 17 5e 73 ba 35 +Test: KeyPairValidAndConsistent +Comment: RSASSA-PSS Signature Example 3.1 +Message: \ +59 4b 37 33 3b bb 2c 84 52 4a 87 c1 a0 1f 75 fc\ +ec 0e 32 56 f1 08 e3 8d ca 36 d7 0d 00 57 +Salt: \ +f3 1a d6 c8 cf 89 df 78 ed 77 fe ac bc c2 f8 b0\ +a8 e4 cf aa +Signature: \ +00 88 b1 35 fb 17 94 b6 b9 6c 4a 3e 67 81 97 f8\ +ca c5 2b 64 b2 fe 90 7d 6f 27 de 76 11 24 96 4a\ +99 a0 1a 88 27 40 ec fa ed 6c 01 a4 74 64 bb 05\ +18 23 13 c0 13 38 a8 cd 09 72 14 cd 68 ca 10 3b\ +d5 7d 3b c9 e8 16 21 3e 61 d7 84 f1 82 46 7a bf\ +8a 01 cf 25 3e 99 a1 56 ea a8 e3 e1 f9 0e 3c 6e\ +4e 3a a2 d8 3e d0 34 5b 89 fa fc 9c 26 07 7c 14\ +b6 ac 51 45 4f a2 6e 44 6e 3a 2f 15 3b 2b 16 79\ +7f +Test: Verify +Comment: RSASSA-PSS Signature Example 3.2 +Message: \ +8b 76 95 28 88 4a 0d 1f fd 09 0c f1 02 99 3e 79\ +6d ad cf bd dd 38 e4 4f f6 32 4c a4 51 +Salt: \ +fc f9 f0 e1 f1 99 a3 d1 d0 da 68 1c 5b 86 06 fc\ +64 29 39 f7 +Signature: \ +02 a5 f0 a8 58 a0 86 4a 4f 65 01 7a 7d 69 45 4f\ +3f 97 3a 29 99 83 9b 7b bc 48 bf 78 64 11 69 17\ +95 56 f5 95 fa 41 f6 ff 18 e2 86 c2 78 30 79 bc\ +09 10 ee 9c c3 4f 49 ba 68 11 24 f9 23 df a8 8f\ +42 61 41 a3 68 a5 f5 a9 30 c6 28 c2 c3 c2 00 e1\ +8a 76 44 72 1a 0c be c6 dd 3f 62 79 bd e3 e8 f2\ +be 5e 2d 4e e5 6f 97 e7 ce af 33 05 4b e7 04 2b\ +d9 1a 63 bb 09 f8 97 bd 41 e8 11 97 de e9 9b 11\ +af +Test: Verify +Comment: RSASSA-PSS Signature Example 3.3 +Message: \ +1a bd ba 48 9c 5a da 2f 99 5e d1 6f 19 d5 a9 4d\ +9e 6e c3 4a 8d 84 f8 45 57 d2 6e 5e f9 b0 2b 22\ +88 7e 3f 9a 4b 69 0a d1 14 92 09 c2 0c 61 43 1f\ +0c 01 7c 36 c2 65 7b 35 d7 b0 7d 3f 5a d8 70 85\ +07 a9 c1 b8 31 df 83 5a 56 f8 31 07 18 14 ea 5d\ +3d 8d 8f 6a de 40 cb a3 8b 42 db 7a 2d 3d 7a 29\ +c8 f0 a7 9a 78 38 cf 58 a9 75 7f a2 fe 4c 40 df\ +9b aa 19 3b fc 6f 92 b1 23 ad 57 b0 7a ce 3e 6a\ +c0 68 c9 f1 06 af d9 ee b0 3b 4f 37 c2 5d bf bc\ +fb 30 71 f6 f9 77 17 66 d0 72 f3 bb 07 0a f6 60\ +55 32 97 3a e2 50 51 +Salt: \ +98 6e 7c 43 db b6 71 bd 41 b9 a7 f4 b6 af c8 0e\ +80 5f 24 23 +Signature: \ +02 44 bc d1 c8 c1 69 55 73 6c 80 3b e4 01 27 2e\ +18 cb 99 08 11 b1 4f 72 db 96 41 24 d5 fa 76 06\ +49 cb b5 7a fb 87 55 db b6 2b f5 1f 46 6c f2 3a\ +0a 16 07 57 6e 98 3d 77 8f ce ff a9 2d f7 54 8a\ +ea 8e a4 ec ad 2c 29 dd 9f 95 bc 07 fe 91 ec f8\ +be e2 55 bf e8 76 2f d7 69 0a a9 bf a4 fa 08 49\ +ef 72 8c 2c 42 c4 53 23 64 52 2d f2 ab 7f 9f 8a\ +03 b6 3f 7a 49 91 75 82 86 68 f5 ef 5a 29 e3 80\ +2c +Test: Verify +Comment: RSASSA-PSS Signature Example 3.4 +Message: \ +8f b4 31 f5 ee 79 2b 6c 2a c7 db 53 cc 42 86 55\ +ae b3 2d 03 f4 e8 89 c5 c2 5d e6 83 c4 61 b5 3a\ +cf 89 f9 f8 d3 aa bd f6 b9 f0 c2 a1 de 12 e1 5b\ +49 ed b3 91 9a 65 2f e9 49 1c 25 a7 fc e1 f7 22\ +c2 54 36 08 b6 9d c3 75 ec +Salt: \ +f8 31 2d 9c 8e ea 13 ec 0a 4c 7b 98 12 0c 87 50\ +90 87 c4 78 +Signature: \ +01 96 f1 2a 00 5b 98 12 9c 8d f1 3c 4c b1 6f 8a\ +a8 87 d3 c4 0d 96 df 3a 88 e7 53 2e f3 9c d9 92\ +f2 73 ab c3 70 bc 1b e6 f0 97 cf eb bf 01 18 fd\ +9e f4 b9 27 15 5f 3d f2 2b 90 4d 90 70 2d 1f 7b\ +a7 a5 2b ed 8b 89 42 f4 12 cd 7b d6 76 c9 d1 8e\ +17 03 91 dc d3 45 c0 6a 73 09 64 b3 f3 0b cc e0\ +bb 20 ba 10 6f 9a b0 ee b3 9c f8 a6 60 7f 75 c0\ +34 7f 0a f7 9f 16 af a0 81 d2 c9 2d 1e e6 f8 36\ +b8 +Test: Verify +Comment: RSASSA-PSS Signature Example 3.5 +Message: \ +fe f4 16 1d fa af 9c 52 95 05 1d fc 1f f3 81 0c\ +8c 9e c2 e8 66 f7 07 54 22 c8 ec 42 16 a9 c4 ff\ +49 42 7d 48 3c ae 10 c8 53 4a 41 b2 fd 15 fe e0\ +69 60 ec 6f b3 f7 a7 e9 4a 2f 8a 2e 3e 43 dc 4a\ +40 57 6c 30 97 ac 95 3b 1d e8 6f 0b 4e d3 6d 64\ +4f 23 ae 14 42 55 29 62 24 64 ca 0c bf 0b 17 41\ +34 72 38 15 7f ab 59 e4 de 55 24 09 6d 62 ba ec\ +63 ac 64 +Salt: \ +50 32 7e fe c6 29 2f 98 01 9f c6 7a 2a 66 38 56\ +3e 9b 6e 2d +Signature: \ +02 1e ca 3a b4 89 22 64 ec 22 41 1a 75 2d 92 22\ +10 76 d4 e0 1c 0e 6f 0d de 9a fd 26 ba 5a cf 6d\ +73 9e f9 87 54 5d 16 68 3e 56 74 c9 e7 0f 1d e6\ +49 d7 e6 1d 48 d0 ca eb 4f b4 d8 b2 4f ba 84 a6\ +e3 10 8f ee 7d 07 05 97 32 66 ac 52 4b 4a d2 80\ +f7 ae 17 dc 59 d9 6d 33 51 58 6b 5a 3b db 89 5d\ +1e 1f 78 20 ac 61 35 d8 75 34 80 99 83 82 ba 32\ +b7 34 95 59 60 8c 38 74 52 90 a8 5e f4 e9 f9 bd\ +83 +Test: Verify +Comment: RSASSA-PSS Signature Example 3.6 +Message: \ +ef d2 37 bb 09 8a 44 3a ee b2 bf 6c 3f 8c 81 b8\ +c0 1b 7f cb 3f eb +Salt: \ +b0 de 3f c2 5b 65 f5 af 96 b1 d5 cc 3b 27 d0 c6\ +05 30 87 b3 +Signature: \ +01 2f af ec 86 2f 56 e9 e9 2f 60 ab 0c 77 82 4f\ +42 99 a0 ca 73 4e d2 6e 06 44 d5 d2 22 c7 f0 bd\ +e0 39 64 f8 e7 0a 5c b6 5e d4 4e 44 d5 6a e0 ed\ +f1 ff 86 ca 03 2c c5 dd 44 04 db b7 6a b8 54 58\ +6c 44 ee d8 33 6d 08 d4 57 ce 6c 03 69 3b 45 c0\ +f1 ef ef 93 62 4b 95 b8 ec 16 9c 61 6d 20 e5 53\ +8e bc 0b 67 37 a6 f8 2b 4b c0 57 09 24 fc 6b 35\ +75 9a 33 48 42 62 79 f8 b3 d7 74 4e 2d 22 24 26\ +ce +Test: Verify +Comment: Example 4: A 1027-bit RSA Key Pair +Modulus: \ +05 4a db 78 86 44 7e fe 6f 57 e0 36 8f 06 cf 52\ +b0 a3 37 07 60 d1 61 ce f1 26 b9 1b e7 f8 9c 42\ +1b 62 a6 ec 1d a3 c3 11 d7 5e d5 0e 0a b5 ff f3\ +fd 33 8a cc 3a a8 a4 e7 7e e2 63 69 ac b8 1b a9\ +00 fa 83 f5 30 0c f9 bb 6c 53 ad 1d c8 a1 78 b8\ +15 db 42 35 a9 a9 da 0c 06 de 4e 61 5e a1 27 7c\ +e5 59 e9 c1 08 de 58 c1 4a 81 aa 77 f5 a6 f8 d1\ +33 54 94 49 88 48 c8 b9 59 40 74 0b e7 bf 7c 37\ +05 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +fa 04 1f 8c d9 69 7c ee d3 8e c8 ca a2 75 52 3b\ +4d d7 2b 09 a3 01 d3 54 1d 72 f5 d3 1c 05 cb ce\ +2d 69 83 b3 61 83 af 10 69 0b d4 6c 46 13 1e 35\ +78 94 31 a5 56 77 1d d0 04 9b 57 46 1b f0 60 c1\ +f6 84 72 e8 a6 7c 25 f3 57 e5 b6 b4 73 8f a5 41\ +a7 30 34 6b 4a 07 64 9a 2d fa 80 6a 69 c9 75 b6\ +ab a6 46 78 ac c7 f5 91 3e 89 c6 22 f2 d8 ab b1\ +e3 e3 25 54 e3 9d f9 4b a6 0c 00 2e 38 7d 90 11 +Prime1: \ +02 92 32 33 6d 28 38 94 5d ba 9d d7 72 3f 4e 62\ +4a 05 f7 37 5b 92 7a 87 ab e6 a8 93 a1 65 8f d4\ +9f 47 f6 c7 b0 fa 59 6c 65 fa 68 a2 3f 0a b4 32\ +96 2d 18 d4 34 3b d6 fd 67 1a 5e a8 d1 48 41 39\ +95 +Prime2: \ +02 0e f5 ef e7 c5 39 4a ed 22 72 f7 e8 1a 74 f4\ +c0 2d 14 58 94 cb 1b 3c ab 23 a9 a0 71 0a 2a fc\ +7e 33 29 ac bb 74 3d 01 f6 80 c4 d0 2a fb 4c 8f\ +de 7e 20 93 08 11 bb 2b 99 57 88 b5 e8 72 c2 0b\ +b1 +ModPrime1PrivateExponent: \ +02 6e 7e 28 01 0e cf 24 12 d9 52 3a d7 04 64 7f\ +b4 fe 9b 66 b1 a6 81 58 1b 0e 15 55 3a 89 b1 54\ +28 28 89 8f 27 24 3e ba b4 5f f5 e1 ac b9 d4 df\ +1b 05 1f bc 62 82 4d bc 6f 6c 93 26 1a 78 b9 a7\ +59 +ModPrime2PrivateExponent: \ +01 2d dc c8 6e f6 55 99 8c 39 dd ae 11 71 86 69\ +e5 e4 6c f1 49 5b 07 e1 3b 10 14 cd 69 b3 af 68\ +30 4a d2 a6 b6 43 21 e7 8b f3 bb ca 9b b4 94 e9\ +1d 45 17 17 e2 d9 75 64 c6 54 94 65 d0 20 5c f4\ +21 +MultiplicativeInverseOfPrime2ModPrime1: \ +01 06 00 c4 c2 18 47 45 9f e5 76 70 3e 2e be ca\ +e8 a5 09 4e e6 3f 53 6b f4 ac 68 d3 c1 3e 5e 4f\ +12 ac 5c c1 0a b6 a2 d0 5a 19 92 14 d1 82 47 47\ +d5 51 90 96 36 b7 74 c2 2c ac 0b 83 75 99 ab cc\ +75 +Test: KeyPairValidAndConsistent +Comment: RSASSA-PSS Signature Example 4.1 +Message: \ +9f b0 3b 82 7c 82 17 d9 +Salt: \ +ed 7c 98 c9 5f 30 97 4f be 4f bd dc f0 f2 8d 60\ +21 c0 e9 1d +Signature: \ +03 23 d5 b7 bf 20 ba 45 39 28 9a e4 52 ae 42 97\ +08 0f ef f4 51 84 23 ff 48 11 a8 17 83 7e 7d 82\ +f1 83 6c df ab 54 51 4f f0 88 7b dd ee bf 40 bf\ +99 b0 47 ab c3 ec fa 6a 37 a3 ef 00 f4 a0 c4 a8\ +8a ae 09 04 b7 45 c8 46 c4 10 7e 87 97 72 3e 8a\ +c8 10 d9 e3 d9 5d fa 30 ff 49 66 f4 d7 5d 13 76\ +8d 20 85 7f 2b 14 06 f2 64 cf e7 5e 27 d7 65 2f\ +4b 5e d3 57 5f 28 a7 02 f8 c4 ed 9c f9 b2 d4 49\ +48 +Test: Verify +Comment: RSASSA-PSS Signature Example 4.2 +Message: \ +0c a2 ad 77 79 7e ce 86 de 5b f7 68 75 0d db 5e\ +d6 a3 11 6a d9 9b bd 17 ed f7 f7 82 f0 db 1c d0\ +5b 0f 67 74 68 c5 ea 42 0d c1 16 b1 0e 80 d1 10\ +de 2b 04 61 ea 14 a3 8b e6 86 20 39 2e 7e 89 3c\ +b4 ea 93 93 fb 88 6c 20 ff 79 06 42 30 5b f3 02\ +00 38 92 e5 4d f9 f6 67 50 9d c5 39 20 df 58 3f\ +50 a3 dd 61 ab b6 fa b7 5d 60 03 77 e3 83 e6 ac\ +a6 71 0e ee a2 71 56 e0 67 52 c9 4c e2 5a e9 9f\ +cb f8 59 2d be 2d 7e 27 45 3c b4 4d e0 71 00 eb\ +b1 a2 a1 98 11 a4 78 ad be ab 27 0f 94 e8 fe 36\ +9d 90 b3 ca 61 2f 9f +Salt: \ +22 d7 1d 54 36 3a 42 17 aa 55 11 3f 05 9b 33 84\ +e3 e5 7e 44 +Signature: \ +04 9d 01 85 84 5a 26 4d 28 fe b1 e6 9e da ec 09\ +06 09 e8 e4 6d 93 ab b3 83 71 ce 51 f4 aa 65 a5\ +99 bd aa a8 1d 24 fb a6 6a 08 a1 16 cb 64 4f 3f\ +1e 65 3d 95 c8 9d b8 bb d5 da ac 27 09 c8 98 40\ +00 17 84 10 a7 c6 aa 86 67 dd c3 8c 74 1f 71 0e\ +c8 66 5a a9 05 2b e9 29 d4 e3 b1 67 82 c1 66 21\ +14 c5 41 4b b0 35 34 55 c3 92 fc 28 f3 db 59 05\ +4b 5f 36 5c 49 e1 d1 56 f8 76 ee 10 cb 4f d7 05\ +98 +Test: Verify +Comment: RSASSA-PSS Signature Example 4.3 +Message: \ +28 80 62 af c0 8f cd b7 c5 f8 65 0b 29 83 73 00\ +46 1d d5 67 6c 17 a2 0a 3c 8f b5 14 89 49 e3 f7\ +3d 66 b3 ae 82 c7 24 0e 27 c5 b3 ec 43 28 ee 7d\ +6d df 6a 6a 0c 9b 5b 15 bc da 19 6a 9d 0c 76 b1\ +19 d5 34 d8 5a bd 12 39 62 d5 83 b7 6c e9 d1 80\ +bc e1 ca +Salt: \ +4a f8 70 fb c6 51 60 12 ca 91 6c 70 ba 86 2a c7\ +e8 24 36 17 +Signature: \ +03 fb c4 10 a2 ce d5 95 00 fb 99 f9 e2 af 27 81\ +ad a7 4e 13 14 56 24 60 27 82 e2 99 48 13 ee fc\ +a0 51 9e cd 25 3b 85 5f b6 26 a9 0d 77 1e ae 02\ +8b 0c 47 a1 99 cb d9 f8 e3 26 97 34 af 41 63 59\ +90 90 71 3a 3f a9 10 fa 09 60 65 27 21 43 2b 97\ +10 36 a7 18 1a 2b c0 ca b4 3b 0b 59 8b c6 21 74\ +61 d7 db 30 5f f7 e9 54 c5 b5 bb 23 1c 39 e7 91\ +af 6b cf a7 6b 14 7b 08 13 21 f7 26 41 48 2a 2a\ +ad +Test: Verify +Comment: RSASSA-PSS Signature Example 4.4 +Message: \ +6f 4f 9a b9 50 11 99 ce f5 5c 6c f4 08 fe 7b 36\ +c5 57 c4 9d 42 0a 47 63 d2 46 3c 8a d4 4b 3c fc\ +5b e2 74 2c 0e 7d 9b 0f 66 08 f0 8c 7f 47 b6 93\ +ee +Salt: \ +40 d2 e1 80 fa e1 ea c4 39 c1 90 b5 6c 2c 0e 14\ +dd f9 a2 26 +Signature: \ +04 86 64 4b c6 6b f7 5d 28 33 5a 61 79 b1 08 51\ +f4 3f 09 bd ed 9f ac 1a f3 32 52 bb 99 53 ba 42\ +98 cd 64 66 b2 75 39 a7 0a da a3 f8 9b 3d b3 c7\ +4a b6 35 d1 22 f4 ee 7c e5 57 a6 1e 59 b8 2f fb\ +78 66 30 e5 f9 db 53 c7 7d 9a 0c 12 fa b5 95 8d\ +4c 2c e7 da a8 07 cd 89 ba 2c c7 fc d0 2f f4 70\ +ca 67 b2 29 fc ce 81 4c 85 2c 73 cc 93 be a3 5b\ +e6 84 59 ce 47 8e 9d 46 55 d1 21 c8 47 2f 37 1d\ +4f +Test: Verify +Comment: RSASSA-PSS Signature Example 4.5 +Message: \ +e1 7d 20 38 5d 50 19 55 82 3c 3f 66 62 54 c1 d3\ +dd 36 ad 51 68 b8 f1 8d 28 6f dc f6 7a 7d ad 94\ +09 70 85 fa b7 ed 86 fe 21 42 a2 87 71 71 79 97\ +ef 1a 7a 08 88 4e fc 39 35 6d 76 07 7a af 82 45\ +9a 7f ad 45 84 88 75 f2 81 9b 09 89 37 fe 92 3b\ +cc 9d c4 42 d7 2d 75 4d 81 20 25 09 0c 9b c0 3d\ +b3 08 0c 13 8d d6 3b 35 5d 0b 4b 85 d6 68 8a c1\ +9f 4d e1 50 84 a0 ba 4e 37 3b 93 ef 4a 55 50 96\ +69 19 15 dc 23 c0 0e 95 4c de b2 0a 47 cd 55 d1\ +6c 3d 86 81 d4 6e d7 f2 ed 5e a4 27 95 be 17 ba\ +ed 25 f0 f4 d1 13 b3 63 6a dd d5 85 f1 6a 8b 5a\ +ec 0c 8f a9 c5 f0 3c bf 3b 9b 73 +Salt: \ +24 97 dc 2b 46 15 df ae 5a 66 3d 49 ff d5 6b f7\ +ef c1 13 04 +Signature: \ +02 2a 80 04 53 53 90 4c b3 0c bb 54 2d 7d 49 90\ +42 1a 6e ec 16 a8 02 9a 84 22 ad fd 22 d6 af f8\ +c4 cc 02 94 af 11 0a 0c 06 7e c8 6a 7d 36 41 34\ +45 9b b1 ae 8f f8 36 d5 a8 a2 57 98 40 99 6b 32\ +0b 19 f1 3a 13 fa d3 78 d9 31 a6 56 25 da e2 73\ +9f 0c 53 67 0b 35 d9 d3 cb ac 08 e7 33 e4 ec 2b\ +83 af 4b 91 96 d6 3e 7c 4f f1 dd ea e2 a1 22 79\ +1a 12 5b fe a8 de b0 de 8c cf 1f 4f fa f6 e6 fb\ +0a +Test: Verify +Comment: RSASSA-PSS Signature Example 4.6 +Message: \ +af bc 19 d4 79 24 90 18 fd f4 e0 9f 61 87 26 44\ +04 95 de 11 dd ee e3 88 72 d7 75 fc ea 74 a2 38\ +96 b5 34 3c 9c 38 d4 6a f0 db a2 24 d0 47 58 0c\ +c6 0a 65 e9 39 1c f9 b5 9b 36 a8 60 59 8d 4e 82\ +16 72 2f 99 3b 91 cf ae 87 bc 25 5a f8 9a 6a 19\ +9b ca 4a 39 1e ad bc 3a 24 90 3c 0b d6 67 36 8f\ +6b e7 8e 3f ea bf b4 ff d4 63 12 27 63 74 0f fb\ +be fe ab 9a 25 56 4b c5 d1 c2 4c 93 e4 22 f7 50\ +73 e2 ad 72 bf 45 b1 0d f0 0b 52 a1 47 12 8e 73\ +fe e3 3f a3 f0 57 7d 77 f8 0f bc 2d f1 be d3 13\ +29 0c 12 77 7f 50 +Salt: \ +a3 34 db 6f ae bf 11 08 1a 04 f8 7c 2d 62 1c de\ +c7 93 0b 9b +Signature: \ +00 93 8d cb 6d 58 30 46 06 5f 69 c7 8d a7 a1 f1\ +75 70 66 a7 fa 75 12 5a 9d 29 29 f0 b7 9a 60 b6\ +27 b0 82 f1 1f 5b 19 6f 28 eb 9d aa 6f 21 c0 5e\ +51 40 f6 ae f1 73 7d 20 23 07 5c 05 ec f0 4a 02\ +8c 68 6a 2a b3 e7 d5 a0 66 4f 29 5c e1 29 95 e8\ +90 90 8b 6a d2 1f 08 39 eb 65 b7 03 93 a7 b5 af\ +d9 87 1d e0 ca a0 ce de c5 b8 19 62 67 56 20 9d\ +13 ab 1e 7b b9 54 6a 26 ff 37 e9 a5 1a f9 fd 56\ +2e +Test: Verify +Comment: Example 5: A 1028-bit RSA Key Pair +Modulus: \ +0d 10 f6 61 f2 99 40 f5 ed 39 aa 26 09 66 de b4\ +78 43 67 9d 2b 6f b2 5b 3d e3 70 f3 ac 7c 19 91\ +63 91 fd 25 fb 52 7e bf a6 a4 b4 df 45 a1 75 9d\ +99 6c 4b b4 eb d1 88 28 c4 4f c5 2d 01 91 87 17\ +40 52 5f 47 a4 b0 cc 8d a3 25 ed 8a a6 76 b0 d0\ +f6 26 e0 a7 7f 07 69 21 70 ac ac 80 82 f4 2f aa\ +7d c7 cd 12 3e 73 0e 31 a8 79 85 20 4c ab cb e6\ +67 0d 43 a2 dd 2b 2d de f5 e0 53 92 fc 21 3b c5\ +07 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +03 ce 08 b1 04 ff f3 96 a9 79 bd 3e 4e 46 92 5b\ +63 19 dd b6 3a cb cf d8 19 f1 7d 16 b8 07 7b 3a\ +87 10 1f f3 4b 77 fe 48 b8 b2 05 a9 6e 91 51 ba\ +8e ce a6 4d 0c ce 7b 23 c3 e6 a6 b8 30 58 bc 49\ +da e8 16 ae 73 6d b5 a4 70 8e 2a d4 35 23 2b 56\ +7f 90 96 ce 59 ff 28 06 1e 79 ab 1c 02 d7 17 e6\ +b2 3c ea 6d b8 eb 51 92 fa 7c 1e ab 22 7d ba 74\ +62 1c 45 60 18 96 ee f1 37 92 c8 44 0b eb 15 aa\ +c1 +Prime1: \ +03 f2 f3 31 f4 14 2d 4f 24 b4 3a a1 02 79 a8 96\ +52 d4 e7 53 72 21 a1 a7 b2 a2 5d eb 55 1e 5d e9\ +ac 49 74 11 c2 27 a9 4e 45 f9 1c 2d 1c 13 cc 04\ +6c f4 ce 14 e3 2d 05 87 34 21 0d 44 a8 7e e1 b7\ +3f +Prime2: \ +03 4f 09 0d 73 b5 58 03 03 0c f0 36 1a 5d 80 81\ +bf b7 9f 85 15 23 fe ac 0a 21 24 d0 8d 40 13 ff\ +08 48 77 71 a8 70 d0 47 9d c0 68 6c 62 f7 71 8d\ +fe cf 02 4b 17 c9 26 76 78 05 91 71 33 9c c0 08\ +39 +ModPrime1PrivateExponent: \ +02 aa 66 3a db f5 1a b8 87 a0 18 cb 42 6e 78 bc\ +2f e1 82 dc b2 f7 bc b5 04 41 d1 7f df 0f 06 79\ +8b 50 71 c6 e2 f5 fe b4 d5 4a d8 18 23 11 c1 ef\ +62 d4 c4 9f 18 d1 f5 1f 54 b2 d2 cf fb a4 da 1b\ +e5 +ModPrime2PrivateExponent: \ +02 bb e7 06 07 8b 5c 0b 39 15 12 d4 11 db 1b 19\ +9b 5a 56 64 b8 40 42 ea d3 7f e9 94 ae 72 b9 53\ +2d fb fb 3e 9e 69 81 a0 fb b8 06 51 31 41 b7 c2\ +16 3f e5 6c 39 5e 4b fa ee 57 e3 83 3f 9b 91 8d\ +f9 +MultiplicativeInverseOfPrime2ModPrime1: \ +02 42 b6 cd 00 d3 0a 76 7a ee 9a 89 8e ad 45 3c\ +8e ae a6 3d 50 0b 7d 1e 00 71 3e da e5 1c e3 6b\ +23 b6 64 df 26 e6 3e 26 6e c8 f7 6e 6e 63 ed 1b\ +a4 1e b0 33 b1 20 f7 ea 52 12 ae 21 a9 8f bc 16 +Test: KeyPairValidAndConsistent +Comment: RSASSA-PSS Signature Example 5.1 +Message: \ +30 c7 d5 57 45 8b 43 6d ec fd c1 4d 06 cb 7b 96\ +b0 67 18 c4 8d 7d e5 74 82 a8 68 ae 7f 06 58 70\ +a6 21 65 06 d1 1b 77 93 23 df df 04 6c f5 77 51\ +29 13 4b 4d 56 89 e4 d9 c0 ce 1e 12 d7 d4 b0 6c\ +b5 fc 58 20 de cf a4 1b af 59 bf 25 7b 32 f0 25\ +b7 67 9b 44 5b 94 99 c9 25 55 14 58 85 99 2f 1b\ +76 f8 48 91 ee 4d 3b e0 f5 15 0f d5 90 1e 3a 4c\ +8e d4 3f d3 6b 61 d0 22 e6 5a d5 00 8d bf 33 29\ +3c 22 bf bf d0 73 21 f0 f1 d5 fa 9f df 00 14 c2\ +fc b0 35 8a ad 0e 35 4b 0d 29 +Salt: \ +08 1b 23 3b 43 56 77 50 bd 6e 78 f3 96 a8 8b 9f\ +6a 44 51 51 +Signature: \ +0b a3 73 f7 6e 09 21 b7 0a 8f bf e6 22 f0 bf 77\ +b2 8a 3d b9 8e 36 10 51 c3 d7 cb 92 ad 04 52 91\ +5a 4d e9 c0 17 22 f6 82 3e eb 6a df 7e 0c a8 29\ +0f 5d e3 e5 49 89 0a c2 a3 c5 95 0a b2 17 ba 58\ +59 08 94 95 2d e9 6f 8d f1 11 b2 57 52 15 da 6c\ +16 15 90 c7 45 be 61 24 76 ee 57 8e d3 84 ab 33\ +e3 ec e9 74 81 a2 52 f5 c7 9a 98 b5 53 2a e0 0c\ +dd 62 f2 ec c0 cd 1b ae fe 80 d8 0b 96 21 93 ec\ +1d +Test: Verify +Comment: RSASSA-PSS Signature Example 5.2 +Message: \ +e7 b3 2e 15 56 ea 1b 27 95 04 6a c6 97 39 d2 2a\ +c8 96 6b f1 1c 11 6f 61 4b 16 67 40 e9 6b 90 65\ +3e 57 50 94 5f cf 77 21 86 c0 37 90 a0 7f da 32\ +3e 1a 61 91 6b 06 ee 21 57 db 3d ff 80 d6 7d 5e\ +39 a5 3a e2 68 c8 f0 9e d9 9a 73 20 05 b0 bc 6a\ +04 af 4e 08 d5 7a 00 e7 20 1b 30 60 ef aa db 73\ +11 3b fc 08 7f d8 37 09 3a a2 52 35 b8 c1 49 f5\ +62 15 f0 31 c2 4a d5 bd e7 f2 99 60 df 7d 52 40\ +70 f7 44 9c 6f 78 50 84 be 1a 0f 73 30 47 f3 36\ +f9 15 47 38 67 45 47 db 02 a9 f4 4d fc 6e 60 30\ +10 81 e1 ce 99 84 7f 3b 5b 60 1f f0 6b 4d 57 76\ +a9 74 0b 9a a0 d3 40 58 fd 3b 90 6e 4f 78 59 df\ +b0 7d 71 73 e5 e6 f6 35 0a da c2 1f 27 b2 30 74\ +69 +Salt: \ +bd 0c e1 95 49 d0 70 01 20 cb e5 10 77 db bb b0\ +0a 8d 8b 09 +Signature: \ +08 18 0d e8 25 e4 b8 b0 14 a3 2d a8 ba 76 15 55\ +92 12 04 f2 f9 0d 5f 24 b7 12 90 8f f8 4f 3e 22\ +0a d1 79 97 c0 dd 6e 70 66 30 ba 3e 84 ad d4 d5\ +e7 ab 00 4e 58 07 4b 54 97 09 56 5d 43 ad 9e 97\ +b5 a7 a1 a2 9e 85 b9 f9 0f 4a af cd f5 83 21 de\ +8c 59 74 ef 9a bf 2d 52 6f 33 c0 f2 f8 2e 95 d1\ +58 ea 6b 81 f1 73 6d b8 d1 af 3d 6a c6 a8 3b 32\ +d1 8b ae 0f f1 b2 fe 27 de 4c 76 ed 8c 79 80 a3\ +4e +Test: Verify +Comment: RSASSA-PSS Signature Example 5.3 +Message: \ +8d 83 96 e3 65 07 fe 1e f6 a1 90 17 54 8e 0c 71\ +66 74 c2 fe c2 33 ad b2 f7 75 66 5e c4 1f 2b d0\ +ba 39 6b 06 1a 9d aa 7e 86 6f 7c 23 fd 35 31 95\ +43 00 a3 42 f9 24 53 5e a1 49 8c 48 f6 c8 79 93\ +28 65 fc 02 00 0c 52 87 23 b7 ad 03 35 74 5b 51\ +20 9a 0a fe d9 32 af 8f 08 87 c2 19 00 4d 2a bd\ +89 4e a9 25 59 ee 31 98 af 3a 73 4f e9 b9 63 8c\ +26 3a 72 8a d9 5a 5a e8 ce 3e b1 58 39 f3 aa 78\ +52 bb 39 07 06 e7 76 0e 43 a7 12 91 a2 e3 f8 27\ +23 7d ed a8 51 87 4c 51 76 65 f5 45 f2 72 38 df\ +86 55 7f 37 5d 09 cc d8 bd 15 d8 cc f6 1f 5d 78\ +ca 5c 7f 5c de 78 2e 6b f5 d0 05 70 56 d4 ba d9\ +8b 3d 2f 95 75 e8 24 ab 7a 33 ff 57 b0 ac 10 0a\ +b0 d6 ea d7 aa 0b 50 f6 e4 d3 e5 ec 0b 96 6b +Salt: \ +81 57 79 a9 1b 3a 8b d0 49 bf 2a eb 92 01 42 77\ +22 22 c9 ca +Signature: \ +05 e0 fd bd f6 f7 56 ef 73 31 85 cc fa 8c ed 2e\ +b6 d0 29 d9 d5 6e 35 56 1b 5d b8 e7 02 57 ee 6f\ +d0 19 d2 f0 bb f6 69 fe 9b 98 21 e7 8d f6 d4 1e\ +31 60 8d 58 28 0f 31 8e e3 4f 55 99 41 c8 df 13\ +28 75 74 ba c0 00 b7 e5 8d c4 f4 14 ba 49 fb 12\ +7f 9d 0f 89 36 63 8c 76 e8 53 56 c9 94 f7 97 50\ +f7 fa 3c f4 fd 48 2d f7 5e 3f b9 97 8c d0 61 f7\ +ab b1 75 72 e6 e6 3e 0b de 12 cb dc f1 8c 68 b9\ +79 +Test: Verify +Comment: RSASSA-PSS Signature Example 5.4 +Message: \ +32 8c 65 9e 0a 64 37 43 3c ce b7 3c 14 +Salt: \ +9a ec 4a 74 80 d5 bb c4 29 20 d7 ca 23 5d b6 74\ +98 9c 9a ac +Signature: \ +0b c9 89 85 3b c2 ea 86 87 32 71 ce 18 3a 92 3a\ +b6 5e 8a 53 10 0e 6d f5 d8 7a 24 c4 19 4e b7 97\ +81 3e e2 a1 87 c0 97 dd 87 2d 59 1d a6 0c 56 86\ +05 dd 7e 74 2d 5a f4 e3 3b 11 67 8c cb 63 90 32\ +04 a3 d0 80 b0 90 2c 89 ab a8 86 8f 00 9c 0f 1c\ +0c b8 58 10 bb dd 29 12 1a bb 84 71 ff 2d 39 e4\ +9f d9 2d 56 c6 55 c8 e0 37 ad 18 fa fb dc 92 c9\ +58 63 f7 f6 1e a9 ef a2 8f ea 40 13 69 d1 9d ae\ +a1 +Test: Verify +Comment: RSASSA-PSS Signature Example 5.5 +Message: \ +f3 7b 96 23 79 a4 7d 41 5a 37 6e ec 89 73 15 0b\ +cb 34 ed d5 ab 65 40 41 b6 14 30 56 0c 21 44 58\ +2b a1 33 c8 67 d8 52 d6 b8 e2 33 21 90 13 02 ec\ +b4 5b 09 ec 88 b1 52 71 78 fa 04 32 63 f3 06 7d\ +9f fe 97 30 32 a9 9f 4c b0 8a d2 c7 e0 a2 45 6c\ +dd 57 a7 df 56 fe 60 53 52 7a 5a eb 67 d7 e5 52\ +06 3c 1c a9 7b 1b ef fa 7b 39 e9 97 ca f2 78 78\ +ea 0f 62 cb eb c8 c2 1d f4 c8 89 a2 02 85 1e 94\ +90 88 49 0c 24 9b 6e 9a cf 1d 80 63 f5 be 23 43\ +98 9b f9 5c 4d a0 1a 2b e7 8b 4a b6 b3 78 01 5b\ +c3 79 57 f7 69 48 b5 e5 8e 44 0c 28 45 3d 40 d7\ +cf d5 7e 7d 69 06 00 47 4a b5 e7 59 73 b1 ea 0c\ +5f 1e 45 d1 41 90 af e2 f4 eb 6d 3b df 71 f1 d2\ +f8 bb 15 6a 1c 29 5d 04 aa eb 9d 68 9d ce 79 ed\ +62 bc 44 3e +Salt: \ +e2 0c 1e 98 78 51 2c 39 97 0f 58 37 5e 15 49 a6\ +8b 64 f3 1d +Signature: \ +0a ef a9 43 b6 98 b9 60 9e df 89 8a d2 27 44 ac\ +28 dc 23 94 97 ce a3 69 cb bd 84 f6 5c 95 c0 ad\ +77 6b 59 47 40 16 4b 59 a7 39 c6 ff 7c 2f 07 c7\ +c0 77 a8 6d 95 23 8f e5 1e 1f cf 33 57 4a 4a e0\ +68 4b 42 a3 f6 bf 67 7d 91 82 0c a8 98 74 46 7b\ +2c 23 ad d7 79 69 c8 07 17 43 0d 0e fc 1d 36 95\ +89 2c e8 55 cb 7f 70 11 63 0f 4d f2 6d ef 8d df\ +36 fc 23 90 5f 57 fa 62 43 a4 85 c7 70 d5 68 1f\ +cd +Test: Verify +Comment: RSASSA-PSS Signature Example 5.6 +Message: \ +c6 10 3c 33 0c 1e f7 18 c1 41 e4 7b 8f a8 59 be\ +4d 5b 96 25 9e 7d 14 20 70 ec d4 85 83 9d ba 5a\ +83 69 c1 7c 11 14 03 5e 53 2d 19 5c 74 f4 4a 04\ +76 a2 d3 e8 a4 da 21 00 16 ca ce d0 e3 67 cb 86\ +77 10 a4 b5 aa 2d f2 b8 e5 da f5 fd c6 47 80 7d\ +4d 5e bb 6c 56 b9 76 3c cd ae 4d ea 33 08 eb 0a\ +c2 a8 95 01 cb 20 9d 26 39 fa 5b f8 7c e7 90 74\ +7d 3c b2 d2 95 e8 45 64 f2 f6 37 82 4f 0c 13 02\ +81 29 b0 aa 4a 42 2d 16 22 82 +Salt: \ +23 29 1e 4a 33 07 e8 bb b7 76 62 3a b3 4e 4a 5f\ +4c c8 a8 db +Signature: \ +02 80 2d cc fa 8d fa f5 27 9b f0 b4 a2 9b a1 b1\ +57 61 1f ae aa f4 19 b8 91 9d 15 94 19 00 c1 33\ +9e 7e 92 e6 fa e5 62 c5 3e 6c c8 e8 41 04 b1 10\ +bc e0 3a d1 85 25 e3 c4 9a 0e ad ad 5d 3f 28 f2\ +44 a8 ed 89 ed ba fb b6 86 27 7c fa 8a e9 09 71\ +4d 6b 28 f4 bf 8e 29 3a a0 4c 41 ef e7 c0 a8 12\ +66 d5 c0 61 e2 57 5b e0 32 aa 46 46 74 ff 71 62\ +62 19 bd 74 cc 45 f0 e7 ed 4e 3f f9 6e ee 75 8e\ +8f +Test: Verify +Comment: Example 6: A 1029-bit RSA Key Pair +Modulus: \ +16 4c a3 1c ff 60 9f 3a 0e 71 01 b0 39 f2 e4 fe\ +6d d3 75 19 ab 98 59 8d 17 9e 17 49 96 59 80 71\ +f4 7d 3a 04 55 91 58 d7 be 37 3c f1 aa 53 f0 aa\ +6e f0 90 39 e5 67 8c 2a 4c 63 90 05 14 c8 c4 f8\ +aa ed 5d e1 2a 5f 10 b0 9c 31 1a f8 c0 ff b5 b7\ +a2 97 f2 ef c6 3b 8d 6b 05 10 93 1f 0b 98 e4 8b\ +f5 fc 6e c4 e7 b8 db 1f fa eb 08 c3 8e 02 ad b8\ +f0 3a 48 22 9c 99 e9 69 43 1f 61 cb 8c 4d c6 98\ +d1 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +03 b6 64 ee 3b 75 66 72 3f c6 ea f2 8a bb 43 0a\ +39 80 f1 12 6c 81 de 8a d7 09 ea b3 9a c9 dc d0\ +b1 55 0b 37 29 d8 70 68 e9 52 00 9d f5 44 53 4c\ +1f 50 82 9a 78 f4 59 1e b8 fd 57 14 04 26 a6 bb\ +04 05 b6 a6 f5 1a 57 d9 26 7b 7b bc 65 33 91 a6\ +99 a2 a9 0d ac 8a e2 26 bc c6 0f a8 cd 93 4c 73\ +c7 b0 3b 1f 6b 81 81 58 63 18 38 a8 61 2e 6e 6e\ +a9 2b e2 4f 83 24 fa f5 b1 fd 85 87 22 52 67 ba\ +6f +Prime1: \ +04 f0 54 8c 96 26 ab 1e bf 12 44 93 47 41 d9 9a\ +06 22 0e fa 2a 58 56 aa 0e 75 73 0b 2e c9 6a dc\ +86 be 89 4f a2 80 3b 53 a5 e8 5d 27 6a cb d2 9a\ +b8 23 f8 0a 73 91 bb 54 a5 05 16 72 fb 04 ee b5\ +43 +Prime2: \ +04 83 e0 ae 47 91 55 87 74 3f f3 45 36 2b 55 5d\ +39 62 d9 8b b6 f1 5f 84 8b 4c 92 b1 77 1c a8 ed\ +10 7d 8d 3e e6 5e c4 45 17 dd 0f aa 48 1a 38 7e\ +90 2f 7a 2e 74 7c 26 9e 7e a4 44 80 bc 53 8b 8e\ +5b +ModPrime1PrivateExponent: \ +03 a8 e8 ae a9 92 0c 1a a3 b2 f0 d8 46 e4 b8 50\ +d8 1c a3 06 a5 1c 83 54 4f 94 9f 64 f9 0d cf 3f\ +8e 26 61 f0 7e 56 12 20 a1 80 38 8f be 27 3e 70\ +e2 e5 dc a8 3a 0e 13 48 dd 64 90 c7 31 d6 ec e1\ +ab +ModPrime2PrivateExponent: \ +01 35 bd cd b6 0b f2 19 7c 43 6e d3 4b 32 cd 8b\ +4f c7 77 78 83 2b a7 67 03 55 1f b2 42 b3 01 69\ +95 93 af 77 fd 8f c3 94 a8 52 6a d2 3c c4 1a 03\ +80 6b d8 97 fe 4b 0e a6 46 55 8a ad dc c9 9e 8a\ +25 +MultiplicativeInverseOfPrime2ModPrime1: \ +03 04 c0 3d 9c 73 65 03 a9 84 ab bd 9b a2 23 01\ +40 7c 4a 2a b1 dd 85 76 64 81 b6 0d 45 40 11 52\ +e6 92 be 14 f4 12 1d 9a a3 fd 6e 0b 4d 1d 3a 97\ +35 38 a3 1d 42 ee 6e 1e 5e f6 20 23 1a 2b ba f3\ +5f +Test: KeyPairValidAndConsistent +Comment: RSASSA-PSS Signature Example 6.1 +Message: \ +0a 20 b7 74 ad dc 2f a5 12 45 ed 7c b9 da 60 9e\ +50 ca c6 63 6a 52 54 3f 97 45 8e ed 73 40 f8 d5\ +3f fc 64 91 8f 94 90 78 ee 03 ef 60 d4 2b 5f ec\ +24 60 50 bd 55 05 cd 8c b5 97 ba d3 c4 e7 13 b0\ +ef 30 64 4e 76 ad ab b0 de 01 a1 56 1e fb 25 51\ +58 c7 4f c8 01 e6 e9 19 e5 81 b4 6f 0f 0d dd 08\ +e4 f3 4c 78 10 b5 ed 83 18 f9 1d 7c 8c +Salt: \ +5b 4e a2 ef 62 9c c2 2f 3b 53 8e 01 69 04 b4 7b\ +1e 40 bf d5 +Signature: \ +04 c0 cf ac ec 04 e5 ba db ec e1 59 a5 a1 10 3f\ +69 b3 f3 2b a5 93 cb 4c c4 b1 b7 ab 45 59 16 a9\ +6a 27 cd 26 78 ea 0f 46 ba 37 f7 fc 9c 86 32 5f\ +29 73 3b 38 9f 1d 97 f4 3e 72 01 c0 f3 48 fc 45\ +fe 42 89 23 35 36 2e ee 01 8b 5b 16 1f 2f 93 93\ +03 12 25 c7 13 01 2a 57 6b c8 8e 23 05 24 89 86\ +8d 90 10 cb f0 33 ec c5 68 e8 bc 15 2b dc 59 d5\ +60 e4 12 91 91 5d 28 56 52 08 e2 2a ee c9 ef 85\ +d1 +Test: Verify +Comment: RSASSA-PSS Signature Example 6.2 +Message: \ +2a af f6 63 1f 62 1c e6 15 76 0a 9e bc e9 4b b3\ +33 07 7a d8 64 88 c8 61 d4 b7 6d 29 c1 f4 87 46\ +c6 11 ae 1e 03 ce d4 44 5d 7c fa 1f e5 f6 2e 1b\ +3f 08 45 2b de 3b 6e f8 19 73 ba fb b5 7f 97 bc\ +ee f8 73 98 53 95 b8 26 05 89 aa 88 cb 7d b5 0a\ +b4 69 26 2e 55 1b dc d9 a5 6f 27 5a 0a c4 fe 48\ +47 00 c3 5f 3d bf 2b 46 9e de 86 47 41 b8 6f a5\ +91 72 a3 60 ba 95 a0 2e 13 9b e5 0d df b7 cf 0b\ +42 fa ea bb fb ba a8 6a 44 97 69 9c 4f 2d fd 5b\ +08 40 6a f7 e1 41 44 42 7c 25 3e c0 ef a2 0e af\ +9a 8b e8 cd 49 ce 1f 1b c4 e9 3e 61 9c f2 aa 8e\ +d4 fb 39 bc 85 90 d0 f7 b9 64 88 f7 31 7a c9 ab\ +f7 be e4 e3 a0 e7 15 +Salt: \ +83 14 6a 9e 78 27 22 c2 8b 01 4f 98 b4 26 7b da\ +2a c9 50 4f +Signature: \ +0a 23 14 25 0c f5 2b 6e 4e 90 8d e5 b3 56 46 bc\ +aa 24 36 1d a8 16 0f b0 f9 25 75 90 ab 3a ce 42\ +b0 dc 3e 77 ad 2d b7 c2 03 a2 0b d9 52 fb b5 6b\ +15 67 04 6e cf aa 93 3d 7b 10 00 c3 de 9f f0 5b\ +7d 98 9b a4 6f d4 3b c4 c2 d0 a3 98 6b 7f fa 13\ +47 1d 37 eb 5b 47 d6 47 07 bd 29 0c fd 6a 9f 39\ +3a d0 8e c1 e3 bd 71 bb 57 92 61 50 35 cd af 2d\ +89 29 ae d3 be 09 83 79 37 7e 77 7c e7 9a aa 47\ +73 +Test: Verify +Comment: RSASSA-PSS Signature Example 6.3 +Message: \ +0f 61 95 d0 4a 6e 6f c7 e2 c9 60 0d bf 84 0c 39\ +ea 8d 4d 62 4f d5 35 07 01 6b 0e 26 85 8a 5e 0a\ +ec d7 ad a5 43 ae 5c 0a b3 a6 25 99 cb a0 a5 4e\ +6b f4 46 e2 62 f9 89 97 8f 9d df 5e 9a 41 +Salt: \ +a8 7b 8a ed 07 d7 b8 e2 da f1 4d dc a4 ac 68 c4\ +d0 aa bf f8 +Signature: \ +08 6d f6 b5 00 09 8c 12 0f 24 ff 84 23 f7 27 d9\ +c6 1a 5c 90 07 d3 b6 a3 1c e7 cf 8f 3c be c1 a2\ +6b b2 0e 2b d4 a0 46 79 32 99 e0 3e 37 a2 1b 40\ +19 4f b0 45 f9 0b 18 bf 20 a4 79 92 cc d7 99 cf\ +9c 05 9c 29 9c 05 26 85 49 54 aa de 8a 6a d9 d9\ +7e c9 1a 11 45 38 3f 42 46 8b 23 1f 4d 72 f2 37\ +06 d9 85 3c 3f a4 3c e8 ac e8 bf e7 48 49 87 a1\ +ec 6a 16 c8 da f8 1f 7c 8b f4 27 74 70 7a 9d f4\ +56 +Test: Verify +Comment: RSASSA-PSS Signature Example 6.4 +Message: \ +33 7d 25 fe 98 10 eb ca 0d e4 d4 65 8d 3c eb 8e\ +0f e4 c0 66 ab a3 bc c4 8b 10 5d 3b f7 e0 25 7d\ +44 fe ce a6 59 6f 4d 0c 59 a0 84 02 83 36 78 f7\ +06 20 f9 13 8d fe b7 de d9 05 e4 a6 d5 f0 5c 47\ +3d 55 93 66 52 e2 a5 df 43 c0 cf da 7b ac af 30\ +87 f4 52 4b 06 cf 42 15 7d 01 53 97 39 f7 fd de\ +c9 d5 81 25 df 31 a3 2e ab 06 c1 9b 71 f1 d5 bf +Salt: \ +a3 79 32 f8 a7 49 4a 94 2d 6f 76 74 38 e7 24 d6\ +d0 c0 ef 18 +Signature: \ +0b 5b 11 ad 54 98 63 ff a9 c5 1a 14 a1 10 6c 2a\ +72 cc 8b 64 6e 5c 72 62 50 97 86 10 5a 98 47 76\ +53 4c a9 b5 4c 1c c6 4b f2 d5 a4 4f d7 e8 a6 9d\ +b6 99 d5 ea 52 08 7a 47 48 fd 2a bc 1a fe d1 e5\ +d6 f7 c8 90 25 53 0b da a2 21 3d 7e 03 0f a5 5d\ +f6 f3 4b cf 1c e4 6d 2e df 4e 3a e4 f3 b0 18 91\ +a0 68 c9 e3 a4 4b bc 43 13 3e da d6 ec b9 f3 54\ +00 c4 25 2a 57 62 d6 57 44 b9 9c b9 f4 c5 59 32\ +9f +Test: Verify +Comment: RSASSA-PSS Signature Example 6.5 +Message: \ +84 ec 50 2b 07 2e 82 87 78 9d 8f 92 35 82 9e a3\ +b1 87 af d4 d4 c7 85 61 1b da 5f 9e b3 cb 96 71\ +7e fa 70 07 22 7f 1c 08 cb cb 97 2e 66 72 35 e0\ +fb 7d 43 1a 65 70 32 6d 2e cc e3 5a db 37 3d c7\ +53 b3 be 5f 82 9b 89 17 54 93 19 3f ab 16 ba db\ +41 37 1b 3a ac 0a e6 70 07 6f 24 be f4 20 c1 35\ +ad d7 ce e8 d3 5f bc 94 4d 79 fa fb 9e 30 7a 13\ +b0 f5 56 cb 65 4a 06 f9 73 ed 22 67 23 30 19 7e\ +f5 a7 48 bf 82 6a 5d b2 38 3a 25 36 4b 68 6b 93\ +72 bb 23 39 ae b1 ac 9e 98 89 32 7d 01 6f 16 70\ +77 6d b0 62 01 ad bd ca f8 a5 e3 b7 4e 10 8b 73 +Salt: \ +7b 79 0c 1d 62 f7 b8 4e 94 df 6a f2 89 17 cf 57\ +10 18 11 0e +Signature: \ +02 d7 1f a9 b5 3e 46 54 fe fb 7f 08 38 5c f6 b0\ +ae 3a 81 79 42 eb f6 6c 35 ac 67 f0 b0 69 95 2a\ +3c e9 c7 e1 f1 b0 2e 48 0a 95 00 83 6d e5 d6 4c\ +db 7e cd e0 45 42 f7 a7 99 88 78 7e 24 c2 ba 05\ +f5 fd 48 2c 02 3e d5 c3 0e 04 83 9d c4 4b ed 2a\ +3a 3a 4f ee 01 11 3c 89 1a 47 d3 2e b8 02 5c 28\ +cb 05 0b 5c db 57 6c 70 fe 76 ef 52 34 05 c0 84\ +17 fa f3 50 b0 37 a4 3c 37 93 39 fc b1 8d 3a 35\ +6b +Test: Verify +Comment: RSASSA-PSS Signature Example 6.6 +Message: \ +99 06 d8 9f 97 a9 fd ed d3 cc d8 24 db 68 73 26\ +f3 0f 00 aa 25 a7 fc a2 af cb 3b 0f 86 cd 41 e7\ +3f 0e 8f f7 d2 d8 3f 59 e2 8e d3 1a 5a 0d 55 15\ +23 37 4d e2 2e 4c 7e 8f f5 68 b3 86 ee 3d c4 11\ +63 f1 0b f6 7b b0 06 26 1c 90 82 f9 af 90 bf 1d\ +90 49 a6 b9 fa e7 1c 7f 84 fb e6 e5 5f 02 78 9d\ +e7 74 f2 30 f1 15 02 6a 4b 4e 96 c5 5b 04 a9 5d\ +a3 aa cb b2 ce ce 8f 81 76 4a 1f 1c 99 51 54 11\ +08 7c f7 d3 4a ed ed 09 32 c1 83 +Salt: \ +fb be 05 90 25 b6 9b 89 fb 14 ae 22 89 e7 aa af\ +e6 0c 0f cd +Signature: \ +0a 40 a1 6e 2f e2 b3 8d 1d f9 05 46 16 7c f9 46\ +9c 9e 3c 36 81 a3 44 2b 4b 2c 2f 58 1d eb 38 5c\ +e9 9f c6 18 8b b0 2a 84 1d 56 e7 6d 30 18 91 e2\ +45 60 55 0f cc 2a 26 b5 5f 4c cb 26 d8 37 d3 50\ +a1 54 bc ac a8 39 2d 98 fa 67 95 9e 97 27 b7 8c\ +ad 03 26 9f 56 96 8f c5 6b 68 bd 67 99 26 d8 3c\ +c9 cb 21 55 50 64 5c cd a3 1c 76 0f f3 58 88 94\ +3d 2d 8a 1d 35 1e 81 e5 d0 7b 86 18 2e 75 10 81\ +ef +Test: Verify +Comment: Example 7: A 1030-bit RSA Key Pair +Modulus: \ +37 c9 da 4a 66 c8 c4 08 b8 da 27 d0 c9 d7 9f 8c\ +cb 1e af c1 d2 fe 48 74 6d 94 0b 7c 4e f5 de e1\ +8a d1 26 47 ce fa a0 c4 b3 18 8b 22 1c 51 53 86\ +75 9b 93 f0 20 24 b2 5a b9 24 2f 83 57 d8 f3 fd\ +49 64 0e e5 e6 43 ea f6 c6 4d ee fa 70 89 72 7c\ +8f f0 39 93 33 39 15 c6 ef 21 bf 59 75 b6 e5 0d\ +11 8b 51 00 8e c3 3e 9f 01 a0 a5 45 a1 0a 83 6a\ +43 dd bc a9 d8 b5 c5 d3 54 80 22 d7 06 4e a2 9a\ +b3 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +3b ed 99 90 52 d9 57 bc 06 d6 51 ee f6 e3 a9 80\ +94 b1 62 1b d3 8b 54 49 bd 6c 4a ea 3d e7 e0 84\ +67 9a 44 84 de d2 5b e0 f0 82 6c f3 37 78 25 41\ +4b 14 d4 d6 1d b1 4d e6 26 fb b8 0e 5f 4f ae c9\ +56 f9 a0 a2 d2 4f 99 57 63 80 f0 84 eb 62 e4 6a\ +57 d5 54 27 8b 53 56 26 19 3c e0 20 60 57 5e b6\ +6c 57 98 d3 6f 6c 5d 40 fb 00 d8 09 b4 2a 73 10\ +2c 1c 74 ee 95 bd 71 42 0f ff ef 63 18 b5 2c 29 +Prime1: \ +07 ee fb 42 4b 0e 3a 40 e4 20 8e e5 af b2 80 b2\ +23 17 30 81 14 dd e0 b4 b6 4f 73 01 84 ec 68 da\ +6c e2 86 7a 9f 48 ed 77 26 d5 e2 61 4e d0 4a 54\ +10 73 6c 8c 71 4e e7 02 47 42 98 c6 29 2a f0 75\ +35 +Prime2: \ +07 08 30 db f9 47 ea c0 22 8d e2 63 14 b5 9b 66\ +99 4c c6 0e 83 60 e7 5d 38 76 29 8f 8f 8a 7d 14\ +1d a0 64 e5 ca 02 6a 97 3e 28 f2 54 73 8c ee 66\ +9c 72 1b 03 4c b5 f8 e2 44 da dd 7c d1 e1 59 d5\ +47 +ModPrime1PrivateExponent: \ +05 24 d2 0c 3d 95 cf f7 5a f2 31 34 83 22 7d 87\ +02 71 7a a5 76 de 15 5f 96 05 15 50 1a db 1d 70\ +e1 c0 4d e9 1b 75 b1 61 db f0 39 83 56 12 7e de\ +da 7b bc 19 a3 2d c1 62 1c c9 f5 3c 26 5d 0c e3\ +31 +ModPrime2PrivateExponent: \ +05 f9 84 a1 f2 3c 93 8d 6a 0e 89 72 4b cf 3d d9\ +3f 99 46 92 60 37 fe 7c 6b 13 a2 9e 52 84 85 5f\ +89 08 95 91 d4 40 97 56 27 bf 5c 9e 3a 8b 5c a7\ +9c 77 2a d2 73 e4 0d 32 1a f4 a6 c9 7d fd ed 78\ +d3 +MultiplicativeInverseOfPrime2ModPrime1: \ +dd d9 18 ad ad a2 9d ca b9 81 ff 9a cb a4 25 70\ +23 c0 9a 38 01 cc ce 09 8c e2 68 f8 55 d0 df 57\ +0c d6 e7 b9 b1 4b d9 a5 a9 25 4c bc 31 5b e6 f8\ +ba 1e 25 46 dd d5 69 c5 ea 19 ee d8 35 3b de 5e +Test: KeyPairValidAndConsistent +Comment: RSASSA-PSS Signature Example 7.1 +Message: \ +9e ad 0e 01 94 56 40 67 4e b4 1c ad 43 5e 23 74\ +ea ef a8 ad 71 97 d9 79 13 c4 49 57 d8 d8 3f 40\ +d7 6e e6 0e 39 bf 9c 0f 9e af 30 21 42 1a 07 4d\ +1a de 96 2c 6e 9d 3d c3 bb 17 4f e4 df e6 52 b0\ +91 15 49 5b 8f d2 79 41 74 02 0a 06 02 b5 ca 51\ +84 8c fc 96 ce 5e b5 7f c0 a2 ad c1 dd a3 6a 7c\ +c4 52 64 1a 14 91 1b 37 e4 5b fa 11 da a5 c7 ec\ +db 74 f6 d0 10 0d 1d 3e 39 e7 52 80 0e 20 33 97\ +de 02 33 07 7b 9a 88 85 55 37 fa e9 27 f9 24 38\ +0d 78 0f 98 e1 8d cf f3 9c 5e a7 41 b1 7d 6f dd\ +18 85 bc 9d 58 14 82 d7 71 ce b5 62 d7 8a 8b f8\ +8f 0c 75 b1 13 63 e5 e3 6c d4 79 ce b0 54 5f 9d\ +a8 42 03 e0 e6 e5 08 37 5c c9 e8 44 b8 8b 7a c7\ +a0 a2 01 ea 0f 1b ee 9a 2c 57 79 20 ca 02 c0 1b\ +9d 83 20 e9 74 a5 6f 4e fb 57 63 b9 62 55 ab bf\ +80 37 bf 18 02 cf 01 8f 56 37 94 93 e5 69 a9 +Salt: \ +b7 86 7a 59 95 8c b5 43 28 f8 77 5e 65 46 ec 06\ +d2 7e aa 50 +Signature: \ +18 7f 39 07 23 c8 90 25 91 f0 15 4b ae 6d 4e cb\ +ff e0 67 f0 e8 b7 95 47 6e a4 f4 d5 1c cc 81 05\ +20 bb 3c a9 bc a7 d0 b1 f2 ea 8a 17 d8 73 fa 27\ +57 0a cd 64 2e 38 08 56 1c b9 e9 75 cc fd 80 b2\ +3d c5 77 1c db 33 06 a5 f2 31 59 da cb d3 aa 2d\ +b9 3d 46 d7 66 e0 9e d1 5d 90 0a d8 97 a8 d2 74\ +dc 26 b4 7e 99 4a 27 e9 7e 22 68 a7 66 53 3a e4\ +b5 e4 2a 2f ca f7 55 c1 c4 79 4b 29 4c 60 55 58\ +23 +Test: Verify +Comment: RSASSA-PSS Signature Example 7.2 +Message: \ +8d 80 d2 d0 8d bd 19 c1 54 df 3f 14 67 3a 14 bd\ +03 73 52 31 f2 4e 86 bf 15 3d 0e 69 e7 4c bf f7\ +b1 83 6e 66 4d e8 3f 68 01 24 37 0f c0 f9 6c 9b\ +65 c0 7a 36 6b 64 4c 4a b3 +Salt: \ +0c 09 58 22 66 df 08 63 10 82 1b a7 e1 8d f6 4d\ +fe e6 de 09 +Signature: \ +10 fd 89 76 8a 60 a6 77 88 ab b5 85 6a 78 7c 85\ +61 f3 ed cf 9a 83 e8 98 f7 dc 87 ab 8c ce 79 42\ +9b 43 e5 69 06 94 1a 88 61 94 f1 37 e5 91 fe 7c\ +33 95 55 36 1f bb e1 f2 4f eb 2d 4b cd b8 06 01\ +f3 09 6b c9 13 2d ee a6 0a e1 30 82 f4 4f 9a d4\ +1c d6 28 93 6a 4d 51 17 6e 42 fc 59 cb 76 db 81\ +5c e5 ab 4d b9 9a 10 4a af ea 68 f5 d3 30 32 9e\ +bf 25 8d 4e de 16 06 4b d1 d0 03 93 d5 e1 57 0e\ +b8 +Test: Verify +Comment: RSASSA-PSS Signature Example 7.3 +Message: \ +80 84 05 cd fc 1a 58 b9 bb 03 97 c7 20 72 2a 81\ +ff fb 76 27 8f 33 59 17 ef 9c 47 38 14 b3 e0 16\ +ba 29 73 cd 27 65 f8 f3 f8 2d 6c c3 8a a7 f8 55\ +18 27 fe 8d 1e 38 84 b7 e6 1c 94 68 3b 8f 82 f1\ +84 3b da e2 25 7e ee c9 81 2a d4 c2 cf 28 3c 34\ +e0 b0 ae 0f e3 cb 99 0c f8 8f 2e f9 +Salt: \ +28 03 9d cf e1 06 d3 b8 29 66 11 25 8c 4a 56 65\ +1c 9e 92 dd +Signature: \ +2b 31 fd e9 98 59 b9 77 aa 09 58 6d 8e 27 46 62\ +b2 5a 2a 64 06 40 b4 57 f5 94 05 1c b1 e7 f7 a9\ +11 86 54 55 24 29 26 cf 88 fe 80 df a3 a7 5b a9\ +68 98 44 a1 1e 63 4a 82 b0 75 af bd 69 c1 2a 0d\ +f9 d2 5f 84 ad 49 45 df 3d c8 fe 90 c3 ce fd f2\ +6e 95 f0 53 43 04 b5 bd ba 20 d3 e5 64 0a 2e bf\ +b8 98 aa c3 5a e4 0f 26 fc e5 56 3c 2f 9f 24 f3\ +04 2a f7 6f 3c 70 72 d6 87 bb fb 95 9a 88 46 0a\ +f1 +Test: Verify +Comment: RSASSA-PSS Signature Example 7.4 +Message: \ +f3 37 b9 ba d9 37 de 22 a1 a0 52 df f1 11 34 a8\ +ce 26 97 62 02 98 19 39 b9 1e 07 15 ae 5e 60 96\ +49 da 1a df ce f3 f4 cc a5 9b 23 83 60 e7 d1 e4\ +96 c7 bf 4b 20 4b 5a cf f9 bb d6 16 6a 1d 87 a3\ +6e f2 24 73 73 75 10 39 f8 a8 00 b8 39 98 07 b3\ +a8 5f 44 89 34 97 c0 d0 5f b7 01 7b 82 22 81 52\ +de 6f 25 e6 11 6d cc 75 03 c7 86 c8 75 c2 8f 3a\ +a6 07 e9 4a b0 f1 98 63 ab 1b 50 73 77 0b 0c d5\ +f5 33 ac de 30 c6 fb 95 3c f3 da 68 02 64 e3 0f\ +c1 1b ff 9a 19 bf fa b4 77 9b 62 23 c3 fb 3f e0\ +f7 1a ba de 4e b7 c0 9c 41 e2 4c 22 d2 3f a1 48\ +e6 a1 73 fe b6 39 84 d1 bc 6e e3 a0 2d 91 5b 75\ +2c ea f9 2a 30 15 ec eb 38 ca 58 6c 68 01 b3 7c\ +34 ce fb 2c ff 25 ea 23 c0 86 62 dc ab 26 a7 a9\ +3a 28 5d 05 d3 04 4c +Salt: \ +a7 78 21 eb bb ef 24 62 8e 4e 12 e1 d0 ea 96 de\ +39 8f 7b 0f +Signature: \ +32 c7 ca 38 ff 26 94 9a 15 00 0c 4b a0 4b 2b 13\ +b3 5a 38 10 e5 68 18 4d 7e ca ba a1 66 b7 ff ab\ +dd f2 b6 cf 4b a0 71 24 92 37 90 f2 e5 b1 a5 be\ +04 0a ea 36 fe 13 2e c1 30 e1 f1 05 67 98 2d 17\ +ac 3e 89 b8 d2 6c 30 94 03 4e 76 2d 2e 03 12 64\ +f0 11 70 be ec b3 d1 43 9e 05 84 6f 25 45 83 67\ +a7 d9 c0 20 60 44 46 72 67 1e 64 e8 77 86 45 59\ +ca 19 b2 07 4d 58 8a 28 1b 58 04 d2 37 72 fb be\ +19 +Test: Verify +Comment: RSASSA-PSS Signature Example 7.5 +Message: \ +45 01 3c eb af d9 60 b2 55 47 6a 8e 25 98 b9 aa\ +32 ef be 6d c1 f3 4f 4a 49 8d 8c f5 a2 b4 54 8d\ +08 c5 5d 5f 95 f7 bc c9 61 91 63 05 6f 2d 58 b5\ +2f a0 32 +Salt: \ +9d 5a d8 eb 45 21 34 b6 5d c3 a9 8b 6a 73 b5 f7\ +41 60 9c d6 +Signature: \ +07 eb 65 1d 75 f1 b5 2b c2 63 b2 e1 98 33 6e 99\ +fb eb c4 f3 32 04 9a 92 2a 10 81 56 07 ee 2d 98\ +9d b3 a4 49 5b 7d cc d3 8f 58 a2 11 fb 7e 19 31\ +71 a3 d8 91 13 24 37 eb ca 44 f3 18 b2 80 50 9e\ +52 b5 fa 98 fc ce 82 05 d9 69 7c 8e e4 b7 ff 59\ +d4 c5 9c 79 03 8a 19 70 bd 2a 0d 45 1e cd c5 ef\ +11 d9 97 9c 9d 35 f8 c7 0a 61 63 71 76 07 89 0d\ +58 6a 7c 6d c0 1c 79 f8 6a 8f 28 e8 52 35 f8 c2\ +f1 +Test: Verify +Comment: RSASSA-PSS Signature Example 7.6 +Message: \ +23 58 09 70 86 c8 99 32 3e 75 d9 c9 0d 0c 09 f1\ +2d 9d 54 ed fb df 70 a9 c2 eb 5a 04 d8 f3 6b 9b\ +2b df 2a ab e0 a5 bd a1 96 89 37 f9 d6 eb d3 b6\ +b2 57 ef b3 13 6d 41 31 f9 ac b5 9b 85 e2 60 2c\ +2a 3f cd c8 35 49 4a 1f 4e 5e c1 8b 22 6c 80 23\ +2b 36 a7 5a 45 fd f0 9a 7e a9 e9 8e fb de 14 50\ +d1 19 4b f1 2e 15 a4 c5 f9 eb 5c 0b ce 52 69 e0\ +c3 b2 8c fa b6 55 d8 1a 61 a2 0b 4b e2 f5 44 59\ +bb 25 a0 db 94 c5 22 18 be 10 9a 74 26 de 83 01\ +44 24 78 9a aa 90 e5 05 6e 63 2a 69 81 15 e2 82\ +c1 a5 64 10 f2 6c 20 72 f1 93 48 1a 9d cd 88 05\ +72 00 5e 64 f4 08 2e cf +Salt: \ +3f 2e fc 59 58 80 a7 d4 7f cf 3c ba 04 98 3e a5\ +4c 4b 73 fb +Signature: \ +18 da 3c dc fe 79 bf b7 7f d9 c3 2f 37 7a d3 99\ +14 6f 0a 8e 81 06 20 23 32 71 a6 e3 ed 32 48 90\ +3f 5c dc 92 dc 79 b5 5d 3e 11 61 5a a0 56 a7 95\ +85 37 92 a3 99 8c 34 9c a5 c4 57 e8 ca 7d 29 d7\ +96 aa 24 f8 34 91 70 9b ef cf b1 51 0e a5 13 c9\ +28 29 a3 f0 0b 10 4f 65 56 34 f3 20 75 2e 13 0e\ +c0 cc f6 75 4f f8 93 db 30 29 32 bb 02 5e b6 0e\ +87 82 25 98 fc 61 9e 0e 98 17 37 a9 a4 c4 15 2d\ +33 +Test: Verify +Comment: Example 8: A 1031-bit RSA Key Pair +Modulus: \ +49 53 70 a1 fb 18 54 3c 16 d3 63 1e 31 63 25 5d\ +f6 2b e6 ee e8 90 d5 f2 55 09 e4 f7 78 a8 ea 6f\ +bb bc df 85 df f6 4e 0d 97 20 03 ab 36 81 fb ba\ +6d d4 1f d5 41 82 9b 2e 58 2d e9 f2 a4 a4 e0 a2\ +d0 90 0b ef 47 53 db 3c ee 0e e0 6c 7d fa e8 b1\ +d5 3b 59 53 21 8f 9c ce ea 69 5b 08 66 8e de aa\ +dc ed 94 63 b1 d7 90 d5 eb f2 7e 91 15 b4 6c ad\ +4d 9a 2b 8e fa b0 56 1b 08 10 34 47 39 ad a0 73\ +3f +PublicExponent: \ +01 00 01 +PrivateExponent: \ +6c 66 ff e9 89 80 c3 8f cd ea b5 15 98 98 83 61\ +65 f4 b4 b8 17 c4 f6 a8 d4 86 ee 4e a9 13 0f e9\ +b9 09 2b d1 36 d1 84 f9 5f 50 4a 60 7e ac 56 58\ +46 d2 fd d6 59 7a 89 67 c7 39 6e f9 5a 6e ee bb\ +45 78 a6 43 96 6d ca 4d 8e e3 de 84 2d e6 32 79\ +c6 18 15 9c 1a b5 4a 89 43 7b 6a 61 20 e4 93 0a\ +fb 52 a4 ba 6c ed 8a 49 47 ac 64 b3 0a 34 97 cb\ +e7 01 c2 d6 26 6d 51 72 19 ad 0e c6 d3 47 db e9 +Prime1: \ +08 da d7 f1 13 63 fa a6 23 d5 d6 d5 e8 a3 19 32\ +8d 82 19 0d 71 27 d2 84 6c 43 9b 0a b7 26 19 b0\ +a4 3a 95 32 0e 4e c3 4f c3 a9 ce a8 76 42 23 05\ +bd 76 c5 ba 7b e9 e2 f4 10 c8 06 06 45 a1 d2 9e\ +db +Prime2: \ +08 47 e7 32 37 6f c7 90 0f 89 8e a8 2e b2 b0 fc\ +41 85 65 fd ae 62 f7 d9 ec 4c e2 21 7b 97 99 0d\ +d2 72 db 15 7f 99 f6 3c 0d cb b9 fb ac db d4 c4\ +da db 6d f6 77 56 35 8c a4 17 48 25 b4 8f 49 70\ +6d +ModPrime1PrivateExponent: \ +05 c2 a8 3c 12 4b 36 21 a2 aa 57 ea 2c 3e fe 03\ +5e ff 45 60 f3 3d de bb 7a da b8 1f ce 69 a0 c8\ +c2 ed c1 65 20 dd a8 3d 59 a2 3b e8 67 96 3a c6\ +5f 2c c7 10 bb cf b9 6e e1 03 de b7 71 d1 05 fd\ +85 +ModPrime2PrivateExponent: \ +04 ca e8 aa 0d 9f aa 16 5c 87 b6 82 ec 14 0b 8e\ +d3 b5 0b 24 59 4b 7a 3b 2c 22 0b 36 69 bb 81 9f\ +98 4f 55 31 0a 1a e7 82 36 51 d4 a0 2e 99 44 79\ +72 59 51 39 36 34 34 e5 e3 0a 7e 7d 24 15 51 e1\ +b9 +MultiplicativeInverseOfPrime2ModPrime1: \ +07 d3 e4 7b f6 86 60 0b 11 ac 28 3c e8 8d bb 3f\ +60 51 e8 ef d0 46 80 e4 4c 17 1e f5 31 b8 0b 2b\ +7c 39 fc 76 63 20 e2 cf 15 d8 d9 98 20 e9 6f f3\ +0d c6 96 91 83 9c 4b 40 d7 b0 6e 45 30 7d c9 1f\ +3f +Test: KeyPairValidAndConsistent +Comment: RSASSA-PSS Signature Example 8.1 +Message: \ +81 33 2f 4b e6 29 48 41 5e a1 d8 99 79 2e ea cf\ +6c 6e 1d b1 da 8b e1 3b 5c ea 41 db 2f ed 46 70\ +92 e1 ff 39 89 14 c7 14 25 97 75 f5 95 f8 54 7f\ +73 56 92 a5 75 e6 92 3a f7 8f 22 c6 99 7d db 90\ +fb 6f 72 d7 bb 0d d5 74 4a 31 de cd 3d c3 68 58\ +49 83 6e d3 4a ec 59 63 04 ad 11 84 3c 4f 88 48\ +9f 20 97 35 f5 fb 7f da f7 ce c8 ad dc 58 18 16\ +8f 88 0a cb f4 90 d5 10 05 b7 a8 e8 4e 43 e5 42\ +87 97 75 71 dd 99 ee a4 b1 61 eb 2d f1 f5 10 8f\ +12 a4 14 2a 83 32 2e db 05 a7 54 87 a3 43 5c 9a\ +78 ce 53 ed 93 bc 55 08 57 d7 a9 fb +Salt: \ +1d 65 49 1d 79 c8 64 b3 73 00 9b e6 f6 f2 46 7b\ +ac 4c 78 fa +Signature: \ +02 62 ac 25 4b fa 77 f3 c1 ac a2 2c 51 79 f8 f0\ +40 42 2b 3c 5b af d4 0a 8f 21 cf 0f a5 a6 67 cc\ +d5 99 3d 42 db af b4 09 c5 20 e2 5f ce 2b 1e e1\ +e7 16 57 7f 1e fa 17 f3 da 28 05 2f 40 f0 41 9b\ +23 10 6d 78 45 aa f0 11 25 b6 98 e7 a4 df e9 2d\ +39 67 bb 00 c4 d0 d3 5b a3 55 2a b9 a8 b3 ee f0\ +7c 7f ec db c5 42 4a c4 db 1e 20 cb 37 d0 b2 74\ +47 69 94 0e a9 07 e1 7f bb ca 67 3b 20 52 23 80\ +c5 +Test: Verify +Comment: RSASSA-PSS Signature Example 8.2 +Message: \ +e2 f9 6e af 0e 05 e7 ba 32 6e cc a0 ba 7f d2 f7\ +c0 23 56 f3 ce de 9d 0f aa bf 4f cc 8e 60 a9 73\ +e5 59 5f d9 ea 08 +Salt: \ +43 5c 09 8a a9 90 9e b2 37 7f 12 48 b0 91 b6 89\ +87 ff 18 38 +Signature: \ +27 07 b9 ad 51 15 c5 8c 94 e9 32 e8 ec 0a 28 0f\ +56 33 9e 44 a1 b5 8d 4d dc ff 2f 31 2e 5f 34 dc\ +fe 39 e8 9c 6a 94 dc ee 86 db bd ae 5b 79 ba 4e\ +08 19 a9 e7 bf d9 d9 82 e7 ee 6c 86 ee 68 39 6e\ +8b 3a 14 c9 c8 f3 4b 17 8e b7 41 f9 d3 f1 21 10\ +9b f5 c8 17 2f ad a2 e7 68 f9 ea 14 33 03 2c 00\ +4a 8a a0 7e b9 90 00 0a 48 dc 94 c8 ba c8 aa be\ +2b 09 b1 aa 46 c0 a2 aa 0e 12 f6 3f bb a7 75 ba\ +7e +Test: Verify +Comment: RSASSA-PSS Signature Example 8.3 +Message: \ +e3 5c 6e d9 8f 64 a6 d5 a6 48 fc ab 8a db 16 33\ +1d b3 2e 5d 15 c7 4a 40 ed f9 4c 3d c4 a4 de 79\ +2d 19 08 89 f2 0f 1e 24 ed 12 05 4a 6b 28 79 8f\ +cb 42 d1 c5 48 76 9b 73 4c 96 37 31 42 09 2a ed\ +27 76 03 f4 73 8d f4 dc 14 46 58 6d 0e c6 4d a4\ +fb 60 53 6d b2 ae 17 fc 7e 3c 04 bb fb bb d9 07\ +bf 11 7c 08 63 6f a1 6f 95 f5 1a 62 16 93 4d 3e\ +34 f8 50 30 f1 7b bb c5 ba 69 14 40 58 af f0 81\ +e0 b1 9c f0 3c 17 19 5c 5e 88 8b a5 8f 6f e0 a0\ +2e 5c 3b da 97 19 a7 +Salt: \ +c6 eb be 76 df 0c 4a ea 32 c4 74 17 5b 2f 13 68\ +62 d0 45 29 +Signature: \ +2a d2 05 09 d7 8c f2 6d 1b 6c 40 61 46 08 6e 4b\ +0c 91 a9 1c 2b d1 64 c8 7b 96 6b 8f aa 42 aa 0c\ +a4 46 02 23 23 ba 4b 1a 1b 89 70 6d 7f 4c 3b e5\ +7d 7b 69 70 2d 16 8a b5 95 5e e2 90 35 6b 8c 4a\ +29 ed 46 7d 54 7e c2 3c ba df 28 6c cb 58 63 c6\ +67 9d a4 67 fc 93 24 a1 51 c7 ec 55 aa c6 db 40\ +84 f8 27 26 82 5c fe 1a a4 21 bc 64 04 9f b4 2f\ +23 14 8f 9c 25 b2 dc 30 04 37 c3 8d 42 8a a7 5f\ +96 +Test: Verify +Comment: RSASSA-PSS Signature Example 8.4 +Message: \ +db c5 f7 50 a7 a1 4b e2 b9 3e 83 8d 18 d1 4a 86\ +95 e5 2e 8a dd 9c 0a c7 33 b8 f5 6d 27 47 e5 29\ +a0 cc a5 32 dd 49 b9 02 ae fe d5 14 44 7f 9e 81\ +d1 61 95 c2 85 38 68 cb 9b 30 f7 d0 d4 95 c6 9d\ +01 b5 c5 d5 0b 27 04 5d b3 86 6c 23 24 a4 4a 11\ +0b 17 17 74 6d e4 57 d1 c8 c4 5c 3c d2 a9 29 70\ +c3 d5 96 32 05 5d 4c 98 a4 1d 6e 99 e2 a3 dd d5\ +f7 f9 97 9a b3 cd 18 f3 75 05 d2 51 41 de 2a 1b\ +ff 17 b3 a7 dc e9 41 9e cc 38 5c f1 1d 72 84 0f\ +19 95 3f d0 50 92 51 f6 ca fd e2 89 3d 0e 75 c7\ +81 ba 7a 50 12 ca 40 1a 4f a9 9e 04 b3 c3 24 9f\ +92 6d 5a fe 82 cc 87 da b2 2c 3c 1b 10 5d e4 8e\ +34 ac e9 c9 12 4e 59 59 7a c7 eb f8 +Salt: \ +02 1f dc c6 eb b5 e1 9b 1c b1 6e 9c 67 f2 76 81\ +65 7f e2 0a +Signature: \ +1e 24 e6 e5 86 28 e5 17 50 44 a9 eb 6d 83 7d 48\ +af 12 60 b0 52 0e 87 32 7d e7 89 7e e4 d5 b9 f0\ +df 0b e3 e0 9e d4 de a8 c1 45 4f f3 42 3b b0 8e\ +17 93 24 5a 9d f8 bf 6a b3 96 8c 8e dd c3 b5 32\ +85 71 c7 7f 09 1c c5 78 57 69 12 df eb d1 64 b9\ +de 54 54 fe 0b e1 c1 f6 38 5b 32 83 60 ce 67 ec\ +7a 05 f6 e3 0e b4 5c 17 c4 8a c7 00 41 d2 ca b6\ +7f 0a 2a e7 aa fd cc 8d 24 5e a3 44 2a 63 00 cc\ +c7 +Test: Verify +Comment: RSASSA-PSS Signature Example 8.5 +Message: \ +04 dc 25 1b e7 2e 88 e5 72 34 85 b6 38 3a 63 7e\ +2f ef e0 76 60 c5 19 a5 60 b8 bc 18 bd ed b8 6e\ +ae 23 64 ea 53 ba 9d ca 6e b3 d2 e7 d6 b8 06 af\ +42 b3 e8 7f 29 1b 4a 88 81 d5 bf 57 2c c9 a8 5e\ +19 c8 6a cb 28 f0 98 f9 da 03 83 c5 66 d3 c0 f5\ +8c fd 8f 39 5d cf 60 2e 5c d4 0e 8c 71 83 f7 14\ +99 6e 22 97 ef +Salt: \ +c5 58 d7 16 7c bb 45 08 ad a0 42 97 1e 71 b1 37\ +7e ea 42 69 +Signature: \ +33 34 1b a3 57 6a 13 0a 50 e2 a5 cf 86 79 22 43\ +88 d5 69 3f 5a cc c2 35 ac 95 ad d6 8e 5e b1 ee\ +c3 16 66 d0 ca 7a 1c da 6f 70 a1 aa 76 2c 05 75\ +2a 51 95 0c db 8a f3 c5 37 9f 18 cf e6 b5 bc 55\ +a4 64 82 26 a1 5e 91 2e f1 9a d7 7a de ea 91 1d\ +67 cf ef d6 9b a4 3f a4 11 91 35 ff 64 21 17 ba\ +98 5a 7e 01 00 32 5e 95 19 f1 ca 6a 92 16 bd a0\ +55 b5 78 50 15 29 11 25 e9 0d cd 07 a2 ca 96 73\ +ee +Test: Verify +Comment: RSASSA-PSS Signature Example 8.6 +Message: \ +0e a3 7d f9 a6 fe a4 a8 b6 10 37 3c 24 cf 39 0c\ +20 fa 6e 21 35 c4 00 c8 a3 4f 5c 18 3a 7e 8e a4\ +c9 ae 09 0e d3 17 59 f4 2d c7 77 19 cc a4 00 ec\ +dc c5 17 ac fc 7a c6 90 26 75 b2 ef 30 c5 09 66\ +5f 33 21 48 2f c6 9a 9f b5 70 d1 5e 01 c8 45 d0\ +d8 e5 0d 2a 24 cb f1 cf 0e 71 49 75 a5 db 7b 18\ +d9 e9 e9 cb 91 b5 cb 16 86 90 60 ed 18 b7 b5 62\ +45 50 3f 0c af 90 35 2b 8d e8 1c b5 a1 d9 c6 33\ +60 92 f0 cd +Salt: \ +76 fd 4e 64 fd c9 8e b9 27 a0 40 3e 35 a0 84 e7\ +6b a9 f9 2a +Signature: \ +1e d1 d8 48 fb 1e db 44 12 9b d9 b3 54 79 5a f9\ +7a 06 9a 7a 00 d0 15 10 48 59 3e 0c 72 c3 51 7f\ +f9 ff 2a 41 d0 cb 5a 0a c8 60 d7 36 a1 99 70 4f\ +7c b6 a5 39 86 a8 8b bd 8a bc c0 07 6a 2c e8 47\ +88 00 31 52 5d 44 9d a2 ac 78 35 63 74 c5 36 e3\ +43 fa a7 cb a4 2a 5a aa 65 06 08 77 91 c0 6a 8e\ +98 93 35 ae d1 9b fa b2 d5 e6 7e 27 fb 0c 28 75\ +af 89 6c 21 b6 e8 e7 30 9d 04 e4 f6 72 7e 69 46\ +3e +Test: Verify +Comment: Example 9: A 1536-bit RSA Key Pair +Modulus: \ +e6 bd 69 2a c9 66 45 79 04 03 fd d0 f5 be b8 b9\ +bf 92 ed 10 00 7f c3 65 04 64 19 dd 06 c0 5c 5b\ +5b 2f 48 ec f9 89 e4 ce 26 91 09 97 9c bb 40 b4\ +a0 ad 24 d2 24 83 d1 ee 31 5a d4 cc b1 53 42 68\ +35 26 91 c5 24 f6 dd 8e 6c 29 d2 24 cf 24 69 73\ +ae c8 6c 5b f6 b1 40 1a 85 0d 1b 9a d1 bb 8c bc\ +ec 47 b0 6f 0f 8c 7f 45 d3 fc 8f 31 92 99 c5 43\ +3d db c2 b3 05 3b 47 de d2 ec d4 a4 ca ef d6 14\ +83 3d c8 bb 62 2f 31 7e d0 76 b8 05 7f e8 de 3f\ +84 48 0a d5 e8 3e 4a 61 90 4a 4f 24 8f b3 97 02\ +73 57 e1 d3 0e 46 31 39 81 5c 6f d4 fd 5a c5 b8\ +17 2a 45 23 0e cb 63 18 a0 4f 14 55 d8 4e 5a 8b +PublicExponent: \ +01 00 01 +PrivateExponent: \ +6a 7f d8 4f b8 5f ad 07 3b 34 40 6d b7 4f 8d 61\ +a6 ab c1 21 96 a9 61 dd 79 56 5e 9d a6 e5 18 7b\ +ce 2d 98 02 50 f7 35 95 75 35 92 70 d9 15 90 bb\ +0e 42 7c 71 46 0b 55 d5 14 10 b1 91 bc f3 09 fe\ +a1 31 a9 2c 8e 70 27 38 fa 71 9f 1e 00 41 f5 2e\ +40 e9 1f 22 9f 4d 96 a1 e6 f1 72 e1 55 96 b4 51\ +0a 6d ae c2 61 05 f2 be bc 53 31 6b 87 bd f2 13\ +11 66 60 70 e8 df ee 69 d5 2c 71 a9 76 ca ae 79\ +c7 2b 68 d2 85 80 dc 68 6d 9f 51 29 d2 25 f8 2b\ +3d 61 55 13 a8 82 b3 db 91 41 6b 48 ce 08 88 82\ +13 e3 7e eb 9a f8 00 d8 1c ab 32 8c e4 20 68 99\ +03 c0 0c 7b 5f d3 1b 75 50 3a 6d 41 96 84 d6 29 +Prime1: \ +f8 eb 97 e9 8d f1 26 64 ee fd b7 61 59 6a 69 dd\ +cd 0e 76 da ec e6 ed 4b f5 a1 b5 0a c0 86 f7 92\ +8a 4d 2f 87 26 a7 7e 51 5b 74 da 41 98 8f 22 0b\ +1c c8 7a a1 fc 81 0c e9 9a 82 f2 d1 ce 82 1e dc\ +ed 79 4c 69 41 f4 2c 7a 1a 0b 8c 4d 28 c7 5e c6\ +0b 65 22 79 f6 15 4a 76 2a ed 16 5d 47 de e3 67 +Prime2: \ +ed 4d 71 d0 a6 e2 4b 93 c2 e5 f6 b4 bb e0 5f 5f\ +b0 af a0 42 d2 04 fe 33 78 d3 65 c2 f2 88 b6 a8\ +da d7 ef e4 5d 15 3e ef 40 ca cc 7b 81 ff 93 40\ +02 d1 08 99 4b 94 a5 e4 72 8c d9 c9 63 37 5a e4\ +99 65 bd a5 5c bf 0e fe d8 d6 55 3b 40 27 f2 d8\ +62 08 a6 e6 b4 89 c1 76 12 80 92 d6 29 e4 9d 3d +ModPrime1PrivateExponent: \ +2b b6 8b dd fb 0c 4f 56 c8 55 8b ff af 89 2d 80\ +43 03 78 41 e7 fa 81 cf a6 1a 38 c5 e3 9b 90 1c\ +8e e7 11 22 a5 da 22 27 bd 6c de eb 48 14 52 c1\ +2a d3 d6 1d 5e 4f 77 6a 0a b5 56 59 1b ef e3 e5\ +9e 5a 7f dd b8 34 5e 1f 2f 35 b9 f4 ce e5 7c 32\ +41 4c 08 6a ec 99 3e 93 53 e4 80 d9 ee c6 28 9f +ModPrime2PrivateExponent: \ +4f f8 97 70 9f ad 07 97 46 49 45 78 e7 0f d8 54\ +61 30 ee ab 56 27 c4 9b 08 0f 05 ee 4a d9 f3 e4\ +b7 cb a9 d6 a5 df f1 13 a4 1c 34 09 33 68 33 f1\ +90 81 6d 8a 6b c4 2e 9b ec 56 b7 56 7d 0f 3c 9c\ +69 6d b6 19 b2 45 d9 01 dd 85 6d b7 c8 09 2e 77\ +e9 a1 cc cd 56 ee 4d ba 42 c5 fd b6 1a ec 26 69 +MultiplicativeInverseOfPrime2ModPrime1: \ +77 b9 d1 13 7b 50 40 4a 98 27 29 31 6e fa fc 7d\ +fe 66 d3 4e 5a 18 26 00 d5 f3 0a 0a 85 12 05 1c\ +56 0d 08 1d 4d 0a 18 35 ec 3d 25 a6 0f 4e 4d 6a\ +a9 48 b2 bf 3d bb 5b 12 4c bb c3 48 92 55 a3 a9\ +48 37 2f 69 78 49 67 45 f9 43 e1 db 4f 18 38 2c\ +ea a5 05 df c6 57 57 bb 3f 85 7a 58 dc e5 21 56 +Test: KeyPairValidAndConsistent +Comment: RSASSA-PSS Signature Example 9.1 +Message: \ +a8 8e 26 58 55 e9 d7 ca 36 c6 87 95 f0 b3 1b 59\ +1c d6 58 7c 71 d0 60 a0 b3 f7 f3 ea ef 43 79 59\ +22 02 8b c2 b6 ad 46 7c fc 2d 7f 65 9c 53 85 aa\ +70 ba 36 72 cd de 4c fe 49 70 cc 79 04 60 1b 27\ +88 72 bf 51 32 1c 4a 97 2f 3c 95 57 0f 34 45 d4\ +f5 79 80 e0 f2 0d f5 48 46 e6 a5 2c 66 8f 12 88\ +c0 3f 95 00 6e a3 2f 56 2d 40 d5 2a f9 fe b3 2f\ +0f a0 6d b6 5b 58 8a 23 7b 34 e5 92 d5 5c f9 79\ +f9 03 a6 42 ef 64 d2 ed 54 2a a8 c7 7d c1 dd 76\ +2f 45 a5 93 03 ed 75 e5 41 ca 27 1e 2b 60 ca 70\ +9e 44 fa 06 61 13 1e 8d 5d 41 63 fd 8d 39 85 66\ +ce 26 de 87 30 e7 2f 9c ca 73 76 41 c2 44 15 94\ +20 63 70 28 df 0a 18 07 9d 62 08 ea 8b 47 11 a2\ +c7 50 f5 +Salt: \ +c0 a4 25 31 3d f8 d7 56 4b d2 43 4d 31 15 23 d5\ +25 7e ed 80 +Signature: \ +58 61 07 22 6c 3c e0 13 a7 c8 f0 4d 1a 6a 29 59\ +bb 4b 8e 20 5b a4 3a 27 b5 0f 12 41 11 bc 35 ef\ +58 9b 03 9f 59 32 18 7c b6 96 d7 d9 a3 2c 0c 38\ +30 0a 5c dd a4 83 4b 62 d2 eb 24 0a f3 3f 79 d1\ +3d fb f0 95 bf 59 9e 0d 96 86 94 8c 19 64 74 7b\ +67 e8 9c 9a ba 5c d8 50 16 23 6f 56 6c c5 80 2c\ +b1 3e ad 51 bc 7c a6 be f3 b9 4d cb db b1 d5 70\ +46 97 71 df 0e 00 b1 a8 a0 67 77 47 2d 23 16 27\ +9e da e8 64 74 66 8d 4e 1e ff f9 5f 1d e6 1c 60\ +20 da 32 ae 92 bb f1 65 20 fe f3 cf 4d 88 f6 11\ +21 f2 4b bd 9f e9 1b 59 ca f1 23 5b 2a 93 ff 81\ +fc 40 3a dd f4 eb de a8 49 34 a9 cd af 8e 1a 9e +Test: Verify +Comment: RSASSA-PSS Signature Example 9.2 +Message: \ +c8 c9 c6 af 04 ac da 41 4d 22 7e f2 3e 08 20 c3\ +73 2c 50 0d c8 72 75 e9 5b 0d 09 54 13 99 3c 26\ +58 bc 1d 98 85 81 ba 87 9c 2d 20 1f 14 cb 88 ce\ +d1 53 a0 19 69 a7 bf 0a 7b e7 9c 84 c1 48 6b c1\ +2b 3f a6 c5 98 71 b6 82 7c 8c e2 53 ca 5f ef a8\ +a8 c6 90 bf 32 6e 8e 37 cd b9 6d 90 a8 2e ba b6\ +9f 86 35 0e 18 22 e8 bd 53 6a 2e +Salt: \ +b3 07 c4 3b 48 50 a8 da c2 f1 5f 32 e3 78 39 ef\ +8c 5c 0e 91 +Signature: \ +80 b6 d6 43 25 52 09 f0 a4 56 76 38 97 ac 9e d2\ +59 d4 59 b4 9c 28 87 e5 88 2e cb 44 34 cf d6 6d\ +d7 e1 69 93 75 38 1e 51 cd 7f 55 4f 2c 27 17 04\ +b3 99 d4 2b 4b e2 54 0a 0e ca 61 95 1f 55 26 7f\ +7c 28 78 c1 22 84 2d ad b2 8b 01 bd 5f 8c 02 5f\ +7e 22 84 18 a6 73 c0 3d 6b c0 c7 36 d0 a2 95 46\ +bd 67 f7 86 d9 d6 92 cc ea 77 8d 71 d9 8c 20 63\ +b7 a7 10 92 18 7a 4d 35 af 10 81 11 d8 3e 83 ea\ +e4 6c 46 aa 34 27 7e 06 04 45 89 90 37 88 f1 d5\ +e7 ce e2 5f b4 85 e9 29 49 11 88 14 d6 f2 c3 ee\ +36 14 89 01 6f 32 7f b5 bc 51 7e b5 04 70 bf fa\ +1a fa 5f 4c e9 aa 0c e5 b8 ee 19 bf 55 01 b9 58 +Test: Verify +Comment: RSASSA-PSS Signature Example 9.3 +Message: \ +0a fa d4 2c cd 4f c6 06 54 a5 50 02 d2 28 f5 2a\ +4a 5f e0 3b 8b bb 08 ca 82 da ca 55 8b 44 db e1\ +26 6e 50 c0 e7 45 a3 6d 9d 29 04 e3 40 8a bc d1\ +fd 56 99 94 06 3f 4a 75 cc 72 f2 fe e2 a0 cd 89\ +3a 43 af 1c 5b 8b 48 7d f0 a7 16 10 02 4e 4f 6d\ +df 9f 28 ad 08 13 c1 aa b9 1b cb 3c 90 64 d5 ff\ +74 2d ef fe a6 57 09 41 39 36 9e 5e a6 f4 a9 63\ +19 a5 cc 82 24 14 5b 54 50 62 75 8f ef d1 fe 34\ +09 ae 16 92 59 c6 cd fd 6b 5f 29 58 e3 14 fa ec\ +be 69 d2 ca ce 58 ee 55 17 9a b9 b3 e6 d1 ec c1\ +4a 55 7c 5f eb e9 88 59 52 64 fc 5d a1 c5 71 46\ +2e ca 79 8a 18 a1 a4 94 0c da b4 a3 e9 20 09 cc\ +d4 2e 1e 94 7b 13 14 e3 22 38 a2 de ce 7d 23 a8\ +9b 5b 30 c7 51 fd 0a 4a 43 0d 2c 54 85 94 +Salt: \ +9a 2b 00 7e 80 97 8b bb 19 2c 35 4e b7 da 9a ed\ +fc 74 db f5 +Signature: \ +48 44 08 f3 89 8c d5 f5 34 83 f8 08 19 ef bf 27\ +08 c3 4d 27 a8 b2 a6 fa e8 b3 22 f9 24 02 37 f9\ +81 81 7a ca 18 46 f1 08 4d aa 6d 7c 07 95 f6 e5\ +bf 1a f5 9c 38 e1 85 84 37 ce 1f 7e c4 19 b9 8c\ +87 36 ad f6 dd 9a 00 b1 80 6d 2b d3 ad 0a 73 77\ +5e 05 f5 2d fe f3 a5 9a b4 b0 81 43 f0 df 05 cd\ +1a d9 d0 4b ec ec a6 da a4 a2 12 98 03 e2 00 cb\ +c7 77 87 ca f4 c1 d0 66 3a 6c 59 87 b6 05 95 20\ +19 78 2c af 2e c1 42 6d 68 fb 94 ed 1d 4b e8 16\ +a7 ed 08 1b 77 e6 ab 33 0b 3f fc 07 38 20 fe cd\ +e3 72 7f cb e2 95 ee 61 a0 50 a3 43 65 86 37 c3\ +fd 65 9c fb 63 73 6d e3 2d 9f 90 d3 c2 f6 3e ca +Test: Verify +Comment: RSASSA-PSS Signature Example 9.4 +Message: \ +1d fd 43 b4 6c 93 db 82 62 9b da e2 bd 0a 12 b8\ +82 ea 04 c3 b4 65 f5 cf 93 02 3f 01 05 96 26 db\ +be 99 f2 6b b1 be 94 9d dd d1 6d c7 f3 de bb 19\ +a1 94 62 7f 0b 22 44 34 df 7d 87 00 e9 e9 8b 06\ +e3 60 c1 2f db e3 d1 9f 51 c9 68 4e b9 08 9e cb\ +b0 a2 f0 45 03 99 d3 f5 9e ac 72 94 08 5d 04 4f\ +53 93 c6 ce 73 74 23 d8 b8 6c 41 53 70 d3 89 e3\ +0b 9f 0a 3c 02 d2 5d 00 82 e8 ad 6f 3f 1e f2 4a\ +45 c3 cf 82 b3 83 36 70 63 a4 d4 61 3e 42 64 f0\ +1b 2d ac 2e 5a a4 20 43 f8 fb 5f 69 fa 87 1d 14\ +fb 27 3e 76 7a 53 1c 40 f0 2f 34 3b c2 fb 45 a0\ +c7 e0 f6 be 25 61 92 3a 77 21 1d 66 a6 e2 db b4\ +3c 36 63 50 be ae 22 da 3a c2 c1 f5 07 70 96 fc\ +b5 c4 bf 25 5f 75 74 35 1a e0 b1 e1 f0 36 32 81\ +7c 08 56 d4 a8 ba 97 af bd c8 b8 58 55 40 2b c5\ +69 26 fc ec 20 9f 9e a8 +Salt: \ +70 f3 82 bd df 4d 5d 2d d8 8b 3b c7 b7 30 8b e6\ +32 b8 40 45 +Signature: \ +84 eb eb 48 1b e5 98 45 b4 64 68 ba fb 47 1c 01\ +12 e0 2b 23 5d 84 b5 d9 11 cb d1 92 6e e5 07 4a\ +e0 42 44 95 cb 20 e8 23 08 b8 eb b6 5f 41 9a 03\ +fb 40 e7 2b 78 98 1d 88 aa d1 43 05 36 85 17 2c\ +97 b2 9c 8b 7b f0 ae 73 b5 b2 26 3c 40 3d a0 ed\ +2f 80 ff 74 50 af 78 28 eb 8b 86 f0 02 8b d2 a8\ +b1 76 a4 d2 28 cc ce a1 83 94 f2 38 b0 9f f7 58\ +cc 00 bc 04 30 11 52 35 57 42 f2 82 b5 4e 66 3a\ +91 9e 70 9d 8d a2 4a de 55 00 a7 b9 aa 50 22 6e\ +0c a5 29 23 e6 c2 d8 60 ec 50 ff 48 0f a5 74 77\ +e8 2b 05 65 f4 37 9f 79 c7 72 d5 c2 da 80 af 9f\ +bf 32 5e ce 6f c2 0b 00 96 16 14 be e8 9a 18 3e +Test: Verify +Comment: RSASSA-PSS Signature Example 9.5 +Message: \ +1b dc 6e 7c 98 fb 8c f5 4e 9b 09 7b 66 a8 31 e9\ +cf e5 2d 9d 48 88 44 8e e4 b0 97 80 93 ba 1d 7d\ +73 ae 78 b3 a6 2b a4 ad 95 cd 28 9c cb 9e 00 52\ +26 bb 3d 17 8b cc aa 82 1f b0 44 a4 e2 1e e9 76\ +96 c1 4d 06 78 c9 4c 2d ae 93 b0 ad 73 92 22 18\ +55 3d aa 7e 44 eb e5 77 25 a7 a4 5c c7 2b 9b 21\ +38 a6 b1 7c 8d b4 11 ce 82 79 ee 12 41 af f0 a8\ +be c6 f7 7f 87 ed b0 c6 9c b2 72 36 e3 43 5a 80\ +0b 19 2e 4f 11 e5 19 e3 fe 30 fc 30 ea cc ca 4f\ +bb 41 76 90 29 bf 70 8e 81 7a 9e 68 38 05 be 67\ +fa 10 09 84 68 3b 74 83 8e 3b cf fa 79 36 6e ed\ +1d 48 1c 76 72 91 18 83 8f 31 ba 8a 04 8a 93 c1\ +be 44 24 59 8e 8d f6 32 8b 7a 77 88 0a 3f 9c 7e\ +2e 8d fc a8 eb 5a 26 fb 86 bd c5 56 d4 2b be 01\ +d9 fa 6e d8 06 46 49 1c 93 41 +Salt: \ +d6 89 25 7a 86 ef fa 68 21 2c 5e 0c 61 9e ca 29\ +5f b9 1b 67 +Signature: \ +82 10 2d f8 cb 91 e7 17 99 19 a0 4d 26 d3 35 d6\ +4f bc 2f 87 2c 44 83 39 43 24 1d e8 45 48 10 27\ +4c df 3d b5 f4 2d 42 3d b1 52 af 71 35 f7 01 42\ +0e 39 b4 94 a6 7c bf d1 9f 91 19 da 23 3a 23 da\ +5c 64 39 b5 ba 0d 2b c3 73 ee e3 50 70 01 37 8d\ +4a 40 73 85 6b 7f e2 ab a0 b5 ee 93 b2 7f 4a fe\ +c7 d4 d1 20 92 1c 83 f6 06 76 5b 02 c1 9e 4d 6a\ +1a 3b 95 fa 4c 42 29 51 be 4f 52 13 10 77 ef 17\ +17 97 29 cd df bd b5 69 50 db ac ee fe 78 cb 16\ +64 0a 09 9e a5 6d 24 38 9e ef 10 f8 fe cb 31 ba\ +3e a3 b2 27 c0 a8 66 98 bb 89 e3 e9 36 39 05 bf\ +22 77 7b 2a 3a a5 21 b6 5b 4c ef 76 d8 3b de 4c +Test: Verify +Comment: RSASSA-PSS Signature Example 9.6 +Message: \ +88 c7 a9 f1 36 04 01 d9 0e 53 b1 01 b6 1c 53 25\ +c3 c7 5d b1 b4 11 fb eb 8e 83 0b 75 e9 6b 56 67\ +0a d2 45 40 4e 16 79 35 44 ee 35 4b c6 13 a9 0c\ +c9 84 87 15 a7 3d b5 89 3e 7f 6d 27 98 15 c0 c1\ +de 83 ef 8e 29 56 e3 a5 6e d2 6a 88 8d 7a 9c dc\ +d0 42 f4 b1 6b 7f a5 1e f1 a0 57 36 62 d1 6a 30\ +2d 0e c5 b2 85 d2 e0 3a d9 65 29 c8 7b 3d 37 4d\ +b3 72 d9 5b 24 43 d0 61 b6 b1 a3 50 ba 87 80 7e\ +d0 83 af d1 eb 05 c3 f5 2f 4e ba 5e d2 22 77 14\ +fd b5 0b 9d 9d 9d d6 81 4f 62 f6 27 2f cd 5c db\ +ce 7a 9e f7 97 +Salt: \ +c2 5f 13 bf 67 d0 81 67 1a 04 81 a1 f1 82 0d 61\ +3b ba 22 76 +Signature: \ +a7 fd b0 d2 59 16 5c a2 c8 8d 00 bb f1 02 8a 86\ +7d 33 76 99 d0 61 19 3b 17 a9 64 8e 14 cc bb aa\ +de ac aa cd ec 81 5e 75 71 29 4e bb 8a 11 7a f2\ +05 fa 07 8b 47 b0 71 2c 19 9e 3a d0 51 35 c5 04\ +c2 4b 81 70 51 15 74 08 02 48 79 92 ff d5 11 d4\ +af c6 b8 54 49 1e b3 f0 dd 52 31 39 54 2f f1 5c\ +31 01 ee 85 54 35 17 c6 a3 c7 94 17 c6 7e 2d d9\ +aa 74 1e 9a 29 b0 6d cb 59 3c 23 36 b3 67 0a e3\ +af ba c7 c3 e7 6e 21 54 73 e8 66 e3 38 ca 24 4d\ +e0 0b 62 62 4d 6b 94 26 82 2c ea e9 f8 cc 46 08\ +95 f4 12 50 07 3f d4 5c 5a 1e 7b 42 5c 20 4a 42\ +3a 69 91 59 f6 90 3e 71 0b 37 a7 bb 2b c8 04 9f +Test: Verify +Comment: Example 10: A 2048-bit RSA Key Pair +Modulus: \ +a5 dd 86 7a c4 cb 02 f9 0b 94 57 d4 8c 14 a7 70\ +ef 99 1c 56 c3 9c 0e c6 5f d1 1a fa 89 37 ce a5\ +7b 9b e7 ac 73 b4 5c 00 17 61 5b 82 d6 22 e3 18\ +75 3b 60 27 c0 fd 15 7b e1 2f 80 90 fe e2 a7 ad\ +cd 0e ef 75 9f 88 ba 49 97 c7 a4 2d 58 c9 aa 12\ +cb 99 ae 00 1f e5 21 c1 3b b5 43 14 45 a8 d5 ae\ +4f 5e 4c 7e 94 8a c2 27 d3 60 40 71 f2 0e 57 7e\ +90 5f be b1 5d fa f0 6d 1d e5 ae 62 53 d6 3a 6a\ +21 20 b3 1a 5d a5 da bc 95 50 60 0e 20 f2 7d 37\ +39 e2 62 79 25 fe a3 cc 50 9f 21 df f0 4e 6e ea\ +45 49 c5 40 d6 80 9f f9 30 7e ed e9 1f ff 58 73\ +3d 83 85 a2 37 d6 d3 70 5a 33 e3 91 90 09 92 07\ +0d f7 ad f1 35 7c f7 e3 70 0c e3 66 7d e8 3f 17\ +b8 df 17 78 db 38 1d ce 09 cb 4a d0 58 a5 11 00\ +1a 73 81 98 ee 27 cf 55 a1 3b 75 45 39 90 65 82\ +ec 8b 17 4b d5 8d 5d 1f 3d 76 7c 61 37 21 ae 05 +PublicExponent: \ +01 00 01 +PrivateExponent: \ +2d 2f f5 67 b3 fe 74 e0 61 91 b7 fd ed 6d e1 12\ +29 0c 67 06 92 43 0d 59 69 18 40 47 da 23 4c 96\ +93 de ed 16 73 ed 42 95 39 c9 69 d3 72 c0 4d 6b\ +47 e0 f5 b8 ce e0 84 3e 5c 22 83 5d bd 3b 05 a0\ +99 79 84 ae 60 58 b1 1b c4 90 7c bf 67 ed 84 fa\ +9a e2 52 df b0 d0 cd 49 e6 18 e3 5d fd fe 59 bc\ +a3 dd d6 6c 33 ce bb c7 7a d4 41 aa 69 5e 13 e3\ +24 b5 18 f0 1c 60 f5 a8 5c 99 4a d1 79 f2 a6 b5\ +fb e9 34 02 b1 17 67 be 01 bf 07 34 44 d6 ba 1d\ +d2 bc a5 bd 07 4d 4a 5f ae 35 31 ad 13 03 d8 4b\ +30 d8 97 31 8c bb ba 04 e0 3c 2e 66 de 6d 91 f8\ +2f 96 ea 1d 4b b5 4a 5a ae 10 2d 59 46 57 f5 c9\ +78 95 53 51 2b 29 6d ea 29 d8 02 31 96 35 7e 3e\ +3a 6e 95 8f 39 e3 c2 34 40 38 ea 60 4b 31 ed c6\ +f0 f7 ff 6e 71 81 a5 7c 92 82 6a 26 8f 86 76 8e\ +96 f8 78 56 2f c7 1d 85 d6 9e 44 86 12 f7 04 8f +Prime1: \ +cf d5 02 83 fe ee b9 7f 6f 08 d7 3c bc 7b 38 36\ +f8 2b bc d4 99 47 9f 5e 6f 76 fd fc b8 b3 8c 4f\ +71 dc 9e 88 bd 6a 6f 76 37 1a fd 65 d2 af 18 62\ +b3 2a fb 34 a9 5f 71 b8 b1 32 04 3f fe be 3a 95\ +2b af 75 92 44 81 48 c0 3f 9c 69 b1 d6 8e 4c e5\ +cf 32 c8 6b af 46 fe d3 01 ca 1a b4 03 06 9b 32\ +f4 56 b9 1f 71 89 8a b0 81 cd 8c 42 52 ef 52 71\ +91 5c 97 94 b8 f2 95 85 1d a7 51 0f 99 cb 73 eb +Prime2: \ +cc 4e 90 d2 a1 b3 a0 65 d3 b2 d1 f5 a8 fc e3 1b\ +54 44 75 66 4e ab 56 1d 29 71 b9 9f b7 be f8 44\ +e8 ec 1f 36 0b 8c 2a c8 35 96 92 97 1e a6 a3 8f\ +72 3f cc 21 1f 5d bc b1 77 a0 fd ac 51 64 a1 d4\ +ff 7f bb 4e 82 99 86 35 3c b9 83 65 9a 14 8c dd\ +42 0c 7d 31 ba 38 22 ea 90 a3 2b e4 6c 03 0e 8c\ +17 e1 fa 0a d3 78 59 e0 6b 0a a6 fa 3b 21 6d 9c\ +be 6c 0e 22 33 97 69 c0 a6 15 91 3e 5d a7 19 cf +ModPrime1PrivateExponent: \ +1c 2d 1f c3 2f 6b c4 00 4f d8 5d fd e0 fb bf 9a\ +4c 38 f9 c7 c4 e4 1d ea 1a a8 82 34 a2 01 cd 92\ +f3 b7 da 52 65 83 a9 8a d8 5b b3 60 fb 98 3b 71\ +1e 23 44 9d 56 1d 17 78 d7 a5 15 48 6b cb f4 7b\ +46 c9 e9 e1 a3 a1 f7 70 00 ef be b0 9a 8a fe 47\ +e5 b8 57 cd a9 9c b1 6d 7f ff 9b 71 2e 3b d6 0c\ +a9 6d 9c 79 73 d6 16 d4 69 34 a9 c0 50 28 1c 00\ +43 99 ce ff 1d b7 dd a7 87 66 a8 a9 b9 cb 08 73 +ModPrime2PrivateExponent: \ +cb 3b 3c 04 ca a5 8c 60 be 7d 9b 2d eb b3 e3 96\ +43 f4 f5 73 97 be 08 23 6a 1e 9e af aa 70 65 36\ +e7 1c 3a cf e0 1c c6 51 f2 3c 9e 05 85 8f ee 13\ +bb 6a 8a fc 47 df 4e dc 9a 4b a3 0b ce cb 73 d0\ +15 78 52 32 7e e7 89 01 5c 2e 8d ee 7b 9f 05 a0\ +f3 1a c9 4e b6 17 31 64 74 0c 5c 95 14 7c d5 f3\ +b5 ae 2c b4 a8 37 87 f0 1d 8a b3 1f 27 c2 d0 ee\ +a2 dd 8a 11 ab 90 6a ba 20 7c 43 c6 ee 12 53 31 +MultiplicativeInverseOfPrime2ModPrime1: \ +12 f6 b2 cf 13 74 a7 36 fa d0 56 16 05 0f 96 ab\ +4b 61 d1 17 7c 7f 9d 52 5a 29 f3 d1 80 e7 76 67\ +e9 9d 99 ab f0 52 5d 07 58 66 0f 37 52 65 5b 0f\ +25 b8 df 84 31 d9 a8 ff 77 c1 6c 12 a0 a5 12 2a\ +9f 0b f7 cf d5 a2 66 a3 5c 15 9f 99 12 08 b9 03\ +16 ff 44 4f 3e 0b 6b d0 e9 3b 8a 7a 24 48 e9 57\ +e3 dd a6 cf cf 22 66 b1 06 01 3a c4 68 08 d3 b3\ +88 7b 3b 00 34 4b aa c9 53 0b 4c e7 08 fc 32 b6 +Test: KeyPairValidAndConsistent +Comment: RSASSA-PSS Signature Example 10.1 +Message: \ +88 31 77 e5 12 6b 9b e2 d9 a9 68 03 27 d5 37 0c\ +6f 26 86 1f 58 20 c4 3d a6 7a 3a d6 09 +Salt: \ +04 e2 15 ee 6f f9 34 b9 da 70 d7 73 0c 87 34 ab\ +fc ec de 89 +Signature: \ +82 c2 b1 60 09 3b 8a a3 c0 f7 52 2b 19 f8 73 54\ +06 6c 77 84 7a bf 2a 9f ce 54 2d 0e 84 e9 20 c5\ +af b4 9f fd fd ac e1 65 60 ee 94 a1 36 96 01 14\ +8e ba d7 a0 e1 51 cf 16 33 17 91 a5 72 7d 05 f2\ +1e 74 e7 eb 81 14 40 20 69 35 d7 44 76 5a 15 e7\ +9f 01 5c b6 6c 53 2c 87 a6 a0 59 61 c8 bf ad 74\ +1a 9a 66 57 02 28 94 39 3e 72 23 73 97 96 c0 2a\ +77 45 5d 0f 55 5b 0e c0 1d df 25 9b 62 07 fd 0f\ +d5 76 14 ce f1 a5 57 3b aa ff 4e c0 00 69 95 16\ +59 b8 5f 24 30 0a 25 16 0c a8 52 2d c6 e6 72 7e\ +57 d0 19 d7 e6 36 29 b8 fe 5e 89 e2 5c c1 5b eb\ +3a 64 75 77 55 92 99 28 0b 9b 28 f7 9b 04 09 00\ +0b e2 5b bd 96 40 8b a3 b4 3c c4 86 18 4d d1 c8\ +e6 25 53 fa 1a f4 04 0f 60 66 3d e7 f5 e4 9c 04\ +38 8e 25 7f 1c e8 9c 95 da b4 8a 31 5d 9b 66 b1\ +b7 62 82 33 87 6f f2 38 52 30 d0 70 d0 7e 16 66 +Comment: RSASSA-PSS Signature Example 10.2 +Message: \ +dd 67 0a 01 46 58 68 ad c9 3f 26 13 19 57 a5 0c\ +52 fb 77 7c db aa 30 89 2c 9e 12 36 11 64 ec 13\ +97 9d 43 04 81 18 e4 44 5d b8 7b ee 58 dd 98 7b\ +34 25 d0 20 71 d8 db ae 80 70 8b 03 9d bb 64 db\ +d1 de 56 57 d9 fe d0 c1 18 a5 41 43 74 2e 0f f3\ +c8 7f 74 e4 58 57 64 7a f3 f7 9e b0 a1 4c 9d 75\ +ea 9a 1a 04 b7 cf 47 8a 89 7a 70 8f d9 88 f4 8e\ +80 1e db 0b 70 39 df 8c 23 bb 3c 56 f4 e8 21 ac +Salt: \ +8b 2b dd 4b 40 fa f5 45 c7 78 dd f9 bc 1a 49 cb\ +57 f9 b7 1b +Signature: \ +14 ae 35 d9 dd 06 ba 92 f7 f3 b8 97 97 8a ed 7c\ +d4 bf 5f f0 b5 85 a4 0b d4 6c e1 b4 2c d2 70 30\ +53 bb 90 44 d6 4e 81 3d 8f 96 db 2d d7 00 7d 10\ +11 8f 6f 8f 84 96 09 7a d7 5e 1f f6 92 34 1b 28\ +92 ad 55 a6 33 a1 c5 5e 7f 0a 0a d5 9a 0e 20 3a\ +5b 82 78 ae c5 4d d8 62 2e 28 31 d8 71 74 f8 ca\ +ff 43 ee 6c 46 44 53 45 d8 4a 59 65 9b fb 92 ec\ +d4 c8 18 66 86 95 f3 47 06 f6 68 28 a8 99 59 63\ +7f 2b f3 e3 25 1c 24 bd ba 4d 4b 76 49 da 00 22\ +21 8b 11 9c 84 e7 9a 65 27 ec 5b 8a 5f 86 1c 15\ +99 52 e2 3e c0 5e 1e 71 73 46 fa ef e8 b1 68 68\ +25 bd 2b 26 2f b2 53 10 66 c0 de 09 ac de 2e 42\ +31 69 07 28 b5 d8 5e 11 5a 2f 6b 92 b7 9c 25 ab\ +c9 bd 93 99 ff 8b cf 82 5a 52 ea 1f 56 ea 76 dd\ +26 f4 3b aa fa 18 bf a9 2a 50 4c bd 35 69 9e 26\ +d1 dc c5 a2 88 73 85 f3 c6 32 32 f0 6f 32 44 c3 +Comment: RSASSA-PSS Signature Example 10.3 +Message: \ +48 b2 b6 a5 7a 63 c8 4c ea 85 9d 65 c6 68 28 4b\ +08 d9 6b dc aa be 25 2d b0 e4 a9 6c b1 ba c6 01\ +93 41 db 6f be fb 8d 10 6b 0e 90 ed a6 bc c6 c6\ +26 2f 37 e7 ea 9c 7e 5d 22 6b d7 df 85 ec 5e 71\ +ef ff 2f 54 c5 db 57 7f f7 29 ff 91 b8 42 49 1d\ +e2 74 1d 0c 63 16 07 df 58 6b 90 5b 23 b9 1a f1\ +3d a1 23 04 bf 83 ec a8 a7 3e 87 1f f9 db +Salt: \ +4e 96 fc 1b 39 8f 92 b4 46 71 01 0c 0d c3 ef d6\ +e2 0c 2d 73 +Signature: \ +6e 3e 4d 7b 6b 15 d2 fb 46 01 3b 89 00 aa 5b bb\ +39 39 cf 2c 09 57 17 98 70 42 02 6e e6 2c 74 c5\ +4c ff d5 d7 d5 7e fb bf 95 0a 0f 5c 57 4f a0 9d\ +3f c1 c9 f5 13 b0 5b 4f f5 0d d8 df 7e df a2 01\ +02 85 4c 35 e5 92 18 01 19 a7 0c e5 b0 85 18 2a\ +a0 2d 9e a2 aa 90 d1 df 03 f2 da ae 88 5b a2 f5\ +d0 5a fd ac 97 47 6f 06 b9 3b 5b c9 4a 1a 80 aa\ +91 16 c4 d6 15 f3 33 b0 98 89 2b 25 ff ac e2 66\ +f5 db 5a 5a 3b cc 10 a8 24 ed 55 aa d3 5b 72 78\ +34 fb 8c 07 da 28 fc f4 16 a5 d9 b2 22 4f 1f 8b\ +44 2b 36 f9 1e 45 6f de a2 d7 cf e3 36 72 68 de\ +03 07 a4 c7 4e 92 41 59 ed 33 39 3d 5e 06 55 53\ +1c 77 32 7b 89 82 1b de df 88 01 61 c7 8c d4 19\ +6b 54 19 f7 ac c3 f1 3e 5e bf 16 1b 6e 7c 67 24\ +71 6c a3 3b 85 c2 e2 56 40 19 2a c2 85 96 51 d5\ +0b de 7e b9 76 e5 1c ec 82 8b 98 b6 56 3b 86 bb +Comment: RSASSA-PSS Signature Example 10.4 +Message: \ +0b 87 77 c7 f8 39 ba f0 a6 4b bb db c5 ce 79 75\ +5c 57 a2 05 b8 45 c1 74 e2 d2 e9 05 46 a0 89 c4\ +e6 ec 8a df fa 23 a7 ea 97 ba e6 b6 5d 78 2b 82\ +db 5d 2b 5a 56 d2 2a 29 a0 5e 7c 44 33 e2 b8 2a\ +62 1a bb a9 0a dd 05 ce 39 3f c4 8a 84 05 42 45\ +1a +Salt: \ +c7 cd 69 8d 84 b6 51 28 d8 83 5e 3a 8b 1e b0 e0\ +1c b5 41 ec +Signature: \ +34 04 7f f9 6c 4d c0 dc 90 b2 d4 ff 59 a1 a3 61\ +a4 75 4b 25 5d 2e e0 af 7d 8b f8 7c 9b c9 e7 dd\ +ee de 33 93 4c 63 ca 1c 0e 3d 26 2c b1 45 ef 93\ +2a 1f 2c 0a 99 7a a6 a3 4f 8e ae e7 47 7d 82 cc\ +f0 90 95 a6 b8 ac ad 38 d4 ee c9 fb 7e ab 7a d0\ +2d a1 d1 1d 8e 54 c1 82 5e 55 bf 58 c2 a2 32 34\ +b9 02 be 12 4f 9e 90 38 a8 f6 8f a4 5d ab 72 f6\ +6e 09 45 bf 1d 8b ac c9 04 4c 6f 07 09 8c 9f ce\ +c5 8a 3a ab 10 0c 80 51 78 15 5f 03 0a 12 4c 45\ +0e 5a cb da 47 d0 e4 f1 0b 80 a2 3f 80 3e 77 4d\ +02 3b 00 15 c2 0b 9f 9b be 7c 91 29 63 38 d5 ec\ +b4 71 ca fb 03 20 07 b6 7a 60 be 5f 69 50 4a 9f\ +01 ab b3 cb 46 7b 26 0e 2b ce 86 0b e8 d9 5b f9\ +2c 0c 8e 14 96 ed 1e 52 85 93 a4 ab b6 df 46 2d\ +de 8a 09 68 df fe 46 83 11 68 57 a2 32 f5 eb f6\ +c8 5b e2 38 74 5a d0 f3 8f 76 7a 5f db f4 86 fb +Comment: RSASSA-PSS Signature Example 10.5 +Message: \ +f1 03 6e 00 8e 71 e9 64 da dc 92 19 ed 30 e1 7f\ +06 b4 b6 8a 95 5c 16 b3 12 b1 ed df 02 8b 74 97\ +6b ed 6b 3f 6a 63 d4 e7 78 59 24 3c 9c cc dc 98\ +01 65 23 ab b0 24 83 b3 55 91 c3 3a ad 81 21 3b\ +b7 c7 bb 1a 47 0a ab c1 0d 44 25 6c 4d 45 59 d9\ +16 +Salt: \ +ef a8 bf f9 62 12 b2 f4 a3 f3 71 a1 0d 57 41 52\ +65 5f 5d fb +Signature: \ +7e 09 35 ea 18 f4 d6 c1 d1 7c e8 2e b2 b3 83 6c\ +55 b3 84 58 9c e1 9d fe 74 33 63 ac 99 48 d1 f3\ +46 b7 bf dd fe 92 ef d7 8a db 21 fa ef c8 9a de\ +42 b1 0f 37 40 03 fe 12 2e 67 42 9a 1c b8 cb d1\ +f8 d9 01 45 64 c4 4d 12 01 16 f4 99 0f 1a 6e 38\ +77 4c 19 4b d1 b8 21 32 86 b0 77 b0 49 9d 2e 7b\ +3f 43 4a b1 22 89 c5 56 68 4d ee d7 81 31 93 4b\ +b3 dd 65 37 23 6f 7c 6f 3d cb 09 d4 76 be 07 72\ +1e 37 e1 ce ed 9b 2f 7b 40 68 87 bd 53 15 73 05\ +e1 c8 b4 f8 4d 73 3b c1 e1 86 fe 06 cc 59 b6 ed\ +b8 f4 bd 7f fe fd f4 f7 ba 9c fb 9d 57 06 89 b5\ +a1 a4 10 9a 74 6a 69 08 93 db 37 99 25 5a 0c b9\ +21 5d 2d 1c d4 90 59 0e 95 2e 8c 87 86 aa 00 11\ +26 52 52 47 0c 04 1d fb c3 ee c7 c3 cb f7 1c 24\ +86 9d 11 5c 0c b4 a9 56 f5 6d 53 0b 80 ab 58 9a\ +cf ef c6 90 75 1d df 36 e8 d3 83 f8 3c ed d2 cc +Comment: RSASSA-PSS Signature Example 10.6 +Message: \ +25 f1 08 95 a8 77 16 c1 37 45 0b b9 51 9d fa a1\ +f2 07 fa a9 42 ea 88 ab f7 1e 9c 17 98 00 85 b5\ +55 ae ba b7 62 64 ae 2a 3a b9 3c 2d 12 98 11 91\ +dd ac 6f b5 94 9e b3 6a ee 3c 5d a9 40 f0 07 52\ +c9 16 d9 46 08 fa 7d 97 ba 6a 29 15 b6 88 f2 03\ +23 d4 e9 d9 68 01 d8 9a 72 ab 58 92 dc 21 17 c0\ +74 34 fc f9 72 e0 58 cf 8c 41 ca 4b 4f f5 54 f7\ +d5 06 8a d3 15 5f ce d0 f3 12 5b c0 4f 91 93 37\ +8a 8f 5c 4c 3b 8c b4 dd 6d 1c c6 9d 30 ec ca 6e\ +aa 51 e3 6a 05 73 0e 9e 34 2e 85 5b af 09 9d ef\ +b8 af d7 +Salt: \ +ad 8b 15 23 70 36 46 22 4b 66 0b 55 08 85 91 7c\ +a2 d1 df 28 +Signature: \ +6d 3b 5b 87 f6 7e a6 57 af 21 f7 54 41 97 7d 21\ +80 f9 1b 2c 5f 69 2d e8 29 55 69 6a 68 67 30 d9\ +b9 77 8d 97 07 58 cc b2 60 71 c2 20 9f fb d6 12\ +5b e2 e9 6e a8 1b 67 cb 9b 93 08 23 9f da 17 f7\ +b2 b6 4e cd a0 96 b6 b9 35 64 0a 5a 1c b4 2a 91\ +55 b1 c9 ef 7a 63 3a 02 c5 9f 0d 6e e5 9b 85 2c\ +43 b3 50 29 e7 3c 94 0f f0 41 0e 8f 11 4e ed 46\ +bb d0 fa e1 65 e4 2b e2 52 8a 40 1c 3b 28 fd 81\ +8e f3 23 2d ca 9f 4d 2a 0f 51 66 ec 59 c4 23 96\ +d6 c1 1d bc 12 15 a5 6f a1 71 69 db 95 75 34 3e\ +f3 4f 9d e3 2a 49 cd c3 17 49 22 f2 29 c2 3e 18\ +e4 5d f9 35 31 19 ec 43 19 ce dc e7 a1 7c 64 08\ +8c 1f 6f 52 be 29 63 41 00 b3 91 9d 38 f3 d1 ed\ +94 e6 89 1e 66 a7 3b 8f b8 49 f5 87 4d f5 94 59\ +e2 98 c7 bb ce 2e ee 78 2a 19 5a a6 6f e2 d0 73\ +2b 25 e5 95 f5 7d 3e 06 1b 1f c3 e4 06 3b f9 8f +Test: Verify diff --git a/cryptopp/TestVectors/rw.txt b/cryptopp/TestVectors/rw.txt new file mode 100644 index 0000000..2d932d0 --- /dev/null +++ b/cryptopp/TestVectors/rw.txt @@ -0,0 +1,166 @@ +AlgorithmType: Signature +Name: RW/EMSA2(SHA-1) +Source: generated by Wei Dai using Crypto++ 5.1 +Comment: 1024-bit RW key +KeyFormat: Component +Modulus: \ + e5eb47bc1f82db3001faaeabc5bbe71b7d307b431889ac10255262281ec5f5af\ + 8a790bd7bbec5efffa442cf2c3fd5ca4778763b9d15aeac0b9b71bdb13da8272\ + 7f4967ac685975f8ff05a763c864d100b7cc1142102aa2dd343ea1a0ab530255\ + 195c3a6400ecab7b27eff9b01ef6d37381fa6fb5401347f195354396772e8285 +Prime1: \ + ef86dd7af3f32cde8a9f6564e43a559a0c9f8bad36cc25330548b347ac158a34\ + 5631fa90f7b873c36effae2f7823227a3f580b5dd18304d5932751e743e9281b +Prime2: \ + f5bb4289c389d9019c36f96c6b81fffbf20be0620c6343e2b800aefb1b55a330\ + 8cc1402da7a2a558579a2a5146b30cb08e3f20b501081248f2f1de36cdfce9df +MultiplicativeInverseOfPrime2ModPrime1: \ + 88813a3d50b7c301948ee1985db19c9fd33a47c78c977024745e10483d9cc4f0\ + f573597ce564a91421d1d7457bc45a971f7d8b31403298da77799b57cf9a76de +PublicExponent: 02 +Test: KeyPairValidAndConsistent +Message: 2CA039854B55688740E3 +Signature: 1AF029CBEC9C692CE5096E73E4E9A52EC9A28D207A5511CCEC7681E5E3D867A4AE2E22DE4909D89196A272F1B50DE6FA3248BCA334D46E0D57171A790B6F4697E7BA7047DB79DECD47BD21995243DEBBF25915DDBC93C45875C14DE953792257C5C6825C905AFF40109C8CC7E793123D47AC1B5B6304A436CFA9BEEC8E0054E7 +Test: Verify +Message: 2A51DF4AF88613D91A37 +Signature: 6FF18F4471E1A8F850C910A181A9F28E69AACD8E8126969605E000A853197541AF9047E5D17315BF062B9CD8DF91196F0343285D9E31D5C72560C156782B6D0E5AF8F06D7DCDD8CABEC01B2438C168C40C21F6A8794648361BD2AEE13573A49ECA07A7EED97C0B9C5B1E508869E4CFD5FE1771924B1CF5A4BFF7D4379E5CD59F +Test: Verify +Message: 1CF8DDD95D780A89D7CF +Signature: 539C266B0313E0E256ED98EEF13E6AE64CED90C160A4999B3D47CBDA5285DAB0E0678C0E079CE9B8EB23E10EDFACFC19A80EEBB8F38ED5B5D6C8A988AB8CEC40A5A5BA102F75586167EAB6D5BF0CE8FF30C656895800F6F1B37D69FBBAF9055F7505DBEB537C0F986A1B5F0270DC12A640FFCB626F9763FDCFEFA1208C104003 +Test: Verify +Message: 2119A954F1AC0F3DCDB2 +Signature: 60C3CCF4F086B15B7F850B445F384333F7AE5A4B5EDE2820C7233239E1B86D6E4B4FCA4F50B087CE1DF17DA5D62672A17F2CF87A2875BBD9B138CAF6863821D6A4D553E9EB64C9254A8F9A6B960E57E39069D65E3F561AA1FA91643D42FEEFB9270D34AB0861DEA1E234EA587F580503D46A1989D413DAC2FFE0FC4CA663CE68 +Test: Verify +Message: F6959926E6D9D37D8BC0 +Signature: 249E1066542618CE0D236A7174708F801E7AB257931E9967A65C483ED66FB58598F99B6664AF0EAE221E2A6B271D7D17875ED02BF7FE35AA0786023858521CB79FEE0D134D9DDA609B0270FC9804BB6BF74AD90AE11EB339353533DC0D5A69E6B8758212B86024ED563767EA5D9B59655E0B8CC21244F720BA4ED663BF668E3A +Test: Verify +Message: 7A4C634DE6F16315BD5F +Signature: 308A5D65224201BED626CC83FB901EC84874EE03B2E7AB4E752EDBDE024C754E3CC9841CA062100A8843DE9183354B4E0596E8C68F1605828287884F0F9BA6968FC7A9F0CA09418A8485B90465E5D3F96CE4995A5FC7A6E5ABD9CC06BB8A2C3C8109F72EAE67FB4C108852C881CA645B3C5586F27F12FF3028ADE56E32AD9434 +Test: Verify +Comment: 1032-bit RW key +KeyFormat: Component +Modulus: \ + b660eb18786256c993ebc6dcb5892eac342f6d91229b73dc5d04f1afb9bb0dd4\ + eb0b48895f514b4c9afeaf86e91226f2299126d37528ce374e89cc312c06f47c\ + 81112bf5ca60ffc33b98318e04a17627269f1af461b6cb40f3be03b0113fb2d8\ + 404e154c7191306b36fd3efa73c784ad9189115d0bb1bd82b850d000e7cc8d20\ + 35 +Prime1: \ + 0bc31c063f43b3ade2cd633d554913339071d6ebed5fd665fc5dd7d47b80721a\ + 976c3b14fbd253f0f988c354725289f2897d7fb62c5c74af7d597a1e22aafba1\ + d3 +Prime2: \ + 0f816bf0add559afda38b008e4087f6a38b575c56fff453056eaaab3381c9552\ + 0969546f954d458d48e44850938b1db471cf4b40afc47e067fb5bce67ba98be8\ + d7 +MultiplicativeInverseOfPrime2ModPrime1: \ + 0b684eeec75b3e24e2d9947341b3f462258628af6f0b881396c887fe26a3408c\ + 40b13370710c82dd4a021a87bbaab5c0fc96cb1d015a783a764a8ab7b002903d\ + 21 +PublicExponent: 02 +Test: KeyPairValidAndConsistent +Message: EF0F1D56F4E5D587C212 +Signature: 3E544FEBB6623F5D392003B729FE2BFC20E2CB3ECAC22734DFCA55150254E616A41C5E54CE3B50FBC2FE2363EE9AF9B15C70615497B0A458F8AB6D850992EEEB56D65F87EA1BD6E2B4B7E40A0F5E1635C7DDB17110C61039CF712D3524C9C2C1F35D9163BE5C70276F46634514BE16EC09602782E88FE74EAEB2F50CBB0E3B5C4A +Test: Verify +Message: 2C9EA313EACF2C5DA43A +Signature: 1FEFF88814BB53E447E1E955AC8F1AF597C15C3866033E337AFBAB8627306F2EC1276621FF2176C89323CE32EA20F6AEC2CC271F1ED749408B2A3E43A23A44D6A3F38DCDDCAB696B239110AA7ECF12C6681B0E97E6FFF1B72F4F6D796BF82B9450AB8B3D28CA9D220BDF84ACCEA1DA5EDA0B470C3A82BBDD77B4C2723297608BD4 +Test: Verify +Message: EC5CC4228C3C70EE8F35 +Signature: 228BAA85062F10DCC9D99A23D340BC4B9E463D8AB86A6781A6D2143564303E2DC78772BF68449BE1E2711A68D5A15CF04A23573FB3870454308F583BBB5F2467069EF1395431E70F91BD56D846DC8DB2E88AB3D26A9770660B87A76D6C3575DE512BAFA8A0B901AD15B7D8E8BE2F176A182D16A9609F19A4298416245873175805 +Test: Verify +Message: D81F0C6F2D3D60EE19FE +Signature: 17EAA0C18178CD45A2B9100997F682E5F02BE09FBE4D8F345033951345CE98C8B3F13F2CA2A950CE7BDCBF83DBB700890E1F0B863D04C3ADB298F546A8F09F4DA4EF0DC6E7317207CB3CF691114E55D9EAA11C53BE55F7C214F62E6B0460DFA60C55B16EB55B29C9DBB908266C1BDBB03AD651EFB91905B142D852DCA0C4E3BBEE +Test: Verify +Message: FEF5EE07C74118DA30B9 +Signature: 2637E16E2599B6EC2F4728C73D3B29F483C2B881F1E1969C426027605EF080E9B17D258D5E1EBC6472A2501E04CF19C144537FCB38A1DA00D948EBD39FA11322D9230B62E2C12AEDB366BD85A2089588A8D52E941FD986D89828A342B83438A960B6FD87E9AD025AD75A692AA9DFEA873A9467B42D84879E85C5D11EFAB347FBED +Test: Verify +Message: 0B9554FFE4F6ADAB2C76 +Signature: 095952F24D9FBEF3A93A932865F4BDBB522CF24EBE153CE4BBB24CF301A1C7B51FE47B94F8F8B211CBC5A926FF6BAF9A6BBF7E15975D2DCCB95EF01AB7E641687870B0D01FC18B6B16FE17D3FC82931FBBCD4FD18C7F9588CEE8491876D72F98F2E7EEA90C12907210D6859053ADC7178B87BF8B4826954D6986FE761E71E1B7EA +Test: Verify +Comment: 1536-bit RW key +KeyFormat: Component +Modulus: \ + 9f8f8ab78ad635c71c9ef0fce9d4a958a9013ed69fcd67c385722668d4357c32\ + 3732c78179eaa17984531ba570aa0721a1e228957b1008010f1a2d6c42e09847\ + 9ffeaff9bbfeb3c8e101f968fc7ac74cfba210f76a6da160e65934d216368763\ + 8f59e414dc6f0448c0b4052c90f7dc565d32acae5da04e3e157dca184aba8362\ + bb28a2da6915d51d65f54fbeee69104a5a1b2304b87230c504b126dcf1c377cf\ + 1777b93be6903b50a44f054ae233b7cc24f950ded467cb8ffbdb17e7b6937605 +Prime1: \ + d0505c510a3b38a139d6d139818b04251d6ca46c2e717cfafbeebcd5fff8ae62\ + de4698e3241784f05e8c86f0f996db77259ebaac6983f092853639f619b75701\ + e562408cc1f5c543cada21fc26af36905b10a0df5b111efd754666bb3db4be63 +Prime2: \ + c41623ccb51e2474eb3dc5c2ef42cfd320a285ef7aefc1d1edcd5f566549cb79\ + 7285f01c89b9f749ca506b717c2a45b708fec2e7d611c5eee6af0a6d61219c7d\ + cab18961e98eea3b7797c61a75aed21d411de4fcf4a009a8238a832dd6e41277 +MultiplicativeInverseOfPrime2ModPrime1: \ + bc1ceeed917217387ead12254cfc183f82c79709499f510ce093d6d28bc1bf2b\ + fabc3d86d64a1c807605bd57f9ec533745d6e359270885c3eb7a36a02dff7137\ + 9bd453bf3fdc282afa2295d5e393f1c2c74edcbd2374c7740e8135ef0b8af258 +PublicExponent: 02 +Test: KeyPairValidAndConsistent +Message: 400AEF79EDBCEA796D71 +Signature: 15EB5A68CBCB0D6313BB2D14436237A716AC3159B059FBC29931933DB802D6925C01BDC6D90DD0DA25980F1C8199AB9CD3FD105A63D13B5C0101A0430455334492038FBE029BF4EE61F8A2F88D2A6D5424DE7C0CC314B5EA4F867B35224D574463BDE78B71904033C1455484865EB80AE1C2A7D1C229CD0A4D49C0F06A26E264AD42ACAA131F8C0C5EA4DC9EB5BD349D1EE12B3F91F4B9F2DABC3BCF0E216D4A34A3541169955BE45289CECE16DA6BC5352FF31D66538F64308D6FBB9C7DDE72 +Test: Verify +Message: 63F64BFAD5B830682F44 +Signature: 1003E58A73B018FF9F0F66D3BE9A8DD9D83097A0EB216AEEAA75B63C150AAE9E8BE2A5DE426D18FBC56865F4C9CA51A9BB6E99B70C59B7995246A1F4327C9E4A69517131DA66DDE98AE5D8355527D1C5E4D83CC7ED7B3B1F404F6FDF731DA615974F0777CD22C1E6FAA3569D1141900734C7F3262FE7B9ED291A934DE81A06EBF258F7159DE842737A32DAEC79EFE211C2739D3F5859CB9A633D2A16D78C347790241925C3E776F04B5D5F1900A7B48645DF16DC6F9E8C990AEFEE22FA1DA496 +Test: Verify +Message: B6AAE87E8D469A16A335 +Signature: 368EE32DDF9D5526E50B1645473DB79CE4B0EF3801F3DF050E8B6B10DFAA600A505FD1C91CAE1CD8CB8FA7BC2F81EDFEE7E74DCF7BDA9ED4FF87C39650E8A473672FD012A6A57C5DC44FFBBDA4A5DECD099A32791CEDC6170C8B367080792713041350D2483B27924822DD886A36EE575A3CD6C097162F758F5628D3EA301050AC848F0ACAEDAB8AD34D436E418AA53618AFAFC3168B7CFA641B1A88C86007FD1EDD8FE1D1A94FCE59B548DA3D8FE313A0A97719E19C857560763EFF1682CC14 +Test: Verify +Message: DB0F126516E3EDFF3D7C +Signature: 42076C3F6976EF4BBEAFEF0B4F7A8198CACE6F73436C59DF212474C94D00B0501C359CAB8950EB8937E8458964C817926A3181EED64EAB3A5274A9B3114406F62A62C51F4EDBEEF3BD948C21578996236D6D477B2701DD5A4818B08F5D4740CD23064798C3406133D0758D51717DB4575117DE887733D1E7170AA0845A81535444A962F2003A46361E8A8A1914DA6732C37334320F155E90E18D9E2A921034BEC81395AF69D61E22FEF90BC4F9127914B536BD2477552166C11F139519129864 +Test: Verify +Message: A58B1E5E98C44A8680BD +Signature: 100B8692C7A09EFB585A63B5D636EABFE9DDFE50D5235B11BDFD818D1810893B327ACC3B78942900C8F7498BDC1D2FB44330ADD3FEBC709046D8028F38AA7DCC768558E7D6469EDA306C0FCAE001C7B01544C80043864761355888C13960DD53BBD7854F2FBB7D9DE021BAD69769418712B6335A8C63143329363C65CB4170AA0C040559136EA9C19A6793024AF77BCF3EE793CAEDF07FD8A8E2C9C29B5F225F399BBA177D070314E319359394DB999D866A48D591EE8C662BA6394E396300FE +Test: Verify +Message: 7AF0498714B0D93AB959 +Signature: 35A959E3717468552590C26FA92009C3866955A1D14405AD33D3FA745D7591521A323BA031070B1FB60A1B6FE0C7198FC14EA41CE62EB6EB060FD073E816C9C85BB6251BF5235567E12951778A61D87F117137C347DE56337FBF9A3360D49330A98248233719FF862F83F772AC887F035820579F406D221191F4535ABA37401FF6E28216EC06AB8832D9AB3EAE4E1D3D780A1FA46883A79B657A7027597BCE4F21744CFC3704A449A204D3790F668E2EB710D5CF031BAA58359D35DDF92455D7 +Test: Verify +Comment: 2048-bit RW key +KeyFormat: Component +Modulus: \ + b6dee7375bf4385043b3cc2ac5cacbc14ad11a17574738dd2bd84d2d1e6c74e1\ + 6066c2a5c35bc3b87839858afb5ee5e8abfab408f38772866f6f833f39fab248\ + 3a2c34ed55ad7098f9f63d4ec70b7950f02daaaab10781a0008f993c4027e381\ + 6bfd45c52f59452a7b28873513dce415a84fc8bc06601567f91ec41647da2304\ + 5b6e01e24516724acc02947ad5aa2dba4d952bc4f49d18ada0b0f7cc5d488814\ + b921c0bc2b33d8828d80130df7d79b0992cec40d3bc7217d4a4dff3699345e44\ + dac968575194845aa7b60dcf3c712d9b0a384824c3579b40dba265457d50f69f\ + 02a140884d89b7fdee9f0a787e76a37c58c92cf2d3818c72097d41b3faa7aa95 +Prime1: \ + fa880a456f9c205a26e02c3357536531dec150be0ef8747f69ea30d987ff7dd8\ + 9e9a1075ebd39f04fa495bd26d8408a8de69113a9fbb52f20713d1d046a76b47\ + 8cf77c46454a7afda2ef418f63faf67c947d898bca109f3275999e8f2e60e2c0\ + eec133ff69e71a2d396632670b52d8ea03f7589d8144ab580b1d3e60efa1280b +Prime2: \ + badcc718dd2d761c4893c4831d56ada30fc5c7c148d473bedf7615b7e821b92f\ + 319676ce278349f1309fb3d264c1a22bde71b221354c7a4d31117b3ec3c9d480\ + 2e0a26bd8ec05d28b6502c65f35c687af7f8396b963ed029a2c5ae38dd7c5c96\ + 2a953c113c0f590957ab19a6e2afda6db84f22c0c31ae243debd2920fbe9fbdf +MultiplicativeInverseOfPrime2ModPrime1: \ + 48a56f93e044a8211861da6bde9ab61265c63e168e507b56cd6e6e5f4de57c2f\ + 5c0b626462d6c06790cf561fa12a350dc0c08767f2717914183fac90db36495a\ + 91c0e9c0fbcfef19c85075b3b744fc378a9f2045cd7fd144ecd39bd1a59f1483\ + 10f6982efb3ffe502b279c4c0cb2a7f9ef64ca8f38690c486afb5f659cf7f838 +PublicExponent: 02 +Test: KeyPairValidAndConsistent +Message: 00AA5515CDAE5CD0F0DC +Signature: 30EECA6B48D796552F5A6A3C11F28D730FA077422CAAB34FDEB879AE0F71DF21330E2F3BE5BF3A8CA372EBCD3DFA7C81B3398C31B0972D0B857926CB39732351AACEB8276D52B9D82F9C245FA0F1CF49E785A2BC00FF27FBCF777F84D05BEF17FCC0505820B029AC8F0CE17D2469372CE47E1428BB941004FE170EF87163E07298EFFCC1BFA7E7CB1F572C340CAA075A5962A15B69CE937BC7EFB492F501FC88CBF0119C351C8498782091EF6EFB19120195E5FF51DF86F90E90FAEB225AA2EE43AB4E8358101C0348C7E3859B9DEBA19464C74B74AC48A0B73FC8D2E7F8033E86208F0792B6E5B6DE36C99DEF604949811D1671EF6B0A4781B4E7A0A72AD855 +Test: Verify +Message: B8E2FB9EAE22FB2C0021 +Signature: 416D33F8C213CF81F805F54FC1D4E7C6A588A0965F1C9CAEEA1D41452E20935AAF2D30F957584B56621035430212A428E27A2F687CA9DBB596C19864AE692EF7BBA730F3D70CC2DDE15AB71E1E350C0C316EFA1A831ACD1441598B112482487DF72F58ED318182C7CD0906FE39C5655BF1313F29A15D60A6178CBF600C7FBFF8994840ED649C3C4026A463B3EA39C692B7D112B128BE49E1E32D4A7FF8D4513283D8DCD9CCB8FB7300BE0BDD4C44DAA2F7049B3AD83437093E623442AC69B48911CDA21E95E0775041F67F6E6AE01DCE646AEC20908E7C1B693600FE41ABA85AC0C778641E46C419083E41773C749DB3E1BD8FD764E271860D2D7F8E11BD6AB3 +Test: Verify +Message: 8C8C306A629373BAE647 +Signature: 0E9A00045FFD399D9DA9D0D7E543CF9FFD098BC23E72DD7763A64F22C7F0479CE866E31438B8F7DE31A18F35AF419BED6C67BE1540614D3310DD24F019E14FCC3AF73743F4C143D4B79CDF35C752A300F0A8251CCFF4AAF18785C533A7DF1A20AFE6770DEBD1B8BA2C83B2E345A04F833CD173E998FF9840C2F8A370FFDCFF5FD95CBD71B25FC9972192470FD145975344F64C2F6D68CB3513F48F9FC070021BEE8F6A4282D098C44DF655CE415E89B97994AE3ABE85986C7EE0AC348EF2A4F52D102EA80836E77E81AD3678803E53C83CF2F30D2D4950FB6B038CCB3F2690A9381EB34D6C09E88C090AB05E28047DC490EB8A1282FEB38E82FB0B18309284C4 +Test: Verify +Message: 15E7B7B7ED0F176B6799 +Signature: 39FF4B5FA50AE498F3C91A655E6865840D1FC401EE02DBC8460A59DEB8816E6680F712B7BAF8D4DC11A3B54BF906BE698306F0449BB43F3F223B944D930A1A3C718E8A9E2EEDEC5A07AB817C26A80CC2A2EE2846A597EAB8A999D38DB98490166F2574524038BBDF24B4E4622C843210C6B94987638C6976562EA9727385B152614C18349BD54AD95DE33D5354954B505E5259CCDA47E3CECEF3154F6E5481E536BAB568146A0BFCB66573714A7BA7ABE0385115720687F33D9C6EF6BB60272F1272CF349990E3A2FBCCE180B730792101089B164AE5A001F5263F7493AF148D6E0953E311AD12E4202D35F96DD30885663B5101F9B05675FCD2FCC4FCC4DDFF +Test: Verify +Message: B36724C92954C38D0288 +Signature: 3C8CD3614555568BBECA99174B7B203D0BC6FABE9E6FFE0C41EB4D9A2C601D2393CA1E01B7D7E99337758AC914C9F151311E5AE6708DAF1D8C825DA471652C6E13A8FE5802D7AE097BFC899A4EC8CA235B5982B9058C53AAD52823ACF692290EB8823C126635AB0BBF101C2B3149AB16183FA2DBB049DDB99C5E83723E4D4693CA3A08588AA868C677D42ABDAA6586EF192391D276C5E5AF0763ACCA6293F06250C51FDC2AD369CD44EB5F654E98761C881DDEC08E795FFB229B20522349B0714059E18B7B23A48875EAB12ED3F0A011D3A985DD7384B0046F39FA6C1A331F3D4C5125100BA58666935C68A7A10849D9C74850BAB82AE15EC950A283F3E7DAD8 +Test: Verify +Message: FA95400C2B14E064F76A +Signature: 3F67F9DBEB88E6AD057BEDC3D97030555A908867EC578A6CA572137CB61C21036AADE6DDC5592EC7CCB6B263E51B4C886A51904C858040E493D64B9ACE5BAA50C4A66D04ACCDFE0039D8541C4363DEFFCF93BDF5F5CC1FB64855D956B5EFD42D4C9B96B9CBAA97A32F02AAB307674E53404E6836DB5C96B59572ADBFD1113B87608ACE6D0898CB02E35575CC28D38A9FF8C1C4AD36BAA991DEFAB533F0A6C9C2F0F0815F1D659ED576E5DB18494A54B6817D9E34A134F3B9A0F1E8C77FC204B6EE087C0445A7036C935117E338D092F6E1FF4DF7605525C409456A5195233A176B29B2FD8FB2808D0412FCA0541B2BB6800BD8BB9DC9DC25230166071E8D961E +Test: Verify diff --git a/cryptopp/TestVectors/salsa.txt b/cryptopp/TestVectors/salsa.txt new file mode 100644 index 0000000..b00ff96 --- /dev/null +++ b/cryptopp/TestVectors/salsa.txt @@ -0,0 +1,463 @@ +AlgorithmType: SymmetricCipher +Name: Salsa20 +Source: http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/full/verified.test-vectors?rev=161&view=markup +Comment: Set 1, vector# 0 +Key: 80000000000000000000000000000000 +IV: 0000000000000000 +Plaintext: r16 00000000 +Seek: 0 +Ciphertext: 4DFA5E481DA23EA09A31022050859936DA52FCEE218005164F267CB65F5CFD7F2B4F97E0FF16924A52DF269515110A07F9E460BC65EF95DA58F740B7D1DBB0AA +Test: Encrypt +Seek: 448 +Ciphertext: B375703739DACED4DD4059FD71C3C47FC2F9939670FAD4A46066ADCC6A5645783308B90FFB72BE04A6B147CBE38CC0C3B9267C296A92A7C69873F9F263BE9703 +Test: Encrypt +Seek: 192 +Plaintext: r32 00000000 +Ciphertext: DA9C1581F429E0A00F7D67E23B730676783B262E8EB43A25F55FB90B3E753AEF8C6713EC66C51881111593CCB3E8CB8F8DE124080501EEEB389C4BCB6977CF95\ +7D5789631EB4554400E1E025935DFA7B3E9039D61BDC58A8697D36815BF1985CEFDF7AE112E5BB81E37ECF0616CE7147FC08A93A367E08631F23C03B00A8DA2F +Test: Encrypt +Comment: Set 3, vector#243 +Key: F3F4F5F6F7F8F9FAFBFCFDFEFF000102030405060708090A0B0C0D0E0F101112 +IV: 0000000000000000 +Plaintext: r16 00000000 +Seek: 0 +Ciphertext: B4C0AFA503BE7FC29A62058166D56F8F5D27DC246F75B9AD8760C8C39DFD87492D3B76D5D9637F009EADA14458A52DFB09815337E72672681DDDC24633750D83 +Test: Encrypt +Seek: 448 +Ciphertext: 5A5FB5C8F0AFEA471F0318A4A2792F7AA5C67B6D6E0F0DDB79961C34E3A564BA2EECE78D9AFF45E510FEAB1030B102D39DFCECB77F5798F7D2793C0AB09C7A04 +Test: Encrypt +Seek: 192 +Plaintext: r32 00000000 +Ciphertext: DBBA0683DF48C335A9802EEF0252256354C9F763C3FDE19131A6BB7B85040624B1D6CD4BF66D16F7482236C8602A6D58505EEDCCA0B77AED574AB583115124B9\ +F0C5F98BAE05E019764EF6B65E0694A904CB9EC9C10C297B1AB1A6052365BB78E55D3C6CB9F06184BA7D425A92E7E987757FC5D9AFD7082418DD64125CA6F2B6 +Test: Encrypt +Comment: Set 6, vector# 3 +Seek: 0 +Key: 0F62B5085BAE0154A7FA4DA0F34699EC3F92E5388BDE3184D72A7DD02376C91C +IV: 288FF65DC42B92F9 +Plaintext: r131072 00 +CiphertextXorDigest: E00EBCCD70D69152725F9987982178A2E2E139C7BCBE04CA8A0E99E318D9AB76F988C8549F75ADD790BA4F81C176DA653C1A043F11A958E169B6D2319F4EEC1A +Test: EncryptXorDigest +AlgorithmType: SymmetricCipher +Name: Salsa20 +Source: http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/reduced/12-rounds/verified.test-vectors?rev=210&view=auto +Comment: Set 1, vector# 0 +Rounds: 12 +Key: 80000000000000000000000000000000 +IV: 0000000000000000 +Plaintext: r64 00 +Seek: 0 +Ciphertext: FC207DBFC76C5E1774961E7A5AAD09069B2225AC1CE0FE7A0CE77003E7E5BDF8B31AF821000813E6C56B8C1771D6EE7039B2FBD0A68E8AD70A3944B677937897 +Test: Encrypt +Seek: 192 +Ciphertext: 4B62A4881FA1AF9560586510D5527ED48A51ECAFA4DECEEBBDDC10E9918D44AB26B10C0A31ED242F146C72940C6E9C3753F641DA84E9F68B4F9E76B6C48CA5AC +Test: Encrypt +Source: http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/reduced/8-rounds/verified.test-vectors?rev=210&view=auto +Comment: Set 1, vector# 0 +Rounds: 8 +Key: 80000000000000000000000000000000 +IV: 0000000000000000 +Plaintext: r64 00 +Seek: 0 +Ciphertext: A9C9F888AB552A2D1BBFF9F36BEBEB337A8B4B107C75B63BAE26CB9A235BBA9D784F38BEFC3ADF4CD3E266687EA7B9F09BA650AE81EAC6063AE31FF12218DDC5 +Test: Encrypt +Seek: 192 +Ciphertext: BB5B6BB2CC8B8A0222DCCC1753ED4AEB23377ACCBD5D4C0B69A8A03BB115EF71871BC10559080ACA7C68F0DEF32A80DDBAF497259BB76A3853A7183B51CC4B9F +Test: Encrypt + +AlgorithmType: SymmetricCipher +Name: XSalsa20 +Source: created by Wei Dai using naclcrypto-20090308 +Key: 1b27556473e985d462cd51197a9a46c76009549eac6474f206c4ee0844f68389 +IV: 69696ee955b62b73cd62bda875fc73d68219e0036b7a0b37 +Plaintext: r139 00 +Ciphertext: \ +eea6a7251c1e72916d11c2cb214d3c252539121d8e234e652d651fa4c8cff880\ +309e645a74e9e0a60d8243acd9177ab51a1beb8d5a2f5d700c093c5e55855796\ +25337bd3ab619d615760d8c5b224a85b1d0efe0eb8a7ee163abb0376529fcc09\ +bab506c618e13ce777d82c3ae9d1a6f972d4160287cbfe60bf2130fc0a6ff604\ +9d0a5c8a82f429231f0080 +Key: a6a7251c1e72916d11c2cb214d3c252539121d8e234e652d651fa4c8cff88030 +IV: 9e645a74e9e0a60d8243acd9177ab51a1beb8d5a2f5d700c +Plaintext: 093c5e5585579625337bd3ab619d615760d8c5b224a85b1d0efe0eb8a7ee163abb0376529fcc09bab506c618e13ce777d82c3ae9d1a6f972d4160287cbfe60bf2130fc0a6ff6049d0a5c8a82f429231f008082e845d7e189d37f9ed2b464e6b919e6523a8c1210bd52a02a4c3fe406d3085f5068d1909eeeca6369abc981a42e87fe665583f0ab85ae71f6f84f528e6b397af86f6917d9754b7320dbdc2fea81496f2732f532ac78c4e9c6cfb18f8e9bdf74622eb126141416776971a84f94d156beaf67aecbf2ad412e76e66e8fad7633f5b6d7f3d64b5c6c69ce29003c6024465ae3b89be78e915d88b4b5621d +Ciphertext: b2af688e7d8fc4b508c05cc39dd583d6714322c64d7f3e63147aede2d9534934b04ff6f337b031815cd094bdbc6d7a92077dce709412286822ef0737ee47f6b7ffa22f9d53f11dd2b0a3bb9fc01d9a88f9d53c26e9365c2c3c063bc4840bfc812e4b80463e69d179530b25c158f543191cff993106511aa036043bbc75866ab7e34afc57e2cce4934a5faae6eabe4f221770183dd060467827c27a354159a081275a291f69d946d6fe28ed0b9ce08206cf484925a51b9498dbde178ddd3ae91a8581b91682d860f840782f6eea49dbb9bd721501d2c67122dea3b7283848c5f13e0c0de876bd227a856e4de593a3 +Test: Encrypt +IV: b2af688e7d8fc4b508c05cc39dd583d6714322c64d7f3e63 +Ciphertext: 418078fe843f5984dd3c7975d1ff51af4dceda640999aaa3c28618ae286ca15051cb4d55f9da22a213ef14a2b905b52c99a557854c7f2a6d6ed6f69c1c6649f3fb67b8628468029b3367920c2e1148aa1f3b9c695cb1426f09ce84045842946e0454e41ab1edb32cae4b95669de4e2ccaf00ba86ffeae6a9c5fce4153baddb0d8998a600537a9649939cb7d7a9c4e8cbca0fab77963abd516699879de0b1971dc7328668111ff5b77c253b9e6346d1a2ce6e390cd736156ad7f44b339cfb141f00e7a766c06e130b0c31d88980d2ad8814a2d641599162ab8af25d93067f06a49637eaf6523806b8fa07d56628bb +Test: Resync +Key: 9e1da239d155f52ad37f75c7368a536668b051952923ad44f57e75ab588e475a +IV: af06f17859dffa799891c4288f6635b5c5a45eee9017fd72 +Plaintext: feac9d54fc8c115ae247d9a7e919dd76cfcbc72d32cae4944860817cbdfb8c04e6b1df76a16517cd33ccf1acda9206389e9e318f5966c093cfb3ec2d9ee2de856437ed581f552f26ac2907609df8c613b9e33d44bfc21ff79153e9ef81a9d66cc317857f752cc175fd8891fefebb7d041e6517c3162d197e2112837d3bc4104312ad35b75ea686e7c70d4ec04746b52ff09c421451459fb59f +Ciphertext: 2c261a2f4e61a62e1b27689916bf03453fcbc97bb2af6f329391ef063b5a219bf984d07d70f602d85f6db61474e9d9f5a2deecb4fcd90184d16f3b5b5e168ee03ea8c93f3933a22bc3d1a5ae8c2d8b02757c87c073409052a2a8a41e7f487e041f9a49a0997b540e18621cad3a24f0a56d9b19227929057ab3ba950f6274b121f193e32e06e5388781a1cb57317c0ba6305e910961d01002f0 +Test: Encrypt +IV: 2c261a2f4e61a62e1b27689916bf03453fcbc97bb2af6f32 +Ciphertext: 7030af4a9db8a6b95f55f962efefcc60d8ceb0d5d920e808cebd8cf6f31542d227a67c9db8888cfcb9410ae357f8a3da06a608a93b7fd5513978c6b8b837f6ecaafd3366495cdd3ab719d9d4c2ac74d6ea2eb117f30369ea62727fa6dc7982f668fa3bf44c9da8e70ff8c18b07d63aa01afe1311bdafc457d06c69aaea0dfbb1fc89d1574ad1e7be8b459d4cf36bdd88db0363219652089c50 +Test: Resync +Key: d5c7f6797b7e7e9c1d7fd2610b2abf2bc5a7885fb3ff78092fb3abe8986d35e2 +IV: 744e17312b27969d826444640e9c4a378ae334f185369c95 +Plaintext: 7758298c628eb3a4b6963c5445ef66971222be5d1a4ad839715d1188071739b77cc6e05d5410f963a64167629757 +Ciphertext: 27b8cfe81416a76301fd1eec6a4d99675069b2da2776c360db1bdfea7c0aa613913e10f7a60fec04d11e65f2d64e +Test: Encrypt +IV: 27b8cfe81416a76301fd1eec6a4d99675069b2da2776c360 +Ciphertext: ed158a1dd07f4316d403af3e6977afaac8205d678b38fa5928c61e366ff27003143d5d20482a2ea76a50756225a4 +Test: Resync +Key: 737d7811ce96472efed12258b78122f11deaec8759ccbd71eac6bbefa627785c +IV: 6fb2ee3dda6dbd12f1274f126701ec75c35c86607adb3edd +Plaintext: 501325fb2645264864df11faa17bbd58312b77cad3d94ac8fb8542f0eb653ad73d7fce932bb874cb89ac39fc47f8267cf0f0c209f204b2d8578a3bdf461cb6a271a468bebaccd9685014ccbc9a73618c6a5e778a21cc8416c60ad24ddc417a130d53eda6dfbfe47d09170a7be1a708b7b5f3ad464310be36d9a2a95dc39e83d38667e842eb6411e8a23712297b165f690c2d7ca1b1346e3c1fccf5cafd4f8be0 +Ciphertext: 6724c372d2e9074da5e27a6c54b2d703dc1d4c9b1f8d90f00c122e692ace7700eadca942544507f1375b6581d5a8fb39981c1c0e6e1ff2140b082e9ec016fce141d5199647d43b0b68bfd0fea5e00f468962c7384dd6129aea6a3fdfe75abb210ed5607cef8fa0e152833d5ac37d52e557b91098a322e76a45bbbcf4899e790618aa3f4c2e5e0fc3de93269a577d77a5502e8ea02f717b1dd2df1ec69d8b61ca +Test: Encrypt +IV: 6724c372d2e9074da5e27a6c54b2d703dc1d4c9b1f8d90f0 +Ciphertext: cfb653dd50a04a8580847d5bb98dc15e27c60f5a70da635718ba6d589f47935ed476fc960ffaf3b8750a59171b1434429a977ba878aea7ace8dd083a9238585112591165d0948a86e89e6118d572aa85667cceffd78a60baa5a152dc5e29bdd93f7389edde1541eec2f3aac38ea2bfc812f73de7e2e7b1322468f823a2c7c16e30fe9283894ac057da5c45a67f4988b4edafeb51c1b4a51a849d188b15838552 +Test: Resync +Key: 760158da09f89bbab2c99e6997f9523a95fcef10239bcca2573b7105f6898d34 +IV: 43636b2cc346fc8b7c85a19bf507bdc3dafe953b88c69dba +Plaintext: d30a6d42dff49f0ed039a306bae9dec8d9e88366cc19e8c3642fd58fa0794ebf8029d949730339b0823a51f0f49f0d2c71f1051c1e0e2c86941f172789cdb1b0107413e70f982ff9761877bb526ef1c3eb1106a948d60ef21bd35d32cfd64f89b79ed63ecc5cca56246af736766f285d8e6b0da9cb1cd21020223ffacc5a32 +Ciphertext: c815b6b79b64f9369aec8dce8c753df8a50f2bc97c70ce2f014db33a65ac5816bac9e30ac08bdded308c65cb87e28e2e71b677dc25c5a6499c1553555daf1f55270a56959dffa0c66f24e0af00951ec4bb59ccc3a6c5f52e0981647e53e439313a52c40fa7004c855b6e6eb25b212a138e843a9ba46edb2a039ee82a263abe +Test: Encrypt +IV: c815b6b79b64f9369aec8dce8c753df8a50f2bc97c70ce2f +Ciphertext: ab7204ab4f995c2d87376c3586f0261250907ab2c25e2d232f10f51f0f3a3f11ff704ba188a508301fb9d5f7e4d55070631ecd2e3be5d79d4fa67f4f4acb3879afc2dc18c09446489b79dd3043f74027e9a24a54d8babe757c9a3470a95cb7b7b093331e32534b337d697046f7349bcfa89036b3cf50ecfc6f1e61300a49b6 +Test: Resync +Key: 27ba7e81e7edd4e71be53c07ce8e633138f287e155c7fa9e84c4ad804b7fa1b9 +IV: ea05f4ebcd2fb6b000da0612861ba54ff5c176fb601391aa +Plaintext: e09ff5d2cb050d69b2d42494bde5825238c756d6991d99d7a20d1ef0b83c371c89872690b2fc11d5369f4fc4971b6d3d6c078aef9b0f05c0e61ab89c025168054defeb03fef633858700c58b1262ce011300012673e893e44901dc18eee3105699c44c805897bdaf776af1833162a21a +Ciphertext: a23e7ef93c5d0667c96d9e404dcbe6be62026fa98f7a3ff9ba5d458643a16a1cef7272dc6097a9b52f35983557c77a11b314b4f7d5dc2cca15ee47616f861873cbfed1d32372171a61e38e447f3cf362b3abbb2ed4170d89dcb28187b7bfd206a3e026f084a7e0ed63d319de6bc9afc0 +Test: Encrypt +IV: a23e7ef93c5d0667c96d9e404dcbe6be62026fa98f7a3ff9 +Ciphertext: 5c77efcb16097df824bd58cd3498e07af1c761740b5539929115e2caf3bc10eed2a16254a4306f4e20827247900276ce887362990c070c0f79e15987473b7ad240e7a9f8e6e3f020fb337438cc3c8b81c4cdbfbdd7b543b13a48a4959744f3efcb99a939c0599ce32f816d12c2b47a2f +Test: Resync +Key: 6799d76e5ffb5b4920bc2768bafd3f8c16554e65efcf9a16f4683a7a06927c11 +IV: 61ab951921e54ff06d9b77f313a4e49df7a057d5fd627989 +Plaintext: 472766 +Ciphertext: 8fd7df +Test: Encrypt +IV: 8fd7dfcb16097df824bd58cd3498e07af1c761740b553992 +Ciphertext: 85e098 +Test: Resync +Key: f68238c08365bb293d26980a606488d09c2f109edafa0bbae9937b5cc219a49c +IV: 5190b51e9b708624820b5abdf4e40fad1fb950ad1adc2d26 +Plaintext: 47ec6b1f73c4b7ff5274a0bfd7f45f864812c85a12fbcb3c2cf8a3e90cf66ccf2eacb521e748363c77f52eb426ae57a0c6c78f75af71284569e79d1a92f949a9d69c4efc0b69902f1e36d7562765543e2d3942d9f6ff5948d8a312cff72c1afd9ea3088aff7640bfd265f7a9946e606abc77bcedae6bddc75a0dba0bd917d73e3bd1268f727e0096345da1ed25cf553ea7a98fea6b6f285732de37431561ee1b3064887fbcbd71935e02 +Ciphertext: 36160e88d3500529ba4edba17bc24d8cfaca9a0680b3b1fc97cf03f3675b7ac301c883a68c071bc54acdd3b63af4a2d72f985e51f9d60a4c7fd481af10b2fc75e252fdee7ea6b6453190617dcc6e2fe1cd56585fc2f0b0e97c5c3f8ad7eb4f31bc4890c03882aac24cc53acc1982296526690a220271c2f6e326750d3fbda5d5b63512c831f67830f59ac49aae330b3e0e02c9ea0091d19841f1b0e13d69c9fbfe8a12d6f30bb734d9d2 +Test: Encrypt +IV: 36160e88d3500529ba4edba17bc24d8cfaca9a0680b3b1fc +Ciphertext: f003b213737415a81894a3d3d8fe4e4434d4df2b253d60c44609bdc0414cedf8bae297ecdb1d0b92393dd6dd7027b555388ac8a66308082fc6327ad94ad96223003de15c48a06e9cd99b5561e7fc5949c6ba8cf11d6ba1374ec32062caef541e7252d168781aab4c637793433b3998c5a5013fd35c336600a02765ddbf52b97ae80dbfbbe55e43c6bd5f746a1c2df4c80611c76a90308c47b2807876249d6d3c507a1a96c2bbb8242ccd +Test: Resync +Key: 45b2bd0de4ed9293ec3e26c4840faaf64b7d619d51e9d7a2c7e36c83d584c3df +IV: 546c8c5d6be8f90952cab3f36d7c1957baaa7a59abe3d7e5 +Plaintext: 5007c8cd5b3c40e17d7fe423a87ae0ced86bec1c39dc07a25772f3e96dabd56cd3fd7319f6c9654925f2d87087a700e1b130da796895d1c9b9acd62b266144067d373ed51e787498b03c52faad16bb3826fa511b0ed2a19a8663f5ba2d6ea7c38e7212e9697d91486c49d8a000b9a1935d6a7ff7ef23e720a45855481440463b4ac8c4f6e7062adc1f1e1e25d3d65a31812f58a71160 +Ciphertext: 8eacfba568898b10c0957a7d44100685e8763a71a69a8d16bc7b3f88085bb9a2f09642e4d09a9f0ad09d0aad66b22610c8bd02ff6679bb92c2c026a216bf425c6be35fb8dae7ff0c72b0efd6a18037c70eed0ca90062a49a3c97fdc90a8f9c2ea536bfdc41918a7582c9927fae47efaa3dc87967b7887dee1bf071734c7665901d9105dae2fdf66b4918e51d8f4a48c60d19fbfbbcba +Test: Encrypt +IV: 8eacfba568898b10c0957a7d44100685e8763a71a69a8d16 +Ciphertext: f17808cf21dba4762ced5fcc264f615a4619d8d5ee3278dbdacf14a799f8ee5f8a38a7fd9d262b336e51a8790c90fb8f0b63a49edae81f9a200ad73d9ed5ce6257524b506d7a219013e3e44a1f2a264b7f7f121e5d4765d0bdfe4a36fc51e48ee21e9dcbc3dc2541405bbdb90490fd786b942a07786094fc990be21e5b746d522cad26269a76c85134ee654f33485807fc28cf87ac37 +Test: Resync +Key: fe559c9a282beb40814d016d6bfcb2c0c0d8bf077b1110b8703a3ce39d70e0e1 +IV: b076200cc7011259805e18b304092754002723ebec5d6200 +Plaintext: 6db65b9ec8b114a944137c821fd606be75478d928366d5284096cdef782fcff7e8f59cb8ffcda979757902c5ffa6bc477ceaa4cb5d5ea76f94d91e833f823a6bc78f1055dfa6a97bea8965c1cde67a668e001257334a585727d9e0f7c1a06e88d3d25a4e6d9096c968bf138e116a3ebeffd4bb4808adb1fd698164ba0a35c709a47f16f1f4435a2345a9194a00b95abd51851d505809a6077da9baca5831afff31578c487ee68f2767974a98a7e803aac788da98319c4ea8eaa3d394855651f484cef543f537e35158ee29 +Ciphertext: 4dce9c8f97a028051b0727f34e1b9ef21f06f0760f36e71713204027902090ba2bb6b13436ee778d9f50530efbd7a32b0d41443f58ccaee781c7b716d3a96fdec0e3764ed7959f34c3941278591ea033b5cbadc0f1916032e9bebbd1a8395b83fb63b1454bd775bd20b3a2a96f951246ac14daf68166ba62f6cbff8bd121ac9498ff8852fd2be975df52b5daef3829d18eda42e715022dcbf930d0a789ee6a146c2c7088c35773c63c06b4af4559856ac199ced86863e4294707825337c5857970eb7fddeb263781309011 +Test: Encrypt +IV: 4dce9c8f97a028051b0727f34e1b9ef21f06f0760f36e717 +Ciphertext: 534f5151319c299d7356be2275ed2137fab66742797370b511e5150dcf7bc75c06d5249e8e8bd7c16e563cc7d99368a7a7f47f811a2ae2b632c73e9f49641bf9954d4df19c2778221d780f799806757738b327e6aeebab6bb22137f8b994c1e08baff75bb2774576bce2deb599817fc7a69860c538efffe91439f4714e4629b00a25b5b1a6be8aa7da2be33bad953481926e0067a70d4ff1a7bd0111e605ef6a2d66fa7af43d746c24a5d464dd6f75773aa9b65bbdfad9b82fe80f182b144cea9211d0b2472de873008509 +Test: Resync +Key: 0ae10012d7e56614b03dcc89b14bae9242ffe630f3d7e35ce8bbb97bbc2c92c3 +IV: f96b025d6cf46a8a12ac2af1e2aef1fb83590adadaa5c5ea +Plaintext: ea0f354e96f12bc72bbaa3d12b4a8ed879b042f0689878f46b651cc4116d6f78409b11430b3aaa30b2076891e8e1fa528f2fd169ed93dc9f84e24409eec2101daf4d057be2492d11de640cbd7b355ad29fb70400fffd7cd6d425abeeb732a0eaa4330af4c656252c4173deab653eb85c58462d7ab0f35fd12b613d29d473d330310dc323d3c66348bbdbb68a326324657cae7b77a9e34358f2cec50c85609e73056856796e3be8d62b6e2fe9f953 +Ciphertext: e8abd48924b54e5b80866be7d4ebe5cf4274cafff08b39cb2d40a8f0b472398aedc776e0793812fbf1f60078635d2ed86b15efcdba60411ee23b07233592a44ec31b1013ce8964236675f8f183aef885e864f2a72edf4215b5338fa2b54653dfa1a8c55ce5d95cc605b9b311527f2e3463ffbec78a9d1d65dabad2f338769c9f43f133a791a11c7eca9af0b771a4ac32963dc8f631a2c11217ac6e1b9430c1aae1ceebe22703f429998a8fb8c641 +Test: Encrypt +IV: e8abd48924b54e5b80866be7d4ebe5cf4274cafff08b39cb +Ciphertext: e8c59b616dd10474930c432422d23d8df8dee1c626def1278eb6c9828435c0c8a98aea9d350752a78cf0cf1de7973436605f22b0d40b9059d777c55c8fd02cd9dbab6888161ed28979c64b700d7ea48038edf36af21078713f844f5f23a4f271aad3562ed2cd773de622fff2f0b5785672760a7064e5415c76ffec522eb1225868345e89a9fcbb4f12c1176b01550fe7a74f750dc43d6fa4718c33ba99b0084c7a1a8e245c8566056296aabe13af +Test: Resync +Key: 082c539bc5b20f97d767cd3f229eda80b2adc4fe49c86329b5cd6250a9877450 +IV: 845543502e8b64912d8f2c8d9fffb3c69365686587c08d0c +Plaintext: a96bb7e910281a6dfad7c8a9c370674f0ceec1ad8d4f0de32f9ae4a23ed329e3d6bc708f876640a229153ac0e7281a8188dd77695138f01cda5f41d5215fd5c6bdd46d982cb73b1efe2997970a9fdbdb1e768d7e5db712068d8ba1af6067b5753495e23e6e1963af012f9c7ce450bf2de619d3d59542fb55f3 +Ciphertext: 835da74fc6de08cbda277a7966a07c8dcd627e7b17adde6d930b6581e3124b8baad096f693991fedb1572930601fc7709541839b8e3ffd5f033d2060d999c6c6e3048276613e648000acb5212cc632a916afce290e20ebdf612d08a6aa4c79a74b070d3f872a861f8dc6bb07614db515d363349d3a8e3336a3 +Test: Encrypt +IV: 835da74fc6de08cbda277a7966a07c8dcd627e7b17adde6d +Ciphertext: a91f3039c37f753857510f121cbbab8f942b41a4d04815729361268c84abed9fd3dd2c0a84ea5dc3cab46245f720d8f0fd81ce4c7837aae561186f66ae70db9e5c2238f1b417b0ab001eada16d1f9bcc2ed74d335fe8da60bebd8b1c4ae4c51d8c46eec7d1fd575a5824bced85b02bfcb1e11d5686471b2791 +Test: Resync +Key: 3d02bff3375d403027356b94f514203737ee9a85d2052db3e4e5a217c259d18a +IV: 74216c95031895f48c1dba651555ebfa3ca326a755237025 +Plaintext: 0d4b0f54fd09ae39baa5fa4baccf2e6682e61b257e01f42b8f +Ciphertext: 16c4006c28365190411eb1593814cf15e74c22238f210afc3d +Test: Encrypt +IV: 16c4006c28365190411eb1593814cf15e74c22238f210afc +Ciphertext: c86458ffa23d50437f3385ea7d3fbae5cdc1df7a14658b8316 +Test: Resync +Key: ad1a5c47688874e6663a0f3fa16fa7efb7ecadc175c468e5432914bdb480ffc6 +IV: e489eed440f1aae1fac8fb7a9825635454f8f8f1f52e2fcc +Plaintext: aa6c1e53580f03a9abb73bfdadedfecada4c6b0ebe020ef10db745e54ba861caf65f0e40dfc520203bb54d29e0a8f78f16b3f1aa525d6bfa33c54726e59988cfbec78056 +Ciphertext: 02fe84ce81e178e7aabdd3ba925a766c3c24756eefae33942af75e8b464556b5997e616f3f2dfc7fce91848afd79912d9fb55201b5813a5a074d2c0d4292c1fd441807c5 +Test: Encrypt +IV: 02fe84ce81e178e7aabdd3ba925a766c3c24756eefae3394 +Ciphertext: 5526b8ff95272e95ad298c30f9f165353ecf0f68aa2943476ec53c386cf07c465b677be13d01279779965dda94d23fe9452dc4934e344c2ee0f6f5e32efc2b3f79630492 +Test: Resync +Key: 053a02bedd6368c1fb8afc7a1b199f7f7ea2220c9a4b642a6850091c9d20ab9c +IV: c713eea5c26dad75ad3f52451e003a9cb0d649f917c89dde +Plaintext: 8f0a8a164760426567e388840276de3f95cb5e3fadc6ed3f3e4fe8bc169d9388804dcb94b6587dbb66cb0bd5f87b8e98b52af37ba290629b858e0e2aa7378047a26602 +Ciphertext: 516710e59843e6fbd4f25d0d8ca0ec0d47d39d125e9dad987e0518d49107014cb0ae405e30c2eb3794750bca142ce95e290cf95abe15e822823e2e7d3ab21bc8fbd445 +Test: Encrypt +IV: 516710e59843e6fbd4f25d0d8ca0ec0d47d39d125e9dad98 +Ciphertext: aadb7c36647ded09fca7587edfa9bbe81911925fa8996330c8e7b77601075e5f94404db9f82c67e2cd39d1649062d4c30cf23bc28f9ddd6d5b9ec586a7de7f8ef45560 +Test: Resync +Key: 5b14ab0fbed4c58952548a6cb1e0000cf4481421f41288ea0aa84add9f7deb96 +IV: 54bf52b911231b952ba1a6af8e45b1c5a29d97e2abad7c83 +Plaintext: 37fb44a675978b560ff9a4a87011d6f3ad2d37a2c3815b45a3c0e6d1b1d8b1784cd468927c2ee39e1dccd4765e1c3d676a335be1ccd6900a45f5d41a317648315d8a8c24adc64eb285f6aeba05b9029586353d303f17a807658b9ff790474e1737bd5fdc604aeff8dfcaf1427dcc3aacbb0256badcd183ed75a2dc52452f87d3c1ed2aa583472b0ab91cda20614e9b6fdbda3b49b098c95823cc72d8e5b717f2314b0324e9ce +Ciphertext: ae6deb5d6ce43d4b09d0e6b1c0e9f46157bcd8ab50eaa3197ff9fa2bf7af649eb52c68544fd3adfe6b1eb316f1f23538d470c30dbfec7e57b60cbcd096c782e7736b669199c8253e70214cf2a098fda8eac5da79a9496a3aae754d03b17c6d70d1027f42bf7f95ce3d1d9c338854e158fcc803e4d6262fb639521e47116ef78a7a437ca9427ba645cd646832feab822a208278e45e93e118d780b988d65397eddfd7a819526e +Test: Encrypt +IV: ae6deb5d6ce43d4b09d0e6b1c0e9f46157bcd8ab50eaa319 +Ciphertext: 89e9c51abd31d6156b96c4e82ef0dfe5c376bd6324750fdbc46e5ae63897323c816fb5bb8e6bf4335853e512cc334dbbfecccfe4e5c8fe8289963ee7127f3ac56bc26b7bd4f0d1e0afb06bde930e7587eedf07995d5052bbff5453147c1555a7c8534111295bb5ab9e89645cc330ae3e0d9294c9e7d6d841579e93aefeaed879f8e8299459a3c07e3c9dee497360510668c5246970ad39077e8d8935b0d885f11d2f06dee0d7 +Test: Resync +Key: d74636e3413a88d85f322ca80fb0bd650bd0bf0134e2329160b69609cd58a4b0 +IV: efb606aa1d9d9f0f465eaa7f8165f1ac09f5cb46fecf2a57 +Plaintext: f85471b75f6ec81abac2799ec09e98e280b2ffd64ca285e5a0109cfb31ffab2d617b2c2952a2a8a788fc0da2af7f530758f74f1ab56391ab5ff2adbcc5be2d6c7f49fbe8118104c6ff9a23c6dfe52f57954e6a69dcee5db06f514f4a0a572a9a8525d961dae72269b987189d465df6107119c7fa790853e063cba0fab7800ca932e258880fd74c33c784675bedad0e7c09e9cc4d63dd5e9713d5d4a0196e6b562226ac31b4f57c04f90a181973737ddc7e80f364112a9fbb435ebdbcabf7d490ce52 +Ciphertext: b2b795fe6c1d4c83c1327e015a67d4465fd8e32813575cbab263e20ef05864d2dc17e0e4eb81436adfe9f638dcc1c8d78f6b0306baf938e5d2ab0b3e05e735cc6fff2d6e02e3d60484bea7c7a8e13e23197fea7b04d47d48f4a4e5944174539492800d3ef51e2ee5e4c8a0bdf050c2dd3dd74fce5e7e5c37364f7547a11480a3063b9a0a157b15b10a5a954de2731ced055aa2e2767f0891d4329c426f3808ee867bed0dc75b5922b7cfb895700fda016105a4c7b7f0bb90f029f6bbcb04ac36ac16 +Test: Encrypt +IV: b2b795fe6c1d4c83c1327e015a67d4465fd8e32813575cba +Ciphertext: 0a8a907dc7f30f6f68eec465ead25768383956a304aa32e4ccea6e3756cbb19f2751e3b68339ade1499004a88170e44620529d3c568cb1e014c16548830dfbce1b47a2dcdd28e59bb0daf5908c5ff51817bd119fe33bda07d63e93a3522685eb101d912b02d093780d10884959ae4a49e2fb7fca51b81394f09314879a41f6dc2f4a7dc34e88da4747a5a1fc15dcb207d13222f08f91f079eafbded0d6036325f607ff29ff2fc7635e8c3767d61a3b7814227d6a2798d623bfdf674604e4e9e03529 +Test: Resync +Key: ea060c72f6e0080fd4a9a2131c9d684902415cab34fce4e52d62273e3c385f37 +IV: 5826043957a27509423fdd82f34935928a4b23a84ede72c8 +Plaintext: 20ae58dbf5c20225c35518711a86a19a61d5ba47ab17e8c5fa9658333d40ed31bffb79cde927c36baf61ed8df37acac330f64471bd91d90bfafa72dc8cdb6ed95ec6610cd6e8f2859255216a3eb4b573410d5644a40e4f0fa785d556304489c0023a1991eb0d01b5 +Ciphertext: 6025c4d5bcc769cc3e67b88340b4101690eb283654c761f8a0af360926313129f16d1c9358ecbaf66acd85787c7c1f52a953bc05e91d43bf3d94d341bffc5913435fb3a8e6264ccd1c355472929a140fe30a22689b055082c70395e0b070a3f0967ab36848cdf3d9 +Test: Encrypt +IV: 6025c4d5bcc769cc3e67b88340b4101690eb283654c761f8 +Ciphertext: a420fde6c359342819ed9c07853c594c0098fd2a3c8da24713dbd12261b528e43af7dd52ddf1a1b553d08c20b0ab399c38a067fb115368c990d9e839735c8427aa885eacb5c2900d1d04afdd3d35793f11c78dd826c5d09351f39823a13976eaa5a49b0bdb054043 +Test: Resync +Key: 115aaaa3a3827fb05175412dc6478747d7c128ce2637b6afdfe3213f7b0b6991 +IV: f8cbe32bdb4c8eac3a571f186ef683b9eb902302ff7ac746 +Plaintext: b09472fbdaa3e4bdb7b04c8819fb3257f764154d09cea22e9a67b40f7e601a97c469811773d2733eb4ab0da6249f237d4c063012fd06714a726b24a512daa7e287d39818980a6720abc45f10aab7d71da318244507b5a9d0aeae76ec5efd3b5ce167c38196744d13b07a14805ee49dc4421e0c59d559e8518a9911682ce1d2b307ccba48dd98c003103421ae6253c6a2476dda5d11cb3d5e7d6dc2c02499d5731095ee89f77c7d4ef27231fd6e9e854d1ed84b0b47bc4794e68e055e1d83d75ab527a53ebefa4d363f952562ac1aa47635296d55e2d5d1b8e214c95445bd586c7f82b31839ff78a60f0063 +Ciphertext: 50c5e2584d473a696c797ff1668137e331bcd9a1ecd5c146422a9140de87c10996d407c5eb8335b5bdb7a9b1613ccc198d5157c6f89d409e1ce7958605d68d442e1b10179c13e12ec33f98d676ae4be95ac7a82786402b1491918a6526e9676037d04fa7aebfd9afd39f6d10dc663877ebbb67aa82c6089529218db9622bd0af7e722e72265e25524d827da8eea6d7e0daf94c516ba24ecca2d820959c0dc939252158903d97139f6fcd81752deb3e9108fc62178bf54797c428e0887d1849fb5004c3b76f0d466afffd47f5066d6dfcbe4782319738e90fa19de6b99861bfc9e8112df4573bb38b1b9e35 +Test: Encrypt +IV: 50c5e2584d473a696c797ff1668137e331bcd9a1ecd5c146 +Ciphertext: 280303c6467f6badc300961c549c33f249c6d2df0596a459383b4c995b296854dea2072d04e46cd47c3380c4be6f6456e8759a5ab2025bd20ae6d116b0bba77b4f03aaa118c73e50f48755a89474c4380e8bbecffc4d6c84514711094ef67c2ed8b81a07c2afa41a19709e69d0bea22067eb3ce3618d80066f9c9f333eea1a624cc4d4dbfb0134004d1d6d295751c7a134cfd29cc85045734e2a4400c261cca16bca4c7e4622837eeed6ddc64c0999347248081aedd3f4d911ad5c92aa491b05510adcb0bcd7c0711a964f176775f11d8b00d9e4264afbb4d6b6a81760d964ca495485895ebba1dd1d2bf9 +Test: Resync +Key: da4147528d2e7862009aa772051e60e309721eeef4b4bcd7f98ae8d0561960b3 +IV: b625057bd07c1385fc08bdc14d735e5832dce5aa0045d9e4 +Plaintext: 6db3a848beb8a6e9670ed91427364c9b042d000a14eb2ac4c6097625e20b2e8eb367c156f927262d2251974d5953f17d00b4ed6b4d93513a19ee6b4f1a159bec8ff94151a7bdd6074d12d343fd852fa69a26302a11caf57417e950723c5a5e795de4cb6523fede7af6b6cb68f41931a1eebea6079e8018fe4116e7b03df7 +Ciphertext: 399c5bf3b894e3dcb5881fdcd927d8cf4ececa5140b2425df5cb2cb993b6901f736e94fb847de41b7c32ae990510402ce5e99a34b5acbb3b5aefbe55be4707025ffcfd6605b6ebeffca3c1ed3c42cba900eb5f14c195e5c574eae67e7355b780403e44ebc91f81fb04f95759f78999fe619d5b8f9fb2185c0e14cadfa8dd +Test: Encrypt +IV: 399c5bf3b894e3dcb5881fdcd927d8cf4ececa5140b2425d +Ciphertext: ebb1d4ebb394e185fddd72fad5efa8434465a9ce758fbdae25cdc6b1278b2e137f5afa706c5a8e95684fcf6645c6c2f67f698621c7d6c7f1899be12e2f6c9e480315c12f02405b8bcf45f4a715eeb72f12e0fef15740734747764e698ee88d05ab30028c9ee237a48b50c8fc453b7d370daad88e57a572a9cb8091526861 +Test: Resync +Key: d61f8e75dc9295dc029292764f3ed08dfb6fd725cae4b0e47aceecaefcf654d8 +IV: a6046a92ad15e9f9d8027ff39bfbf534d46fec35bc9cd94f +Plaintext: c11f014781804645ca22ca213a5558a038090341f3f70aa1df0bf135fb8d0184d77783b519c9c2b2b0b748880a85bab986de7a37a4a11bcbb5c0c87676d7808fd41abbfd0d7a11a7c545405a4ae42f60baa22ccee6de0272e79610c7b885b70ba9bf027657abae393cc8f56735faab9f6fbe36e7a4d99ce15cdac24223880bfb5865ac7acf01ea833098fb148406e6 +Ciphertext: f3b2a1188c33e96124f383b8b75dcacbf782f728eaf436db05551ae2be1a77f09c9ea009d8651329d0a812580d1e11d0f64c44e245bf30dd9c8033b72d0e5049131063c5fc2a3f219e6c1bd993c8961cc174eebb655574dd45b73d0d804f5190f92e385dfd7c2a4ff430ed6dabd41db040aca8ece7f11de796478026f48337f763cf69aef12609384f0ae72ee38c8c +Test: Encrypt +IV: f3b2a1188c33e96124f383b8b75dcacbf782f728eaf436db +Ciphertext: a9b213db6c8e161687e1b63f32a806f15aa8b3ee60cd37d7d437f90b446c3361d37893b702dfe774e5e5ce486399cd408fbf6ca1005768bf7825130c061e43f6077080438514f1a8ecdc6ff7cc264122b1a55c849c76328e833667326f23670590b77f2bfb9a666bcc4c44c16efd6c506c37ec62de8e5365ee894670ac4264b807a8455d8df05ba45af51ff1fee343 +Test: Resync +Key: 0f2850f98634181f49e53bf49d2f822fbf75e5f77c6cd7487541c514a4101ce7 +IV: d6defb4e74c327d89123bdc1d1c6d2fce6b745079bc2c9ef +Plaintext: a064bd9bdab0ee26530c2d26be556cd67295180bca445dfc87954bc51b28a21b606a229cf5a41fa104c51c3f32003a65064ff73e66691e4d2b1a22d236232be18677d54aba7ad49edcc9284897a7f88945513460166e5dfd7650959c05328abc0a7e95c352dbc227ca17 +Ciphertext: 51de41664070aec657612a57641c0c83ae14f5b3b25b25d916e0cdfae1c1bd21f7b47d9ab02b6841e115394cad58a568c1d7c2559a1d3fcd9cb4b25529d26e475ae313e6487538d16376a6b24e5cf27d2dbf4c83bd18996594f60549f34a8683b04d05198893a816adbb +Test: Encrypt +IV: 51de41664070aec657612a57641c0c83ae14f5b3b25b25d9 +Ciphertext: b5f57b5f00d2bf5f48828a4e793997e6d12b0f14953f5b1634cba91867776f75d2d2d247799a46080372046518416c60a07a65b2aa1318238597c320360a279e7633045bc43cf41bf9d366eafc7613b090a41fd8db3f684afc03d96c82a40b46e2994438febf268020c4 +Test: Resync +Key: 5cf680e8a11eb005d03fdc3d4ec0e129e6aceb47262dee6c452a5b8b0ef1b450 +IV: 6a6920ddba39b5a2640976ca10c97bf308a8cdd70ea98260 +Plaintext: 1f322b31f5f577a596b0fbe567864c7ce2973b41f924205defe08e2866b7fb5c1814d664d33957614e91668bb15d9848ffb93dc08c1f74c5f5e1f88148d1a1a7ad47395b75834de4988adfbf7e58a38157544c2be5b913152c1d00 +Ciphertext: 64d6c9ca4db201d95afc0dce28f6e47d51c2856ccbbc8f4c2e2bd2d834aca165dedd117b0be9a7dcd21eb22b508f4ecd0236075b064a0ced23e324b18b2bf2cda1c4416f78c740e51ce687cd37842be368fc4e6ba7cb312d89ea7a +Test: Encrypt +IV: 64d6c9ca4db201d95afc0dce28f6e47d51c2856ccbbc8f4c +Ciphertext: 9f4090fc504efc0f6bb5f76ac9881e1379da9f700737d86e9636714debc5c4eb3276fcff90bf71c32a71e06c199b3431475ab77410e83a7eba158723efb383a5437731a136758aaf7d39f0def719b0dd46798d9d53a30cd1b91eb3 +Test: Resync +Key: 9d27327495159927d0dd93e258908590343a57f6583e0d8aca07070ce41fd37a +IV: a01d1d7d1d43de5fcd60277f84dd8b93d08d480a77961f71 +Plaintext: e2ce8d1f9ee9329c3599e1880b9e6cb75d52e86f48ca89b829d4d7ca16d3e1b496b8b46097501793cdf6764ffd44b44013c7aadbf0ccfa4eab012529373a9022480f58877332b81f3c703ca80a77f429d944d5a877d89c6f64214c9ea6d3a098d9057d519354cfbb71a4bcddaee65de22e4d782ef0065952b891c9494d8a509e86d08ca31594015d3c31931d417cd048e59945d42ab74983434d14ef4e078f30ec2fe9ceb7e247d557b1d2593ab35896082c1c218dd73a868bc5cae74862b898395681234b20fa1ae9cab6a49b94bcc38a3a4a91cefc7745d094d9d8cab730cda4079705e4afd0f5e401 +Ciphertext: 94e0d546dbdcedd76e26629484ffd9b67b9c15f61b07df7ef0efce41270bdc9039ffad321c5b2d2847f6f4d5d105676fde08b8c47df248850dee1272d51feb42d503e58d67b61fff0a20abd999a5ad5942676aca3f31ce08614106fb692ae230c2a74339eb38c074bb59cf5ab42fcc428a0d629c12fbc3d845e84ed76c3f774e92c1109be12f00aa8ebd2a137a914e655081e6e60176cc98e849165d9d93235c605c8562f51bb407aeb8f330692d6245297817eebd32fa2ee96520b560e37019e9aadaea40f25ac4c5446fe93c5b39fc90152f088a5a936ba4efb10db7f246143f2cd151b1f1155e05a8 +Test: Encrypt +IV: 94e0d546dbdcedd76e26629484ffd9b67b9c15f61b07df7e +Ciphertext: 33203e910f56c5e1a63f3a801fdd772dfd1c3b0f3e012772bf0796337d95f4562c349f65557e76dc0aadb982d1aa3a3a865db36418bd1efcae36095fdb3ad68e1df72622d45d5336224caeb237adf9c19b02e23a1b9d4b32a5b6f39595a93d495a74cceeb4254e0b75f54277b80b153f62c8b5bdccae8d3ce24d8ee258f6d4ec6d631f6d1c8e8daa049d33076bea38acc5fda4a8822a16a693c936b340eb7951cd1ab0f7f58206252b0ebe46c77214dc86db136f8e170fc402f31e1c7ef9bc409b19260e4164c145aca28846ead4dc91783bcb1bd914a23d7bdf83745cb74c7ba66eca45457c53f42280 +Test: Resync +Key: b1a6c9bc9870d808a81612d0f4b335cbfd8b305150a6140627df06d9f8b24c0e +IV: 7313e9e505147d4a4c2023259ba01197169bac01af0d5bb0 +Plaintext: 479d7baf87a385c781f0dee6e51ee4f94eb2ee3e93bdbb3f402b0252496225d4118511ff893f4ddebcd31149920e259006cc7353ec5a95da4bc61ee6863282edc341afe9541d44958c2855b6714625ed2fde62db387e114fe837bbecee398351d187e0c93e0a0618f9d923504dd662c11e43af794e7ac7c99816c180ccfe1779bd2dd476ed68eb1736f421922fdc6696 +Ciphertext: 30a86c8b6a55670856e6d1b31d59602e05819022f12df1c67294fa138d65d5fd9f5e9192ad09604e08005537832d07ad5f4743bdbf137b7e18b8811066c7e411291fffc6e6ab55744789a225f15086173495279a4c628ffe4b1f8bb4d886bf74ada7d783b143edda1675ca9493ac1da04ae62584ce41c8a2c4f9fae79d94363bcf79c343e51ce5694c639bdbd8405781 +Test: Encrypt +IV: 30a86c8b6a55670856e6d1b31d59602e05819022f12df1c6 +Ciphertext: 33c313c0da87030169b7da6963644cdd257891b14fc1e4387d35faadc39279cca215e7079ec4272bc259e6499b0cb6dd52c6dff5965c7ddc9e951ac5c0056b4065a6f8eb5cc8e5373633a4aa3aa1736a67be11ef63c3418b1fe57730d6cce0f40e5bf02e61f6aae1404a813fd2a2a870960833be71dc73bff4a98718d64cb146a2ca5d41fcba85a56fa3d0413d0a807b +Test: Resync +Key: 4f9f97fd4ba7db6365f5fec9fde4e752c8bbde48a7ea986b878302e4cc8af9d5 +IV: 05788b5db4e3711eca900a2bfe6f78de44e98a70362504d7 +Plaintext: eb50b1e352f3fae6921fa7884c99365411928a2ffa33e3106768a773246c31cb0bca5cc166819b3b05819017f06c8b8932607db6d66d58d6a2f7356e4666ff7bec3a2223c12777fa54d9ed1dc139d9512c52e1e53762badc7e6f8da576afd940fb4a29d89e76fcdc93e515d69a6ca9efe5d053b7600b458b6719852ec4ad3c59d0b0a69971ac6ae53118c186f2d1a57e350ac3c8ad7d4e087c8f32816462f0506122fc01caa8c93aeebf0edf0c8e1cb726bfc861 +Ciphertext: c63f829e84c1c9709c49780a445bbf0dd441acc5304e0433ce0cd70af3fe98d36bd9e6fab17e6e8b50fda157e3ce9d2a928e8c234dd1700999047db4a28ea40a9657172a471f962d872a1d3342c12965aa1f1484e760979181ec8fde5472f509f76748fb4557b9b73fd517f70b20795caa1cd19e4dd5ac65e8f4cdb65a4ad60e0dd64407dc5232a5a893ace71acb35700fe059bb641497a2db63caf083942b7fe530092e90014bc5b6f889710ba3fc50d086fc32 +Test: Encrypt +IV: c63f829e84c1c9709c49780a445bbf0dd441acc5304e0433 +Ciphertext: 625aa1ac285ed59cb4b17da0ddb32a772eaf95181d0587fa92be22d1f5b65e403de9c0caa3301aa569ef9396c4cd06cffb602d5b5e6d2238712e74de51b0620733e1ba802038de3735b2a08951cbf17759f90cb0c4c4eb6a1acf147b54b7ac7372bafa4377fe7510d06a9c4ed6f972a669e270610a7084b61d4b52d2931803b805440b3d5e333ccdb0f3e7c0d013f068b2b402680a83210d71051da3529299343813150fb0f26ec053a8dac9993568e9b0c703ed +Test: Resync +Key: eee68b65fafe9a5bf2f9f92512a716e5af3740efea15e596f4ea0b5aef23550a +IV: 4d312f84330a107250b68c0b1df417ef713615b704d99b71 +Plaintext: 95ccd08ed2ab0fb87f55786f1f10d33c7713bef4435c3699b13982235ed040c9d9cb1b1f335cac0faf8654812f6874408bf20b129558a2c342c07c7f42a30700b374d18b91d881fc0f153f4ec1a55633a92d637212a11d122a9a1eb085439ea1226ea7124e8bd1c644a1996fa6369dedcacd5c766d7dc9a8c8682c5729ccf4d59433ba8e1569fe826089995414afd576ffb9686a30725fb9e5d7 +Ciphertext: 6c832a8147658a1741af29b0f558fa3773c81429f91a5cef270f7154988f97d4b28549604909f726a8a6e89d625089ea387b2725861963480424d9835d7e2fea93a5bd3bf86c7827fb22e7a68efea1a05c45f9606d4ab7add687d9418ba60517cecb3503287fbc5b2c9f0f9b5faa991337b394dfac7514dc38ffe019a1e7c74e5ad23f4e3bddb74ffc8a81f521d0b6044f98238f7c2a38ab14c0 +Test: Encrypt +IV: 6c832a8147658a1741af29b0f558fa3773c81429f91a5cef +Ciphertext: 7e1ef21dad49405e2fc86c50bf045eb14c65e58acb64e210af9ad8ebb5679021721312b96514d8681fa9d52c01c83f7d871401ec345a334648e0fc2ca294ced407ff98f1d1bc4afd83bb325072a5367d9a014092bc99699713bf84587fe2ee998bf8df35aacf61a96be157bddfd52e5b5a1d4a2e3bb109502e608f286aa8f0d5f67b4072ad9b60971ee8cf9fe966015260e61802f19f4bc8a29c +Test: Resync +Key: 188fbb5bea95b5101e056b93d8890c68e1328966089ebf424defa1bcb96e88ff +IV: b51304a0194bbb2490fced46fd0f39c3e87ea5196ca67ce3 +Plaintext: cd78c7c8f308addbd9acb6352d1b5b8a6ddee8a6f51401556e612d4c18960d152e6973381f45b19693e8ab6643424f01e9ab27de29f4ea16465d95674f7c939b +Ciphertext: 81a468948c618db0de96ad5cdd8b577c8253df097128cea4ffc7044f3eefa1b486b9159545fe135ea8a862fefa015f663febbd9b9527cba516551949013e9601 +Test: Encrypt +IV: 81a468948c618db0de96ad5cdd8b577c8253df097128cea4 +Ciphertext: 0510193beecfda67addf420e9c52130dbc8883cbe27d3e013207dc0ef3ff4e0b92e9ea2a2b644ffbab55c942acd63ddb7f1cff8d51d27b0a7d2853584dcc0bd5 +Test: Resync +Key: 2fb88c256a737eacf97ce4e1d13f1e20e8b2426f19076d7901bf6696f38a81b4 +IV: 12a82872b47b2c5b73cbb38904a08d283701eba289c057b0 +Plaintext: 3caae8a0c99f38cb7b2e45ea91dd5dc1331f0efff9f69a5dab0164693e986ba0da48a84321f618cc7e4b4e4d66acd8a71b69e23dbfbc6bca0c4ae279f3583b08705100adb7a4aecc0d72955a7305f4e7e2765b0a1bebea9d7e044e360d44b402f01357dc9a3e83fb46b48a683c1ad450a255bf45fe801db33414d985fd3a337c857d370ddd05c3313ae2eee0c8cb1d12a2fb650ea6e4851f2ca27badaf36dede18a9f8a62a502f6c2ff94d591cc27438e7215ce6e6abf76c22190b7201763cbc8d3a2be1f366f69eca6e5386883f56bd1c +Ciphertext: d446cbadf5afb1f21d7748a5973e8650d1dbdceaf5b837cdecf972bd091734a71ee1692fca675f4972d1e8db716873a03f9a5516f409982316cdc9f66ca0a8018dd055af0086397a86cf7574253d53fabd3aeefdc54dc2eae48b5b61a31dfb8db6531d2185034b81f745a3b88fa11453df073343de8bbd35a45f9cdff45b52e5352081f1f1a003a58200a4aefe27c87e930b77b8dc5b0882dc848437892e1902d126813e31ee27526d947bad5e8f9cf16a302da1a8f3883e3c9b257091e708ad58f4e716bb49e660cbf1f6fa709d64857f +Test: Encrypt +IV: d446cbadf5afb1f21d7748a5973e8650d1dbdceaf5b837cd +Ciphertext: 4125c6831bd2d39c1b1a2e12c505ca077fede7c553d486ae9a87ca3232d27974fb35c9a18a6315e5feafbffa943e52e9c46aa0eff6bce2f2dbf703c641ac570a92551f8a6e9aee14e8bc433b36e06bbefb0a292279f688e5d06dcdf317eded20f9dab8fab19298b146e1555b772d9f9c95e920356282ae691436a8505051190bd840b234fde486726dabec5e0755f4335b8ff4e30c30bd4f473a6af3fa3e7542f2b720784da760753938a682e86cf7ee18c5b5f7f515ff0380134d375e434934508f7cdd7602ffe2039a376d443c048103 +Test: Resync +Key: 7066fe1125429407b653fd090262bed2a3f7f3be2fa8f160f3344f327b1e53da +IV: beec3787c335739fa5d7ad15b85b7e3e7c9438367434872a +Plaintext: 9dad7f5ca1 +Ciphertext: 014a1f27cc +Test: Encrypt +IV: 014a1f27ccd2d39c1b1a2e12c505ca077fede7c553d486ae +Ciphertext: 20539f2d9f +Test: Resync +Key: 3154d3f5bb56b00b34a255425057e99ed9effd1cb0168d16157fd769ddc665ba +IV: f7f9f18f9648f6dc06ac643ea77f1493a9fea3390a98bb0c +Plaintext: 80a488703cf316be904ac8394437ea02ae2c027b7880ebec58416429ea060db543839d781d82a0fa209077e4b1 +Ciphertext: a07abc8ef3641cf33179296ca401bb291a9547d3e6d1b0886ac31d26d2f3281a6a568cc042593132a3cc1082be +Test: Encrypt +IV: a07abc8ef3641cf33179296ca401bb291a9547d3e6d1b088 +Ciphertext: 27ff7646fa8c6b98b1a732841e1596caba7b87eb40508ef0f8ef390aa5e36c0296ba84b686701d5e3d34b16508 +Test: Resync +Key: 81426f03ae1578d8ec1407827db18640d9d90d2bb773971f4ef14f859bc19e06 +IV: 479961f75954ed4f8024108cdb149ca3fd53e6a239a01e86 +Plaintext: 9cd08cf58e13e94e02c9a40269875392251353223f5329412e2a5e34328ea18c414d4c730b4e1c0bc140953f4ecf4ffc8aec963e59305d4d +Ciphertext: db3ea5b5fdc9671ec56b3f1cecbb2a552b0ea4ce9be508863f3dfb3238d4fb91b896727357fe454a08114200ea7226787fd2ab154d53eac8 +Test: Encrypt +IV: db3ea5b5fdc9671ec56b3f1cecbb2a552b0ea4ce9be50886 +Ciphertext: a887b52b3e97e6c899e1d68e57f283633ec9392438d17fb645702ae3b0ae0aad3a7c6eff0baff9f5357328307f628f470891884c264973fd +Test: Resync +Key: b3c260036b79cd3345e04cbee474dfea3a7c773db2ccb29d4c36a1b8c8b252e7 +IV: 1277840fe82046c024e6f4f53b4ff761c7c9bd1fea6c855a +Plaintext: 6a6dac1bc93b9b5c0dde0d1e6a534914dc2a6d51e6f8af3e9d42b88bedc2173782a2314b33f795cc2e4536829871d77186168f5461d18130581664586256 +Ciphertext: ff5e71022c6522998a2d10843fda170796a70d186e5fca2afcf529c6d075c5212c793fb322c1675d0bd3cc6b18f2715678812e81a8727a2d6ac1158eacf6 +Test: Encrypt +IV: ff5e71022c6522998a2d10843fda170796a70d186e5fca2a +Ciphertext: 7e8b5b4d250c13e38b5dcaa5532295e649ab3669fa594cf30eb81a54b25b3fed4f35be97afe4a2a37b7404acb41ad31d737fa9f272e1c57b3754830b4823 +Test: Resync +Key: 14fabd52e0fff9dae88d54815d82a56c4d4a660db5f214288cec1982e56fae81 +IV: 55b8328a312dff104c7f0720af0b7624f9281731b9f5f4b6 +Plaintext: 71bfc290baeeb0380732aa4312982c0dd0cc06cf2ee53adb0ae61c64228b80c073e7687ad3d3f888151b4066f415b62cf851d2987a3c816255ac40b62f453f350da8c4e1ec6dd0985e721b45a063381e997f629a7fbcd44fead19adc289f58f104fd37ec93a35305ba6fa44844d22e80a853e6db1d466ba2ad09ee2d30b3f47dd01b4d7b5d498cffd934cd3e005dc91e9e951951d5b937b319de0a7ba23c7918b1d74d3551b6500d39e6d626fa9cac8ec4e744713a93d5edc8413e2fba1d3b9b0f70509e38a66a2a2d70c510b57e15ac0c4b2aa7c5d6eb088fcdf6cbfef2c6dad19d7f17437cd261636c6d +Ciphertext: 7fc8bc27994031b3c35632590a15607ccaf1be15c542eea5b71ea1f7fa3abee79cb1281a00adb05e6fee4e65e8cba616a5789629d8fc617fae9bde9d92f6c8779374b1cd32a8e9277d0cb052c7658b3ab24ee1e55e5dd88a76266e9fb5661f576000968a9af71a3edb59ef3974e76aceb41c3de2fcb204a0022f302316eb01a0a8d74378599a7f72987e9abbd6f1a8af152ee89455840584010da73b01bbd7b01093a8c38049dc7a5ee0ee80daa98de46803ed75d0a97083ca328e7642a07e1c037346a280a856a64bba53b050272b7ba9742ef62aa89e34500f0efd7bce800bcac91981556a878d102ceb +Test: Encrypt +IV: 7fc8bc27994031b3c35632590a15607ccaf1be15c542eea5 +Ciphertext: bfd5908a43916afa5e2709b2e43ac62f406a4e677b855d70b216ae92cd444fa47f5568558c3cedece54e8b436e904e927175b455d96672a8cbdb4316b9e48a704216e30e9955ae7107f9f7770768bfd3ce71416bd337710bdf4e8789c8537a37f7c995c616a437ee406ca20c8f333a7c2f84ef87dac8c32f5b9678e344645bd356dbff32089fd195d982d3bb94b06b5b232580b492cb754659df62c9b5186b26bc2485409ff95bdc0c1c4c80bfaae878abebd373b159507b5894c5a9f8402447559b5aa7c3b491b97adf202847d0f74605a2502b193b6440a6b1765d538e38a2206630dfda4123fbbe4da6 +Test: Resync +Key: 75fe951556aae3d6ee93670241b7adac6907fd9285dbdf165834fa0cbf741b00 +IV: fff3e1ebb2e48520be552d2f0b617291c42a946f38804243 +Plaintext: 2b56b7dfaf5969d84a88aaa10dd12682f15d8a9a942deb6eba04a9a7ff38f2d0a947b414cbf7f1fca82d74b4ef98880368ba58ab7da98e8d6a6c46cc47cf0536961920e46095627b73737ea19e393c2f19d1f252ddd74b8fe050d95d21004b8997678eb565db0e369cb8bd326942e634a20845c61265da8a21448357f3eb +Ciphertext: 4b3bbef56b4400b130f8df0ab25bb28ece9160c430417060e48e691e6cc4ba119b0c34f5e76d4f1b7963785b4c6a9fb0b42c9f4eed92f8d0989710456c7f8d228fb26359f6e2549439ff5610dacaeb1df4f43a39cb3802ab1c87ce73f731ab1127ea9c2e82fb372be407a8c2b1af40398b33582e842ef0862f120a96c75b +Test: Encrypt +IV: 4b3bbef56b4400b130f8df0ab25bb28ece9160c430417060 +Ciphertext: 76c77925fc94b86624decfd2014fa505a6343054ae55c5be6d12c43018944b5d1c2aa08b9c11ae00d0c8779e70f220ffa59847969e54228d89b4351471fcdb9f0f76f18fcb896983d09dc5e8d9ee666f5abcb4d9e7bebbba824092c65646c3bee46d07609057e44b36dedfc02ce576506aa1274d550afc57d973fbd60294 +Test: Resync +Key: ea7bcb7f8712f9aa149a311d906dbcba443319f68a441a68a263c7bd0fe10fbc +IV: 620e57a9ce4b3d438c968e603f3c1518ab70be5b7bbecc62 +Plaintext: e40ef8606c72444fd3feeb1873f7ccdd3900760af66c269ad1ee6bf1e4546b1a556d4a90f6397527b270021c226dad5353a142c22963bb818548c3ed504965b2e6eb9744a15ca3c00fef2835d34592b90cc4bef8be904987dfc35e92f835ba15f054ceb760ad903d56c65854fd21f6a03ce9f8f16c04ef7ad9507b5cfa4b373eb544f2bc61bc16e371db087fb7bb749463c16f75 +Ciphertext: a31ae696ac9d66241bf9c826a381c4610de7f6416b153d7f8cc17484f1eeb63b2bc25d7c9b8a486e3e8eed6d34b4604ab5dbca373a80c29d50f416bb4ffb8485bfc6f7b61328f7c708360cf93370b7224b7cba075becafeb5cb62938b396dcc789900d8cb8315ceb460a753f20baabb4c6f61526a012e305c28bcb59fed20565ad1afce39f98b354b67a33daa8425479a07c0dd0 +Test: Encrypt +IV: a31ae696ac9d66241bf9c826a381c4610de7f6416b153d7f +Ciphertext: be217c97aca7ee0c1be18f1d93ccdd0f26d751bbbc36ca29f12bbf4afe83bbf7a749d325aad3b6af4913dbb83b09ade5ec79d88b755f7b2ba63df6ec458627c83e28e4742bd49396f19463bd597902de42ac46ba675d2f0c9db8d39dcc56a5e9233264be90cfed284302b965ab0f0748dcadcd02354c1f81d640a359b8ee5aa58a1908de1356031432b6f12e22ae9ee9f847f0a0 +Test: Resync +Key: 017f97c643425ef0ce5c0a6a0c6dd67aa6181e6aed360adcb103bba88773e1b1 +IV: 8189c8cd17a945196321cb6147cf483d785eacbea352fe3e +Plaintext: 145a3d3ac4c5b57d68d26a1ddabc71289929b6dbf317acbb3d83313c9e4861fa9d9679de974e4f7eea83129cb8f4221df16cdf545e000e087735cb37cb321d097b7b2f4874b74af6a6da9c429b1e62d418066bdff5ea0ed7c3 +Ciphertext: 90551d5f8ebaa8c1aeb52d893ddec3e9cb95f77b8bd5f6d0b3f8a3fae5fd8d9c1e42a96360e8e7e6cc9b7711ee1d61b4d67e6c2d682215c59a72778756dcc3fa93068889219579b2a1ddd85b0e69880913cd2e9be47b93ea70 +Test: Encrypt +IV: 90551d5f8ebaa8c1aeb52d893ddec3e9cb95f77b8bd5f6d0 +Ciphertext: ef58a8589c2996e1fd990d7ec412353edcef7dff079ae0ffbf430f3a479818352647fd8640a518575a3210fa45f7df5bd63532273d54c442ff02918aa79176c137cfea1a6ae167464183ae716a0f6057be891537059ac3322b +Test: Resync +Key: e9a7e6aba47b1d9c1df629c6920ded6894b85d3e7fd211bbcc7a9335e5cbf7bb +IV: af86ca3a196464931fd579bff601c9fe7fcc7a10d7778d22 +Plaintext: ee681bb5ecd15201f433a8f89871109aff85ed5a4a16a7ffe032fff60f1acca78cee6532f7740be05438da05933c8d29fc880533d589f6029291cd0a965113e042b27734968784f871f9e9e6c2a7342bc01fba3ef666aa0e018957169f2213f492acd0d2ab82dec47d8afe7a6bedee72d0c5c7ac0d86d0af5238da822ad4e6346cf2ac76faa64d34051a91659009976d140534a4f2a80f2758a912eed692b62bda4a46649fe58563707478746c77d658f481ebf90c2cd5ff3276fa8dc36739084640e319282d74479084a15838b9822056e900f2050d0f48ed52a3a3ffbdfe3a1831 +Ciphertext: b049fa161f19691f3bfa783327d2663eb8b7f188b301b17336f68630d8e001349f659428fd29359c15e95aa3f5a9f46a92d214e0085ab661b511831d00fb6f496e171b8c139def92be2ad8f6d94c2fde48f9d77ea338b920b2d8d6ad380ce761faf170bbc05128e65149b29d32aeec45e2882362dd2d0e3c7cf9634b9f52c578cb2e1d51b5aad6447f4d1860b1a1f1b7e45bcc002a5f4f03dd7116216414b0be23876b35ffb58f466a4087c992340437e89b12151a7d8f1af04aed585f5feee36f60c1b0e19251c7587e8590e7b6bae774f3ba5f3be2d726c8da4da3824debffedc3 +Test: Encrypt +IV: b049fa161f19691f3bfa783327d2663eb8b7f188b301b173 +Ciphertext: 7cc5bceb953ed1acf44c3a448a15f07c4e4db33f863bbc2368acfe699cd18f0580e3ff8545b946c15dd0f5c15e355fc4a10e340035e91c60b757cb69bbee8d2a22b20066b15929bf3506f2b271326509552b6430f4b82cf9b38ae83124f9b448dbbe049d7b3a98bf25678a72965f9656df149bc068e4cbea8573befef8c70b32d1dae7dc9b74601db95866dc7b5a3b307ac6ab9d09f3c55b6aaeb34c8b0e77c724666a4cea694ee90129568a46bb0f8380d8bac4f6151e84d357f32488ef8d62a08cb02255de04612bec676db471ea2199b9e86fb8ad89b259c0d1ac487cd95a5430 +Test: Resync +Key: af768581d5e401b02de76e6986de0bedbfb7130b9014727194c1d3f02c747fd0 +IV: c4568db83cf9eed0c05629951afa4fe5b72c055d89421efa +Plaintext: b34095f5b7660a03edb3e2277dcd3241270c9a7b890cd682214ff979b725148b1d836346ad84bd776ad748f6fb063c15fb763ca5005e9af95840f2677c1904090a19d83dcbf1011a48c23b620eda573b4a61bb8b86fbb7260090ff6f788a9dc27b5c95c3a3ebff1dc6f72446a23740179bf4dcb0169624d1ce2bf17c79dfaa35c7e12e313488919adf7e56f2d61cad070c164797b9d2dbaf5b954b56fd43e15b61f2cddde618bff31ad545ff163f2482024388ec470329835a8deb0f230760 +Ciphertext: 5b132bc08ec5bb09b5c92587a661c25ec54b8f65a581ab5f788c97c959e39cfb93032c6f63a489deac9eacb0b1a40b14ed152077fdc7b8b6dd5f94501d319d1f5cdfac56dbbedf8a5430843ca36507a363d5694e277ad8c0dcd0c0bd729bbe4b64823acff976f39973ae2d3eaa415f32db86a207f3220054306d99558e27ced2a683699a65d13eb67abb38230137de63c5c758a2149a773d403442cb826d70064c57aa4a778cb3e00a36cc4ebba6ec83dc178a7e4a3fb07c22b77a9c00e889 +Test: Encrypt +IV: 5b132bc08ec5bb09b5c92587a661c25ec54b8f65a581ab5f +Ciphertext: 907a2c78d9e0064b600c1d20985b6268b48cb8e7af87f615f8c298316b186ef64470b1c3c05f46096697d84ac390a3d2e37cb2306b718e7c48fb624bb1c5b3855951444f83e0433e26bbe2e05d8ad375633447a9f1c0856e35c6996c4fe4a477f503a47818ccd364b099b8d640ff2540f892e6a8e915a90b96b3ec13ec18e81a5c5e9f6054e6c90b49892e22ad1f0911a33740fe0719845f5428b0911b220ccec09a73cd8a790afe1ad4b76480c5e7718755fd2c29ea2f5f3cd7608ecb7bbb +Test: Resync +Key: 215f4b041d68a316d29cbea833a9d4170c32c5ea0aa34e90b4381e642f74231b +IV: 0b9e85d8e3d62b0c5b45ef1ead0b180348c0c82b2325beb2 +Plaintext: 68a7cfb070a3ffbb5a1456ff96703d56f84fbf74d92573368def92bde3b49dc9cf8ea87dd8a51d4c12cd9b4e1d20d5939a20b86bdb9fe5c76a10bef983c871c559741ac89155eb6d1a226c2a371c03f3bdf2b4bc +Ciphertext: 68d6236f9df3727c9a457609c0b59e393864855160b1e2074257f72d8b122c99fda40d6092cc96c8134823ab93545a6f8b43e8efca9502b5db2ecb86af5798b45639dc41b34df49782388cad7d1826d9d165b79f +Test: Encrypt +IV: 68d6236f9df3727c9a457609c0b59e393864855160b1e207 +Ciphertext: ab148bbc10bdb9a086c2c94c641225bdd8bca6f04d11a7cc5ba7eb728f1fd84522d3861a648ccae4e03f34162058f560028680d986c4a71e5369a312af02d135684b348b2cf42df1ab7ca841d474b3b51b8b52bf +Test: Resync +Key: 2ecbb5a282ee515b3226952d11d0579607f653a708d18920d18dc5106f76074f +IV: 53f67a3bada58382426b7d2142c327c7a9fa75a8634463c7 +Plaintext: 0878ed1298af132502bb5144066d26042e4a2990 +Ciphertext: f8ef2dc3ffca9dfa4d006bd9d3c00d7517fe0971 +Test: Encrypt +IV: f8ef2dc3ffca9dfa4d006bd9d3c00d7517fe09714d11a7cc +Ciphertext: 488bfbb9058907da6218b81138c26f306b3e214c +Test: Resync +Key: 473ee670e4b93e070c69e4c9f9d1a1808aca67c02dc9b8250034b9a19f0a306f +IV: c7bc3457a0d5b3384ff35ac10c8b09a114b09ad8e3d1ef6b +Plaintext: 09ba3c2aa122ee53878bf46711922fc946d67085ff68c3c5f07da6749194737b715bdfd4d052366fc6761c5aad4931808033b620f7e47d3c6bb65e355d66f4f577ee42a1881a853acfa6e710673b72ba15cc169333aef8fc63635ae5a7af8154d19409f57121d6580d10796585236812bdee04346084c9a831aea5d4be2ea248a90b9d71fb00823c2fdb522ff00e7482bd9d178766ad26807d963002104d3e42d2 +Ciphertext: 12fa7fe0fa0791d6a1ccb22f025563a9f61b1dbaf825bb59ae7523b531da1d720b816f42c12adeebe8171309aa65a5357d46e719e260af1ed2eb2096ab59a00f08671acf0e3a4ca67843641a5d9be4e2c00f8da7d37349f2560dabd133dab9dfe2ff6f3c087099ebcd2c4420b6485a8e810392310a8dfb61eb850ae70680882e98d8c97c1c922e6358c0ff3a6cb6df77f0ff86f4b2697c698c0440305d3ff03c1e +Test: Encrypt +IV: 12fa7fe0fa0791d6a1ccb22f025563a9f61b1dbaf825bb59 +Ciphertext: b069c6b32e99129d65d0e17dc92106edb3949710ea7f84638137073b706d790f4c57db477f4f40161c029f1663ca17fa6ffbe8f6d1e10d94718cc7cb75549307c2e3da305bd33263d7f80d8da26ddeeecb95a241f0d0dd636ca54f7129ee35bd49c707c52aff4a6fb5f520575d693949b8a1ece03cf093663c86b8cf97c89b87fc76cf76d9dce6791c499208fcf7a2b7e868f625a940b5721bee984bf3ba0925cd +Test: Resync +Key: 95d049394412ccaaa002264f391f2448837b9a9eaeeec49ae73f21c3bfb83016 +IV: deb9499a1b4043f0c116133700eae22ea61f45ffad305c03 +Plaintext: fba6e561dbb8d9d3dca1b6073d29103b758c463c5ad756920f66dcfe88fe0e4fc21b6aa382b6b96ef5785d51bf4c6b2375f7ca4494e711a34fef708ec09dd10311d312f7aaef6828f112ffa786263f1f9507ecd5fc3a80bc3fa75c17d272ef1c7cac66097a46df791d0d61a22a68dc4217f7ce54abbf7d4fd3fcedfb4d92c4a87657e15aa3417b62 +Ciphertext: a081927e375175dc84df664d824c351c9417614523e0c30d9fc5b6ab5aadcbd9d3a2fc28cfd7c11a807dfbcfdc7d28a54a5c44e52f6e9806a1c08a5fb06f322d22a91f5aa5097b9cb12ac29d5bdbbf8312fcde98b79c6cae3a26c9828874f9c8e2b072b6c1c70f15a1b6464c722fe183fb1367e03bb3991d8de30396aafe160b4669462ace11bf46 +Test: Encrypt +IV: a081927e375175dc84df664d824c351c9417614523e0c30d +Ciphertext: 2629e5e9e550bcb2d80ad3134a2ceaa80ebc96a68d4cb9b0bfc1e78b8b9b06b6ee34e242a174f65f2c74688b740aa9d52f14e900436c020c10b860f7cc8063dffa9b5baf2202a8ca05a3b52bea40bf7dc3c9444989f33e2ff0cc841742df284ea75c6dcfc9a2eee78dd9ce6b29255979b4abd333ed1ed92d19661850d42ca425a30d3aaf95a201d3 +Test: Resync +Key: 9a1831352b9bd922b41cde1ad94b40b3c2f622ffdd633d03f5638d2ca01b892a +IV: 4539205c887f099743e9ebd3aa4ef88ca7eb0a957a1cf8a2 +Plaintext: b4a37464a37b3691c7fe66a81572f535d780925b3b28dbc85b574edc2b6753278994fbcdac780c6f09e153fcd8a2ffb6e873c440dabcbd081e7bb35098c29dc97248dae7781dbc3b00d7c097c75a2f3cc88bf6dd1989 +Ciphertext: abc902e1dc5c4e5d858597347ebf523cfa233ffa1c38b7d8e8df8cb5dc75f08e74cc7077352efccdd18e39820bf03a39ae1aa56b3f07d92b148b26d6214d710167004b338c1f9868b6932b3d999e60f84ec839dc09cd +Test: Encrypt +IV: abc902e1dc5c4e5d858597347ebf523cfa233ffa1c38b7d8 +Ciphertext: 7b2d46034c39cf770b075dbf8eaaa19492e51e451d1ba97a0f4a71c466dea5dfa1d506ff3c7cb90fe276dfd73a6c0ce88e0df56ec0429872dbcae451dd19d2f3e58ac420e83c97909dce9673e7785cf3a11df9a0b062 +Test: Resync +Key: beed63202b4bb586cadbbb8b6893bc6ca2c07217a3b9275b499245aaace55383 +IV: d22603bfe4fe47187d969fce3aefe24beafb9337ef886980 +Plaintext: 375fe2819168ed3a1bfa7f46e037af06f202f1927b78606a46a35f41e23806817a4151872a5738ba76fc6bc736208124d2da5aaa952276125eb5ee95ab9668a7e773a2c429acf296979436ab21bf8bd77f31ab3023bd7fdbe28b93fe92ddabf0bdb1d990d628bf43942d728cddd330c8b79ab6a270877b789a714095074823637880bb380ad826c3a5ec6fd46c0e2b5887dbcfb101fd84 +Ciphertext: a9b65651c6b7b3a6322c21538d9732f2f31beabe4e94c288aff4cc0bd18dea04f15215343a07e16eda6eb535a04f0fa6100bbafd8fb7e89ed087e662cd5537ed321351d19b56a6dc4a8cf50078f7bc9bb9d2982a0ffc8d24e1814935a9ca38edc6b04105a8ac488437946af107e1bf0838db8ec4066646692fc61b9d94d09a83d63913838c1e88ef6845de6b32e261ae972a6b70e72d6e +Test: Encrypt +IV: a9b65651c6b7b3a6322c21538d9732f2f31beabe4e94c288 +Ciphertext: 685c9adf5239c2f521ac91e3a335267b34ce2aad1760f8771c51ac8c48ae1b93938ae2fa2f988b7c87a43c8cd4a97b5e65c2d11aa878c69349308922bf63dff3a5579d549d22c0028a336aac48bdba88cd9654e37746d2728ddf653c7eed0b0404df6f5a4342d0d7e1df8841da0a249313e105e2863d63fbed1ee621ef5e57f48753dbe3d2fc08d15b5244bdf0369c1741fe92fe3b677e +Test: Resync +Key: 8d4b9a4e7e3107c54a75a7c74b93ddf9c44adeffb07a503a05d6a5f287244808 +IV: 7abba4d58cf460f394f80bc9a080a355961c4a2511f50947 +Plaintext: ed3eccc8be0e5ae6d90eed3b15357050171716c7ae56bc9ef7224db5740257361b83aec0d8c7dc7a9e1df44e0f3fd1b8275bb6c5d6fb8d172df4918f39bab0323a5fa7c4a98aef3a482394882daf5403767f639c0d651f01b9b294d511876c4c3c471f7b684900c54cbbc1143d8aa690d7ab98a41fd9236c31692b7d2406beab5202e1b617ee43a6b9c8324404c4862e5fc0301ba8ac7d7b65df1eb36bf038c85e51a03f1b38a6fa74b0163657eebe640343b83a94ef09308ea3f98cc30ad9 +Ciphertext: 5cf10e20d44ba83ba4b201c7176846976b1a10a98d37f006a9b1ba01b4c81db6e97514d0dad76855d95483f3765b26ecb5f8403f8bd65a79cdc220bbc39a35538dfc757431c20b22cc825633a9af1be926f1072b38d2e89dcc903f2d257592ca97520c869abd4f2ec41b10adf0a2f7c56296975869dbc3a2e1465d32b7781991747ad3d141fb0c343419b76c5ce4facfc257f666c1dd020bdc8f189aea79d5c77e63f42da60510ba86ec2b1c934b90d77793b5951faf1c94b5e3ce38d869b0 +Test: Encrypt +IV: 5cf10e20d44ba83ba4b201c7176846976b1a10a98d37f006 +Ciphertext: e23e817a9c4c2740922734bbe3cc5fad938020ed34c0fe401d4da9cee010d4d1056b71d28856ea327d495c643d819d2d4ba6d97820909a7ac222b892aac4ab130610fbe29311f28432303af69d3dbd3a696fb35582aef9b7040a7e85f6c48d31a3d0c3f1cddb5251bc01a5ce0ace8c95882228ddf7c57aaf1890d70b899631a09af5f4130b436a69ab8623e0260cadebad595ba3d27da5df9e62544876d4daa3fe7af8ba8bdbb7246af0289903d69928c43a1c720b948e2d5a0e8b0d062fca +Test: Resync +Key: 39efc9016ceab203c0e172a335d7dc2916ff577f168904648dce170abf5d21ba +IV: e4e0a36fd930f726ff81007cc919ba0da8aacb5abab72394 +Plaintext: c1229356fb463b251270dae5bfe6772135af17b0624454edee3490ae95616c8b4efaab8a6b6f2a83b083d4ef19a86950c6b570d9000e94255087ecaeb56fead57eb8c51ef71fc802f9fd9d14f462fb5568d4206815e7f3473442b5f9ccc730fbf86a45a008f2b784d14791dcda532578e3ba17a0a3733bd518e15d2a65eb6c79a2130d988db4ee07f1f557a9a08aaa77f28744cf928829c940f70ec541a07b2646f4860fbda22f95cd20018deb68159aec40a889e534dd071a076b46d29a3445c8cebdf2ae0ea6ca7ecdfd203e5941581db5a84e66828f2c3e1b +Ciphertext: c885db1a0c9211392f2cf3cd655170409d53fa559acc66faf0f75766b4501ce80b739f51b985ab10ebcaae7adc2b58c1315ded28b77a2c1c1e3bb65b7d9866827a8b4a39f316222bf0522f3c4cd1ab367c6135cd1b104fcaf4cc746e12d3c72a5cf781d487e1a297d83822c6b68c1b5a9a9505a9b64963d64b2d50ef487057aec172cd070533c400fe0d83f79f4affb1be18fd9429d5dda1ed35c71d674fe98788e3b488bb3b5a781fb6689f8732aa8e4674a5df2643b03a332fdc3d5e10bee7014753a745b4e7bd2b579b8885955d8141fca840204da3eeceef +Test: Encrypt +IV: c885db1a0c9211392f2cf3cd655170409d53fa559acc66fa +Ciphertext: a65f1a87049667811331f8305128b6c06fc3becedae1661dcbac3a627d27cf80429687178b1ff1577cc99bee4b311c480dc3053a74fa523660e9af670d852a032e69b65bb2af61af8a2db4d3aad0a4b27ee74bc2203ac502d188975463f050e3369259d676881b1b318a1cd26094923d2c6fb15c0b522952c176c3cbc01252a4d64f875aea09a9295957be06209ae896410f5665422df60dc4038dc9ad1a45f16350bb433054b9a14061b5eed9cde905ea59f15bd1f58811dd4df49531138431e9d57a8a9adbd4d4fa472077ccf40a2a61affb82242db08f3d27 +Test: Resync +Key: 3070f0db09c523507d36404dac79038a393e9f0e3cf5f870b16d2a06da68dcd3 +IV: 4afe87bf79eb938d786ba54c26fd6d7e62261eeae8b62202 +Plaintext: f4ea120b47d15466ade07df0f2ff508759d9cb1035ceeab43920e9094fa50b868673b07173557d4b994b1e9d35078c1c7369df6b6adb2ec0e6bfd280fea8ac31db44beb0c2a4ddc6198957bd0592e3e587d304863b893ff8eee0efc70ced5d712651c3e9dd1a0de0480fd8cccbae4c50dccbacb83dcdc3e2cef7dbc645f0af468163fb0e015ef48ad74694dfbce2db8430a6e91645fd16adbb72e21a0fbaedf5ecff829cea9cbc22f82902748aa52da5ce903d9f2bde77efef5fa3970c720e89f25dd05157247bf0de2d2129c3f856238d4fad +Ciphertext: 46f396f0d2d54189968bf56b5b2f35588c3ad851e00fac6507598f3ea0193a586c00b18677811cc305b0261d9aebbb9c0485a5800c940aa4f09c4fbdede12553824c429c7954e0b8dad889203d292517b98a64e8d7a37c1364eb0934751323d9b9f8498f50d729e977fb742880222f22ac5d7bfebe6905a4c344d82027398a70c334635792deb0f20b83861b05e731f5627aee17df20413c79957556e66a970085e9ad40a73d9a964381584976c6f111619a916fbb5f5d305df862d5a56bac9ff9b436f31c85f34ff890b5ad3299eda2b8642d +Test: Encrypt +IV: 46f396f0d2d54189968bf56b5b2f35588c3ad851e00fac65 +Ciphertext: 358a8f5e5c6fe93c3d6d7d2f90f5973ba2c0cf7c4579c92a52d1ce6203ddd90188d3e36ff7cbe94e7adb4ec7596e89edcf3a94dba1fe64eeb24e8bec5fed2ef6faa4f0d16faf5853e8f69ee0ca0e048658507bd155bfa13d487c3b994f3a1b8871996eedc2d899d9d79ecd8ff968000b863337dc04d9ad8d05696659f8a1cae880e471621ea13ec42d163eecfdf9cd07bf0b10d6f4634ff16d26c700c88831efc82ac0abd0269b93e302422cfc2dc4088e28bc22ed6c06c9b51774bf3aa4088a6a18fa3d3608f9927837efc3382b25a7ab873c +Test: Resync diff --git a/cryptopp/TestVectors/seal.txt b/cryptopp/TestVectors/seal.txt new file mode 100644 index 0000000..a1ca35f --- /dev/null +++ b/cryptopp/TestVectors/seal.txt @@ -0,0 +1,137 @@ +AlgorithmType: SymmetricCipher +Name: SEAL-3.0-BE +Source: generated by Crypto++ 5.2 +Comment: verified against partial ciphertext from 1997 SEAL paper by Rogaway and Coppersmith +Key: 67452301efcdab8998badcfe10325476c3d2e1f0 +IV: 013577af +Plaintext: r1024 00000000 +Ciphertext: \ +37a005959b84c49ca4be1e050673530f5fb097fdf6a13fbd6c2cdecd81fdee7c\ +2abdc3e764209aff00a12283ef675085c1634b53289059e6a7ab5ed9480c01eb\ +4c64569a8dce2a23feed0ef58f6f5ac3f74145127dbcaec4bcb6b1a459bdc287\ +58ba0523f721c3e154433dc7353f02ef487b07ad309ef5e44e6cc19026f5fd57\ +07cc32ec12b9c01fe0c58beb2fe73ea79e24093f05911663a76b21beab18cede\ +17275c54d18fcd3e4cf32279347b22f8751119fb56d92f55d511e4ecc1334085\ +e74934455a2daec3f1821c54b4cb809053b8d837de4186600afedf8bd72dd56e\ +223745c19f76edba01e9b5346666d01f677fbd68fa5010fd7db8b06829a90da0\ +e81b84756a70946a6c05e16d225a2e11af586bb1c5b1d21f5349f8e5e3ee41f4\ +232d554954d1bc86064754b86c1dc92d7a9de30086d8eb4a7c86db9c380f13b9\ +52e11c5b89f1be0a6b52c6e7a053da7359c5fd7f50c70232d86aff08c5ff1746\ +d3bd074d79ad6fc657e0cbbe5d02c4fce55d3c31fef4642ed738f751430f2f1c\ +f6e453ef6edeb9540cec52c697d4864201e141e06c3ddf5aaa64a1a984247e96\ +d2cf1e7fb2bc239919369f4a0bf9d111d0d8be64afae86214d5f62e64f25e8f1\ +3e12680ec170ad6234cbbda938df53cc17a12afea1eb4005122a65cb42bedb76\ +edf029db910fc81b81f3dd28341fed4064ce37648548e5852d4aebb7923016f9\ +afcb07ae7bc11800e217a0062f0b53ffa8d471aa78ca6a13b7f5647189106773\ +0a311d6fe4ff57f05f9a58aa742696b6cbb3ec539da0c2aadd6a60d2a33c26d5\ +8a343448ed912aafb98568c6ae1cb1efaeafd81a6e3e7c450f8e2be4c6cc18f9\ +5e8a1c6c59190a2798e912a614c1e7d0f7e74b1baf8e5682f5442f998b24fa86\ +d1e5f673002e2c92db8ebf7abb1c9d267a9763f4bd54f7bbf07c4466dac0bf3f\ +faf5666a43a52f0812e76df5f9d4da8ed1bc6d4ab29b34718facb4bebc11e907\ +fe9b0e3937de7769fc5b0cc52b3e50d57e02b9b4022949aaf3698bc58f696073\ +ec972a425caee9700864d3d166130ee09d51320b9d51bc9b4aa575c789786242\ +0698d9e1f6426fd141a32c9f55c24e5149e274983035ac1c44833b0179aed63e\ +a2b2b61afa54700155e55c7c343412584f7b0fe73d63c5ad88718dde3000ac1d\ +b4050ae2610032e6b389eec48952a1a2ed0016e525ccd9616706caba89ed07d5\ +4f15ecfaabbc91b7c82c5904bc0f83d44888997faa11fe8fa7333cb8c5b16e31\ +52233c80fbc9f71d9ee8fefa50d67a7e45b93d3469ba4078bb1ed5859e7a8e62\ +b26bacf538507fa6bd43e18d67d7aaf27baaa68d233ca392ce33e257d5ddf3fa\ +ef6a951430d686f65ee9afaf6aee0677b41098922b41fba202ef05a27d614612\ +5daebeb147d617c8df42dba0b91dfbf8ab5805ee9877e495881035fbb7342c24\ +e24f3b85c88671184152ab0d395a9a81afab3bf93bea49cb23ee6bd1c9fb84e6\ +4ecd462f60119ceeae7f1d2150bd36fe7ef2782b0fd12b55df119a517103d489\ +0a739b715d3d33e2ae9fe659df4bc0136c0b243538eaa8f9b813043d66ae15c8\ +261c94c0072afc802668b3151ad1c0ab0f034eb3e8f2fce0c9fbc8f68404fb93\ +a1cd11f4eb9a5eeb9117462ea602ae41fbfe0074323e56e15deb04d41f3510cd\ +1df417f759f4c2bee72bab88833e7d3d9837801f16901ee12581588fa7037f74\ +073b2166405d79098098fb196cc4b1733e45796fa7fc977cbd23853e5943b2ad\ +e154856565a455189198f6ba50b9cc6fda0c309a413ccc746bc8261fd6b060f0\ +5cfcc82894125b3f1e0b0c47257fd838cf295aa13102724163a9fc2598fe8572\ +d0bf844518dccc1ee16eb8e4c9935b78fb969b7c3104091079079a7688f1e833\ +0335f63eabfdd3224a506bae4ea3022a8a4959f4fa410ad7111488a39e3c1cd7\ +a28ce83255de2c4477fe62f660af3b7ba049240aa5212e4e9fffd8b66fd51b17\ +0bdf6c7e7214361a7efdceae86878f49716c0859ce2e24979bae82d98025720e\ +06d7904c9646f1b1058b1a7c93ee4fd728c4f19051adf2ca30f4d54cf65be23a\ +7198e5be5765c018bbc1d2344fa8d1aa908cb8f789ea793c6c60d9a7ba9eebcf\ +7aee50a54810cbe3b632144956a157c220e33a232c169cc9ae64d6aa3560a185\ +fc2d94f15b389eebad8d07662c2be6d6349ece8ef88aea27d430ec9512ff1bc0\ +c5560862fa4a833af750d968e9fb545e3879571ec021735761da937e294820c6\ +585ae00e8023f48a4e1f392217df763a09e540ca615188345512179f8889902f\ +38c626ea3a333fc367818b058dbb8d6aa474ff3438b2de2b32822fdb93f77618\ +83b89223e0e616c885fa3414905d098d82a5359f629ed11589974393cfaf4695\ +da7ee36346d088a6ea6ef21ad6245da8de9956fcefc930c4e2759b596e3f98d9\ +2483b2bd82b74269caae2014f796ffcfe5db58759f0cd4e527b16f989d9cbab7\ +f20282ee2e666cc19ad64aa7a36193ff248002c762280a98f3ad2bf07b32f26b\ +eff5a5586d967d844aba69f7297bb1e28075273f39aa6e7c6c7308728da8ad30\ +31a2d20ebe99940732f93d0440b6e3b481774b69eb76179496350983031c2611\ +a27d885d91ac37debc02512edd06e1d10061325c5e04269c0c14942d10f03f83\ +06ef173d645478d79c74990a82df4b13f2754f273227f96988c25bedaf392534\ +69d73d642305f8058ce4713f65a36b822cd98da3fd805c4408d18dde4ee8e794\ +72e38f8683edbbfdce8d085e005407666eefba25d8c3368c6cb656a699b30736\ +31b8024eb6859019feb76bdb5a0d7f17c92a37fe6bcd14630c1a62bdde1e41b5\ +e9ab7306183a16c31554821ad44229ebce2e552f9a09fd1607dec8c92a1e893a\ +b80c331cdc7860093503cedfd44b3403b3501415916303baef0c68d12efa7c54\ +a11af3a7df5d23df98cfba907dafad0a8989c710d4602fc75f663fb16039d94e\ +f860f358bbf05ac9c34865141030513c4cda32e9b777d9fd9e4ebdc1ad0b24f6\ +799f815e29b8e2259f94b0215b94b349938556736d3ed578cdcea9024d71f174\ +376f05b3c203cc56476dd92d07ecf7e283cc181225a2b690eeaf3cffd35bbda9\ +c4ed0456661e2e39f6be537d2446f65cae13a6dea668b04f8f223601629cd3d1\ +1b75180dfea19435bae5e0622c5005371d4198b8dc1e0c40adbbe08d3651d345\ +4d68507f7f0b56d4bf2a328bb68854064699d0a38d7468ef64ddb4139644fabb\ +d21ad79b5f28a5612e445dc5673b2038e3f7dcf17a12ab32da214fb28500ea79\ +00491554da45661a03e2a878d1006d4fba8e22a7e5dded9b02fb8b5e6d166aad\ +43f8ef3eec4a7050a0304d46cc0be3ec97f0bdd137eea7c001bd8519101ff3af\ +76d1d7710c22c5b0a69c10df3493283254f5afa2ce4b3959d3be512e6ddb78da\ +30cc0a338d675c8fc3fcbbd313b696c660a85fa13ec9fa13ac8e8dbce8335575\ +608d5962ecb516b9ac186206e1ffb971924e9301e6fc220d0769ea1cd954e2fd\ +dc591ea026e369509d427ad062b81ca5e8873432a0d7a031b7f26702840fbb5e\ +5e9e6c8794dbec841822ca92aea2a22709182a3cda136b7b3569d85be6213817\ +06b2852b7de3e20907739958726334ad0c2c3b7327d0060b3f6cd319bf6666e0\ +9de3ee588abb948a6df37d5ac2b18c82d63ca0a0dcc6f1c1e2ae609999f60738\ +714df767fbf14b12b7a002ce0dad86f8adf777ff7ccc9b08180faa0d96b44023\ +3ca5398525eaaa9afba9e0ea4f2cfbf5a3e868f99ddc1a86ee36baf2ab56f9b0\ +b1ff1ff591033e579847267b9557217e0991d2c90e61f7e58321d9bdaba96c9c\ +63e9d3924f0a8c7ac6d4fc94d74d7bc1a96aafad76fca0fa4017d76f00f5cb5e\ +96058fafb57caf07cbcf665fea359cfa2cd4084796e3ea2ccf30bbe6e8f7efea\ +60190fcf2700d1d27b80ff53d8071aeee1ed8708617c92d821f83c9a7ea90c72\ +f19a58e9179cbed5f4f86a80c28e0fbc3fac50d5eea3117df747ab076044f1ef\ +61c7bb95ab31ca2f4f6e61d19e906230694158df40a72fb748dd79d0fd0617b7\ +24b23c6d0569d170731ee07dfd637820f10fbe860a179f2a24775b1f27a2e528\ +a5808d13cc3f995d2cf0c4a832915e19bd6293bfae8eeabcf85de223c4dea84f\ +0d095815cd34ab885d6c50816bf8fd07d4e58aa8c8fbf34344fc3279c1efa142\ +68471ff263f121bc501439c9fe1ae45c946b348a00535ae451d17f3edcecea67\ +5a7dde387813246bb8312147163f813159413fd550e00204c441b0eaf4d12c79\ +520a3d3bd75b00e20a5284457fc3999ac7ce1f1202e5bd651047c74eac7ff92d\ +7f214d6583304f6dda309a01230198b1e656c9707f2f27663c1855771af7f449\ +0e3f3f8da53f0492654a3c40d15620e2fd2a68658ecaa8fb5601775a393878a3\ +110d75e6b968db8eb81c2ecba5852b2eaf7f9b8967b60f92ee4af138a5e777b7\ +aad802e39d7237a17b4a79d9a467a4be1be5121de907400ee5586f0f94bed1db\ +35dcd7995ec93b49b0f6dc7a1e3e4cc0ad1945e60dbe0d24948eb94ddbc45e20\ +fe0bea593df4e6d38647fb623df65f6fbd1e36f318decf77824abd6bdf95eb8f\ +a5f29b650f36b77a305bf9c15b034a7ce1f482ccba079171a6476863a70bf49f\ +cc488177e461837c64d5f5419ae0a344010df2d6edb170b1461ef27024199b15\ +44144dc327eb225f1ee99ab4f07bf2f934042f2df86252c4058212b2e5cf35dd\ +14df206c1dba5445d41f211911e1053813a09e7fea3d5de5cac92acfe36b3ef6\ +8d4767c52a31c8ccba0eaa85874892d813ae601db1ffd5cd42ec1e98534056e2\ +753b5fa30f993016b787de9620a1242986370e005ff4495315c2b1aedb59a32e\ +47be953ea41f15fbe7a115d10328f67e59c538948ceef3f4a338a030ad198b2f\ +c89f067b336f28085a4ca061a38ae6190de48981de1c942ea83a9143b1faf94c\ +2f462a9de5d14b915bfc52e916d16f11cf59a28a3d933fedb48ac06b7cdd29a0\ +720ed851863bafe7a149f403881afe46b940ca37c29b7e49a730b28404179449\ +73274553b70fb11da65acc1c5420677288c624e67542f230da340d1e9b8dc5a1\ +90b69bf5e67e77929250a802f07cdf0716db567209774367aae32e0c1e90928f\ +61c43eaa372f1e9ec70aa0dd506734d23825213edaf184a24a1bb128811db664\ +783cb27cac1edd074d79d1259f84da9e0e5c75923a4dbfaa8a6283dd2279ba69\ +bcd1d78970d7a54a0d31c44071cbf05527010e2ff808cadefd74d906a8ad8c32\ +a01845d3ad78bc6ed96a688dfff171d80d931409d94c83da2bc54ad9790e9a6b\ +a5093384850090a961572f6fdb929a1a6baa98c015e95b0a6da10de04b8471c1\ +aeac19b6c887c1c81dad641d55ab1a29250d14dc41a042f83eb8a6bddcb662a9\ +3e00cf6adaed95cb52b36692f43a8e9b85ba7723d70e5ada851a16fe102ee1c6\ +d3bf8be1634ade9fa6b44626c734788b3aed0c287ab7e80ae5fc1451ddb037c0\ +f729309209226022f13e6f8aa592445db33bb1f29101e0df15db15df0bab6411\ +5bc12f0bbf430551473dbd274db2eea9905eab75f290ecbd903b675f1ad9ac2f\ +2196d00139e7671ac8b95a8cc8e244511d481863b509e5bb7573b6ce49cf0fc9\ +53de75523ca31a64012d11bb7f60f1f67b199a4f2013f6ea3808e2639eb5f263\ +1c19568bcf36071235de8ae7b2d5815e2e0a2e81098a6b4d6179e29ed0a92bdf\ +585a2905f0496ba58eb3d740efa54b664d1a6134fed9fede636504aa691e08e4 +Test: Encrypt diff --git a/cryptopp/TestVectors/seed.txt b/cryptopp/TestVectors/seed.txt new file mode 100644 index 0000000..983fc3d --- /dev/null +++ b/cryptopp/TestVectors/seed.txt @@ -0,0 +1,19 @@ +AlgorithmType: SymmetricCipher +Name: SEED/ECB +Source: RFC 4269 +Key: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F +Ciphertext: 5E BA C6 E0 05 4E 16 68 19 AF F1 CC 6D 34 6C DB +Test: Encrypt +Key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F +Plaintext: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +Ciphertext: C1 1F 22 F2 01 40 50 50 84 48 35 97 E4 37 0F 43 +Test: Encrypt +Key: 47 06 48 08 51 E6 1B E8 5D 74 BF B3 FD 95 61 85 +Plaintext: 83 A2 F8 A2 88 64 1F B9 A4 E9 A5 CC 2F 13 1C 7D +Ciphertext: EE 54 D1 3E BC AE 70 6D 22 6B C3 14 2C D4 0D 4A +Test: Encrypt +Key: 28 DB C3 BC 49 FF D8 7D CF A5 09 B1 1D 42 2B E7 +Plaintext: B4 1E 6B E2 EB A8 4A 14 8E 2E ED 84 59 3C 5E C7 +Ciphertext: 9B 9B 7B FC D1 81 3C B9 5D 0B 36 18 F4 0F 51 22 +Test: Encrypt diff --git a/cryptopp/TestVectors/sha.txt b/cryptopp/TestVectors/sha.txt new file mode 100644 index 0000000..7980daa --- /dev/null +++ b/cryptopp/TestVectors/sha.txt @@ -0,0 +1,59 @@ +AlgorithmType: MessageDigest +Name: SHA-1 +Message: "abc" +Digest: A9993E364706816ABA3E25717850C26C9CD0D89D +Test: Verify +Message: "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" +Digest: 84983E441C3BD26EBAAE4AA1F95129E5E54670F1 +Test: Verify +Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +Digest: 34AA973CD4C4DAA4F61EEB2BDBAD27316534016F +Test: Verify + +AlgorithmType: MessageDigest +Name: SHA-224 +Message: "abc" +Digest: 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 +Test: Verify +Message: "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" +Digest: 75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525 +Test: Verify +Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +Digest: 20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67 +Test: Verify + +AlgorithmType: MessageDigest +Name: SHA-256 +Message: "abc" +Digest: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad +Test: Verify +Message: "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" +Digest: 248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 +Test: Verify +Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +Digest: cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0 +Test: Verify + +AlgorithmType: MessageDigest +Name: SHA-384 +Message: "abc" +Digest: cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 +Test: Verify +Message: "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" +Digest: 09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039 +Test: Verify +Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +Digest: 9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985 +Test: Verify + +AlgorithmType: MessageDigest +Name: SHA-512 +Message: "abc" +Digest: ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f +Test: Verify +Message: "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" +Digest: 8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909 +Test: Verify +Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +Digest: e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b +Test: Verify diff --git a/cryptopp/TestVectors/shacal2.txt b/cryptopp/TestVectors/shacal2.txt new file mode 100644 index 0000000..19a3d86 --- /dev/null +++ b/cryptopp/TestVectors/shacal2.txt @@ -0,0 +1,5123 @@ +AlgorithmType: SymmetricCipher +Name: SHACAL-2/ECB +Source: NESSIE submission +Comment: Set 1, vector 0 +Key: 80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 361AB6322FA9E7A7BB23818D839E01BDDAFDF47305426EDD297AEDB9F6202BAE +Test: Encrypt +Comment: Set 1, vector 1 +Key: 40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F3BAF53E5301E08813F8BE6F651BB19E9722151FF15063BA42A6FEF7CF3BF3D7 +Test: Encrypt +Comment: Set 1, vector 2 +Key: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E485005217441B60EE5B48EE8AF924B268B6B952D7F593E6102AC83D7DA72838 +Test: Encrypt +Comment: Set 1, vector 3 +Key: 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AE70E355CB7E26FF12421F46CDAD5CB98367FE0E86CC234EDF97481765CD1AD9 +Test: Encrypt +Comment: Set 1, vector 4 +Key: 08000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 00CECD0B01311F881018E7A20BCE169766C089D91FF161346C4E1BD122EA199F +Test: Encrypt +Comment: Set 1, vector 5 +Key: 04000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 47A879CB6785AD37119C450CD50E9A36FE318FA8E7B6C6E0FA963430122F33CD +Test: Encrypt +Comment: Set 1, vector 6 +Key: 02000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CF3D53B9F9F7CA2C66738A4C09CEA9212C056F525BDC26F263FBA1B482EDF503 +Test: Encrypt +Comment: Set 1, vector 7 +Key: 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A274D404E83E82817389A2CB7B528C792A0E80DE879A5A67DE633B0B7DD57B7B +Test: Encrypt +Comment: Set 1, vector 8 +Key: 00800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 09B3AB9332301D4E3C239D192A4221AFD43F6829A705D396FA96BDE1E716BC38 +Test: Encrypt +Comment: Set 1, vector 9 +Key: 00400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D3B9AB867A6868C4400D200979055C8F9E3A6BFB40D1F9E376B9EC89223D7050 +Test: Encrypt +Comment: Set 1, vector 10 +Key: 00200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4F27041481DCF574586CD6D5B72F2E806B0DBC351FEEA624112897A8A64CDBA9 +Test: Encrypt +Comment: Set 1, vector 11 +Key: 00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 77CEC8EA64BB7FAE966D030FE4CF318C318DBEBAEB896F31FAA3C9CBA0AE125D +Test: Encrypt +Comment: Set 1, vector 12 +Key: 00080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E6F96E0217B8BDC6BBF30CB91C05325F493EB076E505FC6469AAA2BBB3A8A60B +Test: Encrypt +Comment: Set 1, vector 13 +Key: 00040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: ED949C1CFC555EC7192464AE86EC0334AD1198C2DBA36DB38CDF7160C950D474 +Test: Encrypt +Comment: Set 1, vector 14 +Key: 00020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 41EB01CC3875F31A6C8D7008C958BBB164813C59435B01879199979FC4762B26 +Test: Encrypt +Comment: Set 1, vector 15 +Key: 00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CCE7C4F96A665DDD23F39A78A3C7898E5F945FE908F1707DBED08BA6BCA3A58E +Test: Encrypt +Comment: Set 1, vector 16 +Key: 00008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5FDBD5741AB5BC53E8C75F4497E37D5BE92B89D2424A11BBF189449AE005E2E8 +Test: Encrypt +Comment: Set 1, vector 17 +Key: 00004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E6C00B21A5B89F4FE9251E53E7AFE30D6C8721678BF842575EEE185E85632778 +Test: Encrypt +Comment: Set 1, vector 18 +Key: 00002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FC19871F6E933014D92721D77BDF4E0EF528A325D5DC979536D6C46457CA066F +Test: Encrypt +Comment: Set 1, vector 19 +Key: 00001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A195202A93364212B989EB2C667EE05881657AD95FB6B3EE62DD21EB73347E56 +Test: Encrypt +Comment: Set 1, vector 20 +Key: 00000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A25B4FB9B4F8418514A1A04078DFBDF73B83B936A887AD6B1B672F1C2AF128CF +Test: Encrypt +Comment: Set 1, vector 21 +Key: 00000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: ACB2AB0F22068D36C160D668ED300DCF32C66FB8447594878DE1B1A83B414E13 +Test: Encrypt +Comment: Set 1, vector 22 +Key: 00000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A5AD217E39C9B40A921B4E52B1B47649C72631E7A99FE4897A92CD1A65BF8BFF +Test: Encrypt +Comment: Set 1, vector 23 +Key: 00000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1185C198ABA5AD97F5DF7850284CD5E34BBE5E0EEC3CE4ACC4FC0A3CE3FA3BEE +Test: Encrypt +Comment: Set 1, vector 24 +Key: 00000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7AC85AA2C5A9A219B8E437C65913738628EE442F56BD57292C8A1B36026B6664 +Test: Encrypt +Comment: Set 1, vector 25 +Key: 00000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6140F926FA90F091603D23A4876A3A5598890CB1F2FDE64E43C50630BE4101D2 +Test: Encrypt +Comment: Set 1, vector 26 +Key: 00000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 365135682290CB40D83228B3F26FD63266EED9C72DAC991510FEFA9B56466E8F +Test: Encrypt +Comment: Set 1, vector 27 +Key: 00000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 928EED2E262D9E398ADA06151ADFB35F34018114E97414C75E390C8EDA8D2440 +Test: Encrypt +Comment: Set 1, vector 28 +Key: 00000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E362280E66204F47E8FB782D18522AA3E1D527C15EBA88E76DB5AF44E156BB45 +Test: Encrypt +Comment: Set 1, vector 29 +Key: 00000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 807E3938AF9C9F0233FDA70B0E26028B390101F238ECFBD53EAE8E2D86552DBF +Test: Encrypt +Comment: Set 1, vector 30 +Key: 00000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E7D3FA388C4E07ADD32E188BD09264A2BD19F0F7EC5712AC05C47B49C7FD6651 +Test: Encrypt +Comment: Set 1, vector 31 +Key: 00000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 891CFD4A18F35239FD4463DE95FE9CAF4569AC82766E457315C123FB5FE6A397 +Test: Encrypt +Comment: Set 1, vector 32 +Key: 00000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5C8E12B2572ED949494B324383806FD61B7CF0479DEB5D62028E83B7091BB039 +Test: Encrypt +Comment: Set 1, vector 33 +Key: 00000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6F071D68C107B19B9949A6B7AF2C79EDC40FBA9BD07674AB3B1DB8CDE0A9637D +Test: Encrypt +Comment: Set 1, vector 34 +Key: 00000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FD720D4ECFB7B68BA48C52E2F69FE268773D73B41723AA51127895B14C516F34 +Test: Encrypt +Comment: Set 1, vector 35 +Key: 00000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0D3D7DEB1F8742BB22C4A3FB88C7C07CDCC8165ECF624C95FD8838D90D465B0D +Test: Encrypt +Comment: Set 1, vector 36 +Key: 00000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 06A524998D1FEA6AF6E4015B9A16B7A447F50AE0A8902E6E3308D3B47E98C4F1 +Test: Encrypt +Comment: Set 1, vector 37 +Key: 00000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9FBDF43AB1294164BC968E113673BB11195AE39267BF2537F0E429E3C10B5D2F +Test: Encrypt +Comment: Set 1, vector 38 +Key: 00000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 81C4C7F2144555C888D876787EE62BC03EBB57093DB3DDE806918707684C8C52 +Test: Encrypt +Comment: Set 1, vector 39 +Key: 00000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F62E7B237C98C5727D4F267AE17932AAC4DAEF0CAF4C02176B4CBB902ED164D1 +Test: Encrypt +Comment: Set 1, vector 40 +Key: 00000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 99CAD86B7E78D9B2ED9DA56F27C9AECB49CBFFC287930CEBC1BF06EA94541E9B +Test: Encrypt +Comment: Set 1, vector 41 +Key: 00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: ED1F4429D5C36B2C16D598A2CE52D9C84E9DE7CD0B4899E47ADCB999CAEDB0CA +Test: Encrypt +Comment: Set 1, vector 42 +Key: 00000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3FEF41084D9CFF6111C40F9656C46D3892323465630B0C1D082255222847D9D0 +Test: Encrypt +Comment: Set 1, vector 43 +Key: 00000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AB7D2B41135ED54EC7AB11C67D20BC35F0C8652D209D675AAB3A33FA264C9380 +Test: Encrypt +Comment: Set 1, vector 44 +Key: 00000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1208F63F213F1A55127900FFBFEB0569B693376D9310C9A9E36EA1DE22CB5A59 +Test: Encrypt +Comment: Set 1, vector 45 +Key: 00000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 10C38678BC2465923063E41B4339D96F3DC5A64CA77A9C9C132D75BC4EC517F1 +Test: Encrypt +Comment: Set 1, vector 46 +Key: 00000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5342519F1181700EDC380133226AE072971AC1AC6DF72440FD817C9ACB862E68 +Test: Encrypt +Comment: Set 1, vector 47 +Key: 00000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 09D02729C71C6E5E852272B853E87C1BAB5E522875E5D8063501ECE10315B4D6 +Test: Encrypt +Comment: Set 1, vector 48 +Key: 00000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 33D7D4F58BDD14244621A960A076573892ABDDBEF36109289A3E8A4EC536E95F +Test: Encrypt +Comment: Set 1, vector 49 +Key: 00000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 81A4590D64E2140414B913AC73BECEC19CAC798C313196007E39EF4F75C7DDB5 +Test: Encrypt +Comment: Set 1, vector 50 +Key: 00000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 942ED16EC4A9D72D74ABFB7E79CDE840997DD2AD83C9DDFAD02528A9A7E0AAC3 +Test: Encrypt +Comment: Set 1, vector 51 +Key: 00000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 8376BF03EAE71EF035E18903AC0CC2CCC93610C48050DB096BE758743234CD63 +Test: Encrypt +Comment: Set 1, vector 52 +Key: 00000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B5613234B5F9D1201A9A581D59BD744B8E59728E5E330B74CBF03B9E81C950E0 +Test: Encrypt +Comment: Set 1, vector 53 +Key: 00000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4750E864B881A2764EC508D0DD4AF06B7B1B123FDCCCA141A74DEAF28070B408 +Test: Encrypt +Comment: Set 1, vector 54 +Key: 00000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B3F29EE6BDF09A16C4EA8C1539CD033B17706436FC40DEBD95DA70BF05BF1856 +Test: Encrypt +Comment: Set 1, vector 55 +Key: 00000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3A91B7730E3FE044B75E75B9BB09BC1550AD5AC9F495AFFB524FAD90A51112D5 +Test: Encrypt +Comment: Set 1, vector 56 +Key: 00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D262DF12E3D8DA99A9F7F011D607905DCBE9AB03C317E81E4BCD076F3C55EBB2 +Test: Encrypt +Comment: Set 1, vector 57 +Key: 00000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 827BD4A79FD82594F645A02F9546906ADCBFF47E2F2D0D0DAF89A200389A5E00 +Test: Encrypt +Comment: Set 1, vector 58 +Key: 00000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E83B866B294780E36058CBCB62BC3C509604F9EB9A44F1CFAFD50F248359A106 +Test: Encrypt +Comment: Set 1, vector 59 +Key: 00000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 8695B4BC5DC6528183B94D5257DC668DCAA0E5A855B76555B65FCCF941A8CCAC +Test: Encrypt +Comment: Set 1, vector 60 +Key: 00000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3B5D549F736D15CFD0F39A42CB1ACBEA370ADAA9EBC7C012AF2E30463DF98E03 +Test: Encrypt +Comment: Set 1, vector 61 +Key: 00000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1C29F7919784BDF30E566B75DBA4C911FC48C1CD7F845406B86DA540B71C572E +Test: Encrypt +Comment: Set 1, vector 62 +Key: 00000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D530E5B30338589A6AE67E0C1E2C57AF02CCEFF84705BC4AAD0D93375E7F2DAB +Test: Encrypt +Comment: Set 1, vector 63 +Key: 00000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AE92CD3DA2022DC9C91E381DA62D8FFA646FD02A1A5A3249AEAD35B729C48329 +Test: Encrypt +Comment: Set 1, vector 64 +Key: 00000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 111318C5C6DAE45DF4FAFF404AE2140300DBBF9361E926900F3ED7F731385A52 +Test: Encrypt +Comment: Set 1, vector 65 +Key: 00000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AA0DAA9A0025B5B3243367C7FC22F56F65A52B3CEEA060825C1FD2813953BEF8 +Test: Encrypt +Comment: Set 1, vector 66 +Key: 00000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 11EA951B966D0B3DF0D6AA00059281E6944CBB9921F84209265938CCE91F4910 +Test: Encrypt +Comment: Set 1, vector 67 +Key: 00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DFDE0D41A657B700DADED5F9CB341481A0183AC1BB51291E8719F77251B478F6 +Test: Encrypt +Comment: Set 1, vector 68 +Key: 00000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A8A42F8E3C2BD71D415EF9FBDBB9DA86B32CFC24EBDADC656B7BFF17FC8BE365 +Test: Encrypt +Comment: Set 1, vector 69 +Key: 00000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1755CB48D8057669C488DF3A2296651F3FB64AA173DC6FCBD2C1113A084679C1 +Test: Encrypt +Comment: Set 1, vector 70 +Key: 00000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CEFD04E10B318145993C0AF4B4A64F623BCE0E04CE04E6D3DDE14EC6DFC0CDEE +Test: Encrypt +Comment: Set 1, vector 71 +Key: 00000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D9C83924493AE365C6369317A4393F904D530C1D30B2FD1A2E4126D0A532A743 +Test: Encrypt +Comment: Set 1, vector 72 +Key: 00000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9B8FC0A924382EBD28AA3F6871B17E1BA9C94418FC3533B446C2DE8C188EABB6 +Test: Encrypt +Comment: Set 1, vector 73 +Key: 00000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F91346BFBC0E05A4076B8CD5640E9DD278D4A7755A6D870565AC2A7E60A7F5AE +Test: Encrypt +Comment: Set 1, vector 74 +Key: 00000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 58D205808D4A580FF8111B9EF06BEE613D51E3B2E026B296F5E9F8520C7319FE +Test: Encrypt +Comment: Set 1, vector 75 +Key: 00000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 15D0C54FC35621B206A4A50EC3DADCEDFE4CCA17C9C5396A18901099A3389086 +Test: Encrypt +Comment: Set 1, vector 76 +Key: 00000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 48DE43EC8F644BCCFF61A52D93BEDEEBA38C71C196203A4A5AD9145416EFF31E +Test: Encrypt +Comment: Set 1, vector 77 +Key: 00000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 253057DA247A8D7A1B4A23E87B67D49669ADE1FE5EF32E08058F2DA6E82D1C25 +Test: Encrypt +Comment: Set 1, vector 78 +Key: 00000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6494B08A0B0CE628E34EC6D7EFBC436687D242131974789ECF20911C0CF16839 +Test: Encrypt +Comment: Set 1, vector 79 +Key: 00000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5088AC91D68173FE292A64D04D9A8083535649D44D7F00F23F389810F5F2528E +Test: Encrypt +Comment: Set 1, vector 80 +Key: 00000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FFF5D0D5296B0C3553DD43C429F51AF844EB6100E373A6A7A16B79A73392AC58 +Test: Encrypt +Comment: Set 1, vector 81 +Key: 00000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4A805BF70CBBAC2FACF405789FE96C4EF097D36F6982B843246C353E77539863 +Test: Encrypt +Comment: Set 1, vector 82 +Key: 00000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5F5F6828D3D2FDF24B4AC2F1F4080F40E9564CD8F9BAFC34E5567F96E2F057BA +Test: Encrypt +Comment: Set 1, vector 83 +Key: 00000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5BFAD855773EF036BAE365C18B6C5784E8BD4673514B0499E7ACFA38F7832927 +Test: Encrypt +Comment: Set 1, vector 84 +Key: 00000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B38604950FA73165F940D4DB527D09CD0B233276CD3808B5CADCCB9FA859AEEB +Test: Encrypt +Comment: Set 1, vector 85 +Key: 00000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B96570996489A74726A70C02CD55FB9D4C3ADE0B69FAE7C37899E3D560A5132F +Test: Encrypt +Comment: Set 1, vector 86 +Key: 00000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0B8612F83912A9EF1082E9D08C772738908BCCD20DE47D64ACA1500633163479 +Test: Encrypt +Comment: Set 1, vector 87 +Key: 00000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CCC75B4A84D08B14495AA8349B0AF79480FF6D0695561710AA16739A54504E58 +Test: Encrypt +Comment: Set 1, vector 88 +Key: 00000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BC3F95A0CB0DCAEDB78E3D6E855267E34F3168C436774E28035D144406E803DA +Test: Encrypt +Comment: Set 1, vector 89 +Key: 00000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BD0A34B0509EFA39D9D091577FC4296F563AF5F3AF9E030FCC3661C0BD82738E +Test: Encrypt +Comment: Set 1, vector 90 +Key: 00000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: EC82DA0C15A50EB98E97532C509DBAC9C392DB79ADDC139F9ADC6091708CD726 +Test: Encrypt +Comment: Set 1, vector 91 +Key: 00000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7F164D165F7585E8306E38D44211325D0C6C177C523F13F69DB39DFEDF5BFD3F +Test: Encrypt +Comment: Set 1, vector 92 +Key: 00000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 73F36AF678E74D413BE851E77F5E55DE1DD92D5237DBAE75E3AB6364D1F181DF +Test: Encrypt +Comment: Set 1, vector 93 +Key: 00000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BE25140C4E7804B22390822501718BE09E7F494594EBD2BCB35A36AC2F0CA095 +Test: Encrypt +Comment: Set 1, vector 94 +Key: 00000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 33171A271100D5CC5CF651ABF60977CD15B718863213DC243CAFA6CA86041094 +Test: Encrypt +Comment: Set 1, vector 95 +Key: 00000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 323FF7A80198298E438C833032CE609D4E6C5C107C9069E8B216080DE5C0880D +Test: Encrypt +Comment: Set 1, vector 96 +Key: 00000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D8FB3E266B96E48524159A3BE04CC85B3DB70F2FE649A01259E4FCCBCD3E7BAF +Test: Encrypt +Comment: Set 1, vector 97 +Key: 00000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 88B2171E37F3E861B6A69397BCC46044EABBC424E3359D11C96A62CB33F6C56C +Test: Encrypt +Comment: Set 1, vector 98 +Key: 00000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 96168ED95200986AFF506D3C2F043DFE03356345C52AD205BDC91423C6079824 +Test: Encrypt +Comment: Set 1, vector 99 +Key: 00000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4FDE2AD110847B5F4F2BD20CE5047913B12A682D119D9A8C8395B9958771FC22 +Test: Encrypt +Comment: Set 1, vector 100 +Key: 00000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F703282E54592A5617E10618027BB67F639E43A90767150D8B7F5E83054B3CBD +Test: Encrypt +Comment: Set 1, vector 101 +Key: 00000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6673138D1A64DD26CDD2F62CAB0BAB2318DE17507BAA307A189EC4997F9C3F89 +Test: Encrypt +Comment: Set 1, vector 102 +Key: 00000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 328B2F4069F398422D78E359F19938B8BFBC9E073C2162A0829265CFD48B89CA +Test: Encrypt +Comment: Set 1, vector 103 +Key: 00000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 02B14A28344C4164DDF0EDB594D581AE847FC0090EE6B933B8B8B91EAE90F5B3 +Test: Encrypt +Comment: Set 1, vector 104 +Key: 00000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 506221E93DBCBA6787757CCBBB0D5CDE9D06CFE3A23A8942A13C5B3849B2D2B9 +Test: Encrypt +Comment: Set 1, vector 105 +Key: 00000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 53A01AD91AE1C7F0DCBE19CF701A895E03FD866F77ABC7B174B327A0576D7719 +Test: Encrypt +Comment: Set 1, vector 106 +Key: 00000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B27AB67ACB784CB231A76D05B2539F0146F5C2F330987DE2C91AEAF8511DB9D1 +Test: Encrypt +Comment: Set 1, vector 107 +Key: 00000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 682263AAD3FF0B227983D20CB8A8B572427A2EE1B85A7FBB0961C722A7DE70CE +Test: Encrypt +Comment: Set 1, vector 108 +Key: 00000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E8AA0C754FBFB2BAF1025C8C13101552FA32E4031843E3DC56D2D819476CBFA6 +Test: Encrypt +Comment: Set 1, vector 109 +Key: 00000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7952391AEB6094458B28B543B9A5AC1DDB0CB18AEB431BE7CC7A4D45CCBEBEB0 +Test: Encrypt +Comment: Set 1, vector 110 +Key: 00000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 138599B1B9406E932D6229A4FFD959EE02E626022342FF233269A00DA1F58384 +Test: Encrypt +Comment: Set 1, vector 111 +Key: 00000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 87FA25FEBEFB539BFA46F9FAF8D62DB8E3C126D7409813A3B2FFC760FF19D390 +Test: Encrypt +Comment: Set 1, vector 112 +Key: 00000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 943B778E6053E3CBC59E9423A6D8AE678D369D5E27AB56D668DAD944D0A238F4 +Test: Encrypt +Comment: Set 1, vector 113 +Key: 00000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 00D31AA7620BEE29169C62966C53058F05709CD7C6A6584AFA80D7B2B7D9414C +Test: Encrypt +Comment: Set 1, vector 114 +Key: 00000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9A6DD9EAE3286D48A7548C0A8A4CE8FFFB61B362C95C897DCD1CB1D8BBF76DEB +Test: Encrypt +Comment: Set 1, vector 115 +Key: 00000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 8231E89C8C74641DA6CD862B98B5DE749D6751B44361B763DF888F3D2312FAD5 +Test: Encrypt +Comment: Set 1, vector 116 +Key: 00000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AEE13BA9322E1089262CEB199FD96E8A3C1E29142C6542961CA0B70782A4FD65 +Test: Encrypt +Comment: Set 1, vector 117 +Key: 00000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 89EEFABFFF030B563CAA5965CFF0372E0518BA1BF9A6E07D279C20AF3D52B9E5 +Test: Encrypt +Comment: Set 1, vector 118 +Key: 00000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9EB46332AE8F271D9613A5FD1D6E1B06ED7A553C874A44A6F3A0615D46AA079D +Test: Encrypt +Comment: Set 1, vector 119 +Key: 00000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FDB79EB3D755AC9338093917F84742BB1D62197D9730AEFCBAA9B3A4CEEC0B5E +Test: Encrypt +Comment: Set 1, vector 120 +Key: 00000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 64D439442C3FB4B580E0C7BC212F5589B395F6D100AA8165E4599A34F288D31D +Test: Encrypt +Comment: Set 1, vector 121 +Key: 00000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 09F8A382936078076F496A14B7BFD77CF4E549171FBDD8106AD0C2F87FD9C151 +Test: Encrypt +Comment: Set 1, vector 122 +Key: 00000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AEB59849B6291FC1B8917642088608C4B9EE364C8C1FAE502F1ECD5BFACBC96A +Test: Encrypt +Comment: Set 1, vector 123 +Key: 00000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 006136B68224BF8BF47C0298FE7E2A4B72964A6C9F36EB709C452F0319B6A104 +Test: Encrypt +Comment: Set 1, vector 124 +Key: 00000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 55912F44A9A3493CF0A4DEF2F77978ECE0868ABF30BBAB15A96AFE15575AA90A +Test: Encrypt +Comment: Set 1, vector 125 +Key: 00000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 81BA612B664481588AB16246226CC1B59A08A7FE0FD64B0111C67C4BF344D2C7 +Test: Encrypt +Comment: Set 1, vector 126 +Key: 00000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6B7930B1609C35095BE581F8F73709A65781DC1D49381411F6474CEBE6D16182 +Test: Encrypt +Comment: Set 1, vector 127 +Key: 00000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7308AEC23D25A231B26448AFE78D5047804C5011B9B5F95C16DF2670551F0001 +Test: Encrypt +Comment: Set 1, vector 128 +Key: 00000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FBE855BD6540594E2D90566E7A30F57516EE170817B66C2468615D5D3D5DF03B +Test: Encrypt +Comment: Set 1, vector 129 +Key: 00000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B072D598869D6EFCC8856A2B4686EF05A37DDB3F26DFEDA2F9C406B7250801F5 +Test: Encrypt +Comment: Set 1, vector 130 +Key: 00000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0CF58B2665B889C06836E699DC2B4C615106541987229D686D43614D3BFC290B +Test: Encrypt +Comment: Set 1, vector 131 +Key: 00000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F591E78CE6A8A375CBF821D222A49C862A461DC52C74065BA6349598CC7CB6EC +Test: Encrypt +Comment: Set 1, vector 132 +Key: 00000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A32B883113DE96B7AFD4ABE8E1703C8D724397542527E27F0CA32C89332980D9 +Test: Encrypt +Comment: Set 1, vector 133 +Key: 00000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9B2C992F4CA0E70E0DDB03400AD24C4F20AD5F32940537B33F375C7979968537 +Test: Encrypt +Comment: Set 1, vector 134 +Key: 00000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0DDEEEBC428F117B094FD27B614F6BDFEC0D71D61F8F93F9A09E0443F2FEB659 +Test: Encrypt +Comment: Set 1, vector 135 +Key: 00000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D58740E259B1C9A5DADD2FA5FFB768ACECD0DA6FE40D7D59F3CF6FCD4838FEDA +Test: Encrypt +Comment: Set 1, vector 136 +Key: 00000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E6F318C17501C28164BE9CA692E92D4CF4835E2778B126E9841CA0F132CCAA61 +Test: Encrypt +Comment: Set 1, vector 137 +Key: 00000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3776A0BB5880EB65386F20D11BCF308C2DA3B010F7E2DAF3FB8B55B523E7CBC3 +Test: Encrypt +Comment: Set 1, vector 138 +Key: 00000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3926539CFD76BB79E50A571D75AA51B94864A79CA5DCAF6CE451FC068E487625 +Test: Encrypt +Comment: Set 1, vector 139 +Key: 00000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A8D9B6254BCD0BC32CA3ECF7A7A80882DDC178F47D8E91F760883D589D94F45C +Test: Encrypt +Comment: Set 1, vector 140 +Key: 00000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A2C3810606AD6AAAA571C8A783A686E9F713D0A1238C3E621347622C569C7BB6 +Test: Encrypt +Comment: Set 1, vector 141 +Key: 00000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 902FF7C8DA5B1D171603F48C02E72B611C40E4B15F06BF4A7DB914AAA7E63036 +Test: Encrypt +Comment: Set 1, vector 142 +Key: 00000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 55AAAB17A700544B1384EA512146F65A2F871C30F8EF7AB84DD96E004E924403 +Test: Encrypt +Comment: Set 1, vector 143 +Key: 00000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E9F049D8DD032202BC5E16F061B0449AEFD91845A4786A045E35739826E283AE +Test: Encrypt +Comment: Set 1, vector 144 +Key: 00000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6347929B2B5B6634C2674CC4AD3B04B321F7404101E79259A35053E552369548 +Test: Encrypt +Comment: Set 1, vector 145 +Key: 00000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3C8D318014177555818122F69A95BED7A175464310A9B53DD4AF3C5887970D39 +Test: Encrypt +Comment: Set 1, vector 146 +Key: 00000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A3CE794DEA39A03EB4337395E3713ACA02E15148CC9302083E9F2FD55A921BF5 +Test: Encrypt +Comment: Set 1, vector 147 +Key: 00000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2EE444D85842D41D9AEFBB7ECE34EEB71720AFB04498F9B4CFB87C10AC842D3A +Test: Encrypt +Comment: Set 1, vector 148 +Key: 00000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0050EF8A2E0EAC79CD1BCC82F52F04410DA08263A320DA47B500DD72FBAA3487 +Test: Encrypt +Comment: Set 1, vector 149 +Key: 00000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 51721D61A2032DB004C8B83F7509B045A5190892FBC5AEB9BAA4B27D7969C791 +Test: Encrypt +Comment: Set 1, vector 150 +Key: 00000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 016D3D0A0C9B1EA97A12AB7BFA23BD4A973D5F10C06581A6DA92668BF3B4026E +Test: Encrypt +Comment: Set 1, vector 151 +Key: 00000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 687DAF7B782EB92EE2F8812ABA81A1F8EC353797544602A8EF2D2D6C1AC7EB48 +Test: Encrypt +Comment: Set 1, vector 152 +Key: 00000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 538008D0A4465A705313E0A03DE02BDFF7D9F0F0226F630DAFEA5434D9ADD7EE +Test: Encrypt +Comment: Set 1, vector 153 +Key: 00000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2F65E608EF3E4C202C347ADDB9733132350A7AC9E544C5D7D76F9527DB3640AE +Test: Encrypt +Comment: Set 1, vector 154 +Key: 00000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1EF33EF878790A6E16E18377C474700E6AF64C0C56F5FE8E7A1A83D990BB7B9B +Test: Encrypt +Comment: Set 1, vector 155 +Key: 00000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3369751D8735C5B82164E9FDFAA8B224AA4BD3FC2CD3DC48C60A1C290AE189BD +Test: Encrypt +Comment: Set 1, vector 156 +Key: 00000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 428F02228A58756A94871F5DCB37F54AD21345ABEDECB6D12630E51ADF4D6128 +Test: Encrypt +Comment: Set 1, vector 157 +Key: 00000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 521221AE0F51055948753BAC7A30394DA0F3DCB485364AB512E62D9CDC24FE48 +Test: Encrypt +Comment: Set 1, vector 158 +Key: 00000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7E44783F40C4A3EBB40E5D4E22A9BECAD3008D8B1AE64929B666664D8D8680D9 +Test: Encrypt +Comment: Set 1, vector 159 +Key: 00000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 48F54AE18072D2E58922EB0B14E4C32CD72807BF436A01164B0B5027ADCE6121 +Test: Encrypt +Comment: Set 1, vector 160 +Key: 00000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 671E9014ABC8FBBA21A307FAFF3FC7C89231ACA932F58C2D79DA323F80B3F87B +Test: Encrypt +Comment: Set 1, vector 161 +Key: 00000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4473A8EF3585DDC8AB5858DB58FD87FA42E724D2374D7888FCFA66D82B30145A +Test: Encrypt +Comment: Set 1, vector 162 +Key: 00000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A4AD8D6A847FF420E96E1E592852FC7B362F1E0DBBE417B0CFC80C1200C5BB97 +Test: Encrypt +Comment: Set 1, vector 163 +Key: 00000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B10D378FB56687BDDE7462A91FD0C42C773097765AC4C332B5007D1D47670EE0 +Test: Encrypt +Comment: Set 1, vector 164 +Key: 00000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 788D00A54C0A6FB10067E08B8F2C60B4DBA05B58D3C8CEEABE49C2FD2FD7D6C2 +Test: Encrypt +Comment: Set 1, vector 165 +Key: 00000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CC54D8465F9529077237703DF4DC136FCD7A9D2FF3B89FF0D226EA3B234B6113 +Test: Encrypt +Comment: Set 1, vector 166 +Key: 00000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A0DAF3D3568FA9134C9C1B6EC5137B72715271DEC644F1268FDFA88A89989371 +Test: Encrypt +Comment: Set 1, vector 167 +Key: 00000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0BBCCB3D83D7B6D3AA96AD5687C4895CD990146E293733A649B4D7EC48E9A93C +Test: Encrypt +Comment: Set 1, vector 168 +Key: 00000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DDF8388BA3EA8FDC869D54D38D6BFE47FB7C5B6D81B3D80AE8B7DE00F4581EC1 +Test: Encrypt +Comment: Set 1, vector 169 +Key: 00000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FF4F175CADFA435B31D5766FE6FE73B88B33BF5A87D79A2B47FCEB6BFE6E39AF +Test: Encrypt +Comment: Set 1, vector 170 +Key: 00000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9B28804310814CF3C9782CB23FAB7FE19D5BDA5E9553F23E7876A6426316365C +Test: Encrypt +Comment: Set 1, vector 171 +Key: 00000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 94831F56AC794746628AF8A0684ABFE6A1113EB5B95939A8223D5C0C08BF52FD +Test: Encrypt +Comment: Set 1, vector 172 +Key: 00000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 689C2CAC1FC6999B8BA48B767A995871D80AB561FADF20D8613274CFFD00BF32 +Test: Encrypt +Comment: Set 1, vector 173 +Key: 00000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4CC4412727B69CE43E6B85D89F03DAC6982CF867FB98801DA1F0E8720123699E +Test: Encrypt +Comment: Set 1, vector 174 +Key: 00000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 8160A24A68E81E4A839E1C16086983BE98652856CC621B3F7612A8B1324FA33E +Test: Encrypt +Comment: Set 1, vector 175 +Key: 00000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 024B19F8BE7203D9E5589AB96B86BD68A488D7994813D0231C835637B9E59A64 +Test: Encrypt +Comment: Set 1, vector 176 +Key: 00000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 954714BFD736CB391604E77367C2875EF291C02EED35B6DD6A20D58FBADAFB84 +Test: Encrypt +Comment: Set 1, vector 177 +Key: 00000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6E95756FEA083B4AB4E624B5CFB00E31CAEA9C03CE4A1F51104BF6E7A86495F3 +Test: Encrypt +Comment: Set 1, vector 178 +Key: 00000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 93176B234B0A25F30649FD3172F75F181CD47C75D795FCFD5A537F18B101B24D +Test: Encrypt +Comment: Set 1, vector 179 +Key: 00000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 51637CD02F79DA935C5A317C1F8AC79E47E255E4A83F3F04DBA2998DF5118D39 +Test: Encrypt +Comment: Set 1, vector 180 +Key: 00000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 15C15F38B0CDEC62A426CF4AED25096DCCF1B2C7CF49A223F4D3ED7E06CAD2D7 +Test: Encrypt +Comment: Set 1, vector 181 +Key: 00000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 14520B3D7B8734A8D4E07CAB93744560D60FE7C9122C97F2ADB97D811074D225 +Test: Encrypt +Comment: Set 1, vector 182 +Key: 00000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F16ED0E9813C694563BF3557D73085C8761642B6B003291B31C681D3A9421E73 +Test: Encrypt +Comment: Set 1, vector 183 +Key: 00000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BD3B03B8DF1994DDD3BE4509BB2B4AED0F7D0F7638102C58B15ED9DC9FAD5261 +Test: Encrypt +Comment: Set 1, vector 184 +Key: 00000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 45813D3ABF443D14B8519A10BA667F16C2EC757B309B978E26FFE56EE0BA00B1 +Test: Encrypt +Comment: Set 1, vector 185 +Key: 00000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A13D32CA09C34BBA16813BE8F4D56AF772B67327C7CDE0756B3D5CECEF2BCD2D +Test: Encrypt +Comment: Set 1, vector 186 +Key: 00000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: EC7D07D6F3AD0351131F15816F8044CBB1592324F62903B9DD6180D88E09EF07 +Test: Encrypt +Comment: Set 1, vector 187 +Key: 00000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 873F46936C8CC3A23CCA3EA3288CA070CC41F128296FCE6E7AAD2B7381BBAEBB +Test: Encrypt +Comment: Set 1, vector 188 +Key: 00000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0AF0BB23EFCF86B273A27D84435F53F9984183E4C0D2F69945E79BAC8674C3A5 +Test: Encrypt +Comment: Set 1, vector 189 +Key: 00000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7B9A8CD1942564414FE5C1237B680970A306CCB0CF73F1123D2E823D084F3126 +Test: Encrypt +Comment: Set 1, vector 190 +Key: 00000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C21A4ABA37069F7173A704B16C2DB945301BD4B08D3202BCBCA4AF8E5BA8A963 +Test: Encrypt +Comment: Set 1, vector 191 +Key: 00000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5B2F725ECF531E569AC6B69408259547B9B054CAAA20B6727FE7654FAE4386D2 +Test: Encrypt +Comment: Set 1, vector 192 +Key: 00000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 58E6E58AD73C9DA9A19CBCBCB6E89B44951781A027D5C5CBEAABD95D55BE1CDF +Test: Encrypt +Comment: Set 1, vector 193 +Key: 00000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 8F076E12AB23D9CABFD006D16E1D554AB367CE88B3FDD44717824387DC9D4B43 +Test: Encrypt +Comment: Set 1, vector 194 +Key: 00000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C5A351191F18886099542CE6B3025D6F0F4EF8A9A1C804803166BC2699D4B3C2 +Test: Encrypt +Comment: Set 1, vector 195 +Key: 00000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 39BF10576DBE0BA332EF36C38CD96F4F0043B8A0C6CCCCD3521F169821CC4C0E +Test: Encrypt +Comment: Set 1, vector 196 +Key: 00000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 12EC53C9420154F7D5334D4BF94BE3B4CCB044FDF56B4A92E245F016BBE9C057 +Test: Encrypt +Comment: Set 1, vector 197 +Key: 00000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 569D436AFFBB65451ECFDDDC7BABD5608BC183E9437F30B5058C505158BCE7EE +Test: Encrypt +Comment: Set 1, vector 198 +Key: 00000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4E53AA49C4A8E0A00FA51E3DBE4D6BD6ABC1505C2E3FDADAC282BBDF5987E075 +Test: Encrypt +Comment: Set 1, vector 199 +Key: 00000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E0BF45509232C9F66517F057FB01C2E0E08906842B59DA4980413F629388C088 +Test: Encrypt +Comment: Set 1, vector 200 +Key: 00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CC5A42F9BBCD1A5BE0D8EAC69A184E1693AE5F1C9FDAA05B8CB5330D5D63A2C0 +Test: Encrypt +Comment: Set 1, vector 201 +Key: 00000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4247A5AA925AEAF29EA9FCC3C942DC47FB1A13213B302FE0C6F33243C631D2A0 +Test: Encrypt +Comment: Set 1, vector 202 +Key: 00000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DAC043890BB61728CFC30E3A860BFF9474DE05CA104C242BAF498344470319B5 +Test: Encrypt +Comment: Set 1, vector 203 +Key: 00000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 214703F986092730BDF01020A825628FD06CD22C9F385CE14BBB2738A38A1E94 +Test: Encrypt +Comment: Set 1, vector 204 +Key: 00000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AD3EED667396E27E4EF749BE1BC2D222380AA5C070B7246EB3A8249D9003BE1E +Test: Encrypt +Comment: Set 1, vector 205 +Key: 00000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 57B33C626E776BAAB8D655DD93125D49BFE92177BB63AA9902A44E4CC6F90666 +Test: Encrypt +Comment: Set 1, vector 206 +Key: 00000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3ABEB777D6240D198677B50B14545714D71D2F46885513688406B201F689C3BD +Test: Encrypt +Comment: Set 1, vector 207 +Key: 00000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0B9E5A4358BCD0CA1AF306274CA676B515499878D2ACA0AD7865139D36910018 +Test: Encrypt +Comment: Set 1, vector 208 +Key: 00000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9EAB0FE92E1B83FAE87EF6369BD0EED91D10DCFC5810FA0188D06929CF927422 +Test: Encrypt +Comment: Set 1, vector 209 +Key: 00000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BC205D90F13A69AA6C45979861B1E5737A69C61F726D252F773E528276B9F1B7 +Test: Encrypt +Comment: Set 1, vector 210 +Key: 00000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CEB885427DF7C988804E7C2401BD703CBB8F3D3D50AFD6CE9F56D32F802F8219 +Test: Encrypt +Comment: Set 1, vector 211 +Key: 00000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C61CE53D0A5E771E6AC98830D496079A34ECE8967D737D0EBE393E7549679BA3 +Test: Encrypt +Comment: Set 1, vector 212 +Key: 00000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 842F934F9C3E9690F3AABC753B6C27F7F3EF7B199ABFDA287686F35E2884A2F5 +Test: Encrypt +Comment: Set 1, vector 213 +Key: 00000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: EE357FEC92355A11FDCE30B089E4F5918A90025832DB3562C762A8421F3B6625 +Test: Encrypt +Comment: Set 1, vector 214 +Key: 00000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C9CC50B7CB29557DCDC64C995B24D2E0E8AD8FBB4906A8DF06D67A69B1AAB8A6 +Test: Encrypt +Comment: Set 1, vector 215 +Key: 00000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D6DE0F6B51BCBDA8D44D7EEA5F91C85B78F42B6612A35662CE3AB3043E87701D +Test: Encrypt +Comment: Set 1, vector 216 +Key: 00000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E3F3E3A5317DCBE044E1A97CAD714449DF0F8E9C319F5C12C19917B2F47F1FD7 +Test: Encrypt +Comment: Set 1, vector 217 +Key: 00000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3A1A26993055B3B30BA84236212646D2622680117D2813316223EDFFA1BBB22B +Test: Encrypt +Comment: Set 1, vector 218 +Key: 00000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 192EE13F6909D98437E8F424DE7DC873D82330DE64B379F3F8985658B00033DA +Test: Encrypt +Comment: Set 1, vector 219 +Key: 00000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DEB92C0159D40548317AEAF996819352F43CB1E487885A0851234A43E4C5CB2F +Test: Encrypt +Comment: Set 1, vector 220 +Key: 00000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C671DF68881157258EF58E7C7E712351FC9D743A2C4ECAAC9D3ABE98F9701B3C +Test: Encrypt +Comment: Set 1, vector 221 +Key: 00000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7A8BA935035DFE8F1DE34EA373FB60E147E6D5572686212BF95B6E0C115D15B8 +Test: Encrypt +Comment: Set 1, vector 222 +Key: 00000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AA95483043360A3CCD5E98C8D5088F9F7154DA3E36F517C459F03B94EA8B5DCF +Test: Encrypt +Comment: Set 1, vector 223 +Key: 00000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F716EF1B45585282C50AD6EB1EAD2D19AFBF57235E5D56A015882C55EECC2044 +Test: Encrypt +Comment: Set 1, vector 224 +Key: 00000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CECA215484E90CE7AF49BED4B5F84543D05CE120973EE8510E0A410FA391BE3F +Test: Encrypt +Comment: Set 1, vector 225 +Key: 00000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5AF45DB110A67D0CC49D1A1BB5765ACDDD6482BD88664A4A511BEB8DCDDC08B3 +Test: Encrypt +Comment: Set 1, vector 226 +Key: 00000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E0AFCA91B3CCF0A0C4E332C4F75BC17E5956B0F3A438F0B0ACA0E9B08DA9A1C0 +Test: Encrypt +Comment: Set 1, vector 227 +Key: 00000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C559C00EB5C49F2321975A264F855C291DB8FF942FC4617193236318D55DA27A +Test: Encrypt +Comment: Set 1, vector 228 +Key: 00000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 88BCDD04989FE085F888A57176463662C57DC70DD3888F427B68BD5A36C3297A +Test: Encrypt +Comment: Set 1, vector 229 +Key: 00000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3C6302F9C2C8997C41FA0F0187B9E19D14FC2196A001D39F56BF5200E76D4F66 +Test: Encrypt +Comment: Set 1, vector 230 +Key: 00000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 641DA3FF9CC2C5AD625FD131D91E1AE5AD3088DF404384BD885917FD1AFDB9AB +Test: Encrypt +Comment: Set 1, vector 231 +Key: 00000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1A05DEF28E631857C796D665FA66F8A4743F9A340904EC1C084AB022E63E3A0A +Test: Encrypt +Comment: Set 1, vector 232 +Key: 00000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 04DF8F3469AFEA2F63ECA1FA64FC18F1E42B42F7666BDCBFE6CC1C68614D85A7 +Test: Encrypt +Comment: Set 1, vector 233 +Key: 00000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 21AA974CF45CF84383024A8E7D3427BCD9A0A4F4B2AA83FA44911615B2D9A27E +Test: Encrypt +Comment: Set 1, vector 234 +Key: 00000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 74533E9973B565E0B7F9DB65A63B70BC5840EE4E1B6D927033CC1F733BD78AD1 +Test: Encrypt +Comment: Set 1, vector 235 +Key: 00000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E818E22E590974A00FBF40C1A1DD100F5C2E3A76C594D129DDE0C9119CC1A836 +Test: Encrypt +Comment: Set 1, vector 236 +Key: 00000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 00BEF3BB9263863455A8736A114E7DF13C903D6D9FE065FED48E6634EE9B9156 +Test: Encrypt +Comment: Set 1, vector 237 +Key: 00000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A0D418EAA61D8B6234D8B07D4652F61EDA48B00764E124DE5D7545973E4BFB0D +Test: Encrypt +Comment: Set 1, vector 238 +Key: 00000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 21472EDC58EB9D2EDE5D8A24DE18784500420820C388408E2D09C8935D3208CA +Test: Encrypt +Comment: Set 1, vector 239 +Key: 00000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 278849105940CFDF61AB8DF9A37427A24BD452C244988E7CE85B8FF94A913F71 +Test: Encrypt +Comment: Set 1, vector 240 +Key: 00000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7B35DC73EBA6408C2486D59ADA0A17B89ADC10E405E029E51B8FA7096704DF23 +Test: Encrypt +Comment: Set 1, vector 241 +Key: 00000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D81FC2305382B4110925F4EEEE6C93C3356B30F4E083B47C0FFB429DC8A317A5 +Test: Encrypt +Comment: Set 1, vector 242 +Key: 00000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B1CC26F822DAA8B4EF2DC5C08792C21A985D285697C9BC49E038331996F2DE35 +Test: Encrypt +Comment: Set 1, vector 243 +Key: 00000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 565635B8CF39652AD3F94F9658FBF2310A08DC25975102D9E0A658574E5437C6 +Test: Encrypt +Comment: Set 1, vector 244 +Key: 00000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3A9E77725182484E375528415C99C9BB2795A0841FD9F7E7D2DDE20A6CD71C04 +Test: Encrypt +Comment: Set 1, vector 245 +Key: 00000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BD3F45893A96EF8C218B3C22079E64BF847F3C41D87F1AC68E62B32E5A59D350 +Test: Encrypt +Comment: Set 1, vector 246 +Key: 00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 44BBB67723B8FC5778D18FFA60F1A7DF16F2A4583BA07E3B2A9A4286765AF743 +Test: Encrypt +Comment: Set 1, vector 247 +Key: 00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 06198963CE32DC41A3869CB3893E1602D21EA64DD206C2DEA9FA79F756260BF8 +Test: Encrypt +Comment: Set 1, vector 248 +Key: 00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 82EA3EC56648E3152D541EA5EA76F9C1D12A373D5183CFFDBC49C0FCE25AC9BA +Test: Encrypt +Comment: Set 1, vector 249 +Key: 00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2D6F44E5104C9A6B28DA5731FE95AD5ED73051B4D405FCB77D2845A3306CD9EA +Test: Encrypt +Comment: Set 1, vector 250 +Key: 00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 360DF8BA5BA3F245E4751C6B1D81CCCC7160D6DE8CB12B496DEF04A78B0D3DD6 +Test: Encrypt +Comment: Set 1, vector 251 +Key: 00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BE0B2DE97E0528C5A135A81F2DA7431C8BF01A456411CB826F1205A9E57A44D2 +Test: Encrypt +Comment: Set 1, vector 252 +Key: 00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4CC729EFC23033F244182FBAE629ABF4386CDB279C6394C7CC914724604D8736 +Test: Encrypt +Comment: Set 1, vector 253 +Key: 00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BA44E9372A4EDC847FE6601F0DDBCF40864B2BB5C4EFF9B3038F7EAD6672907B +Test: Encrypt +Comment: Set 1, vector 254 +Key: 00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DF3109ACA9E8546F5140E6705EDD69EB5512F0C5B3567D6EE132700820839B77 +Test: Encrypt +Comment: Set 1, vector 255 +Key: 00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D909866F49103120A46CD4F2A98B2A2169E3E9AE7BB5AD36CEBD675F62B73018 +Test: Encrypt +Comment: Set 1, vector 256 +Key: 00000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 63081A9DE55FA28CFF0089A3D4A52568BFC0D3A172B1750180A91BA12EC3E38A +Test: Encrypt +Comment: Set 1, vector 257 +Key: 00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7FBD9ADE476739C69CF906B611639D554ECF25BA26AC87A11EF30856DE890D28 +Test: Encrypt +Comment: Set 1, vector 258 +Key: 00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 495FB031327D3AE9CCA3F449E73571539EF9FD88589B5C3142F5A4461CAFF9F1 +Test: Encrypt +Comment: Set 1, vector 259 +Key: 00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1E958BF17F89DD463B49BDE9B05D01DC2557DC4CE072C24D0527E45BA1C8026C +Test: Encrypt +Comment: Set 1, vector 260 +Key: 00000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 92093F21E7CFDCD81765E71ED960121F84C6FE1CDA50B00592ED0DB9A8808FFA +Test: Encrypt +Comment: Set 1, vector 261 +Key: 00000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 122E0C5E19B0636ADE10F1A14FF4CA69EC426B4F311C109F6B137BEE274B1912 +Test: Encrypt +Comment: Set 1, vector 262 +Key: 00000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2CE82AD1BF9BDA86355188CF5605CEAB73E98BC617CDC3D5C8598F11BA96F6A5 +Test: Encrypt +Comment: Set 1, vector 263 +Key: 00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B14A656DB71E54DF9D443E899417FF4F79E033106AA34D8669EEF0E9918FF4C7 +Test: Encrypt +Comment: Set 1, vector 264 +Key: 00000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 47ECD5C02C3D702FC36817981781B1A4593E240773121F763EB788D46E990C5C +Test: Encrypt +Comment: Set 1, vector 265 +Key: 00000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 91B74FC5E6FC8C6C30F33CE83BC0055190373FC589C0516F248227531C6B853F +Test: Encrypt +Comment: Set 1, vector 266 +Key: 00000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AC8F0393E6D8881EFF753E7CE47EC441106AFE1315E712BB439F2F2DD4318670 +Test: Encrypt +Comment: Set 1, vector 267 +Key: 00000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5765316B484E3091FB5135ECD4A5356293BD87512688EF14C719B61857767E1C +Test: Encrypt +Comment: Set 1, vector 268 +Key: 00000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FAD76A9798E8DD194095DACF92F83779DEDA70C413033DADEE55B4C94B98B426 +Test: Encrypt +Comment: Set 1, vector 269 +Key: 00000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 87F337C9D5763F38C679C5EB9A67F72B4581487ABC5ADCD5BABF4C71B5EB6F7C +Test: Encrypt +Comment: Set 1, vector 270 +Key: 00000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 526B4C3E3FE096F47D32A403A7D20EE269A42F68939B2FA8254A1812D9EC6069 +Test: Encrypt +Comment: Set 1, vector 271 +Key: 00000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 342C0D2D0A5048DC98F2E8CDBB84CC610E30BEBC12F7572CB416CBFCFA24039D +Test: Encrypt +Comment: Set 1, vector 272 +Key: 00000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 47D03635744E2D917F799F77A7E09E6F064CE224A4A1D507090DBE200DBD022A +Test: Encrypt +Comment: Set 1, vector 273 +Key: 00000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0DCE2CCCD9628DD4F6552A020B9447D35DEEFCFE5D8CDD8223AB3BA9090D8141 +Test: Encrypt +Comment: Set 1, vector 274 +Key: 00000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AC5622C3DDECDB0A46F796596ED595926B2783E6A884D18517F7344CCAB3A2C0 +Test: Encrypt +Comment: Set 1, vector 275 +Key: 00000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 80E59C358DC6F0B5749FEAF45A9BE7F884842839EE6B47024083F52A8636C2A6 +Test: Encrypt +Comment: Set 1, vector 276 +Key: 00000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 8E57504AD8F6DA6D8633D413362E961A6D69B18FA1B501DB846080A5A9C9C700 +Test: Encrypt +Comment: Set 1, vector 277 +Key: 00000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4956C679E9B58DDE2185BB018A7D6C61C918FA0AA9D6102E7DEF1183DB768FB1 +Test: Encrypt +Comment: Set 1, vector 278 +Key: 00000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2C25F9CD0DB2444EE43D0AD2C3AF0303D1487528F45AFD346617D164F80635B9 +Test: Encrypt +Comment: Set 1, vector 279 +Key: 00000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5292E96CB2110AD3FD231C5B2BCD1A8986333787664D1A551B9B750B2AA39A11 +Test: Encrypt +Comment: Set 1, vector 280 +Key: 00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D189129077C79106AEACA4E3463FD0650AC493ED981DC252531C072F18E1E292 +Test: Encrypt +Comment: Set 1, vector 281 +Key: 00000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F9490DB8BAE36E28E73419D1D57869D760D772DC8752D1DE948262755B4ED503 +Test: Encrypt +Comment: Set 1, vector 282 +Key: 00000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 994EB2D9BE7C9FD547426F295F15DE3BC8F4A2B3955C7028ED890B1DE0FBE21C +Test: Encrypt +Comment: Set 1, vector 283 +Key: 00000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 464BFD1EB42B595AEF9700C7C4C184A2132B5F1E85625592E48A233FA7840EC3 +Test: Encrypt +Comment: Set 1, vector 284 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A097C32D58D5A932AC9DBEE942DCCE547222E37E97DC3B29A63AAF118D5B01CF +Test: Encrypt +Comment: Set 1, vector 285 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D3D13CC4379D2817B8CF8E06312FC727A3BA3C58F96E478E4EC5BC7BAEDDCDE4 +Test: Encrypt +Comment: Set 1, vector 286 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 577C709C26BD52547BD7C0D3F9CDEBEC0F266178905C4C067B75A01D799EF910 +Test: Encrypt +Comment: Set 1, vector 287 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 08FCEF6A263916C53AEBB6CCD2623E7BA3C38C871C5A8B64106308B74A7AE1B6 +Test: Encrypt +Comment: Set 1, vector 288 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A22F794F4913B2B1CD930FA26EC219081F297DE4EC808771C9B375782F891D67 +Test: Encrypt +Comment: Set 1, vector 289 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 52F2C9714DAD06FCF5FD8962131D33952A6D68C2A90B8C08C3AB86B09A2C77C5 +Test: Encrypt +Comment: Set 1, vector 290 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 60BDED5533E692A9F073AAED43A5D5A81378E73A953514ACD5B0997B61848E3E +Test: Encrypt +Comment: Set 1, vector 291 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 38921BE2443A8101FBB44BCB4C5B87AB5026AA34C78B7FCDE07E102E142B6162 +Test: Encrypt +Comment: Set 1, vector 292 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D49C075CC20268EE889A10E27F2D4EAA99A1764F765621FE97687ECB6067E5AA +Test: Encrypt +Comment: Set 1, vector 293 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 50FC6782B3285D35117C0FA81039A7F264FC4EB492F3B86A233D45F2834F153A +Test: Encrypt +Comment: Set 1, vector 294 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1CC0B39D670A88D424F5D40B2F9256AF3736689BD82F0EB315AC9056F7EC63A0 +Test: Encrypt +Comment: Set 1, vector 295 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CF66C3CD4B08CB0E4D25186BF84BE3AAAB1C435F07D12593AD001F70894030FE +Test: Encrypt +Comment: Set 1, vector 296 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 352572656D0EB6E0CE604C1A913ED733D465A480504B61B0F9BBA77122FD20D3 +Test: Encrypt +Comment: Set 1, vector 297 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 096E9F34E6E277EDB994954C3705F6904452001D3A3E799A1D0230D430E207D7 +Test: Encrypt +Comment: Set 1, vector 298 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 277BC612F90A6D0735B86168C021098F134D1627D0FEF38607038415D1BADF84 +Test: Encrypt +Comment: Set 1, vector 299 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2376E2CE884AEC093E22A3C119D573609225FD5DC9B3EB7602C340D1AB51BDF2 +Test: Encrypt +Comment: Set 1, vector 300 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3EE2E39ADB49F92D09D55ACC817B5B2F22FB202951AEFB6DE8998D2932145669 +Test: Encrypt +Comment: Set 1, vector 301 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E508313113570BBB5A1E63F46AB52B57ED0676A061936F093961D34409F1B962 +Test: Encrypt +Comment: Set 1, vector 302 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 198A9A0A5B04AE936CB19E02A5B2A254A2DD5A4D71F6C676C0A826CD261CE8C0 +Test: Encrypt +Comment: Set 1, vector 303 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: EFEB9C3D34865B89275EFB9DCE1929697FC9E68ED9E9E32E2CF267DE57388E77 +Test: Encrypt +Comment: Set 1, vector 304 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 61016E27DF83D9DE642AE01D7D56C4BFE881C8BDEDD15C503BDC28D3F7107754 +Test: Encrypt +Comment: Set 1, vector 305 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2FB5FDEC05BD94EF5A7F0DEA7A368F7C2B26ABC5789FEAE7B7B6A5E6C364041C +Test: Encrypt +Comment: Set 1, vector 306 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F765AE08A03CF705D4BE6A6AF8A34CDE7A14F599B2CB7E2FCF2770F0CFD4F7AC +Test: Encrypt +Comment: Set 1, vector 307 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D38105C4DE4742F16E6AE7C1C3C85A515DA8BC758456E4B5D64C0539B76D473B +Test: Encrypt +Comment: Set 1, vector 308 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BFE3A705729C82DDE1297DF492A8F8ABAFBF2F436830B3716FC206D6931BBFEF +Test: Encrypt +Comment: Set 1, vector 309 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B81E7CB312AC5FF0A1795FCD4AD8B3D84FE6C8B796584DE794B7E230823E6AF0 +Test: Encrypt +Comment: Set 1, vector 310 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 605C8D477420CF7D8218CB8A6B3624700BADE8D1384B04995F3C942DE38ABA6D +Test: Encrypt +Comment: Set 1, vector 311 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 87A3F6DC69A7675F27CD00D7A84251366CCCA92775D680EBEBB48B92A5781D7E +Test: Encrypt +Comment: Set 1, vector 312 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 71625BD75BF6A89C643553D382B325EDACCFB4BF5F1617DED0C44BAB96A9F72D +Test: Encrypt +Comment: Set 1, vector 313 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: ADF64E64C1A8D854C421F5AA8CCBE789F3643B0D769A2CDC68D7C3AC85FDB634 +Test: Encrypt +Comment: Set 1, vector 314 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3C1AB3A3A85B1EEAA057557DBB59FC28479B38BEE67F4CDA0CD49880DC15ED0F +Test: Encrypt +Comment: Set 1, vector 315 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 026071B93A8B85F000539539626BBF664273EA701B63D487208962F8CC14F1DA +Test: Encrypt +Comment: Set 1, vector 316 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 61EC580BC31488BD8993C9B9D6B430BEBAE04F9807F199808CF05B0B4F083F9A +Test: Encrypt +Comment: Set 1, vector 317 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DF9093A33937B0B3ACAEAC1840C8E1358CC90FB0B6C0834D4CE4F442830127B7 +Test: Encrypt +Comment: Set 1, vector 318 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5683A2E768F9E105E9ABF7B71DE48833367D19E961D9D95577D2C4E48716EE9E +Test: Encrypt +Comment: Set 1, vector 319 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1D33978B4B75C10ACB850BBD98BB2CCB31F7D6F561E34AABAEB929C2F7762219 +Test: Encrypt +Comment: Set 1, vector 320 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6197C557619E4B791888DFD695B4BF55B7F72258968E26B9B74A6A3814267DD2 +Test: Encrypt +Comment: Set 1, vector 321 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9AD5C65433732C4ABF08BAE9015692F509775FC0450677CB1E76A060974B8807 +Test: Encrypt +Comment: Set 1, vector 322 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 44AA2FB88757EA695083CE00105D5B77C2DCE04EE1315D99040A1495E97EEB42 +Test: Encrypt +Comment: Set 1, vector 323 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9C637BA9B011A62B15BE522D6C514092358222CDB01A2A35B895B1E57DF1303B +Test: Encrypt +Comment: Set 1, vector 324 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 21774A71C07FC295C4BF477A512445B2AC9AFD6619DCF0124CBD735BC823F945 +Test: Encrypt +Comment: Set 1, vector 325 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3D74A1E781FEE340DD9D912F6A681F85C0EF78BAE81D3E50A5DB8A311057DCB3 +Test: Encrypt +Comment: Set 1, vector 326 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5B851E24E32EEB5BFAB09D26E86BBE4DA23C43C8E88635413516825D1F56DC43 +Test: Encrypt +Comment: Set 1, vector 327 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E79FAFD3076C0F879222F86A0671104F350B115A6AC107F5C66BB673CB047948 +Test: Encrypt +Comment: Set 1, vector 328 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5E8EBDFCEF4F70640695CF76FE7912F5E77F55095F0A3EC15CE692AED2C7312E +Test: Encrypt +Comment: Set 1, vector 329 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 99EC9D6724631EBC582C22B1B002C8F63B386EF1A96A9E4D162F698F3EC13944 +Test: Encrypt +Comment: Set 1, vector 330 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9DCF4937F7E089B09AF8F441538E2577E315212AA56EB20209F040BE602509C3 +Test: Encrypt +Comment: Set 1, vector 331 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 063CE595D4EEC463726FDB74E5254B5AFB965D2729D02F1890E70E33C4C7AE49 +Test: Encrypt +Comment: Set 1, vector 332 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 18F5B3F2F2B54FF37C354F3181228FBAA7D337791671988801C19333165EAD35 +Test: Encrypt +Comment: Set 1, vector 333 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 912671C8099032B1C0AE139D8F029B153B22B999DC30170DAAE3904CBDEFF083 +Test: Encrypt +Comment: Set 1, vector 334 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CAE46BA93F81E1AD26A8FACE45566E162B8F4CAE831B4B80F93D2A809D3C557D +Test: Encrypt +Comment: Set 1, vector 335 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 31708CCF07D82433A61053273FBC5543BAA1A73B836624FF092361E55631531D +Test: Encrypt +Comment: Set 1, vector 336 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B5F46BFA7B367DCE7998428525483F775D8F5F1A8DB9F7E3EB848F887283028A +Test: Encrypt +Comment: Set 1, vector 337 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1D1B9489F66B8FDC1902C02CE15E94727352C2F6A302C12A6F9672BC44014F6F +Test: Encrypt +Comment: Set 1, vector 338 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 8EDD86FA2225D954B3F9F57A0433ED692E99F7ED55EF0A8D112468AEA58717A2 +Test: Encrypt +Comment: Set 1, vector 339 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6F1414CBA350BB5DF73F7B23FCC0859BC2F081374BD4FBA7571DEC9343BD939A +Test: Encrypt +Comment: Set 1, vector 340 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 84535A21BFDE843B9E70AEEC9E5EB915FCEFF57449B7872142AA0669EFF250BF +Test: Encrypt +Comment: Set 1, vector 341 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C4CC653F5CFA6C13C4693967D4CD1398B8808982F0C1D6D9B4CC9A6FCAF41E8B +Test: Encrypt +Comment: Set 1, vector 342 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0949688EEF8CFBB88589CAB3EF58912A2C413E413EF122BB7F4C0E17BF723E71 +Test: Encrypt +Comment: Set 1, vector 343 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AFF2976C45A69940BB88C71381DAEDD767BAF454331FCC5666624EB052CE05CD +Test: Encrypt +Comment: Set 1, vector 344 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A7D73428AA840EFCBFF0C856409C9B19CBDC19BE376EBC75DFC008A6BC9EAB37 +Test: Encrypt +Comment: Set 1, vector 345 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3C59AA18035D96933FB938DE0331DBE42DA57B539A77D660DBFA12B62611760A +Test: Encrypt +Comment: Set 1, vector 346 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1F982024A86CEBEF27F0D19765907131C5EA1385761E92C7432D55A118AF2FD0 +Test: Encrypt +Comment: Set 1, vector 347 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5D5CE5B2BCEC679BEE0B894E4E0FD2E5ABD345D8F8061A02BD4B1873C3A9B612 +Test: Encrypt +Comment: Set 1, vector 348 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 54C62940FC9BD4D96A0D19CE92F6880B5F45A422DF0400E868020ED5B42BC287 +Test: Encrypt +Comment: Set 1, vector 349 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6A7B7E894CB7FE3A0153B5CC6E78351A07AEC726CCAF93A2C426C83760974035 +Test: Encrypt +Comment: Set 1, vector 350 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D2DAC7485B1818A7A2976F164C80AB5FE47B7CBDA4048000D09DAC65857A8387 +Test: Encrypt +Comment: Set 1, vector 351 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7C545CC73456F1C1B06C5B5A05A9659F5D30A4D78E9D85C29A38735BEF098E0E +Test: Encrypt +Comment: Set 1, vector 352 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7E3FA28ABB96C7CFAC0DFAFA5BF2E469D75ECF690FA876F3307D851D3CF0AAC4 +Test: Encrypt +Comment: Set 1, vector 353 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 46FFBA6995D7D6A2B58AB5F995AE3A305CB0385242428FD092FE777556AB05B5 +Test: Encrypt +Comment: Set 1, vector 354 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 052E5126AEDA420CC39EEF255B816BD475DBD36635B090D04C43410F40236BE2 +Test: Encrypt +Comment: Set 1, vector 355 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 80BBBFF3EB0CE3976503A85240226D7FE177B4F30C753F081D7E1F3F8F0FC176 +Test: Encrypt +Comment: Set 1, vector 356 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4A748837D0A7950876ABC89127A6D6FE5B646C7FE9DF8005CBBC3832DFE488EF +Test: Encrypt +Comment: Set 1, vector 357 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 84F35DFA249674C24E6DFB3947E3F3475817DF9548B301D4741B79EF9D26629A +Test: Encrypt +Comment: Set 1, vector 358 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BEC48DE878DD3533F3614B3A0A4BDF5FB34DBA96AE94508FC0D3927032CC6E61 +Test: Encrypt +Comment: Set 1, vector 359 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 80DDDED6AF53DB0459359FE311F32C5DFE85F281C45365BEA7A2D6BA8A2D5EA9 +Test: Encrypt +Comment: Set 1, vector 360 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 43BA1E833A673FB760B13DA40C509EBB7170CA05E7BD2728A7FDA0EB8E3020B8 +Test: Encrypt +Comment: Set 1, vector 361 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 917FDDD2206E751DBAD9BD2EAA3E1FDD7C6CFC7782367B563DE6E116D0E4A3B9 +Test: Encrypt +Comment: Set 1, vector 362 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3AD03FD2841A7C8E8BA49100FCA794DAAF29995A9CDCC6D4F868914C890C3BFC +Test: Encrypt +Comment: Set 1, vector 363 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 79A9305A48A10F739B06EBD24DAACBF5289ED6A83415021DB1CAAB542E417DDB +Test: Encrypt +Comment: Set 1, vector 364 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 195DA96825A0F6B94A71E2EDD934FB184F375EEF66411567815A4A6E966CAC0C +Test: Encrypt +Comment: Set 1, vector 365 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 513239A738978DE007138E83F5CD13A0A9BE374CF61B09021767CAE284D5510E +Test: Encrypt +Comment: Set 1, vector 366 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6BC70608C85D884873CDE727CF2B8A4E9563DA58242C907A3E87C2608AC0F1F7 +Test: Encrypt +Comment: Set 1, vector 367 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F47D47E5D0013BF10141C7BF92642E4CCCF8020347B59F1FAB145849EEF0A2E1 +Test: Encrypt +Comment: Set 1, vector 368 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 879D4097A300F6575BC2021F218E9AE9FED113AF9B4FC9179C621244A9E2A090 +Test: Encrypt +Comment: Set 1, vector 369 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 91EF2BE82D9080A366AC7C4344E457E5F46DA5BD54DD50C97D2910D1478BFA21 +Test: Encrypt +Comment: Set 1, vector 370 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0EED2315EF9B9278CCAD8EE2E33493F5A4FDAE31EC1DA863C017E8AEB77C2867 +Test: Encrypt +Comment: Set 1, vector 371 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FE80FF0F839BE1F911A21C97B36D439ED66F9965293890D98D8A3A98F2CFAE1D +Test: Encrypt +Comment: Set 1, vector 372 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4E241C22B26385E268F868E37873C36B173625048DAAE4ADE3C2E09D856A8AE9 +Test: Encrypt +Comment: Set 1, vector 373 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 71DA83DEC321D3160433BD8E2C2345921A6505444C9B1949B4D6CE400F1FBDBB +Test: Encrypt +Comment: Set 1, vector 374 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 21FF7AA748E96269211F129671E4F7A25BC55D92A144B7BEEB75F445FDCCDDB3 +Test: Encrypt +Comment: Set 1, vector 375 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 070290F0A10324414DCFD323822ABD2256ADDA0913FEDC70EA53F3F88EEB7AB2 +Test: Encrypt +Comment: Set 1, vector 376 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A112192AEDC7824247A9239BE92E45928416D086FEA09D4370DDFE862493AF4E +Test: Encrypt +Comment: Set 1, vector 377 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B0CD1E1BF87C1C63C455C8A285DF739A85706A587CDF0726C4615590DD25BDDE +Test: Encrypt +Comment: Set 1, vector 378 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F5EBFED2EF7706C5DEF09E94641FDA500100F500E431C601C879CC65CE260DF6 +Test: Encrypt +Comment: Set 1, vector 379 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 02CA5B7EAA7F906B706DD5B13A6C121927EAE22FB51C7259A781A916C5906E7D +Test: Encrypt +Comment: Set 1, vector 380 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 10569B20052606FEEB9956C2882702477F1D48F82B09C0BE1C97C3150F5F7D1F +Test: Encrypt +Comment: Set 1, vector 381 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 95C649C5B1ADCE59BE93F701C01D815D7A32D151179FC1B6610B3A2A98EE1295 +Test: Encrypt +Comment: Set 1, vector 382 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7E1DD644C151A0C1055E0AEB7A9DBE80BE09CCDE6C69797D00E7B391A6311D1D +Test: Encrypt +Comment: Set 1, vector 383 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6A82511AEBE5A82B6392CCA180B10F77FF0C14A7CF8CED894E1C8EDF9BAB29DA +Test: Encrypt +Comment: Set 1, vector 384 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AD05B4B2F644469BCCD1BE1D028B1FB26F270088E56D8B73364F958730B0C9D7 +Test: Encrypt +Comment: Set 1, vector 385 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 8B4110E53906CBD07EC61AC8DC8C97C475085AE6AE6418C45CAD7495B2C2F4A9 +Test: Encrypt +Comment: Set 1, vector 386 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FC44F97B9B3791B98D941B460C585BC7A485024F2B15370605FA64BEB36F10F6 +Test: Encrypt +Comment: Set 1, vector 387 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 95E1B79F255E9E477D756B0123F22397C723D63F3D6AC710A1647E5D6229AC25 +Test: Encrypt +Comment: Set 1, vector 388 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 523D59EEA567CAE613403BE8C8769E9E375F290D7FA2DFF64C9B41120E96F0C0 +Test: Encrypt +Comment: Set 1, vector 389 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DCD843BF9123A86C9938CB833C815217E37325B4ECF9A43E8E878ED2CDB257E3 +Test: Encrypt +Comment: Set 1, vector 390 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4D737BB7B6B2EA155FA64CAA9124588594AD9D3239B03A0B5F1A1670EF37C309 +Test: Encrypt +Comment: Set 1, vector 391 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D884858B07B3ADC2AB0067E24CEF443AF6D3CB691C7D3EDDFAF672763DF6991F +Test: Encrypt +Comment: Set 1, vector 392 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 24923E668BA92F02D0545738A1F3A81AD3EACC6F3E65A3C6879FEB3D55C3BEF5 +Test: Encrypt +Comment: Set 1, vector 393 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 98006EC6FFEE6DC3FE9D53FC632D1D82E8DC5BCB0BE0BBF1782701F858934432 +Test: Encrypt +Comment: Set 1, vector 394 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1C7CD45E2FDF746F2F6B7FCE3510DD14CAC7420FDA6BC9C6D3287E894D2B9EF5 +Test: Encrypt +Comment: Set 1, vector 395 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DF1B2CD5A9A7ADC85A257882E53150F9B3BAD4B5EFEEE8B4B212F8FB08F11194 +Test: Encrypt +Comment: Set 1, vector 396 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5DF3202330B96E2C8D45284BC1D8CC34C076B18600495EC43F847D09B9AB08C2 +Test: Encrypt +Comment: Set 1, vector 397 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CEE878EA6317D3B4E2CC695FCCC5EE04B7415B735F2D11B9A8891293D5D5E818 +Test: Encrypt +Comment: Set 1, vector 398 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3753BC3550155B6880CF1AAE6365FA5EA4F277B4E01FD26133A5C69F5620AC9F +Test: Encrypt +Comment: Set 1, vector 399 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 8FF623E4246D8B7D14904BFB478256CA55EBD9E383B672A91D512AFD606BA629 +Test: Encrypt +Comment: Set 1, vector 400 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C823B856B5E462FAD71A1D9C8F02CE1FE48650BD53BD620D021ADB1C53C21B84 +Test: Encrypt +Comment: Set 1, vector 401 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 22D0CD94534D8DCC359095D77008069E57851298103A13ACB50BF6FA778CB9A3 +Test: Encrypt +Comment: Set 1, vector 402 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 413F7657C9E46D928AE307FE794D1B10FEEB433D7F829C66118E155227F811BD +Test: Encrypt +Comment: Set 1, vector 403 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 12A9E9ABCC1916594307C982852A6750FFD5D9DCFDA261EC54C2D465BBB0FB64 +Test: Encrypt +Comment: Set 1, vector 404 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: EEB4897AEABADA871D368A00748CB437801933D78A14687EDDB3D526BBC2BFF7 +Test: Encrypt +Comment: Set 1, vector 405 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2444A95492348F7AB5C8EFE89839C6491833EF227637640F8199262DA70E5406 +Test: Encrypt +Comment: Set 1, vector 406 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CD0F1C806CE40D9901A04A23B52BBCFF51D20E964BA2ADCFE9AEE7CC8FE4A3B5 +Test: Encrypt +Comment: Set 1, vector 407 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 30E58CD115B75139A5D2ECC5253F6467FDEF4DFA307D11132570F90E657BC254 +Test: Encrypt +Comment: Set 1, vector 408 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 563FF22D971BDFACD7A90EDE80F076126CB16A759FDE6DB83E0DEE71CA48F33F +Test: Encrypt +Comment: Set 1, vector 409 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D235A2277B7D3A772C3D092D2E3D92248865EFED8C2577D3D087C5BE84891667 +Test: Encrypt +Comment: Set 1, vector 410 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3CD74A025D1C2044875FE1D97351608E0203CE65F2EB283633505AFDC3C6393B +Test: Encrypt +Comment: Set 1, vector 411 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FDAAE4CA8FD698D4330AD8217D40C8368AE9A825BE3359CB881FA74315ADA4DD +Test: Encrypt +Comment: Set 1, vector 412 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A9BBBED3051D1EB40AA806CF6505EBB4A0D3BAE671AFA03BD2586B01ECC6B9AD +Test: Encrypt +Comment: Set 1, vector 413 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 468AC86525069F4A9F1F7036BB2FC3D042296707B9FE8328C9514DA52FCBBCC2 +Test: Encrypt +Comment: Set 1, vector 414 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 96498A45E45E26AA2A1DD58E7374BCDA71420627B332F94FE98E045251B432C0 +Test: Encrypt +Comment: Set 1, vector 415 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 36FB6B4DAE5EDE9971BC2F5A353A3D5954961D9C8F7D38063A9F8556881F1E1B +Test: Encrypt +Comment: Set 1, vector 416 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4206BEA972707980637FCD2B990F2B8EAE3243C9178487047B1A9BE2C7F6225C +Test: Encrypt +Comment: Set 1, vector 417 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BF2763F46F4EF8CF40E42B6E4F161785D3478BDD1EA0BFAB30763B98BBC64720 +Test: Encrypt +Comment: Set 1, vector 418 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E7B97A297B534B1842528055982B7C382CFFDD161D69725789BF0CC35339D0A8 +Test: Encrypt +Comment: Set 1, vector 419 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F8E68E206729EDF06C9379DC6F87891FFB6D5DD75A040D4F0E17BDF28308E6E0 +Test: Encrypt +Comment: Set 1, vector 420 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DA69958998715C7517B9864E3A81F5960A48E9071FEB047084683D95A8532751 +Test: Encrypt +Comment: Set 1, vector 421 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 99456A498166535817F3DD3B47696CC74777ADE25DFA5CB5A3DF1A47DBCF0F17 +Test: Encrypt +Comment: Set 1, vector 422 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: D2D061B7FEDCA0663FE8F738042D1CE7D0EFB3BCED73977087FAB06192A361C1 +Test: Encrypt +Comment: Set 1, vector 423 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: ABF4E053FD99A777A5C95F057A1D8D3BC433D212220FE2BD5074C7E7B4AAA636 +Test: Encrypt +Comment: Set 1, vector 424 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 335F971AF070B59191F61547DC555F2AD86B263B23AAD53A80D6DA0C8A73C6BB +Test: Encrypt +Comment: Set 1, vector 425 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C2EE398458AD869FCFB5DBAD16CB66F2CDEBE8D9D2C0FC4B258553D7D648E281 +Test: Encrypt +Comment: Set 1, vector 426 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 659BDB67C3BB43D43CF53EF14411F9B5B2B3C8C9B961087622BF1F0412596D81 +Test: Encrypt +Comment: Set 1, vector 427 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 21E2DA7422F753B1B625D95BFE5FD1C52CB5DFEDF0F2662EF17416E44F671525 +Test: Encrypt +Comment: Set 1, vector 428 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C14725058665DCF8D701BB4A3DD5490DDA85E2754D9B233C008B5FC3559837B0 +Test: Encrypt +Comment: Set 1, vector 429 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BF0D7F94DF1C7CA59CAF588BEDB316CB4E31A578B76C1E5213EB663C0E850F97 +Test: Encrypt +Comment: Set 1, vector 430 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C81ABCB56C58DB2D5A329C6777091857DA4A5CBCB9D05AD6B0D4A2D4E915A7F4 +Test: Encrypt +Comment: Set 1, vector 431 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F9D7611F502D0CED242909E032173BAF5A43DAF7009F53E25E109D7F4FEF9981 +Test: Encrypt +Comment: Set 1, vector 432 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4EC0E7F808A10BFD4676E5CCA67E1D48806F346B702B2827810487EE56907C71 +Test: Encrypt +Comment: Set 1, vector 433 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 34C183C96FE5D9D2B4ED564EE9726551B27E1AF24848B5D711503E88BECBE458 +Test: Encrypt +Comment: Set 1, vector 434 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3E5EA6B326751B501C91C4A575B0ED6AEA9D60A14908187ACB3FC145B5468131 +Test: Encrypt +Comment: Set 1, vector 435 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DA3904568BC8844CB594F44FE13F5D663B55EE6995D2232A999D591F2FCE7812 +Test: Encrypt +Comment: Set 1, vector 436 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9293ED1C3C5B1A91B54A43BC63603F2EAD345EF9A7D3E69BD955EF1B8D36FD13 +Test: Encrypt +Comment: Set 1, vector 437 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 65C5CE0CC96FA6085A23EF00299B6D8518673DC9B8BF764DB595A8A7F8E940C7 +Test: Encrypt +Comment: Set 1, vector 438 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: EF95E25669CF4079F8BA728F41BD115F2913D8CFE0116C86032CD133E4787011 +Test: Encrypt +Comment: Set 1, vector 439 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7860315B44671B93718FEAB94BBCEE6B1006354914A90C3BF2DA1B6FA62F48AB +Test: Encrypt +Comment: Set 1, vector 440 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2AA9968D7011FB1F33B97DAD01C2708A6826C030AFCCA35B222B2E47C89F14E1 +Test: Encrypt +Comment: Set 1, vector 441 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CA9DD4F0771447B9AD0664DDA2921192568C2012246CCF5E95CD6CF3FBC44DCA +Test: Encrypt +Comment: Set 1, vector 442 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 38D51B18372FD7E7A617D7BCBCC658CB16014B05ECA242AF52B40AEDF6952DE4 +Test: Encrypt +Comment: Set 1, vector 443 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 640D035CFD65FE70D089866A53F21D00F86FDB1CEE2880F9FA7D382D424978A1 +Test: Encrypt +Comment: Set 1, vector 444 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B41B62EC90FA9CC037F1BC74AEED25226917DD3B2B2E5C11EC6AE7601CF3F0E2 +Test: Encrypt +Comment: Set 1, vector 445 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A4340A36C7E640C83D2401AAE6F9F103BC9B568EF5B7F67663E64B820974B235 +Test: Encrypt +Comment: Set 1, vector 446 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CAEF6FE59B0C05DDFE4F233412A185038077B7138EE9BA5FF4815C63C2BE84D2 +Test: Encrypt +Comment: Set 1, vector 447 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F5D76FAAF12F566711DAAAC0E1F71260354FBA7BC0DBC34D7A2B6FE8E19DC672 +Test: Encrypt +Comment: Set 1, vector 448 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DB1B22D80BD5BEA8D3F5F445E296FF3506C98C6FAE617D6C8DD943BC535AF864 +Test: Encrypt +Comment: Set 1, vector 449 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DA02BA2C706095D3EB008EFFEB5E501FFF78B59EC34CBCAF0D7CE82268CCAFBA +Test: Encrypt +Comment: Set 1, vector 450 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F878759262E5C2BA6CBC2091406D4045F876767C475582965B185DC9437ADD1E +Test: Encrypt +Comment: Set 1, vector 451 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: CA268715277F1CABC2062D4EDFD667759829782F793715199EE172917DA35C5D +Test: Encrypt +Comment: Set 1, vector 452 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 01BACD8388BF42064C8E927B3629C0DA82A0FEC4883EC068DC48483C43512BC5 +Test: Encrypt +Comment: Set 1, vector 453 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3D782388FD4ECBFEBBD49F2FBCF80A687E4CC0B8FEF51F097DEB679F49CB8B06 +Test: Encrypt +Comment: Set 1, vector 454 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 392E11AF1FD4A97ED260B680930C95DF26679260EAE0C025C405CDCDBC8E810D +Test: Encrypt +Comment: Set 1, vector 455 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 10E6AA6CAA90220E6D8963837D9EC3D46F8E9679379345282573753F2093E0F2 +Test: Encrypt +Comment: Set 1, vector 456 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E3EF5E9644294206A5707EF83C54E5EF5F4DB9841383C3EB767DEA722E9B7D0E +Test: Encrypt +Comment: Set 1, vector 457 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0EDD01B5FE46475139F14371B548B58C5E33830D6EA6864BFBAB36D25345F8F3 +Test: Encrypt +Comment: Set 1, vector 458 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7DB72BFBC00A04E38DD4B9F2EA5C0114D19B2956EB959BEAD3E29DFB9BFC9A2A +Test: Encrypt +Comment: Set 1, vector 459 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7DB561AF481CC8B010BFD18A0216E2554888BBDD4E90B00476809B48601C9306 +Test: Encrypt +Comment: Set 1, vector 460 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 4EAB74E6D12574BCDEF95BC0CAD67C7E04B24472431607EBAD5F915F1116C9CB +Test: Encrypt +Comment: Set 1, vector 461 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5A48DE560FA1ABF0F85BFF9A0A1928020A6C51AD3FE7C1392C2A875401DE62F0 +Test: Encrypt +Comment: Set 1, vector 462 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 074956F37AF065DBEDB2D68C602A4B65B7D614F8A0B284539E234B307CFDC495 +Test: Encrypt +Comment: Set 1, vector 463 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9BB4837A582A5CB30579DABEEC41ACCB3786AA9BE52DDC88065BE0FFD33917EC +Test: Encrypt +Comment: Set 1, vector 464 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E1E690D74FC254D1D2A8238096285CC100013E8A8BB55FE92F6DF69DB217773E +Test: Encrypt +Comment: Set 1, vector 465 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: DFE35C2BC6ADFEBE4D9E8F84160AD6315CA43F0F022DDC629106E008F29C81AE +Test: Encrypt +Comment: Set 1, vector 466 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 8106B2FE206F9F8738BEC324B531E6943F00B20EC35DEADCB508197EEEBA5473 +Test: Encrypt +Comment: Set 1, vector 467 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E46E36293B659E73FAA1722AF29651621598FF2E92694C99F7BB0C792B93BAB2 +Test: Encrypt +Comment: Set 1, vector 468 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F3CAB9F84AF81A06F9F350C345B44E053C8F1EE36D62159B4993950BB76D0948 +Test: Encrypt +Comment: Set 1, vector 469 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E3381C1644BBBB29290D30F15C96956BF4AEFE443FBDA0DB3EF2CEE7081D1DB3 +Test: Encrypt +Comment: Set 1, vector 470 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A4DD97D2710285907527C4FAE5676774D937FEC609F8489A16384568FAAA699F +Test: Encrypt +Comment: Set 1, vector 471 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 43C608E43584C631E620672EB0A92707C396ACC12CBCE0810A28F7EA3491E0A3 +Test: Encrypt +Comment: Set 1, vector 472 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A1DC3C2AE54BB2FA291913562F05E021AF361E422D39C89D8CFDBE4B672B63ED +Test: Encrypt +Comment: Set 1, vector 473 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 890CB43DA15A1D69A10EA9322B8C14D61AD537462439A735472CEF9428C8A2D9 +Test: Encrypt +Comment: Set 1, vector 474 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9119548582EB7EA7F4AA1B224A6825B786F316EAA7AAA18B61B56D64AA4CBA29 +Test: Encrypt +Comment: Set 1, vector 475 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 574DD7CA20662ECBC730FA7CE314094E427FB8250E0F636894B650DA35A7F0CE +Test: Encrypt +Comment: Set 1, vector 476 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 3575DEA861D0F97DA32438DB834020996820BE85EAE5ED15A7983A31C7669C70 +Test: Encrypt +Comment: Set 1, vector 477 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 27EA06CBD196073357F1F790191D14796FE2BEFBE18B8C48D7566528B3DDA4C6 +Test: Encrypt +Comment: Set 1, vector 478 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 11B190730F6EDE90C8B3FEE01E722ADDD21BEB4324A358F86F524E4B7F7AF975 +Test: Encrypt +Comment: Set 1, vector 479 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 07E3CDB5130D8FF7A2A31335AD478FEF10805E266C00646CFBBEE81F2B3C1711 +Test: Encrypt +Comment: Set 1, vector 480 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A0ED0FFEEBCBF4066EE550E63065B08569B92BCC938002A5469ABD1C397233A0 +Test: Encrypt +Comment: Set 1, vector 481 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2C9CDE299A4C507EC03C617EACE2358E76BC1AD338FE5A66A9105F18788A8836 +Test: Encrypt +Comment: Set 1, vector 482 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5163F9C4ECECD047E83BDF1D6EE233487646A96FE43B4B08C41324FD8ECB271B +Test: Encrypt +Comment: Set 1, vector 483 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: AA2AE4BF506AB3D7607A29C3EF90B4C7933EE58ED3AB3720817FE3C611A850AC +Test: Encrypt +Comment: Set 1, vector 484 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B04B4C802D91D9ADE76EBAFCDBA0A96A8A83DAEB7069370D6E901A42291EB8C6 +Test: Encrypt +Comment: Set 1, vector 485 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 91A99BC40CF38388B4AA77798D720653492CCED5230382ED587A305A2A1A6BCF +Test: Encrypt +Comment: Set 1, vector 486 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 91FB386F3B9AF82F93836005CBD9ED6727B9BBF1F669EAE6D06DA6D04D1AC082 +Test: Encrypt +Comment: Set 1, vector 487 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 01F8956120BF068AE7241BB96FF086C2D67547B549A8743FC0569978F201678E +Test: Encrypt +Comment: Set 1, vector 488 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A8C562A616F918A669A29C0724B76E3D04B125E0AB5A09E8CE60F54E4816EC90 +Test: Encrypt +Comment: Set 1, vector 489 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B41D3BC188419DC929D611197D17FB4D29B78CD7FBC03B904219DD8A2FEE210C +Test: Encrypt +Comment: Set 1, vector 490 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B119861B67AFE45C0134E2336CAC90BAFD1EB94C557EBA6DFDCBE69367B37981 +Test: Encrypt +Comment: Set 1, vector 491 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A2317FD4C041AF4D87C46FC684FBEE8DB65E4D43E5EA74237988A7EB67404656 +Test: Encrypt +Comment: Set 1, vector 492 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 641794C292A1A590F909D01F175E012671AEBF1E432295AED662E74C1EEA5DD4 +Test: Encrypt +Comment: Set 1, vector 493 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7984AC47362281DF446BE46AEC5D9A94B842F6F5BCCB01FD564318A49F94042C +Test: Encrypt +Comment: Set 1, vector 494 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 74F84174C9E2EBBEE396727DBB1C9CFAE2809D802F7E7CF8F7515FA3A629ED98 +Test: Encrypt +Comment: Set 1, vector 495 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7A9E862E27444A492C91CA2EE5E93369FEB74BB881AAC74F895D97E61500FA99 +Test: Encrypt +Comment: Set 1, vector 496 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 638E347CEC7121A668AF985E56F7F3934D852FCF53283B767BAC213337AAE99A +Test: Encrypt +Comment: Set 1, vector 497 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 45DC398895DA1B415708B4BC8B7EF133849E0E8E99945AE4D9C894FDF6D2815D +Test: Encrypt +Comment: Set 1, vector 498 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 1ACF1203B698FE2E3375E251EBBC05D387FECABDE6A9194DF5195F3FBF1E3502 +Test: Encrypt +Comment: Set 1, vector 499 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F6A064BDC6EE0777B09CC1A0154F28AD282D4D6E48F9DE11CA083B8A9F454891 +Test: Encrypt +Comment: Set 1, vector 500 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: FE68FB721E181EA8A62CDD3CA0278C6EB1344DF07E73676D3F0DC501D99721C3 +Test: Encrypt +Comment: Set 1, vector 501 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 72923AD92EF01BDB90B9639DD411E4540CE0F531A0AE401547FBA03CB850B63A +Test: Encrypt +Comment: Set 1, vector 502 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0B1D0F485A4DE59658FE61F1F0010D9EF5A2BA97624CC3687D94EE4335777138 +Test: Encrypt +Comment: Set 1, vector 503 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7423264FBF5EA94BA461BD80B2518B1CAF3757CF5BAB4511144637F5DC917168 +Test: Encrypt +Comment: Set 1, vector 504 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 589FADA29BEA438C12CA96241AA492FCFED48C1C1C05C16C88CD7A8B46E16A0D +Test: Encrypt +Comment: Set 1, vector 505 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 319B5D23945A98C9480E6460CBCB86A8B36038A28500A36182B228060713F58B +Test: Encrypt +Comment: Set 1, vector 506 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: B81B723D3E18A074078B7D041E55B9B130953ECF70BF773273A28E11238651A5 +Test: Encrypt +Comment: Set 1, vector 507 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E660AC40BC4700D4CE85AA43A2A39A24D0F255E64A9251D7442AEFB6EDFD43A8 +Test: Encrypt +Comment: Set 1, vector 508 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: C27914CB70EA29C06B321E4F61730CE6679A342733738BE72C97EED40802EC17 +Test: Encrypt +Comment: Set 1, vector 509 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 764B78FA0EC12E017D9F7C69FF53FA8FA00E7185888F36DBC3CA9A10A6122FBA +Test: Encrypt +Comment: Set 1, vector 510 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E2F9F554823B38D2099DD27E0AD6AD69BE137626840B41B7CF081D7881C47CC7 +Test: Encrypt +Comment: Set 1, vector 511 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 403E453BBAF997A75C4517B588431C75BCF01208B378A4F4FBB138217A9CA4A2 +Test: Encrypt +Comment: Set 2, vector 0 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 8000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2CAE7C0460EE2FC3200923A1B6C2ABEEA746C8B44F6C3FB941BD3AF02A3E6E3E +Test: Encrypt +Comment: Set 2, vector 1 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 4000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 45FAAFBEE792EA704EE3D08CFA9D9F5CF93FEB3443E0049DE5898A48F5A3D92B +Test: Encrypt +Comment: Set 2, vector 2 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 2000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 720F072E7796310AC1BDDD3714581EB95896723DA3E61E0892B43F65A4153965 +Test: Encrypt +Comment: Set 2, vector 3 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 1000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5E6671D1F792673D63940E69D78A3471B3C150707DA72E6C25CBD2C4DA2B9778 +Test: Encrypt +Comment: Set 2, vector 4 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0800000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 2E96F027C2B62ED2D2EE692A992ACAB827D16FDA71DD98109A645E4094923D3B +Test: Encrypt +Comment: Set 2, vector 5 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0400000000000000000000000000000000000000000000000000000000000000 +Ciphertext: A38D7F334B21394B28A29FC9CBC68AD9F2AE85E7434D1C2F57AAA4C1A49DB759 +Test: Encrypt +Comment: Set 2, vector 6 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0200000000000000000000000000000000000000000000000000000000000000 +Ciphertext: F67B5037CE9193023095D43DE312523F99E6CBCDF43EC00A947284496E311DD6 +Test: Encrypt +Comment: Set 2, vector 7 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0100000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7DC030A91C39EC8558AC10044AF79D4CCA92BBC8093B3A2456E26350E35EEBDA +Test: Encrypt +Comment: Set 2, vector 8 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0080000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 99260425AA126953E04A3D959F9153404521EC64C3B35E61EEBA67AAD2C1295A +Test: Encrypt +Comment: Set 2, vector 9 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0040000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 65C380354899581B2B40EDDF40A0695FB608DCDD11C6B0C2CA6BB427DB1D2A9D +Test: Encrypt +Comment: Set 2, vector 10 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0020000000000000000000000000000000000000000000000000000000000000 +Ciphertext: BBD1C4488D41FB1B096E835AD29FC3DC5B97496BA638625D78B99C5ABBDFA13A +Test: Encrypt +Comment: Set 2, vector 11 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0010000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7AFDEE496D690233ED0717E2D92DE3A102FDF902E51E69FFCE244B84A69CA826 +Test: Encrypt +Comment: Set 2, vector 12 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0008000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 06D8C3E7AAC698D143013B364BD7ABC4E4EB6BA82BBAB2A4A0B486E70E24592C +Test: Encrypt +Comment: Set 2, vector 13 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0004000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 727A8BF64932039C3409ED31CFC0171651BA69D551E8073A4BD1D35F31F52336 +Test: Encrypt +Comment: Set 2, vector 14 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0002000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 9EE7CA05C4161860014BEA89FB2DED90B4F0B362AD67789C6045C9C71310A8AA +Test: Encrypt +Comment: Set 2, vector 15 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0001000000000000000000000000000000000000000000000000000000000000 +Ciphertext: E924224559E43960EC44165CAD471CFED381B279B3EA4AF96BDB071BE987DA0D +Test: Encrypt +Comment: Set 2, vector 16 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000800000000000000000000000000000000000000000000000000000000000 +Ciphertext: FF189222046B5F4FB491CDC9A98130D772629F3EF44A06894268C507C25061AF +Test: Encrypt +Comment: Set 2, vector 17 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000400000000000000000000000000000000000000000000000000000000000 +Ciphertext: 6B053BA7765F2A62595A1E83444B52FCF16C8BBBEB21B437E6FC8C5F03B3673F +Test: Encrypt +Comment: Set 2, vector 18 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000200000000000000000000000000000000000000000000000000000000000 +Ciphertext: 0FB836DC6BCDA1C2955CC7A6F25E72C5FFFDE1075D820217157051FB5BD3D3EF +Test: Encrypt +Comment: Set 2, vector 19 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000100000000000000000000000000000000000000000000000000000000000 +Ciphertext: 200EBC8B8217D9A6895253F9366543027E5F493DBA1A5AD4FC7AB66FB806308E +Test: Encrypt +Comment: Set 2, vector 20 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000080000000000000000000000000000000000000000000000000000000000 +Ciphertext: 45B33F2465C674941B7E26C5986E42F6814A71323B420E401DCC8DA200FC3C08 +Test: Encrypt +Comment: Set 2, vector 21 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000040000000000000000000000000000000000000000000000000000000000 +Ciphertext: D2BF0A074053A01A227DC439311BF8BD696203995285A3A2CD3674A0CC6A65B2 +Test: Encrypt +Comment: Set 2, vector 22 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000020000000000000000000000000000000000000000000000000000000000 +Ciphertext: 5FFFAB58BA2CB27AE92E10F36F99A8EFEDF9DE2446A9C2E82E48F22FB1ED8C5D +Test: Encrypt +Comment: Set 2, vector 23 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000010000000000000000000000000000000000000000000000000000000000 +Ciphertext: 835A1BD7A3688BA0F7C572417A06FCCBCE0A69C7FCDF10C8BCF4469AE80DF11E +Test: Encrypt +Comment: Set 2, vector 24 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000008000000000000000000000000000000000000000000000000000000000 +Ciphertext: 559D1BECB3DBBE40A7E31C66D97D292821B934818172553FC1CE68AD8E6A741F +Test: Encrypt +Comment: Set 2, vector 25 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000004000000000000000000000000000000000000000000000000000000000 +Ciphertext: D962BE9A9C4F8DDA6F0EC42DB8B48FA14A1E91E639BD85FF26A2543D9FDFA9A9 +Test: Encrypt +Comment: Set 2, vector 26 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000002000000000000000000000000000000000000000000000000000000000 +Ciphertext: 588B2319C62ED25ECEAB7C327B212F5FCD5D89DE8A85AA3713BF332CF5F715DF +Test: Encrypt +Comment: Set 2, vector 27 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000001000000000000000000000000000000000000000000000000000000000 +Ciphertext: 67EDE571C64AFF87D7AE5294E64F1709F920A10D278E1629FC8B2BE7EF5ABE0D +Test: Encrypt +Comment: Set 2, vector 28 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000800000000000000000000000000000000000000000000000000000000 +Ciphertext: 60D9E58A6828847F9644DC165EB508B5A2BC67219B969B605B3CFAE109C9CE47 +Test: Encrypt +Comment: Set 2, vector 29 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000400000000000000000000000000000000000000000000000000000000 +Ciphertext: 5A0C538CB78F13404BF8D8AF5C43A17F04AD0D35DAD45F88E26B9D1C204B5AFB +Test: Encrypt +Comment: Set 2, vector 30 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000200000000000000000000000000000000000000000000000000000000 +Ciphertext: 724EE8B7D7BCAC2587C42D92FFCDF7EDFF91F06AD43ED353F332E1FAC3B70F5F +Test: Encrypt +Comment: Set 2, vector 31 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000100000000000000000000000000000000000000000000000000000000 +Ciphertext: D50F11DACBF340C1315419D1983028DCED83F8350FE50DA4F9554DFA641E99E1 +Test: Encrypt +Comment: Set 2, vector 32 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000080000000000000000000000000000000000000000000000000000000 +Ciphertext: 9460ACD1B739015ED197B2659353AAC465339FAD9D1AFB845A337630332C1C55 +Test: Encrypt +Comment: Set 2, vector 33 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000040000000000000000000000000000000000000000000000000000000 +Ciphertext: 7D7A56F8A89463C4CE519B96854200C6E05703651CE3ACD5549B59D0B9788B93 +Test: Encrypt +Comment: Set 2, vector 34 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000020000000000000000000000000000000000000000000000000000000 +Ciphertext: D07E4F830ADF1DE4886C614CDB6B3D988884293AE65A63B3E9886A8727C022B2 +Test: Encrypt +Comment: Set 2, vector 35 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000010000000000000000000000000000000000000000000000000000000 +Ciphertext: 56CCEC1812B3B83086208DBF0C98119DC1CAE316E91B09F4F6F36BDCF73F8873 +Test: Encrypt +Comment: Set 2, vector 36 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000008000000000000000000000000000000000000000000000000000000 +Ciphertext: E8C3012B0EEB2D18DEA4C06BAC2906DF858BFB8A4D86D6841C02A9E45B2D0455 +Test: Encrypt +Comment: Set 2, vector 37 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000004000000000000000000000000000000000000000000000000000000 +Ciphertext: E10FB90CB2F5F830763FCEFA386A8E70052AB8994A55DC95FEDF8B71E11D2636 +Test: Encrypt +Comment: Set 2, vector 38 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000002000000000000000000000000000000000000000000000000000000 +Ciphertext: 848DFB81A0D4D13A40F9119AB77A3B6D2B96E76396B39984739FDF31ADBC376F +Test: Encrypt +Comment: Set 2, vector 39 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000001000000000000000000000000000000000000000000000000000000 +Ciphertext: 61068A490E20E07686D8A77B81718A3214508E3FE3DA6A6BBAA8ABD67B98623F +Test: Encrypt +Comment: Set 2, vector 40 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000800000000000000000000000000000000000000000000000000000 +Ciphertext: 9197E2A5212260324CA6E6FA0BBA56B4E5D9934C8B9E42D9F43E901C0994082C +Test: Encrypt +Comment: Set 2, vector 41 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000400000000000000000000000000000000000000000000000000000 +Ciphertext: E9DC3C1445CBFF1B863CF3FB6B338B4EC29F2C083E65A4BBCC2F1FAC22CCA8DD +Test: Encrypt +Comment: Set 2, vector 42 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000200000000000000000000000000000000000000000000000000000 +Ciphertext: 80039358C99E64A255D5E4E334C830FFEC8E0CBF2EB6030DE7DCE1A938821938 +Test: Encrypt +Comment: Set 2, vector 43 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000100000000000000000000000000000000000000000000000000000 +Ciphertext: E508D93429BBE95EE38672A2F653841701F391C68235391367F16415C2C84ADC +Test: Encrypt +Comment: Set 2, vector 44 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000080000000000000000000000000000000000000000000000000000 +Ciphertext: 710463874DF68B8930CC5CD6A00ABA2BCE27352997F2582EF472ED5F5AFE75A8 +Test: Encrypt +Comment: Set 2, vector 45 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000040000000000000000000000000000000000000000000000000000 +Ciphertext: E90AD04D26F4FF6D25D193CD2C34A2E1C6A1E570CCC705B873CACC94E61F79A7 +Test: Encrypt +Comment: Set 2, vector 46 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000020000000000000000000000000000000000000000000000000000 +Ciphertext: 8E19B69D55C9A2B2CCEACB50EC8007F39C81A0F261A8568D1298967C132BB790 +Test: Encrypt +Comment: Set 2, vector 47 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000010000000000000000000000000000000000000000000000000000 +Ciphertext: 4051E2FA9032676DC6E11CE947C64C9A0C0FC262AA41F40FA0C4093D1E4FA924 +Test: Encrypt +Comment: Set 2, vector 48 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000008000000000000000000000000000000000000000000000000000 +Ciphertext: 5DA6F415CCDF1A2D3335A0BEBB879D88CB9C871744111004C0E5AA6D27EB0311 +Test: Encrypt +Comment: Set 2, vector 49 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000004000000000000000000000000000000000000000000000000000 +Ciphertext: 684C24EC1DD06F6B565890190BE1F8BC7F4537CF5F9CF038ECB6D1D86164503A +Test: Encrypt +Comment: Set 2, vector 50 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000002000000000000000000000000000000000000000000000000000 +Ciphertext: 6D259C132726524987D4FD96C1ECD943D6B87BB98C61C4FFE41E282EC82F246A +Test: Encrypt +Comment: Set 2, vector 51 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000001000000000000000000000000000000000000000000000000000 +Ciphertext: 14707F80CC43E4E6321362B0ACFF84FE57E9D477B56637D01CAA09B232D726C5 +Test: Encrypt +Comment: Set 2, vector 52 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000800000000000000000000000000000000000000000000000000 +Ciphertext: FE98609B71F9CD65CD377C98BC4117EC8708E58D15361F9CAC02C64F0452B80D +Test: Encrypt +Comment: Set 2, vector 53 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000400000000000000000000000000000000000000000000000000 +Ciphertext: 1B78E77F935EBA86B28C9B37818245E2865AF84A73C9DAA735E42E6009AA07F3 +Test: Encrypt +Comment: Set 2, vector 54 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000200000000000000000000000000000000000000000000000000 +Ciphertext: F354ADD75ED9E121B1BFAD9483C6825AEF57BAA2DF08B519640E022E196B313F +Test: Encrypt +Comment: Set 2, vector 55 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000100000000000000000000000000000000000000000000000000 +Ciphertext: 7E0D7DCC0642CD5BF0C39460C4C183E5F321BCAB5EEA0AC7021E1AECE423E2A9 +Test: Encrypt +Comment: Set 2, vector 56 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000080000000000000000000000000000000000000000000000000 +Ciphertext: D1CCBD3EEA6ACF918569BEC2C900723B4359CA19C58E32ED65FDCBAA30A41C98 +Test: Encrypt +Comment: Set 2, vector 57 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000040000000000000000000000000000000000000000000000000 +Ciphertext: 361246D37645483C6D13C6500326694A0D577604CDF7CD36586B6C7F96FBE077 +Test: Encrypt +Comment: Set 2, vector 58 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000020000000000000000000000000000000000000000000000000 +Ciphertext: 0BC890CF369C233EDB99A51CEC75BFF60FB36BFB3EC15F253054F8865CB16DFF +Test: Encrypt +Comment: Set 2, vector 59 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000010000000000000000000000000000000000000000000000000 +Ciphertext: B5ED5183A00C882F8D213AFCE35C14E940407B7C2A8C9A5A19F289AED42DFAD7 +Test: Encrypt +Comment: Set 2, vector 60 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000008000000000000000000000000000000000000000000000000 +Ciphertext: 22B4EA3A5718D6CEE4EA78725F5BAC735C539C343D7B45121EDDA22CA39D9413 +Test: Encrypt +Comment: Set 2, vector 61 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000004000000000000000000000000000000000000000000000000 +Ciphertext: 94ECEC21BC3426C7214F266B6442F85B6AE765BD6206A951B2AA14505D19FBCA +Test: Encrypt +Comment: Set 2, vector 62 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000002000000000000000000000000000000000000000000000000 +Ciphertext: EF77932A5749126D65BD88330C18D91EDBB7FB53D7B3B675EE148EFC893559B9 +Test: Encrypt +Comment: Set 2, vector 63 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000001000000000000000000000000000000000000000000000000 +Ciphertext: BB9E132DC5DE8035433FBEAC46395E861BDA17A4892FFE6BD1B10D6B4D6AE0F3 +Test: Encrypt +Comment: Set 2, vector 64 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000800000000000000000000000000000000000000000000000 +Ciphertext: 7B536CF871F7FF406AD640683F405F0E14D72E77CDD2AB091D9A8E169155CE24 +Test: Encrypt +Comment: Set 2, vector 65 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000400000000000000000000000000000000000000000000000 +Ciphertext: 2417835AB4BD0A1D3439310480224C52796F3DB3536419F51A09551DFD4A6799 +Test: Encrypt +Comment: Set 2, vector 66 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000200000000000000000000000000000000000000000000000 +Ciphertext: 8E49C9819DFF2DEFCD8DF3E9EA910F79A9A932F43E4B763D6988CC0924C20544 +Test: Encrypt +Comment: Set 2, vector 67 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000100000000000000000000000000000000000000000000000 +Ciphertext: 1D364FDEFCB51560E4408CF25FC05E7698235D271E725590533CE24E3F3EC1EE +Test: Encrypt +Comment: Set 2, vector 68 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000080000000000000000000000000000000000000000000000 +Ciphertext: F1C0422AC64E4D566E799ADA6CE33B59C31051C55ED2212841460CE330F2763E +Test: Encrypt +Comment: Set 2, vector 69 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000040000000000000000000000000000000000000000000000 +Ciphertext: FA90883588183011F2748ADBC5217BA38CF6787FFD8BFCBEA06ADE193B1313C5 +Test: Encrypt +Comment: Set 2, vector 70 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000020000000000000000000000000000000000000000000000 +Ciphertext: 84EE69F947AEAAA0F1F2DA8C1508733D31F62FEBCF7085C68DEA5A602A566EBF +Test: Encrypt +Comment: Set 2, vector 71 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000010000000000000000000000000000000000000000000000 +Ciphertext: 260C06AB73B581E29C34FEE05363F532D4C693B5E8025291FC99C48F9CFCEFF8 +Test: Encrypt +Comment: Set 2, vector 72 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000008000000000000000000000000000000000000000000000 +Ciphertext: 98184C744C6A24B329A7827CE0F5B30AE709493A22F9064D1C3F7FED046D1C2A +Test: Encrypt +Comment: Set 2, vector 73 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000004000000000000000000000000000000000000000000000 +Ciphertext: 3CCDF1C3103B356E7A460410D91F1F00F749EB96F3E89F91248FB5E0949806EF +Test: Encrypt +Comment: Set 2, vector 74 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000002000000000000000000000000000000000000000000000 +Ciphertext: 49AB6245E93A6CF84BF66A7451D134535362CB8A8CE2E47012BF8B4EF02894D4 +Test: Encrypt +Comment: Set 2, vector 75 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000001000000000000000000000000000000000000000000000 +Ciphertext: 7A92C7BB97CB99AD15EA9DA3A629031901840D23EA4227C699944882E2E8F3CC +Test: Encrypt +Comment: Set 2, vector 76 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000800000000000000000000000000000000000000000000 +Ciphertext: 00FC7EBE56FCB696D9606FBBEEA6955871B7A03CDCAAE25DFC47D06145371AD3 +Test: Encrypt +Comment: Set 2, vector 77 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000400000000000000000000000000000000000000000000 +Ciphertext: FFF7327A979B527486052C1B99DECCFCC5E680D39613DE4107E8A04980DDFD70 +Test: Encrypt +Comment: Set 2, vector 78 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000200000000000000000000000000000000000000000000 +Ciphertext: 1E950B49D7D446867ED48272D220BCCC35B104A76A107880FB37D8AE55E69F58 +Test: Encrypt +Comment: Set 2, vector 79 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000100000000000000000000000000000000000000000000 +Ciphertext: 3B97EDED4E70497DAE02FD51E10AB26888096D2D182A7BC7EE55B6F3243E0144 +Test: Encrypt +Comment: Set 2, vector 80 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000080000000000000000000000000000000000000000000 +Ciphertext: 94414A0116665FFD8D1589B050A1663DBA15463206DA4E6A735B58FA7B4AA7ED +Test: Encrypt +Comment: Set 2, vector 81 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000040000000000000000000000000000000000000000000 +Ciphertext: D586FFCBBF32561B9659306068DD31C2A1FBC8DDF99CF0BDAB3DCC0664B403C7 +Test: Encrypt +Comment: Set 2, vector 82 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000020000000000000000000000000000000000000000000 +Ciphertext: 061E17DB1EAF9884C940B8C72E884C8D9D46819FDDF6724239168DDBEE170B9B +Test: Encrypt +Comment: Set 2, vector 83 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000010000000000000000000000000000000000000000000 +Ciphertext: D70F322E45E1D64B3D91249E9DE766DB7EF9084120C13D0215F31A6DE2E791C6 +Test: Encrypt +Comment: Set 2, vector 84 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000008000000000000000000000000000000000000000000 +Ciphertext: 5018967FCA5E67F24DCCE2190D24CD3E24A0B709B70DC38F1A4B4FE39CDCD2E5 +Test: Encrypt +Comment: Set 2, vector 85 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000004000000000000000000000000000000000000000000 +Ciphertext: 9108A0540D8D02658268185F06DFF6F2248681D0D9F9F4C6658942FC27C68246 +Test: Encrypt +Comment: Set 2, vector 86 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000002000000000000000000000000000000000000000000 +Ciphertext: 6595E74A5943DFE1A3FC19ADEBF190CDEC4C2EA0B7CCC6364E0AF7222CCEAA46 +Test: Encrypt +Comment: Set 2, vector 87 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000001000000000000000000000000000000000000000000 +Ciphertext: 5F156FB20AFD4BC0E4E4B2BA7700A38FFCAF9229E3CBA8C99915B692A76ACDEA +Test: Encrypt +Comment: Set 2, vector 88 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000800000000000000000000000000000000000000000 +Ciphertext: F0584D66033584791BED0EB67D2A73AA918E0F88F08683DC1F67DB7DD3375326 +Test: Encrypt +Comment: Set 2, vector 89 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000400000000000000000000000000000000000000000 +Ciphertext: 5EB0956E3DA8ECFC571D5BD1C4EF430FBB10117C6684B8530B6552B812780EBF +Test: Encrypt +Comment: Set 2, vector 90 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000200000000000000000000000000000000000000000 +Ciphertext: E8C8CB56ED63B5BA16DD833CC9C7AC77E425C284FFD547E8F9FE10410CA02FF3 +Test: Encrypt +Comment: Set 2, vector 91 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000100000000000000000000000000000000000000000 +Ciphertext: 68704A278A231ED468C1F0CFF43A4FC61253EACBE2BDCE1ED86D89F43263016D +Test: Encrypt +Comment: Set 2, vector 92 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000080000000000000000000000000000000000000000 +Ciphertext: CA16F899842EE79CBAC4D7CD67172C7DD537E6EA21D48C15B0B34B29BF87E79B +Test: Encrypt +Comment: Set 2, vector 93 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000040000000000000000000000000000000000000000 +Ciphertext: 9E6E7B31FF5D4D5C7D1C264273A27DA542BFCC6116B7DFDEF6332690B7304BDD +Test: Encrypt +Comment: Set 2, vector 94 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000020000000000000000000000000000000000000000 +Ciphertext: FE466983DED41AFB1908DF12A5532054C6DB320F0ECBDCE7610BBE2A07AA7F68 +Test: Encrypt +Comment: Set 2, vector 95 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000010000000000000000000000000000000000000000 +Ciphertext: D2D93C1B66FD710F8B72564A44ACA93995938FEE7C38DE482C9586E3413EB40C +Test: Encrypt +Comment: Set 2, vector 96 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000008000000000000000000000000000000000000000 +Ciphertext: 6623F853780833A60B60E6467CFA3D3D000228F2C8334F8B00CFE119133D41C7 +Test: Encrypt +Comment: Set 2, vector 97 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000004000000000000000000000000000000000000000 +Ciphertext: 1CED4727527E1C3107A89E77645241D240F3F113AC2BF8319E5D8EFF68997595 +Test: Encrypt +Comment: Set 2, vector 98 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000002000000000000000000000000000000000000000 +Ciphertext: FA450B3D8A7C03B643DF6EC70867D0502AE20235335AF5932A7016D71A6059A4 +Test: Encrypt +Comment: Set 2, vector 99 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000001000000000000000000000000000000000000000 +Ciphertext: A6F76AB74CE44538579369F5367B826C4EA72EB6EE08A0CFE1272EB435FDFEFC +Test: Encrypt +Comment: Set 2, vector 100 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000800000000000000000000000000000000000000 +Ciphertext: 8108B48A62A0E0CD58B066C10613E2B589CFB0BCEF4EB58BBF8C88E84A2CD258 +Test: Encrypt +Comment: Set 2, vector 101 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000400000000000000000000000000000000000000 +Ciphertext: F335D10835B018414786D30923663B77B2E0CA65423B96BFA885B9797138CF4F +Test: Encrypt +Comment: Set 2, vector 102 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000200000000000000000000000000000000000000 +Ciphertext: 87D8E75FEDA12025B9517BBF8421E837872E8978E48DA51BB8B8574C04731091 +Test: Encrypt +Comment: Set 2, vector 103 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000100000000000000000000000000000000000000 +Ciphertext: B8A50E6EDFF9711C6064812423F5DC5D77970BE65B545C042A02BACB30A4CD6F +Test: Encrypt +Comment: Set 2, vector 104 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000080000000000000000000000000000000000000 +Ciphertext: EB98815E5A9337DF35F98D7CF27183EC8423D5F9D145326638B864E0F994DD7D +Test: Encrypt +Comment: Set 2, vector 105 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000040000000000000000000000000000000000000 +Ciphertext: 3E5DDB36ABD739986483DE7A9EEF2468461A02B55CAA24100394442F0946F337 +Test: Encrypt +Comment: Set 2, vector 106 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000020000000000000000000000000000000000000 +Ciphertext: 809F726C3BB19BD09D4412B64777085D968ED4E612286008C4BAC69F671E7E31 +Test: Encrypt +Comment: Set 2, vector 107 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000010000000000000000000000000000000000000 +Ciphertext: 28F2EE8D382DF1AB0CF82B93C7A09B87180E8D19C35657302EFE1B1C4CA11ED4 +Test: Encrypt +Comment: Set 2, vector 108 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000008000000000000000000000000000000000000 +Ciphertext: 76E6887FC464215C9576BB233F5A3A7D98CA73F9B2D06E3BB81BC34AF02C8CE9 +Test: Encrypt +Comment: Set 2, vector 109 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000004000000000000000000000000000000000000 +Ciphertext: E8CEF712D7AF841C4FE7800CB04C27E25BDB41BECFA894588F73776CAAE2A0FA +Test: Encrypt +Comment: Set 2, vector 110 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000002000000000000000000000000000000000000 +Ciphertext: 868D3A678A216D01A765046E2991A21F9626493063AFE771E3369E5DA2BA7E9B +Test: Encrypt +Comment: Set 2, vector 111 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000001000000000000000000000000000000000000 +Ciphertext: D6465061FA1B143E1F6A3FCC1601D2D9FAEEF995C457E9EE301A27E8139D1AFE +Test: Encrypt +Comment: Set 2, vector 112 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000800000000000000000000000000000000000 +Ciphertext: B42BB57D2F25612AAB33EF3213D6D210D9831502A1C4D51C4E72148CBB9893D1 +Test: Encrypt +Comment: Set 2, vector 113 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000400000000000000000000000000000000000 +Ciphertext: CE0EC3C44BFAABE6E18B3506E01199B0F2E0BCA4EA6C29D367EDDD0E83A1C65F +Test: Encrypt +Comment: Set 2, vector 114 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000200000000000000000000000000000000000 +Ciphertext: 627101F50E134D6F33EF70AF0E32A3AF7C3237E3A5D99319719F175DD0392383 +Test: Encrypt +Comment: Set 2, vector 115 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000100000000000000000000000000000000000 +Ciphertext: CBCC83BE624059BD8B950BCF486AFBC342CF3575EBA6950FB39C03DB4822EDD9 +Test: Encrypt +Comment: Set 2, vector 116 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000080000000000000000000000000000000000 +Ciphertext: 5EAD7961798903C315DD89BE57105FEA164CA06A4ECDBB5CB10B76711C3E49A0 +Test: Encrypt +Comment: Set 2, vector 117 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000040000000000000000000000000000000000 +Ciphertext: 69169E6E11EAC935E12E6E30EFCEDD7236EAED9C5E1E3B215CD7167AB88B199D +Test: Encrypt +Comment: Set 2, vector 118 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000020000000000000000000000000000000000 +Ciphertext: 5B08F07728399920CA30DC57CE94CAE85A44530033B2AE6BB7F8E29D7934C437 +Test: Encrypt +Comment: Set 2, vector 119 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000010000000000000000000000000000000000 +Ciphertext: 8FAD35B4FBC3BBAB2F4BF00D8A1651BE3FD77085AC5E6C7F6E2EDF5048F86068 +Test: Encrypt +Comment: Set 2, vector 120 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000008000000000000000000000000000000000 +Ciphertext: 71B22D911D9E754A76EC052CD7DC503CDE9A16E9043A04CFA244D8EB19FC21AA +Test: Encrypt +Comment: Set 2, vector 121 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000004000000000000000000000000000000000 +Ciphertext: 062A10B7F5E3E8D7F3FC2C14E10EC9CA947A8FDC0EBC01E3A127BAFE689D6577 +Test: Encrypt +Comment: Set 2, vector 122 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000002000000000000000000000000000000000 +Ciphertext: 0FC375F0F68567F1827C7218132B434E84DA6377DB50AB330E8D9BD2754BD1B8 +Test: Encrypt +Comment: Set 2, vector 123 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000001000000000000000000000000000000000 +Ciphertext: 0E4C1117D462EEBCF5FCD7AC9807AF40C403910421CD19A4634B1C86113EB387 +Test: Encrypt +Comment: Set 2, vector 124 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000800000000000000000000000000000000 +Ciphertext: A9DB2CD2A23780D8BC5A2567961BCA24A41531157D4A229046B47DE48CAE0FDD +Test: Encrypt +Comment: Set 2, vector 125 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000400000000000000000000000000000000 +Ciphertext: 7195678F00F98B00706E7C497E5FA2BC648EDA00B4B7DFAC6234C8232DF8E071 +Test: Encrypt +Comment: Set 2, vector 126 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000200000000000000000000000000000000 +Ciphertext: E5C1970C7C0B8E7E1BF871219486359C2E5037BE6E8E637BDB9F11051FB36A16 +Test: Encrypt +Comment: Set 2, vector 127 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000100000000000000000000000000000000 +Ciphertext: 2426496DC3B09404B609157E2273D526C3E6909B82F65527B42ABDD6348CF602 +Test: Encrypt +Comment: Set 2, vector 128 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000080000000000000000000000000000000 +Ciphertext: F9870238947E1575AF11D14D12E593163B98BA12E79F05563CBFFBCFB23FDC38 +Test: Encrypt +Comment: Set 2, vector 129 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000040000000000000000000000000000000 +Ciphertext: 2B1E410ACE9E8875F965A29D90773B68CAC452AE98CEB5922B7BAD936ACC421B +Test: Encrypt +Comment: Set 2, vector 130 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000020000000000000000000000000000000 +Ciphertext: 180285A7AD7DD8FFD619970804F0FDB9706D5F5C467F815D0B1A455DED9D9300 +Test: Encrypt +Comment: Set 2, vector 131 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000010000000000000000000000000000000 +Ciphertext: BAEB5C1C68D72F1AE4735F6B75CDF9265E4F6F55DA934C4F118A3728AA2BC0D5 +Test: Encrypt +Comment: Set 2, vector 132 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000008000000000000000000000000000000 +Ciphertext: 9DEBFCC984F55E97C0064335C8A4B7489B7BDD75560EA51982114FCE4D481032 +Test: Encrypt +Comment: Set 2, vector 133 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000004000000000000000000000000000000 +Ciphertext: DF3B0B54DF4D1814A6F46B8F8B37E27AE8B9EC54B97BF9C523F1EC713EDDFFEE +Test: Encrypt +Comment: Set 2, vector 134 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000002000000000000000000000000000000 +Ciphertext: 37AA04C74A1E8ED165BC1B4C97265A32B5579D9B2A7B7C883A98B616D5C24FAE +Test: Encrypt +Comment: Set 2, vector 135 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000001000000000000000000000000000000 +Ciphertext: 83815356746186AE4CC327AB3A8CE04EF66ABD32D44D7089F1D7E301BFE006D6 +Test: Encrypt +Comment: Set 2, vector 136 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000800000000000000000000000000000 +Ciphertext: 2C6C7878E099F55653CA784A0BE4C9EC6201AFDCF99CDDC1ED862D4FE88CFDC8 +Test: Encrypt +Comment: Set 2, vector 137 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000400000000000000000000000000000 +Ciphertext: 424804513D38537C024955F2CCB29BECFD801FC06CD8EC5DE353872F0B50616F +Test: Encrypt +Comment: Set 2, vector 138 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000200000000000000000000000000000 +Ciphertext: 48C31A55ED4716825D43FF671C01A86CDD792AABF78703ADC58F5FD65B3C0DE1 +Test: Encrypt +Comment: Set 2, vector 139 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000100000000000000000000000000000 +Ciphertext: BF99E4263F2C512CDE33A91E04FACA55052444E40FF79F09716FC06D24FDDE1D +Test: Encrypt +Comment: Set 2, vector 140 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000080000000000000000000000000000 +Ciphertext: 1A40488BA16A5D0AE6381018F15ABF95C78FB05867E3D7E213CAD7BA3DC9EA3B +Test: Encrypt +Comment: Set 2, vector 141 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000040000000000000000000000000000 +Ciphertext: BEAD8979A1A485959C3E9C8BF9CCF7CF850EB205296E1E8FF8BCAFBB011FF21D +Test: Encrypt +Comment: Set 2, vector 142 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000020000000000000000000000000000 +Ciphertext: A8EDCC85F5A941B4434BD4DAD5E39EEAD102DA25BBB2C3D143572AC7425ED819 +Test: Encrypt +Comment: Set 2, vector 143 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000010000000000000000000000000000 +Ciphertext: 631126B3A837AA4C999EFE6A687BBA58751464A6395670213C8445CC8409C33F +Test: Encrypt +Comment: Set 2, vector 144 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000008000000000000000000000000000 +Ciphertext: CA4A5FD3A3D2DA973E16C0A849E374C5A293351A66415B45107BD228CB842B19 +Test: Encrypt +Comment: Set 2, vector 145 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000004000000000000000000000000000 +Ciphertext: A61FDF733DDEC4C3AE51BE778BDD6E34BED64449ABCA7A718EAA513A2A5A9014 +Test: Encrypt +Comment: Set 2, vector 146 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000002000000000000000000000000000 +Ciphertext: 2C632530E7FCD550B5F9D14E21409AFD07C7E1FBF04B3B3FEC8C61AC8A1591ED +Test: Encrypt +Comment: Set 2, vector 147 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000001000000000000000000000000000 +Ciphertext: B2D97A1D343D3D5E1A7E444BA6E57D2E5ED42E02F719ECA22BA47E796AB37B18 +Test: Encrypt +Comment: Set 2, vector 148 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000800000000000000000000000000 +Ciphertext: AC515AAC675C2C3E46A8F77578189149327413CF40B48E16BF83D3500C2B1355 +Test: Encrypt +Comment: Set 2, vector 149 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000400000000000000000000000000 +Ciphertext: C8ADC6079B92459A8E975FFFE2352A90629CF9E8D53630536D9EBC7DAC4C467E +Test: Encrypt +Comment: Set 2, vector 150 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000200000000000000000000000000 +Ciphertext: 97B2C40964B25AE5CBD092E36B37A3BB4520570A9920034C584C66600D3857D9 +Test: Encrypt +Comment: Set 2, vector 151 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000100000000000000000000000000 +Ciphertext: 99A017D3829CEFE10DDD33D33F53EA470A2A74A35ED3BED8B7E9D6EF3B790153 +Test: Encrypt +Comment: Set 2, vector 152 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000080000000000000000000000000 +Ciphertext: 6141854199F9E01CFE4A35DF918B805985ACC8F8A7456FFBF91D27D4E85E4C49 +Test: Encrypt +Comment: Set 2, vector 153 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000040000000000000000000000000 +Ciphertext: 28BC7571E7C921B31BC2D7BF55853C2CC5B815B39471907DAE152F685791378B +Test: Encrypt +Comment: Set 2, vector 154 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000020000000000000000000000000 +Ciphertext: AD751D4D9D635900C22B6166328ECD85FB4A1610D055793BF04A83CB6F5F02DB +Test: Encrypt +Comment: Set 2, vector 155 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000010000000000000000000000000 +Ciphertext: 8670009356A0A3BD402CF218664826C05BE1651C6E606C011967F8F9C3835017 +Test: Encrypt +Comment: Set 2, vector 156 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000008000000000000000000000000 +Ciphertext: 6CE35F565BC4F38D73116267C49D345B7B19D57D5C90136CAF512F76AF47FAAD +Test: Encrypt +Comment: Set 2, vector 157 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000004000000000000000000000000 +Ciphertext: FD0DF28AFE47414F99219AD120F33DCA6F8756B2264349911041B0AEC9D77A43 +Test: Encrypt +Comment: Set 2, vector 158 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000002000000000000000000000000 +Ciphertext: 49CE284D7A18A0608E5E3768286E919DE97DD81B369AB0A012AD7BDC491DED1A +Test: Encrypt +Comment: Set 2, vector 159 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000001000000000000000000000000 +Ciphertext: 12B27FEC757A809C68F670698E5CB40E762855022FC12DE2332DB9814FC6E5E2 +Test: Encrypt +Comment: Set 2, vector 160 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000800000000000000000000000 +Ciphertext: 53074884476D09C729F35C3906046C2DCBA7F12BF59CDD3CE73ABF91847C6369 +Test: Encrypt +Comment: Set 2, vector 161 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000400000000000000000000000 +Ciphertext: D29E3C55DD3D867D7263D2C961FDB6A97B8D827AB73A20479ACB06DF992AEC24 +Test: Encrypt +Comment: Set 2, vector 162 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000200000000000000000000000 +Ciphertext: 4BE421463C6F2CC8118A50684EB5FC98323EA27F03D4B98EC05727BA0FFA40E8 +Test: Encrypt +Comment: Set 2, vector 163 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000100000000000000000000000 +Ciphertext: A96EC7F07298F9D86A811D0110D60E65C80F3E913B575831A5E8533932196B24 +Test: Encrypt +Comment: Set 2, vector 164 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000080000000000000000000000 +Ciphertext: F12B579997BA4203D8A0FF36181E4C1B50C703FE32CF18D9BF84355BC404D135 +Test: Encrypt +Comment: Set 2, vector 165 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000040000000000000000000000 +Ciphertext: 35EBB3FE5FACC9B9D321E82A73C344CA05D0E73372579349A1F365DEA0105292 +Test: Encrypt +Comment: Set 2, vector 166 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000020000000000000000000000 +Ciphertext: 0F1F0518D57ADC91D810B5899EB7EE7900D05AD8AD2960FE07893F30859B636F +Test: Encrypt +Comment: Set 2, vector 167 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000010000000000000000000000 +Ciphertext: A6CAF97EF17BEFDCF3412D7F45F72C1F1726198ED3B5CD905DF9078DCD70F882 +Test: Encrypt +Comment: Set 2, vector 168 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000008000000000000000000000 +Ciphertext: E287019353E8C71C62178B3AF7A3ECA210D79F803F43C09B6C08F295367A30CA +Test: Encrypt +Comment: Set 2, vector 169 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000004000000000000000000000 +Ciphertext: CF7A7ECEA347875A7B9191BF9FFDC3FB53512052FA42370E39BF5D906EE82D4E +Test: Encrypt +Comment: Set 2, vector 170 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000002000000000000000000000 +Ciphertext: 7E362B5B5ED5CAB9A518320E498FDB915BFD72BB5C588495AC49FC2D5CEC2134 +Test: Encrypt +Comment: Set 2, vector 171 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000001000000000000000000000 +Ciphertext: 69254195C6A9A4D334F8F0558A6C9635EB8A397E5AB672E81DC194AFA5C3A8B7 +Test: Encrypt +Comment: Set 2, vector 172 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000800000000000000000000 +Ciphertext: 3934A6BA3DE9885771111CBA59D50EC684F8F612AAAE3E511C0A211D972723C4 +Test: Encrypt +Comment: Set 2, vector 173 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000400000000000000000000 +Ciphertext: BCEE40ADD3CFDE924F58786640A56A68FE83615EDD82873DF6908057AF39F74A +Test: Encrypt +Comment: Set 2, vector 174 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000200000000000000000000 +Ciphertext: 70F4E0381A989C486A45FAE5B108373E950843EE48DC2A43E7AA625BF3AC9838 +Test: Encrypt +Comment: Set 2, vector 175 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000100000000000000000000 +Ciphertext: FAED24C44DE7F447CD1169F4D8D734E55154B73F79B31AD1CD310C7F5529433A +Test: Encrypt +Comment: Set 2, vector 176 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000080000000000000000000 +Ciphertext: 887BA60DED98C75DADDC1CD0824E7E6C76D947617A919A3B870B489CD1B7F6B2 +Test: Encrypt +Comment: Set 2, vector 177 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000040000000000000000000 +Ciphertext: 33D833FFDB7BEB6BBAB4DDACA6784B88C4B76A49641AA01BC980AB31084F4351 +Test: Encrypt +Comment: Set 2, vector 178 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000020000000000000000000 +Ciphertext: 8CDEF08AB44C2CB2AB5EC94437E501A96999B30C045A79DE99E220595B95DA2F +Test: Encrypt +Comment: Set 2, vector 179 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000010000000000000000000 +Ciphertext: 029247C8EC0610E7F5B49FA4191E99CDECBC1E44DF123270901A57DE8ED64850 +Test: Encrypt +Comment: Set 2, vector 180 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000008000000000000000000 +Ciphertext: 08487E1E53C677CA34640459BDBF7C53247DD54624B9C2156A59F24A818A258E +Test: Encrypt +Comment: Set 2, vector 181 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000004000000000000000000 +Ciphertext: 2C7C0444738DB202D9236CF00E1B75F579E18CAD4341093675F66732746F8060 +Test: Encrypt +Comment: Set 2, vector 182 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000002000000000000000000 +Ciphertext: F493AF90C19A9EA6460AE35418D4857236D678B570352665092854CFF9FB684E +Test: Encrypt +Comment: Set 2, vector 183 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000001000000000000000000 +Ciphertext: 4575CF8865954F9FDCC9C2F7A41BFD52B1C770E2C7609151E41D9B1D0489500C +Test: Encrypt +Comment: Set 2, vector 184 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000800000000000000000 +Ciphertext: BA0606FA831D4EF759CF457F88B0EEDFDF13BD3ABF72547456052C877B9E3A3B +Test: Encrypt +Comment: Set 2, vector 185 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000400000000000000000 +Ciphertext: 10E979D310CAD332AA3DC860EF69B2BBD96E817BFB93393AD4D8B141C0A301E4 +Test: Encrypt +Comment: Set 2, vector 186 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000200000000000000000 +Ciphertext: B46DE2A7729FAF7CEE978353D4392EA23FE1BB36732D101377C603125125FE62 +Test: Encrypt +Comment: Set 2, vector 187 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000100000000000000000 +Ciphertext: F03E1B911C1EDD769CAD59A744FAD47CB5E19502C1E7F4F0B3197101F3B673C1 +Test: Encrypt +Comment: Set 2, vector 188 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000080000000000000000 +Ciphertext: A9128F8B0C1809095597110471DD7F10040AE71626E8C694BA529B4C9E1353A2 +Test: Encrypt +Comment: Set 2, vector 189 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000040000000000000000 +Ciphertext: B9EDCD81B2CFB461C1FC554ED71CCC958AF4B2B726C011173F4058C40211C496 +Test: Encrypt +Comment: Set 2, vector 190 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000020000000000000000 +Ciphertext: 400F0635E34B796116E3752A0EDA47C3ABC19641DDD60427B4CE3AA8700CEA8E +Test: Encrypt +Comment: Set 2, vector 191 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000010000000000000000 +Ciphertext: 0E526F1012B80F22F946FD51D776187DEFD554B1F5806102E7DD9277FE06B826 +Test: Encrypt +Comment: Set 2, vector 192 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000008000000000000000 +Ciphertext: 1FC0DA71F72D08CDD0F59120C4A88E793869A2C598BAB97C92D6C63C0FAEADA9 +Test: Encrypt +Comment: Set 2, vector 193 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000004000000000000000 +Ciphertext: C493FDECD4D49D5FC6D8590C70BEAAD97EB7694244201CA4CF1732E03D7A4251 +Test: Encrypt +Comment: Set 2, vector 194 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000002000000000000000 +Ciphertext: C532BFE04C6CA7E8B4ABFF9E8BD9C676CBC9AA78FEF4A2DC5CC907742B3ED64F +Test: Encrypt +Comment: Set 2, vector 195 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000001000000000000000 +Ciphertext: 5C8F3ECB07F0264162A9C01A6BB2BC5CF3C7B9ED315803BF86A72406C2655242 +Test: Encrypt +Comment: Set 2, vector 196 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000800000000000000 +Ciphertext: 8C13C039C13DF9C8D821D33E85AFE93EEAFCFC2A2F06D85B3BDE2743FC37AD3F +Test: Encrypt +Comment: Set 2, vector 197 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000400000000000000 +Ciphertext: 3D990835001730714D0880420F57041E37A7FAF1FCA991AA38C409C80F2DC61F +Test: Encrypt +Comment: Set 2, vector 198 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000200000000000000 +Ciphertext: EC44357D4F18EBE148B47AB546D6A5F3E08F8F6C9E2B8B6B99FF303814BF43BA +Test: Encrypt +Comment: Set 2, vector 199 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000100000000000000 +Ciphertext: 00C3B30C81FBC65B9E12C8D6429104FDF40D322D47A59E637FC8CE749725BDCC +Test: Encrypt +Comment: Set 2, vector 200 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000080000000000000 +Ciphertext: 6136C065D96E7F18AB296F86AF04BB264A6DA61DEA7C5413C9131B7EBE551B88 +Test: Encrypt +Comment: Set 2, vector 201 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000040000000000000 +Ciphertext: 2A363A08CAD79DF6A3F2DF5D842B14935C5D09C9D6C78C4989ADCB018A735A5D +Test: Encrypt +Comment: Set 2, vector 202 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000020000000000000 +Ciphertext: B25955B31CC449A42502D1AB61D699DE558BA2C7825BA06B17B239851E575880 +Test: Encrypt +Comment: Set 2, vector 203 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000010000000000000 +Ciphertext: CBE2FD81D74436E167D6A5CF8F7DC07338885146351483E4474CD213D853A6FE +Test: Encrypt +Comment: Set 2, vector 204 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000008000000000000 +Ciphertext: 66DE9DCBF2B85FF944EDD40B3D81F5F8699DB1982C045667FDE9A499A7777DD6 +Test: Encrypt +Comment: Set 2, vector 205 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000004000000000000 +Ciphertext: D940E3F69C42E847312E473E362FD609BE7780D99DAC30F8F095D58EFDC58D59 +Test: Encrypt +Comment: Set 2, vector 206 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000002000000000000 +Ciphertext: 60FBA04239A8C312E10C7773673E94678CB1E13B069759AF304C56CCA6F490DD +Test: Encrypt +Comment: Set 2, vector 207 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000001000000000000 +Ciphertext: D67E081F763F322BA82FA01E184C355A65DE8028E47BF0DB5FCAEDA8C2593F02 +Test: Encrypt +Comment: Set 2, vector 208 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000800000000000 +Ciphertext: 434868F9A6086D0F9218E02CB9534E9EEE88B90C6174A4306B0D0843A35CFDFD +Test: Encrypt +Comment: Set 2, vector 209 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000400000000000 +Ciphertext: B6CCB5899745E29FEE7870B22C2F989D84C98C4510DEA892666E187CDEF77E1A +Test: Encrypt +Comment: Set 2, vector 210 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000200000000000 +Ciphertext: E798F9255A21E0ECDC4BA638F0BF03BAA0AD7810844837582193D7FB3E11B5DF +Test: Encrypt +Comment: Set 2, vector 211 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000100000000000 +Ciphertext: 9BAE51C5C4DF9E55570EF0FE5F2C6AC0CF9FD953E65CD07ED12378BD5A0F2911 +Test: Encrypt +Comment: Set 2, vector 212 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000080000000000 +Ciphertext: 95ECC45EEDD4537D6A7D54D60A64CBFB6728982441C7EE10B7A84A80B51EE171 +Test: Encrypt +Comment: Set 2, vector 213 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000040000000000 +Ciphertext: D8D77750B38E522216DA0A1A9DB7C56788E504708A2048B66946FB83C1981FCB +Test: Encrypt +Comment: Set 2, vector 214 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000020000000000 +Ciphertext: 0CAA8435D051798DB289708EC6CC4C98F0018AB7F068FA0E40443A1F227002CD +Test: Encrypt +Comment: Set 2, vector 215 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000010000000000 +Ciphertext: 5410408C0306460E6033543669A26A63F7C7BBDFEF4273C9BAD8AC472EDAFB67 +Test: Encrypt +Comment: Set 2, vector 216 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000008000000000 +Ciphertext: DD3A0F7B61D056015B54A329882E942ECA3C5C3F64ACFE71E3255A8F53E1AD73 +Test: Encrypt +Comment: Set 2, vector 217 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000004000000000 +Ciphertext: 80A70BE4CC4C61C0F7F501E8068C75CEA78DC11A224D0C47C09D20361C99CF00 +Test: Encrypt +Comment: Set 2, vector 218 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000002000000000 +Ciphertext: BEF3417464A46BBD2B7E9FB967F4FBF406C2B5B9C8B076B770C199C003786A40 +Test: Encrypt +Comment: Set 2, vector 219 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000001000000000 +Ciphertext: C1756ADF6EEF9837B43C4B032B17A79C3A583EE37981CC495CA95893F34218A6 +Test: Encrypt +Comment: Set 2, vector 220 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000800000000 +Ciphertext: 90273FCA31968871BE3D5C76AFCB47D9ECC31A48B87988FD359E93AFF6815F4D +Test: Encrypt +Comment: Set 2, vector 221 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000400000000 +Ciphertext: D0A5F666F7A819EF8BA114C1872158179731F6989997E13AFD73DB252E5CD2A2 +Test: Encrypt +Comment: Set 2, vector 222 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000200000000 +Ciphertext: D4E3DA34C47E5A86A723ED5B9F615B283E4CD54E9F2ED9EAA98A7AB8DE41B14C +Test: Encrypt +Comment: Set 2, vector 223 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000100000000 +Ciphertext: 547227D086EBB538F5836B8E1E65601209AEB6DFD1C450C014C559D879D71862 +Test: Encrypt +Comment: Set 2, vector 224 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000080000000 +Ciphertext: 9E52F033EFE0762ED108095BDF6CD8A89F8E1028F0D3D9B39B601C1084F95F74 +Test: Encrypt +Comment: Set 2, vector 225 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000040000000 +Ciphertext: A049C5B9BD63EBEB23B34EA2F27813D29EDC044E2486D709AC7D2C731557066B +Test: Encrypt +Comment: Set 2, vector 226 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000020000000 +Ciphertext: 1A9CDD2A99C5ED7FB2A6A1870230B0BD6890567E0E4439E248548DF25CB6126E +Test: Encrypt +Comment: Set 2, vector 227 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000010000000 +Ciphertext: 41F2CDA0EFE97BCE8689CF33201B4E57E0600BBB1F274DF3D589915F8EA5C372 +Test: Encrypt +Comment: Set 2, vector 228 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000008000000 +Ciphertext: 1F4712D7AB6D127ABDA90DA977CFC60B44F84859AE4B705851CF687E01E1E250 +Test: Encrypt +Comment: Set 2, vector 229 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000004000000 +Ciphertext: DC93D915CBBC140EDB08B34406F71B4CD38274E92DE8FAF355D274AE7929BC28 +Test: Encrypt +Comment: Set 2, vector 230 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000002000000 +Ciphertext: D2D9A648EDAF9339D7EE52419CC33C42E4CA91AA670D14B78952F41F889122E5 +Test: Encrypt +Comment: Set 2, vector 231 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000001000000 +Ciphertext: F34BA77405D00CAFC3E6786CDB26263C10CDC4D6AFAEDF4C26566A51DB82F5F9 +Test: Encrypt +Comment: Set 2, vector 232 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000800000 +Ciphertext: 21A7EAD6D95FC7AB788206CEA15A25CC4AEB69BAA96C78D5E2851DDBA25523F0 +Test: Encrypt +Comment: Set 2, vector 233 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000400000 +Ciphertext: 822BC3900195E6F224805E77B2460A65FA1A11CFD473F1DFA65351CBB4EFDFEB +Test: Encrypt +Comment: Set 2, vector 234 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000200000 +Ciphertext: 648A71BE1E77866181F980B37690D5C8A37DF29BB2EBC3A41665CD0CCC2E8EF8 +Test: Encrypt +Comment: Set 2, vector 235 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000100000 +Ciphertext: 808E32C933955FF7C8D6F1A4C6754CB3B7311612CFF846D02C81B712C78EB63E +Test: Encrypt +Comment: Set 2, vector 236 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000080000 +Ciphertext: E074251CC7C5BFFCE2CA45933206B2EE8864156A4626C03EA030B71F8BD454BE +Test: Encrypt +Comment: Set 2, vector 237 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000040000 +Ciphertext: 72EBE213A06F63603B49A750808F348FF7C9E4EC72884FDA7C58968EC5A25EED +Test: Encrypt +Comment: Set 2, vector 238 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000020000 +Ciphertext: 20618612C2AF418DE3E185AF7973D508DC31DE1E9D9FB4FDF9E95FD592F567EF +Test: Encrypt +Comment: Set 2, vector 239 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000010000 +Ciphertext: F94C66D4884A657BF0A6A6EA31A90A07F193F55465575FF1BF8DE68F3441BF4E +Test: Encrypt +Comment: Set 2, vector 240 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000008000 +Ciphertext: 9636DCAB40FB991FC330D8EFD671FF83BAA0C9E33D7A146D5E7ADC53592B605F +Test: Encrypt +Comment: Set 2, vector 241 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000004000 +Ciphertext: FC21689B5F46A011ECFE1E314E03ED7105BAC620193714B2290087C17FB763B6 +Test: Encrypt +Comment: Set 2, vector 242 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000002000 +Ciphertext: ABD2583E0FCC95122FDC700AF9B1FDA50D91E752E19BE9D2EE4F5E22033D53C6 +Test: Encrypt +Comment: Set 2, vector 243 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000001000 +Ciphertext: 3501CD56EE5EA39AB32F38371E5C2CF6EEEB9DA82D210A8D88AE8F29917AE9F4 +Test: Encrypt +Comment: Set 2, vector 244 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000800 +Ciphertext: 7559A2AA6CBFA8A181565EDDDE323DB80CE740545FFEE13B4851980AD2451E24 +Test: Encrypt +Comment: Set 2, vector 245 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000400 +Ciphertext: CEF6DBFD1FBCCBB587BD748D6CC992F8EF671A829E2D6AD73D1DC1C1B2A9E8DD +Test: Encrypt +Comment: Set 2, vector 246 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000200 +Ciphertext: 46FBBCD26A1F879746BDF4FF7804A5C105F621837ABCF94F17123B700A58A08A +Test: Encrypt +Comment: Set 2, vector 247 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000100 +Ciphertext: 0B10D2DA0E0FB6F067D641FF7F8C9C8FF4E2D689450787B7136ADF38DC1F2948 +Test: Encrypt +Comment: Set 2, vector 248 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000080 +Ciphertext: 4492E09E73459BF74417FC0D7190DA719A891C9CAE14801944FFB24912E377A8 +Test: Encrypt +Comment: Set 2, vector 249 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000040 +Ciphertext: 76D72C3D3AF6F2FF6AFBC0C1A553E6F8171D81D6BB1CB3C3A6C43ED826A88FAA +Test: Encrypt +Comment: Set 2, vector 250 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000020 +Ciphertext: D912041134584B69AC01938EC88913DBCFF7CDBE93CDF7443BD465F1B2E3F7F5 +Test: Encrypt +Comment: Set 2, vector 251 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000010 +Ciphertext: F0883EB64A5345CC9A0055D4E882D199EFFC334C05B53BC4132AC1A51BA39A9F +Test: Encrypt +Comment: Set 2, vector 252 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000008 +Ciphertext: 276246B0D93A4E6FF05832F51D2BF60641B63594EB90A1E08A7D98C6DDAE1461 +Test: Encrypt +Comment: Set 2, vector 253 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000004 +Ciphertext: 6AA2B04BF65F4213583CED5347537123DC3BE0703209170D1D34B0B8A66C1C58 +Test: Encrypt +Comment: Set 2, vector 254 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000002 +Ciphertext: DC438414927E453DBFD91DC60C635EE4273A9921A134DB513AB2BBDBAE64A9AD +Test: Encrypt +Comment: Set 2, vector 255 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000001 +Ciphertext: 45D43E9288738C5AD1A683D8DE59CEDD22D666A2B7078EB1301B532A272D570B +Test: Encrypt +Comment: Set 3, vector 0 +Key: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 7CA51614425C3BA8CE54DD2FC2020AE7B6E574D198136D0FAE7E26CCBF0BE7A6 +Test: Encrypt +Comment: Set 3, vector 1 +Key: 01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 +Plaintext: 0101010101010101010101010101010101010101010101010101010101010101 +Ciphertext: C4B7C6A9738C77EE28F7E685C8358E0AF88FB6D23955EE6DF49FE3F5DA16F826 +Test: Encrypt +Comment: Set 3, vector 2 +Key: 02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 +Plaintext: 0202020202020202020202020202020202020202020202020202020202020202 +Ciphertext: CD108DD9EC1000B79C75AA3DCC88F913E6F52773853035A5C44F3245B134CBFF +Test: Encrypt +Comment: Set 3, vector 3 +Key: 03030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303 +Plaintext: 0303030303030303030303030303030303030303030303030303030303030303 +Ciphertext: E8F9DE8F066B675AE90C919FC4981603485BBB92382D8C844CAF707973D5276D +Test: Encrypt +Comment: Set 3, vector 4 +Key: 04040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404 +Plaintext: 0404040404040404040404040404040404040404040404040404040404040404 +Ciphertext: 6AA777340200C1B65AB25193A8BB267C233DAC7E1B3C523D406FC5B567B7B586 +Test: Encrypt +Comment: Set 3, vector 5 +Key: 05050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505 +Plaintext: 0505050505050505050505050505050505050505050505050505050505050505 +Ciphertext: 6B14A9C454143376DBDC3C93FB8096B09C01456B0B55412FD9692CD7CB587069 +Test: Encrypt +Comment: Set 3, vector 6 +Key: 06060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606 +Plaintext: 0606060606060606060606060606060606060606060606060606060606060606 +Ciphertext: 3FED53DEF4FBC1D012B36562132AB40049818DA4E62E86716DE5EF70790B0D6A +Test: Encrypt +Comment: Set 3, vector 7 +Key: 07070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707 +Plaintext: 0707070707070707070707070707070707070707070707070707070707070707 +Ciphertext: 7A428F7A6841BC8F0E99335C5021C413D2639321DC8D9F280A2F0EF4B420A212 +Test: Encrypt +Comment: Set 3, vector 8 +Key: 08080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808 +Plaintext: 0808080808080808080808080808080808080808080808080808080808080808 +Ciphertext: A23BE32D37FA4054EC45D6A9CC643AF9124EDAA4AD9ABC7FAAB449D39D11B128 +Test: Encrypt +Comment: Set 3, vector 9 +Key: 09090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909 +Plaintext: 0909090909090909090909090909090909090909090909090909090909090909 +Ciphertext: 972195D6756F7D3A4D13BF49BFBCE7D164460355150C297A41CCC6AA9F31C5D6 +Test: Encrypt +Comment: Set 3, vector 10 +Key: 0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A +Plaintext: 0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A +Ciphertext: 2AA722C58EBDB7701225BA9C3B1F7C946D57DEDC74FEDDB637EB14E27A0F0CC9 +Test: Encrypt +Comment: Set 3, vector 11 +Key: 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B +Plaintext: 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B +Ciphertext: 1C9A0420B9F6EF013FB3ADB4F20C862B61702BA479276E3187322B33D4B128C2 +Test: Encrypt +Comment: Set 3, vector 12 +Key: 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C +Plaintext: 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C +Ciphertext: 666CC3862BAACADA4D35A9079D52438FB3B4416C9938397E61D48066B6476068 +Test: Encrypt +Comment: Set 3, vector 13 +Key: 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D +Plaintext: 0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D +Ciphertext: DB94504EF884901FAA5778199329A2DCC9AA50A4453172CE8ADE11BFE54234E9 +Test: Encrypt +Comment: Set 3, vector 14 +Key: 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E +Plaintext: 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E +Ciphertext: DF0B4204DB7E0924BD2931C131E6DFEB013A5844F717DF7A2DEF86FBC2125DA6 +Test: Encrypt +Comment: Set 3, vector 15 +Key: 0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F +Plaintext: 0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F +Ciphertext: D7C2D4257254E7A05657047B43B65AB778C9E6ACDE53F14000FDFC346CEE4BA6 +Test: Encrypt +Comment: Set 3, vector 16 +Key: 10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010 +Plaintext: 1010101010101010101010101010101010101010101010101010101010101010 +Ciphertext: F64819DFBEBE0A6DB650E7072CE28EA606586418B317785FF0AD44212A84C82C +Test: Encrypt +Comment: Set 3, vector 17 +Key: 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +Plaintext: 1111111111111111111111111111111111111111111111111111111111111111 +Ciphertext: 155B7E6FFCC0AA874E22494545374E97C08A3D1B1045A0F35FFC54B2842D02A4 +Test: Encrypt +Comment: Set 3, vector 18 +Key: 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212 +Plaintext: 1212121212121212121212121212121212121212121212121212121212121212 +Ciphertext: FEE12FD9E87DCB4FE5C5249E3EAEDA0514F6A4826C1A5ABC87E22B95D4A84851 +Test: Encrypt +Comment: Set 3, vector 19 +Key: 13131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313 +Plaintext: 1313131313131313131313131313131313131313131313131313131313131313 +Ciphertext: 1DA785C2A2CEFED459474EE5401F5B795F6ED468DBB924CFFCF65EF465DE9534 +Test: Encrypt +Comment: Set 3, vector 20 +Key: 14141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414 +Plaintext: 1414141414141414141414141414141414141414141414141414141414141414 +Ciphertext: 4434A4D83273B06B64AF4ED1D70EEAD50DBFC44C5931A7B7B98FF9F514B229E9 +Test: Encrypt +Comment: Set 3, vector 21 +Key: 15151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515 +Plaintext: 1515151515151515151515151515151515151515151515151515151515151515 +Ciphertext: 1AB982A6C64C2C42D05F9FB8ED9BE0EEB5B48CEE8EAB0250D98D43157E999EDC +Test: Encrypt +Comment: Set 3, vector 22 +Key: 16161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616 +Plaintext: 1616161616161616161616161616161616161616161616161616161616161616 +Ciphertext: 83291A3265ACAB71E5CCCF0281A433579F39AE6C2FB7CB7528D7F820158177FF +Test: Encrypt +Comment: Set 3, vector 23 +Key: 17171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717 +Plaintext: 1717171717171717171717171717171717171717171717171717171717171717 +Ciphertext: 90F1FF9F69854321CFC6D0A4541CCDF73C1A1DC737D96FB76F0DDD0BB0097BBA +Test: Encrypt +Comment: Set 3, vector 24 +Key: 18181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818 +Plaintext: 1818181818181818181818181818181818181818181818181818181818181818 +Ciphertext: ABF9813765AFBEA9BF26026716294D5C5B309243339ECC9F21CEADE6E7083266 +Test: Encrypt +Comment: Set 3, vector 25 +Key: 19191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919 +Plaintext: 1919191919191919191919191919191919191919191919191919191919191919 +Ciphertext: 7B5C8222D85392E82E703ADFB0FF02DBD2297791B84E26A3A1ED12309247D064 +Test: Encrypt +Comment: Set 3, vector 26 +Key: 1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A +Plaintext: 1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A +Ciphertext: 227355246FCC9106FA5572475E8C466F1140CD75A8A84DFCD2B0908392914FD7 +Test: Encrypt +Comment: Set 3, vector 27 +Key: 1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B +Plaintext: 1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B +Ciphertext: E5E5A887FA888691FF93014C2E368DC10775A447A5EF4B632A089DA82D245BE3 +Test: Encrypt +Comment: Set 3, vector 28 +Key: 1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C +Plaintext: 1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C +Ciphertext: BA417FC94107761C0969EF6EA7DDC74E5F85CAB61E2271CEB6D9C98B139F4576 +Test: Encrypt +Comment: Set 3, vector 29 +Key: 1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D +Plaintext: 1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D +Ciphertext: F3B85912DF6950B9AE28CE08E456D494E0C949A36FA102540C51827AEC9168AB +Test: Encrypt +Comment: Set 3, vector 30 +Key: 1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E +Plaintext: 1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E +Ciphertext: 1AC0ED993D24366380522B05F97B6FC64B199241A1D556B992632AEE400F0494 +Test: Encrypt +Comment: Set 3, vector 31 +Key: 1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F +Plaintext: 1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F +Ciphertext: 3550CD591130231B0F01F6860B699715B98B9497B4035C7323000D67C5F0B1B7 +Test: Encrypt +Comment: Set 3, vector 32 +Key: 20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020 +Plaintext: 2020202020202020202020202020202020202020202020202020202020202020 +Ciphertext: E267D6113C27170A3EE6DF496E801A6131BBD3444365D7C03791E25610F1A0E4 +Test: Encrypt +Comment: Set 3, vector 33 +Key: 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121 +Plaintext: 2121212121212121212121212121212121212121212121212121212121212121 +Ciphertext: 3D71B778381E70BCC1A7B8411208225FC922857E862FC17312E3782CEA289B15 +Test: Encrypt +Comment: Set 3, vector 34 +Key: 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 +Plaintext: 2222222222222222222222222222222222222222222222222222222222222222 +Ciphertext: 16B41DE00DBF29B96CC59E246DE3188B786E097394E9EEE2250169AE00306FD8 +Test: Encrypt +Comment: Set 3, vector 35 +Key: 23232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323 +Plaintext: 2323232323232323232323232323232323232323232323232323232323232323 +Ciphertext: 99DDE88C9F26D270B3C507A25FE49955A0FEA6C8FEBAD133842DA1CE730EEB7F +Test: Encrypt +Comment: Set 3, vector 36 +Key: 24242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424 +Plaintext: 2424242424242424242424242424242424242424242424242424242424242424 +Ciphertext: 9766D3F9E73987EE10A20605C8338C0759A7024CF2DF549DE5084EC4902C550A +Test: Encrypt +Comment: Set 3, vector 37 +Key: 25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525 +Plaintext: 2525252525252525252525252525252525252525252525252525252525252525 +Ciphertext: 0FFD89849C8EC5A46B8F43C799ED305AF602C73E810FC729A8C9BB0F5C55CD54 +Test: Encrypt +Comment: Set 3, vector 38 +Key: 26262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626 +Plaintext: 2626262626262626262626262626262626262626262626262626262626262626 +Ciphertext: 91956E101CE4546623A5BE49811F167476CB568972CEBF7A59EB27DA524A0C6B +Test: Encrypt +Comment: Set 3, vector 39 +Key: 27272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727 +Plaintext: 2727272727272727272727272727272727272727272727272727272727272727 +Ciphertext: 7DEC5ECE0D590EE3E099C07F2DD6A6A9C71632D277803FD007275B93369ABED0 +Test: Encrypt +Comment: Set 3, vector 40 +Key: 28282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828 +Plaintext: 2828282828282828282828282828282828282828282828282828282828282828 +Ciphertext: 039C192AFC54EFDE1ED3610B0E9F95AA08D7CDC6AE71A66B5C508E4D14C038CF +Test: Encrypt +Comment: Set 3, vector 41 +Key: 29292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929 +Plaintext: 2929292929292929292929292929292929292929292929292929292929292929 +Ciphertext: D558F8F4562BD8FE816FABF621556C8416C6FD00209028DF978F8915CC093E16 +Test: Encrypt +Comment: Set 3, vector 42 +Key: 2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A +Plaintext: 2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A +Ciphertext: 1AE21791ED4B610DD693012518759D6E9C1BBF206482EEA43470F02B493CFFB8 +Test: Encrypt +Comment: Set 3, vector 43 +Key: 2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B +Plaintext: 2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B +Ciphertext: 34F2112E8FBD1B373BA8400B05321F658FDFE0DC87C1304C36766DE71840A4DF +Test: Encrypt +Comment: Set 3, vector 44 +Key: 2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C +Plaintext: 2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C +Ciphertext: DBF9B56BBF2E50DF321CA687F8BE0E6222E7DF52B4A142174058CC119D9EC0DA +Test: Encrypt +Comment: Set 3, vector 45 +Key: 2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D +Plaintext: 2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D +Ciphertext: 8B2757374F778FE0B30D11AD7116CE37E2AB858A4E1C50D1115B6E328F3635F5 +Test: Encrypt +Comment: Set 3, vector 46 +Key: 2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E +Plaintext: 2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E +Ciphertext: 06588A873366FAA47323C9A098A759718DFB0E310C91A4E38B42CC56A0757811 +Test: Encrypt +Comment: Set 3, vector 47 +Key: 2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F +Plaintext: 2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F +Ciphertext: 7B861B18E3F322D8000BDDCBCE3B50405AA923375568F16AE84411E91DB879C3 +Test: Encrypt +Comment: Set 3, vector 48 +Key: 30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030 +Plaintext: 3030303030303030303030303030303030303030303030303030303030303030 +Ciphertext: 170F74A4D692C302551EE17CD544D65185112D2A5E812D203B36FC39BF1DA9C7 +Test: Encrypt +Comment: Set 3, vector 49 +Key: 31313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131 +Plaintext: 3131313131313131313131313131313131313131313131313131313131313131 +Ciphertext: 0178F59DDAB05A4DFAF66FD406170E08227096EF9712CB481A26EBD82F470D7A +Test: Encrypt +Comment: Set 3, vector 50 +Key: 32323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232 +Plaintext: 3232323232323232323232323232323232323232323232323232323232323232 +Ciphertext: 8BAC479F3A92DF71F973AA457E19D75FB0F1A0FE68FF440A86154721BCC345D4 +Test: Encrypt +Comment: Set 3, vector 51 +Key: 33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +Plaintext: 3333333333333333333333333333333333333333333333333333333333333333 +Ciphertext: EB50A10C7A0ED9960CDE0C3EDB899A6B67324B1EE23DE4BB13F60D187C3CBA35 +Test: Encrypt +Comment: Set 3, vector 52 +Key: 34343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434 +Plaintext: 3434343434343434343434343434343434343434343434343434343434343434 +Ciphertext: 00AA782AC61FD06DC781E3C5662C65BD1043EC28D056C98F07074DA7C11C1E1F +Test: Encrypt +Comment: Set 3, vector 53 +Key: 35353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535 +Plaintext: 3535353535353535353535353535353535353535353535353535353535353535 +Ciphertext: 23B9F2F26CFC51ECC6DD1AFE614C2DAE8348DA033F9B67AEAA87B71F5377D95D +Test: Encrypt +Comment: Set 3, vector 54 +Key: 36363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636 +Plaintext: 3636363636363636363636363636363636363636363636363636363636363636 +Ciphertext: 9655D4B1CBEF855401274C3339C16DB9B5A9651F60579CFE8554B6EE25DCCA0E +Test: Encrypt +Comment: Set 3, vector 55 +Key: 37373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737 +Plaintext: 3737373737373737373737373737373737373737373737373737373737373737 +Ciphertext: E072ED2DAD79B07C48B50ED31E02FD9705562525D49DBF45DACCFDF35D5A6965 +Test: Encrypt +Comment: Set 3, vector 56 +Key: 38383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838 +Plaintext: 3838383838383838383838383838383838383838383838383838383838383838 +Ciphertext: 287638BAE945B88A95029155BC47D033B5C5C4C191F079C234C6E97683FFABA0 +Test: Encrypt +Comment: Set 3, vector 57 +Key: 39393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939 +Plaintext: 3939393939393939393939393939393939393939393939393939393939393939 +Ciphertext: 500CD3B02BF6FA8C66D1ADE0CE43B325A759CD3426096084A261F054D798F885 +Test: Encrypt +Comment: Set 3, vector 58 +Key: 3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A +Plaintext: 3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A +Ciphertext: 17614BAB583F2DCF809A2AEE973A4875251B571525521B3A8C47303450B6301F +Test: Encrypt +Comment: Set 3, vector 59 +Key: 3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B +Plaintext: 3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B +Ciphertext: 978C8DFD9AC74FF670CC8B31EDC8EC15DDBC2854375ED9BA07BB0F7B96C70BB3 +Test: Encrypt +Comment: Set 3, vector 60 +Key: 3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C +Plaintext: 3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C +Ciphertext: 994CA36F6230C7DB63CAD61342FAB3F155C361DAD458FC457AD09ACCAB2EB43F +Test: Encrypt +Comment: Set 3, vector 61 +Key: 3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D +Plaintext: 3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D +Ciphertext: AC06659932208AC1DD5F07448A7407232F1410CDAC92F7C5305C4043C559345F +Test: Encrypt +Comment: Set 3, vector 62 +Key: 3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E +Plaintext: 3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E +Ciphertext: B55616F0743A29655FEC468CD30C8C65F7925327665670BA9E41A2E09C05C63B +Test: Encrypt +Comment: Set 3, vector 63 +Key: 3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F +Plaintext: 3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F +Ciphertext: 78F4852712C3547547A114E73F52C6128EDD3F29E0B2C938D6F9F69AF2303FD2 +Test: Encrypt +Comment: Set 3, vector 64 +Key: 40404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040 +Plaintext: 4040404040404040404040404040404040404040404040404040404040404040 +Ciphertext: C97909916EE86FFDCE8A92903046109B53F788A53039434DF1A394DAD6F697A2 +Test: Encrypt +Comment: Set 3, vector 65 +Key: 41414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141 +Plaintext: 4141414141414141414141414141414141414141414141414141414141414141 +Ciphertext: C3FD3C59D37D44AF9EE6B87AC0939A4A4B2FBAAC23E80E72B1CAC352FE30A8E2 +Test: Encrypt +Comment: Set 3, vector 66 +Key: 42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242 +Plaintext: 4242424242424242424242424242424242424242424242424242424242424242 +Ciphertext: 94C70F7654479BC9DA9854129F57F3E69C31B63900A404F577AF1C83CD96E5D6 +Test: Encrypt +Comment: Set 3, vector 67 +Key: 43434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343 +Plaintext: 4343434343434343434343434343434343434343434343434343434343434343 +Ciphertext: 71DD024E9CE700B373A275AA870A68B5DAD9E47D38BC18F34073319041A1CADF +Test: Encrypt +Comment: Set 3, vector 68 +Key: 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 +Plaintext: 4444444444444444444444444444444444444444444444444444444444444444 +Ciphertext: 274D101B2BD0E7CAFC9E5559DC68567DC8975056B84573C4294D78513B7406D8 +Test: Encrypt +Comment: Set 3, vector 69 +Key: 45454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545 +Plaintext: 4545454545454545454545454545454545454545454545454545454545454545 +Ciphertext: 8DCE5B5C376E42F11A322D8CBCEB8C0AE1EC24F3C65D72B326708FEAF13E3B51 +Test: Encrypt +Comment: Set 3, vector 70 +Key: 46464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646 +Plaintext: 4646464646464646464646464646464646464646464646464646464646464646 +Ciphertext: D62D3BA9BBD23F4424EB929AE7A4CD83A70FA7EFD2E6CCFED23E1176AFDB69CD +Test: Encrypt +Comment: Set 3, vector 71 +Key: 47474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747 +Plaintext: 4747474747474747474747474747474747474747474747474747474747474747 +Ciphertext: FE7670925FEA3AAE1F039590EA230C094C3E434BF1350B12D4EA26E48A6EF7F0 +Test: Encrypt +Comment: Set 3, vector 72 +Key: 48484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848 +Plaintext: 4848484848484848484848484848484848484848484848484848484848484848 +Ciphertext: 3A57E728BFA31AA36C8E4ED38A34B465BA233AD066225F31651C93B870AAFE6D +Test: Encrypt +Comment: Set 3, vector 73 +Key: 49494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949 +Plaintext: 4949494949494949494949494949494949494949494949494949494949494949 +Ciphertext: 3B56014035A28EA6F2F2B09429FED7FC0F5B76D5458F1EB4F3AAA7E7F6610C65 +Test: Encrypt +Comment: Set 3, vector 74 +Key: 4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A +Plaintext: 4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A +Ciphertext: 2D28A28ECABAC61B540CD933BE43AF16F11429EDE8E7B62121CD853054363730 +Test: Encrypt +Comment: Set 3, vector 75 +Key: 4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B +Plaintext: 4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B +Ciphertext: D8A892E3C24C6A2EB8446B3737A0E3AA1478811B819FFD3440B5307185906518 +Test: Encrypt +Comment: Set 3, vector 76 +Key: 4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C +Plaintext: 4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C +Ciphertext: 798AD5E43127299B61247059F508268CDBA78B46D4FD28C200AE1052C52294E7 +Test: Encrypt +Comment: Set 3, vector 77 +Key: 4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D +Plaintext: 4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D +Ciphertext: 63F43065BA1F262D950219D71B9CD5FA78D6798BCAA981FE3391FF8EA735E4C7 +Test: Encrypt +Comment: Set 3, vector 78 +Key: 4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E +Plaintext: 4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E +Ciphertext: E8E461EB5FD98011A37765ECA336B080D58B35C636AD6F423893EE768913255C +Test: Encrypt +Comment: Set 3, vector 79 +Key: 4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F +Plaintext: 4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F +Ciphertext: 7348E30FFC0C4F5569B6490622A34FB015C364944553582355887BC472279E8D +Test: Encrypt +Comment: Set 3, vector 80 +Key: 50505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050 +Plaintext: 5050505050505050505050505050505050505050505050505050505050505050 +Ciphertext: BE28CB05EEEEDA8FD8971E9970ECBCA25856F66E95AC8B987C69F04BE3276CD7 +Test: Encrypt +Comment: Set 3, vector 81 +Key: 51515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151 +Plaintext: 5151515151515151515151515151515151515151515151515151515151515151 +Ciphertext: 5D336C5E34D4EB95CFAB87C542C72A748AA45E7F77D841A738017927C7908804 +Test: Encrypt +Comment: Set 3, vector 82 +Key: 52525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252 +Plaintext: 5252525252525252525252525252525252525252525252525252525252525252 +Ciphertext: 2942A594A7964F41460EB6037DDE2C28FFBFFB3C21F7EFF43F06632DA980ED8B +Test: Encrypt +Comment: Set 3, vector 83 +Key: 53535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353 +Plaintext: 5353535353535353535353535353535353535353535353535353535353535353 +Ciphertext: 1C0F7A4E3147BC7F8150D8144ED31D0054FF15414E5DBF289BFEC160D22684AC +Test: Encrypt +Comment: Set 3, vector 84 +Key: 54545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454 +Plaintext: 5454545454545454545454545454545454545454545454545454545454545454 +Ciphertext: 7931C7B9D78CB50610B1BEF596268B94446FCDA44C3EE7CEE53121AC519C4001 +Test: Encrypt +Comment: Set 3, vector 85 +Key: 55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 +Plaintext: 5555555555555555555555555555555555555555555555555555555555555555 +Ciphertext: F4E331C357C603EE5ED5547D75B54631A68D7CD74C5075198D0FC38E5661F556 +Test: Encrypt +Comment: Set 3, vector 86 +Key: 56565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656 +Plaintext: 5656565656565656565656565656565656565656565656565656565656565656 +Ciphertext: 378C2887958E31971E8F59C882730E48407E4DA9C26D4C76B672CD53202AB1B8 +Test: Encrypt +Comment: Set 3, vector 87 +Key: 57575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757 +Plaintext: 5757575757575757575757575757575757575757575757575757575757575757 +Ciphertext: DBE68FE249F4A8D36E1CB49DBE20ED58649CCC502F85895875C1FE82269219DA +Test: Encrypt +Comment: Set 3, vector 88 +Key: 58585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858 +Plaintext: 5858585858585858585858585858585858585858585858585858585858585858 +Ciphertext: 103BD780F3B382C4B28E6E1CB41CBEE22CC1BB64E4A0147D658EDA96A6E7FEAB +Test: Encrypt +Comment: Set 3, vector 89 +Key: 59595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959 +Plaintext: 5959595959595959595959595959595959595959595959595959595959595959 +Ciphertext: 382EF838282E0F4BA729083542BB8CB48AB874FF568DFDA56AFC4ED266DD3243 +Test: Encrypt +Comment: Set 3, vector 90 +Key: 5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A +Plaintext: 5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A +Ciphertext: 088665DE8F9DC9298DEF4164C12526597F56859AAC2C96A95645A06014BA689A +Test: Encrypt +Comment: Set 3, vector 91 +Key: 5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B +Plaintext: 5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B +Ciphertext: EC988946646A1B2DCC7EDEC4FCAB11BF29055A226F4C75D28F9DFB8D2EB5C9B6 +Test: Encrypt +Comment: Set 3, vector 92 +Key: 5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C +Plaintext: 5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C +Ciphertext: B77221CE7F68292BD4E3A55E8EC7BD1FC68B1B6B02F1008586248833C1089F5C +Test: Encrypt +Comment: Set 3, vector 93 +Key: 5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D +Plaintext: 5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D +Ciphertext: B3E4AA5DE6D25A6237FDD97540191D669C64E54A7D3C544E949489355AFC82B5 +Test: Encrypt +Comment: Set 3, vector 94 +Key: 5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E +Plaintext: 5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E +Ciphertext: AAA6FA046AC4270B22A742C4C29445EB38511E5048414886EBF39523B7EAF76A +Test: Encrypt +Comment: Set 3, vector 95 +Key: 5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F +Plaintext: 5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F +Ciphertext: 4D23440171778573BE7B515C68FA99D0426A32111CA493337E7C55280A90F697 +Test: Encrypt +Comment: Set 3, vector 96 +Key: 60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060 +Plaintext: 6060606060606060606060606060606060606060606060606060606060606060 +Ciphertext: 8EE711FB281CBAA99917C85F0623B68E2EDAFEFCC3B1B841883D71BA6683568A +Test: Encrypt +Comment: Set 3, vector 97 +Key: 61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 +Plaintext: 6161616161616161616161616161616161616161616161616161616161616161 +Ciphertext: EC29DAE53DB4475F8900311F425FE60CB834A82F2A6A2DB4810F95F4D6991B84 +Test: Encrypt +Comment: Set 3, vector 98 +Key: 62626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262 +Plaintext: 6262626262626262626262626262626262626262626262626262626262626262 +Ciphertext: 91E58DDE741553572B5D6F3DAD25953906424FF217497226746A25C0CE1C7D0F +Test: Encrypt +Comment: Set 3, vector 99 +Key: 63636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363 +Plaintext: 6363636363636363636363636363636363636363636363636363636363636363 +Ciphertext: B6EC4D9421AB011D4EEDBC32B289E45AC44CAEB1DC5FAEA752DFFA0137325067 +Test: Encrypt +Comment: Set 3, vector 100 +Key: 64646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464 +Plaintext: 6464646464646464646464646464646464646464646464646464646464646464 +Ciphertext: D9CB13EA06CADF09AC446F9B09553FFE3BF4F1152997B171C03E609D4BD60ADB +Test: Encrypt +Comment: Set 3, vector 101 +Key: 65656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565 +Plaintext: 6565656565656565656565656565656565656565656565656565656565656565 +Ciphertext: 2D07CA161326ED154D9E3FF650963557EC369A91ABB0D49FC1F32AEF39A3B12E +Test: Encrypt +Comment: Set 3, vector 102 +Key: 66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 +Plaintext: 6666666666666666666666666666666666666666666666666666666666666666 +Ciphertext: 28E8B606EE621D2C5B865B8208C7BD40C3596931CE3FF8FA5AD7EB8EE4480E95 +Test: Encrypt +Comment: Set 3, vector 103 +Key: 67676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767 +Plaintext: 6767676767676767676767676767676767676767676767676767676767676767 +Ciphertext: 9B9B3A23DA29539DA1E9BAA20449750EC192CE14A5063E1A2FFAF5039A665754 +Test: Encrypt +Comment: Set 3, vector 104 +Key: 68686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868 +Plaintext: 6868686868686868686868686868686868686868686868686868686868686868 +Ciphertext: D770E305A9C2D257759D8AE9E70C408D1CB090F976BBAFF3A56730A78BA8BF4F +Test: Encrypt +Comment: Set 3, vector 105 +Key: 69696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969 +Plaintext: 6969696969696969696969696969696969696969696969696969696969696969 +Ciphertext: 453988B10DFD852D1AFD11E96C50024571CCB0F19E7C3C4981F8B8BDCD11F720 +Test: Encrypt +Comment: Set 3, vector 106 +Key: 6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A +Plaintext: 6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A +Ciphertext: 17DFD98CB5C24610DD631C4E2749A679D68F854F21AABE8BF67605A256452AD8 +Test: Encrypt +Comment: Set 3, vector 107 +Key: 6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B +Plaintext: 6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B +Ciphertext: DA260145EC80E19C18685540AC71FA460DD4427168E37BC6E0F967D90C306FBB +Test: Encrypt +Comment: Set 3, vector 108 +Key: 6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C +Plaintext: 6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C +Ciphertext: 2AC246E2E384ECCC4BC69CE82EDB51C05DD864642F1E9A572DA6043DD1D56DF0 +Test: Encrypt +Comment: Set 3, vector 109 +Key: 6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D +Plaintext: 6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D +Ciphertext: D1A06B820071CC4122F0B0797A294F31922E26703CDEF15A6D8F511CDBD8BD3F +Test: Encrypt +Comment: Set 3, vector 110 +Key: 6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E +Plaintext: 6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E +Ciphertext: C8D23274A1FF6AEBDF0BA70FBA7A895277B1CC8040F8FB2814195E3A7E85BD01 +Test: Encrypt +Comment: Set 3, vector 111 +Key: 6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F +Plaintext: 6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F +Ciphertext: E0133DC7960953BABC7BFBA52E88DCF86EBD979D6D63EB19466EEADEDEDEEBB3 +Test: Encrypt +Comment: Set 3, vector 112 +Key: 70707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070 +Plaintext: 7070707070707070707070707070707070707070707070707070707070707070 +Ciphertext: A1A9527766EE54D566D97E7A0763A5AECE86F2816411AC2066439D6BDF02FEA7 +Test: Encrypt +Comment: Set 3, vector 113 +Key: 71717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171 +Plaintext: 7171717171717171717171717171717171717171717171717171717171717171 +Ciphertext: E1833EF5C2BA2EF192642164F0F2C02A7334EF5AEA37E9DD56D17AE6CB031004 +Test: Encrypt +Comment: Set 3, vector 114 +Key: 72727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272 +Plaintext: 7272727272727272727272727272727272727272727272727272727272727272 +Ciphertext: DD2CC0EECAA7E5364376FA73E12C64A0C42FB9FC7E94EFF0B22A051D6EDFE905 +Test: Encrypt +Comment: Set 3, vector 115 +Key: 73737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373 +Plaintext: 7373737373737373737373737373737373737373737373737373737373737373 +Ciphertext: 9A72F15B911E6A50A32EEEDF83B62B628E37ED403085180571DEBEA2F37CF49F +Test: Encrypt +Comment: Set 3, vector 116 +Key: 74747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474747474 +Plaintext: 7474747474747474747474747474747474747474747474747474747474747474 +Ciphertext: CD83CE7861EE8259A9C29BC3870EA1BF629ECD31F2E18F0BC12221F239207457 +Test: Encrypt +Comment: Set 3, vector 117 +Key: 75757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575 +Plaintext: 7575757575757575757575757575757575757575757575757575757575757575 +Ciphertext: 7B4218C5AEA4EEFE17E2AB110D8B63A947F21D5210162F6283EDDF00900CEE27 +Test: Encrypt +Comment: Set 3, vector 118 +Key: 76767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676 +Plaintext: 7676767676767676767676767676767676767676767676767676767676767676 +Ciphertext: 935DE2010B112937A233E7CB1023FB9D3C46D7C688A478A94F86AD3919FD2728 +Test: Encrypt +Comment: Set 3, vector 119 +Key: 77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +Plaintext: 7777777777777777777777777777777777777777777777777777777777777777 +Ciphertext: 416A91A68A520732E672ACB5A36599D9A99901F013CC460D9C2FB16AAB45996E +Test: Encrypt +Comment: Set 3, vector 120 +Key: 78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878 +Plaintext: 7878787878787878787878787878787878787878787878787878787878787878 +Ciphertext: FD066F9C65CD3D61B43F5DA44F7B94C85541DC5E09D52B044DA963699C39FDA0 +Test: Encrypt +Comment: Set 3, vector 121 +Key: 79797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979 +Plaintext: 7979797979797979797979797979797979797979797979797979797979797979 +Ciphertext: 63937A7953E453B6E48539FACBD1BC489E03D209DB188837C5A09BA458FFFB92 +Test: Encrypt +Comment: Set 3, vector 122 +Key: 7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A +Plaintext: 7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A +Ciphertext: 68F9EA0F87112633611052A45BBF32B7069079EDB16A928CD2AA16BE464178E3 +Test: Encrypt +Comment: Set 3, vector 123 +Key: 7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B +Plaintext: 7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B +Ciphertext: 874D5ED6C8052C3B4AB830626A195F508DDA15388BA75B3D957B26BC134C9B30 +Test: Encrypt +Comment: Set 3, vector 124 +Key: 7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C +Plaintext: 7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C +Ciphertext: EC3EA8DC433E39B85E4C4D68AC6A854A1B943D99EB2E9A018EA27DC1874CA867 +Test: Encrypt +Comment: Set 3, vector 125 +Key: 7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D +Plaintext: 7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D +Ciphertext: 9CE2298362F1F234A73BECA011EC31B4BC7E143D87B4F118CDADE6AB8D1ED783 +Test: Encrypt +Comment: Set 3, vector 126 +Key: 7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E +Plaintext: 7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E +Ciphertext: 27973D9B510ED9C612CC770FC1AE25EE21B1A9616CB64617EDA477939BE98D04 +Test: Encrypt +Comment: Set 3, vector 127 +Key: 7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F +Plaintext: 7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F +Ciphertext: 82A0EB8C058E727EBD6032F0F77EE693342C97BD44E9538032652B1CA10403DE +Test: Encrypt +Comment: Set 3, vector 128 +Key: 80808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080 +Plaintext: 8080808080808080808080808080808080808080808080808080808080808080 +Ciphertext: C3C1CD5F3060B3EC4E6ABC0818B68449E1750FB482368C8F3305270E16F98735 +Test: Encrypt +Comment: Set 3, vector 129 +Key: 81818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181 +Plaintext: 8181818181818181818181818181818181818181818181818181818181818181 +Ciphertext: 26381852C68B646D80E53C958855293BDC6FAAA85C5F9CAAACABE7B8077E4F7A +Test: Encrypt +Comment: Set 3, vector 130 +Key: 82828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282 +Plaintext: 8282828282828282828282828282828282828282828282828282828282828282 +Ciphertext: E2EA924898ED40FBD8C633706AD7D698392DF1EF33A10FDFCBE51B58C3AE0668 +Test: Encrypt +Comment: Set 3, vector 131 +Key: 83838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383838383 +Plaintext: 8383838383838383838383838383838383838383838383838383838383838383 +Ciphertext: 15CBDDA36707819D0C7694AAD46B2345BDEFC9D4F26F03A4BF860CE46F7BB53A +Test: Encrypt +Comment: Set 3, vector 132 +Key: 84848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484848484 +Plaintext: 8484848484848484848484848484848484848484848484848484848484848484 +Ciphertext: F96318A42737AB884FAA82BBB7025063E9A25C5957F52A7342E0C03A1A64273C +Test: Encrypt +Comment: Set 3, vector 133 +Key: 85858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585858585 +Plaintext: 8585858585858585858585858585858585858585858585858585858585858585 +Ciphertext: 7813FEB148D103075C80ACDFC95E2437A560D9B2E6C910E3A59805338E498907 +Test: Encrypt +Comment: Set 3, vector 134 +Key: 86868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686868686 +Plaintext: 8686868686868686868686868686868686868686868686868686868686868686 +Ciphertext: C7E9D5FE3BA11096AB77E715DFF0D2EB67E9136F0393CD004A7E994B3F994FA4 +Test: Encrypt +Comment: Set 3, vector 135 +Key: 87878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787 +Plaintext: 8787878787878787878787878787878787878787878787878787878787878787 +Ciphertext: F7D2DD8DF86A0E985CF6E83AA5922A548C83856D88C2C9D49EA962C9E6497949 +Test: Encrypt +Comment: Set 3, vector 136 +Key: 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +Plaintext: 8888888888888888888888888888888888888888888888888888888888888888 +Ciphertext: C64887C6573E3D7F286C0353188FC93F05321C0C949ACDCB0237725576BCF77B +Test: Encrypt +Comment: Set 3, vector 137 +Key: 89898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989 +Plaintext: 8989898989898989898989898989898989898989898989898989898989898989 +Ciphertext: 77FB97C9C953BE6BD58044FB1E095BB5E3F4B3A51DAFE6F2F7ADED0FB707921F +Test: Encrypt +Comment: Set 3, vector 138 +Key: 8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A +Plaintext: 8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A +Ciphertext: 22DE5F20955357BA1BF70E4D6DA436CCDE28C228031E4A413882C918EF8082D1 +Test: Encrypt +Comment: Set 3, vector 139 +Key: 8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B +Plaintext: 8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B +Ciphertext: 146FF5907A3C58593C3FD3EB7498C4426CCE04DD0DA9138954BB97AAC821D87F +Test: Encrypt +Comment: Set 3, vector 140 +Key: 8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C +Plaintext: 8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C +Ciphertext: 474ADC5855C87504A7C859409E25154D94B05A925F1D9989AE653B5511710BD7 +Test: Encrypt +Comment: Set 3, vector 141 +Key: 8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D +Plaintext: 8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D +Ciphertext: 959B1090C1FF59998C100814E95E40EF94C6F2B7ED0425C78391192CFFFFA465 +Test: Encrypt +Comment: Set 3, vector 142 +Key: 8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E +Plaintext: 8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E +Ciphertext: 9DA473108FFCECB228F8809860CDA316F4E1FAC5ADC39BB0373F01DCEBCBF271 +Test: Encrypt +Comment: Set 3, vector 143 +Key: 8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F +Plaintext: 8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F +Ciphertext: 905FD0302F9F3C4296E15F94EDD72A8F9F4E9E4068F068099CAAE7247235847E +Test: Encrypt +Comment: Set 3, vector 144 +Key: 90909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090 +Plaintext: 9090909090909090909090909090909090909090909090909090909090909090 +Ciphertext: B63B82FB4B4961E4800FD13CAF145BEBF3625822AF7F5D3ACF2A4506471C636D +Test: Encrypt +Comment: Set 3, vector 145 +Key: 91919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191 +Plaintext: 9191919191919191919191919191919191919191919191919191919191919191 +Ciphertext: 63AA9822C7A5A6777D03F901E3BAF91FD566553C88835EF06DB9A983212288BF +Test: Encrypt +Comment: Set 3, vector 146 +Key: 92929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292 +Plaintext: 9292929292929292929292929292929292929292929292929292929292929292 +Ciphertext: 5417F10E4028BDE0F741114632E2090A1E6C83ACB1D03EA98D18D003838B4F0A +Test: Encrypt +Comment: Set 3, vector 147 +Key: 93939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393939393 +Plaintext: 9393939393939393939393939393939393939393939393939393939393939393 +Ciphertext: FD2C478FB17EE8520149E8A242BB07E0B32929536B191AC6DBCE05891C5E4BFC +Test: Encrypt +Comment: Set 3, vector 148 +Key: 94949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494 +Plaintext: 9494949494949494949494949494949494949494949494949494949494949494 +Ciphertext: 6A36A092BC0F029B60D40440F141EF0DC21A241547359FB618E9243C39AE3D7C +Test: Encrypt +Comment: Set 3, vector 149 +Key: 95959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595959595 +Plaintext: 9595959595959595959595959595959595959595959595959595959595959595 +Ciphertext: 605BC400A0FEE12092D369142E4D20C3A4F3D7623254BF9E242766946FC47ED1 +Test: Encrypt +Comment: Set 3, vector 150 +Key: 96969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696969696 +Plaintext: 9696969696969696969696969696969696969696969696969696969696969696 +Ciphertext: 6A5FA33652F946D7C93A56D15B5D3807401C667A9757495341F78526D58659D2 +Test: Encrypt +Comment: Set 3, vector 151 +Key: 97979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797 +Plaintext: 9797979797979797979797979797979797979797979797979797979797979797 +Ciphertext: 5C6AC175B74B9F7F7D6371A90B1F35E1276628DF6A82B0ECE38590C88B7B8DCA +Test: Encrypt +Comment: Set 3, vector 152 +Key: 98989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898 +Plaintext: 9898989898989898989898989898989898989898989898989898989898989898 +Ciphertext: 67BB4E7818FBE6CFAB113C1B2EC797E3164432BFF708450312422D5AEC70A8A8 +Test: Encrypt +Comment: Set 3, vector 153 +Key: 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 +Plaintext: 9999999999999999999999999999999999999999999999999999999999999999 +Ciphertext: BFDA13CA82E73FBF62B6F1BB7181916CE7FD7DC7608EB958A8246346DFBB04E9 +Test: Encrypt +Comment: Set 3, vector 154 +Key: 9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A +Plaintext: 9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A +Ciphertext: C30F3EF137BF7718F76C7E4D2366A48E7C3CE53735BBF8B56CD51609A23AC06C +Test: Encrypt +Comment: Set 3, vector 155 +Key: 9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B +Plaintext: 9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B +Ciphertext: D73795A681B4FBE858703C15D60299682F64C800E691D223C4BE51012DA4D3DA +Test: Encrypt +Comment: Set 3, vector 156 +Key: 9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C +Plaintext: 9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C +Ciphertext: 885A096C820E01E48E1A5F75DB0A007C2A96B66FCAB38AE80CF92DD8B6A35F6F +Test: Encrypt +Comment: Set 3, vector 157 +Key: 9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D +Plaintext: 9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D +Ciphertext: 8FBDD4939C31026305C575F1FDCED3DBAE320C56CF064E9F19B44A43898BFD5C +Test: Encrypt +Comment: Set 3, vector 158 +Key: 9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E +Plaintext: 9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E +Ciphertext: 2D9EC00B081BC1512EC11A0B8B898639415AEEA3270C4B49E4B47C601AB85875 +Test: Encrypt +Comment: Set 3, vector 159 +Key: 9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F +Plaintext: 9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F +Ciphertext: 59565FB9888519C77E9C4E86D72AD86205AB55488D5ED0B9A388FB2D301C4400 +Test: Encrypt +Comment: Set 3, vector 160 +Key: A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0 +Plaintext: A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0 +Ciphertext: 32D6CAA3D5E0A5D3CCD0FD8F2105CFF662FC4052FE348C2DFD0BC3EEFF3AB700 +Test: Encrypt +Comment: Set 3, vector 161 +Key: A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1 +Plaintext: A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1 +Ciphertext: 7C3276EA6BB6FDDDEC8B901C45978B7D4D34AACE9F2D02F7D7F5826A89809DE9 +Test: Encrypt +Comment: Set 3, vector 162 +Key: A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2 +Plaintext: A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2 +Ciphertext: C5ABC33559D828DD1464264F94D46A8519B4CE47EAA0EC9BF0504C876AC85451 +Test: Encrypt +Comment: Set 3, vector 163 +Key: A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3 +Plaintext: A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3A3 +Ciphertext: E63050ADB9F2789F91A192E089883D7346DD42DE4C654E1D4B72C77D6C09FDB0 +Test: Encrypt +Comment: Set 3, vector 164 +Key: A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4 +Plaintext: A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4 +Ciphertext: E7C58AF118E1DFD2A279DE640EDEF02FB4F3C78D778D145ECC6B2C4CCD065229 +Test: Encrypt +Comment: Set 3, vector 165 +Key: A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5 +Plaintext: A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5 +Ciphertext: 278D8C11ACFDB851131432B3E19C409F940F93E0F6CB49D076C62E70B9C27095 +Test: Encrypt +Comment: Set 3, vector 166 +Key: A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6 +Plaintext: A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6 +Ciphertext: D4839B5679FCA83189BB8C3681E83BAC871A02F297578855034E915F4EF04C12 +Test: Encrypt +Comment: Set 3, vector 167 +Key: A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7 +Plaintext: A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7A7 +Ciphertext: 91AFF6474168F1D113E3DC66E620CF2F7283CE84F5FDDECC7E79CC005859C1BA +Test: Encrypt +Comment: Set 3, vector 168 +Key: A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8 +Plaintext: A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8 +Ciphertext: 1374026DD442B1C1E0BA34570240F6A9E99781C8307A1544A9D3C91857C7E6E1 +Test: Encrypt +Comment: Set 3, vector 169 +Key: A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9 +Plaintext: A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9A9 +Ciphertext: C95E8163D47755E25E8A4BA1FDFF46E016F080F13A794FD21251CE238F28C52E +Test: Encrypt +Comment: Set 3, vector 170 +Key: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +Plaintext: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +Ciphertext: 5DA751854BEEDB19D767A09E2BD9C12D15E51A4409A1F70574496D0A0DA767F9 +Test: Encrypt +Comment: Set 3, vector 171 +Key: ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB +Plaintext: ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB +Ciphertext: C1A0ADDB98DA358D8F40CDB8FA427770D6BD5705D81A804A9BA27FFAE8790BD1 +Test: Encrypt +Comment: Set 3, vector 172 +Key: ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC +Plaintext: ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC +Ciphertext: 604830D513CB29E0E89A36EAB97FFDFC0855AE212F9DDAB62ABE7572CBCEBFC5 +Test: Encrypt +Comment: Set 3, vector 173 +Key: ADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADAD +Plaintext: ADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADAD +Ciphertext: 0DB5075E0B9727D439ED88030D31B532B61556D206220CAE70A7B42EE4C5F72E +Test: Encrypt +Comment: Set 3, vector 174 +Key: AEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAE +Plaintext: AEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAE +Ciphertext: A5167DC20ED3B1894B10C6AA754FDCF9FC1418439D9CA80C40974E9CB7630A12 +Test: Encrypt +Comment: Set 3, vector 175 +Key: AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF +Plaintext: AFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAF +Ciphertext: 1A90CCEA061A2FB58E4D1F363B6CEEC26BFB55F4F140A18991C8EF50E8DFB306 +Test: Encrypt +Comment: Set 3, vector 176 +Key: B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0 +Plaintext: B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0 +Ciphertext: 5CED17D75543C21AA1E020D4B084DB86A77BC445C7E77DA54DC6D786A0976A09 +Test: Encrypt +Comment: Set 3, vector 177 +Key: B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 +Plaintext: B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 +Ciphertext: BB28F1F9496ED578276F99F3A2D4657566DC2CDDDCF00AE44555DA614C64E54E +Test: Encrypt +Comment: Set 3, vector 178 +Key: B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 +Plaintext: B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 +Ciphertext: 30C28BF86BEAEBB25F4A667FB2B9C183B85B456527EB49B44AA4EA825A44E026 +Test: Encrypt +Comment: Set 3, vector 179 +Key: B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3 +Plaintext: B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3 +Ciphertext: C2B0DEB4BC6C28869675FB75D2C2081396601B1FA823185D2D9EDE0730BBEAEA +Test: Encrypt +Comment: Set 3, vector 180 +Key: B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4 +Plaintext: B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4 +Ciphertext: B3EDC667C3FD03CE50D05877C8A78C330F809DF5F8F7FB11968A3664C77CA78B +Test: Encrypt +Comment: Set 3, vector 181 +Key: B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5 +Plaintext: B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5 +Ciphertext: BC2FCF90C52B883CAC3F0A673FA093EEB48952F4DE50A9288464B84A920A1316 +Test: Encrypt +Comment: Set 3, vector 182 +Key: B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6 +Plaintext: B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6B6 +Ciphertext: 30BCF4063A59823CE94B14B6B65F1B4DBEED8FB30832765B5186F4B834DBEA89 +Test: Encrypt +Comment: Set 3, vector 183 +Key: B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7 +Plaintext: B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7 +Ciphertext: 51B4C7E8F697FACC24294A2CEB404C4BEC0CA41C76A6B50A824800EA4464C796 +Test: Encrypt +Comment: Set 3, vector 184 +Key: B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8 +Plaintext: B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8B8 +Ciphertext: 2CCFF61604C0881CCC6A69B885878D6D07CEA7DAB31719D89DC4ECB0063DF5D2 +Test: Encrypt +Comment: Set 3, vector 185 +Key: B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9 +Plaintext: B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9B9 +Ciphertext: 87998D9F16DC018B5DBD42A2E0C26D3774C2A41986E2D0A1504CE37B6EE71688 +Test: Encrypt +Comment: Set 3, vector 186 +Key: BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA +Plaintext: BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA +Ciphertext: D774451BB82A62A4C7708D0194F6C129C483CEFD182BAADF5A35EB77892F317A +Test: Encrypt +Comment: Set 3, vector 187 +Key: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +Plaintext: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +Ciphertext: B88CE3DF52572A1A1C8253E05D789BBF204E2CFC7A00389429F4C6B428EF8CD6 +Test: Encrypt +Comment: Set 3, vector 188 +Key: BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC +Plaintext: BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC +Ciphertext: B854E538E6674A1831F635AA6650A0A4D0730A9A4B12511509EFD49E34D57D62 +Test: Encrypt +Comment: Set 3, vector 189 +Key: BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD +Plaintext: BDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBD +Ciphertext: A69EF2348FEEF1EA09A2B29A6D977092ECD522A62EE906FA47624C92A872EB17 +Test: Encrypt +Comment: Set 3, vector 190 +Key: BEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBE +Plaintext: BEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBE +Ciphertext: A1AE0CBC3B5200F1D8AE165EE42D45F6CE8C4FF448F8127B6D9AB4936FC76CA8 +Test: Encrypt +Comment: Set 3, vector 191 +Key: BFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBF +Plaintext: BFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBF +Ciphertext: 91948E36B83E21FF8A5EEDAA48E50E3A292A3B68D20657FA7E11F50BC7A12205 +Test: Encrypt +Comment: Set 3, vector 192 +Key: C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +Plaintext: C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +Ciphertext: 56CD17219224C3103E3E3E5CABAB6C1E78DEA9AD27613E8D62901FFA31500BFF +Test: Encrypt +Comment: Set 3, vector 193 +Key: C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1 +Plaintext: C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1 +Ciphertext: 2E8FE5CAB2448B194387B160E9141E7D1B879BA1580B3D393B55436608EA2735 +Test: Encrypt +Comment: Set 3, vector 194 +Key: C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2 +Plaintext: C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2C2 +Ciphertext: 5DD74E1155DD90840C702145DF6912754FB74B47625EA4C5382326681DB3390E +Test: Encrypt +Comment: Set 3, vector 195 +Key: C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3 +Plaintext: C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3 +Ciphertext: 3A9F5962554037DCB1FA2AD04BFC0BF79699941500D5F9841320C6D8601310A2 +Test: Encrypt +Comment: Set 3, vector 196 +Key: C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4 +Plaintext: C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4C4 +Ciphertext: BB0F5B68087BBA51DBB700BA1860CC3D0A587E54D57F4014DE4E48E58E529F87 +Test: Encrypt +Comment: Set 3, vector 197 +Key: C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5 +Plaintext: C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5C5 +Ciphertext: 8384025D801AB8EC4D4416F5B7E862B6D9AC9E4AEE334C35FD0296B1402E4975 +Test: Encrypt +Comment: Set 3, vector 198 +Key: C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6 +Plaintext: C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6C6 +Ciphertext: BE3057511C5D0E51315D89671BB4E57E7B590EC3ECE8A14D728248ED8F5107BB +Test: Encrypt +Comment: Set 3, vector 199 +Key: C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7 +Plaintext: C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7 +Ciphertext: 18882618837D15B0B6BD77E1F37470EC58155A2788BDD9D91AEBD16B29A92A1B +Test: Encrypt +Comment: Set 3, vector 200 +Key: C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8 +Plaintext: C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8 +Ciphertext: 8FAFDDC7E04C1AF3BBE8428222DCA59D2EF8C9E0213430492ECAB7B414987FEF +Test: Encrypt +Comment: Set 3, vector 201 +Key: C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9 +Plaintext: C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9C9 +Ciphertext: 4D687992D4F9F515FE451AC967CBF75F906D637C3C261758E263A0DA0DEF69C2 +Test: Encrypt +Comment: Set 3, vector 202 +Key: CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA +Plaintext: CACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACA +Ciphertext: 9DDC94BFF87FDBAFDB0AB9DC17D3649231300E5E6270600856722324DC9CA39A +Test: Encrypt +Comment: Set 3, vector 203 +Key: CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB +Plaintext: CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB +Ciphertext: 86E9CCD90D7B902D23D82C085B1F886402DBD2D19C5A81A32F318C98C6E2A98A +Test: Encrypt +Comment: Set 3, vector 204 +Key: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +Plaintext: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +Ciphertext: 164FCD7D1FFE12FF1FDEE6384145EF546A5CD98C22817A5205FF2C2E18339779 +Test: Encrypt +Comment: Set 3, vector 205 +Key: CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD +Plaintext: CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD +Ciphertext: 4579935A483BAC6B4CCD8C25BCC9E6DEAF46EA8B53F8B5E37CC436EAB85A1330 +Test: Encrypt +Comment: Set 3, vector 206 +Key: CECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECE +Plaintext: CECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECE +Ciphertext: E5F810DF5B215F559E76EF925F2B795915A7B03A6F7019FAC8E9127A7CE93F09 +Test: Encrypt +Comment: Set 3, vector 207 +Key: CFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCF +Plaintext: CFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCF +Ciphertext: 2EA0892E2B2F29A63526B37DECD18E31DC970A60E60A4D8414A5BD0D2D5491EF +Test: Encrypt +Comment: Set 3, vector 208 +Key: D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0 +Plaintext: D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0D0 +Ciphertext: 900F155E80A716199EB062827CDDDC4DA857550BA1C265A46D47BE4024706F40 +Test: Encrypt +Comment: Set 3, vector 209 +Key: D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1 +Plaintext: D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1D1 +Ciphertext: 5B495546838A97D8DF4B9CA95EF8350210A3ECAB81469678EBDE1E5846C1F42D +Test: Encrypt +Comment: Set 3, vector 210 +Key: D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2 +Plaintext: D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2 +Ciphertext: 60E7E367347BC3F4091CE34CCA288C8AFC6375ED8F4394D904FD8489280D50F1 +Test: Encrypt +Comment: Set 3, vector 211 +Key: D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3 +Plaintext: D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3 +Ciphertext: F215EED91D35B7BA649F05C3D1E2B254CB1215588AB78DF54F3CA221AB4A3F1B +Test: Encrypt +Comment: Set 3, vector 212 +Key: D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4 +Plaintext: D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4D4 +Ciphertext: 6441A445D808842C6185B81ACBC5AF86386C54C79026BFC21C1DB5111362AA15 +Test: Encrypt +Comment: Set 3, vector 213 +Key: D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5 +Plaintext: D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5D5 +Ciphertext: 4EE459EDAC1FE0CB08E80C8C13FCE8C44CBFECF7A7F9F14C15B5A92BB7F34E71 +Test: Encrypt +Comment: Set 3, vector 214 +Key: D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6 +Plaintext: D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6D6 +Ciphertext: 78826499B0F2F402E6DA3CACA36EA35492B7BD2A4D84575D0432E16368E78808 +Test: Encrypt +Comment: Set 3, vector 215 +Key: D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7 +Plaintext: D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7D7 +Ciphertext: BDFBCAE2761BEF6A411156AE01A63F9321EE969C56043F2A44C5D3D4BB017BC0 +Test: Encrypt +Comment: Set 3, vector 216 +Key: D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8 +Plaintext: D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8D8 +Ciphertext: 926F2CD84035F9070C3506E6D7245FEA9A845F2D355785BB17E1D3C34FA81228 +Test: Encrypt +Comment: Set 3, vector 217 +Key: D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9 +Plaintext: D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9D9 +Ciphertext: 6C5F6B1C746967142D55FA3769A9417D5A44875D364DB4412B4F9EB254D9BB89 +Test: Encrypt +Comment: Set 3, vector 218 +Key: DADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADA +Plaintext: DADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADADA +Ciphertext: 8329A1E54D9F45DB4E8CE6F1B481C3EE00D5511B52B3CDADCBD562A9F1B35770 +Test: Encrypt +Comment: Set 3, vector 219 +Key: DBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDB +Plaintext: DBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDB +Ciphertext: 7A7FEEDEF1950F1A60529743163406CAF167097358377E0650CF0BB35CD783F6 +Test: Encrypt +Comment: Set 3, vector 220 +Key: DCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDC +Plaintext: DCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDC +Ciphertext: C52CFB15D2F53156701AE4951AA46BCFC872252447BB14E1CE19CAC074926984 +Test: Encrypt +Comment: Set 3, vector 221 +Key: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +Plaintext: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +Ciphertext: 79DFF8DC12ABCEC71E7FAE55ABC8C374135ECE2D52834BC77B860252B756D54A +Test: Encrypt +Comment: Set 3, vector 222 +Key: DEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDE +Plaintext: DEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDE +Ciphertext: 62963B66E680BD5602EC86DB7267E15CB1FF6EA698B54EBA661D125400C7F2DD +Test: Encrypt +Comment: Set 3, vector 223 +Key: DFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDF +Plaintext: DFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDF +Ciphertext: 0C2E76743ACC9CC0525D6E2C519D12C369CFA9E27F13068F98D2F32FAD7220CB +Test: Encrypt +Comment: Set 3, vector 224 +Key: E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0 +Plaintext: E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0 +Ciphertext: B464640E72C30DF092A5BB00F34568A7C04B8620265EDA53F19F3A06164AF980 +Test: Encrypt +Comment: Set 3, vector 225 +Key: E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1 +Plaintext: E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1E1 +Ciphertext: 3725215E79F1FE3DC64B4316449FF98EB52D03330BFC848CD83A407475AADA3A +Test: Encrypt +Comment: Set 3, vector 226 +Key: E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2 +Plaintext: E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2 +Ciphertext: BA273F544C5076D523CC75F90E315A39E465D2B25434E6577FE629F27061BBA4 +Test: Encrypt +Comment: Set 3, vector 227 +Key: E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3 +Plaintext: E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3 +Ciphertext: 472161A0F42E64BD0FE6D448996C370E2C3A56BDE16B378EAA31740551121B4E +Test: Encrypt +Comment: Set 3, vector 228 +Key: E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4 +Plaintext: E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4 +Ciphertext: EA089A10A597504D057E1F03064C9465C1A707C9472A7C0DBAD6978F5BB83A46 +Test: Encrypt +Comment: Set 3, vector 229 +Key: E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5 +Plaintext: E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5E5 +Ciphertext: E91B3433426F88FA31A05E17906E55EA1D803ADFE080C51FBD98290CBF427BEF +Test: Encrypt +Comment: Set 3, vector 230 +Key: E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6 +Plaintext: E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6E6 +Ciphertext: 747C4999D0256384349A5FB132DE1AAD4D7FC48507FEC206B80ED429AF7FDBDB +Test: Encrypt +Comment: Set 3, vector 231 +Key: E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7 +Plaintext: E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7E7 +Ciphertext: 3F8058A1A9B7B0A9C31B4670EEAA6988BF2D41E9B3417EF899EF12CBBC9C77DE +Test: Encrypt +Comment: Set 3, vector 232 +Key: E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8 +Plaintext: E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8E8 +Ciphertext: 9DA431EC0DADDEC4A76B3830B20AA03D346AD09691FB98FC0E9A8987F7B70EDF +Test: Encrypt +Comment: Set 3, vector 233 +Key: E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9 +Plaintext: E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9E9 +Ciphertext: 63BF528E184A43EF807DC9169BDB9CD7B63EE144478A4735EC2EE3A5A7EE460A +Test: Encrypt +Comment: Set 3, vector 234 +Key: EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA +Plaintext: EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA +Ciphertext: 73DC5F8AFA9493AD7767D15A36E7741044EFC225136B4972DC5294E80071A64D +Test: Encrypt +Comment: Set 3, vector 235 +Key: EBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB +Plaintext: EBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB +Ciphertext: 7EEE75D690458A604D20CD21ED64B228F0C3563DB8FB925341FC02845B6E06BA +Test: Encrypt +Comment: Set 3, vector 236 +Key: ECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECEC +Plaintext: ECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECECEC +Ciphertext: AA4D9E1A0157AC347DC7A1997718944427BD579DC18B94F181390E8C36A1305C +Test: Encrypt +Comment: Set 3, vector 237 +Key: EDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDED +Plaintext: EDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDEDED +Ciphertext: 1695BC5C3D63F4B0E0BC3225F00BB0B8E8D29F3DC09584353E11510002E2BE53 +Test: Encrypt +Comment: Set 3, vector 238 +Key: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +Plaintext: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +Ciphertext: C68C7A2FBDA419A515AE816480490BFB2A72A4B6534A19A8D8C6C85FAA949567 +Test: Encrypt +Comment: Set 3, vector 239 +Key: EFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEF +Plaintext: EFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEF +Ciphertext: 5F45E7F72A64C66269F83714A88A0701561C3E7AF33BB48887D4439F5DE4A82D +Test: Encrypt +Comment: Set 3, vector 240 +Key: F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 +Plaintext: F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 +Ciphertext: AD49A5C8EB06256147F02301FB47710E915B5A8FC3219C0D56A19382977119FC +Test: Encrypt +Comment: Set 3, vector 241 +Key: F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1 +Plaintext: F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1 +Ciphertext: 2387AF70EE04E7F25277E81081B044EA24090D503CE8F64997BB610C762D8F6F +Test: Encrypt +Comment: Set 3, vector 242 +Key: F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2 +Plaintext: F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2 +Ciphertext: B5D496DD36BA0B47832C170A53760CE5E47B1FF5C28848F5F7A1827E94BC73CB +Test: Encrypt +Comment: Set 3, vector 243 +Key: F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3 +Plaintext: F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3 +Ciphertext: 77978F2EAB7E8B6B32C9293B83F51419785A0CD276276CB417ACA806A456A6AE +Test: Encrypt +Comment: Set 3, vector 244 +Key: F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4 +Plaintext: F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4 +Ciphertext: E3CBD41F80B27C9A684D7C7C27BBCA9FD59E5E81E93B7BC5BFDF66722EF68EEE +Test: Encrypt +Comment: Set 3, vector 245 +Key: F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5 +Plaintext: F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5 +Ciphertext: 4482F0C362CB423104CAA26E1415B0B7519E1189624D313E65D324C6DC95F516 +Test: Encrypt +Comment: Set 3, vector 246 +Key: F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6 +Plaintext: F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6 +Ciphertext: CD72EE9A6919348595286348C7E488DB3648458688F72BAD994B26FE6999E676 +Test: Encrypt +Comment: Set 3, vector 247 +Key: F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7 +Plaintext: F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7 +Ciphertext: 03EF38F91710AE8BCC8B9193F6A55A7C90C66300D20EDCF5B4946F3B38BEF6C5 +Test: Encrypt +Comment: Set 3, vector 248 +Key: F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8 +Plaintext: F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8F8 +Ciphertext: B67638D30578AB2319FE275D0B833B50D7ABF01E8760F566D0D441D8EAFDF8AA +Test: Encrypt +Comment: Set 3, vector 249 +Key: F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9 +Plaintext: F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9 +Ciphertext: 98B05FF6042436505C7163415E187E09F10C3B1A86FA4B458CE1EF31022F5D16 +Test: Encrypt +Comment: Set 3, vector 250 +Key: FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA +Plaintext: FAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFAFA +Ciphertext: B670A350A2CF0478412307EF00F97F8B30175CDB7593FF4686BD614B41444342 +Test: Encrypt +Comment: Set 3, vector 251 +Key: FBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFB +Plaintext: FBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFBFB +Ciphertext: D7FD492E6302265C24FAB910AA1335C29D53406147E853F7604F4AF1A9407E83 +Test: Encrypt +Comment: Set 3, vector 252 +Key: FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC +Plaintext: FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC +Ciphertext: 28926789363A4306E2C75FD1D8FDF0FE6B62FDB2AFAEDDA6F47A565C2781968B +Test: Encrypt +Comment: Set 3, vector 253 +Key: FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFD +Plaintext: FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFDFD +Ciphertext: 813C816CD4B18F20BD06E2E93CFAA717EBB6554B556CC33D67530608A9BF100F +Test: Encrypt +Comment: Set 3, vector 254 +Key: FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE +Plaintext: FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE +Ciphertext: 5DC15C83E7C4F5AAF8D8482ED1E443271B28B59288783DBCDDEC3544E3368A6E +Test: Encrypt +Comment: Set 3, vector 255 +Key: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +Plaintext: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +Ciphertext: 0598127BAF11706F77402000D730C54A0B84C868A98C6CA4D7F3C0FA06A78B7A +Test: Encrypt diff --git a/cryptopp/TestVectors/sosemanuk.txt b/cryptopp/TestVectors/sosemanuk.txt new file mode 100644 index 0000000..435d89b --- /dev/null +++ b/cryptopp/TestVectors/sosemanuk.txt @@ -0,0 +1,25 @@ +AlgorithmType: SymmetricCipher +Source: Sosemanuk reference implementation, compiled with -DSOSEMANUK_VECTOR +Key: A7C083FEB7 +IV: 00112233445566778899AABBCCDDEEFF +Name: Sosemanuk +Plaintext: r160 00 +Ciphertext: \ + FE 81 D2 16 2C 9A 10 0D 04 89 5C 45 4A 77 51 5B\ + BE 6A 43 1A 93 5C B9 0E 22 21 EB B7 EF 50 23 28\ + 94 35 39 49 2E FF 63 10 C8 71 05 4C 28 89 CC 72\ + 8F 82 E8 6B 1A FF F4 33 4B 61 27 A1 3A 15 5C 75\ + 15 16 30 BD 48 2E B6 73 FF 5D B4 77 FA 6C 53 EB\ + E1 A4 EC 38 C2 3C 54 00 C3 15 45 5D 93 A2 AC ED\ + 95 98 60 47 27 FA 34 0D 5F 2A 8B D7 57 B7 78 33\ + F7 4B D2 BC 04 93 13 C8 06 16 B4 A0 62 68 AE 35\ + 0D B9 2E EC 4F A5 6C 17 13 74 A6 7A 80 C0 06 D0\ + EA D0 48 CE 7B 64 0F 17 D3 D5 A6 2D 1F 25 1C 21 +Test: Encrypt +Source: http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/sosemanuk/unverified.test-vectors?rev=189&view=auto +Comment: Set 6, vector# 3 +Key: 0F62B5085BAE0154A7FA4DA0F34699EC3F92E5388BDE3184D72A7DD02376C91C +IV: 288FF65DC42B92F960C72E95FC63CA31 +Plaintext: r131072 00 +CiphertextXorDigest: CC09FB7405DD54BBF09407B1D2033FBBAC53F388DD387A46F2B8FCFF692A7838353523A621A55D08DA0CA5348AE96D8B0D6A028F309982EF6628054D01B9A368 +Test: EncryptXorDigest diff --git a/cryptopp/TestVectors/tea.txt b/cryptopp/TestVectors/tea.txt new file mode 100644 index 0000000..dc46d3f --- /dev/null +++ b/cryptopp/TestVectors/tea.txt @@ -0,0 +1,711 @@ +AlgorithmType: SymmetricCipher +Name: TEA/ECB +Source: http://www.cix.co.uk/~klockstone/teavect.htm +Comment: test 1 +Plaintext: 00000000 00000000 +Key: 00000000 00000000 00000000 00000000 +Ciphertext: 41ea3a0a 94baa940 +Test: Encrypt +Comment: test 2 +Plaintext: 94baa940 00000000 +Key: 00000000 00000000 00000000 41ea3a0a +Ciphertext: 4e8e7829 7d8236d8 +Test: Encrypt +Comment: test 3 +Plaintext: 7d8236d8 00000000 +Key: 00000000 00000000 41ea3a0a 4e8e7829 +Ciphertext: c88ba95e e7edac02 +Test: Encrypt +Comment: test 4 +Plaintext: e7edac02 00000000 +Key: 00000000 41ea3a0a 4e8e7829 c88ba95e +Ciphertext: b84e28af b6b62088 +Test: Encrypt +Comment: test 5 +Plaintext: b6b62088 00000000 +Key: 41ea3a0a 4e8e7829 c88ba95e b84e28af +Ciphertext: a0a47295 8fadf3b3 +Test: Encrypt +Comment: test 6 +Plaintext: 8fadf3b3 41ea3a0a +Key: 4e8e7829 c88ba95e b84e28af a0a47295 +Ciphertext: ed650698 cf9f2b79 +Test: Encrypt +Comment: test 7 +Plaintext: cf9f2b79 4e8e7829 +Key: c88ba95e b84e28af a0a47295 ed650698 +Ciphertext: 1024eea0 6220ae1c +Test: Encrypt +Comment: test 8 +Plaintext: 6220ae1c c88ba95e +Key: b84e28af a0a47295 ed650698 1024eea0 +Ciphertext: 5ddf75d9 7a4ce68f +Test: Encrypt +Comment: test 9 +Plaintext: 7a4ce68f b84e28af +Key: a0a47295 ed650698 1024eea0 5ddf75d9 +Ciphertext: f1be9d1e 8dd4a984 +Test: Encrypt +Comment: test 10 +Plaintext: 8dd4a984 a0a47295 +Key: ed650698 1024eea0 5ddf75d9 f1be9d1e +Ciphertext: d32c758c 092dabad +Test: Encrypt +Comment: test 11 +Plaintext: 092dabad ed650698 +Key: 1024eea0 5ddf75d9 f1be9d1e d32c758c +Ciphertext: bdb43728 f7183fc0 +Test: Encrypt +Comment: test 12 +Plaintext: f7183fc0 1024eea0 +Key: 5ddf75d9 f1be9d1e d32c758c bdb43728 +Ciphertext: a9c3801a d9dcfb4e +Test: Encrypt +Comment: test 13 +Plaintext: d9dcfb4e 5ddf75d9 +Key: f1be9d1e d32c758c bdb43728 a9c3801a +Ciphertext: 32a1e654 a9df917c +Test: Encrypt +Comment: test 14 +Plaintext: a9df917c f1be9d1e +Key: d32c758c bdb43728 a9c3801a 32a1e654 +Ciphertext: 08b63bb9 b20bd3e8 +Test: Encrypt +Comment: test 15 +Plaintext: b20bd3e8 d32c758c +Key: bdb43728 a9c3801a 32a1e654 08b63bb9 +Ciphertext: 21410574 cc4264c6 +Test: Encrypt +Comment: test 16 +Plaintext: cc4264c6 bdb43728 +Key: a9c3801a 32a1e654 08b63bb9 21410574 +Ciphertext: 4ec5d2e2 5ada1d89 +Test: Encrypt +Comment: test 17 +Plaintext: 5ada1d89 a9c3801a +Key: 32a1e654 08b63bb9 21410574 4ec5d2e2 +Ciphertext: dd46249e 28aa0b4b +Test: Encrypt +Comment: test 18 +Plaintext: 28aa0b4b 32a1e654 +Key: 08b63bb9 21410574 4ec5d2e2 dd46249e +Ciphertext: 2486dcba a713df03 +Test: Encrypt +Comment: test 19 +Plaintext: a713df03 08b63bb9 +Key: 21410574 4ec5d2e2 dd46249e 2486dcba +Ciphertext: b7c7af9d 1acb6cab +Test: Encrypt +Comment: test 20 +Plaintext: 1acb6cab 21410574 +Key: 4ec5d2e2 dd46249e 2486dcba b7c7af9d +Ciphertext: 8cc0400a 9aa49fbb +Test: Encrypt +Comment: test 21 +Plaintext: 9aa49fbb 4ec5d2e2 +Key: dd46249e 2486dcba b7c7af9d 8cc0400a +Ciphertext: 9c241876 6cbc8c66 +Test: Encrypt +Comment: test 22 +Plaintext: 6cbc8c66 dd46249e +Key: 2486dcba b7c7af9d 8cc0400a 9c241876 +Ciphertext: b59c5d45 a90066f9 +Test: Encrypt +Comment: test 23 +Plaintext: a90066f9 2486dcba +Key: b7c7af9d 8cc0400a 9c241876 b59c5d45 +Ciphertext: b765a1b3 64b37eb0 +Test: Encrypt +Comment: test 24 +Plaintext: 64b37eb0 b7c7af9d +Key: 8cc0400a 9c241876 b59c5d45 b765a1b3 +Ciphertext: 7b172fac f5ab4933 +Test: Encrypt +Comment: test 25 +Plaintext: f5ab4933 8cc0400a +Key: 9c241876 b59c5d45 b765a1b3 7b172fac +Ciphertext: fe48f4fb ada404b1 +Test: Encrypt +Comment: test 26 +Plaintext: ada404b1 9c241876 +Key: b59c5d45 b765a1b3 7b172fac fe48f4fb +Ciphertext: c5294093 c1d53e3d +Test: Encrypt +Comment: test 27 +Plaintext: c1d53e3d b59c5d45 +Key: b765a1b3 7b172fac fe48f4fb c5294093 +Ciphertext: 759ca8e2 77a96649 +Test: Encrypt +Comment: test 28 +Plaintext: 77a96649 b765a1b3 +Key: 7b172fac fe48f4fb c5294093 759ca8e2 +Ciphertext: 69c53e0f 3e979807 +Test: Encrypt +Comment: test 29 +Plaintext: 3e979807 7b172fac +Key: fe48f4fb c5294093 759ca8e2 69c53e0f +Ciphertext: 60388ada a21fa8e8 +Test: Encrypt +Comment: test 30 +Plaintext: a21fa8e8 fe48f4fb +Key: c5294093 759ca8e2 69c53e0f 60388ada +Ciphertext: df70a1f5 ac4aa407 +Test: Encrypt +Comment: test 31 +Plaintext: ac4aa407 c5294093 +Key: 759ca8e2 69c53e0f 60388ada df70a1f5 +Ciphertext: d9cb4e09 92636233 +Test: Encrypt +Comment: test 32 +Plaintext: 92636233 759ca8e2 +Key: 69c53e0f 60388ada df70a1f5 d9cb4e09 +Ciphertext: 7d2c6c57 7a6adb4d +Test: Encrypt +Comment: test 33 +Plaintext: 7a6adb4d 69c53e0f +Key: 60388ada df70a1f5 d9cb4e09 7d2c6c57 +Ciphertext: 44b71215 cf25368a +Test: Encrypt +Comment: test 34 +Plaintext: cf25368a 60388ada +Key: df70a1f5 d9cb4e09 7d2c6c57 44b71215 +Ciphertext: c10105a1 ef781a18 +Test: Encrypt +Comment: test 35 +Plaintext: ef781a18 df70a1f5 +Key: d9cb4e09 7d2c6c57 44b71215 c10105a1 +Ciphertext: bfdb29fa 9ece39b6 +Test: Encrypt +Comment: test 36 +Plaintext: 9ece39b6 d9cb4e09 +Key: 7d2c6c57 44b71215 c10105a1 bfdb29fa +Ciphertext: 9b0b256d dc04574c +Test: Encrypt +Comment: test 37 +Plaintext: dc04574c 7d2c6c57 +Key: 44b71215 c10105a1 bfdb29fa 9b0b256d +Ciphertext: f8295142 8c022711 +Test: Encrypt +Comment: test 38 +Plaintext: 8c022711 44b71215 +Key: c10105a1 bfdb29fa 9b0b256d f8295142 +Ciphertext: 61341d1c 3a85f2f0 +Test: Encrypt +Comment: test 39 +Plaintext: 3a85f2f0 c10105a1 +Key: bfdb29fa 9b0b256d f8295142 61341d1c +Ciphertext: f6a0d30c ad230209 +Test: Encrypt +Comment: test 40 +Plaintext: ad230209 bfdb29fa +Key: 9b0b256d f8295142 61341d1c f6a0d30c +Ciphertext: 3de21a3f aa0cf5c9 +Test: Encrypt +Comment: test 41 +Plaintext: aa0cf5c9 9b0b256d +Key: f8295142 61341d1c f6a0d30c 3de21a3f +Ciphertext: a7e307c6 bd52d939 +Test: Encrypt +Comment: test 42 +Plaintext: bd52d939 f8295142 +Key: 61341d1c f6a0d30c 3de21a3f a7e307c6 +Ciphertext: 017bc3a7 66fd8c77 +Test: Encrypt +Comment: test 43 +Plaintext: 66fd8c77 61341d1c +Key: f6a0d30c 3de21a3f a7e307c6 017bc3a7 +Ciphertext: d8f8fc86 d01b5761 +Test: Encrypt +Comment: test 44 +Plaintext: d01b5761 f6a0d30c +Key: 3de21a3f a7e307c6 017bc3a7 d8f8fc86 +Ciphertext: e186c41a 5e6e5a4d +Test: Encrypt +Comment: test 45 +Plaintext: 5e6e5a4d 3de21a3f +Key: a7e307c6 017bc3a7 d8f8fc86 e186c41a +Ciphertext: 4368d224 dbb4e677 +Test: Encrypt +Comment: test 46 +Plaintext: dbb4e677 a7e307c6 +Key: 017bc3a7 d8f8fc86 e186c41a 4368d224 +Ciphertext: 9bd0321e 84096523 +Test: Encrypt +Comment: test 47 +Plaintext: 84096523 017bc3a7 +Key: d8f8fc86 e186c41a 4368d224 9bd0321e +Ciphertext: b7c56d5b 97c65866 +Test: Encrypt +Comment: test 48 +Plaintext: 97c65866 d8f8fc86 +Key: e186c41a 4368d224 9bd0321e b7c56d5b +Ciphertext: 63a1bfac 5a5d7ca2 +Test: Encrypt +Comment: test 49 +Plaintext: 5a5d7ca2 e186c41a +Key: 4368d224 9bd0321e b7c56d5b 63a1bfac +Ciphertext: 91f56dff 7281794f +Test: Encrypt +Comment: test 50 +Plaintext: 7281794f 4368d224 +Key: 9bd0321e b7c56d5b 63a1bfac 91f56dff +Ciphertext: e4c63780 019aedf7 +Test: Encrypt +Comment: test 51 +Plaintext: 019aedf7 9bd0321e +Key: b7c56d5b 63a1bfac 91f56dff e4c63780 +Ciphertext: a9fb56e7 35f4aeca +Test: Encrypt +Comment: test 52 +Plaintext: 35f4aeca b7c56d5b +Key: 63a1bfac 91f56dff e4c63780 a9fb56e7 +Ciphertext: a6537187 f0f1ba93 +Test: Encrypt +Comment: test 53 +Plaintext: f0f1ba93 63a1bfac +Key: 91f56dff e4c63780 a9fb56e7 a6537187 +Ciphertext: cc960eda e44c6b8f +Test: Encrypt +Comment: test 54 +Plaintext: e44c6b8f 91f56dff +Key: e4c63780 a9fb56e7 a6537187 cc960eda +Ciphertext: e12f106d 4f1152d0 +Test: Encrypt +Comment: test 55 +Plaintext: 4f1152d0 e4c63780 +Key: a9fb56e7 a6537187 cc960eda e12f106d +Ciphertext: 556ad853 f79992fd +Test: Encrypt +Comment: test 56 +Plaintext: f79992fd a9fb56e7 +Key: a6537187 cc960eda e12f106d 556ad853 +Ciphertext: 78e8e265 128df6ad +Test: Encrypt +Comment: test 57 +Plaintext: 128df6ad a6537187 +Key: cc960eda e12f106d 556ad853 78e8e265 +Ciphertext: f23892aa 288cb926 +Test: Encrypt +Comment: test 58 +Plaintext: 288cb926 cc960eda +Key: e12f106d 556ad853 78e8e265 f23892aa +Ciphertext: 1d115839 6a117fca +Test: Encrypt +Comment: test 59 +Plaintext: 6a117fca e12f106d +Key: 556ad853 78e8e265 f23892aa 1d115839 +Ciphertext: cf899635 5b087e34 +Test: Encrypt +Comment: test 60 +Plaintext: 5b087e34 556ad853 +Key: 78e8e265 f23892aa 1d115839 cf899635 +Ciphertext: 5c60bff2 e68d88c2 +Test: Encrypt +Comment: test 61 +Plaintext: e68d88c2 78e8e265 +Key: f23892aa 1d115839 cf899635 5c60bff2 +Ciphertext: 7072d01c bffeb50a +Test: Encrypt +Comment: test 62 +Plaintext: bffeb50a f23892aa +Key: 1d115839 cf899635 5c60bff2 7072d01c +Ciphertext: 4513c5eb 9c99ae9e +Test: Encrypt +Comment: test 63 +Plaintext: 9c99ae9e 1d115839 +Key: cf899635 5c60bff2 7072d01c 4513c5eb +Ciphertext: 8f3a38ab 80d9c4ad +Test: Encrypt +Comment: test 64 +Plaintext: 80d9c4ad cf899635 +Key: 5c60bff2 7072d01c 4513c5eb 8f3a38ab +Ciphertext: 2bb0f1b3 c023ed11 +Test: Encrypt + +AlgorithmType: SymmetricCipher +Name: XTEA/ECB +Source: http://www.cix.co.uk/~klockstone/teavect.htm +Comment: test 1 +Plaintext: 00000000 00000000 +Key: 00000000 00000000 00000000 00000000 +Rounds: 1 +Ciphertext: 00000000 9e3779b9 +Test: Encrypt +Comment: test 2 +Plaintext: 9e3779b9 00000000 +Key: 00000000 00000000 00000000 00000000 +Rounds: 2 +Ciphertext: ec01a1de aaa0256d +Test: Encrypt +Comment: test 3 +Plaintext: aaa0256d 00000000 +Key: 00000000 00000000 00000000 ec01a1de +Rounds: 3 +Ciphertext: 114f6d74 a39e590c +Test: Encrypt +Comment: test 4 +Plaintext: a39e590c 00000000 +Key: 00000000 00000000 ec01a1de 114f6d74 +Rounds: 4 +Ciphertext: bc3a7de2 4e238eb9 +Test: Encrypt +Comment: test 5 +Plaintext: 4e238eb9 00000000 +Key: 00000000 ec01a1de 114f6d74 bc3a7de2 +Rounds: 5 +Ciphertext: 845846cf 2f36d07f +Test: Encrypt +Comment: test 6 +Plaintext: 2f36d07f 00000000 +Key: ec01a1de 114f6d74 bc3a7de2 845846cf +Rounds: 6 +Ciphertext: 2794a127 4f3e4b6a +Test: Encrypt +Comment: test 7 +Plaintext: 4f3e4b6a ec01a1de +Key: 114f6d74 bc3a7de2 845846cf 2794a127 +Rounds: 7 +Ciphertext: 6b8ea8b8 d99e66c3 +Test: Encrypt +Comment: test 8 +Plaintext: d99e66c3 114f6d74 +Key: bc3a7de2 845846cf 2794a127 6b8ea8b8 +Rounds: 8 +Ciphertext: 31c5fa6c 241756d6 +Test: Encrypt +Comment: test 9 +Plaintext: 241756d6 bc3a7de2 +Key: 845846cf 2794a127 6b8ea8b8 31c5fa6c +Rounds: 9 +Ciphertext: 4a581696 1fd58a6b +Test: Encrypt +Comment: test 10 +Plaintext: 1fd58a6b 845846cf +Key: 2794a127 6b8ea8b8 31c5fa6c 4a581696 +Rounds: 10 +Ciphertext: dfcd0451 df8822cd +Test: Encrypt +Comment: test 11 +Plaintext: df8822cd 2794a127 +Key: 6b8ea8b8 31c5fa6c 4a581696 dfcd0451 +Rounds: 11 +Ciphertext: 3ad1ff17 f465776c +Test: Encrypt +Comment: test 12 +Plaintext: f465776c 6b8ea8b8 +Key: 31c5fa6c 4a581696 dfcd0451 3ad1ff17 +Rounds: 12 +Ciphertext: 6a1d78c8 4d30bdb9 +Test: Encrypt +Comment: test 13 +Plaintext: 4d30bdb9 31c5fa6c +Key: 4a581696 dfcd0451 3ad1ff17 6a1d78c8 +Rounds: 13 +Ciphertext: 08c86d67 f6ef939b +Test: Encrypt +Comment: test 14 +Plaintext: f6ef939b 4a581696 +Key: dfcd0451 3ad1ff17 6a1d78c8 08c86d67 +Rounds: 14 +Ciphertext: 2a65bfbe f733428c +Test: Encrypt +Comment: test 15 +Plaintext: f733428c dfcd0451 +Key: 3ad1ff17 6a1d78c8 08c86d67 2a65bfbe +Rounds: 15 +Ciphertext: b4bd6e46 40672bcc +Test: Encrypt +Comment: test 16 +Plaintext: 40672bcc 3ad1ff17 +Key: 6a1d78c8 08c86d67 2a65bfbe b4bd6e46 +Rounds: 16 +Ciphertext: 1d8e6992 9a478905 +Test: Encrypt +Comment: test 17 +Plaintext: 9a478905 6a1d78c8 +Key: 08c86d67 2a65bfbe b4bd6e46 1d8e6992 +Rounds: 17 +Ciphertext: f8994ada 80dee76a +Test: Encrypt +Comment: test 18 +Plaintext: 80dee76a 08c86d67 +Key: 2a65bfbe b4bd6e46 1d8e6992 f8994ada +Rounds: 18 +Ciphertext: 0997e6ed cdfef370 +Test: Encrypt +Comment: test 19 +Plaintext: cdfef370 2a65bfbe +Key: b4bd6e46 1d8e6992 f8994ada 0997e6ed +Rounds: 19 +Ciphertext: ece50553 10b76c66 +Test: Encrypt +Comment: test 20 +Plaintext: 10b76c66 b4bd6e46 +Key: 1d8e6992 f8994ada 0997e6ed ece50553 +Rounds: 20 +Ciphertext: a6d39c7b dce1a473 +Test: Encrypt +Comment: test 21 +Plaintext: dce1a473 1d8e6992 +Key: f8994ada 0997e6ed ece50553 a6d39c7b +Rounds: 21 +Ciphertext: 21d06fb7 fbb98544 +Test: Encrypt +Comment: test 22 +Plaintext: fbb98544 f8994ada +Key: 0997e6ed ece50553 a6d39c7b 21d06fb7 +Rounds: 22 +Ciphertext: 72cdd36c e1115fb6 +Test: Encrypt +Comment: test 23 +Plaintext: e1115fb6 0997e6ed +Key: ece50553 a6d39c7b 21d06fb7 72cdd36c +Rounds: 23 +Ciphertext: 25bc6eb3 e4c28ab7 +Test: Encrypt +Comment: test 24 +Plaintext: e4c28ab7 ece50553 +Key: a6d39c7b 21d06fb7 72cdd36c 25bc6eb3 +Rounds: 24 +Ciphertext: 4932a288 78020b9e +Test: Encrypt +Comment: test 25 +Plaintext: 78020b9e a6d39c7b +Key: 21d06fb7 72cdd36c 25bc6eb3 4932a288 +Rounds: 25 +Ciphertext: 25285da1 b66c4459 +Test: Encrypt +Comment: test 26 +Plaintext: b66c4459 21d06fb7 +Key: 72cdd36c 25bc6eb3 4932a288 25285da1 +Rounds: 26 +Ciphertext: 39b0155c f227ab20 +Test: Encrypt +Comment: test 27 +Plaintext: f227ab20 72cdd36c +Key: 25bc6eb3 4932a288 25285da1 39b0155c +Rounds: 27 +Ciphertext: 547571aa f38f1e39 +Test: Encrypt +Comment: test 28 +Plaintext: f38f1e39 25bc6eb3 +Key: 4932a288 25285da1 39b0155c 547571aa +Rounds: 28 +Ciphertext: 27f917b1 e5796aee +Test: Encrypt +Comment: test 29 +Plaintext: e5796aee 4932a288 +Key: 25285da1 39b0155c 547571aa 27f917b1 +Rounds: 29 +Ciphertext: c1da8993 670f9fd2 +Test: Encrypt +Comment: test 30 +Plaintext: 670f9fd2 25285da1 +Key: 39b0155c 547571aa 27f917b1 c1da8993 +Rounds: 30 +Ciphertext: 60e2acaa d0a60db4 +Test: Encrypt +Comment: test 31 +Plaintext: d0a60db4 39b0155c +Key: 547571aa 27f917b1 c1da8993 60e2acaa +Rounds: 31 +Ciphertext: a6eb923d af20a390 +Test: Encrypt +Comment: test 32 +Plaintext: af20a390 547571aa +Key: 27f917b1 c1da8993 60e2acaa a6eb923d +Rounds: 32 +Ciphertext: d26428af 0a202283 +Test: Encrypt +Comment: test 33 +Plaintext: 0a202283 27f917b1 +Key: c1da8993 60e2acaa a6eb923d d26428af +Rounds: 33 +Ciphertext: 1c03ceb9 96e9f2d3 +Test: Encrypt +Comment: test 34 +Plaintext: 96e9f2d3 c1da8993 +Key: 60e2acaa a6eb923d d26428af 1c03ceb9 +Rounds: 34 +Ciphertext: e260b3c1 bbd7dff0 +Test: Encrypt +Comment: test 35 +Plaintext: bbd7dff0 60e2acaa +Key: a6eb923d d26428af 1c03ceb9 e260b3c1 +Rounds: 35 +Ciphertext: d33073f9 12841b97 +Test: Encrypt +Comment: test 36 +Plaintext: 12841b97 a6eb923d +Key: d26428af 1c03ceb9 e260b3c1 d33073f9 +Rounds: 36 +Ciphertext: 17b7ea05 1d723f18 +Test: Encrypt +Comment: test 37 +Plaintext: 1d723f18 d26428af +Key: 1c03ceb9 e260b3c1 d33073f9 17b7ea05 +Rounds: 37 +Ciphertext: 9f571045 31e849b9 +Test: Encrypt +Comment: test 38 +Plaintext: 31e849b9 1c03ceb9 +Key: e260b3c1 d33073f9 17b7ea05 9f571045 +Rounds: 38 +Ciphertext: 288351d2 bd0a0054 +Test: Encrypt +Comment: test 39 +Plaintext: bd0a0054 e260b3c1 +Key: d33073f9 17b7ea05 9f571045 288351d2 +Rounds: 39 +Ciphertext: 9236883a 2bd13143 +Test: Encrypt +Comment: test 40 +Plaintext: 2bd13143 d33073f9 +Key: 17b7ea05 9f571045 288351d2 9236883a +Rounds: 40 +Ciphertext: e91dcf23 7c3fd716 +Test: Encrypt +Comment: test 41 +Plaintext: 7c3fd716 17b7ea05 +Key: 9f571045 288351d2 9236883a e91dcf23 +Rounds: 41 +Ciphertext: 5c8ff51e c3abe43d +Test: Encrypt +Comment: test 42 +Plaintext: c3abe43d 9f571045 +Key: 288351d2 9236883a e91dcf23 5c8ff51e +Rounds: 42 +Ciphertext: 446e9f7c ecb0eb4d +Test: Encrypt +Comment: test 43 +Plaintext: ecb0eb4d 288351d2 +Key: 9236883a e91dcf23 5c8ff51e 446e9f7c +Rounds: 43 +Ciphertext: 86455f77 ffc74050 +Test: Encrypt +Comment: test 44 +Plaintext: ffc74050 9236883a +Key: e91dcf23 5c8ff51e 446e9f7c 86455f77 +Rounds: 44 +Ciphertext: ae85d873 e21ef8d3 +Test: Encrypt +Comment: test 45 +Plaintext: e21ef8d3 e91dcf23 +Key: 5c8ff51e 446e9f7c 86455f77 ae85d873 +Rounds: 45 +Ciphertext: cf411a68 18dce768 +Test: Encrypt +Comment: test 46 +Plaintext: 18dce768 5c8ff51e +Key: 446e9f7c 86455f77 ae85d873 cf411a68 +Rounds: 46 +Ciphertext: 4ef68794 07d2b1b3 +Test: Encrypt +Comment: test 47 +Plaintext: 07d2b1b3 446e9f7c +Key: 86455f77 ae85d873 cf411a68 4ef68794 +Rounds: 47 +Ciphertext: d75a1925 07476976 +Test: Encrypt +Comment: test 48 +Plaintext: 07476976 86455f77 +Key: ae85d873 cf411a68 4ef68794 d75a1925 +Rounds: 48 +Ciphertext: 909d29cb 16b37e1b +Test: Encrypt +Comment: test 49 +Plaintext: 16b37e1b ae85d873 +Key: cf411a68 4ef68794 d75a1925 909d29cb +Rounds: 49 +Ciphertext: e05578cd bd40cd0c +Test: Encrypt +Comment: test 50 +Plaintext: bd40cd0c cf411a68 +Key: 4ef68794 d75a1925 909d29cb e05578cd +Rounds: 50 +Ciphertext: 988b50e5 adf1b74c +Test: Encrypt +Comment: test 51 +Plaintext: adf1b74c 4ef68794 +Key: d75a1925 909d29cb e05578cd 988b50e5 +Rounds: 51 +Ciphertext: 90699d3d d2333c19 +Test: Encrypt +Comment: test 52 +Plaintext: d2333c19 d75a1925 +Key: 909d29cb e05578cd 988b50e5 90699d3d +Rounds: 52 +Ciphertext: a119eb2e 3488c65b +Test: Encrypt +Comment: test 53 +Plaintext: 3488c65b 909d29cb +Key: e05578cd 988b50e5 90699d3d a119eb2e +Rounds: 53 +Ciphertext: e4c43e62 e9c4894b +Test: Encrypt +Comment: test 54 +Plaintext: e9c4894b e05578cd +Key: 988b50e5 90699d3d a119eb2e e4c43e62 +Rounds: 54 +Ciphertext: e1aec3f2 1976c384 +Test: Encrypt +Comment: test 55 +Plaintext: 1976c384 988b50e5 +Key: 90699d3d a119eb2e e4c43e62 e1aec3f2 +Rounds: 55 +Ciphertext: 1b7b0e2b 0b392b46 +Test: Encrypt +Comment: test 56 +Plaintext: 0b392b46 90699d3d +Key: a119eb2e e4c43e62 e1aec3f2 1b7b0e2b +Rounds: 56 +Ciphertext: 1a6ffc0c 600f2ee0 +Test: Encrypt +Comment: test 57 +Plaintext: 600f2ee0 a119eb2e +Key: e4c43e62 e1aec3f2 1b7b0e2b 1a6ffc0c +Rounds: 57 +Ciphertext: 82ccc9d3 94ba3d77 +Test: Encrypt +Comment: test 58 +Plaintext: 94ba3d77 e4c43e62 +Key: e1aec3f2 1b7b0e2b 1a6ffc0c 82ccc9d3 +Rounds: 58 +Ciphertext: 38b5ebd1 c56af77e +Test: Encrypt +Comment: test 59 +Plaintext: c56af77e e1aec3f2 +Key: 1b7b0e2b 1a6ffc0c 82ccc9d3 38b5ebd1 +Rounds: 59 +Ciphertext: f5571f9d fe136a04 +Test: Encrypt +Comment: test 60 +Plaintext: fe136a04 1b7b0e2b +Key: 1a6ffc0c 82ccc9d3 38b5ebd1 f5571f9d +Rounds: 60 +Ciphertext: 62ee209f 08550367 +Test: Encrypt +Comment: test 61 +Plaintext: 08550367 1a6ffc0c +Key: 82ccc9d3 38b5ebd1 f5571f9d 62ee209f +Rounds: 61 +Ciphertext: 069b7afc b0fcde91 +Test: Encrypt +Comment: test 62 +Plaintext: b0fcde91 82ccc9d3 +Key: 38b5ebd1 f5571f9d 62ee209f 069b7afc +Rounds: 62 +Ciphertext: 376a8936 11b9c087 +Test: Encrypt +Comment: test 63 +Plaintext: 11b9c087 38b5ebd1 +Key: f5571f9d 62ee209f 069b7afc 376a8936 +Rounds: 63 +Ciphertext: cdc9e923 2e6c1fe7 +Test: Encrypt +Comment: test 64 +Plaintext: 2e6c1fe7 f5571f9d +Key: 62ee209f 069b7afc 376a8936 cdc9e923 +Rounds: 64 +Ciphertext: 7a01cbc9 b03d6068 +Test: Encrypt diff --git a/cryptopp/TestVectors/ttmac.txt b/cryptopp/TestVectors/ttmac.txt new file mode 100644 index 0000000..ec2e683 --- /dev/null +++ b/cryptopp/TestVectors/ttmac.txt @@ -0,0 +1,40 @@ +AlgorithmType: MAC +Name: Two-Track-MAC +Source: NESSIE submission +Comment: Key for all test cases +Key: 00112233445566778899aabbccddeeff01234567 +Comment: Test Case 1 +Message: "" +MAC: 2dec8ed4a0fd712ed9fbf2ab466ec2df21215e4a +Test: Verify +Comment: Test Case 2 +Message: "a" +MAC: 5893e3e6e306704dd77ad6e6ed432cde321a7756 +Test: Verify +Comment: Test Case 3 +Message: "abc" +MAC: 70bfd1029797a5c16da5b557a1f0b2779b78497e +Test: Verify +Comment: Test Case 4 +Message: "message digest" +MAC: 8289f4f19ffe4f2af737de4bd71c829d93a972fa +Test: Verify +Comment: Test Case 5 +Message: "abcdefghijklmnopqrstuvwxyz" +MAC: 2186ca09c5533198b7371f245273504ca92bae60 +Test: Verify +Comment: Test Case 6 +Message: "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" +MAC: 8a7bf77aef62a2578497a27c0d6518a429e7c14d +Test: Verify +Comment: Test Case 7 +Message: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" +MAC: 54bac392a886806d169556fcbb6789b54fb364fb +Test: Verify +Comment: Test Case 8 +Message: r8 "1234567890" +MAC: 0ced2c9f8f0d9d03981ab5c8184bac43dd54c484 +Test: Verify +Comment: Test Case 9 +Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +MAC: 27b3aedb5df8b629f0142194daa3846e1895f3d2 diff --git a/cryptopp/TestVectors/vmac.txt b/cryptopp/TestVectors/vmac.txt new file mode 100644 index 0000000..1d983cd --- /dev/null +++ b/cryptopp/TestVectors/vmac.txt @@ -0,0 +1,77 @@ +AlgorithmType: MAC +Name: VMAC(AES)-64 +Source: http://www.fastcrypto.org/vmac/draft-krovetz-vmac-01.txt +Key: "abcdefghijklmnop" +IV: "bcdefghi" +Message: "" +MAC: 2576BE1C56D8B81B +Test: Verify +Message: "abc" +MAC: 2D376CF5B1813CE5 +Test: Verify +Message: r16 "abc" +MAC: E8421F61D573D298 +Test: Verify +Message: r100 "abc" +MAC: 4492DF6C5CAC1BBE +Test: Verify +Message: r1000000 "abc" +MAC: 09BA597DD7601113 +Test: Verify +Message: r42 "abc" "ab" +MAC: D638B73921F184DE +Test: Verify +Message: r170 "abc" "ab" +MAC: 9DA310281E6FD0A0 +Test: Verify +Message: r65 "a" +MAC: 90 ea 57 cb 51 bc 92 a3 +Test: Verify +Message: r129 "a" +MAC: 86 34 83 87 d1 3d 82 33 +Test: Verify +Message: r65 "abc" +MAC: E86A86EC77A8BF61 +Test: Verify +Message: "abc" +MAC: 2D376CF5B1813CE0 +Test: NotVerify + +AlgorithmType: MAC +Name: VMAC(AES)-128 +Source: http://www.fastcrypto.org/vmac/draft-krovetz-vmac-01.txt +Key: "abcdefghijklmnop" +IV: "bcdefghi" +Message: "" +MAC: 472766C70F74ED23481D6D7DE4E80DAC +Test: Verify +Message: "abc" +MAC: 4EE815A06A1D71EDD36FC75D51188A42 +Test: Verify +Message: r16 "abc" +MAC: 09F2C80C8E1007A0C12FAE19FE4504AE +Test: Verify +Message: r100 "abc" +MAC: 66438817154850C61D8A412164803BCB +Test: Verify +Message: r1000000 "abc" +MAC: 2B6B02288FFC461B75485DE893C629DC +Test: Verify +Message: r42 "abc" "ab" +MAC: F7E95FE3DA8DB9E6BB973E65D0B4CEA5 +Test: Verify +Message: r170 "abc" "ab" +MAC: BF53B8D2D70C05A85880C2E21CAF1299 +Test: Verify +Message: r65 "a" +MAC: b2 9b 00 76 0a 58 c7 ab 92 d6 60 24 d6 9c 1b 92 +Test: Verify +Message: r129 "a" +MAC: a7 e5 2c 32 89 d9 b7 3b 53 57 6f 05 95 85 ee 79 +Test: Verify +Message: r65 "abc" +MAC: 0A1B2F973044F469F405917E45010334 +Test: Verify +Message: "abc" +MAC: 4EE815A06A1D71EDD36FC75D51188A40 +Test: NotVerify diff --git a/cryptopp/TestVectors/whrlpool.txt b/cryptopp/TestVectors/whrlpool.txt new file mode 100644 index 0000000..9a4df8b --- /dev/null +++ b/cryptopp/TestVectors/whrlpool.txt @@ -0,0 +1,39 @@ +AlgorithmType: MessageDigest +Name: Whirlpool +Source: ISO test vectors in http://planeta.terra.com.br/informatica/paulobarreto/whirlpool.zip +Message: "" +Digest: 19FA61D75522A466 9B44E39C1D2E1726 C530232130D407F8 9AFEE0964997F7A7\ + 3E83BE698B288FEB CF88E3E03C4F0757 EA8964E59B63D937 08B138CC42A66EB3 +Test: Verify +Message: "a" +Digest: 8ACA2602792AEC6F 11A67206531FB7D7 F0DFF59413145E69 73C45001D0087B42\ + D11BC645413AEFF6 3A42391A39145A59 1A92200D560195E5 3B478584FDAE231A +Test: Verify +Message: "abc" +Digest: 4E2448A4C6F486BB 16B6562C73B4020B F3043E3A731BCE72 1AE1B303D97E6D4C\ + 7181EEBDB6C57E27 7D0E34957114CBD6 C797FC9D95D8B582 D225292076D4EEF5 +Test: Verify +Message: "message digest" +Digest: 378C84A4126E2DC6 E56DCC7458377AAC 838D00032230F53C E1F5700C0FFB4D3B\ + 8421557659EF55C1 06B4B52AC5A4AAA6 92ED920052838F33 62E86DBD37A8903E +Test: Verify +Message: "abcdefghijklmnopqrstuvwxyz" +Digest: F1D754662636FFE9 2C82EBB9212A484A 8D38631EAD4238F5 442EE13B8054E41B\ + 08BF2A9251C30B6A 0B8AAE86177AB4A6 F68F673E7207865D 5D9819A3DBA4EB3B +Test: Verify +Message: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" +Digest: DC37E008CF9EE69B F11F00ED9ABA2690 1DD7C28CDEC066CC 6AF42E40F82F3A1E\ + 08EBA26629129D8F B7CB57211B9281A6 5517CC879D7B9621 42C65F5A7AF01467 +Test: Verify +Message: r8 "1234567890" +Digest: 466EF18BABB0154D 25B9D38A6414F5C0 8784372BCCB204D6 549C4AFADB601429\ + 4D5BD8DF2A6C44E5 38CD047B2681A51A 2C60481E88C5A20B 2C2A80CF3A9A083B +Test: Verify +Message: "abcdbcdecdefdefgefghfghighijhijk" +Digest: 2A987EA40F917061 F5D6F0A0E4644F48 8A7A5A52DEEE6562 07C562F988E95C69\ + 16BDC8031BC5BE1B 7B947639FE050B56 939BAAA0ADFF9AE6 745B7B181C3BE3FD +Test: Verify +Message: r1000000 "a" +Digest: 0C99005BEB57EFF5 0A7CF005560DDF5D 29057FD86B20BFD6 2DECA0F1CCEA4AF5\ + 1FC15490EDDC47AF 32BB2B66C34FF9AD 8C6008AD677F7712 6953B226E4ED8B01 +Test: Verify diff --git a/cryptopp/adhoc.cpp b/cryptopp/adhoc.cpp new file mode 100644 index 0000000..df09f11 --- /dev/null +++ b/cryptopp/adhoc.cpp @@ -0,0 +1,17 @@ +#include "filters.h" +#include "files.h" +#include "base64.h" +#include "hex.h" +#include + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +extern int (*AdhocTest)(int argc, char *argv[]); + +int MyAdhocTest(int argc, char *argv[]) +{ + return 0; +} + +static int s_i = (AdhocTest = &MyAdhocTest, 0); diff --git a/cryptopp/adhoc.cpp.copied b/cryptopp/adhoc.cpp.copied new file mode 100644 index 0000000..b7ec413 --- /dev/null +++ b/cryptopp/adhoc.cpp.copied @@ -0,0 +1,3 @@ + + + diff --git a/cryptopp/adhoc.cpp.proto b/cryptopp/adhoc.cpp.proto new file mode 100644 index 0000000..df09f11 --- /dev/null +++ b/cryptopp/adhoc.cpp.proto @@ -0,0 +1,17 @@ +#include "filters.h" +#include "files.h" +#include "base64.h" +#include "hex.h" +#include + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +extern int (*AdhocTest)(int argc, char *argv[]); + +int MyAdhocTest(int argc, char *argv[]) +{ + return 0; +} + +static int s_i = (AdhocTest = &MyAdhocTest, 0); diff --git a/cryptopp/adler32.cpp b/cryptopp/adler32.cpp new file mode 100644 index 0000000..0d52c08 --- /dev/null +++ b/cryptopp/adler32.cpp @@ -0,0 +1,77 @@ +// adler32.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "adler32.h" + +NAMESPACE_BEGIN(CryptoPP) + +void Adler32::Update(const byte *input, size_t length) +{ + const unsigned long BASE = 65521; + + unsigned long s1 = m_s1; + unsigned long s2 = m_s2; + + if (length % 8 != 0) + { + do + { + s1 += *input++; + s2 += s1; + length--; + } while (length % 8 != 0); + + if (s1 >= BASE) + s1 -= BASE; + s2 %= BASE; + } + + while (length > 0) + { + s1 += input[0]; s2 += s1; + s1 += input[1]; s2 += s1; + s1 += input[2]; s2 += s1; + s1 += input[3]; s2 += s1; + s1 += input[4]; s2 += s1; + s1 += input[5]; s2 += s1; + s1 += input[6]; s2 += s1; + s1 += input[7]; s2 += s1; + + length -= 8; + input += 8; + + if (s1 >= BASE) + s1 -= BASE; + if (length % 0x8000 == 0) + s2 %= BASE; + } + + assert(s1 < BASE); + assert(s2 < BASE); + + m_s1 = (word16)s1; + m_s2 = (word16)s2; +} + +void Adler32::TruncatedFinal(byte *hash, size_t size) +{ + ThrowIfInvalidTruncatedSize(size); + + switch (size) + { + default: + hash[3] = byte(m_s1); + case 3: + hash[2] = byte(m_s1 >> 8); + case 2: + hash[1] = byte(m_s2); + case 1: + hash[0] = byte(m_s2 >> 8); + case 0: + ; + } + + Reset(); +} + +NAMESPACE_END diff --git a/cryptopp/adler32.h b/cryptopp/adler32.h new file mode 100644 index 0000000..0ed803d --- /dev/null +++ b/cryptopp/adler32.h @@ -0,0 +1,28 @@ +#ifndef CRYPTOPP_ADLER32_H +#define CRYPTOPP_ADLER32_H + +#include "cryptlib.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! ADLER-32 checksum calculations +class Adler32 : public HashTransformation +{ +public: + CRYPTOPP_CONSTANT(DIGESTSIZE = 4) + Adler32() {Reset();} + void Update(const byte *input, size_t length); + void TruncatedFinal(byte *hash, size_t size); + unsigned int DigestSize() const {return DIGESTSIZE;} + static const char * StaticAlgorithmName() {return "Adler32";} + std::string AlgorithmName() const {return StaticAlgorithmName();} + +private: + void Reset() {m_s1 = 1; m_s2 = 0;} + + word16 m_s1, m_s2; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/aes.h b/cryptopp/aes.h new file mode 100644 index 0000000..0087542 --- /dev/null +++ b/cryptopp/aes.h @@ -0,0 +1,16 @@ +#ifndef CRYPTOPP_AES_H +#define CRYPTOPP_AES_H + +#include "rijndael.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! AES winner, announced on 10/2/2000 +DOCUMENTED_TYPEDEF(Rijndael, AES); + +typedef RijndaelEncryption AESEncryption; +typedef RijndaelDecryption AESDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/algebra.cpp b/cryptopp/algebra.cpp new file mode 100644 index 0000000..78c3947 --- /dev/null +++ b/cryptopp/algebra.cpp @@ -0,0 +1,340 @@ +// algebra.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_ALGEBRA_CPP // SunCC workaround: compiler could cause this file to be included twice +#define CRYPTOPP_ALGEBRA_CPP + +#include "algebra.h" +#include "integer.h" + +#include + +NAMESPACE_BEGIN(CryptoPP) + +template const T& AbstractGroup::Double(const Element &a) const +{ + return Add(a, a); +} + +template const T& AbstractGroup::Subtract(const Element &a, const Element &b) const +{ + // make copy of a in case Inverse() overwrites it + Element a1(a); + return Add(a1, Inverse(b)); +} + +template T& AbstractGroup::Accumulate(Element &a, const Element &b) const +{ + return a = Add(a, b); +} + +template T& AbstractGroup::Reduce(Element &a, const Element &b) const +{ + return a = Subtract(a, b); +} + +template const T& AbstractRing::Square(const Element &a) const +{ + return Multiply(a, a); +} + +template const T& AbstractRing::Divide(const Element &a, const Element &b) const +{ + // make copy of a in case MultiplicativeInverse() overwrites it + Element a1(a); + return Multiply(a1, MultiplicativeInverse(b)); +} + +template const T& AbstractEuclideanDomain::Mod(const Element &a, const Element &b) const +{ + Element q; + DivisionAlgorithm(result, q, a, b); + return result; +} + +template const T& AbstractEuclideanDomain::Gcd(const Element &a, const Element &b) const +{ + Element g[3]={b, a}; + unsigned int i0=0, i1=1, i2=2; + + while (!Equal(g[i1], this->Identity())) + { + g[i2] = Mod(g[i0], g[i1]); + unsigned int t = i0; i0 = i1; i1 = i2; i2 = t; + } + + return result = g[i0]; +} + +template const typename QuotientRing::Element& QuotientRing::MultiplicativeInverse(const Element &a) const +{ + Element g[3]={m_modulus, a}; + Element v[3]={m_domain.Identity(), m_domain.MultiplicativeIdentity()}; + Element y; + unsigned int i0=0, i1=1, i2=2; + + while (!Equal(g[i1], Identity())) + { + // y = g[i0] / g[i1]; + // g[i2] = g[i0] % g[i1]; + m_domain.DivisionAlgorithm(g[i2], y, g[i0], g[i1]); + // v[i2] = v[i0] - (v[i1] * y); + v[i2] = m_domain.Subtract(v[i0], m_domain.Multiply(v[i1], y)); + unsigned int t = i0; i0 = i1; i1 = i2; i2 = t; + } + + return m_domain.IsUnit(g[i0]) ? m_domain.Divide(v[i0], g[i0]) : m_domain.Identity(); +} + +template T AbstractGroup::ScalarMultiply(const Element &base, const Integer &exponent) const +{ + Element result; + SimultaneousMultiply(&result, base, &exponent, 1); + return result; +} + +template T AbstractGroup::CascadeScalarMultiply(const Element &x, const Integer &e1, const Element &y, const Integer &e2) const +{ + const unsigned expLen = STDMAX(e1.BitCount(), e2.BitCount()); + if (expLen==0) + return Identity(); + + const unsigned w = (expLen <= 46 ? 1 : (expLen <= 260 ? 2 : 3)); + const unsigned tableSize = 1< powerTable(tableSize << w); + + powerTable[1] = x; + powerTable[tableSize] = y; + if (w==1) + powerTable[3] = Add(x,y); + else + { + powerTable[2] = Double(x); + powerTable[2*tableSize] = Double(y); + + unsigned i, j; + + for (i=3; i=0; i--) + { + power1 = 2*power1 + e1.GetBit(i); + power2 = 2*power2 + e2.GetBit(i); + + if (i==0 || 2*power1 >= tableSize || 2*power2 >= tableSize) + { + unsigned squaresBefore = prevPosition-i; + unsigned squaresAfter = 0; + prevPosition = i; + while ((power1 || power2) && power1%2 == 0 && power2%2==0) + { + power1 /= 2; + power2 /= 2; + squaresBefore--; + squaresAfter++; + } + if (firstTime) + { + result = powerTable[(power2< Element GeneralCascadeMultiplication(const AbstractGroup &group, Iterator begin, Iterator end) +{ + if (end-begin == 1) + return group.ScalarMultiply(begin->base, begin->exponent); + else if (end-begin == 2) + return group.CascadeScalarMultiply(begin->base, begin->exponent, (begin+1)->base, (begin+1)->exponent); + else + { + Integer q, t; + Iterator last = end; + --last; + + std::make_heap(begin, end); + std::pop_heap(begin, end); + + while (!!begin->exponent) + { + // last->exponent is largest exponent, begin->exponent is next largest + t = last->exponent; + Integer::Divide(last->exponent, q, t, begin->exponent); + + if (q == Integer::One()) + group.Accumulate(begin->base, last->base); // avoid overhead of ScalarMultiply() + else + group.Accumulate(begin->base, group.ScalarMultiply(last->base, q)); + + std::push_heap(begin, end); + std::pop_heap(begin, end); + } + + return group.ScalarMultiply(last->base, last->exponent); + } +} + +struct WindowSlider +{ + WindowSlider(const Integer &expIn, bool fastNegate, unsigned int windowSizeIn=0) + : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn), windowBegin(0), fastNegate(fastNegate), firstTime(true), finished(false) + { + if (windowSize == 0) + { + unsigned int expLen = exp.BitCount(); + windowSize = expLen <= 17 ? 1 : (expLen <= 24 ? 2 : (expLen <= 70 ? 3 : (expLen <= 197 ? 4 : (expLen <= 539 ? 5 : (expLen <= 1434 ? 6 : 7))))); + } + windowModulus <<= windowSize; + } + + void FindNextWindow() + { + unsigned int expLen = exp.WordCount() * WORD_BITS; + unsigned int skipCount = firstTime ? 0 : windowSize; + firstTime = false; + while (!exp.GetBit(skipCount)) + { + if (skipCount >= expLen) + { + finished = true; + return; + } + skipCount++; + } + + exp >>= skipCount; + windowBegin += skipCount; + expWindow = word32(exp % (word(1) << windowSize)); + + if (fastNegate && exp.GetBit(windowSize)) + { + negateNext = true; + expWindow = (word32(1) << windowSize) - expWindow; + exp += windowModulus; + } + else + negateNext = false; + } + + Integer exp, windowModulus; + unsigned int windowSize, windowBegin; + word32 expWindow; + bool fastNegate, negateNext, firstTime, finished; +}; + +template +void AbstractGroup::SimultaneousMultiply(T *results, const T &base, const Integer *expBegin, unsigned int expCount) const +{ + std::vector > buckets(expCount); + std::vector exponents; + exponents.reserve(expCount); + unsigned int i; + + for (i=0; iNotNegative()); + exponents.push_back(WindowSlider(*expBegin++, InversionIsFast(), 0)); + exponents[i].FindNextWindow(); + buckets[i].resize(1<<(exponents[i].windowSize-1), Identity()); + } + + unsigned int expBitPosition = 0; + Element g = base; + bool notDone = true; + + while (notDone) + { + notDone = false; + for (i=0; i 1) + { + for (int j = (int)buckets[i].size()-2; j >= 1; j--) + { + Accumulate(buckets[i][j], buckets[i][j+1]); + Accumulate(r, buckets[i][j]); + } + Accumulate(buckets[i][0], buckets[i][1]); + r = Add(Double(r), buckets[i][0]); + } + } +} + +template T AbstractRing::Exponentiate(const Element &base, const Integer &exponent) const +{ + Element result; + SimultaneousExponentiate(&result, base, &exponent, 1); + return result; +} + +template T AbstractRing::CascadeExponentiate(const Element &x, const Integer &e1, const Element &y, const Integer &e2) const +{ + return MultiplicativeGroup().AbstractGroup::CascadeScalarMultiply(x, e1, y, e2); +} + +template Element GeneralCascadeExponentiation(const AbstractRing &ring, Iterator begin, Iterator end) +{ + return GeneralCascadeMultiplication(ring.MultiplicativeGroup(), begin, end); +} + +template +void AbstractRing::SimultaneousExponentiate(T *results, const T &base, const Integer *exponents, unsigned int expCount) const +{ + MultiplicativeGroup().AbstractGroup::SimultaneousMultiply(results, base, exponents, expCount); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/algebra.h b/cryptopp/algebra.h new file mode 100644 index 0000000..13038bd --- /dev/null +++ b/cryptopp/algebra.h @@ -0,0 +1,285 @@ +#ifndef CRYPTOPP_ALGEBRA_H +#define CRYPTOPP_ALGEBRA_H + +#include "config.h" + +NAMESPACE_BEGIN(CryptoPP) + +class Integer; + +// "const Element&" returned by member functions are references +// to internal data members. Since each object may have only +// one such data member for holding results, the following code +// will produce incorrect results: +// abcd = group.Add(group.Add(a,b), group.Add(c,d)); +// But this should be fine: +// abcd = group.Add(a, group.Add(b, group.Add(c,d)); + +//! Abstract Group +template class CRYPTOPP_NO_VTABLE AbstractGroup +{ +public: + typedef T Element; + + virtual ~AbstractGroup() {} + + virtual bool Equal(const Element &a, const Element &b) const =0; + virtual const Element& Identity() const =0; + virtual const Element& Add(const Element &a, const Element &b) const =0; + virtual const Element& Inverse(const Element &a) const =0; + virtual bool InversionIsFast() const {return false;} + + virtual const Element& Double(const Element &a) const; + virtual const Element& Subtract(const Element &a, const Element &b) const; + virtual Element& Accumulate(Element &a, const Element &b) const; + virtual Element& Reduce(Element &a, const Element &b) const; + + virtual Element ScalarMultiply(const Element &a, const Integer &e) const; + virtual Element CascadeScalarMultiply(const Element &x, const Integer &e1, const Element &y, const Integer &e2) const; + + virtual void SimultaneousMultiply(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const; +}; + +//! Abstract Ring +template class CRYPTOPP_NO_VTABLE AbstractRing : public AbstractGroup +{ +public: + typedef T Element; + + AbstractRing() {m_mg.m_pRing = this;} + AbstractRing(const AbstractRing &source) {m_mg.m_pRing = this;} + AbstractRing& operator=(const AbstractRing &source) {return *this;} + + virtual bool IsUnit(const Element &a) const =0; + virtual const Element& MultiplicativeIdentity() const =0; + virtual const Element& Multiply(const Element &a, const Element &b) const =0; + virtual const Element& MultiplicativeInverse(const Element &a) const =0; + + virtual const Element& Square(const Element &a) const; + virtual const Element& Divide(const Element &a, const Element &b) const; + + virtual Element Exponentiate(const Element &a, const Integer &e) const; + virtual Element CascadeExponentiate(const Element &x, const Integer &e1, const Element &y, const Integer &e2) const; + + virtual void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const; + + virtual const AbstractGroup& MultiplicativeGroup() const + {return m_mg;} + +private: + class MultiplicativeGroupT : public AbstractGroup + { + public: + const AbstractRing& GetRing() const + {return *m_pRing;} + + bool Equal(const Element &a, const Element &b) const + {return GetRing().Equal(a, b);} + + const Element& Identity() const + {return GetRing().MultiplicativeIdentity();} + + const Element& Add(const Element &a, const Element &b) const + {return GetRing().Multiply(a, b);} + + Element& Accumulate(Element &a, const Element &b) const + {return a = GetRing().Multiply(a, b);} + + const Element& Inverse(const Element &a) const + {return GetRing().MultiplicativeInverse(a);} + + const Element& Subtract(const Element &a, const Element &b) const + {return GetRing().Divide(a, b);} + + Element& Reduce(Element &a, const Element &b) const + {return a = GetRing().Divide(a, b);} + + const Element& Double(const Element &a) const + {return GetRing().Square(a);} + + Element ScalarMultiply(const Element &a, const Integer &e) const + {return GetRing().Exponentiate(a, e);} + + Element CascadeScalarMultiply(const Element &x, const Integer &e1, const Element &y, const Integer &e2) const + {return GetRing().CascadeExponentiate(x, e1, y, e2);} + + void SimultaneousMultiply(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const + {GetRing().SimultaneousExponentiate(results, base, exponents, exponentsCount);} + + const AbstractRing *m_pRing; + }; + + MultiplicativeGroupT m_mg; +}; + +// ******************************************************** + +//! Base and Exponent +template +struct BaseAndExponent +{ +public: + BaseAndExponent() {} + BaseAndExponent(const T &base, const E &exponent) : base(base), exponent(exponent) {} + bool operator<(const BaseAndExponent &rhs) const {return exponent < rhs.exponent;} + T base; + E exponent; +}; + +// VC60 workaround: incomplete member template support +template + Element GeneralCascadeMultiplication(const AbstractGroup &group, Iterator begin, Iterator end); +template + Element GeneralCascadeExponentiation(const AbstractRing &ring, Iterator begin, Iterator end); + +// ******************************************************** + +//! Abstract Euclidean Domain +template class CRYPTOPP_NO_VTABLE AbstractEuclideanDomain : public AbstractRing +{ +public: + typedef T Element; + + virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a, const Element &d) const =0; + + virtual const Element& Mod(const Element &a, const Element &b) const =0; + virtual const Element& Gcd(const Element &a, const Element &b) const; + +protected: + mutable Element result; +}; + +// ******************************************************** + +//! EuclideanDomainOf +template class EuclideanDomainOf : public AbstractEuclideanDomain +{ +public: + typedef T Element; + + EuclideanDomainOf() {} + + bool Equal(const Element &a, const Element &b) const + {return a==b;} + + const Element& Identity() const + {return Element::Zero();} + + const Element& Add(const Element &a, const Element &b) const + {return result = a+b;} + + Element& Accumulate(Element &a, const Element &b) const + {return a+=b;} + + const Element& Inverse(const Element &a) const + {return result = -a;} + + const Element& Subtract(const Element &a, const Element &b) const + {return result = a-b;} + + Element& Reduce(Element &a, const Element &b) const + {return a-=b;} + + const Element& Double(const Element &a) const + {return result = a.Doubled();} + + const Element& MultiplicativeIdentity() const + {return Element::One();} + + const Element& Multiply(const Element &a, const Element &b) const + {return result = a*b;} + + const Element& Square(const Element &a) const + {return result = a.Squared();} + + bool IsUnit(const Element &a) const + {return a.IsUnit();} + + const Element& MultiplicativeInverse(const Element &a) const + {return result = a.MultiplicativeInverse();} + + const Element& Divide(const Element &a, const Element &b) const + {return result = a/b;} + + const Element& Mod(const Element &a, const Element &b) const + {return result = a%b;} + + void DivisionAlgorithm(Element &r, Element &q, const Element &a, const Element &d) const + {Element::Divide(r, q, a, d);} + + bool operator==(const EuclideanDomainOf &rhs) const + {return true;} + +private: + mutable Element result; +}; + +//! Quotient Ring +template class QuotientRing : public AbstractRing +{ +public: + typedef T EuclideanDomain; + typedef typename T::Element Element; + + QuotientRing(const EuclideanDomain &domain, const Element &modulus) + : m_domain(domain), m_modulus(modulus) {} + + const EuclideanDomain & GetDomain() const + {return m_domain;} + + const Element& GetModulus() const + {return m_modulus;} + + bool Equal(const Element &a, const Element &b) const + {return m_domain.Equal(m_domain.Mod(m_domain.Subtract(a, b), m_modulus), m_domain.Identity());} + + const Element& Identity() const + {return m_domain.Identity();} + + const Element& Add(const Element &a, const Element &b) const + {return m_domain.Add(a, b);} + + Element& Accumulate(Element &a, const Element &b) const + {return m_domain.Accumulate(a, b);} + + const Element& Inverse(const Element &a) const + {return m_domain.Inverse(a);} + + const Element& Subtract(const Element &a, const Element &b) const + {return m_domain.Subtract(a, b);} + + Element& Reduce(Element &a, const Element &b) const + {return m_domain.Reduce(a, b);} + + const Element& Double(const Element &a) const + {return m_domain.Double(a);} + + bool IsUnit(const Element &a) const + {return m_domain.IsUnit(m_domain.Gcd(a, m_modulus));} + + const Element& MultiplicativeIdentity() const + {return m_domain.MultiplicativeIdentity();} + + const Element& Multiply(const Element &a, const Element &b) const + {return m_domain.Mod(m_domain.Multiply(a, b), m_modulus);} + + const Element& Square(const Element &a) const + {return m_domain.Mod(m_domain.Square(a), m_modulus);} + + const Element& MultiplicativeInverse(const Element &a) const; + + bool operator==(const QuotientRing &rhs) const + {return m_domain == rhs.m_domain && m_modulus == rhs.m_modulus;} + +protected: + EuclideanDomain m_domain; + Element m_modulus; +}; + +NAMESPACE_END + +#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#include "algebra.cpp" +#endif + +#endif diff --git a/cryptopp/algparam.cpp b/cryptopp/algparam.cpp new file mode 100644 index 0000000..a70d5dd --- /dev/null +++ b/cryptopp/algparam.cpp @@ -0,0 +1,75 @@ +// algparam.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "algparam.h" + +NAMESPACE_BEGIN(CryptoPP) + +PAssignIntToInteger g_pAssignIntToInteger = NULL; + +bool CombinedNameValuePairs::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + if (strcmp(name, "ValueNames") == 0) + return m_pairs1.GetVoidValue(name, valueType, pValue) && m_pairs2.GetVoidValue(name, valueType, pValue); + else + return m_pairs1.GetVoidValue(name, valueType, pValue) || m_pairs2.GetVoidValue(name, valueType, pValue); +} + +void AlgorithmParametersBase::operator=(const AlgorithmParametersBase& rhs) +{ + assert(false); +} + +bool AlgorithmParametersBase::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + if (strcmp(name, "ValueNames") == 0) + { + NameValuePairs::ThrowIfTypeMismatch(name, typeid(std::string), valueType); + if (m_next.get()) + m_next->GetVoidValue(name, valueType, pValue); + (*reinterpret_cast(pValue) += m_name) += ";"; + return true; + } + else if (strcmp(name, m_name) == 0) + { + AssignValue(name, valueType, pValue); + m_used = true; + return true; + } + else if (m_next.get()) + return m_next->GetVoidValue(name, valueType, pValue); + else + return false; +} + +AlgorithmParameters::AlgorithmParameters() + : m_defaultThrowIfNotUsed(true) +{ +} + +AlgorithmParameters::AlgorithmParameters(const AlgorithmParameters &x) + : m_defaultThrowIfNotUsed(x.m_defaultThrowIfNotUsed) +{ + m_next.reset(const_cast(x).m_next.release()); +} + +AlgorithmParameters & AlgorithmParameters::operator=(const AlgorithmParameters &x) +{ + m_next.reset(const_cast(x).m_next.release()); + return *this; +} + +bool AlgorithmParameters::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + if (m_next.get()) + return m_next->GetVoidValue(name, valueType, pValue); + else + return false; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/algparam.h b/cryptopp/algparam.h new file mode 100644 index 0000000..ea5129c --- /dev/null +++ b/cryptopp/algparam.h @@ -0,0 +1,398 @@ +#ifndef CRYPTOPP_ALGPARAM_H +#define CRYPTOPP_ALGPARAM_H + +#include "cryptlib.h" +#include "smartptr.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! used to pass byte array input as part of a NameValuePairs object +/*! the deepCopy option is used when the NameValuePairs object can't + keep a copy of the data available */ +class ConstByteArrayParameter +{ +public: + ConstByteArrayParameter(const char *data = NULL, bool deepCopy = false) + { + Assign((const byte *)data, data ? strlen(data) : 0, deepCopy); + } + ConstByteArrayParameter(const byte *data, size_t size, bool deepCopy = false) + { + Assign(data, size, deepCopy); + } + template ConstByteArrayParameter(const T &string, bool deepCopy = false) + { + CRYPTOPP_COMPILE_ASSERT(sizeof(CPP_TYPENAME T::value_type) == 1); + Assign((const byte *)string.data(), string.size(), deepCopy); + } + + void Assign(const byte *data, size_t size, bool deepCopy) + { + if (deepCopy) + m_block.Assign(data, size); + else + { + m_data = data; + m_size = size; + } + m_deepCopy = deepCopy; + } + + const byte *begin() const {return m_deepCopy ? m_block.begin() : m_data;} + const byte *end() const {return m_deepCopy ? m_block.end() : m_data + m_size;} + size_t size() const {return m_deepCopy ? m_block.size() : m_size;} + +private: + bool m_deepCopy; + const byte *m_data; + size_t m_size; + SecByteBlock m_block; +}; + +class ByteArrayParameter +{ +public: + ByteArrayParameter(byte *data = NULL, unsigned int size = 0) + : m_data(data), m_size(size) {} + ByteArrayParameter(SecByteBlock &block) + : m_data(block.begin()), m_size(block.size()) {} + + byte *begin() const {return m_data;} + byte *end() const {return m_data + m_size;} + size_t size() const {return m_size;} + +private: + byte *m_data; + size_t m_size; +}; + +class CRYPTOPP_DLL CombinedNameValuePairs : public NameValuePairs +{ +public: + CombinedNameValuePairs(const NameValuePairs &pairs1, const NameValuePairs &pairs2) + : m_pairs1(pairs1), m_pairs2(pairs2) {} + + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + +private: + const NameValuePairs &m_pairs1, &m_pairs2; +}; + +template +class GetValueHelperClass +{ +public: + GetValueHelperClass(const T *pObject, const char *name, const std::type_info &valueType, void *pValue, const NameValuePairs *searchFirst) + : m_pObject(pObject), m_name(name), m_valueType(&valueType), m_pValue(pValue), m_found(false), m_getValueNames(false) + { + if (strcmp(m_name, "ValueNames") == 0) + { + m_found = m_getValueNames = true; + NameValuePairs::ThrowIfTypeMismatch(m_name, typeid(std::string), *m_valueType); + if (searchFirst) + searchFirst->GetVoidValue(m_name, valueType, pValue); + if (typeid(T) != typeid(BASE)) + pObject->BASE::GetVoidValue(m_name, valueType, pValue); + ((*reinterpret_cast(m_pValue) += "ThisPointer:") += typeid(T).name()) += ';'; + } + + if (!m_found && strncmp(m_name, "ThisPointer:", 12) == 0 && strcmp(m_name+12, typeid(T).name()) == 0) + { + NameValuePairs::ThrowIfTypeMismatch(m_name, typeid(T *), *m_valueType); + *reinterpret_cast(pValue) = pObject; + m_found = true; + return; + } + + if (!m_found && searchFirst) + m_found = searchFirst->GetVoidValue(m_name, valueType, pValue); + + if (!m_found && typeid(T) != typeid(BASE)) + m_found = pObject->BASE::GetVoidValue(m_name, valueType, pValue); + } + + operator bool() const {return m_found;} + + template + GetValueHelperClass & operator()(const char *name, const R & (T::*pm)() const) + { + if (m_getValueNames) + (*reinterpret_cast(m_pValue) += name) += ";"; + if (!m_found && strcmp(name, m_name) == 0) + { + NameValuePairs::ThrowIfTypeMismatch(name, typeid(R), *m_valueType); + *reinterpret_cast(m_pValue) = (m_pObject->*pm)(); + m_found = true; + } + return *this; + } + + GetValueHelperClass &Assignable() + { +#ifndef __INTEL_COMPILER // ICL 9.1 workaround: Intel compiler copies the vTable pointer for some reason + if (m_getValueNames) + ((*reinterpret_cast(m_pValue) += "ThisObject:") += typeid(T).name()) += ';'; + if (!m_found && strncmp(m_name, "ThisObject:", 11) == 0 && strcmp(m_name+11, typeid(T).name()) == 0) + { + NameValuePairs::ThrowIfTypeMismatch(m_name, typeid(T), *m_valueType); + *reinterpret_cast(m_pValue) = *m_pObject; + m_found = true; + } +#endif + return *this; + } + +private: + const T *m_pObject; + const char *m_name; + const std::type_info *m_valueType; + void *m_pValue; + bool m_found, m_getValueNames; +}; + +template +GetValueHelperClass GetValueHelper(const T *pObject, const char *name, const std::type_info &valueType, void *pValue, const NameValuePairs *searchFirst=NULL, BASE *dummy=NULL) +{ + return GetValueHelperClass(pObject, name, valueType, pValue, searchFirst); +} + +template +GetValueHelperClass GetValueHelper(const T *pObject, const char *name, const std::type_info &valueType, void *pValue, const NameValuePairs *searchFirst=NULL) +{ + return GetValueHelperClass(pObject, name, valueType, pValue, searchFirst); +} + +// ******************************************************** + +template +R Hack_DefaultValueFromConstReferenceType(const R &) +{ + return R(); +} + +template +bool Hack_GetValueIntoConstReference(const NameValuePairs &source, const char *name, const R &value) +{ + return source.GetValue(name, const_cast(value)); +} + +template +class AssignFromHelperClass +{ +public: + AssignFromHelperClass(T *pObject, const NameValuePairs &source) + : m_pObject(pObject), m_source(source), m_done(false) + { + if (source.GetThisObject(*pObject)) + m_done = true; + else if (typeid(BASE) != typeid(T)) + pObject->BASE::AssignFrom(source); + } + + template + AssignFromHelperClass & operator()(const char *name, void (T::*pm)(R)) // VC60 workaround: "const R &" here causes compiler error + { + if (!m_done) + { + R value = Hack_DefaultValueFromConstReferenceType(reinterpret_cast(*(int *)NULL)); + if (!Hack_GetValueIntoConstReference(m_source, name, value)) + throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name + "'"); + (m_pObject->*pm)(value); + } + return *this; + } + + template + AssignFromHelperClass & operator()(const char *name1, const char *name2, void (T::*pm)(R, S)) // VC60 workaround: "const R &" here causes compiler error + { + if (!m_done) + { + R value1 = Hack_DefaultValueFromConstReferenceType(reinterpret_cast(*(int *)NULL)); + if (!Hack_GetValueIntoConstReference(m_source, name1, value1)) + throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name1 + "'"); + S value2 = Hack_DefaultValueFromConstReferenceType(reinterpret_cast(*(int *)NULL)); + if (!Hack_GetValueIntoConstReference(m_source, name2, value2)) + throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name2 + "'"); + (m_pObject->*pm)(value1, value2); + } + return *this; + } + +private: + T *m_pObject; + const NameValuePairs &m_source; + bool m_done; +}; + +template +AssignFromHelperClass AssignFromHelper(T *pObject, const NameValuePairs &source, BASE *dummy=NULL) +{ + return AssignFromHelperClass(pObject, source); +} + +template +AssignFromHelperClass AssignFromHelper(T *pObject, const NameValuePairs &source) +{ + return AssignFromHelperClass(pObject, source); +} + +// ******************************************************** + +// to allow the linker to discard Integer code if not needed. +typedef bool (CRYPTOPP_API * PAssignIntToInteger)(const std::type_info &valueType, void *pInteger, const void *pInt); +CRYPTOPP_DLL extern PAssignIntToInteger g_pAssignIntToInteger; + +CRYPTOPP_DLL const std::type_info & CRYPTOPP_API IntegerTypeId(); + +class CRYPTOPP_DLL AlgorithmParametersBase +{ +public: + class ParameterNotUsed : public Exception + { + public: + ParameterNotUsed(const char *name) : Exception(OTHER_ERROR, std::string("AlgorithmParametersBase: parameter \"") + name + "\" not used") {} + }; + + // this is actually a move, not a copy + AlgorithmParametersBase(const AlgorithmParametersBase &x) + : m_name(x.m_name), m_throwIfNotUsed(x.m_throwIfNotUsed), m_used(x.m_used) + { + m_next.reset(const_cast(x).m_next.release()); + x.m_used = true; + } + + AlgorithmParametersBase(const char *name, bool throwIfNotUsed) + : m_name(name), m_throwIfNotUsed(throwIfNotUsed), m_used(false) {} + + virtual ~AlgorithmParametersBase() + { +#ifdef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE + if (!std::uncaught_exception()) +#else + try +#endif + { + if (m_throwIfNotUsed && !m_used) + throw ParameterNotUsed(m_name); + } +#ifndef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE + catch(...) + { + } +#endif + } + + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + +protected: + friend class AlgorithmParameters; + void operator=(const AlgorithmParametersBase& rhs); // assignment not allowed, declare this for VC60 + + virtual void AssignValue(const char *name, const std::type_info &valueType, void *pValue) const =0; + virtual void MoveInto(void *p) const =0; // not really const + + const char *m_name; + bool m_throwIfNotUsed; + mutable bool m_used; + member_ptr m_next; +}; + +template +class AlgorithmParametersTemplate : public AlgorithmParametersBase +{ +public: + AlgorithmParametersTemplate(const char *name, const T &value, bool throwIfNotUsed) + : AlgorithmParametersBase(name, throwIfNotUsed), m_value(value) + { + } + + void AssignValue(const char *name, const std::type_info &valueType, void *pValue) const + { + // special case for retrieving an Integer parameter when an int was passed in + if (!(g_pAssignIntToInteger != NULL && typeid(T) == typeid(int) && g_pAssignIntToInteger(valueType, pValue, &m_value))) + { + NameValuePairs::ThrowIfTypeMismatch(name, typeid(T), valueType); + *reinterpret_cast(pValue) = m_value; + } + } + + void MoveInto(void *buffer) const + { + AlgorithmParametersTemplate* p = new(buffer) AlgorithmParametersTemplate(*this); + } + +protected: + T m_value; +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate; +CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate; +CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate; + +class CRYPTOPP_DLL AlgorithmParameters : public NameValuePairs +{ +public: + AlgorithmParameters(); + +#ifdef __BORLANDC__ + template + AlgorithmParameters(const char *name, const T &value, bool throwIfNotUsed=true) + : m_next(new AlgorithmParametersTemplate(name, value, throwIfNotUsed)) + , m_defaultThrowIfNotUsed(throwIfNotUsed) + { + } +#endif + + AlgorithmParameters(const AlgorithmParameters &x); + + AlgorithmParameters & operator=(const AlgorithmParameters &x); + + template + AlgorithmParameters & operator()(const char *name, const T &value, bool throwIfNotUsed) + { + member_ptr p(new AlgorithmParametersTemplate(name, value, throwIfNotUsed)); + p->m_next.reset(m_next.release()); + m_next.reset(p.release()); + m_defaultThrowIfNotUsed = throwIfNotUsed; + return *this; + } + + template + AlgorithmParameters & operator()(const char *name, const T &value) + { + return operator()(name, value, m_defaultThrowIfNotUsed); + } + + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + +protected: + member_ptr m_next; + bool m_defaultThrowIfNotUsed; +}; + +//! Create an object that implements NameValuePairs for passing parameters +/*! \param throwIfNotUsed if true, the object will throw an exception if the value is not accessed + \note throwIfNotUsed is ignored if using a compiler that does not support std::uncaught_exception(), + such as MSVC 7.0 and earlier. + \note A NameValuePairs object containing an arbitrary number of name value pairs may be constructed by + repeatedly using operator() on the object returned by MakeParameters, for example: + AlgorithmParameters parameters = MakeParameters(name1, value1)(name2, value2)(name3, value3); +*/ +#ifdef __BORLANDC__ +typedef AlgorithmParameters MakeParameters; +#else +template +AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwIfNotUsed = true) +{ + return AlgorithmParameters()(name, value, throwIfNotUsed); +} +#endif + +#define CRYPTOPP_GET_FUNCTION_ENTRY(name) (Name::name(), &ThisClass::Get##name) +#define CRYPTOPP_SET_FUNCTION_ENTRY(name) (Name::name(), &ThisClass::Set##name) +#define CRYPTOPP_SET_FUNCTION_ENTRY2(name1, name2) (Name::name1(), Name::name2(), &ThisClass::Set##name1##And##name2) + +NAMESPACE_END + +#endif diff --git a/cryptopp/arc4.cpp b/cryptopp/arc4.cpp new file mode 100644 index 0000000..b5c2730 --- /dev/null +++ b/cryptopp/arc4.cpp @@ -0,0 +1,120 @@ +// arc4.cpp - written and placed in the public domain by Wei Dai + +// The ARC4 algorithm was first revealed in an anonymous email to the +// cypherpunks mailing list. This file originally contained some +// code copied from this email. The code has since been rewritten in order +// to clarify the copyright status of this file. It should now be +// completely in the public domain. + +#include "pch.h" +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 +#include "arc4.h" + +NAMESPACE_BEGIN(CryptoPP) +namespace Weak1 { + +void ARC4_TestInstantiations() +{ + ARC4 x; +} + +ARC4_Base::~ARC4_Base() +{ + m_x = m_y = 0; +} + +void ARC4_Base::UncheckedSetKey(const byte *key, unsigned int keyLen, const NameValuePairs ¶ms) +{ + AssertValidKeyLength(keyLen); + + m_x = 1; + m_y = 0; + + unsigned int i; + for (i=0; i<256; i++) + m_state[i] = i; + + unsigned int keyIndex = 0, stateIndex = 0; + for (i=0; i<256; i++) + { + unsigned int a = m_state[i]; + stateIndex += key[keyIndex] + a; + stateIndex &= 0xff; + m_state[i] = m_state[stateIndex]; + m_state[stateIndex] = a; + if (++keyIndex >= keyLen) + keyIndex = 0; + } + + int discardBytes = params.GetIntValueWithDefault("DiscardBytes", GetDefaultDiscardBytes()); + DiscardBytes(discardBytes); +} + +template +static inline unsigned int MakeByte(T &x, T &y, byte *s) +{ + unsigned int a = s[x]; + y = (y+a) & 0xff; + unsigned int b = s[y]; + s[x] = b; + s[y] = a; + x = (x+1) & 0xff; + return s[(a+b) & 0xff]; +} + +void ARC4_Base::GenerateBlock(byte *output, size_t size) +{ + while (size--) + *output++ = MakeByte(m_x, m_y, m_state); +} + +void ARC4_Base::ProcessData(byte *outString, const byte *inString, size_t length) +{ + if (length == 0) + return; + + byte *const s = m_state; + unsigned int x = m_x; + unsigned int y = m_y; + + if (inString == outString) + { + do + { + *outString++ ^= MakeByte(x, y, s); + } while (--length); + } + else + { + do + { + *outString++ = *inString++ ^ MakeByte(x, y, s); + } + while(--length); + } + + m_x = x; + m_y = y; +} + +void ARC4_Base::DiscardBytes(size_t length) +{ + if (length == 0) + return; + + byte *const s = m_state; + unsigned int x = m_x; + unsigned int y = m_y; + + do + { + MakeByte(x, y, s); + } + while(--length); + + m_x = x; + m_y = y; +} + +} +NAMESPACE_END diff --git a/cryptopp/arc4.h b/cryptopp/arc4.h new file mode 100644 index 0000000..9dcc92e --- /dev/null +++ b/cryptopp/arc4.h @@ -0,0 +1,71 @@ +#ifndef CRYPTOPP_ARC4_H +#define CRYPTOPP_ARC4_H + +#include "strciphr.h" + +NAMESPACE_BEGIN(CryptoPP) + +namespace Weak1 { + +//! _ +class CRYPTOPP_NO_VTABLE ARC4_Base : public VariableKeyLength<16, 1, 256>, public RandomNumberGenerator, public SymmetricCipher, public SymmetricCipherDocumentation +{ +public: + ~ARC4_Base(); + + static const char *StaticAlgorithmName() {return "ARC4";} + + void GenerateBlock(byte *output, size_t size); + void DiscardBytes(size_t n); + + void ProcessData(byte *outString, const byte *inString, size_t length); + + bool IsRandomAccess() const {return false;} + bool IsSelfInverting() const {return true;} + bool IsForwardTransformation() const {return true;} + + typedef SymmetricCipherFinal Encryption; + typedef SymmetricCipherFinal Decryption; + +protected: + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); + virtual unsigned int GetDefaultDiscardBytes() const {return 0;} + + FixedSizeSecBlock m_state; + byte m_x, m_y; +}; + +//! Alleged RC4 +DOCUMENTED_TYPEDEF(SymmetricCipherFinal, ARC4) + +//! _ +class CRYPTOPP_NO_VTABLE MARC4_Base : public ARC4_Base +{ +public: + static const char *StaticAlgorithmName() {return "MARC4";} + + typedef SymmetricCipherFinal Encryption; + typedef SymmetricCipherFinal Decryption; + +protected: + unsigned int GetDefaultDiscardBytes() const {return 256;} +}; + +//! Modified ARC4: it discards the first 256 bytes of keystream which may be weaker than the rest +DOCUMENTED_TYPEDEF(SymmetricCipherFinal, MARC4) + +} +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak +#else +using namespace Weak1; // import Weak1 into CryptoPP with warning +#ifdef __GNUC__ +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." +#else +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") +#endif +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/argnames.h b/cryptopp/argnames.h new file mode 100644 index 0000000..23add3c --- /dev/null +++ b/cryptopp/argnames.h @@ -0,0 +1,79 @@ +#ifndef CRYPTOPP_ARGNAMES_H +#define CRYPTOPP_ARGNAMES_H + +#include "cryptlib.h" + +NAMESPACE_BEGIN(CryptoPP) + +DOCUMENTED_NAMESPACE_BEGIN(Name) + +#define CRYPTOPP_DEFINE_NAME_STRING(name) inline const char *name() {return #name;} + +CRYPTOPP_DEFINE_NAME_STRING(ValueNames) //!< string, a list of value names with a semicolon (';') after each name +CRYPTOPP_DEFINE_NAME_STRING(Version) //!< int +CRYPTOPP_DEFINE_NAME_STRING(Seed) //!< ConstByteArrayParameter +CRYPTOPP_DEFINE_NAME_STRING(Key) //!< ConstByteArrayParameter +CRYPTOPP_DEFINE_NAME_STRING(IV) //!< ConstByteArrayParameter, also accepts const byte * for backwards compatibility +CRYPTOPP_DEFINE_NAME_STRING(StolenIV) //!< byte * +CRYPTOPP_DEFINE_NAME_STRING(Rounds) //!< int +CRYPTOPP_DEFINE_NAME_STRING(FeedbackSize) //!< int +CRYPTOPP_DEFINE_NAME_STRING(WordSize) //!< int, in bytes +CRYPTOPP_DEFINE_NAME_STRING(BlockSize) //!< int, in bytes +CRYPTOPP_DEFINE_NAME_STRING(EffectiveKeyLength) //!< int, in bits +CRYPTOPP_DEFINE_NAME_STRING(KeySize) //!< int, in bits +CRYPTOPP_DEFINE_NAME_STRING(ModulusSize) //!< int, in bits +CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrderSize) //!< int, in bits +CRYPTOPP_DEFINE_NAME_STRING(PrivateExponentSize)//!< int, in bits +CRYPTOPP_DEFINE_NAME_STRING(Modulus) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(PublicExponent) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(PrivateExponent) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(PublicElement) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrder) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(Cofactor) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(SubgroupGenerator) //!< Integer, ECP::Point, or EC2N::Point +CRYPTOPP_DEFINE_NAME_STRING(Curve) //!< ECP or EC2N +CRYPTOPP_DEFINE_NAME_STRING(GroupOID) //!< OID +CRYPTOPP_DEFINE_NAME_STRING(PointerToPrimeSelector) //!< const PrimeSelector * +CRYPTOPP_DEFINE_NAME_STRING(Prime1) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(Prime2) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(ModPrime1PrivateExponent) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(ModPrime2PrivateExponent) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(MultiplicativeInverseOfPrime2ModPrime1) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(QuadraticResidueModPrime1) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(QuadraticResidueModPrime2) //!< Integer +CRYPTOPP_DEFINE_NAME_STRING(PutMessage) //!< bool +CRYPTOPP_DEFINE_NAME_STRING(TruncatedDigestSize) //!< int +CRYPTOPP_DEFINE_NAME_STRING(BlockPaddingScheme) //!< StreamTransformationFilter::BlockPaddingScheme +CRYPTOPP_DEFINE_NAME_STRING(HashVerificationFilterFlags) //!< word32 +CRYPTOPP_DEFINE_NAME_STRING(AuthenticatedDecryptionFilterFlags) //!< word32 +CRYPTOPP_DEFINE_NAME_STRING(SignatureVerificationFilterFlags) //!< word32 +CRYPTOPP_DEFINE_NAME_STRING(InputBuffer) //!< ConstByteArrayParameter +CRYPTOPP_DEFINE_NAME_STRING(OutputBuffer) //!< ByteArrayParameter +CRYPTOPP_DEFINE_NAME_STRING(InputFileName) //!< const char * +CRYPTOPP_DEFINE_NAME_STRING(InputStreamPointer) //!< std::istream * +CRYPTOPP_DEFINE_NAME_STRING(InputBinaryMode) //!< bool +CRYPTOPP_DEFINE_NAME_STRING(OutputFileName) //!< const char * +CRYPTOPP_DEFINE_NAME_STRING(OutputStreamPointer) //!< std::ostream * +CRYPTOPP_DEFINE_NAME_STRING(OutputBinaryMode) //!< bool +CRYPTOPP_DEFINE_NAME_STRING(EncodingParameters) //!< ConstByteArrayParameter +CRYPTOPP_DEFINE_NAME_STRING(KeyDerivationParameters) //!< ConstByteArrayParameter +CRYPTOPP_DEFINE_NAME_STRING(Separator) //< ConstByteArrayParameter +CRYPTOPP_DEFINE_NAME_STRING(Terminator) //< ConstByteArrayParameter +CRYPTOPP_DEFINE_NAME_STRING(Uppercase) //< bool +CRYPTOPP_DEFINE_NAME_STRING(GroupSize) //< int +CRYPTOPP_DEFINE_NAME_STRING(Pad) //< bool +CRYPTOPP_DEFINE_NAME_STRING(PaddingByte) //< byte +CRYPTOPP_DEFINE_NAME_STRING(Log2Base) //< int +CRYPTOPP_DEFINE_NAME_STRING(EncodingLookupArray) //< const byte * +CRYPTOPP_DEFINE_NAME_STRING(DecodingLookupArray) //< const byte * +CRYPTOPP_DEFINE_NAME_STRING(InsertLineBreaks) //< bool +CRYPTOPP_DEFINE_NAME_STRING(MaxLineLength) //< int +CRYPTOPP_DEFINE_NAME_STRING(DigestSize) //!< int, in bytes +CRYPTOPP_DEFINE_NAME_STRING(L1KeyLength) //!< int, in bytes +CRYPTOPP_DEFINE_NAME_STRING(TableSize) //!< int, in bytes + +DOCUMENTED_NAMESPACE_END + +NAMESPACE_END + +#endif diff --git a/cryptopp/asn.cpp b/cryptopp/asn.cpp new file mode 100644 index 0000000..3ebbaf7 --- /dev/null +++ b/cryptopp/asn.cpp @@ -0,0 +1,595 @@ +// asn.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "asn.h" + +#include +#include + +NAMESPACE_BEGIN(CryptoPP) +USING_NAMESPACE(std) + +/// DER Length +size_t DERLengthEncode(BufferedTransformation &bt, lword length) +{ + size_t i=0; + if (length <= 0x7f) + { + bt.Put(byte(length)); + i++; + } + else + { + bt.Put(byte(BytePrecision(length) | 0x80)); + i++; + for (int j=BytePrecision(length); j; --j) + { + bt.Put(byte(length >> (j-1)*8)); + i++; + } + } + return i; +} + +bool BERLengthDecode(BufferedTransformation &bt, lword &length, bool &definiteLength) +{ + byte b; + + if (!bt.Get(b)) + return false; + + if (!(b & 0x80)) + { + definiteLength = true; + length = b; + } + else + { + unsigned int lengthBytes = b & 0x7f; + + if (lengthBytes == 0) + { + definiteLength = false; + return true; + } + + definiteLength = true; + length = 0; + while (lengthBytes--) + { + if (length >> (8*(sizeof(length)-1))) + BERDecodeError(); // length about to overflow + + if (!bt.Get(b)) + return false; + + length = (length << 8) | b; + } + } + return true; +} + +bool BERLengthDecode(BufferedTransformation &bt, size_t &length) +{ + lword lw; + bool definiteLength; + if (!BERLengthDecode(bt, lw, definiteLength)) + BERDecodeError(); + if (!SafeConvert(lw, length)) + BERDecodeError(); + return definiteLength; +} + +void DEREncodeNull(BufferedTransformation &out) +{ + out.Put(TAG_NULL); + out.Put(0); +} + +void BERDecodeNull(BufferedTransformation &in) +{ + byte b; + if (!in.Get(b) || b != TAG_NULL) + BERDecodeError(); + size_t length; + if (!BERLengthDecode(in, length) || length != 0) + BERDecodeError(); +} + +/// ASN Strings +size_t DEREncodeOctetString(BufferedTransformation &bt, const byte *str, size_t strLen) +{ + bt.Put(OCTET_STRING); + size_t lengthBytes = DERLengthEncode(bt, strLen); + bt.Put(str, strLen); + return 1+lengthBytes+strLen; +} + +size_t DEREncodeOctetString(BufferedTransformation &bt, const SecByteBlock &str) +{ + return DEREncodeOctetString(bt, str.begin(), str.size()); +} + +size_t BERDecodeOctetString(BufferedTransformation &bt, SecByteBlock &str) +{ + byte b; + if (!bt.Get(b) || b != OCTET_STRING) + BERDecodeError(); + + size_t bc; + if (!BERLengthDecode(bt, bc)) + BERDecodeError(); + + str.resize(bc); + if (bc != bt.Get(str, bc)) + BERDecodeError(); + return bc; +} + +size_t BERDecodeOctetString(BufferedTransformation &bt, BufferedTransformation &str) +{ + byte b; + if (!bt.Get(b) || b != OCTET_STRING) + BERDecodeError(); + + size_t bc; + if (!BERLengthDecode(bt, bc)) + BERDecodeError(); + + bt.TransferTo(str, bc); + return bc; +} + +size_t DEREncodeTextString(BufferedTransformation &bt, const std::string &str, byte asnTag) +{ + bt.Put(asnTag); + size_t lengthBytes = DERLengthEncode(bt, str.size()); + bt.Put((const byte *)str.data(), str.size()); + return 1+lengthBytes+str.size(); +} + +size_t BERDecodeTextString(BufferedTransformation &bt, std::string &str, byte asnTag) +{ + byte b; + if (!bt.Get(b) || b != asnTag) + BERDecodeError(); + + size_t bc; + if (!BERLengthDecode(bt, bc)) + BERDecodeError(); + + SecByteBlock temp(bc); + if (bc != bt.Get(temp, bc)) + BERDecodeError(); + str.assign((char *)temp.begin(), bc); + return bc; +} + +/// ASN BitString +size_t DEREncodeBitString(BufferedTransformation &bt, const byte *str, size_t strLen, unsigned int unusedBits) +{ + bt.Put(BIT_STRING); + size_t lengthBytes = DERLengthEncode(bt, strLen+1); + bt.Put((byte)unusedBits); + bt.Put(str, strLen); + return 2+lengthBytes+strLen; +} + +size_t BERDecodeBitString(BufferedTransformation &bt, SecByteBlock &str, unsigned int &unusedBits) +{ + byte b; + if (!bt.Get(b) || b != BIT_STRING) + BERDecodeError(); + + size_t bc; + if (!BERLengthDecode(bt, bc)) + BERDecodeError(); + + byte unused; + if (!bt.Get(unused)) + BERDecodeError(); + unusedBits = unused; + str.resize(bc-1); + if ((bc-1) != bt.Get(str, bc-1)) + BERDecodeError(); + return bc-1; +} + +void DERReencode(BufferedTransformation &source, BufferedTransformation &dest) +{ + byte tag; + source.Peek(tag); + BERGeneralDecoder decoder(source, tag); + DERGeneralEncoder encoder(dest, tag); + if (decoder.IsDefiniteLength()) + decoder.TransferTo(encoder, decoder.RemainingLength()); + else + { + while (!decoder.EndReached()) + DERReencode(decoder, encoder); + } + decoder.MessageEnd(); + encoder.MessageEnd(); +} + +void OID::EncodeValue(BufferedTransformation &bt, word32 v) +{ + for (unsigned int i=RoundUpToMultipleOf(STDMAX(7U,BitPrecision(v)), 7U)-7; i != 0; i-=7) + bt.Put((byte)(0x80 | ((v >> i) & 0x7f))); + bt.Put((byte)(v & 0x7f)); +} + +size_t OID::DecodeValue(BufferedTransformation &bt, word32 &v) +{ + byte b; + size_t i=0; + v = 0; + while (true) + { + if (!bt.Get(b)) + BERDecodeError(); + i++; + v <<= 7; + v += b & 0x7f; + if (!(b & 0x80)) + return i; + } +} + +void OID::DEREncode(BufferedTransformation &bt) const +{ + assert(m_values.size() >= 2); + ByteQueue temp; + temp.Put(byte(m_values[0] * 40 + m_values[1])); + for (size_t i=2; i 0) + { + word32 v; + size_t valueLen = DecodeValue(bt, v); + if (valueLen > length) + BERDecodeError(); + m_values.push_back(v); + length -= valueLen; + } +} + +void OID::BERDecodeAndCheck(BufferedTransformation &bt) const +{ + OID oid(bt); + if (*this != oid) + BERDecodeError(); +} + +inline BufferedTransformation & EncodedObjectFilter::CurrentTarget() +{ + if (m_flags & PUT_OBJECTS) + return *AttachedTransformation(); + else + return TheBitBucket(); +} + +void EncodedObjectFilter::Put(const byte *inString, size_t length) +{ + if (m_nCurrentObject == m_nObjects) + { + AttachedTransformation()->Put(inString, length); + return; + } + + LazyPutter lazyPutter(m_queue, inString, length); + + while (m_queue.AnyRetrievable()) + { + switch (m_state) + { + case IDENTIFIER: + if (!m_queue.Get(m_id)) + return; + m_queue.TransferTo(CurrentTarget(), 1); + m_state = LENGTH; // fall through + case LENGTH: + { + byte b; + if (m_level > 0 && m_id == 0 && m_queue.Peek(b) && b == 0) + { + m_queue.TransferTo(CurrentTarget(), 1); + m_level--; + m_state = IDENTIFIER; + break; + } + ByteQueue::Walker walker(m_queue); + bool definiteLength; + if (!BERLengthDecode(walker, m_lengthRemaining, definiteLength)) + return; + m_queue.TransferTo(CurrentTarget(), walker.GetCurrentPosition()); + if (!((m_id & CONSTRUCTED) || definiteLength)) + BERDecodeError(); + if (!definiteLength) + { + if (!(m_id & CONSTRUCTED)) + BERDecodeError(); + m_level++; + m_state = IDENTIFIER; + break; + } + m_state = BODY; // fall through + } + case BODY: + m_lengthRemaining -= m_queue.TransferTo(CurrentTarget(), m_lengthRemaining); + + if (m_lengthRemaining == 0) + m_state = IDENTIFIER; + } + + if (m_state == IDENTIFIER && m_level == 0) + { + // just finished processing a level 0 object + ++m_nCurrentObject; + + if (m_flags & PUT_MESSANGE_END_AFTER_EACH_OBJECT) + AttachedTransformation()->MessageEnd(); + + if (m_nCurrentObject == m_nObjects) + { + if (m_flags & PUT_MESSANGE_END_AFTER_ALL_OBJECTS) + AttachedTransformation()->MessageEnd(); + + if (m_flags & PUT_MESSANGE_SERIES_END_AFTER_ALL_OBJECTS) + AttachedTransformation()->MessageSeriesEnd(); + + m_queue.TransferAllTo(*AttachedTransformation()); + return; + } + } + } +} + +BERGeneralDecoder::BERGeneralDecoder(BufferedTransformation &inQueue, byte asnTag) + : m_inQueue(inQueue), m_finished(false) +{ + Init(asnTag); +} + +BERGeneralDecoder::BERGeneralDecoder(BERGeneralDecoder &inQueue, byte asnTag) + : m_inQueue(inQueue), m_finished(false) +{ + Init(asnTag); +} + +void BERGeneralDecoder::Init(byte asnTag) +{ + byte b; + if (!m_inQueue.Get(b) || b != asnTag) + BERDecodeError(); + + if (!BERLengthDecode(m_inQueue, m_length, m_definiteLength)) + BERDecodeError(); + + if (!m_definiteLength && !(asnTag & CONSTRUCTED)) + BERDecodeError(); // cannot be primitive and have indefinite length +} + +BERGeneralDecoder::~BERGeneralDecoder() +{ + try // avoid throwing in constructor + { + if (!m_finished) + MessageEnd(); + } + catch (...) + { + } +} + +bool BERGeneralDecoder::EndReached() const +{ + if (m_definiteLength) + return m_length == 0; + else + { // check end-of-content octets + word16 i; + return (m_inQueue.PeekWord16(i)==2 && i==0); + } +} + +byte BERGeneralDecoder::PeekByte() const +{ + byte b; + if (!Peek(b)) + BERDecodeError(); + return b; +} + +void BERGeneralDecoder::CheckByte(byte check) +{ + byte b; + if (!Get(b) || b != check) + BERDecodeError(); +} + +void BERGeneralDecoder::MessageEnd() +{ + m_finished = true; + if (m_definiteLength) + { + if (m_length != 0) + BERDecodeError(); + } + else + { // remove end-of-content octets + word16 i; + if (m_inQueue.GetWord16(i) != 2 || i != 0) + BERDecodeError(); + } +} + +size_t BERGeneralDecoder::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking) +{ + if (m_definiteLength && transferBytes > m_length) + transferBytes = m_length; + size_t blockedBytes = m_inQueue.TransferTo2(target, transferBytes, channel, blocking); + ReduceLength(transferBytes); + return blockedBytes; +} + +size_t BERGeneralDecoder::CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end, const std::string &channel, bool blocking) const +{ + if (m_definiteLength) + end = STDMIN(m_length, end); + return m_inQueue.CopyRangeTo2(target, begin, end, channel, blocking); +} + +lword BERGeneralDecoder::ReduceLength(lword delta) +{ + if (m_definiteLength) + { + if (m_length < delta) + BERDecodeError(); + m_length -= delta; + } + return delta; +} + +DERGeneralEncoder::DERGeneralEncoder(BufferedTransformation &outQueue, byte asnTag) + : m_outQueue(outQueue), m_finished(false), m_asnTag(asnTag) +{ +} + +DERGeneralEncoder::DERGeneralEncoder(DERGeneralEncoder &outQueue, byte asnTag) + : m_outQueue(outQueue), m_finished(false), m_asnTag(asnTag) +{ +} + +DERGeneralEncoder::~DERGeneralEncoder() +{ + try // avoid throwing in constructor + { + if (!m_finished) + MessageEnd(); + } + catch (...) + { + } +} + +void DERGeneralEncoder::MessageEnd() +{ + m_finished = true; + lword length = CurrentSize(); + m_outQueue.Put(m_asnTag); + DERLengthEncode(m_outQueue, length); + TransferTo(m_outQueue); +} + +// ************************************************************* + +void X509PublicKey::BERDecode(BufferedTransformation &bt) +{ + BERSequenceDecoder subjectPublicKeyInfo(bt); + BERSequenceDecoder algorithm(subjectPublicKeyInfo); + GetAlgorithmID().BERDecodeAndCheck(algorithm); + bool parametersPresent = algorithm.EndReached() ? false : BERDecodeAlgorithmParameters(algorithm); + algorithm.MessageEnd(); + + BERGeneralDecoder subjectPublicKey(subjectPublicKeyInfo, BIT_STRING); + subjectPublicKey.CheckByte(0); // unused bits + BERDecodePublicKey(subjectPublicKey, parametersPresent, (size_t)subjectPublicKey.RemainingLength()); + subjectPublicKey.MessageEnd(); + subjectPublicKeyInfo.MessageEnd(); +} + +void X509PublicKey::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder subjectPublicKeyInfo(bt); + + DERSequenceEncoder algorithm(subjectPublicKeyInfo); + GetAlgorithmID().DEREncode(algorithm); + DEREncodeAlgorithmParameters(algorithm); + algorithm.MessageEnd(); + + DERGeneralEncoder subjectPublicKey(subjectPublicKeyInfo, BIT_STRING); + subjectPublicKey.Put(0); // unused bits + DEREncodePublicKey(subjectPublicKey); + subjectPublicKey.MessageEnd(); + + subjectPublicKeyInfo.MessageEnd(); +} + +void PKCS8PrivateKey::BERDecode(BufferedTransformation &bt) +{ + BERSequenceDecoder privateKeyInfo(bt); + word32 version; + BERDecodeUnsigned(privateKeyInfo, version, INTEGER, 0, 0); // check version + + BERSequenceDecoder algorithm(privateKeyInfo); + GetAlgorithmID().BERDecodeAndCheck(algorithm); + bool parametersPresent = algorithm.EndReached() ? false : BERDecodeAlgorithmParameters(algorithm); + algorithm.MessageEnd(); + + BERGeneralDecoder octetString(privateKeyInfo, OCTET_STRING); + BERDecodePrivateKey(octetString, parametersPresent, (size_t)privateKeyInfo.RemainingLength()); + octetString.MessageEnd(); + + if (!privateKeyInfo.EndReached()) + BERDecodeOptionalAttributes(privateKeyInfo); + privateKeyInfo.MessageEnd(); +} + +void PKCS8PrivateKey::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder privateKeyInfo(bt); + DEREncodeUnsigned(privateKeyInfo, 0); // version + + DERSequenceEncoder algorithm(privateKeyInfo); + GetAlgorithmID().DEREncode(algorithm); + DEREncodeAlgorithmParameters(algorithm); + algorithm.MessageEnd(); + + DERGeneralEncoder octetString(privateKeyInfo, OCTET_STRING); + DEREncodePrivateKey(octetString); + octetString.MessageEnd(); + + DEREncodeOptionalAttributes(privateKeyInfo); + privateKeyInfo.MessageEnd(); +} + +void PKCS8PrivateKey::BERDecodeOptionalAttributes(BufferedTransformation &bt) +{ + DERReencode(bt, m_optionalAttributes); +} + +void PKCS8PrivateKey::DEREncodeOptionalAttributes(BufferedTransformation &bt) const +{ + m_optionalAttributes.CopyTo(bt); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/asn.h b/cryptopp/asn.h new file mode 100644 index 0000000..c35126b --- /dev/null +++ b/cryptopp/asn.h @@ -0,0 +1,369 @@ +#ifndef CRYPTOPP_ASN_H +#define CRYPTOPP_ASN_H + +#include "filters.h" +#include "queue.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +// these tags and flags are not complete +enum ASNTag +{ + BOOLEAN = 0x01, + INTEGER = 0x02, + BIT_STRING = 0x03, + OCTET_STRING = 0x04, + TAG_NULL = 0x05, + OBJECT_IDENTIFIER = 0x06, + OBJECT_DESCRIPTOR = 0x07, + EXTERNAL = 0x08, + REAL = 0x09, + ENUMERATED = 0x0a, + UTF8_STRING = 0x0c, + SEQUENCE = 0x10, + SET = 0x11, + NUMERIC_STRING = 0x12, + PRINTABLE_STRING = 0x13, + T61_STRING = 0x14, + VIDEOTEXT_STRING = 0x15, + IA5_STRING = 0x16, + UTC_TIME = 0x17, + GENERALIZED_TIME = 0x18, + GRAPHIC_STRING = 0x19, + VISIBLE_STRING = 0x1a, + GENERAL_STRING = 0x1b +}; + +enum ASNIdFlag +{ + UNIVERSAL = 0x00, +// DATA = 0x01, +// HEADER = 0x02, + CONSTRUCTED = 0x20, + APPLICATION = 0x40, + CONTEXT_SPECIFIC = 0x80, + PRIVATE = 0xc0 +}; + +inline void BERDecodeError() {throw BERDecodeErr();} + +class CRYPTOPP_DLL UnknownOID : public BERDecodeErr +{ +public: + UnknownOID() : BERDecodeErr("BER decode error: unknown object identifier") {} + UnknownOID(const char *err) : BERDecodeErr(err) {} +}; + +// unsigned int DERLengthEncode(unsigned int length, byte *output=0); +CRYPTOPP_DLL size_t CRYPTOPP_API DERLengthEncode(BufferedTransformation &out, lword length); +// returns false if indefinite length +CRYPTOPP_DLL bool CRYPTOPP_API BERLengthDecode(BufferedTransformation &in, size_t &length); + +CRYPTOPP_DLL void CRYPTOPP_API DEREncodeNull(BufferedTransformation &out); +CRYPTOPP_DLL void CRYPTOPP_API BERDecodeNull(BufferedTransformation &in); + +CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeOctetString(BufferedTransformation &out, const byte *str, size_t strLen); +CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeOctetString(BufferedTransformation &out, const SecByteBlock &str); +CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeOctetString(BufferedTransformation &in, SecByteBlock &str); +CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeOctetString(BufferedTransformation &in, BufferedTransformation &str); + +// for UTF8_STRING, PRINTABLE_STRING, and IA5_STRING +CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeTextString(BufferedTransformation &out, const std::string &str, byte asnTag); +CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeTextString(BufferedTransformation &in, std::string &str, byte asnTag); + +CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeBitString(BufferedTransformation &out, const byte *str, size_t strLen, unsigned int unusedBits=0); +CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeBitString(BufferedTransformation &in, SecByteBlock &str, unsigned int &unusedBits); + +// BER decode from source and DER reencode into dest +CRYPTOPP_DLL void CRYPTOPP_API DERReencode(BufferedTransformation &source, BufferedTransformation &dest); + +//! Object Identifier +class CRYPTOPP_DLL OID +{ +public: + OID() {} + OID(word32 v) : m_values(1, v) {} + OID(BufferedTransformation &bt) {BERDecode(bt);} + + inline OID & operator+=(word32 rhs) {m_values.push_back(rhs); return *this;} + + void DEREncode(BufferedTransformation &bt) const; + void BERDecode(BufferedTransformation &bt); + + // throw BERDecodeErr() if decoded value doesn't equal this OID + void BERDecodeAndCheck(BufferedTransformation &bt) const; + + std::vector m_values; + +private: + static void EncodeValue(BufferedTransformation &bt, word32 v); + static size_t DecodeValue(BufferedTransformation &bt, word32 &v); +}; + +class EncodedObjectFilter : public Filter +{ +public: + enum Flag {PUT_OBJECTS=1, PUT_MESSANGE_END_AFTER_EACH_OBJECT=2, PUT_MESSANGE_END_AFTER_ALL_OBJECTS=4, PUT_MESSANGE_SERIES_END_AFTER_ALL_OBJECTS=8}; + EncodedObjectFilter(BufferedTransformation *attachment = NULL, unsigned int nObjects = 1, word32 flags = 0); + + void Put(const byte *inString, size_t length); + + unsigned int GetNumberOfCompletedObjects() const {return m_nCurrentObject;} + unsigned long GetPositionOfObject(unsigned int i) const {return m_positions[i];} + +private: + BufferedTransformation & CurrentTarget(); + + word32 m_flags; + unsigned int m_nObjects, m_nCurrentObject, m_level; + std::vector m_positions; + ByteQueue m_queue; + enum State {IDENTIFIER, LENGTH, BODY, TAIL, ALL_DONE} m_state; + byte m_id; + lword m_lengthRemaining; +}; + +//! BER General Decoder +class CRYPTOPP_DLL BERGeneralDecoder : public Store +{ +public: + explicit BERGeneralDecoder(BufferedTransformation &inQueue, byte asnTag); + explicit BERGeneralDecoder(BERGeneralDecoder &inQueue, byte asnTag); + ~BERGeneralDecoder(); + + bool IsDefiniteLength() const {return m_definiteLength;} + lword RemainingLength() const {assert(m_definiteLength); return m_length;} + bool EndReached() const; + byte PeekByte() const; + void CheckByte(byte b); + + size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const; + + // call this to denote end of sequence + void MessageEnd(); + +protected: + BufferedTransformation &m_inQueue; + bool m_finished, m_definiteLength; + lword m_length; + +private: + void Init(byte asnTag); + void StoreInitialize(const NameValuePairs ¶meters) {assert(false);} + lword ReduceLength(lword delta); +}; + +//! DER General Encoder +class CRYPTOPP_DLL DERGeneralEncoder : public ByteQueue +{ +public: + explicit DERGeneralEncoder(BufferedTransformation &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED); + explicit DERGeneralEncoder(DERGeneralEncoder &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED); + ~DERGeneralEncoder(); + + // call this to denote end of sequence + void MessageEnd(); + +private: + BufferedTransformation &m_outQueue; + bool m_finished; + + byte m_asnTag; +}; + +//! BER Sequence Decoder +class CRYPTOPP_DLL BERSequenceDecoder : public BERGeneralDecoder +{ +public: + explicit BERSequenceDecoder(BufferedTransformation &inQueue, byte asnTag = SEQUENCE | CONSTRUCTED) + : BERGeneralDecoder(inQueue, asnTag) {} + explicit BERSequenceDecoder(BERSequenceDecoder &inQueue, byte asnTag = SEQUENCE | CONSTRUCTED) + : BERGeneralDecoder(inQueue, asnTag) {} +}; + +//! DER Sequence Encoder +class CRYPTOPP_DLL DERSequenceEncoder : public DERGeneralEncoder +{ +public: + explicit DERSequenceEncoder(BufferedTransformation &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED) + : DERGeneralEncoder(outQueue, asnTag) {} + explicit DERSequenceEncoder(DERSequenceEncoder &outQueue, byte asnTag = SEQUENCE | CONSTRUCTED) + : DERGeneralEncoder(outQueue, asnTag) {} +}; + +//! BER Set Decoder +class CRYPTOPP_DLL BERSetDecoder : public BERGeneralDecoder +{ +public: + explicit BERSetDecoder(BufferedTransformation &inQueue, byte asnTag = SET | CONSTRUCTED) + : BERGeneralDecoder(inQueue, asnTag) {} + explicit BERSetDecoder(BERSetDecoder &inQueue, byte asnTag = SET | CONSTRUCTED) + : BERGeneralDecoder(inQueue, asnTag) {} +}; + +//! DER Set Encoder +class CRYPTOPP_DLL DERSetEncoder : public DERGeneralEncoder +{ +public: + explicit DERSetEncoder(BufferedTransformation &outQueue, byte asnTag = SET | CONSTRUCTED) + : DERGeneralEncoder(outQueue, asnTag) {} + explicit DERSetEncoder(DERSetEncoder &outQueue, byte asnTag = SET | CONSTRUCTED) + : DERGeneralEncoder(outQueue, asnTag) {} +}; + +template +class ASNOptional : public member_ptr +{ +public: + void BERDecode(BERSequenceDecoder &seqDecoder, byte tag, byte mask = ~CONSTRUCTED) + { + byte b; + if (seqDecoder.Peek(b) && (b & mask) == tag) + reset(new T(seqDecoder)); + } + void DEREncode(BufferedTransformation &out) + { + if (this->get() != NULL) + this->get()->DEREncode(out); + } +}; + +//! _ +template +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE ASN1CryptoMaterial : public ASN1Object, public BASE +{ +public: + void Save(BufferedTransformation &bt) const + {BEREncode(bt);} + void Load(BufferedTransformation &bt) + {BERDecode(bt);} +}; + +//! encodes/decodes subjectPublicKeyInfo +class CRYPTOPP_DLL X509PublicKey : public ASN1CryptoMaterial +{ +public: + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + virtual OID GetAlgorithmID() const =0; + virtual bool BERDecodeAlgorithmParameters(BufferedTransformation &bt) + {BERDecodeNull(bt); return false;} + virtual bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const + {DEREncodeNull(bt); return false;} // see RFC 2459, section 7.3.1 + + //! decode subjectPublicKey part of subjectPublicKeyInfo, without the BIT STRING header + virtual void BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size) =0; + //! encode subjectPublicKey part of subjectPublicKeyInfo, without the BIT STRING header + virtual void DEREncodePublicKey(BufferedTransformation &bt) const =0; +}; + +//! encodes/decodes privateKeyInfo +class CRYPTOPP_DLL PKCS8PrivateKey : public ASN1CryptoMaterial +{ +public: + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + virtual OID GetAlgorithmID() const =0; + virtual bool BERDecodeAlgorithmParameters(BufferedTransformation &bt) + {BERDecodeNull(bt); return false;} + virtual bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const + {DEREncodeNull(bt); return false;} // see RFC 2459, section 7.3.1 + + //! decode privateKey part of privateKeyInfo, without the OCTET STRING header + virtual void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size) =0; + //! encode privateKey part of privateKeyInfo, without the OCTET STRING header + virtual void DEREncodePrivateKey(BufferedTransformation &bt) const =0; + + //! decode optional attributes including context-specific tag + /*! /note default implementation stores attributes to be output in DEREncodeOptionalAttributes */ + virtual void BERDecodeOptionalAttributes(BufferedTransformation &bt); + //! encode optional attributes including context-specific tag + virtual void DEREncodeOptionalAttributes(BufferedTransformation &bt) const; + +protected: + ByteQueue m_optionalAttributes; +}; + +// ******************************************************** + +//! DER Encode Unsigned +/*! for INTEGER, BOOLEAN, and ENUM */ +template +size_t DEREncodeUnsigned(BufferedTransformation &out, T w, byte asnTag = INTEGER) +{ + byte buf[sizeof(w)+1]; + unsigned int bc; + if (asnTag == BOOLEAN) + { + buf[sizeof(w)] = w ? 0xff : 0; + bc = 1; + } + else + { + buf[0] = 0; + for (unsigned int i=0; i> (sizeof(w)-1-i)*8); + bc = sizeof(w); + while (bc > 1 && buf[sizeof(w)+1-bc] == 0) + --bc; + if (buf[sizeof(w)+1-bc] & 0x80) + ++bc; + } + out.Put(asnTag); + size_t lengthBytes = DERLengthEncode(out, bc); + out.Put(buf+sizeof(w)+1-bc, bc); + return 1+lengthBytes+bc; +} + +//! BER Decode Unsigned +// VC60 workaround: std::numeric_limits::max conflicts with MFC max macro +// CW41 workaround: std::numeric_limits::max causes a template error +template +void BERDecodeUnsigned(BufferedTransformation &in, T &w, byte asnTag = INTEGER, + T minValue = 0, T maxValue = 0xffffffff) +{ + byte b; + if (!in.Get(b) || b != asnTag) + BERDecodeError(); + + size_t bc; + BERLengthDecode(in, bc); + + SecByteBlock buf(bc); + + if (bc != in.Get(buf, bc)) + BERDecodeError(); + + const byte *ptr = buf; + while (bc > sizeof(w) && *ptr == 0) + { + bc--; + ptr++; + } + if (bc > sizeof(w)) + BERDecodeError(); + + w = 0; + for (unsigned int i=0; i maxValue) + BERDecodeError(); +} + +inline bool operator==(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs) + {return lhs.m_values == rhs.m_values;} +inline bool operator!=(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs) + {return lhs.m_values != rhs.m_values;} +inline bool operator<(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs) + {return std::lexicographical_compare(lhs.m_values.begin(), lhs.m_values.end(), rhs.m_values.begin(), rhs.m_values.end());} +inline ::CryptoPP::OID operator+(const ::CryptoPP::OID &lhs, unsigned long rhs) + {return ::CryptoPP::OID(lhs)+=rhs;} + +NAMESPACE_END + +#endif diff --git a/cryptopp/authenc.cpp b/cryptopp/authenc.cpp new file mode 100644 index 0000000..f93662e --- /dev/null +++ b/cryptopp/authenc.cpp @@ -0,0 +1,180 @@ +// authenc.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "authenc.h" + +NAMESPACE_BEGIN(CryptoPP) + +void AuthenticatedSymmetricCipherBase::AuthenticateData(const byte *input, size_t len) +{ + unsigned int blockSize = AuthenticationBlockSize(); + unsigned int &num = m_bufferedDataLength; + byte* data = m_buffer.begin(); + + if (num != 0) // process left over data + { + if (num+len >= blockSize) + { + memcpy(data+num, input, blockSize-num); + AuthenticateBlocks(data, blockSize); + input += (blockSize-num); + len -= (blockSize-num); + num = 0; + // drop through and do the rest + } + else + { + memcpy(data+num, input, len); + num += (unsigned int)len; + return; + } + } + + // now process the input data in blocks of blockSize bytes and save the leftovers to m_data + if (len >= blockSize) + { + size_t leftOver = AuthenticateBlocks(input, len); + input += (len - leftOver); + len = leftOver; + } + + memcpy(data, input, len); + num = (unsigned int)len; +} + +void AuthenticatedSymmetricCipherBase::SetKey(const byte *userKey, size_t keylength, const NameValuePairs ¶ms) +{ + m_bufferedDataLength = 0; + m_state = State_Start; + + SetKeyWithoutResync(userKey, keylength, params); + m_state = State_KeySet; + + size_t length; + const byte *iv = GetIVAndThrowIfInvalid(params, length); + if (iv) + Resynchronize(iv, (int)length); +} + +void AuthenticatedSymmetricCipherBase::Resynchronize(const byte *iv, int length) +{ + if (m_state < State_KeySet) + throw BadState(AlgorithmName(), "Resynchronize", "key is set"); + + m_bufferedDataLength = 0; + m_totalHeaderLength = m_totalMessageLength = m_totalFooterLength = 0; + m_state = State_KeySet; + + Resync(iv, this->ThrowIfInvalidIVLength(length)); + m_state = State_IVSet; +} + +void AuthenticatedSymmetricCipherBase::Update(const byte *input, size_t length) +{ + if (length == 0) + return; + + switch (m_state) + { + case State_Start: + case State_KeySet: + throw BadState(AlgorithmName(), "Update", "setting key and IV"); + case State_IVSet: + AuthenticateData(input, length); + m_totalHeaderLength += length; + break; + case State_AuthUntransformed: + case State_AuthTransformed: + AuthenticateLastConfidentialBlock(); + m_bufferedDataLength = 0; + m_state = State_AuthFooter; + // fall through + case State_AuthFooter: + AuthenticateData(input, length); + m_totalFooterLength += length; + break; + default: + assert(false); + } +} + +void AuthenticatedSymmetricCipherBase::ProcessData(byte *outString, const byte *inString, size_t length) +{ + m_totalMessageLength += length; + if (m_state >= State_IVSet && m_totalMessageLength > MaxMessageLength()) + throw InvalidArgument(AlgorithmName() + ": message length exceeds maximum"); + +reswitch: + switch (m_state) + { + case State_Start: + case State_KeySet: + throw BadState(AlgorithmName(), "ProcessData", "setting key and IV"); + case State_AuthFooter: + throw BadState(AlgorithmName(), "ProcessData was called after footer input has started"); + case State_IVSet: + AuthenticateLastHeaderBlock(); + m_bufferedDataLength = 0; + m_state = AuthenticationIsOnPlaintext()==IsForwardTransformation() ? State_AuthUntransformed : State_AuthTransformed; + goto reswitch; + case State_AuthUntransformed: + AuthenticateData(inString, length); + AccessSymmetricCipher().ProcessData(outString, inString, length); + break; + case State_AuthTransformed: + AccessSymmetricCipher().ProcessData(outString, inString, length); + AuthenticateData(outString, length); + break; + default: + assert(false); + } +} + +void AuthenticatedSymmetricCipherBase::TruncatedFinal(byte *mac, size_t macSize) +{ + if (m_totalHeaderLength > MaxHeaderLength()) + throw InvalidArgument(AlgorithmName() + ": header length of " + IntToString(m_totalHeaderLength) + " exceeds the maximum of " + IntToString(MaxHeaderLength())); + + if (m_totalFooterLength > MaxFooterLength()) + { + if (MaxFooterLength() == 0) + throw InvalidArgument(AlgorithmName() + ": additional authenticated data (AAD) cannot be input after data to be encrypted or decrypted"); + else + throw InvalidArgument(AlgorithmName() + ": footer length of " + IntToString(m_totalFooterLength) + " exceeds the maximum of " + IntToString(MaxFooterLength())); + } + + switch (m_state) + { + case State_Start: + case State_KeySet: + throw BadState(AlgorithmName(), "TruncatedFinal", "setting key and IV"); + + case State_IVSet: + AuthenticateLastHeaderBlock(); + m_bufferedDataLength = 0; + // fall through + + case State_AuthUntransformed: + case State_AuthTransformed: + AuthenticateLastConfidentialBlock(); + m_bufferedDataLength = 0; + // fall through + + case State_AuthFooter: + AuthenticateLastFooterBlock(mac, macSize); + m_bufferedDataLength = 0; + break; + + default: + assert(false); + } + + m_state = State_KeySet; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/authenc.h b/cryptopp/authenc.h new file mode 100644 index 0000000..5bb2a51 --- /dev/null +++ b/cryptopp/authenc.h @@ -0,0 +1,49 @@ +#ifndef CRYPTOPP_AUTHENC_H +#define CRYPTOPP_AUTHENC_H + +#include "cryptlib.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! . +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AuthenticatedSymmetricCipherBase : public AuthenticatedSymmetricCipher +{ +public: + AuthenticatedSymmetricCipherBase() : m_state(State_Start) {} + + bool IsRandomAccess() const {return false;} + bool IsSelfInverting() const {return true;} + void UncheckedSetKey(const byte *,unsigned int,const CryptoPP::NameValuePairs &) {assert(false);} + + void SetKey(const byte *userKey, size_t keylength, const NameValuePairs ¶ms); + void Restart() {if (m_state > State_KeySet) m_state = State_KeySet;} + void Resynchronize(const byte *iv, int length=-1); + void Update(const byte *input, size_t length); + void ProcessData(byte *outString, const byte *inString, size_t length); + void TruncatedFinal(byte *mac, size_t macSize); + +protected: + void AuthenticateData(const byte *data, size_t len); + const SymmetricCipher & GetSymmetricCipher() const {return const_cast(this)->AccessSymmetricCipher();}; + + virtual SymmetricCipher & AccessSymmetricCipher() =0; + virtual bool AuthenticationIsOnPlaintext() const =0; + virtual unsigned int AuthenticationBlockSize() const =0; + virtual void SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms) =0; + virtual void Resync(const byte *iv, size_t len) =0; + virtual size_t AuthenticateBlocks(const byte *data, size_t len) =0; + virtual void AuthenticateLastHeaderBlock() =0; + virtual void AuthenticateLastConfidentialBlock() {} + virtual void AuthenticateLastFooterBlock(byte *mac, size_t macSize) =0; + + enum State {State_Start, State_KeySet, State_IVSet, State_AuthUntransformed, State_AuthTransformed, State_AuthFooter}; + State m_state; + unsigned int m_bufferedDataLength; + lword m_totalHeaderLength, m_totalMessageLength, m_totalFooterLength; + AlignedSecByteBlock m_buffer; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/base32.cpp b/cryptopp/base32.cpp new file mode 100644 index 0000000..56bce6e --- /dev/null +++ b/cryptopp/base32.cpp @@ -0,0 +1,39 @@ +// base32.cpp - written and placed in the public domain by Frank Palazzolo, based on hex.cpp by Wei Dai + +#include "pch.h" +#include "base32.h" + +NAMESPACE_BEGIN(CryptoPP) + +static const byte s_vecUpper[] = "ABCDEFGHIJKMNPQRSTUVWXYZ23456789"; +static const byte s_vecLower[] = "abcdefghijkmnpqrstuvwxyz23456789"; + +void Base32Encoder::IsolatedInitialize(const NameValuePairs ¶meters) +{ + bool uppercase = parameters.GetValueWithDefault(Name::Uppercase(), true); + m_filter->Initialize(CombinedNameValuePairs( + parameters, + MakeParameters(Name::EncodingLookupArray(), uppercase ? &s_vecUpper[0] : &s_vecLower[0], false)(Name::Log2Base(), 5, true))); +} + +void Base32Decoder::IsolatedInitialize(const NameValuePairs ¶meters) +{ + BaseN_Decoder::Initialize(CombinedNameValuePairs( + parameters, + MakeParameters(Name::DecodingLookupArray(), GetDefaultDecodingLookupArray(), false)(Name::Log2Base(), 5, true))); +} + +const int *Base32Decoder::GetDefaultDecodingLookupArray() +{ + static bool s_initialized = false; + static int s_array[256]; + + if (!s_initialized) + { + InitializeDecodingLookupArray(s_array, s_vecUpper, 32, true); + s_initialized = true; + } + return s_array; +} + +NAMESPACE_END diff --git a/cryptopp/base32.h b/cryptopp/base32.h new file mode 100644 index 0000000..cb1e1af --- /dev/null +++ b/cryptopp/base32.h @@ -0,0 +1,38 @@ +#ifndef CRYPTOPP_BASE32_H +#define CRYPTOPP_BASE32_H + +#include "basecode.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! Converts given data to base 32, the default code is based on draft-ietf-idn-dude-02.txt +/*! To specify alternative code, call Initialize() with EncodingLookupArray parameter. */ +class Base32Encoder : public SimpleProxyFilter +{ +public: + Base32Encoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "") + : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment) + { + IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator))); + } + + void IsolatedInitialize(const NameValuePairs ¶meters); +}; + +//! Decode base 32 data back to bytes, the default code is based on draft-ietf-idn-dude-02.txt +/*! To specify alternative code, call Initialize() with DecodingLookupArray parameter. */ +class Base32Decoder : public BaseN_Decoder +{ +public: + Base32Decoder(BufferedTransformation *attachment = NULL) + : BaseN_Decoder(GetDefaultDecodingLookupArray(), 5, attachment) {} + + void IsolatedInitialize(const NameValuePairs ¶meters); + +private: + static const int * CRYPTOPP_API GetDefaultDecodingLookupArray(); +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/base64.cpp b/cryptopp/base64.cpp new file mode 100644 index 0000000..f86dc6e --- /dev/null +++ b/cryptopp/base64.cpp @@ -0,0 +1,42 @@ +// base64.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "base64.h" + +NAMESPACE_BEGIN(CryptoPP) + +static const byte s_vec[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const byte s_padding = '='; + +void Base64Encoder::IsolatedInitialize(const NameValuePairs ¶meters) +{ + bool insertLineBreaks = parameters.GetValueWithDefault(Name::InsertLineBreaks(), true); + int maxLineLength = parameters.GetIntValueWithDefault(Name::MaxLineLength(), 72); + + const char *lineBreak = insertLineBreaks ? "\n" : ""; + + m_filter->Initialize(CombinedNameValuePairs( + parameters, + MakeParameters(Name::EncodingLookupArray(), &s_vec[0], false) + (Name::PaddingByte(), s_padding) + (Name::GroupSize(), insertLineBreaks ? maxLineLength : 0) + (Name::Separator(), ConstByteArrayParameter(lineBreak)) + (Name::Terminator(), ConstByteArrayParameter(lineBreak)) + (Name::Log2Base(), 6, true))); +} + +const int *Base64Decoder::GetDecodingLookupArray() +{ + static bool s_initialized = false; + static int s_array[256]; + + if (!s_initialized) + { + InitializeDecodingLookupArray(s_array, s_vec, 64, false); + s_initialized = true; + } + return s_array; +} + +NAMESPACE_END diff --git a/cryptopp/base64.h b/cryptopp/base64.h new file mode 100644 index 0000000..5a9e184 --- /dev/null +++ b/cryptopp/base64.h @@ -0,0 +1,36 @@ +#ifndef CRYPTOPP_BASE64_H +#define CRYPTOPP_BASE64_H + +#include "basecode.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! Base64 Encoder Class +class Base64Encoder : public SimpleProxyFilter +{ +public: + Base64Encoder(BufferedTransformation *attachment = NULL, bool insertLineBreaks = true, int maxLineLength = 72) + : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment) + { + IsolatedInitialize(MakeParameters(Name::InsertLineBreaks(), insertLineBreaks)(Name::MaxLineLength(), maxLineLength)); + } + + void IsolatedInitialize(const NameValuePairs ¶meters); +}; + +//! Base64 Decoder Class +class Base64Decoder : public BaseN_Decoder +{ +public: + Base64Decoder(BufferedTransformation *attachment = NULL) + : BaseN_Decoder(GetDecodingLookupArray(), 6, attachment) {} + + void IsolatedInitialize(const NameValuePairs ¶meters) {} + +private: + static const int * CRYPTOPP_API GetDecodingLookupArray(); +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/basecode.cpp b/cryptopp/basecode.cpp new file mode 100644 index 0000000..0c98b22 --- /dev/null +++ b/cryptopp/basecode.cpp @@ -0,0 +1,238 @@ +// basecode.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "basecode.h" +#include "fltrimpl.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +void BaseN_Encoder::IsolatedInitialize(const NameValuePairs ¶meters) +{ + parameters.GetRequiredParameter("BaseN_Encoder", Name::EncodingLookupArray(), m_alphabet); + + parameters.GetRequiredIntParameter("BaseN_Encoder", Name::Log2Base(), m_bitsPerChar); + if (m_bitsPerChar <= 0 || m_bitsPerChar >= 8) + throw InvalidArgument("BaseN_Encoder: Log2Base must be between 1 and 7 inclusive"); + + byte padding; + bool pad; + if (parameters.GetValue(Name::PaddingByte(), padding)) + pad = parameters.GetValueWithDefault(Name::Pad(), true); + else + pad = false; + m_padding = pad ? padding : -1; + + m_bytePos = m_bitPos = 0; + + int i = 8; + while (i%m_bitsPerChar != 0) + i += 8; + m_outputBlockSize = i/m_bitsPerChar; + + m_outBuf.New(m_outputBlockSize); +} + +size_t BaseN_Encoder::Put2(const byte *begin, size_t length, int messageEnd, bool blocking) +{ + FILTER_BEGIN; + while (m_inputPosition < length) + { + if (m_bytePos == 0) + memset(m_outBuf, 0, m_outputBlockSize); + + { + unsigned int b = begin[m_inputPosition++], bitsLeftInSource = 8; + while (true) + { + assert(m_bitPos < m_bitsPerChar); + unsigned int bitsLeftInTarget = m_bitsPerChar-m_bitPos; + m_outBuf[m_bytePos] |= b >> (8-bitsLeftInTarget); + if (bitsLeftInSource >= bitsLeftInTarget) + { + m_bitPos = 0; + ++m_bytePos; + bitsLeftInSource -= bitsLeftInTarget; + if (bitsLeftInSource == 0) + break; + b <<= bitsLeftInTarget; + b &= 0xff; + } + else + { + m_bitPos += bitsLeftInSource; + break; + } + } + } + + assert(m_bytePos <= m_outputBlockSize); + if (m_bytePos == m_outputBlockSize) + { + int i; + for (i=0; i 0) + ++m_bytePos; + + int i; + for (i=0; i 0) + { + memset(m_outBuf+m_bytePos, m_padding, m_outputBlockSize-m_bytePos); + m_bytePos = m_outputBlockSize; + } + FILTER_OUTPUT(2, m_outBuf, m_bytePos, messageEnd); + m_bytePos = m_bitPos = 0; + } + FILTER_END_NO_MESSAGE_END; +} + +void BaseN_Decoder::IsolatedInitialize(const NameValuePairs ¶meters) +{ + parameters.GetRequiredParameter("BaseN_Decoder", Name::DecodingLookupArray(), m_lookup); + + parameters.GetRequiredIntParameter("BaseN_Decoder", Name::Log2Base(), m_bitsPerChar); + if (m_bitsPerChar <= 0 || m_bitsPerChar >= 8) + throw InvalidArgument("BaseN_Decoder: Log2Base must be between 1 and 7 inclusive"); + + m_bytePos = m_bitPos = 0; + + int i = m_bitsPerChar; + while (i%8 != 0) + i += m_bitsPerChar; + m_outputBlockSize = i/8; + + m_outBuf.New(m_outputBlockSize); +} + +size_t BaseN_Decoder::Put2(const byte *begin, size_t length, int messageEnd, bool blocking) +{ + FILTER_BEGIN; + while (m_inputPosition < length) + { + unsigned int value; + value = m_lookup[begin[m_inputPosition++]]; + if (value >= 256) + continue; + + if (m_bytePos == 0 && m_bitPos == 0) + memset(m_outBuf, 0, m_outputBlockSize); + + { + int newBitPos = m_bitPos + m_bitsPerChar; + if (newBitPos <= 8) + m_outBuf[m_bytePos] |= value << (8-newBitPos); + else + { + m_outBuf[m_bytePos] |= value >> (newBitPos-8); + m_outBuf[m_bytePos+1] |= value << (16-newBitPos); + } + + m_bitPos = newBitPos; + while (m_bitPos >= 8) + { + m_bitPos -= 8; + ++m_bytePos; + } + } + + if (m_bytePos == m_outputBlockSize) + { + FILTER_OUTPUT(1, m_outBuf, m_outputBlockSize, 0); + m_bytePos = m_bitPos = 0; + } + } + if (messageEnd) + { + FILTER_OUTPUT(2, m_outBuf, m_bytePos, messageEnd); + m_bytePos = m_bitPos = 0; + } + FILTER_END_NO_MESSAGE_END; +} + +void BaseN_Decoder::InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive) +{ + std::fill(lookup, lookup+256, -1); + + for (unsigned int i=0; i +{ +public: + BaseN_Encoder(BufferedTransformation *attachment=NULL) + {Detach(attachment);} + + BaseN_Encoder(const byte *alphabet, int log2base, BufferedTransformation *attachment=NULL, int padding=-1) + { + Detach(attachment); + IsolatedInitialize(MakeParameters(Name::EncodingLookupArray(), alphabet) + (Name::Log2Base(), log2base) + (Name::Pad(), padding != -1) + (Name::PaddingByte(), byte(padding))); + } + + void IsolatedInitialize(const NameValuePairs ¶meters); + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + +private: + const byte *m_alphabet; + int m_padding, m_bitsPerChar, m_outputBlockSize; + int m_bytePos, m_bitPos; + SecByteBlock m_outBuf; +}; + +//! base n decoder, where n is a power of 2 +class CRYPTOPP_DLL BaseN_Decoder : public Unflushable +{ +public: + BaseN_Decoder(BufferedTransformation *attachment=NULL) + {Detach(attachment);} + + BaseN_Decoder(const int *lookup, int log2base, BufferedTransformation *attachment=NULL) + { + Detach(attachment); + IsolatedInitialize(MakeParameters(Name::DecodingLookupArray(), lookup)(Name::Log2Base(), log2base)); + } + + void IsolatedInitialize(const NameValuePairs ¶meters); + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + + static void CRYPTOPP_API InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive); + +private: + const int *m_lookup; + int m_padding, m_bitsPerChar, m_outputBlockSize; + int m_bytePos, m_bitPos; + SecByteBlock m_outBuf; +}; + +//! filter that breaks input stream into groups of fixed size +class CRYPTOPP_DLL Grouper : public Bufferless +{ +public: + Grouper(BufferedTransformation *attachment=NULL) + {Detach(attachment);} + + Grouper(int groupSize, const std::string &separator, const std::string &terminator, BufferedTransformation *attachment=NULL) + { + Detach(attachment); + IsolatedInitialize(MakeParameters(Name::GroupSize(), groupSize) + (Name::Separator(), ConstByteArrayParameter(separator)) + (Name::Terminator(), ConstByteArrayParameter(terminator))); + } + + void IsolatedInitialize(const NameValuePairs ¶meters); + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + +private: + SecByteBlock m_separator, m_terminator; + size_t m_groupSize, m_counter; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/bench.cpp b/cryptopp/bench.cpp new file mode 100644 index 0000000..537caff --- /dev/null +++ b/cryptopp/bench.cpp @@ -0,0 +1,317 @@ +// bench.cpp - written and placed in the public domain by Wei Dai + +#define _CRT_SECURE_NO_DEPRECATE + +#include "bench.h" +#include "aes.h" +#include "blumshub.h" +#include "rng.h" +#include "files.h" +#include "hex.h" +#include "modes.h" +#include "factory.h" + +#include +#include +#include +#include + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +#ifdef CLOCKS_PER_SEC +const double CLOCK_TICKS_PER_SECOND = (double)CLOCKS_PER_SEC; +#elif defined(CLK_TCK) +const double CLOCK_TICKS_PER_SECOND = (double)CLK_TCK; +#else +const double CLOCK_TICKS_PER_SECOND = 1000000.0; +#endif + +double logtotal = 0, g_allocatedTime, g_hertz; +unsigned int logcount = 0; + +static const byte *const key=(byte *)"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + +void OutputResultBytes(const char *name, double length, double timeTaken) +{ + double mbs = length / timeTaken / (1024*1024); + cout << "\n" << name; +// cout << "" << setprecision(3) << length / (1024*1024); + cout << setiosflags(ios::fixed); +// cout << "" << setprecision(3) << timeTaken; + cout << "" << setprecision(0) << setiosflags(ios::fixed) << mbs; + if (g_hertz) + cout << "" << setprecision(1) << setiosflags(ios::fixed) << timeTaken * g_hertz / length; + cout << resetiosflags(ios::fixed); + logtotal += log(mbs); + logcount++; +} + +void OutputResultKeying(double iterations, double timeTaken) +{ + cout << "" << setprecision(3) << setiosflags(ios::fixed) << (1000*1000*timeTaken/iterations); + if (g_hertz) + cout << "" << setprecision(0) << setiosflags(ios::fixed) << timeTaken * g_hertz / iterations; +} + +void OutputResultOperations(const char *name, const char *operation, bool pc, unsigned long iterations, double timeTaken) +{ + cout << "\n" << name << " " << operation << (pc ? " with precomputation" : ""); +// cout << "" << iterations; +// cout << setiosflags(ios::fixed); +// cout << "" << setprecision(3) << timeTaken; + cout << "" << setprecision(2) << setiosflags(ios::fixed) << (1000*timeTaken/iterations); + if (g_hertz) + cout << "" << setprecision(2) << setiosflags(ios::fixed) << timeTaken * g_hertz / iterations / 1000000; + cout << resetiosflags(ios::fixed); + + logtotal += log(iterations/timeTaken); + logcount++; +} + +/* +void BenchMark(const char *name, BlockTransformation &cipher, double timeTotal) +{ + const int BUF_SIZE = RoundUpToMultipleOf(2048U, cipher.OptimalNumberOfParallelBlocks() * cipher.BlockSize()); + AlignedSecByteBlock buf(BUF_SIZE); + const int nBlocks = BUF_SIZE / cipher.BlockSize(); + clock_t start = clock(); + + unsigned long i=0, blocks=1; + double timeTaken; + do + { + blocks *= 2; + for (; i +void BenchMarkByName2(const char *factoryName, size_t keyLength = 0, const char *displayName=NULL, const NameValuePairs ¶ms = g_nullNameValuePairs, T_FactoryOutput *x=NULL, T_Interface *y=NULL) +{ + std::string name = factoryName; + if (displayName) + name = displayName; + else if (keyLength) + name += " (" + IntToString(keyLength * 8) + "-bit key)"; + + std::auto_ptr obj(ObjectFactoryRegistry::Registry().CreateObject(factoryName)); + if (!keyLength) + keyLength = obj->DefaultKeyLength(); + obj->SetKey(key, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(key, obj->IVSize()), false))); + BenchMark(name.c_str(), *static_cast(obj.get()), g_allocatedTime); + BenchMarkKeying(*obj, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(key, obj->IVSize()), false))); +} + +//VC60 workaround: compiler bug triggered without the extra dummy parameters +template +void BenchMarkByName(const char *factoryName, size_t keyLength = 0, const char *displayName=NULL, const NameValuePairs ¶ms = g_nullNameValuePairs, T_FactoryOutput *x=NULL) +{ + BenchMarkByName2(factoryName, keyLength, displayName, params, x, x); +} + +template +void BenchMarkByNameKeyLess(const char *factoryName, const char *displayName=NULL, const NameValuePairs ¶ms = g_nullNameValuePairs, T *x=NULL) +{ + std::string name = factoryName; + if (displayName) + name = displayName; + + std::auto_ptr obj(ObjectFactoryRegistry::Registry().CreateObject(factoryName)); + BenchMark(name.c_str(), *obj, g_allocatedTime); +} + +void BenchmarkAll(double t, double hertz) +{ +#if 1 + logtotal = 0; + logcount = 0; + g_allocatedTime = t; + g_hertz = hertz; + + const char *cpb, *cpk; + if (g_hertz) + { + cpb = "Cycles Per Byte"; + cpk = "Cycles to
Setup Key and IV"; + cout << "CPU frequency of the test platform is " << g_hertz << " Hz.\n"; + } + else + { + cpb = cpk = ""; + cout << "CPU frequency of the test platform was not provided.\n"; + } + + cout << "" << endl; + cout << ""; + BenchMarkByName2("AES/GCM", 0, "AES/GCM (2K tables)", MakeParameters(Name::TableSize(), 2048)); + BenchMarkByName2("AES/GCM", 0, "AES/GCM (64K tables)", MakeParameters(Name::TableSize(), 64*1024)); + BenchMarkByName2("AES/CCM"); + BenchMarkByName2("AES/EAX"); + + cout << "\n"; + BenchMarkByName2("AES/GCM", 0, "GMAC(AES) (2K tables)", MakeParameters(Name::TableSize(), 2048)); + BenchMarkByName2("AES/GCM", 0, "GMAC(AES) (64K tables)", MakeParameters(Name::TableSize(), 64*1024)); + BenchMarkByName("VMAC(AES)-64"); + BenchMarkByName("VMAC(AES)-128"); + BenchMarkByName("HMAC(SHA-1)"); + BenchMarkByName("Two-Track-MAC"); + BenchMarkByName("CMAC(AES)"); + BenchMarkByName("DMAC(AES)"); + + cout << "\n"; + BenchMarkByNameKeyLess("CRC32"); + BenchMarkByNameKeyLess("Adler32"); + BenchMarkByNameKeyLess("MD5"); + BenchMarkByNameKeyLess("SHA-1"); + BenchMarkByNameKeyLess("SHA-256"); + BenchMarkByNameKeyLess("SHA-512"); + BenchMarkByNameKeyLess("Tiger"); + BenchMarkByNameKeyLess("Whirlpool"); + BenchMarkByNameKeyLess("RIPEMD-160"); + BenchMarkByNameKeyLess("RIPEMD-320"); + BenchMarkByNameKeyLess("RIPEMD-128"); + BenchMarkByNameKeyLess("RIPEMD-256"); + + cout << "\n"; + BenchMarkByName("Panama-LE"); + BenchMarkByName("Panama-BE"); + BenchMarkByName("Salsa20"); + BenchMarkByName("Salsa20", 0, "Salsa20/12", MakeParameters(Name::Rounds(), 12)); + BenchMarkByName("Salsa20", 0, "Salsa20/8", MakeParameters(Name::Rounds(), 8)); + BenchMarkByName("Sosemanuk"); + BenchMarkByName("MARC4"); + BenchMarkByName("SEAL-3.0-LE"); + BenchMarkByName("WAKE-OFB-LE"); + + cout << "\n"; + BenchMarkByName("AES/CTR", 16); + BenchMarkByName("AES/CTR", 24); + BenchMarkByName("AES/CTR", 32); + BenchMarkByName("AES/CBC", 16); + BenchMarkByName("AES/CBC", 24); + BenchMarkByName("AES/CBC", 32); + BenchMarkByName("AES/OFB", 16); + BenchMarkByName("AES/CFB", 16); + BenchMarkByName("AES/ECB", 16); + BenchMarkByName("Camellia/CTR", 16); + BenchMarkByName("Camellia/CTR", 32); + BenchMarkByName("Twofish/CTR"); + BenchMarkByName("Serpent/CTR"); + BenchMarkByName("CAST-256/CTR"); + BenchMarkByName("RC6/CTR"); + BenchMarkByName("MARS/CTR"); + BenchMarkByName("SHACAL-2/CTR", 16); + BenchMarkByName("SHACAL-2/CTR", 64); + BenchMarkByName("DES/CTR"); + BenchMarkByName("DES-XEX3/CTR"); + BenchMarkByName("DES-EDE3/CTR"); + BenchMarkByName("IDEA/CTR"); + BenchMarkByName("RC5/CTR", 0, "RC5 (r=16)"); + BenchMarkByName("Blowfish/CTR"); + BenchMarkByName("TEA/CTR"); + BenchMarkByName("XTEA/CTR"); + BenchMarkByName("CAST-128/CTR"); + BenchMarkByName("SKIPJACK/CTR"); + BenchMarkByName("SEED/CTR", 0, "SEED/CTR (1/2 K table)"); + cout << "
AlgorithmMiB/Second" << cpb << "Microseconds to
Setup Key and IV" << cpk << endl; + + cout << "\n
" << endl; + + BenchmarkAll2(t, hertz); + + cout << "Throughput Geometric Average: " << setiosflags(ios::fixed) << exp(logtotal/logcount) << endl; + + time_t endTime = time(NULL); + cout << "\nTest ended at " << asctime(localtime(&endTime)); +#endif +} diff --git a/cryptopp/bench.h b/cryptopp/bench.h new file mode 100644 index 0000000..8bb6ab9 --- /dev/null +++ b/cryptopp/bench.h @@ -0,0 +1,11 @@ +#ifndef CRYPTOPP_BENCH_H +#define CRYPTOPP_BENCH_H + +#include "cryptlib.h" + +extern const double CLOCK_TICKS_PER_SECOND; + +void BenchmarkAll(double t, double hertz); +void BenchmarkAll2(double t, double hertz); + +#endif diff --git a/cryptopp/bench2.cpp b/cryptopp/bench2.cpp new file mode 100644 index 0000000..8f85112 --- /dev/null +++ b/cryptopp/bench2.cpp @@ -0,0 +1,327 @@ +// bench2.cpp - written and placed in the public domain by Wei Dai + +#include "bench.h" +#include "rng.h" +#include "files.h" +#include "hex.h" + +#include "rsa.h" +#include "nr.h" +#include "dsa.h" +#include "luc.h" +#include "rw.h" +#include "eccrypto.h" +#include "ecp.h" +#include "ec2n.h" +#include "asn.h" +#include "dh.h" +#include "mqv.h" +#include "xtrcrypt.h" +#include "esign.h" +#include "pssr.h" +#include "oids.h" +#include "randpool.h" + +#include +#include +#include +#include + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +void OutputResultOperations(const char *name, const char *operation, bool pc, unsigned long iterations, double timeTaken); + +void BenchMarkEncryption(const char *name, PK_Encryptor &key, double timeTotal, bool pc=false) +{ + unsigned int len = 16; + LC_RNG rng((word32)time(NULL)); + SecByteBlock plaintext(len), ciphertext(key.CiphertextLength(len)); + rng.GenerateBlock(plaintext, len); + + clock_t start = clock(); + unsigned int i; + double timeTaken; + for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++) + key.Encrypt(rng, plaintext, len, ciphertext); + + OutputResultOperations(name, "Encryption", pc, i, timeTaken); + + if (!pc && key.GetMaterial().SupportsPrecomputation()) + { + key.AccessMaterial().Precompute(16); + BenchMarkEncryption(name, key, timeTotal, true); + } +} + +void BenchMarkDecryption(const char *name, PK_Decryptor &priv, PK_Encryptor &pub, double timeTotal) +{ + unsigned int len = 16; + LC_RNG rng((word32)time(NULL)); + SecByteBlock ciphertext(pub.CiphertextLength(len)); + SecByteBlock plaintext(pub.MaxPlaintextLength(ciphertext.size())); + rng.GenerateBlock(plaintext, len); + pub.Encrypt(rng, plaintext, len, ciphertext); + + clock_t start = clock(); + unsigned int i; + double timeTaken; + for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++) + priv.Decrypt(rng, ciphertext, ciphertext.size(), plaintext); + + OutputResultOperations(name, "Decryption", false, i, timeTaken); +} + +void BenchMarkSigning(const char *name, PK_Signer &key, double timeTotal, bool pc=false) +{ + unsigned int len = 16; + LC_RNG rng((word32)time(NULL)); + AlignedSecByteBlock message(len), signature(key.SignatureLength()); + rng.GenerateBlock(message, len); + + clock_t start = clock(); + unsigned int i; + double timeTaken; + for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++) + key.SignMessage(rng, message, len, signature); + + OutputResultOperations(name, "Signature", pc, i, timeTaken); + + if (!pc && key.GetMaterial().SupportsPrecomputation()) + { + key.AccessMaterial().Precompute(16); + BenchMarkSigning(name, key, timeTotal, true); + } +} + +void BenchMarkVerification(const char *name, const PK_Signer &priv, PK_Verifier &pub, double timeTotal, bool pc=false) +{ + unsigned int len = 16; + LC_RNG rng((word32)time(NULL)); + AlignedSecByteBlock message(len), signature(pub.SignatureLength()); + rng.GenerateBlock(message, len); + priv.SignMessage(rng, message, len, signature); + + clock_t start = clock(); + unsigned int i; + double timeTaken; + for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++) + pub.VerifyMessage(message, len, signature, signature.size()); + + OutputResultOperations(name, "Verification", pc, i, timeTaken); + + if (!pc && pub.GetMaterial().SupportsPrecomputation()) + { + pub.AccessMaterial().Precompute(16); + BenchMarkVerification(name, priv, pub, timeTotal, true); + } +} + +void BenchMarkKeyGen(const char *name, SimpleKeyAgreementDomain &d, double timeTotal, bool pc=false) +{ + LC_RNG rng((word32)time(NULL)); + SecByteBlock priv(d.PrivateKeyLength()), pub(d.PublicKeyLength()); + + clock_t start = clock(); + unsigned int i; + double timeTaken; + for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++) + d.GenerateKeyPair(rng, priv, pub); + + OutputResultOperations(name, "Key-Pair Generation", pc, i, timeTaken); + + if (!pc && d.GetMaterial().SupportsPrecomputation()) + { + d.AccessMaterial().Precompute(16); + BenchMarkKeyGen(name, d, timeTotal, true); + } +} + +void BenchMarkKeyGen(const char *name, AuthenticatedKeyAgreementDomain &d, double timeTotal, bool pc=false) +{ + LC_RNG rng((word32)time(NULL)); + SecByteBlock priv(d.EphemeralPrivateKeyLength()), pub(d.EphemeralPublicKeyLength()); + + clock_t start = clock(); + unsigned int i; + double timeTaken; + for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++) + d.GenerateEphemeralKeyPair(rng, priv, pub); + + OutputResultOperations(name, "Key-Pair Generation", pc, i, timeTaken); + + if (!pc && d.GetMaterial().SupportsPrecomputation()) + { + d.AccessMaterial().Precompute(16); + BenchMarkKeyGen(name, d, timeTotal, true); + } +} + +void BenchMarkAgreement(const char *name, SimpleKeyAgreementDomain &d, double timeTotal, bool pc=false) +{ + LC_RNG rng((word32)time(NULL)); + SecByteBlock priv1(d.PrivateKeyLength()), priv2(d.PrivateKeyLength()); + SecByteBlock pub1(d.PublicKeyLength()), pub2(d.PublicKeyLength()); + d.GenerateKeyPair(rng, priv1, pub1); + d.GenerateKeyPair(rng, priv2, pub2); + SecByteBlock val(d.AgreedValueLength()); + + clock_t start = clock(); + unsigned int i; + double timeTaken; + for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i+=2) + { + d.Agree(val, priv1, pub2); + d.Agree(val, priv2, pub1); + } + + OutputResultOperations(name, "Key Agreement", pc, i, timeTaken); +} + +void BenchMarkAgreement(const char *name, AuthenticatedKeyAgreementDomain &d, double timeTotal, bool pc=false) +{ + LC_RNG rng((word32)time(NULL)); + SecByteBlock spriv1(d.StaticPrivateKeyLength()), spriv2(d.StaticPrivateKeyLength()); + SecByteBlock epriv1(d.EphemeralPrivateKeyLength()), epriv2(d.EphemeralPrivateKeyLength()); + SecByteBlock spub1(d.StaticPublicKeyLength()), spub2(d.StaticPublicKeyLength()); + SecByteBlock epub1(d.EphemeralPublicKeyLength()), epub2(d.EphemeralPublicKeyLength()); + d.GenerateStaticKeyPair(rng, spriv1, spub1); + d.GenerateStaticKeyPair(rng, spriv2, spub2); + d.GenerateEphemeralKeyPair(rng, epriv1, epub1); + d.GenerateEphemeralKeyPair(rng, epriv2, epub2); + SecByteBlock val(d.AgreedValueLength()); + + clock_t start = clock(); + unsigned int i; + double timeTaken; + for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i+=2) + { + d.Agree(val, spriv1, epriv1, spub2, epub2); + d.Agree(val, spriv2, epriv2, spub1, epub1); + } + + OutputResultOperations(name, "Key Agreement", pc, i, timeTaken); +} + +//VC60 workaround: compiler bug triggered without the extra dummy parameters +template +void BenchMarkCrypto(const char *filename, const char *name, double timeTotal, SCHEME *x=NULL) +{ + FileSource f(filename, true, new HexDecoder()); + typename SCHEME::Decryptor priv(f); + typename SCHEME::Encryptor pub(priv); + BenchMarkEncryption(name, pub, timeTotal); + BenchMarkDecryption(name, priv, pub, timeTotal); +} + +//VC60 workaround: compiler bug triggered without the extra dummy parameters +template +void BenchMarkSignature(const char *filename, const char *name, double timeTotal, SCHEME *x=NULL) +{ + FileSource f(filename, true, new HexDecoder()); + typename SCHEME::Signer priv(f); + typename SCHEME::Verifier pub(priv); + BenchMarkSigning(name, priv, timeTotal); + BenchMarkVerification(name, priv, pub, timeTotal); +} + +//VC60 workaround: compiler bug triggered without the extra dummy parameters +template +void BenchMarkKeyAgreement(const char *filename, const char *name, double timeTotal, D *x=NULL) +{ + FileSource f(filename, true, new HexDecoder()); + D d(f); + BenchMarkKeyGen(name, d, timeTotal); + BenchMarkAgreement(name, d, timeTotal); +} + +extern double g_hertz; + +void BenchmarkAll2(double t, double hertz) +{ + g_hertz = hertz; + + cout << "" << endl; + cout << ""; + BenchMarkCrypto > >("TestData/rsa1024.dat", "RSA 1024", t); + BenchMarkCrypto > >("TestData/luc1024.dat", "LUC 1024", t); + BenchMarkCrypto >("TestData/dlie1024.dat", "DLIES 1024", t); + BenchMarkCrypto >("TestData/lucc512.dat", "LUCELG 512", t); + + cout << "\n"; + BenchMarkCrypto > >("TestData/rsa2048.dat", "RSA 2048", t); + BenchMarkCrypto > >("TestData/luc2048.dat", "LUC 2048", t); + BenchMarkCrypto >("TestData/dlie2048.dat", "DLIES 2048", t); + BenchMarkCrypto >("TestData/lucc1024.dat", "LUCELG 1024", t); + + cout << "\n"; + BenchMarkSignature >("TestData/rsa1024.dat", "RSA 1024", t); + BenchMarkSignature >("TestData/rw1024.dat", "RW 1024", t); + BenchMarkSignature >("TestData/luc1024.dat", "LUC 1024", t); + BenchMarkSignature >("TestData/nr1024.dat", "NR 1024", t); + BenchMarkSignature("TestData/dsa1024.dat", "DSA 1024", t); + BenchMarkSignature >("TestData/lucs512.dat", "LUC-HMP 512", t); + BenchMarkSignature >("TestData/esig1023.dat", "ESIGN 1023", t); + BenchMarkSignature >("TestData/esig1536.dat", "ESIGN 1536", t); + + cout << "\n"; + BenchMarkSignature >("TestData/rsa2048.dat", "RSA 2048", t); + BenchMarkSignature >("TestData/rw2048.dat", "RW 2048", t); + BenchMarkSignature >("TestData/luc2048.dat", "LUC 2048", t); + BenchMarkSignature >("TestData/nr2048.dat", "NR 2048", t); + BenchMarkSignature >("TestData/lucs1024.dat", "LUC-HMP 1024", t); + BenchMarkSignature >("TestData/esig2046.dat", "ESIGN 2046", t); + + cout << "\n"; + BenchMarkKeyAgreement("TestData/xtrdh171.dat", "XTR-DH 171", t); + BenchMarkKeyAgreement("TestData/xtrdh342.dat", "XTR-DH 342", t); + BenchMarkKeyAgreement("TestData/dh1024.dat", "DH 1024", t); + BenchMarkKeyAgreement("TestData/dh2048.dat", "DH 2048", t); + BenchMarkKeyAgreement("TestData/lucd512.dat", "LUCDIF 512", t); + BenchMarkKeyAgreement("TestData/lucd1024.dat", "LUCDIF 1024", t); + BenchMarkKeyAgreement("TestData/mqv1024.dat", "MQV 1024", t); + BenchMarkKeyAgreement("TestData/mqv2048.dat", "MQV 2048", t); + + cout << "\n"; + { + RandomPool rng; // not seeded + ECIES::Decryptor cpriv(rng, ASN1::secp256k1()); + ECIES::Encryptor cpub(cpriv); + ECDSA::Signer spriv(cpriv); + ECDSA::Verifier spub(spriv); + ECDH::Domain ecdhc(ASN1::secp256k1()); + ECMQV::Domain ecmqvc(ASN1::secp256k1()); + + BenchMarkEncryption("ECIES over GF(p) 256", cpub, t); + BenchMarkDecryption("ECIES over GF(p) 256", cpriv, cpub, t); + BenchMarkSigning("ECDSA over GF(p) 256", spriv, t); + BenchMarkVerification("ECDSA over GF(p) 256", spriv, spub, t); + BenchMarkKeyGen("ECDHC over GF(p) 256", ecdhc, t); + BenchMarkAgreement("ECDHC over GF(p) 256", ecdhc, t); + BenchMarkKeyGen("ECMQVC over GF(p) 256", ecmqvc, t); + BenchMarkAgreement("ECMQVC over GF(p) 256", ecmqvc, t); + } + + cout << "" << endl; + { + RandomPool rng; // not seeded + ECIES::Decryptor cpriv(rng, ASN1::sect233r1()); + ECIES::Encryptor cpub(cpriv); + ECDSA::Signer spriv(cpriv); + ECDSA::Verifier spub(spriv); + ECDH::Domain ecdhc(ASN1::sect233r1()); + ECMQV::Domain ecmqvc(ASN1::sect233r1()); + + BenchMarkEncryption("ECIES over GF(2^n) 233", cpub, t); + BenchMarkDecryption("ECIES over GF(2^n) 233", cpriv, cpub, t); + BenchMarkSigning("ECNR over GF(2^n) 233", spriv, t); + BenchMarkVerification("ECNR over GF(2^n) 233", spriv, spub, t); + BenchMarkKeyGen("ECDHC over GF(2^n) 233", ecdhc, t); + BenchMarkAgreement("ECDHC over GF(2^n) 233", ecdhc, t); + BenchMarkKeyGen("ECMQVC over GF(2^n) 233", ecmqvc, t); + BenchMarkAgreement("ECMQVC over GF(2^n) 233", ecmqvc, t); + } + cout << "
OperationMilliseconds/Operation" << (g_hertz ? "Megacycles/Operation" : "") << endl; + + cout << "\n
" << endl; +} diff --git a/cryptopp/bfinit.cpp b/cryptopp/bfinit.cpp new file mode 100644 index 0000000..714570a --- /dev/null +++ b/cryptopp/bfinit.cpp @@ -0,0 +1,277 @@ +#include "pch.h" +#include "blowfish.h" + +NAMESPACE_BEGIN(CryptoPP) + +const word32 Blowfish::Base::p_init[Blowfish::ROUNDS+2] = +{ + 608135816U, 2242054355U, 320440878U, 57701188U, + 2752067618U, 698298832U, 137296536U, 3964562569U, + 1160258022U, 953160567U, 3193202383U, 887688300U, + 3232508343U, 3380367581U, 1065670069U, 3041331479U, + 2450970073U, 2306472731U +} ; + +const word32 Blowfish::Base::s_init[4*256] = { + 3509652390U, 2564797868U, 805139163U, 3491422135U, + 3101798381U, 1780907670U, 3128725573U, 4046225305U, + 614570311U, 3012652279U, 134345442U, 2240740374U, + 1667834072U, 1901547113U, 2757295779U, 4103290238U, + 227898511U, 1921955416U, 1904987480U, 2182433518U, + 2069144605U, 3260701109U, 2620446009U, 720527379U, + 3318853667U, 677414384U, 3393288472U, 3101374703U, + 2390351024U, 1614419982U, 1822297739U, 2954791486U, + 3608508353U, 3174124327U, 2024746970U, 1432378464U, + 3864339955U, 2857741204U, 1464375394U, 1676153920U, + 1439316330U, 715854006U, 3033291828U, 289532110U, + 2706671279U, 2087905683U, 3018724369U, 1668267050U, + 732546397U, 1947742710U, 3462151702U, 2609353502U, + 2950085171U, 1814351708U, 2050118529U, 680887927U, + 999245976U, 1800124847U, 3300911131U, 1713906067U, + 1641548236U, 4213287313U, 1216130144U, 1575780402U, + 4018429277U, 3917837745U, 3693486850U, 3949271944U, + 596196993U, 3549867205U, 258830323U, 2213823033U, + 772490370U, 2760122372U, 1774776394U, 2652871518U, + 566650946U, 4142492826U, 1728879713U, 2882767088U, + 1783734482U, 3629395816U, 2517608232U, 2874225571U, + 1861159788U, 326777828U, 3124490320U, 2130389656U, + 2716951837U, 967770486U, 1724537150U, 2185432712U, + 2364442137U, 1164943284U, 2105845187U, 998989502U, + 3765401048U, 2244026483U, 1075463327U, 1455516326U, + 1322494562U, 910128902U, 469688178U, 1117454909U, + 936433444U, 3490320968U, 3675253459U, 1240580251U, + 122909385U, 2157517691U, 634681816U, 4142456567U, + 3825094682U, 3061402683U, 2540495037U, 79693498U, + 3249098678U, 1084186820U, 1583128258U, 426386531U, + 1761308591U, 1047286709U, 322548459U, 995290223U, + 1845252383U, 2603652396U, 3431023940U, 2942221577U, + 3202600964U, 3727903485U, 1712269319U, 422464435U, + 3234572375U, 1170764815U, 3523960633U, 3117677531U, + 1434042557U, 442511882U, 3600875718U, 1076654713U, + 1738483198U, 4213154764U, 2393238008U, 3677496056U, + 1014306527U, 4251020053U, 793779912U, 2902807211U, + 842905082U, 4246964064U, 1395751752U, 1040244610U, + 2656851899U, 3396308128U, 445077038U, 3742853595U, + 3577915638U, 679411651U, 2892444358U, 2354009459U, + 1767581616U, 3150600392U, 3791627101U, 3102740896U, + 284835224U, 4246832056U, 1258075500U, 768725851U, + 2589189241U, 3069724005U, 3532540348U, 1274779536U, + 3789419226U, 2764799539U, 1660621633U, 3471099624U, + 4011903706U, 913787905U, 3497959166U, 737222580U, + 2514213453U, 2928710040U, 3937242737U, 1804850592U, + 3499020752U, 2949064160U, 2386320175U, 2390070455U, + 2415321851U, 4061277028U, 2290661394U, 2416832540U, + 1336762016U, 1754252060U, 3520065937U, 3014181293U, + 791618072U, 3188594551U, 3933548030U, 2332172193U, + 3852520463U, 3043980520U, 413987798U, 3465142937U, + 3030929376U, 4245938359U, 2093235073U, 3534596313U, + 375366246U, 2157278981U, 2479649556U, 555357303U, + 3870105701U, 2008414854U, 3344188149U, 4221384143U, + 3956125452U, 2067696032U, 3594591187U, 2921233993U, + 2428461U, 544322398U, 577241275U, 1471733935U, + 610547355U, 4027169054U, 1432588573U, 1507829418U, + 2025931657U, 3646575487U, 545086370U, 48609733U, + 2200306550U, 1653985193U, 298326376U, 1316178497U, + 3007786442U, 2064951626U, 458293330U, 2589141269U, + 3591329599U, 3164325604U, 727753846U, 2179363840U, + 146436021U, 1461446943U, 4069977195U, 705550613U, + 3059967265U, 3887724982U, 4281599278U, 3313849956U, + 1404054877U, 2845806497U, 146425753U, 1854211946U, + + 1266315497U, 3048417604U, 3681880366U, 3289982499U, + 2909710000U, 1235738493U, 2632868024U, 2414719590U, + 3970600049U, 1771706367U, 1449415276U, 3266420449U, + 422970021U, 1963543593U, 2690192192U, 3826793022U, + 1062508698U, 1531092325U, 1804592342U, 2583117782U, + 2714934279U, 4024971509U, 1294809318U, 4028980673U, + 1289560198U, 2221992742U, 1669523910U, 35572830U, + 157838143U, 1052438473U, 1016535060U, 1802137761U, + 1753167236U, 1386275462U, 3080475397U, 2857371447U, + 1040679964U, 2145300060U, 2390574316U, 1461121720U, + 2956646967U, 4031777805U, 4028374788U, 33600511U, + 2920084762U, 1018524850U, 629373528U, 3691585981U, + 3515945977U, 2091462646U, 2486323059U, 586499841U, + 988145025U, 935516892U, 3367335476U, 2599673255U, + 2839830854U, 265290510U, 3972581182U, 2759138881U, + 3795373465U, 1005194799U, 847297441U, 406762289U, + 1314163512U, 1332590856U, 1866599683U, 4127851711U, + 750260880U, 613907577U, 1450815602U, 3165620655U, + 3734664991U, 3650291728U, 3012275730U, 3704569646U, + 1427272223U, 778793252U, 1343938022U, 2676280711U, + 2052605720U, 1946737175U, 3164576444U, 3914038668U, + 3967478842U, 3682934266U, 1661551462U, 3294938066U, + 4011595847U, 840292616U, 3712170807U, 616741398U, + 312560963U, 711312465U, 1351876610U, 322626781U, + 1910503582U, 271666773U, 2175563734U, 1594956187U, + 70604529U, 3617834859U, 1007753275U, 1495573769U, + 4069517037U, 2549218298U, 2663038764U, 504708206U, + 2263041392U, 3941167025U, 2249088522U, 1514023603U, + 1998579484U, 1312622330U, 694541497U, 2582060303U, + 2151582166U, 1382467621U, 776784248U, 2618340202U, + 3323268794U, 2497899128U, 2784771155U, 503983604U, + 4076293799U, 907881277U, 423175695U, 432175456U, + 1378068232U, 4145222326U, 3954048622U, 3938656102U, + 3820766613U, 2793130115U, 2977904593U, 26017576U, + 3274890735U, 3194772133U, 1700274565U, 1756076034U, + 4006520079U, 3677328699U, 720338349U, 1533947780U, + 354530856U, 688349552U, 3973924725U, 1637815568U, + 332179504U, 3949051286U, 53804574U, 2852348879U, + 3044236432U, 1282449977U, 3583942155U, 3416972820U, + 4006381244U, 1617046695U, 2628476075U, 3002303598U, + 1686838959U, 431878346U, 2686675385U, 1700445008U, + 1080580658U, 1009431731U, 832498133U, 3223435511U, + 2605976345U, 2271191193U, 2516031870U, 1648197032U, + 4164389018U, 2548247927U, 300782431U, 375919233U, + 238389289U, 3353747414U, 2531188641U, 2019080857U, + 1475708069U, 455242339U, 2609103871U, 448939670U, + 3451063019U, 1395535956U, 2413381860U, 1841049896U, + 1491858159U, 885456874U, 4264095073U, 4001119347U, + 1565136089U, 3898914787U, 1108368660U, 540939232U, + 1173283510U, 2745871338U, 3681308437U, 4207628240U, + 3343053890U, 4016749493U, 1699691293U, 1103962373U, + 3625875870U, 2256883143U, 3830138730U, 1031889488U, + 3479347698U, 1535977030U, 4236805024U, 3251091107U, + 2132092099U, 1774941330U, 1199868427U, 1452454533U, + 157007616U, 2904115357U, 342012276U, 595725824U, + 1480756522U, 206960106U, 497939518U, 591360097U, + 863170706U, 2375253569U, 3596610801U, 1814182875U, + 2094937945U, 3421402208U, 1082520231U, 3463918190U, + 2785509508U, 435703966U, 3908032597U, 1641649973U, + 2842273706U, 3305899714U, 1510255612U, 2148256476U, + 2655287854U, 3276092548U, 4258621189U, 236887753U, + 3681803219U, 274041037U, 1734335097U, 3815195456U, + 3317970021U, 1899903192U, 1026095262U, 4050517792U, + 356393447U, 2410691914U, 3873677099U, 3682840055U, + + 3913112168U, 2491498743U, 4132185628U, 2489919796U, + 1091903735U, 1979897079U, 3170134830U, 3567386728U, + 3557303409U, 857797738U, 1136121015U, 1342202287U, + 507115054U, 2535736646U, 337727348U, 3213592640U, + 1301675037U, 2528481711U, 1895095763U, 1721773893U, + 3216771564U, 62756741U, 2142006736U, 835421444U, + 2531993523U, 1442658625U, 3659876326U, 2882144922U, + 676362277U, 1392781812U, 170690266U, 3921047035U, + 1759253602U, 3611846912U, 1745797284U, 664899054U, + 1329594018U, 3901205900U, 3045908486U, 2062866102U, + 2865634940U, 3543621612U, 3464012697U, 1080764994U, + 553557557U, 3656615353U, 3996768171U, 991055499U, + 499776247U, 1265440854U, 648242737U, 3940784050U, + 980351604U, 3713745714U, 1749149687U, 3396870395U, + 4211799374U, 3640570775U, 1161844396U, 3125318951U, + 1431517754U, 545492359U, 4268468663U, 3499529547U, + 1437099964U, 2702547544U, 3433638243U, 2581715763U, + 2787789398U, 1060185593U, 1593081372U, 2418618748U, + 4260947970U, 69676912U, 2159744348U, 86519011U, + 2512459080U, 3838209314U, 1220612927U, 3339683548U, + 133810670U, 1090789135U, 1078426020U, 1569222167U, + 845107691U, 3583754449U, 4072456591U, 1091646820U, + 628848692U, 1613405280U, 3757631651U, 526609435U, + 236106946U, 48312990U, 2942717905U, 3402727701U, + 1797494240U, 859738849U, 992217954U, 4005476642U, + 2243076622U, 3870952857U, 3732016268U, 765654824U, + 3490871365U, 2511836413U, 1685915746U, 3888969200U, + 1414112111U, 2273134842U, 3281911079U, 4080962846U, + 172450625U, 2569994100U, 980381355U, 4109958455U, + 2819808352U, 2716589560U, 2568741196U, 3681446669U, + 3329971472U, 1835478071U, 660984891U, 3704678404U, + 4045999559U, 3422617507U, 3040415634U, 1762651403U, + 1719377915U, 3470491036U, 2693910283U, 3642056355U, + 3138596744U, 1364962596U, 2073328063U, 1983633131U, + 926494387U, 3423689081U, 2150032023U, 4096667949U, + 1749200295U, 3328846651U, 309677260U, 2016342300U, + 1779581495U, 3079819751U, 111262694U, 1274766160U, + 443224088U, 298511866U, 1025883608U, 3806446537U, + 1145181785U, 168956806U, 3641502830U, 3584813610U, + 1689216846U, 3666258015U, 3200248200U, 1692713982U, + 2646376535U, 4042768518U, 1618508792U, 1610833997U, + 3523052358U, 4130873264U, 2001055236U, 3610705100U, + 2202168115U, 4028541809U, 2961195399U, 1006657119U, + 2006996926U, 3186142756U, 1430667929U, 3210227297U, + 1314452623U, 4074634658U, 4101304120U, 2273951170U, + 1399257539U, 3367210612U, 3027628629U, 1190975929U, + 2062231137U, 2333990788U, 2221543033U, 2438960610U, + 1181637006U, 548689776U, 2362791313U, 3372408396U, + 3104550113U, 3145860560U, 296247880U, 1970579870U, + 3078560182U, 3769228297U, 1714227617U, 3291629107U, + 3898220290U, 166772364U, 1251581989U, 493813264U, + 448347421U, 195405023U, 2709975567U, 677966185U, + 3703036547U, 1463355134U, 2715995803U, 1338867538U, + 1343315457U, 2802222074U, 2684532164U, 233230375U, + 2599980071U, 2000651841U, 3277868038U, 1638401717U, + 4028070440U, 3237316320U, 6314154U, 819756386U, + 300326615U, 590932579U, 1405279636U, 3267499572U, + 3150704214U, 2428286686U, 3959192993U, 3461946742U, + 1862657033U, 1266418056U, 963775037U, 2089974820U, + 2263052895U, 1917689273U, 448879540U, 3550394620U, + 3981727096U, 150775221U, 3627908307U, 1303187396U, + 508620638U, 2975983352U, 2726630617U, 1817252668U, + 1876281319U, 1457606340U, 908771278U, 3720792119U, + 3617206836U, 2455994898U, 1729034894U, 1080033504U, + + 976866871U, 3556439503U, 2881648439U, 1522871579U, + 1555064734U, 1336096578U, 3548522304U, 2579274686U, + 3574697629U, 3205460757U, 3593280638U, 3338716283U, + 3079412587U, 564236357U, 2993598910U, 1781952180U, + 1464380207U, 3163844217U, 3332601554U, 1699332808U, + 1393555694U, 1183702653U, 3581086237U, 1288719814U, + 691649499U, 2847557200U, 2895455976U, 3193889540U, + 2717570544U, 1781354906U, 1676643554U, 2592534050U, + 3230253752U, 1126444790U, 2770207658U, 2633158820U, + 2210423226U, 2615765581U, 2414155088U, 3127139286U, + 673620729U, 2805611233U, 1269405062U, 4015350505U, + 3341807571U, 4149409754U, 1057255273U, 2012875353U, + 2162469141U, 2276492801U, 2601117357U, 993977747U, + 3918593370U, 2654263191U, 753973209U, 36408145U, + 2530585658U, 25011837U, 3520020182U, 2088578344U, + 530523599U, 2918365339U, 1524020338U, 1518925132U, + 3760827505U, 3759777254U, 1202760957U, 3985898139U, + 3906192525U, 674977740U, 4174734889U, 2031300136U, + 2019492241U, 3983892565U, 4153806404U, 3822280332U, + 352677332U, 2297720250U, 60907813U, 90501309U, + 3286998549U, 1016092578U, 2535922412U, 2839152426U, + 457141659U, 509813237U, 4120667899U, 652014361U, + 1966332200U, 2975202805U, 55981186U, 2327461051U, + 676427537U, 3255491064U, 2882294119U, 3433927263U, + 1307055953U, 942726286U, 933058658U, 2468411793U, + 3933900994U, 4215176142U, 1361170020U, 2001714738U, + 2830558078U, 3274259782U, 1222529897U, 1679025792U, + 2729314320U, 3714953764U, 1770335741U, 151462246U, + 3013232138U, 1682292957U, 1483529935U, 471910574U, + 1539241949U, 458788160U, 3436315007U, 1807016891U, + 3718408830U, 978976581U, 1043663428U, 3165965781U, + 1927990952U, 4200891579U, 2372276910U, 3208408903U, + 3533431907U, 1412390302U, 2931980059U, 4132332400U, + 1947078029U, 3881505623U, 4168226417U, 2941484381U, + 1077988104U, 1320477388U, 886195818U, 18198404U, + 3786409000U, 2509781533U, 112762804U, 3463356488U, + 1866414978U, 891333506U, 18488651U, 661792760U, + 1628790961U, 3885187036U, 3141171499U, 876946877U, + 2693282273U, 1372485963U, 791857591U, 2686433993U, + 3759982718U, 3167212022U, 3472953795U, 2716379847U, + 445679433U, 3561995674U, 3504004811U, 3574258232U, + 54117162U, 3331405415U, 2381918588U, 3769707343U, + 4154350007U, 1140177722U, 4074052095U, 668550556U, + 3214352940U, 367459370U, 261225585U, 2610173221U, + 4209349473U, 3468074219U, 3265815641U, 314222801U, + 3066103646U, 3808782860U, 282218597U, 3406013506U, + 3773591054U, 379116347U, 1285071038U, 846784868U, + 2669647154U, 3771962079U, 3550491691U, 2305946142U, + 453669953U, 1268987020U, 3317592352U, 3279303384U, + 3744833421U, 2610507566U, 3859509063U, 266596637U, + 3847019092U, 517658769U, 3462560207U, 3443424879U, + 370717030U, 4247526661U, 2224018117U, 4143653529U, + 4112773975U, 2788324899U, 2477274417U, 1456262402U, + 2901442914U, 1517677493U, 1846949527U, 2295493580U, + 3734397586U, 2176403920U, 1280348187U, 1908823572U, + 3871786941U, 846861322U, 1172426758U, 3287448474U, + 3383383037U, 1655181056U, 3139813346U, 901632758U, + 1897031941U, 2986607138U, 3066810236U, 3447102507U, + 1393639104U, 373351379U, 950779232U, 625454576U, + 3124240540U, 4148612726U, 2007998917U, 544563296U, + 2244738638U, 2330496472U, 2058025392U, 1291430526U, + 424198748U, 50039436U, 29584100U, 3605783033U, + 2429876329U, 2791104160U, 1057563949U, 3255363231U, + 3075367218U, 3463963227U, 1469046755U, 985887462U +}; + +NAMESPACE_END diff --git a/cryptopp/blowfish.cpp b/cryptopp/blowfish.cpp new file mode 100644 index 0000000..aaa637c --- /dev/null +++ b/cryptopp/blowfish.cpp @@ -0,0 +1,99 @@ +// blowfish.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "blowfish.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +void Blowfish::Base::UncheckedSetKey(const byte *key_string, unsigned int keylength, const NameValuePairs &) +{ + AssertValidKeyLength(keylength); + + unsigned i, j=0, k; + word32 data, dspace[2] = {0, 0}; + + memcpy(pbox, p_init, sizeof(p_init)); + memcpy(sbox, s_init, sizeof(s_init)); + + // Xor key string into encryption key vector + for (i=0 ; i Block; + + word32 left, right; + Block::Get(inBlock)(left)(right); + + const word32 *const s=sbox; + const word32 *p=pbox; + + left ^= p[0]; + + for (unsigned i=0; i, public VariableKeyLength<16, 1, 56>, public FixedRounds<16> +{ + static const char *StaticAlgorithmName() {return "Blowfish";} +}; + +//! Blowfish +class Blowfish : public Blowfish_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + void UncheckedSetKey(const byte *key_string, unsigned int keylength, const NameValuePairs ¶ms); + + private: + void crypt_block(const word32 in[2], word32 out[2]) const; + + static const word32 p_init[ROUNDS+2]; + static const word32 s_init[4*256]; + + FixedSizeSecBlock pbox; + FixedSizeSecBlock sbox; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef Blowfish::Encryption BlowfishEncryption; +typedef Blowfish::Decryption BlowfishDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/blumshub.cpp b/cryptopp/blumshub.cpp new file mode 100644 index 0000000..be9b758 --- /dev/null +++ b/cryptopp/blumshub.cpp @@ -0,0 +1,63 @@ +// blumshub.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "blumshub.h" + +NAMESPACE_BEGIN(CryptoPP) + +PublicBlumBlumShub::PublicBlumBlumShub(const Integer &n, const Integer &seed) + : modn(n), + maxBits(BitPrecision(n.BitCount())-1) +{ + current = modn.Square(modn.Square(seed)); + bitsLeft = maxBits; +} + +unsigned int PublicBlumBlumShub::GenerateBit() +{ + if (bitsLeft==0) + { + current = modn.Square(current); + bitsLeft = maxBits; + } + + return current.GetBit(--bitsLeft); +} + +byte PublicBlumBlumShub::GenerateByte() +{ + byte b=0; + for (int i=0; i<8; i++) + b = (b << 1) | PublicBlumBlumShub::GenerateBit(); + return b; +} + +void PublicBlumBlumShub::GenerateBlock(byte *output, size_t size) +{ + while (size--) + *output++ = PublicBlumBlumShub::GenerateByte(); +} + +void PublicBlumBlumShub::ProcessData(byte *outString, const byte *inString, size_t length) +{ + while (length--) + *outString++ = *inString++ ^ PublicBlumBlumShub::GenerateByte(); +} + +BlumBlumShub::BlumBlumShub(const Integer &p, const Integer &q, const Integer &seed) + : PublicBlumBlumShub(p*q, seed), + p(p), q(q), + x0(modn.Square(seed)) +{ +} + +void BlumBlumShub::Seek(lword index) +{ + Integer i(Integer::POSITIVE, index); + i *= 8; + Integer e = a_exp_b_mod_c (2, i / maxBits + 1, (p-1)*(q-1)); + current = modn.Exponentiate(x0, e); + bitsLeft = maxBits - i % maxBits; +} + +NAMESPACE_END diff --git a/cryptopp/blumshub.h b/cryptopp/blumshub.h new file mode 100644 index 0000000..5e50747 --- /dev/null +++ b/cryptopp/blumshub.h @@ -0,0 +1,53 @@ +#ifndef CRYPTOPP_BLUMSHUB_H +#define CRYPTOPP_BLUMSHUB_H + +#include "modarith.h" + +NAMESPACE_BEGIN(CryptoPP) + +class BlumGoldwasserPublicKey; +class BlumGoldwasserPrivateKey; + +//! BlumBlumShub without factorization of the modulus +class PublicBlumBlumShub : public RandomNumberGenerator, + public StreamTransformation +{ +public: + PublicBlumBlumShub(const Integer &n, const Integer &seed); + + unsigned int GenerateBit(); + byte GenerateByte(); + void GenerateBlock(byte *output, size_t size); + void ProcessData(byte *outString, const byte *inString, size_t length); + + bool IsSelfInverting() const {return true;} + bool IsForwardTransformation() const {return true;} + +protected: + ModularArithmetic modn; + word maxBits, bitsLeft; + Integer current; + + friend class BlumGoldwasserPublicKey; + friend class BlumGoldwasserPrivateKey; +}; + +//! BlumBlumShub with factorization of the modulus +class BlumBlumShub : public PublicBlumBlumShub +{ +public: + // Make sure p and q are both primes congruent to 3 mod 4 and at least 512 bits long, + // seed is the secret key and should be about as big as p*q + BlumBlumShub(const Integer &p, const Integer &q, const Integer &seed); + + bool IsRandomAccess() const {return true;} + void Seek(lword index); + +protected: + const Integer p, q; + const Integer x0; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/camellia.cpp b/cryptopp/camellia.cpp new file mode 100644 index 0000000..80b3e28 --- /dev/null +++ b/cryptopp/camellia.cpp @@ -0,0 +1,524 @@ +// camellia.cpp - by Kevin Springle, 2003 +// This code is hereby placed in the public domain. + +/* +Optimisations and defense against timing attacks added in Jan 2007 by Wei Dai. + +The first 2 rounds and the last round seem especially vulnerable to timing +attacks. The protection is similar to what was implemented for Rijndael. +See comments at top of rijndael.cpp for more details. +*/ + +#include "pch.h" + +#include "camellia.h" +#include "misc.h" +#include "cpu.h" + +NAMESPACE_BEGIN(CryptoPP) + +// round implementation that uses a small table for protection against timing attacks +#define SLOW_ROUND(lh, ll, rh, rl, kh, kl) { \ + word32 zr = ll ^ kl; \ + word32 zl = lh ^ kh; \ + zr= rotlFixed(s1[GETBYTE(zr, 3)], 1) | \ + (rotrFixed(s1[GETBYTE(zr, 2)], 1) << 24) | \ + (s1[rotlFixed(CRYPTOPP_GET_BYTE_AS_BYTE(zr, 1),1)] << 16) | \ + (s1[GETBYTE(zr, 0)] << 8); \ + zl= (s1[GETBYTE(zl, 3)] << 24) | \ + (rotlFixed(s1[GETBYTE(zl, 2)], 1) << 16) | \ + (rotrFixed(s1[GETBYTE(zl, 1)], 1) << 8) | \ + s1[rotlFixed(CRYPTOPP_GET_BYTE_AS_BYTE(zl, 0), 1)]; \ + zl ^= zr; \ + zr = zl ^ rotlFixed(zr, 8); \ + zl = zr ^ rotrFixed(zl, 8); \ + rh ^= rotlFixed(zr, 16); \ + rh ^= zl; \ + rl ^= rotlFixed(zl, 8); \ + } + +// normal round - same output as above but using larger tables for faster speed +#define ROUND(lh, ll, rh, rl, kh, kl) { \ + word32 th = lh ^ kh; \ + word32 tl = ll ^ kl; \ + word32 d = SP[0][GETBYTE(tl,0)] ^ SP[1][GETBYTE(tl,3)] ^ SP[2][GETBYTE(tl,2)] ^ SP[3][GETBYTE(tl,1)]; \ + word32 u = SP[0][GETBYTE(th,3)] ^ SP[1][GETBYTE(th,2)] ^ SP[2][GETBYTE(th,1)] ^ SP[3][GETBYTE(th,0)]; \ + d ^= u; \ + rh ^= d; \ + rl ^= d; \ + rl ^= rotrFixed(u, 8);} + +#define DOUBLE_ROUND(lh, ll, rh, rl, k0, k1, k2, k3) \ + ROUND(lh, ll, rh, rl, k0, k1) \ + ROUND(rh, rl, lh, ll, k2, k3) + +#ifdef IS_LITTLE_ENDIAN +#define EFI(i) (1-(i)) +#else +#define EFI(i) (i) +#endif + +void Camellia::Base::UncheckedSetKey(const byte *key, unsigned int keylen, const NameValuePairs &) +{ + m_rounds = (keylen >= 24) ? 4 : 3; + unsigned int kslen = (8 * m_rounds + 2); + m_key.New(kslen*2); + word32 *ks32 = m_key.data(); + int m=0, a=0; + if (!IsForwardTransformation()) + m = -1, a = kslen-1; + + word32 kl0, kl1, kl2, kl3; + GetBlock getBlock(key); + getBlock(kl0)(kl1)(kl2)(kl3); + word32 k0=kl0, k1=kl1, k2=kl2, k3=kl3; + +#define CALC_ADDR2(base, i, j) ((byte *)(base)+8*(i)+4*(j)+((-16*(i))&m)) +#define CALC_ADDR(base, i) CALC_ADDR2(base, i, 0) + +#if 1 + word64 kwl, kwr; + ks32 += 2*a; +#define PREPARE_KS_ROUNDS \ + kwl = (word64(k0) << 32) | k1; \ + kwr = (word64(k2) << 32) | k3 +#define KS_ROUND_0(i) \ + *(word64*)CALC_ADDR(ks32, i+EFI(0)) = kwl; \ + *(word64*)CALC_ADDR(ks32, i+EFI(1)) = kwr +#define KS_ROUND(i, r, which) \ + if (which & (1<> (64 - (r%64))); \ + if (which & (1<64))) *(word64*)CALC_ADDR(ks32, i+EFI(r>64)) = (kwl << (r%64)) | (kwr >> (64 - (r%64))) +#else + // SSE2 version is 30% faster on Intel Core 2. Doesn't seem worth the hassle of maintenance, but left here + // #if'd out in case someone needs it. + __m128i kw, kw2; + __m128i *ks128 = (__m128i *)ks32+a/2; + ks32 += 2*a; +#define PREPARE_KS_ROUNDS \ + kw = _mm_set_epi32(k0, k1, k2, k3); \ + if (m) kw2 = kw, kw = _mm_shuffle_epi32(kw, _MM_SHUFFLE(1, 0, 3, 2)); \ + else kw2 = _mm_shuffle_epi32(kw, _MM_SHUFFLE(1, 0, 3, 2)) +#define KS_ROUND_0(i) \ + _mm_store_si128((__m128i *)CALC_ADDR(ks128, i), kw) +#define KS_ROUND(i, r, which) { \ + __m128i temp; \ + if (r<64 && (which!=1 || m)) temp = _mm_or_si128(_mm_slli_epi64(kw, r%64), _mm_srli_epi64(kw2, 64-r%64)); \ + else temp = _mm_or_si128(_mm_slli_epi64(kw2, r%64), _mm_srli_epi64(kw, 64-r%64)); \ + if (which & 2) _mm_store_si128((__m128i *)CALC_ADDR(ks128, i), temp); \ + else _mm_storel_epi64((__m128i*)CALC_ADDR(ks32, i+EFI(0)), temp); \ + } +#endif + + if (keylen == 16) + { + // KL + PREPARE_KS_ROUNDS; + KS_ROUND_0(0); + KS_ROUND(4, 15, 3); + KS_ROUND(10, 45, 3); + KS_ROUND(12, 60, 2); + KS_ROUND(16, 77, 3); + KS_ROUND(18, 94, 3); + KS_ROUND(22, 111, 3); + + // KA + k0=kl0, k1=kl1, k2=kl2, k3=kl3; + DOUBLE_ROUND(k0, k1, k2, k3, 0xA09E667Ful, 0x3BCC908Bul, 0xB67AE858ul, 0x4CAA73B2ul); + k0^=kl0, k1^=kl1, k2^=kl2, k3^=kl3; + DOUBLE_ROUND(k0, k1, k2, k3, 0xC6EF372Ful, 0xE94F82BEul, 0x54FF53A5ul, 0xF1D36F1Cul); + + PREPARE_KS_ROUNDS; + KS_ROUND_0(2); + KS_ROUND(6, 15, 3); + KS_ROUND(8, 30, 3); + KS_ROUND(12, 45, 1); + KS_ROUND(14, 60, 3); + KS_ROUND(20, 94, 3); + KS_ROUND(24, 47, 3); + } + else + { + // KL + PREPARE_KS_ROUNDS; + KS_ROUND_0(0); + KS_ROUND(12, 45, 3); + KS_ROUND(16, 60, 3); + KS_ROUND(22, 77, 3); + KS_ROUND(30, 111, 3); + + // KR + word32 kr0, kr1, kr2, kr3; + GetBlock(key+16)(kr0)(kr1); + if (keylen == 24) + kr2 = ~kr0, kr3 = ~kr1; + else + GetBlock(key+24)(kr2)(kr3); + k0=kr0, k1=kr1, k2=kr2, k3=kr3; + + PREPARE_KS_ROUNDS; + KS_ROUND(4, 15, 3); + KS_ROUND(8, 30, 3); + KS_ROUND(18, 60, 3); + KS_ROUND(26, 94, 3); + + // KA + k0^=kl0, k1^=kl1, k2^=kl2, k3^=kl3; + DOUBLE_ROUND(k0, k1, k2, k3, 0xA09E667Ful, 0x3BCC908Bul, 0xB67AE858ul, 0x4CAA73B2ul); + k0^=kl0, k1^=kl1, k2^=kl2, k3^=kl3; + DOUBLE_ROUND(k0, k1, k2, k3, 0xC6EF372Ful, 0xE94F82BEul, 0x54FF53A5ul, 0xF1D36F1Cul); + + PREPARE_KS_ROUNDS; + KS_ROUND(6, 15, 3); + KS_ROUND(14, 45, 3); + KS_ROUND(24, 77, 3); + KS_ROUND(28, 94, 3); + + // KB + k0^=kr0, k1^=kr1, k2^=kr2, k3^=kr3; + DOUBLE_ROUND(k0, k1, k2, k3, 0x10E527FAul, 0xDE682D1Dul, 0xB05688C2ul, 0xB3E6C1FDul); + + PREPARE_KS_ROUNDS; + KS_ROUND_0(2); + KS_ROUND(10, 30, 3); + KS_ROUND(20, 60, 3); + KS_ROUND(32, 47, 3); + } +} + +void Camellia::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ +#define KS(i, j) ks[i*4 + EFI(j/2)*2 + EFI(j%2)] + +#define FL(klh, kll, krh, krl) \ + ll ^= rotlFixed(lh & klh, 1); \ + lh ^= (ll | kll); \ + rh ^= (rl | krl); \ + rl ^= rotlFixed(rh & krh, 1); + + word32 lh, ll, rh, rl; + typedef BlockGetAndPut Block; + Block::Get(inBlock)(lh)(ll)(rh)(rl); + const word32 *ks = m_key.data(); + lh ^= KS(0,0); + ll ^= KS(0,1); + rh ^= KS(0,2); + rl ^= KS(0,3); + + // timing attack countermeasure. see comments at top for more details + const int cacheLineSize = GetCacheLineSize(); + unsigned int i; + word32 u = 0; + for (i=0; i<256; i+=cacheLineSize) + u &= *(const word32 *)(s1+i); + u &= *(const word32 *)(s1+252); + lh |= u; ll |= u; + + SLOW_ROUND(lh, ll, rh, rl, KS(1,0), KS(1,1)) + SLOW_ROUND(rh, rl, lh, ll, KS(1,2), KS(1,3)) + for (i = m_rounds-1; i > 0; --i) + { + DOUBLE_ROUND(lh, ll, rh, rl, KS(2,0), KS(2,1), KS(2,2), KS(2,3)) + DOUBLE_ROUND(lh, ll, rh, rl, KS(3,0), KS(3,1), KS(3,2), KS(3,3)) + FL(KS(4,0), KS(4,1), KS(4,2), KS(4,3)); + DOUBLE_ROUND(lh, ll, rh, rl, KS(5,0), KS(5,1), KS(5,2), KS(5,3)) + ks += 16; + } + DOUBLE_ROUND(lh, ll, rh, rl, KS(2,0), KS(2,1), KS(2,2), KS(2,3)) + ROUND(lh, ll, rh, rl, KS(3,0), KS(3,1)) + SLOW_ROUND(rh, rl, lh, ll, KS(3,2), KS(3,3)) + lh ^= KS(4,0); + ll ^= KS(4,1); + rh ^= KS(4,2); + rl ^= KS(4,3); + Block::Put(xorBlock, outBlock)(rh)(rl)(lh)(ll); +} + +// The Camellia s-boxes + +const byte Camellia::Base::s1[256] = +{ + 112,130,44,236,179,39,192,229,228,133,87,53,234,12,174,65, + 35,239,107,147,69,25,165,33,237,14,79,78,29,101,146,189, + 134,184,175,143,124,235,31,206,62,48,220,95,94,197,11,26, + 166,225,57,202,213,71,93,61,217,1,90,214,81,86,108,77, + 139,13,154,102,251,204,176,45,116,18,43,32,240,177,132,153, + 223,76,203,194,52,126,118,5,109,183,169,49,209,23,4,215, + 20,88,58,97,222,27,17,28,50,15,156,22,83,24,242,34, + 254,68,207,178,195,181,122,145,36,8,232,168,96,252,105,80, + 170,208,160,125,161,137,98,151,84,91,30,149,224,255,100,210, + 16,196,0,72,163,247,117,219,138,3,230,218,9,63,221,148, + 135,92,131,2,205,74,144,51,115,103,246,243,157,127,191,226, + 82,155,216,38,200,55,198,59,129,150,111,75,19,190,99,46, + 233,121,167,140,159,110,188,142,41,245,249,182,47,253,180,89, + 120,152,6,106,231,70,113,186,212,37,171,66,136,162,141,250, + 114,7,185,85,248,238,172,10,54,73,42,104,60,56,241,164, + 64,40,211,123,187,201,67,193,21,227,173,244,119,199,128,158 +}; + +const word32 Camellia::Base::SP[4][256] = { + { + 0x70707000, 0x82828200, 0x2c2c2c00, 0xececec00, + 0xb3b3b300, 0x27272700, 0xc0c0c000, 0xe5e5e500, + 0xe4e4e400, 0x85858500, 0x57575700, 0x35353500, + 0xeaeaea00, 0x0c0c0c00, 0xaeaeae00, 0x41414100, + 0x23232300, 0xefefef00, 0x6b6b6b00, 0x93939300, + 0x45454500, 0x19191900, 0xa5a5a500, 0x21212100, + 0xededed00, 0x0e0e0e00, 0x4f4f4f00, 0x4e4e4e00, + 0x1d1d1d00, 0x65656500, 0x92929200, 0xbdbdbd00, + 0x86868600, 0xb8b8b800, 0xafafaf00, 0x8f8f8f00, + 0x7c7c7c00, 0xebebeb00, 0x1f1f1f00, 0xcecece00, + 0x3e3e3e00, 0x30303000, 0xdcdcdc00, 0x5f5f5f00, + 0x5e5e5e00, 0xc5c5c500, 0x0b0b0b00, 0x1a1a1a00, + 0xa6a6a600, 0xe1e1e100, 0x39393900, 0xcacaca00, + 0xd5d5d500, 0x47474700, 0x5d5d5d00, 0x3d3d3d00, + 0xd9d9d900, 0x01010100, 0x5a5a5a00, 0xd6d6d600, + 0x51515100, 0x56565600, 0x6c6c6c00, 0x4d4d4d00, + 0x8b8b8b00, 0x0d0d0d00, 0x9a9a9a00, 0x66666600, + 0xfbfbfb00, 0xcccccc00, 0xb0b0b000, 0x2d2d2d00, + 0x74747400, 0x12121200, 0x2b2b2b00, 0x20202000, + 0xf0f0f000, 0xb1b1b100, 0x84848400, 0x99999900, + 0xdfdfdf00, 0x4c4c4c00, 0xcbcbcb00, 0xc2c2c200, + 0x34343400, 0x7e7e7e00, 0x76767600, 0x05050500, + 0x6d6d6d00, 0xb7b7b700, 0xa9a9a900, 0x31313100, + 0xd1d1d100, 0x17171700, 0x04040400, 0xd7d7d700, + 0x14141400, 0x58585800, 0x3a3a3a00, 0x61616100, + 0xdedede00, 0x1b1b1b00, 0x11111100, 0x1c1c1c00, + 0x32323200, 0x0f0f0f00, 0x9c9c9c00, 0x16161600, + 0x53535300, 0x18181800, 0xf2f2f200, 0x22222200, + 0xfefefe00, 0x44444400, 0xcfcfcf00, 0xb2b2b200, + 0xc3c3c300, 0xb5b5b500, 0x7a7a7a00, 0x91919100, + 0x24242400, 0x08080800, 0xe8e8e800, 0xa8a8a800, + 0x60606000, 0xfcfcfc00, 0x69696900, 0x50505000, + 0xaaaaaa00, 0xd0d0d000, 0xa0a0a000, 0x7d7d7d00, + 0xa1a1a100, 0x89898900, 0x62626200, 0x97979700, + 0x54545400, 0x5b5b5b00, 0x1e1e1e00, 0x95959500, + 0xe0e0e000, 0xffffff00, 0x64646400, 0xd2d2d200, + 0x10101000, 0xc4c4c400, 0x00000000, 0x48484800, + 0xa3a3a300, 0xf7f7f700, 0x75757500, 0xdbdbdb00, + 0x8a8a8a00, 0x03030300, 0xe6e6e600, 0xdadada00, + 0x09090900, 0x3f3f3f00, 0xdddddd00, 0x94949400, + 0x87878700, 0x5c5c5c00, 0x83838300, 0x02020200, + 0xcdcdcd00, 0x4a4a4a00, 0x90909000, 0x33333300, + 0x73737300, 0x67676700, 0xf6f6f600, 0xf3f3f300, + 0x9d9d9d00, 0x7f7f7f00, 0xbfbfbf00, 0xe2e2e200, + 0x52525200, 0x9b9b9b00, 0xd8d8d800, 0x26262600, + 0xc8c8c800, 0x37373700, 0xc6c6c600, 0x3b3b3b00, + 0x81818100, 0x96969600, 0x6f6f6f00, 0x4b4b4b00, + 0x13131300, 0xbebebe00, 0x63636300, 0x2e2e2e00, + 0xe9e9e900, 0x79797900, 0xa7a7a700, 0x8c8c8c00, + 0x9f9f9f00, 0x6e6e6e00, 0xbcbcbc00, 0x8e8e8e00, + 0x29292900, 0xf5f5f500, 0xf9f9f900, 0xb6b6b600, + 0x2f2f2f00, 0xfdfdfd00, 0xb4b4b400, 0x59595900, + 0x78787800, 0x98989800, 0x06060600, 0x6a6a6a00, + 0xe7e7e700, 0x46464600, 0x71717100, 0xbababa00, + 0xd4d4d400, 0x25252500, 0xababab00, 0x42424200, + 0x88888800, 0xa2a2a200, 0x8d8d8d00, 0xfafafa00, + 0x72727200, 0x07070700, 0xb9b9b900, 0x55555500, + 0xf8f8f800, 0xeeeeee00, 0xacacac00, 0x0a0a0a00, + 0x36363600, 0x49494900, 0x2a2a2a00, 0x68686800, + 0x3c3c3c00, 0x38383800, 0xf1f1f100, 0xa4a4a400, + 0x40404000, 0x28282800, 0xd3d3d300, 0x7b7b7b00, + 0xbbbbbb00, 0xc9c9c900, 0x43434300, 0xc1c1c100, + 0x15151500, 0xe3e3e300, 0xadadad00, 0xf4f4f400, + 0x77777700, 0xc7c7c700, 0x80808000, 0x9e9e9e00 + }, + { + 0x00e0e0e0, 0x00050505, 0x00585858, 0x00d9d9d9, + 0x00676767, 0x004e4e4e, 0x00818181, 0x00cbcbcb, + 0x00c9c9c9, 0x000b0b0b, 0x00aeaeae, 0x006a6a6a, + 0x00d5d5d5, 0x00181818, 0x005d5d5d, 0x00828282, + 0x00464646, 0x00dfdfdf, 0x00d6d6d6, 0x00272727, + 0x008a8a8a, 0x00323232, 0x004b4b4b, 0x00424242, + 0x00dbdbdb, 0x001c1c1c, 0x009e9e9e, 0x009c9c9c, + 0x003a3a3a, 0x00cacaca, 0x00252525, 0x007b7b7b, + 0x000d0d0d, 0x00717171, 0x005f5f5f, 0x001f1f1f, + 0x00f8f8f8, 0x00d7d7d7, 0x003e3e3e, 0x009d9d9d, + 0x007c7c7c, 0x00606060, 0x00b9b9b9, 0x00bebebe, + 0x00bcbcbc, 0x008b8b8b, 0x00161616, 0x00343434, + 0x004d4d4d, 0x00c3c3c3, 0x00727272, 0x00959595, + 0x00ababab, 0x008e8e8e, 0x00bababa, 0x007a7a7a, + 0x00b3b3b3, 0x00020202, 0x00b4b4b4, 0x00adadad, + 0x00a2a2a2, 0x00acacac, 0x00d8d8d8, 0x009a9a9a, + 0x00171717, 0x001a1a1a, 0x00353535, 0x00cccccc, + 0x00f7f7f7, 0x00999999, 0x00616161, 0x005a5a5a, + 0x00e8e8e8, 0x00242424, 0x00565656, 0x00404040, + 0x00e1e1e1, 0x00636363, 0x00090909, 0x00333333, + 0x00bfbfbf, 0x00989898, 0x00979797, 0x00858585, + 0x00686868, 0x00fcfcfc, 0x00ececec, 0x000a0a0a, + 0x00dadada, 0x006f6f6f, 0x00535353, 0x00626262, + 0x00a3a3a3, 0x002e2e2e, 0x00080808, 0x00afafaf, + 0x00282828, 0x00b0b0b0, 0x00747474, 0x00c2c2c2, + 0x00bdbdbd, 0x00363636, 0x00222222, 0x00383838, + 0x00646464, 0x001e1e1e, 0x00393939, 0x002c2c2c, + 0x00a6a6a6, 0x00303030, 0x00e5e5e5, 0x00444444, + 0x00fdfdfd, 0x00888888, 0x009f9f9f, 0x00656565, + 0x00878787, 0x006b6b6b, 0x00f4f4f4, 0x00232323, + 0x00484848, 0x00101010, 0x00d1d1d1, 0x00515151, + 0x00c0c0c0, 0x00f9f9f9, 0x00d2d2d2, 0x00a0a0a0, + 0x00555555, 0x00a1a1a1, 0x00414141, 0x00fafafa, + 0x00434343, 0x00131313, 0x00c4c4c4, 0x002f2f2f, + 0x00a8a8a8, 0x00b6b6b6, 0x003c3c3c, 0x002b2b2b, + 0x00c1c1c1, 0x00ffffff, 0x00c8c8c8, 0x00a5a5a5, + 0x00202020, 0x00898989, 0x00000000, 0x00909090, + 0x00474747, 0x00efefef, 0x00eaeaea, 0x00b7b7b7, + 0x00151515, 0x00060606, 0x00cdcdcd, 0x00b5b5b5, + 0x00121212, 0x007e7e7e, 0x00bbbbbb, 0x00292929, + 0x000f0f0f, 0x00b8b8b8, 0x00070707, 0x00040404, + 0x009b9b9b, 0x00949494, 0x00212121, 0x00666666, + 0x00e6e6e6, 0x00cecece, 0x00ededed, 0x00e7e7e7, + 0x003b3b3b, 0x00fefefe, 0x007f7f7f, 0x00c5c5c5, + 0x00a4a4a4, 0x00373737, 0x00b1b1b1, 0x004c4c4c, + 0x00919191, 0x006e6e6e, 0x008d8d8d, 0x00767676, + 0x00030303, 0x002d2d2d, 0x00dedede, 0x00969696, + 0x00262626, 0x007d7d7d, 0x00c6c6c6, 0x005c5c5c, + 0x00d3d3d3, 0x00f2f2f2, 0x004f4f4f, 0x00191919, + 0x003f3f3f, 0x00dcdcdc, 0x00797979, 0x001d1d1d, + 0x00525252, 0x00ebebeb, 0x00f3f3f3, 0x006d6d6d, + 0x005e5e5e, 0x00fbfbfb, 0x00696969, 0x00b2b2b2, + 0x00f0f0f0, 0x00313131, 0x000c0c0c, 0x00d4d4d4, + 0x00cfcfcf, 0x008c8c8c, 0x00e2e2e2, 0x00757575, + 0x00a9a9a9, 0x004a4a4a, 0x00575757, 0x00848484, + 0x00111111, 0x00454545, 0x001b1b1b, 0x00f5f5f5, + 0x00e4e4e4, 0x000e0e0e, 0x00737373, 0x00aaaaaa, + 0x00f1f1f1, 0x00dddddd, 0x00595959, 0x00141414, + 0x006c6c6c, 0x00929292, 0x00545454, 0x00d0d0d0, + 0x00787878, 0x00707070, 0x00e3e3e3, 0x00494949, + 0x00808080, 0x00505050, 0x00a7a7a7, 0x00f6f6f6, + 0x00777777, 0x00939393, 0x00868686, 0x00838383, + 0x002a2a2a, 0x00c7c7c7, 0x005b5b5b, 0x00e9e9e9, + 0x00eeeeee, 0x008f8f8f, 0x00010101, 0x003d3d3d + }, + { + 0x38003838, 0x41004141, 0x16001616, 0x76007676, + 0xd900d9d9, 0x93009393, 0x60006060, 0xf200f2f2, + 0x72007272, 0xc200c2c2, 0xab00abab, 0x9a009a9a, + 0x75007575, 0x06000606, 0x57005757, 0xa000a0a0, + 0x91009191, 0xf700f7f7, 0xb500b5b5, 0xc900c9c9, + 0xa200a2a2, 0x8c008c8c, 0xd200d2d2, 0x90009090, + 0xf600f6f6, 0x07000707, 0xa700a7a7, 0x27002727, + 0x8e008e8e, 0xb200b2b2, 0x49004949, 0xde00dede, + 0x43004343, 0x5c005c5c, 0xd700d7d7, 0xc700c7c7, + 0x3e003e3e, 0xf500f5f5, 0x8f008f8f, 0x67006767, + 0x1f001f1f, 0x18001818, 0x6e006e6e, 0xaf00afaf, + 0x2f002f2f, 0xe200e2e2, 0x85008585, 0x0d000d0d, + 0x53005353, 0xf000f0f0, 0x9c009c9c, 0x65006565, + 0xea00eaea, 0xa300a3a3, 0xae00aeae, 0x9e009e9e, + 0xec00ecec, 0x80008080, 0x2d002d2d, 0x6b006b6b, + 0xa800a8a8, 0x2b002b2b, 0x36003636, 0xa600a6a6, + 0xc500c5c5, 0x86008686, 0x4d004d4d, 0x33003333, + 0xfd00fdfd, 0x66006666, 0x58005858, 0x96009696, + 0x3a003a3a, 0x09000909, 0x95009595, 0x10001010, + 0x78007878, 0xd800d8d8, 0x42004242, 0xcc00cccc, + 0xef00efef, 0x26002626, 0xe500e5e5, 0x61006161, + 0x1a001a1a, 0x3f003f3f, 0x3b003b3b, 0x82008282, + 0xb600b6b6, 0xdb00dbdb, 0xd400d4d4, 0x98009898, + 0xe800e8e8, 0x8b008b8b, 0x02000202, 0xeb00ebeb, + 0x0a000a0a, 0x2c002c2c, 0x1d001d1d, 0xb000b0b0, + 0x6f006f6f, 0x8d008d8d, 0x88008888, 0x0e000e0e, + 0x19001919, 0x87008787, 0x4e004e4e, 0x0b000b0b, + 0xa900a9a9, 0x0c000c0c, 0x79007979, 0x11001111, + 0x7f007f7f, 0x22002222, 0xe700e7e7, 0x59005959, + 0xe100e1e1, 0xda00dada, 0x3d003d3d, 0xc800c8c8, + 0x12001212, 0x04000404, 0x74007474, 0x54005454, + 0x30003030, 0x7e007e7e, 0xb400b4b4, 0x28002828, + 0x55005555, 0x68006868, 0x50005050, 0xbe00bebe, + 0xd000d0d0, 0xc400c4c4, 0x31003131, 0xcb00cbcb, + 0x2a002a2a, 0xad00adad, 0x0f000f0f, 0xca00caca, + 0x70007070, 0xff00ffff, 0x32003232, 0x69006969, + 0x08000808, 0x62006262, 0x00000000, 0x24002424, + 0xd100d1d1, 0xfb00fbfb, 0xba00baba, 0xed00eded, + 0x45004545, 0x81008181, 0x73007373, 0x6d006d6d, + 0x84008484, 0x9f009f9f, 0xee00eeee, 0x4a004a4a, + 0xc300c3c3, 0x2e002e2e, 0xc100c1c1, 0x01000101, + 0xe600e6e6, 0x25002525, 0x48004848, 0x99009999, + 0xb900b9b9, 0xb300b3b3, 0x7b007b7b, 0xf900f9f9, + 0xce00cece, 0xbf00bfbf, 0xdf00dfdf, 0x71007171, + 0x29002929, 0xcd00cdcd, 0x6c006c6c, 0x13001313, + 0x64006464, 0x9b009b9b, 0x63006363, 0x9d009d9d, + 0xc000c0c0, 0x4b004b4b, 0xb700b7b7, 0xa500a5a5, + 0x89008989, 0x5f005f5f, 0xb100b1b1, 0x17001717, + 0xf400f4f4, 0xbc00bcbc, 0xd300d3d3, 0x46004646, + 0xcf00cfcf, 0x37003737, 0x5e005e5e, 0x47004747, + 0x94009494, 0xfa00fafa, 0xfc00fcfc, 0x5b005b5b, + 0x97009797, 0xfe00fefe, 0x5a005a5a, 0xac00acac, + 0x3c003c3c, 0x4c004c4c, 0x03000303, 0x35003535, + 0xf300f3f3, 0x23002323, 0xb800b8b8, 0x5d005d5d, + 0x6a006a6a, 0x92009292, 0xd500d5d5, 0x21002121, + 0x44004444, 0x51005151, 0xc600c6c6, 0x7d007d7d, + 0x39003939, 0x83008383, 0xdc00dcdc, 0xaa00aaaa, + 0x7c007c7c, 0x77007777, 0x56005656, 0x05000505, + 0x1b001b1b, 0xa400a4a4, 0x15001515, 0x34003434, + 0x1e001e1e, 0x1c001c1c, 0xf800f8f8, 0x52005252, + 0x20002020, 0x14001414, 0xe900e9e9, 0xbd00bdbd, + 0xdd00dddd, 0xe400e4e4, 0xa100a1a1, 0xe000e0e0, + 0x8a008a8a, 0xf100f1f1, 0xd600d6d6, 0x7a007a7a, + 0xbb00bbbb, 0xe300e3e3, 0x40004040, 0x4f004f4f + }, + { + 0x70700070, 0x2c2c002c, 0xb3b300b3, 0xc0c000c0, + 0xe4e400e4, 0x57570057, 0xeaea00ea, 0xaeae00ae, + 0x23230023, 0x6b6b006b, 0x45450045, 0xa5a500a5, + 0xeded00ed, 0x4f4f004f, 0x1d1d001d, 0x92920092, + 0x86860086, 0xafaf00af, 0x7c7c007c, 0x1f1f001f, + 0x3e3e003e, 0xdcdc00dc, 0x5e5e005e, 0x0b0b000b, + 0xa6a600a6, 0x39390039, 0xd5d500d5, 0x5d5d005d, + 0xd9d900d9, 0x5a5a005a, 0x51510051, 0x6c6c006c, + 0x8b8b008b, 0x9a9a009a, 0xfbfb00fb, 0xb0b000b0, + 0x74740074, 0x2b2b002b, 0xf0f000f0, 0x84840084, + 0xdfdf00df, 0xcbcb00cb, 0x34340034, 0x76760076, + 0x6d6d006d, 0xa9a900a9, 0xd1d100d1, 0x04040004, + 0x14140014, 0x3a3a003a, 0xdede00de, 0x11110011, + 0x32320032, 0x9c9c009c, 0x53530053, 0xf2f200f2, + 0xfefe00fe, 0xcfcf00cf, 0xc3c300c3, 0x7a7a007a, + 0x24240024, 0xe8e800e8, 0x60600060, 0x69690069, + 0xaaaa00aa, 0xa0a000a0, 0xa1a100a1, 0x62620062, + 0x54540054, 0x1e1e001e, 0xe0e000e0, 0x64640064, + 0x10100010, 0x00000000, 0xa3a300a3, 0x75750075, + 0x8a8a008a, 0xe6e600e6, 0x09090009, 0xdddd00dd, + 0x87870087, 0x83830083, 0xcdcd00cd, 0x90900090, + 0x73730073, 0xf6f600f6, 0x9d9d009d, 0xbfbf00bf, + 0x52520052, 0xd8d800d8, 0xc8c800c8, 0xc6c600c6, + 0x81810081, 0x6f6f006f, 0x13130013, 0x63630063, + 0xe9e900e9, 0xa7a700a7, 0x9f9f009f, 0xbcbc00bc, + 0x29290029, 0xf9f900f9, 0x2f2f002f, 0xb4b400b4, + 0x78780078, 0x06060006, 0xe7e700e7, 0x71710071, + 0xd4d400d4, 0xabab00ab, 0x88880088, 0x8d8d008d, + 0x72720072, 0xb9b900b9, 0xf8f800f8, 0xacac00ac, + 0x36360036, 0x2a2a002a, 0x3c3c003c, 0xf1f100f1, + 0x40400040, 0xd3d300d3, 0xbbbb00bb, 0x43430043, + 0x15150015, 0xadad00ad, 0x77770077, 0x80800080, + 0x82820082, 0xecec00ec, 0x27270027, 0xe5e500e5, + 0x85850085, 0x35350035, 0x0c0c000c, 0x41410041, + 0xefef00ef, 0x93930093, 0x19190019, 0x21210021, + 0x0e0e000e, 0x4e4e004e, 0x65650065, 0xbdbd00bd, + 0xb8b800b8, 0x8f8f008f, 0xebeb00eb, 0xcece00ce, + 0x30300030, 0x5f5f005f, 0xc5c500c5, 0x1a1a001a, + 0xe1e100e1, 0xcaca00ca, 0x47470047, 0x3d3d003d, + 0x01010001, 0xd6d600d6, 0x56560056, 0x4d4d004d, + 0x0d0d000d, 0x66660066, 0xcccc00cc, 0x2d2d002d, + 0x12120012, 0x20200020, 0xb1b100b1, 0x99990099, + 0x4c4c004c, 0xc2c200c2, 0x7e7e007e, 0x05050005, + 0xb7b700b7, 0x31310031, 0x17170017, 0xd7d700d7, + 0x58580058, 0x61610061, 0x1b1b001b, 0x1c1c001c, + 0x0f0f000f, 0x16160016, 0x18180018, 0x22220022, + 0x44440044, 0xb2b200b2, 0xb5b500b5, 0x91910091, + 0x08080008, 0xa8a800a8, 0xfcfc00fc, 0x50500050, + 0xd0d000d0, 0x7d7d007d, 0x89890089, 0x97970097, + 0x5b5b005b, 0x95950095, 0xffff00ff, 0xd2d200d2, + 0xc4c400c4, 0x48480048, 0xf7f700f7, 0xdbdb00db, + 0x03030003, 0xdada00da, 0x3f3f003f, 0x94940094, + 0x5c5c005c, 0x02020002, 0x4a4a004a, 0x33330033, + 0x67670067, 0xf3f300f3, 0x7f7f007f, 0xe2e200e2, + 0x9b9b009b, 0x26260026, 0x37370037, 0x3b3b003b, + 0x96960096, 0x4b4b004b, 0xbebe00be, 0x2e2e002e, + 0x79790079, 0x8c8c008c, 0x6e6e006e, 0x8e8e008e, + 0xf5f500f5, 0xb6b600b6, 0xfdfd00fd, 0x59590059, + 0x98980098, 0x6a6a006a, 0x46460046, 0xbaba00ba, + 0x25250025, 0x42420042, 0xa2a200a2, 0xfafa00fa, + 0x07070007, 0x55550055, 0xeeee00ee, 0x0a0a000a, + 0x49490049, 0x68680068, 0x38380038, 0xa4a400a4, + 0x28280028, 0x7b7b007b, 0xc9c900c9, 0xc1c100c1, + 0xe3e300e3, 0xf4f400f4, 0xc7c700c7, 0x9e9e009e + }}; + +NAMESPACE_END diff --git a/cryptopp/camellia.h b/cryptopp/camellia.h new file mode 100644 index 0000000..d8700cb --- /dev/null +++ b/cryptopp/camellia.h @@ -0,0 +1,47 @@ +#ifndef CRYPTOPP_CAMELLIA_H +#define CRYPTOPP_CAMELLIA_H + +#include "config.h" + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct Camellia_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8> +{ + static const char *StaticAlgorithmName() {return "Camellia";} +}; + +/// Camellia +class Camellia : public Camellia_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *key, unsigned int keylen, const NameValuePairs ¶ms); + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + + protected: + static const byte s1[256]; + static const word32 SP[4][256]; + + unsigned int m_rounds; + SecBlock m_key; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef Camellia::Encryption CamelliaEncryption; +typedef Camellia::Decryption CamelliaDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/cast.cpp b/cryptopp/cast.cpp new file mode 100644 index 0000000..ef0a5ef --- /dev/null +++ b/cryptopp/cast.cpp @@ -0,0 +1,296 @@ +// cast.cpp - written and placed in the public domain by Wei Dai and Leonard Janke +// based on Steve Reid's public domain cast.c + +#include "pch.h" +#include "cast.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +/* Macros to access 8-bit bytes out of a 32-bit word */ +#define U8a(x) GETBYTE(x,3) +#define U8b(x) GETBYTE(x,2) +#define U8c(x) GETBYTE(x,1) +#define U8d(x) GETBYTE(x,0) + +/* CAST uses three different round functions */ +#define f1(l, r, km, kr) \ + t = rotlVariable(km + r, kr); \ + l ^= ((S[0][U8a(t)] ^ S[1][U8b(t)]) - \ + S[2][U8c(t)]) + S[3][U8d(t)]; +#define f2(l, r, km, kr) \ + t = rotlVariable(km ^ r, kr); \ + l ^= ((S[0][U8a(t)] - S[1][U8b(t)]) + \ + S[2][U8c(t)]) ^ S[3][U8d(t)]; +#define f3(l, r, km, kr) \ + t = rotlVariable(km - r, kr); \ + l ^= ((S[0][U8a(t)] + S[1][U8b(t)]) ^ \ + S[2][U8c(t)]) - S[3][U8d(t)]; + +#define F1(l, r, i, j) f1(l, r, K[i], K[i+j]) +#define F2(l, r, i, j) f2(l, r, K[i], K[i+j]) +#define F3(l, r, i, j) f3(l, r, K[i], K[i+j]) + +typedef BlockGetAndPut Block; + +void CAST128::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 t, l, r; + + /* Get inblock into l,r */ + Block::Get(inBlock)(l)(r); + /* Do the work */ + F1(l, r, 0, 16); + F2(r, l, 1, 16); + F3(l, r, 2, 16); + F1(r, l, 3, 16); + F2(l, r, 4, 16); + F3(r, l, 5, 16); + F1(l, r, 6, 16); + F2(r, l, 7, 16); + F3(l, r, 8, 16); + F1(r, l, 9, 16); + F2(l, r, 10, 16); + F3(r, l, 11, 16); + /* Only do full 16 rounds if key length > 80 bits */ + if (!reduced) { + F1(l, r, 12, 16); + F2(r, l, 13, 16); + F3(l, r, 14, 16); + F1(r, l, 15, 16); + } + /* Put l,r into outblock */ + Block::Put(xorBlock, outBlock)(r)(l); +} + +void CAST128::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 t, l, r; + + /* Get inblock into l,r */ + Block::Get(inBlock)(r)(l); + /* Only do full 16 rounds if key length > 80 bits */ + if (!reduced) { + F1(r, l, 15, 16); + F3(l, r, 14, 16); + F2(r, l, 13, 16); + F1(l, r, 12, 16); + } + F3(r, l, 11, 16); + F2(l, r, 10, 16); + F1(r, l, 9, 16); + F3(l, r, 8, 16); + F2(r, l, 7, 16); + F1(l, r, 6, 16); + F3(r, l, 5, 16); + F2(l, r, 4, 16); + F1(r, l, 3, 16); + F3(l, r, 2, 16); + F2(r, l, 1, 16); + F1(l, r, 0, 16); + /* Put l,r into outblock */ + Block::Put(xorBlock, outBlock)(l)(r); + /* Wipe clean */ + t = l = r = 0; +} + +void CAST128::Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &) +{ + AssertValidKeyLength(keylength); + + reduced = (keylength <= 10); + + word32 X[4], Z[4]; + GetUserKey(BIG_ENDIAN_ORDER, X, 4, userKey, keylength); + +#define x(i) GETBYTE(X[i/4], 3-i%4) +#define z(i) GETBYTE(Z[i/4], 3-i%4) + + unsigned int i; + for (i=0; i<=16; i+=16) + { + // this part is copied directly from RFC 2144 (with some search and replace) by Wei Dai + Z[0] = X[0] ^ S[4][x(0xD)] ^ S[5][x(0xF)] ^ S[6][x(0xC)] ^ S[7][x(0xE)] ^ S[6][x(0x8)]; + Z[1] = X[2] ^ S[4][z(0x0)] ^ S[5][z(0x2)] ^ S[6][z(0x1)] ^ S[7][z(0x3)] ^ S[7][x(0xA)]; + Z[2] = X[3] ^ S[4][z(0x7)] ^ S[5][z(0x6)] ^ S[6][z(0x5)] ^ S[7][z(0x4)] ^ S[4][x(0x9)]; + Z[3] = X[1] ^ S[4][z(0xA)] ^ S[5][z(0x9)] ^ S[6][z(0xB)] ^ S[7][z(0x8)] ^ S[5][x(0xB)]; + K[i+0] = S[4][z(0x8)] ^ S[5][z(0x9)] ^ S[6][z(0x7)] ^ S[7][z(0x6)] ^ S[4][z(0x2)]; + K[i+1] = S[4][z(0xA)] ^ S[5][z(0xB)] ^ S[6][z(0x5)] ^ S[7][z(0x4)] ^ S[5][z(0x6)]; + K[i+2] = S[4][z(0xC)] ^ S[5][z(0xD)] ^ S[6][z(0x3)] ^ S[7][z(0x2)] ^ S[6][z(0x9)]; + K[i+3] = S[4][z(0xE)] ^ S[5][z(0xF)] ^ S[6][z(0x1)] ^ S[7][z(0x0)] ^ S[7][z(0xC)]; + X[0] = Z[2] ^ S[4][z(0x5)] ^ S[5][z(0x7)] ^ S[6][z(0x4)] ^ S[7][z(0x6)] ^ S[6][z(0x0)]; + X[1] = Z[0] ^ S[4][x(0x0)] ^ S[5][x(0x2)] ^ S[6][x(0x1)] ^ S[7][x(0x3)] ^ S[7][z(0x2)]; + X[2] = Z[1] ^ S[4][x(0x7)] ^ S[5][x(0x6)] ^ S[6][x(0x5)] ^ S[7][x(0x4)] ^ S[4][z(0x1)]; + X[3] = Z[3] ^ S[4][x(0xA)] ^ S[5][x(0x9)] ^ S[6][x(0xB)] ^ S[7][x(0x8)] ^ S[5][z(0x3)]; + K[i+4] = S[4][x(0x3)] ^ S[5][x(0x2)] ^ S[6][x(0xC)] ^ S[7][x(0xD)] ^ S[4][x(0x8)]; + K[i+5] = S[4][x(0x1)] ^ S[5][x(0x0)] ^ S[6][x(0xE)] ^ S[7][x(0xF)] ^ S[5][x(0xD)]; + K[i+6] = S[4][x(0x7)] ^ S[5][x(0x6)] ^ S[6][x(0x8)] ^ S[7][x(0x9)] ^ S[6][x(0x3)]; + K[i+7] = S[4][x(0x5)] ^ S[5][x(0x4)] ^ S[6][x(0xA)] ^ S[7][x(0xB)] ^ S[7][x(0x7)]; + Z[0] = X[0] ^ S[4][x(0xD)] ^ S[5][x(0xF)] ^ S[6][x(0xC)] ^ S[7][x(0xE)] ^ S[6][x(0x8)]; + Z[1] = X[2] ^ S[4][z(0x0)] ^ S[5][z(0x2)] ^ S[6][z(0x1)] ^ S[7][z(0x3)] ^ S[7][x(0xA)]; + Z[2] = X[3] ^ S[4][z(0x7)] ^ S[5][z(0x6)] ^ S[6][z(0x5)] ^ S[7][z(0x4)] ^ S[4][x(0x9)]; + Z[3] = X[1] ^ S[4][z(0xA)] ^ S[5][z(0x9)] ^ S[6][z(0xB)] ^ S[7][z(0x8)] ^ S[5][x(0xB)]; + K[i+8] = S[4][z(0x3)] ^ S[5][z(0x2)] ^ S[6][z(0xC)] ^ S[7][z(0xD)] ^ S[4][z(0x9)]; + K[i+9] = S[4][z(0x1)] ^ S[5][z(0x0)] ^ S[6][z(0xE)] ^ S[7][z(0xF)] ^ S[5][z(0xC)]; + K[i+10] = S[4][z(0x7)] ^ S[5][z(0x6)] ^ S[6][z(0x8)] ^ S[7][z(0x9)] ^ S[6][z(0x2)]; + K[i+11] = S[4][z(0x5)] ^ S[5][z(0x4)] ^ S[6][z(0xA)] ^ S[7][z(0xB)] ^ S[7][z(0x6)]; + X[0] = Z[2] ^ S[4][z(0x5)] ^ S[5][z(0x7)] ^ S[6][z(0x4)] ^ S[7][z(0x6)] ^ S[6][z(0x0)]; + X[1] = Z[0] ^ S[4][x(0x0)] ^ S[5][x(0x2)] ^ S[6][x(0x1)] ^ S[7][x(0x3)] ^ S[7][z(0x2)]; + X[2] = Z[1] ^ S[4][x(0x7)] ^ S[5][x(0x6)] ^ S[6][x(0x5)] ^ S[7][x(0x4)] ^ S[4][z(0x1)]; + X[3] = Z[3] ^ S[4][x(0xA)] ^ S[5][x(0x9)] ^ S[6][x(0xB)] ^ S[7][x(0x8)] ^ S[5][z(0x3)]; + K[i+12] = S[4][x(0x8)] ^ S[5][x(0x9)] ^ S[6][x(0x7)] ^ S[7][x(0x6)] ^ S[4][x(0x3)]; + K[i+13] = S[4][x(0xA)] ^ S[5][x(0xB)] ^ S[6][x(0x5)] ^ S[7][x(0x4)] ^ S[5][x(0x7)]; + K[i+14] = S[4][x(0xC)] ^ S[5][x(0xD)] ^ S[6][x(0x3)] ^ S[7][x(0x2)] ^ S[6][x(0x8)]; + K[i+15] = S[4][x(0xE)] ^ S[5][x(0xF)] ^ S[6][x(0x1)] ^ S[7][x(0x0)] ^ S[7][x(0xD)]; + } + + for (i=16; i<32; i++) + K[i] &= 0x1f; +} + +// The following CAST-256 implementation was contributed by Leonard Janke + +const word32 CAST256::Base::t_m[8][24]={ +{ 0x5a827999, 0xd151d6a1, 0x482133a9, 0xbef090b1, 0x35bfedb9, 0xac8f4ac1, + 0x235ea7c9, 0x9a2e04d1, 0x10fd61d9, 0x87ccbee1, 0xfe9c1be9, 0x756b78f1, + 0xec3ad5f9, 0x630a3301, 0xd9d99009, 0x50a8ed11, 0xc7784a19, 0x3e47a721, + 0xb5170429, 0x2be66131, 0xa2b5be39, 0x19851b41, 0x90547849, 0x0723d551}, +{ 0xc95c653a, 0x402bc242, 0xb6fb1f4a, 0x2dca7c52, 0xa499d95a, 0x1b693662, + 0x9238936a, 0x0907f072, 0x7fd74d7a, 0xf6a6aa82, 0x6d76078a, 0xe4456492, + 0x5b14c19a, 0xd1e41ea2, 0x48b37baa, 0xbf82d8b2, 0x365235ba, 0xad2192c2, + 0x23f0efca, 0x9ac04cd2, 0x118fa9da, 0x885f06e2, 0xff2e63ea, 0x75fdc0f2}, +{ 0x383650db, 0xaf05ade3, 0x25d50aeb, 0x9ca467f3, 0x1373c4fb, 0x8a432203, + 0x01127f0b, 0x77e1dc13, 0xeeb1391b, 0x65809623, 0xdc4ff32b, 0x531f5033, + 0xc9eead3b, 0x40be0a43, 0xb78d674b, 0x2e5cc453, 0xa52c215b, 0x1bfb7e63, + 0x92cadb6b, 0x099a3873, 0x8069957b, 0xf738f283, 0x6e084f8b, 0xe4d7ac93}, +{ 0xa7103c7c, 0x1ddf9984, 0x94aef68c, 0x0b7e5394, 0x824db09c, 0xf91d0da4, + 0x6fec6aac, 0xe6bbc7b4, 0x5d8b24bc, 0xd45a81c4, 0x4b29decc, 0xc1f93bd4, + 0x38c898dc, 0xaf97f5e4, 0x266752ec, 0x9d36aff4, 0x14060cfc, 0x8ad56a04, + 0x01a4c70c, 0x78742414, 0xef43811c, 0x6612de24, 0xdce23b2c, 0x53b19834}, +{ 0x15ea281d, 0x8cb98525, 0x0388e22d, 0x7a583f35, 0xf1279c3d, 0x67f6f945, + 0xdec6564d, 0x5595b355, 0xcc65105d, 0x43346d65, 0xba03ca6d, 0x30d32775, + 0xa7a2847d, 0x1e71e185, 0x95413e8d, 0x0c109b95, 0x82dff89d, 0xf9af55a5, + 0x707eb2ad, 0xe74e0fb5, 0x5e1d6cbd, 0xd4ecc9c5, 0x4bbc26cd, 0xc28b83d5}, +{ 0x84c413be, 0xfb9370c6, 0x7262cdce, 0xe9322ad6, 0x600187de, 0xd6d0e4e6, + 0x4da041ee, 0xc46f9ef6, 0x3b3efbfe, 0xb20e5906, 0x28ddb60e, 0x9fad1316, + 0x167c701e, 0x8d4bcd26, 0x041b2a2e, 0x7aea8736, 0xf1b9e43e, 0x68894146, + 0xdf589e4e, 0x5627fb56, 0xccf7585e, 0x43c6b566, 0xba96126e, 0x31656f76}, +{ 0xf39dff5f, 0x6a6d5c67, 0xe13cb96f, 0x580c1677, 0xcedb737f, 0x45aad087, + 0xbc7a2d8f, 0x33498a97, 0xaa18e79f, 0x20e844a7, 0x97b7a1af, 0x0e86feb7, + 0x85565bbf, 0xfc25b8c7, 0x72f515cf, 0xe9c472d7, 0x6093cfdf, 0xd7632ce7, + 0x4e3289ef, 0xc501e6f7, 0x3bd143ff, 0xb2a0a107, 0x296ffe0f, 0xa03f5b17}, +{ 0x6277eb00, 0xd9474808, 0x5016a510, 0xc6e60218, 0x3db55f20, 0xb484bc28, + 0x2b541930, 0xa2237638, 0x18f2d340, 0x8fc23048, 0x06918d50, 0x7d60ea58, + 0xf4304760, 0x6affa468, 0xe1cf0170, 0x589e5e78, 0xcf6dbb80, 0x463d1888, + 0xbd0c7590, 0x33dbd298, 0xaaab2fa0, 0x217a8ca8, 0x9849e9b0, 0x0f1946b8} +}; + +const unsigned int CAST256::Base::t_r[8][24]={ + {19, 27, 3, 11, 19, 27, 3, 11, 19, 27, 3, 11, 19, 27, 3, 11, 19, 27, 3, 11, 19, 27, 3, 11}, + {4, 12, 20, 28, 4, 12, 20, 28, 4, 12, 20, 28, 4, 12, 20, 28, 4, 12, 20, 28, 4, 12, 20, 28}, + {21, 29, 5, 13, 21, 29, 5, 13, 21, 29, 5, 13, 21, 29, 5, 13, 21, 29, 5, 13, 21, 29, 5, 13}, + {6, 14, 22, 30, 6, 14, 22, 30, 6, 14, 22, 30, 6, 14, 22, 30, 6, 14, 22, 30, 6, 14, 22, 30}, + {23, 31, 7, 15, 23, 31, 7, 15, 23, 31, 7, 15, 23, 31, 7, 15, 23, 31, 7, 15, 23, 31, 7, 15}, + {8, 16, 24, 0, 8, 16, 24, 0, 8, 16, 24, 0, 8, 16, 24, 0, 8, 16, 24, 0, 8, 16, 24, 0}, + {25, 1, 9, 17, 25, 1, 9, 17, 25, 1, 9, 17, 25, 1, 9, 17, 25, 1, 9, 17, 25, 1, 9, 17}, + {10, 18, 26, 2, 10, 18, 26, 2, 10, 18, 26, 2, 10, 18, 26, 2, 10, 18, 26, 2, 10, 18, 26, 2} +}; + +#define Q(i) \ + F1(block[2],block[3],8*i+4,-4); \ + F2(block[1],block[2],8*i+5,-4); \ + F3(block[0],block[1],8*i+6,-4); \ + F1(block[3],block[0],8*i+7,-4); + +#define QBar(i) \ + F1(block[3],block[0],8*i+7,-4); \ + F3(block[0],block[1],8*i+6,-4); \ + F2(block[1],block[2],8*i+5,-4); \ + F1(block[2],block[3],8*i+4,-4); + +/* CAST256's encrypt/decrypt functions are identical except for the order that +the keys are used */ + +void CAST256::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 t, block[4]; + Block::Get(inBlock)(block[0])(block[1])(block[2])(block[3]); + + // Perform 6 forward quad rounds + Q(0); + Q(1); + Q(2); + Q(3); + Q(4); + Q(5); + + // Perform 6 reverse quad rounds + QBar(6); + QBar(7); + QBar(8); + QBar(9); + QBar(10); + QBar(11); + + Block::Put(xorBlock, outBlock)(block[0])(block[1])(block[2])(block[3]); +} + +/* Set up a CAST-256 key */ + +void CAST256::Base::Omega(int i, word32 kappa[8]) +{ + word32 t; + + f1(kappa[6],kappa[7],t_m[0][i],t_r[0][i]); + f2(kappa[5],kappa[6],t_m[1][i],t_r[1][i]); + f3(kappa[4],kappa[5],t_m[2][i],t_r[2][i]); + f1(kappa[3],kappa[4],t_m[3][i],t_r[3][i]); + f2(kappa[2],kappa[3],t_m[4][i],t_r[4][i]); + f3(kappa[1],kappa[2],t_m[5][i],t_r[5][i]); + f1(kappa[0],kappa[1],t_m[6][i],t_r[6][i]); + f2(kappa[7],kappa[0],t_m[7][i],t_r[7][i]); +} + +void CAST256::Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &) +{ + AssertValidKeyLength(keylength); + + word32 kappa[8]; + GetUserKey(BIG_ENDIAN_ORDER, kappa, 8, userKey, keylength); + + for(int i=0; i<12; ++i) + { + Omega(2*i,kappa); + Omega(2*i+1,kappa); + + K[8*i]=kappa[0] & 31; + K[8*i+1]=kappa[2] & 31; + K[8*i+2]=kappa[4] & 31; + K[8*i+3]=kappa[6] & 31; + K[8*i+4]=kappa[7]; + K[8*i+5]=kappa[5]; + K[8*i+6]=kappa[3]; + K[8*i+7]=kappa[1]; + } + + if (!IsForwardTransformation()) + { + for(int j=0; j<6; ++j) + { + for(int i=0; i<4; ++i) + { + int i1=8*j+i; + int i2=8*(11-j)+i; + + assert(i1, public VariableKeyLength<16, 5, 16> +{ + static const char *StaticAlgorithmName() {return "CAST-128";} +}; + +/// CAST-128 +class CAST128 : public CAST128_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + bool reduced; + FixedSizeSecBlock K; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +//! algorithm info +struct CAST256_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32> +{ + static const char *StaticAlgorithmName() {return "CAST-256";} +}; + +//! CAST-256 +class CAST256 : public CAST256_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + + protected: + static const word32 t_m[8][24]; + static const unsigned int t_r[8][24]; + + static void Omega(int i, word32 kappa[8]); + + FixedSizeSecBlock K; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef CAST128::Encryption CAST128Encryption; +typedef CAST128::Decryption CAST128Decryption; + +typedef CAST256::Encryption CAST256Encryption; +typedef CAST256::Decryption CAST256Decryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/casts.cpp b/cryptopp/casts.cpp new file mode 100644 index 0000000..16fa2b1 --- /dev/null +++ b/cryptopp/casts.cpp @@ -0,0 +1,545 @@ +#include "pch.h" +#include "cast.h" + +NAMESPACE_BEGIN(CryptoPP) + +// CAST S-boxes + +const word32 CAST::S[8][256] = { +{ + 0x30FB40D4UL, 0x9FA0FF0BUL, 0x6BECCD2FUL, 0x3F258C7AUL, + 0x1E213F2FUL, 0x9C004DD3UL, 0x6003E540UL, 0xCF9FC949UL, + 0xBFD4AF27UL, 0x88BBBDB5UL, 0xE2034090UL, 0x98D09675UL, + 0x6E63A0E0UL, 0x15C361D2UL, 0xC2E7661DUL, 0x22D4FF8EUL, + 0x28683B6FUL, 0xC07FD059UL, 0xFF2379C8UL, 0x775F50E2UL, + 0x43C340D3UL, 0xDF2F8656UL, 0x887CA41AUL, 0xA2D2BD2DUL, + 0xA1C9E0D6UL, 0x346C4819UL, 0x61B76D87UL, 0x22540F2FUL, + 0x2ABE32E1UL, 0xAA54166BUL, 0x22568E3AUL, 0xA2D341D0UL, + 0x66DB40C8UL, 0xA784392FUL, 0x004DFF2FUL, 0x2DB9D2DEUL, + 0x97943FACUL, 0x4A97C1D8UL, 0x527644B7UL, 0xB5F437A7UL, + 0xB82CBAEFUL, 0xD751D159UL, 0x6FF7F0EDUL, 0x5A097A1FUL, + 0x827B68D0UL, 0x90ECF52EUL, 0x22B0C054UL, 0xBC8E5935UL, + 0x4B6D2F7FUL, 0x50BB64A2UL, 0xD2664910UL, 0xBEE5812DUL, + 0xB7332290UL, 0xE93B159FUL, 0xB48EE411UL, 0x4BFF345DUL, + 0xFD45C240UL, 0xAD31973FUL, 0xC4F6D02EUL, 0x55FC8165UL, + 0xD5B1CAADUL, 0xA1AC2DAEUL, 0xA2D4B76DUL, 0xC19B0C50UL, + 0x882240F2UL, 0x0C6E4F38UL, 0xA4E4BFD7UL, 0x4F5BA272UL, + 0x564C1D2FUL, 0xC59C5319UL, 0xB949E354UL, 0xB04669FEUL, + 0xB1B6AB8AUL, 0xC71358DDUL, 0x6385C545UL, 0x110F935DUL, + 0x57538AD5UL, 0x6A390493UL, 0xE63D37E0UL, 0x2A54F6B3UL, + 0x3A787D5FUL, 0x6276A0B5UL, 0x19A6FCDFUL, 0x7A42206AUL, + 0x29F9D4D5UL, 0xF61B1891UL, 0xBB72275EUL, 0xAA508167UL, + 0x38901091UL, 0xC6B505EBUL, 0x84C7CB8CUL, 0x2AD75A0FUL, + 0x874A1427UL, 0xA2D1936BUL, 0x2AD286AFUL, 0xAA56D291UL, + 0xD7894360UL, 0x425C750DUL, 0x93B39E26UL, 0x187184C9UL, + 0x6C00B32DUL, 0x73E2BB14UL, 0xA0BEBC3CUL, 0x54623779UL, + 0x64459EABUL, 0x3F328B82UL, 0x7718CF82UL, 0x59A2CEA6UL, + 0x04EE002EUL, 0x89FE78E6UL, 0x3FAB0950UL, 0x325FF6C2UL, + 0x81383F05UL, 0x6963C5C8UL, 0x76CB5AD6UL, 0xD49974C9UL, + 0xCA180DCFUL, 0x380782D5UL, 0xC7FA5CF6UL, 0x8AC31511UL, + 0x35E79E13UL, 0x47DA91D0UL, 0xF40F9086UL, 0xA7E2419EUL, + 0x31366241UL, 0x051EF495UL, 0xAA573B04UL, 0x4A805D8DUL, + 0x548300D0UL, 0x00322A3CUL, 0xBF64CDDFUL, 0xBA57A68EUL, + 0x75C6372BUL, 0x50AFD341UL, 0xA7C13275UL, 0x915A0BF5UL, + 0x6B54BFABUL, 0x2B0B1426UL, 0xAB4CC9D7UL, 0x449CCD82UL, + 0xF7FBF265UL, 0xAB85C5F3UL, 0x1B55DB94UL, 0xAAD4E324UL, + 0xCFA4BD3FUL, 0x2DEAA3E2UL, 0x9E204D02UL, 0xC8BD25ACUL, + 0xEADF55B3UL, 0xD5BD9E98UL, 0xE31231B2UL, 0x2AD5AD6CUL, + 0x954329DEUL, 0xADBE4528UL, 0xD8710F69UL, 0xAA51C90FUL, + 0xAA786BF6UL, 0x22513F1EUL, 0xAA51A79BUL, 0x2AD344CCUL, + 0x7B5A41F0UL, 0xD37CFBADUL, 0x1B069505UL, 0x41ECE491UL, + 0xB4C332E6UL, 0x032268D4UL, 0xC9600ACCUL, 0xCE387E6DUL, + 0xBF6BB16CUL, 0x6A70FB78UL, 0x0D03D9C9UL, 0xD4DF39DEUL, + 0xE01063DAUL, 0x4736F464UL, 0x5AD328D8UL, 0xB347CC96UL, + 0x75BB0FC3UL, 0x98511BFBUL, 0x4FFBCC35UL, 0xB58BCF6AUL, + 0xE11F0ABCUL, 0xBFC5FE4AUL, 0xA70AEC10UL, 0xAC39570AUL, + 0x3F04442FUL, 0x6188B153UL, 0xE0397A2EUL, 0x5727CB79UL, + 0x9CEB418FUL, 0x1CACD68DUL, 0x2AD37C96UL, 0x0175CB9DUL, + 0xC69DFF09UL, 0xC75B65F0UL, 0xD9DB40D8UL, 0xEC0E7779UL, + 0x4744EAD4UL, 0xB11C3274UL, 0xDD24CB9EUL, 0x7E1C54BDUL, + 0xF01144F9UL, 0xD2240EB1UL, 0x9675B3FDUL, 0xA3AC3755UL, + 0xD47C27AFUL, 0x51C85F4DUL, 0x56907596UL, 0xA5BB15E6UL, + 0x580304F0UL, 0xCA042CF1UL, 0x011A37EAUL, 0x8DBFAADBUL, + 0x35BA3E4AUL, 0x3526FFA0UL, 0xC37B4D09UL, 0xBC306ED9UL, + 0x98A52666UL, 0x5648F725UL, 0xFF5E569DUL, 0x0CED63D0UL, + 0x7C63B2CFUL, 0x700B45E1UL, 0xD5EA50F1UL, 0x85A92872UL, + 0xAF1FBDA7UL, 0xD4234870UL, 0xA7870BF3UL, 0x2D3B4D79UL, + 0x42E04198UL, 0x0CD0EDE7UL, 0x26470DB8UL, 0xF881814CUL, + 0x474D6AD7UL, 0x7C0C5E5CUL, 0xD1231959UL, 0x381B7298UL, + 0xF5D2F4DBUL, 0xAB838653UL, 0x6E2F1E23UL, 0x83719C9EUL, + 0xBD91E046UL, 0x9A56456EUL, 0xDC39200CUL, 0x20C8C571UL, + 0x962BDA1CUL, 0xE1E696FFUL, 0xB141AB08UL, 0x7CCA89B9UL, + 0x1A69E783UL, 0x02CC4843UL, 0xA2F7C579UL, 0x429EF47DUL, + 0x427B169CUL, 0x5AC9F049UL, 0xDD8F0F00UL, 0x5C8165BFUL +}, + +{ + 0x1F201094UL, 0xEF0BA75BUL, 0x69E3CF7EUL, 0x393F4380UL, + 0xFE61CF7AUL, 0xEEC5207AUL, 0x55889C94UL, 0x72FC0651UL, + 0xADA7EF79UL, 0x4E1D7235UL, 0xD55A63CEUL, 0xDE0436BAUL, + 0x99C430EFUL, 0x5F0C0794UL, 0x18DCDB7DUL, 0xA1D6EFF3UL, + 0xA0B52F7BUL, 0x59E83605UL, 0xEE15B094UL, 0xE9FFD909UL, + 0xDC440086UL, 0xEF944459UL, 0xBA83CCB3UL, 0xE0C3CDFBUL, + 0xD1DA4181UL, 0x3B092AB1UL, 0xF997F1C1UL, 0xA5E6CF7BUL, + 0x01420DDBUL, 0xE4E7EF5BUL, 0x25A1FF41UL, 0xE180F806UL, + 0x1FC41080UL, 0x179BEE7AUL, 0xD37AC6A9UL, 0xFE5830A4UL, + 0x98DE8B7FUL, 0x77E83F4EUL, 0x79929269UL, 0x24FA9F7BUL, + 0xE113C85BUL, 0xACC40083UL, 0xD7503525UL, 0xF7EA615FUL, + 0x62143154UL, 0x0D554B63UL, 0x5D681121UL, 0xC866C359UL, + 0x3D63CF73UL, 0xCEE234C0UL, 0xD4D87E87UL, 0x5C672B21UL, + 0x071F6181UL, 0x39F7627FUL, 0x361E3084UL, 0xE4EB573BUL, + 0x602F64A4UL, 0xD63ACD9CUL, 0x1BBC4635UL, 0x9E81032DUL, + 0x2701F50CUL, 0x99847AB4UL, 0xA0E3DF79UL, 0xBA6CF38CUL, + 0x10843094UL, 0x2537A95EUL, 0xF46F6FFEUL, 0xA1FF3B1FUL, + 0x208CFB6AUL, 0x8F458C74UL, 0xD9E0A227UL, 0x4EC73A34UL, + 0xFC884F69UL, 0x3E4DE8DFUL, 0xEF0E0088UL, 0x3559648DUL, + 0x8A45388CUL, 0x1D804366UL, 0x721D9BFDUL, 0xA58684BBUL, + 0xE8256333UL, 0x844E8212UL, 0x128D8098UL, 0xFED33FB4UL, + 0xCE280AE1UL, 0x27E19BA5UL, 0xD5A6C252UL, 0xE49754BDUL, + 0xC5D655DDUL, 0xEB667064UL, 0x77840B4DUL, 0xA1B6A801UL, + 0x84DB26A9UL, 0xE0B56714UL, 0x21F043B7UL, 0xE5D05860UL, + 0x54F03084UL, 0x066FF472UL, 0xA31AA153UL, 0xDADC4755UL, + 0xB5625DBFUL, 0x68561BE6UL, 0x83CA6B94UL, 0x2D6ED23BUL, + 0xECCF01DBUL, 0xA6D3D0BAUL, 0xB6803D5CUL, 0xAF77A709UL, + 0x33B4A34CUL, 0x397BC8D6UL, 0x5EE22B95UL, 0x5F0E5304UL, + 0x81ED6F61UL, 0x20E74364UL, 0xB45E1378UL, 0xDE18639BUL, + 0x881CA122UL, 0xB96726D1UL, 0x8049A7E8UL, 0x22B7DA7BUL, + 0x5E552D25UL, 0x5272D237UL, 0x79D2951CUL, 0xC60D894CUL, + 0x488CB402UL, 0x1BA4FE5BUL, 0xA4B09F6BUL, 0x1CA815CFUL, + 0xA20C3005UL, 0x8871DF63UL, 0xB9DE2FCBUL, 0x0CC6C9E9UL, + 0x0BEEFF53UL, 0xE3214517UL, 0xB4542835UL, 0x9F63293CUL, + 0xEE41E729UL, 0x6E1D2D7CUL, 0x50045286UL, 0x1E6685F3UL, + 0xF33401C6UL, 0x30A22C95UL, 0x31A70850UL, 0x60930F13UL, + 0x73F98417UL, 0xA1269859UL, 0xEC645C44UL, 0x52C877A9UL, + 0xCDFF33A6UL, 0xA02B1741UL, 0x7CBAD9A2UL, 0x2180036FUL, + 0x50D99C08UL, 0xCB3F4861UL, 0xC26BD765UL, 0x64A3F6ABUL, + 0x80342676UL, 0x25A75E7BUL, 0xE4E6D1FCUL, 0x20C710E6UL, + 0xCDF0B680UL, 0x17844D3BUL, 0x31EEF84DUL, 0x7E0824E4UL, + 0x2CCB49EBUL, 0x846A3BAEUL, 0x8FF77888UL, 0xEE5D60F6UL, + 0x7AF75673UL, 0x2FDD5CDBUL, 0xA11631C1UL, 0x30F66F43UL, + 0xB3FAEC54UL, 0x157FD7FAUL, 0xEF8579CCUL, 0xD152DE58UL, + 0xDB2FFD5EUL, 0x8F32CE19UL, 0x306AF97AUL, 0x02F03EF8UL, + 0x99319AD5UL, 0xC242FA0FUL, 0xA7E3EBB0UL, 0xC68E4906UL, + 0xB8DA230CUL, 0x80823028UL, 0xDCDEF3C8UL, 0xD35FB171UL, + 0x088A1BC8UL, 0xBEC0C560UL, 0x61A3C9E8UL, 0xBCA8F54DUL, + 0xC72FEFFAUL, 0x22822E99UL, 0x82C570B4UL, 0xD8D94E89UL, + 0x8B1C34BCUL, 0x301E16E6UL, 0x273BE979UL, 0xB0FFEAA6UL, + 0x61D9B8C6UL, 0x00B24869UL, 0xB7FFCE3FUL, 0x08DC283BUL, + 0x43DAF65AUL, 0xF7E19798UL, 0x7619B72FUL, 0x8F1C9BA4UL, + 0xDC8637A0UL, 0x16A7D3B1UL, 0x9FC393B7UL, 0xA7136EEBUL, + 0xC6BCC63EUL, 0x1A513742UL, 0xEF6828BCUL, 0x520365D6UL, + 0x2D6A77ABUL, 0x3527ED4BUL, 0x821FD216UL, 0x095C6E2EUL, + 0xDB92F2FBUL, 0x5EEA29CBUL, 0x145892F5UL, 0x91584F7FUL, + 0x5483697BUL, 0x2667A8CCUL, 0x85196048UL, 0x8C4BACEAUL, + 0x833860D4UL, 0x0D23E0F9UL, 0x6C387E8AUL, 0x0AE6D249UL, + 0xB284600CUL, 0xD835731DUL, 0xDCB1C647UL, 0xAC4C56EAUL, + 0x3EBD81B3UL, 0x230EABB0UL, 0x6438BC87UL, 0xF0B5B1FAUL, + 0x8F5EA2B3UL, 0xFC184642UL, 0x0A036B7AUL, 0x4FB089BDUL, + 0x649DA589UL, 0xA345415EUL, 0x5C038323UL, 0x3E5D3BB9UL, + 0x43D79572UL, 0x7E6DD07CUL, 0x06DFDF1EUL, 0x6C6CC4EFUL, + 0x7160A539UL, 0x73BFBE70UL, 0x83877605UL, 0x4523ECF1UL +}, + +{ + 0x8DEFC240UL, 0x25FA5D9FUL, 0xEB903DBFUL, 0xE810C907UL, + 0x47607FFFUL, 0x369FE44BUL, 0x8C1FC644UL, 0xAECECA90UL, + 0xBEB1F9BFUL, 0xEEFBCAEAUL, 0xE8CF1950UL, 0x51DF07AEUL, + 0x920E8806UL, 0xF0AD0548UL, 0xE13C8D83UL, 0x927010D5UL, + 0x11107D9FUL, 0x07647DB9UL, 0xB2E3E4D4UL, 0x3D4F285EUL, + 0xB9AFA820UL, 0xFADE82E0UL, 0xA067268BUL, 0x8272792EUL, + 0x553FB2C0UL, 0x489AE22BUL, 0xD4EF9794UL, 0x125E3FBCUL, + 0x21FFFCEEUL, 0x825B1BFDUL, 0x9255C5EDUL, 0x1257A240UL, + 0x4E1A8302UL, 0xBAE07FFFUL, 0x528246E7UL, 0x8E57140EUL, + 0x3373F7BFUL, 0x8C9F8188UL, 0xA6FC4EE8UL, 0xC982B5A5UL, + 0xA8C01DB7UL, 0x579FC264UL, 0x67094F31UL, 0xF2BD3F5FUL, + 0x40FFF7C1UL, 0x1FB78DFCUL, 0x8E6BD2C1UL, 0x437BE59BUL, + 0x99B03DBFUL, 0xB5DBC64BUL, 0x638DC0E6UL, 0x55819D99UL, + 0xA197C81CUL, 0x4A012D6EUL, 0xC5884A28UL, 0xCCC36F71UL, + 0xB843C213UL, 0x6C0743F1UL, 0x8309893CUL, 0x0FEDDD5FUL, + 0x2F7FE850UL, 0xD7C07F7EUL, 0x02507FBFUL, 0x5AFB9A04UL, + 0xA747D2D0UL, 0x1651192EUL, 0xAF70BF3EUL, 0x58C31380UL, + 0x5F98302EUL, 0x727CC3C4UL, 0x0A0FB402UL, 0x0F7FEF82UL, + 0x8C96FDADUL, 0x5D2C2AAEUL, 0x8EE99A49UL, 0x50DA88B8UL, + 0x8427F4A0UL, 0x1EAC5790UL, 0x796FB449UL, 0x8252DC15UL, + 0xEFBD7D9BUL, 0xA672597DUL, 0xADA840D8UL, 0x45F54504UL, + 0xFA5D7403UL, 0xE83EC305UL, 0x4F91751AUL, 0x925669C2UL, + 0x23EFE941UL, 0xA903F12EUL, 0x60270DF2UL, 0x0276E4B6UL, + 0x94FD6574UL, 0x927985B2UL, 0x8276DBCBUL, 0x02778176UL, + 0xF8AF918DUL, 0x4E48F79EUL, 0x8F616DDFUL, 0xE29D840EUL, + 0x842F7D83UL, 0x340CE5C8UL, 0x96BBB682UL, 0x93B4B148UL, + 0xEF303CABUL, 0x984FAF28UL, 0x779FAF9BUL, 0x92DC560DUL, + 0x224D1E20UL, 0x8437AA88UL, 0x7D29DC96UL, 0x2756D3DCUL, + 0x8B907CEEUL, 0xB51FD240UL, 0xE7C07CE3UL, 0xE566B4A1UL, + 0xC3E9615EUL, 0x3CF8209DUL, 0x6094D1E3UL, 0xCD9CA341UL, + 0x5C76460EUL, 0x00EA983BUL, 0xD4D67881UL, 0xFD47572CUL, + 0xF76CEDD9UL, 0xBDA8229CUL, 0x127DADAAUL, 0x438A074EUL, + 0x1F97C090UL, 0x081BDB8AUL, 0x93A07EBEUL, 0xB938CA15UL, + 0x97B03CFFUL, 0x3DC2C0F8UL, 0x8D1AB2ECUL, 0x64380E51UL, + 0x68CC7BFBUL, 0xD90F2788UL, 0x12490181UL, 0x5DE5FFD4UL, + 0xDD7EF86AUL, 0x76A2E214UL, 0xB9A40368UL, 0x925D958FUL, + 0x4B39FFFAUL, 0xBA39AEE9UL, 0xA4FFD30BUL, 0xFAF7933BUL, + 0x6D498623UL, 0x193CBCFAUL, 0x27627545UL, 0x825CF47AUL, + 0x61BD8BA0UL, 0xD11E42D1UL, 0xCEAD04F4UL, 0x127EA392UL, + 0x10428DB7UL, 0x8272A972UL, 0x9270C4A8UL, 0x127DE50BUL, + 0x285BA1C8UL, 0x3C62F44FUL, 0x35C0EAA5UL, 0xE805D231UL, + 0x428929FBUL, 0xB4FCDF82UL, 0x4FB66A53UL, 0x0E7DC15BUL, + 0x1F081FABUL, 0x108618AEUL, 0xFCFD086DUL, 0xF9FF2889UL, + 0x694BCC11UL, 0x236A5CAEUL, 0x12DECA4DUL, 0x2C3F8CC5UL, + 0xD2D02DFEUL, 0xF8EF5896UL, 0xE4CF52DAUL, 0x95155B67UL, + 0x494A488CUL, 0xB9B6A80CUL, 0x5C8F82BCUL, 0x89D36B45UL, + 0x3A609437UL, 0xEC00C9A9UL, 0x44715253UL, 0x0A874B49UL, + 0xD773BC40UL, 0x7C34671CUL, 0x02717EF6UL, 0x4FEB5536UL, + 0xA2D02FFFUL, 0xD2BF60C4UL, 0xD43F03C0UL, 0x50B4EF6DUL, + 0x07478CD1UL, 0x006E1888UL, 0xA2E53F55UL, 0xB9E6D4BCUL, + 0xA2048016UL, 0x97573833UL, 0xD7207D67UL, 0xDE0F8F3DUL, + 0x72F87B33UL, 0xABCC4F33UL, 0x7688C55DUL, 0x7B00A6B0UL, + 0x947B0001UL, 0x570075D2UL, 0xF9BB88F8UL, 0x8942019EUL, + 0x4264A5FFUL, 0x856302E0UL, 0x72DBD92BUL, 0xEE971B69UL, + 0x6EA22FDEUL, 0x5F08AE2BUL, 0xAF7A616DUL, 0xE5C98767UL, + 0xCF1FEBD2UL, 0x61EFC8C2UL, 0xF1AC2571UL, 0xCC8239C2UL, + 0x67214CB8UL, 0xB1E583D1UL, 0xB7DC3E62UL, 0x7F10BDCEUL, + 0xF90A5C38UL, 0x0FF0443DUL, 0x606E6DC6UL, 0x60543A49UL, + 0x5727C148UL, 0x2BE98A1DUL, 0x8AB41738UL, 0x20E1BE24UL, + 0xAF96DA0FUL, 0x68458425UL, 0x99833BE5UL, 0x600D457DUL, + 0x282F9350UL, 0x8334B362UL, 0xD91D1120UL, 0x2B6D8DA0UL, + 0x642B1E31UL, 0x9C305A00UL, 0x52BCE688UL, 0x1B03588AUL, + 0xF7BAEFD5UL, 0x4142ED9CUL, 0xA4315C11UL, 0x83323EC5UL, + 0xDFEF4636UL, 0xA133C501UL, 0xE9D3531CUL, 0xEE353783UL +}, + +{ + 0x9DB30420UL, 0x1FB6E9DEUL, 0xA7BE7BEFUL, 0xD273A298UL, + 0x4A4F7BDBUL, 0x64AD8C57UL, 0x85510443UL, 0xFA020ED1UL, + 0x7E287AFFUL, 0xE60FB663UL, 0x095F35A1UL, 0x79EBF120UL, + 0xFD059D43UL, 0x6497B7B1UL, 0xF3641F63UL, 0x241E4ADFUL, + 0x28147F5FUL, 0x4FA2B8CDUL, 0xC9430040UL, 0x0CC32220UL, + 0xFDD30B30UL, 0xC0A5374FUL, 0x1D2D00D9UL, 0x24147B15UL, + 0xEE4D111AUL, 0x0FCA5167UL, 0x71FF904CUL, 0x2D195FFEUL, + 0x1A05645FUL, 0x0C13FEFEUL, 0x081B08CAUL, 0x05170121UL, + 0x80530100UL, 0xE83E5EFEUL, 0xAC9AF4F8UL, 0x7FE72701UL, + 0xD2B8EE5FUL, 0x06DF4261UL, 0xBB9E9B8AUL, 0x7293EA25UL, + 0xCE84FFDFUL, 0xF5718801UL, 0x3DD64B04UL, 0xA26F263BUL, + 0x7ED48400UL, 0x547EEBE6UL, 0x446D4CA0UL, 0x6CF3D6F5UL, + 0x2649ABDFUL, 0xAEA0C7F5UL, 0x36338CC1UL, 0x503F7E93UL, + 0xD3772061UL, 0x11B638E1UL, 0x72500E03UL, 0xF80EB2BBUL, + 0xABE0502EUL, 0xEC8D77DEUL, 0x57971E81UL, 0xE14F6746UL, + 0xC9335400UL, 0x6920318FUL, 0x081DBB99UL, 0xFFC304A5UL, + 0x4D351805UL, 0x7F3D5CE3UL, 0xA6C866C6UL, 0x5D5BCCA9UL, + 0xDAEC6FEAUL, 0x9F926F91UL, 0x9F46222FUL, 0x3991467DUL, + 0xA5BF6D8EUL, 0x1143C44FUL, 0x43958302UL, 0xD0214EEBUL, + 0x022083B8UL, 0x3FB6180CUL, 0x18F8931EUL, 0x281658E6UL, + 0x26486E3EUL, 0x8BD78A70UL, 0x7477E4C1UL, 0xB506E07CUL, + 0xF32D0A25UL, 0x79098B02UL, 0xE4EABB81UL, 0x28123B23UL, + 0x69DEAD38UL, 0x1574CA16UL, 0xDF871B62UL, 0x211C40B7UL, + 0xA51A9EF9UL, 0x0014377BUL, 0x041E8AC8UL, 0x09114003UL, + 0xBD59E4D2UL, 0xE3D156D5UL, 0x4FE876D5UL, 0x2F91A340UL, + 0x557BE8DEUL, 0x00EAE4A7UL, 0x0CE5C2ECUL, 0x4DB4BBA6UL, + 0xE756BDFFUL, 0xDD3369ACUL, 0xEC17B035UL, 0x06572327UL, + 0x99AFC8B0UL, 0x56C8C391UL, 0x6B65811CUL, 0x5E146119UL, + 0x6E85CB75UL, 0xBE07C002UL, 0xC2325577UL, 0x893FF4ECUL, + 0x5BBFC92DUL, 0xD0EC3B25UL, 0xB7801AB7UL, 0x8D6D3B24UL, + 0x20C763EFUL, 0xC366A5FCUL, 0x9C382880UL, 0x0ACE3205UL, + 0xAAC9548AUL, 0xECA1D7C7UL, 0x041AFA32UL, 0x1D16625AUL, + 0x6701902CUL, 0x9B757A54UL, 0x31D477F7UL, 0x9126B031UL, + 0x36CC6FDBUL, 0xC70B8B46UL, 0xD9E66A48UL, 0x56E55A79UL, + 0x026A4CEBUL, 0x52437EFFUL, 0x2F8F76B4UL, 0x0DF980A5UL, + 0x8674CDE3UL, 0xEDDA04EBUL, 0x17A9BE04UL, 0x2C18F4DFUL, + 0xB7747F9DUL, 0xAB2AF7B4UL, 0xEFC34D20UL, 0x2E096B7CUL, + 0x1741A254UL, 0xE5B6A035UL, 0x213D42F6UL, 0x2C1C7C26UL, + 0x61C2F50FUL, 0x6552DAF9UL, 0xD2C231F8UL, 0x25130F69UL, + 0xD8167FA2UL, 0x0418F2C8UL, 0x001A96A6UL, 0x0D1526ABUL, + 0x63315C21UL, 0x5E0A72ECUL, 0x49BAFEFDUL, 0x187908D9UL, + 0x8D0DBD86UL, 0x311170A7UL, 0x3E9B640CUL, 0xCC3E10D7UL, + 0xD5CAD3B6UL, 0x0CAEC388UL, 0xF73001E1UL, 0x6C728AFFUL, + 0x71EAE2A1UL, 0x1F9AF36EUL, 0xCFCBD12FUL, 0xC1DE8417UL, + 0xAC07BE6BUL, 0xCB44A1D8UL, 0x8B9B0F56UL, 0x013988C3UL, + 0xB1C52FCAUL, 0xB4BE31CDUL, 0xD8782806UL, 0x12A3A4E2UL, + 0x6F7DE532UL, 0x58FD7EB6UL, 0xD01EE900UL, 0x24ADFFC2UL, + 0xF4990FC5UL, 0x9711AAC5UL, 0x001D7B95UL, 0x82E5E7D2UL, + 0x109873F6UL, 0x00613096UL, 0xC32D9521UL, 0xADA121FFUL, + 0x29908415UL, 0x7FBB977FUL, 0xAF9EB3DBUL, 0x29C9ED2AUL, + 0x5CE2A465UL, 0xA730F32CUL, 0xD0AA3FE8UL, 0x8A5CC091UL, + 0xD49E2CE7UL, 0x0CE454A9UL, 0xD60ACD86UL, 0x015F1919UL, + 0x77079103UL, 0xDEA03AF6UL, 0x78A8565EUL, 0xDEE356DFUL, + 0x21F05CBEUL, 0x8B75E387UL, 0xB3C50651UL, 0xB8A5C3EFUL, + 0xD8EEB6D2UL, 0xE523BE77UL, 0xC2154529UL, 0x2F69EFDFUL, + 0xAFE67AFBUL, 0xF470C4B2UL, 0xF3E0EB5BUL, 0xD6CC9876UL, + 0x39E4460CUL, 0x1FDA8538UL, 0x1987832FUL, 0xCA007367UL, + 0xA99144F8UL, 0x296B299EUL, 0x492FC295UL, 0x9266BEABUL, + 0xB5676E69UL, 0x9BD3DDDAUL, 0xDF7E052FUL, 0xDB25701CUL, + 0x1B5E51EEUL, 0xF65324E6UL, 0x6AFCE36CUL, 0x0316CC04UL, + 0x8644213EUL, 0xB7DC59D0UL, 0x7965291FUL, 0xCCD6FD43UL, + 0x41823979UL, 0x932BCDF6UL, 0xB657C34DUL, 0x4EDFD282UL, + 0x7AE5290CUL, 0x3CB9536BUL, 0x851E20FEUL, 0x9833557EUL, + 0x13ECF0B0UL, 0xD3FFB372UL, 0x3F85C5C1UL, 0x0AEF7ED2UL +}, + +{ + 0x7EC90C04UL, 0x2C6E74B9UL, 0x9B0E66DFUL, 0xA6337911UL, + 0xB86A7FFFUL, 0x1DD358F5UL, 0x44DD9D44UL, 0x1731167FUL, + 0x08FBF1FAUL, 0xE7F511CCUL, 0xD2051B00UL, 0x735ABA00UL, + 0x2AB722D8UL, 0x386381CBUL, 0xACF6243AUL, 0x69BEFD7AUL, + 0xE6A2E77FUL, 0xF0C720CDUL, 0xC4494816UL, 0xCCF5C180UL, + 0x38851640UL, 0x15B0A848UL, 0xE68B18CBUL, 0x4CAADEFFUL, + 0x5F480A01UL, 0x0412B2AAUL, 0x259814FCUL, 0x41D0EFE2UL, + 0x4E40B48DUL, 0x248EB6FBUL, 0x8DBA1CFEUL, 0x41A99B02UL, + 0x1A550A04UL, 0xBA8F65CBUL, 0x7251F4E7UL, 0x95A51725UL, + 0xC106ECD7UL, 0x97A5980AUL, 0xC539B9AAUL, 0x4D79FE6AUL, + 0xF2F3F763UL, 0x68AF8040UL, 0xED0C9E56UL, 0x11B4958BUL, + 0xE1EB5A88UL, 0x8709E6B0UL, 0xD7E07156UL, 0x4E29FEA7UL, + 0x6366E52DUL, 0x02D1C000UL, 0xC4AC8E05UL, 0x9377F571UL, + 0x0C05372AUL, 0x578535F2UL, 0x2261BE02UL, 0xD642A0C9UL, + 0xDF13A280UL, 0x74B55BD2UL, 0x682199C0UL, 0xD421E5ECUL, + 0x53FB3CE8UL, 0xC8ADEDB3UL, 0x28A87FC9UL, 0x3D959981UL, + 0x5C1FF900UL, 0xFE38D399UL, 0x0C4EFF0BUL, 0x062407EAUL, + 0xAA2F4FB1UL, 0x4FB96976UL, 0x90C79505UL, 0xB0A8A774UL, + 0xEF55A1FFUL, 0xE59CA2C2UL, 0xA6B62D27UL, 0xE66A4263UL, + 0xDF65001FUL, 0x0EC50966UL, 0xDFDD55BCUL, 0x29DE0655UL, + 0x911E739AUL, 0x17AF8975UL, 0x32C7911CUL, 0x89F89468UL, + 0x0D01E980UL, 0x524755F4UL, 0x03B63CC9UL, 0x0CC844B2UL, + 0xBCF3F0AAUL, 0x87AC36E9UL, 0xE53A7426UL, 0x01B3D82BUL, + 0x1A9E7449UL, 0x64EE2D7EUL, 0xCDDBB1DAUL, 0x01C94910UL, + 0xB868BF80UL, 0x0D26F3FDUL, 0x9342EDE7UL, 0x04A5C284UL, + 0x636737B6UL, 0x50F5B616UL, 0xF24766E3UL, 0x8ECA36C1UL, + 0x136E05DBUL, 0xFEF18391UL, 0xFB887A37UL, 0xD6E7F7D4UL, + 0xC7FB7DC9UL, 0x3063FCDFUL, 0xB6F589DEUL, 0xEC2941DAUL, + 0x26E46695UL, 0xB7566419UL, 0xF654EFC5UL, 0xD08D58B7UL, + 0x48925401UL, 0xC1BACB7FUL, 0xE5FF550FUL, 0xB6083049UL, + 0x5BB5D0E8UL, 0x87D72E5AUL, 0xAB6A6EE1UL, 0x223A66CEUL, + 0xC62BF3CDUL, 0x9E0885F9UL, 0x68CB3E47UL, 0x086C010FUL, + 0xA21DE820UL, 0xD18B69DEUL, 0xF3F65777UL, 0xFA02C3F6UL, + 0x407EDAC3UL, 0xCBB3D550UL, 0x1793084DUL, 0xB0D70EBAUL, + 0x0AB378D5UL, 0xD951FB0CUL, 0xDED7DA56UL, 0x4124BBE4UL, + 0x94CA0B56UL, 0x0F5755D1UL, 0xE0E1E56EUL, 0x6184B5BEUL, + 0x580A249FUL, 0x94F74BC0UL, 0xE327888EUL, 0x9F7B5561UL, + 0xC3DC0280UL, 0x05687715UL, 0x646C6BD7UL, 0x44904DB3UL, + 0x66B4F0A3UL, 0xC0F1648AUL, 0x697ED5AFUL, 0x49E92FF6UL, + 0x309E374FUL, 0x2CB6356AUL, 0x85808573UL, 0x4991F840UL, + 0x76F0AE02UL, 0x083BE84DUL, 0x28421C9AUL, 0x44489406UL, + 0x736E4CB8UL, 0xC1092910UL, 0x8BC95FC6UL, 0x7D869CF4UL, + 0x134F616FUL, 0x2E77118DUL, 0xB31B2BE1UL, 0xAA90B472UL, + 0x3CA5D717UL, 0x7D161BBAUL, 0x9CAD9010UL, 0xAF462BA2UL, + 0x9FE459D2UL, 0x45D34559UL, 0xD9F2DA13UL, 0xDBC65487UL, + 0xF3E4F94EUL, 0x176D486FUL, 0x097C13EAUL, 0x631DA5C7UL, + 0x445F7382UL, 0x175683F4UL, 0xCDC66A97UL, 0x70BE0288UL, + 0xB3CDCF72UL, 0x6E5DD2F3UL, 0x20936079UL, 0x459B80A5UL, + 0xBE60E2DBUL, 0xA9C23101UL, 0xEBA5315CUL, 0x224E42F2UL, + 0x1C5C1572UL, 0xF6721B2CUL, 0x1AD2FFF3UL, 0x8C25404EUL, + 0x324ED72FUL, 0x4067B7FDUL, 0x0523138EUL, 0x5CA3BC78UL, + 0xDC0FD66EUL, 0x75922283UL, 0x784D6B17UL, 0x58EBB16EUL, + 0x44094F85UL, 0x3F481D87UL, 0xFCFEAE7BUL, 0x77B5FF76UL, + 0x8C2302BFUL, 0xAAF47556UL, 0x5F46B02AUL, 0x2B092801UL, + 0x3D38F5F7UL, 0x0CA81F36UL, 0x52AF4A8AUL, 0x66D5E7C0UL, + 0xDF3B0874UL, 0x95055110UL, 0x1B5AD7A8UL, 0xF61ED5ADUL, + 0x6CF6E479UL, 0x20758184UL, 0xD0CEFA65UL, 0x88F7BE58UL, + 0x4A046826UL, 0x0FF6F8F3UL, 0xA09C7F70UL, 0x5346ABA0UL, + 0x5CE96C28UL, 0xE176EDA3UL, 0x6BAC307FUL, 0x376829D2UL, + 0x85360FA9UL, 0x17E3FE2AUL, 0x24B79767UL, 0xF5A96B20UL, + 0xD6CD2595UL, 0x68FF1EBFUL, 0x7555442CUL, 0xF19F06BEUL, + 0xF9E0659AUL, 0xEEB9491DUL, 0x34010718UL, 0xBB30CAB8UL, + 0xE822FE15UL, 0x88570983UL, 0x750E6249UL, 0xDA627E55UL, + 0x5E76FFA8UL, 0xB1534546UL, 0x6D47DE08UL, 0xEFE9E7D4UL +}, + +{ + 0xF6FA8F9DUL, 0x2CAC6CE1UL, 0x4CA34867UL, 0xE2337F7CUL, + 0x95DB08E7UL, 0x016843B4UL, 0xECED5CBCUL, 0x325553ACUL, + 0xBF9F0960UL, 0xDFA1E2EDUL, 0x83F0579DUL, 0x63ED86B9UL, + 0x1AB6A6B8UL, 0xDE5EBE39UL, 0xF38FF732UL, 0x8989B138UL, + 0x33F14961UL, 0xC01937BDUL, 0xF506C6DAUL, 0xE4625E7EUL, + 0xA308EA99UL, 0x4E23E33CUL, 0x79CBD7CCUL, 0x48A14367UL, + 0xA3149619UL, 0xFEC94BD5UL, 0xA114174AUL, 0xEAA01866UL, + 0xA084DB2DUL, 0x09A8486FUL, 0xA888614AUL, 0x2900AF98UL, + 0x01665991UL, 0xE1992863UL, 0xC8F30C60UL, 0x2E78EF3CUL, + 0xD0D51932UL, 0xCF0FEC14UL, 0xF7CA07D2UL, 0xD0A82072UL, + 0xFD41197EUL, 0x9305A6B0UL, 0xE86BE3DAUL, 0x74BED3CDUL, + 0x372DA53CUL, 0x4C7F4448UL, 0xDAB5D440UL, 0x6DBA0EC3UL, + 0x083919A7UL, 0x9FBAEED9UL, 0x49DBCFB0UL, 0x4E670C53UL, + 0x5C3D9C01UL, 0x64BDB941UL, 0x2C0E636AUL, 0xBA7DD9CDUL, + 0xEA6F7388UL, 0xE70BC762UL, 0x35F29ADBUL, 0x5C4CDD8DUL, + 0xF0D48D8CUL, 0xB88153E2UL, 0x08A19866UL, 0x1AE2EAC8UL, + 0x284CAF89UL, 0xAA928223UL, 0x9334BE53UL, 0x3B3A21BFUL, + 0x16434BE3UL, 0x9AEA3906UL, 0xEFE8C36EUL, 0xF890CDD9UL, + 0x80226DAEUL, 0xC340A4A3UL, 0xDF7E9C09UL, 0xA694A807UL, + 0x5B7C5ECCUL, 0x221DB3A6UL, 0x9A69A02FUL, 0x68818A54UL, + 0xCEB2296FUL, 0x53C0843AUL, 0xFE893655UL, 0x25BFE68AUL, + 0xB4628ABCUL, 0xCF222EBFUL, 0x25AC6F48UL, 0xA9A99387UL, + 0x53BDDB65UL, 0xE76FFBE7UL, 0xE967FD78UL, 0x0BA93563UL, + 0x8E342BC1UL, 0xE8A11BE9UL, 0x4980740DUL, 0xC8087DFCUL, + 0x8DE4BF99UL, 0xA11101A0UL, 0x7FD37975UL, 0xDA5A26C0UL, + 0xE81F994FUL, 0x9528CD89UL, 0xFD339FEDUL, 0xB87834BFUL, + 0x5F04456DUL, 0x22258698UL, 0xC9C4C83BUL, 0x2DC156BEUL, + 0x4F628DAAUL, 0x57F55EC5UL, 0xE2220ABEUL, 0xD2916EBFUL, + 0x4EC75B95UL, 0x24F2C3C0UL, 0x42D15D99UL, 0xCD0D7FA0UL, + 0x7B6E27FFUL, 0xA8DC8AF0UL, 0x7345C106UL, 0xF41E232FUL, + 0x35162386UL, 0xE6EA8926UL, 0x3333B094UL, 0x157EC6F2UL, + 0x372B74AFUL, 0x692573E4UL, 0xE9A9D848UL, 0xF3160289UL, + 0x3A62EF1DUL, 0xA787E238UL, 0xF3A5F676UL, 0x74364853UL, + 0x20951063UL, 0x4576698DUL, 0xB6FAD407UL, 0x592AF950UL, + 0x36F73523UL, 0x4CFB6E87UL, 0x7DA4CEC0UL, 0x6C152DAAUL, + 0xCB0396A8UL, 0xC50DFE5DUL, 0xFCD707ABUL, 0x0921C42FUL, + 0x89DFF0BBUL, 0x5FE2BE78UL, 0x448F4F33UL, 0x754613C9UL, + 0x2B05D08DUL, 0x48B9D585UL, 0xDC049441UL, 0xC8098F9BUL, + 0x7DEDE786UL, 0xC39A3373UL, 0x42410005UL, 0x6A091751UL, + 0x0EF3C8A6UL, 0x890072D6UL, 0x28207682UL, 0xA9A9F7BEUL, + 0xBF32679DUL, 0xD45B5B75UL, 0xB353FD00UL, 0xCBB0E358UL, + 0x830F220AUL, 0x1F8FB214UL, 0xD372CF08UL, 0xCC3C4A13UL, + 0x8CF63166UL, 0x061C87BEUL, 0x88C98F88UL, 0x6062E397UL, + 0x47CF8E7AUL, 0xB6C85283UL, 0x3CC2ACFBUL, 0x3FC06976UL, + 0x4E8F0252UL, 0x64D8314DUL, 0xDA3870E3UL, 0x1E665459UL, + 0xC10908F0UL, 0x513021A5UL, 0x6C5B68B7UL, 0x822F8AA0UL, + 0x3007CD3EUL, 0x74719EEFUL, 0xDC872681UL, 0x073340D4UL, + 0x7E432FD9UL, 0x0C5EC241UL, 0x8809286CUL, 0xF592D891UL, + 0x08A930F6UL, 0x957EF305UL, 0xB7FBFFBDUL, 0xC266E96FUL, + 0x6FE4AC98UL, 0xB173ECC0UL, 0xBC60B42AUL, 0x953498DAUL, + 0xFBA1AE12UL, 0x2D4BD736UL, 0x0F25FAABUL, 0xA4F3FCEBUL, + 0xE2969123UL, 0x257F0C3DUL, 0x9348AF49UL, 0x361400BCUL, + 0xE8816F4AUL, 0x3814F200UL, 0xA3F94043UL, 0x9C7A54C2UL, + 0xBC704F57UL, 0xDA41E7F9UL, 0xC25AD33AUL, 0x54F4A084UL, + 0xB17F5505UL, 0x59357CBEUL, 0xEDBD15C8UL, 0x7F97C5ABUL, + 0xBA5AC7B5UL, 0xB6F6DEAFUL, 0x3A479C3AUL, 0x5302DA25UL, + 0x653D7E6AUL, 0x54268D49UL, 0x51A477EAUL, 0x5017D55BUL, + 0xD7D25D88UL, 0x44136C76UL, 0x0404A8C8UL, 0xB8E5A121UL, + 0xB81A928AUL, 0x60ED5869UL, 0x97C55B96UL, 0xEAEC991BUL, + 0x29935913UL, 0x01FDB7F1UL, 0x088E8DFAUL, 0x9AB6F6F5UL, + 0x3B4CBF9FUL, 0x4A5DE3ABUL, 0xE6051D35UL, 0xA0E1D855UL, + 0xD36B4CF1UL, 0xF544EDEBUL, 0xB0E93524UL, 0xBEBB8FBDUL, + 0xA2D762CFUL, 0x49C92F54UL, 0x38B5F331UL, 0x7128A454UL, + 0x48392905UL, 0xA65B1DB8UL, 0x851C97BDUL, 0xD675CF2FUL +}, + +{ + 0x85E04019UL, 0x332BF567UL, 0x662DBFFFUL, 0xCFC65693UL, + 0x2A8D7F6FUL, 0xAB9BC912UL, 0xDE6008A1UL, 0x2028DA1FUL, + 0x0227BCE7UL, 0x4D642916UL, 0x18FAC300UL, 0x50F18B82UL, + 0x2CB2CB11UL, 0xB232E75CUL, 0x4B3695F2UL, 0xB28707DEUL, + 0xA05FBCF6UL, 0xCD4181E9UL, 0xE150210CUL, 0xE24EF1BDUL, + 0xB168C381UL, 0xFDE4E789UL, 0x5C79B0D8UL, 0x1E8BFD43UL, + 0x4D495001UL, 0x38BE4341UL, 0x913CEE1DUL, 0x92A79C3FUL, + 0x089766BEUL, 0xBAEEADF4UL, 0x1286BECFUL, 0xB6EACB19UL, + 0x2660C200UL, 0x7565BDE4UL, 0x64241F7AUL, 0x8248DCA9UL, + 0xC3B3AD66UL, 0x28136086UL, 0x0BD8DFA8UL, 0x356D1CF2UL, + 0x107789BEUL, 0xB3B2E9CEUL, 0x0502AA8FUL, 0x0BC0351EUL, + 0x166BF52AUL, 0xEB12FF82UL, 0xE3486911UL, 0xD34D7516UL, + 0x4E7B3AFFUL, 0x5F43671BUL, 0x9CF6E037UL, 0x4981AC83UL, + 0x334266CEUL, 0x8C9341B7UL, 0xD0D854C0UL, 0xCB3A6C88UL, + 0x47BC2829UL, 0x4725BA37UL, 0xA66AD22BUL, 0x7AD61F1EUL, + 0x0C5CBAFAUL, 0x4437F107UL, 0xB6E79962UL, 0x42D2D816UL, + 0x0A961288UL, 0xE1A5C06EUL, 0x13749E67UL, 0x72FC081AUL, + 0xB1D139F7UL, 0xF9583745UL, 0xCF19DF58UL, 0xBEC3F756UL, + 0xC06EBA30UL, 0x07211B24UL, 0x45C28829UL, 0xC95E317FUL, + 0xBC8EC511UL, 0x38BC46E9UL, 0xC6E6FA14UL, 0xBAE8584AUL, + 0xAD4EBC46UL, 0x468F508BUL, 0x7829435FUL, 0xF124183BUL, + 0x821DBA9FUL, 0xAFF60FF4UL, 0xEA2C4E6DUL, 0x16E39264UL, + 0x92544A8BUL, 0x009B4FC3UL, 0xABA68CEDUL, 0x9AC96F78UL, + 0x06A5B79AUL, 0xB2856E6EUL, 0x1AEC3CA9UL, 0xBE838688UL, + 0x0E0804E9UL, 0x55F1BE56UL, 0xE7E5363BUL, 0xB3A1F25DUL, + 0xF7DEBB85UL, 0x61FE033CUL, 0x16746233UL, 0x3C034C28UL, + 0xDA6D0C74UL, 0x79AAC56CUL, 0x3CE4E1ADUL, 0x51F0C802UL, + 0x98F8F35AUL, 0x1626A49FUL, 0xEED82B29UL, 0x1D382FE3UL, + 0x0C4FB99AUL, 0xBB325778UL, 0x3EC6D97BUL, 0x6E77A6A9UL, + 0xCB658B5CUL, 0xD45230C7UL, 0x2BD1408BUL, 0x60C03EB7UL, + 0xB9068D78UL, 0xA33754F4UL, 0xF430C87DUL, 0xC8A71302UL, + 0xB96D8C32UL, 0xEBD4E7BEUL, 0xBE8B9D2DUL, 0x7979FB06UL, + 0xE7225308UL, 0x8B75CF77UL, 0x11EF8DA4UL, 0xE083C858UL, + 0x8D6B786FUL, 0x5A6317A6UL, 0xFA5CF7A0UL, 0x5DDA0033UL, + 0xF28EBFB0UL, 0xF5B9C310UL, 0xA0EAC280UL, 0x08B9767AUL, + 0xA3D9D2B0UL, 0x79D34217UL, 0x021A718DUL, 0x9AC6336AUL, + 0x2711FD60UL, 0x438050E3UL, 0x069908A8UL, 0x3D7FEDC4UL, + 0x826D2BEFUL, 0x4EEB8476UL, 0x488DCF25UL, 0x36C9D566UL, + 0x28E74E41UL, 0xC2610ACAUL, 0x3D49A9CFUL, 0xBAE3B9DFUL, + 0xB65F8DE6UL, 0x92AEAF64UL, 0x3AC7D5E6UL, 0x9EA80509UL, + 0xF22B017DUL, 0xA4173F70UL, 0xDD1E16C3UL, 0x15E0D7F9UL, + 0x50B1B887UL, 0x2B9F4FD5UL, 0x625ABA82UL, 0x6A017962UL, + 0x2EC01B9CUL, 0x15488AA9UL, 0xD716E740UL, 0x40055A2CUL, + 0x93D29A22UL, 0xE32DBF9AUL, 0x058745B9UL, 0x3453DC1EUL, + 0xD699296EUL, 0x496CFF6FUL, 0x1C9F4986UL, 0xDFE2ED07UL, + 0xB87242D1UL, 0x19DE7EAEUL, 0x053E561AUL, 0x15AD6F8CUL, + 0x66626C1CUL, 0x7154C24CUL, 0xEA082B2AUL, 0x93EB2939UL, + 0x17DCB0F0UL, 0x58D4F2AEUL, 0x9EA294FBUL, 0x52CF564CUL, + 0x9883FE66UL, 0x2EC40581UL, 0x763953C3UL, 0x01D6692EUL, + 0xD3A0C108UL, 0xA1E7160EUL, 0xE4F2DFA6UL, 0x693ED285UL, + 0x74904698UL, 0x4C2B0EDDUL, 0x4F757656UL, 0x5D393378UL, + 0xA132234FUL, 0x3D321C5DUL, 0xC3F5E194UL, 0x4B269301UL, + 0xC79F022FUL, 0x3C997E7EUL, 0x5E4F9504UL, 0x3FFAFBBDUL, + 0x76F7AD0EUL, 0x296693F4UL, 0x3D1FCE6FUL, 0xC61E45BEUL, + 0xD3B5AB34UL, 0xF72BF9B7UL, 0x1B0434C0UL, 0x4E72B567UL, + 0x5592A33DUL, 0xB5229301UL, 0xCFD2A87FUL, 0x60AEB767UL, + 0x1814386BUL, 0x30BCC33DUL, 0x38A0C07DUL, 0xFD1606F2UL, + 0xC363519BUL, 0x589DD390UL, 0x5479F8E6UL, 0x1CB8D647UL, + 0x97FD61A9UL, 0xEA7759F4UL, 0x2D57539DUL, 0x569A58CFUL, + 0xE84E63ADUL, 0x462E1B78UL, 0x6580F87EUL, 0xF3817914UL, + 0x91DA55F4UL, 0x40A230F3UL, 0xD1988F35UL, 0xB6E318D2UL, + 0x3FFA50BCUL, 0x3D40F021UL, 0xC3C0BDAEUL, 0x4958C24CUL, + 0x518F36B2UL, 0x84B1D370UL, 0x0FEDCE83UL, 0x878DDADAUL, + 0xF2A279C7UL, 0x94E01BE8UL, 0x90716F4BUL, 0x954B8AA3UL +}, + +{ + 0xE216300DUL, 0xBBDDFFFCUL, 0xA7EBDABDUL, 0x35648095UL, + 0x7789F8B7UL, 0xE6C1121BUL, 0x0E241600UL, 0x052CE8B5UL, + 0x11A9CFB0UL, 0xE5952F11UL, 0xECE7990AUL, 0x9386D174UL, + 0x2A42931CUL, 0x76E38111UL, 0xB12DEF3AUL, 0x37DDDDFCUL, + 0xDE9ADEB1UL, 0x0A0CC32CUL, 0xBE197029UL, 0x84A00940UL, + 0xBB243A0FUL, 0xB4D137CFUL, 0xB44E79F0UL, 0x049EEDFDUL, + 0x0B15A15DUL, 0x480D3168UL, 0x8BBBDE5AUL, 0x669DED42UL, + 0xC7ECE831UL, 0x3F8F95E7UL, 0x72DF191BUL, 0x7580330DUL, + 0x94074251UL, 0x5C7DCDFAUL, 0xABBE6D63UL, 0xAA402164UL, + 0xB301D40AUL, 0x02E7D1CAUL, 0x53571DAEUL, 0x7A3182A2UL, + 0x12A8DDECUL, 0xFDAA335DUL, 0x176F43E8UL, 0x71FB46D4UL, + 0x38129022UL, 0xCE949AD4UL, 0xB84769ADUL, 0x965BD862UL, + 0x82F3D055UL, 0x66FB9767UL, 0x15B80B4EUL, 0x1D5B47A0UL, + 0x4CFDE06FUL, 0xC28EC4B8UL, 0x57E8726EUL, 0x647A78FCUL, + 0x99865D44UL, 0x608BD593UL, 0x6C200E03UL, 0x39DC5FF6UL, + 0x5D0B00A3UL, 0xAE63AFF2UL, 0x7E8BD632UL, 0x70108C0CUL, + 0xBBD35049UL, 0x2998DF04UL, 0x980CF42AUL, 0x9B6DF491UL, + 0x9E7EDD53UL, 0x06918548UL, 0x58CB7E07UL, 0x3B74EF2EUL, + 0x522FFFB1UL, 0xD24708CCUL, 0x1C7E27CDUL, 0xA4EB215BUL, + 0x3CF1D2E2UL, 0x19B47A38UL, 0x424F7618UL, 0x35856039UL, + 0x9D17DEE7UL, 0x27EB35E6UL, 0xC9AFF67BUL, 0x36BAF5B8UL, + 0x09C467CDUL, 0xC18910B1UL, 0xE11DBF7BUL, 0x06CD1AF8UL, + 0x7170C608UL, 0x2D5E3354UL, 0xD4DE495AUL, 0x64C6D006UL, + 0xBCC0C62CUL, 0x3DD00DB3UL, 0x708F8F34UL, 0x77D51B42UL, + 0x264F620FUL, 0x24B8D2BFUL, 0x15C1B79EUL, 0x46A52564UL, + 0xF8D7E54EUL, 0x3E378160UL, 0x7895CDA5UL, 0x859C15A5UL, + 0xE6459788UL, 0xC37BC75FUL, 0xDB07BA0CUL, 0x0676A3ABUL, + 0x7F229B1EUL, 0x31842E7BUL, 0x24259FD7UL, 0xF8BEF472UL, + 0x835FFCB8UL, 0x6DF4C1F2UL, 0x96F5B195UL, 0xFD0AF0FCUL, + 0xB0FE134CUL, 0xE2506D3DUL, 0x4F9B12EAUL, 0xF215F225UL, + 0xA223736FUL, 0x9FB4C428UL, 0x25D04979UL, 0x34C713F8UL, + 0xC4618187UL, 0xEA7A6E98UL, 0x7CD16EFCUL, 0x1436876CUL, + 0xF1544107UL, 0xBEDEEE14UL, 0x56E9AF27UL, 0xA04AA441UL, + 0x3CF7C899UL, 0x92ECBAE6UL, 0xDD67016DUL, 0x151682EBUL, + 0xA842EEDFUL, 0xFDBA60B4UL, 0xF1907B75UL, 0x20E3030FUL, + 0x24D8C29EUL, 0xE139673BUL, 0xEFA63FB8UL, 0x71873054UL, + 0xB6F2CF3BUL, 0x9F326442UL, 0xCB15A4CCUL, 0xB01A4504UL, + 0xF1E47D8DUL, 0x844A1BE5UL, 0xBAE7DFDCUL, 0x42CBDA70UL, + 0xCD7DAE0AUL, 0x57E85B7AUL, 0xD53F5AF6UL, 0x20CF4D8CUL, + 0xCEA4D428UL, 0x79D130A4UL, 0x3486EBFBUL, 0x33D3CDDCUL, + 0x77853B53UL, 0x37EFFCB5UL, 0xC5068778UL, 0xE580B3E6UL, + 0x4E68B8F4UL, 0xC5C8B37EUL, 0x0D809EA2UL, 0x398FEB7CUL, + 0x132A4F94UL, 0x43B7950EUL, 0x2FEE7D1CUL, 0x223613BDUL, + 0xDD06CAA2UL, 0x37DF932BUL, 0xC4248289UL, 0xACF3EBC3UL, + 0x5715F6B7UL, 0xEF3478DDUL, 0xF267616FUL, 0xC148CBE4UL, + 0x9052815EUL, 0x5E410FABUL, 0xB48A2465UL, 0x2EDA7FA4UL, + 0xE87B40E4UL, 0xE98EA084UL, 0x5889E9E1UL, 0xEFD390FCUL, + 0xDD07D35BUL, 0xDB485694UL, 0x38D7E5B2UL, 0x57720101UL, + 0x730EDEBCUL, 0x5B643113UL, 0x94917E4FUL, 0x503C2FBAUL, + 0x646F1282UL, 0x7523D24AUL, 0xE0779695UL, 0xF9C17A8FUL, + 0x7A5B2121UL, 0xD187B896UL, 0x29263A4DUL, 0xBA510CDFUL, + 0x81F47C9FUL, 0xAD1163EDUL, 0xEA7B5965UL, 0x1A00726EUL, + 0x11403092UL, 0x00DA6D77UL, 0x4A0CDD61UL, 0xAD1F4603UL, + 0x605BDFB0UL, 0x9EEDC364UL, 0x22EBE6A8UL, 0xCEE7D28AUL, + 0xA0E736A0UL, 0x5564A6B9UL, 0x10853209UL, 0xC7EB8F37UL, + 0x2DE705CAUL, 0x8951570FUL, 0xDF09822BUL, 0xBD691A6CUL, + 0xAA12E4F2UL, 0x87451C0FUL, 0xE0F6A27AUL, 0x3ADA4819UL, + 0x4CF1764FUL, 0x0D771C2BUL, 0x67CDB156UL, 0x350D8384UL, + 0x5938FA0FUL, 0x42399EF3UL, 0x36997B07UL, 0x0E84093DUL, + 0x4AA93E61UL, 0x8360D87BUL, 0x1FA98B0CUL, 0x1149382CUL, + 0xE97625A5UL, 0x0614D1B7UL, 0x0E25244BUL, 0x0C768347UL, + 0x589E8D82UL, 0x0D2059D1UL, 0xA466BB1EUL, 0xF8DA0A82UL, + 0x04F19130UL, 0xBA6E4EC0UL, 0x99265164UL, 0x1EE7230DUL, + 0x50B2AD80UL, 0xEAEE6801UL, 0x8DB2A283UL, 0xEA8BF59EUL +}}; + +NAMESPACE_END diff --git a/cryptopp/cbcmac.cpp b/cryptopp/cbcmac.cpp new file mode 100644 index 0000000..6b0e885 --- /dev/null +++ b/cryptopp/cbcmac.cpp @@ -0,0 +1,62 @@ +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "cbcmac.h" + +NAMESPACE_BEGIN(CryptoPP) + +void CBC_MAC_Base::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) +{ + AccessCipher().SetKey(key, length, params); + m_reg.CleanNew(AccessCipher().BlockSize()); + m_counter = 0; +} + +void CBC_MAC_Base::Update(const byte *input, size_t length) +{ + unsigned int blockSize = AccessCipher().BlockSize(); + + while (m_counter && length) + { + m_reg[m_counter++] ^= *input++; + if (m_counter == blockSize) + ProcessBuf(); + length--; + } + + if (length >= blockSize) + { + size_t leftOver = AccessCipher().AdvancedProcessBlocks(m_reg, input, m_reg, length, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput); + input += (length - leftOver); + length = leftOver; + } + + while (length--) + { + m_reg[m_counter++] ^= *input++; + if (m_counter == blockSize) + ProcessBuf(); + } +} + +void CBC_MAC_Base::TruncatedFinal(byte *mac, size_t size) +{ + ThrowIfInvalidTruncatedSize(size); + + if (m_counter) + ProcessBuf(); + + memcpy(mac, m_reg, size); + memset(m_reg, 0, AccessCipher().BlockSize()); +} + +void CBC_MAC_Base::ProcessBuf() +{ + AccessCipher().ProcessBlock(m_reg); + m_counter = 0; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/cbcmac.h b/cryptopp/cbcmac.h new file mode 100644 index 0000000..4675dcb --- /dev/null +++ b/cryptopp/cbcmac.h @@ -0,0 +1,50 @@ +#ifndef CRYPTOPP_CBCMAC_H +#define CRYPTOPP_CBCMAC_H + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_MAC_Base : public MessageAuthenticationCode +{ +public: + CBC_MAC_Base() {} + + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); + void Update(const byte *input, size_t length); + void TruncatedFinal(byte *mac, size_t size); + unsigned int DigestSize() const {return const_cast(this)->AccessCipher().BlockSize();} + +protected: + virtual BlockCipher & AccessCipher() =0; + +private: + void ProcessBuf(); + SecByteBlock m_reg; + unsigned int m_counter; +}; + +//! CBC-MAC +/*! Compatible with FIPS 113. T should be a class derived from BlockCipherDocumentation. + Secure only for fixed length messages. For variable length messages use CMAC or DMAC. +*/ +template +class CBC_MAC : public MessageAuthenticationCodeImpl >, public SameKeyLengthAs +{ +public: + CBC_MAC() {} + CBC_MAC(const byte *key, size_t length=SameKeyLengthAs::DEFAULT_KEYLENGTH) + {this->SetKey(key, length);} + + static std::string StaticAlgorithmName() {return std::string("CBC-MAC(") + T::StaticAlgorithmName() + ")";} + +private: + BlockCipher & AccessCipher() {return m_cipher;} + typename T::Encryption m_cipher; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/ccm.cpp b/cryptopp/ccm.cpp new file mode 100644 index 0000000..030828a --- /dev/null +++ b/cryptopp/ccm.cpp @@ -0,0 +1,140 @@ +// ccm.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "ccm.h" + +NAMESPACE_BEGIN(CryptoPP) + +void CCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms) +{ + BlockCipher &blockCipher = AccessBlockCipher(); + + blockCipher.SetKey(userKey, keylength, params); + + if (blockCipher.BlockSize() != REQUIRED_BLOCKSIZE) + throw InvalidArgument(AlgorithmName() + ": block size of underlying block cipher is not 16"); + + m_digestSize = params.GetIntValueWithDefault(Name::DigestSize(), DefaultDigestSize()); + if (m_digestSize % 2 > 0 || m_digestSize < 4 || m_digestSize > 16) + throw InvalidArgument(AlgorithmName() + ": DigestSize must be 4, 6, 8, 10, 12, 14, or 16"); + + m_buffer.Grow(2*REQUIRED_BLOCKSIZE); + m_L = 8; +} + +void CCM_Base::Resync(const byte *iv, size_t len) +{ + BlockCipher &cipher = AccessBlockCipher(); + + m_L = REQUIRED_BLOCKSIZE-1-(int)len; + assert(m_L >= 2); + if (m_L > 8) + m_L = 8; + + m_buffer[0] = byte(m_L-1); // flag + memcpy(m_buffer+1, iv, len); + memset(m_buffer+1+len, 0, REQUIRED_BLOCKSIZE-1-len); + + if (m_state >= State_IVSet) + m_ctr.Resynchronize(m_buffer, REQUIRED_BLOCKSIZE); + else + m_ctr.SetCipherWithIV(cipher, m_buffer); + + m_ctr.Seek(REQUIRED_BLOCKSIZE); + m_aadLength = 0; + m_messageLength = 0; +} + +void CCM_Base::UncheckedSpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength) +{ + if (m_state != State_IVSet) + throw BadState(AlgorithmName(), "SpecifyDataLengths", "or after State_IVSet"); + + m_aadLength = headerLength; + m_messageLength = messageLength; + + byte *cbcBuffer = CBC_Buffer(); + const BlockCipher &cipher = GetBlockCipher(); + + cbcBuffer[0] = byte(64*(headerLength>0) + 8*((m_digestSize-2)/2) + (m_L-1)); // flag + PutWord(true, BIG_ENDIAN_ORDER, cbcBuffer+REQUIRED_BLOCKSIZE-8, m_messageLength); + memcpy(cbcBuffer+1, m_buffer+1, REQUIRED_BLOCKSIZE-1-m_L); + cipher.ProcessBlock(cbcBuffer); + + if (headerLength>0) + { + assert(m_bufferedDataLength == 0); + + if (headerLength < ((1<<16) - (1<<8))) + { + PutWord(true, BIG_ENDIAN_ORDER, m_buffer, (word16)headerLength); + m_bufferedDataLength = 2; + } + else if (headerLength < (W64LIT(1)<<32)) + { + m_buffer[0] = 0xff; + m_buffer[1] = 0xfe; + PutWord(false, BIG_ENDIAN_ORDER, m_buffer+2, (word32)headerLength); + m_bufferedDataLength = 6; + } + else + { + m_buffer[0] = 0xff; + m_buffer[1] = 0xff; + PutWord(false, BIG_ENDIAN_ORDER, m_buffer+2, headerLength); + m_bufferedDataLength = 10; + } + } +} + +size_t CCM_Base::AuthenticateBlocks(const byte *data, size_t len) +{ + byte *cbcBuffer = CBC_Buffer(); + const BlockCipher &cipher = GetBlockCipher(); + return cipher.AdvancedProcessBlocks(cbcBuffer, data, cbcBuffer, len, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput); +} + +void CCM_Base::AuthenticateLastHeaderBlock() +{ + byte *cbcBuffer = CBC_Buffer(); + const BlockCipher &cipher = GetBlockCipher(); + + if (m_aadLength != m_totalHeaderLength) + throw InvalidArgument(AlgorithmName() + ": header length doesn't match that given in SpecifyDataLengths"); + + if (m_bufferedDataLength > 0) + { + xorbuf(cbcBuffer, m_buffer, m_bufferedDataLength); + cipher.ProcessBlock(cbcBuffer); + m_bufferedDataLength = 0; + } +} + +void CCM_Base::AuthenticateLastConfidentialBlock() +{ + byte *cbcBuffer = CBC_Buffer(); + const BlockCipher &cipher = GetBlockCipher(); + + if (m_messageLength != m_totalMessageLength) + throw InvalidArgument(AlgorithmName() + ": message length doesn't match that given in SpecifyDataLengths"); + + if (m_bufferedDataLength > 0) + { + xorbuf(cbcBuffer, m_buffer, m_bufferedDataLength); + cipher.ProcessBlock(cbcBuffer); + m_bufferedDataLength = 0; + } +} + +void CCM_Base::AuthenticateLastFooterBlock(byte *mac, size_t macSize) +{ + m_ctr.Seek(0); + m_ctr.ProcessData(mac, CBC_Buffer(), macSize); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/ccm.h b/cryptopp/ccm.h new file mode 100644 index 0000000..b1e5f00 --- /dev/null +++ b/cryptopp/ccm.h @@ -0,0 +1,101 @@ +#ifndef CRYPTOPP_CCM_H +#define CRYPTOPP_CCM_H + +#include "authenc.h" +#include "modes.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! . +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CCM_Base : public AuthenticatedSymmetricCipherBase +{ +public: + CCM_Base() + : m_digestSize(0), m_L(0) {} + + // AuthenticatedSymmetricCipher + std::string AlgorithmName() const + {return GetBlockCipher().AlgorithmName() + std::string("/CCM");} + size_t MinKeyLength() const + {return GetBlockCipher().MinKeyLength();} + size_t MaxKeyLength() const + {return GetBlockCipher().MaxKeyLength();} + size_t DefaultKeyLength() const + {return GetBlockCipher().DefaultKeyLength();} + size_t GetValidKeyLength(size_t n) const + {return GetBlockCipher().GetValidKeyLength(n);} + bool IsValidKeyLength(size_t n) const + {return GetBlockCipher().IsValidKeyLength(n);} + unsigned int OptimalDataAlignment() const + {return GetBlockCipher().OptimalDataAlignment();} + IV_Requirement IVRequirement() const + {return UNIQUE_IV;} + unsigned int IVSize() const + {return 8;} + unsigned int MinIVLength() const + {return 7;} + unsigned int MaxIVLength() const + {return 13;} + unsigned int DigestSize() const + {return m_digestSize;} + lword MaxHeaderLength() const + {return W64LIT(0)-1;} + lword MaxMessageLength() const + {return m_L<8 ? (W64LIT(1)<<(8*m_L))-1 : W64LIT(0)-1;} + bool NeedsPrespecifiedDataLengths() const + {return true;} + void UncheckedSpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength); + +protected: + // AuthenticatedSymmetricCipherBase + bool AuthenticationIsOnPlaintext() const + {return true;} + unsigned int AuthenticationBlockSize() const + {return GetBlockCipher().BlockSize();} + void SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms); + void Resync(const byte *iv, size_t len); + size_t AuthenticateBlocks(const byte *data, size_t len); + void AuthenticateLastHeaderBlock(); + void AuthenticateLastConfidentialBlock(); + void AuthenticateLastFooterBlock(byte *mac, size_t macSize); + SymmetricCipher & AccessSymmetricCipher() {return m_ctr;} + + virtual BlockCipher & AccessBlockCipher() =0; + virtual int DefaultDigestSize() const =0; + + const BlockCipher & GetBlockCipher() const {return const_cast(this)->AccessBlockCipher();}; + byte *CBC_Buffer() {return m_buffer+REQUIRED_BLOCKSIZE;} + + enum {REQUIRED_BLOCKSIZE = 16}; + int m_digestSize, m_L; + word64 m_messageLength, m_aadLength; + CTR_Mode_ExternalCipher::Encryption m_ctr; +}; + +//! . +template +class CCM_Final : public CCM_Base +{ +public: + static std::string StaticAlgorithmName() + {return T_BlockCipher::StaticAlgorithmName() + std::string("/CCM");} + bool IsForwardTransformation() const + {return T_IsEncryption;} + +private: + BlockCipher & AccessBlockCipher() {return m_cipher;} + int DefaultDigestSize() const {return T_DefaultDigestSize;} + typename T_BlockCipher::Encryption m_cipher; +}; + +/// CCM +template +struct CCM : public AuthenticatedSymmetricCipherDocumentation +{ + typedef CCM_Final Encryption; + typedef CCM_Final Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/channels.cpp b/cryptopp/channels.cpp new file mode 100644 index 0000000..7359f54 --- /dev/null +++ b/cryptopp/channels.cpp @@ -0,0 +1,309 @@ +// channels.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "channels.h" + +NAMESPACE_BEGIN(CryptoPP) +USING_NAMESPACE(std) + +#if 0 +void MessageSwitch::AddDefaultRoute(BufferedTransformation &destination, const std::string &channel) +{ + m_defaultRoutes.push_back(Route(&destination, channel)); +} + +void MessageSwitch::AddRoute(unsigned int begin, unsigned int end, BufferedTransformation &destination, const std::string &channel) +{ + RangeRoute route(begin, end, Route(&destination, channel)); + RouteList::iterator it = upper_bound(m_routes.begin(), m_routes.end(), route); + m_routes.insert(it, route); +} + +/* +class MessageRouteIterator +{ +public: + typedef MessageSwitch::RouteList::const_iterator RouteIterator; + typedef MessageSwitch::DefaultRouteList::const_iterator DefaultIterator; + + bool m_useDefault; + RouteIterator m_itRouteCurrent, m_itRouteEnd; + DefaultIterator m_itDefaultCurrent, m_itDefaultEnd; + + MessageRouteIterator(MessageSwitch &ms, const std::string &channel) + : m_channel(channel) + { + pair range = cs.m_routeMap.equal_range(channel); + if (range.first == range.second) + { + m_useDefault = true; + m_itListCurrent = cs.m_defaultRoutes.begin(); + m_itListEnd = cs.m_defaultRoutes.end(); + } + else + { + m_useDefault = false; + m_itMapCurrent = range.first; + m_itMapEnd = range.second; + } + } + + bool End() const + { + return m_useDefault ? m_itListCurrent == m_itListEnd : m_itMapCurrent == m_itMapEnd; + } + + void Next() + { + if (m_useDefault) + ++m_itListCurrent; + else + ++m_itMapCurrent; + } + + BufferedTransformation & Destination() + { + return m_useDefault ? *m_itListCurrent->first : *m_itMapCurrent->second.first; + } + + const std::string & Message() + { + if (m_useDefault) + return m_itListCurrent->second.get() ? *m_itListCurrent->second.get() : m_channel; + else + return m_itMapCurrent->second.second; + } +}; + +void MessageSwitch::Put(byte inByte); +void MessageSwitch::Put(const byte *inString, unsigned int length); + +void MessageSwitch::Flush(bool completeFlush, int propagation=-1); +void MessageSwitch::MessageEnd(int propagation=-1); +void MessageSwitch::PutMessageEnd(const byte *inString, unsigned int length, int propagation=-1); +void MessageSwitch::MessageSeriesEnd(int propagation=-1); +*/ +#endif + + +// +// ChannelRouteIterator +////////////////////////// + +void ChannelRouteIterator::Reset(const std::string &channel) +{ + m_channel = channel; + pair range = m_cs.m_routeMap.equal_range(channel); + if (range.first == range.second) + { + m_useDefault = true; + m_itListCurrent = m_cs.m_defaultRoutes.begin(); + m_itListEnd = m_cs.m_defaultRoutes.end(); + } + else + { + m_useDefault = false; + m_itMapCurrent = range.first; + m_itMapEnd = range.second; + } +} + +bool ChannelRouteIterator::End() const +{ + return m_useDefault ? m_itListCurrent == m_itListEnd : m_itMapCurrent == m_itMapEnd; +} + +void ChannelRouteIterator::Next() +{ + if (m_useDefault) + ++m_itListCurrent; + else + ++m_itMapCurrent; +} + +BufferedTransformation & ChannelRouteIterator::Destination() +{ + return m_useDefault ? *m_itListCurrent->first : *m_itMapCurrent->second.first; +} + +const std::string & ChannelRouteIterator::Channel() +{ + if (m_useDefault) + return m_itListCurrent->second.get() ? *m_itListCurrent->second.get() : m_channel; + else + return m_itMapCurrent->second.second; +} + + +// +// ChannelSwitch +/////////////////// + +size_t ChannelSwitch::ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking) +{ + if (m_blocked) + { + m_blocked = false; + goto WasBlocked; + } + + m_it.Reset(channel); + + while (!m_it.End()) + { +WasBlocked: + if (m_it.Destination().ChannelPut2(m_it.Channel(), begin, length, messageEnd, blocking)) + { + m_blocked = true; + return 1; + } + + m_it.Next(); + } + + return 0; +} + +void ChannelSwitch::IsolatedInitialize(const NameValuePairs ¶meters/* =g_nullNameValuePairs */) +{ + m_routeMap.clear(); + m_defaultRoutes.clear(); + m_blocked = false; +} + +bool ChannelSwitch::ChannelFlush(const std::string &channel, bool completeFlush, int propagation, bool blocking) +{ + if (m_blocked) + { + m_blocked = false; + goto WasBlocked; + } + + m_it.Reset(channel); + + while (!m_it.End()) + { + WasBlocked: + if (m_it.Destination().ChannelFlush(m_it.Channel(), completeFlush, propagation, blocking)) + { + m_blocked = true; + return true; + } + + m_it.Next(); + } + + return false; +} + +bool ChannelSwitch::ChannelMessageSeriesEnd(const std::string &channel, int propagation, bool blocking) +{ + if (m_blocked) + { + m_blocked = false; + goto WasBlocked; + } + + m_it.Reset(channel); + + while (!m_it.End()) + { + WasBlocked: + if (m_it.Destination().ChannelMessageSeriesEnd(m_it.Channel(), propagation)) + { + m_blocked = true; + return true; + } + + m_it.Next(); + } + + return false; +} + +byte * ChannelSwitch::ChannelCreatePutSpace(const std::string &channel, size_t &size) +{ + m_it.Reset(channel); + if (!m_it.End()) + { + BufferedTransformation &target = m_it.Destination(); + const std::string &channel = m_it.Channel(); + m_it.Next(); + if (m_it.End()) // there is only one target channel + return target.ChannelCreatePutSpace(channel, size); + } + size = 0; + return NULL; +} + +size_t ChannelSwitch::ChannelPutModifiable2(const std::string &channel, byte *inString, size_t length, int messageEnd, bool blocking) +{ + ChannelRouteIterator it(*this); + it.Reset(channel); + + if (!it.End()) + { + BufferedTransformation &target = it.Destination(); + const std::string &targetChannel = it.Channel(); + it.Next(); + if (it.End()) // there is only one target channel + return target.ChannelPutModifiable2(targetChannel, inString, length, messageEnd, blocking); + } + + return ChannelPut2(channel, inString, length, messageEnd, blocking); +} + +void ChannelSwitch::AddDefaultRoute(BufferedTransformation &destination) +{ + m_defaultRoutes.push_back(DefaultRoute(&destination, value_ptr(NULL))); +} + +void ChannelSwitch::RemoveDefaultRoute(BufferedTransformation &destination) +{ + for (DefaultRouteList::iterator it = m_defaultRoutes.begin(); it != m_defaultRoutes.end(); ++it) + if (it->first == &destination && !it->second.get()) + { + m_defaultRoutes.erase(it); + break; + } +} + +void ChannelSwitch::AddDefaultRoute(BufferedTransformation &destination, const std::string &outChannel) +{ + m_defaultRoutes.push_back(DefaultRoute(&destination, outChannel)); +} + +void ChannelSwitch::RemoveDefaultRoute(BufferedTransformation &destination, const std::string &outChannel) +{ + for (DefaultRouteList::iterator it = m_defaultRoutes.begin(); it != m_defaultRoutes.end(); ++it) + if (it->first == &destination && (it->second.get() && *it->second == outChannel)) + { + m_defaultRoutes.erase(it); + break; + } +} + +void ChannelSwitch::AddRoute(const std::string &inChannel, BufferedTransformation &destination, const std::string &outChannel) +{ + m_routeMap.insert(RouteMap::value_type(inChannel, Route(&destination, outChannel))); +} + +void ChannelSwitch::RemoveRoute(const std::string &inChannel, BufferedTransformation &destination, const std::string &outChannel) +{ + typedef ChannelSwitch::RouteMap::iterator MapIterator; + pair range = m_routeMap.equal_range(inChannel); + + for (MapIterator it = range.first; it != range.second; ++it) + if (it->second.first == &destination && it->second.second == outChannel) + { + m_routeMap.erase(it); + break; + } +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/channels.h b/cryptopp/channels.h new file mode 100644 index 0000000..8374156 --- /dev/null +++ b/cryptopp/channels.h @@ -0,0 +1,123 @@ +#ifndef CRYPTOPP_CHANNELS_H +#define CRYPTOPP_CHANNELS_H + +#include "simple.h" +#include "smartptr.h" +#include +#include + +NAMESPACE_BEGIN(CryptoPP) + +#if 0 +//! Route input on default channel to different and/or multiple channels based on message sequence number +class MessageSwitch : public Sink +{ +public: + void AddDefaultRoute(BufferedTransformation &destination, const std::string &channel); + void AddRoute(unsigned int begin, unsigned int end, BufferedTransformation &destination, const std::string &channel); + + void Put(byte inByte); + void Put(const byte *inString, unsigned int length); + + void Flush(bool completeFlush, int propagation=-1); + void MessageEnd(int propagation=-1); + void PutMessageEnd(const byte *inString, unsigned int length, int propagation=-1); + void MessageSeriesEnd(int propagation=-1); + +private: + typedef std::pair Route; + struct RangeRoute + { + RangeRoute(unsigned int begin, unsigned int end, const Route &route) + : begin(begin), end(end), route(route) {} + bool operator<(const RangeRoute &rhs) const {return begin < rhs.begin;} + unsigned int begin, end; + Route route; + }; + + typedef std::list RouteList; + typedef std::list DefaultRouteList; + + RouteList m_routes; + DefaultRouteList m_defaultRoutes; + unsigned int m_nCurrentMessage; +}; +#endif + +class ChannelSwitchTypedefs +{ +public: + typedef std::pair Route; + typedef std::multimap RouteMap; + + typedef std::pair > DefaultRoute; + typedef std::list DefaultRouteList; + + // SunCC workaround: can't use const_iterator here + typedef RouteMap::iterator MapIterator; + typedef DefaultRouteList::iterator ListIterator; +}; + +class ChannelSwitch; + +class ChannelRouteIterator : public ChannelSwitchTypedefs +{ +public: + ChannelSwitch& m_cs; + std::string m_channel; + bool m_useDefault; + MapIterator m_itMapCurrent, m_itMapEnd; + ListIterator m_itListCurrent, m_itListEnd; + + ChannelRouteIterator(ChannelSwitch &cs) : m_cs(cs) {} + void Reset(const std::string &channel); + bool End() const; + void Next(); + BufferedTransformation & Destination(); + const std::string & Channel(); +}; + +//! Route input to different and/or multiple channels based on channel ID +class CRYPTOPP_DLL ChannelSwitch : public Multichannel, public ChannelSwitchTypedefs +{ +public: + ChannelSwitch() : m_it(*this), m_blocked(false) {} + ChannelSwitch(BufferedTransformation &destination) : m_it(*this), m_blocked(false) + { + AddDefaultRoute(destination); + } + ChannelSwitch(BufferedTransformation &destination, const std::string &outChannel) : m_it(*this), m_blocked(false) + { + AddDefaultRoute(destination, outChannel); + } + + void IsolatedInitialize(const NameValuePairs ¶meters=g_nullNameValuePairs); + + size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking); + size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking); + + bool ChannelFlush(const std::string &channel, bool completeFlush, int propagation=-1, bool blocking=true); + bool ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1, bool blocking=true); + + byte * ChannelCreatePutSpace(const std::string &channel, size_t &size); + + void AddDefaultRoute(BufferedTransformation &destination); + void RemoveDefaultRoute(BufferedTransformation &destination); + void AddDefaultRoute(BufferedTransformation &destination, const std::string &outChannel); + void RemoveDefaultRoute(BufferedTransformation &destination, const std::string &outChannel); + void AddRoute(const std::string &inChannel, BufferedTransformation &destination, const std::string &outChannel); + void RemoveRoute(const std::string &inChannel, BufferedTransformation &destination, const std::string &outChannel); + +private: + RouteMap m_routeMap; + DefaultRouteList m_defaultRoutes; + + ChannelRouteIterator m_it; + bool m_blocked; + + friend class ChannelRouteIterator; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/cmac.cpp b/cryptopp/cmac.cpp new file mode 100644 index 0000000..a31d5f8 --- /dev/null +++ b/cryptopp/cmac.cpp @@ -0,0 +1,122 @@ +// cmac.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "cmac.h" + +NAMESPACE_BEGIN(CryptoPP) + +static void MulU(byte *k, unsigned int length) +{ + byte carry = 0; + + for (int i=length-1; i>=1; i-=2) + { + byte carry2 = k[i] >> 7; + k[i] += k[i] + carry; + carry = k[i-1] >> 7; + k[i-1] += k[i-1] + carry2; + } + + if (carry) + { + switch (length) + { + case 8: + k[7] ^= 0x1b; + break; + case 16: + k[15] ^= 0x87; + break; + case 32: + k[30] ^= 4; + k[31] ^= 0x23; + break; + default: + throw InvalidArgument("CMAC: " + IntToString(length) + " is not a supported cipher block size"); + } + } +} + +void CMAC_Base::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) +{ + BlockCipher &cipher = AccessCipher(); + unsigned int blockSize = cipher.BlockSize(); + + cipher.SetKey(key, length, params); + m_reg.CleanNew(3*blockSize); + m_counter = 0; + + cipher.ProcessBlock(m_reg, m_reg+blockSize); + MulU(m_reg+blockSize, blockSize); + memcpy(m_reg+2*blockSize, m_reg+blockSize, blockSize); + MulU(m_reg+2*blockSize, blockSize); +} + +void CMAC_Base::Update(const byte *input, size_t length) +{ + if (!length) + return; + + BlockCipher &cipher = AccessCipher(); + unsigned int blockSize = cipher.BlockSize(); + + if (m_counter > 0) + { + unsigned int len = UnsignedMin(blockSize - m_counter, length); + xorbuf(m_reg+m_counter, input, len); + length -= len; + input += len; + m_counter += len; + + if (m_counter == blockSize && length > 0) + { + cipher.ProcessBlock(m_reg); + m_counter = 0; + } + } + + if (length > blockSize) + { + assert(m_counter == 0); + size_t leftOver = 1 + cipher.AdvancedProcessBlocks(m_reg, input, m_reg, length-1, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput); + input += (length - leftOver); + length = leftOver; + } + + if (length > 0) + { + assert(m_counter + length <= blockSize); + xorbuf(m_reg+m_counter, input, length); + m_counter += (unsigned int)length; + } + + assert(m_counter > 0); +} + +void CMAC_Base::TruncatedFinal(byte *mac, size_t size) +{ + ThrowIfInvalidTruncatedSize(size); + + BlockCipher &cipher = AccessCipher(); + unsigned int blockSize = cipher.BlockSize(); + + if (m_counter < blockSize) + { + m_reg[m_counter] ^= 0x80; + cipher.AdvancedProcessBlocks(m_reg, m_reg+2*blockSize, m_reg, blockSize, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput); + } + else + cipher.AdvancedProcessBlocks(m_reg, m_reg+blockSize, m_reg, blockSize, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput); + + memcpy(mac, m_reg, size); + + m_counter = 0; + memset(m_reg, 0, blockSize); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/cmac.h b/cryptopp/cmac.h new file mode 100644 index 0000000..d8a1b39 --- /dev/null +++ b/cryptopp/cmac.h @@ -0,0 +1,52 @@ +#ifndef CRYPTOPP_CMAC_H +#define CRYPTOPP_CMAC_H + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CMAC_Base : public MessageAuthenticationCode +{ +public: + CMAC_Base() {} + + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); + void Update(const byte *input, size_t length); + void TruncatedFinal(byte *mac, size_t size); + unsigned int DigestSize() const {return GetCipher().BlockSize();} + unsigned int OptimalBlockSize() const {return GetCipher().BlockSize();} + unsigned int OptimalDataAlignment() const {return GetCipher().OptimalDataAlignment();} + +protected: + friend class EAX_Base; + + const BlockCipher & GetCipher() const {return const_cast(this)->AccessCipher();} + virtual BlockCipher & AccessCipher() =0; + + void ProcessBuf(); + SecByteBlock m_reg; + unsigned int m_counter; +}; + +/// CMAC +/*! Template parameter T should be a class derived from BlockCipherDocumentation, for example AES, with a block size of 8, 16, or 32 */ +template +class CMAC : public MessageAuthenticationCodeImpl >, public SameKeyLengthAs +{ +public: + CMAC() {} + CMAC(const byte *key, size_t length=SameKeyLengthAs::DEFAULT_KEYLENGTH) + {this->SetKey(key, length);} + + static std::string StaticAlgorithmName() {return std::string("CMAC(") + T::StaticAlgorithmName() + ")";} + +private: + BlockCipher & AccessCipher() {return m_cipher;} + typename T::Encryption m_cipher; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/config.h b/cryptopp/config.h new file mode 100644 index 0000000..de6b0d7 --- /dev/null +++ b/cryptopp/config.h @@ -0,0 +1,455 @@ +#ifndef CRYPTOPP_CONFIG_H +#define CRYPTOPP_CONFIG_H + +// ***************** Important Settings ******************** + +// define this if running on a big-endian CPU +#if !defined(IS_LITTLE_ENDIAN) && (defined(__BIG_ENDIAN__) || defined(__sparc) || defined(__sparc__) || defined(__hppa__) || defined(__mips__) || (defined(__MWERKS__) && !defined(__INTEL__))) +# define IS_BIG_ENDIAN +#endif + +// define this if running on a little-endian CPU +// big endian will be assumed if IS_LITTLE_ENDIAN is not defined +#ifndef IS_BIG_ENDIAN +# define IS_LITTLE_ENDIAN +#endif + +// define this if you want to disable all OS-dependent features, +// such as sockets and OS-provided random number generators +// #define NO_OS_DEPENDENCE + +// Define this to use features provided by Microsoft's CryptoAPI. +// Currently the only feature used is random number generation. +// This macro will be ignored if NO_OS_DEPENDENCE is defined. +#define USE_MS_CRYPTOAPI + +// Define this to 1 to enforce the requirement in FIPS 186-2 Change Notice 1 that only 1024 bit moduli be used +#ifndef DSA_1024_BIT_MODULUS_ONLY +# define DSA_1024_BIT_MODULUS_ONLY 1 +#endif + +// ***************** Less Important Settings *************** + +// define this to retain (as much as possible) old deprecated function and class names +// #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY + +#define GZIP_OS_CODE 0 + +// Try this if your CPU has 256K internal cache or a slow multiply instruction +// and you want a (possibly) faster IDEA implementation using log tables +// #define IDEA_LARGECACHE + +// Define this if, for the linear congruential RNG, you want to use +// the original constants as specified in S.K. Park and K.W. Miller's +// CACM paper. +// #define LCRNG_ORIGINAL_NUMBERS + +// choose which style of sockets to wrap (mostly useful for cygwin which has both) +#define PREFER_BERKELEY_STYLE_SOCKETS +// #define PREFER_WINDOWS_STYLE_SOCKETS + +// set the name of Rijndael cipher, was "Rijndael" before version 5.3 +#define CRYPTOPP_RIJNDAEL_NAME "AES" + +// ***************** Important Settings Again ******************** +// But the defaults should be ok. + +// namespace support is now required +#ifdef NO_NAMESPACE +# error namespace support is now required +#endif + +// Define this to workaround a Microsoft CryptoAPI bug where +// each call to CryptAcquireContext causes a 100 KB memory leak. +// Defining this will cause Crypto++ to make only one call to CryptAcquireContext. +#define WORKAROUND_MS_BUG_Q258000 + +#ifdef CRYPTOPP_DOXYGEN_PROCESSING +// Avoid putting "CryptoPP::" in front of everything in Doxygen output +# define CryptoPP +# define NAMESPACE_BEGIN(x) +# define NAMESPACE_END +// Get Doxygen to generate better documentation for these typedefs +# define DOCUMENTED_TYPEDEF(x, y) class y : public x {}; +#else +# define NAMESPACE_BEGIN(x) namespace x { +# define NAMESPACE_END } +# define DOCUMENTED_TYPEDEF(x, y) typedef x y; +#endif +#define ANONYMOUS_NAMESPACE_BEGIN namespace { +#define USING_NAMESPACE(x) using namespace x; +#define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x { +#define DOCUMENTED_NAMESPACE_END } + +// What is the type of the third parameter to bind? +// For Unix, the new standard is ::socklen_t (typically unsigned int), and the old standard is int. +// Unfortunately there is no way to tell whether or not socklen_t is defined. +// To work around this, TYPE_OF_SOCKLEN_T is a macro so that you can change it from the makefile. +#ifndef TYPE_OF_SOCKLEN_T +# if defined(_WIN32) || defined(__CYGWIN__) +# define TYPE_OF_SOCKLEN_T int +# else +# define TYPE_OF_SOCKLEN_T ::socklen_t +# endif +#endif + +#if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS) +# define __USE_W32_SOCKETS +#endif + +typedef unsigned char byte; // put in global namespace to avoid ambiguity with other byte typedefs + +NAMESPACE_BEGIN(CryptoPP) + +typedef unsigned short word16; +typedef unsigned int word32; + +#if defined(_MSC_VER) || defined(__BORLANDC__) + typedef unsigned __int64 word64; + #define W64LIT(x) x##ui64 +#else + typedef unsigned long long word64; + #define W64LIT(x) x##ULL +#endif + +// define large word type, used for file offsets and such +typedef word64 lword; +const lword LWORD_MAX = W64LIT(0xffffffffffffffff); + +#ifdef __GNUC__ + #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#endif + +// define hword, word, and dword. these are used for multiprecision integer arithmetic +// Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx +#if (defined(_MSC_VER) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) && (defined(_M_X64) || defined(_M_IA64))) || (defined(__DECCXX) && defined(__alpha__)) || (defined(__INTEL_COMPILER) && defined(__x86_64__)) || (defined(__SUNPRO_CC) && defined(__x86_64__)) + typedef word32 hword; + typedef word64 word; +#else + #define CRYPTOPP_NATIVE_DWORD_AVAILABLE + #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__) + #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400 + // GCC 4.0.1 on MacOS X is missing __umodti3 and __udivti3 + // mode(TI) division broken on amd64 with GCC earlier than GCC 3.4 + typedef word32 hword; + typedef word64 word; + typedef __uint128_t dword; + typedef __uint128_t word128; + #define CRYPTOPP_WORD128_AVAILABLE + #else + // if we're here, it means we're on a 64-bit CPU but we don't have a way to obtain 128-bit multiplication results + typedef word16 hword; + typedef word32 word; + typedef word64 dword; + #endif + #else + // being here means the native register size is probably 32 bits or less + #define CRYPTOPP_BOOL_SLOW_WORD64 1 + typedef word16 hword; + typedef word32 word; + typedef word64 dword; + #endif +#endif +#ifndef CRYPTOPP_BOOL_SLOW_WORD64 + #define CRYPTOPP_BOOL_SLOW_WORD64 0 +#endif + +const unsigned int WORD_SIZE = sizeof(word); +const unsigned int WORD_BITS = WORD_SIZE * 8; + +NAMESPACE_END + +#ifndef CRYPTOPP_L1_CACHE_LINE_SIZE + // This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks. + #if defined(_M_X64) || defined(__x86_64__) + #define CRYPTOPP_L1_CACHE_LINE_SIZE 64 + #else + // L1 cache line size is 32 on Pentium III and earlier + #define CRYPTOPP_L1_CACHE_LINE_SIZE 32 + #endif +#endif + +#if defined(_MSC_VER) + #if _MSC_VER == 1200 + #include + #endif + #if _MSC_VER > 1200 || defined(_mm_free) + #define CRYPTOPP_MSVC6PP_OR_LATER // VC 6 processor pack or later + #else + #define CRYPTOPP_MSVC6_NO_PP // VC 6 without processor pack + #endif +#endif + +#ifndef CRYPTOPP_ALIGN_DATA + #if defined(CRYPTOPP_MSVC6PP_OR_LATER) + #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x)) + #elif defined(__GNUC__) + #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x))) + #else + #define CRYPTOPP_ALIGN_DATA(x) + #endif +#endif + +#ifndef CRYPTOPP_SECTION_ALIGN16 + #if defined(__GNUC__) && !defined(__APPLE__) + // the alignment attribute doesn't seem to work without this section attribute when -fdata-sections is turned on + #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16"))) + #else + #define CRYPTOPP_SECTION_ALIGN16 + #endif +#endif + +#if defined(_MSC_VER) || defined(__fastcall) + #define CRYPTOPP_FASTCALL __fastcall +#else + #define CRYPTOPP_FASTCALL +#endif + +// VC60 workaround: it doesn't allow typename in some places +#if defined(_MSC_VER) && (_MSC_VER < 1300) +#define CPP_TYPENAME +#else +#define CPP_TYPENAME typename +#endif + +// VC60 workaround: can't cast unsigned __int64 to float or double +#if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER) +#define CRYPTOPP_VC6_INT64 (__int64) +#else +#define CRYPTOPP_VC6_INT64 +#endif + +#ifdef _MSC_VER +#define CRYPTOPP_NO_VTABLE __declspec(novtable) +#else +#define CRYPTOPP_NO_VTABLE +#endif + +#ifdef _MSC_VER + // 4231: nonstandard extension used : 'extern' before template explicit instantiation + // 4250: dominance + // 4251: member needs to have dll-interface + // 4275: base needs to have dll-interface + // 4660: explicitly instantiating a class that's already implicitly instantiated + // 4661: no suitable definition provided for explicit template instantiation request + // 4786: identifer was truncated in debug information + // 4355: 'this' : used in base member initializer list + // 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation +# pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355 4910) +#endif + +#ifdef __BORLANDC__ +// 8037: non-const function called for const object. needed to work around BCB2006 bug +# pragma warn -8037 +#endif + +#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION) +#define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION +#endif + +#ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION +#define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE +#endif + +#ifdef CRYPTOPP_DISABLE_X86ASM // for backwards compatibility: this macro had both meanings +#define CRYPTOPP_DISABLE_ASM +#define CRYPTOPP_DISABLE_SSE2 +#endif + +#if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))) + #define CRYPTOPP_X86_ASM_AVAILABLE + + #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300) + #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1 + #else + #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0 + #endif + + // SSSE3 was actually introduced in GNU as 2.17, which was released 6/23/2006, but we can't tell what version of binutils is installed. + // GCC 4.1.2 was released on 2/13/2007, so we'll use that as a proxy for the binutils version. + #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102) + #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1 + #else + #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0 + #endif +#endif + +#if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64) + #define CRYPTOPP_X64_MASM_AVAILABLE +#endif + +#if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__) + #define CRYPTOPP_X64_ASM_AVAILABLE +#endif + +#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) + #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1 +#else + #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0 +#endif + +#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) + #define CRYPTOPP_BOOL_ALIGN16_ENABLED 1 +#else + #define CRYPTOPP_BOOL_ALIGN16_ENABLED 0 +#endif + +// how to allocate 16-byte aligned memory (for SSE2) +#if defined(CRYPTOPP_MSVC6PP_OR_LATER) + #define CRYPTOPP_MM_MALLOC_AVAILABLE +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) + #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16 +#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__) + #define CRYPTOPP_MEMALIGN_AVAILABLE +#else + #define CRYPTOPP_NO_ALIGNED_ALLOC +#endif + +// how to disable inlining +#if defined(_MSC_VER) && _MSC_VER >= 1300 +# define CRYPTOPP_NOINLINE_DOTDOTDOT +# define CRYPTOPP_NOINLINE __declspec(noinline) +#elif defined(__GNUC__) +# define CRYPTOPP_NOINLINE_DOTDOTDOT +# define CRYPTOPP_NOINLINE __attribute__((noinline)) +#else +# define CRYPTOPP_NOINLINE_DOTDOTDOT ... +# define CRYPTOPP_NOINLINE +#endif + +// how to declare class constants +#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__INTEL_COMPILER) +# define CRYPTOPP_CONSTANT(x) enum {x}; +#else +# define CRYPTOPP_CONSTANT(x) static const int x; +#endif + +#if defined(_M_X64) || defined(__x86_64__) + #define CRYPTOPP_BOOL_X64 1 +#else + #define CRYPTOPP_BOOL_X64 0 +#endif + +// see http://predef.sourceforge.net/prearch.html +#if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__) + #define CRYPTOPP_BOOL_X86 1 +#else + #define CRYPTOPP_BOOL_X86 0 +#endif + +#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || defined(__powerpc__) + #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS +#endif + +#define CRYPTOPP_VERSION 560 + +// ***************** determine availability of OS features ******************** + +#ifndef NO_OS_DEPENDENCE + +#if defined(_WIN32) || defined(__CYGWIN__) +#define CRYPTOPP_WIN32_AVAILABLE +#endif + +#if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun) +#define CRYPTOPP_UNIX_AVAILABLE +#endif + +#if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE) +# define HIGHRES_TIMER_AVAILABLE +#endif + +#ifdef CRYPTOPP_UNIX_AVAILABLE +# define HAS_BERKELEY_STYLE_SOCKETS +#endif + +#ifdef CRYPTOPP_WIN32_AVAILABLE +# define HAS_WINDOWS_STYLE_SOCKETS +#endif + +#if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS)) +# define SOCKETS_AVAILABLE +#endif + +#if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS)) +# define USE_WINDOWS_STYLE_SOCKETS +#else +# define USE_BERKELEY_STYLE_SOCKETS +#endif + +#if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS) +# define WINDOWS_PIPES_AVAILABLE +#endif + +#if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI) +# define NONBLOCKING_RNG_AVAILABLE +# define OS_RNG_AVAILABLE +#endif + +#if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING) +# define NONBLOCKING_RNG_AVAILABLE +# define BLOCKING_RNG_AVAILABLE +# define OS_RNG_AVAILABLE +# define HAS_PTHREADS +# define THREADS_AVAILABLE +#endif + +#ifdef CRYPTOPP_WIN32_AVAILABLE +# define HAS_WINTHREADS +# define THREADS_AVAILABLE +#endif + +#endif // NO_OS_DEPENDENCE + +// ***************** DLL related ******************** + +#ifdef CRYPTOPP_WIN32_AVAILABLE + +#ifdef CRYPTOPP_EXPORTS +#define CRYPTOPP_IS_DLL +#define CRYPTOPP_DLL __declspec(dllexport) +#elif defined(CRYPTOPP_IMPORTS) +#define CRYPTOPP_IS_DLL +#define CRYPTOPP_DLL __declspec(dllimport) +#else +#define CRYPTOPP_DLL +#endif + +#define CRYPTOPP_API __cdecl + +#else // CRYPTOPP_WIN32_AVAILABLE + +#define CRYPTOPP_DLL +#define CRYPTOPP_API + +#endif // CRYPTOPP_WIN32_AVAILABLE + +#if defined(__MWERKS__) +#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL +#elif defined(__BORLANDC__) || defined(__SUNPRO_CC) +#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL +#else +#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL +#endif + +#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS) +#define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL +#else +#define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS +#endif + +#if defined(__MWERKS__) +#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class +#elif defined(__BORLANDC__) || defined(__SUNPRO_CC) +#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class +#else +#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class +#endif + +#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS) +#define CRYPTOPP_STATIC_TEMPLATE_CLASS template class +#else +#define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS +#endif + +#endif diff --git a/cryptopp/cpu.cpp b/cryptopp/cpu.cpp new file mode 100644 index 0000000..3e46804 --- /dev/null +++ b/cryptopp/cpu.cpp @@ -0,0 +1,199 @@ +// cpu.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "cpu.h" +#include "misc.h" +#include + +#ifdef __GNUC__ +#include +#include +#endif + +#ifdef CRYPTOPP_MSVC6PP_OR_LATER +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +#ifdef CRYPTOPP_X86_ASM_AVAILABLE + +#ifndef _MSC_VER +typedef void (*SigHandler)(int); + +static jmp_buf s_jmpNoCPUID; +static void SigIllHandlerCPUID(int) +{ + longjmp(s_jmpNoCPUID, 1); +} +#endif + +bool CpuId(word32 input, word32 *output) +{ +#ifdef _MSC_VER + __try + { + __asm + { + mov eax, input + cpuid + mov edi, output + mov [edi], eax + mov [edi+4], ebx + mov [edi+8], ecx + mov [edi+12], edx + } + } + __except (1) + { + return false; + } + return true; +#else + SigHandler oldHandler = signal(SIGILL, SigIllHandlerCPUID); + if (oldHandler == SIG_ERR) + return false; + + bool result = true; + if (setjmp(s_jmpNoCPUID)) + result = false; + else + { + __asm__ + ( + // save ebx in case -fPIC is being used +#if CRYPTOPP_BOOL_X86 + "push %%ebx; cpuid; mov %%ebx, %%edi; pop %%ebx" +#else + "pushq %%rbx; cpuid; mov %%ebx, %%edi; popq %%rbx" +#endif + : "=a" (output[0]), "=D" (output[1]), "=c" (output[2]), "=d" (output[3]) + : "a" (input) + ); + } + + signal(SIGILL, oldHandler); + return result; +#endif +} + +#ifndef _MSC_VER +static jmp_buf s_jmpNoSSE2; +static void SigIllHandlerSSE2(int) +{ + longjmp(s_jmpNoSSE2, 1); +} +#endif + +#elif _MSC_VER >= 1400 && CRYPTOPP_BOOL_X64 + +bool CpuId(word32 input, word32 *output) +{ + __cpuid((int *)output, input); + return true; +} + +#endif + +#ifdef CRYPTOPP_CPUID_AVAILABLE + +static bool TrySSE2() +{ +#if CRYPTOPP_BOOL_X64 + return true; +#elif defined(_MSC_VER) + __try + { +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + AS2(por xmm0, xmm0) // executing SSE2 instruction +#elif CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE + __mm128i x = _mm_setzero_si128(); + return _mm_cvtsi128_si32(x) == 0; +#endif + } + __except (1) + { + return false; + } + return true; +#elif defined(__GNUC__) + SigHandler oldHandler = signal(SIGILL, SigIllHandlerSSE2); + if (oldHandler == SIG_ERR) + return false; + + bool result = true; + if (setjmp(s_jmpNoSSE2)) + result = false; + else + { +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + __asm __volatile ("por %xmm0, %xmm0"); +#elif CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE + __mm128i x = _mm_setzero_si128(); + result = _mm_cvtsi128_si32(x) == 0; +#endif + } + + signal(SIGILL, oldHandler); + return result; +#else + return false; +#endif +} + +bool g_x86DetectionDone = false; +bool g_hasISSE = false, g_hasSSE2 = false, g_hasSSSE3 = false, g_hasMMX = false, g_isP4 = false; +word32 g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE; + +void DetectX86Features() +{ + word32 cpuid[4], cpuid1[4]; + if (!CpuId(0, cpuid)) + return; + if (!CpuId(1, cpuid1)) + return; + + g_hasMMX = (cpuid1[3] & (1 << 23)) != 0; + if ((cpuid1[3] & (1 << 26)) != 0) + g_hasSSE2 = TrySSE2(); + g_hasSSSE3 = g_hasSSE2 && (cpuid1[2] & (1<<9)); + + if ((cpuid1[3] & (1 << 25)) != 0) + g_hasISSE = true; + else + { + word32 cpuid2[4]; + CpuId(0x080000000, cpuid2); + if (cpuid2[0] >= 0x080000001) + { + CpuId(0x080000001, cpuid2); + g_hasISSE = (cpuid2[3] & (1 << 22)) != 0; + } + } + + std::swap(cpuid[2], cpuid[3]); + if (memcmp(cpuid+1, "GenuineIntel", 12) == 0) + { + g_isP4 = ((cpuid1[0] >> 8) & 0xf) == 0xf; + g_cacheLineSize = 8 * GETBYTE(cpuid1[1], 1); + } + else if (memcmp(cpuid+1, "AuthenticAMD", 12) == 0) + { + CpuId(0x80000005, cpuid); + g_cacheLineSize = GETBYTE(cpuid[2], 0); + } + + if (!g_cacheLineSize) + g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE; + + g_x86DetectionDone = true; +} + +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/cpu.h b/cryptopp/cpu.h new file mode 100644 index 0000000..7f01dad --- /dev/null +++ b/cryptopp/cpu.h @@ -0,0 +1,263 @@ +#ifndef CRYPTOPP_CPU_H +#define CRYPTOPP_CPU_H + +#ifdef CRYPTOPP_GENERATE_X64_MASM + +#define CRYPTOPP_X86_ASM_AVAILABLE +#define CRYPTOPP_BOOL_X64 1 +#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1 +#define NAMESPACE_END + +#else + +#include "config.h" + +#ifdef CRYPTOPP_MSVC6PP_OR_LATER + #include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || (_MSC_VER >= 1400 && CRYPTOPP_BOOL_X64) + +#define CRYPTOPP_CPUID_AVAILABLE + +// these should not be used directly +extern CRYPTOPP_DLL bool g_x86DetectionDone; +extern CRYPTOPP_DLL bool g_hasSSE2; +extern CRYPTOPP_DLL bool g_hasISSE; +extern CRYPTOPP_DLL bool g_hasMMX; +extern CRYPTOPP_DLL bool g_hasSSSE3; +extern CRYPTOPP_DLL bool g_isP4; +extern CRYPTOPP_DLL word32 g_cacheLineSize; +CRYPTOPP_DLL void CRYPTOPP_API DetectX86Features(); + +CRYPTOPP_DLL bool CRYPTOPP_API CpuId(word32 input, word32 *output); + +#if CRYPTOPP_BOOL_X64 +inline bool HasSSE2() {return true;} +inline bool HasISSE() {return true;} +inline bool HasMMX() {return true;} +#else + +inline bool HasSSE2() +{ + if (!g_x86DetectionDone) + DetectX86Features(); + return g_hasSSE2; +} + +inline bool HasISSE() +{ + if (!g_x86DetectionDone) + DetectX86Features(); + return g_hasISSE; +} + +inline bool HasMMX() +{ + if (!g_x86DetectionDone) + DetectX86Features(); + return g_hasMMX; +} + +#endif + +inline bool HasSSSE3() +{ + if (!g_x86DetectionDone) + DetectX86Features(); + return g_hasSSSE3; +} + +inline bool IsP4() +{ + if (!g_x86DetectionDone) + DetectX86Features(); + return g_isP4; +} + +inline int GetCacheLineSize() +{ + if (!g_x86DetectionDone) + DetectX86Features(); + return g_cacheLineSize; +} + +#else + +inline int GetCacheLineSize() +{ + return CRYPTOPP_L1_CACHE_LINE_SIZE; +} + +inline bool HasSSSE3() {return false;} +inline bool IsP4() {return false;} + +// assume MMX and SSE2 if intrinsics are enabled +#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_X64 +inline bool HasSSE2() {return true;} +inline bool HasISSE() {return true;} +inline bool HasMMX() {return true;} +#else +inline bool HasSSE2() {return false;} +inline bool HasISSE() {return false;} +inline bool HasMMX() {return false;} +#endif + +#endif // #ifdef CRYPTOPP_X86_ASM_AVAILABLE || _MSC_VER >= 1400 + +#endif + +#ifdef CRYPTOPP_GENERATE_X64_MASM + #define AS1(x) x*newline* + #define AS2(x, y) x, y*newline* + #define AS3(x, y, z) x, y, z*newline* + #define ASS(x, y, a, b, c, d) x, y, a*64+b*16+c*4+d*newline* + #define ASL(x) label##x:*newline* + #define ASJ(x, y, z) x label##y*newline* + #define ASC(x, y) x label##y*newline* + #define AS_HEX(y) 0##y##h +#elif defined(__GNUC__) + // define these in two steps to allow arguments to be expanded + #define GNU_AS1(x) #x ";" + #define GNU_AS2(x, y) #x ", " #y ";" + #define GNU_AS3(x, y, z) #x ", " #y ", " #z ";" + #define GNU_ASL(x) "\n" #x ":" + #define GNU_ASJ(x, y, z) #x " " #y #z ";" + #define AS1(x) GNU_AS1(x) + #define AS2(x, y) GNU_AS2(x, y) + #define AS3(x, y, z) GNU_AS3(x, y, z) + #define ASS(x, y, a, b, c, d) #x ", " #y ", " #a "*64+" #b "*16+" #c "*4+" #d ";" + #define ASL(x) GNU_ASL(x) + #define ASJ(x, y, z) GNU_ASJ(x, y, z) + #define ASC(x, y) #x " " #y ";" + #define CRYPTOPP_NAKED + #define AS_HEX(y) 0x##y +#else + #define AS1(x) __asm {x} + #define AS2(x, y) __asm {x, y} + #define AS3(x, y, z) __asm {x, y, z} + #define ASS(x, y, a, b, c, d) __asm {x, y, _MM_SHUFFLE(a, b, c, d)} + #define ASL(x) __asm {label##x:} + #define ASJ(x, y, z) __asm {x label##y} + #define ASC(x, y) __asm {x label##y} + #define CRYPTOPP_NAKED __declspec(naked) + #define AS_HEX(y) 0x##y +#endif + +#define IF0(y) +#define IF1(y) y + +#ifdef CRYPTOPP_GENERATE_X64_MASM +#define ASM_MOD(x, y) ((x) MOD (y)) +#define XMMWORD_PTR XMMWORD PTR +#else +// GNU assembler doesn't seem to have mod operator +#define ASM_MOD(x, y) ((x)-((x)/(y))*(y)) +// GAS 2.15 doesn't support XMMWORD PTR. it seems necessary only for MASM +#define XMMWORD_PTR +#endif + +#if CRYPTOPP_BOOL_X86 + #define AS_REG_1 ecx + #define AS_REG_2 edx + #define AS_REG_3 esi + #define AS_REG_4 edi + #define AS_REG_5 eax + #define AS_REG_6 ebx + #define AS_REG_7 ebp + #define AS_REG_1d ecx + #define AS_REG_2d edx + #define AS_REG_3d esi + #define AS_REG_4d edi + #define AS_REG_5d eax + #define AS_REG_6d ebx + #define AS_REG_7d ebp + #define WORD_SZ 4 + #define WORD_REG(x) e##x + #define WORD_PTR DWORD PTR + #define AS_PUSH_IF86(x) AS1(push e##x) + #define AS_POP_IF86(x) AS1(pop e##x) + #define AS_JCXZ jecxz +#elif CRYPTOPP_BOOL_X64 + #ifdef CRYPTOPP_GENERATE_X64_MASM + #define AS_REG_1 rcx + #define AS_REG_2 rdx + #define AS_REG_3 r8 + #define AS_REG_4 r9 + #define AS_REG_5 rax + #define AS_REG_6 r10 + #define AS_REG_7 r11 + #define AS_REG_1d ecx + #define AS_REG_2d edx + #define AS_REG_3d r8d + #define AS_REG_4d r9d + #define AS_REG_5d eax + #define AS_REG_6d r10d + #define AS_REG_7d r11d + #else + #define AS_REG_1 rdi + #define AS_REG_2 rsi + #define AS_REG_3 rdx + #define AS_REG_4 rcx + #define AS_REG_5 r8 + #define AS_REG_6 r9 + #define AS_REG_7 r10 + #define AS_REG_1d edi + #define AS_REG_2d esi + #define AS_REG_3d edx + #define AS_REG_4d ecx + #define AS_REG_5d r8d + #define AS_REG_6d r9d + #define AS_REG_7d r10d + #endif + #define WORD_SZ 8 + #define WORD_REG(x) r##x + #define WORD_PTR QWORD PTR + #define AS_PUSH_IF86(x) + #define AS_POP_IF86(x) + #define AS_JCXZ jrcxz +#endif + +// helper macro for stream cipher output +#define AS_XMM_OUTPUT4(labelPrefix, inputPtr, outputPtr, x0, x1, x2, x3, t, p0, p1, p2, p3, increment)\ + AS2( test inputPtr, inputPtr)\ + ASC( jz, labelPrefix##3)\ + AS2( test inputPtr, 15)\ + ASC( jnz, labelPrefix##7)\ + AS2( pxor xmm##x0, [inputPtr+p0*16])\ + AS2( pxor xmm##x1, [inputPtr+p1*16])\ + AS2( pxor xmm##x2, [inputPtr+p2*16])\ + AS2( pxor xmm##x3, [inputPtr+p3*16])\ + AS2( add inputPtr, increment*16)\ + ASC( jmp, labelPrefix##3)\ + ASL(labelPrefix##7)\ + AS2( movdqu xmm##t, [inputPtr+p0*16])\ + AS2( pxor xmm##x0, xmm##t)\ + AS2( movdqu xmm##t, [inputPtr+p1*16])\ + AS2( pxor xmm##x1, xmm##t)\ + AS2( movdqu xmm##t, [inputPtr+p2*16])\ + AS2( pxor xmm##x2, xmm##t)\ + AS2( movdqu xmm##t, [inputPtr+p3*16])\ + AS2( pxor xmm##x3, xmm##t)\ + AS2( add inputPtr, increment*16)\ + ASL(labelPrefix##3)\ + AS2( test outputPtr, 15)\ + ASC( jnz, labelPrefix##8)\ + AS2( movdqa [outputPtr+p0*16], xmm##x0)\ + AS2( movdqa [outputPtr+p1*16], xmm##x1)\ + AS2( movdqa [outputPtr+p2*16], xmm##x2)\ + AS2( movdqa [outputPtr+p3*16], xmm##x3)\ + ASC( jmp, labelPrefix##9)\ + ASL(labelPrefix##8)\ + AS2( movdqu [outputPtr+p0*16], xmm##x0)\ + AS2( movdqu [outputPtr+p1*16], xmm##x1)\ + AS2( movdqu [outputPtr+p2*16], xmm##x2)\ + AS2( movdqu [outputPtr+p3*16], xmm##x3)\ + ASL(labelPrefix##9)\ + AS2( add outputPtr, increment*16) + +NAMESPACE_END + +#endif diff --git a/cryptopp/crc.cpp b/cryptopp/crc.cpp new file mode 100644 index 0000000..10c25c2 --- /dev/null +++ b/cryptopp/crc.cpp @@ -0,0 +1,160 @@ +// crc.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "crc.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +/* Table of CRC-32's of all single byte values (made by makecrc.c) */ +const word32 CRC32::m_tab[] = { +#ifdef IS_LITTLE_ENDIAN + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL +#else + 0x00000000L, 0x96300777L, 0x2c610eeeL, 0xba510999L, 0x19c46d07L, + 0x8ff46a70L, 0x35a563e9L, 0xa395649eL, 0x3288db0eL, 0xa4b8dc79L, + 0x1ee9d5e0L, 0x88d9d297L, 0x2b4cb609L, 0xbd7cb17eL, 0x072db8e7L, + 0x911dbf90L, 0x6410b71dL, 0xf220b06aL, 0x4871b9f3L, 0xde41be84L, + 0x7dd4da1aL, 0xebe4dd6dL, 0x51b5d4f4L, 0xc785d383L, 0x56986c13L, + 0xc0a86b64L, 0x7af962fdL, 0xecc9658aL, 0x4f5c0114L, 0xd96c0663L, + 0x633d0ffaL, 0xf50d088dL, 0xc8206e3bL, 0x5e10694cL, 0xe44160d5L, + 0x727167a2L, 0xd1e4033cL, 0x47d4044bL, 0xfd850dd2L, 0x6bb50aa5L, + 0xfaa8b535L, 0x6c98b242L, 0xd6c9bbdbL, 0x40f9bcacL, 0xe36cd832L, + 0x755cdf45L, 0xcf0dd6dcL, 0x593dd1abL, 0xac30d926L, 0x3a00de51L, + 0x8051d7c8L, 0x1661d0bfL, 0xb5f4b421L, 0x23c4b356L, 0x9995bacfL, + 0x0fa5bdb8L, 0x9eb80228L, 0x0888055fL, 0xb2d90cc6L, 0x24e90bb1L, + 0x877c6f2fL, 0x114c6858L, 0xab1d61c1L, 0x3d2d66b6L, 0x9041dc76L, + 0x0671db01L, 0xbc20d298L, 0x2a10d5efL, 0x8985b171L, 0x1fb5b606L, + 0xa5e4bf9fL, 0x33d4b8e8L, 0xa2c90778L, 0x34f9000fL, 0x8ea80996L, + 0x18980ee1L, 0xbb0d6a7fL, 0x2d3d6d08L, 0x976c6491L, 0x015c63e6L, + 0xf4516b6bL, 0x62616c1cL, 0xd8306585L, 0x4e0062f2L, 0xed95066cL, + 0x7ba5011bL, 0xc1f40882L, 0x57c40ff5L, 0xc6d9b065L, 0x50e9b712L, + 0xeab8be8bL, 0x7c88b9fcL, 0xdf1ddd62L, 0x492dda15L, 0xf37cd38cL, + 0x654cd4fbL, 0x5861b24dL, 0xce51b53aL, 0x7400bca3L, 0xe230bbd4L, + 0x41a5df4aL, 0xd795d83dL, 0x6dc4d1a4L, 0xfbf4d6d3L, 0x6ae96943L, + 0xfcd96e34L, 0x468867adL, 0xd0b860daL, 0x732d0444L, 0xe51d0333L, + 0x5f4c0aaaL, 0xc97c0dddL, 0x3c710550L, 0xaa410227L, 0x10100bbeL, + 0x86200cc9L, 0x25b56857L, 0xb3856f20L, 0x09d466b9L, 0x9fe461ceL, + 0x0ef9de5eL, 0x98c9d929L, 0x2298d0b0L, 0xb4a8d7c7L, 0x173db359L, + 0x810db42eL, 0x3b5cbdb7L, 0xad6cbac0L, 0x2083b8edL, 0xb6b3bf9aL, + 0x0ce2b603L, 0x9ad2b174L, 0x3947d5eaL, 0xaf77d29dL, 0x1526db04L, + 0x8316dc73L, 0x120b63e3L, 0x843b6494L, 0x3e6a6d0dL, 0xa85a6a7aL, + 0x0bcf0ee4L, 0x9dff0993L, 0x27ae000aL, 0xb19e077dL, 0x44930ff0L, + 0xd2a30887L, 0x68f2011eL, 0xfec20669L, 0x5d5762f7L, 0xcb676580L, + 0x71366c19L, 0xe7066b6eL, 0x761bd4feL, 0xe02bd389L, 0x5a7ada10L, + 0xcc4add67L, 0x6fdfb9f9L, 0xf9efbe8eL, 0x43beb717L, 0xd58eb060L, + 0xe8a3d6d6L, 0x7e93d1a1L, 0xc4c2d838L, 0x52f2df4fL, 0xf167bbd1L, + 0x6757bca6L, 0xdd06b53fL, 0x4b36b248L, 0xda2b0dd8L, 0x4c1b0aafL, + 0xf64a0336L, 0x607a0441L, 0xc3ef60dfL, 0x55df67a8L, 0xef8e6e31L, + 0x79be6946L, 0x8cb361cbL, 0x1a8366bcL, 0xa0d26f25L, 0x36e26852L, + 0x95770cccL, 0x03470bbbL, 0xb9160222L, 0x2f260555L, 0xbe3bbac5L, + 0x280bbdb2L, 0x925ab42bL, 0x046ab35cL, 0xa7ffd7c2L, 0x31cfd0b5L, + 0x8b9ed92cL, 0x1daede5bL, 0xb0c2649bL, 0x26f263ecL, 0x9ca36a75L, + 0x0a936d02L, 0xa906099cL, 0x3f360eebL, 0x85670772L, 0x13570005L, + 0x824abf95L, 0x147ab8e2L, 0xae2bb17bL, 0x381bb60cL, 0x9b8ed292L, + 0x0dbed5e5L, 0xb7efdc7cL, 0x21dfdb0bL, 0xd4d2d386L, 0x42e2d4f1L, + 0xf8b3dd68L, 0x6e83da1fL, 0xcd16be81L, 0x5b26b9f6L, 0xe177b06fL, + 0x7747b718L, 0xe65a0888L, 0x706a0fffL, 0xca3b0666L, 0x5c0b0111L, + 0xff9e658fL, 0x69ae62f8L, 0xd3ff6b61L, 0x45cf6c16L, 0x78e20aa0L, + 0xeed20dd7L, 0x5483044eL, 0xc2b30339L, 0x612667a7L, 0xf71660d0L, + 0x4d476949L, 0xdb776e3eL, 0x4a6ad1aeL, 0xdc5ad6d9L, 0x660bdf40L, + 0xf03bd837L, 0x53aebca9L, 0xc59ebbdeL, 0x7fcfb247L, 0xe9ffb530L, + 0x1cf2bdbdL, 0x8ac2bacaL, 0x3093b353L, 0xa6a3b424L, 0x0536d0baL, + 0x9306d7cdL, 0x2957de54L, 0xbf67d923L, 0x2e7a66b3L, 0xb84a61c4L, + 0x021b685dL, 0x942b6f2aL, 0x37be0bb4L, 0xa18e0cc3L, 0x1bdf055aL, + 0x8def022dL +#endif +}; + +CRC32::CRC32() +{ + Reset(); +} + +void CRC32::Update(const byte *s, size_t n) +{ + word32 crc = m_crc; + + for(; !IsAligned(s) && n > 0; n--) + crc = m_tab[CRC32_INDEX(crc) ^ *s++] ^ CRC32_SHIFTED(crc); + + while (n >= 4) + { + crc ^= *(const word32 *)s; + crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); + crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); + crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); + crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); + n -= 4; + s += 4; + } + + while (n--) + crc = m_tab[CRC32_INDEX(crc) ^ *s++] ^ CRC32_SHIFTED(crc); + + m_crc = crc; +} + +void CRC32::TruncatedFinal(byte *hash, size_t size) +{ + ThrowIfInvalidTruncatedSize(size); + + m_crc ^= CRC32_NEGL; + for (size_t i=0; i> 8) +#else +#define CRC32_INDEX(c) (c >> 24) +#define CRC32_SHIFTED(c) (c << 8) +#endif + +//! CRC Checksum Calculation +class CRC32 : public HashTransformation +{ +public: + CRYPTOPP_CONSTANT(DIGESTSIZE = 4) + CRC32(); + void Update(const byte *input, size_t length); + void TruncatedFinal(byte *hash, size_t size); + unsigned int DigestSize() const {return DIGESTSIZE;} + static const char * StaticAlgorithmName() {return "CRC32";} + std::string AlgorithmName() const {return StaticAlgorithmName();} + + void UpdateByte(byte b) {m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc);} + byte GetCrcByte(size_t i) const {return ((byte *)&(m_crc))[i];} + +private: + void Reset() {m_crc = CRC32_NEGL;} + + static const word32 m_tab[256]; + word32 m_crc; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/cryptdll.vcproj b/cryptopp/cryptdll.vcproj new file mode 100644 index 0000000..f0d2b28 --- /dev/null +++ b/cryptopp/cryptdll.vcproj @@ -0,0 +1,2694 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cryptopp/cryptest.dsw b/cryptopp/cryptest.dsw new file mode 100644 index 0000000..f8cf4f1 --- /dev/null +++ b/cryptopp/cryptest.dsw @@ -0,0 +1,74 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "cryptdll"=.\cryptdll.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name cryptest + End Project Dependency +}}} + +############################################################################### + +Project: "cryptest"=.\cryptest.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name cryptlib + End Project Dependency +}}} + +############################################################################### + +Project: "cryptlib"=.\cryptlib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "dlltest"=.\dlltest.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name cryptdll + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/cryptopp/cryptest.sln b/cryptopp/cryptest.sln new file mode 100644 index 0000000..bf64aaf --- /dev/null +++ b/cryptopp/cryptest.sln @@ -0,0 +1,100 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cryptdll", "cryptdll.vcproj", "{EBD86293-69A9-456B-B814-916E12AA9BBF}" + ProjectSection(ProjectDependencies) = postProject + {9EAFA456-89B4-4879-AD4F-C2C341184CF5} = {9EAFA456-89B4-4879-AD4F-C2C341184CF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cryptest", "cryptest.vcproj", "{9EAFA456-89B4-4879-AD4F-C2C341184CF5}" + ProjectSection(ProjectDependencies) = postProject + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cryptlib", "cryptlib.vcproj", "{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dlltest", "dlltest.vcproj", "{A7483CE8-2784-46CE-8CB8-8C0C1D27E232}" + ProjectSection(ProjectDependencies) = postProject + {EBD86293-69A9-456B-B814-916E12AA9BBF} = {EBD86293-69A9-456B-B814-916E12AA9BBF} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + DLL-Import Debug|Win32 = DLL-Import Debug|Win32 + DLL-Import Debug|x64 = DLL-Import Debug|x64 + DLL-Import Release|Win32 = DLL-Import Release|Win32 + DLL-Import Release|x64 = DLL-Import Release|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EBD86293-69A9-456B-B814-916E12AA9BBF}.Debug|Win32.ActiveCfg = Debug|Win32 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.Debug|Win32.Build.0 = Debug|Win32 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.Debug|x64.ActiveCfg = Debug|x64 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.Debug|x64.Build.0 = Debug|x64 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.DLL-Import Debug|Win32.Build.0 = Debug|Win32 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.DLL-Import Debug|x64.ActiveCfg = Debug|x64 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.DLL-Import Debug|x64.Build.0 = Debug|x64 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.DLL-Import Release|Win32.ActiveCfg = Release|Win32 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.DLL-Import Release|Win32.Build.0 = Release|Win32 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.DLL-Import Release|x64.ActiveCfg = Release|x64 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.DLL-Import Release|x64.Build.0 = Release|x64 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.Release|Win32.ActiveCfg = Release|Win32 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.Release|Win32.Build.0 = Release|Win32 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.Release|x64.ActiveCfg = Release|x64 + {EBD86293-69A9-456B-B814-916E12AA9BBF}.Release|x64.Build.0 = Release|x64 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.Debug|Win32.ActiveCfg = Debug|Win32 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.Debug|Win32.Build.0 = Debug|Win32 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.Debug|x64.ActiveCfg = Debug|x64 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.Debug|x64.Build.0 = Debug|x64 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.DLL-Import Debug|Win32.ActiveCfg = DLL-Import Debug|Win32 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.DLL-Import Debug|Win32.Build.0 = DLL-Import Debug|Win32 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.DLL-Import Debug|x64.ActiveCfg = DLL-Import Debug|x64 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.DLL-Import Debug|x64.Build.0 = DLL-Import Debug|x64 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.DLL-Import Release|Win32.ActiveCfg = DLL-Import Release|Win32 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.DLL-Import Release|Win32.Build.0 = DLL-Import Release|Win32 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.DLL-Import Release|x64.ActiveCfg = DLL-Import Release|x64 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.DLL-Import Release|x64.Build.0 = DLL-Import Release|x64 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.Release|Win32.ActiveCfg = Release|Win32 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.Release|Win32.Build.0 = Release|Win32 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.Release|x64.ActiveCfg = Release|x64 + {9EAFA456-89B4-4879-AD4F-C2C341184CF5}.Release|x64.Build.0 = Release|x64 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.ActiveCfg = Debug|Win32 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.Build.0 = Debug|Win32 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|x64.ActiveCfg = Debug|x64 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|x64.Build.0 = Debug|x64 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Debug|Win32.ActiveCfg = DLL-Import Debug|Win32 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Debug|Win32.Build.0 = DLL-Import Debug|Win32 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Debug|x64.ActiveCfg = DLL-Import Debug|x64 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Debug|x64.Build.0 = DLL-Import Debug|x64 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Release|Win32.ActiveCfg = DLL-Import Release|Win32 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Release|Win32.Build.0 = DLL-Import Release|Win32 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Release|x64.ActiveCfg = DLL-Import Release|x64 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.DLL-Import Release|x64.Build.0 = DLL-Import Release|x64 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|Win32.ActiveCfg = Release|Win32 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|Win32.Build.0 = Release|Win32 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|x64.ActiveCfg = Release|x64 + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|x64.Build.0 = Release|x64 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.Debug|Win32.ActiveCfg = Debug|Win32 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.Debug|Win32.Build.0 = Debug|Win32 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.Debug|x64.ActiveCfg = Debug|x64 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.Debug|x64.Build.0 = Debug|x64 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.DLL-Import Debug|Win32.ActiveCfg = Debug|Win32 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.DLL-Import Debug|Win32.Build.0 = Debug|Win32 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.DLL-Import Debug|x64.ActiveCfg = Debug|x64 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.DLL-Import Debug|x64.Build.0 = Debug|x64 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.DLL-Import Release|Win32.ActiveCfg = Release|Win32 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.DLL-Import Release|Win32.Build.0 = Release|Win32 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.DLL-Import Release|x64.ActiveCfg = Release|x64 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.DLL-Import Release|x64.Build.0 = Release|x64 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.Release|Win32.ActiveCfg = Release|Win32 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.Release|Win32.Build.0 = Release|Win32 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.Release|x64.ActiveCfg = Release|x64 + {A7483CE8-2784-46CE-8CB8-8C0C1D27E232}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/cryptopp/cryptest.vcproj b/cryptopp/cryptest.vcproj new file mode 100644 index 0000000..c01d972 --- /dev/null +++ b/cryptopp/cryptest.vcproj @@ -0,0 +1,1850 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cryptopp/cryptest_bds.bdsgroup b/cryptopp/cryptest_bds.bdsgroup new file mode 100644 index 0000000..32d85c6 --- /dev/null +++ b/cryptopp/cryptest_bds.bdsgroup @@ -0,0 +1,22 @@ + + + + + + + + + + + cryptest_bds.bdsproj + cryptlib_bds.bdsproj + cryptest_bds.exe cryptlib_bds.lib + + + + + + + + diff --git a/cryptopp/cryptest_bds.bdsproj b/cryptopp/cryptest_bds.bdsproj new file mode 100644 index 0000000..39751de --- /dev/null +++ b/cryptopp/cryptest_bds.bdsproj @@ -0,0 +1,267 @@ + + + + + + + + + + + + cryptest_bds.bpf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + + v + + True + . + D:\cvs\c5\Debug_Build\cryptest_bds.exe + + + + + False + + False + + True + False + + + Delphi 1.0 Compatibility Components + Borland C++Builder Internet Explorer 5 Components Package + + + + + + + + + + + diff --git a/cryptopp/cryptest_bds.bpf b/cryptopp/cryptest_bds.bpf new file mode 100644 index 0000000..fa1ed3b --- /dev/null +++ b/cryptopp/cryptest_bds.bpf @@ -0,0 +1,5 @@ +This file is used by the project manager only and should be treated like the project file + +To add a file to this project use the Project menu 'Add to Project' + +main \ No newline at end of file diff --git a/cryptopp/cryptlib.cpp b/cryptopp/cryptlib.cpp new file mode 100644 index 0000000..0e5bd24 --- /dev/null +++ b/cryptopp/cryptlib.cpp @@ -0,0 +1,821 @@ +// cryptlib.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "cryptlib.h" +#include "misc.h" +#include "filters.h" +#include "algparam.h" +#include "fips140.h" +#include "argnames.h" +#include "fltrimpl.h" +#include "trdlocal.h" +#include "osrng.h" + +#include + +NAMESPACE_BEGIN(CryptoPP) + +CRYPTOPP_COMPILE_ASSERT(sizeof(byte) == 1); +CRYPTOPP_COMPILE_ASSERT(sizeof(word16) == 2); +CRYPTOPP_COMPILE_ASSERT(sizeof(word32) == 4); +CRYPTOPP_COMPILE_ASSERT(sizeof(word64) == 8); +#ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE +CRYPTOPP_COMPILE_ASSERT(sizeof(dword) == 2*sizeof(word)); +#endif + +const std::string DEFAULT_CHANNEL; +const std::string AAD_CHANNEL = "AAD"; +const std::string &BufferedTransformation::NULL_CHANNEL = DEFAULT_CHANNEL; + +const NullNameValuePairs g_nullNameValuePairs; + +BufferedTransformation & TheBitBucket() +{ + static BitBucket bitBucket; + return bitBucket; +} + +Algorithm::Algorithm(bool checkSelfTestStatus) +{ + if (checkSelfTestStatus && FIPS_140_2_ComplianceEnabled()) + { + if (GetPowerUpSelfTestStatus() == POWER_UP_SELF_TEST_NOT_DONE && !PowerUpSelfTestInProgressOnThisThread()) + throw SelfTestFailure("Cryptographic algorithms are disabled before the power-up self tests are performed."); + + if (GetPowerUpSelfTestStatus() == POWER_UP_SELF_TEST_FAILED) + throw SelfTestFailure("Cryptographic algorithms are disabled after a power-up self test failed."); + } +} + +void SimpleKeyingInterface::SetKey(const byte *key, size_t length, const NameValuePairs ¶ms) +{ + this->ThrowIfInvalidKeyLength(length); + this->UncheckedSetKey(key, (unsigned int)length, params); +} + +void SimpleKeyingInterface::SetKeyWithRounds(const byte *key, size_t length, int rounds) +{ + SetKey(key, length, MakeParameters(Name::Rounds(), rounds)); +} + +void SimpleKeyingInterface::SetKeyWithIV(const byte *key, size_t length, const byte *iv, size_t ivLength) +{ + SetKey(key, length, MakeParameters(Name::IV(), ConstByteArrayParameter(iv, ivLength))); +} + +void SimpleKeyingInterface::ThrowIfInvalidKeyLength(size_t length) +{ + if (!IsValidKeyLength(length)) + throw InvalidKeyLength(GetAlgorithm().AlgorithmName(), length); +} + +void SimpleKeyingInterface::ThrowIfResynchronizable() +{ + if (IsResynchronizable()) + throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": this object requires an IV"); +} + +void SimpleKeyingInterface::ThrowIfInvalidIV(const byte *iv) +{ + if (!iv && !(IVRequirement() == INTERNALLY_GENERATED_IV || IVRequirement() == UNIQUE_IV || !IsResynchronizable())) + throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": this object cannot use a null IV"); +} + +size_t SimpleKeyingInterface::ThrowIfInvalidIVLength(int size) +{ + if (size < 0) + return IVSize(); + else if ((size_t)size < MinIVLength()) + throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": IV length " + IntToString(size) + " is less than the minimum of " + IntToString(MinIVLength())); + else if ((size_t)size > MaxIVLength()) + throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": IV length " + IntToString(size) + " exceeds the maximum of " + IntToString(MaxIVLength())); + else + return size; +} + +const byte * SimpleKeyingInterface::GetIVAndThrowIfInvalid(const NameValuePairs ¶ms, size_t &size) +{ + ConstByteArrayParameter ivWithLength; + const byte *iv; + bool found = false; + + try {found = params.GetValue(Name::IV(), ivWithLength);} + catch (const NameValuePairs::ValueTypeMismatch &) {} + + if (found) + { + iv = ivWithLength.begin(); + ThrowIfInvalidIV(iv); + size = ThrowIfInvalidIVLength((int)ivWithLength.size()); + return iv; + } + else if (params.GetValue(Name::IV(), iv)) + { + ThrowIfInvalidIV(iv); + size = IVSize(); + return iv; + } + else + { + ThrowIfResynchronizable(); + size = 0; + return NULL; + } +} + +void SimpleKeyingInterface::GetNextIV(RandomNumberGenerator &rng, byte *IV) +{ + rng.GenerateBlock(IV, IVSize()); +} + +size_t BlockTransformation::AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const +{ + size_t blockSize = BlockSize(); + size_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : blockSize; + size_t xorIncrement = xorBlocks ? blockSize : 0; + size_t outIncrement = (flags & BT_DontIncrementInOutPointers) ? 0 : blockSize; + + if (flags & BT_ReverseDirection) + { + assert(length % blockSize == 0); + inBlocks += length - blockSize; + xorBlocks += length - blockSize; + outBlocks += length - blockSize; + inIncrement = 0-inIncrement; + xorIncrement = 0-xorIncrement; + outIncrement = 0-outIncrement; + } + + while (length >= blockSize) + { + if (flags & BT_XorInput) + { + xorbuf(outBlocks, xorBlocks, inBlocks, blockSize); + ProcessBlock(outBlocks); + } + else + ProcessAndXorBlock(inBlocks, xorBlocks, outBlocks); + if (flags & BT_InBlockIsCounter) + const_cast(inBlocks)[blockSize-1]++; + inBlocks += inIncrement; + outBlocks += outIncrement; + xorBlocks += xorIncrement; + length -= blockSize; + } + + return length; +} + +unsigned int BlockTransformation::OptimalDataAlignment() const +{ + return GetAlignmentOf(); +} + +unsigned int StreamTransformation::OptimalDataAlignment() const +{ + return GetAlignmentOf(); +} + +unsigned int HashTransformation::OptimalDataAlignment() const +{ + return GetAlignmentOf(); +} + +void StreamTransformation::ProcessLastBlock(byte *outString, const byte *inString, size_t length) +{ + assert(MinLastBlockSize() == 0); // this function should be overriden otherwise + + if (length == MandatoryBlockSize()) + ProcessData(outString, inString, length); + else if (length != 0) + throw NotImplemented(AlgorithmName() + ": this object does't support a special last block"); +} + +void AuthenticatedSymmetricCipher::SpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength) +{ + if (headerLength > MaxHeaderLength()) + throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": header length " + IntToString(headerLength) + " exceeds the maximum of " + IntToString(MaxHeaderLength())); + + if (messageLength > MaxMessageLength()) + throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": message length " + IntToString(messageLength) + " exceeds the maximum of " + IntToString(MaxMessageLength())); + + if (footerLength > MaxFooterLength()) + throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": footer length " + IntToString(footerLength) + " exceeds the maximum of " + IntToString(MaxFooterLength())); + + UncheckedSpecifyDataLengths(headerLength, messageLength, footerLength); +} + +void AuthenticatedSymmetricCipher::EncryptAndAuthenticate(byte *ciphertext, byte *mac, size_t macSize, const byte *iv, int ivLength, const byte *header, size_t headerLength, const byte *message, size_t messageLength) +{ + Resynchronize(iv, ivLength); + SpecifyDataLengths(headerLength, messageLength); + Update(header, headerLength); + ProcessString(ciphertext, message, messageLength); + TruncatedFinal(mac, macSize); +} + +bool AuthenticatedSymmetricCipher::DecryptAndVerify(byte *message, const byte *mac, size_t macLength, const byte *iv, int ivLength, const byte *header, size_t headerLength, const byte *ciphertext, size_t ciphertextLength) +{ + Resynchronize(iv, ivLength); + SpecifyDataLengths(headerLength, ciphertextLength); + Update(header, headerLength); + ProcessString(message, ciphertext, ciphertextLength); + return TruncatedVerify(mac, macLength); +} + +unsigned int RandomNumberGenerator::GenerateBit() +{ + return GenerateByte() & 1; +} + +byte RandomNumberGenerator::GenerateByte() +{ + byte b; + GenerateBlock(&b, 1); + return b; +} + +word32 RandomNumberGenerator::GenerateWord32(word32 min, word32 max) +{ + word32 range = max-min; + const int maxBits = BitPrecision(range); + + word32 value; + + do + { + GenerateBlock((byte *)&value, sizeof(value)); + value = Crop(value, maxBits); + } while (value > range); + + return value+min; +} + +void RandomNumberGenerator::GenerateBlock(byte *output, size_t size) +{ + ArraySink s(output, size); + GenerateIntoBufferedTransformation(s, DEFAULT_CHANNEL, size); +} + +void RandomNumberGenerator::DiscardBytes(size_t n) +{ + GenerateIntoBufferedTransformation(TheBitBucket(), DEFAULT_CHANNEL, n); +} + +void RandomNumberGenerator::GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword length) +{ + FixedSizeSecBlock buffer; + while (length) + { + size_t len = UnsignedMin(buffer.size(), length); + GenerateBlock(buffer, len); + target.ChannelPut(channel, buffer, len); + length -= len; + } +} + +//! see NullRNG() +class ClassNullRNG : public RandomNumberGenerator +{ +public: + std::string AlgorithmName() const {return "NullRNG";} + void GenerateBlock(byte *output, size_t size) {throw NotImplemented("NullRNG: NullRNG should only be passed to functions that don't need to generate random bytes");} +}; + +RandomNumberGenerator & NullRNG() +{ + static ClassNullRNG s_nullRNG; + return s_nullRNG; +} + +bool HashTransformation::TruncatedVerify(const byte *digestIn, size_t digestLength) +{ + ThrowIfInvalidTruncatedSize(digestLength); + SecByteBlock digest(digestLength); + TruncatedFinal(digest, digestLength); + return VerifyBufsEqual(digest, digestIn, digestLength); +} + +void HashTransformation::ThrowIfInvalidTruncatedSize(size_t size) const +{ + if (size > DigestSize()) + throw InvalidArgument("HashTransformation: can't truncate a " + IntToString(DigestSize()) + " byte digest to " + IntToString(size) + " bytes"); +} + +unsigned int BufferedTransformation::GetMaxWaitObjectCount() const +{ + const BufferedTransformation *t = AttachedTransformation(); + return t ? t->GetMaxWaitObjectCount() : 0; +} + +void BufferedTransformation::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) +{ + BufferedTransformation *t = AttachedTransformation(); + if (t) + t->GetWaitObjects(container, callStack); // reduce clutter by not adding to stack here +} + +void BufferedTransformation::Initialize(const NameValuePairs ¶meters, int propagation) +{ + assert(!AttachedTransformation()); + IsolatedInitialize(parameters); +} + +bool BufferedTransformation::Flush(bool hardFlush, int propagation, bool blocking) +{ + assert(!AttachedTransformation()); + return IsolatedFlush(hardFlush, blocking); +} + +bool BufferedTransformation::MessageSeriesEnd(int propagation, bool blocking) +{ + assert(!AttachedTransformation()); + return IsolatedMessageSeriesEnd(blocking); +} + +byte * BufferedTransformation::ChannelCreatePutSpace(const std::string &channel, size_t &size) +{ + if (channel.empty()) + return CreatePutSpace(size); + else + throw NoChannelSupport(AlgorithmName()); +} + +size_t BufferedTransformation::ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking) +{ + if (channel.empty()) + return Put2(begin, length, messageEnd, blocking); + else + throw NoChannelSupport(AlgorithmName()); +} + +size_t BufferedTransformation::ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking) +{ + if (channel.empty()) + return PutModifiable2(begin, length, messageEnd, blocking); + else + return ChannelPut2(channel, begin, length, messageEnd, blocking); +} + +bool BufferedTransformation::ChannelFlush(const std::string &channel, bool completeFlush, int propagation, bool blocking) +{ + if (channel.empty()) + return Flush(completeFlush, propagation, blocking); + else + throw NoChannelSupport(AlgorithmName()); +} + +bool BufferedTransformation::ChannelMessageSeriesEnd(const std::string &channel, int propagation, bool blocking) +{ + if (channel.empty()) + return MessageSeriesEnd(propagation, blocking); + else + throw NoChannelSupport(AlgorithmName()); +} + +lword BufferedTransformation::MaxRetrievable() const +{ + if (AttachedTransformation()) + return AttachedTransformation()->MaxRetrievable(); + else + return CopyTo(TheBitBucket()); +} + +bool BufferedTransformation::AnyRetrievable() const +{ + if (AttachedTransformation()) + return AttachedTransformation()->AnyRetrievable(); + else + { + byte b; + return Peek(b) != 0; + } +} + +size_t BufferedTransformation::Get(byte &outByte) +{ + if (AttachedTransformation()) + return AttachedTransformation()->Get(outByte); + else + return Get(&outByte, 1); +} + +size_t BufferedTransformation::Get(byte *outString, size_t getMax) +{ + if (AttachedTransformation()) + return AttachedTransformation()->Get(outString, getMax); + else + { + ArraySink arraySink(outString, getMax); + return (size_t)TransferTo(arraySink, getMax); + } +} + +size_t BufferedTransformation::Peek(byte &outByte) const +{ + if (AttachedTransformation()) + return AttachedTransformation()->Peek(outByte); + else + return Peek(&outByte, 1); +} + +size_t BufferedTransformation::Peek(byte *outString, size_t peekMax) const +{ + if (AttachedTransformation()) + return AttachedTransformation()->Peek(outString, peekMax); + else + { + ArraySink arraySink(outString, peekMax); + return (size_t)CopyTo(arraySink, peekMax); + } +} + +lword BufferedTransformation::Skip(lword skipMax) +{ + if (AttachedTransformation()) + return AttachedTransformation()->Skip(skipMax); + else + return TransferTo(TheBitBucket(), skipMax); +} + +lword BufferedTransformation::TotalBytesRetrievable() const +{ + if (AttachedTransformation()) + return AttachedTransformation()->TotalBytesRetrievable(); + else + return MaxRetrievable(); +} + +unsigned int BufferedTransformation::NumberOfMessages() const +{ + if (AttachedTransformation()) + return AttachedTransformation()->NumberOfMessages(); + else + return CopyMessagesTo(TheBitBucket()); +} + +bool BufferedTransformation::AnyMessages() const +{ + if (AttachedTransformation()) + return AttachedTransformation()->AnyMessages(); + else + return NumberOfMessages() != 0; +} + +bool BufferedTransformation::GetNextMessage() +{ + if (AttachedTransformation()) + return AttachedTransformation()->GetNextMessage(); + else + { + assert(!AnyMessages()); + return false; + } +} + +unsigned int BufferedTransformation::SkipMessages(unsigned int count) +{ + if (AttachedTransformation()) + return AttachedTransformation()->SkipMessages(count); + else + return TransferMessagesTo(TheBitBucket(), count); +} + +size_t BufferedTransformation::TransferMessagesTo2(BufferedTransformation &target, unsigned int &messageCount, const std::string &channel, bool blocking) +{ + if (AttachedTransformation()) + return AttachedTransformation()->TransferMessagesTo2(target, messageCount, channel, blocking); + else + { + unsigned int maxMessages = messageCount; + for (messageCount=0; messageCount < maxMessages && AnyMessages(); messageCount++) + { + size_t blockedBytes; + lword transferredBytes; + + while (AnyRetrievable()) + { + transferredBytes = LWORD_MAX; + blockedBytes = TransferTo2(target, transferredBytes, channel, blocking); + if (blockedBytes > 0) + return blockedBytes; + } + + if (target.ChannelMessageEnd(channel, GetAutoSignalPropagation(), blocking)) + return 1; + + bool result = GetNextMessage(); + assert(result); + } + return 0; + } +} + +unsigned int BufferedTransformation::CopyMessagesTo(BufferedTransformation &target, unsigned int count, const std::string &channel) const +{ + if (AttachedTransformation()) + return AttachedTransformation()->CopyMessagesTo(target, count, channel); + else + return 0; +} + +void BufferedTransformation::SkipAll() +{ + if (AttachedTransformation()) + AttachedTransformation()->SkipAll(); + else + { + while (SkipMessages()) {} + while (Skip()) {} + } +} + +size_t BufferedTransformation::TransferAllTo2(BufferedTransformation &target, const std::string &channel, bool blocking) +{ + if (AttachedTransformation()) + return AttachedTransformation()->TransferAllTo2(target, channel, blocking); + else + { + assert(!NumberOfMessageSeries()); + + unsigned int messageCount; + do + { + messageCount = UINT_MAX; + size_t blockedBytes = TransferMessagesTo2(target, messageCount, channel, blocking); + if (blockedBytes) + return blockedBytes; + } + while (messageCount != 0); + + lword byteCount; + do + { + byteCount = ULONG_MAX; + size_t blockedBytes = TransferTo2(target, byteCount, channel, blocking); + if (blockedBytes) + return blockedBytes; + } + while (byteCount != 0); + + return 0; + } +} + +void BufferedTransformation::CopyAllTo(BufferedTransformation &target, const std::string &channel) const +{ + if (AttachedTransformation()) + AttachedTransformation()->CopyAllTo(target, channel); + else + { + assert(!NumberOfMessageSeries()); + while (CopyMessagesTo(target, UINT_MAX, channel)) {} + } +} + +void BufferedTransformation::SetRetrievalChannel(const std::string &channel) +{ + if (AttachedTransformation()) + AttachedTransformation()->SetRetrievalChannel(channel); +} + +size_t BufferedTransformation::ChannelPutWord16(const std::string &channel, word16 value, ByteOrder order, bool blocking) +{ + PutWord(false, order, m_buf, value); + return ChannelPut(channel, m_buf, 2, blocking); +} + +size_t BufferedTransformation::ChannelPutWord32(const std::string &channel, word32 value, ByteOrder order, bool blocking) +{ + PutWord(false, order, m_buf, value); + return ChannelPut(channel, m_buf, 4, blocking); +} + +size_t BufferedTransformation::PutWord16(word16 value, ByteOrder order, bool blocking) +{ + return ChannelPutWord16(DEFAULT_CHANNEL, value, order, blocking); +} + +size_t BufferedTransformation::PutWord32(word32 value, ByteOrder order, bool blocking) +{ + return ChannelPutWord32(DEFAULT_CHANNEL, value, order, blocking); +} + +size_t BufferedTransformation::PeekWord16(word16 &value, ByteOrder order) const +{ + byte buf[2] = {0, 0}; + size_t len = Peek(buf, 2); + + if (order) + value = (buf[0] << 8) | buf[1]; + else + value = (buf[1] << 8) | buf[0]; + + return len; +} + +size_t BufferedTransformation::PeekWord32(word32 &value, ByteOrder order) const +{ + byte buf[4] = {0, 0, 0, 0}; + size_t len = Peek(buf, 4); + + if (order) + value = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf [3]; + else + value = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf [0]; + + return len; +} + +size_t BufferedTransformation::GetWord16(word16 &value, ByteOrder order) +{ + return (size_t)Skip(PeekWord16(value, order)); +} + +size_t BufferedTransformation::GetWord32(word32 &value, ByteOrder order) +{ + return (size_t)Skip(PeekWord32(value, order)); +} + +void BufferedTransformation::Attach(BufferedTransformation *newOut) +{ + if (AttachedTransformation() && AttachedTransformation()->Attachable()) + AttachedTransformation()->Attach(newOut); + else + Detach(newOut); +} + +void GeneratableCryptoMaterial::GenerateRandomWithKeySize(RandomNumberGenerator &rng, unsigned int keySize) +{ + GenerateRandom(rng, MakeParameters("KeySize", (int)keySize)); +} + +class PK_DefaultEncryptionFilter : public Unflushable +{ +public: + PK_DefaultEncryptionFilter(RandomNumberGenerator &rng, const PK_Encryptor &encryptor, BufferedTransformation *attachment, const NameValuePairs ¶meters) + : m_rng(rng), m_encryptor(encryptor), m_parameters(parameters) + { + Detach(attachment); + } + + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking) + { + FILTER_BEGIN; + m_plaintextQueue.Put(inString, length); + + if (messageEnd) + { + { + size_t plaintextLength; + if (!SafeConvert(m_plaintextQueue.CurrentSize(), plaintextLength)) + throw InvalidArgument("PK_DefaultEncryptionFilter: plaintext too long"); + size_t ciphertextLength = m_encryptor.CiphertextLength(plaintextLength); + + SecByteBlock plaintext(plaintextLength); + m_plaintextQueue.Get(plaintext, plaintextLength); + m_ciphertext.resize(ciphertextLength); + m_encryptor.Encrypt(m_rng, plaintext, plaintextLength, m_ciphertext, m_parameters); + } + + FILTER_OUTPUT(1, m_ciphertext, m_ciphertext.size(), messageEnd); + } + FILTER_END_NO_MESSAGE_END; + } + + RandomNumberGenerator &m_rng; + const PK_Encryptor &m_encryptor; + const NameValuePairs &m_parameters; + ByteQueue m_plaintextQueue; + SecByteBlock m_ciphertext; +}; + +BufferedTransformation * PK_Encryptor::CreateEncryptionFilter(RandomNumberGenerator &rng, BufferedTransformation *attachment, const NameValuePairs ¶meters) const +{ + return new PK_DefaultEncryptionFilter(rng, *this, attachment, parameters); +} + +class PK_DefaultDecryptionFilter : public Unflushable +{ +public: + PK_DefaultDecryptionFilter(RandomNumberGenerator &rng, const PK_Decryptor &decryptor, BufferedTransformation *attachment, const NameValuePairs ¶meters) + : m_rng(rng), m_decryptor(decryptor), m_parameters(parameters) + { + Detach(attachment); + } + + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking) + { + FILTER_BEGIN; + m_ciphertextQueue.Put(inString, length); + + if (messageEnd) + { + { + size_t ciphertextLength; + if (!SafeConvert(m_ciphertextQueue.CurrentSize(), ciphertextLength)) + throw InvalidArgument("PK_DefaultDecryptionFilter: ciphertext too long"); + size_t maxPlaintextLength = m_decryptor.MaxPlaintextLength(ciphertextLength); + + SecByteBlock ciphertext(ciphertextLength); + m_ciphertextQueue.Get(ciphertext, ciphertextLength); + m_plaintext.resize(maxPlaintextLength); + m_result = m_decryptor.Decrypt(m_rng, ciphertext, ciphertextLength, m_plaintext, m_parameters); + if (!m_result.isValidCoding) + throw InvalidCiphertext(m_decryptor.AlgorithmName() + ": invalid ciphertext"); + } + + FILTER_OUTPUT(1, m_plaintext, m_result.messageLength, messageEnd); + } + FILTER_END_NO_MESSAGE_END; + } + + RandomNumberGenerator &m_rng; + const PK_Decryptor &m_decryptor; + const NameValuePairs &m_parameters; + ByteQueue m_ciphertextQueue; + SecByteBlock m_plaintext; + DecodingResult m_result; +}; + +BufferedTransformation * PK_Decryptor::CreateDecryptionFilter(RandomNumberGenerator &rng, BufferedTransformation *attachment, const NameValuePairs ¶meters) const +{ + return new PK_DefaultDecryptionFilter(rng, *this, attachment, parameters); +} + +size_t PK_Signer::Sign(RandomNumberGenerator &rng, PK_MessageAccumulator *messageAccumulator, byte *signature) const +{ + std::auto_ptr m(messageAccumulator); + return SignAndRestart(rng, *m, signature, false); +} + +size_t PK_Signer::SignMessage(RandomNumberGenerator &rng, const byte *message, size_t messageLen, byte *signature) const +{ + std::auto_ptr m(NewSignatureAccumulator(rng)); + m->Update(message, messageLen); + return SignAndRestart(rng, *m, signature, false); +} + +size_t PK_Signer::SignMessageWithRecovery(RandomNumberGenerator &rng, const byte *recoverableMessage, size_t recoverableMessageLength, + const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, byte *signature) const +{ + std::auto_ptr m(NewSignatureAccumulator(rng)); + InputRecoverableMessage(*m, recoverableMessage, recoverableMessageLength); + m->Update(nonrecoverableMessage, nonrecoverableMessageLength); + return SignAndRestart(rng, *m, signature, false); +} + +bool PK_Verifier::Verify(PK_MessageAccumulator *messageAccumulator) const +{ + std::auto_ptr m(messageAccumulator); + return VerifyAndRestart(*m); +} + +bool PK_Verifier::VerifyMessage(const byte *message, size_t messageLen, const byte *signature, size_t signatureLength) const +{ + std::auto_ptr m(NewVerificationAccumulator()); + InputSignature(*m, signature, signatureLength); + m->Update(message, messageLen); + return VerifyAndRestart(*m); +} + +DecodingResult PK_Verifier::Recover(byte *recoveredMessage, PK_MessageAccumulator *messageAccumulator) const +{ + std::auto_ptr m(messageAccumulator); + return RecoverAndRestart(recoveredMessage, *m); +} + +DecodingResult PK_Verifier::RecoverMessage(byte *recoveredMessage, + const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, + const byte *signature, size_t signatureLength) const +{ + std::auto_ptr m(NewVerificationAccumulator()); + InputSignature(*m, signature, signatureLength); + m->Update(nonrecoverableMessage, nonrecoverableMessageLength); + return RecoverAndRestart(recoveredMessage, *m); +} + +void SimpleKeyAgreementDomain::GenerateKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const +{ + GeneratePrivateKey(rng, privateKey); + GeneratePublicKey(rng, privateKey, publicKey); +} + +void AuthenticatedKeyAgreementDomain::GenerateStaticKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const +{ + GenerateStaticPrivateKey(rng, privateKey); + GenerateStaticPublicKey(rng, privateKey, publicKey); +} + +void AuthenticatedKeyAgreementDomain::GenerateEphemeralKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const +{ + GenerateEphemeralPrivateKey(rng, privateKey); + GenerateEphemeralPublicKey(rng, privateKey, publicKey); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/cryptlib.h b/cryptopp/cryptlib.h new file mode 100644 index 0000000..15cd6da --- /dev/null +++ b/cryptopp/cryptlib.h @@ -0,0 +1,1668 @@ +// cryptlib.h - written and placed in the public domain by Wei Dai +/*! \file + This file contains the declarations for the abstract base + classes that provide a uniform interface to this library. +*/ + +/*! \mainpage Crypto++ Library 5.6.0 API Reference +
+
Abstract Base Classes
+ cryptlib.h +
Authenticated Encryption
+ AuthenticatedSymmetricCipherDocumentation +
Symmetric Ciphers
+ SymmetricCipherDocumentation +
Hash Functions
+ SHA1, SHA224, SHA256, SHA384, SHA512, Tiger, Whirlpool, RIPEMD160, RIPEMD320, RIPEMD128, RIPEMD256, Weak1::MD2, Weak1::MD4, Weak1::MD5 +
Non-Cryptographic Checksums
+ CRC32, Adler32 +
Message Authentication Codes
+ VMAC, HMAC, CBC_MAC, CMAC, DMAC, TTMAC, GCM (GMAC) +
Random Number Generators
+ NullRNG(), LC_RNG, RandomPool, BlockingRng, NonblockingRng, AutoSeededRandomPool, AutoSeededX917RNG, DefaultAutoSeededRNG +
Password-based Cryptography
+ PasswordBasedKeyDerivationFunction +
Public Key Cryptosystems
+ DLIES, ECIES, LUCES, RSAES, RabinES, LUC_IES +
Public Key Signature Schemes
+ DSA, GDSA, ECDSA, NR, ECNR, LUCSS, RSASS, RSASS_ISO, RabinSS, RWSS, ESIGN +
Key Agreement
+ #DH, DH2, #MQV, ECDH, ECMQV, XTR_DH +
Algebraic Structures
+ Integer, PolynomialMod2, PolynomialOver, RingOfPolynomialsOver, + ModularArithmetic, MontgomeryRepresentation, GFP2_ONB, + GF2NP, GF256, GF2_32, EC2N, ECP +
Secret Sharing and Information Dispersal
+ SecretSharing, SecretRecovery, InformationDispersal, InformationRecovery +
Compression
+ Deflator, Inflator, Gzip, Gunzip, ZlibCompressor, ZlibDecompressor +
Input Source Classes
+ StringSource, ArraySource, FileSource, SocketSource, WindowsPipeSource, RandomNumberSource +
Output Sink Classes
+ StringSinkTemplate, ArraySink, FileSink, SocketSink, WindowsPipeSink, RandomNumberSink +
Filter Wrappers
+ StreamTransformationFilter, HashFilter, HashVerificationFilter, SignerFilter, SignatureVerificationFilter +
Binary to Text Encoders and Decoders
+ HexEncoder, HexDecoder, Base64Encoder, Base64Decoder, Base32Encoder, Base32Decoder +
Wrappers for OS features
+ Timer, Socket, WindowsHandle, ThreadLocalStorage, ThreadUserTimer +
FIPS 140 related
+ fips140.h +
+ +In the FIPS 140-2 validated DLL version of Crypto++, only the following implementation class are available. +
+
Block Ciphers
+ AES, DES_EDE2, DES_EDE3, SKIPJACK +
Cipher Modes (replace template parameter BC with one of the block ciphers above)
+ ECB_Mode\, CTR_Mode\, CBC_Mode\, CFB_FIPS_Mode\, OFB_Mode\ +
Hash Functions
+ SHA1, SHA224, SHA256, SHA384, SHA512 +
Public Key Signature Schemes (replace template parameter H with one of the hash functions above)
+ RSASS\, RSASS\, RSASS_ISO\, RWSS\, DSA, ECDSA\, ECDSA\ +
Message Authentication Codes (replace template parameter H with one of the hash functions above)
+ HMAC\, CBC_MAC\, CBC_MAC\ +
Random Number Generators
+ DefaultAutoSeededRNG (AutoSeededX917RNG\) +
Key Agreement
+ #DH +
Public Key Cryptosystems
+ RSAES\ \> +
+ +

This reference manual is a work in progress. Some classes are still lacking detailed descriptions. +

Click here to download a zip archive containing this manual. +

Thanks to Ryan Phillips for providing the Doxygen configuration file +and getting me started with this manual. +*/ + +#ifndef CRYPTOPP_CRYPTLIB_H +#define CRYPTOPP_CRYPTLIB_H + +#include "config.h" +#include "stdcpp.h" + +NAMESPACE_BEGIN(CryptoPP) + +// forward declarations +class Integer; +class RandomNumberGenerator; +class BufferedTransformation; + +//! used to specify a direction for a cipher to operate in (encrypt or decrypt) +enum CipherDir {ENCRYPTION, DECRYPTION}; + +//! used to represent infinite time +const unsigned long INFINITE_TIME = ULONG_MAX; + +// VC60 workaround: using enums as template parameters causes problems +template +struct EnumToType +{ + static ENUM_TYPE ToEnum() {return (ENUM_TYPE)VALUE;} +}; + +enum ByteOrder {LITTLE_ENDIAN_ORDER = 0, BIG_ENDIAN_ORDER = 1}; +typedef EnumToType LittleEndian; +typedef EnumToType BigEndian; + +//! base class for all exceptions thrown by Crypto++ +class CRYPTOPP_DLL Exception : public std::exception +{ +public: + //! error types + enum ErrorType { + //! a method is not implemented + NOT_IMPLEMENTED, + //! invalid function argument + INVALID_ARGUMENT, + //! BufferedTransformation received a Flush(true) signal but can't flush buffers + CANNOT_FLUSH, + //! data integerity check (such as CRC or MAC) failed + DATA_INTEGRITY_CHECK_FAILED, + //! received input data that doesn't conform to expected format + INVALID_DATA_FORMAT, + //! error reading from input device or writing to output device + IO_ERROR, + //! some error not belong to any of the above categories + OTHER_ERROR + }; + + explicit Exception(ErrorType errorType, const std::string &s) : m_errorType(errorType), m_what(s) {} + virtual ~Exception() throw() {} + const char *what() const throw() {return (m_what.c_str());} + const std::string &GetWhat() const {return m_what;} + void SetWhat(const std::string &s) {m_what = s;} + ErrorType GetErrorType() const {return m_errorType;} + void SetErrorType(ErrorType errorType) {m_errorType = errorType;} + +private: + ErrorType m_errorType; + std::string m_what; +}; + +//! exception thrown when an invalid argument is detected +class CRYPTOPP_DLL InvalidArgument : public Exception +{ +public: + explicit InvalidArgument(const std::string &s) : Exception(INVALID_ARGUMENT, s) {} +}; + +//! exception thrown when input data is received that doesn't conform to expected format +class CRYPTOPP_DLL InvalidDataFormat : public Exception +{ +public: + explicit InvalidDataFormat(const std::string &s) : Exception(INVALID_DATA_FORMAT, s) {} +}; + +//! exception thrown by decryption filters when trying to decrypt an invalid ciphertext +class CRYPTOPP_DLL InvalidCiphertext : public InvalidDataFormat +{ +public: + explicit InvalidCiphertext(const std::string &s) : InvalidDataFormat(s) {} +}; + +//! exception thrown by a class if a non-implemented method is called +class CRYPTOPP_DLL NotImplemented : public Exception +{ +public: + explicit NotImplemented(const std::string &s) : Exception(NOT_IMPLEMENTED, s) {} +}; + +//! exception thrown by a class when Flush(true) is called but it can't completely flush its buffers +class CRYPTOPP_DLL CannotFlush : public Exception +{ +public: + explicit CannotFlush(const std::string &s) : Exception(CANNOT_FLUSH, s) {} +}; + +//! error reported by the operating system +class CRYPTOPP_DLL OS_Error : public Exception +{ +public: + OS_Error(ErrorType errorType, const std::string &s, const std::string& operation, int errorCode) + : Exception(errorType, s), m_operation(operation), m_errorCode(errorCode) {} + ~OS_Error() throw() {} + + // the operating system API that reported the error + const std::string & GetOperation() const {return m_operation;} + // the error code return by the operating system + int GetErrorCode() const {return m_errorCode;} + +protected: + std::string m_operation; + int m_errorCode; +}; + +//! used to return decoding results +struct CRYPTOPP_DLL DecodingResult +{ + explicit DecodingResult() : isValidCoding(false), messageLength(0) {} + explicit DecodingResult(size_t len) : isValidCoding(true), messageLength(len) {} + + bool operator==(const DecodingResult &rhs) const {return isValidCoding == rhs.isValidCoding && messageLength == rhs.messageLength;} + bool operator!=(const DecodingResult &rhs) const {return !operator==(rhs);} + + bool isValidCoding; + size_t messageLength; + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY + operator size_t() const {return isValidCoding ? messageLength : 0;} +#endif +}; + +//! interface for retrieving values given their names +/*! \note This class is used to safely pass a variable number of arbitrarily typed arguments to functions + and to read values from keys and crypto parameters. + \note To obtain an object that implements NameValuePairs for the purpose of parameter + passing, use the MakeParameters() function. + \note To get a value from NameValuePairs, you need to know the name and the type of the value. + Call GetValueNames() on a NameValuePairs object to obtain a list of value names that it supports. + Then look at the Name namespace documentation to see what the type of each value is, or + alternatively, call GetIntValue() with the value name, and if the type is not int, a + ValueTypeMismatch exception will be thrown and you can get the actual type from the exception object. +*/ +class CRYPTOPP_NO_VTABLE NameValuePairs +{ +public: + virtual ~NameValuePairs() {} + + //! exception thrown when trying to retrieve a value using a different type than expected + class CRYPTOPP_DLL ValueTypeMismatch : public InvalidArgument + { + public: + ValueTypeMismatch(const std::string &name, const std::type_info &stored, const std::type_info &retrieving) + : InvalidArgument("NameValuePairs: type mismatch for '" + name + "', stored '" + stored.name() + "', trying to retrieve '" + retrieving.name() + "'") + , m_stored(stored), m_retrieving(retrieving) {} + + const std::type_info & GetStoredTypeInfo() const {return m_stored;} + const std::type_info & GetRetrievingTypeInfo() const {return m_retrieving;} + + private: + const std::type_info &m_stored; + const std::type_info &m_retrieving; + }; + + //! get a copy of this object or a subobject of it + template + bool GetThisObject(T &object) const + { + return GetValue((std::string("ThisObject:")+typeid(T).name()).c_str(), object); + } + + //! get a pointer to this object, as a pointer to T + template + bool GetThisPointer(T *&p) const + { + return GetValue((std::string("ThisPointer:")+typeid(T).name()).c_str(), p); + } + + //! get a named value, returns true if the name exists + template + bool GetValue(const char *name, T &value) const + { + return GetVoidValue(name, typeid(T), &value); + } + + //! get a named value, returns the default if the name doesn't exist + template + T GetValueWithDefault(const char *name, T defaultValue) const + { + GetValue(name, defaultValue); + return defaultValue; + } + + //! get a list of value names that can be retrieved + CRYPTOPP_DLL std::string GetValueNames() const + {std::string result; GetValue("ValueNames", result); return result;} + + //! get a named value with type int + /*! used to ensure we don't accidentally try to get an unsigned int + or some other type when we mean int (which is the most common case) */ + CRYPTOPP_DLL bool GetIntValue(const char *name, int &value) const + {return GetValue(name, value);} + + //! get a named value with type int, with default + CRYPTOPP_DLL int GetIntValueWithDefault(const char *name, int defaultValue) const + {return GetValueWithDefault(name, defaultValue);} + + //! used by derived classes to check for type mismatch + CRYPTOPP_DLL static void CRYPTOPP_API ThrowIfTypeMismatch(const char *name, const std::type_info &stored, const std::type_info &retrieving) + {if (stored != retrieving) throw ValueTypeMismatch(name, stored, retrieving);} + + template + void GetRequiredParameter(const char *className, const char *name, T &value) const + { + if (!GetValue(name, value)) + throw InvalidArgument(std::string(className) + ": missing required parameter '" + name + "'"); + } + + CRYPTOPP_DLL void GetRequiredIntParameter(const char *className, const char *name, int &value) const + { + if (!GetIntValue(name, value)) + throw InvalidArgument(std::string(className) + ": missing required parameter '" + name + "'"); + } + + //! to be implemented by derived classes, users should use one of the above functions instead + CRYPTOPP_DLL virtual bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const =0; +}; + +//! namespace containing value name definitions +/*! value names, types and semantics: + + ThisObject:ClassName (ClassName, copy of this object or a subobject) + ThisPointer:ClassName (const ClassName *, pointer to this object or a subobject) +*/ +DOCUMENTED_NAMESPACE_BEGIN(Name) +// more names defined in argnames.h +DOCUMENTED_NAMESPACE_END + +//! empty set of name-value pairs +class CRYPTOPP_DLL NullNameValuePairs : public NameValuePairs +{ +public: + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const {return false;} +}; + +//! _ +extern CRYPTOPP_DLL const NullNameValuePairs g_nullNameValuePairs; + +// ******************************************************** + +//! interface for cloning objects, this is not implemented by most classes yet +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Clonable +{ +public: + virtual ~Clonable() {} + //! this is not implemented by most classes yet + virtual Clonable* Clone() const {throw NotImplemented("Clone() is not implemented yet.");} // TODO: make this =0 +}; + +//! interface for all crypto algorithms + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Algorithm : public Clonable +{ +public: + /*! When FIPS 140-2 compliance is enabled and checkSelfTestStatus == true, + this constructor throws SelfTestFailure if the self test hasn't been run or fails. */ + Algorithm(bool checkSelfTestStatus = true); + //! returns name of this algorithm, not universally implemented yet + virtual std::string AlgorithmName() const {return "unknown";} +}; + +//! keying interface for crypto algorithms that take byte strings as keys +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE SimpleKeyingInterface +{ +public: + virtual ~SimpleKeyingInterface() {} + + //! returns smallest valid key length in bytes */ + virtual size_t MinKeyLength() const =0; + //! returns largest valid key length in bytes */ + virtual size_t MaxKeyLength() const =0; + //! returns default (recommended) key length in bytes */ + virtual size_t DefaultKeyLength() const =0; + + //! returns the smallest valid key length in bytes that is >= min(n, GetMaxKeyLength()) + virtual size_t GetValidKeyLength(size_t n) const =0; + + //! returns whether n is a valid key length + virtual bool IsValidKeyLength(size_t n) const + {return n == GetValidKeyLength(n);} + + //! set or reset the key of this object + /*! \param params is used to specify Rounds, BlockSize, etc. */ + virtual void SetKey(const byte *key, size_t length, const NameValuePairs ¶ms = g_nullNameValuePairs); + + //! calls SetKey() with an NameValuePairs object that just specifies "Rounds" + void SetKeyWithRounds(const byte *key, size_t length, int rounds); + + //! calls SetKey() with an NameValuePairs object that just specifies "IV" + void SetKeyWithIV(const byte *key, size_t length, const byte *iv, size_t ivLength); + + //! calls SetKey() with an NameValuePairs object that just specifies "IV" + void SetKeyWithIV(const byte *key, size_t length, const byte *iv) + {SetKeyWithIV(key, length, iv, IVSize());} + + enum IV_Requirement {UNIQUE_IV = 0, RANDOM_IV, UNPREDICTABLE_RANDOM_IV, INTERNALLY_GENERATED_IV, NOT_RESYNCHRONIZABLE}; + //! returns the minimal requirement for secure IVs + virtual IV_Requirement IVRequirement() const =0; + + //! returns whether this object can be resynchronized (i.e. supports initialization vectors) + /*! If this function returns true, and no IV is passed to SetKey() and CanUseStructuredIVs()==true, an IV of all 0's will be assumed. */ + bool IsResynchronizable() const {return IVRequirement() < NOT_RESYNCHRONIZABLE;} + //! returns whether this object can use random IVs (in addition to ones returned by GetNextIV) + bool CanUseRandomIVs() const {return IVRequirement() <= UNPREDICTABLE_RANDOM_IV;} + //! returns whether this object can use random but possibly predictable IVs (in addition to ones returned by GetNextIV) + bool CanUsePredictableIVs() const {return IVRequirement() <= RANDOM_IV;} + //! returns whether this object can use structured IVs, for example a counter (in addition to ones returned by GetNextIV) + bool CanUseStructuredIVs() const {return IVRequirement() <= UNIQUE_IV;} + + virtual unsigned int IVSize() const {throw NotImplemented(GetAlgorithm().AlgorithmName() + ": this object doesn't support resynchronization");} + //! returns default length of IVs accepted by this object + unsigned int DefaultIVLength() const {return IVSize();} + //! returns minimal length of IVs accepted by this object + virtual unsigned int MinIVLength() const {return IVSize();} + //! returns maximal length of IVs accepted by this object + virtual unsigned int MaxIVLength() const {return IVSize();} + //! resynchronize with an IV. ivLength=-1 means use IVSize() + virtual void Resynchronize(const byte *iv, int ivLength=-1) {throw NotImplemented(GetAlgorithm().AlgorithmName() + ": this object doesn't support resynchronization");} + //! get a secure IV for the next message + /*! This method should be called after you finish encrypting one message and are ready to start the next one. + After calling it, you must call SetKey() or Resynchronize() before using this object again. + This method is not implemented on decryption objects. */ + virtual void GetNextIV(RandomNumberGenerator &rng, byte *IV); + +protected: + virtual const Algorithm & GetAlgorithm() const =0; + virtual void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) =0; + + void ThrowIfInvalidKeyLength(size_t length); + void ThrowIfResynchronizable(); // to be called when no IV is passed + void ThrowIfInvalidIV(const byte *iv); // check for NULL IV if it can't be used + size_t ThrowIfInvalidIVLength(int size); + const byte * GetIVAndThrowIfInvalid(const NameValuePairs ¶ms, size_t &size); + inline void AssertValidKeyLength(size_t length) const + {assert(IsValidKeyLength(length));} +}; + +//! interface for the data processing part of block ciphers + +/*! Classes derived from BlockTransformation are block ciphers + in ECB mode (for example the DES::Encryption class), which are stateless. + These classes should not be used directly, but only in combination with + a mode class (see CipherModeDocumentation in modes.h). +*/ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BlockTransformation : public Algorithm +{ +public: + //! encrypt or decrypt inBlock, xor with xorBlock, and write to outBlock + virtual void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const =0; + + //! encrypt or decrypt one block + /*! \pre size of inBlock and outBlock == BlockSize() */ + void ProcessBlock(const byte *inBlock, byte *outBlock) const + {ProcessAndXorBlock(inBlock, NULL, outBlock);} + + //! encrypt or decrypt one block in place + void ProcessBlock(byte *inoutBlock) const + {ProcessAndXorBlock(inoutBlock, NULL, inoutBlock);} + + //! block size of the cipher in bytes + virtual unsigned int BlockSize() const =0; + + //! returns how inputs and outputs should be aligned for optimal performance + virtual unsigned int OptimalDataAlignment() const; + + //! returns true if this is a permutation (i.e. there is an inverse transformation) + virtual bool IsPermutation() const {return true;} + + //! returns true if this is an encryption object + virtual bool IsForwardTransformation() const =0; + + //! return number of blocks that can be processed in parallel, for bit-slicing implementations + virtual unsigned int OptimalNumberOfParallelBlocks() const {return 1;} + + enum {BT_InBlockIsCounter=1, BT_DontIncrementInOutPointers=2, BT_XorInput=4, BT_ReverseDirection=8} FlagsForAdvancedProcessBlocks; + + //! encrypt and xor blocks according to flags (see FlagsForAdvancedProcessBlocks) + /*! /note If BT_InBlockIsCounter is set, last byte of inBlocks may be modified. */ + virtual size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const; + + inline CipherDir GetCipherDirection() const {return IsForwardTransformation() ? ENCRYPTION : DECRYPTION;} +}; + +//! interface for the data processing part of stream ciphers + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE StreamTransformation : public Algorithm +{ +public: + //! return a reference to this object, + /*! This function is useful for passing a temporary StreamTransformation object to a + function that takes a non-const reference. */ + StreamTransformation& Ref() {return *this;} + + //! returns block size, if input must be processed in blocks, otherwise 1 + virtual unsigned int MandatoryBlockSize() const {return 1;} + + //! returns the input block size that is most efficient for this cipher + /*! \note optimal input length is n * OptimalBlockSize() - GetOptimalBlockSizeUsed() for any n > 0 */ + virtual unsigned int OptimalBlockSize() const {return MandatoryBlockSize();} + //! returns how much of the current block is used up + virtual unsigned int GetOptimalBlockSizeUsed() const {return 0;} + + //! returns how input should be aligned for optimal performance + virtual unsigned int OptimalDataAlignment() const; + + //! encrypt or decrypt an array of bytes of specified length + /*! \note either inString == outString, or they don't overlap */ + virtual void ProcessData(byte *outString, const byte *inString, size_t length) =0; + + //! for ciphers where the last block of data is special, encrypt or decrypt the last block of data + /*! For now the only use of this function is for CBC-CTS mode. */ + virtual void ProcessLastBlock(byte *outString, const byte *inString, size_t length); + //! returns the minimum size of the last block, 0 indicating the last block is not special + virtual unsigned int MinLastBlockSize() const {return 0;} + + //! same as ProcessData(inoutString, inoutString, length) + inline void ProcessString(byte *inoutString, size_t length) + {ProcessData(inoutString, inoutString, length);} + //! same as ProcessData(outString, inString, length) + inline void ProcessString(byte *outString, const byte *inString, size_t length) + {ProcessData(outString, inString, length);} + //! implemented as {ProcessData(&input, &input, 1); return input;} + inline byte ProcessByte(byte input) + {ProcessData(&input, &input, 1); return input;} + + //! returns whether this cipher supports random access + virtual bool IsRandomAccess() const =0; + //! for random access ciphers, seek to an absolute position + virtual void Seek(lword n) + { + assert(!IsRandomAccess()); + throw NotImplemented("StreamTransformation: this object doesn't support random access"); + } + + //! returns whether this transformation is self-inverting (e.g. xor with a keystream) + virtual bool IsSelfInverting() const =0; + //! returns whether this is an encryption object + virtual bool IsForwardTransformation() const =0; +}; + +//! interface for hash functions and data processing part of MACs + +/*! HashTransformation objects are stateful. They are created in an initial state, + change state as Update() is called, and return to the initial + state when Final() is called. This interface allows a large message to + be hashed in pieces by calling Update() on each piece followed by + calling Final(). +*/ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HashTransformation : public Algorithm +{ +public: + //! return a reference to this object, + /*! This function is useful for passing a temporary HashTransformation object to a + function that takes a non-const reference. */ + HashTransformation& Ref() {return *this;} + + //! process more input + virtual void Update(const byte *input, size_t length) =0; + + //! request space to write input into + virtual byte * CreateUpdateSpace(size_t &size) {size=0; return NULL;} + + //! compute hash for current message, then restart for a new message + /*! \pre size of digest == DigestSize(). */ + virtual void Final(byte *digest) + {TruncatedFinal(digest, DigestSize());} + + //! discard the current state, and restart with a new message + virtual void Restart() + {TruncatedFinal(NULL, 0);} + + //! size of the hash/digest/MAC returned by Final() + virtual unsigned int DigestSize() const =0; + + //! same as DigestSize() + unsigned int TagSize() const {return DigestSize();} + + + //! block size of underlying compression function, or 0 if not block based + virtual unsigned int BlockSize() const {return 0;} + + //! input to Update() should have length a multiple of this for optimal speed + virtual unsigned int OptimalBlockSize() const {return 1;} + + //! returns how input should be aligned for optimal performance + virtual unsigned int OptimalDataAlignment() const; + + //! use this if your input is in one piece and you don't want to call Update() and Final() separately + virtual void CalculateDigest(byte *digest, const byte *input, size_t length) + {Update(input, length); Final(digest);} + + //! verify that digest is a valid digest for the current message, then reinitialize the object + /*! Default implementation is to call Final() and do a bitwise comparison + between its output and digest. */ + virtual bool Verify(const byte *digest) + {return TruncatedVerify(digest, DigestSize());} + + //! use this if your input is in one piece and you don't want to call Update() and Verify() separately + virtual bool VerifyDigest(const byte *digest, const byte *input, size_t length) + {Update(input, length); return Verify(digest);} + + //! truncated version of Final() + virtual void TruncatedFinal(byte *digest, size_t digestSize) =0; + + //! truncated version of CalculateDigest() + virtual void CalculateTruncatedDigest(byte *digest, size_t digestSize, const byte *input, size_t length) + {Update(input, length); TruncatedFinal(digest, digestSize);} + + //! truncated version of Verify() + virtual bool TruncatedVerify(const byte *digest, size_t digestLength); + + //! truncated version of VerifyDigest() + virtual bool VerifyTruncatedDigest(const byte *digest, size_t digestLength, const byte *input, size_t length) + {Update(input, length); return TruncatedVerify(digest, digestLength);} + +protected: + void ThrowIfInvalidTruncatedSize(size_t size) const; +}; + +typedef HashTransformation HashFunction; + +//! interface for one direction (encryption or decryption) of a block cipher +/*! \note These objects usually should not be used directly. See BlockTransformation for more details. */ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BlockCipher : public SimpleKeyingInterface, public BlockTransformation +{ +protected: + const Algorithm & GetAlgorithm() const {return *this;} +}; + +//! interface for one direction (encryption or decryption) of a stream cipher or cipher mode +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE SymmetricCipher : public SimpleKeyingInterface, public StreamTransformation +{ +protected: + const Algorithm & GetAlgorithm() const {return *this;} +}; + +//! interface for message authentication codes +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE MessageAuthenticationCode : public SimpleKeyingInterface, public HashTransformation +{ +protected: + const Algorithm & GetAlgorithm() const {return *this;} +}; + +//! interface for for one direction (encryption or decryption) of a stream cipher or block cipher mode with authentication +/*! The StreamTransformation part of this interface is used to encrypt/decrypt the data, and the MessageAuthenticationCode part of this + interface is used to input additional authenticated data (AAD, which is MAC'ed but not encrypted), and to generate/verify the MAC. */ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AuthenticatedSymmetricCipher : public MessageAuthenticationCode, public StreamTransformation +{ +public: + //! this indicates that a member function was called in the wrong state, for example trying to encrypt a message before having set the key or IV + class BadState : public Exception + { + public: + explicit BadState(const std::string &name, const char *message) : Exception(OTHER_ERROR, name + ": " + message) {} + explicit BadState(const std::string &name, const char *function, const char *state) : Exception(OTHER_ERROR, name + ": " + function + " was called before " + state) {} + }; + + //! the maximum length of AAD that can be input before the encrypted data + virtual lword MaxHeaderLength() const =0; + //! the maximum length of encrypted data + virtual lword MaxMessageLength() const =0; + //! the maximum length of AAD that can be input after the encrypted data + virtual lword MaxFooterLength() const {return 0;} + //! if this function returns true, SpecifyDataLengths() must be called before attempting to input data + /*! This is the case for some schemes, such as CCM. */ + virtual bool NeedsPrespecifiedDataLengths() const {return false;} + //! this function only needs to be called if NeedsPrespecifiedDataLengths() returns true + void SpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength=0); + //! encrypt and generate MAC in one call. will truncate MAC if macSize < TagSize() + virtual void EncryptAndAuthenticate(byte *ciphertext, byte *mac, size_t macSize, const byte *iv, int ivLength, const byte *header, size_t headerLength, const byte *message, size_t messageLength); + //! decrypt and verify MAC in one call, returning true iff MAC is valid. will assume MAC is truncated if macLength < TagSize() + virtual bool DecryptAndVerify(byte *message, const byte *mac, size_t macLength, const byte *iv, int ivLength, const byte *header, size_t headerLength, const byte *ciphertext, size_t ciphertextLength); + + // redeclare this to avoid compiler ambiguity errors + virtual std::string AlgorithmName() const =0; + +protected: + const Algorithm & GetAlgorithm() const {return *static_cast(this);} + virtual void UncheckedSpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength) {} +}; + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY +typedef SymmetricCipher StreamCipher; +#endif + +//! interface for random number generators +/*! All return values are uniformly distributed over the range specified. +*/ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomNumberGenerator : public Algorithm +{ +public: + //! update RNG state with additional unpredictable values + virtual void IncorporateEntropy(const byte *input, size_t length) {throw NotImplemented("RandomNumberGenerator: IncorporateEntropy not implemented");} + + //! returns true if IncorporateEntropy is implemented + virtual bool CanIncorporateEntropy() const {return false;} + + //! generate new random byte and return it + virtual byte GenerateByte(); + + //! generate new random bit and return it + /*! Default implementation is to call GenerateByte() and return its lowest bit. */ + virtual unsigned int GenerateBit(); + + //! generate a random 32 bit word in the range min to max, inclusive + virtual word32 GenerateWord32(word32 a=0, word32 b=0xffffffffL); + + //! generate random array of bytes + virtual void GenerateBlock(byte *output, size_t size); + + //! generate and discard n bytes + virtual void DiscardBytes(size_t n); + + //! generate random bytes as input to a BufferedTransformation + virtual void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword length); + + //! randomly shuffle the specified array, resulting permutation is uniformly distributed + template void Shuffle(IT begin, IT end) + { + for (; begin != end; ++begin) + std::iter_swap(begin, begin + GenerateWord32(0, end-begin-1)); + } + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY + byte GetByte() {return GenerateByte();} + unsigned int GetBit() {return GenerateBit();} + word32 GetLong(word32 a=0, word32 b=0xffffffffL) {return GenerateWord32(a, b);} + word16 GetShort(word16 a=0, word16 b=0xffff) {return (word16)GenerateWord32(a, b);} + void GetBlock(byte *output, size_t size) {GenerateBlock(output, size);} +#endif +}; + +//! returns a reference that can be passed to functions that ask for a RNG but doesn't actually use it +CRYPTOPP_DLL RandomNumberGenerator & CRYPTOPP_API NullRNG(); + +class WaitObjectContainer; +class CallStack; + +//! interface for objects that you can wait for + +class CRYPTOPP_NO_VTABLE Waitable +{ +public: + virtual ~Waitable() {} + + //! maximum number of wait objects that this object can return + virtual unsigned int GetMaxWaitObjectCount() const =0; + //! put wait objects into container + /*! \param callStack is used for tracing no wait loops, example: + something.GetWaitObjects(c, CallStack("my func after X", 0)); + - or in an outer GetWaitObjects() method that itself takes a callStack parameter: + innerThing.GetWaitObjects(c, CallStack("MyClass::GetWaitObjects at X", &callStack)); */ + virtual void GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) =0; + //! wait on this object + /*! same as creating an empty container, calling GetWaitObjects(), and calling Wait() on the container */ + bool Wait(unsigned long milliseconds, CallStack const& callStack); +}; + +//! the default channel for BufferedTransformation, equal to the empty string +extern CRYPTOPP_DLL const std::string DEFAULT_CHANNEL; + +//! channel for additional authenticated data, equal to "AAD" +extern CRYPTOPP_DLL const std::string AAD_CHANNEL; + +//! interface for buffered transformations + +/*! BufferedTransformation is a generalization of BlockTransformation, + StreamTransformation, and HashTransformation. + + A buffered transformation is an object that takes a stream of bytes + as input (this may be done in stages), does some computation on them, and + then places the result into an internal buffer for later retrieval. Any + partial result already in the output buffer is not modified by further + input. + + If a method takes a "blocking" parameter, and you + pass "false" for it, the method will return before all input has been processed if + the input cannot be processed without waiting (for network buffers to become available, for example). + In this case the method will return true + or a non-zero integer value. When this happens you must continue to call the method with the same + parameters until it returns false or zero, before calling any other method on it or + attached BufferedTransformation. The integer return value in this case is approximately + the number of bytes left to be processed, and can be used to implement a progress bar. + + For functions that take a "propagation" parameter, propagation != 0 means pass on the signal to attached + BufferedTransformation objects, with propagation decremented at each step until it reaches 0. + -1 means unlimited propagation. + + \nosubgrouping +*/ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BufferedTransformation : public Algorithm, public Waitable +{ +public: + // placed up here for CW8 + static const std::string &NULL_CHANNEL; // same as DEFAULT_CHANNEL, for backwards compatibility + + BufferedTransformation() : Algorithm(false) {} + + //! return a reference to this object + /*! This function is useful for passing a temporary BufferedTransformation object to a + function that takes a non-const reference. */ + BufferedTransformation& Ref() {return *this;} + + //! \name INPUT + //@{ + //! input a byte for processing + size_t Put(byte inByte, bool blocking=true) + {return Put(&inByte, 1, blocking);} + //! input multiple bytes + size_t Put(const byte *inString, size_t length, bool blocking=true) + {return Put2(inString, length, 0, blocking);} + + //! input a 16-bit word + size_t PutWord16(word16 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true); + //! input a 32-bit word + size_t PutWord32(word32 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true); + + //! request space which can be written into by the caller, and then used as input to Put() + /*! \param size is requested size (as a hint) for input, and size of the returned space for output */ + /*! \note The purpose of this method is to help avoid doing extra memory allocations. */ + virtual byte * CreatePutSpace(size_t &size) {size=0; return NULL;} + + virtual bool CanModifyInput() const {return false;} + + //! input multiple bytes that may be modified by callee + size_t PutModifiable(byte *inString, size_t length, bool blocking=true) + {return PutModifiable2(inString, length, 0, blocking);} + + bool MessageEnd(int propagation=-1, bool blocking=true) + {return !!Put2(NULL, 0, propagation < 0 ? -1 : propagation+1, blocking);} + size_t PutMessageEnd(const byte *inString, size_t length, int propagation=-1, bool blocking=true) + {return Put2(inString, length, propagation < 0 ? -1 : propagation+1, blocking);} + + //! input multiple bytes for blocking or non-blocking processing + /*! \param messageEnd means how many filters to signal MessageEnd to, including this one */ + virtual size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking) =0; + //! input multiple bytes that may be modified by callee for blocking or non-blocking processing + /*! \param messageEnd means how many filters to signal MessageEnd to, including this one */ + virtual size_t PutModifiable2(byte *inString, size_t length, int messageEnd, bool blocking) + {return Put2(inString, length, messageEnd, blocking);} + + //! thrown by objects that have not implemented nonblocking input processing + struct BlockingInputOnly : public NotImplemented + {BlockingInputOnly(const std::string &s) : NotImplemented(s + ": Nonblocking input is not implemented by this object.") {}}; + //@} + + //! \name WAITING + //@{ + unsigned int GetMaxWaitObjectCount() const; + void GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack); + //@} + + //! \name SIGNALS + //@{ + virtual void IsolatedInitialize(const NameValuePairs ¶meters) {throw NotImplemented("BufferedTransformation: this object can't be reinitialized");} + virtual bool IsolatedFlush(bool hardFlush, bool blocking) =0; + virtual bool IsolatedMessageSeriesEnd(bool blocking) {return false;} + + //! initialize or reinitialize this object + virtual void Initialize(const NameValuePairs ¶meters=g_nullNameValuePairs, int propagation=-1); + //! flush buffered input and/or output + /*! \param hardFlush is used to indicate whether all data should be flushed + \note Hard flushes must be used with care. It means try to process and output everything, even if + there may not be enough data to complete the action. For example, hard flushing a HexDecoder would + cause an error if you do it after inputing an odd number of hex encoded characters. + For some types of filters, for example ZlibDecompressor, hard flushes can only + be done at "synchronization points". These synchronization points are positions in the data + stream that are created by hard flushes on the corresponding reverse filters, in this + example ZlibCompressor. This is useful when zlib compressed data is moved across a + network in packets and compression state is preserved across packets, as in the ssh2 protocol. + */ + virtual bool Flush(bool hardFlush, int propagation=-1, bool blocking=true); + //! mark end of a series of messages + /*! There should be a MessageEnd immediately before MessageSeriesEnd. */ + virtual bool MessageSeriesEnd(int propagation=-1, bool blocking=true); + + //! set propagation of automatically generated and transferred signals + /*! propagation == 0 means do not automaticly generate signals */ + virtual void SetAutoSignalPropagation(int propagation) {} + + //! + virtual int GetAutoSignalPropagation() const {return 0;} +public: + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY + void Close() {MessageEnd();} +#endif + //@} + + //! \name RETRIEVAL OF ONE MESSAGE + //@{ + //! returns number of bytes that is currently ready for retrieval + /*! All retrieval functions return the actual number of bytes + retrieved, which is the lesser of the request number and + MaxRetrievable(). */ + virtual lword MaxRetrievable() const; + + //! returns whether any bytes are currently ready for retrieval + virtual bool AnyRetrievable() const; + + //! try to retrieve a single byte + virtual size_t Get(byte &outByte); + //! try to retrieve multiple bytes + virtual size_t Get(byte *outString, size_t getMax); + + //! peek at the next byte without removing it from the output buffer + virtual size_t Peek(byte &outByte) const; + //! peek at multiple bytes without removing them from the output buffer + virtual size_t Peek(byte *outString, size_t peekMax) const; + + //! try to retrieve a 16-bit word + size_t GetWord16(word16 &value, ByteOrder order=BIG_ENDIAN_ORDER); + //! try to retrieve a 32-bit word + size_t GetWord32(word32 &value, ByteOrder order=BIG_ENDIAN_ORDER); + + //! try to peek at a 16-bit word + size_t PeekWord16(word16 &value, ByteOrder order=BIG_ENDIAN_ORDER) const; + //! try to peek at a 32-bit word + size_t PeekWord32(word32 &value, ByteOrder order=BIG_ENDIAN_ORDER) const; + + //! move transferMax bytes of the buffered output to target as input + lword TransferTo(BufferedTransformation &target, lword transferMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL) + {TransferTo2(target, transferMax, channel); return transferMax;} + + //! discard skipMax bytes from the output buffer + virtual lword Skip(lword skipMax=LWORD_MAX); + + //! copy copyMax bytes of the buffered output to target as input + lword CopyTo(BufferedTransformation &target, lword copyMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL) const + {return CopyRangeTo(target, 0, copyMax, channel);} + + //! copy copyMax bytes of the buffered output, starting at position (relative to current position), to target as input + lword CopyRangeTo(BufferedTransformation &target, lword position, lword copyMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL) const + {lword i = position; CopyRangeTo2(target, i, i+copyMax, channel); return i-position;} + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY + unsigned long MaxRetrieveable() const {return MaxRetrievable();} +#endif + //@} + + //! \name RETRIEVAL OF MULTIPLE MESSAGES + //@{ + //! + virtual lword TotalBytesRetrievable() const; + //! number of times MessageEnd() has been received minus messages retrieved or skipped + virtual unsigned int NumberOfMessages() const; + //! returns true if NumberOfMessages() > 0 + virtual bool AnyMessages() const; + //! start retrieving the next message + /*! + Returns false if no more messages exist or this message + is not completely retrieved. + */ + virtual bool GetNextMessage(); + //! skip count number of messages + virtual unsigned int SkipMessages(unsigned int count=UINT_MAX); + //! + unsigned int TransferMessagesTo(BufferedTransformation &target, unsigned int count=UINT_MAX, const std::string &channel=DEFAULT_CHANNEL) + {TransferMessagesTo2(target, count, channel); return count;} + //! + unsigned int CopyMessagesTo(BufferedTransformation &target, unsigned int count=UINT_MAX, const std::string &channel=DEFAULT_CHANNEL) const; + + //! + virtual void SkipAll(); + //! + void TransferAllTo(BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL) + {TransferAllTo2(target, channel);} + //! + void CopyAllTo(BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL) const; + + virtual bool GetNextMessageSeries() {return false;} + virtual unsigned int NumberOfMessagesInThisSeries() const {return NumberOfMessages();} + virtual unsigned int NumberOfMessageSeries() const {return 0;} + //@} + + //! \name NON-BLOCKING TRANSFER OF OUTPUT + //@{ + //! upon return, byteCount contains number of bytes that have finished being transfered, and returns the number of bytes left in the current transfer block + virtual size_t TransferTo2(BufferedTransformation &target, lword &byteCount, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) =0; + //! upon return, begin contains the start position of data yet to be finished copying, and returns the number of bytes left in the current transfer block + virtual size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const =0; + //! upon return, messageCount contains number of messages that have finished being transfered, and returns the number of bytes left in the current transfer block + size_t TransferMessagesTo2(BufferedTransformation &target, unsigned int &messageCount, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + //! returns the number of bytes left in the current transfer block + size_t TransferAllTo2(BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + //@} + + //! \name CHANNELS + //@{ + struct NoChannelSupport : public NotImplemented + {NoChannelSupport(const std::string &name) : NotImplemented(name + ": this object doesn't support multiple channels") {}}; + struct InvalidChannelName : public InvalidArgument + {InvalidChannelName(const std::string &name, const std::string &channel) : InvalidArgument(name + ": unexpected channel name \"" + channel + "\"") {}}; + + size_t ChannelPut(const std::string &channel, byte inByte, bool blocking=true) + {return ChannelPut(channel, &inByte, 1, blocking);} + size_t ChannelPut(const std::string &channel, const byte *inString, size_t length, bool blocking=true) + {return ChannelPut2(channel, inString, length, 0, blocking);} + + size_t ChannelPutModifiable(const std::string &channel, byte *inString, size_t length, bool blocking=true) + {return ChannelPutModifiable2(channel, inString, length, 0, blocking);} + + size_t ChannelPutWord16(const std::string &channel, word16 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true); + size_t ChannelPutWord32(const std::string &channel, word32 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true); + + bool ChannelMessageEnd(const std::string &channel, int propagation=-1, bool blocking=true) + {return !!ChannelPut2(channel, NULL, 0, propagation < 0 ? -1 : propagation+1, blocking);} + size_t ChannelPutMessageEnd(const std::string &channel, const byte *inString, size_t length, int propagation=-1, bool blocking=true) + {return ChannelPut2(channel, inString, length, propagation < 0 ? -1 : propagation+1, blocking);} + + virtual byte * ChannelCreatePutSpace(const std::string &channel, size_t &size); + + virtual size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking); + virtual size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking); + + virtual bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true); + virtual bool ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1, bool blocking=true); + + virtual void SetRetrievalChannel(const std::string &channel); + //@} + + //! \name ATTACHMENT + /*! Some BufferedTransformation objects (e.g. Filter objects) + allow other BufferedTransformation objects to be attached. When + this is done, the first object instead of buffering its output, + sents that output to the attached object as input. The entire + attachment chain is deleted when the anchor object is destructed. + */ + //@{ + //! returns whether this object allows attachment + virtual bool Attachable() {return false;} + //! returns the object immediately attached to this object or NULL for no attachment + virtual BufferedTransformation *AttachedTransformation() {assert(!Attachable()); return 0;} + //! + virtual const BufferedTransformation *AttachedTransformation() const + {return const_cast(this)->AttachedTransformation();} + //! delete the current attachment chain and replace it with newAttachment + virtual void Detach(BufferedTransformation *newAttachment = 0) + {assert(!Attachable()); throw NotImplemented("BufferedTransformation: this object is not attachable");} + //! add newAttachment to the end of attachment chain + virtual void Attach(BufferedTransformation *newAttachment); + //@} + +protected: + static int DecrementPropagation(int propagation) + {return propagation != 0 ? propagation - 1 : 0;} + +private: + byte m_buf[4]; // for ChannelPutWord16 and ChannelPutWord32, to ensure buffer isn't deallocated before non-blocking operation completes +}; + +//! returns a reference to a BufferedTransformation object that discards all input +BufferedTransformation & TheBitBucket(); + +//! interface for crypto material, such as public and private keys, and crypto parameters + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CryptoMaterial : public NameValuePairs +{ +public: + //! exception thrown when invalid crypto material is detected + class CRYPTOPP_DLL InvalidMaterial : public InvalidDataFormat + { + public: + explicit InvalidMaterial(const std::string &s) : InvalidDataFormat(s) {} + }; + + //! assign values from source to this object + /*! \note This function can be used to create a public key from a private key. */ + virtual void AssignFrom(const NameValuePairs &source) =0; + + //! check this object for errors + /*! \param level denotes the level of thoroughness: + 0 - using this object won't cause a crash or exception (rng is ignored) + 1 - this object will probably function (encrypt, sign, etc.) correctly (but may not check for weak keys and such) + 2 - make sure this object will function correctly, and do reasonable security checks + 3 - do checks that may take a long time + \return true if the tests pass */ + virtual bool Validate(RandomNumberGenerator &rng, unsigned int level) const =0; + + //! throws InvalidMaterial if this object fails Validate() test + virtual void ThrowIfInvalid(RandomNumberGenerator &rng, unsigned int level) const + {if (!Validate(rng, level)) throw InvalidMaterial("CryptoMaterial: this object contains invalid values");} + +// virtual std::vector GetSupportedFormats(bool includeSaveOnly=false, bool includeLoadOnly=false); + + //! save key into a BufferedTransformation + virtual void Save(BufferedTransformation &bt) const + {throw NotImplemented("CryptoMaterial: this object does not support saving");} + + //! load key from a BufferedTransformation + /*! \throws KeyingErr if decode fails + \note Generally does not check that the key is valid. + Call ValidateKey() or ThrowIfInvalidKey() to check that. */ + virtual void Load(BufferedTransformation &bt) + {throw NotImplemented("CryptoMaterial: this object does not support loading");} + + //! \return whether this object supports precomputation + virtual bool SupportsPrecomputation() const {return false;} + //! do precomputation + /*! The exact semantics of Precompute() is varies, but + typically it means calculate a table of n objects + that can be used later to speed up computation. */ + virtual void Precompute(unsigned int n) + {assert(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");} + //! retrieve previously saved precomputation + virtual void LoadPrecomputation(BufferedTransformation &storedPrecomputation) + {assert(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");} + //! save precomputation for later use + virtual void SavePrecomputation(BufferedTransformation &storedPrecomputation) const + {assert(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");} + + // for internal library use + void DoQuickSanityCheck() const {ThrowIfInvalid(NullRNG(), 0);} + +#if (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) + // Sun Studio 11/CC 5.8 workaround: it generates incorrect code when casting to an empty virtual base class + char m_sunCCworkaround; +#endif +}; + +//! interface for generatable crypto material, such as private keys and crypto parameters + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE GeneratableCryptoMaterial : virtual public CryptoMaterial +{ +public: + //! generate a random key or crypto parameters + /*! \throws KeyingErr if algorithm parameters are invalid, or if a key can't be generated + (e.g., if this is a public key object) */ + virtual void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms = g_nullNameValuePairs) + {throw NotImplemented("GeneratableCryptoMaterial: this object does not support key/parameter generation");} + + //! calls the above function with a NameValuePairs object that just specifies "KeySize" + void GenerateRandomWithKeySize(RandomNumberGenerator &rng, unsigned int keySize); +}; + +//! interface for public keys + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PublicKey : virtual public CryptoMaterial +{ +}; + +//! interface for private keys + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PrivateKey : public GeneratableCryptoMaterial +{ +}; + +//! interface for crypto prameters + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CryptoParameters : public GeneratableCryptoMaterial +{ +}; + +//! interface for asymmetric algorithms + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AsymmetricAlgorithm : public Algorithm +{ +public: + //! returns a reference to the crypto material used by this object + virtual CryptoMaterial & AccessMaterial() =0; + //! returns a const reference to the crypto material used by this object + virtual const CryptoMaterial & GetMaterial() const =0; + + //! for backwards compatibility, calls AccessMaterial().Load(bt) + void BERDecode(BufferedTransformation &bt) + {AccessMaterial().Load(bt);} + //! for backwards compatibility, calls GetMaterial().Save(bt) + void DEREncode(BufferedTransformation &bt) const + {GetMaterial().Save(bt);} +}; + +//! interface for asymmetric algorithms using public keys + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PublicKeyAlgorithm : public AsymmetricAlgorithm +{ +public: + // VC60 workaround: no co-variant return type + CryptoMaterial & AccessMaterial() {return AccessPublicKey();} + const CryptoMaterial & GetMaterial() const {return GetPublicKey();} + + virtual PublicKey & AccessPublicKey() =0; + virtual const PublicKey & GetPublicKey() const {return const_cast(this)->AccessPublicKey();} +}; + +//! interface for asymmetric algorithms using private keys + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PrivateKeyAlgorithm : public AsymmetricAlgorithm +{ +public: + CryptoMaterial & AccessMaterial() {return AccessPrivateKey();} + const CryptoMaterial & GetMaterial() const {return GetPrivateKey();} + + virtual PrivateKey & AccessPrivateKey() =0; + virtual const PrivateKey & GetPrivateKey() const {return const_cast(this)->AccessPrivateKey();} +}; + +//! interface for key agreement algorithms + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE KeyAgreementAlgorithm : public AsymmetricAlgorithm +{ +public: + CryptoMaterial & AccessMaterial() {return AccessCryptoParameters();} + const CryptoMaterial & GetMaterial() const {return GetCryptoParameters();} + + virtual CryptoParameters & AccessCryptoParameters() =0; + virtual const CryptoParameters & GetCryptoParameters() const {return const_cast(this)->AccessCryptoParameters();} +}; + +//! interface for public-key encryptors and decryptors + +/*! This class provides an interface common to encryptors and decryptors + for querying their plaintext and ciphertext lengths. +*/ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_CryptoSystem +{ +public: + virtual ~PK_CryptoSystem() {} + + //! maximum length of plaintext for a given ciphertext length + /*! \note This function returns 0 if ciphertextLength is not valid (too long or too short). */ + virtual size_t MaxPlaintextLength(size_t ciphertextLength) const =0; + + //! calculate length of ciphertext given length of plaintext + /*! \note This function returns 0 if plaintextLength is not valid (too long). */ + virtual size_t CiphertextLength(size_t plaintextLength) const =0; + + //! this object supports the use of the parameter with the given name + /*! some possible parameter names: EncodingParameters, KeyDerivationParameters */ + virtual bool ParameterSupported(const char *name) const =0; + + //! return fixed ciphertext length, if one exists, otherwise return 0 + /*! \note "Fixed" here means length of ciphertext does not depend on length of plaintext. + It usually does depend on the key length. */ + virtual size_t FixedCiphertextLength() const {return 0;} + + //! return maximum plaintext length given the fixed ciphertext length, if one exists, otherwise return 0 + virtual size_t FixedMaxPlaintextLength() const {return 0;} + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY + size_t MaxPlainTextLength(size_t cipherTextLength) const {return MaxPlaintextLength(cipherTextLength);} + size_t CipherTextLength(size_t plainTextLength) const {return CiphertextLength(plainTextLength);} +#endif +}; + +//! interface for public-key encryptors +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Encryptor : public PK_CryptoSystem, public PublicKeyAlgorithm +{ +public: + //! exception thrown when trying to encrypt plaintext of invalid length + class CRYPTOPP_DLL InvalidPlaintextLength : public Exception + { + public: + InvalidPlaintextLength() : Exception(OTHER_ERROR, "PK_Encryptor: invalid plaintext length") {} + }; + + //! encrypt a byte string + /*! \pre CiphertextLength(plaintextLength) != 0 (i.e., plaintext isn't too long) + \pre size of ciphertext == CiphertextLength(plaintextLength) + */ + virtual void Encrypt(RandomNumberGenerator &rng, + const byte *plaintext, size_t plaintextLength, + byte *ciphertext, const NameValuePairs ¶meters = g_nullNameValuePairs) const =0; + + //! create a new encryption filter + /*! \note The caller is responsible for deleting the returned pointer. + \note Encoding parameters should be passed in the "EP" channel. + */ + virtual BufferedTransformation * CreateEncryptionFilter(RandomNumberGenerator &rng, + BufferedTransformation *attachment=NULL, const NameValuePairs ¶meters = g_nullNameValuePairs) const; +}; + +//! interface for public-key decryptors + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Decryptor : public PK_CryptoSystem, public PrivateKeyAlgorithm +{ +public: + //! decrypt a byte string, and return the length of plaintext + /*! \pre size of plaintext == MaxPlaintextLength(ciphertextLength) bytes. + \return the actual length of the plaintext, indication that decryption failed. + */ + virtual DecodingResult Decrypt(RandomNumberGenerator &rng, + const byte *ciphertext, size_t ciphertextLength, + byte *plaintext, const NameValuePairs ¶meters = g_nullNameValuePairs) const =0; + + //! create a new decryption filter + /*! \note caller is responsible for deleting the returned pointer + */ + virtual BufferedTransformation * CreateDecryptionFilter(RandomNumberGenerator &rng, + BufferedTransformation *attachment=NULL, const NameValuePairs ¶meters = g_nullNameValuePairs) const; + + //! decrypt a fixed size ciphertext + DecodingResult FixedLengthDecrypt(RandomNumberGenerator &rng, const byte *ciphertext, byte *plaintext, const NameValuePairs ¶meters = g_nullNameValuePairs) const + {return Decrypt(rng, ciphertext, FixedCiphertextLength(), plaintext, parameters);} +}; + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY +typedef PK_CryptoSystem PK_FixedLengthCryptoSystem; +typedef PK_Encryptor PK_FixedLengthEncryptor; +typedef PK_Decryptor PK_FixedLengthDecryptor; +#endif + +//! interface for public-key signers and verifiers + +/*! This class provides an interface common to signers and verifiers + for querying scheme properties. +*/ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_SignatureScheme +{ +public: + //! invalid key exception, may be thrown by any function in this class if the private or public key has a length that can't be used + class CRYPTOPP_DLL InvalidKeyLength : public Exception + { + public: + InvalidKeyLength(const std::string &message) : Exception(OTHER_ERROR, message) {} + }; + + //! key too short exception, may be thrown by any function in this class if the private or public key is too short to sign or verify anything + class CRYPTOPP_DLL KeyTooShort : public InvalidKeyLength + { + public: + KeyTooShort() : InvalidKeyLength("PK_Signer: key too short for this signature scheme") {} + }; + + virtual ~PK_SignatureScheme() {} + + //! signature length if it only depends on the key, otherwise 0 + virtual size_t SignatureLength() const =0; + + //! maximum signature length produced for a given length of recoverable message part + virtual size_t MaxSignatureLength(size_t recoverablePartLength = 0) const {return SignatureLength();} + + //! length of longest message that can be recovered, or 0 if this signature scheme does not support message recovery + virtual size_t MaxRecoverableLength() const =0; + + //! length of longest message that can be recovered from a signature of given length, or 0 if this signature scheme does not support message recovery + virtual size_t MaxRecoverableLengthFromSignatureLength(size_t signatureLength) const =0; + + //! requires a random number generator to sign + /*! if this returns false, NullRNG() can be passed to functions that take RandomNumberGenerator & */ + virtual bool IsProbabilistic() const =0; + + //! whether or not a non-recoverable message part can be signed + virtual bool AllowNonrecoverablePart() const =0; + + //! if this function returns true, during verification you must input the signature before the message, otherwise you can input it at anytime */ + virtual bool SignatureUpfront() const {return false;} + + //! whether you must input the recoverable part before the non-recoverable part during signing + virtual bool RecoverablePartFirst() const =0; +}; + +//! interface for accumulating messages to be signed or verified +/*! Only Update() should be called + on this class. No other functions inherited from HashTransformation should be called. +*/ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_MessageAccumulator : public HashTransformation +{ +public: + //! should not be called on PK_MessageAccumulator + unsigned int DigestSize() const + {throw NotImplemented("PK_MessageAccumulator: DigestSize() should not be called");} + //! should not be called on PK_MessageAccumulator + void TruncatedFinal(byte *digest, size_t digestSize) + {throw NotImplemented("PK_MessageAccumulator: TruncatedFinal() should not be called");} +}; + +//! interface for public-key signers + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Signer : public PK_SignatureScheme, public PrivateKeyAlgorithm +{ +public: + //! create a new HashTransformation to accumulate the message to be signed + virtual PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng) const =0; + + virtual void InputRecoverableMessage(PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, size_t recoverableMessageLength) const =0; + + //! sign and delete messageAccumulator (even in case of exception thrown) + /*! \pre size of signature == MaxSignatureLength() + \return actual signature length + */ + virtual size_t Sign(RandomNumberGenerator &rng, PK_MessageAccumulator *messageAccumulator, byte *signature) const; + + //! sign and restart messageAccumulator + /*! \pre size of signature == MaxSignatureLength() + \return actual signature length + */ + virtual size_t SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart=true) const =0; + + //! sign a message + /*! \pre size of signature == MaxSignatureLength() + \return actual signature length + */ + virtual size_t SignMessage(RandomNumberGenerator &rng, const byte *message, size_t messageLen, byte *signature) const; + + //! sign a recoverable message + /*! \pre size of signature == MaxSignatureLength(recoverableMessageLength) + \return actual signature length + */ + virtual size_t SignMessageWithRecovery(RandomNumberGenerator &rng, const byte *recoverableMessage, size_t recoverableMessageLength, + const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, byte *signature) const; +}; + +//! interface for public-key signature verifiers +/*! The Recover* functions throw NotImplemented if the signature scheme does not support + message recovery. + The Verify* functions throw InvalidDataFormat if the scheme does support message + recovery and the signature contains a non-empty recoverable message part. The + Recovery* functions should be used in that case. +*/ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Verifier : public PK_SignatureScheme, public PublicKeyAlgorithm +{ +public: + //! create a new HashTransformation to accumulate the message to be verified + virtual PK_MessageAccumulator * NewVerificationAccumulator() const =0; + + //! input signature into a message accumulator + virtual void InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const =0; + + //! check whether messageAccumulator contains a valid signature and message, and delete messageAccumulator (even in case of exception thrown) + virtual bool Verify(PK_MessageAccumulator *messageAccumulator) const; + + //! check whether messageAccumulator contains a valid signature and message, and restart messageAccumulator + virtual bool VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const =0; + + //! check whether input signature is a valid signature for input message + virtual bool VerifyMessage(const byte *message, size_t messageLen, + const byte *signature, size_t signatureLength) const; + + //! recover a message from its signature + /*! \pre size of recoveredMessage == MaxRecoverableLengthFromSignatureLength(signatureLength) + */ + virtual DecodingResult Recover(byte *recoveredMessage, PK_MessageAccumulator *messageAccumulator) const; + + //! recover a message from its signature + /*! \pre size of recoveredMessage == MaxRecoverableLengthFromSignatureLength(signatureLength) + */ + virtual DecodingResult RecoverAndRestart(byte *recoveredMessage, PK_MessageAccumulator &messageAccumulator) const =0; + + //! recover a message from its signature + /*! \pre size of recoveredMessage == MaxRecoverableLengthFromSignatureLength(signatureLength) + */ + virtual DecodingResult RecoverMessage(byte *recoveredMessage, + const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, + const byte *signature, size_t signatureLength) const; +}; + +//! interface for domains of simple key agreement protocols + +/*! A key agreement domain is a set of parameters that must be shared + by two parties in a key agreement protocol, along with the algorithms + for generating key pairs and deriving agreed values. +*/ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE SimpleKeyAgreementDomain : public KeyAgreementAlgorithm +{ +public: + //! return length of agreed value produced + virtual unsigned int AgreedValueLength() const =0; + //! return length of private keys in this domain + virtual unsigned int PrivateKeyLength() const =0; + //! return length of public keys in this domain + virtual unsigned int PublicKeyLength() const =0; + //! generate private key + /*! \pre size of privateKey == PrivateKeyLength() */ + virtual void GeneratePrivateKey(RandomNumberGenerator &rng, byte *privateKey) const =0; + //! generate public key + /*! \pre size of publicKey == PublicKeyLength() */ + virtual void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const =0; + //! generate private/public key pair + /*! \note equivalent to calling GeneratePrivateKey() and then GeneratePublicKey() */ + virtual void GenerateKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const; + //! derive agreed value from your private key and couterparty's public key, return false in case of failure + /*! \note If you have previously validated the public key, use validateOtherPublicKey=false to save time. + \pre size of agreedValue == AgreedValueLength() + \pre length of privateKey == PrivateKeyLength() + \pre length of otherPublicKey == PublicKeyLength() + */ + virtual bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const =0; + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY + bool ValidateDomainParameters(RandomNumberGenerator &rng) const + {return GetCryptoParameters().Validate(rng, 2);} +#endif +}; + +//! interface for domains of authenticated key agreement protocols + +/*! In an authenticated key agreement protocol, each party has two + key pairs. The long-lived key pair is called the static key pair, + and the short-lived key pair is called the ephemeral key pair. +*/ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AuthenticatedKeyAgreementDomain : public KeyAgreementAlgorithm +{ +public: + //! return length of agreed value produced + virtual unsigned int AgreedValueLength() const =0; + + //! return length of static private keys in this domain + virtual unsigned int StaticPrivateKeyLength() const =0; + //! return length of static public keys in this domain + virtual unsigned int StaticPublicKeyLength() const =0; + //! generate static private key + /*! \pre size of privateKey == PrivateStaticKeyLength() */ + virtual void GenerateStaticPrivateKey(RandomNumberGenerator &rng, byte *privateKey) const =0; + //! generate static public key + /*! \pre size of publicKey == PublicStaticKeyLength() */ + virtual void GenerateStaticPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const =0; + //! generate private/public key pair + /*! \note equivalent to calling GenerateStaticPrivateKey() and then GenerateStaticPublicKey() */ + virtual void GenerateStaticKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const; + + //! return length of ephemeral private keys in this domain + virtual unsigned int EphemeralPrivateKeyLength() const =0; + //! return length of ephemeral public keys in this domain + virtual unsigned int EphemeralPublicKeyLength() const =0; + //! generate ephemeral private key + /*! \pre size of privateKey == PrivateEphemeralKeyLength() */ + virtual void GenerateEphemeralPrivateKey(RandomNumberGenerator &rng, byte *privateKey) const =0; + //! generate ephemeral public key + /*! \pre size of publicKey == PublicEphemeralKeyLength() */ + virtual void GenerateEphemeralPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const =0; + //! generate private/public key pair + /*! \note equivalent to calling GenerateEphemeralPrivateKey() and then GenerateEphemeralPublicKey() */ + virtual void GenerateEphemeralKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const; + + //! derive agreed value from your private keys and couterparty's public keys, return false in case of failure + /*! \note The ephemeral public key will always be validated. + If you have previously validated the static public key, use validateStaticOtherPublicKey=false to save time. + \pre size of agreedValue == AgreedValueLength() + \pre length of staticPrivateKey == StaticPrivateKeyLength() + \pre length of ephemeralPrivateKey == EphemeralPrivateKeyLength() + \pre length of staticOtherPublicKey == StaticPublicKeyLength() + \pre length of ephemeralOtherPublicKey == EphemeralPublicKeyLength() + */ + virtual bool Agree(byte *agreedValue, + const byte *staticPrivateKey, const byte *ephemeralPrivateKey, + const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, + bool validateStaticOtherPublicKey=true) const =0; + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY + bool ValidateDomainParameters(RandomNumberGenerator &rng) const + {return GetCryptoParameters().Validate(rng, 2);} +#endif +}; + +// interface for password authenticated key agreement protocols, not implemented yet +#if 0 +//! interface for protocol sessions +/*! The methods should be called in the following order: + + InitializeSession(rng, parameters); // or call initialize method in derived class + while (true) + { + if (OutgoingMessageAvailable()) + { + length = GetOutgoingMessageLength(); + GetOutgoingMessage(message); + ; // send outgoing message + } + + if (LastMessageProcessed()) + break; + + ; // receive incoming message + ProcessIncomingMessage(message); + } + ; // call methods in derived class to obtain result of protocol session +*/ +class ProtocolSession +{ +public: + //! exception thrown when an invalid protocol message is processed + class ProtocolError : public Exception + { + public: + ProtocolError(ErrorType errorType, const std::string &s) : Exception(errorType, s) {} + }; + + //! exception thrown when a function is called unexpectedly + /*! for example calling ProcessIncomingMessage() when ProcessedLastMessage() == true */ + class UnexpectedMethodCall : public Exception + { + public: + UnexpectedMethodCall(const std::string &s) : Exception(OTHER_ERROR, s) {} + }; + + ProtocolSession() : m_rng(NULL), m_throwOnProtocolError(true), m_validState(false) {} + virtual ~ProtocolSession() {} + + virtual void InitializeSession(RandomNumberGenerator &rng, const NameValuePairs ¶meters) =0; + + bool GetThrowOnProtocolError() const {return m_throwOnProtocolError;} + void SetThrowOnProtocolError(bool throwOnProtocolError) {m_throwOnProtocolError = throwOnProtocolError;} + + bool HasValidState() const {return m_validState;} + + virtual bool OutgoingMessageAvailable() const =0; + virtual unsigned int GetOutgoingMessageLength() const =0; + virtual void GetOutgoingMessage(byte *message) =0; + + virtual bool LastMessageProcessed() const =0; + virtual void ProcessIncomingMessage(const byte *message, unsigned int messageLength) =0; + +protected: + void HandleProtocolError(Exception::ErrorType errorType, const std::string &s) const; + void CheckAndHandleInvalidState() const; + void SetValidState(bool valid) {m_validState = valid;} + + RandomNumberGenerator *m_rng; + +private: + bool m_throwOnProtocolError, m_validState; +}; + +class KeyAgreementSession : public ProtocolSession +{ +public: + virtual unsigned int GetAgreedValueLength() const =0; + virtual void GetAgreedValue(byte *agreedValue) const =0; +}; + +class PasswordAuthenticatedKeyAgreementSession : public KeyAgreementSession +{ +public: + void InitializePasswordAuthenticatedKeyAgreementSession(RandomNumberGenerator &rng, + const byte *myId, unsigned int myIdLength, + const byte *counterPartyId, unsigned int counterPartyIdLength, + const byte *passwordOrVerifier, unsigned int passwordOrVerifierLength); +}; + +class PasswordAuthenticatedKeyAgreementDomain : public KeyAgreementAlgorithm +{ +public: + //! return whether the domain parameters stored in this object are valid + virtual bool ValidateDomainParameters(RandomNumberGenerator &rng) const + {return GetCryptoParameters().Validate(rng, 2);} + + virtual unsigned int GetPasswordVerifierLength(const byte *password, unsigned int passwordLength) const =0; + virtual void GeneratePasswordVerifier(RandomNumberGenerator &rng, const byte *userId, unsigned int userIdLength, const byte *password, unsigned int passwordLength, byte *verifier) const =0; + + enum RoleFlags {CLIENT=1, SERVER=2, INITIATOR=4, RESPONDER=8}; + + virtual bool IsValidRole(unsigned int role) =0; + virtual PasswordAuthenticatedKeyAgreementSession * CreateProtocolSession(unsigned int role) const =0; +}; +#endif + +//! BER Decode Exception Class, may be thrown during an ASN1 BER decode operation +class CRYPTOPP_DLL BERDecodeErr : public InvalidArgument +{ +public: + BERDecodeErr() : InvalidArgument("BER decode error") {} + BERDecodeErr(const std::string &s) : InvalidArgument(s) {} +}; + +//! interface for encoding and decoding ASN1 objects +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE ASN1Object +{ +public: + virtual ~ASN1Object() {} + //! decode this object from a BufferedTransformation, using BER (Basic Encoding Rules) + virtual void BERDecode(BufferedTransformation &bt) =0; + //! encode this object into a BufferedTransformation, using DER (Distinguished Encoding Rules) + virtual void DEREncode(BufferedTransformation &bt) const =0; + //! encode this object into a BufferedTransformation, using BER + /*! this may be useful if DEREncode() would be too inefficient */ + virtual void BEREncode(BufferedTransformation &bt) const {DEREncode(bt);} +}; + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY +typedef PK_SignatureScheme PK_SignatureSystem; +typedef SimpleKeyAgreementDomain PK_SimpleKeyAgreementDomain; +typedef AuthenticatedKeyAgreementDomain PK_AuthenticatedKeyAgreementDomain; +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/cryptlib.vcproj b/cryptopp/cryptlib.vcproj new file mode 100644 index 0000000..8f5de37 --- /dev/null +++ b/cryptopp/cryptlib.vcproj @@ -0,0 +1,3298 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cryptopp/cryptlib100.vcxproj b/cryptopp/cryptlib100.vcxproj new file mode 100644 index 0000000..ada8973 --- /dev/null +++ b/cryptopp/cryptlib100.vcxproj @@ -0,0 +1,2171 @@ + + + + + debug100 + Win32 + + + debug100 + x64 + + + Debug + Win32 + + + Debug + x64 + + + DLL-Import Debug + Win32 + + + DLL-Import Debug + x64 + + + DLL-Import Release + Win32 + + + DLL-Import Release + x64 + + + Release + Win32 + + + Release + x64 + + + + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF} + cryptlib + . + cryptlib100 + + + + Application + v140_xp + + + Application + v140_xp + + + StaticLibrary + false + + + v140_xp + + + StaticLibrary + false + v140_xp + + + StaticLibrary + false + true + v140_xp + + + StaticLibrary + false + v140_xp + + + StaticLibrary + false + true + v140_xp + + + Application + v140_xp + + + StaticLibrary + false + v140_xp + + + StaticLibrary + false + true + v140_xp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)\build\$(Configuration)\ + $(SolutionDir)\build\$(Configuration)\$(ProjectName)\ + $(Platform)\Output\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + $(SolutionDir)\build\$(Configuration)\ + $(SolutionDir)\build\$(Configuration)\$(ProjectName)\ + $(Platform)\Output\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(Platform)\$(Configuration)\ + $(Configuration)\ + $(Platform)\DLL_Output\Release\ + $(Platform)\$(ProjectName)\$(Configuration)\ + $(Configuration)\ + $(Platform)\DLL_Output\Debug\ + $(Platform)\$(ProjectName)\$(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + MaxSpeed + AnySuitable + true + false + false + _ALLOW_KEYWORD_MACROS;NDEBUG;_WINDOWS;USE_PRECOMPILED_HEADERS;WIN32;%(PreprocessorDefinitions) + true + Async + MultiThreaded + true + true + NotSet + Use + pch.h + Level3 + true + ProgramDatabase + + + 0x0409 + + + true + + + + + X64 + + + MaxSpeed + AnySuitable + true + true + NDEBUG;_WINDOWS;USE_PRECOMPILED_HEADERS;WIN32;%(PreprocessorDefinitions) + true + MultiThreaded + true + Use + pch.h + Level3 + true + ProgramDatabase + + + 0x0409 + + + true + + + + + Disabled + true + _DEBUG;_WINDOWS;USE_PRECOMPILED_HEADERS;WIN32;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + NotSet + Use + pch.h + Level3 + true + EditAndContinue + + + 0x0409 + + + true + + + + + X64 + + + Disabled + true + _DEBUG;_WINDOWS;USE_PRECOMPILED_HEADERS;WIN32;%(PreprocessorDefinitions) + MultiThreadedDebug + Use + pch.h + Level3 + true + ProgramDatabase + + + 0x0409 + + + true + + + + + Disabled + true + _DEBUG;_WINDOWS;USE_PRECOMPILED_HEADERS;WIN32;%(PreprocessorDefinitions) + Async + EnableFastChecks + MultiThreadedDebug + NotSet + Use + pch.h + Level3 + true + EditAndContinue + true + + + 0x0409 + + + true + + + true + + + + + false + + + + + + + false + + + + + + + X64 + + + MaxSpeed + AnySuitable + true + true + true + NDEBUG;_WINDOWS;USE_PRECOMPILED_HEADERS;WIN32;CRYPTOPP_IMPORTS;%(PreprocessorDefinitions) + true + MultiThreaded + true + Use + pch.h + Level3 + true + ProgramDatabase + + + 0x0409 + + + true + + + + + false + + + + + + + X64 + + + Disabled + true + _DEBUG;_WINDOWS;USE_PRECOMPILED_HEADERS;WIN32;CRYPTOPP_IMPORTS;%(PreprocessorDefinitions) + MultiThreadedDebug + Use + pch.h + Level3 + true + ProgramDatabase + + + 0x0409 + + + true + + + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + + + MaxSpeed + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + + + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + true + Disabled + %(PreprocessorDefinitions) + true + MaxSpeed + %(PreprocessorDefinitions) + true + Disabled + %(PreprocessorDefinitions) + true + Disabled + %(PreprocessorDefinitions) + true + %(PreprocessorDefinitions) + true + %(PreprocessorDefinitions) + true + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + + true + Disabled + %(PreprocessorDefinitions) + true + MaxSpeed + %(PreprocessorDefinitions) + true + Disabled + %(PreprocessorDefinitions) + true + Disabled + %(PreprocessorDefinitions) + true + %(PreprocessorDefinitions) + true + %(PreprocessorDefinitions) + true + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + Create + MaxSpeed + %(PreprocessorDefinitions) + Create + Disabled + %(PreprocessorDefinitions) + Create + Disabled + %(PreprocessorDefinitions) + Create + %(PreprocessorDefinitions) + Create + %(PreprocessorDefinitions) + Create + Disabled + %(PreprocessorDefinitions) + Create + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + Disabled + %(PreprocessorDefinitions) + MaxSpeed + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + Disabled + %(PreprocessorDefinitions) + + + + + if not exist adhoc.cpp copy "%(FullPath)" adhoc.cpp +echo: >> adhoc.cpp.copied + + adhoc.cpp.copied;%(Outputs) + if not exist adhoc.cpp copy "%(FullPath)" adhoc.cpp +echo: >> adhoc.cpp.copied + + adhoc.cpp.copied;%(Outputs) + if not exist adhoc.cpp copy "%(FullPath)" adhoc.cpp +echo: >> adhoc.cpp.copied + + adhoc.cpp.copied;%(Outputs) + if not exist adhoc.cpp copy "%(FullPath)" adhoc.cpp +echo: >> adhoc.cpp.copied + + adhoc.cpp.copied;%(Outputs) + if not exist adhoc.cpp copy "%(FullPath)" adhoc.cpp +echo: >> adhoc.cpp.copied + + adhoc.cpp.copied;%(Outputs) + if not exist adhoc.cpp copy "%(FullPath)" adhoc.cpp +echo: >> adhoc.cpp.copied + + adhoc.cpp.copied;%(Outputs) + if not exist adhoc.cpp copy "%(FullPath)" adhoc.cpp +echo: >> adhoc.cpp.copied + + adhoc.cpp.copied;%(Outputs) + + + ml64.exe /c /nologo /Fo"$(IntDir)x64masm.obj" /Zi %(FullPath) + + $(IntDir)x64masm.obj;%(Outputs) + ml64.exe /c /nologo /Fo"$(IntDir)x64masm.obj" /Zi %(FullPath) + + $(IntDir)x64masm.obj;%(Outputs) + true + ml64.exe /c /nologo /Fo"$(IntDir)x64masm.obj" /Zi %(FullPath) + + $(IntDir)x64masm.obj;%(Outputs) + true + ml64.exe /c /nologo /Fo"$(IntDir)x64masm.obj" /Zi %(FullPath) + + $(IntDir)x64masm.obj;%(Outputs) + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cryptopp/cryptlib100.vcxproj.filters b/cryptopp/cryptlib100.vcxproj.filters new file mode 100644 index 0000000..fbfb5b1 --- /dev/null +++ b/cryptopp/cryptlib100.vcxproj.filters @@ -0,0 +1,781 @@ + + + + + {8339f875-5c79-4572-be82-dd3f82b60fba} + .cpp + + + {4d86e037-edba-42d3-9688-daa45964f021} + .;.h + + + {0c58022e-04a1-4434-a920-f47726513c7d} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Miscellaneous + + + Miscellaneous + + + Miscellaneous + + + Miscellaneous + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/cryptopp/cryptlib80.vcproj b/cryptopp/cryptlib80.vcproj new file mode 100644 index 0000000..b28a2aa --- /dev/null +++ b/cryptopp/cryptlib80.vcproj @@ -0,0 +1,8628 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cryptopp/cryptlib90.vcproj b/cryptopp/cryptlib90.vcproj new file mode 100644 index 0000000..4f2c77f --- /dev/null +++ b/cryptopp/cryptlib90.vcproj @@ -0,0 +1,8626 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cryptopp/cryptlib_bds.bdsproj b/cryptopp/cryptlib_bds.bdsproj new file mode 100644 index 0000000..8351316 --- /dev/null +++ b/cryptopp/cryptlib_bds.bdsproj @@ -0,0 +1,377 @@ + + + + + + + + + + + + cryptlib_bds.cpp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + + + + False + + + + + + + False + + False + + True + False + + + + + + + + + + + diff --git a/cryptopp/cryptlib_bds.cpp b/cryptopp/cryptlib_bds.cpp new file mode 100644 index 0000000..7724a9f --- /dev/null +++ b/cryptopp/cryptlib_bds.cpp @@ -0,0 +1,10 @@ +//--------------------------------------------------------------------------- + +/* +#include +#pragma hdrstop +*/ +#define Library + +// To add a file to the library use the Project menu 'Add to Project'. + diff --git a/cryptopp/cryptopp.rc b/cryptopp/cryptopp.rc new file mode 100644 index 0000000..b1012ef --- /dev/null +++ b/cryptopp/cryptopp.rc @@ -0,0 +1,104 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 5,6,0,0 + PRODUCTVERSION 5,6,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "free crypto library, more information available at www.cryptopp.com" + VALUE "CompanyName", "Wei Dai" + VALUE "FileDescription", "Crypto++ Library DLL" + VALUE "FileVersion", "5, 6, 0, 0" + VALUE "InternalName", "cryptopp" + VALUE "LegalCopyright", "Copyright 1995-2009 by Wei Dai" + VALUE "LegalTrademarks", "Crypto++" + VALUE "OriginalFilename", "cryptopp.dll" + VALUE "ProductName", "Crypto++ Library" + VALUE "ProductVersion", "5, 6, 0, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/cryptopp/datatest.cpp b/cryptopp/datatest.cpp new file mode 100644 index 0000000..d23d5d9 --- /dev/null +++ b/cryptopp/datatest.cpp @@ -0,0 +1,698 @@ +#include "factory.h" +#include "integer.h" +#include "filters.h" +#include "hex.h" +#include "randpool.h" +#include "files.h" +#include "trunhash.h" +#include "queue.h" +#include "validate.h" +#include +#include + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +typedef std::map TestData; + +class TestFailure : public Exception +{ +public: + TestFailure() : Exception(OTHER_ERROR, "Validation test failed") {} +}; + +static const TestData *s_currentTestData = NULL; + +static void OutputTestData(const TestData &v) +{ + for (TestData::const_iterator i = v.begin(); i != v.end(); ++i) + { + cerr << i->first << ": " << i->second << endl; + } +} + +static void SignalTestFailure() +{ + OutputTestData(*s_currentTestData); + throw TestFailure(); +} + +static void SignalTestError() +{ + OutputTestData(*s_currentTestData); + throw Exception(Exception::OTHER_ERROR, "Unexpected error during validation test"); +} + +bool DataExists(const TestData &data, const char *name) +{ + TestData::const_iterator i = data.find(name); + return (i != data.end()); +} + +const std::string & GetRequiredDatum(const TestData &data, const char *name) +{ + TestData::const_iterator i = data.find(name); + if (i == data.end()) + SignalTestError(); + return i->second; +} + +void PutDecodedDatumInto(const TestData &data, const char *name, BufferedTransformation &target) +{ + std::string s1 = GetRequiredDatum(data, name), s2; + + while (!s1.empty()) + { + while (s1[0] == ' ') + s1 = s1.substr(1); + + int repeat = 1; + if (s1[0] == 'r') + { + repeat = atoi(s1.c_str()+1); + s1 = s1.substr(s1.find(' ')+1); + } + + s2 = ""; // MSVC 6 doesn't have clear(); + + if (s1[0] == '\"') + { + s2 = s1.substr(1, s1.find('\"', 1)-1); + s1 = s1.substr(s2.length() + 2); + } + else if (s1.substr(0, 2) == "0x") + { + StringSource(s1.substr(2, s1.find(' ')), true, new HexDecoder(new StringSink(s2))); + s1 = s1.substr(STDMIN(s1.find(' '), s1.length())); + } + else + { + StringSource(s1.substr(0, s1.find(' ')), true, new HexDecoder(new StringSink(s2))); + s1 = s1.substr(STDMIN(s1.find(' '), s1.length())); + } + + ByteQueue q; + while (repeat--) + { + q.Put((const byte *)s2.data(), s2.size()); + if (q.MaxRetrievable() > 4*1024 || repeat == 0) + q.TransferTo(target); + } + } +} + +std::string GetDecodedDatum(const TestData &data, const char *name) +{ + std::string s; + PutDecodedDatumInto(data, name, StringSink(s).Ref()); + return s; +} + +std::string GetOptionalDecodedDatum(const TestData &data, const char *name) +{ + std::string s; + if (DataExists(data, name)) + PutDecodedDatumInto(data, name, StringSink(s).Ref()); + return s; +} + +class TestDataNameValuePairs : public NameValuePairs +{ +public: + TestDataNameValuePairs(const TestData &data) : m_data(data) {} + + virtual bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const + { + TestData::const_iterator i = m_data.find(name); + if (i == m_data.end()) + { + if (std::string(name) == Name::DigestSize() && valueType == typeid(int)) + { + i = m_data.find("MAC"); + if (i == m_data.end()) + i = m_data.find("Digest"); + if (i == m_data.end()) + return false; + + m_temp.resize(0); + PutDecodedDatumInto(m_data, i->first.c_str(), StringSink(m_temp).Ref()); + *reinterpret_cast(pValue) = (int)m_temp.size(); + return true; + } + else + return false; + } + + const std::string &value = i->second; + + if (valueType == typeid(int)) + *reinterpret_cast(pValue) = atoi(value.c_str()); + else if (valueType == typeid(Integer)) + *reinterpret_cast(pValue) = Integer((std::string(value) + "h").c_str()); + else if (valueType == typeid(ConstByteArrayParameter)) + { + m_temp.resize(0); + PutDecodedDatumInto(m_data, name, StringSink(m_temp).Ref()); + reinterpret_cast(pValue)->Assign((const byte *)m_temp.data(), m_temp.size(), false); + } + else + throw ValueTypeMismatch(name, typeid(std::string), valueType); + + return true; + } + +private: + const TestData &m_data; + mutable std::string m_temp; +}; + +void TestKeyPairValidAndConsistent(CryptoMaterial &pub, const CryptoMaterial &priv) +{ + if (!pub.Validate(GlobalRNG(), 3)) + SignalTestFailure(); + if (!priv.Validate(GlobalRNG(), 3)) + SignalTestFailure(); + +/* EqualityComparisonFilter comparison; + pub.Save(ChannelSwitch(comparison, "0")); + pub.AssignFrom(priv); + pub.Save(ChannelSwitch(comparison, "1")); + comparison.ChannelMessageSeriesEnd("0"); + comparison.ChannelMessageSeriesEnd("1"); +*/ +} + +void TestSignatureScheme(TestData &v) +{ + std::string name = GetRequiredDatum(v, "Name"); + std::string test = GetRequiredDatum(v, "Test"); + + std::auto_ptr signer(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + std::auto_ptr verifier(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + + TestDataNameValuePairs pairs(v); + std::string keyFormat = GetRequiredDatum(v, "KeyFormat"); + + if (keyFormat == "DER") + verifier->AccessMaterial().Load(StringStore(GetDecodedDatum(v, "PublicKey")).Ref()); + else if (keyFormat == "Component") + verifier->AccessMaterial().AssignFrom(pairs); + + if (test == "Verify" || test == "NotVerify") + { + VerifierFilter verifierFilter(*verifier, NULL, VerifierFilter::SIGNATURE_AT_BEGIN); + PutDecodedDatumInto(v, "Signature", verifierFilter); + PutDecodedDatumInto(v, "Message", verifierFilter); + verifierFilter.MessageEnd(); + if (verifierFilter.GetLastResult() == (test == "NotVerify")) + SignalTestFailure(); + } + else if (test == "PublicKeyValid") + { + if (!verifier->GetMaterial().Validate(GlobalRNG(), 3)) + SignalTestFailure(); + } + else + goto privateKeyTests; + + return; + +privateKeyTests: + if (keyFormat == "DER") + signer->AccessMaterial().Load(StringStore(GetDecodedDatum(v, "PrivateKey")).Ref()); + else if (keyFormat == "Component") + signer->AccessMaterial().AssignFrom(pairs); + + if (test == "KeyPairValidAndConsistent") + { + TestKeyPairValidAndConsistent(verifier->AccessMaterial(), signer->GetMaterial()); + } + else if (test == "Sign") + { + SignerFilter f(GlobalRNG(), *signer, new HexEncoder(new FileSink(cout))); + StringSource ss(GetDecodedDatum(v, "Message"), true, new Redirector(f)); + SignalTestFailure(); + } + else if (test == "DeterministicSign") + { + SignalTestError(); + assert(false); // TODO: implement + } + else if (test == "RandomSign") + { + SignalTestError(); + assert(false); // TODO: implement + } + else if (test == "GenerateKey") + { + SignalTestError(); + assert(false); + } + else + { + SignalTestError(); + assert(false); + } +} + +void TestAsymmetricCipher(TestData &v) +{ + std::string name = GetRequiredDatum(v, "Name"); + std::string test = GetRequiredDatum(v, "Test"); + + std::auto_ptr encryptor(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + std::auto_ptr decryptor(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + + std::string keyFormat = GetRequiredDatum(v, "KeyFormat"); + + if (keyFormat == "DER") + { + decryptor->AccessMaterial().Load(StringStore(GetDecodedDatum(v, "PrivateKey")).Ref()); + encryptor->AccessMaterial().Load(StringStore(GetDecodedDatum(v, "PublicKey")).Ref()); + } + else if (keyFormat == "Component") + { + TestDataNameValuePairs pairs(v); + decryptor->AccessMaterial().AssignFrom(pairs); + encryptor->AccessMaterial().AssignFrom(pairs); + } + + if (test == "DecryptMatch") + { + std::string decrypted, expected = GetDecodedDatum(v, "Plaintext"); + StringSource ss(GetDecodedDatum(v, "Ciphertext"), true, new PK_DecryptorFilter(GlobalRNG(), *decryptor, new StringSink(decrypted))); + if (decrypted != expected) + SignalTestFailure(); + } + else if (test == "KeyPairValidAndConsistent") + { + TestKeyPairValidAndConsistent(encryptor->AccessMaterial(), decryptor->GetMaterial()); + } + else + { + SignalTestError(); + assert(false); + } +} + +void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters) +{ + std::string name = GetRequiredDatum(v, "Name"); + std::string test = GetRequiredDatum(v, "Test"); + + std::string key = GetDecodedDatum(v, "Key"); + std::string plaintext = GetDecodedDatum(v, "Plaintext"); + + TestDataNameValuePairs testDataPairs(v); + CombinedNameValuePairs pairs(overrideParameters, testDataPairs); + + if (test == "Encrypt" || test == "EncryptXorDigest" || test == "Resync") + { + static member_ptr encryptor, decryptor; + static std::string lastName; + + if (name != lastName) + { + encryptor.reset(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + decryptor.reset(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + lastName = name; + } + + ConstByteArrayParameter iv; + if (pairs.GetValue(Name::IV(), iv) && iv.size() != encryptor->IVSize()) + SignalTestFailure(); + + if (test == "Resync") + { + encryptor->Resynchronize(iv.begin(), (int)iv.size()); + decryptor->Resynchronize(iv.begin(), (int)iv.size()); + } + else + { + encryptor->SetKey((const byte *)key.data(), key.size(), pairs); + decryptor->SetKey((const byte *)key.data(), key.size(), pairs); + } + + int seek = pairs.GetIntValueWithDefault("Seek", 0); + if (seek) + { + encryptor->Seek(seek); + decryptor->Seek(seek); + } + std::string encrypted, xorDigest, ciphertext, ciphertextXorDigest; + StringSource ss(plaintext, false, new StreamTransformationFilter(*encryptor, new StringSink(encrypted), StreamTransformationFilter::NO_PADDING)); + ss.Pump(plaintext.size()/2 + 1); + ss.PumpAll(); + /*{ + std::string z; + encryptor->Seek(seek); + StringSource ss(plaintext, false, new StreamTransformationFilter(*encryptor, new StringSink(z), StreamTransformationFilter::NO_PADDING)); + while (ss.Pump(64)) {} + ss.PumpAll(); + for (int i=0; i asc1, asc2; + asc1.reset(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + asc2.reset(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + asc1->SetKey((const byte *)key.data(), key.size(), pairs); + asc2->SetKey((const byte *)key.data(), key.size(), pairs); + + std::string encrypted, decrypted; + AuthenticatedEncryptionFilter ef(*asc1, new StringSink(encrypted)); + bool macAtBegin = !mac.empty() && !GlobalRNG().GenerateBit(); // test both ways randomly + AuthenticatedDecryptionFilter df(*asc2, new StringSink(decrypted), macAtBegin ? AuthenticatedDecryptionFilter::MAC_AT_BEGIN : 0); + + if (asc1->NeedsPrespecifiedDataLengths()) + { + asc1->SpecifyDataLengths(header.size(), plaintext.size(), footer.size()); + asc2->SpecifyDataLengths(header.size(), plaintext.size(), footer.size()); + } + + StringStore sh(header), sp(plaintext), sc(ciphertext), sf(footer), sm(mac); + + if (macAtBegin) + sm.TransferTo(df); + sh.CopyTo(df, LWORD_MAX, AAD_CHANNEL); + sc.TransferTo(df); + sf.CopyTo(df, LWORD_MAX, AAD_CHANNEL); + if (!macAtBegin) + sm.TransferTo(df); + df.MessageEnd(); + + sh.TransferTo(ef, sh.MaxRetrievable()/2+1, AAD_CHANNEL); + sh.TransferTo(ef, LWORD_MAX, AAD_CHANNEL); + sp.TransferTo(ef, sp.MaxRetrievable()/2+1); + sp.TransferTo(ef); + sf.TransferTo(ef, sf.MaxRetrievable()/2+1, AAD_CHANNEL); + sf.TransferTo(ef, LWORD_MAX, AAD_CHANNEL); + ef.MessageEnd(); + + if (test == "Encrypt" && encrypted != ciphertext+mac) + { + std::cout << "incorrectly encrypted: "; + StringSource xx(encrypted, false, new HexEncoder(new FileSink(std::cout))); + xx.Pump(256); xx.Flush(false); + std::cout << "\n"; + SignalTestFailure(); + } + if (test == "Encrypt" && decrypted != plaintext) + { + std::cout << "incorrectly decrypted: "; + StringSource xx(decrypted, false, new HexEncoder(new FileSink(std::cout))); + xx.Pump(256); xx.Flush(false); + std::cout << "\n"; + SignalTestFailure(); + } + + if (ciphertext.size()+mac.size()-plaintext.size() != asc1->DigestSize()) + { + std::cout << "bad MAC size\n"; + SignalTestFailure(); + } + if (df.GetLastResult() != (test == "Encrypt")) + { + std::cout << "MAC incorrectly verified\n"; + SignalTestFailure(); + } + } + else + { + std::cout << "unexpected test name\n"; + SignalTestError(); + } +} + +void TestDigestOrMAC(TestData &v, bool testDigest) +{ + std::string name = GetRequiredDatum(v, "Name"); + std::string test = GetRequiredDatum(v, "Test"); + const char *digestName = testDigest ? "Digest" : "MAC"; + + member_ptr mac; + member_ptr hash; + HashTransformation *pHash = NULL; + + TestDataNameValuePairs pairs(v); + + if (testDigest) + { + hash.reset(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + pHash = hash.get(); + } + else + { + mac.reset(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + pHash = mac.get(); + std::string key = GetDecodedDatum(v, "Key"); + mac->SetKey((const byte *)key.c_str(), key.size(), pairs); + } + + if (test == "Verify" || test == "VerifyTruncated" || test == "NotVerify") + { + int digestSize = -1; + if (test == "VerifyTruncated") + pairs.GetIntValue(Name::DigestSize(), digestSize); + HashVerificationFilter verifierFilter(*pHash, NULL, HashVerificationFilter::HASH_AT_BEGIN, digestSize); + PutDecodedDatumInto(v, digestName, verifierFilter); + PutDecodedDatumInto(v, "Message", verifierFilter); + verifierFilter.MessageEnd(); + if (verifierFilter.GetLastResult() == (test == "NotVerify")) + SignalTestFailure(); + } + else + { + SignalTestError(); + assert(false); + } +} + +bool GetField(std::istream &is, std::string &name, std::string &value) +{ + name.resize(0); // GCC workaround: 2.95.3 doesn't have clear() + is >> name; + if (name.empty()) + return false; + + if (name[name.size()-1] != ':') + { + char c; + is >> skipws >> c; + if (c != ':') + SignalTestError(); + } + else + name.erase(name.size()-1); + + while (is.peek() == ' ') + is.ignore(1); + + // VC60 workaround: getline bug + char buffer[128]; + value.resize(0); // GCC workaround: 2.95.3 doesn't have clear() + bool continueLine; + + do + { + do + { + is.get(buffer, sizeof(buffer)); + value += buffer; + } + while (buffer[0] != 0); + is.clear(); + is.ignore(); + + if (!value.empty() && value[value.size()-1] == '\r') + value.resize(value.size()-1); + + if (!value.empty() && value[value.size()-1] == '\\') + { + value.resize(value.size()-1); + continueLine = true; + } + else + continueLine = false; + + std::string::size_type i = value.find('#'); + if (i != std::string::npos) + value.erase(i); + } + while (continueLine); + + return true; +} + +void OutputPair(const NameValuePairs &v, const char *name) +{ + Integer x; + bool b = v.GetValue(name, x); + assert(b); + cout << name << ": \\\n "; + x.Encode(HexEncoder(new FileSink(cout), false, 64, "\\\n ").Ref(), x.MinEncodedSize()); + cout << endl; +} + +void OutputNameValuePairs(const NameValuePairs &v) +{ + std::string names = v.GetValueNames(); + string::size_type i = 0; + while (i < names.size()) + { + string::size_type j = names.find_first_of (';', i); + + if (j == string::npos) + return; + else + { + std::string name = names.substr(i, j-i); + if (name.find(':') == string::npos) + OutputPair(v, name.c_str()); + } + + i = j + 1; + } +} + +void TestDataFile(const std::string &filename, const NameValuePairs &overrideParameters, unsigned int &totalTests, unsigned int &failedTests) +{ + std::ifstream file(filename.c_str()); + if (!file.good()) + throw Exception(Exception::OTHER_ERROR, "Can not open file " + filename + " for reading"); + TestData v; + s_currentTestData = &v; + std::string name, value, lastAlgName; + + while (file) + { + while (file.peek() == '#') + file.ignore(INT_MAX, '\n'); + + if (file.peek() == '\n' || file.peek() == '\r') + v.clear(); + + if (!GetField(file, name, value)) + break; + v[name] = value; + + if (name == "Test") + { + bool failed = true; + std::string algType = GetRequiredDatum(v, "AlgorithmType"); + + if (lastAlgName != GetRequiredDatum(v, "Name")) + { + lastAlgName = GetRequiredDatum(v, "Name"); + cout << "\nTesting " << algType.c_str() << " algorithm " << lastAlgName.c_str() << ".\n"; + } + + try + { + if (algType == "Signature") + TestSignatureScheme(v); + else if (algType == "SymmetricCipher") + TestSymmetricCipher(v, overrideParameters); + else if (algType == "AuthenticatedSymmetricCipher") + TestAuthenticatedSymmetricCipher(v, overrideParameters); + else if (algType == "AsymmetricCipher") + TestAsymmetricCipher(v); + else if (algType == "MessageDigest") + TestDigestOrMAC(v, true); + else if (algType == "MAC") + TestDigestOrMAC(v, false); + else if (algType == "FileList") + TestDataFile(GetRequiredDatum(v, "Test"), g_nullNameValuePairs, totalTests, failedTests); + else + SignalTestError(); + failed = false; + } + catch (TestFailure &) + { + cout << "\nTest failed.\n"; + } + catch (CryptoPP::Exception &e) + { + cout << "\nCryptoPP::Exception caught: " << e.what() << endl; + } + catch (std::exception &e) + { + cout << "\nstd::exception caught: " << e.what() << endl; + } + + if (failed) + { + cout << "Skipping to next test.\n"; + failedTests++; + } + else + cout << "." << flush; + + totalTests++; + } + } +} + +bool RunTestDataFile(const char *filename, const NameValuePairs &overrideParameters) +{ + unsigned int totalTests = 0, failedTests = 0; + TestDataFile(filename, overrideParameters, totalTests, failedTests); + cout << "\nTests complete. Total tests = " << totalTests << ". Failed tests = " << failedTests << ".\n"; + if (failedTests != 0) + cout << "SOME TESTS FAILED!\n"; + return failedTests == 0; +} diff --git a/cryptopp/default.cpp b/cryptopp/default.cpp new file mode 100644 index 0000000..7294078 --- /dev/null +++ b/cryptopp/default.cpp @@ -0,0 +1,258 @@ +// default.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "default.h" +#include "queue.h" +#include +#include + +NAMESPACE_BEGIN(CryptoPP) + +static const unsigned int MASH_ITERATIONS = 200; +static const unsigned int SALTLENGTH = 8; +static const unsigned int BLOCKSIZE = Default_BlockCipher::Encryption::BLOCKSIZE; +static const unsigned int KEYLENGTH = Default_BlockCipher::Encryption::DEFAULT_KEYLENGTH; + +// The purpose of this function Mash() is to take an arbitrary length input +// string and *deterministicly* produce an arbitrary length output string such +// that (1) it looks random, (2) no information about the input is +// deducible from it, and (3) it contains as much entropy as it can hold, or +// the amount of entropy in the input string, whichever is smaller. + +static void Mash(const byte *in, size_t inLen, byte *out, size_t outLen, int iterations) +{ + if (BytePrecision(outLen) > 2) + throw InvalidArgument("Mash: output legnth too large"); + + size_t bufSize = RoundUpToMultipleOf(outLen, (size_t)DefaultHashModule::DIGESTSIZE); + byte b[2]; + SecByteBlock buf(bufSize); + SecByteBlock outBuf(bufSize); + DefaultHashModule hash; + + unsigned int i; + for(i=0; i> 8); + b[1] = (byte) i; + hash.Update(b, 2); + hash.Update(in, inLen); + hash.Final(outBuf+i); + } + + while (iterations-- > 1) + { + memcpy(buf, outBuf, bufSize); + for (i=0; i> 8); + b[1] = (byte) i; + hash.Update(b, 2); + hash.Update(buf, bufSize); + hash.Final(outBuf+i); + } + } + + memcpy(out, outBuf, outLen); +} + +static void GenerateKeyIV(const byte *passphrase, size_t passphraseLength, const byte *salt, size_t saltLength, byte *key, byte *IV) +{ + SecByteBlock temp(passphraseLength+saltLength); + memcpy(temp, passphrase, passphraseLength); + memcpy(temp+passphraseLength, salt, saltLength); + SecByteBlock keyIV(KEYLENGTH+BLOCKSIZE); + Mash(temp, passphraseLength + saltLength, keyIV, KEYLENGTH+BLOCKSIZE, MASH_ITERATIONS); + memcpy(key, keyIV, KEYLENGTH); + memcpy(IV, keyIV+KEYLENGTH, BLOCKSIZE); +} + +// ******************************************************** + +DefaultEncryptor::DefaultEncryptor(const char *passphrase, BufferedTransformation *attachment) + : ProxyFilter(NULL, 0, 0, attachment), m_passphrase((const byte *)passphrase, strlen(passphrase)) +{ +} + +DefaultEncryptor::DefaultEncryptor(const byte *passphrase, size_t passphraseLength, BufferedTransformation *attachment) + : ProxyFilter(NULL, 0, 0, attachment), m_passphrase(passphrase, passphraseLength) +{ +} + + +void DefaultEncryptor::FirstPut(const byte *) +{ + // VC60 workaround: __LINE__ expansion bug + CRYPTOPP_COMPILE_ASSERT_INSTANCE(SALTLENGTH <= DefaultHashModule::DIGESTSIZE, 1); + CRYPTOPP_COMPILE_ASSERT_INSTANCE(BLOCKSIZE <= DefaultHashModule::DIGESTSIZE, 2); + + SecByteBlock salt(DefaultHashModule::DIGESTSIZE), keyCheck(DefaultHashModule::DIGESTSIZE); + DefaultHashModule hash; + + // use hash(passphrase | time | clock) as salt + hash.Update(m_passphrase, m_passphrase.size()); + time_t t=time(0); + hash.Update((byte *)&t, sizeof(t)); + clock_t c=clock(); + hash.Update((byte *)&c, sizeof(c)); + hash.Final(salt); + + // use hash(passphrase | salt) as key check + hash.Update(m_passphrase, m_passphrase.size()); + hash.Update(salt, SALTLENGTH); + hash.Final(keyCheck); + + AttachedTransformation()->Put(salt, SALTLENGTH); + + // mash passphrase and salt together into key and IV + SecByteBlock key(KEYLENGTH); + SecByteBlock IV(BLOCKSIZE); + GenerateKeyIV(m_passphrase, m_passphrase.size(), salt, SALTLENGTH, key, IV); + + m_cipher.SetKeyWithIV(key, key.size(), IV); + SetFilter(new StreamTransformationFilter(m_cipher)); + + m_filter->Put(keyCheck, BLOCKSIZE); +} + +void DefaultEncryptor::LastPut(const byte *inString, size_t length) +{ + m_filter->MessageEnd(); +} + +// ******************************************************** + +DefaultDecryptor::DefaultDecryptor(const char *p, BufferedTransformation *attachment, bool throwException) + : ProxyFilter(NULL, SALTLENGTH+BLOCKSIZE, 0, attachment) + , m_state(WAITING_FOR_KEYCHECK) + , m_passphrase((const byte *)p, strlen(p)) + , m_throwException(throwException) +{ +} + +DefaultDecryptor::DefaultDecryptor(const byte *passphrase, size_t passphraseLength, BufferedTransformation *attachment, bool throwException) + : ProxyFilter(NULL, SALTLENGTH+BLOCKSIZE, 0, attachment) + , m_state(WAITING_FOR_KEYCHECK) + , m_passphrase(passphrase, passphraseLength) + , m_throwException(throwException) +{ +} + +void DefaultDecryptor::FirstPut(const byte *inString) +{ + CheckKey(inString, inString+SALTLENGTH); +} + +void DefaultDecryptor::LastPut(const byte *inString, size_t length) +{ + if (m_filter.get() == NULL) + { + m_state = KEY_BAD; + if (m_throwException) + throw KeyBadErr(); + } + else + { + m_filter->MessageEnd(); + m_state = WAITING_FOR_KEYCHECK; + } +} + +void DefaultDecryptor::CheckKey(const byte *salt, const byte *keyCheck) +{ + SecByteBlock check(STDMAX((unsigned int)2*BLOCKSIZE, (unsigned int)DefaultHashModule::DIGESTSIZE)); + + DefaultHashModule hash; + hash.Update(m_passphrase, m_passphrase.size()); + hash.Update(salt, SALTLENGTH); + hash.Final(check); + + SecByteBlock key(KEYLENGTH); + SecByteBlock IV(BLOCKSIZE); + GenerateKeyIV(m_passphrase, m_passphrase.size(), salt, SALTLENGTH, key, IV); + + m_cipher.SetKeyWithIV(key, key.size(), IV); + std::auto_ptr decryptor(new StreamTransformationFilter(m_cipher)); + + decryptor->Put(keyCheck, BLOCKSIZE); + decryptor->ForceNextPut(); + decryptor->Get(check+BLOCKSIZE, BLOCKSIZE); + + SetFilter(decryptor.release()); + + if (!VerifyBufsEqual(check, check+BLOCKSIZE, BLOCKSIZE)) + { + m_state = KEY_BAD; + if (m_throwException) + throw KeyBadErr(); + } + else + m_state = KEY_GOOD; +} + +// ******************************************************** + +static DefaultMAC * NewDefaultEncryptorMAC(const byte *passphrase, size_t passphraseLength) +{ + size_t macKeyLength = DefaultMAC::StaticGetValidKeyLength(16); + SecByteBlock macKey(macKeyLength); + // since the MAC is encrypted there is no reason to mash the passphrase for many iterations + Mash(passphrase, passphraseLength, macKey, macKeyLength, 1); + return new DefaultMAC(macKey, macKeyLength); +} + +DefaultEncryptorWithMAC::DefaultEncryptorWithMAC(const char *passphrase, BufferedTransformation *attachment) + : ProxyFilter(NULL, 0, 0, attachment) + , m_mac(NewDefaultEncryptorMAC((const byte *)passphrase, strlen(passphrase))) +{ + SetFilter(new HashFilter(*m_mac, new DefaultEncryptor(passphrase), true)); +} + +DefaultEncryptorWithMAC::DefaultEncryptorWithMAC(const byte *passphrase, size_t passphraseLength, BufferedTransformation *attachment) + : ProxyFilter(NULL, 0, 0, attachment) + , m_mac(NewDefaultEncryptorMAC(passphrase, passphraseLength)) +{ + SetFilter(new HashFilter(*m_mac, new DefaultEncryptor(passphrase, passphraseLength), true)); +} + +void DefaultEncryptorWithMAC::LastPut(const byte *inString, size_t length) +{ + m_filter->MessageEnd(); +} + +// ******************************************************** + +DefaultDecryptorWithMAC::DefaultDecryptorWithMAC(const char *passphrase, BufferedTransformation *attachment, bool throwException) + : ProxyFilter(NULL, 0, 0, attachment) + , m_mac(NewDefaultEncryptorMAC((const byte *)passphrase, strlen(passphrase))) + , m_throwException(throwException) +{ + SetFilter(new DefaultDecryptor(passphrase, m_hashVerifier=new HashVerifier(*m_mac, NULL, HashVerifier::PUT_MESSAGE), throwException)); +} + +DefaultDecryptorWithMAC::DefaultDecryptorWithMAC(const byte *passphrase, size_t passphraseLength, BufferedTransformation *attachment, bool throwException) + : ProxyFilter(NULL, 0, 0, attachment) + , m_mac(NewDefaultEncryptorMAC(passphrase, passphraseLength)) + , m_throwException(throwException) +{ + SetFilter(new DefaultDecryptor(passphrase, passphraseLength, m_hashVerifier=new HashVerifier(*m_mac, NULL, HashVerifier::PUT_MESSAGE), throwException)); +} + +DefaultDecryptor::State DefaultDecryptorWithMAC::CurrentState() const +{ + return static_cast(m_filter.get())->CurrentState(); +} + +bool DefaultDecryptorWithMAC::CheckLastMAC() const +{ + return m_hashVerifier->GetLastResult(); +} + +void DefaultDecryptorWithMAC::LastPut(const byte *inString, size_t length) +{ + m_filter->MessageEnd(); + if (m_throwException && !CheckLastMAC()) + throw MACBadErr(); +} + +NAMESPACE_END diff --git a/cryptopp/default.h b/cryptopp/default.h new file mode 100644 index 0000000..fb53641 --- /dev/null +++ b/cryptopp/default.h @@ -0,0 +1,104 @@ +#ifndef CRYPTOPP_DEFAULT_H +#define CRYPTOPP_DEFAULT_H + +#include "sha.h" +#include "hmac.h" +#include "des.h" +#include "filters.h" +#include "modes.h" + +NAMESPACE_BEGIN(CryptoPP) + +typedef DES_EDE2 Default_BlockCipher; +typedef SHA DefaultHashModule; +typedef HMAC DefaultMAC; + +//! Password-Based Encryptor using DES-EDE2 +class DefaultEncryptor : public ProxyFilter +{ +public: + DefaultEncryptor(const char *passphrase, BufferedTransformation *attachment = NULL); + DefaultEncryptor(const byte *passphrase, size_t passphraseLength, BufferedTransformation *attachment = NULL); + +protected: + void FirstPut(const byte *); + void LastPut(const byte *inString, size_t length); + +private: + SecByteBlock m_passphrase; + CBC_Mode::Encryption m_cipher; +}; + +//! Password-Based Decryptor using DES-EDE2 +class DefaultDecryptor : public ProxyFilter +{ +public: + DefaultDecryptor(const char *passphrase, BufferedTransformation *attachment = NULL, bool throwException=true); + DefaultDecryptor(const byte *passphrase, size_t passphraseLength, BufferedTransformation *attachment = NULL, bool throwException=true); + + class Err : public Exception + { + public: + Err(const std::string &s) + : Exception(DATA_INTEGRITY_CHECK_FAILED, s) {} + }; + class KeyBadErr : public Err {public: KeyBadErr() : Err("DefaultDecryptor: cannot decrypt message with this passphrase") {}}; + + enum State {WAITING_FOR_KEYCHECK, KEY_GOOD, KEY_BAD}; + State CurrentState() const {return m_state;} + +protected: + void FirstPut(const byte *inString); + void LastPut(const byte *inString, size_t length); + + State m_state; + +private: + void CheckKey(const byte *salt, const byte *keyCheck); + + SecByteBlock m_passphrase; + CBC_Mode::Decryption m_cipher; + member_ptr m_decryptor; + bool m_throwException; +}; + +//! Password-Based Encryptor using DES-EDE2 and HMAC/SHA-1 +class DefaultEncryptorWithMAC : public ProxyFilter +{ +public: + DefaultEncryptorWithMAC(const char *passphrase, BufferedTransformation *attachment = NULL); + DefaultEncryptorWithMAC(const byte *passphrase, size_t passphraseLength, BufferedTransformation *attachment = NULL); + +protected: + void FirstPut(const byte *inString) {} + void LastPut(const byte *inString, size_t length); + +private: + member_ptr m_mac; +}; + +//! Password-Based Decryptor using DES-EDE2 and HMAC/SHA-1 +class DefaultDecryptorWithMAC : public ProxyFilter +{ +public: + class MACBadErr : public DefaultDecryptor::Err {public: MACBadErr() : DefaultDecryptor::Err("DefaultDecryptorWithMAC: MAC check failed") {}}; + + DefaultDecryptorWithMAC(const char *passphrase, BufferedTransformation *attachment = NULL, bool throwException=true); + DefaultDecryptorWithMAC(const byte *passphrase, size_t passphraseLength, BufferedTransformation *attachment = NULL, bool throwException=true); + + DefaultDecryptor::State CurrentState() const; + bool CheckLastMAC() const; + +protected: + void FirstPut(const byte *inString) {} + void LastPut(const byte *inString, size_t length); + +private: + member_ptr m_mac; + HashVerifier *m_hashVerifier; + bool m_throwException; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/des.cpp b/cryptopp/des.cpp new file mode 100644 index 0000000..a6e0c51 --- /dev/null +++ b/cryptopp/des.cpp @@ -0,0 +1,449 @@ +// des.cpp - modified by Wei Dai from Phil Karn's des.c +// The original code and all modifications are in the public domain. + +/* + * This is a major rewrite of my old public domain DES code written + * circa 1987, which in turn borrowed heavily from Jim Gillogly's 1977 + * public domain code. I pretty much kept my key scheduling code, but + * the actual encrypt/decrypt routines are taken from from Richard + * Outerbridge's DES code as printed in Schneier's "Applied Cryptography." + * + * This code is in the public domain. I would appreciate bug reports and + * enhancements. + * + * Phil Karn KA9Q, karn@unix.ka9q.ampr.org, August 1994. + */ + +#include "pch.h" +#include "misc.h" +#include "des.h" + +NAMESPACE_BEGIN(CryptoPP) + +typedef BlockGetAndPut Block; + +// Richard Outerbridge's initial permutation algorithm +/* +inline void IPERM(word32 &left, word32 &right) +{ + word32 work; + + work = ((left >> 4) ^ right) & 0x0f0f0f0f; + right ^= work; + left ^= work << 4; + work = ((left >> 16) ^ right) & 0xffff; + right ^= work; + left ^= work << 16; + work = ((right >> 2) ^ left) & 0x33333333; + left ^= work; + right ^= (work << 2); + work = ((right >> 8) ^ left) & 0xff00ff; + left ^= work; + right ^= (work << 8); + right = rotl(right, 1); + work = (left ^ right) & 0xaaaaaaaa; + left ^= work; + right ^= work; + left = rotl(left, 1); +} +inline void FPERM(word32 &left, word32 &right) +{ + word32 work; + + right = rotr(right, 1); + work = (left ^ right) & 0xaaaaaaaa; + left ^= work; + right ^= work; + left = rotr(left, 1); + work = ((left >> 8) ^ right) & 0xff00ff; + right ^= work; + left ^= work << 8; + work = ((left >> 2) ^ right) & 0x33333333; + right ^= work; + left ^= work << 2; + work = ((right >> 16) ^ left) & 0xffff; + left ^= work; + right ^= work << 16; + work = ((right >> 4) ^ left) & 0x0f0f0f0f; + left ^= work; + right ^= work << 4; +} +*/ + +// Wei Dai's modification to Richard Outerbridge's initial permutation +// algorithm, this one is faster if you have access to rotate instructions +// (like in MSVC) +static inline void IPERM(word32 &left, word32 &right) +{ + word32 work; + + right = rotlFixed(right, 4U); + work = (left ^ right) & 0xf0f0f0f0; + left ^= work; + right = rotrFixed(right^work, 20U); + work = (left ^ right) & 0xffff0000; + left ^= work; + right = rotrFixed(right^work, 18U); + work = (left ^ right) & 0x33333333; + left ^= work; + right = rotrFixed(right^work, 6U); + work = (left ^ right) & 0x00ff00ff; + left ^= work; + right = rotlFixed(right^work, 9U); + work = (left ^ right) & 0xaaaaaaaa; + left = rotlFixed(left^work, 1U); + right ^= work; +} + +static inline void FPERM(word32 &left, word32 &right) +{ + word32 work; + + right = rotrFixed(right, 1U); + work = (left ^ right) & 0xaaaaaaaa; + right ^= work; + left = rotrFixed(left^work, 9U); + work = (left ^ right) & 0x00ff00ff; + right ^= work; + left = rotlFixed(left^work, 6U); + work = (left ^ right) & 0x33333333; + right ^= work; + left = rotlFixed(left^work, 18U); + work = (left ^ right) & 0xffff0000; + right ^= work; + left = rotlFixed(left^work, 20U); + work = (left ^ right) & 0xf0f0f0f0; + right ^= work; + left = rotrFixed(left^work, 4U); +} + +void DES::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &) +{ + AssertValidKeyLength(length); + + RawSetKey(GetCipherDirection(), userKey); +} + +#ifndef CRYPTOPP_IMPORTS + +/* Tables defined in the Data Encryption Standard documents + * Three of these tables, the initial permutation, the final + * permutation and the expansion operator, are regular enough that + * for speed, we hard-code them. They're here for reference only. + * Also, the S and P boxes are used by a separate program, gensp.c, + * to build the combined SP box, Spbox[]. They're also here just + * for reference. + */ +#ifdef notdef +/* initial permutation IP */ +static byte ip[] = { + 58, 50, 42, 34, 26, 18, 10, 2, + 60, 52, 44, 36, 28, 20, 12, 4, + 62, 54, 46, 38, 30, 22, 14, 6, + 64, 56, 48, 40, 32, 24, 16, 8, + 57, 49, 41, 33, 25, 17, 9, 1, + 59, 51, 43, 35, 27, 19, 11, 3, + 61, 53, 45, 37, 29, 21, 13, 5, + 63, 55, 47, 39, 31, 23, 15, 7 +}; + +/* final permutation IP^-1 */ +static byte fp[] = { + 40, 8, 48, 16, 56, 24, 64, 32, + 39, 7, 47, 15, 55, 23, 63, 31, + 38, 6, 46, 14, 54, 22, 62, 30, + 37, 5, 45, 13, 53, 21, 61, 29, + 36, 4, 44, 12, 52, 20, 60, 28, + 35, 3, 43, 11, 51, 19, 59, 27, + 34, 2, 42, 10, 50, 18, 58, 26, + 33, 1, 41, 9, 49, 17, 57, 25 +}; +/* expansion operation matrix */ +static byte ei[] = { + 32, 1, 2, 3, 4, 5, + 4, 5, 6, 7, 8, 9, + 8, 9, 10, 11, 12, 13, + 12, 13, 14, 15, 16, 17, + 16, 17, 18, 19, 20, 21, + 20, 21, 22, 23, 24, 25, + 24, 25, 26, 27, 28, 29, + 28, 29, 30, 31, 32, 1 +}; +/* The (in)famous S-boxes */ +static byte sbox[8][64] = { + /* S1 */ + 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, + 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, + 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, + 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13, + + /* S2 */ + 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, + 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, + 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, + 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9, + + /* S3 */ + 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, + 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, + 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, + 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12, + + /* S4 */ + 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, + 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, + 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, + 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14, + + /* S5 */ + 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, + 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, + 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, + 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3, + + /* S6 */ + 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, + 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, + 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, + 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13, + + /* S7 */ + 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, + 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, + 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, + 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12, + + /* S8 */ + 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, + 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, + 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, + 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 +}; + +/* 32-bit permutation function P used on the output of the S-boxes */ +static byte p32i[] = { + 16, 7, 20, 21, + 29, 12, 28, 17, + 1, 15, 23, 26, + 5, 18, 31, 10, + 2, 8, 24, 14, + 32, 27, 3, 9, + 19, 13, 30, 6, + 22, 11, 4, 25 +}; +#endif + +/* permuted choice table (key) */ +static const byte pc1[] = { + 57, 49, 41, 33, 25, 17, 9, + 1, 58, 50, 42, 34, 26, 18, + 10, 2, 59, 51, 43, 35, 27, + 19, 11, 3, 60, 52, 44, 36, + + 63, 55, 47, 39, 31, 23, 15, + 7, 62, 54, 46, 38, 30, 22, + 14, 6, 61, 53, 45, 37, 29, + 21, 13, 5, 28, 20, 12, 4 +}; + +/* number left rotations of pc1 */ +static const byte totrot[] = { + 1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 +}; + +/* permuted choice key (table) */ +static const byte pc2[] = { + 14, 17, 11, 24, 1, 5, + 3, 28, 15, 6, 21, 10, + 23, 19, 12, 4, 26, 8, + 16, 7, 27, 20, 13, 2, + 41, 52, 31, 37, 47, 55, + 30, 40, 51, 45, 33, 48, + 44, 49, 39, 56, 34, 53, + 46, 42, 50, 36, 29, 32 +}; + +/* End of DES-defined tables */ + +/* bit 0 is left-most in byte */ +static const int bytebit[] = { + 0200,0100,040,020,010,04,02,01 +}; + +/* Set key (initialize key schedule array) */ +void RawDES::RawSetKey(CipherDir dir, const byte *key) +{ + SecByteBlock buffer(56+56+8); + byte *const pc1m=buffer; /* place to modify pc1 into */ + byte *const pcr=pc1m+56; /* place to rotate pc1 into */ + byte *const ks=pcr+56; + register int i,j,l; + int m; + + for (j=0; j<56; j++) { /* convert pc1 to bits of key */ + l=pc1[j]-1; /* integer bit location */ + m = l & 07; /* find bit */ + pc1m[j]=(key[l>>3] & /* find which key byte l is in */ + bytebit[m]) /* and which bit of that byte */ + ? 1 : 0; /* and store 1-bit result */ + } + for (i=0; i<16; i++) { /* key chunk for each iteration */ + memset(ks,0,8); /* Clear key schedule */ + for (j=0; j<56; j++) /* rotate pc1 the right amount */ + pcr[j] = pc1m[(l=j+totrot[i])<(j<28? 28 : 56) ? l: l-28]; + /* rotate left and right halves independently */ + for (j=0; j<48; j++){ /* select bits individually */ + /* check bit that goes to ks[j] */ + if (pcr[pc2[j]-1]){ + /* mask it in if it's there */ + l= j % 6; + ks[j/6] |= bytebit[l] >> 2; + } + } + /* Now convert to odd/even interleaved form for use in F */ + k[2*i] = ((word32)ks[0] << 24) + | ((word32)ks[2] << 16) + | ((word32)ks[4] << 8) + | ((word32)ks[6]); + k[2*i+1] = ((word32)ks[1] << 24) + | ((word32)ks[3] << 16) + | ((word32)ks[5] << 8) + | ((word32)ks[7]); + } + + if (dir==DECRYPTION) // reverse key schedule order + for (i=0; i<16; i+=2) + { + std::swap(k[i], k[32-2-i]); + std::swap(k[i+1], k[32-1-i]); + } +} + +void RawDES::RawProcessBlock(word32 &l_, word32 &r_) const +{ + word32 l = l_, r = r_; + const word32 *kptr=k; + + for (unsigned i=0; i<8; i++) + { + word32 work = rotrFixed(r, 4U) ^ kptr[4*i+0]; + l ^= Spbox[6][(work) & 0x3f] + ^ Spbox[4][(work >> 8) & 0x3f] + ^ Spbox[2][(work >> 16) & 0x3f] + ^ Spbox[0][(work >> 24) & 0x3f]; + work = r ^ kptr[4*i+1]; + l ^= Spbox[7][(work) & 0x3f] + ^ Spbox[5][(work >> 8) & 0x3f] + ^ Spbox[3][(work >> 16) & 0x3f] + ^ Spbox[1][(work >> 24) & 0x3f]; + + work = rotrFixed(l, 4U) ^ kptr[4*i+2]; + r ^= Spbox[6][(work) & 0x3f] + ^ Spbox[4][(work >> 8) & 0x3f] + ^ Spbox[2][(work >> 16) & 0x3f] + ^ Spbox[0][(work >> 24) & 0x3f]; + work = l ^ kptr[4*i+3]; + r ^= Spbox[7][(work) & 0x3f] + ^ Spbox[5][(work >> 8) & 0x3f] + ^ Spbox[3][(work >> 16) & 0x3f] + ^ Spbox[1][(work >> 24) & 0x3f]; + } + + l_ = l; r_ = r; +} + +void DES_EDE2::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &) +{ + AssertValidKeyLength(length); + + m_des1.RawSetKey(GetCipherDirection(), userKey); + m_des2.RawSetKey(ReverseCipherDir(GetCipherDirection()), userKey+8); +} + +void DES_EDE2::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 l,r; + Block::Get(inBlock)(l)(r); + IPERM(l,r); + m_des1.RawProcessBlock(l, r); + m_des2.RawProcessBlock(r, l); + m_des1.RawProcessBlock(l, r); + FPERM(l,r); + Block::Put(xorBlock, outBlock)(r)(l); +} + +void DES_EDE3::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &) +{ + AssertValidKeyLength(length); + + m_des1.RawSetKey(GetCipherDirection(), userKey + (IsForwardTransformation() ? 0 : 16)); + m_des2.RawSetKey(ReverseCipherDir(GetCipherDirection()), userKey + 8); + m_des3.RawSetKey(GetCipherDirection(), userKey + (IsForwardTransformation() ? 16 : 0)); +} + +void DES_EDE3::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 l,r; + Block::Get(inBlock)(l)(r); + IPERM(l,r); + m_des1.RawProcessBlock(l, r); + m_des2.RawProcessBlock(r, l); + m_des3.RawProcessBlock(l, r); + FPERM(l,r); + Block::Put(xorBlock, outBlock)(r)(l); +} + +#endif // #ifndef CRYPTOPP_IMPORTS + +static inline bool CheckParity(byte b) +{ + unsigned int a = b ^ (b >> 4); + return ((a ^ (a>>1) ^ (a>>2) ^ (a>>3)) & 1) == 1; +} + +bool DES::CheckKeyParityBits(const byte *key) +{ + for (unsigned int i=0; i<8; i++) + if (!CheckParity(key[i])) + return false; + return true; +} + +void DES::CorrectKeyParityBits(byte *key) +{ + for (unsigned int i=0; i<8; i++) + if (!CheckParity(key[i])) + key[i] ^= 1; +} + +// Encrypt or decrypt a block of data in ECB mode +void DES::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 l,r; + Block::Get(inBlock)(l)(r); + IPERM(l,r); + RawProcessBlock(l, r); + FPERM(l,r); + Block::Put(xorBlock, outBlock)(r)(l); +} + +void DES_XEX3::Base::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &) +{ + AssertValidKeyLength(length); + + if (!m_des.get()) + m_des.reset(new DES::Encryption); + + memcpy(m_x1, key + (IsForwardTransformation() ? 0 : 16), BLOCKSIZE); + m_des->RawSetKey(GetCipherDirection(), key + 8); + memcpy(m_x3, key + (IsForwardTransformation() ? 16 : 0), BLOCKSIZE); +} + +void DES_XEX3::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + xorbuf(outBlock, inBlock, m_x1, BLOCKSIZE); + m_des->ProcessAndXorBlock(outBlock, xorBlock, outBlock); + xorbuf(outBlock, m_x3, BLOCKSIZE); +} + +NAMESPACE_END diff --git a/cryptopp/des.h b/cryptopp/des.h new file mode 100644 index 0000000..62f6288 --- /dev/null +++ b/cryptopp/des.h @@ -0,0 +1,144 @@ +#ifndef CRYPTOPP_DES_H +#define CRYPTOPP_DES_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +class CRYPTOPP_DLL RawDES +{ +public: + void RawSetKey(CipherDir direction, const byte *userKey); + void RawProcessBlock(word32 &l, word32 &r) const; + +protected: + static const word32 Spbox[8][64]; + + FixedSizeSecBlock k; +}; + +//! _ +struct DES_Info : public FixedBlockSize<8>, public FixedKeyLength<8> +{ + // disable DES in DLL version by not exporting this function + static const char * StaticAlgorithmName() {return "DES";} +}; + +/// DES +/*! The DES implementation in Crypto++ ignores the parity bits + (the least significant bits of each byte) in the key. However + you can use CheckKeyParityBits() and CorrectKeyParityBits() to + check or correct the parity bits if you wish. */ +class DES : public DES_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public RawDES + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + //! check DES key parity bits + static bool CheckKeyParityBits(const byte *key); + //! correct DES key parity bits + static void CorrectKeyParityBits(byte *key); + + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +//! _ +struct DES_EDE2_Info : public FixedBlockSize<8>, public FixedKeyLength<16> +{ + CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "DES-EDE2";} +}; + +/// DES-EDE2 +class DES_EDE2 : public DES_EDE2_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + + protected: + RawDES m_des1, m_des2; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +//! _ +struct DES_EDE3_Info : public FixedBlockSize<8>, public FixedKeyLength<24> +{ + CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "DES-EDE3";} +}; + +/// DES-EDE3 +class DES_EDE3 : public DES_EDE3_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + + protected: + RawDES m_des1, m_des2, m_des3; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +//! _ +struct DES_XEX3_Info : public FixedBlockSize<8>, public FixedKeyLength<24> +{ + static const char *StaticAlgorithmName() {return "DES-XEX3";} +}; + +/// DES-XEX3, AKA DESX +class DES_XEX3 : public DES_XEX3_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + + protected: + FixedSizeSecBlock m_x1, m_x3; + // VS2005 workaround: calling modules compiled with /clr gets unresolved external symbol DES::Base::ProcessAndXorBlock + // if we use DES::Encryption here directly without value_ptr. + value_ptr m_des; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef DES::Encryption DESEncryption; +typedef DES::Decryption DESDecryption; + +typedef DES_EDE2::Encryption DES_EDE2_Encryption; +typedef DES_EDE2::Decryption DES_EDE2_Decryption; + +typedef DES_EDE3::Encryption DES_EDE3_Encryption; +typedef DES_EDE3::Decryption DES_EDE3_Decryption; + +typedef DES_XEX3::Encryption DES_XEX3_Encryption; +typedef DES_XEX3::Decryption DES_XEX3_Decryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/dessp.cpp b/cryptopp/dessp.cpp new file mode 100644 index 0000000..49ed1d2 --- /dev/null +++ b/cryptopp/dessp.cpp @@ -0,0 +1,95 @@ +// This file is mostly generated by Phil Karn's gensp.c + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "des.h" + +NAMESPACE_BEGIN(CryptoPP) + +// VC60 workaround: gives a C4786 warning without this function +// when runtime lib is set to multithread debug DLL +// even though warning 4786 is disabled! +void DES_VC60Workaround() +{ +} + +const word32 RawDES::Spbox[8][64] = { +{ +0x01010400,0x00000000,0x00010000,0x01010404, 0x01010004,0x00010404,0x00000004,0x00010000, +0x00000400,0x01010400,0x01010404,0x00000400, 0x01000404,0x01010004,0x01000000,0x00000004, +0x00000404,0x01000400,0x01000400,0x00010400, 0x00010400,0x01010000,0x01010000,0x01000404, +0x00010004,0x01000004,0x01000004,0x00010004, 0x00000000,0x00000404,0x00010404,0x01000000, +0x00010000,0x01010404,0x00000004,0x01010000, 0x01010400,0x01000000,0x01000000,0x00000400, +0x01010004,0x00010000,0x00010400,0x01000004, 0x00000400,0x00000004,0x01000404,0x00010404, +0x01010404,0x00010004,0x01010000,0x01000404, 0x01000004,0x00000404,0x00010404,0x01010400, +0x00000404,0x01000400,0x01000400,0x00000000, 0x00010004,0x00010400,0x00000000,0x01010004}, +{ +0x80108020,0x80008000,0x00008000,0x00108020, 0x00100000,0x00000020,0x80100020,0x80008020, +0x80000020,0x80108020,0x80108000,0x80000000, 0x80008000,0x00100000,0x00000020,0x80100020, +0x00108000,0x00100020,0x80008020,0x00000000, 0x80000000,0x00008000,0x00108020,0x80100000, +0x00100020,0x80000020,0x00000000,0x00108000, 0x00008020,0x80108000,0x80100000,0x00008020, +0x00000000,0x00108020,0x80100020,0x00100000, 0x80008020,0x80100000,0x80108000,0x00008000, +0x80100000,0x80008000,0x00000020,0x80108020, 0x00108020,0x00000020,0x00008000,0x80000000, +0x00008020,0x80108000,0x00100000,0x80000020, 0x00100020,0x80008020,0x80000020,0x00100020, +0x00108000,0x00000000,0x80008000,0x00008020, 0x80000000,0x80100020,0x80108020,0x00108000}, +{ +0x00000208,0x08020200,0x00000000,0x08020008, 0x08000200,0x00000000,0x00020208,0x08000200, +0x00020008,0x08000008,0x08000008,0x00020000, 0x08020208,0x00020008,0x08020000,0x00000208, +0x08000000,0x00000008,0x08020200,0x00000200, 0x00020200,0x08020000,0x08020008,0x00020208, +0x08000208,0x00020200,0x00020000,0x08000208, 0x00000008,0x08020208,0x00000200,0x08000000, +0x08020200,0x08000000,0x00020008,0x00000208, 0x00020000,0x08020200,0x08000200,0x00000000, +0x00000200,0x00020008,0x08020208,0x08000200, 0x08000008,0x00000200,0x00000000,0x08020008, +0x08000208,0x00020000,0x08000000,0x08020208, 0x00000008,0x00020208,0x00020200,0x08000008, +0x08020000,0x08000208,0x00000208,0x08020000, 0x00020208,0x00000008,0x08020008,0x00020200}, +{ +0x00802001,0x00002081,0x00002081,0x00000080, 0x00802080,0x00800081,0x00800001,0x00002001, +0x00000000,0x00802000,0x00802000,0x00802081, 0x00000081,0x00000000,0x00800080,0x00800001, +0x00000001,0x00002000,0x00800000,0x00802001, 0x00000080,0x00800000,0x00002001,0x00002080, +0x00800081,0x00000001,0x00002080,0x00800080, 0x00002000,0x00802080,0x00802081,0x00000081, +0x00800080,0x00800001,0x00802000,0x00802081, 0x00000081,0x00000000,0x00000000,0x00802000, +0x00002080,0x00800080,0x00800081,0x00000001, 0x00802001,0x00002081,0x00002081,0x00000080, +0x00802081,0x00000081,0x00000001,0x00002000, 0x00800001,0x00002001,0x00802080,0x00800081, +0x00002001,0x00002080,0x00800000,0x00802001, 0x00000080,0x00800000,0x00002000,0x00802080}, +{ +0x00000100,0x02080100,0x02080000,0x42000100, 0x00080000,0x00000100,0x40000000,0x02080000, +0x40080100,0x00080000,0x02000100,0x40080100, 0x42000100,0x42080000,0x00080100,0x40000000, +0x02000000,0x40080000,0x40080000,0x00000000, 0x40000100,0x42080100,0x42080100,0x02000100, +0x42080000,0x40000100,0x00000000,0x42000000, 0x02080100,0x02000000,0x42000000,0x00080100, +0x00080000,0x42000100,0x00000100,0x02000000, 0x40000000,0x02080000,0x42000100,0x40080100, +0x02000100,0x40000000,0x42080000,0x02080100, 0x40080100,0x00000100,0x02000000,0x42080000, +0x42080100,0x00080100,0x42000000,0x42080100, 0x02080000,0x00000000,0x40080000,0x42000000, +0x00080100,0x02000100,0x40000100,0x00080000, 0x00000000,0x40080000,0x02080100,0x40000100}, +{ +0x20000010,0x20400000,0x00004000,0x20404010, 0x20400000,0x00000010,0x20404010,0x00400000, +0x20004000,0x00404010,0x00400000,0x20000010, 0x00400010,0x20004000,0x20000000,0x00004010, +0x00000000,0x00400010,0x20004010,0x00004000, 0x00404000,0x20004010,0x00000010,0x20400010, +0x20400010,0x00000000,0x00404010,0x20404000, 0x00004010,0x00404000,0x20404000,0x20000000, +0x20004000,0x00000010,0x20400010,0x00404000, 0x20404010,0x00400000,0x00004010,0x20000010, +0x00400000,0x20004000,0x20000000,0x00004010, 0x20000010,0x20404010,0x00404000,0x20400000, +0x00404010,0x20404000,0x00000000,0x20400010, 0x00000010,0x00004000,0x20400000,0x00404010, +0x00004000,0x00400010,0x20004010,0x00000000, 0x20404000,0x20000000,0x00400010,0x20004010}, +{ +0x00200000,0x04200002,0x04000802,0x00000000, 0x00000800,0x04000802,0x00200802,0x04200800, +0x04200802,0x00200000,0x00000000,0x04000002, 0x00000002,0x04000000,0x04200002,0x00000802, +0x04000800,0x00200802,0x00200002,0x04000800, 0x04000002,0x04200000,0x04200800,0x00200002, +0x04200000,0x00000800,0x00000802,0x04200802, 0x00200800,0x00000002,0x04000000,0x00200800, +0x04000000,0x00200800,0x00200000,0x04000802, 0x04000802,0x04200002,0x04200002,0x00000002, +0x00200002,0x04000000,0x04000800,0x00200000, 0x04200800,0x00000802,0x00200802,0x04200800, +0x00000802,0x04000002,0x04200802,0x04200000, 0x00200800,0x00000000,0x00000002,0x04200802, +0x00000000,0x00200802,0x04200000,0x00000800, 0x04000002,0x04000800,0x00000800,0x00200002}, +{ +0x10001040,0x00001000,0x00040000,0x10041040, 0x10000000,0x10001040,0x00000040,0x10000000, +0x00040040,0x10040000,0x10041040,0x00041000, 0x10041000,0x00041040,0x00001000,0x00000040, +0x10040000,0x10000040,0x10001000,0x00001040, 0x00041000,0x00040040,0x10040040,0x10041000, +0x00001040,0x00000000,0x00000000,0x10040040, 0x10000040,0x10001000,0x00041040,0x00040000, +0x00041040,0x00040000,0x10041000,0x00001000, 0x00000040,0x10040040,0x00001000,0x00041040, +0x10001000,0x00000040,0x10000040,0x10040000, 0x10040040,0x10000000,0x00040000,0x10001040, +0x00000000,0x10041040,0x00040040,0x10000040, 0x10040000,0x10001000,0x10001040,0x00000000, +0x10041040,0x00041000,0x00041000,0x00001040, 0x00001040,0x00040040,0x10000000,0x10041000} +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/dh.cpp b/cryptopp/dh.cpp new file mode 100644 index 0000000..22097a0 --- /dev/null +++ b/cryptopp/dh.cpp @@ -0,0 +1,19 @@ +// dh.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "dh.h" + +NAMESPACE_BEGIN(CryptoPP) + +void DH_TestInstantiations() +{ + DH dh1; + DH dh2(NullRNG(), 10); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/dh.h b/cryptopp/dh.h new file mode 100644 index 0000000..10e8d14 --- /dev/null +++ b/cryptopp/dh.h @@ -0,0 +1,99 @@ +#ifndef CRYPTOPP_DH_H +#define CRYPTOPP_DH_H + +/** \file +*/ + +#include "gfpcrypt.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! , +template +class DH_Domain : public DL_SimpleKeyAgreementDomainBase +{ + typedef DL_SimpleKeyAgreementDomainBase Base; + +public: + typedef GROUP_PARAMETERS GroupParameters; + typedef typename GroupParameters::Element Element; + typedef DL_KeyAgreementAlgorithm_DH DH_Algorithm; + typedef DH_Domain Domain; + + DH_Domain() {} + + DH_Domain(const GroupParameters ¶ms) + : m_groupParameters(params) {} + + DH_Domain(BufferedTransformation &bt) + {m_groupParameters.BERDecode(bt);} + + template + DH_Domain(RandomNumberGenerator &v1, const T2 &v2) + {m_groupParameters.Initialize(v1, v2);} + + template + DH_Domain(RandomNumberGenerator &v1, const T2 &v2, const T3 &v3) + {m_groupParameters.Initialize(v1, v2, v3);} + + template + DH_Domain(RandomNumberGenerator &v1, const T2 &v2, const T3 &v3, const T4 &v4) + {m_groupParameters.Initialize(v1, v2, v3, v4);} + + template + DH_Domain(const T1 &v1, const T2 &v2) + {m_groupParameters.Initialize(v1, v2);} + + template + DH_Domain(const T1 &v1, const T2 &v2, const T3 &v3) + {m_groupParameters.Initialize(v1, v2, v3);} + + template + DH_Domain(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4) + {m_groupParameters.Initialize(v1, v2, v3, v4);} + + const GroupParameters & GetGroupParameters() const {return m_groupParameters;} + GroupParameters & AccessGroupParameters() {return m_groupParameters;} + + void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const + { + Base::GeneratePublicKey(rng, privateKey, publicKey); + + if (FIPS_140_2_ComplianceEnabled()) + { + SecByteBlock privateKey2(this->PrivateKeyLength()); + this->GeneratePrivateKey(rng, privateKey2); + + SecByteBlock publicKey2(this->PublicKeyLength()); + Base::GeneratePublicKey(rng, privateKey2, publicKey2); + + SecByteBlock agreedValue(this->AgreedValueLength()), agreedValue2(this->AgreedValueLength()); + bool agreed1 = this->Agree(agreedValue, privateKey, publicKey2); + bool agreed2 = this->Agree(agreedValue2, privateKey2, publicKey); + + if (!agreed1 || !agreed2 || agreedValue != agreedValue2) + throw SelfTestFailure(this->AlgorithmName() + ": pairwise consistency test failed"); + } + } + + static std::string CRYPTOPP_API StaticAlgorithmName() + {return GroupParameters::StaticAlgorithmNamePrefix() + DH_Algorithm::StaticAlgorithmName();} + std::string AlgorithmName() const {return StaticAlgorithmName();} + +private: + const DL_KeyAgreementAlgorithm & GetKeyAgreementAlgorithm() const + {return Singleton().Ref();} + DL_GroupParameters & AccessAbstractGroupParameters() + {return m_groupParameters;} + + GroupParameters m_groupParameters; +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS DH_Domain; + +//! Diffie-Hellman in GF(p) with key validation +typedef DH_Domain DH; + +NAMESPACE_END + +#endif diff --git a/cryptopp/dh2.cpp b/cryptopp/dh2.cpp new file mode 100644 index 0000000..98175ee --- /dev/null +++ b/cryptopp/dh2.cpp @@ -0,0 +1,22 @@ +// dh2.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "dh2.h" + +NAMESPACE_BEGIN(CryptoPP) + +void DH2_TestInstantiations() +{ + DH2 dh(*(SimpleKeyAgreementDomain*)NULL); +} + +bool DH2::Agree(byte *agreedValue, + const byte *staticSecretKey, const byte *ephemeralSecretKey, + const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, + bool validateStaticOtherPublicKey) const +{ + return d1.Agree(agreedValue, staticSecretKey, staticOtherPublicKey, validateStaticOtherPublicKey) + && d2.Agree(agreedValue+d1.AgreedValueLength(), ephemeralSecretKey, ephemeralOtherPublicKey, true); +} + +NAMESPACE_END diff --git a/cryptopp/dh2.h b/cryptopp/dh2.h new file mode 100644 index 0000000..af9d342 --- /dev/null +++ b/cryptopp/dh2.h @@ -0,0 +1,58 @@ +#ifndef CRYPTOPP_DH2_H +#define CRYPTOPP_DH2_H + +/** \file +*/ + +#include "cryptlib.h" + +NAMESPACE_BEGIN(CryptoPP) + +/// Unified Diffie-Hellman +class DH2 : public AuthenticatedKeyAgreementDomain +{ +public: + DH2(SimpleKeyAgreementDomain &domain) + : d1(domain), d2(domain) {} + DH2(SimpleKeyAgreementDomain &staticDomain, SimpleKeyAgreementDomain &ephemeralDomain) + : d1(staticDomain), d2(ephemeralDomain) {} + + CryptoParameters & AccessCryptoParameters() {return d1.AccessCryptoParameters();} + + unsigned int AgreedValueLength() const + {return d1.AgreedValueLength() + d2.AgreedValueLength();} + + unsigned int StaticPrivateKeyLength() const + {return d1.PrivateKeyLength();} + unsigned int StaticPublicKeyLength() const + {return d1.PublicKeyLength();} + void GenerateStaticPrivateKey(RandomNumberGenerator &rng, byte *privateKey) const + {d1.GeneratePrivateKey(rng, privateKey);} + void GenerateStaticPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const + {d1.GeneratePublicKey(rng, privateKey, publicKey);} + void GenerateStaticKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const + {d1.GenerateKeyPair(rng, privateKey, publicKey);} + + unsigned int EphemeralPrivateKeyLength() const + {return d2.PrivateKeyLength();} + unsigned int EphemeralPublicKeyLength() const + {return d2.PublicKeyLength();} + void GenerateEphemeralPrivateKey(RandomNumberGenerator &rng, byte *privateKey) const + {d2.GeneratePrivateKey(rng, privateKey);} + void GenerateEphemeralPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const + {d2.GeneratePublicKey(rng, privateKey, publicKey);} + void GenerateEphemeralKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const + {d2.GenerateKeyPair(rng, privateKey, publicKey);} + + bool Agree(byte *agreedValue, + const byte *staticPrivateKey, const byte *ephemeralPrivateKey, + const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, + bool validateStaticOtherPublicKey=true) const; + +protected: + SimpleKeyAgreementDomain &d1, &d2; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/dll.cpp b/cryptopp/dll.cpp new file mode 100644 index 0000000..2b4ef7a --- /dev/null +++ b/cryptopp/dll.cpp @@ -0,0 +1,146 @@ +// dll.cpp - written and placed in the public domain by Wei Dai + +#define CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#define CRYPTOPP_DEFAULT_NO_DLL + +#include "dll.h" +#pragma warning(default: 4660) + +#if defined(CRYPTOPP_EXPORTS) && defined(CRYPTOPP_WIN32_AVAILABLE) +#include +#endif + +#ifndef CRYPTOPP_IMPORTS + +NAMESPACE_BEGIN(CryptoPP) + +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); + +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x2d,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x04,0x05,0x00,0x04,0x1c}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); + +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); + +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x41,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02,0x05,0x00,0x04,0x30}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); + +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05,0x00,0x04,0x40}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); + +template<> const byte EMSA2HashId::id = 0x33; +template<> const byte EMSA2HashId::id = 0x38; +template<> const byte EMSA2HashId::id = 0x34; +template<> const byte EMSA2HashId::id = 0x36; +template<> const byte EMSA2HashId::id = 0x35; + +NAMESPACE_END + +#endif + +#ifdef CRYPTOPP_EXPORTS + +USING_NAMESPACE(CryptoPP) + +#if !(defined(_MSC_VER) && (_MSC_VER < 1300)) +using std::set_new_handler; +#endif + +static PNew s_pNew = NULL; +static PDelete s_pDelete = NULL; + +static void * New (size_t size) +{ + void *p; + while (!(p = malloc(size))) + CallNewHandler(); + + return p; +} + +static void SetNewAndDeleteFunctionPointers() +{ + void *p = NULL; + HMODULE hModule = NULL; + MEMORY_BASIC_INFORMATION mbi; + + while (true) + { + VirtualQuery(p, &mbi, sizeof(mbi)); + + if (p >= (char *)mbi.BaseAddress + mbi.RegionSize) + break; + + p = (char *)mbi.BaseAddress + mbi.RegionSize; + + if (!mbi.AllocationBase || mbi.AllocationBase == hModule) + continue; + + hModule = HMODULE(mbi.AllocationBase); + + PGetNewAndDelete pGetNewAndDelete = (PGetNewAndDelete)GetProcAddress(hModule, "GetNewAndDeleteForCryptoPP"); + if (pGetNewAndDelete) + { + pGetNewAndDelete(s_pNew, s_pDelete); + return; + } + + PSetNewAndDelete pSetNewAndDelete = (PSetNewAndDelete)GetProcAddress(hModule, "SetNewAndDeleteFromCryptoPP"); + if (pSetNewAndDelete) + { + s_pNew = &New; + s_pDelete = &free; + pSetNewAndDelete(s_pNew, s_pDelete, &set_new_handler); + return; + } + } + + // try getting these directly using mangled names of new and delete operators + + hModule = GetModuleHandle("msvcrtd"); + if (!hModule) + hModule = GetModuleHandle("msvcrt"); + if (hModule) + { + // 32-bit versions + s_pNew = (PNew)GetProcAddress(hModule, "??2@YAPAXI@Z"); + s_pDelete = (PDelete)GetProcAddress(hModule, "??3@YAXPAX@Z"); + if (s_pNew && s_pDelete) + return; + + // 64-bit versions + s_pNew = (PNew)GetProcAddress(hModule, "??2@YAPEAX_K@Z"); + s_pDelete = (PDelete)GetProcAddress(hModule, "??3@YAXPEAX@Z"); + if (s_pNew && s_pDelete) + return; + } + + OutputDebugString("Crypto++ was not able to obtain new and delete function pointers.\n"); + throw 0; +} + +void * operator new (size_t size) +{ + if (!s_pNew) + SetNewAndDeleteFunctionPointers(); + + return s_pNew(size); +} + +void operator delete (void * p) +{ + s_pDelete(p); +} + +void * operator new [] (size_t size) +{ + return operator new (size); +} + +void operator delete [] (void * p) +{ + operator delete (p); +} + +#endif // #ifdef CRYPTOPP_EXPORTS diff --git a/cryptopp/dll.h b/cryptopp/dll.h new file mode 100644 index 0000000..5e42d46 --- /dev/null +++ b/cryptopp/dll.h @@ -0,0 +1,71 @@ +#ifndef CRYPTOPP_DLL_H +#define CRYPTOPP_DLL_H + +#if !defined(CRYPTOPP_IMPORTS) && !defined(CRYPTOPP_EXPORTS) && !defined(CRYPTOPP_DEFAULT_NO_DLL) +#ifdef CRYPTOPP_CONFIG_H +#error To use the DLL version of Crypto++, this file must be included before any other Crypto++ header files. +#endif +#define CRYPTOPP_IMPORTS +#endif + +#include "aes.h" +#include "cbcmac.h" +#include "ccm.h" +#include "cmac.h" +#include "channels.h" +#include "des.h" +#include "dh.h" +#include "dsa.h" +#include "ec2n.h" +#include "eccrypto.h" +#include "ecp.h" +#include "files.h" +#include "fips140.h" +#include "gcm.h" +#include "hex.h" +#include "hmac.h" +#include "modes.h" +#include "mqueue.h" +#include "nbtheory.h" +#include "osrng.h" +#include "pkcspad.h" +#include "pssr.h" +#include "randpool.h" +#include "rsa.h" +#include "rw.h" +#include "sha.h" +#include "skipjack.h" +#include "trdlocal.h" + +#ifdef CRYPTOPP_IMPORTS + +#ifdef _DLL +// cause CRT DLL to be initialized before Crypto++ so that we can use malloc and free during DllMain() +#ifdef NDEBUG +#pragma comment(lib, "msvcrt") +#else +#pragma comment(lib, "msvcrtd") +#endif +#endif + +#pragma comment(lib, "cryptopp") + +#endif // #ifdef CRYPTOPP_IMPORTS + +#include // for new_handler + +NAMESPACE_BEGIN(CryptoPP) + +#if !(defined(_MSC_VER) && (_MSC_VER < 1300)) +using std::new_handler; +#endif + +typedef void * (CRYPTOPP_API * PNew)(size_t); +typedef void (CRYPTOPP_API * PDelete)(void *); +typedef void (CRYPTOPP_API * PGetNewAndDelete)(PNew &, PDelete &); +typedef new_handler (CRYPTOPP_API * PSetNewHandler)(new_handler); +typedef void (CRYPTOPP_API * PSetNewAndDelete)(PNew, PDelete, PSetNewHandler); + +NAMESPACE_END + +#endif diff --git a/cryptopp/dlltest.cpp b/cryptopp/dlltest.cpp new file mode 100644 index 0000000..dac9093 --- /dev/null +++ b/cryptopp/dlltest.cpp @@ -0,0 +1,206 @@ +#ifndef CRYPTOPP_DLL_ONLY +#define CRYPTOPP_DEFAULT_NO_DLL +#endif + +#include "dll.h" +#include + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +void FIPS140_SampleApplication() +{ + if (!FIPS_140_2_ComplianceEnabled()) + { + cerr << "FIPS 140-2 compliance was turned off at compile time.\n"; + abort(); + } + + // check self test status + if (GetPowerUpSelfTestStatus() != POWER_UP_SELF_TEST_PASSED) + { + cerr << "Automatic power-up self test failed.\n"; + abort(); + } + cout << "0. Automatic power-up self test passed.\n"; + + // simulate a power-up self test error + SimulatePowerUpSelfTestFailure(); + try + { + // trying to use a crypto algorithm after power-up self test error will result in an exception + AES::Encryption aes; + + // should not be here + cerr << "Use of AES failed to cause an exception after power-up self test error.\n"; + abort(); + } + catch (SelfTestFailure &e) + { + cout << "1. Caught expected exception when simulating self test failure. Exception message follows: "; + cout << e.what() << endl; + } + + // clear the self test error state and redo power-up self test + DoDllPowerUpSelfTest(); + if (GetPowerUpSelfTestStatus() != POWER_UP_SELF_TEST_PASSED) + { + cerr << "Re-do power-up self test failed.\n"; + abort(); + } + cout << "2. Re-do power-up self test passed.\n"; + + // encrypt and decrypt + const byte key[] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; + const byte iv[] = {0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef}; + const byte plaintext[] = { // "Now is the time for all " without tailing 0 + 0x4e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74, + 0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20, + 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20}; + byte ciphertext[24]; + byte decrypted[24]; + + CFB_FIPS_Mode::Encryption encryption_DES_EDE3_CFB; + encryption_DES_EDE3_CFB.SetKeyWithIV(key, sizeof(key), iv); + encryption_DES_EDE3_CFB.ProcessString(ciphertext, plaintext, 24); + + CFB_FIPS_Mode::Decryption decryption_DES_EDE3_CFB; + decryption_DES_EDE3_CFB.SetKeyWithIV(key, sizeof(key), iv); + decryption_DES_EDE3_CFB.ProcessString(decrypted, ciphertext, 24); + + if (memcmp(plaintext, decrypted, 24) != 0) + { + cerr << "DES-EDE3-CFB Encryption/decryption failed.\n"; + abort(); + } + cout << "3. DES-EDE3-CFB Encryption/decryption succeeded.\n"; + + // hash + const byte message[] = {'a', 'b', 'c'}; + const byte expectedDigest[] = {0xA9,0x99,0x3E,0x36,0x47,0x06,0x81,0x6A,0xBA,0x3E,0x25,0x71,0x78,0x50,0xC2,0x6C,0x9C,0xD0,0xD8,0x9D}; + byte digest[20]; + + SHA1 sha; + sha.Update(message, 3); + sha.Final(digest); + + if (memcmp(digest, expectedDigest, 20) != 0) + { + cerr << "SHA-1 hash failed.\n"; + abort(); + } + cout << "4. SHA-1 hash succeeded.\n"; + + // create auto-seeded X9.17 RNG object, if available +#ifdef OS_RNG_AVAILABLE + AutoSeededX917RNG rng; +#else + // this is used to allow this function to compile on platforms that don't have auto-seeded RNGs + RandomNumberGenerator &rng(NullRNG()); +#endif + + // generate DSA key + DSA::PrivateKey dsaPrivateKey; + dsaPrivateKey.GenerateRandomWithKeySize(rng, 1024); + DSA::PublicKey dsaPublicKey; + dsaPublicKey.AssignFrom(dsaPrivateKey); + if (!dsaPrivateKey.Validate(rng, 3) || !dsaPublicKey.Validate(rng, 3)) + { + cerr << "DSA key generation failed.\n"; + abort(); + } + cout << "5. DSA key generation succeeded.\n"; + + // encode DSA key + std::string encodedDsaPublicKey, encodedDsaPrivateKey; + dsaPublicKey.DEREncode(StringSink(encodedDsaPublicKey).Ref()); + dsaPrivateKey.DEREncode(StringSink(encodedDsaPrivateKey).Ref()); + + // decode DSA key + DSA::PrivateKey decodedDsaPrivateKey; + decodedDsaPrivateKey.BERDecode(StringStore(encodedDsaPrivateKey).Ref()); + DSA::PublicKey decodedDsaPublicKey; + decodedDsaPublicKey.BERDecode(StringStore(encodedDsaPublicKey).Ref()); + + if (!decodedDsaPrivateKey.Validate(rng, 3) || !decodedDsaPublicKey.Validate(rng, 3)) + { + cerr << "DSA key encode/decode failed.\n"; + abort(); + } + cout << "6. DSA key encode/decode succeeded.\n"; + + // sign and verify + byte signature[40]; + DSA::Signer signer(dsaPrivateKey); + assert(signer.SignatureLength() == 40); + signer.SignMessage(rng, message, 3, signature); + + DSA::Verifier verifier(dsaPublicKey); + if (!verifier.VerifyMessage(message, 3, signature, sizeof(signature))) + { + cerr << "DSA signature and verification failed.\n"; + abort(); + } + cout << "7. DSA signature and verification succeeded.\n"; + + + // try to verify an invalid signature + signature[0] ^= 1; + if (verifier.VerifyMessage(message, 3, signature, sizeof(signature))) + { + cerr << "DSA signature verification failed to detect bad signature.\n"; + abort(); + } + cout << "8. DSA signature verification successfully detected bad signature.\n"; + + // try to use an invalid key length + try + { + ECB_Mode::Encryption encryption_DES_EDE3_ECB; + encryption_DES_EDE3_ECB.SetKey(key, 5); + + // should not be here + cerr << "DES-EDE3 implementation did not detect use of invalid key length.\n"; + abort(); + } + catch (InvalidArgument &e) + { + cout << "9. Caught expected exception when using invalid key length. Exception message follows: "; + cout << e.what() << endl; + } + + cout << "\nFIPS 140-2 Sample Application completed normally.\n"; +} + +#ifdef CRYPTOPP_IMPORTS + +static PNew s_pNew = NULL; +static PDelete s_pDelete = NULL; + +extern "C" __declspec(dllexport) void __cdecl SetNewAndDeleteFromCryptoPP(PNew pNew, PDelete pDelete, PSetNewHandler pSetNewHandler) +{ + s_pNew = pNew; + s_pDelete = pDelete; +} + +void * __cdecl operator new (size_t size) +{ + return s_pNew(size); +} + +void __cdecl operator delete (void * p) +{ + s_pDelete(p); +} + +#endif + +#ifdef CRYPTOPP_DLL_ONLY + +int __cdecl main() +{ + FIPS140_SampleApplication(); + return 0; +} + +#endif diff --git a/cryptopp/dlltest.vcproj b/cryptopp/dlltest.vcproj new file mode 100644 index 0000000..f55d5cb --- /dev/null +++ b/cryptopp/dlltest.vcproj @@ -0,0 +1,419 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cryptopp/dmac.h b/cryptopp/dmac.h new file mode 100644 index 0000000..80b54ac --- /dev/null +++ b/cryptopp/dmac.h @@ -0,0 +1,93 @@ +#ifndef CRYPTOPP_DMAC_H +#define CRYPTOPP_DMAC_H + +#include "cbcmac.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +template +class CRYPTOPP_NO_VTABLE DMAC_Base : public SameKeyLengthAs, public MessageAuthenticationCode +{ +public: + static std::string StaticAlgorithmName() {return std::string("DMAC(") + T::StaticAlgorithmName() + ")";} + + CRYPTOPP_CONSTANT(DIGESTSIZE=T::BLOCKSIZE) + + DMAC_Base() {} + + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); + void Update(const byte *input, size_t length); + void TruncatedFinal(byte *mac, size_t size); + unsigned int DigestSize() const {return DIGESTSIZE;} + +private: + byte *GenerateSubKeys(const byte *key, size_t keylength); + + size_t m_subkeylength; + SecByteBlock m_subkeys; + CBC_MAC m_mac1; + typename T::Encryption m_f2; + unsigned int m_counter; +}; + +//! DMAC +/*! Based on "CBC MAC for Real-Time Data Sources" by Erez Petrank + and Charles Rackoff. T should be a class derived from BlockCipherDocumentation. +*/ +template +class DMAC : public MessageAuthenticationCodeFinal > +{ +public: + DMAC() {} + DMAC(const byte *key, size_t length=DMAC_Base::DEFAULT_KEYLENGTH) + {this->SetKey(key, length);} +}; + +template +void DMAC_Base::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) +{ + m_subkeylength = T::StaticGetValidKeyLength(T::BLOCKSIZE); + m_subkeys.resize(2*UnsignedMin((unsigned int)T::BLOCKSIZE, m_subkeylength)); + m_mac1.SetKey(GenerateSubKeys(key, length), m_subkeylength, params); + m_f2.SetKey(m_subkeys+m_subkeys.size()/2, m_subkeylength, params); + m_counter = 0; + m_subkeys.resize(0); +} + +template +void DMAC_Base::Update(const byte *input, size_t length) +{ + m_mac1.Update(input, length); + m_counter = (unsigned int)((m_counter + length) % T::BLOCKSIZE); +} + +template +void DMAC_Base::TruncatedFinal(byte *mac, size_t size) +{ + ThrowIfInvalidTruncatedSize(size); + + byte pad[T::BLOCKSIZE]; + byte padByte = byte(T::BLOCKSIZE-m_counter); + memset(pad, padByte, padByte); + m_mac1.Update(pad, padByte); + m_mac1.TruncatedFinal(mac, size); + m_f2.ProcessBlock(mac); + + m_counter = 0; // reset for next message +} + +template +byte *DMAC_Base::GenerateSubKeys(const byte *key, size_t keylength) +{ + typename T::Encryption cipher(key, keylength); + memset(m_subkeys, 0, m_subkeys.size()); + cipher.ProcessBlock(m_subkeys); + m_subkeys[m_subkeys.size()/2 + T::BLOCKSIZE - 1] = 1; + cipher.ProcessBlock(m_subkeys+m_subkeys.size()/2); + return m_subkeys; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/dsa.cpp b/cryptopp/dsa.cpp new file mode 100644 index 0000000..ac9e1f8 --- /dev/null +++ b/cryptopp/dsa.cpp @@ -0,0 +1,119 @@ +// dsa.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "dsa.h" +#include "nbtheory.h" + +NAMESPACE_BEGIN(CryptoPP) + +size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat) +{ + Integer r, s; + StringStore store(signature, signatureLen); + ArraySink sink(buffer, bufferSize); + + switch (fromFormat) + { + case DSA_P1363: + r.Decode(store, signatureLen/2); + s.Decode(store, signatureLen/2); + break; + case DSA_DER: + { + BERSequenceDecoder seq(store); + r.BERDecode(seq); + s.BERDecode(seq); + seq.MessageEnd(); + break; + } + case DSA_OPENPGP: + r.OpenPGPDecode(store); + s.OpenPGPDecode(store); + break; + } + + switch (toFormat) + { + case DSA_P1363: + r.Encode(sink, bufferSize/2); + s.Encode(sink, bufferSize/2); + break; + case DSA_DER: + { + DERSequenceEncoder seq(sink); + r.DEREncode(seq); + s.DEREncode(seq); + seq.MessageEnd(); + break; + } + case DSA_OPENPGP: + r.OpenPGPEncode(sink); + s.OpenPGPEncode(sink); + break; + } + + return (size_t)sink.TotalPutLength(); +} + +bool DSA::GeneratePrimes(const byte *seedIn, unsigned int g, int &counter, + Integer &p, unsigned int L, Integer &q, bool useInputCounterValue) +{ + assert(g%8 == 0); + + SHA sha; + SecByteBlock seed(seedIn, g/8); + SecByteBlock U(SHA::DIGESTSIZE); + SecByteBlock temp(SHA::DIGESTSIZE); + SecByteBlock W(((L-1)/160+1) * SHA::DIGESTSIZE); + const int n = (L-1) / 160; + const int b = (L-1) % 160; + Integer X; + + sha.CalculateDigest(U, seed, g/8); + + for (int i=g/8-1, carry=true; i>=0 && carry; i--) + carry=!++seed[i]; + + sha.CalculateDigest(temp, seed, g/8); + xorbuf(U, temp, SHA::DIGESTSIZE); + + U[0] |= 0x80; + U[SHA::DIGESTSIZE-1] |= 1; + q.Decode(U, SHA::DIGESTSIZE); + + if (!IsPrime(q)) + return false; + + int counterEnd = useInputCounterValue ? counter+1 : 4096; + + for (int c = 0; c < counterEnd; c++) + { + for (int k=0; k<=n; k++) + { + for (int i=g/8-1, carry=true; i>=0 && carry; i--) + carry=!++seed[i]; + if (!useInputCounterValue || c == counter) + sha.CalculateDigest(W+(n-k)*SHA::DIGESTSIZE, seed, g/8); + } + if (!useInputCounterValue || c == counter) + { + W[SHA::DIGESTSIZE - 1 - b/8] |= 0x80; + X.Decode(W + SHA::DIGESTSIZE - 1 - b/8, L/8); + p = X-((X % (2*q))-1); + + if (p.GetBit(L-1) && IsPrime(p)) + { + counter = c; + return true; + } + } + } + return false; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/dsa.h b/cryptopp/dsa.h new file mode 100644 index 0000000..6ae0387 --- /dev/null +++ b/cryptopp/dsa.h @@ -0,0 +1,35 @@ +#ifndef CRYPTOPP_DSA_H +#define CRYPTOPP_DSA_H + +/** \file +*/ + +#include "gfpcrypt.h" + +NAMESPACE_BEGIN(CryptoPP) + +/*! The DSA signature format used by Crypto++ is as defined by IEEE P1363. + Java uses the DER format, and OpenPGP uses the OpenPGP format. */ +enum DSASignatureFormat {DSA_P1363, DSA_DER, DSA_OPENPGP}; +/** This function converts between these formats, and returns length of signature in the target format. + If toFormat == DSA_P1363, bufferSize must equal publicKey.SignatureLength() */ +size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, + const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat); + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY + +typedef DSA::Signer DSAPrivateKey; +typedef DSA::Verifier DSAPublicKey; + +const int MIN_DSA_PRIME_LENGTH = DSA::MIN_PRIME_LENGTH; +const int MAX_DSA_PRIME_LENGTH = DSA::MAX_PRIME_LENGTH; +const int DSA_PRIME_LENGTH_MULTIPLE = DSA::PRIME_LENGTH_MULTIPLE; + +inline bool GenerateDSAPrimes(const byte *seed, size_t seedLength, int &counter, Integer &p, unsigned int primeLength, Integer &q) + {return DSA::GeneratePrimes(seed, seedLength, counter, p, primeLength, q);} + +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/eax.cpp b/cryptopp/eax.cpp new file mode 100644 index 0000000..2728c9b --- /dev/null +++ b/cryptopp/eax.cpp @@ -0,0 +1,59 @@ +// eax.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "eax.h" + +NAMESPACE_BEGIN(CryptoPP) + +void EAX_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms) +{ + AccessMAC().SetKey(userKey, keylength, params); + m_buffer.New(2*AccessMAC().TagSize()); +} + +void EAX_Base::Resync(const byte *iv, size_t len) +{ + MessageAuthenticationCode &mac = AccessMAC(); + unsigned int blockSize = mac.TagSize(); + + memset(m_buffer, 0, blockSize); + mac.Update(m_buffer, blockSize); + mac.CalculateDigest(m_buffer+blockSize, iv, len); + + m_buffer[blockSize-1] = 1; + mac.Update(m_buffer, blockSize); + + m_ctr.SetCipherWithIV(AccessMAC().AccessCipher(), m_buffer+blockSize, blockSize); +} + +size_t EAX_Base::AuthenticateBlocks(const byte *data, size_t len) +{ + AccessMAC().Update(data, len); + return 0; +} + +void EAX_Base::AuthenticateLastHeaderBlock() +{ + assert(m_bufferedDataLength == 0); + MessageAuthenticationCode &mac = AccessMAC(); + unsigned int blockSize = mac.TagSize(); + + mac.Final(m_buffer); + xorbuf(m_buffer+blockSize, m_buffer, blockSize); + + memset(m_buffer, 0, blockSize); + m_buffer[blockSize-1] = 2; + mac.Update(m_buffer, blockSize); +} + +void EAX_Base::AuthenticateLastFooterBlock(byte *tag, size_t macSize) +{ + assert(m_bufferedDataLength == 0); + MessageAuthenticationCode &mac = AccessMAC(); + unsigned int blockSize = mac.TagSize(); + + mac.TruncatedFinal(m_buffer, macSize); + xorbuf(tag, m_buffer, m_buffer+blockSize, macSize); +} + +NAMESPACE_END diff --git a/cryptopp/eax.h b/cryptopp/eax.h new file mode 100644 index 0000000..e48ee92 --- /dev/null +++ b/cryptopp/eax.h @@ -0,0 +1,91 @@ +#ifndef CRYPTOPP_EAX_H +#define CRYPTOPP_EAX_H + +#include "authenc.h" +#include "modes.h" +#include "cmac.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! . +class CRYPTOPP_NO_VTABLE EAX_Base : public AuthenticatedSymmetricCipherBase +{ +public: + // AuthenticatedSymmetricCipher + std::string AlgorithmName() const + {return GetMAC().GetCipher().AlgorithmName() + std::string("/EAX");} + size_t MinKeyLength() const + {return GetMAC().MinKeyLength();} + size_t MaxKeyLength() const + {return GetMAC().MaxKeyLength();} + size_t DefaultKeyLength() const + {return GetMAC().DefaultKeyLength();} + size_t GetValidKeyLength(size_t n) const + {return GetMAC().GetValidKeyLength(n);} + bool IsValidKeyLength(size_t n) const + {return GetMAC().IsValidKeyLength(n);} + unsigned int OptimalDataAlignment() const + {return GetMAC().OptimalDataAlignment();} + IV_Requirement IVRequirement() const + {return UNIQUE_IV;} + unsigned int IVSize() const + {return GetMAC().TagSize();} + unsigned int MinIVLength() const + {return 0;} + unsigned int MaxIVLength() const + {return UINT_MAX;} + unsigned int DigestSize() const + {return GetMAC().TagSize();} + lword MaxHeaderLength() const + {return LWORD_MAX;} + lword MaxMessageLength() const + {return LWORD_MAX;} + +protected: + // AuthenticatedSymmetricCipherBase + bool AuthenticationIsOnPlaintext() const + {return false;} + unsigned int AuthenticationBlockSize() const + {return 1;} + void SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms); + void Resync(const byte *iv, size_t len); + size_t AuthenticateBlocks(const byte *data, size_t len); + void AuthenticateLastHeaderBlock(); + void AuthenticateLastFooterBlock(byte *mac, size_t macSize); + SymmetricCipher & AccessSymmetricCipher() {return m_ctr;} + const CMAC_Base & GetMAC() const {return const_cast(this)->AccessMAC();} + virtual CMAC_Base & AccessMAC() =0; + + CTR_Mode_ExternalCipher::Encryption m_ctr; +}; + +//! . +template +class EAX_Final : public EAX_Base +{ +public: + static std::string StaticAlgorithmName() + {return T_BlockCipher::StaticAlgorithmName() + std::string("/EAX");} + bool IsForwardTransformation() const + {return T_IsEncryption;} + +private: + CMAC_Base & AccessMAC() {return m_cmac;} + CMAC m_cmac; +}; + +#ifdef EAX // EAX is defined to 11 on GCC 3.4.3, OpenSolaris 8.11 +#undef EAX +#endif + +/// EAX +template +struct EAX : public AuthenticatedSymmetricCipherDocumentation +{ + typedef EAX_Final Encryption; + typedef EAX_Final Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/ec2n.cpp b/cryptopp/ec2n.cpp new file mode 100644 index 0000000..dbab31a --- /dev/null +++ b/cryptopp/ec2n.cpp @@ -0,0 +1,288 @@ +// ec2n.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "ec2n.h" +#include "asn.h" + +#include "algebra.cpp" +#include "eprecomp.cpp" + +NAMESPACE_BEGIN(CryptoPP) + +EC2N::EC2N(BufferedTransformation &bt) + : m_field(BERDecodeGF2NP(bt)) +{ + BERSequenceDecoder seq(bt); + m_field->BERDecodeElement(seq, m_a); + m_field->BERDecodeElement(seq, m_b); + // skip optional seed + if (!seq.EndReached()) + BERDecodeOctetString(seq, TheBitBucket()); + seq.MessageEnd(); +} + +void EC2N::DEREncode(BufferedTransformation &bt) const +{ + m_field->DEREncode(bt); + DERSequenceEncoder seq(bt); + m_field->DEREncodeElement(seq, m_a); + m_field->DEREncodeElement(seq, m_b); + seq.MessageEnd(); +} + +bool EC2N::DecodePoint(EC2N::Point &P, const byte *encodedPoint, size_t encodedPointLen) const +{ + StringStore store(encodedPoint, encodedPointLen); + return DecodePoint(P, store, encodedPointLen); +} + +bool EC2N::DecodePoint(EC2N::Point &P, BufferedTransformation &bt, size_t encodedPointLen) const +{ + byte type; + if (encodedPointLen < 1 || !bt.Get(type)) + return false; + + switch (type) + { + case 0: + P.identity = true; + return true; + case 2: + case 3: + { + if (encodedPointLen != EncodedPointSize(true)) + return false; + + P.identity = false; + P.x.Decode(bt, m_field->MaxElementByteLength()); + + if (P.x.IsZero()) + { + P.y = m_field->SquareRoot(m_b); + return true; + } + + FieldElement z = m_field->Square(P.x); + assert(P.x == m_field->SquareRoot(z)); + P.y = m_field->Divide(m_field->Add(m_field->Multiply(z, m_field->Add(P.x, m_a)), m_b), z); + assert(P.x == m_field->Subtract(m_field->Divide(m_field->Subtract(m_field->Multiply(P.y, z), m_b), z), m_a)); + z = m_field->SolveQuadraticEquation(P.y); + assert(m_field->Add(m_field->Square(z), z) == P.y); + z.SetCoefficient(0, type & 1); + + P.y = m_field->Multiply(z, P.x); + return true; + } + case 4: + { + if (encodedPointLen != EncodedPointSize(false)) + return false; + + unsigned int len = m_field->MaxElementByteLength(); + P.identity = false; + P.x.Decode(bt, len); + P.y.Decode(bt, len); + return true; + } + default: + return false; + } +} + +void EC2N::EncodePoint(BufferedTransformation &bt, const Point &P, bool compressed) const +{ + if (P.identity) + NullStore().TransferTo(bt, EncodedPointSize(compressed)); + else if (compressed) + { + bt.Put(2 + (!P.x ? 0 : m_field->Divide(P.y, P.x).GetBit(0))); + P.x.Encode(bt, m_field->MaxElementByteLength()); + } + else + { + unsigned int len = m_field->MaxElementByteLength(); + bt.Put(4); // uncompressed + P.x.Encode(bt, len); + P.y.Encode(bt, len); + } +} + +void EC2N::EncodePoint(byte *encodedPoint, const Point &P, bool compressed) const +{ + ArraySink sink(encodedPoint, EncodedPointSize(compressed)); + EncodePoint(sink, P, compressed); + assert(sink.TotalPutLength() == EncodedPointSize(compressed)); +} + +EC2N::Point EC2N::BERDecodePoint(BufferedTransformation &bt) const +{ + SecByteBlock str; + BERDecodeOctetString(bt, str); + Point P; + if (!DecodePoint(P, str, str.size())) + BERDecodeError(); + return P; +} + +void EC2N::DEREncodePoint(BufferedTransformation &bt, const Point &P, bool compressed) const +{ + SecByteBlock str(EncodedPointSize(compressed)); + EncodePoint(str, P, compressed); + DEREncodeOctetString(bt, str); +} + +bool EC2N::ValidateParameters(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = !!m_b; + pass = pass && m_a.CoefficientCount() <= m_field->MaxElementBitLength(); + pass = pass && m_b.CoefficientCount() <= m_field->MaxElementBitLength(); + + if (level >= 1) + pass = pass && m_field->GetModulus().IsIrreducible(); + + return pass; +} + +bool EC2N::VerifyPoint(const Point &P) const +{ + const FieldElement &x = P.x, &y = P.y; + return P.identity || + (x.CoefficientCount() <= m_field->MaxElementBitLength() + && y.CoefficientCount() <= m_field->MaxElementBitLength() + && !(((x+m_a)*x*x+m_b-(x+y)*y)%m_field->GetModulus())); +} + +bool EC2N::Equal(const Point &P, const Point &Q) const +{ + if (P.identity && Q.identity) + return true; + + if (P.identity && !Q.identity) + return false; + + if (!P.identity && Q.identity) + return false; + + return (m_field->Equal(P.x,Q.x) && m_field->Equal(P.y,Q.y)); +} + +const EC2N::Point& EC2N::Identity() const +{ + return Singleton().Ref(); +} + +const EC2N::Point& EC2N::Inverse(const Point &P) const +{ + if (P.identity) + return P; + else + { + m_R.identity = false; + m_R.y = m_field->Add(P.x, P.y); + m_R.x = P.x; + return m_R; + } +} + +const EC2N::Point& EC2N::Add(const Point &P, const Point &Q) const +{ + if (P.identity) return Q; + if (Q.identity) return P; + if (Equal(P, Q)) return Double(P); + if (m_field->Equal(P.x, Q.x) && m_field->Equal(P.y, m_field->Add(Q.x, Q.y))) return Identity(); + + FieldElement t = m_field->Add(P.y, Q.y); + t = m_field->Divide(t, m_field->Add(P.x, Q.x)); + FieldElement x = m_field->Square(t); + m_field->Accumulate(x, t); + m_field->Accumulate(x, Q.x); + m_field->Accumulate(x, m_a); + m_R.y = m_field->Add(P.y, m_field->Multiply(t, x)); + m_field->Accumulate(x, P.x); + m_field->Accumulate(m_R.y, x); + + m_R.x.swap(x); + m_R.identity = false; + return m_R; +} + +const EC2N::Point& EC2N::Double(const Point &P) const +{ + if (P.identity) return P; + if (!m_field->IsUnit(P.x)) return Identity(); + + FieldElement t = m_field->Divide(P.y, P.x); + m_field->Accumulate(t, P.x); + m_R.y = m_field->Square(P.x); + m_R.x = m_field->Square(t); + m_field->Accumulate(m_R.x, t); + m_field->Accumulate(m_R.x, m_a); + m_field->Accumulate(m_R.y, m_field->Multiply(t, m_R.x)); + m_field->Accumulate(m_R.y, m_R.x); + + m_R.identity = false; + return m_R; +} + +// ******************************************************** + +/* +EcPrecomputation& EcPrecomputation::operator=(const EcPrecomputation &rhs) +{ + m_ec = rhs.m_ec; + m_ep = rhs.m_ep; + m_ep.m_group = m_ec.get(); + return *this; +} + +void EcPrecomputation::SetCurveAndBase(const EC2N &ec, const EC2N::Point &base) +{ + m_ec.reset(new EC2N(ec)); + m_ep.SetGroupAndBase(*m_ec, base); +} + +void EcPrecomputation::Precompute(unsigned int maxExpBits, unsigned int storage) +{ + m_ep.Precompute(maxExpBits, storage); +} + +void EcPrecomputation::Load(BufferedTransformation &bt) +{ + BERSequenceDecoder seq(bt); + word32 version; + BERDecodeUnsigned(seq, version, INTEGER, 1, 1); + m_ep.m_exponentBase.BERDecode(seq); + m_ep.m_windowSize = m_ep.m_exponentBase.BitCount() - 1; + m_ep.m_bases.clear(); + while (!seq.EndReached()) + m_ep.m_bases.push_back(m_ec->BERDecodePoint(seq)); + seq.MessageEnd(); +} + +void EcPrecomputation::Save(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + DEREncodeUnsigned(seq, 1); // version + m_ep.m_exponentBase.DEREncode(seq); + for (unsigned i=0; iDEREncodePoint(seq, m_ep.m_bases[i]); + seq.MessageEnd(); +} + +EC2N::Point EcPrecomputation::Exponentiate(const Integer &exponent) const +{ + return m_ep.Exponentiate(exponent); +} + +EC2N::Point EcPrecomputation::CascadeExponentiate(const Integer &exponent, const DL_FixedBasePrecomputation &pc2, const Integer &exponent2) const +{ + return m_ep.CascadeExponentiate(exponent, static_cast &>(pc2).m_ep, exponent2); +} +*/ + +NAMESPACE_END + +#endif diff --git a/cryptopp/ec2n.h b/cryptopp/ec2n.h new file mode 100644 index 0000000..ae4007c --- /dev/null +++ b/cryptopp/ec2n.h @@ -0,0 +1,113 @@ +#ifndef CRYPTOPP_EC2N_H +#define CRYPTOPP_EC2N_H + +#include "gf2n.h" +#include "eprecomp.h" +#include "smartptr.h" +#include "pubkey.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! Elliptic Curve Point +struct CRYPTOPP_DLL EC2NPoint +{ + EC2NPoint() : identity(true) {} + EC2NPoint(const PolynomialMod2 &x, const PolynomialMod2 &y) + : identity(false), x(x), y(y) {} + + bool operator==(const EC2NPoint &t) const + {return (identity && t.identity) || (!identity && !t.identity && x==t.x && y==t.y);} + bool operator< (const EC2NPoint &t) const + {return identity ? !t.identity : (!t.identity && (x; + +//! Elliptic Curve over GF(2^n) +class CRYPTOPP_DLL EC2N : public AbstractGroup +{ +public: + typedef GF2NP Field; + typedef Field::Element FieldElement; + typedef EC2NPoint Point; + + EC2N() {} + EC2N(const Field &field, const Field::Element &a, const Field::Element &b) + : m_field(field), m_a(a), m_b(b) {} + // construct from BER encoded parameters + // this constructor will decode and extract the the fields fieldID and curve of the sequence ECParameters + EC2N(BufferedTransformation &bt); + + // encode the fields fieldID and curve of the sequence ECParameters + void DEREncode(BufferedTransformation &bt) const; + + bool Equal(const Point &P, const Point &Q) const; + const Point& Identity() const; + const Point& Inverse(const Point &P) const; + bool InversionIsFast() const {return true;} + const Point& Add(const Point &P, const Point &Q) const; + const Point& Double(const Point &P) const; + + Point Multiply(const Integer &k, const Point &P) const + {return ScalarMultiply(P, k);} + Point CascadeMultiply(const Integer &k1, const Point &P, const Integer &k2, const Point &Q) const + {return CascadeScalarMultiply(P, k1, Q, k2);} + + bool ValidateParameters(RandomNumberGenerator &rng, unsigned int level=3) const; + bool VerifyPoint(const Point &P) const; + + unsigned int EncodedPointSize(bool compressed = false) const + {return 1 + (compressed?1:2)*m_field->MaxElementByteLength();} + // returns false if point is compressed and not valid (doesn't check if uncompressed) + bool DecodePoint(Point &P, BufferedTransformation &bt, size_t len) const; + bool DecodePoint(Point &P, const byte *encodedPoint, size_t len) const; + void EncodePoint(byte *encodedPoint, const Point &P, bool compressed) const; + void EncodePoint(BufferedTransformation &bt, const Point &P, bool compressed) const; + + Point BERDecodePoint(BufferedTransformation &bt) const; + void DEREncodePoint(BufferedTransformation &bt, const Point &P, bool compressed) const; + + Integer FieldSize() const {return Integer::Power2(m_field->MaxElementBitLength());} + const Field & GetField() const {return *m_field;} + const FieldElement & GetA() const {return m_a;} + const FieldElement & GetB() const {return m_b;} + + bool operator==(const EC2N &rhs) const + {return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;} + +private: + clonable_ptr m_field; + FieldElement m_a, m_b; + mutable Point m_R; +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupPrecomputation; + +template class EcPrecomputation; + +//! EC2N precomputation +template<> class EcPrecomputation : public DL_GroupPrecomputation +{ +public: + typedef EC2N EllipticCurve; + + // DL_GroupPrecomputation + const AbstractGroup & GetGroup() const {return m_ec;} + Element BERDecodeElement(BufferedTransformation &bt) const {return m_ec.BERDecodePoint(bt);} + void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {m_ec.DEREncodePoint(bt, v, false);} + + // non-inherited + void SetCurve(const EC2N &ec) {m_ec = ec;} + const EC2N & GetCurve() const {return m_ec;} + +private: + EC2N m_ec; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/eccrypto.cpp b/cryptopp/eccrypto.cpp new file mode 100644 index 0000000..fd8462f --- /dev/null +++ b/cryptopp/eccrypto.cpp @@ -0,0 +1,694 @@ +// eccrypto.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "eccrypto.h" +#include "nbtheory.h" +#include "oids.h" +#include "hex.h" +#include "argnames.h" +#include "ec2n.h" + +NAMESPACE_BEGIN(CryptoPP) + +#if 0 +static void ECDSA_TestInstantiations() +{ + ECDSA::Signer t1; + ECDSA::Verifier t2(t1); + ECNR::Signer t3; + ECNR::Verifier t4(t3); + ECIES::Encryptor t5; + ECIES::Decryptor t6; + ECDH::Domain t7; + ECMQV::Domain t8; +} +#endif + +// VC60 workaround: complains when these functions are put into an anonymous namespace +static Integer ConvertToInteger(const PolynomialMod2 &x) +{ + unsigned int l = x.ByteCount(); + SecByteBlock temp(l); + x.Encode(temp, l); + return Integer(temp, l); +} + +static inline Integer ConvertToInteger(const Integer &x) +{ + return x; +} + +static bool CheckMOVCondition(const Integer &q, const Integer &r) +{ + // see "Updated standards for validating elliptic curves", http://eprint.iacr.org/2007/343 + Integer t = 1; + unsigned int n = q.IsEven() ? 1 : q.BitCount(), m = r.BitCount(); + + for (unsigned int i=n; DiscreteLogWorkFactor(i) struct EcRecommendedParameters; + +template<> struct EcRecommendedParameters +{ + EcRecommendedParameters(const OID &oid, unsigned int t2, unsigned int t3, unsigned int t4, const char *a, const char *b, const char *g, const char *n, unsigned int h) + : oid(oid), t0(0), t1(0), t2(t2), t3(t3), t4(t4), a(a), b(b), g(g), n(n), h(h) {} + EcRecommendedParameters(const OID &oid, unsigned int t0, unsigned int t1, unsigned int t2, unsigned int t3, unsigned int t4, const char *a, const char *b, const char *g, const char *n, unsigned int h) + : oid(oid), t0(t0), t1(t1), t2(t2), t3(t3), t4(t4), a(a), b(b), g(g), n(n), h(h) {} + EC2N *NewEC() const + { + StringSource ssA(a, true, new HexDecoder); + StringSource ssB(b, true, new HexDecoder); + if (t0 == 0) + return new EC2N(GF2NT(t2, t3, t4), EC2N::FieldElement(ssA, (size_t)ssA.MaxRetrievable()), EC2N::FieldElement(ssB, (size_t)ssB.MaxRetrievable())); + else + return new EC2N(GF2NPP(t0, t1, t2, t3, t4), EC2N::FieldElement(ssA, (size_t)ssA.MaxRetrievable()), EC2N::FieldElement(ssB, (size_t)ssB.MaxRetrievable())); + }; + + OID oid; + unsigned int t0, t1, t2, t3, t4; + const char *a, *b, *g, *n; + unsigned int h; +}; + +template<> struct EcRecommendedParameters +{ + EcRecommendedParameters(const OID &oid, const char *p, const char *a, const char *b, const char *g, const char *n, unsigned int h) + : oid(oid), p(p), a(a), b(b), g(g), n(n), h(h) {} + ECP *NewEC() const + { + StringSource ssP(p, true, new HexDecoder); + StringSource ssA(a, true, new HexDecoder); + StringSource ssB(b, true, new HexDecoder); + return new ECP(Integer(ssP, (size_t)ssP.MaxRetrievable()), ECP::FieldElement(ssA, (size_t)ssA.MaxRetrievable()), ECP::FieldElement(ssB, (size_t)ssB.MaxRetrievable())); + }; + + OID oid; + const char *p; + const char *a, *b, *g, *n; + unsigned int h; +}; + +struct OIDLessThan +{ + template + inline bool operator()(const EcRecommendedParameters& a, const OID& b) {return a.oid < b;} + template + inline bool operator()(const OID& a, const EcRecommendedParameters& b) {return a < b.oid;} + template + inline bool operator()(const EcRecommendedParameters& a, const EcRecommendedParameters& b) {return a.oid < b.oid;} +}; + +static void GetRecommendedParameters(const EcRecommendedParameters *&begin, const EcRecommendedParameters *&end) +{ + // this array must be sorted by OID + static const EcRecommendedParameters rec[] = { + EcRecommendedParameters(ASN1::sect163k1(), + 163, 7, 6, 3, 0, + "000000000000000000000000000000000000000001", + "000000000000000000000000000000000000000001", + "0402FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE80289070FB05D38FF58321F2E800536D538CCDAA3D9", + "04000000000000000000020108A2E0CC0D99F8A5EF", + 2), + EcRecommendedParameters(ASN1::sect163r1(), + 163, 7, 6, 3, 0, + "07B6882CAAEFA84F9554FF8428BD88E246D2782AE2", + "0713612DCDDCB40AAB946BDA29CA91F73AF958AFD9", + "040369979697AB43897789566789567F787A7876A65400435EDB42EFAFB2989D51FEFCE3C80988F41FF883", + "03FFFFFFFFFFFFFFFFFFFF48AAB689C29CA710279B", + 2), + EcRecommendedParameters(ASN1::sect239k1(), + 239, 158, 0, + "000000000000000000000000000000000000000000000000000000000000", + "000000000000000000000000000000000000000000000000000000000001", + "0429A0B6A887A983E9730988A68727A8B2D126C44CC2CC7B2A6555193035DC76310804F12E549BDB011C103089E73510ACB275FC312A5DC6B76553F0CA", + "2000000000000000000000000000005A79FEC67CB6E91F1C1DA800E478A5", + 4), + EcRecommendedParameters(ASN1::sect113r1(), + 113, 9, 0, + "003088250CA6E7C7FE649CE85820F7", + "00E8BEE4D3E2260744188BE0E9C723", + "04009D73616F35F4AB1407D73562C10F00A52830277958EE84D1315ED31886", + "0100000000000000D9CCEC8A39E56F", + 2), + EcRecommendedParameters(ASN1::sect113r2(), + 113, 9, 0, + "00689918DBEC7E5A0DD6DFC0AA55C7", + "0095E9A9EC9B297BD4BF36E059184F", + "0401A57A6A7B26CA5EF52FCDB816479700B3ADC94ED1FE674C06E695BABA1D", + "010000000000000108789B2496AF93", + 2), + EcRecommendedParameters(ASN1::sect163r2(), + 163, 7, 6, 3, 0, + "000000000000000000000000000000000000000001", + "020A601907B8C953CA1481EB10512F78744A3205FD", + "0403F0EBA16286A2D57EA0991168D4994637E8343E3600D51FBC6C71A0094FA2CDD545B11C5C0C797324F1", + "040000000000000000000292FE77E70C12A4234C33", + 2), + EcRecommendedParameters(ASN1::sect283k1(), + 283, 12, 7, 5, 0, + "000000000000000000000000000000000000000000000000000000000000000000000000", + "000000000000000000000000000000000000000000000000000000000000000000000001", + "040503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC245849283601CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259", + "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61", + 4), + EcRecommendedParameters(ASN1::sect283r1(), + 283, 12, 7, 5, 0, + "000000000000000000000000000000000000000000000000000000000000000000000001", + "027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5", + "0405F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B1205303676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4", + "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307", + 2), + EcRecommendedParameters(ASN1::sect131r1(), + 131, 8, 3, 2, 0, + "07A11B09A76B562144418FF3FF8C2570B8", + "0217C05610884B63B9C6C7291678F9D341", + "040081BAF91FDF9833C40F9C181343638399078C6E7EA38C001F73C8134B1B4EF9E150", + "0400000000000000023123953A9464B54D", + 2), + EcRecommendedParameters(ASN1::sect131r2(), + 131, 8, 3, 2, 0, + "03E5A88919D7CAFCBF415F07C2176573B2", + "04B8266A46C55657AC734CE38F018F2192", + "040356DCD8F2F95031AD652D23951BB366A80648F06D867940A5366D9E265DE9EB240F", + "0400000000000000016954A233049BA98F", + 2), + EcRecommendedParameters(ASN1::sect193r1(), + 193, 15, 0, + "0017858FEB7A98975169E171F77B4087DE098AC8A911DF7B01", + "00FDFB49BFE6C3A89FACADAA7A1E5BBC7CC1C2E5D831478814", + "0401F481BC5F0FF84A74AD6CDF6FDEF4BF6179625372D8C0C5E10025E399F2903712CCF3EA9E3A1AD17FB0B3201B6AF7CE1B05", + "01000000000000000000000000C7F34A778F443ACC920EBA49", + 2), + EcRecommendedParameters(ASN1::sect193r2(), + 193, 15, 0, + "0163F35A5137C2CE3EA6ED8667190B0BC43ECD69977702709B", + "00C9BB9E8927D4D64C377E2AB2856A5B16E3EFB7F61D4316AE", + "0400D9B67D192E0367C803F39E1A7E82CA14A651350AAE617E8F01CE94335607C304AC29E7DEFBD9CA01F596F927224CDECF6C", + "010000000000000000000000015AAB561B005413CCD4EE99D5", + 2), + EcRecommendedParameters(ASN1::sect233k1(), + 233, 74, 0, + "000000000000000000000000000000000000000000000000000000000000", + "000000000000000000000000000000000000000000000000000000000001", + "04017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD612601DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3", + "8000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF", + 4), + EcRecommendedParameters(ASN1::sect233r1(), + 233, 74, 0, + "000000000000000000000000000000000000000000000000000000000001", + "0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD", + "0400FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052", + "01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7", + 2), + EcRecommendedParameters(ASN1::sect409k1(), + 409, 87, 0, + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + "040060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE902374601E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B", + "7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF", + 4), + EcRecommendedParameters(ASN1::sect409r1(), + 409, 87, 0, + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + "0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F", + "04015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A70061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706", + "010000000000000000000000000000000000000000000000000001E2AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173", + 2), + EcRecommendedParameters(ASN1::sect571k1(), + 571, 10, 5, 2, 0, + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + "04026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C89720349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3", + "020000000000000000000000000000000000000000000000000000000000000000000000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001", + 4), + EcRecommendedParameters(ASN1::sect571r1(), + 571, 10, 5, 2, 0, + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + "02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFABBD8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F2955727A", + "040303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B", + "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2FE84E47", + 2), + }; + begin = rec; + end = rec + sizeof(rec)/sizeof(rec[0]); +} + +static void GetRecommendedParameters(const EcRecommendedParameters *&begin, const EcRecommendedParameters *&end) +{ + // this array must be sorted by OID + static const EcRecommendedParameters rec[] = { + EcRecommendedParameters(ASN1::secp192r1(), + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC", + "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1", + "04188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF101207192B95FFC8DA78631011ED6B24CDD573F977A11E794811", + "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831", + 1), + EcRecommendedParameters(ASN1::secp256r1(), + "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF", + "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC", + "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B", + "046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", + "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551", + 1), + EcRecommendedParameters(ASN1::brainpoolP160r1(), + "E95E4A5F737059DC60DFC7AD95B3D8139515620F", + "340E7BE2A280EB74E2BE61BADA745D97E8F7C300", + "1E589A8595423412134FAA2DBDEC95C8D8675E58", + "04BED5AF16EA3F6A4F62938C4631EB5AF7BDBCDBC31667CB477A1A8EC338F94741669C976316DA6321", + "E95E4A5F737059DC60DF5991D45029409E60FC09", + 1), + EcRecommendedParameters(ASN1::brainpoolP192r1(), + "C302F41D932A36CDA7A3463093D18DB78FCE476DE1A86297", + "6A91174076B1E0E19C39C031FE8685C1CAE040E5C69A28EF", + "469A28EF7C28CCA3DC721D044F4496BCCA7EF4146FBF25C9", + "04C0A0647EAAB6A48753B033C56CB0F0900A2F5C4853375FD614B690866ABD5BB88B5F4828C1490002E6773FA2FA299B8F", + "C302F41D932A36CDA7A3462F9E9E916B5BE8F1029AC4ACC1", + 1), + EcRecommendedParameters(ASN1::brainpoolP224r1(), + "D7C134AA264366862A18302575D1D787B09F075797DA89F57EC8C0FF", + "68A5E62CA9CE6C1C299803A6C1530B514E182AD8B0042A59CAD29F43", + "2580F63CCFE44138870713B1A92369E33E2135D266DBB372386C400B", + "040D9029AD2C7E5CF4340823B2A87DC68C9E4CE3174C1E6EFDEE12C07D58AA56F772C0726F24C6B89E4ECDAC24354B9E99CAA3F6D3761402CD", + "D7C134AA264366862A18302575D0FB98D116BC4B6DDEBCA3A5A7939F", + 1), + EcRecommendedParameters(ASN1::brainpoolP256r1(), + "A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E5377", + "7D5A0975FC2C3057EEF67530417AFFE7FB8055C126DC5C6CE94A4B44F330B5D9", + "26DC5C6CE94A4B44F330B5D9BBD77CBF958416295CF7E1CE6BCCDC18FF8C07B6", + "048BD2AEB9CB7E57CB2C4B482FFC81B7AFB9DE27E1E3BD23C23A4453BD9ACE3262547EF835C3DAC4FD97F8461A14611DC9C27745132DED8E545C1D54C72F046997", + "A9FB57DBA1EEA9BC3E660A909D838D718C397AA3B561A6F7901E0E82974856A7", + 1), + EcRecommendedParameters(ASN1::brainpoolP320r1(), + "D35E472036BC4FB7E13C785ED201E065F98FCFA6F6F40DEF4F92B9EC7893EC28FCD412B1F1B32E27", + "3EE30B568FBAB0F883CCEBD46D3F3BB8A2A73513F5EB79DA66190EB085FFA9F492F375A97D860EB4", + "520883949DFDBC42D3AD198640688A6FE13F41349554B49ACC31DCCD884539816F5EB4AC8FB1F1A6", + "0443BD7E9AFB53D8B85289BCC48EE5BFE6F20137D10A087EB6E7871E2A10A599C710AF8D0D39E2061114FDD05545EC1CC8AB4093247F77275E0743FFED117182EAA9C77877AAAC6AC7D35245D1692E8EE1", + "D35E472036BC4FB7E13C785ED201E065F98FCFA5B68F12A32D482EC7EE8658E98691555B44C59311", + 1), + EcRecommendedParameters(ASN1::brainpoolP384r1(), + "8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B412B1DA197FB71123ACD3A729901D1A71874700133107EC53", + "7BC382C63D8C150C3C72080ACE05AFA0C2BEA28E4FB22787139165EFBA91F90F8AA5814A503AD4EB04A8C7DD22CE2826", + "04A8C7DD22CE28268B39B55416F0447C2FB77DE107DCD2A62E880EA53EEB62D57CB4390295DBC9943AB78696FA504C11", + "041D1C64F068CF45FFA2A63A81B7C13F6B8847A3E77EF14FE3DB7FCAFE0CBD10E8E826E03436D646AAEF87B2E247D4AF1E8ABE1D7520F9C2A45CB1EB8E95CFD55262B70B29FEEC5864E19C054FF99129280E4646217791811142820341263C5315", + "8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B31F166E6CAC0425A7CF3AB6AF6B7FC3103B883202E9046565", + 1), + EcRecommendedParameters(ASN1::brainpoolP512r1(), + "AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA703308717D4D9B009BC66842AECDA12AE6A380E62881FF2F2D82C68528AA6056583A48F3", + "7830A3318B603B89E2327145AC234CC594CBDD8D3DF91610A83441CAEA9863BC2DED5D5AA8253AA10A2EF1C98B9AC8B57F1117A72BF2C7B9E7C1AC4D77FC94CA", + "3DF91610A83441CAEA9863BC2DED5D5AA8253AA10A2EF1C98B9AC8B57F1117A72BF2C7B9E7C1AC4D77FC94CADC083E67984050B75EBAE5DD2809BD638016F723", + "0481AEE4BDD82ED9645A21322E9C4C6A9385ED9F70B5D916C1B43B62EEF4D0098EFF3B1F78E2D0D48D50D1687B93B97D5F7C6D5047406A5E688B352209BCB9F8227DDE385D566332ECC0EABFA9CF7822FDF209F70024A57B1AA000C55B881F8111B2DCDE494A5F485E5BCA4BD88A2763AED1CA2B2FA8F0540678CD1E0F3AD80892", + "AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA70330870553E5C414CA92619418661197FAC10471DB1D381085DDADDB58796829CA90069", + 1), + EcRecommendedParameters(ASN1::secp112r1(), + "DB7C2ABF62E35E668076BEAD208B", + "DB7C2ABF62E35E668076BEAD2088", + "659EF8BA043916EEDE8911702B22", + "0409487239995A5EE76B55F9C2F098A89CE5AF8724C0A23E0E0FF77500", + "DB7C2ABF62E35E7628DFAC6561C5", + 1), + EcRecommendedParameters(ASN1::secp112r2(), + "DB7C2ABF62E35E668076BEAD208B", + "6127C24C05F38A0AAAF65C0EF02C", + "51DEF1815DB5ED74FCC34C85D709", + "044BA30AB5E892B4E1649DD0928643ADCD46F5882E3747DEF36E956E97", + "36DF0AAFD8B8D7597CA10520D04B", + 4), + EcRecommendedParameters(ASN1::secp160r1(), + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC", + "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45", + "044A96B5688EF573284664698968C38BB913CBFC8223A628553168947D59DCC912042351377AC5FB32", + "0100000000000000000001F4C8F927AED3CA752257", + 1), + EcRecommendedParameters(ASN1::secp160k1(), + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73", + "0000000000000000000000000000000000000000", + "0000000000000000000000000000000000000007", + "043B4C382CE37AA192A4019E763036F4F5DD4D7EBB938CF935318FDCED6BC28286531733C3F03C4FEE", + "0100000000000000000001B8FA16DFAB9ACA16B6B3", + 1), + EcRecommendedParameters(ASN1::secp256k1(), + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000007", + "0479BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", + 1), + EcRecommendedParameters(ASN1::secp128r1(), + "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF", + "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC", + "E87579C11079F43DD824993C2CEE5ED3", + "04161FF7528B899B2D0C28607CA52C5B86CF5AC8395BAFEB13C02DA292DDED7A83", + "FFFFFFFE0000000075A30D1B9038A115", + 1), + EcRecommendedParameters(ASN1::secp128r2(), + "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF", + "D6031998D1B3BBFEBF59CC9BBFF9AEE1", + "5EEEFCA380D02919DC2C6558BB6D8A5D", + "047B6AA5D85E572983E6FB32A7CDEBC14027B6916A894D3AEE7106FE805FC34B44", + "3FFFFFFF7FFFFFFFBE0024720613B5A3", + 4), + EcRecommendedParameters(ASN1::secp160r2(), + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC70", + "B4E134D3FB59EB8BAB57274904664D5AF50388BA", + "0452DCB034293A117E1F4FF11B30F7199D3144CE6DFEAFFEF2E331F296E071FA0DF9982CFEA7D43F2E", + "0100000000000000000000351EE786A818F3A1A16B", + 1), + EcRecommendedParameters(ASN1::secp192k1(), + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37", + "000000000000000000000000000000000000000000000000", + "000000000000000000000000000000000000000000000003", + "04DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D", + "FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D", + 1), + EcRecommendedParameters(ASN1::secp224k1(), + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFE56D", + "00000000000000000000000000000000000000000000000000000000", + "00000000000000000000000000000000000000000000000000000005", + "04A1455B334DF099DF30FC28A169A467E9E47075A90F7E650EB6B7A45C7E089FED7FBA344282CAFBD6F7E319F7C0B0BD59E2CA4BDB556D61A5", + "010000000000000000000000000001DCE8D2EC6184CAF0A971769FB1F7", + 1), + EcRecommendedParameters(ASN1::secp224r1(), + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE", + "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4", + "04B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D", + 1), + EcRecommendedParameters(ASN1::secp384r1(), + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC", + "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF", + "04AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB73617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F", + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973", + 1), + EcRecommendedParameters(ASN1::secp521r1(), + "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", + "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC", + "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00", + "0400C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650", + "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409", + 1), + }; + begin = rec; + end = rec + sizeof(rec)/sizeof(rec[0]); +} + +template OID DL_GroupParameters_EC::GetNextRecommendedParametersOID(const OID &oid) +{ + const EcRecommendedParameters *begin, *end; + GetRecommendedParameters(begin, end); + const EcRecommendedParameters *it = std::upper_bound(begin, end, oid, OIDLessThan()); + return (it == end ? OID() : it->oid); +} + +template void DL_GroupParameters_EC::Initialize(const OID &oid) +{ + const EcRecommendedParameters *begin, *end; + GetRecommendedParameters(begin, end); + const EcRecommendedParameters *it = std::lower_bound(begin, end, oid, OIDLessThan()); + if (it == end || it->oid != oid) + throw UnknownOID(); + + const EcRecommendedParameters ¶m = *it; + m_oid = oid; + std::auto_ptr ec(param.NewEC()); + this->m_groupPrecomputation.SetCurve(*ec); + + StringSource ssG(param.g, true, new HexDecoder); + Element G; + bool result = GetCurve().DecodePoint(G, ssG, (size_t)ssG.MaxRetrievable()); + SetSubgroupGenerator(G); + assert(result); + + StringSource ssN(param.n, true, new HexDecoder); + m_n.Decode(ssN, (size_t)ssN.MaxRetrievable()); + m_k = param.h; +} + +template +bool DL_GroupParameters_EC::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + if (strcmp(name, Name::GroupOID()) == 0) + { + if (m_oid.m_values.empty()) + return false; + + this->ThrowIfTypeMismatch(name, typeid(OID), valueType); + *reinterpret_cast(pValue) = m_oid; + return true; + } + else + return GetValueHelper >(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Curve); +} + +template +void DL_GroupParameters_EC::AssignFrom(const NameValuePairs &source) +{ + OID oid; + if (source.GetValue(Name::GroupOID(), oid)) + Initialize(oid); + else + { + EllipticCurve ec; + Point G; + Integer n; + + source.GetRequiredParameter("DL_GroupParameters_EC", Name::Curve(), ec); + source.GetRequiredParameter("DL_GroupParameters_EC", Name::SubgroupGenerator(), G); + source.GetRequiredParameter("DL_GroupParameters_EC", Name::SubgroupOrder(), n); + Integer k = source.GetValueWithDefault(Name::Cofactor(), Integer::Zero()); + + Initialize(ec, G, n, k); + } +} + +template +void DL_GroupParameters_EC::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg) +{ + try + { + AssignFrom(alg); + } + catch (InvalidArgument &) + { + throw NotImplemented("DL_GroupParameters_EC: curve generation is not implemented yet"); + } +} + +template +void DL_GroupParameters_EC::BERDecode(BufferedTransformation &bt) +{ + byte b; + if (!bt.Peek(b)) + BERDecodeError(); + if (b == OBJECT_IDENTIFIER) + Initialize(OID(bt)); + else + { + BERSequenceDecoder seq(bt); + word32 version; + BERDecodeUnsigned(seq, version, INTEGER, 1, 1); // check version + EllipticCurve ec(seq); + Point G = ec.BERDecodePoint(seq); + Integer n(seq); + Integer k; + bool cofactorPresent = !seq.EndReached(); + if (cofactorPresent) + k.BERDecode(seq); + else + k = Integer::Zero(); + seq.MessageEnd(); + + Initialize(ec, G, n, k); + } +} + +template +void DL_GroupParameters_EC::DEREncode(BufferedTransformation &bt) const +{ + if (m_encodeAsOID && !m_oid.m_values.empty()) + m_oid.DEREncode(bt); + else + { + DERSequenceEncoder seq(bt); + DEREncodeUnsigned(seq, 1); // version + GetCurve().DEREncode(seq); + GetCurve().DEREncodePoint(seq, this->GetSubgroupGenerator(), m_compress); + m_n.DEREncode(seq); + if (m_k.NotZero()) + m_k.DEREncode(seq); + seq.MessageEnd(); + } +} + +template +Integer DL_GroupParameters_EC::GetCofactor() const +{ + if (!m_k) + { + Integer q = GetCurve().FieldSize(); + Integer qSqrt = q.SquareRoot(); + m_k = (q+2*qSqrt+1)/m_n; + } + + return m_k; +} + +template +Integer DL_GroupParameters_EC::ConvertElementToInteger(const Element &element) const +{ + return ConvertToInteger(element.x); +}; + +template +bool DL_GroupParameters_EC::ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = GetCurve().ValidateParameters(rng, level); + + Integer q = GetCurve().FieldSize(); + pass = pass && m_n!=q; + + if (level >= 2) + { + Integer qSqrt = q.SquareRoot(); + pass = pass && m_n>4*qSqrt; + pass = pass && VerifyPrime(rng, m_n, level-2); + pass = pass && (m_k.IsZero() || m_k == (q+2*qSqrt+1)/m_n); + pass = pass && CheckMOVCondition(q, m_n); + } + + return pass; +} + +template +bool DL_GroupParameters_EC::ValidateElement(unsigned int level, const Element &g, const DL_FixedBasePrecomputation *gpc) const +{ + bool pass = !IsIdentity(g) && GetCurve().VerifyPoint(g); + if (level >= 1) + { + if (gpc) + pass = pass && gpc->Exponentiate(this->GetGroupPrecomputation(), Integer::One()) == g; + } + if (level >= 2 && pass) + { + const Integer &q = GetSubgroupOrder(); + Element gq = gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : ExponentiateElement(g, q); + pass = pass && IsIdentity(gq); + } + return pass; +} + +template +void DL_GroupParameters_EC::SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const +{ + GetCurve().SimultaneousMultiply(results, base, exponents, exponentsCount); +} + +template +CPP_TYPENAME DL_GroupParameters_EC::Element DL_GroupParameters_EC::MultiplyElements(const Element &a, const Element &b) const +{ + return GetCurve().Add(a, b); +} + +template +CPP_TYPENAME DL_GroupParameters_EC::Element DL_GroupParameters_EC::CascadeExponentiate(const Element &element1, const Integer &exponent1, const Element &element2, const Integer &exponent2) const +{ + return GetCurve().CascadeMultiply(exponent1, element1, exponent2, element2); +} + +template +OID DL_GroupParameters_EC::GetAlgorithmID() const +{ + return ASN1::id_ecPublicKey(); +} + +// ****************************************************************** + +template +void DL_PublicKey_EC::BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size) +{ + typename EC::Point P; + if (!this->GetGroupParameters().GetCurve().DecodePoint(P, bt, size)) + BERDecodeError(); + SetPublicElement(P); +} + +template +void DL_PublicKey_EC::DEREncodePublicKey(BufferedTransformation &bt) const +{ + this->GetGroupParameters().GetCurve().EncodePoint(bt, this->GetPublicElement(), this->GetGroupParameters().GetPointCompression()); +} + +// ****************************************************************** + +template +void DL_PrivateKey_EC::BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size) +{ + BERSequenceDecoder seq(bt); + word32 version; + BERDecodeUnsigned(seq, version, INTEGER, 1, 1); // check version + + BERGeneralDecoder dec(seq, OCTET_STRING); + if (!dec.IsDefiniteLength()) + BERDecodeError(); + Integer x; + x.Decode(dec, (size_t)dec.RemainingLength()); + dec.MessageEnd(); + if (!parametersPresent && seq.PeekByte() != (CONTEXT_SPECIFIC | CONSTRUCTED | 0)) + BERDecodeError(); + if (!seq.EndReached() && seq.PeekByte() == (CONTEXT_SPECIFIC | CONSTRUCTED | 0)) + { + BERGeneralDecoder parameters(seq, CONTEXT_SPECIFIC | CONSTRUCTED | 0); + this->AccessGroupParameters().BERDecode(parameters); + parameters.MessageEnd(); + } + if (!seq.EndReached()) + { + // skip over the public element + SecByteBlock subjectPublicKey; + unsigned int unusedBits; + BERGeneralDecoder publicKey(seq, CONTEXT_SPECIFIC | CONSTRUCTED | 1); + BERDecodeBitString(publicKey, subjectPublicKey, unusedBits); + publicKey.MessageEnd(); + Element Q; + if (!(unusedBits == 0 && this->GetGroupParameters().GetCurve().DecodePoint(Q, subjectPublicKey, subjectPublicKey.size()))) + BERDecodeError(); + } + seq.MessageEnd(); + + this->SetPrivateExponent(x); +} + +template +void DL_PrivateKey_EC::DEREncodePrivateKey(BufferedTransformation &bt) const +{ + DERSequenceEncoder privateKey(bt); + DEREncodeUnsigned(privateKey, 1); // version + // SEC 1 ver 1.0 says privateKey (m_d) has the same length as order of the curve + // this will be changed to order of base point in a future version + this->GetPrivateExponent().DEREncodeAsOctetString(privateKey, this->GetGroupParameters().GetSubgroupOrder().ByteCount()); + privateKey.MessageEnd(); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/eccrypto.h b/cryptopp/eccrypto.h new file mode 100644 index 0000000..8d95780 --- /dev/null +++ b/cryptopp/eccrypto.h @@ -0,0 +1,280 @@ +#ifndef CRYPTOPP_ECCRYPTO_H +#define CRYPTOPP_ECCRYPTO_H + +/*! \file +*/ + +#include "pubkey.h" +#include "integer.h" +#include "asn.h" +#include "hmac.h" +#include "sha.h" +#include "gfpcrypt.h" +#include "dh.h" +#include "mqv.h" +#include "ecp.h" +#include "ec2n.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! Elliptic Curve Parameters +/*! This class corresponds to the ASN.1 sequence of the same name + in ANSI X9.62 (also SEC 1). +*/ +template +class DL_GroupParameters_EC : public DL_GroupParametersImpl > +{ + typedef DL_GroupParameters_EC ThisClass; + +public: + typedef EC EllipticCurve; + typedef typename EllipticCurve::Point Point; + typedef Point Element; + typedef IncompatibleCofactorMultiplication DefaultCofactorOption; + + DL_GroupParameters_EC() : m_compress(false), m_encodeAsOID(false) {} + DL_GroupParameters_EC(const OID &oid) + : m_compress(false), m_encodeAsOID(false) {Initialize(oid);} + DL_GroupParameters_EC(const EllipticCurve &ec, const Point &G, const Integer &n, const Integer &k = Integer::Zero()) + : m_compress(false), m_encodeAsOID(false) {Initialize(ec, G, n, k);} + DL_GroupParameters_EC(BufferedTransformation &bt) + : m_compress(false), m_encodeAsOID(false) {BERDecode(bt);} + + void Initialize(const EllipticCurve &ec, const Point &G, const Integer &n, const Integer &k = Integer::Zero()) + { + this->m_groupPrecomputation.SetCurve(ec); + SetSubgroupGenerator(G); + m_n = n; + m_k = k; + } + void Initialize(const OID &oid); + + // NameValuePairs + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + + // GeneratibleCryptoMaterial interface + //! this implementation doesn't actually generate a curve, it just initializes the parameters with existing values + /*! parameters: (Curve, SubgroupGenerator, SubgroupOrder, Cofactor (optional)), or (GroupOID) */ + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg); + + // DL_GroupParameters + const DL_FixedBasePrecomputation & GetBasePrecomputation() const {return this->m_gpc;} + DL_FixedBasePrecomputation & AccessBasePrecomputation() {return this->m_gpc;} + const Integer & GetSubgroupOrder() const {return m_n;} + Integer GetCofactor() const; + bool ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const; + bool ValidateElement(unsigned int level, const Element &element, const DL_FixedBasePrecomputation *precomp) const; + bool FastSubgroupCheckAvailable() const {return false;} + void EncodeElement(bool reversible, const Element &element, byte *encoded) const + { + if (reversible) + GetCurve().EncodePoint(encoded, element, m_compress); + else + element.x.Encode(encoded, GetEncodedElementSize(false)); + } + unsigned int GetEncodedElementSize(bool reversible) const + { + if (reversible) + return GetCurve().EncodedPointSize(m_compress); + else + return GetCurve().GetField().MaxElementByteLength(); + } + Element DecodeElement(const byte *encoded, bool checkForGroupMembership) const + { + Point result; + if (!GetCurve().DecodePoint(result, encoded, GetEncodedElementSize(true))) + throw DL_BadElement(); + if (checkForGroupMembership && !ValidateElement(1, result, NULL)) + throw DL_BadElement(); + return result; + } + Integer ConvertElementToInteger(const Element &element) const; + Integer GetMaxExponent() const {return GetSubgroupOrder()-1;} + bool IsIdentity(const Element &element) const {return element.identity;} + void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const; + static std::string CRYPTOPP_API StaticAlgorithmNamePrefix() {return "EC";} + + // ASN1Key + OID GetAlgorithmID() const; + + // used by MQV + Element MultiplyElements(const Element &a, const Element &b) const; + Element CascadeExponentiate(const Element &element1, const Integer &exponent1, const Element &element2, const Integer &exponent2) const; + + // non-inherited + + // enumerate OIDs for recommended parameters, use OID() to get first one + static OID CRYPTOPP_API GetNextRecommendedParametersOID(const OID &oid); + + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + void SetPointCompression(bool compress) {m_compress = compress;} + bool GetPointCompression() const {return m_compress;} + + void SetEncodeAsOID(bool encodeAsOID) {m_encodeAsOID = encodeAsOID;} + bool GetEncodeAsOID() const {return m_encodeAsOID;} + + const EllipticCurve& GetCurve() const {return this->m_groupPrecomputation.GetCurve();} + + bool operator==(const ThisClass &rhs) const + {return this->m_groupPrecomputation.GetCurve() == rhs.m_groupPrecomputation.GetCurve() && this->m_gpc.GetBase(this->m_groupPrecomputation) == rhs.m_gpc.GetBase(rhs.m_groupPrecomputation);} + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY + const Point& GetBasePoint() const {return GetSubgroupGenerator();} + const Integer& GetBasePointOrder() const {return GetSubgroupOrder();} + void LoadRecommendedParameters(const OID &oid) {Initialize(oid);} +#endif + +protected: + unsigned int FieldElementLength() const {return GetCurve().GetField().MaxElementByteLength();} + unsigned int ExponentLength() const {return m_n.ByteCount();} + + OID m_oid; // set if parameters loaded from a recommended curve + Integer m_n; // order of base point + bool m_compress, m_encodeAsOID; + mutable Integer m_k; // cofactor +}; + +//! EC public key +template +class DL_PublicKey_EC : public DL_PublicKeyImpl > +{ +public: + typedef typename EC::Point Element; + + void Initialize(const DL_GroupParameters_EC ¶ms, const Element &Q) + {this->AccessGroupParameters() = params; SetPublicElement(Q);} + void Initialize(const EC &ec, const Element &G, const Integer &n, const Element &Q) + {this->AccessGroupParameters().Initialize(ec, G, n); SetPublicElement(Q);} + + // X509PublicKey + void BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size); + void DEREncodePublicKey(BufferedTransformation &bt) const; +}; + +//! EC private key +template +class DL_PrivateKey_EC : public DL_PrivateKeyImpl > +{ +public: + typedef typename EC::Point Element; + + void Initialize(const DL_GroupParameters_EC ¶ms, const Integer &x) + {this->AccessGroupParameters() = params; this->SetPrivateExponent(x);} + void Initialize(const EC &ec, const Element &G, const Integer &n, const Integer &x) + {this->AccessGroupParameters().Initialize(ec, G, n); this->SetPrivateExponent(x);} + void Initialize(RandomNumberGenerator &rng, const DL_GroupParameters_EC ¶ms) + {GenerateRandom(rng, params);} + void Initialize(RandomNumberGenerator &rng, const EC &ec, const Element &G, const Integer &n) + {GenerateRandom(rng, DL_GroupParameters_EC(ec, G, n));} + + // PKCS8PrivateKey + void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size); + void DEREncodePrivateKey(BufferedTransformation &bt) const; +}; + +//! Elliptic Curve Diffie-Hellman, AKA ECDH +template ::DefaultCofactorOption> +struct ECDH +{ + typedef DH_Domain, COFACTOR_OPTION> Domain; +}; + +/// Elliptic Curve Menezes-Qu-Vanstone, AKA ECMQV +template ::DefaultCofactorOption> +struct ECMQV +{ + typedef MQV_Domain, COFACTOR_OPTION> Domain; +}; + +//! EC keys +template +struct DL_Keys_EC +{ + typedef DL_PublicKey_EC PublicKey; + typedef DL_PrivateKey_EC PrivateKey; +}; + +template +struct ECDSA; + +//! ECDSA keys +template +struct DL_Keys_ECDSA +{ + typedef DL_PublicKey_EC PublicKey; + typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest, ECDSA > PrivateKey; +}; + +//! ECDSA algorithm +template +class DL_Algorithm_ECDSA : public DL_Algorithm_GDSA +{ +public: + static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECDSA";} +}; + +//! ECNR algorithm +template +class DL_Algorithm_ECNR : public DL_Algorithm_NR +{ +public: + static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECNR";} +}; + +//! ECDSA +template +struct ECDSA : public DL_SS, DL_Algorithm_ECDSA, DL_SignatureMessageEncodingMethod_DSA, H> +{ +}; + +//! ECNR +template +struct ECNR : public DL_SS, DL_Algorithm_ECNR, DL_SignatureMessageEncodingMethod_NR, H> +{ +}; + +//! Elliptic Curve Integrated Encryption Scheme, AKA ECIES +/*! Default to (NoCofactorMultiplication and DHAES_MODE = false) for compatibilty with SEC1 and Crypto++ 4.2. + The combination of (IncompatibleCofactorMultiplication and DHAES_MODE = true) is recommended for best + efficiency and security. */ +template +struct ECIES + : public DL_ES< + DL_Keys_EC, + DL_KeyAgreementAlgorithm_DH, + DL_KeyDerivationAlgorithm_P1363 >, + DL_EncryptionAlgorithm_Xor, DHAES_MODE>, + ECIES > +{ + static std::string CRYPTOPP_API StaticAlgorithmName() {return "ECIES";} // TODO: fix this after name is standardized +}; + +NAMESPACE_END + +#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#include "eccrypto.cpp" +#endif + +NAMESPACE_BEGIN(CryptoPP) + +CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl >; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl >; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl >; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl >; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest, ECDSA >; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest, ECDSA >; + +NAMESPACE_END + +#endif diff --git a/cryptopp/ecp.cpp b/cryptopp/ecp.cpp new file mode 100644 index 0000000..55a7cc1 --- /dev/null +++ b/cryptopp/ecp.cpp @@ -0,0 +1,473 @@ +// ecp.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "ecp.h" +#include "asn.h" +#include "nbtheory.h" + +#include "algebra.cpp" + +NAMESPACE_BEGIN(CryptoPP) + +ANONYMOUS_NAMESPACE_BEGIN +static inline ECP::Point ToMontgomery(const ModularArithmetic &mr, const ECP::Point &P) +{ + return P.identity ? P : ECP::Point(mr.ConvertIn(P.x), mr.ConvertIn(P.y)); +} + +static inline ECP::Point FromMontgomery(const ModularArithmetic &mr, const ECP::Point &P) +{ + return P.identity ? P : ECP::Point(mr.ConvertOut(P.x), mr.ConvertOut(P.y)); +} +NAMESPACE_END + +ECP::ECP(const ECP &ecp, bool convertToMontgomeryRepresentation) +{ + if (convertToMontgomeryRepresentation && !ecp.GetField().IsMontgomeryRepresentation()) + { + m_fieldPtr.reset(new MontgomeryRepresentation(ecp.GetField().GetModulus())); + m_a = GetField().ConvertIn(ecp.m_a); + m_b = GetField().ConvertIn(ecp.m_b); + } + else + operator=(ecp); +} + +ECP::ECP(BufferedTransformation &bt) + : m_fieldPtr(new Field(bt)) +{ + BERSequenceDecoder seq(bt); + GetField().BERDecodeElement(seq, m_a); + GetField().BERDecodeElement(seq, m_b); + // skip optional seed + if (!seq.EndReached()) + { + SecByteBlock seed; + unsigned int unused; + BERDecodeBitString(seq, seed, unused); + } + seq.MessageEnd(); +} + +void ECP::DEREncode(BufferedTransformation &bt) const +{ + GetField().DEREncode(bt); + DERSequenceEncoder seq(bt); + GetField().DEREncodeElement(seq, m_a); + GetField().DEREncodeElement(seq, m_b); + seq.MessageEnd(); +} + +bool ECP::DecodePoint(ECP::Point &P, const byte *encodedPoint, size_t encodedPointLen) const +{ + StringStore store(encodedPoint, encodedPointLen); + return DecodePoint(P, store, encodedPointLen); +} + +bool ECP::DecodePoint(ECP::Point &P, BufferedTransformation &bt, size_t encodedPointLen) const +{ + byte type; + if (encodedPointLen < 1 || !bt.Get(type)) + return false; + + switch (type) + { + case 0: + P.identity = true; + return true; + case 2: + case 3: + { + if (encodedPointLen != EncodedPointSize(true)) + return false; + + Integer p = FieldSize(); + + P.identity = false; + P.x.Decode(bt, GetField().MaxElementByteLength()); + P.y = ((P.x*P.x+m_a)*P.x+m_b) % p; + + if (Jacobi(P.y, p) !=1) + return false; + + P.y = ModularSquareRoot(P.y, p); + + if ((type & 1) != P.y.GetBit(0)) + P.y = p-P.y; + + return true; + } + case 4: + { + if (encodedPointLen != EncodedPointSize(false)) + return false; + + unsigned int len = GetField().MaxElementByteLength(); + P.identity = false; + P.x.Decode(bt, len); + P.y.Decode(bt, len); + return true; + } + default: + return false; + } +} + +void ECP::EncodePoint(BufferedTransformation &bt, const Point &P, bool compressed) const +{ + if (P.identity) + NullStore().TransferTo(bt, EncodedPointSize(compressed)); + else if (compressed) + { + bt.Put(2 + P.y.GetBit(0)); + P.x.Encode(bt, GetField().MaxElementByteLength()); + } + else + { + unsigned int len = GetField().MaxElementByteLength(); + bt.Put(4); // uncompressed + P.x.Encode(bt, len); + P.y.Encode(bt, len); + } +} + +void ECP::EncodePoint(byte *encodedPoint, const Point &P, bool compressed) const +{ + ArraySink sink(encodedPoint, EncodedPointSize(compressed)); + EncodePoint(sink, P, compressed); + assert(sink.TotalPutLength() == EncodedPointSize(compressed)); +} + +ECP::Point ECP::BERDecodePoint(BufferedTransformation &bt) const +{ + SecByteBlock str; + BERDecodeOctetString(bt, str); + Point P; + if (!DecodePoint(P, str, str.size())) + BERDecodeError(); + return P; +} + +void ECP::DEREncodePoint(BufferedTransformation &bt, const Point &P, bool compressed) const +{ + SecByteBlock str(EncodedPointSize(compressed)); + EncodePoint(str, P, compressed); + DEREncodeOctetString(bt, str); +} + +bool ECP::ValidateParameters(RandomNumberGenerator &rng, unsigned int level) const +{ + Integer p = FieldSize(); + + bool pass = p.IsOdd(); + pass = pass && !m_a.IsNegative() && m_a

= 1) + pass = pass && ((4*m_a*m_a*m_a+27*m_b*m_b)%p).IsPositive(); + + if (level >= 2) + pass = pass && VerifyPrime(rng, p); + + return pass; +} + +bool ECP::VerifyPoint(const Point &P) const +{ + const FieldElement &x = P.x, &y = P.y; + Integer p = FieldSize(); + return P.identity || + (!x.IsNegative() && x

().Ref(); +} + +const ECP::Point& ECP::Inverse(const Point &P) const +{ + if (P.identity) + return P; + else + { + m_R.identity = false; + m_R.x = P.x; + m_R.y = GetField().Inverse(P.y); + return m_R; + } +} + +const ECP::Point& ECP::Add(const Point &P, const Point &Q) const +{ + if (P.identity) return Q; + if (Q.identity) return P; + if (GetField().Equal(P.x, Q.x)) + return GetField().Equal(P.y, Q.y) ? Double(P) : Identity(); + + FieldElement t = GetField().Subtract(Q.y, P.y); + t = GetField().Divide(t, GetField().Subtract(Q.x, P.x)); + FieldElement x = GetField().Subtract(GetField().Subtract(GetField().Square(t), P.x), Q.x); + m_R.y = GetField().Subtract(GetField().Multiply(t, GetField().Subtract(P.x, x)), P.y); + + m_R.x.swap(x); + m_R.identity = false; + return m_R; +} + +const ECP::Point& ECP::Double(const Point &P) const +{ + if (P.identity || P.y==GetField().Identity()) return Identity(); + + FieldElement t = GetField().Square(P.x); + t = GetField().Add(GetField().Add(GetField().Double(t), t), m_a); + t = GetField().Divide(t, GetField().Double(P.y)); + FieldElement x = GetField().Subtract(GetField().Subtract(GetField().Square(t), P.x), P.x); + m_R.y = GetField().Subtract(GetField().Multiply(t, GetField().Subtract(P.x, x)), P.y); + + m_R.x.swap(x); + m_R.identity = false; + return m_R; +} + +template void ParallelInvert(const AbstractRing &ring, Iterator begin, Iterator end) +{ + size_t n = end-begin; + if (n == 1) + *begin = ring.MultiplicativeInverse(*begin); + else if (n > 1) + { + std::vector vec((n+1)/2); + unsigned int i; + Iterator it; + + for (i=0, it=begin; i::iterator it) : it(it) {} + Integer& operator*() {return it->z;} + int operator-(ZIterator it2) {return int(it-it2.it);} + ZIterator operator+(int i) {return ZIterator(it+i);} + ZIterator& operator+=(int i) {it+=i; return *this;} + std::vector::iterator it; +}; + +ECP::Point ECP::ScalarMultiply(const Point &P, const Integer &k) const +{ + Element result; + if (k.BitCount() <= 5) + AbstractGroup::SimultaneousMultiply(&result, P, &k, 1); + else + ECP::SimultaneousMultiply(&result, P, &k, 1); + return result; +} + +void ECP::SimultaneousMultiply(ECP::Point *results, const ECP::Point &P, const Integer *expBegin, unsigned int expCount) const +{ + if (!GetField().IsMontgomeryRepresentation()) + { + ECP ecpmr(*this, true); + const ModularArithmetic &mr = ecpmr.GetField(); + ecpmr.SimultaneousMultiply(results, ToMontgomery(mr, P), expBegin, expCount); + for (unsigned int i=0; i bases; + std::vector exponents; + exponents.reserve(expCount); + std::vector > baseIndices(expCount); + std::vector > negateBase(expCount); + std::vector > exponentWindows(expCount); + unsigned int i; + + for (i=0; iNotNegative()); + exponents.push_back(WindowSlider(*expBegin++, InversionIsFast(), 5)); + exponents[i].FindNextWindow(); + } + + unsigned int expBitPosition = 0; + bool notDone = true; + + while (notDone) + { + notDone = false; + bool baseAdded = false; + for (i=0; i > finalCascade; + for (i=0; i::CascadeScalarMultiply(P, k1, Q, k2); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/ecp.h b/cryptopp/ecp.h new file mode 100644 index 0000000..d946be6 --- /dev/null +++ b/cryptopp/ecp.h @@ -0,0 +1,126 @@ +#ifndef CRYPTOPP_ECP_H +#define CRYPTOPP_ECP_H + +#include "modarith.h" +#include "eprecomp.h" +#include "smartptr.h" +#include "pubkey.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! Elliptical Curve Point +struct CRYPTOPP_DLL ECPPoint +{ + ECPPoint() : identity(true) {} + ECPPoint(const Integer &x, const Integer &y) + : identity(false), x(x), y(y) {} + + bool operator==(const ECPPoint &t) const + {return (identity && t.identity) || (!identity && !t.identity && x==t.x && y==t.y);} + bool operator< (const ECPPoint &t) const + {return identity ? !t.identity : (!t.identity && (x; + +//! Elliptic Curve over GF(p), where p is prime +class CRYPTOPP_DLL ECP : public AbstractGroup +{ +public: + typedef ModularArithmetic Field; + typedef Integer FieldElement; + typedef ECPPoint Point; + + ECP() {} + ECP(const ECP &ecp, bool convertToMontgomeryRepresentation = false); + ECP(const Integer &modulus, const FieldElement &a, const FieldElement &b) + : m_fieldPtr(new Field(modulus)), m_a(a.IsNegative() ? modulus+a : a), m_b(b) {} + // construct from BER encoded parameters + // this constructor will decode and extract the the fields fieldID and curve of the sequence ECParameters + ECP(BufferedTransformation &bt); + + // encode the fields fieldID and curve of the sequence ECParameters + void DEREncode(BufferedTransformation &bt) const; + + bool Equal(const Point &P, const Point &Q) const; + const Point& Identity() const; + const Point& Inverse(const Point &P) const; + bool InversionIsFast() const {return true;} + const Point& Add(const Point &P, const Point &Q) const; + const Point& Double(const Point &P) const; + Point ScalarMultiply(const Point &P, const Integer &k) const; + Point CascadeScalarMultiply(const Point &P, const Integer &k1, const Point &Q, const Integer &k2) const; + void SimultaneousMultiply(Point *results, const Point &base, const Integer *exponents, unsigned int exponentsCount) const; + + Point Multiply(const Integer &k, const Point &P) const + {return ScalarMultiply(P, k);} + Point CascadeMultiply(const Integer &k1, const Point &P, const Integer &k2, const Point &Q) const + {return CascadeScalarMultiply(P, k1, Q, k2);} + + bool ValidateParameters(RandomNumberGenerator &rng, unsigned int level=3) const; + bool VerifyPoint(const Point &P) const; + + unsigned int EncodedPointSize(bool compressed = false) const + {return 1 + (compressed?1:2)*GetField().MaxElementByteLength();} + // returns false if point is compressed and not valid (doesn't check if uncompressed) + bool DecodePoint(Point &P, BufferedTransformation &bt, size_t len) const; + bool DecodePoint(Point &P, const byte *encodedPoint, size_t len) const; + void EncodePoint(byte *encodedPoint, const Point &P, bool compressed) const; + void EncodePoint(BufferedTransformation &bt, const Point &P, bool compressed) const; + + Point BERDecodePoint(BufferedTransformation &bt) const; + void DEREncodePoint(BufferedTransformation &bt, const Point &P, bool compressed) const; + + Integer FieldSize() const {return GetField().GetModulus();} + const Field & GetField() const {return *m_fieldPtr;} + const FieldElement & GetA() const {return m_a;} + const FieldElement & GetB() const {return m_b;} + + bool operator==(const ECP &rhs) const + {return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;} + +private: + clonable_ptr m_fieldPtr; + FieldElement m_a, m_b; + mutable Point m_R; +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupPrecomputation; + +template class EcPrecomputation; + +//! ECP precomputation +template<> class EcPrecomputation : public DL_GroupPrecomputation +{ +public: + typedef ECP EllipticCurve; + + // DL_GroupPrecomputation + bool NeedConversions() const {return true;} + Element ConvertIn(const Element &P) const + {return P.identity ? P : ECP::Point(m_ec->GetField().ConvertIn(P.x), m_ec->GetField().ConvertIn(P.y));}; + Element ConvertOut(const Element &P) const + {return P.identity ? P : ECP::Point(m_ec->GetField().ConvertOut(P.x), m_ec->GetField().ConvertOut(P.y));} + const AbstractGroup & GetGroup() const {return *m_ec;} + Element BERDecodeElement(BufferedTransformation &bt) const {return m_ec->BERDecodePoint(bt);} + void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {m_ec->DEREncodePoint(bt, v, false);} + + // non-inherited + void SetCurve(const ECP &ec) + { + m_ec.reset(new ECP(ec, true)); + m_ecOriginal = ec; + } + const ECP & GetCurve() const {return *m_ecOriginal;} + +private: + value_ptr m_ec, m_ecOriginal; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/elgamal.cpp b/cryptopp/elgamal.cpp new file mode 100644 index 0000000..b58fe7c --- /dev/null +++ b/cryptopp/elgamal.cpp @@ -0,0 +1,17 @@ +// elgamal.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "elgamal.h" +#include "asn.h" +#include "nbtheory.h" + +NAMESPACE_BEGIN(CryptoPP) + +void ElGamal_TestInstantiations() +{ + ElGamalEncryptor test1(1, 1, 1); + ElGamalDecryptor test2(NullRNG(), 123); + ElGamalEncryptor test3(test2); +} + +NAMESPACE_END diff --git a/cryptopp/elgamal.h b/cryptopp/elgamal.h new file mode 100644 index 0000000..9afc30e --- /dev/null +++ b/cryptopp/elgamal.h @@ -0,0 +1,121 @@ +#ifndef CRYPTOPP_ELGAMAL_H +#define CRYPTOPP_ELGAMAL_H + +#include "modexppc.h" +#include "dsa.h" + +NAMESPACE_BEGIN(CryptoPP) + +class CRYPTOPP_NO_VTABLE ElGamalBase : public DL_KeyAgreementAlgorithm_DH, + public DL_KeyDerivationAlgorithm, + public DL_SymmetricEncryptionAlgorithm +{ +public: + void Derive(const DL_GroupParameters &groupParams, byte *derivedKey, size_t derivedLength, const Integer &agreedElement, const Integer &ephemeralPublicKey, const NameValuePairs &derivationParams) const + { + agreedElement.Encode(derivedKey, derivedLength); + } + + size_t GetSymmetricKeyLength(size_t plainTextLength) const + { + return GetGroupParameters().GetModulus().ByteCount(); + } + + size_t GetSymmetricCiphertextLength(size_t plainTextLength) const + { + unsigned int len = GetGroupParameters().GetModulus().ByteCount(); + if (plainTextLength <= GetMaxSymmetricPlaintextLength(len)) + return len; + else + return 0; + } + + size_t GetMaxSymmetricPlaintextLength(size_t cipherTextLength) const + { + unsigned int len = GetGroupParameters().GetModulus().ByteCount(); + if (cipherTextLength == len) + return STDMIN(255U, len-3); + else + return 0; + } + + void SymmetricEncrypt(RandomNumberGenerator &rng, const byte *key, const byte *plainText, size_t plainTextLength, byte *cipherText, const NameValuePairs ¶meters) const + { + const Integer &p = GetGroupParameters().GetModulus(); + unsigned int modulusLen = p.ByteCount(); + + SecByteBlock block(modulusLen-1); + rng.GenerateBlock(block, modulusLen-2-plainTextLength); + memcpy(block+modulusLen-2-plainTextLength, plainText, plainTextLength); + block[modulusLen-2] = (byte)plainTextLength; + + a_times_b_mod_c(Integer(key, modulusLen), Integer(block, modulusLen-1), p).Encode(cipherText, modulusLen); + } + + DecodingResult SymmetricDecrypt(const byte *key, const byte *cipherText, size_t cipherTextLength, byte *plainText, const NameValuePairs ¶meters) const + { + const Integer &p = GetGroupParameters().GetModulus(); + unsigned int modulusLen = p.ByteCount(); + + if (cipherTextLength != modulusLen) + return DecodingResult(); + + Integer m = a_times_b_mod_c(Integer(cipherText, modulusLen), Integer(key, modulusLen).InverseMod(p), p); + + m.Encode(plainText, 1); + unsigned int plainTextLength = plainText[0]; + if (plainTextLength > GetMaxSymmetricPlaintextLength(modulusLen)) + return DecodingResult(); + m >>= 8; + m.Encode(plainText, plainTextLength); + return DecodingResult(plainTextLength); + } + + virtual const DL_GroupParameters_GFP & GetGroupParameters() const =0; +}; + +template +class ElGamalObjectImpl : public DL_ObjectImplBase, public ElGamalBase +{ +public: + size_t FixedMaxPlaintextLength() const {return this->MaxPlaintextLength(FixedCiphertextLength());} + size_t FixedCiphertextLength() const {return this->CiphertextLength(0);} + + const DL_GroupParameters_GFP & GetGroupParameters() const {return this->GetKey().GetGroupParameters();} + + DecodingResult FixedLengthDecrypt(RandomNumberGenerator &rng, const byte *cipherText, byte *plainText) const + {return Decrypt(rng, cipherText, FixedCiphertextLength(), plainText);} + +protected: + const DL_KeyAgreementAlgorithm & GetKeyAgreementAlgorithm() const {return *this;} + const DL_KeyDerivationAlgorithm & GetKeyDerivationAlgorithm() const {return *this;} + const DL_SymmetricEncryptionAlgorithm & GetSymmetricEncryptionAlgorithm() const {return *this;} +}; + +struct ElGamalKeys +{ + typedef DL_CryptoKeys_GFP::GroupParameters GroupParameters; + typedef DL_PrivateKey_GFP_OldFormat PrivateKey; + typedef DL_PublicKey_GFP_OldFormat PublicKey; +}; + +//! ElGamal encryption scheme with non-standard padding +struct ElGamal +{ + typedef DL_CryptoSchemeOptions SchemeOptions; + + static const char * StaticAlgorithmName() {return "ElgamalEnc/Crypto++Padding";} + + typedef SchemeOptions::GroupParameters GroupParameters; + //! implements PK_Encryptor interface + typedef PK_FinalTemplate, SchemeOptions, SchemeOptions::PublicKey> > Encryptor; + //! implements PK_Decryptor interface + typedef PK_FinalTemplate, SchemeOptions, SchemeOptions::PrivateKey> > Decryptor; +}; + +typedef ElGamal::Encryptor ElGamalEncryptor; +typedef ElGamal::Decryptor ElGamalDecryptor; + +NAMESPACE_END + +#endif diff --git a/cryptopp/emsa2.cpp b/cryptopp/emsa2.cpp new file mode 100644 index 0000000..3dbb7e8 --- /dev/null +++ b/cryptopp/emsa2.cpp @@ -0,0 +1,34 @@ +// emsa2.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "emsa2.h" + +#ifndef CRYPTOPP_IMPORTS + +NAMESPACE_BEGIN(CryptoPP) + +void EMSA2Pad::ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const +{ + assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize())); + + if (representativeBitLength % 8 != 7) + throw PK_SignatureScheme::InvalidKeyLength("EMSA2: EMSA2 requires a key length that is a multiple of 8"); + + size_t digestSize = hash.DigestSize(); + size_t representativeByteLength = BitsToBytes(representativeBitLength); + + representative[0] = messageEmpty ? 0x4b : 0x6b; + memset(representative+1, 0xbb, representativeByteLength-digestSize-4); // pad with 0xbb + byte *afterP2 = representative+representativeByteLength-digestSize-3; + afterP2[0] = 0xba; + hash.Final(afterP2+1); + representative[representativeByteLength-2] = *hashIdentifier.first; + representative[representativeByteLength-1] = 0xcc; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/emsa2.h b/cryptopp/emsa2.h new file mode 100644 index 0000000..49109e6 --- /dev/null +++ b/cryptopp/emsa2.h @@ -0,0 +1,86 @@ +#ifndef CRYPTOPP_EMSA2_H +#define CRYPTOPP_EMSA2_H + +/** \file + This file contains various padding schemes for public key algorithms. +*/ + +#include "cryptlib.h" +#include "pubkey.h" + +#ifdef CRYPTOPP_IS_DLL +#include "sha.h" +#endif + +NAMESPACE_BEGIN(CryptoPP) + +template class EMSA2HashId +{ +public: + static const byte id; +}; + +template +class EMSA2HashIdLookup : public BASE +{ +public: + struct HashIdentifierLookup + { + template struct HashIdentifierLookup2 + { + static HashIdentifier Lookup() + { + return HashIdentifier(&EMSA2HashId::id, 1); + } + }; + }; +}; + +// EMSA2HashId can be instantiated with the following classes. +class SHA1; +class RIPEMD160; +class RIPEMD128; +class SHA256; +class SHA384; +class SHA512; +class Whirlpool; +class SHA224; +// end of list + +#ifdef CRYPTOPP_IS_DLL +CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId; +CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId; +CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId; +CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId; +CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId; +#endif + +//! _ +class CRYPTOPP_DLL EMSA2Pad : public EMSA2HashIdLookup +{ +public: + static const char * CRYPTOPP_API StaticAlgorithmName() {return "EMSA2";} + + size_t MinRepresentativeBitLength(size_t hashIdentifierLength, size_t digestLength) const + {return 8*digestLength + 31;} + + void ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const; +}; + +//! EMSA2, for use with RWSS and RSA_ISO +/*! Only the following hash functions are supported by this signature standard: + \dontinclude emsa2.h + \skip EMSA2HashId can be instantiated + \until end of list +*/ +struct P1363_EMSA2 : public SignatureStandard +{ + typedef EMSA2Pad SignatureMessageEncodingMethod; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/eprecomp.cpp b/cryptopp/eprecomp.cpp new file mode 100644 index 0000000..a061cf6 --- /dev/null +++ b/cryptopp/eprecomp.cpp @@ -0,0 +1,112 @@ +// eprecomp.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "eprecomp.h" +#include "asn.h" + +NAMESPACE_BEGIN(CryptoPP) + +template void DL_FixedBasePrecomputationImpl::SetBase(const DL_GroupPrecomputation &group, const Element &i_base) +{ + m_base = group.NeedConversions() ? group.ConvertIn(i_base) : i_base; + + if (m_bases.empty() || !(m_base == m_bases[0])) + { + m_bases.resize(1); + m_bases[0] = m_base; + } + + if (group.NeedConversions()) + m_base = i_base; +} + +template void DL_FixedBasePrecomputationImpl::Precompute(const DL_GroupPrecomputation &group, unsigned int maxExpBits, unsigned int storage) +{ + assert(m_bases.size() > 0); + assert(storage <= maxExpBits); + + if (storage > 1) + { + m_windowSize = (maxExpBits+storage-1)/storage; + m_exponentBase = Integer::Power2(m_windowSize); + } + + m_bases.resize(storage); + for (unsigned i=1; i void DL_FixedBasePrecomputationImpl::Load(const DL_GroupPrecomputation &group, BufferedTransformation &bt) +{ + BERSequenceDecoder seq(bt); + word32 version; + BERDecodeUnsigned(seq, version, INTEGER, 1, 1); + m_exponentBase.BERDecode(seq); + m_windowSize = m_exponentBase.BitCount() - 1; + m_bases.clear(); + while (!seq.EndReached()) + m_bases.push_back(group.BERDecodeElement(seq)); + if (!m_bases.empty() && group.NeedConversions()) + m_base = group.ConvertOut(m_bases[0]); + seq.MessageEnd(); +} + +template void DL_FixedBasePrecomputationImpl::Save(const DL_GroupPrecomputation &group, BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + DEREncodeUnsigned(seq, 1); // version + m_exponentBase.DEREncode(seq); + for (unsigned i=0; i void DL_FixedBasePrecomputationImpl::PrepareCascade(const DL_GroupPrecomputation &i_group, std::vector > &eb, const Integer &exponent) const +{ + const AbstractGroup &group = i_group.GetGroup(); + + Integer r, q, e = exponent; + bool fastNegate = group.InversionIsFast() && m_windowSize > 1; + unsigned int i; + + for (i=0; i+1(group.Inverse(m_bases[i]), m_exponentBase - r)); + } + else + eb.push_back(BaseAndExponent(m_bases[i], r)); + } + eb.push_back(BaseAndExponent(m_bases[i], e)); +} + +template T DL_FixedBasePrecomputationImpl::Exponentiate(const DL_GroupPrecomputation &group, const Integer &exponent) const +{ + std::vector > eb; // array of segments of the exponent and precalculated bases + eb.reserve(m_bases.size()); + PrepareCascade(group, eb, exponent); + return group.ConvertOut(GeneralCascadeMultiplication(group.GetGroup(), eb.begin(), eb.end())); +} + +template T + DL_FixedBasePrecomputationImpl::CascadeExponentiate(const DL_GroupPrecomputation &group, const Integer &exponent, + const DL_FixedBasePrecomputation &i_pc2, const Integer &exponent2) const +{ + std::vector > eb; // array of segments of the exponent and precalculated bases + const DL_FixedBasePrecomputationImpl &pc2 = static_cast &>(i_pc2); + eb.reserve(m_bases.size() + pc2.m_bases.size()); + PrepareCascade(group, eb, exponent); + pc2.PrepareCascade(group, eb, exponent2); + return group.ConvertOut(GeneralCascadeMultiplication(group.GetGroup(), eb.begin(), eb.end())); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/eprecomp.h b/cryptopp/eprecomp.h new file mode 100644 index 0000000..1f32567 --- /dev/null +++ b/cryptopp/eprecomp.h @@ -0,0 +1,75 @@ +#ifndef CRYPTOPP_EPRECOMP_H +#define CRYPTOPP_EPRECOMP_H + +#include "integer.h" +#include "algebra.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +template +class DL_GroupPrecomputation +{ +public: + typedef T Element; + + virtual bool NeedConversions() const {return false;} + virtual Element ConvertIn(const Element &v) const {return v;} + virtual Element ConvertOut(const Element &v) const {return v;} + virtual const AbstractGroup & GetGroup() const =0; + virtual Element BERDecodeElement(BufferedTransformation &bt) const =0; + virtual void DEREncodeElement(BufferedTransformation &bt, const Element &P) const =0; +}; + +template +class DL_FixedBasePrecomputation +{ +public: + typedef T Element; + + virtual bool IsInitialized() const =0; + virtual void SetBase(const DL_GroupPrecomputation &group, const Element &base) =0; + virtual const Element & GetBase(const DL_GroupPrecomputation &group) const =0; + virtual void Precompute(const DL_GroupPrecomputation &group, unsigned int maxExpBits, unsigned int storage) =0; + virtual void Load(const DL_GroupPrecomputation &group, BufferedTransformation &storedPrecomputation) =0; + virtual void Save(const DL_GroupPrecomputation &group, BufferedTransformation &storedPrecomputation) const =0; + virtual Element Exponentiate(const DL_GroupPrecomputation &group, const Integer &exponent) const =0; + virtual Element CascadeExponentiate(const DL_GroupPrecomputation &group, const Integer &exponent, const DL_FixedBasePrecomputation &pc2, const Integer &exponent2) const =0; +}; + +template +class DL_FixedBasePrecomputationImpl : public DL_FixedBasePrecomputation +{ +public: + typedef T Element; + + DL_FixedBasePrecomputationImpl() : m_windowSize(0) {} + + // DL_FixedBasePrecomputation + bool IsInitialized() const + {return !m_bases.empty();} + void SetBase(const DL_GroupPrecomputation &group, const Element &base); + const Element & GetBase(const DL_GroupPrecomputation &group) const + {return group.NeedConversions() ? m_base : m_bases[0];} + void Precompute(const DL_GroupPrecomputation &group, unsigned int maxExpBits, unsigned int storage); + void Load(const DL_GroupPrecomputation &group, BufferedTransformation &storedPrecomputation); + void Save(const DL_GroupPrecomputation &group, BufferedTransformation &storedPrecomputation) const; + Element Exponentiate(const DL_GroupPrecomputation &group, const Integer &exponent) const; + Element CascadeExponentiate(const DL_GroupPrecomputation &group, const Integer &exponent, const DL_FixedBasePrecomputation &pc2, const Integer &exponent2) const; + +private: + void PrepareCascade(const DL_GroupPrecomputation &group, std::vector > &eb, const Integer &exponent) const; + + Element m_base; + unsigned int m_windowSize; + Integer m_exponentBase; // what base to represent the exponent in + std::vector m_bases; // precalculated bases +}; + +NAMESPACE_END + +#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#include "eprecomp.cpp" +#endif + +#endif diff --git a/cryptopp/esign.cpp b/cryptopp/esign.cpp new file mode 100644 index 0000000..8b42c1f --- /dev/null +++ b/cryptopp/esign.cpp @@ -0,0 +1,210 @@ +// esign.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "esign.h" +#include "asn.h" +#include "modarith.h" +#include "nbtheory.h" +#include "sha.h" +#include "algparam.h" + +NAMESPACE_BEGIN(CryptoPP) + +void ESIGN_TestInstantiations() +{ + ESIGN::Verifier x1(1, 1); + ESIGN::Signer x2(NullRNG(), 1); + ESIGN::Verifier x3(x2); + ESIGN::Verifier x4(x2.GetKey()); + ESIGN::Verifier x5(x3); + ESIGN::Signer x6 = x2; + + x6 = x2; + x3 = ESIGN::Verifier(x2); + x4 = x2.GetKey(); +} + +void ESIGNFunction::BERDecode(BufferedTransformation &bt) +{ + BERSequenceDecoder seq(bt); + m_n.BERDecode(seq); + m_e.BERDecode(seq); + seq.MessageEnd(); +} + +void ESIGNFunction::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + m_n.DEREncode(seq); + m_e.DEREncode(seq); + seq.MessageEnd(); +} + +Integer ESIGNFunction::ApplyFunction(const Integer &x) const +{ + DoQuickSanityCheck(); + return STDMIN(a_exp_b_mod_c(x, m_e, m_n) >> (2*GetK()+2), MaxImage()); +} + +bool ESIGNFunction::Validate(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = true; + pass = pass && m_n > Integer::One() && m_n.IsOdd(); + pass = pass && m_e >= 8 && m_e < m_n; + return pass; +} + +bool ESIGNFunction::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Modulus) + CRYPTOPP_GET_FUNCTION_ENTRY(PublicExponent) + ; +} + +void ESIGNFunction::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Modulus) + CRYPTOPP_SET_FUNCTION_ENTRY(PublicExponent) + ; +} + +// ***************************************************************************** + +void InvertibleESIGNFunction::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶m) +{ + int modulusSize = 1023*2; + param.GetIntValue("ModulusSize", modulusSize) || param.GetIntValue("KeySize", modulusSize); + + if (modulusSize < 24) + throw InvalidArgument("InvertibleESIGNFunction: specified modulus size is too small"); + + if (modulusSize % 3 != 0) + throw InvalidArgument("InvertibleESIGNFunction: modulus size must be divisible by 3"); + + m_e = param.GetValueWithDefault("PublicExponent", Integer(32)); + + if (m_e < 8) + throw InvalidArgument("InvertibleESIGNFunction: public exponents less than 8 may not be secure"); + + // VC70 workaround: putting these after primeParam causes overlapped stack allocation + ConstByteArrayParameter seedParam; + SecByteBlock seed; + + const Integer minP = Integer(204) << (modulusSize/3-8); + const Integer maxP = Integer::Power2(modulusSize/3)-1; + AlgorithmParameters primeParam = MakeParameters("Min", minP)("Max", maxP)("RandomNumberType", Integer::PRIME); + + if (param.GetValue("Seed", seedParam)) + { + seed.resize(seedParam.size() + 4); + memcpy(seed + 4, seedParam.begin(), seedParam.size()); + + PutWord(false, BIG_ENDIAN_ORDER, seed, (word32)0); + m_p.GenerateRandom(rng, CombinedNameValuePairs(primeParam, MakeParameters("Seed", ConstByteArrayParameter(seed)))); + PutWord(false, BIG_ENDIAN_ORDER, seed, (word32)1); + m_q.GenerateRandom(rng, CombinedNameValuePairs(primeParam, MakeParameters("Seed", ConstByteArrayParameter(seed)))); + } + else + { + m_p.GenerateRandom(rng, primeParam); + m_q.GenerateRandom(rng, primeParam); + } + + m_n = m_p * m_p * m_q; + + assert(m_n.BitCount() == modulusSize); +} + +void InvertibleESIGNFunction::BERDecode(BufferedTransformation &bt) +{ + BERSequenceDecoder privateKey(bt); + m_n.BERDecode(privateKey); + m_e.BERDecode(privateKey); + m_p.BERDecode(privateKey); + m_q.BERDecode(privateKey); + privateKey.MessageEnd(); +} + +void InvertibleESIGNFunction::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder privateKey(bt); + m_n.DEREncode(privateKey); + m_e.DEREncode(privateKey); + m_p.DEREncode(privateKey); + m_q.DEREncode(privateKey); + privateKey.MessageEnd(); +} + +Integer InvertibleESIGNFunction::CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const +{ + DoQuickSanityCheck(); + + Integer pq = m_p * m_q; + Integer p2 = m_p * m_p; + Integer r, z, re, a, w0, w1; + + do + { + r.Randomize(rng, Integer::Zero(), pq); + z = x << (2*GetK()+2); + re = a_exp_b_mod_c(r, m_e, m_n); + a = (z - re) % m_n; + Integer::Divide(w1, w0, a, pq); + if (w1.NotZero()) + { + ++w0; + w1 = pq - w1; + } + } + while ((w1 >> 2*GetK()+1).IsPositive()); + + ModularArithmetic modp(m_p); + Integer t = modp.Divide(w0 * r % m_p, m_e * re % m_p); + Integer s = r + t*pq; + assert(s < m_n); +/* + using namespace std; + cout << "f = " << x << endl; + cout << "r = " << r << endl; + cout << "z = " << z << endl; + cout << "a = " << a << endl; + cout << "w0 = " << w0 << endl; + cout << "w1 = " << w1 << endl; + cout << "t = " << t << endl; + cout << "s = " << s << endl; +*/ + return s; +} + +bool InvertibleESIGNFunction::Validate(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = ESIGNFunction::Validate(rng, level); + pass = pass && m_p > Integer::One() && m_p.IsOdd() && m_p < m_n; + pass = pass && m_q > Integer::One() && m_q.IsOdd() && m_q < m_n; + pass = pass && m_p.BitCount() == m_q.BitCount(); + if (level >= 1) + pass = pass && m_p * m_p * m_q == m_n; + if (level >= 2) + pass = pass && VerifyPrime(rng, m_p, level-2) && VerifyPrime(rng, m_q, level-2); + return pass; +} + +bool InvertibleESIGNFunction::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Prime1) + CRYPTOPP_GET_FUNCTION_ENTRY(Prime2) + ; +} + +void InvertibleESIGNFunction::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Prime1) + CRYPTOPP_SET_FUNCTION_ENTRY(Prime2) + ; +} + +NAMESPACE_END diff --git a/cryptopp/esign.h b/cryptopp/esign.h new file mode 100644 index 0000000..8eecbc5 --- /dev/null +++ b/cryptopp/esign.h @@ -0,0 +1,128 @@ +#ifndef CRYPTOPP_ESIGN_H +#define CRYPTOPP_ESIGN_H + +/** \file + This file contains classes that implement the + ESIGN signature schemes as defined in IEEE P1363a. +*/ + +#include "pubkey.h" +#include "integer.h" +#include "asn.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class ESIGNFunction : public TrapdoorFunction, public ASN1CryptoMaterial +{ + typedef ESIGNFunction ThisClass; + +public: + void Initialize(const Integer &n, const Integer &e) + {m_n = n; m_e = e;} + + // PublicKey + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + // CryptoMaterial + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + + // TrapdoorFunction + Integer ApplyFunction(const Integer &x) const; + Integer PreimageBound() const {return m_n;} + Integer ImageBound() const {return Integer::Power2(GetK());} + + // non-derived + const Integer & GetModulus() const {return m_n;} + const Integer & GetPublicExponent() const {return m_e;} + + void SetModulus(const Integer &n) {m_n = n;} + void SetPublicExponent(const Integer &e) {m_e = e;} + +protected: + unsigned int GetK() const {return m_n.BitCount()/3-1;} + + Integer m_n, m_e; +}; + +//! _ +class InvertibleESIGNFunction : public ESIGNFunction, public RandomizedTrapdoorFunctionInverse, public PrivateKey +{ + typedef InvertibleESIGNFunction ThisClass; + +public: + void Initialize(const Integer &n, const Integer &e, const Integer &p, const Integer &q) + {m_n = n; m_e = e; m_p = p; m_q = q;} + // generate a random private key + void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits) + {GenerateRandomWithKeySize(rng, modulusBits);} + + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const; + + // GeneratibleCryptoMaterial + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + /*! parameters: (ModulusSize) */ + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg); + + const Integer& GetPrime1() const {return m_p;} + const Integer& GetPrime2() const {return m_q;} + + void SetPrime1(const Integer &p) {m_p = p;} + void SetPrime2(const Integer &q) {m_q = q;} + +protected: + Integer m_p, m_q; +}; + +//! _ +template +class EMSA5Pad : public PK_DeterministicSignatureMessageEncodingMethod +{ +public: + static const char *StaticAlgorithmName() {return "EMSA5";} + + void ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const + { + SecByteBlock digest(hash.DigestSize()); + hash.Final(digest); + size_t representativeByteLength = BitsToBytes(representativeBitLength); + T mgf; + mgf.GenerateAndMask(hash, representative, representativeByteLength, digest, digest.size(), false); + if (representativeBitLength % 8 != 0) + representative[0] = (byte)Crop(representative[0], representativeBitLength % 8); + } +}; + +//! EMSA5, for use with ESIGN +struct P1363_EMSA5 : public SignatureStandard +{ + typedef EMSA5Pad SignatureMessageEncodingMethod; +}; + +struct ESIGN_Keys +{ + static std::string StaticAlgorithmName() {return "ESIGN";} + typedef ESIGNFunction PublicKey; + typedef InvertibleESIGNFunction PrivateKey; +}; + +//! ESIGN, as defined in IEEE P1363a +template +struct ESIGN : public TF_SS +{ +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/factory.h b/cryptopp/factory.h new file mode 100644 index 0000000..ef5a59e --- /dev/null +++ b/cryptopp/factory.h @@ -0,0 +1,135 @@ +#ifndef CRYPTOPP_OBJFACT_H +#define CRYPTOPP_OBJFACT_H + +#include "cryptlib.h" +#include +#include + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +template +class ObjectFactory +{ +public: + virtual AbstractClass * CreateObject() const =0; +}; + +//! _ +template +class DefaultObjectFactory : public ObjectFactory +{ +public: + AbstractClass * CreateObject() const + { + return new ConcreteClass; + } + +}; + +//! _ +template +class ObjectFactoryRegistry +{ +public: + class FactoryNotFound : public Exception + { + public: + FactoryNotFound(const char *name) : Exception(OTHER_ERROR, std::string("ObjectFactoryRegistry: could not find factory for algorithm ") + name) {} + }; + + ~ObjectFactoryRegistry() + { + for (CPP_TYPENAME Map::iterator i = m_map.begin(); i != m_map.end(); ++i) + { + delete (ObjectFactory *)i->second; + i->second = NULL; + } + } + + void RegisterFactory(const std::string &name, ObjectFactory *factory) + { + m_map[name] = factory; + } + + const ObjectFactory * GetFactory(const char *name) const + { + CPP_TYPENAME Map::const_iterator i = m_map.find(name); + return i == m_map.end() ? NULL : (ObjectFactory *)i->second; + } + + AbstractClass *CreateObject(const char *name) const + { + const ObjectFactory *factory = GetFactory(name); + if (!factory) + throw FactoryNotFound(name); + return factory->CreateObject(); + } + + // Return a vector containing the factory names. This is easier than returning an iterator. + // from Andrew Pitonyak + std::vector GetFactoryNames() const + { + std::vector names; + CPP_TYPENAME Map::const_iterator iter; + for (iter = m_map.begin(); iter != m_map.end(); ++iter) + names.push_back(iter->first); + return names; + } + + CRYPTOPP_NOINLINE static ObjectFactoryRegistry & Registry(CRYPTOPP_NOINLINE_DOTDOTDOT); + +private: + // use void * instead of ObjectFactory * to save code size + typedef std::map Map; + Map m_map; +}; + +template +ObjectFactoryRegistry & ObjectFactoryRegistry::Registry(CRYPTOPP_NOINLINE_DOTDOTDOT) +{ + static ObjectFactoryRegistry s_registry; + return s_registry; +} + +template +struct RegisterDefaultFactoryFor { +RegisterDefaultFactoryFor(const char *name=NULL) +{ + // BCB2006 workaround + std::string n = name ? std::string(name) : std::string(ConcreteClass::StaticAlgorithmName()); + ObjectFactoryRegistry::Registry(). + RegisterFactory(n, new DefaultObjectFactory); +}}; + +template +void RegisterAsymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL) +{ + RegisterDefaultFactoryFor((const char *)name); + RegisterDefaultFactoryFor((const char *)name); +} + +template +void RegisterSignatureSchemeDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL) +{ + RegisterDefaultFactoryFor((const char *)name); + RegisterDefaultFactoryFor((const char *)name); +} + +template +void RegisterSymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL) +{ + RegisterDefaultFactoryFor((const char *)name); + RegisterDefaultFactoryFor((const char *)name); +} + +template +void RegisterAuthenticatedSymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL) +{ + RegisterDefaultFactoryFor((const char *)name); + RegisterDefaultFactoryFor((const char *)name); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/files.cpp b/cryptopp/files.cpp new file mode 100644 index 0000000..f9fecbe --- /dev/null +++ b/cryptopp/files.cpp @@ -0,0 +1,212 @@ +// files.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "files.h" + +#include + +NAMESPACE_BEGIN(CryptoPP) + +using namespace std; + +void Files_TestInstantiations() +{ + FileStore f0; + FileSource f1; + FileSink f2; +} + +void FileStore::StoreInitialize(const NameValuePairs ¶meters) +{ + m_file.reset(new std::ifstream); + const char *fileName; + if (parameters.GetValue(Name::InputFileName(), fileName)) + { + ios::openmode binary = parameters.GetValueWithDefault(Name::InputBinaryMode(), true) ? ios::binary : ios::openmode(0); + m_file->open(fileName, ios::in | binary); + if (!*m_file) + throw OpenErr(fileName); + m_stream = m_file.get(); + } + else + { + m_stream = NULL; + parameters.GetValue(Name::InputStreamPointer(), m_stream); + } + m_waiting = false; +} + +lword FileStore::MaxRetrievable() const +{ + if (!m_stream) + return 0; + + streampos current = m_stream->tellg(); + streampos end = m_stream->seekg(0, ios::end).tellg(); + m_stream->seekg(current); + return end-current; +} + +size_t FileStore::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking) +{ + if (!m_stream) + { + transferBytes = 0; + return 0; + } + + lword size=transferBytes; + transferBytes = 0; + + if (m_waiting) + goto output; + + while (size && m_stream->good()) + { + { + size_t spaceSize = 1024; + m_space = HelpCreatePutSpace(target, channel, 1, UnsignedMin(size_t(0)-1, size), spaceSize); + + m_stream->read((char *)m_space, (unsigned int)STDMIN(size, (lword)spaceSize)); + } + m_len = m_stream->gcount(); + size_t blockedBytes; +output: + blockedBytes = target.ChannelPutModifiable2(channel, m_space, m_len, 0, blocking); + m_waiting = blockedBytes > 0; + if (m_waiting) + return blockedBytes; + size -= m_len; + transferBytes += m_len; + } + + if (!m_stream->good() && !m_stream->eof()) + throw ReadErr(); + + return 0; +} + +size_t FileStore::CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end, const std::string &channel, bool blocking) const +{ + if (!m_stream) + return 0; + + if (begin == 0 && end == 1) + { + int result = m_stream->peek(); + if (result == char_traits::eof()) + return 0; + else + { + size_t blockedBytes = target.ChannelPut(channel, byte(result), blocking); + begin += 1-blockedBytes; + return blockedBytes; + } + } + + // TODO: figure out what happens on cin + streampos current = m_stream->tellg(); + streampos endPosition = m_stream->seekg(0, ios::end).tellg(); + streampos newPosition = current + (streamoff)begin; + + if (newPosition >= endPosition) + { + m_stream->seekg(current); + return 0; // don't try to seek beyond the end of file + } + m_stream->seekg(newPosition); + try + { + assert(!m_waiting); + lword copyMax = end-begin; + size_t blockedBytes = const_cast(this)->TransferTo2(target, copyMax, channel, blocking); + begin += copyMax; + if (blockedBytes) + { + const_cast(this)->m_waiting = false; + return blockedBytes; + } + } + catch(...) + { + m_stream->clear(); + m_stream->seekg(current); + throw; + } + m_stream->clear(); + m_stream->seekg(current); + + return 0; +} + +lword FileStore::Skip(lword skipMax) +{ + lword oldPos = m_stream->tellg(); + std::istream::off_type offset; + if (!SafeConvert(skipMax, offset)) + throw InvalidArgument("FileStore: maximum seek offset exceeded"); + m_stream->seekg(offset, ios::cur); + return (lword)m_stream->tellg() - oldPos; +} + +void FileSink::IsolatedInitialize(const NameValuePairs ¶meters) +{ + m_file.reset(new std::ofstream); + const char *fileName; + if (parameters.GetValue(Name::OutputFileName(), fileName)) + { + ios::openmode binary = parameters.GetValueWithDefault(Name::OutputBinaryMode(), true) ? ios::binary : ios::openmode(0); + m_file->open(fileName, ios::out | ios::trunc | binary); + if (!*m_file) + throw OpenErr(fileName); + m_stream = m_file.get(); + } + else + { + m_stream = NULL; + parameters.GetValue(Name::OutputStreamPointer(), m_stream); + } +} + +bool FileSink::IsolatedFlush(bool hardFlush, bool blocking) +{ + if (!m_stream) + throw Err("FileSink: output stream not opened"); + + m_stream->flush(); + if (!m_stream->good()) + throw WriteErr(); + + return false; +} + +size_t FileSink::Put2(const byte *inString, size_t length, int messageEnd, bool blocking) +{ + if (!m_stream) + throw Err("FileSink: output stream not opened"); + + while (length > 0) + { + std::streamsize size; + if (!SafeConvert(length, size)) + size = numeric_limits::max(); + m_stream->write((const char *)inString, size); + inString += size; + length -= size; + } + + if (messageEnd) + m_stream->flush(); + + if (!m_stream->good()) + throw WriteErr(); + + return 0; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/files.h b/cryptopp/files.h new file mode 100644 index 0000000..2c4e2b8 --- /dev/null +++ b/cryptopp/files.h @@ -0,0 +1,97 @@ +#ifndef CRYPTOPP_FILES_H +#define CRYPTOPP_FILES_H + +#include "cryptlib.h" +#include "filters.h" +#include "argnames.h" + +#include +#include + +NAMESPACE_BEGIN(CryptoPP) + +//! file-based implementation of Store interface +class CRYPTOPP_DLL FileStore : public Store, private FilterPutSpaceHelper, public NotCopyable +{ +public: + class Err : public Exception + { + public: + Err(const std::string &s) : Exception(IO_ERROR, s) {} + }; + class OpenErr : public Err {public: OpenErr(const std::string &filename) : Err("FileStore: error opening file for reading: " + filename) {}}; + class ReadErr : public Err {public: ReadErr() : Err("FileStore: error reading file") {}}; + + FileStore() : m_stream(NULL) {} + FileStore(std::istream &in) + {StoreInitialize(MakeParameters(Name::InputStreamPointer(), &in));} + FileStore(const char *filename) + {StoreInitialize(MakeParameters(Name::InputFileName(), filename));} + + std::istream* GetStream() {return m_stream;} + + lword MaxRetrievable() const; + size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const; + lword Skip(lword skipMax=ULONG_MAX); + +private: + void StoreInitialize(const NameValuePairs ¶meters); + + member_ptr m_file; + std::istream *m_stream; + byte *m_space; + size_t m_len; + bool m_waiting; +}; + +//! file-based implementation of Source interface +class CRYPTOPP_DLL FileSource : public SourceTemplate +{ +public: + typedef FileStore::Err Err; + typedef FileStore::OpenErr OpenErr; + typedef FileStore::ReadErr ReadErr; + + FileSource(BufferedTransformation *attachment = NULL) + : SourceTemplate(attachment) {} + FileSource(std::istream &in, bool pumpAll, BufferedTransformation *attachment = NULL) + : SourceTemplate(attachment) {SourceInitialize(pumpAll, MakeParameters(Name::InputStreamPointer(), &in));} + FileSource(const char *filename, bool pumpAll, BufferedTransformation *attachment = NULL, bool binary=true) + : SourceTemplate(attachment) {SourceInitialize(pumpAll, MakeParameters(Name::InputFileName(), filename)(Name::InputBinaryMode(), binary));} + + std::istream* GetStream() {return m_store.GetStream();} +}; + +//! file-based implementation of Sink interface +class CRYPTOPP_DLL FileSink : public Sink, public NotCopyable +{ +public: + class Err : public Exception + { + public: + Err(const std::string &s) : Exception(IO_ERROR, s) {} + }; + class OpenErr : public Err {public: OpenErr(const std::string &filename) : Err("FileSink: error opening file for writing: " + filename) {}}; + class WriteErr : public Err {public: WriteErr() : Err("FileSink: error writing file") {}}; + + FileSink() : m_stream(NULL) {} + FileSink(std::ostream &out) + {IsolatedInitialize(MakeParameters(Name::OutputStreamPointer(), &out));} + FileSink(const char *filename, bool binary=true) + {IsolatedInitialize(MakeParameters(Name::OutputFileName(), filename)("OutputBinaryMode", binary));} + + std::ostream* GetStream() {return m_stream;} + + void IsolatedInitialize(const NameValuePairs ¶meters); + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking); + bool IsolatedFlush(bool hardFlush, bool blocking); + +private: + member_ptr m_file; + std::ostream *m_stream; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/filters.cpp b/cryptopp/filters.cpp new file mode 100644 index 0000000..083dfd3 --- /dev/null +++ b/cryptopp/filters.cpp @@ -0,0 +1,1120 @@ +// filters.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "filters.h" +#include "mqueue.h" +#include "fltrimpl.h" +#include "argnames.h" +#include +#include + +NAMESPACE_BEGIN(CryptoPP) + +Filter::Filter(BufferedTransformation *attachment) + : m_attachment(attachment), m_continueAt(0) +{ +} + +BufferedTransformation * Filter::NewDefaultAttachment() const +{ + return new MessageQueue; +} + +BufferedTransformation * Filter::AttachedTransformation() +{ + if (m_attachment.get() == NULL) + m_attachment.reset(NewDefaultAttachment()); + return m_attachment.get(); +} + +const BufferedTransformation *Filter::AttachedTransformation() const +{ + if (m_attachment.get() == NULL) + const_cast(this)->m_attachment.reset(NewDefaultAttachment()); + return m_attachment.get(); +} + +void Filter::Detach(BufferedTransformation *newOut) +{ + m_attachment.reset(newOut); +} + +void Filter::Insert(Filter *filter) +{ + filter->m_attachment.reset(m_attachment.release()); + m_attachment.reset(filter); +} + +size_t Filter::CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end, const std::string &channel, bool blocking) const +{ + return AttachedTransformation()->CopyRangeTo2(target, begin, end, channel, blocking); +} + +size_t Filter::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking) +{ + return AttachedTransformation()->TransferTo2(target, transferBytes, channel, blocking); +} + +void Filter::Initialize(const NameValuePairs ¶meters, int propagation) +{ + m_continueAt = 0; + IsolatedInitialize(parameters); + PropagateInitialize(parameters, propagation); +} + +bool Filter::Flush(bool hardFlush, int propagation, bool blocking) +{ + switch (m_continueAt) + { + case 0: + if (IsolatedFlush(hardFlush, blocking)) + return true; + case 1: + if (OutputFlush(1, hardFlush, propagation, blocking)) + return true; + } + return false; +} + +bool Filter::MessageSeriesEnd(int propagation, bool blocking) +{ + switch (m_continueAt) + { + case 0: + if (IsolatedMessageSeriesEnd(blocking)) + return true; + case 1: + if (ShouldPropagateMessageSeriesEnd() && OutputMessageSeriesEnd(1, propagation, blocking)) + return true; + } + return false; +} + +void Filter::PropagateInitialize(const NameValuePairs ¶meters, int propagation) +{ + if (propagation) + AttachedTransformation()->Initialize(parameters, propagation-1); +} + +size_t Filter::OutputModifiable(int outputSite, byte *inString, size_t length, int messageEnd, bool blocking, const std::string &channel) +{ + if (messageEnd) + messageEnd--; + size_t result = AttachedTransformation()->ChannelPutModifiable2(channel, inString, length, messageEnd, blocking); + m_continueAt = result ? outputSite : 0; + return result; +} + +size_t Filter::Output(int outputSite, const byte *inString, size_t length, int messageEnd, bool blocking, const std::string &channel) +{ + if (messageEnd) + messageEnd--; + size_t result = AttachedTransformation()->ChannelPut2(channel, inString, length, messageEnd, blocking); + m_continueAt = result ? outputSite : 0; + return result; +} + +bool Filter::OutputFlush(int outputSite, bool hardFlush, int propagation, bool blocking, const std::string &channel) +{ + if (propagation && AttachedTransformation()->ChannelFlush(channel, hardFlush, propagation-1, blocking)) + { + m_continueAt = outputSite; + return true; + } + m_continueAt = 0; + return false; +} + +bool Filter::OutputMessageSeriesEnd(int outputSite, int propagation, bool blocking, const std::string &channel) +{ + if (propagation && AttachedTransformation()->ChannelMessageSeriesEnd(channel, propagation-1, blocking)) + { + m_continueAt = outputSite; + return true; + } + m_continueAt = 0; + return false; +} + +// ************************************************************* + +void MeterFilter::ResetMeter() +{ + m_currentMessageBytes = m_totalBytes = m_currentSeriesMessages = m_totalMessages = m_totalMessageSeries = 0; + m_rangesToSkip.clear(); +} + +void MeterFilter::AddRangeToSkip(unsigned int message, lword position, lword size, bool sortNow) +{ + MessageRange r = {message, position, size}; + m_rangesToSkip.push_back(r); + if (sortNow) + std::sort(m_rangesToSkip.begin(), m_rangesToSkip.end()); +} + +size_t MeterFilter::PutMaybeModifiable(byte *begin, size_t length, int messageEnd, bool blocking, bool modifiable) +{ + if (!m_transparent) + return 0; + + size_t t; + FILTER_BEGIN; + + m_begin = begin; + m_length = length; + + while (m_length > 0 || messageEnd) + { + if (m_length > 0 && !m_rangesToSkip.empty() && m_rangesToSkip.front().message == m_totalMessages && m_currentMessageBytes + m_length > m_rangesToSkip.front().position) + { + FILTER_OUTPUT_MAYBE_MODIFIABLE(1, m_begin, t = (size_t)SaturatingSubtract(m_rangesToSkip.front().position, m_currentMessageBytes), false, modifiable); + + assert(t < m_length); + m_begin += t; + m_length -= t; + m_currentMessageBytes += t; + m_totalBytes += t; + + if (m_currentMessageBytes + m_length < m_rangesToSkip.front().position + m_rangesToSkip.front().size) + t = m_length; + else + { + t = (size_t)SaturatingSubtract(m_rangesToSkip.front().position + m_rangesToSkip.front().size, m_currentMessageBytes); + assert(t <= m_length); + m_rangesToSkip.pop_front(); + } + + m_begin += t; + m_length -= t; + m_currentMessageBytes += t; + m_totalBytes += t; + } + else + { + FILTER_OUTPUT_MAYBE_MODIFIABLE(2, m_begin, m_length, messageEnd, modifiable); + + m_currentMessageBytes += m_length; + m_totalBytes += m_length; + m_length = 0; + + if (messageEnd) + { + m_currentMessageBytes = 0; + m_currentSeriesMessages++; + m_totalMessages++; + messageEnd = false; + } + } + } + + FILTER_END_NO_MESSAGE_END; +} + +size_t MeterFilter::Put2(const byte *begin, size_t length, int messageEnd, bool blocking) +{ + return PutMaybeModifiable(const_cast(begin), length, messageEnd, blocking, false); +} + +size_t MeterFilter::PutModifiable2(byte *begin, size_t length, int messageEnd, bool blocking) +{ + return PutMaybeModifiable(begin, length, messageEnd, blocking, true); +} + +bool MeterFilter::IsolatedMessageSeriesEnd(bool blocking) +{ + m_currentMessageBytes = 0; + m_currentSeriesMessages = 0; + m_totalMessageSeries++; + return false; +} + +// ************************************************************* + +void FilterWithBufferedInput::BlockQueue::ResetQueue(size_t blockSize, size_t maxBlocks) +{ + m_buffer.New(blockSize * maxBlocks); + m_blockSize = blockSize; + m_maxBlocks = maxBlocks; + m_size = 0; + m_begin = m_buffer; +} + +byte *FilterWithBufferedInput::BlockQueue::GetBlock() +{ + if (m_size >= m_blockSize) + { + byte *ptr = m_begin; + if ((m_begin+=m_blockSize) == m_buffer.end()) + m_begin = m_buffer; + m_size -= m_blockSize; + return ptr; + } + else + return NULL; +} + +byte *FilterWithBufferedInput::BlockQueue::GetContigousBlocks(size_t &numberOfBytes) +{ + numberOfBytes = STDMIN(numberOfBytes, STDMIN(size_t(m_buffer.end()-m_begin), m_size)); + byte *ptr = m_begin; + m_begin += numberOfBytes; + m_size -= numberOfBytes; + if (m_size == 0 || m_begin == m_buffer.end()) + m_begin = m_buffer; + return ptr; +} + +size_t FilterWithBufferedInput::BlockQueue::GetAll(byte *outString) +{ + size_t size = m_size; + size_t numberOfBytes = m_maxBlocks*m_blockSize; + const byte *ptr = GetContigousBlocks(numberOfBytes); + memcpy(outString, ptr, numberOfBytes); + memcpy(outString+numberOfBytes, m_begin, m_size); + m_size = 0; + return size; +} + +void FilterWithBufferedInput::BlockQueue::Put(const byte *inString, size_t length) +{ + assert(m_size + length <= m_buffer.size()); + byte *end = (m_size < size_t(m_buffer.end()-m_begin)) ? m_begin + m_size : m_begin + m_size - m_buffer.size(); + size_t len = STDMIN(length, size_t(m_buffer.end()-end)); + memcpy(end, inString, len); + if (len < length) + memcpy(m_buffer, inString+len, length-len); + m_size += length; +} + +FilterWithBufferedInput::FilterWithBufferedInput(BufferedTransformation *attachment) + : Filter(attachment) +{ +} + +FilterWithBufferedInput::FilterWithBufferedInput(size_t firstSize, size_t blockSize, size_t lastSize, BufferedTransformation *attachment) + : Filter(attachment), m_firstSize(firstSize), m_blockSize(blockSize), m_lastSize(lastSize) + , m_firstInputDone(false) +{ + if (m_firstSize < 0 || m_blockSize < 1 || m_lastSize < 0) + throw InvalidArgument("FilterWithBufferedInput: invalid buffer size"); + + m_queue.ResetQueue(1, m_firstSize); +} + +void FilterWithBufferedInput::IsolatedInitialize(const NameValuePairs ¶meters) +{ + InitializeDerivedAndReturnNewSizes(parameters, m_firstSize, m_blockSize, m_lastSize); + if (m_firstSize < 0 || m_blockSize < 1 || m_lastSize < 0) + throw InvalidArgument("FilterWithBufferedInput: invalid buffer size"); + m_queue.ResetQueue(1, m_firstSize); + m_firstInputDone = false; +} + +bool FilterWithBufferedInput::IsolatedFlush(bool hardFlush, bool blocking) +{ + if (!blocking) + throw BlockingInputOnly("FilterWithBufferedInput"); + + if (hardFlush) + ForceNextPut(); + FlushDerived(); + + return false; +} + +size_t FilterWithBufferedInput::PutMaybeModifiable(byte *inString, size_t length, int messageEnd, bool blocking, bool modifiable) +{ + if (!blocking) + throw BlockingInputOnly("FilterWithBufferedInput"); + + if (length != 0) + { + size_t newLength = m_queue.CurrentSize() + length; + + if (!m_firstInputDone && newLength >= m_firstSize) + { + size_t len = m_firstSize - m_queue.CurrentSize(); + m_queue.Put(inString, len); + FirstPut(m_queue.GetContigousBlocks(m_firstSize)); + assert(m_queue.CurrentSize() == 0); + m_queue.ResetQueue(m_blockSize, (2*m_blockSize+m_lastSize-2)/m_blockSize); + + inString += len; + newLength -= m_firstSize; + m_firstInputDone = true; + } + + if (m_firstInputDone) + { + if (m_blockSize == 1) + { + while (newLength > m_lastSize && m_queue.CurrentSize() > 0) + { + size_t len = newLength - m_lastSize; + byte *ptr = m_queue.GetContigousBlocks(len); + NextPutModifiable(ptr, len); + newLength -= len; + } + + if (newLength > m_lastSize) + { + size_t len = newLength - m_lastSize; + NextPutMaybeModifiable(inString, len, modifiable); + inString += len; + newLength -= len; + } + } + else + { + while (newLength >= m_blockSize + m_lastSize && m_queue.CurrentSize() >= m_blockSize) + { + NextPutModifiable(m_queue.GetBlock(), m_blockSize); + newLength -= m_blockSize; + } + + if (newLength >= m_blockSize + m_lastSize && m_queue.CurrentSize() > 0) + { + assert(m_queue.CurrentSize() < m_blockSize); + size_t len = m_blockSize - m_queue.CurrentSize(); + m_queue.Put(inString, len); + inString += len; + NextPutModifiable(m_queue.GetBlock(), m_blockSize); + newLength -= m_blockSize; + } + + if (newLength >= m_blockSize + m_lastSize) + { + size_t len = RoundDownToMultipleOf(newLength - m_lastSize, m_blockSize); + NextPutMaybeModifiable(inString, len, modifiable); + inString += len; + newLength -= len; + } + } + } + + m_queue.Put(inString, newLength - m_queue.CurrentSize()); + } + + if (messageEnd) + { + if (!m_firstInputDone && m_firstSize==0) + FirstPut(NULL); + + SecByteBlock temp(m_queue.CurrentSize()); + m_queue.GetAll(temp); + LastPut(temp, temp.size()); + + m_firstInputDone = false; + m_queue.ResetQueue(1, m_firstSize); + + Output(1, NULL, 0, messageEnd, blocking); + } + return 0; +} + +void FilterWithBufferedInput::ForceNextPut() +{ + if (!m_firstInputDone) + return; + + if (m_blockSize > 1) + { + while (m_queue.CurrentSize() >= m_blockSize) + NextPutModifiable(m_queue.GetBlock(), m_blockSize); + } + else + { + size_t len; + while ((len = m_queue.CurrentSize()) > 0) + NextPutModifiable(m_queue.GetContigousBlocks(len), len); + } +} + +void FilterWithBufferedInput::NextPutMultiple(const byte *inString, size_t length) +{ + assert(m_blockSize > 1); // m_blockSize = 1 should always override this function + while (length > 0) + { + assert(length >= m_blockSize); + NextPutSingle(inString); + inString += m_blockSize; + length -= m_blockSize; + } +} + +// ************************************************************* + +void Redirector::Initialize(const NameValuePairs ¶meters, int propagation) +{ + m_target = parameters.GetValueWithDefault("RedirectionTargetPointer", (BufferedTransformation*)NULL); + m_behavior = parameters.GetIntValueWithDefault("RedirectionBehavior", PASS_EVERYTHING); + + if (m_target && GetPassSignals()) + m_target->Initialize(parameters, propagation); +} + +// ************************************************************* + +ProxyFilter::ProxyFilter(BufferedTransformation *filter, size_t firstSize, size_t lastSize, BufferedTransformation *attachment) + : FilterWithBufferedInput(firstSize, 1, lastSize, attachment), m_filter(filter) +{ + if (m_filter.get()) + m_filter->Attach(new OutputProxy(*this, false)); +} + +bool ProxyFilter::IsolatedFlush(bool hardFlush, bool blocking) +{ + return m_filter.get() ? m_filter->Flush(hardFlush, -1, blocking) : false; +} + +void ProxyFilter::SetFilter(Filter *filter) +{ + m_filter.reset(filter); + if (filter) + { + OutputProxy *proxy; + std::auto_ptr temp(proxy = new OutputProxy(*this, false)); + m_filter->TransferAllTo(*proxy); + m_filter->Attach(temp.release()); + } +} + +void ProxyFilter::NextPutMultiple(const byte *s, size_t len) +{ + if (m_filter.get()) + m_filter->Put(s, len); +} + +void ProxyFilter::NextPutModifiable(byte *s, size_t len) +{ + if (m_filter.get()) + m_filter->PutModifiable(s, len); +} + +// ************************************************************* + +void RandomNumberSink::IsolatedInitialize(const NameValuePairs ¶meters) +{ + parameters.GetRequiredParameter("RandomNumberSink", "RandomNumberGeneratorPointer", m_rng); +} + +size_t RandomNumberSink::Put2(const byte *begin, size_t length, int messageEnd, bool blocking) +{ + m_rng->IncorporateEntropy(begin, length); + return 0; +} + +size_t ArraySink::Put2(const byte *begin, size_t length, int messageEnd, bool blocking) +{ + if (m_buf+m_total != begin) + memcpy(m_buf+m_total, begin, STDMIN(length, SaturatingSubtract(m_size, m_total))); + m_total += length; + return 0; +} + +byte * ArraySink::CreatePutSpace(size_t &size) +{ + size = SaturatingSubtract(m_size, m_total); + return m_buf + m_total; +} + +void ArraySink::IsolatedInitialize(const NameValuePairs ¶meters) +{ + ByteArrayParameter array; + if (!parameters.GetValue(Name::OutputBuffer(), array)) + throw InvalidArgument("ArraySink: missing OutputBuffer argument"); + m_buf = array.begin(); + m_size = array.size(); + m_total = 0; +} + +size_t ArrayXorSink::Put2(const byte *begin, size_t length, int messageEnd, bool blocking) +{ + xorbuf(m_buf+m_total, begin, STDMIN(length, SaturatingSubtract(m_size, m_total))); + m_total += length; + return 0; +} + +// ************************************************************* + +StreamTransformationFilter::StreamTransformationFilter(StreamTransformation &c, BufferedTransformation *attachment, BlockPaddingScheme padding, bool allowAuthenticatedSymmetricCipher) + : FilterWithBufferedInput(attachment) + , m_cipher(c) +{ + assert(c.MinLastBlockSize() == 0 || c.MinLastBlockSize() > c.MandatoryBlockSize()); + + if (!allowAuthenticatedSymmetricCipher && dynamic_cast(&c) != 0) + throw InvalidArgument("StreamTransformationFilter: please use AuthenticatedEncryptionFilter and AuthenticatedDecryptionFilter for AuthenticatedSymmetricCipher"); + + IsolatedInitialize(MakeParameters(Name::BlockPaddingScheme(), padding)); +} + +size_t StreamTransformationFilter::LastBlockSize(StreamTransformation &c, BlockPaddingScheme padding) +{ + if (c.MinLastBlockSize() > 0) + return c.MinLastBlockSize(); + else if (c.MandatoryBlockSize() > 1 && !c.IsForwardTransformation() && padding != NO_PADDING && padding != ZEROS_PADDING) + return c.MandatoryBlockSize(); + else + return 0; +} + +void StreamTransformationFilter::InitializeDerivedAndReturnNewSizes(const NameValuePairs ¶meters, size_t &firstSize, size_t &blockSize, size_t &lastSize) +{ + BlockPaddingScheme padding = parameters.GetValueWithDefault(Name::BlockPaddingScheme(), DEFAULT_PADDING); + bool isBlockCipher = (m_cipher.MandatoryBlockSize() > 1 && m_cipher.MinLastBlockSize() == 0); + + if (padding == DEFAULT_PADDING) + m_padding = isBlockCipher ? PKCS_PADDING : NO_PADDING; + else + m_padding = padding; + + if (!isBlockCipher && (m_padding == PKCS_PADDING || m_padding == ONE_AND_ZEROS_PADDING)) + throw InvalidArgument("StreamTransformationFilter: PKCS_PADDING and ONE_AND_ZEROS_PADDING cannot be used with " + m_cipher.AlgorithmName()); + + firstSize = 0; + blockSize = m_cipher.MandatoryBlockSize(); + lastSize = LastBlockSize(m_cipher, m_padding); +} + +void StreamTransformationFilter::FirstPut(const byte *inString) +{ + m_optimalBufferSize = m_cipher.OptimalBlockSize(); + m_optimalBufferSize = (unsigned int)STDMAX(m_optimalBufferSize, RoundDownToMultipleOf(4096U, m_optimalBufferSize)); +} + +void StreamTransformationFilter::NextPutMultiple(const byte *inString, size_t length) +{ + if (!length) + return; + + size_t s = m_cipher.MandatoryBlockSize(); + + do + { + size_t len = m_optimalBufferSize; + byte *space = HelpCreatePutSpace(*AttachedTransformation(), DEFAULT_CHANNEL, s, length, len); + if (len < length) + { + if (len == m_optimalBufferSize) + len -= m_cipher.GetOptimalBlockSizeUsed(); + len = RoundDownToMultipleOf(len, s); + } + else + len = length; + m_cipher.ProcessString(space, inString, len); + AttachedTransformation()->PutModifiable(space, len); + inString += len; + length -= len; + } + while (length > 0); +} + +void StreamTransformationFilter::NextPutModifiable(byte *inString, size_t length) +{ + m_cipher.ProcessString(inString, length); + AttachedTransformation()->PutModifiable(inString, length); +} + +void StreamTransformationFilter::LastPut(const byte *inString, size_t length) +{ + byte *space = NULL; + + switch (m_padding) + { + case NO_PADDING: + case ZEROS_PADDING: + if (length > 0) + { + size_t minLastBlockSize = m_cipher.MinLastBlockSize(); + bool isForwardTransformation = m_cipher.IsForwardTransformation(); + + if (isForwardTransformation && m_padding == ZEROS_PADDING && (minLastBlockSize == 0 || length < minLastBlockSize)) + { + // do padding + size_t blockSize = STDMAX(minLastBlockSize, (size_t)m_cipher.MandatoryBlockSize()); + space = HelpCreatePutSpace(*AttachedTransformation(), DEFAULT_CHANNEL, blockSize); + memcpy(space, inString, length); + memset(space + length, 0, blockSize - length); + m_cipher.ProcessLastBlock(space, space, blockSize); + AttachedTransformation()->Put(space, blockSize); + } + else + { + if (minLastBlockSize == 0) + { + if (isForwardTransformation) + throw InvalidDataFormat("StreamTransformationFilter: plaintext length is not a multiple of block size and NO_PADDING is specified"); + else + throw InvalidCiphertext("StreamTransformationFilter: ciphertext length is not a multiple of block size"); + } + + space = HelpCreatePutSpace(*AttachedTransformation(), DEFAULT_CHANNEL, length, m_optimalBufferSize); + m_cipher.ProcessLastBlock(space, inString, length); + AttachedTransformation()->Put(space, length); + } + } + break; + + case PKCS_PADDING: + case ONE_AND_ZEROS_PADDING: + unsigned int s; + s = m_cipher.MandatoryBlockSize(); + assert(s > 1); + space = HelpCreatePutSpace(*AttachedTransformation(), DEFAULT_CHANNEL, s, m_optimalBufferSize); + if (m_cipher.IsForwardTransformation()) + { + assert(length < s); + memcpy(space, inString, length); + if (m_padding == PKCS_PADDING) + { + assert(s < 256); + byte pad = byte(s-length); + memset(space+length, pad, s-length); + } + else + { + space[length] = 0x80; + memset(space+length+1, 0, s-length-1); + } + m_cipher.ProcessData(space, space, s); + AttachedTransformation()->Put(space, s); + } + else + { + if (length != s) + throw InvalidCiphertext("StreamTransformationFilter: ciphertext length is not a multiple of block size"); + m_cipher.ProcessData(space, inString, s); + if (m_padding == PKCS_PADDING) + { + byte pad = space[s-1]; + if (pad < 1 || pad > s || std::find_if(space+s-pad, space+s, std::bind2nd(std::not_equal_to(), pad)) != space+s) + throw InvalidCiphertext("StreamTransformationFilter: invalid PKCS #7 block padding found"); + length = s-pad; + } + else + { + while (length > 1 && space[length-1] == 0) + --length; + if (space[--length] != 0x80) + throw InvalidCiphertext("StreamTransformationFilter: invalid ones-and-zeros padding found"); + } + AttachedTransformation()->Put(space, length); + } + break; + + default: + assert(false); + } +} + +// ************************************************************* + +HashFilter::HashFilter(HashTransformation &hm, BufferedTransformation *attachment, bool putMessage, int truncatedDigestSize, const std::string &messagePutChannel, const std::string &hashPutChannel) + : m_hashModule(hm), m_putMessage(putMessage), m_messagePutChannel(messagePutChannel), m_hashPutChannel(hashPutChannel) +{ + m_digestSize = truncatedDigestSize < 0 ? m_hashModule.DigestSize() : truncatedDigestSize; + Detach(attachment); +} + +void HashFilter::IsolatedInitialize(const NameValuePairs ¶meters) +{ + m_putMessage = parameters.GetValueWithDefault(Name::PutMessage(), false); + int s = parameters.GetIntValueWithDefault(Name::TruncatedDigestSize(), -1); + m_digestSize = s < 0 ? m_hashModule.DigestSize() : s; +} + +size_t HashFilter::Put2(const byte *inString, size_t length, int messageEnd, bool blocking) +{ + FILTER_BEGIN; + if (m_putMessage) + FILTER_OUTPUT3(1, 0, inString, length, 0, m_messagePutChannel); + m_hashModule.Update(inString, length); + if (messageEnd) + { + { + size_t size; + m_space = HelpCreatePutSpace(*AttachedTransformation(), m_hashPutChannel, m_digestSize, m_digestSize, size = m_digestSize); + m_hashModule.TruncatedFinal(m_space, m_digestSize); + } + FILTER_OUTPUT3(2, 0, m_space, m_digestSize, messageEnd, m_hashPutChannel); + } + FILTER_END_NO_MESSAGE_END; +} + +// ************************************************************* + +HashVerificationFilter::HashVerificationFilter(HashTransformation &hm, BufferedTransformation *attachment, word32 flags, int truncatedDigestSize) + : FilterWithBufferedInput(attachment) + , m_hashModule(hm) +{ + IsolatedInitialize(MakeParameters(Name::HashVerificationFilterFlags(), flags)(Name::TruncatedDigestSize(), truncatedDigestSize)); +} + +void HashVerificationFilter::InitializeDerivedAndReturnNewSizes(const NameValuePairs ¶meters, size_t &firstSize, size_t &blockSize, size_t &lastSize) +{ + m_flags = parameters.GetValueWithDefault(Name::HashVerificationFilterFlags(), (word32)DEFAULT_FLAGS); + int s = parameters.GetIntValueWithDefault(Name::TruncatedDigestSize(), -1); + m_digestSize = s < 0 ? m_hashModule.DigestSize() : s; + m_verified = false; + firstSize = m_flags & HASH_AT_BEGIN ? m_digestSize : 0; + blockSize = 1; + lastSize = m_flags & HASH_AT_BEGIN ? 0 : m_digestSize; +} + +void HashVerificationFilter::FirstPut(const byte *inString) +{ + if (m_flags & HASH_AT_BEGIN) + { + m_expectedHash.New(m_digestSize); + memcpy(m_expectedHash, inString, m_expectedHash.size()); + if (m_flags & PUT_HASH) + AttachedTransformation()->Put(inString, m_expectedHash.size()); + } +} + +void HashVerificationFilter::NextPutMultiple(const byte *inString, size_t length) +{ + m_hashModule.Update(inString, length); + if (m_flags & PUT_MESSAGE) + AttachedTransformation()->Put(inString, length); +} + +void HashVerificationFilter::LastPut(const byte *inString, size_t length) +{ + if (m_flags & HASH_AT_BEGIN) + { + assert(length == 0); + m_verified = m_hashModule.TruncatedVerify(m_expectedHash, m_digestSize); + } + else + { + m_verified = (length==m_digestSize && m_hashModule.TruncatedVerify(inString, length)); + if (m_flags & PUT_HASH) + AttachedTransformation()->Put(inString, length); + } + + if (m_flags & PUT_RESULT) + AttachedTransformation()->Put(m_verified); + + if ((m_flags & THROW_EXCEPTION) && !m_verified) + throw HashVerificationFailed(); +} + +// ************************************************************* + +AuthenticatedEncryptionFilter::AuthenticatedEncryptionFilter(AuthenticatedSymmetricCipher &c, BufferedTransformation *attachment, + bool putAAD, int truncatedDigestSize, const std::string &macChannel, BlockPaddingScheme padding) + : StreamTransformationFilter(c, attachment, padding, true) + , m_hf(c, new OutputProxy(*this, false), putAAD, truncatedDigestSize, AAD_CHANNEL, macChannel) +{ + assert(c.IsForwardTransformation()); +} + +void AuthenticatedEncryptionFilter::IsolatedInitialize(const NameValuePairs ¶meters) +{ + m_hf.IsolatedInitialize(parameters); + StreamTransformationFilter::IsolatedInitialize(parameters); +} + +byte * AuthenticatedEncryptionFilter::ChannelCreatePutSpace(const std::string &channel, size_t &size) +{ + if (channel.empty()) + return StreamTransformationFilter::CreatePutSpace(size); + + if (channel == AAD_CHANNEL) + return m_hf.CreatePutSpace(size); + + throw InvalidChannelName("AuthenticatedEncryptionFilter", channel); +} + +size_t AuthenticatedEncryptionFilter::ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking) +{ + if (channel.empty()) + return StreamTransformationFilter::Put2(begin, length, messageEnd, blocking); + + if (channel == AAD_CHANNEL) + return m_hf.Put2(begin, length, 0, blocking); + + throw InvalidChannelName("AuthenticatedEncryptionFilter", channel); +} + +void AuthenticatedEncryptionFilter::LastPut(const byte *inString, size_t length) +{ + StreamTransformationFilter::LastPut(inString, length); + m_hf.MessageEnd(); +} + +// ************************************************************* + +AuthenticatedDecryptionFilter::AuthenticatedDecryptionFilter(AuthenticatedSymmetricCipher &c, BufferedTransformation *attachment, word32 flags, int truncatedDigestSize, BlockPaddingScheme padding) + : FilterWithBufferedInput(attachment) + , m_hashVerifier(c, new OutputProxy(*this, false)) + , m_streamFilter(c, new OutputProxy(*this, false), padding, true) +{ + assert(!c.IsForwardTransformation() || c.IsSelfInverting()); + IsolatedInitialize(MakeParameters(Name::BlockPaddingScheme(), padding)(Name::AuthenticatedDecryptionFilterFlags(), flags)(Name::TruncatedDigestSize(), truncatedDigestSize)); +} + +void AuthenticatedDecryptionFilter::InitializeDerivedAndReturnNewSizes(const NameValuePairs ¶meters, size_t &firstSize, size_t &blockSize, size_t &lastSize) +{ + word32 flags = parameters.GetValueWithDefault(Name::AuthenticatedDecryptionFilterFlags(), (word32)DEFAULT_FLAGS); + + m_hashVerifier.Initialize(CombinedNameValuePairs(parameters, MakeParameters(Name::HashVerificationFilterFlags(), flags))); + m_streamFilter.Initialize(parameters); + + firstSize = m_hashVerifier.m_firstSize; + blockSize = 1; + lastSize = m_hashVerifier.m_lastSize; +} + +byte * AuthenticatedDecryptionFilter::ChannelCreatePutSpace(const std::string &channel, size_t &size) +{ + if (channel.empty()) + return m_streamFilter.CreatePutSpace(size); + + if (channel == AAD_CHANNEL) + return m_hashVerifier.CreatePutSpace(size); + + throw InvalidChannelName("AuthenticatedDecryptionFilter", channel); +} + +size_t AuthenticatedDecryptionFilter::ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking) +{ + if (channel.empty()) + { + if (m_lastSize > 0) + m_hashVerifier.ForceNextPut(); + return FilterWithBufferedInput::Put2(begin, length, messageEnd, blocking); + } + + if (channel == AAD_CHANNEL) + return m_hashVerifier.Put2(begin, length, 0, blocking); + + throw InvalidChannelName("AuthenticatedDecryptionFilter", channel); +} + +void AuthenticatedDecryptionFilter::FirstPut(const byte *inString) +{ + m_hashVerifier.Put(inString, m_firstSize); +} + +void AuthenticatedDecryptionFilter::NextPutMultiple(const byte *inString, size_t length) +{ + m_streamFilter.Put(inString, length); +} + +void AuthenticatedDecryptionFilter::LastPut(const byte *inString, size_t length) +{ + m_streamFilter.MessageEnd(); + m_hashVerifier.PutMessageEnd(inString, length); +} + +// ************************************************************* + +void SignerFilter::IsolatedInitialize(const NameValuePairs ¶meters) +{ + m_putMessage = parameters.GetValueWithDefault(Name::PutMessage(), false); + m_messageAccumulator.reset(m_signer.NewSignatureAccumulator(m_rng)); +} + +size_t SignerFilter::Put2(const byte *inString, size_t length, int messageEnd, bool blocking) +{ + FILTER_BEGIN; + m_messageAccumulator->Update(inString, length); + if (m_putMessage) + FILTER_OUTPUT(1, inString, length, 0); + if (messageEnd) + { + m_buf.New(m_signer.SignatureLength()); + m_signer.Sign(m_rng, m_messageAccumulator.release(), m_buf); + FILTER_OUTPUT(2, m_buf, m_buf.size(), messageEnd); + m_messageAccumulator.reset(m_signer.NewSignatureAccumulator(m_rng)); + } + FILTER_END_NO_MESSAGE_END; +} + +SignatureVerificationFilter::SignatureVerificationFilter(const PK_Verifier &verifier, BufferedTransformation *attachment, word32 flags) + : FilterWithBufferedInput(attachment) + , m_verifier(verifier) +{ + IsolatedInitialize(MakeParameters(Name::SignatureVerificationFilterFlags(), flags)); +} + +void SignatureVerificationFilter::InitializeDerivedAndReturnNewSizes(const NameValuePairs ¶meters, size_t &firstSize, size_t &blockSize, size_t &lastSize) +{ + m_flags = parameters.GetValueWithDefault(Name::SignatureVerificationFilterFlags(), (word32)DEFAULT_FLAGS); + m_messageAccumulator.reset(m_verifier.NewVerificationAccumulator()); + size_t size = m_verifier.SignatureLength(); + assert(size != 0); // TODO: handle recoverable signature scheme + m_verified = false; + firstSize = m_flags & SIGNATURE_AT_BEGIN ? size : 0; + blockSize = 1; + lastSize = m_flags & SIGNATURE_AT_BEGIN ? 0 : size; +} + +void SignatureVerificationFilter::FirstPut(const byte *inString) +{ + if (m_flags & SIGNATURE_AT_BEGIN) + { + if (m_verifier.SignatureUpfront()) + m_verifier.InputSignature(*m_messageAccumulator, inString, m_verifier.SignatureLength()); + else + { + m_signature.New(m_verifier.SignatureLength()); + memcpy(m_signature, inString, m_signature.size()); + } + + if (m_flags & PUT_SIGNATURE) + AttachedTransformation()->Put(inString, m_signature.size()); + } + else + { + assert(!m_verifier.SignatureUpfront()); + } +} + +void SignatureVerificationFilter::NextPutMultiple(const byte *inString, size_t length) +{ + m_messageAccumulator->Update(inString, length); + if (m_flags & PUT_MESSAGE) + AttachedTransformation()->Put(inString, length); +} + +void SignatureVerificationFilter::LastPut(const byte *inString, size_t length) +{ + if (m_flags & SIGNATURE_AT_BEGIN) + { + assert(length == 0); + m_verifier.InputSignature(*m_messageAccumulator, m_signature, m_signature.size()); + m_verified = m_verifier.VerifyAndRestart(*m_messageAccumulator); + } + else + { + m_verifier.InputSignature(*m_messageAccumulator, inString, length); + m_verified = m_verifier.VerifyAndRestart(*m_messageAccumulator); + if (m_flags & PUT_SIGNATURE) + AttachedTransformation()->Put(inString, length); + } + + if (m_flags & PUT_RESULT) + AttachedTransformation()->Put(m_verified); + + if ((m_flags & THROW_EXCEPTION) && !m_verified) + throw SignatureVerificationFailed(); +} + +// ************************************************************* + +size_t Source::PumpAll2(bool blocking) +{ + unsigned int messageCount = UINT_MAX; + do { + RETURN_IF_NONZERO(PumpMessages2(messageCount, blocking)); + } while(messageCount == UINT_MAX); + + return 0; +} + +bool Store::GetNextMessage() +{ + if (!m_messageEnd && !AnyRetrievable()) + { + m_messageEnd=true; + return true; + } + else + return false; +} + +unsigned int Store::CopyMessagesTo(BufferedTransformation &target, unsigned int count, const std::string &channel) const +{ + if (m_messageEnd || count == 0) + return 0; + else + { + CopyTo(target, ULONG_MAX, channel); + if (GetAutoSignalPropagation()) + target.ChannelMessageEnd(channel, GetAutoSignalPropagation()-1); + return 1; + } +} + +void StringStore::StoreInitialize(const NameValuePairs ¶meters) +{ + ConstByteArrayParameter array; + if (!parameters.GetValue(Name::InputBuffer(), array)) + throw InvalidArgument("StringStore: missing InputBuffer argument"); + m_store = array.begin(); + m_length = array.size(); + m_count = 0; +} + +size_t StringStore::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking) +{ + lword position = 0; + size_t blockedBytes = CopyRangeTo2(target, position, transferBytes, channel, blocking); + m_count += (size_t)position; + transferBytes = position; + return blockedBytes; +} + +size_t StringStore::CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end, const std::string &channel, bool blocking) const +{ + size_t i = UnsignedMin(m_length, m_count+begin); + size_t len = UnsignedMin(m_length-i, end-begin); + size_t blockedBytes = target.ChannelPut2(channel, m_store+i, len, 0, blocking); + if (!blockedBytes) + begin += len; + return blockedBytes; +} + +void RandomNumberStore::StoreInitialize(const NameValuePairs ¶meters) +{ + parameters.GetRequiredParameter("RandomNumberStore", "RandomNumberGeneratorPointer", m_rng); + int length; + parameters.GetRequiredIntParameter("RandomNumberStore", "RandomNumberStoreSize", length); + m_length = length; +} + +size_t RandomNumberStore::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking) +{ + if (!blocking) + throw NotImplemented("RandomNumberStore: nonblocking transfer is not implemented by this object"); + + transferBytes = UnsignedMin(transferBytes, m_length - m_count); + m_rng->GenerateIntoBufferedTransformation(target, channel, transferBytes); + m_count += transferBytes; + + return 0; +} + +size_t NullStore::CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end, const std::string &channel, bool blocking) const +{ + static const byte nullBytes[128] = {0}; + while (begin < end) + { + size_t len = (size_t)STDMIN(end-begin, lword(128)); + size_t blockedBytes = target.ChannelPut2(channel, nullBytes, len, 0, blocking); + if (blockedBytes) + return blockedBytes; + begin += len; + } + return 0; +} + +size_t NullStore::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking) +{ + lword begin = 0; + size_t blockedBytes = NullStore::CopyRangeTo2(target, begin, transferBytes, channel, blocking); + transferBytes = begin; + m_size -= begin; + return blockedBytes; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/filters.h b/cryptopp/filters.h new file mode 100644 index 0000000..b2194ca --- /dev/null +++ b/cryptopp/filters.h @@ -0,0 +1,808 @@ +#ifndef CRYPTOPP_FILTERS_H +#define CRYPTOPP_FILTERS_H + +#include "simple.h" +#include "secblock.h" +#include "misc.h" +#include "smartptr.h" +#include "queue.h" +#include "algparam.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +/// provides an implementation of BufferedTransformation's attachment interface +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Filter : public BufferedTransformation, public NotCopyable +{ +public: + Filter(BufferedTransformation *attachment = NULL); + + bool Attachable() {return true;} + BufferedTransformation *AttachedTransformation(); + const BufferedTransformation *AttachedTransformation() const; + void Detach(BufferedTransformation *newAttachment = NULL); + + size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const; + + void Initialize(const NameValuePairs ¶meters=g_nullNameValuePairs, int propagation=-1); + bool Flush(bool hardFlush, int propagation=-1, bool blocking=true); + bool MessageSeriesEnd(int propagation=-1, bool blocking=true); + +protected: + virtual BufferedTransformation * NewDefaultAttachment() const; + void Insert(Filter *nextFilter); // insert filter after this one + + virtual bool ShouldPropagateMessageEnd() const {return true;} + virtual bool ShouldPropagateMessageSeriesEnd() const {return true;} + + void PropagateInitialize(const NameValuePairs ¶meters, int propagation); + + size_t Output(int outputSite, const byte *inString, size_t length, int messageEnd, bool blocking, const std::string &channel=DEFAULT_CHANNEL); + size_t OutputModifiable(int outputSite, byte *inString, size_t length, int messageEnd, bool blocking, const std::string &channel=DEFAULT_CHANNEL); + bool OutputMessageEnd(int outputSite, int propagation, bool blocking, const std::string &channel=DEFAULT_CHANNEL); + bool OutputFlush(int outputSite, bool hardFlush, int propagation, bool blocking, const std::string &channel=DEFAULT_CHANNEL); + bool OutputMessageSeriesEnd(int outputSite, int propagation, bool blocking, const std::string &channel=DEFAULT_CHANNEL); + +private: + member_ptr m_attachment; + +protected: + size_t m_inputPosition; + int m_continueAt; +}; + +struct CRYPTOPP_DLL FilterPutSpaceHelper +{ + // desiredSize is how much to ask target, bufferSize is how much to allocate in m_tempSpace + byte *HelpCreatePutSpace(BufferedTransformation &target, const std::string &channel, size_t minSize, size_t desiredSize, size_t &bufferSize) + { + assert(desiredSize >= minSize && bufferSize >= minSize); + if (m_tempSpace.size() < minSize) + { + byte *result = target.ChannelCreatePutSpace(channel, desiredSize); + if (desiredSize >= minSize) + { + bufferSize = desiredSize; + return result; + } + m_tempSpace.New(bufferSize); + } + + bufferSize = m_tempSpace.size(); + return m_tempSpace.begin(); + } + byte *HelpCreatePutSpace(BufferedTransformation &target, const std::string &channel, size_t minSize) + {return HelpCreatePutSpace(target, channel, minSize, minSize, minSize);} + byte *HelpCreatePutSpace(BufferedTransformation &target, const std::string &channel, size_t minSize, size_t bufferSize) + {return HelpCreatePutSpace(target, channel, minSize, minSize, bufferSize);} + SecByteBlock m_tempSpace; +}; + +//! measure how many byte and messages pass through, also serves as valve +class CRYPTOPP_DLL MeterFilter : public Bufferless +{ +public: + MeterFilter(BufferedTransformation *attachment=NULL, bool transparent=true) + : m_transparent(transparent) {Detach(attachment); ResetMeter();} + + void SetTransparent(bool transparent) {m_transparent = transparent;} + void AddRangeToSkip(unsigned int message, lword position, lword size, bool sortNow = true); + void ResetMeter(); + void IsolatedInitialize(const NameValuePairs ¶meters) {ResetMeter();} + + lword GetCurrentMessageBytes() const {return m_currentMessageBytes;} + lword GetTotalBytes() {return m_totalBytes;} + unsigned int GetCurrentSeriesMessages() {return m_currentSeriesMessages;} + unsigned int GetTotalMessages() {return m_totalMessages;} + unsigned int GetTotalMessageSeries() {return m_totalMessageSeries;} + + byte * CreatePutSpace(size_t &size) + {return AttachedTransformation()->CreatePutSpace(size);} + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + size_t PutModifiable2(byte *inString, size_t length, int messageEnd, bool blocking); + bool IsolatedMessageSeriesEnd(bool blocking); + +private: + size_t PutMaybeModifiable(byte *inString, size_t length, int messageEnd, bool blocking, bool modifiable); + bool ShouldPropagateMessageEnd() const {return m_transparent;} + bool ShouldPropagateMessageSeriesEnd() const {return m_transparent;} + + struct MessageRange + { + inline bool operator<(const MessageRange &b) const // BCB2006 workaround: this has to be a member function + {return message < b.message || (message == b.message && position < b.position);} + unsigned int message; lword position; lword size; + }; + + bool m_transparent; + lword m_currentMessageBytes, m_totalBytes; + unsigned int m_currentSeriesMessages, m_totalMessages, m_totalMessageSeries; + std::deque m_rangesToSkip; + byte *m_begin; + size_t m_length; +}; + +//! _ +class CRYPTOPP_DLL TransparentFilter : public MeterFilter +{ +public: + TransparentFilter(BufferedTransformation *attachment=NULL) : MeterFilter(attachment, true) {} +}; + +//! _ +class CRYPTOPP_DLL OpaqueFilter : public MeterFilter +{ +public: + OpaqueFilter(BufferedTransformation *attachment=NULL) : MeterFilter(attachment, false) {} +}; + +/*! FilterWithBufferedInput divides up the input stream into + a first block, a number of middle blocks, and a last block. + First and last blocks are optional, and middle blocks may + be a stream instead (i.e. blockSize == 1). +*/ +class CRYPTOPP_DLL FilterWithBufferedInput : public Filter +{ +public: + FilterWithBufferedInput(BufferedTransformation *attachment); + //! firstSize and lastSize may be 0, blockSize must be at least 1 + FilterWithBufferedInput(size_t firstSize, size_t blockSize, size_t lastSize, BufferedTransformation *attachment); + + void IsolatedInitialize(const NameValuePairs ¶meters); + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking) + { + return PutMaybeModifiable(const_cast(inString), length, messageEnd, blocking, false); + } + size_t PutModifiable2(byte *inString, size_t length, int messageEnd, bool blocking) + { + return PutMaybeModifiable(inString, length, messageEnd, blocking, true); + } + /*! calls ForceNextPut() if hardFlush is true */ + bool IsolatedFlush(bool hardFlush, bool blocking); + + /*! The input buffer may contain more than blockSize bytes if lastSize != 0. + ForceNextPut() forces a call to NextPut() if this is the case. + */ + void ForceNextPut(); + +protected: + bool DidFirstPut() {return m_firstInputDone;} + + virtual void InitializeDerivedAndReturnNewSizes(const NameValuePairs ¶meters, size_t &firstSize, size_t &blockSize, size_t &lastSize) + {InitializeDerived(parameters);} + virtual void InitializeDerived(const NameValuePairs ¶meters) {} + // FirstPut() is called if (firstSize != 0 and totalLength >= firstSize) + // or (firstSize == 0 and (totalLength > 0 or a MessageEnd() is received)) + virtual void FirstPut(const byte *inString) =0; + // NextPut() is called if totalLength >= firstSize+blockSize+lastSize + virtual void NextPutSingle(const byte *inString) {assert(false);} + // Same as NextPut() except length can be a multiple of blockSize + // Either NextPut() or NextPutMultiple() must be overriden + virtual void NextPutMultiple(const byte *inString, size_t length); + // Same as NextPutMultiple(), but inString can be modified + virtual void NextPutModifiable(byte *inString, size_t length) + {NextPutMultiple(inString, length);} + // LastPut() is always called + // if totalLength < firstSize then length == totalLength + // else if totalLength <= firstSize+lastSize then length == totalLength-firstSize + // else lastSize <= length < lastSize+blockSize + virtual void LastPut(const byte *inString, size_t length) =0; + virtual void FlushDerived() {} + +protected: + size_t PutMaybeModifiable(byte *begin, size_t length, int messageEnd, bool blocking, bool modifiable); + void NextPutMaybeModifiable(byte *inString, size_t length, bool modifiable) + { + if (modifiable) NextPutModifiable(inString, length); + else NextPutMultiple(inString, length); + } + + // This function should no longer be used, put this here to cause a compiler error + // if someone tries to override NextPut(). + virtual int NextPut(const byte *inString, size_t length) {assert(false); return 0;} + + class BlockQueue + { + public: + void ResetQueue(size_t blockSize, size_t maxBlocks); + byte *GetBlock(); + byte *GetContigousBlocks(size_t &numberOfBytes); + size_t GetAll(byte *outString); + void Put(const byte *inString, size_t length); + size_t CurrentSize() const {return m_size;} + size_t MaxSize() const {return m_buffer.size();} + + private: + SecByteBlock m_buffer; + size_t m_blockSize, m_maxBlocks, m_size; + byte *m_begin; + }; + + size_t m_firstSize, m_blockSize, m_lastSize; + bool m_firstInputDone; + BlockQueue m_queue; +}; + +//! _ +class CRYPTOPP_DLL FilterWithInputQueue : public Filter +{ +public: + FilterWithInputQueue(BufferedTransformation *attachment=NULL) : Filter(attachment) {} + + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking) + { + if (!blocking) + throw BlockingInputOnly("FilterWithInputQueue"); + + m_inQueue.Put(inString, length); + if (messageEnd) + { + IsolatedMessageEnd(blocking); + Output(0, NULL, 0, messageEnd, blocking); + } + return 0; + } + +protected: + virtual bool IsolatedMessageEnd(bool blocking) =0; + void IsolatedInitialize(const NameValuePairs ¶meters) {m_inQueue.Clear();} + + ByteQueue m_inQueue; +}; + +struct BlockPaddingSchemeDef +{ + enum BlockPaddingScheme {NO_PADDING, ZEROS_PADDING, PKCS_PADDING, ONE_AND_ZEROS_PADDING, DEFAULT_PADDING}; +}; + +//! Filter Wrapper for StreamTransformation, optionally handling padding/unpadding when needed +class CRYPTOPP_DLL StreamTransformationFilter : public FilterWithBufferedInput, public BlockPaddingSchemeDef, private FilterPutSpaceHelper +{ +public: + /*! DEFAULT_PADDING means PKCS_PADDING if c.MandatoryBlockSize() > 1 && c.MinLastBlockSize() == 0 (e.g. ECB or CBC mode), + otherwise NO_PADDING (OFB, CFB, CTR, CBC-CTS modes). + See http://www.weidai.com/scan-mirror/csp.html for details of the padding schemes. */ + StreamTransformationFilter(StreamTransformation &c, BufferedTransformation *attachment = NULL, BlockPaddingScheme padding = DEFAULT_PADDING, bool allowAuthenticatedSymmetricCipher = false); + + std::string AlgorithmName() const {return m_cipher.AlgorithmName();} + +protected: + void InitializeDerivedAndReturnNewSizes(const NameValuePairs ¶meters, size_t &firstSize, size_t &blockSize, size_t &lastSize); + void FirstPut(const byte *inString); + void NextPutMultiple(const byte *inString, size_t length); + void NextPutModifiable(byte *inString, size_t length); + void LastPut(const byte *inString, size_t length); + + static size_t LastBlockSize(StreamTransformation &c, BlockPaddingScheme padding); + + StreamTransformation &m_cipher; + BlockPaddingScheme m_padding; + unsigned int m_optimalBufferSize; +}; + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY +typedef StreamTransformationFilter StreamCipherFilter; +#endif + +//! Filter Wrapper for HashTransformation +class CRYPTOPP_DLL HashFilter : public Bufferless, private FilterPutSpaceHelper +{ +public: + HashFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, bool putMessage=false, int truncatedDigestSize=-1, const std::string &messagePutChannel=DEFAULT_CHANNEL, const std::string &hashPutChannel=DEFAULT_CHANNEL); + + std::string AlgorithmName() const {return m_hashModule.AlgorithmName();} + void IsolatedInitialize(const NameValuePairs ¶meters); + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + byte * CreatePutSpace(size_t &size) {return m_hashModule.CreateUpdateSpace(size);} + +private: + HashTransformation &m_hashModule; + bool m_putMessage; + unsigned int m_digestSize; + byte *m_space; + std::string m_messagePutChannel, m_hashPutChannel; +}; + +//! Filter Wrapper for HashTransformation +class CRYPTOPP_DLL HashVerificationFilter : public FilterWithBufferedInput +{ +public: + class HashVerificationFailed : public Exception + { + public: + HashVerificationFailed() + : Exception(DATA_INTEGRITY_CHECK_FAILED, "HashVerificationFilter: message hash or MAC not valid") {} + }; + + enum Flags {HASH_AT_END=0, HASH_AT_BEGIN=1, PUT_MESSAGE=2, PUT_HASH=4, PUT_RESULT=8, THROW_EXCEPTION=16, DEFAULT_FLAGS = HASH_AT_BEGIN | PUT_RESULT}; + HashVerificationFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, word32 flags = DEFAULT_FLAGS, int truncatedDigestSize=-1); + + std::string AlgorithmName() const {return m_hashModule.AlgorithmName();} + bool GetLastResult() const {return m_verified;} + +protected: + void InitializeDerivedAndReturnNewSizes(const NameValuePairs ¶meters, size_t &firstSize, size_t &blockSize, size_t &lastSize); + void FirstPut(const byte *inString); + void NextPutMultiple(const byte *inString, size_t length); + void LastPut(const byte *inString, size_t length); + +private: + friend class AuthenticatedDecryptionFilter; + + HashTransformation &m_hashModule; + word32 m_flags; + unsigned int m_digestSize; + bool m_verified; + SecByteBlock m_expectedHash; +}; + +typedef HashVerificationFilter HashVerifier; // for backwards compatibility + +//! Filter wrapper for encrypting with AuthenticatedSymmetricCipher, optionally handling padding/unpadding when needed +/*! Additional authenticated data should be given in channel "AAD". If putAAD is true, AAD will be Put() to the attached BufferedTransformation in channel "AAD". */ +class CRYPTOPP_DLL AuthenticatedEncryptionFilter : public StreamTransformationFilter +{ +public: + /*! See StreamTransformationFilter for documentation on BlockPaddingScheme */ + AuthenticatedEncryptionFilter(AuthenticatedSymmetricCipher &c, BufferedTransformation *attachment = NULL, bool putAAD=false, int truncatedDigestSize=-1, const std::string &macChannel=DEFAULT_CHANNEL, BlockPaddingScheme padding = DEFAULT_PADDING); + + void IsolatedInitialize(const NameValuePairs ¶meters); + byte * ChannelCreatePutSpace(const std::string &channel, size_t &size); + size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking); + void LastPut(const byte *inString, size_t length); + +protected: + HashFilter m_hf; +}; + +//! Filter wrapper for decrypting with AuthenticatedSymmetricCipher, optionally handling padding/unpadding when needed +/*! Additional authenticated data should be given in channel "AAD". */ +class CRYPTOPP_DLL AuthenticatedDecryptionFilter : public FilterWithBufferedInput, public BlockPaddingSchemeDef +{ +public: + enum Flags {MAC_AT_END=0, MAC_AT_BEGIN=1, THROW_EXCEPTION=16, DEFAULT_FLAGS = THROW_EXCEPTION}; + + /*! See StreamTransformationFilter for documentation on BlockPaddingScheme */ + AuthenticatedDecryptionFilter(AuthenticatedSymmetricCipher &c, BufferedTransformation *attachment = NULL, word32 flags = DEFAULT_FLAGS, int truncatedDigestSize=-1, BlockPaddingScheme padding = DEFAULT_PADDING); + + std::string AlgorithmName() const {return m_hashVerifier.AlgorithmName();} + byte * ChannelCreatePutSpace(const std::string &channel, size_t &size); + size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking); + bool GetLastResult() const {return m_hashVerifier.GetLastResult();} + +protected: + void InitializeDerivedAndReturnNewSizes(const NameValuePairs ¶meters, size_t &firstSize, size_t &blockSize, size_t &lastSize); + void FirstPut(const byte *inString); + void NextPutMultiple(const byte *inString, size_t length); + void LastPut(const byte *inString, size_t length); + + HashVerificationFilter m_hashVerifier; + StreamTransformationFilter m_streamFilter; +}; + +//! Filter Wrapper for PK_Signer +class CRYPTOPP_DLL SignerFilter : public Unflushable +{ +public: + SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *attachment = NULL, bool putMessage=false) + : m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewSignatureAccumulator(rng)), m_putMessage(putMessage) {Detach(attachment);} + + std::string AlgorithmName() const {return m_signer.AlgorithmName();} + + void IsolatedInitialize(const NameValuePairs ¶meters); + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + +private: + RandomNumberGenerator &m_rng; + const PK_Signer &m_signer; + member_ptr m_messageAccumulator; + bool m_putMessage; + SecByteBlock m_buf; +}; + +//! Filter Wrapper for PK_Verifier +class CRYPTOPP_DLL SignatureVerificationFilter : public FilterWithBufferedInput +{ +public: + class SignatureVerificationFailed : public Exception + { + public: + SignatureVerificationFailed() + : Exception(DATA_INTEGRITY_CHECK_FAILED, "VerifierFilter: digital signature not valid") {} + }; + + enum Flags {SIGNATURE_AT_END=0, SIGNATURE_AT_BEGIN=1, PUT_MESSAGE=2, PUT_SIGNATURE=4, PUT_RESULT=8, THROW_EXCEPTION=16, DEFAULT_FLAGS = SIGNATURE_AT_BEGIN | PUT_RESULT}; + SignatureVerificationFilter(const PK_Verifier &verifier, BufferedTransformation *attachment = NULL, word32 flags = DEFAULT_FLAGS); + + std::string AlgorithmName() const {return m_verifier.AlgorithmName();} + + bool GetLastResult() const {return m_verified;} + +protected: + void InitializeDerivedAndReturnNewSizes(const NameValuePairs ¶meters, size_t &firstSize, size_t &blockSize, size_t &lastSize); + void FirstPut(const byte *inString); + void NextPutMultiple(const byte *inString, size_t length); + void LastPut(const byte *inString, size_t length); + +private: + const PK_Verifier &m_verifier; + member_ptr m_messageAccumulator; + word32 m_flags; + SecByteBlock m_signature; + bool m_verified; +}; + +typedef SignatureVerificationFilter VerifierFilter; // for backwards compatibility + +//! Redirect input to another BufferedTransformation without owning it +class CRYPTOPP_DLL Redirector : public CustomSignalPropagation +{ +public: + enum Behavior + { + DATA_ONLY = 0x00, + PASS_SIGNALS = 0x01, + PASS_WAIT_OBJECTS = 0x02, + PASS_EVERYTHING = PASS_SIGNALS | PASS_WAIT_OBJECTS + }; + + Redirector() : m_target(NULL), m_behavior(PASS_EVERYTHING) {} + Redirector(BufferedTransformation &target, Behavior behavior=PASS_EVERYTHING) + : m_target(&target), m_behavior(behavior) {} + + void Redirect(BufferedTransformation &target) {m_target = ⌖} + void StopRedirection() {m_target = NULL;} + + Behavior GetBehavior() {return (Behavior) m_behavior;} + void SetBehavior(Behavior behavior) {m_behavior=behavior;} + bool GetPassSignals() const {return (m_behavior & PASS_SIGNALS) != 0;} + void SetPassSignals(bool pass) { if (pass) m_behavior |= PASS_SIGNALS; else m_behavior &= ~(word32) PASS_SIGNALS; } + bool GetPassWaitObjects() const {return (m_behavior & PASS_WAIT_OBJECTS) != 0;} + void SetPassWaitObjects(bool pass) { if (pass) m_behavior |= PASS_WAIT_OBJECTS; else m_behavior &= ~(word32) PASS_WAIT_OBJECTS; } + + bool CanModifyInput() const + {return m_target ? m_target->CanModifyInput() : false;} + + void Initialize(const NameValuePairs ¶meters, int propagation); + byte * CreatePutSpace(size_t &size) + {return m_target ? m_target->CreatePutSpace(size) : (byte *)(size=0, NULL);} + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking) + {return m_target ? m_target->Put2(begin, length, GetPassSignals() ? messageEnd : 0, blocking) : 0;} + bool Flush(bool hardFlush, int propagation=-1, bool blocking=true) + {return m_target && GetPassSignals() ? m_target->Flush(hardFlush, propagation, blocking) : false;} + bool MessageSeriesEnd(int propagation=-1, bool blocking=true) + {return m_target && GetPassSignals() ? m_target->MessageSeriesEnd(propagation, blocking) : false;} + + byte * ChannelCreatePutSpace(const std::string &channel, size_t &size) + {return m_target ? m_target->ChannelCreatePutSpace(channel, size) : (byte *)(size=0, NULL);} + size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking) + {return m_target ? m_target->ChannelPut2(channel, begin, length, GetPassSignals() ? messageEnd : 0, blocking) : 0;} + size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking) + {return m_target ? m_target->ChannelPutModifiable2(channel, begin, length, GetPassSignals() ? messageEnd : 0, blocking) : 0;} + bool ChannelFlush(const std::string &channel, bool completeFlush, int propagation=-1, bool blocking=true) + {return m_target && GetPassSignals() ? m_target->ChannelFlush(channel, completeFlush, propagation, blocking) : false;} + bool ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1, bool blocking=true) + {return m_target && GetPassSignals() ? m_target->ChannelMessageSeriesEnd(channel, propagation, blocking) : false;} + + unsigned int GetMaxWaitObjectCount() const + { return m_target && GetPassWaitObjects() ? m_target->GetMaxWaitObjectCount() : 0; } + void GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) + { if (m_target && GetPassWaitObjects()) m_target->GetWaitObjects(container, callStack); } + +private: + BufferedTransformation *m_target; + word32 m_behavior; +}; + +// Used By ProxyFilter +class CRYPTOPP_DLL OutputProxy : public CustomSignalPropagation +{ +public: + OutputProxy(BufferedTransformation &owner, bool passSignal) : m_owner(owner), m_passSignal(passSignal) {} + + bool GetPassSignal() const {return m_passSignal;} + void SetPassSignal(bool passSignal) {m_passSignal = passSignal;} + + byte * CreatePutSpace(size_t &size) + {return m_owner.AttachedTransformation()->CreatePutSpace(size);} + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking) + {return m_owner.AttachedTransformation()->Put2(begin, length, m_passSignal ? messageEnd : 0, blocking);} + size_t PutModifiable2(byte *begin, size_t length, int messageEnd, bool blocking) + {return m_owner.AttachedTransformation()->PutModifiable2(begin, length, m_passSignal ? messageEnd : 0, blocking);} + void Initialize(const NameValuePairs ¶meters=g_nullNameValuePairs, int propagation=-1) + {if (m_passSignal) m_owner.AttachedTransformation()->Initialize(parameters, propagation);} + bool Flush(bool hardFlush, int propagation=-1, bool blocking=true) + {return m_passSignal ? m_owner.AttachedTransformation()->Flush(hardFlush, propagation, blocking) : false;} + bool MessageSeriesEnd(int propagation=-1, bool blocking=true) + {return m_passSignal ? m_owner.AttachedTransformation()->MessageSeriesEnd(propagation, blocking) : false;} + + byte * ChannelCreatePutSpace(const std::string &channel, size_t &size) + {return m_owner.AttachedTransformation()->ChannelCreatePutSpace(channel, size);} + size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking) + {return m_owner.AttachedTransformation()->ChannelPut2(channel, begin, length, m_passSignal ? messageEnd : 0, blocking);} + size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking) + {return m_owner.AttachedTransformation()->ChannelPutModifiable2(channel, begin, length, m_passSignal ? messageEnd : 0, blocking);} + bool ChannelFlush(const std::string &channel, bool completeFlush, int propagation=-1, bool blocking=true) + {return m_passSignal ? m_owner.AttachedTransformation()->ChannelFlush(channel, completeFlush, propagation, blocking) : false;} + bool ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1, bool blocking=true) + {return m_passSignal ? m_owner.AttachedTransformation()->ChannelMessageSeriesEnd(channel, propagation, blocking) : false;} + +private: + BufferedTransformation &m_owner; + bool m_passSignal; +}; + +//! Base class for Filter classes that are proxies for a chain of other filters. +class CRYPTOPP_DLL ProxyFilter : public FilterWithBufferedInput +{ +public: + ProxyFilter(BufferedTransformation *filter, size_t firstSize, size_t lastSize, BufferedTransformation *attachment); + + bool IsolatedFlush(bool hardFlush, bool blocking); + + void SetFilter(Filter *filter); + void NextPutMultiple(const byte *s, size_t len); + void NextPutModifiable(byte *inString, size_t length); + +protected: + member_ptr m_filter; +}; + +//! simple proxy filter that doesn't modify the underlying filter's input or output +class CRYPTOPP_DLL SimpleProxyFilter : public ProxyFilter +{ +public: + SimpleProxyFilter(BufferedTransformation *filter, BufferedTransformation *attachment) + : ProxyFilter(filter, 0, 0, attachment) {} + + void FirstPut(const byte *) {} + void LastPut(const byte *, size_t) {m_filter->MessageEnd();} +}; + +//! proxy for the filter created by PK_Encryptor::CreateEncryptionFilter +/*! This class is here just to provide symmetry with VerifierFilter. */ +class CRYPTOPP_DLL PK_EncryptorFilter : public SimpleProxyFilter +{ +public: + PK_EncryptorFilter(RandomNumberGenerator &rng, const PK_Encryptor &encryptor, BufferedTransformation *attachment = NULL) + : SimpleProxyFilter(encryptor.CreateEncryptionFilter(rng), attachment) {} +}; + +//! proxy for the filter created by PK_Decryptor::CreateDecryptionFilter +/*! This class is here just to provide symmetry with SignerFilter. */ +class CRYPTOPP_DLL PK_DecryptorFilter : public SimpleProxyFilter +{ +public: + PK_DecryptorFilter(RandomNumberGenerator &rng, const PK_Decryptor &decryptor, BufferedTransformation *attachment = NULL) + : SimpleProxyFilter(decryptor.CreateDecryptionFilter(rng), attachment) {} +}; + +//! Append input to a string object +template +class StringSinkTemplate : public Bufferless +{ +public: + // VC60 workaround: no T::char_type + typedef typename T::traits_type::char_type char_type; + + StringSinkTemplate(T &output) + : m_output(&output) {assert(sizeof(output[0])==1);} + + void IsolatedInitialize(const NameValuePairs ¶meters) + {if (!parameters.GetValue("OutputStringPointer", m_output)) throw InvalidArgument("StringSink: OutputStringPointer not specified");} + + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking) + { + if (length > 0) + { + typename T::size_type size = m_output->size(); + if (length < size && size + length > m_output->capacity()) + m_output->reserve(2*size); + m_output->append((const char_type *)begin, (const char_type *)begin+length); + } + return 0; + } + +private: + T *m_output; +}; + +//! Append input to an std::string +CRYPTOPP_DLL_TEMPLATE_CLASS StringSinkTemplate; +typedef StringSinkTemplate StringSink; + +//! incorporates input into RNG as additional entropy +class RandomNumberSink : public Bufferless +{ +public: + RandomNumberSink() + : m_rng(NULL) {} + + RandomNumberSink(RandomNumberGenerator &rng) + : m_rng(&rng) {} + + void IsolatedInitialize(const NameValuePairs ¶meters); + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + +private: + RandomNumberGenerator *m_rng; +}; + +//! Copy input to a memory buffer +class CRYPTOPP_DLL ArraySink : public Bufferless +{ +public: + ArraySink(const NameValuePairs ¶meters = g_nullNameValuePairs) {IsolatedInitialize(parameters);} + ArraySink(byte *buf, size_t size) : m_buf(buf), m_size(size), m_total(0) {} + + size_t AvailableSize() {return SaturatingSubtract(m_size, m_total);} + lword TotalPutLength() {return m_total;} + + void IsolatedInitialize(const NameValuePairs ¶meters); + byte * CreatePutSpace(size_t &size); + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + +protected: + byte *m_buf; + size_t m_size; + lword m_total; +}; + +//! Xor input to a memory buffer +class CRYPTOPP_DLL ArrayXorSink : public ArraySink +{ +public: + ArrayXorSink(byte *buf, size_t size) + : ArraySink(buf, size) {} + + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + byte * CreatePutSpace(size_t &size) {return BufferedTransformation::CreatePutSpace(size);} +}; + +//! string-based implementation of Store interface +class StringStore : public Store +{ +public: + StringStore(const char *string = NULL) + {StoreInitialize(MakeParameters("InputBuffer", ConstByteArrayParameter(string)));} + StringStore(const byte *string, size_t length) + {StoreInitialize(MakeParameters("InputBuffer", ConstByteArrayParameter(string, length)));} + template StringStore(const T &string) + {StoreInitialize(MakeParameters("InputBuffer", ConstByteArrayParameter(string)));} + + CRYPTOPP_DLL size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + CRYPTOPP_DLL size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const; + +private: + CRYPTOPP_DLL void StoreInitialize(const NameValuePairs ¶meters); + + const byte *m_store; + size_t m_length, m_count; +}; + +//! RNG-based implementation of Source interface +class CRYPTOPP_DLL RandomNumberStore : public Store +{ +public: + RandomNumberStore() + : m_rng(NULL), m_length(0), m_count(0) {} + + RandomNumberStore(RandomNumberGenerator &rng, lword length) + : m_rng(&rng), m_length(length), m_count(0) {} + + bool AnyRetrievable() const {return MaxRetrievable() != 0;} + lword MaxRetrievable() const {return m_length-m_count;} + + size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const + { + throw NotImplemented("RandomNumberStore: CopyRangeTo2() is not supported by this store"); + } + +private: + void StoreInitialize(const NameValuePairs ¶meters); + + RandomNumberGenerator *m_rng; + lword m_length, m_count; +}; + +//! empty store +class CRYPTOPP_DLL NullStore : public Store +{ +public: + NullStore(lword size = ULONG_MAX) : m_size(size) {} + void StoreInitialize(const NameValuePairs ¶meters) {} + lword MaxRetrievable() const {return m_size;} + size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const; + +private: + lword m_size; +}; + +//! A Filter that pumps data into its attachment as input +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Source : public InputRejecting +{ +public: + Source(BufferedTransformation *attachment = NULL) + {Source::Detach(attachment);} + + lword Pump(lword pumpMax=size_t(0)-1) + {Pump2(pumpMax); return pumpMax;} + unsigned int PumpMessages(unsigned int count=UINT_MAX) + {PumpMessages2(count); return count;} + void PumpAll() + {PumpAll2();} + virtual size_t Pump2(lword &byteCount, bool blocking=true) =0; + virtual size_t PumpMessages2(unsigned int &messageCount, bool blocking=true) =0; + virtual size_t PumpAll2(bool blocking=true); + virtual bool SourceExhausted() const =0; + +protected: + void SourceInitialize(bool pumpAll, const NameValuePairs ¶meters) + { + IsolatedInitialize(parameters); + if (pumpAll) + PumpAll(); + } +}; + +//! Turn a Store into a Source +template +class SourceTemplate : public Source +{ +public: + SourceTemplate(BufferedTransformation *attachment) + : Source(attachment) {} + void IsolatedInitialize(const NameValuePairs ¶meters) + {m_store.IsolatedInitialize(parameters);} + size_t Pump2(lword &byteCount, bool blocking=true) + {return m_store.TransferTo2(*AttachedTransformation(), byteCount, DEFAULT_CHANNEL, blocking);} + size_t PumpMessages2(unsigned int &messageCount, bool blocking=true) + {return m_store.TransferMessagesTo2(*AttachedTransformation(), messageCount, DEFAULT_CHANNEL, blocking);} + size_t PumpAll2(bool blocking=true) + {return m_store.TransferAllTo2(*AttachedTransformation(), DEFAULT_CHANNEL, blocking);} + bool SourceExhausted() const + {return !m_store.AnyRetrievable() && !m_store.AnyMessages();} + void SetAutoSignalPropagation(int propagation) + {m_store.SetAutoSignalPropagation(propagation);} + int GetAutoSignalPropagation() const + {return m_store.GetAutoSignalPropagation();} + +protected: + T m_store; +}; + +//! string-based implementation of Source interface +class CRYPTOPP_DLL StringSource : public SourceTemplate +{ +public: + StringSource(BufferedTransformation *attachment = NULL) + : SourceTemplate(attachment) {} + //! zero terminated string as source + StringSource(const char *string, bool pumpAll, BufferedTransformation *attachment = NULL) + : SourceTemplate(attachment) {SourceInitialize(pumpAll, MakeParameters("InputBuffer", ConstByteArrayParameter(string)));} + //! binary byte array as source + StringSource(const byte *string, size_t length, bool pumpAll, BufferedTransformation *attachment = NULL) + : SourceTemplate(attachment) {SourceInitialize(pumpAll, MakeParameters("InputBuffer", ConstByteArrayParameter(string, length)));} + //! std::string as source + StringSource(const std::string &string, bool pumpAll, BufferedTransformation *attachment = NULL) + : SourceTemplate(attachment) {SourceInitialize(pumpAll, MakeParameters("InputBuffer", ConstByteArrayParameter(string)));} +}; + +//! use the third constructor for an array source +typedef StringSource ArraySource; + +//! RNG-based implementation of Source interface +class CRYPTOPP_DLL RandomNumberSource : public SourceTemplate +{ +public: + RandomNumberSource(RandomNumberGenerator &rng, int length, bool pumpAll, BufferedTransformation *attachment = NULL) + : SourceTemplate(attachment) + {SourceInitialize(pumpAll, MakeParameters("RandomNumberGeneratorPointer", &rng)("RandomNumberStoreSize", length));} +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/fips140.cpp b/cryptopp/fips140.cpp new file mode 100644 index 0000000..1fcf590 --- /dev/null +++ b/cryptopp/fips140.cpp @@ -0,0 +1,84 @@ +// fips140.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "fips140.h" +#include "trdlocal.h" // needs to be included last for cygwin + +NAMESPACE_BEGIN(CryptoPP) + +// Define this to 1 to turn on FIPS 140-2 compliance features, including additional tests during +// startup, random number generation, and key generation. These tests may affect performance. +#ifndef CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 +#define CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 0 +#endif + +#if (CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 && !defined(THREADS_AVAILABLE)) +#error FIPS 140-2 compliance requires the availability of thread local storage. +#endif + +#if (CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 && !defined(OS_RNG_AVAILABLE)) +#error FIPS 140-2 compliance requires the availability of OS provided RNG. +#endif + +PowerUpSelfTestStatus g_powerUpSelfTestStatus = POWER_UP_SELF_TEST_NOT_DONE; + +bool FIPS_140_2_ComplianceEnabled() +{ + return CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2; +} + +void SimulatePowerUpSelfTestFailure() +{ + g_powerUpSelfTestStatus = POWER_UP_SELF_TEST_FAILED; +} + +PowerUpSelfTestStatus CRYPTOPP_API GetPowerUpSelfTestStatus() +{ + return g_powerUpSelfTestStatus; +} + +#if CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 +ThreadLocalStorage & AccessPowerUpSelfTestInProgress() +{ + static ThreadLocalStorage selfTestInProgress; + return selfTestInProgress; +} +#endif + +bool PowerUpSelfTestInProgressOnThisThread() +{ +#if CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 + return AccessPowerUpSelfTestInProgress().GetValue() != NULL; +#else + assert(false); // should not be called + return false; +#endif +} + +void SetPowerUpSelfTestInProgressOnThisThread(bool inProgress) +{ +#if CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 + AccessPowerUpSelfTestInProgress().SetValue((void *)inProgress); +#endif +} + +void EncryptionPairwiseConsistencyTest_FIPS_140_Only(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor) +{ +#if CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 + EncryptionPairwiseConsistencyTest(encryptor, decryptor); +#endif +} + +void SignaturePairwiseConsistencyTest_FIPS_140_Only(const PK_Signer &signer, const PK_Verifier &verifier) +{ +#if CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 + SignaturePairwiseConsistencyTest(signer, verifier); +#endif +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/fips140.h b/cryptopp/fips140.h new file mode 100644 index 0000000..a3e5386 --- /dev/null +++ b/cryptopp/fips140.h @@ -0,0 +1,59 @@ +#ifndef CRYPTOPP_FIPS140_H +#define CRYPTOPP_FIPS140_H + +/*! \file + FIPS 140 related functions and classes. +*/ + +#include "cryptlib.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! exception thrown when a crypto algorithm is used after a self test fails +class CRYPTOPP_DLL SelfTestFailure : public Exception +{ +public: + explicit SelfTestFailure(const std::string &s) : Exception(OTHER_ERROR, s) {} +}; + +//! returns whether FIPS 140-2 compliance features were enabled at compile time +CRYPTOPP_DLL bool CRYPTOPP_API FIPS_140_2_ComplianceEnabled(); + +//! enum values representing status of the power-up self test +enum PowerUpSelfTestStatus {POWER_UP_SELF_TEST_NOT_DONE, POWER_UP_SELF_TEST_FAILED, POWER_UP_SELF_TEST_PASSED}; + +//! perform the power-up self test, and set the self test status +CRYPTOPP_DLL void CRYPTOPP_API DoPowerUpSelfTest(const char *moduleFilename, const byte *expectedModuleMac); + +//! perform the power-up self test using the filename of this DLL and the embedded module MAC +CRYPTOPP_DLL void CRYPTOPP_API DoDllPowerUpSelfTest(); + +//! set the power-up self test status to POWER_UP_SELF_TEST_FAILED +CRYPTOPP_DLL void CRYPTOPP_API SimulatePowerUpSelfTestFailure(); + +//! return the current power-up self test status +CRYPTOPP_DLL PowerUpSelfTestStatus CRYPTOPP_API GetPowerUpSelfTestStatus(); + +typedef PowerUpSelfTestStatus (CRYPTOPP_API * PGetPowerUpSelfTestStatus)(); + +CRYPTOPP_DLL MessageAuthenticationCode * CRYPTOPP_API NewIntegrityCheckingMAC(); + +CRYPTOPP_DLL bool CRYPTOPP_API IntegrityCheckModule(const char *moduleFilename, const byte *expectedModuleMac, SecByteBlock *pActualMac = NULL, unsigned long *pMacFileLocation = NULL); + +// this is used by Algorithm constructor to allow Algorithm objects to be constructed for the self test +bool PowerUpSelfTestInProgressOnThisThread(); + +void SetPowerUpSelfTestInProgressOnThisThread(bool inProgress); + +void SignaturePairwiseConsistencyTest(const PK_Signer &signer, const PK_Verifier &verifier); +void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor); + +void SignaturePairwiseConsistencyTest_FIPS_140_Only(const PK_Signer &signer, const PK_Verifier &verifier); +void EncryptionPairwiseConsistencyTest_FIPS_140_Only(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor); + +#define CRYPTOPP_DUMMY_DLL_MAC "MAC_51f34b8db820ae8" + +NAMESPACE_END + +#endif diff --git a/cryptopp/fipsalgt.cpp b/cryptopp/fipsalgt.cpp new file mode 100644 index 0000000..92c254f --- /dev/null +++ b/cryptopp/fipsalgt.cpp @@ -0,0 +1,1290 @@ +// fipsalgt.cpp - written and placed in the public domain by Wei Dai + +// This file implements the various algorithm tests needed to pass FIPS 140 validation. +// They're preserved here (commented out) in case Crypto++ needs to be revalidated. + +#if 0 +#ifndef CRYPTOPP_IMPORTS +#define CRYPTOPP_DEFAULT_NO_DLL +#endif +#include "dll.h" +#include "oids.h" + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +class LineBreakParser : public AutoSignaling > +{ +public: + LineBreakParser(BufferedTransformation *attachment=NULL, byte lineEnd='\n') + : m_lineEnd(lineEnd) {Detach(attachment);} + + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking) + { + if (!blocking) + throw BlockingInputOnly("LineBreakParser"); + + unsigned int i, last = 0; + for (i=0; iPut2(begin+last, i-last, GetAutoSignalPropagation(), blocking); + last = i+1; + } + } + if (last != i) + AttachedTransformation()->Put2(begin+last, i-last, 0, blocking); + + if (messageEnd && GetAutoSignalPropagation()) + { + AttachedTransformation()->MessageEnd(GetAutoSignalPropagation()-1, blocking); + AttachedTransformation()->MessageSeriesEnd(GetAutoSignalPropagation()-1, blocking); + } + + return 0; + } + +private: + byte m_lineEnd; +}; + +class TestDataParser : public Unflushable +{ +public: + enum DataType {OTHER, COUNT, KEY_T, IV, INPUT, OUTPUT}; + + TestDataParser(std::string algorithm, std::string test, std::string mode, unsigned int feedbackSize, bool encrypt, BufferedTransformation *attachment) + : m_algorithm(algorithm), m_test(test), m_mode(mode), m_feedbackSize(feedbackSize) + , m_firstLine(true), m_blankLineTransition(0) + { + Detach(attachment); + + m_typeToName[COUNT] = "COUNT"; + + m_nameToType["COUNT"] = COUNT; + m_nameToType["KEY"] = KEY_T; + m_nameToType["KEYs"] = KEY_T; + m_nameToType["key"] = KEY_T; + m_nameToType["Key"] = KEY_T; + m_nameToType["IV"] = IV; + m_nameToType["IV1"] = IV; + m_nameToType["CV"] = IV; + m_nameToType["CV1"] = IV; + m_nameToType["IB"] = IV; + m_nameToType["TEXT"] = INPUT; + m_nameToType["RESULT"] = OUTPUT; + m_nameToType["Msg"] = INPUT; + m_nameToType["Seed"] = INPUT; + m_nameToType["V"] = INPUT; + m_nameToType["DT"] = IV; + SetEncrypt(encrypt); + + if (m_algorithm == "DSA" || m_algorithm == "ECDSA") + { + if (m_test == "PKV") + m_trigger = "Qy"; + else if (m_test == "KeyPair") + m_trigger = "N"; + else if (m_test == "SigGen") + m_trigger = "Msg"; + else if (m_test == "SigVer") + m_trigger = "S"; + else if (m_test == "PQGGen") + m_trigger = "N"; + else if (m_test == "PQGVer") + m_trigger = "H"; + } + else if (m_algorithm == "HMAC") + m_trigger = "Msg"; + else if (m_algorithm == "SHA") + m_trigger = (m_test == "MONTE") ? "Seed" : "Msg"; + else if (m_algorithm == "RNG") + m_trigger = "V"; + else if (m_algorithm == "RSA") + m_trigger = (m_test == "Ver") ? "S" : "Msg"; + } + + void SetEncrypt(bool encrypt) + { + m_encrypt = encrypt; + if (encrypt) + { + m_nameToType["PLAINTEXT"] = INPUT; + m_nameToType["CIPHERTEXT"] = OUTPUT; + m_nameToType["PT"] = INPUT; + m_nameToType["CT"] = OUTPUT; + } + else + { + m_nameToType["PLAINTEXT"] = OUTPUT; + m_nameToType["CIPHERTEXT"] = INPUT; + m_nameToType["PT"] = OUTPUT; + m_nameToType["CT"] = INPUT; + } + + if (m_algorithm == "AES" || m_algorithm == "TDES") + { + if (encrypt) + { + m_trigger = "PLAINTEXT"; + m_typeToName[OUTPUT] = "CIPHERTEXT"; + } + else + { + m_trigger = "CIPHERTEXT"; + m_typeToName[OUTPUT] = "PLAINTEXT"; + } + m_count = 0; + } + } + +protected: + void OutputData(std::string &output, const std::string &key, const std::string &data) + { + output += key; + output += "= "; + output += data; + output += "\n"; + } + + void OutputData(std::string &output, const std::string &key, int data) + { + OutputData(output, key, IntToString(data)); + } + + void OutputData(std::string &output, const std::string &key, const SecByteBlock &data) + { + output += key; + output += "= "; + HexEncoder(new StringSink(output), false).Put(data, data.size()); + output += "\n"; + } + + void OutputData(std::string &output, const std::string &key, const Integer &data, int size=-1) + { + SecByteBlock s(size < 0 ? data.MinEncodedSize() : size); + data.Encode(s, s.size()); + OutputData(output, key, s); + } + + void OutputData(std::string &output, const std::string &key, const PolynomialMod2 &data, int size=-1) + { + SecByteBlock s(size < 0 ? data.MinEncodedSize() : size); + data.Encode(s, s.size()); + OutputData(output, key, s); + } + + void OutputData(std::string &output, DataType t, const std::string &data) + { + if (m_algorithm == "SKIPJACK") + { + if (m_test == "KAT") + { + if (t == OUTPUT) + output = m_line + data + "\n"; + } + else + { + if (t != COUNT) + { + output += m_typeToName[t]; + output += "="; + } + output += data; + output += t == OUTPUT ? "\n" : " "; + } + } + else if (m_algorithm == "TDES" && t == KEY_T && m_typeToName[KEY_T].empty()) + { + output += "KEY1 = "; + output += data.substr(0, 16); + output += "\nKEY2 = "; + output += data.size() > 16 ? data.substr(16, 16) : data.substr(0, 16); + output += "\nKEY3 = "; + output += data.size() > 32 ? data.substr(32, 16) : data.substr(0, 16); + output += "\n"; + } + else + { + output += m_typeToName[t]; + output += " = "; + output += data; + output += "\n"; + } + } + + void OutputData(std::string &output, DataType t, int i) + { + OutputData(output, t, IntToString(i)); + } + + void OutputData(std::string &output, DataType t, const SecByteBlock &data) + { + std::string hexData; + StringSource(data.begin(), data.size(), true, new HexEncoder(new StringSink(hexData), false)); + OutputData(output, t, hexData); + } + + void OutputGivenData(std::string &output, DataType t, bool optional = false) + { + if (m_data.find(m_typeToName[t]) == m_data.end()) + { + if (optional) + return; + throw Exception(Exception::OTHER_ERROR, "TestDataParser: key not found: " + m_typeToName[t]); + } + + OutputData(output, t, m_data[m_typeToName[t]]); + } + + template + BlockCipher * NewBT(T *) + { + if (!m_encrypt && (m_mode == "ECB" || m_mode == "CBC")) + return new typename T::Decryption; + else + return new typename T::Encryption; + } + + template + SymmetricCipher * NewMode(T *, BlockCipher &bt, const byte *iv) + { + if (!m_encrypt) + return new typename T::Decryption(bt, iv, m_feedbackSize/8); + else + return new typename T::Encryption(bt, iv, m_feedbackSize/8); + } + + static inline void Xor(SecByteBlock &z, const SecByteBlock &x, const SecByteBlock &y) + { + assert(x.size() == y.size()); + z.resize(x.size()); + xorbuf(z, x, y, x.size()); + } + + SecByteBlock UpdateKey(SecByteBlock key, const SecByteBlock *text) + { + unsigned int innerCount = (m_algorithm == "AES") ? 1000 : 10000; + int keySize = key.size(), blockSize = text[0].size(); + SecByteBlock x(keySize); + for (int k=0; k + void EC_KeyPair(string &output, int n, const OID &oid) + { + DL_GroupParameters_EC params(oid); + for (int i=0; i priv; + DL_PublicKey_EC pub; + priv.Initialize(m_rng, params); + priv.MakePublicKey(pub); + + OutputData(output, "d ", priv.GetPrivateExponent()); + OutputData(output, "Qx ", pub.GetPublicElement().x, params.GetCurve().GetField().MaxElementByteLength()); + OutputData(output, "Qy ", pub.GetPublicElement().y, params.GetCurve().GetField().MaxElementByteLength()); + } + } + + template + void EC_SigGen(string &output, const OID &oid) + { + DL_GroupParameters_EC params(oid); + typename ECDSA::PrivateKey priv; + typename ECDSA::PublicKey pub; + priv.Initialize(m_rng, params); + priv.MakePublicKey(pub); + + typename ECDSA::Signer signer(priv); + SecByteBlock sig(signer.SignatureLength()); + StringSource(m_data["Msg"], true, new HexDecoder(new SignerFilter(m_rng, signer, new ArraySink(sig, sig.size())))); + SecByteBlock R(sig, sig.size()/2), S(sig+sig.size()/2, sig.size()/2); + + OutputData(output, "Qx ", pub.GetPublicElement().x, params.GetCurve().GetField().MaxElementByteLength()); + OutputData(output, "Qy ", pub.GetPublicElement().y, params.GetCurve().GetField().MaxElementByteLength()); + OutputData(output, "R ", R); + OutputData(output, "S ", S); + } + + template + void EC_SigVer(string &output, const OID &oid) + { + SecByteBlock x(DecodeHex(m_data["Qx"])); + SecByteBlock y(DecodeHex(m_data["Qy"])); + Integer r((m_data["R"]+"h").c_str()); + Integer s((m_data["S"]+"h").c_str()); + + typename EC::FieldElement Qx(x, x.size()); + typename EC::FieldElement Qy(y, y.size()); + typename EC::Element Q(Qx, Qy); + + DL_GroupParameters_EC params(oid); + typename ECDSA::PublicKey pub; + pub.Initialize(params, Q); + typename ECDSA::Verifier verifier(pub); + + SecByteBlock sig(verifier.SignatureLength()); + r.Encode(sig, sig.size()/2); + s.Encode(sig+sig.size()/2, sig.size()/2); + + SignatureVerificationFilter filter(verifier); + filter.Put(sig, sig.size()); + StringSource(m_data["Msg"], true, new HexDecoder(new Redirector(filter, Redirector::DATA_ONLY))); + filter.MessageEnd(); + byte b; + filter.Get(b); + OutputData(output, "Result ", b ? "P" : "F"); + } + + template + static bool EC_PKV(RandomNumberGenerator &rng, const SecByteBlock &x, const SecByteBlock &y, const OID &oid) + { + typename EC::FieldElement Qx(x, x.size()); + typename EC::FieldElement Qy(y, y.size()); + typename EC::Element Q(Qx, Qy); + + DL_GroupParameters_EC params(oid); + typename ECDSA::PublicKey pub; + pub.Initialize(params, Q); + return pub.Validate(rng, 3); + } + + template + Result * CreateRSA2(const std::string &standard) + { + if (typeid(Result) == typeid(PK_Verifier)) + { + if (standard == "R") + return (Result *) new typename RSASS_ISO::Verifier; + else if (standard == "P") + return (Result *) new typename RSASS::Verifier; + else if (standard == "1") + return (Result *) new typename RSASS::Verifier; + } + else if (typeid(Result) == typeid(PK_Signer)) + { + if (standard == "R") + return (Result *) new typename RSASS_ISO::Signer; + else if (standard == "P") + return (Result *) new typename RSASS::Signer; + else if (standard == "1") + return (Result *) new typename RSASS::Signer; + } + + return NULL; + } + + template + Result * CreateRSA(const std::string &standard, const std::string &hash) + { + if (hash == "1") + return CreateRSA2(standard); + else if (hash == "224") + return CreateRSA2(standard); + else if (hash == "256") + return CreateRSA2(standard); + else if (hash == "384") + return CreateRSA2(standard); + else if (hash == "512") + return CreateRSA2(standard); + else + return NULL; + } + + virtual void DoTest() + { + std::string output; + + if (m_algorithm == "DSA") + { + if (m_test == "KeyPair") + { + DL_GroupParameters_DSA pqg; + int modLen = atol(m_bracketString.substr(6).c_str()); + pqg.GenerateRandomWithKeySize(m_rng, modLen); + + OutputData(output, "P ", pqg.GetModulus()); + OutputData(output, "Q ", pqg.GetSubgroupOrder()); + OutputData(output, "G ", pqg.GetSubgroupGenerator()); + + int n = atol(m_data["N"].c_str()); + for (int i=0; iPut((byte *)output.data(), output.size()); + output.resize(0); + } + } + else if (m_test == "PQGGen") + { + int n = atol(m_data["N"].c_str()); + for (int i=0; iPut((byte *)output.data(), output.size()); + output.resize(0); + } + } + else if (m_test == "SigGen") + { + std::string &encodedKey = m_data["PrivKey"]; + int modLen = atol(m_bracketString.substr(6).c_str()); + DSA::PrivateKey priv; + + if (!encodedKey.empty()) + { + StringStore s(encodedKey); + priv.BERDecode(s); + if (priv.GetGroupParameters().GetModulus().BitCount() != modLen) + encodedKey.clear(); + } + + if (encodedKey.empty()) + { + priv.Initialize(m_rng, modLen); + StringSink s(encodedKey); + priv.DEREncode(s); + OutputData(output, "P ", priv.GetGroupParameters().GetModulus()); + OutputData(output, "Q ", priv.GetGroupParameters().GetSubgroupOrder()); + OutputData(output, "G ", priv.GetGroupParameters().GetSubgroupGenerator()); + } + + DSA::Signer signer(priv); + DSA::Verifier pub(signer); + OutputData(output, "Msg ", m_data["Msg"]); + OutputData(output, "Y ", pub.GetKey().GetPublicElement()); + + SecByteBlock sig(signer.SignatureLength()); + StringSource(m_data["Msg"], true, new HexDecoder(new SignerFilter(m_rng, signer, new ArraySink(sig, sig.size())))); + SecByteBlock R(sig, sig.size()/2), S(sig+sig.size()/2, sig.size()/2); + OutputData(output, "R ", R); + OutputData(output, "S ", S); + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + } + else if (m_test == "SigVer") + { + Integer p((m_data["P"] + "h").c_str()); + Integer q((m_data["Q"] + "h").c_str()); + Integer g((m_data["G"] + "h").c_str()); + Integer y((m_data["Y"] + "h").c_str()); + DSA::Verifier verifier(p, q, g, y); + + HexDecoder filter(new SignatureVerificationFilter(verifier)); + StringSource(m_data["R"], true, new Redirector(filter, Redirector::DATA_ONLY)); + StringSource(m_data["S"], true, new Redirector(filter, Redirector::DATA_ONLY)); + StringSource(m_data["Msg"], true, new Redirector(filter, Redirector::DATA_ONLY)); + filter.MessageEnd(); + byte b; + filter.Get(b); + OutputData(output, "Result ", b ? "P" : "F"); + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + } + else if (m_test == "PQGVer") + { + Integer p((m_data["P"] + "h").c_str()); + Integer q((m_data["Q"] + "h").c_str()); + Integer g((m_data["G"] + "h").c_str()); + Integer h((m_data["H"] + "h").c_str()); + int c = atol(m_data["c"].c_str()); + SecByteBlock seed(m_data["Seed"].size()/2); + StringSource(m_data["Seed"], true, new HexDecoder(new ArraySink(seed, seed.size()))); + + Integer p1, q1; + bool result = DSA::GeneratePrimes(seed, seed.size()*8, c, p1, 1024, q1, true); + result = result && (p1 == p && q1 == q); + result = result && g == a_exp_b_mod_c(h, (p-1)/q, p); + + OutputData(output, "Result ", result ? "P" : "F"); + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + } + + return; + } + + if (m_algorithm == "ECDSA") + { + std::map name2oid; + name2oid["P-192"] = ASN1::secp192r1(); + name2oid["P-224"] = ASN1::secp224r1(); + name2oid["P-256"] = ASN1::secp256r1(); + name2oid["P-384"] = ASN1::secp384r1(); + name2oid["P-521"] = ASN1::secp521r1(); + name2oid["K-163"] = ASN1::sect163k1(); + name2oid["K-233"] = ASN1::sect233k1(); + name2oid["K-283"] = ASN1::sect283k1(); + name2oid["K-409"] = ASN1::sect409k1(); + name2oid["K-571"] = ASN1::sect571k1(); + name2oid["B-163"] = ASN1::sect163r2(); + name2oid["B-233"] = ASN1::sect233r1(); + name2oid["B-283"] = ASN1::sect283r1(); + name2oid["B-409"] = ASN1::sect409r1(); + name2oid["B-571"] = ASN1::sect571r1(); + + if (m_test == "PKV") + { + bool pass; + if (m_bracketString[0] == 'P') + pass = EC_PKV(m_rng, DecodeHex(m_data["Qx"]), DecodeHex(m_data["Qy"]), name2oid[m_bracketString]); + else + pass = EC_PKV(m_rng, DecodeHex(m_data["Qx"]), DecodeHex(m_data["Qy"]), name2oid[m_bracketString]); + + OutputData(output, "Result ", pass ? "P" : "F"); + } + else if (m_test == "KeyPair") + { + if (m_bracketString[0] == 'P') + EC_KeyPair(output, atol(m_data["N"].c_str()), name2oid[m_bracketString]); + else + EC_KeyPair(output, atol(m_data["N"].c_str()), name2oid[m_bracketString]); + } + else if (m_test == "SigGen") + { + if (m_bracketString[0] == 'P') + EC_SigGen(output, name2oid[m_bracketString]); + else + EC_SigGen(output, name2oid[m_bracketString]); + } + else if (m_test == "SigVer") + { + if (m_bracketString[0] == 'P') + EC_SigVer(output, name2oid[m_bracketString]); + else + EC_SigVer(output, name2oid[m_bracketString]); + } + + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + return; + } + + if (m_algorithm == "RSA") + { + std::string shaAlg = m_data["SHAAlg"].substr(3); + + if (m_test == "Ver") + { + Integer n((m_data["n"] + "h").c_str()); + Integer e((m_data["e"] + "h").c_str()); + RSA::PublicKey pub; + pub.Initialize(n, e); + + member_ptr pV(CreateRSA(m_mode, shaAlg)); + pV->AccessMaterial().AssignFrom(pub); + + HexDecoder filter(new SignatureVerificationFilter(*pV)); + for (unsigned int i=m_data["S"].size(); iSignatureLength()*2; i++) + filter.Put('0'); + StringSource(m_data["S"], true, new Redirector(filter, Redirector::DATA_ONLY)); + StringSource(m_data["Msg"], true, new Redirector(filter, Redirector::DATA_ONLY)); + filter.MessageEnd(); + byte b; + filter.Get(b); + OutputData(output, "Result ", b ? "P" : "F"); + } + else + { + assert(m_test == "Gen"); + int modLen = atol(m_bracketString.substr(6).c_str()); + std::string &encodedKey = m_data["PrivKey"]; + RSA::PrivateKey priv; + + if (!encodedKey.empty()) + { + StringStore s(encodedKey); + priv.BERDecode(s); + if (priv.GetModulus().BitCount() != modLen) + encodedKey.clear(); + } + + if (encodedKey.empty()) + { + priv.Initialize(m_rng, modLen); + StringSink s(encodedKey); + priv.DEREncode(s); + OutputData(output, "n ", priv.GetModulus()); + OutputData(output, "e ", priv.GetPublicExponent(), modLen/8); + } + + member_ptr pS(CreateRSA(m_mode, shaAlg)); + pS->AccessMaterial().AssignFrom(priv); + + SecByteBlock sig(pS->SignatureLength()); + StringSource(m_data["Msg"], true, new HexDecoder(new SignerFilter(m_rng, *pS, new ArraySink(sig, sig.size())))); + OutputData(output, "SHAAlg ", m_data["SHAAlg"]); + OutputData(output, "Msg ", m_data["Msg"]); + OutputData(output, "S ", sig); + } + + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + return; + } + + if (m_algorithm == "SHA") + { + member_ptr pHF; + + if (m_mode == "1") + pHF.reset(new SHA1); + else if (m_mode == "224") + pHF.reset(new SHA224); + else if (m_mode == "256") + pHF.reset(new SHA256); + else if (m_mode == "384") + pHF.reset(new SHA384); + else if (m_mode == "512") + pHF.reset(new SHA512); + + if (m_test == "MONTE") + { + SecByteBlock seed = m_data2[INPUT]; + SecByteBlock MD[1003]; + int i,j; + + for (j=0; j<100; j++) + { + MD[0] = MD[1] = MD[2] = seed; + for (i=3; i<1003; i++) + { + SecByteBlock Mi = MD[i-3] + MD[i-2] + MD[i-1]; + MD[i].resize(pHF->DigestSize()); + pHF->CalculateDigest(MD[i], Mi, Mi.size()); + } + seed = MD[1002]; + OutputData(output, "COUNT ", j); + OutputData(output, "MD ", seed); + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + } + } + else + { + SecByteBlock tag(pHF->DigestSize()); + SecByteBlock &msg(m_data2[INPUT]); + int len = atol(m_data["Len"].c_str()); + StringSource(msg.begin(), len/8, true, new HashFilter(*pHF, new ArraySink(tag, tag.size()))); + OutputData(output, "MD ", tag); + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + } + return; + } + + SecByteBlock &key = m_data2[KEY_T]; + + if (m_algorithm == "TDES") + { + if (!m_data["KEY1"].empty()) + { + const std::string keys[3] = {m_data["KEY1"], m_data["KEY2"], m_data["KEY3"]}; + key.resize(24); + HexDecoder hexDec(new ArraySink(key, key.size())); + for (int i=0; i<3; i++) + hexDec.Put((byte *)keys[i].data(), keys[i].size()); + + if (keys[0] == keys[2]) + { + if (keys[0] == keys[1]) + key.resize(8); + else + key.resize(16); + } + else + key.resize(24); + } + } + + if (m_algorithm == "RNG") + { + key.resize(24); + StringSource(m_data["Key1"] + m_data["Key2"] + m_data["Key3"], true, new HexDecoder(new ArraySink(key, key.size()))); + + SecByteBlock seed(m_data2[INPUT]), dt(m_data2[IV]), r(8); + X917RNG rng(new DES_EDE3::Encryption(key, key.size()), seed, dt); + + if (m_test == "MCT") + { + for (int i=0; i<10000; i++) + rng.GenerateBlock(r, r.size()); + } + else + { + rng.GenerateBlock(r, r.size()); + } + + OutputData(output, "R ", r); + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + return; + } + + if (m_algorithm == "HMAC") + { + member_ptr pMAC; + + if (m_bracketString == "L=20") + pMAC.reset(new HMAC); + else if (m_bracketString == "L=28") + pMAC.reset(new HMAC); + else if (m_bracketString == "L=32") + pMAC.reset(new HMAC); + else if (m_bracketString == "L=48") + pMAC.reset(new HMAC); + else if (m_bracketString == "L=64") + pMAC.reset(new HMAC); + else + throw Exception(Exception::OTHER_ERROR, "TestDataParser: unexpected HMAC bracket string: " + m_bracketString); + + pMAC->SetKey(key, key.size()); + int Tlen = atol(m_data["Tlen"].c_str()); + SecByteBlock tag(Tlen); + StringSource(m_data["Msg"], true, new HexDecoder(new HashFilter(*pMAC, new ArraySink(tag, Tlen), false, Tlen))); + OutputData(output, "Mac ", tag); + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + return; + } + + member_ptr pBT; + if (m_algorithm == "DES") + pBT.reset(NewBT((DES*)0)); + else if (m_algorithm == "TDES") + { + if (key.size() == 8) + pBT.reset(NewBT((DES*)0)); + else if (key.size() == 16) + pBT.reset(NewBT((DES_EDE2*)0)); + else + pBT.reset(NewBT((DES_EDE3*)0)); + } + else if (m_algorithm == "SKIPJACK") + pBT.reset(NewBT((SKIPJACK*)0)); + else if (m_algorithm == "AES") + pBT.reset(NewBT((AES*)0)); + else + throw Exception(Exception::OTHER_ERROR, "TestDataParser: unexpected algorithm: " + m_algorithm); + + if (!pBT->IsValidKeyLength(key.size())) + key.CleanNew(pBT->DefaultKeyLength()); // for Scbcvrct + pBT->SetKey(key.data(), key.size()); + + SecByteBlock &iv = m_data2[IV]; + if (iv.empty()) + iv.CleanNew(pBT->BlockSize()); + + member_ptr pCipher; + unsigned int K = m_feedbackSize; + + if (m_mode == "ECB") + pCipher.reset(NewMode((ECB_Mode_ExternalCipher*)0, *pBT, iv)); + else if (m_mode == "CBC") + pCipher.reset(NewMode((CBC_Mode_ExternalCipher*)0, *pBT, iv)); + else if (m_mode == "CFB") + pCipher.reset(NewMode((CFB_Mode_ExternalCipher*)0, *pBT, iv)); + else if (m_mode == "OFB") + pCipher.reset(NewMode((OFB_Mode_ExternalCipher*)0, *pBT, iv)); + else + throw Exception(Exception::OTHER_ERROR, "TestDataParser: unexpected mode: " + m_mode); + + bool encrypt = m_encrypt; + + if (m_test == "MONTE") + { + SecByteBlock KEY[401]; + KEY[0] = key; + int keySize = key.size(); + int blockSize = pBT->BlockSize(); + + std::vector IB(10001), OB(10001), PT(10001), CT(10001), RESULT(10001), TXT(10001), CV(10001); + PT[0] = GetData("PLAINTEXT"); + CT[0] = GetData("CIPHERTEXT"); + CV[0] = IB[0] = iv; + TXT[0] = GetData("TEXT"); + + int outerCount = (m_algorithm == "AES") ? 100 : 400; + int innerCount = (m_algorithm == "AES") ? 1000 : 10000; + + for (int i=0; iSetKey(KEY[i], keySize); + + for (int j=0; jProcessBlock(IB[j], CT[j]); + PT[j+1] = CT[j]; + } + else + { + IB[j] = CT[j]; + PT[j].resize(blockSize); + pBT->ProcessBlock(IB[j], PT[j]); + CT[j+1] = PT[j]; + } + } + else if (m_mode == "OFB") + { + OB[j].resize(blockSize); + pBT->ProcessBlock(IB[j], OB[j]); + Xor(RESULT[j], OB[j], TXT[j]); + TXT[j+1] = IB[j]; + IB[j+1] = OB[j]; + } + else if (m_mode == "CBC") + { + if (encrypt) + { + Xor(IB[j], PT[j], CV[j]); + CT[j].resize(blockSize); + pBT->ProcessBlock(IB[j], CT[j]); + PT[j+1] = CV[j]; + CV[j+1] = CT[j]; + } + else + { + IB[j] = CT[j]; + OB[j].resize(blockSize); + pBT->ProcessBlock(IB[j], OB[j]); + Xor(PT[j], OB[j], CV[j]); + CV[j+1] = CT[j]; + CT[j+1] = PT[j]; + } + } + else if (m_mode == "CFB") + { + if (encrypt) + { + OB[j].resize(blockSize); + pBT->ProcessBlock(IB[j], OB[j]); + AssignLeftMostBits(CT[j], OB[j], K); + Xor(CT[j], CT[j], PT[j]); + AssignLeftMostBits(PT[j+1], IB[j], K); + IB[j+1].resize(blockSize); + memcpy(IB[j+1], IB[j]+K/8, blockSize-K/8); + memcpy(IB[j+1]+blockSize-K/8, CT[j], K/8); + } + else + { + OB[j].resize(blockSize); + pBT->ProcessBlock(IB[j], OB[j]); + AssignLeftMostBits(PT[j], OB[j], K); + Xor(PT[j], PT[j], CT[j]); + IB[j+1].resize(blockSize); + memcpy(IB[j+1], IB[j]+K/8, blockSize-K/8); + memcpy(IB[j+1]+blockSize-K/8, CT[j], K/8); + AssignLeftMostBits(CT[j+1], OB[j], K); + } + } + else + throw Exception(Exception::OTHER_ERROR, "TestDataParser: unexpected mode: " + m_mode); + } + + OutputData(output, COUNT, IntToString(i)); + OutputData(output, KEY_T, KEY[i]); + if (m_mode == "CBC") + OutputData(output, IV, CV[0]); + if (m_mode == "OFB" || m_mode == "CFB") + OutputData(output, IV, IB[0]); + if (m_mode == "ECB" || m_mode == "CBC" || m_mode == "CFB") + { + if (encrypt) + { + OutputData(output, INPUT, PT[0]); + OutputData(output, OUTPUT, CT[innerCount-1]); + KEY[i+1] = UpdateKey(KEY[i], &CT[0]); + } + else + { + OutputData(output, INPUT, CT[0]); + OutputData(output, OUTPUT, PT[innerCount-1]); + KEY[i+1] = UpdateKey(KEY[i], &PT[0]); + } + PT[0] = PT[innerCount]; + IB[0] = IB[innerCount]; + CV[0] = CV[innerCount]; + CT[0] = CT[innerCount]; + } + else if (m_mode == "OFB") + { + OutputData(output, INPUT, TXT[0]); + OutputData(output, OUTPUT, RESULT[innerCount-1]); + KEY[i+1] = UpdateKey(KEY[i], &RESULT[0]); + Xor(TXT[0], TXT[0], IB[innerCount-1]); + IB[0] = OB[innerCount-1]; + } + output += "\n"; + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + } + } + else if (m_test == "MCT") + { + SecByteBlock KEY[101]; + KEY[0] = key; + int keySize = key.size(); + int blockSize = pBT->BlockSize(); + + SecByteBlock ivs[101], inputs[1001], outputs[1001]; + ivs[0] = iv; + inputs[0] = m_data2[INPUT]; + + for (int i=0; i<100; i++) + { + pCipher->SetKey(KEY[i], keySize, MakeParameters(Name::IV(), (const byte *)ivs[i])(Name::FeedbackSize(), (int)K/8, false)); + + for (int j=0; j<1000; j++) + { + outputs[j] = inputs[j]; + pCipher->ProcessString(outputs[j], outputs[j].size()); + if (K==8 && m_mode == "CFB") + { + if (j<16) + inputs[j+1].Assign(ivs[i]+j, 1); + else + inputs[j+1] = outputs[j-16]; + } + else if (m_mode == "ECB") + inputs[j+1] = outputs[j]; + else if (j == 0) + inputs[j+1] = ivs[i]; + else + inputs[j+1] = outputs[j-1]; + } + + if (m_algorithm == "AES") + OutputData(output, COUNT, m_count++); + OutputData(output, KEY_T, KEY[i]); + if (m_mode != "ECB") + OutputData(output, IV, ivs[i]); + OutputData(output, INPUT, inputs[0]); + OutputData(output, OUTPUT, outputs[999]); + output += "\n"; + AttachedTransformation()->Put((byte *)output.data(), output.size()); + output.resize(0); + + KEY[i+1] = UpdateKey(KEY[i], outputs); + ivs[i+1].CleanNew(pCipher->IVSize()); + ivs[i+1] = UpdateKey(ivs[i+1], outputs); + if (K==8 && m_mode == "CFB") + inputs[0] = outputs[999-16]; + else if (m_mode == "ECB") + inputs[0] = outputs[999]; + else + inputs[0] = outputs[998]; + } + } + else + { + assert(m_test == "KAT"); + + SecByteBlock &input = m_data2[INPUT]; + SecByteBlock result(input.size()); + member_ptr pFilter(new StreamTransformationFilter(*pCipher, new ArraySink(result, result.size()), StreamTransformationFilter::NO_PADDING)); + StringSource(input.data(), input.size(), true, pFilter.release()); + + OutputGivenData(output, COUNT, true); + OutputData(output, KEY_T, key); + OutputGivenData(output, IV, true); + OutputGivenData(output, INPUT); + OutputData(output, OUTPUT, result); + output += "\n"; + AttachedTransformation()->Put((byte *)output.data(), output.size()); + } + } + + std::vector Tokenize(const std::string &line) + { + std::vector result; + std::string s; + for (unsigned int i=0; i") + { + assert(m_test == "sha"); + m_bracketString = m_line.substr(2, m_line.size()-4); + m_line = m_line.substr(0, 13) + "Hashes") + copyLine = true; + + if (m_line == "Put((byte *)m_line.data(), m_line.size(), blocking); + return false; + } + + std::vector tokens = Tokenize(m_line); + + if (m_algorithm == "DSA" && m_test == "sha") + { + for (unsigned int i = 0; i < tokens.size(); i++) + { + if (tokens[i] == "^") + DoTest(); + else if (tokens[i] != "") + m_compactString.push_back(atol(tokens[i].c_str())); + } + } + else + { + if (!m_line.empty() && ((m_algorithm == "RSA" && m_test != "Gen") || m_algorithm == "RNG" || m_algorithm == "HMAC" || m_algorithm == "SHA" || (m_algorithm == "ECDSA" && m_test != "KeyPair") || (m_algorithm == "DSA" && (m_test == "PQGVer" || m_test == "SigVer")))) + { + // copy input to output + std::string output = m_line + '\n'; + AttachedTransformation()->Put((byte *)output.data(), output.size()); + } + + for (unsigned int i = 0; i < tokens.size(); i++) + { + if (m_firstLine && m_algorithm != "DSA") + { + if (tokens[i] == "Encrypt" || tokens[i] == "OFB") + SetEncrypt(true); + else if (tokens[i] == "Decrypt") + SetEncrypt(false); + else if (tokens[i] == "Modes") + m_test = "MONTE"; + } + else + { + if (tokens[i] != "=") + continue; + + if (i == 0) + throw Exception(Exception::OTHER_ERROR, "TestDataParser: unexpected data: " + m_line); + + const std::string &key = tokens[i-1]; + std::string &data = m_data[key]; + data = (tokens.size() > i+1) ? tokens[i+1] : ""; + DataType t = m_nameToType[key]; + m_typeToName[t] = key; + m_data2[t] = DecodeHex(data); + + if (key == m_trigger || (t == OUTPUT && !m_data2[INPUT].empty() && !isspace(m_line[0]))) + DoTest(); + } + } + } + + m_firstLine = false; + + return false; + } + + inline const SecByteBlock & GetData(const std::string &key) + { + return m_data2[m_nameToType[key]]; + } + + static SecByteBlock DecodeHex(const std::string &data) + { + SecByteBlock data2(data.size() / 2); + StringSource(data, true, new HexDecoder(new ArraySink(data2, data2.size()))); + return data2; + } + + std::string m_algorithm, m_test, m_mode, m_line, m_bracketString, m_trigger; + unsigned int m_feedbackSize, m_blankLineTransition; + bool m_encrypt, m_firstLine; + + typedef std::map NameToTypeMap; + NameToTypeMap m_nameToType; + typedef std::map TypeToNameMap; + TypeToNameMap m_typeToName; + + typedef std::map Map; + Map m_data; // raw data + typedef std::map Map2; + Map2 m_data2; + int m_count; + + AutoSeededX917RNG m_rng; + std::vector m_compactString; +}; + +int FIPS_140_AlgorithmTest(int argc, char **argv) +{ + argc--; + argv++; + + std::string algorithm = argv[1]; + std::string pathname = argv[2]; + unsigned int i = pathname.find_last_of("\\/"); + std::string filename = pathname.substr(i == std::string::npos ? 0 : i+1); + std::string dirname = pathname.substr(0, i); + + if (algorithm == "auto") + { + string algTable[] = {"AES", "ECDSA", "DSA", "HMAC", "RNG", "RSA", "TDES", "SKIPJACK", "SHA"}; // order is important here + for (i=0; i 3) + { + std::string outDir = argv[3]; + + if (outDir == "auto") + { + if (dirname.substr(dirname.size()-3) == "req") + outDir = dirname.substr(0, dirname.size()-3) + "resp"; + } + + if (*outDir.rbegin() != '\\' && *outDir.rbegin() != '/') + outDir += '/'; + std::string outPathname = outDir + filename.substr(0, filename.size() - 3) + "rsp"; + pSink = new FileSink(outPathname.c_str(), false); + } + else + pSink = new FileSink(cout); + + FileSource(pathname.c_str(), true, new LineBreakParser(new TestDataParser(algorithm, test, mode, feedbackSize, encrypt, pSink)), false); + } + catch (...) + { + cout << "file: " << filename << endl; + throw; + } + return 0; +} + +extern int (*AdhocTest)(int argc, char *argv[]); +static int s_i = (AdhocTest = &FIPS_140_AlgorithmTest, 0); +#endif diff --git a/cryptopp/fipstest.cpp b/cryptopp/fipstest.cpp new file mode 100644 index 0000000..9a6c560 --- /dev/null +++ b/cryptopp/fipstest.cpp @@ -0,0 +1,614 @@ +// fipstest.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#define CRYPTOPP_DEFAULT_NO_DLL +#include "dll.h" + +#ifdef CRYPTOPP_WIN32_AVAILABLE +#define _WIN32_WINNT 0x0400 +#include + +#if defined(_MSC_VER) && _MSC_VER >= 1400 +#ifdef _M_IX86 +#define _CRT_DEBUGGER_HOOK _crt_debugger_hook +#else +#define _CRT_DEBUGGER_HOOK __crt_debugger_hook +#endif +extern "C" {_CRTIMP void __cdecl _CRT_DEBUGGER_HOOK(int);} +#endif +#endif + +#include + +NAMESPACE_BEGIN(CryptoPP) + +extern PowerUpSelfTestStatus g_powerUpSelfTestStatus; +SecByteBlock g_actualMac; +unsigned long g_macFileLocation = 0; + +// use a random dummy string here, to be searched/replaced later with the real MAC +static const byte s_moduleMac[CryptoPP::HMAC::DIGESTSIZE] = CRYPTOPP_DUMMY_DLL_MAC; +CRYPTOPP_COMPILE_ASSERT(sizeof(s_moduleMac) == CryptoPP::SHA1::DIGESTSIZE); + +#ifdef CRYPTOPP_WIN32_AVAILABLE +static HMODULE s_hModule = NULL; +#endif + +const byte * CRYPTOPP_API GetActualMacAndLocation(unsigned int &macSize, unsigned int &fileLocation) +{ + macSize = (unsigned int)g_actualMac.size(); + fileLocation = g_macFileLocation; + return g_actualMac; +} + +void KnownAnswerTest(RandomNumberGenerator &rng, const char *output) +{ + EqualityComparisonFilter comparison; + + RandomNumberStore(rng, strlen(output)/2).TransferAllTo(comparison, "0"); + StringSource(output, true, new HexDecoder(new ChannelSwitch(comparison, "1"))); + + comparison.ChannelMessageSeriesEnd("0"); + comparison.ChannelMessageSeriesEnd("1"); +} + +template +void X917RNG_KnownAnswerTest( + const char *key, + const char *seed, + const char *deterministicTimeVector, + const char *output, + CIPHER *dummy = NULL) +{ +#ifdef OS_RNG_AVAILABLE + std::string decodedKey, decodedSeed, decodedDeterministicTimeVector; + StringSource(key, true, new HexDecoder(new StringSink(decodedKey))); + StringSource(seed, true, new HexDecoder(new StringSink(decodedSeed))); + StringSource(deterministicTimeVector, true, new HexDecoder(new StringSink(decodedDeterministicTimeVector))); + + AutoSeededX917RNG rng; + rng.Reseed((const byte *)decodedKey.data(), decodedKey.size(), (const byte *)decodedSeed.data(), (const byte *)decodedDeterministicTimeVector.data()); + KnownAnswerTest(rng, output); +#else + throw 0; +#endif +} + +void KnownAnswerTest(StreamTransformation &encryption, StreamTransformation &decryption, const char *plaintext, const char *ciphertext) +{ + EqualityComparisonFilter comparison; + + StringSource(plaintext, true, new HexDecoder(new StreamTransformationFilter(encryption, new ChannelSwitch(comparison, "0"), StreamTransformationFilter::NO_PADDING))); + StringSource(ciphertext, true, new HexDecoder(new ChannelSwitch(comparison, "1"))); + + StringSource(ciphertext, true, new HexDecoder(new StreamTransformationFilter(decryption, new ChannelSwitch(comparison, "0"), StreamTransformationFilter::NO_PADDING))); + StringSource(plaintext, true, new HexDecoder(new ChannelSwitch(comparison, "1"))); + + comparison.ChannelMessageSeriesEnd("0"); + comparison.ChannelMessageSeriesEnd("1"); +} + +template +void SymmetricEncryptionKnownAnswerTest( + const char *key, + const char *hexIV, + const char *plaintext, + const char *ecb, + const char *cbc, + const char *cfb, + const char *ofb, + const char *ctr, + CIPHER *dummy = NULL) +{ + std::string decodedKey; + StringSource(key, true, new HexDecoder(new StringSink(decodedKey))); + + typename CIPHER::Encryption encryption((const byte *)decodedKey.data(), decodedKey.size()); + typename CIPHER::Decryption decryption((const byte *)decodedKey.data(), decodedKey.size()); + + SecByteBlock iv(encryption.BlockSize()); + StringSource(hexIV, true, new HexDecoder(new ArraySink(iv, iv.size()))); + + if (ecb) + KnownAnswerTest(ECB_Mode_ExternalCipher::Encryption(encryption).Ref(), ECB_Mode_ExternalCipher::Decryption(decryption).Ref(), plaintext, ecb); + if (cbc) + KnownAnswerTest(CBC_Mode_ExternalCipher::Encryption(encryption, iv).Ref(), CBC_Mode_ExternalCipher::Decryption(decryption, iv).Ref(), plaintext, cbc); + if (cfb) + KnownAnswerTest(CFB_Mode_ExternalCipher::Encryption(encryption, iv).Ref(), CFB_Mode_ExternalCipher::Decryption(encryption, iv).Ref(), plaintext, cfb); + if (ofb) + KnownAnswerTest(OFB_Mode_ExternalCipher::Encryption(encryption, iv).Ref(), OFB_Mode_ExternalCipher::Decryption(encryption, iv).Ref(), plaintext, ofb); + if (ctr) + KnownAnswerTest(CTR_Mode_ExternalCipher::Encryption(encryption, iv).Ref(), CTR_Mode_ExternalCipher::Decryption(encryption, iv).Ref(), plaintext, ctr); +} + +void KnownAnswerTest(HashTransformation &hash, const char *message, const char *digest) +{ + EqualityComparisonFilter comparison; + StringSource(digest, true, new HexDecoder(new ChannelSwitch(comparison, "1"))); + StringSource(message, true, new HashFilter(hash, new ChannelSwitch(comparison, "0"))); + + comparison.ChannelMessageSeriesEnd("0"); + comparison.ChannelMessageSeriesEnd("1"); +} + +template +void SecureHashKnownAnswerTest(const char *message, const char *digest, HASH *dummy = NULL) +{ + HASH hash; + KnownAnswerTest(hash, message, digest); +} + +template +void MAC_KnownAnswerTest(const char *key, const char *message, const char *digest, MAC *dummy = NULL) +{ + std::string decodedKey; + StringSource(key, true, new HexDecoder(new StringSink(decodedKey))); + + MAC mac((const byte *)decodedKey.data(), decodedKey.size()); + KnownAnswerTest(mac, message, digest); +} + +template +void SignatureKnownAnswerTest(const char *key, const char *message, const char *signature, SCHEME *dummy = NULL) +{ +#ifdef OS_RNG_AVAILABLE + DefaultAutoSeededRNG rng; +#else + RandomNumberGenerator &rng = NullRNG(); +#endif + + typename SCHEME::Signer signer(StringSource(key, true, new HexDecoder).Ref()); + typename SCHEME::Verifier verifier(signer); + + EqualityComparisonFilter comparison; + + StringSource(message, true, new SignerFilter(rng, signer, new ChannelSwitch(comparison, "0"))); + StringSource(signature, true, new HexDecoder(new ChannelSwitch(comparison, "1"))); + + comparison.ChannelMessageSeriesEnd("0"); + comparison.ChannelMessageSeriesEnd("1"); + + VerifierFilter verifierFilter(verifier, NULL, VerifierFilter::SIGNATURE_AT_BEGIN | VerifierFilter::THROW_EXCEPTION); + StringSource(signature, true, new HexDecoder(new Redirector(verifierFilter, Redirector::DATA_ONLY))); + StringSource(message, true, new Redirector(verifierFilter)); +} + +void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor) +{ + try + { +#ifdef OS_RNG_AVAILABLE + DefaultAutoSeededRNG rng; +#else + RandomNumberGenerator &rng = NullRNG(); +#endif + const char *testMessage ="test message"; + std::string ciphertext, decrypted; + + StringSource( + testMessage, + true, + new PK_EncryptorFilter( + rng, + encryptor, + new StringSink(ciphertext))); + + if (ciphertext == testMessage) + throw 0; + + StringSource( + ciphertext, + true, + new PK_DecryptorFilter( + rng, + decryptor, + new StringSink(decrypted))); + + if (decrypted != testMessage) + throw 0; + } + catch (...) + { + throw SelfTestFailure(encryptor.AlgorithmName() + ": pairwise consistency test failed"); + } +} + +void SignaturePairwiseConsistencyTest(const PK_Signer &signer, const PK_Verifier &verifier) +{ + try + { +#ifdef OS_RNG_AVAILABLE + DefaultAutoSeededRNG rng; +#else + RandomNumberGenerator &rng = NullRNG(); +#endif + + StringSource( + "test message", + true, + new SignerFilter( + rng, + signer, + new VerifierFilter(verifier, NULL, VerifierFilter::THROW_EXCEPTION), + true)); + } + catch (...) + { + throw SelfTestFailure(signer.AlgorithmName() + ": pairwise consistency test failed"); + } +} + +template +void SignaturePairwiseConsistencyTest(const char *key, SCHEME *dummy = NULL) +{ + typename SCHEME::Signer signer(StringSource(key, true, new HexDecoder).Ref()); + typename SCHEME::Verifier verifier(signer); + + SignaturePairwiseConsistencyTest(signer, verifier); +} + +MessageAuthenticationCode * NewIntegrityCheckingMAC() +{ + byte key[] = {0x47, 0x1E, 0x33, 0x96, 0x65, 0xB1, 0x6A, 0xED, 0x0B, 0xF8, 0x6B, 0xFD, 0x01, 0x65, 0x05, 0xCC}; + return new HMAC(key, sizeof(key)); +} + +bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModuleMac, SecByteBlock *pActualMac, unsigned long *pMacFileLocation) +{ + std::auto_ptr mac(NewIntegrityCheckingMAC()); + unsigned int macSize = mac->DigestSize(); + + SecByteBlock tempMac; + SecByteBlock &actualMac = pActualMac ? *pActualMac : tempMac; + actualMac.resize(macSize); + + unsigned long tempLocation; + unsigned long &macFileLocation = pMacFileLocation ? *pMacFileLocation : tempLocation; + macFileLocation = 0; + + MeterFilter verifier(new HashFilter(*mac, new ArraySink(actualMac, actualMac.size()))); +// MeterFilter verifier(new FileSink("c:\\dt.tmp")); + std::ifstream moduleStream; + +#ifdef CRYPTOPP_WIN32_AVAILABLE + HMODULE h; + { + char moduleFilenameBuf[MAX_PATH] = ""; + if (moduleFilename == NULL) + { +#if (_MSC_VER >= 1400 && !defined(_STLPORT_VERSION)) // ifstream doesn't support wide filename on other compilers + wchar_t wideModuleFilename[MAX_PATH]; + if (GetModuleFileNameW(s_hModule, wideModuleFilename, MAX_PATH) > 0) + { + moduleStream.open(wideModuleFilename, std::ios::in | std::ios::binary); + h = GetModuleHandleW(wideModuleFilename); + } + else +#endif + { + GetModuleFileNameA(s_hModule, moduleFilenameBuf, MAX_PATH); + moduleFilename = moduleFilenameBuf; + } + } +#endif + if (moduleFilename != NULL) + { + moduleStream.open(moduleFilename, std::ios::in | std::ios::binary); +#ifdef CRYPTOPP_WIN32_AVAILABLE + h = GetModuleHandleA(moduleFilename); + moduleFilename = NULL; + } +#endif + } + + if (!moduleStream) + { +#ifdef CRYPTOPP_WIN32_AVAILABLE + OutputDebugString("Crypto++ DLL integrity check failed. Cannot open file for reading."); +#endif + return false; + } + FileStore file(moduleStream); + +#ifdef CRYPTOPP_WIN32_AVAILABLE + // try to hash from memory first + const byte *memBase = (const byte *)h; + const IMAGE_DOS_HEADER *ph = (IMAGE_DOS_HEADER *)memBase; + const IMAGE_NT_HEADERS *phnt = (IMAGE_NT_HEADERS *)(memBase + ph->e_lfanew); + const IMAGE_SECTION_HEADER *phs = IMAGE_FIRST_SECTION(phnt); + DWORD nSections = phnt->FileHeader.NumberOfSections; + size_t currentFilePos = 0; + + size_t checksumPos = (byte *)&phnt->OptionalHeader.CheckSum - memBase; + size_t checksumSize = sizeof(phnt->OptionalHeader.CheckSum); + size_t certificateTableDirectoryPos = (byte *)&phnt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY] - memBase; + size_t certificateTableDirectorySize = sizeof(phnt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY]); + size_t certificateTablePos = phnt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress; + size_t certificateTableSize = phnt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY].Size; + + verifier.AddRangeToSkip(0, checksumPos, checksumSize); + verifier.AddRangeToSkip(0, certificateTableDirectoryPos, certificateTableDirectorySize); + verifier.AddRangeToSkip(0, certificateTablePos, certificateTableSize); + + while (nSections--) + { + switch (phs->Characteristics) + { + default: + break; + case IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ: + case IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ: + unsigned int sectionSize = STDMIN(phs->SizeOfRawData, phs->Misc.VirtualSize); + const byte *sectionMemStart = memBase + phs->VirtualAddress; + unsigned int sectionFileStart = phs->PointerToRawData; + size_t subSectionStart = 0, nextSubSectionStart; + + do + { + const byte *subSectionMemStart = sectionMemStart + subSectionStart; + size_t subSectionFileStart = sectionFileStart + subSectionStart; + size_t subSectionSize = sectionSize - subSectionStart; + nextSubSectionStart = 0; + + unsigned int entriesToReadFromDisk[] = {IMAGE_DIRECTORY_ENTRY_IMPORT, IMAGE_DIRECTORY_ENTRY_IAT}; + for (unsigned int i=0; iOptionalHeader.DataDirectory[entriesToReadFromDisk[i]]; + const byte *entryMemStart = memBase + entry.VirtualAddress; + if (subSectionMemStart <= entryMemStart && entryMemStart < subSectionMemStart + subSectionSize) + { + subSectionSize = entryMemStart - subSectionMemStart; + nextSubSectionStart = entryMemStart - sectionMemStart + entry.Size; + } + } + +#if defined(_MSC_VER) && _MSC_VER >= 1400 + // first byte of _CRT_DEBUGGER_HOOK gets modified in memory by the debugger invisibly, so read it from file + if (IsDebuggerPresent()) + { + if (subSectionMemStart <= (byte *)&_CRT_DEBUGGER_HOOK && (byte *)&_CRT_DEBUGGER_HOOK < subSectionMemStart + subSectionSize) + { + subSectionSize = (byte *)&_CRT_DEBUGGER_HOOK - subSectionMemStart; + nextSubSectionStart = (byte *)&_CRT_DEBUGGER_HOOK - sectionMemStart + 1; + } + } +#endif + + if (subSectionMemStart <= expectedModuleMac && expectedModuleMac < subSectionMemStart + subSectionSize) + { + // found stored MAC + macFileLocation = (unsigned long)(subSectionFileStart + (expectedModuleMac - subSectionMemStart)); + verifier.AddRangeToSkip(0, macFileLocation, macSize); + } + + file.TransferTo(verifier, subSectionFileStart - currentFilePos); + verifier.Put(subSectionMemStart, subSectionSize); + file.Skip(subSectionSize); + currentFilePos = subSectionFileStart + subSectionSize; + subSectionStart = nextSubSectionStart; + } while (nextSubSectionStart != 0); + } + phs++; + } +#endif + file.TransferAllTo(verifier); + +#ifdef CRYPTOPP_WIN32_AVAILABLE + // if that fails (could be caused by debug breakpoints or DLL base relocation modifying image in memory), + // hash from disk instead + if (!VerifyBufsEqual(expectedModuleMac, actualMac, macSize)) + { + OutputDebugString("In memory integrity check failed. This may be caused by debug breakpoints or DLL relocation.\n"); + moduleStream.clear(); + moduleStream.seekg(0); + verifier.Initialize(MakeParameters(Name::OutputBuffer(), ByteArrayParameter(actualMac, (unsigned int)actualMac.size()))); +// verifier.Initialize(MakeParameters(Name::OutputFileName(), (const char *)"c:\\dt2.tmp")); + verifier.AddRangeToSkip(0, checksumPos, checksumSize); + verifier.AddRangeToSkip(0, certificateTableDirectoryPos, certificateTableDirectorySize); + verifier.AddRangeToSkip(0, certificateTablePos, certificateTableSize); + verifier.AddRangeToSkip(0, macFileLocation, macSize); + FileStore(moduleStream).TransferAllTo(verifier); + } +#endif + + if (VerifyBufsEqual(expectedModuleMac, actualMac, macSize)) + return true; + +#ifdef CRYPTOPP_WIN32_AVAILABLE + std::string hexMac; + HexEncoder(new StringSink(hexMac)).PutMessageEnd(actualMac, actualMac.size()); + OutputDebugString((("Crypto++ DLL integrity check failed. Actual MAC is: " + hexMac) + "\n").c_str()); +#endif + return false; +} + +void DoPowerUpSelfTest(const char *moduleFilename, const byte *expectedModuleMac) +{ + g_powerUpSelfTestStatus = POWER_UP_SELF_TEST_NOT_DONE; + SetPowerUpSelfTestInProgressOnThisThread(true); + + try + { + if (FIPS_140_2_ComplianceEnabled() || expectedModuleMac != NULL) + { + if (!IntegrityCheckModule(moduleFilename, expectedModuleMac, &g_actualMac, &g_macFileLocation)) + throw 0; // throw here so we break in the debugger, this will be caught right away + } + + // algorithm tests + + X917RNG_KnownAnswerTest( + "2b7e151628aed2a6abf7158809cf4f3c", // key + "000102030405060708090a0b0c0d0e0f", // seed + "00000000000000000000000000000001", // time vector + "D176EDD27493B0395F4D10546232B0693DC7061C03C3A554F09CECF6F6B46D945A"); // output + + SymmetricEncryptionKnownAnswerTest( + "385D7189A5C3D485E1370AA5D408082B5CCCCB5E19F2D90E", + "C141B5FCCD28DC8A", + "6E1BD7C6120947A464A6AAB293A0F89A563D8D40D3461B68", + "64EAAD4ACBB9CEAD6C7615E7C7E4792FE587D91F20C7D2F4", + "6235A461AFD312973E3B4F7AA7D23E34E03371F8E8C376C9", + "E26BA806A59B0330DE40CA38E77A3E494BE2B212F6DD624B", + "E26BA806A59B03307DE2BCC25A08BA40A8BA335F5D604C62", + "E26BA806A59B03303C62C2EFF32D3ACDD5D5F35EBCC53371"); + + SymmetricEncryptionKnownAnswerTest( + "1555E5531C3A169B2D65", + "6EC9795701F49864", + "00AFA48E9621E52E8CBDA312660184EDDB1F33D9DACDA8DA", + "DBEC73562EFCAEB56204EB8AE9557EBF77473FBB52D17CD1", + "0C7B0B74E21F99B8F2C8DF37879F6C044967F42A796DCA8B", + "79FDDA9724E36CC2E023E9A5C717A8A8A7FDA465CADCBF63", + "79FDDA9724E36CC26CACBD83C1ABC06EAF5B249BE5B1E040", + "79FDDA9724E36CC211B0AEC607B95A96BCDA318440B82F49"); + + SymmetricEncryptionKnownAnswerTest( + "2b7e151628aed2a6abf7158809cf4f3c", + "000102030405060708090a0b0c0d0e0f", + "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710", // plaintext + "3ad77bb40d7a3660a89ecaf32466ef97f5d3d58503b9699de785895a96fdbaaf43b1cd7f598ece23881b00e3ed0306887b0c785e27e8ad3f8223207104725dd4", // ecb + "7649abac8119b246cee98e9b12e9197d5086cb9b507219ee95db113a917678b273bed6b8e3c1743b7116e69e222295163ff1caa1681fac09120eca307586e1a7", // cbc + "3b3fd92eb72dad20333449f8e83cfb4ac8a64537a0b3a93fcde3cdad9f1ce58b26751f67a3cbb140b1808cf187a4f4dfc04b05357c5d1c0eeac4c66f9ff7f2e6", // cfb + "3b3fd92eb72dad20333449f8e83cfb4a7789508d16918f03f53c52dac54ed8259740051e9c5fecf64344f7a82260edcc304c6528f659c77866a510d9c1d6ae5e", // ofb + NULL); + + SymmetricEncryptionKnownAnswerTest( + "2b7e151628aed2a6abf7158809cf4f3c", + "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff", + "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710", + NULL, + NULL, + NULL, + NULL, + "874d6191b620e3261bef6864990db6ce9806f66b7970fdff8617187bb9fffdff5ae4df3edbd5d35e5b4f09020db03eab1e031dda2fbe03d1792170a0f3009cee"); // ctr + + + SecureHashKnownAnswerTest( + "abc", + "A9993E364706816ABA3E25717850C26C9CD0D89D"); + + SecureHashKnownAnswerTest( + "abc", + "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7"); + + SecureHashKnownAnswerTest( + "abc", + "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"); + + SecureHashKnownAnswerTest( + "abc", + "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7"); + + SecureHashKnownAnswerTest( + "abc", + "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"); + + MAC_KnownAnswerTest >( + "303132333435363738393a3b3c3d3e3f40414243", + "Sample #2", + "0922d3405faa3d194f82a45830737d5cc6c75d24"); + + const char *keyRSA1 = + "30820150020100300d06092a864886f70d01010105000482013a3082013602010002400a66791dc6988168de7ab77419bb7fb0" + "c001c62710270075142942e19a8d8c51d053b3e3782a1de5dc5af4ebe99468170114a1dfe67cdc9a9af55d655620bbab0203010001" + "02400123c5b61ba36edb1d3679904199a89ea80c09b9122e1400c09adcf7784676d01d23356a7d44d6bd8bd50e94bfc723fa" + "87d8862b75177691c11d757692df8881022033d48445c859e52340de704bcdda065fbb4058d740bd1d67d29e9c146c11cf61" + "0220335e8408866b0fd38dc7002d3f972c67389a65d5d8306566d5c4f2a5aa52628b0220045ec90071525325d3d46db79695e9af" + "acc4523964360e02b119baa366316241022015eb327360c7b60d12e5e2d16bdcd97981d17fba6b70db13b20b436e24eada590220" + "2ca6366d72781dfa24d34a9a24cbc2ae927a9958af426563ff63fb11658a461d"; + + const char *keyRSA2 = + "30820273020100300D06092A864886F70D01010105000482025D3082025902010002818100D40AF9" + "A2B713034249E5780056D70FC7DE75D76E44565AA6A6B8ED9646F3C19F9E254D72D7DE6E49DB2264" + "0C1D05AB9E2A5F901D8F3FE1F7AE02CEE2ECCE54A40ABAE55A004692752E70725AEEE7CDEA67628A" + "82A9239B4AB660C2BC56D9F01E90CBAAB9BF0FC8E17173CEFC5709A29391A7DDF3E0B758691AAF30" + "725B292F4F020111027F18C0BA087D082C45D75D3594E0767E4820818EB35612B80CEAB8C880ACA5" + "44B6876DFFEF85A576C0D45B551AFAA1FD63209CD745DF75C5A0F0B580296EA466CD0338207E4752" + "FF4E7DB724D8AE18CE5CF4153BB94C27869FBB50E64F02546E4B02997A0B8623E64017CC770759C6" + "695DB649EEFD829D688D441BCC4E7348F1024100EF86DD7AF3F32CDE8A9F6564E43A559A0C9F8BAD" + "36CC25330548B347AC158A345631FA90F7B873C36EFFAE2F7823227A3F580B5DD18304D5932751E7" + "43E9234F024100E2A039854B55688740E32A51DF4AF88613D91A371CF8DDD95D780A89D7CF2119A9" + "54F1AC0F3DCDB2F6959926E6D9D37D8BC07A4C634DE6F16315BD5F0DAC340102407ECEEDB9903572" + "1B76909F174BA6698DCA72953D957B22C0A871C8531EDE3A1BB52984A719BC010D1CA57A555DB83F" + "6DE54CBAB932AEC652F38D497A6F3F30CF024100854F30E4FF232E6DADB2CD99926855F484255AB7" + "01FBCDCB27EC426F33A7046972AA700ADBCA008763DF87440F52F4E070531AC385B55AAC1C2AE7DD" + "8F9278F1024100C313F4AF9E4A9DE1253C21080CE524251560C111550772FD08690F13FBE658342E" + "BD2D41C9DCB12374E871B1839E26CAE252E1AE3DAAD5F1EE1F42B4D0EE7581"; + + SignatureKnownAnswerTest >( + keyRSA1, + "Everyone gets Friday off.", + "0610761F95FFD1B8F29DA34212947EC2AA0E358866A722F03CC3C41487ADC604A48FF54F5C6BEDB9FB7BD59F82D6E55D8F3174BA361B2214B2D74E8825E04E81"); + + SignatureKnownAnswerTest >( + keyRSA2, + "test", + "32F6BA41C8930DE71EE67F2627172CC539EDE04267FDE03AC295E3C50311F26C3B275D3AF513AC96" + "8EE493BAB7DA3A754661D1A7C4A0D1A2B7EE8B313AACD8CB8BFBC5C15EFB0EF15C86A9334A1E87AD" + "291EB961B5CA0E84930429B28780816AA94F96FC2367B71E2D2E4866FA966795B147F00600E5207E" + "2F189C883B37477C"); + + SignaturePairwiseConsistencyTest( + "3082014A0201003082012B06072A8648CE3804013082011E02818100F468699A6F6EBCC0120D3B34C8E007F125EC7D81F763B8D0F33869AE3BD6B9F2ECCC7DF34DF84C0307449E9B85D30D57194BCCEB310F48141914DD13A077AAF9B624A6CBE666BBA1D7EBEA95B5BA6F54417FD5D4E4220C601E071D316A24EA814E8B0122DBF47EE8AEEFD319EBB01DD95683F10DBB4FEB023F8262A07EAEB7FD02150082AD4E034DA6EEACDFDAE68C36F2BAD614F9E53B02818071AAF73361A26081529F7D84078ADAFCA48E031DB54AD57FB1A833ADBD8672328AABAA0C756247998D7A5B10DACA359D231332CE8120B483A784FE07D46EEBFF0D7D374A10691F78653E6DC29E27CCB1B174923960DFE5B959B919B2C3816C19251832AFD8E35D810E598F82877ABF7D40A041565168BD7F0E21E3FE2A8D8C1C0416021426EBA66E846E755169F84A1DA981D86502405DDF"); + + SignaturePairwiseConsistencyTest >( + "302D020100301006072A8648CE3D020106052B8104000404163014020101040F0070337065E1E196980A9D00E37211"); + + SignaturePairwiseConsistencyTest >( + "3039020100301306072A8648CE3D020106082A8648CE3D030101041F301D02010104182BB8A13C8B867010BD9471D9E81FDB01ABD0538C64D6249A"); + + SignaturePairwiseConsistencyTest >(keyRSA1); + } + catch (...) + { + g_powerUpSelfTestStatus = POWER_UP_SELF_TEST_FAILED; + goto done; + } + + g_powerUpSelfTestStatus = POWER_UP_SELF_TEST_PASSED; + +done: + SetPowerUpSelfTestInProgressOnThisThread(false); + return; +} + +#ifdef CRYPTOPP_WIN32_AVAILABLE + +void DoDllPowerUpSelfTest() +{ + CryptoPP::DoPowerUpSelfTest(NULL, s_moduleMac); +} + +#else + +void DoDllPowerUpSelfTest() +{ + throw NotImplemented("DoDllPowerUpSelfTest() only available on Windows"); +} + +#endif // #ifdef CRYPTOPP_WIN32_AVAILABLE + +NAMESPACE_END + +#ifdef CRYPTOPP_WIN32_AVAILABLE + +// DllMain needs to be in the global namespace +BOOL APIENTRY DllMain(HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved) +{ + if (ul_reason_for_call == DLL_PROCESS_ATTACH) + { + CryptoPP::s_hModule = (HMODULE)hModule; + CryptoPP::DoDllPowerUpSelfTest(); + } + return TRUE; +} + +#endif // #ifdef CRYPTOPP_WIN32_AVAILABLE + +#endif // #ifndef CRYPTOPP_IMPORTS diff --git a/cryptopp/fltrimpl.h b/cryptopp/fltrimpl.h new file mode 100644 index 0000000..4087d7d --- /dev/null +++ b/cryptopp/fltrimpl.h @@ -0,0 +1,67 @@ +#ifndef CRYPTOPP_FLTRIMPL_H +#define CRYPTOPP_FLTRIMPL_H + +#define FILTER_BEGIN \ + switch (m_continueAt) \ + { \ + case 0: \ + m_inputPosition = 0; + +#define FILTER_END_NO_MESSAGE_END_NO_RETURN \ + break; \ + default: \ + assert(false); \ + } + +#define FILTER_END_NO_MESSAGE_END \ + FILTER_END_NO_MESSAGE_END_NO_RETURN \ + return 0; + +/* +#define FILTER_END \ + case -1: \ + if (messageEnd && Output(-1, NULL, 0, messageEnd, blocking)) \ + return 1; \ + FILTER_END_NO_MESSAGE_END +*/ + +#define FILTER_OUTPUT3(site, statement, output, length, messageEnd, channel) \ + {\ + case site: \ + statement; \ + if (Output(site, output, length, messageEnd, blocking, channel)) \ + return STDMAX(size_t(1), length-m_inputPosition);\ + } + +#define FILTER_OUTPUT2(site, statement, output, length, messageEnd) \ + FILTER_OUTPUT3(site, statement, output, length, messageEnd, DEFAULT_CHANNEL) + +#define FILTER_OUTPUT(site, output, length, messageEnd) \ + FILTER_OUTPUT2(site, 0, output, length, messageEnd) + +#define FILTER_OUTPUT_BYTE(site, output) \ + FILTER_OUTPUT(site, &(const byte &)(byte)output, 1, 0) + +#define FILTER_OUTPUT2_MODIFIABLE(site, statement, output, length, messageEnd) \ + {\ + case site: \ + statement; \ + if (OutputModifiable(site, output, length, messageEnd, blocking)) \ + return STDMAX(size_t(1), length-m_inputPosition);\ + } + +#define FILTER_OUTPUT_MODIFIABLE(site, output, length, messageEnd) \ + FILTER_OUTPUT2_MODIFIABLE(site, 0, output, length, messageEnd) + +#define FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, statement, output, length, messageEnd, modifiable) \ + {\ + case site: \ + statement; \ + if (modifiable ? OutputModifiable(site, output, length, messageEnd, blocking) : Output(site, output, length, messageEnd, blocking)) \ + return STDMAX(size_t(1), length-m_inputPosition);\ + } + +#define FILTER_OUTPUT_MAYBE_MODIFIABLE(site, output, length, messageEnd, modifiable) \ + FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, 0, output, length, messageEnd, modifiable) + +#endif diff --git a/cryptopp/gcm.cpp b/cryptopp/gcm.cpp new file mode 100644 index 0000000..2b5b8aa --- /dev/null +++ b/cryptopp/gcm.cpp @@ -0,0 +1,656 @@ +// gcm.cpp - written and placed in the public domain by Wei Dai + +// use "cl /EP /P /DCRYPTOPP_GENERATE_X64_MASM gcm.cpp" to generate MASM code + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS +#ifndef CRYPTOPP_GENERATE_X64_MASM + +#include "gcm.h" +#include "cpu.h" + +#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +word16 GCM_Base::s_reductionTable[256]; +bool GCM_Base::s_reductionTableInitialized = false; + +void GCM_Base::GCTR::IncrementCounterBy256() +{ + IncrementCounterByOne(m_counterArray+BlockSize()-4, 3); +} + +#if 0 +// preserved for testing +void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c) +{ + word64 Z0=0, Z1=0, V0, V1; + + typedef BlockGetAndPut Block; + Block::Get(a)(V0)(V1); + + for (int i=0; i<16; i++) + { + for (int j=0x80; j!=0; j>>=1) + { + int x = b[i] & j; + Z0 ^= x ? V0 : 0; + Z1 ^= x ? V1 : 0; + x = (int)V1 & 1; + V1 = (V1>>1) | (V0<<63); + V0 = (V0>>1) ^ (x ? W64LIT(0xe1) << 56 : 0); + } + } + Block::Put(NULL, c)(Z0)(Z1); +} +#endif + +#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +inline static void SSE2_Xor16(byte *a, const byte *b, const byte *c) +{ +#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE + *(__m128i *)a = _mm_xor_si128(*(__m128i *)b, *(__m128i *)c); +#else + asm ("movdqa %1, %%xmm0; pxor %2, %%xmm0; movdqa %%xmm0, %0;" : "=m" (a[0]) : "m"(b[0]), "m"(c[0])); +#endif +} +#endif + +inline static void Xor16(byte *a, const byte *b, const byte *c) +{ + ((word64 *)a)[0] = ((word64 *)b)[0] ^ ((word64 *)c)[0]; + ((word64 *)a)[1] = ((word64 *)b)[1] ^ ((word64 *)c)[1]; +} + +void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms) +{ + BlockCipher &blockCipher = AccessBlockCipher(); + blockCipher.SetKey(userKey, keylength, params); + + if (blockCipher.BlockSize() != REQUIRED_BLOCKSIZE) + throw InvalidArgument(AlgorithmName() + ": block size of underlying block cipher is not 16"); + + int tableSize; + if (params.GetIntValue(Name::TableSize(), tableSize)) + tableSize = (tableSize >= 64*1024) ? 64*1024 : 2*1024; + else + tableSize = (GetTablesOption() == GCM_64K_Tables) ? 64*1024 : 2*1024; + +#if defined(_MSC_VER) && (_MSC_VER >= 1300 && _MSC_VER < 1400) + // VC 2003 workaround: compiler generates bad code for 64K tables + tableSize = 2*1024; +#endif + + m_buffer.resize(3*REQUIRED_BLOCKSIZE + tableSize); + byte *hashKey = HashKey(); + memset(hashKey, 0, REQUIRED_BLOCKSIZE); + blockCipher.ProcessBlock(hashKey); + + byte *table = MulTable(); + int i, j, k; + word64 V0, V1; + + typedef BlockGetAndPut Block; + Block::Get(hashKey)(V0)(V1); + + if (tableSize == 64*1024) + { + for (i=0; i<128; i++) + { + k = i%8; + Block::Put(NULL, table+(i/8)*256*16+(size_t(1)<<(11-k)))(V0)(V1); + + int x = (int)V1 & 1; + V1 = (V1>>1) | (V0<<63); + V0 = (V0>>1) ^ (x ? W64LIT(0xe1) << 56 : 0); + } + + for (i=0; i<16; i++) + { + memset(table+i*256*16, 0, 16); +#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + if (HasSSE2()) + for (j=2; j<=0x80; j*=2) + for (k=1; k>1) | (V0<<63); + V0 = (V0>>1) ^ (x ? W64LIT(0xe1) << 56 : 0); + } + + for (i=0; i<4; i++) + { + memset(table+i*256, 0, 16); + memset(table+1024+i*256, 0, 16); +#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + if (HasSSE2()) + for (j=2; j<=8; j*=2) + for (k=1; k= HASH_BLOCKSIZE) + { + len = GCM_Base::AuthenticateBlocks(iv, len); + iv += (origLen - len); + } + + if (len > 0) + { + memcpy(m_buffer, iv, len); + memset(m_buffer+len, 0, HASH_BLOCKSIZE-len); + GCM_Base::AuthenticateBlocks(m_buffer, HASH_BLOCKSIZE); + } + + PutBlock(NULL, m_buffer)(0)(origLen*8); + GCM_Base::AuthenticateBlocks(m_buffer, HASH_BLOCKSIZE); + } + + if (m_state >= State_IVSet) + m_ctr.Resynchronize(hashBuffer, REQUIRED_BLOCKSIZE); + else + m_ctr.SetCipherWithIV(cipher, hashBuffer); + + m_ctr.Seek(HASH_BLOCKSIZE); + + memset(hashBuffer, 0, HASH_BLOCKSIZE); +} + +unsigned int GCM_Base::OptimalDataAlignment() const +{ + return HasSSE2() ? 16 : GetBlockCipher().OptimalDataAlignment(); +} + +#pragma warning(disable: 4731) // frame pointer register 'ebp' modified by inline assembly code + +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM + +#ifdef CRYPTOPP_X64_MASM_AVAILABLE +extern "C" { +void GCM_AuthenticateBlocks_2K(const byte *data, size_t blocks, word64 *hashBuffer, const word16 *reductionTable); +void GCM_AuthenticateBlocks_64K(const byte *data, size_t blocks, word64 *hashBuffer); +} +#endif + +#ifndef CRYPTOPP_GENERATE_X64_MASM + +size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len) +{ + typedef BlockGetAndPut Block; + word64 *hashBuffer = (word64 *)HashBuffer(); + + switch (2*(m_buffer.size()>=64*1024) +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) + + HasSSE2() +#endif + ) + { + case 0: // non-SSE2 and 2K tables + { + byte *table = MulTable(); + word64 x0 = hashBuffer[0], x1 = hashBuffer[1]; + + do + { + word64 y0, y1, a0, a1, b0, b1, c0, c1, d0, d1; + Block::Get(data)(y0)(y1); + x0 ^= y0; + x1 ^= y1; + + data += HASH_BLOCKSIZE; + len -= HASH_BLOCKSIZE; + + #define READ_TABLE_WORD64_COMMON(a, b, c, d) *(word64 *)(table+(a*1024)+(b*256)+c+d*8) + + #ifdef IS_LITTLE_ENDIAN + #if CRYPTOPP_BOOL_SLOW_WORD64 + word32 z0 = (word32)x0; + word32 z1 = (word32)(x0>>32); + word32 z2 = (word32)x1; + word32 z3 = (word32)(x1>>32); + #define READ_TABLE_WORD64(a, b, c, d, e) READ_TABLE_WORD64_COMMON((d%2), c, (d?(z##c>>((d?d-1:0)*4))&0xf0:(z##c&0xf)<<4), e) + #else + #define READ_TABLE_WORD64(a, b, c, d, e) READ_TABLE_WORD64_COMMON((d%2), c, ((d+8*b)?(x##a>>(((d+8*b)?(d+8*b)-1:1)*4))&0xf0:(x##a&0xf)<<4), e) + #endif + #define GF_MOST_SIG_8BITS(a) (a##1 >> 7*8) + #define GF_SHIFT_8(a) a##1 = (a##1 << 8) ^ (a##0 >> 7*8); a##0 <<= 8; + #else + #define READ_TABLE_WORD64(a, b, c, d, e) READ_TABLE_WORD64_COMMON((1-d%2), c, ((15-d-8*b)?(x##a>>(((15-d-8*b)?(15-d-8*b)-1:0)*4))&0xf0:(x##a&0xf)<<4), e) + #define GF_MOST_SIG_8BITS(a) (a##1 & 0xff) + #define GF_SHIFT_8(a) a##1 = (a##1 >> 8) ^ (a##0 << 7*8); a##0 >>= 8; + #endif + + #define GF_MUL_32BY128(op, a, b, c) \ + a0 op READ_TABLE_WORD64(a, b, c, 0, 0) ^ READ_TABLE_WORD64(a, b, c, 1, 0);\ + a1 op READ_TABLE_WORD64(a, b, c, 0, 1) ^ READ_TABLE_WORD64(a, b, c, 1, 1);\ + b0 op READ_TABLE_WORD64(a, b, c, 2, 0) ^ READ_TABLE_WORD64(a, b, c, 3, 0);\ + b1 op READ_TABLE_WORD64(a, b, c, 2, 1) ^ READ_TABLE_WORD64(a, b, c, 3, 1);\ + c0 op READ_TABLE_WORD64(a, b, c, 4, 0) ^ READ_TABLE_WORD64(a, b, c, 5, 0);\ + c1 op READ_TABLE_WORD64(a, b, c, 4, 1) ^ READ_TABLE_WORD64(a, b, c, 5, 1);\ + d0 op READ_TABLE_WORD64(a, b, c, 6, 0) ^ READ_TABLE_WORD64(a, b, c, 7, 0);\ + d1 op READ_TABLE_WORD64(a, b, c, 6, 1) ^ READ_TABLE_WORD64(a, b, c, 7, 1);\ + + GF_MUL_32BY128(=, 0, 0, 0) + GF_MUL_32BY128(^=, 0, 1, 1) + GF_MUL_32BY128(^=, 1, 0, 2) + GF_MUL_32BY128(^=, 1, 1, 3) + + word32 r = (word32)s_reductionTable[GF_MOST_SIG_8BITS(d)] << 16; + GF_SHIFT_8(d) + c0 ^= d0; c1 ^= d1; + r ^= (word32)s_reductionTable[GF_MOST_SIG_8BITS(c)] << 8; + GF_SHIFT_8(c) + b0 ^= c0; b1 ^= c1; + r ^= s_reductionTable[GF_MOST_SIG_8BITS(b)]; + GF_SHIFT_8(b) + a0 ^= b0; a1 ^= b1; + a0 ^= ConditionalByteReverse(LITTLE_ENDIAN_ORDER, r); + x0 = a0; x1 = a1; + } + while (len >= HASH_BLOCKSIZE); + + hashBuffer[0] = x0; hashBuffer[1] = x1; + return len; + } + + case 2: // non-SSE2 and 64K tables + { + byte *table = MulTable(); + word64 x0 = hashBuffer[0], x1 = hashBuffer[1]; + + do + { + word64 y0, y1, a0, a1; + Block::Get(data)(y0)(y1); + x0 ^= y0; + x1 ^= y1; + + data += HASH_BLOCKSIZE; + len -= HASH_BLOCKSIZE; + + #undef READ_TABLE_WORD64_COMMON + #undef READ_TABLE_WORD64 + + #define READ_TABLE_WORD64_COMMON(a, c, d) *(word64 *)(table+(a)*256*16+(c)+(d)*8) + + #ifdef IS_LITTLE_ENDIAN + #if CRYPTOPP_BOOL_SLOW_WORD64 + word32 z0 = (word32)x0; + word32 z1 = (word32)(x0>>32); + word32 z2 = (word32)x1; + word32 z3 = (word32)(x1>>32); + #define READ_TABLE_WORD64(b, c, d, e) READ_TABLE_WORD64_COMMON(c*4+d, (d?(z##c>>((d?d:1)*8-4))&0xff0:(z##c&0xff)<<4), e) + #else + #define READ_TABLE_WORD64(b, c, d, e) READ_TABLE_WORD64_COMMON(c*4+d, ((d+4*(c%2))?(x##b>>(((d+4*(c%2))?(d+4*(c%2)):1)*8-4))&0xff0:(x##b&0xff)<<4), e) + #endif + #else + #define READ_TABLE_WORD64(b, c, d, e) READ_TABLE_WORD64_COMMON(c*4+d, ((7-d-4*(c%2))?(x##b>>(((7-d-4*(c%2))?(7-d-4*(c%2)):1)*8-4))&0xff0:(x##b&0xff)<<4), e) + #endif + + #define GF_MUL_8BY128(op, b, c, d) \ + a0 op READ_TABLE_WORD64(b, c, d, 0);\ + a1 op READ_TABLE_WORD64(b, c, d, 1);\ + + GF_MUL_8BY128(=, 0, 0, 0) + GF_MUL_8BY128(^=, 0, 0, 1) + GF_MUL_8BY128(^=, 0, 0, 2) + GF_MUL_8BY128(^=, 0, 0, 3) + GF_MUL_8BY128(^=, 0, 1, 0) + GF_MUL_8BY128(^=, 0, 1, 1) + GF_MUL_8BY128(^=, 0, 1, 2) + GF_MUL_8BY128(^=, 0, 1, 3) + GF_MUL_8BY128(^=, 1, 2, 0) + GF_MUL_8BY128(^=, 1, 2, 1) + GF_MUL_8BY128(^=, 1, 2, 2) + GF_MUL_8BY128(^=, 1, 2, 3) + GF_MUL_8BY128(^=, 1, 3, 0) + GF_MUL_8BY128(^=, 1, 3, 1) + GF_MUL_8BY128(^=, 1, 3, 2) + GF_MUL_8BY128(^=, 1, 3, 3) + + x0 = a0; x1 = a1; + } + while (len >= HASH_BLOCKSIZE); + + hashBuffer[0] = x0; hashBuffer[1] = x1; + return len; + } +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM + +#ifdef CRYPTOPP_X64_MASM_AVAILABLE + case 1: // SSE2 and 2K tables + GCM_AuthenticateBlocks_2K(data, len/16, hashBuffer, s_reductionTable); + return len % 16; + case 3: // SSE2 and 64K tables + GCM_AuthenticateBlocks_64K(data, len/16, hashBuffer); + return len % 16; +#endif + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + case 1: // SSE2 and 2K tables + { + #ifdef __GNUC__ + __asm__ __volatile__ + ( + ".intel_syntax noprefix;" + #elif defined(CRYPTOPP_GENERATE_X64_MASM) + ALIGN 8 + GCM_AuthenticateBlocks_2K PROC FRAME + rex_push_reg rsi + push_reg rdi + push_reg rbx + .endprolog + mov rsi, r8 + mov r11, r9 + #else + AS2( mov WORD_REG(cx), data ) + AS2( mov WORD_REG(dx), len ) + AS2( mov WORD_REG(si), hashBuffer ) + AS2( shr WORD_REG(dx), 4 ) + #endif + + #if !defined(_MSC_VER) || (_MSC_VER < 1400) + AS_PUSH_IF86( bx) + #endif + AS_PUSH_IF86( bp) + + #ifdef __GNUC__ + AS2( mov AS_REG_7, WORD_REG(di)) + #elif CRYPTOPP_BOOL_X86 + AS2( lea AS_REG_7, s_reductionTable) + #endif + + AS2( movdqa xmm0, [WORD_REG(si)] ) + + #define MUL_TABLE_0 WORD_REG(si) + 32 + #define MUL_TABLE_1 WORD_REG(si) + 32 + 1024 + #define RED_TABLE AS_REG_7 + + ASL(0) + AS2( movdqu xmm4, [WORD_REG(cx)] ) + AS2( pxor xmm0, xmm4 ) + + AS2( movd ebx, xmm0 ) + AS2( mov eax, AS_HEX(f0f0f0f0) ) + AS2( and eax, ebx ) + AS2( shl ebx, 4 ) + AS2( and ebx, AS_HEX(f0f0f0f0) ) + AS2( movzx edi, ah ) + AS2( movdqa xmm5, XMMWORD_PTR [MUL_TABLE_1 + WORD_REG(di)] ) + AS2( movzx edi, al ) + AS2( movdqa xmm4, XMMWORD_PTR [MUL_TABLE_1 + WORD_REG(di)] ) + AS2( shr eax, 16 ) + AS2( movzx edi, ah ) + AS2( movdqa xmm3, XMMWORD_PTR [MUL_TABLE_1 + WORD_REG(di)] ) + AS2( movzx edi, al ) + AS2( movdqa xmm2, XMMWORD_PTR [MUL_TABLE_1 + WORD_REG(di)] ) + + #define SSE2_MUL_32BITS(i) \ + AS2( psrldq xmm0, 4 )\ + AS2( movd eax, xmm0 )\ + AS2( and eax, AS_HEX(f0f0f0f0) )\ + AS2( movzx edi, bh )\ + AS2( pxor xmm5, XMMWORD_PTR [MUL_TABLE_0 + (i-1)*256 + WORD_REG(di)] )\ + AS2( movzx edi, bl )\ + AS2( pxor xmm4, XMMWORD_PTR [MUL_TABLE_0 + (i-1)*256 + WORD_REG(di)] )\ + AS2( shr ebx, 16 )\ + AS2( movzx edi, bh )\ + AS2( pxor xmm3, XMMWORD_PTR [MUL_TABLE_0 + (i-1)*256 + WORD_REG(di)] )\ + AS2( movzx edi, bl )\ + AS2( pxor xmm2, XMMWORD_PTR [MUL_TABLE_0 + (i-1)*256 + WORD_REG(di)] )\ + AS2( movd ebx, xmm0 )\ + AS2( shl ebx, 4 )\ + AS2( and ebx, AS_HEX(f0f0f0f0) )\ + AS2( movzx edi, ah )\ + AS2( pxor xmm5, XMMWORD_PTR [MUL_TABLE_1 + i*256 + WORD_REG(di)] )\ + AS2( movzx edi, al )\ + AS2( pxor xmm4, XMMWORD_PTR [MUL_TABLE_1 + i*256 + WORD_REG(di)] )\ + AS2( shr eax, 16 )\ + AS2( movzx edi, ah )\ + AS2( pxor xmm3, XMMWORD_PTR [MUL_TABLE_1 + i*256 + WORD_REG(di)] )\ + AS2( movzx edi, al )\ + AS2( pxor xmm2, XMMWORD_PTR [MUL_TABLE_1 + i*256 + WORD_REG(di)] )\ + + SSE2_MUL_32BITS(1) + SSE2_MUL_32BITS(2) + SSE2_MUL_32BITS(3) + + AS2( movzx edi, bh ) + AS2( pxor xmm5, XMMWORD_PTR [MUL_TABLE_0 + 3*256 + WORD_REG(di)] ) + AS2( movzx edi, bl ) + AS2( pxor xmm4, XMMWORD_PTR [MUL_TABLE_0 + 3*256 + WORD_REG(di)] ) + AS2( shr ebx, 16 ) + AS2( movzx edi, bh ) + AS2( pxor xmm3, XMMWORD_PTR [MUL_TABLE_0 + 3*256 + WORD_REG(di)] ) + AS2( movzx edi, bl ) + AS2( pxor xmm2, XMMWORD_PTR [MUL_TABLE_0 + 3*256 + WORD_REG(di)] ) + + AS2( movdqa xmm0, xmm3 ) + AS2( pslldq xmm3, 1 ) + AS2( pxor xmm2, xmm3 ) + AS2( movdqa xmm1, xmm2 ) + AS2( pslldq xmm2, 1 ) + AS2( pxor xmm5, xmm2 ) + + AS2( psrldq xmm0, 15 ) + AS2( movd WORD_REG(di), xmm0 ) + AS2( movzx eax, WORD PTR [RED_TABLE + WORD_REG(di)*2] ) + AS2( shl eax, 8 ) + + AS2( movdqa xmm0, xmm5 ) + AS2( pslldq xmm5, 1 ) + AS2( pxor xmm4, xmm5 ) + + AS2( psrldq xmm1, 15 ) + AS2( movd WORD_REG(di), xmm1 ) + AS2( xor ax, WORD PTR [RED_TABLE + WORD_REG(di)*2] ) + AS2( shl eax, 8 ) + + AS2( psrldq xmm0, 15 ) + AS2( movd WORD_REG(di), xmm0 ) + AS2( xor ax, WORD PTR [RED_TABLE + WORD_REG(di)*2] ) + + AS2( movd xmm0, eax ) + AS2( pxor xmm0, xmm4 ) + + AS2( add WORD_REG(cx), 16 ) + AS2( sub WORD_REG(dx), 1 ) + ASJ( jnz, 0, b ) + AS2( movdqa [WORD_REG(si)], xmm0 ) + + AS_POP_IF86( bp) + #if !defined(_MSC_VER) || (_MSC_VER < 1400) + AS_POP_IF86( bx) + #endif + + #ifdef __GNUC__ + ".att_syntax prefix;" + : + : "c" (data), "d" (len/16), "S" (hashBuffer), "D" (s_reductionTable) + : "memory", "cc", "%eax" + #if CRYPTOPP_BOOL_X64 + , "%ebx", "%r11" + #endif + ); + #elif defined(CRYPTOPP_GENERATE_X64_MASM) + pop rbx + pop rdi + pop rsi + ret + GCM_AuthenticateBlocks_2K ENDP + #endif + + return len%16; + } + case 3: // SSE2 and 64K tables + { + #ifdef __GNUC__ + __asm__ __volatile__ + ( + ".intel_syntax noprefix;" + #elif defined(CRYPTOPP_GENERATE_X64_MASM) + ALIGN 8 + GCM_AuthenticateBlocks_64K PROC FRAME + rex_push_reg rsi + push_reg rdi + .endprolog + mov rsi, r8 + #else + AS2( mov WORD_REG(cx), data ) + AS2( mov WORD_REG(dx), len ) + AS2( mov WORD_REG(si), hashBuffer ) + AS2( shr WORD_REG(dx), 4 ) + #endif + + AS2( movdqa xmm0, [WORD_REG(si)] ) + + #undef MUL_TABLE + #define MUL_TABLE(i,j) WORD_REG(si) + 32 + (i*4+j)*256*16 + + ASL(1) + AS2( movdqu xmm1, [WORD_REG(cx)] ) + AS2( pxor xmm1, xmm0 ) + AS2( pxor xmm0, xmm0 ) + + #undef SSE2_MUL_32BITS + #define SSE2_MUL_32BITS(i) \ + AS2( movd eax, xmm1 )\ + AS2( psrldq xmm1, 4 )\ + AS2( movzx edi, al )\ + AS2( add WORD_REG(di), WORD_REG(di) )\ + AS2( pxor xmm0, [MUL_TABLE(i,0) + WORD_REG(di)*8] )\ + AS2( movzx edi, ah )\ + AS2( add WORD_REG(di), WORD_REG(di) )\ + AS2( pxor xmm0, [MUL_TABLE(i,1) + WORD_REG(di)*8] )\ + AS2( shr eax, 16 )\ + AS2( movzx edi, al )\ + AS2( add WORD_REG(di), WORD_REG(di) )\ + AS2( pxor xmm0, [MUL_TABLE(i,2) + WORD_REG(di)*8] )\ + AS2( movzx edi, ah )\ + AS2( add WORD_REG(di), WORD_REG(di) )\ + AS2( pxor xmm0, [MUL_TABLE(i,3) + WORD_REG(di)*8] )\ + + SSE2_MUL_32BITS(0) + SSE2_MUL_32BITS(1) + SSE2_MUL_32BITS(2) + SSE2_MUL_32BITS(3) + + AS2( add WORD_REG(cx), 16 ) + AS2( sub WORD_REG(dx), 1 ) + ASJ( jnz, 1, b ) + AS2( movdqa [WORD_REG(si)], xmm0 ) + + #ifdef __GNUC__ + ".att_syntax prefix;" + : + : "c" (data), "d" (len/16), "S" (hashBuffer) + : "memory", "cc", "%edi", "%eax" + ); + #elif defined(CRYPTOPP_GENERATE_X64_MASM) + pop rdi + pop rsi + ret + GCM_AuthenticateBlocks_64K ENDP + #endif + + return len%16; + } +#endif +#ifndef CRYPTOPP_GENERATE_X64_MASM + } + + return len%16; +} + +void GCM_Base::AuthenticateLastHeaderBlock() +{ + if (m_bufferedDataLength > 0) + { + memset(m_buffer+m_bufferedDataLength, 0, HASH_BLOCKSIZE-m_bufferedDataLength); + m_bufferedDataLength = 0; + GCM_Base::AuthenticateBlocks(m_buffer, HASH_BLOCKSIZE); + } +} + +void GCM_Base::AuthenticateLastConfidentialBlock() +{ + GCM_Base::AuthenticateLastHeaderBlock(); + PutBlock(NULL, m_buffer)(m_totalHeaderLength*8)(m_totalMessageLength*8); + GCM_Base::AuthenticateBlocks(m_buffer, HASH_BLOCKSIZE); +} + +void GCM_Base::AuthenticateLastFooterBlock(byte *mac, size_t macSize) +{ + m_ctr.Seek(0); + m_ctr.ProcessData(mac, HashBuffer(), macSize); +} + +NAMESPACE_END + +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM +#endif diff --git a/cryptopp/gcm.h b/cryptopp/gcm.h new file mode 100644 index 0000000..bb22aa9 --- /dev/null +++ b/cryptopp/gcm.h @@ -0,0 +1,105 @@ +#ifndef CRYPTOPP_GCM_H +#define CRYPTOPP_GCM_H + +#include "authenc.h" +#include "modes.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! . +enum GCM_TablesOption {GCM_2K_Tables, GCM_64K_Tables}; + +//! . +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE GCM_Base : public AuthenticatedSymmetricCipherBase +{ +public: + // AuthenticatedSymmetricCipher + std::string AlgorithmName() const + {return GetBlockCipher().AlgorithmName() + std::string("/GCM");} + size_t MinKeyLength() const + {return GetBlockCipher().MinKeyLength();} + size_t MaxKeyLength() const + {return GetBlockCipher().MaxKeyLength();} + size_t DefaultKeyLength() const + {return GetBlockCipher().DefaultKeyLength();} + size_t GetValidKeyLength(size_t n) const + {return GetBlockCipher().GetValidKeyLength(n);} + bool IsValidKeyLength(size_t n) const + {return GetBlockCipher().IsValidKeyLength(n);} + unsigned int OptimalDataAlignment() const; + IV_Requirement IVRequirement() const + {return UNIQUE_IV;} + unsigned int IVSize() const + {return 12;} + unsigned int MinIVLength() const + {return 1;} + unsigned int MaxIVLength() const + {return UINT_MAX;} // (W64LIT(1)<<61)-1 in the standard + unsigned int DigestSize() const + {return 16;} + lword MaxHeaderLength() const + {return (W64LIT(1)<<61)-1;} + lword MaxMessageLength() const + {return ((W64LIT(1)<<39)-256)/8;} + +protected: + // AuthenticatedSymmetricCipherBase + bool AuthenticationIsOnPlaintext() const + {return false;} + unsigned int AuthenticationBlockSize() const + {return HASH_BLOCKSIZE;} + void SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms); + void Resync(const byte *iv, size_t len); + size_t AuthenticateBlocks(const byte *data, size_t len); + void AuthenticateLastHeaderBlock(); + void AuthenticateLastConfidentialBlock(); + void AuthenticateLastFooterBlock(byte *mac, size_t macSize); + SymmetricCipher & AccessSymmetricCipher() {return m_ctr;} + + virtual BlockCipher & AccessBlockCipher() =0; + virtual GCM_TablesOption GetTablesOption() const =0; + + const BlockCipher & GetBlockCipher() const {return const_cast(this)->AccessBlockCipher();}; + byte *HashBuffer() {return m_buffer+REQUIRED_BLOCKSIZE;} + byte *HashKey() {return m_buffer+2*REQUIRED_BLOCKSIZE;} + byte *MulTable() {return m_buffer+3*REQUIRED_BLOCKSIZE;} + + class GCTR : public CTR_Mode_ExternalCipher::Encryption + { + protected: + void IncrementCounterBy256(); + }; + + GCTR m_ctr; + static word16 s_reductionTable[256]; + static bool s_reductionTableInitialized; + enum {REQUIRED_BLOCKSIZE = 16, HASH_BLOCKSIZE = 16}; +}; + +//! . +template +class GCM_Final : public GCM_Base +{ +public: + static std::string StaticAlgorithmName() + {return T_BlockCipher::StaticAlgorithmName() + std::string("/GCM");} + bool IsForwardTransformation() const + {return T_IsEncryption;} + +private: + GCM_TablesOption GetTablesOption() const {return T_TablesOption;} + BlockCipher & AccessBlockCipher() {return m_cipher;} + typename T_BlockCipher::Encryption m_cipher; +}; + +//! GCM +template +struct GCM : public AuthenticatedSymmetricCipherDocumentation +{ + typedef GCM_Final Encryption; + typedef GCM_Final Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/gf256.cpp b/cryptopp/gf256.cpp new file mode 100644 index 0000000..72026d1 --- /dev/null +++ b/cryptopp/gf256.cpp @@ -0,0 +1,34 @@ +// gf256.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "gf256.h" + +NAMESPACE_BEGIN(CryptoPP) + +GF256::Element GF256::Multiply(Element a, Element b) const +{ + word result = 0, t = b; + + for (unsigned int i=0; i<8; i++) + { + result <<= 1; + if (result & 0x100) + result ^= m_modulus; + + t <<= 1; + if (t & 0x100) + result ^= a; + } + + return (GF256::Element) result; +} + +GF256::Element GF256::MultiplicativeInverse(Element a) const +{ + Element result = a; + for (int i=1; i<7; i++) + result = Multiply(Square(result), a); + return Square(result); +} + +NAMESPACE_END diff --git a/cryptopp/gf256.h b/cryptopp/gf256.h new file mode 100644 index 0000000..e0ea748 --- /dev/null +++ b/cryptopp/gf256.h @@ -0,0 +1,66 @@ +#ifndef CRYPTOPP_GF256_H +#define CRYPTOPP_GF256_H + +#include "cryptlib.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! GF(256) with polynomial basis +class GF256 +{ +public: + typedef byte Element; + typedef int RandomizationParameter; + + GF256(byte modulus) : m_modulus(modulus) {} + + Element RandomElement(RandomNumberGenerator &rng, int ignored = 0) const + {return rng.GenerateByte();} + + bool Equal(Element a, Element b) const + {return a==b;} + + Element Zero() const + {return 0;} + + Element Add(Element a, Element b) const + {return a^b;} + + Element& Accumulate(Element &a, Element b) const + {return a^=b;} + + Element Inverse(Element a) const + {return a;} + + Element Subtract(Element a, Element b) const + {return a^b;} + + Element& Reduce(Element &a, Element b) const + {return a^=b;} + + Element Double(Element a) const + {return 0;} + + Element One() const + {return 1;} + + Element Multiply(Element a, Element b) const; + + Element Square(Element a) const + {return Multiply(a, a);} + + bool IsUnit(Element a) const + {return a != 0;} + + Element MultiplicativeInverse(Element a) const; + + Element Divide(Element a, Element b) const + {return Multiply(a, MultiplicativeInverse(b));} + +private: + word m_modulus; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/gf2_32.cpp b/cryptopp/gf2_32.cpp new file mode 100644 index 0000000..ae4874a --- /dev/null +++ b/cryptopp/gf2_32.cpp @@ -0,0 +1,99 @@ +// gf2_32.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "misc.h" +#include "gf2_32.h" + +NAMESPACE_BEGIN(CryptoPP) + +GF2_32::Element GF2_32::Multiply(Element a, Element b) const +{ + word32 table[4]; + table[0] = 0; + table[1] = m_modulus; + if (a & 0x80000000) + { + table[2] = m_modulus ^ (a<<1); + table[3] = a<<1; + } + else + { + table[2] = a<<1; + table[3] = m_modulus ^ (a<<1); + } + +#if CRYPTOPP_FAST_ROTATE(32) + b = rotrFixed(b, 30U); + word32 result = table[b&2]; + + for (int i=29; i>=0; --i) + { + b = rotlFixed(b, 1U); + result = (result<<1) ^ table[(b&2) + (result>>31)]; + } + + return (b&1) ? result ^ a : result; +#else + word32 result = table[(b>>30) & 2]; + + for (int i=29; i>=0; --i) + result = (result<<1) ^ table[((b>>i)&2) + (result>>31)]; + + return (b&1) ? result ^ a : result; +#endif +} + +GF2_32::Element GF2_32::MultiplicativeInverse(Element a) const +{ + if (a <= 1) // 1 is a special case + return a; + + // warning - don't try to adapt this algorithm for another situation + word32 g0=m_modulus, g1=a, g2=a; + word32 v0=0, v1=1, v2=1; + + assert(g1); + + while (!(g2 & 0x80000000)) + { + g2 <<= 1; + v2 <<= 1; + } + + g2 <<= 1; + v2 <<= 1; + + g0 ^= g2; + v0 ^= v2; + + while (g0 != 1) + { + if (g1 < g0 || ((g0^g1) < g0 && (g0^g1) < g1)) + { + assert(BitPrecision(g1) <= BitPrecision(g0)); + g2 = g1; + v2 = v1; + } + else + { + assert(BitPrecision(g1) > BitPrecision(g0)); + g2 = g0; g0 = g1; g1 = g2; + v2 = v0; v0 = v1; v1 = v2; + } + + while ((g0^g2) >= g2) + { + assert(BitPrecision(g0) > BitPrecision(g2)); + g2 <<= 1; + v2 <<= 1; + } + + assert(BitPrecision(g0) == BitPrecision(g2)); + g0 ^= g2; + v0 ^= v2; + } + + return v0; +} + +NAMESPACE_END diff --git a/cryptopp/gf2_32.h b/cryptopp/gf2_32.h new file mode 100644 index 0000000..31713f4 --- /dev/null +++ b/cryptopp/gf2_32.h @@ -0,0 +1,66 @@ +#ifndef CRYPTOPP_GF2_32_H +#define CRYPTOPP_GF2_32_H + +#include "cryptlib.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! GF(2^32) with polynomial basis +class GF2_32 +{ +public: + typedef word32 Element; + typedef int RandomizationParameter; + + GF2_32(word32 modulus=0x0000008D) : m_modulus(modulus) {} + + Element RandomElement(RandomNumberGenerator &rng, int ignored = 0) const + {return rng.GenerateWord32();} + + bool Equal(Element a, Element b) const + {return a==b;} + + Element Identity() const + {return 0;} + + Element Add(Element a, Element b) const + {return a^b;} + + Element& Accumulate(Element &a, Element b) const + {return a^=b;} + + Element Inverse(Element a) const + {return a;} + + Element Subtract(Element a, Element b) const + {return a^b;} + + Element& Reduce(Element &a, Element b) const + {return a^=b;} + + Element Double(Element a) const + {return 0;} + + Element MultiplicativeIdentity() const + {return 1;} + + Element Multiply(Element a, Element b) const; + + Element Square(Element a) const + {return Multiply(a, a);} + + bool IsUnit(Element a) const + {return a != 0;} + + Element MultiplicativeInverse(Element a) const; + + Element Divide(Element a, Element b) const + {return Multiply(a, MultiplicativeInverse(b));} + +private: + word32 m_modulus; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/gf2n.cpp b/cryptopp/gf2n.cpp new file mode 100644 index 0000000..0fac46a --- /dev/null +++ b/cryptopp/gf2n.cpp @@ -0,0 +1,879 @@ +// gf2n.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "gf2n.h" +#include "algebra.h" +#include "words.h" +#include "randpool.h" +#include "asn.h" +#include "oids.h" + +#include + +NAMESPACE_BEGIN(CryptoPP) + +PolynomialMod2::PolynomialMod2() +{ +} + +PolynomialMod2::PolynomialMod2(word value, size_t bitLength) + : reg(BitsToWords(bitLength)) +{ + assert(value==0 || reg.size()>0); + + if (reg.size() > 0) + { + reg[0] = value; + SetWords(reg+1, 0, reg.size()-1); + } +} + +PolynomialMod2::PolynomialMod2(const PolynomialMod2& t) + : reg(t.reg.size()) +{ + CopyWords(reg, t.reg, reg.size()); +} + +void PolynomialMod2::Randomize(RandomNumberGenerator &rng, size_t nbits) +{ + const size_t nbytes = nbits/8 + 1; + SecByteBlock buf(nbytes); + rng.GenerateBlock(buf, nbytes); + buf[0] = (byte)Crop(buf[0], nbits % 8); + Decode(buf, nbytes); +} + +PolynomialMod2 PolynomialMod2::AllOnes(size_t bitLength) +{ + PolynomialMod2 result((word)0, bitLength); + SetWords(result.reg, ~(word)0, result.reg.size()); + if (bitLength%WORD_BITS) + result.reg[result.reg.size()-1] = (word)Crop(result.reg[result.reg.size()-1], bitLength%WORD_BITS); + return result; +} + +void PolynomialMod2::SetBit(size_t n, int value) +{ + if (value) + { + reg.CleanGrow(n/WORD_BITS + 1); + reg[n/WORD_BITS] |= (word(1) << (n%WORD_BITS)); + } + else + { + if (n/WORD_BITS < reg.size()) + reg[n/WORD_BITS] &= ~(word(1) << (n%WORD_BITS)); + } +} + +byte PolynomialMod2::GetByte(size_t n) const +{ + if (n/WORD_SIZE >= reg.size()) + return 0; + else + return byte(reg[n/WORD_SIZE] >> ((n%WORD_SIZE)*8)); +} + +void PolynomialMod2::SetByte(size_t n, byte value) +{ + reg.CleanGrow(BytesToWords(n+1)); + reg[n/WORD_SIZE] &= ~(word(0xff) << 8*(n%WORD_SIZE)); + reg[n/WORD_SIZE] |= (word(value) << 8*(n%WORD_SIZE)); +} + +PolynomialMod2 PolynomialMod2::Monomial(size_t i) +{ + PolynomialMod2 r((word)0, i+1); + r.SetBit(i); + return r; +} + +PolynomialMod2 PolynomialMod2::Trinomial(size_t t0, size_t t1, size_t t2) +{ + PolynomialMod2 r((word)0, t0+1); + r.SetBit(t0); + r.SetBit(t1); + r.SetBit(t2); + return r; +} + +PolynomialMod2 PolynomialMod2::Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4) +{ + PolynomialMod2 r((word)0, t0+1); + r.SetBit(t0); + r.SetBit(t1); + r.SetBit(t2); + r.SetBit(t3); + r.SetBit(t4); + return r; +} + +template +struct NewPolynomialMod2 +{ + PolynomialMod2 * operator()() const + { + return new PolynomialMod2(i); + } +}; + +const PolynomialMod2 &PolynomialMod2::Zero() +{ + return Singleton().Ref(); +} + +const PolynomialMod2 &PolynomialMod2::One() +{ + return Singleton >().Ref(); +} + +void PolynomialMod2::Decode(const byte *input, size_t inputLen) +{ + StringStore store(input, inputLen); + Decode(store, inputLen); +} + +void PolynomialMod2::Encode(byte *output, size_t outputLen) const +{ + ArraySink sink(output, outputLen); + Encode(sink, outputLen); +} + +void PolynomialMod2::Decode(BufferedTransformation &bt, size_t inputLen) +{ + reg.CleanNew(BytesToWords(inputLen)); + + for (size_t i=inputLen; i > 0; i--) + { + byte b; + bt.Get(b); + reg[(i-1)/WORD_SIZE] |= word(b) << ((i-1)%WORD_SIZE)*8; + } +} + +void PolynomialMod2::Encode(BufferedTransformation &bt, size_t outputLen) const +{ + for (size_t i=outputLen; i > 0; i--) + bt.Put(GetByte(i-1)); +} + +void PolynomialMod2::DEREncodeAsOctetString(BufferedTransformation &bt, size_t length) const +{ + DERGeneralEncoder enc(bt, OCTET_STRING); + Encode(enc, length); + enc.MessageEnd(); +} + +void PolynomialMod2::BERDecodeAsOctetString(BufferedTransformation &bt, size_t length) +{ + BERGeneralDecoder dec(bt, OCTET_STRING); + if (!dec.IsDefiniteLength() || dec.RemainingLength() != length) + BERDecodeError(); + Decode(dec, length); + dec.MessageEnd(); +} + +unsigned int PolynomialMod2::WordCount() const +{ + return (unsigned int)CountWords(reg, reg.size()); +} + +unsigned int PolynomialMod2::ByteCount() const +{ + unsigned wordCount = WordCount(); + if (wordCount) + return (wordCount-1)*WORD_SIZE + BytePrecision(reg[wordCount-1]); + else + return 0; +} + +unsigned int PolynomialMod2::BitCount() const +{ + unsigned wordCount = WordCount(); + if (wordCount) + return (wordCount-1)*WORD_BITS + BitPrecision(reg[wordCount-1]); + else + return 0; +} + +unsigned int PolynomialMod2::Parity() const +{ + unsigned i; + word temp=0; + for (i=0; i= reg.size()) + { + PolynomialMod2 result((word)0, b.reg.size()*WORD_BITS); + XorWords(result.reg, reg, b.reg, reg.size()); + CopyWords(result.reg+reg.size(), b.reg+reg.size(), b.reg.size()-reg.size()); + return result; + } + else + { + PolynomialMod2 result((word)0, reg.size()*WORD_BITS); + XorWords(result.reg, reg, b.reg, b.reg.size()); + CopyWords(result.reg+b.reg.size(), reg+b.reg.size(), reg.size()-b.reg.size()); + return result; + } +} + +PolynomialMod2 PolynomialMod2::And(const PolynomialMod2 &b) const +{ + PolynomialMod2 result((word)0, WORD_BITS*STDMIN(reg.size(), b.reg.size())); + AndWords(result.reg, reg, b.reg, result.reg.size()); + return result; +} + +PolynomialMod2 PolynomialMod2::Times(const PolynomialMod2 &b) const +{ + PolynomialMod2 result((word)0, BitCount() + b.BitCount()); + + for (int i=b.Degree(); i>=0; i--) + { + result <<= 1; + if (b[i]) + XorWords(result.reg, reg, reg.size()); + } + return result; +} + +PolynomialMod2 PolynomialMod2::Squared() const +{ + static const word map[16] = {0, 1, 4, 5, 16, 17, 20, 21, 64, 65, 68, 69, 80, 81, 84, 85}; + + PolynomialMod2 result((word)0, 2*reg.size()*WORD_BITS); + + for (unsigned i=0; i> (j/2)) % 16] << j; + + for (j=0; j> (j/2 + WORD_BITS/2)) % 16] << j; + } + + return result; +} + +void PolynomialMod2::Divide(PolynomialMod2 &remainder, PolynomialMod2 "ient, + const PolynomialMod2 ÷nd, const PolynomialMod2 &divisor) +{ + if (!divisor) + throw PolynomialMod2::DivideByZero(); + + int degree = divisor.Degree(); + remainder.reg.CleanNew(BitsToWords(degree+1)); + if (dividend.BitCount() >= divisor.BitCount()) + quotient.reg.CleanNew(BitsToWords(dividend.BitCount() - divisor.BitCount() + 1)); + else + quotient.reg.CleanNew(0); + + for (int i=dividend.Degree(); i>=0; i--) + { + remainder <<= 1; + remainder.reg[0] |= dividend[i]; + if (remainder[degree]) + { + remainder -= divisor; + quotient.SetBit(i); + } + } +} + +PolynomialMod2 PolynomialMod2::DividedBy(const PolynomialMod2 &b) const +{ + PolynomialMod2 remainder, quotient; + PolynomialMod2::Divide(remainder, quotient, *this, b); + return quotient; +} + +PolynomialMod2 PolynomialMod2::Modulo(const PolynomialMod2 &b) const +{ + PolynomialMod2 remainder, quotient; + PolynomialMod2::Divide(remainder, quotient, *this, b); + return remainder; +} + +PolynomialMod2& PolynomialMod2::operator<<=(unsigned int n) +{ + if (!reg.size()) + return *this; + + int i; + word u; + word carry=0; + word *r=reg; + + if (n==1) // special case code for most frequent case + { + i = (int)reg.size(); + while (i--) + { + u = *r; + *r = (u << 1) | carry; + carry = u >> (WORD_BITS-1); + r++; + } + + if (carry) + { + reg.Grow(reg.size()+1); + reg[reg.size()-1] = carry; + } + + return *this; + } + + int shiftWords = n / WORD_BITS; + int shiftBits = n % WORD_BITS; + + if (shiftBits) + { + i = (int)reg.size(); + while (i--) + { + u = *r; + *r = (u << shiftBits) | carry; + carry = u >> (WORD_BITS-shiftBits); + r++; + } + } + + if (carry) + { + reg.Grow(reg.size()+shiftWords+1); + reg[reg.size()-1] = carry; + } + else + reg.Grow(reg.size()+shiftWords); + + if (shiftWords) + { + for (i = (int)reg.size()-1; i>=shiftWords; i--) + reg[i] = reg[i-shiftWords]; + for (; i>=0; i--) + reg[i] = 0; + } + + return *this; +} + +PolynomialMod2& PolynomialMod2::operator>>=(unsigned int n) +{ + if (!reg.size()) + return *this; + + int shiftWords = n / WORD_BITS; + int shiftBits = n % WORD_BITS; + + size_t i; + word u; + word carry=0; + word *r=reg+reg.size()-1; + + if (shiftBits) + { + i = reg.size(); + while (i--) + { + u = *r; + *r = (u >> shiftBits) | carry; + carry = u << (WORD_BITS-shiftBits); + r--; + } + } + + if (shiftWords) + { + for (i=0; i>(unsigned int n) const +{ + PolynomialMod2 result(*this); + return result>>=n; +} + +bool PolynomialMod2::operator!() const +{ + for (unsigned i=0; i s(a.BitCount()/bits+1); + unsigned i; + const char vec[]="0123456789ABCDEF"; + + for (i=0; i*bits < a.BitCount(); i++) + { + int digit=0; + for (int j=0; j().Gcd(a, b); +} + +PolynomialMod2 PolynomialMod2::InverseMod(const PolynomialMod2 &modulus) const +{ + typedef EuclideanDomainOf Domain; + return QuotientRing(Domain(), modulus).MultiplicativeInverse(*this); +} + +bool PolynomialMod2::IsIrreducible() const +{ + signed int d = Degree(); + if (d <= 0) + return false; + + PolynomialMod2 t(2), u(t); + for (int i=1; i<=d/2; i++) + { + u = u.Squared()%(*this); + if (!Gcd(u+t, *this).IsUnit()) + return false; + } + return true; +} + +// ******************************************************** + +GF2NP::GF2NP(const PolynomialMod2 &modulus) + : QuotientRing >(EuclideanDomainOf(), modulus), m(modulus.Degree()) +{ +} + +GF2NP::Element GF2NP::SquareRoot(const Element &a) const +{ + Element r = a; + for (unsigned int i=1; i t1 && t1 > t2 && t2==0); +} + +const GF2NT::Element& GF2NT::MultiplicativeInverse(const Element &a) const +{ + if (t0-t1 < WORD_BITS) + return GF2NP::MultiplicativeInverse(a); + + SecWordBlock T(m_modulus.reg.size() * 4); + word *b = T; + word *c = T+m_modulus.reg.size(); + word *f = T+2*m_modulus.reg.size(); + word *g = T+3*m_modulus.reg.size(); + size_t bcLen=1, fgLen=m_modulus.reg.size(); + unsigned int k=0; + + SetWords(T, 0, 3*m_modulus.reg.size()); + b[0]=1; + assert(a.reg.size() <= m_modulus.reg.size()); + CopyWords(f, a.reg, a.reg.size()); + CopyWords(g, m_modulus.reg, m_modulus.reg.size()); + + while (1) + { + word t=f[0]; + while (!t) + { + ShiftWordsRightByWords(f, fgLen, 1); + if (c[bcLen-1]) + bcLen++; + assert(bcLen <= m_modulus.reg.size()); + ShiftWordsLeftByWords(c, bcLen, 1); + k+=WORD_BITS; + t=f[0]; + } + + unsigned int i=0; + while (t%2 == 0) + { + t>>=1; + i++; + } + k+=i; + + if (t==1 && CountWords(f, fgLen)==1) + break; + + if (i==1) + { + ShiftWordsRightByBits(f, fgLen, 1); + t=ShiftWordsLeftByBits(c, bcLen, 1); + } + else + { + ShiftWordsRightByBits(f, fgLen, i); + t=ShiftWordsLeftByBits(c, bcLen, i); + } + if (t) + { + c[bcLen] = t; + bcLen++; + assert(bcLen <= m_modulus.reg.size()); + } + + if (f[fgLen-1]==0 && g[fgLen-1]==0) + fgLen--; + + if (f[fgLen-1] < g[fgLen-1]) + { + std::swap(f, g); + std::swap(b, c); + } + + XorWords(f, g, fgLen); + XorWords(b, c, bcLen); + } + + while (k >= WORD_BITS) + { + word temp = b[0]; + // right shift b + for (unsigned i=0; i+1> j) & 1) << (t1 + j); + else + b[t1/WORD_BITS-1] ^= temp << t1%WORD_BITS; + + if (t1 % WORD_BITS) + b[t1/WORD_BITS] ^= temp >> (WORD_BITS - t1%WORD_BITS); + + if (t0%WORD_BITS) + { + b[t0/WORD_BITS-1] ^= temp << t0%WORD_BITS; + b[t0/WORD_BITS] ^= temp >> (WORD_BITS - t0%WORD_BITS); + } + else + b[t0/WORD_BITS-1] ^= temp; + + k -= WORD_BITS; + } + + if (k) + { + word temp = b[0] << (WORD_BITS - k); + ShiftWordsRightByBits(b, BitsToWords(m), k); + + if (t1 < WORD_BITS) + for (unsigned int j=0; j> j) & 1) << (t1 + j); + else + b[t1/WORD_BITS-1] ^= temp << t1%WORD_BITS; + + if (t1 % WORD_BITS) + b[t1/WORD_BITS] ^= temp >> (WORD_BITS - t1%WORD_BITS); + + if (t0%WORD_BITS) + { + b[t0/WORD_BITS-1] ^= temp << t0%WORD_BITS; + b[t0/WORD_BITS] ^= temp >> (WORD_BITS - t0%WORD_BITS); + } + else + b[t0/WORD_BITS-1] ^= temp; + } + + CopyWords(result.reg.begin(), b, result.reg.size()); + return result; +} + +const GF2NT::Element& GF2NT::Multiply(const Element &a, const Element &b) const +{ + size_t aSize = STDMIN(a.reg.size(), result.reg.size()); + Element r((word)0, m); + + for (int i=m-1; i>=0; i--) + { + if (r[m-1]) + { + ShiftWordsLeftByBits(r.reg.begin(), r.reg.size(), 1); + XorWords(r.reg.begin(), m_modulus.reg, r.reg.size()); + } + else + ShiftWordsLeftByBits(r.reg.begin(), r.reg.size(), 1); + + if (b[i]) + XorWords(r.reg.begin(), a.reg, aSize); + } + + if (m%WORD_BITS) + r.reg.begin()[r.reg.size()-1] = (word)Crop(r.reg[r.reg.size()-1], m%WORD_BITS); + + CopyWords(result.reg.begin(), r.reg.begin(), result.reg.size()); + return result; +} + +const GF2NT::Element& GF2NT::Reduced(const Element &a) const +{ + if (t0-t1 < WORD_BITS) + return m_domain.Mod(a, m_modulus); + + SecWordBlock b(a.reg); + + size_t i; + for (i=b.size()-1; i>=BitsToWords(t0); i--) + { + word temp = b[i]; + + if (t0%WORD_BITS) + { + b[i-t0/WORD_BITS] ^= temp >> t0%WORD_BITS; + b[i-t0/WORD_BITS-1] ^= temp << (WORD_BITS - t0%WORD_BITS); + } + else + b[i-t0/WORD_BITS] ^= temp; + + if ((t0-t1)%WORD_BITS) + { + b[i-(t0-t1)/WORD_BITS] ^= temp >> (t0-t1)%WORD_BITS; + b[i-(t0-t1)/WORD_BITS-1] ^= temp << (WORD_BITS - (t0-t1)%WORD_BITS); + } + else + b[i-(t0-t1)/WORD_BITS] ^= temp; + } + + if (i==BitsToWords(t0)-1 && t0%WORD_BITS) + { + word mask = ((word)1<<(t0%WORD_BITS))-1; + word temp = b[i] & ~mask; + b[i] &= mask; + + b[i-t0/WORD_BITS] ^= temp >> t0%WORD_BITS; + + if ((t0-t1)%WORD_BITS) + { + b[i-(t0-t1)/WORD_BITS] ^= temp >> (t0-t1)%WORD_BITS; + if ((t0-t1)%WORD_BITS > t0%WORD_BITS) + b[i-(t0-t1)/WORD_BITS-1] ^= temp << (WORD_BITS - (t0-t1)%WORD_BITS); + else + assert(temp << (WORD_BITS - (t0-t1)%WORD_BITS) == 0); + } + else + b[i-(t0-t1)/WORD_BITS] ^= temp; + } + + SetWords(result.reg.begin(), 0, result.reg.size()); + CopyWords(result.reg.begin(), b, STDMIN(b.size(), result.reg.size())); + return result; +} + +void GF2NP::DEREncodeElement(BufferedTransformation &out, const Element &a) const +{ + a.DEREncodeAsOctetString(out, MaxElementByteLength()); +} + +void GF2NP::BERDecodeElement(BufferedTransformation &in, Element &a) const +{ + a.BERDecodeAsOctetString(in, MaxElementByteLength()); +} + +void GF2NT::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + ASN1::characteristic_two_field().DEREncode(seq); + DERSequenceEncoder parameters(seq); + DEREncodeUnsigned(parameters, m); + ASN1::tpBasis().DEREncode(parameters); + DEREncodeUnsigned(parameters, t1); + parameters.MessageEnd(); + seq.MessageEnd(); +} + +void GF2NPP::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + ASN1::characteristic_two_field().DEREncode(seq); + DERSequenceEncoder parameters(seq); + DEREncodeUnsigned(parameters, m); + ASN1::ppBasis().DEREncode(parameters); + DERSequenceEncoder pentanomial(parameters); + DEREncodeUnsigned(pentanomial, t3); + DEREncodeUnsigned(pentanomial, t2); + DEREncodeUnsigned(pentanomial, t1); + pentanomial.MessageEnd(); + parameters.MessageEnd(); + seq.MessageEnd(); +} + +GF2NP * BERDecodeGF2NP(BufferedTransformation &bt) +{ + // VC60 workaround: auto_ptr lacks reset() + member_ptr result; + + BERSequenceDecoder seq(bt); + if (OID(seq) != ASN1::characteristic_two_field()) + BERDecodeError(); + BERSequenceDecoder parameters(seq); + unsigned int m; + BERDecodeUnsigned(parameters, m); + OID oid(parameters); + if (oid == ASN1::tpBasis()) + { + unsigned int t1; + BERDecodeUnsigned(parameters, t1); + result.reset(new GF2NT(m, t1, 0)); + } + else if (oid == ASN1::ppBasis()) + { + unsigned int t1, t2, t3; + BERSequenceDecoder pentanomial(parameters); + BERDecodeUnsigned(pentanomial, t3); + BERDecodeUnsigned(pentanomial, t2); + BERDecodeUnsigned(pentanomial, t1); + pentanomial.MessageEnd(); + result.reset(new GF2NPP(m, t3, t2, t1, 0)); + } + else + { + BERDecodeError(); + return NULL; + } + parameters.MessageEnd(); + seq.MessageEnd(); + + return result.release(); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/gf2n.h b/cryptopp/gf2n.h new file mode 100644 index 0000000..67ade64 --- /dev/null +++ b/cryptopp/gf2n.h @@ -0,0 +1,369 @@ +#ifndef CRYPTOPP_GF2N_H +#define CRYPTOPP_GF2N_H + +/*! \file */ + +#include "cryptlib.h" +#include "secblock.h" +#include "misc.h" +#include "algebra.h" + +#include + +NAMESPACE_BEGIN(CryptoPP) + +//! Polynomial with Coefficients in GF(2) +/*! \nosubgrouping */ +class CRYPTOPP_DLL PolynomialMod2 +{ +public: + //! \name ENUMS, EXCEPTIONS, and TYPEDEFS + //@{ + //! divide by zero exception + class DivideByZero : public Exception + { + public: + DivideByZero() : Exception(OTHER_ERROR, "PolynomialMod2: division by zero") {} + }; + + typedef unsigned int RandomizationParameter; + //@} + + //! \name CREATORS + //@{ + //! creates the zero polynomial + PolynomialMod2(); + //! copy constructor + PolynomialMod2(const PolynomialMod2& t); + + //! convert from word + /*! value should be encoded with the least significant bit as coefficient to x^0 + and most significant bit as coefficient to x^(WORD_BITS-1) + bitLength denotes how much memory to allocate initially + */ + PolynomialMod2(word value, size_t bitLength=WORD_BITS); + + //! convert from big-endian byte array + PolynomialMod2(const byte *encodedPoly, size_t byteCount) + {Decode(encodedPoly, byteCount);} + + //! convert from big-endian form stored in a BufferedTransformation + PolynomialMod2(BufferedTransformation &encodedPoly, size_t byteCount) + {Decode(encodedPoly, byteCount);} + + //! create a random polynomial uniformly distributed over all polynomials with degree less than bitcount + PolynomialMod2(RandomNumberGenerator &rng, size_t bitcount) + {Randomize(rng, bitcount);} + + //! return x^i + static PolynomialMod2 CRYPTOPP_API Monomial(size_t i); + //! return x^t0 + x^t1 + x^t2 + static PolynomialMod2 CRYPTOPP_API Trinomial(size_t t0, size_t t1, size_t t2); + //! return x^t0 + x^t1 + x^t2 + x^t3 + x^t4 + static PolynomialMod2 CRYPTOPP_API Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4); + //! return x^(n-1) + ... + x + 1 + static PolynomialMod2 CRYPTOPP_API AllOnes(size_t n); + + //! + static const PolynomialMod2 & CRYPTOPP_API Zero(); + //! + static const PolynomialMod2 & CRYPTOPP_API One(); + //@} + + //! \name ENCODE/DECODE + //@{ + //! minimum number of bytes to encode this polynomial + /*! MinEncodedSize of 0 is 1 */ + unsigned int MinEncodedSize() const {return STDMAX(1U, ByteCount());} + + //! encode in big-endian format + /*! if outputLen < MinEncodedSize, the most significant bytes will be dropped + if outputLen > MinEncodedSize, the most significant bytes will be padded + */ + void Encode(byte *output, size_t outputLen) const; + //! + void Encode(BufferedTransformation &bt, size_t outputLen) const; + + //! + void Decode(const byte *input, size_t inputLen); + //! + //* Precondition: bt.MaxRetrievable() >= inputLen + void Decode(BufferedTransformation &bt, size_t inputLen); + + //! encode value as big-endian octet string + void DEREncodeAsOctetString(BufferedTransformation &bt, size_t length) const; + //! decode value as big-endian octet string + void BERDecodeAsOctetString(BufferedTransformation &bt, size_t length); + //@} + + //! \name ACCESSORS + //@{ + //! number of significant bits = Degree() + 1 + unsigned int BitCount() const; + //! number of significant bytes = ceiling(BitCount()/8) + unsigned int ByteCount() const; + //! number of significant words = ceiling(ByteCount()/sizeof(word)) + unsigned int WordCount() const; + + //! return the n-th bit, n=0 being the least significant bit + bool GetBit(size_t n) const {return GetCoefficient(n)!=0;} + //! return the n-th byte + byte GetByte(size_t n) const; + + //! the zero polynomial will return a degree of -1 + signed int Degree() const {return BitCount()-1;} + //! degree + 1 + unsigned int CoefficientCount() const {return BitCount();} + //! return coefficient for x^i + int GetCoefficient(size_t i) const + {return (i/WORD_BITS < reg.size()) ? int(reg[i/WORD_BITS] >> (i % WORD_BITS)) & 1 : 0;} + //! return coefficient for x^i + int operator[](unsigned int i) const {return GetCoefficient(i);} + + //! + bool IsZero() const {return !*this;} + //! + bool Equals(const PolynomialMod2 &rhs) const; + //@} + + //! \name MANIPULATORS + //@{ + //! + PolynomialMod2& operator=(const PolynomialMod2& t); + //! + PolynomialMod2& operator&=(const PolynomialMod2& t); + //! + PolynomialMod2& operator^=(const PolynomialMod2& t); + //! + PolynomialMod2& operator+=(const PolynomialMod2& t) {return *this ^= t;} + //! + PolynomialMod2& operator-=(const PolynomialMod2& t) {return *this ^= t;} + //! + PolynomialMod2& operator*=(const PolynomialMod2& t); + //! + PolynomialMod2& operator/=(const PolynomialMod2& t); + //! + PolynomialMod2& operator%=(const PolynomialMod2& t); + //! + PolynomialMod2& operator<<=(unsigned int); + //! + PolynomialMod2& operator>>=(unsigned int); + + //! + void Randomize(RandomNumberGenerator &rng, size_t bitcount); + + //! + void SetBit(size_t i, int value = 1); + //! set the n-th byte to value + void SetByte(size_t n, byte value); + + //! + void SetCoefficient(size_t i, int value) {SetBit(i, value);} + + //! + void swap(PolynomialMod2 &a) {reg.swap(a.reg);} + //@} + + //! \name UNARY OPERATORS + //@{ + //! + bool operator!() const; + //! + PolynomialMod2 operator+() const {return *this;} + //! + PolynomialMod2 operator-() const {return *this;} + //@} + + //! \name BINARY OPERATORS + //@{ + //! + PolynomialMod2 And(const PolynomialMod2 &b) const; + //! + PolynomialMod2 Xor(const PolynomialMod2 &b) const; + //! + PolynomialMod2 Plus(const PolynomialMod2 &b) const {return Xor(b);} + //! + PolynomialMod2 Minus(const PolynomialMod2 &b) const {return Xor(b);} + //! + PolynomialMod2 Times(const PolynomialMod2 &b) const; + //! + PolynomialMod2 DividedBy(const PolynomialMod2 &b) const; + //! + PolynomialMod2 Modulo(const PolynomialMod2 &b) const; + + //! + PolynomialMod2 operator>>(unsigned int n) const; + //! + PolynomialMod2 operator<<(unsigned int n) const; + //@} + + //! \name OTHER ARITHMETIC FUNCTIONS + //@{ + //! sum modulo 2 of all coefficients + unsigned int Parity() const; + + //! check for irreducibility + bool IsIrreducible() const; + + //! is always zero since we're working modulo 2 + PolynomialMod2 Doubled() const {return Zero();} + //! + PolynomialMod2 Squared() const; + + //! only 1 is a unit + bool IsUnit() const {return Equals(One());} + //! return inverse if *this is a unit, otherwise return 0 + PolynomialMod2 MultiplicativeInverse() const {return IsUnit() ? One() : Zero();} + + //! greatest common divisor + static PolynomialMod2 CRYPTOPP_API Gcd(const PolynomialMod2 &a, const PolynomialMod2 &n); + //! calculate multiplicative inverse of *this mod n + PolynomialMod2 InverseMod(const PolynomialMod2 &) const; + + //! calculate r and q such that (a == d*q + r) && (deg(r) < deg(d)) + static void CRYPTOPP_API Divide(PolynomialMod2 &r, PolynomialMod2 &q, const PolynomialMod2 &a, const PolynomialMod2 &d); + //@} + + //! \name INPUT/OUTPUT + //@{ + //! + friend std::ostream& operator<<(std::ostream& out, const PolynomialMod2 &a); + //@} + +private: + friend class GF2NT; + + SecWordBlock reg; +}; + +//! +inline bool operator==(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) +{return a.Equals(b);} +//! +inline bool operator!=(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) +{return !(a==b);} +//! compares degree +inline bool operator> (const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) +{return a.Degree() > b.Degree();} +//! compares degree +inline bool operator>=(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) +{return a.Degree() >= b.Degree();} +//! compares degree +inline bool operator< (const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) +{return a.Degree() < b.Degree();} +//! compares degree +inline bool operator<=(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) +{return a.Degree() <= b.Degree();} +//! +inline CryptoPP::PolynomialMod2 operator&(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.And(b);} +//! +inline CryptoPP::PolynomialMod2 operator^(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.Xor(b);} +//! +inline CryptoPP::PolynomialMod2 operator+(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.Plus(b);} +//! +inline CryptoPP::PolynomialMod2 operator-(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.Minus(b);} +//! +inline CryptoPP::PolynomialMod2 operator*(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.Times(b);} +//! +inline CryptoPP::PolynomialMod2 operator/(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.DividedBy(b);} +//! +inline CryptoPP::PolynomialMod2 operator%(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.Modulo(b);} + +// CodeWarrior 8 workaround: put these template instantiations after overloaded operator declarations, +// but before the use of QuotientRing > for VC .NET 2003 +CRYPTOPP_DLL_TEMPLATE_CLASS AbstractGroup; +CRYPTOPP_DLL_TEMPLATE_CLASS AbstractRing; +CRYPTOPP_DLL_TEMPLATE_CLASS AbstractEuclideanDomain; +CRYPTOPP_DLL_TEMPLATE_CLASS EuclideanDomainOf; +CRYPTOPP_DLL_TEMPLATE_CLASS QuotientRing >; + +//! GF(2^n) with Polynomial Basis +class CRYPTOPP_DLL GF2NP : public QuotientRing > +{ +public: + GF2NP(const PolynomialMod2 &modulus); + + virtual GF2NP * Clone() const {return new GF2NP(*this);} + virtual void DEREncode(BufferedTransformation &bt) const + {assert(false);} // no ASN.1 syntax yet for general polynomial basis + + void DEREncodeElement(BufferedTransformation &out, const Element &a) const; + void BERDecodeElement(BufferedTransformation &in, Element &a) const; + + bool Equal(const Element &a, const Element &b) const + {assert(a.Degree() < m_modulus.Degree() && b.Degree() < m_modulus.Degree()); return a.Equals(b);} + + bool IsUnit(const Element &a) const + {assert(a.Degree() < m_modulus.Degree()); return !!a;} + + unsigned int MaxElementBitLength() const + {return m;} + + unsigned int MaxElementByteLength() const + {return (unsigned int)BitsToBytes(MaxElementBitLength());} + + Element SquareRoot(const Element &a) const; + + Element HalfTrace(const Element &a) const; + + // returns z such that z^2 + z == a + Element SolveQuadraticEquation(const Element &a) const; + +protected: + unsigned int m; +}; + +//! GF(2^n) with Trinomial Basis +class CRYPTOPP_DLL GF2NT : public GF2NP +{ +public: + // polynomial modulus = x^t0 + x^t1 + x^t2, t0 > t1 > t2 + GF2NT(unsigned int t0, unsigned int t1, unsigned int t2); + + GF2NP * Clone() const {return new GF2NT(*this);} + void DEREncode(BufferedTransformation &bt) const; + + const Element& Multiply(const Element &a, const Element &b) const; + + const Element& Square(const Element &a) const + {return Reduced(a.Squared());} + + const Element& MultiplicativeInverse(const Element &a) const; + +private: + const Element& Reduced(const Element &a) const; + + unsigned int t0, t1; + mutable PolynomialMod2 result; +}; + +//! GF(2^n) with Pentanomial Basis +class CRYPTOPP_DLL GF2NPP : public GF2NP +{ +public: + // polynomial modulus = x^t0 + x^t1 + x^t2 + x^t3 + x^t4, t0 > t1 > t2 > t3 > t4 + GF2NPP(unsigned int t0, unsigned int t1, unsigned int t2, unsigned int t3, unsigned int t4) + : GF2NP(PolynomialMod2::Pentanomial(t0, t1, t2, t3, t4)), t0(t0), t1(t1), t2(t2), t3(t3) {} + + GF2NP * Clone() const {return new GF2NPP(*this);} + void DEREncode(BufferedTransformation &bt) const; + +private: + unsigned int t0, t1, t2, t3; +}; + +// construct new GF2NP from the ASN.1 sequence Characteristic-two +CRYPTOPP_DLL GF2NP * CRYPTOPP_API BERDecodeGF2NP(BufferedTransformation &bt); + +NAMESPACE_END + +#ifndef __BORLANDC__ +NAMESPACE_BEGIN(std) +template<> inline void swap(CryptoPP::PolynomialMod2 &a, CryptoPP::PolynomialMod2 &b) +{ + a.swap(b); +} +NAMESPACE_END +#endif + +#endif diff --git a/cryptopp/gfpcrypt.cpp b/cryptopp/gfpcrypt.cpp new file mode 100644 index 0000000..6d9ffce --- /dev/null +++ b/cryptopp/gfpcrypt.cpp @@ -0,0 +1,275 @@ +// dsa.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "gfpcrypt.h" +#include "asn.h" +#include "oids.h" +#include "nbtheory.h" + +NAMESPACE_BEGIN(CryptoPP) + +void TestInstantiations_gfpcrypt() +{ + GDSA::Signer test; + GDSA::Verifier test1; + DSA::Signer test5(NullRNG(), 100); + DSA::Signer test2(test5); + NR::Signer test3; + NR::Verifier test4; + DLIES<>::Encryptor test6; + DLIES<>::Decryptor test7; +} + +void DL_GroupParameters_DSA::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg) +{ + Integer p, q, g; + + if (alg.GetValue("Modulus", p) && alg.GetValue("SubgroupGenerator", g)) + { + q = alg.GetValueWithDefault("SubgroupOrder", ComputeGroupOrder(p)/2); + } + else + { + int modulusSize = 1024; + alg.GetIntValue("ModulusSize", modulusSize) || alg.GetIntValue("KeySize", modulusSize); + + if (!DSA::IsValidPrimeLength(modulusSize)) + throw InvalidArgument("DSA: not a valid prime length"); + + SecByteBlock seed(SHA::DIGESTSIZE); + Integer h; + int c; + + do + { + rng.GenerateBlock(seed, SHA::DIGESTSIZE); + } while (!DSA::GeneratePrimes(seed, SHA::DIGESTSIZE*8, c, p, modulusSize, q)); + + do + { + h.Randomize(rng, 2, p-2); + g = a_exp_b_mod_c(h, (p-1)/q, p); + } while (g <= 1); + } + + Initialize(p, q, g); +} + +bool DL_GroupParameters_DSA::ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = DL_GroupParameters_GFP::ValidateGroup(rng, level); + pass = pass && DSA::IsValidPrimeLength(GetModulus().BitCount()); + pass = pass && GetSubgroupOrder().BitCount() == 160; + return pass; +} + +void DL_SignatureMessageEncodingMethod_DSA::ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const +{ + assert(recoverableMessageLength == 0); + assert(hashIdentifier.second == 0); + const size_t representativeByteLength = BitsToBytes(representativeBitLength); + const size_t digestSize = hash.DigestSize(); + const size_t paddingLength = SaturatingSubtract(representativeByteLength, digestSize); + + memset(representative, 0, paddingLength); + hash.TruncatedFinal(representative+paddingLength, STDMIN(representativeByteLength, digestSize)); + + if (digestSize*8 > representativeBitLength) + { + Integer h(representative, representativeByteLength); + h >>= representativeByteLength*8 - representativeBitLength; + h.Encode(representative, representativeByteLength); + } +} + +void DL_SignatureMessageEncodingMethod_NR::ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const +{ + assert(recoverableMessageLength == 0); + assert(hashIdentifier.second == 0); + const size_t representativeByteLength = BitsToBytes(representativeBitLength); + const size_t digestSize = hash.DigestSize(); + const size_t paddingLength = SaturatingSubtract(representativeByteLength, digestSize); + + memset(representative, 0, paddingLength); + hash.TruncatedFinal(representative+paddingLength, STDMIN(representativeByteLength, digestSize)); + + if (digestSize*8 >= representativeBitLength) + { + Integer h(representative, representativeByteLength); + h >>= representativeByteLength*8 - representativeBitLength + 1; + h.Encode(representative, representativeByteLength); + } +} + +bool DL_GroupParameters_IntegerBased::ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const +{ + const Integer &p = GetModulus(), &q = GetSubgroupOrder(); + + bool pass = true; + pass = pass && p > Integer::One() && p.IsOdd(); + pass = pass && q > Integer::One() && q.IsOdd(); + + if (level >= 1) + pass = pass && GetCofactor() > Integer::One() && GetGroupOrder() % q == Integer::Zero(); + if (level >= 2) + pass = pass && VerifyPrime(rng, q, level-2) && VerifyPrime(rng, p, level-2); + + return pass; +} + +bool DL_GroupParameters_IntegerBased::ValidateElement(unsigned int level, const Integer &g, const DL_FixedBasePrecomputation *gpc) const +{ + const Integer &p = GetModulus(), &q = GetSubgroupOrder(); + + bool pass = true; + pass = pass && GetFieldType() == 1 ? g.IsPositive() : g.NotNegative(); + pass = pass && g < p && !IsIdentity(g); + + if (level >= 1) + { + if (gpc) + pass = pass && gpc->Exponentiate(GetGroupPrecomputation(), Integer::One()) == g; + } + if (level >= 2) + { + if (GetFieldType() == 2) + pass = pass && Jacobi(g*g-4, p)==-1; + + // verifying that Lucas((p+1)/2, w, p)==2 is omitted because it's too costly + // and at most 1 bit is leaked if it's false + bool fullValidate = (GetFieldType() == 2 && level >= 3) || !FastSubgroupCheckAvailable(); + + if (fullValidate && pass) + { + Integer gp = gpc ? gpc->Exponentiate(GetGroupPrecomputation(), q) : ExponentiateElement(g, q); + pass = pass && IsIdentity(gp); + } + else if (GetFieldType() == 1) + pass = pass && Jacobi(g, p) == 1; + } + + return pass; +} + +void DL_GroupParameters_IntegerBased::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg) +{ + Integer p, q, g; + + if (alg.GetValue("Modulus", p) && alg.GetValue("SubgroupGenerator", g)) + { + q = alg.GetValueWithDefault("SubgroupOrder", ComputeGroupOrder(p)/2); + } + else + { + int modulusSize, subgroupOrderSize; + + if (!alg.GetIntValue("ModulusSize", modulusSize)) + modulusSize = alg.GetIntValueWithDefault("KeySize", 2048); + + if (!alg.GetIntValue("SubgroupOrderSize", subgroupOrderSize)) + subgroupOrderSize = GetDefaultSubgroupOrderSize(modulusSize); + + PrimeAndGenerator pg; + pg.Generate(GetFieldType() == 1 ? 1 : -1, rng, modulusSize, subgroupOrderSize); + p = pg.Prime(); + q = pg.SubPrime(); + g = pg.Generator(); + } + + Initialize(p, q, g); +} + +Integer DL_GroupParameters_IntegerBased::DecodeElement(const byte *encoded, bool checkForGroupMembership) const +{ + Integer g(encoded, GetModulus().ByteCount()); + if (!ValidateElement(1, g, NULL)) + throw DL_BadElement(); + return g; +} + +void DL_GroupParameters_IntegerBased::BERDecode(BufferedTransformation &bt) +{ + BERSequenceDecoder parameters(bt); + Integer p(parameters); + Integer q(parameters); + Integer g; + if (parameters.EndReached()) + { + g = q; + q = ComputeGroupOrder(p) / 2; + } + else + g.BERDecode(parameters); + parameters.MessageEnd(); + + SetModulusAndSubgroupGenerator(p, g); + SetSubgroupOrder(q); +} + +void DL_GroupParameters_IntegerBased::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder parameters(bt); + GetModulus().DEREncode(parameters); + m_q.DEREncode(parameters); + GetSubgroupGenerator().DEREncode(parameters); + parameters.MessageEnd(); +} + +bool DL_GroupParameters_IntegerBased::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper >(this, name, valueType, pValue) + CRYPTOPP_GET_FUNCTION_ENTRY(Modulus); +} + +void DL_GroupParameters_IntegerBased::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY2(Modulus, SubgroupGenerator) + CRYPTOPP_SET_FUNCTION_ENTRY(SubgroupOrder) + ; +} + +OID DL_GroupParameters_IntegerBased::GetAlgorithmID() const +{ + return ASN1::id_dsa(); +} + +void DL_GroupParameters_GFP::SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const +{ + ModularArithmetic ma(GetModulus()); + ma.SimultaneousExponentiate(results, base, exponents, exponentsCount); +} + +DL_GroupParameters_GFP::Element DL_GroupParameters_GFP::MultiplyElements(const Element &a, const Element &b) const +{ + return a_times_b_mod_c(a, b, GetModulus()); +} + +DL_GroupParameters_GFP::Element DL_GroupParameters_GFP::CascadeExponentiate(const Element &element1, const Integer &exponent1, const Element &element2, const Integer &exponent2) const +{ + ModularArithmetic ma(GetModulus()); + return ma.CascadeExponentiate(element1, exponent1, element2, exponent2); +} + +Integer DL_GroupParameters_IntegerBased::GetMaxExponent() const +{ + return STDMIN(GetSubgroupOrder()-1, Integer::Power2(2*DiscreteLogWorkFactor(GetFieldType()*GetModulus().BitCount()))); +} + +unsigned int DL_GroupParameters_IntegerBased::GetDefaultSubgroupOrderSize(unsigned int modulusSize) const +{ + return 2*DiscreteLogWorkFactor(GetFieldType()*modulusSize); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/gfpcrypt.h b/cryptopp/gfpcrypt.h new file mode 100644 index 0000000..5e9c635 --- /dev/null +++ b/cryptopp/gfpcrypt.h @@ -0,0 +1,536 @@ +#ifndef CRYPTOPP_GFPCRYPT_H +#define CRYPTOPP_GFPCRYPT_H + +/** \file + Implementation of schemes based on DL over GF(p) +*/ + +#include "pubkey.h" +#include "modexppc.h" +#include "sha.h" +#include "algparam.h" +#include "asn.h" +#include "smartptr.h" +#include "hmac.h" + +#include + +NAMESPACE_BEGIN(CryptoPP) + +CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters; + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBased : public ASN1CryptoMaterial > +{ + typedef DL_GroupParameters_IntegerBased ThisClass; + +public: + void Initialize(const DL_GroupParameters_IntegerBased ¶ms) + {Initialize(params.GetModulus(), params.GetSubgroupOrder(), params.GetSubgroupGenerator());} + void Initialize(RandomNumberGenerator &rng, unsigned int pbits) + {GenerateRandom(rng, MakeParameters("ModulusSize", (int)pbits));} + void Initialize(const Integer &p, const Integer &g) + {SetModulusAndSubgroupGenerator(p, g); SetSubgroupOrder(ComputeGroupOrder(p)/2);} + void Initialize(const Integer &p, const Integer &q, const Integer &g) + {SetModulusAndSubgroupGenerator(p, g); SetSubgroupOrder(q);} + + // ASN1Object interface + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + // GeneratibleCryptoMaterial interface + /*! parameters: (ModulusSize, SubgroupOrderSize (optional)) */ + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg); + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + + // DL_GroupParameters + const Integer & GetSubgroupOrder() const {return m_q;} + Integer GetGroupOrder() const {return GetFieldType() == 1 ? GetModulus()-Integer::One() : GetModulus()+Integer::One();} + bool ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const; + bool ValidateElement(unsigned int level, const Integer &element, const DL_FixedBasePrecomputation *precomp) const; + bool FastSubgroupCheckAvailable() const {return GetCofactor() == 2;} + void EncodeElement(bool reversible, const Element &element, byte *encoded) const + {element.Encode(encoded, GetModulus().ByteCount());} + unsigned int GetEncodedElementSize(bool reversible) const {return GetModulus().ByteCount();} + Integer DecodeElement(const byte *encoded, bool checkForGroupMembership) const; + Integer ConvertElementToInteger(const Element &element) const + {return element;} + Integer GetMaxExponent() const; + static std::string CRYPTOPP_API StaticAlgorithmNamePrefix() {return "";} + + OID GetAlgorithmID() const; + + virtual const Integer & GetModulus() const =0; + virtual void SetModulusAndSubgroupGenerator(const Integer &p, const Integer &g) =0; + + void SetSubgroupOrder(const Integer &q) + {m_q = q; ParametersChanged();} + +protected: + Integer ComputeGroupOrder(const Integer &modulus) const + {return modulus-(GetFieldType() == 1 ? 1 : -1);} + + // GF(p) = 1, GF(p^2) = 2 + virtual int GetFieldType() const =0; + virtual unsigned int GetDefaultSubgroupOrderSize(unsigned int modulusSize) const; + +private: + Integer m_q; +}; + +//! _ +template > +class CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBasedImpl : public DL_GroupParametersImpl +{ + typedef DL_GroupParameters_IntegerBasedImpl ThisClass; + +public: + typedef typename GROUP_PRECOMP::Element Element; + + // GeneratibleCryptoMaterial interface + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const + {return GetValueHelper(this, name, valueType, pValue).Assignable();} + + void AssignFrom(const NameValuePairs &source) + {AssignFromHelper(this, source);} + + // DL_GroupParameters + const DL_FixedBasePrecomputation & GetBasePrecomputation() const {return this->m_gpc;} + DL_FixedBasePrecomputation & AccessBasePrecomputation() {return this->m_gpc;} + + // IntegerGroupParameters + const Integer & GetModulus() const {return this->m_groupPrecomputation.GetModulus();} + const Integer & GetGenerator() const {return this->m_gpc.GetBase(this->GetGroupPrecomputation());} + + void SetModulusAndSubgroupGenerator(const Integer &p, const Integer &g) // these have to be set together + {this->m_groupPrecomputation.SetModulus(p); this->m_gpc.SetBase(this->GetGroupPrecomputation(), g); this->ParametersChanged();} + + // non-inherited + bool operator==(const DL_GroupParameters_IntegerBasedImpl &rhs) const + {return GetModulus() == rhs.GetModulus() && GetGenerator() == rhs.GetGenerator() && this->GetSubgroupOrder() == rhs.GetSubgroupOrder();} + bool operator!=(const DL_GroupParameters_IntegerBasedImpl &rhs) const + {return !operator==(rhs);} +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_IntegerBasedImpl; + +//! GF(p) group parameters +class CRYPTOPP_DLL DL_GroupParameters_GFP : public DL_GroupParameters_IntegerBasedImpl +{ +public: + // DL_GroupParameters + bool IsIdentity(const Integer &element) const {return element == Integer::One();} + void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const; + + // NameValuePairs interface + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const + { + return GetValueHelper(this, name, valueType, pValue).Assignable(); + } + + // used by MQV + Element MultiplyElements(const Element &a, const Element &b) const; + Element CascadeExponentiate(const Element &element1, const Integer &exponent1, const Element &element2, const Integer &exponent2) const; + +protected: + int GetFieldType() const {return 1;} +}; + +//! GF(p) group parameters that default to same primes +class CRYPTOPP_DLL DL_GroupParameters_GFP_DefaultSafePrime : public DL_GroupParameters_GFP +{ +public: + typedef NoCofactorMultiplication DefaultCofactorOption; + +protected: + unsigned int GetDefaultSubgroupOrderSize(unsigned int modulusSize) const {return modulusSize-1;} +}; + +//! GDSA algorithm +template +class DL_Algorithm_GDSA : public DL_ElgamalLikeSignatureAlgorithm +{ +public: + static const char * CRYPTOPP_API StaticAlgorithmName() {return "DSA-1363";} + + void Sign(const DL_GroupParameters ¶ms, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const + { + const Integer &q = params.GetSubgroupOrder(); + r %= q; + Integer kInv = k.InverseMod(q); + s = (kInv * (x*r + e)) % q; + assert(!!r && !!s); + } + + bool Verify(const DL_GroupParameters ¶ms, const DL_PublicKey &publicKey, const Integer &e, const Integer &r, const Integer &s) const + { + const Integer &q = params.GetSubgroupOrder(); + if (r>=q || r<1 || s>=q || s<1) + return false; + + Integer w = s.InverseMod(q); + Integer u1 = (e * w) % q; + Integer u2 = (r * w) % q; + // verify r == (g^u1 * y^u2 mod p) mod q + return r == params.ConvertElementToInteger(publicKey.CascadeExponentiateBaseAndPublicElement(u1, u2)) % q; + } +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA; + +//! NR algorithm +template +class DL_Algorithm_NR : public DL_ElgamalLikeSignatureAlgorithm +{ +public: + static const char * CRYPTOPP_API StaticAlgorithmName() {return "NR";} + + void Sign(const DL_GroupParameters ¶ms, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const + { + const Integer &q = params.GetSubgroupOrder(); + r = (r + e) % q; + s = (k - x*r) % q; + assert(!!r); + } + + bool Verify(const DL_GroupParameters ¶ms, const DL_PublicKey &publicKey, const Integer &e, const Integer &r, const Integer &s) const + { + const Integer &q = params.GetSubgroupOrder(); + if (r>=q || r<1 || s>=q) + return false; + + // check r == (m_g^s * m_y^r + m) mod m_q + return r == (params.ConvertElementToInteger(publicKey.CascadeExponentiateBaseAndPublicElement(s, r)) + e) % q; + } +}; + +/*! DSA public key format is defined in 7.3.3 of RFC 2459. The + private key format is defined in 12.9 of PKCS #11 v2.10. */ +template +class DL_PublicKey_GFP : public DL_PublicKeyImpl +{ +public: + void Initialize(const DL_GroupParameters_IntegerBased ¶ms, const Integer &y) + {this->AccessGroupParameters().Initialize(params); this->SetPublicElement(y);} + void Initialize(const Integer &p, const Integer &g, const Integer &y) + {this->AccessGroupParameters().Initialize(p, g); this->SetPublicElement(y);} + void Initialize(const Integer &p, const Integer &q, const Integer &g, const Integer &y) + {this->AccessGroupParameters().Initialize(p, q, g); this->SetPublicElement(y);} + + // X509PublicKey + void BERDecodePublicKey(BufferedTransformation &bt, bool, size_t) + {this->SetPublicElement(Integer(bt));} + void DEREncodePublicKey(BufferedTransformation &bt) const + {this->GetPublicElement().DEREncode(bt);} +}; + +//! DL private key (in GF(p) groups) +template +class DL_PrivateKey_GFP : public DL_PrivateKeyImpl +{ +public: + void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits) + {this->GenerateRandomWithKeySize(rng, modulusBits);} + void Initialize(RandomNumberGenerator &rng, const Integer &p, const Integer &g) + {this->GenerateRandom(rng, MakeParameters("Modulus", p)("SubgroupGenerator", g));} + void Initialize(RandomNumberGenerator &rng, const Integer &p, const Integer &q, const Integer &g) + {this->GenerateRandom(rng, MakeParameters("Modulus", p)("SubgroupOrder", q)("SubgroupGenerator", g));} + void Initialize(const DL_GroupParameters_IntegerBased ¶ms, const Integer &x) + {this->AccessGroupParameters().Initialize(params); this->SetPrivateExponent(x);} + void Initialize(const Integer &p, const Integer &g, const Integer &x) + {this->AccessGroupParameters().Initialize(p, g); this->SetPrivateExponent(x);} + void Initialize(const Integer &p, const Integer &q, const Integer &g, const Integer &x) + {this->AccessGroupParameters().Initialize(p, q, g); this->SetPrivateExponent(x);} +}; + +//! DL signing/verification keys (in GF(p) groups) +struct DL_SignatureKeys_GFP +{ + typedef DL_GroupParameters_GFP GroupParameters; + typedef DL_PublicKey_GFP PublicKey; + typedef DL_PrivateKey_GFP PrivateKey; +}; + +//! DL encryption/decryption keys (in GF(p) groups) +struct DL_CryptoKeys_GFP +{ + typedef DL_GroupParameters_GFP_DefaultSafePrime GroupParameters; + typedef DL_PublicKey_GFP PublicKey; + typedef DL_PrivateKey_GFP PrivateKey; +}; + +//! provided for backwards compatibility, this class uses the old non-standard Crypto++ key format +template +class DL_PublicKey_GFP_OldFormat : public BASE +{ +public: + void BERDecode(BufferedTransformation &bt) + { + BERSequenceDecoder seq(bt); + Integer v1(seq); + Integer v2(seq); + Integer v3(seq); + + if (seq.EndReached()) + { + this->AccessGroupParameters().Initialize(v1, v1/2, v2); + this->SetPublicElement(v3); + } + else + { + Integer v4(seq); + this->AccessGroupParameters().Initialize(v1, v2, v3); + this->SetPublicElement(v4); + } + + seq.MessageEnd(); + } + + void DEREncode(BufferedTransformation &bt) const + { + DERSequenceEncoder seq(bt); + this->GetGroupParameters().GetModulus().DEREncode(seq); + if (this->GetGroupParameters().GetCofactor() != 2) + this->GetGroupParameters().GetSubgroupOrder().DEREncode(seq); + this->GetGroupParameters().GetGenerator().DEREncode(seq); + this->GetPublicElement().DEREncode(seq); + seq.MessageEnd(); + } +}; + +//! provided for backwards compatibility, this class uses the old non-standard Crypto++ key format +template +class DL_PrivateKey_GFP_OldFormat : public BASE +{ +public: + void BERDecode(BufferedTransformation &bt) + { + BERSequenceDecoder seq(bt); + Integer v1(seq); + Integer v2(seq); + Integer v3(seq); + Integer v4(seq); + + if (seq.EndReached()) + { + this->AccessGroupParameters().Initialize(v1, v1/2, v2); + this->SetPrivateExponent(v4 % (v1/2)); // some old keys may have x >= q + } + else + { + Integer v5(seq); + this->AccessGroupParameters().Initialize(v1, v2, v3); + this->SetPrivateExponent(v5); + } + + seq.MessageEnd(); + } + + void DEREncode(BufferedTransformation &bt) const + { + DERSequenceEncoder seq(bt); + this->GetGroupParameters().GetModulus().DEREncode(seq); + if (this->GetGroupParameters().GetCofactor() != 2) + this->GetGroupParameters().GetSubgroupOrder().DEREncode(seq); + this->GetGroupParameters().GetGenerator().DEREncode(seq); + this->GetGroupParameters().ExponentiateBase(this->GetPrivateExponent()).DEREncode(seq); + this->GetPrivateExponent().DEREncode(seq); + seq.MessageEnd(); + } +}; + +//! DSA-1363 +template +struct GDSA : public DL_SS< + DL_SignatureKeys_GFP, + DL_Algorithm_GDSA, + DL_SignatureMessageEncodingMethod_DSA, + H> +{ +}; + +//! NR +template +struct NR : public DL_SS< + DL_SignatureKeys_GFP, + DL_Algorithm_NR, + DL_SignatureMessageEncodingMethod_NR, + H> +{ +}; + +//! DSA group parameters, these are GF(p) group parameters that are allowed by the DSA standard +class CRYPTOPP_DLL DL_GroupParameters_DSA : public DL_GroupParameters_GFP +{ +public: + /*! also checks that the lengths of p and q are allowed by the DSA standard */ + bool ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const; + /*! parameters: (ModulusSize), or (Modulus, SubgroupOrder, SubgroupGenerator) */ + /*! ModulusSize must be between DSA::MIN_PRIME_LENGTH and DSA::MAX_PRIME_LENGTH, and divisible by DSA::PRIME_LENGTH_MULTIPLE */ + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg); +}; + +struct DSA; + +//! DSA keys +struct DL_Keys_DSA +{ + typedef DL_PublicKey_GFP PublicKey; + typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest, DSA> PrivateKey; +}; + +//! DSA +struct CRYPTOPP_DLL DSA : public DL_SS< + DL_Keys_DSA, + DL_Algorithm_GDSA, + DL_SignatureMessageEncodingMethod_DSA, + SHA, + DSA> +{ + static const char * CRYPTOPP_API StaticAlgorithmName() {return "DSA";} + + //! Generate DSA primes according to NIST standard + /*! Both seedLength and primeLength are in bits, but seedLength should + be a multiple of 8. + If useInputCounterValue == true, the counter parameter is taken as input, otherwise it's used for output + */ + static bool CRYPTOPP_API GeneratePrimes(const byte *seed, unsigned int seedLength, int &counter, + Integer &p, unsigned int primeLength, Integer &q, bool useInputCounterValue = false); + + static bool CRYPTOPP_API IsValidPrimeLength(unsigned int pbits) + {return pbits >= MIN_PRIME_LENGTH && pbits <= MAX_PRIME_LENGTH && pbits % PRIME_LENGTH_MULTIPLE == 0;} + + //! FIPS 186-2 Change Notice 1 changed the minimum modulus length to 1024 + enum { +#if (DSA_1024_BIT_MODULUS_ONLY) + MIN_PRIME_LENGTH = 1024, +#else + MIN_PRIME_LENGTH = 512, +#endif + MAX_PRIME_LENGTH = 1024, PRIME_LENGTH_MULTIPLE = 64}; +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_GFP; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_GFP; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest, DSA>; + +//! the XOR encryption method, for use with DL-based cryptosystems +template +class DL_EncryptionAlgorithm_Xor : public DL_SymmetricEncryptionAlgorithm +{ +public: + bool ParameterSupported(const char *name) const {return strcmp(name, Name::EncodingParameters()) == 0;} + size_t GetSymmetricKeyLength(size_t plaintextLength) const + {return plaintextLength + MAC::DEFAULT_KEYLENGTH;} + size_t GetSymmetricCiphertextLength(size_t plaintextLength) const + {return plaintextLength + MAC::DIGESTSIZE;} + size_t GetMaxSymmetricPlaintextLength(size_t ciphertextLength) const + {return (unsigned int)SaturatingSubtract(ciphertextLength, (unsigned int)MAC::DIGESTSIZE);} + void SymmetricEncrypt(RandomNumberGenerator &rng, const byte *key, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs ¶meters) const + { + const byte *cipherKey, *macKey; + if (DHAES_MODE) + { + macKey = key; + cipherKey = key + MAC::DEFAULT_KEYLENGTH; + } + else + { + cipherKey = key; + macKey = key + plaintextLength; + } + + ConstByteArrayParameter encodingParameters; + parameters.GetValue(Name::EncodingParameters(), encodingParameters); + + xorbuf(ciphertext, plaintext, cipherKey, plaintextLength); + MAC mac(macKey); + mac.Update(ciphertext, plaintextLength); + mac.Update(encodingParameters.begin(), encodingParameters.size()); + if (DHAES_MODE) + { + byte L[8] = {0,0,0,0}; + PutWord(false, BIG_ENDIAN_ORDER, L+4, word32(encodingParameters.size())); + mac.Update(L, 8); + } + mac.Final(ciphertext + plaintextLength); + } + DecodingResult SymmetricDecrypt(const byte *key, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs ¶meters) const + { + size_t plaintextLength = GetMaxSymmetricPlaintextLength(ciphertextLength); + const byte *cipherKey, *macKey; + if (DHAES_MODE) + { + macKey = key; + cipherKey = key + MAC::DEFAULT_KEYLENGTH; + } + else + { + cipherKey = key; + macKey = key + plaintextLength; + } + + ConstByteArrayParameter encodingParameters; + parameters.GetValue(Name::EncodingParameters(), encodingParameters); + + MAC mac(macKey); + mac.Update(ciphertext, plaintextLength); + mac.Update(encodingParameters.begin(), encodingParameters.size()); + if (DHAES_MODE) + { + byte L[8] = {0,0,0,0}; + PutWord(false, BIG_ENDIAN_ORDER, L+4, word32(encodingParameters.size())); + mac.Update(L, 8); + } + if (!mac.Verify(ciphertext + plaintextLength)) + return DecodingResult(); + + xorbuf(plaintext, ciphertext, cipherKey, plaintextLength); + return DecodingResult(plaintextLength); + } +}; + +//! _ +template +class DL_KeyDerivationAlgorithm_P1363 : public DL_KeyDerivationAlgorithm +{ +public: + bool ParameterSupported(const char *name) const {return strcmp(name, Name::KeyDerivationParameters()) == 0;} + void Derive(const DL_GroupParameters ¶ms, byte *derivedKey, size_t derivedLength, const T &agreedElement, const T &ephemeralPublicKey, const NameValuePairs ¶meters) const + { + SecByteBlock agreedSecret; + if (DHAES_MODE) + { + agreedSecret.New(params.GetEncodedElementSize(true) + params.GetEncodedElementSize(false)); + params.EncodeElement(true, ephemeralPublicKey, agreedSecret); + params.EncodeElement(false, agreedElement, agreedSecret + params.GetEncodedElementSize(true)); + } + else + { + agreedSecret.New(params.GetEncodedElementSize(false)); + params.EncodeElement(false, agreedElement, agreedSecret); + } + + ConstByteArrayParameter derivationParameters; + parameters.GetValue(Name::KeyDerivationParameters(), derivationParameters); + KDF::DeriveKey(derivedKey, derivedLength, agreedSecret, agreedSecret.size(), derivationParameters.begin(), derivationParameters.size()); + } +}; + +//! Discrete Log Integrated Encryption Scheme, AKA DLIES +template +struct DLIES + : public DL_ES< + DL_CryptoKeys_GFP, + DL_KeyAgreementAlgorithm_DH, + DL_KeyDerivationAlgorithm_P1363 >, + DL_EncryptionAlgorithm_Xor, DHAES_MODE>, + DLIES<> > +{ + static std::string CRYPTOPP_API StaticAlgorithmName() {return "DLIES";} // TODO: fix this after name is standardized +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/gost.cpp b/cryptopp/gost.cpp new file mode 100644 index 0000000..1775238 --- /dev/null +++ b/cryptopp/gost.cpp @@ -0,0 +1,123 @@ +#include "pch.h" +#include "gost.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +// these are the S-boxes given in Applied Cryptography 2nd Ed., p. 333 +const byte GOST::Base::sBox[8][16]={ + {4, 10, 9, 2, 13, 8, 0, 14, 6, 11, 1, 12, 7, 15, 5, 3}, + {14, 11, 4, 12, 6, 13, 15, 10, 2, 3, 8, 1, 0, 7, 5, 9}, + {5, 8, 1, 13, 10, 3, 4, 2, 14, 15, 12, 7, 6, 0, 9, 11}, + {7, 13, 10, 1, 0, 8, 9, 15, 14, 4, 6, 12, 11, 2, 5, 3}, + {6, 12, 7, 1, 5, 15, 13, 8, 4, 10, 9, 14, 0, 3, 11, 2}, + {4, 11, 10, 0, 7, 2, 1, 13, 3, 6, 8, 5, 9, 12, 15, 14}, + {13, 11, 4, 1, 3, 15, 5, 9, 0, 10, 14, 7, 6, 8, 2, 12}, + {1, 15, 13, 0, 5, 7, 10, 4, 9, 2, 3, 14, 6, 11, 8, 12}}; + +/* // these are the S-boxes given in the GOST source code listing in Applied + // Cryptography 2nd Ed., p. 644. they appear to be from the DES S-boxes + {13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7 }, + { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1 }, + {12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11 }, + { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9 }, + { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15 }, + {10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8 }, + {15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 }, + {14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 }}; +*/ + +bool GOST::Base::sTableCalculated = false; +word32 GOST::Base::sTable[4][256]; + +void GOST::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &) +{ + AssertValidKeyLength(length); + + PrecalculateSTable(); + + GetUserKey(LITTLE_ENDIAN_ORDER, key.begin(), 8, userKey, KEYLENGTH); +} + +void GOST::Base::PrecalculateSTable() +{ + if (!sTableCalculated) + { + for (unsigned i = 0; i < 4; i++) + for (unsigned j = 0; j < 256; j++) + { + word32 temp = sBox[2*i][j%16] | (sBox[2*i+1][j/16] << 4); + sTable[i][j] = rotlMod(temp, 11+8*i); + } + + sTableCalculated=true; + } +} + +#define f(x) ( t=x, \ + sTable[3][GETBYTE(t, 3)] ^ sTable[2][GETBYTE(t, 2)] \ + ^ sTable[1][GETBYTE(t, 1)] ^ sTable[0][GETBYTE(t, 0)] ) + +typedef BlockGetAndPut Block; + +void GOST::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 n1, n2, t; + + Block::Get(inBlock)(n1)(n2); + + for (unsigned int i=0; i<3; i++) + { + n2 ^= f(n1+key[0]); + n1 ^= f(n2+key[1]); + n2 ^= f(n1+key[2]); + n1 ^= f(n2+key[3]); + n2 ^= f(n1+key[4]); + n1 ^= f(n2+key[5]); + n2 ^= f(n1+key[6]); + n1 ^= f(n2+key[7]); + } + + n2 ^= f(n1+key[7]); + n1 ^= f(n2+key[6]); + n2 ^= f(n1+key[5]); + n1 ^= f(n2+key[4]); + n2 ^= f(n1+key[3]); + n1 ^= f(n2+key[2]); + n2 ^= f(n1+key[1]); + n1 ^= f(n2+key[0]); + + Block::Put(xorBlock, outBlock)(n2)(n1); +} + +void GOST::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 n1, n2, t; + + Block::Get(inBlock)(n1)(n2); + + n2 ^= f(n1+key[0]); + n1 ^= f(n2+key[1]); + n2 ^= f(n1+key[2]); + n1 ^= f(n2+key[3]); + n2 ^= f(n1+key[4]); + n1 ^= f(n2+key[5]); + n2 ^= f(n1+key[6]); + n1 ^= f(n2+key[7]); + + for (unsigned int i=0; i<3; i++) + { + n2 ^= f(n1+key[7]); + n1 ^= f(n2+key[6]); + n2 ^= f(n1+key[5]); + n1 ^= f(n2+key[4]); + n2 ^= f(n1+key[3]); + n1 ^= f(n2+key[2]); + n2 ^= f(n1+key[1]); + n1 ^= f(n2+key[0]); + } + + Block::Put(xorBlock, outBlock)(n2)(n1); +} + +NAMESPACE_END diff --git a/cryptopp/gost.h b/cryptopp/gost.h new file mode 100644 index 0000000..044c18d --- /dev/null +++ b/cryptopp/gost.h @@ -0,0 +1,58 @@ +#ifndef CRYPTOPP_GOST_H +#define CRYPTOPP_GOST_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32> +{ + static const char *StaticAlgorithmName() {return "GOST";} +}; + +/// GOST +class GOST : public GOST_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + static void PrecalculateSTable(); + + static const byte sBox[8][16]; + static bool sTableCalculated; + static word32 sTable[4][256]; + + FixedSizeSecBlock key; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef GOST::Encryption GOSTEncryption; +typedef GOST::Decryption GOSTDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/gzip.cpp b/cryptopp/gzip.cpp new file mode 100644 index 0000000..09e420a --- /dev/null +++ b/cryptopp/gzip.cpp @@ -0,0 +1,99 @@ +// gzip.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "gzip.h" + +NAMESPACE_BEGIN(CryptoPP) + +void Gzip::WritePrestreamHeader() +{ + m_totalLen = 0; + m_crc.Restart(); + + AttachedTransformation()->Put(MAGIC1); + AttachedTransformation()->Put(MAGIC2); + AttachedTransformation()->Put(DEFLATED); + AttachedTransformation()->Put(0); // general flag + AttachedTransformation()->PutWord32(0); // time stamp + byte extra = (GetDeflateLevel() == 1) ? FAST : ((GetDeflateLevel() == 9) ? SLOW : 0); + AttachedTransformation()->Put(extra); + AttachedTransformation()->Put(GZIP_OS_CODE); +} + +void Gzip::ProcessUncompressedData(const byte *inString, size_t length) +{ + m_crc.Update(inString, length); + m_totalLen += (word32)length; +} + +void Gzip::WritePoststreamTail() +{ + SecByteBlock crc(4); + m_crc.Final(crc); + AttachedTransformation()->Put(crc, 4); + AttachedTransformation()->PutWord32(m_totalLen, LITTLE_ENDIAN_ORDER); +} + +// ************************************************************* + +Gunzip::Gunzip(BufferedTransformation *attachment, bool repeat, int propagation) + : Inflator(attachment, repeat, propagation) +{ +} + +void Gunzip::ProcessPrestreamHeader() +{ + m_length = 0; + m_crc.Restart(); + + byte buf[6]; + byte b, flags; + + if (m_inQueue.Get(buf, 2)!=2) throw HeaderErr(); + if (buf[0] != MAGIC1 || buf[1] != MAGIC2) throw HeaderErr(); + if (!m_inQueue.Skip(1)) throw HeaderErr(); // skip extra flags + if (!m_inQueue.Get(flags)) throw HeaderErr(); + if (flags & (ENCRYPTED | CONTINUED)) throw HeaderErr(); + if (m_inQueue.Skip(6)!=6) throw HeaderErr(); // Skip file time, extra flags and OS type + + if (flags & EXTRA_FIELDS) // skip extra fields + { + word16 length; + if (m_inQueue.GetWord16(length, LITTLE_ENDIAN_ORDER) != 2) throw HeaderErr(); + if (m_inQueue.Skip(length)!=length) throw HeaderErr(); + } + + if (flags & FILENAME) // skip filename + do + if(!m_inQueue.Get(b)) throw HeaderErr(); + while (b); + + if (flags & COMMENTS) // skip comments + do + if(!m_inQueue.Get(b)) throw HeaderErr(); + while (b); +} + +void Gunzip::ProcessDecompressedData(const byte *inString, size_t length) +{ + AttachedTransformation()->Put(inString, length); + m_crc.Update(inString, length); + m_length += (word32)length; +} + +void Gunzip::ProcessPoststreamTail() +{ + SecByteBlock crc(4); + if (m_inQueue.Get(crc, 4) != 4) + throw TailErr(); + if (!m_crc.Verify(crc)) + throw CrcErr(); + + word32 lengthCheck; + if (m_inQueue.GetWord32(lengthCheck, LITTLE_ENDIAN_ORDER) != 4) + throw TailErr(); + if (lengthCheck != m_length) + throw LengthErr(); +} + +NAMESPACE_END diff --git a/cryptopp/gzip.h b/cryptopp/gzip.h new file mode 100644 index 0000000..f3148ad --- /dev/null +++ b/cryptopp/gzip.h @@ -0,0 +1,65 @@ +#ifndef CRYPTOPP_GZIP_H +#define CRYPTOPP_GZIP_H + +#include "zdeflate.h" +#include "zinflate.h" +#include "crc.h" + +NAMESPACE_BEGIN(CryptoPP) + +/// GZIP Compression (RFC 1952) +class Gzip : public Deflator +{ +public: + Gzip(BufferedTransformation *attachment=NULL, unsigned int deflateLevel=DEFAULT_DEFLATE_LEVEL, unsigned int log2WindowSize=DEFAULT_LOG2_WINDOW_SIZE, bool detectUncompressible=true) + : Deflator(attachment, deflateLevel, log2WindowSize, detectUncompressible) {} + Gzip(const NameValuePairs ¶meters, BufferedTransformation *attachment=NULL) + : Deflator(parameters, attachment) {} + +protected: + enum {MAGIC1=0x1f, MAGIC2=0x8b, // flags for the header + DEFLATED=8, FAST=4, SLOW=2}; + + void WritePrestreamHeader(); + void ProcessUncompressedData(const byte *string, size_t length); + void WritePoststreamTail(); + + word32 m_totalLen; + CRC32 m_crc; +}; + +/// GZIP Decompression (RFC 1952) +class Gunzip : public Inflator +{ +public: + typedef Inflator::Err Err; + class HeaderErr : public Err {public: HeaderErr() : Err(INVALID_DATA_FORMAT, "Gunzip: header decoding error") {}}; + class TailErr : public Err {public: TailErr() : Err(INVALID_DATA_FORMAT, "Gunzip: tail too short") {}}; + class CrcErr : public Err {public: CrcErr() : Err(DATA_INTEGRITY_CHECK_FAILED, "Gunzip: CRC check error") {}}; + class LengthErr : public Err {public: LengthErr() : Err(DATA_INTEGRITY_CHECK_FAILED, "Gunzip: length check error") {}}; + + /*! \param repeat decompress multiple compressed streams in series + \param autoSignalPropagation 0 to turn off MessageEnd signal + */ + Gunzip(BufferedTransformation *attachment = NULL, bool repeat = false, int autoSignalPropagation = -1); + +protected: + enum {MAGIC1=0x1f, MAGIC2=0x8b, // flags for the header + DEFLATED=8}; + + enum FLAG_MASKS { + CONTINUED=2, EXTRA_FIELDS=4, FILENAME=8, COMMENTS=16, ENCRYPTED=32}; + + unsigned int MaxPrestreamHeaderSize() const {return 1024;} + void ProcessPrestreamHeader(); + void ProcessDecompressedData(const byte *string, size_t length); + unsigned int MaxPoststreamTailSize() const {return 8;} + void ProcessPoststreamTail(); + + word32 m_length; + CRC32 m_crc; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/hex.cpp b/cryptopp/hex.cpp new file mode 100644 index 0000000..b6484a5 --- /dev/null +++ b/cryptopp/hex.cpp @@ -0,0 +1,44 @@ +// hex.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "hex.h" + +NAMESPACE_BEGIN(CryptoPP) + +static const byte s_vecUpper[] = "0123456789ABCDEF"; +static const byte s_vecLower[] = "0123456789abcdef"; + +void HexEncoder::IsolatedInitialize(const NameValuePairs ¶meters) +{ + bool uppercase = parameters.GetValueWithDefault(Name::Uppercase(), true); + m_filter->Initialize(CombinedNameValuePairs( + parameters, + MakeParameters(Name::EncodingLookupArray(), uppercase ? &s_vecUpper[0] : &s_vecLower[0], false)(Name::Log2Base(), 4, true))); +} + +void HexDecoder::IsolatedInitialize(const NameValuePairs ¶meters) +{ + BaseN_Decoder::IsolatedInitialize(CombinedNameValuePairs( + parameters, + MakeParameters(Name::DecodingLookupArray(), GetDefaultDecodingLookupArray(), false)(Name::Log2Base(), 4, true))); +} + +const int *HexDecoder::GetDefaultDecodingLookupArray() +{ + static bool s_initialized = false; + static int s_array[256]; + + if (!s_initialized) + { + InitializeDecodingLookupArray(s_array, s_vecUpper, 16, true); + s_initialized = true; + } + return s_array; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/hex.h b/cryptopp/hex.h new file mode 100644 index 0000000..006914c --- /dev/null +++ b/cryptopp/hex.h @@ -0,0 +1,36 @@ +#ifndef CRYPTOPP_HEX_H +#define CRYPTOPP_HEX_H + +#include "basecode.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! Converts given data to base 16 +class CRYPTOPP_DLL HexEncoder : public SimpleProxyFilter +{ +public: + HexEncoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "") + : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment) + { + IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator))(Name::Terminator(), ConstByteArrayParameter(terminator))); + } + + void IsolatedInitialize(const NameValuePairs ¶meters); +}; + +//! Decode base 16 data back to bytes +class CRYPTOPP_DLL HexDecoder : public BaseN_Decoder +{ +public: + HexDecoder(BufferedTransformation *attachment = NULL) + : BaseN_Decoder(GetDefaultDecodingLookupArray(), 4, attachment) {} + + void IsolatedInitialize(const NameValuePairs ¶meters); + +private: + static const int * CRYPTOPP_API GetDefaultDecodingLookupArray(); +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/hmac.cpp b/cryptopp/hmac.cpp new file mode 100644 index 0000000..d4a649c --- /dev/null +++ b/cryptopp/hmac.cpp @@ -0,0 +1,86 @@ +// hmac.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "hmac.h" + +NAMESPACE_BEGIN(CryptoPP) + +void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &) +{ + AssertValidKeyLength(keylength); + + Restart(); + + HashTransformation &hash = AccessHash(); + unsigned int blockSize = hash.BlockSize(); + + if (!blockSize) + throw InvalidArgument("HMAC: can only be used with a block-based hash function"); + + m_buf.resize(2*AccessHash().BlockSize() + AccessHash().DigestSize()); + + if (keylength <= blockSize) + memcpy(AccessIpad(), userKey, keylength); + else + { + AccessHash().CalculateDigest(AccessIpad(), userKey, keylength); + keylength = hash.DigestSize(); + } + + assert(keylength <= blockSize); + memset(AccessIpad()+keylength, 0, blockSize-keylength); + + for (unsigned int i=0; i, public MessageAuthenticationCode +{ +public: + HMAC_Base() : m_innerHashKeyed(false) {} + void UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs ¶ms); + + void Restart(); + void Update(const byte *input, size_t length); + void TruncatedFinal(byte *mac, size_t size); + unsigned int OptimalBlockSize() const {return const_cast(this)->AccessHash().OptimalBlockSize();} + unsigned int DigestSize() const {return const_cast(this)->AccessHash().DigestSize();} + +protected: + virtual HashTransformation & AccessHash() =0; + byte * AccessIpad() {return m_buf;} + byte * AccessOpad() {return m_buf + AccessHash().BlockSize();} + byte * AccessInnerHash() {return m_buf + 2*AccessHash().BlockSize();} + +private: + void KeyInnerHash(); + + SecByteBlock m_buf; + bool m_innerHashKeyed; +}; + +//! HMAC +/*! HMAC(K, text) = H(K XOR opad, H(K XOR ipad, text)) */ +template +class HMAC : public MessageAuthenticationCodeImpl > +{ +public: + CRYPTOPP_CONSTANT(DIGESTSIZE=T::DIGESTSIZE) + CRYPTOPP_CONSTANT(BLOCKSIZE=T::BLOCKSIZE) + + HMAC() {} + HMAC(const byte *key, size_t length=HMAC_Base::DEFAULT_KEYLENGTH) + {this->SetKey(key, length);} + + static std::string StaticAlgorithmName() {return std::string("HMAC(") + T::StaticAlgorithmName() + ")";} + std::string AlgorithmName() const {return std::string("HMAC(") + m_hash.AlgorithmName() + ")";} + +private: + HashTransformation & AccessHash() {return m_hash;} + + T m_hash; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/hrtimer.cpp b/cryptopp/hrtimer.cpp new file mode 100644 index 0000000..906ec4a --- /dev/null +++ b/cryptopp/hrtimer.cpp @@ -0,0 +1,139 @@ +// hrtimer.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "hrtimer.h" +#include "misc.h" +#include // for NULL +#include + +#if defined(CRYPTOPP_WIN32_AVAILABLE) +#include +#elif defined(CRYPTOPP_UNIX_AVAILABLE) +#include +#include +#include +#endif + +#include + +NAMESPACE_BEGIN(CryptoPP) + +#ifndef CRYPTOPP_IMPORTS + +double TimerBase::ConvertTo(TimerWord t, Unit unit) +{ + static unsigned long unitsPerSecondTable[] = {1, 1000, 1000*1000, 1000*1000*1000}; + + assert(unit < sizeof(unitsPerSecondTable) / sizeof(unitsPerSecondTable[0])); + return (double)CRYPTOPP_VC6_INT64 t * unitsPerSecondTable[unit] / CRYPTOPP_VC6_INT64 TicksPerSecond(); +} + +void TimerBase::StartTimer() +{ + m_last = m_start = GetCurrentTimerValue(); + m_started = true; +} + +double TimerBase::ElapsedTimeAsDouble() +{ + if (m_stuckAtZero) + return 0; + + if (m_started) + { + TimerWord now = GetCurrentTimerValue(); + if (m_last < now) // protect against OS bugs where time goes backwards + m_last = now; + return ConvertTo(m_last - m_start, m_timerUnit); + } + + StartTimer(); + return 0; +} + +unsigned long TimerBase::ElapsedTime() +{ + double elapsed = ElapsedTimeAsDouble(); + assert(elapsed <= ULONG_MAX); + return (unsigned long)elapsed; +} + +TimerWord Timer::GetCurrentTimerValue() +{ +#if defined(CRYPTOPP_WIN32_AVAILABLE) + LARGE_INTEGER now; + if (!QueryPerformanceCounter(&now)) + throw Exception(Exception::OTHER_ERROR, "Timer: QueryPerformanceCounter failed with error " + IntToString(GetLastError())); + return now.QuadPart; +#elif defined(CRYPTOPP_UNIX_AVAILABLE) + timeval now; + gettimeofday(&now, NULL); + return (TimerWord)now.tv_sec * 1000000 + now.tv_usec; +#else + clock_t now; + return clock(); +#endif +} + +TimerWord Timer::TicksPerSecond() +{ +#if defined(CRYPTOPP_WIN32_AVAILABLE) + static LARGE_INTEGER freq = {0}; + if (freq.QuadPart == 0) + { + if (!QueryPerformanceFrequency(&freq)) + throw Exception(Exception::OTHER_ERROR, "Timer: QueryPerformanceFrequency failed with error " + IntToString(GetLastError())); + } + return freq.QuadPart; +#elif defined(CRYPTOPP_UNIX_AVAILABLE) + return 1000000; +#else + return CLOCKS_PER_SEC; +#endif +} + +#endif // #ifndef CRYPTOPP_IMPORTS + +TimerWord ThreadUserTimer::GetCurrentTimerValue() +{ +#if defined(CRYPTOPP_WIN32_AVAILABLE) + static bool getCurrentThreadImplemented = true; + if (getCurrentThreadImplemented) + { + FILETIME now, ignored; + if (!GetThreadTimes(GetCurrentThread(), &ignored, &ignored, &ignored, &now)) + { + DWORD lastError = GetLastError(); + if (lastError == ERROR_CALL_NOT_IMPLEMENTED) + { + getCurrentThreadImplemented = false; + goto GetCurrentThreadNotImplemented; + } + throw Exception(Exception::OTHER_ERROR, "ThreadUserTimer: GetThreadTimes failed with error " + IntToString(lastError)); + } + return now.dwLowDateTime + ((TimerWord)now.dwHighDateTime << 32); + } +GetCurrentThreadNotImplemented: + return (TimerWord)clock() * (10*1000*1000 / CLOCKS_PER_SEC); +#elif defined(CRYPTOPP_UNIX_AVAILABLE) + tms now; + times(&now); + return now.tms_utime; +#else + return clock(); +#endif +} + +TimerWord ThreadUserTimer::TicksPerSecond() +{ +#if defined(CRYPTOPP_WIN32_AVAILABLE) + return 10*1000*1000; +#elif defined(CRYPTOPP_UNIX_AVAILABLE) + static const long ticksPerSecond = sysconf(_SC_CLK_TCK); + return ticksPerSecond; +#else + return CLOCKS_PER_SEC; +#endif +} + +NAMESPACE_END diff --git a/cryptopp/hrtimer.h b/cryptopp/hrtimer.h new file mode 100644 index 0000000..858dbd2 --- /dev/null +++ b/cryptopp/hrtimer.h @@ -0,0 +1,61 @@ +#ifndef CRYPTOPP_HRTIMER_H +#define CRYPTOPP_HRTIMER_H + +#include "config.h" +#ifndef HIGHRES_TIMER_AVAILABLE +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +#ifdef HIGHRES_TIMER_AVAILABLE + typedef word64 TimerWord; +#else + typedef clock_t TimerWord; +#endif + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TimerBase +{ +public: + enum Unit {SECONDS = 0, MILLISECONDS, MICROSECONDS, NANOSECONDS}; + TimerBase(Unit unit, bool stuckAtZero) : m_timerUnit(unit), m_stuckAtZero(stuckAtZero), m_started(false) {} + + virtual TimerWord GetCurrentTimerValue() =0; // GetCurrentTime is a macro in MSVC 6.0 + virtual TimerWord TicksPerSecond() =0; // this is not the resolution, just a conversion factor into seconds + + void StartTimer(); + double ElapsedTimeAsDouble(); + unsigned long ElapsedTime(); + +private: + double ConvertTo(TimerWord t, Unit unit); + + Unit m_timerUnit; // HPUX workaround: m_unit is a system macro on HPUX + bool m_stuckAtZero, m_started; + TimerWord m_start, m_last; +}; + +//! measure CPU time spent executing instructions of this thread (if supported by OS) +/*! /note This only works correctly on Windows NT or later. On Unix it reports process time, and others wall clock time. +*/ +class ThreadUserTimer : public TimerBase +{ +public: + ThreadUserTimer(Unit unit = TimerBase::SECONDS, bool stuckAtZero = false) : TimerBase(unit, stuckAtZero) {} + TimerWord GetCurrentTimerValue(); + TimerWord TicksPerSecond(); +}; + +//! high resolution timer +class CRYPTOPP_DLL Timer : public TimerBase +{ +public: + Timer(Unit unit = TimerBase::SECONDS, bool stuckAtZero = false) : TimerBase(unit, stuckAtZero) {} + TimerWord GetCurrentTimerValue(); + TimerWord TicksPerSecond(); +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/ida.cpp b/cryptopp/ida.cpp new file mode 100644 index 0000000..5cb43b2 --- /dev/null +++ b/cryptopp/ida.cpp @@ -0,0 +1,421 @@ +// ida.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "ida.h" + +#include "algebra.h" +#include "gf2_32.h" +#include "polynomi.h" +#include + +#include "polynomi.cpp" + +ANONYMOUS_NAMESPACE_BEGIN +static const CryptoPP::GF2_32 field; +NAMESPACE_END + +using namespace std; + +NAMESPACE_BEGIN(CryptoPP) + +void RawIDA::IsolatedInitialize(const NameValuePairs ¶meters) +{ + if (!parameters.GetIntValue("RecoveryThreshold", m_threshold)) + throw InvalidArgument("RawIDA: missing RecoveryThreshold argument"); + + if (m_threshold <= 0) + throw InvalidArgument("RawIDA: RecoveryThreshold must be greater than 0"); + + m_lastMapPosition = m_inputChannelMap.end(); + m_channelsReady = 0; + m_channelsFinished = 0; + m_w.New(m_threshold); + m_y.New(m_threshold); + m_inputQueues.reserve(m_threshold); + + m_outputChannelIds.clear(); + m_outputChannelIdStrings.clear(); + m_outputQueues.clear(); + + word32 outputChannelID; + if (parameters.GetValue("OutputChannelID", outputChannelID)) + AddOutputChannel(outputChannelID); + else + { + int nShares = parameters.GetIntValueWithDefault("NumberOfShares", m_threshold); + for (int i=0; ifirst == channelId) + goto skipFind; + ++m_lastMapPosition; + if (m_lastMapPosition != m_inputChannelMap.end() && m_lastMapPosition->first == channelId) + goto skipFind; + } + m_lastMapPosition = m_inputChannelMap.find(channelId); + +skipFind: + if (m_lastMapPosition == m_inputChannelMap.end()) + { + if (m_inputChannelIds.size() == m_threshold) + return m_threshold; + + m_lastMapPosition = m_inputChannelMap.insert(InputChannelMap::value_type(channelId, (unsigned int)m_inputChannelIds.size())).first; + m_inputQueues.push_back(MessageQueue()); + m_inputChannelIds.push_back(channelId); + + if (m_inputChannelIds.size() == m_threshold) + PrepareInterpolation(); + } + return m_lastMapPosition->second; +} + +unsigned int RawIDA::LookupInputChannel(word32 channelId) const +{ + map::const_iterator it = m_inputChannelMap.find(channelId); + if (it == m_inputChannelMap.end()) + return m_threshold; + else + return it->second; +} + +void RawIDA::ChannelData(word32 channelId, const byte *inString, size_t length, bool messageEnd) +{ + int i = InsertInputChannel(channelId); + if (i < m_threshold) + { + lword size = m_inputQueues[i].MaxRetrievable(); + m_inputQueues[i].Put(inString, length); + if (size < 4 && size + length >= 4) + { + m_channelsReady++; + if (m_channelsReady == m_threshold) + ProcessInputQueues(); + } + + if (messageEnd) + { + m_inputQueues[i].MessageEnd(); + if (m_inputQueues[i].NumberOfMessages() == 1) + { + m_channelsFinished++; + if (m_channelsFinished == m_threshold) + { + m_channelsReady = 0; + for (i=0; i= m_v.size()) + { + m_v.resize(i+1); + m_outputToInput.resize(i+1); + } + + m_outputToInput[i] = LookupInputChannel(m_outputChannelIds[i]); + if (m_outputToInput[i] == m_threshold && i * m_threshold <= 1000*1000) + { + m_v[i].resize(m_threshold); + PrepareBulkPolynomialInterpolationAt(field, m_v[i].begin(), m_outputChannelIds[i], &(m_inputChannelIds[0]), m_w.begin(), m_threshold); + } +} + +void RawIDA::AddOutputChannel(word32 channelId) +{ + m_outputChannelIds.push_back(channelId); + m_outputChannelIdStrings.push_back(WordToString(channelId)); + m_outputQueues.push_back(ByteQueue()); + if (m_inputChannelIds.size() == m_threshold) + ComputeV((unsigned int)m_outputChannelIds.size() - 1); +} + +void RawIDA::PrepareInterpolation() +{ + assert(m_inputChannelIds.size() == m_threshold); + PrepareBulkPolynomialInterpolation(field, m_w.begin(), &(m_inputChannelIds[0]), m_threshold); + for (unsigned int i=0; i 0 : m_channelsReady == m_threshold) + { + m_channelsReady = 0; + for (i=0; i 0 || queue.MaxRetrievable() >= 4; + } + + for (i=0; (unsigned int)i 0 && m_outputQueues[0].AnyRetrievable()) + FlushOutputQueues(); + + if (finished) + { + OutputMessageEnds(); + + m_channelsReady = 0; + m_channelsFinished = 0; + m_v.clear(); + + vector inputQueues; + vector inputChannelIds; + + inputQueues.swap(m_inputQueues); + inputChannelIds.swap(m_inputChannelIds); + m_inputChannelMap.clear(); + m_lastMapPosition = m_inputChannelMap.end(); + + for (i=0; iChannelMessageEnd(m_outputChannelIdStrings[i], GetAutoSignalPropagation()-1); + } +} + +// **************************************************************** + +void SecretSharing::IsolatedInitialize(const NameValuePairs ¶meters) +{ + m_pad = parameters.GetValueWithDefault("AddPadding", true); + m_ida.IsolatedInitialize(parameters); +} + +size_t SecretSharing::Put2(const byte *begin, size_t length, int messageEnd, bool blocking) +{ + if (!blocking) + throw BlockingInputOnly("SecretSharing"); + + SecByteBlock buf(UnsignedMin(256, length)); + unsigned int threshold = m_ida.GetThreshold(); + while (length > 0) + { + size_t len = STDMIN(length, buf.size()); + m_ida.ChannelData(0xffffffff, begin, len, false); + for (unsigned int i=0; i 0) + SecretSharing::Put(0); + } + m_ida.ChannelData(0xffffffff, NULL, 0, true); + for (unsigned int i=0; iMessageEnd(GetAutoSignalPropagation()-1); +} + +// **************************************************************** + +void InformationDispersal::IsolatedInitialize(const NameValuePairs ¶meters) +{ + m_nextChannel = 0; + m_pad = parameters.GetValueWithDefault("AddPadding", true); + m_ida.IsolatedInitialize(parameters); +} + +size_t InformationDispersal::Put2(const byte *begin, size_t length, int messageEnd, bool blocking) +{ + if (!blocking) + throw BlockingInputOnly("InformationDispersal"); + + while (length--) + { + m_ida.ChannelData(m_nextChannel, begin, 1, false); + begin++; + m_nextChannel++; + if (m_nextChannel == m_ida.GetThreshold()) + m_nextChannel = 0; + } + + if (messageEnd) + { + m_ida.SetAutoSignalPropagation(messageEnd-1); + if (m_pad) + InformationDispersal::Put(1); + for (word32 i=0; iMessageEnd(GetAutoSignalPropagation()-1); +} + +size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bool blocking) +{ + if (!blocking) + throw BlockingInputOnly("PaddingRemover"); + + const byte *const end = begin + length; + + if (m_possiblePadding) + { + size_t len = find_if(begin, end, bind2nd(not_equal_to(), 0)) - begin; + m_zeroCount += len; + begin += len; + if (begin == end) + return 0; + + AttachedTransformation()->Put(1); + while (m_zeroCount--) + AttachedTransformation()->Put(0); + AttachedTransformation()->Put(*begin++); + m_possiblePadding = false; + } + +#if defined(_MSC_VER) && !defined(__MWERKS__) && (_MSC_VER <= 1300) + // VC60 and VC7 workaround: built-in reverse_iterator has two template parameters, Dinkumware only has one + typedef reverse_bidirectional_iterator RevIt; +#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + typedef reverse_iterator RevIt; +#else + typedef reverse_iterator RevIt; +#endif + const byte *x = find_if(RevIt(end), RevIt(begin), bind2nd(not_equal_to(), 0)).base(); + if (x != begin && *(x-1) == 1) + { + AttachedTransformation()->Put(begin, x-begin-1); + m_possiblePadding = true; + m_zeroCount = end - x; + } + else + AttachedTransformation()->Put(begin, end-begin); + + if (messageEnd) + { + m_possiblePadding = false; + Output(0, begin, length, messageEnd, blocking); + } + return 0; +} + +NAMESPACE_END diff --git a/cryptopp/ida.h b/cryptopp/ida.h new file mode 100644 index 0000000..8ebb4ec --- /dev/null +++ b/cryptopp/ida.h @@ -0,0 +1,152 @@ +#ifndef CRYPTOPP_IDA_H +#define CRYPTOPP_IDA_H + +#include "mqueue.h" +#include "filters.h" +#include "channels.h" +#include +#include + +NAMESPACE_BEGIN(CryptoPP) + +/// base class for secret sharing and information dispersal +class RawIDA : public AutoSignaling > > +{ +public: + RawIDA(BufferedTransformation *attachment=NULL) + {Detach(attachment);} + + unsigned int GetThreshold() const {return m_threshold;} + void AddOutputChannel(word32 channelId); + void ChannelData(word32 channelId, const byte *inString, size_t length, bool messageEnd); + lword InputBuffered(word32 channelId) const; + + void IsolatedInitialize(const NameValuePairs ¶meters=g_nullNameValuePairs); + size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking) + { + if (!blocking) + throw BlockingInputOnly("RawIDA"); + ChannelData(StringToWord(channel), begin, length, messageEnd != 0); + return 0; + } + +protected: + virtual void FlushOutputQueues(); + virtual void OutputMessageEnds(); + + unsigned int InsertInputChannel(word32 channelId); + unsigned int LookupInputChannel(word32 channelId) const; + void ComputeV(unsigned int); + void PrepareInterpolation(); + void ProcessInputQueues(); + + typedef std::map InputChannelMap; + InputChannelMap m_inputChannelMap; + InputChannelMap::iterator m_lastMapPosition; + std::vector m_inputQueues; + std::vector m_inputChannelIds, m_outputChannelIds, m_outputToInput; + std::vector m_outputChannelIdStrings; + std::vector m_outputQueues; + int m_threshold; + unsigned int m_channelsReady, m_channelsFinished; + std::vector > m_v; + SecBlock m_u, m_w, m_y; +}; + +/// a variant of Shamir's Secret Sharing Algorithm +class SecretSharing : public CustomFlushPropagation +{ +public: + SecretSharing(RandomNumberGenerator &rng, int threshold, int nShares, BufferedTransformation *attachment=NULL, bool addPadding=true) + : m_rng(rng), m_ida(new OutputProxy(*this, true)) + { + Detach(attachment); + IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("NumberOfShares", nShares)("AddPadding", addPadding)); + } + + void IsolatedInitialize(const NameValuePairs ¶meters=g_nullNameValuePairs); + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + bool Flush(bool hardFlush, int propagation=-1, bool blocking=true) {return m_ida.Flush(hardFlush, propagation, blocking);} + +protected: + RandomNumberGenerator &m_rng; + RawIDA m_ida; + bool m_pad; +}; + +/// a variant of Shamir's Secret Sharing Algorithm +class SecretRecovery : public RawIDA +{ +public: + SecretRecovery(int threshold, BufferedTransformation *attachment=NULL, bool removePadding=true) + : RawIDA(attachment) + {IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("RemovePadding", removePadding));} + + void IsolatedInitialize(const NameValuePairs ¶meters=g_nullNameValuePairs); + +protected: + void FlushOutputQueues(); + void OutputMessageEnds(); + + bool m_pad; +}; + +/// a variant of Rabin's Information Dispersal Algorithm +class InformationDispersal : public CustomFlushPropagation +{ +public: + InformationDispersal(int threshold, int nShares, BufferedTransformation *attachment=NULL, bool addPadding=true) + : m_ida(new OutputProxy(*this, true)) + { + Detach(attachment); + IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("NumberOfShares", nShares)("AddPadding", addPadding)); + } + + void IsolatedInitialize(const NameValuePairs ¶meters=g_nullNameValuePairs); + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + bool Flush(bool hardFlush, int propagation=-1, bool blocking=true) {return m_ida.Flush(hardFlush, propagation, blocking);} + +protected: + RawIDA m_ida; + bool m_pad; + unsigned int m_nextChannel; +}; + +/// a variant of Rabin's Information Dispersal Algorithm +class InformationRecovery : public RawIDA +{ +public: + InformationRecovery(int threshold, BufferedTransformation *attachment=NULL, bool removePadding=true) + : RawIDA(attachment) + {IsolatedInitialize(MakeParameters("RecoveryThreshold", threshold)("RemovePadding", removePadding));} + + void IsolatedInitialize(const NameValuePairs ¶meters=g_nullNameValuePairs); + +protected: + void FlushOutputQueues(); + void OutputMessageEnds(); + + bool m_pad; + ByteQueue m_queue; +}; + +class PaddingRemover : public Unflushable +{ +public: + PaddingRemover(BufferedTransformation *attachment=NULL) + : m_possiblePadding(false) {Detach(attachment);} + + void IsolatedInitialize(const NameValuePairs ¶meters) {m_possiblePadding = false;} + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking); + + // GetPossiblePadding() == false at the end of a message indicates incorrect padding + bool GetPossiblePadding() const {return m_possiblePadding;} + +private: + bool m_possiblePadding; + lword m_zeroCount; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/idea.cpp b/cryptopp/idea.cpp new file mode 100644 index 0000000..b0768fa --- /dev/null +++ b/cryptopp/idea.cpp @@ -0,0 +1,192 @@ +// idea.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "idea.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +static const int IDEA_KEYLEN=(6*IDEA::ROUNDS+4); // key schedule length in # of word16s + +#define low16(x) ((x)&0xffff) // compiler should be able to optimize this away if word is 16 bits +#define high16(x) ((x)>>16) + +CRYPTOPP_COMPILE_ASSERT(sizeof(IDEA::Word) >= 2); + +// should use an inline function but macros are still faster in MSVC 4.0 +#define DirectMUL(a,b) \ +{ \ + assert(b <= 0xffff); \ + \ + word32 p=(word32)low16(a)*b; \ + \ + if (p) \ + { \ + p = low16(p) - high16(p); \ + a = (IDEA::Word)p - (IDEA::Word)high16(p); \ + } \ + else \ + a = 1-a-b; \ +} + +#ifdef IDEA_LARGECACHE +bool IDEA::Base::tablesBuilt = false; +word16 IDEA::Base::log[0x10000]; +word16 IDEA::Base::antilog[0x10000]; + +void IDEA::Base::BuildLogTables() +{ + if (tablesBuilt) + return; + else + { + tablesBuilt = true; + + IDEA::Word x=1; + word32 i; + + for (i=0; i<0x10000; i++) + { + antilog[i] = (word16)x; + DirectMUL(x, 3); + } + + for (i=0; i<0x10000; i++) + log[antilog[i]] = (word16)i; + } +} + +void IDEA::Base::LookupKeyLogs() +{ + IDEA::Word* Z=key; + int r=ROUNDS; + do + { + Z[0] = log[Z[0]]; + Z[3] = log[Z[3]]; + Z[4] = log[Z[4]]; + Z[5] = log[Z[5]]; + Z+=6; + } while (--r); + Z[0] = log[Z[0]]; + Z[3] = log[Z[3]]; +} + +inline void IDEA::Base::LookupMUL(IDEA::Word &a, IDEA::Word b) +{ + a = antilog[low16(log[low16(a)]+b)]; +} +#endif // IDEA_LARGECACHE + +void IDEA::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &) +{ + AssertValidKeyLength(length); + +#ifdef IDEA_LARGECACHE + BuildLogTables(); +#endif + + EnKey(userKey); + + if (!IsForwardTransformation()) + DeKey(); + +#ifdef IDEA_LARGECACHE + LookupKeyLogs(); +#endif +} + +void IDEA::Base::EnKey (const byte *userKey) +{ + unsigned int i; + + for (i=0; i<8; i++) + m_key[i] = ((IDEA::Word)userKey[2*i]<<8) | userKey[2*i+1]; + + for (; i> 7)); + } +} + +static IDEA::Word MulInv(IDEA::Word x) +{ + IDEA::Word y=x; + for (unsigned i=0; i<15; i++) + { + DirectMUL(y,low16(y)); + DirectMUL(y,x); + } + return low16(y); +} + +static inline IDEA::Word AddInv(IDEA::Word x) +{ + return low16(0-x); +} + +void IDEA::Base::DeKey() +{ + FixedSizeSecBlock tempkey; + unsigned int i; + + for (i=0; i0)]); + tempkey[i*6+2] = AddInv(m_key[(ROUNDS-i)*6+2-(i>0)]); + tempkey[i*6+3] = MulInv(m_key[(ROUNDS-i)*6+3]); + tempkey[i*6+4] = m_key[(ROUNDS-1-i)*6+4]; + tempkey[i*6+5] = m_key[(ROUNDS-1-i)*6+5]; + } + + tempkey[i*6+0] = MulInv(m_key[(ROUNDS-i)*6+0]); + tempkey[i*6+1] = AddInv(m_key[(ROUNDS-i)*6+1]); + tempkey[i*6+2] = AddInv(m_key[(ROUNDS-i)*6+2]); + tempkey[i*6+3] = MulInv(m_key[(ROUNDS-i)*6+3]); + + m_key = tempkey; +} + +#ifdef IDEA_LARGECACHE +#define MUL(a,b) LookupMUL(a,b) +#else +#define MUL(a,b) DirectMUL(a,b) +#endif + +void IDEA::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + typedef BlockGetAndPut Block; + + const IDEA::Word *key = m_key; + IDEA::Word x0,x1,x2,x3,t0,t1; + Block::Get(inBlock)(x0)(x1)(x2)(x3); + + for (unsigned int i=0; i, public FixedKeyLength<16>, public FixedRounds<8> +{ + static const char *StaticAlgorithmName() {return "IDEA";} +}; + +/// IDEA +class IDEA : public IDEA_Info, public BlockCipherDocumentation +{ +public: // made public for internal purposes +#ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + typedef word Word; +#else + typedef hword Word; +#endif + +private: + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + unsigned int OptimalDataAlignment() const {return 2;} + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + private: + void EnKey(const byte *); + void DeKey(); + FixedSizeSecBlock m_key; + + #ifdef IDEA_LARGECACHE + static inline void LookupMUL(word &a, word b); + void LookupKeyLogs(); + static void BuildLogTables(); + static bool tablesBuilt; + static word16 log[0x10000], antilog[0x10000]; + #endif + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef IDEA::Encryption IDEAEncryption; +typedef IDEA::Decryption IDEADecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/integer.cpp b/cryptopp/integer.cpp new file mode 100644 index 0000000..9adb745 --- /dev/null +++ b/cryptopp/integer.cpp @@ -0,0 +1,4245 @@ +// integer.cpp - written and placed in the public domain by Wei Dai +// contains public domain code contributed by Alister Lee and Leonard Janke + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "integer.h" +#include "modarith.h" +#include "nbtheory.h" +#include "asn.h" +#include "oids.h" +#include "words.h" +#include "algparam.h" +#include "pubkey.h" // for P1363_KDF2 +#include "sha.h" +#include "cpu.h" + +#include + +#if _MSC_VER >= 1400 + #include +#endif + +#ifdef __DECCXX + #include +#endif + +#ifdef CRYPTOPP_MSVC6_NO_PP + #pragma message("You do not seem to have the Visual C++ Processor Pack installed, so use of SSE2 instructions will be disabled.") +#endif + +#define CRYPTOPP_INTEGER_SSE2 (CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86) + +NAMESPACE_BEGIN(CryptoPP) + +bool AssignIntToInteger(const std::type_info &valueType, void *pInteger, const void *pInt) +{ + if (valueType != typeid(Integer)) + return false; + *reinterpret_cast(pInteger) = *reinterpret_cast(pInt); + return true; +} + +inline static int Compare(const word *A, const word *B, size_t N) +{ + while (N--) + if (A[N] > B[N]) + return 1; + else if (A[N] < B[N]) + return -1; + + return 0; +} + +inline static int Increment(word *A, size_t N, word B=1) +{ + assert(N); + word t = A[0]; + A[0] = t+B; + if (A[0] >= t) + return 0; + for (unsigned i=1; i>(WORD_BITS-1)); d##0 = 2*d##0 + (c>>(WORD_BITS-1)); c *= 2; + #endif + #ifndef Acc2WordsBy2 + #define Acc2WordsBy2(a, b) a##0 += b##0; a##1 += a##0 < b##0; a##1 += b##1; + #endif + #define AddWithCarry(u, a, b) {word t = a+b; u##0 = t + u##1; u##1 = (ta) + (u##0>t);} + #define GetCarry(u) u##1 + #define GetBorrow(u) u##1 +#else + #define Declare2Words(x) dword x; + #if _MSC_VER >= 1400 && !defined(__INTEL_COMPILER) + #define MultiplyWords(p, a, b) p = __emulu(a, b); + #else + #define MultiplyWords(p, a, b) p = (dword)a*b; + #endif + #define AssignWord(a, b) a = b; + #define Add2WordsBy1(a, b, c) a = b + c; + #define Acc2WordsBy2(a, b) a += b; + #define LowWord(a) word(a) + #define HighWord(a) word(a>>WORD_BITS) + #define Double3Words(c, d) d = 2*d + (c>>(WORD_BITS-1)); c *= 2; + #define AddWithCarry(u, a, b) u = dword(a) + b + GetCarry(u); + #define SubtractWithBorrow(u, a, b) u = dword(a) - b - GetBorrow(u); + #define GetCarry(u) HighWord(u) + #define GetBorrow(u) word(u>>(WORD_BITS*2-1)) +#endif +#ifndef MulAcc + #define MulAcc(c, d, a, b) MultiplyWords(p, a, b); Acc2WordsBy1(p, c); c = LowWord(p); Acc2WordsBy1(d, HighWord(p)); +#endif +#ifndef Acc2WordsBy1 + #define Acc2WordsBy1(a, b) Add2WordsBy1(a, a, b) +#endif +#ifndef Acc3WordsBy2 + #define Acc3WordsBy2(c, d, e) Acc2WordsBy1(e, c); c = LowWord(e); Add2WordsBy1(e, d, HighWord(e)); +#endif + +class DWord +{ +public: + DWord() {} + +#ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + explicit DWord(word low) + { + m_whole = low; + } +#else + explicit DWord(word low) + { + m_halfs.low = low; + m_halfs.high = 0; + } +#endif + + DWord(word low, word high) + { + m_halfs.low = low; + m_halfs.high = high; + } + + static DWord Multiply(word a, word b) + { + DWord r; + #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + r.m_whole = (dword)a * b; + #elif defined(MultiplyWordsLoHi) + MultiplyWordsLoHi(r.m_halfs.low, r.m_halfs.high, a, b); + #endif + return r; + } + + static DWord MultiplyAndAdd(word a, word b, word c) + { + DWord r = Multiply(a, b); + return r += c; + } + + DWord & operator+=(word a) + { + #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + m_whole = m_whole + a; + #else + m_halfs.low += a; + m_halfs.high += (m_halfs.low < a); + #endif + return *this; + } + + DWord operator+(word a) + { + DWord r; + #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + r.m_whole = m_whole + a; + #else + r.m_halfs.low = m_halfs.low + a; + r.m_halfs.high = m_halfs.high + (r.m_halfs.low < a); + #endif + return r; + } + + DWord operator-(DWord a) + { + DWord r; + #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + r.m_whole = m_whole - a.m_whole; + #else + r.m_halfs.low = m_halfs.low - a.m_halfs.low; + r.m_halfs.high = m_halfs.high - a.m_halfs.high - (r.m_halfs.low > m_halfs.low); + #endif + return r; + } + + DWord operator-(word a) + { + DWord r; + #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + r.m_whole = m_whole - a; + #else + r.m_halfs.low = m_halfs.low - a; + r.m_halfs.high = m_halfs.high - (r.m_halfs.low > m_halfs.low); + #endif + return r; + } + + // returns quotient, which must fit in a word + word operator/(word divisor); + + word operator%(word a); + + bool operator!() const + { + #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + return !m_whole; + #else + return !m_halfs.high && !m_halfs.low; + #endif + } + + word GetLowHalf() const {return m_halfs.low;} + word GetHighHalf() const {return m_halfs.high;} + word GetHighHalfAsBorrow() const {return 0-m_halfs.high;} + +private: + union + { + #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + dword m_whole; + #endif + struct + { + #ifdef IS_LITTLE_ENDIAN + word low; + word high; + #else + word high; + word low; + #endif + } m_halfs; + }; +}; + +class Word +{ +public: + Word() {} + + Word(word value) + { + m_whole = value; + } + + Word(hword low, hword high) + { + m_whole = low | (word(high) << (WORD_BITS/2)); + } + + static Word Multiply(hword a, hword b) + { + Word r; + r.m_whole = (word)a * b; + return r; + } + + Word operator-(Word a) + { + Word r; + r.m_whole = m_whole - a.m_whole; + return r; + } + + Word operator-(hword a) + { + Word r; + r.m_whole = m_whole - a; + return r; + } + + // returns quotient, which must fit in a word + hword operator/(hword divisor) + { + return hword(m_whole / divisor); + } + + bool operator!() const + { + return !m_whole; + } + + word GetWhole() const {return m_whole;} + hword GetLowHalf() const {return hword(m_whole);} + hword GetHighHalf() const {return hword(m_whole>>(WORD_BITS/2));} + hword GetHighHalfAsBorrow() const {return 0-hword(m_whole>>(WORD_BITS/2));} + +private: + word m_whole; +}; + +// do a 3 word by 2 word divide, returns quotient and leaves remainder in A +template +S DivideThreeWordsByTwo(S *A, S B0, S B1, D *dummy=NULL) +{ + // assert {A[2],A[1]} < {B1,B0}, so quotient can fit in a S + assert(A[2] < B1 || (A[2]==B1 && A[1] < B0)); + + // estimate the quotient: do a 2 S by 1 S divide + S Q; + if (S(B1+1) == 0) + Q = A[2]; + else + Q = D(A[1], A[2]) / S(B1+1); + + // now subtract Q*B from A + D p = D::Multiply(B0, Q); + D u = (D) A[0] - p.GetLowHalf(); + A[0] = u.GetLowHalf(); + u = (D) A[1] - p.GetHighHalf() - u.GetHighHalfAsBorrow() - D::Multiply(B1, Q); + A[1] = u.GetLowHalf(); + A[2] += u.GetHighHalf(); + + // Q <= actual quotient, so fix it + while (A[2] || A[1] > B1 || (A[1]==B1 && A[0]>=B0)) + { + u = (D) A[0] - B0; + A[0] = u.GetLowHalf(); + u = (D) A[1] - B1 - u.GetHighHalfAsBorrow(); + A[1] = u.GetLowHalf(); + A[2] += u.GetHighHalf(); + Q++; + assert(Q); // shouldn't overflow + } + + return Q; +} + +// do a 4 word by 2 word divide, returns 2 word quotient in Q0 and Q1 +template +inline D DivideFourWordsByTwo(S *T, const D &Al, const D &Ah, const D &B) +{ + if (!B) // if divisor is 0, we assume divisor==2**(2*WORD_BITS) + return D(Ah.GetLowHalf(), Ah.GetHighHalf()); + else + { + S Q[2]; + T[0] = Al.GetLowHalf(); + T[1] = Al.GetHighHalf(); + T[2] = Ah.GetLowHalf(); + T[3] = Ah.GetHighHalf(); + Q[1] = DivideThreeWordsByTwo(T+1, B.GetLowHalf(), B.GetHighHalf()); + Q[0] = DivideThreeWordsByTwo(T, B.GetLowHalf(), B.GetHighHalf()); + return D(Q[0], Q[1]); + } +} + +// returns quotient, which must fit in a word +inline word DWord::operator/(word a) +{ + #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + return word(m_whole / a); + #else + hword r[4]; + return DivideFourWordsByTwo(r, m_halfs.low, m_halfs.high, a).GetWhole(); + #endif +} + +inline word DWord::operator%(word a) +{ + #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + return word(m_whole % a); + #else + if (a < (word(1) << (WORD_BITS/2))) + { + hword h = hword(a); + word r = m_halfs.high % h; + r = ((m_halfs.low >> (WORD_BITS/2)) + (r << (WORD_BITS/2))) % h; + return hword((hword(m_halfs.low) + (r << (WORD_BITS/2))) % h); + } + else + { + hword r[4]; + DivideFourWordsByTwo(r, m_halfs.low, m_halfs.high, a); + return Word(r[0], r[1]).GetWhole(); + } + #endif +} + +// ******************************************************** + +// use some tricks to share assembly code between MSVC and GCC +#if defined(__GNUC__) + #define AddPrologue \ + int result; \ + __asm__ __volatile__ \ + ( \ + ".intel_syntax noprefix;" + #define AddEpilogue \ + ".att_syntax prefix;" \ + : "=a" (result)\ + : "d" (C), "a" (A), "D" (B), "c" (N) \ + : "%esi", "memory", "cc" \ + );\ + return result; + #define MulPrologue \ + __asm__ __volatile__ \ + ( \ + ".intel_syntax noprefix;" \ + AS1( push ebx) \ + AS2( mov ebx, edx) + #define MulEpilogue \ + AS1( pop ebx) \ + ".att_syntax prefix;" \ + : \ + : "d" (s_maskLow16), "c" (C), "a" (A), "D" (B) \ + : "%esi", "memory", "cc" \ + ); + #define SquPrologue MulPrologue + #define SquEpilogue \ + AS1( pop ebx) \ + ".att_syntax prefix;" \ + : \ + : "d" (s_maskLow16), "c" (C), "a" (A) \ + : "%esi", "%edi", "memory", "cc" \ + ); + #define TopPrologue MulPrologue + #define TopEpilogue \ + AS1( pop ebx) \ + ".att_syntax prefix;" \ + : \ + : "d" (s_maskLow16), "c" (C), "a" (A), "D" (B), "S" (L) \ + : "memory", "cc" \ + ); +#else + #define AddPrologue \ + __asm push edi \ + __asm push esi \ + __asm mov eax, [esp+12] \ + __asm mov edi, [esp+16] + #define AddEpilogue \ + __asm pop esi \ + __asm pop edi \ + __asm ret 8 +#if _MSC_VER < 1300 + #define SaveEBX __asm push ebx + #define RestoreEBX __asm pop ebx +#else + #define SaveEBX + #define RestoreEBX +#endif + #define SquPrologue \ + AS2( mov eax, A) \ + AS2( mov ecx, C) \ + SaveEBX \ + AS2( lea ebx, s_maskLow16) + #define MulPrologue \ + AS2( mov eax, A) \ + AS2( mov edi, B) \ + AS2( mov ecx, C) \ + SaveEBX \ + AS2( lea ebx, s_maskLow16) + #define TopPrologue \ + AS2( mov eax, A) \ + AS2( mov edi, B) \ + AS2( mov ecx, C) \ + AS2( mov esi, L) \ + SaveEBX \ + AS2( lea ebx, s_maskLow16) + #define SquEpilogue RestoreEBX + #define MulEpilogue RestoreEBX + #define TopEpilogue RestoreEBX +#endif + +#ifdef CRYPTOPP_X64_MASM_AVAILABLE +extern "C" { +int Baseline_Add(size_t N, word *C, const word *A, const word *B); +int Baseline_Sub(size_t N, word *C, const word *A, const word *B); +} +#elif defined(CRYPTOPP_X64_ASM_AVAILABLE) && defined(__GNUC__) && defined(CRYPTOPP_WORD128_AVAILABLE) +int Baseline_Add(size_t N, word *C, const word *A, const word *B) +{ + word result; + __asm__ __volatile__ + ( + ".intel_syntax;" + AS1( neg %1) + ASJ( jz, 1, f) + AS2( mov %0,[%3+8*%1]) + AS2( add %0,[%4+8*%1]) + AS2( mov [%2+8*%1],%0) + ASL(0) + AS2( mov %0,[%3+8*%1+8]) + AS2( adc %0,[%4+8*%1+8]) + AS2( mov [%2+8*%1+8],%0) + AS2( lea %1,[%1+2]) + ASJ( jrcxz, 1, f) + AS2( mov %0,[%3+8*%1]) + AS2( adc %0,[%4+8*%1]) + AS2( mov [%2+8*%1],%0) + ASJ( jmp, 0, b) + ASL(1) + AS2( mov %0, 0) + AS2( adc %0, %0) + ".att_syntax;" + : "=&r" (result), "+c" (N) + : "r" (C+N), "r" (A+N), "r" (B+N) + : "memory", "cc" + ); + return (int)result; +} + +int Baseline_Sub(size_t N, word *C, const word *A, const word *B) +{ + word result; + __asm__ __volatile__ + ( + ".intel_syntax;" + AS1( neg %1) + ASJ( jz, 1, f) + AS2( mov %0,[%3+8*%1]) + AS2( sub %0,[%4+8*%1]) + AS2( mov [%2+8*%1],%0) + ASL(0) + AS2( mov %0,[%3+8*%1+8]) + AS2( sbb %0,[%4+8*%1+8]) + AS2( mov [%2+8*%1+8],%0) + AS2( lea %1,[%1+2]) + ASJ( jrcxz, 1, f) + AS2( mov %0,[%3+8*%1]) + AS2( sbb %0,[%4+8*%1]) + AS2( mov [%2+8*%1],%0) + ASJ( jmp, 0, b) + ASL(1) + AS2( mov %0, 0) + AS2( adc %0, %0) + ".att_syntax;" + : "=&r" (result), "+c" (N) + : "r" (C+N), "r" (A+N), "r" (B+N) + : "memory", "cc" + ); + return (int)result; +} +#elif defined(CRYPTOPP_X86_ASM_AVAILABLE) && CRYPTOPP_BOOL_X86 +CRYPTOPP_NAKED int CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word *A, const word *B) +{ + AddPrologue + + // now: eax = A, edi = B, edx = C, ecx = N + AS2( lea eax, [eax+4*ecx]) + AS2( lea edi, [edi+4*ecx]) + AS2( lea edx, [edx+4*ecx]) + + AS1( neg ecx) // ecx is negative index + AS2( test ecx, 2) // this clears carry flag + ASJ( jz, 0, f) + AS2( sub ecx, 2) + ASJ( jmp, 1, f) + + ASL(0) + ASJ( jecxz, 2, f) // loop until ecx overflows and becomes zero + AS2( mov esi,[eax+4*ecx]) + AS2( adc esi,[edi+4*ecx]) + AS2( mov [edx+4*ecx],esi) + AS2( mov esi,[eax+4*ecx+4]) + AS2( adc esi,[edi+4*ecx+4]) + AS2( mov [edx+4*ecx+4],esi) + ASL(1) + AS2( mov esi,[eax+4*ecx+8]) + AS2( adc esi,[edi+4*ecx+8]) + AS2( mov [edx+4*ecx+8],esi) + AS2( mov esi,[eax+4*ecx+12]) + AS2( adc esi,[edi+4*ecx+12]) + AS2( mov [edx+4*ecx+12],esi) + + AS2( lea ecx,[ecx+4]) // advance index, avoid inc which causes slowdown on Intel Core 2 + ASJ( jmp, 0, b) + + ASL(2) + AS2( mov eax, 0) + AS1( setc al) // store carry into eax (return result register) + + AddEpilogue +} + +CRYPTOPP_NAKED int CRYPTOPP_FASTCALL Baseline_Sub(size_t N, word *C, const word *A, const word *B) +{ + AddPrologue + + // now: eax = A, edi = B, edx = C, ecx = N + AS2( lea eax, [eax+4*ecx]) + AS2( lea edi, [edi+4*ecx]) + AS2( lea edx, [edx+4*ecx]) + + AS1( neg ecx) // ecx is negative index + AS2( test ecx, 2) // this clears carry flag + ASJ( jz, 0, f) + AS2( sub ecx, 2) + ASJ( jmp, 1, f) + + ASL(0) + ASJ( jecxz, 2, f) // loop until ecx overflows and becomes zero + AS2( mov esi,[eax+4*ecx]) + AS2( sbb esi,[edi+4*ecx]) + AS2( mov [edx+4*ecx],esi) + AS2( mov esi,[eax+4*ecx+4]) + AS2( sbb esi,[edi+4*ecx+4]) + AS2( mov [edx+4*ecx+4],esi) + ASL(1) + AS2( mov esi,[eax+4*ecx+8]) + AS2( sbb esi,[edi+4*ecx+8]) + AS2( mov [edx+4*ecx+8],esi) + AS2( mov esi,[eax+4*ecx+12]) + AS2( sbb esi,[edi+4*ecx+12]) + AS2( mov [edx+4*ecx+12],esi) + + AS2( lea ecx,[ecx+4]) // advance index, avoid inc which causes slowdown on Intel Core 2 + ASJ( jmp, 0, b) + + ASL(2) + AS2( mov eax, 0) + AS1( setc al) // store carry into eax (return result register) + + AddEpilogue +} + +#if CRYPTOPP_INTEGER_SSE2 +CRYPTOPP_NAKED int CRYPTOPP_FASTCALL SSE2_Add(size_t N, word *C, const word *A, const word *B) +{ + AddPrologue + + // now: eax = A, edi = B, edx = C, ecx = N + AS2( lea eax, [eax+4*ecx]) + AS2( lea edi, [edi+4*ecx]) + AS2( lea edx, [edx+4*ecx]) + + AS1( neg ecx) // ecx is negative index + AS2( pxor mm2, mm2) + ASJ( jz, 2, f) + AS2( test ecx, 2) // this clears carry flag + ASJ( jz, 0, f) + AS2( sub ecx, 2) + ASJ( jmp, 1, f) + + ASL(0) + AS2( movd mm0, DWORD PTR [eax+4*ecx]) + AS2( movd mm1, DWORD PTR [edi+4*ecx]) + AS2( paddq mm0, mm1) + AS2( paddq mm2, mm0) + AS2( movd DWORD PTR [edx+4*ecx], mm2) + AS2( psrlq mm2, 32) + + AS2( movd mm0, DWORD PTR [eax+4*ecx+4]) + AS2( movd mm1, DWORD PTR [edi+4*ecx+4]) + AS2( paddq mm0, mm1) + AS2( paddq mm2, mm0) + AS2( movd DWORD PTR [edx+4*ecx+4], mm2) + AS2( psrlq mm2, 32) + + ASL(1) + AS2( movd mm0, DWORD PTR [eax+4*ecx+8]) + AS2( movd mm1, DWORD PTR [edi+4*ecx+8]) + AS2( paddq mm0, mm1) + AS2( paddq mm2, mm0) + AS2( movd DWORD PTR [edx+4*ecx+8], mm2) + AS2( psrlq mm2, 32) + + AS2( movd mm0, DWORD PTR [eax+4*ecx+12]) + AS2( movd mm1, DWORD PTR [edi+4*ecx+12]) + AS2( paddq mm0, mm1) + AS2( paddq mm2, mm0) + AS2( movd DWORD PTR [edx+4*ecx+12], mm2) + AS2( psrlq mm2, 32) + + AS2( add ecx, 4) + ASJ( jnz, 0, b) + + ASL(2) + AS2( movd eax, mm2) + AS1( emms) + + AddEpilogue +} +CRYPTOPP_NAKED int CRYPTOPP_FASTCALL SSE2_Sub(size_t N, word *C, const word *A, const word *B) +{ + AddPrologue + + // now: eax = A, edi = B, edx = C, ecx = N + AS2( lea eax, [eax+4*ecx]) + AS2( lea edi, [edi+4*ecx]) + AS2( lea edx, [edx+4*ecx]) + + AS1( neg ecx) // ecx is negative index + AS2( pxor mm2, mm2) + ASJ( jz, 2, f) + AS2( test ecx, 2) // this clears carry flag + ASJ( jz, 0, f) + AS2( sub ecx, 2) + ASJ( jmp, 1, f) + + ASL(0) + AS2( movd mm0, DWORD PTR [eax+4*ecx]) + AS2( movd mm1, DWORD PTR [edi+4*ecx]) + AS2( psubq mm0, mm1) + AS2( psubq mm0, mm2) + AS2( movd DWORD PTR [edx+4*ecx], mm0) + AS2( psrlq mm0, 63) + + AS2( movd mm2, DWORD PTR [eax+4*ecx+4]) + AS2( movd mm1, DWORD PTR [edi+4*ecx+4]) + AS2( psubq mm2, mm1) + AS2( psubq mm2, mm0) + AS2( movd DWORD PTR [edx+4*ecx+4], mm2) + AS2( psrlq mm2, 63) + + ASL(1) + AS2( movd mm0, DWORD PTR [eax+4*ecx+8]) + AS2( movd mm1, DWORD PTR [edi+4*ecx+8]) + AS2( psubq mm0, mm1) + AS2( psubq mm0, mm2) + AS2( movd DWORD PTR [edx+4*ecx+8], mm0) + AS2( psrlq mm0, 63) + + AS2( movd mm2, DWORD PTR [eax+4*ecx+12]) + AS2( movd mm1, DWORD PTR [edi+4*ecx+12]) + AS2( psubq mm2, mm1) + AS2( psubq mm2, mm0) + AS2( movd DWORD PTR [edx+4*ecx+12], mm2) + AS2( psrlq mm2, 63) + + AS2( add ecx, 4) + ASJ( jnz, 0, b) + + ASL(2) + AS2( movd eax, mm2) + AS1( emms) + + AddEpilogue +} +#endif // #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +#else +int CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word *A, const word *B) +{ + assert (N%2 == 0); + + Declare2Words(u); + AssignWord(u, 0); + for (size_t i=0; i=2 && N%2==0); + + if (N <= s_recursionLimit) + s_pMul[N/4](R, A, B); + else + { + const size_t N2 = N/2; + + size_t AN2 = Compare(A0, A1, N2) > 0 ? 0 : N2; + Subtract(R0, A + AN2, A + (N2 ^ AN2), N2); + + size_t BN2 = Compare(B0, B1, N2) > 0 ? 0 : N2; + Subtract(R1, B + BN2, B + (N2 ^ BN2), N2); + + RecursiveMultiply(R2, T2, A1, B1, N2); + RecursiveMultiply(T0, T2, R0, R1, N2); + RecursiveMultiply(R0, T2, A0, B0, N2); + + // now T[01] holds (A1-A0)*(B0-B1), R[01] holds A0*B0, R[23] holds A1*B1 + + int c2 = Add(R2, R2, R1, N2); + int c3 = c2; + c2 += Add(R1, R2, R0, N2); + c3 += Add(R2, R2, R3, N2); + + if (AN2 == BN2) + c3 -= Subtract(R1, R1, T0, N); + else + c3 += Add(R1, R1, T0, N); + + c3 += Increment(R2, N2, c2); + assert (c3 >= 0 && c3 <= 2); + Increment(R3, N2, c3); + } +} + +// R[2*N] - result = A*A +// T[2*N] - temporary work space +// A[N] --- number to be squared + +void RecursiveSquare(word *R, word *T, const word *A, size_t N) +{ + assert(N && N%2==0); + + if (N <= s_recursionLimit) + s_pSqu[N/4](R, A); + else + { + const size_t N2 = N/2; + + RecursiveSquare(R0, T2, A0, N2); + RecursiveSquare(R2, T2, A1, N2); + RecursiveMultiply(T0, T2, A0, A1, N2); + + int carry = Add(R1, R1, T0, N); + carry += Add(R1, R1, T0, N); + Increment(R3, N2, carry); + } +} + +// R[N] - bottom half of A*B +// T[3*N/2] - temporary work space +// A[N] - multiplier +// B[N] - multiplicant + +void RecursiveMultiplyBottom(word *R, word *T, const word *A, const word *B, size_t N) +{ + assert(N>=2 && N%2==0); + + if (N <= s_recursionLimit) + s_pBot[N/4](R, A, B); + else + { + const size_t N2 = N/2; + + RecursiveMultiply(R, T, A0, B0, N2); + RecursiveMultiplyBottom(T0, T1, A1, B0, N2); + Add(R1, R1, T0, N2); + RecursiveMultiplyBottom(T0, T1, A0, B1, N2); + Add(R1, R1, T0, N2); + } +} + +// R[N] --- upper half of A*B +// T[2*N] - temporary work space +// L[N] --- lower half of A*B +// A[N] --- multiplier +// B[N] --- multiplicant + +void MultiplyTop(word *R, word *T, const word *L, const word *A, const word *B, size_t N) +{ + assert(N>=2 && N%2==0); + + if (N <= s_recursionLimit) + s_pTop[N/4](R, A, B, L[N-1]); + else + { + const size_t N2 = N/2; + + size_t AN2 = Compare(A0, A1, N2) > 0 ? 0 : N2; + Subtract(R0, A + AN2, A + (N2 ^ AN2), N2); + + size_t BN2 = Compare(B0, B1, N2) > 0 ? 0 : N2; + Subtract(R1, B + BN2, B + (N2 ^ BN2), N2); + + RecursiveMultiply(T0, T2, R0, R1, N2); + RecursiveMultiply(R0, T2, A1, B1, N2); + + // now T[01] holds (A1-A0)*(B0-B1) = A1*B0+A0*B1-A1*B1-A0*B0, R[01] holds A1*B1 + + int t, c3; + int c2 = Subtract(T2, L+N2, L, N2); + + if (AN2 == BN2) + { + c2 -= Add(T2, T2, T0, N2); + t = (Compare(T2, R0, N2) == -1); + c3 = t - Subtract(T2, T2, T1, N2); + } + else + { + c2 += Subtract(T2, T2, T0, N2); + t = (Compare(T2, R0, N2) == -1); + c3 = t + Add(T2, T2, T1, N2); + } + + c2 += t; + if (c2 >= 0) + c3 += Increment(T2, N2, c2); + else + c3 -= Decrement(T2, N2, -c2); + c3 += Add(R0, T2, R1, N2); + + assert (c3 >= 0 && c3 <= 2); + Increment(R1, N2, c3); + } +} + +inline void Multiply(word *R, word *T, const word *A, const word *B, size_t N) +{ + RecursiveMultiply(R, T, A, B, N); +} + +inline void Square(word *R, word *T, const word *A, size_t N) +{ + RecursiveSquare(R, T, A, N); +} + +inline void MultiplyBottom(word *R, word *T, const word *A, const word *B, size_t N) +{ + RecursiveMultiplyBottom(R, T, A, B, N); +} + +// R[NA+NB] - result = A*B +// T[NA+NB] - temporary work space +// A[NA] ---- multiplier +// B[NB] ---- multiplicant + +void AsymmetricMultiply(word *R, word *T, const word *A, size_t NA, const word *B, size_t NB) +{ + if (NA == NB) + { + if (A == B) + Square(R, T, A, NA); + else + Multiply(R, T, A, B, NA); + + return; + } + + if (NA > NB) + { + std::swap(A, B); + std::swap(NA, NB); + } + + assert(NB % NA == 0); + + if (NA==2 && !A[1]) + { + switch (A[0]) + { + case 0: + SetWords(R, 0, NB+2); + return; + case 1: + CopyWords(R, B, NB); + R[NB] = R[NB+1] = 0; + return; + default: + R[NB] = LinearMultiply(R, B, A[0], NB); + R[NB+1] = 0; + return; + } + } + + size_t i; + if ((NB/NA)%2 == 0) + { + Multiply(R, T, A, B, NA); + CopyWords(T+2*NA, R+NA, NA); + + for (i=2*NA; i=4); + +#define M0 M +#define M1 (M+N2) +#define V0 V +#define V1 (V+N2) + +#define X0 X +#define X1 (X+N2) +#define X2 (X+N) +#define X3 (X+N+N2) + + const size_t N2 = N/2; + Multiply(T0, T2, V0, X3, N2); + int c2 = Add(T0, T0, X0, N); + MultiplyBottom(T3, T2, T0, U, N2); + MultiplyTop(T2, R, T0, T3, M0, N2); + c2 -= Subtract(T2, T1, T2, N2); + Multiply(T0, R, T3, M1, N2); + c2 -= Subtract(T0, T2, T0, N2); + int c3 = -(int)Subtract(T1, X2, T1, N2); + Multiply(R0, T2, V1, X3, N2); + c3 += Add(R, R, T, N); + + if (c2>0) + c3 += Increment(R1, N2); + else if (c2<0) + c3 -= Decrement(R1, N2, -c2); + + assert(c3>=-1 && c3<=1); + if (c3>0) + Subtract(R, R, M, N); + else if (c3<0) + Add(R, R, M, N); + +#undef M0 +#undef M1 +#undef V0 +#undef V1 + +#undef X0 +#undef X1 +#undef X2 +#undef X3 +} + +#undef A0 +#undef A1 +#undef B0 +#undef B1 + +#undef T0 +#undef T1 +#undef T2 +#undef T3 + +#undef R0 +#undef R1 +#undef R2 +#undef R3 + +/* +// do a 3 word by 2 word divide, returns quotient and leaves remainder in A +static word SubatomicDivide(word *A, word B0, word B1) +{ + // assert {A[2],A[1]} < {B1,B0}, so quotient can fit in a word + assert(A[2] < B1 || (A[2]==B1 && A[1] < B0)); + + // estimate the quotient: do a 2 word by 1 word divide + word Q; + if (B1+1 == 0) + Q = A[2]; + else + Q = DWord(A[1], A[2]).DividedBy(B1+1); + + // now subtract Q*B from A + DWord p = DWord::Multiply(B0, Q); + DWord u = (DWord) A[0] - p.GetLowHalf(); + A[0] = u.GetLowHalf(); + u = (DWord) A[1] - p.GetHighHalf() - u.GetHighHalfAsBorrow() - DWord::Multiply(B1, Q); + A[1] = u.GetLowHalf(); + A[2] += u.GetHighHalf(); + + // Q <= actual quotient, so fix it + while (A[2] || A[1] > B1 || (A[1]==B1 && A[0]>=B0)) + { + u = (DWord) A[0] - B0; + A[0] = u.GetLowHalf(); + u = (DWord) A[1] - B1 - u.GetHighHalfAsBorrow(); + A[1] = u.GetLowHalf(); + A[2] += u.GetHighHalf(); + Q++; + assert(Q); // shouldn't overflow + } + + return Q; +} + +// do a 4 word by 2 word divide, returns 2 word quotient in Q0 and Q1 +static inline void AtomicDivide(word *Q, const word *A, const word *B) +{ + if (!B[0] && !B[1]) // if divisor is 0, we assume divisor==2**(2*WORD_BITS) + { + Q[0] = A[2]; + Q[1] = A[3]; + } + else + { + word T[4]; + T[0] = A[0]; T[1] = A[1]; T[2] = A[2]; T[3] = A[3]; + Q[1] = SubatomicDivide(T+1, B[0], B[1]); + Q[0] = SubatomicDivide(T, B[0], B[1]); + +#ifndef NDEBUG + // multiply quotient and divisor and add remainder, make sure it equals dividend + assert(!T[2] && !T[3] && (T[1] < B[1] || (T[1]==B[1] && T[0](T, DWord(A[0], A[1]), DWord(A[2], A[3]), DWord(B[0], B[1])); + Q[0] = q.GetLowHalf(); + Q[1] = q.GetHighHalf(); + +#ifndef NDEBUG + if (B[0] || B[1]) + { + // multiply quotient and divisor and add remainder, make sure it equals dividend + assert(!T[2] && !T[3] && (T[1] < B[1] || (T[1]==B[1] && T[0]= 0) + { + R[N] -= Subtract(R, R, B, N); + Q[1] += (++Q[0]==0); + assert(Q[0] || Q[1]); // no overflow + } +} + +// R[NB] -------- remainder = A%B +// Q[NA-NB+2] --- quotient = A/B +// T[NA+3*(NB+2)] - temp work space +// A[NA] -------- dividend +// B[NB] -------- divisor + +void Divide(word *R, word *Q, word *T, const word *A, size_t NA, const word *B, size_t NB) +{ + assert(NA && NB && NA%2==0 && NB%2==0); + assert(B[NB-1] || B[NB-2]); + assert(NB <= NA); + + // set up temporary work space + word *const TA=T; + word *const TB=T+NA+2; + word *const TP=T+NA+2+NB; + + // copy B into TB and normalize it so that TB has highest bit set to 1 + unsigned shiftWords = (B[NB-1]==0); + TB[0] = TB[NB-1] = 0; + CopyWords(TB+shiftWords, B, NB-shiftWords); + unsigned shiftBits = WORD_BITS - BitPrecision(TB[NB-1]); + assert(shiftBits < WORD_BITS); + ShiftWordsLeftByBits(TB, NB, shiftBits); + + // copy A into TA and normalize it + TA[0] = TA[NA] = TA[NA+1] = 0; + CopyWords(TA+shiftWords, A, NA); + ShiftWordsLeftByBits(TA, NA+2, shiftBits); + + if (TA[NA+1]==0 && TA[NA] <= 1) + { + Q[NA-NB+1] = Q[NA-NB] = 0; + while (TA[NA] || Compare(TA+NA-NB, TB, NB) >= 0) + { + TA[NA] -= Subtract(TA+NA-NB, TA+NA-NB, TB, NB); + ++Q[NA-NB]; + } + } + else + { + NA+=2; + assert(Compare(TA+NA-NB, TB, NB) < 0); + } + + word BT[2]; + BT[0] = TB[NB-2] + 1; + BT[1] = TB[NB-1] + (BT[0]==0); + + // start reducing TA mod TB, 2 words at a time + for (size_t i=NA-2; i>=NB; i-=2) + { + AtomicDivide(Q+i-NB, TA+i-2, BT); + CorrectQuotientEstimate(TA+i-NB, TP, Q+i-NB, TB, NB); + } + + // copy TA into R, and denormalize it + CopyWords(R, TA+shiftWords, NB); + ShiftWordsRightByBits(R, NB, shiftBits); +} + +static inline size_t EvenWordCount(const word *X, size_t N) +{ + while (N && X[N-2]==0 && X[N-1]==0) + N-=2; + return N; +} + +// return k +// R[N] --- result = A^(-1) * 2^k mod M +// T[4*N] - temporary work space +// A[NA] -- number to take inverse of +// M[N] --- modulus + +unsigned int AlmostInverse(word *R, word *T, const word *A, size_t NA, const word *M, size_t N) +{ + assert(NA<=N && N && N%2==0); + + word *b = T; + word *c = T+N; + word *f = T+2*N; + word *g = T+3*N; + size_t bcLen=2, fgLen=EvenWordCount(M, N); + unsigned int k=0, s=0; + + SetWords(T, 0, 3*N); + b[0]=1; + CopyWords(f, A, NA); + CopyWords(g, M, N); + + while (1) + { + word t=f[0]; + while (!t) + { + if (EvenWordCount(f, fgLen)==0) + { + SetWords(R, 0, N); + return 0; + } + + ShiftWordsRightByWords(f, fgLen, 1); + if (c[bcLen-1]) bcLen+=2; + assert(bcLen <= N); + ShiftWordsLeftByWords(c, bcLen, 1); + k+=WORD_BITS; + t=f[0]; + } + + unsigned int i=0; + while (t%2 == 0) + { + t>>=1; + i++; + } + k+=i; + + if (t==1 && f[1]==0 && EvenWordCount(f, fgLen)==2) + { + if (s%2==0) + CopyWords(R, b, N); + else + Subtract(R, M, b, N); + return k; + } + + ShiftWordsRightByBits(f, fgLen, i); + t=ShiftWordsLeftByBits(c, bcLen, i); + if (t) + { + c[bcLen] = t; + bcLen+=2; + assert(bcLen <= N); + } + + if (f[fgLen-2]==0 && g[fgLen-2]==0 && f[fgLen-1]==0 && g[fgLen-1]==0) + fgLen-=2; + + if (Compare(f, g, fgLen)==-1) + { + std::swap(f, g); + std::swap(b, c); + s++; + } + + Subtract(f, f, g, fgLen); + + if (Add(b, b, c, bcLen)) + { + b[bcLen] = 1; + bcLen+=2; + assert(bcLen <= N); + } + } +} + +// R[N] - result = A/(2^k) mod M +// A[N] - input +// M[N] - modulus + +void DivideByPower2Mod(word *R, const word *A, size_t k, const word *M, size_t N) +{ + CopyWords(R, A, N); + + while (k--) + { + if (R[0]%2==0) + ShiftWordsRightByBits(R, N, 1); + else + { + word carry = Add(R, R, M, N); + ShiftWordsRightByBits(R, N, 1); + R[N-1] += carry<<(WORD_BITS-1); + } + } +} + +// R[N] - result = A*(2^k) mod M +// A[N] - input +// M[N] - modulus + +void MultiplyByPower2Mod(word *R, const word *A, size_t k, const word *M, size_t N) +{ + CopyWords(R, A, N); + + while (k--) + if (ShiftWordsLeftByBits(R, N, 1) || Compare(R, M, N)>=0) + Subtract(R, R, M, N); +} + +// ****************************************************************** + +InitializeInteger::InitializeInteger() +{ + if (!g_pAssignIntToInteger) + { + SetFunctionPointers(); + g_pAssignIntToInteger = AssignIntToInteger; + } +} + +static const unsigned int RoundupSizeTable[] = {2, 2, 2, 4, 4, 8, 8, 8, 8}; + +static inline size_t RoundupSize(size_t n) +{ + if (n<=8) + return RoundupSizeTable[n]; + else if (n<=16) + return 16; + else if (n<=32) + return 32; + else if (n<=64) + return 64; + else return size_t(1) << BitPrecision(n-1); +} + +Integer::Integer() + : reg(2), sign(POSITIVE) +{ + reg[0] = reg[1] = 0; +} + +Integer::Integer(const Integer& t) + : reg(RoundupSize(t.WordCount())), sign(t.sign) +{ + CopyWords(reg, t.reg, reg.size()); +} + +Integer::Integer(Sign s, lword value) + : reg(2), sign(s) +{ + reg[0] = word(value); + reg[1] = word(SafeRightShift(value)); +} + +Integer::Integer(signed long value) + : reg(2) +{ + if (value >= 0) + sign = POSITIVE; + else + { + sign = NEGATIVE; + value = -value; + } + reg[0] = word(value); + reg[1] = word(SafeRightShift((unsigned long)value)); +} + +Integer::Integer(Sign s, word high, word low) + : reg(2), sign(s) +{ + reg[0] = low; + reg[1] = high; +} + +bool Integer::IsConvertableToLong() const +{ + if (ByteCount() > sizeof(long)) + return false; + + unsigned long value = (unsigned long)reg[0]; + value += SafeLeftShift((unsigned long)reg[1]); + + if (sign==POSITIVE) + return (signed long)value >= 0; + else + return -(signed long)value < 0; +} + +signed long Integer::ConvertToLong() const +{ + assert(IsConvertableToLong()); + + unsigned long value = (unsigned long)reg[0]; + value += SafeLeftShift((unsigned long)reg[1]); + return sign==POSITIVE ? value : -(signed long)value; +} + +Integer::Integer(BufferedTransformation &encodedInteger, size_t byteCount, Signedness s) +{ + Decode(encodedInteger, byteCount, s); +} + +Integer::Integer(const byte *encodedInteger, size_t byteCount, Signedness s) +{ + Decode(encodedInteger, byteCount, s); +} + +Integer::Integer(BufferedTransformation &bt) +{ + BERDecode(bt); +} + +Integer::Integer(RandomNumberGenerator &rng, size_t bitcount) +{ + Randomize(rng, bitcount); +} + +Integer::Integer(RandomNumberGenerator &rng, const Integer &min, const Integer &max, RandomNumberType rnType, const Integer &equiv, const Integer &mod) +{ + if (!Randomize(rng, min, max, rnType, equiv, mod)) + throw Integer::RandomNumberNotFound(); +} + +Integer Integer::Power2(size_t e) +{ + Integer r((word)0, BitsToWords(e+1)); + r.SetBit(e); + return r; +} + +template +struct NewInteger +{ + Integer * operator()() const + { + return new Integer(i); + } +}; + +const Integer &Integer::Zero() +{ + return Singleton().Ref(); +} + +const Integer &Integer::One() +{ + return Singleton >().Ref(); +} + +const Integer &Integer::Two() +{ + return Singleton >().Ref(); +} + +bool Integer::operator!() const +{ + return IsNegative() ? false : (reg[0]==0 && WordCount()==0); +} + +Integer& Integer::operator=(const Integer& t) +{ + if (this != &t) + { + if (reg.size() != t.reg.size() || t.reg[t.reg.size()/2] == 0) + reg.New(RoundupSize(t.WordCount())); + CopyWords(reg, t.reg, reg.size()); + sign = t.sign; + } + return *this; +} + +bool Integer::GetBit(size_t n) const +{ + if (n/WORD_BITS >= reg.size()) + return 0; + else + return bool((reg[n/WORD_BITS] >> (n % WORD_BITS)) & 1); +} + +void Integer::SetBit(size_t n, bool value) +{ + if (value) + { + reg.CleanGrow(RoundupSize(BitsToWords(n+1))); + reg[n/WORD_BITS] |= (word(1) << (n%WORD_BITS)); + } + else + { + if (n/WORD_BITS < reg.size()) + reg[n/WORD_BITS] &= ~(word(1) << (n%WORD_BITS)); + } +} + +byte Integer::GetByte(size_t n) const +{ + if (n/WORD_SIZE >= reg.size()) + return 0; + else + return byte(reg[n/WORD_SIZE] >> ((n%WORD_SIZE)*8)); +} + +void Integer::SetByte(size_t n, byte value) +{ + reg.CleanGrow(RoundupSize(BytesToWords(n+1))); + reg[n/WORD_SIZE] &= ~(word(0xff) << 8*(n%WORD_SIZE)); + reg[n/WORD_SIZE] |= (word(value) << 8*(n%WORD_SIZE)); +} + +lword Integer::GetBits(size_t i, size_t n) const +{ + lword v = 0; + assert(n <= sizeof(v)*8); + for (unsigned int j=0; j +static Integer StringToInteger(const T *str) +{ + int radix; + // GCC workaround + // std::char_traits::length() not defined in GCC 3.2 and STLport 4.5.3 + unsigned int length; + for (length = 0; str[length] != 0; length++) {} + + Integer v; + + if (length == 0) + return v; + + switch (str[length-1]) + { + case 'h': + case 'H': + radix=16; + break; + case 'o': + case 'O': + radix=8; + break; + case 'b': + case 'B': + radix=2; + break; + default: + radix=10; + } + + if (length > 2 && str[0] == '0' && str[1] == 'x') + radix = 16; + + for (unsigned i=0; i= '0' && str[i] <= '9') + digit = str[i] - '0'; + else if (str[i] >= 'A' && str[i] <= 'F') + digit = str[i] - 'A' + 10; + else if (str[i] >= 'a' && str[i] <= 'f') + digit = str[i] - 'a' + 10; + else + digit = radix; + + if (digit < radix) + { + v *= radix; + v += digit; + } + } + + if (str[0] == '-') + v.Negate(); + + return v; +} + +Integer::Integer(const char *str) + : reg(2), sign(POSITIVE) +{ + *this = StringToInteger(str); +} + +Integer::Integer(const wchar_t *str) + : reg(2), sign(POSITIVE) +{ + *this = StringToInteger(str); +} + +unsigned int Integer::WordCount() const +{ + return (unsigned int)CountWords(reg, reg.size()); +} + +unsigned int Integer::ByteCount() const +{ + unsigned wordCount = WordCount(); + if (wordCount) + return (wordCount-1)*WORD_SIZE + BytePrecision(reg[wordCount-1]); + else + return 0; +} + +unsigned int Integer::BitCount() const +{ + unsigned wordCount = WordCount(); + if (wordCount) + return (wordCount-1)*WORD_BITS + BitPrecision(reg[wordCount-1]); + else + return 0; +} + +void Integer::Decode(const byte *input, size_t inputLen, Signedness s) +{ + StringStore store(input, inputLen); + Decode(store, inputLen, s); +} + +void Integer::Decode(BufferedTransformation &bt, size_t inputLen, Signedness s) +{ + assert(bt.MaxRetrievable() >= inputLen); + + byte b; + bt.Peek(b); + sign = ((s==SIGNED) && (b & 0x80)) ? NEGATIVE : POSITIVE; + + while (inputLen>0 && (sign==POSITIVE ? b==0 : b==0xff)) + { + bt.Skip(1); + inputLen--; + bt.Peek(b); + } + + reg.CleanNew(RoundupSize(BytesToWords(inputLen))); + + for (size_t i=inputLen; i > 0; i--) + { + bt.Get(b); + reg[(i-1)/WORD_SIZE] |= word(b) << ((i-1)%WORD_SIZE)*8; + } + + if (sign == NEGATIVE) + { + for (size_t i=inputLen; i 0; i--) + bt.Put(GetByte(i-1)); + } + else + { + // take two's complement of *this + Integer temp = Integer::Power2(8*STDMAX((size_t)ByteCount(), outputLen)) + *this; + temp.Encode(bt, outputLen, UNSIGNED); + } +} + +void Integer::DEREncode(BufferedTransformation &bt) const +{ + DERGeneralEncoder enc(bt, INTEGER); + Encode(enc, MinEncodedSize(SIGNED), SIGNED); + enc.MessageEnd(); +} + +void Integer::BERDecode(const byte *input, size_t len) +{ + StringStore store(input, len); + BERDecode(store); +} + +void Integer::BERDecode(BufferedTransformation &bt) +{ + BERGeneralDecoder dec(bt, INTEGER); + if (!dec.IsDefiniteLength() || dec.MaxRetrievable() < dec.RemainingLength()) + BERDecodeError(); + Decode(dec, (size_t)dec.RemainingLength(), SIGNED); + dec.MessageEnd(); +} + +void Integer::DEREncodeAsOctetString(BufferedTransformation &bt, size_t length) const +{ + DERGeneralEncoder enc(bt, OCTET_STRING); + Encode(enc, length); + enc.MessageEnd(); +} + +void Integer::BERDecodeAsOctetString(BufferedTransformation &bt, size_t length) +{ + BERGeneralDecoder dec(bt, OCTET_STRING); + if (!dec.IsDefiniteLength() || dec.RemainingLength() != length) + BERDecodeError(); + Decode(dec, length); + dec.MessageEnd(); +} + +size_t Integer::OpenPGPEncode(byte *output, size_t len) const +{ + ArraySink sink(output, len); + return OpenPGPEncode(sink); +} + +size_t Integer::OpenPGPEncode(BufferedTransformation &bt) const +{ + word16 bitCount = BitCount(); + bt.PutWord16(bitCount); + size_t byteCount = BitsToBytes(bitCount); + Encode(bt, byteCount); + return 2 + byteCount; +} + +void Integer::OpenPGPDecode(const byte *input, size_t len) +{ + StringStore store(input, len); + OpenPGPDecode(store); +} + +void Integer::OpenPGPDecode(BufferedTransformation &bt) +{ + word16 bitCount; + if (bt.GetWord16(bitCount) != 2 || bt.MaxRetrievable() < BitsToBytes(bitCount)) + throw OpenPGPDecodeErr(); + Decode(bt, BitsToBytes(bitCount)); +} + +void Integer::Randomize(RandomNumberGenerator &rng, size_t nbits) +{ + const size_t nbytes = nbits/8 + 1; + SecByteBlock buf(nbytes); + rng.GenerateBlock(buf, nbytes); + if (nbytes) + buf[0] = (byte)Crop(buf[0], nbits % 8); + Decode(buf, nbytes, UNSIGNED); +} + +void Integer::Randomize(RandomNumberGenerator &rng, const Integer &min, const Integer &max) +{ + if (min > max) + throw InvalidArgument("Integer: Min must be no greater than Max"); + + Integer range = max - min; + const unsigned int nbits = range.BitCount(); + + do + { + Randomize(rng, nbits); + } + while (*this > range); + + *this += min; +} + +bool Integer::Randomize(RandomNumberGenerator &rng, const Integer &min, const Integer &max, RandomNumberType rnType, const Integer &equiv, const Integer &mod) +{ + return GenerateRandomNoThrow(rng, MakeParameters("Min", min)("Max", max)("RandomNumberType", rnType)("EquivalentTo", equiv)("Mod", mod)); +} + +class KDF2_RNG : public RandomNumberGenerator +{ +public: + KDF2_RNG(const byte *seed, size_t seedSize) + : m_counter(0), m_counterAndSeed(seedSize + 4) + { + memcpy(m_counterAndSeed + 4, seed, seedSize); + } + + void GenerateBlock(byte *output, size_t size) + { + PutWord(false, BIG_ENDIAN_ORDER, m_counterAndSeed, m_counter); + ++m_counter; + P1363_KDF2::DeriveKey(output, size, m_counterAndSeed, m_counterAndSeed.size(), NULL, 0); + } + +private: + word32 m_counter; + SecByteBlock m_counterAndSeed; +}; + +bool Integer::GenerateRandomNoThrow(RandomNumberGenerator &i_rng, const NameValuePairs ¶ms) +{ + Integer min = params.GetValueWithDefault("Min", Integer::Zero()); + Integer max; + if (!params.GetValue("Max", max)) + { + int bitLength; + if (params.GetIntValue("BitLength", bitLength)) + max = Integer::Power2(bitLength); + else + throw InvalidArgument("Integer: missing Max argument"); + } + if (min > max) + throw InvalidArgument("Integer: Min must be no greater than Max"); + + Integer equiv = params.GetValueWithDefault("EquivalentTo", Integer::Zero()); + Integer mod = params.GetValueWithDefault("Mod", Integer::One()); + + if (equiv.IsNegative() || equiv >= mod) + throw InvalidArgument("Integer: invalid EquivalentTo and/or Mod argument"); + + Integer::RandomNumberType rnType = params.GetValueWithDefault("RandomNumberType", Integer::ANY); + + member_ptr kdf2Rng; + ConstByteArrayParameter seed; + if (params.GetValue(Name::Seed(), seed)) + { + ByteQueue bq; + DERSequenceEncoder seq(bq); + min.DEREncode(seq); + max.DEREncode(seq); + equiv.DEREncode(seq); + mod.DEREncode(seq); + DEREncodeUnsigned(seq, rnType); + DEREncodeOctetString(seq, seed.begin(), seed.size()); + seq.MessageEnd(); + + SecByteBlock finalSeed((size_t)bq.MaxRetrievable()); + bq.Get(finalSeed, finalSeed.size()); + kdf2Rng.reset(new KDF2_RNG(finalSeed.begin(), finalSeed.size())); + } + RandomNumberGenerator &rng = kdf2Rng.get() ? (RandomNumberGenerator &)*kdf2Rng : i_rng; + + switch (rnType) + { + case ANY: + if (mod == One()) + Randomize(rng, min, max); + else + { + Integer min1 = min + (equiv-min)%mod; + if (max < min1) + return false; + Randomize(rng, Zero(), (max - min1) / mod); + *this *= mod; + *this += min1; + } + return true; + + case PRIME: + { + const PrimeSelector *pSelector = params.GetValueWithDefault(Name::PointerToPrimeSelector(), (const PrimeSelector *)NULL); + + int i; + i = 0; + while (1) + { + if (++i==16) + { + // check if there are any suitable primes in [min, max] + Integer first = min; + if (FirstPrime(first, max, equiv, mod, pSelector)) + { + // if there is only one suitable prime, we're done + *this = first; + if (!FirstPrime(first, max, equiv, mod, pSelector)) + return true; + } + else + return false; + } + + Randomize(rng, min, max); + if (FirstPrime(*this, STDMIN(*this+mod*PrimeSearchInterval(max), max), equiv, mod, pSelector)) + return true; + } + } + + default: + throw InvalidArgument("Integer: invalid RandomNumberType argument"); + } +} + +std::istream& operator>>(std::istream& in, Integer &a) +{ + char c; + unsigned int length = 0; + SecBlock str(length + 16); + + std::ws(in); + + do + { + in.read(&c, 1); + str[length++] = c; + if (length >= str.size()) + str.Grow(length + 16); + } + while (in && (c=='-' || c=='x' || (c>='0' && c<='9') || (c>='a' && c<='f') || (c>='A' && c<='F') || c=='h' || c=='H' || c=='o' || c=='O' || c==',' || c=='.')); + + if (in.gcount()) + in.putback(c); + str[length-1] = '\0'; + a = Integer(str); + + return in; +} + +std::ostream& operator<<(std::ostream& out, const Integer &a) +{ + // Get relevant conversion specifications from ostream. + long f = out.flags() & std::ios::basefield; // Get base digits. + int base, block; + char suffix; + switch(f) + { + case std::ios::oct : + base = 8; + block = 8; + suffix = 'o'; + break; + case std::ios::hex : + base = 16; + block = 4; + suffix = 'h'; + break; + default : + base = 10; + block = 3; + suffix = '.'; + } + + Integer temp1=a, temp2; + + if (a.IsNegative()) + { + out << '-'; + temp1.Negate(); + } + + if (!a) + out << '0'; + + static const char upper[]="0123456789ABCDEF"; + static const char lower[]="0123456789abcdef"; + + const char* vec = (out.flags() & std::ios::uppercase) ? upper : lower; + unsigned i=0; + SecBlock s(a.BitCount() / (BitPrecision(base)-1) + 1); + + while (!!temp1) + { + word digit; + Integer::Divide(digit, temp2, temp1, base); + s[i++]=vec[digit]; + temp1.swap(temp2); + } + + while (i--) + { + out << s[i]; +// if (i && !(i%block)) +// out << ","; + } + return out << suffix; +} + +Integer& Integer::operator++() +{ + if (NotNegative()) + { + if (Increment(reg, reg.size())) + { + reg.CleanGrow(2*reg.size()); + reg[reg.size()/2]=1; + } + } + else + { + word borrow = Decrement(reg, reg.size()); + assert(!borrow); + if (WordCount()==0) + *this = Zero(); + } + return *this; +} + +Integer& Integer::operator--() +{ + if (IsNegative()) + { + if (Increment(reg, reg.size())) + { + reg.CleanGrow(2*reg.size()); + reg[reg.size()/2]=1; + } + } + else + { + if (Decrement(reg, reg.size())) + *this = -One(); + } + return *this; +} + +void PositiveAdd(Integer &sum, const Integer &a, const Integer& b) +{ + int carry; + if (a.reg.size() == b.reg.size()) + carry = Add(sum.reg, a.reg, b.reg, a.reg.size()); + else if (a.reg.size() > b.reg.size()) + { + carry = Add(sum.reg, a.reg, b.reg, b.reg.size()); + CopyWords(sum.reg+b.reg.size(), a.reg+b.reg.size(), a.reg.size()-b.reg.size()); + carry = Increment(sum.reg+b.reg.size(), a.reg.size()-b.reg.size(), carry); + } + else + { + carry = Add(sum.reg, a.reg, b.reg, a.reg.size()); + CopyWords(sum.reg+a.reg.size(), b.reg+a.reg.size(), b.reg.size()-a.reg.size()); + carry = Increment(sum.reg+a.reg.size(), b.reg.size()-a.reg.size(), carry); + } + + if (carry) + { + sum.reg.CleanGrow(2*sum.reg.size()); + sum.reg[sum.reg.size()/2] = 1; + } + sum.sign = Integer::POSITIVE; +} + +void PositiveSubtract(Integer &diff, const Integer &a, const Integer& b) +{ + unsigned aSize = a.WordCount(); + aSize += aSize%2; + unsigned bSize = b.WordCount(); + bSize += bSize%2; + + if (aSize == bSize) + { + if (Compare(a.reg, b.reg, aSize) >= 0) + { + Subtract(diff.reg, a.reg, b.reg, aSize); + diff.sign = Integer::POSITIVE; + } + else + { + Subtract(diff.reg, b.reg, a.reg, aSize); + diff.sign = Integer::NEGATIVE; + } + } + else if (aSize > bSize) + { + word borrow = Subtract(diff.reg, a.reg, b.reg, bSize); + CopyWords(diff.reg+bSize, a.reg+bSize, aSize-bSize); + borrow = Decrement(diff.reg+bSize, aSize-bSize, borrow); + assert(!borrow); + diff.sign = Integer::POSITIVE; + } + else + { + word borrow = Subtract(diff.reg, b.reg, a.reg, aSize); + CopyWords(diff.reg+aSize, b.reg+aSize, bSize-aSize); + borrow = Decrement(diff.reg+aSize, bSize-aSize, borrow); + assert(!borrow); + diff.sign = Integer::NEGATIVE; + } +} + +// MSVC .NET 2003 workaround +template inline const T& STDMAX2(const T& a, const T& b) +{ + return a < b ? b : a; +} + +Integer Integer::Plus(const Integer& b) const +{ + Integer sum((word)0, STDMAX2(reg.size(), b.reg.size())); + if (NotNegative()) + { + if (b.NotNegative()) + PositiveAdd(sum, *this, b); + else + PositiveSubtract(sum, *this, b); + } + else + { + if (b.NotNegative()) + PositiveSubtract(sum, b, *this); + else + { + PositiveAdd(sum, *this, b); + sum.sign = Integer::NEGATIVE; + } + } + return sum; +} + +Integer& Integer::operator+=(const Integer& t) +{ + reg.CleanGrow(t.reg.size()); + if (NotNegative()) + { + if (t.NotNegative()) + PositiveAdd(*this, *this, t); + else + PositiveSubtract(*this, *this, t); + } + else + { + if (t.NotNegative()) + PositiveSubtract(*this, t, *this); + else + { + PositiveAdd(*this, *this, t); + sign = Integer::NEGATIVE; + } + } + return *this; +} + +Integer Integer::Minus(const Integer& b) const +{ + Integer diff((word)0, STDMAX2(reg.size(), b.reg.size())); + if (NotNegative()) + { + if (b.NotNegative()) + PositiveSubtract(diff, *this, b); + else + PositiveAdd(diff, *this, b); + } + else + { + if (b.NotNegative()) + { + PositiveAdd(diff, *this, b); + diff.sign = Integer::NEGATIVE; + } + else + PositiveSubtract(diff, b, *this); + } + return diff; +} + +Integer& Integer::operator-=(const Integer& t) +{ + reg.CleanGrow(t.reg.size()); + if (NotNegative()) + { + if (t.NotNegative()) + PositiveSubtract(*this, *this, t); + else + PositiveAdd(*this, *this, t); + } + else + { + if (t.NotNegative()) + { + PositiveAdd(*this, *this, t); + sign = Integer::NEGATIVE; + } + else + PositiveSubtract(*this, t, *this); + } + return *this; +} + +Integer& Integer::operator<<=(size_t n) +{ + const size_t wordCount = WordCount(); + const size_t shiftWords = n / WORD_BITS; + const unsigned int shiftBits = (unsigned int)(n % WORD_BITS); + + reg.CleanGrow(RoundupSize(wordCount+BitsToWords(n))); + ShiftWordsLeftByWords(reg, wordCount + shiftWords, shiftWords); + ShiftWordsLeftByBits(reg+shiftWords, wordCount+BitsToWords(shiftBits), shiftBits); + return *this; +} + +Integer& Integer::operator>>=(size_t n) +{ + const size_t wordCount = WordCount(); + const size_t shiftWords = n / WORD_BITS; + const unsigned int shiftBits = (unsigned int)(n % WORD_BITS); + + ShiftWordsRightByWords(reg, wordCount, shiftWords); + if (wordCount > shiftWords) + ShiftWordsRightByBits(reg, wordCount-shiftWords, shiftBits); + if (IsNegative() && WordCount()==0) // avoid -0 + *this = Zero(); + return *this; +} + +void PositiveMultiply(Integer &product, const Integer &a, const Integer &b) +{ + size_t aSize = RoundupSize(a.WordCount()); + size_t bSize = RoundupSize(b.WordCount()); + + product.reg.CleanNew(RoundupSize(aSize+bSize)); + product.sign = Integer::POSITIVE; + + IntegerSecBlock workspace(aSize + bSize); + AsymmetricMultiply(product.reg, workspace, a.reg, aSize, b.reg, bSize); +} + +void Multiply(Integer &product, const Integer &a, const Integer &b) +{ + PositiveMultiply(product, a, b); + + if (a.NotNegative() != b.NotNegative()) + product.Negate(); +} + +Integer Integer::Times(const Integer &b) const +{ + Integer product; + Multiply(product, *this, b); + return product; +} + +/* +void PositiveDivide(Integer &remainder, Integer "ient, + const Integer ÷nd, const Integer &divisor) +{ + remainder.reg.CleanNew(divisor.reg.size()); + remainder.sign = Integer::POSITIVE; + quotient.reg.New(0); + quotient.sign = Integer::POSITIVE; + unsigned i=dividend.BitCount(); + while (i--) + { + word overflow = ShiftWordsLeftByBits(remainder.reg, remainder.reg.size(), 1); + remainder.reg[0] |= dividend[i]; + if (overflow || remainder >= divisor) + { + Subtract(remainder.reg, remainder.reg, divisor.reg, remainder.reg.size()); + quotient.SetBit(i); + } + } +} +*/ + +void PositiveDivide(Integer &remainder, Integer "ient, + const Integer &a, const Integer &b) +{ + unsigned aSize = a.WordCount(); + unsigned bSize = b.WordCount(); + + if (!bSize) + throw Integer::DivideByZero(); + + if (aSize < bSize) + { + remainder = a; + remainder.sign = Integer::POSITIVE; + quotient = Integer::Zero(); + return; + } + + aSize += aSize%2; // round up to next even number + bSize += bSize%2; + + remainder.reg.CleanNew(RoundupSize(bSize)); + remainder.sign = Integer::POSITIVE; + quotient.reg.CleanNew(RoundupSize(aSize-bSize+2)); + quotient.sign = Integer::POSITIVE; + + IntegerSecBlock T(aSize+3*(bSize+2)); + Divide(remainder.reg, quotient.reg, T, a.reg, aSize, b.reg, bSize); +} + +void Integer::Divide(Integer &remainder, Integer "ient, const Integer ÷nd, const Integer &divisor) +{ + PositiveDivide(remainder, quotient, dividend, divisor); + + if (dividend.IsNegative()) + { + quotient.Negate(); + if (remainder.NotZero()) + { + --quotient; + remainder = divisor.AbsoluteValue() - remainder; + } + } + + if (divisor.IsNegative()) + quotient.Negate(); +} + +void Integer::DivideByPowerOf2(Integer &r, Integer &q, const Integer &a, unsigned int n) +{ + q = a; + q >>= n; + + const size_t wordCount = BitsToWords(n); + if (wordCount <= a.WordCount()) + { + r.reg.resize(RoundupSize(wordCount)); + CopyWords(r.reg, a.reg, wordCount); + SetWords(r.reg+wordCount, 0, r.reg.size()-wordCount); + if (n % WORD_BITS != 0) + r.reg[wordCount-1] %= (word(1) << (n % WORD_BITS)); + } + else + { + r.reg.resize(RoundupSize(a.WordCount())); + CopyWords(r.reg, a.reg, r.reg.size()); + } + r.sign = POSITIVE; + + if (a.IsNegative() && r.NotZero()) + { + --q; + r = Power2(n) - r; + } +} + +Integer Integer::DividedBy(const Integer &b) const +{ + Integer remainder, quotient; + Integer::Divide(remainder, quotient, *this, b); + return quotient; +} + +Integer Integer::Modulo(const Integer &b) const +{ + Integer remainder, quotient; + Integer::Divide(remainder, quotient, *this, b); + return remainder; +} + +void Integer::Divide(word &remainder, Integer "ient, const Integer ÷nd, word divisor) +{ + if (!divisor) + throw Integer::DivideByZero(); + + assert(divisor); + + if ((divisor & (divisor-1)) == 0) // divisor is a power of 2 + { + quotient = dividend >> (BitPrecision(divisor)-1); + remainder = dividend.reg[0] & (divisor-1); + return; + } + + unsigned int i = dividend.WordCount(); + quotient.reg.CleanNew(RoundupSize(i)); + remainder = 0; + while (i--) + { + quotient.reg[i] = DWord(dividend.reg[i], remainder) / divisor; + remainder = DWord(dividend.reg[i], remainder) % divisor; + } + + if (dividend.NotNegative()) + quotient.sign = POSITIVE; + else + { + quotient.sign = NEGATIVE; + if (remainder) + { + --quotient; + remainder = divisor - remainder; + } + } +} + +Integer Integer::DividedBy(word b) const +{ + word remainder; + Integer quotient; + Integer::Divide(remainder, quotient, *this, b); + return quotient; +} + +word Integer::Modulo(word divisor) const +{ + if (!divisor) + throw Integer::DivideByZero(); + + assert(divisor); + + word remainder; + + if ((divisor & (divisor-1)) == 0) // divisor is a power of 2 + remainder = reg[0] & (divisor-1); + else + { + unsigned int i = WordCount(); + + if (divisor <= 5) + { + DWord sum(0, 0); + while (i--) + sum += reg[i]; + remainder = sum % divisor; + } + else + { + remainder = 0; + while (i--) + remainder = DWord(reg[i], remainder) % divisor; + } + } + + if (IsNegative() && remainder) + remainder = divisor - remainder; + + return remainder; +} + +void Integer::Negate() +{ + if (!!(*this)) // don't flip sign if *this==0 + sign = Sign(1-sign); +} + +int Integer::PositiveCompare(const Integer& t) const +{ + unsigned size = WordCount(), tSize = t.WordCount(); + + if (size == tSize) + return CryptoPP::Compare(reg, t.reg, size); + else + return size > tSize ? 1 : -1; +} + +int Integer::Compare(const Integer& t) const +{ + if (NotNegative()) + { + if (t.NotNegative()) + return PositiveCompare(t); + else + return 1; + } + else + { + if (t.NotNegative()) + return -1; + else + return -PositiveCompare(t); + } +} + +Integer Integer::SquareRoot() const +{ + if (!IsPositive()) + return Zero(); + + // overestimate square root + Integer x, y = Power2((BitCount()+1)/2); + assert(y*y >= *this); + + do + { + x = y; + y = (x + *this/x) >> 1; + } while (y().Gcd(a, b); +} + +Integer Integer::InverseMod(const Integer &m) const +{ + assert(m.NotNegative()); + + if (IsNegative()) + return Modulo(m).InverseMod(m); + + if (m.IsEven()) + { + if (!m || IsEven()) + return Zero(); // no inverse + if (*this == One()) + return One(); + + Integer u = m.Modulo(*this).InverseMod(*this); + return !u ? Zero() : (m*(*this-u)+1)/(*this); + } + + SecBlock T(m.reg.size() * 4); + Integer r((word)0, m.reg.size()); + unsigned k = AlmostInverse(r.reg, T, reg, reg.size(), m.reg, m.reg.size()); + DivideByPower2Mod(r.reg, r.reg, k, m.reg, m.reg.size()); + return r; +} + +word Integer::InverseMod(word mod) const +{ + word g0 = mod, g1 = *this % mod; + word v0 = 0, v1 = 1; + word y; + + while (g1) + { + if (g1 == 1) + return v1; + y = g0 / g1; + g0 = g0 % g1; + v0 += y * v1; + + if (!g0) + break; + if (g0 == 1) + return mod-v0; + y = g1 / g0; + g1 = g1 % g0; + v1 += y * v0; + } + return 0; +} + +// ******************************************************** + +ModularArithmetic::ModularArithmetic(BufferedTransformation &bt) +{ + BERSequenceDecoder seq(bt); + OID oid(seq); + if (oid != ASN1::prime_field()) + BERDecodeError(); + m_modulus.BERDecode(seq); + seq.MessageEnd(); + m_result.reg.resize(m_modulus.reg.size()); +} + +void ModularArithmetic::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + ASN1::prime_field().DEREncode(seq); + m_modulus.DEREncode(seq); + seq.MessageEnd(); +} + +void ModularArithmetic::DEREncodeElement(BufferedTransformation &out, const Element &a) const +{ + a.DEREncodeAsOctetString(out, MaxElementByteLength()); +} + +void ModularArithmetic::BERDecodeElement(BufferedTransformation &in, Element &a) const +{ + a.BERDecodeAsOctetString(in, MaxElementByteLength()); +} + +const Integer& ModularArithmetic::Half(const Integer &a) const +{ + if (a.reg.size()==m_modulus.reg.size()) + { + CryptoPP::DivideByPower2Mod(m_result.reg.begin(), a.reg, 1, m_modulus.reg, a.reg.size()); + return m_result; + } + else + return m_result1 = (a.IsEven() ? (a >> 1) : ((a+m_modulus) >> 1)); +} + +const Integer& ModularArithmetic::Add(const Integer &a, const Integer &b) const +{ + if (a.reg.size()==m_modulus.reg.size() && b.reg.size()==m_modulus.reg.size()) + { + if (CryptoPP::Add(m_result.reg.begin(), a.reg, b.reg, a.reg.size()) + || Compare(m_result.reg, m_modulus.reg, a.reg.size()) >= 0) + { + CryptoPP::Subtract(m_result.reg.begin(), m_result.reg, m_modulus.reg, a.reg.size()); + } + return m_result; + } + else + { + m_result1 = a+b; + if (m_result1 >= m_modulus) + m_result1 -= m_modulus; + return m_result1; + } +} + +Integer& ModularArithmetic::Accumulate(Integer &a, const Integer &b) const +{ + if (a.reg.size()==m_modulus.reg.size() && b.reg.size()==m_modulus.reg.size()) + { + if (CryptoPP::Add(a.reg, a.reg, b.reg, a.reg.size()) + || Compare(a.reg, m_modulus.reg, a.reg.size()) >= 0) + { + CryptoPP::Subtract(a.reg, a.reg, m_modulus.reg, a.reg.size()); + } + } + else + { + a+=b; + if (a>=m_modulus) + a-=m_modulus; + } + + return a; +} + +const Integer& ModularArithmetic::Subtract(const Integer &a, const Integer &b) const +{ + if (a.reg.size()==m_modulus.reg.size() && b.reg.size()==m_modulus.reg.size()) + { + if (CryptoPP::Subtract(m_result.reg.begin(), a.reg, b.reg, a.reg.size())) + CryptoPP::Add(m_result.reg.begin(), m_result.reg, m_modulus.reg, a.reg.size()); + return m_result; + } + else + { + m_result1 = a-b; + if (m_result1.IsNegative()) + m_result1 += m_modulus; + return m_result1; + } +} + +Integer& ModularArithmetic::Reduce(Integer &a, const Integer &b) const +{ + if (a.reg.size()==m_modulus.reg.size() && b.reg.size()==m_modulus.reg.size()) + { + if (CryptoPP::Subtract(a.reg, a.reg, b.reg, a.reg.size())) + CryptoPP::Add(a.reg, a.reg, m_modulus.reg, a.reg.size()); + } + else + { + a-=b; + if (a.IsNegative()) + a+=m_modulus; + } + + return a; +} + +const Integer& ModularArithmetic::Inverse(const Integer &a) const +{ + if (!a) + return a; + + CopyWords(m_result.reg.begin(), m_modulus.reg, m_modulus.reg.size()); + if (CryptoPP::Subtract(m_result.reg.begin(), m_result.reg, a.reg, a.reg.size())) + Decrement(m_result.reg.begin()+a.reg.size(), m_modulus.reg.size()-a.reg.size()); + + return m_result; +} + +Integer ModularArithmetic::CascadeExponentiate(const Integer &x, const Integer &e1, const Integer &y, const Integer &e2) const +{ + if (m_modulus.IsOdd()) + { + MontgomeryRepresentation dr(m_modulus); + return dr.ConvertOut(dr.CascadeExponentiate(dr.ConvertIn(x), e1, dr.ConvertIn(y), e2)); + } + else + return AbstractRing::CascadeExponentiate(x, e1, y, e2); +} + +void ModularArithmetic::SimultaneousExponentiate(Integer *results, const Integer &base, const Integer *exponents, unsigned int exponentsCount) const +{ + if (m_modulus.IsOdd()) + { + MontgomeryRepresentation dr(m_modulus); + dr.SimultaneousExponentiate(results, dr.ConvertIn(base), exponents, exponentsCount); + for (unsigned int i=0; i::SimultaneousExponentiate(results, base, exponents, exponentsCount); +} + +MontgomeryRepresentation::MontgomeryRepresentation(const Integer &m) // modulus must be odd + : ModularArithmetic(m), + m_u((word)0, m_modulus.reg.size()), + m_workspace(5*m_modulus.reg.size()) +{ + if (!m_modulus.IsOdd()) + throw InvalidArgument("MontgomeryRepresentation: Montgomery representation requires an odd modulus"); + + RecursiveInverseModPower2(m_u.reg, m_workspace, m_modulus.reg, m_modulus.reg.size()); +} + +const Integer& MontgomeryRepresentation::Multiply(const Integer &a, const Integer &b) const +{ + word *const T = m_workspace.begin(); + word *const R = m_result.reg.begin(); + const size_t N = m_modulus.reg.size(); + assert(a.reg.size()<=N && b.reg.size()<=N); + + AsymmetricMultiply(T, T+2*N, a.reg, a.reg.size(), b.reg, b.reg.size()); + SetWords(T+a.reg.size()+b.reg.size(), 0, 2*N-a.reg.size()-b.reg.size()); + MontgomeryReduce(R, T+2*N, T, m_modulus.reg, m_u.reg, N); + return m_result; +} + +const Integer& MontgomeryRepresentation::Square(const Integer &a) const +{ + word *const T = m_workspace.begin(); + word *const R = m_result.reg.begin(); + const size_t N = m_modulus.reg.size(); + assert(a.reg.size()<=N); + + CryptoPP::Square(T, T+2*N, a.reg, a.reg.size()); + SetWords(T+2*a.reg.size(), 0, 2*N-2*a.reg.size()); + MontgomeryReduce(R, T+2*N, T, m_modulus.reg, m_u.reg, N); + return m_result; +} + +Integer MontgomeryRepresentation::ConvertOut(const Integer &a) const +{ + word *const T = m_workspace.begin(); + word *const R = m_result.reg.begin(); + const size_t N = m_modulus.reg.size(); + assert(a.reg.size()<=N); + + CopyWords(T, a.reg, a.reg.size()); + SetWords(T+a.reg.size(), 0, 2*N-a.reg.size()); + MontgomeryReduce(R, T+2*N, T, m_modulus.reg, m_u.reg, N); + return m_result; +} + +const Integer& MontgomeryRepresentation::MultiplicativeInverse(const Integer &a) const +{ +// return (EuclideanMultiplicativeInverse(a, modulus)<<(2*WORD_BITS*modulus.reg.size()))%modulus; + word *const T = m_workspace.begin(); + word *const R = m_result.reg.begin(); + const size_t N = m_modulus.reg.size(); + assert(a.reg.size()<=N); + + CopyWords(T, a.reg, a.reg.size()); + SetWords(T+a.reg.size(), 0, 2*N-a.reg.size()); + MontgomeryReduce(R, T+2*N, T, m_modulus.reg, m_u.reg, N); + unsigned k = AlmostInverse(R, T, R, N, m_modulus.reg, N); + +// cout << "k=" << k << " N*32=" << 32*N << endl; + + if (k>N*WORD_BITS) + DivideByPower2Mod(R, R, k-N*WORD_BITS, m_modulus.reg, N); + else + MultiplyByPower2Mod(R, R, N*WORD_BITS-k, m_modulus.reg, N); + + return m_result; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/integer.h b/cryptopp/integer.h new file mode 100644 index 0000000..6d844fa --- /dev/null +++ b/cryptopp/integer.h @@ -0,0 +1,420 @@ +#ifndef CRYPTOPP_INTEGER_H +#define CRYPTOPP_INTEGER_H + +/** \file */ + +#include "cryptlib.h" +#include "secblock.h" + +#include +#include + +NAMESPACE_BEGIN(CryptoPP) + +struct InitializeInteger // used to initialize static variables +{ + InitializeInteger(); +}; + +typedef SecBlock > IntegerSecBlock; + +//! multiple precision integer and basic arithmetics +/*! This class can represent positive and negative integers + with absolute value less than (256**sizeof(word)) ** (256**sizeof(int)). + \nosubgrouping +*/ +class CRYPTOPP_DLL Integer : private InitializeInteger, public ASN1Object +{ +public: + //! \name ENUMS, EXCEPTIONS, and TYPEDEFS + //@{ + //! division by zero exception + class DivideByZero : public Exception + { + public: + DivideByZero() : Exception(OTHER_ERROR, "Integer: division by zero") {} + }; + + //! + class RandomNumberNotFound : public Exception + { + public: + RandomNumberNotFound() : Exception(OTHER_ERROR, "Integer: no integer satisfies the given parameters") {} + }; + + //! + enum Sign {POSITIVE=0, NEGATIVE=1}; + + //! + enum Signedness { + //! + UNSIGNED, + //! + SIGNED}; + + //! + enum RandomNumberType { + //! + ANY, + //! + PRIME}; + //@} + + //! \name CREATORS + //@{ + //! creates the zero integer + Integer(); + + //! copy constructor + Integer(const Integer& t); + + //! convert from signed long + Integer(signed long value); + + //! convert from lword + Integer(Sign s, lword value); + + //! convert from two words + Integer(Sign s, word highWord, word lowWord); + + //! convert from string + /*! str can be in base 2, 8, 10, or 16. Base is determined by a + case insensitive suffix of 'h', 'o', or 'b'. No suffix means base 10. + */ + explicit Integer(const char *str); + explicit Integer(const wchar_t *str); + + //! convert from big-endian byte array + Integer(const byte *encodedInteger, size_t byteCount, Signedness s=UNSIGNED); + + //! convert from big-endian form stored in a BufferedTransformation + Integer(BufferedTransformation &bt, size_t byteCount, Signedness s=UNSIGNED); + + //! convert from BER encoded byte array stored in a BufferedTransformation object + explicit Integer(BufferedTransformation &bt); + + //! create a random integer + /*! The random integer created is uniformly distributed over [0, 2**bitcount). */ + Integer(RandomNumberGenerator &rng, size_t bitcount); + + //! avoid calling constructors for these frequently used integers + static const Integer & CRYPTOPP_API Zero(); + //! avoid calling constructors for these frequently used integers + static const Integer & CRYPTOPP_API One(); + //! avoid calling constructors for these frequently used integers + static const Integer & CRYPTOPP_API Two(); + + //! create a random integer of special type + /*! Ideally, the random integer created should be uniformly distributed + over {x | min <= x <= max and x is of rnType and x % mod == equiv}. + However the actual distribution may not be uniform because sequential + search is used to find an appropriate number from a random starting + point. + May return (with very small probability) a pseudoprime when a prime + is requested and max > lastSmallPrime*lastSmallPrime (lastSmallPrime + is declared in nbtheory.h). + \throw RandomNumberNotFound if the set is empty. + */ + Integer(RandomNumberGenerator &rng, const Integer &min, const Integer &max, RandomNumberType rnType=ANY, const Integer &equiv=Zero(), const Integer &mod=One()); + + //! return the integer 2**e + static Integer CRYPTOPP_API Power2(size_t e); + //@} + + //! \name ENCODE/DECODE + //@{ + //! minimum number of bytes to encode this integer + /*! MinEncodedSize of 0 is 1 */ + size_t MinEncodedSize(Signedness=UNSIGNED) const; + //! encode in big-endian format + /*! unsigned means encode absolute value, signed means encode two's complement if negative. + if outputLen < MinEncodedSize, the most significant bytes will be dropped + if outputLen > MinEncodedSize, the most significant bytes will be padded + */ + void Encode(byte *output, size_t outputLen, Signedness=UNSIGNED) const; + //! + void Encode(BufferedTransformation &bt, size_t outputLen, Signedness=UNSIGNED) const; + + //! encode using Distinguished Encoding Rules, put result into a BufferedTransformation object + void DEREncode(BufferedTransformation &bt) const; + + //! encode absolute value as big-endian octet string + void DEREncodeAsOctetString(BufferedTransformation &bt, size_t length) const; + + //! encode absolute value in OpenPGP format, return length of output + size_t OpenPGPEncode(byte *output, size_t bufferSize) const; + //! encode absolute value in OpenPGP format, put result into a BufferedTransformation object + size_t OpenPGPEncode(BufferedTransformation &bt) const; + + //! + void Decode(const byte *input, size_t inputLen, Signedness=UNSIGNED); + //! + //* Precondition: bt.MaxRetrievable() >= inputLen + void Decode(BufferedTransformation &bt, size_t inputLen, Signedness=UNSIGNED); + + //! + void BERDecode(const byte *input, size_t inputLen); + //! + void BERDecode(BufferedTransformation &bt); + + //! decode nonnegative value as big-endian octet string + void BERDecodeAsOctetString(BufferedTransformation &bt, size_t length); + + class OpenPGPDecodeErr : public Exception + { + public: + OpenPGPDecodeErr() : Exception(INVALID_DATA_FORMAT, "OpenPGP decode error") {} + }; + + //! + void OpenPGPDecode(const byte *input, size_t inputLen); + //! + void OpenPGPDecode(BufferedTransformation &bt); + //@} + + //! \name ACCESSORS + //@{ + //! return true if *this can be represented as a signed long + bool IsConvertableToLong() const; + //! return equivalent signed long if possible, otherwise undefined + signed long ConvertToLong() const; + + //! number of significant bits = floor(log2(abs(*this))) + 1 + unsigned int BitCount() const; + //! number of significant bytes = ceiling(BitCount()/8) + unsigned int ByteCount() const; + //! number of significant words = ceiling(ByteCount()/sizeof(word)) + unsigned int WordCount() const; + + //! return the i-th bit, i=0 being the least significant bit + bool GetBit(size_t i) const; + //! return the i-th byte + byte GetByte(size_t i) const; + //! return n lowest bits of *this >> i + lword GetBits(size_t i, size_t n) const; + + //! + bool IsZero() const {return !*this;} + //! + bool NotZero() const {return !IsZero();} + //! + bool IsNegative() const {return sign == NEGATIVE;} + //! + bool NotNegative() const {return !IsNegative();} + //! + bool IsPositive() const {return NotNegative() && NotZero();} + //! + bool NotPositive() const {return !IsPositive();} + //! + bool IsEven() const {return GetBit(0) == 0;} + //! + bool IsOdd() const {return GetBit(0) == 1;} + //@} + + //! \name MANIPULATORS + //@{ + //! + Integer& operator=(const Integer& t); + + //! + Integer& operator+=(const Integer& t); + //! + Integer& operator-=(const Integer& t); + //! + Integer& operator*=(const Integer& t) {return *this = Times(t);} + //! + Integer& operator/=(const Integer& t) {return *this = DividedBy(t);} + //! + Integer& operator%=(const Integer& t) {return *this = Modulo(t);} + //! + Integer& operator/=(word t) {return *this = DividedBy(t);} + //! + Integer& operator%=(word t) {return *this = Integer(POSITIVE, 0, Modulo(t));} + + //! + Integer& operator<<=(size_t); + //! + Integer& operator>>=(size_t); + + //! + void Randomize(RandomNumberGenerator &rng, size_t bitcount); + //! + void Randomize(RandomNumberGenerator &rng, const Integer &min, const Integer &max); + //! set this Integer to a random element of {x | min <= x <= max and x is of rnType and x % mod == equiv} + /*! returns false if the set is empty */ + bool Randomize(RandomNumberGenerator &rng, const Integer &min, const Integer &max, RandomNumberType rnType, const Integer &equiv=Zero(), const Integer &mod=One()); + + bool GenerateRandomNoThrow(RandomNumberGenerator &rng, const NameValuePairs ¶ms = g_nullNameValuePairs); + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms = g_nullNameValuePairs) + { + if (!GenerateRandomNoThrow(rng, params)) + throw RandomNumberNotFound(); + } + + //! set the n-th bit to value + void SetBit(size_t n, bool value=1); + //! set the n-th byte to value + void SetByte(size_t n, byte value); + + //! + void Negate(); + //! + void SetPositive() {sign = POSITIVE;} + //! + void SetNegative() {if (!!(*this)) sign = NEGATIVE;} + + //! + void swap(Integer &a); + //@} + + //! \name UNARY OPERATORS + //@{ + //! + bool operator!() const; + //! + Integer operator+() const {return *this;} + //! + Integer operator-() const; + //! + Integer& operator++(); + //! + Integer& operator--(); + //! + Integer operator++(int) {Integer temp = *this; ++*this; return temp;} + //! + Integer operator--(int) {Integer temp = *this; --*this; return temp;} + //@} + + //! \name BINARY OPERATORS + //@{ + //! signed comparison + /*! \retval -1 if *this < a + \retval 0 if *this = a + \retval 1 if *this > a + */ + int Compare(const Integer& a) const; + + //! + Integer Plus(const Integer &b) const; + //! + Integer Minus(const Integer &b) const; + //! + Integer Times(const Integer &b) const; + //! + Integer DividedBy(const Integer &b) const; + //! + Integer Modulo(const Integer &b) const; + //! + Integer DividedBy(word b) const; + //! + word Modulo(word b) const; + + //! + Integer operator>>(size_t n) const {return Integer(*this)>>=n;} + //! + Integer operator<<(size_t n) const {return Integer(*this)<<=n;} + //@} + + //! \name OTHER ARITHMETIC FUNCTIONS + //@{ + //! + Integer AbsoluteValue() const; + //! + Integer Doubled() const {return Plus(*this);} + //! + Integer Squared() const {return Times(*this);} + //! extract square root, if negative return 0, else return floor of square root + Integer SquareRoot() const; + //! return whether this integer is a perfect square + bool IsSquare() const; + + //! is 1 or -1 + bool IsUnit() const; + //! return inverse if 1 or -1, otherwise return 0 + Integer MultiplicativeInverse() const; + + //! modular multiplication + CRYPTOPP_DLL friend Integer CRYPTOPP_API a_times_b_mod_c(const Integer &x, const Integer& y, const Integer& m); + //! modular exponentiation + CRYPTOPP_DLL friend Integer CRYPTOPP_API a_exp_b_mod_c(const Integer &x, const Integer& e, const Integer& m); + + //! calculate r and q such that (a == d*q + r) && (0 <= r < abs(d)) + static void CRYPTOPP_API Divide(Integer &r, Integer &q, const Integer &a, const Integer &d); + //! use a faster division algorithm when divisor is short + static void CRYPTOPP_API Divide(word &r, Integer &q, const Integer &a, word d); + + //! returns same result as Divide(r, q, a, Power2(n)), but faster + static void CRYPTOPP_API DivideByPowerOf2(Integer &r, Integer &q, const Integer &a, unsigned int n); + + //! greatest common divisor + static Integer CRYPTOPP_API Gcd(const Integer &a, const Integer &n); + //! calculate multiplicative inverse of *this mod n + Integer InverseMod(const Integer &n) const; + //! + word InverseMod(word n) const; + //@} + + //! \name INPUT/OUTPUT + //@{ + //! + friend CRYPTOPP_DLL std::istream& CRYPTOPP_API operator>>(std::istream& in, Integer &a); + //! + friend CRYPTOPP_DLL std::ostream& CRYPTOPP_API operator<<(std::ostream& out, const Integer &a); + //@} + +private: + friend class ModularArithmetic; + friend class MontgomeryRepresentation; + friend class HalfMontgomeryRepresentation; + + Integer(word value, size_t length); + + int PositiveCompare(const Integer &t) const; + friend void PositiveAdd(Integer &sum, const Integer &a, const Integer &b); + friend void PositiveSubtract(Integer &diff, const Integer &a, const Integer &b); + friend void PositiveMultiply(Integer &product, const Integer &a, const Integer &b); + friend void PositiveDivide(Integer &remainder, Integer "ient, const Integer ÷nd, const Integer &divisor); + + IntegerSecBlock reg; + Sign sign; +}; + +//! +inline bool operator==(const CryptoPP::Integer& a, const CryptoPP::Integer& b) {return a.Compare(b)==0;} +//! +inline bool operator!=(const CryptoPP::Integer& a, const CryptoPP::Integer& b) {return a.Compare(b)!=0;} +//! +inline bool operator> (const CryptoPP::Integer& a, const CryptoPP::Integer& b) {return a.Compare(b)> 0;} +//! +inline bool operator>=(const CryptoPP::Integer& a, const CryptoPP::Integer& b) {return a.Compare(b)>=0;} +//! +inline bool operator< (const CryptoPP::Integer& a, const CryptoPP::Integer& b) {return a.Compare(b)< 0;} +//! +inline bool operator<=(const CryptoPP::Integer& a, const CryptoPP::Integer& b) {return a.Compare(b)<=0;} +//! +inline CryptoPP::Integer operator+(const CryptoPP::Integer &a, const CryptoPP::Integer &b) {return a.Plus(b);} +//! +inline CryptoPP::Integer operator-(const CryptoPP::Integer &a, const CryptoPP::Integer &b) {return a.Minus(b);} +//! +inline CryptoPP::Integer operator*(const CryptoPP::Integer &a, const CryptoPP::Integer &b) {return a.Times(b);} +//! +inline CryptoPP::Integer operator/(const CryptoPP::Integer &a, const CryptoPP::Integer &b) {return a.DividedBy(b);} +//! +inline CryptoPP::Integer operator%(const CryptoPP::Integer &a, const CryptoPP::Integer &b) {return a.Modulo(b);} +//! +inline CryptoPP::Integer operator/(const CryptoPP::Integer &a, CryptoPP::word b) {return a.DividedBy(b);} +//! +inline CryptoPP::word operator%(const CryptoPP::Integer &a, CryptoPP::word b) {return a.Modulo(b);} + +NAMESPACE_END + +#ifndef __BORLANDC__ +NAMESPACE_BEGIN(std) +inline void swap(CryptoPP::Integer &a, CryptoPP::Integer &b) +{ + a.swap(b); +} +NAMESPACE_END +#endif + +#endif diff --git a/cryptopp/iterhash.cpp b/cryptopp/iterhash.cpp new file mode 100644 index 0000000..478950c --- /dev/null +++ b/cryptopp/iterhash.cpp @@ -0,0 +1,159 @@ +// iterhash.cpp - written and placed in the public domain by Wei Dai + +#ifndef __GNUC__ +#define CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#endif + +#include "iterhash.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +template void IteratedHashBase::Update(const byte *input, size_t len) +{ + HashWordType oldCountLo = m_countLo, oldCountHi = m_countHi; + if ((m_countLo = oldCountLo + HashWordType(len)) < oldCountLo) + m_countHi++; // carry from low to high + m_countHi += (HashWordType)SafeRightShift<8*sizeof(HashWordType)>(len); + if (m_countHi < oldCountHi || SafeRightShift<2*8*sizeof(HashWordType)>(len) != 0) + throw HashInputTooLong(this->AlgorithmName()); + + unsigned int blockSize = this->BlockSize(); + unsigned int num = ModPowerOf2(oldCountLo, blockSize); + T* dataBuf = this->DataBuf(); + byte* data = (byte *)dataBuf; + + if (num != 0) // process left over data + { + if (num+len >= blockSize) + { + memcpy(data+num, input, blockSize-num); + HashBlock(dataBuf); + input += (blockSize-num); + len -= (blockSize-num); + num = 0; + // drop through and do the rest + } + else + { + memcpy(data+num, input, len); + return; + } + } + + // now process the input data in blocks of blockSize bytes and save the leftovers to m_data + if (len >= blockSize) + { + if (input == data) + { + assert(len == blockSize); + HashBlock(dataBuf); + return; + } + else if (IsAligned(input)) + { + size_t leftOver = HashMultipleBlocks((T *)input, len); + input += (len - leftOver); + len = leftOver; + } + else + do + { // copy input first if it's not aligned correctly + memcpy(data, input, blockSize); + HashBlock(dataBuf); + input+=blockSize; + len-=blockSize; + } while (len >= blockSize); + } + + memcpy(data, input, len); +} + +template byte * IteratedHashBase::CreateUpdateSpace(size_t &size) +{ + unsigned int blockSize = this->BlockSize(); + unsigned int num = ModPowerOf2(m_countLo, blockSize); + size = blockSize - num; + return (byte *)DataBuf() + num; +} + +template size_t IteratedHashBase::HashMultipleBlocks(const T *input, size_t length) +{ + unsigned int blockSize = this->BlockSize(); + bool noReverse = NativeByteOrderIs(this->GetByteOrder()); + T* dataBuf = this->DataBuf(); + do + { + if (noReverse) + this->HashEndianCorrectedBlock(input); + else + { + ByteReverse(dataBuf, input, this->BlockSize()); + this->HashEndianCorrectedBlock(dataBuf); + } + + input += blockSize/sizeof(T); + length -= blockSize; + } + while (length >= blockSize); + return length; +} + +template void IteratedHashBase::PadLastBlock(unsigned int lastBlockSize, byte padFirst) +{ + unsigned int blockSize = this->BlockSize(); + unsigned int num = ModPowerOf2(m_countLo, blockSize); + T* dataBuf = this->DataBuf(); + byte* data = (byte *)dataBuf; + data[num++] = padFirst; + if (num <= lastBlockSize) + memset(data+num, 0, lastBlockSize-num); + else + { + memset(data+num, 0, blockSize-num); + HashBlock(dataBuf); + memset(data, 0, lastBlockSize); + } +} + +template void IteratedHashBase::Restart() +{ + m_countLo = m_countHi = 0; + Init(); +} + +template void IteratedHashBase::TruncatedFinal(byte *digest, size_t size) +{ + this->ThrowIfInvalidTruncatedSize(size); + + T* dataBuf = this->DataBuf(); + T* stateBuf = this->StateBuf(); + unsigned int blockSize = this->BlockSize(); + ByteOrder order = this->GetByteOrder(); + + PadLastBlock(blockSize - 2*sizeof(HashWordType)); + dataBuf[blockSize/sizeof(T)-2+order] = ConditionalByteReverse(order, this->GetBitCountLo()); + dataBuf[blockSize/sizeof(T)-1-order] = ConditionalByteReverse(order, this->GetBitCountHi()); + + HashBlock(dataBuf); + + if (IsAligned(digest) && size%sizeof(HashWordType)==0) + ConditionalByteReverse(order, (HashWordType *)digest, stateBuf, size); + else + { + ConditionalByteReverse(order, stateBuf, stateBuf, this->DigestSize()); + memcpy(digest, stateBuf, size); + } + + this->Restart(); // reinit for next use +} + +#ifdef __GNUC__ + template class IteratedHashBase; + template class IteratedHashBase; + + template class IteratedHashBase; + template class IteratedHashBase; +#endif + +NAMESPACE_END diff --git a/cryptopp/iterhash.h b/cryptopp/iterhash.h new file mode 100644 index 0000000..cce9e82 --- /dev/null +++ b/cryptopp/iterhash.h @@ -0,0 +1,106 @@ +#ifndef CRYPTOPP_ITERHASH_H +#define CRYPTOPP_ITERHASH_H + +#include "cryptlib.h" +#include "secblock.h" +#include "misc.h" +#include "simple.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! exception thrown when trying to hash more data than is allowed by a hash function +class CRYPTOPP_DLL HashInputTooLong : public InvalidDataFormat +{ +public: + explicit HashInputTooLong(const std::string &alg) + : InvalidDataFormat("IteratedHashBase: input data exceeds maximum allowed by hash function " + alg) {} +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE IteratedHashBase : public BASE +{ +public: + typedef T HashWordType; + + IteratedHashBase() : m_countLo(0), m_countHi(0) {} + unsigned int OptimalBlockSize() const {return this->BlockSize();} + unsigned int OptimalDataAlignment() const {return GetAlignmentOf();} + void Update(const byte *input, size_t length); + byte * CreateUpdateSpace(size_t &size); + void Restart(); + void TruncatedFinal(byte *digest, size_t size); + +protected: + inline T GetBitCountHi() const {return (m_countLo >> (8*sizeof(T)-3)) + (m_countHi << 3);} + inline T GetBitCountLo() const {return m_countLo << 3;} + + void PadLastBlock(unsigned int lastBlockSize, byte padFirst=0x80); + virtual void Init() =0; + + virtual ByteOrder GetByteOrder() const =0; + virtual void HashEndianCorrectedBlock(const HashWordType *data) =0; + virtual size_t HashMultipleBlocks(const T *input, size_t length); + void HashBlock(const HashWordType *input) {HashMultipleBlocks(input, this->BlockSize());} + + virtual T* DataBuf() =0; + virtual T* StateBuf() =0; + +private: + T m_countLo, m_countHi; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE IteratedHash : public IteratedHashBase +{ +public: + typedef T_Endianness ByteOrderClass; + typedef T_HashWordType HashWordType; + + CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize) + // BCB2006 workaround: can't use BLOCKSIZE here + CRYPTOPP_COMPILE_ASSERT((T_BlockSize & (T_BlockSize - 1)) == 0); // blockSize is a power of 2 + unsigned int BlockSize() const {return T_BlockSize;} + + ByteOrder GetByteOrder() const {return T_Endianness::ToEnum();} + + inline static void CorrectEndianess(HashWordType *out, const HashWordType *in, size_t byteCount) + { + ConditionalByteReverse(T_Endianness::ToEnum(), out, in, byteCount); + } + +protected: + T_HashWordType* DataBuf() {return this->m_data;} + FixedSizeSecBlock m_data; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform + : public ClonableImpl, T_Transform> > +{ +public: + CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize) + unsigned int DigestSize() const {return DIGESTSIZE;}; + +protected: + IteratedHashWithStaticTransform() {this->Init();} + void HashEndianCorrectedBlock(const T_HashWordType *data) {T_Transform::Transform(this->m_state, data);} + void Init() {T_Transform::InitState(this->m_state);} + + T_HashWordType* StateBuf() {return this->m_state;} + FixedSizeAlignedSecBlock m_state; +}; + +#ifndef __GNUC__ + CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase; + CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase; + + CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase; + CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase; +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/lubyrack.h b/cryptopp/lubyrack.h new file mode 100644 index 0000000..e8fd2f7 --- /dev/null +++ b/cryptopp/lubyrack.h @@ -0,0 +1,141 @@ +// lubyrack.h - written and placed in the public domain by Wei Dai + +#ifndef CRYPTOPP_LUBYRACK_H +#define CRYPTOPP_LUBYRACK_H + +/** \file */ + +#include "simple.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +template struct DigestSizeDoubleWorkaround // VC60 workaround +{ + CRYPTOPP_CONSTANT(RESULT = 2*T::DIGESTSIZE) +}; + +//! algorithm info +template +struct LR_Info : public VariableKeyLength<16, 0, 2*(INT_MAX/2), 2>, public FixedBlockSize::RESULT> +{ + static std::string StaticAlgorithmName() {return std::string("LR/")+T::StaticAlgorithmName();} +}; + +//! Luby-Rackoff +template +class LR : public LR_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl > + { + public: + // VC60 workaround: have to define these functions within class definition + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms) + { + this->AssertValidKeyLength(length); + + L = length/2; + buffer.New(2*S); + digest.New(S); + key.Assign(userKey, 2*L); + } + + protected: + CRYPTOPP_CONSTANT(S=T::DIGESTSIZE) + unsigned int L; // key length / 2 + SecByteBlock key; + + mutable T hm; + mutable SecByteBlock buffer, digest; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + +#define KL this->key +#define KR this->key+this->L +#define BL this->buffer +#define BR this->buffer+this->S +#define IL inBlock +#define IR inBlock+this->S +#define OL outBlock +#define OR outBlock+this->S + + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const + { + this->hm.Update(KL, this->L); + this->hm.Update(IL, this->S); + this->hm.Final(BR); + xorbuf(BR, IR, this->S); + + this->hm.Update(KR, this->L); + this->hm.Update(BR, this->S); + this->hm.Final(BL); + xorbuf(BL, IL, this->S); + + this->hm.Update(KL, this->L); + this->hm.Update(BL, this->S); + this->hm.Final(this->digest); + xorbuf(BR, this->digest, this->S); + + this->hm.Update(KR, this->L); + this->hm.Update(OR, this->S); + this->hm.Final(this->digest); + xorbuf(BL, this->digest, this->S); + + if (xorBlock) + xorbuf(outBlock, xorBlock, this->buffer, 2*this->S); + else + memcpy_s(outBlock, 2*this->S, this->buffer, 2*this->S); + } + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const + { + this->hm.Update(KR, this->L); + this->hm.Update(IR, this->S); + this->hm.Final(BL); + xorbuf(BL, IL, this->S); + + this->hm.Update(KL, this->L); + this->hm.Update(BL, this->S); + this->hm.Final(BR); + xorbuf(BR, IR, this->S); + + this->hm.Update(KR, this->L); + this->hm.Update(BR, this->S); + this->hm.Final(this->digest); + xorbuf(BL, this->digest, this->S); + + this->hm.Update(KL, this->L); + this->hm.Update(OL, this->S); + this->hm.Final(this->digest); + xorbuf(BR, this->digest, this->S); + + if (xorBlock) + xorbuf(outBlock, xorBlock, this->buffer, 2*this->S); + else + memcpy(outBlock, this->buffer, 2*this->S); + } +#undef KL +#undef KR +#undef BL +#undef BR +#undef IL +#undef IR +#undef OL +#undef OR + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/luc.cpp b/cryptopp/luc.cpp new file mode 100644 index 0000000..43cd2ed --- /dev/null +++ b/cryptopp/luc.cpp @@ -0,0 +1,210 @@ +// luc.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "luc.h" +#include "asn.h" +#include "nbtheory.h" +#include "sha.h" +#include "algparam.h" + +NAMESPACE_BEGIN(CryptoPP) + +void LUC_TestInstantiations() +{ + LUC_HMP::Signer t1; + LUCFunction t2; + InvertibleLUCFunction t3; +} + +void DL_Algorithm_LUC_HMP::Sign(const DL_GroupParameters ¶ms, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const +{ + const Integer &q = params.GetSubgroupOrder(); + r = params.ExponentiateBase(k); + s = (k + x*(r+e)) % q; +} + +bool DL_Algorithm_LUC_HMP::Verify(const DL_GroupParameters ¶ms, const DL_PublicKey &publicKey, const Integer &e, const Integer &r, const Integer &s) const +{ + Integer p = params.GetGroupOrder()-1; + const Integer &q = params.GetSubgroupOrder(); + + Integer Vsg = params.ExponentiateBase(s); + Integer Vry = publicKey.ExponentiatePublicElement((r+e)%q); + return (Vsg*Vsg + Vry*Vry + r*r) % p == (Vsg * Vry * r + 4) % p; +} + +Integer DL_BasePrecomputation_LUC::Exponentiate(const DL_GroupPrecomputation &group, const Integer &exponent) const +{ + return Lucas(exponent, m_g, static_cast(group).GetModulus()); +} + +void DL_GroupParameters_LUC::SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const +{ + for (unsigned int i=0; i Integer::One() && m_n.IsOdd(); + pass = pass && m_e > Integer::One() && m_e.IsOdd() && m_e < m_n; + return pass; +} + +bool LUCFunction::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Modulus) + CRYPTOPP_GET_FUNCTION_ENTRY(PublicExponent) + ; +} + +void LUCFunction::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Modulus) + CRYPTOPP_SET_FUNCTION_ENTRY(PublicExponent) + ; +} + +// ***************************************************************************** +// private key operations: + +class LUCPrimeSelector : public PrimeSelector +{ +public: + LUCPrimeSelector(const Integer &e) : m_e(e) {} + bool IsAcceptable(const Integer &candidate) const + { + return RelativelyPrime(m_e, candidate+1) && RelativelyPrime(m_e, candidate-1); + } + Integer m_e; +}; + +void InvertibleLUCFunction::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg) +{ + int modulusSize = 2048; + alg.GetIntValue("ModulusSize", modulusSize) || alg.GetIntValue("KeySize", modulusSize); + + if (modulusSize < 16) + throw InvalidArgument("InvertibleLUCFunction: specified modulus size is too small"); + + m_e = alg.GetValueWithDefault("PublicExponent", Integer(17)); + + if (m_e < 5 || m_e.IsEven()) + throw InvalidArgument("InvertibleLUCFunction: invalid public exponent"); + + LUCPrimeSelector selector(m_e); + AlgorithmParameters primeParam = MakeParametersForTwoPrimesOfEqualSize(modulusSize) + ("PointerToPrimeSelector", selector.GetSelectorPointer()); + m_p.GenerateRandom(rng, primeParam); + m_q.GenerateRandom(rng, primeParam); + + m_n = m_p * m_q; + m_u = m_q.InverseMod(m_p); +} + +void InvertibleLUCFunction::Initialize(RandomNumberGenerator &rng, unsigned int keybits, const Integer &e) +{ + GenerateRandom(rng, MakeParameters("ModulusSize", (int)keybits)("PublicExponent", e)); +} + +void InvertibleLUCFunction::BERDecode(BufferedTransformation &bt) +{ + BERSequenceDecoder seq(bt); + + Integer version(seq); + if (!!version) // make sure version is 0 + BERDecodeError(); + + m_n.BERDecode(seq); + m_e.BERDecode(seq); + m_p.BERDecode(seq); + m_q.BERDecode(seq); + m_u.BERDecode(seq); + seq.MessageEnd(); +} + +void InvertibleLUCFunction::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + + const byte version[] = {INTEGER, 1, 0}; + seq.Put(version, sizeof(version)); + m_n.DEREncode(seq); + m_e.DEREncode(seq); + m_p.DEREncode(seq); + m_q.DEREncode(seq); + m_u.DEREncode(seq); + seq.MessageEnd(); +} + +Integer InvertibleLUCFunction::CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const +{ + // not clear how to do blinding with LUC + DoQuickSanityCheck(); + return InverseLucas(m_e, x, m_q, m_p, m_u); +} + +bool InvertibleLUCFunction::Validate(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = LUCFunction::Validate(rng, level); + pass = pass && m_p > Integer::One() && m_p.IsOdd() && m_p < m_n; + pass = pass && m_q > Integer::One() && m_q.IsOdd() && m_q < m_n; + pass = pass && m_u.IsPositive() && m_u < m_p; + if (level >= 1) + { + pass = pass && m_p * m_q == m_n; + pass = pass && RelativelyPrime(m_e, m_p+1); + pass = pass && RelativelyPrime(m_e, m_p-1); + pass = pass && RelativelyPrime(m_e, m_q+1); + pass = pass && RelativelyPrime(m_e, m_q-1); + pass = pass && m_u * m_q % m_p == 1; + } + if (level >= 2) + pass = pass && VerifyPrime(rng, m_p, level-2) && VerifyPrime(rng, m_q, level-2); + return pass; +} + +bool InvertibleLUCFunction::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Prime1) + CRYPTOPP_GET_FUNCTION_ENTRY(Prime2) + CRYPTOPP_GET_FUNCTION_ENTRY(MultiplicativeInverseOfPrime2ModPrime1) + ; +} + +void InvertibleLUCFunction::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Prime1) + CRYPTOPP_SET_FUNCTION_ENTRY(Prime2) + CRYPTOPP_SET_FUNCTION_ENTRY(MultiplicativeInverseOfPrime2ModPrime1) + ; +} + +NAMESPACE_END diff --git a/cryptopp/luc.h b/cryptopp/luc.h new file mode 100644 index 0000000..730776d --- /dev/null +++ b/cryptopp/luc.h @@ -0,0 +1,236 @@ +#ifndef CRYPTOPP_LUC_H +#define CRYPTOPP_LUC_H + +/** \file +*/ + +#include "pkcspad.h" +#include "oaep.h" +#include "integer.h" +#include "dh.h" + +#include + +NAMESPACE_BEGIN(CryptoPP) + +//! The LUC function. +/*! This class is here for historical and pedagogical interest. It has no + practical advantages over other trapdoor functions and probably shouldn't + be used in production software. The discrete log based LUC schemes + defined later in this .h file may be of more practical interest. +*/ +class LUCFunction : public TrapdoorFunction, public PublicKey +{ + typedef LUCFunction ThisClass; + +public: + void Initialize(const Integer &n, const Integer &e) + {m_n = n; m_e = e;} + + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + Integer ApplyFunction(const Integer &x) const; + Integer PreimageBound() const {return m_n;} + Integer ImageBound() const {return m_n;} + + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + + // non-derived interface + const Integer & GetModulus() const {return m_n;} + const Integer & GetPublicExponent() const {return m_e;} + + void SetModulus(const Integer &n) {m_n = n;} + void SetPublicExponent(const Integer &e) {m_e = e;} + +protected: + Integer m_n, m_e; +}; + +//! _ +class InvertibleLUCFunction : public LUCFunction, public TrapdoorFunctionInverse, public PrivateKey +{ + typedef InvertibleLUCFunction ThisClass; + +public: + void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &eStart=17); + void Initialize(const Integer &n, const Integer &e, const Integer &p, const Integer &q, const Integer &u) + {m_n = n; m_e = e; m_p = p; m_q = q; m_u = u;} + + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const; + + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + /*! parameters: (ModulusSize, PublicExponent (default 17)) */ + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg); + + // non-derived interface + const Integer& GetPrime1() const {return m_p;} + const Integer& GetPrime2() const {return m_q;} + const Integer& GetMultiplicativeInverseOfPrime2ModPrime1() const {return m_u;} + + void SetPrime1(const Integer &p) {m_p = p;} + void SetPrime2(const Integer &q) {m_q = q;} + void SetMultiplicativeInverseOfPrime2ModPrime1(const Integer &u) {m_u = u;} + +protected: + Integer m_p, m_q, m_u; +}; + +struct LUC +{ + static std::string StaticAlgorithmName() {return "LUC";} + typedef LUCFunction PublicKey; + typedef InvertibleLUCFunction PrivateKey; +}; + +//! LUC cryptosystem +template +struct LUCES : public TF_ES +{ +}; + +//! LUC signature scheme with appendix +template +struct LUCSS : public TF_SS +{ +}; + +// analagous to the RSA schemes defined in PKCS #1 v2.0 +typedef LUCES >::Decryptor LUCES_OAEP_SHA_Decryptor; +typedef LUCES >::Encryptor LUCES_OAEP_SHA_Encryptor; + +typedef LUCSS::Signer LUCSSA_PKCS1v15_SHA_Signer; +typedef LUCSS::Verifier LUCSSA_PKCS1v15_SHA_Verifier; + +// ******************************************************** + +// no actual precomputation +class DL_GroupPrecomputation_LUC : public DL_GroupPrecomputation +{ +public: + const AbstractGroup & GetGroup() const {assert(false); throw 0;} + Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);} + void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);} + + // non-inherited + void SetModulus(const Integer &v) {m_p = v;} + const Integer & GetModulus() const {return m_p;} + +private: + Integer m_p; +}; + +//! _ +class DL_BasePrecomputation_LUC : public DL_FixedBasePrecomputation +{ +public: + // DL_FixedBasePrecomputation + bool IsInitialized() const {return m_g.NotZero();} + void SetBase(const DL_GroupPrecomputation &group, const Integer &base) {m_g = base;} + const Integer & GetBase(const DL_GroupPrecomputation &group) const {return m_g;} + void Precompute(const DL_GroupPrecomputation &group, unsigned int maxExpBits, unsigned int storage) {} + void Load(const DL_GroupPrecomputation &group, BufferedTransformation &storedPrecomputation) {} + void Save(const DL_GroupPrecomputation &group, BufferedTransformation &storedPrecomputation) const {} + Integer Exponentiate(const DL_GroupPrecomputation &group, const Integer &exponent) const; + Integer CascadeExponentiate(const DL_GroupPrecomputation &group, const Integer &exponent, const DL_FixedBasePrecomputation &pc2, const Integer &exponent2) const + {throw NotImplemented("DL_BasePrecomputation_LUC: CascadeExponentiate not implemented");} // shouldn't be called + +private: + Integer m_g; +}; + +//! _ +class DL_GroupParameters_LUC : public DL_GroupParameters_IntegerBasedImpl +{ +public: + // DL_GroupParameters + bool IsIdentity(const Integer &element) const {return element == Integer::Two();} + void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const; + Element MultiplyElements(const Element &a, const Element &b) const + {throw NotImplemented("LUC_GroupParameters: MultiplyElements can not be implemented");} + Element CascadeExponentiate(const Element &element1, const Integer &exponent1, const Element &element2, const Integer &exponent2) const + {throw NotImplemented("LUC_GroupParameters: MultiplyElements can not be implemented");} + + // NameValuePairs interface + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const + { + return GetValueHelper(this, name, valueType, pValue).Assignable(); + } + +private: + int GetFieldType() const {return 2;} +}; + +//! _ +class DL_GroupParameters_LUC_DefaultSafePrime : public DL_GroupParameters_LUC +{ +public: + typedef NoCofactorMultiplication DefaultCofactorOption; + +protected: + unsigned int GetDefaultSubgroupOrderSize(unsigned int modulusSize) const {return modulusSize-1;} +}; + +//! _ +class DL_Algorithm_LUC_HMP : public DL_ElgamalLikeSignatureAlgorithm +{ +public: + static const char * StaticAlgorithmName() {return "LUC-HMP";} + + void Sign(const DL_GroupParameters ¶ms, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const; + bool Verify(const DL_GroupParameters ¶ms, const DL_PublicKey &publicKey, const Integer &e, const Integer &r, const Integer &s) const; + + size_t RLen(const DL_GroupParameters ¶ms) const + {return params.GetGroupOrder().ByteCount();} +}; + +//! _ +struct DL_SignatureKeys_LUC +{ + typedef DL_GroupParameters_LUC GroupParameters; + typedef DL_PublicKey_GFP PublicKey; + typedef DL_PrivateKey_GFP PrivateKey; +}; + +//! LUC-HMP, based on "Digital signature schemes based on Lucas functions" by Patrick Horster, Markus Michels, Holger Petersen +template +struct LUC_HMP : public DL_SS +{ +}; + +//! _ +struct DL_CryptoKeys_LUC +{ + typedef DL_GroupParameters_LUC_DefaultSafePrime GroupParameters; + typedef DL_PublicKey_GFP PublicKey; + typedef DL_PrivateKey_GFP PrivateKey; +}; + +//! LUC-IES +template +struct LUC_IES + : public DL_ES< + DL_CryptoKeys_LUC, + DL_KeyAgreementAlgorithm_DH, + DL_KeyDerivationAlgorithm_P1363 >, + DL_EncryptionAlgorithm_Xor, DHAES_MODE>, + LUC_IES<> > +{ + static std::string StaticAlgorithmName() {return "LUC-IES";} // non-standard name +}; + +// ******************************************************** + +//! LUC-DH +typedef DH_Domain LUC_DH; + +NAMESPACE_END + +#endif diff --git a/cryptopp/mars.cpp b/cryptopp/mars.cpp new file mode 100644 index 0000000..06811b5 --- /dev/null +++ b/cryptopp/mars.cpp @@ -0,0 +1,210 @@ +// mars.cpp - modified by Sean Woods from Brian Gladman's mars6.c for Crypto++ +// key setup updated by Wei Dai to reflect IBM's "tweak" proposed in August 1999 + +/* This is an independent implementation of the MARS encryption */ +/* algorithm designed by a team at IBM as a candidate for the US */ +/* NIST Advanced Encryption Standard (AES) effort. The algorithm */ +/* is subject to Patent action by IBM, who intend to offer royalty */ +/* free use if a Patent is granted. */ +/* */ +/* Copyright in this implementation is held by Dr B R Gladman but */ +/* I hereby give permission for its free direct or derivative use */ +/* subject to acknowledgment of its origin and compliance with any */ +/* constraints that IBM place on the use of the MARS algorithm. */ +/* */ +/* Dr Brian Gladman (gladman@seven77.demon.co.uk) 4th October 1998 */ + +#include "pch.h" +#include "mars.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +ANONYMOUS_NAMESPACE_BEGIN +static word32 gen_mask(word32 x) +{ + word32 m; + + m = (~x ^ (x >> 1)) & 0x7fffffff; + m &= (m >> 1) & (m >> 2); m &= (m >> 3) & (m >> 6); + + if(!m) + return 0; + + m <<= 1; m |= (m << 1); m |= (m << 2); m |= (m << 4); + m |= (m << 1) & ~x & 0x80000000; + + return m & 0xfffffffc; +}; +NAMESPACE_END + +void MARS::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &) +{ + AssertValidKeyLength(length); + + // Initialize T[] with the key data + FixedSizeSecBlock T; + GetUserKey(LITTLE_ENDIAN_ORDER, T.begin(), 15, userKey, length); + T[length/4] = length/4; + + for (unsigned int j=0; j<4; j++) // compute 10 words of K[] in each iteration + { + unsigned int i; + // Do linear transformation + for (i=0; i<15; i++) + T[i] = T[i] ^ rotlFixed(T[(i+8)%15] ^ T[(i+13)%15], 3) ^ (4*i+j); + + // Do four rounds of stirring + for (unsigned int k=0; k<4; k++) + for (i=0; i<15; i++) + T[i] = rotlFixed(T[i] + Sbox[T[(i+14)%15]%512], 9); + + // Store next 10 key words into K[] + for (i=0; i<10; i++) + EK[10*j+i] = T[4*i%15]; + } + + // Modify multiplication key-words + for(unsigned int i = 5; i < 37; i += 2) + { + word32 w = EK[i] | 3; + word32 m = gen_mask(w); + if(m) + w ^= (rotlMod(Sbox[265 + (EK[i] & 3)], EK[i-1]) & m); + EK[i] = w; + } +} + +#define f_mix(a,b,c,d) \ + r = rotrFixed(a, 8); \ + b ^= Sbox[a & 255]; \ + b += Sbox[(r & 255) + 256]; \ + r = rotrFixed(a, 16); \ + a = rotrFixed(a, 24); \ + c += Sbox[r & 255]; \ + d ^= Sbox[(a & 255) + 256] + +#define b_mix(a,b,c,d) \ + r = rotlFixed(a, 8); \ + b ^= Sbox[(a & 255) + 256]; \ + c -= Sbox[r & 255]; \ + r = rotlFixed(a, 16); \ + a = rotlFixed(a, 24); \ + d -= Sbox[(r & 255) + 256]; \ + d ^= Sbox[a & 255] + +#define f_ktr(a,b,c,d,i) \ + m = a + EK[i]; \ + a = rotlFixed(a, 13); \ + r = a * EK[i + 1]; \ + l = Sbox[m & 511]; \ + r = rotlFixed(r, 5); \ + l ^= r; \ + c += rotlMod(m, r); \ + r = rotlFixed(r, 5); \ + l ^= r; \ + d ^= r; \ + b += rotlMod(l, r) + +#define r_ktr(a,b,c,d,i) \ + r = a * EK[i + 1]; \ + a = rotrFixed(a, 13); \ + m = a + EK[i]; \ + l = Sbox[m & 511]; \ + r = rotlFixed(r, 5); \ + l ^= r; \ + c -= rotlMod(m, r); \ + r = rotlFixed(r, 5); \ + l ^= r; \ + d ^= r; \ + b -= rotlMod(l, r) + +typedef BlockGetAndPut Block; + +void MARS::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 a, b, c, d, l, m, r; + + Block::Get(inBlock)(a)(b)(c)(d); + + a += EK[0]; + b += EK[1]; + c += EK[2]; + d += EK[3]; + + int i; + for (i = 0; i < 2; i++) { + f_mix(a,b,c,d); + a += d; + f_mix(b,c,d,a); + b += c; + f_mix(c,d,a,b); + f_mix(d,a,b,c); + } + + f_ktr(a,b,c,d, 4); f_ktr(b,c,d,a, 6); f_ktr(c,d,a,b, 8); f_ktr(d,a,b,c,10); + f_ktr(a,b,c,d,12); f_ktr(b,c,d,a,14); f_ktr(c,d,a,b,16); f_ktr(d,a,b,c,18); + f_ktr(a,d,c,b,20); f_ktr(b,a,d,c,22); f_ktr(c,b,a,d,24); f_ktr(d,c,b,a,26); + f_ktr(a,d,c,b,28); f_ktr(b,a,d,c,30); f_ktr(c,b,a,d,32); f_ktr(d,c,b,a,34); + + for (i = 0; i < 2; i++) { + b_mix(a,b,c,d); + b_mix(b,c,d,a); + c -= b; + b_mix(c,d,a,b); + d -= a; + b_mix(d,a,b,c); + } + + a -= EK[36]; + b -= EK[37]; + c -= EK[38]; + d -= EK[39]; + + Block::Put(xorBlock, outBlock)(a)(b)(c)(d); +} + +void MARS::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 a, b, c, d, l, m, r; + + Block::Get(inBlock)(d)(c)(b)(a); + + d += EK[36]; + c += EK[37]; + b += EK[38]; + a += EK[39]; + + int i; + for (i = 0; i < 2; i++) { + f_mix(a,b,c,d); + a += d; + f_mix(b,c,d,a); + b += c; + f_mix(c,d,a,b); + f_mix(d,a,b,c); + } + + r_ktr(a,b,c,d,34); r_ktr(b,c,d,a,32); r_ktr(c,d,a,b,30); r_ktr(d,a,b,c,28); + r_ktr(a,b,c,d,26); r_ktr(b,c,d,a,24); r_ktr(c,d,a,b,22); r_ktr(d,a,b,c,20); + r_ktr(a,d,c,b,18); r_ktr(b,a,d,c,16); r_ktr(c,b,a,d,14); r_ktr(d,c,b,a,12); + r_ktr(a,d,c,b,10); r_ktr(b,a,d,c, 8); r_ktr(c,b,a,d, 6); r_ktr(d,c,b,a, 4); + + for (i = 0; i < 2; i++) { + b_mix(a,b,c,d); + b_mix(b,c,d,a); + c -= b; + b_mix(c,d,a,b); + d -= a; + b_mix(d,a,b,c); + } + + d -= EK[0]; + c -= EK[1]; + b -= EK[2]; + a -= EK[3]; + + Block::Put(xorBlock, outBlock)(d)(c)(b)(a); +} + +NAMESPACE_END diff --git a/cryptopp/mars.h b/cryptopp/mars.h new file mode 100644 index 0000000..ad0cd36 --- /dev/null +++ b/cryptopp/mars.h @@ -0,0 +1,54 @@ +#ifndef CRYPTOPP_MARS_H +#define CRYPTOPP_MARS_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct MARS_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 56, 4> +{ + static const char *StaticAlgorithmName() {return "MARS";} +}; + +/// MARS +class MARS : public MARS_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + static const word32 Sbox[512]; + + FixedSizeSecBlock EK; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef MARS::Encryption MARSEncryption; +typedef MARS::Decryption MARSDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/marss.cpp b/cryptopp/marss.cpp new file mode 100644 index 0000000..7c38f14 --- /dev/null +++ b/cryptopp/marss.cpp @@ -0,0 +1,139 @@ +// MARS S-Box + +#include "pch.h" +#include "mars.h" + +NAMESPACE_BEGIN(CryptoPP) + +const word32 MARS::Base::Sbox[512] = { + 0x09d0c479, 0x28c8ffe0, 0x84aa6c39, 0x9dad7287, + 0x7dff9be3, 0xd4268361, 0xc96da1d4, 0x7974cc93, + 0x85d0582e, 0x2a4b5705, 0x1ca16a62, 0xc3bd279d, + 0x0f1f25e5, 0x5160372f, 0xc695c1fb, 0x4d7ff1e4, + 0xae5f6bf4, 0x0d72ee46, 0xff23de8a, 0xb1cf8e83, + 0xf14902e2, 0x3e981e42, 0x8bf53eb6, 0x7f4bf8ac, + 0x83631f83, 0x25970205, 0x76afe784, 0x3a7931d4, + 0x4f846450, 0x5c64c3f6, 0x210a5f18, 0xc6986a26, + 0x28f4e826, 0x3a60a81c, 0xd340a664, 0x7ea820c4, + 0x526687c5, 0x7eddd12b, 0x32a11d1d, 0x9c9ef086, + 0x80f6e831, 0xab6f04ad, 0x56fb9b53, 0x8b2e095c, + 0xb68556ae, 0xd2250b0d, 0x294a7721, 0xe21fb253, + 0xae136749, 0xe82aae86, 0x93365104, 0x99404a66, + 0x78a784dc, 0xb69ba84b, 0x04046793, 0x23db5c1e, + 0x46cae1d6, 0x2fe28134, 0x5a223942, 0x1863cd5b, + 0xc190c6e3, 0x07dfb846, 0x6eb88816, 0x2d0dcc4a, + 0xa4ccae59, 0x3798670d, 0xcbfa9493, 0x4f481d45, + 0xeafc8ca8, 0xdb1129d6, 0xb0449e20, 0x0f5407fb, + 0x6167d9a8, 0xd1f45763, 0x4daa96c3, 0x3bec5958, + 0xababa014, 0xb6ccd201, 0x38d6279f, 0x02682215, + 0x8f376cd5, 0x092c237e, 0xbfc56593, 0x32889d2c, + 0x854b3e95, 0x05bb9b43, 0x7dcd5dcd, 0xa02e926c, + 0xfae527e5, 0x36a1c330, 0x3412e1ae, 0xf257f462, + 0x3c4f1d71, 0x30a2e809, 0x68e5f551, 0x9c61ba44, + 0x5ded0ab8, 0x75ce09c8, 0x9654f93e, 0x698c0cca, + 0x243cb3e4, 0x2b062b97, 0x0f3b8d9e, 0x00e050df, + 0xfc5d6166, 0xe35f9288, 0xc079550d, 0x0591aee8, + 0x8e531e74, 0x75fe3578, 0x2f6d829a, 0xf60b21ae, + 0x95e8eb8d, 0x6699486b, 0x901d7d9b, 0xfd6d6e31, + 0x1090acef, 0xe0670dd8, 0xdab2e692, 0xcd6d4365, + 0xe5393514, 0x3af345f0, 0x6241fc4d, 0x460da3a3, + 0x7bcf3729, 0x8bf1d1e0, 0x14aac070, 0x1587ed55, + 0x3afd7d3e, 0xd2f29e01, 0x29a9d1f6, 0xefb10c53, + 0xcf3b870f, 0xb414935c, 0x664465ed, 0x024acac7, + 0x59a744c1, 0x1d2936a7, 0xdc580aa6, 0xcf574ca8, + 0x040a7a10, 0x6cd81807, 0x8a98be4c, 0xaccea063, + 0xc33e92b5, 0xd1e0e03d, 0xb322517e, 0x2092bd13, + 0x386b2c4a, 0x52e8dd58, 0x58656dfb, 0x50820371, + 0x41811896, 0xe337ef7e, 0xd39fb119, 0xc97f0df6, + 0x68fea01b, 0xa150a6e5, 0x55258962, 0xeb6ff41b, + 0xd7c9cd7a, 0xa619cd9e, 0xbcf09576, 0x2672c073, + 0xf003fb3c, 0x4ab7a50b, 0x1484126a, 0x487ba9b1, + 0xa64fc9c6, 0xf6957d49, 0x38b06a75, 0xdd805fcd, + 0x63d094cf, 0xf51c999e, 0x1aa4d343, 0xb8495294, + 0xce9f8e99, 0xbffcd770, 0xc7c275cc, 0x378453a7, + 0x7b21be33, 0x397f41bd, 0x4e94d131, 0x92cc1f98, + 0x5915ea51, 0x99f861b7, 0xc9980a88, 0x1d74fd5f, + 0xb0a495f8, 0x614deed0, 0xb5778eea, 0x5941792d, + 0xfa90c1f8, 0x33f824b4, 0xc4965372, 0x3ff6d550, + 0x4ca5fec0, 0x8630e964, 0x5b3fbbd6, 0x7da26a48, + 0xb203231a, 0x04297514, 0x2d639306, 0x2eb13149, + 0x16a45272, 0x532459a0, 0x8e5f4872, 0xf966c7d9, + 0x07128dc0, 0x0d44db62, 0xafc8d52d, 0x06316131, + 0xd838e7ce, 0x1bc41d00, 0x3a2e8c0f, 0xea83837e, + 0xb984737d, 0x13ba4891, 0xc4f8b949, 0xa6d6acb3, + 0xa215cdce, 0x8359838b, 0x6bd1aa31, 0xf579dd52, + 0x21b93f93, 0xf5176781, 0x187dfdde, 0xe94aeb76, + 0x2b38fd54, 0x431de1da, 0xab394825, 0x9ad3048f, + 0xdfea32aa, 0x659473e3, 0x623f7863, 0xf3346c59, + 0xab3ab685, 0x3346a90b, 0x6b56443e, 0xc6de01f8, + 0x8d421fc0, 0x9b0ed10c, 0x88f1a1e9, 0x54c1f029, + 0x7dead57b, 0x8d7ba426, 0x4cf5178a, 0x551a7cca, + 0x1a9a5f08, 0xfcd651b9, 0x25605182, 0xe11fc6c3, + 0xb6fd9676, 0x337b3027, 0xb7c8eb14, 0x9e5fd030, + 0x6b57e354, 0xad913cf7, 0x7e16688d, 0x58872a69, + 0x2c2fc7df, 0xe389ccc6, 0x30738df1, 0x0824a734, + 0xe1797a8b, 0xa4a8d57b, 0x5b5d193b, 0xc8a8309b, + 0x73f9a978, 0x73398d32, 0x0f59573e, 0xe9df2b03, + 0xe8a5b6c8, 0x848d0704, 0x98df93c2, 0x720a1dc3, + 0x684f259a, 0x943ba848, 0xa6370152, 0x863b5ea3, + 0xd17b978b, 0x6d9b58ef, 0x0a700dd4, 0xa73d36bf, + 0x8e6a0829, 0x8695bc14, 0xe35b3447, 0x933ac568, + 0x8894b022, 0x2f511c27, 0xddfbcc3c, 0x006662b6, + 0x117c83fe, 0x4e12b414, 0xc2bca766, 0x3a2fec10, + 0xf4562420, 0x55792e2a, 0x46f5d857, 0xceda25ce, + 0xc3601d3b, 0x6c00ab46, 0xefac9c28, 0xb3c35047, + 0x611dfee3, 0x257c3207, 0xfdd58482, 0x3b14d84f, + 0x23becb64, 0xa075f3a3, 0x088f8ead, 0x07adf158, + 0x7796943c, 0xfacabf3d, 0xc09730cd, 0xf7679969, + 0xda44e9ed, 0x2c854c12, 0x35935fa3, 0x2f057d9f, + 0x690624f8, 0x1cb0bafd, 0x7b0dbdc6, 0x810f23bb, + 0xfa929a1a, 0x6d969a17, 0x6742979b, 0x74ac7d05, + 0x010e65c4, 0x86a3d963, 0xf907b5a0, 0xd0042bd3, + 0x158d7d03, 0x287a8255, 0xbba8366f, 0x096edc33, + 0x21916a7b, 0x77b56b86, 0x951622f9, 0xa6c5e650, + 0x8cea17d1, 0xcd8c62bc, 0xa3d63433, 0x358a68fd, + 0x0f9b9d3c, 0xd6aa295b, 0xfe33384a, 0xc000738e, + 0xcd67eb2f, 0xe2eb6dc2, 0x97338b02, 0x06c9f246, + 0x419cf1ad, 0x2b83c045, 0x3723f18a, 0xcb5b3089, + 0x160bead7, 0x5d494656, 0x35f8a74b, 0x1e4e6c9e, + 0x000399bd, 0x67466880, 0xb4174831, 0xacf423b2, + 0xca815ab3, 0x5a6395e7, 0x302a67c5, 0x8bdb446b, + 0x108f8fa4, 0x10223eda, 0x92b8b48b, 0x7f38d0ee, + 0xab2701d4, 0x0262d415, 0xaf224a30, 0xb3d88aba, + 0xf8b2c3af, 0xdaf7ef70, 0xcc97d3b7, 0xe9614b6c, + 0x2baebff4, 0x70f687cf, 0x386c9156, 0xce092ee5, + 0x01e87da6, 0x6ce91e6a, 0xbb7bcc84, 0xc7922c20, + 0x9d3b71fd, 0x060e41c6, 0xd7590f15, 0x4e03bb47, + 0x183c198e, 0x63eeb240, 0x2ddbf49a, 0x6d5cba54, + 0x923750af, 0xf9e14236, 0x7838162b, 0x59726c72, + 0x81b66760, 0xbb2926c1, 0x48a0ce0d, 0xa6c0496d, + 0xad43507b, 0x718d496a, 0x9df057af, 0x44b1bde6, + 0x054356dc, 0xde7ced35, 0xd51a138b, 0x62088cc9, + 0x35830311, 0xc96efca2, 0x686f86ec, 0x8e77cb68, + 0x63e1d6b8, 0xc80f9778, 0x79c491fd, 0x1b4c67f2, + 0x72698d7d, 0x5e368c31, 0xf7d95e2e, 0xa1d3493f, + 0xdcd9433e, 0x896f1552, 0x4bc4ca7a, 0xa6d1baf4, + 0xa5a96dcc, 0x0bef8b46, 0xa169fda7, 0x74df40b7, + 0x4e208804, 0x9a756607, 0x038e87c8, 0x20211e44, + 0x8b7ad4bf, 0xc6403f35, 0x1848e36d, 0x80bdb038, + 0x1e62891c, 0x643d2107, 0xbf04d6f8, 0x21092c8c, + 0xf644f389, 0x0778404e, 0x7b78adb8, 0xa2c52d53, + 0x42157abe, 0xa2253e2e, 0x7bf3f4ae, 0x80f594f9, + 0x953194e7, 0x77eb92ed, 0xb3816930, 0xda8d9336, + 0xbf447469, 0xf26d9483, 0xee6faed5, 0x71371235, + 0xde425f73, 0xb4e59f43, 0x7dbe2d4e, 0x2d37b185, + 0x49dc9a63, 0x98c39d98, 0x1301c9a2, 0x389b1bbf, + 0x0c18588d, 0xa421c1ba, 0x7aa3865c, 0x71e08558, + 0x3c5cfcaa, 0x7d239ca4, 0x0297d9dd, 0xd7dc2830, + 0x4b37802b, 0x7428ab54, 0xaeee0347, 0x4b3fbb85, + 0x692f2f08, 0x134e578e, 0x36d9e0bf, 0xae8b5fcf, + 0xedb93ecf, 0x2b27248e, 0x170eb1ef, 0x7dc57fd6, + 0x1e760f16, 0xb1136601, 0x864e1b9b, 0xd7ea7319, + 0x3ab871bd, 0xcfa4d76f, 0xe31bd782, 0x0dbeb469, + 0xabb96061, 0x5370f85d, 0xffb07e37, 0xda30d0fb, + 0xebc977b6, 0x0b98b40f, 0x3a4d0fe6, 0xdf4fc26b, + 0x159cf22a, 0xc298d6e2, 0x2b78ef6a, 0x61a94ac0, + 0xab561187, 0x14eea0f0, 0xdf0d4164, 0x19af70ee +}; + +NAMESPACE_END diff --git a/cryptopp/md2.cpp b/cryptopp/md2.cpp new file mode 100644 index 0000000..41f714b --- /dev/null +++ b/cryptopp/md2.cpp @@ -0,0 +1,120 @@ +// md2.cpp - modified by Wei Dai from Andrew M. Kuchling's md2.c +// The original code and all modifications are in the public domain. + +// This is the original introductory comment: + +/* + * md2.c : MD2 hash algorithm. + * + * Part of the Python Cryptography Toolkit, version 1.1 + * + * Distribute and use freely; there are no restrictions on further + * dissemination and usage except those imposed by the laws of your + * country of residence. + * + */ + +#include "pch.h" +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 +#include "md2.h" + +NAMESPACE_BEGIN(CryptoPP) +namespace Weak1 { + +MD2::MD2() + : m_X(48), m_C(16), m_buf(16) +{ + Init(); +} + +void MD2::Init() +{ + memset(m_X, 0, 48); + memset(m_C, 0, 16); + memset(m_buf, 0, 16); + m_count = 0; +} + +void MD2::Update(const byte *buf, size_t len) +{ + static const byte S[256] = { + 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, + 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, + 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, + 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, + 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, + 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, + 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, + 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, + 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, + 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, + 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, + 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, + 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, + 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, + 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, + 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, + 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, + 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 + }; + + while (len) + { + unsigned int L = UnsignedMin(16U-m_count, len); + memcpy(m_buf+m_count, buf, L); + m_count+=L; + buf+=L; + len-=L; + if (m_count==16) + { + byte t; + int i,j; + + m_count=0; + memcpy(m_X+16, m_buf, 16); + t=m_C[15]; + for(i=0; i<16; i++) + { + m_X[32+i]=m_X[16+i]^m_X[i]; + t=m_C[i]^=S[m_buf[i]^t]; + } + + t=0; + for(i=0; i<18; i++) + { + for(j=0; j<48; j+=8) + { + t=m_X[j+0]^=S[t]; + t=m_X[j+1]^=S[t]; + t=m_X[j+2]^=S[t]; + t=m_X[j+3]^=S[t]; + t=m_X[j+4]^=S[t]; + t=m_X[j+5]^=S[t]; + t=m_X[j+6]^=S[t]; + t=m_X[j+7]^=S[t]; + } + t=(t+i) & 0xFF; + } + } + } +} + +void MD2::TruncatedFinal(byte *hash, size_t size) +{ + ThrowIfInvalidTruncatedSize(size); + + byte padding[16]; + word32 padlen; + unsigned int i; + + padlen= 16-m_count; + for(i=0; iMD2 +class MD2 : public HashTransformation +{ +public: + MD2(); + void Update(const byte *input, size_t length); + void TruncatedFinal(byte *hash, size_t size); + unsigned int DigestSize() const {return DIGESTSIZE;} + unsigned int BlockSize() const {return BLOCKSIZE;} + static const char * StaticAlgorithmName() {return "MD2";} + + CRYPTOPP_CONSTANT(DIGESTSIZE = 16) + CRYPTOPP_CONSTANT(BLOCKSIZE = 16) + +private: + void Transform(); + void Init(); + SecByteBlock m_X, m_C, m_buf; + unsigned int m_count; +}; + +} +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak +#else +using namespace Weak1; // import Weak1 into CryptoPP with warning +#ifdef __GNUC__ +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." +#else +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") +#endif +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/md4.cpp b/cryptopp/md4.cpp new file mode 100644 index 0000000..9ed639c --- /dev/null +++ b/cryptopp/md4.cpp @@ -0,0 +1,110 @@ +// md4.cpp - modified by Wei Dai from Andrew M. Kuchling's md4.c +// The original code and all modifications are in the public domain. + +// This is the original introductory comment: + +/* + * md4.c : MD4 hash algorithm. + * + * Part of the Python Cryptography Toolkit, version 1.1 + * + * Distribute and use freely; there are no restrictions on further + * dissemination and usage except those imposed by the laws of your + * country of residence. + * + */ + +#include "pch.h" +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 +#include "md4.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) +namespace Weak1 { + +void MD4::InitState(HashWordType *state) +{ + state[0] = 0x67452301L; + state[1] = 0xefcdab89L; + state[2] = 0x98badcfeL; + state[3] = 0x10325476L; +} + +void MD4::Transform (word32 *digest, const word32 *in) +{ +// #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) + + word32 A, B, C, D; + + A=digest[0]; + B=digest[1]; + C=digest[2]; + D=digest[3]; + +#define function(a,b,c,d,k,s) a=rotlFixed(a+F(b,c,d)+in[k],s); + function(A,B,C,D, 0, 3); + function(D,A,B,C, 1, 7); + function(C,D,A,B, 2,11); + function(B,C,D,A, 3,19); + function(A,B,C,D, 4, 3); + function(D,A,B,C, 5, 7); + function(C,D,A,B, 6,11); + function(B,C,D,A, 7,19); + function(A,B,C,D, 8, 3); + function(D,A,B,C, 9, 7); + function(C,D,A,B,10,11); + function(B,C,D,A,11,19); + function(A,B,C,D,12, 3); + function(D,A,B,C,13, 7); + function(C,D,A,B,14,11); + function(B,C,D,A,15,19); + +#undef function +#define function(a,b,c,d,k,s) a=rotlFixed(a+G(b,c,d)+in[k]+0x5a827999,s); + function(A,B,C,D, 0, 3); + function(D,A,B,C, 4, 5); + function(C,D,A,B, 8, 9); + function(B,C,D,A,12,13); + function(A,B,C,D, 1, 3); + function(D,A,B,C, 5, 5); + function(C,D,A,B, 9, 9); + function(B,C,D,A,13,13); + function(A,B,C,D, 2, 3); + function(D,A,B,C, 6, 5); + function(C,D,A,B,10, 9); + function(B,C,D,A,14,13); + function(A,B,C,D, 3, 3); + function(D,A,B,C, 7, 5); + function(C,D,A,B,11, 9); + function(B,C,D,A,15,13); + +#undef function +#define function(a,b,c,d,k,s) a=rotlFixed(a+H(b,c,d)+in[k]+0x6ed9eba1,s); + function(A,B,C,D, 0, 3); + function(D,A,B,C, 8, 9); + function(C,D,A,B, 4,11); + function(B,C,D,A,12,15); + function(A,B,C,D, 2, 3); + function(D,A,B,C,10, 9); + function(C,D,A,B, 6,11); + function(B,C,D,A,14,15); + function(A,B,C,D, 1, 3); + function(D,A,B,C, 9, 9); + function(C,D,A,B, 5,11); + function(B,C,D,A,13,15); + function(A,B,C,D, 3, 3); + function(D,A,B,C,11, 9); + function(C,D,A,B, 7,11); + function(B,C,D,A,15,15); + + digest[0]+=A; + digest[1]+=B; + digest[2]+=C; + digest[3]+=D; +} + +} +NAMESPACE_END diff --git a/cryptopp/md4.h b/cryptopp/md4.h new file mode 100644 index 0000000..5338700 --- /dev/null +++ b/cryptopp/md4.h @@ -0,0 +1,35 @@ +#ifndef CRYPTOPP_MD4_H +#define CRYPTOPP_MD4_H + +#include "iterhash.h" + +NAMESPACE_BEGIN(CryptoPP) + +namespace Weak1 { + +//! MD4 +/*! \warning MD4 is considered insecure, and should not be used + unless you absolutely need it for compatibility. */ +class MD4 : public IteratedHashWithStaticTransform +{ +public: + static void InitState(HashWordType *state); + static void Transform(word32 *digest, const word32 *data); + static const char *StaticAlgorithmName() {return "MD4";} +}; + +} +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak +#else +using namespace Weak1; // import Weak1 into CryptoPP with warning +#ifdef __GNUC__ +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." +#else +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") +#endif +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/md5.cpp b/cryptopp/md5.cpp new file mode 100644 index 0000000..a522978 --- /dev/null +++ b/cryptopp/md5.cpp @@ -0,0 +1,118 @@ +// md5.cpp - modified by Wei Dai from Colin Plumb's public domain md5.c +// any modifications are placed in the public domain + +#include "pch.h" +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 +#include "md5.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) +namespace Weak1 { + +void MD5_TestInstantiations() +{ + MD5 x; +} + +void MD5::InitState(HashWordType *state) +{ + state[0] = 0x67452301L; + state[1] = 0xefcdab89L; + state[2] = 0x98badcfeL; + state[3] = 0x10325476L; +} + +void MD5::Transform (word32 *digest, const word32 *in) +{ +// #define F1(x, y, z) (x & y | ~x & z) +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +#define MD5STEP(f, w, x, y, z, data, s) \ + w = rotlFixed(w + f(x, y, z) + data, s) + x + + word32 a, b, c, d; + + a=digest[0]; + b=digest[1]; + c=digest[2]; + d=digest[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + digest[0]+=a; + digest[1]+=b; + digest[2]+=c; + digest[3]+=d; +} + +} +NAMESPACE_END diff --git a/cryptopp/md5.h b/cryptopp/md5.h new file mode 100644 index 0000000..73ec532 --- /dev/null +++ b/cryptopp/md5.h @@ -0,0 +1,33 @@ +#ifndef CRYPTOPP_MD5_H +#define CRYPTOPP_MD5_H + +#include "iterhash.h" + +NAMESPACE_BEGIN(CryptoPP) + +namespace Weak1 { + +//! MD5 +class MD5 : public IteratedHashWithStaticTransform +{ +public: + static void InitState(HashWordType *state); + static void Transform(word32 *digest, const word32 *data); + static const char * StaticAlgorithmName() {return "MD5";} +}; + +} +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak +#else +using namespace Weak1; // import Weak1 into CryptoPP with warning +#ifdef __GNUC__ +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." +#else +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") +#endif +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/mdc.h b/cryptopp/mdc.h new file mode 100644 index 0000000..cc90cdc --- /dev/null +++ b/cryptopp/mdc.h @@ -0,0 +1,72 @@ + // mdc.h - written and placed in the public domain by Wei Dai + +#ifndef CRYPTOPP_MDC_H +#define CRYPTOPP_MDC_H + +/** \file +*/ + +#include "seckey.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +template +struct MDC_Info : public FixedBlockSize, public FixedKeyLength +{ + static std::string StaticAlgorithmName() {return std::string("MDC/")+T::StaticAlgorithmName();} +}; + +//! MDC +/*! a construction by Peter Gutmann to turn an iterated hash function into a PRF */ +template +class MDC : public MDC_Info +{ + class CRYPTOPP_NO_VTABLE Enc : public BlockCipherImpl > + { + typedef typename T::HashWordType HashWordType; + + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms) + { + this->AssertValidKeyLength(length); + memcpy_s(m_key, m_key.size(), userKey, this->KEYLENGTH); + T::CorrectEndianess(Key(), Key(), this->KEYLENGTH); + } + + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const + { + T::CorrectEndianess(Buffer(), (HashWordType *)inBlock, this->BLOCKSIZE); + T::Transform(Buffer(), Key()); + if (xorBlock) + { + T::CorrectEndianess(Buffer(), Buffer(), this->BLOCKSIZE); + xorbuf(outBlock, xorBlock, m_buffer, this->BLOCKSIZE); + } + else + T::CorrectEndianess((HashWordType *)outBlock, Buffer(), this->BLOCKSIZE); + } + + bool IsPermutation() const {return false;} + + unsigned int OptimalDataAlignment() const {return sizeof(HashWordType);} + + private: + HashWordType *Key() {return (HashWordType *)m_key.data();} + const HashWordType *Key() const {return (const HashWordType *)m_key.data();} + HashWordType *Buffer() const {return (HashWordType *)m_buffer.data();} + + // VC60 workaround: bug triggered if using FixedSizeAllocatorWithCleanup + FixedSizeSecBlock::KEYLENGTH, AllocatorWithCleanup > m_key; + mutable FixedSizeSecBlock::BLOCKSIZE, AllocatorWithCleanup > m_buffer; + }; + +public: + //! use BlockCipher interface + typedef BlockCipherFinal Encryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/misc.cpp b/cryptopp/misc.cpp new file mode 100644 index 0000000..7e4fa89 --- /dev/null +++ b/cryptopp/misc.cpp @@ -0,0 +1,130 @@ +// misc.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "misc.h" +#include "words.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +void xorbuf(byte *buf, const byte *mask, size_t count) +{ + size_t i; + + if (IsAligned(buf) && IsAligned(mask)) + { + if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned(buf) && IsAligned(mask)) + { + for (i=0; i(output) && IsAligned(input) && IsAligned(mask)) + { + if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned(output) && IsAligned(input) && IsAligned(mask)) + { + for (i=0; i(buf) && IsAligned(mask)) + { + word32 acc32 = 0; + if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned(buf) && IsAligned(mask)) + { + word64 acc64 = 0; + for (i=0; i>32); + } + + for (i=0; i>8) | byte(acc32>>16) | byte(acc32>>24); + } + + for (i=0; i // for memcpy and memmove + +#ifdef _MSC_VER + #include + #if _MSC_VER >= 1400 + // VC2005 workaround: disable declarations that conflict with winnt.h + #define _interlockedbittestandset CRYPTOPP_DISABLED_INTRINSIC_1 + #define _interlockedbittestandreset CRYPTOPP_DISABLED_INTRINSIC_2 + #define _interlockedbittestandset64 CRYPTOPP_DISABLED_INTRINSIC_3 + #define _interlockedbittestandreset64 CRYPTOPP_DISABLED_INTRINSIC_4 + #include + #undef _interlockedbittestandset + #undef _interlockedbittestandreset + #undef _interlockedbittestandset64 + #undef _interlockedbittestandreset64 + #define CRYPTOPP_FAST_ROTATE(x) 1 + #elif _MSC_VER >= 1300 + #define CRYPTOPP_FAST_ROTATE(x) ((x) == 32 | (x) == 64) + #else + #define CRYPTOPP_FAST_ROTATE(x) ((x) == 32) + #endif +#elif (defined(__MWERKS__) && TARGET_CPU_PPC) || \ + (defined(__GNUC__) && (defined(_ARCH_PWR2) || defined(_ARCH_PWR) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_ARCH_COM))) + #define CRYPTOPP_FAST_ROTATE(x) ((x) == 32) +#elif defined(__GNUC__) && (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86) // depend on GCC's peephole optimization to generate rotate instructions + #define CRYPTOPP_FAST_ROTATE(x) 1 +#else + #define CRYPTOPP_FAST_ROTATE(x) 0 +#endif + +#ifdef __BORLANDC__ +#include +#endif + +#if defined(__GNUC__) && defined(__linux__) +#define CRYPTOPP_BYTESWAP_AVAILABLE +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +// ************** compile-time assertion *************** + +template +struct CompileAssert +{ + static char dummy[2*b-1]; +}; + +#define CRYPTOPP_COMPILE_ASSERT(assertion) CRYPTOPP_COMPILE_ASSERT_INSTANCE(assertion, __LINE__) +#if defined(CRYPTOPP_EXPORTS) || defined(CRYPTOPP_IMPORTS) +#define CRYPTOPP_COMPILE_ASSERT_INSTANCE(assertion, instance) +#else +#define CRYPTOPP_COMPILE_ASSERT_INSTANCE(assertion, instance) static CompileAssert<(assertion)> CRYPTOPP_ASSERT_JOIN(cryptopp_assert_, instance) +#endif +#define CRYPTOPP_ASSERT_JOIN(X, Y) CRYPTOPP_DO_ASSERT_JOIN(X, Y) +#define CRYPTOPP_DO_ASSERT_JOIN(X, Y) X##Y + +// ************** misc classes *************** + +class CRYPTOPP_DLL Empty +{ +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE TwoBases : public BASE1, public BASE2 +{ +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE ThreeBases : public BASE1, public BASE2, public BASE3 +{ +}; + +template +class ObjectHolder +{ +protected: + T m_object; +}; + +class NotCopyable +{ +public: + NotCopyable() {} +private: + NotCopyable(const NotCopyable &); + void operator=(const NotCopyable &); +}; + +template +struct NewObject +{ + T* operator()() const {return new T;} +}; + +/*! This function safely initializes a static object in a multithreaded environment without using locks. + It may leak memory when two threads try to initialize the static object at the same time + but this should be acceptable since each static object is only initialized once per session. +*/ +template , int instance=0> +class Singleton +{ +public: + Singleton(F objectFactory = F()) : m_objectFactory(objectFactory) {} + + // prevent this function from being inlined + CRYPTOPP_NOINLINE const T & Ref(CRYPTOPP_NOINLINE_DOTDOTDOT) const; + +private: + F m_objectFactory; +}; + +template +const T & Singleton::Ref(CRYPTOPP_NOINLINE_DOTDOTDOT) const +{ + static simple_ptr s_pObject; + static char s_objectState = 0; + +retry: + switch (s_objectState) + { + case 0: + s_objectState = 1; + try + { + s_pObject.m_p = m_objectFactory(); + } + catch(...) + { + s_objectState = 0; + throw; + } + s_objectState = 2; + break; + case 1: + goto retry; + default: + break; + } + return *s_pObject.m_p; +} + +// ************** misc functions *************** + +#if (!__STDC_WANT_SECURE_LIB__) +inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t count) +{ + if (count > sizeInBytes) + throw InvalidArgument("memcpy_s: buffer overflow"); + memcpy(dest, src, count); +} + +inline void memmove_s(void *dest, size_t sizeInBytes, const void *src, size_t count) +{ + if (count > sizeInBytes) + throw InvalidArgument("memmove_s: buffer overflow"); + memmove(dest, src, count); +} +#endif + +inline void * memset_z(void *ptr, int value, size_t num) +{ +// avoid extranous warning on GCC 4.3.2 Ubuntu 8.10 +#if CRYPTOPP_GCC_VERSION >= 30001 + if (__builtin_constant_p(num) && num==0) + return ptr; +#endif + return memset(ptr, value, num); +} + +// can't use std::min or std::max in MSVC60 or Cygwin 1.1.0 +template inline const T& STDMIN(const T& a, const T& b) +{ + return b < a ? b : a; +} + +template inline const T1 UnsignedMin(const T1& a, const T2& b) +{ + CRYPTOPP_COMPILE_ASSERT((sizeof(T1)<=sizeof(T2) && T2(-1)>0) || (sizeof(T1)>sizeof(T2) && T1(-1)>0)); + assert(a==0 || a>0); // GCC workaround: get rid of the warning "comparison is always true due to limited range of data type" + assert(b>=0); + + if (sizeof(T1)<=sizeof(T2)) + return b < (T2)a ? (T1)b : a; + else + return (T1)b < a ? (T1)b : a; +} + +template inline const T& STDMAX(const T& a, const T& b) +{ + return a < b ? b : a; +} + +#define RETURN_IF_NONZERO(x) size_t returnedValue = x; if (returnedValue) return returnedValue + +// this version of the macro is fastest on Pentium 3 and Pentium 4 with MSVC 6 SP5 w/ Processor Pack +#define GETBYTE(x, y) (unsigned int)byte((x)>>(8*(y))) +// these may be faster on other CPUs/compilers +// #define GETBYTE(x, y) (unsigned int)(((x)>>(8*(y)))&255) +// #define GETBYTE(x, y) (((byte *)&(x))[y]) + +#define CRYPTOPP_GET_BYTE_AS_BYTE(x, y) byte((x)>>(8*(y))) + +template +unsigned int Parity(T value) +{ + for (unsigned int i=8*sizeof(value)/2; i>0; i/=2) + value ^= value >> i; + return (unsigned int)value&1; +} + +template +unsigned int BytePrecision(const T &value) +{ + if (!value) + return 0; + + unsigned int l=0, h=8*sizeof(value); + + while (h-l > 8) + { + unsigned int t = (l+h)/2; + if (value >> t) + l = t; + else + h = t; + } + + return h/8; +} + +template +unsigned int BitPrecision(const T &value) +{ + if (!value) + return 0; + + unsigned int l=0, h=8*sizeof(value); + + while (h-l > 1) + { + unsigned int t = (l+h)/2; + if (value >> t) + l = t; + else + h = t; + } + + return h; +} + +template +inline T Crop(T value, size_t size) +{ + if (size < 8*sizeof(value)) + return T(value & ((T(1) << size) - 1)); + else + return value; +} + +template +inline bool SafeConvert(T1 from, T2 &to) +{ + to = (T2)from; + if (from != to || (from > 0) != (to > 0)) + return false; + return true; +} + +inline size_t BitsToBytes(size_t bitCount) +{ + return ((bitCount+7)/(8)); +} + +inline size_t BytesToWords(size_t byteCount) +{ + return ((byteCount+WORD_SIZE-1)/WORD_SIZE); +} + +inline size_t BitsToWords(size_t bitCount) +{ + return ((bitCount+WORD_BITS-1)/(WORD_BITS)); +} + +inline size_t BitsToDwords(size_t bitCount) +{ + return ((bitCount+2*WORD_BITS-1)/(2*WORD_BITS)); +} + +CRYPTOPP_DLL void CRYPTOPP_API xorbuf(byte *buf, const byte *mask, size_t count); +CRYPTOPP_DLL void CRYPTOPP_API xorbuf(byte *output, const byte *input, const byte *mask, size_t count); + +CRYPTOPP_DLL bool CRYPTOPP_API VerifyBufsEqual(const byte *buf1, const byte *buf2, size_t count); + +template +inline bool IsPowerOf2(const T &n) +{ + return n > 0 && (n & (n-1)) == 0; +} + +template +inline T2 ModPowerOf2(const T1 &a, const T2 &b) +{ + assert(IsPowerOf2(b)); + return T2(a) & (b-1); +} + +template +inline T1 RoundDownToMultipleOf(const T1 &n, const T2 &m) +{ + if (IsPowerOf2(m)) + return n - ModPowerOf2(n, m); + else + return n - n%m; +} + +template +inline T1 RoundUpToMultipleOf(const T1 &n, const T2 &m) +{ + if (n+m-1 < n) + throw InvalidArgument("RoundUpToMultipleOf: integer overflow"); + return RoundDownToMultipleOf(n+m-1, m); +} + +template +inline unsigned int GetAlignmentOf(T *dummy=NULL) // VC60 workaround +{ +#ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + if (sizeof(T) < 16) + return 1; +#endif + +#if (_MSC_VER >= 1300) + return __alignof(T); +#elif defined(__GNUC__) + return __alignof__(T); +#elif CRYPTOPP_BOOL_SLOW_WORD64 + return UnsignedMin(4U, sizeof(T)); +#else + return sizeof(T); +#endif +} + +inline bool IsAlignedOn(const void *p, unsigned int alignment) +{ + return alignment==1 || (IsPowerOf2(alignment) ? ModPowerOf2((size_t)p, alignment) == 0 : (size_t)p % alignment == 0); +} + +template +inline bool IsAligned(const void *p, T *dummy=NULL) // VC60 workaround +{ + return IsAlignedOn(p, GetAlignmentOf()); +} + +#ifdef IS_LITTLE_ENDIAN + typedef LittleEndian NativeByteOrder; +#else + typedef BigEndian NativeByteOrder; +#endif + +inline ByteOrder GetNativeByteOrder() +{ + return NativeByteOrder::ToEnum(); +} + +inline bool NativeByteOrderIs(ByteOrder order) +{ + return order == GetNativeByteOrder(); +} + +template +std::string IntToString(T a, unsigned int base = 10) +{ + if (a == 0) + return "0"; + bool negate = false; + if (a < 0) + { + negate = true; + a = 0-a; // VC .NET does not like -a + } + std::string result; + while (a > 0) + { + T digit = a % base; + result = char((digit < 10 ? '0' : ('a' - 10)) + digit) + result; + a /= base; + } + if (negate) + result = "-" + result; + return result; +} + +template +inline T1 SaturatingSubtract(const T1 &a, const T2 &b) +{ + return T1((a > b) ? (a - b) : 0); +} + +template +inline CipherDir GetCipherDir(const T &obj) +{ + return obj.IsForwardTransformation() ? ENCRYPTION : DECRYPTION; +} + +CRYPTOPP_DLL void CRYPTOPP_API CallNewHandler(); + +inline void IncrementCounterByOne(byte *inout, unsigned int s) +{ + for (int i=s-1, carry=1; i>=0 && carry; i--) + carry = !++inout[i]; +} + +inline void IncrementCounterByOne(byte *output, const byte *input, unsigned int s) +{ + int i, carry; + for (i=s-1, carry=1; i>=0 && carry; i--) + carry = ((output[i] = input[i]+1) == 0); + memcpy_s(output, s, input, i+1); +} + +// ************** rotate functions *************** + +template inline T rotlFixed(T x, unsigned int y) +{ + assert(y < sizeof(T)*8); + return T((x<>(sizeof(T)*8-y))); +} + +template inline T rotrFixed(T x, unsigned int y) +{ + assert(y < sizeof(T)*8); + return T((x>>y) | (x<<(sizeof(T)*8-y))); +} + +template inline T rotlVariable(T x, unsigned int y) +{ + assert(y < sizeof(T)*8); + return T((x<>(sizeof(T)*8-y))); +} + +template inline T rotrVariable(T x, unsigned int y) +{ + assert(y < sizeof(T)*8); + return T((x>>y) | (x<<(sizeof(T)*8-y))); +} + +template inline T rotlMod(T x, unsigned int y) +{ + y %= sizeof(T)*8; + return T((x<>(sizeof(T)*8-y))); +} + +template inline T rotrMod(T x, unsigned int y) +{ + y %= sizeof(T)*8; + return T((x>>y) | (x<<(sizeof(T)*8-y))); +} + +#ifdef _MSC_VER + +template<> inline word32 rotlFixed(word32 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return y ? _lrotl(x, y) : x; +} + +template<> inline word32 rotrFixed(word32 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return y ? _lrotr(x, y) : x; +} + +template<> inline word32 rotlVariable(word32 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return _lrotl(x, y); +} + +template<> inline word32 rotrVariable(word32 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return _lrotr(x, y); +} + +template<> inline word32 rotlMod(word32 x, unsigned int y) +{ + return _lrotl(x, y); +} + +template<> inline word32 rotrMod(word32 x, unsigned int y) +{ + return _lrotr(x, y); +} + +#endif // #ifdef _MSC_VER + +#if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) +// Intel C++ Compiler 10.0 calls a function instead of using the rotate instruction when using these instructions + +template<> inline word64 rotlFixed(word64 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return y ? _rotl64(x, y) : x; +} + +template<> inline word64 rotrFixed(word64 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return y ? _rotr64(x, y) : x; +} + +template<> inline word64 rotlVariable(word64 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return _rotl64(x, y); +} + +template<> inline word64 rotrVariable(word64 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return _rotr64(x, y); +} + +template<> inline word64 rotlMod(word64 x, unsigned int y) +{ + return _rotl64(x, y); +} + +template<> inline word64 rotrMod(word64 x, unsigned int y) +{ + return _rotr64(x, y); +} + +#endif // #if _MSC_VER >= 1310 + +#if _MSC_VER >= 1400 && !defined(__INTEL_COMPILER) +// Intel C++ Compiler 10.0 gives undefined externals with these + +template<> inline word16 rotlFixed(word16 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return y ? _rotl16(x, y) : x; +} + +template<> inline word16 rotrFixed(word16 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return y ? _rotr16(x, y) : x; +} + +template<> inline word16 rotlVariable(word16 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return _rotl16(x, y); +} + +template<> inline word16 rotrVariable(word16 x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return _rotr16(x, y); +} + +template<> inline word16 rotlMod(word16 x, unsigned int y) +{ + return _rotl16(x, y); +} + +template<> inline word16 rotrMod(word16 x, unsigned int y) +{ + return _rotr16(x, y); +} + +template<> inline byte rotlFixed(byte x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return y ? _rotl8(x, y) : x; +} + +template<> inline byte rotrFixed(byte x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return y ? _rotr8(x, y) : x; +} + +template<> inline byte rotlVariable(byte x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return _rotl8(x, y); +} + +template<> inline byte rotrVariable(byte x, unsigned int y) +{ + assert(y < 8*sizeof(x)); + return _rotr8(x, y); +} + +template<> inline byte rotlMod(byte x, unsigned int y) +{ + return _rotl8(x, y); +} + +template<> inline byte rotrMod(byte x, unsigned int y) +{ + return _rotr8(x, y); +} + +#endif // #if _MSC_VER >= 1400 + +#if (defined(__MWERKS__) && TARGET_CPU_PPC) + +template<> inline word32 rotlFixed(word32 x, unsigned int y) +{ + assert(y < 32); + return y ? __rlwinm(x,y,0,31) : x; +} + +template<> inline word32 rotrFixed(word32 x, unsigned int y) +{ + assert(y < 32); + return y ? __rlwinm(x,32-y,0,31) : x; +} + +template<> inline word32 rotlVariable(word32 x, unsigned int y) +{ + assert(y < 32); + return (__rlwnm(x,y,0,31)); +} + +template<> inline word32 rotrVariable(word32 x, unsigned int y) +{ + assert(y < 32); + return (__rlwnm(x,32-y,0,31)); +} + +template<> inline word32 rotlMod(word32 x, unsigned int y) +{ + return (__rlwnm(x,y,0,31)); +} + +template<> inline word32 rotrMod(word32 x, unsigned int y) +{ + return (__rlwnm(x,32-y,0,31)); +} + +#endif // #if (defined(__MWERKS__) && TARGET_CPU_PPC) + +// ************** endian reversal *************** + +template +inline unsigned int GetByte(ByteOrder order, T value, unsigned int index) +{ + if (order == LITTLE_ENDIAN_ORDER) + return GETBYTE(value, index); + else + return GETBYTE(value, sizeof(T)-index-1); +} + +inline byte ByteReverse(byte value) +{ + return value; +} + +inline word16 ByteReverse(word16 value) +{ +#ifdef CRYPTOPP_BYTESWAP_AVAILABLE + return bswap_16(value); +#elif defined(_MSC_VER) && _MSC_VER >= 1300 + return _byteswap_ushort(value); +#else + return rotlFixed(value, 8U); +#endif +} + +inline word32 ByteReverse(word32 value) +{ +#if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) + __asm__ ("bswap %0" : "=r" (value) : "0" (value)); + return value; +#elif defined(CRYPTOPP_BYTESWAP_AVAILABLE) + return bswap_32(value); +#elif defined(__MWERKS__) && TARGET_CPU_PPC + return (word32)__lwbrx(&value,0); +#elif _MSC_VER >= 1400 || (_MSC_VER >= 1300 && !defined(_DLL)) + return _byteswap_ulong(value); +#elif CRYPTOPP_FAST_ROTATE(32) + // 5 instructions with rotate instruction, 9 without + return (rotrFixed(value, 8U) & 0xff00ff00) | (rotlFixed(value, 8U) & 0x00ff00ff); +#else + // 6 instructions with rotate instruction, 8 without + value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); + return rotlFixed(value, 16U); +#endif +} + +inline word64 ByteReverse(word64 value) +{ +#if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(__x86_64__) + __asm__ ("bswap %0" : "=r" (value) : "0" (value)); + return value; +#elif defined(CRYPTOPP_BYTESWAP_AVAILABLE) + return bswap_64(value); +#elif defined(_MSC_VER) && _MSC_VER >= 1300 + return _byteswap_uint64(value); +#elif CRYPTOPP_BOOL_SLOW_WORD64 + return (word64(ByteReverse(word32(value))) << 32) | ByteReverse(word32(value>>32)); +#else + value = ((value & W64LIT(0xFF00FF00FF00FF00)) >> 8) | ((value & W64LIT(0x00FF00FF00FF00FF)) << 8); + value = ((value & W64LIT(0xFFFF0000FFFF0000)) >> 16) | ((value & W64LIT(0x0000FFFF0000FFFF)) << 16); + return rotlFixed(value, 32U); +#endif +} + +inline byte BitReverse(byte value) +{ + value = ((value & 0xAA) >> 1) | ((value & 0x55) << 1); + value = ((value & 0xCC) >> 2) | ((value & 0x33) << 2); + return rotlFixed(value, 4U); +} + +inline word16 BitReverse(word16 value) +{ + value = ((value & 0xAAAA) >> 1) | ((value & 0x5555) << 1); + value = ((value & 0xCCCC) >> 2) | ((value & 0x3333) << 2); + value = ((value & 0xF0F0) >> 4) | ((value & 0x0F0F) << 4); + return ByteReverse(value); +} + +inline word32 BitReverse(word32 value) +{ + value = ((value & 0xAAAAAAAA) >> 1) | ((value & 0x55555555) << 1); + value = ((value & 0xCCCCCCCC) >> 2) | ((value & 0x33333333) << 2); + value = ((value & 0xF0F0F0F0) >> 4) | ((value & 0x0F0F0F0F) << 4); + return ByteReverse(value); +} + +inline word64 BitReverse(word64 value) +{ +#if CRYPTOPP_BOOL_SLOW_WORD64 + return (word64(BitReverse(word32(value))) << 32) | BitReverse(word32(value>>32)); +#else + value = ((value & W64LIT(0xAAAAAAAAAAAAAAAA)) >> 1) | ((value & W64LIT(0x5555555555555555)) << 1); + value = ((value & W64LIT(0xCCCCCCCCCCCCCCCC)) >> 2) | ((value & W64LIT(0x3333333333333333)) << 2); + value = ((value & W64LIT(0xF0F0F0F0F0F0F0F0)) >> 4) | ((value & W64LIT(0x0F0F0F0F0F0F0F0F)) << 4); + return ByteReverse(value); +#endif +} + +template +inline T BitReverse(T value) +{ + if (sizeof(T) == 1) + return (T)BitReverse((byte)value); + else if (sizeof(T) == 2) + return (T)BitReverse((word16)value); + else if (sizeof(T) == 4) + return (T)BitReverse((word32)value); + else + { + assert(sizeof(T) == 8); + return (T)BitReverse((word64)value); + } +} + +template +inline T ConditionalByteReverse(ByteOrder order, T value) +{ + return NativeByteOrderIs(order) ? value : ByteReverse(value); +} + +template +void ByteReverse(T *out, const T *in, size_t byteCount) +{ + assert(byteCount % sizeof(T) == 0); + size_t count = byteCount/sizeof(T); + for (size_t i=0; i +inline void ConditionalByteReverse(ByteOrder order, T *out, const T *in, size_t byteCount) +{ + if (!NativeByteOrderIs(order)) + ByteReverse(out, in, byteCount); + else if (in != out) + memcpy_s(out, byteCount, in, byteCount); +} + +template +inline void GetUserKey(ByteOrder order, T *out, size_t outlen, const byte *in, size_t inlen) +{ + const size_t U = sizeof(T); + assert(inlen <= outlen*U); + memcpy_s(out, outlen*U, in, inlen); + memset_z((byte *)out+inlen, 0, outlen*U-inlen); + ConditionalByteReverse(order, out, out, RoundUpToMultipleOf(inlen, U)); +} + +#ifndef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS +inline byte UnalignedGetWordNonTemplate(ByteOrder order, const byte *block, const byte *) +{ + return block[0]; +} + +inline word16 UnalignedGetWordNonTemplate(ByteOrder order, const byte *block, const word16 *) +{ + return (order == BIG_ENDIAN_ORDER) + ? block[1] | (block[0] << 8) + : block[0] | (block[1] << 8); +} + +inline word32 UnalignedGetWordNonTemplate(ByteOrder order, const byte *block, const word32 *) +{ + return (order == BIG_ENDIAN_ORDER) + ? word32(block[3]) | (word32(block[2]) << 8) | (word32(block[1]) << 16) | (word32(block[0]) << 24) + : word32(block[0]) | (word32(block[1]) << 8) | (word32(block[2]) << 16) | (word32(block[3]) << 24); +} + +inline word64 UnalignedGetWordNonTemplate(ByteOrder order, const byte *block, const word64 *) +{ + return (order == BIG_ENDIAN_ORDER) + ? + (word64(block[7]) | + (word64(block[6]) << 8) | + (word64(block[5]) << 16) | + (word64(block[4]) << 24) | + (word64(block[3]) << 32) | + (word64(block[2]) << 40) | + (word64(block[1]) << 48) | + (word64(block[0]) << 56)) + : + (word64(block[0]) | + (word64(block[1]) << 8) | + (word64(block[2]) << 16) | + (word64(block[3]) << 24) | + (word64(block[4]) << 32) | + (word64(block[5]) << 40) | + (word64(block[6]) << 48) | + (word64(block[7]) << 56)); +} + +inline void UnalignedPutWordNonTemplate(ByteOrder order, byte *block, byte value, const byte *xorBlock) +{ + block[0] = xorBlock ? (value ^ xorBlock[0]) : value; +} + +inline void UnalignedPutWordNonTemplate(ByteOrder order, byte *block, word16 value, const byte *xorBlock) +{ + if (order == BIG_ENDIAN_ORDER) + { + if (xorBlock) + { + block[0] = xorBlock[0] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + block[1] = xorBlock[1] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + } + else + { + block[0] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + block[1] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + } + } + else + { + if (xorBlock) + { + block[0] = xorBlock[0] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + block[1] = xorBlock[1] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + } + else + { + block[0] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + block[1] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + } + } +} + +inline void UnalignedPutWordNonTemplate(ByteOrder order, byte *block, word32 value, const byte *xorBlock) +{ + if (order == BIG_ENDIAN_ORDER) + { + if (xorBlock) + { + block[0] = xorBlock[0] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 3); + block[1] = xorBlock[1] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 2); + block[2] = xorBlock[2] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + block[3] = xorBlock[3] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + } + else + { + block[0] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 3); + block[1] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 2); + block[2] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + block[3] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + } + } + else + { + if (xorBlock) + { + block[0] = xorBlock[0] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + block[1] = xorBlock[1] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + block[2] = xorBlock[2] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 2); + block[3] = xorBlock[3] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 3); + } + else + { + block[0] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + block[1] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + block[2] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 2); + block[3] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 3); + } + } +} + +inline void UnalignedPutWordNonTemplate(ByteOrder order, byte *block, word64 value, const byte *xorBlock) +{ + if (order == BIG_ENDIAN_ORDER) + { + if (xorBlock) + { + block[0] = xorBlock[0] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 7); + block[1] = xorBlock[1] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 6); + block[2] = xorBlock[2] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 5); + block[3] = xorBlock[3] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 4); + block[4] = xorBlock[4] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 3); + block[5] = xorBlock[5] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 2); + block[6] = xorBlock[6] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + block[7] = xorBlock[7] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + } + else + { + block[0] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 7); + block[1] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 6); + block[2] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 5); + block[3] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 4); + block[4] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 3); + block[5] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 2); + block[6] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + block[7] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + } + } + else + { + if (xorBlock) + { + block[0] = xorBlock[0] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + block[1] = xorBlock[1] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + block[2] = xorBlock[2] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 2); + block[3] = xorBlock[3] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 3); + block[4] = xorBlock[4] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 4); + block[5] = xorBlock[5] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 5); + block[6] = xorBlock[6] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 6); + block[7] = xorBlock[7] ^ CRYPTOPP_GET_BYTE_AS_BYTE(value, 7); + } + else + { + block[0] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 0); + block[1] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 1); + block[2] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 2); + block[3] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 3); + block[4] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 4); + block[5] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 5); + block[6] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 6); + block[7] = CRYPTOPP_GET_BYTE_AS_BYTE(value, 7); + } + } +} +#endif // #ifndef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + +template +inline T GetWord(bool assumeAligned, ByteOrder order, const byte *block) +{ +#ifndef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + if (!assumeAligned) + return UnalignedGetWordNonTemplate(order, block, (T*)NULL); + assert(IsAligned(block)); +#endif + return ConditionalByteReverse(order, *reinterpret_cast(block)); +} + +template +inline void GetWord(bool assumeAligned, ByteOrder order, T &result, const byte *block) +{ + result = GetWord(assumeAligned, order, block); +} + +template +inline void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, const byte *xorBlock = NULL) +{ +#ifndef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + if (!assumeAligned) + return UnalignedPutWordNonTemplate(order, block, value, xorBlock); + assert(IsAligned(block)); + assert(IsAligned(xorBlock)); +#endif + *reinterpret_cast(block) = ConditionalByteReverse(order, value) ^ (xorBlock ? *reinterpret_cast(xorBlock) : 0); +} + +template +class GetBlock +{ +public: + GetBlock(const void *block) + : m_block((const byte *)block) {} + + template + inline GetBlock & operator()(U &x) + { + CRYPTOPP_COMPILE_ASSERT(sizeof(U) >= sizeof(T)); + x = GetWord(A, B::ToEnum(), m_block); + m_block += sizeof(T); + return *this; + } + +private: + const byte *m_block; +}; + +template +class PutBlock +{ +public: + PutBlock(const void *xorBlock, void *block) + : m_xorBlock((const byte *)xorBlock), m_block((byte *)block) {} + + template + inline PutBlock & operator()(U x) + { + PutWord(A, B::ToEnum(), m_block, (T)x, m_xorBlock); + m_block += sizeof(T); + if (m_xorBlock) + m_xorBlock += sizeof(T); + return *this; + } + +private: + const byte *m_xorBlock; + byte *m_block; +}; + +template +struct BlockGetAndPut +{ + // function needed because of C++ grammatical ambiguity between expression-statements and declarations + static inline GetBlock Get(const void *block) {return GetBlock(block);} + typedef PutBlock Put; +}; + +template +std::string WordToString(T value, ByteOrder order = BIG_ENDIAN_ORDER) +{ + if (!NativeByteOrderIs(order)) + value = ByteReverse(value); + + return std::string((char *)&value, sizeof(value)); +} + +template +T StringToWord(const std::string &str, ByteOrder order = BIG_ENDIAN_ORDER) +{ + T value = 0; + memcpy_s(&value, sizeof(value), str.data(), UnsignedMin(str.size(), sizeof(value))); + return NativeByteOrderIs(order) ? value : ByteReverse(value); +} + +// ************** help remove warning on g++ *************** + +template struct SafeShifter; + +template<> struct SafeShifter +{ + template + static inline T RightShift(T value, unsigned int bits) + { + return 0; + } + + template + static inline T LeftShift(T value, unsigned int bits) + { + return 0; + } +}; + +template<> struct SafeShifter +{ + template + static inline T RightShift(T value, unsigned int bits) + { + return value >> bits; + } + + template + static inline T LeftShift(T value, unsigned int bits) + { + return value << bits; + } +}; + +template +inline T SafeRightShift(T value) +{ + return SafeShifter<(bits>=(8*sizeof(T)))>::RightShift(value, bits); +} + +template +inline T SafeLeftShift(T value) +{ + return SafeShifter<(bits>=(8*sizeof(T)))>::LeftShift(value, bits); +} + +// ************** use one buffer for multiple data members *************** + +#define CRYPTOPP_BLOCK_1(n, t, s) t* m_##n() {return (t *)(m_aggregate+0);} size_t SS1() {return sizeof(t)*(s);} size_t m_##n##Size() {return (s);} +#define CRYPTOPP_BLOCK_2(n, t, s) t* m_##n() {return (t *)(m_aggregate+SS1());} size_t SS2() {return SS1()+sizeof(t)*(s);} size_t m_##n##Size() {return (s);} +#define CRYPTOPP_BLOCK_3(n, t, s) t* m_##n() {return (t *)(m_aggregate+SS2());} size_t SS3() {return SS2()+sizeof(t)*(s);} size_t m_##n##Size() {return (s);} +#define CRYPTOPP_BLOCK_4(n, t, s) t* m_##n() {return (t *)(m_aggregate+SS3());} size_t SS4() {return SS3()+sizeof(t)*(s);} size_t m_##n##Size() {return (s);} +#define CRYPTOPP_BLOCK_5(n, t, s) t* m_##n() {return (t *)(m_aggregate+SS4());} size_t SS5() {return SS4()+sizeof(t)*(s);} size_t m_##n##Size() {return (s);} +#define CRYPTOPP_BLOCK_6(n, t, s) t* m_##n() {return (t *)(m_aggregate+SS5());} size_t SS6() {return SS5()+sizeof(t)*(s);} size_t m_##n##Size() {return (s);} +#define CRYPTOPP_BLOCK_7(n, t, s) t* m_##n() {return (t *)(m_aggregate+SS6());} size_t SS7() {return SS6()+sizeof(t)*(s);} size_t m_##n##Size() {return (s);} +#define CRYPTOPP_BLOCK_8(n, t, s) t* m_##n() {return (t *)(m_aggregate+SS7());} size_t SS8() {return SS7()+sizeof(t)*(s);} size_t m_##n##Size() {return (s);} +#define CRYPTOPP_BLOCKS_END(i) size_t SST() {return SS##i();} void AllocateBlocks() {m_aggregate.New(SST());} AlignedSecByteBlock m_aggregate; + +NAMESPACE_END + +#endif diff --git a/cryptopp/modarith.h b/cryptopp/modarith.h new file mode 100644 index 0000000..c0368e3 --- /dev/null +++ b/cryptopp/modarith.h @@ -0,0 +1,158 @@ +#ifndef CRYPTOPP_MODARITH_H +#define CRYPTOPP_MODARITH_H + +// implementations are in integer.cpp + +#include "cryptlib.h" +#include "misc.h" +#include "integer.h" +#include "algebra.h" + +NAMESPACE_BEGIN(CryptoPP) + +CRYPTOPP_DLL_TEMPLATE_CLASS AbstractGroup; +CRYPTOPP_DLL_TEMPLATE_CLASS AbstractRing; +CRYPTOPP_DLL_TEMPLATE_CLASS AbstractEuclideanDomain; + +//! ring of congruence classes modulo n +/*! \note this implementation represents each congruence class as the smallest non-negative integer in that class */ +class CRYPTOPP_DLL ModularArithmetic : public AbstractRing +{ +public: + + typedef int RandomizationParameter; + typedef Integer Element; + + ModularArithmetic(const Integer &modulus = Integer::One()) + : m_modulus(modulus), m_result((word)0, modulus.reg.size()) {} + + ModularArithmetic(const ModularArithmetic &ma) + : m_modulus(ma.m_modulus), m_result((word)0, m_modulus.reg.size()) {} + + ModularArithmetic(BufferedTransformation &bt); // construct from BER encoded parameters + + virtual ModularArithmetic * Clone() const {return new ModularArithmetic(*this);} + + void DEREncode(BufferedTransformation &bt) const; + + void DEREncodeElement(BufferedTransformation &out, const Element &a) const; + void BERDecodeElement(BufferedTransformation &in, Element &a) const; + + const Integer& GetModulus() const {return m_modulus;} + void SetModulus(const Integer &newModulus) {m_modulus = newModulus; m_result.reg.resize(m_modulus.reg.size());} + + virtual bool IsMontgomeryRepresentation() const {return false;} + + virtual Integer ConvertIn(const Integer &a) const + {return a%m_modulus;} + + virtual Integer ConvertOut(const Integer &a) const + {return a;} + + const Integer& Half(const Integer &a) const; + + bool Equal(const Integer &a, const Integer &b) const + {return a==b;} + + const Integer& Identity() const + {return Integer::Zero();} + + const Integer& Add(const Integer &a, const Integer &b) const; + + Integer& Accumulate(Integer &a, const Integer &b) const; + + const Integer& Inverse(const Integer &a) const; + + const Integer& Subtract(const Integer &a, const Integer &b) const; + + Integer& Reduce(Integer &a, const Integer &b) const; + + const Integer& Double(const Integer &a) const + {return Add(a, a);} + + const Integer& MultiplicativeIdentity() const + {return Integer::One();} + + const Integer& Multiply(const Integer &a, const Integer &b) const + {return m_result1 = a*b%m_modulus;} + + const Integer& Square(const Integer &a) const + {return m_result1 = a.Squared()%m_modulus;} + + bool IsUnit(const Integer &a) const + {return Integer::Gcd(a, m_modulus).IsUnit();} + + const Integer& MultiplicativeInverse(const Integer &a) const + {return m_result1 = a.InverseMod(m_modulus);} + + const Integer& Divide(const Integer &a, const Integer &b) const + {return Multiply(a, MultiplicativeInverse(b));} + + Integer CascadeExponentiate(const Integer &x, const Integer &e1, const Integer &y, const Integer &e2) const; + + void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const; + + unsigned int MaxElementBitLength() const + {return (m_modulus-1).BitCount();} + + unsigned int MaxElementByteLength() const + {return (m_modulus-1).ByteCount();} + + Element RandomElement( RandomNumberGenerator &rng , const RandomizationParameter &ignore_for_now = 0 ) const + // left RandomizationParameter arg as ref in case RandomizationParameter becomes a more complicated struct + { + return Element( rng , Integer( (long) 0) , m_modulus - Integer( (long) 1 ) ) ; + } + + bool operator==(const ModularArithmetic &rhs) const + {return m_modulus == rhs.m_modulus;} + + static const RandomizationParameter DefaultRandomizationParameter ; + +protected: + Integer m_modulus; + mutable Integer m_result, m_result1; + +}; + +// const ModularArithmetic::RandomizationParameter ModularArithmetic::DefaultRandomizationParameter = 0 ; + +//! do modular arithmetics in Montgomery representation for increased speed +/*! \note the Montgomery representation represents each congruence class [a] as a*r%n, where r is a convenient power of 2 */ +class CRYPTOPP_DLL MontgomeryRepresentation : public ModularArithmetic +{ +public: + MontgomeryRepresentation(const Integer &modulus); // modulus must be odd + + virtual ModularArithmetic * Clone() const {return new MontgomeryRepresentation(*this);} + + bool IsMontgomeryRepresentation() const {return true;} + + Integer ConvertIn(const Integer &a) const + {return (a<<(WORD_BITS*m_modulus.reg.size()))%m_modulus;} + + Integer ConvertOut(const Integer &a) const; + + const Integer& MultiplicativeIdentity() const + {return m_result1 = Integer::Power2(WORD_BITS*m_modulus.reg.size())%m_modulus;} + + const Integer& Multiply(const Integer &a, const Integer &b) const; + + const Integer& Square(const Integer &a) const; + + const Integer& MultiplicativeInverse(const Integer &a) const; + + Integer CascadeExponentiate(const Integer &x, const Integer &e1, const Integer &y, const Integer &e2) const + {return AbstractRing::CascadeExponentiate(x, e1, y, e2);} + + void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const + {AbstractRing::SimultaneousExponentiate(results, base, exponents, exponentsCount);} + +private: + Integer m_u; + mutable IntegerSecBlock m_workspace; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/modes.cpp b/cryptopp/modes.cpp new file mode 100644 index 0000000..81bf4de --- /dev/null +++ b/cryptopp/modes.cpp @@ -0,0 +1,243 @@ +// modes.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "modes.h" + +#ifndef NDEBUG +#include "des.h" +#endif + +NAMESPACE_BEGIN(CryptoPP) + +#ifndef NDEBUG +void Modes_TestInstantiations() +{ + CFB_Mode::Encryption m0; + CFB_Mode::Decryption m1; + OFB_Mode::Encryption m2; + CTR_Mode::Encryption m3; + ECB_Mode::Encryption m4; + CBC_Mode::Encryption m5; +} +#endif + +void CFB_ModePolicy::Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount) +{ + assert(m_cipher->IsForwardTransformation()); // CFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt + assert(m_feedbackSize == BlockSize()); + + unsigned int s = BlockSize(); + if (dir == ENCRYPTION) + { + m_cipher->ProcessAndXorBlock(m_register, input, output); + m_cipher->AdvancedProcessBlocks(output, input+s, output+s, (iterationCount-1)*s, 0); + memcpy(m_register, output+(iterationCount-1)*s, s); + } + else + { + memcpy(m_temp, input+(iterationCount-1)*s, s); // make copy first in case of in-place decryption + m_cipher->AdvancedProcessBlocks(input, input+s, output+s, (iterationCount-1)*s, BlockTransformation::BT_ReverseDirection); + m_cipher->ProcessAndXorBlock(m_register, input, output); + memcpy(m_register, m_temp, s); + } +} + +void CFB_ModePolicy::TransformRegister() +{ + assert(m_cipher->IsForwardTransformation()); // CFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt + m_cipher->ProcessBlock(m_register, m_temp); + unsigned int updateSize = BlockSize()-m_feedbackSize; + memmove_s(m_register, m_register.size(), m_register+m_feedbackSize, updateSize); + memcpy_s(m_register+updateSize, m_register.size()-updateSize, m_temp, m_feedbackSize); +} + +void CFB_ModePolicy::CipherResynchronize(const byte *iv, size_t length) +{ + memcpy_s(m_register, m_register.size(), iv, BlockSize()); + TransformRegister(); +} + +void CFB_ModePolicy::SetFeedbackSize(unsigned int feedbackSize) +{ + if (feedbackSize > BlockSize()) + throw InvalidArgument("CFB_Mode: invalid feedback size"); + m_feedbackSize = feedbackSize ? feedbackSize : BlockSize(); +} + +void CFB_ModePolicy::ResizeBuffers() +{ + CipherModeBase::ResizeBuffers(); + m_temp.New(BlockSize()); +} + +void OFB_ModePolicy::WriteKeystream(byte *keystreamBuffer, size_t iterationCount) +{ + assert(m_cipher->IsForwardTransformation()); // OFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt + unsigned int s = BlockSize(); + m_cipher->ProcessBlock(m_register, keystreamBuffer); + if (iterationCount > 1) + m_cipher->AdvancedProcessBlocks(keystreamBuffer, NULL, keystreamBuffer+s, s*(iterationCount-1), 0); + memcpy(m_register, keystreamBuffer+s*(iterationCount-1), s); +} + +void OFB_ModePolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length) +{ + CopyOrZero(m_register, iv, length); +} + +void CTR_ModePolicy::SeekToIteration(lword iterationCount) +{ + int carry=0; + for (int i=BlockSize()-1; i>=0; i--) + { + unsigned int sum = m_register[i] + byte(iterationCount) + carry; + m_counterArray[i] = (byte) sum; + carry = sum >> 8; + iterationCount >>= 8; + } +} + +void CTR_ModePolicy::IncrementCounterBy256() +{ + IncrementCounterByOne(m_counterArray, BlockSize()-1); +} + +void CTR_ModePolicy::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) +{ + assert(m_cipher->IsForwardTransformation()); // CTR mode needs the "encrypt" direction of the underlying block cipher, even to decrypt + unsigned int s = BlockSize(); + unsigned int inputIncrement = input ? s : 0; + + while (iterationCount) + { + byte lsb = m_counterArray[s-1]; + size_t blocks = UnsignedMin(iterationCount, 256U-lsb); + m_cipher->AdvancedProcessBlocks(m_counterArray, input, output, blocks*s, BlockTransformation::BT_InBlockIsCounter); + if ((m_counterArray[s-1] = lsb + (byte)blocks) == 0) + IncrementCounterBy256(); + + output += blocks*s; + input += blocks*inputIncrement; + iterationCount -= blocks; + } +} + +void CTR_ModePolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length) +{ + assert(length == BlockSize()); + CopyOrZero(m_register, iv, length); + m_counterArray = m_register; +} + +void BlockOrientedCipherModeBase::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) +{ + m_cipher->SetKey(key, length, params); + ResizeBuffers(); + if (IsResynchronizable()) + { + size_t ivLength; + const byte *iv = GetIVAndThrowIfInvalid(params, ivLength); + Resynchronize(iv, (int)ivLength); + } +} + +void ECB_OneWay::ProcessData(byte *outString, const byte *inString, size_t length) +{ + assert(length%BlockSize()==0); + m_cipher->AdvancedProcessBlocks(inString, NULL, outString, length, 0); +} + +void CBC_Encryption::ProcessData(byte *outString, const byte *inString, size_t length) +{ + if (!length) + return; + assert(length%BlockSize()==0); + + unsigned int blockSize = BlockSize(); + m_cipher->AdvancedProcessBlocks(inString, m_register, outString, blockSize, BlockTransformation::BT_XorInput); + if (length > blockSize) + m_cipher->AdvancedProcessBlocks(inString+blockSize, outString, outString+blockSize, length-blockSize, BlockTransformation::BT_XorInput); + memcpy(m_register, outString + length - blockSize, blockSize); +} + +void CBC_CTS_Encryption::ProcessLastBlock(byte *outString, const byte *inString, size_t length) +{ + if (length <= BlockSize()) + { + if (!m_stolenIV) + throw InvalidArgument("CBC_Encryption: message is too short for ciphertext stealing"); + + // steal from IV + memcpy(outString, m_register, length); + outString = m_stolenIV; + } + else + { + // steal from next to last block + xorbuf(m_register, inString, BlockSize()); + m_cipher->ProcessBlock(m_register); + inString += BlockSize(); + length -= BlockSize(); + memcpy(outString+BlockSize(), m_register, length); + } + + // output last full ciphertext block + xorbuf(m_register, inString, length); + m_cipher->ProcessBlock(m_register); + memcpy(outString, m_register, BlockSize()); +} + +void CBC_Decryption::ProcessData(byte *outString, const byte *inString, size_t length) +{ + if (!length) + return; + assert(length%BlockSize()==0); + + unsigned int blockSize = BlockSize(); + memcpy(m_temp, inString+length-blockSize, blockSize); // save copy now in case of in-place decryption + if (length > blockSize) + m_cipher->AdvancedProcessBlocks(inString+blockSize, inString, outString+blockSize, length-blockSize, BlockTransformation::BT_ReverseDirection); + m_cipher->ProcessAndXorBlock(inString, m_register, outString); + m_register.swap(m_temp); +} + +void CBC_CTS_Decryption::ProcessLastBlock(byte *outString, const byte *inString, size_t length) +{ + const byte *pn, *pn1; + bool stealIV = length <= BlockSize(); + + if (stealIV) + { + pn = inString; + pn1 = m_register; + } + else + { + pn = inString + BlockSize(); + pn1 = inString; + length -= BlockSize(); + } + + // decrypt last partial plaintext block + memcpy(m_temp, pn1, BlockSize()); + m_cipher->ProcessBlock(m_temp); + xorbuf(m_temp, pn, length); + + if (stealIV) + memcpy(outString, m_temp, length); + else + { + memcpy(outString+BlockSize(), m_temp, length); + // decrypt next to last plaintext block + memcpy(m_temp, pn, length); + m_cipher->ProcessBlock(m_temp); + xorbuf(outString, m_temp, m_register, BlockSize()); + } +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/modes.h b/cryptopp/modes.h new file mode 100644 index 0000000..ff88d31 --- /dev/null +++ b/cryptopp/modes.h @@ -0,0 +1,421 @@ +#ifndef CRYPTOPP_MODES_H +#define CRYPTOPP_MODES_H + +/*! \file +*/ + +#include "cryptlib.h" +#include "secblock.h" +#include "misc.h" +#include "strciphr.h" +#include "argnames.h" +#include "algparam.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! Cipher modes documentation. See NIST SP 800-38A for definitions of these modes. See AuthenticatedSymmetricCipherDocumentation for authenticated encryption modes. + +/*! Each class derived from this one defines two types, Encryption and Decryption, + both of which implement the SymmetricCipher interface. + For each mode there are two classes, one of which is a template class, + and the other one has a name that ends in "_ExternalCipher". + The "external cipher" mode objects hold a reference to the underlying block cipher, + instead of holding an instance of it. The reference must be passed in to the constructor. + For the "cipher holder" classes, the CIPHER template parameter should be a class + derived from BlockCipherDocumentation, for example DES or AES. +*/ +struct CipherModeDocumentation : public SymmetricCipherDocumentation +{ +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CipherModeBase : public SymmetricCipher +{ +public: + size_t MinKeyLength() const {return m_cipher->MinKeyLength();} + size_t MaxKeyLength() const {return m_cipher->MaxKeyLength();} + size_t DefaultKeyLength() const {return m_cipher->DefaultKeyLength();} + size_t GetValidKeyLength(size_t n) const {return m_cipher->GetValidKeyLength(n);} + bool IsValidKeyLength(size_t n) const {return m_cipher->IsValidKeyLength(n);} + + unsigned int OptimalDataAlignment() const {return m_cipher->OptimalDataAlignment();} + + unsigned int IVSize() const {return BlockSize();} + virtual IV_Requirement IVRequirement() const =0; + + void SetCipher(BlockCipher &cipher) + { + this->ThrowIfResynchronizable(); + this->m_cipher = &cipher; + this->ResizeBuffers(); + } + + void SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize = 0) + { + this->ThrowIfInvalidIV(iv); + this->m_cipher = &cipher; + this->ResizeBuffers(); + this->SetFeedbackSize(feedbackSize); + if (this->IsResynchronizable()) + this->Resynchronize(iv); + } + +protected: + CipherModeBase() : m_cipher(NULL) {} + inline unsigned int BlockSize() const {assert(m_register.size() > 0); return (unsigned int)m_register.size();} + virtual void SetFeedbackSize(unsigned int feedbackSize) + { + if (!(feedbackSize == 0 || feedbackSize == BlockSize())) + throw InvalidArgument("CipherModeBase: feedback size cannot be specified for this cipher mode"); + } + virtual void ResizeBuffers() + { + m_register.New(m_cipher->BlockSize()); + } + + BlockCipher *m_cipher; + AlignedSecByteBlock m_register; +}; + +template +class CRYPTOPP_NO_VTABLE ModePolicyCommonTemplate : public CipherModeBase, public POLICY_INTERFACE +{ + unsigned int GetAlignment() const {return m_cipher->OptimalDataAlignment();} + void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); +}; + +template +void ModePolicyCommonTemplate::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) +{ + m_cipher->SetKey(key, length, params); + ResizeBuffers(); + int feedbackSize = params.GetIntValueWithDefault(Name::FeedbackSize(), 0); + SetFeedbackSize(feedbackSize); +} + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_ModePolicy : public ModePolicyCommonTemplate +{ +public: + IV_Requirement IVRequirement() const {return RANDOM_IV;} + static const char * CRYPTOPP_API StaticAlgorithmName() {return "CFB";} + +protected: + unsigned int GetBytesPerIteration() const {return m_feedbackSize;} + byte * GetRegisterBegin() {return m_register + BlockSize() - m_feedbackSize;} + bool CanIterate() const {return m_feedbackSize == BlockSize();} + void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount); + void TransformRegister(); + void CipherResynchronize(const byte *iv, size_t length); + void SetFeedbackSize(unsigned int feedbackSize); + void ResizeBuffers(); + + SecByteBlock m_temp; + unsigned int m_feedbackSize; +}; + +inline void CopyOrZero(void *dest, const void *src, size_t s) +{ + if (src) + memcpy_s(dest, s, src, s); + else + memset(dest, 0, s); +} + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE OFB_ModePolicy : public ModePolicyCommonTemplate +{ +public: + bool CipherIsRandomAccess() const {return false;} + IV_Requirement IVRequirement() const {return UNIQUE_IV;} + static const char * CRYPTOPP_API StaticAlgorithmName() {return "OFB";} + +private: + unsigned int GetBytesPerIteration() const {return BlockSize();} + unsigned int GetIterationsToBuffer() const {return m_cipher->OptimalNumberOfParallelBlocks();} + void WriteKeystream(byte *keystreamBuffer, size_t iterationCount); + void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length); +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CTR_ModePolicy : public ModePolicyCommonTemplate +{ +public: + bool CipherIsRandomAccess() const {return true;} + IV_Requirement IVRequirement() const {return RANDOM_IV;} + static const char * CRYPTOPP_API StaticAlgorithmName() {return "CTR";} + +protected: + virtual void IncrementCounterBy256(); + + unsigned int GetAlignment() const {return m_cipher->OptimalDataAlignment();} + unsigned int GetBytesPerIteration() const {return BlockSize();} + unsigned int GetIterationsToBuffer() const {return m_cipher->OptimalNumberOfParallelBlocks();} + void WriteKeystream(byte *buffer, size_t iterationCount) + {OperateKeystream(WRITE_KEYSTREAM, buffer, NULL, iterationCount);} + bool CanOperateKeystream() const {return true;} + void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); + void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length); + void SeekToIteration(lword iterationCount); + + AlignedSecByteBlock m_counterArray; +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BlockOrientedCipherModeBase : public CipherModeBase +{ +public: + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); + unsigned int MandatoryBlockSize() const {return BlockSize();} + bool IsRandomAccess() const {return false;} + bool IsSelfInverting() const {return false;} + bool IsForwardTransformation() const {return m_cipher->IsForwardTransformation();} + void Resynchronize(const byte *iv, int length=-1) {memcpy_s(m_register, m_register.size(), iv, ThrowIfInvalidIVLength(length));} + +protected: + bool RequireAlignedInput() const {return true;} + void ResizeBuffers() + { + CipherModeBase::ResizeBuffers(); + m_buffer.New(BlockSize()); + } + + SecByteBlock m_buffer; +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE ECB_OneWay : public BlockOrientedCipherModeBase +{ +public: + void SetKey(const byte *key, size_t length, const NameValuePairs ¶ms = g_nullNameValuePairs) + {m_cipher->SetKey(key, length, params); BlockOrientedCipherModeBase::ResizeBuffers();} + IV_Requirement IVRequirement() const {return NOT_RESYNCHRONIZABLE;} + unsigned int OptimalBlockSize() const {return BlockSize() * m_cipher->OptimalNumberOfParallelBlocks();} + void ProcessData(byte *outString, const byte *inString, size_t length); + static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECB";} +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_ModeBase : public BlockOrientedCipherModeBase +{ +public: + IV_Requirement IVRequirement() const {return UNPREDICTABLE_RANDOM_IV;} + bool RequireAlignedInput() const {return false;} + unsigned int MinLastBlockSize() const {return 0;} + static const char * CRYPTOPP_API StaticAlgorithmName() {return "CBC";} +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_Encryption : public CBC_ModeBase +{ +public: + void ProcessData(byte *outString, const byte *inString, size_t length); +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_CTS_Encryption : public CBC_Encryption +{ +public: + void SetStolenIV(byte *iv) {m_stolenIV = iv;} + unsigned int MinLastBlockSize() const {return BlockSize()+1;} + void ProcessLastBlock(byte *outString, const byte *inString, size_t length); + static const char * CRYPTOPP_API StaticAlgorithmName() {return "CBC/CTS";} + +protected: + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) + { + CBC_Encryption::UncheckedSetKey(key, length, params); + m_stolenIV = params.GetValueWithDefault(Name::StolenIV(), (byte *)NULL); + } + + byte *m_stolenIV; +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_Decryption : public CBC_ModeBase +{ +public: + void ProcessData(byte *outString, const byte *inString, size_t length); + +protected: + void ResizeBuffers() + { + BlockOrientedCipherModeBase::ResizeBuffers(); + m_temp.New(BlockSize()); + } + AlignedSecByteBlock m_temp; +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_CTS_Decryption : public CBC_Decryption +{ +public: + unsigned int MinLastBlockSize() const {return BlockSize()+1;} + void ProcessLastBlock(byte *outString, const byte *inString, size_t length); +}; + +//! _ +template +class CipherModeFinalTemplate_CipherHolder : protected ObjectHolder, public AlgorithmImpl > +{ +public: + CipherModeFinalTemplate_CipherHolder() + { + this->m_cipher = &this->m_object; + this->ResizeBuffers(); + } + CipherModeFinalTemplate_CipherHolder(const byte *key, size_t length) + { + this->m_cipher = &this->m_object; + this->SetKey(key, length); + } + CipherModeFinalTemplate_CipherHolder(const byte *key, size_t length, const byte *iv) + { + this->m_cipher = &this->m_object; + this->SetKey(key, length, MakeParameters(Name::IV(), ConstByteArrayParameter(iv, this->m_cipher->BlockSize()))); + } + CipherModeFinalTemplate_CipherHolder(const byte *key, size_t length, const byte *iv, int feedbackSize) + { + this->m_cipher = &this->m_object; + this->SetKey(key, length, MakeParameters(Name::IV(), ConstByteArrayParameter(iv, this->m_cipher->BlockSize()))(Name::FeedbackSize(), feedbackSize)); + } + + static std::string CRYPTOPP_API StaticAlgorithmName() + {return CIPHER::StaticAlgorithmName() + "/" + BASE::StaticAlgorithmName();} +}; + +//! _ +template +class CipherModeFinalTemplate_ExternalCipher : public BASE +{ +public: + CipherModeFinalTemplate_ExternalCipher() {} + CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher) + {this->SetCipher(cipher);} + CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize = 0) + {this->SetCipherWithIV(cipher, iv, feedbackSize);} + + std::string AlgorithmName() const + {return (this->m_cipher ? this->m_cipher->AlgorithmName() + "/" : std::string("")) + BASE::StaticAlgorithmName();} +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate >; +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate >; +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate >; + +//! CFB mode +template +struct CFB_Mode : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_CipherHolder > > > Encryption; + typedef CipherModeFinalTemplate_CipherHolder > > > Decryption; +}; + +//! CFB mode, external cipher +struct CFB_Mode_ExternalCipher : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_ExternalCipher > > > Encryption; + typedef CipherModeFinalTemplate_ExternalCipher > > > Decryption; +}; + +//! CFB mode FIPS variant, requiring full block plaintext according to FIPS 800-38A +template +struct CFB_FIPS_Mode : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_CipherHolder > > > > Encryption; + typedef CipherModeFinalTemplate_CipherHolder > > > > Decryption; +}; + +//! CFB mode FIPS variant, requiring full block plaintext according to FIPS 800-38A, external cipher +struct CFB_FIPS_Mode_ExternalCipher : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_ExternalCipher > > > > Encryption; + typedef CipherModeFinalTemplate_ExternalCipher > > > > Decryption; +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate >; + +//! OFB mode +template +struct OFB_Mode : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_CipherHolder > > > Encryption; + typedef Encryption Decryption; +}; + +//! OFB mode, external cipher +struct OFB_Mode_ExternalCipher : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_ExternalCipher > > > Encryption; + typedef Encryption Decryption; +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate >; + +//! CTR mode +template +struct CTR_Mode : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_CipherHolder > > > Encryption; + typedef Encryption Decryption; +}; + +//! CTR mode, external cipher +struct CTR_Mode_ExternalCipher : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_ExternalCipher > > > Encryption; + typedef Encryption Decryption; +}; + +//! ECB mode +template +struct ECB_Mode : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_CipherHolder Encryption; + typedef CipherModeFinalTemplate_CipherHolder Decryption; +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher; + +//! ECB mode, external cipher +struct ECB_Mode_ExternalCipher : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_ExternalCipher Encryption; + typedef Encryption Decryption; +}; + +//! CBC mode +template +struct CBC_Mode : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_CipherHolder Encryption; + typedef CipherModeFinalTemplate_CipherHolder Decryption; +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher; +CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher; + +//! CBC mode, external cipher +struct CBC_Mode_ExternalCipher : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_ExternalCipher Encryption; + typedef CipherModeFinalTemplate_ExternalCipher Decryption; +}; + +//! CBC mode with ciphertext stealing +template +struct CBC_CTS_Mode : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_CipherHolder Encryption; + typedef CipherModeFinalTemplate_CipherHolder Decryption; +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher; +CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher; + +//! CBC mode with ciphertext stealing, external cipher +struct CBC_CTS_Mode_ExternalCipher : public CipherModeDocumentation +{ + typedef CipherModeFinalTemplate_ExternalCipher Encryption; + typedef CipherModeFinalTemplate_ExternalCipher Decryption; +}; + +#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY +typedef CFB_Mode_ExternalCipher::Encryption CFBEncryption; +typedef CFB_Mode_ExternalCipher::Decryption CFBDecryption; +typedef OFB_Mode_ExternalCipher::Encryption OFB; +typedef CTR_Mode_ExternalCipher::Encryption CounterMode; +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/modexppc.h b/cryptopp/modexppc.h new file mode 100644 index 0000000..fbe7012 --- /dev/null +++ b/cryptopp/modexppc.h @@ -0,0 +1,34 @@ +#ifndef CRYPTOPP_MODEXPPC_H +#define CRYPTOPP_MODEXPPC_H + +#include "modarith.h" +#include "eprecomp.h" +#include "smartptr.h" +#include "pubkey.h" + +NAMESPACE_BEGIN(CryptoPP) + +CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl; + +class ModExpPrecomputation : public DL_GroupPrecomputation +{ +public: + // DL_GroupPrecomputation + bool NeedConversions() const {return true;} + Element ConvertIn(const Element &v) const {return m_mr->ConvertIn(v);} + virtual Element ConvertOut(const Element &v) const {return m_mr->ConvertOut(v);} + const AbstractGroup & GetGroup() const {return m_mr->MultiplicativeGroup();} + Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);} + void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);} + + // non-inherited + void SetModulus(const Integer &v) {m_mr.reset(new MontgomeryRepresentation(v));} + const Integer & GetModulus() const {return m_mr->GetModulus();} + +private: + value_ptr m_mr; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/mqueue.cpp b/cryptopp/mqueue.cpp new file mode 100644 index 0000000..1d645d8 --- /dev/null +++ b/cryptopp/mqueue.cpp @@ -0,0 +1,174 @@ +// mqueue.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "mqueue.h" + +NAMESPACE_BEGIN(CryptoPP) + +MessageQueue::MessageQueue(unsigned int nodeSize) + : m_queue(nodeSize), m_lengths(1, 0U), m_messageCounts(1, 0U) +{ +} + +size_t MessageQueue::CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end, const std::string &channel, bool blocking) const +{ + if (begin >= MaxRetrievable()) + return 0; + + return m_queue.CopyRangeTo2(target, begin, STDMIN(MaxRetrievable(), end), channel, blocking); +} + +size_t MessageQueue::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking) +{ + transferBytes = STDMIN(MaxRetrievable(), transferBytes); + size_t blockedBytes = m_queue.TransferTo2(target, transferBytes, channel, blocking); + m_lengths.front() -= transferBytes; + return blockedBytes; +} + +bool MessageQueue::GetNextMessage() +{ + if (NumberOfMessages() > 0 && !AnyRetrievable()) + { + m_lengths.pop_front(); + if (m_messageCounts[0] == 0 && m_messageCounts.size() > 1) + m_messageCounts.pop_front(); + return true; + } + else + return false; +} + +unsigned int MessageQueue::CopyMessagesTo(BufferedTransformation &target, unsigned int count, const std::string &channel) const +{ + ByteQueue::Walker walker(m_queue); + std::deque::const_iterator it = m_lengths.begin(); + unsigned int i; + for (i=0; i 0 && q2.AnyRetrievable()) + { + size_t len = length; + const byte *data = q2.Spy(len); + len = STDMIN(len, length); + if (memcmp(inString, data, len) != 0) + goto mismatch; + inString += len; + length -= len; + q2.Skip(len); + } + + q1.Put(inString, length); + + if (messageEnd) + { + if (q2.AnyRetrievable()) + goto mismatch; + else if (q2.AnyMessages()) + q2.GetNextMessage(); + else if (q2.NumberOfMessageSeries() > 0) + goto mismatch; + else + q1.MessageEnd(); + } + + return 0; + +mismatch: + return HandleMismatchDetected(blocking); + } +} + +bool EqualityComparisonFilter::ChannelMessageSeriesEnd(const std::string &channel, int propagation, bool blocking) +{ + unsigned int i = MapChannel(channel); + + if (i == 2) + { + OutputMessageSeriesEnd(4, propagation, blocking, channel); + return false; + } + else if (m_mismatchDetected) + return false; + else + { + MessageQueue &q1 = m_q[i], &q2 = m_q[1-i]; + + if (q2.AnyRetrievable() || q2.AnyMessages()) + goto mismatch; + else if (q2.NumberOfMessageSeries() > 0) + return Output(2, (const byte *)"\1", 1, 0, blocking) != 0; + else + q1.MessageSeriesEnd(); + + return false; + +mismatch: + return HandleMismatchDetected(blocking); + } +} + +bool EqualityComparisonFilter::HandleMismatchDetected(bool blocking) +{ + m_mismatchDetected = true; + if (m_throwIfNotEqual) + throw MismatchDetected(); + return Output(1, (const byte *)"\0", 1, 0, blocking) != 0; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/mqueue.h b/cryptopp/mqueue.h new file mode 100644 index 0000000..efa57a7 --- /dev/null +++ b/cryptopp/mqueue.h @@ -0,0 +1,100 @@ +#ifndef CRYPTOPP_MQUEUE_H +#define CRYPTOPP_MQUEUE_H + +#include "queue.h" +#include "filters.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +//! Message Queue +class CRYPTOPP_DLL MessageQueue : public AutoSignaling +{ +public: + MessageQueue(unsigned int nodeSize=256); + + void IsolatedInitialize(const NameValuePairs ¶meters) + {m_queue.IsolatedInitialize(parameters); m_lengths.assign(1, 0U); m_messageCounts.assign(1, 0U);} + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking) + { + m_queue.Put(begin, length); + m_lengths.back() += length; + if (messageEnd) + { + m_lengths.push_back(0); + m_messageCounts.back()++; + } + return 0; + } + bool IsolatedFlush(bool hardFlush, bool blocking) {return false;} + bool IsolatedMessageSeriesEnd(bool blocking) + {m_messageCounts.push_back(0); return false;} + + lword MaxRetrievable() const + {return m_lengths.front();} + bool AnyRetrievable() const + {return m_lengths.front() > 0;} + + size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const; + + lword TotalBytesRetrievable() const + {return m_queue.MaxRetrievable();} + unsigned int NumberOfMessages() const + {return (unsigned int)m_lengths.size()-1;} + bool GetNextMessage(); + + unsigned int NumberOfMessagesInThisSeries() const + {return m_messageCounts[0];} + unsigned int NumberOfMessageSeries() const + {return (unsigned int)m_messageCounts.size()-1;} + + unsigned int CopyMessagesTo(BufferedTransformation &target, unsigned int count=UINT_MAX, const std::string &channel=DEFAULT_CHANNEL) const; + + const byte * Spy(size_t &contiguousSize) const; + + void swap(MessageQueue &rhs); + +private: + ByteQueue m_queue; + std::deque m_lengths; + std::deque m_messageCounts; +}; + + +//! A filter that checks messages on two channels for equality +class CRYPTOPP_DLL EqualityComparisonFilter : public Unflushable > +{ +public: + struct MismatchDetected : public Exception {MismatchDetected() : Exception(DATA_INTEGRITY_CHECK_FAILED, "EqualityComparisonFilter: did not receive the same data on two channels") {}}; + + /*! if throwIfNotEqual is false, this filter will output a '\\0' byte when it detects a mismatch, '\\1' otherwise */ + EqualityComparisonFilter(BufferedTransformation *attachment=NULL, bool throwIfNotEqual=true, const std::string &firstChannel="0", const std::string &secondChannel="1") + : m_throwIfNotEqual(throwIfNotEqual), m_mismatchDetected(false) + , m_firstChannel(firstChannel), m_secondChannel(secondChannel) + {Detach(attachment);} + + size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking); + bool ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1, bool blocking=true); + +private: + unsigned int MapChannel(const std::string &channel) const; + bool HandleMismatchDetected(bool blocking); + + bool m_throwIfNotEqual, m_mismatchDetected; + std::string m_firstChannel, m_secondChannel; + MessageQueue m_q[2]; +}; + +NAMESPACE_END + +#ifndef __BORLANDC__ +NAMESPACE_BEGIN(std) +template<> inline void swap(CryptoPP::MessageQueue &a, CryptoPP::MessageQueue &b) +{ + a.swap(b); +} +NAMESPACE_END +#endif + +#endif diff --git a/cryptopp/mqv.cpp b/cryptopp/mqv.cpp new file mode 100644 index 0000000..c427561 --- /dev/null +++ b/cryptopp/mqv.cpp @@ -0,0 +1,13 @@ +// mqv.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "mqv.h" + +NAMESPACE_BEGIN(CryptoPP) + +void TestInstantiations_MQV() +{ + MQV mqv; +} + +NAMESPACE_END diff --git a/cryptopp/mqv.h b/cryptopp/mqv.h new file mode 100644 index 0000000..2683817 --- /dev/null +++ b/cryptopp/mqv.h @@ -0,0 +1,141 @@ +#ifndef CRYPTOPP_MQV_H +#define CRYPTOPP_MQV_H + +/** \file +*/ + +#include "gfpcrypt.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +template +class MQV_Domain : public AuthenticatedKeyAgreementDomain +{ +public: + typedef GROUP_PARAMETERS GroupParameters; + typedef typename GroupParameters::Element Element; + typedef MQV_Domain Domain; + + MQV_Domain() {} + + MQV_Domain(const GroupParameters ¶ms) + : m_groupParameters(params) {} + + MQV_Domain(BufferedTransformation &bt) + {m_groupParameters.BERDecode(bt);} + + template + MQV_Domain(T1 v1, T2 v2) + {m_groupParameters.Initialize(v1, v2);} + + template + MQV_Domain(T1 v1, T2 v2, T3 v3) + {m_groupParameters.Initialize(v1, v2, v3);} + + template + MQV_Domain(T1 v1, T2 v2, T3 v3, T4 v4) + {m_groupParameters.Initialize(v1, v2, v3, v4);} + + const GroupParameters & GetGroupParameters() const {return m_groupParameters;} + GroupParameters & AccessGroupParameters() {return m_groupParameters;} + + CryptoParameters & AccessCryptoParameters() {return AccessAbstractGroupParameters();} + + unsigned int AgreedValueLength() const {return GetAbstractGroupParameters().GetEncodedElementSize(false);} + unsigned int StaticPrivateKeyLength() const {return GetAbstractGroupParameters().GetSubgroupOrder().ByteCount();} + unsigned int StaticPublicKeyLength() const {return GetAbstractGroupParameters().GetEncodedElementSize(true);} + + void GenerateStaticPrivateKey(RandomNumberGenerator &rng, byte *privateKey) const + { + Integer x(rng, Integer::One(), GetAbstractGroupParameters().GetMaxExponent()); + x.Encode(privateKey, StaticPrivateKeyLength()); + } + + void GenerateStaticPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const + { + const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); + Integer x(privateKey, StaticPrivateKeyLength()); + Element y = params.ExponentiateBase(x); + params.EncodeElement(true, y, publicKey); + } + + unsigned int EphemeralPrivateKeyLength() const {return StaticPrivateKeyLength() + StaticPublicKeyLength();} + unsigned int EphemeralPublicKeyLength() const {return StaticPublicKeyLength();} + + void GenerateEphemeralPrivateKey(RandomNumberGenerator &rng, byte *privateKey) const + { + const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); + Integer x(rng, Integer::One(), params.GetMaxExponent()); + x.Encode(privateKey, StaticPrivateKeyLength()); + Element y = params.ExponentiateBase(x); + params.EncodeElement(true, y, privateKey+StaticPrivateKeyLength()); + } + + void GenerateEphemeralPublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const + { + memcpy(publicKey, privateKey+StaticPrivateKeyLength(), EphemeralPublicKeyLength()); + } + + bool Agree(byte *agreedValue, + const byte *staticPrivateKey, const byte *ephemeralPrivateKey, + const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, + bool validateStaticOtherPublicKey=true) const + { + try + { + const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); + Element WW = params.DecodeElement(staticOtherPublicKey, validateStaticOtherPublicKey); + Element VV = params.DecodeElement(ephemeralOtherPublicKey, true); + + Integer s(staticPrivateKey, StaticPrivateKeyLength()); + Integer u(ephemeralPrivateKey, StaticPrivateKeyLength()); + Element V = params.DecodeElement(ephemeralPrivateKey+StaticPrivateKeyLength(), false); + + const Integer &r = params.GetSubgroupOrder(); + Integer h2 = Integer::Power2((r.BitCount()+1)/2); + Integer e = ((h2+params.ConvertElementToInteger(V)%h2)*s+u) % r; + Integer tt = h2 + params.ConvertElementToInteger(VV) % h2; + + if (COFACTOR_OPTION::ToEnum() == NO_COFACTOR_MULTIPLICTION) + { + Element P = params.ExponentiateElement(WW, tt); + P = m_groupParameters.MultiplyElements(P, VV); + Element R[2]; + const Integer e2[2] = {r, e}; + params.SimultaneousExponentiate(R, P, e2, 2); + if (!params.IsIdentity(R[0]) || params.IsIdentity(R[1])) + return false; + params.EncodeElement(false, R[1], agreedValue); + } + else + { + const Integer &k = params.GetCofactor(); + if (COFACTOR_OPTION::ToEnum() == COMPATIBLE_COFACTOR_MULTIPLICTION) + e = ModularArithmetic(r).Divide(e, k); + Element P = m_groupParameters.CascadeExponentiate(VV, k*e, WW, k*(e*tt%r)); + if (params.IsIdentity(P)) + return false; + params.EncodeElement(false, P, agreedValue); + } + } + catch (DL_BadElement &) + { + return false; + } + return true; + } + +private: + DL_GroupParameters & AccessAbstractGroupParameters() {return m_groupParameters;} + const DL_GroupParameters & GetAbstractGroupParameters() const {return m_groupParameters;} + + GroupParameters m_groupParameters; +}; + +//! Menezes-Qu-Vanstone in GF(p) with key validation, AKA MQV +typedef MQV_Domain MQV; + +NAMESPACE_END + +#endif diff --git a/cryptopp/nbtheory.cpp b/cryptopp/nbtheory.cpp new file mode 100644 index 0000000..3fdea4e --- /dev/null +++ b/cryptopp/nbtheory.cpp @@ -0,0 +1,1123 @@ +// nbtheory.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "nbtheory.h" +#include "modarith.h" +#include "algparam.h" + +#include +#include + +#ifdef _OPENMP +// needed in MSVC 2005 to generate correct manifest +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +const word s_lastSmallPrime = 32719; + +struct NewPrimeTable +{ + std::vector * operator()() const + { + const unsigned int maxPrimeTableSize = 3511; + + std::auto_ptr > pPrimeTable(new std::vector); + std::vector &primeTable = *pPrimeTable; + primeTable.reserve(maxPrimeTableSize); + + primeTable.push_back(2); + unsigned int testEntriesEnd = 1; + + for (unsigned int p=3; p<=s_lastSmallPrime; p+=2) + { + unsigned int j; + for (j=1; j &primeTable = Singleton, NewPrimeTable>().Ref(); + size = (unsigned int)primeTable.size(); + return &primeTable[0]; +} + +bool IsSmallPrime(const Integer &p) +{ + unsigned int primeTableSize; + const word16 * primeTable = GetPrimeTable(primeTableSize); + + if (p.IsPositive() && p <= primeTable[primeTableSize-1]) + return std::binary_search(primeTable, primeTable+primeTableSize, (word16)p.ConvertToLong()); + else + return false; +} + +bool TrialDivision(const Integer &p, unsigned bound) +{ + unsigned int primeTableSize; + const word16 * primeTable = GetPrimeTable(primeTableSize); + + assert(primeTable[primeTableSize-1] >= bound); + + unsigned int i; + for (i = 0; primeTable[i]3 && b>1 && b3 && b>1 && b>a; + + Integer z = a_exp_b_mod_c(b, m, n); + if (z==1 || z==nminus1) + return true; + for (unsigned j=1; j3); + + Integer b; + for (unsigned int i=0; i2); + + Integer b=3; + unsigned int i=0; + int j; + + while ((j=Jacobi(b.Squared()-4, n)) == 1) + { + if (++i==64 && n.IsSquare()) // avoid infinite loop if n is a square + return false; + ++b; ++b; + } + + if (j==0) + return false; + else + return Lucas(n+1, b, n)==2; +} + +bool IsStrongLucasProbablePrime(const Integer &n) +{ + if (n <= 1) + return false; + + if (n.IsEven()) + return n==2; + + assert(n>2); + + Integer b=3; + unsigned int i=0; + int j; + + while ((j=Jacobi(b.Squared()-4, n)) == 1) + { + if (++i==64 && n.IsSquare()) // avoid infinite loop if n is a square + return false; + ++b; ++b; + } + + if (j==0) + return false; + + Integer n1 = n+1; + unsigned int a; + + // calculate a = largest power of 2 that divides n1 + for (a=0; ; a++) + if (n1.GetBit(a)) + break; + Integer m = n1>>a; + + Integer z = Lucas(m, b, n); + if (z==2 || z==n-2) + return true; + for (i=1; i().Ref()) + return SmallDivisorsTest(p); + else + return SmallDivisorsTest(p) && IsStrongProbablePrime(p, 3) && IsStrongLucasProbablePrime(p); +} + +bool VerifyPrime(RandomNumberGenerator &rng, const Integer &p, unsigned int level) +{ + bool pass = IsPrime(p) && RabinMillerTest(rng, p, 1); + if (level >= 1) + pass = pass && RabinMillerTest(rng, p, 10); + return pass; +} + +unsigned int PrimeSearchInterval(const Integer &max) +{ + return max.BitCount(); +} + +static inline bool FastProbablePrimeTest(const Integer &n) +{ + return IsStrongProbablePrime(n,2); +} + +AlgorithmParameters MakeParametersForTwoPrimesOfEqualSize(unsigned int productBitLength) +{ + if (productBitLength < 16) + throw InvalidArgument("invalid bit length"); + + Integer minP, maxP; + + if (productBitLength%2==0) + { + minP = Integer(182) << (productBitLength/2-8); + maxP = Integer::Power2(productBitLength/2)-1; + } + else + { + minP = Integer::Power2((productBitLength-1)/2); + maxP = Integer(181) << ((productBitLength+1)/2-8); + } + + return MakeParameters("RandomNumberType", Integer::PRIME)("Min", minP)("Max", maxP); +} + +class PrimeSieve +{ +public: + // delta == 1 or -1 means double sieve with p = 2*q + delta + PrimeSieve(const Integer &first, const Integer &last, const Integer &step, signed int delta=0); + bool NextCandidate(Integer &c); + + void DoSieve(); + static void SieveSingle(std::vector &sieve, word16 p, const Integer &first, const Integer &step, word16 stepInv); + + Integer m_first, m_last, m_step; + signed int m_delta; + word m_next; + std::vector m_sieve; +}; + +PrimeSieve::PrimeSieve(const Integer &first, const Integer &last, const Integer &step, signed int delta) + : m_first(first), m_last(last), m_step(step), m_delta(delta), m_next(0) +{ + DoSieve(); +} + +bool PrimeSieve::NextCandidate(Integer &c) +{ + bool safe = SafeConvert(std::find(m_sieve.begin()+m_next, m_sieve.end(), false) - m_sieve.begin(), m_next); + assert(safe); + if (m_next == m_sieve.size()) + { + m_first += long(m_sieve.size())*m_step; + if (m_first > m_last) + return false; + else + { + m_next = 0; + DoSieve(); + return NextCandidate(c); + } + } + else + { + c = m_first + long(m_next)*m_step; + ++m_next; + return true; + } +} + +void PrimeSieve::SieveSingle(std::vector &sieve, word16 p, const Integer &first, const Integer &step, word16 stepInv) +{ + if (stepInv) + { + size_t sieveSize = sieve.size(); + size_t j = (word32(p-(first%p))*stepInv) % p; + // if the first multiple of p is p, skip it + if (first.WordCount() <= 1 && first + step*long(j) == p) + j += p; + for (; j < sieveSize; j += p) + sieve[j] = true; + } +} + +void PrimeSieve::DoSieve() +{ + unsigned int primeTableSize; + const word16 * primeTable = GetPrimeTable(primeTableSize); + + const unsigned int maxSieveSize = 32768; + unsigned int sieveSize = STDMIN(Integer(maxSieveSize), (m_last-m_first)/m_step+1).ConvertToLong(); + + m_sieve.clear(); + m_sieve.resize(sieveSize, false); + + if (m_delta == 0) + { + for (unsigned int i = 0; i < primeTableSize; ++i) + SieveSingle(m_sieve, primeTable[i], m_first, m_step, (word16)m_step.InverseMod(primeTable[i])); + } + else + { + assert(m_step%2==0); + Integer qFirst = (m_first-m_delta) >> 1; + Integer halfStep = m_step >> 1; + for (unsigned int i = 0; i < primeTableSize; ++i) + { + word16 p = primeTable[i]; + word16 stepInv = (word16)m_step.InverseMod(p); + SieveSingle(m_sieve, p, m_first, m_step, stepInv); + + word16 halfStepInv = 2*stepInv < p ? 2*stepInv : 2*stepInv-p; + SieveSingle(m_sieve, p, qFirst, halfStep, halfStepInv); + } + } +} + +bool FirstPrime(Integer &p, const Integer &max, const Integer &equiv, const Integer &mod, const PrimeSelector *pSelector) +{ + assert(!equiv.IsNegative() && equiv < mod); + + Integer gcd = GCD(equiv, mod); + if (gcd != Integer::One()) + { + // the only possible prime p such that p%mod==equiv where GCD(mod,equiv)!=1 is GCD(mod,equiv) + if (p <= gcd && gcd <= max && IsPrime(gcd) && (!pSelector || pSelector->IsAcceptable(gcd))) + { + p = gcd; + return true; + } + else + return false; + } + + unsigned int primeTableSize; + const word16 * primeTable = GetPrimeTable(primeTableSize); + + if (p <= primeTable[primeTableSize-1]) + { + const word16 *pItr; + + --p; + if (p.IsPositive()) + pItr = std::upper_bound(primeTable, primeTable+primeTableSize, (word)p.ConvertToLong()); + else + pItr = primeTable; + + while (pItr < primeTable+primeTableSize && !(*pItr%mod == equiv && (!pSelector || pSelector->IsAcceptable(*pItr)))) + ++pItr; + + if (pItr < primeTable+primeTableSize) + { + p = *pItr; + return p <= max; + } + + p = primeTable[primeTableSize-1]+1; + } + + assert(p > primeTable[primeTableSize-1]); + + if (mod.IsOdd()) + return FirstPrime(p, max, CRT(equiv, mod, 1, 2, 1), mod<<1, pSelector); + + p += (equiv-p)%mod; + + if (p>max) + return false; + + PrimeSieve sieve(p, max, mod); + + while (sieve.NextCandidate(p)) + { + if ((!pSelector || pSelector->IsAcceptable(p)) && FastProbablePrimeTest(p) && IsPrime(p)) + return true; + } + + return false; +} + +// the following two functions are based on code and comments provided by Preda Mihailescu +static bool ProvePrime(const Integer &p, const Integer &q) +{ + assert(p < q*q*q); + assert(p % q == 1); + +// this is the Quisquater test. Numbers p having passed the Lucas - Lehmer test +// for q and verifying p < q^3 can only be built up of two factors, both = 1 mod q, +// or be prime. The next two lines build the discriminant of a quadratic equation +// which holds iff p is built up of two factors (excercise ... ) + + Integer r = (p-1)/q; + if (((r%q).Squared()-4*(r/q)).IsSquare()) + return false; + + unsigned int primeTableSize; + const word16 * primeTable = GetPrimeTable(primeTableSize); + + assert(primeTableSize >= 50); + for (int i=0; i<50; i++) + { + Integer b = a_exp_b_mod_c(primeTable[i], r, p); + if (b != 1) + return a_exp_b_mod_c(b, q, p) == 1; + } + return false; +} + +Integer MihailescuProvablePrime(RandomNumberGenerator &rng, unsigned int pbits) +{ + Integer p; + Integer minP = Integer::Power2(pbits-1); + Integer maxP = Integer::Power2(pbits) - 1; + + if (maxP <= Integer(s_lastSmallPrime).Squared()) + { + // Randomize() will generate a prime provable by trial division + p.Randomize(rng, minP, maxP, Integer::PRIME); + return p; + } + + unsigned int qbits = (pbits+2)/3 + 1 + rng.GenerateWord32(0, pbits/36); + Integer q = MihailescuProvablePrime(rng, qbits); + Integer q2 = q<<1; + + while (true) + { + // this initializes the sieve to search in the arithmetic + // progression p = p_0 + \lambda * q2 = p_0 + 2 * \lambda * q, + // with q the recursively generated prime above. We will be able + // to use Lucas tets for proving primality. A trick of Quisquater + // allows taking q > cubic_root(p) rather then square_root: this + // decreases the recursion. + + p.Randomize(rng, minP, maxP, Integer::ANY, 1, q2); + PrimeSieve sieve(p, STDMIN(p+PrimeSearchInterval(maxP)*q2, maxP), q2); + + while (sieve.NextCandidate(p)) + { + if (FastProbablePrimeTest(p) && ProvePrime(p, q)) + return p; + } + } + + // not reached + return p; +} + +Integer MaurerProvablePrime(RandomNumberGenerator &rng, unsigned int bits) +{ + const unsigned smallPrimeBound = 29, c_opt=10; + Integer p; + + unsigned int primeTableSize; + const word16 * primeTable = GetPrimeTable(primeTableSize); + + if (bits < smallPrimeBound) + { + do + p.Randomize(rng, Integer::Power2(bits-1), Integer::Power2(bits)-1, Integer::ANY, 1, 2); + while (TrialDivision(p, 1 << ((bits+1)/2))); + } + else + { + const unsigned margin = bits > 50 ? 20 : (bits-10)/2; + double relativeSize; + do + relativeSize = pow(2.0, double(rng.GenerateWord32())/0xffffffff - 1); + while (bits * relativeSize >= bits - margin); + + Integer a,b; + Integer q = MaurerProvablePrime(rng, unsigned(bits*relativeSize)); + Integer I = Integer::Power2(bits-2)/q; + Integer I2 = I << 1; + unsigned int trialDivisorBound = (unsigned int)STDMIN((unsigned long)primeTable[primeTableSize-1], (unsigned long)bits*bits/c_opt); + bool success = false; + while (!success) + { + p.Randomize(rng, I, I2, Integer::ANY); + p *= q; p <<= 1; ++p; + if (!TrialDivision(p, trialDivisorBound)) + { + a.Randomize(rng, 2, p-1, Integer::ANY); + b = a_exp_b_mod_c(a, (p-1)/q, p); + success = (GCD(b-1, p) == 1) && (a_exp_b_mod_c(b, q, p) == 1); + } + } + } + return p; +} + +Integer CRT(const Integer &xp, const Integer &p, const Integer &xq, const Integer &q, const Integer &u) +{ + // isn't operator overloading great? + return p * (u * (xq-xp) % q) + xp; +/* + Integer t1 = xq-xp; + cout << hex << t1 << endl; + Integer t2 = u * t1; + cout << hex << t2 << endl; + Integer t3 = t2 % q; + cout << hex << t3 << endl; + Integer t4 = p * t3; + cout << hex << t4 << endl; + Integer t5 = t4 + xp; + cout << hex << t5 << endl; + return t5; +*/ +} + +Integer ModularSquareRoot(const Integer &a, const Integer &p) +{ + if (p%4 == 3) + return a_exp_b_mod_c(a, (p+1)/4, p); + + Integer q=p-1; + unsigned int r=0; + while (q.IsEven()) + { + r++; + q >>= 1; + } + + Integer n=2; + while (Jacobi(n, p) != -1) + ++n; + + Integer y = a_exp_b_mod_c(n, q, p); + Integer x = a_exp_b_mod_c(a, (q-1)/2, p); + Integer b = (x.Squared()%p)*a%p; + x = a*x%p; + Integer tempb, t; + + while (b != 1) + { + unsigned m=0; + tempb = b; + do + { + m++; + b = b.Squared()%p; + if (m==r) + return Integer::Zero(); + } + while (b != 1); + + t = y; + for (unsigned i=0; i>= 1; + b >>= 1; + k++; + } + + while (a[0]==0) + a >>= 1; + + while (b[0]==0) + b >>= 1; + + while (1) + { + switch (a.Compare(b)) + { + case -1: + b -= a; + while (b[0]==0) + b >>= 1; + break; + + case 0: + return (a <<= k); + + case 1: + a -= b; + while (a[0]==0) + a >>= 1; + break; + + default: + assert(false); + } + } +} + +Integer EuclideanMultiplicativeInverse(const Integer &a, const Integer &b) +{ + assert(b.Positive()); + + if (a.Negative()) + return EuclideanMultiplicativeInverse(a%b, b); + + if (b[0]==0) + { + if (!b || a[0]==0) + return Integer::Zero(); // no inverse + if (a==1) + return 1; + Integer u = EuclideanMultiplicativeInverse(b, a); + if (!u) + return Integer::Zero(); // no inverse + else + return (b*(a-u)+1)/a; + } + + Integer u=1, d=a, v1=b, v3=b, t1, t3, b2=(b+1)>>1; + + if (a[0]) + { + t1 = Integer::Zero(); + t3 = -b; + } + else + { + t1 = b2; + t3 = a>>1; + } + + while (!!t3) + { + while (t3[0]==0) + { + t3 >>= 1; + if (t1[0]==0) + t1 >>= 1; + else + { + t1 >>= 1; + t1 += b2; + } + } + if (t3.Positive()) + { + u = t1; + d = t3; + } + else + { + v1 = b-t1; + v3 = -t3; + } + t1 = u-v1; + t3 = d-v3; + if (t1.Negative()) + t1 += b; + } + if (d==1) + return u; + else + return Integer::Zero(); // no inverse +} +*/ + +int Jacobi(const Integer &aIn, const Integer &bIn) +{ + assert(bIn.IsOdd()); + + Integer b = bIn, a = aIn%bIn; + int result = 1; + + while (!!a) + { + unsigned i=0; + while (a.GetBit(i)==0) + i++; + a>>=i; + + if (i%2==1 && (b%8==3 || b%8==5)) + result = -result; + + if (a%4==3 && b%4==3) + result = -result; + + std::swap(a, b); + a %= b; + } + + return (b==1) ? result : 0; +} + +Integer Lucas(const Integer &e, const Integer &pIn, const Integer &n) +{ + unsigned i = e.BitCount(); + if (i==0) + return Integer::Two(); + + MontgomeryRepresentation m(n); + Integer p=m.ConvertIn(pIn%n), two=m.ConvertIn(Integer::Two()); + Integer v=p, v1=m.Subtract(m.Square(p), two); + + i--; + while (i--) + { + if (e.GetBit(i)) + { + // v = (v*v1 - p) % m; + v = m.Subtract(m.Multiply(v,v1), p); + // v1 = (v1*v1 - 2) % m; + v1 = m.Subtract(m.Square(v1), two); + } + else + { + // v1 = (v*v1 - p) % m; + v1 = m.Subtract(m.Multiply(v,v1), p); + // v = (v*v - 2) % m; + v = m.Subtract(m.Square(v), two); + } + } + return m.ConvertOut(v); +} + +// This is Peter Montgomery's unpublished Lucas sequence evalutation algorithm. +// The total number of multiplies and squares used is less than the binary +// algorithm (see above). Unfortunately I can't get it to run as fast as +// the binary algorithm because of the extra overhead. +/* +Integer Lucas(const Integer &n, const Integer &P, const Integer &modulus) +{ + if (!n) + return 2; + +#define f(A, B, C) m.Subtract(m.Multiply(A, B), C) +#define X2(A) m.Subtract(m.Square(A), two) +#define X3(A) m.Multiply(A, m.Subtract(m.Square(A), three)) + + MontgomeryRepresentation m(modulus); + Integer two=m.ConvertIn(2), three=m.ConvertIn(3); + Integer A=m.ConvertIn(P), B, C, p, d=n, e, r, t, T, U; + + while (d!=1) + { + p = d; + unsigned int b = WORD_BITS * p.WordCount(); + Integer alpha = (Integer(5)<<(2*b-2)).SquareRoot() - Integer::Power2(b-1); + r = (p*alpha)>>b; + e = d-r; + B = A; + C = two; + d = r; + + while (d!=e) + { + if (d>2)) + if ((dm3+em3==0 || dm3+em3==3) && (t = e, t >>= 2, t += e, d <= t)) + { + // #1 +// t = (d+d-e)/3; +// t = d; t += d; t -= e; t /= 3; +// e = (e+e-d)/3; +// e += e; e -= d; e /= 3; +// d = t; + +// t = (d+e)/3 + t = d; t += e; t /= 3; + e -= t; + d -= t; + + T = f(A, B, C); + U = f(T, A, B); + B = f(T, B, A); + A = U; + continue; + } + +// if (dm6 == em6 && d <= e + (e>>2)) + if (dm3 == em3 && dm2 == em2 && (t = e, t >>= 2, t += e, d <= t)) + { + // #2 +// d = (d-e)>>1; + d -= e; d >>= 1; + B = f(A, B, C); + A = X2(A); + continue; + } + +// if (d <= (e<<2)) + if (d <= (t = e, t <<= 2)) + { + // #3 + d -= e; + C = f(A, B, C); + swap(B, C); + continue; + } + + if (dm2 == em2) + { + // #4 +// d = (d-e)>>1; + d -= e; d >>= 1; + B = f(A, B, C); + A = X2(A); + continue; + } + + if (dm2 == 0) + { + // #5 + d >>= 1; + C = f(A, C, B); + A = X2(A); + continue; + } + + if (dm3 == 0) + { + // #6 +// d = d/3 - e; + d /= 3; d -= e; + T = X2(A); + C = f(T, f(A, B, C), C); + swap(B, C); + A = f(T, A, A); + continue; + } + + if (dm3+em3==0 || dm3+em3==3) + { + // #7 +// d = (d-e-e)/3; + d -= e; d -= e; d /= 3; + T = f(A, B, C); + B = f(T, A, B); + A = X3(A); + continue; + } + + if (dm3 == em3) + { + // #8 +// d = (d-e)/3; + d -= e; d /= 3; + T = f(A, B, C); + C = f(A, C, B); + B = T; + A = X3(A); + continue; + } + + assert(em2 == 0); + // #9 + e >>= 1; + C = f(C, B, A); + B = X2(B); + } + + A = f(A, B, C); + } + +#undef f +#undef X2 +#undef X3 + + return m.ConvertOut(A); +} +*/ + +Integer InverseLucas(const Integer &e, const Integer &m, const Integer &p, const Integer &q, const Integer &u) +{ + Integer d = (m*m-4); + Integer p2, q2; + #pragma omp parallel + #pragma omp sections + { + #pragma omp section + { + p2 = p-Jacobi(d,p); + p2 = Lucas(EuclideanMultiplicativeInverse(e,p2), m, p); + } + #pragma omp section + { + q2 = q-Jacobi(d,q); + q2 = Lucas(EuclideanMultiplicativeInverse(e,q2), m, q); + } + } + return CRT(p2, p, q2, q, u); +} + +unsigned int FactoringWorkFactor(unsigned int n) +{ + // extrapolated from the table in Odlyzko's "The Future of Integer Factorization" + // updated to reflect the factoring of RSA-130 + if (n<5) return 0; + else return (unsigned int)(2.4 * pow((double)n, 1.0/3.0) * pow(log(double(n)), 2.0/3.0) - 5); +} + +unsigned int DiscreteLogWorkFactor(unsigned int n) +{ + // assuming discrete log takes about the same time as factoring + if (n<5) return 0; + else return (unsigned int)(2.4 * pow((double)n, 1.0/3.0) * pow(log(double(n)), 2.0/3.0) - 5); +} + +// ******************************************************** + +void PrimeAndGenerator::Generate(signed int delta, RandomNumberGenerator &rng, unsigned int pbits, unsigned int qbits) +{ + // no prime exists for delta = -1, qbits = 4, and pbits = 5 + assert(qbits > 4); + assert(pbits > qbits); + + if (qbits+1 == pbits) + { + Integer minP = Integer::Power2(pbits-1); + Integer maxP = Integer::Power2(pbits) - 1; + bool success = false; + + while (!success) + { + p.Randomize(rng, minP, maxP, Integer::ANY, 6+5*delta, 12); + PrimeSieve sieve(p, STDMIN(p+PrimeSearchInterval(maxP)*12, maxP), 12, delta); + + while (sieve.NextCandidate(p)) + { + assert(IsSmallPrime(p) || SmallDivisorsTest(p)); + q = (p-delta) >> 1; + assert(IsSmallPrime(q) || SmallDivisorsTest(q)); + if (FastProbablePrimeTest(q) && FastProbablePrimeTest(p) && IsPrime(q) && IsPrime(p)) + { + success = true; + break; + } + } + } + + if (delta == 1) + { + // find g such that g is a quadratic residue mod p, then g has order q + // g=4 always works, but this way we get the smallest quadratic residue (other than 1) + for (g=2; Jacobi(g, p) != 1; ++g) {} + // contributed by Walt Tuvell: g should be the following according to the Law of Quadratic Reciprocity + assert((p%8==1 || p%8==7) ? g==2 : (p%12==1 || p%12==11) ? g==3 : g==4); + } + else + { + assert(delta == -1); + // find g such that g*g-4 is a quadratic non-residue, + // and such that g has order q + for (g=3; ; ++g) + if (Jacobi(g*g-4, p)==-1 && Lucas(q, g, p)==2) + break; + } + } + else + { + Integer minQ = Integer::Power2(qbits-1); + Integer maxQ = Integer::Power2(qbits) - 1; + Integer minP = Integer::Power2(pbits-1); + Integer maxP = Integer::Power2(pbits) - 1; + + do + { + q.Randomize(rng, minQ, maxQ, Integer::PRIME); + } while (!p.Randomize(rng, minP, maxP, Integer::PRIME, delta%q, q)); + + // find a random g of order q + if (delta==1) + { + do + { + Integer h(rng, 2, p-2, Integer::ANY); + g = a_exp_b_mod_c(h, (p-1)/q, p); + } while (g <= 1); + assert(a_exp_b_mod_c(g, q, p)==1); + } + else + { + assert(delta==-1); + do + { + Integer h(rng, 3, p-1, Integer::ANY); + if (Jacobi(h*h-4, p)==1) + continue; + g = Lucas((p+1)/q, h, p); + } while (g <= 2); + assert(Lucas(q, g, p) == 2); + } + } +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/nbtheory.h b/cryptopp/nbtheory.h new file mode 100644 index 0000000..6364792 --- /dev/null +++ b/cryptopp/nbtheory.h @@ -0,0 +1,131 @@ +// nbtheory.h - written and placed in the public domain by Wei Dai + +#ifndef CRYPTOPP_NBTHEORY_H +#define CRYPTOPP_NBTHEORY_H + +#include "integer.h" +#include "algparam.h" + +NAMESPACE_BEGIN(CryptoPP) + +// obtain pointer to small prime table and get its size +CRYPTOPP_DLL const word16 * CRYPTOPP_API GetPrimeTable(unsigned int &size); + +// ************ primality testing **************** + +// generate a provable prime +CRYPTOPP_DLL Integer CRYPTOPP_API MaurerProvablePrime(RandomNumberGenerator &rng, unsigned int bits); +CRYPTOPP_DLL Integer CRYPTOPP_API MihailescuProvablePrime(RandomNumberGenerator &rng, unsigned int bits); + +CRYPTOPP_DLL bool CRYPTOPP_API IsSmallPrime(const Integer &p); + +// returns true if p is divisible by some prime less than bound +// bound not be greater than the largest entry in the prime table +CRYPTOPP_DLL bool CRYPTOPP_API TrialDivision(const Integer &p, unsigned bound); + +// returns true if p is NOT divisible by small primes +CRYPTOPP_DLL bool CRYPTOPP_API SmallDivisorsTest(const Integer &p); + +// These is no reason to use these two, use the ones below instead +CRYPTOPP_DLL bool CRYPTOPP_API IsFermatProbablePrime(const Integer &n, const Integer &b); +CRYPTOPP_DLL bool CRYPTOPP_API IsLucasProbablePrime(const Integer &n); + +CRYPTOPP_DLL bool CRYPTOPP_API IsStrongProbablePrime(const Integer &n, const Integer &b); +CRYPTOPP_DLL bool CRYPTOPP_API IsStrongLucasProbablePrime(const Integer &n); + +// Rabin-Miller primality test, i.e. repeating the strong probable prime test +// for several rounds with random bases +CRYPTOPP_DLL bool CRYPTOPP_API RabinMillerTest(RandomNumberGenerator &rng, const Integer &w, unsigned int rounds); + +// primality test, used to generate primes +CRYPTOPP_DLL bool CRYPTOPP_API IsPrime(const Integer &p); + +// more reliable than IsPrime(), used to verify primes generated by others +CRYPTOPP_DLL bool CRYPTOPP_API VerifyPrime(RandomNumberGenerator &rng, const Integer &p, unsigned int level = 1); + +class CRYPTOPP_DLL PrimeSelector +{ +public: + const PrimeSelector *GetSelectorPointer() const {return this;} + virtual bool IsAcceptable(const Integer &candidate) const =0; +}; + +// use a fast sieve to find the first probable prime in {x | p<=x<=max and x%mod==equiv} +// returns true iff successful, value of p is undefined if no such prime exists +CRYPTOPP_DLL bool CRYPTOPP_API FirstPrime(Integer &p, const Integer &max, const Integer &equiv, const Integer &mod, const PrimeSelector *pSelector); + +CRYPTOPP_DLL unsigned int CRYPTOPP_API PrimeSearchInterval(const Integer &max); + +CRYPTOPP_DLL AlgorithmParameters CRYPTOPP_API MakeParametersForTwoPrimesOfEqualSize(unsigned int productBitLength); + +// ********** other number theoretic functions ************ + +inline Integer GCD(const Integer &a, const Integer &b) + {return Integer::Gcd(a,b);} +inline bool RelativelyPrime(const Integer &a, const Integer &b) + {return Integer::Gcd(a,b) == Integer::One();} +inline Integer LCM(const Integer &a, const Integer &b) + {return a/Integer::Gcd(a,b)*b;} +inline Integer EuclideanMultiplicativeInverse(const Integer &a, const Integer &b) + {return a.InverseMod(b);} + +// use Chinese Remainder Theorem to calculate x given x mod p and x mod q, and u = inverse of p mod q +CRYPTOPP_DLL Integer CRYPTOPP_API CRT(const Integer &xp, const Integer &p, const Integer &xq, const Integer &q, const Integer &u); + +// if b is prime, then Jacobi(a, b) returns 0 if a%b==0, 1 if a is quadratic residue mod b, -1 otherwise +// check a number theory book for what Jacobi symbol means when b is not prime +CRYPTOPP_DLL int CRYPTOPP_API Jacobi(const Integer &a, const Integer &b); + +// calculates the Lucas function V_e(p, 1) mod n +CRYPTOPP_DLL Integer CRYPTOPP_API Lucas(const Integer &e, const Integer &p, const Integer &n); +// calculates x such that m==Lucas(e, x, p*q), p q primes, u=inverse of p mod q +CRYPTOPP_DLL Integer CRYPTOPP_API InverseLucas(const Integer &e, const Integer &m, const Integer &p, const Integer &q, const Integer &u); + +inline Integer ModularExponentiation(const Integer &a, const Integer &e, const Integer &m) + {return a_exp_b_mod_c(a, e, m);} +// returns x such that x*x%p == a, p prime +CRYPTOPP_DLL Integer CRYPTOPP_API ModularSquareRoot(const Integer &a, const Integer &p); +// returns x such that a==ModularExponentiation(x, e, p*q), p q primes, +// and e relatively prime to (p-1)*(q-1) +// dp=d%(p-1), dq=d%(q-1), (d is inverse of e mod (p-1)*(q-1)) +// and u=inverse of p mod q +CRYPTOPP_DLL Integer CRYPTOPP_API ModularRoot(const Integer &a, const Integer &dp, const Integer &dq, const Integer &p, const Integer &q, const Integer &u); + +// find r1 and r2 such that ax^2 + bx + c == 0 (mod p) for x in {r1, r2}, p prime +// returns true if solutions exist +CRYPTOPP_DLL bool CRYPTOPP_API SolveModularQuadraticEquation(Integer &r1, Integer &r2, const Integer &a, const Integer &b, const Integer &c, const Integer &p); + +// returns log base 2 of estimated number of operations to calculate discrete log or factor a number +CRYPTOPP_DLL unsigned int CRYPTOPP_API DiscreteLogWorkFactor(unsigned int bitlength); +CRYPTOPP_DLL unsigned int CRYPTOPP_API FactoringWorkFactor(unsigned int bitlength); + +// ******************************************************** + +//! generator of prime numbers of special forms +class CRYPTOPP_DLL PrimeAndGenerator +{ +public: + PrimeAndGenerator() {} + // generate a random prime p of the form 2*q+delta, where delta is 1 or -1 and q is also prime + // Precondition: pbits > 5 + // warning: this is slow, because primes of this form are harder to find + PrimeAndGenerator(signed int delta, RandomNumberGenerator &rng, unsigned int pbits) + {Generate(delta, rng, pbits, pbits-1);} + // generate a random prime p of the form 2*r*q+delta, where q is also prime + // Precondition: qbits > 4 && pbits > qbits + PrimeAndGenerator(signed int delta, RandomNumberGenerator &rng, unsigned int pbits, unsigned qbits) + {Generate(delta, rng, pbits, qbits);} + + void Generate(signed int delta, RandomNumberGenerator &rng, unsigned int pbits, unsigned qbits); + + const Integer& Prime() const {return p;} + const Integer& SubPrime() const {return q;} + const Integer& Generator() const {return g;} + +private: + Integer p, q, g; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/network.cpp b/cryptopp/network.cpp new file mode 100644 index 0000000..9b7198d --- /dev/null +++ b/cryptopp/network.cpp @@ -0,0 +1,550 @@ +// network.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "network.h" +#include "wait.h" + +#define CRYPTOPP_TRACE_NETWORK 0 + +NAMESPACE_BEGIN(CryptoPP) + +#ifdef HIGHRES_TIMER_AVAILABLE + +lword LimitedBandwidth::ComputeCurrentTransceiveLimit() +{ + if (!m_maxBytesPerSecond) + return ULONG_MAX; + + double curTime = GetCurTimeAndCleanUp(); + lword total = 0; + for (OpQueue::size_type i=0; i!=m_ops.size(); ++i) + total += m_ops[i].second; + return SaturatingSubtract(m_maxBytesPerSecond, total); +} + +double LimitedBandwidth::TimeToNextTransceive() +{ + if (!m_maxBytesPerSecond) + return 0; + + if (!m_nextTransceiveTime) + ComputeNextTransceiveTime(); + + return SaturatingSubtract(m_nextTransceiveTime, m_timer.ElapsedTimeAsDouble()); +} + +void LimitedBandwidth::NoteTransceive(lword size) +{ + if (m_maxBytesPerSecond) + { + double curTime = GetCurTimeAndCleanUp(); + m_ops.push_back(std::make_pair(curTime, size)); + m_nextTransceiveTime = 0; + } +} + +void LimitedBandwidth::ComputeNextTransceiveTime() +{ + double curTime = GetCurTimeAndCleanUp(); + lword total = 0; + for (unsigned int i=0; i!=m_ops.size(); ++i) + total += m_ops[i].second; + m_nextTransceiveTime = + (total < m_maxBytesPerSecond) ? curTime : m_ops.front().first + 1000; +} + +double LimitedBandwidth::GetCurTimeAndCleanUp() +{ + if (!m_maxBytesPerSecond) + return 0; + + double curTime = m_timer.ElapsedTimeAsDouble(); + while (m_ops.size() && (m_ops.front().first + 1000 < curTime)) + m_ops.pop_front(); + return curTime; +} + +void LimitedBandwidth::GetWaitObjects(WaitObjectContainer &container, const CallStack &callStack) +{ + double nextTransceiveTime = TimeToNextTransceive(); + if (nextTransceiveTime) + container.ScheduleEvent(nextTransceiveTime, CallStack("LimitedBandwidth::GetWaitObjects()", &callStack)); +} + +// ************************************************************* + +size_t NonblockingSource::GeneralPump2( + lword& byteCount, bool blockingOutput, + unsigned long maxTime, bool checkDelimiter, byte delimiter) +{ + m_blockedBySpeedLimit = false; + + if (!GetMaxBytesPerSecond()) + { + size_t ret = DoPump(byteCount, blockingOutput, maxTime, checkDelimiter, delimiter); + m_doPumpBlocked = (ret != 0); + return ret; + } + + bool forever = (maxTime == INFINITE_TIME); + unsigned long timeToGo = maxTime; + Timer timer(Timer::MILLISECONDS, forever); + lword maxSize = byteCount; + byteCount = 0; + + timer.StartTimer(); + + while (true) + { + lword curMaxSize = UnsignedMin(ComputeCurrentTransceiveLimit(), maxSize - byteCount); + + if (curMaxSize || m_doPumpBlocked) + { + if (!forever) timeToGo = SaturatingSubtract(maxTime, timer.ElapsedTime()); + size_t ret = DoPump(curMaxSize, blockingOutput, timeToGo, checkDelimiter, delimiter); + m_doPumpBlocked = (ret != 0); + if (curMaxSize) + { + NoteTransceive(curMaxSize); + byteCount += curMaxSize; + } + if (ret) + return ret; + } + + if (maxSize != ULONG_MAX && byteCount >= maxSize) + break; + + if (!forever) + { + timeToGo = SaturatingSubtract(maxTime, timer.ElapsedTime()); + if (!timeToGo) + break; + } + + double waitTime = TimeToNextTransceive(); + if (!forever && waitTime > timeToGo) + { + m_blockedBySpeedLimit = true; + break; + } + + WaitObjectContainer container; + LimitedBandwidth::GetWaitObjects(container, CallStack("NonblockingSource::GeneralPump2() - speed limit", 0)); + container.Wait((unsigned long)waitTime); + } + + return 0; +} + +size_t NonblockingSource::PumpMessages2(unsigned int &messageCount, bool blocking) +{ + if (messageCount == 0) + return 0; + + messageCount = 0; + + lword byteCount; + do { + byteCount = LWORD_MAX; + RETURN_IF_NONZERO(Pump2(byteCount, blocking)); + } while(byteCount == LWORD_MAX); + + if (!m_messageEndSent && SourceExhausted()) + { + RETURN_IF_NONZERO(AttachedTransformation()->Put2(NULL, 0, GetAutoSignalPropagation(), true)); + m_messageEndSent = true; + messageCount = 1; + } + return 0; +} + +lword NonblockingSink::TimedFlush(unsigned long maxTime, size_t targetSize) +{ + m_blockedBySpeedLimit = false; + + size_t curBufSize = GetCurrentBufferSize(); + if (curBufSize <= targetSize && (targetSize || !EofPending())) + return 0; + + if (!GetMaxBytesPerSecond()) + return DoFlush(maxTime, targetSize); + + bool forever = (maxTime == INFINITE_TIME); + unsigned long timeToGo = maxTime; + Timer timer(Timer::MILLISECONDS, forever); + lword totalFlushed = 0; + + timer.StartTimer(); + + while (true) + { + size_t flushSize = UnsignedMin(curBufSize - targetSize, ComputeCurrentTransceiveLimit()); + if (flushSize || EofPending()) + { + if (!forever) timeToGo = SaturatingSubtract(maxTime, timer.ElapsedTime()); + size_t ret = (size_t)DoFlush(timeToGo, curBufSize - flushSize); + if (ret) + { + NoteTransceive(ret); + curBufSize -= ret; + totalFlushed += ret; + } + } + + if (curBufSize <= targetSize && (targetSize || !EofPending())) + break; + + if (!forever) + { + timeToGo = SaturatingSubtract(maxTime, timer.ElapsedTime()); + if (!timeToGo) + break; + } + + double waitTime = TimeToNextTransceive(); + if (!forever && waitTime > timeToGo) + { + m_blockedBySpeedLimit = true; + break; + } + + WaitObjectContainer container; + LimitedBandwidth::GetWaitObjects(container, CallStack("NonblockingSink::TimedFlush() - speed limit", 0)); + container.Wait((unsigned long)waitTime); + } + + return totalFlushed; +} + +bool NonblockingSink::IsolatedFlush(bool hardFlush, bool blocking) +{ + TimedFlush(blocking ? INFINITE_TIME : 0); + return hardFlush && (!!GetCurrentBufferSize() || EofPending()); +} + +// ************************************************************* + +NetworkSource::NetworkSource(BufferedTransformation *attachment) + : NonblockingSource(attachment), m_buf(1024*16) + , m_waitingForResult(false), m_outputBlocked(false) + , m_dataBegin(0), m_dataEnd(0) +{ +} + +unsigned int NetworkSource::GetMaxWaitObjectCount() const +{ + return LimitedBandwidth::GetMaxWaitObjectCount() + + GetReceiver().GetMaxWaitObjectCount() + + AttachedTransformation()->GetMaxWaitObjectCount(); +} + +void NetworkSource::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) +{ + if (BlockedBySpeedLimit()) + LimitedBandwidth::GetWaitObjects(container, CallStack("NetworkSource::GetWaitObjects() - speed limit", &callStack)); + else if (!m_outputBlocked) + { + if (m_dataBegin == m_dataEnd) + AccessReceiver().GetWaitObjects(container, CallStack("NetworkSource::GetWaitObjects() - no data", &callStack)); + else + container.SetNoWait(CallStack("NetworkSource::GetWaitObjects() - have data", &callStack)); + } + + AttachedTransformation()->GetWaitObjects(container, CallStack("NetworkSource::GetWaitObjects() - attachment", &callStack)); +} + +size_t NetworkSource::DoPump(lword &byteCount, bool blockingOutput, unsigned long maxTime, bool checkDelimiter, byte delimiter) +{ + NetworkReceiver &receiver = AccessReceiver(); + + lword maxSize = byteCount; + byteCount = 0; + bool forever = maxTime == INFINITE_TIME; + Timer timer(Timer::MILLISECONDS, forever); + BufferedTransformation *t = AttachedTransformation(); + + if (m_outputBlocked) + goto DoOutput; + + while (true) + { + if (m_dataBegin == m_dataEnd) + { + if (receiver.EofReceived()) + break; + + if (m_waitingForResult) + { + if (receiver.MustWaitForResult() && + !receiver.Wait(SaturatingSubtract(maxTime, timer.ElapsedTime()), + CallStack("NetworkSource::DoPump() - wait receive result", 0))) + break; + + unsigned int recvResult = receiver.GetReceiveResult(); +#if CRYPTOPP_TRACE_NETWORK + OutputDebugString((IntToString((unsigned int)this) + ": Received " + IntToString(recvResult) + " bytes\n").c_str()); +#endif + m_dataEnd += recvResult; + m_waitingForResult = false; + + if (!receiver.MustWaitToReceive() && !receiver.EofReceived() && m_dataEnd != m_buf.size()) + goto ReceiveNoWait; + } + else + { + m_dataEnd = m_dataBegin = 0; + + if (receiver.MustWaitToReceive()) + { + if (!receiver.Wait(SaturatingSubtract(maxTime, timer.ElapsedTime()), + CallStack("NetworkSource::DoPump() - wait receive", 0))) + break; + + receiver.Receive(m_buf+m_dataEnd, m_buf.size()-m_dataEnd); + m_waitingForResult = true; + } + else + { +ReceiveNoWait: + m_waitingForResult = true; + // call Receive repeatedly as long as data is immediately available, + // because some receivers tend to return data in small pieces +#if CRYPTOPP_TRACE_NETWORK + OutputDebugString((IntToString((unsigned int)this) + ": Receiving " + IntToString(m_buf.size()-m_dataEnd) + " bytes\n").c_str()); +#endif + while (receiver.Receive(m_buf+m_dataEnd, m_buf.size()-m_dataEnd)) + { + unsigned int recvResult = receiver.GetReceiveResult(); +#if CRYPTOPP_TRACE_NETWORK + OutputDebugString((IntToString((unsigned int)this) + ": Received " + IntToString(recvResult) + " bytes\n").c_str()); +#endif + m_dataEnd += recvResult; + if (receiver.EofReceived() || m_dataEnd > m_buf.size() /2) + { + m_waitingForResult = false; + break; + } + } + } + } + } + else + { + m_putSize = UnsignedMin(m_dataEnd - m_dataBegin, maxSize - byteCount); + + if (checkDelimiter) + m_putSize = std::find(m_buf+m_dataBegin, m_buf+m_dataBegin+m_putSize, delimiter) - (m_buf+m_dataBegin); + +DoOutput: + size_t result = t->PutModifiable2(m_buf+m_dataBegin, m_putSize, 0, forever || blockingOutput); + if (result) + { + if (t->Wait(SaturatingSubtract(maxTime, timer.ElapsedTime()), + CallStack("NetworkSource::DoPump() - wait attachment", 0))) + goto DoOutput; + else + { + m_outputBlocked = true; + return result; + } + } + m_outputBlocked = false; + + byteCount += m_putSize; + m_dataBegin += m_putSize; + if (checkDelimiter && m_dataBegin < m_dataEnd && m_buf[m_dataBegin] == delimiter) + break; + if (maxSize != ULONG_MAX && byteCount == maxSize) + break; + // once time limit is reached, return even if there is more data waiting + // but make 0 a special case so caller can request a large amount of data to be + // pumped as long as it is immediately available + if (maxTime > 0 && timer.ElapsedTime() > maxTime) + break; + } + } + + return 0; +} + +// ************************************************************* + +NetworkSink::NetworkSink(unsigned int maxBufferSize, unsigned int autoFlushBound) + : m_maxBufferSize(maxBufferSize), m_autoFlushBound(autoFlushBound) + , m_needSendResult(false), m_wasBlocked(false), m_eofState(EOF_NONE) + , m_buffer(STDMIN(16U*1024U+256, maxBufferSize)), m_skipBytes(0) + , m_speedTimer(Timer::MILLISECONDS), m_byteCountSinceLastTimerReset(0) + , m_currentSpeed(0), m_maxObservedSpeed(0) +{ +} + +float NetworkSink::ComputeCurrentSpeed() +{ + if (m_speedTimer.ElapsedTime() > 1000) + { + m_currentSpeed = m_byteCountSinceLastTimerReset * 1000 / m_speedTimer.ElapsedTime(); + m_maxObservedSpeed = STDMAX(m_currentSpeed, m_maxObservedSpeed * 0.98f); + m_byteCountSinceLastTimerReset = 0; + m_speedTimer.StartTimer(); +// OutputDebugString(("max speed: " + IntToString((int)m_maxObservedSpeed) + " current speed: " + IntToString((int)m_currentSpeed) + "\n").c_str()); + } + return m_currentSpeed; +} + +float NetworkSink::GetMaxObservedSpeed() const +{ + lword m = GetMaxBytesPerSecond(); + return m ? STDMIN(m_maxObservedSpeed, float(CRYPTOPP_VC6_INT64 m)) : m_maxObservedSpeed; +} + +unsigned int NetworkSink::GetMaxWaitObjectCount() const +{ + return LimitedBandwidth::GetMaxWaitObjectCount() + GetSender().GetMaxWaitObjectCount(); +} + +void NetworkSink::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) +{ + if (BlockedBySpeedLimit()) + LimitedBandwidth::GetWaitObjects(container, CallStack("NetworkSink::GetWaitObjects() - speed limit", &callStack)); + else if (m_wasBlocked) + AccessSender().GetWaitObjects(container, CallStack("NetworkSink::GetWaitObjects() - was blocked", &callStack)); + else if (!m_buffer.IsEmpty()) + AccessSender().GetWaitObjects(container, CallStack("NetworkSink::GetWaitObjects() - buffer not empty", &callStack)); + else if (EofPending()) + AccessSender().GetWaitObjects(container, CallStack("NetworkSink::GetWaitObjects() - EOF pending", &callStack)); +} + +size_t NetworkSink::Put2(const byte *inString, size_t length, int messageEnd, bool blocking) +{ + if (m_eofState == EOF_DONE) + { + if (length || messageEnd) + throw Exception(Exception::OTHER_ERROR, "NetworkSink::Put2() being called after EOF had been sent"); + + return 0; + } + + if (m_eofState > EOF_NONE) + goto EofSite; + + { + if (m_skipBytes) + { + assert(length >= m_skipBytes); + inString += m_skipBytes; + length -= m_skipBytes; + } + + m_buffer.Put(inString, length); + + if (!blocking || m_buffer.CurrentSize() > m_autoFlushBound) + TimedFlush(0, 0); + + size_t targetSize = messageEnd ? 0 : m_maxBufferSize; + if (blocking) + TimedFlush(INFINITE_TIME, targetSize); + + if (m_buffer.CurrentSize() > targetSize) + { + assert(!blocking); + m_wasBlocked = true; + m_skipBytes += length; + size_t blockedBytes = UnsignedMin(length, m_buffer.CurrentSize() - targetSize); + return STDMAX(blockedBytes, 1); + } + + m_wasBlocked = false; + m_skipBytes = 0; + } + + if (messageEnd) + { + m_eofState = EOF_PENDING_SEND; + + EofSite: + TimedFlush(blocking ? INFINITE_TIME : 0, 0); + if (m_eofState != EOF_DONE) + return 1; + } + + return 0; +} + +lword NetworkSink::DoFlush(unsigned long maxTime, size_t targetSize) +{ + NetworkSender &sender = AccessSender(); + + bool forever = maxTime == INFINITE_TIME; + Timer timer(Timer::MILLISECONDS, forever); + unsigned int totalFlushSize = 0; + + while (true) + { + if (m_buffer.CurrentSize() <= targetSize) + break; + + if (m_needSendResult) + { + if (sender.MustWaitForResult() && + !sender.Wait(SaturatingSubtract(maxTime, timer.ElapsedTime()), + CallStack("NetworkSink::DoFlush() - wait send result", 0))) + break; + + unsigned int sendResult = sender.GetSendResult(); +#if CRYPTOPP_TRACE_NETWORK + OutputDebugString((IntToString((unsigned int)this) + ": Sent " + IntToString(sendResult) + " bytes\n").c_str()); +#endif + m_buffer.Skip(sendResult); + totalFlushSize += sendResult; + m_needSendResult = false; + + if (!m_buffer.AnyRetrievable()) + break; + } + + unsigned long timeOut = maxTime ? SaturatingSubtract(maxTime, timer.ElapsedTime()) : 0; + if (sender.MustWaitToSend() && !sender.Wait(timeOut, CallStack("NetworkSink::DoFlush() - wait send", 0))) + break; + + size_t contiguousSize = 0; + const byte *block = m_buffer.Spy(contiguousSize); + +#if CRYPTOPP_TRACE_NETWORK + OutputDebugString((IntToString((unsigned int)this) + ": Sending " + IntToString(contiguousSize) + " bytes\n").c_str()); +#endif + sender.Send(block, contiguousSize); + m_needSendResult = true; + + if (maxTime > 0 && timeOut == 0) + break; // once time limit is reached, return even if there is more data waiting + } + + m_byteCountSinceLastTimerReset += totalFlushSize; + ComputeCurrentSpeed(); + + if (m_buffer.IsEmpty() && !m_needSendResult) + { + if (m_eofState == EOF_PENDING_SEND) + { + sender.SendEof(); + m_eofState = sender.MustWaitForEof() ? EOF_PENDING_DELIVERY : EOF_DONE; + } + + while (m_eofState == EOF_PENDING_DELIVERY) + { + unsigned long timeOut = maxTime ? SaturatingSubtract(maxTime, timer.ElapsedTime()) : 0; + if (!sender.Wait(timeOut, CallStack("NetworkSink::DoFlush() - wait EOF", 0))) + break; + + if (sender.EofSent()) + m_eofState = EOF_DONE; + } + } + + return totalFlushSize; +} + +#endif // #ifdef HIGHRES_TIMER_AVAILABLE + +NAMESPACE_END diff --git a/cryptopp/network.h b/cryptopp/network.h new file mode 100644 index 0000000..96cd456 --- /dev/null +++ b/cryptopp/network.h @@ -0,0 +1,235 @@ +#ifndef CRYPTOPP_NETWORK_H +#define CRYPTOPP_NETWORK_H + +#include "config.h" + +#ifdef HIGHRES_TIMER_AVAILABLE + +#include "filters.h" +#include "hrtimer.h" + +#include + +NAMESPACE_BEGIN(CryptoPP) + +class LimitedBandwidth +{ +public: + LimitedBandwidth(lword maxBytesPerSecond = 0) + : m_maxBytesPerSecond(maxBytesPerSecond), m_timer(Timer::MILLISECONDS) + , m_nextTransceiveTime(0) + { m_timer.StartTimer(); } + + lword GetMaxBytesPerSecond() const + { return m_maxBytesPerSecond; } + + void SetMaxBytesPerSecond(lword v) + { m_maxBytesPerSecond = v; } + + lword ComputeCurrentTransceiveLimit(); + + double TimeToNextTransceive(); + + void NoteTransceive(lword size); + +public: + /*! GetWaitObjects() must be called despite the 0 return from GetMaxWaitObjectCount(); + the 0 is because the ScheduleEvent() method is used instead of adding a wait object */ + unsigned int GetMaxWaitObjectCount() const { return 0; } + void GetWaitObjects(WaitObjectContainer &container, const CallStack &callStack); + +private: + lword m_maxBytesPerSecond; + + typedef std::deque > OpQueue; + OpQueue m_ops; + + Timer m_timer; + double m_nextTransceiveTime; + + void ComputeNextTransceiveTime(); + double GetCurTimeAndCleanUp(); +}; + +//! a Source class that can pump from a device for a specified amount of time. +class CRYPTOPP_NO_VTABLE NonblockingSource : public AutoSignaling, public LimitedBandwidth +{ +public: + NonblockingSource(BufferedTransformation *attachment) + : m_messageEndSent(false) , m_doPumpBlocked(false), m_blockedBySpeedLimit(false) {Detach(attachment);} + + //! \name NONBLOCKING SOURCE + //@{ + + //! pump up to maxSize bytes using at most maxTime milliseconds + /*! If checkDelimiter is true, pump up to delimiter, which itself is not extracted or pumped. */ + size_t GeneralPump2(lword &byteCount, bool blockingOutput=true, unsigned long maxTime=INFINITE_TIME, bool checkDelimiter=false, byte delimiter='\n'); + + lword GeneralPump(lword maxSize=LWORD_MAX, unsigned long maxTime=INFINITE_TIME, bool checkDelimiter=false, byte delimiter='\n') + { + GeneralPump2(maxSize, true, maxTime, checkDelimiter, delimiter); + return maxSize; + } + lword TimedPump(unsigned long maxTime) + {return GeneralPump(LWORD_MAX, maxTime);} + lword PumpLine(byte delimiter='\n', lword maxSize=1024) + {return GeneralPump(maxSize, INFINITE_TIME, true, delimiter);} + + size_t Pump2(lword &byteCount, bool blocking=true) + {return GeneralPump2(byteCount, blocking, blocking ? INFINITE_TIME : 0);} + size_t PumpMessages2(unsigned int &messageCount, bool blocking=true); + //@} + +protected: + virtual size_t DoPump(lword &byteCount, bool blockingOutput, + unsigned long maxTime, bool checkDelimiter, byte delimiter) =0; + + bool BlockedBySpeedLimit() const { return m_blockedBySpeedLimit; } + +private: + bool m_messageEndSent, m_doPumpBlocked, m_blockedBySpeedLimit; +}; + +//! Network Receiver +class CRYPTOPP_NO_VTABLE NetworkReceiver : public Waitable +{ +public: + virtual bool MustWaitToReceive() {return false;} + virtual bool MustWaitForResult() {return false;} + //! receive data from network source, returns whether result is immediately available + virtual bool Receive(byte* buf, size_t bufLen) =0; + virtual unsigned int GetReceiveResult() =0; + virtual bool EofReceived() const =0; +}; + +class CRYPTOPP_NO_VTABLE NonblockingSinkInfo +{ +public: + virtual ~NonblockingSinkInfo() {} + virtual size_t GetMaxBufferSize() const =0; + virtual size_t GetCurrentBufferSize() const =0; + virtual bool EofPending() const =0; + //! compute the current speed of this sink in bytes per second + virtual float ComputeCurrentSpeed() =0; + //! get the maximum observed speed of this sink in bytes per second + virtual float GetMaxObservedSpeed() const =0; +}; + +//! a Sink class that queues input and can flush to a device for a specified amount of time. +class CRYPTOPP_NO_VTABLE NonblockingSink : public Sink, public NonblockingSinkInfo, public LimitedBandwidth +{ +public: + NonblockingSink() : m_blockedBySpeedLimit(false) {} + + bool IsolatedFlush(bool hardFlush, bool blocking); + + //! flush to device for no more than maxTime milliseconds + /*! This function will repeatedly attempt to flush data to some device, until + the queue is empty, or a total of maxTime milliseconds have elapsed. + If maxTime == 0, at least one attempt will be made to flush some data, but + it is likely that not all queued data will be flushed, even if the device + is ready to receive more data without waiting. If you want to flush as much data + as possible without waiting for the device, call this function in a loop. + For example: while (sink.TimedFlush(0) > 0) {} + \return number of bytes flushed + */ + lword TimedFlush(unsigned long maxTime, size_t targetSize = 0); + + virtual void SetMaxBufferSize(size_t maxBufferSize) =0; + //! set a bound which will cause sink to flush if exceeded by GetCurrentBufferSize() + virtual void SetAutoFlushBound(size_t bound) =0; + +protected: + virtual lword DoFlush(unsigned long maxTime, size_t targetSize) = 0; + + bool BlockedBySpeedLimit() const { return m_blockedBySpeedLimit; } + +private: + bool m_blockedBySpeedLimit; +}; + +//! Network Sender +class CRYPTOPP_NO_VTABLE NetworkSender : public Waitable +{ +public: + virtual bool MustWaitToSend() {return false;} + virtual bool MustWaitForResult() {return false;} + virtual void Send(const byte* buf, size_t bufLen) =0; + virtual unsigned int GetSendResult() =0; + virtual bool MustWaitForEof() {return false;} + virtual void SendEof() =0; + virtual bool EofSent() {return false;} // implement if MustWaitForEof() == true +}; + +//! Network Source +class CRYPTOPP_NO_VTABLE NetworkSource : public NonblockingSource +{ +public: + NetworkSource(BufferedTransformation *attachment); + + unsigned int GetMaxWaitObjectCount() const; + void GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack); + + bool SourceExhausted() const {return m_dataBegin == m_dataEnd && GetReceiver().EofReceived();} + +protected: + size_t DoPump(lword &byteCount, bool blockingOutput, unsigned long maxTime, bool checkDelimiter, byte delimiter); + + virtual NetworkReceiver & AccessReceiver() =0; + const NetworkReceiver & GetReceiver() const {return const_cast(this)->AccessReceiver();} + +private: + SecByteBlock m_buf; + size_t m_putSize, m_dataBegin, m_dataEnd; + bool m_waitingForResult, m_outputBlocked; +}; + +//! Network Sink +class CRYPTOPP_NO_VTABLE NetworkSink : public NonblockingSink +{ +public: + NetworkSink(unsigned int maxBufferSize, unsigned int autoFlushBound); + + unsigned int GetMaxWaitObjectCount() const; + void GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack); + + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking); + + void SetMaxBufferSize(size_t maxBufferSize) {m_maxBufferSize = maxBufferSize; m_buffer.SetNodeSize(UnsignedMin(maxBufferSize, 16U*1024U+256U));} + void SetAutoFlushBound(size_t bound) {m_autoFlushBound = bound;} + + size_t GetMaxBufferSize() const {return m_maxBufferSize;} + size_t GetCurrentBufferSize() const {return (size_t)m_buffer.CurrentSize();} + + void ClearBuffer() { m_buffer.Clear(); } + + bool EofPending() const { return m_eofState > EOF_NONE && m_eofState < EOF_DONE; } + + //! compute the current speed of this sink in bytes per second + float ComputeCurrentSpeed(); + //! get the maximum observed speed of this sink in bytes per second + float GetMaxObservedSpeed() const; + +protected: + lword DoFlush(unsigned long maxTime, size_t targetSize); + + virtual NetworkSender & AccessSender() =0; + const NetworkSender & GetSender() const {return const_cast(this)->AccessSender();} + +private: + enum EofState { EOF_NONE, EOF_PENDING_SEND, EOF_PENDING_DELIVERY, EOF_DONE }; + + size_t m_maxBufferSize, m_autoFlushBound; + bool m_needSendResult, m_wasBlocked; + EofState m_eofState; + ByteQueue m_buffer; + size_t m_skipBytes; + Timer m_speedTimer; + float m_byteCountSinceLastTimerReset, m_currentSpeed, m_maxObservedSpeed; +}; + +NAMESPACE_END + +#endif // #ifdef HIGHRES_TIMER_AVAILABLE + +#endif diff --git a/cryptopp/nr.h b/cryptopp/nr.h new file mode 100644 index 0000000..c398e35 --- /dev/null +++ b/cryptopp/nr.h @@ -0,0 +1,6 @@ +#ifndef CRYPTOPP_NR_H +#define CRYPTOPP_NR_H + +#include "gfpcrypt.h" + +#endif diff --git a/cryptopp/oaep.cpp b/cryptopp/oaep.cpp new file mode 100644 index 0000000..1d474be --- /dev/null +++ b/cryptopp/oaep.cpp @@ -0,0 +1,97 @@ +// oaep.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "oaep.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +// ******************************************************** + +size_t OAEP_Base::MaxUnpaddedLength(size_t paddedLength) const +{ + return SaturatingSubtract(paddedLength/8, 1+2*DigestSize()); +} + +void OAEP_Base::Pad(RandomNumberGenerator &rng, const byte *input, size_t inputLength, byte *oaepBlock, size_t oaepBlockLen, const NameValuePairs ¶meters) const +{ + assert (inputLength <= MaxUnpaddedLength(oaepBlockLen)); + + // convert from bit length to byte length + if (oaepBlockLen % 8 != 0) + { + oaepBlock[0] = 0; + oaepBlock++; + } + oaepBlockLen /= 8; + + std::auto_ptr pHash(NewHash()); + const size_t hLen = pHash->DigestSize(); + const size_t seedLen = hLen, dbLen = oaepBlockLen-seedLen; + byte *const maskedSeed = oaepBlock; + byte *const maskedDB = oaepBlock+seedLen; + + ConstByteArrayParameter encodingParameters; + parameters.GetValue(Name::EncodingParameters(), encodingParameters); + + // DB = pHash || 00 ... || 01 || M + pHash->CalculateDigest(maskedDB, encodingParameters.begin(), encodingParameters.size()); + memset(maskedDB+hLen, 0, dbLen-hLen-inputLength-1); + maskedDB[dbLen-inputLength-1] = 0x01; + memcpy(maskedDB+dbLen-inputLength, input, inputLength); + + rng.GenerateBlock(maskedSeed, seedLen); + std::auto_ptr pMGF(NewMGF()); + pMGF->GenerateAndMask(*pHash, maskedDB, dbLen, maskedSeed, seedLen); + pMGF->GenerateAndMask(*pHash, maskedSeed, seedLen, maskedDB, dbLen); +} + +DecodingResult OAEP_Base::Unpad(const byte *oaepBlock, size_t oaepBlockLen, byte *output, const NameValuePairs ¶meters) const +{ + bool invalid = false; + + // convert from bit length to byte length + if (oaepBlockLen % 8 != 0) + { + invalid = (oaepBlock[0] != 0) || invalid; + oaepBlock++; + } + oaepBlockLen /= 8; + + std::auto_ptr pHash(NewHash()); + const size_t hLen = pHash->DigestSize(); + const size_t seedLen = hLen, dbLen = oaepBlockLen-seedLen; + + invalid = (oaepBlockLen < 2*hLen+1) || invalid; + + SecByteBlock t(oaepBlock, oaepBlockLen); + byte *const maskedSeed = t; + byte *const maskedDB = t+seedLen; + + std::auto_ptr pMGF(NewMGF()); + pMGF->GenerateAndMask(*pHash, maskedSeed, seedLen, maskedDB, dbLen); + pMGF->GenerateAndMask(*pHash, maskedDB, dbLen, maskedSeed, seedLen); + + ConstByteArrayParameter encodingParameters; + parameters.GetValue(Name::EncodingParameters(), encodingParameters); + + // DB = pHash' || 00 ... || 01 || M + byte *M = std::find(maskedDB+hLen, maskedDB+dbLen, 0x01); + invalid = (M == maskedDB+dbLen) || invalid; + invalid = (std::find_if(maskedDB+hLen, M, std::bind2nd(std::not_equal_to(), 0)) != M) || invalid; + invalid = !pHash->VerifyDigest(maskedDB, encodingParameters.begin(), encodingParameters.size()) || invalid; + + if (invalid) + return DecodingResult(); + + M++; + memcpy(output, M, maskedDB+dbLen-M); + return DecodingResult(maskedDB+dbLen-M); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/oaep.h b/cryptopp/oaep.h new file mode 100644 index 0000000..4bf6b0d --- /dev/null +++ b/cryptopp/oaep.h @@ -0,0 +1,42 @@ +#ifndef CRYPTOPP_OAEP_H +#define CRYPTOPP_OAEP_H + +#include "pubkey.h" +#include "sha.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class CRYPTOPP_DLL OAEP_Base : public PK_EncryptionMessageEncodingMethod +{ +public: + bool ParameterSupported(const char *name) const {return strcmp(name, Name::EncodingParameters()) == 0;} + size_t MaxUnpaddedLength(size_t paddedLength) const; + void Pad(RandomNumberGenerator &rng, const byte *raw, size_t inputLength, byte *padded, size_t paddedLength, const NameValuePairs ¶meters) const; + DecodingResult Unpad(const byte *padded, size_t paddedLength, byte *raw, const NameValuePairs ¶meters) const; + +protected: + virtual unsigned int DigestSize() const =0; + virtual HashTransformation * NewHash() const =0; + virtual MaskGeneratingFunction * NewMGF() const =0; +}; + +//! EME-OAEP, for use with classes derived from TF_ES +template +class OAEP : public OAEP_Base, public EncryptionStandard +{ +public: + static std::string CRYPTOPP_API StaticAlgorithmName() {return std::string("OAEP-") + MGF::StaticAlgorithmName() + "(" + H::StaticAlgorithmName() + ")";} + typedef OAEP EncryptionMessageEncodingMethod; + +protected: + unsigned int DigestSize() const {return H::DIGESTSIZE;} + HashTransformation * NewHash() const {return new H;} + MaskGeneratingFunction * NewMGF() const {return new MGF;} +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS OAEP; + +NAMESPACE_END + +#endif diff --git a/cryptopp/oids.h b/cryptopp/oids.h new file mode 100644 index 0000000..9911ec2 --- /dev/null +++ b/cryptopp/oids.h @@ -0,0 +1,123 @@ +#ifndef CRYPTOPP_OIDS_H +#define CRYPTOPP_OIDS_H + +// crypto-related ASN.1 object identifiers + +#include "asn.h" + +NAMESPACE_BEGIN(CryptoPP) + +NAMESPACE_BEGIN(ASN1) + +#define DEFINE_OID(value, name) inline OID name() {return value;} + +DEFINE_OID(1, iso) + DEFINE_OID(iso()+2, member_body) + DEFINE_OID(member_body()+840, iso_us) + DEFINE_OID(iso_us()+10040, ansi_x9_57) + DEFINE_OID(ansi_x9_57()+4+1, id_dsa) + DEFINE_OID(iso_us()+10045, ansi_x9_62) + DEFINE_OID(ansi_x9_62()+1, id_fieldType) + DEFINE_OID(id_fieldType()+1, prime_field) + DEFINE_OID(id_fieldType()+2, characteristic_two_field) + DEFINE_OID(characteristic_two_field()+3, id_characteristic_two_basis) + DEFINE_OID(id_characteristic_two_basis()+1, gnBasis) + DEFINE_OID(id_characteristic_two_basis()+2, tpBasis) + DEFINE_OID(id_characteristic_two_basis()+3, ppBasis) + DEFINE_OID(ansi_x9_62()+2, id_publicKeyType) + DEFINE_OID(id_publicKeyType()+1, id_ecPublicKey) + DEFINE_OID(ansi_x9_62()+3, ansi_x9_62_curves) + DEFINE_OID(ansi_x9_62_curves()+1, ansi_x9_62_curves_prime) + DEFINE_OID(ansi_x9_62_curves_prime()+1, secp192r1) + DEFINE_OID(ansi_x9_62_curves_prime()+7, secp256r1) + DEFINE_OID(iso_us()+113549, rsadsi) + DEFINE_OID(rsadsi()+1, pkcs) + DEFINE_OID(pkcs()+1, pkcs_1) + DEFINE_OID(pkcs_1()+1, rsaEncryption); + DEFINE_OID(rsadsi()+2, rsadsi_digestAlgorithm) + DEFINE_OID(rsadsi_digestAlgorithm()+2, id_md2) + DEFINE_OID(rsadsi_digestAlgorithm()+5, id_md5) + DEFINE_OID(iso()+3, identified_organization); + DEFINE_OID(identified_organization()+14, oiw); + DEFINE_OID(oiw()+14, oiw_secsig); + DEFINE_OID(oiw_secsig()+2, oiw_secsig_algorithms); + DEFINE_OID(oiw_secsig_algorithms()+26, id_sha1); + + DEFINE_OID(identified_organization()+36, teletrust); + DEFINE_OID(teletrust()+3, teletrust_algorithm) + DEFINE_OID(teletrust_algorithm()+2+1, id_ripemd160) + DEFINE_OID(teletrust_algorithm()+3+2+8+1, teletrust_ellipticCurve) + DEFINE_OID(teletrust_ellipticCurve()+1+1, brainpoolP160r1) + DEFINE_OID(teletrust_ellipticCurve()+1+3, brainpoolP192r1) + DEFINE_OID(teletrust_ellipticCurve()+1+5, brainpoolP224r1) + DEFINE_OID(teletrust_ellipticCurve()+1+7, brainpoolP256r1) + DEFINE_OID(teletrust_ellipticCurve()+1+9, brainpoolP320r1) + DEFINE_OID(teletrust_ellipticCurve()+1+11, brainpoolP384r1) + DEFINE_OID(teletrust_ellipticCurve()+1+13, brainpoolP512r1) + + DEFINE_OID(identified_organization()+132, certicom); + DEFINE_OID(certicom()+0, certicom_ellipticCurve); + // these are sorted by curve type and then by OID + // first curves based on GF(p) + DEFINE_OID(certicom_ellipticCurve()+6, secp112r1); + DEFINE_OID(certicom_ellipticCurve()+7, secp112r2); + DEFINE_OID(certicom_ellipticCurve()+8, secp160r1); + DEFINE_OID(certicom_ellipticCurve()+9, secp160k1); + DEFINE_OID(certicom_ellipticCurve()+10, secp256k1); + DEFINE_OID(certicom_ellipticCurve()+28, secp128r1); + DEFINE_OID(certicom_ellipticCurve()+29, secp128r2); + DEFINE_OID(certicom_ellipticCurve()+30, secp160r2); + DEFINE_OID(certicom_ellipticCurve()+31, secp192k1); + DEFINE_OID(certicom_ellipticCurve()+32, secp224k1); + DEFINE_OID(certicom_ellipticCurve()+33, secp224r1); + DEFINE_OID(certicom_ellipticCurve()+34, secp384r1); + DEFINE_OID(certicom_ellipticCurve()+35, secp521r1); + // then curves based on GF(2^n) + DEFINE_OID(certicom_ellipticCurve()+1, sect163k1); + DEFINE_OID(certicom_ellipticCurve()+2, sect163r1); + DEFINE_OID(certicom_ellipticCurve()+3, sect239k1); + DEFINE_OID(certicom_ellipticCurve()+4, sect113r1); + DEFINE_OID(certicom_ellipticCurve()+5, sect113r2); + DEFINE_OID(certicom_ellipticCurve()+15, sect163r2); + DEFINE_OID(certicom_ellipticCurve()+16, sect283k1); + DEFINE_OID(certicom_ellipticCurve()+17, sect283r1); + DEFINE_OID(certicom_ellipticCurve()+22, sect131r1); + DEFINE_OID(certicom_ellipticCurve()+23, sect131r2); + DEFINE_OID(certicom_ellipticCurve()+24, sect193r1); + DEFINE_OID(certicom_ellipticCurve()+25, sect193r2); + DEFINE_OID(certicom_ellipticCurve()+26, sect233k1); + DEFINE_OID(certicom_ellipticCurve()+27, sect233r1); + DEFINE_OID(certicom_ellipticCurve()+36, sect409k1); + DEFINE_OID(certicom_ellipticCurve()+37, sect409r1); + DEFINE_OID(certicom_ellipticCurve()+38, sect571k1); + DEFINE_OID(certicom_ellipticCurve()+39, sect571r1); +DEFINE_OID(2, joint_iso_ccitt) + DEFINE_OID(joint_iso_ccitt()+16, country) + DEFINE_OID(country()+840, joint_iso_ccitt_us) + DEFINE_OID(joint_iso_ccitt_us()+1, us_organization) + DEFINE_OID(us_organization()+101, us_gov) + DEFINE_OID(us_gov()+3, csor) + DEFINE_OID(csor()+4, nistalgorithms) + DEFINE_OID(nistalgorithms()+1, aes) + DEFINE_OID(aes()+1, id_aes128_ECB) + DEFINE_OID(aes()+2, id_aes128_cbc) + DEFINE_OID(aes()+3, id_aes128_ofb) + DEFINE_OID(aes()+4, id_aes128_cfb) + DEFINE_OID(aes()+21, id_aes192_ECB) + DEFINE_OID(aes()+22, id_aes192_cbc) + DEFINE_OID(aes()+23, id_aes192_ofb) + DEFINE_OID(aes()+24, id_aes192_cfb) + DEFINE_OID(aes()+41, id_aes256_ECB) + DEFINE_OID(aes()+42, id_aes256_cbc) + DEFINE_OID(aes()+43, id_aes256_ofb) + DEFINE_OID(aes()+44, id_aes256_cfb) + DEFINE_OID(nistalgorithms()+2, nist_hashalgs) + DEFINE_OID(nist_hashalgs()+1, id_sha256) + DEFINE_OID(nist_hashalgs()+2, id_sha384) + DEFINE_OID(nist_hashalgs()+3, id_sha512) + +NAMESPACE_END + +NAMESPACE_END + +#endif diff --git a/cryptopp/osrng.cpp b/cryptopp/osrng.cpp new file mode 100644 index 0000000..fa6dd36 --- /dev/null +++ b/cryptopp/osrng.cpp @@ -0,0 +1,171 @@ +// osrng.cpp - written and placed in the public domain by Wei Dai + +// Thanks to Leonard Janke for the suggestion for AutoSeededRandomPool. + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "osrng.h" + +#ifdef OS_RNG_AVAILABLE + +#include "rng.h" + +#ifdef CRYPTOPP_WIN32_AVAILABLE +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif +#include +#include +#endif + +#ifdef CRYPTOPP_UNIX_AVAILABLE +#include +#include +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +#if defined(NONBLOCKING_RNG_AVAILABLE) || defined(BLOCKING_RNG_AVAILABLE) +OS_RNG_Err::OS_RNG_Err(const std::string &operation) + : Exception(OTHER_ERROR, "OS_Rng: " + operation + " operation failed with error " + +#ifdef CRYPTOPP_WIN32_AVAILABLE + "0x" + IntToString(GetLastError(), 16) +#else + IntToString(errno) +#endif + ) +{ +} +#endif + +#ifdef NONBLOCKING_RNG_AVAILABLE + +#ifdef CRYPTOPP_WIN32_AVAILABLE + +MicrosoftCryptoProvider::MicrosoftCryptoProvider() +{ + if(!CryptAcquireContext(&m_hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) + throw OS_RNG_Err("CryptAcquireContext"); +} + +MicrosoftCryptoProvider::~MicrosoftCryptoProvider() +{ + CryptReleaseContext(m_hProvider, 0); +} + +#endif + +NonblockingRng::NonblockingRng() +{ +#ifndef CRYPTOPP_WIN32_AVAILABLE + m_fd = open("/dev/urandom",O_RDONLY); + if (m_fd == -1) + throw OS_RNG_Err("open /dev/urandom"); +#endif +} + +NonblockingRng::~NonblockingRng() +{ +#ifndef CRYPTOPP_WIN32_AVAILABLE + close(m_fd); +#endif +} + +void NonblockingRng::GenerateBlock(byte *output, size_t size) +{ +#ifdef CRYPTOPP_WIN32_AVAILABLE +# ifdef WORKAROUND_MS_BUG_Q258000 + const MicrosoftCryptoProvider &m_Provider = Singleton().Ref(); +# endif + if (!CryptGenRandom(m_Provider.GetProviderHandle(), (DWORD)size, output)) + throw OS_RNG_Err("CryptGenRandom"); +#else + if (read(m_fd, output, size) != size) + throw OS_RNG_Err("read /dev/urandom"); +#endif +} + +#endif + +// ************************************************************* + +#ifdef BLOCKING_RNG_AVAILABLE + +#ifndef CRYPTOPP_BLOCKING_RNG_FILENAME +#ifdef __OpenBSD__ +#define CRYPTOPP_BLOCKING_RNG_FILENAME "/dev/srandom" +#else +#define CRYPTOPP_BLOCKING_RNG_FILENAME "/dev/random" +#endif +#endif + +BlockingRng::BlockingRng() +{ + m_fd = open(CRYPTOPP_BLOCKING_RNG_FILENAME,O_RDONLY); + if (m_fd == -1) + throw OS_RNG_Err("open " CRYPTOPP_BLOCKING_RNG_FILENAME); +} + +BlockingRng::~BlockingRng() +{ + close(m_fd); +} + +void BlockingRng::GenerateBlock(byte *output, size_t size) +{ + while (size) + { + // on some systems /dev/random will block until all bytes + // are available, on others it will returns immediately + ssize_t len = read(m_fd, output, size); + if (len < 0) + throw OS_RNG_Err("read " CRYPTOPP_BLOCKING_RNG_FILENAME); + size -= len; + output += len; + if (size) + sleep(1); + } +} + +#endif + +// ************************************************************* + +void OS_GenerateRandomBlock(bool blocking, byte *output, size_t size) +{ +#ifdef NONBLOCKING_RNG_AVAILABLE + if (blocking) +#endif + { +#ifdef BLOCKING_RNG_AVAILABLE + BlockingRng rng; + rng.GenerateBlock(output, size); +#endif + } + +#ifdef BLOCKING_RNG_AVAILABLE + if (!blocking) +#endif + { +#ifdef NONBLOCKING_RNG_AVAILABLE + NonblockingRng rng; + rng.GenerateBlock(output, size); +#endif + } +} + +void AutoSeededRandomPool::Reseed(bool blocking, unsigned int seedSize) +{ + SecByteBlock seed(seedSize); + OS_GenerateRandomBlock(blocking, seed, seedSize); + IncorporateEntropy(seed, seedSize); +} + +NAMESPACE_END + +#endif + +#endif diff --git a/cryptopp/osrng.h b/cryptopp/osrng.h new file mode 100644 index 0000000..eb4e6e2 --- /dev/null +++ b/cryptopp/osrng.h @@ -0,0 +1,153 @@ +#ifndef CRYPTOPP_OSRNG_H +#define CRYPTOPP_OSRNG_H + +#include "config.h" + +#ifdef OS_RNG_AVAILABLE + +#include "randpool.h" +#include "rng.h" +#include "aes.h" +#include "sha.h" +#include "fips140.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! Exception class for Operating-System Random Number Generator. +class CRYPTOPP_DLL OS_RNG_Err : public Exception +{ +public: + OS_RNG_Err(const std::string &operation); +}; + +#ifdef NONBLOCKING_RNG_AVAILABLE + +#ifdef CRYPTOPP_WIN32_AVAILABLE +class CRYPTOPP_DLL MicrosoftCryptoProvider +{ +public: + MicrosoftCryptoProvider(); + ~MicrosoftCryptoProvider(); +#if defined(_WIN64) + typedef unsigned __int64 ProviderHandle; // type HCRYPTPROV, avoid #include +#else + typedef unsigned long ProviderHandle; +#endif + ProviderHandle GetProviderHandle() const {return m_hProvider;} +private: + ProviderHandle m_hProvider; +}; + +#pragma comment(lib, "advapi32.lib") +#endif + +//! encapsulate CryptoAPI's CryptGenRandom or /dev/urandom +class CRYPTOPP_DLL NonblockingRng : public RandomNumberGenerator +{ +public: + NonblockingRng(); + ~NonblockingRng(); + void GenerateBlock(byte *output, size_t size); + +protected: +#ifdef CRYPTOPP_WIN32_AVAILABLE +# ifndef WORKAROUND_MS_BUG_Q258000 + MicrosoftCryptoProvider m_Provider; +# endif +#else + int m_fd; +#endif +}; + +#endif + +#ifdef BLOCKING_RNG_AVAILABLE + +//! encapsulate /dev/random, or /dev/srandom on OpenBSD +class CRYPTOPP_DLL BlockingRng : public RandomNumberGenerator +{ +public: + BlockingRng(); + ~BlockingRng(); + void GenerateBlock(byte *output, size_t size); + +protected: + int m_fd; +}; + +#endif + +CRYPTOPP_DLL void CRYPTOPP_API OS_GenerateRandomBlock(bool blocking, byte *output, size_t size); + +//! Automaticly Seeded Randomness Pool +/*! This class seeds itself using an operating system provided RNG. */ +class CRYPTOPP_DLL AutoSeededRandomPool : public RandomPool +{ +public: + //! use blocking to choose seeding with BlockingRng or NonblockingRng. the parameter is ignored if only one of these is available + explicit AutoSeededRandomPool(bool blocking = false, unsigned int seedSize = 32) + {Reseed(blocking, seedSize);} + void Reseed(bool blocking = false, unsigned int seedSize = 32); +}; + +//! RNG from ANSI X9.17 Appendix C, seeded using an OS provided RNG +template +class AutoSeededX917RNG : public RandomNumberGenerator, public NotCopyable +{ +public: + //! use blocking to choose seeding with BlockingRng or NonblockingRng. the parameter is ignored if only one of these is available + explicit AutoSeededX917RNG(bool blocking = false) + {Reseed(blocking);} + void Reseed(bool blocking = false, const byte *additionalEntropy = NULL, size_t length = 0); + // exposed for testing + void Reseed(const byte *key, size_t keylength, const byte *seed, const byte *timeVector); + + bool CanIncorporateEntropy() const {return true;} + void IncorporateEntropy(const byte *input, size_t length) {Reseed(false, input, length);} + void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword length) {m_rng->GenerateIntoBufferedTransformation(target, channel, length);} + +private: + member_ptr m_rng; +}; + +template +void AutoSeededX917RNG::Reseed(const byte *key, size_t keylength, const byte *seed, const byte *timeVector) +{ + m_rng.reset(new X917RNG(new typename BLOCK_CIPHER::Encryption(key, keylength), seed, timeVector)); +} + +template +void AutoSeededX917RNG::Reseed(bool blocking, const byte *input, size_t length) +{ + SecByteBlock seed(BLOCK_CIPHER::BLOCKSIZE + BLOCK_CIPHER::DEFAULT_KEYLENGTH); + const byte *key; + do + { + OS_GenerateRandomBlock(blocking, seed, seed.size()); + if (length > 0) + { + SHA256 hash; + hash.Update(seed, seed.size()); + hash.Update(input, length); + hash.TruncatedFinal(seed, UnsignedMin(hash.DigestSize(), seed.size())); + } + key = seed + BLOCK_CIPHER::BLOCKSIZE; + } // check that seed and key don't have same value + while (memcmp(key, seed, STDMIN((unsigned int)BLOCK_CIPHER::BLOCKSIZE, (unsigned int)BLOCK_CIPHER::DEFAULT_KEYLENGTH)) == 0); + + Reseed(key, BLOCK_CIPHER::DEFAULT_KEYLENGTH, seed, NULL); +} + +CRYPTOPP_DLL_TEMPLATE_CLASS AutoSeededX917RNG; + +#if CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 +typedef AutoSeededX917RNG DefaultAutoSeededRNG; +#else +typedef AutoSeededRandomPool DefaultAutoSeededRNG; +#endif + +NAMESPACE_END + +#endif + +#endif diff --git a/cryptopp/panama.cpp b/cryptopp/panama.cpp new file mode 100644 index 0000000..da84e36 --- /dev/null +++ b/cryptopp/panama.cpp @@ -0,0 +1,506 @@ +// panama.cpp - written and placed in the public domain by Wei Dai + +// use "cl /EP /P /DCRYPTOPP_GENERATE_X64_MASM panama.cpp" to generate MASM code + +#include "pch.h" + +#ifndef CRYPTOPP_GENERATE_X64_MASM + +#include "panama.h" +#include "misc.h" +#include "cpu.h" + +NAMESPACE_BEGIN(CryptoPP) + +template +void Panama::Reset() +{ + memset(m_state, 0, m_state.SizeInBytes()); +#if CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE + m_state[17] = HasSSSE3(); +#endif +} + +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM + +#ifdef CRYPTOPP_X64_MASM_AVAILABLE +extern "C" { +void Panama_SSE2_Pull(size_t count, word32 *state, word32 *z, const word32 *y); +} +#elif CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + +#ifdef CRYPTOPP_GENERATE_X64_MASM + Panama_SSE2_Pull PROC FRAME + alloc_stack(2*16+8) + save_xmm128 xmm6, 0h + save_xmm128 xmm7, 10h + .endprolog +#else +#pragma warning(disable: 4731) // frame pointer register 'ebp' modified by inline assembly code +void CRYPTOPP_NOINLINE Panama_SSE2_Pull(size_t count, word32 *state, word32 *z, const word32 *y) +{ +#ifdef __GNUC__ + __asm__ __volatile__ + ( + ".intel_syntax noprefix;" + AS_PUSH_IF86( bx) +#else + AS2( mov AS_REG_1, count) + AS2( mov AS_REG_2, state) + AS2( mov AS_REG_3, z) + AS2( mov AS_REG_4, y) +#endif +#endif // #ifdef CRYPTOPP_GENERATE_X64_MASM + +#if CRYPTOPP_BOOL_X86 + #define REG_loopEnd [esp] +#elif defined(CRYPTOPP_GENERATE_X64_MASM) + #define REG_loopEnd rdi +#else + #define REG_loopEnd r8 +#endif + + AS2( shl AS_REG_1, 5) + ASJ( jz, 5, f) + AS2( mov AS_REG_6d, [AS_REG_2+4*17]) + AS2( add AS_REG_1, AS_REG_6) + + #if CRYPTOPP_BOOL_X64 + AS2( mov REG_loopEnd, AS_REG_1) + #else + AS1( push ebp) + AS1( push AS_REG_1) + #endif + + AS2( movdqa xmm0, XMMWORD_PTR [AS_REG_2+0*16]) + AS2( movdqa xmm1, XMMWORD_PTR [AS_REG_2+1*16]) + AS2( movdqa xmm2, XMMWORD_PTR [AS_REG_2+2*16]) + AS2( movdqa xmm3, XMMWORD_PTR [AS_REG_2+3*16]) + AS2( mov eax, dword ptr [AS_REG_2+4*16]) + + ASL(4) + // gamma and pi +#if CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE + AS2( test AS_REG_6, 1) + ASJ( jnz, 6, f) +#endif + AS2( movdqa xmm6, xmm2) + AS2( movss xmm6, xmm3) + ASS( pshufd xmm5, xmm6, 0, 3, 2, 1) + AS2( movd xmm6, eax) + AS2( movdqa xmm7, xmm3) + AS2( movss xmm7, xmm6) + ASS( pshufd xmm6, xmm7, 0, 3, 2, 1) +#if CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE + ASJ( jmp, 7, f) + ASL(6) + AS2( movdqa xmm5, xmm3) + AS3( palignr xmm5, xmm2, 4) + AS2( movd xmm6, eax) + AS3( palignr xmm6, xmm3, 4) + ASL(7) +#endif + + AS2( movd AS_REG_1d, xmm2) + AS1( not AS_REG_1d) + AS2( movd AS_REG_7d, xmm3) + AS2( or AS_REG_1d, AS_REG_7d) + AS2( xor eax, AS_REG_1d) + +#define SSE2_Index(i) ASM_MOD(((i)*13+16), 17) + +#define pi(i) \ + AS2( movd AS_REG_1d, xmm7)\ + AS2( rol AS_REG_1d, ASM_MOD((ASM_MOD(5*i,17)*(ASM_MOD(5*i,17)+1)/2), 32))\ + AS2( mov [AS_REG_2+SSE2_Index(ASM_MOD(5*(i), 17))*4], AS_REG_1d) + +#define pi4(x, y, z, a, b, c, d) \ + AS2( pcmpeqb xmm7, xmm7)\ + AS2( pxor xmm7, x)\ + AS2( por xmm7, y)\ + AS2( pxor xmm7, z)\ + pi(a)\ + ASS( pshuflw xmm7, xmm7, 1, 0, 3, 2)\ + pi(b)\ + AS2( punpckhqdq xmm7, xmm7)\ + pi(c)\ + ASS( pshuflw xmm7, xmm7, 1, 0, 3, 2)\ + pi(d) + + pi4(xmm1, xmm2, xmm3, 1, 5, 9, 13) + pi4(xmm0, xmm1, xmm2, 2, 6, 10, 14) + pi4(xmm6, xmm0, xmm1, 3, 7, 11, 15) + pi4(xmm5, xmm6, xmm0, 4, 8, 12, 16) + + // output keystream and update buffer here to hide partial memory stalls between pi and theta + AS2( movdqa xmm4, xmm3) + AS2( punpcklqdq xmm3, xmm2) // 1 5 2 6 + AS2( punpckhdq xmm4, xmm2) // 9 10 13 14 + AS2( movdqa xmm2, xmm1) + AS2( punpcklqdq xmm1, xmm0) // 3 7 4 8 + AS2( punpckhdq xmm2, xmm0) // 11 12 15 16 + + // keystream + AS2( test AS_REG_3, AS_REG_3) + ASJ( jz, 0, f) + AS2( movdqa xmm6, xmm4) + AS2( punpcklqdq xmm4, xmm2) + AS2( punpckhqdq xmm6, xmm2) + AS2( test AS_REG_4, 15) + ASJ( jnz, 2, f) + AS2( test AS_REG_4, AS_REG_4) + ASJ( jz, 1, f) + AS2( pxor xmm4, [AS_REG_4]) + AS2( pxor xmm6, [AS_REG_4+16]) + AS2( add AS_REG_4, 32) + ASJ( jmp, 1, f) + ASL(2) + AS2( movdqu xmm0, [AS_REG_4]) + AS2( movdqu xmm2, [AS_REG_4+16]) + AS2( pxor xmm4, xmm0) + AS2( pxor xmm6, xmm2) + AS2( add AS_REG_4, 32) + ASL(1) + AS2( test AS_REG_3, 15) + ASJ( jnz, 3, f) + AS2( movdqa XMMWORD_PTR [AS_REG_3], xmm4) + AS2( movdqa XMMWORD_PTR [AS_REG_3+16], xmm6) + AS2( add AS_REG_3, 32) + ASJ( jmp, 0, f) + ASL(3) + AS2( movdqu XMMWORD_PTR [AS_REG_3], xmm4) + AS2( movdqu XMMWORD_PTR [AS_REG_3+16], xmm6) + AS2( add AS_REG_3, 32) + ASL(0) + + // buffer update + AS2( lea AS_REG_1, [AS_REG_6 + 32]) + AS2( and AS_REG_1, 31*32) + AS2( lea AS_REG_7, [AS_REG_6 + (32-24)*32]) + AS2( and AS_REG_7, 31*32) + + AS2( movdqa xmm0, XMMWORD_PTR [AS_REG_2+20*4+AS_REG_1+0*8]) + AS2( pxor xmm3, xmm0) + ASS( pshufd xmm0, xmm0, 2, 3, 0, 1) + AS2( movdqa XMMWORD_PTR [AS_REG_2+20*4+AS_REG_1+0*8], xmm3) + AS2( pxor xmm0, XMMWORD_PTR [AS_REG_2+20*4+AS_REG_7+2*8]) + AS2( movdqa XMMWORD_PTR [AS_REG_2+20*4+AS_REG_7+2*8], xmm0) + + AS2( movdqa xmm4, XMMWORD_PTR [AS_REG_2+20*4+AS_REG_1+2*8]) + AS2( pxor xmm1, xmm4) + AS2( movdqa XMMWORD_PTR [AS_REG_2+20*4+AS_REG_1+2*8], xmm1) + AS2( pxor xmm4, XMMWORD_PTR [AS_REG_2+20*4+AS_REG_7+0*8]) + AS2( movdqa XMMWORD_PTR [AS_REG_2+20*4+AS_REG_7+0*8], xmm4) + + // theta + AS2( movdqa xmm3, XMMWORD_PTR [AS_REG_2+3*16]) + AS2( movdqa xmm2, XMMWORD_PTR [AS_REG_2+2*16]) + AS2( movdqa xmm1, XMMWORD_PTR [AS_REG_2+1*16]) + AS2( movdqa xmm0, XMMWORD_PTR [AS_REG_2+0*16]) + +#if CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE + AS2( test AS_REG_6, 1) + ASJ( jnz, 8, f) +#endif + AS2( movd xmm6, eax) + AS2( movdqa xmm7, xmm3) + AS2( movss xmm7, xmm6) + AS2( movdqa xmm6, xmm2) + AS2( movss xmm6, xmm3) + AS2( movdqa xmm5, xmm1) + AS2( movss xmm5, xmm2) + AS2( movdqa xmm4, xmm0) + AS2( movss xmm4, xmm1) + ASS( pshufd xmm7, xmm7, 0, 3, 2, 1) + ASS( pshufd xmm6, xmm6, 0, 3, 2, 1) + ASS( pshufd xmm5, xmm5, 0, 3, 2, 1) + ASS( pshufd xmm4, xmm4, 0, 3, 2, 1) +#if CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE + ASJ( jmp, 9, f) + ASL(8) + AS2( movd xmm7, eax) + AS3( palignr xmm7, xmm3, 4) + AS2( movq xmm6, xmm3) + AS3( palignr xmm6, xmm2, 4) + AS2( movq xmm5, xmm2) + AS3( palignr xmm5, xmm1, 4) + AS2( movq xmm4, xmm1) + AS3( palignr xmm4, xmm0, 4) + ASL(9) +#endif + + AS2( xor eax, 1) + AS2( movd AS_REG_1d, xmm0) + AS2( xor eax, AS_REG_1d) + AS2( movd AS_REG_1d, xmm3) + AS2( xor eax, AS_REG_1d) + + AS2( pxor xmm3, xmm2) + AS2( pxor xmm2, xmm1) + AS2( pxor xmm1, xmm0) + AS2( pxor xmm0, xmm7) + AS2( pxor xmm3, xmm7) + AS2( pxor xmm2, xmm6) + AS2( pxor xmm1, xmm5) + AS2( pxor xmm0, xmm4) + + // sigma + AS2( lea AS_REG_1, [AS_REG_6 + (32-4)*32]) + AS2( and AS_REG_1, 31*32) + AS2( lea AS_REG_7, [AS_REG_6 + 16*32]) + AS2( and AS_REG_7, 31*32) + + AS2( movdqa xmm4, XMMWORD_PTR [AS_REG_2+20*4+AS_REG_1+0*16]) + AS2( movdqa xmm5, XMMWORD_PTR [AS_REG_2+20*4+AS_REG_7+0*16]) + AS2( movdqa xmm6, xmm4) + AS2( punpcklqdq xmm4, xmm5) + AS2( punpckhqdq xmm6, xmm5) + AS2( pxor xmm3, xmm4) + AS2( pxor xmm2, xmm6) + + AS2( movdqa xmm4, XMMWORD_PTR [AS_REG_2+20*4+AS_REG_1+1*16]) + AS2( movdqa xmm5, XMMWORD_PTR [AS_REG_2+20*4+AS_REG_7+1*16]) + AS2( movdqa xmm6, xmm4) + AS2( punpcklqdq xmm4, xmm5) + AS2( punpckhqdq xmm6, xmm5) + AS2( pxor xmm1, xmm4) + AS2( pxor xmm0, xmm6) + + // loop + AS2( add AS_REG_6, 32) + AS2( cmp AS_REG_6, REG_loopEnd) + ASJ( jne, 4, b) + + // save state + AS2( mov [AS_REG_2+4*16], eax) + AS2( movdqa XMMWORD_PTR [AS_REG_2+3*16], xmm3) + AS2( movdqa XMMWORD_PTR [AS_REG_2+2*16], xmm2) + AS2( movdqa XMMWORD_PTR [AS_REG_2+1*16], xmm1) + AS2( movdqa XMMWORD_PTR [AS_REG_2+0*16], xmm0) + + #if CRYPTOPP_BOOL_X86 + AS2( add esp, 4) + AS1( pop ebp) + #endif + ASL(5) + +#ifdef __GNUC__ + AS_POP_IF86( bx) + ".att_syntax prefix;" + : + #if CRYPTOPP_BOOL_X64 + : "D" (count), "S" (state), "d" (z), "c" (y) + : "%r8", "%r9", "r10", "%eax", "memory", "cc", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7" + #else + : "c" (count), "d" (state), "S" (z), "D" (y) + : "%eax", "memory", "cc" + #endif + ); +#endif +#ifdef CRYPTOPP_GENERATE_X64_MASM + movdqa xmm6, [rsp + 0h] + movdqa xmm7, [rsp + 10h] + add rsp, 2*16+8 + ret + Panama_SSE2_Pull ENDP +#else +} +#endif +#endif // #ifdef CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + +#ifndef CRYPTOPP_GENERATE_X64_MASM + +template +void Panama::Iterate(size_t count, const word32 *p, word32 *z, const word32 *y) +{ + word32 bstart = m_state[17]; + word32 *const aPtr = m_state; + word32 cPtr[17]; + +#define bPtr ((byte *)(aPtr+20)) + +// reorder the state for SSE2 +// a and c: 4 8 12 16 | 3 7 11 15 | 2 6 10 14 | 1 5 9 13 | 0 +// xmm0 xmm1 xmm2 xmm3 eax +#define a(i) aPtr[((i)*13+16) % 17] // 13 is inverse of 4 mod 17 +#define c(i) cPtr[((i)*13+16) % 17] +// b: 0 4 | 1 5 | 2 6 | 3 7 +#define b(i, j) b##i[(j)*2%8 + (j)/4] + +// output +#define OA(i) z[i] = ConditionalByteReverse(B::ToEnum(), a(i+9)) +#define OX(i) z[i] = y[i] ^ ConditionalByteReverse(B::ToEnum(), a(i+9)) +// buffer update +#define US(i) {word32 t=b(0,i); b(0,i)=ConditionalByteReverse(B::ToEnum(), p[i])^t; b(25,(i+6)%8)^=t;} +#define UL(i) {word32 t=b(0,i); b(0,i)=a(i+1)^t; b(25,(i+6)%8)^=t;} +// gamma and pi +#define GP(i) c(5*i%17) = rotlFixed(a(i) ^ (a((i+1)%17) | ~a((i+2)%17)), ((5*i%17)*((5*i%17)+1)/2)%32) +// theta and sigma +#define T(i,x) a(i) = c(i) ^ c((i+1)%17) ^ c((i+4)%17) ^ x +#define TS1S(i) T(i+1, ConditionalByteReverse(B::ToEnum(), p[i])) +#define TS1L(i) T(i+1, b(4,i)) +#define TS2(i) T(i+9, b(16,i)) + + while (count--) + { + if (z) + { + if (y) + { + OX(0); OX(1); OX(2); OX(3); OX(4); OX(5); OX(6); OX(7); + y += 8; + } + else + { + OA(0); OA(1); OA(2); OA(3); OA(4); OA(5); OA(6); OA(7); + } + z += 8; + } + + word32 *const b16 = (word32 *)(bPtr+((bstart+16*32) & 31*32)); + word32 *const b4 = (word32 *)(bPtr+((bstart+(32-4)*32) & 31*32)); + bstart += 32; + word32 *const b0 = (word32 *)(bPtr+((bstart) & 31*32)); + word32 *const b25 = (word32 *)(bPtr+((bstart+(32-25)*32) & 31*32)); + + if (p) + { + US(0); US(1); US(2); US(3); US(4); US(5); US(6); US(7); + } + else + { + UL(0); UL(1); UL(2); UL(3); UL(4); UL(5); UL(6); UL(7); + } + + GP(0); + GP(1); + GP(2); + GP(3); + GP(4); + GP(5); + GP(6); + GP(7); + GP(8); + GP(9); + GP(10); + GP(11); + GP(12); + GP(13); + GP(14); + GP(15); + GP(16); + + T(0,1); + + if (p) + { + TS1S(0); TS1S(1); TS1S(2); TS1S(3); TS1S(4); TS1S(5); TS1S(6); TS1S(7); + p += 8; + } + else + { + TS1L(0); TS1L(1); TS1L(2); TS1L(3); TS1L(4); TS1L(5); TS1L(6); TS1L(7); + } + + TS2(0); TS2(1); TS2(2); TS2(3); TS2(4); TS2(5); TS2(6); TS2(7); + } + m_state[17] = bstart; +} + +namespace Weak { +template +size_t PanamaHash::HashMultipleBlocks(const word32 *input, size_t length) +{ + this->Iterate(length / this->BLOCKSIZE, input); + return length % this->BLOCKSIZE; +} + +template +void PanamaHash::TruncatedFinal(byte *hash, size_t size) +{ + this->ThrowIfInvalidTruncatedSize(size); + + PadLastBlock(this->BLOCKSIZE, 0x01); + + HashEndianCorrectedBlock(this->m_data); + + this->Iterate(32); // pull + + FixedSizeSecBlock buf; + this->Iterate(1, NULL, buf, NULL); + + memcpy(hash, buf, size); + + this->Restart(); // reinit for next use +} +} + +template +void PanamaCipherPolicy::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) +{ + assert(length==32); + memcpy(m_key, key, 32); +} + +template +void PanamaCipherPolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length) +{ + assert(length==32); + this->Reset(); + this->Iterate(1, m_key); + if (iv && IsAligned(iv)) + this->Iterate(1, (const word32 *)iv); + else + { + FixedSizeSecBlock buf; + if (iv) + memcpy(buf, iv, 32); + else + memset(buf, 0, 32); + this->Iterate(1, buf); + } + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) + if (B::ToEnum() == LITTLE_ENDIAN_ORDER && HasSSE2()) + Panama_SSE2_Pull(32, this->m_state, NULL, NULL); + else +#endif + this->Iterate(32); +} + +#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64 +template +unsigned int PanamaCipherPolicy::GetAlignment() const +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) + if (B::ToEnum() == LITTLE_ENDIAN_ORDER && HasSSE2()) + return 16; + else +#endif + return 1; +} +#endif + +template +void PanamaCipherPolicy::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) + if (B::ToEnum() == LITTLE_ENDIAN_ORDER && HasSSE2()) + Panama_SSE2_Pull(iterationCount, this->m_state, (word32 *)output, (const word32 *)input); + else +#endif + this->Iterate(iterationCount, NULL, (word32 *)output, (const word32 *)input); +} + +template class Panama; +template class Panama; + +template class Weak::PanamaHash; +template class Weak::PanamaHash; + +template class PanamaCipherPolicy; +template class PanamaCipherPolicy; + +NAMESPACE_END + +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM diff --git a/cryptopp/panama.h b/cryptopp/panama.h new file mode 100644 index 0000000..5a23681 --- /dev/null +++ b/cryptopp/panama.h @@ -0,0 +1,144 @@ +#ifndef CRYPTOPP_PANAMA_H +#define CRYPTOPP_PANAMA_H + +#include "strciphr.h" +#include "iterhash.h" + +NAMESPACE_BEGIN(CryptoPP) + +/// base class, do not use directly +template +class CRYPTOPP_NO_VTABLE Panama +{ +public: + void Reset(); + void Iterate(size_t count, const word32 *p=NULL, word32 *z=NULL, const word32 *y=NULL); + +protected: + typedef word32 Stage[8]; + CRYPTOPP_CONSTANT(STAGES = 32) + + FixedSizeAlignedSecBlock m_state; +}; + +namespace Weak { +/// Panama Hash +template +class PanamaHash : protected Panama, public AlgorithmImpl, PanamaHash > +{ +public: + CRYPTOPP_CONSTANT(DIGESTSIZE = 32) + PanamaHash() {Panama::Reset();} + unsigned int DigestSize() const {return DIGESTSIZE;} + void TruncatedFinal(byte *hash, size_t size); + static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";} + +protected: + void Init() {Panama::Reset();} + void HashEndianCorrectedBlock(const word32 *data) {this->Iterate(1, data);} // push + size_t HashMultipleBlocks(const word32 *input, size_t length); + word32* StateBuf() {return NULL;} +}; +} + +//! MAC construction using a hermetic hash function +template +class HermeticHashFunctionMAC : public AlgorithmImpl > >, T_Info> +{ +public: + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) + { + m_key.Assign(key, length); + Restart(); + } + + void Restart() + { + m_hash.Restart(); + m_keyed = false; + } + + void Update(const byte *input, size_t length) + { + if (!m_keyed) + KeyHash(); + m_hash.Update(input, length); + } + + void TruncatedFinal(byte *digest, size_t digestSize) + { + if (!m_keyed) + KeyHash(); + m_hash.TruncatedFinal(digest, digestSize); + m_keyed = false; + } + + unsigned int DigestSize() const + {return m_hash.DigestSize();} + unsigned int BlockSize() const + {return m_hash.BlockSize();} + unsigned int OptimalBlockSize() const + {return m_hash.OptimalBlockSize();} + unsigned int OptimalDataAlignment() const + {return m_hash.OptimalDataAlignment();} + +protected: + void KeyHash() + { + m_hash.Update(m_key, m_key.size()); + m_keyed = true; + } + + T_Hash m_hash; + bool m_keyed; + SecByteBlock m_key; +}; + +namespace Weak { +/// Panama MAC +template +class PanamaMAC : public HermeticHashFunctionMAC > +{ +public: + PanamaMAC() {} + PanamaMAC(const byte *key, unsigned int length) + {this->SetKey(key, length);} +}; +} + +//! algorithm info +template +struct PanamaCipherInfo : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_IV, 32> +{ + static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";} +}; + +//! _ +template +class PanamaCipherPolicy : public AdditiveCipherConcretePolicy, + public PanamaCipherInfo, + protected Panama +{ +protected: + void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); + void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); + bool CipherIsRandomAccess() const {return false;} + void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length); +#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64 + unsigned int GetAlignment() const; +#endif + + FixedSizeSecBlock m_key; +}; + +//! Panama Stream Cipher +template +struct PanamaCipher : public PanamaCipherInfo, public SymmetricCipherDocumentation +{ + typedef SymmetricCipherFinal, AdditiveCipherTemplate<> >, PanamaCipherInfo > Encryption; + typedef Encryption Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/pch.cpp b/cryptopp/pch.cpp new file mode 100644 index 0000000..1d9f38c --- /dev/null +++ b/cryptopp/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/cryptopp/pch.h b/cryptopp/pch.h new file mode 100644 index 0000000..418c390 --- /dev/null +++ b/cryptopp/pch.h @@ -0,0 +1,21 @@ +#ifndef CRYPTOPP_PCH_H +#define CRYPTOPP_PCH_H + +#ifdef CRYPTOPP_GENERATE_X64_MASM + + #include "cpu.h" + +#else + + #include "config.h" + + #ifdef USE_PRECOMPILED_HEADERS + #include "simple.h" + #include "secblock.h" + #include "misc.h" + #include "smartptr.h" + #endif + +#endif + +#endif diff --git a/cryptopp/pkcspad.cpp b/cryptopp/pkcspad.cpp new file mode 100644 index 0000000..e1f1d1e --- /dev/null +++ b/cryptopp/pkcspad.cpp @@ -0,0 +1,124 @@ +// pkcspad.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_PKCSPAD_CPP // SunCC workaround: compiler could cause this file to be included twice +#define CRYPTOPP_PKCSPAD_CPP + +#include "pkcspad.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +// more in dll.cpp +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02,0x05,0x00,0x04,0x10}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); + +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x04,0x10}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); + +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x24,0x03,0x02,0x01,0x05,0x00,0x04,0x14}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); + +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x29,0x30,0x0D,0x06,0x09,0x2B,0x06,0x01,0x04,0x01,0xDA,0x47,0x0C,0x02,0x05,0x00,0x04,0x18}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); + +size_t PKCS_EncryptionPaddingScheme::MaxUnpaddedLength(size_t paddedLength) const +{ + return SaturatingSubtract(paddedLength/8, 10U); +} + +void PKCS_EncryptionPaddingScheme::Pad(RandomNumberGenerator &rng, const byte *input, size_t inputLen, byte *pkcsBlock, size_t pkcsBlockLen, const NameValuePairs ¶meters) const +{ + assert (inputLen <= MaxUnpaddedLength(pkcsBlockLen)); // this should be checked by caller + + // convert from bit length to byte length + if (pkcsBlockLen % 8 != 0) + { + pkcsBlock[0] = 0; + pkcsBlock++; + } + pkcsBlockLen /= 8; + + pkcsBlock[0] = 2; // block type 2 + + // pad with non-zero random bytes + for (unsigned i = 1; i < pkcsBlockLen-inputLen-1; i++) + pkcsBlock[i] = (byte)rng.GenerateWord32(1, 0xff); + + pkcsBlock[pkcsBlockLen-inputLen-1] = 0; // separator + memcpy(pkcsBlock+pkcsBlockLen-inputLen, input, inputLen); +} + +DecodingResult PKCS_EncryptionPaddingScheme::Unpad(const byte *pkcsBlock, size_t pkcsBlockLen, byte *output, const NameValuePairs ¶meters) const +{ + bool invalid = false; + size_t maxOutputLen = MaxUnpaddedLength(pkcsBlockLen); + + // convert from bit length to byte length + if (pkcsBlockLen % 8 != 0) + { + invalid = (pkcsBlock[0] != 0) || invalid; + pkcsBlock++; + } + pkcsBlockLen /= 8; + + // Require block type 2. + invalid = (pkcsBlock[0] != 2) || invalid; + + // skip past the padding until we find the separator + size_t i=1; + while (i maxOutputLen) || invalid; + + if (invalid) + return DecodingResult(); + + memcpy (output, pkcsBlock+i, outputLen); + return DecodingResult(outputLen); +} + +// ******************************************************** + +#ifndef CRYPTOPP_IMPORTS + +void PKCS1v15_SignatureMessageEncodingMethod::ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const +{ + assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize())); + + size_t pkcsBlockLen = representativeBitLength; + // convert from bit length to byte length + if (pkcsBlockLen % 8 != 0) + { + representative[0] = 0; + representative++; + } + pkcsBlockLen /= 8; + + representative[0] = 1; // block type 1 + + unsigned int digestSize = hash.DigestSize(); + byte *pPadding = representative + 1; + byte *pDigest = representative + pkcsBlockLen - digestSize; + byte *pHashId = pDigest - hashIdentifier.second; + byte *pSeparator = pHashId - 1; + + // pad with 0xff + memset(pPadding, 0xff, pSeparator-pPadding); + *pSeparator = 0; + memcpy(pHashId, hashIdentifier.first, hashIdentifier.second); + hash.Final(pDigest); +} + +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/pkcspad.h b/cryptopp/pkcspad.h new file mode 100644 index 0000000..6371c76 --- /dev/null +++ b/cryptopp/pkcspad.h @@ -0,0 +1,94 @@ +#ifndef CRYPTOPP_PKCSPAD_H +#define CRYPTOPP_PKCSPAD_H + +#include "cryptlib.h" +#include "pubkey.h" + +#ifdef CRYPTOPP_IS_DLL +#include "sha.h" +#endif + +NAMESPACE_BEGIN(CryptoPP) + +//! EME-PKCS1-v1_5 +class PKCS_EncryptionPaddingScheme : public PK_EncryptionMessageEncodingMethod +{ +public: + static const char * StaticAlgorithmName() {return "EME-PKCS1-v1_5";} + + size_t MaxUnpaddedLength(size_t paddedLength) const; + void Pad(RandomNumberGenerator &rng, const byte *raw, size_t inputLength, byte *padded, size_t paddedLength, const NameValuePairs ¶meters) const; + DecodingResult Unpad(const byte *padded, size_t paddedLength, byte *raw, const NameValuePairs ¶meters) const; +}; + +template class PKCS_DigestDecoration +{ +public: + static const byte decoration[]; + static const unsigned int length; +}; + +// PKCS_DigestDecoration can be instantiated with the following +// classes as specified in PKCS#1 v2.0 and P1363a +class SHA1; +class RIPEMD160; +class Tiger; +class SHA224; +class SHA256; +class SHA384; +class SHA512; +namespace Weak1 { +class MD2; +class MD5; +} +// end of list + +#ifdef CRYPTOPP_IS_DLL +CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; +CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; +CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; +CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; +CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; +#endif + +//! EMSA-PKCS1-v1_5 +class CRYPTOPP_DLL PKCS1v15_SignatureMessageEncodingMethod : public PK_DeterministicSignatureMessageEncodingMethod +{ +public: + static const char * CRYPTOPP_API StaticAlgorithmName() {return "EMSA-PKCS1-v1_5";} + + size_t MinRepresentativeBitLength(size_t hashIdentifierSize, size_t digestSize) const + {return 8 * (digestSize + hashIdentifierSize + 10);} + + void ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const; + + struct HashIdentifierLookup + { + template struct HashIdentifierLookup2 + { + static HashIdentifier Lookup() + { + return HashIdentifier(PKCS_DigestDecoration::decoration, PKCS_DigestDecoration::length); + } + }; + }; +}; + +//! PKCS #1 version 1.5, for use with RSAES and RSASS +/*! Only the following hash functions are supported by this signature standard: + \dontinclude pkcspad.h + \skip can be instantiated + \until end of list +*/ +struct PKCS1v15 : public SignatureStandard, public EncryptionStandard +{ + typedef PKCS_EncryptionPaddingScheme EncryptionMessageEncodingMethod; + typedef PKCS1v15_SignatureMessageEncodingMethod SignatureMessageEncodingMethod; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/polynomi.cpp b/cryptopp/polynomi.cpp new file mode 100644 index 0000000..734cae9 --- /dev/null +++ b/cryptopp/polynomi.cpp @@ -0,0 +1,577 @@ +// polynomi.cpp - written and placed in the public domain by Wei Dai + +// Part of the code for polynomial evaluation and interpolation +// originally came from Hal Finney's public domain secsplit.c. + +#include "pch.h" +#include "polynomi.h" +#include "secblock.h" + +#include +#include + +NAMESPACE_BEGIN(CryptoPP) + +template +void PolynomialOver::Randomize(RandomNumberGenerator &rng, const RandomizationParameter ¶meter, const Ring &ring) +{ + m_coefficients.resize(parameter.m_coefficientCount); + for (unsigned int i=0; i +void PolynomialOver::FromStr(const char *str, const Ring &ring) +{ + std::istringstream in((char *)str); + bool positive = true; + CoefficientType coef; + unsigned int power; + + while (in) + { + std::ws(in); + if (in.peek() == 'x') + coef = ring.MultiplicativeIdentity(); + else + in >> coef; + + std::ws(in); + if (in.peek() == 'x') + { + in.get(); + std::ws(in); + if (in.peek() == '^') + { + in.get(); + in >> power; + } + else + power = 1; + } + else + power = 0; + + if (!positive) + coef = ring.Inverse(coef); + + SetCoefficient(power, coef, ring); + + std::ws(in); + switch (in.get()) + { + case '+': + positive = true; + break; + case '-': + positive = false; + break; + default: + return; // something's wrong with the input string + } + } +} + +template +unsigned int PolynomialOver::CoefficientCount(const Ring &ring) const +{ + unsigned count = m_coefficients.size(); + while (count && ring.Equal(m_coefficients[count-1], ring.Identity())) + count--; + const_cast &>(m_coefficients).resize(count); + return count; +} + +template +typename PolynomialOver::CoefficientType PolynomialOver::GetCoefficient(unsigned int i, const Ring &ring) const +{ + return (i < m_coefficients.size()) ? m_coefficients[i] : ring.Identity(); +} + +template +PolynomialOver& PolynomialOver::operator=(const PolynomialOver& t) +{ + if (this != &t) + { + m_coefficients.resize(t.m_coefficients.size()); + for (unsigned int i=0; i +PolynomialOver& PolynomialOver::Accumulate(const PolynomialOver& t, const Ring &ring) +{ + unsigned int count = t.CoefficientCount(ring); + + if (count > CoefficientCount(ring)) + m_coefficients.resize(count, ring.Identity()); + + for (unsigned int i=0; i +PolynomialOver& PolynomialOver::Reduce(const PolynomialOver& t, const Ring &ring) +{ + unsigned int count = t.CoefficientCount(ring); + + if (count > CoefficientCount(ring)) + m_coefficients.resize(count, ring.Identity()); + + for (unsigned int i=0; i +typename PolynomialOver::CoefficientType PolynomialOver::EvaluateAt(const CoefficientType &x, const Ring &ring) const +{ + int degree = Degree(ring); + + if (degree < 0) + return ring.Identity(); + + CoefficientType result = m_coefficients[degree]; + for (int j=degree-1; j>=0; j--) + { + result = ring.Multiply(result, x); + ring.Accumulate(result, m_coefficients[j]); + } + return result; +} + +template +PolynomialOver& PolynomialOver::ShiftLeft(unsigned int n, const Ring &ring) +{ + unsigned int i = CoefficientCount(ring) + n; + m_coefficients.resize(i, ring.Identity()); + while (i > n) + { + i--; + m_coefficients[i] = m_coefficients[i-n]; + } + while (i) + { + i--; + m_coefficients[i] = ring.Identity(); + } + return *this; +} + +template +PolynomialOver& PolynomialOver::ShiftRight(unsigned int n, const Ring &ring) +{ + unsigned int count = CoefficientCount(ring); + if (count > n) + { + for (unsigned int i=0; i +void PolynomialOver::SetCoefficient(unsigned int i, const CoefficientType &value, const Ring &ring) +{ + if (i >= m_coefficients.size()) + m_coefficients.resize(i+1, ring.Identity()); + m_coefficients[i] = value; +} + +template +void PolynomialOver::Negate(const Ring &ring) +{ + unsigned int count = CoefficientCount(ring); + for (unsigned int i=0; i +void PolynomialOver::swap(PolynomialOver &t) +{ + m_coefficients.swap(t.m_coefficients); +} + +template +bool PolynomialOver::Equals(const PolynomialOver& t, const Ring &ring) const +{ + unsigned int count = CoefficientCount(ring); + + if (count != t.CoefficientCount(ring)) + return false; + + for (unsigned int i=0; i +PolynomialOver PolynomialOver::Plus(const PolynomialOver& t, const Ring &ring) const +{ + unsigned int i; + unsigned int count = CoefficientCount(ring); + unsigned int tCount = t.CoefficientCount(ring); + + if (count > tCount) + { + PolynomialOver result(ring, count); + + for (i=0; i result(ring, tCount); + + for (i=0; i +PolynomialOver PolynomialOver::Minus(const PolynomialOver& t, const Ring &ring) const +{ + unsigned int i; + unsigned int count = CoefficientCount(ring); + unsigned int tCount = t.CoefficientCount(ring); + + if (count > tCount) + { + PolynomialOver result(ring, count); + + for (i=0; i result(ring, tCount); + + for (i=0; i +PolynomialOver PolynomialOver::Inverse(const Ring &ring) const +{ + unsigned int count = CoefficientCount(ring); + PolynomialOver result(ring, count); + + for (unsigned int i=0; i +PolynomialOver PolynomialOver::Times(const PolynomialOver& t, const Ring &ring) const +{ + if (IsZero(ring) || t.IsZero(ring)) + return PolynomialOver(); + + unsigned int count1 = CoefficientCount(ring), count2 = t.CoefficientCount(ring); + PolynomialOver result(ring, count1 + count2 - 1); + + for (unsigned int i=0; i +PolynomialOver PolynomialOver::DividedBy(const PolynomialOver& t, const Ring &ring) const +{ + PolynomialOver remainder, quotient; + Divide(remainder, quotient, *this, t, ring); + return quotient; +} + +template +PolynomialOver PolynomialOver::Modulo(const PolynomialOver& t, const Ring &ring) const +{ + PolynomialOver remainder, quotient; + Divide(remainder, quotient, *this, t, ring); + return remainder; +} + +template +PolynomialOver PolynomialOver::MultiplicativeInverse(const Ring &ring) const +{ + return Degree(ring)==0 ? ring.MultiplicativeInverse(m_coefficients[0]) : ring.Identity(); +} + +template +bool PolynomialOver::IsUnit(const Ring &ring) const +{ + return Degree(ring)==0 && ring.IsUnit(m_coefficients[0]); +} + +template +std::istream& PolynomialOver::Input(std::istream &in, const Ring &ring) +{ + char c; + unsigned int length = 0; + SecBlock str(length + 16); + bool paren = false; + + std::ws(in); + + if (in.peek() == '(') + { + paren = true; + in.get(); + } + + do + { + in.read(&c, 1); + str[length++] = c; + if (length >= str.size()) + str.Grow(length + 16); + } + // if we started with a left paren, then read until we find a right paren, + // otherwise read until the end of the line + while (in && ((paren && c != ')') || (!paren && c != '\n'))); + + str[length-1] = '\0'; + *this = PolynomialOver(str, ring); + + return in; +} + +template +std::ostream& PolynomialOver::Output(std::ostream &out, const Ring &ring) const +{ + unsigned int i = CoefficientCount(ring); + if (i) + { + bool firstTerm = true; + + while (i--) + { + if (m_coefficients[i] != ring.Identity()) + { + if (firstTerm) + { + firstTerm = false; + if (!i || !ring.Equal(m_coefficients[i], ring.MultiplicativeIdentity())) + out << m_coefficients[i]; + } + else + { + CoefficientType inverse = ring.Inverse(m_coefficients[i]); + std::ostringstream pstr, nstr; + + pstr << m_coefficients[i]; + nstr << inverse; + + if (pstr.str().size() <= nstr.str().size()) + { + out << " + "; + if (!i || !ring.Equal(m_coefficients[i], ring.MultiplicativeIdentity())) + out << m_coefficients[i]; + } + else + { + out << " - "; + if (!i || !ring.Equal(inverse, ring.MultiplicativeIdentity())) + out << inverse; + } + } + + switch (i) + { + case 0: + break; + case 1: + out << "x"; + break; + default: + out << "x^" << i; + } + } + } + } + else + { + out << ring.Identity(); + } + return out; +} + +template +void PolynomialOver::Divide(PolynomialOver &r, PolynomialOver &q, const PolynomialOver &a, const PolynomialOver &d, const Ring &ring) +{ + unsigned int i = a.CoefficientCount(ring); + const int dDegree = d.Degree(ring); + + if (dDegree < 0) + throw DivideByZero(); + + r = a; + q.m_coefficients.resize(STDMAX(0, int(i - dDegree))); + + while (i > (unsigned int)dDegree) + { + --i; + q.m_coefficients[i-dDegree] = ring.Divide(r.m_coefficients[i], d.m_coefficients[dDegree]); + for (int j=0; j<=dDegree; j++) + ring.Reduce(r.m_coefficients[i-dDegree+j], ring.Multiply(q.m_coefficients[i-dDegree], d.m_coefficients[j])); + } + + r.CoefficientCount(ring); // resize r.m_coefficients +} + +// ******************************************************** + +// helper function for Interpolate() and InterpolateAt() +template +void RingOfPolynomialsOver::CalculateAlpha(std::vector &alpha, const CoefficientType x[], const CoefficientType y[], unsigned int n) const +{ + for (unsigned int j=0; j=k; --j) + { + m_ring.Reduce(alpha[j], alpha[j-1]); + + CoefficientType d = m_ring.Subtract(x[j], x[j-k]); + if (!m_ring.IsUnit(d)) + throw InterpolationFailed(); + alpha[j] = m_ring.Divide(alpha[j], d); + } + } +} + +template +typename RingOfPolynomialsOver::Element RingOfPolynomialsOver::Interpolate(const CoefficientType x[], const CoefficientType y[], unsigned int n) const +{ + assert(n > 0); + + std::vector alpha(n); + CalculateAlpha(alpha, x, y, n); + + std::vector coefficients((size_t)n, m_ring.Identity()); + coefficients[0] = alpha[n-1]; + + for (int j=n-2; j>=0; --j) + { + for (unsigned int i=n-j-1; i>0; i--) + coefficients[i] = m_ring.Subtract(coefficients[i-1], m_ring.Multiply(coefficients[i], x[j])); + + coefficients[0] = m_ring.Subtract(alpha[j], m_ring.Multiply(coefficients[0], x[j])); + } + + return PolynomialOver(coefficients.begin(), coefficients.end()); +} + +template +typename RingOfPolynomialsOver::CoefficientType RingOfPolynomialsOver::InterpolateAt(const CoefficientType &position, const CoefficientType x[], const CoefficientType y[], unsigned int n) const +{ + assert(n > 0); + + std::vector alpha(n); + CalculateAlpha(alpha, x, y, n); + + CoefficientType result = alpha[n-1]; + for (int j=n-2; j>=0; --j) + { + result = m_ring.Multiply(result, m_ring.Subtract(position, x[j])); + m_ring.Accumulate(result, alpha[j]); + } + return result; +} + +template +void PrepareBulkPolynomialInterpolation(const Ring &ring, Element *w, const Element x[], unsigned int n) +{ + for (unsigned int i=0; i +void PrepareBulkPolynomialInterpolationAt(const Ring &ring, Element *v, const Element &position, const Element x[], const Element w[], unsigned int n) +{ + assert(n > 0); + + std::vector a(2*n-1); + unsigned int i; + + for (i=0; i1; i--) + a[i-1] = ring.Multiply(a[2*i], a[2*i-1]); + + a[0] = ring.MultiplicativeIdentity(); + + for (i=0; i +Element BulkPolynomialInterpolateAt(const Ring &ring, const Element y[], const Element v[], unsigned int n) +{ + Element result = ring.Identity(); + for (unsigned int i=0; i +const PolynomialOverFixedRing &PolynomialOverFixedRing::Zero() +{ + return Singleton().Ref(); +} + +template +const PolynomialOverFixedRing &PolynomialOverFixedRing::One() +{ + return Singleton().Ref(); +} + +NAMESPACE_END diff --git a/cryptopp/polynomi.h b/cryptopp/polynomi.h new file mode 100644 index 0000000..cddadae --- /dev/null +++ b/cryptopp/polynomi.h @@ -0,0 +1,459 @@ +#ifndef CRYPTOPP_POLYNOMI_H +#define CRYPTOPP_POLYNOMI_H + +/*! \file */ + +#include "cryptlib.h" +#include "misc.h" +#include "algebra.h" + +#include +#include + +NAMESPACE_BEGIN(CryptoPP) + +//! represents single-variable polynomials over arbitrary rings +/*! \nosubgrouping */ +template class PolynomialOver +{ +public: + //! \name ENUMS, EXCEPTIONS, and TYPEDEFS + //@{ + //! division by zero exception + class DivideByZero : public Exception + { + public: + DivideByZero() : Exception(OTHER_ERROR, "PolynomialOver: division by zero") {} + }; + + //! specify the distribution for randomization functions + class RandomizationParameter + { + public: + RandomizationParameter(unsigned int coefficientCount, const typename T::RandomizationParameter &coefficientParameter ) + : m_coefficientCount(coefficientCount), m_coefficientParameter(coefficientParameter) {} + + private: + unsigned int m_coefficientCount; + typename T::RandomizationParameter m_coefficientParameter; + friend class PolynomialOver; + }; + + typedef T Ring; + typedef typename T::Element CoefficientType; + //@} + + //! \name CREATORS + //@{ + //! creates the zero polynomial + PolynomialOver() {} + + //! + PolynomialOver(const Ring &ring, unsigned int count) + : m_coefficients((size_t)count, ring.Identity()) {} + + //! copy constructor + PolynomialOver(const PolynomialOver &t) + : m_coefficients(t.m_coefficients.size()) {*this = t;} + + //! construct constant polynomial + PolynomialOver(const CoefficientType &element) + : m_coefficients(1, element) {} + + //! construct polynomial with specified coefficients, starting from coefficient of x^0 + template PolynomialOver(Iterator begin, Iterator end) + : m_coefficients(begin, end) {} + + //! convert from string + PolynomialOver(const char *str, const Ring &ring) {FromStr(str, ring);} + + //! convert from big-endian byte array + PolynomialOver(const byte *encodedPolynomialOver, unsigned int byteCount); + + //! convert from Basic Encoding Rules encoded byte array + explicit PolynomialOver(const byte *BEREncodedPolynomialOver); + + //! convert from BER encoded byte array stored in a BufferedTransformation object + explicit PolynomialOver(BufferedTransformation &bt); + + //! create a random PolynomialOver + PolynomialOver(RandomNumberGenerator &rng, const RandomizationParameter ¶meter, const Ring &ring) + {Randomize(rng, parameter, ring);} + //@} + + //! \name ACCESSORS + //@{ + //! the zero polynomial will return a degree of -1 + int Degree(const Ring &ring) const {return int(CoefficientCount(ring))-1;} + //! + unsigned int CoefficientCount(const Ring &ring) const; + //! return coefficient for x^i + CoefficientType GetCoefficient(unsigned int i, const Ring &ring) const; + //@} + + //! \name MANIPULATORS + //@{ + //! + PolynomialOver& operator=(const PolynomialOver& t); + + //! + void Randomize(RandomNumberGenerator &rng, const RandomizationParameter ¶meter, const Ring &ring); + + //! set the coefficient for x^i to value + void SetCoefficient(unsigned int i, const CoefficientType &value, const Ring &ring); + + //! + void Negate(const Ring &ring); + + //! + void swap(PolynomialOver &t); + //@} + + + //! \name BASIC ARITHMETIC ON POLYNOMIALS + //@{ + bool Equals(const PolynomialOver &t, const Ring &ring) const; + bool IsZero(const Ring &ring) const {return CoefficientCount(ring)==0;} + + PolynomialOver Plus(const PolynomialOver& t, const Ring &ring) const; + PolynomialOver Minus(const PolynomialOver& t, const Ring &ring) const; + PolynomialOver Inverse(const Ring &ring) const; + + PolynomialOver Times(const PolynomialOver& t, const Ring &ring) const; + PolynomialOver DividedBy(const PolynomialOver& t, const Ring &ring) const; + PolynomialOver Modulo(const PolynomialOver& t, const Ring &ring) const; + PolynomialOver MultiplicativeInverse(const Ring &ring) const; + bool IsUnit(const Ring &ring) const; + + PolynomialOver& Accumulate(const PolynomialOver& t, const Ring &ring); + PolynomialOver& Reduce(const PolynomialOver& t, const Ring &ring); + + //! + PolynomialOver Doubled(const Ring &ring) const {return Plus(*this, ring);} + //! + PolynomialOver Squared(const Ring &ring) const {return Times(*this, ring);} + + CoefficientType EvaluateAt(const CoefficientType &x, const Ring &ring) const; + + PolynomialOver& ShiftLeft(unsigned int n, const Ring &ring); + PolynomialOver& ShiftRight(unsigned int n, const Ring &ring); + + //! calculate r and q such that (a == d*q + r) && (0 <= degree of r < degree of d) + static void Divide(PolynomialOver &r, PolynomialOver &q, const PolynomialOver &a, const PolynomialOver &d, const Ring &ring); + //@} + + //! \name INPUT/OUTPUT + //@{ + std::istream& Input(std::istream &in, const Ring &ring); + std::ostream& Output(std::ostream &out, const Ring &ring) const; + //@} + +private: + void FromStr(const char *str, const Ring &ring); + + std::vector m_coefficients; +}; + +//! Polynomials over a fixed ring +/*! Having a fixed ring allows overloaded operators */ +template class PolynomialOverFixedRing : private PolynomialOver +{ + typedef PolynomialOver B; + typedef PolynomialOverFixedRing ThisType; + +public: + typedef T Ring; + typedef typename T::Element CoefficientType; + typedef typename B::DivideByZero DivideByZero; + typedef typename B::RandomizationParameter RandomizationParameter; + + //! \name CREATORS + //@{ + //! creates the zero polynomial + PolynomialOverFixedRing(unsigned int count = 0) : B(ms_fixedRing, count) {} + + //! copy constructor + PolynomialOverFixedRing(const ThisType &t) : B(t) {} + + explicit PolynomialOverFixedRing(const B &t) : B(t) {} + + //! construct constant polynomial + PolynomialOverFixedRing(const CoefficientType &element) : B(element) {} + + //! construct polynomial with specified coefficients, starting from coefficient of x^0 + template PolynomialOverFixedRing(Iterator first, Iterator last) + : B(first, last) {} + + //! convert from string + explicit PolynomialOverFixedRing(const char *str) : B(str, ms_fixedRing) {} + + //! convert from big-endian byte array + PolynomialOverFixedRing(const byte *encodedPoly, unsigned int byteCount) : B(encodedPoly, byteCount) {} + + //! convert from Basic Encoding Rules encoded byte array + explicit PolynomialOverFixedRing(const byte *BEREncodedPoly) : B(BEREncodedPoly) {} + + //! convert from BER encoded byte array stored in a BufferedTransformation object + explicit PolynomialOverFixedRing(BufferedTransformation &bt) : B(bt) {} + + //! create a random PolynomialOverFixedRing + PolynomialOverFixedRing(RandomNumberGenerator &rng, const RandomizationParameter ¶meter) : B(rng, parameter, ms_fixedRing) {} + + static const ThisType &Zero(); + static const ThisType &One(); + //@} + + //! \name ACCESSORS + //@{ + //! the zero polynomial will return a degree of -1 + int Degree() const {return B::Degree(ms_fixedRing);} + //! degree + 1 + unsigned int CoefficientCount() const {return B::CoefficientCount(ms_fixedRing);} + //! return coefficient for x^i + CoefficientType GetCoefficient(unsigned int i) const {return B::GetCoefficient(i, ms_fixedRing);} + //! return coefficient for x^i + CoefficientType operator[](unsigned int i) const {return B::GetCoefficient(i, ms_fixedRing);} + //@} + + //! \name MANIPULATORS + //@{ + //! + ThisType& operator=(const ThisType& t) {B::operator=(t); return *this;} + //! + ThisType& operator+=(const ThisType& t) {Accumulate(t, ms_fixedRing); return *this;} + //! + ThisType& operator-=(const ThisType& t) {Reduce(t, ms_fixedRing); return *this;} + //! + ThisType& operator*=(const ThisType& t) {return *this = *this*t;} + //! + ThisType& operator/=(const ThisType& t) {return *this = *this/t;} + //! + ThisType& operator%=(const ThisType& t) {return *this = *this%t;} + + //! + ThisType& operator<<=(unsigned int n) {ShiftLeft(n, ms_fixedRing); return *this;} + //! + ThisType& operator>>=(unsigned int n) {ShiftRight(n, ms_fixedRing); return *this;} + + //! set the coefficient for x^i to value + void SetCoefficient(unsigned int i, const CoefficientType &value) {B::SetCoefficient(i, value, ms_fixedRing);} + + //! + void Randomize(RandomNumberGenerator &rng, const RandomizationParameter ¶meter) {B::Randomize(rng, parameter, ms_fixedRing);} + + //! + void Negate() {B::Negate(ms_fixedRing);} + + void swap(ThisType &t) {B::swap(t);} + //@} + + //! \name UNARY OPERATORS + //@{ + //! + bool operator!() const {return CoefficientCount()==0;} + //! + ThisType operator+() const {return *this;} + //! + ThisType operator-() const {return ThisType(Inverse(ms_fixedRing));} + //@} + + //! \name BINARY OPERATORS + //@{ + //! + friend ThisType operator>>(ThisType a, unsigned int n) {return ThisType(a>>=n);} + //! + friend ThisType operator<<(ThisType a, unsigned int n) {return ThisType(a<<=n);} + //@} + + //! \name OTHER ARITHMETIC FUNCTIONS + //@{ + //! + ThisType MultiplicativeInverse() const {return ThisType(B::MultiplicativeInverse(ms_fixedRing));} + //! + bool IsUnit() const {return B::IsUnit(ms_fixedRing);} + + //! + ThisType Doubled() const {return ThisType(B::Doubled(ms_fixedRing));} + //! + ThisType Squared() const {return ThisType(B::Squared(ms_fixedRing));} + + CoefficientType EvaluateAt(const CoefficientType &x) const {return B::EvaluateAt(x, ms_fixedRing);} + + //! calculate r and q such that (a == d*q + r) && (0 <= r < abs(d)) + static void Divide(ThisType &r, ThisType &q, const ThisType &a, const ThisType &d) + {B::Divide(r, q, a, d, ms_fixedRing);} + //@} + + //! \name INPUT/OUTPUT + //@{ + //! + friend std::istream& operator>>(std::istream& in, ThisType &a) + {return a.Input(in, ms_fixedRing);} + //! + friend std::ostream& operator<<(std::ostream& out, const ThisType &a) + {return a.Output(out, ms_fixedRing);} + //@} + +private: + struct NewOnePolynomial + { + ThisType * operator()() const + { + return new ThisType(ms_fixedRing.MultiplicativeIdentity()); + } + }; + + static const Ring ms_fixedRing; +}; + +//! Ring of polynomials over another ring +template class RingOfPolynomialsOver : public AbstractEuclideanDomain > +{ +public: + typedef T CoefficientRing; + typedef PolynomialOver Element; + typedef typename Element::CoefficientType CoefficientType; + typedef typename Element::RandomizationParameter RandomizationParameter; + + RingOfPolynomialsOver(const CoefficientRing &ring) : m_ring(ring) {} + + Element RandomElement(RandomNumberGenerator &rng, const RandomizationParameter ¶meter) + {return Element(rng, parameter, m_ring);} + + bool Equal(const Element &a, const Element &b) const + {return a.Equals(b, m_ring);} + + const Element& Identity() const + {return this->result = m_ring.Identity();} + + const Element& Add(const Element &a, const Element &b) const + {return this->result = a.Plus(b, m_ring);} + + Element& Accumulate(Element &a, const Element &b) const + {a.Accumulate(b, m_ring); return a;} + + const Element& Inverse(const Element &a) const + {return this->result = a.Inverse(m_ring);} + + const Element& Subtract(const Element &a, const Element &b) const + {return this->result = a.Minus(b, m_ring);} + + Element& Reduce(Element &a, const Element &b) const + {return a.Reduce(b, m_ring);} + + const Element& Double(const Element &a) const + {return this->result = a.Doubled(m_ring);} + + const Element& MultiplicativeIdentity() const + {return this->result = m_ring.MultiplicativeIdentity();} + + const Element& Multiply(const Element &a, const Element &b) const + {return this->result = a.Times(b, m_ring);} + + const Element& Square(const Element &a) const + {return this->result = a.Squared(m_ring);} + + bool IsUnit(const Element &a) const + {return a.IsUnit(m_ring);} + + const Element& MultiplicativeInverse(const Element &a) const + {return this->result = a.MultiplicativeInverse(m_ring);} + + const Element& Divide(const Element &a, const Element &b) const + {return this->result = a.DividedBy(b, m_ring);} + + const Element& Mod(const Element &a, const Element &b) const + {return this->result = a.Modulo(b, m_ring);} + + void DivisionAlgorithm(Element &r, Element &q, const Element &a, const Element &d) const + {Element::Divide(r, q, a, d, m_ring);} + + class InterpolationFailed : public Exception + { + public: + InterpolationFailed() : Exception(OTHER_ERROR, "RingOfPolynomialsOver: interpolation failed") {} + }; + + Element Interpolate(const CoefficientType x[], const CoefficientType y[], unsigned int n) const; + + // a faster version of Interpolate(x, y, n).EvaluateAt(position) + CoefficientType InterpolateAt(const CoefficientType &position, const CoefficientType x[], const CoefficientType y[], unsigned int n) const; +/* + void PrepareBulkInterpolation(CoefficientType *w, const CoefficientType x[], unsigned int n) const; + void PrepareBulkInterpolationAt(CoefficientType *v, const CoefficientType &position, const CoefficientType x[], const CoefficientType w[], unsigned int n) const; + CoefficientType BulkInterpolateAt(const CoefficientType y[], const CoefficientType v[], unsigned int n) const; +*/ +protected: + void CalculateAlpha(std::vector &alpha, const CoefficientType x[], const CoefficientType y[], unsigned int n) const; + + CoefficientRing m_ring; +}; + +template +void PrepareBulkPolynomialInterpolation(const Ring &ring, Element *w, const Element x[], unsigned int n); +template +void PrepareBulkPolynomialInterpolationAt(const Ring &ring, Element *v, const Element &position, const Element x[], const Element w[], unsigned int n); +template +Element BulkPolynomialInterpolateAt(const Ring &ring, const Element y[], const Element v[], unsigned int n); + +//! +template +inline bool operator==(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return a.Equals(b, a.ms_fixedRing);} +//! +template +inline bool operator!=(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return !(a==b);} + +//! +template +inline bool operator> (const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return a.Degree() > b.Degree();} +//! +template +inline bool operator>=(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return a.Degree() >= b.Degree();} +//! +template +inline bool operator< (const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return a.Degree() < b.Degree();} +//! +template +inline bool operator<=(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return a.Degree() <= b.Degree();} + +//! +template +inline CryptoPP::PolynomialOverFixedRing operator+(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return CryptoPP::PolynomialOverFixedRing(a.Plus(b, a.ms_fixedRing));} +//! +template +inline CryptoPP::PolynomialOverFixedRing operator-(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return CryptoPP::PolynomialOverFixedRing(a.Minus(b, a.ms_fixedRing));} +//! +template +inline CryptoPP::PolynomialOverFixedRing operator*(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return CryptoPP::PolynomialOverFixedRing(a.Times(b, a.ms_fixedRing));} +//! +template +inline CryptoPP::PolynomialOverFixedRing operator/(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return CryptoPP::PolynomialOverFixedRing(a.DividedBy(b, a.ms_fixedRing));} +//! +template +inline CryptoPP::PolynomialOverFixedRing operator%(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) + {return CryptoPP::PolynomialOverFixedRing(a.Modulo(b, a.ms_fixedRing));} + +NAMESPACE_END + +NAMESPACE_BEGIN(std) +template inline void swap(CryptoPP::PolynomialOver &a, CryptoPP::PolynomialOver &b) +{ + a.swap(b); +} +template inline void swap(CryptoPP::PolynomialOverFixedRing &a, CryptoPP::PolynomialOverFixedRing &b) +{ + a.swap(b); +} +NAMESPACE_END + +#endif diff --git a/cryptopp/pssr.cpp b/cryptopp/pssr.cpp new file mode 100644 index 0000000..ccbe4ee --- /dev/null +++ b/cryptopp/pssr.cpp @@ -0,0 +1,145 @@ +// pssr.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "pssr.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +// more in dll.cpp +template<> const byte EMSA2HashId::id = 0x31; +template<> const byte EMSA2HashId::id = 0x32; +template<> const byte EMSA2HashId::id = 0x37; + +#ifndef CRYPTOPP_IMPORTS + +size_t PSSR_MEM_Base::MinRepresentativeBitLength(size_t hashIdentifierLength, size_t digestLength) const +{ + size_t saltLen = SaltLen(digestLength); + size_t minPadLen = MinPadLen(digestLength); + return 9 + 8*(minPadLen + saltLen + digestLength + hashIdentifierLength); +} + +size_t PSSR_MEM_Base::MaxRecoverableLength(size_t representativeBitLength, size_t hashIdentifierLength, size_t digestLength) const +{ + if (AllowRecovery()) + return SaturatingSubtract(representativeBitLength, MinRepresentativeBitLength(hashIdentifierLength, digestLength)) / 8; + return 0; +} + +bool PSSR_MEM_Base::IsProbabilistic() const +{ + return SaltLen(1) > 0; +} + +bool PSSR_MEM_Base::AllowNonrecoverablePart() const +{ + return true; +} + +bool PSSR_MEM_Base::RecoverablePartFirst() const +{ + return false; +} + +void PSSR_MEM_Base::ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const +{ + assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize())); + + const size_t u = hashIdentifier.second + 1; + const size_t representativeByteLength = BitsToBytes(representativeBitLength); + const size_t digestSize = hash.DigestSize(); + const size_t saltSize = SaltLen(digestSize); + byte *const h = representative + representativeByteLength - u - digestSize; + + SecByteBlock digest(digestSize), salt(saltSize); + hash.Final(digest); + rng.GenerateBlock(salt, saltSize); + + // compute H = hash of M' + byte c[8]; + PutWord(false, BIG_ENDIAN_ORDER, c, (word32)SafeRightShift<29>(recoverableMessageLength)); + PutWord(false, BIG_ENDIAN_ORDER, c+4, word32(recoverableMessageLength << 3)); + hash.Update(c, 8); + hash.Update(recoverableMessage, recoverableMessageLength); + hash.Update(digest, digestSize); + hash.Update(salt, saltSize); + hash.Final(h); + + // compute representative + GetMGF().GenerateAndMask(hash, representative, representativeByteLength - u - digestSize, h, digestSize, false); + byte *xorStart = representative + representativeByteLength - u - digestSize - salt.size() - recoverableMessageLength - 1; + xorStart[0] ^= 1; + xorbuf(xorStart + 1, recoverableMessage, recoverableMessageLength); + xorbuf(xorStart + 1 + recoverableMessageLength, salt, salt.size()); + memcpy(representative + representativeByteLength - u, hashIdentifier.first, hashIdentifier.second); + representative[representativeByteLength - 1] = hashIdentifier.second ? 0xcc : 0xbc; + if (representativeBitLength % 8 != 0) + representative[0] = (byte)Crop(representative[0], representativeBitLength % 8); +} + +DecodingResult PSSR_MEM_Base::RecoverMessageFromRepresentative( + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength, + byte *recoverableMessage) const +{ + assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize())); + + const size_t u = hashIdentifier.second + 1; + const size_t representativeByteLength = BitsToBytes(representativeBitLength); + const size_t digestSize = hash.DigestSize(); + const size_t saltSize = SaltLen(digestSize); + const byte *const h = representative + representativeByteLength - u - digestSize; + + SecByteBlock digest(digestSize); + hash.Final(digest); + + DecodingResult result(0); + bool &valid = result.isValidCoding; + size_t &recoverableMessageLength = result.messageLength; + + valid = (representative[representativeByteLength - 1] == (hashIdentifier.second ? 0xcc : 0xbc)) && valid; + valid = VerifyBufsEqual(representative + representativeByteLength - u, hashIdentifier.first, hashIdentifier.second) && valid; + + GetMGF().GenerateAndMask(hash, representative, representativeByteLength - u - digestSize, h, digestSize); + if (representativeBitLength % 8 != 0) + representative[0] = (byte)Crop(representative[0], representativeBitLength % 8); + + // extract salt and recoverableMessage from DB = 00 ... || 01 || M || salt + byte *salt = representative + representativeByteLength - u - digestSize - saltSize; + byte *M = std::find_if(representative, salt-1, std::bind2nd(std::not_equal_to(), 0)); + recoverableMessageLength = salt-M-1; + if (*M == 0x01 + && (size_t)(M - representative - (representativeBitLength % 8 != 0)) >= MinPadLen(digestSize) + && recoverableMessageLength <= MaxRecoverableLength(representativeBitLength, hashIdentifier.second, digestSize)) + { + memcpy(recoverableMessage, M+1, recoverableMessageLength); + } + else + { + recoverableMessageLength = 0; + valid = false; + } + + // verify H = hash of M' + byte c[8]; + PutWord(false, BIG_ENDIAN_ORDER, c, (word32)SafeRightShift<29>(recoverableMessageLength)); + PutWord(false, BIG_ENDIAN_ORDER, c+4, word32(recoverableMessageLength << 3)); + hash.Update(c, 8); + hash.Update(recoverableMessage, recoverableMessageLength); + hash.Update(digest, digestSize); + hash.Update(salt, saltSize); + valid = hash.Verify(h) && valid; + + if (!AllowRecovery() && valid && recoverableMessageLength != 0) + {throw NotImplemented("PSSR_MEM: message recovery disabled");} + + return result; +} + +#endif + +NAMESPACE_END diff --git a/cryptopp/pssr.h b/cryptopp/pssr.h new file mode 100644 index 0000000..6ec6936 --- /dev/null +++ b/cryptopp/pssr.h @@ -0,0 +1,66 @@ +#ifndef CRYPTOPP_PSSR_H +#define CRYPTOPP_PSSR_H + +#include "pubkey.h" +#include "emsa2.h" + +#ifdef CRYPTOPP_IS_DLL +#include "sha.h" +#endif + +NAMESPACE_BEGIN(CryptoPP) + +class CRYPTOPP_DLL PSSR_MEM_Base : public PK_RecoverableSignatureMessageEncodingMethod +{ + virtual bool AllowRecovery() const =0; + virtual size_t SaltLen(size_t hashLen) const =0; + virtual size_t MinPadLen(size_t hashLen) const =0; + virtual const MaskGeneratingFunction & GetMGF() const =0; + +public: + size_t MinRepresentativeBitLength(size_t hashIdentifierLength, size_t digestLength) const; + size_t MaxRecoverableLength(size_t representativeBitLength, size_t hashIdentifierLength, size_t digestLength) const; + bool IsProbabilistic() const; + bool AllowNonrecoverablePart() const; + bool RecoverablePartFirst() const; + void ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const; + DecodingResult RecoverMessageFromRepresentative( + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength, + byte *recoverableMessage) const; +}; + +template class PSSR_MEM_BaseWithHashId; +template<> class PSSR_MEM_BaseWithHashId : public EMSA2HashIdLookup {}; +template<> class PSSR_MEM_BaseWithHashId : public PSSR_MEM_Base {}; + +template +class PSSR_MEM : public PSSR_MEM_BaseWithHashId +{ + virtual bool AllowRecovery() const {return ALLOW_RECOVERY;} + virtual size_t SaltLen(size_t hashLen) const {return SALT_LEN < 0 ? hashLen : SALT_LEN;} + virtual size_t MinPadLen(size_t hashLen) const {return MIN_PAD_LEN < 0 ? hashLen : MIN_PAD_LEN;} + virtual const MaskGeneratingFunction & GetMGF() const {static MGF mgf; return mgf;} + +public: + static std::string CRYPTOPP_API StaticAlgorithmName() {return std::string(ALLOW_RECOVERY ? "PSSR-" : "PSS-") + MGF::StaticAlgorithmName();} +}; + +//! PSSR-MGF1 +struct PSSR : public SignatureStandard +{ + typedef PSSR_MEM SignatureMessageEncodingMethod; +}; + +//! PSS-MGF1 +struct PSS : public SignatureStandard +{ + typedef PSSR_MEM SignatureMessageEncodingMethod; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/pubkey.cpp b/cryptopp/pubkey.cpp new file mode 100644 index 0000000..7336e8b --- /dev/null +++ b/cryptopp/pubkey.cpp @@ -0,0 +1,162 @@ +// pubkey.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "pubkey.h" + +NAMESPACE_BEGIN(CryptoPP) + +void P1363_MGF1KDF2_Common(HashTransformation &hash, byte *output, size_t outputLength, const byte *input, size_t inputLength, const byte *derivationParams, size_t derivationParamsLength, bool mask, unsigned int counterStart) +{ + ArraySink *sink; + HashFilter filter(hash, sink = mask ? new ArrayXorSink(output, outputLength) : new ArraySink(output, outputLength)); + word32 counter = counterStart; + while (sink->AvailableSize() > 0) + { + filter.Put(input, inputLength); + filter.PutWord32(counter++); + filter.Put(derivationParams, derivationParamsLength); + filter.MessageEnd(); + } +} + +bool PK_DeterministicSignatureMessageEncodingMethod::VerifyMessageRepresentative( + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const +{ + SecByteBlock computedRepresentative(BitsToBytes(representativeBitLength)); + ComputeMessageRepresentative(NullRNG(), NULL, 0, hash, hashIdentifier, messageEmpty, computedRepresentative, representativeBitLength); + return VerifyBufsEqual(representative, computedRepresentative, computedRepresentative.size()); +} + +bool PK_RecoverableSignatureMessageEncodingMethod::VerifyMessageRepresentative( + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const +{ + SecByteBlock recoveredMessage(MaxRecoverableLength(representativeBitLength, hashIdentifier.second, hash.DigestSize())); + DecodingResult result = RecoverMessageFromRepresentative( + hash, hashIdentifier, messageEmpty, representative, representativeBitLength, recoveredMessage); + return result.isValidCoding && result.messageLength == 0; +} + +void TF_SignerBase::InputRecoverableMessage(PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, size_t recoverableMessageLength) const +{ + PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); + HashIdentifier id = GetHashIdentifier(); + const MessageEncodingInterface &encoding = GetMessageEncodingInterface(); + + if (MessageRepresentativeBitLength() < encoding.MinRepresentativeBitLength(id.second, ma.AccessHash().DigestSize())) + throw PK_SignatureScheme::KeyTooShort(); + + size_t maxRecoverableLength = encoding.MaxRecoverableLength(MessageRepresentativeBitLength(), GetHashIdentifier().second, ma.AccessHash().DigestSize()); + + if (maxRecoverableLength == 0) + {throw NotImplemented("TF_SignerBase: this algorithm does not support messsage recovery or the key is too short");} + if (recoverableMessageLength > maxRecoverableLength) + throw InvalidArgument("TF_SignerBase: the recoverable message part is too long for the given key and algorithm"); + + ma.m_recoverableMessage.Assign(recoverableMessage, recoverableMessageLength); + encoding.ProcessRecoverableMessage( + ma.AccessHash(), + recoverableMessage, recoverableMessageLength, + NULL, 0, ma.m_semisignature); +} + +size_t TF_SignerBase::SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart) const +{ + PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); + HashIdentifier id = GetHashIdentifier(); + const MessageEncodingInterface &encoding = GetMessageEncodingInterface(); + + if (MessageRepresentativeBitLength() < encoding.MinRepresentativeBitLength(id.second, ma.AccessHash().DigestSize())) + throw PK_SignatureScheme::KeyTooShort(); + + SecByteBlock representative(MessageRepresentativeLength()); + encoding.ComputeMessageRepresentative(rng, + ma.m_recoverableMessage, ma.m_recoverableMessage.size(), + ma.AccessHash(), id, ma.m_empty, + representative, MessageRepresentativeBitLength()); + ma.m_empty = true; + + Integer r(representative, representative.size()); + size_t signatureLength = SignatureLength(); + GetTrapdoorFunctionInterface().CalculateRandomizedInverse(rng, r).Encode(signature, signatureLength); + return signatureLength; +} + +void TF_VerifierBase::InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const +{ + PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); + HashIdentifier id = GetHashIdentifier(); + const MessageEncodingInterface &encoding = GetMessageEncodingInterface(); + + if (MessageRepresentativeBitLength() < encoding.MinRepresentativeBitLength(id.second, ma.AccessHash().DigestSize())) + throw PK_SignatureScheme::KeyTooShort(); + + ma.m_representative.New(MessageRepresentativeLength()); + Integer x = GetTrapdoorFunctionInterface().ApplyFunction(Integer(signature, signatureLength)); + if (x.BitCount() > MessageRepresentativeBitLength()) + x = Integer::Zero(); // don't return false here to prevent timing attack + x.Encode(ma.m_representative, ma.m_representative.size()); +} + +bool TF_VerifierBase::VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const +{ + PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); + HashIdentifier id = GetHashIdentifier(); + const MessageEncodingInterface &encoding = GetMessageEncodingInterface(); + + if (MessageRepresentativeBitLength() < encoding.MinRepresentativeBitLength(id.second, ma.AccessHash().DigestSize())) + throw PK_SignatureScheme::KeyTooShort(); + + bool result = encoding.VerifyMessageRepresentative( + ma.AccessHash(), id, ma.m_empty, ma.m_representative, MessageRepresentativeBitLength()); + ma.m_empty = true; + return result; +} + +DecodingResult TF_VerifierBase::RecoverAndRestart(byte *recoveredMessage, PK_MessageAccumulator &messageAccumulator) const +{ + PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); + HashIdentifier id = GetHashIdentifier(); + const MessageEncodingInterface &encoding = GetMessageEncodingInterface(); + + if (MessageRepresentativeBitLength() < encoding.MinRepresentativeBitLength(id.second, ma.AccessHash().DigestSize())) + throw PK_SignatureScheme::KeyTooShort(); + + DecodingResult result = encoding.RecoverMessageFromRepresentative( + ma.AccessHash(), id, ma.m_empty, ma.m_representative, MessageRepresentativeBitLength(), recoveredMessage); + ma.m_empty = true; + return result; +} + +DecodingResult TF_DecryptorBase::Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs ¶meters) const +{ + SecByteBlock paddedBlock(PaddedBlockByteLength()); + Integer x = GetTrapdoorFunctionInterface().CalculateInverse(rng, Integer(ciphertext, FixedCiphertextLength())); + if (x.ByteCount() > paddedBlock.size()) + x = Integer::Zero(); // don't return false here to prevent timing attack + x.Encode(paddedBlock, paddedBlock.size()); + return GetMessageEncodingInterface().Unpad(paddedBlock, PaddedBlockBitLength(), plaintext, parameters); +} + +void TF_EncryptorBase::Encrypt(RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs ¶meters) const +{ + if (plaintextLength > FixedMaxPlaintextLength()) + { + if (FixedMaxPlaintextLength() < 1) + throw InvalidArgument(AlgorithmName() + ": this key is too short to encrypt any messages"); + else + throw InvalidArgument(AlgorithmName() + ": message length of " + IntToString(plaintextLength) + " exceeds the maximum of " + IntToString(FixedMaxPlaintextLength()) + " for this public key"); + } + + SecByteBlock paddedBlock(PaddedBlockByteLength()); + GetMessageEncodingInterface().Pad(rng, plaintext, plaintextLength, paddedBlock, PaddedBlockBitLength(), parameters); + GetTrapdoorFunctionInterface().ApplyRandomizedFunction(rng, Integer(paddedBlock, paddedBlock.size())).Encode(ciphertext, FixedCiphertextLength()); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/pubkey.h b/cryptopp/pubkey.h new file mode 100644 index 0000000..c529fcd --- /dev/null +++ b/cryptopp/pubkey.h @@ -0,0 +1,1682 @@ +// pubkey.h - written and placed in the public domain by Wei Dai + +#ifndef CRYPTOPP_PUBKEY_H +#define CRYPTOPP_PUBKEY_H + +/** \file + + This file contains helper classes/functions for implementing public key algorithms. + + The class hierachies in this .h file tend to look like this: +

+                  x1
+                 / \
+                y1  z1
+                 |  |
+            x2  x2
+                 |  |
+                y2  z2
+                 |  |
+            x3  x3
+                 |  |
+                y3  z3
+
+ - x1, y1, z1 are abstract interface classes defined in cryptlib.h + - x2, y2, z2 are implementations of the interfaces using "abstract policies", which + are pure virtual functions that should return interfaces to interchangeable algorithms. + These classes have "Base" suffixes. + - x3, y3, z3 hold actual algorithms and implement those virtual functions. + These classes have "Impl" suffixes. + + The "TF_" prefix means an implementation using trapdoor functions on integers. + The "DL_" prefix means an implementation using group operations (in groups where discrete log is hard). +*/ + +#include "modarith.h" +#include "filters.h" +#include "eprecomp.h" +#include "fips140.h" +#include "argnames.h" +#include + +// VC60 workaround: this macro is defined in shlobj.h and conflicts with a template parameter used in this file +#undef INTERFACE + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunctionBounds +{ +public: + virtual ~TrapdoorFunctionBounds() {} + + virtual Integer PreimageBound() const =0; + virtual Integer ImageBound() const =0; + virtual Integer MaxPreimage() const {return --PreimageBound();} + virtual Integer MaxImage() const {return --ImageBound();} +}; + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomizedTrapdoorFunction : public TrapdoorFunctionBounds +{ +public: + virtual Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const =0; + virtual bool IsRandomized() const {return true;} +}; + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunction : public RandomizedTrapdoorFunction +{ +public: + Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const + {return ApplyFunction(x);} + bool IsRandomized() const {return false;} + + virtual Integer ApplyFunction(const Integer &x) const =0; +}; + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomizedTrapdoorFunctionInverse +{ +public: + virtual ~RandomizedTrapdoorFunctionInverse() {} + + virtual Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const =0; + virtual bool IsRandomized() const {return true;} +}; + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunctionInverse : public RandomizedTrapdoorFunctionInverse +{ +public: + virtual ~TrapdoorFunctionInverse() {} + + Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const + {return CalculateInverse(rng, x);} + bool IsRandomized() const {return false;} + + virtual Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const =0; +}; + +// ******************************************************** + +//! message encoding method for public key encryption +class CRYPTOPP_NO_VTABLE PK_EncryptionMessageEncodingMethod +{ +public: + virtual ~PK_EncryptionMessageEncodingMethod() {} + + virtual bool ParameterSupported(const char *name) const {return false;} + + //! max size of unpadded message in bytes, given max size of padded message in bits (1 less than size of modulus) + virtual size_t MaxUnpaddedLength(size_t paddedLength) const =0; + + virtual void Pad(RandomNumberGenerator &rng, const byte *raw, size_t inputLength, byte *padded, size_t paddedBitLength, const NameValuePairs ¶meters) const =0; + + virtual DecodingResult Unpad(const byte *padded, size_t paddedBitLength, byte *raw, const NameValuePairs ¶meters) const =0; +}; + +// ******************************************************** + +//! _ +template +class CRYPTOPP_NO_VTABLE TF_Base +{ +protected: + virtual const TrapdoorFunctionBounds & GetTrapdoorFunctionBounds() const =0; + + typedef TFI TrapdoorFunctionInterface; + virtual const TrapdoorFunctionInterface & GetTrapdoorFunctionInterface() const =0; + + typedef MEI MessageEncodingInterface; + virtual const MessageEncodingInterface & GetMessageEncodingInterface() const =0; +}; + +// ******************************************************** + +//! _ +template +class CRYPTOPP_NO_VTABLE PK_FixedLengthCryptoSystemImpl : public BASE +{ +public: + size_t MaxPlaintextLength(size_t ciphertextLength) const + {return ciphertextLength == FixedCiphertextLength() ? FixedMaxPlaintextLength() : 0;} + size_t CiphertextLength(size_t plaintextLength) const + {return plaintextLength <= FixedMaxPlaintextLength() ? FixedCiphertextLength() : 0;} + + virtual size_t FixedMaxPlaintextLength() const =0; + virtual size_t FixedCiphertextLength() const =0; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE TF_CryptoSystemBase : public PK_FixedLengthCryptoSystemImpl, protected BASE +{ +public: + bool ParameterSupported(const char *name) const {return this->GetMessageEncodingInterface().ParameterSupported(name);} + size_t FixedMaxPlaintextLength() const {return this->GetMessageEncodingInterface().MaxUnpaddedLength(PaddedBlockBitLength());} + size_t FixedCiphertextLength() const {return this->GetTrapdoorFunctionBounds().MaxImage().ByteCount();} + +protected: + size_t PaddedBlockByteLength() const {return BitsToBytes(PaddedBlockBitLength());} + size_t PaddedBlockBitLength() const {return this->GetTrapdoorFunctionBounds().PreimageBound().BitCount()-1;} +}; + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_DecryptorBase : public TF_CryptoSystemBase > +{ +public: + DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs ¶meters = g_nullNameValuePairs) const; +}; + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_EncryptorBase : public TF_CryptoSystemBase > +{ +public: + void Encrypt(RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs ¶meters = g_nullNameValuePairs) const; +}; + +// ******************************************************** + +typedef std::pair HashIdentifier; + +//! interface for message encoding method for public key signature schemes +class CRYPTOPP_NO_VTABLE PK_SignatureMessageEncodingMethod +{ +public: + virtual ~PK_SignatureMessageEncodingMethod() {} + + virtual size_t MinRepresentativeBitLength(size_t hashIdentifierLength, size_t digestLength) const + {return 0;} + virtual size_t MaxRecoverableLength(size_t representativeBitLength, size_t hashIdentifierLength, size_t digestLength) const + {return 0;} + + bool IsProbabilistic() const + {return true;} + bool AllowNonrecoverablePart() const + {throw NotImplemented("PK_MessageEncodingMethod: this signature scheme does not support message recovery");} + virtual bool RecoverablePartFirst() const + {throw NotImplemented("PK_MessageEncodingMethod: this signature scheme does not support message recovery");} + + // for verification, DL + virtual void ProcessSemisignature(HashTransformation &hash, const byte *semisignature, size_t semisignatureLength) const {} + + // for signature + virtual void ProcessRecoverableMessage(HashTransformation &hash, + const byte *recoverableMessage, size_t recoverableMessageLength, + const byte *presignature, size_t presignatureLength, + SecByteBlock &semisignature) const + { + if (RecoverablePartFirst()) + assert(!"ProcessRecoverableMessage() not implemented"); + } + + virtual void ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const =0; + + virtual bool VerifyMessageRepresentative( + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const =0; + + virtual DecodingResult RecoverMessageFromRepresentative( // for TF + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength, + byte *recoveredMessage) const + {throw NotImplemented("PK_MessageEncodingMethod: this signature scheme does not support message recovery");} + + virtual DecodingResult RecoverMessageFromSemisignature( // for DL + HashTransformation &hash, HashIdentifier hashIdentifier, + const byte *presignature, size_t presignatureLength, + const byte *semisignature, size_t semisignatureLength, + byte *recoveredMessage) const + {throw NotImplemented("PK_MessageEncodingMethod: this signature scheme does not support message recovery");} + + // VC60 workaround + struct HashIdentifierLookup + { + template struct HashIdentifierLookup2 + { + static HashIdentifier CRYPTOPP_API Lookup() + { +#if (_MSC_VER < 1600) + return HashIdentifier(NULL, 0); +#else + return HashIdentifier((const byte*)NULL, 0); +#endif + } + }; + }; +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_DeterministicSignatureMessageEncodingMethod : public PK_SignatureMessageEncodingMethod +{ +public: + bool VerifyMessageRepresentative( + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const; +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_RecoverableSignatureMessageEncodingMethod : public PK_SignatureMessageEncodingMethod +{ +public: + bool VerifyMessageRepresentative( + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const; +}; + +class CRYPTOPP_DLL DL_SignatureMessageEncodingMethod_DSA : public PK_DeterministicSignatureMessageEncodingMethod +{ +public: + void ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const; +}; + +class CRYPTOPP_DLL DL_SignatureMessageEncodingMethod_NR : public PK_DeterministicSignatureMessageEncodingMethod +{ +public: + void ComputeMessageRepresentative(RandomNumberGenerator &rng, + const byte *recoverableMessage, size_t recoverableMessageLength, + HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, + byte *representative, size_t representativeBitLength) const; +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_MessageAccumulatorBase : public PK_MessageAccumulator +{ +public: + PK_MessageAccumulatorBase() : m_empty(true) {} + + virtual HashTransformation & AccessHash() =0; + + void Update(const byte *input, size_t length) + { + AccessHash().Update(input, length); + m_empty = m_empty && length == 0; + } + + SecByteBlock m_recoverableMessage, m_representative, m_presignature, m_semisignature; + Integer m_k, m_s; + bool m_empty; +}; + +template +class PK_MessageAccumulatorImpl : public PK_MessageAccumulatorBase, protected ObjectHolder +{ +public: + HashTransformation & AccessHash() {return this->m_object;} +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE TF_SignatureSchemeBase : public INTERFACE, protected BASE +{ +public: + size_t SignatureLength() const + {return this->GetTrapdoorFunctionBounds().MaxPreimage().ByteCount();} + size_t MaxRecoverableLength() const + {return this->GetMessageEncodingInterface().MaxRecoverableLength(MessageRepresentativeBitLength(), GetHashIdentifier().second, GetDigestSize());} + size_t MaxRecoverableLengthFromSignatureLength(size_t signatureLength) const + {return this->MaxRecoverableLength();} + + bool IsProbabilistic() const + {return this->GetTrapdoorFunctionInterface().IsRandomized() || this->GetMessageEncodingInterface().IsProbabilistic();} + bool AllowNonrecoverablePart() const + {return this->GetMessageEncodingInterface().AllowNonrecoverablePart();} + bool RecoverablePartFirst() const + {return this->GetMessageEncodingInterface().RecoverablePartFirst();} + +protected: + size_t MessageRepresentativeLength() const {return BitsToBytes(MessageRepresentativeBitLength());} + size_t MessageRepresentativeBitLength() const {return this->GetTrapdoorFunctionBounds().ImageBound().BitCount()-1;} + virtual HashIdentifier GetHashIdentifier() const =0; + virtual size_t GetDigestSize() const =0; +}; + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_SignerBase : public TF_SignatureSchemeBase > +{ +public: + void InputRecoverableMessage(PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, size_t recoverableMessageLength) const; + size_t SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart=true) const; +}; + +//! _ +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_VerifierBase : public TF_SignatureSchemeBase > +{ +public: + void InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const; + bool VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const; + DecodingResult RecoverAndRestart(byte *recoveredMessage, PK_MessageAccumulator &recoveryAccumulator) const; +}; + +// ******************************************************** + +//! _ +template +struct TF_CryptoSchemeOptions +{ + typedef T1 AlgorithmInfo; + typedef T2 Keys; + typedef typename Keys::PrivateKey PrivateKey; + typedef typename Keys::PublicKey PublicKey; + typedef T3 MessageEncodingMethod; +}; + +//! _ +template +struct TF_SignatureSchemeOptions : public TF_CryptoSchemeOptions +{ + typedef T4 HashFunction; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE TF_ObjectImplBase : public AlgorithmImpl +{ +public: + typedef SCHEME_OPTIONS SchemeOptions; + typedef KEY_CLASS KeyClass; + + PublicKey & AccessPublicKey() {return AccessKey();} + const PublicKey & GetPublicKey() const {return GetKey();} + + PrivateKey & AccessPrivateKey() {return AccessKey();} + const PrivateKey & GetPrivateKey() const {return GetKey();} + + virtual const KeyClass & GetKey() const =0; + virtual KeyClass & AccessKey() =0; + + const KeyClass & GetTrapdoorFunction() const {return GetKey();} + + PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng) const + { + return new PK_MessageAccumulatorImpl; + } + PK_MessageAccumulator * NewVerificationAccumulator() const + { + return new PK_MessageAccumulatorImpl; + } + +protected: + const typename BASE::MessageEncodingInterface & GetMessageEncodingInterface() const + {return Singleton().Ref();} + const TrapdoorFunctionBounds & GetTrapdoorFunctionBounds() const + {return GetKey();} + const typename BASE::TrapdoorFunctionInterface & GetTrapdoorFunctionInterface() const + {return GetKey();} + + // for signature scheme + HashIdentifier GetHashIdentifier() const + { + typedef CPP_TYPENAME SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::template HashIdentifierLookup2 L; + return L::Lookup(); + } + size_t GetDigestSize() const + { + typedef CPP_TYPENAME SchemeOptions::HashFunction H; + return H::DIGESTSIZE; + } +}; + +//! _ +template +class TF_ObjectImplExtRef : public TF_ObjectImplBase +{ +public: + TF_ObjectImplExtRef(const KEY *pKey = NULL) : m_pKey(pKey) {} + void SetKeyPtr(const KEY *pKey) {m_pKey = pKey;} + + const KEY & GetKey() const {return *m_pKey;} + KEY & AccessKey() {throw NotImplemented("TF_ObjectImplExtRef: cannot modify refererenced key");} + +private: + const KEY * m_pKey; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE TF_ObjectImpl : public TF_ObjectImplBase +{ +public: + typedef KEY_CLASS KeyClass; + + const KeyClass & GetKey() const {return m_trapdoorFunction;} + KeyClass & AccessKey() {return m_trapdoorFunction;} + +private: + KeyClass m_trapdoorFunction; +}; + +//! _ +template +class TF_DecryptorImpl : public TF_ObjectImpl +{ +}; + +//! _ +template +class TF_EncryptorImpl : public TF_ObjectImpl +{ +}; + +//! _ +template +class TF_SignerImpl : public TF_ObjectImpl +{ +}; + +//! _ +template +class TF_VerifierImpl : public TF_ObjectImpl +{ +}; + +// ******************************************************** + +//! _ +class CRYPTOPP_NO_VTABLE MaskGeneratingFunction +{ +public: + virtual ~MaskGeneratingFunction() {} + virtual void GenerateAndMask(HashTransformation &hash, byte *output, size_t outputLength, const byte *input, size_t inputLength, bool mask = true) const =0; +}; + +CRYPTOPP_DLL void CRYPTOPP_API P1363_MGF1KDF2_Common(HashTransformation &hash, byte *output, size_t outputLength, const byte *input, size_t inputLength, const byte *derivationParams, size_t derivationParamsLength, bool mask, unsigned int counterStart); + +//! _ +class P1363_MGF1 : public MaskGeneratingFunction +{ +public: + static const char * CRYPTOPP_API StaticAlgorithmName() {return "MGF1";} + void GenerateAndMask(HashTransformation &hash, byte *output, size_t outputLength, const byte *input, size_t inputLength, bool mask = true) const + { + P1363_MGF1KDF2_Common(hash, output, outputLength, input, inputLength, NULL, 0, mask, 0); + } +}; + +// ******************************************************** + +//! _ +template +class P1363_KDF2 +{ +public: + static void CRYPTOPP_API DeriveKey(byte *output, size_t outputLength, const byte *input, size_t inputLength, const byte *derivationParams, size_t derivationParamsLength) + { + H h; + P1363_MGF1KDF2_Common(h, output, outputLength, input, inputLength, derivationParams, derivationParamsLength, false, 1); + } +}; + +// ******************************************************** + +//! to be thrown by DecodeElement and AgreeWithStaticPrivateKey +class DL_BadElement : public InvalidDataFormat +{ +public: + DL_BadElement() : InvalidDataFormat("CryptoPP: invalid group element") {} +}; + +//! interface for DL group parameters +template +class CRYPTOPP_NO_VTABLE DL_GroupParameters : public CryptoParameters +{ + typedef DL_GroupParameters ThisClass; + +public: + typedef T Element; + + DL_GroupParameters() : m_validationLevel(0) {} + + // CryptoMaterial + bool Validate(RandomNumberGenerator &rng, unsigned int level) const + { + if (!GetBasePrecomputation().IsInitialized()) + return false; + + if (m_validationLevel > level) + return true; + + bool pass = ValidateGroup(rng, level); + pass = pass && ValidateElement(level, GetSubgroupGenerator(), &GetBasePrecomputation()); + + m_validationLevel = pass ? level+1 : 0; + + return pass; + } + + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const + { + return GetValueHelper(this, name, valueType, pValue) + CRYPTOPP_GET_FUNCTION_ENTRY(SubgroupOrder) + CRYPTOPP_GET_FUNCTION_ENTRY(SubgroupGenerator) + ; + } + + bool SupportsPrecomputation() const {return true;} + + void Precompute(unsigned int precomputationStorage=16) + { + AccessBasePrecomputation().Precompute(GetGroupPrecomputation(), GetSubgroupOrder().BitCount(), precomputationStorage); + } + + void LoadPrecomputation(BufferedTransformation &storedPrecomputation) + { + AccessBasePrecomputation().Load(GetGroupPrecomputation(), storedPrecomputation); + m_validationLevel = 0; + } + + void SavePrecomputation(BufferedTransformation &storedPrecomputation) const + { + GetBasePrecomputation().Save(GetGroupPrecomputation(), storedPrecomputation); + } + + // non-inherited + virtual const Element & GetSubgroupGenerator() const {return GetBasePrecomputation().GetBase(GetGroupPrecomputation());} + virtual void SetSubgroupGenerator(const Element &base) {AccessBasePrecomputation().SetBase(GetGroupPrecomputation(), base);} + virtual Element ExponentiateBase(const Integer &exponent) const + { + return GetBasePrecomputation().Exponentiate(GetGroupPrecomputation(), exponent); + } + virtual Element ExponentiateElement(const Element &base, const Integer &exponent) const + { + Element result; + SimultaneousExponentiate(&result, base, &exponent, 1); + return result; + } + + virtual const DL_GroupPrecomputation & GetGroupPrecomputation() const =0; + virtual const DL_FixedBasePrecomputation & GetBasePrecomputation() const =0; + virtual DL_FixedBasePrecomputation & AccessBasePrecomputation() =0; + virtual const Integer & GetSubgroupOrder() const =0; // order of subgroup generated by base element + virtual Integer GetMaxExponent() const =0; + virtual Integer GetGroupOrder() const {return GetSubgroupOrder()*GetCofactor();} // one of these two needs to be overriden + virtual Integer GetCofactor() const {return GetGroupOrder()/GetSubgroupOrder();} + virtual unsigned int GetEncodedElementSize(bool reversible) const =0; + virtual void EncodeElement(bool reversible, const Element &element, byte *encoded) const =0; + virtual Element DecodeElement(const byte *encoded, bool checkForGroupMembership) const =0; + virtual Integer ConvertElementToInteger(const Element &element) const =0; + virtual bool ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const =0; + virtual bool ValidateElement(unsigned int level, const Element &element, const DL_FixedBasePrecomputation *precomp) const =0; + virtual bool FastSubgroupCheckAvailable() const =0; + virtual bool IsIdentity(const Element &element) const =0; + virtual void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const =0; + +protected: + void ParametersChanged() {m_validationLevel = 0;} + +private: + mutable unsigned int m_validationLevel; +}; + +//! _ +template , class BASE = DL_GroupParameters > +class DL_GroupParametersImpl : public BASE +{ +public: + typedef GROUP_PRECOMP GroupPrecomputation; + typedef typename GROUP_PRECOMP::Element Element; + typedef BASE_PRECOMP BasePrecomputation; + + const DL_GroupPrecomputation & GetGroupPrecomputation() const {return m_groupPrecomputation;} + const DL_FixedBasePrecomputation & GetBasePrecomputation() const {return m_gpc;} + DL_FixedBasePrecomputation & AccessBasePrecomputation() {return m_gpc;} + +protected: + GROUP_PRECOMP m_groupPrecomputation; + BASE_PRECOMP m_gpc; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_Key +{ +public: + virtual const DL_GroupParameters & GetAbstractGroupParameters() const =0; + virtual DL_GroupParameters & AccessAbstractGroupParameters() =0; +}; + +//! interface for DL public keys +template +class CRYPTOPP_NO_VTABLE DL_PublicKey : public DL_Key +{ + typedef DL_PublicKey ThisClass; + +public: + typedef T Element; + + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const + { + return GetValueHelper(this, name, valueType, pValue, &this->GetAbstractGroupParameters()) + CRYPTOPP_GET_FUNCTION_ENTRY(PublicElement); + } + + void AssignFrom(const NameValuePairs &source); + + // non-inherited + virtual const Element & GetPublicElement() const {return GetPublicPrecomputation().GetBase(this->GetAbstractGroupParameters().GetGroupPrecomputation());} + virtual void SetPublicElement(const Element &y) {AccessPublicPrecomputation().SetBase(this->GetAbstractGroupParameters().GetGroupPrecomputation(), y);} + virtual Element ExponentiatePublicElement(const Integer &exponent) const + { + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + return GetPublicPrecomputation().Exponentiate(params.GetGroupPrecomputation(), exponent); + } + virtual Element CascadeExponentiateBaseAndPublicElement(const Integer &baseExp, const Integer &publicExp) const + { + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + return params.GetBasePrecomputation().CascadeExponentiate(params.GetGroupPrecomputation(), baseExp, GetPublicPrecomputation(), publicExp); + } + + virtual const DL_FixedBasePrecomputation & GetPublicPrecomputation() const =0; + virtual DL_FixedBasePrecomputation & AccessPublicPrecomputation() =0; +}; + +//! interface for DL private keys +template +class CRYPTOPP_NO_VTABLE DL_PrivateKey : public DL_Key +{ + typedef DL_PrivateKey ThisClass; + +public: + typedef T Element; + + void MakePublicKey(DL_PublicKey &pub) const + { + pub.AccessAbstractGroupParameters().AssignFrom(this->GetAbstractGroupParameters()); + pub.SetPublicElement(this->GetAbstractGroupParameters().ExponentiateBase(GetPrivateExponent())); + } + + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const + { + return GetValueHelper(this, name, valueType, pValue, &this->GetAbstractGroupParameters()) + CRYPTOPP_GET_FUNCTION_ENTRY(PrivateExponent); + } + + void AssignFrom(const NameValuePairs &source) + { + this->AccessAbstractGroupParameters().AssignFrom(source); + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(PrivateExponent); + } + + virtual const Integer & GetPrivateExponent() const =0; + virtual void SetPrivateExponent(const Integer &x) =0; +}; + +template +void DL_PublicKey::AssignFrom(const NameValuePairs &source) +{ + DL_PrivateKey *pPrivateKey = NULL; + if (source.GetThisPointer(pPrivateKey)) + pPrivateKey->MakePublicKey(*this); + else + { + this->AccessAbstractGroupParameters().AssignFrom(source); + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(PublicElement); + } +} + +class OID; + +//! _ +template +class DL_KeyImpl : public PK +{ +public: + typedef GP GroupParameters; + + O GetAlgorithmID() const {return GetGroupParameters().GetAlgorithmID();} +// void BERDecode(BufferedTransformation &bt) +// {PK::BERDecode(bt);} +// void DEREncode(BufferedTransformation &bt) const +// {PK::DEREncode(bt);} + bool BERDecodeAlgorithmParameters(BufferedTransformation &bt) + {AccessGroupParameters().BERDecode(bt); return true;} + bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const + {GetGroupParameters().DEREncode(bt); return true;} + + const GP & GetGroupParameters() const {return m_groupParameters;} + GP & AccessGroupParameters() {return m_groupParameters;} + +private: + GP m_groupParameters; +}; + +class X509PublicKey; +class PKCS8PrivateKey; + +//! _ +template +class DL_PrivateKeyImpl : public DL_PrivateKey, public DL_KeyImpl +{ +public: + typedef typename GP::Element Element; + + // GeneratableCryptoMaterial + bool Validate(RandomNumberGenerator &rng, unsigned int level) const + { + bool pass = GetAbstractGroupParameters().Validate(rng, level); + + const Integer &q = GetAbstractGroupParameters().GetSubgroupOrder(); + const Integer &x = GetPrivateExponent(); + + pass = pass && x.IsPositive() && x < q; + if (level >= 1) + pass = pass && Integer::Gcd(x, q) == Integer::One(); + return pass; + } + + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const + { + return GetValueHelper >(this, name, valueType, pValue).Assignable(); + } + + void AssignFrom(const NameValuePairs &source) + { + AssignFromHelper >(this, source); + } + + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms) + { + if (!params.GetThisObject(this->AccessGroupParameters())) + this->AccessGroupParameters().GenerateRandom(rng, params); +// std::pair seed; + Integer x(rng, Integer::One(), GetAbstractGroupParameters().GetMaxExponent()); +// Integer::ANY, Integer::Zero(), Integer::One(), +// params.GetValue("DeterministicKeyGenerationSeed", seed) ? &seed : NULL); + SetPrivateExponent(x); + } + + bool SupportsPrecomputation() const {return true;} + + void Precompute(unsigned int precomputationStorage=16) + {AccessAbstractGroupParameters().Precompute(precomputationStorage);} + + void LoadPrecomputation(BufferedTransformation &storedPrecomputation) + {AccessAbstractGroupParameters().LoadPrecomputation(storedPrecomputation);} + + void SavePrecomputation(BufferedTransformation &storedPrecomputation) const + {GetAbstractGroupParameters().SavePrecomputation(storedPrecomputation);} + + // DL_Key + const DL_GroupParameters & GetAbstractGroupParameters() const {return this->GetGroupParameters();} + DL_GroupParameters & AccessAbstractGroupParameters() {return this->AccessGroupParameters();} + + // DL_PrivateKey + const Integer & GetPrivateExponent() const {return m_x;} + void SetPrivateExponent(const Integer &x) {m_x = x;} + + // PKCS8PrivateKey + void BERDecodePrivateKey(BufferedTransformation &bt, bool, size_t) + {m_x.BERDecode(bt);} + void DEREncodePrivateKey(BufferedTransformation &bt) const + {m_x.DEREncode(bt);} + +private: + Integer m_x; +}; + +//! _ +template +class DL_PrivateKey_WithSignaturePairwiseConsistencyTest : public BASE +{ +public: + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms) + { + BASE::GenerateRandom(rng, params); + + if (FIPS_140_2_ComplianceEnabled()) + { + typename SIGNATURE_SCHEME::Signer signer(*this); + typename SIGNATURE_SCHEME::Verifier verifier(signer); + SignaturePairwiseConsistencyTest_FIPS_140_Only(signer, verifier); + } + } +}; + +//! _ +template +class DL_PublicKeyImpl : public DL_PublicKey, public DL_KeyImpl +{ +public: + typedef typename GP::Element Element; + + // CryptoMaterial + bool Validate(RandomNumberGenerator &rng, unsigned int level) const + { + bool pass = GetAbstractGroupParameters().Validate(rng, level); + pass = pass && GetAbstractGroupParameters().ValidateElement(level, this->GetPublicElement(), &GetPublicPrecomputation()); + return pass; + } + + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const + { + return GetValueHelper >(this, name, valueType, pValue).Assignable(); + } + + void AssignFrom(const NameValuePairs &source) + { + AssignFromHelper >(this, source); + } + + bool SupportsPrecomputation() const {return true;} + + void Precompute(unsigned int precomputationStorage=16) + { + AccessAbstractGroupParameters().Precompute(precomputationStorage); + AccessPublicPrecomputation().Precompute(GetAbstractGroupParameters().GetGroupPrecomputation(), GetAbstractGroupParameters().GetSubgroupOrder().BitCount(), precomputationStorage); + } + + void LoadPrecomputation(BufferedTransformation &storedPrecomputation) + { + AccessAbstractGroupParameters().LoadPrecomputation(storedPrecomputation); + AccessPublicPrecomputation().Load(GetAbstractGroupParameters().GetGroupPrecomputation(), storedPrecomputation); + } + + void SavePrecomputation(BufferedTransformation &storedPrecomputation) const + { + GetAbstractGroupParameters().SavePrecomputation(storedPrecomputation); + GetPublicPrecomputation().Save(GetAbstractGroupParameters().GetGroupPrecomputation(), storedPrecomputation); + } + + // DL_Key + const DL_GroupParameters & GetAbstractGroupParameters() const {return this->GetGroupParameters();} + DL_GroupParameters & AccessAbstractGroupParameters() {return this->AccessGroupParameters();} + + // DL_PublicKey + const DL_FixedBasePrecomputation & GetPublicPrecomputation() const {return m_ypc;} + DL_FixedBasePrecomputation & AccessPublicPrecomputation() {return m_ypc;} + + // non-inherited + bool operator==(const DL_PublicKeyImpl &rhs) const + {return this->GetGroupParameters() == rhs.GetGroupParameters() && this->GetPublicElement() == rhs.GetPublicElement();} + +private: + typename GP::BasePrecomputation m_ypc; +}; + +//! interface for Elgamal-like signature algorithms +template +class CRYPTOPP_NO_VTABLE DL_ElgamalLikeSignatureAlgorithm +{ +public: + virtual void Sign(const DL_GroupParameters ¶ms, const Integer &privateKey, const Integer &k, const Integer &e, Integer &r, Integer &s) const =0; + virtual bool Verify(const DL_GroupParameters ¶ms, const DL_PublicKey &publicKey, const Integer &e, const Integer &r, const Integer &s) const =0; + virtual Integer RecoverPresignature(const DL_GroupParameters ¶ms, const DL_PublicKey &publicKey, const Integer &r, const Integer &s) const + {throw NotImplemented("DL_ElgamalLikeSignatureAlgorithm: this signature scheme does not support message recovery");} + virtual size_t RLen(const DL_GroupParameters ¶ms) const + {return params.GetSubgroupOrder().ByteCount();} + virtual size_t SLen(const DL_GroupParameters ¶ms) const + {return params.GetSubgroupOrder().ByteCount();} +}; + +//! interface for DL key agreement algorithms +template +class CRYPTOPP_NO_VTABLE DL_KeyAgreementAlgorithm +{ +public: + typedef T Element; + + virtual Element AgreeWithEphemeralPrivateKey(const DL_GroupParameters ¶ms, const DL_FixedBasePrecomputation &publicPrecomputation, const Integer &privateExponent) const =0; + virtual Element AgreeWithStaticPrivateKey(const DL_GroupParameters ¶ms, const Element &publicElement, bool validateOtherPublicKey, const Integer &privateExponent) const =0; +}; + +//! interface for key derivation algorithms used in DL cryptosystems +template +class CRYPTOPP_NO_VTABLE DL_KeyDerivationAlgorithm +{ +public: + virtual bool ParameterSupported(const char *name) const {return false;} + virtual void Derive(const DL_GroupParameters &groupParams, byte *derivedKey, size_t derivedLength, const T &agreedElement, const T &ephemeralPublicKey, const NameValuePairs &derivationParams) const =0; +}; + +//! interface for symmetric encryption algorithms used in DL cryptosystems +class CRYPTOPP_NO_VTABLE DL_SymmetricEncryptionAlgorithm +{ +public: + virtual bool ParameterSupported(const char *name) const {return false;} + virtual size_t GetSymmetricKeyLength(size_t plaintextLength) const =0; + virtual size_t GetSymmetricCiphertextLength(size_t plaintextLength) const =0; + virtual size_t GetMaxSymmetricPlaintextLength(size_t ciphertextLength) const =0; + virtual void SymmetricEncrypt(RandomNumberGenerator &rng, const byte *key, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs ¶meters) const =0; + virtual DecodingResult SymmetricDecrypt(const byte *key, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs ¶meters) const =0; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_Base +{ +protected: + typedef KI KeyInterface; + typedef typename KI::Element Element; + + const DL_GroupParameters & GetAbstractGroupParameters() const {return GetKeyInterface().GetAbstractGroupParameters();} + DL_GroupParameters & AccessAbstractGroupParameters() {return AccessKeyInterface().AccessAbstractGroupParameters();} + + virtual KeyInterface & AccessKeyInterface() =0; + virtual const KeyInterface & GetKeyInterface() const =0; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_SignatureSchemeBase : public INTERFACE, public DL_Base +{ +public: + size_t SignatureLength() const + { + return GetSignatureAlgorithm().RLen(this->GetAbstractGroupParameters()) + + GetSignatureAlgorithm().SLen(this->GetAbstractGroupParameters()); + } + size_t MaxRecoverableLength() const + {return GetMessageEncodingInterface().MaxRecoverableLength(0, GetHashIdentifier().second, GetDigestSize());} + size_t MaxRecoverableLengthFromSignatureLength(size_t signatureLength) const + {assert(false); return 0;} // TODO + + bool IsProbabilistic() const + {return true;} + bool AllowNonrecoverablePart() const + {return GetMessageEncodingInterface().AllowNonrecoverablePart();} + bool RecoverablePartFirst() const + {return GetMessageEncodingInterface().RecoverablePartFirst();} + +protected: + size_t MessageRepresentativeLength() const {return BitsToBytes(MessageRepresentativeBitLength());} + size_t MessageRepresentativeBitLength() const {return this->GetAbstractGroupParameters().GetSubgroupOrder().BitCount();} + + virtual const DL_ElgamalLikeSignatureAlgorithm & GetSignatureAlgorithm() const =0; + virtual const PK_SignatureMessageEncodingMethod & GetMessageEncodingInterface() const =0; + virtual HashIdentifier GetHashIdentifier() const =0; + virtual size_t GetDigestSize() const =0; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_SignerBase : public DL_SignatureSchemeBase > +{ +public: + // for validation testing + void RawSign(const Integer &k, const Integer &e, Integer &r, Integer &s) const + { + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PrivateKey &key = this->GetKeyInterface(); + + r = params.ConvertElementToInteger(params.ExponentiateBase(k)); + alg.Sign(params, key.GetPrivateExponent(), k, e, r, s); + } + + void InputRecoverableMessage(PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, size_t recoverableMessageLength) const + { + PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); + ma.m_recoverableMessage.Assign(recoverableMessage, recoverableMessageLength); + this->GetMessageEncodingInterface().ProcessRecoverableMessage(ma.AccessHash(), + recoverableMessage, recoverableMessageLength, + ma.m_presignature, ma.m_presignature.size(), + ma.m_semisignature); + } + + size_t SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart) const + { + this->GetMaterial().DoQuickSanityCheck(); + + PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PrivateKey &key = this->GetKeyInterface(); + + SecByteBlock representative(this->MessageRepresentativeLength()); + this->GetMessageEncodingInterface().ComputeMessageRepresentative( + rng, + ma.m_recoverableMessage, ma.m_recoverableMessage.size(), + ma.AccessHash(), this->GetHashIdentifier(), ma.m_empty, + representative, this->MessageRepresentativeBitLength()); + ma.m_empty = true; + Integer e(representative, representative.size()); + + // hash message digest into random number k to prevent reusing the same k on a different messages + // after virtual machine rollback + if (rng.CanIncorporateEntropy()) + rng.IncorporateEntropy(representative, representative.size()); + Integer k(rng, 1, params.GetSubgroupOrder()-1); + Integer r, s; + r = params.ConvertElementToInteger(params.ExponentiateBase(k)); + alg.Sign(params, key.GetPrivateExponent(), k, e, r, s); + + /* + Integer r, s; + if (this->MaxRecoverableLength() > 0) + r.Decode(ma.m_semisignature, ma.m_semisignature.size()); + else + r.Decode(ma.m_presignature, ma.m_presignature.size()); + alg.Sign(params, key.GetPrivateExponent(), ma.m_k, e, r, s); + */ + + size_t rLen = alg.RLen(params); + r.Encode(signature, rLen); + s.Encode(signature+rLen, alg.SLen(params)); + + if (restart) + RestartMessageAccumulator(rng, ma); + + return this->SignatureLength(); + } + +protected: + void RestartMessageAccumulator(RandomNumberGenerator &rng, PK_MessageAccumulatorBase &ma) const + { + // k needs to be generated before hashing for signature schemes with recovery + // but to defend against VM rollbacks we need to generate k after hashing. + // so this code is commented out, since no DL-based signature scheme with recovery + // has been implemented in Crypto++ anyway + /* + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + ma.m_k.Randomize(rng, 1, params.GetSubgroupOrder()-1); + ma.m_presignature.New(params.GetEncodedElementSize(false)); + params.ConvertElementToInteger(params.ExponentiateBase(ma.m_k)).Encode(ma.m_presignature, ma.m_presignature.size()); + */ + } +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_VerifierBase : public DL_SignatureSchemeBase > +{ +public: + void InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const + { + PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + + size_t rLen = alg.RLen(params); + ma.m_semisignature.Assign(signature, rLen); + ma.m_s.Decode(signature+rLen, alg.SLen(params)); + + this->GetMessageEncodingInterface().ProcessSemisignature(ma.AccessHash(), ma.m_semisignature, ma.m_semisignature.size()); + } + + bool VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const + { + this->GetMaterial().DoQuickSanityCheck(); + + PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PublicKey &key = this->GetKeyInterface(); + + SecByteBlock representative(this->MessageRepresentativeLength()); + this->GetMessageEncodingInterface().ComputeMessageRepresentative(NullRNG(), ma.m_recoverableMessage, ma.m_recoverableMessage.size(), + ma.AccessHash(), this->GetHashIdentifier(), ma.m_empty, + representative, this->MessageRepresentativeBitLength()); + ma.m_empty = true; + Integer e(representative, representative.size()); + + Integer r(ma.m_semisignature, ma.m_semisignature.size()); + return alg.Verify(params, key, e, r, ma.m_s); + } + + DecodingResult RecoverAndRestart(byte *recoveredMessage, PK_MessageAccumulator &messageAccumulator) const + { + this->GetMaterial().DoQuickSanityCheck(); + + PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PublicKey &key = this->GetKeyInterface(); + + SecByteBlock representative(this->MessageRepresentativeLength()); + this->GetMessageEncodingInterface().ComputeMessageRepresentative( + NullRNG(), + ma.m_recoverableMessage, ma.m_recoverableMessage.size(), + ma.AccessHash(), this->GetHashIdentifier(), ma.m_empty, + representative, this->MessageRepresentativeBitLength()); + ma.m_empty = true; + Integer e(representative, representative.size()); + + ma.m_presignature.New(params.GetEncodedElementSize(false)); + Integer r(ma.m_semisignature, ma.m_semisignature.size()); + alg.RecoverPresignature(params, key, r, ma.m_s).Encode(ma.m_presignature, ma.m_presignature.size()); + + return this->GetMessageEncodingInterface().RecoverMessageFromSemisignature( + ma.AccessHash(), this->GetHashIdentifier(), + ma.m_presignature, ma.m_presignature.size(), + ma.m_semisignature, ma.m_semisignature.size(), + recoveredMessage); + } +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_CryptoSystemBase : public PK, public DL_Base +{ +public: + typedef typename DL_Base::Element Element; + + size_t MaxPlaintextLength(size_t ciphertextLength) const + { + unsigned int minLen = this->GetAbstractGroupParameters().GetEncodedElementSize(true); + return ciphertextLength < minLen ? 0 : GetSymmetricEncryptionAlgorithm().GetMaxSymmetricPlaintextLength(ciphertextLength - minLen); + } + + size_t CiphertextLength(size_t plaintextLength) const + { + size_t len = GetSymmetricEncryptionAlgorithm().GetSymmetricCiphertextLength(plaintextLength); + return len == 0 ? 0 : this->GetAbstractGroupParameters().GetEncodedElementSize(true) + len; + } + + bool ParameterSupported(const char *name) const + {return GetKeyDerivationAlgorithm().ParameterSupported(name) || GetSymmetricEncryptionAlgorithm().ParameterSupported(name);} + +protected: + virtual const DL_KeyAgreementAlgorithm & GetKeyAgreementAlgorithm() const =0; + virtual const DL_KeyDerivationAlgorithm & GetKeyDerivationAlgorithm() const =0; + virtual const DL_SymmetricEncryptionAlgorithm & GetSymmetricEncryptionAlgorithm() const =0; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_DecryptorBase : public DL_CryptoSystemBase > +{ +public: + typedef T Element; + + DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs ¶meters = g_nullNameValuePairs) const + { + try + { + const DL_KeyAgreementAlgorithm &agreeAlg = this->GetKeyAgreementAlgorithm(); + const DL_KeyDerivationAlgorithm &derivAlg = this->GetKeyDerivationAlgorithm(); + const DL_SymmetricEncryptionAlgorithm &encAlg = this->GetSymmetricEncryptionAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PrivateKey &key = this->GetKeyInterface(); + + Element q = params.DecodeElement(ciphertext, true); + size_t elementSize = params.GetEncodedElementSize(true); + ciphertext += elementSize; + ciphertextLength -= elementSize; + + Element z = agreeAlg.AgreeWithStaticPrivateKey(params, q, true, key.GetPrivateExponent()); + + SecByteBlock derivedKey(encAlg.GetSymmetricKeyLength(encAlg.GetMaxSymmetricPlaintextLength(ciphertextLength))); + derivAlg.Derive(params, derivedKey, derivedKey.size(), z, q, parameters); + + return encAlg.SymmetricDecrypt(derivedKey, ciphertext, ciphertextLength, plaintext, parameters); + } + catch (DL_BadElement &) + { + return DecodingResult(); + } + } +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_EncryptorBase : public DL_CryptoSystemBase > +{ +public: + typedef T Element; + + void Encrypt(RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs ¶meters = g_nullNameValuePairs) const + { + const DL_KeyAgreementAlgorithm &agreeAlg = this->GetKeyAgreementAlgorithm(); + const DL_KeyDerivationAlgorithm &derivAlg = this->GetKeyDerivationAlgorithm(); + const DL_SymmetricEncryptionAlgorithm &encAlg = this->GetSymmetricEncryptionAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PublicKey &key = this->GetKeyInterface(); + + Integer x(rng, Integer::One(), params.GetMaxExponent()); + Element q = params.ExponentiateBase(x); + params.EncodeElement(true, q, ciphertext); + unsigned int elementSize = params.GetEncodedElementSize(true); + ciphertext += elementSize; + + Element z = agreeAlg.AgreeWithEphemeralPrivateKey(params, key.GetPublicPrecomputation(), x); + + SecByteBlock derivedKey(encAlg.GetSymmetricKeyLength(plaintextLength)); + derivAlg.Derive(params, derivedKey, derivedKey.size(), z, q, parameters); + + encAlg.SymmetricEncrypt(rng, derivedKey, plaintext, plaintextLength, ciphertext, parameters); + } +}; + +//! _ +template +struct DL_SchemeOptionsBase +{ + typedef T1 AlgorithmInfo; + typedef T2 GroupParameters; + typedef typename GroupParameters::Element Element; +}; + +//! _ +template +struct DL_KeyedSchemeOptions : public DL_SchemeOptionsBase +{ + typedef T2 Keys; + typedef typename Keys::PrivateKey PrivateKey; + typedef typename Keys::PublicKey PublicKey; +}; + +//! _ +template +struct DL_SignatureSchemeOptions : public DL_KeyedSchemeOptions +{ + typedef T3 SignatureAlgorithm; + typedef T4 MessageEncodingMethod; + typedef T5 HashFunction; +}; + +//! _ +template +struct DL_CryptoSchemeOptions : public DL_KeyedSchemeOptions +{ + typedef T3 KeyAgreementAlgorithm; + typedef T4 KeyDerivationAlgorithm; + typedef T5 SymmetricEncryptionAlgorithm; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_ObjectImplBase : public AlgorithmImpl +{ +public: + typedef SCHEME_OPTIONS SchemeOptions; + typedef typename KEY::Element Element; + + PrivateKey & AccessPrivateKey() {return m_key;} + PublicKey & AccessPublicKey() {return m_key;} + + // KeyAccessor + const KEY & GetKey() const {return m_key;} + KEY & AccessKey() {return m_key;} + +protected: + typename BASE::KeyInterface & AccessKeyInterface() {return m_key;} + const typename BASE::KeyInterface & GetKeyInterface() const {return m_key;} + + // for signature scheme + HashIdentifier GetHashIdentifier() const + { + typedef typename SchemeOptions::MessageEncodingMethod::HashIdentifierLookup HashLookup; + return HashLookup::template HashIdentifierLookup2::Lookup(); + } + size_t GetDigestSize() const + { + typedef CPP_TYPENAME SchemeOptions::HashFunction H; + return H::DIGESTSIZE; + } + +private: + KEY m_key; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_ObjectImpl : public DL_ObjectImplBase +{ +public: + typedef typename KEY::Element Element; + +protected: + const DL_ElgamalLikeSignatureAlgorithm & GetSignatureAlgorithm() const + {return Singleton().Ref();} + const DL_KeyAgreementAlgorithm & GetKeyAgreementAlgorithm() const + {return Singleton().Ref();} + const DL_KeyDerivationAlgorithm & GetKeyDerivationAlgorithm() const + {return Singleton().Ref();} + const DL_SymmetricEncryptionAlgorithm & GetSymmetricEncryptionAlgorithm() const + {return Singleton().Ref();} + HashIdentifier GetHashIdentifier() const + {return HashIdentifier();} + const PK_SignatureMessageEncodingMethod & GetMessageEncodingInterface() const + {return Singleton().Ref();} +}; + +//! _ +template +class DL_SignerImpl : public DL_ObjectImpl, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PrivateKey> +{ +public: + PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng) const + { + std::auto_ptr p(new PK_MessageAccumulatorImpl); + this->RestartMessageAccumulator(rng, *p); + return p.release(); + } +}; + +//! _ +template +class DL_VerifierImpl : public DL_ObjectImpl, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PublicKey> +{ +public: + PK_MessageAccumulator * NewVerificationAccumulator() const + { + return new PK_MessageAccumulatorImpl; + } +}; + +//! _ +template +class DL_EncryptorImpl : public DL_ObjectImpl, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PublicKey> +{ +}; + +//! _ +template +class DL_DecryptorImpl : public DL_ObjectImpl, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PrivateKey> +{ +}; + +// ******************************************************** + +//! _ +template +class CRYPTOPP_NO_VTABLE DL_SimpleKeyAgreementDomainBase : public SimpleKeyAgreementDomain +{ +public: + typedef T Element; + + CryptoParameters & AccessCryptoParameters() {return AccessAbstractGroupParameters();} + unsigned int AgreedValueLength() const {return GetAbstractGroupParameters().GetEncodedElementSize(false);} + unsigned int PrivateKeyLength() const {return GetAbstractGroupParameters().GetSubgroupOrder().ByteCount();} + unsigned int PublicKeyLength() const {return GetAbstractGroupParameters().GetEncodedElementSize(true);} + + void GeneratePrivateKey(RandomNumberGenerator &rng, byte *privateKey) const + { + Integer x(rng, Integer::One(), GetAbstractGroupParameters().GetMaxExponent()); + x.Encode(privateKey, PrivateKeyLength()); + } + + void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const + { + const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); + Integer x(privateKey, PrivateKeyLength()); + Element y = params.ExponentiateBase(x); + params.EncodeElement(true, y, publicKey); + } + + bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const + { + try + { + const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); + Integer x(privateKey, PrivateKeyLength()); + Element w = params.DecodeElement(otherPublicKey, validateOtherPublicKey); + + Element z = GetKeyAgreementAlgorithm().AgreeWithStaticPrivateKey( + GetAbstractGroupParameters(), w, validateOtherPublicKey, x); + params.EncodeElement(false, z, agreedValue); + } + catch (DL_BadElement &) + { + return false; + } + return true; + } + + const Element &GetGenerator() const {return GetAbstractGroupParameters().GetSubgroupGenerator();} + +protected: + virtual const DL_KeyAgreementAlgorithm & GetKeyAgreementAlgorithm() const =0; + virtual DL_GroupParameters & AccessAbstractGroupParameters() =0; + const DL_GroupParameters & GetAbstractGroupParameters() const {return const_cast *>(this)->AccessAbstractGroupParameters();} +}; + +enum CofactorMultiplicationOption {NO_COFACTOR_MULTIPLICTION, COMPATIBLE_COFACTOR_MULTIPLICTION, INCOMPATIBLE_COFACTOR_MULTIPLICTION}; +typedef EnumToType NoCofactorMultiplication; +typedef EnumToType CompatibleCofactorMultiplication; +typedef EnumToType IncompatibleCofactorMultiplication; + +//! DH key agreement algorithm +template +class DL_KeyAgreementAlgorithm_DH : public DL_KeyAgreementAlgorithm +{ +public: + typedef ELEMENT Element; + + static const char * CRYPTOPP_API StaticAlgorithmName() + {return COFACTOR_OPTION::ToEnum() == INCOMPATIBLE_COFACTOR_MULTIPLICTION ? "DHC" : "DH";} + + Element AgreeWithEphemeralPrivateKey(const DL_GroupParameters ¶ms, const DL_FixedBasePrecomputation &publicPrecomputation, const Integer &privateExponent) const + { + return publicPrecomputation.Exponentiate(params.GetGroupPrecomputation(), + COFACTOR_OPTION::ToEnum() == INCOMPATIBLE_COFACTOR_MULTIPLICTION ? privateExponent*params.GetCofactor() : privateExponent); + } + + Element AgreeWithStaticPrivateKey(const DL_GroupParameters ¶ms, const Element &publicElement, bool validateOtherPublicKey, const Integer &privateExponent) const + { + if (COFACTOR_OPTION::ToEnum() == COMPATIBLE_COFACTOR_MULTIPLICTION) + { + const Integer &k = params.GetCofactor(); + return params.ExponentiateElement(publicElement, + ModularArithmetic(params.GetSubgroupOrder()).Divide(privateExponent, k)*k); + } + else if (COFACTOR_OPTION::ToEnum() == INCOMPATIBLE_COFACTOR_MULTIPLICTION) + return params.ExponentiateElement(publicElement, privateExponent*params.GetCofactor()); + else + { + assert(COFACTOR_OPTION::ToEnum() == NO_COFACTOR_MULTIPLICTION); + + if (!validateOtherPublicKey) + return params.ExponentiateElement(publicElement, privateExponent); + + if (params.FastSubgroupCheckAvailable()) + { + if (!params.ValidateElement(2, publicElement, NULL)) + throw DL_BadElement(); + return params.ExponentiateElement(publicElement, privateExponent); + } + else + { + const Integer e[2] = {params.GetSubgroupOrder(), privateExponent}; + Element r[2]; + params.SimultaneousExponentiate(r, publicElement, e, 2); + if (!params.IsIdentity(r[0])) + throw DL_BadElement(); + return r[1]; + } + } + } +}; + +// ******************************************************** + +//! A template implementing constructors for public key algorithm classes +template +class CRYPTOPP_NO_VTABLE PK_FinalTemplate : public BASE +{ +public: + PK_FinalTemplate() {} + + PK_FinalTemplate(const CryptoMaterial &key) + {this->AccessKey().AssignFrom(key);} + + PK_FinalTemplate(BufferedTransformation &bt) + {this->AccessKey().BERDecode(bt);} + + PK_FinalTemplate(const AsymmetricAlgorithm &algorithm) + {this->AccessKey().AssignFrom(algorithm.GetMaterial());} + + PK_FinalTemplate(const Integer &v1) + {this->AccessKey().Initialize(v1);} + +#if (defined(_MSC_VER) && _MSC_VER < 1300) + + template + PK_FinalTemplate(T1 &v1, T2 &v2) + {this->AccessKey().Initialize(v1, v2);} + + template + PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3) + {this->AccessKey().Initialize(v1, v2, v3);} + + template + PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4) + {this->AccessKey().Initialize(v1, v2, v3, v4);} + + template + PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5);} + + template + PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5, T6 &v6) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6);} + + template + PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5, T6 &v6, T7 &v7) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);} + + template + PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5, T6 &v6, T7 &v7, T8 &v8) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);} + +#else + + template + PK_FinalTemplate(const T1 &v1, const T2 &v2) + {this->AccessKey().Initialize(v1, v2);} + + template + PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3) + {this->AccessKey().Initialize(v1, v2, v3);} + + template + PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4) + {this->AccessKey().Initialize(v1, v2, v3, v4);} + + template + PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5);} + + template + PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6);} + + template + PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);} + + template + PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);} + + template + PK_FinalTemplate(T1 &v1, const T2 &v2) + {this->AccessKey().Initialize(v1, v2);} + + template + PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3) + {this->AccessKey().Initialize(v1, v2, v3);} + + template + PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4) + {this->AccessKey().Initialize(v1, v2, v3, v4);} + + template + PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5);} + + template + PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6);} + + template + PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);} + + template + PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8) + {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);} + +#endif +}; + +//! Base class for public key encryption standard classes. These classes are used to select from variants of algorithms. Note that not all standards apply to all algorithms. +struct EncryptionStandard {}; + +//! Base class for public key signature standard classes. These classes are used to select from variants of algorithms. Note that not all standards apply to all algorithms. +struct SignatureStandard {}; + +template +class TF_ES; + +//! Trapdoor Function Based Encryption Scheme +template > +class TF_ES : public KEYS +{ + typedef typename STANDARD::EncryptionMessageEncodingMethod MessageEncodingMethod; + +public: + //! see EncryptionStandard for a list of standards + typedef STANDARD Standard; + typedef TF_CryptoSchemeOptions SchemeOptions; + + static std::string CRYPTOPP_API StaticAlgorithmName() {return std::string(KEYS::StaticAlgorithmName()) + "/" + MessageEncodingMethod::StaticAlgorithmName();} + + //! implements PK_Decryptor interface + typedef PK_FinalTemplate > Decryptor; + //! implements PK_Encryptor interface + typedef PK_FinalTemplate > Encryptor; +}; + +template // VC60 workaround: doesn't work if KEYS is first parameter +class TF_SS; + +//! Trapdoor Function Based Signature Scheme +template > // VC60 workaround: doesn't work if KEYS is first parameter +class TF_SS : public KEYS +{ +public: + //! see SignatureStandard for a list of standards + typedef STANDARD Standard; + typedef typename Standard::SignatureMessageEncodingMethod MessageEncodingMethod; + typedef TF_SignatureSchemeOptions SchemeOptions; + + static std::string CRYPTOPP_API StaticAlgorithmName() {return std::string(KEYS::StaticAlgorithmName()) + "/" + MessageEncodingMethod::StaticAlgorithmName() + "(" + H::StaticAlgorithmName() + ")";} + + //! implements PK_Signer interface + typedef PK_FinalTemplate > Signer; + //! implements PK_Verifier interface + typedef PK_FinalTemplate > Verifier; +}; + +template +class DL_SS; + +//! Discrete Log Based Signature Scheme +template > +class DL_SS : public KEYS +{ + typedef DL_SignatureSchemeOptions SchemeOptions; + +public: + static std::string StaticAlgorithmName() {return SA::StaticAlgorithmName() + std::string("/EMSA1(") + H::StaticAlgorithmName() + ")";} + + //! implements PK_Signer interface + typedef PK_FinalTemplate > Signer; + //! implements PK_Verifier interface + typedef PK_FinalTemplate > Verifier; +}; + +//! Discrete Log Based Encryption Scheme +template +class DL_ES : public KEYS +{ + typedef DL_CryptoSchemeOptions SchemeOptions; + +public: + //! implements PK_Decryptor interface + typedef PK_FinalTemplate > Decryptor; + //! implements PK_Encryptor interface + typedef PK_FinalTemplate > Encryptor; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/pwdbased.h b/cryptopp/pwdbased.h new file mode 100644 index 0000000..99d2c3f --- /dev/null +++ b/cryptopp/pwdbased.h @@ -0,0 +1,213 @@ +// pwdbased.h - written and placed in the public domain by Wei Dai + +#ifndef CRYPTOPP_PWDBASED_H +#define CRYPTOPP_PWDBASED_H + +#include "cryptlib.h" +#include "hmac.h" +#include "hrtimer.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! abstract base class for password based key derivation function +class PasswordBasedKeyDerivationFunction +{ +public: + virtual size_t MaxDerivedKeyLength() const =0; + virtual bool UsesPurposeByte() const =0; + //! derive key from password + /*! If timeInSeconds != 0, will iterate until time elapsed, as measured by ThreadUserTimer + Returns actual iteration count, which is equal to iterations if timeInSeconds == 0, and not less than iterations otherwise. */ + virtual unsigned int DeriveKey(byte *derived, size_t derivedLen, byte purpose, const byte *password, size_t passwordLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds=0) const =0; +}; + +//! PBKDF1 from PKCS #5, T should be a HashTransformation class +template +class PKCS5_PBKDF1 : public PasswordBasedKeyDerivationFunction +{ +public: + size_t MaxDerivedKeyLength() const {return T::DIGESTSIZE;} + bool UsesPurposeByte() const {return false;} + // PKCS #5 says PBKDF1 should only take 8-byte salts. This implementation allows salts of any length. + unsigned int DeriveKey(byte *derived, size_t derivedLen, byte purpose, const byte *password, size_t passwordLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds=0) const; +}; + +//! PBKDF2 from PKCS #5, T should be a HashTransformation class +template +class PKCS5_PBKDF2_HMAC : public PasswordBasedKeyDerivationFunction +{ +public: + size_t MaxDerivedKeyLength() const {return 0xffffffffU;} // should multiply by T::DIGESTSIZE, but gets overflow that way + bool UsesPurposeByte() const {return false;} + unsigned int DeriveKey(byte *derived, size_t derivedLen, byte purpose, const byte *password, size_t passwordLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds=0) const; +}; + +/* +class PBKDF2Params +{ +public: + SecByteBlock m_salt; + unsigned int m_interationCount; + ASNOptional > m_keyLength; +}; +*/ + +template +unsigned int PKCS5_PBKDF1::DeriveKey(byte *derived, size_t derivedLen, byte purpose, const byte *password, size_t passwordLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds) const +{ + assert(derivedLen <= MaxDerivedKeyLength()); + assert(iterations > 0 || timeInSeconds > 0); + + if (!iterations) + iterations = 1; + + T hash; + hash.Update(password, passwordLen); + hash.Update(salt, saltLen); + + SecByteBlock buffer(hash.DigestSize()); + hash.Final(buffer); + + unsigned int i; + ThreadUserTimer timer; + + if (timeInSeconds) + timer.StartTimer(); + + for (i=1; i +unsigned int PKCS5_PBKDF2_HMAC::DeriveKey(byte *derived, size_t derivedLen, byte purpose, const byte *password, size_t passwordLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds) const +{ + assert(derivedLen <= MaxDerivedKeyLength()); + assert(iterations > 0 || timeInSeconds > 0); + + if (!iterations) + iterations = 1; + + HMAC hmac(password, passwordLen); + SecByteBlock buffer(hmac.DigestSize()); + ThreadUserTimer timer; + + unsigned int i=1; + while (derivedLen > 0) + { + hmac.Update(salt, saltLen); + unsigned int j; + for (j=0; j<4; j++) + { + byte b = byte(i >> ((3-j)*8)); + hmac.Update(&b, 1); + } + hmac.Final(buffer); + + size_t segmentLen = STDMIN(derivedLen, buffer.size()); + memcpy(derived, buffer, segmentLen); + + if (timeInSeconds) + { + timeInSeconds = timeInSeconds / ((derivedLen + buffer.size() - 1) / buffer.size()); + timer.StartTimer(); + } + + for (j=1; j +class PKCS12_PBKDF : public PasswordBasedKeyDerivationFunction +{ +public: + size_t MaxDerivedKeyLength() const {return size_t(0)-1;} + bool UsesPurposeByte() const {return true;} + unsigned int DeriveKey(byte *derived, size_t derivedLen, byte purpose, const byte *password, size_t passwordLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds) const; +}; + +template +unsigned int PKCS12_PBKDF::DeriveKey(byte *derived, size_t derivedLen, byte purpose, const byte *password, size_t passwordLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds) const +{ + assert(derivedLen <= MaxDerivedKeyLength()); + assert(iterations > 0 || timeInSeconds > 0); + + if (!iterations) + iterations = 1; + + const size_t v = T::BLOCKSIZE; // v is in bytes rather than bits as in PKCS #12 + const size_t DLen = v, SLen = RoundUpToMultipleOf(saltLen, v); + const size_t PLen = RoundUpToMultipleOf(passwordLen, v), ILen = SLen + PLen; + SecByteBlock buffer(DLen + SLen + PLen); + byte *D = buffer, *S = buffer+DLen, *P = buffer+DLen+SLen, *I = S; + + memset(D, purpose, DLen); + size_t i; + for (i=0; i 0) + { + hash.CalculateDigest(Ai, buffer, buffer.size()); + + if (timeInSeconds) + { + timeInSeconds = timeInSeconds / ((derivedLen + Ai.size() - 1) / Ai.size()); + timer.StartTimer(); + } + + for (i=1; inext; current; current=current->next) + { + m_tail->next = new ByteQueueNode(*current); + m_tail = m_tail->next; + } + + m_tail->next = NULL; + + Put(copy.m_lazyString, copy.m_lazyLength); +} + +ByteQueue::~ByteQueue() +{ + Destroy(); +} + +void ByteQueue::Destroy() +{ + for (ByteQueueNode *next, *current=m_head; current; current=next) + { + next=current->next; + delete current; + } +} + +void ByteQueue::IsolatedInitialize(const NameValuePairs ¶meters) +{ + m_nodeSize = parameters.GetIntValueWithDefault("NodeSize", 256); + Clear(); +} + +lword ByteQueue::CurrentSize() const +{ + lword size=0; + + for (ByteQueueNode *current=m_head; current; current=current->next) + size += current->CurrentSize(); + + return size + m_lazyLength; +} + +bool ByteQueue::IsEmpty() const +{ + return m_head==m_tail && m_head->CurrentSize()==0 && m_lazyLength==0; +} + +void ByteQueue::Clear() +{ + for (ByteQueueNode *next, *current=m_head->next; current; current=next) + { + next=current->next; + delete current; + } + + m_tail = m_head; + m_head->Clear(); + m_head->next = NULL; + m_lazyLength = 0; +} + +size_t ByteQueue::Put2(const byte *inString, size_t length, int messageEnd, bool blocking) +{ + if (m_lazyLength > 0) + FinalizeLazyPut(); + + size_t len; + while ((len=m_tail->Put(inString, length)) < length) + { + inString += len; + length -= len; + if (m_autoNodeSize && m_nodeSize < s_maxAutoNodeSize) + do + { + m_nodeSize *= 2; + } + while (m_nodeSize < length && m_nodeSize < s_maxAutoNodeSize); + m_tail->next = new ByteQueueNode(STDMAX(m_nodeSize, length)); + m_tail = m_tail->next; + } + + return 0; +} + +void ByteQueue::CleanupUsedNodes() +{ + while (m_head != m_tail && m_head->UsedUp()) + { + ByteQueueNode *temp=m_head; + m_head=m_head->next; + delete temp; + } + + if (m_head->CurrentSize() == 0) + m_head->Clear(); +} + +void ByteQueue::LazyPut(const byte *inString, size_t size) +{ + if (m_lazyLength > 0) + FinalizeLazyPut(); + + if (inString == m_tail->buf+m_tail->m_tail) + Put(inString, size); + else + { + m_lazyString = const_cast(inString); + m_lazyLength = size; + m_lazyStringModifiable = false; + } +} + +void ByteQueue::LazyPutModifiable(byte *inString, size_t size) +{ + if (m_lazyLength > 0) + FinalizeLazyPut(); + m_lazyString = inString; + m_lazyLength = size; + m_lazyStringModifiable = true; +} + +void ByteQueue::UndoLazyPut(size_t size) +{ + if (m_lazyLength < size) + throw InvalidArgument("ByteQueue: size specified for UndoLazyPut is too large"); + + m_lazyLength -= size; +} + +void ByteQueue::FinalizeLazyPut() +{ + size_t len = m_lazyLength; + m_lazyLength = 0; + if (len) + Put(m_lazyString, len); +} + +size_t ByteQueue::Get(byte &outByte) +{ + if (m_head->Get(outByte)) + { + if (m_head->UsedUp()) + CleanupUsedNodes(); + return 1; + } + else if (m_lazyLength > 0) + { + outByte = *m_lazyString++; + m_lazyLength--; + return 1; + } + else + return 0; +} + +size_t ByteQueue::Get(byte *outString, size_t getMax) +{ + ArraySink sink(outString, getMax); + return (size_t)TransferTo(sink, getMax); +} + +size_t ByteQueue::Peek(byte &outByte) const +{ + if (m_head->Peek(outByte)) + return 1; + else if (m_lazyLength > 0) + { + outByte = *m_lazyString; + return 1; + } + else + return 0; +} + +size_t ByteQueue::Peek(byte *outString, size_t peekMax) const +{ + ArraySink sink(outString, peekMax); + return (size_t)CopyTo(sink, peekMax); +} + +size_t ByteQueue::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking) +{ + if (blocking) + { + lword bytesLeft = transferBytes; + for (ByteQueueNode *current=m_head; bytesLeft && current; current=current->next) + bytesLeft -= current->TransferTo(target, bytesLeft, channel); + CleanupUsedNodes(); + + size_t len = (size_t)STDMIN(bytesLeft, (lword)m_lazyLength); + if (len) + { + if (m_lazyStringModifiable) + target.ChannelPutModifiable(channel, m_lazyString, len); + else + target.ChannelPut(channel, m_lazyString, len); + m_lazyString += len; + m_lazyLength -= len; + bytesLeft -= len; + } + transferBytes -= bytesLeft; + return 0; + } + else + { + Walker walker(*this); + size_t blockedBytes = walker.TransferTo2(target, transferBytes, channel, blocking); + Skip(transferBytes); + return blockedBytes; + } +} + +size_t ByteQueue::CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end, const std::string &channel, bool blocking) const +{ + Walker walker(*this); + walker.Skip(begin); + lword transferBytes = end-begin; + size_t blockedBytes = walker.TransferTo2(target, transferBytes, channel, blocking); + begin += transferBytes; + return blockedBytes; +} + +void ByteQueue::Unget(byte inByte) +{ + Unget(&inByte, 1); +} + +void ByteQueue::Unget(const byte *inString, size_t length) +{ + size_t len = STDMIN(length, m_head->m_head); + length -= len; + m_head->m_head -= len; + memcpy(m_head->buf + m_head->m_head, inString + length, len); + + if (length > 0) + { + ByteQueueNode *newHead = new ByteQueueNode(length); + newHead->next = m_head; + m_head = newHead; + m_head->Put(inString, length); + } +} + +const byte * ByteQueue::Spy(size_t &contiguousSize) const +{ + contiguousSize = m_head->m_tail - m_head->m_head; + if (contiguousSize == 0 && m_lazyLength > 0) + { + contiguousSize = m_lazyLength; + return m_lazyString; + } + else + return m_head->buf + m_head->m_head; +} + +byte * ByteQueue::CreatePutSpace(size_t &size) +{ + if (m_lazyLength > 0) + FinalizeLazyPut(); + + if (m_tail->m_tail == m_tail->MaxSize()) + { + m_tail->next = new ByteQueueNode(STDMAX(m_nodeSize, size)); + m_tail = m_tail->next; + } + + size = m_tail->MaxSize() - m_tail->m_tail; + return m_tail->buf + m_tail->m_tail; +} + +ByteQueue & ByteQueue::operator=(const ByteQueue &rhs) +{ + Destroy(); + CopyFrom(rhs); + return *this; +} + +bool ByteQueue::operator==(const ByteQueue &rhs) const +{ + const lword currentSize = CurrentSize(); + + if (currentSize != rhs.CurrentSize()) + return false; + + Walker walker1(*this), walker2(rhs); + byte b1, b2; + + while (walker1.Get(b1) && walker2.Get(b2)) + if (b1 != b2) + return false; + + return true; +} + +byte ByteQueue::operator[](lword i) const +{ + for (ByteQueueNode *current=m_head; current; current=current->next) + { + if (i < current->CurrentSize()) + return (*current)[(size_t)i]; + + i -= current->CurrentSize(); + } + + assert(i < m_lazyLength); + return m_lazyString[i]; +} + +void ByteQueue::swap(ByteQueue &rhs) +{ + std::swap(m_autoNodeSize, rhs.m_autoNodeSize); + std::swap(m_nodeSize, rhs.m_nodeSize); + std::swap(m_head, rhs.m_head); + std::swap(m_tail, rhs.m_tail); + std::swap(m_lazyString, rhs.m_lazyString); + std::swap(m_lazyLength, rhs.m_lazyLength); + std::swap(m_lazyStringModifiable, rhs.m_lazyStringModifiable); +} + +// ******************************************************** + +void ByteQueue::Walker::IsolatedInitialize(const NameValuePairs ¶meters) +{ + m_node = m_queue.m_head; + m_position = 0; + m_offset = 0; + m_lazyString = m_queue.m_lazyString; + m_lazyLength = m_queue.m_lazyLength; +} + +size_t ByteQueue::Walker::Get(byte &outByte) +{ + ArraySink sink(&outByte, 1); + return (size_t)TransferTo(sink, 1); +} + +size_t ByteQueue::Walker::Get(byte *outString, size_t getMax) +{ + ArraySink sink(outString, getMax); + return (size_t)TransferTo(sink, getMax); +} + +size_t ByteQueue::Walker::Peek(byte &outByte) const +{ + ArraySink sink(&outByte, 1); + return (size_t)CopyTo(sink, 1); +} + +size_t ByteQueue::Walker::Peek(byte *outString, size_t peekMax) const +{ + ArraySink sink(outString, peekMax); + return (size_t)CopyTo(sink, peekMax); +} + +size_t ByteQueue::Walker::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking) +{ + lword bytesLeft = transferBytes; + size_t blockedBytes = 0; + + while (m_node) + { + size_t len = (size_t)STDMIN(bytesLeft, (lword)m_node->CurrentSize()-m_offset); + blockedBytes = target.ChannelPut2(channel, m_node->buf+m_node->m_head+m_offset, len, 0, blocking); + + if (blockedBytes) + goto done; + + m_position += len; + bytesLeft -= len; + + if (!bytesLeft) + { + m_offset += len; + goto done; + } + + m_node = m_node->next; + m_offset = 0; + } + + if (bytesLeft && m_lazyLength) + { + size_t len = (size_t)STDMIN(bytesLeft, (lword)m_lazyLength); + blockedBytes = target.ChannelPut2(channel, m_lazyString, len, 0, blocking); + if (blockedBytes) + goto done; + + m_lazyString += len; + m_lazyLength -= len; + bytesLeft -= len; + } + +done: + transferBytes -= bytesLeft; + return blockedBytes; +} + +size_t ByteQueue::Walker::CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end, const std::string &channel, bool blocking) const +{ + Walker walker(*this); + walker.Skip(begin); + lword transferBytes = end-begin; + size_t blockedBytes = walker.TransferTo2(target, transferBytes, channel, blocking); + begin += transferBytes; + return blockedBytes; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/queue.h b/cryptopp/queue.h new file mode 100644 index 0000000..75f7807 --- /dev/null +++ b/cryptopp/queue.h @@ -0,0 +1,143 @@ +// specification file for an unlimited queue for storing bytes + +#ifndef CRYPTOPP_QUEUE_H +#define CRYPTOPP_QUEUE_H + +#include "simple.h" +//#include + +NAMESPACE_BEGIN(CryptoPP) + +/** The queue is implemented as a linked list of byte arrays, but you don't need to + know about that. So just ignore this next line. :) */ +class ByteQueueNode; + +//! Byte Queue +class CRYPTOPP_DLL ByteQueue : public Bufferless +{ +public: + ByteQueue(size_t nodeSize=0); + ByteQueue(const ByteQueue ©); + ~ByteQueue(); + + lword MaxRetrievable() const + {return CurrentSize();} + bool AnyRetrievable() const + {return !IsEmpty();} + + void IsolatedInitialize(const NameValuePairs ¶meters); + byte * CreatePutSpace(size_t &size); + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking); + + size_t Get(byte &outByte); + size_t Get(byte *outString, size_t getMax); + + size_t Peek(byte &outByte) const; + size_t Peek(byte *outString, size_t peekMax) const; + + size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const; + + // these member functions are not inherited + void SetNodeSize(size_t nodeSize); + + lword CurrentSize() const; + bool IsEmpty() const; + + void Clear(); + + void Unget(byte inByte); + void Unget(const byte *inString, size_t length); + + const byte * Spy(size_t &contiguousSize) const; + + void LazyPut(const byte *inString, size_t size); + void LazyPutModifiable(byte *inString, size_t size); + void UndoLazyPut(size_t size); + void FinalizeLazyPut(); + + ByteQueue & operator=(const ByteQueue &rhs); + bool operator==(const ByteQueue &rhs) const; + byte operator[](lword i) const; + void swap(ByteQueue &rhs); + + class Walker : public InputRejecting + { + public: + Walker(const ByteQueue &queue) + : m_queue(queue) {Initialize();} + + lword GetCurrentPosition() {return m_position;} + + lword MaxRetrievable() const + {return m_queue.CurrentSize() - m_position;} + + void IsolatedInitialize(const NameValuePairs ¶meters); + + size_t Get(byte &outByte); + size_t Get(byte *outString, size_t getMax); + + size_t Peek(byte &outByte) const; + size_t Peek(byte *outString, size_t peekMax) const; + + size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true); + size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const; + + private: + const ByteQueue &m_queue; + const ByteQueueNode *m_node; + lword m_position; + size_t m_offset; + const byte *m_lazyString; + size_t m_lazyLength; + }; + + friend class Walker; + +private: + void CleanupUsedNodes(); + void CopyFrom(const ByteQueue ©); + void Destroy(); + + bool m_autoNodeSize; + size_t m_nodeSize; + ByteQueueNode *m_head, *m_tail; + byte *m_lazyString; + size_t m_lazyLength; + bool m_lazyStringModifiable; +}; + +//! use this to make sure LazyPut is finalized in event of exception +class CRYPTOPP_DLL LazyPutter +{ +public: + LazyPutter(ByteQueue &bq, const byte *inString, size_t size) + : m_bq(bq) {bq.LazyPut(inString, size);} + ~LazyPutter() + {try {m_bq.FinalizeLazyPut();} catch(...) {}} +protected: + LazyPutter(ByteQueue &bq) : m_bq(bq) {} +private: + ByteQueue &m_bq; +}; + +//! like LazyPutter, but does a LazyPutModifiable instead +class LazyPutterModifiable : public LazyPutter +{ +public: + LazyPutterModifiable(ByteQueue &bq, byte *inString, size_t size) + : LazyPutter(bq) {bq.LazyPutModifiable(inString, size);} +}; + +NAMESPACE_END + +#ifndef __BORLANDC__ +NAMESPACE_BEGIN(std) +template<> inline void swap(CryptoPP::ByteQueue &a, CryptoPP::ByteQueue &b) +{ + a.swap(b); +} +NAMESPACE_END +#endif + +#endif diff --git a/cryptopp/rabin.cpp b/cryptopp/rabin.cpp new file mode 100644 index 0000000..d496333 --- /dev/null +++ b/cryptopp/rabin.cpp @@ -0,0 +1,221 @@ +// rabin.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "rabin.h" +#include "nbtheory.h" +#include "asn.h" +#include "sha.h" +#include "modarith.h" + +NAMESPACE_BEGIN(CryptoPP) + +void RabinFunction::BERDecode(BufferedTransformation &bt) +{ + BERSequenceDecoder seq(bt); + m_n.BERDecode(seq); + m_r.BERDecode(seq); + m_s.BERDecode(seq); + seq.MessageEnd(); +} + +void RabinFunction::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + m_n.DEREncode(seq); + m_r.DEREncode(seq); + m_s.DEREncode(seq); + seq.MessageEnd(); +} + +Integer RabinFunction::ApplyFunction(const Integer &in) const +{ + DoQuickSanityCheck(); + + Integer out = in.Squared()%m_n; + if (in.IsOdd()) + out = out*m_r%m_n; + if (Jacobi(in, m_n)==-1) + out = out*m_s%m_n; + return out; +} + +bool RabinFunction::Validate(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = true; + pass = pass && m_n > Integer::One() && m_n%4 == 1; + pass = pass && m_r > Integer::One() && m_r < m_n; + pass = pass && m_s > Integer::One() && m_s < m_n; + if (level >= 1) + pass = pass && Jacobi(m_r, m_n) == -1 && Jacobi(m_s, m_n) == -1; + return pass; +} + +bool RabinFunction::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Modulus) + CRYPTOPP_GET_FUNCTION_ENTRY(QuadraticResidueModPrime1) + CRYPTOPP_GET_FUNCTION_ENTRY(QuadraticResidueModPrime2) + ; +} + +void RabinFunction::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Modulus) + CRYPTOPP_SET_FUNCTION_ENTRY(QuadraticResidueModPrime1) + CRYPTOPP_SET_FUNCTION_ENTRY(QuadraticResidueModPrime2) + ; +} + +// ***************************************************************************** +// private key operations: + +// generate a random private key +void InvertibleRabinFunction::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg) +{ + int modulusSize = 2048; + alg.GetIntValue("ModulusSize", modulusSize) || alg.GetIntValue("KeySize", modulusSize); + + if (modulusSize < 16) + throw InvalidArgument("InvertibleRabinFunction: specified modulus size is too small"); + + // VC70 workaround: putting these after primeParam causes overlapped stack allocation + bool rFound=false, sFound=false; + Integer t=2; + + AlgorithmParameters primeParam = MakeParametersForTwoPrimesOfEqualSize(modulusSize) + ("EquivalentTo", 3)("Mod", 4); + m_p.GenerateRandom(rng, primeParam); + m_q.GenerateRandom(rng, primeParam); + + while (!(rFound && sFound)) + { + int jp = Jacobi(t, m_p); + int jq = Jacobi(t, m_q); + + if (!rFound && jp==1 && jq==-1) + { + m_r = t; + rFound = true; + } + + if (!sFound && jp==-1 && jq==1) + { + m_s = t; + sFound = true; + } + + ++t; + } + + m_n = m_p * m_q; + m_u = m_q.InverseMod(m_p); +} + +void InvertibleRabinFunction::BERDecode(BufferedTransformation &bt) +{ + BERSequenceDecoder seq(bt); + m_n.BERDecode(seq); + m_r.BERDecode(seq); + m_s.BERDecode(seq); + m_p.BERDecode(seq); + m_q.BERDecode(seq); + m_u.BERDecode(seq); + seq.MessageEnd(); +} + +void InvertibleRabinFunction::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + m_n.DEREncode(seq); + m_r.DEREncode(seq); + m_s.DEREncode(seq); + m_p.DEREncode(seq); + m_q.DEREncode(seq); + m_u.DEREncode(seq); + seq.MessageEnd(); +} + +Integer InvertibleRabinFunction::CalculateInverse(RandomNumberGenerator &rng, const Integer &in) const +{ + DoQuickSanityCheck(); + + ModularArithmetic modn(m_n); + Integer r(rng, Integer::One(), m_n - Integer::One()); + r = modn.Square(r); + Integer r2 = modn.Square(r); + Integer c = modn.Multiply(in, r2); // blind + + Integer cp=c%m_p, cq=c%m_q; + + int jp = Jacobi(cp, m_p); + int jq = Jacobi(cq, m_q); + + if (jq==-1) + { + cp = cp*EuclideanMultiplicativeInverse(m_r, m_p)%m_p; + cq = cq*EuclideanMultiplicativeInverse(m_r, m_q)%m_q; + } + + if (jp==-1) + { + cp = cp*EuclideanMultiplicativeInverse(m_s, m_p)%m_p; + cq = cq*EuclideanMultiplicativeInverse(m_s, m_q)%m_q; + } + + cp = ModularSquareRoot(cp, m_p); + cq = ModularSquareRoot(cq, m_q); + + if (jp==-1) + cp = m_p-cp; + + Integer out = CRT(cq, m_q, cp, m_p, m_u); + + out = modn.Divide(out, r); // unblind + + if ((jq==-1 && out.IsEven()) || (jq==1 && out.IsOdd())) + out = m_n-out; + + return out; +} + +bool InvertibleRabinFunction::Validate(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = RabinFunction::Validate(rng, level); + pass = pass && m_p > Integer::One() && m_p%4 == 3 && m_p < m_n; + pass = pass && m_q > Integer::One() && m_q%4 == 3 && m_q < m_n; + pass = pass && m_u.IsPositive() && m_u < m_p; + if (level >= 1) + { + pass = pass && m_p * m_q == m_n; + pass = pass && m_u * m_q % m_p == 1; + pass = pass && Jacobi(m_r, m_p) == 1; + pass = pass && Jacobi(m_r, m_q) == -1; + pass = pass && Jacobi(m_s, m_p) == -1; + pass = pass && Jacobi(m_s, m_q) == 1; + } + if (level >= 2) + pass = pass && VerifyPrime(rng, m_p, level-2) && VerifyPrime(rng, m_q, level-2); + return pass; +} + +bool InvertibleRabinFunction::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Prime1) + CRYPTOPP_GET_FUNCTION_ENTRY(Prime2) + CRYPTOPP_GET_FUNCTION_ENTRY(MultiplicativeInverseOfPrime2ModPrime1) + ; +} + +void InvertibleRabinFunction::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Prime1) + CRYPTOPP_SET_FUNCTION_ENTRY(Prime2) + CRYPTOPP_SET_FUNCTION_ENTRY(MultiplicativeInverseOfPrime2ModPrime1) + ; +} + +NAMESPACE_END diff --git a/cryptopp/rabin.h b/cryptopp/rabin.h new file mode 100644 index 0000000..1c9bcbb --- /dev/null +++ b/cryptopp/rabin.h @@ -0,0 +1,107 @@ +#ifndef CRYPTOPP_RABIN_H +#define CRYPTOPP_RABIN_H + +/** \file +*/ + +#include "oaep.h" +#include "pssr.h" +#include "integer.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class RabinFunction : public TrapdoorFunction, public PublicKey +{ + typedef RabinFunction ThisClass; + +public: + void Initialize(const Integer &n, const Integer &r, const Integer &s) + {m_n = n; m_r = r; m_s = s;} + + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + Integer ApplyFunction(const Integer &x) const; + Integer PreimageBound() const {return m_n;} + Integer ImageBound() const {return m_n;} + + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + + const Integer& GetModulus() const {return m_n;} + const Integer& GetQuadraticResidueModPrime1() const {return m_r;} + const Integer& GetQuadraticResidueModPrime2() const {return m_s;} + + void SetModulus(const Integer &n) {m_n = n;} + void SetQuadraticResidueModPrime1(const Integer &r) {m_r = r;} + void SetQuadraticResidueModPrime2(const Integer &s) {m_s = s;} + +protected: + Integer m_n, m_r, m_s; +}; + +//! _ +class InvertibleRabinFunction : public RabinFunction, public TrapdoorFunctionInverse, public PrivateKey +{ + typedef InvertibleRabinFunction ThisClass; + +public: + void Initialize(const Integer &n, const Integer &r, const Integer &s, + const Integer &p, const Integer &q, const Integer &u) + {m_n = n; m_r = r; m_s = s; m_p = p; m_q = q; m_u = u;} + void Initialize(RandomNumberGenerator &rng, unsigned int keybits) + {GenerateRandomWithKeySize(rng, keybits);} + + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const; + + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + /*! parameters: (ModulusSize) */ + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg); + + const Integer& GetPrime1() const {return m_p;} + const Integer& GetPrime2() const {return m_q;} + const Integer& GetMultiplicativeInverseOfPrime2ModPrime1() const {return m_u;} + + void SetPrime1(const Integer &p) {m_p = p;} + void SetPrime2(const Integer &q) {m_q = q;} + void SetMultiplicativeInverseOfPrime2ModPrime1(const Integer &u) {m_u = u;} + +protected: + Integer m_p, m_q, m_u; +}; + +//! Rabin +struct Rabin +{ + static std::string StaticAlgorithmName() {return "Rabin-Crypto++Variant";} + typedef RabinFunction PublicKey; + typedef InvertibleRabinFunction PrivateKey; +}; + +//! Rabin encryption +template +struct RabinES : public TF_ES +{ +}; + +//! Rabin signature +template +struct RabinSS : public TF_SS +{ +}; + +// More typedefs for backwards compatibility +class SHA1; +typedef RabinES >::Decryptor RabinDecryptor; +typedef RabinES >::Encryptor RabinEncryptor; + +NAMESPACE_END + +#endif diff --git a/cryptopp/randpool.cpp b/cryptopp/randpool.cpp new file mode 100644 index 0000000..11ece6d --- /dev/null +++ b/cryptopp/randpool.cpp @@ -0,0 +1,61 @@ +// randpool.cpp - written and placed in the public domain by Wei Dai +// RandomPool used to follow the design of randpool in PGP 2.6.x, +// but as of version 5.5 it has been redesigned to reduce the risk +// of reusing random numbers after state rollback (which may occur +// when running in a virtual machine like VMware). + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "randpool.h" +#include "aes.h" +#include "sha.h" +#include "hrtimer.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +RandomPool::RandomPool() + : m_pCipher(new AES::Encryption), m_keySet(false) +{ +} + +void RandomPool::IncorporateEntropy(const byte *input, size_t length) +{ + SHA256 hash; + hash.Update(m_key, 32); + hash.Update(input, length); + hash.Final(m_key); + m_keySet = false; +} + +void RandomPool::GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size) +{ + if (size > 0) + { + if (!m_keySet) + m_pCipher->SetKey(m_key, 32); + + Timer timer; + TimerWord tw = timer.GetCurrentTimerValue(); + CRYPTOPP_COMPILE_ASSERT(sizeof(tw) <= 16); + *(TimerWord *)m_seed.data() += tw; + + time_t t = time(NULL); + CRYPTOPP_COMPILE_ASSERT(sizeof(t) <= 8); + *(time_t *)(m_seed.data()+8) += t; + + do + { + m_pCipher->ProcessBlock(m_seed); + size_t len = UnsignedMin(16, size); + target.ChannelPut(channel, m_seed, len); + size -= len; + } while (size > 0); + } +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/randpool.h b/cryptopp/randpool.h new file mode 100644 index 0000000..c25bc9b --- /dev/null +++ b/cryptopp/randpool.h @@ -0,0 +1,33 @@ +#ifndef CRYPTOPP_RANDPOOL_H +#define CRYPTOPP_RANDPOOL_H + +#include "cryptlib.h" +#include "filters.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! Randomness Pool +/*! This class can be used to generate cryptographic quality + pseudorandom bytes after seeding the pool with IncorporateEntropy() */ +class CRYPTOPP_DLL RandomPool : public RandomNumberGenerator, public NotCopyable +{ +public: + RandomPool(); + + bool CanIncorporateEntropy() const {return true;} + void IncorporateEntropy(const byte *input, size_t length); + void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size); + + // for backwards compatibility. use RandomNumberSource, RandomNumberStore, and RandomNumberSink for other BufferTransformation functionality + void Put(const byte *input, size_t length) {IncorporateEntropy(input, length);} + +private: + FixedSizeSecBlock m_key; + FixedSizeSecBlock m_seed; + member_ptr m_pCipher; + bool m_keySet; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/rc2.cpp b/cryptopp/rc2.cpp new file mode 100644 index 0000000..48df2ef --- /dev/null +++ b/cryptopp/rc2.cpp @@ -0,0 +1,118 @@ +// rc2.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "rc2.h" +#include "misc.h" +#include "argnames.h" + +NAMESPACE_BEGIN(CryptoPP) + +void RC2::Base::UncheckedSetKey(const byte *key, unsigned int keyLen, const NameValuePairs ¶ms) +{ + AssertValidKeyLength(keyLen); + + int effectiveLen = params.GetIntValueWithDefault(Name::EffectiveKeyLength(), DEFAULT_EFFECTIVE_KEYLENGTH); + if (effectiveLen > MAX_EFFECTIVE_KEYLENGTH) + throw InvalidArgument("RC2: effective key length parameter exceeds maximum"); + + static const unsigned char PITABLE[256] = { + 217,120,249,196, 25,221,181,237, 40,233,253,121, 74,160,216,157, + 198,126, 55,131, 43,118, 83,142, 98, 76,100,136, 68,139,251,162, + 23,154, 89,245,135,179, 79, 19, 97, 69,109,141, 9,129,125, 50, + 189,143, 64,235,134,183,123, 11,240,149, 33, 34, 92,107, 78,130, + 84,214,101,147,206, 96,178, 28,115, 86,192, 20,167,140,241,220, + 18,117,202, 31, 59,190,228,209, 66, 61,212, 48,163, 60,182, 38, + 111,191, 14,218, 70,105, 7, 87, 39,242, 29,155,188,148, 67, 3, + 248, 17,199,246,144,239, 62,231, 6,195,213, 47,200,102, 30,215, + 8,232,234,222,128, 82,238,247,132,170,114,172, 53, 77,106, 42, + 150, 26,210,113, 90, 21, 73,116, 75,159,208, 94, 4, 24,164,236, + 194,224, 65,110, 15, 81,203,204, 36,145,175, 80,161,244,112, 57, + 153,124, 58,133, 35,184,180,122,252, 2, 54, 91, 37, 85,151, 49, + 45, 93,250,152,227,138,146,174, 5,223, 41, 16,103,108,186,201, + 211, 0,230,207,225,158,168, 44, 99, 22, 1, 63, 88,226,137,169, + 13, 56, 52, 27,171, 51,255,176,187, 72, 12, 95,185,177,205, 46, + 197,243,219, 71,229,165,156,119, 10,166, 32,104,254,127,193,173}; + + SecByteBlock L(128); + memcpy(L, key, keyLen); + + int i; + for (i=keyLen; i<128; i++) + L[i] = PITABLE[(L[i-1] + L[i-keyLen]) & 255]; + + unsigned int T8 = (effectiveLen+7) / 8; + byte TM = 255 >> ((8-(effectiveLen%8))%8); + L[128-T8] = PITABLE[L[128-T8] & TM]; + + for (i=127-T8; i>=0; i--) + L[i] = PITABLE[L[i+1] ^ L[i+T8]]; + + for (i=0; i<64; i++) + K[i] = L[2*i] + (L[2*i+1] << 8); +} + +typedef BlockGetAndPut Block; + +void RC2::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word16 R0, R1, R2, R3; + Block::Get(inBlock)(R0)(R1)(R2)(R3); + + for (int i = 0; i < 16; i++) + { + R0 += (R1 & ~R3) + (R2 & R3) + K[4*i+0]; + R0 = rotlFixed(R0, 1); + + R1 += (R2 & ~R0) + (R3 & R0) + K[4*i+1]; + R1 = rotlFixed(R1, 2); + + R2 += (R3 & ~R1) + (R0 & R1) + K[4*i+2]; + R2 = rotlFixed(R2, 3); + + R3 += (R0 & ~R2) + (R1 & R2) + K[4*i+3]; + R3 = rotlFixed(R3, 5); + + if (i == 4 || i == 10) + { + R0 += K[R3 & 63]; + R1 += K[R0 & 63]; + R2 += K[R1 & 63]; + R3 += K[R2 & 63]; + } + } + + Block::Put(xorBlock, outBlock)(R0)(R1)(R2)(R3); +} + +void RC2::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word16 R0, R1, R2, R3; + Block::Get(inBlock)(R0)(R1)(R2)(R3); + + for (int i = 15; i >= 0; i--) + { + if (i == 4 || i == 10) + { + R3 -= K[R2 & 63]; + R2 -= K[R1 & 63]; + R1 -= K[R0 & 63]; + R0 -= K[R3 & 63]; + } + + R3 = rotrFixed(R3, 5); + R3 -= (R0 & ~R2) + (R1 & R2) + K[4*i+3]; + + R2 = rotrFixed(R2, 3); + R2 -= (R3 & ~R1) + (R0 & R1) + K[4*i+2]; + + R1 = rotrFixed(R1, 2); + R1 -= (R2 & ~R0) + (R3 & R0) + K[4*i+1]; + + R0 = rotrFixed(R0, 1); + R0 -= (R1 & ~R3) + (R2 & R3) + K[4*i+0]; + } + + Block::Put(xorBlock, outBlock)(R0)(R1)(R2)(R3); +} + +NAMESPACE_END diff --git a/cryptopp/rc2.h b/cryptopp/rc2.h new file mode 100644 index 0000000..ebff798 --- /dev/null +++ b/cryptopp/rc2.h @@ -0,0 +1,73 @@ +#ifndef CRYPTOPP_RC2_H +#define CRYPTOPP_RC2_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" +#include "algparam.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct RC2_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 128> +{ + CRYPTOPP_CONSTANT(DEFAULT_EFFECTIVE_KEYLENGTH = 1024) + CRYPTOPP_CONSTANT(MAX_EFFECTIVE_KEYLENGTH = 1024) + static const char *StaticAlgorithmName() {return "RC2";} +}; + +/// RC2 +class RC2 : public RC2_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + unsigned int OptimalDataAlignment() const {return GetAlignmentOf();} + + protected: + FixedSizeSecBlock K; // expanded key table + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + class Encryption : public BlockCipherFinal + { + public: + Encryption() {} + Encryption(const byte *key, size_t keyLen=DEFAULT_KEYLENGTH) + {SetKey(key, keyLen);} + Encryption(const byte *key, size_t keyLen, int effectiveKeyLen) + {SetKey(key, keyLen, MakeParameters("EffectiveKeyLength", effectiveKeyLen));} + }; + + class Decryption : public BlockCipherFinal + { + public: + Decryption() {} + Decryption(const byte *key, size_t keyLen=DEFAULT_KEYLENGTH) + {SetKey(key, keyLen);} + Decryption(const byte *key, size_t keyLen, int effectiveKeyLen) + {SetKey(key, keyLen, MakeParameters("EffectiveKeyLength", effectiveKeyLen));} + }; +}; + +typedef RC2::Encryption RC2Encryption; +typedef RC2::Decryption RC2Decryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/rc5.cpp b/cryptopp/rc5.cpp new file mode 100644 index 0000000..2b730de --- /dev/null +++ b/cryptopp/rc5.cpp @@ -0,0 +1,79 @@ +// rc5.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "rc5.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +void RC5::Base::UncheckedSetKey(const byte *k, unsigned int keylen, const NameValuePairs ¶ms) +{ + AssertValidKeyLength(keylen); + + r = GetRoundsAndThrowIfInvalid(params, this); + sTable.New(2*(r+1)); + + static const RC5_WORD MAGIC_P = 0xb7e15163L; // magic constant P for wordsize + static const RC5_WORD MAGIC_Q = 0x9e3779b9L; // magic constant Q for wordsize + static const int U=sizeof(RC5_WORD); + + const unsigned int c = STDMAX((keylen+U-1)/U, 1U); // RC6 paper says c=1 if keylen==0 + SecBlock l(c); + + GetUserKey(LITTLE_ENDIAN_ORDER, l.begin(), c, k, keylen); + + sTable[0] = MAGIC_P; + for (unsigned j=1; j Block; + +void RC5::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + const RC5_WORD *sptr = sTable; + RC5_WORD a, b; + + Block::Get(inBlock)(a)(b); + a += sptr[0]; + b += sptr[1]; + sptr += 2; + + for(unsigned i=0; i, public VariableKeyLength<16, 0, 255>, public VariableRounds<16> +{ + static const char *StaticAlgorithmName() {return "RC5";} + typedef word32 RC5_WORD; +}; + +/// RC5 +class RC5 : public RC5_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + unsigned int r; // number of rounds + SecBlock sTable; // expanded key table + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef RC5::Encryption RC5Encryption; +typedef RC5::Decryption RC5Decryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/rc6.cpp b/cryptopp/rc6.cpp new file mode 100644 index 0000000..e58cb6a --- /dev/null +++ b/cryptopp/rc6.cpp @@ -0,0 +1,96 @@ +// rc6.cpp - written and placed in the public domain by Sean Woods +// based on Wei Dai's RC5 code. + +#include "pch.h" +#include "rc6.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +void RC6::Base::UncheckedSetKey(const byte *k, unsigned int keylen, const NameValuePairs ¶ms) +{ + AssertValidKeyLength(keylen); + + r = GetRoundsAndThrowIfInvalid(params, this); + sTable.New(2*(r+2)); + + static const RC6_WORD MAGIC_P = 0xb7e15163L; // magic constant P for wordsize + static const RC6_WORD MAGIC_Q = 0x9e3779b9L; // magic constant Q for wordsize + static const int U=sizeof(RC6_WORD); + + const unsigned int c = STDMAX((keylen+U-1)/U, 1U); // RC6 paper says c=1 if keylen==0 + SecBlock l(c); + + GetUserKey(LITTLE_ENDIAN_ORDER, l.begin(), c, k, keylen); + + sTable[0] = MAGIC_P; + for (unsigned j=1; j Block; + +void RC6::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + const RC6_WORD *sptr = sTable; + RC6_WORD a, b, c, d, t, u; + + Block::Get(inBlock)(a)(b)(c)(d); + b += sptr[0]; + d += sptr[1]; + sptr += 2; + + for(unsigned i=0; i, public VariableKeyLength<16, 0, 255>, public VariableRounds<20> +{ + static const char *StaticAlgorithmName() {return "RC6";} + typedef word32 RC6_WORD; +}; + +/// RC6 +class RC6 : public RC6_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + unsigned int r; // number of rounds + SecBlock sTable; // expanded key table + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef RC6::Encryption RC6Encryption; +typedef RC6::Decryption RC6Decryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/rdtables.cpp b/cryptopp/rdtables.cpp new file mode 100644 index 0000000..4937932 --- /dev/null +++ b/cryptopp/rdtables.cpp @@ -0,0 +1,172 @@ +// Rijndael tables + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "rijndael.h" + +// VC60 workaround: gives a C4786 warning without this function +// when runtime lib is set to multithread debug DLL +// even though warning 4786 is disabled! +void Rijndael_VC60Workaround() +{ +} + +NAMESPACE_BEGIN(CryptoPP) + +/* +Te0[x] = S [x].[02, 01, 01, 03]; +Te1[x] = S [x].[03, 02, 01, 01]; +Te2[x] = S [x].[01, 03, 02, 01]; +Te3[x] = S [x].[01, 01, 03, 02]; + +Td0[x] = Si[x].[0e, 09, 0d, 0b]; +Td1[x] = Si[x].[0b, 0e, 09, 0d]; +Td2[x] = Si[x].[0d, 0b, 0e, 09]; +Td3[x] = Si[x].[09, 0d, 0b, 0e]; +*/ + +const byte Rijndael::Base::Se[256] = { + 0x63, 0x7c, 0x77, 0x7b, + 0xf2, 0x6b, 0x6f, 0xc5, + 0x30, 0x01, 0x67, 0x2b, + 0xfe, 0xd7, 0xab, 0x76, + 0xca, 0x82, 0xc9, 0x7d, + 0xfa, 0x59, 0x47, 0xf0, + 0xad, 0xd4, 0xa2, 0xaf, + 0x9c, 0xa4, 0x72, 0xc0, + 0xb7, 0xfd, 0x93, 0x26, + 0x36, 0x3f, 0xf7, 0xcc, + 0x34, 0xa5, 0xe5, 0xf1, + 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, + 0x18, 0x96, 0x05, 0x9a, + 0x07, 0x12, 0x80, 0xe2, + 0xeb, 0x27, 0xb2, 0x75, + 0x09, 0x83, 0x2c, 0x1a, + 0x1b, 0x6e, 0x5a, 0xa0, + 0x52, 0x3b, 0xd6, 0xb3, + 0x29, 0xe3, 0x2f, 0x84, + 0x53, 0xd1, 0x00, 0xed, + 0x20, 0xfc, 0xb1, 0x5b, + 0x6a, 0xcb, 0xbe, 0x39, + 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, + 0x43, 0x4d, 0x33, 0x85, + 0x45, 0xf9, 0x02, 0x7f, + 0x50, 0x3c, 0x9f, 0xa8, + 0x51, 0xa3, 0x40, 0x8f, + 0x92, 0x9d, 0x38, 0xf5, + 0xbc, 0xb6, 0xda, 0x21, + 0x10, 0xff, 0xf3, 0xd2, + 0xcd, 0x0c, 0x13, 0xec, + 0x5f, 0x97, 0x44, 0x17, + 0xc4, 0xa7, 0x7e, 0x3d, + 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, + 0x22, 0x2a, 0x90, 0x88, + 0x46, 0xee, 0xb8, 0x14, + 0xde, 0x5e, 0x0b, 0xdb, + 0xe0, 0x32, 0x3a, 0x0a, + 0x49, 0x06, 0x24, 0x5c, + 0xc2, 0xd3, 0xac, 0x62, + 0x91, 0x95, 0xe4, 0x79, + 0xe7, 0xc8, 0x37, 0x6d, + 0x8d, 0xd5, 0x4e, 0xa9, + 0x6c, 0x56, 0xf4, 0xea, + 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, + 0x1c, 0xa6, 0xb4, 0xc6, + 0xe8, 0xdd, 0x74, 0x1f, + 0x4b, 0xbd, 0x8b, 0x8a, + 0x70, 0x3e, 0xb5, 0x66, + 0x48, 0x03, 0xf6, 0x0e, + 0x61, 0x35, 0x57, 0xb9, + 0x86, 0xc1, 0x1d, 0x9e, + 0xe1, 0xf8, 0x98, 0x11, + 0x69, 0xd9, 0x8e, 0x94, + 0x9b, 0x1e, 0x87, 0xe9, + 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, + 0xbf, 0xe6, 0x42, 0x68, + 0x41, 0x99, 0x2d, 0x0f, + 0xb0, 0x54, 0xbb, 0x16, +}; + +const byte Rijndael::Base::Sd[256] = { + 0x52, 0x09, 0x6a, 0xd5, + 0x30, 0x36, 0xa5, 0x38, + 0xbf, 0x40, 0xa3, 0x9e, + 0x81, 0xf3, 0xd7, 0xfb, + 0x7c, 0xe3, 0x39, 0x82, + 0x9b, 0x2f, 0xff, 0x87, + 0x34, 0x8e, 0x43, 0x44, + 0xc4, 0xde, 0xe9, 0xcb, + 0x54, 0x7b, 0x94, 0x32, + 0xa6, 0xc2, 0x23, 0x3d, + 0xee, 0x4c, 0x95, 0x0b, + 0x42, 0xfa, 0xc3, 0x4e, + 0x08, 0x2e, 0xa1, 0x66, + 0x28, 0xd9, 0x24, 0xb2, + 0x76, 0x5b, 0xa2, 0x49, + 0x6d, 0x8b, 0xd1, 0x25, + 0x72, 0xf8, 0xf6, 0x64, + 0x86, 0x68, 0x98, 0x16, + 0xd4, 0xa4, 0x5c, 0xcc, + 0x5d, 0x65, 0xb6, 0x92, + 0x6c, 0x70, 0x48, 0x50, + 0xfd, 0xed, 0xb9, 0xda, + 0x5e, 0x15, 0x46, 0x57, + 0xa7, 0x8d, 0x9d, 0x84, + 0x90, 0xd8, 0xab, 0x00, + 0x8c, 0xbc, 0xd3, 0x0a, + 0xf7, 0xe4, 0x58, 0x05, + 0xb8, 0xb3, 0x45, 0x06, + 0xd0, 0x2c, 0x1e, 0x8f, + 0xca, 0x3f, 0x0f, 0x02, + 0xc1, 0xaf, 0xbd, 0x03, + 0x01, 0x13, 0x8a, 0x6b, + 0x3a, 0x91, 0x11, 0x41, + 0x4f, 0x67, 0xdc, 0xea, + 0x97, 0xf2, 0xcf, 0xce, + 0xf0, 0xb4, 0xe6, 0x73, + 0x96, 0xac, 0x74, 0x22, + 0xe7, 0xad, 0x35, 0x85, + 0xe2, 0xf9, 0x37, 0xe8, + 0x1c, 0x75, 0xdf, 0x6e, + 0x47, 0xf1, 0x1a, 0x71, + 0x1d, 0x29, 0xc5, 0x89, + 0x6f, 0xb7, 0x62, 0x0e, + 0xaa, 0x18, 0xbe, 0x1b, + 0xfc, 0x56, 0x3e, 0x4b, + 0xc6, 0xd2, 0x79, 0x20, + 0x9a, 0xdb, 0xc0, 0xfe, + 0x78, 0xcd, 0x5a, 0xf4, + 0x1f, 0xdd, 0xa8, 0x33, + 0x88, 0x07, 0xc7, 0x31, + 0xb1, 0x12, 0x10, 0x59, + 0x27, 0x80, 0xec, 0x5f, + 0x60, 0x51, 0x7f, 0xa9, + 0x19, 0xb5, 0x4a, 0x0d, + 0x2d, 0xe5, 0x7a, 0x9f, + 0x93, 0xc9, 0x9c, 0xef, + 0xa0, 0xe0, 0x3b, 0x4d, + 0xae, 0x2a, 0xf5, 0xb0, + 0xc8, 0xeb, 0xbb, 0x3c, + 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2b, 0x04, 0x7e, + 0xba, 0x77, 0xd6, 0x26, + 0xe1, 0x69, 0x14, 0x63, + 0x55, 0x21, 0x0c, 0x7d, +}; + +const word32 Rijndael::Base::rcon[] = { + 0x01000000, 0x02000000, 0x04000000, 0x08000000, + 0x10000000, 0x20000000, 0x40000000, 0x80000000, + 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/regtest.cpp b/cryptopp/regtest.cpp new file mode 100644 index 0000000..3887e84 --- /dev/null +++ b/cryptopp/regtest.cpp @@ -0,0 +1,139 @@ +#include "factory.h" + +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 +#include "modes.h" +#include "dh.h" +#include "esign.h" +#include "md2.h" +#include "rw.h" +#include "md5.h" +#include "rsa.h" +#include "ripemd.h" +#include "dsa.h" +#include "seal.h" +#include "whrlpool.h" +#include "ttmac.h" +#include "camellia.h" +#include "shacal2.h" +#include "tea.h" +#include "panama.h" +#include "pssr.h" +#include "aes.h" +#include "salsa.h" +#include "vmac.h" +#include "tiger.h" +#include "md5.h" +#include "sosemanuk.h" +#include "arc4.h" +#include "ccm.h" +#include "gcm.h" +#include "eax.h" +#include "twofish.h" +#include "serpent.h" +#include "cast.h" +#include "rc6.h" +#include "mars.h" +#include "shacal2.h" +#include "des.h" +#include "idea.h" +#include "rc5.h" +#include "tea.h" +#include "skipjack.h" +#include "cmac.h" +#include "dmac.h" +#include "blowfish.h" +#include "seed.h" +#include "wake.h" +#include "seal.h" +#include "crc.h" +#include "adler32.h" + +USING_NAMESPACE(CryptoPP) + +void RegisterFactories() +{ + static bool s_registered = false; + if (s_registered) + return; + + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterAsymmetricCipherDefaultFactories > >("RSA/OAEP-MGF1(SHA-1)"); + RegisterAsymmetricCipherDefaultFactories >("DLIES(NoCofactorMultiplication, KDF2(SHA-1), XOR, HMAC(SHA-1), DHAES)"); + RegisterSignatureSchemeDefaultFactories("DSA(1363)"); + RegisterSignatureSchemeDefaultFactories >("NR(1363)/EMSA1(SHA-1)"); + RegisterSignatureSchemeDefaultFactories >("DSA-1363/EMSA1(SHA-1)"); + RegisterSignatureSchemeDefaultFactories >("RSA/PKCS1-1.5(MD2)"); + RegisterSignatureSchemeDefaultFactories >("RSA/PKCS1-1.5(SHA-1)"); + RegisterSignatureSchemeDefaultFactories >("ESIGN/EMSA5-MGF1(SHA-1)"); + RegisterSignatureSchemeDefaultFactories >("RW/EMSA2(SHA-1)"); + RegisterSignatureSchemeDefaultFactories >("RSA/PSS-MGF1(SHA-1)"); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories(); + RegisterSymmetricCipherDefaultFactories(); + RegisterSymmetricCipherDefaultFactories(); + RegisterSymmetricCipherDefaultFactories(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterAuthenticatedSymmetricCipherDefaultFactories >(); + RegisterAuthenticatedSymmetricCipherDefaultFactories >(); + RegisterAuthenticatedSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + + s_registered = true; +} diff --git a/cryptopp/resource.h b/cryptopp/resource.h new file mode 100644 index 0000000..861e22b --- /dev/null +++ b/cryptopp/resource.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by cryptopp.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/cryptopp/rijndael.cpp b/cryptopp/rijndael.cpp new file mode 100644 index 0000000..a2c7be3 --- /dev/null +++ b/cryptopp/rijndael.cpp @@ -0,0 +1,987 @@ +// rijndael.cpp - modified by Chris Morgan +// and Wei Dai from Paulo Baretto's Rijndael implementation +// The original code and all modifications are in the public domain. + +// use "cl /EP /P /DCRYPTOPP_GENERATE_X64_MASM rijndael.cpp" to generate MASM code + +/* +Feb 2009: The x86/x64 assembly code was rewritten in by Wei Dai to do counter mode +caching, which was invented by Hongjun Wu and popularized by Daniel J. Bernstein +and Peter Schwabe in their paper "New AES software speed records". The round +function was also modified to include a trick similar to one in Brian Gladman's +x86 assembly code, doing an 8-bit register move to minimize the number of +register spills. Also switched to compressed tables and copying round keys to +the stack. + +The C++ implementation now uses compressed tables if +CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS is defined. +*/ + +/* +July 2006: Defense against timing attacks was added in by Wei Dai. + +The code now uses smaller tables in the first and last rounds, +and preloads them into L1 cache before usage (by loading at least +one element in each cache line). + +We try to delay subsequent accesses to each table (used in the first +and last rounds) until all of the table has been preloaded. Hopefully +the compiler isn't smart enough to optimize that code away. + +After preloading the table, we also try not to access any memory location +other than the table and the stack, in order to prevent table entries from +being unloaded from L1 cache, until that round is finished. +(Some popular CPUs have 2-way associative caches.) +*/ + +// This is the original introductory comment: + +/** + * version 3.0 (December 2000) + * + * Optimised ANSI C code for the Rijndael cipher (now AES) + * + * author Vincent Rijmen + * author Antoon Bosselaers + * author Paulo Barreto + * + * This code is hereby placed in the public domain. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS +#ifndef CRYPTOPP_GENERATE_X64_MASM + +#include "rijndael.h" +#include "misc.h" +#include "cpu.h" + +#ifdef __sun +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +#ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) +namespace rdtable {CRYPTOPP_ALIGN_DATA(16) word64 Te[256+2];} +using namespace rdtable; +#else +static word64 Te[256]; +#endif +static word64 Td[256]; +#else +static word32 Te[256*4], Td[256*4]; +#endif +static bool s_TeFilled = false, s_TdFilled = false; + +// ************************* Portable Code ************************************ + +#define QUARTER_ROUND(L, T, t, a, b, c, d) \ + a ^= L(T, 3, byte(t)); t >>= 8;\ + b ^= L(T, 2, byte(t)); t >>= 8;\ + c ^= L(T, 1, byte(t)); t >>= 8;\ + d ^= L(T, 0, t); + +#define QUARTER_ROUND_LE(t, a, b, c, d) \ + tempBlock[a] = ((byte *)(Te+byte(t)))[1]; t >>= 8;\ + tempBlock[b] = ((byte *)(Te+byte(t)))[1]; t >>= 8;\ + tempBlock[c] = ((byte *)(Te+byte(t)))[1]; t >>= 8;\ + tempBlock[d] = ((byte *)(Te+t))[1]; + +#ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + #define QUARTER_ROUND_LD(t, a, b, c, d) \ + tempBlock[a] = ((byte *)(Td+byte(t)))[GetNativeByteOrder()*7]; t >>= 8;\ + tempBlock[b] = ((byte *)(Td+byte(t)))[GetNativeByteOrder()*7]; t >>= 8;\ + tempBlock[c] = ((byte *)(Td+byte(t)))[GetNativeByteOrder()*7]; t >>= 8;\ + tempBlock[d] = ((byte *)(Td+t))[GetNativeByteOrder()*7]; +#else + #define QUARTER_ROUND_LD(t, a, b, c, d) \ + tempBlock[a] = Sd[byte(t)]; t >>= 8;\ + tempBlock[b] = Sd[byte(t)]; t >>= 8;\ + tempBlock[c] = Sd[byte(t)]; t >>= 8;\ + tempBlock[d] = Sd[t]; +#endif + +#define QUARTER_ROUND_E(t, a, b, c, d) QUARTER_ROUND(TL_M, Te, t, a, b, c, d) +#define QUARTER_ROUND_D(t, a, b, c, d) QUARTER_ROUND(TL_M, Td, t, a, b, c, d) + +#ifdef IS_LITTLE_ENDIAN + #define QUARTER_ROUND_FE(t, a, b, c, d) QUARTER_ROUND(TL_F, Te, t, d, c, b, a) + #define QUARTER_ROUND_FD(t, a, b, c, d) QUARTER_ROUND(TL_F, Td, t, d, c, b, a) + #ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + #define TL_F(T, i, x) (*(word32 *)((byte *)T + x*8 + (6-i)%4+1)) + #define TL_M(T, i, x) (*(word32 *)((byte *)T + x*8 + (i+3)%4+1)) + #else + #define TL_F(T, i, x) rotrFixed(T[x], (3-i)*8) + #define TL_M(T, i, x) T[i*256 + x] + #endif +#else + #define QUARTER_ROUND_FE(t, a, b, c, d) QUARTER_ROUND(TL_F, Te, t, a, b, c, d) + #define QUARTER_ROUND_FD(t, a, b, c, d) QUARTER_ROUND(TL_F, Td, t, a, b, c, d) + #ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + #define TL_F(T, i, x) (*(word32 *)((byte *)T + x*8 + (4-i)%4)) + #define TL_M TL_F + #else + #define TL_F(T, i, x) rotrFixed(T[x], i*8) + #define TL_M(T, i, x) T[i*256 + x] + #endif +#endif + + +#define f2(x) ((x<<1)^(((x>>7)&1)*0x11b)) +#define f4(x) ((x<<2)^(((x>>6)&1)*0x11b)^(((x>>6)&2)*0x11b)) +#define f8(x) ((x<<3)^(((x>>5)&1)*0x11b)^(((x>>5)&2)*0x11b)^(((x>>5)&4)*0x11b)) + +#define f3(x) (f2(x) ^ x) +#define f9(x) (f8(x) ^ x) +#define fb(x) (f8(x) ^ f2(x) ^ x) +#define fd(x) (f8(x) ^ f4(x) ^ x) +#define fe(x) (f8(x) ^ f4(x) ^ f2(x)) + +void Rijndael::Base::FillEncTable() +{ + for (int i=0; i<256; i++) + { + byte x = Se[i]; +#ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + word32 y = word32(x)<<8 | word32(x)<<16 | word32(f2(x))<<24; + Te[i] = word64(y | f3(x))<<32 | y; +#else + word32 y = f3(x) | word32(x)<<8 | word32(x)<<16 | word32(f2(x))<<24; + for (int j=0; j<4; j++) + { + Te[i+j*256] = y; + y = rotrFixed(y, 8); + } +#endif + } +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) + Te[256] = Te[257] = 0; +#endif + s_TeFilled = true; +} + +void Rijndael::Base::FillDecTable() +{ + for (int i=0; i<256; i++) + { + byte x = Sd[i]; +#ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + word32 y = word32(fd(x))<<8 | word32(f9(x))<<16 | word32(fe(x))<<24; + Td[i] = word64(y | fb(x))<<32 | y | x; +#else + word32 y = fb(x) | word32(fd(x))<<8 | word32(f9(x))<<16 | word32(fe(x))<<24;; + for (int j=0; j<4; j++) + { + Td[i+j*256] = y; + y = rotrFixed(y, 8); + } +#endif + } + s_TdFilled = true; +} + +void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keylen, const NameValuePairs &) +{ + AssertValidKeyLength(keylen); + + m_rounds = keylen/4 + 6; + m_key.New(4*(m_rounds+1)); + + word32 temp, *rk = m_key; + const word32 *rc = rcon; + + GetUserKey(BIG_ENDIAN_ORDER, rk, keylen/4, userKey, keylen); + + while (true) + { + temp = rk[keylen/4-1]; + rk[keylen/4] = rk[0] ^ + (word32(Se[GETBYTE(temp, 2)]) << 24) ^ + (word32(Se[GETBYTE(temp, 1)]) << 16) ^ + (word32(Se[GETBYTE(temp, 0)]) << 8) ^ + Se[GETBYTE(temp, 3)] ^ + *(rc++); + rk[keylen/4+1] = rk[1] ^ rk[keylen/4]; + rk[keylen/4+2] = rk[2] ^ rk[keylen/4+1]; + rk[keylen/4+3] = rk[3] ^ rk[keylen/4+2]; + + if (rk + keylen/4 + 4 == m_key.end()) + break; + + if (keylen == 24) + { + rk[10] = rk[ 4] ^ rk[ 9]; + rk[11] = rk[ 5] ^ rk[10]; + } + else if (keylen == 32) + { + temp = rk[11]; + rk[12] = rk[ 4] ^ + (word32(Se[GETBYTE(temp, 3)]) << 24) ^ + (word32(Se[GETBYTE(temp, 2)]) << 16) ^ + (word32(Se[GETBYTE(temp, 1)]) << 8) ^ + Se[GETBYTE(temp, 0)]; + rk[13] = rk[ 5] ^ rk[12]; + rk[14] = rk[ 6] ^ rk[13]; + rk[15] = rk[ 7] ^ rk[14]; + } + rk += keylen/4; + } + + if (IsForwardTransformation()) + { + if (!s_TeFilled) + FillEncTable(); + } + else + { + if (!s_TdFilled) + FillDecTable(); + + unsigned int i, j; + rk = m_key; + + /* invert the order of the round keys: */ + for (i = 0, j = 4*m_rounds; i < j; i += 4, j -= 4) { + temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; + temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; + temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; + temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; + } + +#define InverseMixColumn(x) x = TL_M(Td, 0, Se[GETBYTE(x, 3)]) ^ TL_M(Td, 1, Se[GETBYTE(x, 2)]) ^ TL_M(Td, 2, Se[GETBYTE(x, 1)]) ^ TL_M(Td, 3, Se[GETBYTE(x, 0)]) + + /* apply the inverse MixColumn transform to all round keys but the first and the last: */ + for (i = 1; i < m_rounds; i++) { + rk += 4; + InverseMixColumn(rk[0]); + InverseMixColumn(rk[1]); + InverseMixColumn(rk[2]); + InverseMixColumn(rk[3]); + } + } + + ConditionalByteReverse(BIG_ENDIAN_ORDER, m_key.begin(), m_key.begin(), 16); + ConditionalByteReverse(BIG_ENDIAN_ORDER, m_key + m_rounds*4, m_key + m_rounds*4, 16); +} + +void Rijndael::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) + if (HasSSE2()) + { + Rijndael::Enc::AdvancedProcessBlocks(inBlock, xorBlock, outBlock, 16, 0); + return; + } +#endif + + typedef BlockGetAndPut Block; + + word32 s0, s1, s2, s3, t0, t1, t2, t3; + Block::Get(inBlock)(s0)(s1)(s2)(s3); + + const word32 *rk = m_key; + s0 ^= rk[0]; + s1 ^= rk[1]; + s2 ^= rk[2]; + s3 ^= rk[3]; + t0 = rk[4]; + t1 = rk[5]; + t2 = rk[6]; + t3 = rk[7]; + rk += 8; + + // timing attack countermeasure. see comments at top for more details + const int cacheLineSize = GetCacheLineSize(); + unsigned int i; + word32 u = 0; +#ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + for (i=0; i<2048; i+=cacheLineSize) +#else + for (i=0; i<1024; i+=cacheLineSize) +#endif + u &= *(const word32 *)(((const byte *)Te)+i); + u &= Te[255]; + s0 |= u; s1 |= u; s2 |= u; s3 |= u; + + QUARTER_ROUND_FE(s3, t0, t1, t2, t3) + QUARTER_ROUND_FE(s2, t3, t0, t1, t2) + QUARTER_ROUND_FE(s1, t2, t3, t0, t1) + QUARTER_ROUND_FE(s0, t1, t2, t3, t0) + + // Nr - 2 full rounds: + unsigned int r = m_rounds/2 - 1; + do + { + s0 = rk[0]; s1 = rk[1]; s2 = rk[2]; s3 = rk[3]; + + QUARTER_ROUND_E(t3, s0, s1, s2, s3) + QUARTER_ROUND_E(t2, s3, s0, s1, s2) + QUARTER_ROUND_E(t1, s2, s3, s0, s1) + QUARTER_ROUND_E(t0, s1, s2, s3, s0) + + t0 = rk[4]; t1 = rk[5]; t2 = rk[6]; t3 = rk[7]; + + QUARTER_ROUND_E(s3, t0, t1, t2, t3) + QUARTER_ROUND_E(s2, t3, t0, t1, t2) + QUARTER_ROUND_E(s1, t2, t3, t0, t1) + QUARTER_ROUND_E(s0, t1, t2, t3, t0) + + rk += 8; + } while (--r); + + word32 tbw[4]; + byte *const tempBlock = (byte *)tbw; + + QUARTER_ROUND_LE(t2, 15, 2, 5, 8) + QUARTER_ROUND_LE(t1, 11, 14, 1, 4) + QUARTER_ROUND_LE(t0, 7, 10, 13, 0) + QUARTER_ROUND_LE(t3, 3, 6, 9, 12) + + Block::Put(xorBlock, outBlock)(tbw[0]^rk[0])(tbw[1]^rk[1])(tbw[2]^rk[2])(tbw[3]^rk[3]); +} + +void Rijndael::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + typedef BlockGetAndPut Block; + + word32 s0, s1, s2, s3, t0, t1, t2, t3; + Block::Get(inBlock)(s0)(s1)(s2)(s3); + + const word32 *rk = m_key; + s0 ^= rk[0]; + s1 ^= rk[1]; + s2 ^= rk[2]; + s3 ^= rk[3]; + t0 = rk[4]; + t1 = rk[5]; + t2 = rk[6]; + t3 = rk[7]; + rk += 8; + + // timing attack countermeasure. see comments at top for more details + const int cacheLineSize = GetCacheLineSize(); + unsigned int i; + word32 u = 0; +#ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + for (i=0; i<2048; i+=cacheLineSize) +#else + for (i=0; i<1024; i+=cacheLineSize) +#endif + u &= *(const word32 *)(((const byte *)Td)+i); + u &= Td[255]; + s0 |= u; s1 |= u; s2 |= u; s3 |= u; + + QUARTER_ROUND_FD(s3, t2, t1, t0, t3) + QUARTER_ROUND_FD(s2, t1, t0, t3, t2) + QUARTER_ROUND_FD(s1, t0, t3, t2, t1) + QUARTER_ROUND_FD(s0, t3, t2, t1, t0) + + // Nr - 2 full rounds: + unsigned int r = m_rounds/2 - 1; + do + { + s0 = rk[0]; s1 = rk[1]; s2 = rk[2]; s3 = rk[3]; + + QUARTER_ROUND_D(t3, s2, s1, s0, s3) + QUARTER_ROUND_D(t2, s1, s0, s3, s2) + QUARTER_ROUND_D(t1, s0, s3, s2, s1) + QUARTER_ROUND_D(t0, s3, s2, s1, s0) + + t0 = rk[4]; t1 = rk[5]; t2 = rk[6]; t3 = rk[7]; + + QUARTER_ROUND_D(s3, t2, t1, t0, t3) + QUARTER_ROUND_D(s2, t1, t0, t3, t2) + QUARTER_ROUND_D(s1, t0, t3, t2, t1) + QUARTER_ROUND_D(s0, t3, t2, t1, t0) + + rk += 8; + } while (--r); + +#ifndef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + // timing attack countermeasure. see comments at top for more details + // If CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS is defined, + // QUARTER_ROUND_LD will use Td, which is already preloaded. + u = 0; + for (i=0; i<256; i+=cacheLineSize) + u &= *(const word32 *)(Sd+i); + u &= *(const word32 *)(Sd+252); + t0 |= u; t1 |= u; t2 |= u; t3 |= u; +#endif + + word32 tbw[4]; + byte *const tempBlock = (byte *)tbw; + + QUARTER_ROUND_LD(t2, 7, 2, 13, 8) + QUARTER_ROUND_LD(t1, 3, 14, 9, 4) + QUARTER_ROUND_LD(t0, 15, 10, 5, 0) + QUARTER_ROUND_LD(t3, 11, 6, 1, 12) + + Block::Put(xorBlock, outBlock)(tbw[0]^rk[0])(tbw[1]^rk[1])(tbw[2]^rk[2])(tbw[3]^rk[3]); +} + +// ************************* Assembly Code ************************************ + +#pragma warning(disable: 4731) // frame pointer register 'ebp' modified by inline assembly code + +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + +CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_AdvancedProcessBlocks(void *locals, const word32 *k) +{ +#if CRYPTOPP_BOOL_X86 + +#define L_REG esp +#define L_INDEX(i) (L_REG+512+i) +#define L_INXORBLOCKS L_INBLOCKS+4 +#define L_OUTXORBLOCKS L_INBLOCKS+8 +#define L_OUTBLOCKS L_INBLOCKS+12 +#define L_INCREMENTS L_INDEX(16*15) +#define L_SP L_INDEX(16*16) +#define L_LENGTH L_INDEX(16*16+4) +#define L_KEYS_BEGIN L_INDEX(16*16+8) + +#define MOVD movd +#define MM(i) mm##i + +#define MXOR(a,b,c) \ + AS2( movzx esi, b)\ + AS2( movd mm7, DWORD PTR [AS_REG_7+8*WORD_REG(si)+MAP0TO4(c)])\ + AS2( pxor MM(a), mm7)\ + +#define MMOV(a,b,c) \ + AS2( movzx esi, b)\ + AS2( movd MM(a), DWORD PTR [AS_REG_7+8*WORD_REG(si)+MAP0TO4(c)])\ + +#else + +#define L_REG r8 +#define L_INDEX(i) (L_REG+i) +#define L_INXORBLOCKS L_INBLOCKS+8 +#define L_OUTXORBLOCKS L_INBLOCKS+16 +#define L_OUTBLOCKS L_INBLOCKS+24 +#define L_INCREMENTS L_INDEX(16*16) +#define L_LENGTH L_INDEX(16*18+8) +#define L_KEYS_BEGIN L_INDEX(16*19) + +#define MOVD mov +#define MM_0 r9d +#define MM_1 r12d +#ifdef __GNUC__ +#define MM_2 r11d +#else +#define MM_2 r10d +#endif +#define MM(i) MM_##i + +#define MXOR(a,b,c) \ + AS2( movzx esi, b)\ + AS2( xor MM(a), DWORD PTR [AS_REG_7+8*WORD_REG(si)+MAP0TO4(c)])\ + +#define MMOV(a,b,c) \ + AS2( movzx esi, b)\ + AS2( mov MM(a), DWORD PTR [AS_REG_7+8*WORD_REG(si)+MAP0TO4(c)])\ + +#endif + +#define L_SUBKEYS L_INDEX(0) +#define L_SAVED_X L_SUBKEYS +#define L_KEY12 L_INDEX(16*12) +#define L_LASTROUND L_INDEX(16*13) +#define L_INBLOCKS L_INDEX(16*14) +#define MAP0TO4(i) (ASM_MOD(i+3,4)+1) + +#define XOR(a,b,c) \ + AS2( movzx esi, b)\ + AS2( xor a, DWORD PTR [AS_REG_7+8*WORD_REG(si)+MAP0TO4(c)])\ + +#define MOV(a,b,c) \ + AS2( movzx esi, b)\ + AS2( mov a, DWORD PTR [AS_REG_7+8*WORD_REG(si)+MAP0TO4(c)])\ + +#ifdef CRYPTOPP_GENERATE_X64_MASM + ALIGN 8 + Rijndael_Enc_AdvancedProcessBlocks PROC FRAME + rex_push_reg rsi + push_reg rdi + push_reg rbx + push_reg r12 + .endprolog + mov L_REG, rcx + mov AS_REG_7, ?Te@rdtable@CryptoPP@@3PA_KA + mov rdi, QWORD PTR [?g_cacheLineSize@CryptoPP@@3IA] +#elif defined(__GNUC__) + __asm__ __volatile__ + ( + ".intel_syntax noprefix;" + #if CRYPTOPP_BOOL_X64 + AS2( mov L_REG, rcx) + #endif + AS_PUSH_IF86(bx) + AS_PUSH_IF86(bp) + AS2( mov AS_REG_7, WORD_REG(si)) +#else + AS_PUSH_IF86(si) + AS_PUSH_IF86(di) +#if !defined(_MSC_VER) || (_MSC_VER < 1400) + AS_PUSH_IF86(bx) +#endif + AS_PUSH_IF86(bp) + AS2( lea AS_REG_7, [Te]) + AS2( mov edi, [g_cacheLineSize]) +#endif + +#if CRYPTOPP_BOOL_X86 + AS2( mov [ecx+16*12+16*4], esp) // save esp to L_SP + AS2( lea esp, [ecx-512]) +#endif + + // copy subkeys to stack + AS2( mov WORD_REG(si), [L_KEYS_BEGIN]) + AS2( mov WORD_REG(ax), 16) + AS2( and WORD_REG(ax), WORD_REG(si)) + AS2( movdqa xmm3, XMMWORD_PTR [WORD_REG(dx)+16+WORD_REG(ax)]) // subkey 1 (non-counter) or 2 (counter) + AS2( movdqa [L_KEY12], xmm3) + AS2( lea WORD_REG(ax), [WORD_REG(dx)+WORD_REG(ax)+2*16]) + AS2( sub WORD_REG(ax), WORD_REG(si)) + ASL(0) + AS2( movdqa xmm0, [WORD_REG(ax)+WORD_REG(si)]) + AS2( movdqa XMMWORD_PTR [L_SUBKEYS+WORD_REG(si)], xmm0) + AS2( add WORD_REG(si), 16) + AS2( cmp WORD_REG(si), 16*12) + ASJ( jl, 0, b) + + // read subkeys 0, 1 and last + AS2( movdqa xmm4, [WORD_REG(ax)+WORD_REG(si)]) // last subkey + AS2( movdqa xmm1, [WORD_REG(dx)]) // subkey 0 + AS2( MOVD MM(1), [WORD_REG(dx)+4*4]) // 0,1,2,3 + AS2( mov ebx, [WORD_REG(dx)+5*4]) // 4,5,6,7 + AS2( mov ecx, [WORD_REG(dx)+6*4]) // 8,9,10,11 + AS2( mov edx, [WORD_REG(dx)+7*4]) // 12,13,14,15 + + // load table into cache + AS2( xor WORD_REG(ax), WORD_REG(ax)) + ASL(9) + AS2( mov esi, [AS_REG_7+WORD_REG(ax)]) + AS2( add WORD_REG(ax), WORD_REG(di)) + AS2( mov esi, [AS_REG_7+WORD_REG(ax)]) + AS2( add WORD_REG(ax), WORD_REG(di)) + AS2( mov esi, [AS_REG_7+WORD_REG(ax)]) + AS2( add WORD_REG(ax), WORD_REG(di)) + AS2( mov esi, [AS_REG_7+WORD_REG(ax)]) + AS2( add WORD_REG(ax), WORD_REG(di)) + AS2( cmp WORD_REG(ax), 2048) + ASJ( jl, 9, b) + AS1( lfence) + + AS2( test DWORD PTR [L_LENGTH], 1) + ASJ( jz, 8, f) + + // counter mode one-time setup + AS2( mov WORD_REG(si), [L_INBLOCKS]) + AS2( movdqu xmm2, [WORD_REG(si)]) // counter + AS2( pxor xmm2, xmm1) + AS2( psrldq xmm1, 14) + AS2( movd eax, xmm1) + AS2( mov al, BYTE PTR [WORD_REG(si)+15]) + AS2( MOVD MM(2), eax) +#if CRYPTOPP_BOOL_X86 + AS2( mov eax, 1) + AS2( movd mm3, eax) +#endif + + // partial first round, in: xmm2(15,14,13,12;11,10,9,8;7,6,5,4;3,2,1,0), out: mm1, ebx, ecx, edx + AS2( movd eax, xmm2) + AS2( psrldq xmm2, 4) + AS2( movd edi, xmm2) + AS2( psrldq xmm2, 4) + MXOR( 1, al, 0) // 0 + XOR( edx, ah, 1) // 1 + AS2( shr eax, 16) + XOR( ecx, al, 2) // 2 + XOR( ebx, ah, 3) // 3 + AS2( mov eax, edi) + AS2( movd edi, xmm2) + AS2( psrldq xmm2, 4) + XOR( ebx, al, 0) // 4 + MXOR( 1, ah, 1) // 5 + AS2( shr eax, 16) + XOR( edx, al, 2) // 6 + XOR( ecx, ah, 3) // 7 + AS2( mov eax, edi) + AS2( movd edi, xmm2) + XOR( ecx, al, 0) // 8 + XOR( ebx, ah, 1) // 9 + AS2( shr eax, 16) + MXOR( 1, al, 2) // 10 + XOR( edx, ah, 3) // 11 + AS2( mov eax, edi) + XOR( edx, al, 0) // 12 + XOR( ecx, ah, 1) // 13 + AS2( shr eax, 16) + XOR( ebx, al, 2) // 14 + AS2( psrldq xmm2, 3) + + // partial second round, in: ebx(4,5,6,7), ecx(8,9,10,11), edx(12,13,14,15), out: eax, ebx, edi, mm0 + AS2( mov eax, [L_KEY12+0*4]) + AS2( mov edi, [L_KEY12+2*4]) + AS2( MOVD MM(0), [L_KEY12+3*4]) + MXOR( 0, cl, 3) /* 11 */ + XOR( edi, bl, 3) /* 7 */ + MXOR( 0, bh, 2) /* 6 */ + AS2( shr ebx, 16) /* 4,5 */ + XOR( eax, bl, 1) /* 5 */ + MOV( ebx, bh, 0) /* 4 */ + AS2( xor ebx, [L_KEY12+1*4]) + XOR( eax, ch, 2) /* 10 */ + AS2( shr ecx, 16) /* 8,9 */ + XOR( eax, dl, 3) /* 15 */ + XOR( ebx, dh, 2) /* 14 */ + AS2( shr edx, 16) /* 12,13 */ + XOR( edi, ch, 0) /* 8 */ + XOR( ebx, cl, 1) /* 9 */ + XOR( edi, dl, 1) /* 13 */ + MXOR( 0, dh, 0) /* 12 */ + + AS2( movd ecx, xmm2) + AS2( MOVD edx, MM(1)) + AS2( MOVD [L_SAVED_X+3*4], MM(0)) + AS2( mov [L_SAVED_X+0*4], eax) + AS2( mov [L_SAVED_X+1*4], ebx) + AS2( mov [L_SAVED_X+2*4], edi) + ASJ( jmp, 5, f) + + ASL(3) + // non-counter mode per-block setup + AS2( MOVD MM(1), [L_KEY12+0*4]) // 0,1,2,3 + AS2( mov ebx, [L_KEY12+1*4]) // 4,5,6,7 + AS2( mov ecx, [L_KEY12+2*4]) // 8,9,10,11 + AS2( mov edx, [L_KEY12+3*4]) // 12,13,14,15 + ASL(8) + AS2( mov WORD_REG(ax), [L_INBLOCKS]) + AS2( movdqu xmm2, [WORD_REG(ax)]) + AS2( mov WORD_REG(si), [L_INXORBLOCKS]) + AS2( movdqu xmm5, [WORD_REG(si)]) + AS2( pxor xmm2, xmm1) + AS2( pxor xmm2, xmm5) + + // first round, in: xmm2(15,14,13,12;11,10,9,8;7,6,5,4;3,2,1,0), out: eax, ebx, ecx, edx + AS2( movd eax, xmm2) + AS2( psrldq xmm2, 4) + AS2( movd edi, xmm2) + AS2( psrldq xmm2, 4) + MXOR( 1, al, 0) // 0 + XOR( edx, ah, 1) // 1 + AS2( shr eax, 16) + XOR( ecx, al, 2) // 2 + XOR( ebx, ah, 3) // 3 + AS2( mov eax, edi) + AS2( movd edi, xmm2) + AS2( psrldq xmm2, 4) + XOR( ebx, al, 0) // 4 + MXOR( 1, ah, 1) // 5 + AS2( shr eax, 16) + XOR( edx, al, 2) // 6 + XOR( ecx, ah, 3) // 7 + AS2( mov eax, edi) + AS2( movd edi, xmm2) + XOR( ecx, al, 0) // 8 + XOR( ebx, ah, 1) // 9 + AS2( shr eax, 16) + MXOR( 1, al, 2) // 10 + XOR( edx, ah, 3) // 11 + AS2( mov eax, edi) + XOR( edx, al, 0) // 12 + XOR( ecx, ah, 1) // 13 + AS2( shr eax, 16) + XOR( ebx, al, 2) // 14 + MXOR( 1, ah, 3) // 15 + AS2( MOVD eax, MM(1)) + + AS2( add L_REG, [L_KEYS_BEGIN]) + AS2( add L_REG, 4*16) + ASJ( jmp, 2, f) + + ASL(1) + // counter-mode per-block setup + AS2( MOVD ecx, MM(2)) + AS2( MOVD edx, MM(1)) + AS2( mov eax, [L_SAVED_X+0*4]) + AS2( mov ebx, [L_SAVED_X+1*4]) + AS2( xor cl, ch) + AS2( and WORD_REG(cx), 255) + ASL(5) +#if CRYPTOPP_BOOL_X86 + AS2( paddb MM(2), mm3) +#else + AS2( add MM(2), 1) +#endif + // remaining part of second round, in: edx(previous round),esi(keyed counter byte) eax,ebx,[L_SAVED_X+2*4],[L_SAVED_X+3*4], out: eax,ebx,ecx,edx + AS2( xor edx, DWORD PTR [AS_REG_7+WORD_REG(cx)*8+3]) + XOR( ebx, dl, 3) + MOV( ecx, dh, 2) + AS2( shr edx, 16) + AS2( xor ecx, [L_SAVED_X+2*4]) + XOR( eax, dh, 0) + MOV( edx, dl, 1) + AS2( xor edx, [L_SAVED_X+3*4]) + + AS2( add L_REG, [L_KEYS_BEGIN]) + AS2( add L_REG, 3*16) + ASJ( jmp, 4, f) + +// in: eax(0,1,2,3), ebx(4,5,6,7), ecx(8,9,10,11), edx(12,13,14,15) +// out: eax, ebx, edi, mm0 +#define ROUND() \ + MXOR( 0, cl, 3) /* 11 */\ + AS2( mov cl, al) /* 8,9,10,3 */\ + XOR( edi, ah, 2) /* 2 */\ + AS2( shr eax, 16) /* 0,1 */\ + XOR( edi, bl, 3) /* 7 */\ + MXOR( 0, bh, 2) /* 6 */\ + AS2( shr ebx, 16) /* 4,5 */\ + MXOR( 0, al, 1) /* 1 */\ + MOV( eax, ah, 0) /* 0 */\ + XOR( eax, bl, 1) /* 5 */\ + MOV( ebx, bh, 0) /* 4 */\ + XOR( eax, ch, 2) /* 10 */\ + XOR( ebx, cl, 3) /* 3 */\ + AS2( shr ecx, 16) /* 8,9 */\ + XOR( eax, dl, 3) /* 15 */\ + XOR( ebx, dh, 2) /* 14 */\ + AS2( shr edx, 16) /* 12,13 */\ + XOR( edi, ch, 0) /* 8 */\ + XOR( ebx, cl, 1) /* 9 */\ + XOR( edi, dl, 1) /* 13 */\ + MXOR( 0, dh, 0) /* 12 */\ + + ASL(2) // 2-round loop + AS2( MOVD MM(0), [L_SUBKEYS-4*16+3*4]) + AS2( mov edi, [L_SUBKEYS-4*16+2*4]) + ROUND() + AS2( mov ecx, edi) + AS2( xor eax, [L_SUBKEYS-4*16+0*4]) + AS2( xor ebx, [L_SUBKEYS-4*16+1*4]) + AS2( MOVD edx, MM(0)) + + ASL(4) + AS2( MOVD MM(0), [L_SUBKEYS-4*16+7*4]) + AS2( mov edi, [L_SUBKEYS-4*16+6*4]) + ROUND() + AS2( mov ecx, edi) + AS2( xor eax, [L_SUBKEYS-4*16+4*4]) + AS2( xor ebx, [L_SUBKEYS-4*16+5*4]) + AS2( MOVD edx, MM(0)) + + AS2( add L_REG, 32) + AS2( test L_REG, 255) + ASJ( jnz, 2, b) + AS2( sub L_REG, 16*16) + +#define LAST(a, b, c) \ + AS2( movzx esi, a )\ + AS2( movzx edi, BYTE PTR [AS_REG_7+WORD_REG(si)*8+1] )\ + AS2( movzx esi, b )\ + AS2( xor edi, DWORD PTR [AS_REG_7+WORD_REG(si)*8+0] )\ + AS2( mov WORD PTR [L_LASTROUND+c], di )\ + + // last round + LAST(ch, dl, 2) + LAST(dh, al, 6) + AS2( shr edx, 16) + LAST(ah, bl, 10) + AS2( shr eax, 16) + LAST(bh, cl, 14) + AS2( shr ebx, 16) + LAST(dh, al, 12) + AS2( shr ecx, 16) + LAST(ah, bl, 0) + LAST(bh, cl, 4) + LAST(ch, dl, 8) + + AS2( mov WORD_REG(ax), [L_OUTXORBLOCKS]) + AS2( mov WORD_REG(bx), [L_OUTBLOCKS]) + + AS2( mov WORD_REG(cx), [L_LENGTH]) + AS2( sub WORD_REG(cx), 16) + + AS2( movdqu xmm2, [WORD_REG(ax)]) + AS2( pxor xmm2, xmm4) + +#if CRYPTOPP_BOOL_X86 + AS2( movdqa xmm0, [L_INCREMENTS]) + AS2( paddd xmm0, [L_INBLOCKS]) + AS2( movdqa [L_INBLOCKS], xmm0) +#else + AS2( movdqa xmm0, [L_INCREMENTS+16]) + AS2( paddq xmm0, [L_INBLOCKS+16]) + AS2( movdqa [L_INBLOCKS+16], xmm0) +#endif + + AS2( pxor xmm2, [L_LASTROUND]) + AS2( movdqu [WORD_REG(bx)], xmm2) + + ASJ( jle, 7, f) + AS2( mov [L_LENGTH], WORD_REG(cx)) + AS2( test WORD_REG(cx), 1) + ASJ( jnz, 1, b) +#if CRYPTOPP_BOOL_X64 + AS2( movdqa xmm0, [L_INCREMENTS]) + AS2( paddq xmm0, [L_INBLOCKS]) + AS2( movdqa [L_INBLOCKS], xmm0) +#endif + ASJ( jmp, 3, b) + + ASL(7) + // erase keys on stack + AS2( xorps xmm0, xmm0) + AS2( lea WORD_REG(ax), [L_SUBKEYS+7*16]) + AS2( movaps [WORD_REG(ax)-7*16], xmm0) + AS2( movaps [WORD_REG(ax)-6*16], xmm0) + AS2( movaps [WORD_REG(ax)-5*16], xmm0) + AS2( movaps [WORD_REG(ax)-4*16], xmm0) + AS2( movaps [WORD_REG(ax)-3*16], xmm0) + AS2( movaps [WORD_REG(ax)-2*16], xmm0) + AS2( movaps [WORD_REG(ax)-1*16], xmm0) + AS2( movaps [WORD_REG(ax)+0*16], xmm0) + AS2( movaps [WORD_REG(ax)+1*16], xmm0) + AS2( movaps [WORD_REG(ax)+2*16], xmm0) + AS2( movaps [WORD_REG(ax)+3*16], xmm0) + AS2( movaps [WORD_REG(ax)+4*16], xmm0) + AS2( movaps [WORD_REG(ax)+5*16], xmm0) + AS2( movaps [WORD_REG(ax)+6*16], xmm0) +#if CRYPTOPP_BOOL_X86 + AS2( mov esp, [L_SP]) + AS1( emms) +#endif + AS_POP_IF86(bp) +#if !defined(_MSC_VER) || (_MSC_VER < 1400) + AS_POP_IF86(bx) +#endif +#if defined(_MSC_VER) && CRYPTOPP_BOOL_X86 + AS_POP_IF86(di) + AS_POP_IF86(si) + AS1(ret) +#endif +#ifdef CRYPTOPP_GENERATE_X64_MASM + pop r12 + pop rbx + pop rdi + pop rsi + ret + Rijndael_Enc_AdvancedProcessBlocks ENDP +#endif +#ifdef __GNUC__ + ".att_syntax prefix;" + : + : "c" (locals), "d" (k), "S" (Te), "D" (g_cacheLineSize) + : "memory", "cc", "%eax" + #if CRYPTOPP_BOOL_X64 + , "%rbx", "%r8", "%r9", "%r10", "%r11", "%r12" + #endif + ); +#endif +} + +#endif + +#ifndef CRYPTOPP_GENERATE_X64_MASM + +#ifdef CRYPTOPP_X64_MASM_AVAILABLE +extern "C" { +void Rijndael_Enc_AdvancedProcessBlocks(void *locals, const word32 *k); +} +#endif + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) + +static inline bool AliasedWithTable(const byte *begin, const byte *end) +{ + size_t s0 = size_t(begin)%4096, s1 = size_t(end)%4096; + size_t t0 = size_t(Te)%4096, t1 = (size_t(Te)+sizeof(Te))%4096; + if (t1 > t0) + return (s0 >= t0 && s0 < t1) || (s1 > t0 && s1 <= t1); + else + return (s0 < t1 || s1 <= t1) || (s0 >= t0 || s1 > t0); +} + +size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const +{ + if (length < BLOCKSIZE) + return length; + + if (HasSSE2()) + { + struct Locals + { + word32 subkeys[4*12], workspace[8]; + const byte *inBlocks, *inXorBlocks, *outXorBlocks; + byte *outBlocks; + size_t inIncrement, inXorIncrement, outXorIncrement, outIncrement; + size_t regSpill, lengthAndCounterFlag, keysBegin; + }; + + size_t increment = BLOCKSIZE; + const byte* zeros = (byte *)(Te+256); + byte *space; + + do { + space = (byte *)alloca(255+sizeof(Locals)); + space += (256-(size_t)space%256)%256; + } + while (AliasedWithTable(space, space+sizeof(Locals))); + + if (flags & BT_ReverseDirection) + { + assert(length % BLOCKSIZE == 0); + inBlocks += length - BLOCKSIZE; + xorBlocks += length - BLOCKSIZE; + outBlocks += length - BLOCKSIZE; + increment = 0-increment; + } + + Locals &locals = *(Locals *)space; + + locals.inBlocks = inBlocks; + locals.inXorBlocks = (flags & BT_XorInput) && xorBlocks ? xorBlocks : zeros; + locals.outXorBlocks = (flags & BT_XorInput) || !xorBlocks ? zeros : xorBlocks; + locals.outBlocks = outBlocks; + + locals.inIncrement = (flags & BT_DontIncrementInOutPointers) ? 0 : increment; + locals.inXorIncrement = (flags & BT_XorInput) && xorBlocks ? increment : 0; + locals.outXorIncrement = (flags & BT_XorInput) || !xorBlocks ? 0 : increment; + locals.outIncrement = (flags & BT_DontIncrementInOutPointers) ? 0 : increment; + + locals.lengthAndCounterFlag = length - (length%16) - bool(flags & BT_InBlockIsCounter); + int keysToCopy = m_rounds - (flags & BT_InBlockIsCounter ? 3 : 2); + locals.keysBegin = (12-keysToCopy)*16; + + Rijndael_Enc_AdvancedProcessBlocks(&locals, m_key); + return length%16; + } + else + return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags); +} + +#endif + +NAMESPACE_END + +#endif +#endif diff --git a/cryptopp/rijndael.h b/cryptopp/rijndael.h new file mode 100644 index 0000000..483b8dd --- /dev/null +++ b/cryptopp/rijndael.h @@ -0,0 +1,65 @@ +#ifndef CRYPTOPP_RIJNDAEL_H +#define CRYPTOPP_RIJNDAEL_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct Rijndael_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8> +{ + CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return CRYPTOPP_RIJNDAEL_NAME;} +}; + +/// Rijndael +class CRYPTOPP_DLL Rijndael : public Rijndael_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + static void FillEncTable(); + static void FillDecTable(); + + // VS2005 workaround: have to put these on seperate lines, or error C2487 is triggered in DLL build + static const byte Se[256]; + static const byte Sd[256]; + + static const word32 rcon[]; + + unsigned int m_rounds; + FixedSizeAlignedSecBlock m_key; + }; + + class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) + size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const; +#endif + }; + + class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef Rijndael::Encryption RijndaelEncryption; +typedef Rijndael::Decryption RijndaelDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/ripemd.cpp b/cryptopp/ripemd.cpp new file mode 100644 index 0000000..3476aa8 --- /dev/null +++ b/cryptopp/ripemd.cpp @@ -0,0 +1,803 @@ +// ripemd.cpp +// RIPEMD-160 written and placed in the public domain by Wei Dai +// RIPEMD-320, RIPEMD-128, RIPEMD-256 written by Kevin Springle +// and also placed in the public domain + +#include "pch.h" +#include "ripemd.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +#define F(x, y, z) (x ^ y ^ z) +#define G(x, y, z) (z ^ (x & (y^z))) +#define H(x, y, z) (z ^ (x | ~y)) +#define I(x, y, z) (y ^ (z & (x^y))) +#define J(x, y, z) (x ^ (y | ~z)) + +#define k0 0 +#define k1 0x5a827999UL +#define k2 0x6ed9eba1UL +#define k3 0x8f1bbcdcUL +#define k4 0xa953fd4eUL +#define k5 0x50a28be6UL +#define k6 0x5c4dd124UL +#define k7 0x6d703ef3UL +#define k8 0x7a6d76e9UL +#define k9 0 + +// ************************************************************* + +// for 160 and 320 +#define Subround(f, a, b, c, d, e, x, s, k) \ + a += f(b, c, d) + x + k;\ + a = rotlFixed((word32)a, s) + e;\ + c = rotlFixed((word32)c, 10U) + +void RIPEMD160::InitState(HashWordType *state) +{ + state[0] = 0x67452301L; + state[1] = 0xefcdab89L; + state[2] = 0x98badcfeL; + state[3] = 0x10325476L; + state[4] = 0xc3d2e1f0L; +} + +void RIPEMD160::Transform (word32 *digest, const word32 *X) +{ + unsigned long a1, b1, c1, d1, e1, a2, b2, c2, d2, e2; + a1 = a2 = digest[0]; + b1 = b2 = digest[1]; + c1 = c2 = digest[2]; + d1 = d2 = digest[3]; + e1 = e2 = digest[4]; + + Subround(F, a1, b1, c1, d1, e1, X[ 0], 11, k0); + Subround(F, e1, a1, b1, c1, d1, X[ 1], 14, k0); + Subround(F, d1, e1, a1, b1, c1, X[ 2], 15, k0); + Subround(F, c1, d1, e1, a1, b1, X[ 3], 12, k0); + Subround(F, b1, c1, d1, e1, a1, X[ 4], 5, k0); + Subround(F, a1, b1, c1, d1, e1, X[ 5], 8, k0); + Subround(F, e1, a1, b1, c1, d1, X[ 6], 7, k0); + Subround(F, d1, e1, a1, b1, c1, X[ 7], 9, k0); + Subround(F, c1, d1, e1, a1, b1, X[ 8], 11, k0); + Subround(F, b1, c1, d1, e1, a1, X[ 9], 13, k0); + Subround(F, a1, b1, c1, d1, e1, X[10], 14, k0); + Subround(F, e1, a1, b1, c1, d1, X[11], 15, k0); + Subround(F, d1, e1, a1, b1, c1, X[12], 6, k0); + Subround(F, c1, d1, e1, a1, b1, X[13], 7, k0); + Subround(F, b1, c1, d1, e1, a1, X[14], 9, k0); + Subround(F, a1, b1, c1, d1, e1, X[15], 8, k0); + + Subround(G, e1, a1, b1, c1, d1, X[ 7], 7, k1); + Subround(G, d1, e1, a1, b1, c1, X[ 4], 6, k1); + Subround(G, c1, d1, e1, a1, b1, X[13], 8, k1); + Subround(G, b1, c1, d1, e1, a1, X[ 1], 13, k1); + Subround(G, a1, b1, c1, d1, e1, X[10], 11, k1); + Subround(G, e1, a1, b1, c1, d1, X[ 6], 9, k1); + Subround(G, d1, e1, a1, b1, c1, X[15], 7, k1); + Subround(G, c1, d1, e1, a1, b1, X[ 3], 15, k1); + Subround(G, b1, c1, d1, e1, a1, X[12], 7, k1); + Subround(G, a1, b1, c1, d1, e1, X[ 0], 12, k1); + Subround(G, e1, a1, b1, c1, d1, X[ 9], 15, k1); + Subround(G, d1, e1, a1, b1, c1, X[ 5], 9, k1); + Subround(G, c1, d1, e1, a1, b1, X[ 2], 11, k1); + Subround(G, b1, c1, d1, e1, a1, X[14], 7, k1); + Subround(G, a1, b1, c1, d1, e1, X[11], 13, k1); + Subround(G, e1, a1, b1, c1, d1, X[ 8], 12, k1); + + Subround(H, d1, e1, a1, b1, c1, X[ 3], 11, k2); + Subround(H, c1, d1, e1, a1, b1, X[10], 13, k2); + Subround(H, b1, c1, d1, e1, a1, X[14], 6, k2); + Subround(H, a1, b1, c1, d1, e1, X[ 4], 7, k2); + Subround(H, e1, a1, b1, c1, d1, X[ 9], 14, k2); + Subround(H, d1, e1, a1, b1, c1, X[15], 9, k2); + Subround(H, c1, d1, e1, a1, b1, X[ 8], 13, k2); + Subround(H, b1, c1, d1, e1, a1, X[ 1], 15, k2); + Subround(H, a1, b1, c1, d1, e1, X[ 2], 14, k2); + Subround(H, e1, a1, b1, c1, d1, X[ 7], 8, k2); + Subround(H, d1, e1, a1, b1, c1, X[ 0], 13, k2); + Subround(H, c1, d1, e1, a1, b1, X[ 6], 6, k2); + Subround(H, b1, c1, d1, e1, a1, X[13], 5, k2); + Subround(H, a1, b1, c1, d1, e1, X[11], 12, k2); + Subround(H, e1, a1, b1, c1, d1, X[ 5], 7, k2); + Subround(H, d1, e1, a1, b1, c1, X[12], 5, k2); + + Subround(I, c1, d1, e1, a1, b1, X[ 1], 11, k3); + Subround(I, b1, c1, d1, e1, a1, X[ 9], 12, k3); + Subround(I, a1, b1, c1, d1, e1, X[11], 14, k3); + Subround(I, e1, a1, b1, c1, d1, X[10], 15, k3); + Subround(I, d1, e1, a1, b1, c1, X[ 0], 14, k3); + Subround(I, c1, d1, e1, a1, b1, X[ 8], 15, k3); + Subround(I, b1, c1, d1, e1, a1, X[12], 9, k3); + Subround(I, a1, b1, c1, d1, e1, X[ 4], 8, k3); + Subround(I, e1, a1, b1, c1, d1, X[13], 9, k3); + Subround(I, d1, e1, a1, b1, c1, X[ 3], 14, k3); + Subround(I, c1, d1, e1, a1, b1, X[ 7], 5, k3); + Subround(I, b1, c1, d1, e1, a1, X[15], 6, k3); + Subround(I, a1, b1, c1, d1, e1, X[14], 8, k3); + Subround(I, e1, a1, b1, c1, d1, X[ 5], 6, k3); + Subround(I, d1, e1, a1, b1, c1, X[ 6], 5, k3); + Subround(I, c1, d1, e1, a1, b1, X[ 2], 12, k3); + + Subround(J, b1, c1, d1, e1, a1, X[ 4], 9, k4); + Subround(J, a1, b1, c1, d1, e1, X[ 0], 15, k4); + Subround(J, e1, a1, b1, c1, d1, X[ 5], 5, k4); + Subround(J, d1, e1, a1, b1, c1, X[ 9], 11, k4); + Subround(J, c1, d1, e1, a1, b1, X[ 7], 6, k4); + Subround(J, b1, c1, d1, e1, a1, X[12], 8, k4); + Subround(J, a1, b1, c1, d1, e1, X[ 2], 13, k4); + Subround(J, e1, a1, b1, c1, d1, X[10], 12, k4); + Subround(J, d1, e1, a1, b1, c1, X[14], 5, k4); + Subround(J, c1, d1, e1, a1, b1, X[ 1], 12, k4); + Subround(J, b1, c1, d1, e1, a1, X[ 3], 13, k4); + Subround(J, a1, b1, c1, d1, e1, X[ 8], 14, k4); + Subround(J, e1, a1, b1, c1, d1, X[11], 11, k4); + Subround(J, d1, e1, a1, b1, c1, X[ 6], 8, k4); + Subround(J, c1, d1, e1, a1, b1, X[15], 5, k4); + Subround(J, b1, c1, d1, e1, a1, X[13], 6, k4); + + Subround(J, a2, b2, c2, d2, e2, X[ 5], 8, k5); + Subround(J, e2, a2, b2, c2, d2, X[14], 9, k5); + Subround(J, d2, e2, a2, b2, c2, X[ 7], 9, k5); + Subround(J, c2, d2, e2, a2, b2, X[ 0], 11, k5); + Subround(J, b2, c2, d2, e2, a2, X[ 9], 13, k5); + Subround(J, a2, b2, c2, d2, e2, X[ 2], 15, k5); + Subround(J, e2, a2, b2, c2, d2, X[11], 15, k5); + Subround(J, d2, e2, a2, b2, c2, X[ 4], 5, k5); + Subround(J, c2, d2, e2, a2, b2, X[13], 7, k5); + Subround(J, b2, c2, d2, e2, a2, X[ 6], 7, k5); + Subround(J, a2, b2, c2, d2, e2, X[15], 8, k5); + Subround(J, e2, a2, b2, c2, d2, X[ 8], 11, k5); + Subround(J, d2, e2, a2, b2, c2, X[ 1], 14, k5); + Subround(J, c2, d2, e2, a2, b2, X[10], 14, k5); + Subround(J, b2, c2, d2, e2, a2, X[ 3], 12, k5); + Subround(J, a2, b2, c2, d2, e2, X[12], 6, k5); + + Subround(I, e2, a2, b2, c2, d2, X[ 6], 9, k6); + Subround(I, d2, e2, a2, b2, c2, X[11], 13, k6); + Subround(I, c2, d2, e2, a2, b2, X[ 3], 15, k6); + Subround(I, b2, c2, d2, e2, a2, X[ 7], 7, k6); + Subround(I, a2, b2, c2, d2, e2, X[ 0], 12, k6); + Subround(I, e2, a2, b2, c2, d2, X[13], 8, k6); + Subround(I, d2, e2, a2, b2, c2, X[ 5], 9, k6); + Subround(I, c2, d2, e2, a2, b2, X[10], 11, k6); + Subround(I, b2, c2, d2, e2, a2, X[14], 7, k6); + Subround(I, a2, b2, c2, d2, e2, X[15], 7, k6); + Subround(I, e2, a2, b2, c2, d2, X[ 8], 12, k6); + Subround(I, d2, e2, a2, b2, c2, X[12], 7, k6); + Subround(I, c2, d2, e2, a2, b2, X[ 4], 6, k6); + Subround(I, b2, c2, d2, e2, a2, X[ 9], 15, k6); + Subround(I, a2, b2, c2, d2, e2, X[ 1], 13, k6); + Subround(I, e2, a2, b2, c2, d2, X[ 2], 11, k6); + + Subround(H, d2, e2, a2, b2, c2, X[15], 9, k7); + Subround(H, c2, d2, e2, a2, b2, X[ 5], 7, k7); + Subround(H, b2, c2, d2, e2, a2, X[ 1], 15, k7); + Subround(H, a2, b2, c2, d2, e2, X[ 3], 11, k7); + Subround(H, e2, a2, b2, c2, d2, X[ 7], 8, k7); + Subround(H, d2, e2, a2, b2, c2, X[14], 6, k7); + Subround(H, c2, d2, e2, a2, b2, X[ 6], 6, k7); + Subround(H, b2, c2, d2, e2, a2, X[ 9], 14, k7); + Subround(H, a2, b2, c2, d2, e2, X[11], 12, k7); + Subround(H, e2, a2, b2, c2, d2, X[ 8], 13, k7); + Subround(H, d2, e2, a2, b2, c2, X[12], 5, k7); + Subround(H, c2, d2, e2, a2, b2, X[ 2], 14, k7); + Subround(H, b2, c2, d2, e2, a2, X[10], 13, k7); + Subround(H, a2, b2, c2, d2, e2, X[ 0], 13, k7); + Subround(H, e2, a2, b2, c2, d2, X[ 4], 7, k7); + Subround(H, d2, e2, a2, b2, c2, X[13], 5, k7); + + Subround(G, c2, d2, e2, a2, b2, X[ 8], 15, k8); + Subround(G, b2, c2, d2, e2, a2, X[ 6], 5, k8); + Subround(G, a2, b2, c2, d2, e2, X[ 4], 8, k8); + Subround(G, e2, a2, b2, c2, d2, X[ 1], 11, k8); + Subround(G, d2, e2, a2, b2, c2, X[ 3], 14, k8); + Subround(G, c2, d2, e2, a2, b2, X[11], 14, k8); + Subround(G, b2, c2, d2, e2, a2, X[15], 6, k8); + Subround(G, a2, b2, c2, d2, e2, X[ 0], 14, k8); + Subround(G, e2, a2, b2, c2, d2, X[ 5], 6, k8); + Subround(G, d2, e2, a2, b2, c2, X[12], 9, k8); + Subround(G, c2, d2, e2, a2, b2, X[ 2], 12, k8); + Subround(G, b2, c2, d2, e2, a2, X[13], 9, k8); + Subround(G, a2, b2, c2, d2, e2, X[ 9], 12, k8); + Subround(G, e2, a2, b2, c2, d2, X[ 7], 5, k8); + Subround(G, d2, e2, a2, b2, c2, X[10], 15, k8); + Subround(G, c2, d2, e2, a2, b2, X[14], 8, k8); + + Subround(F, b2, c2, d2, e2, a2, X[12], 8, k9); + Subround(F, a2, b2, c2, d2, e2, X[15], 5, k9); + Subround(F, e2, a2, b2, c2, d2, X[10], 12, k9); + Subround(F, d2, e2, a2, b2, c2, X[ 4], 9, k9); + Subround(F, c2, d2, e2, a2, b2, X[ 1], 12, k9); + Subround(F, b2, c2, d2, e2, a2, X[ 5], 5, k9); + Subround(F, a2, b2, c2, d2, e2, X[ 8], 14, k9); + Subround(F, e2, a2, b2, c2, d2, X[ 7], 6, k9); + Subround(F, d2, e2, a2, b2, c2, X[ 6], 8, k9); + Subround(F, c2, d2, e2, a2, b2, X[ 2], 13, k9); + Subround(F, b2, c2, d2, e2, a2, X[13], 6, k9); + Subround(F, a2, b2, c2, d2, e2, X[14], 5, k9); + Subround(F, e2, a2, b2, c2, d2, X[ 0], 15, k9); + Subround(F, d2, e2, a2, b2, c2, X[ 3], 13, k9); + Subround(F, c2, d2, e2, a2, b2, X[ 9], 11, k9); + Subround(F, b2, c2, d2, e2, a2, X[11], 11, k9); + + c1 = digest[1] + c1 + d2; + digest[1] = digest[2] + d1 + e2; + digest[2] = digest[3] + e1 + a2; + digest[3] = digest[4] + a1 + b2; + digest[4] = digest[0] + b1 + c2; + digest[0] = c1; +} + +// ************************************************************* + +void RIPEMD320::InitState(HashWordType *state) +{ + state[0] = 0x67452301L; + state[1] = 0xefcdab89L; + state[2] = 0x98badcfeL; + state[3] = 0x10325476L; + state[4] = 0xc3d2e1f0L; + state[5] = 0x76543210L; + state[6] = 0xfedcba98L; + state[7] = 0x89abcdefL; + state[8] = 0x01234567L; + state[9] = 0x3c2d1e0fL; +} + +void RIPEMD320::Transform (word32 *digest, const word32 *X) +{ + unsigned long a1, b1, c1, d1, e1, a2, b2, c2, d2, e2, t; + a1 = digest[0]; + b1 = digest[1]; + c1 = digest[2]; + d1 = digest[3]; + e1 = digest[4]; + a2 = digest[5]; + b2 = digest[6]; + c2 = digest[7]; + d2 = digest[8]; + e2 = digest[9]; + + Subround(F, a1, b1, c1, d1, e1, X[ 0], 11, k0); + Subround(F, e1, a1, b1, c1, d1, X[ 1], 14, k0); + Subround(F, d1, e1, a1, b1, c1, X[ 2], 15, k0); + Subround(F, c1, d1, e1, a1, b1, X[ 3], 12, k0); + Subround(F, b1, c1, d1, e1, a1, X[ 4], 5, k0); + Subround(F, a1, b1, c1, d1, e1, X[ 5], 8, k0); + Subround(F, e1, a1, b1, c1, d1, X[ 6], 7, k0); + Subround(F, d1, e1, a1, b1, c1, X[ 7], 9, k0); + Subround(F, c1, d1, e1, a1, b1, X[ 8], 11, k0); + Subround(F, b1, c1, d1, e1, a1, X[ 9], 13, k0); + Subround(F, a1, b1, c1, d1, e1, X[10], 14, k0); + Subround(F, e1, a1, b1, c1, d1, X[11], 15, k0); + Subround(F, d1, e1, a1, b1, c1, X[12], 6, k0); + Subround(F, c1, d1, e1, a1, b1, X[13], 7, k0); + Subround(F, b1, c1, d1, e1, a1, X[14], 9, k0); + Subround(F, a1, b1, c1, d1, e1, X[15], 8, k0); + + Subround(J, a2, b2, c2, d2, e2, X[ 5], 8, k5); + Subround(J, e2, a2, b2, c2, d2, X[14], 9, k5); + Subround(J, d2, e2, a2, b2, c2, X[ 7], 9, k5); + Subround(J, c2, d2, e2, a2, b2, X[ 0], 11, k5); + Subround(J, b2, c2, d2, e2, a2, X[ 9], 13, k5); + Subround(J, a2, b2, c2, d2, e2, X[ 2], 15, k5); + Subround(J, e2, a2, b2, c2, d2, X[11], 15, k5); + Subround(J, d2, e2, a2, b2, c2, X[ 4], 5, k5); + Subround(J, c2, d2, e2, a2, b2, X[13], 7, k5); + Subround(J, b2, c2, d2, e2, a2, X[ 6], 7, k5); + Subround(J, a2, b2, c2, d2, e2, X[15], 8, k5); + Subround(J, e2, a2, b2, c2, d2, X[ 8], 11, k5); + Subround(J, d2, e2, a2, b2, c2, X[ 1], 14, k5); + Subround(J, c2, d2, e2, a2, b2, X[10], 14, k5); + Subround(J, b2, c2, d2, e2, a2, X[ 3], 12, k5); + Subround(J, a2, b2, c2, d2, e2, X[12], 6, k5); + + t = a1; a1 = a2; a2 = t; + + Subround(G, e1, a1, b1, c1, d1, X[ 7], 7, k1); + Subround(G, d1, e1, a1, b1, c1, X[ 4], 6, k1); + Subround(G, c1, d1, e1, a1, b1, X[13], 8, k1); + Subround(G, b1, c1, d1, e1, a1, X[ 1], 13, k1); + Subround(G, a1, b1, c1, d1, e1, X[10], 11, k1); + Subround(G, e1, a1, b1, c1, d1, X[ 6], 9, k1); + Subround(G, d1, e1, a1, b1, c1, X[15], 7, k1); + Subround(G, c1, d1, e1, a1, b1, X[ 3], 15, k1); + Subround(G, b1, c1, d1, e1, a1, X[12], 7, k1); + Subround(G, a1, b1, c1, d1, e1, X[ 0], 12, k1); + Subround(G, e1, a1, b1, c1, d1, X[ 9], 15, k1); + Subround(G, d1, e1, a1, b1, c1, X[ 5], 9, k1); + Subround(G, c1, d1, e1, a1, b1, X[ 2], 11, k1); + Subround(G, b1, c1, d1, e1, a1, X[14], 7, k1); + Subround(G, a1, b1, c1, d1, e1, X[11], 13, k1); + Subround(G, e1, a1, b1, c1, d1, X[ 8], 12, k1); + + Subround(I, e2, a2, b2, c2, d2, X[ 6], 9, k6); + Subround(I, d2, e2, a2, b2, c2, X[11], 13, k6); + Subround(I, c2, d2, e2, a2, b2, X[ 3], 15, k6); + Subround(I, b2, c2, d2, e2, a2, X[ 7], 7, k6); + Subround(I, a2, b2, c2, d2, e2, X[ 0], 12, k6); + Subround(I, e2, a2, b2, c2, d2, X[13], 8, k6); + Subround(I, d2, e2, a2, b2, c2, X[ 5], 9, k6); + Subround(I, c2, d2, e2, a2, b2, X[10], 11, k6); + Subround(I, b2, c2, d2, e2, a2, X[14], 7, k6); + Subround(I, a2, b2, c2, d2, e2, X[15], 7, k6); + Subround(I, e2, a2, b2, c2, d2, X[ 8], 12, k6); + Subround(I, d2, e2, a2, b2, c2, X[12], 7, k6); + Subround(I, c2, d2, e2, a2, b2, X[ 4], 6, k6); + Subround(I, b2, c2, d2, e2, a2, X[ 9], 15, k6); + Subround(I, a2, b2, c2, d2, e2, X[ 1], 13, k6); + Subround(I, e2, a2, b2, c2, d2, X[ 2], 11, k6); + + t = b1; b1 = b2; b2 = t; + + Subround(H, d1, e1, a1, b1, c1, X[ 3], 11, k2); + Subround(H, c1, d1, e1, a1, b1, X[10], 13, k2); + Subround(H, b1, c1, d1, e1, a1, X[14], 6, k2); + Subround(H, a1, b1, c1, d1, e1, X[ 4], 7, k2); + Subround(H, e1, a1, b1, c1, d1, X[ 9], 14, k2); + Subround(H, d1, e1, a1, b1, c1, X[15], 9, k2); + Subround(H, c1, d1, e1, a1, b1, X[ 8], 13, k2); + Subround(H, b1, c1, d1, e1, a1, X[ 1], 15, k2); + Subround(H, a1, b1, c1, d1, e1, X[ 2], 14, k2); + Subround(H, e1, a1, b1, c1, d1, X[ 7], 8, k2); + Subround(H, d1, e1, a1, b1, c1, X[ 0], 13, k2); + Subround(H, c1, d1, e1, a1, b1, X[ 6], 6, k2); + Subround(H, b1, c1, d1, e1, a1, X[13], 5, k2); + Subround(H, a1, b1, c1, d1, e1, X[11], 12, k2); + Subround(H, e1, a1, b1, c1, d1, X[ 5], 7, k2); + Subround(H, d1, e1, a1, b1, c1, X[12], 5, k2); + + Subround(H, d2, e2, a2, b2, c2, X[15], 9, k7); + Subround(H, c2, d2, e2, a2, b2, X[ 5], 7, k7); + Subround(H, b2, c2, d2, e2, a2, X[ 1], 15, k7); + Subround(H, a2, b2, c2, d2, e2, X[ 3], 11, k7); + Subround(H, e2, a2, b2, c2, d2, X[ 7], 8, k7); + Subround(H, d2, e2, a2, b2, c2, X[14], 6, k7); + Subround(H, c2, d2, e2, a2, b2, X[ 6], 6, k7); + Subround(H, b2, c2, d2, e2, a2, X[ 9], 14, k7); + Subround(H, a2, b2, c2, d2, e2, X[11], 12, k7); + Subround(H, e2, a2, b2, c2, d2, X[ 8], 13, k7); + Subround(H, d2, e2, a2, b2, c2, X[12], 5, k7); + Subround(H, c2, d2, e2, a2, b2, X[ 2], 14, k7); + Subround(H, b2, c2, d2, e2, a2, X[10], 13, k7); + Subround(H, a2, b2, c2, d2, e2, X[ 0], 13, k7); + Subround(H, e2, a2, b2, c2, d2, X[ 4], 7, k7); + Subround(H, d2, e2, a2, b2, c2, X[13], 5, k7); + + t = c1; c1 = c2; c2 = t; + + Subround(I, c1, d1, e1, a1, b1, X[ 1], 11, k3); + Subround(I, b1, c1, d1, e1, a1, X[ 9], 12, k3); + Subround(I, a1, b1, c1, d1, e1, X[11], 14, k3); + Subround(I, e1, a1, b1, c1, d1, X[10], 15, k3); + Subround(I, d1, e1, a1, b1, c1, X[ 0], 14, k3); + Subround(I, c1, d1, e1, a1, b1, X[ 8], 15, k3); + Subround(I, b1, c1, d1, e1, a1, X[12], 9, k3); + Subround(I, a1, b1, c1, d1, e1, X[ 4], 8, k3); + Subround(I, e1, a1, b1, c1, d1, X[13], 9, k3); + Subround(I, d1, e1, a1, b1, c1, X[ 3], 14, k3); + Subround(I, c1, d1, e1, a1, b1, X[ 7], 5, k3); + Subround(I, b1, c1, d1, e1, a1, X[15], 6, k3); + Subround(I, a1, b1, c1, d1, e1, X[14], 8, k3); + Subround(I, e1, a1, b1, c1, d1, X[ 5], 6, k3); + Subround(I, d1, e1, a1, b1, c1, X[ 6], 5, k3); + Subround(I, c1, d1, e1, a1, b1, X[ 2], 12, k3); + + Subround(G, c2, d2, e2, a2, b2, X[ 8], 15, k8); + Subround(G, b2, c2, d2, e2, a2, X[ 6], 5, k8); + Subround(G, a2, b2, c2, d2, e2, X[ 4], 8, k8); + Subround(G, e2, a2, b2, c2, d2, X[ 1], 11, k8); + Subround(G, d2, e2, a2, b2, c2, X[ 3], 14, k8); + Subround(G, c2, d2, e2, a2, b2, X[11], 14, k8); + Subround(G, b2, c2, d2, e2, a2, X[15], 6, k8); + Subround(G, a2, b2, c2, d2, e2, X[ 0], 14, k8); + Subround(G, e2, a2, b2, c2, d2, X[ 5], 6, k8); + Subround(G, d2, e2, a2, b2, c2, X[12], 9, k8); + Subround(G, c2, d2, e2, a2, b2, X[ 2], 12, k8); + Subround(G, b2, c2, d2, e2, a2, X[13], 9, k8); + Subround(G, a2, b2, c2, d2, e2, X[ 9], 12, k8); + Subround(G, e2, a2, b2, c2, d2, X[ 7], 5, k8); + Subround(G, d2, e2, a2, b2, c2, X[10], 15, k8); + Subround(G, c2, d2, e2, a2, b2, X[14], 8, k8); + + t = d1; d1 = d2; d2 = t; + + Subround(J, b1, c1, d1, e1, a1, X[ 4], 9, k4); + Subround(J, a1, b1, c1, d1, e1, X[ 0], 15, k4); + Subround(J, e1, a1, b1, c1, d1, X[ 5], 5, k4); + Subround(J, d1, e1, a1, b1, c1, X[ 9], 11, k4); + Subround(J, c1, d1, e1, a1, b1, X[ 7], 6, k4); + Subround(J, b1, c1, d1, e1, a1, X[12], 8, k4); + Subround(J, a1, b1, c1, d1, e1, X[ 2], 13, k4); + Subround(J, e1, a1, b1, c1, d1, X[10], 12, k4); + Subround(J, d1, e1, a1, b1, c1, X[14], 5, k4); + Subround(J, c1, d1, e1, a1, b1, X[ 1], 12, k4); + Subround(J, b1, c1, d1, e1, a1, X[ 3], 13, k4); + Subround(J, a1, b1, c1, d1, e1, X[ 8], 14, k4); + Subround(J, e1, a1, b1, c1, d1, X[11], 11, k4); + Subround(J, d1, e1, a1, b1, c1, X[ 6], 8, k4); + Subround(J, c1, d1, e1, a1, b1, X[15], 5, k4); + Subround(J, b1, c1, d1, e1, a1, X[13], 6, k4); + + Subround(F, b2, c2, d2, e2, a2, X[12], 8, k9); + Subround(F, a2, b2, c2, d2, e2, X[15], 5, k9); + Subround(F, e2, a2, b2, c2, d2, X[10], 12, k9); + Subround(F, d2, e2, a2, b2, c2, X[ 4], 9, k9); + Subround(F, c2, d2, e2, a2, b2, X[ 1], 12, k9); + Subround(F, b2, c2, d2, e2, a2, X[ 5], 5, k9); + Subround(F, a2, b2, c2, d2, e2, X[ 8], 14, k9); + Subround(F, e2, a2, b2, c2, d2, X[ 7], 6, k9); + Subround(F, d2, e2, a2, b2, c2, X[ 6], 8, k9); + Subround(F, c2, d2, e2, a2, b2, X[ 2], 13, k9); + Subround(F, b2, c2, d2, e2, a2, X[13], 6, k9); + Subround(F, a2, b2, c2, d2, e2, X[14], 5, k9); + Subround(F, e2, a2, b2, c2, d2, X[ 0], 15, k9); + Subround(F, d2, e2, a2, b2, c2, X[ 3], 13, k9); + Subround(F, c2, d2, e2, a2, b2, X[ 9], 11, k9); + Subround(F, b2, c2, d2, e2, a2, X[11], 11, k9); + + t = e1; e1 = e2; e2 = t; + + digest[0] += a1; + digest[1] += b1; + digest[2] += c1; + digest[3] += d1; + digest[4] += e1; + digest[5] += a2; + digest[6] += b2; + digest[7] += c2; + digest[8] += d2; + digest[9] += e2; +} + +#undef Subround + +// ************************************************************* + +// for 128 and 256 +#define Subround(f, a, b, c, d, x, s, k) \ + a += f(b, c, d) + x + k;\ + a = rotlFixed((word32)a, s); + +void RIPEMD128::InitState(HashWordType *state) +{ + state[0] = 0x67452301L; + state[1] = 0xefcdab89L; + state[2] = 0x98badcfeL; + state[3] = 0x10325476L; +} + +void RIPEMD128::Transform (word32 *digest, const word32 *X) +{ + unsigned long a1, b1, c1, d1, a2, b2, c2, d2; + a1 = a2 = digest[0]; + b1 = b2 = digest[1]; + c1 = c2 = digest[2]; + d1 = d2 = digest[3]; + + Subround(F, a1, b1, c1, d1, X[ 0], 11, k0); + Subround(F, d1, a1, b1, c1, X[ 1], 14, k0); + Subround(F, c1, d1, a1, b1, X[ 2], 15, k0); + Subround(F, b1, c1, d1, a1, X[ 3], 12, k0); + Subround(F, a1, b1, c1, d1, X[ 4], 5, k0); + Subround(F, d1, a1, b1, c1, X[ 5], 8, k0); + Subround(F, c1, d1, a1, b1, X[ 6], 7, k0); + Subround(F, b1, c1, d1, a1, X[ 7], 9, k0); + Subround(F, a1, b1, c1, d1, X[ 8], 11, k0); + Subround(F, d1, a1, b1, c1, X[ 9], 13, k0); + Subround(F, c1, d1, a1, b1, X[10], 14, k0); + Subround(F, b1, c1, d1, a1, X[11], 15, k0); + Subround(F, a1, b1, c1, d1, X[12], 6, k0); + Subround(F, d1, a1, b1, c1, X[13], 7, k0); + Subround(F, c1, d1, a1, b1, X[14], 9, k0); + Subround(F, b1, c1, d1, a1, X[15], 8, k0); + + Subround(G, a1, b1, c1, d1, X[ 7], 7, k1); + Subround(G, d1, a1, b1, c1, X[ 4], 6, k1); + Subround(G, c1, d1, a1, b1, X[13], 8, k1); + Subround(G, b1, c1, d1, a1, X[ 1], 13, k1); + Subround(G, a1, b1, c1, d1, X[10], 11, k1); + Subround(G, d1, a1, b1, c1, X[ 6], 9, k1); + Subround(G, c1, d1, a1, b1, X[15], 7, k1); + Subround(G, b1, c1, d1, a1, X[ 3], 15, k1); + Subround(G, a1, b1, c1, d1, X[12], 7, k1); + Subround(G, d1, a1, b1, c1, X[ 0], 12, k1); + Subround(G, c1, d1, a1, b1, X[ 9], 15, k1); + Subround(G, b1, c1, d1, a1, X[ 5], 9, k1); + Subround(G, a1, b1, c1, d1, X[ 2], 11, k1); + Subround(G, d1, a1, b1, c1, X[14], 7, k1); + Subround(G, c1, d1, a1, b1, X[11], 13, k1); + Subround(G, b1, c1, d1, a1, X[ 8], 12, k1); + + Subround(H, a1, b1, c1, d1, X[ 3], 11, k2); + Subround(H, d1, a1, b1, c1, X[10], 13, k2); + Subround(H, c1, d1, a1, b1, X[14], 6, k2); + Subround(H, b1, c1, d1, a1, X[ 4], 7, k2); + Subround(H, a1, b1, c1, d1, X[ 9], 14, k2); + Subround(H, d1, a1, b1, c1, X[15], 9, k2); + Subround(H, c1, d1, a1, b1, X[ 8], 13, k2); + Subround(H, b1, c1, d1, a1, X[ 1], 15, k2); + Subround(H, a1, b1, c1, d1, X[ 2], 14, k2); + Subround(H, d1, a1, b1, c1, X[ 7], 8, k2); + Subround(H, c1, d1, a1, b1, X[ 0], 13, k2); + Subround(H, b1, c1, d1, a1, X[ 6], 6, k2); + Subround(H, a1, b1, c1, d1, X[13], 5, k2); + Subround(H, d1, a1, b1, c1, X[11], 12, k2); + Subround(H, c1, d1, a1, b1, X[ 5], 7, k2); + Subround(H, b1, c1, d1, a1, X[12], 5, k2); + + Subround(I, a1, b1, c1, d1, X[ 1], 11, k3); + Subround(I, d1, a1, b1, c1, X[ 9], 12, k3); + Subround(I, c1, d1, a1, b1, X[11], 14, k3); + Subround(I, b1, c1, d1, a1, X[10], 15, k3); + Subround(I, a1, b1, c1, d1, X[ 0], 14, k3); + Subround(I, d1, a1, b1, c1, X[ 8], 15, k3); + Subround(I, c1, d1, a1, b1, X[12], 9, k3); + Subround(I, b1, c1, d1, a1, X[ 4], 8, k3); + Subround(I, a1, b1, c1, d1, X[13], 9, k3); + Subround(I, d1, a1, b1, c1, X[ 3], 14, k3); + Subround(I, c1, d1, a1, b1, X[ 7], 5, k3); + Subround(I, b1, c1, d1, a1, X[15], 6, k3); + Subround(I, a1, b1, c1, d1, X[14], 8, k3); + Subround(I, d1, a1, b1, c1, X[ 5], 6, k3); + Subround(I, c1, d1, a1, b1, X[ 6], 5, k3); + Subround(I, b1, c1, d1, a1, X[ 2], 12, k3); + + Subround(I, a2, b2, c2, d2, X[ 5], 8, k5); + Subround(I, d2, a2, b2, c2, X[14], 9, k5); + Subround(I, c2, d2, a2, b2, X[ 7], 9, k5); + Subround(I, b2, c2, d2, a2, X[ 0], 11, k5); + Subround(I, a2, b2, c2, d2, X[ 9], 13, k5); + Subround(I, d2, a2, b2, c2, X[ 2], 15, k5); + Subround(I, c2, d2, a2, b2, X[11], 15, k5); + Subround(I, b2, c2, d2, a2, X[ 4], 5, k5); + Subround(I, a2, b2, c2, d2, X[13], 7, k5); + Subround(I, d2, a2, b2, c2, X[ 6], 7, k5); + Subround(I, c2, d2, a2, b2, X[15], 8, k5); + Subround(I, b2, c2, d2, a2, X[ 8], 11, k5); + Subround(I, a2, b2, c2, d2, X[ 1], 14, k5); + Subround(I, d2, a2, b2, c2, X[10], 14, k5); + Subround(I, c2, d2, a2, b2, X[ 3], 12, k5); + Subround(I, b2, c2, d2, a2, X[12], 6, k5); + + Subround(H, a2, b2, c2, d2, X[ 6], 9, k6); + Subround(H, d2, a2, b2, c2, X[11], 13, k6); + Subround(H, c2, d2, a2, b2, X[ 3], 15, k6); + Subround(H, b2, c2, d2, a2, X[ 7], 7, k6); + Subround(H, a2, b2, c2, d2, X[ 0], 12, k6); + Subround(H, d2, a2, b2, c2, X[13], 8, k6); + Subround(H, c2, d2, a2, b2, X[ 5], 9, k6); + Subround(H, b2, c2, d2, a2, X[10], 11, k6); + Subround(H, a2, b2, c2, d2, X[14], 7, k6); + Subround(H, d2, a2, b2, c2, X[15], 7, k6); + Subround(H, c2, d2, a2, b2, X[ 8], 12, k6); + Subround(H, b2, c2, d2, a2, X[12], 7, k6); + Subround(H, a2, b2, c2, d2, X[ 4], 6, k6); + Subround(H, d2, a2, b2, c2, X[ 9], 15, k6); + Subround(H, c2, d2, a2, b2, X[ 1], 13, k6); + Subround(H, b2, c2, d2, a2, X[ 2], 11, k6); + + Subround(G, a2, b2, c2, d2, X[15], 9, k7); + Subround(G, d2, a2, b2, c2, X[ 5], 7, k7); + Subround(G, c2, d2, a2, b2, X[ 1], 15, k7); + Subround(G, b2, c2, d2, a2, X[ 3], 11, k7); + Subround(G, a2, b2, c2, d2, X[ 7], 8, k7); + Subround(G, d2, a2, b2, c2, X[14], 6, k7); + Subround(G, c2, d2, a2, b2, X[ 6], 6, k7); + Subround(G, b2, c2, d2, a2, X[ 9], 14, k7); + Subround(G, a2, b2, c2, d2, X[11], 12, k7); + Subround(G, d2, a2, b2, c2, X[ 8], 13, k7); + Subround(G, c2, d2, a2, b2, X[12], 5, k7); + Subround(G, b2, c2, d2, a2, X[ 2], 14, k7); + Subround(G, a2, b2, c2, d2, X[10], 13, k7); + Subround(G, d2, a2, b2, c2, X[ 0], 13, k7); + Subround(G, c2, d2, a2, b2, X[ 4], 7, k7); + Subround(G, b2, c2, d2, a2, X[13], 5, k7); + + Subround(F, a2, b2, c2, d2, X[ 8], 15, k9); + Subround(F, d2, a2, b2, c2, X[ 6], 5, k9); + Subround(F, c2, d2, a2, b2, X[ 4], 8, k9); + Subround(F, b2, c2, d2, a2, X[ 1], 11, k9); + Subround(F, a2, b2, c2, d2, X[ 3], 14, k9); + Subround(F, d2, a2, b2, c2, X[11], 14, k9); + Subround(F, c2, d2, a2, b2, X[15], 6, k9); + Subround(F, b2, c2, d2, a2, X[ 0], 14, k9); + Subround(F, a2, b2, c2, d2, X[ 5], 6, k9); + Subround(F, d2, a2, b2, c2, X[12], 9, k9); + Subround(F, c2, d2, a2, b2, X[ 2], 12, k9); + Subround(F, b2, c2, d2, a2, X[13], 9, k9); + Subround(F, a2, b2, c2, d2, X[ 9], 12, k9); + Subround(F, d2, a2, b2, c2, X[ 7], 5, k9); + Subround(F, c2, d2, a2, b2, X[10], 15, k9); + Subround(F, b2, c2, d2, a2, X[14], 8, k9); + + c1 = digest[1] + c1 + d2; + digest[1] = digest[2] + d1 + a2; + digest[2] = digest[3] + a1 + b2; + digest[3] = digest[0] + b1 + c2; + digest[0] = c1; +} + +// ************************************************************* + +void RIPEMD256::InitState(HashWordType *state) +{ + state[0] = 0x67452301L; + state[1] = 0xefcdab89L; + state[2] = 0x98badcfeL; + state[3] = 0x10325476L; + state[4] = 0x76543210L; + state[5] = 0xfedcba98L; + state[6] = 0x89abcdefL; + state[7] = 0x01234567L; +} + +void RIPEMD256::Transform (word32 *digest, const word32 *X) +{ + unsigned long a1, b1, c1, d1, a2, b2, c2, d2, t; + a1 = digest[0]; + b1 = digest[1]; + c1 = digest[2]; + d1 = digest[3]; + a2 = digest[4]; + b2 = digest[5]; + c2 = digest[6]; + d2 = digest[7]; + + Subround(F, a1, b1, c1, d1, X[ 0], 11, k0); + Subround(F, d1, a1, b1, c1, X[ 1], 14, k0); + Subround(F, c1, d1, a1, b1, X[ 2], 15, k0); + Subround(F, b1, c1, d1, a1, X[ 3], 12, k0); + Subround(F, a1, b1, c1, d1, X[ 4], 5, k0); + Subround(F, d1, a1, b1, c1, X[ 5], 8, k0); + Subround(F, c1, d1, a1, b1, X[ 6], 7, k0); + Subround(F, b1, c1, d1, a1, X[ 7], 9, k0); + Subround(F, a1, b1, c1, d1, X[ 8], 11, k0); + Subround(F, d1, a1, b1, c1, X[ 9], 13, k0); + Subround(F, c1, d1, a1, b1, X[10], 14, k0); + Subround(F, b1, c1, d1, a1, X[11], 15, k0); + Subround(F, a1, b1, c1, d1, X[12], 6, k0); + Subround(F, d1, a1, b1, c1, X[13], 7, k0); + Subround(F, c1, d1, a1, b1, X[14], 9, k0); + Subround(F, b1, c1, d1, a1, X[15], 8, k0); + + Subround(I, a2, b2, c2, d2, X[ 5], 8, k5); + Subround(I, d2, a2, b2, c2, X[14], 9, k5); + Subround(I, c2, d2, a2, b2, X[ 7], 9, k5); + Subround(I, b2, c2, d2, a2, X[ 0], 11, k5); + Subround(I, a2, b2, c2, d2, X[ 9], 13, k5); + Subround(I, d2, a2, b2, c2, X[ 2], 15, k5); + Subround(I, c2, d2, a2, b2, X[11], 15, k5); + Subround(I, b2, c2, d2, a2, X[ 4], 5, k5); + Subround(I, a2, b2, c2, d2, X[13], 7, k5); + Subround(I, d2, a2, b2, c2, X[ 6], 7, k5); + Subround(I, c2, d2, a2, b2, X[15], 8, k5); + Subround(I, b2, c2, d2, a2, X[ 8], 11, k5); + Subround(I, a2, b2, c2, d2, X[ 1], 14, k5); + Subround(I, d2, a2, b2, c2, X[10], 14, k5); + Subround(I, c2, d2, a2, b2, X[ 3], 12, k5); + Subround(I, b2, c2, d2, a2, X[12], 6, k5); + + t = a1; a1 = a2; a2 = t; + + Subround(G, a1, b1, c1, d1, X[ 7], 7, k1); + Subround(G, d1, a1, b1, c1, X[ 4], 6, k1); + Subround(G, c1, d1, a1, b1, X[13], 8, k1); + Subround(G, b1, c1, d1, a1, X[ 1], 13, k1); + Subround(G, a1, b1, c1, d1, X[10], 11, k1); + Subround(G, d1, a1, b1, c1, X[ 6], 9, k1); + Subround(G, c1, d1, a1, b1, X[15], 7, k1); + Subround(G, b1, c1, d1, a1, X[ 3], 15, k1); + Subround(G, a1, b1, c1, d1, X[12], 7, k1); + Subround(G, d1, a1, b1, c1, X[ 0], 12, k1); + Subround(G, c1, d1, a1, b1, X[ 9], 15, k1); + Subround(G, b1, c1, d1, a1, X[ 5], 9, k1); + Subround(G, a1, b1, c1, d1, X[ 2], 11, k1); + Subround(G, d1, a1, b1, c1, X[14], 7, k1); + Subround(G, c1, d1, a1, b1, X[11], 13, k1); + Subround(G, b1, c1, d1, a1, X[ 8], 12, k1); + + Subround(H, a2, b2, c2, d2, X[ 6], 9, k6); + Subround(H, d2, a2, b2, c2, X[11], 13, k6); + Subround(H, c2, d2, a2, b2, X[ 3], 15, k6); + Subround(H, b2, c2, d2, a2, X[ 7], 7, k6); + Subround(H, a2, b2, c2, d2, X[ 0], 12, k6); + Subround(H, d2, a2, b2, c2, X[13], 8, k6); + Subround(H, c2, d2, a2, b2, X[ 5], 9, k6); + Subround(H, b2, c2, d2, a2, X[10], 11, k6); + Subround(H, a2, b2, c2, d2, X[14], 7, k6); + Subround(H, d2, a2, b2, c2, X[15], 7, k6); + Subround(H, c2, d2, a2, b2, X[ 8], 12, k6); + Subround(H, b2, c2, d2, a2, X[12], 7, k6); + Subround(H, a2, b2, c2, d2, X[ 4], 6, k6); + Subround(H, d2, a2, b2, c2, X[ 9], 15, k6); + Subround(H, c2, d2, a2, b2, X[ 1], 13, k6); + Subround(H, b2, c2, d2, a2, X[ 2], 11, k6); + + t = b1; b1 = b2; b2 = t; + + Subround(H, a1, b1, c1, d1, X[ 3], 11, k2); + Subround(H, d1, a1, b1, c1, X[10], 13, k2); + Subround(H, c1, d1, a1, b1, X[14], 6, k2); + Subround(H, b1, c1, d1, a1, X[ 4], 7, k2); + Subround(H, a1, b1, c1, d1, X[ 9], 14, k2); + Subround(H, d1, a1, b1, c1, X[15], 9, k2); + Subround(H, c1, d1, a1, b1, X[ 8], 13, k2); + Subround(H, b1, c1, d1, a1, X[ 1], 15, k2); + Subround(H, a1, b1, c1, d1, X[ 2], 14, k2); + Subround(H, d1, a1, b1, c1, X[ 7], 8, k2); + Subround(H, c1, d1, a1, b1, X[ 0], 13, k2); + Subround(H, b1, c1, d1, a1, X[ 6], 6, k2); + Subround(H, a1, b1, c1, d1, X[13], 5, k2); + Subround(H, d1, a1, b1, c1, X[11], 12, k2); + Subround(H, c1, d1, a1, b1, X[ 5], 7, k2); + Subround(H, b1, c1, d1, a1, X[12], 5, k2); + + Subround(G, a2, b2, c2, d2, X[15], 9, k7); + Subround(G, d2, a2, b2, c2, X[ 5], 7, k7); + Subround(G, c2, d2, a2, b2, X[ 1], 15, k7); + Subround(G, b2, c2, d2, a2, X[ 3], 11, k7); + Subround(G, a2, b2, c2, d2, X[ 7], 8, k7); + Subround(G, d2, a2, b2, c2, X[14], 6, k7); + Subround(G, c2, d2, a2, b2, X[ 6], 6, k7); + Subround(G, b2, c2, d2, a2, X[ 9], 14, k7); + Subround(G, a2, b2, c2, d2, X[11], 12, k7); + Subround(G, d2, a2, b2, c2, X[ 8], 13, k7); + Subround(G, c2, d2, a2, b2, X[12], 5, k7); + Subround(G, b2, c2, d2, a2, X[ 2], 14, k7); + Subround(G, a2, b2, c2, d2, X[10], 13, k7); + Subround(G, d2, a2, b2, c2, X[ 0], 13, k7); + Subround(G, c2, d2, a2, b2, X[ 4], 7, k7); + Subround(G, b2, c2, d2, a2, X[13], 5, k7); + + t = c1; c1 = c2; c2 = t; + + Subround(I, a1, b1, c1, d1, X[ 1], 11, k3); + Subround(I, d1, a1, b1, c1, X[ 9], 12, k3); + Subround(I, c1, d1, a1, b1, X[11], 14, k3); + Subround(I, b1, c1, d1, a1, X[10], 15, k3); + Subround(I, a1, b1, c1, d1, X[ 0], 14, k3); + Subround(I, d1, a1, b1, c1, X[ 8], 15, k3); + Subround(I, c1, d1, a1, b1, X[12], 9, k3); + Subround(I, b1, c1, d1, a1, X[ 4], 8, k3); + Subround(I, a1, b1, c1, d1, X[13], 9, k3); + Subround(I, d1, a1, b1, c1, X[ 3], 14, k3); + Subround(I, c1, d1, a1, b1, X[ 7], 5, k3); + Subround(I, b1, c1, d1, a1, X[15], 6, k3); + Subround(I, a1, b1, c1, d1, X[14], 8, k3); + Subround(I, d1, a1, b1, c1, X[ 5], 6, k3); + Subround(I, c1, d1, a1, b1, X[ 6], 5, k3); + Subround(I, b1, c1, d1, a1, X[ 2], 12, k3); + + Subround(F, a2, b2, c2, d2, X[ 8], 15, k9); + Subround(F, d2, a2, b2, c2, X[ 6], 5, k9); + Subround(F, c2, d2, a2, b2, X[ 4], 8, k9); + Subround(F, b2, c2, d2, a2, X[ 1], 11, k9); + Subround(F, a2, b2, c2, d2, X[ 3], 14, k9); + Subround(F, d2, a2, b2, c2, X[11], 14, k9); + Subround(F, c2, d2, a2, b2, X[15], 6, k9); + Subround(F, b2, c2, d2, a2, X[ 0], 14, k9); + Subround(F, a2, b2, c2, d2, X[ 5], 6, k9); + Subround(F, d2, a2, b2, c2, X[12], 9, k9); + Subround(F, c2, d2, a2, b2, X[ 2], 12, k9); + Subround(F, b2, c2, d2, a2, X[13], 9, k9); + Subround(F, a2, b2, c2, d2, X[ 9], 12, k9); + Subround(F, d2, a2, b2, c2, X[ 7], 5, k9); + Subround(F, c2, d2, a2, b2, X[10], 15, k9); + Subround(F, b2, c2, d2, a2, X[14], 8, k9); + + t = d1; d1 = d2; d2 = t; + + digest[0] += a1; + digest[1] += b1; + digest[2] += c1; + digest[3] += d1; + digest[4] += a2; + digest[5] += b2; + digest[6] += c2; + digest[7] += d2; +} + +NAMESPACE_END diff --git a/cryptopp/ripemd.h b/cryptopp/ripemd.h new file mode 100644 index 0000000..56871a9 --- /dev/null +++ b/cryptopp/ripemd.h @@ -0,0 +1,49 @@ +#ifndef CRYPTOPP_RIPEMD_H +#define CRYPTOPP_RIPEMD_H + +#include "iterhash.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! RIPEMD-160 +/*! Digest Length = 160 bits */ +class RIPEMD160 : public IteratedHashWithStaticTransform +{ +public: + static void InitState(HashWordType *state); + static void Transform(word32 *digest, const word32 *data); + static const char * StaticAlgorithmName() {return "RIPEMD-160";} +}; + +/*! Digest Length = 320 bits, Security is similar to RIPEMD-160 */ +class RIPEMD320 : public IteratedHashWithStaticTransform +{ +public: + static void InitState(HashWordType *state); + static void Transform(word32 *digest, const word32 *data); + static const char * StaticAlgorithmName() {return "RIPEMD-320";} +}; + +/*! \warning RIPEMD-128 is considered insecure, and should not be used + unless you absolutely need it for compatibility. */ +class RIPEMD128 : public IteratedHashWithStaticTransform +{ +public: + static void InitState(HashWordType *state); + static void Transform(word32 *digest, const word32 *data); + static const char * StaticAlgorithmName() {return "RIPEMD-128";} +}; + +/*! \warning RIPEMD-256 is considered insecure, and should not be used + unless you absolutely need it for compatibility. */ +class RIPEMD256 : public IteratedHashWithStaticTransform +{ +public: + static void InitState(HashWordType *state); + static void Transform(word32 *digest, const word32 *data); + static const char * StaticAlgorithmName() {return "RIPEMD-256";} +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/rng.cpp b/cryptopp/rng.cpp new file mode 100644 index 0000000..9866cd8 --- /dev/null +++ b/cryptopp/rng.cpp @@ -0,0 +1,155 @@ +// rng.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#include "rng.h" +#include "fips140.h" + +#include +#include + +NAMESPACE_BEGIN(CryptoPP) + +// linear congruential generator +// originally by William S. England + +// do not use for cryptographic purposes + +/* +** Original_numbers are the original published m and q in the +** ACM article above. John Burton has furnished numbers for +** a reportedly better generator. The new numbers are now +** used in this program by default. +*/ + +#ifndef LCRNG_ORIGINAL_NUMBERS +const word32 LC_RNG::m=2147483647L; +const word32 LC_RNG::q=44488L; + +const word16 LC_RNG::a=(unsigned int)48271L; +const word16 LC_RNG::r=3399; +#else +const word32 LC_RNG::m=2147483647L; +const word32 LC_RNG::q=127773L; + +const word16 LC_RNG::a=16807; +const word16 LC_RNG::r=2836; +#endif + +void LC_RNG::GenerateBlock(byte *output, size_t size) +{ + while (size--) + { + word32 hi = seed/q; + word32 lo = seed%q; + + long test = a*lo - r*hi; + + if (test > 0) + seed = test; + else + seed = test+ m; + + *output++ = (GETBYTE(seed, 0) ^ GETBYTE(seed, 1) ^ GETBYTE(seed, 2) ^ GETBYTE(seed, 3)); + } +} + +// ******************************************************** + +#ifndef CRYPTOPP_IMPORTS + +X917RNG::X917RNG(BlockTransformation *c, const byte *seed, const byte *deterministicTimeVector) + : cipher(c), + S(cipher->BlockSize()), + dtbuf(S), + randseed(seed, S), + m_lastBlock(S), + m_deterministicTimeVector(deterministicTimeVector, deterministicTimeVector ? S : 0) +{ + if (!deterministicTimeVector) + { + time_t tstamp1 = time(0); + xorbuf(dtbuf, (byte *)&tstamp1, UnsignedMin(sizeof(tstamp1), S)); + cipher->ProcessBlock(dtbuf); + clock_t tstamp2 = clock(); + xorbuf(dtbuf, (byte *)&tstamp2, UnsignedMin(sizeof(tstamp2), S)); + cipher->ProcessBlock(dtbuf); + } + + // for FIPS 140-2 + GenerateBlock(m_lastBlock, S); +} + +void X917RNG::GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size) +{ + while (size > 0) + { + // calculate new enciphered timestamp + if (m_deterministicTimeVector.size()) + { + cipher->ProcessBlock(m_deterministicTimeVector, dtbuf); + IncrementCounterByOne(m_deterministicTimeVector, S); + } + else + { + clock_t c = clock(); + xorbuf(dtbuf, (byte *)&c, UnsignedMin(sizeof(c), S)); + time_t t = time(NULL); + xorbuf(dtbuf+S-UnsignedMin(sizeof(t), S), (byte *)&t, UnsignedMin(sizeof(t), S)); + cipher->ProcessBlock(dtbuf); + } + + // combine enciphered timestamp with seed + xorbuf(randseed, dtbuf, S); + + // generate a new block of random bytes + cipher->ProcessBlock(randseed); + if (memcmp(m_lastBlock, randseed, S) == 0) + throw SelfTestFailure("X917RNG: Continuous random number generator test failed."); + + // output random bytes + size_t len = UnsignedMin(S, size); + target.ChannelPut(channel, randseed, len); + size -= len; + + // compute new seed vector + memcpy(m_lastBlock, randseed, S); + xorbuf(randseed, dtbuf, S); + cipher->ProcessBlock(randseed); + } +} + +#endif + +MaurerRandomnessTest::MaurerRandomnessTest() + : sum(0.0), n(0) +{ + for (unsigned i=0; i= Q) + sum += log(double(n - tab[inByte])); + tab[inByte] = n; + n++; + } + return 0; +} + +double MaurerRandomnessTest::GetTestValue() const +{ + if (BytesNeeded() > 0) + throw Exception(Exception::OTHER_ERROR, "MaurerRandomnessTest: " + IntToString(BytesNeeded()) + " more bytes of input needed"); + + double fTu = (sum/(n-Q))/log(2.0); // this is the test value defined by Maurer + + double value = fTu * 0.1392; // arbitrarily normalize it to + return value > 1.0 ? 1.0 : value; // a number between 0 and 1 +} + +NAMESPACE_END diff --git a/cryptopp/rng.h b/cryptopp/rng.h new file mode 100644 index 0000000..2439dee --- /dev/null +++ b/cryptopp/rng.h @@ -0,0 +1,77 @@ +// rng.h - misc RNG related classes, see also osrng.h, randpool.h + +#ifndef CRYPTOPP_RNG_H +#define CRYPTOPP_RNG_H + +#include "cryptlib.h" +#include "filters.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! linear congruential generator +/*! originally by William S. England, do not use for cryptographic purposes */ +class LC_RNG : public RandomNumberGenerator +{ +public: + LC_RNG(word32 init_seed) + : seed(init_seed) {} + + void GenerateBlock(byte *output, size_t size); + + word32 GetSeed() {return seed;} + +private: + word32 seed; + + static const word32 m; + static const word32 q; + static const word16 a; + static const word16 r; +}; + +//! RNG derived from ANSI X9.17 Appendix C + +class CRYPTOPP_DLL X917RNG : public RandomNumberGenerator, public NotCopyable +{ +public: + // cipher will be deleted by destructor, deterministicTimeVector = 0 means obtain time vector from system + X917RNG(BlockTransformation *cipher, const byte *seed, const byte *deterministicTimeVector = 0); + + void GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size); + +private: + member_ptr cipher; + unsigned int S; // blocksize of cipher + SecByteBlock dtbuf; // buffer for enciphered timestamp + SecByteBlock randseed, m_lastBlock, m_deterministicTimeVector; +}; + +/** This class implements Maurer's Universal Statistical Test for Random Bit Generators + it is intended for measuring the randomness of *PHYSICAL* RNGs. + For more details see his paper in Journal of Cryptology, 1992. */ + +class MaurerRandomnessTest : public Bufferless +{ +public: + MaurerRandomnessTest(); + + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking); + + // BytesNeeded() returns how many more bytes of input is needed by the test + // GetTestValue() should not be called before BytesNeeded()==0 + unsigned int BytesNeeded() const {return n >= (Q+K) ? 0 : Q+K-n;} + + // returns a number between 0.0 and 1.0, describing the quality of the + // random numbers entered + double GetTestValue() const; + +private: + enum {L=8, V=256, Q=2000, K=2000}; + double sum; + unsigned int n; + unsigned int tab[V]; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/rsa.cpp b/cryptopp/rsa.cpp new file mode 100644 index 0000000..59449c4 --- /dev/null +++ b/cryptopp/rsa.cpp @@ -0,0 +1,304 @@ +// rsa.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "rsa.h" +#include "asn.h" +#include "oids.h" +#include "modarith.h" +#include "nbtheory.h" +#include "sha.h" +#include "algparam.h" +#include "fips140.h" + +#if !defined(NDEBUG) && !defined(CRYPTOPP_IS_DLL) +#include "pssr.h" +NAMESPACE_BEGIN(CryptoPP) +void RSA_TestInstantiations() +{ + RSASS::Verifier x1(1, 1); + RSASS::Signer x2(NullRNG(), 1); + RSASS::Verifier x3(x2); + RSASS::Verifier x4(x2.GetKey()); + RSASS::Verifier x5(x3); +#ifndef __MWERKS__ + RSASS::Signer x6 = x2; + x3 = x2; + x6 = x2; +#endif + RSAES::Encryptor x7(x2); +#ifndef __GNUC__ + RSAES::Encryptor x8(x3); +#endif + RSAES >::Encryptor x9(x2); + + x4 = x2.GetKey(); +} +NAMESPACE_END +#endif + +#ifndef CRYPTOPP_IMPORTS + +NAMESPACE_BEGIN(CryptoPP) + +OID RSAFunction::GetAlgorithmID() const +{ + return ASN1::rsaEncryption(); +} + +void RSAFunction::BERDecodePublicKey(BufferedTransformation &bt, bool, size_t) +{ + BERSequenceDecoder seq(bt); + m_n.BERDecode(seq); + m_e.BERDecode(seq); + seq.MessageEnd(); +} + +void RSAFunction::DEREncodePublicKey(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + m_n.DEREncode(seq); + m_e.DEREncode(seq); + seq.MessageEnd(); +} + +Integer RSAFunction::ApplyFunction(const Integer &x) const +{ + DoQuickSanityCheck(); + return a_exp_b_mod_c(x, m_e, m_n); +} + +bool RSAFunction::Validate(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = true; + pass = pass && m_n > Integer::One() && m_n.IsOdd(); + pass = pass && m_e > Integer::One() && m_e.IsOdd() && m_e < m_n; + return pass; +} + +bool RSAFunction::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Modulus) + CRYPTOPP_GET_FUNCTION_ENTRY(PublicExponent) + ; +} + +void RSAFunction::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Modulus) + CRYPTOPP_SET_FUNCTION_ENTRY(PublicExponent) + ; +} + +// ***************************************************************************** + +class RSAPrimeSelector : public PrimeSelector +{ +public: + RSAPrimeSelector(const Integer &e) : m_e(e) {} + bool IsAcceptable(const Integer &candidate) const {return RelativelyPrime(m_e, candidate-Integer::One());} + Integer m_e; +}; + +void InvertibleRSAFunction::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg) +{ + int modulusSize = 2048; + alg.GetIntValue(Name::ModulusSize(), modulusSize) || alg.GetIntValue(Name::KeySize(), modulusSize); + + if (modulusSize < 16) + throw InvalidArgument("InvertibleRSAFunction: specified modulus size is too small"); + + m_e = alg.GetValueWithDefault(Name::PublicExponent(), Integer(17)); + + if (m_e < 3 || m_e.IsEven()) + throw InvalidArgument("InvertibleRSAFunction: invalid public exponent"); + + RSAPrimeSelector selector(m_e); + AlgorithmParameters primeParam = MakeParametersForTwoPrimesOfEqualSize(modulusSize) + (Name::PointerToPrimeSelector(), selector.GetSelectorPointer()); + m_p.GenerateRandom(rng, primeParam); + m_q.GenerateRandom(rng, primeParam); + + m_d = m_e.InverseMod(LCM(m_p-1, m_q-1)); + assert(m_d.IsPositive()); + + m_dp = m_d % (m_p-1); + m_dq = m_d % (m_q-1); + m_n = m_p * m_q; + m_u = m_q.InverseMod(m_p); + + if (FIPS_140_2_ComplianceEnabled()) + { + RSASS::Signer signer(*this); + RSASS::Verifier verifier(signer); + SignaturePairwiseConsistencyTest_FIPS_140_Only(signer, verifier); + + RSAES >::Decryptor decryptor(*this); + RSAES >::Encryptor encryptor(decryptor); + EncryptionPairwiseConsistencyTest_FIPS_140_Only(encryptor, decryptor); + } +} + +void InvertibleRSAFunction::Initialize(RandomNumberGenerator &rng, unsigned int keybits, const Integer &e) +{ + GenerateRandom(rng, MakeParameters(Name::ModulusSize(), (int)keybits)(Name::PublicExponent(), e+e.IsEven())); +} + +void InvertibleRSAFunction::Initialize(const Integer &n, const Integer &e, const Integer &d) +{ + if (n.IsEven() || e.IsEven() | d.IsEven()) + throw InvalidArgument("InvertibleRSAFunction: input is not a valid RSA private key"); + + m_n = n; + m_e = e; + m_d = d; + + Integer r = --(d*e); + unsigned int s = 0; + while (r.IsEven()) + { + r >>= 1; + s++; + } + + ModularArithmetic modn(n); + for (Integer i = 2; ; ++i) + { + Integer a = modn.Exponentiate(i, r); + if (a == 1) + continue; + Integer b; + unsigned int j = 0; + while (a != n-1) + { + b = modn.Square(a); + if (b == 1) + { + m_p = GCD(a-1, n); + m_q = n/m_p; + m_dp = m_d % (m_p-1); + m_dq = m_d % (m_q-1); + m_u = m_q.InverseMod(m_p); + return; + } + if (++j == s) + throw InvalidArgument("InvertibleRSAFunction: input is not a valid RSA private key"); + a = b; + } + } +} + +void InvertibleRSAFunction::BERDecodePrivateKey(BufferedTransformation &bt, bool, size_t) +{ + BERSequenceDecoder privateKey(bt); + word32 version; + BERDecodeUnsigned(privateKey, version, INTEGER, 0, 0); // check version + m_n.BERDecode(privateKey); + m_e.BERDecode(privateKey); + m_d.BERDecode(privateKey); + m_p.BERDecode(privateKey); + m_q.BERDecode(privateKey); + m_dp.BERDecode(privateKey); + m_dq.BERDecode(privateKey); + m_u.BERDecode(privateKey); + privateKey.MessageEnd(); +} + +void InvertibleRSAFunction::DEREncodePrivateKey(BufferedTransformation &bt) const +{ + DERSequenceEncoder privateKey(bt); + DEREncodeUnsigned(privateKey, 0); // version + m_n.DEREncode(privateKey); + m_e.DEREncode(privateKey); + m_d.DEREncode(privateKey); + m_p.DEREncode(privateKey); + m_q.DEREncode(privateKey); + m_dp.DEREncode(privateKey); + m_dq.DEREncode(privateKey); + m_u.DEREncode(privateKey); + privateKey.MessageEnd(); +} + +Integer InvertibleRSAFunction::CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const +{ + DoQuickSanityCheck(); + ModularArithmetic modn(m_n); + Integer r, rInv; + do { // do this in a loop for people using small numbers for testing + r.Randomize(rng, Integer::One(), m_n - Integer::One()); + rInv = modn.MultiplicativeInverse(r); + } while (rInv.IsZero()); + Integer re = modn.Exponentiate(r, m_e); + re = modn.Multiply(re, x); // blind + // here we follow the notation of PKCS #1 and let u=q inverse mod p + // but in ModRoot, u=p inverse mod q, so we reverse the order of p and q + Integer y = ModularRoot(re, m_dq, m_dp, m_q, m_p, m_u); + y = modn.Multiply(y, rInv); // unblind + if (modn.Exponentiate(y, m_e) != x) // check + throw Exception(Exception::OTHER_ERROR, "InvertibleRSAFunction: computational error during private key operation"); + return y; +} + +bool InvertibleRSAFunction::Validate(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = RSAFunction::Validate(rng, level); + pass = pass && m_p > Integer::One() && m_p.IsOdd() && m_p < m_n; + pass = pass && m_q > Integer::One() && m_q.IsOdd() && m_q < m_n; + pass = pass && m_d > Integer::One() && m_d.IsOdd() && m_d < m_n; + pass = pass && m_dp > Integer::One() && m_dp.IsOdd() && m_dp < m_p; + pass = pass && m_dq > Integer::One() && m_dq.IsOdd() && m_dq < m_q; + pass = pass && m_u.IsPositive() && m_u < m_p; + if (level >= 1) + { + pass = pass && m_p * m_q == m_n; + pass = pass && m_e*m_d % LCM(m_p-1, m_q-1) == 1; + pass = pass && m_dp == m_d%(m_p-1) && m_dq == m_d%(m_q-1); + pass = pass && m_u * m_q % m_p == 1; + } + if (level >= 2) + pass = pass && VerifyPrime(rng, m_p, level-2) && VerifyPrime(rng, m_q, level-2); + return pass; +} + +bool InvertibleRSAFunction::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Prime1) + CRYPTOPP_GET_FUNCTION_ENTRY(Prime2) + CRYPTOPP_GET_FUNCTION_ENTRY(PrivateExponent) + CRYPTOPP_GET_FUNCTION_ENTRY(ModPrime1PrivateExponent) + CRYPTOPP_GET_FUNCTION_ENTRY(ModPrime2PrivateExponent) + CRYPTOPP_GET_FUNCTION_ENTRY(MultiplicativeInverseOfPrime2ModPrime1) + ; +} + +void InvertibleRSAFunction::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Prime1) + CRYPTOPP_SET_FUNCTION_ENTRY(Prime2) + CRYPTOPP_SET_FUNCTION_ENTRY(PrivateExponent) + CRYPTOPP_SET_FUNCTION_ENTRY(ModPrime1PrivateExponent) + CRYPTOPP_SET_FUNCTION_ENTRY(ModPrime2PrivateExponent) + CRYPTOPP_SET_FUNCTION_ENTRY(MultiplicativeInverseOfPrime2ModPrime1) + ; +} + +// ***************************************************************************** + +Integer RSAFunction_ISO::ApplyFunction(const Integer &x) const +{ + Integer t = RSAFunction::ApplyFunction(x); + return t % 16 == 12 ? t : m_n - t; +} + +Integer InvertibleRSAFunction_ISO::CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const +{ + Integer t = InvertibleRSAFunction::CalculateInverse(rng, x); + return STDMIN(t, m_n-t); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/rsa.h b/cryptopp/rsa.h new file mode 100644 index 0000000..6a8b185 --- /dev/null +++ b/cryptopp/rsa.h @@ -0,0 +1,174 @@ +#ifndef CRYPTOPP_RSA_H +#define CRYPTOPP_RSA_H + +/** \file + This file contains classes that implement the RSA + ciphers and signature schemes as defined in PKCS #1 v2.0. +*/ + +#include "pubkey.h" +#include "asn.h" +#include "pkcspad.h" +#include "oaep.h" +#include "emsa2.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class CRYPTOPP_DLL RSAFunction : public TrapdoorFunction, public X509PublicKey +{ + typedef RSAFunction ThisClass; + +public: + void Initialize(const Integer &n, const Integer &e) + {m_n = n; m_e = e;} + + // X509PublicKey + OID GetAlgorithmID() const; + void BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size); + void DEREncodePublicKey(BufferedTransformation &bt) const; + + // CryptoMaterial + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + + // TrapdoorFunction + Integer ApplyFunction(const Integer &x) const; + Integer PreimageBound() const {return m_n;} + Integer ImageBound() const {return m_n;} + + // non-derived + const Integer & GetModulus() const {return m_n;} + const Integer & GetPublicExponent() const {return m_e;} + + void SetModulus(const Integer &n) {m_n = n;} + void SetPublicExponent(const Integer &e) {m_e = e;} + +protected: + Integer m_n, m_e; +}; + +//! _ +class CRYPTOPP_DLL InvertibleRSAFunction : public RSAFunction, public TrapdoorFunctionInverse, public PKCS8PrivateKey +{ + typedef InvertibleRSAFunction ThisClass; + +public: + void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &e = 17); + void Initialize(const Integer &n, const Integer &e, const Integer &d, const Integer &p, const Integer &q, const Integer &dp, const Integer &dq, const Integer &u) + {m_n = n; m_e = e; m_d = d; m_p = p; m_q = q; m_dp = dp; m_dq = dq; m_u = u;} + //! factor n given private exponent + void Initialize(const Integer &n, const Integer &e, const Integer &d); + + // PKCS8PrivateKey + void BERDecode(BufferedTransformation &bt) + {PKCS8PrivateKey::BERDecode(bt);} + void DEREncode(BufferedTransformation &bt) const + {PKCS8PrivateKey::DEREncode(bt);} + void Load(BufferedTransformation &bt) + {PKCS8PrivateKey::BERDecode(bt);} + void Save(BufferedTransformation &bt) const + {PKCS8PrivateKey::DEREncode(bt);} + OID GetAlgorithmID() const {return RSAFunction::GetAlgorithmID();} + void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size); + void DEREncodePrivateKey(BufferedTransformation &bt) const; + + // TrapdoorFunctionInverse + Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const; + + // GeneratableCryptoMaterial + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + /*! parameters: (ModulusSize, PublicExponent (default 17)) */ + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg); + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + + // non-derived interface + const Integer& GetPrime1() const {return m_p;} + const Integer& GetPrime2() const {return m_q;} + const Integer& GetPrivateExponent() const {return m_d;} + const Integer& GetModPrime1PrivateExponent() const {return m_dp;} + const Integer& GetModPrime2PrivateExponent() const {return m_dq;} + const Integer& GetMultiplicativeInverseOfPrime2ModPrime1() const {return m_u;} + + void SetPrime1(const Integer &p) {m_p = p;} + void SetPrime2(const Integer &q) {m_q = q;} + void SetPrivateExponent(const Integer &d) {m_d = d;} + void SetModPrime1PrivateExponent(const Integer &dp) {m_dp = dp;} + void SetModPrime2PrivateExponent(const Integer &dq) {m_dq = dq;} + void SetMultiplicativeInverseOfPrime2ModPrime1(const Integer &u) {m_u = u;} + +protected: + Integer m_d, m_p, m_q, m_dp, m_dq, m_u; +}; + +class CRYPTOPP_DLL RSAFunction_ISO : public RSAFunction +{ +public: + Integer ApplyFunction(const Integer &x) const; + Integer PreimageBound() const {return ++(m_n>>1);} +}; + +class CRYPTOPP_DLL InvertibleRSAFunction_ISO : public InvertibleRSAFunction +{ +public: + Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const; + Integer PreimageBound() const {return ++(m_n>>1);} +}; + +//! RSA +struct CRYPTOPP_DLL RSA +{ + static const char * CRYPTOPP_API StaticAlgorithmName() {return "RSA";} + typedef RSAFunction PublicKey; + typedef InvertibleRSAFunction PrivateKey; +}; + +//! RSA cryptosystem +template +struct RSAES : public TF_ES +{ +}; + +//! RSA signature scheme with appendix +/*! See documentation of PKCS1v15 for a list of hash functions that can be used with it. */ +template +struct RSASS : public TF_SS +{ +}; + +struct CRYPTOPP_DLL RSA_ISO +{ + static const char * CRYPTOPP_API StaticAlgorithmName() {return "RSA-ISO";} + typedef RSAFunction_ISO PublicKey; + typedef InvertibleRSAFunction_ISO PrivateKey; +}; + +template +struct RSASS_ISO : public TF_SS +{ +}; + +// The two RSA encryption schemes defined in PKCS #1 v2.0 +typedef RSAES::Decryptor RSAES_PKCS1v15_Decryptor; +typedef RSAES::Encryptor RSAES_PKCS1v15_Encryptor; + +typedef RSAES >::Decryptor RSAES_OAEP_SHA_Decryptor; +typedef RSAES >::Encryptor RSAES_OAEP_SHA_Encryptor; + +// The three RSA signature schemes defined in PKCS #1 v2.0 +typedef RSASS::Signer RSASSA_PKCS1v15_SHA_Signer; +typedef RSASS::Verifier RSASSA_PKCS1v15_SHA_Verifier; + +namespace Weak { +typedef RSASS::Signer RSASSA_PKCS1v15_MD2_Signer; +typedef RSASS::Verifier RSASSA_PKCS1v15_MD2_Verifier; + +typedef RSASS::Signer RSASSA_PKCS1v15_MD5_Signer; +typedef RSASS::Verifier RSASSA_PKCS1v15_MD5_Verifier; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/rw.cpp b/cryptopp/rw.cpp new file mode 100644 index 0000000..cdd9f2d --- /dev/null +++ b/cryptopp/rw.cpp @@ -0,0 +1,196 @@ +// rw.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "rw.h" +#include "nbtheory.h" +#include "asn.h" + +#ifndef CRYPTOPP_IMPORTS + +NAMESPACE_BEGIN(CryptoPP) + +void RWFunction::BERDecode(BufferedTransformation &bt) +{ + BERSequenceDecoder seq(bt); + m_n.BERDecode(seq); + seq.MessageEnd(); +} + +void RWFunction::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + m_n.DEREncode(seq); + seq.MessageEnd(); +} + +Integer RWFunction::ApplyFunction(const Integer &in) const +{ + DoQuickSanityCheck(); + + Integer out = in.Squared()%m_n; + const word r = 12; + // this code was written to handle both r = 6 and r = 12, + // but now only r = 12 is used in P1363 + const word r2 = r/2; + const word r3a = (16 + 5 - r) % 16; // n%16 could be 5 or 13 + const word r3b = (16 + 13 - r) % 16; + const word r4 = (8 + 5 - r/2) % 8; // n%8 == 5 + switch (out % 16) + { + case r: + break; + case r2: + case r2+8: + out <<= 1; + break; + case r3a: + case r3b: + out.Negate(); + out += m_n; + break; + case r4: + case r4+8: + out.Negate(); + out += m_n; + out <<= 1; + break; + default: + out = Integer::Zero(); + } + return out; +} + +bool RWFunction::Validate(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = true; + pass = pass && m_n > Integer::One() && m_n%8 == 5; + return pass; +} + +bool RWFunction::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Modulus) + ; +} + +void RWFunction::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Modulus) + ; +} + +// ***************************************************************************** +// private key operations: + +// generate a random private key +void InvertibleRWFunction::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg) +{ + int modulusSize = 2048; + alg.GetIntValue("ModulusSize", modulusSize) || alg.GetIntValue("KeySize", modulusSize); + + if (modulusSize < 16) + throw InvalidArgument("InvertibleRWFunction: specified modulus length is too small"); + + AlgorithmParameters primeParam = MakeParametersForTwoPrimesOfEqualSize(modulusSize); + m_p.GenerateRandom(rng, CombinedNameValuePairs(primeParam, MakeParameters("EquivalentTo", 3)("Mod", 8))); + m_q.GenerateRandom(rng, CombinedNameValuePairs(primeParam, MakeParameters("EquivalentTo", 7)("Mod", 8))); + + m_n = m_p * m_q; + m_u = m_q.InverseMod(m_p); +} + +void InvertibleRWFunction::BERDecode(BufferedTransformation &bt) +{ + BERSequenceDecoder seq(bt); + m_n.BERDecode(seq); + m_p.BERDecode(seq); + m_q.BERDecode(seq); + m_u.BERDecode(seq); + seq.MessageEnd(); +} + +void InvertibleRWFunction::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + m_n.DEREncode(seq); + m_p.DEREncode(seq); + m_q.DEREncode(seq); + m_u.DEREncode(seq); + seq.MessageEnd(); +} + +Integer InvertibleRWFunction::CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const +{ + DoQuickSanityCheck(); + ModularArithmetic modn(m_n); + Integer r, rInv; + do { // do this in a loop for people using small numbers for testing + r.Randomize(rng, Integer::One(), m_n - Integer::One()); + rInv = modn.MultiplicativeInverse(r); + } while (rInv.IsZero()); + Integer re = modn.Square(r); + re = modn.Multiply(re, x); // blind + + Integer cp=re%m_p, cq=re%m_q; + if (Jacobi(cp, m_p) * Jacobi(cq, m_q) != 1) + { + cp = cp.IsOdd() ? (cp+m_p) >> 1 : cp >> 1; + cq = cq.IsOdd() ? (cq+m_q) >> 1 : cq >> 1; + } + + #pragma omp parallel + #pragma omp sections + { + #pragma omp section + cp = ModularSquareRoot(cp, m_p); + #pragma omp section + cq = ModularSquareRoot(cq, m_q); + } + + Integer y = CRT(cq, m_q, cp, m_p, m_u); + y = modn.Multiply(y, rInv); // unblind + y = STDMIN(y, m_n-y); + if (ApplyFunction(y) != x) // check + throw Exception(Exception::OTHER_ERROR, "InvertibleRWFunction: computational error during private key operation"); + return y; +} + +bool InvertibleRWFunction::Validate(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = RWFunction::Validate(rng, level); + pass = pass && m_p > Integer::One() && m_p%8 == 3 && m_p < m_n; + pass = pass && m_q > Integer::One() && m_q%8 == 7 && m_q < m_n; + pass = pass && m_u.IsPositive() && m_u < m_p; + if (level >= 1) + { + pass = pass && m_p * m_q == m_n; + pass = pass && m_u * m_q % m_p == 1; + } + if (level >= 2) + pass = pass && VerifyPrime(rng, m_p, level-2) && VerifyPrime(rng, m_q, level-2); + return pass; +} + +bool InvertibleRWFunction::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Prime1) + CRYPTOPP_GET_FUNCTION_ENTRY(Prime2) + CRYPTOPP_GET_FUNCTION_ENTRY(MultiplicativeInverseOfPrime2ModPrime1) + ; +} + +void InvertibleRWFunction::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Prime1) + CRYPTOPP_SET_FUNCTION_ENTRY(Prime2) + CRYPTOPP_SET_FUNCTION_ENTRY(MultiplicativeInverseOfPrime2ModPrime1) + ; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/rw.h b/cryptopp/rw.h new file mode 100644 index 0000000..ec8b850 --- /dev/null +++ b/cryptopp/rw.h @@ -0,0 +1,92 @@ +#ifndef CRYPTOPP_RW_H +#define CRYPTOPP_RW_H + +/** \file + This file contains classes that implement the + Rabin-Williams signature schemes as defined in IEEE P1363. +*/ + +#include "pubkey.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class CRYPTOPP_DLL RWFunction : public TrapdoorFunction, public PublicKey +{ + typedef RWFunction ThisClass; + +public: + void Initialize(const Integer &n) + {m_n = n;} + + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + Integer ApplyFunction(const Integer &x) const; + Integer PreimageBound() const {return ++(m_n>>1);} + Integer ImageBound() const {return m_n;} + + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + + const Integer& GetModulus() const {return m_n;} + void SetModulus(const Integer &n) {m_n = n;} + +protected: + Integer m_n; +}; + +//! _ +class CRYPTOPP_DLL InvertibleRWFunction : public RWFunction, public TrapdoorFunctionInverse, public PrivateKey +{ + typedef InvertibleRWFunction ThisClass; + +public: + void Initialize(const Integer &n, const Integer &p, const Integer &q, const Integer &u) + {m_n = n; m_p = p; m_q = q; m_u = u;} + // generate a random private key + void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits) + {GenerateRandomWithKeySize(rng, modulusBits);} + + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + + Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const; + + // GeneratibleCryptoMaterial + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + /*! parameters: (ModulusSize) */ + void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg); + + const Integer& GetPrime1() const {return m_p;} + const Integer& GetPrime2() const {return m_q;} + const Integer& GetMultiplicativeInverseOfPrime2ModPrime1() const {return m_u;} + + void SetPrime1(const Integer &p) {m_p = p;} + void SetPrime2(const Integer &q) {m_q = q;} + void SetMultiplicativeInverseOfPrime2ModPrime1(const Integer &u) {m_u = u;} + +protected: + Integer m_p, m_q, m_u; +}; + +//! RW +struct RW +{ + static std::string StaticAlgorithmName() {return "RW";} + typedef RWFunction PublicKey; + typedef InvertibleRWFunction PrivateKey; +}; + +//! RWSS +template +struct RWSS : public TF_SS +{ +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/safer.cpp b/cryptopp/safer.cpp new file mode 100644 index 0000000..d46ca64 --- /dev/null +++ b/cryptopp/safer.cpp @@ -0,0 +1,153 @@ +// safer.cpp - modified by by Wei Dai from Richard De Moliner's safer.c + +#include "pch.h" +#include "safer.h" +#include "misc.h" +#include "argnames.h" + +NAMESPACE_BEGIN(CryptoPP) + +const byte SAFER::Base::exp_tab[256] = + {1, 45, 226, 147, 190, 69, 21, 174, 120, 3, 135, 164, 184, 56, 207, 63, + 8, 103, 9, 148, 235, 38, 168, 107, 189, 24, 52, 27, 187, 191, 114, 247, + 64, 53, 72, 156, 81, 47, 59, 85, 227, 192, 159, 216, 211, 243, 141, 177, + 255, 167, 62, 220, 134, 119, 215, 166, 17, 251, 244, 186, 146, 145, 100, 131, + 241, 51, 239, 218, 44, 181, 178, 43, 136, 209, 153, 203, 140, 132, 29, 20, + 129, 151, 113, 202, 95, 163, 139, 87, 60, 130, 196, 82, 92, 28, 232, 160, + 4, 180, 133, 74, 246, 19, 84, 182, 223, 12, 26, 142, 222, 224, 57, 252, + 32, 155, 36, 78, 169, 152, 158, 171, 242, 96, 208, 108, 234, 250, 199, 217, + 0, 212, 31, 110, 67, 188, 236, 83, 137, 254, 122, 93, 73, 201, 50, 194, + 249, 154, 248, 109, 22, 219, 89, 150, 68, 233, 205, 230, 70, 66, 143, 10, + 193, 204, 185, 101, 176, 210, 198, 172, 30, 65, 98, 41, 46, 14, 116, 80, + 2, 90, 195, 37, 123, 138, 42, 91, 240, 6, 13, 71, 111, 112, 157, 126, + 16, 206, 18, 39, 213, 76, 79, 214, 121, 48, 104, 54, 117, 125, 228, 237, + 128, 106, 144, 55, 162, 94, 118, 170, 197, 127, 61, 175, 165, 229, 25, 97, + 253, 77, 124, 183, 11, 238, 173, 75, 34, 245, 231, 115, 35, 33, 200, 5, + 225, 102, 221, 179, 88, 105, 99, 86, 15, 161, 49, 149, 23, 7, 58, 40}; + +const byte SAFER::Base::log_tab[256] = + {128, 0, 176, 9, 96, 239, 185, 253, 16, 18, 159, 228, 105, 186, 173, 248, + 192, 56, 194, 101, 79, 6, 148, 252, 25, 222, 106, 27, 93, 78, 168, 130, + 112, 237, 232, 236, 114, 179, 21, 195, 255, 171, 182, 71, 68, 1, 172, 37, + 201, 250, 142, 65, 26, 33, 203, 211, 13, 110, 254, 38, 88, 218, 50, 15, + 32, 169, 157, 132, 152, 5, 156, 187, 34, 140, 99, 231, 197, 225, 115, 198, + 175, 36, 91, 135, 102, 39, 247, 87, 244, 150, 177, 183, 92, 139, 213, 84, + 121, 223, 170, 246, 62, 163, 241, 17, 202, 245, 209, 23, 123, 147, 131, 188, + 189, 82, 30, 235, 174, 204, 214, 53, 8, 200, 138, 180, 226, 205, 191, 217, + 208, 80, 89, 63, 77, 98, 52, 10, 72, 136, 181, 86, 76, 46, 107, 158, + 210, 61, 60, 3, 19, 251, 151, 81, 117, 74, 145, 113, 35, 190, 118, 42, + 95, 249, 212, 85, 11, 220, 55, 49, 22, 116, 215, 119, 167, 230, 7, 219, + 164, 47, 70, 243, 97, 69, 103, 227, 12, 162, 59, 28, 133, 24, 4, 29, + 41, 160, 143, 178, 90, 216, 166, 126, 238, 141, 83, 75, 161, 154, 193, 14, + 122, 73, 165, 44, 129, 196, 199, 54, 43, 127, 67, 149, 51, 242, 108, 104, + 109, 240, 2, 40, 206, 221, 155, 234, 94, 153, 124, 20, 134, 207, 229, 66, + 184, 64, 120, 45, 58, 233, 100, 31, 146, 144, 125, 57, 111, 224, 137, 48}; + +#define EXP(x) exp_tab[(x)] +#define LOG(x) log_tab[(x)] +#define PHT(x, y) { y += x; x += y; } +#define IPHT(x, y) { x -= y; y -= x; } + +static const unsigned int BLOCKSIZE = 8; +static const unsigned int MAX_ROUNDS = 13; + +void SAFER::Base::UncheckedSetKey(const byte *userkey_1, unsigned int length, const NameValuePairs ¶ms) +{ + bool strengthened = Strengthened(); + unsigned int nof_rounds = params.GetIntValueWithDefault(Name::Rounds(), length == 8 ? (strengthened ? 8 : 6) : 10); + + const byte *userkey_2 = length == 8 ? userkey_1 : userkey_1 + 8; + keySchedule.New(1 + BLOCKSIZE * (1 + 2 * nof_rounds)); + + unsigned int i, j; + byte *key = keySchedule; + SecByteBlock ka(BLOCKSIZE + 1), kb(BLOCKSIZE + 1); + + if (MAX_ROUNDS < nof_rounds) + nof_rounds = MAX_ROUNDS; + *key++ = (unsigned char)nof_rounds; + ka[BLOCKSIZE] = 0; + kb[BLOCKSIZE] = 0; + for (j = 0; j < BLOCKSIZE; j++) + { + ka[BLOCKSIZE] ^= ka[j] = rotlFixed(userkey_1[j], 5U); + kb[BLOCKSIZE] ^= kb[j] = *key++ = userkey_2[j]; + } + + for (i = 1; i <= nof_rounds; i++) + { + for (j = 0; j < BLOCKSIZE + 1; j++) + { + ka[j] = rotlFixed(ka[j], 6U); + kb[j] = rotlFixed(kb[j], 6U); + } + for (j = 0; j < BLOCKSIZE; j++) + if (strengthened) + *key++ = (ka[(j + 2 * i - 1) % (BLOCKSIZE + 1)] + + exp_tab[exp_tab[18 * i + j + 1]]) & 0xFF; + else + *key++ = (ka[j] + exp_tab[exp_tab[18 * i + j + 1]]) & 0xFF; + for (j = 0; j < BLOCKSIZE; j++) + if (strengthened) + *key++ = (kb[(j + 2 * i) % (BLOCKSIZE + 1)] + + exp_tab[exp_tab[18 * i + j + 10]]) & 0xFF; + else + *key++ = (kb[j] + exp_tab[exp_tab[18 * i + j + 10]]) & 0xFF; + } +} + +typedef BlockGetAndPut Block; + +void SAFER::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + byte a, b, c, d, e, f, g, h, t; + const byte *key = keySchedule+1; + unsigned int round = keySchedule[0]; + + Block::Get(inBlock)(a)(b)(c)(d)(e)(f)(g)(h); + while(round--) + { + a ^= key[0]; b += key[1]; c += key[2]; d ^= key[3]; + e ^= key[4]; f += key[5]; g += key[6]; h ^= key[7]; + a = EXP(a) + key[ 8]; b = LOG(b) ^ key[ 9]; + c = LOG(c) ^ key[10]; d = EXP(d) + key[11]; + e = EXP(e) + key[12]; f = LOG(f) ^ key[13]; + g = LOG(g) ^ key[14]; h = EXP(h) + key[15]; + key += 16; + PHT(a, b); PHT(c, d); PHT(e, f); PHT(g, h); + PHT(a, c); PHT(e, g); PHT(b, d); PHT(f, h); + PHT(a, e); PHT(b, f); PHT(c, g); PHT(d, h); + t = b; b = e; e = c; c = t; t = d; d = f; f = g; g = t; + } + a ^= key[0]; b += key[1]; c += key[2]; d ^= key[3]; + e ^= key[4]; f += key[5]; g += key[6]; h ^= key[7]; + Block::Put(xorBlock, outBlock)(a)(b)(c)(d)(e)(f)(g)(h); +} + +void SAFER::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + byte a, b, c, d, e, f, g, h, t; + unsigned int round = keySchedule[0]; + const byte *key = keySchedule + BLOCKSIZE * (1 + 2 * round) - 7; + + Block::Get(inBlock)(a)(b)(c)(d)(e)(f)(g)(h); + h ^= key[7]; g -= key[6]; f -= key[5]; e ^= key[4]; + d ^= key[3]; c -= key[2]; b -= key[1]; a ^= key[0]; + while (round--) + { + key -= 16; + t = e; e = b; b = c; c = t; t = f; f = d; d = g; g = t; + IPHT(a, e); IPHT(b, f); IPHT(c, g); IPHT(d, h); + IPHT(a, c); IPHT(e, g); IPHT(b, d); IPHT(f, h); + IPHT(a, b); IPHT(c, d); IPHT(e, f); IPHT(g, h); + h -= key[15]; g ^= key[14]; f ^= key[13]; e -= key[12]; + d -= key[11]; c ^= key[10]; b ^= key[9]; a -= key[8]; + h = LOG(h) ^ key[7]; g = EXP(g) - key[6]; + f = EXP(f) - key[5]; e = LOG(e) ^ key[4]; + d = LOG(d) ^ key[3]; c = EXP(c) - key[2]; + b = EXP(b) - key[1]; a = LOG(a) ^ key[0]; + } + Block::Put(xorBlock, outBlock)(a)(b)(c)(d)(e)(f)(g)(h); +} + +NAMESPACE_END diff --git a/cryptopp/safer.h b/cryptopp/safer.h new file mode 100644 index 0000000..f9a3c9e --- /dev/null +++ b/cryptopp/safer.h @@ -0,0 +1,86 @@ +#ifndef CRYPTOPP_SAFER_H +#define CRYPTOPP_SAFER_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +/// base class, do not use directly +class SAFER +{ +public: + class CRYPTOPP_NO_VTABLE Base : public BlockCipher + { + public: + unsigned int OptimalDataAlignment() const {return 1;} + void UncheckedSetKey(const byte *userkey, unsigned int length, const NameValuePairs ¶ms); + + protected: + virtual bool Strengthened() const =0; + + SecByteBlock keySchedule; + static const byte exp_tab[256]; + static const byte log_tab[256]; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; +}; + +template +class CRYPTOPP_NO_VTABLE SAFER_Impl : public BlockCipherImpl +{ +protected: + bool Strengthened() const {return STR;} +}; + +//! _ +struct SAFER_K_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 8, 16, 8>, public VariableRounds<10, 1, 13> +{ + static const char *StaticAlgorithmName() {return "SAFER-K";} +}; + +/// SAFER-K +class SAFER_K : public SAFER_K_Info, public SAFER, public BlockCipherDocumentation +{ +public: + typedef BlockCipherFinal > Encryption; + typedef BlockCipherFinal > Decryption; +}; + +//! _ +struct SAFER_SK_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 8, 16, 8>, public VariableRounds<10, 1, 13> +{ + static const char *StaticAlgorithmName() {return "SAFER-SK";} +}; + +/// SAFER-SK +class SAFER_SK : public SAFER_SK_Info, public SAFER, public BlockCipherDocumentation +{ +public: + typedef BlockCipherFinal > Encryption; + typedef BlockCipherFinal > Decryption; +}; + +typedef SAFER_K::Encryption SAFER_K_Encryption; +typedef SAFER_K::Decryption SAFER_K_Decryption; + +typedef SAFER_SK::Encryption SAFER_SK_Encryption; +typedef SAFER_SK::Decryption SAFER_SK_Decryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/salsa.cpp b/cryptopp/salsa.cpp new file mode 100644 index 0000000..bd216ee --- /dev/null +++ b/cryptopp/salsa.cpp @@ -0,0 +1,598 @@ +// salsa.cpp - written and placed in the public domain by Wei Dai + +// use "cl /EP /P /DCRYPTOPP_GENERATE_X64_MASM salsa.cpp" to generate MASM code + +#include "pch.h" + +#ifndef CRYPTOPP_GENERATE_X64_MASM + +#include "salsa.h" +#include "misc.h" +#include "argnames.h" +#include "cpu.h" + +NAMESPACE_BEGIN(CryptoPP) + +void Salsa20_TestInstantiations() +{ + Salsa20::Encryption x; +} + +void Salsa20_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) +{ + m_rounds = params.GetIntValueWithDefault(Name::Rounds(), 20); + + if (!(m_rounds == 8 || m_rounds == 12 || m_rounds == 20)) + throw InvalidRounds(Salsa20::StaticAlgorithmName(), m_rounds); + + // m_state is reordered for SSE2 + GetBlock get1(key); + get1(m_state[13])(m_state[10])(m_state[7])(m_state[4]); + GetBlock get2(key + length - 16); + get2(m_state[15])(m_state[12])(m_state[9])(m_state[6]); + + // "expand 16-byte k" or "expand 32-byte k" + m_state[0] = 0x61707865; + m_state[1] = (length == 16) ? 0x3120646e : 0x3320646e; + m_state[2] = (length == 16) ? 0x79622d36 : 0x79622d32; + m_state[3] = 0x6b206574; +} + +void Salsa20_Policy::CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length) +{ + assert(length==8); + GetBlock get(IV); + get(m_state[14])(m_state[11]); + m_state[8] = m_state[5] = 0; +} + +void Salsa20_Policy::SeekToIteration(lword iterationCount) +{ + m_state[8] = (word32)iterationCount; + m_state[5] = (word32)SafeRightShift<32>(iterationCount); +} + +#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64 +unsigned int Salsa20_Policy::GetAlignment() const +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + if (HasSSE2()) + return 16; + else +#endif + return GetAlignmentOf(); +} + +unsigned int Salsa20_Policy::GetOptimalBlockSize() const +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + if (HasSSE2()) + return 4*BYTES_PER_ITERATION; + else +#endif + return BYTES_PER_ITERATION; +} +#endif + +#ifdef CRYPTOPP_X64_MASM_AVAILABLE +extern "C" { +void Salsa20_OperateKeystream(byte *output, const byte *input, size_t iterationCount, int rounds, void *state); +} +#endif + +#pragma warning(disable: 4731) // frame pointer register 'ebp' modified by inline assembly code + +void Salsa20_Policy::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) +{ +#endif // #ifdef CRYPTOPP_GENERATE_X64_MASM + +#ifdef CRYPTOPP_X64_MASM_AVAILABLE + Salsa20_OperateKeystream(output, input, iterationCount, m_rounds, m_state.data()); + return; +#endif + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +#ifdef CRYPTOPP_GENERATE_X64_MASM + ALIGN 8 + Salsa20_OperateKeystream PROC FRAME + mov r10, [rsp + 5*8] ; state + alloc_stack(10*16 + 32*16 + 8) + save_xmm128 xmm6, 0200h + save_xmm128 xmm7, 0210h + save_xmm128 xmm8, 0220h + save_xmm128 xmm9, 0230h + save_xmm128 xmm10, 0240h + save_xmm128 xmm11, 0250h + save_xmm128 xmm12, 0260h + save_xmm128 xmm13, 0270h + save_xmm128 xmm14, 0280h + save_xmm128 xmm15, 0290h + .endprolog + + #define REG_output rcx + #define REG_input rdx + #define REG_iterationCount r8 + #define REG_state r10 + #define REG_rounds e9d + #define REG_roundsLeft eax + #define REG_temp32 r11d + #define REG_temp r11 + #define SSE2_WORKSPACE rsp +#else + if (HasSSE2()) + { + #if CRYPTOPP_BOOL_X64 + #define REG_output %4 + #define REG_input %1 + #define REG_iterationCount %2 + #define REG_state %3 + #define REG_rounds %0 + #define REG_roundsLeft eax + #define REG_temp32 edx + #define REG_temp rdx + #define SSE2_WORKSPACE %5 + + FixedSizeAlignedSecBlock workspace; + #else + #define REG_output edi + #define REG_input eax + #define REG_iterationCount ecx + #define REG_state esi + #define REG_rounds edx + #define REG_roundsLeft ebx + #define REG_temp32 ebp + #define REG_temp ebp + #define SSE2_WORKSPACE esp + WORD_SZ + #endif + + #ifdef __GNUC__ + __asm__ __volatile__ + ( + ".intel_syntax noprefix;" + AS_PUSH_IF86( bx) + #else + void *s = m_state.data(); + word32 r = m_rounds; + + AS2( mov REG_iterationCount, iterationCount) + AS2( mov REG_input, input) + AS2( mov REG_output, output) + AS2( mov REG_state, s) + AS2( mov REG_rounds, r) + #endif +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM + + AS_PUSH_IF86( bp) + AS2( cmp REG_iterationCount, 4) + ASJ( jl, 5, f) + +#if CRYPTOPP_BOOL_X86 + AS2( mov ebx, esp) + AS2( and esp, -16) + AS2( sub esp, 32*16) + AS1( push ebx) +#endif + +#define SSE2_EXPAND_S(i, j) \ + ASS( pshufd xmm4, xmm##i, j, j, j, j) \ + AS2( movdqa [SSE2_WORKSPACE + (i*4+j)*16 + 256], xmm4) + + AS2( movdqa xmm0, [REG_state + 0*16]) + AS2( movdqa xmm1, [REG_state + 1*16]) + AS2( movdqa xmm2, [REG_state + 2*16]) + AS2( movdqa xmm3, [REG_state + 3*16]) + SSE2_EXPAND_S(0, 0) + SSE2_EXPAND_S(0, 1) + SSE2_EXPAND_S(0, 2) + SSE2_EXPAND_S(0, 3) + SSE2_EXPAND_S(1, 0) + SSE2_EXPAND_S(1, 2) + SSE2_EXPAND_S(1, 3) + SSE2_EXPAND_S(2, 1) + SSE2_EXPAND_S(2, 2) + SSE2_EXPAND_S(2, 3) + SSE2_EXPAND_S(3, 0) + SSE2_EXPAND_S(3, 1) + SSE2_EXPAND_S(3, 2) + SSE2_EXPAND_S(3, 3) + +#define SSE2_EXPAND_S85(i) \ + AS2( mov dword ptr [SSE2_WORKSPACE + 8*16 + i*4 + 256], REG_roundsLeft) \ + AS2( mov dword ptr [SSE2_WORKSPACE + 5*16 + i*4 + 256], REG_temp32) \ + AS2( add REG_roundsLeft, 1) \ + AS2( adc REG_temp32, 0) + + ASL(1) + AS2( mov REG_roundsLeft, dword ptr [REG_state + 8*4]) + AS2( mov REG_temp32, dword ptr [REG_state + 5*4]) + SSE2_EXPAND_S85(0) + SSE2_EXPAND_S85(1) + SSE2_EXPAND_S85(2) + SSE2_EXPAND_S85(3) + AS2( mov dword ptr [REG_state + 8*4], REG_roundsLeft) + AS2( mov dword ptr [REG_state + 5*4], REG_temp32) + +#define SSE2_QUARTER_ROUND(a, b, d, i) \ + AS2( movdqa xmm4, xmm##d) \ + AS2( paddd xmm4, xmm##a) \ + AS2( movdqa xmm5, xmm4) \ + AS2( pslld xmm4, i) \ + AS2( psrld xmm5, 32-i) \ + AS2( pxor xmm##b, xmm4) \ + AS2( pxor xmm##b, xmm5) + +#define L01(A,B,C,D,a,b,c,d,i) AS2( movdqa xmm##A, [SSE2_WORKSPACE + d*16 + i*256]) /* y3 */ +#define L02(A,B,C,D,a,b,c,d,i) AS2( movdqa xmm##C, [SSE2_WORKSPACE + a*16 + i*256]) /* y0 */ +#define L03(A,B,C,D,a,b,c,d,i) AS2( paddd xmm##A, xmm##C) /* y0+y3 */ +#define L04(A,B,C,D,a,b,c,d,i) AS2( movdqa xmm##B, xmm##A) +#define L05(A,B,C,D,a,b,c,d,i) AS2( pslld xmm##A, 7) +#define L06(A,B,C,D,a,b,c,d,i) AS2( psrld xmm##B, 32-7) +#define L07(A,B,C,D,a,b,c,d,i) AS2( pxor xmm##A, [SSE2_WORKSPACE + b*16 + i*256]) +#define L08(A,B,C,D,a,b,c,d,i) AS2( pxor xmm##A, xmm##B) /* z1 */ +#define L09(A,B,C,D,a,b,c,d,i) AS2( movdqa [SSE2_WORKSPACE + b*16], xmm##A) +#define L10(A,B,C,D,a,b,c,d,i) AS2( movdqa xmm##B, xmm##A) +#define L11(A,B,C,D,a,b,c,d,i) AS2( paddd xmm##A, xmm##C) /* z1+y0 */ +#define L12(A,B,C,D,a,b,c,d,i) AS2( movdqa xmm##D, xmm##A) +#define L13(A,B,C,D,a,b,c,d,i) AS2( pslld xmm##A, 9) +#define L14(A,B,C,D,a,b,c,d,i) AS2( psrld xmm##D, 32-9) +#define L15(A,B,C,D,a,b,c,d,i) AS2( pxor xmm##A, [SSE2_WORKSPACE + c*16 + i*256]) +#define L16(A,B,C,D,a,b,c,d,i) AS2( pxor xmm##A, xmm##D) /* z2 */ +#define L17(A,B,C,D,a,b,c,d,i) AS2( movdqa [SSE2_WORKSPACE + c*16], xmm##A) +#define L18(A,B,C,D,a,b,c,d,i) AS2( movdqa xmm##D, xmm##A) +#define L19(A,B,C,D,a,b,c,d,i) AS2( paddd xmm##A, xmm##B) /* z2+z1 */ +#define L20(A,B,C,D,a,b,c,d,i) AS2( movdqa xmm##B, xmm##A) +#define L21(A,B,C,D,a,b,c,d,i) AS2( pslld xmm##A, 13) +#define L22(A,B,C,D,a,b,c,d,i) AS2( psrld xmm##B, 32-13) +#define L23(A,B,C,D,a,b,c,d,i) AS2( pxor xmm##A, [SSE2_WORKSPACE + d*16 + i*256]) +#define L24(A,B,C,D,a,b,c,d,i) AS2( pxor xmm##A, xmm##B) /* z3 */ +#define L25(A,B,C,D,a,b,c,d,i) AS2( movdqa [SSE2_WORKSPACE + d*16], xmm##A) +#define L26(A,B,C,D,a,b,c,d,i) AS2( paddd xmm##A, xmm##D) /* z3+z2 */ +#define L27(A,B,C,D,a,b,c,d,i) AS2( movdqa xmm##D, xmm##A) +#define L28(A,B,C,D,a,b,c,d,i) AS2( pslld xmm##A, 18) +#define L29(A,B,C,D,a,b,c,d,i) AS2( psrld xmm##D, 32-18) +#define L30(A,B,C,D,a,b,c,d,i) AS2( pxor xmm##A, xmm##C) /* xor y0 */ +#define L31(A,B,C,D,a,b,c,d,i) AS2( pxor xmm##A, xmm##D) /* z0 */ +#define L32(A,B,C,D,a,b,c,d,i) AS2( movdqa [SSE2_WORKSPACE + a*16], xmm##A) + +#define SSE2_QUARTER_ROUND_X8(i, a, b, c, d, e, f, g, h) \ + L01(0,1,2,3, a,b,c,d, i) L01(4,5,6,7, e,f,g,h, i) \ + L02(0,1,2,3, a,b,c,d, i) L02(4,5,6,7, e,f,g,h, i) \ + L03(0,1,2,3, a,b,c,d, i) L03(4,5,6,7, e,f,g,h, i) \ + L04(0,1,2,3, a,b,c,d, i) L04(4,5,6,7, e,f,g,h, i) \ + L05(0,1,2,3, a,b,c,d, i) L05(4,5,6,7, e,f,g,h, i) \ + L06(0,1,2,3, a,b,c,d, i) L06(4,5,6,7, e,f,g,h, i) \ + L07(0,1,2,3, a,b,c,d, i) L07(4,5,6,7, e,f,g,h, i) \ + L08(0,1,2,3, a,b,c,d, i) L08(4,5,6,7, e,f,g,h, i) \ + L09(0,1,2,3, a,b,c,d, i) L09(4,5,6,7, e,f,g,h, i) \ + L10(0,1,2,3, a,b,c,d, i) L10(4,5,6,7, e,f,g,h, i) \ + L11(0,1,2,3, a,b,c,d, i) L11(4,5,6,7, e,f,g,h, i) \ + L12(0,1,2,3, a,b,c,d, i) L12(4,5,6,7, e,f,g,h, i) \ + L13(0,1,2,3, a,b,c,d, i) L13(4,5,6,7, e,f,g,h, i) \ + L14(0,1,2,3, a,b,c,d, i) L14(4,5,6,7, e,f,g,h, i) \ + L15(0,1,2,3, a,b,c,d, i) L15(4,5,6,7, e,f,g,h, i) \ + L16(0,1,2,3, a,b,c,d, i) L16(4,5,6,7, e,f,g,h, i) \ + L17(0,1,2,3, a,b,c,d, i) L17(4,5,6,7, e,f,g,h, i) \ + L18(0,1,2,3, a,b,c,d, i) L18(4,5,6,7, e,f,g,h, i) \ + L19(0,1,2,3, a,b,c,d, i) L19(4,5,6,7, e,f,g,h, i) \ + L20(0,1,2,3, a,b,c,d, i) L20(4,5,6,7, e,f,g,h, i) \ + L21(0,1,2,3, a,b,c,d, i) L21(4,5,6,7, e,f,g,h, i) \ + L22(0,1,2,3, a,b,c,d, i) L22(4,5,6,7, e,f,g,h, i) \ + L23(0,1,2,3, a,b,c,d, i) L23(4,5,6,7, e,f,g,h, i) \ + L24(0,1,2,3, a,b,c,d, i) L24(4,5,6,7, e,f,g,h, i) \ + L25(0,1,2,3, a,b,c,d, i) L25(4,5,6,7, e,f,g,h, i) \ + L26(0,1,2,3, a,b,c,d, i) L26(4,5,6,7, e,f,g,h, i) \ + L27(0,1,2,3, a,b,c,d, i) L27(4,5,6,7, e,f,g,h, i) \ + L28(0,1,2,3, a,b,c,d, i) L28(4,5,6,7, e,f,g,h, i) \ + L29(0,1,2,3, a,b,c,d, i) L29(4,5,6,7, e,f,g,h, i) \ + L30(0,1,2,3, a,b,c,d, i) L30(4,5,6,7, e,f,g,h, i) \ + L31(0,1,2,3, a,b,c,d, i) L31(4,5,6,7, e,f,g,h, i) \ + L32(0,1,2,3, a,b,c,d, i) L32(4,5,6,7, e,f,g,h, i) + +#define SSE2_QUARTER_ROUND_X16(i, a, b, c, d, e, f, g, h, A, B, C, D, E, F, G, H) \ + L01(0,1,2,3, a,b,c,d, i) L01(4,5,6,7, e,f,g,h, i) L01(8,9,10,11, A,B,C,D, i) L01(12,13,14,15, E,F,G,H, i) \ + L02(0,1,2,3, a,b,c,d, i) L02(4,5,6,7, e,f,g,h, i) L02(8,9,10,11, A,B,C,D, i) L02(12,13,14,15, E,F,G,H, i) \ + L03(0,1,2,3, a,b,c,d, i) L03(4,5,6,7, e,f,g,h, i) L03(8,9,10,11, A,B,C,D, i) L03(12,13,14,15, E,F,G,H, i) \ + L04(0,1,2,3, a,b,c,d, i) L04(4,5,6,7, e,f,g,h, i) L04(8,9,10,11, A,B,C,D, i) L04(12,13,14,15, E,F,G,H, i) \ + L05(0,1,2,3, a,b,c,d, i) L05(4,5,6,7, e,f,g,h, i) L05(8,9,10,11, A,B,C,D, i) L05(12,13,14,15, E,F,G,H, i) \ + L06(0,1,2,3, a,b,c,d, i) L06(4,5,6,7, e,f,g,h, i) L06(8,9,10,11, A,B,C,D, i) L06(12,13,14,15, E,F,G,H, i) \ + L07(0,1,2,3, a,b,c,d, i) L07(4,5,6,7, e,f,g,h, i) L07(8,9,10,11, A,B,C,D, i) L07(12,13,14,15, E,F,G,H, i) \ + L08(0,1,2,3, a,b,c,d, i) L08(4,5,6,7, e,f,g,h, i) L08(8,9,10,11, A,B,C,D, i) L08(12,13,14,15, E,F,G,H, i) \ + L09(0,1,2,3, a,b,c,d, i) L09(4,5,6,7, e,f,g,h, i) L09(8,9,10,11, A,B,C,D, i) L09(12,13,14,15, E,F,G,H, i) \ + L10(0,1,2,3, a,b,c,d, i) L10(4,5,6,7, e,f,g,h, i) L10(8,9,10,11, A,B,C,D, i) L10(12,13,14,15, E,F,G,H, i) \ + L11(0,1,2,3, a,b,c,d, i) L11(4,5,6,7, e,f,g,h, i) L11(8,9,10,11, A,B,C,D, i) L11(12,13,14,15, E,F,G,H, i) \ + L12(0,1,2,3, a,b,c,d, i) L12(4,5,6,7, e,f,g,h, i) L12(8,9,10,11, A,B,C,D, i) L12(12,13,14,15, E,F,G,H, i) \ + L13(0,1,2,3, a,b,c,d, i) L13(4,5,6,7, e,f,g,h, i) L13(8,9,10,11, A,B,C,D, i) L13(12,13,14,15, E,F,G,H, i) \ + L14(0,1,2,3, a,b,c,d, i) L14(4,5,6,7, e,f,g,h, i) L14(8,9,10,11, A,B,C,D, i) L14(12,13,14,15, E,F,G,H, i) \ + L15(0,1,2,3, a,b,c,d, i) L15(4,5,6,7, e,f,g,h, i) L15(8,9,10,11, A,B,C,D, i) L15(12,13,14,15, E,F,G,H, i) \ + L16(0,1,2,3, a,b,c,d, i) L16(4,5,6,7, e,f,g,h, i) L16(8,9,10,11, A,B,C,D, i) L16(12,13,14,15, E,F,G,H, i) \ + L17(0,1,2,3, a,b,c,d, i) L17(4,5,6,7, e,f,g,h, i) L17(8,9,10,11, A,B,C,D, i) L17(12,13,14,15, E,F,G,H, i) \ + L18(0,1,2,3, a,b,c,d, i) L18(4,5,6,7, e,f,g,h, i) L18(8,9,10,11, A,B,C,D, i) L18(12,13,14,15, E,F,G,H, i) \ + L19(0,1,2,3, a,b,c,d, i) L19(4,5,6,7, e,f,g,h, i) L19(8,9,10,11, A,B,C,D, i) L19(12,13,14,15, E,F,G,H, i) \ + L20(0,1,2,3, a,b,c,d, i) L20(4,5,6,7, e,f,g,h, i) L20(8,9,10,11, A,B,C,D, i) L20(12,13,14,15, E,F,G,H, i) \ + L21(0,1,2,3, a,b,c,d, i) L21(4,5,6,7, e,f,g,h, i) L21(8,9,10,11, A,B,C,D, i) L21(12,13,14,15, E,F,G,H, i) \ + L22(0,1,2,3, a,b,c,d, i) L22(4,5,6,7, e,f,g,h, i) L22(8,9,10,11, A,B,C,D, i) L22(12,13,14,15, E,F,G,H, i) \ + L23(0,1,2,3, a,b,c,d, i) L23(4,5,6,7, e,f,g,h, i) L23(8,9,10,11, A,B,C,D, i) L23(12,13,14,15, E,F,G,H, i) \ + L24(0,1,2,3, a,b,c,d, i) L24(4,5,6,7, e,f,g,h, i) L24(8,9,10,11, A,B,C,D, i) L24(12,13,14,15, E,F,G,H, i) \ + L25(0,1,2,3, a,b,c,d, i) L25(4,5,6,7, e,f,g,h, i) L25(8,9,10,11, A,B,C,D, i) L25(12,13,14,15, E,F,G,H, i) \ + L26(0,1,2,3, a,b,c,d, i) L26(4,5,6,7, e,f,g,h, i) L26(8,9,10,11, A,B,C,D, i) L26(12,13,14,15, E,F,G,H, i) \ + L27(0,1,2,3, a,b,c,d, i) L27(4,5,6,7, e,f,g,h, i) L27(8,9,10,11, A,B,C,D, i) L27(12,13,14,15, E,F,G,H, i) \ + L28(0,1,2,3, a,b,c,d, i) L28(4,5,6,7, e,f,g,h, i) L28(8,9,10,11, A,B,C,D, i) L28(12,13,14,15, E,F,G,H, i) \ + L29(0,1,2,3, a,b,c,d, i) L29(4,5,6,7, e,f,g,h, i) L29(8,9,10,11, A,B,C,D, i) L29(12,13,14,15, E,F,G,H, i) \ + L30(0,1,2,3, a,b,c,d, i) L30(4,5,6,7, e,f,g,h, i) L30(8,9,10,11, A,B,C,D, i) L30(12,13,14,15, E,F,G,H, i) \ + L31(0,1,2,3, a,b,c,d, i) L31(4,5,6,7, e,f,g,h, i) L31(8,9,10,11, A,B,C,D, i) L31(12,13,14,15, E,F,G,H, i) \ + L32(0,1,2,3, a,b,c,d, i) L32(4,5,6,7, e,f,g,h, i) L32(8,9,10,11, A,B,C,D, i) L32(12,13,14,15, E,F,G,H, i) + +#if CRYPTOPP_BOOL_X64 + SSE2_QUARTER_ROUND_X16(1, 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15) +#else + SSE2_QUARTER_ROUND_X8(1, 2, 6, 10, 14, 3, 7, 11, 15) + SSE2_QUARTER_ROUND_X8(1, 0, 4, 8, 12, 1, 5, 9, 13) +#endif + AS2( mov REG_roundsLeft, REG_rounds) + ASJ( jmp, 2, f) + + ASL(SSE2_Salsa_Output) + AS2( movdqa xmm0, xmm4) + AS2( punpckldq xmm4, xmm5) + AS2( movdqa xmm1, xmm6) + AS2( punpckldq xmm6, xmm7) + AS2( movdqa xmm2, xmm4) + AS2( punpcklqdq xmm4, xmm6) // e + AS2( punpckhqdq xmm2, xmm6) // f + AS2( punpckhdq xmm0, xmm5) + AS2( punpckhdq xmm1, xmm7) + AS2( movdqa xmm6, xmm0) + AS2( punpcklqdq xmm0, xmm1) // g + AS2( punpckhqdq xmm6, xmm1) // h + AS_XMM_OUTPUT4(SSE2_Salsa_Output_A, REG_input, REG_output, 4, 2, 0, 6, 1, 0, 4, 8, 12, 1) + AS1( ret) + + ASL(6) +#if CRYPTOPP_BOOL_X64 + SSE2_QUARTER_ROUND_X16(0, 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15) + ASL(2) + SSE2_QUARTER_ROUND_X16(0, 0, 13, 10, 7, 1, 14, 11, 4, 2, 15, 8, 5, 3, 12, 9, 6) +#else + SSE2_QUARTER_ROUND_X8(0, 2, 6, 10, 14, 3, 7, 11, 15) + SSE2_QUARTER_ROUND_X8(0, 0, 4, 8, 12, 1, 5, 9, 13) + ASL(2) + SSE2_QUARTER_ROUND_X8(0, 2, 15, 8, 5, 3, 12, 9, 6) + SSE2_QUARTER_ROUND_X8(0, 0, 13, 10, 7, 1, 14, 11, 4) +#endif + AS2( sub REG_roundsLeft, 2) + ASJ( jnz, 6, b) + +#define SSE2_OUTPUT_4(a, b, c, d) \ + AS2( movdqa xmm4, [SSE2_WORKSPACE + a*16 + 256])\ + AS2( paddd xmm4, [SSE2_WORKSPACE + a*16])\ + AS2( movdqa xmm5, [SSE2_WORKSPACE + b*16 + 256])\ + AS2( paddd xmm5, [SSE2_WORKSPACE + b*16])\ + AS2( movdqa xmm6, [SSE2_WORKSPACE + c*16 + 256])\ + AS2( paddd xmm6, [SSE2_WORKSPACE + c*16])\ + AS2( movdqa xmm7, [SSE2_WORKSPACE + d*16 + 256])\ + AS2( paddd xmm7, [SSE2_WORKSPACE + d*16])\ + ASC( call, SSE2_Salsa_Output) + + SSE2_OUTPUT_4(0, 13, 10, 7) + SSE2_OUTPUT_4(4, 1, 14, 11) + SSE2_OUTPUT_4(8, 5, 2, 15) + SSE2_OUTPUT_4(12, 9, 6, 3) + AS2( test REG_input, REG_input) + ASJ( jz, 9, f) + AS2( add REG_input, 12*16) + ASL(9) + AS2( add REG_output, 12*16) + AS2( sub REG_iterationCount, 4) + AS2( cmp REG_iterationCount, 4) + ASJ( jge, 1, b) + AS_POP_IF86( sp) + + ASL(5) + AS2( sub REG_iterationCount, 1) + ASJ( jl, 4, f) + AS2( movdqa xmm0, [REG_state + 0*16]) + AS2( movdqa xmm1, [REG_state + 1*16]) + AS2( movdqa xmm2, [REG_state + 2*16]) + AS2( movdqa xmm3, [REG_state + 3*16]) + AS2( mov REG_roundsLeft, REG_rounds) + + ASL(0) + SSE2_QUARTER_ROUND(0, 1, 3, 7) + SSE2_QUARTER_ROUND(1, 2, 0, 9) + SSE2_QUARTER_ROUND(2, 3, 1, 13) + SSE2_QUARTER_ROUND(3, 0, 2, 18) + ASS( pshufd xmm1, xmm1, 2, 1, 0, 3) + ASS( pshufd xmm2, xmm2, 1, 0, 3, 2) + ASS( pshufd xmm3, xmm3, 0, 3, 2, 1) + SSE2_QUARTER_ROUND(0, 3, 1, 7) + SSE2_QUARTER_ROUND(3, 2, 0, 9) + SSE2_QUARTER_ROUND(2, 1, 3, 13) + SSE2_QUARTER_ROUND(1, 0, 2, 18) + ASS( pshufd xmm1, xmm1, 0, 3, 2, 1) + ASS( pshufd xmm2, xmm2, 1, 0, 3, 2) + ASS( pshufd xmm3, xmm3, 2, 1, 0, 3) + AS2( sub REG_roundsLeft, 2) + ASJ( jnz, 0, b) + + AS2( paddd xmm0, [REG_state + 0*16]) + AS2( paddd xmm1, [REG_state + 1*16]) + AS2( paddd xmm2, [REG_state + 2*16]) + AS2( paddd xmm3, [REG_state + 3*16]) + + AS2( add dword ptr [REG_state + 8*4], 1) + AS2( adc dword ptr [REG_state + 5*4], 0) + + AS2( pcmpeqb xmm6, xmm6) // all ones + AS2( psrlq xmm6, 32) // lo32 mask + ASS( pshufd xmm7, xmm6, 0, 1, 2, 3) // hi32 mask + AS2( movdqa xmm4, xmm0) + AS2( movdqa xmm5, xmm3) + AS2( pand xmm0, xmm7) + AS2( pand xmm4, xmm6) + AS2( pand xmm3, xmm6) + AS2( pand xmm5, xmm7) + AS2( por xmm4, xmm5) // 0,13,2,15 + AS2( movdqa xmm5, xmm1) + AS2( pand xmm1, xmm7) + AS2( pand xmm5, xmm6) + AS2( por xmm0, xmm5) // 4,1,6,3 + AS2( pand xmm6, xmm2) + AS2( pand xmm2, xmm7) + AS2( por xmm1, xmm6) // 8,5,10,7 + AS2( por xmm2, xmm3) // 12,9,14,11 + + AS2( movdqa xmm5, xmm4) + AS2( movdqa xmm6, xmm0) + AS3( shufpd xmm4, xmm1, 2) // 0,13,10,7 + AS3( shufpd xmm0, xmm2, 2) // 4,1,14,11 + AS3( shufpd xmm1, xmm5, 2) // 8,5,2,15 + AS3( shufpd xmm2, xmm6, 2) // 12,9,6,3 + + // output keystream + AS_XMM_OUTPUT4(SSE2_Salsa_Output_B, REG_input, REG_output, 4, 0, 1, 2, 3, 0, 1, 2, 3, 4) + ASJ( jmp, 5, b) + ASL(4) + + AS_POP_IF86( bp) +#ifdef __GNUC__ + AS_POP_IF86( bx) + ".att_syntax prefix;" + : + #if CRYPTOPP_BOOL_X64 + : "r" (m_rounds), "r" (input), "r" (iterationCount), "r" (m_state.data()), "r" (output), "r" (workspace.m_ptr) + : "%eax", "%edx", "memory", "cc", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "%xmm8", "%xmm9", "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15" + #else + : "d" (m_rounds), "a" (input), "c" (iterationCount), "S" (m_state.data()), "D" (output) + : "memory", "cc" + #endif + ); +#endif +#ifdef CRYPTOPP_GENERATE_X64_MASM + movdqa xmm6, [rsp + 0200h] + movdqa xmm7, [rsp + 0210h] + movdqa xmm8, [rsp + 0220h] + movdqa xmm9, [rsp + 0230h] + movdqa xmm10, [rsp + 0240h] + movdqa xmm11, [rsp + 0250h] + movdqa xmm12, [rsp + 0260h] + movdqa xmm13, [rsp + 0270h] + movdqa xmm14, [rsp + 0280h] + movdqa xmm15, [rsp + 0290h] + add rsp, 10*16 + 32*16 + 8 + ret +Salsa20_OperateKeystream ENDP +#else + } + else +#endif +#endif +#ifndef CRYPTOPP_GENERATE_X64_MASM + { + word32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; + + while (iterationCount--) + { + x0 = m_state[0]; x1 = m_state[1]; x2 = m_state[2]; x3 = m_state[3]; + x4 = m_state[4]; x5 = m_state[5]; x6 = m_state[6]; x7 = m_state[7]; + x8 = m_state[8]; x9 = m_state[9]; x10 = m_state[10]; x11 = m_state[11]; + x12 = m_state[12]; x13 = m_state[13]; x14 = m_state[14]; x15 = m_state[15]; + + for (int i=m_rounds; i>0; i-=2) + { + #define QUARTER_ROUND(a, b, c, d) \ + b = b ^ rotlFixed(a + d, 7); \ + c = c ^ rotlFixed(b + a, 9); \ + d = d ^ rotlFixed(c + b, 13); \ + a = a ^ rotlFixed(d + c, 18); + + QUARTER_ROUND(x0, x4, x8, x12) + QUARTER_ROUND(x1, x5, x9, x13) + QUARTER_ROUND(x2, x6, x10, x14) + QUARTER_ROUND(x3, x7, x11, x15) + + QUARTER_ROUND(x0, x13, x10, x7) + QUARTER_ROUND(x1, x14, x11, x4) + QUARTER_ROUND(x2, x15, x8, x5) + QUARTER_ROUND(x3, x12, x9, x6) + } + + #define SALSA_OUTPUT(x) {\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 0, x0 + m_state[0]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 1, x13 + m_state[13]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 2, x10 + m_state[10]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 3, x7 + m_state[7]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 4, x4 + m_state[4]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 5, x1 + m_state[1]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 6, x14 + m_state[14]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 7, x11 + m_state[11]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 8, x8 + m_state[8]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 9, x5 + m_state[5]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 10, x2 + m_state[2]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 11, x15 + m_state[15]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 12, x12 + m_state[12]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 13, x9 + m_state[9]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 14, x6 + m_state[6]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 15, x3 + m_state[3]);} + +#ifndef CRYPTOPP_DOXYGEN_PROCESSING + CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH(SALSA_OUTPUT, BYTES_PER_ITERATION); +#endif + + if (++m_state[8] == 0) + ++m_state[5]; + } + } +} // see comment above if an internal compiler error occurs here + +void XSalsa20_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) +{ + m_rounds = params.GetIntValueWithDefault(Name::Rounds(), 20); + + if (!(m_rounds == 8 || m_rounds == 12 || m_rounds == 20)) + throw InvalidRounds(XSalsa20::StaticAlgorithmName(), m_rounds); + + GetUserKey(LITTLE_ENDIAN_ORDER, m_key.begin(), m_key.size(), key, length); + if (length == 16) + memcpy(m_key.begin()+4, m_key.begin(), 16); + + // "expand 32-byte k" + m_state[0] = 0x61707865; + m_state[1] = 0x3320646e; + m_state[2] = 0x79622d32; + m_state[3] = 0x6b206574; +} + +void XSalsa20_Policy::CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length) +{ + assert(length==24); + + word32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; + + GetBlock get(IV); + get(x14)(x11)(x8)(x5)(m_state[14])(m_state[11]); + + x13 = m_key[0]; x10 = m_key[1]; x7 = m_key[2]; x4 = m_key[3]; + x15 = m_key[4]; x12 = m_key[5]; x9 = m_key[6]; x6 = m_key[7]; + x0 = m_state[0]; x1 = m_state[1]; x2 = m_state[2]; x3 = m_state[3]; + + for (int i=m_rounds; i>0; i-=2) + { + QUARTER_ROUND(x0, x4, x8, x12) + QUARTER_ROUND(x1, x5, x9, x13) + QUARTER_ROUND(x2, x6, x10, x14) + QUARTER_ROUND(x3, x7, x11, x15) + + QUARTER_ROUND(x0, x13, x10, x7) + QUARTER_ROUND(x1, x14, x11, x4) + QUARTER_ROUND(x2, x15, x8, x5) + QUARTER_ROUND(x3, x12, x9, x6) + } + + m_state[13] = x0; m_state[10] = x1; m_state[7] = x2; m_state[4] = x3; + m_state[15] = x14; m_state[12] = x11; m_state[9] = x8; m_state[6] = x5; + m_state[8] = m_state[5] = 0; +} + +NAMESPACE_END + +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM diff --git a/cryptopp/salsa.h b/cryptopp/salsa.h new file mode 100644 index 0000000..49af885 --- /dev/null +++ b/cryptopp/salsa.h @@ -0,0 +1,65 @@ +// salsa.h - written and placed in the public domain by Wei Dai + +#ifndef CRYPTOPP_SALSA_H +#define CRYPTOPP_SALSA_H + +#include "strciphr.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct Salsa20_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::UNIQUE_IV, 8> +{ + static const char *StaticAlgorithmName() {return "Salsa20";} +}; + +class CRYPTOPP_NO_VTABLE Salsa20_Policy : public AdditiveCipherConcretePolicy +{ +protected: + void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); + void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); + void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length); + bool CipherIsRandomAccess() const {return true;} + void SeekToIteration(lword iterationCount); +#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64 + unsigned int GetAlignment() const; + unsigned int GetOptimalBlockSize() const; +#endif + + FixedSizeAlignedSecBlock m_state; + int m_rounds; +}; + +/// Salsa20, variable rounds: 8, 12 or 20 (default 20) +struct Salsa20 : public Salsa20_Info, public SymmetricCipherDocumentation +{ + typedef SymmetricCipherFinal >, Salsa20_Info> Encryption; + typedef Encryption Decryption; +}; + +//! _ +struct XSalsa20_Info : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_IV, 24> +{ + static const char *StaticAlgorithmName() {return "XSalsa20";} +}; + +class CRYPTOPP_NO_VTABLE XSalsa20_Policy : public Salsa20_Policy +{ +public: + void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); + void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length); + +protected: + FixedSizeSecBlock m_key; +}; + +/// XSalsa20, variable rounds: 8, 12 or 20 (default 20) +struct XSalsa20 : public XSalsa20_Info, public SymmetricCipherDocumentation +{ + typedef SymmetricCipherFinal >, XSalsa20_Info> Encryption; + typedef Encryption Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/seal.cpp b/cryptopp/seal.cpp new file mode 100644 index 0000000..f49b522 --- /dev/null +++ b/cryptopp/seal.cpp @@ -0,0 +1,213 @@ +// seal.cpp - written and placed in the public domain by Wei Dai +// updated to SEAL 3.0 by Leonard Janke + +#include "pch.h" + +#include "seal.h" +#include "sha.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +void SEAL_TestInstantiations() +{ + SEAL<>::Encryption x; +} + +struct SEAL_Gamma +{ + SEAL_Gamma(const byte *key) + : H(5), Z(5), D(16), lastIndex(0xffffffff) + { + GetUserKey(BIG_ENDIAN_ORDER, H.begin(), 5, key, 20); + memset(D, 0, 64); + } + + word32 Apply(word32 i); + + SecBlock H, Z, D; + word32 lastIndex; +}; + +word32 SEAL_Gamma::Apply(word32 i) +{ + word32 shaIndex = i/5; + if (shaIndex != lastIndex) + { + memcpy(Z, H, 20); + D[0] = shaIndex; + SHA::Transform(Z, D); + lastIndex = shaIndex; + } + return Z[i%5]; +} + +template +void SEAL_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) +{ + m_insideCounter = m_outsideCounter = m_startCount = 0; + + unsigned int L = params.GetIntValueWithDefault("NumberOfOutputBitsPerPositionIndex", 32*1024); + m_iterationsPerCount = L / 8192; + + SEAL_Gamma gamma(key); + unsigned int i; + + for (i=0; i<512; i++) + m_T[i] = gamma.Apply(i); + + for (i=0; i<256; i++) + m_S[i] = gamma.Apply(0x1000+i); + + m_R.New(4*(L/8192)); + + for (i=0; i +void SEAL_Policy::CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length) +{ + assert(length==4); + m_outsideCounter = IV ? GetWord(false, BIG_ENDIAN_ORDER, IV) : 0; + m_startCount = m_outsideCounter; + m_insideCounter = 0; +} + +template +void SEAL_Policy::SeekToIteration(lword iterationCount) +{ + m_outsideCounter = m_startCount + (unsigned int)(iterationCount / m_iterationsPerCount); + m_insideCounter = (unsigned int)(iterationCount % m_iterationsPerCount); +} + +template +void SEAL_Policy::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) +{ + word32 a, b, c, d, n1, n2, n3, n4; + unsigned int p, q; + + for (size_t iteration = 0; iteration < iterationCount; ++iteration) + { +#define Ttab(x) *(word32 *)((byte *)m_T.begin()+x) + + a = m_outsideCounter ^ m_R[4*m_insideCounter]; + b = rotrFixed(m_outsideCounter, 8U) ^ m_R[4*m_insideCounter+1]; + c = rotrFixed(m_outsideCounter, 16U) ^ m_R[4*m_insideCounter+2]; + d = rotrFixed(m_outsideCounter, 24U) ^ m_R[4*m_insideCounter+3]; + + for (unsigned int j=0; j<2; j++) + { + p = a & 0x7fc; + b += Ttab(p); + a = rotrFixed(a, 9U); + + p = b & 0x7fc; + c += Ttab(p); + b = rotrFixed(b, 9U); + + p = c & 0x7fc; + d += Ttab(p); + c = rotrFixed(c, 9U); + + p = d & 0x7fc; + a += Ttab(p); + d = rotrFixed(d, 9U); + } + + n1 = d, n2 = b, n3 = a, n4 = c; + + p = a & 0x7fc; + b += Ttab(p); + a = rotrFixed(a, 9U); + + p = b & 0x7fc; + c += Ttab(p); + b = rotrFixed(b, 9U); + + p = c & 0x7fc; + d += Ttab(p); + c = rotrFixed(c, 9U); + + p = d & 0x7fc; + a += Ttab(p); + d = rotrFixed(d, 9U); + + // generate 8192 bits + for (unsigned int i=0; i<64; i++) + { + p = a & 0x7fc; + a = rotrFixed(a, 9U); + b += Ttab(p); + b ^= a; + + q = b & 0x7fc; + b = rotrFixed(b, 9U); + c ^= Ttab(q); + c += b; + + p = (p+c) & 0x7fc; + c = rotrFixed(c, 9U); + d += Ttab(p); + d ^= c; + + q = (q+d) & 0x7fc; + d = rotrFixed(d, 9U); + a ^= Ttab(q); + a += d; + + p = (p+a) & 0x7fc; + b ^= Ttab(p); + a = rotrFixed(a, 9U); + + q = (q+b) & 0x7fc; + c += Ttab(q); + b = rotrFixed(b, 9U); + + p = (p+c) & 0x7fc; + d ^= Ttab(p); + c = rotrFixed(c, 9U); + + q = (q+d) & 0x7fc; + d = rotrFixed(d, 9U); + a += Ttab(q); + +#define SEAL_OUTPUT(x) \ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 0, b + m_S[4*i+0]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 1, c ^ m_S[4*i+1]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 2, d + m_S[4*i+2]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 3, a ^ m_S[4*i+3]); + + CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH(SEAL_OUTPUT, 4*4); + + if (i & 1) + { + a += n3; + b += n4; + c ^= n3; + d ^= n4; + } + else + { + a += n1; + b += n2; + c ^= n1; + d ^= n2; + } + } + + if (++m_insideCounter == m_iterationsPerCount) + { + ++m_outsideCounter; + m_insideCounter = 0; + } + } + + a = b = c = d = n1 = n2 = n3 = n4 = 0; + p = q = 0; +} + +template class SEAL_Policy; +template class SEAL_Policy; + +NAMESPACE_END diff --git a/cryptopp/seal.h b/cryptopp/seal.h new file mode 100644 index 0000000..e14ae1c --- /dev/null +++ b/cryptopp/seal.h @@ -0,0 +1,44 @@ +#ifndef CRYPTOPP_SEAL_H +#define CRYPTOPP_SEAL_H + +#include "strciphr.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +template +struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4> +{ + static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";} +}; + +template +class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy, public SEAL_Info +{ +protected: + void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); + void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); + void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length); + bool CipherIsRandomAccess() const {return true;} + void SeekToIteration(lword iterationCount); + +private: + FixedSizeSecBlock m_T; + FixedSizeSecBlock m_S; + SecBlock m_R; + + word32 m_startCount, m_iterationsPerCount; + word32 m_outsideCounter, m_insideCounter; +}; + +//! SEAL +template +struct SEAL : public SEAL_Info, public SymmetricCipherDocumentation +{ + typedef SymmetricCipherFinal, AdditiveCipherTemplate<> >, SEAL_Info > Encryption; + typedef Encryption Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/secblock.h b/cryptopp/secblock.h new file mode 100644 index 0000000..d66470e --- /dev/null +++ b/cryptopp/secblock.h @@ -0,0 +1,500 @@ +// secblock.h - written and placed in the public domain by Wei Dai + +#ifndef CRYPTOPP_SECBLOCK_H +#define CRYPTOPP_SECBLOCK_H + +#include "config.h" +#include "misc.h" +#include + +#if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE) || defined(QNX) + #include +#else + #include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +// ************** secure memory allocation *************** + +template +class AllocatorBase +{ +public: + typedef T value_type; + typedef size_t size_type; +#ifdef CRYPTOPP_MSVCRT6 + typedef ptrdiff_t difference_type; +#else + typedef std::ptrdiff_t difference_type; +#endif + typedef T * pointer; + typedef const T * const_pointer; + typedef T & reference; + typedef const T & const_reference; + + pointer address(reference r) const {return (&r);} + const_pointer address(const_reference r) const {return (&r); } + void construct(pointer p, const T& val) {new (p) T(val);} + void destroy(pointer p) {p->~T();} + size_type max_size() const {return ~size_type(0)/sizeof(T);} // switch to std::numeric_limits::max later + +protected: + static void CheckSize(size_t n) + { + if (n > ~size_t(0) / sizeof(T)) + throw InvalidArgument("AllocatorBase: requested size would cause integer overflow"); + } +}; + +#define CRYPTOPP_INHERIT_ALLOCATOR_TYPES \ +typedef typename AllocatorBase::value_type value_type;\ +typedef typename AllocatorBase::size_type size_type;\ +typedef typename AllocatorBase::difference_type difference_type;\ +typedef typename AllocatorBase::pointer pointer;\ +typedef typename AllocatorBase::const_pointer const_pointer;\ +typedef typename AllocatorBase::reference reference;\ +typedef typename AllocatorBase::const_reference const_reference; + +#if defined(_MSC_VER) && (_MSC_VER < 1300) +// this pragma causes an internal compiler error if placed immediately before std::swap(a, b) +#pragma warning(push) +#pragma warning(disable: 4700) // VC60 workaround: don't know how to get rid of this warning +#endif + +template +typename A::pointer StandardReallocate(A& a, T *p, typename A::size_type oldSize, typename A::size_type newSize, bool preserve) +{ + if (oldSize == newSize) + return p; + + if (preserve) + { + typename A::pointer newPointer = a.allocate(newSize, NULL); + memcpy_s(newPointer, sizeof(T)*newSize, p, sizeof(T)*STDMIN(oldSize, newSize)); + a.deallocate(p, oldSize); + return newPointer; + } + else + { + a.deallocate(p, oldSize); + return a.allocate(newSize, NULL); + } +} + +#if defined(_MSC_VER) && (_MSC_VER < 1300) +#pragma warning(pop) +#endif + +template +class AllocatorWithCleanup : public AllocatorBase +{ +public: + CRYPTOPP_INHERIT_ALLOCATOR_TYPES + + pointer allocate(size_type n, const void * = NULL) + { + CheckSize(n); + if (n == 0) + return NULL; + + if (CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16 && n*sizeof(T) >= 16) + { + byte *p; + #ifdef CRYPTOPP_MM_MALLOC_AVAILABLE + while (!(p = (byte *)_mm_malloc(sizeof(T)*n, 16))) + #elif defined(CRYPTOPP_MEMALIGN_AVAILABLE) + while (!(p = (byte *)memalign(16, sizeof(T)*n))) + #elif defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16) + while (!(p = (byte *)malloc(sizeof(T)*n))) + #else + while (!(p = (byte *)malloc(sizeof(T)*n + 16))) + #endif + CallNewHandler(); + + #ifdef CRYPTOPP_NO_ALIGNED_ALLOC + size_t adjustment = 16-((size_t)p%16); + p += adjustment; + p[-1] = (byte)adjustment; + #endif + + assert(IsAlignedOn(p, 16)); + return (pointer)p; + } + + pointer p; + while (!(p = (pointer)malloc(sizeof(T)*n))) + CallNewHandler(); + return p; + } + + void deallocate(void *p, size_type n) + { + memset_z(p, 0, n*sizeof(T)); + + if (CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16 && n*sizeof(T) >= 16) + { + #ifdef CRYPTOPP_MM_MALLOC_AVAILABLE + _mm_free(p); + #elif defined(CRYPTOPP_NO_ALIGNED_ALLOC) + p = (byte *)p - ((byte *)p)[-1]; + free(p); + #else + free(p); + #endif + return; + } + + free(p); + } + + pointer reallocate(T *p, size_type oldSize, size_type newSize, bool preserve) + { + return StandardReallocate(*this, p, oldSize, newSize, preserve); + } + + // VS.NET STL enforces the policy of "All STL-compliant allocators have to provide a + // template class member called rebind". + template struct rebind { typedef AllocatorWithCleanup other; }; +#if _MSC_VER >= 1500 + AllocatorWithCleanup() {} + template AllocatorWithCleanup(const AllocatorWithCleanup &) {} +#endif +}; + +CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup; +CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup; +CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup; +CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup; +#if CRYPTOPP_BOOL_X86 +CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup; // for Integer +#endif + +template +class NullAllocator : public AllocatorBase +{ +public: + CRYPTOPP_INHERIT_ALLOCATOR_TYPES + + pointer allocate(size_type n, const void * = NULL) + { + assert(false); + return NULL; + } + + void deallocate(void *p, size_type n) + { + assert(false); + } + + size_type max_size() const {return 0;} +}; + +// This allocator can't be used with standard collections because +// they require that all objects of the same allocator type are equivalent. +// So this is for use with SecBlock only. +template , bool T_Align16 = false> +class FixedSizeAllocatorWithCleanup : public AllocatorBase +{ +public: + CRYPTOPP_INHERIT_ALLOCATOR_TYPES + + FixedSizeAllocatorWithCleanup() : m_allocated(false) {} + + pointer allocate(size_type n) + { + assert(IsAlignedOn(m_array, 8)); + + if (n <= S && !m_allocated) + { + m_allocated = true; + return GetAlignedArray(); + } + else + return m_fallbackAllocator.allocate(n); + } + + pointer allocate(size_type n, const void *hint) + { + if (n <= S && !m_allocated) + { + m_allocated = true; + return GetAlignedArray(); + } + else + return m_fallbackAllocator.allocate(n, hint); + } + + void deallocate(void *p, size_type n) + { + if (p == GetAlignedArray()) + { + assert(n <= S); + assert(m_allocated); + m_allocated = false; + memset(p, 0, n*sizeof(T)); + } + else + m_fallbackAllocator.deallocate(p, n); + } + + pointer reallocate(pointer p, size_type oldSize, size_type newSize, bool preserve) + { + if (p == GetAlignedArray() && newSize <= S) + { + assert(oldSize <= S); + if (oldSize > newSize) + memset(p + newSize, 0, (oldSize-newSize)*sizeof(T)); + return p; + } + + pointer newPointer = allocate(newSize, NULL); + if (preserve) + memcpy(newPointer, p, sizeof(T)*STDMIN(oldSize, newSize)); + deallocate(p, oldSize); + return newPointer; + } + + size_type max_size() const {return STDMAX(m_fallbackAllocator.max_size(), S);} + +private: +#ifdef __BORLANDC__ + T* GetAlignedArray() {return m_array;} + T m_array[S]; +#else + T* GetAlignedArray() {return (CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16) ? (T*)(((byte *)m_array) + (0-(size_t)m_array)%16) : m_array;} + CRYPTOPP_ALIGN_DATA(8) T m_array[(CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16) ? S+8/sizeof(T) : S]; +#endif + A m_fallbackAllocator; + bool m_allocated; +}; + +//! a block of memory allocated using A +template > +class SecBlock +{ +public: + typedef typename A::value_type value_type; + typedef typename A::pointer iterator; + typedef typename A::const_pointer const_iterator; + typedef typename A::size_type size_type; + + explicit SecBlock(size_type size=0) + : m_size(size) {m_ptr = m_alloc.allocate(size, NULL);} + SecBlock(const SecBlock &t) + : m_size(t.m_size) {m_ptr = m_alloc.allocate(m_size, NULL); memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T));} + SecBlock(const T *t, size_type len) + : m_size(len) + { + m_ptr = m_alloc.allocate(len, NULL); + if (t == NULL) + memset_z(m_ptr, 0, len*sizeof(T)); + else + memcpy(m_ptr, t, len*sizeof(T)); + } + + ~SecBlock() + {m_alloc.deallocate(m_ptr, m_size);} + +#ifdef __BORLANDC__ + operator T *() const + {return (T*)m_ptr;} +#else + operator const void *() const + {return m_ptr;} + operator void *() + {return m_ptr;} + + operator const T *() const + {return m_ptr;} + operator T *() + {return m_ptr;} +#endif + +// T *operator +(size_type offset) +// {return m_ptr+offset;} + +// const T *operator +(size_type offset) const +// {return m_ptr+offset;} + +// T& operator[](size_type index) +// {assert(index >= 0 && index < m_size); return m_ptr[index];} + +// const T& operator[](size_type index) const +// {assert(index >= 0 && index < m_size); return m_ptr[index];} + + iterator begin() + {return m_ptr;} + const_iterator begin() const + {return m_ptr;} + iterator end() + {return m_ptr+m_size;} + const_iterator end() const + {return m_ptr+m_size;} + + typename A::pointer data() {return m_ptr;} + typename A::const_pointer data() const {return m_ptr;} + + size_type size() const {return m_size;} + bool empty() const {return m_size == 0;} + + byte * BytePtr() {return (byte *)m_ptr;} + const byte * BytePtr() const {return (const byte *)m_ptr;} + size_type SizeInBytes() const {return m_size*sizeof(T);} + + //! set contents and size + void Assign(const T *t, size_type len) + { + New(len); + memcpy_s(m_ptr, m_size*sizeof(T), t, len*sizeof(T)); + } + + //! copy contents and size from another SecBlock + void Assign(const SecBlock &t) + { + New(t.m_size); + memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T)); + } + + SecBlock& operator=(const SecBlock &t) + { + Assign(t); + return *this; + } + + // append to this object + SecBlock& operator+=(const SecBlock &t) + { + size_type oldSize = m_size; + Grow(m_size+t.m_size); + memcpy_s(m_ptr+oldSize, m_size*sizeof(T), t.m_ptr, t.m_size*sizeof(T)); + return *this; + } + + // append operator + SecBlock operator+(const SecBlock &t) + { + SecBlock result(m_size+t.m_size); + memcpy_s(result.m_ptr, result.m_size*sizeof(T), m_ptr, m_size*sizeof(T)); + memcpy_s(result.m_ptr+m_size, t.m_size*sizeof(T), t.m_ptr, t.m_size*sizeof(T)); + return result; + } + + bool operator==(const SecBlock &t) const + { + return m_size == t.m_size && VerifyBufsEqual(m_ptr, t.m_ptr, m_size*sizeof(T)); + } + + bool operator!=(const SecBlock &t) const + { + return !operator==(t); + } + + //! change size, without preserving contents + void New(size_type newSize) + { + m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, false); + m_size = newSize; + } + + //! change size and set contents to 0 + void CleanNew(size_type newSize) + { + New(newSize); + memset_z(m_ptr, 0, m_size*sizeof(T)); + } + + //! change size only if newSize > current size. contents are preserved + void Grow(size_type newSize) + { + if (newSize > m_size) + { + m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true); + m_size = newSize; + } + } + + //! change size only if newSize > current size. contents are preserved and additional area is set to 0 + void CleanGrow(size_type newSize) + { + if (newSize > m_size) + { + m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true); + memset(m_ptr+m_size, 0, (newSize-m_size)*sizeof(T)); + m_size = newSize; + } + } + + //! change size and preserve contents + void resize(size_type newSize) + { + m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true); + m_size = newSize; + } + + //! swap contents and size with another SecBlock + void swap(SecBlock &b) + { + std::swap(m_alloc, b.m_alloc); + std::swap(m_size, b.m_size); + std::swap(m_ptr, b.m_ptr); + } + +//private: + A m_alloc; + size_type m_size; + T *m_ptr; +}; + +typedef SecBlock SecByteBlock; +typedef SecBlock > AlignedSecByteBlock; +typedef SecBlock SecWordBlock; + +//! a SecBlock with fixed size, allocated statically +template > +class FixedSizeSecBlock : public SecBlock +{ +public: + explicit FixedSizeSecBlock() : SecBlock(S) {} +}; + +template +class FixedSizeAlignedSecBlock : public FixedSizeSecBlock, T_Align16> > +{ +}; + +//! a SecBlock that preallocates size S statically, and uses the heap when this size is exceeded +template > > +class SecBlockWithHint : public SecBlock +{ +public: + explicit SecBlockWithHint(size_t size) : SecBlock(size) {} +}; + +template +inline bool operator==(const CryptoPP::AllocatorWithCleanup&, const CryptoPP::AllocatorWithCleanup&) {return (true);} +template +inline bool operator!=(const CryptoPP::AllocatorWithCleanup&, const CryptoPP::AllocatorWithCleanup&) {return (false);} + +NAMESPACE_END + +NAMESPACE_BEGIN(std) +template +inline void swap(CryptoPP::SecBlock &a, CryptoPP::SecBlock &b) +{ + a.swap(b); +} + +#if defined(_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) || (defined(_STLPORT_VERSION) && !defined(_STLP_MEMBER_TEMPLATE_CLASSES)) +// working for STLport 5.1.3 and MSVC 6 SP5 +template +inline CryptoPP::AllocatorWithCleanup<_Tp2>& +__stl_alloc_rebind(CryptoPP::AllocatorWithCleanup<_Tp1>& __a, const _Tp2*) +{ + return (CryptoPP::AllocatorWithCleanup<_Tp2>&)(__a); +} +#endif + +NAMESPACE_END + +#endif diff --git a/cryptopp/seckey.h b/cryptopp/seckey.h new file mode 100644 index 0000000..35046a6 --- /dev/null +++ b/cryptopp/seckey.h @@ -0,0 +1,221 @@ +// seckey.h - written and placed in the public domain by Wei Dai + +// This file contains helper classes/functions for implementing secret key algorithms. + +#ifndef CRYPTOPP_SECKEY_H +#define CRYPTOPP_SECKEY_H + +#include "cryptlib.h" +#include "misc.h" +#include "simple.h" + +NAMESPACE_BEGIN(CryptoPP) + +inline CipherDir ReverseCipherDir(CipherDir dir) +{ + return (dir == ENCRYPTION) ? DECRYPTION : ENCRYPTION; +} + +//! to be inherited by block ciphers with fixed block size +template +class FixedBlockSize +{ +public: + CRYPTOPP_CONSTANT(BLOCKSIZE = N) +}; + +// ************** rounds *************** + +//! to be inherited by ciphers with fixed number of rounds +template +class FixedRounds +{ +public: + CRYPTOPP_CONSTANT(ROUNDS = R) +}; + +//! to be inherited by ciphers with variable number of rounds +template // use INT_MAX here because enums are treated as signed ints +class VariableRounds +{ +public: + CRYPTOPP_CONSTANT(DEFAULT_ROUNDS = D) + CRYPTOPP_CONSTANT(MIN_ROUNDS = N) + CRYPTOPP_CONSTANT(MAX_ROUNDS = M) + static unsigned int StaticGetDefaultRounds(size_t keylength) {return DEFAULT_ROUNDS;} + +protected: + inline void ThrowIfInvalidRounds(int rounds, const Algorithm *alg) + { + if (rounds < MIN_ROUNDS || rounds > MAX_ROUNDS) + throw InvalidRounds(alg->AlgorithmName(), rounds); + } + + inline unsigned int GetRoundsAndThrowIfInvalid(const NameValuePairs ¶m, const Algorithm *alg) + { + int rounds = param.GetIntValueWithDefault("Rounds", DEFAULT_ROUNDS); + ThrowIfInvalidRounds(rounds, alg); + return (unsigned int)rounds; + } +}; + +// ************** key length *************** + +//! to be inherited by keyed algorithms with fixed key length +template +class FixedKeyLength +{ +public: + CRYPTOPP_CONSTANT(KEYLENGTH=N) + CRYPTOPP_CONSTANT(MIN_KEYLENGTH=N) + CRYPTOPP_CONSTANT(MAX_KEYLENGTH=N) + CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=N) + CRYPTOPP_CONSTANT(IV_REQUIREMENT = IV_REQ) + CRYPTOPP_CONSTANT(IV_LENGTH = IV_L) + static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t) {return KEYLENGTH;} +}; + +/// support query of variable key length, template parameters are default, min, max, multiple (default multiple 1) +template +class VariableKeyLength +{ + // make these private to avoid Doxygen documenting them in all derived classes + CRYPTOPP_COMPILE_ASSERT(Q > 0); + CRYPTOPP_COMPILE_ASSERT(N % Q == 0); + CRYPTOPP_COMPILE_ASSERT(M % Q == 0); + CRYPTOPP_COMPILE_ASSERT(N < M); + CRYPTOPP_COMPILE_ASSERT(D >= N); + CRYPTOPP_COMPILE_ASSERT(M >= D); + +public: + CRYPTOPP_CONSTANT(MIN_KEYLENGTH=N) + CRYPTOPP_CONSTANT(MAX_KEYLENGTH=M) + CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=D) + CRYPTOPP_CONSTANT(KEYLENGTH_MULTIPLE=Q) + CRYPTOPP_CONSTANT(IV_REQUIREMENT=IV_REQ) + CRYPTOPP_CONSTANT(IV_LENGTH=IV_L) + + static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t n) + { + if (n < (size_t)MIN_KEYLENGTH) + return MIN_KEYLENGTH; + else if (n > (size_t)MAX_KEYLENGTH) + return (size_t)MAX_KEYLENGTH; + else + { + n += KEYLENGTH_MULTIPLE-1; + return n - n%KEYLENGTH_MULTIPLE; + } + } +}; + +/// support query of key length that's the same as another class +template +class SameKeyLengthAs +{ +public: + CRYPTOPP_CONSTANT(MIN_KEYLENGTH=T::MIN_KEYLENGTH) + CRYPTOPP_CONSTANT(MAX_KEYLENGTH=T::MAX_KEYLENGTH) + CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=T::DEFAULT_KEYLENGTH) + CRYPTOPP_CONSTANT(IV_REQUIREMENT=IV_REQ) + CRYPTOPP_CONSTANT(IV_LENGTH=IV_L) + + static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t keylength) + {return T::StaticGetValidKeyLength(keylength);} +}; + +// ************** implementation helper for SimpleKeyed *************** + +//! _ +template +class CRYPTOPP_NO_VTABLE SimpleKeyingInterfaceImpl : public BASE +{ +public: + size_t MinKeyLength() const {return INFO::MIN_KEYLENGTH;} + size_t MaxKeyLength() const {return (size_t)INFO::MAX_KEYLENGTH;} + size_t DefaultKeyLength() const {return INFO::DEFAULT_KEYLENGTH;} + size_t GetValidKeyLength(size_t n) const {return INFO::StaticGetValidKeyLength(n);} + SimpleKeyingInterface::IV_Requirement IVRequirement() const {return (SimpleKeyingInterface::IV_Requirement)INFO::IV_REQUIREMENT;} + unsigned int IVSize() const {return INFO::IV_LENGTH;} +}; + +template +class CRYPTOPP_NO_VTABLE BlockCipherImpl : public AlgorithmImpl > > +{ +public: + unsigned int BlockSize() const {return this->BLOCKSIZE;} +}; + +//! _ +template +class BlockCipherFinal : public ClonableImpl, BASE> +{ +public: + BlockCipherFinal() {} + BlockCipherFinal(const byte *key) + {this->SetKey(key, this->DEFAULT_KEYLENGTH);} + BlockCipherFinal(const byte *key, size_t length) + {this->SetKey(key, length);} + BlockCipherFinal(const byte *key, size_t length, unsigned int rounds) + {this->SetKeyWithRounds(key, length, rounds);} + + bool IsForwardTransformation() const {return DIR == ENCRYPTION;} +}; + +//! _ +template +class MessageAuthenticationCodeImpl : public AlgorithmImpl, INFO> +{ +}; + +//! _ +template +class MessageAuthenticationCodeFinal : public ClonableImpl, MessageAuthenticationCodeImpl > +{ +public: + MessageAuthenticationCodeFinal() {} + MessageAuthenticationCodeFinal(const byte *key) + {this->SetKey(key, this->DEFAULT_KEYLENGTH);} + MessageAuthenticationCodeFinal(const byte *key, size_t length) + {this->SetKey(key, length);} +}; + +// ************** documentation *************** + +//! These objects usually should not be used directly. See CipherModeDocumentation instead. +/*! Each class derived from this one defines two types, Encryption and Decryption, + both of which implement the BlockCipher interface. */ +struct BlockCipherDocumentation +{ + //! implements the BlockCipher interface + typedef BlockCipher Encryption; + //! implements the BlockCipher interface + typedef BlockCipher Decryption; +}; + +/*! \brief Each class derived from this one defines two types, Encryption and Decryption, + both of which implement the SymmetricCipher interface. Two types of classes derive + from this class: stream ciphers and block cipher modes. Stream ciphers can be used + alone, cipher mode classes need to be used with a block cipher. See CipherModeDocumentation + for more for information about using cipher modes and block ciphers. */ +struct SymmetricCipherDocumentation +{ + //! implements the SymmetricCipher interface + typedef SymmetricCipher Encryption; + //! implements the SymmetricCipher interface + typedef SymmetricCipher Decryption; +}; + +/*! \brief Each class derived from this one defines two types, Encryption and Decryption, + both of which implement the AuthenticatedSymmetricCipher interface. */ +struct AuthenticatedSymmetricCipherDocumentation +{ + //! implements the AuthenticatedSymmetricCipher interface + typedef AuthenticatedSymmetricCipher Encryption; + //! implements the AuthenticatedSymmetricCipher interface + typedef AuthenticatedSymmetricCipher Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/seed.cpp b/cryptopp/seed.cpp new file mode 100644 index 0000000..101902d --- /dev/null +++ b/cryptopp/seed.cpp @@ -0,0 +1,104 @@ +// seed.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "seed.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +static const word32 s_kc[16] = { + 0x9e3779b9, 0x3c6ef373, 0x78dde6e6, 0xf1bbcdcc, 0xe3779b99, 0xc6ef3733, 0x8dde6e67, 0x1bbcdccf, + 0x3779b99e, 0x6ef3733c, 0xdde6e678, 0xbbcdccf1, 0x779b99e3, 0xef3733c6, 0xde6e678d, 0xbcdccf1b}; + +static const byte s_s0[256] = { + 0xA9, 0x85, 0xD6, 0xD3, 0x54, 0x1D, 0xAC, 0x25, 0x5D, 0x43, 0x18, 0x1E, 0x51, 0xFC, 0xCA, 0x63, 0x28, + 0x44, 0x20, 0x9D, 0xE0, 0xE2, 0xC8, 0x17, 0xA5, 0x8F, 0x03, 0x7B, 0xBB, 0x13, 0xD2, 0xEE, 0x70, 0x8C, + 0x3F, 0xA8, 0x32, 0xDD, 0xF6, 0x74, 0xEC, 0x95, 0x0B, 0x57, 0x5C, 0x5B, 0xBD, 0x01, 0x24, 0x1C, 0x73, + 0x98, 0x10, 0xCC, 0xF2, 0xD9, 0x2C, 0xE7, 0x72, 0x83, 0x9B, 0xD1, 0x86, 0xC9, 0x60, 0x50, 0xA3, 0xEB, + 0x0D, 0xB6, 0x9E, 0x4F, 0xB7, 0x5A, 0xC6, 0x78, 0xA6, 0x12, 0xAF, 0xD5, 0x61, 0xC3, 0xB4, 0x41, 0x52, + 0x7D, 0x8D, 0x08, 0x1F, 0x99, 0x00, 0x19, 0x04, 0x53, 0xF7, 0xE1, 0xFD, 0x76, 0x2F, 0x27, 0xB0, 0x8B, + 0x0E, 0xAB, 0xA2, 0x6E, 0x93, 0x4D, 0x69, 0x7C, 0x09, 0x0A, 0xBF, 0xEF, 0xF3, 0xC5, 0x87, 0x14, 0xFE, + 0x64, 0xDE, 0x2E, 0x4B, 0x1A, 0x06, 0x21, 0x6B, 0x66, 0x02, 0xF5, 0x92, 0x8A, 0x0C, 0xB3, 0x7E, 0xD0, + 0x7A, 0x47, 0x96, 0xE5, 0x26, 0x80, 0xAD, 0xDF, 0xA1, 0x30, 0x37, 0xAE, 0x36, 0x15, 0x22, 0x38, 0xF4, + 0xA7, 0x45, 0x4C, 0x81, 0xE9, 0x84, 0x97, 0x35, 0xCB, 0xCE, 0x3C, 0x71, 0x11, 0xC7, 0x89, 0x75, 0xFB, + 0xDA, 0xF8, 0x94, 0x59, 0x82, 0xC4, 0xFF, 0x49, 0x39, 0x67, 0xC0, 0xCF, 0xD7, 0xB8, 0x0F, 0x8E, 0x42, + 0x23, 0x91, 0x6C, 0xDB, 0xA4, 0x34, 0xF1, 0x48, 0xC2, 0x6F, 0x3D, 0x2D, 0x40, 0xBE, 0x3E, 0xBC, 0xC1, + 0xAA, 0xBA, 0x4E, 0x55, 0x3B, 0xDC, 0x68, 0x7F, 0x9C, 0xD8, 0x4A, 0x56, 0x77, 0xA0, 0xED, 0x46, 0xB5, + 0x2B, 0x65, 0xFA, 0xE3, 0xB9, 0xB1, 0x9F, 0x5E, 0xF9, 0xE6, 0xB2, 0x31, 0xEA, 0x6D, 0x5F, 0xE4, 0xF0, + 0xCD, 0x88, 0x16, 0x3A, 0x58, 0xD4, 0x62, 0x29, 0x07, 0x33, 0xE8, 0x1B, 0x05, 0x79, 0x90, 0x6A, 0x2A, + 0x9A}; + +static const byte s_s1[256] = { + 0x38, 0xE8, 0x2D, 0xA6, 0xCF, 0xDE, 0xB3, 0xB8, 0xAF, 0x60, 0x55, 0xC7, 0x44, 0x6F, 0x6B, 0x5B, 0xC3, + 0x62, 0x33, 0xB5, 0x29, 0xA0, 0xE2, 0xA7, 0xD3, 0x91, 0x11, 0x06, 0x1C, 0xBC, 0x36, 0x4B, 0xEF, 0x88, + 0x6C, 0xA8, 0x17, 0xC4, 0x16, 0xF4, 0xC2, 0x45, 0xE1, 0xD6, 0x3F, 0x3D, 0x8E, 0x98, 0x28, 0x4E, 0xF6, + 0x3E, 0xA5, 0xF9, 0x0D, 0xDF, 0xD8, 0x2B, 0x66, 0x7A, 0x27, 0x2F, 0xF1, 0x72, 0x42, 0xD4, 0x41, 0xC0, + 0x73, 0x67, 0xAC, 0x8B, 0xF7, 0xAD, 0x80, 0x1F, 0xCA, 0x2C, 0xAA, 0x34, 0xD2, 0x0B, 0xEE, 0xE9, 0x5D, + 0x94, 0x18, 0xF8, 0x57, 0xAE, 0x08, 0xC5, 0x13, 0xCD, 0x86, 0xB9, 0xFF, 0x7D, 0xC1, 0x31, 0xF5, 0x8A, + 0x6A, 0xB1, 0xD1, 0x20, 0xD7, 0x02, 0x22, 0x04, 0x68, 0x71, 0x07, 0xDB, 0x9D, 0x99, 0x61, 0xBE, 0xE6, + 0x59, 0xDD, 0x51, 0x90, 0xDC, 0x9A, 0xA3, 0xAB, 0xD0, 0x81, 0x0F, 0x47, 0x1A, 0xE3, 0xEC, 0x8D, 0xBF, + 0x96, 0x7B, 0x5C, 0xA2, 0xA1, 0x63, 0x23, 0x4D, 0xC8, 0x9E, 0x9C, 0x3A, 0x0C, 0x2E, 0xBA, 0x6E, 0x9F, + 0x5A, 0xF2, 0x92, 0xF3, 0x49, 0x78, 0xCC, 0x15, 0xFB, 0x70, 0x75, 0x7F, 0x35, 0x10, 0x03, 0x64, 0x6D, + 0xC6, 0x74, 0xD5, 0xB4, 0xEA, 0x09, 0x76, 0x19, 0xFE, 0x40, 0x12, 0xE0, 0xBD, 0x05, 0xFA, 0x01, 0xF0, + 0x2A, 0x5E, 0xA9, 0x56, 0x43, 0x85, 0x14, 0x89, 0x9B, 0xB0, 0xE5, 0x48, 0x79, 0x97, 0xFC, 0x1E, 0x82, + 0x21, 0x8C, 0x1B, 0x5F, 0x77, 0x54, 0xB2, 0x1D, 0x25, 0x4F, 0x00, 0x46, 0xED, 0x58, 0x52, 0xEB, 0x7E, + 0xDA, 0xC9, 0xFD, 0x30, 0x95, 0x65, 0x3C, 0xB6, 0xE4, 0xBB, 0x7C, 0x0E, 0x50, 0x39, 0x26, 0x32, 0x84, + 0x69, 0x93, 0x37, 0xE7, 0x24, 0xA4, 0xCB, 0x53, 0x0A, 0x87, 0xD9, 0x4C, 0x83, 0x8F, 0xCE, 0x3B, 0x4A, + 0xB7}; + +#define SS0(x) ((s_s0[x]*0x01010101UL) & 0x3FCFF3FC) +#define SS1(x) ((s_s1[x]*0x01010101UL) & 0xFC3FCFF3) +#define SS2(x) ((s_s0[x]*0x01010101UL) & 0xF3FC3FCF) +#define SS3(x) ((s_s1[x]*0x01010101UL) & 0xCFF3FC3F) +#define G(x) (SS0(GETBYTE(x, 0)) ^ SS1(GETBYTE(x, 1)) ^ SS2(GETBYTE(x, 2)) ^ SS3(GETBYTE(x, 3))) + +void SEED::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms) +{ + AssertValidKeyLength(length); + + word64 key01, key23; + GetBlock get(userKey); + get(key01)(key23); + word32 *k = m_k; + size_t kInc = 2; + if (!IsForwardTransformation()) + { + k = k+30; + kInc = 0-kInc; + } + + for (int i=0; i>32) + word32(key23>>32) - s_kc[i]; + word32 t1 = word32(key01) - word32(key23) + s_kc[i]; + k[0] = G(t0); + k[1] = G(t1); + k+=kInc; + if (i&1) + key23 = rotlFixed(key23, 8); + else + key01 = rotrFixed(key01, 8); + } +} + +void SEED::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + typedef BlockGetAndPut Block; + word32 a0, a1, b0, b1, t0, t1; + Block::Get(inBlock)(a0)(a1)(b0)(b1); + + for (int i=0; i, public FixedKeyLength<16>, public FixedRounds<16> +{ + static const char *StaticAlgorithmName() {return "SEED";} +}; + +/// SEED +class SEED : public SEED_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + + protected: + FixedSizeSecBlock m_k; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/serpent.cpp b/cryptopp/serpent.cpp new file mode 100644 index 0000000..40fab23 --- /dev/null +++ b/cryptopp/serpent.cpp @@ -0,0 +1,123 @@ +// serpent.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "serpent.h" +#include "misc.h" + +#include "serpentp.h" + +NAMESPACE_BEGIN(CryptoPP) + +void Serpent_KeySchedule(word32 *k, unsigned int rounds, const byte *userKey, size_t keylen) +{ + FixedSizeSecBlock k0; + GetUserKey(LITTLE_ENDIAN_ORDER, k0.begin(), 8, userKey, keylen); + if (keylen < 32) + k0[keylen/4] |= word32(1) << ((keylen%4)*8); + + word32 t = k0[7]; + unsigned int i; + for (i = 0; i < 8; ++i) + k[i] = k0[i] = t = rotlFixed(k0[i] ^ k0[(i+3)%8] ^ k0[(i+5)%8] ^ t ^ 0x9e3779b9 ^ i, 11); + for (i = 8; i < 4*(rounds+1); ++i) + k[i] = t = rotlFixed(k[i-8] ^ k[i-5] ^ k[i-3] ^ t ^ 0x9e3779b9 ^ i, 11); + k -= 20; + + word32 a,b,c,d,e; + for (i=0; i Block; + +void Serpent::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 a, b, c, d, e; + + Block::Get(inBlock)(a)(b)(c)(d); + + const word32 *k = m_key; + unsigned int i=1; + + do + { + beforeS0(KX); beforeS0(S0); afterS0(LT); + afterS0(KX); afterS0(S1); afterS1(LT); + afterS1(KX); afterS1(S2); afterS2(LT); + afterS2(KX); afterS2(S3); afterS3(LT); + afterS3(KX); afterS3(S4); afterS4(LT); + afterS4(KX); afterS4(S5); afterS5(LT); + afterS5(KX); afterS5(S6); afterS6(LT); + afterS6(KX); afterS6(S7); + + if (i == 4) + break; + + ++i; + c = b; + b = e; + e = d; + d = a; + a = e; + k += 32; + beforeS0(LT); + } + while (true); + + afterS7(KX); + + Block::Put(xorBlock, outBlock)(d)(e)(b)(a); +} + +void Serpent::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 a, b, c, d, e; + + Block::Get(inBlock)(a)(b)(c)(d); + + const word32 *k = m_key + 96; + unsigned int i=4; + + beforeI7(KX); + goto start; + + do + { + c = b; + b = d; + d = e; + k -= 32; + beforeI7(ILT); +start: + beforeI7(I7); afterI7(KX); + afterI7(ILT); afterI7(I6); afterI6(KX); + afterI6(ILT); afterI6(I5); afterI5(KX); + afterI5(ILT); afterI5(I4); afterI4(KX); + afterI4(ILT); afterI4(I3); afterI3(KX); + afterI3(ILT); afterI3(I2); afterI2(KX); + afterI2(ILT); afterI2(I1); afterI1(KX); + afterI1(ILT); afterI1(I0); afterI0(KX); + } + while (--i != 0); + + Block::Put(xorBlock, outBlock)(a)(d)(b)(e); +} + +NAMESPACE_END diff --git a/cryptopp/serpent.h b/cryptopp/serpent.h new file mode 100644 index 0000000..f7ee8d6 --- /dev/null +++ b/cryptopp/serpent.h @@ -0,0 +1,52 @@ +#ifndef CRYPTOPP_SERPENT_H +#define CRYPTOPP_SERPENT_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct Serpent_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 32>, public FixedRounds<32> +{ + static const char *StaticAlgorithmName() {return "Serpent";} +}; + +/// Serpent +class Serpent : public Serpent_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + FixedSizeSecBlock m_key; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef Serpent::Encryption SerpentEncryption; +typedef Serpent::Decryption SerpentDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/serpentp.h b/cryptopp/serpentp.h new file mode 100644 index 0000000..7869a3f --- /dev/null +++ b/cryptopp/serpentp.h @@ -0,0 +1,434 @@ +// private header for Serpent and Sosemanuk + +NAMESPACE_BEGIN(CryptoPP) + +// linear transformation +#define LT(i,a,b,c,d,e) {\ + a = rotlFixed(a, 13); \ + c = rotlFixed(c, 3); \ + d = rotlFixed(d ^ c ^ (a << 3), 7); \ + b = rotlFixed(b ^ a ^ c, 1); \ + a = rotlFixed(a ^ b ^ d, 5); \ + c = rotlFixed(c ^ d ^ (b << 7), 22);} + +// inverse linear transformation +#define ILT(i,a,b,c,d,e) {\ + c = rotrFixed(c, 22); \ + a = rotrFixed(a, 5); \ + c ^= d ^ (b << 7); \ + a ^= b ^ d; \ + b = rotrFixed(b, 1); \ + d = rotrFixed(d, 7) ^ c ^ (a << 3); \ + b ^= a ^ c; \ + c = rotrFixed(c, 3); \ + a = rotrFixed(a, 13);} + +// order of output from S-box functions +#define beforeS0(f) f(0,a,b,c,d,e) +#define afterS0(f) f(1,b,e,c,a,d) +#define afterS1(f) f(2,c,b,a,e,d) +#define afterS2(f) f(3,a,e,b,d,c) +#define afterS3(f) f(4,e,b,d,c,a) +#define afterS4(f) f(5,b,a,e,c,d) +#define afterS5(f) f(6,a,c,b,e,d) +#define afterS6(f) f(7,a,c,d,b,e) +#define afterS7(f) f(8,d,e,b,a,c) + +// order of output from inverse S-box functions +#define beforeI7(f) f(8,a,b,c,d,e) +#define afterI7(f) f(7,d,a,b,e,c) +#define afterI6(f) f(6,a,b,c,e,d) +#define afterI5(f) f(5,b,d,e,c,a) +#define afterI4(f) f(4,b,c,e,a,d) +#define afterI3(f) f(3,a,b,e,c,d) +#define afterI2(f) f(2,b,d,e,c,a) +#define afterI1(f) f(1,a,b,c,e,d) +#define afterI0(f) f(0,a,d,b,e,c) + +// The instruction sequences for the S-box functions +// come from Dag Arne Osvik's paper "Speeding up Serpent". + +#define S0(i, r0, r1, r2, r3, r4) \ + { \ + r3 ^= r0; \ + r4 = r1; \ + r1 &= r3; \ + r4 ^= r2; \ + r1 ^= r0; \ + r0 |= r3; \ + r0 ^= r4; \ + r4 ^= r3; \ + r3 ^= r2; \ + r2 |= r1; \ + r2 ^= r4; \ + r4 = ~r4; \ + r4 |= r1; \ + r1 ^= r3; \ + r1 ^= r4; \ + r3 |= r0; \ + r1 ^= r3; \ + r4 ^= r3; \ + } + +#define I0(i, r0, r1, r2, r3, r4) \ + { \ + r2 = ~r2; \ + r4 = r1; \ + r1 |= r0; \ + r4 = ~r4; \ + r1 ^= r2; \ + r2 |= r4; \ + r1 ^= r3; \ + r0 ^= r4; \ + r2 ^= r0; \ + r0 &= r3; \ + r4 ^= r0; \ + r0 |= r1; \ + r0 ^= r2; \ + r3 ^= r4; \ + r2 ^= r1; \ + r3 ^= r0; \ + r3 ^= r1; \ + r2 &= r3; \ + r4 ^= r2; \ + } + +#define S1(i, r0, r1, r2, r3, r4) \ + { \ + r0 = ~r0; \ + r2 = ~r2; \ + r4 = r0; \ + r0 &= r1; \ + r2 ^= r0; \ + r0 |= r3; \ + r3 ^= r2; \ + r1 ^= r0; \ + r0 ^= r4; \ + r4 |= r1; \ + r1 ^= r3; \ + r2 |= r0; \ + r2 &= r4; \ + r0 ^= r1; \ + r1 &= r2; \ + r1 ^= r0; \ + r0 &= r2; \ + r0 ^= r4; \ + } + +#define I1(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r1; \ + r1 ^= r3; \ + r3 &= r1; \ + r4 ^= r2; \ + r3 ^= r0; \ + r0 |= r1; \ + r2 ^= r3; \ + r0 ^= r4; \ + r0 |= r2; \ + r1 ^= r3; \ + r0 ^= r1; \ + r1 |= r3; \ + r1 ^= r0; \ + r4 = ~r4; \ + r4 ^= r1; \ + r1 |= r0; \ + r1 ^= r0; \ + r1 |= r4; \ + r3 ^= r1; \ + } + +#define S2(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r0; \ + r0 &= r2; \ + r0 ^= r3; \ + r2 ^= r1; \ + r2 ^= r0; \ + r3 |= r4; \ + r3 ^= r1; \ + r4 ^= r2; \ + r1 = r3; \ + r3 |= r4; \ + r3 ^= r0; \ + r0 &= r1; \ + r4 ^= r0; \ + r1 ^= r3; \ + r1 ^= r4; \ + r4 = ~r4; \ + } + +#define I2(i, r0, r1, r2, r3, r4) \ + { \ + r2 ^= r3; \ + r3 ^= r0; \ + r4 = r3; \ + r3 &= r2; \ + r3 ^= r1; \ + r1 |= r2; \ + r1 ^= r4; \ + r4 &= r3; \ + r2 ^= r3; \ + r4 &= r0; \ + r4 ^= r2; \ + r2 &= r1; \ + r2 |= r0; \ + r3 = ~r3; \ + r2 ^= r3; \ + r0 ^= r3; \ + r0 &= r1; \ + r3 ^= r4; \ + r3 ^= r0; \ + } + +#define S3(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r0; \ + r0 |= r3; \ + r3 ^= r1; \ + r1 &= r4; \ + r4 ^= r2; \ + r2 ^= r3; \ + r3 &= r0; \ + r4 |= r1; \ + r3 ^= r4; \ + r0 ^= r1; \ + r4 &= r0; \ + r1 ^= r3; \ + r4 ^= r2; \ + r1 |= r0; \ + r1 ^= r2; \ + r0 ^= r3; \ + r2 = r1; \ + r1 |= r3; \ + r1 ^= r0; \ + } + +#define I3(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r2; \ + r2 ^= r1; \ + r1 &= r2; \ + r1 ^= r0; \ + r0 &= r4; \ + r4 ^= r3; \ + r3 |= r1; \ + r3 ^= r2; \ + r0 ^= r4; \ + r2 ^= r0; \ + r0 |= r3; \ + r0 ^= r1; \ + r4 ^= r2; \ + r2 &= r3; \ + r1 |= r3; \ + r1 ^= r2; \ + r4 ^= r0; \ + r2 ^= r4; \ + } + +#define S4(i, r0, r1, r2, r3, r4) \ + { \ + r1 ^= r3; \ + r3 = ~r3; \ + r2 ^= r3; \ + r3 ^= r0; \ + r4 = r1; \ + r1 &= r3; \ + r1 ^= r2; \ + r4 ^= r3; \ + r0 ^= r4; \ + r2 &= r4; \ + r2 ^= r0; \ + r0 &= r1; \ + r3 ^= r0; \ + r4 |= r1; \ + r4 ^= r0; \ + r0 |= r3; \ + r0 ^= r2; \ + r2 &= r3; \ + r0 = ~r0; \ + r4 ^= r2; \ + } + +#define I4(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r2; \ + r2 &= r3; \ + r2 ^= r1; \ + r1 |= r3; \ + r1 &= r0; \ + r4 ^= r2; \ + r4 ^= r1; \ + r1 &= r2; \ + r0 = ~r0; \ + r3 ^= r4; \ + r1 ^= r3; \ + r3 &= r0; \ + r3 ^= r2; \ + r0 ^= r1; \ + r2 &= r0; \ + r3 ^= r0; \ + r2 ^= r4; \ + r2 |= r3; \ + r3 ^= r0; \ + r2 ^= r1; \ + } + +#define S5(i, r0, r1, r2, r3, r4) \ + { \ + r0 ^= r1; \ + r1 ^= r3; \ + r3 = ~r3; \ + r4 = r1; \ + r1 &= r0; \ + r2 ^= r3; \ + r1 ^= r2; \ + r2 |= r4; \ + r4 ^= r3; \ + r3 &= r1; \ + r3 ^= r0; \ + r4 ^= r1; \ + r4 ^= r2; \ + r2 ^= r0; \ + r0 &= r3; \ + r2 = ~r2; \ + r0 ^= r4; \ + r4 |= r3; \ + r2 ^= r4; \ + } + +#define I5(i, r0, r1, r2, r3, r4) \ + { \ + r1 = ~r1; \ + r4 = r3; \ + r2 ^= r1; \ + r3 |= r0; \ + r3 ^= r2; \ + r2 |= r1; \ + r2 &= r0; \ + r4 ^= r3; \ + r2 ^= r4; \ + r4 |= r0; \ + r4 ^= r1; \ + r1 &= r2; \ + r1 ^= r3; \ + r4 ^= r2; \ + r3 &= r4; \ + r4 ^= r1; \ + r3 ^= r0; \ + r3 ^= r4; \ + r4 = ~r4; \ + } + +#define S6(i, r0, r1, r2, r3, r4) \ + { \ + r2 = ~r2; \ + r4 = r3; \ + r3 &= r0; \ + r0 ^= r4; \ + r3 ^= r2; \ + r2 |= r4; \ + r1 ^= r3; \ + r2 ^= r0; \ + r0 |= r1; \ + r2 ^= r1; \ + r4 ^= r0; \ + r0 |= r3; \ + r0 ^= r2; \ + r4 ^= r3; \ + r4 ^= r0; \ + r3 = ~r3; \ + r2 &= r4; \ + r2 ^= r3; \ + } + +#define I6(i, r0, r1, r2, r3, r4) \ + { \ + r0 ^= r2; \ + r4 = r2; \ + r2 &= r0; \ + r4 ^= r3; \ + r2 = ~r2; \ + r3 ^= r1; \ + r2 ^= r3; \ + r4 |= r0; \ + r0 ^= r2; \ + r3 ^= r4; \ + r4 ^= r1; \ + r1 &= r3; \ + r1 ^= r0; \ + r0 ^= r3; \ + r0 |= r2; \ + r3 ^= r1; \ + r4 ^= r0; \ + } + +#define S7(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r2; \ + r2 &= r1; \ + r2 ^= r3; \ + r3 &= r1; \ + r4 ^= r2; \ + r2 ^= r1; \ + r1 ^= r0; \ + r0 |= r4; \ + r0 ^= r2; \ + r3 ^= r1; \ + r2 ^= r3; \ + r3 &= r0; \ + r3 ^= r4; \ + r4 ^= r2; \ + r2 &= r0; \ + r4 = ~r4; \ + r2 ^= r4; \ + r4 &= r0; \ + r1 ^= r3; \ + r4 ^= r1; \ + } + +#define I7(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r2; \ + r2 ^= r0; \ + r0 &= r3; \ + r2 = ~r2; \ + r4 |= r3; \ + r3 ^= r1; \ + r1 |= r0; \ + r0 ^= r2; \ + r2 &= r4; \ + r1 ^= r2; \ + r2 ^= r0; \ + r0 |= r2; \ + r3 &= r4; \ + r0 ^= r3; \ + r4 ^= r1; \ + r3 ^= r4; \ + r4 |= r0; \ + r3 ^= r2; \ + r4 ^= r2; \ + } + +// key xor +#define KX(r, a, b, c, d, e) {\ + a ^= k[4 * r + 0]; \ + b ^= k[4 * r + 1]; \ + c ^= k[4 * r + 2]; \ + d ^= k[4 * r + 3];} + +#define LK(r, a, b, c, d, e) {\ + a = k[(8-r)*4 + 0]; \ + b = k[(8-r)*4 + 1]; \ + c = k[(8-r)*4 + 2]; \ + d = k[(8-r)*4 + 3];} + +#define SK(r, a, b, c, d, e) {\ + k[(8-r)*4 + 4] = a; \ + k[(8-r)*4 + 5] = b; \ + k[(8-r)*4 + 6] = c; \ + k[(8-r)*4 + 7] = d;} + +void Serpent_KeySchedule(word32 *k, unsigned int rounds, const byte *userKey, size_t keylen); + +NAMESPACE_END diff --git a/cryptopp/sha.cpp b/cryptopp/sha.cpp new file mode 100644 index 0000000..fd0b0a2 --- /dev/null +++ b/cryptopp/sha.cpp @@ -0,0 +1,899 @@ +// sha.cpp - modified by Wei Dai from Steve Reid's public domain sha1.c + +// Steve Reid implemented SHA-1. Wei Dai implemented SHA-2. +// Both are in the public domain. + +// use "cl /EP /P /DCRYPTOPP_GENERATE_X64_MASM sha.cpp" to generate MASM code + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS +#ifndef CRYPTOPP_GENERATE_X64_MASM + +#include "sha.h" +#include "misc.h" +#include "cpu.h" + +NAMESPACE_BEGIN(CryptoPP) + +// start of Steve Reid's code + +#define blk0(i) (W[i] = data[i]) +#define blk1(i) (W[i&15] = rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1)) + +void SHA1::InitState(HashWordType *state) +{ + state[0] = 0x67452301L; + state[1] = 0xEFCDAB89L; + state[2] = 0x98BADCFEL; + state[3] = 0x10325476L; + state[4] = 0xC3D2E1F0L; +} + +#define f1(x,y,z) (z^(x&(y^z))) +#define f2(x,y,z) (x^y^z) +#define f3(x,y,z) ((x&y)|(z&(x|y))) +#define f4(x,y,z) (x^y^z) + +/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ +#define R0(v,w,x,y,z,i) z+=f1(w,x,y)+blk0(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30); +#define R1(v,w,x,y,z,i) z+=f1(w,x,y)+blk1(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30); +#define R2(v,w,x,y,z,i) z+=f2(w,x,y)+blk1(i)+0x6ED9EBA1+rotlFixed(v,5);w=rotlFixed(w,30); +#define R3(v,w,x,y,z,i) z+=f3(w,x,y)+blk1(i)+0x8F1BBCDC+rotlFixed(v,5);w=rotlFixed(w,30); +#define R4(v,w,x,y,z,i) z+=f4(w,x,y)+blk1(i)+0xCA62C1D6+rotlFixed(v,5);w=rotlFixed(w,30); + +void SHA1::Transform(word32 *state, const word32 *data) +{ + word32 W[16]; + /* Copy context->state[] to working vars */ + word32 a = state[0]; + word32 b = state[1]; + word32 c = state[2]; + word32 d = state[3]; + word32 e = state[4]; + /* 4 rounds of 20 operations each. Loop unrolled. */ + R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); + R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); + R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); + R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); + R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); + R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); + R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); + R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); + R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); + R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); + R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); + R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); + R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); + R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); + R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); + R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); + R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); + R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); + R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); + R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); + /* Add the working vars back into context.state[] */ + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; +} + +// end of Steve Reid's code + +// ************************************************************* + +void SHA224::InitState(HashWordType *state) +{ + static const word32 s[8] = {0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4}; + memcpy(state, s, sizeof(s)); +} + +void SHA256::InitState(HashWordType *state) +{ + static const word32 s[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19}; + memcpy(state, s, sizeof(s)); +} + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +CRYPTOPP_ALIGN_DATA(16) extern const word32 SHA256_K[64] CRYPTOPP_SECTION_ALIGN16 = { +#else +extern const word32 SHA256_K[64] = { +#endif + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM + +#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_GENERATE_X64_MASM) + +#pragma warning(disable: 4731) // frame pointer register 'ebp' modified by inline assembly code + +static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len +#if defined(_MSC_VER) && (_MSC_VER == 1200) + , ... // VC60 workaround: prevent VC 6 from inlining this function +#endif + ) +{ +#if defined(_MSC_VER) && (_MSC_VER == 1200) + AS2(mov ecx, [state]) + AS2(mov edx, [data]) +#endif + + #define LOCALS_SIZE 8*4 + 16*4 + 4*WORD_SZ + #define H(i) [BASE+ASM_MOD(1024+7-(i),8)*4] + #define G(i) H(i+1) + #define F(i) H(i+2) + #define E(i) H(i+3) + #define D(i) H(i+4) + #define C(i) H(i+5) + #define B(i) H(i+6) + #define A(i) H(i+7) + #define Wt(i) BASE+8*4+ASM_MOD(1024+15-(i),16)*4 + #define Wt_2(i) Wt((i)-2) + #define Wt_15(i) Wt((i)-15) + #define Wt_7(i) Wt((i)-7) + #define K_END [BASE+8*4+16*4+0*WORD_SZ] + #define STATE_SAVE [BASE+8*4+16*4+1*WORD_SZ] + #define DATA_SAVE [BASE+8*4+16*4+2*WORD_SZ] + #define DATA_END [BASE+8*4+16*4+3*WORD_SZ] + #define Kt(i) WORD_REG(si)+(i)*4 +#if CRYPTOPP_BOOL_X86 + #define BASE esp+4 +#elif defined(__GNUC__) + #define BASE r8 +#else + #define BASE rsp +#endif + +#define RA0(i, edx, edi) \ + AS2( add edx, [Kt(i)] )\ + AS2( add edx, [Wt(i)] )\ + AS2( add edx, H(i) )\ + +#define RA1(i, edx, edi) + +#define RB0(i, edx, edi) + +#define RB1(i, edx, edi) \ + AS2( mov AS_REG_7d, [Wt_2(i)] )\ + AS2( mov edi, [Wt_15(i)])\ + AS2( mov ebx, AS_REG_7d )\ + AS2( shr AS_REG_7d, 10 )\ + AS2( ror ebx, 17 )\ + AS2( xor AS_REG_7d, ebx )\ + AS2( ror ebx, 2 )\ + AS2( xor ebx, AS_REG_7d )/* s1(W_t-2) */\ + AS2( add ebx, [Wt_7(i)])\ + AS2( mov AS_REG_7d, edi )\ + AS2( shr AS_REG_7d, 3 )\ + AS2( ror edi, 7 )\ + AS2( add ebx, [Wt(i)])/* s1(W_t-2) + W_t-7 + W_t-16 */\ + AS2( xor AS_REG_7d, edi )\ + AS2( add edx, [Kt(i)])\ + AS2( ror edi, 11 )\ + AS2( add edx, H(i) )\ + AS2( xor AS_REG_7d, edi )/* s0(W_t-15) */\ + AS2( add AS_REG_7d, ebx )/* W_t = s1(W_t-2) + W_t-7 + s0(W_t-15) W_t-16*/\ + AS2( mov [Wt(i)], AS_REG_7d)\ + AS2( add edx, AS_REG_7d )\ + +#define ROUND(i, r, eax, ecx, edi, edx)\ + /* in: edi = E */\ + /* unused: eax, ecx, temp: ebx, AS_REG_7d, out: edx = T1 */\ + AS2( mov edx, F(i) )\ + AS2( xor edx, G(i) )\ + AS2( and edx, edi )\ + AS2( xor edx, G(i) )/* Ch(E,F,G) = (G^(E&(F^G))) */\ + AS2( mov AS_REG_7d, edi )\ + AS2( ror edi, 6 )\ + AS2( ror AS_REG_7d, 25 )\ + RA##r(i, edx, edi )/* H + Wt + Kt + Ch(E,F,G) */\ + AS2( xor AS_REG_7d, edi )\ + AS2( ror edi, 5 )\ + AS2( xor AS_REG_7d, edi )/* S1(E) */\ + AS2( add edx, AS_REG_7d )/* T1 = S1(E) + Ch(E,F,G) + H + Wt + Kt */\ + RB##r(i, edx, edi )/* H + Wt + Kt + Ch(E,F,G) */\ + /* in: ecx = A, eax = B^C, edx = T1 */\ + /* unused: edx, temp: ebx, AS_REG_7d, out: eax = A, ecx = B^C, edx = E */\ + AS2( mov ebx, ecx )\ + AS2( xor ecx, B(i) )/* A^B */\ + AS2( and eax, ecx )\ + AS2( xor eax, B(i) )/* Maj(A,B,C) = B^((A^B)&(B^C) */\ + AS2( mov AS_REG_7d, ebx )\ + AS2( ror ebx, 2 )\ + AS2( add eax, edx )/* T1 + Maj(A,B,C) */\ + AS2( add edx, D(i) )\ + AS2( mov D(i), edx )\ + AS2( ror AS_REG_7d, 22 )\ + AS2( xor AS_REG_7d, ebx )\ + AS2( ror ebx, 11 )\ + AS2( xor AS_REG_7d, ebx )\ + AS2( add eax, AS_REG_7d )/* T1 + S0(A) + Maj(A,B,C) */\ + AS2( mov H(i), eax )\ + +#define SWAP_COPY(i) \ + AS2( mov WORD_REG(bx), [WORD_REG(dx)+i*WORD_SZ])\ + AS1( bswap WORD_REG(bx))\ + AS2( mov [Wt(i*(1+CRYPTOPP_BOOL_X64)+CRYPTOPP_BOOL_X64)], WORD_REG(bx)) + +#if defined(__GNUC__) + #if CRYPTOPP_BOOL_X64 + FixedSizeAlignedSecBlock workspace; + #endif + __asm__ __volatile__ + ( + #if CRYPTOPP_BOOL_X64 + "lea %4, %%r8;" + #endif + ".intel_syntax noprefix;" +#elif defined(CRYPTOPP_GENERATE_X64_MASM) + ALIGN 8 + X86_SHA256_HashBlocks PROC FRAME + rex_push_reg rsi + push_reg rdi + push_reg rbx + push_reg rbp + alloc_stack(LOCALS_SIZE+8) + .endprolog + mov rdi, r8 + lea rsi, [?SHA256_K@CryptoPP@@3QBIB + 48*4] +#endif + +#if CRYPTOPP_BOOL_X86 + #ifndef __GNUC__ + AS2( mov edi, [len]) + AS2( lea WORD_REG(si), [SHA256_K+48*4]) + #endif + #if !defined(_MSC_VER) || (_MSC_VER < 1400) + AS_PUSH_IF86(bx) + #endif + + AS_PUSH_IF86(bp) + AS2( mov ebx, esp) + AS2( and esp, -16) + AS2( sub WORD_REG(sp), LOCALS_SIZE) + AS_PUSH_IF86(bx) +#endif + AS2( mov STATE_SAVE, WORD_REG(cx)) + AS2( mov DATA_SAVE, WORD_REG(dx)) + AS2( add WORD_REG(di), WORD_REG(dx)) + AS2( mov DATA_END, WORD_REG(di)) + AS2( mov K_END, WORD_REG(si)) + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +#if CRYPTOPP_BOOL_X86 + AS2( test edi, 1) + ASJ( jnz, 2, f) +#endif + AS2( movdqa xmm0, XMMWORD_PTR [WORD_REG(cx)+0*16]) + AS2( movdqa xmm1, XMMWORD_PTR [WORD_REG(cx)+1*16]) +#endif + +#if CRYPTOPP_BOOL_X86 +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + ASJ( jmp, 0, f) +#endif + ASL(2) // non-SSE2 + AS2( mov esi, ecx) + AS2( lea edi, A(0)) + AS2( mov ecx, 8) + AS1( rep movsd) + AS2( mov esi, K_END) + ASJ( jmp, 3, f) +#endif + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + ASL(0) + AS2( movdqa E(0), xmm1) + AS2( movdqa A(0), xmm0) +#endif +#if CRYPTOPP_BOOL_X86 + ASL(3) +#endif + AS2( sub WORD_REG(si), 48*4) + SWAP_COPY(0) SWAP_COPY(1) SWAP_COPY(2) SWAP_COPY(3) + SWAP_COPY(4) SWAP_COPY(5) SWAP_COPY(6) SWAP_COPY(7) +#if CRYPTOPP_BOOL_X86 + SWAP_COPY(8) SWAP_COPY(9) SWAP_COPY(10) SWAP_COPY(11) + SWAP_COPY(12) SWAP_COPY(13) SWAP_COPY(14) SWAP_COPY(15) +#endif + AS2( mov edi, E(0)) // E + AS2( mov eax, B(0)) // B + AS2( xor eax, C(0)) // B^C + AS2( mov ecx, A(0)) // A + + ROUND(0, 0, eax, ecx, edi, edx) + ROUND(1, 0, ecx, eax, edx, edi) + ROUND(2, 0, eax, ecx, edi, edx) + ROUND(3, 0, ecx, eax, edx, edi) + ROUND(4, 0, eax, ecx, edi, edx) + ROUND(5, 0, ecx, eax, edx, edi) + ROUND(6, 0, eax, ecx, edi, edx) + ROUND(7, 0, ecx, eax, edx, edi) + ROUND(8, 0, eax, ecx, edi, edx) + ROUND(9, 0, ecx, eax, edx, edi) + ROUND(10, 0, eax, ecx, edi, edx) + ROUND(11, 0, ecx, eax, edx, edi) + ROUND(12, 0, eax, ecx, edi, edx) + ROUND(13, 0, ecx, eax, edx, edi) + ROUND(14, 0, eax, ecx, edi, edx) + ROUND(15, 0, ecx, eax, edx, edi) + + ASL(1) + AS2(add WORD_REG(si), 4*16) + ROUND(0, 1, eax, ecx, edi, edx) + ROUND(1, 1, ecx, eax, edx, edi) + ROUND(2, 1, eax, ecx, edi, edx) + ROUND(3, 1, ecx, eax, edx, edi) + ROUND(4, 1, eax, ecx, edi, edx) + ROUND(5, 1, ecx, eax, edx, edi) + ROUND(6, 1, eax, ecx, edi, edx) + ROUND(7, 1, ecx, eax, edx, edi) + ROUND(8, 1, eax, ecx, edi, edx) + ROUND(9, 1, ecx, eax, edx, edi) + ROUND(10, 1, eax, ecx, edi, edx) + ROUND(11, 1, ecx, eax, edx, edi) + ROUND(12, 1, eax, ecx, edi, edx) + ROUND(13, 1, ecx, eax, edx, edi) + ROUND(14, 1, eax, ecx, edi, edx) + ROUND(15, 1, ecx, eax, edx, edi) + AS2( cmp WORD_REG(si), K_END) + ASJ( jne, 1, b) + + AS2( mov WORD_REG(dx), DATA_SAVE) + AS2( add WORD_REG(dx), 64) + AS2( mov AS_REG_7, STATE_SAVE) + AS2( mov DATA_SAVE, WORD_REG(dx)) + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +#if CRYPTOPP_BOOL_X86 + AS2( test DWORD PTR DATA_END, 1) + ASJ( jnz, 4, f) +#endif + AS2( movdqa xmm1, XMMWORD_PTR [AS_REG_7+1*16]) + AS2( movdqa xmm0, XMMWORD_PTR [AS_REG_7+0*16]) + AS2( paddd xmm1, E(0)) + AS2( paddd xmm0, A(0)) + AS2( movdqa [AS_REG_7+1*16], xmm1) + AS2( movdqa [AS_REG_7+0*16], xmm0) + AS2( cmp WORD_REG(dx), DATA_END) + ASJ( jl, 0, b) +#endif + +#if CRYPTOPP_BOOL_X86 +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + ASJ( jmp, 5, f) + ASL(4) // non-SSE2 +#endif + AS2( add [AS_REG_7+0*4], ecx) // A + AS2( add [AS_REG_7+4*4], edi) // E + AS2( mov eax, B(0)) + AS2( mov ebx, C(0)) + AS2( mov ecx, D(0)) + AS2( add [AS_REG_7+1*4], eax) + AS2( add [AS_REG_7+2*4], ebx) + AS2( add [AS_REG_7+3*4], ecx) + AS2( mov eax, F(0)) + AS2( mov ebx, G(0)) + AS2( mov ecx, H(0)) + AS2( add [AS_REG_7+5*4], eax) + AS2( add [AS_REG_7+6*4], ebx) + AS2( add [AS_REG_7+7*4], ecx) + AS2( mov ecx, AS_REG_7d) + AS2( cmp WORD_REG(dx), DATA_END) + ASJ( jl, 2, b) +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + ASL(5) +#endif +#endif + + AS_POP_IF86(sp) + AS_POP_IF86(bp) + #if !defined(_MSC_VER) || (_MSC_VER < 1400) + AS_POP_IF86(bx) + #endif + +#ifdef CRYPTOPP_GENERATE_X64_MASM + add rsp, LOCALS_SIZE+8 + pop rbp + pop rbx + pop rdi + pop rsi + ret + X86_SHA256_HashBlocks ENDP +#endif + +#ifdef __GNUC__ + ".att_syntax prefix;" + : + : "c" (state), "d" (data), "S" (SHA256_K+48), "D" (len) + #if CRYPTOPP_BOOL_X64 + , "m" (workspace[0]) + #endif + : "memory", "cc", "%eax" + #if CRYPTOPP_BOOL_X64 + , "%rbx", "%r8" + #endif + ); +#endif +} + +#endif // #if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_GENERATE_X64_MASM) + +#ifndef CRYPTOPP_GENERATE_X64_MASM + +#ifdef CRYPTOPP_X64_MASM_AVAILABLE +extern "C" { +void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len); +} +#endif + +#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE) + +size_t SHA256::HashMultipleBlocks(const word32 *input, size_t length) +{ + X86_SHA256_HashBlocks(m_state, input, (length&(size_t(0)-BLOCKSIZE)) - !HasSSE2()); + return length % BLOCKSIZE; +} + +size_t SHA224::HashMultipleBlocks(const word32 *input, size_t length) +{ + X86_SHA256_HashBlocks(m_state, input, (length&(size_t(0)-BLOCKSIZE)) - !HasSSE2()); + return length % BLOCKSIZE; +} + +#endif + +#define blk2(i) (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15])) + +#define Ch(x,y,z) (z^(x&(y^z))) +#define Maj(x,y,z) (y^((x^y)&(y^z))) + +#define a(i) T[(0-i)&7] +#define b(i) T[(1-i)&7] +#define c(i) T[(2-i)&7] +#define d(i) T[(3-i)&7] +#define e(i) T[(4-i)&7] +#define f(i) T[(5-i)&7] +#define g(i) T[(6-i)&7] +#define h(i) T[(7-i)&7] + +#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA256_K[i+j]+(j?blk2(i):blk0(i));\ + d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i)) + +// for SHA256 +#define S0(x) (rotrFixed(x,2)^rotrFixed(x,13)^rotrFixed(x,22)) +#define S1(x) (rotrFixed(x,6)^rotrFixed(x,11)^rotrFixed(x,25)) +#define s0(x) (rotrFixed(x,7)^rotrFixed(x,18)^(x>>3)) +#define s1(x) (rotrFixed(x,17)^rotrFixed(x,19)^(x>>10)) + +void SHA256::Transform(word32 *state, const word32 *data) +{ + word32 W[16]; +#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE) + // this byte reverse is a waste of time, but this function is only called by MDC + ByteReverse(W, data, BLOCKSIZE); + X86_SHA256_HashBlocks(state, W, BLOCKSIZE - !HasSSE2()); +#else + word32 T[8]; + /* Copy context->state[] to working vars */ + memcpy(T, state, sizeof(T)); + /* 64 operations, partially loop unrolled */ + for (unsigned int j=0; j<64; j+=16) + { + R( 0); R( 1); R( 2); R( 3); + R( 4); R( 5); R( 6); R( 7); + R( 8); R( 9); R(10); R(11); + R(12); R(13); R(14); R(15); + } + /* Add the working vars back into context.state[] */ + state[0] += a(0); + state[1] += b(0); + state[2] += c(0); + state[3] += d(0); + state[4] += e(0); + state[5] += f(0); + state[6] += g(0); + state[7] += h(0); +#endif +} + +/* +// smaller but slower +void SHA256::Transform(word32 *state, const word32 *data) +{ + word32 T[20]; + word32 W[32]; + unsigned int i = 0, j = 0; + word32 *t = T+8; + + memcpy(t, state, 8*4); + word32 e = t[4], a = t[0]; + + do + { + word32 w = data[j]; + W[j] = w; + w += SHA256_K[j]; + w += t[7]; + w += S1(e); + w += Ch(e, t[5], t[6]); + e = t[3] + w; + t[3] = t[3+8] = e; + w += S0(t[0]); + a = w + Maj(a, t[1], t[2]); + t[-1] = t[7] = a; + --t; + ++j; + if (j%8 == 0) + t += 8; + } while (j<16); + + do + { + i = j&0xf; + word32 w = s1(W[i+16-2]) + s0(W[i+16-15]) + W[i] + W[i+16-7]; + W[i+16] = W[i] = w; + w += SHA256_K[j]; + w += t[7]; + w += S1(e); + w += Ch(e, t[5], t[6]); + e = t[3] + w; + t[3] = t[3+8] = e; + w += S0(t[0]); + a = w + Maj(a, t[1], t[2]); + t[-1] = t[7] = a; + + w = s1(W[(i+1)+16-2]) + s0(W[(i+1)+16-15]) + W[(i+1)] + W[(i+1)+16-7]; + W[(i+1)+16] = W[(i+1)] = w; + w += SHA256_K[j+1]; + w += (t-1)[7]; + w += S1(e); + w += Ch(e, (t-1)[5], (t-1)[6]); + e = (t-1)[3] + w; + (t-1)[3] = (t-1)[3+8] = e; + w += S0((t-1)[0]); + a = w + Maj(a, (t-1)[1], (t-1)[2]); + (t-1)[-1] = (t-1)[7] = a; + + t-=2; + j+=2; + if (j%8 == 0) + t += 8; + } while (j<64); + + state[0] += a; + state[1] += t[1]; + state[2] += t[2]; + state[3] += t[3]; + state[4] += e; + state[5] += t[5]; + state[6] += t[6]; + state[7] += t[7]; +} +*/ + +#undef S0 +#undef S1 +#undef s0 +#undef s1 +#undef R + +// ************************************************************* + +void SHA384::InitState(HashWordType *state) +{ + static const word64 s[8] = { + W64LIT(0xcbbb9d5dc1059ed8), W64LIT(0x629a292a367cd507), + W64LIT(0x9159015a3070dd17), W64LIT(0x152fecd8f70e5939), + W64LIT(0x67332667ffc00b31), W64LIT(0x8eb44a8768581511), + W64LIT(0xdb0c2e0d64f98fa7), W64LIT(0x47b5481dbefa4fa4)}; + memcpy(state, s, sizeof(s)); +} + +void SHA512::InitState(HashWordType *state) +{ + static const word64 s[8] = { + W64LIT(0x6a09e667f3bcc908), W64LIT(0xbb67ae8584caa73b), + W64LIT(0x3c6ef372fe94f82b), W64LIT(0xa54ff53a5f1d36f1), + W64LIT(0x510e527fade682d1), W64LIT(0x9b05688c2b3e6c1f), + W64LIT(0x1f83d9abfb41bd6b), W64LIT(0x5be0cd19137e2179)}; + memcpy(state, s, sizeof(s)); +} + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86 +CRYPTOPP_ALIGN_DATA(16) static const word64 SHA512_K[80] CRYPTOPP_SECTION_ALIGN16 = { +#else +static const word64 SHA512_K[80] = { +#endif + W64LIT(0x428a2f98d728ae22), W64LIT(0x7137449123ef65cd), + W64LIT(0xb5c0fbcfec4d3b2f), W64LIT(0xe9b5dba58189dbbc), + W64LIT(0x3956c25bf348b538), W64LIT(0x59f111f1b605d019), + W64LIT(0x923f82a4af194f9b), W64LIT(0xab1c5ed5da6d8118), + W64LIT(0xd807aa98a3030242), W64LIT(0x12835b0145706fbe), + W64LIT(0x243185be4ee4b28c), W64LIT(0x550c7dc3d5ffb4e2), + W64LIT(0x72be5d74f27b896f), W64LIT(0x80deb1fe3b1696b1), + W64LIT(0x9bdc06a725c71235), W64LIT(0xc19bf174cf692694), + W64LIT(0xe49b69c19ef14ad2), W64LIT(0xefbe4786384f25e3), + W64LIT(0x0fc19dc68b8cd5b5), W64LIT(0x240ca1cc77ac9c65), + W64LIT(0x2de92c6f592b0275), W64LIT(0x4a7484aa6ea6e483), + W64LIT(0x5cb0a9dcbd41fbd4), W64LIT(0x76f988da831153b5), + W64LIT(0x983e5152ee66dfab), W64LIT(0xa831c66d2db43210), + W64LIT(0xb00327c898fb213f), W64LIT(0xbf597fc7beef0ee4), + W64LIT(0xc6e00bf33da88fc2), W64LIT(0xd5a79147930aa725), + W64LIT(0x06ca6351e003826f), W64LIT(0x142929670a0e6e70), + W64LIT(0x27b70a8546d22ffc), W64LIT(0x2e1b21385c26c926), + W64LIT(0x4d2c6dfc5ac42aed), W64LIT(0x53380d139d95b3df), + W64LIT(0x650a73548baf63de), W64LIT(0x766a0abb3c77b2a8), + W64LIT(0x81c2c92e47edaee6), W64LIT(0x92722c851482353b), + W64LIT(0xa2bfe8a14cf10364), W64LIT(0xa81a664bbc423001), + W64LIT(0xc24b8b70d0f89791), W64LIT(0xc76c51a30654be30), + W64LIT(0xd192e819d6ef5218), W64LIT(0xd69906245565a910), + W64LIT(0xf40e35855771202a), W64LIT(0x106aa07032bbd1b8), + W64LIT(0x19a4c116b8d2d0c8), W64LIT(0x1e376c085141ab53), + W64LIT(0x2748774cdf8eeb99), W64LIT(0x34b0bcb5e19b48a8), + W64LIT(0x391c0cb3c5c95a63), W64LIT(0x4ed8aa4ae3418acb), + W64LIT(0x5b9cca4f7763e373), W64LIT(0x682e6ff3d6b2b8a3), + W64LIT(0x748f82ee5defb2fc), W64LIT(0x78a5636f43172f60), + W64LIT(0x84c87814a1f0ab72), W64LIT(0x8cc702081a6439ec), + W64LIT(0x90befffa23631e28), W64LIT(0xa4506cebde82bde9), + W64LIT(0xbef9a3f7b2c67915), W64LIT(0xc67178f2e372532b), + W64LIT(0xca273eceea26619c), W64LIT(0xd186b8c721c0c207), + W64LIT(0xeada7dd6cde0eb1e), W64LIT(0xf57d4f7fee6ed178), + W64LIT(0x06f067aa72176fba), W64LIT(0x0a637dc5a2c898a6), + W64LIT(0x113f9804bef90dae), W64LIT(0x1b710b35131c471b), + W64LIT(0x28db77f523047d84), W64LIT(0x32caab7b40c72493), + W64LIT(0x3c9ebe0a15c9bebc), W64LIT(0x431d67c49c100d4c), + W64LIT(0x4cc5d4becb3e42b6), W64LIT(0x597f299cfc657e2a), + W64LIT(0x5fcb6fab3ad6faec), W64LIT(0x6c44198c4a475817) +}; + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86 +// put assembly version in separate function, otherwise MSVC 2005 SP1 doesn't generate correct code for the non-assembly version +CRYPTOPP_NAKED static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state, const word64 *data) +{ +#ifdef __GNUC__ + __asm__ __volatile__ + ( + ".intel_syntax noprefix;" + AS1( push ebx) + AS2( mov ebx, eax) +#else + AS1( push ebx) + AS1( push esi) + AS1( push edi) + AS2( lea ebx, SHA512_K) +#endif + + AS2( mov eax, esp) + AS2( and esp, 0xfffffff0) + AS2( sub esp, 27*16) // 17*16 for expanded data, 20*8 for state + AS1( push eax) + AS2( xor eax, eax) + AS2( lea edi, [esp+4+8*8]) // start at middle of state buffer. will decrement pointer each round to avoid copying + AS2( lea esi, [esp+4+20*8+8]) // 16-byte alignment, then add 8 + + AS2( movdqa xmm0, [ecx+0*16]) + AS2( movdq2q mm4, xmm0) + AS2( movdqa [edi+0*16], xmm0) + AS2( movdqa xmm0, [ecx+1*16]) + AS2( movdqa [edi+1*16], xmm0) + AS2( movdqa xmm0, [ecx+2*16]) + AS2( movdq2q mm5, xmm0) + AS2( movdqa [edi+2*16], xmm0) + AS2( movdqa xmm0, [ecx+3*16]) + AS2( movdqa [edi+3*16], xmm0) + ASJ( jmp, 0, f) + +#define SSE2_S0_S1(r, a, b, c) \ + AS2( movq mm6, r)\ + AS2( psrlq r, a)\ + AS2( movq mm7, r)\ + AS2( psllq mm6, 64-c)\ + AS2( pxor mm7, mm6)\ + AS2( psrlq r, b-a)\ + AS2( pxor mm7, r)\ + AS2( psllq mm6, c-b)\ + AS2( pxor mm7, mm6)\ + AS2( psrlq r, c-b)\ + AS2( pxor r, mm7)\ + AS2( psllq mm6, b-a)\ + AS2( pxor r, mm6) + +#define SSE2_s0(r, a, b, c) \ + AS2( movdqa xmm6, r)\ + AS2( psrlq r, a)\ + AS2( movdqa xmm7, r)\ + AS2( psllq xmm6, 64-c)\ + AS2( pxor xmm7, xmm6)\ + AS2( psrlq r, b-a)\ + AS2( pxor xmm7, r)\ + AS2( psrlq r, c-b)\ + AS2( pxor r, xmm7)\ + AS2( psllq xmm6, c-a)\ + AS2( pxor r, xmm6) + +#define SSE2_s1(r, a, b, c) \ + AS2( movdqa xmm6, r)\ + AS2( psrlq r, a)\ + AS2( movdqa xmm7, r)\ + AS2( psllq xmm6, 64-c)\ + AS2( pxor xmm7, xmm6)\ + AS2( psrlq r, b-a)\ + AS2( pxor xmm7, r)\ + AS2( psllq xmm6, c-b)\ + AS2( pxor xmm7, xmm6)\ + AS2( psrlq r, c-b)\ + AS2( pxor r, xmm7) + + ASL(SHA512_Round) + // k + w is in mm0, a is in mm4, e is in mm5 + AS2( paddq mm0, [edi+7*8]) // h + AS2( movq mm2, [edi+5*8]) // f + AS2( movq mm3, [edi+6*8]) // g + AS2( pxor mm2, mm3) + AS2( pand mm2, mm5) + SSE2_S0_S1(mm5,14,18,41) + AS2( pxor mm2, mm3) + AS2( paddq mm0, mm2) // h += Ch(e,f,g) + AS2( paddq mm5, mm0) // h += S1(e) + AS2( movq mm2, [edi+1*8]) // b + AS2( movq mm1, mm2) + AS2( por mm2, mm4) + AS2( pand mm2, [edi+2*8]) // c + AS2( pand mm1, mm4) + AS2( por mm1, mm2) + AS2( paddq mm1, mm5) // temp = h + Maj(a,b,c) + AS2( paddq mm5, [edi+3*8]) // e = d + h + AS2( movq [edi+3*8], mm5) + AS2( movq [edi+11*8], mm5) + SSE2_S0_S1(mm4,28,34,39) // S0(a) + AS2( paddq mm4, mm1) // a = temp + S0(a) + AS2( movq [edi-8], mm4) + AS2( movq [edi+7*8], mm4) + AS1( ret) + + // first 16 rounds + ASL(0) + AS2( movq mm0, [edx+eax*8]) + AS2( movq [esi+eax*8], mm0) + AS2( movq [esi+eax*8+16*8], mm0) + AS2( paddq mm0, [ebx+eax*8]) + ASC( call, SHA512_Round) + AS1( inc eax) + AS2( sub edi, 8) + AS2( test eax, 7) + ASJ( jnz, 0, b) + AS2( add edi, 8*8) + AS2( cmp eax, 16) + ASJ( jne, 0, b) + + // rest of the rounds + AS2( movdqu xmm0, [esi+(16-2)*8]) + ASL(1) + // data expansion, W[i-2] already in xmm0 + AS2( movdqu xmm3, [esi]) + AS2( paddq xmm3, [esi+(16-7)*8]) + AS2( movdqa xmm2, [esi+(16-15)*8]) + SSE2_s1(xmm0, 6, 19, 61) + AS2( paddq xmm0, xmm3) + SSE2_s0(xmm2, 1, 7, 8) + AS2( paddq xmm0, xmm2) + AS2( movdq2q mm0, xmm0) + AS2( movhlps xmm1, xmm0) + AS2( paddq mm0, [ebx+eax*8]) + AS2( movlps [esi], xmm0) + AS2( movlps [esi+8], xmm1) + AS2( movlps [esi+8*16], xmm0) + AS2( movlps [esi+8*17], xmm1) + // 2 rounds + ASC( call, SHA512_Round) + AS2( sub edi, 8) + AS2( movdq2q mm0, xmm1) + AS2( paddq mm0, [ebx+eax*8+8]) + ASC( call, SHA512_Round) + // update indices and loop + AS2( add esi, 16) + AS2( add eax, 2) + AS2( sub edi, 8) + AS2( test eax, 7) + ASJ( jnz, 1, b) + // do housekeeping every 8 rounds + AS2( mov esi, 0xf) + AS2( and esi, eax) + AS2( lea esi, [esp+4+20*8+8+esi*8]) + AS2( add edi, 8*8) + AS2( cmp eax, 80) + ASJ( jne, 1, b) + +#define SSE2_CombineState(i) \ + AS2( movdqa xmm0, [edi+i*16])\ + AS2( paddq xmm0, [ecx+i*16])\ + AS2( movdqa [ecx+i*16], xmm0) + + SSE2_CombineState(0) + SSE2_CombineState(1) + SSE2_CombineState(2) + SSE2_CombineState(3) + + AS1( pop esp) + AS1( emms) + +#if defined(__GNUC__) + AS1( pop ebx) + ".att_syntax prefix;" + : + : "a" (SHA512_K), "c" (state), "d" (data) + : "%esi", "%edi", "memory", "cc" + ); +#else + AS1( pop edi) + AS1( pop esi) + AS1( pop ebx) + AS1( ret) +#endif +} +#endif // #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + +void SHA512::Transform(word64 *state, const word64 *data) +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86 + if (HasSSE2()) + { + SHA512_SSE2_Transform(state, data); + return; + } +#endif + +#define S0(x) (rotrFixed(x,28)^rotrFixed(x,34)^rotrFixed(x,39)) +#define S1(x) (rotrFixed(x,14)^rotrFixed(x,18)^rotrFixed(x,41)) +#define s0(x) (rotrFixed(x,1)^rotrFixed(x,8)^(x>>7)) +#define s1(x) (rotrFixed(x,19)^rotrFixed(x,61)^(x>>6)) + +#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA512_K[i+j]+(j?blk2(i):blk0(i));\ + d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i)) + + word64 W[16]; + word64 T[8]; + /* Copy context->state[] to working vars */ + memcpy(T, state, sizeof(T)); + /* 80 operations, partially loop unrolled */ + for (unsigned int j=0; j<80; j+=16) + { + R( 0); R( 1); R( 2); R( 3); + R( 4); R( 5); R( 6); R( 7); + R( 8); R( 9); R(10); R(11); + R(12); R(13); R(14); R(15); + } + /* Add the working vars back into context.state[] */ + state[0] += a(0); + state[1] += b(0); + state[2] += c(0); + state[3] += d(0); + state[4] += e(0); + state[5] += f(0); + state[6] += g(0); + state[7] += h(0); +} + +NAMESPACE_END + +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM +#endif // #ifndef CRYPTOPP_IMPORTS diff --git a/cryptopp/sha.h b/cryptopp/sha.h new file mode 100644 index 0000000..679081e --- /dev/null +++ b/cryptopp/sha.h @@ -0,0 +1,63 @@ +#ifndef CRYPTOPP_SHA_H +#define CRYPTOPP_SHA_H + +#include "iterhash.h" + +NAMESPACE_BEGIN(CryptoPP) + +/// SHA-1 +class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform +{ +public: + static void CRYPTOPP_API InitState(HashWordType *state); + static void CRYPTOPP_API Transform(word32 *digest, const word32 *data); + static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";} +}; + +typedef SHA1 SHA; // for backwards compatibility + +//! implements the SHA-256 standard +class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform +{ +public: +#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE) + size_t HashMultipleBlocks(const word32 *input, size_t length); +#endif + static void CRYPTOPP_API InitState(HashWordType *state); + static void CRYPTOPP_API Transform(word32 *digest, const word32 *data); + static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";} +}; + +//! implements the SHA-224 standard +class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform +{ +public: +#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE) + size_t HashMultipleBlocks(const word32 *input, size_t length); +#endif + static void CRYPTOPP_API InitState(HashWordType *state); + static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);} + static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";} +}; + +//! implements the SHA-512 standard +class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform +{ +public: + static void CRYPTOPP_API InitState(HashWordType *state); + static void CRYPTOPP_API Transform(word64 *digest, const word64 *data); + static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";} +}; + +//! implements the SHA-384 standard +class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform +{ +public: + static void CRYPTOPP_API InitState(HashWordType *state); + static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);} + static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";} +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/shacal2.cpp b/cryptopp/shacal2.cpp new file mode 100644 index 0000000..b0360e4 --- /dev/null +++ b/cryptopp/shacal2.cpp @@ -0,0 +1,140 @@ +// shacal2.cpp - by Kevin Springle, 2003 +// +// Portions of this code were derived from +// Wei Dai's implementation of SHA-2 +// +// The original code and all modifications are in the public domain. + +#include "pch.h" +#include "shacal2.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +// SHACAL-2 function and round definitions + +#define S0(x) (rotrFixed(x,2)^rotrFixed(x,13)^rotrFixed(x,22)) +#define S1(x) (rotrFixed(x,6)^rotrFixed(x,11)^rotrFixed(x,25)) +#define s0(x) (rotrFixed(x,7)^rotrFixed(x,18)^(x>>3)) +#define s1(x) (rotrFixed(x,17)^rotrFixed(x,19)^(x>>10)) + +#define Ch(x,y,z) (z^(x&(y^z))) +#define Maj(x,y,z) ((x&y)|(z&(x|y))) + +/* R is the SHA-256 round function. */ +/* This macro increments the k argument as a side effect. */ +#define R(a,b,c,d,e,f,g,h,k) \ + h+=S1(e)+Ch(e,f,g)+*k++;d+=h;h+=S0(a)+Maj(a,b,c); + +/* P is the inverse of the SHA-256 round function. */ +/* This macro decrements the k argument as a side effect. */ +#define P(a,b,c,d,e,f,g,h,k) \ + h-=S0(a)+Maj(a,b,c);d-=h;h-=S1(e)+Ch(e,f,g)+*--k; + +void SHACAL2::Base::UncheckedSetKey(const byte *userKey, unsigned int keylen, const NameValuePairs &) +{ + AssertValidKeyLength(keylen); + + word32 *rk = m_key; + unsigned int i; + + GetUserKey(BIG_ENDIAN_ORDER, rk, m_key.size(), userKey, keylen); + for (i = 0; i < 48; i++, rk++) + { + rk[16] = rk[0] + s0(rk[1]) + rk[9] + s1(rk[14]); + rk[0] += K[i]; + } + for (i = 48; i < 64; i++, rk++) + { + rk[0] += K[i]; + } +} + +typedef BlockGetAndPut Block; + +void SHACAL2::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 a, b, c, d, e, f, g, h; + const word32 *rk = m_key; + + /* + * map byte array block to cipher state: + */ + Block::Get(inBlock)(a)(b)(c)(d)(e)(f)(g)(h); + + // Perform SHA-256 transformation. + + /* 64 operations, partially loop unrolled */ + for (unsigned int j=0; j<64; j+=8) + { + R(a,b,c,d,e,f,g,h,rk); + R(h,a,b,c,d,e,f,g,rk); + R(g,h,a,b,c,d,e,f,rk); + R(f,g,h,a,b,c,d,e,rk); + R(e,f,g,h,a,b,c,d,rk); + R(d,e,f,g,h,a,b,c,rk); + R(c,d,e,f,g,h,a,b,rk); + R(b,c,d,e,f,g,h,a,rk); + } + + /* + * map cipher state to byte array block: + */ + + Block::Put(xorBlock, outBlock)(a)(b)(c)(d)(e)(f)(g)(h); +} + +void SHACAL2::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 a, b, c, d, e, f, g, h; + const word32 *rk = m_key + 64; + + /* + * map byte array block to cipher state: + */ + Block::Get(inBlock)(a)(b)(c)(d)(e)(f)(g)(h); + + // Perform inverse SHA-256 transformation. + + /* 64 operations, partially loop unrolled */ + for (unsigned int j=0; j<64; j+=8) + { + P(b,c,d,e,f,g,h,a,rk); + P(c,d,e,f,g,h,a,b,rk); + P(d,e,f,g,h,a,b,c,rk); + P(e,f,g,h,a,b,c,d,rk); + P(f,g,h,a,b,c,d,e,rk); + P(g,h,a,b,c,d,e,f,rk); + P(h,a,b,c,d,e,f,g,rk); + P(a,b,c,d,e,f,g,h,rk); + } + + /* + * map cipher state to byte array block: + */ + + Block::Put(xorBlock, outBlock)(a)(b)(c)(d)(e)(f)(g)(h); +} + +// The SHACAL-2 round constants are identical to the SHA-256 round constants. +const word32 SHACAL2::Base::K[64] = +{ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +NAMESPACE_END diff --git a/cryptopp/shacal2.h b/cryptopp/shacal2.h new file mode 100644 index 0000000..66c987f --- /dev/null +++ b/cryptopp/shacal2.h @@ -0,0 +1,54 @@ +#ifndef CRYPTOPP_SHACAL2_H +#define CRYPTOPP_SHACAL2_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct SHACAL2_Info : public FixedBlockSize<32>, public VariableKeyLength<16, 16, 64> +{ + static const char *StaticAlgorithmName() {return "SHACAL-2";} +}; + +/// SHACAL-2 +class SHACAL2 : public SHACAL2_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + FixedSizeSecBlock m_key; + + static const word32 K[64]; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef SHACAL2::Encryption SHACAL2Encryption; +typedef SHACAL2::Decryption SHACAL2Decryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/shark.cpp b/cryptopp/shark.cpp new file mode 100644 index 0000000..361147e --- /dev/null +++ b/cryptopp/shark.cpp @@ -0,0 +1,136 @@ +// shark.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "shark.h" +#include "misc.h" +#include "modes.h" +#include "gf256.h" + +NAMESPACE_BEGIN(CryptoPP) + +static word64 SHARKTransform(word64 a) +{ + static const byte iG[8][8] = { + 0xe7, 0x30, 0x90, 0x85, 0xd0, 0x4b, 0x91, 0x41, + 0x53, 0x95, 0x9b, 0xa5, 0x96, 0xbc, 0xa1, 0x68, + 0x02, 0x45, 0xf7, 0x65, 0x5c, 0x1f, 0xb6, 0x52, + 0xa2, 0xca, 0x22, 0x94, 0x44, 0x63, 0x2a, 0xa2, + 0xfc, 0x67, 0x8e, 0x10, 0x29, 0x75, 0x85, 0x71, + 0x24, 0x45, 0xa2, 0xcf, 0x2f, 0x22, 0xc1, 0x0e, + 0xa1, 0xf1, 0x71, 0x40, 0x91, 0x27, 0x18, 0xa5, + 0x56, 0xf4, 0xaf, 0x32, 0xd2, 0xa4, 0xdc, 0x71, + }; + + word64 result=0; + GF256 gf256(0xf5); + for (unsigned int i=0; i<8; i++) + for(unsigned int j=0; j<8; j++) + result ^= word64(gf256.Multiply(iG[i][j], GF256::Element(a>>(56-8*j)))) << (56-8*i); + return result; +} + +void SHARK::Base::UncheckedSetKey(const byte *key, unsigned int keyLen, const NameValuePairs ¶ms) +{ + AssertValidKeyLength(keyLen); + + m_rounds = GetRoundsAndThrowIfInvalid(params, this); + m_roundKeys.New(m_rounds+1); + + // concatenate key enought times to fill a + for (unsigned int i=0; i<(m_rounds+1)*8; i++) + ((byte *)m_roundKeys.begin())[i] = key[i%keyLen]; + + SHARK::Encryption e; + e.InitForKeySetup(); + byte IV[8] = {0,0,0,0,0,0,0,0}; + CFB_Mode_ExternalCipher::Encryption cfb(e, IV); + + cfb.ProcessString((byte *)m_roundKeys.begin(), (m_rounds+1)*8); + + ConditionalByteReverse(BIG_ENDIAN_ORDER, m_roundKeys.begin(), m_roundKeys.begin(), (m_rounds+1)*8); + + m_roundKeys[m_rounds] = SHARKTransform(m_roundKeys[m_rounds]); + + if (!IsForwardTransformation()) + { + unsigned int i; + + // transform encryption round keys into decryption round keys + for (i=0; i +struct SharkProcessAndXorBlock{ // VC60 workaround: problem with template functions +inline SharkProcessAndXorBlock(const word64 *roundKeys, unsigned int rounds, const byte *inBlock, const byte *xorBlock, byte *outBlock) +{ + word64 tmp = *(word64 *)inBlock ^ roundKeys[0]; + + ByteOrder order = GetNativeByteOrder(); + tmp = cbox[0][GetByte(order, tmp, 0)] ^ cbox[1][GetByte(order, tmp, 1)] + ^ cbox[2][GetByte(order, tmp, 2)] ^ cbox[3][GetByte(order, tmp, 3)] + ^ cbox[4][GetByte(order, tmp, 4)] ^ cbox[5][GetByte(order, tmp, 5)] + ^ cbox[6][GetByte(order, tmp, 6)] ^ cbox[7][GetByte(order, tmp, 7)] + ^ roundKeys[1]; + + for(unsigned int i=2; i(xorBlock, outBlock) + (sbox[GETBYTE(tmp, 7)]) + (sbox[GETBYTE(tmp, 6)]) + (sbox[GETBYTE(tmp, 5)]) + (sbox[GETBYTE(tmp, 4)]) + (sbox[GETBYTE(tmp, 3)]) + (sbox[GETBYTE(tmp, 2)]) + (sbox[GETBYTE(tmp, 1)]) + (sbox[GETBYTE(tmp, 0)]); + + *(word64 *)outBlock ^= roundKeys[rounds]; +}}; + +void SHARK::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + SharkProcessAndXorBlock(m_roundKeys, m_rounds, inBlock, xorBlock, outBlock); +} + +void SHARK::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + SharkProcessAndXorBlock(m_roundKeys, m_rounds, inBlock, xorBlock, outBlock); +} + +NAMESPACE_END diff --git a/cryptopp/shark.h b/cryptopp/shark.h new file mode 100644 index 0000000..8d5ce9b --- /dev/null +++ b/cryptopp/shark.h @@ -0,0 +1,65 @@ +#ifndef CRYPTOPP_SHARK_H +#define CRYPTOPP_SHARK_H + +/** \file +*/ + +#include "config.h" +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct SHARK_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 16>, public VariableRounds<6, 2> +{ + static const char *StaticAlgorithmName() {return "SHARK-E";} +}; + +/// SHARK-E +class SHARK : public SHARK_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶m); + + protected: + unsigned int m_rounds; + SecBlock m_roundKeys; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + + // used by Base to do key setup + void InitForKeySetup(); + + private: + static const byte sbox[256]; + static const word64 cbox[8][256]; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + + private: + static const byte sbox[256]; + static const word64 cbox[8][256]; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef SHARK::Encryption SHARKEncryption; +typedef SHARK::Decryption SHARKDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/sharkbox.cpp b/cryptopp/sharkbox.cpp new file mode 100644 index 0000000..a0ff31f --- /dev/null +++ b/cryptopp/sharkbox.cpp @@ -0,0 +1,4162 @@ +#include "pch.h" +#include "shark.h" + +NAMESPACE_BEGIN(CryptoPP) + +const byte SHARK::Enc::sbox[256] = { +177, 206, 195, 149, 90, 173, 231, 2, 77, 68, 251, 145, 12, 135, 161, 80, +203, 103, 84, 221, 70, 143, 225, 78, 240, 253, 252, 235, 249, 196, 26, 110, + 94, 245, 204, 141, 28, 86, 67, 254, 7, 97, 248, 117, 89, 255, 3, 34, +138, 209, 19, 238, 136, 0, 14, 52, 21, 128, 148, 227, 237, 181, 83, 35, + 75, 71, 23, 167, 144, 53, 171, 216, 184, 223, 79, 87, 154, 146, 219, 27, + 60, 200, 153, 4, 142, 224, 215, 125, 133, 187, 64, 44, 58, 69, 241, 66, +101, 32, 65, 24, 114, 37, 147, 112, 54, 5, 242, 11, 163, 121, 236, 8, + 39, 49, 50, 182, 124, 176, 10, 115, 91, 123, 183, 129, 210, 13, 106, 38, +158, 88, 156, 131, 116, 179, 172, 48, 122, 105, 119, 15, 174, 33, 222, 208, + 46, 151, 16, 164, 152, 168, 212, 104, 45, 98, 41, 109, 22, 73, 118, 199, +232, 193, 150, 55, 229, 202, 244, 233, 99, 18, 194, 166, 20, 188, 211, 40, +175, 47, 230, 36, 82, 198, 160, 9, 189, 140, 207, 93, 17, 95, 1, 197, +159, 61, 162, 155, 201, 59, 190, 81, 25, 31, 63, 92, 178, 239, 74, 205, +191, 186, 111, 100, 217, 243, 62, 180, 170, 220, 213, 6, 192, 126, 246, 102, +108, 132, 113, 56, 185, 29, 127, 157, 72, 139, 42, 218, 165, 51, 130, 57, +214, 120, 134, 250, 228, 43, 169, 30, 137, 96, 107, 234, 85, 76, 247, 226, +}; + +const byte SHARK::Dec::sbox[256] = { + 53, 190, 7, 46, 83, 105, 219, 40, 111, 183, 118, 107, 12, 125, 54, 139, +146, 188, 169, 50, 172, 56, 156, 66, 99, 200, 30, 79, 36, 229, 247, 201, + 97, 141, 47, 63, 179, 101, 127, 112, 175, 154, 234, 245, 91, 152, 144, 177, +135, 113, 114, 237, 55, 69, 104, 163, 227, 239, 92, 197, 80, 193, 214, 202, + 90, 98, 95, 38, 9, 93, 20, 65, 232, 157, 206, 64, 253, 8, 23, 74, + 15, 199, 180, 62, 18, 252, 37, 75, 129, 44, 4, 120, 203, 187, 32, 189, +249, 41, 153, 168, 211, 96, 223, 17, 151, 137, 126, 250, 224, 155, 31, 210, +103, 226, 100, 119, 132, 43, 158, 138, 241, 109, 136, 121, 116, 87, 221, 230, + 57, 123, 238, 131, 225, 88, 242, 13, 52, 248, 48, 233, 185, 35, 84, 21, + 68, 11, 77, 102, 58, 3, 162, 145, 148, 82, 76, 195, 130, 231, 128, 192, +182, 14, 194, 108, 147, 236, 171, 67, 149, 246, 216, 70, 134, 5, 140, 176, +117, 0, 204, 133, 215, 61, 115, 122, 72, 228, 209, 89, 173, 184, 198, 208, +220, 161, 170, 2, 29, 191, 181, 159, 81, 196, 165, 16, 34, 207, 1, 186, +143, 49, 124, 174, 150, 218, 240, 86, 71, 212, 235, 78, 217, 19, 142, 73, + 85, 22, 255, 59, 244, 164, 178, 6, 160, 167, 251, 27, 110, 60, 51, 205, + 24, 94, 106, 213, 166, 33, 222, 254, 42, 28, 243, 10, 26, 25, 39, 45, +}; + +const word64 SHARK::Enc::cbox[8][256] = { +/* box 0 */ +W64LIT(0x060d838f16f3a365), +W64LIT(0xa68857ee5cae56f6), +W64LIT(0xebf516353c2c4d89), +W64LIT(0x652174be88e85bdc), +W64LIT(0x0d4e9a8086c17921), +W64LIT(0x27ba7d33cffa58a1), +W64LIT(0x88d9e104a237b530), +W64LIT(0x693b8755a4fbe816), +W64LIT(0xdac9591826b254a0), +W64LIT(0x45c2e369fb336af3), +W64LIT(0xa96e1fb87b3e4ef4), +W64LIT(0xb7578f1435eb7ef0), +W64LIT(0x839af80b32056f74), +W64LIT(0xae37f55cc71f277a), +W64LIT(0xa4208538fdff37d5), +W64LIT(0x35991e74ad3cdb6f), +W64LIT(0xba191594b32a07d1), +W64LIT(0x5344d1772e572b7b), +W64LIT(0xe7efe5de103ffe43), +W64LIT(0xa3796fdc41de5e5b), +W64LIT(0x2cf9643c5fc882e5), +W64LIT(0xffdbf6fd48196d22), +W64LIT(0x33949dfbbbcf780a), +W64LIT(0x7d15679dd0cec8bd), +W64LIT(0x5f5e229c024498b1), +W64LIT(0x1223634762c683ce), +W64LIT(0xdcc4da973041f7c5), +W64LIT(0x0b43190f9032da44), +W64LIT(0xc05598eddfc5a6e2), +W64LIT(0x9e5fd31a7753f4b8), +W64LIT(0x9afa8243c0f136fe), +W64LIT(0xcc4f6b06f3d61528), +W64LIT(0xdf38612a3bc25c0d), +W64LIT(0x43cf60e6edc0c996), +W64LIT(0xcfb3d0bbf855bee0), +W64LIT(0x96e071a8ece28534), +W64LIT(0x21b7febcd909fbc4), +W64LIT(0x8ed4628bb4c41655), +W64LIT(0x30682646b04cd3c2), +W64LIT(0xb5ff5dc294ba1fd3), +W64LIT(0x75aac52f4b7fb931), +W64LIT(0xe809ad8837afe641), +W64LIT(0x0eb2213d8d42d2e9), +W64LIT(0x9852509561a057dd), +W64LIT(0xaa92a40570bde53c), +W64LIT(0x7b18e412c63d6bd8), +W64LIT(0xa7dc3e85f67c9c1d), +W64LIT(0xd8618bce87e33583), +W64LIT(0xe34ab487a79d3c05), +W64LIT(0x20e397d773db312f), +W64LIT(0x05f138321d7008ad), +W64LIT(0x17d25b757fb68b63), +W64LIT(0x8a7133d20366d413), +W64LIT(0x0000000000000000), +W64LIT(0xeaa17f5e96fe8762), +W64LIT(0xc101f18675176c09), +W64LIT(0xbebc44cd0488c597), +W64LIT(0xdb9d30738c609e4b), +W64LIT(0xabc6cd6eda6f2fd7), +W64LIT(0x5aaf1aae1f34901c), +W64LIT(0xb00e65f089ca177e), +W64LIT(0xd47b7825abf08649), +W64LIT(0x924520f15b404772), +W64LIT(0x1686321ed5644188), +W64LIT(0x618425e73f4a999a), +W64LIT(0xe21eddec0d4ff6ee), +W64LIT(0xd787c398a0732d81), +W64LIT(0x1f6df9c7e407faef), +W64LIT(0x79b036c4676c0afb), +W64LIT(0x0fe6485627901802), +W64LIT(0x9cf701ccd602959b), +W64LIT(0xbfe82da6ae5a0f7c), +W64LIT(0x990639fecb729d36), +W64LIT(0xca42e889e525b64d), +W64LIT(0xb3f2de4d8249bcb6), +W64LIT(0x4033db5be643625e), +W64LIT(0x4167b2304c91a8b5), +W64LIT(0x108bb191c397e2ed), +W64LIT(0x1834132358269361), +W64LIT(0x541d3b93927642f5), +W64LIT(0x90edf227fa112651), +W64LIT(0x1dc52b1145569bcc), +W64LIT(0xe6bb8cb5baed34a8), +W64LIT(0xd276fbaabd03252c), +W64LIT(0x313c4f2d1a9e1929), +W64LIT(0xfd73242be9480c01), +W64LIT(0x9baeeb286a23fc15), +W64LIT(0xc9be5334eea61d85), +W64LIT(0xc70c720963e4cf6c), +W64LIT(0x3eda077b3d0e012b), +W64LIT(0x97b418c346304fdf), +W64LIT(0x32c0f490111db2e1), +W64LIT(0x2ba08ed8e3e9eb6b), +W64LIT(0x8b255ab9a9b41ef8), +W64LIT(0x91b99b4c50c3ecba), +W64LIT(0xfe8f9f96e2cba7c9), +W64LIT(0x3a7f56228aacc36d), +W64LIT(0xb15a0c9b2318dd95), +W64LIT(0x5953a11314b73bd4), +W64LIT(0xf3c10516640adee8), +W64LIT(0xedf895ba2adfeeec), +W64LIT(0xadcb4ee1cc9c8cb2), +W64LIT(0xde6c0841911096e6), +W64LIT(0x84c312ef8e2406fa), +W64LIT(0xa83a76d3d1ec841f), +W64LIT(0x1c91427aef845127), +W64LIT(0x3665a5c9a6bf70a7), +W64LIT(0xf6303d24797ad645), +W64LIT(0xcd1b026d5904dfc3), +W64LIT(0x1bc8a89e53a538a9), +W64LIT(0x7ee9dc20db4d6375), +W64LIT(0x51ec03a18f064a58), +W64LIT(0xc4f0c9b4686764a4), +W64LIT(0xdd90b3fc9a933d2e), +W64LIT(0x7a4c8d796cefa133), +W64LIT(0x73a746a05d8c1a54), +W64LIT(0x0759eae4bc21698e), +W64LIT(0xc8ea3a5f4474d76e), +W64LIT(0x38d784f42bfda24e), +W64LIT(0x231f2c6a78589ae7), +W64LIT(0xc3a92350d4460d2a), +W64LIT(0x72f32fcbf75ed0bf), +W64LIT(0xbd40ff700f0b6e5f), +W64LIT(0x157a89a3dee7ea40), +W64LIT(0x873fa95285a7ad32), +W64LIT(0x4d7d41db60821b7f), +W64LIT(0x1e3990ac4ed53004), +W64LIT(0x0a1770643ae010af), +W64LIT(0x9311499af1928d99), +W64LIT(0x64751dd5223a9137), +W64LIT(0xfa2acecf5569658f), +W64LIT(0x7c410ef67a1c0256), +W64LIT(0x56b5e945332723d6), +W64LIT(0x6f3604dab2084b73), +W64LIT(0xe95dc4e39d7d2caa), +W64LIT(0x13770a2cc8144925), +W64LIT(0xbc14961ba5d9a4b4), +W64LIT(0xb9e5ae29b8a9ac19), +W64LIT(0xf169d7c0c55bbfcb), +W64LIT(0x2446c68ec479f369), +W64LIT(0x806643b63986c4bc), +W64LIT(0x7fbdb54b719fa99e), +W64LIT(0x04a55159b7a2c246), +W64LIT(0xee042e07215c4524), +W64LIT(0x5bfb73c5b5e65af7), +W64LIT(0x0c1af3eb2c13b3ca), +W64LIT(0xa22d06b7eb0c94b0), +W64LIT(0xb8b1c742127b66f2), +W64LIT(0x285c3565e86a40a3), +W64LIT(0x3b2b3f49207e0986), +W64LIT(0x3c72d5ad9c5f6008), +W64LIT(0x770217f9ea2ed812), +W64LIT(0xfc274d40439ac6ea), +W64LIT(0x4fd5930dc1d37a5c), +W64LIT(0x2e51b6eafe99e3c6), +W64LIT(0x6b93558305aa8935), +W64LIT(0x19607a48f2f4598a), +W64LIT(0x08bfa2b29bb1718c), +W64LIT(0x3f8e6e1097dccbc0), +W64LIT(0x3983ed9f812f68a5), +W64LIT(0xac9f278a664e4659), +W64LIT(0x82ce916098d7a59f), +W64LIT(0xc2fd4a3b7e94c7c1), +W64LIT(0x66ddcf03836bf014), +W64LIT(0xe1e2665106cc5d26), +W64LIT(0x74feac44e1ad73da), +W64LIT(0x8d28d936bf47bd9d), +W64LIT(0x62789e5a34c93252), +W64LIT(0x81322add93540e57), +W64LIT(0xcb1681e24ff77ca6), +W64LIT(0x2512afe56eab3982), +W64LIT(0xd18a4017b6808ee4), +W64LIT(0x705bfd1d560fb19c), +W64LIT(0x4b70c2547671b81a), +W64LIT(0x49d81082d720d939), +W64LIT(0xe0b60f3aac1e97cd), +W64LIT(0x4e81fa666b01b0b7), +W64LIT(0x951cca15e7612efc), +W64LIT(0x463e58d4f0b0c13b), +W64LIT(0x632cf7319e1bf8b9), +W64LIT(0x5ca2992109c73379), +W64LIT(0xf764544fd3a81cae), +W64LIT(0x6ac73ce8af7843de), +W64LIT(0x9f0bba71dd813e53), +W64LIT(0x85977b8424f6cc11), +W64LIT(0x5807c878be65f13f), +W64LIT(0x686fee3e0e2922fd), +W64LIT(0x78e45fafcdbec010), +W64LIT(0x6ccabf67b98be0bb), +W64LIT(0x11dfd8fa69452806), +W64LIT(0xcee7b9d05287740b), +W64LIT(0x50b86aca25d480b3), +W64LIT(0x5df6f04aa315f992), +W64LIT(0x5e0a4bf7a896525a), +W64LIT(0x03fcbbbd0b83abc8), +W64LIT(0x8f800be01e16dcbe), +W64LIT(0xd32292c117d1efc7), +W64LIT(0xe5473708b16e9f60), +W64LIT(0x224b4501d28a500c), +W64LIT(0xfb7ea7a4ffbbaf64), +W64LIT(0x3d26bcc6368daae3), +W64LIT(0x866bc0392f7567d9), +W64LIT(0x3731cca20c6dba4c), +W64LIT(0xb603e67f9f39b41b), +W64LIT(0xa1d1bd0ae08f3f78), +W64LIT(0xd935e2a52d31ff68), +W64LIT(0xaf639c376dcded91), +W64LIT(0x0154696baad2caeb), +W64LIT(0xecacfcd1800d2407), +W64LIT(0xf03dbeab6f897520), +W64LIT(0x02a8d2d6a1516123), +W64LIT(0xf498eff2d82bb766), +W64LIT(0x710f9476fcdd7b77), +W64LIT(0xf8821c19f43804ac), +W64LIT(0xf9d675725eeace47), +W64LIT(0x1a9cc1f5f977f242), +W64LIT(0x5210b81c8485e190), +W64LIT(0x6d9ed60c13592a50), +W64LIT(0xf2956c7dced81403), +W64LIT(0xbb4d7cff19f8cd3a), +W64LIT(0x4c2928b0ca50d194), +W64LIT(0x6e626db118da8198), +W64LIT(0xe4135e631bbc558b), +W64LIT(0x9da368a77cd05f70), +W64LIT(0xa574ec53572dfd3e), +W64LIT(0x09ebcbd93163bb67), +W64LIT(0x4a24ab3fdca372f1), +W64LIT(0x429b098d4712037d), +W64LIT(0x57e1802e99f5e93d), +W64LIT(0xef50476c8b8e8fcf), +W64LIT(0xa085d4614a5df593), +W64LIT(0x34cd771f07ee1184), +W64LIT(0xc6581b62c9360587), +W64LIT(0x2dad0d57f51a480e), +W64LIT(0x898d886f08e57fdb), +W64LIT(0xd6d3aaf30aa1e76a), +W64LIT(0x76567e9240fc12f9), +W64LIT(0xb4ab34a93e68d538), +W64LIT(0xb2a6b726289b765d), +W64LIT(0x8c7cb05d15957776), +W64LIT(0x554952f838a4881e), +W64LIT(0xd52f114e01224ca2), +W64LIT(0x60d04c8c95985371), +W64LIT(0x6789a66829b93aff), +W64LIT(0x2f05df81544b292d), +W64LIT(0x476a31bf5a620bd0), +W64LIT(0xf5cc869972f97d8d), +W64LIT(0x488c79e97df213d2), +W64LIT(0x44968a0251e1a018), +W64LIT(0x26ee14586528924a), +W64LIT(0xd0de297c1c52440f), +W64LIT(0xc5a4a0dfc2b5ae4f), +W64LIT(0x29085c0e42b88a48), +W64LIT(0x142ee0c8743520ab), +W64LIT(0x2af4e7b3493b2180), +W64LIT(0x9448a37e4db3e417), +/* box 1 */ +W64LIT(0xe2795ba105ba30ce), +W64LIT(0x65b5d634f5e0fbdd), +W64LIT(0x2d7d7f1464dd8c55), +W64LIT(0xeefbf778add1c20b), +W64LIT(0x1eb0fbd1f11968e7), +W64LIT(0xe6073f45ce30cd8d), +W64LIT(0x21ffd3cdccb67e90), +W64LIT(0xdf0941cfa750a262), +W64LIT(0xc61df5b1b75ef18a), +W64LIT(0xc5c7defa9dc337c6), +W64LIT(0x2581b729073c83d3), +W64LIT(0xa5e97513167173cf), +W64LIT(0xdd3673bd381526b9), +W64LIT(0xe8baa1eef91ebb93), +W64LIT(0x3b314cf8f625eb34), +W64LIT(0x579d4bc8d5fc5df8), +W64LIT(0xbb598ec2e7681b28), +W64LIT(0xc8a06b1a80708794), +W64LIT(0x1c8fc9a36e5cec3c), +W64LIT(0xf60a5a3f0807d374), +W64LIT(0x1ace9f353a9395a4), +W64LIT(0x7e9e50387aab2cee), +W64LIT(0xb5e41069d0466d36), +W64LIT(0x8cea6ee3b92602d9), +W64LIT(0xf952ddad8af1e7fd), +W64LIT(0xb19a748d1bcc9075), +W64LIT(0x2464ae10b2e4c144), +W64LIT(0xfcc9a070f4a35829), +W64LIT(0xfa88f6e6a06c21b1), +W64LIT(0x2c98662dd105cec2), +W64LIT(0x9065a740d77aeee5), +W64LIT(0xcb7a4051aaed41d8), +W64LIT(0x55a279ba4ab9d923), +W64LIT(0x27be855b98790708), +W64LIT(0xbabc97fb52b059bf), +W64LIT(0xa19711f7ddfb8e8c), +W64LIT(0x047e64e4cb8afd43), +W64LIT(0xc386886cc90c4e5e), +W64LIT(0xc422c7c3281b7551), +W64LIT(0xfb6defdf15b46326), +W64LIT(0x01e51939b5d84297), +W64LIT(0x5cbba8be9c809432), +W64LIT(0x6f762c7b09447080), +W64LIT(0xcee13d8cd4bffe0c), +W64LIT(0x54476083ff619bb4), +W64LIT(0x6e933542bc9c3217), +W64LIT(0x4af79b520e78f353), +W64LIT(0x98996f7db49be163), +W64LIT(0xa07208ce6823cc1b), +W64LIT(0x2b3c29823012f5cd), +W64LIT(0x93bf8c0bfde728a9), +W64LIT(0x2225f886e62bb8dc), +W64LIT(0x7f7b4901cf736e79), +W64LIT(0x0000000000000000), +W64LIT(0x023f32729f4584db), +W64LIT(0xd5cabb805bf4293f), +W64LIT(0x07a44fafe1173b0f), +W64LIT(0xe95fb8d74cc6f904), +W64LIT(0x7b052de504f9933a), +W64LIT(0x6aed51a67716cf54), +W64LIT(0x68d263d4e8534b8f), +W64LIT(0xa96bd9cabe1a810a), +W64LIT(0x1d6ad09adb84aeab), +W64LIT(0x0d67b5e01db3b052), +W64LIT(0x52063615abaee22c), +W64LIT(0x8f3045a893bbc495), +W64LIT(0xd8ad0e604647996d), +W64LIT(0xaf2a8f5cead5f892), +W64LIT(0x3017af8ebf5922fe), +W64LIT(0x4034611df2dc780e), +W64LIT(0x721cfce1d2c0de2b), +W64LIT(0x28e602c91a8f3381), +W64LIT(0xe1a370ea2f27f682), +W64LIT(0x29031bf0af577116), +W64LIT(0x1914b47e100e53e8), +W64LIT(0x567852f160241f6f), +W64LIT(0x793a1f979bbc17e1), +W64LIT(0xef1eee411809809c), +W64LIT(0x6211999b14f7c0d2), +W64LIT(0x059b7ddd7e52bfd4), +W64LIT(0x43ee4a56d841be42), +W64LIT(0xf1ae1590e910e87b), +W64LIT(0x33cd84c595c4e4b2), +W64LIT(0x4b12826bbba0b1c4), +W64LIT(0xeb608aa5d3837ddf), +W64LIT(0x201acaf4796e3c07), +W64LIT(0xbf27ea262ce2e66b), +W64LIT(0x58c5cc5a570a6971), +W64LIT(0x37b3e0215e4e19f1), +W64LIT(0xab54ebb8215f05d1), +W64LIT(0x8ed55c9126638602), +W64LIT(0x9aa65d0f2bde65b8), +W64LIT(0xd7f589f2c4b1ade4), +W64LIT(0x5039046734eb66f7), +W64LIT(0x6cac073023d9b6cc), +W64LIT(0x51dc1d5e81332460), +W64LIT(0x17a92ad5272025f6), +W64LIT(0x47902eb213cb4301), +W64LIT(0x1b2b860c8f4bd733), +W64LIT(0x4f6ce68f702a4c87), +W64LIT(0xcf0424b56167bc9b), +W64LIT(0x997c76440143a3f4), +W64LIT(0x7ae034dcb121d1ad), +W64LIT(0x100d657ac6371ef9), +W64LIT(0x0ac3fa4ffca48b5d), +W64LIT(0xdeec58f61288e0f5), +W64LIT(0x265b9c622da1459f), +W64LIT(0xdcd36a848dcd642e), +W64LIT(0xe4380d3751754956), +W64LIT(0x13d74e31ecaad8b5), +W64LIT(0xfd2cb949417b1abe), +W64LIT(0x9624f1d683b5977d), +W64LIT(0x4675378ba6130196), +W64LIT(0x0b26e376497cc9ca), +W64LIT(0x41d1782447043a99), +W64LIT(0xe39c4298b0627259), +W64LIT(0xcd3b16c7fe223840), +W64LIT(0x7787813cac9261ff), +W64LIT(0x492db01924e5351f), +W64LIT(0x5afafe28c84fedaa), +W64LIT(0x8b4e214c583139d6), +W64LIT(0xccde0ffe4bfa7ad7), +W64LIT(0x76629805194a2368), +W64LIT(0x7ca1624ae5eea835), +W64LIT(0x61cbb2d03e6a069e), +W64LIT(0x48c8a920913d7788), +W64LIT(0x8068c23a114df01c), +W64LIT(0xd38bed160f3b50a7), +W64LIT(0x32289dfc201ca625), +W64LIT(0xc1b9ba1e5649ca85), +W64LIT(0xed21dc33874c0447), +W64LIT(0xa3a8238542be0a57), +W64LIT(0x5b1fe7117d97af3d), +W64LIT(0x3d701a6ea2ea92ac), +W64LIT(0x73f9e5d867189cbc), +W64LIT(0x9ed839ebe05498fb), +W64LIT(0x5920d563e2d22be6), +W64LIT(0xca9f59681f35034f), +W64LIT(0x11e87c4373ef5c6e), +W64LIT(0x97c1e8ef366dd5ea), +W64LIT(0xacf0a417c0483ede), +W64LIT(0xd26ef42fbae31230), +W64LIT(0xbcfdc16d067f2027), +W64LIT(0xbec2f31f993aa4fc), +W64LIT(0x45af1cc08c8ec7da), +W64LIT(0x31f2b6b70a816069), +W64LIT(0xd9481759f39fdbfa), +W64LIT(0xe5dd140ee4ad0bc1), +W64LIT(0xa6335e583cecb583), +W64LIT(0x38eb67b3dcb82d78), +W64LIT(0xf5d07174229a1538), +W64LIT(0x5f6183f5b61d527e), +W64LIT(0x0f58879282f63489), +W64LIT(0x164c33ec92f86761), +W64LIT(0x444a05f93956854d), +W64LIT(0x818ddb03a495b28b), +W64LIT(0x4d53d4fdef6fc85c), +W64LIT(0x8d0f77da0cfe404e), +W64LIT(0x8416a6dedac70d5f), +W64LIT(0x666ffd7fdf7d3d91), +W64LIT(0xb63e3b22fadbab7a), +W64LIT(0xf2743edbc38d2e37), +W64LIT(0xa40c6c2aa3a93158), +W64LIT(0x9f3d20d2558cda6c), +W64LIT(0xfef692026be6dcf2), +W64LIT(0x2ea7545f4e404a19), +W64LIT(0xb2405fc631515639), +W64LIT(0x23c0e1bf53f3fa4b), +W64LIT(0x83b2e9713bd03650), +W64LIT(0x0641569654cf7998), +W64LIT(0xb883a589cdf5dd64), +W64LIT(0x3ad455c143fda9a3), +W64LIT(0x925a9532483f6a3e), +W64LIT(0xaab1f28194874746), +W64LIT(0xf435684d974257af), +W64LIT(0xd1b4df64907ed47c), +W64LIT(0x390e7e8a69606fef), +W64LIT(0xd051c65d25a696eb), +W64LIT(0xb4010950659e2fa1), +W64LIT(0x0c82acd9a86bf2c5), +W64LIT(0x88940a0772acff9a), +W64LIT(0xf39127e276556ca0), +W64LIT(0xaecf96655f0dba05), +W64LIT(0x03da2b4b2a9dc64c), +W64LIT(0x3f4f281c3daf1677), +W64LIT(0x3469cb6a74d3dfbd), +W64LIT(0xf04b0ca95cc8aaec), +W64LIT(0x1f55e2e844c12a70), +W64LIT(0x4cb6cdc45ab78acb), +W64LIT(0xc05ca327e3918812), +W64LIT(0x95feda9da9285131), +W64LIT(0xb966bcb0782d9ff3), +W64LIT(0xa7d647618934f714), +W64LIT(0xd61090cb7169ef73), +W64LIT(0x71c6d7aaf85d1867), +W64LIT(0xecc4c50a329446d0), +W64LIT(0x6450cf0d4038b94a), +W64LIT(0x420b536f6d99fcd5), +W64LIT(0x75b8b34e33d7e524), +W64LIT(0xc26391557cd40cc9), +W64LIT(0xda923c12d9021db6), +W64LIT(0x4e89ffb6c5f20e10), +W64LIT(0x0919d104d6394d11), +W64LIT(0x8aab3875ede97b41), +W64LIT(0xa88ec0f30bc2c39d), +W64LIT(0xb7db221b4f03e9ed), +W64LIT(0xc7f8ec880286b31d), +W64LIT(0x2f424d66fb98088e), +W64LIT(0xe04669d39affb415), +W64LIT(0x3eaa3125887754e0), +W64LIT(0x5e849acc03c510e9), +W64LIT(0x8257f0488e0874c7), +W64LIT(0xbd18d854b3a762b0), +W64LIT(0xb3a546ff848914ae), +W64LIT(0x9ce70b997f111c20), +W64LIT(0x3c9503571732d03b), +W64LIT(0xe7e2267c7be88f1a), +W64LIT(0x63f480a2a12f8245), +W64LIT(0x602eabe98bb24409), +W64LIT(0x941bc3a41cf013a6), +W64LIT(0x678ae4466aa57f06), +W64LIT(0x1232570859729a22), +W64LIT(0x6d491e099601f45b), +W64LIT(0x5d5eb1872958d6a5), +W64LIT(0x1473019e0dbde3ba), +W64LIT(0xa24d3abcf76648c0), +W64LIT(0x85f3bfe76f1f4fc8), +W64LIT(0x08fcc83d63e10f86), +W64LIT(0x745daa77860fa7b3), +W64LIT(0x9180be7962a2ac72), +W64LIT(0x87cc8d95f05acb13), +W64LIT(0x78df06ae2e645576), +W64LIT(0x18f1ad47a5d6117f), +W64LIT(0x358cd253c10b9d2a), +W64LIT(0x0ebd9eab372e761e), +W64LIT(0xf7ef4306bddf91e3), +W64LIT(0x7023ce934d855af0), +W64LIT(0xd42fa2b9ee2c6ba8), +W64LIT(0x3656f918eb965b66), +W64LIT(0x9d0212a0cac95eb7), +W64LIT(0x2ad930bb85cab75a), +W64LIT(0x862994ac45828984), +W64LIT(0x7d447b735036eaa2), +W64LIT(0xb07f6db4ae14d2e2), +W64LIT(0x6b08489fc2ce8dc3), +W64LIT(0x9b4344369e06272f), +W64LIT(0xad15bd2e75907c49), +W64LIT(0xdb77252b6cda5f21), +W64LIT(0xea85939c665b3f48), +W64LIT(0xc945722335a8c503), +W64LIT(0x159618a7b865a12d), +W64LIT(0x69377aed5d8b0918), +W64LIT(0x8971133ec774bd0d), +W64LIT(0x53e32f2c1e76a0bb), +W64LIT(0xf8b7c4943f29a56a), +W64LIT(0xff138b3bde3e9e65), +/* box 2 */ +W64LIT(0x7c6a2eb5fdabecc6), +W64LIT(0x401cda0a752bbea0), +W64LIT(0x1925217156dc57c4), +W64LIT(0x56dec6d301d70787), +W64LIT(0x41c751ff73c6ac58), +W64LIT(0xc9067697a92cb5f9), +W64LIT(0x3391c917aaa0bc85), +W64LIT(0xae0a9a4c0e742afe), +W64LIT(0xaa8ca972162a62f4), +W64LIT(0x5aa193912935df99), +W64LIT(0x86fd9135fe27e5ba), +W64LIT(0xffca074b1d3f538e), +W64LIT(0x0e3cb65d24cdfc1b), +W64LIT(0x4384b2e07fe9885d), +W64LIT(0xc73ac0ca8de149e2), +W64LIT(0x48e5bc7645972eb4), +W64LIT(0xbe0d56b46ef9ffd6), +W64LIT(0x200e6d05c0ef5f50), +W64LIT(0xe1f17dee597f7abd), +W64LIT(0x0243e31f0c2f2405), +W64LIT(0xf4ab09dd2741f567), +W64LIT(0xe4acc52547cc204f), +W64LIT(0x348f92c3b83cc272), +W64LIT(0x53837e181f645d75), +W64LIT(0xd8da319acf4c7229), +W64LIT(0x81e3cae1ecbb9b4d), +W64LIT(0xd6e687c7eb818e32), +W64LIT(0x3dad7f4a8e6d409e), +W64LIT(0x28f70b79f053cf44), +W64LIT(0x493e3783437a3c4c), +W64LIT(0xb27203f6461b27c8), +W64LIT(0xd02357e6fff0e23d), +W64LIT(0xe8d390676f2ef851), +W64LIT(0x26cbbd24d49e335f), +W64LIT(0xee1640467b5f945e), +W64LIT(0x4aa65f6949b80ab1), +W64LIT(0xb56c58225487593f), +W64LIT(0x4ffbe7a2570b5043), +W64LIT(0x0aba85633c93b411), +W64LIT(0x78ec1d8be5f5a4cc), +W64LIT(0x501b16f215a66b88), +W64LIT(0x271036d1d27321a7), +W64LIT(0x7ff2465ff769da3b), +W64LIT(0x35541936bed1d08a), +W64LIT(0xb8c886957a8893d9), +W64LIT(0x2fe950ade2cfb1b3), +W64LIT(0xf90fd76a094e3f81), +W64LIT(0x2daab3b2eee095b6), +W64LIT(0x1abd499b5c1e6139), +W64LIT(0x0c7f554228e2d81e), +W64LIT(0x425f391579049aa5), +W64LIT(0xc3bcf3f495bf01e8), +W64LIT(0xb4b7d3d7526a4bc7), +W64LIT(0x0000000000000000), +W64LIT(0xa0362c112ab9d6e5), +W64LIT(0x91e406198c364e65), +W64LIT(0x454162c16b98e452), +W64LIT(0x139fa4126a4fe3d5), +W64LIT(0x01db8bf506ed12f8), +W64LIT(0x9a85088fb648e88c), +W64LIT(0x3ab3249e9cf13e69), +W64LIT(0xd57eef2de143b8cf), +W64LIT(0xb1ea6b1c4cd91135), +W64LIT(0x7aaffe94e9da80c9), +W64LIT(0xad92f2a604b61c03), +W64LIT(0xa3ae44fb207be018), +W64LIT(0xeb4bf88d65ecceac), +W64LIT(0xc0249b1e9f7d3715), +W64LIT(0xa8cf4a6d1a0546f1), +W64LIT(0xc6e14b3f8b0c5b1a), +W64LIT(0xce182d43bbb0cb0e), +W64LIT(0xfc526fa117fd6573), +W64LIT(0x8c471456c2b451ab), +W64LIT(0xac497953025b0efb), +W64LIT(0x0486333e185e480a), +W64LIT(0x18feaa845031453c), +W64LIT(0xa1eda7e42c54c41d), +W64LIT(0x06c5d02114716c0f), +W64LIT(0x055db8cb1eb35af2), +W64LIT(0xe5774ed0412132b7), +W64LIT(0x36cc71dcb413e677), +W64LIT(0x470281de67b7c057), +W64LIT(0x58e2708e251afb9c), +W64LIT(0xa914c1981ce85409), +W64LIT(0xb3a9880340f63530), +W64LIT(0x638adfe5bf06d70d), +W64LIT(0x0b610e963a7ea6e9), +W64LIT(0x927c6ef386f47898), +W64LIT(0xed8e28ac719da2a3), +W64LIT(0x7548c33ccbfa6e2a), +W64LIT(0xf3b5520935dd8b90), +W64LIT(0x8d9c9fa3c4594353), +W64LIT(0x31d22a08a68f9880), +W64LIT(0x0da4deb72e0fcae6), +W64LIT(0x8fdf7cbcc8766756), +W64LIT(0x5dbfc8453ba9a16e), +W64LIT(0x8e04f749ce9b75ae), +W64LIT(0x83a029fee094bf48), +W64LIT(0xa4b01f2f32e79eef), +W64LIT(0x1c7899ba486f0d36), +W64LIT(0x654f0fc4ab77bb02), +W64LIT(0x7db1a540fb46fe3e), +W64LIT(0x51c09d07134b7970), +W64LIT(0xcb459588a50391fc), +W64LIT(0x3fee9c558242649b), +W64LIT(0xfe118cbe1bd24176), +W64LIT(0x76d0abd6c13858d7), +W64LIT(0x5e27a0af316b9793), +W64LIT(0x69305a868395631c), +W64LIT(0x3b68af6b9a1c2c91), +W64LIT(0x6db669b89bcb2b16), +W64LIT(0xa72877c53825a812), +W64LIT(0xd3bb3f0cf532d4c0), +W64LIT(0x6ff58aa797e40f13), +W64LIT(0x96fa5dcd9eaa3092), +W64LIT(0x2c713847e80d874e), +W64LIT(0xc57923d581ce6de7), +W64LIT(0x2b6f6393fa91f9b9), +W64LIT(0x0922ed89365182ec), +W64LIT(0x324a42e2ac4dae7d), +W64LIT(0x16c21cd974fcb927), +W64LIT(0x956235279468066f), +W64LIT(0x7b747561ef379231), +W64LIT(0x449ae9346d75f6aa), +W64LIT(0xf570822821ace79f), +W64LIT(0x5939fb7b23f7e964), +W64LIT(0x7937967ee318b634), +W64LIT(0x84be722af208c1bf), +W64LIT(0x08f9667c30bc9014), +W64LIT(0xefcdcbb37db286a6), +W64LIT(0xa6f3fc303ec8baea), +W64LIT(0xea9073786301dc54), +W64LIT(0x62515410b9ebc5f5), +W64LIT(0xd260b4f9f3dfc638), +W64LIT(0x9e033bb1ae16a086), +W64LIT(0x38f0c78190de1a6c), +W64LIT(0xc267780193521310), +W64LIT(0x80384114ea5689b5), +W64LIT(0x9b5e837ab0a5fa74), +W64LIT(0xf73361372d83c39a), +W64LIT(0x3009a1fda0628a78), +W64LIT(0xd4a564d8e7aeaa37), +W64LIT(0xfb4c347505611b84), +W64LIT(0x5b7a18642fd8cd61), +W64LIT(0x239605efca2d69ad), +W64LIT(0xf8d45c9f0fa32d79), +W64LIT(0xbb50ee7f704aa524), +W64LIT(0x392b4c7496330894), +W64LIT(0x0fe73da82220eee3), +W64LIT(0x3717fa29b2fef48f), +W64LIT(0xf26ed9fc33309968), +W64LIT(0xd73d0c32ed6c9cca), +W64LIT(0xda99d285c363562c), +W64LIT(0xde1fe1bbdb3d1e26), +W64LIT(0x738d131ddf8b0225), +W64LIT(0x292c808cf6beddbc), +W64LIT(0xbc4eb5ab62d6dbd3), +W64LIT(0x039868ea0ac236fd), +W64LIT(0xcc5bce5cb79fef0b), +W64LIT(0xb031e0e94a3403cd), +W64LIT(0xc4a2a82087237f1f), +W64LIT(0xb72fbb3d58a87d3a), +W64LIT(0xafd111b908993806), +W64LIT(0x68ebd173857871e4), +W64LIT(0x9d9b535ba4d4967b), +W64LIT(0xe9081b9269c3eaa9), +W64LIT(0x71cef002d3a42620), +W64LIT(0x93a7e50680196a60), +W64LIT(0x891aac9ddc070b59), +W64LIT(0x155a74337e3e8fda), +W64LIT(0x4e206c5751e642bb), +W64LIT(0x9721d6389847226a), +W64LIT(0x12442fe76ca2f12d), +W64LIT(0x2553d5cede5c05a2), +W64LIT(0xa275cf0e2696f2e0), +W64LIT(0x24885e3bd8b1175a), +W64LIT(0x670cecdba7589f07), +W64LIT(0x749348c9cd177cd2), +W64LIT(0x64948431ad9aa9fa), +W64LIT(0x2ab4e866fc7ceb41), +W64LIT(0xe6ef263a4be3044a), +W64LIT(0xe734adcf4d0e16b2), +W64LIT(0x903f8dec8adb5c9d), +W64LIT(0xf02d3ae33f1fbd6d), +W64LIT(0x725698e8d96610dd), +W64LIT(0x1da3124f4e821fce), +W64LIT(0x1719972c7211abdf), +W64LIT(0x11dc470d6660c7d0), +W64LIT(0xec55a3597770b05b), +W64LIT(0xbfd6dd416814ed2e), +W64LIT(0x57054d26073a157f), +W64LIT(0x1e3b7aa544402933), +W64LIT(0x5ffc2b5a3786856b), +W64LIT(0x61c93cfab329f308), +W64LIT(0x3e3517a084af7663), +W64LIT(0xf6e8eac22b6ed162), +W64LIT(0x1007ccf8608dd528), +W64LIT(0x66d7672ea1b58dff), +W64LIT(0x8b594f82d0282f5c), +W64LIT(0x1fe0f15042ad3bcb), +W64LIT(0x4b7dd49c4f551849), +W64LIT(0x4c638f485dc966be), +W64LIT(0xcfc3a6b6bd5dd9f6), +W64LIT(0x46d90a2b615ad2af), +W64LIT(0x8565f9dff4e5d347), +W64LIT(0x94b9bed292851497), +W64LIT(0xfa97bf80038c097c), +W64LIT(0xb9130d607c658121), +W64LIT(0xdc5c02a4d7123a23), +W64LIT(0x224d8e1accc07b55), +W64LIT(0x87261ac0f8caf742), +W64LIT(0xd901ba6fc9a160d1), +W64LIT(0xab57228710c7700c), +W64LIT(0x21d5e6f0c6024da8), +W64LIT(0x98c6eb90ba67cc89), +W64LIT(0x827ba20be679adb0), +W64LIT(0x991d6065bc8ade71), +W64LIT(0x5546ae390b15317a), +W64LIT(0xa56b94da340a8c17), +W64LIT(0x071e5bd4129c7ef7), +W64LIT(0xe02af61b5f926845), +W64LIT(0x6b73b9998fba4719), +W64LIT(0xdfc46a4eddd00cde), +W64LIT(0x770b2023c7d54a2f), +W64LIT(0x7e29cdaaf184c8c3), +W64LIT(0xba8b658a76a7b7dc), +W64LIT(0x9c40d8aea2398483), +W64LIT(0x9fd8b044a8fbb27e), +W64LIT(0xdb425970c58e44d4), +W64LIT(0xe269150453bd4c40), +W64LIT(0x3c76f4bf88805266), +W64LIT(0xf1f6b11639f2af95), +W64LIT(0x549d25cc0df82382), +W64LIT(0x4db804bd5b247446), +W64LIT(0x8a82c477d6c53da4), +W64LIT(0x5258f5ed19894f8d), +W64LIT(0x6e2e015291091deb), +W64LIT(0xc1ff10eb999025ed), +W64LIT(0xbd953e5e643bc92b), +W64LIT(0xc8ddfd62afc1a701), +W64LIT(0x5c6443b03d44b396), +W64LIT(0x6c6de24d9d2639ee), +W64LIT(0x1481ffc678d39d22), +W64LIT(0xd1f8dc13f91df0c5), +W64LIT(0xca9e1e7da3ee8304), +W64LIT(0xdd878951d1ff28db), +W64LIT(0x6012b70fb5c4e1f0), +W64LIT(0x1b66c26e5af373c1), +W64LIT(0xe3b29ef155505eb8), +W64LIT(0x70157bf7d54934d8), +W64LIT(0x2e32db58e422a34b), +W64LIT(0x6aa8326c895755e1), +W64LIT(0xb6f430c85e456fc2), +W64LIT(0xfd89e4541110778b), +W64LIT(0x88c12768daea19a1), +W64LIT(0xcd8045a9b172fdf3), +/* box 3 */ +W64LIT(0x99183e616655b742), +W64LIT(0xb2872032a50d6860), +W64LIT(0x0946f63b060528ef), +W64LIT(0x36612b9a141ef07d), +W64LIT(0x0634da84dd49579b), +W64LIT(0xfc9c9e9b486c8a57), +W64LIT(0xa63fe3c0744e6fd0), +W64LIT(0xf1515758d8b46bf9), +W64LIT(0x3e82559fcd5197ff), +W64LIT(0x92e12d262bc40177), +W64LIT(0xc3bb433a5a7752c5), +W64LIT(0x21c3852a5183267a), +W64LIT(0x39130725cf528f09), +W64LIT(0x9ba7db1d2dc12998), +W64LIT(0xc58f99be873e055e), +W64LIT(0xd9d424498f32656c), +W64LIT(0x27f75fae8cca71e1), +W64LIT(0x59b91019a8fc3430), +W64LIT(0xce768af9caafb36b), +W64LIT(0x9d930199f0887e03), +W64LIT(0x63b07a7ef3706a8e), +W64LIT(0xb5167288a70e7096), +W64LIT(0x40cc1a28e967d22e), +W64LIT(0x4d01d3eb79bf3380), +W64LIT(0x9e896cdb6456afb4), +W64LIT(0x2548bad2c75eef3b), +W64LIT(0xa79a6bfeab0420bd), +W64LIT(0x9f2ce4e5bb1ce0d9), +W64LIT(0x32ea146282c3393c), +W64LIT(0x6d67defff7765a97), +W64LIT(0x83775912b31080eb), +W64LIT(0xf5da68a04e69a2b8), +W64LIT(0x1196743498d4819c), +W64LIT(0x0bf913474d91b635), +W64LIT(0x43d6776a7db90399), +W64LIT(0x444725d07fba1b6f), +W64LIT(0x6584a0fa2e393d15), +W64LIT(0x3f27dda1121bd892), +W64LIT(0xf6c005e2dab7730f), +W64LIT(0x56cb3ca673b04b44), +W64LIT(0x642128c4f1737278), +W64LIT(0xbf4ae9f135d589ce), +W64LIT(0xb038c54eee99f6ba), +W64LIT(0xf47fe09e9123edd5), +W64LIT(0x75b75cf069a7f3e4), +W64LIT(0xd419ed8a1fea84c2), +W64LIT(0x73838674b4eea47f), +W64LIT(0x498aec13ef62fac1), +W64LIT(0x20660d148ec96917), +W64LIT(0xa48006bc3fdaf10a), +W64LIT(0x2f1421ab55851663), +W64LIT(0x0a5c9b7992dbf958), +W64LIT(0xd1375a4c567d02ee), +W64LIT(0x0000000000000000), +W64LIT(0xc842507d17e6e4f0), +W64LIT(0xf3eeb2249320f523), +W64LIT(0xc9e7d843c8acab9d), +W64LIT(0xff86f3d9dcb25be0), +W64LIT(0xb4b3fab678443ffb), +W64LIT(0xb19d4d7031d3b9d7), +W64LIT(0x79df1d0d26355d27), +W64LIT(0x8eba90d123c86145), +W64LIT(0xaa57a23d3bdcc113), +W64LIT(0xcb583d3f83383547), +W64LIT(0xd871ac7750782a01), +W64LIT(0xe162ab529f2aa508), +W64LIT(0x38b68f1b1018c064), +W64LIT(0x237c60561a17b8a0), +W64LIT(0xa31154063dd9e9fc), +W64LIT(0x713c6308ff7a3aa5), +W64LIT(0x1a6f6773d54537a9), +W64LIT(0x08e37e05d94f6782), +W64LIT(0x357b46d880c021ca), +W64LIT(0x6cc256c1283c15fa), +W64LIT(0xcfd302c715e5fc06), +W64LIT(0xbdf50c8d7e411714), +W64LIT(0x7cf1aacb6fa2db0b), +W64LIT(0x5240035ee56d8205), +W64LIT(0x7b60f8716da1c3fd), +W64LIT(0x01a5883edf4a4f6d), +W64LIT(0xdd5f1bb119efac2d), +W64LIT(0x5474d9da3824d59e), +W64LIT(0x0f722cbfdb4c7f74), +W64LIT(0x17a2aeb0459dd607), +W64LIT(0x37c4a3a4cb54bf10), +W64LIT(0xc21ecb04853d1da8), +W64LIT(0x4273ff54a2f34cf4), +W64LIT(0xdace490b1becb4db), +W64LIT(0x6af68c45f5754261), +W64LIT(0x46f8c0ac342e85b5), +W64LIT(0x854383966e59d770), +W64LIT(0x81c8bc6ef8841e31), +W64LIT(0x3bace25984c611d3), +W64LIT(0x1033fc0a479ecef1), +W64LIT(0x1c5bbdf7080c6032), +W64LIT(0x7412d4ceb6edbc89), +W64LIT(0xa8e8474170485fc9), +W64LIT(0xb8dbbb4b37d69138), +W64LIT(0x079152ba020318f6), +W64LIT(0x72260e4a6ba4eb12), +W64LIT(0x905ec85a60509fad), +W64LIT(0x2dabc4d71e1188b9), +W64LIT(0xd092d27289374d83), +W64LIT(0x610f9f02b8e4f454), +W64LIT(0x02bfe57c4b949eda), +W64LIT(0x95707f9c29c71981), +W64LIT(0x6fd83b83bce2c44d), +W64LIT(0x5d322fe13e21fd71), +W64LIT(0x34decee65f8a6ea7), +W64LIT(0xcd6ce7bb5e7162dc), +W64LIT(0xfb0dcc214a6f92a1), +W64LIT(0x2eb1a9958acf590e), +W64LIT(0xdcfa938fc6a5e340), +W64LIT(0x669ecdb8bae7eca2), +W64LIT(0x151d4bcc0e0948dd), +W64LIT(0xfd3916a59726c53a), +W64LIT(0x581c982777b67b5d), +W64LIT(0x1bcaef4d0a0f78c4), +W64LIT(0xdfe0fecd527b32f7), +W64LIT(0x128c19760c0a502b), +W64LIT(0x84e60ba8b113981d), +W64LIT(0x3c3db0e386c50925), +W64LIT(0x7febc789fb7c0abc), +W64LIT(0x7d5422f5b0e89466), +W64LIT(0xd70380c88b345575), +W64LIT(0xbbc1d609a308408f), +W64LIT(0xe278c6100bf474bf), +W64LIT(0x5e2842a3aaff2cc6), +W64LIT(0x6b53047b2a3f0d0c), +W64LIT(0xf7658ddc05fd3c62), +W64LIT(0x9a025323f28b66f5), +W64LIT(0x8c0575ad685cff9f), +W64LIT(0x76ad31b2fd792253), +W64LIT(0x68496939bee1dcbb), +W64LIT(0x7e4e4fb7243645d1), +W64LIT(0xe44c1c94d6bd2324), +W64LIT(0xbeef61cfea9fc6a3), +W64LIT(0x91fb4064bf1ad0c0), +W64LIT(0x052eb7c64997862c), +W64LIT(0x4a9081517bbc2b76), +W64LIT(0x8f1f18effc822e28), +W64LIT(0x3a096a675b8c5ebe), +W64LIT(0xee1087ed4466da7c), +W64LIT(0x2652d79053803e8c), +W64LIT(0x7099eb36203075c8), +W64LIT(0xc7307cc2ccaa9b84), +W64LIT(0x5c97a7dfe16bb21c), +W64LIT(0x50ffe622aef91cdf), +W64LIT(0x8da0fd93b716b0f2), +W64LIT(0x69ece10761ab93d6), +W64LIT(0x31f07920161de88b), +W64LIT(0x13299148d3401f46), +W64LIT(0x031a6d4294ded1b7), +W64LIT(0xccc96f85813b2db1), +W64LIT(0x14b8c3f2d14307b0), +W64LIT(0x8659eed4fa8706c7), +W64LIT(0xba645e377c420fe2), +W64LIT(0x2920fb2f88cc41f8), +W64LIT(0x87fc66ea25cd49aa), +W64LIT(0x1ee4588b4398fee8), +W64LIT(0xecaf62910ff244a6), +W64LIT(0xf817a163deb14316), +W64LIT(0x45e2adeea0f05402), +W64LIT(0x806d345027ce515c), +W64LIT(0x576eb498acfa0429), +W64LIT(0xa5258e82e090be67), +W64LIT(0x892bc26b21cb79b3), +W64LIT(0x6e7db3bd63a88b20), +W64LIT(0x4e1bbea9ed61e237), +W64LIT(0xadc6f08739dfd9e5), +W64LIT(0x8b9427176a5fe769), +W64LIT(0xa1aeb17a764d7726), +W64LIT(0x4b35096fa4f6641b), +W64LIT(0x22d9e868c55df7cd), +W64LIT(0x55d151e4e76e9af3), +W64LIT(0x966a12debd19c836), +W64LIT(0x0dcdc9c390d8e1ae), +W64LIT(0xf24b3a1a4c6aba4e), +W64LIT(0x24ed32ec1814a056), +W64LIT(0xaf7915fb724b473f), +W64LIT(0x2885731157860e95), +W64LIT(0x9c3689a72fc2316e), +W64LIT(0x475d4892eb64cad8), +W64LIT(0xac6378b9e6959688), +W64LIT(0xa00b3944a907384b), +W64LIT(0xc695f4fc13e0d4e9), +W64LIT(0x3055f11ec957a7e6), +W64LIT(0x6215f2402c3a25e3), +W64LIT(0xde4576f38d317d9a), +W64LIT(0x9344a518f48e4e1a), +W64LIT(0x82d2d12c6c5acf86), +W64LIT(0xefb50fd39b2c9511), +W64LIT(0xe981d5574665c28a), +W64LIT(0x5f8dca9d75b563ab), +W64LIT(0xb60c1fca33d0a121), +W64LIT(0xfe237be703f8148d), +W64LIT(0xd6a608f6547e1a18), +W64LIT(0xb97e3375e89cde55), +W64LIT(0xd388bf301de99c34), +W64LIT(0x5b06f565e368aaea), +W64LIT(0xf0f4df6607fe2494), +W64LIT(0x1607268e9ad7996a), +W64LIT(0xaedc9dc5ad010852), +W64LIT(0xe0c7236c4060ea65), +W64LIT(0xea9bb815d2bb133d), +W64LIT(0x888e4a55fe8136de), +W64LIT(0x5aa37d5b3c22e587), +W64LIT(0xc104a64611e3cc1f), +W64LIT(0x515a6e1c71b353b2), +W64LIT(0xc42a118058744a33), +W64LIT(0x7708b98c22336d3e), +W64LIT(0x2a3a966d1c12904f), +W64LIT(0x8a31af29b515a804), +W64LIT(0xed0aeaafd0b80bcb), +W64LIT(0x2c0e4ce9c15bc7d4), +W64LIT(0x0c6841fd4f92aec3), +W64LIT(0x98bdb65fb91ff82f), +W64LIT(0x1f41d0b59cd2b185), +W64LIT(0xb322a80c7a47270d), +W64LIT(0xe6f3f9e89d29bdfe), +W64LIT(0x7ac5704fb2eb8c90), +W64LIT(0xa94dcf7faf0210a4), +W64LIT(0x787a9533f97f124a), +W64LIT(0xdb6bc135c4a6fbb6), +W64LIT(0x048b3ff896ddc941), +W64LIT(0xe8245d69992f8de7), +W64LIT(0xe3dd4e2ed4be3bd2), +W64LIT(0xcafdb5015c727a2a), +W64LIT(0xb7a997f4ec9aee4c), +W64LIT(0xe75671d64263f293), +W64LIT(0x2b9f1e53c358df22), +W64LIT(0x18d0820f9ed1a973), +W64LIT(0xabf22a03e4968e7e), +W64LIT(0xa2b4dc38e293a691), +W64LIT(0x673b458665ada3cf), +W64LIT(0xf9b2295d01fb0c7b), +W64LIT(0xd22d370ec2a3d359), +W64LIT(0x97cf9ae06253875b), +W64LIT(0x0ed7a48104063019), +W64LIT(0x482f642d3028b5ac), +W64LIT(0xc0a12e78cea98372), +W64LIT(0x4fbe3697322bad5a), +W64LIT(0x19750a31419be61e), +W64LIT(0x41699216362d9d43), +W64LIT(0xd5bc65b4c0a0cbaf), +W64LIT(0xe5e994aa09f76c49), +W64LIT(0xeb3e302b0df15c50), +W64LIT(0x94d5f7a2f68d56ec), +W64LIT(0x53e58b603a27cd68), +W64LIT(0x3d9838dd598f4648), +W64LIT(0x60aa173c67aebb39), +W64LIT(0x1dfe35c9d7462f5f), +W64LIT(0x4ca45bd5a6f57ced), +W64LIT(0xbc5084b3a10b5879), +W64LIT(0xfaa8441f9525ddcc), +W64LIT(0x334f9c5c5d897651), +/* box 4 */ +W64LIT(0xda1687a883adf27e), +W64LIT(0xe35c9378578d9f22), +W64LIT(0x303ca4531637fa40), +W64LIT(0xa088321f74b20375), +W64LIT(0xc9863f3a9acb95e9), +W64LIT(0x5fcf47c57d0b0ed4), +W64LIT(0x4aa211e4e1280b4b), +W64LIT(0xe1a4c9ba871d1289), +W64LIT(0x4926664759f03a4f), +W64LIT(0xadfb36ede3707bca), +W64LIT(0xcf7bd1891f8ef7e1), +W64LIT(0x9735559e8f882792), +W64LIT(0x5932a976f84e6cdc), +W64LIT(0x9dc792bef547818a), +W64LIT(0x06fdeeb385456208), +W64LIT(0x46ad38771ea2cf5b), +W64LIT(0x5eb36aa41543b27b), +W64LIT(0x8b2eb33cd1bcb511), +W64LIT(0x71105ff6e598ebbc), +W64LIT(0x5441ad846f8c1463), +W64LIT(0x4c5fff57646d6943), +W64LIT(0xf3485c49f633c9b1), +W64LIT(0x9cbbbfdf9d0f3d25), +W64LIT(0x22d031a067192178), +W64LIT(0xca0248992213a4ed), +W64LIT(0x19627fb263a9c18f), +W64LIT(0x9330e1efda5dc831), +W64LIT(0x1390b89219666797), +W64LIT(0x2edf18339893e568), +W64LIT(0x6c779435d3e4c590), +W64LIT(0x53c06e568281cac4), +W64LIT(0x6ff3e3966b3cf494), +W64LIT(0xfe3b58bb61f1b10e), +W64LIT(0x77edb14560dd89b4), +W64LIT(0x02f85ac2d0908dab), +W64LIT(0x12ec95f3712edb38), +W64LIT(0x85d9c06dfea6fcaa), +W64LIT(0x90b4964c6285f935), +W64LIT(0xf1b0068b26a3441a), +W64LIT(0x729428555d40dab8), +W64LIT(0x5c4b3066c5d33fd0), +W64LIT(0x5d371d07ad9b837f), +W64LIT(0xa48d866e2167ecd6), +W64LIT(0xb661139d504937ee), +W64LIT(0xa27068dda4228ede), +W64LIT(0xf8c6b608e4b4d306), +W64LIT(0x6bf657e73ee91b37), +W64LIT(0xac871b8c8b38c765), +W64LIT(0x4ea7a595b4fde4e8), +W64LIT(0x0d7304f297c278bf), +W64LIT(0xb71d3efc38018b41), +W64LIT(0xae7f414e5ba84ace), +W64LIT(0xaf036c2f33e0f661), +W64LIT(0x0000000000000000), +W64LIT(0xb89660cc7f537e55), +W64LIT(0xa675dcacf1f7617d), +W64LIT(0x610490c74426bd2f), +W64LIT(0xc18ca2d83094be5a), +W64LIT(0x2adaac42cd460acb), +W64LIT(0x7d1f76651a122fac), +W64LIT(0xc58916a9654151f9), +W64LIT(0xedabe0297897d699), +W64LIT(0x2d5b6f90204bd46c), +W64LIT(0x26d585d132cccedb), +W64LIT(0x9f3fc87c25d70c21), +W64LIT(0xc60d610add9960fd), +W64LIT(0x80a0597dc33bafa6), +W64LIT(0xd0e44088f9625466), +W64LIT(0x1d67cbc3367c2e2c), +W64LIT(0x2c2742f1480368c3), +W64LIT(0x89d6e9fe012c38ba), +W64LIT(0xe9ae54582d42393a), +W64LIT(0x3ecbd702392db3fb), +W64LIT(0xb5e5643ee89106ea), +W64LIT(0xa882affddeed28c6), +W64LIT(0x1ae60811db71f08b), +W64LIT(0x924ccc8eb215749e), +W64LIT(0xfcc30279b1613ca5), +W64LIT(0x825803bf13ab220d), +W64LIT(0xd992f00b3b75c37a), +W64LIT(0xc8fa125bf2832946), +W64LIT(0x35453d432baaa94c), +W64LIT(0xf9ba9b698cfc6fa9), +W64LIT(0x37bd6781fb3a24e7), +W64LIT(0x791ac2144fc7c00f), +W64LIT(0x16e9218224fb349b), +W64LIT(0xdb6aaac9ebe54ed1), +W64LIT(0xd8eedd6a533d7fd5), +W64LIT(0x7c635b04725a9303), +W64LIT(0x553d80e507c4a8cc), +W64LIT(0x9a46516c184a5f2d), +W64LIT(0x14117b40f46bb930), +W64LIT(0x1ee3bc608ea41f28), +W64LIT(0x27a9a8b05a847274), +W64LIT(0x4050d6c49be7ad53), +W64LIT(0x7be298d69f574da4), +W64LIT(0x6a8a7a8656a1a798), +W64LIT(0x4d23d2360c25d5ec), +W64LIT(0x1014cf31a1be5693), +W64LIT(0xb264a7ec059cd84d), +W64LIT(0xea2a23fb959a083e), +W64LIT(0xf0cc2bea4eebf8b5), +W64LIT(0x76919c240895351b), +W64LIT(0x0b8eea4112871ab7), +W64LIT(0x47d1151676ea73f4), +W64LIT(0xbdeff9dc42ce2d59), +W64LIT(0x2ba68123a50eb664), +W64LIT(0x057999103d9d530c), +W64LIT(0xe759270902587081), +W64LIT(0xef53baeba8075b32), +W64LIT(0x4fdb88f4dcb55847), +W64LIT(0x6e8fcef70374483b), +W64LIT(0x1168e250c9f6ea3c), +W64LIT(0x1b9a2570b3394c24), +W64LIT(0x706c72978dd05713), +W64LIT(0x865db7ce467ecdae), +W64LIT(0x52bc4337eac9766b), +W64LIT(0x504419f53a59fbc0), +W64LIT(0x8f2b074d84695ab2), +W64LIT(0x6078bda62c6e0180), +W64LIT(0x43d4a167233f9c57), +W64LIT(0x0ef773512f1a49bb), +W64LIT(0x0c0f2993ff8ac410), +W64LIT(0x4bde3c858960b7e4), +W64LIT(0x66855315a92b6388), +W64LIT(0xd360372b41ba6562), +W64LIT(0x584e84179006d073), +W64LIT(0x9b3a7c0d7002e382), +W64LIT(0xa5f1ab0f492f5079), +W64LIT(0x2822f6801dd68760), +W64LIT(0x445562b5ce3242f0), +W64LIT(0xaa7af53f0e7da56d), +W64LIT(0x3c338dc0e9bd3e50), +W64LIT(0x3bb24e1204b0e0f7), +W64LIT(0xd59dd998c4ff076a), +W64LIT(0x91c8bb2d0acd459a), +W64LIT(0x84a5ed0c96ee4005), +W64LIT(0x33b8d3f0aeefcb44), +W64LIT(0x57c5da27d7542567), +W64LIT(0x32c4fe91c6a777eb), +W64LIT(0x3439102243e215e3), +W64LIT(0xc7714c6bb5d1dc52), +W64LIT(0x3fb7fa6351650f54), +W64LIT(0x87219aaf2e367101), +W64LIT(0xf5b5b2fa7376abb9), +W64LIT(0x412cfba5f3af11fc), +W64LIT(0xdceb691b06e89076), +W64LIT(0xbb12176fc78b4f51), +W64LIT(0x73e8053435086617), +W64LIT(0xe220be193fc5238d), +W64LIT(0xb09cfd2ed50c55e6), +W64LIT(0xb9ea4dad171bc2fa), +W64LIT(0x9e43e51d4d9fb08e), +W64LIT(0x36c14ae093729848), +W64LIT(0xa9fe829cb6a59469), +W64LIT(0x0405b47155d5efa3), +W64LIT(0x0af2c7207acfa618), +W64LIT(0x7e9b01c6a2ca1ea8), +W64LIT(0xdd97447a6ea02cd9), +W64LIT(0x0781c3d2ed0ddea7), +W64LIT(0x7866ef75278f7ca0), +W64LIT(0xd1986de9912ae8c9), +W64LIT(0xcb7e65f84a5b1842), +W64LIT(0xcd838b4bcf1e7a4a), +W64LIT(0xab06d85e663519c2), +W64LIT(0xd4e1f4f9acb7bbc5), +W64LIT(0xfdbf2f18d929800a), +W64LIT(0xf23471289e7b751e), +W64LIT(0xbc93d4bd2a8691f6), +W64LIT(0x3d4fa0a181f582ff), +W64LIT(0xba6e3a0eafc3f3fe), +W64LIT(0x5ab6ded540965dd8), +W64LIT(0xeb560e9afdd2b491), +W64LIT(0x0976b083c217971c), +W64LIT(0xecd7cd4810df6a36), +W64LIT(0x23ac1cc10f519dd7), +W64LIT(0xbe6b8e7ffa161c5d), +W64LIT(0x7fe72ca7ca82a207), +W64LIT(0xc0f08fb958dc02f5), +W64LIT(0x7a9eb5b7f71ff10b), +W64LIT(0xa709f1cd99bfddd2), +W64LIT(0x8dd35d8f54f9d719), +W64LIT(0x8caf70ee3cb16bb6), +W64LIT(0xe4dd50aaba804185), +W64LIT(0x83242ede7be39ea2), +W64LIT(0x98be0baec8dad286), +W64LIT(0x690e0d25ee79969c), +W64LIT(0x95cd0f5c5f18aa39), +W64LIT(0x56b9f746bf1c99c8), +W64LIT(0x7469c6e6d805b8b0), +W64LIT(0x8a529e5db9f409be), +W64LIT(0xe6250a686a10cc2e), +W64LIT(0x2fa33552f0db59c7), +W64LIT(0x42a88c064b7720f8), +W64LIT(0x6d0bb954bbac793f), +W64LIT(0x181e52d30be17d20), +W64LIT(0xbf17a31e925ea0f2), +W64LIT(0x94b1223d37501696), +W64LIT(0xe8d27939450a8595), +W64LIT(0xccffa62aa756c6e5), +W64LIT(0x383639b1bc68d1f3), +W64LIT(0xee2f978ac04fe79d), +W64LIT(0xa30c45bccc6a3271), +W64LIT(0x1f9f9101e6eca387), +W64LIT(0xb1e0d04fbd44e949), +W64LIT(0x242ddf13e25c4370), +W64LIT(0x156d56219c23059f), +W64LIT(0x88aac49f69648415), +W64LIT(0x6280e764fcfe8c2b), +W64LIT(0xdf6f1eb8be30a172), +W64LIT(0xe5a17dcbd2c8fd2a), +W64LIT(0xe0d8e4dbef55ae26), +W64LIT(0x63fcca0594b63084), +W64LIT(0xa1f41f7e1cfabfda), +W64LIT(0x295edbe1759e3bcf), +W64LIT(0x67f97e74c163df27), +W64LIT(0x038477a3b8d83104), +W64LIT(0xde1333d9d6781ddd), +W64LIT(0x3ace63736cf85c58), +W64LIT(0xd619ae3b7c27366e), +W64LIT(0x5bcaf3b428dee177), +W64LIT(0xb3188a8d6dd464e2), +W64LIT(0x1c1be6a25e349283), +W64LIT(0x017c2d616848bcaf), +W64LIT(0x8e572a2cec21e61d), +W64LIT(0xf631c559cbae9abd), +W64LIT(0x81dc741cab731309), +W64LIT(0xff4775da09b90da1), +W64LIT(0xb499495f80d9ba45), +W64LIT(0x0f8b5e304752f514), +W64LIT(0x394a14d0d4206d5c), +W64LIT(0xce07fce877c64b4e), +W64LIT(0xf4c99f9b1b3e1716), +W64LIT(0xc4f53bc80d09ed56), +W64LIT(0xc208d57b884c8f5e), +W64LIT(0x080a9de2aa5f2bb3), +W64LIT(0x314089327e7f46ef), +W64LIT(0xfa3eecca34245ead), +W64LIT(0x20286b62b789acd3), +W64LIT(0x7515eb87b04d041f), +W64LIT(0x513834945211476f), +W64LIT(0x650124b611f3528c), +W64LIT(0x17950ce34cb38834), +W64LIT(0x45294fd4a67afe5f), +W64LIT(0x21544603dfc1107c), +W64LIT(0x485a4b2631b886e0), +W64LIT(0x6872204486312a33), +W64LIT(0x647d09d779bbee23), +W64LIT(0x2551f2728a14ffdf), +W64LIT(0xd765835a146f8ac1), +W64LIT(0xd21c1a4a29f2d9cd), +W64LIT(0x99c226cfa0926e29), +W64LIT(0xfb42c1ab5c6ce202), +W64LIT(0xc374f81ae00433f1), +W64LIT(0x964978ffe7c09b3d), +W64LIT(0xf74de838a3e62612), +/* box 5 */ +W64LIT(0x74b87b36b0592c6a), +W64LIT(0x3d82d75dffb4b81c), +W64LIT(0x8884246715267825), +W64LIT(0xdaf2d8a77ed4e5de), +W64LIT(0xfeb118650e53f9c7), +W64LIT(0xbd2d1aea59226b06), +W64LIT(0x26ce87f6dbabb191), +W64LIT(0x32772ecbeb66bd0a), +W64LIT(0xd4bbf82bc5104c8c), +W64LIT(0x055357720c4e03a1), +W64LIT(0xef5be62a32d0f6fd), +W64LIT(0xbe1c84c45d186aca), +W64LIT(0xacc7e4a565a1643c), +W64LIT(0x8dd7731519687b84), +W64LIT(0x11eafe4f3c830f3a), +W64LIT(0x04ef8e68a358afe5), +W64LIT(0x40ad9ca1534b930d), +W64LIT(0xe44191d4855a5c0e), +W64LIT(0x6001d20b809420f1), +W64LIT(0x73666b70173b8243), +W64LIT(0x372479b9e728beab), +W64LIT(0x45fecbd35f0590ac), +W64LIT(0x7057f55e1301838f), +W64LIT(0xff0dc17fa1455583), +W64LIT(0x0cc467b810e804da), +W64LIT(0xb9c29482fa7ac4e3), +W64LIT(0xa003831d754960e6), +W64LIT(0x8a096353be0ad5ad), +W64LIT(0xdd2cc8e1d9b64bf7), +W64LIT(0xc7dc415052bfee3e), +W64LIT(0x9f0c137421d17572), +W64LIT(0x35a93e8d4c041323), +W64LIT(0x9a5f44062d9f76d3), +W64LIT(0x71eb2c44bc172fcb), +W64LIT(0x0ff5f99614d20516), +W64LIT(0x7789e518b4632da6), +W64LIT(0xc99561dce97b476c), +W64LIT(0x5276fcc06bf29dfb), +W64LIT(0x4a0b32454bd795ba), +W64LIT(0x9274add69e2fddec), +W64LIT(0x4f5865374799961b), +W64LIT(0xb2d8e37c4df06e10), +W64LIT(0xc4eddf7e5685eff2), +W64LIT(0xb3643a66e2e6c254), +W64LIT(0xd50721316a06e0c8), +W64LIT(0x8bb5ba49111c79e9), +W64LIT(0x2bb639546455190f), +W64LIT(0xf8d3d1390627fbaa), +W64LIT(0x38d1802ff3fabbbd), +W64LIT(0xdfa18fd5729ae67f), +W64LIT(0x4ee4bc2de88f3a5f), +W64LIT(0xf72628af12f5febc), +W64LIT(0x0aa6aee4189c06b7), +W64LIT(0x0000000000000000), +W64LIT(0x9eb0ca6e8ec7d936), +W64LIT(0xcb1826e84257eae4), +W64LIT(0x187dce8520250841), +W64LIT(0xc28f16225ef1ed9f), +W64LIT(0xc333cf38f1e741db), +W64LIT(0x4220db95f8673e85), +W64LIT(0xdc9011fb76a0e7b3), +W64LIT(0x105627559395a37e), +W64LIT(0x2f59b73cc70db6ea), +W64LIT(0xe112c6a689145faf), +W64LIT(0x82228a830dba7e92), +W64LIT(0x2ee56e26681b1aae), +W64LIT(0x2a0ae04ecb43b54b), +W64LIT(0x47738ce7f4293d24), +W64LIT(0xa7dd935bd22bcecf), +W64LIT(0xd2d93177cd644ee1), +W64LIT(0xebb4684291885918), +W64LIT(0x0e49208cbbc4a952), +W64LIT(0xa550d46f79076347), +W64LIT(0x411145bbfc5d3f49), +W64LIT(0xe6ccd6e02e76f186), +W64LIT(0x4bb7eb5fe4c139fe), +W64LIT(0x5d8305567f2098ed), +W64LIT(0x95aabd90394d73c5), +W64LIT(0x25ff19d8df91b05d), +W64LIT(0x86cd04ebaee2d177), +W64LIT(0x03319e2e043a01cc), +W64LIT(0x6b1ba5f5371e8a02), +W64LIT(0x76353c021b7581e2), +W64LIT(0x64ee5c6323cc8f14), +W64LIT(0x5c3fdc4cd03634a9), +W64LIT(0x6996e2c19c32278a), +W64LIT(0x8938fd7dba30d461), +W64LIT(0x7b4d82a0a48b297c), +W64LIT(0xbfa05ddef20ec68e), +W64LIT(0x8ee6ed3b1d527a48), +W64LIT(0x61bd0b112f828cb5), +W64LIT(0x66631b5788e0229c), +W64LIT(0x55a8ec86cc9033d2), +W64LIT(0x1c9240ed837da7a4), +W64LIT(0x150570279fdba0df), +W64LIT(0x53ca25dac4e431bf), +W64LIT(0xd636bf1f6e3ce104), +W64LIT(0xcaa4fff2ed4146a0), +W64LIT(0x787c1c8ea0b128b0), +W64LIT(0xad7b3dbfcab7c878), +W64LIT(0xfc3c5f51a57f544f), +W64LIT(0xb78bb40e41be6db1), +W64LIT(0x8c6baa0fb67ed7c0), +W64LIT(0xce4b719a4e19e945), +W64LIT(0xf96f0823a93157ee), +W64LIT(0x7d2f4bfcacff2b11), +W64LIT(0x3eb34973fb8eb9d0), +W64LIT(0xe39f81922238f227), +W64LIT(0x239dd084d7e5b230), +W64LIT(0x1fa3dec38747a668), +W64LIT(0xc5510664f99343b6), +W64LIT(0xc829b8c6466deb28), +W64LIT(0x85fc9ac5aad8d0bb), +W64LIT(0xb6376d14eea8c1f5), +W64LIT(0x9d8154408afdd8fa), +W64LIT(0x3be01e01f7c0ba71), +W64LIT(0x628c953f2bb88d79), +W64LIT(0x6d796ca93f6a886f), +W64LIT(0xfa5e960dad0b5622), +W64LIT(0xe5fd48ce2a4cf04a), +W64LIT(0xe7700ffa81605dc2), +W64LIT(0x2dd4f0086c211b62), +W64LIT(0x2221099e78f31e74), +W64LIT(0xdb4e01bdd1c2499a), +W64LIT(0xf417b68116cfff70), +W64LIT(0xb506f33aea92c039), +W64LIT(0x514762ee6fc89c37), +W64LIT(0x9c3d8d5a25eb74be), +W64LIT(0x396d59355cec17f9), +W64LIT(0xccc636aee53544cd), +W64LIT(0x0b1a77feb78aaaf3), +W64LIT(0xe9392f763aa4f490), +W64LIT(0xaaa52df96dd56651), +W64LIT(0x46cf55fd5b3f9160), +W64LIT(0xa4ec0d75d611cf03), +W64LIT(0xaff67a8b619b65f0), +W64LIT(0x3415e797e312bf67), +W64LIT(0x7af15bba0b9d8538), +W64LIT(0x811314ad09807f5e), +W64LIT(0x8771ddf101f47d33), +W64LIT(0x969b23be3d777209), +W64LIT(0xd365e86d6272e2a5), +W64LIT(0x58d05224736e9b4c), +W64LIT(0xc660984afda9427a), +W64LIT(0x5414359c63869f96), +W64LIT(0xe885f66c95b258d4), +W64LIT(0x655285798cda2350), +W64LIT(0x6cc5b5b3907c242b), +W64LIT(0x6ff42b9d944625e7), +W64LIT(0xc0025116f5dd4017), +W64LIT(0xa28ec429de65cd6e), +W64LIT(0x63304c2584ae213d), +W64LIT(0x7fa20cc807d38699), +W64LIT(0x996eda2829a5771f), +W64LIT(0x1b4c50ab241f098d), +W64LIT(0x1e1f07d928510a2c), +W64LIT(0x33cbf7d14470114e), +W64LIT(0xb055a448e6dcc398), +W64LIT(0x98d2033286b3db5b), +W64LIT(0xec6a780436eaf731), +W64LIT(0xa1bf5a07da5fcca2), +W64LIT(0xbaf30aacfe40c52f), +W64LIT(0xf144e1f31a81fcd1), +W64LIT(0xe0ae1fbc2602f3eb), +W64LIT(0x14b9a93d30cd0c9b), +W64LIT(0x596c8b3edc783708), +W64LIT(0x682a3bdb33248bce), +W64LIT(0xb87e4d98556c68a7), +W64LIT(0x80afcdb7a696d31a), +W64LIT(0x5725abb267bc9e5a), +W64LIT(0x914533f89a15dc20), +W64LIT(0x5eb29b787b1a9921), +W64LIT(0x01bcd91aaf16ac44), +W64LIT(0xc1be880c5acbec53), +W64LIT(0xedd6a11e99fc5b75), +W64LIT(0x028d4734ab2cad88), +W64LIT(0x8f5a3421b244d60c), +W64LIT(0x4dd52203ecb53b93), +W64LIT(0x3f0f906954981594), +W64LIT(0xae4aa391ce8dc9b4), +W64LIT(0x3698a0a3483e12ef), +W64LIT(0xf5ab6f9bb9d95334), +W64LIT(0x082be9d0b3b0ab3f), +W64LIT(0xd1e8af59c95e4f2d), +W64LIT(0xd87f9f93d5f84856), +W64LIT(0x6e48f2873b5089a3), +W64LIT(0x2443c0c270871c19), +W64LIT(0xb1e97d5249ca6fdc), +W64LIT(0x7c9392e603e98755), +W64LIT(0x839e5399a2acd2d6), +W64LIT(0x19c1179f8f33a405), +W64LIT(0xde1d56cfdd8c4a3b), +W64LIT(0x20ac4eaad3dfb3fc), +W64LIT(0x1af089b18b09a5c9), +W64LIT(0x3a5cc71b58d61635), +W64LIT(0x444212c9f0133ce8), +W64LIT(0x72dab26ab82d2e07), +W64LIT(0x4c69fb1943a397d7), +W64LIT(0xf3c9a6c7b1ad5159), +W64LIT(0x1d2e99f72c6b0be0), +W64LIT(0xb4ba2a2045846c7d), +W64LIT(0xe22358888d2e5e63), +W64LIT(0x2887a77a606f18c3), +W64LIT(0xa8286acdc6f9cbd9), +W64LIT(0x5f0e4262d40c3565), +W64LIT(0xeee73f309dc65ab9), +W64LIT(0x9be39d1c8289da97), +W64LIT(0x1634ee099be1a113), +W64LIT(0xea08b1583e9ef55c), +W64LIT(0x9727faa49261de4d), +W64LIT(0x2c682912c337b726), +W64LIT(0xcff7a880e10f4501), +W64LIT(0x1788371334f70d57), +W64LIT(0x27725eec74bd1dd5), +W64LIT(0x3146b0e5ef5cbcc6), +W64LIT(0x099730ca1ca6077b), +W64LIT(0xf2757fdd1ebbfd1d), +W64LIT(0x6aa77cef98082646), +W64LIT(0xbb4fd3b65156696b), +W64LIT(0x569972a8c8aa321e), +W64LIT(0xa3321d337173612a), +W64LIT(0x50fbbbf4c0de3073), +W64LIT(0x5a5d1510d84236c4), +W64LIT(0xfd80864b0a69f80b), +W64LIT(0x07de1046a762ae29), +W64LIT(0xa6614a417d3d628b), +W64LIT(0xd78a6605c12a4d40), +W64LIT(0x67dfc24d27f68ed8), +W64LIT(0xbc91c3f0f634c742), +W64LIT(0xd05476436648e369), +W64LIT(0x493aac6b4fed9476), +W64LIT(0x12db606138b90ef6), +W64LIT(0xa994b3d769ef679d), +W64LIT(0x211097b07cc91fb8), +W64LIT(0x30fa69ff404a1082), +W64LIT(0x3c3e0e4750a21458), +W64LIT(0x7504a22c1f4f802e), +W64LIT(0x844043df05ce7cff), +W64LIT(0xf0f838e9b5975095), +W64LIT(0x7e1ed5d2a8c52add), +W64LIT(0x90f9eae235037064), +W64LIT(0x0662c95c0874026d), +W64LIT(0x9416648a965bdf81), +W64LIT(0xf69af1b5bde352f8), +W64LIT(0x0d78bea2bffea89e), +W64LIT(0x293b7e60cf79b487), +W64LIT(0xd9c346897aeee412), +W64LIT(0xfbe24f17021dfa66), +W64LIT(0x1367b97b97afa2b2), +W64LIT(0xab19f4e3c2c3ca15), +W64LIT(0x48867571e0fb3832), +W64LIT(0x93c874cc313971a8), +W64LIT(0x79c0c5940fa784f4), +W64LIT(0xcd7aefb44a23e889), +W64LIT(0x439c028f577192c1), +W64LIT(0x5be1cc0a77549a80), +/* box 6 */ +W64LIT(0x714d28d778656928), +W64LIT(0xc88a7c6b84f64f7c), +W64LIT(0xec43cac5ab89aaca), +W64LIT(0x777fa38110dc16a3), +W64LIT(0x0f7d5c87e4213b5c), +W64LIT(0x73f051e5f3a1ef51), +W64LIT(0xea714193c330d541), +W64LIT(0x95e5f3dae016c4f3), +W64LIT(0x63d3738095a0e173), +W64LIT(0x9825d66f8ff379d6), +W64LIT(0xe8cc38a148f45338), +W64LIT(0xa840b0c025f06bb0), +W64LIT(0x944135c35f748735), +W64LIT(0x74661caa247ad31c), +W64LIT(0xe7b16426acd56864), +W64LIT(0xd1e689df6e6f0589), +W64LIT(0xa73dec47c1d150ec), +W64LIT(0x64453ecf427bdd3e), +W64LIT(0x0ed99a9e5b43789a), +W64LIT(0x7b1b402dc05be840), +W64LIT(0x0dc025b56fe5bd25), +W64LIT(0x3f183a284e22293a), +W64LIT(0xa0aba108160a6ca1), +W64LIT(0x46be033705bd4703), +W64LIT(0x86df6e94b2b10f6e), +W64LIT(0xa216d83a9dceead8), +W64LIT(0x129e5b57edc5885b), +W64LIT(0x7e3074509c445274), +W64LIT(0x7d29cb7ba8e297cb), +W64LIT(0x1611a9330eb871a9), +W64LIT(0x486799a95efe3f99), +W64LIT(0x9fb39b205828459b), +W64LIT(0xd0424fc6d10d464f), +W64LIT(0xe968feb8f79610fe), +W64LIT(0x5d6f8fb164e08b8f), +W64LIT(0xaafdc9f2ae34edc9), +W64LIT(0x02bd79328bc48679), +W64LIT(0x9b3c6944bb55bc69), +W64LIT(0x6277b5992ac2a2b5), +W64LIT(0x877ba88d0dd34ca8), +W64LIT(0xfa5263f6a531db63), +W64LIT(0x2e9fde54974164de), +W64LIT(0xcda14816d8e9f548), +W64LIT(0x675c81e476dd1881), +W64LIT(0x2a102c30743c9d2c), +W64LIT(0x37f32be07dd82e2b), +W64LIT(0x256d70b7901da670), +W64LIT(0x4ce86bcdbd83c66b), +W64LIT(0x50afaa040b0536aa), +W64LIT(0xef5a75ee9f2f6f75), +W64LIT(0xb3913c4644ada73c), +W64LIT(0x1187e47cd9634de4), +W64LIT(0xc54a59deeb13f259), +W64LIT(0x0000000000000000), +W64LIT(0x01a4c619bf6243c6), +W64LIT(0x90cec7a7bc097ec7), +W64LIT(0xf94bdcdd91971edc), +W64LIT(0x8e347f5c814b087f), +W64LIT(0xc7f720ec60d77420), +W64LIT(0x354e52d2f61ca852), +W64LIT(0x34ea94cb497eeb94), +W64LIT(0xae723b964d49143b), +W64LIT(0xf48bf968fe72a3f9), +W64LIT(0xfc60e8a0cd88a4e8), +W64LIT(0x2909931b409a5893), +W64LIT(0xbd48a6d81feedfa6), +W64LIT(0x6cae2f077181da2f), +W64LIT(0xad6b84bd79efd184), +W64LIT(0x18c833ad55fb0933), +W64LIT(0x204644cacc021c44), +W64LIT(0x392ab17e269b56b1), +W64LIT(0x14acd001857cf7d0), +W64LIT(0x8abb8d386236f18d), +W64LIT(0xeefeb3f7204d2cb3), +W64LIT(0xf636805a75b62580), +W64LIT(0x2bb4ea29cb5edeea), +W64LIT(0xc653e6f5dfb537e6), +W64LIT(0x8d2dc077b5edcdc0), +W64LIT(0x31c1a0b6156151a0), +W64LIT(0xf8ef1ac42ef55d1a), +W64LIT(0xdbb0e125d65184e1), +W64LIT(0x82509cf051ccf69c), +W64LIT(0xe33e96424fa89196), +W64LIT(0xdf3f1341352c7d13), +W64LIT(0x8f90b9453e294bb9), +W64LIT(0x1023226566010e22), +W64LIT(0xa58095754a15d695), +W64LIT(0x2c22a7661c85e2a7), +W64LIT(0xe183ef70c46c17ef), +W64LIT(0xafd6fd8ff22b57fd), +W64LIT(0x471ac52ebadf04c5), +W64LIT(0x4d4cadd402e185ad), +W64LIT(0x916a01be036b3d01), +W64LIT(0x28ad5502fff81b55), +W64LIT(0x3657edf9c2ba6ded), +W64LIT(0xd2ff36f45ac9c036), +W64LIT(0xf1a0cd15a26d19cd), +W64LIT(0xd90d98175d950298), +W64LIT(0xf7924643cad46646), +W64LIT(0xdd826a73bee8fb6a), +W64LIT(0x9d0ee212d3ecc3e2), +W64LIT(0xb6ba083b18b21d08), +W64LIT(0x3da5431ac5e6af43), +W64LIT(0x08eb11c833fa0711), +W64LIT(0x052b347d5c1fba34), +W64LIT(0x6fb7902c45271f90), +W64LIT(0x133a9d4e52a7cb9d), +W64LIT(0x6e135635fa455c56), +W64LIT(0x725497fc4cc3ac97), +W64LIT(0xf31db42729a99fb4), +W64LIT(0x846217a639758917), +W64LIT(0x4b7e26826a58fa26), +W64LIT(0x235ffbe1f8a4d9fb), +W64LIT(0xff79578bf92e6157), +W64LIT(0xda14273c6933c727), +W64LIT(0x8b1f4b21dd54b24b), +W64LIT(0x9caa240b6c8e8024), +W64LIT(0xc1c5abba086e0bab), +W64LIT(0xde9bd5588a4e3ed5), +W64LIT(0x2d86617fa3e7a161), +W64LIT(0xbff5dfea942a59df), +W64LIT(0x66f847fdc9bf5b47), +W64LIT(0x3b97c84cad5fd0c8), +W64LIT(0x3ebcfc31f1406afc), +W64LIT(0xca3705590f32c905), +W64LIT(0x24c9b6ae2f7fe5b6), +W64LIT(0x408c88616d043888), +W64LIT(0x93d7788c88afbb78), +W64LIT(0x196cf5b4ea994af5), +W64LIT(0x9a98af5d0437ffaf), +W64LIT(0x8c89066e0a8f8e06), +W64LIT(0xab590feb1156ae0f), +W64LIT(0xd7d4028906d67a02), +W64LIT(0xe4a8db0d9873addb), +W64LIT(0xc378d28883aa8dd2), +W64LIT(0x4ff1d4e6892503d4), +W64LIT(0xd670c490b9b439c4), +W64LIT(0x65e1f8d6fd199ef8), +W64LIT(0xf2b9723e96cbdc72), +W64LIT(0xb12c4574cf692145), +W64LIT(0x569d215263bc4921), +W64LIT(0x69851b7a2d9e601b), +W64LIT(0x5e76309a50464e30), +W64LIT(0x5fd2f683ef240df6), +W64LIT(0xd8a95e0ee2f7415e), +W64LIT(0xe29a505bf0cad250), +W64LIT(0x96fc4cf1d4b0014c), +W64LIT(0x8806f40ae9f277f4), +W64LIT(0x53b6152f3fa3f315), +W64LIT(0x1c47c1c9b686f0c1), +W64LIT(0x80ede5c2da0870e5), +W64LIT(0xd5697bbb8d12fc7b), +W64LIT(0xfdc42eb972eae72e), +W64LIT(0x0bf2aee3075cc2ae), +W64LIT(0x22fb3df847c69a3d), +W64LIT(0xbadeeb97c835e3eb), +W64LIT(0xdc26ac6a018ab8ac), +W64LIT(0xbcec60c1a08c9c60), +W64LIT(0x4231f153e6c0bef1), +W64LIT(0x337cd9849ea5d7d9), +W64LIT(0x5b5d04e70c59f404), +W64LIT(0x79a6391f4b9f6e39), +W64LIT(0x5212d33680c1b0d3), +W64LIT(0xb5a3b7102c14d8b7), +W64LIT(0x7f94b249232611b2), +W64LIT(0x17b56f2ab1da326f), +W64LIT(0x59e07dd5879d727d), +W64LIT(0xebd5878a7c529687), +W64LIT(0xbb7a2d8e7757a02d), +W64LIT(0x0319bf2b34a6c5bf), +W64LIT(0x5ccb49a8db82c849), +W64LIT(0x1de307d009e4b307), +W64LIT(0x49c35fb0e19c7c5f), +W64LIT(0x55849e79571a8c9e), +W64LIT(0x7abf86347f39ab86), +W64LIT(0x9273be9537cdf8be), +W64LIT(0xe615a23f13b72ba2), +W64LIT(0x6821dd6392fc23dd), +W64LIT(0x5af9c2feb33bb7c2), +W64LIT(0x06328b5668b97f8b), +W64LIT(0x44037a058e79c17a), +W64LIT(0x83f45ae9eeaeb55a), +W64LIT(0x5739e74bdcde0ae7), +W64LIT(0xfbf6a5ef1a5398a5), +W64LIT(0xe50c1d142711ee1d), +W64LIT(0x1a754a9fde3f8f4a), +W64LIT(0x7802ff06f4fd2dff), +W64LIT(0xf52f3f714110e03f), +W64LIT(0x2674cf9ca4bb63cf), +W64LIT(0x60caccaba10624cc), +W64LIT(0xb088836d700b6283), +W64LIT(0xa6992a5e7eb3132a), +W64LIT(0xa9e476d99a922876), +W64LIT(0x6b386248a65ae662), +W64LIT(0xc2dc14913cc8ce14), +W64LIT(0x76db6598afbe5565), +W64LIT(0x32d81f9d21c7941f), +W64LIT(0x21e282d373605f82), +W64LIT(0xc0616da3b70c486d), +W64LIT(0x616e0ab21e64670a), +W64LIT(0x6d0ae91ecee399e9), +W64LIT(0x27d009851bd92009), +W64LIT(0xfedd9192464c2291), +W64LIT(0x45a7bc1c311b82bc), +W64LIT(0x54205860e878cf58), +W64LIT(0xa10f6711a9682f67), +W64LIT(0x9981107630913a10), +W64LIT(0xede70cdc14ebe90c), +W64LIT(0x70e9eecec7072aee), +W64LIT(0x1f5e7ee28220357e), +W64LIT(0x2f3b184d28232718), +W64LIT(0x41284e78d2667b4e), +W64LIT(0xa424536cf5779553), +W64LIT(0xa3b21e2322aca91e), +W64LIT(0x4e5512ff36474012), +W64LIT(0x1efab8fb3d4276b8), +W64LIT(0x89a2321356903432), +W64LIT(0xcb93c340b0508ac3), +W64LIT(0x306566afaa031266), +W64LIT(0x4adae09bd53ab9e0), +W64LIT(0xc92eba723b940cba), +W64LIT(0x094fd7d18c9844d7), +W64LIT(0xcc058e0f678bb68e), +W64LIT(0xd4cdbda23270bfbd), +W64LIT(0x0a5668fab83e8168), +W64LIT(0x510b6c1db467756c), +W64LIT(0xb86392a543f16592), +W64LIT(0x048ff264e37df9f2), +W64LIT(0x3a330e55123d930e), +W64LIT(0xb235fa5ffbcfe4fa), +W64LIT(0xb9c754bcfc932654), +W64LIT(0x3c0185037a84ec85), +W64LIT(0x0c64e3acd087fee3), +W64LIT(0xe02729697b0e5429), +W64LIT(0x07964d4fd7db3c4d), +W64LIT(0x814923db656a3323), +W64LIT(0x388e776799f91577), +W64LIT(0x6a9ca4511938a5a4), +W64LIT(0x1bd18c86615dcc8c), +W64LIT(0xb407710993769b71), +W64LIT(0x150816183a1eb416), +W64LIT(0x4395374a59a2fd37), +W64LIT(0xc4ee9fc75471b19f), +W64LIT(0x5844bbcc38ff31bb), +W64LIT(0xcf1c3124532d7331), +W64LIT(0xb71ece22a7d05ece), +W64LIT(0xaccf42a4c68d9242), +W64LIT(0x97588ae86bd2428a), +W64LIT(0x75c2dab39b1890da), +W64LIT(0x9e175d39e74a065d), +W64LIT(0xf0040b0c1d0f5a0b), +W64LIT(0xceb8f73dec4f30f7), +W64LIT(0xbe5119f32b481a19), +W64LIT(0xd35bf0ede5ab83f0), +W64LIT(0x7c8d0d621780d40d), +W64LIT(0x85c6d1bf8617cad1), +/* box 7 */ +W64LIT(0xb1c742127b66f2a4), +W64LIT(0xce916098d7a59fc1), +W64LIT(0xc312ef8e2406fa70), +W64LIT(0x956c7dced81403d5), +W64LIT(0x5a0c9b2318dd9520), +W64LIT(0xad0d57f51a480e8b), +W64LIT(0xe7b9d05287740b01), +W64LIT(0x0217f9ea2ed81268), +W64LIT(0x4d7cff19f8cd3a06), +W64LIT(0x44d1772e572b7b67), +W64LIT(0xfb73c5b5e65af72e), +W64LIT(0x91427aef84512705), +W64LIT(0x0c720963e4cf6c85), +W64LIT(0x87c398a0732d8117), +W64LIT(0xa17f5e96fe87620e), +W64LIT(0x50476c8b8e8fcf1d), +W64LIT(0xcb4ee1cc9c8cb225), +W64LIT(0x67b2304c91a8b59a), +W64LIT(0x54696baad2caebcd), +W64LIT(0xddcf03836bf01437), +W64LIT(0x46c68ec479f3690f), +W64LIT(0x8f9f96e2cba7c942), +W64LIT(0xe1802e99f5e93db9), +W64LIT(0x4e9a8086c179215a), +W64LIT(0xf0c9b4686764a427), +W64LIT(0xfd4a3b7e94c7c196), +W64LIT(0xfcbbbd0b83abc8a2), +W64LIT(0xebcbd93163bb6784), +W64LIT(0xf9643c5fc882e546), +W64LIT(0xc4da973041f7c5fc), +W64LIT(0x1af3eb2c13b3ca97), +W64LIT(0x6e1fb87b3e4ef4fb), +W64LIT(0x5e229c024498b1f0), +W64LIT(0xf516353c2c4d89c3), +W64LIT(0xcc869972f97d8da9), +W64LIT(0x8d886f08e57fdb2a), +W64LIT(0x1cca15e7612efc2f), +W64LIT(0x567e9240fc12f9a5), +W64LIT(0x43190f9032da44eb), +W64LIT(0xfeac44e1ad73daca), +W64LIT(0x07c878be65f13f8c), +W64LIT(0x618bce87e3358322), +W64LIT(0xf895ba2adfeeec72), +W64LIT(0x751dd5223a913758), +W64LIT(0x59eae4bc21698e7c), +W64LIT(0xff5dc294ba1fd3fe), +W64LIT(0x03e67f9f39b41b5c), +W64LIT(0x2292c117d1efc7c9), +W64LIT(0x8a4017b6808ee4a6), +W64LIT(0xd1bd0ae08f3f78b2), +W64LIT(0x135e631bbc558bf6), +W64LIT(0xee14586528924a60), +W64LIT(0x8857ee5cae56f6ce), +W64LIT(0x0000000000000000), +W64LIT(0x0e65f089ca177eed), +W64LIT(0x34132358269361db), +W64LIT(0x15679dd0cec8bd4e), +W64LIT(0x800be01e16dcbe9b), +W64LIT(0x949dfbbbcf780ae1), +W64LIT(0xe397d773db312fd1), +W64LIT(0xedf227fa1126513c), +W64LIT(0xb5e945332723d674), +W64LIT(0x53a11314b73bd441), +W64LIT(0x23634762c683cefd), +W64LIT(0x4b4501d28a500cbe), +W64LIT(0x473708b16e9f603b), +W64LIT(0x1770643ae010af26), +W64LIT(0xa746a05d8c1a54b6), +W64LIT(0x90b3fc9a933d2e31), +W64LIT(0x35e2a52d31ff68ef), +W64LIT(0xab34a93e68d53833), +W64LIT(0xd81082d720d939d3), +W64LIT(0xb86aca25d480b3c5), +W64LIT(0xdfd8fa694528065f), +W64LIT(0x4f6b06f3d615286e), +W64LIT(0x578f1435eb7ef091), +W64LIT(0x9af80b32056f740c), +W64LIT(0x92a40570bde53c59), +W64LIT(0xdbf6fd48196d228f), +W64LIT(0x1b026d5904dfc3a3), +W64LIT(0x3c4f2d1a9e19298e), +W64LIT(0xc8a89e53a538a979), +W64LIT(0x991e74ad3cdb6f50), +W64LIT(0x042e07215c4524d0), +W64LIT(0x8e6e1097dccbc076), +W64LIT(0xe071a8ece285348d), +W64LIT(0xd784f42bfda24e0a), +W64LIT(0x7d41db60821b7f0d), +W64LIT(0x85d4614a5df5937f), +W64LIT(0xbb8cb5baed34a899), +W64LIT(0x40ff700f0b6e5fb7), +W64LIT(0x2cf7319e1bf8b924), +W64LIT(0x3a76d3d1ec841f36), +W64LIT(0x4520f15b40477253), +W64LIT(0xf138321d7008ad13), +W64LIT(0x42e889e525b64ddf), +W64LIT(0x65a5c9a6bf70a7f2), +W64LIT(0x208538fdff37d5a1), +W64LIT(0x410ef67a1c025683), +W64LIT(0x18e412c63d6bd8ff), +W64LIT(0x72d5ad9c5f6008d4), +W64LIT(0x255ab9a9b41ef845), +W64LIT(0x93558305aa89356d), +W64LIT(0x70c2547671b81abc), +W64LIT(0x3604dab2084b73b3), +W64LIT(0x05df81544b292de4), +W64LIT(0xf2de4d8249bcb64f), +W64LIT(0x0bba71dd813e5309), +W64LIT(0xa368a77cd05f7066), +W64LIT(0x796fdc41de5e5bdd), +W64LIT(0xec03a18f064a5808), +W64LIT(0x085c0e42b88a4855), +W64LIT(0x274d40439ac6ea2d), +W64LIT(0x31cca20c6dba4c3f), +W64LIT(0x322add93540e5763), +W64LIT(0xb60f3aac1e97cd28), +W64LIT(0x7cb05d1595777639), +W64LIT(0xb036c4676c0afb90), +W64LIT(0x0a4bf7a896525a3d), +W64LIT(0x73242be9480c01e0), +W64LIT(0x5bfd1d560fb19c14), +W64LIT(0x7b7825abf08649b5), +W64LIT(0xb7febcd909fbc41c), +W64LIT(0x81fa666b01b0b7af), +W64LIT(0xd25b757fb68b63ee), +W64LIT(0x0d838f16f3a365b1), +W64LIT(0x6a31bf5a620bd02b), +W64LIT(0x26bcc6368daae319), +W64LIT(0x9ed60c13592a50dc), +W64LIT(0x581b62c936058748), +W64LIT(0x9cc1f5f977f242b4), +W64LIT(0x83ed9f812f68a5c7), +W64LIT(0x74ec53572dfd3e6c), +W64LIT(0xb3d0bbf855bee0cc), +W64LIT(0xacfcd1800d2407bf), +W64LIT(0x303d24797ad6450b), +W64LIT(0x7a89a3dee7ea4081), +W64LIT(0x69d7c0c55bbfcb77), +W64LIT(0x770a2cc814492530), +W64LIT(0x0f9476fcdd7b77d9), +W64LIT(0xaeeb286a23fc15d7), +W64LIT(0x2174be88e85bdc95), +W64LIT(0xde297c1c52440f6b), +W64LIT(0xd04c8c9598537186), +W64LIT(0x2ee0c8743520ab4c), +W64LIT(0x977b8424f6cc11bd), +W64LIT(0x10b81c8485e190aa), +W64LIT(0xa4a0dfc2b5ae4fea), +W64LIT(0x98eff2d82bb76664), +W64LIT(0xa8d2d6a15161236f), +W64LIT(0xd4628bb4c4165556), +W64LIT(0x682646b04cd3c243), +W64LIT(0x2d06b7eb0c94b010), +W64LIT(0x626db118da81987e), +W64LIT(0x2928b0ca50d194c0), +W64LIT(0x6df9c7e407faefa7), +W64LIT(0x1681e24ff77ca612), +W64LIT(0x4952f838a4881ed6), +W64LIT(0x76fbaabd03252c04), +W64LIT(0xc73ce8af7843dea0), +W64LIT(0xe82da6ae5a0f7cd8), +W64LIT(0xc10516640adee818), +W64LIT(0x968a0251e1a01889), +W64LIT(0x37f55cc71f277a87), +W64LIT(0xe5ae29b8a9ac1969), +W64LIT(0xcabf67b98be0bb11), +W64LIT(0xf4e7b3493b2180f7), +W64LIT(0xe9dc20db4d6375ec), +W64LIT(0x639c376dcded914a), +W64LIT(0x12afe56eab3982c2), +W64LIT(0xc2e369fb336af344), +W64LIT(0xa6b726289b765d82), +W64LIT(0x14961ba5d9a4b47a), +W64LIT(0xbc44cd0488c59715), +W64LIT(0xd3aaf30aa1e76ada), +W64LIT(0x28d936bf47bd9df4), +W64LIT(0xaf1aae1f34901ce3), +W64LIT(0x2f114e01224ca278), +W64LIT(0xe648562790180235), +W64LIT(0x24ab3fdca372f171), +W64LIT(0x52509561a057dd75), +W64LIT(0xc6cd6eda6f2fd794), +W64LIT(0xa08ed8e3e9eb6b3a), +W64LIT(0x09ad8837afe64161), +W64LIT(0xbdb54b719fa99e21), +W64LIT(0x8c79e97df213d21e), +W64LIT(0xcf60e6edc0c996f5), +W64LIT(0x5dc4e39d7d2caaac), +W64LIT(0x11499af1928d999e), +W64LIT(0x5fd31a7753f4b8c4), +W64LIT(0x01f18675176c0934), +W64LIT(0xc52b1145569bccc8), +W64LIT(0x9f278a664e4659e8), +W64LIT(0x3dbeab6f897520ba), +W64LIT(0xa2992109c7337952), +W64LIT(0x9b098d4712037d38), +W64LIT(0xc9591826b254a04d), +W64LIT(0x3b8755a4fbe81602), +W64LIT(0xbe5334eea61d857d), +W64LIT(0x51b6eafe99e3c629), +W64LIT(0x191594b32a07d1cb), +W64LIT(0x1f2c6a78589ae773), +W64LIT(0x3fa95285a7ad32d2), +W64LIT(0x5c3565e86a40a398), +W64LIT(0xb2213d8d42d2e9f8), +W64LIT(0xefe5de103ffe4354), +W64LIT(0x4ab487a79d3c058a), +W64LIT(0xcd771f07ee11849d), +W64LIT(0xbfa2b29bb1718c49), +W64LIT(0xba7d33cffa58a1ad), +W64LIT(0x6fee3e0e2922fdcf), +W64LIT(0x64544fd3a81caec6), +W64LIT(0xd9e104a237b530e7), +W64LIT(0xf32fcbf75ed0bf7b), +W64LIT(0x3e58d4f0b0c13be6), +W64LIT(0xb418c346304fdf40), +W64LIT(0xaac52f4b7fb93107), +W64LIT(0xdc3e85f67c9c1d03), +W64LIT(0xd5930dc1d37a5c62), +W64LIT(0x0639fecb729d36b8), +W64LIT(0xc0f490111db2e12c), +W64LIT(0x7ea7a4ffbbaf6451), +W64LIT(0xf6f04aa315f9929f), +W64LIT(0x6643b63986c4bcae), +W64LIT(0x6c0841911096e693), +W64LIT(0x8425e73f4a999a4b), +W64LIT(0x7133d20366d41388), +W64LIT(0x38612a3bc25c0d5e), +W64LIT(0xb99b4c50c3ecbaf1), +W64LIT(0x1d3b93927642f51b), +W64LIT(0x7f56228aacc36d65), +W64LIT(0x9d30738c609e4b80), +W64LIT(0x48a37e4db3e417e2), +W64LIT(0x8bb191c397e2ed92), +W64LIT(0x2acecf5569658f9c), +W64LIT(0xda077b3d0e012bbb), +W64LIT(0xa55159b7a2c246de), +W64LIT(0x33db5be643625e57), +W64LIT(0x821c19f43804acf3), +W64LIT(0x3990ac4ed530046a), +W64LIT(0xd675725eeace473e), +W64LIT(0x789e5a34c93252e9), +W64LIT(0x86321ed564418823), +W64LIT(0xfa8243c0f136fe1a), +W64LIT(0xe45fafcdbec0105d), +W64LIT(0x2b3f49207e0986a8), +W64LIT(0xa92350d4460d2a5b), +W64LIT(0x1eddec0d4ff6ee47), +W64LIT(0x89a66829b93afffa), +W64LIT(0x607a48f2f4598a16), +W64LIT(0x6bc0392f7567d91f), +W64LIT(0xea3a5f4474d76eb0), +W64LIT(0x5598eddfc5a6e2f9), +W64LIT(0x4c8d796cefa13332), +W64LIT(0xf701ccd602959bab), +W64LIT(0xe2665106cc5d26e5), +}; + +const word64 SHARK::Dec::cbox[8][256] = { +/* box 0 */ +W64LIT(0xe6126af05e55aff3), +W64LIT(0x4b6c893f310b0835), +W64LIT(0xaa4c0e84ebfc8d57), +W64LIT(0xfb9b5c7bf3b3090d), +W64LIT(0x4508a6a9ccba5ce2), +W64LIT(0xe5d1d2064dc6bde9), +W64LIT(0x348343755288edde), +W64LIT(0xb684505de46b250c), +W64LIT(0xa8cede205a1e91e8), +W64LIT(0x40b89b46f9fa6acc), +W64LIT(0x8ee1ec1afab080ba), +W64LIT(0xde77d6b7408e0a45), +W64LIT(0x9a3e184c2e455802), +W64LIT(0xbe93fad23f0955ef), +W64LIT(0x3ae76ce3af39b909), +W64LIT(0xad7ee3cf6f5ea7c6), +W64LIT(0x8b51d1f5cff0b694), +W64LIT(0x70ca8d8e3c43bf99), +W64LIT(0xccdba7f8b2a8f6c9), +W64LIT(0x4c5e6474b5a922a4), +W64LIT(0x5d31adcd541ccc32), +W64LIT(0x9b7f701e8c3456a7), +W64LIT(0x2ac9cd08ecfd593a), +W64LIT(0x8fa0844858c18e1f), +W64LIT(0x32f0c66c745bc9ea), +W64LIT(0xc58d6525cbbb888f), +W64LIT(0x8c633cbe4b529c05), +W64LIT(0xf2cd9ea68aa0774b), +W64LIT(0x2cba4811ca2e7d0e), +W64LIT(0xe2e33f4dc9649778), +W64LIT(0xf4be1bbfac73537f), +W64LIT(0x22de6787379f29d9), +W64LIT(0x0956c2dd79137e46), +W64LIT(0xe061efe978868bc7), +W64LIT(0x1cc85ed90f97a85b), +W64LIT(0x31337e9a67c8dbf0), +W64LIT(0x360193d1e36af161), +W64LIT(0x7fefca4a6383e5eb), +W64LIT(0x8535fe633241e243), +W64LIT(0xc3fee03ced68acbb), +W64LIT(0x81c4abdea570dac8), +W64LIT(0x67d6c12efb25753b), +W64LIT(0xa4282112164dd980), +W64LIT(0xcf181f0ea13be4d3), +W64LIT(0xa98fb672f86f9f4d), +W64LIT(0x5c70c59ff66dc297), +W64LIT(0xb0f7d544c2b80138), +W64LIT(0x0da79760ee2246cd), +W64LIT(0x3740fb83411bffc4), +W64LIT(0x24ade29e114c0ded), +W64LIT(0xf858e48de0201b17), +W64LIT(0x0e642f96fdb154d7), +W64LIT(0xddb46e41531d185f), +W64LIT(0x25ec8accb33d0348), +W64LIT(0x0282d0a4b1e21cbf), +W64LIT(0x1bfab3928b3582ca), +W64LIT(0xaffc336bdebcbb79), +W64LIT(0x35c22b27f0f9e37b), +W64LIT(0x03c3b8f61393121a), +W64LIT(0xb8e07fcb19da71db), +W64LIT(0x99fda0ba3dd64a18), +W64LIT(0xce59775c034aea76), +W64LIT(0x49ee599b80e9148a), +W64LIT(0xfe2b6194c6f33f23), +W64LIT(0x4edcb4d0044b3e1b), +W64LIT(0xd5a3c4ce887f68bc), +W64LIT(0xdf36bee5e2ff04e0), +W64LIT(0x171c4ca0c766caa2), +W64LIT(0x0bd41279c8f162f9), +W64LIT(0xe490ba54efb7b34c), +W64LIT(0x5b4228d472cfe806), +W64LIT(0x5355825ba9ad98e5), +W64LIT(0x9f8e25a31b056e2c), +W64LIT(0xcd9acfaa10d9f86c), +W64LIT(0x88926903dc63a48e), +W64LIT(0xb40680f9558939b3), +W64LIT(0x239f0fd595ee277c), +W64LIT(0xec8710db34d5c3af), +W64LIT(0x87b72ec783a3fefc), +W64LIT(0x632794936c144db0), +W64LIT(0x46cb1e5fdf294ef8), +W64LIT(0x83467b7a1492c677), +W64LIT(0x9c4d9d5508967c36), +W64LIT(0xd6607c389bec7aa6), +W64LIT(0x165d24f26517c407), +W64LIT(0xc4cc0d7769ca862a), +W64LIT(0xcbe94ab3360adc58), +W64LIT(0x847496319030ece6), +W64LIT(0x7a5ff7a556c3d3c5), +W64LIT(0xc03d58cafefbbea1), +W64LIT(0x76b908971a909bad), +W64LIT(0x2f79f0e7d9bd6f14), +W64LIT(0x197863363ad79e75), +W64LIT(0xda86830ad7bf32ce), +W64LIT(0x5a034086d0bee6a3), +W64LIT(0x97998f2cc0671ecf), +W64LIT(0x552607428f7ebcd1), +W64LIT(0x51d752ff184f845a), +W64LIT(0xbb23c73d0a4963c1), +W64LIT(0x2b88a55a4e8c579f), +W64LIT(0xd80453ae665d2e71), +W64LIT(0xee05c07f8537df10), +W64LIT(0x423a4be248187673), +W64LIT(0xcaa822e1947bd2fd), +W64LIT(0x1abbdbc029448c6f), +W64LIT(0x96d8e77e6216106a), +W64LIT(0x6266fcc1ce654315), +W64LIT(0x89d301517e12aa2b), +W64LIT(0x730935782fd0ad83), +W64LIT(0x8085c38c0701d46d), +W64LIT(0x6b303e1cb7763d53), +W64LIT(0x3f57510c9a798f27), +W64LIT(0x4449cefb6ecb5247), +W64LIT(0x48af31c922981a2f), +W64LIT(0x98bcc8e89fa744bd), +W64LIT(0x69b2eeb8069421ec), +W64LIT(0xebb5fd90b077e93e), +W64LIT(0x6a71564e150733f6), +W64LIT(0x116fc9b9e1b5ee96), +W64LIT(0x4a2de16d937a0690), +W64LIT(0xb9a11799bbab7f7e), +W64LIT(0x9368da9157562644), +W64LIT(0x718be5dc9e32b13c), +W64LIT(0xc82af2452599ce42), +W64LIT(0xb547e8abf7f83716), +W64LIT(0x33b1ae3ed62ac74f), +W64LIT(0x799c4f534550c1df), +W64LIT(0x3e16395e38088182), +W64LIT(0x7c2c72bc7010f7f1), +W64LIT(0xf38cf6f428d179ee), +W64LIT(0xd29129850cdd422d), +W64LIT(0x41f9f3145b8b6469), +W64LIT(0x945a37dad3f40cd5), +W64LIT(0x757ab061090389b7), +W64LIT(0x6554118a4ac76984), +W64LIT(0x7d6d1aeed261f954), +W64LIT(0x01416852a2710ea5), +W64LIT(0xb27505e0735a1d87), +W64LIT(0x77f860c5b8e19508), +W64LIT(0x78dd2701e721cf7a), +W64LIT(0xe12087bbdaf78562), +W64LIT(0x86f6469521d2f059), +W64LIT(0xef44a82d2746d1b5), +W64LIT(0xbc112a768eeb4950), +W64LIT(0xc2bf886e4f19a21e), +W64LIT(0x307216c8c5b9d555), +W64LIT(0xc96b9a1787e8c0e7), +W64LIT(0xa31acc5992eff311), +W64LIT(0xa0d974af817ce10b), +W64LIT(0xdcf50613f16c16fa), +W64LIT(0xfca9b1307711239c), +W64LIT(0x57a4d7e63e9ca06e), +W64LIT(0xc64eddd3d8289a95), +W64LIT(0xa25ba40b309efdb4), +W64LIT(0x2e3898b57bcc61b1), +W64LIT(0xf5ff73ed0e025dda), +W64LIT(0xa6aaf1b6a7afc53f), +W64LIT(0xd9453bfcc42c20d4), +W64LIT(0x9d0cf507aae77293), +W64LIT(0x290a75feff6e4b20), +W64LIT(0xa7eb99e405decb9a), +W64LIT(0xa1981cfd230defae), +W64LIT(0x12ac714ff226fc8c), +W64LIT(0x743bd833ab728712), +W64LIT(0x6c02d35733d417c2), +W64LIT(0xe9372d340195f581), +W64LIT(0xf77da349bfe04165), +W64LIT(0x68f386eaa4e52f49), +W64LIT(0x211ddf71240c3bc3), +W64LIT(0x13ed191d5057f229), +W64LIT(0xe8764566a3e4fb24), +W64LIT(0xf9198cdf425115b2), +W64LIT(0xd013f921bd3f5e92), +W64LIT(0x91ea0a35e6b43afb), +W64LIT(0x0732ed4b84a22a91), +W64LIT(0xeaf495c21206e79b), +W64LIT(0x5214ea090bdc9640), +W64LIT(0x0000000000000000), +W64LIT(0xb3346db2d12b1322), +W64LIT(0x0ce6ff324c534868), +W64LIT(0xaebd5b397ccdb5dc), +W64LIT(0x0a957a2b6a806c5c), +W64LIT(0x1f0be62f1c04ba41), +W64LIT(0x14dff456d4f5d8b8), +W64LIT(0x58819022615cfa1c), +W64LIT(0x05b03def3540362e), +W64LIT(0xe3a2571f6b1599dd), +W64LIT(0x9229b2c3f52728e1), +W64LIT(0xba62af6fa8386d64), +W64LIT(0x0673851926d32434), +W64LIT(0x641579d8e8b66721), +W64LIT(0x04f155bd9731388b), +W64LIT(0x9ecf4df1b9746089), +W64LIT(0x205cb723867d3566), +W64LIT(0x102ea1eb43c4e033), +W64LIT(0x3ba604b10d48b7ac), +W64LIT(0x50963aadba3e8aff), +W64LIT(0xac3f8b9dcd2fa963), +W64LIT(0x7b1e9ff7f4b2dd60), +W64LIT(0xf63ccb1b1d914fc0), +W64LIT(0x7eaea218c1f2eb4e), +W64LIT(0x5fb37d69e5fed08d), +W64LIT(0x56e5bfb49cedaecb), +W64LIT(0x2dfb2043685f73ab), +W64LIT(0x61a54437ddf6510f), +W64LIT(0x6fc16ba1204705d8), +W64LIT(0xe75302a2fc24a156), +W64LIT(0x3dd581a82b9b9398), +W64LIT(0xdbc7eb5875ce3c6b), +W64LIT(0x90ab626744c5345e), +W64LIT(0x59c0f870c32df4b9), +W64LIT(0x6697a97c59547b9e), +W64LIT(0xfde8d962d5602d39), +W64LIT(0xd3d041d7aeac4c88), +W64LIT(0x5ef2153b478fde28), +W64LIT(0xd4e2ac9c2a0e6619), +W64LIT(0x1e4a8e7dbe75b4e4), +W64LIT(0x72485d2a8da1a326), +W64LIT(0x437b23b0ea6978d6), +W64LIT(0x159e9c047684d61d), +W64LIT(0x0f2547c45fc05a72), +W64LIT(0xf10e265099336551), +W64LIT(0x3c94e9fa89ea9d3d), +W64LIT(0xbfd292809d785b4a), +W64LIT(0x0817aa8fdb6270e3), +W64LIT(0x60e42c657f875faa), +W64LIT(0x18390b6498a690d0), +W64LIT(0x478a760d7d58405d), +W64LIT(0x284b1dac5d1f4585), +W64LIT(0xb1b6bd1660c90f9d), +W64LIT(0xd15291731f4e5037), +W64LIT(0x4d1f0c2617d82c01), +W64LIT(0xc70fb5817a599430), +W64LIT(0x6d43bb0591a51967), +W64LIT(0x6e8003f382360b7d), +W64LIT(0x1d89368bade6a6fe), +W64LIT(0x4f9ddc82a63a30be), +W64LIT(0xedc6788996a4cd0a), +W64LIT(0xab0d66d6498d83f2), +W64LIT(0x54676f102d0fb274), +W64LIT(0xc17c30985c8ab004), +W64LIT(0x3865bc471edba5b6), +W64LIT(0x3924d415bcaaab13), +W64LIT(0x951b5f8871850270), +W64LIT(0x8a10b9a76d81b831), +W64LIT(0xbd5042242c9a47f5), +W64LIT(0xa5694940b43cd725), +W64LIT(0xff6a09c664823186), +W64LIT(0x8d2254ece92392a0), +W64LIT(0xb7c5380f461a2ba9), +W64LIT(0x82071328b6e3c8d2), +W64LIT(0xd721146a399d7403), +W64LIT(0xfada342951c207a8), +W64LIT(0x262f323aa0ae1152), +W64LIT(0xf04f4e023b426bf4), +W64LIT(0x276e5a6802df1ff7), +/* box 1 */ +W64LIT(0x3b4016dbfd16e203), +W64LIT(0x9a7574c51174530a), +W64LIT(0x90012e69c02ec8d3), +W64LIT(0xf44580e3d780e076), +W64LIT(0xf81dec2b49eca14b), +W64LIT(0x26cae3e8a6e3d7ef), +W64LIT(0x0962419e0c41f6ab), +W64LIT(0x54d1eb4070ebd951), +W64LIT(0x865e884b0188eec8), +W64LIT(0xdf76067ea406fe8a), +W64LIT(0x29849412e594fba0), +W64LIT(0x461569896869c0f2), +W64LIT(0xb5ddd6b3bbd6724e), +W64LIT(0x0c586cc89e6c413d), +W64LIT(0x6b0ad97054d904ea), +W64LIT(0xa135621eec62b109), +W64LIT(0x0eef7e47087ea461), +W64LIT(0xfaaafea4dffe4417), +W64LIT(0xe0ad344e80342331), +W64LIT(0xab4138b23d382ad0), +W64LIT(0x107390468e90fcff), +W64LIT(0xbe0885a2218561b9), +W64LIT(0xdbed22957d22c132), +W64LIT(0x2251c7037fc7e857), +W64LIT(0x33835ef8ba5e9c86), +W64LIT(0xb3f1e0d7f4e0a8aa), +W64LIT(0x3fdb32302432ddbb), +W64LIT(0xa719547aa3546bed), +W64LIT(0xe10c3df3cb3dab1f), +W64LIT(0x17feaf9f8aafae35), +W64LIT(0x9df84b1c154b01c0), +W64LIT(0x8364a51d93a5595e), +W64LIT(0x535cd49974d48b9b), +W64LIT(0x01a109bd4b09882e), +W64LIT(0xc4d0c529b0c51182), +W64LIT(0x2e09abcbe1aba96a), +W64LIT(0x1f3de7bccde7d0b0), +W64LIT(0x9317355b1d35a5a1), +W64LIT(0x6c87e6a950e65620), +W64LIT(0x8910ffb142ffc287), +W64LIT(0x40395fed275f1a16), +W64LIT(0x7b794936da49f815), +W64LIT(0xf269b68798b63a92), +W64LIT(0xfd27c17ddbc116dd), +W64LIT(0x8d8bdb5a9bdbfd3f), +W64LIT(0x1ba6c35714c3ef08), +W64LIT(0x6e30f426c6f4b37c), +W64LIT(0x7fe26ddd036dc7ad), +W64LIT(0x14e8b4ad57b4c347), +W64LIT(0xb985ba7b25ba3373), +W64LIT(0xe9cf75d08c75d59a), +W64LIT(0x626898ee5898f241), +W64LIT(0x5b9f9cba339cf51e), +W64LIT(0xb250e96abfe92084), +W64LIT(0x165fa622c1a6261b), +W64LIT(0xf5e4895e9c896858), +W64LIT(0xb76ac43c2dc49712), +W64LIT(0x02b7128f9612e55c), +W64LIT(0x1d8af5335bf535ec), +W64LIT(0x36b973ae28732b10), +W64LIT(0xa8572380e02347a2), +W64LIT(0xf6f2926c4192052a), +W64LIT(0x8c2ad2e7d0d27511), +W64LIT(0xd32e6ab63a6abfb7), +W64LIT(0xbd1e9e90fc9e0ccb), +W64LIT(0x03161b32dd1b6d72), +W64LIT(0x4dc03a98f23ad305), +W64LIT(0x81d3b79205b7bc02), +W64LIT(0x450372bbb572ad80), +W64LIT(0x2d1fb0f93cb0c418), +W64LIT(0x2a928f20388f96d2), +W64LIT(0x721b08a8d6080ebe), +W64LIT(0x92b63ce6563c2d8f), +W64LIT(0xeb78675f1a6730c6), +W64LIT(0x13658b74538b918d), +W64LIT(0x428e4d62b14dff4a), +W64LIT(0x88b1f60c09f64aa9), +W64LIT(0x75963771d2375c74), +W64LIT(0x7ad8408b9140703b), +W64LIT(0x57c7f072adf0b423), +W64LIT(0xe5971918121994a7), +W64LIT(0x5666f9cfe6f93c0d), +W64LIT(0x8f3cc9d50dc91863), +W64LIT(0x1e9cee0186ee589e), +W64LIT(0x8a06e4839fe4aff5), +W64LIT(0xb824b3c66eb3bb5d), +W64LIT(0xd1997839ac785aeb), +W64LIT(0x6752b5b8cab545d7), +W64LIT(0xb47cdf0ef0dffa60), +W64LIT(0x949a0a82190af76b), +W64LIT(0xc04be1c269e12e3a), +W64LIT(0xfc86c8c090c89ef3), +W64LIT(0xe3bb2f7c5d2f4e43), +W64LIT(0x6aabd0cd1fd08cc4), +W64LIT(0x2147dc31a2dc8525), +W64LIT(0xca3fbb6eb8bbb5e3), +W64LIT(0x48fa17ce60176493), +W64LIT(0x6444ae8a17ae28a5), +W64LIT(0x2b33869d73861efc), +W64LIT(0xd0387184e771d2c5), +W64LIT(0x7cf476efde76aadf), +W64LIT(0x63c9915313917a6f), +W64LIT(0xc929a05c65a0d891), +W64LIT(0xda4c2b28362b491c), +W64LIT(0xfe31da4f06da7baf), +W64LIT(0xc1eae87f22e8a614), +W64LIT(0x5c12a36337a3a7d4), +W64LIT(0x18b0d865c9d8827a), +W64LIT(0xe7200b97840b71fb), +W64LIT(0x4bec0cfcbd0c09e1), +W64LIT(0x0f4e77fa43772c4f), +W64LIT(0x4c613325b9335b2b), +W64LIT(0xf3c8bf3ad3bfb2bc), +W64LIT(0x87ff81f64a8166e6), +W64LIT(0xa38270917a705455), +W64LIT(0x1911d1d882d10a54), +W64LIT(0x44a27b06fe7b25ae), +W64LIT(0x049b24ebd9243fb8), +W64LIT(0xbb32a8f4b3a8d62f), +W64LIT(0x91a027d48b2740fd), +W64LIT(0x3d6c20bfb22038e7), +W64LIT(0xe681022acf02f9d5), +W64LIT(0xf17fadb545ad57e0), +W64LIT(0xcc138d0af78d6f07), +W64LIT(0x495b1e732b1eecbd), +W64LIT(0x38560de9200d8f71), +W64LIT(0xa9f62a3dab2acf8c), +W64LIT(0x47b46034236048dc), +W64LIT(0x8e9dc06846c0904d), +W64LIT(0xaccc076b3907781a), +W64LIT(0x32225745f15714a8), +W64LIT(0xd4a3556f3e55ed7d), +W64LIT(0xd7b54e5de34e800f), +W64LIT(0xddc114f132141bd6), +W64LIT(0x6d26ef141befde0e), +W64LIT(0x85489379dc9383ba), +W64LIT(0x0bd553119a5313f7), +W64LIT(0x786f520407529567), +W64LIT(0xcb9eb2d3f3b23dcd), +W64LIT(0xa223792c3179dc7b), +W64LIT(0x0a745aacd15a9bd9), +W64LIT(0x710d139a0b1363cc), +W64LIT(0x681cc24289c26998), +W64LIT(0x1a07caea5fca6726), +W64LIT(0x82c5aca0d8acd170), +W64LIT(0x25dcf8da7bf8ba9d), +W64LIT(0xc7c6de1b6dde7cf0), +W64LIT(0xc35dfaf0b4fa4348), +W64LIT(0xded70fc3ef0f76a4), +W64LIT(0x504acfaba9cfe6e9), +W64LIT(0xc571cc94fbcc99ac), +W64LIT(0x5ea5b1eca1b14288), +W64LIT(0xae7b15e4af159d46), +W64LIT(0xc888a9e12ea950bf), +W64LIT(0xf7539bd10a9b8d04), +W64LIT(0x962d180d8f181237), +W64LIT(0xe43610a559101c89), +W64LIT(0x772125fe4425b928), +W64LIT(0x84e99ac4979a0b94), +W64LIT(0xc667d7a626d7f4de), +W64LIT(0xefe343b4c3430f7e), +W64LIT(0xd5025cd2755c6553), +W64LIT(0xa6b85dc7e85de3c3), +W64LIT(0xd61447e0a8470821), +W64LIT(0x3e7a3b8d6f3b5595), +W64LIT(0x52fddd243fdd03b5), +W64LIT(0x8072be2f4ebe342c), +W64LIT(0x12c482c9188219a3), +W64LIT(0x9eee502ec8506cb2), +W64LIT(0xad6d0ed6720ef034), +W64LIT(0x59288e35a58e1042), +W64LIT(0xe21a26c11626c66d), +W64LIT(0x247df16730f132b3), +W64LIT(0xf0dea4080ea4dfce), +W64LIT(0x31344c772c4c79da), +W64LIT(0x4f77281764283659), +W64LIT(0x79ce5bb94c5b1d49), +W64LIT(0x0000000000000000), +W64LIT(0x73ba01159d018690), +W64LIT(0x74373ecc993ed45a), +W64LIT(0xbcbf972db79784e5), +W64LIT(0x4ed621aa2f21be77), +W64LIT(0xd95a301aeb30246e), +W64LIT(0x9c5942a15e4289ee), +W64LIT(0x37187a13637aa33e), +W64LIT(0x276bea55edea5fc1), +W64LIT(0x1c2bfc8e10fcbdc2), +W64LIT(0xed54513b5551ea22), +W64LIT(0x20e6d58ce9d50d0b), +W64LIT(0x3ae11f66b61f6a2d), +W64LIT(0x66f3bc0581bccdf9), +W64LIT(0x2cbeb94477b94c36), +W64LIT(0x99636ff7cc6f3e78), +W64LIT(0x953b033f52037f45), +W64LIT(0xb0e7fbe529fbc5d8), +W64LIT(0x60df8a61ce8a171d), +W64LIT(0x6f91fd9b8dfd3b52), +W64LIT(0xaae0310f7631a2fe), +W64LIT(0xbfa98c1f6a8ce997), +W64LIT(0x8ba7ed3ed4ed27db), +W64LIT(0x98c2664a8766b656), +W64LIT(0x062c36644f36dae4), +W64LIT(0x5570e2fd3be2517f), +W64LIT(0xead96ee2516eb8e8), +W64LIT(0x419856506c569238), +W64LIT(0x23f0cebe34ce6079), +W64LIT(0x309545ca6745f1f4), +W64LIT(0x5a3e950778957d30), +W64LIT(0x617e83dc85839f33), +W64LIT(0xfb0bf71994f7cc39), +W64LIT(0x3ccd2902f929b0c9), +W64LIT(0x70ac1a27401aebe2), +W64LIT(0xcea49f85619f8a5b), +W64LIT(0x39f704546b04075f), +W64LIT(0x0df96575d565c913), +W64LIT(0x08c3482347487e85), +W64LIT(0xd28f630b71633799), +W64LIT(0xecf558861e58620c), +W64LIT(0xc2fcf34dfff3cb66), +W64LIT(0x978c11b0c4119a19), +W64LIT(0x69bdcbffc2cbe1b6), +W64LIT(0xba93a149f8a15e01), +W64LIT(0x51ebc616e2c66ec7), +W64LIT(0x078d3fd9043f52ca), +W64LIT(0x58898788ee87986c), +W64LIT(0x4a4d0541f60581cf), +W64LIT(0xe86e7c6dc77c5db4), +W64LIT(0xee424a09884a8750), +W64LIT(0xcdb284b7bc84e729), +W64LIT(0x65e5a7375ca7a08b), +W64LIT(0x2fa8a276aaa22144), +W64LIT(0xa0946ba3a76b3927), +W64LIT(0xa5ae46f535468eb1), +W64LIT(0x35af689cf5684662), +W64LIT(0x28259dafae9d738e), +W64LIT(0xcf0596382a960275), +W64LIT(0xb6cbcd8166cd1f3c), +W64LIT(0x7e43646048644f83), +W64LIT(0x9bd47d785a7ddb24), +W64LIT(0x432f44dffa447764), +W64LIT(0x9f4f59938359e49c), +W64LIT(0x7d557f52957f22f1), +W64LIT(0x76802c430f2c3106), +W64LIT(0xdc601d4c791d93f8), +W64LIT(0x053a2d56922db796), +W64LIT(0x11d299fbc59974d1), +W64LIT(0xf9bce59602e52965), +W64LIT(0xd8fb39a7a039ac40), +W64LIT(0x340e6121be61ce4c), +W64LIT(0x5f04b851eab8caa6), +W64LIT(0x5db3aade7caa2ffa), +W64LIT(0x1549bd101cbd4b69), +W64LIT(0xff90d3f24dd3f381), +W64LIT(0xafda1c59e41c1568), +W64LIT(0xb146f25862f24df6), +W64LIT(0xa40f4f487e4f069f), +/* box 2 */ +W64LIT(0xa1a35cebf8f0f94c), +W64LIT(0x2c203d650f3f095d), +W64LIT(0x1a2bdaee4084a2a7), +W64LIT(0xd32404574d7bcc68), +W64LIT(0xf785bea594a9adc4), +W64LIT(0xf2eb54456206949c), +W64LIT(0x3f5e334d0475ced1), +W64LIT(0x5994299b835d1f60), +W64LIT(0x785b7989ac204794), +W64LIT(0x025da6a2cf461a41), +W64LIT(0xdf1f3a71f01a901b), +W64LIT(0x27284f018bb77637), +W64LIT(0xe1955a6d694c5310), +W64LIT(0x24a1baf2d9d261ac), +W64LIT(0xe4fbb08d9fe36a48), +W64LIT(0x8d83618ef7cff011), +W64LIT(0x2ac72276abf5279e), +W64LIT(0xf9e32621e68eebf6), +W64LIT(0xbf323fb4d3f86f69), +W64LIT(0xbb888605b8745beb), +W64LIT(0x70dafe1e7acd2f65), +W64LIT(0xd0adf1a41f1edbf3), +W64LIT(0x1e91635f2b089625), +W64LIT(0xee2791b8864818f8), +W64LIT(0x99ce23e4c56c1484), +W64LIT(0xf33f0714ff259946), +W64LIT(0xbd6f99161cbe7528), +W64LIT(0x9f293cf761a63a47), +W64LIT(0xb80173f6ea114c70), +W64LIT(0x6543ef25d54dc62a), +W64LIT(0x39b92c5ea0bfe012), +W64LIT(0x63a4f0367187e8e9), +W64LIT(0x4c0d38a02cddf62f), +W64LIT(0x07334c4239e92319), +W64LIT(0x43bff375c3d9bdc7), +W64LIT(0xca862b4a5f9a7954), +W64LIT(0x5d2e902ae8d12be2), +W64LIT(0x137e0e280b4ac78c), +W64LIT(0xf162a1b630638307), +W64LIT(0x55af17bd3e3c4313), +W64LIT(0x358212781ddebc61), +W64LIT(0x94214e93e52e452d), +W64LIT(0xc18e592edb12063e), +W64LIT(0xec7a371a490e02b9), +W64LIT(0x4963d240da72cf77), +W64LIT(0x41e255d70c9fa786), +W64LIT(0xff0439324244c535), +W64LIT(0x88ed8b6e0160c949), +W64LIT(0x6c163be39e83a301), +W64LIT(0xc534e09fb09e32bc), +W64LIT(0x806c0cf9d78da1b8), +W64LIT(0xdba583c09b96a499), +W64LIT(0x746047af11411be7), +W64LIT(0xf40c4b56c6ccba5f), +W64LIT(0x6270a367eca4e533), +W64LIT(0xd41748157492ef71), +W64LIT(0xeff3c2e91b6b1522), +W64LIT(0x0e66988472274632), +W64LIT(0x534808ae9af66dd0), +W64LIT(0x8231aa5b18cbbbf9), +W64LIT(0xb2dd52c3f3ba3ec0), +W64LIT(0xdd429cd33f5c8a5a), +W64LIT(0x4e509e02e39bec6e), +W64LIT(0x26fc1c5016947bed), +W64LIT(0xd9f8256254d0bed8), +W64LIT(0x0955d4c64bce652b), +W64LIT(0x1610e4c8fde5fed4), +W64LIT(0x6dc268b203a0aedb), +W64LIT(0x2e7d9bc7c079131c), +W64LIT(0xc3d3ff8c14541c7f), +W64LIT(0xd64aeeb7bbd4f530), +W64LIT(0xab7f7ddee15b8bfc), +W64LIT(0x144d426a32a3e495), +W64LIT(0x8e0a947da5aae78a), +W64LIT(0x798f2ad831034a4e), +W64LIT(0x3be48afc6ff9fa53), +W64LIT(0x529c5bff07d5600a), +W64LIT(0xbee66ce54edb62b3), +W64LIT(0x931202d1dcc76634), +W64LIT(0x50c1fd5dc8937a4b), +W64LIT(0xa4cdb60b0e5fc014), +W64LIT(0x57f2b11ff17a5952), +W64LIT(0x47054ac4a8558945), +W64LIT(0x5a1ddc68d13808fb), +W64LIT(0x5cfac37b75f22638), +W64LIT(0xc207acdd897711a5), +W64LIT(0x289a84d464b33ddf), +W64LIT(0xc05a0a7f46310be4), +W64LIT(0xe6a6162f50a57009), +W64LIT(0x06e71f13a4ca2ec3), +W64LIT(0x5f733688279731a3), +W64LIT(0xeb497b5870e721a0), +W64LIT(0xb667eb7298360a42), +W64LIT(0xe3c8fccfa60a4951), +W64LIT(0xe772457ecd867dd3), +W64LIT(0x6978d103682c9a59), +W64LIT(0x0def6d77204251a9), +W64LIT(0xc90fdeb90dff6ecf), +W64LIT(0xd179a2f5823dd629), +W64LIT(0x2fa9c8965d5a1ec6), +W64LIT(0x81b85fa84aaeac62), +W64LIT(0xdc96cf82a27f8780), +W64LIT(0x602d05c523e2ff72), +W64LIT(0x19a22f1d12e1b53c), +W64LIT(0xe52fe3dc02c06792), +W64LIT(0x58407aca1e7e12ba), +W64LIT(0x61f95694bec1f2a8), +W64LIT(0x48b781114751c2ad), +W64LIT(0xaaab2e8f7c788626), +W64LIT(0x04bab9b16b8c3482), +W64LIT(0x2df46e34921c0487), +W64LIT(0x1123a88ac40cddcd), +W64LIT(0xc6bd156ce2fb2527), +W64LIT(0x7f6835cb95c9648d), +W64LIT(0x83e5f90a85e8b623), +W64LIT(0x4f84cd537eb8e1b4), +W64LIT(0x294ed785f9903005), +W64LIT(0x1cccc5fde44e8c64), +W64LIT(0xcb52781bc2b9748e), +W64LIT(0x1d1896ac796d81be), +W64LIT(0xb30901926e99331a), +W64LIT(0xad9862cd4591a53f), +W64LIT(0xc8db8de890dc6315), +W64LIT(0x7bd28c7afe45500f), +W64LIT(0x0adc213519ab72b0), +W64LIT(0xa8f6882db33e9c67), +W64LIT(0xb5ee1e81ca531dd9), +W64LIT(0x201b0343b25e552e), +W64LIT(0x4036068691bcaa5c), +W64LIT(0xae11973e17f4b2a4), +W64LIT(0x9efd6fa6fc85379d), +W64LIT(0x33650d6bb91492a2), +W64LIT(0x3a30d9adf2daf789), +W64LIT(0x0c3b3e26bd615c73), +W64LIT(0xf651edf4098aa01e), +W64LIT(0x710ead4fe7ee22bf), +W64LIT(0x3138abc9765288e3), +W64LIT(0x9d749a55aee02006), +W64LIT(0x6e4b9d4151c5b940), +W64LIT(0x84d6b548bc01953a), +W64LIT(0x360be78b4fbbabfa), +W64LIT(0xa22aa918aa95eed7), +W64LIT(0xedae644bd42d0f63), +W64LIT(0x46d119953576849f), +W64LIT(0x6497bc74486ecbf0), +W64LIT(0xfbbe808329c8f1b7), +W64LIT(0x4aea27b38817d8ec), +W64LIT(0x5626e24e6c595488), +W64LIT(0x056eeae0f6af3958), +W64LIT(0x4558ec6667139304), +W64LIT(0x448cbf37fa309ede), +W64LIT(0x6f9fce10cce6b49a), +W64LIT(0xa0770fba65d3f496), +W64LIT(0x671e49871a0bdc6b), +W64LIT(0xda71d09106b5a943), +W64LIT(0x08818797d6ed68f1), +W64LIT(0xa3fefa4937b6e30d), +W64LIT(0xb080f4613cfc2481), +W64LIT(0x763de10dde0701a6), +W64LIT(0x4dd96bf1b1fefbf5), +W64LIT(0x92c6518041e46bee), +W64LIT(0x3456412980fdb1bb), +W64LIT(0x981a70b5584f195e), +W64LIT(0x3d0395efcb33d490), +W64LIT(0xba5cd55425575631), +W64LIT(0x4b3e74e21534d536), +W64LIT(0x6af124f03a498dc2), +W64LIT(0x7ebc669a08ea6957), +W64LIT(0x30ecf898eb718539), +W64LIT(0xa922db7c2e1d91bd), +W64LIT(0x7a06df2b63665dd5), +W64LIT(0xb154a730a1df295b), +W64LIT(0xfc8dccc11021d2ae), +W64LIT(0xcfe8c1aaa935400c), +W64LIT(0x97a8bb60b74b52b6), +W64LIT(0x18767c4c8fc2b8e6), +W64LIT(0x9a47d6179709031f), +W64LIT(0x0000000000000000), +W64LIT(0xac4c319cd8b2a8e5), +W64LIT(0xb9d520a7773241aa), +W64LIT(0xdecb69206d399dc1), +W64LIT(0x1f45300eb62b9bff), +W64LIT(0x10f7fbdb592fd017), +W64LIT(0x3e8a601c9956c30b), +W64LIT(0x8502e619212298e0), +W64LIT(0xf5d818075befb785), +W64LIT(0x547b44eca31f4ec9), +W64LIT(0x9ca0c90433c32ddc), +W64LIT(0xe041093cf46f5eca), +W64LIT(0xa69010a9c119da55), +W64LIT(0xc769463d7fd828fd), +W64LIT(0xc4e0b3ce2dbd3f66), +W64LIT(0x2575e9a344f16c76), +W64LIT(0x01d453519d230dda), +W64LIT(0xfa6ad3d2b4ebfc6d), +W64LIT(0xd5c31b44e9b1e2ab), +W64LIT(0xf83775707bade62c), +W64LIT(0xbcbbca47819d78f2), +W64LIT(0xd79ebde626f7f8ea), +W64LIT(0x5bc98f394c1b0521), +W64LIT(0x2246a5e17d184f6f), +W64LIT(0x12aa5d799669ca56), +W64LIT(0x5ea765d9bab43c79), +W64LIT(0x8939d83f9c43c493), +W64LIT(0x32b15e3a24379f78), +W64LIT(0xe914ddfabfa13be1), +W64LIT(0x909bf7228ea271af), +W64LIT(0x73530bed28a838fe), +W64LIT(0xd2f05706d058c1b2), +W64LIT(0xfed06a63df67c8ef), +W64LIT(0xb43a4dd057701003), +W64LIT(0xa519e55a937ccdce), +W64LIT(0x75b414fe8c62163d), +W64LIT(0xafc5c46f8ad7bf7e), +W64LIT(0x2392f6b0e03b42b5), +W64LIT(0x386d7f0f3d9cedc8), +W64LIT(0x21cf50122f7d58f4), +W64LIT(0x9b9385460a2a0ec5), +W64LIT(0x5115ae0c55b07791), +W64LIT(0x0fb2cbd5ef044be8), +W64LIT(0xea9d2809edc42c7a), +W64LIT(0xcc613459fb505797), +W64LIT(0x426ba0245efab01d), +W64LIT(0x1599113baf80e94f), +W64LIT(0x7d3593695a8f7ecc), +W64LIT(0x0389f5f35265179b), +W64LIT(0x875f40bbee6482a1), +W64LIT(0x95f51dc2780d48f7), +W64LIT(0x7ce1c038c7ac7316), +W64LIT(0xce3c92fb34164dd6), +W64LIT(0xcdb5670866735a4d), +W64LIT(0x8ab02dccce26d308), +W64LIT(0x914fa47313817c75), +W64LIT(0x8b647e9d5305ded2), +W64LIT(0xd82c7633c9f3b302), +W64LIT(0x728758bcb58b3524), +W64LIT(0xe8c08eab2282363b), +W64LIT(0x8fdec72c3889ea50), +W64LIT(0x2b13712736d62a44), +W64LIT(0x3cd7c6be5610d94a), +W64LIT(0x37dfb4dad298a620), +W64LIT(0x868b13ea73478f7b), +W64LIT(0xb7b3b82305150798), +W64LIT(0x0b08726484887f6a), +W64LIT(0x1bff89bfdda7af7d), +W64LIT(0x77e9b25c43240c7c), +W64LIT(0xf0b6f2e7ad408edd), +W64LIT(0x17c4b79960c6f30e), +W64LIT(0x8c5732df6aecfdcb), +W64LIT(0x68ac8252f50f9783), +W64LIT(0x66ca1ad68728d1b1), +W64LIT(0x6b2577a1a76a8018), +W64LIT(0xe21caf9e3b29448b), +W64LIT(0xa74443f85c3ad78f), +W64LIT(0xfd599f908d02df74), +W64LIT(0x967ce8312a685f6c), +/* box 3 */ +W64LIT(0xfa7b9775ba3af751), +W64LIT(0x03ef98cb769c2d13), +W64LIT(0x7191ce067072359e), +W64LIT(0xbab18b6bff7516a8), +W64LIT(0xe6e5ef4efbc1065e), +W64LIT(0x7bec74a3b1d0dbf4), +W64LIT(0x656b4fb907c31c4a), +W64LIT(0x4e8520f99fc86304), +W64LIT(0x8fd8df31d16dae58), +W64LIT(0x90a93fc1e60a7244), +W64LIT(0x30ad09f2b449cfc5), +W64LIT(0x8453be7e91bb5b90), +W64LIT(0x1d68a3d1c08feaad), +W64LIT(0x5c54642504b410f6), +W64LIT(0x8061383c8a9e3707), +W64LIT(0xf9940fbecca6da42), +W64LIT(0x46e1d97da982bbdf), +W64LIT(0xfc50521656f7ad77), +W64LIT(0x5e4d2704f35c2647), +W64LIT(0x8bea5973ca48c2cf), +W64LIT(0xd06323dfa34593bd), +W64LIT(0x62b651306a7a5dce), +W64LIT(0xa436b0714966d116), +W64LIT(0x4f73fb131ebc78a6), +W64LIT(0x92b07ce011e244f5), +W64LIT(0x33429139c2d5e2d6), +W64LIT(0xcee418c515565403), +W64LIT(0xd7be3d56cefcd239), +W64LIT(0x53ed83285f4789a9), +W64LIT(0xf3e9b51b0d043428), +W64LIT(0x20650e0fd8dd8a86), +W64LIT(0xb6e7f4add21aa2e4), +W64LIT(0x6d0fb63d3189c491), +W64LIT(0x0da0a42cac1bafee), +W64LIT(0x3f14eeffefba569a), +W64LIT(0x13279f361a086850), +W64LIT(0x9b225e8ea6dc878c), +W64LIT(0x6684d772715f3159), +W64LIT(0xa3ebaef824df9092), +W64LIT(0xc499a260d4f4ba69), +W64LIT(0xaa798c9693e153eb), +W64LIT(0x50021be329dba4ba), +W64LIT(0x949bb983fd2f1ed3), +W64LIT(0xdfdac4d2f8b60ae2), +W64LIT(0xf0062dd07b98193b), +W64LIT(0xafbdd13e09b024de), +W64LIT(0xb95e13a089e93bbb), +W64LIT(0x649d945386b707e8), +W64LIT(0xe4fcac6f0c2930ef), +W64LIT(0x413cc7f4c43bfa5b), +W64LIT(0x3b2668bdf49f3a0d), +W64LIT(0xe50a77858d5d2b4d), +W64LIT(0x05c45da89a517735), +W64LIT(0x3ee235156ece4d38), +W64LIT(0xfe491137a11f9bc6), +W64LIT(0xb7112f47536eb946), +W64LIT(0x07dd1e896db94184), +W64LIT(0x1ab5bd58ad36ab29), +W64LIT(0x8197e3d60bea2ca5), +W64LIT(0xab8f577c12954849), +W64LIT(0x9cff4007cb65c608), +W64LIT(0xa00436335243bd81), +W64LIT(0xfda689fcd783b6d5), +W64LIT(0xccfd5be4e2be62b2), +W64LIT(0x75a348446b575909), +W64LIT(0x17151974012d04c7), +W64LIT(0xfb8d4c9f3b4eecf3), +W64LIT(0xac5249f57f2c09cd), +W64LIT(0x9346a70a90965f57), +W64LIT(0x043286421b256c97), +W64LIT(0x27b81086b564cb02), +W64LIT(0x3569545a2e18b8f0), +W64LIT(0x6b24735edd449eb7), +W64LIT(0x2193d5e559a99124), +W64LIT(0xc7763aaba268977a), +W64LIT(0xb0cc31ce3ed7f8c2), +W64LIT(0xc939064c78ef1587), +W64LIT(0x16e3c29e80591f65), +W64LIT(0x5da2bfcf85c00b54), +W64LIT(0x5990398d9ee567c3), +W64LIT(0x67720c98f02b2afb), +W64LIT(0x54309da132fec82d), +W64LIT(0xeab39088d6aeb212), +W64LIT(0x9682faa20ac72862), +W64LIT(0xd38cbb14d5d9beae), +W64LIT(0x4c9c63d8682055b5), +W64LIT(0xd648e6bc4f88c99b), +W64LIT(0xdc355c198e2a27f1), +W64LIT(0x10c807fd6c944543), +W64LIT(0x450e41b6df1e96cc), +W64LIT(0x0b8b614f40d6f5c8), +W64LIT(0xd27a60fe54ada50c), +W64LIT(0x49583e70f2712280), +W64LIT(0x8dc19c10268598e9), +W64LIT(0x5866e2671f917c61), +W64LIT(0x79f537824638ed45), +W64LIT(0xc2b267033839e04f), +W64LIT(0xcb20456d8f072336), +W64LIT(0x2a18b4aa197f64ec), +W64LIT(0xdbe84290e3936675), +W64LIT(0x73888d27879a032f), +W64LIT(0xe8aad3a9214684a3), +W64LIT(0x6ee02ef64715e982), +W64LIT(0xa996145de57d7ef8), +W64LIT(0xc8cfdda6f99b0e25), +W64LIT(0x062bc563eccd5a26), +W64LIT(0x264ecb6c3410d0a0), +W64LIT(0xb8a8c84a089d2019), +W64LIT(0x7dc7b1c05d1d81d2), +W64LIT(0xd5a77e773914e488), +W64LIT(0x4b417d5105991431), +W64LIT(0xf62de8b39755431d), +W64LIT(0x993b1daf5134b13d), +W64LIT(0x82787b1d7d7601b6), +W64LIT(0xe321b2e66190716b), +W64LIT(0xb5086c66a4868ff7), +W64LIT(0x9ee603263c8df0b9), +W64LIT(0x349f8fb0af6ca352), +W64LIT(0x5b897aac690d5172), +W64LIT(0x7c316a2adc699a70), +W64LIT(0xd451a59db860ff2a), +W64LIT(0x706715ecf1062e3c), +W64LIT(0x838ea0f7fc021a14), +W64LIT(0x57df056a4462e53e), +W64LIT(0xcf12c32f94224fa1), +W64LIT(0xed6e8e01bb17f396), +W64LIT(0x915fe42b677e69e6), +W64LIT(0x89f31a523da0f47e), +W64LIT(0xe71334a47ab51dfc), +W64LIT(0xa860cfb76409655a), +W64LIT(0x9f10d8ccbdf9eb1b), +W64LIT(0xef77cd204cffc527), +W64LIT(0xf862d4544dd2c1e0), +W64LIT(0x8a1c82994b3cd96d), +W64LIT(0xae4b0ad488c43f7c), +W64LIT(0x98cdc645d040aa9f), +W64LIT(0x7fdef2e1aaf5b763), +W64LIT(0x4717029728f6a07d), +W64LIT(0x745593aeea2342ab), +W64LIT(0xee8116cacd8bde85), +W64LIT(0x727e56cd06ee188d), +W64LIT(0x227c4d2e2f35bc37), +W64LIT(0x977421488bb333c0), +W64LIT(0xa21d7512a5ab8b30), +W64LIT(0xbb4750817e010d0a), +W64LIT(0x6cf96dd7b0fddf33), +W64LIT(0x2801f78bee97525d), +W64LIT(0x1c9e783b41fbf10f), +W64LIT(0x9d099bed4a11ddaa), +W64LIT(0x7a1aaf4930a4c056), +W64LIT(0x32b44ad343a1f974), +W64LIT(0x3cfb763499267b89), +W64LIT(0xb2d572efc93fce73), +W64LIT(0x63408adaeb0e466c), +W64LIT(0xada4921ffe58126f), +W64LIT(0x5fbbfcee72283de5), +W64LIT(0x6ad2a8b45c308515), +W64LIT(0x0c567fc62d6fb44c), +W64LIT(0x956d62697c5b0571), +W64LIT(0x25a153a7428cfdb3), +W64LIT(0x150c5a55f6c53276), +W64LIT(0xe2d7690ce0e46ac9), +W64LIT(0xda1e997a62e77dd7), +W64LIT(0xf5c27078e1c96e0e), +W64LIT(0xc344bce9b94dfbed), +W64LIT(0x60af12119d926b7f), +W64LIT(0xa1f2edd9d337a623), +W64LIT(0xcad69e870e733894), +W64LIT(0x3770177bd9f08e41), +W64LIT(0xa5c06b9bc812cab4), +W64LIT(0x1f71e0f03767dc1c), +W64LIT(0x44f89a5c5e6a8d6e), +W64LIT(0x6159c9fb1ce670dd), +W64LIT(0x8e2e04db5019b5fa), +W64LIT(0x8805c1b8bcd4efdc), +W64LIT(0xe138f1c7967847da), +W64LIT(0x4ab7a6bb84ed0f93), +W64LIT(0x0000000000000000), +W64LIT(0x38c9f0768203171e), +W64LIT(0x1b4366b22c42b08b), +W64LIT(0x7803ec68c74cf6e7), +W64LIT(0xec9855eb3a63e834), +W64LIT(0xbe830d29e4507a3f), +W64LIT(0x2dc5aa2374c62568), +W64LIT(0xa62ff350be8ee7a7), +W64LIT(0x764cd08f1dcb741a), +W64LIT(0x8c3747faa7f1834b), +W64LIT(0x0fb9e70d5bf3995f), +W64LIT(0x55c6464bb38ad38f), +W64LIT(0xf7db3359162158bf), +W64LIT(0xd195f8352231881f), +W64LIT(0x0992226eb73ec379), +W64LIT(0x14fa81bf77b129d4), +W64LIT(0x48aee59a73053922), +W64LIT(0x2457884dc3f8e611), +W64LIT(0xffbfcadd206b8064), +W64LIT(0xb4feb78c25f29455), +W64LIT(0x864afd5f66536d21), +W64LIT(0x6f16f51cc661f220), +W64LIT(0xde2c1f3879c21140), +W64LIT(0x195a2593dbaa863a), +W64LIT(0x2e2a32e8025a087b), +W64LIT(0x432584d533d3ccea), +W64LIT(0x2c3371c9f5b23eca), +W64LIT(0xa7d928ba3ffafc05), +W64LIT(0x42d35f3fb2a7d748), +W64LIT(0x85a5659410cf4032), +W64LIT(0x0864f984364ad8db), +W64LIT(0xf21f6ef18c702f8a), +W64LIT(0xf1f0f63afaec0299), +W64LIT(0xd9f101b1147b50c4), +W64LIT(0x2fdce902832e13d9), +W64LIT(0x4d6ab832e9544e17), +W64LIT(0xe0ce2a2d170c5c78), +W64LIT(0x51f4c009a8afbf18), +W64LIT(0x68cbeb95abd8b3a4), +W64LIT(0xc15dffc84ea5cd5c), +W64LIT(0x02194321f7e836b1), +W64LIT(0x113edc17ede05ee1), +W64LIT(0x521b58c2de33920b), +W64LIT(0x9ad4856427a89c2e), +W64LIT(0x5629de80c516fe9c), +W64LIT(0x77ba0b659cbf6fb8), +W64LIT(0x238a96c4ae41a795), +W64LIT(0x12d144dc9b7c73f2), +W64LIT(0xd807da5b950f4b66), +W64LIT(0x3686cc91588495e3), +W64LIT(0x18acfe795ade9d98), +W64LIT(0x5a7fa146e8794ad0), +W64LIT(0xc680e141231c8cd8), +W64LIT(0x1e873b1ab613c7be), +W64LIT(0xf434ab9260bd75ac), +W64LIT(0xcd0b800e63ca7910), +W64LIT(0xbc9a4e0813b84c8e), +W64LIT(0x3d0dadde1852602b), +W64LIT(0x40ca1c1e454fe1f9), +W64LIT(0x0a7dbaa5c1a2ee6a), +W64LIT(0x693d307f2aaca806), +W64LIT(0x0e4f3ce7da8782fd), +W64LIT(0xbd6c95e292cc572c), +W64LIT(0x3ad0b35775eb21af), +W64LIT(0x7e28290b2b81acc1), +W64LIT(0x01f6dbea81741ba2), +W64LIT(0x87bc26b5e7277683), +W64LIT(0x393f2b9c03770cbc), +W64LIT(0xddc387f30f5e3c53), +W64LIT(0xeb454b6257daa9b0), +W64LIT(0xb323a905484bd5d1), +W64LIT(0xb13aea24bfa3e360), +W64LIT(0x315bd218353dd467), +W64LIT(0x2bee6f40980b7f4e), +W64LIT(0xe95c0843a0329f01), +W64LIT(0xc56f798a5580a1cb), +W64LIT(0xbf75d6c36524619d), +W64LIT(0x29f72c616fe349ff), +W64LIT(0xc0ab2422cfd1d6fe), +/* box 4 */ +W64LIT(0x561fc423e957943c), +W64LIT(0x014287ca69079288), +W64LIT(0x2f086129dfcd1d21), +W64LIT(0xc537d4aea044fd99), +W64LIT(0xf1e8c3bfd7c8a457), +W64LIT(0x2971998a5cdf9bfb), +W64LIT(0x23fa649a2ce9e460), +W64LIT(0x3aa9e9c356a6716a), +W64LIT(0xd6efa4e7aa3d1708), +W64LIT(0x705a24b1fda5b5eb), +W64LIT(0x101e0ce2b170a9fc), +W64LIT(0x7ca821020e814caa), +W64LIT(0x0bc97ada1931ed13), +W64LIT(0x34df1711778c59ce), +W64LIT(0xd35020ef9226d2bf), +W64LIT(0x575d43e9805006b4), +W64LIT(0x91acebec9b1db840), +W64LIT(0x549b3f423b5945d9), +W64LIT(0x99a3ed9d3925163e), +W64LIT(0x7917a50a369a891d), +W64LIT(0xe372343cb4b6dc4e), +W64LIT(0x8d40e2bdd949e8fd), +W64LIT(0xcfbc29bed0728202), +W64LIT(0x969794857108ac12), +W64LIT(0xdd26de3db30cfa1b), +W64LIT(0x115c8b28d8773b74), +W64LIT(0xe9f9c92cc480a3d5), +W64LIT(0x4dc8b21b4116d0d3), +W64LIT(0x316093194f979c79), +W64LIT(0x5124bb4a0342806e), +W64LIT(0xb31408bcdef3cea8), +W64LIT(0xc1cad76cf158aaa6), +W64LIT(0x88ff66b5e1522d4a), +W64LIT(0xa8c37e8476b28a47), +W64LIT(0x15a188ea896b6c4b), +W64LIT(0xa24883940684f5dc), +W64LIT(0xda1da1545919ee49), +W64LIT(0x22b8e35045ee76e8), +W64LIT(0x6106af9925d28e9f), +W64LIT(0xef80318f4792250f), +W64LIT(0x663dd0f0cfc79acd), +W64LIT(0x302214d326900ef1), +W64LIT(0xdfa2255c61022bfe), +W64LIT(0xe6cdb0348cad19f9), +W64LIT(0x50663c806a4512e6), +W64LIT(0x65fbac5b74ced9a0), +W64LIT(0xc4755364c9436f11), +W64LIT(0x8fc419dc0b473918), +W64LIT(0x5c9439339961eba7), +W64LIT(0x3f166dcb6ebdb4dd), +W64LIT(0xba59890715ccf25e), +W64LIT(0xf0aa4475becf36df), +W64LIT(0x03c67cabbb09436d), +W64LIT(0xb99ff5acaec5b133), +W64LIT(0xf9e7c5ce75f00a29), +W64LIT(0x6df4aa2ad6f677de), +W64LIT(0xaeba8627f5a00c9d), +W64LIT(0xa573fcfdec91e18e), +W64LIT(0x7f6e5da9b5880fc7), +W64LIT(0xca03adb6e86947b5), +W64LIT(0x74a72773acb9e2d4), +W64LIT(0x604428534cd51c17), +W64LIT(0xf8a542041cf798a1), +W64LIT(0x448533a08a29ec25), +W64LIT(0x80f060c4436a8334), +W64LIT(0x0db082799a236bc9), +W64LIT(0xfa21b965cef94944), +W64LIT(0x64b92b911dc94b28), +W64LIT(0x7118a37b94a22763), +W64LIT(0xaff801ed9ca79e15), +W64LIT(0x1dae8e9b2b53c235), +W64LIT(0x13d870490a79ea91), +W64LIT(0x8a7b9dd4335cfcaf), +W64LIT(0x1f2a75faf95d13d0), +W64LIT(0xeec2b6452e95b787), +W64LIT(0xc34e2c0d23567b43), +W64LIT(0x47434f0b3120af48), +W64LIT(0xa18eff3fbd8db6b1), +W64LIT(0x98e16a57502284b6), +W64LIT(0x37196bbacc851aa3), +W64LIT(0x8e869e166240ab90), +W64LIT(0x9fda153eba3790e4), +W64LIT(0xf515c07d86d4f368), +W64LIT(0x72dedfd02fab640e), +W64LIT(0xe230b3f6ddb14ec6), +W64LIT(0x97d5134f180f3e9a), +W64LIT(0xe1f6cf5d66b80dab), +W64LIT(0xe78f37fee5aa8b71), +W64LIT(0xa30a045e6f836754), +W64LIT(0x90ee6c26f21a2ac8), +W64LIT(0xaa4785e5a4bc5ba2), +W64LIT(0x4e0eceb0fa1f93be), +W64LIT(0x94136fe4a3067df7), +W64LIT(0x7b935e6be49458f8), +W64LIT(0x9b2716fceb2bc7db), +W64LIT(0x840d63061276d40b), +W64LIT(0xed04caee959cf4ea), +W64LIT(0xea3fb5877f89e0b8), +W64LIT(0xb56df01f5de14872), +W64LIT(0x4935b1d9100a87ec), +W64LIT(0x82749ba5916452d1), +W64LIT(0x58693af1c87dbc98), +W64LIT(0x89bde17f8855bfc2), +W64LIT(0x677f573aa6c00845), +W64LIT(0xeb7d324d168e7230), +W64LIT(0x0284fb61d20ed1e5), +W64LIT(0xb190f3dd0cfd1f4d), +W64LIT(0x684b2e22eeedb269), +W64LIT(0x2bf562eb8ed14a1e), +W64LIT(0xe0b448970fbf9f23), +W64LIT(0x396f9568edaf3207), +W64LIT(0x52e2c7e1b84bc303), +W64LIT(0x77615bd817b0a1b9), +W64LIT(0x7e2cda63dc8f9d4f), +W64LIT(0xf22ebf146cc1e73a), +W64LIT(0xc08850a6985f382e), +W64LIT(0xd9dbddffe210ad24), +W64LIT(0xbfe60d0f2dd737e9), +W64LIT(0x9a659136822c5553), +W64LIT(0x87cb1fada97f9766), +W64LIT(0x4c8a35d12811425b), +W64LIT(0x83361c6ff863c059), +W64LIT(0xd212a725fb214037), +W64LIT(0x9e9892f4d330026c), +W64LIT(0x45c7b46ae32e7ead), +W64LIT(0x5baf465a7374fff5), +W64LIT(0xdc6459f7da0b6893), +W64LIT(0xd46b5f867833c6ed), +W64LIT(0x5dd6bef9f066792f), +W64LIT(0xcb412a7c816ed53d), +W64LIT(0x75e5a0b9c5be705c), +W64LIT(0xf6d3bcd63dddb005), +W64LIT(0xfb633eafa7fedbcc), +W64LIT(0xd529d84c11345465), +W64LIT(0xc9c5d11d536004d8), +W64LIT(0xdb5f269e301e7cc1), +W64LIT(0x86899867c07805ee), +W64LIT(0x3d9296aabcb36538), +W64LIT(0x2cce1d8264c45e4c), +W64LIT(0x5aedc1901a736d7d), +W64LIT(0x2e4ae6e3b6ca8fa9), +W64LIT(0x1e68f230905a8158), +W64LIT(0xdee0a2960805b976), +W64LIT(0xcd38d2df027c53e7), +W64LIT(0x6909a9e887ea20e1), +W64LIT(0x24c11bf3c6fcf032), +W64LIT(0x18110a9313480782), +W64LIT(0xa7f7079c3e9f306b), +W64LIT(0xd8995a358b173fac), +W64LIT(0x854fe4cc7b714683), +W64LIT(0xbd62f66effd9e60c), +W64LIT(0x14e30f20e06cfec3), +W64LIT(0x6e32d6816dff34b3), +W64LIT(0x217e9ffbfee73585), +W64LIT(0xc88756d73a679650), +W64LIT(0x359d90db1e8bcb46), +W64LIT(0x2645e09214f221d7), +W64LIT(0x04fd03c2511c573f), +W64LIT(0x739c581a46acf686), +W64LIT(0xb0d2741765fa8dc5), +W64LIT(0xa0cc78f5d48a2439), +W64LIT(0x5e10c2524b6f3a42), +W64LIT(0xe50bcc9f37a45a94), +W64LIT(0x53a0402bd14c518b), +W64LIT(0x413ab7a8b2322992), +W64LIT(0x203c183197e0a70d), +W64LIT(0xcc7a55156b7bc16f), +W64LIT(0x4601c8c158273dc0), +W64LIT(0xbea48ac544d0a561), +W64LIT(0x638254f8f7dc5f7a), +W64LIT(0xa6b580565798a2e3), +W64LIT(0x3cd01160d5b4f7b0), +W64LIT(0x8c026577b04e7a75), +W64LIT(0x7ad1d9a18d93ca70), +W64LIT(0x785522c05f9d1b95), +W64LIT(0x5f5245982268a8ca), +W64LIT(0x9551e82eca01ef7f), +W64LIT(0x0000000000000000), +W64LIT(0xbb1b0ecd7ccb60d6), +W64LIT(0x094d81bbcb3f3cf6), +W64LIT(0x28331e4035d80973), +W64LIT(0xf7913b1c54da228d), +W64LIT(0x6acfd5433ce3638c), +W64LIT(0x1bd77638a84144ef), +W64LIT(0x62c0d3329edbcdf2), +W64LIT(0x81b2e70e2a6d11bc), +W64LIT(0xd7ad232dc33a8580), +W64LIT(0x05bf8408381bc5b7), +W64LIT(0x33e468789d994d9c), +W64LIT(0xfedcbaa79fe51e7b), +W64LIT(0x4f4c497a93180136), +W64LIT(0x073b7f69ea151452), +W64LIT(0x0cf205b3f324f941), +W64LIT(0x382d12a284a8a08f), +W64LIT(0x1cec0951425450bd), +W64LIT(0x55d9b888525ed751), +W64LIT(0x6cb62de0bff1e556), +W64LIT(0xd1d4db8e4028035a), +W64LIT(0x25839c39affb62ba), +W64LIT(0x4af3cd72ab03c481), +W64LIT(0xa4317b3785967306), +W64LIT(0x1a95f1f2c146d667), +W64LIT(0x926a97472014fb2d), +W64LIT(0xb7e90b7e8fef9997), +W64LIT(0xcefeae74b975108a), +W64LIT(0x3e54ea0107ba2655), +W64LIT(0xd0965c44292f91d2), +W64LIT(0xab05022fcdbbc92a), +W64LIT(0xfd1ac60c24ec5d16), +W64LIT(0xfc5841c64debcf9e), +W64LIT(0xe4494b555ea3c81c), +W64LIT(0xb6ab8cb4e6e80b1f), +W64LIT(0x3beb6e093fa1e3e2), +W64LIT(0xf36c38de05c675b2), +W64LIT(0x9c1c6995013ed389), +W64LIT(0x8b391a1e5a5b6e27), +W64LIT(0xec464d24fc9b6662), +W64LIT(0xad7cfa8c4ea94ff0), +W64LIT(0x0f347918482dba2c), +W64LIT(0x9d5eee5f68394101), +W64LIT(0x7623dc127eb73331), +W64LIT(0x32a6efb2f49edf14), +W64LIT(0x2d8c9a480dc3ccc4), +W64LIT(0xb2568f76b7f45c20), +W64LIT(0x0e76fed2212a28a4), +W64LIT(0x48773613790d1564), +W64LIT(0x129af783637e7819), +W64LIT(0x080f0671a238ae7e), +W64LIT(0x365bec70a582882b), +W64LIT(0x42fccb03093b6aff), +W64LIT(0x0a8bfd1070367f9b), +W64LIT(0xff9e3d6df6e28cf3), +W64LIT(0xe8bb4ee6ad87315d), +W64LIT(0xc7b32fcf724a2c7c), +W64LIT(0xb8dd7266c7c223bb), +W64LIT(0x9328108d491369a5), +W64LIT(0x0679f8a3831286da), +W64LIT(0x270767587df5b35f), +W64LIT(0xa981f94e1fb518cf), +W64LIT(0x6b8d528955e4f104), +W64LIT(0x1667f44132622f26), +W64LIT(0x2ab7e521e7d6d896), +W64LIT(0xac3e7d4627aedd78), +W64LIT(0x7deaa6c86786de22), +W64LIT(0x1725738b5b65bdae), +W64LIT(0x4bb14ab8c2045609), +W64LIT(0x592bbd3ba17a2e10), +W64LIT(0xc20cabc74a51e9cb), +W64LIT(0x6f70514b04f8a63b), +W64LIT(0xbc2071a496de7484), +W64LIT(0x19538d597a4f950a), +W64LIT(0xf45747b7efd361e0), +W64LIT(0x43be4cc9603cf877), +W64LIT(0xc6f1a8051b4dbef4), +W64LIT(0xb42f77d534e6dafa), +W64LIT(0x40783062db35bb1a), +/* box 5 */ +W64LIT(0xf5a96c292deb0a4e), +W64LIT(0x211c9df6ee653c51), +W64LIT(0x04de5ddcbeeef596), +W64LIT(0xe1e5b06f7457c19f), +W64LIT(0x74ca30f014a54fb6), +W64LIT(0xc296f9f7c5457d85), +W64LIT(0x7d4ee08a484d10b0), +W64LIT(0xae87f2d0bf9b13ad), +W64LIT(0x8df4bb480e89afb7), +W64LIT(0x2d8b7a67d9a2d61e), +W64LIT(0x0f3559c8bd712adb), +W64LIT(0x541bc7312f013338), +W64LIT(0x9ec4848b636d5164), +W64LIT(0x952f809f60f28e29), +W64LIT(0x28984d8cb28d6357), +W64LIT(0xd4b5f1dfc38e361f), +W64LIT(0x5674135f7076b373), +W64LIT(0xb791a330042172ec), +W64LIT(0xab94c53bd4b4a6e4), +W64LIT(0xf17731f59305ffd8), +W64LIT(0x39c7a621801e1dcf), +W64LIT(0x20d1f7c13ba47c8e), +W64LIT(0x5e3da912f95facaa), +W64LIT(0xb1202a82e5b80731), +W64LIT(0x13303fc36de4fed3), +W64LIT(0x2e29c43e5314168a), +W64LIT(0x861fbf5c0d1670fa), +W64LIT(0x6458b16af3f771f1), +W64LIT(0x3043765bdcf642c9), +W64LIT(0x12fd55f4b825be0c), +W64LIT(0x0a266e23d65e9f92), +W64LIT(0x6595db5d2636312e), +W64LIT(0x85bd010587a0b06e), +W64LIT(0x9bd7b3600842e42d), +W64LIT(0xaa59af0c0175e63b), +W64LIT(0x240faa1d854a8918), +W64LIT(0xf464061ef82a4a91), +W64LIT(0x5c527d7ca6282ce1), +W64LIT(0x03a2be598ab6c094), +W64LIT(0x40571b7776bdf8e9), +W64LIT(0xe4f687841f7874d6), +W64LIT(0x115febad32937e98), +W64LIT(0x5108f0da442e8671), +W64LIT(0x9cab50e53c1ad12f), +W64LIT(0x33e1c8025640825d), +W64LIT(0x87d2d56bd8d73025), +W64LIT(0xc0f92d999a32fdce), +W64LIT(0x62e938d8126e042c), +W64LIT(0x4a717554a0e3677b), +W64LIT(0x0beb0414039fdf4d), +W64LIT(0xd6da25b19cf9b654), +W64LIT(0x55d6ad06fac073e7), +W64LIT(0x632452efc7af44f3), +W64LIT(0xb5fe775e5b56f2a7), +W64LIT(0x892ae694b0675a21), +W64LIT(0x7a32030f7c1525b2), +W64LIT(0x5d9f174b73e96c3e), +W64LIT(0xc35b93c010843d5a), +W64LIT(0x373f95dee8ae77cb), +W64LIT(0xfb515fd6455b604a), +W64LIT(0xa9fb11558bc326af), +W64LIT(0x22be23af64d3fcc5), +W64LIT(0xa8367b625e026670), +W64LIT(0xb8a4faf8b9505837), +W64LIT(0x785dd7612362a5f9), +W64LIT(0x588c20a018c6d977), +W64LIT(0xea0eb47b77c81ed2), +W64LIT(0xa6ce489d36b20c74), +W64LIT(0x0c97e79137c7ea4f), +W64LIT(0x7c838abd9d8c506f), +W64LIT(0x57b97968a5b7f3ac), +W64LIT(0x6c110b277ade6e28), +W64LIT(0xc785ce1cae6ac8cc), +W64LIT(0x1581b6718c7d8b0e), +W64LIT(0x614b868198d8c4b8), +W64LIT(0x27ad14440ffc498c), +W64LIT(0xdb80a8177eff1cc4), +W64LIT(0x472bf8f242e5cdeb), +W64LIT(0x8a8858cd3ad19ab5), +W64LIT(0xf60bd270a75dcada), +W64LIT(0x43f5a52efc0b387d), +W64LIT(0x6ddc6110af1f2ef7), +W64LIT(0xf0ba5bc246c4bf07), +W64LIT(0x6fb3b57ef068aebc), +W64LIT(0x18db3bd76e7b219e), +W64LIT(0x903cb7740bdd3b60), +W64LIT(0x7bff6938a9d4656d), +W64LIT(0xbdb7cd13d27fed7e), +W64LIT(0x051337eb6b2fb549), +W64LIT(0x77688ea99e138f22), +W64LIT(0xd9ef7c7921889c8f), +W64LIT(0x077ce38534583502), +W64LIT(0xf318e59bcc727f93), +W64LIT(0xb34ffeecbacf877a), +W64LIT(0xe9ac0a22fd7ede46), +W64LIT(0xfc2dbc5371035548), +W64LIT(0x026fd46e5f77804b), +W64LIT(0xe53bedb3cab93409), +W64LIT(0xcc6eca08adf51781), +W64LIT(0xe028da58a1968140), +W64LIT(0x3a6518780aa8dd5b), +W64LIT(0xce011e66f28297ca), +W64LIT(0xa4a19cf369c58c3f), +W64LIT(0xc5ea1a72f11d4887), +W64LIT(0xc427704524dc0858), +W64LIT(0x4238cf1929ca78a2), +W64LIT(0x481ea13aff94e730), +W64LIT(0xdf5ef5cbc011e952), +W64LIT(0x80ae36eeec8f0527), +W64LIT(0x5ae3f4ce47b1593c), +W64LIT(0xcda3a03f7834575e), +W64LIT(0x71d9071b7f8afaff), +W64LIT(0xcadf43ba4c6c625c), +W64LIT(0x1623082806cb4b9a), +W64LIT(0x17ee621fd30a0b45), +W64LIT(0x448946abc8530d7f), +W64LIT(0x974054f13f850e62), +W64LIT(0x73b6d37520fd7ab4), +W64LIT(0xc8b097d4131be217), +W64LIT(0x9f09eebcb6ac11bb), +W64LIT(0x45442c9c1d924da0), +W64LIT(0x1b79858ee4cde10a), +W64LIT(0x0984d07a5ce85f06), +W64LIT(0x4cc0fce6417a12a6), +W64LIT(0x99b8670e57356466), +W64LIT(0xad254c89352dd339), +W64LIT(0x322ca2358381c282), +W64LIT(0xcfcc74512743d715), +W64LIT(0x6b6de8a24e865b2a), +W64LIT(0xda4dc220ab3e5c1b), +W64LIT(0x88e78ca365a61afe), +W64LIT(0x939e092d816bfbf4), +W64LIT(0xcb12298d99ad2283), +W64LIT(0xeed0e9a7c926eb44), +W64LIT(0x98750d3982f424b9), +W64LIT(0xd5789be8164f76c0), +W64LIT(0xbe15734a58c92dea), +W64LIT(0x49d3cb0d2a55a7ef), +W64LIT(0x67fa0f337941b165), +W64LIT(0x8c39d17fdb48ef68), +W64LIT(0x25c2c02a508bc9c7), +W64LIT(0x349d2b876218b75f), +W64LIT(0x70146d2caa4bba20), +W64LIT(0x1c05660bd095d408), +W64LIT(0xfe42683d2e74d503), +W64LIT(0x9a1ad957dd83a4f2), +W64LIT(0xf2d58fac19b33f4c), +W64LIT(0x81635cd9394e45f8), +W64LIT(0xb65cc907d1e03233), +W64LIT(0xdd3121a59f666919), +W64LIT(0x318e1c6c09370216), +W64LIT(0x8b4532faef10da6a), +W64LIT(0x191651e0bbba6141), +W64LIT(0x3f762f9361876812), +W64LIT(0xb96990cf6c9118e8), +W64LIT(0xb4331d698e97b278), +W64LIT(0xd822164ef449dc50), +W64LIT(0x84706b325261f0b1), +W64LIT(0x4eaf28881e0d92ed), +W64LIT(0x69023ccc11f1db61), +W64LIT(0x66376504ac80f1ba), +W64LIT(0x0849ba4d89291fd9), +W64LIT(0xff8f020afbb595dc), +W64LIT(0x50c59aed91efc6ae), +W64LIT(0x1dc80c3c055494d7), +W64LIT(0x1e6ab2658fe25443), +W64LIT(0x3d19fbfd3ef0e859), +W64LIT(0xfa9c35e1909a2095), +W64LIT(0x52aa4e83ce9846e5), +W64LIT(0x419a7140a37cb836), +W64LIT(0xa07fc12fd72b79a9), +W64LIT(0x68cf56fbc4309bbe), +W64LIT(0x01cd6a37d5c140df), +W64LIT(0x9253631a54aabb2b), +W64LIT(0xd06bac037d60c389), +W64LIT(0x295527bb674c2388), +W64LIT(0xd204786d221743c2), +W64LIT(0x0000000000000000), +W64LIT(0xf7c6b847729c8a05), +W64LIT(0xdcfc4b924aa729c6), +W64LIT(0xe38a64012b2041d4), +W64LIT(0xb28294db6f0ec7a5), +W64LIT(0x9d663ad2e9db91f0), +W64LIT(0x91f1dd43de1c7bbf), +W64LIT(0x6086ecb64d198467), +W64LIT(0x59414a97cd0799a8), +W64LIT(0xace826bee0ec93e6), +W64LIT(0xa56cf6c4bc04cce0), +W64LIT(0x727bb942f53c3a6b), +W64LIT(0x6e7edf4925a9ee63), +W64LIT(0x26607e73da3d0953), +W64LIT(0xe75439dd95ceb442), +W64LIT(0x7990bd56f6a3e526), +W64LIT(0xecbf3dc996516b0f), +W64LIT(0x76a5e49e4bd2cffd), +W64LIT(0x968d3ec6ea444ebd), +W64LIT(0x5b2e9ef9927019e3), +W64LIT(0x6aa082959b471bf5), +W64LIT(0xbb0644a133e698a3), +W64LIT(0x830c88b76639c5b3), +W64LIT(0xe2470e36fee1010b), +W64LIT(0xb0ed40b5307947ee), +W64LIT(0x355041b0b7d9f780), +W64LIT(0x8e560511843f6f23), +W64LIT(0x7f2134e4173a90fb), +W64LIT(0x2af799e2edfae31c), +W64LIT(0x4bbc1f63752227a4), +W64LIT(0xf8f3e18fcfeda0de), +W64LIT(0x0d5a8da6e206aa90), +W64LIT(0x2c4610500c6396c1), +W64LIT(0xde939ffc15d0a98d), +W64LIT(0xaf4a98e76a5a5372), +W64LIT(0x8f9b6f2651fe2ffc), +W64LIT(0x36f2ffe93d6f3714), +W64LIT(0x0ef833ff68b06a04), +W64LIT(0xe69953ea400ff49d), +W64LIT(0x23734998b112bc1a), +W64LIT(0x3ebb45a4b44628cd), +W64LIT(0x1ab4efb9310ca1d5), +W64LIT(0x2fe4ae0986d55655), +W64LIT(0xebc3de4ca2095e0d), +W64LIT(0x536724b41b59063a), +W64LIT(0x46e692c597248d34), +W64LIT(0x2b3af3d5383ba3c3), +W64LIT(0x3ba8724fdf699d84), +W64LIT(0xc13447ae4ff3bd11), +W64LIT(0x4d0d96d194bb5279), +W64LIT(0xfde0d664a4c21597), +W64LIT(0xd7174f864938f68b), +W64LIT(0x7eec5ed3c2fbd024), +W64LIT(0xbfd8197d8d086d35), +W64LIT(0x4f6242bfcbccd232), +W64LIT(0xa70322aae3734cab), +W64LIT(0xa3dd7f765d9db93d), +W64LIT(0x94e2eaa8b533cef6), +W64LIT(0x144cdc4659bccbd1), +W64LIT(0xc648a42b7bab8813), +W64LIT(0xf93e8bb81a2ce001), +W64LIT(0xbacb2e96e627d87c), +W64LIT(0xbc7aa72407beada1), +W64LIT(0xc97dfde3c6daa2c8), +W64LIT(0xa1b2ab1802ea3976), +W64LIT(0x1fa7d8525a23149c), +W64LIT(0x75075ac7c1640f69), +W64LIT(0xe861601528bf9e99), +W64LIT(0xa2101541885cf9e2), +W64LIT(0xef1d83901ce7ab9b), +W64LIT(0x06b189b2e19975dd), +W64LIT(0x380acc1655df5d10), +W64LIT(0x1092819ae7523e47), +W64LIT(0xd3c9125af7d6031d), +W64LIT(0xd1a6c634a8a18356), +W64LIT(0x5ff0c3252c9eec75), +W64LIT(0x82c1e280b3f8856c), +W64LIT(0xed7257fe43902bd0), +W64LIT(0x3cd491caeb31a886), +/* box 6 */ +W64LIT(0x94af9eb6fad9e7df), +W64LIT(0x9208ae5e03c94ddd), +W64LIT(0x1d8de8d67158480b), +W64LIT(0xfd093cd2ba147af8), +W64LIT(0xa45ceb22e6597ccf), +W64LIT(0x9bbde6e77bf113da), +W64LIT(0xe4edf4b465fffe5c), +W64LIT(0x7125622e4e8d2a2f), +W64LIT(0x1791b81b8f68430d), +W64LIT(0xb56a63d1902195c0), +W64LIT(0xa980832b30d2ee67), +W64LIT(0x4c0a7fb384862397), +W64LIT(0xed58bc0d1dc7a05b), +W64LIT(0x5955d7f05c4d0637), +W64LIT(0xd2b9b1c8806fcf4e), +W64LIT(0x06a730e8f910aa02), +W64LIT(0xb8b60bd846aa0768), +W64LIT(0x45bf370afcbe7d90), +W64LIT(0x16f6b0375ec370a1), +W64LIT(0x892276608b81afd4), +W64LIT(0xdcccc1b5d0ec08e7), +W64LIT(0xe856949162df5f58), +W64LIT(0x82592e81a41a977e), +W64LIT(0xac8eabb74fca1164), +W64LIT(0xfac9041692afe356), +W64LIT(0x3b882d75331ba3ba), +W64LIT(0xa39cd3e6cee2e561), +W64LIT(0xd077a190d7cca9e3), +W64LIT(0x9c7dde23534a8a74), +W64LIT(0x80973ed9f3b9f1d3), +W64LIT(0xce535132209cb4e9), +W64LIT(0xaa299b5fb6dabb66), +W64LIT(0x2d7e9d426dd8d31b), +W64LIT(0x8a8b6e140d89fad5), +W64LIT(0x6ca88af83fd56224), +W64LIT(0xf5db7c4713871753), +W64LIT(0xeef1a4799bcff55a), +W64LIT(0x76e55aea6636b381), +W64LIT(0x8ee24ea4a33a367a), +W64LIT(0x25acddd7c44bbeb0), +W64LIT(0x9adaeecbaa5a2076), +W64LIT(0x0e75707d5083c7a9), +W64LIT(0x2bd9adaa94c87919), +W64LIT(0x19e4c866dfeb84a4), +W64LIT(0x129f9087f070bc0e), +W64LIT(0xd9c2e929aff4f7e4), +W64LIT(0x6f01928cb9dd3725), +W64LIT(0x39463d2d64b8c517), +W64LIT(0xebff8ce5e4d70a59), +W64LIT(0xb40d6bfd418aa66c), +W64LIT(0xf21b44833b3c8efd), +W64LIT(0x3654457ce5903112), +W64LIT(0x431807e205aed792), +W64LIT(0xb10343613e92596f), +W64LIT(0x0a1c50cdfe300b06), +W64LIT(0x778252c6b79d802d), +W64LIT(0x0cbb60250720a104), +W64LIT(0xe1e3dc281ae7015f), +W64LIT(0x0f1278518128f405), +W64LIT(0x47712752ab1d1b3d), +W64LIT(0xe24ac45c9cef545e), +W64LIT(0x1ceae0faa0f37ba7), +W64LIT(0x9814fe93fdf946db), +W64LIT(0xec3fb421cc6c93f7), +W64LIT(0x833e26ad75b1a4d2), +W64LIT(0x6b68b23c176efb8a), +W64LIT(0x4904572ffb9edc94), +W64LIT(0x4bca4777ac3dba39), +W64LIT(0x2762cd8f93e8d81d), +W64LIT(0x9eb3ce7b04e9ecd9), +W64LIT(0xc2e8311727bc15ed), +W64LIT(0xea9884c9357c39f5), +W64LIT(0xfc6e34fe6bbf4954), +W64LIT(0x13f898ab21db8fa2), +W64LIT(0xb7a47389c782f36d), +W64LIT(0x7b3932e3b0bd2129), +W64LIT(0xaf27b3c3c9c24465), +W64LIT(0xb6c37ba51629c0c1), +W64LIT(0x84fe1e695d0a3d7c), +W64LIT(0x1a4dd01259e3d1a5), +W64LIT(0xab4e9373677188ca), +W64LIT(0x90c6be06546a2b70), +W64LIT(0xf37c4cafea97bd51), +W64LIT(0x647aca6d96460f8f), +W64LIT(0x4ec46febd325453a), +W64LIT(0x3e8605e94c035cb9), +W64LIT(0x0ddc6809d68b92a8), +W64LIT(0x8bec6638dc22c979), +W64LIT(0x67d3d219104e5a8e), +W64LIT(0x2abea58645634ab5), +W64LIT(0x5b9bc7a80bee609a), +W64LIT(0x936fa672d2627e71), +W64LIT(0x7d9e020b49ad8b2b), +W64LIT(0x5832dfdc8de6359b), +W64LIT(0xc7e6198b58a4eaee), +W64LIT(0xd41e8120797f654c), +W64LIT(0xf4bc746bc22c24ff), +W64LIT(0xe084d404cb4c32f3), +W64LIT(0x48635f032a35ef38), +W64LIT(0x8757061ddb02687d), +W64LIT(0x522e8f1173d63e9d), +W64LIT(0xbcdf2b68e819cbc7), +W64LIT(0xbf76331c6e119ec6), +W64LIT(0x08d24095a9936dab), +W64LIT(0x728c7a5ac8857f2e), +W64LIT(0xd110a9bc06679a4f), +W64LIT(0x1f43f88e26fb2ea6), +W64LIT(0xb2aa5b15b89a0c6e), +W64LIT(0x4aad4f5b7d968995), +W64LIT(0x9fd4c657d542df75), +W64LIT(0x323d65cc4b23fdbd), +W64LIT(0xc38f393bf6172641), +W64LIT(0xa152c3be994183cc), +W64LIT(0x9d1ad60f82e1b9d8), +W64LIT(0xe744ecc0e3f7ab5d), +W64LIT(0x38213501b513f6bb), +W64LIT(0xade9a39b9e6122c8), +W64LIT(0x37334d50343b02be), +W64LIT(0x55eeb7d55b6da733), +W64LIT(0x970686c27cd1b2de), +W64LIT(0x427f0fced405e43e), +W64LIT(0xc026214f701f7340), +W64LIT(0x40b11f9683a68293), +W64LIT(0x02ce105857a366ad), +W64LIT(0x7e371a7fcfa5de2a), +W64LIT(0xffc72c8aedb71c55), +W64LIT(0x68c1aa489166ae8b), +W64LIT(0xc68111a7890fd942), +W64LIT(0x79f722bbe71e4784), +W64LIT(0xd579890ca8d456e0), +W64LIT(0x70426a029f261983), +W64LIT(0xb0644b4def396ac3), +W64LIT(0xdb0cf971f8579149), +W64LIT(0x5489bff98ac6949f), +W64LIT(0x046920b0aeb3ccaf), +W64LIT(0x7cf90a279806b887), +W64LIT(0x050e289c7f18ff03), +W64LIT(0x651dc24147ed3c23), +W64LIT(0x5e95ef3474f69f99), +W64LIT(0x6dcf82d4ee7e5188), +W64LIT(0x8f854688729105d6), +W64LIT(0x81f036f52212c27f), +W64LIT(0xb9d103f4970134c4), +W64LIT(0x5349873da27d0d31), +W64LIT(0x20a2f54bbb5341b3), +W64LIT(0xf0d554db6c9fe850), +W64LIT(0x07c038c428bb99ae), +W64LIT(0x30f375941c809b10), +W64LIT(0x3fe10dc59da86f15), +W64LIT(0x46162f7e7ab62891), +W64LIT(0xe623e4ec325c98f1), +W64LIT(0xfea024a63c1c2ff9), +W64LIT(0x349a5524b23357bf), +W64LIT(0x35fd5d0863986413), +W64LIT(0x96618eeead7a8172), +W64LIT(0xcb5d79ae5f844bea), +W64LIT(0x21c5fd676af8721f), +W64LIT(0x5720a78d0ccec19e), +W64LIT(0xf6726433958f4252), +W64LIT(0x8d4b56d02532637b), +W64LIT(0x24cbd5fb15e08d1c), +W64LIT(0x3aef2559e2b09016), +W64LIT(0x5afccf84da455336), +W64LIT(0x51879765f5de6b9c), +W64LIT(0x2917bdf2c36b1fb4), +W64LIT(0xa7f5f356605129ce), +W64LIT(0xc1412963a1b440ec), +W64LIT(0x3d2f1d9dca0b09b8), +W64LIT(0xa53be30e37f24f63), +W64LIT(0x5ff2e718a55dac35), +W64LIT(0xa2fbdbca1f49d6cd), +W64LIT(0xf7156c1f442471fe), +W64LIT(0x7a5e3acf61161285), +W64LIT(0xca3a71828e2f7846), +W64LIT(0x1b2ad83e8848e209), +W64LIT(0xa8e78b07e179ddcb), +W64LIT(0xef96ac554a64c6f6), +W64LIT(0x0000000000000000), +W64LIT(0x6013eadd38f5c320), +W64LIT(0x3c4815b11ba03a14), +W64LIT(0x09b548b978385e07), +W64LIT(0x226ce513ecf0271e), +W64LIT(0x63baf2a9befd9621), +W64LIT(0x44d83f262d154e3c), +W64LIT(0xcdfa4946a694e1e8), +W64LIT(0x113688f37678e90f), +W64LIT(0x859916458ca10ed0), +W64LIT(0xc52809d30f078c43), +W64LIT(0x4d6d779f552d103b), +W64LIT(0x1e24f0a2f7501d0a), +W64LIT(0x0167082cd1ab33ac), +W64LIT(0x1438a06f0960160c), +W64LIT(0xf9601c6214a7b657), +W64LIT(0xa035cb9248eab060), +W64LIT(0x50e09f4924755830), +W64LIT(0xd7b79954ff77304d), +W64LIT(0xe58afc98b454cdf0), +W64LIT(0x03a9187486085501), +W64LIT(0x62ddfa856f56a58d), +W64LIT(0xc44f01ffdeacbfef), +W64LIT(0x73eb7276192e4c82), +W64LIT(0xd6d091782edc03e1), +W64LIT(0xfbae0c3a4304d0fa), +W64LIT(0x9973f6bf2c527577), +W64LIT(0x105180dfa7d3daa3), +W64LIT(0x2605c5a34243ebb1), +W64LIT(0x91a1b62a85c118dc), +W64LIT(0xc99369f608272d47), +W64LIT(0x5d3cf740f2feca98), +W64LIT(0xcf34591ef1378745), +W64LIT(0xc8f461dad98c1eeb), +W64LIT(0x0b7b58e12f9b38aa), +W64LIT(0xe32dcc704d4467f2), +W64LIT(0x754c429ee03ee680), +W64LIT(0xd3deb9e451c4fce2), +W64LIT(0x6e669aa068760489), +W64LIT(0x66b4da35c1e56922), +W64LIT(0x4fa367c7028e7696), +W64LIT(0xba781b80110961c5), +W64LIT(0x41d617ba520db13f), +W64LIT(0x335a6de09a88ce11), +W64LIT(0xdf65d9c156e45de6), +W64LIT(0xcc9d416a773fd244), +W64LIT(0x5c5bff6c2355f934), +W64LIT(0x2870b5de12c02c18), +W64LIT(0x155fa843d8cb25a0), +W64LIT(0x78902a9736b57428), +W64LIT(0xae40bbef186977c9), +W64LIT(0x88457e4c5a2a9c78), +W64LIT(0x6a0fba10c6c5c826), +W64LIT(0x7f5012531e0eed86), +W64LIT(0x8c2c5efcf49950d7), +W64LIT(0x31947db8cd2ba8bc), +W64LIT(0x2c19956ebc73e0b7), +W64LIT(0x230bed3f3d5b14b2), +W64LIT(0x69a6a26440cd9d27), +W64LIT(0x86300e310aa95bd1), +W64LIT(0xb3cd533969313fc2), +W64LIT(0x1883c04a0e40b708), +W64LIT(0xf1b25cf7bd34dbfc), +W64LIT(0x2fb08d1a3a7bb5b6), +W64LIT(0xd8a5e1057e5fc448), +W64LIT(0xddabc99901473b4b), +W64LIT(0xde02d1ed874f6e4a), +W64LIT(0xbdb8234439b2f86b), +W64LIT(0x5647afa1dd65f232), +W64LIT(0x2ed78536ebd0861a), +W64LIT(0xe9319cbdb3746cf4), +W64LIT(0xa692fb7ab1fa1a62), +W64LIT(0x742b4ab23195d52c), +W64LIT(0x95c8969a2b72d473), +W64LIT(0x6174e2f1e95ef08c), +W64LIT(0xf807144ec50c85fb), +W64LIT(0xbe113b30bfbaad6a), +W64LIT(0xda6bf15d29fca2e5), +W64LIT(0xbb1f13acc0a25269), +/* box 7 */ +W64LIT(0xc22b27f0f9e37bf9), +W64LIT(0x93fad23f0955ef09), +W64LIT(0x32ed4b84a22a91a2), +W64LIT(0x3898b57bcc61b1cc), +W64LIT(0x55825ba9ad98e5ad), +W64LIT(0xb2eeb8069421ec94), +W64LIT(0xc7eb5875ce3c6bce), +W64LIT(0x4b1dac5d1f45851f), +W64LIT(0xc16ba1204705d847), +W64LIT(0xc5380f461a2ba91a), +W64LIT(0xb908971a909bad90), +W64LIT(0x303e1cb7763d5376), +W64LIT(0xe6ff324c53486853), +W64LIT(0x6d1aeed261f95461), +W64LIT(0x0193d1e36af1616a), +W64LIT(0x51d1f5cff0b694f0), +W64LIT(0x29b2c3f52728e127), +W64LIT(0x112a768eeb4950eb), +W64LIT(0x8fb672f86f9f4d6f), +W64LIT(0xf0c66c745bc9ea5b), +W64LIT(0x3f8b9dcd2fa9632f), +W64LIT(0x65bc471edba5b6db), +W64LIT(0x4d9d5508967c3696), +W64LIT(0x3a4be24818767318), +W64LIT(0x2794936c144db014), +W64LIT(0x2af2452599ce4299), +W64LIT(0x4a8e7dbe75b4e475), +W64LIT(0x9ddc82a63a30be3a), +W64LIT(0xade29e114c0ded4c), +W64LIT(0xd1d2064dc6bde9c6), +W64LIT(0x7da349bfe04165e0), +W64LIT(0x6b9a1787e8c0e7e8), +W64LIT(0xa54437ddf6510ff6), +W64LIT(0x2254ece92392a023), +W64LIT(0x79f0e7d9bd6f14bd), +W64LIT(0x57510c9a798f2779), +W64LIT(0x346db2d12b13222b), +W64LIT(0x54118a4ac76984c7), +W64LIT(0xefca4a6383e5eb83), +W64LIT(0xca8d8e3c43bf9943), +W64LIT(0xfc336bdebcbb79bc), +W64LIT(0x3e184c2e45580245), +W64LIT(0xf495c21206e79b06), +W64LIT(0xff73ed0e025dda02), +W64LIT(0x4228d472cfe806cf), +W64LIT(0xbcc8e89fa744bda7), +W64LIT(0xab626744c5345ec5), +W64LIT(0xb6bd1660c90f9dc9), +W64LIT(0xb72ec783a3fefca3), +W64LIT(0x8be5dc9e32b13c32), +W64LIT(0x485d2a8da1a326a1), +W64LIT(0xc6788996a4cd0aa4), +W64LIT(0x40fb83411bffc41b), +W64LIT(0x08a6a9ccba5ce2ba), +W64LIT(0xf386eaa4e52f49e5), +W64LIT(0x1acc5992eff311ef), +W64LIT(0xa2571f6b1599dd15), +W64LIT(0x44a82d2746d1b546), +W64LIT(0x70c59ff66dc2976d), +W64LIT(0x8d6525cbbb888fbb), +W64LIT(0x963aadba3e8aff3e), +W64LIT(0x7c30985c8ab0048a), +W64LIT(0x607c389bec7aa6ec), +W64LIT(0xa822e1947bd2fd7b), +W64LIT(0x034086d0bee6a3be), +W64LIT(0x66fcc1ce65431565), +W64LIT(0xb37d69e5fed08dfe), +W64LIT(0x2f323aa0ae1152ae), +W64LIT(0x56c2dd79137e4613), +W64LIT(0x31adcd541ccc321c), +W64LIT(0xdff456d4f5d8b8f5), +W64LIT(0xf9f3145b8b64698b), +W64LIT(0x764566a3e4fb24e4), +W64LIT(0x0cf507aae77293e7), +W64LIT(0x59775c034aea764a), +W64LIT(0xb89b46f9fa6accfa), +W64LIT(0xe8d962d5602d3960), +W64LIT(0x17aa8fdb6270e362), +W64LIT(0x1c4ca0c766caa266), +W64LIT(0x2de16d937a06907a), +W64LIT(0x2547c45fc05a72c0), +W64LIT(0x0fb5817a59943059), +W64LIT(0x0680f9558939b389), +W64LIT(0x16395e3808818208), +W64LIT(0xac714ff226fc8c26), +W64LIT(0xa9b1307711239c11), +W64LIT(0xec8accb33d03483d), +W64LIT(0x6c893f310b08350b), +W64LIT(0xc4abdea570dac870), +W64LIT(0xba4811ca2e7d0e2e), +W64LIT(0xf155bd9731388b31), +W64LIT(0xdd2701e721cf7a21), +W64LIT(0xe94ab3360adc580a), +W64LIT(0x23c73d0a4963c149), +W64LIT(0x5cb723867d35667d), +W64LIT(0x5042242c9a47f59a), +W64LIT(0x198cdf425115b251), +W64LIT(0x0a75feff6e4b206e), +W64LIT(0xfda0ba3dd64a18d6), +W64LIT(0xcede205a1e91e81e), +W64LIT(0xd041d7aeac4c88ac), +W64LIT(0xe42c657f875faa87), +W64LIT(0x36bee5e2ff04e0ff), +W64LIT(0x6fc9b9e1b5ee96b5), +W64LIT(0x998f2cc0671ecf67), +W64LIT(0xd301517e12aa2b12), +W64LIT(0xaea218c1f2eb4ef2), +W64LIT(0xda342951c207a8c2), +W64LIT(0x61efe978868bc786), +W64LIT(0x7f701e8c3456a734), +W64LIT(0x0be62f1c04ba4104), +W64LIT(0x9129850cdd422ddd), +W64LIT(0xd6c12efb25753b25), +W64LIT(0xe33f4dc964977864), +W64LIT(0x1579d8e8b66721b6), +W64LIT(0xf860c5b8e19508e1), +W64LIT(0x7496319030ece630), +W64LIT(0x88a55a4e8c579f8c), +W64LIT(0xcf4df1b974608974), +W64LIT(0x10b9a76d81b83181), +W64LIT(0x0e26509933655133), +W64LIT(0x43bb0591a51967a5), +W64LIT(0x926903dc63a48e63), +W64LIT(0x9c4f534550c1df50), +W64LIT(0x3bd833ab72871272), +W64LIT(0xa4d7e63e9ca06e9c), +W64LIT(0xb46e41531d185f1d), +W64LIT(0x126af05e55aff355), +W64LIT(0x24d415bcaaab13aa), +W64LIT(0x1e9ff7f4b2dd60b2), +W64LIT(0x05c07f8537df1037), +W64LIT(0x467b7a1492c67792), +W64LIT(0x2087bbdaf78562f7), +W64LIT(0x819022615cfa1c5c), +W64LIT(0xcd9ea68aa0774ba0), +W64LIT(0xa79760ee2246cd22), +W64LIT(0x8343755288edde88), +W64LIT(0x58e48de0201b1720), +W64LIT(0x7216c8c5b9d555b9), +W64LIT(0x372d340195f58195), +W64LIT(0xa11799bbab7f7eab), +W64LIT(0x9f0fd595ee277cee), +W64LIT(0x676f102d0fb2740f), +W64LIT(0x9e9c047684d61d84), +W64LIT(0x49cefb6ecb5247cb), +W64LIT(0xd41279c8f162f9f1), +W64LIT(0x1f0c2617d82c01d8), +W64LIT(0x97a97c59547b9e54), +W64LIT(0xe76ce3af39b90939), +W64LIT(0xc3b8f61393121a93), +W64LIT(0x5ba40b309efdb49e), +W64LIT(0xea0a35e6b43afbb4), +W64LIT(0x5a37dad3f40cd5f4), +W64LIT(0x14ea090bdc9640dc), +W64LIT(0x5e6474b5a922a4a9), +W64LIT(0xfee03ced68acbb68), +W64LIT(0x071328b6e3c8d2e3), +W64LIT(0x5302a2fc24a15624), +W64LIT(0x85c38c0701d46d01), +W64LIT(0x3d58cafefbbea1fb), +W64LIT(0x84505de46b250c6b), +W64LIT(0x642f96fdb154d7b1), +W64LIT(0xbf886e4f19a21e19), +W64LIT(0x02d35733d417c2d4), +W64LIT(0x68da915756264456), +W64LIT(0x8710db34d5c3afd5), +W64LIT(0x0d66d6498d83f28d), +W64LIT(0x7b23b0ea6978d669), +W64LIT(0x1b5f887185027085), +W64LIT(0x3ccb1b1d914fc091), +W64LIT(0x0453ae665d2e715d), +W64LIT(0xcb1e5fdf294ef829), +W64LIT(0xf6469521d2f059d2), +W64LIT(0xb03def3540362e40), +W64LIT(0x633cbe4b529c0552), +W64LIT(0xf7d544c2b80138b8), +W64LIT(0x7ab061090389b703), +W64LIT(0x0000000000000000), +W64LIT(0xdba7f8b2a8f6c9a8), +W64LIT(0x35fe633241e24341), +W64LIT(0x21146a399d74039d), +W64LIT(0xd581a82b9b93989b), +W64LIT(0x0935782fd0ad83d0), +W64LIT(0x5ff7a556c3d3c5c3), +W64LIT(0xaf31c922981a2f98), +W64LIT(0x90ba54efb7b34cb7), +W64LIT(0x5291731f4e50374e), +W64LIT(0xc0f870c32df4b92d), +W64LIT(0x7ee3cf6f5ea7c65e), +W64LIT(0xe07fcb19da71dbda), +W64LIT(0x4eddd3d8289a9528), +W64LIT(0x13f921bd3f5e923f), +W64LIT(0xf50613f16c16fa6c), +W64LIT(0x981cfd230defae0d), +W64LIT(0x4c0e84ebfc8d57fc), +W64LIT(0x82d0a4b1e21cbfe2), +W64LIT(0x89368bade6a6fee6), +W64LIT(0xd292809d785b4a78), +W64LIT(0x47e8abf7f83716f8), +W64LIT(0x8e25a31b056e2c05), +W64LIT(0xd752ff184f845a4f), +W64LIT(0xcc0d7769ca862aca), +W64LIT(0x694940b43cd7253c), +W64LIT(0x2ea1eb43c4e033c4), +W64LIT(0xde6787379f29d99f), +W64LIT(0x181f0ea13be4d33b), +W64LIT(0x416852a2710ea571), +W64LIT(0x62af6fa8386d6438), +W64LIT(0xa0844858c18e1fc1), +W64LIT(0x337e9a67c8dbf0c8), +W64LIT(0x2c72bc7010f7f110), +W64LIT(0xbd5b397ccdb5dccd), +W64LIT(0xd8e77e6216106a16), +W64LIT(0x86830ad7bf32cebf), +W64LIT(0x4f4e023b426bf442), +W64LIT(0xe5bfb49cedaecbed), +W64LIT(0x8a760d7d58405d58), +W64LIT(0xe2ac9c2a0e66190e), +W64LIT(0xb5fd90b077e93e77), +W64LIT(0xdcb4d0044b3e1b4b), +W64LIT(0x453bfcc42c20d42c), +W64LIT(0xed191d5057f22957), +W64LIT(0xe1ec1afab080bab0), +W64LIT(0xee599b80e9148ae9), +W64LIT(0x2607428f7ebcd17e), +W64LIT(0x5d24f26517c40717), +W64LIT(0x6a09c66482318682), +W64LIT(0xa604b10d48b7ac48), +W64LIT(0xbe1bbfac73537f73), +W64LIT(0x282112164dd9804d), +W64LIT(0x7505e0735a1d875a), +W64LIT(0x73851926d32434d3), +W64LIT(0xd974af817ce10b7c), +W64LIT(0xeb99e405decb9ade), +W64LIT(0x9b5c7bf3b3090db3), +W64LIT(0xfab3928b3582ca35), +W64LIT(0x8003f382360b7d36), +W64LIT(0x94e9fa89ea9d3dea), +W64LIT(0xb1ae3ed62ac74f2a), +W64LIT(0x9acfaa10d9f86cd9), +W64LIT(0x390b6498a690d0a6), +W64LIT(0xf2153b478fde288f), +W64LIT(0x71564e150733f607), +W64LIT(0xa3c4ce887f68bc7f), +W64LIT(0xaaf1b6a7afc53faf), +W64LIT(0x1ddf71240c3bc30c), +W64LIT(0x77d6b7408e0a458e), +W64LIT(0x2b6194c6f33f23f3), +W64LIT(0xc9cd08ecfd593afd), +W64LIT(0xc85ed90f97a85b97), +W64LIT(0x8cf6f428d179eed1), +W64LIT(0x957a2b6a806c5c80), +W64LIT(0xbbdbc029448c6f44), +W64LIT(0x7863363ad79e75d7), +W64LIT(0x6e5a6802df1ff7df), +W64LIT(0xfb2043685f73ab5f), +}; + +NAMESPACE_END diff --git a/cryptopp/simple.cpp b/cryptopp/simple.cpp new file mode 100644 index 0000000..96f256b --- /dev/null +++ b/cryptopp/simple.cpp @@ -0,0 +1,14 @@ +// simple.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "simple.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +NAMESPACE_END + +#endif diff --git a/cryptopp/simple.h b/cryptopp/simple.h new file mode 100644 index 0000000..35fd65a --- /dev/null +++ b/cryptopp/simple.h @@ -0,0 +1,209 @@ +// simple.h - written and placed in the public domain by Wei Dai +/*! \file + Simple non-interface classes derived from classes in cryptlib.h. +*/ + +#ifndef CRYPTOPP_SIMPLE_H +#define CRYPTOPP_SIMPLE_H + +#include "cryptlib.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +template +class CRYPTOPP_NO_VTABLE ClonableImpl : public BASE +{ +public: + Clonable * Clone() const {return new DERIVED(*static_cast(this));} +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE AlgorithmImpl : public BASE +{ +public: + static std::string CRYPTOPP_API StaticAlgorithmName() {return ALGORITHM_INFO::StaticAlgorithmName();} + std::string AlgorithmName() const {return ALGORITHM_INFO::StaticAlgorithmName();} +}; + +//! _ +class CRYPTOPP_DLL InvalidKeyLength : public InvalidArgument +{ +public: + explicit InvalidKeyLength(const std::string &algorithm, size_t length) : InvalidArgument(algorithm + ": " + IntToString(length) + " is not a valid key length") {} +}; + +//! _ +class CRYPTOPP_DLL InvalidRounds : public InvalidArgument +{ +public: + explicit InvalidRounds(const std::string &algorithm, unsigned int rounds) : InvalidArgument(algorithm + ": " + IntToString(rounds) + " is not a valid number of rounds") {} +}; + +// ***************************** + +//! _ +template +class CRYPTOPP_NO_VTABLE Bufferless : public T +{ +public: + bool IsolatedFlush(bool hardFlush, bool blocking) {return false;} +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE Unflushable : public T +{ +public: + bool Flush(bool completeFlush, int propagation=-1, bool blocking=true) + {return ChannelFlush(DEFAULT_CHANNEL, completeFlush, propagation, blocking);} + bool IsolatedFlush(bool hardFlush, bool blocking) + {assert(false); return false;} + bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true) + { + if (hardFlush && !InputBufferIsEmpty()) + throw CannotFlush("Unflushable: this object has buffered input that cannot be flushed"); + else + { + BufferedTransformation *attached = this->AttachedTransformation(); + return attached && propagation ? attached->ChannelFlush(channel, hardFlush, propagation-1, blocking) : false; + } + } + +protected: + virtual bool InputBufferIsEmpty() const {return false;} +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE InputRejecting : public T +{ +public: + struct InputRejected : public NotImplemented + {InputRejected() : NotImplemented("BufferedTransformation: this object doesn't allow input") {}}; + + // shouldn't be calling these functions on this class + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking) + {throw InputRejected();} + bool IsolatedFlush(bool, bool) {return false;} + bool IsolatedMessageSeriesEnd(bool) {throw InputRejected();} + + size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking) + {throw InputRejected();} + bool ChannelMessageSeriesEnd(const std::string &, int, bool) {throw InputRejected();} +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE CustomFlushPropagation : public T +{ +public: + virtual bool Flush(bool hardFlush, int propagation=-1, bool blocking=true) =0; + +private: + bool IsolatedFlush(bool hardFlush, bool blocking) {assert(false); return false;} +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE CustomSignalPropagation : public CustomFlushPropagation +{ +public: + virtual void Initialize(const NameValuePairs ¶meters=g_nullNameValuePairs, int propagation=-1) =0; + +private: + void IsolatedInitialize(const NameValuePairs ¶meters) {assert(false);} +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE Multichannel : public CustomFlushPropagation +{ +public: + bool Flush(bool hardFlush, int propagation=-1, bool blocking=true) + {return this->ChannelFlush(DEFAULT_CHANNEL, hardFlush, propagation, blocking);} + bool MessageSeriesEnd(int propagation=-1, bool blocking=true) + {return this->ChannelMessageSeriesEnd(DEFAULT_CHANNEL, propagation, blocking);} + byte * CreatePutSpace(size_t &size) + {return this->ChannelCreatePutSpace(DEFAULT_CHANNEL, size);} + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking) + {return this->ChannelPut2(DEFAULT_CHANNEL, begin, length, messageEnd, blocking);} + size_t PutModifiable2(byte *inString, size_t length, int messageEnd, bool blocking) + {return this->ChannelPutModifiable2(DEFAULT_CHANNEL, inString, length, messageEnd, blocking);} + +// void ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1) +// {PropagateMessageSeriesEnd(propagation, channel);} + byte * ChannelCreatePutSpace(const std::string &channel, size_t &size) + {size = 0; return NULL;} + bool ChannelPutModifiable(const std::string &channel, byte *inString, size_t length) + {this->ChannelPut(channel, inString, length); return false;} + + virtual size_t ChannelPut2(const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking) =0; + size_t ChannelPutModifiable2(const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking) + {return ChannelPut2(channel, begin, length, messageEnd, blocking);} + + virtual bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true) =0; +}; + +//! _ +template +class CRYPTOPP_NO_VTABLE AutoSignaling : public T +{ +public: + AutoSignaling(int propagation=-1) : m_autoSignalPropagation(propagation) {} + + void SetAutoSignalPropagation(int propagation) + {m_autoSignalPropagation = propagation;} + int GetAutoSignalPropagation() const + {return m_autoSignalPropagation;} + +private: + int m_autoSignalPropagation; +}; + +//! A BufferedTransformation that only contains pre-existing data as "output" +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Store : public AutoSignaling > +{ +public: + Store() : m_messageEnd(false) {} + + void IsolatedInitialize(const NameValuePairs ¶meters) + { + m_messageEnd = false; + StoreInitialize(parameters); + } + + unsigned int NumberOfMessages() const {return m_messageEnd ? 0 : 1;} + bool GetNextMessage(); + unsigned int CopyMessagesTo(BufferedTransformation &target, unsigned int count=UINT_MAX, const std::string &channel=DEFAULT_CHANNEL) const; + +protected: + virtual void StoreInitialize(const NameValuePairs ¶meters) =0; + + bool m_messageEnd; +}; + +//! A BufferedTransformation that doesn't produce any retrievable output +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Sink : public BufferedTransformation +{ +public: + size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) + {transferBytes = 0; return 0;} + size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const + {return 0;} +}; + +class CRYPTOPP_DLL BitBucket : public Bufferless +{ +public: + std::string AlgorithmName() const {return "BitBucket";} + void IsolatedInitialize(const NameValuePairs ¶meters) {} + size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking) + {return 0;} +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/skipjack.cpp b/cryptopp/skipjack.cpp new file mode 100644 index 0000000..e9ec586 --- /dev/null +++ b/cryptopp/skipjack.cpp @@ -0,0 +1,202 @@ +// skipjack.cpp - modified by Wei Dai from Paulo Barreto's skipjack32.c, +// which is public domain according to his web site. + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "skipjack.h" + +/* + * Optimized implementation of SKIPJACK algorithm + * + * originally written by Panu Rissanen 1998.06.24 + * optimized by Mark Tillotson 1998.06.25 + * optimized by Paulo Barreto 1998.06.30 + */ + +NAMESPACE_BEGIN(CryptoPP) + +/** + * The F-table byte permutation (see description of the G-box permutation) + */ +const byte SKIPJACK::Base::fTable[256] = { + 0xa3,0xd7,0x09,0x83,0xf8,0x48,0xf6,0xf4,0xb3,0x21,0x15,0x78,0x99,0xb1,0xaf,0xf9, + 0xe7,0x2d,0x4d,0x8a,0xce,0x4c,0xca,0x2e,0x52,0x95,0xd9,0x1e,0x4e,0x38,0x44,0x28, + 0x0a,0xdf,0x02,0xa0,0x17,0xf1,0x60,0x68,0x12,0xb7,0x7a,0xc3,0xe9,0xfa,0x3d,0x53, + 0x96,0x84,0x6b,0xba,0xf2,0x63,0x9a,0x19,0x7c,0xae,0xe5,0xf5,0xf7,0x16,0x6a,0xa2, + 0x39,0xb6,0x7b,0x0f,0xc1,0x93,0x81,0x1b,0xee,0xb4,0x1a,0xea,0xd0,0x91,0x2f,0xb8, + 0x55,0xb9,0xda,0x85,0x3f,0x41,0xbf,0xe0,0x5a,0x58,0x80,0x5f,0x66,0x0b,0xd8,0x90, + 0x35,0xd5,0xc0,0xa7,0x33,0x06,0x65,0x69,0x45,0x00,0x94,0x56,0x6d,0x98,0x9b,0x76, + 0x97,0xfc,0xb2,0xc2,0xb0,0xfe,0xdb,0x20,0xe1,0xeb,0xd6,0xe4,0xdd,0x47,0x4a,0x1d, + 0x42,0xed,0x9e,0x6e,0x49,0x3c,0xcd,0x43,0x27,0xd2,0x07,0xd4,0xde,0xc7,0x67,0x18, + 0x89,0xcb,0x30,0x1f,0x8d,0xc6,0x8f,0xaa,0xc8,0x74,0xdc,0xc9,0x5d,0x5c,0x31,0xa4, + 0x70,0x88,0x61,0x2c,0x9f,0x0d,0x2b,0x87,0x50,0x82,0x54,0x64,0x26,0x7d,0x03,0x40, + 0x34,0x4b,0x1c,0x73,0xd1,0xc4,0xfd,0x3b,0xcc,0xfb,0x7f,0xab,0xe6,0x3e,0x5b,0xa5, + 0xad,0x04,0x23,0x9c,0x14,0x51,0x22,0xf0,0x29,0x79,0x71,0x7e,0xff,0x8c,0x0e,0xe2, + 0x0c,0xef,0xbc,0x72,0x75,0x6f,0x37,0xa1,0xec,0xd3,0x8e,0x62,0x8b,0x86,0x10,0xe8, + 0x08,0x77,0x11,0xbe,0x92,0x4f,0x24,0xc5,0x32,0x36,0x9d,0xcf,0xf3,0xa6,0xbb,0xac, + 0x5e,0x6c,0xa9,0x13,0x57,0x25,0xb5,0xe3,0xbd,0xa8,0x3a,0x01,0x05,0x59,0x2a,0x46 +}; + +/** + * The key-dependent permutation G on V^16 is a four-round Feistel network. + * The round function is a fixed byte-substitution table (permutation on V^8), + * the F-table. Each round of G incorporates a single byte from the key. + */ +#define g(tab, w, i, j, k, l) \ +{ \ + w ^= (word)tab[i][w & 0xff] << 8; \ + w ^= (word)tab[j][w >> 8]; \ + w ^= (word)tab[k][w & 0xff] << 8; \ + w ^= (word)tab[l][w >> 8]; \ +} + +#define g0(tab, w) g(tab, w, 0, 1, 2, 3) +#define g1(tab, w) g(tab, w, 4, 5, 6, 7) +#define g2(tab, w) g(tab, w, 8, 9, 0, 1) +#define g3(tab, w) g(tab, w, 2, 3, 4, 5) +#define g4(tab, w) g(tab, w, 6, 7, 8, 9) + +/** + * The inverse of the G permutation. + */ +#define h(tab, w, i, j, k, l) \ +{ \ + w ^= (word)tab[l][w >> 8]; \ + w ^= (word)tab[k][w & 0xff] << 8; \ + w ^= (word)tab[j][w >> 8]; \ + w ^= (word)tab[i][w & 0xff] << 8; \ +} + +#define h0(tab, w) h(tab, w, 0, 1, 2, 3) +#define h1(tab, w) h(tab, w, 4, 5, 6, 7) +#define h2(tab, w) h(tab, w, 8, 9, 0, 1) +#define h3(tab, w) h(tab, w, 2, 3, 4, 5) +#define h4(tab, w) h(tab, w, 6, 7, 8, 9) + +/** + * Preprocess a user key into a table to save an XOR at each F-table access. + */ +void SKIPJACK::Base::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &) +{ + AssertValidKeyLength(length); + + /* tab[i][c] = fTable[c ^ key[i]] */ + int i; + for (i = 0; i < 10; i++) { + byte *t = tab[i], k = key[9-i]; + int c; + for (c = 0; c < 256; c++) { + t[c] = fTable[c ^ k]; + } + } +} + +typedef BlockGetAndPut Block; + +/** + * Encrypt a single block of data. + */ +void SKIPJACK::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word16 w1, w2, w3, w4; + Block::Get(inBlock)(w4)(w3)(w2)(w1); + + /* stepping rule A: */ + g0(tab, w1); w4 ^= w1 ^ 1; + g1(tab, w4); w3 ^= w4 ^ 2; + g2(tab, w3); w2 ^= w3 ^ 3; + g3(tab, w2); w1 ^= w2 ^ 4; + g4(tab, w1); w4 ^= w1 ^ 5; + g0(tab, w4); w3 ^= w4 ^ 6; + g1(tab, w3); w2 ^= w3 ^ 7; + g2(tab, w2); w1 ^= w2 ^ 8; + + /* stepping rule B: */ + w2 ^= w1 ^ 9; g3(tab, w1); + w1 ^= w4 ^ 10; g4(tab, w4); + w4 ^= w3 ^ 11; g0(tab, w3); + w3 ^= w2 ^ 12; g1(tab, w2); + w2 ^= w1 ^ 13; g2(tab, w1); + w1 ^= w4 ^ 14; g3(tab, w4); + w4 ^= w3 ^ 15; g4(tab, w3); + w3 ^= w2 ^ 16; g0(tab, w2); + + /* stepping rule A: */ + g1(tab, w1); w4 ^= w1 ^ 17; + g2(tab, w4); w3 ^= w4 ^ 18; + g3(tab, w3); w2 ^= w3 ^ 19; + g4(tab, w2); w1 ^= w2 ^ 20; + g0(tab, w1); w4 ^= w1 ^ 21; + g1(tab, w4); w3 ^= w4 ^ 22; + g2(tab, w3); w2 ^= w3 ^ 23; + g3(tab, w2); w1 ^= w2 ^ 24; + + /* stepping rule B: */ + w2 ^= w1 ^ 25; g4(tab, w1); + w1 ^= w4 ^ 26; g0(tab, w4); + w4 ^= w3 ^ 27; g1(tab, w3); + w3 ^= w2 ^ 28; g2(tab, w2); + w2 ^= w1 ^ 29; g3(tab, w1); + w1 ^= w4 ^ 30; g4(tab, w4); + w4 ^= w3 ^ 31; g0(tab, w3); + w3 ^= w2 ^ 32; g1(tab, w2); + + Block::Put(xorBlock, outBlock)(w4)(w3)(w2)(w1); +} + +/** + * Decrypt a single block of data. + */ +void SKIPJACK::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word16 w1, w2, w3, w4; + Block::Get(inBlock)(w4)(w3)(w2)(w1); + + /* stepping rule A: */ + h1(tab, w2); w3 ^= w2 ^ 32; + h0(tab, w3); w4 ^= w3 ^ 31; + h4(tab, w4); w1 ^= w4 ^ 30; + h3(tab, w1); w2 ^= w1 ^ 29; + h2(tab, w2); w3 ^= w2 ^ 28; + h1(tab, w3); w4 ^= w3 ^ 27; + h0(tab, w4); w1 ^= w4 ^ 26; + h4(tab, w1); w2 ^= w1 ^ 25; + + /* stepping rule B: */ + w1 ^= w2 ^ 24; h3(tab, w2); + w2 ^= w3 ^ 23; h2(tab, w3); + w3 ^= w4 ^ 22; h1(tab, w4); + w4 ^= w1 ^ 21; h0(tab, w1); + w1 ^= w2 ^ 20; h4(tab, w2); + w2 ^= w3 ^ 19; h3(tab, w3); + w3 ^= w4 ^ 18; h2(tab, w4); + w4 ^= w1 ^ 17; h1(tab, w1); + + /* stepping rule A: */ + h0(tab, w2); w3 ^= w2 ^ 16; + h4(tab, w3); w4 ^= w3 ^ 15; + h3(tab, w4); w1 ^= w4 ^ 14; + h2(tab, w1); w2 ^= w1 ^ 13; + h1(tab, w2); w3 ^= w2 ^ 12; + h0(tab, w3); w4 ^= w3 ^ 11; + h4(tab, w4); w1 ^= w4 ^ 10; + h3(tab, w1); w2 ^= w1 ^ 9; + + /* stepping rule B: */ + w1 ^= w2 ^ 8; h2(tab, w2); + w2 ^= w3 ^ 7; h1(tab, w3); + w3 ^= w4 ^ 6; h0(tab, w4); + w4 ^= w1 ^ 5; h4(tab, w1); + w1 ^= w2 ^ 4; h3(tab, w2); + w2 ^= w3 ^ 3; h2(tab, w3); + w3 ^= w4 ^ 2; h1(tab, w4); + w4 ^= w1 ^ 1; h0(tab, w1); + + Block::Put(xorBlock, outBlock)(w4)(w3)(w2)(w1); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/skipjack.h b/cryptopp/skipjack.h new file mode 100644 index 0000000..2cf10d2 --- /dev/null +++ b/cryptopp/skipjack.h @@ -0,0 +1,61 @@ +#ifndef CRYPTOPP_SKIPJACK_H +#define CRYPTOPP_SKIPJACK_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10> +{ + CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "SKIPJACK";} +}; + +/// SKIPJACK +class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + unsigned int OptimalDataAlignment() const {return GetAlignmentOf();} + + protected: + static const byte fTable[256]; + + FixedSizeSecBlock tab; + }; + + class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + private: + static const byte Se[256]; + static const word32 Te[4][256]; + }; + + class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + private: + static const byte Sd[256]; + static const word32 Td[4][256]; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef SKIPJACK::Encryption SKIPJACKEncryption; +typedef SKIPJACK::Decryption SKIPJACKDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/smartptr.h b/cryptopp/smartptr.h new file mode 100644 index 0000000..6b4040e --- /dev/null +++ b/cryptopp/smartptr.h @@ -0,0 +1,223 @@ +#ifndef CRYPTOPP_SMARTPTR_H +#define CRYPTOPP_SMARTPTR_H + +#include "config.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +template class simple_ptr +{ +public: + simple_ptr() : m_p(NULL) {} + ~simple_ptr() {delete m_p;} + T *m_p; +}; + +template class member_ptr +{ +public: + explicit member_ptr(T *p = NULL) : m_p(p) {} + + ~member_ptr(); + + const T& operator*() const { return *m_p; } + T& operator*() { return *m_p; } + + const T* operator->() const { return m_p; } + T* operator->() { return m_p; } + + const T* get() const { return m_p; } + T* get() { return m_p; } + + T* release() + { + T *old_p = m_p; + m_p = 0; + return old_p; + } + + void reset(T *p = 0); + +protected: + member_ptr(const member_ptr& rhs); // copy not allowed + void operator=(const member_ptr& rhs); // assignment not allowed + + T *m_p; +}; + +template member_ptr::~member_ptr() {delete m_p;} +template void member_ptr::reset(T *p) {delete m_p; m_p = p;} + +// ******************************************************** + +template class value_ptr : public member_ptr +{ +public: + value_ptr(const T &obj) : member_ptr(new T(obj)) {} + value_ptr(T *p = NULL) : member_ptr(p) {} + value_ptr(const value_ptr& rhs) + : member_ptr(rhs.m_p ? new T(*rhs.m_p) : NULL) {} + + value_ptr& operator=(const value_ptr& rhs); + bool operator==(const value_ptr& rhs) + { + return (!this->m_p && !rhs.m_p) || (this->m_p && rhs.m_p && *this->m_p == *rhs.m_p); + } +}; + +template value_ptr& value_ptr::operator=(const value_ptr& rhs) +{ + T *old_p = this->m_p; + this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL; + delete old_p; + return *this; +} + +// ******************************************************** + +template class clonable_ptr : public member_ptr +{ +public: + clonable_ptr(const T &obj) : member_ptr(obj.Clone()) {} + clonable_ptr(T *p = NULL) : member_ptr(p) {} + clonable_ptr(const clonable_ptr& rhs) + : member_ptr(rhs.m_p ? rhs.m_p->Clone() : NULL) {} + + clonable_ptr& operator=(const clonable_ptr& rhs); +}; + +template clonable_ptr& clonable_ptr::operator=(const clonable_ptr& rhs) +{ + T *old_p = this->m_p; + this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL; + delete old_p; + return *this; +} + +// ******************************************************** + +template class counted_ptr +{ +public: + explicit counted_ptr(T *p = 0); + counted_ptr(const T &r) : m_p(0) {attach(r);} + counted_ptr(const counted_ptr& rhs); + + ~counted_ptr(); + + const T& operator*() const { return *m_p; } + T& operator*() { return *m_p; } + + const T* operator->() const { return m_p; } + T* operator->() { return get(); } + + const T* get() const { return m_p; } + T* get(); + + void attach(const T &p); + + counted_ptr & operator=(const counted_ptr& rhs); + +private: + T *m_p; +}; + +template counted_ptr::counted_ptr(T *p) + : m_p(p) +{ + if (m_p) + m_p->m_referenceCount = 1; +} + +template counted_ptr::counted_ptr(const counted_ptr& rhs) + : m_p(rhs.m_p) +{ + if (m_p) + m_p->m_referenceCount++; +} + +template counted_ptr::~counted_ptr() +{ + if (m_p && --m_p->m_referenceCount == 0) + delete m_p; +} + +template void counted_ptr::attach(const T &r) +{ + if (m_p && --m_p->m_referenceCount == 0) + delete m_p; + if (r.m_referenceCount == 0) + { + m_p = r.clone(); + m_p->m_referenceCount = 1; + } + else + { + m_p = const_cast(&r); + m_p->m_referenceCount++; + } +} + +template T* counted_ptr::get() +{ + if (m_p && m_p->m_referenceCount > 1) + { + T *temp = m_p->clone(); + m_p->m_referenceCount--; + m_p = temp; + m_p->m_referenceCount = 1; + } + return m_p; +} + +template counted_ptr & counted_ptr::operator=(const counted_ptr& rhs) +{ + if (m_p != rhs.m_p) + { + if (m_p && --m_p->m_referenceCount == 0) + delete m_p; + m_p = rhs.m_p; + if (m_p) + m_p->m_referenceCount++; + } + return *this; +} + +// ******************************************************** + +template class vector_member_ptrs +{ +public: + vector_member_ptrs(size_t size=0) + : m_size(size), m_ptr(new member_ptr[size]) {} + ~vector_member_ptrs() + {delete [] this->m_ptr;} + + member_ptr& operator[](size_t index) + {assert(indexm_size); return this->m_ptr[index];} + const member_ptr& operator[](size_t index) const + {assert(indexm_size); return this->m_ptr[index];} + + size_t size() const {return this->m_size;} + void resize(size_t newSize) + { + member_ptr *newPtr = new member_ptr[newSize]; + for (size_t i=0; im_size && im_ptr[i].release()); + delete [] this->m_ptr; + this->m_size = newSize; + this->m_ptr = newPtr; + } + +private: + vector_member_ptrs(const vector_member_ptrs &c); // copy not allowed + void operator=(const vector_member_ptrs &x); // assignment not allowed + + size_t m_size; + member_ptr *m_ptr; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/socketft.cpp b/cryptopp/socketft.cpp new file mode 100644 index 0000000..6c5a8ff --- /dev/null +++ b/cryptopp/socketft.cpp @@ -0,0 +1,531 @@ +// socketft.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "socketft.h" + +#ifdef SOCKETS_AVAILABLE + +#include "wait.h" + +#ifdef USE_BERKELEY_STYLE_SOCKETS +#include +#include +#include +#include +#include +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +#ifdef USE_WINDOWS_STYLE_SOCKETS +const int SOCKET_EINVAL = WSAEINVAL; +const int SOCKET_EWOULDBLOCK = WSAEWOULDBLOCK; +typedef int socklen_t; +#else +const int SOCKET_EINVAL = EINVAL; +const int SOCKET_EWOULDBLOCK = EWOULDBLOCK; +#endif + +Socket::Err::Err(socket_t s, const std::string& operation, int error) + : OS_Error(IO_ERROR, "Socket: " + operation + " operation failed with error " + IntToString(error), operation, error) + , m_s(s) +{ +} + +Socket::~Socket() +{ + if (m_own) + { + try + { + CloseSocket(); + } + catch (...) + { + } + } +} + +void Socket::AttachSocket(socket_t s, bool own) +{ + if (m_own) + CloseSocket(); + + m_s = s; + m_own = own; + SocketChanged(); +} + +socket_t Socket::DetachSocket() +{ + socket_t s = m_s; + m_s = INVALID_SOCKET; + SocketChanged(); + return s; +} + +void Socket::Create(int nType) +{ + assert(m_s == INVALID_SOCKET); + m_s = socket(AF_INET, nType, 0); + CheckAndHandleError("socket", m_s); + m_own = true; + SocketChanged(); +} + +void Socket::CloseSocket() +{ + if (m_s != INVALID_SOCKET) + { +#ifdef USE_WINDOWS_STYLE_SOCKETS + CancelIo((HANDLE) m_s); + CheckAndHandleError_int("closesocket", closesocket(m_s)); +#else + CheckAndHandleError_int("close", close(m_s)); +#endif + m_s = INVALID_SOCKET; + SocketChanged(); + } +} + +void Socket::Bind(unsigned int port, const char *addr) +{ + sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + + if (addr == NULL) + sa.sin_addr.s_addr = htonl(INADDR_ANY); + else + { + unsigned long result = inet_addr(addr); + if (result == -1) // Solaris doesn't have INADDR_NONE + { + SetLastError(SOCKET_EINVAL); + CheckAndHandleError_int("inet_addr", SOCKET_ERROR); + } + sa.sin_addr.s_addr = result; + } + + sa.sin_port = htons((u_short)port); + + Bind((sockaddr *)&sa, sizeof(sa)); +} + +void Socket::Bind(const sockaddr *psa, socklen_t saLen) +{ + assert(m_s != INVALID_SOCKET); + // cygwin workaround: needs const_cast + CheckAndHandleError_int("bind", bind(m_s, const_cast(psa), saLen)); +} + +void Socket::Listen(int backlog) +{ + assert(m_s != INVALID_SOCKET); + CheckAndHandleError_int("listen", listen(m_s, backlog)); +} + +bool Socket::Connect(const char *addr, unsigned int port) +{ + assert(addr != NULL); + + sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_addr.s_addr = inet_addr(addr); + + if (sa.sin_addr.s_addr == -1) // Solaris doesn't have INADDR_NONE + { + hostent *lphost = gethostbyname(addr); + if (lphost == NULL) + { + SetLastError(SOCKET_EINVAL); + CheckAndHandleError_int("gethostbyname", SOCKET_ERROR); + } + + sa.sin_addr.s_addr = ((in_addr *)lphost->h_addr)->s_addr; + } + + sa.sin_port = htons((u_short)port); + + return Connect((const sockaddr *)&sa, sizeof(sa)); +} + +bool Socket::Connect(const sockaddr* psa, socklen_t saLen) +{ + assert(m_s != INVALID_SOCKET); + int result = connect(m_s, const_cast(psa), saLen); + if (result == SOCKET_ERROR && GetLastError() == SOCKET_EWOULDBLOCK) + return false; + CheckAndHandleError_int("connect", result); + return true; +} + +bool Socket::Accept(Socket& target, sockaddr *psa, socklen_t *psaLen) +{ + assert(m_s != INVALID_SOCKET); + socket_t s = accept(m_s, psa, psaLen); + if (s == INVALID_SOCKET && GetLastError() == SOCKET_EWOULDBLOCK) + return false; + CheckAndHandleError("accept", s); + target.AttachSocket(s, true); + return true; +} + +void Socket::GetSockName(sockaddr *psa, socklen_t *psaLen) +{ + assert(m_s != INVALID_SOCKET); + CheckAndHandleError_int("getsockname", getsockname(m_s, psa, psaLen)); +} + +void Socket::GetPeerName(sockaddr *psa, socklen_t *psaLen) +{ + assert(m_s != INVALID_SOCKET); + CheckAndHandleError_int("getpeername", getpeername(m_s, psa, psaLen)); +} + +unsigned int Socket::Send(const byte* buf, size_t bufLen, int flags) +{ + assert(m_s != INVALID_SOCKET); + int result = send(m_s, (const char *)buf, UnsignedMin(INT_MAX, bufLen), flags); + CheckAndHandleError_int("send", result); + return result; +} + +unsigned int Socket::Receive(byte* buf, size_t bufLen, int flags) +{ + assert(m_s != INVALID_SOCKET); + int result = recv(m_s, (char *)buf, UnsignedMin(INT_MAX, bufLen), flags); + CheckAndHandleError_int("recv", result); + return result; +} + +void Socket::ShutDown(int how) +{ + assert(m_s != INVALID_SOCKET); + int result = shutdown(m_s, how); + CheckAndHandleError_int("shutdown", result); +} + +void Socket::IOCtl(long cmd, unsigned long *argp) +{ + assert(m_s != INVALID_SOCKET); +#ifdef USE_WINDOWS_STYLE_SOCKETS + CheckAndHandleError_int("ioctlsocket", ioctlsocket(m_s, cmd, argp)); +#else + CheckAndHandleError_int("ioctl", ioctl(m_s, cmd, argp)); +#endif +} + +bool Socket::SendReady(const timeval *timeout) +{ + fd_set fds; + FD_ZERO(&fds); + FD_SET(m_s, &fds); + int ready; + if (timeout == NULL) + ready = select((int)m_s+1, NULL, &fds, NULL, NULL); + else + { + timeval timeoutCopy = *timeout; // select() modified timeout on Linux + ready = select((int)m_s+1, NULL, &fds, NULL, &timeoutCopy); + } + CheckAndHandleError_int("select", ready); + return ready > 0; +} + +bool Socket::ReceiveReady(const timeval *timeout) +{ + fd_set fds; + FD_ZERO(&fds); + FD_SET(m_s, &fds); + int ready; + if (timeout == NULL) + ready = select((int)m_s+1, &fds, NULL, NULL, NULL); + else + { + timeval timeoutCopy = *timeout; // select() modified timeout on Linux + ready = select((int)m_s+1, &fds, NULL, NULL, &timeoutCopy); + } + CheckAndHandleError_int("select", ready); + return ready > 0; +} + +unsigned int Socket::PortNameToNumber(const char *name, const char *protocol) +{ + int port = atoi(name); + if (IntToString(port) == name) + return port; + + servent *se = getservbyname(name, protocol); + if (!se) + throw Err(INVALID_SOCKET, "getservbyname", SOCKET_EINVAL); + return ntohs(se->s_port); +} + +void Socket::StartSockets() +{ +#ifdef USE_WINDOWS_STYLE_SOCKETS + WSADATA wsd; + int result = WSAStartup(0x0202, &wsd); + if (result != 0) + throw Err(INVALID_SOCKET, "WSAStartup", result); +#endif +} + +void Socket::ShutdownSockets() +{ +#ifdef USE_WINDOWS_STYLE_SOCKETS + int result = WSACleanup(); + if (result != 0) + throw Err(INVALID_SOCKET, "WSACleanup", result); +#endif +} + +int Socket::GetLastError() +{ +#ifdef USE_WINDOWS_STYLE_SOCKETS + return WSAGetLastError(); +#else + return errno; +#endif +} + +void Socket::SetLastError(int errorCode) +{ +#ifdef USE_WINDOWS_STYLE_SOCKETS + WSASetLastError(errorCode); +#else + errno = errorCode; +#endif +} + +void Socket::HandleError(const char *operation) const +{ + int err = GetLastError(); + throw Err(m_s, operation, err); +} + +#ifdef USE_WINDOWS_STYLE_SOCKETS + +SocketReceiver::SocketReceiver(Socket &s) + : m_s(s), m_resultPending(false), m_eofReceived(false) +{ + m_event.AttachHandle(CreateEvent(NULL, true, false, NULL), true); + m_s.CheckAndHandleError("CreateEvent", m_event.HandleValid()); + memset(&m_overlapped, 0, sizeof(m_overlapped)); + m_overlapped.hEvent = m_event; +} + +SocketReceiver::~SocketReceiver() +{ +#ifdef USE_WINDOWS_STYLE_SOCKETS + CancelIo((HANDLE) m_s.GetSocket()); +#endif +} + +bool SocketReceiver::Receive(byte* buf, size_t bufLen) +{ + assert(!m_resultPending && !m_eofReceived); + + DWORD flags = 0; + // don't queue too much at once, or we might use up non-paged memory + WSABUF wsabuf = {UnsignedMin((u_long)128*1024, bufLen), (char *)buf}; + if (WSARecv(m_s, &wsabuf, 1, &m_lastResult, &flags, &m_overlapped, NULL) == 0) + { + if (m_lastResult == 0) + m_eofReceived = true; + } + else + { + switch (WSAGetLastError()) + { + default: + m_s.CheckAndHandleError_int("WSARecv", SOCKET_ERROR); + case WSAEDISCON: + m_lastResult = 0; + m_eofReceived = true; + break; + case WSA_IO_PENDING: + m_resultPending = true; + } + } + return !m_resultPending; +} + +void SocketReceiver::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) +{ + if (m_resultPending) + container.AddHandle(m_event, CallStack("SocketReceiver::GetWaitObjects() - result pending", &callStack)); + else if (!m_eofReceived) + container.SetNoWait(CallStack("SocketReceiver::GetWaitObjects() - result ready", &callStack)); +} + +unsigned int SocketReceiver::GetReceiveResult() +{ + if (m_resultPending) + { + DWORD flags = 0; + if (WSAGetOverlappedResult(m_s, &m_overlapped, &m_lastResult, false, &flags)) + { + if (m_lastResult == 0) + m_eofReceived = true; + } + else + { + switch (WSAGetLastError()) + { + default: + m_s.CheckAndHandleError("WSAGetOverlappedResult", FALSE); + case WSAEDISCON: + m_lastResult = 0; + m_eofReceived = true; + } + } + m_resultPending = false; + } + return m_lastResult; +} + +// ************************************************************* + +SocketSender::SocketSender(Socket &s) + : m_s(s), m_resultPending(false), m_lastResult(0) +{ + m_event.AttachHandle(CreateEvent(NULL, true, false, NULL), true); + m_s.CheckAndHandleError("CreateEvent", m_event.HandleValid()); + memset(&m_overlapped, 0, sizeof(m_overlapped)); + m_overlapped.hEvent = m_event; +} + + +SocketSender::~SocketSender() +{ +#ifdef USE_WINDOWS_STYLE_SOCKETS + CancelIo((HANDLE) m_s.GetSocket()); +#endif +} + +void SocketSender::Send(const byte* buf, size_t bufLen) +{ + assert(!m_resultPending); + DWORD written = 0; + // don't queue too much at once, or we might use up non-paged memory + WSABUF wsabuf = {UnsignedMin((u_long)128*1024, bufLen), (char *)buf}; + if (WSASend(m_s, &wsabuf, 1, &written, 0, &m_overlapped, NULL) == 0) + { + m_resultPending = false; + m_lastResult = written; + } + else + { + if (WSAGetLastError() != WSA_IO_PENDING) + m_s.CheckAndHandleError_int("WSASend", SOCKET_ERROR); + + m_resultPending = true; + } +} + +void SocketSender::SendEof() +{ + assert(!m_resultPending); + m_s.ShutDown(SD_SEND); + m_s.CheckAndHandleError("ResetEvent", ResetEvent(m_event)); + m_s.CheckAndHandleError_int("WSAEventSelect", WSAEventSelect(m_s, m_event, FD_CLOSE)); + m_resultPending = true; +} + +bool SocketSender::EofSent() +{ + if (m_resultPending) + { + WSANETWORKEVENTS events; + m_s.CheckAndHandleError_int("WSAEnumNetworkEvents", WSAEnumNetworkEvents(m_s, m_event, &events)); + if ((events.lNetworkEvents & FD_CLOSE) != FD_CLOSE) + throw Socket::Err(m_s, "WSAEnumNetworkEvents (FD_CLOSE not present)", E_FAIL); + if (events.iErrorCode[FD_CLOSE_BIT] != 0) + throw Socket::Err(m_s, "FD_CLOSE (via WSAEnumNetworkEvents)", events.iErrorCode[FD_CLOSE_BIT]); + m_resultPending = false; + } + return m_lastResult != 0; +} + +void SocketSender::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) +{ + if (m_resultPending) + container.AddHandle(m_event, CallStack("SocketSender::GetWaitObjects() - result pending", &callStack)); + else + container.SetNoWait(CallStack("SocketSender::GetWaitObjects() - result ready", &callStack)); +} + +unsigned int SocketSender::GetSendResult() +{ + if (m_resultPending) + { + DWORD flags = 0; + BOOL result = WSAGetOverlappedResult(m_s, &m_overlapped, &m_lastResult, false, &flags); + m_s.CheckAndHandleError("WSAGetOverlappedResult", result); + m_resultPending = false; + } + return m_lastResult; +} + +#endif + +#ifdef USE_BERKELEY_STYLE_SOCKETS + +SocketReceiver::SocketReceiver(Socket &s) + : m_s(s), m_lastResult(0), m_eofReceived(false) +{ +} + +void SocketReceiver::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) +{ + if (!m_eofReceived) + container.AddReadFd(m_s, CallStack("SocketReceiver::GetWaitObjects()", &callStack)); +} + +bool SocketReceiver::Receive(byte* buf, size_t bufLen) +{ + m_lastResult = m_s.Receive(buf, bufLen); + if (bufLen > 0 && m_lastResult == 0) + m_eofReceived = true; + return true; +} + +unsigned int SocketReceiver::GetReceiveResult() +{ + return m_lastResult; +} + +SocketSender::SocketSender(Socket &s) + : m_s(s), m_lastResult(0) +{ +} + +void SocketSender::Send(const byte* buf, size_t bufLen) +{ + m_lastResult = m_s.Send(buf, bufLen); +} + +void SocketSender::SendEof() +{ + m_s.ShutDown(SD_SEND); +} + +unsigned int SocketSender::GetSendResult() +{ + return m_lastResult; +} + +void SocketSender::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) +{ + container.AddWriteFd(m_s, CallStack("SocketSender::GetWaitObjects()", &callStack)); +} + +#endif + +NAMESPACE_END + +#endif // #ifdef SOCKETS_AVAILABLE diff --git a/cryptopp/socketft.h b/cryptopp/socketft.h new file mode 100644 index 0000000..e414aa6 --- /dev/null +++ b/cryptopp/socketft.h @@ -0,0 +1,224 @@ +#ifndef CRYPTOPP_SOCKETFT_H +#define CRYPTOPP_SOCKETFT_H + +#include "config.h" + +#ifdef SOCKETS_AVAILABLE + +#include "network.h" +#include "queue.h" + +#ifdef USE_WINDOWS_STYLE_SOCKETS +# if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_) +# error Winsock 1 is not supported by this library. Please include this file or winsock2.h before windows.h. +# endif +#include +#include "winpipes.h" +#else +#include +#include +#include +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +#ifdef USE_WINDOWS_STYLE_SOCKETS +typedef ::SOCKET socket_t; +#else +typedef int socket_t; +const socket_t INVALID_SOCKET = -1; +// cygwin 1.1.4 doesn't have SHUT_RD +const int SD_RECEIVE = 0; +const int SD_SEND = 1; +const int SD_BOTH = 2; +const int SOCKET_ERROR = -1; +#endif + +#ifndef socklen_t +typedef TYPE_OF_SOCKLEN_T socklen_t; // see config.h +#endif + +//! wrapper for Windows or Berkeley Sockets +class Socket +{ +public: + //! exception thrown by Socket class + class Err : public OS_Error + { + public: + Err(socket_t s, const std::string& operation, int error); + socket_t GetSocket() const {return m_s;} + + private: + socket_t m_s; + }; + + Socket(socket_t s = INVALID_SOCKET, bool own=false) : m_s(s), m_own(own) {} + Socket(const Socket &s) : m_s(s.m_s), m_own(false) {} + virtual ~Socket(); + + bool GetOwnership() const {return m_own;} + void SetOwnership(bool own) {m_own = own;} + + operator socket_t() {return m_s;} + socket_t GetSocket() const {return m_s;} + void AttachSocket(socket_t s, bool own=false); + socket_t DetachSocket(); + void CloseSocket(); + + void Create(int nType = SOCK_STREAM); + void Bind(unsigned int port, const char *addr=NULL); + void Bind(const sockaddr* psa, socklen_t saLen); + void Listen(int backlog=5); + // the next three functions return false if the socket is in nonblocking mode + // and the operation cannot be completed immediately + bool Connect(const char *addr, unsigned int port); + bool Connect(const sockaddr* psa, socklen_t saLen); + bool Accept(Socket& s, sockaddr *psa=NULL, socklen_t *psaLen=NULL); + void GetSockName(sockaddr *psa, socklen_t *psaLen); + void GetPeerName(sockaddr *psa, socklen_t *psaLen); + unsigned int Send(const byte* buf, size_t bufLen, int flags=0); + unsigned int Receive(byte* buf, size_t bufLen, int flags=0); + void ShutDown(int how = SD_SEND); + + void IOCtl(long cmd, unsigned long *argp); + bool SendReady(const timeval *timeout); + bool ReceiveReady(const timeval *timeout); + + virtual void HandleError(const char *operation) const; + void CheckAndHandleError_int(const char *operation, int result) const + {if (result == SOCKET_ERROR) HandleError(operation);} + void CheckAndHandleError(const char *operation, socket_t result) const + {if (result == SOCKET_ERROR) HandleError(operation);} +#ifdef USE_WINDOWS_STYLE_SOCKETS + void CheckAndHandleError(const char *operation, BOOL result) const + {assert(result==TRUE || result==FALSE); if (!result) HandleError(operation);} + void CheckAndHandleError(const char *operation, bool result) const + {if (!result) HandleError(operation);} +#endif + + //! look up the port number given its name, returns 0 if not found + static unsigned int PortNameToNumber(const char *name, const char *protocol="tcp"); + //! start Windows Sockets 2 + static void StartSockets(); + //! calls WSACleanup for Windows Sockets + static void ShutdownSockets(); + //! returns errno or WSAGetLastError + static int GetLastError(); + //! sets errno or calls WSASetLastError + static void SetLastError(int errorCode); + +protected: + virtual void SocketChanged() {} + + socket_t m_s; + bool m_own; +}; + +class SocketsInitializer +{ +public: + SocketsInitializer() {Socket::StartSockets();} + ~SocketsInitializer() {try {Socket::ShutdownSockets();} catch (...) {}} +}; + +class SocketReceiver : public NetworkReceiver +{ +public: + SocketReceiver(Socket &s); + +#ifdef USE_BERKELEY_STYLE_SOCKETS + bool MustWaitToReceive() {return true;} +#else + ~SocketReceiver(); + bool MustWaitForResult() {return true;} +#endif + bool Receive(byte* buf, size_t bufLen); + unsigned int GetReceiveResult(); + bool EofReceived() const {return m_eofReceived;} + + unsigned int GetMaxWaitObjectCount() const {return 1;} + void GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack); + +private: + Socket &m_s; + bool m_eofReceived; + +#ifdef USE_WINDOWS_STYLE_SOCKETS + WindowsHandle m_event; + OVERLAPPED m_overlapped; + bool m_resultPending; + DWORD m_lastResult; +#else + unsigned int m_lastResult; +#endif +}; + +class SocketSender : public NetworkSender +{ +public: + SocketSender(Socket &s); + +#ifdef USE_BERKELEY_STYLE_SOCKETS + bool MustWaitToSend() {return true;} +#else + ~SocketSender(); + bool MustWaitForResult() {return true;} + bool MustWaitForEof() { return true; } + bool EofSent(); +#endif + void Send(const byte* buf, size_t bufLen); + unsigned int GetSendResult(); + void SendEof(); + + unsigned int GetMaxWaitObjectCount() const {return 1;} + void GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack); + +private: + Socket &m_s; +#ifdef USE_WINDOWS_STYLE_SOCKETS + WindowsHandle m_event; + OVERLAPPED m_overlapped; + bool m_resultPending; + DWORD m_lastResult; +#else + unsigned int m_lastResult; +#endif +}; + +//! socket-based implementation of NetworkSource +class SocketSource : public NetworkSource, public Socket +{ +public: + SocketSource(socket_t s = INVALID_SOCKET, bool pumpAll = false, BufferedTransformation *attachment = NULL) + : NetworkSource(attachment), Socket(s), m_receiver(*this) + { + if (pumpAll) + PumpAll(); + } + +private: + NetworkReceiver & AccessReceiver() {return m_receiver;} + SocketReceiver m_receiver; +}; + +//! socket-based implementation of NetworkSink +class SocketSink : public NetworkSink, public Socket +{ +public: + SocketSink(socket_t s=INVALID_SOCKET, unsigned int maxBufferSize=0, unsigned int autoFlushBound=16*1024) + : NetworkSink(maxBufferSize, autoFlushBound), Socket(s), m_sender(*this) {} + + void SendEof() {ShutDown(SD_SEND);} + +private: + NetworkSender & AccessSender() {return m_sender;} + SocketSender m_sender; +}; + +NAMESPACE_END + +#endif // #ifdef SOCKETS_AVAILABLE + +#endif diff --git a/cryptopp/sosemanuk.cpp b/cryptopp/sosemanuk.cpp new file mode 100644 index 0000000..0863675 --- /dev/null +++ b/cryptopp/sosemanuk.cpp @@ -0,0 +1,711 @@ +// sosemanuk.cpp - written and placed in the public domain by Wei Dai + +// use "cl /EP /P /DCRYPTOPP_GENERATE_X64_MASM sosemanuk.cpp" to generate MASM code + +#include "pch.h" + +#ifndef CRYPTOPP_GENERATE_X64_MASM + +#include "sosemanuk.h" +#include "misc.h" +#include "cpu.h" + +#include "serpentp.h" + +NAMESPACE_BEGIN(CryptoPP) + +void SosemanukPolicy::CipherSetKey(const NameValuePairs ¶ms, const byte *userKey, size_t keylen) +{ + Serpent_KeySchedule(m_key, 24, userKey, keylen); +} + +void SosemanukPolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length) +{ + assert(length==16); + + word32 a, b, c, d, e; + + typedef BlockGetAndPut Block; + Block::Get(iv)(a)(b)(c)(d); + + const word32 *k = m_key; + unsigned int i=1; + + do + { + beforeS0(KX); beforeS0(S0); afterS0(LT); + afterS0(KX); afterS0(S1); afterS1(LT); + if (i == 3) // after 18th round + { + m_state[4] = b; + m_state[5] = e; + m_state[10] = c; + m_state[11] = a; + } + afterS1(KX); afterS1(S2); afterS2(LT); + afterS2(KX); afterS2(S3); afterS3(LT); + if (i == 2) // after 12th round + { + m_state[6] = c; + m_state[7] = d; + m_state[8] = b; + m_state[9] = e; + } + afterS3(KX); afterS3(S4); afterS4(LT); + afterS4(KX); afterS4(S5); afterS5(LT); + afterS5(KX); afterS5(S6); afterS6(LT); + afterS6(KX); afterS6(S7); afterS7(LT); + + if (i == 3) + break; + + ++i; + c = b; + b = e; + e = d; + d = a; + a = e; + k += 32; + } + while (true); + + afterS7(KX); + + m_state[0] = a; + m_state[1] = b; + m_state[2] = e; + m_state[3] = d; + +#define XMUX(c, x, y) (x ^ (y & (0 - (c & 1)))) + m_state[11] += XMUX(m_state[10], m_state[1], m_state[8]); + m_state[10] = rotlFixed(m_state[10] * 0x54655307, 7); +} + +extern "C" { +word32 s_sosemanukMulTables[512] = { +#if CRYPTOPP_BOOL_X86 | CRYPTOPP_BOOL_X64 + 0x00000000, 0xE19FCF12, 0x6B973724, 0x8A08F836, + 0xD6876E48, 0x3718A15A, 0xBD10596C, 0x5C8F967E, + 0x05A7DC90, 0xE4381382, 0x6E30EBB4, 0x8FAF24A6, + 0xD320B2D8, 0x32BF7DCA, 0xB8B785FC, 0x59284AEE, + 0x0AE71189, 0xEB78DE9B, 0x617026AD, 0x80EFE9BF, + 0xDC607FC1, 0x3DFFB0D3, 0xB7F748E5, 0x566887F7, + 0x0F40CD19, 0xEEDF020B, 0x64D7FA3D, 0x8548352F, + 0xD9C7A351, 0x38586C43, 0xB2509475, 0x53CF5B67, + 0x146722BB, 0xF5F8EDA9, 0x7FF0159F, 0x9E6FDA8D, + 0xC2E04CF3, 0x237F83E1, 0xA9777BD7, 0x48E8B4C5, + 0x11C0FE2B, 0xF05F3139, 0x7A57C90F, 0x9BC8061D, + 0xC7479063, 0x26D85F71, 0xACD0A747, 0x4D4F6855, + 0x1E803332, 0xFF1FFC20, 0x75170416, 0x9488CB04, + 0xC8075D7A, 0x29989268, 0xA3906A5E, 0x420FA54C, + 0x1B27EFA2, 0xFAB820B0, 0x70B0D886, 0x912F1794, + 0xCDA081EA, 0x2C3F4EF8, 0xA637B6CE, 0x47A879DC, + 0x28CE44DF, 0xC9518BCD, 0x435973FB, 0xA2C6BCE9, + 0xFE492A97, 0x1FD6E585, 0x95DE1DB3, 0x7441D2A1, + 0x2D69984F, 0xCCF6575D, 0x46FEAF6B, 0xA7616079, + 0xFBEEF607, 0x1A713915, 0x9079C123, 0x71E60E31, + 0x22295556, 0xC3B69A44, 0x49BE6272, 0xA821AD60, + 0xF4AE3B1E, 0x1531F40C, 0x9F390C3A, 0x7EA6C328, + 0x278E89C6, 0xC61146D4, 0x4C19BEE2, 0xAD8671F0, + 0xF109E78E, 0x1096289C, 0x9A9ED0AA, 0x7B011FB8, + 0x3CA96664, 0xDD36A976, 0x573E5140, 0xB6A19E52, + 0xEA2E082C, 0x0BB1C73E, 0x81B93F08, 0x6026F01A, + 0x390EBAF4, 0xD89175E6, 0x52998DD0, 0xB30642C2, + 0xEF89D4BC, 0x0E161BAE, 0x841EE398, 0x65812C8A, + 0x364E77ED, 0xD7D1B8FF, 0x5DD940C9, 0xBC468FDB, + 0xE0C919A5, 0x0156D6B7, 0x8B5E2E81, 0x6AC1E193, + 0x33E9AB7D, 0xD276646F, 0x587E9C59, 0xB9E1534B, + 0xE56EC535, 0x04F10A27, 0x8EF9F211, 0x6F663D03, + 0x50358817, 0xB1AA4705, 0x3BA2BF33, 0xDA3D7021, + 0x86B2E65F, 0x672D294D, 0xED25D17B, 0x0CBA1E69, + 0x55925487, 0xB40D9B95, 0x3E0563A3, 0xDF9AACB1, + 0x83153ACF, 0x628AF5DD, 0xE8820DEB, 0x091DC2F9, + 0x5AD2999E, 0xBB4D568C, 0x3145AEBA, 0xD0DA61A8, + 0x8C55F7D6, 0x6DCA38C4, 0xE7C2C0F2, 0x065D0FE0, + 0x5F75450E, 0xBEEA8A1C, 0x34E2722A, 0xD57DBD38, + 0x89F22B46, 0x686DE454, 0xE2651C62, 0x03FAD370, + 0x4452AAAC, 0xA5CD65BE, 0x2FC59D88, 0xCE5A529A, + 0x92D5C4E4, 0x734A0BF6, 0xF942F3C0, 0x18DD3CD2, + 0x41F5763C, 0xA06AB92E, 0x2A624118, 0xCBFD8E0A, + 0x97721874, 0x76EDD766, 0xFCE52F50, 0x1D7AE042, + 0x4EB5BB25, 0xAF2A7437, 0x25228C01, 0xC4BD4313, + 0x9832D56D, 0x79AD1A7F, 0xF3A5E249, 0x123A2D5B, + 0x4B1267B5, 0xAA8DA8A7, 0x20855091, 0xC11A9F83, + 0x9D9509FD, 0x7C0AC6EF, 0xF6023ED9, 0x179DF1CB, + 0x78FBCCC8, 0x996403DA, 0x136CFBEC, 0xF2F334FE, + 0xAE7CA280, 0x4FE36D92, 0xC5EB95A4, 0x24745AB6, + 0x7D5C1058, 0x9CC3DF4A, 0x16CB277C, 0xF754E86E, + 0xABDB7E10, 0x4A44B102, 0xC04C4934, 0x21D38626, + 0x721CDD41, 0x93831253, 0x198BEA65, 0xF8142577, + 0xA49BB309, 0x45047C1B, 0xCF0C842D, 0x2E934B3F, + 0x77BB01D1, 0x9624CEC3, 0x1C2C36F5, 0xFDB3F9E7, + 0xA13C6F99, 0x40A3A08B, 0xCAAB58BD, 0x2B3497AF, + 0x6C9CEE73, 0x8D032161, 0x070BD957, 0xE6941645, + 0xBA1B803B, 0x5B844F29, 0xD18CB71F, 0x3013780D, + 0x693B32E3, 0x88A4FDF1, 0x02AC05C7, 0xE333CAD5, + 0xBFBC5CAB, 0x5E2393B9, 0xD42B6B8F, 0x35B4A49D, + 0x667BFFFA, 0x87E430E8, 0x0DECC8DE, 0xEC7307CC, + 0xB0FC91B2, 0x51635EA0, 0xDB6BA696, 0x3AF46984, + 0x63DC236A, 0x8243EC78, 0x084B144E, 0xE9D4DB5C, + 0xB55B4D22, 0x54C48230, 0xDECC7A06, 0x3F53B514, +#else + 0x00000000, 0xE19FCF13, 0x6B973726, 0x8A08F835, + 0xD6876E4C, 0x3718A15F, 0xBD10596A, 0x5C8F9679, + 0x05A7DC98, 0xE438138B, 0x6E30EBBE, 0x8FAF24AD, + 0xD320B2D4, 0x32BF7DC7, 0xB8B785F2, 0x59284AE1, + 0x0AE71199, 0xEB78DE8A, 0x617026BF, 0x80EFE9AC, + 0xDC607FD5, 0x3DFFB0C6, 0xB7F748F3, 0x566887E0, + 0x0F40CD01, 0xEEDF0212, 0x64D7FA27, 0x85483534, + 0xD9C7A34D, 0x38586C5E, 0xB250946B, 0x53CF5B78, + 0x1467229B, 0xF5F8ED88, 0x7FF015BD, 0x9E6FDAAE, + 0xC2E04CD7, 0x237F83C4, 0xA9777BF1, 0x48E8B4E2, + 0x11C0FE03, 0xF05F3110, 0x7A57C925, 0x9BC80636, + 0xC747904F, 0x26D85F5C, 0xACD0A769, 0x4D4F687A, + 0x1E803302, 0xFF1FFC11, 0x75170424, 0x9488CB37, + 0xC8075D4E, 0x2998925D, 0xA3906A68, 0x420FA57B, + 0x1B27EF9A, 0xFAB82089, 0x70B0D8BC, 0x912F17AF, + 0xCDA081D6, 0x2C3F4EC5, 0xA637B6F0, 0x47A879E3, + 0x28CE449F, 0xC9518B8C, 0x435973B9, 0xA2C6BCAA, + 0xFE492AD3, 0x1FD6E5C0, 0x95DE1DF5, 0x7441D2E6, + 0x2D699807, 0xCCF65714, 0x46FEAF21, 0xA7616032, + 0xFBEEF64B, 0x1A713958, 0x9079C16D, 0x71E60E7E, + 0x22295506, 0xC3B69A15, 0x49BE6220, 0xA821AD33, + 0xF4AE3B4A, 0x1531F459, 0x9F390C6C, 0x7EA6C37F, + 0x278E899E, 0xC611468D, 0x4C19BEB8, 0xAD8671AB, + 0xF109E7D2, 0x109628C1, 0x9A9ED0F4, 0x7B011FE7, + 0x3CA96604, 0xDD36A917, 0x573E5122, 0xB6A19E31, + 0xEA2E0848, 0x0BB1C75B, 0x81B93F6E, 0x6026F07D, + 0x390EBA9C, 0xD891758F, 0x52998DBA, 0xB30642A9, + 0xEF89D4D0, 0x0E161BC3, 0x841EE3F6, 0x65812CE5, + 0x364E779D, 0xD7D1B88E, 0x5DD940BB, 0xBC468FA8, + 0xE0C919D1, 0x0156D6C2, 0x8B5E2EF7, 0x6AC1E1E4, + 0x33E9AB05, 0xD2766416, 0x587E9C23, 0xB9E15330, + 0xE56EC549, 0x04F10A5A, 0x8EF9F26F, 0x6F663D7C, + 0x50358897, 0xB1AA4784, 0x3BA2BFB1, 0xDA3D70A2, + 0x86B2E6DB, 0x672D29C8, 0xED25D1FD, 0x0CBA1EEE, + 0x5592540F, 0xB40D9B1C, 0x3E056329, 0xDF9AAC3A, + 0x83153A43, 0x628AF550, 0xE8820D65, 0x091DC276, + 0x5AD2990E, 0xBB4D561D, 0x3145AE28, 0xD0DA613B, + 0x8C55F742, 0x6DCA3851, 0xE7C2C064, 0x065D0F77, + 0x5F754596, 0xBEEA8A85, 0x34E272B0, 0xD57DBDA3, + 0x89F22BDA, 0x686DE4C9, 0xE2651CFC, 0x03FAD3EF, + 0x4452AA0C, 0xA5CD651F, 0x2FC59D2A, 0xCE5A5239, + 0x92D5C440, 0x734A0B53, 0xF942F366, 0x18DD3C75, + 0x41F57694, 0xA06AB987, 0x2A6241B2, 0xCBFD8EA1, + 0x977218D8, 0x76EDD7CB, 0xFCE52FFE, 0x1D7AE0ED, + 0x4EB5BB95, 0xAF2A7486, 0x25228CB3, 0xC4BD43A0, + 0x9832D5D9, 0x79AD1ACA, 0xF3A5E2FF, 0x123A2DEC, + 0x4B12670D, 0xAA8DA81E, 0x2085502B, 0xC11A9F38, + 0x9D950941, 0x7C0AC652, 0xF6023E67, 0x179DF174, + 0x78FBCC08, 0x9964031B, 0x136CFB2E, 0xF2F3343D, + 0xAE7CA244, 0x4FE36D57, 0xC5EB9562, 0x24745A71, + 0x7D5C1090, 0x9CC3DF83, 0x16CB27B6, 0xF754E8A5, + 0xABDB7EDC, 0x4A44B1CF, 0xC04C49FA, 0x21D386E9, + 0x721CDD91, 0x93831282, 0x198BEAB7, 0xF81425A4, + 0xA49BB3DD, 0x45047CCE, 0xCF0C84FB, 0x2E934BE8, + 0x77BB0109, 0x9624CE1A, 0x1C2C362F, 0xFDB3F93C, + 0xA13C6F45, 0x40A3A056, 0xCAAB5863, 0x2B349770, + 0x6C9CEE93, 0x8D032180, 0x070BD9B5, 0xE69416A6, + 0xBA1B80DF, 0x5B844FCC, 0xD18CB7F9, 0x301378EA, + 0x693B320B, 0x88A4FD18, 0x02AC052D, 0xE333CA3E, + 0xBFBC5C47, 0x5E239354, 0xD42B6B61, 0x35B4A472, + 0x667BFF0A, 0x87E43019, 0x0DECC82C, 0xEC73073F, + 0xB0FC9146, 0x51635E55, 0xDB6BA660, 0x3AF46973, + 0x63DC2392, 0x8243EC81, 0x084B14B4, 0xE9D4DBA7, + 0xB55B4DDE, 0x54C482CD, 0xDECC7AF8, 0x3F53B5EB, +#endif + 0x00000000, 0x180F40CD, 0x301E8033, 0x2811C0FE, + 0x603CA966, 0x7833E9AB, 0x50222955, 0x482D6998, + 0xC078FBCC, 0xD877BB01, 0xF0667BFF, 0xE8693B32, + 0xA04452AA, 0xB84B1267, 0x905AD299, 0x88559254, + 0x29F05F31, 0x31FF1FFC, 0x19EEDF02, 0x01E19FCF, + 0x49CCF657, 0x51C3B69A, 0x79D27664, 0x61DD36A9, + 0xE988A4FD, 0xF187E430, 0xD99624CE, 0xC1996403, + 0x89B40D9B, 0x91BB4D56, 0xB9AA8DA8, 0xA1A5CD65, + 0x5249BE62, 0x4A46FEAF, 0x62573E51, 0x7A587E9C, + 0x32751704, 0x2A7A57C9, 0x026B9737, 0x1A64D7FA, + 0x923145AE, 0x8A3E0563, 0xA22FC59D, 0xBA208550, + 0xF20DECC8, 0xEA02AC05, 0xC2136CFB, 0xDA1C2C36, + 0x7BB9E153, 0x63B6A19E, 0x4BA76160, 0x53A821AD, + 0x1B854835, 0x038A08F8, 0x2B9BC806, 0x339488CB, + 0xBBC11A9F, 0xA3CE5A52, 0x8BDF9AAC, 0x93D0DA61, + 0xDBFDB3F9, 0xC3F2F334, 0xEBE333CA, 0xF3EC7307, + 0xA492D5C4, 0xBC9D9509, 0x948C55F7, 0x8C83153A, + 0xC4AE7CA2, 0xDCA13C6F, 0xF4B0FC91, 0xECBFBC5C, + 0x64EA2E08, 0x7CE56EC5, 0x54F4AE3B, 0x4CFBEEF6, + 0x04D6876E, 0x1CD9C7A3, 0x34C8075D, 0x2CC74790, + 0x8D628AF5, 0x956DCA38, 0xBD7C0AC6, 0xA5734A0B, + 0xED5E2393, 0xF551635E, 0xDD40A3A0, 0xC54FE36D, + 0x4D1A7139, 0x551531F4, 0x7D04F10A, 0x650BB1C7, + 0x2D26D85F, 0x35299892, 0x1D38586C, 0x053718A1, + 0xF6DB6BA6, 0xEED42B6B, 0xC6C5EB95, 0xDECAAB58, + 0x96E7C2C0, 0x8EE8820D, 0xA6F942F3, 0xBEF6023E, + 0x36A3906A, 0x2EACD0A7, 0x06BD1059, 0x1EB25094, + 0x569F390C, 0x4E9079C1, 0x6681B93F, 0x7E8EF9F2, + 0xDF2B3497, 0xC724745A, 0xEF35B4A4, 0xF73AF469, + 0xBF179DF1, 0xA718DD3C, 0x8F091DC2, 0x97065D0F, + 0x1F53CF5B, 0x075C8F96, 0x2F4D4F68, 0x37420FA5, + 0x7F6F663D, 0x676026F0, 0x4F71E60E, 0x577EA6C3, + 0xE18D0321, 0xF98243EC, 0xD1938312, 0xC99CC3DF, + 0x81B1AA47, 0x99BEEA8A, 0xB1AF2A74, 0xA9A06AB9, + 0x21F5F8ED, 0x39FAB820, 0x11EB78DE, 0x09E43813, + 0x41C9518B, 0x59C61146, 0x71D7D1B8, 0x69D89175, + 0xC87D5C10, 0xD0721CDD, 0xF863DC23, 0xE06C9CEE, + 0xA841F576, 0xB04EB5BB, 0x985F7545, 0x80503588, + 0x0805A7DC, 0x100AE711, 0x381B27EF, 0x20146722, + 0x68390EBA, 0x70364E77, 0x58278E89, 0x4028CE44, + 0xB3C4BD43, 0xABCBFD8E, 0x83DA3D70, 0x9BD57DBD, + 0xD3F81425, 0xCBF754E8, 0xE3E69416, 0xFBE9D4DB, + 0x73BC468F, 0x6BB30642, 0x43A2C6BC, 0x5BAD8671, + 0x1380EFE9, 0x0B8FAF24, 0x239E6FDA, 0x3B912F17, + 0x9A34E272, 0x823BA2BF, 0xAA2A6241, 0xB225228C, + 0xFA084B14, 0xE2070BD9, 0xCA16CB27, 0xD2198BEA, + 0x5A4C19BE, 0x42435973, 0x6A52998D, 0x725DD940, + 0x3A70B0D8, 0x227FF015, 0x0A6E30EB, 0x12617026, + 0x451FD6E5, 0x5D109628, 0x750156D6, 0x6D0E161B, + 0x25237F83, 0x3D2C3F4E, 0x153DFFB0, 0x0D32BF7D, + 0x85672D29, 0x9D686DE4, 0xB579AD1A, 0xAD76EDD7, + 0xE55B844F, 0xFD54C482, 0xD545047C, 0xCD4A44B1, + 0x6CEF89D4, 0x74E0C919, 0x5CF109E7, 0x44FE492A, + 0x0CD320B2, 0x14DC607F, 0x3CCDA081, 0x24C2E04C, + 0xAC977218, 0xB49832D5, 0x9C89F22B, 0x8486B2E6, + 0xCCABDB7E, 0xD4A49BB3, 0xFCB55B4D, 0xE4BA1B80, + 0x17566887, 0x0F59284A, 0x2748E8B4, 0x3F47A879, + 0x776AC1E1, 0x6F65812C, 0x477441D2, 0x5F7B011F, + 0xD72E934B, 0xCF21D386, 0xE7301378, 0xFF3F53B5, + 0xB7123A2D, 0xAF1D7AE0, 0x870CBA1E, 0x9F03FAD3, + 0x3EA637B6, 0x26A9777B, 0x0EB8B785, 0x16B7F748, + 0x5E9A9ED0, 0x4695DE1D, 0x6E841EE3, 0x768B5E2E, + 0xFEDECC7A, 0xE6D18CB7, 0xCEC04C49, 0xD6CF0C84, + 0x9EE2651C, 0x86ED25D1, 0xAEFCE52F, 0xB6F3A5E2 +}; +} + +#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64 +unsigned int SosemanukPolicy::GetAlignment() const +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +#ifdef __INTEL_COMPILER + if (HasSSE2() && !IsP4()) // Intel compiler produces faster code for this algorithm on the P4 +#else + if (HasSSE2()) +#endif + return 16; + else +#endif + return GetAlignmentOf(); +} + +unsigned int SosemanukPolicy::GetOptimalBlockSize() const +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +#ifdef __INTEL_COMPILER + if (HasSSE2() && !IsP4()) // Intel compiler produces faster code for this algorithm on the P4 +#else + if (HasSSE2()) +#endif + return 4*BYTES_PER_ITERATION; + else +#endif + return BYTES_PER_ITERATION; +} +#endif + +#ifdef CRYPTOPP_X64_MASM_AVAILABLE +extern "C" { +void Sosemanuk_OperateKeystream(size_t iterationCount, const byte *input, byte *output, word32 *state); +} +#endif + +#pragma warning(disable: 4731) // frame pointer register 'ebp' modified by inline assembly code + +void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) +{ +#endif // #ifdef CRYPTOPP_GENERATE_X64_MASM + +#ifdef CRYPTOPP_X64_MASM_AVAILABLE + Sosemanuk_OperateKeystream(iterationCount, input, output, m_state.data()); + return; +#endif + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +#ifdef CRYPTOPP_GENERATE_X64_MASM + ALIGN 8 + Sosemanuk_OperateKeystream PROC FRAME + rex_push_reg rsi + push_reg rdi + alloc_stack(80*4*2+12*4+8*WORD_SZ + 2*16+8) + save_xmm128 xmm6, 02f0h + save_xmm128 xmm7, 0300h + .endprolog + mov rdi, r8 + mov rax, r9 +#else +#ifdef __INTEL_COMPILER + if (HasSSE2() && !IsP4()) // Intel compiler produces faster code for this algorithm on the P4 +#else + if (HasSSE2()) +#endif + { +#ifdef __GNUC__ + #if CRYPTOPP_BOOL_X64 + FixedSizeAlignedSecBlock workspace; + #endif + __asm__ __volatile__ + ( + ".intel_syntax noprefix;" + AS_PUSH_IF86( bx) +#else + word32 *state = m_state; + AS2( mov WORD_REG(ax), state) + AS2( mov WORD_REG(di), output) + AS2( mov WORD_REG(dx), input) + AS2( mov WORD_REG(cx), iterationCount) +#endif +#endif // #ifdef CRYPTOPP_GENERATE_X64_MASM + +#if defined(__GNUC__) && CRYPTOPP_BOOL_X64 + #define SSE2_workspace %5 +#else + #define SSE2_workspace WORD_REG(sp) +#endif + +#define SSE2_output WORD_PTR [SSE2_workspace+1*WORD_SZ] +#define SSE2_input WORD_PTR [SSE2_workspace+2*WORD_SZ] +#define SSE2_wordsLeft WORD_PTR [SSE2_workspace+3*WORD_SZ] +#define SSE2_diEnd WORD_PTR [SSE2_workspace+4*WORD_SZ] +#define SSE2_pMulTables WORD_PTR [SSE2_workspace+5*WORD_SZ] +#define SSE2_state WORD_PTR [SSE2_workspace+6*WORD_SZ] +#define SSE2_wordsLeft2 WORD_PTR [SSE2_workspace+7*WORD_SZ] +#define SSE2_stateCopy SSE2_workspace + 8*WORD_SZ +#define SSE2_uvStart SSE2_stateCopy + 12*4 + +#if CRYPTOPP_BOOL_X86 + AS_PUSH_IF86( bp) + AS2( mov AS_REG_6, esp) + AS2( and esp, -16) + AS2( sub esp, 80*4*2+12*4+8*WORD_SZ) // 80 v's, 80 u's, 12 state, 8 locals + AS2( mov [esp], AS_REG_6) +#endif + AS2( mov SSE2_output, WORD_REG(di)) + AS2( mov SSE2_input, WORD_REG(dx)) + AS2( mov SSE2_state, WORD_REG(ax)) +#ifndef _MSC_VER + AS2( mov SSE2_pMulTables, WORD_REG(si)) +#endif + AS2( lea WORD_REG(cx), [4*WORD_REG(cx)+WORD_REG(cx)]) + AS2( lea WORD_REG(si), [4*WORD_REG(cx)]) + AS2( mov SSE2_wordsLeft, WORD_REG(si)) + AS2( movdqa xmm0, [WORD_REG(ax)+0*16]) // copy state to stack to save a register + AS2( movdqa [SSE2_stateCopy+0*16], xmm0) + AS2( movdqa xmm0, [WORD_REG(ax)+1*16]) + AS2( movdqa [SSE2_stateCopy+1*16], xmm0) + AS2( movq xmm0, QWORD PTR [WORD_REG(ax)+2*16]) + AS2( movq QWORD PTR [SSE2_stateCopy+2*16], xmm0) + AS2( psrlq xmm0, 32) + AS2( movd AS_REG_6d, xmm0) // s(9) + AS2( mov ecx, [WORD_REG(ax)+10*4]) + AS2( mov edx, [WORD_REG(ax)+11*4]) + AS2( pcmpeqb xmm7, xmm7) // all ones + +#define s(i) SSE2_stateCopy + ASM_MOD(i,10)*4 +#define u(j) WORD_REG(di) + (ASM_MOD(j,4)*20 + (j/4)) * 4 +#define v(j) WORD_REG(di) + (ASM_MOD(j,4)*20 + (j/4)) * 4 + 80*4 + +#define R10 ecx +#define R11 edx +#define R20 edx +#define R21 ecx +// workaround bug in GAS 2.15 +#define R20r WORD_REG(dx) +#define R21r WORD_REG(cx) + +#define SSE2_STEP(i, j) \ + AS2( mov eax, [s(i+0)])\ + AS2( mov [v(i)], eax)\ + AS2( rol eax, 8)\ + AS2( lea AS_REG_7, [AS_REG_6 + R2##j##r])\ + AS2( xor AS_REG_7d, R1##j)\ + AS2( mov [u(i)], AS_REG_7d)\ + AS2( mov AS_REG_7d, 1)\ + AS2( and AS_REG_7d, R2##j)\ + AS1( neg AS_REG_7d)\ + AS2( and AS_REG_7d, AS_REG_6d)\ + AS2( xor AS_REG_6d, eax)\ + AS2( movzx eax, al)\ + AS2( xor AS_REG_6d, [WORD_REG(si)+WORD_REG(ax)*4])\ + AS2( mov eax, [s(i+3)])\ + AS2( xor AS_REG_7d, [s(i+2)])\ + AS2( add R1##j, AS_REG_7d)\ + AS2( movzx AS_REG_7d, al)\ + AS2( shr eax, 8)\ + AS2( xor AS_REG_6d, [WORD_REG(si)+1024+AS_REG_7*4])\ + AS2( xor AS_REG_6d, eax)\ + AS2( imul R2##j, AS_HEX(54655307))\ + AS2( rol R2##j, 7)\ + AS2( mov [s(i+0)], AS_REG_6d)\ + + ASL(2) // outer loop, each iteration of this processes 80 words + AS2( lea WORD_REG(di), [SSE2_uvStart]) // start of v and u + AS2( mov WORD_REG(ax), 80) + AS2( cmp WORD_REG(si), 80) + AS2( cmovg WORD_REG(si), WORD_REG(ax)) + AS2( mov SSE2_wordsLeft2, WORD_REG(si)) + AS2( lea WORD_REG(si), [WORD_REG(di)+WORD_REG(si)]) // use to end first inner loop + AS2( mov SSE2_diEnd, WORD_REG(si)) +#ifdef _MSC_VER + AS2( lea WORD_REG(si), s_sosemanukMulTables) +#else + AS2( mov WORD_REG(si), SSE2_pMulTables) +#endif + + ASL(0) // first inner loop, 20 words each, 4 iterations + SSE2_STEP(0, 0) + SSE2_STEP(1, 1) + SSE2_STEP(2, 0) + SSE2_STEP(3, 1) + SSE2_STEP(4, 0) + SSE2_STEP(5, 1) + SSE2_STEP(6, 0) + SSE2_STEP(7, 1) + SSE2_STEP(8, 0) + SSE2_STEP(9, 1) + SSE2_STEP(10, 0) + SSE2_STEP(11, 1) + SSE2_STEP(12, 0) + SSE2_STEP(13, 1) + SSE2_STEP(14, 0) + SSE2_STEP(15, 1) + SSE2_STEP(16, 0) + SSE2_STEP(17, 1) + SSE2_STEP(18, 0) + SSE2_STEP(19, 1) + // loop + AS2( add WORD_REG(di), 5*4) + AS2( cmp WORD_REG(di), SSE2_diEnd) + ASJ( jne, 0, b) + + AS2( mov WORD_REG(ax), SSE2_input) + AS2( mov AS_REG_7, SSE2_output) + AS2( lea WORD_REG(di), [SSE2_uvStart]) // start of v and u + AS2( mov WORD_REG(si), SSE2_wordsLeft2) + + ASL(1) // second inner loop, 16 words each, 5 iterations + AS2( movdqa xmm0, [WORD_REG(di)+0*20*4]) + AS2( movdqa xmm2, [WORD_REG(di)+2*20*4]) + AS2( movdqa xmm3, [WORD_REG(di)+3*20*4]) + AS2( movdqa xmm1, [WORD_REG(di)+1*20*4]) + // S2 + AS2( movdqa xmm4, xmm0) + AS2( pand xmm0, xmm2) + AS2( pxor xmm0, xmm3) + AS2( pxor xmm2, xmm1) + AS2( pxor xmm2, xmm0) + AS2( por xmm3, xmm4) + AS2( pxor xmm3, xmm1) + AS2( pxor xmm4, xmm2) + AS2( movdqa xmm1, xmm3) + AS2( por xmm3, xmm4) + AS2( pxor xmm3, xmm0) + AS2( pand xmm0, xmm1) + AS2( pxor xmm4, xmm0) + AS2( pxor xmm1, xmm3) + AS2( pxor xmm1, xmm4) + AS2( pxor xmm4, xmm7) + // xor with v + AS2( pxor xmm2, [WORD_REG(di)+80*4]) + AS2( pxor xmm3, [WORD_REG(di)+80*5]) + AS2( pxor xmm1, [WORD_REG(di)+80*6]) + AS2( pxor xmm4, [WORD_REG(di)+80*7]) + // exit loop early if less than 16 words left to output + // this is necessary because block size is 20 words, and we output 16 words in each iteration of this loop + AS2( cmp WORD_REG(si), 16) + ASJ( jl, 4, f) + // unpack + AS2( movdqa xmm6, xmm2) + AS2( punpckldq xmm2, xmm3) + AS2( movdqa xmm5, xmm1) + AS2( punpckldq xmm1, xmm4) + AS2( movdqa xmm0, xmm2) + AS2( punpcklqdq xmm2, xmm1) + AS2( punpckhqdq xmm0, xmm1) + AS2( punpckhdq xmm6, xmm3) + AS2( punpckhdq xmm5, xmm4) + AS2( movdqa xmm3, xmm6) + AS2( punpcklqdq xmm6, xmm5) + AS2( punpckhqdq xmm3, xmm5) + // output keystream + AS_XMM_OUTPUT4(SSE2_Sosemanuk_Output, WORD_REG(ax), AS_REG_7, 2,0,6,3, 1, 0,1,2,3, 4) + + // loop + AS2( add WORD_REG(di), 4*4) + AS2( sub WORD_REG(si), 16) + ASJ( jnz, 1, b) + + // outer loop + AS2( mov WORD_REG(si), SSE2_wordsLeft) + AS2( sub WORD_REG(si), 80) + ASJ( jz, 6, f) + AS2( mov SSE2_wordsLeft, WORD_REG(si)) + AS2( mov SSE2_input, WORD_REG(ax)) + AS2( mov SSE2_output, AS_REG_7) + ASJ( jmp, 2, b) + + ASL(4) // final output of less than 16 words + AS2( test WORD_REG(ax), WORD_REG(ax)) + ASJ( jz, 5, f) + AS2( movd xmm0, dword ptr [WORD_REG(ax)+0*4]) + AS2( pxor xmm2, xmm0) + AS2( movd xmm0, dword ptr [WORD_REG(ax)+1*4]) + AS2( pxor xmm3, xmm0) + AS2( movd xmm0, dword ptr [WORD_REG(ax)+2*4]) + AS2( pxor xmm1, xmm0) + AS2( movd xmm0, dword ptr [WORD_REG(ax)+3*4]) + AS2( pxor xmm4, xmm0) + AS2( add WORD_REG(ax), 16) + ASL(5) + AS2( movd dword ptr [AS_REG_7+0*4], xmm2) + AS2( movd dword ptr [AS_REG_7+1*4], xmm3) + AS2( movd dword ptr [AS_REG_7+2*4], xmm1) + AS2( movd dword ptr [AS_REG_7+3*4], xmm4) + AS2( sub WORD_REG(si), 4) + ASJ( jz, 6, f) + AS2( add AS_REG_7, 16) + AS2( psrldq xmm2, 4) + AS2( psrldq xmm3, 4) + AS2( psrldq xmm1, 4) + AS2( psrldq xmm4, 4) + ASJ( jmp, 4, b) + + ASL(6) // save state + AS2( mov AS_REG_6, SSE2_state) + AS2( movdqa xmm0, [SSE2_stateCopy+0*16]) + AS2( movdqa [AS_REG_6+0*16], xmm0) + AS2( movdqa xmm0, [SSE2_stateCopy+1*16]) + AS2( movdqa [AS_REG_6+1*16], xmm0) + AS2( movq xmm0, QWORD PTR [SSE2_stateCopy+2*16]) + AS2( movq QWORD PTR [AS_REG_6+2*16], xmm0) + AS2( mov [AS_REG_6+10*4], ecx) + AS2( mov [AS_REG_6+11*4], edx) + + AS_POP_IF86( sp) + AS_POP_IF86( bp) + +#ifdef __GNUC__ + AS_POP_IF86( bx) + ".att_syntax prefix;" + : + : "a" (m_state.m_ptr), "c" (iterationCount), "S" (s_sosemanukMulTables), "D" (output), "d" (input) + #if CRYPTOPP_BOOL_X64 + , "r" (workspace.m_ptr) + : "memory", "cc", "%r9", "%r10", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7" + #else + : "memory", "cc" + #endif + ); +#endif +#ifdef CRYPTOPP_GENERATE_X64_MASM + movdqa xmm6, [rsp + 02f0h] + movdqa xmm7, [rsp + 0300h] + add rsp, 80*4*2+12*4+8*WORD_SZ + 2*16+8 + pop rdi + pop rsi + ret + Sosemanuk_OperateKeystream ENDP +#else + } + else +#endif +#endif +#ifndef CRYPTOPP_GENERATE_X64_MASM + { +#if CRYPTOPP_BOOL_X86 | CRYPTOPP_BOOL_X64 +#define MUL_A(x) (x = rotlFixed(x, 8), x ^ s_sosemanukMulTables[byte(x)]) +#else +#define MUL_A(x) (((x) << 8) ^ s_sosemanukMulTables[(x) >> 24]) +#endif + +#define DIV_A(x) (((x) >> 8) ^ s_sosemanukMulTables[256 + byte(x)]) + +#define r1(i) ((i%2) ? reg2 : reg1) +#define r2(i) ((i%2) ? reg1 : reg2) + +#define STEP(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, v, u) \ + u = (s##x9 + r2(x0)) ^ r1(x0);\ + v = s##x0;\ + s##x0 = MUL_A(s##x0) ^ DIV_A(s##x3) ^ s##x9;\ + r1(x0) += XMUX(r2(x0), s##x2, s##x9);\ + r2(x0) = rotlFixed(r2(x0) * 0x54655307, 7);\ + +#define SOSEMANUK_OUTPUT(x) \ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 0, u2 ^ v0);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 1, u3 ^ v1);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 2, u1 ^ v2);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, LITTLE_ENDIAN_ORDER, 3, u4 ^ v3); + +#define OUTPUT4 \ + S2(0, u0, u1, u2, u3, u4);\ + CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH(SOSEMANUK_OUTPUT, 4*4); + + word32 s0 = m_state[0]; + word32 s1 = m_state[1]; + word32 s2 = m_state[2]; + word32 s3 = m_state[3]; + word32 s4 = m_state[4]; + word32 s5 = m_state[5]; + word32 s6 = m_state[6]; + word32 s7 = m_state[7]; + word32 s8 = m_state[8]; + word32 s9 = m_state[9]; + word32 reg1 = m_state[10]; + word32 reg2 = m_state[11]; + word32 u0, u1, u2, u3, u4, v0, v1, v2, v3; + + do + { + STEP(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, v0, u0) + STEP(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, v1, u1) + STEP(2, 3, 4, 5, 6, 7, 8, 9, 0, 1, v2, u2) + STEP(3, 4, 5, 6, 7, 8, 9, 0, 1, 2, v3, u3) + OUTPUT4 + STEP(4, 5, 6, 7, 8, 9, 0, 1, 2, 3, v0, u0) + STEP(5, 6, 7, 8, 9, 0, 1, 2, 3, 4, v1, u1) + STEP(6, 7, 8, 9, 0, 1, 2, 3, 4, 5, v2, u2) + STEP(7, 8, 9, 0, 1, 2, 3, 4, 5, 6, v3, u3) + OUTPUT4 + STEP(8, 9, 0, 1, 2, 3, 4, 5, 6, 7, v0, u0) + STEP(9, 0, 1, 2, 3, 4, 5, 6, 7, 8, v1, u1) + STEP(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, v2, u2) + STEP(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, v3, u3) + OUTPUT4 + STEP(2, 3, 4, 5, 6, 7, 8, 9, 0, 1, v0, u0) + STEP(3, 4, 5, 6, 7, 8, 9, 0, 1, 2, v1, u1) + STEP(4, 5, 6, 7, 8, 9, 0, 1, 2, 3, v2, u2) + STEP(5, 6, 7, 8, 9, 0, 1, 2, 3, 4, v3, u3) + OUTPUT4 + STEP(6, 7, 8, 9, 0, 1, 2, 3, 4, 5, v0, u0) + STEP(7, 8, 9, 0, 1, 2, 3, 4, 5, 6, v1, u1) + STEP(8, 9, 0, 1, 2, 3, 4, 5, 6, 7, v2, u2) + STEP(9, 0, 1, 2, 3, 4, 5, 6, 7, 8, v3, u3) + OUTPUT4 + } + while (--iterationCount); + + m_state[0] = s0; + m_state[1] = s1; + m_state[2] = s2; + m_state[3] = s3; + m_state[4] = s4; + m_state[5] = s5; + m_state[6] = s6; + m_state[7] = s7; + m_state[8] = s8; + m_state[9] = s9; + m_state[10] = reg1; + m_state[11] = reg2; + } +} + +NAMESPACE_END + +#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM diff --git a/cryptopp/sosemanuk.h b/cryptopp/sosemanuk.h new file mode 100644 index 0000000..ff1d820 --- /dev/null +++ b/cryptopp/sosemanuk.h @@ -0,0 +1,40 @@ +#ifndef CRYPTOPP_SOSEMANUK_H +#define CRYPTOPP_SOSEMANUK_H + +#include "strciphr.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! algorithm info +struct SosemanukInfo : public VariableKeyLength<16, 1, 32, 1, SimpleKeyingInterface::UNIQUE_IV, 16> +{ + static const char * StaticAlgorithmName() {return "Sosemanuk";} +}; + +//! _ +class SosemanukPolicy : public AdditiveCipherConcretePolicy, public SosemanukInfo +{ +protected: + void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); + void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); + void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length); + bool CipherIsRandomAccess() const {return false;} +#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64 + unsigned int GetAlignment() const; + unsigned int GetOptimalBlockSize() const; +#endif + + FixedSizeSecBlock m_key; + FixedSizeAlignedSecBlock m_state; +}; + +//! Sosemanuk +struct Sosemanuk : public SosemanukInfo, public SymmetricCipherDocumentation +{ + typedef SymmetricCipherFinal >, SosemanukInfo> Encryption; + typedef Encryption Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/square.cpp b/cryptopp/square.cpp new file mode 100644 index 0000000..3686eac --- /dev/null +++ b/cryptopp/square.cpp @@ -0,0 +1,174 @@ +// square.cpp - written and placed in the public domain by Wei Dai +// Based on Paulo S.L.M. Barreto's public domain implementation + +#include "pch.h" +#include "square.h" +#include "misc.h" +#include "gf256.h" + +NAMESPACE_BEGIN(CryptoPP) + +// apply theta to a roundkey +static void SquareTransform (word32 in[4], word32 out[4]) +{ + static const byte G[4][4] = + { + 0x02U, 0x01U, 0x01U, 0x03U, + 0x03U, 0x02U, 0x01U, 0x01U, + 0x01U, 0x03U, 0x02U, 0x01U, + 0x01U, 0x01U, 0x03U, 0x02U + }; + + GF256 gf256(0xf5); + + for (int i = 0; i < 4; i++) + { + word32 temp = 0; + for (int j = 0; j < 4; j++) + for (int k = 0; k < 4; k++) + temp ^= (word32)gf256.Multiply(GETBYTE(in[i], 3-k), G[k][j]) << ((3-j)*8); + out[i] = temp; + } +} + +void Square::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &) +{ + AssertValidKeyLength(length); + + static const word32 offset[ROUNDS] = { + 0x01000000UL, 0x02000000UL, 0x04000000UL, 0x08000000UL, + 0x10000000UL, 0x20000000UL, 0x40000000UL, 0x80000000UL, + }; + + GetUserKey(BIG_ENDIAN_ORDER, roundkeys[0], KEYLENGTH/4, userKey, KEYLENGTH); + + /* apply the key evolution function */ + for (int i = 1; i < ROUNDS+1; i++) + { + roundkeys[i][0] = roundkeys[i-1][0] ^ rotlFixed(roundkeys[i-1][3], 8U) ^ offset[i-1]; + roundkeys[i][1] = roundkeys[i-1][1] ^ roundkeys[i][0]; + roundkeys[i][2] = roundkeys[i-1][2] ^ roundkeys[i][1]; + roundkeys[i][3] = roundkeys[i-1][3] ^ roundkeys[i][2]; + } + + /* produce the round keys */ + if (IsForwardTransformation()) + { + for (int i = 0; i < ROUNDS; i++) + SquareTransform (roundkeys[i], roundkeys[i]); + } + else + { + for (int i = 0; i < ROUNDS/2; i++) + for (int j = 0; j < 4; j++) + std::swap(roundkeys[i][j], roundkeys[ROUNDS-i][j]); + SquareTransform (roundkeys[ROUNDS], roundkeys[ROUNDS]); + } +} + +#define MSB(x) (((x) >> 24) & 0xffU) /* most significant byte */ +#define SSB(x) (((x) >> 16) & 0xffU) /* second in significance */ +#define TSB(x) (((x) >> 8) & 0xffU) /* third in significance */ +#define LSB(x) (((x) ) & 0xffU) /* least significant byte */ + +#define squareRound(text, temp, T0, T1, T2, T3, roundkey) \ +{ \ + temp[0] = T0[MSB (text[0])] \ + ^ T1[MSB (text[1])] \ + ^ T2[MSB (text[2])] \ + ^ T3[MSB (text[3])] \ + ^ roundkey[0]; \ + temp[1] = T0[SSB (text[0])] \ + ^ T1[SSB (text[1])] \ + ^ T2[SSB (text[2])] \ + ^ T3[SSB (text[3])] \ + ^ roundkey[1]; \ + temp[2] = T0[TSB (text[0])] \ + ^ T1[TSB (text[1])] \ + ^ T2[TSB (text[2])] \ + ^ T3[TSB (text[3])] \ + ^ roundkey[2]; \ + temp[3] = T0[LSB (text[0])] \ + ^ T1[LSB (text[1])] \ + ^ T2[LSB (text[2])] \ + ^ T3[LSB (text[3])] \ + ^ roundkey[3]; \ +} /* squareRound */ + +#define squareFinal(text, temp, S, roundkey) \ +{ \ + text[0] = ((word32) (S[MSB (temp[0])]) << 24) \ + ^ ((word32) (S[MSB (temp[1])]) << 16) \ + ^ ((word32) (S[MSB (temp[2])]) << 8) \ + ^ (word32) (S[MSB (temp[3])]) \ + ^ roundkey[0]; \ + text[1] = ((word32) (S[SSB (temp[0])]) << 24) \ + ^ ((word32) (S[SSB (temp[1])]) << 16) \ + ^ ((word32) (S[SSB (temp[2])]) << 8) \ + ^ (word32) (S[SSB (temp[3])]) \ + ^ roundkey[1]; \ + text[2] = ((word32) (S[TSB (temp[0])]) << 24) \ + ^ ((word32) (S[TSB (temp[1])]) << 16) \ + ^ ((word32) (S[TSB (temp[2])]) << 8) \ + ^ (word32) (S[TSB (temp[3])]) \ + ^ roundkey[2]; \ + text[3] = ((word32) (S[LSB (temp[0])]) << 24) \ + ^ ((word32) (S[LSB (temp[1])]) << 16) \ + ^ ((word32) (S[LSB (temp[2])]) << 8) \ + ^ (word32) (S[LSB (temp[3])]) \ + ^ roundkey[3]; \ +} /* squareFinal */ + +typedef BlockGetAndPut Block; + +void Square::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 text[4], temp[4]; + Block::Get(inBlock)(text[0])(text[1])(text[2])(text[3]); + + /* initial key addition */ + text[0] ^= roundkeys[0][0]; + text[1] ^= roundkeys[0][1]; + text[2] ^= roundkeys[0][2]; + text[3] ^= roundkeys[0][3]; + + /* ROUNDS - 1 full rounds */ + for (int i=1; i+1, public FixedKeyLength<16>, FixedRounds<8> +{ + static const char *StaticAlgorithmName() {return "Square";} +}; + +/// Square +class Square : public Square_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + FixedSizeSecBlock roundkeys; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + private: + static const byte Se[256]; + static const word32 Te[4][256]; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + private: + static const byte Sd[256]; + static const word32 Td[4][256]; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef Square::Encryption SquareEncryption; +typedef Square::Decryption SquareDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/squaretb.cpp b/cryptopp/squaretb.cpp new file mode 100644 index 0000000..bc3bee7 --- /dev/null +++ b/cryptopp/squaretb.cpp @@ -0,0 +1,582 @@ +#include "pch.h" +#include "square.h" + +NAMESPACE_BEGIN(CryptoPP) + +const byte Square::Enc::Se[256] = { +177, 206, 195, 149, 90, 173, 231, 2, 77, 68, 251, 145, 12, 135, 161, 80, +203, 103, 84, 221, 70, 143, 225, 78, 240, 253, 252, 235, 249, 196, 26, 110, + 94, 245, 204, 141, 28, 86, 67, 254, 7, 97, 248, 117, 89, 255, 3, 34, +138, 209, 19, 238, 136, 0, 14, 52, 21, 128, 148, 227, 237, 181, 83, 35, + 75, 71, 23, 167, 144, 53, 171, 216, 184, 223, 79, 87, 154, 146, 219, 27, + 60, 200, 153, 4, 142, 224, 215, 125, 133, 187, 64, 44, 58, 69, 241, 66, +101, 32, 65, 24, 114, 37, 147, 112, 54, 5, 242, 11, 163, 121, 236, 8, + 39, 49, 50, 182, 124, 176, 10, 115, 91, 123, 183, 129, 210, 13, 106, 38, +158, 88, 156, 131, 116, 179, 172, 48, 122, 105, 119, 15, 174, 33, 222, 208, + 46, 151, 16, 164, 152, 168, 212, 104, 45, 98, 41, 109, 22, 73, 118, 199, +232, 193, 150, 55, 229, 202, 244, 233, 99, 18, 194, 166, 20, 188, 211, 40, +175, 47, 230, 36, 82, 198, 160, 9, 189, 140, 207, 93, 17, 95, 1, 197, +159, 61, 162, 155, 201, 59, 190, 81, 25, 31, 63, 92, 178, 239, 74, 205, +191, 186, 111, 100, 217, 243, 62, 180, 170, 220, 213, 6, 192, 126, 246, 102, +108, 132, 113, 56, 185, 29, 127, 157, 72, 139, 42, 218, 165, 51, 130, 57, +214, 120, 134, 250, 228, 43, 169, 30, 137, 96, 107, 234, 85, 76, 247, 226, +}; + +const byte Square::Dec::Sd[256] = { + 53, 190, 7, 46, 83, 105, 219, 40, 111, 183, 118, 107, 12, 125, 54, 139, +146, 188, 169, 50, 172, 56, 156, 66, 99, 200, 30, 79, 36, 229, 247, 201, + 97, 141, 47, 63, 179, 101, 127, 112, 175, 154, 234, 245, 91, 152, 144, 177, +135, 113, 114, 237, 55, 69, 104, 163, 227, 239, 92, 197, 80, 193, 214, 202, + 90, 98, 95, 38, 9, 93, 20, 65, 232, 157, 206, 64, 253, 8, 23, 74, + 15, 199, 180, 62, 18, 252, 37, 75, 129, 44, 4, 120, 203, 187, 32, 189, +249, 41, 153, 168, 211, 96, 223, 17, 151, 137, 126, 250, 224, 155, 31, 210, +103, 226, 100, 119, 132, 43, 158, 138, 241, 109, 136, 121, 116, 87, 221, 230, + 57, 123, 238, 131, 225, 88, 242, 13, 52, 248, 48, 233, 185, 35, 84, 21, + 68, 11, 77, 102, 58, 3, 162, 145, 148, 82, 76, 195, 130, 231, 128, 192, +182, 14, 194, 108, 147, 236, 171, 67, 149, 246, 216, 70, 134, 5, 140, 176, +117, 0, 204, 133, 215, 61, 115, 122, 72, 228, 209, 89, 173, 184, 198, 208, +220, 161, 170, 2, 29, 191, 181, 159, 81, 196, 165, 16, 34, 207, 1, 186, +143, 49, 124, 174, 150, 218, 240, 86, 71, 212, 235, 78, 217, 19, 142, 73, + 85, 22, 255, 59, 244, 164, 178, 6, 160, 167, 251, 27, 110, 60, 51, 205, + 24, 94, 106, 213, 166, 33, 222, 254, 42, 28, 243, 10, 26, 25, 39, 45, +}; + +const word32 Square::Enc::Te[4][256] = { +{ +0x97b1b126UL, 0x69cecea7UL, 0x73c3c3b0UL, 0xdf95954aUL, +0xb45a5aeeUL, 0xafadad02UL, 0x3be7e7dcUL, 0x04020206UL, +0x9a4d4dd7UL, 0x884444ccUL, 0x03fbfbf8UL, 0xd7919146UL, +0x180c0c14UL, 0xfb87877cUL, 0xb7a1a116UL, 0xa05050f0UL, +0x63cbcba8UL, 0xce6767a9UL, 0xa85454fcUL, 0x4fdddd92UL, +0x8c4646caUL, 0xeb8f8f64UL, 0x37e1e1d6UL, 0x9c4e4ed2UL, +0x15f0f0e5UL, 0x0ffdfdf2UL, 0x0dfcfcf1UL, 0x23ebebc8UL, +0x07f9f9feUL, 0x7dc4c4b9UL, 0x341a1a2eUL, 0xdc6e6eb2UL, +0xbc5e5ee2UL, 0x1ff5f5eaUL, 0x6dcccca1UL, 0xef8d8d62UL, +0x381c1c24UL, 0xac5656faUL, 0x864343c5UL, 0x09fefef7UL, +0x0e070709UL, 0xc26161a3UL, 0x05f8f8fdUL, 0xea75759fUL, +0xb25959ebUL, 0x0bfffff4UL, 0x06030305UL, 0x44222266UL, +0xe18a8a6bUL, 0x57d1d186UL, 0x26131335UL, 0x29eeeec7UL, +0xe588886dUL, 0x00000000UL, 0x1c0e0e12UL, 0x6834345cUL, +0x2a15153fUL, 0xf5808075UL, 0xdd949449UL, 0x33e3e3d0UL, +0x2fededc2UL, 0x9fb5b52aUL, 0xa65353f5UL, 0x46232365UL, +0x964b4bddUL, 0x8e4747c9UL, 0x2e171739UL, 0xbba7a71cUL, +0xd5909045UL, 0x6a35355fUL, 0xa3abab08UL, 0x45d8d89dUL, +0x85b8b83dUL, 0x4bdfdf94UL, 0x9e4f4fd1UL, 0xae5757f9UL, +0xc19a9a5bUL, 0xd1929243UL, 0x43dbdb98UL, 0x361b1b2dUL, +0x783c3c44UL, 0x65c8c8adUL, 0xc799995eUL, 0x0804040cUL, +0xe98e8e67UL, 0x35e0e0d5UL, 0x5bd7d78cUL, 0xfa7d7d87UL, +0xff85857aUL, 0x83bbbb38UL, 0x804040c0UL, 0x582c2c74UL, +0x743a3a4eUL, 0x8a4545cfUL, 0x17f1f1e6UL, 0x844242c6UL, +0xca6565afUL, 0x40202060UL, 0x824141c3UL, 0x30181828UL, +0xe4727296UL, 0x4a25256fUL, 0xd3939340UL, 0xe0707090UL, +0x6c36365aUL, 0x0a05050fUL, 0x11f2f2e3UL, 0x160b0b1dUL, +0xb3a3a310UL, 0xf279798bUL, 0x2dececc1UL, 0x10080818UL, +0x4e272769UL, 0x62313153UL, 0x64323256UL, 0x99b6b62fUL, +0xf87c7c84UL, 0x95b0b025UL, 0x140a0a1eUL, 0xe6737395UL, +0xb65b5bedUL, 0xf67b7b8dUL, 0x9bb7b72cUL, 0xf7818176UL, +0x51d2d283UL, 0x1a0d0d17UL, 0xd46a6abeUL, 0x4c26266aUL, +0xc99e9e57UL, 0xb05858e8UL, 0xcd9c9c51UL, 0xf3838370UL, +0xe874749cUL, 0x93b3b320UL, 0xadacac01UL, 0x60303050UL, +0xf47a7a8eUL, 0xd26969bbUL, 0xee777799UL, 0x1e0f0f11UL, +0xa9aeae07UL, 0x42212163UL, 0x49dede97UL, 0x55d0d085UL, +0x5c2e2e72UL, 0xdb97974cUL, 0x20101030UL, 0xbda4a419UL, +0xc598985dUL, 0xa5a8a80dUL, 0x5dd4d489UL, 0xd06868b8UL, +0x5a2d2d77UL, 0xc46262a6UL, 0x5229297bUL, 0xda6d6db7UL, +0x2c16163aUL, 0x924949dbUL, 0xec76769aUL, 0x7bc7c7bcUL, +0x25e8e8cdUL, 0x77c1c1b6UL, 0xd996964fUL, 0x6e373759UL, +0x3fe5e5daUL, 0x61cacaabUL, 0x1df4f4e9UL, 0x27e9e9ceUL, +0xc66363a5UL, 0x24121236UL, 0x71c2c2b3UL, 0xb9a6a61fUL, +0x2814143cUL, 0x8dbcbc31UL, 0x53d3d380UL, 0x50282878UL, +0xabafaf04UL, 0x5e2f2f71UL, 0x39e6e6dfUL, 0x4824246cUL, +0xa45252f6UL, 0x79c6c6bfUL, 0xb5a0a015UL, 0x1209091bUL, +0x8fbdbd32UL, 0xed8c8c61UL, 0x6bcfcfa4UL, 0xba5d5de7UL, +0x22111133UL, 0xbe5f5fe1UL, 0x02010103UL, 0x7fc5c5baUL, +0xcb9f9f54UL, 0x7a3d3d47UL, 0xb1a2a213UL, 0xc39b9b58UL, +0x67c9c9aeUL, 0x763b3b4dUL, 0x89bebe37UL, 0xa25151f3UL, +0x3219192bUL, 0x3e1f1f21UL, 0x7e3f3f41UL, 0xb85c5ce4UL, +0x91b2b223UL, 0x2befefc4UL, 0x944a4adeUL, 0x6fcdcda2UL, +0x8bbfbf34UL, 0x81baba3bUL, 0xde6f6fb1UL, 0xc86464acUL, +0x47d9d99eUL, 0x13f3f3e0UL, 0x7c3e3e42UL, 0x9db4b429UL, +0xa1aaaa0bUL, 0x4ddcdc91UL, 0x5fd5d58aUL, 0x0c06060aUL, +0x75c0c0b5UL, 0xfc7e7e82UL, 0x19f6f6efUL, 0xcc6666aaUL, +0xd86c6cb4UL, 0xfd848479UL, 0xe2717193UL, 0x70383848UL, +0x87b9b93eUL, 0x3a1d1d27UL, 0xfe7f7f81UL, 0xcf9d9d52UL, +0x904848d8UL, 0xe38b8b68UL, 0x542a2a7eUL, 0x41dada9bUL, +0xbfa5a51aUL, 0x66333355UL, 0xf1828273UL, 0x7239394bUL, +0x59d6d68fUL, 0xf0787888UL, 0xf986867fUL, 0x01fafafbUL, +0x3de4e4d9UL, 0x562b2b7dUL, 0xa7a9a90eUL, 0x3c1e1e22UL, +0xe789896eUL, 0xc06060a0UL, 0xd66b6bbdUL, 0x21eaeacbUL, +0xaa5555ffUL, 0x984c4cd4UL, 0x1bf7f7ecUL, 0x31e2e2d3UL, +}, + +{ +0x2697b1b1UL, 0xa769ceceUL, 0xb073c3c3UL, 0x4adf9595UL, +0xeeb45a5aUL, 0x02afadadUL, 0xdc3be7e7UL, 0x06040202UL, +0xd79a4d4dUL, 0xcc884444UL, 0xf803fbfbUL, 0x46d79191UL, +0x14180c0cUL, 0x7cfb8787UL, 0x16b7a1a1UL, 0xf0a05050UL, +0xa863cbcbUL, 0xa9ce6767UL, 0xfca85454UL, 0x924fddddUL, +0xca8c4646UL, 0x64eb8f8fUL, 0xd637e1e1UL, 0xd29c4e4eUL, +0xe515f0f0UL, 0xf20ffdfdUL, 0xf10dfcfcUL, 0xc823ebebUL, +0xfe07f9f9UL, 0xb97dc4c4UL, 0x2e341a1aUL, 0xb2dc6e6eUL, +0xe2bc5e5eUL, 0xea1ff5f5UL, 0xa16dccccUL, 0x62ef8d8dUL, +0x24381c1cUL, 0xfaac5656UL, 0xc5864343UL, 0xf709fefeUL, +0x090e0707UL, 0xa3c26161UL, 0xfd05f8f8UL, 0x9fea7575UL, +0xebb25959UL, 0xf40bffffUL, 0x05060303UL, 0x66442222UL, +0x6be18a8aUL, 0x8657d1d1UL, 0x35261313UL, 0xc729eeeeUL, +0x6de58888UL, 0x00000000UL, 0x121c0e0eUL, 0x5c683434UL, +0x3f2a1515UL, 0x75f58080UL, 0x49dd9494UL, 0xd033e3e3UL, +0xc22fededUL, 0x2a9fb5b5UL, 0xf5a65353UL, 0x65462323UL, +0xdd964b4bUL, 0xc98e4747UL, 0x392e1717UL, 0x1cbba7a7UL, +0x45d59090UL, 0x5f6a3535UL, 0x08a3ababUL, 0x9d45d8d8UL, +0x3d85b8b8UL, 0x944bdfdfUL, 0xd19e4f4fUL, 0xf9ae5757UL, +0x5bc19a9aUL, 0x43d19292UL, 0x9843dbdbUL, 0x2d361b1bUL, +0x44783c3cUL, 0xad65c8c8UL, 0x5ec79999UL, 0x0c080404UL, +0x67e98e8eUL, 0xd535e0e0UL, 0x8c5bd7d7UL, 0x87fa7d7dUL, +0x7aff8585UL, 0x3883bbbbUL, 0xc0804040UL, 0x74582c2cUL, +0x4e743a3aUL, 0xcf8a4545UL, 0xe617f1f1UL, 0xc6844242UL, +0xafca6565UL, 0x60402020UL, 0xc3824141UL, 0x28301818UL, +0x96e47272UL, 0x6f4a2525UL, 0x40d39393UL, 0x90e07070UL, +0x5a6c3636UL, 0x0f0a0505UL, 0xe311f2f2UL, 0x1d160b0bUL, +0x10b3a3a3UL, 0x8bf27979UL, 0xc12dececUL, 0x18100808UL, +0x694e2727UL, 0x53623131UL, 0x56643232UL, 0x2f99b6b6UL, +0x84f87c7cUL, 0x2595b0b0UL, 0x1e140a0aUL, 0x95e67373UL, +0xedb65b5bUL, 0x8df67b7bUL, 0x2c9bb7b7UL, 0x76f78181UL, +0x8351d2d2UL, 0x171a0d0dUL, 0xbed46a6aUL, 0x6a4c2626UL, +0x57c99e9eUL, 0xe8b05858UL, 0x51cd9c9cUL, 0x70f38383UL, +0x9ce87474UL, 0x2093b3b3UL, 0x01adacacUL, 0x50603030UL, +0x8ef47a7aUL, 0xbbd26969UL, 0x99ee7777UL, 0x111e0f0fUL, +0x07a9aeaeUL, 0x63422121UL, 0x9749dedeUL, 0x8555d0d0UL, +0x725c2e2eUL, 0x4cdb9797UL, 0x30201010UL, 0x19bda4a4UL, +0x5dc59898UL, 0x0da5a8a8UL, 0x895dd4d4UL, 0xb8d06868UL, +0x775a2d2dUL, 0xa6c46262UL, 0x7b522929UL, 0xb7da6d6dUL, +0x3a2c1616UL, 0xdb924949UL, 0x9aec7676UL, 0xbc7bc7c7UL, +0xcd25e8e8UL, 0xb677c1c1UL, 0x4fd99696UL, 0x596e3737UL, +0xda3fe5e5UL, 0xab61cacaUL, 0xe91df4f4UL, 0xce27e9e9UL, +0xa5c66363UL, 0x36241212UL, 0xb371c2c2UL, 0x1fb9a6a6UL, +0x3c281414UL, 0x318dbcbcUL, 0x8053d3d3UL, 0x78502828UL, +0x04abafafUL, 0x715e2f2fUL, 0xdf39e6e6UL, 0x6c482424UL, +0xf6a45252UL, 0xbf79c6c6UL, 0x15b5a0a0UL, 0x1b120909UL, +0x328fbdbdUL, 0x61ed8c8cUL, 0xa46bcfcfUL, 0xe7ba5d5dUL, +0x33221111UL, 0xe1be5f5fUL, 0x03020101UL, 0xba7fc5c5UL, +0x54cb9f9fUL, 0x477a3d3dUL, 0x13b1a2a2UL, 0x58c39b9bUL, +0xae67c9c9UL, 0x4d763b3bUL, 0x3789bebeUL, 0xf3a25151UL, +0x2b321919UL, 0x213e1f1fUL, 0x417e3f3fUL, 0xe4b85c5cUL, +0x2391b2b2UL, 0xc42befefUL, 0xde944a4aUL, 0xa26fcdcdUL, +0x348bbfbfUL, 0x3b81babaUL, 0xb1de6f6fUL, 0xacc86464UL, +0x9e47d9d9UL, 0xe013f3f3UL, 0x427c3e3eUL, 0x299db4b4UL, +0x0ba1aaaaUL, 0x914ddcdcUL, 0x8a5fd5d5UL, 0x0a0c0606UL, +0xb575c0c0UL, 0x82fc7e7eUL, 0xef19f6f6UL, 0xaacc6666UL, +0xb4d86c6cUL, 0x79fd8484UL, 0x93e27171UL, 0x48703838UL, +0x3e87b9b9UL, 0x273a1d1dUL, 0x81fe7f7fUL, 0x52cf9d9dUL, +0xd8904848UL, 0x68e38b8bUL, 0x7e542a2aUL, 0x9b41dadaUL, +0x1abfa5a5UL, 0x55663333UL, 0x73f18282UL, 0x4b723939UL, +0x8f59d6d6UL, 0x88f07878UL, 0x7ff98686UL, 0xfb01fafaUL, +0xd93de4e4UL, 0x7d562b2bUL, 0x0ea7a9a9UL, 0x223c1e1eUL, +0x6ee78989UL, 0xa0c06060UL, 0xbdd66b6bUL, 0xcb21eaeaUL, +0xffaa5555UL, 0xd4984c4cUL, 0xec1bf7f7UL, 0xd331e2e2UL, +}, + +{ +0xb12697b1UL, 0xcea769ceUL, 0xc3b073c3UL, 0x954adf95UL, +0x5aeeb45aUL, 0xad02afadUL, 0xe7dc3be7UL, 0x02060402UL, +0x4dd79a4dUL, 0x44cc8844UL, 0xfbf803fbUL, 0x9146d791UL, +0x0c14180cUL, 0x877cfb87UL, 0xa116b7a1UL, 0x50f0a050UL, +0xcba863cbUL, 0x67a9ce67UL, 0x54fca854UL, 0xdd924fddUL, +0x46ca8c46UL, 0x8f64eb8fUL, 0xe1d637e1UL, 0x4ed29c4eUL, +0xf0e515f0UL, 0xfdf20ffdUL, 0xfcf10dfcUL, 0xebc823ebUL, +0xf9fe07f9UL, 0xc4b97dc4UL, 0x1a2e341aUL, 0x6eb2dc6eUL, +0x5ee2bc5eUL, 0xf5ea1ff5UL, 0xcca16dccUL, 0x8d62ef8dUL, +0x1c24381cUL, 0x56faac56UL, 0x43c58643UL, 0xfef709feUL, +0x07090e07UL, 0x61a3c261UL, 0xf8fd05f8UL, 0x759fea75UL, +0x59ebb259UL, 0xfff40bffUL, 0x03050603UL, 0x22664422UL, +0x8a6be18aUL, 0xd18657d1UL, 0x13352613UL, 0xeec729eeUL, +0x886de588UL, 0x00000000UL, 0x0e121c0eUL, 0x345c6834UL, +0x153f2a15UL, 0x8075f580UL, 0x9449dd94UL, 0xe3d033e3UL, +0xedc22fedUL, 0xb52a9fb5UL, 0x53f5a653UL, 0x23654623UL, +0x4bdd964bUL, 0x47c98e47UL, 0x17392e17UL, 0xa71cbba7UL, +0x9045d590UL, 0x355f6a35UL, 0xab08a3abUL, 0xd89d45d8UL, +0xb83d85b8UL, 0xdf944bdfUL, 0x4fd19e4fUL, 0x57f9ae57UL, +0x9a5bc19aUL, 0x9243d192UL, 0xdb9843dbUL, 0x1b2d361bUL, +0x3c44783cUL, 0xc8ad65c8UL, 0x995ec799UL, 0x040c0804UL, +0x8e67e98eUL, 0xe0d535e0UL, 0xd78c5bd7UL, 0x7d87fa7dUL, +0x857aff85UL, 0xbb3883bbUL, 0x40c08040UL, 0x2c74582cUL, +0x3a4e743aUL, 0x45cf8a45UL, 0xf1e617f1UL, 0x42c68442UL, +0x65afca65UL, 0x20604020UL, 0x41c38241UL, 0x18283018UL, +0x7296e472UL, 0x256f4a25UL, 0x9340d393UL, 0x7090e070UL, +0x365a6c36UL, 0x050f0a05UL, 0xf2e311f2UL, 0x0b1d160bUL, +0xa310b3a3UL, 0x798bf279UL, 0xecc12decUL, 0x08181008UL, +0x27694e27UL, 0x31536231UL, 0x32566432UL, 0xb62f99b6UL, +0x7c84f87cUL, 0xb02595b0UL, 0x0a1e140aUL, 0x7395e673UL, +0x5bedb65bUL, 0x7b8df67bUL, 0xb72c9bb7UL, 0x8176f781UL, +0xd28351d2UL, 0x0d171a0dUL, 0x6abed46aUL, 0x266a4c26UL, +0x9e57c99eUL, 0x58e8b058UL, 0x9c51cd9cUL, 0x8370f383UL, +0x749ce874UL, 0xb32093b3UL, 0xac01adacUL, 0x30506030UL, +0x7a8ef47aUL, 0x69bbd269UL, 0x7799ee77UL, 0x0f111e0fUL, +0xae07a9aeUL, 0x21634221UL, 0xde9749deUL, 0xd08555d0UL, +0x2e725c2eUL, 0x974cdb97UL, 0x10302010UL, 0xa419bda4UL, +0x985dc598UL, 0xa80da5a8UL, 0xd4895dd4UL, 0x68b8d068UL, +0x2d775a2dUL, 0x62a6c462UL, 0x297b5229UL, 0x6db7da6dUL, +0x163a2c16UL, 0x49db9249UL, 0x769aec76UL, 0xc7bc7bc7UL, +0xe8cd25e8UL, 0xc1b677c1UL, 0x964fd996UL, 0x37596e37UL, +0xe5da3fe5UL, 0xcaab61caUL, 0xf4e91df4UL, 0xe9ce27e9UL, +0x63a5c663UL, 0x12362412UL, 0xc2b371c2UL, 0xa61fb9a6UL, +0x143c2814UL, 0xbc318dbcUL, 0xd38053d3UL, 0x28785028UL, +0xaf04abafUL, 0x2f715e2fUL, 0xe6df39e6UL, 0x246c4824UL, +0x52f6a452UL, 0xc6bf79c6UL, 0xa015b5a0UL, 0x091b1209UL, +0xbd328fbdUL, 0x8c61ed8cUL, 0xcfa46bcfUL, 0x5de7ba5dUL, +0x11332211UL, 0x5fe1be5fUL, 0x01030201UL, 0xc5ba7fc5UL, +0x9f54cb9fUL, 0x3d477a3dUL, 0xa213b1a2UL, 0x9b58c39bUL, +0xc9ae67c9UL, 0x3b4d763bUL, 0xbe3789beUL, 0x51f3a251UL, +0x192b3219UL, 0x1f213e1fUL, 0x3f417e3fUL, 0x5ce4b85cUL, +0xb22391b2UL, 0xefc42befUL, 0x4ade944aUL, 0xcda26fcdUL, +0xbf348bbfUL, 0xba3b81baUL, 0x6fb1de6fUL, 0x64acc864UL, +0xd99e47d9UL, 0xf3e013f3UL, 0x3e427c3eUL, 0xb4299db4UL, +0xaa0ba1aaUL, 0xdc914ddcUL, 0xd58a5fd5UL, 0x060a0c06UL, +0xc0b575c0UL, 0x7e82fc7eUL, 0xf6ef19f6UL, 0x66aacc66UL, +0x6cb4d86cUL, 0x8479fd84UL, 0x7193e271UL, 0x38487038UL, +0xb93e87b9UL, 0x1d273a1dUL, 0x7f81fe7fUL, 0x9d52cf9dUL, +0x48d89048UL, 0x8b68e38bUL, 0x2a7e542aUL, 0xda9b41daUL, +0xa51abfa5UL, 0x33556633UL, 0x8273f182UL, 0x394b7239UL, +0xd68f59d6UL, 0x7888f078UL, 0x867ff986UL, 0xfafb01faUL, +0xe4d93de4UL, 0x2b7d562bUL, 0xa90ea7a9UL, 0x1e223c1eUL, +0x896ee789UL, 0x60a0c060UL, 0x6bbdd66bUL, 0xeacb21eaUL, +0x55ffaa55UL, 0x4cd4984cUL, 0xf7ec1bf7UL, 0xe2d331e2UL, +}, + +{ +0xb1b12697UL, 0xcecea769UL, 0xc3c3b073UL, 0x95954adfUL, +0x5a5aeeb4UL, 0xadad02afUL, 0xe7e7dc3bUL, 0x02020604UL, +0x4d4dd79aUL, 0x4444cc88UL, 0xfbfbf803UL, 0x919146d7UL, +0x0c0c1418UL, 0x87877cfbUL, 0xa1a116b7UL, 0x5050f0a0UL, +0xcbcba863UL, 0x6767a9ceUL, 0x5454fca8UL, 0xdddd924fUL, +0x4646ca8cUL, 0x8f8f64ebUL, 0xe1e1d637UL, 0x4e4ed29cUL, +0xf0f0e515UL, 0xfdfdf20fUL, 0xfcfcf10dUL, 0xebebc823UL, +0xf9f9fe07UL, 0xc4c4b97dUL, 0x1a1a2e34UL, 0x6e6eb2dcUL, +0x5e5ee2bcUL, 0xf5f5ea1fUL, 0xcccca16dUL, 0x8d8d62efUL, +0x1c1c2438UL, 0x5656faacUL, 0x4343c586UL, 0xfefef709UL, +0x0707090eUL, 0x6161a3c2UL, 0xf8f8fd05UL, 0x75759feaUL, +0x5959ebb2UL, 0xfffff40bUL, 0x03030506UL, 0x22226644UL, +0x8a8a6be1UL, 0xd1d18657UL, 0x13133526UL, 0xeeeec729UL, +0x88886de5UL, 0x00000000UL, 0x0e0e121cUL, 0x34345c68UL, +0x15153f2aUL, 0x808075f5UL, 0x949449ddUL, 0xe3e3d033UL, +0xededc22fUL, 0xb5b52a9fUL, 0x5353f5a6UL, 0x23236546UL, +0x4b4bdd96UL, 0x4747c98eUL, 0x1717392eUL, 0xa7a71cbbUL, +0x909045d5UL, 0x35355f6aUL, 0xabab08a3UL, 0xd8d89d45UL, +0xb8b83d85UL, 0xdfdf944bUL, 0x4f4fd19eUL, 0x5757f9aeUL, +0x9a9a5bc1UL, 0x929243d1UL, 0xdbdb9843UL, 0x1b1b2d36UL, +0x3c3c4478UL, 0xc8c8ad65UL, 0x99995ec7UL, 0x04040c08UL, +0x8e8e67e9UL, 0xe0e0d535UL, 0xd7d78c5bUL, 0x7d7d87faUL, +0x85857affUL, 0xbbbb3883UL, 0x4040c080UL, 0x2c2c7458UL, +0x3a3a4e74UL, 0x4545cf8aUL, 0xf1f1e617UL, 0x4242c684UL, +0x6565afcaUL, 0x20206040UL, 0x4141c382UL, 0x18182830UL, +0x727296e4UL, 0x25256f4aUL, 0x939340d3UL, 0x707090e0UL, +0x36365a6cUL, 0x05050f0aUL, 0xf2f2e311UL, 0x0b0b1d16UL, +0xa3a310b3UL, 0x79798bf2UL, 0xececc12dUL, 0x08081810UL, +0x2727694eUL, 0x31315362UL, 0x32325664UL, 0xb6b62f99UL, +0x7c7c84f8UL, 0xb0b02595UL, 0x0a0a1e14UL, 0x737395e6UL, +0x5b5bedb6UL, 0x7b7b8df6UL, 0xb7b72c9bUL, 0x818176f7UL, +0xd2d28351UL, 0x0d0d171aUL, 0x6a6abed4UL, 0x26266a4cUL, +0x9e9e57c9UL, 0x5858e8b0UL, 0x9c9c51cdUL, 0x838370f3UL, +0x74749ce8UL, 0xb3b32093UL, 0xacac01adUL, 0x30305060UL, +0x7a7a8ef4UL, 0x6969bbd2UL, 0x777799eeUL, 0x0f0f111eUL, +0xaeae07a9UL, 0x21216342UL, 0xdede9749UL, 0xd0d08555UL, +0x2e2e725cUL, 0x97974cdbUL, 0x10103020UL, 0xa4a419bdUL, +0x98985dc5UL, 0xa8a80da5UL, 0xd4d4895dUL, 0x6868b8d0UL, +0x2d2d775aUL, 0x6262a6c4UL, 0x29297b52UL, 0x6d6db7daUL, +0x16163a2cUL, 0x4949db92UL, 0x76769aecUL, 0xc7c7bc7bUL, +0xe8e8cd25UL, 0xc1c1b677UL, 0x96964fd9UL, 0x3737596eUL, +0xe5e5da3fUL, 0xcacaab61UL, 0xf4f4e91dUL, 0xe9e9ce27UL, +0x6363a5c6UL, 0x12123624UL, 0xc2c2b371UL, 0xa6a61fb9UL, +0x14143c28UL, 0xbcbc318dUL, 0xd3d38053UL, 0x28287850UL, +0xafaf04abUL, 0x2f2f715eUL, 0xe6e6df39UL, 0x24246c48UL, +0x5252f6a4UL, 0xc6c6bf79UL, 0xa0a015b5UL, 0x09091b12UL, +0xbdbd328fUL, 0x8c8c61edUL, 0xcfcfa46bUL, 0x5d5de7baUL, +0x11113322UL, 0x5f5fe1beUL, 0x01010302UL, 0xc5c5ba7fUL, +0x9f9f54cbUL, 0x3d3d477aUL, 0xa2a213b1UL, 0x9b9b58c3UL, +0xc9c9ae67UL, 0x3b3b4d76UL, 0xbebe3789UL, 0x5151f3a2UL, +0x19192b32UL, 0x1f1f213eUL, 0x3f3f417eUL, 0x5c5ce4b8UL, +0xb2b22391UL, 0xefefc42bUL, 0x4a4ade94UL, 0xcdcda26fUL, +0xbfbf348bUL, 0xbaba3b81UL, 0x6f6fb1deUL, 0x6464acc8UL, +0xd9d99e47UL, 0xf3f3e013UL, 0x3e3e427cUL, 0xb4b4299dUL, +0xaaaa0ba1UL, 0xdcdc914dUL, 0xd5d58a5fUL, 0x06060a0cUL, +0xc0c0b575UL, 0x7e7e82fcUL, 0xf6f6ef19UL, 0x6666aaccUL, +0x6c6cb4d8UL, 0x848479fdUL, 0x717193e2UL, 0x38384870UL, +0xb9b93e87UL, 0x1d1d273aUL, 0x7f7f81feUL, 0x9d9d52cfUL, +0x4848d890UL, 0x8b8b68e3UL, 0x2a2a7e54UL, 0xdada9b41UL, +0xa5a51abfUL, 0x33335566UL, 0x828273f1UL, 0x39394b72UL, +0xd6d68f59UL, 0x787888f0UL, 0x86867ff9UL, 0xfafafb01UL, +0xe4e4d93dUL, 0x2b2b7d56UL, 0xa9a90ea7UL, 0x1e1e223cUL, +0x89896ee7UL, 0x6060a0c0UL, 0x6b6bbdd6UL, 0xeaeacb21UL, +0x5555ffaaUL, 0x4c4cd498UL, 0xf7f7ec1bUL, 0xe2e2d331UL, +}}; + +const word32 Square::Dec::Td[4][256] = { +{ +0xe368bc02UL, 0x5585620cUL, 0x2a3f2331UL, 0x61ab13f7UL, +0x98d46d72UL, 0x21cb9a19UL, 0x3c22a461UL, 0x459d3dcdUL, +0x05fdb423UL, 0x2bc4075fUL, 0x9b2c01c0UL, 0x3dd9800fUL, +0x486c5c74UL, 0xf97f7e85UL, 0xf173ab1fUL, 0xb6edde0eUL, +0x283c6bedUL, 0x4997781aUL, 0x9f2a918dUL, 0xc9579f33UL, +0xa907a8aaUL, 0xa50ded7dUL, 0x7c422d8fUL, 0x764db0c9UL, +0x4d91e857UL, 0xcea963ccUL, 0xb4ee96d2UL, 0x3028e1b6UL, +0x0df161b9UL, 0xbd196726UL, 0x419bad80UL, 0xc0a06ec7UL, +0x5183f241UL, 0x92dbf034UL, 0x6fa21efcUL, 0x8f32ce4cUL, +0x13e03373UL, 0x69a7c66dUL, 0xe56d6493UL, 0xbf1a2ffaUL, +0xbb1cbfb7UL, 0x587403b5UL, 0xe76e2c4fUL, 0x5d89b796UL, +0xe89c052aUL, 0x446619a3UL, 0x342e71fbUL, 0x0ff22965UL, +0xfe81827aUL, 0xb11322f1UL, 0xa30835ecUL, 0xcd510f7eUL, +0xff7aa614UL, 0x5c7293f8UL, 0x2fc29712UL, 0xf370e3c3UL, +0x992f491cUL, 0xd1431568UL, 0xc2a3261bUL, 0x88cc32b3UL, +0x8acf7a6fUL, 0xb0e8069fUL, 0x7a47f51eUL, 0xd2bb79daUL, +0xe6950821UL, 0x4398e55cUL, 0xd0b83106UL, 0x11e37bafUL, +0x7e416553UL, 0xccaa2b10UL, 0xd8b4e49cUL, 0x6456a7d4UL, +0xfb7c3659UL, 0x724b2084UL, 0xea9f4df6UL, 0x6a5faadfUL, +0x2dc1dfceUL, 0x70486858UL, 0xcaaff381UL, 0x0605d891UL, +0x5a774b69UL, 0x94de28a5UL, 0x39df1042UL, 0x813bc347UL, +0xfc82caa6UL, 0x23c8d2c5UL, 0x03f86cb2UL, 0x080cd59aUL, +0xdab7ac40UL, 0x7db909e1UL, 0x3824342cUL, 0xcf5247a2UL, +0xdcb274d1UL, 0x63a85b2bUL, 0x35d55595UL, 0x479e7511UL, +0x15e5ebe2UL, 0x4b9430c6UL, 0x4a6f14a8UL, 0x91239c86UL, +0x4c6acc39UL, 0x5f8aff4aUL, 0x0406904dUL, 0xee99ddbbUL, +0x1e1152caUL, 0xaaffc418UL, 0xeb646998UL, 0x07fefcffUL, +0x8b345e01UL, 0x567d0ebeUL, 0xbae79bd9UL, 0x4263c132UL, +0x75b5dc7bUL, 0x97264417UL, 0x67aecb66UL, 0x95250ccbUL, +0xec9a9567UL, 0x57862ad0UL, 0x60503799UL, 0xb8e4d305UL, +0x65ad83baUL, 0x19efae35UL, 0xa4f6c913UL, 0xc15b4aa9UL, +0x873e1bd6UL, 0xa0f0595eUL, 0x18148a5bUL, 0xaf02703bUL, +0xab04e076UL, 0xdd4950bfUL, 0xdf4a1863UL, 0xc6a5b656UL, +0x853d530aUL, 0xfa871237UL, 0x77b694a7UL, 0x4665517fUL, +0xed61b109UL, 0x1bece6e9UL, 0xd5458525UL, 0xf5753b52UL, +0x7fba413dUL, 0x27ce4288UL, 0xb2eb4e43UL, 0xd6bde997UL, +0x527b9ef3UL, 0x62537f45UL, 0x2c3afba0UL, 0x7bbcd170UL, +0xb91ff76bUL, 0x121b171dUL, 0xfd79eec8UL, 0x3a277cf0UL, +0x0c0a45d7UL, 0x96dd6079UL, 0x2233f6abUL, 0xacfa1c89UL, +0xc8acbb5dUL, 0xa10b7d30UL, 0xd4bea14bUL, 0xbee10b94UL, +0x25cd0a54UL, 0x547e4662UL, 0xa2f31182UL, 0x17e6a33eUL, +0x263566e6UL, 0xc3580275UL, 0x83388b9bUL, 0x7844bdc2UL, +0x020348dcUL, 0x4f92a08bUL, 0x2e39b37cUL, 0x4e6984e5UL, +0xf0888f71UL, 0x362d3927UL, 0x9cd2fd3fUL, 0x01fb246eUL, +0x893716ddUL, 0x00000000UL, 0xf68d57e0UL, 0xe293986cUL, +0x744ef815UL, 0x9320d45aUL, 0xad0138e7UL, 0xd3405db4UL, +0x1a17c287UL, 0xb3106a2dUL, 0x5078d62fUL, 0xf48e1f3cUL, +0xa70ea5a1UL, 0x71b34c36UL, 0x9ad725aeUL, 0x5e71db24UL, +0x161d8750UL, 0xef62f9d5UL, 0x8d318690UL, 0x1c121a16UL, +0xa6f581cfUL, 0x5b8c6f07UL, 0x37d61d49UL, 0x6e593a92UL, +0x84c67764UL, 0x86c53fb8UL, 0xd746cdf9UL, 0xe090d0b0UL, +0x29c74f83UL, 0xe49640fdUL, 0x0e090d0bUL, 0x6da15620UL, +0x8ec9ea22UL, 0xdb4c882eUL, 0xf776738eUL, 0xb515b2bcUL, +0x10185fc1UL, 0x322ba96aUL, 0x6ba48eb1UL, 0xaef95455UL, +0x406089eeUL, 0x6655ef08UL, 0xe9672144UL, 0x3e21ecbdUL, +0x2030be77UL, 0xf28bc7adUL, 0x80c0e729UL, 0x141ecf8cUL, +0xbce24348UL, 0xc4a6fe8aUL, 0x31d3c5d8UL, 0xb716fa60UL, +0x5380ba9dUL, 0xd94fc0f2UL, 0x1de93e78UL, 0x24362e3aUL, +0xe16bf4deUL, 0xcb54d7efUL, 0x09f7f1f4UL, 0x82c3aff5UL, +0x0bf4b928UL, 0x9d29d951UL, 0xc75e9238UL, 0xf8845aebUL, +0x90d8b8e8UL, 0xdeb13c0dUL, 0x33d08d04UL, 0x685ce203UL, +0xc55ddae4UL, 0x3bdc589eUL, 0x0a0f9d46UL, 0x3fdac8d3UL, +0x598f27dbUL, 0xa8fc8cc4UL, 0x79bf99acUL, 0x6c5a724eUL, +0x8ccaa2feUL, 0x9ed1b5e3UL, 0x1fea76a4UL, 0x73b004eaUL, +}, + +{ +0x02e368bcUL, 0x0c558562UL, 0x312a3f23UL, 0xf761ab13UL, +0x7298d46dUL, 0x1921cb9aUL, 0x613c22a4UL, 0xcd459d3dUL, +0x2305fdb4UL, 0x5f2bc407UL, 0xc09b2c01UL, 0x0f3dd980UL, +0x74486c5cUL, 0x85f97f7eUL, 0x1ff173abUL, 0x0eb6eddeUL, +0xed283c6bUL, 0x1a499778UL, 0x8d9f2a91UL, 0x33c9579fUL, +0xaaa907a8UL, 0x7da50dedUL, 0x8f7c422dUL, 0xc9764db0UL, +0x574d91e8UL, 0xcccea963UL, 0xd2b4ee96UL, 0xb63028e1UL, +0xb90df161UL, 0x26bd1967UL, 0x80419badUL, 0xc7c0a06eUL, +0x415183f2UL, 0x3492dbf0UL, 0xfc6fa21eUL, 0x4c8f32ceUL, +0x7313e033UL, 0x6d69a7c6UL, 0x93e56d64UL, 0xfabf1a2fUL, +0xb7bb1cbfUL, 0xb5587403UL, 0x4fe76e2cUL, 0x965d89b7UL, +0x2ae89c05UL, 0xa3446619UL, 0xfb342e71UL, 0x650ff229UL, +0x7afe8182UL, 0xf1b11322UL, 0xeca30835UL, 0x7ecd510fUL, +0x14ff7aa6UL, 0xf85c7293UL, 0x122fc297UL, 0xc3f370e3UL, +0x1c992f49UL, 0x68d14315UL, 0x1bc2a326UL, 0xb388cc32UL, +0x6f8acf7aUL, 0x9fb0e806UL, 0x1e7a47f5UL, 0xdad2bb79UL, +0x21e69508UL, 0x5c4398e5UL, 0x06d0b831UL, 0xaf11e37bUL, +0x537e4165UL, 0x10ccaa2bUL, 0x9cd8b4e4UL, 0xd46456a7UL, +0x59fb7c36UL, 0x84724b20UL, 0xf6ea9f4dUL, 0xdf6a5faaUL, +0xce2dc1dfUL, 0x58704868UL, 0x81caaff3UL, 0x910605d8UL, +0x695a774bUL, 0xa594de28UL, 0x4239df10UL, 0x47813bc3UL, +0xa6fc82caUL, 0xc523c8d2UL, 0xb203f86cUL, 0x9a080cd5UL, +0x40dab7acUL, 0xe17db909UL, 0x2c382434UL, 0xa2cf5247UL, +0xd1dcb274UL, 0x2b63a85bUL, 0x9535d555UL, 0x11479e75UL, +0xe215e5ebUL, 0xc64b9430UL, 0xa84a6f14UL, 0x8691239cUL, +0x394c6accUL, 0x4a5f8affUL, 0x4d040690UL, 0xbbee99ddUL, +0xca1e1152UL, 0x18aaffc4UL, 0x98eb6469UL, 0xff07fefcUL, +0x018b345eUL, 0xbe567d0eUL, 0xd9bae79bUL, 0x324263c1UL, +0x7b75b5dcUL, 0x17972644UL, 0x6667aecbUL, 0xcb95250cUL, +0x67ec9a95UL, 0xd057862aUL, 0x99605037UL, 0x05b8e4d3UL, +0xba65ad83UL, 0x3519efaeUL, 0x13a4f6c9UL, 0xa9c15b4aUL, +0xd6873e1bUL, 0x5ea0f059UL, 0x5b18148aUL, 0x3baf0270UL, +0x76ab04e0UL, 0xbfdd4950UL, 0x63df4a18UL, 0x56c6a5b6UL, +0x0a853d53UL, 0x37fa8712UL, 0xa777b694UL, 0x7f466551UL, +0x09ed61b1UL, 0xe91bece6UL, 0x25d54585UL, 0x52f5753bUL, +0x3d7fba41UL, 0x8827ce42UL, 0x43b2eb4eUL, 0x97d6bde9UL, +0xf3527b9eUL, 0x4562537fUL, 0xa02c3afbUL, 0x707bbcd1UL, +0x6bb91ff7UL, 0x1d121b17UL, 0xc8fd79eeUL, 0xf03a277cUL, +0xd70c0a45UL, 0x7996dd60UL, 0xab2233f6UL, 0x89acfa1cUL, +0x5dc8acbbUL, 0x30a10b7dUL, 0x4bd4bea1UL, 0x94bee10bUL, +0x5425cd0aUL, 0x62547e46UL, 0x82a2f311UL, 0x3e17e6a3UL, +0xe6263566UL, 0x75c35802UL, 0x9b83388bUL, 0xc27844bdUL, +0xdc020348UL, 0x8b4f92a0UL, 0x7c2e39b3UL, 0xe54e6984UL, +0x71f0888fUL, 0x27362d39UL, 0x3f9cd2fdUL, 0x6e01fb24UL, +0xdd893716UL, 0x00000000UL, 0xe0f68d57UL, 0x6ce29398UL, +0x15744ef8UL, 0x5a9320d4UL, 0xe7ad0138UL, 0xb4d3405dUL, +0x871a17c2UL, 0x2db3106aUL, 0x2f5078d6UL, 0x3cf48e1fUL, +0xa1a70ea5UL, 0x3671b34cUL, 0xae9ad725UL, 0x245e71dbUL, +0x50161d87UL, 0xd5ef62f9UL, 0x908d3186UL, 0x161c121aUL, +0xcfa6f581UL, 0x075b8c6fUL, 0x4937d61dUL, 0x926e593aUL, +0x6484c677UL, 0xb886c53fUL, 0xf9d746cdUL, 0xb0e090d0UL, +0x8329c74fUL, 0xfde49640UL, 0x0b0e090dUL, 0x206da156UL, +0x228ec9eaUL, 0x2edb4c88UL, 0x8ef77673UL, 0xbcb515b2UL, +0xc110185fUL, 0x6a322ba9UL, 0xb16ba48eUL, 0x55aef954UL, +0xee406089UL, 0x086655efUL, 0x44e96721UL, 0xbd3e21ecUL, +0x772030beUL, 0xadf28bc7UL, 0x2980c0e7UL, 0x8c141ecfUL, +0x48bce243UL, 0x8ac4a6feUL, 0xd831d3c5UL, 0x60b716faUL, +0x9d5380baUL, 0xf2d94fc0UL, 0x781de93eUL, 0x3a24362eUL, +0xdee16bf4UL, 0xefcb54d7UL, 0xf409f7f1UL, 0xf582c3afUL, +0x280bf4b9UL, 0x519d29d9UL, 0x38c75e92UL, 0xebf8845aUL, +0xe890d8b8UL, 0x0ddeb13cUL, 0x0433d08dUL, 0x03685ce2UL, +0xe4c55ddaUL, 0x9e3bdc58UL, 0x460a0f9dUL, 0xd33fdac8UL, +0xdb598f27UL, 0xc4a8fc8cUL, 0xac79bf99UL, 0x4e6c5a72UL, +0xfe8ccaa2UL, 0xe39ed1b5UL, 0xa41fea76UL, 0xea73b004UL, +}, + +{ +0xbc02e368UL, 0x620c5585UL, 0x23312a3fUL, 0x13f761abUL, +0x6d7298d4UL, 0x9a1921cbUL, 0xa4613c22UL, 0x3dcd459dUL, +0xb42305fdUL, 0x075f2bc4UL, 0x01c09b2cUL, 0x800f3dd9UL, +0x5c74486cUL, 0x7e85f97fUL, 0xab1ff173UL, 0xde0eb6edUL, +0x6bed283cUL, 0x781a4997UL, 0x918d9f2aUL, 0x9f33c957UL, +0xa8aaa907UL, 0xed7da50dUL, 0x2d8f7c42UL, 0xb0c9764dUL, +0xe8574d91UL, 0x63cccea9UL, 0x96d2b4eeUL, 0xe1b63028UL, +0x61b90df1UL, 0x6726bd19UL, 0xad80419bUL, 0x6ec7c0a0UL, +0xf2415183UL, 0xf03492dbUL, 0x1efc6fa2UL, 0xce4c8f32UL, +0x337313e0UL, 0xc66d69a7UL, 0x6493e56dUL, 0x2ffabf1aUL, +0xbfb7bb1cUL, 0x03b55874UL, 0x2c4fe76eUL, 0xb7965d89UL, +0x052ae89cUL, 0x19a34466UL, 0x71fb342eUL, 0x29650ff2UL, +0x827afe81UL, 0x22f1b113UL, 0x35eca308UL, 0x0f7ecd51UL, +0xa614ff7aUL, 0x93f85c72UL, 0x97122fc2UL, 0xe3c3f370UL, +0x491c992fUL, 0x1568d143UL, 0x261bc2a3UL, 0x32b388ccUL, +0x7a6f8acfUL, 0x069fb0e8UL, 0xf51e7a47UL, 0x79dad2bbUL, +0x0821e695UL, 0xe55c4398UL, 0x3106d0b8UL, 0x7baf11e3UL, +0x65537e41UL, 0x2b10ccaaUL, 0xe49cd8b4UL, 0xa7d46456UL, +0x3659fb7cUL, 0x2084724bUL, 0x4df6ea9fUL, 0xaadf6a5fUL, +0xdfce2dc1UL, 0x68587048UL, 0xf381caafUL, 0xd8910605UL, +0x4b695a77UL, 0x28a594deUL, 0x104239dfUL, 0xc347813bUL, +0xcaa6fc82UL, 0xd2c523c8UL, 0x6cb203f8UL, 0xd59a080cUL, +0xac40dab7UL, 0x09e17db9UL, 0x342c3824UL, 0x47a2cf52UL, +0x74d1dcb2UL, 0x5b2b63a8UL, 0x559535d5UL, 0x7511479eUL, +0xebe215e5UL, 0x30c64b94UL, 0x14a84a6fUL, 0x9c869123UL, +0xcc394c6aUL, 0xff4a5f8aUL, 0x904d0406UL, 0xddbbee99UL, +0x52ca1e11UL, 0xc418aaffUL, 0x6998eb64UL, 0xfcff07feUL, +0x5e018b34UL, 0x0ebe567dUL, 0x9bd9bae7UL, 0xc1324263UL, +0xdc7b75b5UL, 0x44179726UL, 0xcb6667aeUL, 0x0ccb9525UL, +0x9567ec9aUL, 0x2ad05786UL, 0x37996050UL, 0xd305b8e4UL, +0x83ba65adUL, 0xae3519efUL, 0xc913a4f6UL, 0x4aa9c15bUL, +0x1bd6873eUL, 0x595ea0f0UL, 0x8a5b1814UL, 0x703baf02UL, +0xe076ab04UL, 0x50bfdd49UL, 0x1863df4aUL, 0xb656c6a5UL, +0x530a853dUL, 0x1237fa87UL, 0x94a777b6UL, 0x517f4665UL, +0xb109ed61UL, 0xe6e91becUL, 0x8525d545UL, 0x3b52f575UL, +0x413d7fbaUL, 0x428827ceUL, 0x4e43b2ebUL, 0xe997d6bdUL, +0x9ef3527bUL, 0x7f456253UL, 0xfba02c3aUL, 0xd1707bbcUL, +0xf76bb91fUL, 0x171d121bUL, 0xeec8fd79UL, 0x7cf03a27UL, +0x45d70c0aUL, 0x607996ddUL, 0xf6ab2233UL, 0x1c89acfaUL, +0xbb5dc8acUL, 0x7d30a10bUL, 0xa14bd4beUL, 0x0b94bee1UL, +0x0a5425cdUL, 0x4662547eUL, 0x1182a2f3UL, 0xa33e17e6UL, +0x66e62635UL, 0x0275c358UL, 0x8b9b8338UL, 0xbdc27844UL, +0x48dc0203UL, 0xa08b4f92UL, 0xb37c2e39UL, 0x84e54e69UL, +0x8f71f088UL, 0x3927362dUL, 0xfd3f9cd2UL, 0x246e01fbUL, +0x16dd8937UL, 0x00000000UL, 0x57e0f68dUL, 0x986ce293UL, +0xf815744eUL, 0xd45a9320UL, 0x38e7ad01UL, 0x5db4d340UL, +0xc2871a17UL, 0x6a2db310UL, 0xd62f5078UL, 0x1f3cf48eUL, +0xa5a1a70eUL, 0x4c3671b3UL, 0x25ae9ad7UL, 0xdb245e71UL, +0x8750161dUL, 0xf9d5ef62UL, 0x86908d31UL, 0x1a161c12UL, +0x81cfa6f5UL, 0x6f075b8cUL, 0x1d4937d6UL, 0x3a926e59UL, +0x776484c6UL, 0x3fb886c5UL, 0xcdf9d746UL, 0xd0b0e090UL, +0x4f8329c7UL, 0x40fde496UL, 0x0d0b0e09UL, 0x56206da1UL, +0xea228ec9UL, 0x882edb4cUL, 0x738ef776UL, 0xb2bcb515UL, +0x5fc11018UL, 0xa96a322bUL, 0x8eb16ba4UL, 0x5455aef9UL, +0x89ee4060UL, 0xef086655UL, 0x2144e967UL, 0xecbd3e21UL, +0xbe772030UL, 0xc7adf28bUL, 0xe72980c0UL, 0xcf8c141eUL, +0x4348bce2UL, 0xfe8ac4a6UL, 0xc5d831d3UL, 0xfa60b716UL, +0xba9d5380UL, 0xc0f2d94fUL, 0x3e781de9UL, 0x2e3a2436UL, +0xf4dee16bUL, 0xd7efcb54UL, 0xf1f409f7UL, 0xaff582c3UL, +0xb9280bf4UL, 0xd9519d29UL, 0x9238c75eUL, 0x5aebf884UL, +0xb8e890d8UL, 0x3c0ddeb1UL, 0x8d0433d0UL, 0xe203685cUL, +0xdae4c55dUL, 0x589e3bdcUL, 0x9d460a0fUL, 0xc8d33fdaUL, +0x27db598fUL, 0x8cc4a8fcUL, 0x99ac79bfUL, 0x724e6c5aUL, +0xa2fe8ccaUL, 0xb5e39ed1UL, 0x76a41feaUL, 0x04ea73b0UL, +}, + +{ +0x68bc02e3UL, 0x85620c55UL, 0x3f23312aUL, 0xab13f761UL, +0xd46d7298UL, 0xcb9a1921UL, 0x22a4613cUL, 0x9d3dcd45UL, +0xfdb42305UL, 0xc4075f2bUL, 0x2c01c09bUL, 0xd9800f3dUL, +0x6c5c7448UL, 0x7f7e85f9UL, 0x73ab1ff1UL, 0xedde0eb6UL, +0x3c6bed28UL, 0x97781a49UL, 0x2a918d9fUL, 0x579f33c9UL, +0x07a8aaa9UL, 0x0ded7da5UL, 0x422d8f7cUL, 0x4db0c976UL, +0x91e8574dUL, 0xa963ccceUL, 0xee96d2b4UL, 0x28e1b630UL, +0xf161b90dUL, 0x196726bdUL, 0x9bad8041UL, 0xa06ec7c0UL, +0x83f24151UL, 0xdbf03492UL, 0xa21efc6fUL, 0x32ce4c8fUL, +0xe0337313UL, 0xa7c66d69UL, 0x6d6493e5UL, 0x1a2ffabfUL, +0x1cbfb7bbUL, 0x7403b558UL, 0x6e2c4fe7UL, 0x89b7965dUL, +0x9c052ae8UL, 0x6619a344UL, 0x2e71fb34UL, 0xf229650fUL, +0x81827afeUL, 0x1322f1b1UL, 0x0835eca3UL, 0x510f7ecdUL, +0x7aa614ffUL, 0x7293f85cUL, 0xc297122fUL, 0x70e3c3f3UL, +0x2f491c99UL, 0x431568d1UL, 0xa3261bc2UL, 0xcc32b388UL, +0xcf7a6f8aUL, 0xe8069fb0UL, 0x47f51e7aUL, 0xbb79dad2UL, +0x950821e6UL, 0x98e55c43UL, 0xb83106d0UL, 0xe37baf11UL, +0x4165537eUL, 0xaa2b10ccUL, 0xb4e49cd8UL, 0x56a7d464UL, +0x7c3659fbUL, 0x4b208472UL, 0x9f4df6eaUL, 0x5faadf6aUL, +0xc1dfce2dUL, 0x48685870UL, 0xaff381caUL, 0x05d89106UL, +0x774b695aUL, 0xde28a594UL, 0xdf104239UL, 0x3bc34781UL, +0x82caa6fcUL, 0xc8d2c523UL, 0xf86cb203UL, 0x0cd59a08UL, +0xb7ac40daUL, 0xb909e17dUL, 0x24342c38UL, 0x5247a2cfUL, +0xb274d1dcUL, 0xa85b2b63UL, 0xd5559535UL, 0x9e751147UL, +0xe5ebe215UL, 0x9430c64bUL, 0x6f14a84aUL, 0x239c8691UL, +0x6acc394cUL, 0x8aff4a5fUL, 0x06904d04UL, 0x99ddbbeeUL, +0x1152ca1eUL, 0xffc418aaUL, 0x646998ebUL, 0xfefcff07UL, +0x345e018bUL, 0x7d0ebe56UL, 0xe79bd9baUL, 0x63c13242UL, +0xb5dc7b75UL, 0x26441797UL, 0xaecb6667UL, 0x250ccb95UL, +0x9a9567ecUL, 0x862ad057UL, 0x50379960UL, 0xe4d305b8UL, +0xad83ba65UL, 0xefae3519UL, 0xf6c913a4UL, 0x5b4aa9c1UL, +0x3e1bd687UL, 0xf0595ea0UL, 0x148a5b18UL, 0x02703bafUL, +0x04e076abUL, 0x4950bfddUL, 0x4a1863dfUL, 0xa5b656c6UL, +0x3d530a85UL, 0x871237faUL, 0xb694a777UL, 0x65517f46UL, +0x61b109edUL, 0xece6e91bUL, 0x458525d5UL, 0x753b52f5UL, +0xba413d7fUL, 0xce428827UL, 0xeb4e43b2UL, 0xbde997d6UL, +0x7b9ef352UL, 0x537f4562UL, 0x3afba02cUL, 0xbcd1707bUL, +0x1ff76bb9UL, 0x1b171d12UL, 0x79eec8fdUL, 0x277cf03aUL, +0x0a45d70cUL, 0xdd607996UL, 0x33f6ab22UL, 0xfa1c89acUL, +0xacbb5dc8UL, 0x0b7d30a1UL, 0xbea14bd4UL, 0xe10b94beUL, +0xcd0a5425UL, 0x7e466254UL, 0xf31182a2UL, 0xe6a33e17UL, +0x3566e626UL, 0x580275c3UL, 0x388b9b83UL, 0x44bdc278UL, +0x0348dc02UL, 0x92a08b4fUL, 0x39b37c2eUL, 0x6984e54eUL, +0x888f71f0UL, 0x2d392736UL, 0xd2fd3f9cUL, 0xfb246e01UL, +0x3716dd89UL, 0x00000000UL, 0x8d57e0f6UL, 0x93986ce2UL, +0x4ef81574UL, 0x20d45a93UL, 0x0138e7adUL, 0x405db4d3UL, +0x17c2871aUL, 0x106a2db3UL, 0x78d62f50UL, 0x8e1f3cf4UL, +0x0ea5a1a7UL, 0xb34c3671UL, 0xd725ae9aUL, 0x71db245eUL, +0x1d875016UL, 0x62f9d5efUL, 0x3186908dUL, 0x121a161cUL, +0xf581cfa6UL, 0x8c6f075bUL, 0xd61d4937UL, 0x593a926eUL, +0xc6776484UL, 0xc53fb886UL, 0x46cdf9d7UL, 0x90d0b0e0UL, +0xc74f8329UL, 0x9640fde4UL, 0x090d0b0eUL, 0xa156206dUL, +0xc9ea228eUL, 0x4c882edbUL, 0x76738ef7UL, 0x15b2bcb5UL, +0x185fc110UL, 0x2ba96a32UL, 0xa48eb16bUL, 0xf95455aeUL, +0x6089ee40UL, 0x55ef0866UL, 0x672144e9UL, 0x21ecbd3eUL, +0x30be7720UL, 0x8bc7adf2UL, 0xc0e72980UL, 0x1ecf8c14UL, +0xe24348bcUL, 0xa6fe8ac4UL, 0xd3c5d831UL, 0x16fa60b7UL, +0x80ba9d53UL, 0x4fc0f2d9UL, 0xe93e781dUL, 0x362e3a24UL, +0x6bf4dee1UL, 0x54d7efcbUL, 0xf7f1f409UL, 0xc3aff582UL, +0xf4b9280bUL, 0x29d9519dUL, 0x5e9238c7UL, 0x845aebf8UL, +0xd8b8e890UL, 0xb13c0ddeUL, 0xd08d0433UL, 0x5ce20368UL, +0x5ddae4c5UL, 0xdc589e3bUL, 0x0f9d460aUL, 0xdac8d33fUL, +0x8f27db59UL, 0xfc8cc4a8UL, 0xbf99ac79UL, 0x5a724e6cUL, +0xcaa2fe8cUL, 0xd1b5e39eUL, 0xea76a41fUL, 0xb004ea73UL, +}}; + +NAMESPACE_END diff --git a/cryptopp/stdcpp.h b/cryptopp/stdcpp.h new file mode 100644 index 0000000..9a468ab --- /dev/null +++ b/cryptopp/stdcpp.h @@ -0,0 +1,27 @@ +#ifndef CRYPTOPP_STDCPP_H +#define CRYPTOPP_STDCPP_H + +#include +#include +#include +#include +#include +#include +#include + + +#ifdef _MSC_VER +#include // CodeWarrior doesn't have memory.h +#include +#include +#include + +// re-disable this +#pragma warning(disable: 4231) +#endif + +#if defined(_MSC_VER) && defined(_CRTAPI1) +#define CRYPTOPP_MSVCRT6 +#endif + +#endif diff --git a/cryptopp/strciphr.cpp b/cryptopp/strciphr.cpp new file mode 100644 index 0000000..53e0073 --- /dev/null +++ b/cryptopp/strciphr.cpp @@ -0,0 +1,252 @@ +// strciphr.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS + +#include "strciphr.h" + +NAMESPACE_BEGIN(CryptoPP) + +template +void AdditiveCipherTemplate::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) +{ + PolicyInterface &policy = this->AccessPolicy(); + policy.CipherSetKey(params, key, length); + m_leftOver = 0; + unsigned int bufferByteSize = policy.CanOperateKeystream() ? GetBufferByteSize(policy) : RoundUpToMultipleOf(1024U, GetBufferByteSize(policy)); + m_buffer.New(bufferByteSize); + + if (this->IsResynchronizable()) + { + size_t ivLength; + const byte *iv = this->GetIVAndThrowIfInvalid(params, ivLength); + policy.CipherResynchronize(m_buffer, iv, ivLength); + } +} + +template +void AdditiveCipherTemplate::GenerateBlock(byte *outString, size_t length) +{ + if (m_leftOver > 0) + { + size_t len = STDMIN(m_leftOver, length); + memcpy(outString, KeystreamBufferEnd()-m_leftOver, len); + length -= len; + m_leftOver -= len; + outString += len; + + if (!length) + return; + } + assert(m_leftOver == 0); + + PolicyInterface &policy = this->AccessPolicy(); + unsigned int bytesPerIteration = policy.GetBytesPerIteration(); + + if (length >= bytesPerIteration) + { + size_t iterations = length / bytesPerIteration; + policy.WriteKeystream(outString, iterations); + outString += iterations * bytesPerIteration; + length -= iterations * bytesPerIteration; + } + + if (length > 0) + { + size_t bufferByteSize = RoundUpToMultipleOf(length, bytesPerIteration); + size_t bufferIterations = bufferByteSize / bytesPerIteration; + + policy.WriteKeystream(KeystreamBufferEnd()-bufferByteSize, bufferIterations); + memcpy(outString, KeystreamBufferEnd()-bufferByteSize, length); + m_leftOver = bufferByteSize - length; + } +} + +template +void AdditiveCipherTemplate::ProcessData(byte *outString, const byte *inString, size_t length) +{ + if (m_leftOver > 0) + { + size_t len = STDMIN(m_leftOver, length); + xorbuf(outString, inString, KeystreamBufferEnd()-m_leftOver, len); + length -= len; + m_leftOver -= len; + inString += len; + outString += len; + + if (!length) + return; + } + assert(m_leftOver == 0); + + PolicyInterface &policy = this->AccessPolicy(); + unsigned int bytesPerIteration = policy.GetBytesPerIteration(); + + if (policy.CanOperateKeystream() && length >= bytesPerIteration) + { + size_t iterations = length / bytesPerIteration; + unsigned int alignment = policy.GetAlignment(); + KeystreamOperation operation = KeystreamOperation((IsAlignedOn(inString, alignment) * 2) | (int)IsAlignedOn(outString, alignment)); + + policy.OperateKeystream(operation, outString, inString, iterations); + + inString += iterations * bytesPerIteration; + outString += iterations * bytesPerIteration; + length -= iterations * bytesPerIteration; + + if (!length) + return; + } + + size_t bufferByteSize = m_buffer.size(); + size_t bufferIterations = bufferByteSize / bytesPerIteration; + + while (length >= bufferByteSize) + { + policy.WriteKeystream(m_buffer, bufferIterations); + xorbuf(outString, inString, KeystreamBufferBegin(), bufferByteSize); + length -= bufferByteSize; + inString += bufferByteSize; + outString += bufferByteSize; + } + + if (length > 0) + { + bufferByteSize = RoundUpToMultipleOf(length, bytesPerIteration); + bufferIterations = bufferByteSize / bytesPerIteration; + + policy.WriteKeystream(KeystreamBufferEnd()-bufferByteSize, bufferIterations); + xorbuf(outString, inString, KeystreamBufferEnd()-bufferByteSize, length); + m_leftOver = bufferByteSize - length; + } +} + +template +void AdditiveCipherTemplate::Resynchronize(const byte *iv, int length) +{ + PolicyInterface &policy = this->AccessPolicy(); + m_leftOver = 0; + m_buffer.New(GetBufferByteSize(policy)); + policy.CipherResynchronize(m_buffer, iv, this->ThrowIfInvalidIVLength(length)); +} + +template +void AdditiveCipherTemplate::Seek(lword position) +{ + PolicyInterface &policy = this->AccessPolicy(); + unsigned int bytesPerIteration = policy.GetBytesPerIteration(); + + policy.SeekToIteration(position / bytesPerIteration); + position %= bytesPerIteration; + + if (position > 0) + { + policy.WriteKeystream(KeystreamBufferEnd()-bytesPerIteration, 1); + m_leftOver = bytesPerIteration - (unsigned int)position; + } + else + m_leftOver = 0; +} + +template +void CFB_CipherTemplate::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) +{ + PolicyInterface &policy = this->AccessPolicy(); + policy.CipherSetKey(params, key, length); + + if (this->IsResynchronizable()) + { + size_t ivLength; + const byte *iv = this->GetIVAndThrowIfInvalid(params, ivLength); + policy.CipherResynchronize(iv, ivLength); + } + + m_leftOver = policy.GetBytesPerIteration(); +} + +template +void CFB_CipherTemplate::Resynchronize(const byte *iv, int length) +{ + PolicyInterface &policy = this->AccessPolicy(); + policy.CipherResynchronize(iv, this->ThrowIfInvalidIVLength(length)); + m_leftOver = policy.GetBytesPerIteration(); +} + +template +void CFB_CipherTemplate::ProcessData(byte *outString, const byte *inString, size_t length) +{ + assert(length % this->MandatoryBlockSize() == 0); + + PolicyInterface &policy = this->AccessPolicy(); + unsigned int bytesPerIteration = policy.GetBytesPerIteration(); + unsigned int alignment = policy.GetAlignment(); + byte *reg = policy.GetRegisterBegin(); + + if (m_leftOver) + { + size_t len = STDMIN(m_leftOver, length); + CombineMessageAndShiftRegister(outString, reg + bytesPerIteration - m_leftOver, inString, len); + m_leftOver -= len; + length -= len; + inString += len; + outString += len; + } + + if (!length) + return; + + assert(m_leftOver == 0); + + if (policy.CanIterate() && length >= bytesPerIteration && IsAlignedOn(outString, alignment)) + { + if (IsAlignedOn(inString, alignment)) + policy.Iterate(outString, inString, GetCipherDir(*this), length / bytesPerIteration); + else + { + memcpy(outString, inString, length); + policy.Iterate(outString, outString, GetCipherDir(*this), length / bytesPerIteration); + } + inString += length - length % bytesPerIteration; + outString += length - length % bytesPerIteration; + length %= bytesPerIteration; + } + + while (length >= bytesPerIteration) + { + policy.TransformRegister(); + CombineMessageAndShiftRegister(outString, reg, inString, bytesPerIteration); + length -= bytesPerIteration; + inString += bytesPerIteration; + outString += bytesPerIteration; + } + + if (length > 0) + { + policy.TransformRegister(); + CombineMessageAndShiftRegister(outString, reg, inString, length); + m_leftOver = bytesPerIteration - length; + } +} + +template +void CFB_EncryptionTemplate::CombineMessageAndShiftRegister(byte *output, byte *reg, const byte *message, size_t length) +{ + xorbuf(reg, message, length); + memcpy(output, reg, length); +} + +template +void CFB_DecryptionTemplate::CombineMessageAndShiftRegister(byte *output, byte *reg, const byte *message, size_t length) +{ + for (unsigned int i=0; i, AdditiveCipherTemplate\<\> \> \> Encryption; + + AdditiveCipherTemplate and CFB_CipherTemplate are designed so that they don't need + to take a policy class as a template parameter (although this is allowed), so that + their code is not duplicated for each new cipher. Instead they each + get a reference to an abstract policy interface by calling AccessPolicy() on itself, so + AccessPolicy() must be overriden to return the actual policy reference. This is done + by the ConceretePolicyHolder class. Finally, SymmetricCipherFinal implements the constructors and + other functions that must be implemented by the most derived class. +*/ + +#ifndef CRYPTOPP_STRCIPHR_H +#define CRYPTOPP_STRCIPHR_H + +#include "seckey.h" +#include "secblock.h" +#include "argnames.h" + +NAMESPACE_BEGIN(CryptoPP) + +template +class CRYPTOPP_NO_VTABLE AbstractPolicyHolder : public BASE +{ +public: + typedef POLICY_INTERFACE PolicyInterface; + virtual ~AbstractPolicyHolder() {} + +protected: + virtual const POLICY_INTERFACE & GetPolicy() const =0; + virtual POLICY_INTERFACE & AccessPolicy() =0; +}; + +template +class ConcretePolicyHolder : public BASE, protected POLICY +{ +protected: + const POLICY_INTERFACE & GetPolicy() const {return *this;} + POLICY_INTERFACE & AccessPolicy() {return *this;} +}; + +enum KeystreamOperationFlags {OUTPUT_ALIGNED=1, INPUT_ALIGNED=2, INPUT_NULL = 4}; +enum KeystreamOperation { + WRITE_KEYSTREAM = INPUT_NULL, + WRITE_KEYSTREAM_ALIGNED = INPUT_NULL | OUTPUT_ALIGNED, + XOR_KEYSTREAM = 0, + XOR_KEYSTREAM_INPUT_ALIGNED = INPUT_ALIGNED, + XOR_KEYSTREAM_OUTPUT_ALIGNED= OUTPUT_ALIGNED, + XOR_KEYSTREAM_BOTH_ALIGNED = OUTPUT_ALIGNED | INPUT_ALIGNED}; + +struct CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AdditiveCipherAbstractPolicy +{ + virtual ~AdditiveCipherAbstractPolicy() {} + virtual unsigned int GetAlignment() const {return 1;} + virtual unsigned int GetBytesPerIteration() const =0; + virtual unsigned int GetOptimalBlockSize() const {return GetBytesPerIteration();} + virtual unsigned int GetIterationsToBuffer() const =0; + virtual void WriteKeystream(byte *keystream, size_t iterationCount) + {OperateKeystream(KeystreamOperation(INPUT_NULL | (KeystreamOperationFlags)IsAlignedOn(keystream, GetAlignment())), keystream, NULL, iterationCount);} + virtual bool CanOperateKeystream() const {return false;} + virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) {assert(false);} + virtual void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) =0; + virtual void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length) {throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");} + virtual bool CipherIsRandomAccess() const =0; + virtual void SeekToIteration(lword iterationCount) {assert(!CipherIsRandomAccess()); throw NotImplemented("StreamTransformation: this object doesn't support random access");} +}; + +template +struct CRYPTOPP_NO_VTABLE AdditiveCipherConcretePolicy : public BASE +{ + typedef WT WordType; + CRYPTOPP_CONSTANT(BYTES_PER_ITERATION = sizeof(WordType) * W) + +#if !(CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64) + unsigned int GetAlignment() const {return GetAlignmentOf();} +#endif + unsigned int GetBytesPerIteration() const {return BYTES_PER_ITERATION;} + unsigned int GetIterationsToBuffer() const {return X;} + bool CanOperateKeystream() const {return true;} + virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) =0; +}; + +// use these to implement OperateKeystream +#define CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, b, i, a) \ + PutWord(bool(x & OUTPUT_ALIGNED), b, output+i*sizeof(WordType), (x & INPUT_NULL) ? a : a ^ GetWord(bool(x & INPUT_ALIGNED), b, input+i*sizeof(WordType))); +#define CRYPTOPP_KEYSTREAM_OUTPUT_XMM(x, i, a) {\ + __m128i t = (x & INPUT_NULL) ? a : _mm_xor_si128(a, (x & INPUT_ALIGNED) ? _mm_load_si128((__m128i *)input+i) : _mm_loadu_si128((__m128i *)input+i));\ + if (x & OUTPUT_ALIGNED) _mm_store_si128((__m128i *)output+i, t);\ + else _mm_storeu_si128((__m128i *)output+i, t);} +#define CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH(x, y) \ + switch (operation) \ + { \ + case WRITE_KEYSTREAM: \ + x(WRITE_KEYSTREAM) \ + break; \ + case XOR_KEYSTREAM: \ + x(XOR_KEYSTREAM) \ + input += y; \ + break; \ + case XOR_KEYSTREAM_INPUT_ALIGNED: \ + x(XOR_KEYSTREAM_INPUT_ALIGNED) \ + input += y; \ + break; \ + case XOR_KEYSTREAM_OUTPUT_ALIGNED: \ + x(XOR_KEYSTREAM_OUTPUT_ALIGNED) \ + input += y; \ + break; \ + case WRITE_KEYSTREAM_ALIGNED: \ + x(WRITE_KEYSTREAM_ALIGNED) \ + break; \ + case XOR_KEYSTREAM_BOTH_ALIGNED: \ + x(XOR_KEYSTREAM_BOTH_ALIGNED) \ + input += y; \ + break; \ + } \ + output += y; + +template > +class CRYPTOPP_NO_VTABLE AdditiveCipherTemplate : public BASE, public RandomNumberGenerator +{ +public: + void GenerateBlock(byte *output, size_t size); + void ProcessData(byte *outString, const byte *inString, size_t length); + void Resynchronize(const byte *iv, int length=-1); + unsigned int OptimalBlockSize() const {return this->GetPolicy().GetOptimalBlockSize();} + unsigned int GetOptimalNextBlockSize() const {return (unsigned int)this->m_leftOver;} + unsigned int OptimalDataAlignment() const {return this->GetPolicy().GetAlignment();} + bool IsSelfInverting() const {return true;} + bool IsForwardTransformation() const {return true;} + bool IsRandomAccess() const {return this->GetPolicy().CipherIsRandomAccess();} + void Seek(lword position); + + typedef typename BASE::PolicyInterface PolicyInterface; + +protected: + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); + + unsigned int GetBufferByteSize(const PolicyInterface &policy) const {return policy.GetBytesPerIteration() * policy.GetIterationsToBuffer();} + + inline byte * KeystreamBufferBegin() {return this->m_buffer.data();} + inline byte * KeystreamBufferEnd() {return (this->m_buffer.data() + this->m_buffer.size());} + + SecByteBlock m_buffer; + size_t m_leftOver; +}; + +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_CipherAbstractPolicy +{ +public: + virtual ~CFB_CipherAbstractPolicy() {} + virtual unsigned int GetAlignment() const =0; + virtual unsigned int GetBytesPerIteration() const =0; + virtual byte * GetRegisterBegin() =0; + virtual void TransformRegister() =0; + virtual bool CanIterate() const {return false;} + virtual void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount) {assert(false); throw 0;} + virtual void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) =0; + virtual void CipherResynchronize(const byte *iv, size_t length) {throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");} +}; + +template +struct CRYPTOPP_NO_VTABLE CFB_CipherConcretePolicy : public BASE +{ + typedef WT WordType; + + unsigned int GetAlignment() const {return sizeof(WordType);} + unsigned int GetBytesPerIteration() const {return sizeof(WordType) * W;} + bool CanIterate() const {return true;} + void TransformRegister() {this->Iterate(NULL, NULL, ENCRYPTION, 1);} + + template + struct RegisterOutput + { + RegisterOutput(byte *output, const byte *input, CipherDir dir) + : m_output(output), m_input(input), m_dir(dir) {} + + inline RegisterOutput& operator()(WordType ®isterWord) + { + assert(IsAligned(m_output)); + assert(IsAligned(m_input)); + + if (!NativeByteOrderIs(B::ToEnum())) + registerWord = ByteReverse(registerWord); + + if (m_dir == ENCRYPTION) + { + if (m_input == NULL) + assert(m_output == NULL); + else + { + WordType ct = *(const WordType *)m_input ^ registerWord; + registerWord = ct; + *(WordType*)m_output = ct; + m_input += sizeof(WordType); + m_output += sizeof(WordType); + } + } + else + { + WordType ct = *(const WordType *)m_input; + *(WordType*)m_output = registerWord ^ ct; + registerWord = ct; + m_input += sizeof(WordType); + m_output += sizeof(WordType); + } + + // registerWord is left unreversed so it can be xor-ed with further input + + return *this; + } + + byte *m_output; + const byte *m_input; + CipherDir m_dir; + }; +}; + +template +class CRYPTOPP_NO_VTABLE CFB_CipherTemplate : public BASE +{ +public: + void ProcessData(byte *outString, const byte *inString, size_t length); + void Resynchronize(const byte *iv, int length=-1); + unsigned int OptimalBlockSize() const {return this->GetPolicy().GetBytesPerIteration();} + unsigned int GetOptimalNextBlockSize() const {return (unsigned int)m_leftOver;} + unsigned int OptimalDataAlignment() const {return this->GetPolicy().GetAlignment();} + bool IsRandomAccess() const {return false;} + bool IsSelfInverting() const {return false;} + + typedef typename BASE::PolicyInterface PolicyInterface; + +protected: + virtual void CombineMessageAndShiftRegister(byte *output, byte *reg, const byte *message, size_t length) =0; + + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); + + size_t m_leftOver; +}; + +template > +class CRYPTOPP_NO_VTABLE CFB_EncryptionTemplate : public CFB_CipherTemplate +{ + bool IsForwardTransformation() const {return true;} + void CombineMessageAndShiftRegister(byte *output, byte *reg, const byte *message, size_t length); +}; + +template > +class CRYPTOPP_NO_VTABLE CFB_DecryptionTemplate : public CFB_CipherTemplate +{ + bool IsForwardTransformation() const {return false;} + void CombineMessageAndShiftRegister(byte *output, byte *reg, const byte *message, size_t length); +}; + +template +class CFB_RequireFullDataBlocks : public BASE +{ +public: + unsigned int MandatoryBlockSize() const {return this->OptimalBlockSize();} +}; + +//! _ +template +class SymmetricCipherFinal : public AlgorithmImpl, INFO> +{ +public: + SymmetricCipherFinal() {} + SymmetricCipherFinal(const byte *key) + {this->SetKey(key, this->DEFAULT_KEYLENGTH);} + SymmetricCipherFinal(const byte *key, size_t length) + {this->SetKey(key, length);} + SymmetricCipherFinal(const byte *key, size_t length, const byte *iv) + {this->SetKeyWithIV(key, length, iv);} + + Clonable * Clone() const {return static_cast(new SymmetricCipherFinal(*this));} +}; + +NAMESPACE_END + +#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#include "strciphr.cpp" +#endif + +NAMESPACE_BEGIN(CryptoPP) +CRYPTOPP_DLL_TEMPLATE_CLASS AbstractPolicyHolder; +CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate >; +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate >; +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate >; +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate >; +NAMESPACE_END + +#endif diff --git a/cryptopp/tea.cpp b/cryptopp/tea.cpp new file mode 100644 index 0000000..60921d4 --- /dev/null +++ b/cryptopp/tea.cpp @@ -0,0 +1,147 @@ +// tea.cpp - modified by Wei Dai from code in the original paper + +#include "pch.h" +#include "tea.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +static const word32 DELTA = 0x9e3779b9; +typedef BlockGetAndPut Block; + +void TEA::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms) +{ + AssertValidKeyLength(length); + + GetUserKey(BIG_ENDIAN_ORDER, m_k.begin(), 4, userKey, KEYLENGTH); + m_limit = GetRoundsAndThrowIfInvalid(params, this) * DELTA; +} + +void TEA::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 y, z; + Block::Get(inBlock)(y)(z); + + word32 sum = 0; + while (sum != m_limit) + { + sum += DELTA; + y += (z << 4) + m_k[0] ^ z + sum ^ (z >> 5) + m_k[1]; + z += (y << 4) + m_k[2] ^ y + sum ^ (y >> 5) + m_k[3]; + } + + Block::Put(xorBlock, outBlock)(y)(z); +} + +void TEA::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 y, z; + Block::Get(inBlock)(y)(z); + + word32 sum = m_limit; + while (sum != 0) + { + z -= (y << 4) + m_k[2] ^ y + sum ^ (y >> 5) + m_k[3]; + y -= (z << 4) + m_k[0] ^ z + sum ^ (z >> 5) + m_k[1]; + sum -= DELTA; + } + + Block::Put(xorBlock, outBlock)(y)(z); +} + +void XTEA::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms) +{ + AssertValidKeyLength(length); + + GetUserKey(BIG_ENDIAN_ORDER, m_k.begin(), 4, userKey, KEYLENGTH); + m_limit = GetRoundsAndThrowIfInvalid(params, this) * DELTA; +} + +void XTEA::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 y, z; + Block::Get(inBlock)(y)(z); + + word32 sum = 0; + while (sum != m_limit) + { + y += (z<<4 ^ z>>5) + z ^ sum + m_k[sum&3]; + sum += DELTA; + z += (y<<4 ^ y>>5) + y ^ sum + m_k[sum>>11 & 3]; + } + + Block::Put(xorBlock, outBlock)(y)(z); +} + +void XTEA::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 y, z; + Block::Get(inBlock)(y)(z); + + word32 sum = m_limit; + while (sum != 0) + { + z -= (y<<4 ^ y>>5) + y ^ sum + m_k[sum>>11 & 3]; + sum -= DELTA; + y -= (z<<4 ^ z>>5) + z ^ sum + m_k[sum&3]; + } + + Block::Put(xorBlock, outBlock)(y)(z); +} + +#define MX (z>>5^y<<2)+(y>>3^z<<4)^(sum^y)+(m_k[p&3^e]^z) + +void BTEA::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + unsigned int n = m_blockSize / 4; + word32 *v = (word32*)outBlock; + ConditionalByteReverse(BIG_ENDIAN_ORDER, v, (const word32*)inBlock, m_blockSize); + + word32 y = v[0], z = v[n-1], e; + word32 p, q = 6+52/n; + word32 sum = 0; + + while (q-- > 0) + { + sum += DELTA; + e = sum>>2 & 3; + for (p = 0; p < n-1; p++) + { + y = v[p+1]; + z = v[p] += MX; + } + y = v[0]; + z = v[n-1] += MX; + } + + ConditionalByteReverse(BIG_ENDIAN_ORDER, v, v, m_blockSize); +} + +void BTEA::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + unsigned int n = m_blockSize / 4; + word32 *v = (word32*)outBlock; + ConditionalByteReverse(BIG_ENDIAN_ORDER, v, (const word32*)inBlock, m_blockSize); + + word32 y = v[0], z = v[n-1], e; + word32 p, q = 6+52/n; + word32 sum = q * DELTA; + + while (sum != 0) + { + e = sum>>2 & 3; + for (p = n-1; p > 0; p--) + { + z = v[p-1]; + y = v[p] -= MX; + } + + z = v[n-1]; + y = v[0] -= MX; + sum -= DELTA; + } + + ConditionalByteReverse(BIG_ENDIAN_ORDER, v, v, m_blockSize); +} + +NAMESPACE_END diff --git a/cryptopp/tea.h b/cryptopp/tea.h new file mode 100644 index 0000000..d8ddded --- /dev/null +++ b/cryptopp/tea.h @@ -0,0 +1,132 @@ +#ifndef CRYPTOPP_TEA_H +#define CRYPTOPP_TEA_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct TEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<32> +{ + static const char *StaticAlgorithmName() {return "TEA";} +}; + +/// TEA +class TEA : public TEA_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + FixedSizeSecBlock m_k; + word32 m_limit; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef TEA::Encryption TEAEncryption; +typedef TEA::Decryption TEADecryption; + +//! _ +struct XTEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<32> +{ + static const char *StaticAlgorithmName() {return "XTEA";} +}; + +/// XTEA +class XTEA : public XTEA_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + FixedSizeSecBlock m_k; + word32 m_limit; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +//! _ +struct BTEA_Info : public FixedKeyLength<16> +{ + static const char *StaticAlgorithmName() {return "BTEA";} +}; + +//! corrected Block TEA (as described in "xxtea"). +/*! This class hasn't been tested yet. */ +class BTEA : public BTEA_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public AlgorithmImpl, BTEA_Info>, public BTEA_Info + { + public: + void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) + { + m_blockSize = params.GetIntValueWithDefault("BlockSize", 60*4); + GetUserKey(BIG_ENDIAN_ORDER, m_k.begin(), 4, key, KEYLENGTH); + } + + unsigned int BlockSize() const {return m_blockSize;} + + protected: + FixedSizeSecBlock m_k; + unsigned int m_blockSize; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/test.cpp b/cryptopp/test.cpp new file mode 100644 index 0000000..6a5aab0 --- /dev/null +++ b/cryptopp/test.cpp @@ -0,0 +1,852 @@ +// test.cpp - written and placed in the public domain by Wei Dai + +#define _CRT_SECURE_NO_DEPRECATE +#define CRYPTOPP_DEFAULT_NO_DLL +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 + +#include "dll.h" +#include "md5.h" +#include "ripemd.h" +#include "rng.h" +#include "gzip.h" +#include "default.h" +#include "randpool.h" +#include "ida.h" +#include "base64.h" +#include "socketft.h" +#include "wait.h" +#include "factory.h" +#include "whrlpool.h" +#include "tiger.h" + +#include "validate.h" +#include "bench.h" + +#include +#include + +#ifdef CRYPTOPP_WIN32_AVAILABLE +#include +#endif + +#if defined(USE_BERKELEY_STYLE_SOCKETS) && !defined(macintosh) +#include +#include +#endif + +#if (_MSC_VER >= 1000) +#include // for the debug heap +#endif + +#if defined(__MWERKS__) && defined(macintosh) +#include +#endif + +#ifdef __BORLANDC__ +#pragma comment(lib, "cryptlib_bds.lib") +#pragma comment(lib, "ws2_32.lib") +#endif + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +const int MAX_PHRASE_LENGTH=250; + +void RegisterFactories(); + +void GenerateRSAKey(unsigned int keyLength, const char *privFilename, const char *pubFilename, const char *seed); +string RSAEncryptString(const char *pubFilename, const char *seed, const char *message); +string RSADecryptString(const char *privFilename, const char *ciphertext); +void RSASignFile(const char *privFilename, const char *messageFilename, const char *signatureFilename); +bool RSAVerifyFile(const char *pubFilename, const char *messageFilename, const char *signatureFilename); + +void DigestFile(const char *file); +void HmacFile(const char *hexKey, const char *file); + +void AES_CTR_Encrypt(const char *hexKey, const char *hexIV, const char *infile, const char *outfile); + +string EncryptString(const char *plaintext, const char *passPhrase); +string DecryptString(const char *ciphertext, const char *passPhrase); + +void EncryptFile(const char *in, const char *out, const char *passPhrase); +void DecryptFile(const char *in, const char *out, const char *passPhrase); + +void SecretShareFile(int threshold, int nShares, const char *filename, const char *seed); +void SecretRecoverFile(int threshold, const char *outFilename, char *const *inFilenames); + +void InformationDisperseFile(int threshold, int nShares, const char *filename); +void InformationRecoverFile(int threshold, const char *outFilename, char *const *inFilenames); + +void GzipFile(const char *in, const char *out, int deflate_level); +void GunzipFile(const char *in, const char *out); + +void Base64Encode(const char *infile, const char *outfile); +void Base64Decode(const char *infile, const char *outfile); +void HexEncode(const char *infile, const char *outfile); +void HexDecode(const char *infile, const char *outfile); + +void ForwardTcpPort(const char *sourcePort, const char *destinationHost, const char *destinationPort); + +void FIPS140_SampleApplication(); +void FIPS140_GenerateRandomFiles(); + +bool Validate(int, bool, const char *); + +int (*AdhocTest)(int argc, char *argv[]) = NULL; + +static OFB_Mode::Encryption s_globalRNG; + +RandomNumberGenerator & GlobalRNG() +{ + return s_globalRNG; +} + +int CRYPTOPP_API main(int argc, char *argv[]) +{ +#ifdef _CRTDBG_LEAK_CHECK_DF + // Turn on leak-checking + int tempflag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); + tempflag |= _CRTDBG_LEAK_CHECK_DF; + _CrtSetDbgFlag( tempflag ); +#endif + +#if defined(__MWERKS__) && defined(macintosh) + argc = ccommand(&argv); +#endif + + try + { + RegisterFactories(); + + std::string seed = IntToString(time(NULL)); + seed.resize(16); + s_globalRNG.SetKeyWithIV((byte *)seed.data(), 16, (byte *)seed.data()); + + std::string command, executableName, macFilename; + + if (argc < 2) + command = 'h'; + else + command = argv[1]; + + if (command == "g") + { + char seed[1024], privFilename[128], pubFilename[128]; + unsigned int keyLength; + + cout << "Key length in bits: "; + cin >> keyLength; + + cout << "\nSave private key to file: "; + cin >> privFilename; + + cout << "\nSave public key to file: "; + cin >> pubFilename; + + cout << "\nRandom Seed: "; + ws(cin); + cin.getline(seed, 1024); + + GenerateRSAKey(keyLength, privFilename, pubFilename, seed); + } + else if (command == "rs") + RSASignFile(argv[2], argv[3], argv[4]); + else if (command == "rv") + { + bool verified = RSAVerifyFile(argv[2], argv[3], argv[4]); + cout << (verified ? "valid signature" : "invalid signature") << endl; + } + else if (command == "r") + { + char privFilename[128], pubFilename[128]; + char seed[1024], message[1024]; + + cout << "Private key file: "; + cin >> privFilename; + + cout << "\nPublic key file: "; + cin >> pubFilename; + + cout << "\nRandom Seed: "; + ws(cin); + cin.getline(seed, 1024); + + cout << "\nMessage: "; + cin.getline(message, 1024); + + string ciphertext = RSAEncryptString(pubFilename, seed, message); + cout << "\nCiphertext: " << ciphertext << endl; + + string decrypted = RSADecryptString(privFilename, ciphertext.c_str()); + cout << "\nDecrypted: " << decrypted << endl; + } + else if (command == "mt") + { + MaurerRandomnessTest mt; + FileStore fs(argv[2]); + fs.TransferAllTo(mt); + cout << "Maurer Test Value: " << mt.GetTestValue() << endl; + } + else if (command == "mac_dll") + { + // sanity check on file size + std::fstream dllFile(argv[2], ios::in | ios::out | ios::binary); + std::ifstream::pos_type fileEnd = dllFile.seekg(0, std::ios_base::end).tellg(); + if (fileEnd > 20*1000*1000) + { + cerr << "Input file too large (more than 20 MB).\n"; + return 1; + } + + // read file into memory + unsigned int fileSize = (unsigned int)fileEnd; + SecByteBlock buf(fileSize); + dllFile.seekg(0, std::ios_base::beg); + dllFile.read((char *)buf.begin(), fileSize); + + // find positions of relevant sections in the file, based on version 8 of documentation from http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx + word32 coffPos = *(word16 *)(buf+0x3c); + word32 optionalHeaderPos = coffPos + 24; + word16 optionalHeaderMagic = *(word16 *)(buf+optionalHeaderPos); + if (optionalHeaderMagic != 0x10b && optionalHeaderMagic != 0x20b) + { + cerr << "Target file is not a PE32 or PE32+ image.\n"; + return 3; + } + word32 checksumPos = optionalHeaderPos + 64; + word32 certificateTableDirectoryPos = optionalHeaderPos + (optionalHeaderMagic == 0x10b ? 128 : 144); + word32 certificateTablePos = *(word32 *)(buf+certificateTableDirectoryPos); + word32 certificateTableSize = *(word32 *)(buf+certificateTableDirectoryPos+4); + if (certificateTableSize != 0) + cerr << "Warning: certificate table (IMAGE_DIRECTORY_ENTRY_SECURITY) of target image is not empty.\n"; + + // find where to place computed MAC + byte mac[] = CRYPTOPP_DUMMY_DLL_MAC; + byte *found = std::search(buf.begin(), buf.end(), mac+0, mac+sizeof(mac)); + if (found == buf.end()) + { + cerr << "MAC placeholder not found. Possibly the actual MAC was already placed.\n"; + return 2; + } + word32 macPos = (unsigned int)(found-buf.begin()); + + // compute MAC + member_ptr pMac(NewIntegrityCheckingMAC()); + assert(pMac->DigestSize() == sizeof(mac)); + MeterFilter f(new HashFilter(*pMac, new ArraySink(mac, sizeof(mac)))); + f.AddRangeToSkip(0, checksumPos, 4); + f.AddRangeToSkip(0, certificateTableDirectoryPos, 8); + f.AddRangeToSkip(0, macPos, sizeof(mac)); + f.AddRangeToSkip(0, certificateTablePos, certificateTableSize); + f.PutMessageEnd(buf.begin(), buf.size()); + + // place MAC + cout << "Placing MAC in file " << argv[2] << ", location " << macPos << ".\n"; + dllFile.seekg(macPos, std::ios_base::beg); + dllFile.write((char *)mac, sizeof(mac)); + } + else if (command == "m") + DigestFile(argv[2]); + else if (command == "tv") + { + std::string fname = argv[2]; + if (fname.find(".txt") == std::string::npos) + fname = "TestVectors/" + fname + ".txt"; + return !RunTestDataFile(fname.c_str()); + } + else if (command == "t") + { + // VC60 workaround: use char array instead of std::string to workaround MSVC's getline bug + char passPhrase[MAX_PHRASE_LENGTH], plaintext[1024]; + + cout << "Passphrase: "; + cin.getline(passPhrase, MAX_PHRASE_LENGTH); + + cout << "\nPlaintext: "; + cin.getline(plaintext, 1024); + + string ciphertext = EncryptString(plaintext, passPhrase); + cout << "\nCiphertext: " << ciphertext << endl; + + string decrypted = DecryptString(ciphertext.c_str(), passPhrase); + cout << "\nDecrypted: " << decrypted << endl; + + return 0; + } + else if (command == "e64") + Base64Encode(argv[2], argv[3]); + else if (command == "d64") + Base64Decode(argv[2], argv[3]); + else if (command == "e16") + HexEncode(argv[2], argv[3]); + else if (command == "d16") + HexDecode(argv[2], argv[3]); + else if (command == "e" || command == "d") + { + char passPhrase[MAX_PHRASE_LENGTH]; + cout << "Passphrase: "; + cin.getline(passPhrase, MAX_PHRASE_LENGTH); + if (command == "e") + EncryptFile(argv[2], argv[3], passPhrase); + else + DecryptFile(argv[2], argv[3], passPhrase); + } + else if (command == "ss") + { + char seed[1024]; + cout << "\nRandom Seed: "; + ws(cin); + cin.getline(seed, 1024); + SecretShareFile(atoi(argv[2]), atoi(argv[3]), argv[4], seed); + } + else if (command == "sr") + SecretRecoverFile(argc-3, argv[2], argv+3); + else if (command == "id") + InformationDisperseFile(atoi(argv[2]), atoi(argv[3]), argv[4]); + else if (command == "ir") + InformationRecoverFile(argc-3, argv[2], argv+3); + else if (command == "v" || command == "vv") + return !Validate(argc>2 ? atoi(argv[2]) : 0, argv[1][1] == 'v', argc>3 ? argv[3] : NULL); + else if (command == "b") + BenchmarkAll(argc<3 ? 1 : atof(argv[2]), argc<4 ? 0 : atof(argv[3])*1e9); + else if (command == "b2") + BenchmarkAll2(argc<3 ? 1 : atof(argv[2]), argc<4 ? 0 : atof(argv[3])*1e9); + else if (command == "z") + GzipFile(argv[3], argv[4], argv[2][0]-'0'); + else if (command == "u") + GunzipFile(argv[2], argv[3]); + else if (command == "fips") + FIPS140_SampleApplication(); + else if (command == "fips-rand") + FIPS140_GenerateRandomFiles(); + else if (command == "ft") + ForwardTcpPort(argv[2], argv[3], argv[4]); + else if (command == "a") + { + if (AdhocTest) + return (*AdhocTest)(argc, argv); + else + { + cerr << "AdhocTest not defined.\n"; + return 1; + } + } + else if (command == "hmac") + HmacFile(argv[2], argv[3]); + else if (command == "ae") + AES_CTR_Encrypt(argv[2], argv[3], argv[4], argv[5]); + else if (command == "h") + { + FileSource usage("TestData/usage.dat", true, new FileSink(cout)); + return 1; + } + else if (command == "V") + { + cout << CRYPTOPP_VERSION / 100 << '.' << (CRYPTOPP_VERSION % 100) / 10 << '.' << CRYPTOPP_VERSION % 10 << endl; + } + else + { + cerr << "Unrecognized command. Run \"cryptest h\" to obtain usage information.\n"; + return 1; + } + return 0; + } + catch(CryptoPP::Exception &e) + { + cout << "\nCryptoPP::Exception caught: " << e.what() << endl; + return -1; + } + catch(std::exception &e) + { + cout << "\nstd::exception caught: " << e.what() << endl; + return -2; + } +} + +void FIPS140_GenerateRandomFiles() +{ +#ifdef OS_RNG_AVAILABLE + DefaultAutoSeededRNG rng; + RandomNumberStore store(rng, ULONG_MAX); + + for (unsigned int i=0; i<100000; i++) + store.TransferTo(FileSink((IntToString(i) + ".rnd").c_str()).Ref(), 20000); +#else + cout << "OS provided RNG not available.\n"; + exit(-1); +#endif +} + +SecByteBlock HexDecodeString(const char *hex) +{ + StringSource ss(hex, true, new HexDecoder); + SecByteBlock result((size_t)ss.MaxRetrievable()); + ss.Get(result, result.size()); + return result; +} + +void GenerateRSAKey(unsigned int keyLength, const char *privFilename, const char *pubFilename, const char *seed) +{ + RandomPool randPool; + randPool.IncorporateEntropy((byte *)seed, strlen(seed)); + + RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength); + HexEncoder privFile(new FileSink(privFilename)); + priv.DEREncode(privFile); + privFile.MessageEnd(); + + RSAES_OAEP_SHA_Encryptor pub(priv); + HexEncoder pubFile(new FileSink(pubFilename)); + pub.DEREncode(pubFile); + pubFile.MessageEnd(); +} + +string RSAEncryptString(const char *pubFilename, const char *seed, const char *message) +{ + FileSource pubFile(pubFilename, true, new HexDecoder); + RSAES_OAEP_SHA_Encryptor pub(pubFile); + + RandomPool randPool; + randPool.IncorporateEntropy((byte *)seed, strlen(seed)); + + string result; + StringSource(message, true, new PK_EncryptorFilter(randPool, pub, new HexEncoder(new StringSink(result)))); + return result; +} + +string RSADecryptString(const char *privFilename, const char *ciphertext) +{ + FileSource privFile(privFilename, true, new HexDecoder); + RSAES_OAEP_SHA_Decryptor priv(privFile); + + string result; + StringSource(ciphertext, true, new HexDecoder(new PK_DecryptorFilter(GlobalRNG(), priv, new StringSink(result)))); + return result; +} + +void RSASignFile(const char *privFilename, const char *messageFilename, const char *signatureFilename) +{ + FileSource privFile(privFilename, true, new HexDecoder); + RSASS::Signer priv(privFile); + FileSource f(messageFilename, true, new SignerFilter(GlobalRNG(), priv, new HexEncoder(new FileSink(signatureFilename)))); +} + +bool RSAVerifyFile(const char *pubFilename, const char *messageFilename, const char *signatureFilename) +{ + FileSource pubFile(pubFilename, true, new HexDecoder); + RSASS::Verifier pub(pubFile); + + FileSource signatureFile(signatureFilename, true, new HexDecoder); + if (signatureFile.MaxRetrievable() != pub.SignatureLength()) + return false; + SecByteBlock signature(pub.SignatureLength()); + signatureFile.Get(signature, signature.size()); + + VerifierFilter *verifierFilter = new VerifierFilter(pub); + verifierFilter->Put(signature, pub.SignatureLength()); + FileSource f(messageFilename, true, verifierFilter); + + return verifierFilter->GetLastResult(); +} + +void DigestFile(const char *filename) +{ + SHA1 sha; + RIPEMD160 ripemd; + SHA256 sha256; + Tiger tiger; + SHA512 sha512; + Whirlpool whirlpool; + vector_member_ptrs filters(6); + filters[0].reset(new HashFilter(sha)); + filters[1].reset(new HashFilter(ripemd)); + filters[2].reset(new HashFilter(tiger)); + filters[3].reset(new HashFilter(sha256)); + filters[4].reset(new HashFilter(sha512)); + filters[5].reset(new HashFilter(whirlpool)); + + auto_ptr channelSwitch(new ChannelSwitch); + size_t i; + for (i=0; iAddDefaultRoute(*filters[i]); + FileSource(filename, true, channelSwitch.release()); + + HexEncoder encoder(new FileSink(cout), false); + for (i=0; iAlgorithmName() << ": "; + filters[i]->TransferTo(encoder); + cout << "\n"; + } +} + +void HmacFile(const char *hexKey, const char *file) +{ + member_ptr mac; + if (strcmp(hexKey, "selftest") == 0) + { + cerr << "Computing HMAC/SHA1 value for self test.\n"; + mac.reset(NewIntegrityCheckingMAC()); + } + else + { + std::string decodedKey; + StringSource(hexKey, true, new HexDecoder(new StringSink(decodedKey))); + mac.reset(new HMAC((const byte *)decodedKey.data(), decodedKey.size())); + } + FileSource(file, true, new HashFilter(*mac, new HexEncoder(new FileSink(cout)))); +} + +void AES_CTR_Encrypt(const char *hexKey, const char *hexIV, const char *infile, const char *outfile) +{ + SecByteBlock key = HexDecodeString(hexKey); + SecByteBlock iv = HexDecodeString(hexIV); + CTR_Mode::Encryption aes(key, key.size(), iv); + FileSource(infile, true, new StreamTransformationFilter(aes, new FileSink(outfile))); +} + +string EncryptString(const char *instr, const char *passPhrase) +{ + string outstr; + + DefaultEncryptorWithMAC encryptor(passPhrase, new HexEncoder(new StringSink(outstr))); + encryptor.Put((byte *)instr, strlen(instr)); + encryptor.MessageEnd(); + + return outstr; +} + +string DecryptString(const char *instr, const char *passPhrase) +{ + string outstr; + + HexDecoder decryptor(new DefaultDecryptorWithMAC(passPhrase, new StringSink(outstr))); + decryptor.Put((byte *)instr, strlen(instr)); + decryptor.MessageEnd(); + + return outstr; +} + +void EncryptFile(const char *in, const char *out, const char *passPhrase) +{ + FileSource f(in, true, new DefaultEncryptorWithMAC(passPhrase, new FileSink(out))); +} + +void DecryptFile(const char *in, const char *out, const char *passPhrase) +{ + FileSource f(in, true, new DefaultDecryptorWithMAC(passPhrase, new FileSink(out))); +} + +void SecretShareFile(int threshold, int nShares, const char *filename, const char *seed) +{ + assert(nShares<=1000); + + RandomPool rng; + rng.IncorporateEntropy((byte *)seed, strlen(seed)); + + ChannelSwitch *channelSwitch; + FileSource source(filename, false, new SecretSharing(rng, threshold, nShares, channelSwitch = new ChannelSwitch)); + + vector_member_ptrs fileSinks(nShares); + string channel; + for (int i=0; i(i); + fileSinks[i]->Put((byte *)channel.data(), 4); + channelSwitch->AddRoute(channel, *fileSinks[i], DEFAULT_CHANNEL); + } + + source.PumpAll(); +} + +void SecretRecoverFile(int threshold, const char *outFilename, char *const *inFilenames) +{ + assert(threshold<=1000); + + SecretRecovery recovery(threshold, new FileSink(outFilename)); + + vector_member_ptrs fileSources(threshold); + SecByteBlock channel(4); + int i; + for (i=0; iPump(4); + fileSources[i]->Get(channel, 4); + fileSources[i]->Attach(new ChannelSwitch(recovery, string((char *)channel.begin(), 4))); + } + + while (fileSources[0]->Pump(256)) + for (i=1; iPump(256); + + for (i=0; iPumpAll(); +} + +void InformationDisperseFile(int threshold, int nShares, const char *filename) +{ + assert(nShares<=1000); + + ChannelSwitch *channelSwitch; + FileSource source(filename, false, new InformationDispersal(threshold, nShares, channelSwitch = new ChannelSwitch)); + + vector_member_ptrs fileSinks(nShares); + string channel; + for (int i=0; i(i); + fileSinks[i]->Put((byte *)channel.data(), 4); + channelSwitch->AddRoute(channel, *fileSinks[i], DEFAULT_CHANNEL); + } + + source.PumpAll(); +} + +void InformationRecoverFile(int threshold, const char *outFilename, char *const *inFilenames) +{ + assert(threshold<=1000); + + InformationRecovery recovery(threshold, new FileSink(outFilename)); + + vector_member_ptrs fileSources(threshold); + SecByteBlock channel(4); + int i; + for (i=0; iPump(4); + fileSources[i]->Get(channel, 4); + fileSources[i]->Attach(new ChannelSwitch(recovery, string((char *)channel.begin(), 4))); + } + + while (fileSources[0]->Pump(256)) + for (i=1; iPump(256); + + for (i=0; iPumpAll(); +} + +void GzipFile(const char *in, const char *out, int deflate_level) +{ +// FileSource(in, true, new Gzip(new FileSink(out), deflate_level)); + + // use a filter graph to compare decompressed data with original + // + // Source ----> Gzip ------> Sink + // \ | + // \ Gunzip + // \ | + // \ v + // > ComparisonFilter + + EqualityComparisonFilter comparison; + + Gunzip gunzip(new ChannelSwitch(comparison, "0")); + gunzip.SetAutoSignalPropagation(0); + + FileSink sink(out); + + ChannelSwitch *cs; + Gzip gzip(cs = new ChannelSwitch(sink), deflate_level); + cs->AddDefaultRoute(gunzip); + + cs = new ChannelSwitch(gzip); + cs->AddDefaultRoute(comparison, "1"); + FileSource source(in, true, cs); + + comparison.ChannelMessageSeriesEnd("0"); + comparison.ChannelMessageSeriesEnd("1"); +} + +void GunzipFile(const char *in, const char *out) +{ + FileSource(in, true, new Gunzip(new FileSink(out))); +} + +void Base64Encode(const char *in, const char *out) +{ + FileSource(in, true, new Base64Encoder(new FileSink(out))); +} + +void Base64Decode(const char *in, const char *out) +{ + FileSource(in, true, new Base64Decoder(new FileSink(out))); +} + +void HexEncode(const char *in, const char *out) +{ + FileSource(in, true, new HexEncoder(new FileSink(out))); +} + +void HexDecode(const char *in, const char *out) +{ + FileSource(in, true, new HexDecoder(new FileSink(out))); +} + +void ForwardTcpPort(const char *sourcePortName, const char *destinationHost, const char *destinationPortName) +{ +#ifdef SOCKETS_AVAILABLE + SocketsInitializer sockInit; + + Socket sockListen, sockSource, sockDestination; + + int sourcePort = Socket::PortNameToNumber(sourcePortName); + int destinationPort = Socket::PortNameToNumber(destinationPortName); + + sockListen.Create(); + sockListen.Bind(sourcePort); + setsockopt(sockListen, IPPROTO_TCP, TCP_NODELAY, "\x01", 1); + + cout << "Listing on port " << sourcePort << ".\n"; + sockListen.Listen(); + + sockListen.Accept(sockSource); + cout << "Connection accepted on port " << sourcePort << ".\n"; + sockListen.CloseSocket(); + + cout << "Making connection to " << destinationHost << ", port " << destinationPort << ".\n"; + sockDestination.Create(); + sockDestination.Connect(destinationHost, destinationPort); + + cout << "Connection made to " << destinationHost << ", starting to forward.\n"; + + SocketSource out(sockSource, false, new SocketSink(sockDestination)); + SocketSource in(sockDestination, false, new SocketSink(sockSource)); + + WaitObjectContainer waitObjects; + + while (!(in.SourceExhausted() && out.SourceExhausted())) + { + waitObjects.Clear(); + + out.GetWaitObjects(waitObjects, CallStack("ForwardTcpPort - out", NULL)); + in.GetWaitObjects(waitObjects, CallStack("ForwardTcpPort - in", NULL)); + + waitObjects.Wait(INFINITE_TIME); + + if (!out.SourceExhausted()) + { + cout << "o" << flush; + out.PumpAll2(false); + if (out.SourceExhausted()) + cout << "EOF received on source socket.\n"; + } + + if (!in.SourceExhausted()) + { + cout << "i" << flush; + in.PumpAll2(false); + if (in.SourceExhausted()) + cout << "EOF received on destination socket.\n"; + } + } +#else + cout << "Socket support was not enabled at compile time.\n"; + exit(-1); +#endif +} + +bool Validate(int alg, bool thorough, const char *seedInput) +{ + bool result; + + std::string seed = seedInput ? std::string(seedInput) : IntToString(time(NULL)); + seed.resize(16); + + cout << "Using seed: " << seed << endl << endl; + s_globalRNG.SetKeyWithIV((byte *)seed.data(), 16, (byte *)seed.data()); + + switch (alg) + { + case 0: result = ValidateAll(thorough); break; + case 1: result = TestSettings(); break; + case 2: result = TestOS_RNG(); break; + case 3: result = ValidateMD5(); break; + case 4: result = ValidateSHA(); break; + case 5: result = ValidateDES(); break; + case 6: result = ValidateIDEA(); break; + case 7: result = ValidateARC4(); break; + case 8: result = ValidateRC5(); break; + case 9: result = ValidateBlowfish(); break; +// case 10: result = ValidateDiamond2(); break; + case 11: result = ValidateThreeWay(); break; + case 12: result = ValidateBBS(); break; + case 13: result = ValidateDH(); break; + case 14: result = ValidateRSA(); break; + case 15: result = ValidateElGamal(); break; + case 16: result = ValidateDSA(thorough); break; +// case 17: result = ValidateHAVAL(); break; + case 18: result = ValidateSAFER(); break; + case 19: result = ValidateLUC(); break; + case 20: result = ValidateRabin(); break; +// case 21: result = ValidateBlumGoldwasser(); break; + case 22: result = ValidateECP(); break; + case 23: result = ValidateEC2N(); break; +// case 24: result = ValidateMD5MAC(); break; + case 25: result = ValidateGOST(); break; + case 26: result = ValidateTiger(); break; + case 27: result = ValidateRIPEMD(); break; + case 28: result = ValidateHMAC(); break; +// case 29: result = ValidateXMACC(); break; + case 30: result = ValidateSHARK(); break; + case 32: result = ValidateLUC_DH(); break; + case 33: result = ValidateLUC_DL(); break; + case 34: result = ValidateSEAL(); break; + case 35: result = ValidateCAST(); break; + case 36: result = ValidateSquare(); break; + case 37: result = ValidateRC2(); break; + case 38: result = ValidateRC6(); break; + case 39: result = ValidateMARS(); break; + case 40: result = ValidateRW(); break; + case 41: result = ValidateMD2(); break; + case 42: result = ValidateNR(); break; + case 43: result = ValidateMQV(); break; + case 44: result = ValidateRijndael(); break; + case 45: result = ValidateTwofish(); break; + case 46: result = ValidateSerpent(); break; + case 47: result = ValidateCipherModes(); break; + case 48: result = ValidateCRC32(); break; + case 49: result = ValidateECDSA(); break; + case 50: result = ValidateXTR_DH(); break; + case 51: result = ValidateSKIPJACK(); break; + case 52: result = ValidateSHA2(); break; + case 53: result = ValidatePanama(); break; + case 54: result = ValidateAdler32(); break; + case 55: result = ValidateMD4(); break; + case 56: result = ValidatePBKDF(); break; + case 57: result = ValidateESIGN(); break; + case 58: result = ValidateDLIES(); break; + case 59: result = ValidateBaseCode(); break; + case 60: result = ValidateSHACAL2(); break; + case 61: result = ValidateCamellia(); break; + case 62: result = ValidateWhirlpool(); break; + case 63: result = ValidateTTMAC(); break; + case 64: result = ValidateSalsa(); break; + case 65: result = ValidateSosemanuk(); break; + case 66: result = ValidateVMAC(); break; + case 67: result = ValidateCCM(); break; + case 68: result = ValidateGCM(); break; + case 69: result = ValidateCMAC(); break; + default: return false; + } + + time_t endTime = time(NULL); + cout << "\nTest ended at " << asctime(localtime(&endTime)); + cout << "Seed used was: " << seed << endl; + + return result; +} diff --git a/cryptopp/tftables.cpp b/cryptopp/tftables.cpp new file mode 100644 index 0000000..dc654cf --- /dev/null +++ b/cryptopp/tftables.cpp @@ -0,0 +1,317 @@ +// Twofish tables + +#include "pch.h" +#include "twofish.h" + +NAMESPACE_BEGIN(CryptoPP) + +const byte Twofish::Base::q[2][256] = { + 0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, 0x9A, 0x92, 0x80, 0x78, + 0xE4, 0xDD, 0xD1, 0x38, 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C, + 0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, 0xF2, 0xD0, 0x8B, 0x30, + 0x84, 0x54, 0xDF, 0x23, 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82, + 0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, 0xA6, 0xEB, 0xA5, 0xBE, + 0x16, 0x0C, 0xE3, 0x61, 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B, + 0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, 0xE1, 0xE6, 0xBD, 0x45, + 0xE2, 0xF4, 0xB6, 0x66, 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7, + 0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, 0xEA, 0x77, 0x39, 0xAF, + 0x33, 0xC9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8, + 0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, 0xA1, 0x1D, 0xAA, 0xED, + 0x06, 0x70, 0xB2, 0xD2, 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90, + 0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, 0x9E, 0x9C, 0x52, 0x1B, + 0x5F, 0x93, 0x0A, 0xEF, 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B, + 0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, 0x2A, 0xCE, 0xCB, 0x2F, + 0xFC, 0x97, 0x05, 0x7A, 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A, + 0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, 0xB8, 0xDA, 0xB0, 0x17, + 0x55, 0x1F, 0x8A, 0x7D, 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72, + 0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6E, 0x50, 0xDE, 0x68, + 0x65, 0xBC, 0xDB, 0xF8, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, + 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0x6F, 0x9D, 0x36, 0x42, + 0x4A, 0x5E, 0xC1, 0xE0, + + 0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, 0x4A, 0xD3, 0xE6, 0x6B, + 0x45, 0x7D, 0xE8, 0x4B, 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1, + 0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, 0x5E, 0xBA, 0xAE, 0x5B, + 0x8A, 0x00, 0xBC, 0x9D, 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5, + 0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, 0xB2, 0x73, 0x4C, 0x54, + 0x92, 0x74, 0x36, 0x51, 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96, + 0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, 0x13, 0x95, 0x9C, 0xC7, + 0x24, 0x46, 0x3B, 0x70, 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8, + 0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, 0x03, 0x6F, 0x08, 0xBF, + 0x40, 0xE7, 0x2B, 0xE2, 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9, + 0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, 0x66, 0x94, 0xA1, 0x1D, + 0x3D, 0xF0, 0xDE, 0xB3, 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E, + 0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, 0x81, 0x88, 0xEE, 0x21, + 0xC4, 0x1A, 0xEB, 0xD9, 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01, + 0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, 0x4F, 0xF2, 0x65, 0x8E, + 0x78, 0x5C, 0x58, 0x19, 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64, + 0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, 0xCE, 0xE9, 0x68, 0x44, + 0xE0, 0x4D, 0x43, 0x69, 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E, + 0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, 0x22, 0xC9, 0xC0, 0x9B, + 0x89, 0xD4, 0xED, 0xAB, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, + 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0x16, 0x25, 0x86, 0x56, + 0x55, 0x09, 0xBE, 0x91 +}; + +const word32 Twofish::Base::mds[4][256] = { + 0xbcbc3275, 0xecec21f3, 0x202043c6, 0xb3b3c9f4, + 0xdada03db, 0x02028b7b, 0xe2e22bfb, 0x9e9efac8, + 0xc9c9ec4a, 0xd4d409d3, 0x18186be6, 0x1e1e9f6b, + 0x98980e45, 0xb2b2387d, 0xa6a6d2e8, 0x2626b74b, + 0x3c3c57d6, 0x93938a32, 0x8282eed8, 0x525298fd, + 0x7b7bd437, 0xbbbb3771, 0x5b5b97f1, 0x474783e1, + 0x24243c30, 0x5151e20f, 0xbabac6f8, 0x4a4af31b, + 0xbfbf4887, 0x0d0d70fa, 0xb0b0b306, 0x7575de3f, + 0xd2d2fd5e, 0x7d7d20ba, 0x666631ae, 0x3a3aa35b, + 0x59591c8a, 0x00000000, 0xcdcd93bc, 0x1a1ae09d, + 0xaeae2c6d, 0x7f7fabc1, 0x2b2bc7b1, 0xbebeb90e, + 0xe0e0a080, 0x8a8a105d, 0x3b3b52d2, 0x6464bad5, + 0xd8d888a0, 0xe7e7a584, 0x5f5fe807, 0x1b1b1114, + 0x2c2cc2b5, 0xfcfcb490, 0x3131272c, 0x808065a3, + 0x73732ab2, 0x0c0c8173, 0x79795f4c, 0x6b6b4154, + 0x4b4b0292, 0x53536974, 0x94948f36, 0x83831f51, + 0x2a2a3638, 0xc4c49cb0, 0x2222c8bd, 0xd5d5f85a, + 0xbdbdc3fc, 0x48487860, 0xffffce62, 0x4c4c0796, + 0x4141776c, 0xc7c7e642, 0xebeb24f7, 0x1c1c1410, + 0x5d5d637c, 0x36362228, 0x6767c027, 0xe9e9af8c, + 0x4444f913, 0x1414ea95, 0xf5f5bb9c, 0xcfcf18c7, + 0x3f3f2d24, 0xc0c0e346, 0x7272db3b, 0x54546c70, + 0x29294cca, 0xf0f035e3, 0x0808fe85, 0xc6c617cb, + 0xf3f34f11, 0x8c8ce4d0, 0xa4a45993, 0xcaca96b8, + 0x68683ba6, 0xb8b84d83, 0x38382820, 0xe5e52eff, + 0xadad569f, 0x0b0b8477, 0xc8c81dc3, 0x9999ffcc, + 0x5858ed03, 0x19199a6f, 0x0e0e0a08, 0x95957ebf, + 0x70705040, 0xf7f730e7, 0x6e6ecf2b, 0x1f1f6ee2, + 0xb5b53d79, 0x09090f0c, 0x616134aa, 0x57571682, + 0x9f9f0b41, 0x9d9d803a, 0x111164ea, 0x2525cdb9, + 0xafafdde4, 0x4545089a, 0xdfdf8da4, 0xa3a35c97, + 0xeaead57e, 0x353558da, 0xededd07a, 0x4343fc17, + 0xf8f8cb66, 0xfbfbb194, 0x3737d3a1, 0xfafa401d, + 0xc2c2683d, 0xb4b4ccf0, 0x32325dde, 0x9c9c71b3, + 0x5656e70b, 0xe3e3da72, 0x878760a7, 0x15151b1c, + 0xf9f93aef, 0x6363bfd1, 0x3434a953, 0x9a9a853e, + 0xb1b1428f, 0x7c7cd133, 0x88889b26, 0x3d3da65f, + 0xa1a1d7ec, 0xe4e4df76, 0x8181942a, 0x91910149, + 0x0f0ffb81, 0xeeeeaa88, 0x161661ee, 0xd7d77321, + 0x9797f5c4, 0xa5a5a81a, 0xfefe3feb, 0x6d6db5d9, + 0x7878aec5, 0xc5c56d39, 0x1d1de599, 0x7676a4cd, + 0x3e3edcad, 0xcbcb6731, 0xb6b6478b, 0xefef5b01, + 0x12121e18, 0x6060c523, 0x6a6ab0dd, 0x4d4df61f, + 0xcecee94e, 0xdede7c2d, 0x55559df9, 0x7e7e5a48, + 0x2121b24f, 0x03037af2, 0xa0a02665, 0x5e5e198e, + 0x5a5a6678, 0x65654b5c, 0x62624e58, 0xfdfd4519, + 0x0606f48d, 0x404086e5, 0xf2f2be98, 0x3333ac57, + 0x17179067, 0x05058e7f, 0xe8e85e05, 0x4f4f7d64, + 0x89896aaf, 0x10109563, 0x74742fb6, 0x0a0a75fe, + 0x5c5c92f5, 0x9b9b74b7, 0x2d2d333c, 0x3030d6a5, + 0x2e2e49ce, 0x494989e9, 0x46467268, 0x77775544, + 0xa8a8d8e0, 0x9696044d, 0x2828bd43, 0xa9a92969, + 0xd9d97929, 0x8686912e, 0xd1d187ac, 0xf4f44a15, + 0x8d8d1559, 0xd6d682a8, 0xb9b9bc0a, 0x42420d9e, + 0xf6f6c16e, 0x2f2fb847, 0xdddd06df, 0x23233934, + 0xcccc6235, 0xf1f1c46a, 0xc1c112cf, 0x8585ebdc, + 0x8f8f9e22, 0x7171a1c9, 0x9090f0c0, 0xaaaa539b, + 0x0101f189, 0x8b8be1d4, 0x4e4e8ced, 0x8e8e6fab, + 0xababa212, 0x6f6f3ea2, 0xe6e6540d, 0xdbdbf252, + 0x92927bbb, 0xb7b7b602, 0x6969ca2f, 0x3939d9a9, + 0xd3d30cd7, 0xa7a72361, 0xa2a2ad1e, 0xc3c399b4, + 0x6c6c4450, 0x07070504, 0x04047ff6, 0x272746c2, + 0xacaca716, 0xd0d07625, 0x50501386, 0xdcdcf756, + 0x84841a55, 0xe1e15109, 0x7a7a25be, 0x1313ef91, + + 0xa9d93939, 0x67901717, 0xb3719c9c, 0xe8d2a6a6, + 0x04050707, 0xfd985252, 0xa3658080, 0x76dfe4e4, + 0x9a084545, 0x92024b4b, 0x80a0e0e0, 0x78665a5a, + 0xe4ddafaf, 0xddb06a6a, 0xd1bf6363, 0x38362a2a, + 0x0d54e6e6, 0xc6432020, 0x3562cccc, 0x98bef2f2, + 0x181e1212, 0xf724ebeb, 0xecd7a1a1, 0x6c774141, + 0x43bd2828, 0x7532bcbc, 0x37d47b7b, 0x269b8888, + 0xfa700d0d, 0x13f94444, 0x94b1fbfb, 0x485a7e7e, + 0xf27a0303, 0xd0e48c8c, 0x8b47b6b6, 0x303c2424, + 0x84a5e7e7, 0x54416b6b, 0xdf06dddd, 0x23c56060, + 0x1945fdfd, 0x5ba33a3a, 0x3d68c2c2, 0x59158d8d, + 0xf321ecec, 0xae316666, 0xa23e6f6f, 0x82165757, + 0x63951010, 0x015befef, 0x834db8b8, 0x2e918686, + 0xd9b56d6d, 0x511f8383, 0x9b53aaaa, 0x7c635d5d, + 0xa63b6868, 0xeb3ffefe, 0xa5d63030, 0xbe257a7a, + 0x16a7acac, 0x0c0f0909, 0xe335f0f0, 0x6123a7a7, + 0xc0f09090, 0x8cafe9e9, 0x3a809d9d, 0xf5925c5c, + 0x73810c0c, 0x2c273131, 0x2576d0d0, 0x0be75656, + 0xbb7b9292, 0x4ee9cece, 0x89f10101, 0x6b9f1e1e, + 0x53a93434, 0x6ac4f1f1, 0xb499c3c3, 0xf1975b5b, + 0xe1834747, 0xe66b1818, 0xbdc82222, 0x450e9898, + 0xe26e1f1f, 0xf4c9b3b3, 0xb62f7474, 0x66cbf8f8, + 0xccff9999, 0x95ea1414, 0x03ed5858, 0x56f7dcdc, + 0xd4e18b8b, 0x1c1b1515, 0x1eada2a2, 0xd70cd3d3, + 0xfb2be2e2, 0xc31dc8c8, 0x8e195e5e, 0xb5c22c2c, + 0xe9894949, 0xcf12c1c1, 0xbf7e9595, 0xba207d7d, + 0xea641111, 0x77840b0b, 0x396dc5c5, 0xaf6a8989, + 0x33d17c7c, 0xc9a17171, 0x62ceffff, 0x7137bbbb, + 0x81fb0f0f, 0x793db5b5, 0x0951e1e1, 0xaddc3e3e, + 0x242d3f3f, 0xcda47676, 0xf99d5555, 0xd8ee8282, + 0xe5864040, 0xc5ae7878, 0xb9cd2525, 0x4d049696, + 0x44557777, 0x080a0e0e, 0x86135050, 0xe730f7f7, + 0xa1d33737, 0x1d40fafa, 0xaa346161, 0xed8c4e4e, + 0x06b3b0b0, 0x706c5454, 0xb22a7373, 0xd2523b3b, + 0x410b9f9f, 0x7b8b0202, 0xa088d8d8, 0x114ff3f3, + 0x3167cbcb, 0xc2462727, 0x27c06767, 0x90b4fcfc, + 0x20283838, 0xf67f0404, 0x60784848, 0xff2ee5e5, + 0x96074c4c, 0x5c4b6565, 0xb1c72b2b, 0xab6f8e8e, + 0x9e0d4242, 0x9cbbf5f5, 0x52f2dbdb, 0x1bf34a4a, + 0x5fa63d3d, 0x9359a4a4, 0x0abcb9b9, 0xef3af9f9, + 0x91ef1313, 0x85fe0808, 0x49019191, 0xee611616, + 0x2d7cdede, 0x4fb22121, 0x8f42b1b1, 0x3bdb7272, + 0x47b82f2f, 0x8748bfbf, 0x6d2caeae, 0x46e3c0c0, + 0xd6573c3c, 0x3e859a9a, 0x6929a9a9, 0x647d4f4f, + 0x2a948181, 0xce492e2e, 0xcb17c6c6, 0x2fca6969, + 0xfcc3bdbd, 0x975ca3a3, 0x055ee8e8, 0x7ad0eded, + 0xac87d1d1, 0x7f8e0505, 0xd5ba6464, 0x1aa8a5a5, + 0x4bb72626, 0x0eb9bebe, 0xa7608787, 0x5af8d5d5, + 0x28223636, 0x14111b1b, 0x3fde7575, 0x2979d9d9, + 0x88aaeeee, 0x3c332d2d, 0x4c5f7979, 0x02b6b7b7, + 0xb896caca, 0xda583535, 0xb09cc4c4, 0x17fc4343, + 0x551a8484, 0x1ff64d4d, 0x8a1c5959, 0x7d38b2b2, + 0x57ac3333, 0xc718cfcf, 0x8df40606, 0x74695353, + 0xb7749b9b, 0xc4f59797, 0x9f56adad, 0x72dae3e3, + 0x7ed5eaea, 0x154af4f4, 0x229e8f8f, 0x12a2abab, + 0x584e6262, 0x07e85f5f, 0x99e51d1d, 0x34392323, + 0x6ec1f6f6, 0x50446c6c, 0xde5d3232, 0x68724646, + 0x6526a0a0, 0xbc93cdcd, 0xdb03dada, 0xf8c6baba, + 0xc8fa9e9e, 0xa882d6d6, 0x2bcf6e6e, 0x40507070, + 0xdceb8585, 0xfe750a0a, 0x328a9393, 0xa48ddfdf, + 0xca4c2929, 0x10141c1c, 0x2173d7d7, 0xf0ccb4b4, + 0xd309d4d4, 0x5d108a8a, 0x0fe25151, 0x00000000, + 0x6f9a1919, 0x9de01a1a, 0x368f9494, 0x42e6c7c7, + 0x4aecc9c9, 0x5efdd2d2, 0xc1ab7f7f, 0xe0d8a8a8, + + 0xbc75bc32, 0xecf3ec21, 0x20c62043, 0xb3f4b3c9, + 0xdadbda03, 0x027b028b, 0xe2fbe22b, 0x9ec89efa, + 0xc94ac9ec, 0xd4d3d409, 0x18e6186b, 0x1e6b1e9f, + 0x9845980e, 0xb27db238, 0xa6e8a6d2, 0x264b26b7, + 0x3cd63c57, 0x9332938a, 0x82d882ee, 0x52fd5298, + 0x7b377bd4, 0xbb71bb37, 0x5bf15b97, 0x47e14783, + 0x2430243c, 0x510f51e2, 0xbaf8bac6, 0x4a1b4af3, + 0xbf87bf48, 0x0dfa0d70, 0xb006b0b3, 0x753f75de, + 0xd25ed2fd, 0x7dba7d20, 0x66ae6631, 0x3a5b3aa3, + 0x598a591c, 0x00000000, 0xcdbccd93, 0x1a9d1ae0, + 0xae6dae2c, 0x7fc17fab, 0x2bb12bc7, 0xbe0ebeb9, + 0xe080e0a0, 0x8a5d8a10, 0x3bd23b52, 0x64d564ba, + 0xd8a0d888, 0xe784e7a5, 0x5f075fe8, 0x1b141b11, + 0x2cb52cc2, 0xfc90fcb4, 0x312c3127, 0x80a38065, + 0x73b2732a, 0x0c730c81, 0x794c795f, 0x6b546b41, + 0x4b924b02, 0x53745369, 0x9436948f, 0x8351831f, + 0x2a382a36, 0xc4b0c49c, 0x22bd22c8, 0xd55ad5f8, + 0xbdfcbdc3, 0x48604878, 0xff62ffce, 0x4c964c07, + 0x416c4177, 0xc742c7e6, 0xebf7eb24, 0x1c101c14, + 0x5d7c5d63, 0x36283622, 0x672767c0, 0xe98ce9af, + 0x441344f9, 0x149514ea, 0xf59cf5bb, 0xcfc7cf18, + 0x3f243f2d, 0xc046c0e3, 0x723b72db, 0x5470546c, + 0x29ca294c, 0xf0e3f035, 0x088508fe, 0xc6cbc617, + 0xf311f34f, 0x8cd08ce4, 0xa493a459, 0xcab8ca96, + 0x68a6683b, 0xb883b84d, 0x38203828, 0xe5ffe52e, + 0xad9fad56, 0x0b770b84, 0xc8c3c81d, 0x99cc99ff, + 0x580358ed, 0x196f199a, 0x0e080e0a, 0x95bf957e, + 0x70407050, 0xf7e7f730, 0x6e2b6ecf, 0x1fe21f6e, + 0xb579b53d, 0x090c090f, 0x61aa6134, 0x57825716, + 0x9f419f0b, 0x9d3a9d80, 0x11ea1164, 0x25b925cd, + 0xafe4afdd, 0x459a4508, 0xdfa4df8d, 0xa397a35c, + 0xea7eead5, 0x35da3558, 0xed7aedd0, 0x431743fc, + 0xf866f8cb, 0xfb94fbb1, 0x37a137d3, 0xfa1dfa40, + 0xc23dc268, 0xb4f0b4cc, 0x32de325d, 0x9cb39c71, + 0x560b56e7, 0xe372e3da, 0x87a78760, 0x151c151b, + 0xf9eff93a, 0x63d163bf, 0x345334a9, 0x9a3e9a85, + 0xb18fb142, 0x7c337cd1, 0x8826889b, 0x3d5f3da6, + 0xa1eca1d7, 0xe476e4df, 0x812a8194, 0x91499101, + 0x0f810ffb, 0xee88eeaa, 0x16ee1661, 0xd721d773, + 0x97c497f5, 0xa51aa5a8, 0xfeebfe3f, 0x6dd96db5, + 0x78c578ae, 0xc539c56d, 0x1d991de5, 0x76cd76a4, + 0x3ead3edc, 0xcb31cb67, 0xb68bb647, 0xef01ef5b, + 0x1218121e, 0x602360c5, 0x6add6ab0, 0x4d1f4df6, + 0xce4ecee9, 0xde2dde7c, 0x55f9559d, 0x7e487e5a, + 0x214f21b2, 0x03f2037a, 0xa065a026, 0x5e8e5e19, + 0x5a785a66, 0x655c654b, 0x6258624e, 0xfd19fd45, + 0x068d06f4, 0x40e54086, 0xf298f2be, 0x335733ac, + 0x17671790, 0x057f058e, 0xe805e85e, 0x4f644f7d, + 0x89af896a, 0x10631095, 0x74b6742f, 0x0afe0a75, + 0x5cf55c92, 0x9bb79b74, 0x2d3c2d33, 0x30a530d6, + 0x2ece2e49, 0x49e94989, 0x46684672, 0x77447755, + 0xa8e0a8d8, 0x964d9604, 0x284328bd, 0xa969a929, + 0xd929d979, 0x862e8691, 0xd1acd187, 0xf415f44a, + 0x8d598d15, 0xd6a8d682, 0xb90ab9bc, 0x429e420d, + 0xf66ef6c1, 0x2f472fb8, 0xdddfdd06, 0x23342339, + 0xcc35cc62, 0xf16af1c4, 0xc1cfc112, 0x85dc85eb, + 0x8f228f9e, 0x71c971a1, 0x90c090f0, 0xaa9baa53, + 0x018901f1, 0x8bd48be1, 0x4eed4e8c, 0x8eab8e6f, + 0xab12aba2, 0x6fa26f3e, 0xe60de654, 0xdb52dbf2, + 0x92bb927b, 0xb702b7b6, 0x692f69ca, 0x39a939d9, + 0xd3d7d30c, 0xa761a723, 0xa21ea2ad, 0xc3b4c399, + 0x6c506c44, 0x07040705, 0x04f6047f, 0x27c22746, + 0xac16aca7, 0xd025d076, 0x50865013, 0xdc56dcf7, + 0x8455841a, 0xe109e151, 0x7abe7a25, 0x139113ef, + + 0xd939a9d9, 0x90176790, 0x719cb371, 0xd2a6e8d2, + 0x05070405, 0x9852fd98, 0x6580a365, 0xdfe476df, + 0x08459a08, 0x024b9202, 0xa0e080a0, 0x665a7866, + 0xddafe4dd, 0xb06addb0, 0xbf63d1bf, 0x362a3836, + 0x54e60d54, 0x4320c643, 0x62cc3562, 0xbef298be, + 0x1e12181e, 0x24ebf724, 0xd7a1ecd7, 0x77416c77, + 0xbd2843bd, 0x32bc7532, 0xd47b37d4, 0x9b88269b, + 0x700dfa70, 0xf94413f9, 0xb1fb94b1, 0x5a7e485a, + 0x7a03f27a, 0xe48cd0e4, 0x47b68b47, 0x3c24303c, + 0xa5e784a5, 0x416b5441, 0x06dddf06, 0xc56023c5, + 0x45fd1945, 0xa33a5ba3, 0x68c23d68, 0x158d5915, + 0x21ecf321, 0x3166ae31, 0x3e6fa23e, 0x16578216, + 0x95106395, 0x5bef015b, 0x4db8834d, 0x91862e91, + 0xb56dd9b5, 0x1f83511f, 0x53aa9b53, 0x635d7c63, + 0x3b68a63b, 0x3ffeeb3f, 0xd630a5d6, 0x257abe25, + 0xa7ac16a7, 0x0f090c0f, 0x35f0e335, 0x23a76123, + 0xf090c0f0, 0xafe98caf, 0x809d3a80, 0x925cf592, + 0x810c7381, 0x27312c27, 0x76d02576, 0xe7560be7, + 0x7b92bb7b, 0xe9ce4ee9, 0xf10189f1, 0x9f1e6b9f, + 0xa93453a9, 0xc4f16ac4, 0x99c3b499, 0x975bf197, + 0x8347e183, 0x6b18e66b, 0xc822bdc8, 0x0e98450e, + 0x6e1fe26e, 0xc9b3f4c9, 0x2f74b62f, 0xcbf866cb, + 0xff99ccff, 0xea1495ea, 0xed5803ed, 0xf7dc56f7, + 0xe18bd4e1, 0x1b151c1b, 0xada21ead, 0x0cd3d70c, + 0x2be2fb2b, 0x1dc8c31d, 0x195e8e19, 0xc22cb5c2, + 0x8949e989, 0x12c1cf12, 0x7e95bf7e, 0x207dba20, + 0x6411ea64, 0x840b7784, 0x6dc5396d, 0x6a89af6a, + 0xd17c33d1, 0xa171c9a1, 0xceff62ce, 0x37bb7137, + 0xfb0f81fb, 0x3db5793d, 0x51e10951, 0xdc3eaddc, + 0x2d3f242d, 0xa476cda4, 0x9d55f99d, 0xee82d8ee, + 0x8640e586, 0xae78c5ae, 0xcd25b9cd, 0x04964d04, + 0x55774455, 0x0a0e080a, 0x13508613, 0x30f7e730, + 0xd337a1d3, 0x40fa1d40, 0x3461aa34, 0x8c4eed8c, + 0xb3b006b3, 0x6c54706c, 0x2a73b22a, 0x523bd252, + 0x0b9f410b, 0x8b027b8b, 0x88d8a088, 0x4ff3114f, + 0x67cb3167, 0x4627c246, 0xc06727c0, 0xb4fc90b4, + 0x28382028, 0x7f04f67f, 0x78486078, 0x2ee5ff2e, + 0x074c9607, 0x4b655c4b, 0xc72bb1c7, 0x6f8eab6f, + 0x0d429e0d, 0xbbf59cbb, 0xf2db52f2, 0xf34a1bf3, + 0xa63d5fa6, 0x59a49359, 0xbcb90abc, 0x3af9ef3a, + 0xef1391ef, 0xfe0885fe, 0x01914901, 0x6116ee61, + 0x7cde2d7c, 0xb2214fb2, 0x42b18f42, 0xdb723bdb, + 0xb82f47b8, 0x48bf8748, 0x2cae6d2c, 0xe3c046e3, + 0x573cd657, 0x859a3e85, 0x29a96929, 0x7d4f647d, + 0x94812a94, 0x492ece49, 0x17c6cb17, 0xca692fca, + 0xc3bdfcc3, 0x5ca3975c, 0x5ee8055e, 0xd0ed7ad0, + 0x87d1ac87, 0x8e057f8e, 0xba64d5ba, 0xa8a51aa8, + 0xb7264bb7, 0xb9be0eb9, 0x6087a760, 0xf8d55af8, + 0x22362822, 0x111b1411, 0xde753fde, 0x79d92979, + 0xaaee88aa, 0x332d3c33, 0x5f794c5f, 0xb6b702b6, + 0x96cab896, 0x5835da58, 0x9cc4b09c, 0xfc4317fc, + 0x1a84551a, 0xf64d1ff6, 0x1c598a1c, 0x38b27d38, + 0xac3357ac, 0x18cfc718, 0xf4068df4, 0x69537469, + 0x749bb774, 0xf597c4f5, 0x56ad9f56, 0xdae372da, + 0xd5ea7ed5, 0x4af4154a, 0x9e8f229e, 0xa2ab12a2, + 0x4e62584e, 0xe85f07e8, 0xe51d99e5, 0x39233439, + 0xc1f66ec1, 0x446c5044, 0x5d32de5d, 0x72466872, + 0x26a06526, 0x93cdbc93, 0x03dadb03, 0xc6baf8c6, + 0xfa9ec8fa, 0x82d6a882, 0xcf6e2bcf, 0x50704050, + 0xeb85dceb, 0x750afe75, 0x8a93328a, 0x8ddfa48d, + 0x4c29ca4c, 0x141c1014, 0x73d72173, 0xccb4f0cc, + 0x09d4d309, 0x108a5d10, 0xe2510fe2, 0x00000000, + 0x9a196f9a, 0xe01a9de0, 0x8f94368f, 0xe6c742e6, + 0xecc94aec, 0xfdd25efd, 0xab7fc1ab, 0xd8a8e0d8}; + +NAMESPACE_END diff --git a/cryptopp/tiger.cpp b/cryptopp/tiger.cpp new file mode 100644 index 0000000..c6c05ca --- /dev/null +++ b/cryptopp/tiger.cpp @@ -0,0 +1,265 @@ +// tiger.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "tiger.h" +#include "misc.h" +#include "cpu.h" + +NAMESPACE_BEGIN(CryptoPP) + +void Tiger::InitState(HashWordType *state) +{ + state[0] = W64LIT(0x0123456789ABCDEF); + state[1] = W64LIT(0xFEDCBA9876543210); + state[2] = W64LIT(0xF096A5B4C3B2E187); +} + +void Tiger::TruncatedFinal(byte *hash, size_t size) +{ + ThrowIfInvalidTruncatedSize(size); + + PadLastBlock(56, 0x01); + CorrectEndianess(m_data, m_data, 56); + + m_data[7] = GetBitCountLo(); + + Transform(m_state, m_data); + CorrectEndianess(m_state, m_state, DigestSize()); + memcpy(hash, m_state, size); + + Restart(); // reinit for next use +} + +void Tiger::Transform (word64 *digest, const word64 *X) +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86 + if (HasSSE2()) + { +#ifdef __GNUC__ + __asm__ __volatile__ + ( + ".intel_syntax noprefix;" + AS1( push ebx) +#else + #if _MSC_VER < 1300 + const word64 *t = table; + AS2( mov edx, t) + #else + AS2( lea edx, [table]) + #endif + AS2( mov eax, digest) + AS2( mov esi, X) +#endif + AS2( movq mm0, [eax]) + AS2( movq mm1, [eax+1*8]) + AS2( movq mm5, mm1) + AS2( movq mm2, [eax+2*8]) + AS2( movq mm7, [edx+4*2048+0*8]) + AS2( movq mm6, [edx+4*2048+1*8]) + AS2( mov ecx, esp) + AS2( and esp, 0xfffffff0) + AS2( sub esp, 8*8) + AS1( push ecx) + +#define SSE2_round(a,b,c,x,mul) \ + AS2( pxor c, [x])\ + AS2( movd ecx, c)\ + AS2( movzx edi, cl)\ + AS2( movq mm3, [edx+0*2048+edi*8])\ + AS2( movzx edi, ch)\ + AS2( movq mm4, [edx+3*2048+edi*8])\ + AS2( shr ecx, 16)\ + AS2( movzx edi, cl)\ + AS2( pxor mm3, [edx+1*2048+edi*8])\ + AS2( movzx edi, ch)\ + AS2( pxor mm4, [edx+2*2048+edi*8])\ + AS3( pextrw ecx, c, 2)\ + AS2( movzx edi, cl)\ + AS2( pxor mm3, [edx+2*2048+edi*8])\ + AS2( movzx edi, ch)\ + AS2( pxor mm4, [edx+1*2048+edi*8])\ + AS3( pextrw ecx, c, 3)\ + AS2( movzx edi, cl)\ + AS2( pxor mm3, [edx+3*2048+edi*8])\ + AS2( psubq a, mm3)\ + AS2( movzx edi, ch)\ + AS2( pxor mm4, [edx+0*2048+edi*8])\ + AS2( paddq b, mm4)\ + SSE2_mul_##mul(b) + +#define SSE2_mul_5(b) \ + AS2( movq mm3, b)\ + AS2( psllq b, 2)\ + AS2( paddq b, mm3) + +#define SSE2_mul_7(b) \ + AS2( movq mm3, b)\ + AS2( psllq b, 3)\ + AS2( psubq b, mm3) + +#define SSE2_mul_9(b) \ + AS2( movq mm3, b)\ + AS2( psllq b, 3)\ + AS2( paddq b, mm3) + +#define label2_5 1 +#define label2_7 2 +#define label2_9 3 + +#define SSE2_pass(A,B,C,mul,X) \ + AS2( xor ebx, ebx)\ + ASL(mul)\ + SSE2_round(A,B,C,X+0*8+ebx,mul)\ + SSE2_round(B,C,A,X+1*8+ebx,mul)\ + AS2( cmp ebx, 6*8)\ + ASJ( je, label2_##mul, f)\ + SSE2_round(C,A,B,X+2*8+ebx,mul)\ + AS2( add ebx, 3*8)\ + ASJ( jmp, mul, b)\ + ASL(label2_##mul) + +#define SSE2_key_schedule(Y,X) \ + AS2( movq mm3, [X+7*8])\ + AS2( pxor mm3, mm6)\ + AS2( movq mm4, [X+0*8])\ + AS2( psubq mm4, mm3)\ + AS2( movq [Y+0*8], mm4)\ + AS2( pxor mm4, [X+1*8])\ + AS2( movq mm3, mm4)\ + AS2( movq [Y+1*8], mm4)\ + AS2( paddq mm4, [X+2*8])\ + AS2( pxor mm3, mm7)\ + AS2( psllq mm3, 19)\ + AS2( movq [Y+2*8], mm4)\ + AS2( pxor mm3, mm4)\ + AS2( movq mm4, [X+3*8])\ + AS2( psubq mm4, mm3)\ + AS2( movq [Y+3*8], mm4)\ + AS2( pxor mm4, [X+4*8])\ + AS2( movq mm3, mm4)\ + AS2( movq [Y+4*8], mm4)\ + AS2( paddq mm4, [X+5*8])\ + AS2( pxor mm3, mm7)\ + AS2( psrlq mm3, 23)\ + AS2( movq [Y+5*8], mm4)\ + AS2( pxor mm3, mm4)\ + AS2( movq mm4, [X+6*8])\ + AS2( psubq mm4, mm3)\ + AS2( movq [Y+6*8], mm4)\ + AS2( pxor mm4, [X+7*8])\ + AS2( movq mm3, mm4)\ + AS2( movq [Y+7*8], mm4)\ + AS2( paddq mm4, [Y+0*8])\ + AS2( pxor mm3, mm7)\ + AS2( psllq mm3, 19)\ + AS2( movq [Y+0*8], mm4)\ + AS2( pxor mm3, mm4)\ + AS2( movq mm4, [Y+1*8])\ + AS2( psubq mm4, mm3)\ + AS2( movq [Y+1*8], mm4)\ + AS2( pxor mm4, [Y+2*8])\ + AS2( movq mm3, mm4)\ + AS2( movq [Y+2*8], mm4)\ + AS2( paddq mm4, [Y+3*8])\ + AS2( pxor mm3, mm7)\ + AS2( psrlq mm3, 23)\ + AS2( movq [Y+3*8], mm4)\ + AS2( pxor mm3, mm4)\ + AS2( movq mm4, [Y+4*8])\ + AS2( psubq mm4, mm3)\ + AS2( movq [Y+4*8], mm4)\ + AS2( pxor mm4, [Y+5*8])\ + AS2( movq [Y+5*8], mm4)\ + AS2( paddq mm4, [Y+6*8])\ + AS2( movq [Y+6*8], mm4)\ + AS2( pxor mm4, [edx+4*2048+2*8])\ + AS2( movq mm3, [Y+7*8])\ + AS2( psubq mm3, mm4)\ + AS2( movq [Y+7*8], mm3) + + SSE2_pass(mm0, mm1, mm2, 5, esi) + SSE2_key_schedule(esp+4, esi) + SSE2_pass(mm2, mm0, mm1, 7, esp+4) + SSE2_key_schedule(esp+4, esp+4) + SSE2_pass(mm1, mm2, mm0, 9, esp+4) + + AS2( pxor mm0, [eax+0*8]) + AS2( movq [eax+0*8], mm0) + AS2( psubq mm1, mm5) + AS2( movq [eax+1*8], mm1) + AS2( paddq mm2, [eax+2*8]) + AS2( movq [eax+2*8], mm2) + + AS1( pop esp) + AS1( emms) +#ifdef __GNUC__ + AS1( pop ebx) + ".att_syntax prefix;" + : + : "a" (digest), "S" (X), "d" (table) + : "%ecx", "%edi", "memory", "cc" + ); +#endif + } + else +#endif + { + word64 a = digest[0]; + word64 b = digest[1]; + word64 c = digest[2]; + word64 Y[8]; + +#define t1 (table) +#define t2 (table+256) +#define t3 (table+256*2) +#define t4 (table+256*3) + +#define round(a,b,c,x,mul) \ + c ^= x; \ + a -= t1[GETBYTE(c,0)] ^ t2[GETBYTE(c,2)] ^ t3[GETBYTE(c,4)] ^ t4[GETBYTE(c,6)]; \ + b += t4[GETBYTE(c,1)] ^ t3[GETBYTE(c,3)] ^ t2[GETBYTE(c,5)] ^ t1[GETBYTE(c,7)]; \ + b *= mul + +#define pass(a,b,c,mul,X) {\ + int i=0;\ + while (true)\ + {\ + round(a,b,c,X[i+0],mul); \ + round(b,c,a,X[i+1],mul); \ + if (i==6)\ + break;\ + round(c,a,b,X[i+2],mul); \ + i+=3;\ + }} + +#define key_schedule(Y,X) \ + Y[0] = X[0] - (X[7]^W64LIT(0xA5A5A5A5A5A5A5A5)); \ + Y[1] = X[1] ^ Y[0]; \ + Y[2] = X[2] + Y[1]; \ + Y[3] = X[3] - (Y[2] ^ ((~Y[1])<<19)); \ + Y[4] = X[4] ^ Y[3]; \ + Y[5] = X[5] + Y[4]; \ + Y[6] = X[6] - (Y[5] ^ ((~Y[4])>>23)); \ + Y[7] = X[7] ^ Y[6]; \ + Y[0] += Y[7]; \ + Y[1] -= Y[0] ^ ((~Y[7])<<19); \ + Y[2] ^= Y[1]; \ + Y[3] += Y[2]; \ + Y[4] -= Y[3] ^ ((~Y[2])>>23); \ + Y[5] ^= Y[4]; \ + Y[6] += Y[5]; \ + Y[7] -= Y[6] ^ W64LIT(0x0123456789ABCDEF) + + pass(a,b,c,5,X); + key_schedule(Y,X); + pass(c,a,b,7,Y); + key_schedule(Y,Y); + pass(b,c,a,9,Y); + + digest[0] = a ^ digest[0]; + digest[1] = b - digest[1]; + digest[2] = c + digest[2]; + } +} + +NAMESPACE_END diff --git a/cryptopp/tiger.h b/cryptopp/tiger.h new file mode 100644 index 0000000..5f6e941 --- /dev/null +++ b/cryptopp/tiger.h @@ -0,0 +1,24 @@ +#ifndef CRYPTOPP_TIGER_H +#define CRYPTOPP_TIGER_H + +#include "config.h" +#include "iterhash.h" + +NAMESPACE_BEGIN(CryptoPP) + +/// Tiger +class Tiger : public IteratedHashWithStaticTransform +{ +public: + static void InitState(HashWordType *state); + static void Transform(word64 *digest, const word64 *data); + void TruncatedFinal(byte *hash, size_t size); + static const char * StaticAlgorithmName() {return "Tiger";} + +protected: + static const word64 table[4*256+3]; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/tigertab.cpp b/cryptopp/tigertab.cpp new file mode 100644 index 0000000..5c1595b --- /dev/null +++ b/cryptopp/tigertab.cpp @@ -0,0 +1,525 @@ +#include "pch.h" +#include "tiger.h" + +NAMESPACE_BEGIN(CryptoPP) + +const word64 Tiger::table[4*256+3] = +{ + W64LIT(0x02AAB17CF7E90C5E) /* 0 */, W64LIT(0xAC424B03E243A8EC) /* 1 */, + W64LIT(0x72CD5BE30DD5FCD3) /* 2 */, W64LIT(0x6D019B93F6F97F3A) /* 3 */, + W64LIT(0xCD9978FFD21F9193) /* 4 */, W64LIT(0x7573A1C9708029E2) /* 5 */, + W64LIT(0xB164326B922A83C3) /* 6 */, W64LIT(0x46883EEE04915870) /* 7 */, + W64LIT(0xEAACE3057103ECE6) /* 8 */, W64LIT(0xC54169B808A3535C) /* 9 */, + W64LIT(0x4CE754918DDEC47C) /* 10 */, W64LIT(0x0AA2F4DFDC0DF40C) /* 11 */, + W64LIT(0x10B76F18A74DBEFA) /* 12 */, W64LIT(0xC6CCB6235AD1AB6A) /* 13 */, + W64LIT(0x13726121572FE2FF) /* 14 */, W64LIT(0x1A488C6F199D921E) /* 15 */, + W64LIT(0x4BC9F9F4DA0007CA) /* 16 */, W64LIT(0x26F5E6F6E85241C7) /* 17 */, + W64LIT(0x859079DBEA5947B6) /* 18 */, W64LIT(0x4F1885C5C99E8C92) /* 19 */, + W64LIT(0xD78E761EA96F864B) /* 20 */, W64LIT(0x8E36428C52B5C17D) /* 21 */, + W64LIT(0x69CF6827373063C1) /* 22 */, W64LIT(0xB607C93D9BB4C56E) /* 23 */, + W64LIT(0x7D820E760E76B5EA) /* 24 */, W64LIT(0x645C9CC6F07FDC42) /* 25 */, + W64LIT(0xBF38A078243342E0) /* 26 */, W64LIT(0x5F6B343C9D2E7D04) /* 27 */, + W64LIT(0xF2C28AEB600B0EC6) /* 28 */, W64LIT(0x6C0ED85F7254BCAC) /* 29 */, + W64LIT(0x71592281A4DB4FE5) /* 30 */, W64LIT(0x1967FA69CE0FED9F) /* 31 */, + W64LIT(0xFD5293F8B96545DB) /* 32 */, W64LIT(0xC879E9D7F2A7600B) /* 33 */, + W64LIT(0x860248920193194E) /* 34 */, W64LIT(0xA4F9533B2D9CC0B3) /* 35 */, + W64LIT(0x9053836C15957613) /* 36 */, W64LIT(0xDB6DCF8AFC357BF1) /* 37 */, + W64LIT(0x18BEEA7A7A370F57) /* 38 */, W64LIT(0x037117CA50B99066) /* 39 */, + W64LIT(0x6AB30A9774424A35) /* 40 */, W64LIT(0xF4E92F02E325249B) /* 41 */, + W64LIT(0x7739DB07061CCAE1) /* 42 */, W64LIT(0xD8F3B49CECA42A05) /* 43 */, + W64LIT(0xBD56BE3F51382F73) /* 44 */, W64LIT(0x45FAED5843B0BB28) /* 45 */, + W64LIT(0x1C813D5C11BF1F83) /* 46 */, W64LIT(0x8AF0E4B6D75FA169) /* 47 */, + W64LIT(0x33EE18A487AD9999) /* 48 */, W64LIT(0x3C26E8EAB1C94410) /* 49 */, + W64LIT(0xB510102BC0A822F9) /* 50 */, W64LIT(0x141EEF310CE6123B) /* 51 */, + W64LIT(0xFC65B90059DDB154) /* 52 */, W64LIT(0xE0158640C5E0E607) /* 53 */, + W64LIT(0x884E079826C3A3CF) /* 54 */, W64LIT(0x930D0D9523C535FD) /* 55 */, + W64LIT(0x35638D754E9A2B00) /* 56 */, W64LIT(0x4085FCCF40469DD5) /* 57 */, + W64LIT(0xC4B17AD28BE23A4C) /* 58 */, W64LIT(0xCAB2F0FC6A3E6A2E) /* 59 */, + W64LIT(0x2860971A6B943FCD) /* 60 */, W64LIT(0x3DDE6EE212E30446) /* 61 */, + W64LIT(0x6222F32AE01765AE) /* 62 */, W64LIT(0x5D550BB5478308FE) /* 63 */, + W64LIT(0xA9EFA98DA0EDA22A) /* 64 */, W64LIT(0xC351A71686C40DA7) /* 65 */, + W64LIT(0x1105586D9C867C84) /* 66 */, W64LIT(0xDCFFEE85FDA22853) /* 67 */, + W64LIT(0xCCFBD0262C5EEF76) /* 68 */, W64LIT(0xBAF294CB8990D201) /* 69 */, + W64LIT(0xE69464F52AFAD975) /* 70 */, W64LIT(0x94B013AFDF133E14) /* 71 */, + W64LIT(0x06A7D1A32823C958) /* 72 */, W64LIT(0x6F95FE5130F61119) /* 73 */, + W64LIT(0xD92AB34E462C06C0) /* 74 */, W64LIT(0xED7BDE33887C71D2) /* 75 */, + W64LIT(0x79746D6E6518393E) /* 76 */, W64LIT(0x5BA419385D713329) /* 77 */, + W64LIT(0x7C1BA6B948A97564) /* 78 */, W64LIT(0x31987C197BFDAC67) /* 79 */, + W64LIT(0xDE6C23C44B053D02) /* 80 */, W64LIT(0x581C49FED002D64D) /* 81 */, + W64LIT(0xDD474D6338261571) /* 82 */, W64LIT(0xAA4546C3E473D062) /* 83 */, + W64LIT(0x928FCE349455F860) /* 84 */, W64LIT(0x48161BBACAAB94D9) /* 85 */, + W64LIT(0x63912430770E6F68) /* 86 */, W64LIT(0x6EC8A5E602C6641C) /* 87 */, + W64LIT(0x87282515337DDD2B) /* 88 */, W64LIT(0x2CDA6B42034B701B) /* 89 */, + W64LIT(0xB03D37C181CB096D) /* 90 */, W64LIT(0xE108438266C71C6F) /* 91 */, + W64LIT(0x2B3180C7EB51B255) /* 92 */, W64LIT(0xDF92B82F96C08BBC) /* 93 */, + W64LIT(0x5C68C8C0A632F3BA) /* 94 */, W64LIT(0x5504CC861C3D0556) /* 95 */, + W64LIT(0xABBFA4E55FB26B8F) /* 96 */, W64LIT(0x41848B0AB3BACEB4) /* 97 */, + W64LIT(0xB334A273AA445D32) /* 98 */, W64LIT(0xBCA696F0A85AD881) /* 99 */, + W64LIT(0x24F6EC65B528D56C) /* 100 */, W64LIT(0x0CE1512E90F4524A) /* 101 */, + W64LIT(0x4E9DD79D5506D35A) /* 102 */, W64LIT(0x258905FAC6CE9779) /* 103 */, + W64LIT(0x2019295B3E109B33) /* 104 */, W64LIT(0xF8A9478B73A054CC) /* 105 */, + W64LIT(0x2924F2F934417EB0) /* 106 */, W64LIT(0x3993357D536D1BC4) /* 107 */, + W64LIT(0x38A81AC21DB6FF8B) /* 108 */, W64LIT(0x47C4FBF17D6016BF) /* 109 */, + W64LIT(0x1E0FAADD7667E3F5) /* 110 */, W64LIT(0x7ABCFF62938BEB96) /* 111 */, + W64LIT(0xA78DAD948FC179C9) /* 112 */, W64LIT(0x8F1F98B72911E50D) /* 113 */, + W64LIT(0x61E48EAE27121A91) /* 114 */, W64LIT(0x4D62F7AD31859808) /* 115 */, + W64LIT(0xECEBA345EF5CEAEB) /* 116 */, W64LIT(0xF5CEB25EBC9684CE) /* 117 */, + W64LIT(0xF633E20CB7F76221) /* 118 */, W64LIT(0xA32CDF06AB8293E4) /* 119 */, + W64LIT(0x985A202CA5EE2CA4) /* 120 */, W64LIT(0xCF0B8447CC8A8FB1) /* 121 */, + W64LIT(0x9F765244979859A3) /* 122 */, W64LIT(0xA8D516B1A1240017) /* 123 */, + W64LIT(0x0BD7BA3EBB5DC726) /* 124 */, W64LIT(0xE54BCA55B86ADB39) /* 125 */, + W64LIT(0x1D7A3AFD6C478063) /* 126 */, W64LIT(0x519EC608E7669EDD) /* 127 */, + W64LIT(0x0E5715A2D149AA23) /* 128 */, W64LIT(0x177D4571848FF194) /* 129 */, + W64LIT(0xEEB55F3241014C22) /* 130 */, W64LIT(0x0F5E5CA13A6E2EC2) /* 131 */, + W64LIT(0x8029927B75F5C361) /* 132 */, W64LIT(0xAD139FABC3D6E436) /* 133 */, + W64LIT(0x0D5DF1A94CCF402F) /* 134 */, W64LIT(0x3E8BD948BEA5DFC8) /* 135 */, + W64LIT(0xA5A0D357BD3FF77E) /* 136 */, W64LIT(0xA2D12E251F74F645) /* 137 */, + W64LIT(0x66FD9E525E81A082) /* 138 */, W64LIT(0x2E0C90CE7F687A49) /* 139 */, + W64LIT(0xC2E8BCBEBA973BC5) /* 140 */, W64LIT(0x000001BCE509745F) /* 141 */, + W64LIT(0x423777BBE6DAB3D6) /* 142 */, W64LIT(0xD1661C7EAEF06EB5) /* 143 */, + W64LIT(0xA1781F354DAACFD8) /* 144 */, W64LIT(0x2D11284A2B16AFFC) /* 145 */, + W64LIT(0xF1FC4F67FA891D1F) /* 146 */, W64LIT(0x73ECC25DCB920ADA) /* 147 */, + W64LIT(0xAE610C22C2A12651) /* 148 */, W64LIT(0x96E0A810D356B78A) /* 149 */, + W64LIT(0x5A9A381F2FE7870F) /* 150 */, W64LIT(0xD5AD62EDE94E5530) /* 151 */, + W64LIT(0xD225E5E8368D1427) /* 152 */, W64LIT(0x65977B70C7AF4631) /* 153 */, + W64LIT(0x99F889B2DE39D74F) /* 154 */, W64LIT(0x233F30BF54E1D143) /* 155 */, + W64LIT(0x9A9675D3D9A63C97) /* 156 */, W64LIT(0x5470554FF334F9A8) /* 157 */, + W64LIT(0x166ACB744A4F5688) /* 158 */, W64LIT(0x70C74CAAB2E4AEAD) /* 159 */, + W64LIT(0xF0D091646F294D12) /* 160 */, W64LIT(0x57B82A89684031D1) /* 161 */, + W64LIT(0xEFD95A5A61BE0B6B) /* 162 */, W64LIT(0x2FBD12E969F2F29A) /* 163 */, + W64LIT(0x9BD37013FEFF9FE8) /* 164 */, W64LIT(0x3F9B0404D6085A06) /* 165 */, + W64LIT(0x4940C1F3166CFE15) /* 166 */, W64LIT(0x09542C4DCDF3DEFB) /* 167 */, + W64LIT(0xB4C5218385CD5CE3) /* 168 */, W64LIT(0xC935B7DC4462A641) /* 169 */, + W64LIT(0x3417F8A68ED3B63F) /* 170 */, W64LIT(0xB80959295B215B40) /* 171 */, + W64LIT(0xF99CDAEF3B8C8572) /* 172 */, W64LIT(0x018C0614F8FCB95D) /* 173 */, + W64LIT(0x1B14ACCD1A3ACDF3) /* 174 */, W64LIT(0x84D471F200BB732D) /* 175 */, + W64LIT(0xC1A3110E95E8DA16) /* 176 */, W64LIT(0x430A7220BF1A82B8) /* 177 */, + W64LIT(0xB77E090D39DF210E) /* 178 */, W64LIT(0x5EF4BD9F3CD05E9D) /* 179 */, + W64LIT(0x9D4FF6DA7E57A444) /* 180 */, W64LIT(0xDA1D60E183D4A5F8) /* 181 */, + W64LIT(0xB287C38417998E47) /* 182 */, W64LIT(0xFE3EDC121BB31886) /* 183 */, + W64LIT(0xC7FE3CCC980CCBEF) /* 184 */, W64LIT(0xE46FB590189BFD03) /* 185 */, + W64LIT(0x3732FD469A4C57DC) /* 186 */, W64LIT(0x7EF700A07CF1AD65) /* 187 */, + W64LIT(0x59C64468A31D8859) /* 188 */, W64LIT(0x762FB0B4D45B61F6) /* 189 */, + W64LIT(0x155BAED099047718) /* 190 */, W64LIT(0x68755E4C3D50BAA6) /* 191 */, + W64LIT(0xE9214E7F22D8B4DF) /* 192 */, W64LIT(0x2ADDBF532EAC95F4) /* 193 */, + W64LIT(0x32AE3909B4BD0109) /* 194 */, W64LIT(0x834DF537B08E3450) /* 195 */, + W64LIT(0xFA209DA84220728D) /* 196 */, W64LIT(0x9E691D9B9EFE23F7) /* 197 */, + W64LIT(0x0446D288C4AE8D7F) /* 198 */, W64LIT(0x7B4CC524E169785B) /* 199 */, + W64LIT(0x21D87F0135CA1385) /* 200 */, W64LIT(0xCEBB400F137B8AA5) /* 201 */, + W64LIT(0x272E2B66580796BE) /* 202 */, W64LIT(0x3612264125C2B0DE) /* 203 */, + W64LIT(0x057702BDAD1EFBB2) /* 204 */, W64LIT(0xD4BABB8EACF84BE9) /* 205 */, + W64LIT(0x91583139641BC67B) /* 206 */, W64LIT(0x8BDC2DE08036E024) /* 207 */, + W64LIT(0x603C8156F49F68ED) /* 208 */, W64LIT(0xF7D236F7DBEF5111) /* 209 */, + W64LIT(0x9727C4598AD21E80) /* 210 */, W64LIT(0xA08A0896670A5FD7) /* 211 */, + W64LIT(0xCB4A8F4309EBA9CB) /* 212 */, W64LIT(0x81AF564B0F7036A1) /* 213 */, + W64LIT(0xC0B99AA778199ABD) /* 214 */, W64LIT(0x959F1EC83FC8E952) /* 215 */, + W64LIT(0x8C505077794A81B9) /* 216 */, W64LIT(0x3ACAAF8F056338F0) /* 217 */, + W64LIT(0x07B43F50627A6778) /* 218 */, W64LIT(0x4A44AB49F5ECCC77) /* 219 */, + W64LIT(0x3BC3D6E4B679EE98) /* 220 */, W64LIT(0x9CC0D4D1CF14108C) /* 221 */, + W64LIT(0x4406C00B206BC8A0) /* 222 */, W64LIT(0x82A18854C8D72D89) /* 223 */, + W64LIT(0x67E366B35C3C432C) /* 224 */, W64LIT(0xB923DD61102B37F2) /* 225 */, + W64LIT(0x56AB2779D884271D) /* 226 */, W64LIT(0xBE83E1B0FF1525AF) /* 227 */, + W64LIT(0xFB7C65D4217E49A9) /* 228 */, W64LIT(0x6BDBE0E76D48E7D4) /* 229 */, + W64LIT(0x08DF828745D9179E) /* 230 */, W64LIT(0x22EA6A9ADD53BD34) /* 231 */, + W64LIT(0xE36E141C5622200A) /* 232 */, W64LIT(0x7F805D1B8CB750EE) /* 233 */, + W64LIT(0xAFE5C7A59F58E837) /* 234 */, W64LIT(0xE27F996A4FB1C23C) /* 235 */, + W64LIT(0xD3867DFB0775F0D0) /* 236 */, W64LIT(0xD0E673DE6E88891A) /* 237 */, + W64LIT(0x123AEB9EAFB86C25) /* 238 */, W64LIT(0x30F1D5D5C145B895) /* 239 */, + W64LIT(0xBB434A2DEE7269E7) /* 240 */, W64LIT(0x78CB67ECF931FA38) /* 241 */, + W64LIT(0xF33B0372323BBF9C) /* 242 */, W64LIT(0x52D66336FB279C74) /* 243 */, + W64LIT(0x505F33AC0AFB4EAA) /* 244 */, W64LIT(0xE8A5CD99A2CCE187) /* 245 */, + W64LIT(0x534974801E2D30BB) /* 246 */, W64LIT(0x8D2D5711D5876D90) /* 247 */, + W64LIT(0x1F1A412891BC038E) /* 248 */, W64LIT(0xD6E2E71D82E56648) /* 249 */, + W64LIT(0x74036C3A497732B7) /* 250 */, W64LIT(0x89B67ED96361F5AB) /* 251 */, + W64LIT(0xFFED95D8F1EA02A2) /* 252 */, W64LIT(0xE72B3BD61464D43D) /* 253 */, + W64LIT(0xA6300F170BDC4820) /* 254 */, W64LIT(0xEBC18760ED78A77A) /* 255 */, + W64LIT(0xE6A6BE5A05A12138) /* 256 */, W64LIT(0xB5A122A5B4F87C98) /* 257 */, + W64LIT(0x563C6089140B6990) /* 258 */, W64LIT(0x4C46CB2E391F5DD5) /* 259 */, + W64LIT(0xD932ADDBC9B79434) /* 260 */, W64LIT(0x08EA70E42015AFF5) /* 261 */, + W64LIT(0xD765A6673E478CF1) /* 262 */, W64LIT(0xC4FB757EAB278D99) /* 263 */, + W64LIT(0xDF11C6862D6E0692) /* 264 */, W64LIT(0xDDEB84F10D7F3B16) /* 265 */, + W64LIT(0x6F2EF604A665EA04) /* 266 */, W64LIT(0x4A8E0F0FF0E0DFB3) /* 267 */, + W64LIT(0xA5EDEEF83DBCBA51) /* 268 */, W64LIT(0xFC4F0A2A0EA4371E) /* 269 */, + W64LIT(0xE83E1DA85CB38429) /* 270 */, W64LIT(0xDC8FF882BA1B1CE2) /* 271 */, + W64LIT(0xCD45505E8353E80D) /* 272 */, W64LIT(0x18D19A00D4DB0717) /* 273 */, + W64LIT(0x34A0CFEDA5F38101) /* 274 */, W64LIT(0x0BE77E518887CAF2) /* 275 */, + W64LIT(0x1E341438B3C45136) /* 276 */, W64LIT(0xE05797F49089CCF9) /* 277 */, + W64LIT(0xFFD23F9DF2591D14) /* 278 */, W64LIT(0x543DDA228595C5CD) /* 279 */, + W64LIT(0x661F81FD99052A33) /* 280 */, W64LIT(0x8736E641DB0F7B76) /* 281 */, + W64LIT(0x15227725418E5307) /* 282 */, W64LIT(0xE25F7F46162EB2FA) /* 283 */, + W64LIT(0x48A8B2126C13D9FE) /* 284 */, W64LIT(0xAFDC541792E76EEA) /* 285 */, + W64LIT(0x03D912BFC6D1898F) /* 286 */, W64LIT(0x31B1AAFA1B83F51B) /* 287 */, + W64LIT(0xF1AC2796E42AB7D9) /* 288 */, W64LIT(0x40A3A7D7FCD2EBAC) /* 289 */, + W64LIT(0x1056136D0AFBBCC5) /* 290 */, W64LIT(0x7889E1DD9A6D0C85) /* 291 */, + W64LIT(0xD33525782A7974AA) /* 292 */, W64LIT(0xA7E25D09078AC09B) /* 293 */, + W64LIT(0xBD4138B3EAC6EDD0) /* 294 */, W64LIT(0x920ABFBE71EB9E70) /* 295 */, + W64LIT(0xA2A5D0F54FC2625C) /* 296 */, W64LIT(0xC054E36B0B1290A3) /* 297 */, + W64LIT(0xF6DD59FF62FE932B) /* 298 */, W64LIT(0x3537354511A8AC7D) /* 299 */, + W64LIT(0xCA845E9172FADCD4) /* 300 */, W64LIT(0x84F82B60329D20DC) /* 301 */, + W64LIT(0x79C62CE1CD672F18) /* 302 */, W64LIT(0x8B09A2ADD124642C) /* 303 */, + W64LIT(0xD0C1E96A19D9E726) /* 304 */, W64LIT(0x5A786A9B4BA9500C) /* 305 */, + W64LIT(0x0E020336634C43F3) /* 306 */, W64LIT(0xC17B474AEB66D822) /* 307 */, + W64LIT(0x6A731AE3EC9BAAC2) /* 308 */, W64LIT(0x8226667AE0840258) /* 309 */, + W64LIT(0x67D4567691CAECA5) /* 310 */, W64LIT(0x1D94155C4875ADB5) /* 311 */, + W64LIT(0x6D00FD985B813FDF) /* 312 */, W64LIT(0x51286EFCB774CD06) /* 313 */, + W64LIT(0x5E8834471FA744AF) /* 314 */, W64LIT(0xF72CA0AEE761AE2E) /* 315 */, + W64LIT(0xBE40E4CDAEE8E09A) /* 316 */, W64LIT(0xE9970BBB5118F665) /* 317 */, + W64LIT(0x726E4BEB33DF1964) /* 318 */, W64LIT(0x703B000729199762) /* 319 */, + W64LIT(0x4631D816F5EF30A7) /* 320 */, W64LIT(0xB880B5B51504A6BE) /* 321 */, + W64LIT(0x641793C37ED84B6C) /* 322 */, W64LIT(0x7B21ED77F6E97D96) /* 323 */, + W64LIT(0x776306312EF96B73) /* 324 */, W64LIT(0xAE528948E86FF3F4) /* 325 */, + W64LIT(0x53DBD7F286A3F8F8) /* 326 */, W64LIT(0x16CADCE74CFC1063) /* 327 */, + W64LIT(0x005C19BDFA52C6DD) /* 328 */, W64LIT(0x68868F5D64D46AD3) /* 329 */, + W64LIT(0x3A9D512CCF1E186A) /* 330 */, W64LIT(0x367E62C2385660AE) /* 331 */, + W64LIT(0xE359E7EA77DCB1D7) /* 332 */, W64LIT(0x526C0773749ABE6E) /* 333 */, + W64LIT(0x735AE5F9D09F734B) /* 334 */, W64LIT(0x493FC7CC8A558BA8) /* 335 */, + W64LIT(0xB0B9C1533041AB45) /* 336 */, W64LIT(0x321958BA470A59BD) /* 337 */, + W64LIT(0x852DB00B5F46C393) /* 338 */, W64LIT(0x91209B2BD336B0E5) /* 339 */, + W64LIT(0x6E604F7D659EF19F) /* 340 */, W64LIT(0xB99A8AE2782CCB24) /* 341 */, + W64LIT(0xCCF52AB6C814C4C7) /* 342 */, W64LIT(0x4727D9AFBE11727B) /* 343 */, + W64LIT(0x7E950D0C0121B34D) /* 344 */, W64LIT(0x756F435670AD471F) /* 345 */, + W64LIT(0xF5ADD442615A6849) /* 346 */, W64LIT(0x4E87E09980B9957A) /* 347 */, + W64LIT(0x2ACFA1DF50AEE355) /* 348 */, W64LIT(0xD898263AFD2FD556) /* 349 */, + W64LIT(0xC8F4924DD80C8FD6) /* 350 */, W64LIT(0xCF99CA3D754A173A) /* 351 */, + W64LIT(0xFE477BACAF91BF3C) /* 352 */, W64LIT(0xED5371F6D690C12D) /* 353 */, + W64LIT(0x831A5C285E687094) /* 354 */, W64LIT(0xC5D3C90A3708A0A4) /* 355 */, + W64LIT(0x0F7F903717D06580) /* 356 */, W64LIT(0x19F9BB13B8FDF27F) /* 357 */, + W64LIT(0xB1BD6F1B4D502843) /* 358 */, W64LIT(0x1C761BA38FFF4012) /* 359 */, + W64LIT(0x0D1530C4E2E21F3B) /* 360 */, W64LIT(0x8943CE69A7372C8A) /* 361 */, + W64LIT(0xE5184E11FEB5CE66) /* 362 */, W64LIT(0x618BDB80BD736621) /* 363 */, + W64LIT(0x7D29BAD68B574D0B) /* 364 */, W64LIT(0x81BB613E25E6FE5B) /* 365 */, + W64LIT(0x071C9C10BC07913F) /* 366 */, W64LIT(0xC7BEEB7909AC2D97) /* 367 */, + W64LIT(0xC3E58D353BC5D757) /* 368 */, W64LIT(0xEB017892F38F61E8) /* 369 */, + W64LIT(0xD4EFFB9C9B1CC21A) /* 370 */, W64LIT(0x99727D26F494F7AB) /* 371 */, + W64LIT(0xA3E063A2956B3E03) /* 372 */, W64LIT(0x9D4A8B9A4AA09C30) /* 373 */, + W64LIT(0x3F6AB7D500090FB4) /* 374 */, W64LIT(0x9CC0F2A057268AC0) /* 375 */, + W64LIT(0x3DEE9D2DEDBF42D1) /* 376 */, W64LIT(0x330F49C87960A972) /* 377 */, + W64LIT(0xC6B2720287421B41) /* 378 */, W64LIT(0x0AC59EC07C00369C) /* 379 */, + W64LIT(0xEF4EAC49CB353425) /* 380 */, W64LIT(0xF450244EEF0129D8) /* 381 */, + W64LIT(0x8ACC46E5CAF4DEB6) /* 382 */, W64LIT(0x2FFEAB63989263F7) /* 383 */, + W64LIT(0x8F7CB9FE5D7A4578) /* 384 */, W64LIT(0x5BD8F7644E634635) /* 385 */, + W64LIT(0x427A7315BF2DC900) /* 386 */, W64LIT(0x17D0C4AA2125261C) /* 387 */, + W64LIT(0x3992486C93518E50) /* 388 */, W64LIT(0xB4CBFEE0A2D7D4C3) /* 389 */, + W64LIT(0x7C75D6202C5DDD8D) /* 390 */, W64LIT(0xDBC295D8E35B6C61) /* 391 */, + W64LIT(0x60B369D302032B19) /* 392 */, W64LIT(0xCE42685FDCE44132) /* 393 */, + W64LIT(0x06F3DDB9DDF65610) /* 394 */, W64LIT(0x8EA4D21DB5E148F0) /* 395 */, + W64LIT(0x20B0FCE62FCD496F) /* 396 */, W64LIT(0x2C1B912358B0EE31) /* 397 */, + W64LIT(0xB28317B818F5A308) /* 398 */, W64LIT(0xA89C1E189CA6D2CF) /* 399 */, + W64LIT(0x0C6B18576AAADBC8) /* 400 */, W64LIT(0xB65DEAA91299FAE3) /* 401 */, + W64LIT(0xFB2B794B7F1027E7) /* 402 */, W64LIT(0x04E4317F443B5BEB) /* 403 */, + W64LIT(0x4B852D325939D0A6) /* 404 */, W64LIT(0xD5AE6BEEFB207FFC) /* 405 */, + W64LIT(0x309682B281C7D374) /* 406 */, W64LIT(0xBAE309A194C3B475) /* 407 */, + W64LIT(0x8CC3F97B13B49F05) /* 408 */, W64LIT(0x98A9422FF8293967) /* 409 */, + W64LIT(0x244B16B01076FF7C) /* 410 */, W64LIT(0xF8BF571C663D67EE) /* 411 */, + W64LIT(0x1F0D6758EEE30DA1) /* 412 */, W64LIT(0xC9B611D97ADEB9B7) /* 413 */, + W64LIT(0xB7AFD5887B6C57A2) /* 414 */, W64LIT(0x6290AE846B984FE1) /* 415 */, + W64LIT(0x94DF4CDEACC1A5FD) /* 416 */, W64LIT(0x058A5BD1C5483AFF) /* 417 */, + W64LIT(0x63166CC142BA3C37) /* 418 */, W64LIT(0x8DB8526EB2F76F40) /* 419 */, + W64LIT(0xE10880036F0D6D4E) /* 420 */, W64LIT(0x9E0523C9971D311D) /* 421 */, + W64LIT(0x45EC2824CC7CD691) /* 422 */, W64LIT(0x575B8359E62382C9) /* 423 */, + W64LIT(0xFA9E400DC4889995) /* 424 */, W64LIT(0xD1823ECB45721568) /* 425 */, + W64LIT(0xDAFD983B8206082F) /* 426 */, W64LIT(0xAA7D29082386A8CB) /* 427 */, + W64LIT(0x269FCD4403B87588) /* 428 */, W64LIT(0x1B91F5F728BDD1E0) /* 429 */, + W64LIT(0xE4669F39040201F6) /* 430 */, W64LIT(0x7A1D7C218CF04ADE) /* 431 */, + W64LIT(0x65623C29D79CE5CE) /* 432 */, W64LIT(0x2368449096C00BB1) /* 433 */, + W64LIT(0xAB9BF1879DA503BA) /* 434 */, W64LIT(0xBC23ECB1A458058E) /* 435 */, + W64LIT(0x9A58DF01BB401ECC) /* 436 */, W64LIT(0xA070E868A85F143D) /* 437 */, + W64LIT(0x4FF188307DF2239E) /* 438 */, W64LIT(0x14D565B41A641183) /* 439 */, + W64LIT(0xEE13337452701602) /* 440 */, W64LIT(0x950E3DCF3F285E09) /* 441 */, + W64LIT(0x59930254B9C80953) /* 442 */, W64LIT(0x3BF299408930DA6D) /* 443 */, + W64LIT(0xA955943F53691387) /* 444 */, W64LIT(0xA15EDECAA9CB8784) /* 445 */, + W64LIT(0x29142127352BE9A0) /* 446 */, W64LIT(0x76F0371FFF4E7AFB) /* 447 */, + W64LIT(0x0239F450274F2228) /* 448 */, W64LIT(0xBB073AF01D5E868B) /* 449 */, + W64LIT(0xBFC80571C10E96C1) /* 450 */, W64LIT(0xD267088568222E23) /* 451 */, + W64LIT(0x9671A3D48E80B5B0) /* 452 */, W64LIT(0x55B5D38AE193BB81) /* 453 */, + W64LIT(0x693AE2D0A18B04B8) /* 454 */, W64LIT(0x5C48B4ECADD5335F) /* 455 */, + W64LIT(0xFD743B194916A1CA) /* 456 */, W64LIT(0x2577018134BE98C4) /* 457 */, + W64LIT(0xE77987E83C54A4AD) /* 458 */, W64LIT(0x28E11014DA33E1B9) /* 459 */, + W64LIT(0x270CC59E226AA213) /* 460 */, W64LIT(0x71495F756D1A5F60) /* 461 */, + W64LIT(0x9BE853FB60AFEF77) /* 462 */, W64LIT(0xADC786A7F7443DBF) /* 463 */, + W64LIT(0x0904456173B29A82) /* 464 */, W64LIT(0x58BC7A66C232BD5E) /* 465 */, + W64LIT(0xF306558C673AC8B2) /* 466 */, W64LIT(0x41F639C6B6C9772A) /* 467 */, + W64LIT(0x216DEFE99FDA35DA) /* 468 */, W64LIT(0x11640CC71C7BE615) /* 469 */, + W64LIT(0x93C43694565C5527) /* 470 */, W64LIT(0xEA038E6246777839) /* 471 */, + W64LIT(0xF9ABF3CE5A3E2469) /* 472 */, W64LIT(0x741E768D0FD312D2) /* 473 */, + W64LIT(0x0144B883CED652C6) /* 474 */, W64LIT(0xC20B5A5BA33F8552) /* 475 */, + W64LIT(0x1AE69633C3435A9D) /* 476 */, W64LIT(0x97A28CA4088CFDEC) /* 477 */, + W64LIT(0x8824A43C1E96F420) /* 478 */, W64LIT(0x37612FA66EEEA746) /* 479 */, + W64LIT(0x6B4CB165F9CF0E5A) /* 480 */, W64LIT(0x43AA1C06A0ABFB4A) /* 481 */, + W64LIT(0x7F4DC26FF162796B) /* 482 */, W64LIT(0x6CBACC8E54ED9B0F) /* 483 */, + W64LIT(0xA6B7FFEFD2BB253E) /* 484 */, W64LIT(0x2E25BC95B0A29D4F) /* 485 */, + W64LIT(0x86D6A58BDEF1388C) /* 486 */, W64LIT(0xDED74AC576B6F054) /* 487 */, + W64LIT(0x8030BDBC2B45805D) /* 488 */, W64LIT(0x3C81AF70E94D9289) /* 489 */, + W64LIT(0x3EFF6DDA9E3100DB) /* 490 */, W64LIT(0xB38DC39FDFCC8847) /* 491 */, + W64LIT(0x123885528D17B87E) /* 492 */, W64LIT(0xF2DA0ED240B1B642) /* 493 */, + W64LIT(0x44CEFADCD54BF9A9) /* 494 */, W64LIT(0x1312200E433C7EE6) /* 495 */, + W64LIT(0x9FFCC84F3A78C748) /* 496 */, W64LIT(0xF0CD1F72248576BB) /* 497 */, + W64LIT(0xEC6974053638CFE4) /* 498 */, W64LIT(0x2BA7B67C0CEC4E4C) /* 499 */, + W64LIT(0xAC2F4DF3E5CE32ED) /* 500 */, W64LIT(0xCB33D14326EA4C11) /* 501 */, + W64LIT(0xA4E9044CC77E58BC) /* 502 */, W64LIT(0x5F513293D934FCEF) /* 503 */, + W64LIT(0x5DC9645506E55444) /* 504 */, W64LIT(0x50DE418F317DE40A) /* 505 */, + W64LIT(0x388CB31A69DDE259) /* 506 */, W64LIT(0x2DB4A83455820A86) /* 507 */, + W64LIT(0x9010A91E84711AE9) /* 508 */, W64LIT(0x4DF7F0B7B1498371) /* 509 */, + W64LIT(0xD62A2EABC0977179) /* 510 */, W64LIT(0x22FAC097AA8D5C0E) /* 511 */, + W64LIT(0xF49FCC2FF1DAF39B) /* 512 */, W64LIT(0x487FD5C66FF29281) /* 513 */, + W64LIT(0xE8A30667FCDCA83F) /* 514 */, W64LIT(0x2C9B4BE3D2FCCE63) /* 515 */, + W64LIT(0xDA3FF74B93FBBBC2) /* 516 */, W64LIT(0x2FA165D2FE70BA66) /* 517 */, + W64LIT(0xA103E279970E93D4) /* 518 */, W64LIT(0xBECDEC77B0E45E71) /* 519 */, + W64LIT(0xCFB41E723985E497) /* 520 */, W64LIT(0xB70AAA025EF75017) /* 521 */, + W64LIT(0xD42309F03840B8E0) /* 522 */, W64LIT(0x8EFC1AD035898579) /* 523 */, + W64LIT(0x96C6920BE2B2ABC5) /* 524 */, W64LIT(0x66AF4163375A9172) /* 525 */, + W64LIT(0x2174ABDCCA7127FB) /* 526 */, W64LIT(0xB33CCEA64A72FF41) /* 527 */, + W64LIT(0xF04A4933083066A5) /* 528 */, W64LIT(0x8D970ACDD7289AF5) /* 529 */, + W64LIT(0x8F96E8E031C8C25E) /* 530 */, W64LIT(0xF3FEC02276875D47) /* 531 */, + W64LIT(0xEC7BF310056190DD) /* 532 */, W64LIT(0xF5ADB0AEBB0F1491) /* 533 */, + W64LIT(0x9B50F8850FD58892) /* 534 */, W64LIT(0x4975488358B74DE8) /* 535 */, + W64LIT(0xA3354FF691531C61) /* 536 */, W64LIT(0x0702BBE481D2C6EE) /* 537 */, + W64LIT(0x89FB24057DEDED98) /* 538 */, W64LIT(0xAC3075138596E902) /* 539 */, + W64LIT(0x1D2D3580172772ED) /* 540 */, W64LIT(0xEB738FC28E6BC30D) /* 541 */, + W64LIT(0x5854EF8F63044326) /* 542 */, W64LIT(0x9E5C52325ADD3BBE) /* 543 */, + W64LIT(0x90AA53CF325C4623) /* 544 */, W64LIT(0xC1D24D51349DD067) /* 545 */, + W64LIT(0x2051CFEEA69EA624) /* 546 */, W64LIT(0x13220F0A862E7E4F) /* 547 */, + W64LIT(0xCE39399404E04864) /* 548 */, W64LIT(0xD9C42CA47086FCB7) /* 549 */, + W64LIT(0x685AD2238A03E7CC) /* 550 */, W64LIT(0x066484B2AB2FF1DB) /* 551 */, + W64LIT(0xFE9D5D70EFBF79EC) /* 552 */, W64LIT(0x5B13B9DD9C481854) /* 553 */, + W64LIT(0x15F0D475ED1509AD) /* 554 */, W64LIT(0x0BEBCD060EC79851) /* 555 */, + W64LIT(0xD58C6791183AB7F8) /* 556 */, W64LIT(0xD1187C5052F3EEE4) /* 557 */, + W64LIT(0xC95D1192E54E82FF) /* 558 */, W64LIT(0x86EEA14CB9AC6CA2) /* 559 */, + W64LIT(0x3485BEB153677D5D) /* 560 */, W64LIT(0xDD191D781F8C492A) /* 561 */, + W64LIT(0xF60866BAA784EBF9) /* 562 */, W64LIT(0x518F643BA2D08C74) /* 563 */, + W64LIT(0x8852E956E1087C22) /* 564 */, W64LIT(0xA768CB8DC410AE8D) /* 565 */, + W64LIT(0x38047726BFEC8E1A) /* 566 */, W64LIT(0xA67738B4CD3B45AA) /* 567 */, + W64LIT(0xAD16691CEC0DDE19) /* 568 */, W64LIT(0xC6D4319380462E07) /* 569 */, + W64LIT(0xC5A5876D0BA61938) /* 570 */, W64LIT(0x16B9FA1FA58FD840) /* 571 */, + W64LIT(0x188AB1173CA74F18) /* 572 */, W64LIT(0xABDA2F98C99C021F) /* 573 */, + W64LIT(0x3E0580AB134AE816) /* 574 */, W64LIT(0x5F3B05B773645ABB) /* 575 */, + W64LIT(0x2501A2BE5575F2F6) /* 576 */, W64LIT(0x1B2F74004E7E8BA9) /* 577 */, + W64LIT(0x1CD7580371E8D953) /* 578 */, W64LIT(0x7F6ED89562764E30) /* 579 */, + W64LIT(0xB15926FF596F003D) /* 580 */, W64LIT(0x9F65293DA8C5D6B9) /* 581 */, + W64LIT(0x6ECEF04DD690F84C) /* 582 */, W64LIT(0x4782275FFF33AF88) /* 583 */, + W64LIT(0xE41433083F820801) /* 584 */, W64LIT(0xFD0DFE409A1AF9B5) /* 585 */, + W64LIT(0x4325A3342CDB396B) /* 586 */, W64LIT(0x8AE77E62B301B252) /* 587 */, + W64LIT(0xC36F9E9F6655615A) /* 588 */, W64LIT(0x85455A2D92D32C09) /* 589 */, + W64LIT(0xF2C7DEA949477485) /* 590 */, W64LIT(0x63CFB4C133A39EBA) /* 591 */, + W64LIT(0x83B040CC6EBC5462) /* 592 */, W64LIT(0x3B9454C8FDB326B0) /* 593 */, + W64LIT(0x56F56A9E87FFD78C) /* 594 */, W64LIT(0x2DC2940D99F42BC6) /* 595 */, + W64LIT(0x98F7DF096B096E2D) /* 596 */, W64LIT(0x19A6E01E3AD852BF) /* 597 */, + W64LIT(0x42A99CCBDBD4B40B) /* 598 */, W64LIT(0xA59998AF45E9C559) /* 599 */, + W64LIT(0x366295E807D93186) /* 600 */, W64LIT(0x6B48181BFAA1F773) /* 601 */, + W64LIT(0x1FEC57E2157A0A1D) /* 602 */, W64LIT(0x4667446AF6201AD5) /* 603 */, + W64LIT(0xE615EBCACFB0F075) /* 604 */, W64LIT(0xB8F31F4F68290778) /* 605 */, + W64LIT(0x22713ED6CE22D11E) /* 606 */, W64LIT(0x3057C1A72EC3C93B) /* 607 */, + W64LIT(0xCB46ACC37C3F1F2F) /* 608 */, W64LIT(0xDBB893FD02AAF50E) /* 609 */, + W64LIT(0x331FD92E600B9FCF) /* 610 */, W64LIT(0xA498F96148EA3AD6) /* 611 */, + W64LIT(0xA8D8426E8B6A83EA) /* 612 */, W64LIT(0xA089B274B7735CDC) /* 613 */, + W64LIT(0x87F6B3731E524A11) /* 614 */, W64LIT(0x118808E5CBC96749) /* 615 */, + W64LIT(0x9906E4C7B19BD394) /* 616 */, W64LIT(0xAFED7F7E9B24A20C) /* 617 */, + W64LIT(0x6509EADEEB3644A7) /* 618 */, W64LIT(0x6C1EF1D3E8EF0EDE) /* 619 */, + W64LIT(0xB9C97D43E9798FB4) /* 620 */, W64LIT(0xA2F2D784740C28A3) /* 621 */, + W64LIT(0x7B8496476197566F) /* 622 */, W64LIT(0x7A5BE3E6B65F069D) /* 623 */, + W64LIT(0xF96330ED78BE6F10) /* 624 */, W64LIT(0xEEE60DE77A076A15) /* 625 */, + W64LIT(0x2B4BEE4AA08B9BD0) /* 626 */, W64LIT(0x6A56A63EC7B8894E) /* 627 */, + W64LIT(0x02121359BA34FEF4) /* 628 */, W64LIT(0x4CBF99F8283703FC) /* 629 */, + W64LIT(0x398071350CAF30C8) /* 630 */, W64LIT(0xD0A77A89F017687A) /* 631 */, + W64LIT(0xF1C1A9EB9E423569) /* 632 */, W64LIT(0x8C7976282DEE8199) /* 633 */, + W64LIT(0x5D1737A5DD1F7ABD) /* 634 */, W64LIT(0x4F53433C09A9FA80) /* 635 */, + W64LIT(0xFA8B0C53DF7CA1D9) /* 636 */, W64LIT(0x3FD9DCBC886CCB77) /* 637 */, + W64LIT(0xC040917CA91B4720) /* 638 */, W64LIT(0x7DD00142F9D1DCDF) /* 639 */, + W64LIT(0x8476FC1D4F387B58) /* 640 */, W64LIT(0x23F8E7C5F3316503) /* 641 */, + W64LIT(0x032A2244E7E37339) /* 642 */, W64LIT(0x5C87A5D750F5A74B) /* 643 */, + W64LIT(0x082B4CC43698992E) /* 644 */, W64LIT(0xDF917BECB858F63C) /* 645 */, + W64LIT(0x3270B8FC5BF86DDA) /* 646 */, W64LIT(0x10AE72BB29B5DD76) /* 647 */, + W64LIT(0x576AC94E7700362B) /* 648 */, W64LIT(0x1AD112DAC61EFB8F) /* 649 */, + W64LIT(0x691BC30EC5FAA427) /* 650 */, W64LIT(0xFF246311CC327143) /* 651 */, + W64LIT(0x3142368E30E53206) /* 652 */, W64LIT(0x71380E31E02CA396) /* 653 */, + W64LIT(0x958D5C960AAD76F1) /* 654 */, W64LIT(0xF8D6F430C16DA536) /* 655 */, + W64LIT(0xC8FFD13F1BE7E1D2) /* 656 */, W64LIT(0x7578AE66004DDBE1) /* 657 */, + W64LIT(0x05833F01067BE646) /* 658 */, W64LIT(0xBB34B5AD3BFE586D) /* 659 */, + W64LIT(0x095F34C9A12B97F0) /* 660 */, W64LIT(0x247AB64525D60CA8) /* 661 */, + W64LIT(0xDCDBC6F3017477D1) /* 662 */, W64LIT(0x4A2E14D4DECAD24D) /* 663 */, + W64LIT(0xBDB5E6D9BE0A1EEB) /* 664 */, W64LIT(0x2A7E70F7794301AB) /* 665 */, + W64LIT(0xDEF42D8A270540FD) /* 666 */, W64LIT(0x01078EC0A34C22C1) /* 667 */, + W64LIT(0xE5DE511AF4C16387) /* 668 */, W64LIT(0x7EBB3A52BD9A330A) /* 669 */, + W64LIT(0x77697857AA7D6435) /* 670 */, W64LIT(0x004E831603AE4C32) /* 671 */, + W64LIT(0xE7A21020AD78E312) /* 672 */, W64LIT(0x9D41A70C6AB420F2) /* 673 */, + W64LIT(0x28E06C18EA1141E6) /* 674 */, W64LIT(0xD2B28CBD984F6B28) /* 675 */, + W64LIT(0x26B75F6C446E9D83) /* 676 */, W64LIT(0xBA47568C4D418D7F) /* 677 */, + W64LIT(0xD80BADBFE6183D8E) /* 678 */, W64LIT(0x0E206D7F5F166044) /* 679 */, + W64LIT(0xE258A43911CBCA3E) /* 680 */, W64LIT(0x723A1746B21DC0BC) /* 681 */, + W64LIT(0xC7CAA854F5D7CDD3) /* 682 */, W64LIT(0x7CAC32883D261D9C) /* 683 */, + W64LIT(0x7690C26423BA942C) /* 684 */, W64LIT(0x17E55524478042B8) /* 685 */, + W64LIT(0xE0BE477656A2389F) /* 686 */, W64LIT(0x4D289B5E67AB2DA0) /* 687 */, + W64LIT(0x44862B9C8FBBFD31) /* 688 */, W64LIT(0xB47CC8049D141365) /* 689 */, + W64LIT(0x822C1B362B91C793) /* 690 */, W64LIT(0x4EB14655FB13DFD8) /* 691 */, + W64LIT(0x1ECBBA0714E2A97B) /* 692 */, W64LIT(0x6143459D5CDE5F14) /* 693 */, + W64LIT(0x53A8FBF1D5F0AC89) /* 694 */, W64LIT(0x97EA04D81C5E5B00) /* 695 */, + W64LIT(0x622181A8D4FDB3F3) /* 696 */, W64LIT(0xE9BCD341572A1208) /* 697 */, + W64LIT(0x1411258643CCE58A) /* 698 */, W64LIT(0x9144C5FEA4C6E0A4) /* 699 */, + W64LIT(0x0D33D06565CF620F) /* 700 */, W64LIT(0x54A48D489F219CA1) /* 701 */, + W64LIT(0xC43E5EAC6D63C821) /* 702 */, W64LIT(0xA9728B3A72770DAF) /* 703 */, + W64LIT(0xD7934E7B20DF87EF) /* 704 */, W64LIT(0xE35503B61A3E86E5) /* 705 */, + W64LIT(0xCAE321FBC819D504) /* 706 */, W64LIT(0x129A50B3AC60BFA6) /* 707 */, + W64LIT(0xCD5E68EA7E9FB6C3) /* 708 */, W64LIT(0xB01C90199483B1C7) /* 709 */, + W64LIT(0x3DE93CD5C295376C) /* 710 */, W64LIT(0xAED52EDF2AB9AD13) /* 711 */, + W64LIT(0x2E60F512C0A07884) /* 712 */, W64LIT(0xBC3D86A3E36210C9) /* 713 */, + W64LIT(0x35269D9B163951CE) /* 714 */, W64LIT(0x0C7D6E2AD0CDB5FA) /* 715 */, + W64LIT(0x59E86297D87F5733) /* 716 */, W64LIT(0x298EF221898DB0E7) /* 717 */, + W64LIT(0x55000029D1A5AA7E) /* 718 */, W64LIT(0x8BC08AE1B5061B45) /* 719 */, + W64LIT(0xC2C31C2B6C92703A) /* 720 */, W64LIT(0x94CC596BAF25EF42) /* 721 */, + W64LIT(0x0A1D73DB22540456) /* 722 */, W64LIT(0x04B6A0F9D9C4179A) /* 723 */, + W64LIT(0xEFFDAFA2AE3D3C60) /* 724 */, W64LIT(0xF7C8075BB49496C4) /* 725 */, + W64LIT(0x9CC5C7141D1CD4E3) /* 726 */, W64LIT(0x78BD1638218E5534) /* 727 */, + W64LIT(0xB2F11568F850246A) /* 728 */, W64LIT(0xEDFABCFA9502BC29) /* 729 */, + W64LIT(0x796CE5F2DA23051B) /* 730 */, W64LIT(0xAAE128B0DC93537C) /* 731 */, + W64LIT(0x3A493DA0EE4B29AE) /* 732 */, W64LIT(0xB5DF6B2C416895D7) /* 733 */, + W64LIT(0xFCABBD25122D7F37) /* 734 */, W64LIT(0x70810B58105DC4B1) /* 735 */, + W64LIT(0xE10FDD37F7882A90) /* 736 */, W64LIT(0x524DCAB5518A3F5C) /* 737 */, + W64LIT(0x3C9E85878451255B) /* 738 */, W64LIT(0x4029828119BD34E2) /* 739 */, + W64LIT(0x74A05B6F5D3CECCB) /* 740 */, W64LIT(0xB610021542E13ECA) /* 741 */, + W64LIT(0x0FF979D12F59E2AC) /* 742 */, W64LIT(0x6037DA27E4F9CC50) /* 743 */, + W64LIT(0x5E92975A0DF1847D) /* 744 */, W64LIT(0xD66DE190D3E623FE) /* 745 */, + W64LIT(0x5032D6B87B568048) /* 746 */, W64LIT(0x9A36B7CE8235216E) /* 747 */, + W64LIT(0x80272A7A24F64B4A) /* 748 */, W64LIT(0x93EFED8B8C6916F7) /* 749 */, + W64LIT(0x37DDBFF44CCE1555) /* 750 */, W64LIT(0x4B95DB5D4B99BD25) /* 751 */, + W64LIT(0x92D3FDA169812FC0) /* 752 */, W64LIT(0xFB1A4A9A90660BB6) /* 753 */, + W64LIT(0x730C196946A4B9B2) /* 754 */, W64LIT(0x81E289AA7F49DA68) /* 755 */, + W64LIT(0x64669A0F83B1A05F) /* 756 */, W64LIT(0x27B3FF7D9644F48B) /* 757 */, + W64LIT(0xCC6B615C8DB675B3) /* 758 */, W64LIT(0x674F20B9BCEBBE95) /* 759 */, + W64LIT(0x6F31238275655982) /* 760 */, W64LIT(0x5AE488713E45CF05) /* 761 */, + W64LIT(0xBF619F9954C21157) /* 762 */, W64LIT(0xEABAC46040A8EAE9) /* 763 */, + W64LIT(0x454C6FE9F2C0C1CD) /* 764 */, W64LIT(0x419CF6496412691C) /* 765 */, + W64LIT(0xD3DC3BEF265B0F70) /* 766 */, W64LIT(0x6D0E60F5C3578A9E) /* 767 */, + W64LIT(0x5B0E608526323C55) /* 768 */, W64LIT(0x1A46C1A9FA1B59F5) /* 769 */, + W64LIT(0xA9E245A17C4C8FFA) /* 770 */, W64LIT(0x65CA5159DB2955D7) /* 771 */, + W64LIT(0x05DB0A76CE35AFC2) /* 772 */, W64LIT(0x81EAC77EA9113D45) /* 773 */, + W64LIT(0x528EF88AB6AC0A0D) /* 774 */, W64LIT(0xA09EA253597BE3FF) /* 775 */, + W64LIT(0x430DDFB3AC48CD56) /* 776 */, W64LIT(0xC4B3A67AF45CE46F) /* 777 */, + W64LIT(0x4ECECFD8FBE2D05E) /* 778 */, W64LIT(0x3EF56F10B39935F0) /* 779 */, + W64LIT(0x0B22D6829CD619C6) /* 780 */, W64LIT(0x17FD460A74DF2069) /* 781 */, + W64LIT(0x6CF8CC8E8510ED40) /* 782 */, W64LIT(0xD6C824BF3A6ECAA7) /* 783 */, + W64LIT(0x61243D581A817049) /* 784 */, W64LIT(0x048BACB6BBC163A2) /* 785 */, + W64LIT(0xD9A38AC27D44CC32) /* 786 */, W64LIT(0x7FDDFF5BAAF410AB) /* 787 */, + W64LIT(0xAD6D495AA804824B) /* 788 */, W64LIT(0xE1A6A74F2D8C9F94) /* 789 */, + W64LIT(0xD4F7851235DEE8E3) /* 790 */, W64LIT(0xFD4B7F886540D893) /* 791 */, + W64LIT(0x247C20042AA4BFDA) /* 792 */, W64LIT(0x096EA1C517D1327C) /* 793 */, + W64LIT(0xD56966B4361A6685) /* 794 */, W64LIT(0x277DA5C31221057D) /* 795 */, + W64LIT(0x94D59893A43ACFF7) /* 796 */, W64LIT(0x64F0C51CCDC02281) /* 797 */, + W64LIT(0x3D33BCC4FF6189DB) /* 798 */, W64LIT(0xE005CB184CE66AF1) /* 799 */, + W64LIT(0xFF5CCD1D1DB99BEA) /* 800 */, W64LIT(0xB0B854A7FE42980F) /* 801 */, + W64LIT(0x7BD46A6A718D4B9F) /* 802 */, W64LIT(0xD10FA8CC22A5FD8C) /* 803 */, + W64LIT(0xD31484952BE4BD31) /* 804 */, W64LIT(0xC7FA975FCB243847) /* 805 */, + W64LIT(0x4886ED1E5846C407) /* 806 */, W64LIT(0x28CDDB791EB70B04) /* 807 */, + W64LIT(0xC2B00BE2F573417F) /* 808 */, W64LIT(0x5C9590452180F877) /* 809 */, + W64LIT(0x7A6BDDFFF370EB00) /* 810 */, W64LIT(0xCE509E38D6D9D6A4) /* 811 */, + W64LIT(0xEBEB0F00647FA702) /* 812 */, W64LIT(0x1DCC06CF76606F06) /* 813 */, + W64LIT(0xE4D9F28BA286FF0A) /* 814 */, W64LIT(0xD85A305DC918C262) /* 815 */, + W64LIT(0x475B1D8732225F54) /* 816 */, W64LIT(0x2D4FB51668CCB5FE) /* 817 */, + W64LIT(0xA679B9D9D72BBA20) /* 818 */, W64LIT(0x53841C0D912D43A5) /* 819 */, + W64LIT(0x3B7EAA48BF12A4E8) /* 820 */, W64LIT(0x781E0E47F22F1DDF) /* 821 */, + W64LIT(0xEFF20CE60AB50973) /* 822 */, W64LIT(0x20D261D19DFFB742) /* 823 */, + W64LIT(0x16A12B03062A2E39) /* 824 */, W64LIT(0x1960EB2239650495) /* 825 */, + W64LIT(0x251C16FED50EB8B8) /* 826 */, W64LIT(0x9AC0C330F826016E) /* 827 */, + W64LIT(0xED152665953E7671) /* 828 */, W64LIT(0x02D63194A6369570) /* 829 */, + W64LIT(0x5074F08394B1C987) /* 830 */, W64LIT(0x70BA598C90B25CE1) /* 831 */, + W64LIT(0x794A15810B9742F6) /* 832 */, W64LIT(0x0D5925E9FCAF8C6C) /* 833 */, + W64LIT(0x3067716CD868744E) /* 834 */, W64LIT(0x910AB077E8D7731B) /* 835 */, + W64LIT(0x6A61BBDB5AC42F61) /* 836 */, W64LIT(0x93513EFBF0851567) /* 837 */, + W64LIT(0xF494724B9E83E9D5) /* 838 */, W64LIT(0xE887E1985C09648D) /* 839 */, + W64LIT(0x34B1D3C675370CFD) /* 840 */, W64LIT(0xDC35E433BC0D255D) /* 841 */, + W64LIT(0xD0AAB84234131BE0) /* 842 */, W64LIT(0x08042A50B48B7EAF) /* 843 */, + W64LIT(0x9997C4EE44A3AB35) /* 844 */, W64LIT(0x829A7B49201799D0) /* 845 */, + W64LIT(0x263B8307B7C54441) /* 846 */, W64LIT(0x752F95F4FD6A6CA6) /* 847 */, + W64LIT(0x927217402C08C6E5) /* 848 */, W64LIT(0x2A8AB754A795D9EE) /* 849 */, + W64LIT(0xA442F7552F72943D) /* 850 */, W64LIT(0x2C31334E19781208) /* 851 */, + W64LIT(0x4FA98D7CEAEE6291) /* 852 */, W64LIT(0x55C3862F665DB309) /* 853 */, + W64LIT(0xBD0610175D53B1F3) /* 854 */, W64LIT(0x46FE6CB840413F27) /* 855 */, + W64LIT(0x3FE03792DF0CFA59) /* 856 */, W64LIT(0xCFE700372EB85E8F) /* 857 */, + W64LIT(0xA7BE29E7ADBCE118) /* 858 */, W64LIT(0xE544EE5CDE8431DD) /* 859 */, + W64LIT(0x8A781B1B41F1873E) /* 860 */, W64LIT(0xA5C94C78A0D2F0E7) /* 861 */, + W64LIT(0x39412E2877B60728) /* 862 */, W64LIT(0xA1265EF3AFC9A62C) /* 863 */, + W64LIT(0xBCC2770C6A2506C5) /* 864 */, W64LIT(0x3AB66DD5DCE1CE12) /* 865 */, + W64LIT(0xE65499D04A675B37) /* 866 */, W64LIT(0x7D8F523481BFD216) /* 867 */, + W64LIT(0x0F6F64FCEC15F389) /* 868 */, W64LIT(0x74EFBE618B5B13C8) /* 869 */, + W64LIT(0xACDC82B714273E1D) /* 870 */, W64LIT(0xDD40BFE003199D17) /* 871 */, + W64LIT(0x37E99257E7E061F8) /* 872 */, W64LIT(0xFA52626904775AAA) /* 873 */, + W64LIT(0x8BBBF63A463D56F9) /* 874 */, W64LIT(0xF0013F1543A26E64) /* 875 */, + W64LIT(0xA8307E9F879EC898) /* 876 */, W64LIT(0xCC4C27A4150177CC) /* 877 */, + W64LIT(0x1B432F2CCA1D3348) /* 878 */, W64LIT(0xDE1D1F8F9F6FA013) /* 879 */, + W64LIT(0x606602A047A7DDD6) /* 880 */, W64LIT(0xD237AB64CC1CB2C7) /* 881 */, + W64LIT(0x9B938E7225FCD1D3) /* 882 */, W64LIT(0xEC4E03708E0FF476) /* 883 */, + W64LIT(0xFEB2FBDA3D03C12D) /* 884 */, W64LIT(0xAE0BCED2EE43889A) /* 885 */, + W64LIT(0x22CB8923EBFB4F43) /* 886 */, W64LIT(0x69360D013CF7396D) /* 887 */, + W64LIT(0x855E3602D2D4E022) /* 888 */, W64LIT(0x073805BAD01F784C) /* 889 */, + W64LIT(0x33E17A133852F546) /* 890 */, W64LIT(0xDF4874058AC7B638) /* 891 */, + W64LIT(0xBA92B29C678AA14A) /* 892 */, W64LIT(0x0CE89FC76CFAADCD) /* 893 */, + W64LIT(0x5F9D4E0908339E34) /* 894 */, W64LIT(0xF1AFE9291F5923B9) /* 895 */, + W64LIT(0x6E3480F60F4A265F) /* 896 */, W64LIT(0xEEBF3A2AB29B841C) /* 897 */, + W64LIT(0xE21938A88F91B4AD) /* 898 */, W64LIT(0x57DFEFF845C6D3C3) /* 899 */, + W64LIT(0x2F006B0BF62CAAF2) /* 900 */, W64LIT(0x62F479EF6F75EE78) /* 901 */, + W64LIT(0x11A55AD41C8916A9) /* 902 */, W64LIT(0xF229D29084FED453) /* 903 */, + W64LIT(0x42F1C27B16B000E6) /* 904 */, W64LIT(0x2B1F76749823C074) /* 905 */, + W64LIT(0x4B76ECA3C2745360) /* 906 */, W64LIT(0x8C98F463B91691BD) /* 907 */, + W64LIT(0x14BCC93CF1ADE66A) /* 908 */, W64LIT(0x8885213E6D458397) /* 909 */, + W64LIT(0x8E177DF0274D4711) /* 910 */, W64LIT(0xB49B73B5503F2951) /* 911 */, + W64LIT(0x10168168C3F96B6B) /* 912 */, W64LIT(0x0E3D963B63CAB0AE) /* 913 */, + W64LIT(0x8DFC4B5655A1DB14) /* 914 */, W64LIT(0xF789F1356E14DE5C) /* 915 */, + W64LIT(0x683E68AF4E51DAC1) /* 916 */, W64LIT(0xC9A84F9D8D4B0FD9) /* 917 */, + W64LIT(0x3691E03F52A0F9D1) /* 918 */, W64LIT(0x5ED86E46E1878E80) /* 919 */, + W64LIT(0x3C711A0E99D07150) /* 920 */, W64LIT(0x5A0865B20C4E9310) /* 921 */, + W64LIT(0x56FBFC1FE4F0682E) /* 922 */, W64LIT(0xEA8D5DE3105EDF9B) /* 923 */, + W64LIT(0x71ABFDB12379187A) /* 924 */, W64LIT(0x2EB99DE1BEE77B9C) /* 925 */, + W64LIT(0x21ECC0EA33CF4523) /* 926 */, W64LIT(0x59A4D7521805C7A1) /* 927 */, + W64LIT(0x3896F5EB56AE7C72) /* 928 */, W64LIT(0xAA638F3DB18F75DC) /* 929 */, + W64LIT(0x9F39358DABE9808E) /* 930 */, W64LIT(0xB7DEFA91C00B72AC) /* 931 */, + W64LIT(0x6B5541FD62492D92) /* 932 */, W64LIT(0x6DC6DEE8F92E4D5B) /* 933 */, + W64LIT(0x353F57ABC4BEEA7E) /* 934 */, W64LIT(0x735769D6DA5690CE) /* 935 */, + W64LIT(0x0A234AA642391484) /* 936 */, W64LIT(0xF6F9508028F80D9D) /* 937 */, + W64LIT(0xB8E319A27AB3F215) /* 938 */, W64LIT(0x31AD9C1151341A4D) /* 939 */, + W64LIT(0x773C22A57BEF5805) /* 940 */, W64LIT(0x45C7561A07968633) /* 941 */, + W64LIT(0xF913DA9E249DBE36) /* 942 */, W64LIT(0xDA652D9B78A64C68) /* 943 */, + W64LIT(0x4C27A97F3BC334EF) /* 944 */, W64LIT(0x76621220E66B17F4) /* 945 */, + W64LIT(0x967743899ACD7D0B) /* 946 */, W64LIT(0xF3EE5BCAE0ED6782) /* 947 */, + W64LIT(0x409F753600C879FC) /* 948 */, W64LIT(0x06D09A39B5926DB6) /* 949 */, + W64LIT(0x6F83AEB0317AC588) /* 950 */, W64LIT(0x01E6CA4A86381F21) /* 951 */, + W64LIT(0x66FF3462D19F3025) /* 952 */, W64LIT(0x72207C24DDFD3BFB) /* 953 */, + W64LIT(0x4AF6B6D3E2ECE2EB) /* 954 */, W64LIT(0x9C994DBEC7EA08DE) /* 955 */, + W64LIT(0x49ACE597B09A8BC4) /* 956 */, W64LIT(0xB38C4766CF0797BA) /* 957 */, + W64LIT(0x131B9373C57C2A75) /* 958 */, W64LIT(0xB1822CCE61931E58) /* 959 */, + W64LIT(0x9D7555B909BA1C0C) /* 960 */, W64LIT(0x127FAFDD937D11D2) /* 961 */, + W64LIT(0x29DA3BADC66D92E4) /* 962 */, W64LIT(0xA2C1D57154C2ECBC) /* 963 */, + W64LIT(0x58C5134D82F6FE24) /* 964 */, W64LIT(0x1C3AE3515B62274F) /* 965 */, + W64LIT(0xE907C82E01CB8126) /* 966 */, W64LIT(0xF8ED091913E37FCB) /* 967 */, + W64LIT(0x3249D8F9C80046C9) /* 968 */, W64LIT(0x80CF9BEDE388FB63) /* 969 */, + W64LIT(0x1881539A116CF19E) /* 970 */, W64LIT(0x5103F3F76BD52457) /* 971 */, + W64LIT(0x15B7E6F5AE47F7A8) /* 972 */, W64LIT(0xDBD7C6DED47E9CCF) /* 973 */, + W64LIT(0x44E55C410228BB1A) /* 974 */, W64LIT(0xB647D4255EDB4E99) /* 975 */, + W64LIT(0x5D11882BB8AAFC30) /* 976 */, W64LIT(0xF5098BBB29D3212A) /* 977 */, + W64LIT(0x8FB5EA14E90296B3) /* 978 */, W64LIT(0x677B942157DD025A) /* 979 */, + W64LIT(0xFB58E7C0A390ACB5) /* 980 */, W64LIT(0x89D3674C83BD4A01) /* 981 */, + W64LIT(0x9E2DA4DF4BF3B93B) /* 982 */, W64LIT(0xFCC41E328CAB4829) /* 983 */, + W64LIT(0x03F38C96BA582C52) /* 984 */, W64LIT(0xCAD1BDBD7FD85DB2) /* 985 */, + W64LIT(0xBBB442C16082AE83) /* 986 */, W64LIT(0xB95FE86BA5DA9AB0) /* 987 */, + W64LIT(0xB22E04673771A93F) /* 988 */, W64LIT(0x845358C9493152D8) /* 989 */, + W64LIT(0xBE2A488697B4541E) /* 990 */, W64LIT(0x95A2DC2DD38E6966) /* 991 */, + W64LIT(0xC02C11AC923C852B) /* 992 */, W64LIT(0x2388B1990DF2A87B) /* 993 */, + W64LIT(0x7C8008FA1B4F37BE) /* 994 */, W64LIT(0x1F70D0C84D54E503) /* 995 */, + W64LIT(0x5490ADEC7ECE57D4) /* 996 */, W64LIT(0x002B3C27D9063A3A) /* 997 */, + W64LIT(0x7EAEA3848030A2BF) /* 998 */, W64LIT(0xC602326DED2003C0) /* 999 */, + W64LIT(0x83A7287D69A94086) /* 1000 */, W64LIT(0xC57A5FCB30F57A8A) /* 1001 */, + W64LIT(0xB56844E479EBE779) /* 1002 */, W64LIT(0xA373B40F05DCBCE9) /* 1003 */, + W64LIT(0xD71A786E88570EE2) /* 1004 */, W64LIT(0x879CBACDBDE8F6A0) /* 1005 */, + W64LIT(0x976AD1BCC164A32F) /* 1006 */, W64LIT(0xAB21E25E9666D78B) /* 1007 */, + W64LIT(0x901063AAE5E5C33C) /* 1008 */, W64LIT(0x9818B34448698D90) /* 1009 */, + W64LIT(0xE36487AE3E1E8ABB) /* 1010 */, W64LIT(0xAFBDF931893BDCB4) /* 1011 */, + W64LIT(0x6345A0DC5FBBD519) /* 1012 */, W64LIT(0x8628FE269B9465CA) /* 1013 */, + W64LIT(0x1E5D01603F9C51EC) /* 1014 */, W64LIT(0x4DE44006A15049B7) /* 1015 */, + W64LIT(0xBF6C70E5F776CBB1) /* 1016 */, W64LIT(0x411218F2EF552BED) /* 1017 */, + W64LIT(0xCB0C0708705A36A3) /* 1018 */, W64LIT(0xE74D14754F986044) /* 1019 */, + W64LIT(0xCD56D9430EA8280E) /* 1020 */, W64LIT(0xC12591D7535F5065) /* 1021 */, + W64LIT(0xC83223F1720AEF96) /* 1022 */, W64LIT(0xC3A0396F7363A51F) /* 1023 */, + W64LIT(0xffffffffffffffff), + W64LIT(0xA5A5A5A5A5A5A5A5), + W64LIT(0x0123456789ABCDEF), +}; + +NAMESPACE_END diff --git a/cryptopp/trdlocal.cpp b/cryptopp/trdlocal.cpp new file mode 100644 index 0000000..6d6b822 --- /dev/null +++ b/cryptopp/trdlocal.cpp @@ -0,0 +1,73 @@ +// trdlocal.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#ifndef CRYPTOPP_IMPORTS +#ifdef THREADS_AVAILABLE + +#include "trdlocal.h" + +#ifdef HAS_WINTHREADS +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +ThreadLocalStorage::Err::Err(const std::string& operation, int error) + : OS_Error(OTHER_ERROR, "ThreadLocalStorage: " + operation + " operation failed with error 0x" + IntToString(error, 16), operation, error) +{ +} + +ThreadLocalStorage::ThreadLocalStorage() +{ +#ifdef HAS_WINTHREADS + m_index = TlsAlloc(); + if (m_index == TLS_OUT_OF_INDEXES) + throw Err("TlsAlloc", GetLastError()); +#else + int error = pthread_key_create(&m_index, NULL); + if (error) + throw Err("pthread_key_create", error); +#endif +} + +ThreadLocalStorage::~ThreadLocalStorage() +{ +#ifdef HAS_WINTHREADS + if (!TlsFree(m_index)) + throw Err("TlsFree", GetLastError()); +#else + int error = pthread_key_delete(m_index); + if (error) + throw Err("pthread_key_delete", error); +#endif +} + +void ThreadLocalStorage::SetValue(void *value) +{ +#ifdef HAS_WINTHREADS + if (!TlsSetValue(m_index, value)) + throw Err("TlsSetValue", GetLastError()); +#else + int error = pthread_setspecific(m_index, value); + if (error) + throw Err("pthread_key_getspecific", error); +#endif +} + +void *ThreadLocalStorage::GetValue() const +{ +#ifdef HAS_WINTHREADS + void *result = TlsGetValue(m_index); + if (!result && GetLastError() != NO_ERROR) + throw Err("TlsGetValue", GetLastError()); +#else + void *result = pthread_getspecific(m_index); +#endif + return result; +} + +NAMESPACE_END + +#endif // #ifdef THREADS_AVAILABLE +#endif diff --git a/cryptopp/trdlocal.h b/cryptopp/trdlocal.h new file mode 100644 index 0000000..92d244a --- /dev/null +++ b/cryptopp/trdlocal.h @@ -0,0 +1,44 @@ +#ifndef CRYPTOPP_TRDLOCAL_H +#define CRYPTOPP_TRDLOCAL_H + +#include "config.h" + +#ifdef THREADS_AVAILABLE + +#include "misc.h" + +#ifdef HAS_WINTHREADS +typedef unsigned long ThreadLocalIndexType; +#else +#include +typedef pthread_key_t ThreadLocalIndexType; +#endif + +NAMESPACE_BEGIN(CryptoPP) + +//! thread local storage +class CRYPTOPP_DLL ThreadLocalStorage : public NotCopyable +{ +public: + //! exception thrown by ThreadLocalStorage class + class Err : public OS_Error + { + public: + Err(const std::string& operation, int error); + }; + + ThreadLocalStorage(); + ~ThreadLocalStorage(); + + void SetValue(void *value); + void *GetValue() const; + +private: + ThreadLocalIndexType m_index; +}; + +NAMESPACE_END + +#endif // #ifdef THREADS_AVAILABLE + +#endif diff --git a/cryptopp/trunhash.h b/cryptopp/trunhash.h new file mode 100644 index 0000000..c1c4e9b --- /dev/null +++ b/cryptopp/trunhash.h @@ -0,0 +1,48 @@ +#ifndef CRYPTOPP_TRUNHASH_H +#define CRYPTOPP_TRUNHASH_H + +#include "cryptlib.h" + +NAMESPACE_BEGIN(CryptoPP) + +class NullHash : public HashTransformation +{ +public: + void Update(const byte *input, size_t length) {} + unsigned int DigestSize() const {return 0;} + void TruncatedFinal(byte *digest, size_t digestSize) {} + bool TruncatedVerify(const byte *digest, size_t digestLength) {return true;} +}; + +//! construct new HashModule with smaller DigestSize() from existing one +template +class TruncatedHashTemplate : public HashTransformation +{ +public: + TruncatedHashTemplate(T hm, unsigned int digestSize) + : m_hm(hm), m_digestSize(digestSize) {} + TruncatedHashTemplate(const byte *key, size_t keyLength, unsigned int digestSize) + : m_hm(key, keyLength), m_digestSize(digestSize) {} + TruncatedHashTemplate(size_t digestSize) + : m_digestSize(digestSize) {} + + void Restart() + {m_hm.Restart();} + void Update(const byte *input, size_t length) + {m_hm.Update(input, length);} + unsigned int DigestSize() const {return m_digestSize;} + void TruncatedFinal(byte *digest, size_t digestSize) + {m_hm.TruncatedFinal(digest, digestSize);} + bool TruncatedVerify(const byte *digest, size_t digestLength) + {return m_hm.TruncatedVerify(digest, digestLength);} + +private: + T m_hm; + unsigned int m_digestSize; +}; + +typedef TruncatedHashTemplate TruncatedHashModule; + +NAMESPACE_END + +#endif diff --git a/cryptopp/ttmac.cpp b/cryptopp/ttmac.cpp new file mode 100644 index 0000000..d4ff381 --- /dev/null +++ b/cryptopp/ttmac.cpp @@ -0,0 +1,338 @@ +// ttmac.cpp - written and placed in the public domain by Kevin Springle + +#include "pch.h" +#include "ttmac.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +void TTMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &) +{ + AssertValidKeyLength(keylength); + + memcpy(m_key, userKey, KEYLENGTH); + CorrectEndianess(m_key, m_key, KEYLENGTH); + + Init(); +} + +void TTMAC_Base::Init() +{ + m_digest[0] = m_digest[5] = m_key[0]; + m_digest[1] = m_digest[6] = m_key[1]; + m_digest[2] = m_digest[7] = m_key[2]; + m_digest[3] = m_digest[8] = m_key[3]; + m_digest[4] = m_digest[9] = m_key[4]; +} + +void TTMAC_Base::TruncatedFinal(byte *hash, size_t size) +{ + PadLastBlock(BlockSize() - 2*sizeof(HashWordType)); + CorrectEndianess(m_data, m_data, BlockSize() - 2*sizeof(HashWordType)); + + m_data[m_data.size()-2] = GetBitCountLo(); + m_data[m_data.size()-1] = GetBitCountHi(); + + Transform(m_digest, m_data, true); + + word32 t2 = m_digest[2]; + word32 t3 = m_digest[3]; + if (size != DIGESTSIZE) + { + switch (size) + { + case 16: + m_digest[3] += m_digest[1] + m_digest[4]; + + case 12: + m_digest[2] += m_digest[0] + t3; + + case 8: + m_digest[0] += m_digest[1] + t3; + m_digest[1] += m_digest[4] + t2; + break; + + case 4: + m_digest[0] += + m_digest[1] + + m_digest[2] + + m_digest[3] + + m_digest[4]; + break; + + case 0: + // Used by HashTransformation::Restart() + break; + + default: + throw InvalidArgument("TTMAC_Base: can't truncate a Two-Track-MAC 20 byte digest to " + IntToString(size) + " bytes"); + break; + } + } + + CorrectEndianess(m_digest, m_digest, size); + memcpy(hash, m_digest, size); + + Restart(); // reinit for next use +} + +// RIPEMD-160 definitions used by Two-Track-MAC + +#define F(x, y, z) (x ^ y ^ z) +#define G(x, y, z) (z ^ (x & (y^z))) +#define H(x, y, z) (z ^ (x | ~y)) +#define I(x, y, z) (y ^ (z & (x^y))) +#define J(x, y, z) (x ^ (y | ~z)) + +#define k0 0 +#define k1 0x5a827999UL +#define k2 0x6ed9eba1UL +#define k3 0x8f1bbcdcUL +#define k4 0xa953fd4eUL +#define k5 0x50a28be6UL +#define k6 0x5c4dd124UL +#define k7 0x6d703ef3UL +#define k8 0x7a6d76e9UL +#define k9 0 + +void TTMAC_Base::Transform(word32 *digest, const word32 *X, bool last) +{ +#define Subround(f, a, b, c, d, e, x, s, k) \ + a += f(b, c, d) + x + k;\ + a = rotlFixed((word32)a, s) + e;\ + c = rotlFixed((word32)c, 10U) + + word32 a1, b1, c1, d1, e1, a2, b2, c2, d2, e2; + word32 *trackA, *trackB; + + if (!last) + { + trackA = digest; + trackB = digest+5; + } + else + { + trackB = digest; + trackA = digest+5; + } + a1 = trackA[0]; + b1 = trackA[1]; + c1 = trackA[2]; + d1 = trackA[3]; + e1 = trackA[4]; + a2 = trackB[0]; + b2 = trackB[1]; + c2 = trackB[2]; + d2 = trackB[3]; + e2 = trackB[4]; + + Subround(F, a1, b1, c1, d1, e1, X[ 0], 11, k0); + Subround(F, e1, a1, b1, c1, d1, X[ 1], 14, k0); + Subround(F, d1, e1, a1, b1, c1, X[ 2], 15, k0); + Subround(F, c1, d1, e1, a1, b1, X[ 3], 12, k0); + Subround(F, b1, c1, d1, e1, a1, X[ 4], 5, k0); + Subround(F, a1, b1, c1, d1, e1, X[ 5], 8, k0); + Subround(F, e1, a1, b1, c1, d1, X[ 6], 7, k0); + Subround(F, d1, e1, a1, b1, c1, X[ 7], 9, k0); + Subround(F, c1, d1, e1, a1, b1, X[ 8], 11, k0); + Subround(F, b1, c1, d1, e1, a1, X[ 9], 13, k0); + Subround(F, a1, b1, c1, d1, e1, X[10], 14, k0); + Subround(F, e1, a1, b1, c1, d1, X[11], 15, k0); + Subround(F, d1, e1, a1, b1, c1, X[12], 6, k0); + Subround(F, c1, d1, e1, a1, b1, X[13], 7, k0); + Subround(F, b1, c1, d1, e1, a1, X[14], 9, k0); + Subround(F, a1, b1, c1, d1, e1, X[15], 8, k0); + + Subround(G, e1, a1, b1, c1, d1, X[ 7], 7, k1); + Subround(G, d1, e1, a1, b1, c1, X[ 4], 6, k1); + Subround(G, c1, d1, e1, a1, b1, X[13], 8, k1); + Subround(G, b1, c1, d1, e1, a1, X[ 1], 13, k1); + Subround(G, a1, b1, c1, d1, e1, X[10], 11, k1); + Subround(G, e1, a1, b1, c1, d1, X[ 6], 9, k1); + Subround(G, d1, e1, a1, b1, c1, X[15], 7, k1); + Subround(G, c1, d1, e1, a1, b1, X[ 3], 15, k1); + Subround(G, b1, c1, d1, e1, a1, X[12], 7, k1); + Subround(G, a1, b1, c1, d1, e1, X[ 0], 12, k1); + Subround(G, e1, a1, b1, c1, d1, X[ 9], 15, k1); + Subround(G, d1, e1, a1, b1, c1, X[ 5], 9, k1); + Subround(G, c1, d1, e1, a1, b1, X[ 2], 11, k1); + Subround(G, b1, c1, d1, e1, a1, X[14], 7, k1); + Subround(G, a1, b1, c1, d1, e1, X[11], 13, k1); + Subround(G, e1, a1, b1, c1, d1, X[ 8], 12, k1); + + Subround(H, d1, e1, a1, b1, c1, X[ 3], 11, k2); + Subround(H, c1, d1, e1, a1, b1, X[10], 13, k2); + Subround(H, b1, c1, d1, e1, a1, X[14], 6, k2); + Subround(H, a1, b1, c1, d1, e1, X[ 4], 7, k2); + Subround(H, e1, a1, b1, c1, d1, X[ 9], 14, k2); + Subround(H, d1, e1, a1, b1, c1, X[15], 9, k2); + Subround(H, c1, d1, e1, a1, b1, X[ 8], 13, k2); + Subround(H, b1, c1, d1, e1, a1, X[ 1], 15, k2); + Subround(H, a1, b1, c1, d1, e1, X[ 2], 14, k2); + Subround(H, e1, a1, b1, c1, d1, X[ 7], 8, k2); + Subround(H, d1, e1, a1, b1, c1, X[ 0], 13, k2); + Subround(H, c1, d1, e1, a1, b1, X[ 6], 6, k2); + Subround(H, b1, c1, d1, e1, a1, X[13], 5, k2); + Subround(H, a1, b1, c1, d1, e1, X[11], 12, k2); + Subround(H, e1, a1, b1, c1, d1, X[ 5], 7, k2); + Subround(H, d1, e1, a1, b1, c1, X[12], 5, k2); + + Subround(I, c1, d1, e1, a1, b1, X[ 1], 11, k3); + Subround(I, b1, c1, d1, e1, a1, X[ 9], 12, k3); + Subround(I, a1, b1, c1, d1, e1, X[11], 14, k3); + Subround(I, e1, a1, b1, c1, d1, X[10], 15, k3); + Subround(I, d1, e1, a1, b1, c1, X[ 0], 14, k3); + Subround(I, c1, d1, e1, a1, b1, X[ 8], 15, k3); + Subround(I, b1, c1, d1, e1, a1, X[12], 9, k3); + Subround(I, a1, b1, c1, d1, e1, X[ 4], 8, k3); + Subround(I, e1, a1, b1, c1, d1, X[13], 9, k3); + Subround(I, d1, e1, a1, b1, c1, X[ 3], 14, k3); + Subround(I, c1, d1, e1, a1, b1, X[ 7], 5, k3); + Subround(I, b1, c1, d1, e1, a1, X[15], 6, k3); + Subround(I, a1, b1, c1, d1, e1, X[14], 8, k3); + Subround(I, e1, a1, b1, c1, d1, X[ 5], 6, k3); + Subround(I, d1, e1, a1, b1, c1, X[ 6], 5, k3); + Subround(I, c1, d1, e1, a1, b1, X[ 2], 12, k3); + + Subround(J, b1, c1, d1, e1, a1, X[ 4], 9, k4); + Subround(J, a1, b1, c1, d1, e1, X[ 0], 15, k4); + Subround(J, e1, a1, b1, c1, d1, X[ 5], 5, k4); + Subround(J, d1, e1, a1, b1, c1, X[ 9], 11, k4); + Subround(J, c1, d1, e1, a1, b1, X[ 7], 6, k4); + Subround(J, b1, c1, d1, e1, a1, X[12], 8, k4); + Subround(J, a1, b1, c1, d1, e1, X[ 2], 13, k4); + Subround(J, e1, a1, b1, c1, d1, X[10], 12, k4); + Subround(J, d1, e1, a1, b1, c1, X[14], 5, k4); + Subround(J, c1, d1, e1, a1, b1, X[ 1], 12, k4); + Subround(J, b1, c1, d1, e1, a1, X[ 3], 13, k4); + Subround(J, a1, b1, c1, d1, e1, X[ 8], 14, k4); + Subround(J, e1, a1, b1, c1, d1, X[11], 11, k4); + Subround(J, d1, e1, a1, b1, c1, X[ 6], 8, k4); + Subround(J, c1, d1, e1, a1, b1, X[15], 5, k4); + Subround(J, b1, c1, d1, e1, a1, X[13], 6, k4); + + Subround(J, a2, b2, c2, d2, e2, X[ 5], 8, k5); + Subround(J, e2, a2, b2, c2, d2, X[14], 9, k5); + Subround(J, d2, e2, a2, b2, c2, X[ 7], 9, k5); + Subround(J, c2, d2, e2, a2, b2, X[ 0], 11, k5); + Subround(J, b2, c2, d2, e2, a2, X[ 9], 13, k5); + Subround(J, a2, b2, c2, d2, e2, X[ 2], 15, k5); + Subround(J, e2, a2, b2, c2, d2, X[11], 15, k5); + Subround(J, d2, e2, a2, b2, c2, X[ 4], 5, k5); + Subround(J, c2, d2, e2, a2, b2, X[13], 7, k5); + Subround(J, b2, c2, d2, e2, a2, X[ 6], 7, k5); + Subround(J, a2, b2, c2, d2, e2, X[15], 8, k5); + Subround(J, e2, a2, b2, c2, d2, X[ 8], 11, k5); + Subround(J, d2, e2, a2, b2, c2, X[ 1], 14, k5); + Subround(J, c2, d2, e2, a2, b2, X[10], 14, k5); + Subround(J, b2, c2, d2, e2, a2, X[ 3], 12, k5); + Subround(J, a2, b2, c2, d2, e2, X[12], 6, k5); + + Subround(I, e2, a2, b2, c2, d2, X[ 6], 9, k6); + Subround(I, d2, e2, a2, b2, c2, X[11], 13, k6); + Subround(I, c2, d2, e2, a2, b2, X[ 3], 15, k6); + Subround(I, b2, c2, d2, e2, a2, X[ 7], 7, k6); + Subround(I, a2, b2, c2, d2, e2, X[ 0], 12, k6); + Subround(I, e2, a2, b2, c2, d2, X[13], 8, k6); + Subround(I, d2, e2, a2, b2, c2, X[ 5], 9, k6); + Subround(I, c2, d2, e2, a2, b2, X[10], 11, k6); + Subround(I, b2, c2, d2, e2, a2, X[14], 7, k6); + Subround(I, a2, b2, c2, d2, e2, X[15], 7, k6); + Subround(I, e2, a2, b2, c2, d2, X[ 8], 12, k6); + Subround(I, d2, e2, a2, b2, c2, X[12], 7, k6); + Subround(I, c2, d2, e2, a2, b2, X[ 4], 6, k6); + Subround(I, b2, c2, d2, e2, a2, X[ 9], 15, k6); + Subround(I, a2, b2, c2, d2, e2, X[ 1], 13, k6); + Subround(I, e2, a2, b2, c2, d2, X[ 2], 11, k6); + + Subround(H, d2, e2, a2, b2, c2, X[15], 9, k7); + Subround(H, c2, d2, e2, a2, b2, X[ 5], 7, k7); + Subround(H, b2, c2, d2, e2, a2, X[ 1], 15, k7); + Subround(H, a2, b2, c2, d2, e2, X[ 3], 11, k7); + Subround(H, e2, a2, b2, c2, d2, X[ 7], 8, k7); + Subround(H, d2, e2, a2, b2, c2, X[14], 6, k7); + Subround(H, c2, d2, e2, a2, b2, X[ 6], 6, k7); + Subround(H, b2, c2, d2, e2, a2, X[ 9], 14, k7); + Subround(H, a2, b2, c2, d2, e2, X[11], 12, k7); + Subround(H, e2, a2, b2, c2, d2, X[ 8], 13, k7); + Subround(H, d2, e2, a2, b2, c2, X[12], 5, k7); + Subround(H, c2, d2, e2, a2, b2, X[ 2], 14, k7); + Subround(H, b2, c2, d2, e2, a2, X[10], 13, k7); + Subround(H, a2, b2, c2, d2, e2, X[ 0], 13, k7); + Subround(H, e2, a2, b2, c2, d2, X[ 4], 7, k7); + Subround(H, d2, e2, a2, b2, c2, X[13], 5, k7); + + Subround(G, c2, d2, e2, a2, b2, X[ 8], 15, k8); + Subround(G, b2, c2, d2, e2, a2, X[ 6], 5, k8); + Subround(G, a2, b2, c2, d2, e2, X[ 4], 8, k8); + Subround(G, e2, a2, b2, c2, d2, X[ 1], 11, k8); + Subround(G, d2, e2, a2, b2, c2, X[ 3], 14, k8); + Subround(G, c2, d2, e2, a2, b2, X[11], 14, k8); + Subround(G, b2, c2, d2, e2, a2, X[15], 6, k8); + Subround(G, a2, b2, c2, d2, e2, X[ 0], 14, k8); + Subround(G, e2, a2, b2, c2, d2, X[ 5], 6, k8); + Subround(G, d2, e2, a2, b2, c2, X[12], 9, k8); + Subround(G, c2, d2, e2, a2, b2, X[ 2], 12, k8); + Subround(G, b2, c2, d2, e2, a2, X[13], 9, k8); + Subround(G, a2, b2, c2, d2, e2, X[ 9], 12, k8); + Subround(G, e2, a2, b2, c2, d2, X[ 7], 5, k8); + Subround(G, d2, e2, a2, b2, c2, X[10], 15, k8); + Subround(G, c2, d2, e2, a2, b2, X[14], 8, k8); + + Subround(F, b2, c2, d2, e2, a2, X[12], 8, k9); + Subround(F, a2, b2, c2, d2, e2, X[15], 5, k9); + Subround(F, e2, a2, b2, c2, d2, X[10], 12, k9); + Subround(F, d2, e2, a2, b2, c2, X[ 4], 9, k9); + Subround(F, c2, d2, e2, a2, b2, X[ 1], 12, k9); + Subround(F, b2, c2, d2, e2, a2, X[ 5], 5, k9); + Subround(F, a2, b2, c2, d2, e2, X[ 8], 14, k9); + Subround(F, e2, a2, b2, c2, d2, X[ 7], 6, k9); + Subround(F, d2, e2, a2, b2, c2, X[ 6], 8, k9); + Subround(F, c2, d2, e2, a2, b2, X[ 2], 13, k9); + Subround(F, b2, c2, d2, e2, a2, X[13], 6, k9); + Subround(F, a2, b2, c2, d2, e2, X[14], 5, k9); + Subround(F, e2, a2, b2, c2, d2, X[ 0], 15, k9); + Subround(F, d2, e2, a2, b2, c2, X[ 3], 13, k9); + Subround(F, c2, d2, e2, a2, b2, X[ 9], 11, k9); + Subround(F, b2, c2, d2, e2, a2, X[11], 11, k9); + + a1 -= trackA[0]; + b1 -= trackA[1]; + c1 -= trackA[2]; + d1 -= trackA[3]; + e1 -= trackA[4]; + a2 -= trackB[0]; + b2 -= trackB[1]; + c2 -= trackB[2]; + d2 -= trackB[3]; + e2 -= trackB[4]; + + if (!last) + { + trackA[0] = (b1 + e1) - d2; + trackA[1] = c1 - e2; + trackA[2] = d1 - a2; + trackA[3] = e1 - b2; + trackA[4] = a1 - c2; + trackB[0] = d1 - e2; + trackB[1] = (e1 + c1) - a2; + trackB[2] = a1 - b2; + trackB[3] = b1 - c2; + trackB[4] = c1 - d2; + } + else + { + trackB[0] = a2 - a1; + trackB[1] = b2 - b1; + trackB[2] = c2 - c1; + trackB[3] = d2 - d1; + trackB[4] = e2 - e1; + trackA[0] = 0; + trackA[1] = 0; + trackA[2] = 0; + trackA[3] = 0; + trackA[4] = 0; + } +} + +NAMESPACE_END diff --git a/cryptopp/ttmac.h b/cryptopp/ttmac.h new file mode 100644 index 0000000..b4bf86e --- /dev/null +++ b/cryptopp/ttmac.h @@ -0,0 +1,38 @@ +// ttmac.h - written and placed in the public domain by Kevin Springle + +#ifndef CRYPTOPP_TTMAC_H +#define CRYPTOPP_TTMAC_H + +#include "seckey.h" +#include "iterhash.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash +{ +public: + static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");} + CRYPTOPP_CONSTANT(DIGESTSIZE=20) + + unsigned int DigestSize() const {return DIGESTSIZE;}; + void UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs ¶ms); + void TruncatedFinal(byte *mac, size_t size); + +protected: + static void Transform (word32 *digest, const word32 *X, bool last); + void HashEndianCorrectedBlock(const word32 *data) {Transform(m_digest, data, false);} + void Init(); + word32* StateBuf() {return m_digest;} + + FixedSizeSecBlock m_digest; + FixedSizeSecBlock m_key; +}; + +//! Two-Track-MAC +/*! 160 Bit MAC with 160 Bit Key */ +DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal, TTMAC) + +NAMESPACE_END + +#endif diff --git a/cryptopp/twofish.cpp b/cryptopp/twofish.cpp new file mode 100644 index 0000000..e78258d --- /dev/null +++ b/cryptopp/twofish.cpp @@ -0,0 +1,168 @@ +// twofish.cpp - modified by Wei Dai from Matthew Skala's twofish.c +// The original code and all modifications are in the public domain. + +#include "pch.h" +#include "twofish.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +// compute (c * x^4) mod (x^4 + (a + 1/a) * x^3 + a * x^2 + (a + 1/a) * x + 1) +// over GF(256) +static inline unsigned int Mod(unsigned int c) +{ + static const unsigned int modulus = 0x14d; + unsigned int c2 = (c<<1) ^ ((c & 0x80) ? modulus : 0); + unsigned int c1 = c2 ^ (c>>1) ^ ((c & 1) ? (modulus>>1) : 0); + return c | (c1 << 8) | (c2 << 16) | (c1 << 24); +} + +// compute RS(12,8) code with the above polynomial as generator +// this is equivalent to multiplying by the RS matrix +static word32 ReedSolomon(word32 high, word32 low) +{ + for (unsigned int i=0; i<8; i++) + { + high = Mod(high>>24) ^ (high<<8) ^ (low>>24); + low <<= 8; + } + return high; +} + +inline word32 Twofish::Base::h0(word32 x, const word32 *key, unsigned int kLen) +{ + x = x | (x<<8) | (x<<16) | (x<<24); + switch(kLen) + { +#define Q(a, b, c, d, t) q[a][GETBYTE(t,0)] ^ (q[b][GETBYTE(t,1)] << 8) ^ (q[c][GETBYTE(t,2)] << 16) ^ (q[d][GETBYTE(t,3)] << 24) + case 4: x = Q(1, 0, 0, 1, x) ^ key[6]; + case 3: x = Q(1, 1, 0, 0, x) ^ key[4]; + case 2: x = Q(0, 1, 0, 1, x) ^ key[2]; + x = Q(0, 0, 1, 1, x) ^ key[0]; + } + return x; +} + +inline word32 Twofish::Base::h(word32 x, const word32 *key, unsigned int kLen) +{ + x = h0(x, key, kLen); + return mds[0][GETBYTE(x,0)] ^ mds[1][GETBYTE(x,1)] ^ mds[2][GETBYTE(x,2)] ^ mds[3][GETBYTE(x,3)]; +} + +void Twofish::Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &) +{ + AssertValidKeyLength(keylength); + + unsigned int len = (keylength <= 16 ? 2 : (keylength <= 24 ? 3 : 4)); + SecBlock key(len*2); + GetUserKey(LITTLE_ENDIAN_ORDER, key.begin(), len*2, userKey, keylength); + + unsigned int i; + for (i=0; i<40; i+=2) + { + word32 a = h(i, key, len); + word32 b = rotlFixed(h(i+1, key+1, len), 8); + m_k[i] = a+b; + m_k[i+1] = rotlFixed(a+2*b, 9); + } + + SecBlock svec(2*len); + for (i=0; i Block; + +void Twofish::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 x, y, a, b, c, d; + + Block::Get(inBlock)(a)(b)(c)(d); + + a ^= m_k[0]; + b ^= m_k[1]; + c ^= m_k[2]; + d ^= m_k[3]; + + const word32 *k = m_k+8; + ENCCYCLE (0); + ENCCYCLE (1); + ENCCYCLE (2); + ENCCYCLE (3); + ENCCYCLE (4); + ENCCYCLE (5); + ENCCYCLE (6); + ENCCYCLE (7); + + c ^= m_k[4]; + d ^= m_k[5]; + a ^= m_k[6]; + b ^= m_k[7]; + + Block::Put(xorBlock, outBlock)(c)(d)(a)(b); +} + +void Twofish::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const +{ + word32 x, y, a, b, c, d; + + Block::Get(inBlock)(c)(d)(a)(b); + + c ^= m_k[4]; + d ^= m_k[5]; + a ^= m_k[6]; + b ^= m_k[7]; + + const word32 *k = m_k+8; + DECCYCLE (7); + DECCYCLE (6); + DECCYCLE (5); + DECCYCLE (4); + DECCYCLE (3); + DECCYCLE (2); + DECCYCLE (1); + DECCYCLE (0); + + a ^= m_k[0]; + b ^= m_k[1]; + c ^= m_k[2]; + d ^= m_k[3]; + + Block::Put(xorBlock, outBlock)(a)(b)(c)(d); +} + +NAMESPACE_END diff --git a/cryptopp/twofish.h b/cryptopp/twofish.h new file mode 100644 index 0000000..969fdb2 --- /dev/null +++ b/cryptopp/twofish.h @@ -0,0 +1,59 @@ +#ifndef CRYPTOPP_TWOFISH_H +#define CRYPTOPP_TWOFISH_H + +/** \file +*/ + +#include "seckey.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +struct Twofish_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 32>, FixedRounds<16> +{ + static const char *StaticAlgorithmName() {return "Twofish";} +}; + +/// Twofish +class Twofish : public Twofish_Info, public BlockCipherDocumentation +{ + class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl + { + public: + void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); + + protected: + static word32 h0(word32 x, const word32 *key, unsigned int kLen); + static word32 h(word32 x, const word32 *key, unsigned int kLen); + + static const byte q[2][256]; + static const word32 mds[4][256]; + + FixedSizeSecBlock m_k; + FixedSizeSecBlock m_s; + }; + + class CRYPTOPP_NO_VTABLE Enc : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + + class CRYPTOPP_NO_VTABLE Dec : public Base + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; + }; + +public: + typedef BlockCipherFinal Encryption; + typedef BlockCipherFinal Decryption; +}; + +typedef Twofish::Encryption TwofishEncryption; +typedef Twofish::Decryption TwofishDecryption; + +NAMESPACE_END + +#endif diff --git a/cryptopp/validat1.cpp b/cryptopp/validat1.cpp new file mode 100644 index 0000000..e76f0f2 --- /dev/null +++ b/cryptopp/validat1.cpp @@ -0,0 +1,1405 @@ +// validat1.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 +#include "files.h" +#include "hex.h" +#include "base32.h" +#include "base64.h" +#include "modes.h" +#include "cbcmac.h" +#include "dmac.h" +#include "idea.h" +#include "des.h" +#include "rc2.h" +#include "arc4.h" +#include "rc5.h" +#include "blowfish.h" +#include "wake.h" +#include "3way.h" +#include "safer.h" +#include "gost.h" +#include "shark.h" +#include "cast.h" +#include "square.h" +#include "seal.h" +#include "rc6.h" +#include "mars.h" +#include "rijndael.h" +#include "twofish.h" +#include "serpent.h" +#include "skipjack.h" +#include "shacal2.h" +#include "camellia.h" +#include "osrng.h" +#include "zdeflate.h" +#include "cpu.h" + +#include +#include +#include +#include +#include + +#include "validate.h" + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +bool ValidateAll(bool thorough) +{ + bool pass=TestSettings(); + pass=TestOS_RNG() && pass; + + pass=ValidateCRC32() && pass; + pass=ValidateAdler32() && pass; + pass=ValidateMD2() && pass; + pass=ValidateMD5() && pass; + pass=ValidateSHA() && pass; + pass=ValidateSHA2() && pass; + pass=ValidateTiger() && pass; + pass=ValidateRIPEMD() && pass; + pass=ValidatePanama() && pass; + pass=ValidateWhirlpool() && pass; + + pass=ValidateHMAC() && pass; + pass=ValidateTTMAC() && pass; + + pass=ValidatePBKDF() && pass; + + pass=ValidateDES() && pass; + pass=ValidateCipherModes() && pass; + pass=ValidateIDEA() && pass; + pass=ValidateSAFER() && pass; + pass=ValidateRC2() && pass; + pass=ValidateARC4() && pass; + pass=ValidateRC5() && pass; + pass=ValidateBlowfish() && pass; + pass=ValidateThreeWay() && pass; + pass=ValidateGOST() && pass; + pass=ValidateSHARK() && pass; + pass=ValidateCAST() && pass; + pass=ValidateSquare() && pass; + pass=ValidateSKIPJACK() && pass; + pass=ValidateSEAL() && pass; + pass=ValidateRC6() && pass; + pass=ValidateMARS() && pass; + pass=ValidateRijndael() && pass; + pass=ValidateTwofish() && pass; + pass=ValidateSerpent() && pass; + pass=ValidateSHACAL2() && pass; + pass=ValidateCamellia() && pass; + pass=ValidateSalsa() && pass; + pass=ValidateSosemanuk() && pass; + pass=ValidateVMAC() && pass; + pass=ValidateCCM() && pass; + pass=ValidateGCM() && pass; + pass=ValidateCMAC() && pass; + pass=RunTestDataFile("TestVectors/eax.txt") && pass; + pass=RunTestDataFile("TestVectors/seed.txt") && pass; + + pass=ValidateBBS() && pass; + pass=ValidateDH() && pass; + pass=ValidateMQV() && pass; + pass=ValidateRSA() && pass; + pass=ValidateElGamal() && pass; + pass=ValidateDLIES() && pass; + pass=ValidateNR() && pass; + pass=ValidateDSA(thorough) && pass; + pass=ValidateLUC() && pass; + pass=ValidateLUC_DH() && pass; + pass=ValidateLUC_DL() && pass; + pass=ValidateXTR_DH() && pass; + pass=ValidateRabin() && pass; + pass=ValidateRW() && pass; +// pass=ValidateBlumGoldwasser() && pass; + pass=ValidateECP() && pass; + pass=ValidateEC2N() && pass; + pass=ValidateECDSA() && pass; + pass=ValidateESIGN() && pass; + + if (pass) + cout << "\nAll tests passed!\n"; + else + cout << "\nOops! Not all tests passed.\n"; + + return pass; +} + +bool TestSettings() +{ + bool pass = true; + + cout << "\nTesting Settings...\n\n"; + + if (*(word32 *)"\x01\x02\x03\x04" == 0x04030201L) + { +#ifdef IS_LITTLE_ENDIAN + cout << "passed: "; +#else + cout << "FAILED: "; + pass = false; +#endif + cout << "Your machine is little endian.\n"; + } + else if (*(word32 *)"\x01\x02\x03\x04" == 0x01020304L) + { +#ifndef IS_LITTLE_ENDIAN + cout << "passed: "; +#else + cout << "FAILED: "; + pass = false; +#endif + cout << "Your machine is big endian.\n"; + } + else + { + cout << "FAILED: Your machine is neither big endian nor little endian.\n"; + pass = false; + } + +#ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS + byte testvals[10] = {1,2,2,3,3,3,3,2,2,1}; + if (*(word32 *)(testvals+3) == 0x03030303 && *(word64 *)(testvals+1) == W64LIT(0x0202030303030202)) + cout << "passed: Your machine allows unaligned data access.\n"; + else + { + cout << "FAILED: Unaligned data access gave incorrect results.\n"; + pass = false; + } +#else + cout << "passed: CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS is not defined. Will restrict to aligned data access.\n"; +#endif + + if (sizeof(byte) == 1) + cout << "passed: "; + else + { + cout << "FAILED: "; + pass = false; + } + cout << "sizeof(byte) == " << sizeof(byte) << endl; + + if (sizeof(word16) == 2) + cout << "passed: "; + else + { + cout << "FAILED: "; + pass = false; + } + cout << "sizeof(word16) == " << sizeof(word16) << endl; + + if (sizeof(word32) == 4) + cout << "passed: "; + else + { + cout << "FAILED: "; + pass = false; + } + cout << "sizeof(word32) == " << sizeof(word32) << endl; + + if (sizeof(word64) == 8) + cout << "passed: "; + else + { + cout << "FAILED: "; + pass = false; + } + cout << "sizeof(word64) == " << sizeof(word64) << endl; + +#ifdef CRYPTOPP_WORD128_AVAILABLE + if (sizeof(word128) == 16) + cout << "passed: "; + else + { + cout << "FAILED: "; + pass = false; + } + cout << "sizeof(word128) == " << sizeof(word128) << endl; +#endif + + if (sizeof(word) == 2*sizeof(hword) +#ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + && sizeof(dword) == 2*sizeof(word) +#endif + ) + cout << "passed: "; + else + { + cout << "FAILED: "; + pass = false; + } + cout << "sizeof(hword) == " << sizeof(hword) << ", sizeof(word) == " << sizeof(word); +#ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE + cout << ", sizeof(dword) == " << sizeof(dword); +#endif + cout << endl; + + bool hasMMX = HasMMX(); + bool hasISSE = HasISSE(); + bool hasSSE2 = HasSSE2(); + bool hasSSSE3 = HasSSSE3(); + bool isP4 = IsP4(); + int cacheLineSize = GetCacheLineSize(); + + if ((isP4 && (!hasMMX || !hasSSE2)) || (hasSSE2 && !hasMMX) || (cacheLineSize < 16 || cacheLineSize > 256 || !IsPowerOf2(cacheLineSize))) + { + cout << "FAILED: "; + pass = false; + } + else + cout << "passed: "; + + cout << "hasMMX == " << hasMMX << ", hasISSE == " << hasISSE << ", hasSSE2 == " << hasSSE2 << ", hasSSSE3 == " << hasSSSE3 << ", isP4 == " << isP4 << ", cacheLineSize == " << cacheLineSize; + + if (!pass) + { + cout << "Some critical setting in config.h is in error. Please fix it and recompile." << endl; + abort(); + } + return pass; +} + +bool TestOS_RNG() +{ + bool pass = true; + + member_ptr rng; +#ifdef BLOCKING_RNG_AVAILABLE + try {rng.reset(new BlockingRng);} + catch (OS_RNG_Err &) {} +#endif + + if (rng.get()) + { + cout << "\nTesting operating system provided blocking random number generator...\n\n"; + + ArraySink *sink; + RandomNumberSource test(*rng, UINT_MAX, false, new Deflator(sink=new ArraySink(NULL,0))); + unsigned long total=0, length=0; + time_t t = time(NULL), t1 = 0; + + // check that it doesn't take too long to generate a reasonable amount of randomness + while (total < 16 && (t1 < 10 || total*8 > (unsigned long)t1)) + { + test.Pump(1); + total += 1; + t1 = time(NULL) - t; + } + + if (total < 16) + { + cout << "FAILED:"; + pass = false; + } + else + cout << "passed:"; + cout << " it took " << long(t1) << " seconds to generate " << total << " bytes" << endl; + +#if 0 // disable this part. it's causing an unpredictable pause during the validation testing + if (t1 < 2) + { + // that was fast, are we really blocking? + // first exhaust the extropy reserve + t = time(NULL); + while (time(NULL) - t < 2) + { + test.Pump(1); + total += 1; + } + + // if it generates too many bytes in a certain amount of time, + // something's probably wrong + t = time(NULL); + while (time(NULL) - t < 2) + { + test.Pump(1); + total += 1; + length += 1; + } + if (length > 1024) + { + cout << "FAILED:"; + pass = false; + } + else + cout << "passed:"; + cout << " it generated " << length << " bytes in " << long(time(NULL) - t) << " seconds" << endl; + } +#endif + + test.AttachedTransformation()->MessageEnd(); + + if (sink->TotalPutLength() < total) + { + cout << "FAILED:"; + pass = false; + } + else + cout << "passed:"; + cout << " " << total << " generated bytes compressed to " << (size_t)sink->TotalPutLength() << " bytes by DEFLATE" << endl; + } + else + cout << "\nNo operating system provided blocking random number generator, skipping test." << endl; + + rng.reset(NULL); +#ifdef NONBLOCKING_RNG_AVAILABLE + try {rng.reset(new NonblockingRng);} + catch (OS_RNG_Err &) {} +#endif + + if (rng.get()) + { + cout << "\nTesting operating system provided nonblocking random number generator...\n\n"; + + ArraySink *sink; + RandomNumberSource test(*rng, 100000, true, new Deflator(sink=new ArraySink(NULL, 0))); + + if (sink->TotalPutLength() < 100000) + { + cout << "FAILED:"; + pass = false; + } + else + cout << "passed:"; + cout << " 100000 generated bytes compressed to " << (size_t)sink->TotalPutLength() << " bytes by DEFLATE" << endl; + } + else + cout << "\nNo operating system provided nonblocking random number generator, skipping test." << endl; + + return pass; +} + +// VC50 workaround +typedef auto_ptr apbt; + +class CipherFactory +{ +public: + virtual unsigned int BlockSize() const =0; + virtual unsigned int KeyLength() const =0; + + virtual apbt NewEncryption(const byte *key) const =0; + virtual apbt NewDecryption(const byte *key) const =0; +}; + +template class FixedRoundsCipherFactory : public CipherFactory +{ +public: + FixedRoundsCipherFactory(unsigned int keylen=0) : m_keylen(keylen?keylen:E::DEFAULT_KEYLENGTH) {} + unsigned int BlockSize() const {return E::BLOCKSIZE;} + unsigned int KeyLength() const {return m_keylen;} + + apbt NewEncryption(const byte *key) const + {return apbt(new E(key, m_keylen));} + apbt NewDecryption(const byte *key) const + {return apbt(new D(key, m_keylen));} + + unsigned int m_keylen; +}; + +template class VariableRoundsCipherFactory : public CipherFactory +{ +public: + VariableRoundsCipherFactory(unsigned int keylen=0, unsigned int rounds=0) + : m_keylen(keylen ? keylen : E::DEFAULT_KEYLENGTH), m_rounds(rounds ? rounds : E::DEFAULT_ROUNDS) {} + unsigned int BlockSize() const {return E::BLOCKSIZE;} + unsigned int KeyLength() const {return m_keylen;} + + apbt NewEncryption(const byte *key) const + {return apbt(new E(key, m_keylen, m_rounds));} + apbt NewDecryption(const byte *key) const + {return apbt(new D(key, m_keylen, m_rounds));} + + unsigned int m_keylen, m_rounds; +}; + +bool BlockTransformationTest(const CipherFactory &cg, BufferedTransformation &valdata, unsigned int tuples = 0xffff) +{ + HexEncoder output(new FileSink(cout)); + SecByteBlock plain(cg.BlockSize()), cipher(cg.BlockSize()), out(cg.BlockSize()), outplain(cg.BlockSize()); + SecByteBlock key(cg.KeyLength()); + bool pass=true, fail; + + while (valdata.MaxRetrievable() && tuples--) + { + valdata.Get(key, cg.KeyLength()); + valdata.Get(plain, cg.BlockSize()); + valdata.Get(cipher, cg.BlockSize()); + + apbt transE = cg.NewEncryption(key); + transE->ProcessBlock(plain, out); + fail = memcmp(out, cipher, cg.BlockSize()) != 0; + + apbt transD = cg.NewDecryption(key); + transD->ProcessBlock(out, outplain); + fail=fail || memcmp(outplain, plain, cg.BlockSize()); + + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + output.Put(key, cg.KeyLength()); + cout << " "; + output.Put(outplain, cg.BlockSize()); + cout << " "; + output.Put(out, cg.BlockSize()); + cout << endl; + } + return pass; +} + +class FilterTester : public Unflushable +{ +public: + FilterTester(const byte *validOutput, size_t outputLen) + : validOutput(validOutput), outputLen(outputLen), counter(0), fail(false) {} + void PutByte(byte inByte) + { + if (counter >= outputLen || validOutput[counter] != inByte) + { + std::cerr << "incorrect output " << counter << ", " << (word16)validOutput[counter] << ", " << (word16)inByte << "\n"; + fail = true; + assert(false); + } + counter++; + } + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking) + { + while (length--) + FilterTester::PutByte(*inString++); + + if (messageEnd) + if (counter != outputLen) + { + fail = true; + assert(false); + } + + return 0; + } + bool GetResult() + { + return !fail; + } + + const byte *validOutput; + size_t outputLen, counter; + bool fail; +}; + +bool TestFilter(BufferedTransformation &bt, const byte *in, size_t inLen, const byte *out, size_t outLen) +{ + FilterTester *ft; + bt.Attach(ft = new FilterTester(out, outLen)); + + while (inLen) + { + size_t randomLen = GlobalRNG().GenerateWord32(0, (word32)inLen); + bt.Put(in, randomLen); + in += randomLen; + inLen -= randomLen; + } + bt.MessageEnd(); + return ft->GetResult(); +} + +bool ValidateDES() +{ + cout << "\nDES validation suite running...\n\n"; + + FileSource valdata("TestData/descert.dat", true, new HexDecoder); + bool pass = BlockTransformationTest(FixedRoundsCipherFactory(), valdata); + + cout << "\nTesting EDE2, EDE3, and XEX3 variants...\n\n"; + + FileSource valdata1("TestData/3desval.dat", true, new HexDecoder); + pass = BlockTransformationTest(FixedRoundsCipherFactory(), valdata1, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(), valdata1, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(), valdata1, 1) && pass; + + return pass; +} + +bool TestModeIV(SymmetricCipher &e, SymmetricCipher &d) +{ + SecByteBlock lastIV, iv(e.IVSize()); + StreamTransformationFilter filter(e, new StreamTransformationFilter(d)); + byte plaintext[20480]; + + for (unsigned int i=1; i cbcmac(key); + HashFilter cbcmacFilter(cbcmac); + fail = !TestFilter(cbcmacFilter, plain, sizeof(plain), mac1, sizeof(mac1)); + pass = pass && !fail; + cout << (fail ? "FAILED " : "passed ") << "CBC MAC" << endl; + + DMAC dmac(key); + HashFilter dmacFilter(dmac); + fail = !TestFilter(dmacFilter, plain, sizeof(plain), mac2, sizeof(mac2)); + pass = pass && !fail; + cout << (fail ? "FAILED " : "passed ") << "DMAC" << endl; + } + { + CTR_Mode::Encryption modeE(plain, 16, plain); + CTR_Mode::Decryption modeD(plain, 16, plain); + fail = !TestModeIV(modeE, modeD); + pass = pass && !fail; + cout << (fail ? "FAILED " : "passed ") << "AES CTR Mode" << endl; + } + { + OFB_Mode::Encryption modeE(plain, 16, plain); + OFB_Mode::Decryption modeD(plain, 16, plain); + fail = !TestModeIV(modeE, modeD); + pass = pass && !fail; + cout << (fail ? "FAILED " : "passed ") << "AES OFB Mode" << endl; + } + { + CFB_Mode::Encryption modeE(plain, 16, plain); + CFB_Mode::Decryption modeD(plain, 16, plain); + fail = !TestModeIV(modeE, modeD); + pass = pass && !fail; + cout << (fail ? "FAILED " : "passed ") << "AES CFB Mode" << endl; + } + { + CBC_Mode::Encryption modeE(plain, 16, plain); + CBC_Mode::Decryption modeD(plain, 16, plain); + fail = !TestModeIV(modeE, modeD); + pass = pass && !fail; + cout << (fail ? "FAILED " : "passed ") << "AES CBC Mode" << endl; + } + + return pass; +} + +bool ValidateIDEA() +{ + cout << "\nIDEA validation suite running...\n\n"; + + FileSource valdata("TestData/ideaval.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); +} + +bool ValidateSAFER() +{ + cout << "\nSAFER validation suite running...\n\n"; + + FileSource valdata("TestData/saferval.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(VariableRoundsCipherFactory(8,6), valdata, 4) && pass; + pass = BlockTransformationTest(VariableRoundsCipherFactory(16,12), valdata, 4) && pass; + pass = BlockTransformationTest(VariableRoundsCipherFactory(8,6), valdata, 4) && pass; + pass = BlockTransformationTest(VariableRoundsCipherFactory(16,10), valdata, 4) && pass; + return pass; +} + +bool ValidateRC2() +{ + cout << "\nRC2 validation suite running...\n\n"; + + FileSource valdata("TestData/rc2val.dat", true, new HexDecoder); + HexEncoder output(new FileSink(cout)); + SecByteBlock plain(RC2Encryption::BLOCKSIZE), cipher(RC2Encryption::BLOCKSIZE), out(RC2Encryption::BLOCKSIZE), outplain(RC2Encryption::BLOCKSIZE); + SecByteBlock key(128); + bool pass=true, fail; + + while (valdata.MaxRetrievable()) + { + byte keyLen, effectiveLen; + + valdata.Get(keyLen); + valdata.Get(effectiveLen); + valdata.Get(key, keyLen); + valdata.Get(plain, RC2Encryption::BLOCKSIZE); + valdata.Get(cipher, RC2Encryption::BLOCKSIZE); + + apbt transE(new RC2Encryption(key, keyLen, effectiveLen)); + transE->ProcessBlock(plain, out); + fail = memcmp(out, cipher, RC2Encryption::BLOCKSIZE) != 0; + + apbt transD(new RC2Decryption(key, keyLen, effectiveLen)); + transD->ProcessBlock(out, outplain); + fail=fail || memcmp(outplain, plain, RC2Encryption::BLOCKSIZE); + + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + output.Put(key, keyLen); + cout << " "; + output.Put(outplain, RC2Encryption::BLOCKSIZE); + cout << " "; + output.Put(out, RC2Encryption::BLOCKSIZE); + cout << endl; + } + return pass; +} + +bool ValidateARC4() +{ + unsigned char Key0[] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef }; + unsigned char Input0[]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; + unsigned char Output0[] = {0x75,0xb7,0x87,0x80,0x99,0xe0,0xc5,0x96}; + + unsigned char Key1[]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; + unsigned char Input1[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + unsigned char Output1[]={0x74,0x94,0xc2,0xe7,0x10,0x4b,0x08,0x79}; + + unsigned char Key2[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + unsigned char Input2[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + unsigned char Output2[]={0xde,0x18,0x89,0x41,0xa3,0x37,0x5d,0x3a}; + + unsigned char Key3[]={0xef,0x01,0x23,0x45}; + unsigned char Input3[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + unsigned char Output3[]={0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,0xbd,0x61}; + + unsigned char Key4[]={ 0x01,0x23,0x45,0x67,0x89,0xab, 0xcd,0xef }; + unsigned char Input4[] = + {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01}; + unsigned char Output4[]= { + 0x75,0x95,0xc3,0xe6,0x11,0x4a,0x09,0x78,0x0c,0x4a,0xd4, + 0x52,0x33,0x8e,0x1f,0xfd,0x9a,0x1b,0xe9,0x49,0x8f, + 0x81,0x3d,0x76,0x53,0x34,0x49,0xb6,0x77,0x8d,0xca, + 0xd8,0xc7,0x8a,0x8d,0x2b,0xa9,0xac,0x66,0x08,0x5d, + 0x0e,0x53,0xd5,0x9c,0x26,0xc2,0xd1,0xc4,0x90,0xc1, + 0xeb,0xbe,0x0c,0xe6,0x6d,0x1b,0x6b,0x1b,0x13,0xb6, + 0xb9,0x19,0xb8,0x47,0xc2,0x5a,0x91,0x44,0x7a,0x95, + 0xe7,0x5e,0x4e,0xf1,0x67,0x79,0xcd,0xe8,0xbf,0x0a, + 0x95,0x85,0x0e,0x32,0xaf,0x96,0x89,0x44,0x4f,0xd3, + 0x77,0x10,0x8f,0x98,0xfd,0xcb,0xd4,0xe7,0x26,0x56, + 0x75,0x00,0x99,0x0b,0xcc,0x7e,0x0c,0xa3,0xc4,0xaa, + 0xa3,0x04,0xa3,0x87,0xd2,0x0f,0x3b,0x8f,0xbb,0xcd, + 0x42,0xa1,0xbd,0x31,0x1d,0x7a,0x43,0x03,0xdd,0xa5, + 0xab,0x07,0x88,0x96,0xae,0x80,0xc1,0x8b,0x0a,0xf6, + 0x6d,0xff,0x31,0x96,0x16,0xeb,0x78,0x4e,0x49,0x5a, + 0xd2,0xce,0x90,0xd7,0xf7,0x72,0xa8,0x17,0x47,0xb6, + 0x5f,0x62,0x09,0x3b,0x1e,0x0d,0xb9,0xe5,0xba,0x53, + 0x2f,0xaf,0xec,0x47,0x50,0x83,0x23,0xe6,0x71,0x32, + 0x7d,0xf9,0x44,0x44,0x32,0xcb,0x73,0x67,0xce,0xc8, + 0x2f,0x5d,0x44,0xc0,0xd0,0x0b,0x67,0xd6,0x50,0xa0, + 0x75,0xcd,0x4b,0x70,0xde,0xdd,0x77,0xeb,0x9b,0x10, + 0x23,0x1b,0x6b,0x5b,0x74,0x13,0x47,0x39,0x6d,0x62, + 0x89,0x74,0x21,0xd4,0x3d,0xf9,0xb4,0x2e,0x44,0x6e, + 0x35,0x8e,0x9c,0x11,0xa9,0xb2,0x18,0x4e,0xcb,0xef, + 0x0c,0xd8,0xe7,0xa8,0x77,0xef,0x96,0x8f,0x13,0x90, + 0xec,0x9b,0x3d,0x35,0xa5,0x58,0x5c,0xb0,0x09,0x29, + 0x0e,0x2f,0xcd,0xe7,0xb5,0xec,0x66,0xd9,0x08,0x4b, + 0xe4,0x40,0x55,0xa6,0x19,0xd9,0xdd,0x7f,0xc3,0x16, + 0x6f,0x94,0x87,0xf7,0xcb,0x27,0x29,0x12,0x42,0x64, + 0x45,0x99,0x85,0x14,0xc1,0x5d,0x53,0xa1,0x8c,0x86, + 0x4c,0xe3,0xa2,0xb7,0x55,0x57,0x93,0x98,0x81,0x26, + 0x52,0x0e,0xac,0xf2,0xe3,0x06,0x6e,0x23,0x0c,0x91, + 0xbe,0xe4,0xdd,0x53,0x04,0xf5,0xfd,0x04,0x05,0xb3, + 0x5b,0xd9,0x9c,0x73,0x13,0x5d,0x3d,0x9b,0xc3,0x35, + 0xee,0x04,0x9e,0xf6,0x9b,0x38,0x67,0xbf,0x2d,0x7b, + 0xd1,0xea,0xa5,0x95,0xd8,0xbf,0xc0,0x06,0x6f,0xf8, + 0xd3,0x15,0x09,0xeb,0x0c,0x6c,0xaa,0x00,0x6c,0x80, + 0x7a,0x62,0x3e,0xf8,0x4c,0x3d,0x33,0xc1,0x95,0xd2, + 0x3e,0xe3,0x20,0xc4,0x0d,0xe0,0x55,0x81,0x57,0xc8, + 0x22,0xd4,0xb8,0xc5,0x69,0xd8,0x49,0xae,0xd5,0x9d, + 0x4e,0x0f,0xd7,0xf3,0x79,0x58,0x6b,0x4b,0x7f,0xf6, + 0x84,0xed,0x6a,0x18,0x9f,0x74,0x86,0xd4,0x9b,0x9c, + 0x4b,0xad,0x9b,0xa2,0x4b,0x96,0xab,0xf9,0x24,0x37, + 0x2c,0x8a,0x8f,0xff,0xb1,0x0d,0x55,0x35,0x49,0x00, + 0xa7,0x7a,0x3d,0xb5,0xf2,0x05,0xe1,0xb9,0x9f,0xcd, + 0x86,0x60,0x86,0x3a,0x15,0x9a,0xd4,0xab,0xe4,0x0f, + 0xa4,0x89,0x34,0x16,0x3d,0xdd,0xe5,0x42,0xa6,0x58, + 0x55,0x40,0xfd,0x68,0x3c,0xbf,0xd8,0xc0,0x0f,0x12, + 0x12,0x9a,0x28,0x4d,0xea,0xcc,0x4c,0xde,0xfe,0x58, + 0xbe,0x71,0x37,0x54,0x1c,0x04,0x71,0x26,0xc8,0xd4, + 0x9e,0x27,0x55,0xab,0x18,0x1a,0xb7,0xe9,0x40,0xb0, + 0xc0}; + + // VC60 workaround: auto_ptr lacks reset() + member_ptr arc4; + bool pass=true, fail; + int i; + + cout << "\nARC4 validation suite running...\n\n"; + + arc4.reset(new Weak::ARC4(Key0, sizeof(Key0))); + arc4->ProcessString(Input0, sizeof(Input0)); + fail = memcmp(Input0, Output0, sizeof(Input0)) != 0; + cout << (fail ? "FAILED" : "passed") << " Test 0" << endl; + pass = pass && !fail; + + arc4.reset(new Weak::ARC4(Key1, sizeof(Key1))); + arc4->ProcessString(Key1, Input1, sizeof(Key1)); + fail = memcmp(Output1, Key1, sizeof(Key1)) != 0; + cout << (fail ? "FAILED" : "passed") << " Test 1" << endl; + pass = pass && !fail; + + arc4.reset(new Weak::ARC4(Key2, sizeof(Key2))); + for (i=0, fail=false; iProcessByte(Input2[i]) != Output2[i]) + fail = true; + cout << (fail ? "FAILED" : "passed") << " Test 2" << endl; + pass = pass && !fail; + + arc4.reset(new Weak::ARC4(Key3, sizeof(Key3))); + for (i=0, fail=false; iProcessByte(Input3[i]) != Output3[i]) + fail = true; + cout << (fail ? "FAILED" : "passed") << " Test 3" << endl; + pass = pass && !fail; + + arc4.reset(new Weak::ARC4(Key4, sizeof(Key4))); + for (i=0, fail=false; iProcessByte(Input4[i]) != Output4[i]) + fail = true; + cout << (fail ? "FAILED" : "passed") << " Test 4" << endl; + pass = pass && !fail; + + return pass; +} + +bool ValidateRC5() +{ + cout << "\nRC5 validation suite running...\n\n"; + + FileSource valdata("TestData/rc5val.dat", true, new HexDecoder); + return BlockTransformationTest(VariableRoundsCipherFactory(16, 12), valdata); +} + +bool ValidateRC6() +{ + cout << "\nRC6 validation suite running...\n\n"; + + FileSource valdata("TestData/rc6val.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 2) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 2) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(32), valdata, 2) && pass; + return pass; +} + +bool ValidateMARS() +{ + cout << "\nMARS validation suite running...\n\n"; + + FileSource valdata("TestData/marsval.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 3) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(32), valdata, 2) && pass; + return pass; +} + +bool ValidateRijndael() +{ + cout << "\nRijndael (AES) validation suite running...\n\n"; + + FileSource valdata("TestData/rijndael.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 3) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(32), valdata, 2) && pass; + pass = RunTestDataFile("TestVectors/aes.txt") && pass; + return pass; +} + +bool ValidateTwofish() +{ + cout << "\nTwofish validation suite running...\n\n"; + + FileSource valdata("TestData/twofishv.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 3) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(32), valdata, 2) && pass; + return pass; +} + +bool ValidateSerpent() +{ + cout << "\nSerpent validation suite running...\n\n"; + + FileSource valdata("TestData/serpentv.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 3) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(32), valdata, 2) && pass; + return pass; +} + +bool ValidateBlowfish() +{ + cout << "\nBlowfish validation suite running...\n\n"; + + HexEncoder output(new FileSink(cout)); + const char *key[]={"abcdefghijklmnopqrstuvwxyz", "Who is John Galt?"}; + byte *plain[]={(byte *)"BLOWFISH", (byte *)"\xfe\xdc\xba\x98\x76\x54\x32\x10"}; + byte *cipher[]={(byte *)"\x32\x4e\xd0\xfe\xf4\x13\xa2\x03", (byte *)"\xcc\x91\x73\x2b\x80\x22\xf6\x84"}; + byte out[8], outplain[8]; + bool pass=true, fail; + + for (int i=0; i<2; i++) + { + ECB_Mode::Encryption enc((byte *)key[i], strlen(key[i])); + enc.ProcessData(out, plain[i], 8); + fail = memcmp(out, cipher[i], 8) != 0; + + ECB_Mode::Decryption dec((byte *)key[i], strlen(key[i])); + dec.ProcessData(outplain, cipher[i], 8); + fail = fail || memcmp(outplain, plain[i], 8); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << '\"' << key[i] << '\"'; + for (int j=0; j<(signed int)(30-strlen(key[i])); j++) + cout << ' '; + output.Put(outplain, 8); + cout << " "; + output.Put(out, 8); + cout << endl; + } + return pass; +} + +bool ValidateThreeWay() +{ + cout << "\n3-WAY validation suite running...\n\n"; + + FileSource valdata("TestData/3wayval.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); +} + +bool ValidateGOST() +{ + cout << "\nGOST validation suite running...\n\n"; + + FileSource valdata("TestData/gostval.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); +} + +bool ValidateSHARK() +{ + cout << "\nSHARK validation suite running...\n\n"; + + FileSource valdata("TestData/sharkval.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); +} + +bool ValidateCAST() +{ + bool pass = true; + + cout << "\nCAST-128 validation suite running...\n\n"; + + FileSource val128("TestData/cast128v.dat", true, new HexDecoder); + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), val128, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(10), val128, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(5), val128, 1) && pass; + + cout << "\nCAST-256 validation suite running...\n\n"; + + FileSource val256("TestData/cast256v.dat", true, new HexDecoder); + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), val256, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), val256, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(32), val256, 1) && pass; + + return pass; +} + +bool ValidateSquare() +{ + cout << "\nSquare validation suite running...\n\n"; + + FileSource valdata("TestData/squareva.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); +} + +bool ValidateSKIPJACK() +{ + cout << "\nSKIPJACK validation suite running...\n\n"; + + FileSource valdata("TestData/skipjack.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); +} + +bool ValidateSEAL() +{ + byte input[] = {0x37,0xa0,0x05,0x95,0x9b,0x84,0xc4,0x9c,0xa4,0xbe,0x1e,0x05,0x06,0x73,0x53,0x0f,0x5f,0xb0,0x97,0xfd,0xf6,0xa1,0x3f,0xbd,0x6c,0x2c,0xde,0xcd,0x81,0xfd,0xee,0x7c}; + byte output[32]; + byte key[] = {0x67, 0x45, 0x23, 0x01, 0xef, 0xcd, 0xab, 0x89, 0x98, 0xba, 0xdc, 0xfe, 0x10, 0x32, 0x54, 0x76, 0xc3, 0xd2, 0xe1, 0xf0}; + byte iv[] = {0x01, 0x35, 0x77, 0xaf}; + + cout << "\nSEAL validation suite running...\n\n"; + + SEAL<>::Encryption seal(key, sizeof(key), iv); + unsigned int size = sizeof(input); + bool pass = true; + + memset(output, 1, size); + seal.ProcessString(output, input, size); + for (unsigned int i=0; i(16), valdata, 4) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(64), valdata, 10) && pass; + return pass; +} + +bool ValidateCamellia() +{ + cout << "\nCamellia validation suite running...\n\n"; + + bool pass = true; + FileSource valdata("TestData/camellia.dat", true, new HexDecoder); + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 15) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 15) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(32), valdata, 15) && pass; + return pass; +} + +bool ValidateSalsa() +{ + cout << "\nSalsa validation suite running...\n"; + + return RunTestDataFile("TestVectors/salsa.txt"); +} + +bool ValidateSosemanuk() +{ + cout << "\nSosemanuk validation suite running...\n"; + return RunTestDataFile("TestVectors/sosemanuk.txt"); +} + +bool ValidateVMAC() +{ + cout << "\nVMAC validation suite running...\n"; + return RunTestDataFile("TestVectors/vmac.txt"); +} + +bool ValidateCCM() +{ + cout << "\nAES/CCM validation suite running...\n"; + return RunTestDataFile("TestVectors/ccm.txt"); +} + +bool ValidateGCM() +{ + cout << "\nAES/GCM validation suite running...\n"; + cout << "\n2K tables:"; + bool pass = RunTestDataFile("TestVectors/gcm.txt", MakeParameters(Name::TableSize(), (int)2048)); + cout << "\n64K tables:"; + return RunTestDataFile("TestVectors/gcm.txt", MakeParameters(Name::TableSize(), (int)64*1024)) && pass; +} + +bool ValidateCMAC() +{ + cout << "\nCMAC validation suite running...\n"; + return RunTestDataFile("TestVectors/cmac.txt"); +} diff --git a/cryptopp/validat2.cpp b/cryptopp/validat2.cpp new file mode 100644 index 0000000..e752678 --- /dev/null +++ b/cryptopp/validat2.cpp @@ -0,0 +1,764 @@ +// validat2.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" + +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 +#include "blumshub.h" +#include "rsa.h" +#include "md2.h" +#include "elgamal.h" +#include "nr.h" +#include "dsa.h" +#include "dh.h" +#include "mqv.h" +#include "luc.h" +#include "xtrcrypt.h" +#include "rabin.h" +#include "rw.h" +#include "eccrypto.h" +#include "ecp.h" +#include "ec2n.h" +#include "asn.h" +#include "rng.h" +#include "files.h" +#include "hex.h" +#include "oids.h" +#include "esign.h" +#include "osrng.h" + +#include +#include + +#include "validate.h" + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +class FixedRNG : public RandomNumberGenerator +{ +public: + FixedRNG(BufferedTransformation &source) : m_source(source) {} + + void GenerateBlock(byte *output, size_t size) + { + m_source.Get(output, size); + } + +private: + BufferedTransformation &m_source; +}; + +bool ValidateBBS() +{ + cout << "\nBlumBlumShub validation suite running...\n\n"; + + Integer p("212004934506826557583707108431463840565872545889679278744389317666981496005411448865750399674653351"); + Integer q("100677295735404212434355574418077394581488455772477016953458064183204108039226017738610663984508231"); + Integer seed("63239752671357255800299643604761065219897634268887145610573595874544114193025997412441121667211431"); + BlumBlumShub bbs(p, q, seed); + bool pass = true, fail; + int j; + + const byte output1[] = { + 0x49,0xEA,0x2C,0xFD,0xB0,0x10,0x64,0xA0,0xBB,0xB9, + 0x2A,0xF1,0x01,0xDA,0xC1,0x8A,0x94,0xF7,0xB7,0xCE}; + const byte output2[] = { + 0x74,0x45,0x48,0xAE,0xAC,0xB7,0x0E,0xDF,0xAF,0xD7, + 0xD5,0x0E,0x8E,0x29,0x83,0x75,0x6B,0x27,0x46,0xA1}; + + byte buf[20]; + + bbs.GenerateBlock(buf, 20); + fail = memcmp(output1, buf, 20) != 0; + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + for (j=0;j<20;j++) + cout << setw(2) << setfill('0') << hex << (int)buf[j]; + cout << endl; + + bbs.Seek(10); + bbs.GenerateBlock(buf, 10); + fail = memcmp(output1+10, buf, 10) != 0; + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + for (j=0;j<10;j++) + cout << setw(2) << setfill('0') << hex << (int)buf[j]; + cout << endl; + + bbs.Seek(1234567); + bbs.GenerateBlock(buf, 20); + fail = memcmp(output2, buf, 20) != 0; + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + for (j=0;j<20;j++) + cout << setw(2) << setfill('0') << hex << (int)buf[j]; + cout << endl; + + return pass; +} + +bool SignatureValidate(PK_Signer &priv, PK_Verifier &pub, bool thorough = false) +{ + bool pass = true, fail; + + fail = !pub.GetMaterial().Validate(GlobalRNG(), thorough ? 3 : 2) || !priv.GetMaterial().Validate(GlobalRNG(), thorough ? 3 : 2); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "signature key validation\n"; + + const byte *message = (byte *)"test message"; + const int messageLen = 12; + + SecByteBlock signature(priv.MaxSignatureLength()); + size_t signatureLength = priv.SignMessage(GlobalRNG(), message, messageLen, signature); + fail = !pub.VerifyMessage(message, messageLen, signature, signatureLength); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "signature and verification\n"; + + ++signature[0]; + fail = pub.VerifyMessage(message, messageLen, signature, signatureLength); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "checking invalid signature" << endl; + + if (priv.MaxRecoverableLength() > 0) + { + signatureLength = priv.SignMessageWithRecovery(GlobalRNG(), message, messageLen, NULL, 0, signature); + SecByteBlock recovered(priv.MaxRecoverableLengthFromSignatureLength(signatureLength)); + DecodingResult result = pub.RecoverMessage(recovered, NULL, 0, signature, signatureLength); + fail = !(result.isValidCoding && result.messageLength == messageLen && memcmp(recovered, message, messageLen) == 0); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "signature and verification with recovery" << endl; + + ++signature[0]; + result = pub.RecoverMessage(recovered, NULL, 0, signature, signatureLength); + fail = result.isValidCoding; + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "recovery with invalid signature" << endl; + } + + return pass; +} + +bool CryptoSystemValidate(PK_Decryptor &priv, PK_Encryptor &pub, bool thorough = false) +{ + bool pass = true, fail; + + fail = !pub.GetMaterial().Validate(GlobalRNG(), thorough ? 3 : 2) || !priv.GetMaterial().Validate(GlobalRNG(), thorough ? 3 : 2); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "cryptosystem key validation\n"; + + const byte *message = (byte *)"test message"; + const int messageLen = 12; + SecByteBlock ciphertext(priv.CiphertextLength(messageLen)); + SecByteBlock plaintext(priv.MaxPlaintextLength(ciphertext.size())); + + pub.Encrypt(GlobalRNG(), message, messageLen, ciphertext); + fail = priv.Decrypt(GlobalRNG(), ciphertext, priv.CiphertextLength(messageLen), plaintext) != DecodingResult(messageLen); + fail = fail || memcmp(message, plaintext, messageLen); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "encryption and decryption\n"; + + return pass; +} + +bool SimpleKeyAgreementValidate(SimpleKeyAgreementDomain &d) +{ + if (d.GetCryptoParameters().Validate(GlobalRNG(), 3)) + cout << "passed simple key agreement domain parameters validation" << endl; + else + { + cout << "FAILED simple key agreement domain parameters invalid" << endl; + return false; + } + + SecByteBlock priv1(d.PrivateKeyLength()), priv2(d.PrivateKeyLength()); + SecByteBlock pub1(d.PublicKeyLength()), pub2(d.PublicKeyLength()); + SecByteBlock val1(d.AgreedValueLength()), val2(d.AgreedValueLength()); + + d.GenerateKeyPair(GlobalRNG(), priv1, pub1); + d.GenerateKeyPair(GlobalRNG(), priv2, pub2); + + memset(val1.begin(), 0x10, val1.size()); + memset(val2.begin(), 0x11, val2.size()); + + if (!(d.Agree(val1, priv1, pub2) && d.Agree(val2, priv2, pub1))) + { + cout << "FAILED simple key agreement failed" << endl; + return false; + } + + if (memcmp(val1.begin(), val2.begin(), d.AgreedValueLength())) + { + cout << "FAILED simple agreed values not equal" << endl; + return false; + } + + cout << "passed simple key agreement" << endl; + return true; +} + +bool AuthenticatedKeyAgreementValidate(AuthenticatedKeyAgreementDomain &d) +{ + if (d.GetCryptoParameters().Validate(GlobalRNG(), 3)) + cout << "passed authenticated key agreement domain parameters validation" << endl; + else + { + cout << "FAILED authenticated key agreement domain parameters invalid" << endl; + return false; + } + + SecByteBlock spriv1(d.StaticPrivateKeyLength()), spriv2(d.StaticPrivateKeyLength()); + SecByteBlock epriv1(d.EphemeralPrivateKeyLength()), epriv2(d.EphemeralPrivateKeyLength()); + SecByteBlock spub1(d.StaticPublicKeyLength()), spub2(d.StaticPublicKeyLength()); + SecByteBlock epub1(d.EphemeralPublicKeyLength()), epub2(d.EphemeralPublicKeyLength()); + SecByteBlock val1(d.AgreedValueLength()), val2(d.AgreedValueLength()); + + d.GenerateStaticKeyPair(GlobalRNG(), spriv1, spub1); + d.GenerateStaticKeyPair(GlobalRNG(), spriv2, spub2); + d.GenerateEphemeralKeyPair(GlobalRNG(), epriv1, epub1); + d.GenerateEphemeralKeyPair(GlobalRNG(), epriv2, epub2); + + memset(val1.begin(), 0x10, val1.size()); + memset(val2.begin(), 0x11, val2.size()); + + if (!(d.Agree(val1, spriv1, epriv1, spub2, epub2) && d.Agree(val2, spriv2, epriv2, spub1, epub1))) + { + cout << "FAILED authenticated key agreement failed" << endl; + return false; + } + + if (memcmp(val1.begin(), val2.begin(), d.AgreedValueLength())) + { + cout << "FAILED authenticated agreed values not equal" << endl; + return false; + } + + cout << "passed authenticated key agreement" << endl; + return true; +} + +bool ValidateRSA() +{ + cout << "\nRSA validation suite running...\n\n"; + + byte out[100], outPlain[100]; + bool pass = true, fail; + + { + const char *plain = "Everyone gets Friday off."; + byte *signature = (byte *) + "\x05\xfa\x6a\x81\x2f\xc7\xdf\x8b\xf4\xf2\x54\x25\x09\xe0\x3e\x84" + "\x6e\x11\xb9\xc6\x20\xbe\x20\x09\xef\xb4\x40\xef\xbc\xc6\x69\x21" + "\x69\x94\xac\x04\xf3\x41\xb5\x7d\x05\x20\x2d\x42\x8f\xb2\xa2\x7b" + "\x5c\x77\xdf\xd9\xb1\x5b\xfc\x3d\x55\x93\x53\x50\x34\x10\xc1\xe1"; + + FileSource keys("TestData/rsa512a.dat", true, new HexDecoder); + Weak::RSASSA_PKCS1v15_MD2_Signer rsaPriv(keys); + Weak::RSASSA_PKCS1v15_MD2_Verifier rsaPub(rsaPriv); + + size_t signatureLength = rsaPriv.SignMessage(GlobalRNG(), (byte *)plain, strlen(plain), out); + fail = memcmp(signature, out, 64) != 0; + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "signature check against test vector\n"; + + fail = !rsaPub.VerifyMessage((byte *)plain, strlen(plain), out, signatureLength); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "verification check against test vector\n"; + + out[10]++; + fail = rsaPub.VerifyMessage((byte *)plain, strlen(plain), out, signatureLength); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "invalid signature verification\n"; + } + { + FileSource keys("TestData/rsa1024.dat", true, new HexDecoder); + RSAES_PKCS1v15_Decryptor rsaPriv(keys); + RSAES_PKCS1v15_Encryptor rsaPub(rsaPriv); + + pass = CryptoSystemValidate(rsaPriv, rsaPub) && pass; + } + { + RSAES >::Decryptor rsaPriv(GlobalRNG(), 512); + RSAES >::Encryptor rsaPub(rsaPriv); + + pass = CryptoSystemValidate(rsaPriv, rsaPub) && pass; + } + { + byte *plain = (byte *) + "\x54\x85\x9b\x34\x2c\x49\xea\x2a"; + byte *encrypted = (byte *) + "\x14\xbd\xdd\x28\xc9\x83\x35\x19\x23\x80\xe8\xe5\x49\xb1\x58\x2a" + "\x8b\x40\xb4\x48\x6d\x03\xa6\xa5\x31\x1f\x1f\xd5\xf0\xa1\x80\xe4" + "\x17\x53\x03\x29\xa9\x34\x90\x74\xb1\x52\x13\x54\x29\x08\x24\x52" + "\x62\x51"; + byte *oaepSeed = (byte *) + "\xaa\xfd\x12\xf6\x59\xca\xe6\x34\x89\xb4\x79\xe5\x07\x6d\xde\xc2" + "\xf0\x6c\xb5\x8f"; + ByteQueue bq; + bq.Put(oaepSeed, 20); + FixedRNG rng(bq); + + FileSource privFile("TestData/rsa400pv.dat", true, new HexDecoder); + FileSource pubFile("TestData/rsa400pb.dat", true, new HexDecoder); + RSAES_OAEP_SHA_Decryptor rsaPriv; + rsaPriv.AccessKey().BERDecodePrivateKey(privFile, false, 0); + RSAES_OAEP_SHA_Encryptor rsaPub(pubFile); + + memset(out, 0, 50); + memset(outPlain, 0, 8); + rsaPub.Encrypt(rng, plain, 8, out); + DecodingResult result = rsaPriv.FixedLengthDecrypt(GlobalRNG(), encrypted, outPlain); + fail = !result.isValidCoding || (result.messageLength!=8) || memcmp(out, encrypted, 50) || memcmp(plain, outPlain, 8); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "PKCS 2.0 encryption and decryption\n"; + } + + return pass; +} + +bool ValidateDH() +{ + cout << "\nDH validation suite running...\n\n"; + + FileSource f("TestData/dh1024.dat", true, new HexDecoder()); + DH dh(f); + return SimpleKeyAgreementValidate(dh); +} + +bool ValidateMQV() +{ + cout << "\nMQV validation suite running...\n\n"; + + FileSource f("TestData/mqv1024.dat", true, new HexDecoder()); + MQV mqv(f); + return AuthenticatedKeyAgreementValidate(mqv); +} + +bool ValidateLUC_DH() +{ + cout << "\nLUC-DH validation suite running...\n\n"; + + FileSource f("TestData/lucd512.dat", true, new HexDecoder()); + LUC_DH dh(f); + return SimpleKeyAgreementValidate(dh); +} + +bool ValidateXTR_DH() +{ + cout << "\nXTR-DH validation suite running...\n\n"; + + FileSource f("TestData/xtrdh171.dat", true, new HexDecoder()); + XTR_DH dh(f); + return SimpleKeyAgreementValidate(dh); +} + +bool ValidateElGamal() +{ + cout << "\nElGamal validation suite running...\n\n"; + bool pass = true; + { + FileSource fc("TestData/elgc1024.dat", true, new HexDecoder); + ElGamalDecryptor privC(fc); + ElGamalEncryptor pubC(privC); + privC.AccessKey().Precompute(); + ByteQueue queue; + privC.AccessKey().SavePrecomputation(queue); + privC.AccessKey().LoadPrecomputation(queue); + + pass = CryptoSystemValidate(privC, pubC) && pass; + } + return pass; +} + +bool ValidateDLIES() +{ + cout << "\nDLIES validation suite running...\n\n"; + bool pass = true; + { + FileSource fc("TestData/dlie1024.dat", true, new HexDecoder); + DLIES<>::Decryptor privC(fc); + DLIES<>::Encryptor pubC(privC); + pass = CryptoSystemValidate(privC, pubC) && pass; + } + { + cout << "Generating new encryption key..." << endl; + DLIES<>::GroupParameters gp; + gp.GenerateRandomWithKeySize(GlobalRNG(), 128); + DLIES<>::Decryptor decryptor; + decryptor.AccessKey().GenerateRandom(GlobalRNG(), gp); + DLIES<>::Encryptor encryptor(decryptor); + + pass = CryptoSystemValidate(decryptor, encryptor) && pass; + } + return pass; +} + +bool ValidateNR() +{ + cout << "\nNR validation suite running...\n\n"; + bool pass = true; + { + FileSource f("TestData/nr2048.dat", true, new HexDecoder); + NR::Signer privS(f); + privS.AccessKey().Precompute(); + NR::Verifier pubS(privS); + + pass = SignatureValidate(privS, pubS) && pass; + } + { + cout << "Generating new signature key..." << endl; + NR::Signer privS(GlobalRNG(), 256); + NR::Verifier pubS(privS); + + pass = SignatureValidate(privS, pubS) && pass; + } + return pass; +} + +bool ValidateDSA(bool thorough) +{ + cout << "\nDSA validation suite running...\n\n"; + + bool pass = true, fail; + { + FileSource fs("TestData/dsa512.dat", true, new HexDecoder()); + GDSA::Signer priv(fs); + priv.AccessKey().Precompute(16); + GDSA::Verifier pub(priv); + + byte seed[]={0xd5, 0x01, 0x4e, 0x4b, 0x60, 0xef, 0x2b, 0xa8, 0xb6, 0x21, + 0x1b, 0x40, 0x62, 0xba, 0x32, 0x24, 0xe0, 0x42, 0x7d, 0xd3}; + Integer k("358dad57 1462710f 50e254cf 1a376b2b deaadfbfh"); + Integer h("a9993e36 4706816a ba3e2571 7850c26c 9cd0d89dh"); + byte sig[]={0x8b, 0xac, 0x1a, 0xb6, 0x64, 0x10, 0x43, 0x5c, 0xb7, 0x18, + 0x1f, 0x95, 0xb1, 0x6a, 0xb9, 0x7c, 0x92, 0xb3, 0x41, 0xc0, + 0x41, 0xe2, 0x34, 0x5f, 0x1f, 0x56, 0xdf, 0x24, 0x58, 0xf4, + 0x26, 0xd1, 0x55, 0xb4, 0xba, 0x2d, 0xb6, 0xdc, 0xd8, 0xc8}; + Integer r(sig, 20); + Integer s(sig+20, 20); + + Integer pGen, qGen, rOut, sOut; + int c; + + fail = !DSA::GeneratePrimes(seed, 160, c, pGen, 512, qGen); + fail = fail || (pGen != pub.GetKey().GetGroupParameters().GetModulus()) || (qGen != pub.GetKey().GetGroupParameters().GetSubgroupOrder()); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "prime generation test\n"; + + priv.RawSign(k, h, rOut, sOut); + fail = (rOut != r) || (sOut != s); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "signature check against test vector\n"; + + fail = !pub.VerifyMessage((byte *)"abc", 3, sig, sizeof(sig)); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "verification check against test vector\n"; + + fail = pub.VerifyMessage((byte *)"xyz", 3, sig, sizeof(sig)); + pass = pass && !fail; + } + FileSource fs1("TestData/dsa1024.dat", true, new HexDecoder()); + DSA::Signer priv(fs1); + DSA::Verifier pub(priv); + FileSource fs2("TestData/dsa1024b.dat", true, new HexDecoder()); + DSA::Verifier pub1(fs2); + assert(pub.GetKey() == pub1.GetKey()); + pass = SignatureValidate(priv, pub, thorough) && pass; + return pass; +} + +bool ValidateLUC() +{ + cout << "\nLUC validation suite running...\n\n"; + bool pass=true; + + { + FileSource f("TestData/luc1024.dat", true, new HexDecoder); + LUCSSA_PKCS1v15_SHA_Signer priv(f); + LUCSSA_PKCS1v15_SHA_Verifier pub(priv); + pass = SignatureValidate(priv, pub) && pass; + } + { + LUCES_OAEP_SHA_Decryptor priv(GlobalRNG(), 512); + LUCES_OAEP_SHA_Encryptor pub(priv); + pass = CryptoSystemValidate(priv, pub) && pass; + } + return pass; +} + +bool ValidateLUC_DL() +{ + cout << "\nLUC-HMP validation suite running...\n\n"; + + FileSource f("TestData/lucs512.dat", true, new HexDecoder); + LUC_HMP::Signer privS(f); + LUC_HMP::Verifier pubS(privS); + bool pass = SignatureValidate(privS, pubS); + + cout << "\nLUC-IES validation suite running...\n\n"; + + FileSource fc("TestData/lucc512.dat", true, new HexDecoder); + LUC_IES<>::Decryptor privC(fc); + LUC_IES<>::Encryptor pubC(privC); + pass = CryptoSystemValidate(privC, pubC) && pass; + + return pass; +} + +bool ValidateRabin() +{ + cout << "\nRabin validation suite running...\n\n"; + bool pass=true; + + { + FileSource f("TestData/rabi1024.dat", true, new HexDecoder); + RabinSS::Signer priv(f); + RabinSS::Verifier pub(priv); + pass = SignatureValidate(priv, pub) && pass; + } + { + RabinES >::Decryptor priv(GlobalRNG(), 512); + RabinES >::Encryptor pub(priv); + pass = CryptoSystemValidate(priv, pub) && pass; + } + return pass; +} + +bool ValidateRW() +{ + cout << "\nRW validation suite running...\n\n"; + + FileSource f("TestData/rw1024.dat", true, new HexDecoder); + RWSS::Signer priv(f); + RWSS::Verifier pub(priv); + + return SignatureValidate(priv, pub); +} + +/* +bool ValidateBlumGoldwasser() +{ + cout << "\nBlumGoldwasser validation suite running...\n\n"; + + FileSource f("TestData/blum512.dat", true, new HexDecoder); + BlumGoldwasserPrivateKey priv(f); + BlumGoldwasserPublicKey pub(priv); + + return CryptoSystemValidate(priv, pub); +} +*/ + +bool ValidateECP() +{ + cout << "\nECP validation suite running...\n\n"; + + ECIES::Decryptor cpriv(GlobalRNG(), ASN1::secp192r1()); + ECIES::Encryptor cpub(cpriv); + ByteQueue bq; + cpriv.GetKey().DEREncode(bq); + cpub.AccessKey().AccessGroupParameters().SetEncodeAsOID(true); + cpub.GetKey().DEREncode(bq); + ECDSA::Signer spriv(bq); + ECDSA::Verifier spub(bq); + ECDH::Domain ecdhc(ASN1::secp192r1()); + ECMQV::Domain ecmqvc(ASN1::secp192r1()); + + spriv.AccessKey().Precompute(); + ByteQueue queue; + spriv.AccessKey().SavePrecomputation(queue); + spriv.AccessKey().LoadPrecomputation(queue); + + bool pass = SignatureValidate(spriv, spub); + cpub.AccessKey().Precompute(); + cpriv.AccessKey().Precompute(); + pass = CryptoSystemValidate(cpriv, cpub) && pass; + pass = SimpleKeyAgreementValidate(ecdhc) && pass; + pass = AuthenticatedKeyAgreementValidate(ecmqvc) && pass; + + cout << "Turning on point compression..." << endl; + cpriv.AccessKey().AccessGroupParameters().SetPointCompression(true); + cpub.AccessKey().AccessGroupParameters().SetPointCompression(true); + ecdhc.AccessGroupParameters().SetPointCompression(true); + ecmqvc.AccessGroupParameters().SetPointCompression(true); + pass = CryptoSystemValidate(cpriv, cpub) && pass; + pass = SimpleKeyAgreementValidate(ecdhc) && pass; + pass = AuthenticatedKeyAgreementValidate(ecmqvc) && pass; + + cout << "Testing SEC 2, NIST, and Brainpool recommended curves..." << endl; + OID oid; + while (!(oid = DL_GroupParameters_EC::GetNextRecommendedParametersOID(oid)).m_values.empty()) + { + DL_GroupParameters_EC params(oid); + bool fail = !params.Validate(GlobalRNG(), 2); + cout << (fail ? "FAILED" : "passed") << " " << dec << params.GetCurve().GetField().MaxElementBitLength() << " bits" << endl; + pass = pass && !fail; + } + + return pass; +} + +bool ValidateEC2N() +{ + cout << "\nEC2N validation suite running...\n\n"; + + ECIES::Decryptor cpriv(GlobalRNG(), ASN1::sect193r1()); + ECIES::Encryptor cpub(cpriv); + ByteQueue bq; + cpriv.DEREncode(bq); + cpub.AccessKey().AccessGroupParameters().SetEncodeAsOID(true); + cpub.DEREncode(bq); + ECDSA::Signer spriv(bq); + ECDSA::Verifier spub(bq); + ECDH::Domain ecdhc(ASN1::sect193r1()); + ECMQV::Domain ecmqvc(ASN1::sect193r1()); + + spriv.AccessKey().Precompute(); + ByteQueue queue; + spriv.AccessKey().SavePrecomputation(queue); + spriv.AccessKey().LoadPrecomputation(queue); + + bool pass = SignatureValidate(spriv, spub); + pass = CryptoSystemValidate(cpriv, cpub) && pass; + pass = SimpleKeyAgreementValidate(ecdhc) && pass; + pass = AuthenticatedKeyAgreementValidate(ecmqvc) && pass; + + cout << "Turning on point compression..." << endl; + cpriv.AccessKey().AccessGroupParameters().SetPointCompression(true); + cpub.AccessKey().AccessGroupParameters().SetPointCompression(true); + ecdhc.AccessGroupParameters().SetPointCompression(true); + ecmqvc.AccessGroupParameters().SetPointCompression(true); + pass = CryptoSystemValidate(cpriv, cpub) && pass; + pass = SimpleKeyAgreementValidate(ecdhc) && pass; + pass = AuthenticatedKeyAgreementValidate(ecmqvc) && pass; + +#if 0 // TODO: turn this back on when I make EC2N faster for pentanomial basis + cout << "Testing SEC 2 recommended curves..." << endl; + OID oid; + while (!(oid = DL_GroupParameters_EC::GetNextRecommendedParametersOID(oid)).m_values.empty()) + { + DL_GroupParameters_EC params(oid); + bool fail = !params.Validate(GlobalRNG(), 2); + cout << (fail ? "FAILED" : "passed") << " " << params.GetCurve().GetField().MaxElementBitLength() << " bits" << endl; + pass = pass && !fail; + } +#endif + + return pass; +} + +bool ValidateECDSA() +{ + cout << "\nECDSA validation suite running...\n\n"; + + // from Sample Test Vectors for P1363 + GF2NT gf2n(191, 9, 0); + byte a[]="\x28\x66\x53\x7B\x67\x67\x52\x63\x6A\x68\xF5\x65\x54\xE1\x26\x40\x27\x6B\x64\x9E\xF7\x52\x62\x67"; + byte b[]="\x2E\x45\xEF\x57\x1F\x00\x78\x6F\x67\xB0\x08\x1B\x94\x95\xA3\xD9\x54\x62\xF5\xDE\x0A\xA1\x85\xEC"; + EC2N ec(gf2n, PolynomialMod2(a,24), PolynomialMod2(b,24)); + + EC2N::Point P; + ec.DecodePoint(P, (byte *)"\x04\x36\xB3\xDA\xF8\xA2\x32\x06\xF9\xC4\xF2\x99\xD7\xB2\x1A\x9C\x36\x91\x37\xF2\xC8\x4A\xE1\xAA\x0D" + "\x76\x5B\xE7\x34\x33\xB3\xF9\x5E\x33\x29\x32\xE7\x0E\xA2\x45\xCA\x24\x18\xEA\x0E\xF9\x80\x18\xFB", ec.EncodedPointSize()); + Integer n("40000000000000000000000004a20e90c39067c893bbb9a5H"); + Integer d("340562e1dda332f9d2aec168249b5696ee39d0ed4d03760fH"); + EC2N::Point Q(ec.Multiply(d, P)); + ECDSA::Signer priv(ec, P, n, d); + ECDSA::Verifier pub(priv); + + Integer h("A9993E364706816ABA3E25717850C26C9CD0D89DH"); + Integer k("3eeace72b4919d991738d521879f787cb590aff8189d2b69H"); + byte sig[]="\x03\x8e\x5a\x11\xfb\x55\xe4\xc6\x54\x71\xdc\xd4\x99\x84\x52\xb1\xe0\x2d\x8a\xf7\x09\x9b\xb9\x30" + "\x0c\x9a\x08\xc3\x44\x68\xc2\x44\xb4\xe5\xd6\xb2\x1b\x3c\x68\x36\x28\x07\x41\x60\x20\x32\x8b\x6e"; + Integer r(sig, 24); + Integer s(sig+24, 24); + + Integer rOut, sOut; + bool fail, pass=true; + + priv.RawSign(k, h, rOut, sOut); + fail = (rOut != r) || (sOut != s); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "signature check against test vector\n"; + + fail = !pub.VerifyMessage((byte *)"abc", 3, sig, sizeof(sig)); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "verification check against test vector\n"; + + fail = pub.VerifyMessage((byte *)"xyz", 3, sig, sizeof(sig)); + pass = pass && !fail; + + pass = SignatureValidate(priv, pub) && pass; + + return pass; +} + +bool ValidateESIGN() +{ + cout << "\nESIGN validation suite running...\n\n"; + + bool pass = true, fail; + + const char *plain = "test"; + const byte *signature = (byte *) + "\xA3\xE3\x20\x65\xDE\xDA\xE7\xEC\x05\xC1\xBF\xCD\x25\x79\x7D\x99\xCD\xD5\x73\x9D\x9D\xF3\xA4\xAA\x9A\xA4\x5A\xC8\x23\x3D\x0D\x37\xFE\xBC\x76\x3F\xF1\x84\xF6\x59" + "\x14\x91\x4F\x0C\x34\x1B\xAE\x9A\x5C\x2E\x2E\x38\x08\x78\x77\xCB\xDC\x3C\x7E\xA0\x34\x44\x5B\x0F\x67\xD9\x35\x2A\x79\x47\x1A\x52\x37\x71\xDB\x12\x67\xC1\xB6\xC6" + "\x66\x73\xB3\x40\x2E\xD6\xF2\x1A\x84\x0A\xB6\x7B\x0F\xEB\x8B\x88\xAB\x33\xDD\xE4\x83\x21\x90\x63\x2D\x51\x2A\xB1\x6F\xAB\xA7\x5C\xFD\x77\x99\xF2\xE1\xEF\x67\x1A" + "\x74\x02\x37\x0E\xED\x0A\x06\xAD\xF4\x15\x65\xB8\xE1\xD1\x45\xAE\x39\x19\xB4\xFF\x5D\xF1\x45\x7B\xE0\xFE\x72\xED\x11\x92\x8F\x61\x41\x4F\x02\x00\xF2\x76\x6F\x7C" + "\x79\xA2\xE5\x52\x20\x5D\x97\x5E\xFE\x39\xAE\x21\x10\xFB\x35\xF4\x80\x81\x41\x13\xDD\xE8\x5F\xCA\x1E\x4F\xF8\x9B\xB2\x68\xFB\x28"; + + FileSource keys("TestData/esig1536.dat", true, new HexDecoder); + ESIGN::Signer signer(keys); + ESIGN::Verifier verifier(signer); + + fail = !SignatureValidate(signer, verifier); + pass = pass && !fail; + + fail = !verifier.VerifyMessage((byte *)plain, strlen(plain), signature, verifier.SignatureLength()); + pass = pass && !fail; + + cout << (fail ? "FAILED " : "passed "); + cout << "verification check against test vector\n"; + + cout << "Generating signature key from seed..." << endl; + signer.AccessKey().GenerateRandom(GlobalRNG(), MakeParameters("Seed", ConstByteArrayParameter((const byte *)"test", 4))("KeySize", 3*512)); + verifier = signer; + + fail = !SignatureValidate(signer, verifier); + pass = pass && !fail; + + return pass; +} diff --git a/cryptopp/validat3.cpp b/cryptopp/validat3.cpp new file mode 100644 index 0000000..209741c --- /dev/null +++ b/cryptopp/validat3.cpp @@ -0,0 +1,675 @@ +// validat3.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "validate.h" + +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 +#include "smartptr.h" +#include "crc.h" +#include "adler32.h" +#include "md2.h" +#include "md4.h" +#include "md5.h" +#include "sha.h" +#include "tiger.h" +#include "ripemd.h" + +#include "hmac.h" +#include "ttmac.h" + +#include "integer.h" +#include "pwdbased.h" +#include "filters.h" +#include "hex.h" +#include "files.h" + +#include +#include + +USING_NAMESPACE(CryptoPP) +USING_NAMESPACE(std) + +struct HashTestTuple +{ + HashTestTuple(const char *input, const char *output, unsigned int repeatTimes=1) + : input((byte *)input), output((byte *)output), inputLen(strlen(input)), repeatTimes(repeatTimes) {} + + HashTestTuple(const char *input, unsigned int inputLen, const char *output, unsigned int repeatTimes) + : input((byte *)input), output((byte *)output), inputLen(inputLen), repeatTimes(repeatTimes) {} + + const byte *input, *output; + size_t inputLen; + unsigned int repeatTimes; +}; + +bool HashModuleTest(HashTransformation &md, const HashTestTuple *testSet, unsigned int testSetSize) +{ + bool pass=true, fail; + SecByteBlock digest(md.DigestSize()); + + for (unsigned int i=0; i HMAC_MD5; + + const char* keys[]= + { + "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", + "Jefe", + "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA", + "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" + "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" + "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" + "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" + "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" + }; + + HashTestTuple testSet[] = + { + HashTestTuple("Hi There", "\x92\x94\x72\x7a\x36\x38\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d"), + HashTestTuple("what do ya want for nothing?", "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7\x38"), + HashTestTuple("\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD", + "\x56\xbe\x34\x52\x1d\x14\x4c\x88\xdb\xb8\xc7\x33\xf0\xe8\xb3\xf6"), + HashTestTuple("Test Using Larger Than Block-Size Key - Hash Key First", "\x6b\x1a\xb7\xfe\x4b\xd7\xbf\x8f\x0b\x62\xe6\xce\x61\xb9\xd0\xcd") + }; + + bool pass=true; + + cout << "\nHMAC/MD5 validation suite running...\n"; + + for (int k=0; k<4; k++) + { + HMAC_MD5 mac((byte *)keys[k], strlen(keys[k])); + cout << "\nKEY: "; + for (int j=0; keys[k][j] != 0; j++) + cout << setw(2) << setfill('0') << hex << (int)(byte)keys[k][j]; + cout << endl; + + pass = HashModuleTest(mac, testSet+k, 1) && pass; + } + + return pass; +} + +#ifdef CRYPTOPP_REMOVED +bool ValidateXMACC() +{ + typedef XMACC XMACC_MD5; + + const byte keys[2][XMACC_MD5::KEYLENGTH]={ + {0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb}, + {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba,0x98}}; + + const word32 counters[2]={0xccddeeff, 0x76543210}; + + const char *TestVals[7]={ + "", + "a", + "abc", + "message digest", + "abcdefghijklmnopqrstuvwxyz", + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "12345678901234567890123456789012345678901234567890123456789012345678901234567890"}; + + const byte output[2][7][XMACC_MD5::DIGESTSIZE]={ + {{0xcc,0xdd,0xef,0x00,0xfa,0x89,0x54,0x92,0x86,0x32,0xda,0x2a,0x3f,0x29,0xc5,0x52,0xa0,0x0d,0x05,0x13}, + {0xcc,0xdd,0xef,0x01,0xae,0xdb,0x8b,0x7b,0x69,0x71,0xc7,0x91,0x71,0x48,0x9d,0x18,0xe7,0xdf,0x9d,0x5a}, + {0xcc,0xdd,0xef,0x02,0x5e,0x01,0x2e,0x2e,0x4b,0xc3,0x83,0x62,0xc2,0xf4,0xe6,0x18,0x1c,0x44,0xaf,0xca}, + {0xcc,0xdd,0xef,0x03,0x3e,0xa9,0xf1,0xe0,0x97,0x91,0xf8,0xe2,0xbe,0xe0,0xdf,0xf3,0x41,0x03,0xb3,0x5a}, + {0xcc,0xdd,0xef,0x04,0x2e,0x6a,0x8d,0xb9,0x72,0xe3,0xce,0x9f,0xf4,0x28,0x45,0xe7,0xbc,0x80,0xa9,0xc7}, + {0xcc,0xdd,0xef,0x05,0x1a,0xd5,0x40,0x78,0xfb,0x16,0x37,0xfc,0x7a,0x1d,0xce,0xb4,0x77,0x10,0xb2,0xa0}, + {0xcc,0xdd,0xef,0x06,0x13,0x2f,0x11,0x47,0xd7,0x1b,0xb5,0x52,0x36,0x51,0x26,0xb0,0x96,0xd7,0x60,0x81}}, + {{0x76,0x54,0x32,0x11,0xe9,0xcb,0x74,0x32,0x07,0x93,0xfe,0x01,0xdd,0x27,0xdb,0xde,0x6b,0x77,0xa4,0x56}, + {0x76,0x54,0x32,0x12,0xcd,0x55,0x87,0x5c,0xc0,0x35,0x85,0x99,0x44,0x02,0xa5,0x0b,0x8c,0xe7,0x2c,0x68}, + {0x76,0x54,0x32,0x13,0xac,0xfd,0x87,0x50,0xc3,0x8f,0xcd,0x58,0xaa,0xa5,0x7e,0x7a,0x25,0x63,0x26,0xd1}, + {0x76,0x54,0x32,0x14,0xe3,0x30,0xf5,0xdd,0x27,0x2b,0x76,0x22,0x7f,0xaa,0x90,0x73,0x6a,0x48,0xdb,0x00}, + {0x76,0x54,0x32,0x15,0xfc,0x57,0x00,0x20,0x7c,0x9d,0xf6,0x30,0x6f,0xbd,0x46,0x3e,0xfb,0x8a,0x2c,0x60}, + {0x76,0x54,0x32,0x16,0xfb,0x0f,0xd3,0xdf,0x4c,0x4b,0xc3,0x05,0x9d,0x63,0x1e,0xba,0x25,0x2b,0xbe,0x35}, + {0x76,0x54,0x32,0x17,0xc6,0xfe,0xe6,0x5f,0xb1,0x35,0x8a,0xf5,0x32,0x7a,0x80,0xbd,0xb8,0x72,0xee,0xae}}}; + + byte digest[XMACC_MD5::DIGESTSIZE]; + bool pass=true, fail; + + cout << "\nXMACC/MD5 validation suite running...\n"; + + for (int k=0; k<2; k++) + { + XMACC_MD5 mac(keys[k], counters[k]); + cout << "\nKEY: "; + for (int j=0;j pbkdf; + + cout << "\nPKCS #12 PBKDF validation suite running...\n\n"; + pass = TestPBKDF(pbkdf, testSet, sizeof(testSet)/sizeof(testSet[0])) && pass; + } + + { + // from draft-ietf-smime-password-03.txt, at http://www.imc.org/draft-ietf-smime-password + PBKDF_TestTuple testSet[] = + { + {0, 5, "70617373776f7264", "1234567878563412", "D1DAA78615F287E6"}, + {0, 500, "416C6C206E2D656E746974696573206D75737420636F6D6D756E69636174652077697468206F74686572206E2d656E74697469657320766961206E2D3120656E746974656568656568656573", "1234567878563412","6A8970BF68C92CAEA84A8DF28510858607126380CC47AB2D"} + }; + + PKCS5_PBKDF2_HMAC pbkdf; + + cout << "\nPKCS #5 PBKDF2 validation suite running...\n\n"; + pass = TestPBKDF(pbkdf, testSet, sizeof(testSet)/sizeof(testSet[0])) && pass; + } + + return pass; +} diff --git a/cryptopp/validate.h b/cryptopp/validate.h new file mode 100644 index 0000000..6853407 --- /dev/null +++ b/cryptopp/validate.h @@ -0,0 +1,81 @@ +#ifndef CRYPTOPP_VALIDATE_H +#define CRYPTOPP_VALIDATE_H + +#include "cryptlib.h" + +bool ValidateAll(bool thorough); +bool TestSettings(); +bool TestOS_RNG(); +bool ValidateBaseCode(); + +bool ValidateCRC32(); +bool ValidateAdler32(); +bool ValidateMD2(); +bool ValidateMD4(); +bool ValidateMD5(); +bool ValidateSHA(); +bool ValidateSHA2(); +bool ValidateTiger(); +bool ValidateRIPEMD(); +bool ValidatePanama(); +bool ValidateWhirlpool(); + +bool ValidateHMAC(); +bool ValidateTTMAC(); + +bool ValidateCipherModes(); +bool ValidatePBKDF(); + +bool ValidateDES(); +bool ValidateIDEA(); +bool ValidateSAFER(); +bool ValidateRC2(); +bool ValidateARC4(); + +bool ValidateRC5(); +bool ValidateBlowfish(); +bool ValidateThreeWay(); +bool ValidateGOST(); +bool ValidateSHARK(); +bool ValidateSEAL(); +bool ValidateCAST(); +bool ValidateSquare(); +bool ValidateSKIPJACK(); +bool ValidateRC6(); +bool ValidateMARS(); +bool ValidateRijndael(); +bool ValidateTwofish(); +bool ValidateSerpent(); +bool ValidateSHACAL2(); +bool ValidateCamellia(); +bool ValidateSalsa(); +bool ValidateSosemanuk(); +bool ValidateVMAC(); +bool ValidateCCM(); +bool ValidateGCM(); +bool ValidateCMAC(); + +bool ValidateBBS(); +bool ValidateDH(); +bool ValidateMQV(); +bool ValidateRSA(); +bool ValidateElGamal(); +bool ValidateDLIES(); +bool ValidateNR(); +bool ValidateDSA(bool thorough); +bool ValidateLUC(); +bool ValidateLUC_DL(); +bool ValidateLUC_DH(); +bool ValidateXTR_DH(); +bool ValidateRabin(); +bool ValidateRW(); +//bool ValidateBlumGoldwasser(); +bool ValidateECP(); +bool ValidateEC2N(); +bool ValidateECDSA(); +bool ValidateESIGN(); + +CryptoPP::RandomNumberGenerator & GlobalRNG(); +bool RunTestDataFile(const char *filename, const CryptoPP::NameValuePairs &overrideParameters=CryptoPP::g_nullNameValuePairs); + +#endif diff --git a/cryptopp/vmac.cpp b/cryptopp/vmac.cpp new file mode 100644 index 0000000..6b490f9 --- /dev/null +++ b/cryptopp/vmac.cpp @@ -0,0 +1,832 @@ +// vmac.cpp - written and placed in the public domain by Wei Dai +// based on Ted Krovetz's public domain vmac.c and draft-krovetz-vmac-01.txt + +#include "pch.h" +#include "vmac.h" +#include "argnames.h" +#include "cpu.h" + +NAMESPACE_BEGIN(CryptoPP) + +#if defined(_MSC_VER) && !CRYPTOPP_BOOL_SLOW_WORD64 +#include +#endif + +#define VMAC_BOOL_WORD128 (defined(CRYPTOPP_WORD128_AVAILABLE) && !defined(CRYPTOPP_X64_ASM_AVAILABLE)) +#ifdef __BORLANDC__ +#define const // Turbo C++ 2006 workaround +#endif +static const word64 p64 = W64LIT(0xfffffffffffffeff); /* 2^64 - 257 prime */ +static const word64 m62 = W64LIT(0x3fffffffffffffff); /* 62-bit mask */ +static const word64 m63 = W64LIT(0x7fffffffffffffff); /* 63-bit mask */ +static const word64 m64 = W64LIT(0xffffffffffffffff); /* 64-bit mask */ +static const word64 mpoly = W64LIT(0x1fffffff1fffffff); /* Poly key mask */ +#ifdef __BORLANDC__ +#undef const +#endif +#if VMAC_BOOL_WORD128 +#ifdef __powerpc__ +// workaround GCC Bug 31690: ICE with const __uint128_t and C++ front-end +#define m126 ((word128(m62)<<64)|m64) +#else +static const word128 m126 = (word128(m62)<<64)|m64; /* 126-bit mask */ +#endif +#endif + +void VMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs ¶ms) +{ + int digestLength = params.GetIntValueWithDefault(Name::DigestSize(), DefaultDigestSize()); + if (digestLength != 8 && digestLength != 16) + throw InvalidArgument("VMAC: DigestSize must be 8 or 16"); + m_is128 = digestLength == 16; + + m_L1KeyLength = params.GetIntValueWithDefault(Name::L1KeyLength(), 128); + if (m_L1KeyLength <= 0 || m_L1KeyLength % 128 != 0) + throw InvalidArgument("VMAC: L1KeyLength must be a positive multiple of 128"); + + AllocateBlocks(); + + BlockCipher &cipher = AccessCipher(); + cipher.SetKey(userKey, keylength, params); + unsigned int blockSize = cipher.BlockSize(); + unsigned int blockSizeInWords = blockSize / sizeof(word64); + SecBlock out(blockSizeInWords); + SecByteBlock in; + in.CleanNew(blockSize); + size_t i; + + /* Fill nh key */ + in[0] = 0x80; + cipher.AdvancedProcessBlocks(in, NULL, (byte *)m_nhKey(), m_nhKeySize()*sizeof(word64), cipher.BT_InBlockIsCounter); + ConditionalByteReverse(BIG_ENDIAN_ORDER, m_nhKey(), m_nhKey(), m_nhKeySize()*sizeof(word64)); + + /* Fill poly key */ + in[0] = 0xC0; + in[15] = 0; + for (i = 0; i <= (size_t)m_is128; i++) + { + cipher.ProcessBlock(in, out.BytePtr()); + m_polyState()[i*4+2] = GetWord(true, BIG_ENDIAN_ORDER, out.BytePtr()) & mpoly; + m_polyState()[i*4+3] = GetWord(true, BIG_ENDIAN_ORDER, out.BytePtr()+8) & mpoly; + in[15]++; + } + + /* Fill ip key */ + in[0] = 0xE0; + in[15] = 0; + word64 *l3Key = m_l3Key(); + for (i = 0; i <= (size_t)m_is128; i++) + do + { + cipher.ProcessBlock(in, out.BytePtr()); + l3Key[i*2+0] = GetWord(true, BIG_ENDIAN_ORDER, out.BytePtr()); + l3Key[i*2+1] = GetWord(true, BIG_ENDIAN_ORDER, out.BytePtr()+8); + in[15]++; + } while ((l3Key[i*2+0] >= p64) || (l3Key[i*2+1] >= p64)); + + m_padCached = false; + size_t nonceLength; + const byte *nonce = GetIVAndThrowIfInvalid(params, nonceLength); + Resynchronize(nonce, (int)nonceLength); +} + +void VMAC_Base::GetNextIV(RandomNumberGenerator &rng, byte *IV) +{ + SimpleKeyingInterface::GetNextIV(rng, IV); + IV[0] &= 0x7f; +} + +void VMAC_Base::Resynchronize(const byte *nonce, int len) +{ + size_t length = ThrowIfInvalidIVLength(len); + size_t s = IVSize(); + byte *storedNonce = m_nonce(); + + if (m_is128) + { + memset(storedNonce, 0, s-length); + memcpy(storedNonce+s-length, nonce, length); + AccessCipher().ProcessBlock(storedNonce, m_pad()); + } + else + { + if (m_padCached && (storedNonce[s-1] | 1) == (nonce[length-1] | 1)) + { + m_padCached = VerifyBufsEqual(storedNonce+s-length, nonce, length-1); + for (size_t i=0; m_padCached && i>64); rl = word64(p);} + #define AccumulateNH(a, b, c) a += word128(b)*(c) + #define Multiply128(r, i1, i2) r = word128(word64(i1)) * word64(i2) +#else + #if _MSC_VER >= 1400 && !defined(__INTEL_COMPILER) + #define MUL32(a, b) __emulu(word32(a), word32(b)) + #else + #define MUL32(a, b) ((word64)((word32)(a)) * (word32)(b)) + #endif + #if defined(CRYPTOPP_X64_ASM_AVAILABLE) + #define DeclareNH(a) word64 a##0=0, a##1=0 + #define MUL64(rh,rl,i1,i2) asm ("mulq %3" : "=a"(rl), "=d"(rh) : "a"(i1), "g"(i2) : "cc"); + #define AccumulateNH(a, b, c) asm ("mulq %3; addq %%rax, %0; adcq %%rdx, %1" : "+r"(a##0), "+r"(a##1) : "a"(b), "g"(c) : "%rdx", "cc"); + #define ADD128(rh,rl,ih,il) asm ("addq %3, %1; adcq %2, %0" : "+r"(rh),"+r"(rl) : "r"(ih),"r"(il) : "cc"); + #elif defined(_MSC_VER) && !CRYPTOPP_BOOL_SLOW_WORD64 + #define DeclareNH(a) word64 a##0=0, a##1=0 + #define MUL64(rh,rl,i1,i2) (rl) = _umul128(i1,i2,&(rh)); + #define AccumulateNH(a, b, c) {\ + word64 ph, pl;\ + pl = _umul128(b,c,&ph);\ + a##0 += pl;\ + a##1 += ph + (a##0 < pl);} + #else + #define VMAC_BOOL_32BIT 1 + #define DeclareNH(a) word64 a##0=0, a##1=0, a##2=0 + #define MUL64(rh,rl,i1,i2) \ + { word64 _i1 = (i1), _i2 = (i2); \ + word64 m1= MUL32(_i1,_i2>>32); \ + word64 m2= MUL32(_i1>>32,_i2); \ + rh = MUL32(_i1>>32,_i2>>32); \ + rl = MUL32(_i1,_i2); \ + ADD128(rh,rl,(m1 >> 32),(m1 << 32)); \ + ADD128(rh,rl,(m2 >> 32),(m2 << 32)); \ + } + #define AccumulateNH(a, b, c) {\ + word64 p = MUL32(b, c);\ + a##1 += word32((p)>>32);\ + a##0 += word32(p);\ + p = MUL32((b)>>32, c);\ + a##2 += word32((p)>>32);\ + a##1 += word32(p);\ + p = MUL32((b)>>32, (c)>>32);\ + a##2 += p;\ + p = MUL32(b, (c)>>32);\ + a##1 += word32(p);\ + a##2 += word32(p>>32);} + #endif +#endif +#ifndef VMAC_BOOL_32BIT + #define VMAC_BOOL_32BIT 0 +#endif +#ifndef ADD128 + #define ADD128(rh,rl,ih,il) \ + { word64 _il = (il); \ + (rl) += (_il); \ + (rh) += (ih) + ((rl) < (_il)); \ + } +#endif + +#if !(defined(_MSC_VER) && _MSC_VER < 1300) +template +#endif +void VMAC_Base::VHASH_Update_Template(const word64 *data, size_t blocksRemainingInWord64) +{ + #define INNER_LOOP_ITERATION(j) {\ + word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+0]);\ + word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+1]);\ + AccumulateNH(nhA, d0+nhK[i+2*j+0], d1+nhK[i+2*j+1]);\ + if (T_128BitTag)\ + AccumulateNH(nhB, d0+nhK[i+2*j+2], d1+nhK[i+2*j+3]);\ + } + +#if (defined(_MSC_VER) && _MSC_VER < 1300) + bool T_128BitTag = m_is128; +#endif + size_t L1KeyLengthInWord64 = m_L1KeyLength / 8; + size_t innerLoopEnd = L1KeyLengthInWord64; + const word64 *nhK = m_nhKey(); + word64 *polyS = m_polyState(); + bool isFirstBlock = true; + size_t i; + + #if !VMAC_BOOL_32BIT + #if VMAC_BOOL_WORD128 + word128 a1, a2; + #else + word64 ah1, al1, ah2, al2; + #endif + word64 kh1, kl1, kh2, kl2; + kh1=(polyS+0*4+2)[0]; kl1=(polyS+0*4+2)[1]; + if (T_128BitTag) + { + kh2=(polyS+1*4+2)[0]; kl2=(polyS+1*4+2)[1]; + } + #endif + + do + { + DeclareNH(nhA); + DeclareNH(nhB); + + i = 0; + if (blocksRemainingInWord64 < L1KeyLengthInWord64) + { + if (blocksRemainingInWord64 % 8) + { + innerLoopEnd = blocksRemainingInWord64 % 8; + for (; i> 32); + nh1[0] = word32(nhA1); + nh2[0] = (nhA2 + (nhA1 >> 32)) & m62; + + if (T_128BitTag) + { + nh0[1] = word32(nhB0); + nhB1 += (nhB0 >> 32); + nh1[1] = word32(nhB1); + nh2[1] = (nhB2 + (nhB1 >> 32)) & m62; + } + + #define a0 (((word32 *)(polyS+i*4))[2+NativeByteOrder::ToEnum()]) + #define a1 (*(((word32 *)(polyS+i*4))+3-NativeByteOrder::ToEnum())) // workaround for GCC 3.2 + #define a2 (((word32 *)(polyS+i*4))[0+NativeByteOrder::ToEnum()]) + #define a3 (*(((word32 *)(polyS+i*4))+1-NativeByteOrder::ToEnum())) + #define aHi ((polyS+i*4)[0]) + #define k0 (((word32 *)(polyS+i*4+2))[2+NativeByteOrder::ToEnum()]) + #define k1 (*(((word32 *)(polyS+i*4+2))+3-NativeByteOrder::ToEnum())) + #define k2 (((word32 *)(polyS+i*4+2))[0+NativeByteOrder::ToEnum()]) + #define k3 (*(((word32 *)(polyS+i*4+2))+1-NativeByteOrder::ToEnum())) + #define kHi ((polyS+i*4+2)[0]) + + if (isFirstBlock) + { + isFirstBlock = false; + if (m_isFirstBlock) + { + m_isFirstBlock = false; + for (i=0; i<=(size_t)T_128BitTag; i++) + { + word64 t = (word64)nh0[i] + k0; + a0 = (word32)t; + t = (t >> 32) + nh1[i] + k1; + a1 = (word32)t; + aHi = (t >> 32) + nh2[i] + kHi; + } + continue; + } + } + for (i=0; i<=(size_t)T_128BitTag; i++) + { + word64 p, t; + word32 t2; + + p = MUL32(a3, 2*k3); + p += nh2[i]; + p += MUL32(a0, k2); + p += MUL32(a1, k1); + p += MUL32(a2, k0); + t2 = (word32)p; + p >>= 32; + p += MUL32(a0, k3); + p += MUL32(a1, k2); + p += MUL32(a2, k1); + p += MUL32(a3, k0); + t = (word64(word32(p) & 0x7fffffff) << 32) | t2; + p >>= 31; + p += nh0[i]; + p += MUL32(a0, k0); + p += MUL32(a1, 2*k3); + p += MUL32(a2, 2*k2); + p += MUL32(a3, 2*k1); + t2 = (word32)p; + p >>= 32; + p += nh1[i]; + p += MUL32(a0, k1); + p += MUL32(a1, k0); + p += MUL32(a2, 2*k3); + p += MUL32(a3, 2*k2); + a0 = t2; + a1 = (word32)p; + aHi = (p >> 32) + t; + } + + #undef a0 + #undef a1 + #undef a2 + #undef a3 + #undef aHi + #undef k0 + #undef k1 + #undef k2 + #undef k3 + #undef kHi + #else // #if VMAC_BOOL_32BIT + if (isFirstBlock) + { + isFirstBlock = false; + if (m_isFirstBlock) + { + m_isFirstBlock = false; + #if VMAC_BOOL_WORD128 + #define first_poly_step(a, kh, kl, m) a = (m & m126) + ((word128(kh) << 64) | kl) + + first_poly_step(a1, kh1, kl1, nhA); + if (T_128BitTag) + first_poly_step(a2, kh2, kl2, nhB); + #else + #define first_poly_step(ah, al, kh, kl, mh, ml) {\ + mh &= m62;\ + ADD128(mh, ml, kh, kl); \ + ah = mh; al = ml;} + + first_poly_step(ah1, al1, kh1, kl1, nhA1, nhA0); + if (T_128BitTag) + first_poly_step(ah2, al2, kh2, kl2, nhB1, nhB0); + #endif + continue; + } + else + { + #if VMAC_BOOL_WORD128 + a1 = (word128((polyS+0*4)[0]) << 64) | (polyS+0*4)[1]; + #else + ah1=(polyS+0*4)[0]; al1=(polyS+0*4)[1]; + #endif + if (T_128BitTag) + { + #if VMAC_BOOL_WORD128 + a2 = (word128((polyS+1*4)[0]) << 64) | (polyS+1*4)[1]; + #else + ah2=(polyS+1*4)[0]; al2=(polyS+1*4)[1]; + #endif + } + } + } + + #if VMAC_BOOL_WORD128 + #define poly_step(a, kh, kl, m) \ + { word128 t1, t2, t3, t4;\ + Multiply128(t2, a>>64, kl);\ + Multiply128(t3, a, kh);\ + Multiply128(t1, a, kl);\ + Multiply128(t4, a>>64, 2*kh);\ + t2 += t3;\ + t4 += t1;\ + t2 += t4>>64;\ + a = (word128(word64(t2)&m63) << 64) | word64(t4);\ + t2 *= 2;\ + a += m & m126;\ + a += t2>>64;} + + poly_step(a1, kh1, kl1, nhA); + if (T_128BitTag) + poly_step(a2, kh2, kl2, nhB); + #else + #define poly_step(ah, al, kh, kl, mh, ml) \ + { word64 t1h, t1l, t2h, t2l, t3h, t3l, z=0; \ + /* compute ab*cd, put bd into result registers */ \ + MUL64(t2h,t2l,ah,kl); \ + MUL64(t3h,t3l,al,kh); \ + MUL64(t1h,t1l,ah,2*kh); \ + MUL64(ah,al,al,kl); \ + /* add together ad + bc */ \ + ADD128(t2h,t2l,t3h,t3l); \ + /* add 2 * ac to result */ \ + ADD128(ah,al,t1h,t1l); \ + /* now (ah,al), (t2l,2*t2h) need summing */ \ + /* first add the high registers, carrying into t2h */ \ + ADD128(t2h,ah,z,t2l); \ + /* double t2h and add top bit of ah */ \ + t2h += t2h + (ah >> 63); \ + ah &= m63; \ + /* now add the low registers */ \ + mh &= m62; \ + ADD128(ah,al,mh,ml); \ + ADD128(ah,al,z,t2h); \ + } + + poly_step(ah1, al1, kh1, kl1, nhA1, nhA0); + if (T_128BitTag) + poly_step(ah2, al2, kh2, kl2, nhB1, nhB0); + #endif + #endif // #if VMAC_BOOL_32BIT + } while (blocksRemainingInWord64); + + #if VMAC_BOOL_WORD128 + (polyS+0*4)[0]=word64(a1>>64); (polyS+0*4)[1]=word64(a1); + if (T_128BitTag) + { + (polyS+1*4)[0]=word64(a2>>64); (polyS+1*4)[1]=word64(a2); + } + #elif !VMAC_BOOL_32BIT + (polyS+0*4)[0]=ah1; (polyS+0*4)[1]=al1; + if (T_128BitTag) + { + (polyS+1*4)[0]=ah2; (polyS+1*4)[1]=al2; + } + #endif +} + +inline void VMAC_Base::VHASH_Update(const word64 *data, size_t blocksRemainingInWord64) +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86 + if (HasSSE2()) + { + VHASH_Update_SSE2(data, blocksRemainingInWord64, 0); + if (m_is128) + VHASH_Update_SSE2(data, blocksRemainingInWord64, 1); + m_isFirstBlock = false; + } + else +#endif + { +#if defined(_MSC_VER) && _MSC_VER < 1300 + VHASH_Update_Template(data, blocksRemainingInWord64); +#else + if (m_is128) + VHASH_Update_Template(data, blocksRemainingInWord64); + else + VHASH_Update_Template(data, blocksRemainingInWord64); +#endif + } +} + +size_t VMAC_Base::HashMultipleBlocks(const word64 *data, size_t length) +{ + size_t remaining = ModPowerOf2(length, m_L1KeyLength); + VHASH_Update(data, (length-remaining)/8); + return remaining; +} + +static word64 L3Hash(const word64 *input, const word64 *l3Key, size_t len) +{ + word64 rh, rl, t, z=0; + word64 p1 = input[0], p2 = input[1]; + word64 k1 = l3Key[0], k2 = l3Key[1]; + + /* fully reduce (p1,p2)+(len,0) mod p127 */ + t = p1 >> 63; + p1 &= m63; + ADD128(p1, p2, len, t); + /* At this point, (p1,p2) is at most 2^127+(len<<64) */ + t = (p1 > m63) + ((p1 == m63) & (p2 == m64)); + ADD128(p1, p2, z, t); + p1 &= m63; + + /* compute (p1,p2)/(2^64-2^32) and (p1,p2)%(2^64-2^32) */ + t = p1 + (p2 >> 32); + t += (t >> 32); + t += (word32)t > 0xfffffffeU; + p1 += (t >> 32); + p2 += (p1 << 32); + + /* compute (p1+k1)%p64 and (p2+k2)%p64 */ + p1 += k1; + p1 += (0 - (p1 < k1)) & 257; + p2 += k2; + p2 += (0 - (p2 < k2)) & 257; + + /* compute (p1+k1)*(p2+k2)%p64 */ + MUL64(rh, rl, p1, p2); + t = rh >> 56; + ADD128(t, rl, z, rh); + rh <<= 8; + ADD128(t, rl, z, rh); + t += t << 8; + rl += t; + rl += (0 - (rl < t)) & 257; + rl += (0 - (rl > p64-1)) & 257; + return rl; +} + +void VMAC_Base::TruncatedFinal(byte *mac, size_t size) +{ + size_t len = ModPowerOf2(GetBitCountLo()/8, m_L1KeyLength); + + if (len) + { + memset(m_data()+len, 0, (0-len)%16); + VHASH_Update(DataBuf(), ((len+15)/16)*2); + len *= 8; // convert to bits + } + else if (m_isFirstBlock) + { + // special case for empty string + m_polyState()[0] = m_polyState()[2]; + m_polyState()[1] = m_polyState()[3]; + if (m_is128) + { + m_polyState()[4] = m_polyState()[6]; + m_polyState()[5] = m_polyState()[7]; + } + } + + if (m_is128) + { + word64 t[2]; + t[0] = L3Hash(m_polyState(), m_l3Key(), len) + GetWord(true, BIG_ENDIAN_ORDER, m_pad()); + t[1] = L3Hash(m_polyState()+4, m_l3Key()+2, len) + GetWord(true, BIG_ENDIAN_ORDER, m_pad()+8); + if (size == 16) + { + PutWord(false, BIG_ENDIAN_ORDER, mac, t[0]); + PutWord(false, BIG_ENDIAN_ORDER, mac+8, t[1]); + } + else + { + t[0] = ConditionalByteReverse(BIG_ENDIAN_ORDER, t[0]); + t[1] = ConditionalByteReverse(BIG_ENDIAN_ORDER, t[1]); + memcpy(mac, t, size); + } + } + else + { + word64 t = L3Hash(m_polyState(), m_l3Key(), len); + t += GetWord(true, BIG_ENDIAN_ORDER, m_pad() + (m_nonce()[IVSize()-1]&1) * 8); + if (size == 8) + PutWord(false, BIG_ENDIAN_ORDER, mac, t); + else + { + t = ConditionalByteReverse(BIG_ENDIAN_ORDER, t); + memcpy(mac, &t, size); + } + } +} + +NAMESPACE_END diff --git a/cryptopp/vmac.h b/cryptopp/vmac.h new file mode 100644 index 0000000..0724017 --- /dev/null +++ b/cryptopp/vmac.h @@ -0,0 +1,68 @@ +#ifndef CRYPTOPP_VMAC_H +#define CRYPTOPP_VMAC_H + +#include "iterhash.h" +#include "seckey.h" + +NAMESPACE_BEGIN(CryptoPP) + +/// . +class VMAC_Base : public IteratedHashBase +{ +public: + std::string AlgorithmName() const {return std::string("VMAC(") + GetCipher().AlgorithmName() + ")-" + IntToString(DigestSize()*8);} + unsigned int IVSize() const {return GetCipher().BlockSize();} + unsigned int MinIVLength() const {return 1;} + void Resynchronize(const byte *nonce, int length=-1); + void GetNextIV(RandomNumberGenerator &rng, byte *IV); + unsigned int DigestSize() const {return m_is128 ? 16 : 8;}; + void UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs ¶ms); + void TruncatedFinal(byte *mac, size_t size); + unsigned int BlockSize() const {return m_L1KeyLength;} + ByteOrder GetByteOrder() const {return LITTLE_ENDIAN_ORDER;} + +protected: + virtual BlockCipher & AccessCipher() =0; + virtual int DefaultDigestSize() const =0; + const BlockCipher & GetCipher() const {return const_cast(this)->AccessCipher();} + void HashEndianCorrectedBlock(const word64 *data); + size_t HashMultipleBlocks(const word64 *input, size_t length); + void Init() {} + word64* StateBuf() {return NULL;} + word64* DataBuf() {return (word64 *)m_data();} + + void VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64, int tagPart); +#if !(defined(_MSC_VER) && _MSC_VER < 1300) // can't use function template here with VC6 + template +#endif + void VHASH_Update_Template(const word64 *data, size_t blockRemainingInWord128); + void VHASH_Update(const word64 *data, size_t blocksRemainingInWord128); + + CRYPTOPP_BLOCK_1(polyState, word64, 4*(m_is128+1)) + CRYPTOPP_BLOCK_2(nhKey, word64, m_L1KeyLength/sizeof(word64) + 2*m_is128) + CRYPTOPP_BLOCK_3(data, byte, m_L1KeyLength) + CRYPTOPP_BLOCK_4(l3Key, word64, 2*(m_is128+1)) + CRYPTOPP_BLOCK_5(nonce, byte, IVSize()) + CRYPTOPP_BLOCK_6(pad, byte, IVSize()) + CRYPTOPP_BLOCKS_END(6) + + bool m_is128, m_padCached, m_isFirstBlock; + int m_L1KeyLength; +}; + +/// VMAC +template +class VMAC : public SimpleKeyingInterfaceImpl > +{ +public: + static std::string StaticAlgorithmName() {return std::string("VMAC(") + T_BlockCipher::StaticAlgorithmName() + ")-" + IntToString(T_DigestBitSize);} + +private: + BlockCipher & AccessCipher() {return m_cipher;} + int DefaultDigestSize() const {return T_DigestBitSize/8;} + typename T_BlockCipher::Encryption m_cipher; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/wait.cpp b/cryptopp/wait.cpp new file mode 100644 index 0000000..1987858 --- /dev/null +++ b/cryptopp/wait.cpp @@ -0,0 +1,397 @@ +// wait.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "wait.h" +#include "misc.h" + +#ifdef SOCKETS_AVAILABLE + +#ifdef USE_BERKELEY_STYLE_SOCKETS +#include +#include +#include +#include +#endif + +NAMESPACE_BEGIN(CryptoPP) + +unsigned int WaitObjectContainer::MaxWaitObjects() +{ +#ifdef USE_WINDOWS_STYLE_SOCKETS + return MAXIMUM_WAIT_OBJECTS * (MAXIMUM_WAIT_OBJECTS-1); +#else + return FD_SETSIZE; +#endif +} + +WaitObjectContainer::WaitObjectContainer(WaitObjectsTracer* tracer) + : m_tracer(tracer), m_eventTimer(Timer::MILLISECONDS) + , m_sameResultCount(0), m_noWaitTimer(Timer::MILLISECONDS) +{ + Clear(); + m_eventTimer.StartTimer(); +} + +void WaitObjectContainer::Clear() +{ +#ifdef USE_WINDOWS_STYLE_SOCKETS + m_handles.clear(); +#else + m_maxFd = 0; + FD_ZERO(&m_readfds); + FD_ZERO(&m_writefds); +#endif + m_noWait = false; + m_firstEventTime = 0; +} + +inline void WaitObjectContainer::SetLastResult(LastResultType result) +{ + if (result == m_lastResult) + m_sameResultCount++; + else + { + m_lastResult = result; + m_sameResultCount = 0; + } +} + +void WaitObjectContainer::DetectNoWait(LastResultType result, CallStack const& callStack) +{ + if (result == m_lastResult && m_noWaitTimer.ElapsedTime() > 1000) + { + if (m_sameResultCount > m_noWaitTimer.ElapsedTime()) + { + if (m_tracer) + { + std::string desc = "No wait loop detected - m_lastResult: "; + desc.append(IntToString(m_lastResult)).append(", call stack:"); + for (CallStack const* cs = &callStack; cs; cs = cs->Prev()) + desc.append("\n- ").append(cs->Format()); + m_tracer->TraceNoWaitLoop(desc); + } + try { throw 0; } catch (...) {} // help debugger break + } + + m_noWaitTimer.StartTimer(); + m_sameResultCount = 0; + } +} + +void WaitObjectContainer::SetNoWait(CallStack const& callStack) +{ + DetectNoWait(LASTRESULT_NOWAIT, CallStack("WaitObjectContainer::SetNoWait()", &callStack)); + m_noWait = true; +} + +void WaitObjectContainer::ScheduleEvent(double milliseconds, CallStack const& callStack) +{ + if (milliseconds <= 3) + DetectNoWait(LASTRESULT_SCHEDULED, CallStack("WaitObjectContainer::ScheduleEvent()", &callStack)); + double thisEventTime = m_eventTimer.ElapsedTimeAsDouble() + milliseconds; + if (!m_firstEventTime || thisEventTime < m_firstEventTime) + m_firstEventTime = thisEventTime; +} + +#ifdef USE_WINDOWS_STYLE_SOCKETS + +struct WaitingThreadData +{ + bool waitingToWait, terminate; + HANDLE startWaiting, stopWaiting; + const HANDLE *waitHandles; + unsigned int count; + HANDLE threadHandle; + DWORD threadId; + DWORD* error; +}; + +WaitObjectContainer::~WaitObjectContainer() +{ + try // don't let exceptions escape destructor + { + if (!m_threads.empty()) + { + HANDLE threadHandles[MAXIMUM_WAIT_OBJECTS]; + unsigned int i; + for (i=0; i pThread((WaitingThreadData *)lParam); + WaitingThreadData &thread = *pThread; + std::vector handles; + + while (true) + { + thread.waitingToWait = true; + ::WaitForSingleObject(thread.startWaiting, INFINITE); + thread.waitingToWait = false; + + if (thread.terminate) + break; + if (!thread.count) + continue; + + handles.resize(thread.count + 1); + handles[0] = thread.stopWaiting; + std::copy(thread.waitHandles, thread.waitHandles+thread.count, handles.begin()+1); + + DWORD result = ::WaitForMultipleObjects((DWORD)handles.size(), &handles[0], FALSE, INFINITE); + + if (result == WAIT_OBJECT_0) + continue; // another thread finished waiting first, so do nothing + SetEvent(thread.stopWaiting); + if (!(result > WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + handles.size())) + { + assert(!"error in WaitingThread"); // break here so we can see which thread has an error + *thread.error = ::GetLastError(); + } + } + + return S_OK; // return a value here to avoid compiler warning +} + +void WaitObjectContainer::CreateThreads(unsigned int count) +{ + size_t currentCount = m_threads.size(); + if (currentCount == 0) + { + m_startWaiting = ::CreateEvent(NULL, TRUE, FALSE, NULL); + m_stopWaiting = ::CreateEvent(NULL, TRUE, FALSE, NULL); + } + + if (currentCount < count) + { + m_threads.resize(count); + for (size_t i=currentCount; i MAXIMUM_WAIT_OBJECTS) + { + // too many wait objects for a single WaitForMultipleObjects call, so use multiple threads + static const unsigned int WAIT_OBJECTS_PER_THREAD = MAXIMUM_WAIT_OBJECTS-1; + unsigned int nThreads = (unsigned int)((m_handles.size() + WAIT_OBJECTS_PER_THREAD - 1) / WAIT_OBJECTS_PER_THREAD); + if (nThreads > MAXIMUM_WAIT_OBJECTS) // still too many wait objects, maybe implement recursive threading later? + throw Err("WaitObjectContainer: number of wait objects exceeds limit"); + CreateThreads(nThreads); + DWORD error = S_OK; + + for (unsigned int i=0; i 0) + { + unsigned long timeAfterWait = t.ElapsedTime(); + OutputDebugString(("Handles " + IntToString(m_handles.size()) + ", Woke up by " + IntToString(result-WAIT_OBJECT_0) + ", Busied for " + IntToString(timeBeforeWait-lastTime) + " us, Waited for " + IntToString(timeAfterWait-timeBeforeWait) + " us, max " + IntToString(milliseconds) + "ms\n").c_str()); + lastTime = timeAfterWait; + } +#endif + if (result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + m_handles.size()) + { + if (result == m_lastResult) + m_sameResultCount++; + else + { + m_lastResult = result; + m_sameResultCount = 0; + } + return true; + } + else if (result == WAIT_TIMEOUT) + { + SetLastResult(timeoutIsScheduledEvent ? LASTRESULT_SCHEDULED : LASTRESULT_TIMEOUT); + return timeoutIsScheduledEvent; + } + else + throw Err("WaitObjectContainer: WaitForMultipleObjects failed with error " + IntToString(::GetLastError())); + } +} + +#else // #ifdef USE_WINDOWS_STYLE_SOCKETS + +void WaitObjectContainer::AddReadFd(int fd, CallStack const& callStack) // TODO: do something with callStack +{ + FD_SET(fd, &m_readfds); + m_maxFd = STDMAX(m_maxFd, fd); +} + +void WaitObjectContainer::AddWriteFd(int fd, CallStack const& callStack) // TODO: do something with callStack +{ + FD_SET(fd, &m_writefds); + m_maxFd = STDMAX(m_maxFd, fd); +} + +bool WaitObjectContainer::Wait(unsigned long milliseconds) +{ + if (m_noWait || (!m_maxFd && !m_firstEventTime)) + return true; + + bool timeoutIsScheduledEvent = false; + + if (m_firstEventTime) + { + double timeToFirstEvent = SaturatingSubtract(m_firstEventTime, m_eventTimer.ElapsedTimeAsDouble()); + if (timeToFirstEvent <= milliseconds) + { + milliseconds = (unsigned long)timeToFirstEvent; + timeoutIsScheduledEvent = true; + } + } + + timeval tv, *timeout; + + if (milliseconds == INFINITE_TIME) + timeout = NULL; + else + { + tv.tv_sec = milliseconds / 1000; + tv.tv_usec = (milliseconds % 1000) * 1000; + timeout = &tv; + } + + int result = select(m_maxFd+1, &m_readfds, &m_writefds, NULL, timeout); + + if (result > 0) + return true; + else if (result == 0) + return timeoutIsScheduledEvent; + else + throw Err("WaitObjectContainer: select failed with error " + errno); +} + +#endif + +// ******************************************************** + +std::string CallStack::Format() const +{ + return m_info; +} + +std::string CallStackWithNr::Format() const +{ + return std::string(m_info) + " / nr: " + IntToString(m_nr); +} + +std::string CallStackWithStr::Format() const +{ + return std::string(m_info) + " / " + std::string(m_z); +} + +bool Waitable::Wait(unsigned long milliseconds, CallStack const& callStack) +{ + WaitObjectContainer container; + GetWaitObjects(container, callStack); // reduce clutter by not adding this func to stack + return container.Wait(milliseconds); +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/wait.h b/cryptopp/wait.h new file mode 100644 index 0000000..045afbc --- /dev/null +++ b/cryptopp/wait.h @@ -0,0 +1,208 @@ +#ifndef CRYPTOPP_WAIT_H +#define CRYPTOPP_WAIT_H + +#include "config.h" + +#ifdef SOCKETS_AVAILABLE + +#include "misc.h" +#include "cryptlib.h" +#include + +#ifdef USE_WINDOWS_STYLE_SOCKETS +#include +#else +#include +#endif + +#include "hrtimer.h" + +NAMESPACE_BEGIN(CryptoPP) + +class Tracer +{ +public: + Tracer(unsigned int level) : m_level(level) {} + virtual ~Tracer() {} + +protected: + //! Override this in your most-derived tracer to do the actual tracing. + virtual void Trace(unsigned int n, std::string const& s) = 0; + + /*! By default, tracers will decide which trace messages to trace according to a trace level + mechanism. If your most-derived tracer uses a different mechanism, override this to + return false. If this method returns false, the default TraceXxxx(void) methods will all + return 0 and must be overridden explicitly by your tracer for trace messages you want. */ + virtual bool UsingDefaults() const { return true; } + +protected: + unsigned int m_level; + + void TraceIf(unsigned int n, std::string const&s) + { if (n) Trace(n, s); } + + /*! Returns nr if, according to the default log settings mechanism (using log levels), + the message should be traced. Returns 0 if the default trace level mechanism is not + in use, or if it is in use but the event should not be traced. Provided as a utility + method for easier and shorter coding of default TraceXxxx(void) implementations. */ + unsigned int Tracing(unsigned int nr, unsigned int minLevel) const + { return (UsingDefaults() && m_level >= minLevel) ? nr : 0; } +}; + +// Your Tracer-derived class should inherit as virtual public from Tracer or another +// Tracer-derived class, and should pass the log level in its constructor. You can use the +// following methods to begin and end your Tracer definition. + +// This constructor macro initializes Tracer directly even if not derived directly from it; +// this is intended, virtual base classes are always initialized by the most derived class. +#define CRYPTOPP_TRACER_CONSTRUCTOR(DERIVED) \ + public: DERIVED(unsigned int level = 0) : Tracer(level) {} + +#define CRYPTOPP_BEGIN_TRACER_CLASS_1(DERIVED, BASE1) \ + class DERIVED : virtual public BASE1 { CRYPTOPP_TRACER_CONSTRUCTOR(DERIVED) + +#define CRYPTOPP_BEGIN_TRACER_CLASS_2(DERIVED, BASE1, BASE2) \ + class DERIVED : virtual public BASE1, virtual public BASE2 { CRYPTOPP_TRACER_CONSTRUCTOR(DERIVED) + +#define CRYPTOPP_END_TRACER_CLASS }; + +// In your Tracer-derived class, you should define a globally unique event number for each +// new event defined. This can be done using the following macros. + +#define CRYPTOPP_BEGIN_TRACER_EVENTS(UNIQUENR) enum { EVENTBASE = UNIQUENR, +#define CRYPTOPP_TRACER_EVENT(EVENTNAME) EventNr_##EVENTNAME, +#define CRYPTOPP_END_TRACER_EVENTS }; + +// In your own Tracer-derived class, you must define two methods per new trace event type: +// - unsigned int TraceXxxx() const +// Your default implementation of this method should return the event number if according +// to the default trace level system the event should be traced, or 0 if it should not. +// - void TraceXxxx(string const& s) +// This method should call TraceIf(TraceXxxx(), s); to do the tracing. +// For your convenience, a macro to define these two types of methods are defined below. +// If you use this macro, you should also use the TRACER_EVENTS macros above to associate +// event names with numbers. + +#define CRYPTOPP_TRACER_EVENT_METHODS(EVENTNAME, LOGLEVEL) \ + virtual unsigned int Trace##EVENTNAME() const { return Tracing(EventNr_##EVENTNAME, LOGLEVEL); } \ + virtual void Trace##EVENTNAME(std::string const& s) { TraceIf(Trace##EVENTNAME(), s); } + + +/*! A simple unidirectional linked list with m_prev == 0 to indicate the final entry. + The aim of this implementation is to provide a very lightweight and practical + tracing mechanism with a low performance impact. Functions and methods supporting + this call-stack mechanism would take a parameter of the form "CallStack const& callStack", + and would pass this parameter to subsequent functions they call using the construct: + + SubFunc(arg1, arg2, CallStack("my func at place such and such", &callStack)); + + The advantage of this approach is that it is easy to use and should be very efficient, + involving no allocation from the heap, just a linked list of stack objects containing + pointers to static ASCIIZ strings (or possibly additional but simple data if derived). */ +class CallStack +{ +public: + CallStack(char const* i, CallStack const* p) : m_info(i), m_prev(p) {} + CallStack const* Prev() const { return m_prev; } + virtual std::string Format() const; + +protected: + char const* m_info; + CallStack const* m_prev; +}; + +/*! An extended CallStack entry type with an additional numeric parameter. */ +class CallStackWithNr : public CallStack +{ +public: + CallStackWithNr(char const* i, word32 n, CallStack const* p) : CallStack(i, p), m_nr(n) {} + std::string Format() const; + +protected: + word32 m_nr; +}; + +/*! An extended CallStack entry type with an additional string parameter. */ +class CallStackWithStr : public CallStack +{ +public: + CallStackWithStr(char const* i, char const* z, CallStack const* p) : CallStack(i, p), m_z(z) {} + std::string Format() const; + +protected: + char const* m_z; +}; + +CRYPTOPP_BEGIN_TRACER_CLASS_1(WaitObjectsTracer, Tracer) + CRYPTOPP_BEGIN_TRACER_EVENTS(0x48752841) + CRYPTOPP_TRACER_EVENT(NoWaitLoop) + CRYPTOPP_END_TRACER_EVENTS + CRYPTOPP_TRACER_EVENT_METHODS(NoWaitLoop, 1) +CRYPTOPP_END_TRACER_CLASS + +struct WaitingThreadData; + +//! container of wait objects +class WaitObjectContainer : public NotCopyable +{ +public: + //! exception thrown by WaitObjectContainer + class Err : public Exception + { + public: + Err(const std::string& s) : Exception(IO_ERROR, s) {} + }; + + static unsigned int MaxWaitObjects(); + + WaitObjectContainer(WaitObjectsTracer* tracer = 0); + + void Clear(); + void SetNoWait(CallStack const& callStack); + void ScheduleEvent(double milliseconds, CallStack const& callStack); + // returns false if timed out + bool Wait(unsigned long milliseconds); + +#ifdef USE_WINDOWS_STYLE_SOCKETS + ~WaitObjectContainer(); + void AddHandle(HANDLE handle, CallStack const& callStack); +#else + void AddReadFd(int fd, CallStack const& callStack); + void AddWriteFd(int fd, CallStack const& callStack); +#endif + +private: + WaitObjectsTracer* m_tracer; + +#ifdef USE_WINDOWS_STYLE_SOCKETS + void CreateThreads(unsigned int count); + std::vector m_handles; + std::vector m_threads; + HANDLE m_startWaiting; + HANDLE m_stopWaiting; +#else + fd_set m_readfds, m_writefds; + int m_maxFd; +#endif + bool m_noWait; + double m_firstEventTime; + Timer m_eventTimer; + +#ifdef USE_WINDOWS_STYLE_SOCKETS + typedef size_t LastResultType; +#else + typedef int LastResultType; +#endif + enum { LASTRESULT_NOWAIT = -1, LASTRESULT_SCHEDULED = -2, LASTRESULT_TIMEOUT = -3 }; + LastResultType m_lastResult; + unsigned int m_sameResultCount; + Timer m_noWaitTimer; + void SetLastResult(LastResultType result); + void DetectNoWait(LastResultType result, CallStack const& callStack); +}; + +NAMESPACE_END + +#endif + +#endif diff --git a/cryptopp/wake.cpp b/cryptopp/wake.cpp new file mode 100644 index 0000000..78c243b --- /dev/null +++ b/cryptopp/wake.cpp @@ -0,0 +1,125 @@ +// wake.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "wake.h" + +NAMESPACE_BEGIN(CryptoPP) + +void WAKE_TestInstantiations() +{ + Weak::WAKE_CFB<>::Encryption x1; + Weak::WAKE_CFB<>::Decryption x3; + WAKE_OFB<>::Encryption x2; + WAKE_OFB<>::Decryption x4; +} + +inline word32 WAKE_Base::M(word32 x, word32 y) +{ + word32 w = x+y; + return (w>>8) ^ t[(byte)w]; +} + +void WAKE_Base::GenKey(word32 k0, word32 k1, word32 k2, word32 k3) +{ + long x, z; + int p ; + static long tt[10]= { + 0x726a8f3bL, // table + 0xe69a3b5cL, + 0xd3c71fe5L, + 0xab3c73d2L, + 0x4d3a8eb3L, + 0x0396d6e8L, + 0x3d4c2f7aL, + 0x9ee27cf3L, } ; + t[0] = k0; + t[1] = k1; + t[2] = k2; + t[3] = k3; + for (p=4 ; p<256 ; p++) + { + x=t[p-4]+t[p-1] ; // fill t + t[p]= (x>>3) ^ tt[byte(x&7)] ; + } + + for (p=0 ; p<23 ; p++) + t[p]+=t[p+89] ; // mix first entries + x=t[33] ; z=t[59] | 0x01000001L ; + z=z&0xff7fffffL ; + for (p=0 ; p<256 ; p++) { //change top byte to + x=(x&0xff7fffffL)+z ; // a permutation etc + t[p]=(t[p] & 0x00ffffffL) ^ x ; } + + t[256]=t[0] ; + byte y=byte(x); + for (p=0 ; p<256 ; p++) { // further change perm. + t[p]=t[y=byte(t[p^y]^y)] ; // and other digits + t[y]=t[p+1] ; } +} + +template +void WAKE_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) +{ + word32 k0, k1, k2, k3; + BlockGetAndPut::Get(key)(r3)(r4)(r5)(r6)(k0)(k1)(k2)(k3); + GenKey(k0, k1, k2, k3); +} + +// CFB +template +void WAKE_Policy::Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount) +{ + RegisterOutput registerOutput(output, input, dir); + + while (iterationCount--) + { + r3 = M(r3, ConditionalByteReverse(B::ToEnum(), r6)); + r4 = M(r4, r3); + r5 = M(r5, r4); + r6 = M(r6, r5); + registerOutput(r6); + } +} + +// OFB +template +void WAKE_Policy::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) +{ +#define WAKE_OUTPUT(x)\ + while (iterationCount--)\ + {\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 0, r6);\ + r3 = M(r3, r6);\ + r4 = M(r4, r3);\ + r5 = M(r5, r4);\ + r6 = M(r6, r5);\ + output += 4;\ + if (x == XOR_KEYSTREAM)\ + input += 4;\ + } + + typedef word32 WordType; + CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH(WAKE_OUTPUT, 0); +} +/* +template +void WAKE_ROFB_Policy::Iterate(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount) +{ + KeystreamOutput keystreamOperation(operation, output, input); + + while (iterationCount--) + { + keystreamOperation(r6); + r3 = M(r3, r6); + r4 = M(r4, r3); + r5 = M(r5, r4); + r6 = M(r6, r5); + } +} +*/ +template class WAKE_Policy; +template class WAKE_Policy; +//template class WAKE_ROFB_Policy; +//template class WAKE_ROFB_Policy; + +NAMESPACE_END diff --git a/cryptopp/wake.h b/cryptopp/wake.h new file mode 100644 index 0000000..e3c9390 --- /dev/null +++ b/cryptopp/wake.h @@ -0,0 +1,86 @@ +#ifndef CRYPTOPP_WAKE_H +#define CRYPTOPP_WAKE_H + +#include "seckey.h" +#include "secblock.h" +#include "strciphr.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +template +struct WAKE_CFB_Info : public FixedKeyLength<32> +{ + static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-CFB-LE" : "WAKE-CFB-BE";} +}; + +//! _ +template +struct WAKE_OFB_Info : public FixedKeyLength<32> +{ + static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";} +}; + +class CRYPTOPP_NO_VTABLE WAKE_Base +{ +protected: + word32 M(word32 x, word32 y); + void GenKey(word32 k0, word32 k1, word32 k2, word32 k3); + + word32 t[257]; + word32 r3, r4, r5, r6; +}; + +template +class CRYPTOPP_NO_VTABLE WAKE_Policy + : public CFB_CipherConcretePolicy + , public AdditiveCipherConcretePolicy + , protected WAKE_Base +{ +protected: + void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); + // CFB + byte * GetRegisterBegin() {return (byte *)&r6;} + void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount); + // OFB + void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); + bool CipherIsRandomAccess() const {return false;} +}; + +namespace Weak { +//! WAKE-CFB-BE +template +struct WAKE_CFB : public WAKE_CFB_Info, public SymmetricCipherDocumentation +{ + typedef SymmetricCipherFinal, CFB_EncryptionTemplate<> >, WAKE_CFB_Info > Encryption; + typedef SymmetricCipherFinal, CFB_DecryptionTemplate<> >, WAKE_CFB_Info > Decryption; +}; +} + +//! WAKE-OFB +template +struct WAKE_OFB : public WAKE_OFB_Info, public SymmetricCipherDocumentation +{ + typedef SymmetricCipherFinal, AdditiveCipherTemplate<> >, WAKE_OFB_Info > Encryption; + typedef Encryption Decryption; +}; + +/* +template +class WAKE_ROFB_Policy : public WAKE_Policy +{ +protected: + void Iterate(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount); +}; + +template +struct WAKE_ROFB : public WAKE_Info +{ + typedef SymmetricCipherTemplate, WAKE_ROFB_Policy > > Encryption; + typedef Encryption Decryption; +}; +*/ + +NAMESPACE_END + +#endif diff --git a/cryptopp/whrlpool.cpp b/cryptopp/whrlpool.cpp new file mode 100644 index 0000000..9da12e3 --- /dev/null +++ b/cryptopp/whrlpool.cpp @@ -0,0 +1,701 @@ +// whrlpool.cpp - originally modified by Kevin Springle from +// Paulo Barreto and Vincent Rijmen's public domain code, whirlpool.c. +// Updated to Whirlpool version 3.0, optimized and SSE version added by Wei Dai +// All modifications are placed in the public domain + +// This is the original introductory comment: + +/** + * The Whirlpool hashing function. + * + *

+ * References + * + *

+ * The Whirlpool algorithm was developed by + * Paulo S. L. M. Barreto and + * Vincent Rijmen. + * + * See + * P.S.L.M. Barreto, V. Rijmen, + * ``The Whirlpool hashing function,'' + * NESSIE submission, 2000 (tweaked version, 2001), + * + * + * @author Paulo S.L.M. Barreto + * @author Vincent Rijmen. + * + * @version 3.0 (2003.03.12) + * + * ============================================================================= + * + * Differences from version 2.1: + * + * - Suboptimal diffusion matrix replaced by cir(1, 1, 4, 1, 8, 5, 2, 9). + * + * ============================================================================= + * + * Differences from version 2.0: + * + * - Generation of ISO/IEC 10118-3 test vectors. + * - Bug fix: nonzero carry was ignored when tallying the data length + * (this bug apparently only manifested itself when feeding data + * in pieces rather than in a single chunk at once). + * - Support for MS Visual C++ 64-bit integer arithmetic. + * + * Differences from version 1.0: + * + * - Original S-box replaced by the tweaked, hardware-efficient version. + * + * ============================================================================= + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "pch.h" +#include "whrlpool.h" +#include "misc.h" +#include "cpu.h" + +NAMESPACE_BEGIN(CryptoPP) + +void Whirlpool_TestInstantiations() +{ + Whirlpool x; +} + +void Whirlpool::InitState(HashWordType *state) +{ + memset(state, 0, 8*sizeof(state[0])); +} + +void Whirlpool::TruncatedFinal(byte *hash, size_t size) +{ + ThrowIfInvalidTruncatedSize(size); + + PadLastBlock(32); + CorrectEndianess(m_data, m_data, 32); + + m_data[m_data.size()-4] = 0; + m_data[m_data.size()-3] = 0; + m_data[m_data.size()-2] = GetBitCountHi(); + m_data[m_data.size()-1] = GetBitCountLo(); + + Transform(m_state, m_data); + CorrectEndianess(m_state, m_state, DigestSize()); + memcpy(hash, m_state, size); + + Restart(); // reinit for next use +} + +/* + * The number of rounds of the internal dedicated block cipher. + */ +#define R 10 + +/* + * Though Whirlpool is endianness-neutral, the encryption tables are listed + * in BIG-ENDIAN format, which is adopted throughout this implementation + * (but little-endian notation would be equally suitable if consistently + * employed). + */ + +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +CRYPTOPP_ALIGN_DATA(16) static const word64 Whirlpool_C[4*256+R] CRYPTOPP_SECTION_ALIGN16 = { +#else +static const word64 Whirlpool_C[4*256+R] = { +#endif + W64LIT(0x18186018c07830d8), W64LIT(0x23238c2305af4626), W64LIT(0xc6c63fc67ef991b8), W64LIT(0xe8e887e8136fcdfb), + W64LIT(0x878726874ca113cb), W64LIT(0xb8b8dab8a9626d11), W64LIT(0x0101040108050209), W64LIT(0x4f4f214f426e9e0d), + W64LIT(0x3636d836adee6c9b), W64LIT(0xa6a6a2a6590451ff), W64LIT(0xd2d26fd2debdb90c), W64LIT(0xf5f5f3f5fb06f70e), + W64LIT(0x7979f979ef80f296), W64LIT(0x6f6fa16f5fcede30), W64LIT(0x91917e91fcef3f6d), W64LIT(0x52525552aa07a4f8), + W64LIT(0x60609d6027fdc047), W64LIT(0xbcbccabc89766535), W64LIT(0x9b9b569baccd2b37), W64LIT(0x8e8e028e048c018a), + W64LIT(0xa3a3b6a371155bd2), W64LIT(0x0c0c300c603c186c), W64LIT(0x7b7bf17bff8af684), W64LIT(0x3535d435b5e16a80), + W64LIT(0x1d1d741de8693af5), W64LIT(0xe0e0a7e05347ddb3), W64LIT(0xd7d77bd7f6acb321), W64LIT(0xc2c22fc25eed999c), + W64LIT(0x2e2eb82e6d965c43), W64LIT(0x4b4b314b627a9629), W64LIT(0xfefedffea321e15d), W64LIT(0x575741578216aed5), + W64LIT(0x15155415a8412abd), W64LIT(0x7777c1779fb6eee8), W64LIT(0x3737dc37a5eb6e92), W64LIT(0xe5e5b3e57b56d79e), + W64LIT(0x9f9f469f8cd92313), W64LIT(0xf0f0e7f0d317fd23), W64LIT(0x4a4a354a6a7f9420), W64LIT(0xdada4fda9e95a944), + W64LIT(0x58587d58fa25b0a2), W64LIT(0xc9c903c906ca8fcf), W64LIT(0x2929a429558d527c), W64LIT(0x0a0a280a5022145a), + W64LIT(0xb1b1feb1e14f7f50), W64LIT(0xa0a0baa0691a5dc9), W64LIT(0x6b6bb16b7fdad614), W64LIT(0x85852e855cab17d9), + W64LIT(0xbdbdcebd8173673c), W64LIT(0x5d5d695dd234ba8f), W64LIT(0x1010401080502090), W64LIT(0xf4f4f7f4f303f507), + W64LIT(0xcbcb0bcb16c08bdd), W64LIT(0x3e3ef83eedc67cd3), W64LIT(0x0505140528110a2d), W64LIT(0x676781671fe6ce78), + W64LIT(0xe4e4b7e47353d597), W64LIT(0x27279c2725bb4e02), W64LIT(0x4141194132588273), W64LIT(0x8b8b168b2c9d0ba7), + W64LIT(0xa7a7a6a7510153f6), W64LIT(0x7d7de97dcf94fab2), W64LIT(0x95956e95dcfb3749), W64LIT(0xd8d847d88e9fad56), + W64LIT(0xfbfbcbfb8b30eb70), W64LIT(0xeeee9fee2371c1cd), W64LIT(0x7c7ced7cc791f8bb), W64LIT(0x6666856617e3cc71), + W64LIT(0xdddd53dda68ea77b), W64LIT(0x17175c17b84b2eaf), W64LIT(0x4747014702468e45), W64LIT(0x9e9e429e84dc211a), + W64LIT(0xcaca0fca1ec589d4), W64LIT(0x2d2db42d75995a58), W64LIT(0xbfbfc6bf9179632e), W64LIT(0x07071c07381b0e3f), + W64LIT(0xadad8ead012347ac), W64LIT(0x5a5a755aea2fb4b0), W64LIT(0x838336836cb51bef), W64LIT(0x3333cc3385ff66b6), + W64LIT(0x636391633ff2c65c), W64LIT(0x02020802100a0412), W64LIT(0xaaaa92aa39384993), W64LIT(0x7171d971afa8e2de), + W64LIT(0xc8c807c80ecf8dc6), W64LIT(0x19196419c87d32d1), W64LIT(0x494939497270923b), W64LIT(0xd9d943d9869aaf5f), + W64LIT(0xf2f2eff2c31df931), W64LIT(0xe3e3abe34b48dba8), W64LIT(0x5b5b715be22ab6b9), W64LIT(0x88881a8834920dbc), + W64LIT(0x9a9a529aa4c8293e), W64LIT(0x262698262dbe4c0b), W64LIT(0x3232c8328dfa64bf), W64LIT(0xb0b0fab0e94a7d59), + W64LIT(0xe9e983e91b6acff2), W64LIT(0x0f0f3c0f78331e77), W64LIT(0xd5d573d5e6a6b733), W64LIT(0x80803a8074ba1df4), + W64LIT(0xbebec2be997c6127), W64LIT(0xcdcd13cd26de87eb), W64LIT(0x3434d034bde46889), W64LIT(0x48483d487a759032), + W64LIT(0xffffdbffab24e354), W64LIT(0x7a7af57af78ff48d), W64LIT(0x90907a90f4ea3d64), W64LIT(0x5f5f615fc23ebe9d), + W64LIT(0x202080201da0403d), W64LIT(0x6868bd6867d5d00f), W64LIT(0x1a1a681ad07234ca), W64LIT(0xaeae82ae192c41b7), + W64LIT(0xb4b4eab4c95e757d), W64LIT(0x54544d549a19a8ce), W64LIT(0x93937693ece53b7f), W64LIT(0x222288220daa442f), + W64LIT(0x64648d6407e9c863), W64LIT(0xf1f1e3f1db12ff2a), W64LIT(0x7373d173bfa2e6cc), W64LIT(0x12124812905a2482), + W64LIT(0x40401d403a5d807a), W64LIT(0x0808200840281048), W64LIT(0xc3c32bc356e89b95), W64LIT(0xecec97ec337bc5df), + W64LIT(0xdbdb4bdb9690ab4d), W64LIT(0xa1a1bea1611f5fc0), W64LIT(0x8d8d0e8d1c830791), W64LIT(0x3d3df43df5c97ac8), + W64LIT(0x97976697ccf1335b), W64LIT(0x0000000000000000), W64LIT(0xcfcf1bcf36d483f9), W64LIT(0x2b2bac2b4587566e), + W64LIT(0x7676c57697b3ece1), W64LIT(0x8282328264b019e6), W64LIT(0xd6d67fd6fea9b128), W64LIT(0x1b1b6c1bd87736c3), + W64LIT(0xb5b5eeb5c15b7774), W64LIT(0xafaf86af112943be), W64LIT(0x6a6ab56a77dfd41d), W64LIT(0x50505d50ba0da0ea), + W64LIT(0x45450945124c8a57), W64LIT(0xf3f3ebf3cb18fb38), W64LIT(0x3030c0309df060ad), W64LIT(0xefef9bef2b74c3c4), + W64LIT(0x3f3ffc3fe5c37eda), W64LIT(0x55554955921caac7), W64LIT(0xa2a2b2a2791059db), W64LIT(0xeaea8fea0365c9e9), + W64LIT(0x656589650fecca6a), W64LIT(0xbabad2bab9686903), W64LIT(0x2f2fbc2f65935e4a), W64LIT(0xc0c027c04ee79d8e), + W64LIT(0xdede5fdebe81a160), W64LIT(0x1c1c701ce06c38fc), W64LIT(0xfdfdd3fdbb2ee746), W64LIT(0x4d4d294d52649a1f), + W64LIT(0x92927292e4e03976), W64LIT(0x7575c9758fbceafa), W64LIT(0x06061806301e0c36), W64LIT(0x8a8a128a249809ae), + W64LIT(0xb2b2f2b2f940794b), W64LIT(0xe6e6bfe66359d185), W64LIT(0x0e0e380e70361c7e), W64LIT(0x1f1f7c1ff8633ee7), + W64LIT(0x6262956237f7c455), W64LIT(0xd4d477d4eea3b53a), W64LIT(0xa8a89aa829324d81), W64LIT(0x96966296c4f43152), + W64LIT(0xf9f9c3f99b3aef62), W64LIT(0xc5c533c566f697a3), W64LIT(0x2525942535b14a10), W64LIT(0x59597959f220b2ab), + W64LIT(0x84842a8454ae15d0), W64LIT(0x7272d572b7a7e4c5), W64LIT(0x3939e439d5dd72ec), W64LIT(0x4c4c2d4c5a619816), + W64LIT(0x5e5e655eca3bbc94), W64LIT(0x7878fd78e785f09f), W64LIT(0x3838e038ddd870e5), W64LIT(0x8c8c0a8c14860598), + W64LIT(0xd1d163d1c6b2bf17), W64LIT(0xa5a5aea5410b57e4), W64LIT(0xe2e2afe2434dd9a1), W64LIT(0x616199612ff8c24e), + W64LIT(0xb3b3f6b3f1457b42), W64LIT(0x2121842115a54234), W64LIT(0x9c9c4a9c94d62508), W64LIT(0x1e1e781ef0663cee), + W64LIT(0x4343114322528661), W64LIT(0xc7c73bc776fc93b1), W64LIT(0xfcfcd7fcb32be54f), W64LIT(0x0404100420140824), + W64LIT(0x51515951b208a2e3), W64LIT(0x99995e99bcc72f25), W64LIT(0x6d6da96d4fc4da22), W64LIT(0x0d0d340d68391a65), + W64LIT(0xfafacffa8335e979), W64LIT(0xdfdf5bdfb684a369), W64LIT(0x7e7ee57ed79bfca9), W64LIT(0x242490243db44819), + W64LIT(0x3b3bec3bc5d776fe), W64LIT(0xabab96ab313d4b9a), W64LIT(0xcece1fce3ed181f0), W64LIT(0x1111441188552299), + W64LIT(0x8f8f068f0c890383), W64LIT(0x4e4e254e4a6b9c04), W64LIT(0xb7b7e6b7d1517366), W64LIT(0xebeb8beb0b60cbe0), + W64LIT(0x3c3cf03cfdcc78c1), W64LIT(0x81813e817cbf1ffd), W64LIT(0x94946a94d4fe3540), W64LIT(0xf7f7fbf7eb0cf31c), + W64LIT(0xb9b9deb9a1676f18), W64LIT(0x13134c13985f268b), W64LIT(0x2c2cb02c7d9c5851), W64LIT(0xd3d36bd3d6b8bb05), + W64LIT(0xe7e7bbe76b5cd38c), W64LIT(0x6e6ea56e57cbdc39), W64LIT(0xc4c437c46ef395aa), W64LIT(0x03030c03180f061b), + W64LIT(0x565645568a13acdc), W64LIT(0x44440d441a49885e), W64LIT(0x7f7fe17fdf9efea0), W64LIT(0xa9a99ea921374f88), + W64LIT(0x2a2aa82a4d825467), W64LIT(0xbbbbd6bbb16d6b0a), W64LIT(0xc1c123c146e29f87), W64LIT(0x53535153a202a6f1), + W64LIT(0xdcdc57dcae8ba572), W64LIT(0x0b0b2c0b58271653), W64LIT(0x9d9d4e9d9cd32701), W64LIT(0x6c6cad6c47c1d82b), + W64LIT(0x3131c43195f562a4), W64LIT(0x7474cd7487b9e8f3), W64LIT(0xf6f6fff6e309f115), W64LIT(0x464605460a438c4c), + W64LIT(0xacac8aac092645a5), W64LIT(0x89891e893c970fb5), W64LIT(0x14145014a04428b4), W64LIT(0xe1e1a3e15b42dfba), + W64LIT(0x16165816b04e2ca6), W64LIT(0x3a3ae83acdd274f7), W64LIT(0x6969b9696fd0d206), W64LIT(0x09092409482d1241), + W64LIT(0x7070dd70a7ade0d7), W64LIT(0xb6b6e2b6d954716f), W64LIT(0xd0d067d0ceb7bd1e), W64LIT(0xeded93ed3b7ec7d6), + W64LIT(0xcccc17cc2edb85e2), W64LIT(0x424215422a578468), W64LIT(0x98985a98b4c22d2c), W64LIT(0xa4a4aaa4490e55ed), + W64LIT(0x2828a0285d885075), W64LIT(0x5c5c6d5cda31b886), W64LIT(0xf8f8c7f8933fed6b), W64LIT(0x8686228644a411c2), + + W64LIT(0xd818186018c07830), W64LIT(0x2623238c2305af46), W64LIT(0xb8c6c63fc67ef991), W64LIT(0xfbe8e887e8136fcd), + W64LIT(0xcb878726874ca113), W64LIT(0x11b8b8dab8a9626d), W64LIT(0x0901010401080502), W64LIT(0x0d4f4f214f426e9e), + W64LIT(0x9b3636d836adee6c), W64LIT(0xffa6a6a2a6590451), W64LIT(0x0cd2d26fd2debdb9), W64LIT(0x0ef5f5f3f5fb06f7), + W64LIT(0x967979f979ef80f2), W64LIT(0x306f6fa16f5fcede), W64LIT(0x6d91917e91fcef3f), W64LIT(0xf852525552aa07a4), + W64LIT(0x4760609d6027fdc0), W64LIT(0x35bcbccabc897665), W64LIT(0x379b9b569baccd2b), W64LIT(0x8a8e8e028e048c01), + W64LIT(0xd2a3a3b6a371155b), W64LIT(0x6c0c0c300c603c18), W64LIT(0x847b7bf17bff8af6), W64LIT(0x803535d435b5e16a), + W64LIT(0xf51d1d741de8693a), W64LIT(0xb3e0e0a7e05347dd), W64LIT(0x21d7d77bd7f6acb3), W64LIT(0x9cc2c22fc25eed99), + W64LIT(0x432e2eb82e6d965c), W64LIT(0x294b4b314b627a96), W64LIT(0x5dfefedffea321e1), W64LIT(0xd5575741578216ae), + W64LIT(0xbd15155415a8412a), W64LIT(0xe87777c1779fb6ee), W64LIT(0x923737dc37a5eb6e), W64LIT(0x9ee5e5b3e57b56d7), + W64LIT(0x139f9f469f8cd923), W64LIT(0x23f0f0e7f0d317fd), W64LIT(0x204a4a354a6a7f94), W64LIT(0x44dada4fda9e95a9), + W64LIT(0xa258587d58fa25b0), W64LIT(0xcfc9c903c906ca8f), W64LIT(0x7c2929a429558d52), W64LIT(0x5a0a0a280a502214), + W64LIT(0x50b1b1feb1e14f7f), W64LIT(0xc9a0a0baa0691a5d), W64LIT(0x146b6bb16b7fdad6), W64LIT(0xd985852e855cab17), + W64LIT(0x3cbdbdcebd817367), W64LIT(0x8f5d5d695dd234ba), W64LIT(0x9010104010805020), W64LIT(0x07f4f4f7f4f303f5), + W64LIT(0xddcbcb0bcb16c08b), W64LIT(0xd33e3ef83eedc67c), W64LIT(0x2d0505140528110a), W64LIT(0x78676781671fe6ce), + W64LIT(0x97e4e4b7e47353d5), W64LIT(0x0227279c2725bb4e), W64LIT(0x7341411941325882), W64LIT(0xa78b8b168b2c9d0b), + W64LIT(0xf6a7a7a6a7510153), W64LIT(0xb27d7de97dcf94fa), W64LIT(0x4995956e95dcfb37), W64LIT(0x56d8d847d88e9fad), + W64LIT(0x70fbfbcbfb8b30eb), W64LIT(0xcdeeee9fee2371c1), W64LIT(0xbb7c7ced7cc791f8), W64LIT(0x716666856617e3cc), + W64LIT(0x7bdddd53dda68ea7), W64LIT(0xaf17175c17b84b2e), W64LIT(0x454747014702468e), W64LIT(0x1a9e9e429e84dc21), + W64LIT(0xd4caca0fca1ec589), W64LIT(0x582d2db42d75995a), W64LIT(0x2ebfbfc6bf917963), W64LIT(0x3f07071c07381b0e), + W64LIT(0xacadad8ead012347), W64LIT(0xb05a5a755aea2fb4), W64LIT(0xef838336836cb51b), W64LIT(0xb63333cc3385ff66), + W64LIT(0x5c636391633ff2c6), W64LIT(0x1202020802100a04), W64LIT(0x93aaaa92aa393849), W64LIT(0xde7171d971afa8e2), + W64LIT(0xc6c8c807c80ecf8d), W64LIT(0xd119196419c87d32), W64LIT(0x3b49493949727092), W64LIT(0x5fd9d943d9869aaf), + W64LIT(0x31f2f2eff2c31df9), W64LIT(0xa8e3e3abe34b48db), W64LIT(0xb95b5b715be22ab6), W64LIT(0xbc88881a8834920d), + W64LIT(0x3e9a9a529aa4c829), W64LIT(0x0b262698262dbe4c), W64LIT(0xbf3232c8328dfa64), W64LIT(0x59b0b0fab0e94a7d), + W64LIT(0xf2e9e983e91b6acf), W64LIT(0x770f0f3c0f78331e), W64LIT(0x33d5d573d5e6a6b7), W64LIT(0xf480803a8074ba1d), + W64LIT(0x27bebec2be997c61), W64LIT(0xebcdcd13cd26de87), W64LIT(0x893434d034bde468), W64LIT(0x3248483d487a7590), + W64LIT(0x54ffffdbffab24e3), W64LIT(0x8d7a7af57af78ff4), W64LIT(0x6490907a90f4ea3d), W64LIT(0x9d5f5f615fc23ebe), + W64LIT(0x3d202080201da040), W64LIT(0x0f6868bd6867d5d0), W64LIT(0xca1a1a681ad07234), W64LIT(0xb7aeae82ae192c41), + W64LIT(0x7db4b4eab4c95e75), W64LIT(0xce54544d549a19a8), W64LIT(0x7f93937693ece53b), W64LIT(0x2f222288220daa44), + W64LIT(0x6364648d6407e9c8), W64LIT(0x2af1f1e3f1db12ff), W64LIT(0xcc7373d173bfa2e6), W64LIT(0x8212124812905a24), + W64LIT(0x7a40401d403a5d80), W64LIT(0x4808082008402810), W64LIT(0x95c3c32bc356e89b), W64LIT(0xdfecec97ec337bc5), + W64LIT(0x4ddbdb4bdb9690ab), W64LIT(0xc0a1a1bea1611f5f), W64LIT(0x918d8d0e8d1c8307), W64LIT(0xc83d3df43df5c97a), + W64LIT(0x5b97976697ccf133), W64LIT(0x0000000000000000), W64LIT(0xf9cfcf1bcf36d483), W64LIT(0x6e2b2bac2b458756), + W64LIT(0xe17676c57697b3ec), W64LIT(0xe68282328264b019), W64LIT(0x28d6d67fd6fea9b1), W64LIT(0xc31b1b6c1bd87736), + W64LIT(0x74b5b5eeb5c15b77), W64LIT(0xbeafaf86af112943), W64LIT(0x1d6a6ab56a77dfd4), W64LIT(0xea50505d50ba0da0), + W64LIT(0x5745450945124c8a), W64LIT(0x38f3f3ebf3cb18fb), W64LIT(0xad3030c0309df060), W64LIT(0xc4efef9bef2b74c3), + W64LIT(0xda3f3ffc3fe5c37e), W64LIT(0xc755554955921caa), W64LIT(0xdba2a2b2a2791059), W64LIT(0xe9eaea8fea0365c9), + W64LIT(0x6a656589650fecca), W64LIT(0x03babad2bab96869), W64LIT(0x4a2f2fbc2f65935e), W64LIT(0x8ec0c027c04ee79d), + W64LIT(0x60dede5fdebe81a1), W64LIT(0xfc1c1c701ce06c38), W64LIT(0x46fdfdd3fdbb2ee7), W64LIT(0x1f4d4d294d52649a), + W64LIT(0x7692927292e4e039), W64LIT(0xfa7575c9758fbcea), W64LIT(0x3606061806301e0c), W64LIT(0xae8a8a128a249809), + W64LIT(0x4bb2b2f2b2f94079), W64LIT(0x85e6e6bfe66359d1), W64LIT(0x7e0e0e380e70361c), W64LIT(0xe71f1f7c1ff8633e), + W64LIT(0x556262956237f7c4), W64LIT(0x3ad4d477d4eea3b5), W64LIT(0x81a8a89aa829324d), W64LIT(0x5296966296c4f431), + W64LIT(0x62f9f9c3f99b3aef), W64LIT(0xa3c5c533c566f697), W64LIT(0x102525942535b14a), W64LIT(0xab59597959f220b2), + W64LIT(0xd084842a8454ae15), W64LIT(0xc57272d572b7a7e4), W64LIT(0xec3939e439d5dd72), W64LIT(0x164c4c2d4c5a6198), + W64LIT(0x945e5e655eca3bbc), W64LIT(0x9f7878fd78e785f0), W64LIT(0xe53838e038ddd870), W64LIT(0x988c8c0a8c148605), + W64LIT(0x17d1d163d1c6b2bf), W64LIT(0xe4a5a5aea5410b57), W64LIT(0xa1e2e2afe2434dd9), W64LIT(0x4e616199612ff8c2), + W64LIT(0x42b3b3f6b3f1457b), W64LIT(0x342121842115a542), W64LIT(0x089c9c4a9c94d625), W64LIT(0xee1e1e781ef0663c), + W64LIT(0x6143431143225286), W64LIT(0xb1c7c73bc776fc93), W64LIT(0x4ffcfcd7fcb32be5), W64LIT(0x2404041004201408), + W64LIT(0xe351515951b208a2), W64LIT(0x2599995e99bcc72f), W64LIT(0x226d6da96d4fc4da), W64LIT(0x650d0d340d68391a), + W64LIT(0x79fafacffa8335e9), W64LIT(0x69dfdf5bdfb684a3), W64LIT(0xa97e7ee57ed79bfc), W64LIT(0x19242490243db448), + W64LIT(0xfe3b3bec3bc5d776), W64LIT(0x9aabab96ab313d4b), W64LIT(0xf0cece1fce3ed181), W64LIT(0x9911114411885522), + W64LIT(0x838f8f068f0c8903), W64LIT(0x044e4e254e4a6b9c), W64LIT(0x66b7b7e6b7d15173), W64LIT(0xe0ebeb8beb0b60cb), + W64LIT(0xc13c3cf03cfdcc78), W64LIT(0xfd81813e817cbf1f), W64LIT(0x4094946a94d4fe35), W64LIT(0x1cf7f7fbf7eb0cf3), + W64LIT(0x18b9b9deb9a1676f), W64LIT(0x8b13134c13985f26), W64LIT(0x512c2cb02c7d9c58), W64LIT(0x05d3d36bd3d6b8bb), + W64LIT(0x8ce7e7bbe76b5cd3), W64LIT(0x396e6ea56e57cbdc), W64LIT(0xaac4c437c46ef395), W64LIT(0x1b03030c03180f06), + W64LIT(0xdc565645568a13ac), W64LIT(0x5e44440d441a4988), W64LIT(0xa07f7fe17fdf9efe), W64LIT(0x88a9a99ea921374f), + W64LIT(0x672a2aa82a4d8254), W64LIT(0x0abbbbd6bbb16d6b), W64LIT(0x87c1c123c146e29f), W64LIT(0xf153535153a202a6), + W64LIT(0x72dcdc57dcae8ba5), W64LIT(0x530b0b2c0b582716), W64LIT(0x019d9d4e9d9cd327), W64LIT(0x2b6c6cad6c47c1d8), + W64LIT(0xa43131c43195f562), W64LIT(0xf37474cd7487b9e8), W64LIT(0x15f6f6fff6e309f1), W64LIT(0x4c464605460a438c), + W64LIT(0xa5acac8aac092645), W64LIT(0xb589891e893c970f), W64LIT(0xb414145014a04428), W64LIT(0xbae1e1a3e15b42df), + W64LIT(0xa616165816b04e2c), W64LIT(0xf73a3ae83acdd274), W64LIT(0x066969b9696fd0d2), W64LIT(0x4109092409482d12), + W64LIT(0xd77070dd70a7ade0), W64LIT(0x6fb6b6e2b6d95471), W64LIT(0x1ed0d067d0ceb7bd), W64LIT(0xd6eded93ed3b7ec7), + W64LIT(0xe2cccc17cc2edb85), W64LIT(0x68424215422a5784), W64LIT(0x2c98985a98b4c22d), W64LIT(0xeda4a4aaa4490e55), + W64LIT(0x752828a0285d8850), W64LIT(0x865c5c6d5cda31b8), W64LIT(0x6bf8f8c7f8933fed), W64LIT(0xc28686228644a411), + + W64LIT(0x30d818186018c078), W64LIT(0x462623238c2305af), W64LIT(0x91b8c6c63fc67ef9), W64LIT(0xcdfbe8e887e8136f), + W64LIT(0x13cb878726874ca1), W64LIT(0x6d11b8b8dab8a962), W64LIT(0x0209010104010805), W64LIT(0x9e0d4f4f214f426e), + W64LIT(0x6c9b3636d836adee), W64LIT(0x51ffa6a6a2a65904), W64LIT(0xb90cd2d26fd2debd), W64LIT(0xf70ef5f5f3f5fb06), + W64LIT(0xf2967979f979ef80), W64LIT(0xde306f6fa16f5fce), W64LIT(0x3f6d91917e91fcef), W64LIT(0xa4f852525552aa07), + W64LIT(0xc04760609d6027fd), W64LIT(0x6535bcbccabc8976), W64LIT(0x2b379b9b569baccd), W64LIT(0x018a8e8e028e048c), + W64LIT(0x5bd2a3a3b6a37115), W64LIT(0x186c0c0c300c603c), W64LIT(0xf6847b7bf17bff8a), W64LIT(0x6a803535d435b5e1), + W64LIT(0x3af51d1d741de869), W64LIT(0xddb3e0e0a7e05347), W64LIT(0xb321d7d77bd7f6ac), W64LIT(0x999cc2c22fc25eed), + W64LIT(0x5c432e2eb82e6d96), W64LIT(0x96294b4b314b627a), W64LIT(0xe15dfefedffea321), W64LIT(0xaed5575741578216), + W64LIT(0x2abd15155415a841), W64LIT(0xeee87777c1779fb6), W64LIT(0x6e923737dc37a5eb), W64LIT(0xd79ee5e5b3e57b56), + W64LIT(0x23139f9f469f8cd9), W64LIT(0xfd23f0f0e7f0d317), W64LIT(0x94204a4a354a6a7f), W64LIT(0xa944dada4fda9e95), + W64LIT(0xb0a258587d58fa25), W64LIT(0x8fcfc9c903c906ca), W64LIT(0x527c2929a429558d), W64LIT(0x145a0a0a280a5022), + W64LIT(0x7f50b1b1feb1e14f), W64LIT(0x5dc9a0a0baa0691a), W64LIT(0xd6146b6bb16b7fda), W64LIT(0x17d985852e855cab), + W64LIT(0x673cbdbdcebd8173), W64LIT(0xba8f5d5d695dd234), W64LIT(0x2090101040108050), W64LIT(0xf507f4f4f7f4f303), + W64LIT(0x8bddcbcb0bcb16c0), W64LIT(0x7cd33e3ef83eedc6), W64LIT(0x0a2d050514052811), W64LIT(0xce78676781671fe6), + W64LIT(0xd597e4e4b7e47353), W64LIT(0x4e0227279c2725bb), W64LIT(0x8273414119413258), W64LIT(0x0ba78b8b168b2c9d), + W64LIT(0x53f6a7a7a6a75101), W64LIT(0xfab27d7de97dcf94), W64LIT(0x374995956e95dcfb), W64LIT(0xad56d8d847d88e9f), + W64LIT(0xeb70fbfbcbfb8b30), W64LIT(0xc1cdeeee9fee2371), W64LIT(0xf8bb7c7ced7cc791), W64LIT(0xcc716666856617e3), + W64LIT(0xa77bdddd53dda68e), W64LIT(0x2eaf17175c17b84b), W64LIT(0x8e45474701470246), W64LIT(0x211a9e9e429e84dc), + W64LIT(0x89d4caca0fca1ec5), W64LIT(0x5a582d2db42d7599), W64LIT(0x632ebfbfc6bf9179), W64LIT(0x0e3f07071c07381b), + W64LIT(0x47acadad8ead0123), W64LIT(0xb4b05a5a755aea2f), W64LIT(0x1bef838336836cb5), W64LIT(0x66b63333cc3385ff), + W64LIT(0xc65c636391633ff2), W64LIT(0x041202020802100a), W64LIT(0x4993aaaa92aa3938), W64LIT(0xe2de7171d971afa8), + W64LIT(0x8dc6c8c807c80ecf), W64LIT(0x32d119196419c87d), W64LIT(0x923b494939497270), W64LIT(0xaf5fd9d943d9869a), + W64LIT(0xf931f2f2eff2c31d), W64LIT(0xdba8e3e3abe34b48), W64LIT(0xb6b95b5b715be22a), W64LIT(0x0dbc88881a883492), + W64LIT(0x293e9a9a529aa4c8), W64LIT(0x4c0b262698262dbe), W64LIT(0x64bf3232c8328dfa), W64LIT(0x7d59b0b0fab0e94a), + W64LIT(0xcff2e9e983e91b6a), W64LIT(0x1e770f0f3c0f7833), W64LIT(0xb733d5d573d5e6a6), W64LIT(0x1df480803a8074ba), + W64LIT(0x6127bebec2be997c), W64LIT(0x87ebcdcd13cd26de), W64LIT(0x68893434d034bde4), W64LIT(0x903248483d487a75), + W64LIT(0xe354ffffdbffab24), W64LIT(0xf48d7a7af57af78f), W64LIT(0x3d6490907a90f4ea), W64LIT(0xbe9d5f5f615fc23e), + W64LIT(0x403d202080201da0), W64LIT(0xd00f6868bd6867d5), W64LIT(0x34ca1a1a681ad072), W64LIT(0x41b7aeae82ae192c), + W64LIT(0x757db4b4eab4c95e), W64LIT(0xa8ce54544d549a19), W64LIT(0x3b7f93937693ece5), W64LIT(0x442f222288220daa), + W64LIT(0xc86364648d6407e9), W64LIT(0xff2af1f1e3f1db12), W64LIT(0xe6cc7373d173bfa2), W64LIT(0x248212124812905a), + W64LIT(0x807a40401d403a5d), W64LIT(0x1048080820084028), W64LIT(0x9b95c3c32bc356e8), W64LIT(0xc5dfecec97ec337b), + W64LIT(0xab4ddbdb4bdb9690), W64LIT(0x5fc0a1a1bea1611f), W64LIT(0x07918d8d0e8d1c83), W64LIT(0x7ac83d3df43df5c9), + W64LIT(0x335b97976697ccf1), W64LIT(0x0000000000000000), W64LIT(0x83f9cfcf1bcf36d4), W64LIT(0x566e2b2bac2b4587), + W64LIT(0xece17676c57697b3), W64LIT(0x19e68282328264b0), W64LIT(0xb128d6d67fd6fea9), W64LIT(0x36c31b1b6c1bd877), + W64LIT(0x7774b5b5eeb5c15b), W64LIT(0x43beafaf86af1129), W64LIT(0xd41d6a6ab56a77df), W64LIT(0xa0ea50505d50ba0d), + W64LIT(0x8a5745450945124c), W64LIT(0xfb38f3f3ebf3cb18), W64LIT(0x60ad3030c0309df0), W64LIT(0xc3c4efef9bef2b74), + W64LIT(0x7eda3f3ffc3fe5c3), W64LIT(0xaac755554955921c), W64LIT(0x59dba2a2b2a27910), W64LIT(0xc9e9eaea8fea0365), + W64LIT(0xca6a656589650fec), W64LIT(0x6903babad2bab968), W64LIT(0x5e4a2f2fbc2f6593), W64LIT(0x9d8ec0c027c04ee7), + W64LIT(0xa160dede5fdebe81), W64LIT(0x38fc1c1c701ce06c), W64LIT(0xe746fdfdd3fdbb2e), W64LIT(0x9a1f4d4d294d5264), + W64LIT(0x397692927292e4e0), W64LIT(0xeafa7575c9758fbc), W64LIT(0x0c3606061806301e), W64LIT(0x09ae8a8a128a2498), + W64LIT(0x794bb2b2f2b2f940), W64LIT(0xd185e6e6bfe66359), W64LIT(0x1c7e0e0e380e7036), W64LIT(0x3ee71f1f7c1ff863), + W64LIT(0xc4556262956237f7), W64LIT(0xb53ad4d477d4eea3), W64LIT(0x4d81a8a89aa82932), W64LIT(0x315296966296c4f4), + W64LIT(0xef62f9f9c3f99b3a), W64LIT(0x97a3c5c533c566f6), W64LIT(0x4a102525942535b1), W64LIT(0xb2ab59597959f220), + W64LIT(0x15d084842a8454ae), W64LIT(0xe4c57272d572b7a7), W64LIT(0x72ec3939e439d5dd), W64LIT(0x98164c4c2d4c5a61), + W64LIT(0xbc945e5e655eca3b), W64LIT(0xf09f7878fd78e785), W64LIT(0x70e53838e038ddd8), W64LIT(0x05988c8c0a8c1486), + W64LIT(0xbf17d1d163d1c6b2), W64LIT(0x57e4a5a5aea5410b), W64LIT(0xd9a1e2e2afe2434d), W64LIT(0xc24e616199612ff8), + W64LIT(0x7b42b3b3f6b3f145), W64LIT(0x42342121842115a5), W64LIT(0x25089c9c4a9c94d6), W64LIT(0x3cee1e1e781ef066), + W64LIT(0x8661434311432252), W64LIT(0x93b1c7c73bc776fc), W64LIT(0xe54ffcfcd7fcb32b), W64LIT(0x0824040410042014), + W64LIT(0xa2e351515951b208), W64LIT(0x2f2599995e99bcc7), W64LIT(0xda226d6da96d4fc4), W64LIT(0x1a650d0d340d6839), + W64LIT(0xe979fafacffa8335), W64LIT(0xa369dfdf5bdfb684), W64LIT(0xfca97e7ee57ed79b), W64LIT(0x4819242490243db4), + W64LIT(0x76fe3b3bec3bc5d7), W64LIT(0x4b9aabab96ab313d), W64LIT(0x81f0cece1fce3ed1), W64LIT(0x2299111144118855), + W64LIT(0x03838f8f068f0c89), W64LIT(0x9c044e4e254e4a6b), W64LIT(0x7366b7b7e6b7d151), W64LIT(0xcbe0ebeb8beb0b60), + W64LIT(0x78c13c3cf03cfdcc), W64LIT(0x1ffd81813e817cbf), W64LIT(0x354094946a94d4fe), W64LIT(0xf31cf7f7fbf7eb0c), + W64LIT(0x6f18b9b9deb9a167), W64LIT(0x268b13134c13985f), W64LIT(0x58512c2cb02c7d9c), W64LIT(0xbb05d3d36bd3d6b8), + W64LIT(0xd38ce7e7bbe76b5c), W64LIT(0xdc396e6ea56e57cb), W64LIT(0x95aac4c437c46ef3), W64LIT(0x061b03030c03180f), + W64LIT(0xacdc565645568a13), W64LIT(0x885e44440d441a49), W64LIT(0xfea07f7fe17fdf9e), W64LIT(0x4f88a9a99ea92137), + W64LIT(0x54672a2aa82a4d82), W64LIT(0x6b0abbbbd6bbb16d), W64LIT(0x9f87c1c123c146e2), W64LIT(0xa6f153535153a202), + W64LIT(0xa572dcdc57dcae8b), W64LIT(0x16530b0b2c0b5827), W64LIT(0x27019d9d4e9d9cd3), W64LIT(0xd82b6c6cad6c47c1), + W64LIT(0x62a43131c43195f5), W64LIT(0xe8f37474cd7487b9), W64LIT(0xf115f6f6fff6e309), W64LIT(0x8c4c464605460a43), + W64LIT(0x45a5acac8aac0926), W64LIT(0x0fb589891e893c97), W64LIT(0x28b414145014a044), W64LIT(0xdfbae1e1a3e15b42), + W64LIT(0x2ca616165816b04e), W64LIT(0x74f73a3ae83acdd2), W64LIT(0xd2066969b9696fd0), W64LIT(0x124109092409482d), + W64LIT(0xe0d77070dd70a7ad), W64LIT(0x716fb6b6e2b6d954), W64LIT(0xbd1ed0d067d0ceb7), W64LIT(0xc7d6eded93ed3b7e), + W64LIT(0x85e2cccc17cc2edb), W64LIT(0x8468424215422a57), W64LIT(0x2d2c98985a98b4c2), W64LIT(0x55eda4a4aaa4490e), + W64LIT(0x50752828a0285d88), W64LIT(0xb8865c5c6d5cda31), W64LIT(0xed6bf8f8c7f8933f), W64LIT(0x11c28686228644a4), + + W64LIT(0x7830d818186018c0), W64LIT(0xaf462623238c2305), W64LIT(0xf991b8c6c63fc67e), W64LIT(0x6fcdfbe8e887e813), + W64LIT(0xa113cb878726874c), W64LIT(0x626d11b8b8dab8a9), W64LIT(0x0502090101040108), W64LIT(0x6e9e0d4f4f214f42), + W64LIT(0xee6c9b3636d836ad), W64LIT(0x0451ffa6a6a2a659), W64LIT(0xbdb90cd2d26fd2de), W64LIT(0x06f70ef5f5f3f5fb), + W64LIT(0x80f2967979f979ef), W64LIT(0xcede306f6fa16f5f), W64LIT(0xef3f6d91917e91fc), W64LIT(0x07a4f852525552aa), + W64LIT(0xfdc04760609d6027), W64LIT(0x766535bcbccabc89), W64LIT(0xcd2b379b9b569bac), W64LIT(0x8c018a8e8e028e04), + W64LIT(0x155bd2a3a3b6a371), W64LIT(0x3c186c0c0c300c60), W64LIT(0x8af6847b7bf17bff), W64LIT(0xe16a803535d435b5), + W64LIT(0x693af51d1d741de8), W64LIT(0x47ddb3e0e0a7e053), W64LIT(0xacb321d7d77bd7f6), W64LIT(0xed999cc2c22fc25e), + W64LIT(0x965c432e2eb82e6d), W64LIT(0x7a96294b4b314b62), W64LIT(0x21e15dfefedffea3), W64LIT(0x16aed55757415782), + W64LIT(0x412abd15155415a8), W64LIT(0xb6eee87777c1779f), W64LIT(0xeb6e923737dc37a5), W64LIT(0x56d79ee5e5b3e57b), + W64LIT(0xd923139f9f469f8c), W64LIT(0x17fd23f0f0e7f0d3), W64LIT(0x7f94204a4a354a6a), W64LIT(0x95a944dada4fda9e), + W64LIT(0x25b0a258587d58fa), W64LIT(0xca8fcfc9c903c906), W64LIT(0x8d527c2929a42955), W64LIT(0x22145a0a0a280a50), + W64LIT(0x4f7f50b1b1feb1e1), W64LIT(0x1a5dc9a0a0baa069), W64LIT(0xdad6146b6bb16b7f), W64LIT(0xab17d985852e855c), + W64LIT(0x73673cbdbdcebd81), W64LIT(0x34ba8f5d5d695dd2), W64LIT(0x5020901010401080), W64LIT(0x03f507f4f4f7f4f3), + W64LIT(0xc08bddcbcb0bcb16), W64LIT(0xc67cd33e3ef83eed), W64LIT(0x110a2d0505140528), W64LIT(0xe6ce78676781671f), + W64LIT(0x53d597e4e4b7e473), W64LIT(0xbb4e0227279c2725), W64LIT(0x5882734141194132), W64LIT(0x9d0ba78b8b168b2c), + W64LIT(0x0153f6a7a7a6a751), W64LIT(0x94fab27d7de97dcf), W64LIT(0xfb374995956e95dc), W64LIT(0x9fad56d8d847d88e), + W64LIT(0x30eb70fbfbcbfb8b), W64LIT(0x71c1cdeeee9fee23), W64LIT(0x91f8bb7c7ced7cc7), W64LIT(0xe3cc716666856617), + W64LIT(0x8ea77bdddd53dda6), W64LIT(0x4b2eaf17175c17b8), W64LIT(0x468e454747014702), W64LIT(0xdc211a9e9e429e84), + W64LIT(0xc589d4caca0fca1e), W64LIT(0x995a582d2db42d75), W64LIT(0x79632ebfbfc6bf91), W64LIT(0x1b0e3f07071c0738), + W64LIT(0x2347acadad8ead01), W64LIT(0x2fb4b05a5a755aea), W64LIT(0xb51bef838336836c), W64LIT(0xff66b63333cc3385), + W64LIT(0xf2c65c636391633f), W64LIT(0x0a04120202080210), W64LIT(0x384993aaaa92aa39), W64LIT(0xa8e2de7171d971af), + W64LIT(0xcf8dc6c8c807c80e), W64LIT(0x7d32d119196419c8), W64LIT(0x70923b4949394972), W64LIT(0x9aaf5fd9d943d986), + W64LIT(0x1df931f2f2eff2c3), W64LIT(0x48dba8e3e3abe34b), W64LIT(0x2ab6b95b5b715be2), W64LIT(0x920dbc88881a8834), + W64LIT(0xc8293e9a9a529aa4), W64LIT(0xbe4c0b262698262d), W64LIT(0xfa64bf3232c8328d), W64LIT(0x4a7d59b0b0fab0e9), + W64LIT(0x6acff2e9e983e91b), W64LIT(0x331e770f0f3c0f78), W64LIT(0xa6b733d5d573d5e6), W64LIT(0xba1df480803a8074), + W64LIT(0x7c6127bebec2be99), W64LIT(0xde87ebcdcd13cd26), W64LIT(0xe468893434d034bd), W64LIT(0x75903248483d487a), + W64LIT(0x24e354ffffdbffab), W64LIT(0x8ff48d7a7af57af7), W64LIT(0xea3d6490907a90f4), W64LIT(0x3ebe9d5f5f615fc2), + W64LIT(0xa0403d202080201d), W64LIT(0xd5d00f6868bd6867), W64LIT(0x7234ca1a1a681ad0), W64LIT(0x2c41b7aeae82ae19), + W64LIT(0x5e757db4b4eab4c9), W64LIT(0x19a8ce54544d549a), W64LIT(0xe53b7f93937693ec), W64LIT(0xaa442f222288220d), + W64LIT(0xe9c86364648d6407), W64LIT(0x12ff2af1f1e3f1db), W64LIT(0xa2e6cc7373d173bf), W64LIT(0x5a24821212481290), + W64LIT(0x5d807a40401d403a), W64LIT(0x2810480808200840), W64LIT(0xe89b95c3c32bc356), W64LIT(0x7bc5dfecec97ec33), + W64LIT(0x90ab4ddbdb4bdb96), W64LIT(0x1f5fc0a1a1bea161), W64LIT(0x8307918d8d0e8d1c), W64LIT(0xc97ac83d3df43df5), + W64LIT(0xf1335b97976697cc), W64LIT(0x0000000000000000), W64LIT(0xd483f9cfcf1bcf36), W64LIT(0x87566e2b2bac2b45), + W64LIT(0xb3ece17676c57697), W64LIT(0xb019e68282328264), W64LIT(0xa9b128d6d67fd6fe), W64LIT(0x7736c31b1b6c1bd8), + W64LIT(0x5b7774b5b5eeb5c1), W64LIT(0x2943beafaf86af11), W64LIT(0xdfd41d6a6ab56a77), W64LIT(0x0da0ea50505d50ba), + W64LIT(0x4c8a574545094512), W64LIT(0x18fb38f3f3ebf3cb), W64LIT(0xf060ad3030c0309d), W64LIT(0x74c3c4efef9bef2b), + W64LIT(0xc37eda3f3ffc3fe5), W64LIT(0x1caac75555495592), W64LIT(0x1059dba2a2b2a279), W64LIT(0x65c9e9eaea8fea03), + W64LIT(0xecca6a656589650f), W64LIT(0x686903babad2bab9), W64LIT(0x935e4a2f2fbc2f65), W64LIT(0xe79d8ec0c027c04e), + W64LIT(0x81a160dede5fdebe), W64LIT(0x6c38fc1c1c701ce0), W64LIT(0x2ee746fdfdd3fdbb), W64LIT(0x649a1f4d4d294d52), + W64LIT(0xe0397692927292e4), W64LIT(0xbceafa7575c9758f), W64LIT(0x1e0c360606180630), W64LIT(0x9809ae8a8a128a24), + W64LIT(0x40794bb2b2f2b2f9), W64LIT(0x59d185e6e6bfe663), W64LIT(0x361c7e0e0e380e70), W64LIT(0x633ee71f1f7c1ff8), + W64LIT(0xf7c4556262956237), W64LIT(0xa3b53ad4d477d4ee), W64LIT(0x324d81a8a89aa829), W64LIT(0xf4315296966296c4), + W64LIT(0x3aef62f9f9c3f99b), W64LIT(0xf697a3c5c533c566), W64LIT(0xb14a102525942535), W64LIT(0x20b2ab59597959f2), + W64LIT(0xae15d084842a8454), W64LIT(0xa7e4c57272d572b7), W64LIT(0xdd72ec3939e439d5), W64LIT(0x6198164c4c2d4c5a), + W64LIT(0x3bbc945e5e655eca), W64LIT(0x85f09f7878fd78e7), W64LIT(0xd870e53838e038dd), W64LIT(0x8605988c8c0a8c14), + W64LIT(0xb2bf17d1d163d1c6), W64LIT(0x0b57e4a5a5aea541), W64LIT(0x4dd9a1e2e2afe243), W64LIT(0xf8c24e616199612f), + W64LIT(0x457b42b3b3f6b3f1), W64LIT(0xa542342121842115), W64LIT(0xd625089c9c4a9c94), W64LIT(0x663cee1e1e781ef0), + W64LIT(0x5286614343114322), W64LIT(0xfc93b1c7c73bc776), W64LIT(0x2be54ffcfcd7fcb3), W64LIT(0x1408240404100420), + W64LIT(0x08a2e351515951b2), W64LIT(0xc72f2599995e99bc), W64LIT(0xc4da226d6da96d4f), W64LIT(0x391a650d0d340d68), + W64LIT(0x35e979fafacffa83), W64LIT(0x84a369dfdf5bdfb6), W64LIT(0x9bfca97e7ee57ed7), W64LIT(0xb44819242490243d), + W64LIT(0xd776fe3b3bec3bc5), W64LIT(0x3d4b9aabab96ab31), W64LIT(0xd181f0cece1fce3e), W64LIT(0x5522991111441188), + W64LIT(0x8903838f8f068f0c), W64LIT(0x6b9c044e4e254e4a), W64LIT(0x517366b7b7e6b7d1), W64LIT(0x60cbe0ebeb8beb0b), + W64LIT(0xcc78c13c3cf03cfd), W64LIT(0xbf1ffd81813e817c), W64LIT(0xfe354094946a94d4), W64LIT(0x0cf31cf7f7fbf7eb), + W64LIT(0x676f18b9b9deb9a1), W64LIT(0x5f268b13134c1398), W64LIT(0x9c58512c2cb02c7d), W64LIT(0xb8bb05d3d36bd3d6), + W64LIT(0x5cd38ce7e7bbe76b), W64LIT(0xcbdc396e6ea56e57), W64LIT(0xf395aac4c437c46e), W64LIT(0x0f061b03030c0318), + W64LIT(0x13acdc565645568a), W64LIT(0x49885e44440d441a), W64LIT(0x9efea07f7fe17fdf), W64LIT(0x374f88a9a99ea921), + W64LIT(0x8254672a2aa82a4d), W64LIT(0x6d6b0abbbbd6bbb1), W64LIT(0xe29f87c1c123c146), W64LIT(0x02a6f153535153a2), + W64LIT(0x8ba572dcdc57dcae), W64LIT(0x2716530b0b2c0b58), W64LIT(0xd327019d9d4e9d9c), W64LIT(0xc1d82b6c6cad6c47), + W64LIT(0xf562a43131c43195), W64LIT(0xb9e8f37474cd7487), W64LIT(0x09f115f6f6fff6e3), W64LIT(0x438c4c464605460a), + W64LIT(0x2645a5acac8aac09), W64LIT(0x970fb589891e893c), W64LIT(0x4428b414145014a0), W64LIT(0x42dfbae1e1a3e15b), + W64LIT(0x4e2ca616165816b0), W64LIT(0xd274f73a3ae83acd), W64LIT(0xd0d2066969b9696f), W64LIT(0x2d12410909240948), + W64LIT(0xade0d77070dd70a7), W64LIT(0x54716fb6b6e2b6d9), W64LIT(0xb7bd1ed0d067d0ce), W64LIT(0x7ec7d6eded93ed3b), + W64LIT(0xdb85e2cccc17cc2e), W64LIT(0x578468424215422a), W64LIT(0xc22d2c98985a98b4), W64LIT(0x0e55eda4a4aaa449), + W64LIT(0x8850752828a0285d), W64LIT(0x31b8865c5c6d5cda), W64LIT(0x3fed6bf8f8c7f893), W64LIT(0xa411c28686228644), + + W64LIT(0x1823c6e887b8014f), + W64LIT(0x36a6d2f5796f9152), + W64LIT(0x60bc9b8ea30c7b35), + W64LIT(0x1de0d7c22e4bfe57), + W64LIT(0x157737e59ff04ada), + W64LIT(0x58c9290ab1a06b85), + W64LIT(0xbd5d10f4cb3e0567), + W64LIT(0xe427418ba77d95d8), + W64LIT(0xfbee7c66dd17479e), + W64LIT(0xca2dbf07ad5a8333) +}; + +// Whirlpool basic transformation. Transforms state based on block. +void Whirlpool::Transform(word64 *digest, const word64 *block) +{ +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE + if (HasISSE()) + { + // MMX version has the same structure as C version below +#ifdef __GNUC__ + #if CRYPTOPP_BOOL_X64 + word64 workspace[16]; + #endif + __asm__ __volatile__ + ( + ".intel_syntax noprefix;" + AS_PUSH_IF86( bx) + AS2( mov AS_REG_6, WORD_REG(ax)) +#else + #if _MSC_VER < 1300 + AS_PUSH_IF86( bx) + #endif + AS2( lea AS_REG_6, [Whirlpool_C]) + AS2( mov WORD_REG(cx), digest) + AS2( mov WORD_REG(dx), block) +#endif +#if CRYPTOPP_BOOL_X86 + AS2( mov eax, esp) + AS2( and esp, -16) + AS2( sub esp, 16*8) + AS1( push eax) + #define SSE2_workspace esp+WORD_SZ +#else + #define SSE2_workspace %3 +#endif + AS2( xor esi, esi) + ASL(0) + AS2( movq mm0, [WORD_REG(cx)+8*WORD_REG(si)]) + AS2( movq [SSE2_workspace+8*WORD_REG(si)], mm0) // k + AS2( pxor mm0, [WORD_REG(dx)+8*WORD_REG(si)]) + AS2( movq [SSE2_workspace+64+8*WORD_REG(si)], mm0) // s + AS2( movq [WORD_REG(cx)+8*WORD_REG(si)], mm0) + AS1( inc WORD_REG(si)) + AS2( cmp WORD_REG(si), 8) + ASJ( jne, 0, b) + + AS2( xor esi, esi) + ASL(1) + +#define KSL0(a, b) AS2(movq mm##a, b) +#define KSL1(a, b) AS2(pxor mm##a, b) + +#define KSL(op, i, a, b, c, d) \ + AS2(mov eax, [SSE2_workspace+8*i])\ + AS2(movzx edi, al)\ + KSL##op(a, [AS_REG_6+3*2048+8*WORD_REG(di)])\ + AS2(movzx edi, ah)\ + KSL##op(b, [AS_REG_6+2*2048+8*WORD_REG(di)])\ + AS2(shr eax, 16)\ + AS2(movzx edi, al)\ + AS2(shr eax, 8)\ + KSL##op(c, [AS_REG_6+1*2048+8*WORD_REG(di)])\ + KSL##op(d, [AS_REG_6+0*2048+8*WORD_REG(ax)]) + +#define KSH0(a, b) \ + ASS(pshufw mm##a, mm##a, 1, 0, 3, 2)\ + AS2(pxor mm##a, b) +#define KSH1(a, b) \ + AS2(pxor mm##a, b) +#define KSH2(a, b) \ + AS2(pxor mm##a, b)\ + AS2(movq [SSE2_workspace+8*a], mm##a) + +#define KSH(op, i, a, b, c, d) \ + AS2(mov eax, [SSE2_workspace+8*((i+4)-8*((i+4)/8))+4])\ + AS2(movzx edi, al)\ + KSH##op(a, [AS_REG_6+3*2048+8*WORD_REG(di)])\ + AS2(movzx edi, ah)\ + KSH##op(b, [AS_REG_6+2*2048+8*WORD_REG(di)])\ + AS2(shr eax, 16)\ + AS2(movzx edi, al)\ + AS2(shr eax, 8)\ + KSH##op(c, [AS_REG_6+1*2048+8*WORD_REG(di)])\ + KSH##op(d, [AS_REG_6+0*2048+8*WORD_REG(ax)]) + +#define TSL(op, i, a, b, c, d) \ + AS2(mov eax, [SSE2_workspace+64+8*i])\ + AS2(movzx edi, al)\ + KSL##op(a, [AS_REG_6+3*2048+8*WORD_REG(di)])\ + AS2(movzx edi, ah)\ + KSL##op(b, [AS_REG_6+2*2048+8*WORD_REG(di)])\ + AS2(shr eax, 16)\ + AS2(movzx edi, al)\ + AS2(shr eax, 8)\ + KSL##op(c, [AS_REG_6+1*2048+8*WORD_REG(di)])\ + KSL##op(d, [AS_REG_6+0*2048+8*WORD_REG(ax)]) + +#define TSH0(a, b) \ + ASS(pshufw mm##a, mm##a, 1, 0, 3, 2)\ + AS2(pxor mm##a, [SSE2_workspace+8*a])\ + AS2(pxor mm##a, b) +#define TSH1(a, b) \ + AS2(pxor mm##a, b) +#define TSH2(a, b) \ + AS2(pxor mm##a, b)\ + AS2(movq [SSE2_workspace+64+8*a], mm##a) +#define TSH3(a, b) \ + AS2(pxor mm##a, b)\ + AS2(pxor mm##a, [WORD_REG(cx)+8*a])\ + AS2(movq [WORD_REG(cx)+8*a], mm##a) + +#define TSH(op, i, a, b, c, d) \ + AS2(mov eax, [SSE2_workspace+64+8*((i+4)-8*((i+4)/8))+4])\ + AS2(movzx edi, al)\ + TSH##op(a, [AS_REG_6+3*2048+8*WORD_REG(di)])\ + AS2(movzx edi, ah)\ + TSH##op(b, [AS_REG_6+2*2048+8*WORD_REG(di)])\ + AS2(shr eax, 16)\ + AS2(movzx edi, al)\ + AS2(shr eax, 8)\ + TSH##op(c, [AS_REG_6+1*2048+8*WORD_REG(di)])\ + TSH##op(d, [AS_REG_6+0*2048+8*WORD_REG(ax)]) + + KSL(0, 4, 3, 2, 1, 0) + KSL(0, 0, 7, 6, 5, 4) + KSL(1, 1, 0, 7, 6, 5) + KSL(1, 2, 1, 0, 7, 6) + KSL(1, 3, 2, 1, 0, 7) + KSL(1, 5, 4, 3, 2, 1) + KSL(1, 6, 5, 4, 3, 2) + KSL(1, 7, 6, 5, 4, 3) + KSH(0, 0, 7, 6, 5, 4) + KSH(0, 4, 3, 2, 1, 0) + KSH(1, 1, 0, 7, 6, 5) + KSH(1, 2, 1, 0, 7, 6) + KSH(1, 5, 4, 3, 2, 1) + KSH(1, 6, 5, 4, 3, 2) + KSH(2, 3, 2, 1, 0, 7) + KSH(2, 7, 6, 5, 4, 3) + + AS2( pxor mm0, [AS_REG_6 + 8*1024 + WORD_REG(si)*8]) + AS2( movq [SSE2_workspace], mm0) + + TSL(0, 4, 3, 2, 1, 0) + TSL(0, 0, 7, 6, 5, 4) + TSL(1, 1, 0, 7, 6, 5) + TSL(1, 2, 1, 0, 7, 6) + TSL(1, 3, 2, 1, 0, 7) + TSL(1, 5, 4, 3, 2, 1) + TSL(1, 6, 5, 4, 3, 2) + TSL(1, 7, 6, 5, 4, 3) + TSH(0, 0, 7, 6, 5, 4) + TSH(0, 4, 3, 2, 1, 0) + TSH(1, 1, 0, 7, 6, 5) + TSH(1, 2, 1, 0, 7, 6) + TSH(1, 5, 4, 3, 2, 1) + TSH(1, 6, 5, 4, 3, 2) + + AS1( inc WORD_REG(si)) + AS2( cmp WORD_REG(si), 10) + ASJ( je, 2, f) + + TSH(2, 3, 2, 1, 0, 7) + TSH(2, 7, 6, 5, 4, 3) + + ASJ( jmp, 1, b) + ASL(2) + + TSH(3, 3, 2, 1, 0, 7) + TSH(3, 7, 6, 5, 4, 3) + +#undef KSL +#undef KSH +#undef TSL +#undef TSH + + AS_POP_IF86( sp) + AS1( emms) + +#if defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER < 1300) + AS_POP_IF86( bx) +#endif +#ifdef __GNUC__ + ".att_syntax prefix;" + : + : "a" (Whirlpool_C), "c" (digest), "d" (block) + #if CRYPTOPP_BOOL_X64 + , "r" (workspace) + #endif + : "%esi", "%edi", "memory", "cc" + #if CRYPTOPP_BOOL_X64 + , "%r9" + #endif + ); +#endif + } + else +#endif // #ifdef CRYPTOPP_X86_ASM_AVAILABLE + { + word64 s[8]; // the cipher state + word64 k[8]; // the round key + + // Compute and apply K^0 to the cipher state + // Also apply part of the Miyaguchi-Preneel compression function + for (int i=0; i<8; i++) + digest[i] = s[i] = block[i] ^ (k[i] = digest[i]); + +#define KSL(op, i, a, b, c, d) \ + t = (word32)k[i];\ + w##a = Whirlpool_C[3*256 + (byte)t] ^ (op ? w##a : 0);\ + t >>= 8;\ + w##b = Whirlpool_C[2*256 + (byte)t] ^ (op ? w##b : 0);\ + t >>= 8;\ + w##c = Whirlpool_C[1*256 + (byte)t] ^ (op ? w##c : 0);\ + t >>= 8;\ + w##d = Whirlpool_C[0*256 + t] ^ (op ? w##d : 0); + +#define KSH(op, i, a, b, c, d) \ + t = (word32)(k[(i+4)%8]>>32);\ + w##a = Whirlpool_C[3*256 + (byte)t] ^ (op ? w##a : rotrFixed(w##a, 32));\ + if (op==2) k[a] = w##a;\ + t >>= 8;\ + w##b = Whirlpool_C[2*256 + (byte)t] ^ (op ? w##b : rotrFixed(w##b, 32));\ + if (op==2) k[b] = w##b;\ + t >>= 8;\ + w##c = Whirlpool_C[1*256 + (byte)t] ^ (op ? w##c : rotrFixed(w##c, 32));\ + if (op==2) k[c] = w##c;\ + t >>= 8;\ + w##d = Whirlpool_C[0*256 + t] ^ (op ? w##d : rotrFixed(w##d, 32));\ + if (op==2) k[d] = w##d;\ + +#define TSL(op, i, a, b, c, d) \ + t = (word32)s[i];\ + w##a = Whirlpool_C[3*256 + (byte)t] ^ (op ? w##a : 0);\ + t >>= 8;\ + w##b = Whirlpool_C[2*256 + (byte)t] ^ (op ? w##b : 0);\ + t >>= 8;\ + w##c = Whirlpool_C[1*256 + (byte)t] ^ (op ? w##c : 0);\ + t >>= 8;\ + w##d = Whirlpool_C[0*256 + t] ^ (op ? w##d : 0); + +#define TSH_OP(op, a, b) \ + w##a = Whirlpool_C[b*256 + (byte)t] ^ (op ? w##a : rotrFixed(w##a, 32) ^ k[a]);\ + if (op==2) s[a] = w##a;\ + if (op==3) digest[a] ^= w##a;\ + +#define TSH(op, i, a, b, c, d) \ + t = (word32)(s[(i+4)%8]>>32);\ + TSH_OP(op, a, 3);\ + t >>= 8;\ + TSH_OP(op, b, 2);\ + t >>= 8;\ + TSH_OP(op, c, 1);\ + t >>= 8;\ + TSH_OP(op, d, 0);\ + + // Iterate over all rounds: + int r=0; + while (true) + { + word64 w0, w1, w2, w3, w4, w5, w6, w7; // temporary storage + word32 t; + + KSL(0, 4, 3, 2, 1, 0) + KSL(0, 0, 7, 6, 5, 4) + KSL(1, 1, 0, 7, 6, 5) + KSL(1, 2, 1, 0, 7, 6) + KSL(1, 3, 2, 1, 0, 7) + KSL(1, 5, 4, 3, 2, 1) + KSL(1, 6, 5, 4, 3, 2) + KSL(1, 7, 6, 5, 4, 3) + KSH(0, 0, 7, 6, 5, 4) + KSH(0, 4, 3, 2, 1, 0) + KSH(1, 1, 0, 7, 6, 5) + KSH(1, 2, 1, 0, 7, 6) + KSH(1, 5, 4, 3, 2, 1) + KSH(1, 6, 5, 4, 3, 2) + KSH(2, 3, 2, 1, 0, 7) + KSH(2, 7, 6, 5, 4, 3) + + k[0] ^= Whirlpool_C[1024+r]; + + TSL(0, 4, 3, 2, 1, 0) + TSL(0, 0, 7, 6, 5, 4) + TSL(1, 1, 0, 7, 6, 5) + TSL(1, 2, 1, 0, 7, 6) + TSL(1, 3, 2, 1, 0, 7) + TSL(1, 5, 4, 3, 2, 1) + TSL(1, 6, 5, 4, 3, 2) + TSL(1, 7, 6, 5, 4, 3) + TSH(0, 0, 7, 6, 5, 4) + TSH(0, 4, 3, 2, 1, 0) + TSH(1, 1, 0, 7, 6, 5) + TSH(1, 2, 1, 0, 7, 6) + TSH(1, 5, 4, 3, 2, 1) + TSH(1, 6, 5, 4, 3, 2) + + if (++r < R) + { + TSH(2, 3, 2, 1, 0, 7) + TSH(2, 7, 6, 5, 4, 3) + } + else + { + TSH(3, 3, 2, 1, 0, 7) + TSH(3, 7, 6, 5, 4, 3) + break; + } + } + } +} + +NAMESPACE_END diff --git a/cryptopp/whrlpool.h b/cryptopp/whrlpool.h new file mode 100644 index 0000000..62c9d8a --- /dev/null +++ b/cryptopp/whrlpool.h @@ -0,0 +1,21 @@ +#ifndef CRYPTOPP_WHIRLPOOL_H +#define CRYPTOPP_WHIRLPOOL_H + +#include "config.h" +#include "iterhash.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! Whirlpool +class Whirlpool : public IteratedHashWithStaticTransform +{ +public: + static void InitState(HashWordType *state); + static void Transform(word64 *digest, const word64 *data); + void TruncatedFinal(byte *hash, size_t size); + static const char * StaticAlgorithmName() {return "Whirlpool";} +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/winpipes.cpp b/cryptopp/winpipes.cpp new file mode 100644 index 0000000..1c2e047 --- /dev/null +++ b/cryptopp/winpipes.cpp @@ -0,0 +1,205 @@ +// winpipes.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "winpipes.h" + +#ifdef WINDOWS_PIPES_AVAILABLE + +#include "wait.h" + +NAMESPACE_BEGIN(CryptoPP) + +WindowsHandle::WindowsHandle(HANDLE h, bool own) + : m_h(h), m_own(own) +{ +} + +WindowsHandle::~WindowsHandle() +{ + if (m_own) + { + try + { + CloseHandle(); + } + catch (...) + { + } + } +} + +bool WindowsHandle::HandleValid() const +{ + return m_h && m_h != INVALID_HANDLE_VALUE; +} + +void WindowsHandle::AttachHandle(HANDLE h, bool own) +{ + if (m_own) + CloseHandle(); + + m_h = h; + m_own = own; + HandleChanged(); +} + +HANDLE WindowsHandle::DetachHandle() +{ + HANDLE h = m_h; + m_h = INVALID_HANDLE_VALUE; + HandleChanged(); + return h; +} + +void WindowsHandle::CloseHandle() +{ + if (m_h != INVALID_HANDLE_VALUE) + { + ::CloseHandle(m_h); + m_h = INVALID_HANDLE_VALUE; + HandleChanged(); + } +} + +// ******************************************************** + +void WindowsPipe::HandleError(const char *operation) const +{ + DWORD err = GetLastError(); + throw Err(GetHandle(), operation, err); +} + +WindowsPipe::Err::Err(HANDLE s, const std::string& operation, int error) + : OS_Error(IO_ERROR, "WindowsPipe: " + operation + " operation failed with error 0x" + IntToString(error, 16), operation, error) + , m_h(s) +{ +} + +// ************************************************************* + +WindowsPipeReceiver::WindowsPipeReceiver() + : m_resultPending(false), m_eofReceived(false) +{ + m_event.AttachHandle(CreateEvent(NULL, true, false, NULL), true); + CheckAndHandleError("CreateEvent", m_event.HandleValid()); + memset(&m_overlapped, 0, sizeof(m_overlapped)); + m_overlapped.hEvent = m_event; +} + +bool WindowsPipeReceiver::Receive(byte* buf, size_t bufLen) +{ + assert(!m_resultPending && !m_eofReceived); + + HANDLE h = GetHandle(); + // don't queue too much at once, or we might use up non-paged memory + if (ReadFile(h, buf, UnsignedMin((DWORD)128*1024, bufLen), &m_lastResult, &m_overlapped)) + { + if (m_lastResult == 0) + m_eofReceived = true; + } + else + { + switch (GetLastError()) + { + default: + CheckAndHandleError("ReadFile", false); + case ERROR_BROKEN_PIPE: + case ERROR_HANDLE_EOF: + m_lastResult = 0; + m_eofReceived = true; + break; + case ERROR_IO_PENDING: + m_resultPending = true; + } + } + return !m_resultPending; +} + +void WindowsPipeReceiver::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) +{ + if (m_resultPending) + container.AddHandle(m_event, CallStack("WindowsPipeReceiver::GetWaitObjects() - result pending", &callStack)); + else if (!m_eofReceived) + container.SetNoWait(CallStack("WindowsPipeReceiver::GetWaitObjects() - result ready", &callStack)); +} + +unsigned int WindowsPipeReceiver::GetReceiveResult() +{ + if (m_resultPending) + { + HANDLE h = GetHandle(); + if (GetOverlappedResult(h, &m_overlapped, &m_lastResult, false)) + { + if (m_lastResult == 0) + m_eofReceived = true; + } + else + { + switch (GetLastError()) + { + default: + CheckAndHandleError("GetOverlappedResult", false); + case ERROR_BROKEN_PIPE: + case ERROR_HANDLE_EOF: + m_lastResult = 0; + m_eofReceived = true; + } + } + m_resultPending = false; + } + return m_lastResult; +} + +// ************************************************************* + +WindowsPipeSender::WindowsPipeSender() + : m_resultPending(false), m_lastResult(0) +{ + m_event.AttachHandle(CreateEvent(NULL, true, false, NULL), true); + CheckAndHandleError("CreateEvent", m_event.HandleValid()); + memset(&m_overlapped, 0, sizeof(m_overlapped)); + m_overlapped.hEvent = m_event; +} + +void WindowsPipeSender::Send(const byte* buf, size_t bufLen) +{ + DWORD written = 0; + HANDLE h = GetHandle(); + // don't queue too much at once, or we might use up non-paged memory + if (WriteFile(h, buf, UnsignedMin((DWORD)128*1024, bufLen), &written, &m_overlapped)) + { + m_resultPending = false; + m_lastResult = written; + } + else + { + if (GetLastError() != ERROR_IO_PENDING) + CheckAndHandleError("WriteFile", false); + + m_resultPending = true; + } +} + +void WindowsPipeSender::GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack) +{ + if (m_resultPending) + container.AddHandle(m_event, CallStack("WindowsPipeSender::GetWaitObjects() - result pending", &callStack)); + else + container.SetNoWait(CallStack("WindowsPipeSender::GetWaitObjects() - result ready", &callStack)); +} + +unsigned int WindowsPipeSender::GetSendResult() +{ + if (m_resultPending) + { + HANDLE h = GetHandle(); + BOOL result = GetOverlappedResult(h, &m_overlapped, &m_lastResult, false); + CheckAndHandleError("GetOverlappedResult", result); + m_resultPending = false; + } + return m_lastResult; +} + +NAMESPACE_END + +#endif diff --git a/cryptopp/winpipes.h b/cryptopp/winpipes.h new file mode 100644 index 0000000..07225f9 --- /dev/null +++ b/cryptopp/winpipes.h @@ -0,0 +1,142 @@ +#ifndef CRYPTOPP_WINPIPES_H +#define CRYPTOPP_WINPIPES_H + +#include "config.h" + +#ifdef WINDOWS_PIPES_AVAILABLE + +#include "network.h" +#include "queue.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +//! Windows Handle +class WindowsHandle +{ +public: + WindowsHandle(HANDLE h = INVALID_HANDLE_VALUE, bool own=false); + WindowsHandle(const WindowsHandle &h) : m_h(h.m_h), m_own(false) {} + virtual ~WindowsHandle(); + + bool GetOwnership() const {return m_own;} + void SetOwnership(bool own) {m_own = own;} + + operator HANDLE() {return m_h;} + HANDLE GetHandle() const {return m_h;} + bool HandleValid() const; + void AttachHandle(HANDLE h, bool own=false); + HANDLE DetachHandle(); + void CloseHandle(); + +protected: + virtual void HandleChanged() {} + + HANDLE m_h; + bool m_own; +}; + +//! Windows Pipe +class WindowsPipe +{ +public: + class Err : public OS_Error + { + public: + Err(HANDLE h, const std::string& operation, int error); + HANDLE GetHandle() const {return m_h;} + + private: + HANDLE m_h; + }; + +protected: + virtual HANDLE GetHandle() const =0; + virtual void HandleError(const char *operation) const; + void CheckAndHandleError(const char *operation, BOOL result) const + {assert(result==TRUE || result==FALSE); if (!result) HandleError(operation);} +}; + +//! pipe-based implementation of NetworkReceiver +class WindowsPipeReceiver : public WindowsPipe, public NetworkReceiver +{ +public: + WindowsPipeReceiver(); + + bool MustWaitForResult() {return true;} + bool Receive(byte* buf, size_t bufLen); + unsigned int GetReceiveResult(); + bool EofReceived() const {return m_eofReceived;} + + unsigned int GetMaxWaitObjectCount() const {return 1;} + void GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack); + +private: + WindowsHandle m_event; + OVERLAPPED m_overlapped; + bool m_resultPending; + DWORD m_lastResult; + bool m_eofReceived; +}; + +//! pipe-based implementation of NetworkSender +class WindowsPipeSender : public WindowsPipe, public NetworkSender +{ +public: + WindowsPipeSender(); + + bool MustWaitForResult() {return true;} + void Send(const byte* buf, size_t bufLen); + unsigned int GetSendResult(); + bool MustWaitForEof() { return false; } + void SendEof() {} + + unsigned int GetMaxWaitObjectCount() const {return 1;} + void GetWaitObjects(WaitObjectContainer &container, CallStack const& callStack); + +private: + WindowsHandle m_event; + OVERLAPPED m_overlapped; + bool m_resultPending; + DWORD m_lastResult; +}; + +//! Windows Pipe Source +class WindowsPipeSource : public WindowsHandle, public NetworkSource, public WindowsPipeReceiver +{ +public: + WindowsPipeSource(HANDLE h=INVALID_HANDLE_VALUE, bool pumpAll=false, BufferedTransformation *attachment=NULL) + : WindowsHandle(h), NetworkSource(attachment) + { + if (pumpAll) + PumpAll(); + } + + NetworkSource::GetMaxWaitObjectCount; + NetworkSource::GetWaitObjects; + +private: + HANDLE GetHandle() const {return WindowsHandle::GetHandle();} + NetworkReceiver & AccessReceiver() {return *this;} +}; + +//! Windows Pipe Sink +class WindowsPipeSink : public WindowsHandle, public NetworkSink, public WindowsPipeSender +{ +public: + WindowsPipeSink(HANDLE h=INVALID_HANDLE_VALUE, unsigned int maxBufferSize=0, unsigned int autoFlushBound=16*1024) + : WindowsHandle(h), NetworkSink(maxBufferSize, autoFlushBound) {} + + NetworkSink::GetMaxWaitObjectCount; + NetworkSink::GetWaitObjects; + +private: + HANDLE GetHandle() const {return WindowsHandle::GetHandle();} + NetworkSender & AccessSender() {return *this;} +}; + +NAMESPACE_END + +#endif + +#endif diff --git a/cryptopp/words.h b/cryptopp/words.h new file mode 100644 index 0000000..d5fda71 --- /dev/null +++ b/cryptopp/words.h @@ -0,0 +1,103 @@ +#ifndef CRYPTOPP_WORDS_H +#define CRYPTOPP_WORDS_H + +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +inline size_t CountWords(const word *X, size_t N) +{ + while (N && X[N-1]==0) + N--; + return N; +} + +inline void SetWords(word *r, word a, size_t n) +{ + for (size_t i=0; i> (WORD_BITS-shiftBits); + } + return carry; +} + +inline word ShiftWordsRightByBits(word *r, size_t n, unsigned int shiftBits) +{ + assert (shiftBits0; i--) + { + u = r[i-1]; + r[i-1] = (u >> shiftBits) | carry; + carry = u << (WORD_BITS-shiftBits); + } + return carry; +} + +inline void ShiftWordsLeftByWords(word *r, size_t n, size_t shiftWords) +{ + shiftWords = STDMIN(shiftWords, n); + if (shiftWords) + { + for (size_t i=n-1; i>=shiftWords; i--) + r[i] = r[i-shiftWords]; + SetWords(r, 0, shiftWords); + } +} + +inline void ShiftWordsRightByWords(word *r, size_t n, size_t shiftWords) +{ + shiftWords = STDMIN(shiftWords, n); + if (shiftWords) + { + for (size_t i=0; i+shiftWords().Ref(); +} + +void XTR_FindPrimesAndGenerator(RandomNumberGenerator &rng, Integer &p, Integer &q, GFP2Element &g, unsigned int pbits, unsigned int qbits) +{ + assert(qbits > 9); // no primes exist for pbits = 10, qbits = 9 + assert(pbits > qbits); + + const Integer minQ = Integer::Power2(qbits - 1); + const Integer maxQ = Integer::Power2(qbits) - 1; + const Integer minP = Integer::Power2(pbits - 1); + const Integer maxP = Integer::Power2(pbits) - 1; + + Integer r1, r2; + do + { + bool qFound = q.Randomize(rng, minQ, maxQ, Integer::PRIME, 7, 12); + assert(qFound); + bool solutionsExist = SolveModularQuadraticEquation(r1, r2, 1, -1, 1, q); + assert(solutionsExist); + } while (!p.Randomize(rng, minP, maxP, Integer::PRIME, CRT(rng.GenerateBit()?r1:r2, q, 2, 3, EuclideanMultiplicativeInverse(p, 3)), 3*q)); + assert(((p.Squared() - p + 1) % q).IsZero()); + + GFP2_ONB gfp2(p); + GFP2Element three = gfp2.ConvertIn(3), t; + + while (true) + { + g.c1.Randomize(rng, Integer::Zero(), p-1); + g.c2.Randomize(rng, Integer::Zero(), p-1); + t = XTR_Exponentiate(g, p+1, p); + if (t.c1 == t.c2) + continue; + g = XTR_Exponentiate(g, (p.Squared()-p+1)/q, p); + if (g != three) + break; + } + assert(XTR_Exponentiate(g, q, p) == three); +} + +GFP2Element XTR_Exponentiate(const GFP2Element &b, const Integer &e, const Integer &p) +{ + unsigned int bitCount = e.BitCount(); + if (bitCount == 0) + return GFP2Element(-3, -3); + + // find the lowest bit of e that is 1 + unsigned int lowest1bit; + for (lowest1bit=0; e.GetBit(lowest1bit) == 0; lowest1bit++) {} + + GFP2_ONB gfp2(p); + GFP2Element c = gfp2.ConvertIn(b); + GFP2Element cp = gfp2.PthPower(c); + GFP2Element S[5] = {gfp2.ConvertIn(3), c, gfp2.SpecialOperation1(c)}; + + // do all exponents bits except the lowest zeros starting from the top + unsigned int i; + for (i = e.BitCount() - 1; i>lowest1bit; i--) + { + if (e.GetBit(i)) + { + gfp2.RaiseToPthPower(S[0]); + gfp2.Accumulate(S[0], gfp2.SpecialOperation2(S[2], c, S[1])); + S[1] = gfp2.SpecialOperation1(S[1]); + S[2] = gfp2.SpecialOperation1(S[2]); + S[0].swap(S[1]); + } + else + { + gfp2.RaiseToPthPower(S[2]); + gfp2.Accumulate(S[2], gfp2.SpecialOperation2(S[0], cp, S[1])); + S[1] = gfp2.SpecialOperation1(S[1]); + S[0] = gfp2.SpecialOperation1(S[0]); + S[2].swap(S[1]); + } + } + + // now do the lowest zeros + while (i--) + S[1] = gfp2.SpecialOperation1(S[1]); + + return gfp2.ConvertOut(S[1]); +} + +template class AbstractRing; +template class AbstractGroup; + +NAMESPACE_END diff --git a/cryptopp/xtr.h b/cryptopp/xtr.h new file mode 100644 index 0000000..89d39f0 --- /dev/null +++ b/cryptopp/xtr.h @@ -0,0 +1,215 @@ +#ifndef CRYPTOPP_XTR_H +#define CRYPTOPP_XTR_H + +/** \file + "The XTR public key system" by Arjen K. Lenstra and Eric R. Verheul +*/ + +#include "modarith.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! an element of GF(p^2) +class GFP2Element +{ +public: + GFP2Element() {} + GFP2Element(const Integer &c1, const Integer &c2) : c1(c1), c2(c2) {} + GFP2Element(const byte *encodedElement, unsigned int size) + : c1(encodedElement, size/2), c2(encodedElement+size/2, size/2) {} + + void Encode(byte *encodedElement, unsigned int size) + { + c1.Encode(encodedElement, size/2); + c2.Encode(encodedElement+size/2, size/2); + } + + bool operator==(const GFP2Element &rhs) const {return c1 == rhs.c1 && c2 == rhs.c2;} + bool operator!=(const GFP2Element &rhs) const {return !operator==(rhs);} + + void swap(GFP2Element &a) + { + c1.swap(a.c1); + c2.swap(a.c2); + } + + static const GFP2Element & Zero(); + + Integer c1, c2; +}; + +//! GF(p^2), optimal normal basis +template +class GFP2_ONB : public AbstractRing +{ +public: + typedef F BaseField; + + GFP2_ONB(const Integer &p) : modp(p) + { + if (p%3 != 2) + throw InvalidArgument("GFP2_ONB: modulus must be equivalent to 2 mod 3"); + } + + const Integer& GetModulus() const {return modp.GetModulus();} + + GFP2Element ConvertIn(const Integer &a) const + { + t = modp.Inverse(modp.ConvertIn(a)); + return GFP2Element(t, t); + } + + GFP2Element ConvertIn(const GFP2Element &a) const + {return GFP2Element(modp.ConvertIn(a.c1), modp.ConvertIn(a.c2));} + + GFP2Element ConvertOut(const GFP2Element &a) const + {return GFP2Element(modp.ConvertOut(a.c1), modp.ConvertOut(a.c2));} + + bool Equal(const GFP2Element &a, const GFP2Element &b) const + { + return modp.Equal(a.c1, b.c1) && modp.Equal(a.c2, b.c2); + } + + const Element& Identity() const + { + return GFP2Element::Zero(); + } + + const Element& Add(const Element &a, const Element &b) const + { + result.c1 = modp.Add(a.c1, b.c1); + result.c2 = modp.Add(a.c2, b.c2); + return result; + } + + const Element& Inverse(const Element &a) const + { + result.c1 = modp.Inverse(a.c1); + result.c2 = modp.Inverse(a.c2); + return result; + } + + const Element& Double(const Element &a) const + { + result.c1 = modp.Double(a.c1); + result.c2 = modp.Double(a.c2); + return result; + } + + const Element& Subtract(const Element &a, const Element &b) const + { + result.c1 = modp.Subtract(a.c1, b.c1); + result.c2 = modp.Subtract(a.c2, b.c2); + return result; + } + + Element& Accumulate(Element &a, const Element &b) const + { + modp.Accumulate(a.c1, b.c1); + modp.Accumulate(a.c2, b.c2); + return a; + } + + Element& Reduce(Element &a, const Element &b) const + { + modp.Reduce(a.c1, b.c1); + modp.Reduce(a.c2, b.c2); + return a; + } + + bool IsUnit(const Element &a) const + { + return a.c1.NotZero() || a.c2.NotZero(); + } + + const Element& MultiplicativeIdentity() const + { + result.c1 = result.c2 = modp.Inverse(modp.MultiplicativeIdentity()); + return result; + } + + const Element& Multiply(const Element &a, const Element &b) const + { + t = modp.Add(a.c1, a.c2); + t = modp.Multiply(t, modp.Add(b.c1, b.c2)); + result.c1 = modp.Multiply(a.c1, b.c1); + result.c2 = modp.Multiply(a.c2, b.c2); + result.c1.swap(result.c2); + modp.Reduce(t, result.c1); + modp.Reduce(t, result.c2); + modp.Reduce(result.c1, t); + modp.Reduce(result.c2, t); + return result; + } + + const Element& MultiplicativeInverse(const Element &a) const + { + return result = Exponentiate(a, modp.GetModulus()-2); + } + + const Element& Square(const Element &a) const + { + const Integer &ac1 = (&a == &result) ? (t = a.c1) : a.c1; + result.c1 = modp.Multiply(modp.Subtract(modp.Subtract(a.c2, a.c1), a.c1), a.c2); + result.c2 = modp.Multiply(modp.Subtract(modp.Subtract(ac1, a.c2), a.c2), ac1); + return result; + } + + Element Exponentiate(const Element &a, const Integer &e) const + { + Integer edivp, emodp; + Integer::Divide(emodp, edivp, e, modp.GetModulus()); + Element b = PthPower(a); + return AbstractRing::CascadeExponentiate(a, emodp, b, edivp); + } + + const Element & PthPower(const Element &a) const + { + result = a; + result.c1.swap(result.c2); + return result; + } + + void RaiseToPthPower(Element &a) const + { + a.c1.swap(a.c2); + } + + // a^2 - 2a^p + const Element & SpecialOperation1(const Element &a) const + { + assert(&a != &result); + result = Square(a); + modp.Reduce(result.c1, a.c2); + modp.Reduce(result.c1, a.c2); + modp.Reduce(result.c2, a.c1); + modp.Reduce(result.c2, a.c1); + return result; + } + + // x * z - y * z^p + const Element & SpecialOperation2(const Element &x, const Element &y, const Element &z) const + { + assert(&x != &result && &y != &result && &z != &result); + t = modp.Add(x.c2, y.c2); + result.c1 = modp.Multiply(z.c1, modp.Subtract(y.c1, t)); + modp.Accumulate(result.c1, modp.Multiply(z.c2, modp.Subtract(t, x.c1))); + t = modp.Add(x.c1, y.c1); + result.c2 = modp.Multiply(z.c2, modp.Subtract(y.c2, t)); + modp.Accumulate(result.c2, modp.Multiply(z.c1, modp.Subtract(t, x.c2))); + return result; + } + +protected: + BaseField modp; + mutable GFP2Element result; + mutable Integer t; +}; + +void XTR_FindPrimesAndGenerator(RandomNumberGenerator &rng, Integer &p, Integer &q, GFP2Element &g, unsigned int pbits, unsigned int qbits); + +GFP2Element XTR_Exponentiate(const GFP2Element &b, const Integer &e, const Integer &p); + +NAMESPACE_END + +#endif diff --git a/cryptopp/xtrcrypt.cpp b/cryptopp/xtrcrypt.cpp new file mode 100644 index 0000000..20e78e7 --- /dev/null +++ b/cryptopp/xtrcrypt.cpp @@ -0,0 +1,108 @@ +// xtrcrypt.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "xtrcrypt.h" +#include "nbtheory.h" +#include "asn.h" +#include "argnames.h" + +NAMESPACE_BEGIN(CryptoPP) + +XTR_DH::XTR_DH(const Integer &p, const Integer &q, const GFP2Element &g) + : m_p(p), m_q(q), m_g(g) +{ +} + +XTR_DH::XTR_DH(RandomNumberGenerator &rng, unsigned int pbits, unsigned int qbits) +{ + XTR_FindPrimesAndGenerator(rng, m_p, m_q, m_g, pbits, qbits); +} + +XTR_DH::XTR_DH(BufferedTransformation &bt) +{ + BERSequenceDecoder seq(bt); + m_p.BERDecode(seq); + m_q.BERDecode(seq); + m_g.c1.BERDecode(seq); + m_g.c2.BERDecode(seq); + seq.MessageEnd(); +} + +void XTR_DH::DEREncode(BufferedTransformation &bt) const +{ + DERSequenceEncoder seq(bt); + m_p.DEREncode(seq); + m_q.DEREncode(seq); + m_g.c1.DEREncode(seq); + m_g.c2.DEREncode(seq); + seq.MessageEnd(); +} + +bool XTR_DH::Validate(RandomNumberGenerator &rng, unsigned int level) const +{ + bool pass = true; + pass = pass && m_p > Integer::One() && m_p.IsOdd(); + pass = pass && m_q > Integer::One() && m_q.IsOdd(); + GFP2Element three = GFP2_ONB(m_p).ConvertIn(3); + pass = pass && !(m_g.c1.IsNegative() || m_g.c2.IsNegative() || m_g.c1 >= m_p || m_g.c2 >= m_p || m_g == three); + if (level >= 1) + pass = pass && ((m_p.Squared()-m_p+1)%m_q).IsZero(); + if (level >= 2) + { + pass = pass && VerifyPrime(rng, m_p, level-2) && VerifyPrime(rng, m_q, level-2); + pass = pass && XTR_Exponentiate(m_g, (m_p.Squared()-m_p+1)/m_q, m_p) != three; + pass = pass && XTR_Exponentiate(m_g, m_q, m_p) == three; + } + return pass; +} + +bool XTR_DH::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const +{ + return GetValueHelper(this, name, valueType, pValue).Assignable() + CRYPTOPP_GET_FUNCTION_ENTRY(Modulus) + CRYPTOPP_GET_FUNCTION_ENTRY(SubgroupOrder) + CRYPTOPP_GET_FUNCTION_ENTRY(SubgroupGenerator) + ; +} + +void XTR_DH::AssignFrom(const NameValuePairs &source) +{ + AssignFromHelper(this, source) + CRYPTOPP_SET_FUNCTION_ENTRY(Modulus) + CRYPTOPP_SET_FUNCTION_ENTRY(SubgroupOrder) + CRYPTOPP_SET_FUNCTION_ENTRY(SubgroupGenerator) + ; +} + +void XTR_DH::GeneratePrivateKey(RandomNumberGenerator &rng, byte *privateKey) const +{ + Integer x(rng, Integer::Zero(), m_q-1); + x.Encode(privateKey, PrivateKeyLength()); +} + +void XTR_DH::GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const +{ + Integer x(privateKey, PrivateKeyLength()); + GFP2Element y = XTR_Exponentiate(m_g, x, m_p); + y.Encode(publicKey, PublicKeyLength()); +} + +bool XTR_DH::Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey) const +{ + GFP2Element w(otherPublicKey, PublicKeyLength()); + if (validateOtherPublicKey) + { + GFP2_ONB gfp2(m_p); + GFP2Element three = gfp2.ConvertIn(3); + if (w.c1.IsNegative() || w.c2.IsNegative() || w.c1 >= m_p || w.c2 >= m_p || w == three) + return false; + if (XTR_Exponentiate(w, m_q, m_p) != three) + return false; + } + Integer s(privateKey, PrivateKeyLength()); + GFP2Element z = XTR_Exponentiate(w, s, m_p); + z.Encode(agreedValue, AgreedValueLength()); + return true; +} + +NAMESPACE_END diff --git a/cryptopp/xtrcrypt.h b/cryptopp/xtrcrypt.h new file mode 100644 index 0000000..6aee127 --- /dev/null +++ b/cryptopp/xtrcrypt.h @@ -0,0 +1,54 @@ +#ifndef CRYPTOPP_XTRCRYPT_H +#define CRYPTOPP_XTRCRYPT_H + +/** \file + "The XTR public key system" by Arjen K. Lenstra and Eric R. Verheul +*/ + +#include "xtr.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! XTR-DH with key validation + +class XTR_DH : public SimpleKeyAgreementDomain, public CryptoParameters +{ + typedef XTR_DH ThisClass; + +public: + XTR_DH(const Integer &p, const Integer &q, const GFP2Element &g); + XTR_DH(RandomNumberGenerator &rng, unsigned int pbits, unsigned int qbits); + XTR_DH(BufferedTransformation &domainParams); + + void DEREncode(BufferedTransformation &domainParams) const; + + bool Validate(RandomNumberGenerator &rng, unsigned int level) const; + bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; + void AssignFrom(const NameValuePairs &source); + CryptoParameters & AccessCryptoParameters() {return *this;} + unsigned int AgreedValueLength() const {return 2*m_p.ByteCount();} + unsigned int PrivateKeyLength() const {return m_q.ByteCount();} + unsigned int PublicKeyLength() const {return 2*m_p.ByteCount();} + + void GeneratePrivateKey(RandomNumberGenerator &rng, byte *privateKey) const; + void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const; + bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const; + + const Integer &GetModulus() const {return m_p;} + const Integer &GetSubgroupOrder() const {return m_q;} + const GFP2Element &GetSubgroupGenerator() const {return m_g;} + + void SetModulus(const Integer &p) {m_p = p;} + void SetSubgroupOrder(const Integer &q) {m_q = q;} + void SetSubgroupGenerator(const GFP2Element &g) {m_g = g;} + +private: + unsigned int ExponentBitLength() const; + + Integer m_p, m_q; + GFP2Element m_g; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/zdeflate.cpp b/cryptopp/zdeflate.cpp new file mode 100644 index 0000000..d77168f --- /dev/null +++ b/cryptopp/zdeflate.cpp @@ -0,0 +1,792 @@ +// zdeflate.cpp - written and placed in the public domain by Wei Dai + +// Many of the algorithms and tables used here came from the deflate implementation +// by Jean-loup Gailly, which was included in Crypto++ 4.0 and earlier. I completely +// rewrote it in order to fix a bug that I could not figure out. This code +// is less clever, but hopefully more understandable and maintainable. + +#include "pch.h" +#include "zdeflate.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +using namespace std; + +LowFirstBitWriter::LowFirstBitWriter(BufferedTransformation *attachment) + : Filter(attachment), m_counting(false), m_buffer(0), m_bitsBuffered(0), m_bytesBuffered(0) +{ +} + +void LowFirstBitWriter::StartCounting() +{ + assert(!m_counting); + m_counting = true; + m_bitCount = 0; +} + +unsigned long LowFirstBitWriter::FinishCounting() +{ + assert(m_counting); + m_counting = false; + return m_bitCount; +} + +void LowFirstBitWriter::PutBits(unsigned long value, unsigned int length) +{ + if (m_counting) + m_bitCount += length; + else + { + m_buffer |= value << m_bitsBuffered; + m_bitsBuffered += length; + assert(m_bitsBuffered <= sizeof(unsigned long)*8); + while (m_bitsBuffered >= 8) + { + m_outputBuffer[m_bytesBuffered++] = (byte)m_buffer; + if (m_bytesBuffered == m_outputBuffer.size()) + { + AttachedTransformation()->PutModifiable(m_outputBuffer, m_bytesBuffered); + m_bytesBuffered = 0; + } + m_buffer >>= 8; + m_bitsBuffered -= 8; + } + } +} + +void LowFirstBitWriter::FlushBitBuffer() +{ + if (m_counting) + m_bitCount += 8*(m_bitsBuffered > 0); + else + { + if (m_bytesBuffered > 0) + { + AttachedTransformation()->PutModifiable(m_outputBuffer, m_bytesBuffered); + m_bytesBuffered = 0; + } + if (m_bitsBuffered > 0) + { + AttachedTransformation()->Put((byte)m_buffer); + m_buffer = 0; + m_bitsBuffered = 0; + } + } +} + +void LowFirstBitWriter::ClearBitBuffer() +{ + m_buffer = 0; + m_bytesBuffered = 0; + m_bitsBuffered = 0; +} + +HuffmanEncoder::HuffmanEncoder(const unsigned int *codeBits, unsigned int nCodes) +{ + Initialize(codeBits, nCodes); +} + +struct HuffmanNode +{ + size_t symbol; + union {size_t parent; unsigned depth, freq;}; +}; + +struct FreqLessThan +{ + inline bool operator()(unsigned int lhs, const HuffmanNode &rhs) {return lhs < rhs.freq;} + inline bool operator()(const HuffmanNode &lhs, const HuffmanNode &rhs) const {return lhs.freq < rhs.freq;} + // needed for MSVC .NET 2005 + inline bool operator()(const HuffmanNode &lhs, unsigned int rhs) {return lhs.freq < rhs;} +}; + +void HuffmanEncoder::GenerateCodeLengths(unsigned int *codeBits, unsigned int maxCodeBits, const unsigned int *codeCounts, size_t nCodes) +{ + assert(nCodes > 0); + assert(nCodes <= ((size_t)1 << maxCodeBits)); + + size_t i; + SecBlockWithHint tree(nCodes); + for (i=0; i= 2) + for (i=tree.size()-2; i>=nCodes; i--) + tree[i].depth = tree[tree[i].parent].depth + 1; + unsigned int sum = 0; + SecBlockWithHint blCount(maxCodeBits+1); + fill(blCount.begin(), blCount.end(), 0); + for (i=treeBegin; i (unsigned int)(1 << maxCodeBits) ? sum - (1 << maxCodeBits) : 0; + + while (overflow--) + { + unsigned int bits = maxCodeBits-1; + while (blCount[bits] == 0) + bits--; + blCount[bits]--; + blCount[bits+1] += 2; + assert(blCount[maxCodeBits] > 0); + blCount[maxCodeBits]--; + } + + for (i=0; i 0); + unsigned int maxCodeBits = *max_element(codeBits, codeBits+nCodes); + if (maxCodeBits == 0) + return; // assume this object won't be used + + SecBlockWithHint blCount(maxCodeBits+1); + fill(blCount.begin(), blCount.end(), 0); + unsigned int i; + for (i=0; i nextCode(maxCodeBits+1); + nextCode[1] = 0; + for (i=2; i<=maxCodeBits; i++) + { + code = (code + blCount[i-1]) << 1; + nextCode[i] = code; + } + assert(maxCodeBits == 1 || code == (1 << maxCodeBits) - blCount[maxCodeBits]); + + m_valueToCode.resize(nCodes); + for (i=0; i> (8*sizeof(code_t)-len); + } +} + +inline void HuffmanEncoder::Encode(LowFirstBitWriter &writer, value_t value) const +{ + assert(m_valueToCode[value].len > 0); + writer.PutBits(m_valueToCode[value].code, m_valueToCode[value].len); +} + +Deflator::Deflator(BufferedTransformation *attachment, int deflateLevel, int log2WindowSize, bool detectUncompressible) + : LowFirstBitWriter(attachment) + , m_deflateLevel(-1) +{ + InitializeStaticEncoders(); + IsolatedInitialize(MakeParameters("DeflateLevel", deflateLevel)("Log2WindowSize", log2WindowSize)("DetectUncompressible", detectUncompressible)); +} + +Deflator::Deflator(const NameValuePairs ¶meters, BufferedTransformation *attachment) + : LowFirstBitWriter(attachment) + , m_deflateLevel(-1) +{ + InitializeStaticEncoders(); + IsolatedInitialize(parameters); +} + +void Deflator::InitializeStaticEncoders() +{ + unsigned int codeLengths[288]; + fill(codeLengths + 0, codeLengths + 144, 8); + fill(codeLengths + 144, codeLengths + 256, 9); + fill(codeLengths + 256, codeLengths + 280, 7); + fill(codeLengths + 280, codeLengths + 288, 8); + m_staticLiteralEncoder.Initialize(codeLengths, 288); + fill(codeLengths + 0, codeLengths + 32, 5); + m_staticDistanceEncoder.Initialize(codeLengths, 32); +} + +void Deflator::IsolatedInitialize(const NameValuePairs ¶meters) +{ + int log2WindowSize = parameters.GetIntValueWithDefault("Log2WindowSize", DEFAULT_LOG2_WINDOW_SIZE); + if (!(MIN_LOG2_WINDOW_SIZE <= log2WindowSize && log2WindowSize <= MAX_LOG2_WINDOW_SIZE)) + throw InvalidArgument("Deflator: " + IntToString(log2WindowSize) + " is an invalid window size"); + + m_log2WindowSize = log2WindowSize; + DSIZE = 1 << m_log2WindowSize; + DMASK = DSIZE - 1; + HSIZE = 1 << m_log2WindowSize; + HMASK = HSIZE - 1; + m_byteBuffer.New(2*DSIZE); + m_head.New(HSIZE); + m_prev.New(DSIZE); + m_matchBuffer.New(DSIZE/2); + Reset(true); + + SetDeflateLevel(parameters.GetIntValueWithDefault("DeflateLevel", DEFAULT_DEFLATE_LEVEL)); + bool detectUncompressible = parameters.GetValueWithDefault("DetectUncompressible", true); + m_compressibleDeflateLevel = detectUncompressible ? m_deflateLevel : 0; +} + +void Deflator::Reset(bool forceReset) +{ + if (forceReset) + ClearBitBuffer(); + else + assert(m_bitsBuffered == 0); + + m_headerWritten = false; + m_matchAvailable = false; + m_dictionaryEnd = 0; + m_stringStart = 0; + m_lookahead = 0; + m_minLookahead = MAX_MATCH; + m_matchBufferEnd = 0; + m_blockStart = 0; + m_blockLength = 0; + + m_detectCount = 1; + m_detectSkip = 0; + + // m_prev will be initialized automaticly in InsertString + fill(m_head.begin(), m_head.end(), 0); + + fill(m_literalCounts.begin(), m_literalCounts.end(), 0); + fill(m_distanceCounts.begin(), m_distanceCounts.end(), 0); +} + +void Deflator::SetDeflateLevel(int deflateLevel) +{ + if (!(MIN_DEFLATE_LEVEL <= deflateLevel && deflateLevel <= MAX_DEFLATE_LEVEL)) + throw InvalidArgument("Deflator: " + IntToString(deflateLevel) + " is an invalid deflate level"); + + if (deflateLevel == m_deflateLevel) + return; + + EndBlock(false); + + static const unsigned int configurationTable[10][4] = { + /* good lazy nice chain */ + /* 0 */ {0, 0, 0, 0}, /* store only */ + /* 1 */ {4, 3, 8, 4}, /* maximum speed, no lazy matches */ + /* 2 */ {4, 3, 16, 8}, + /* 3 */ {4, 3, 32, 32}, + /* 4 */ {4, 4, 16, 16}, /* lazy matches */ + /* 5 */ {8, 16, 32, 32}, + /* 6 */ {8, 16, 128, 128}, + /* 7 */ {8, 32, 128, 256}, + /* 8 */ {32, 128, 258, 1024}, + /* 9 */ {32, 258, 258, 4096}}; /* maximum compression */ + + GOOD_MATCH = configurationTable[deflateLevel][0]; + MAX_LAZYLENGTH = configurationTable[deflateLevel][1]; + MAX_CHAIN_LENGTH = configurationTable[deflateLevel][3]; + + m_deflateLevel = deflateLevel; +} + +unsigned int Deflator::FillWindow(const byte *str, size_t length) +{ + unsigned int maxBlockSize = (unsigned int)STDMIN(2UL*DSIZE, 0xffffUL); + + if (m_stringStart >= maxBlockSize - MAX_MATCH) + { + if (m_blockStart < DSIZE) + EndBlock(false); + + memcpy(m_byteBuffer, m_byteBuffer + DSIZE, DSIZE); + + m_dictionaryEnd = m_dictionaryEnd < DSIZE ? 0 : m_dictionaryEnd-DSIZE; + assert(m_stringStart >= DSIZE); + m_stringStart -= DSIZE; + assert(!m_matchAvailable || m_previousMatch >= DSIZE); + m_previousMatch -= DSIZE; + assert(m_blockStart >= DSIZE); + m_blockStart -= DSIZE; + + unsigned int i; + + for (i=0; i m_stringStart+m_lookahead); + unsigned int accepted = UnsignedMin(maxBlockSize-(m_stringStart+m_lookahead), length); + assert(accepted > 0); + memcpy(m_byteBuffer + m_stringStart + m_lookahead, str, accepted); + m_lookahead += accepted; + return accepted; +} + +inline unsigned int Deflator::ComputeHash(const byte *str) const +{ + assert(str+3 <= m_byteBuffer + m_stringStart + m_lookahead); + return ((str[0] << 10) ^ (str[1] << 5) ^ str[2]) & HMASK; +} + +unsigned int Deflator::LongestMatch(unsigned int &bestMatch) const +{ + assert(m_previousLength < MAX_MATCH); + + bestMatch = 0; + unsigned int bestLength = STDMAX(m_previousLength, (unsigned int)MIN_MATCH-1); + if (m_lookahead <= bestLength) + return 0; + + const byte *scan = m_byteBuffer + m_stringStart, *scanEnd = scan + STDMIN((unsigned int)MAX_MATCH, m_lookahead); + unsigned int limit = m_stringStart > (DSIZE-MAX_MATCH) ? m_stringStart - (DSIZE-MAX_MATCH) : 0; + unsigned int current = m_head[ComputeHash(scan)]; + + unsigned int chainLength = MAX_CHAIN_LENGTH; + if (m_previousLength >= GOOD_MATCH) + chainLength >>= 2; + + while (current > limit && --chainLength > 0) + { + const byte *match = m_byteBuffer + current; + assert(scan + bestLength < m_byteBuffer + m_stringStart + m_lookahead); + if (scan[bestLength-1] == match[bestLength-1] && scan[bestLength] == match[bestLength] && scan[0] == match[0] && scan[1] == match[1]) + { + assert(scan[2] == match[2]); + unsigned int len = (unsigned int)( +#if defined(_STDEXT_BEGIN) && !(defined(_MSC_VER) && _MSC_VER < 1400 || _MSC_VER >= 1600) && !defined(_STLPORT_VERSION) + stdext::unchecked_mismatch +#else + std::mismatch +#endif + (scan+3, scanEnd, match+3).first - scan); + assert(len != bestLength); + if (len > bestLength) + { + bestLength = len; + bestMatch = current; + if (len == (scanEnd - scan)) + break; + } + } + current = m_prev[current & DMASK]; + } + return (bestMatch > 0) ? bestLength : 0; +} + +inline void Deflator::InsertString(unsigned int start) +{ + unsigned int hash = ComputeHash(m_byteBuffer + start); + m_prev[start & DMASK] = m_head[hash]; + m_head[hash] = start; +} + +void Deflator::ProcessBuffer() +{ + if (!m_headerWritten) + { + WritePrestreamHeader(); + m_headerWritten = true; + } + + if (m_deflateLevel == 0) + { + m_stringStart += m_lookahead; + m_lookahead = 0; + m_blockLength = m_stringStart - m_blockStart; + m_matchAvailable = false; + return; + } + + while (m_lookahead > m_minLookahead) + { + while (m_dictionaryEnd < m_stringStart && m_dictionaryEnd+3 <= m_stringStart+m_lookahead) + InsertString(m_dictionaryEnd++); + + if (m_matchAvailable) + { + unsigned int matchPosition, matchLength; + bool usePreviousMatch; + if (m_previousLength >= MAX_LAZYLENGTH) + usePreviousMatch = true; + else + { + matchLength = LongestMatch(matchPosition); + usePreviousMatch = (matchLength == 0); + } + if (usePreviousMatch) + { + MatchFound(m_stringStart-1-m_previousMatch, m_previousLength); + m_stringStart += m_previousLength-1; + m_lookahead -= m_previousLength-1; + m_matchAvailable = false; + } + else + { + m_previousLength = matchLength; + m_previousMatch = matchPosition; + LiteralByte(m_byteBuffer[m_stringStart-1]); + m_stringStart++; + m_lookahead--; + } + } + else + { + m_previousLength = 0; + m_previousLength = LongestMatch(m_previousMatch); + if (m_previousLength) + m_matchAvailable = true; + else + LiteralByte(m_byteBuffer[m_stringStart]); + m_stringStart++; + m_lookahead--; + } + + assert(m_stringStart - (m_blockStart+m_blockLength) == (unsigned int)m_matchAvailable); + } + + if (m_minLookahead == 0 && m_matchAvailable) + { + LiteralByte(m_byteBuffer[m_stringStart-1]); + m_matchAvailable = false; + } +} + +size_t Deflator::Put2(const byte *str, size_t length, int messageEnd, bool blocking) +{ + if (!blocking) + throw BlockingInputOnly("Deflator"); + + size_t accepted = 0; + while (accepted < length) + { + unsigned int newAccepted = FillWindow(str+accepted, length-accepted); + ProcessBuffer(); + // call ProcessUncompressedData() after WritePrestreamHeader() + ProcessUncompressedData(str+accepted, newAccepted); + accepted += newAccepted; + } + assert(accepted == length); + + if (messageEnd) + { + m_minLookahead = 0; + ProcessBuffer(); + EndBlock(true); + FlushBitBuffer(); + WritePoststreamTail(); + Reset(); + } + + Output(0, NULL, 0, messageEnd, blocking); + return 0; +} + +bool Deflator::IsolatedFlush(bool hardFlush, bool blocking) +{ + if (!blocking) + throw BlockingInputOnly("Deflator"); + + m_minLookahead = 0; + ProcessBuffer(); + m_minLookahead = MAX_MATCH; + EndBlock(false); + if (hardFlush) + EncodeBlock(false, STORED); + return false; +} + +void Deflator::LiteralByte(byte b) +{ + if (m_matchBufferEnd == m_matchBuffer.size()) + EndBlock(false); + + m_matchBuffer[m_matchBufferEnd++].literalCode = b; + m_literalCounts[b]++; + m_blockLength++; +} + +void Deflator::MatchFound(unsigned int distance, unsigned int length) +{ + if (m_matchBufferEnd == m_matchBuffer.size()) + EndBlock(false); + + static const unsigned int lengthCodes[] = { + 257, 258, 259, 260, 261, 262, 263, 264, 265, 265, 266, 266, 267, 267, 268, 268, + 269, 269, 269, 269, 270, 270, 270, 270, 271, 271, 271, 271, 272, 272, 272, 272, + 273, 273, 273, 273, 273, 273, 273, 273, 274, 274, 274, 274, 274, 274, 274, 274, + 275, 275, 275, 275, 275, 275, 275, 275, 276, 276, 276, 276, 276, 276, 276, 276, + 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, + 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, + 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, + 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 285}; + static const unsigned int lengthBases[] = {3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258}; + static const unsigned int distanceBases[30] = + {1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577}; + + EncodedMatch &m = m_matchBuffer[m_matchBufferEnd++]; + assert(length >= 3); + unsigned int lengthCode = lengthCodes[length-3]; + m.literalCode = lengthCode; + m.literalExtra = length - lengthBases[lengthCode-257]; + unsigned int distanceCode = (unsigned int)(upper_bound(distanceBases, distanceBases+30, distance) - distanceBases - 1); + m.distanceCode = distanceCode; + m.distanceExtra = distance - distanceBases[distanceCode]; + + m_literalCounts[lengthCode]++; + m_distanceCounts[distanceCode]++; + m_blockLength += length; +} + +inline unsigned int CodeLengthEncode(const unsigned int *begin, + const unsigned int *end, + const unsigned int *& p, + unsigned int &extraBits, + unsigned int &extraBitsLength) +{ + unsigned int v = *p; + if ((end-p) >= 3) + { + const unsigned int *oldp = p; + if (v==0 && p[1]==0 && p[2]==0) + { + for (p=p+3; p!=end && *p==0 && p!=oldp+138; p++) {} + unsigned int repeat = (unsigned int)(p - oldp); + if (repeat <= 10) + { + extraBits = repeat-3; + extraBitsLength = 3; + return 17; + } + else + { + extraBits = repeat-11; + extraBitsLength = 7; + return 18; + } + } + else if (p!=begin && v==p[-1] && v==p[1] && v==p[2]) + { + for (p=p+3; p!=end && *p==v && p!=oldp+6; p++) {} + unsigned int repeat = (unsigned int)(p - oldp); + extraBits = repeat-3; + extraBitsLength = 2; + return 16; + } + } + p++; + extraBits = 0; + extraBitsLength = 0; + return v; +} + +void Deflator::EncodeBlock(bool eof, unsigned int blockType) +{ + PutBits(eof, 1); + PutBits(blockType, 2); + + if (blockType == STORED) + { + assert(m_blockStart + m_blockLength <= m_byteBuffer.size()); + assert(m_blockLength <= 0xffff); + FlushBitBuffer(); + AttachedTransformation()->PutWord16(m_blockLength, LITTLE_ENDIAN_ORDER); + AttachedTransformation()->PutWord16(~m_blockLength, LITTLE_ENDIAN_ORDER); + AttachedTransformation()->Put(m_byteBuffer + m_blockStart, m_blockLength); + } + else + { + if (blockType == DYNAMIC) + { +#if defined(_MSC_VER) && !defined(__MWERKS__) && (_MSC_VER <= 1300) + // VC60 and VC7 workaround: built-in reverse_iterator has two template parameters, Dinkumware only has one + typedef reverse_bidirectional_iterator RevIt; +#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + typedef reverse_iterator RevIt; +#else + typedef reverse_iterator RevIt; +#endif + + FixedSizeSecBlock literalCodeLengths; + FixedSizeSecBlock distanceCodeLengths; + + m_literalCounts[256] = 1; + HuffmanEncoder::GenerateCodeLengths(literalCodeLengths, 15, m_literalCounts, 286); + m_dynamicLiteralEncoder.Initialize(literalCodeLengths, 286); + unsigned int hlit = (unsigned int)(find_if(RevIt(literalCodeLengths.end()), RevIt(literalCodeLengths.begin()+257), bind2nd(not_equal_to(), 0)).base() - (literalCodeLengths.begin()+257)); + + HuffmanEncoder::GenerateCodeLengths(distanceCodeLengths, 15, m_distanceCounts, 30); + m_dynamicDistanceEncoder.Initialize(distanceCodeLengths, 30); + unsigned int hdist = (unsigned int)(find_if(RevIt(distanceCodeLengths.end()), RevIt(distanceCodeLengths.begin()+1), bind2nd(not_equal_to(), 0)).base() - (distanceCodeLengths.begin()+1)); + + SecBlockWithHint combinedLengths(hlit+257+hdist+1); + memcpy(combinedLengths, literalCodeLengths, (hlit+257)*sizeof(unsigned int)); + memcpy(combinedLengths+hlit+257, distanceCodeLengths, (hdist+1)*sizeof(unsigned int)); + + FixedSizeSecBlock codeLengthCodeCounts, codeLengthCodeLengths; + fill(codeLengthCodeCounts.begin(), codeLengthCodeCounts.end(), 0); + const unsigned int *p = combinedLengths.begin(), *begin = combinedLengths.begin(), *end = combinedLengths.end(); + while (p != end) + { + unsigned int code, extraBits, extraBitsLength; + code = CodeLengthEncode(begin, end, p, extraBits, extraBitsLength); + codeLengthCodeCounts[code]++; + } + HuffmanEncoder::GenerateCodeLengths(codeLengthCodeLengths, 7, codeLengthCodeCounts, 19); + HuffmanEncoder codeLengthEncoder(codeLengthCodeLengths, 19); + static const unsigned int border[] = { // Order of the bit length code lengths + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + unsigned int hclen = 19; + while (hclen > 4 && codeLengthCodeLengths[border[hclen-1]] == 0) + hclen--; + hclen -= 4; + + PutBits(hlit, 5); + PutBits(hdist, 5); + PutBits(hclen, 4); + + for (unsigned int i=0; i= 257) + { + assert(literalCode <= 285); + PutBits(m_matchBuffer[i].literalExtra, lengthExtraBits[literalCode-257]); + unsigned int distanceCode = m_matchBuffer[i].distanceCode; + distanceEncoder.Encode(*this, distanceCode); + PutBits(m_matchBuffer[i].distanceExtra, distanceExtraBits[distanceCode]); + } + } + literalEncoder.Encode(*this, 256); // end of block + } +} + +void Deflator::EndBlock(bool eof) +{ + if (m_blockLength == 0 && !eof) + return; + + if (m_deflateLevel == 0) + { + EncodeBlock(eof, STORED); + + if (m_compressibleDeflateLevel > 0 && ++m_detectCount == m_detectSkip) + { + m_deflateLevel = m_compressibleDeflateLevel; + m_detectCount = 1; + } + } + else + { + unsigned long storedLen = 8*((unsigned long)m_blockLength+4) + RoundUpToMultipleOf(m_bitsBuffered+3, 8U)-m_bitsBuffered; + + StartCounting(); + EncodeBlock(eof, STATIC); + unsigned long staticLen = FinishCounting(); + + unsigned long dynamicLen; + if (m_blockLength < 128 && m_deflateLevel < 8) + dynamicLen = ULONG_MAX; + else + { + StartCounting(); + EncodeBlock(eof, DYNAMIC); + dynamicLen = FinishCounting(); + } + + if (storedLen <= staticLen && storedLen <= dynamicLen) + { + EncodeBlock(eof, STORED); + + if (m_compressibleDeflateLevel > 0) + { + if (m_detectSkip) + m_deflateLevel = 0; + m_detectSkip = m_detectSkip ? STDMIN(2*m_detectSkip, 128U) : 1; + } + } + else + { + if (staticLen <= dynamicLen) + EncodeBlock(eof, STATIC); + else + EncodeBlock(eof, DYNAMIC); + + if (m_compressibleDeflateLevel > 0) + m_detectSkip = 0; + } + } + + m_matchBufferEnd = 0; + m_blockStart += m_blockLength; + m_blockLength = 0; + fill(m_literalCounts.begin(), m_literalCounts.end(), 0); + fill(m_distanceCounts.begin(), m_distanceCounts.end(), 0); +} + +NAMESPACE_END diff --git a/cryptopp/zdeflate.h b/cryptopp/zdeflate.h new file mode 100644 index 0000000..8bbd14e --- /dev/null +++ b/cryptopp/zdeflate.h @@ -0,0 +1,121 @@ +#ifndef CRYPTOPP_ZDEFLATE_H +#define CRYPTOPP_ZDEFLATE_H + +#include "filters.h" +#include "misc.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class LowFirstBitWriter : public Filter +{ +public: + LowFirstBitWriter(BufferedTransformation *attachment); + void PutBits(unsigned long value, unsigned int length); + void FlushBitBuffer(); + void ClearBitBuffer(); + + void StartCounting(); + unsigned long FinishCounting(); + +protected: + bool m_counting; + unsigned long m_bitCount; + unsigned long m_buffer; + unsigned int m_bitsBuffered, m_bytesBuffered; + FixedSizeSecBlock m_outputBuffer; +}; + +//! Huffman Encoder +class HuffmanEncoder +{ +public: + typedef unsigned int code_t; + typedef unsigned int value_t; + + HuffmanEncoder() {} + HuffmanEncoder(const unsigned int *codeBits, unsigned int nCodes); + void Initialize(const unsigned int *codeBits, unsigned int nCodes); + + static void GenerateCodeLengths(unsigned int *codeBits, unsigned int maxCodeBits, const unsigned int *codeCounts, size_t nCodes); + + void Encode(LowFirstBitWriter &writer, value_t value) const; + + struct Code + { + unsigned int code; + unsigned int len; + }; + + SecBlock m_valueToCode; +}; + +//! DEFLATE (RFC 1951) compressor + +class Deflator : public LowFirstBitWriter +{ +public: + enum {MIN_DEFLATE_LEVEL = 0, DEFAULT_DEFLATE_LEVEL = 6, MAX_DEFLATE_LEVEL = 9}; + enum {MIN_LOG2_WINDOW_SIZE = 9, DEFAULT_LOG2_WINDOW_SIZE = 15, MAX_LOG2_WINDOW_SIZE = 15}; + /*! \note detectUncompressible makes it faster to process uncompressible files, but + if a file has both compressible and uncompressible parts, it may fail to compress some of the + compressible parts. */ + Deflator(BufferedTransformation *attachment=NULL, int deflateLevel=DEFAULT_DEFLATE_LEVEL, int log2WindowSize=DEFAULT_LOG2_WINDOW_SIZE, bool detectUncompressible=true); + //! possible parameter names: Log2WindowSize, DeflateLevel, DetectUncompressible + Deflator(const NameValuePairs ¶meters, BufferedTransformation *attachment=NULL); + + //! this function can be used to set the deflate level in the middle of compression + void SetDeflateLevel(int deflateLevel); + int GetDeflateLevel() const {return m_deflateLevel;} + int GetLog2WindowSize() const {return m_log2WindowSize;} + + void IsolatedInitialize(const NameValuePairs ¶meters); + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking); + bool IsolatedFlush(bool hardFlush, bool blocking); + +protected: + virtual void WritePrestreamHeader() {} + virtual void ProcessUncompressedData(const byte *string, size_t length) {} + virtual void WritePoststreamTail() {} + + enum {STORED = 0, STATIC = 1, DYNAMIC = 2}; + enum {MIN_MATCH = 3, MAX_MATCH = 258}; + + void InitializeStaticEncoders(); + void Reset(bool forceReset = false); + unsigned int FillWindow(const byte *str, size_t length); + unsigned int ComputeHash(const byte *str) const; + unsigned int LongestMatch(unsigned int &bestMatch) const; + void InsertString(unsigned int start); + void ProcessBuffer(); + + void LiteralByte(byte b); + void MatchFound(unsigned int distance, unsigned int length); + void EncodeBlock(bool eof, unsigned int blockType); + void EndBlock(bool eof); + + struct EncodedMatch + { + unsigned literalCode : 9; + unsigned literalExtra : 5; + unsigned distanceCode : 5; + unsigned distanceExtra : 13; + }; + + int m_deflateLevel, m_log2WindowSize, m_compressibleDeflateLevel; + unsigned int m_detectSkip, m_detectCount; + unsigned int DSIZE, DMASK, HSIZE, HMASK, GOOD_MATCH, MAX_LAZYLENGTH, MAX_CHAIN_LENGTH; + bool m_headerWritten, m_matchAvailable; + unsigned int m_dictionaryEnd, m_stringStart, m_lookahead, m_minLookahead, m_previousMatch, m_previousLength; + HuffmanEncoder m_staticLiteralEncoder, m_staticDistanceEncoder, m_dynamicLiteralEncoder, m_dynamicDistanceEncoder; + SecByteBlock m_byteBuffer; + SecBlock m_head, m_prev; + FixedSizeSecBlock m_literalCounts; + FixedSizeSecBlock m_distanceCounts; + SecBlock m_matchBuffer; + unsigned int m_matchBufferEnd, m_blockStart, m_blockLength; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/zinflate.cpp b/cryptopp/zinflate.cpp new file mode 100644 index 0000000..4018e11 --- /dev/null +++ b/cryptopp/zinflate.cpp @@ -0,0 +1,621 @@ +// zinflate.cpp - written and placed in the public domain by Wei Dai + +// This is a complete reimplementation of the DEFLATE decompression algorithm. +// It should not be affected by any security vulnerabilities in the zlib +// compression library. In particular it is not affected by the double free bug +// (http://www.kb.cert.org/vuls/id/368819). + +#include "pch.h" +#include "zinflate.h" + +NAMESPACE_BEGIN(CryptoPP) + +struct CodeLessThan +{ + inline bool operator()(CryptoPP::HuffmanDecoder::code_t lhs, const CryptoPP::HuffmanDecoder::CodeInfo &rhs) + {return lhs < rhs.code;} + // needed for MSVC .NET 2005 + inline bool operator()(const CryptoPP::HuffmanDecoder::CodeInfo &lhs, const CryptoPP::HuffmanDecoder::CodeInfo &rhs) + {return lhs.code < rhs.code;} +}; + +inline bool LowFirstBitReader::FillBuffer(unsigned int length) +{ + while (m_bitsBuffered < length) + { + byte b; + if (!m_store.Get(b)) + return false; + m_buffer |= (unsigned long)b << m_bitsBuffered; + m_bitsBuffered += 8; + } + assert(m_bitsBuffered <= sizeof(unsigned long)*8); + return true; +} + +inline unsigned long LowFirstBitReader::PeekBits(unsigned int length) +{ + bool result = FillBuffer(length); + assert(result); + return m_buffer & (((unsigned long)1 << length) - 1); +} + +inline void LowFirstBitReader::SkipBits(unsigned int length) +{ + assert(m_bitsBuffered >= length); + m_buffer >>= length; + m_bitsBuffered -= length; +} + +inline unsigned long LowFirstBitReader::GetBits(unsigned int length) +{ + unsigned long result = PeekBits(length); + SkipBits(length); + return result; +} + +inline HuffmanDecoder::code_t HuffmanDecoder::NormalizeCode(HuffmanDecoder::code_t code, unsigned int codeBits) +{ + return code << (MAX_CODE_BITS - codeBits); +} + +void HuffmanDecoder::Initialize(const unsigned int *codeBits, unsigned int nCodes) +{ + // the Huffman codes are represented in 3 ways in this code: + // + // 1. most significant code bit (i.e. top of code tree) in the least significant bit position + // 2. most significant code bit (i.e. top of code tree) in the most significant bit position + // 3. most significant code bit (i.e. top of code tree) in n-th least significant bit position, + // where n is the maximum code length for this code tree + // + // (1) is the way the codes come in from the deflate stream + // (2) is used to sort codes so they can be binary searched + // (3) is used in this function to compute codes from code lengths + // + // a code in representation (2) is called "normalized" here + // The BitReverse() function is used to convert between (1) and (2) + // The NormalizeCode() function is used to convert from (3) to (2) + + if (nCodes == 0) + throw Err("null code"); + + m_maxCodeBits = *std::max_element(codeBits, codeBits+nCodes); + + if (m_maxCodeBits > MAX_CODE_BITS) + throw Err("code length exceeds maximum"); + + if (m_maxCodeBits == 0) + throw Err("null code"); + + // count number of codes of each length + SecBlockWithHint blCount(m_maxCodeBits+1); + std::fill(blCount.begin(), blCount.end(), 0); + unsigned int i; + for (i=0; i nextCode(m_maxCodeBits+1); + nextCode[1] = 0; + for (i=2; i<=m_maxCodeBits; i++) + { + // compute this while checking for overflow: code = (code + blCount[i-1]) << 1 + if (code > code + blCount[i-1]) + throw Err("codes oversubscribed"); + code += blCount[i-1]; + if (code > (code << 1)) + throw Err("codes oversubscribed"); + code <<= 1; + nextCode[i] = code; + } + + if (code > (1 << m_maxCodeBits) - blCount[m_maxCodeBits]) + throw Err("codes oversubscribed"); + else if (m_maxCodeBits != 1 && code < (1 << m_maxCodeBits) - blCount[m_maxCodeBits]) + throw Err("codes incomplete"); + + // compute a vector of triples sorted by code + m_codeToValue.resize(nCodes - blCount[0]); + unsigned int j=0; + for (i=0; ilen) + { + entry.type = 2; + entry.len = codeInfo.len; + } + else + { + entry.type = 3; + entry.end = last+1; + } + } +} + +inline unsigned int HuffmanDecoder::Decode(code_t code, /* out */ value_t &value) const +{ + assert(m_codeToValue.size() > 0); + LookupEntry &entry = m_cache[code & m_cacheMask]; + + code_t normalizedCode; + if (entry.type != 1) + normalizedCode = BitReverse(code); + + if (entry.type == 0) + FillCacheEntry(entry, normalizedCode); + + if (entry.type == 1) + { + value = entry.value; + return entry.len; + } + else + { + const CodeInfo &codeInfo = (entry.type == 2) + ? entry.begin[(normalizedCode << m_cacheBits) >> (MAX_CODE_BITS - (entry.len - m_cacheBits))] + : *(std::upper_bound(entry.begin, entry.end, normalizedCode, CodeLessThan())-1); + value = codeInfo.value; + return codeInfo.len; + } +} + +bool HuffmanDecoder::Decode(LowFirstBitReader &reader, value_t &value) const +{ + reader.FillBuffer(m_maxCodeBits); + unsigned int codeBits = Decode(reader.PeekBuffer(), value); + if (codeBits > reader.BitsBuffered()) + return false; + reader.SkipBits(codeBits); + return true; +} + +// ************************************************************* + +Inflator::Inflator(BufferedTransformation *attachment, bool repeat, int propagation) + : AutoSignaling(propagation) + , m_state(PRE_STREAM), m_repeat(repeat), m_reader(m_inQueue) +{ + Detach(attachment); +} + +void Inflator::IsolatedInitialize(const NameValuePairs ¶meters) +{ + m_state = PRE_STREAM; + parameters.GetValue("Repeat", m_repeat); + m_inQueue.Clear(); + m_reader.SkipBits(m_reader.BitsBuffered()); +} + +void Inflator::OutputByte(byte b) +{ + m_window[m_current++] = b; + if (m_current == m_window.size()) + { + ProcessDecompressedData(m_window + m_lastFlush, m_window.size() - m_lastFlush); + m_lastFlush = 0; + m_current = 0; + m_wrappedAround = true; + } +} + +void Inflator::OutputString(const byte *string, size_t length) +{ + while (length) + { + size_t len = UnsignedMin(length, m_window.size() - m_current); + memcpy(m_window + m_current, string, len); + m_current += len; + if (m_current == m_window.size()) + { + ProcessDecompressedData(m_window + m_lastFlush, m_window.size() - m_lastFlush); + m_lastFlush = 0; + m_current = 0; + m_wrappedAround = true; + } + string += len; + length -= len; + } +} + +void Inflator::OutputPast(unsigned int length, unsigned int distance) +{ + size_t start; + if (distance <= m_current) + start = m_current - distance; + else if (m_wrappedAround && distance <= m_window.size()) + start = m_current + m_window.size() - distance; + else + throw BadBlockErr(); + + if (start + length > m_window.size()) + { + for (; start < m_window.size(); start++, length--) + OutputByte(m_window[start]); + start = 0; + } + + if (start + length > m_current || m_current + length >= m_window.size()) + { + while (length--) + OutputByte(m_window[start++]); + } + else + { + memcpy(m_window + m_current, m_window + start, length); + m_current += length; + } +} + +size_t Inflator::Put2(const byte *inString, size_t length, int messageEnd, bool blocking) +{ + if (!blocking) + throw BlockingInputOnly("Inflator"); + + LazyPutter lp(m_inQueue, inString, length); + ProcessInput(messageEnd != 0); + + if (messageEnd) + if (!(m_state == PRE_STREAM || m_state == AFTER_END)) + throw UnexpectedEndErr(); + + Output(0, NULL, 0, messageEnd, blocking); + return 0; +} + +bool Inflator::IsolatedFlush(bool hardFlush, bool blocking) +{ + if (!blocking) + throw BlockingInputOnly("Inflator"); + + if (hardFlush) + ProcessInput(true); + FlushOutput(); + + return false; +} + +void Inflator::ProcessInput(bool flush) +{ + while (true) + { + switch (m_state) + { + case PRE_STREAM: + if (!flush && m_inQueue.CurrentSize() < MaxPrestreamHeaderSize()) + return; + ProcessPrestreamHeader(); + m_state = WAIT_HEADER; + m_wrappedAround = false; + m_current = 0; + m_lastFlush = 0; + m_window.New(1 << GetLog2WindowSize()); + break; + case WAIT_HEADER: + { + // maximum number of bytes before actual compressed data starts + const size_t MAX_HEADER_SIZE = BitsToBytes(3+5+5+4+19*7+286*15+19*15); + if (m_inQueue.CurrentSize() < (flush ? 1 : MAX_HEADER_SIZE)) + return; + DecodeHeader(); + break; + } + case DECODING_BODY: + if (!DecodeBody()) + return; + break; + case POST_STREAM: + if (!flush && m_inQueue.CurrentSize() < MaxPoststreamTailSize()) + return; + ProcessPoststreamTail(); + m_state = m_repeat ? PRE_STREAM : AFTER_END; + Output(0, NULL, 0, GetAutoSignalPropagation(), true); // TODO: non-blocking + if (m_inQueue.IsEmpty()) + return; + break; + case AFTER_END: + m_inQueue.TransferTo(*AttachedTransformation()); + return; + } + } +} + +void Inflator::DecodeHeader() +{ + if (!m_reader.FillBuffer(3)) + throw UnexpectedEndErr(); + m_eof = m_reader.GetBits(1) != 0; + m_blockType = (byte)m_reader.GetBits(2); + switch (m_blockType) + { + case 0: // stored + { + m_reader.SkipBits(m_reader.BitsBuffered() % 8); + if (!m_reader.FillBuffer(32)) + throw UnexpectedEndErr(); + m_storedLen = (word16)m_reader.GetBits(16); + word16 nlen = (word16)m_reader.GetBits(16); + if (nlen != (word16)~m_storedLen) + throw BadBlockErr(); + break; + } + case 1: // fixed codes + m_nextDecode = LITERAL; + break; + case 2: // dynamic codes + { + if (!m_reader.FillBuffer(5+5+4)) + throw UnexpectedEndErr(); + unsigned int hlit = m_reader.GetBits(5); + unsigned int hdist = m_reader.GetBits(5); + unsigned int hclen = m_reader.GetBits(4); + + FixedSizeSecBlock codeLengths; + unsigned int i; + static const unsigned int border[] = { // Order of the bit length code lengths + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + std::fill(codeLengths.begin(), codeLengths+19, 0); + for (i=0; i hlit+257+hdist+1) + throw BadBlockErr(); + std::fill(codeLengths + i, codeLengths + i + count, repeater); + i += count; + } + m_dynamicLiteralDecoder.Initialize(codeLengths, hlit+257); + if (hdist == 0 && codeLengths[hlit+257] == 0) + { + if (hlit != 0) // a single zero distance code length means all literals + throw BadBlockErr(); + } + else + m_dynamicDistanceDecoder.Initialize(codeLengths+hlit+257, hdist+1); + m_nextDecode = LITERAL; + } + catch (HuffmanDecoder::Err &) + { + throw BadBlockErr(); + } + break; + } + default: + throw BadBlockErr(); // reserved block type + } + m_state = DECODING_BODY; +} + +bool Inflator::DecodeBody() +{ + bool blockEnd = false; + switch (m_blockType) + { + case 0: // stored + assert(m_reader.BitsBuffered() == 0); + while (!m_inQueue.IsEmpty() && !blockEnd) + { + size_t size; + const byte *block = m_inQueue.Spy(size); + size = UnsignedMin(m_storedLen, size); + OutputString(block, size); + m_inQueue.Skip(size); + m_storedLen -= (word16)size; + if (m_storedLen == 0) + blockEnd = true; + } + break; + case 1: // fixed codes + case 2: // dynamic codes + static const unsigned int lengthStarts[] = { + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; + static const unsigned int lengthExtraBits[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; + static const unsigned int distanceStarts[] = { + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577}; + static const unsigned int distanceExtraBits[] = { + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, + 12, 12, 13, 13}; + + const HuffmanDecoder& literalDecoder = GetLiteralDecoder(); + const HuffmanDecoder& distanceDecoder = GetDistanceDecoder(); + + switch (m_nextDecode) + { + case LITERAL: + while (true) + { + if (!literalDecoder.Decode(m_reader, m_literal)) + { + m_nextDecode = LITERAL; + break; + } + if (m_literal < 256) + OutputByte((byte)m_literal); + else if (m_literal == 256) // end of block + { + blockEnd = true; + break; + } + else + { + if (m_literal > 285) + throw BadBlockErr(); + unsigned int bits; + case LENGTH_BITS: + bits = lengthExtraBits[m_literal-257]; + if (!m_reader.FillBuffer(bits)) + { + m_nextDecode = LENGTH_BITS; + break; + } + m_literal = m_reader.GetBits(bits) + lengthStarts[m_literal-257]; + case DISTANCE: + if (!distanceDecoder.Decode(m_reader, m_distance)) + { + m_nextDecode = DISTANCE; + break; + } + case DISTANCE_BITS: + bits = distanceExtraBits[m_distance]; + if (!m_reader.FillBuffer(bits)) + { + m_nextDecode = DISTANCE_BITS; + break; + } + m_distance = m_reader.GetBits(bits) + distanceStarts[m_distance]; + OutputPast(m_literal, m_distance); + } + } + } + } + if (blockEnd) + { + if (m_eof) + { + FlushOutput(); + m_reader.SkipBits(m_reader.BitsBuffered()%8); + if (m_reader.BitsBuffered()) + { + // undo too much lookahead + SecBlockWithHint buffer(m_reader.BitsBuffered() / 8); + for (unsigned int i=0; i= m_lastFlush); + ProcessDecompressedData(m_window + m_lastFlush, m_current - m_lastFlush); + m_lastFlush = m_current; + } +} + +struct NewFixedLiteralDecoder +{ + HuffmanDecoder * operator()() const + { + unsigned int codeLengths[288]; + std::fill(codeLengths + 0, codeLengths + 144, 8); + std::fill(codeLengths + 144, codeLengths + 256, 9); + std::fill(codeLengths + 256, codeLengths + 280, 7); + std::fill(codeLengths + 280, codeLengths + 288, 8); + std::auto_ptr pDecoder(new HuffmanDecoder); + pDecoder->Initialize(codeLengths, 288); + return pDecoder.release(); + } +}; + +struct NewFixedDistanceDecoder +{ + HuffmanDecoder * operator()() const + { + unsigned int codeLengths[32]; + std::fill(codeLengths + 0, codeLengths + 32, 5); + std::auto_ptr pDecoder(new HuffmanDecoder); + pDecoder->Initialize(codeLengths, 32); + return pDecoder.release(); + } +}; + +const HuffmanDecoder& Inflator::GetLiteralDecoder() const +{ + return m_blockType == 1 ? Singleton().Ref() : m_dynamicLiteralDecoder; +} + +const HuffmanDecoder& Inflator::GetDistanceDecoder() const +{ + return m_blockType == 1 ? Singleton().Ref() : m_dynamicDistanceDecoder; +} + +NAMESPACE_END diff --git a/cryptopp/zinflate.h b/cryptopp/zinflate.h new file mode 100644 index 0000000..7e1225b --- /dev/null +++ b/cryptopp/zinflate.h @@ -0,0 +1,149 @@ +#ifndef CRYPTOPP_ZINFLATE_H +#define CRYPTOPP_ZINFLATE_H + +#include "filters.h" +#include + +NAMESPACE_BEGIN(CryptoPP) + +//! _ +class LowFirstBitReader +{ +public: + LowFirstBitReader(BufferedTransformation &store) + : m_store(store), m_buffer(0), m_bitsBuffered(0) {} +// unsigned long BitsLeft() const {return m_store.MaxRetrievable() * 8 + m_bitsBuffered;} + unsigned int BitsBuffered() const {return m_bitsBuffered;} + unsigned long PeekBuffer() const {return m_buffer;} + bool FillBuffer(unsigned int length); + unsigned long PeekBits(unsigned int length); + void SkipBits(unsigned int length); + unsigned long GetBits(unsigned int length); + +private: + BufferedTransformation &m_store; + unsigned long m_buffer; + unsigned int m_bitsBuffered; +}; + +struct CodeLessThan; + +//! Huffman Decoder +class HuffmanDecoder +{ +public: + typedef unsigned int code_t; + typedef unsigned int value_t; + enum {MAX_CODE_BITS = sizeof(code_t)*8}; + + class Err : public Exception {public: Err(const std::string &what) : Exception(INVALID_DATA_FORMAT, "HuffmanDecoder: " + what) {}}; + + HuffmanDecoder() {} + HuffmanDecoder(const unsigned int *codeBitLengths, unsigned int nCodes) {Initialize(codeBitLengths, nCodes);} + + void Initialize(const unsigned int *codeBitLengths, unsigned int nCodes); + unsigned int Decode(code_t code, /* out */ value_t &value) const; + bool Decode(LowFirstBitReader &reader, value_t &value) const; + +private: + friend struct CodeLessThan; + + struct CodeInfo + { + CodeInfo(code_t code=0, unsigned int len=0, value_t value=0) : code(code), len(len), value(value) {} + inline bool operator<(const CodeInfo &rhs) const {return code < rhs.code;} + code_t code; + unsigned int len; + value_t value; + }; + + struct LookupEntry + { + unsigned int type; + union + { + value_t value; + const CodeInfo *begin; + }; + union + { + unsigned int len; + const CodeInfo *end; + }; + }; + + static code_t NormalizeCode(code_t code, unsigned int codeBits); + void FillCacheEntry(LookupEntry &entry, code_t normalizedCode) const; + + unsigned int m_maxCodeBits, m_cacheBits, m_cacheMask, m_normalizedCacheMask; + std::vector > m_codeToValue; + mutable std::vector > m_cache; +}; + +//! DEFLATE (RFC 1951) decompressor + +class Inflator : public AutoSignaling +{ +public: + class Err : public Exception + { + public: + Err(ErrorType e, const std::string &s) + : Exception(e, s) {} + }; + class UnexpectedEndErr : public Err {public: UnexpectedEndErr() : Err(INVALID_DATA_FORMAT, "Inflator: unexpected end of compressed block") {}}; + class BadBlockErr : public Err {public: BadBlockErr() : Err(INVALID_DATA_FORMAT, "Inflator: error in compressed block") {}}; + + /*! \param repeat decompress multiple compressed streams in series + \param autoSignalPropagation 0 to turn off MessageEnd signal + */ + Inflator(BufferedTransformation *attachment = NULL, bool repeat = false, int autoSignalPropagation = -1); + + void IsolatedInitialize(const NameValuePairs ¶meters); + size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking); + bool IsolatedFlush(bool hardFlush, bool blocking); + + virtual unsigned int GetLog2WindowSize() const {return 15;} + +protected: + ByteQueue m_inQueue; + +private: + virtual unsigned int MaxPrestreamHeaderSize() const {return 0;} + virtual void ProcessPrestreamHeader() {} + virtual void ProcessDecompressedData(const byte *string, size_t length) + {AttachedTransformation()->Put(string, length);} + virtual unsigned int MaxPoststreamTailSize() const {return 0;} + virtual void ProcessPoststreamTail() {} + + void ProcessInput(bool flush); + void DecodeHeader(); + bool DecodeBody(); + void FlushOutput(); + void OutputByte(byte b); + void OutputString(const byte *string, size_t length); + void OutputPast(unsigned int length, unsigned int distance); + + static const HuffmanDecoder *FixedLiteralDecoder(); + static const HuffmanDecoder *FixedDistanceDecoder(); + + const HuffmanDecoder& GetLiteralDecoder() const; + const HuffmanDecoder& GetDistanceDecoder() const; + + enum State {PRE_STREAM, WAIT_HEADER, DECODING_BODY, POST_STREAM, AFTER_END}; + State m_state; + bool m_repeat, m_eof, m_wrappedAround; + byte m_blockType; + word16 m_storedLen; + enum NextDecode {LITERAL, LENGTH_BITS, DISTANCE, DISTANCE_BITS}; + NextDecode m_nextDecode; + unsigned int m_literal, m_distance; // for LENGTH_BITS or DISTANCE_BITS + HuffmanDecoder m_dynamicLiteralDecoder, m_dynamicDistanceDecoder; + LowFirstBitReader m_reader; + SecByteBlock m_window; + size_t m_current, m_lastFlush; +}; + +NAMESPACE_END + +#endif diff --git a/cryptopp/zlib.cpp b/cryptopp/zlib.cpp new file mode 100644 index 0000000..4abafb0 --- /dev/null +++ b/cryptopp/zlib.cpp @@ -0,0 +1,90 @@ +// zlib.cpp - written and placed in the public domain by Wei Dai + +// "zlib" is the name of a well known C language compression library +// (http://www.zlib.org) and also the name of a compression format +// (RFC 1950) that the library implements. This file is part of a +// complete reimplementation of the zlib compression format. + +#include "pch.h" +#include "zlib.h" +#include "zdeflate.h" +#include "zinflate.h" + +NAMESPACE_BEGIN(CryptoPP) + +static const byte DEFLATE_METHOD = 8; +static const byte FDICT_FLAG = 1 << 5; + +// ************************************************************* + +void ZlibCompressor::WritePrestreamHeader() +{ + m_adler32.Restart(); + byte cmf = DEFLATE_METHOD | ((GetLog2WindowSize()-8) << 4); + byte flags = GetCompressionLevel() << 6; + AttachedTransformation()->PutWord16(RoundUpToMultipleOf(cmf*256+flags, 31)); +} + +void ZlibCompressor::ProcessUncompressedData(const byte *inString, size_t length) +{ + m_adler32.Update(inString, length); +} + +void ZlibCompressor::WritePoststreamTail() +{ + FixedSizeSecBlock adler32; + m_adler32.Final(adler32); + AttachedTransformation()->Put(adler32, 4); +} + +unsigned int ZlibCompressor::GetCompressionLevel() const +{ + static const unsigned int deflateToCompressionLevel[] = {0, 1, 1, 1, 2, 2, 2, 2, 2, 3}; + return deflateToCompressionLevel[GetDeflateLevel()]; +} + +// ************************************************************* + +ZlibDecompressor::ZlibDecompressor(BufferedTransformation *attachment, bool repeat, int propagation) + : Inflator(attachment, repeat, propagation) +{ +} + +void ZlibDecompressor::ProcessPrestreamHeader() +{ + m_adler32.Restart(); + + byte cmf; + byte flags; + + if (!m_inQueue.Get(cmf) || !m_inQueue.Get(flags)) + throw HeaderErr(); + + if ((cmf*256+flags) % 31 != 0) + throw HeaderErr(); // if you hit this exception, you're probably trying to decompress invalid data + + if ((cmf & 0xf) != DEFLATE_METHOD) + throw UnsupportedAlgorithm(); + + if (flags & FDICT_FLAG) + throw UnsupportedPresetDictionary(); + + m_log2WindowSize = 8 + (cmf >> 4); +} + +void ZlibDecompressor::ProcessDecompressedData(const byte *inString, size_t length) +{ + AttachedTransformation()->Put(inString, length); + m_adler32.Update(inString, length); +} + +void ZlibDecompressor::ProcessPoststreamTail() +{ + FixedSizeSecBlock adler32; + if (m_inQueue.Get(adler32, 4) != 4) + throw Adler32Err(); + if (!m_adler32.Verify(adler32)) + throw Adler32Err(); +} + +NAMESPACE_END diff --git a/cryptopp/zlib.h b/cryptopp/zlib.h new file mode 100644 index 0000000..443b144 --- /dev/null +++ b/cryptopp/zlib.h @@ -0,0 +1,58 @@ +#ifndef CRYPTOPP_ZLIB_H +#define CRYPTOPP_ZLIB_H + +#include "adler32.h" +#include "zdeflate.h" +#include "zinflate.h" + +NAMESPACE_BEGIN(CryptoPP) + +/// ZLIB Compressor (RFC 1950) +class ZlibCompressor : public Deflator +{ +public: + ZlibCompressor(BufferedTransformation *attachment=NULL, unsigned int deflateLevel=DEFAULT_DEFLATE_LEVEL, unsigned int log2WindowSize=DEFAULT_LOG2_WINDOW_SIZE, bool detectUncompressible=true) + : Deflator(attachment, deflateLevel, log2WindowSize, detectUncompressible) {} + ZlibCompressor(const NameValuePairs ¶meters, BufferedTransformation *attachment=NULL) + : Deflator(parameters, attachment) {} + + unsigned int GetCompressionLevel() const; + +protected: + void WritePrestreamHeader(); + void ProcessUncompressedData(const byte *string, size_t length); + void WritePoststreamTail(); + + Adler32 m_adler32; +}; + +/// ZLIB Decompressor (RFC 1950) +class ZlibDecompressor : public Inflator +{ +public: + typedef Inflator::Err Err; + class HeaderErr : public Err {public: HeaderErr() : Err(INVALID_DATA_FORMAT, "ZlibDecompressor: header decoding error") {}}; + class Adler32Err : public Err {public: Adler32Err() : Err(DATA_INTEGRITY_CHECK_FAILED, "ZlibDecompressor: ADLER32 check error") {}}; + class UnsupportedAlgorithm : public Err {public: UnsupportedAlgorithm() : Err(INVALID_DATA_FORMAT, "ZlibDecompressor: unsupported algorithm") {}}; + class UnsupportedPresetDictionary : public Err {public: UnsupportedPresetDictionary() : Err(INVALID_DATA_FORMAT, "ZlibDecompressor: unsupported preset dictionary") {}}; + + /*! \param repeat decompress multiple compressed streams in series + \param autoSignalPropagation 0 to turn off MessageEnd signal + */ + ZlibDecompressor(BufferedTransformation *attachment = NULL, bool repeat = false, int autoSignalPropagation = -1); + unsigned int GetLog2WindowSize() const {return m_log2WindowSize;} + +private: + unsigned int MaxPrestreamHeaderSize() const {return 2;} + void ProcessPrestreamHeader(); + void ProcessDecompressedData(const byte *string, size_t length); + unsigned int MaxPoststreamTailSize() const {return 4;} + void ProcessPoststreamTail(); + + unsigned int m_log2WindowSize; + Adler32 m_adler32; +}; + +NAMESPACE_END + +#endif diff --git a/id3lib/AUTHORS b/id3lib/AUTHORS new file mode 100644 index 0000000..da117bb --- /dev/null +++ b/id3lib/AUTHORS @@ -0,0 +1,5 @@ +t1mpy: Thijmen Klok +/* + * Only for questions if Thijmen seems to be dead: + * shadrack: Cedric Tefft +*/ diff --git a/id3lib/COPYING b/id3lib/COPYING new file mode 100644 index 0000000..bf50f20 --- /dev/null +++ b/id3lib/COPYING @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/id3lib/ChangeLog b/id3lib/ChangeLog new file mode 100644 index 0000000..9499356 --- /dev/null +++ b/id3lib/ChangeLog @@ -0,0 +1,10601 @@ +2003-03-02 Sunday 17:38 Thijmen Klok + + * THANKS (1.20): added more people + +2003-03-02 Sunday 17:37 Thijmen Klok + + * config.h.win32 (1.25), config.h.win32.in (1.13), configure + (1.79), configure.in (1.68), macconfig.h (1.12): changes to reflect + new version + +2003-03-02 Sunday 17:19 Thijmen Klok + + * config.sub (1.3), config.guess (1.3): update from + ftp://ftp.gnu.org/pub/gnu/config/ timestamp 2003-02-22 + +2003-03-02 Sunday 16:17 Thijmen Klok + + * examples/: demo_main.cpp (1.4), test_io.cpp (1.6), + test_remove.cpp (1.13): added cerr cout and endl where needed + +2003-03-02 Sunday 15:39 Thijmen Klok + + * src/tag_find.cpp (1.28): Fixes a bug where a string is tried to + be made from NULL + +2003-03-02 Sunday 15:30 Thijmen Klok + + * src/header_tag.cpp (1.25): adds a check on _info for NULL + +2003-03-02 Sunday 15:23 Thijmen Klok + + * src/: field_string_ascii.cpp (1.29), field_string_unicode.cpp + (1.33), field_binary.cpp (1.27): added a check for NULL in Set() + +2003-03-02 Sunday 15:14 Thijmen Klok + + * src/tag_file.cpp (1.43): fixes left open file + +2003-03-02 Sunday 14:56 Thijmen Klok + + * include/id3/id3lib_strings.h (1.4): fix for undefined wchar_t + template + +2003-03-02 Sunday 14:35 Thijmen Klok + + * src/tag.cpp (1.55), include/id3/tag.h (1.63): fix because + GetFileName need to return a pointer which keeps to be valid + +2003-02-21 Friday 04:47 slackorama + + * include/id3/globals.h (1.54): added a missing const to remove + warning when compiling with -Wwrite-strings (as is done in KDE and + many other projects) + +2002-11-24 Sunday 20:39 Thijmen Klok + + * ChangeLog (1.138): added all entries for 3.8.2 release + +2002-11-24 Sunday 20:34 Thijmen Klok + + * id3com/id3com.dsp (1.20): added link32 to zlib + +2002-11-24 Sunday 18:33 Thijmen Klok + + * src/tag_parse.cpp (1.47): fixed a bug which caused v1 tags to be + ignored after a lyrics v2 tag + +2002-11-24 Sunday 17:31 Thijmen Klok + + * src/tag_parse.cpp (1.46): fixed a stupid bug of mine, affecting + wrong handling of id3v1 tags + +2002-11-03 Sunday 01:41 Thijmen Klok + + * src/field.cpp (1.47): fixes access to invalid framedefs + +2002-11-02 Saturday 23:28 Thijmen Klok + + * id3com/win32.readme.first.txt (1.4), + libprj/win32.readme.first.txt (1.4), prj/win32.readme.first.txt + (1.4): improved comment on delphi + +2002-11-02 Saturday 22:02 Thijmen Klok + + * src/tag_file.cpp (1.42): fixed a bug in RenderV2ToFile, file was + not cleared and thus eof mark was still set + +2002-11-02 Saturday 19:10 Thijmen Klok + + * ChangeLog (1.137): added todays work + +2002-11-02 Saturday 19:07 Thijmen Klok + + * config.h.win32 (1.24), configure (1.78), configure.in (1.67), + macconfig.h (1.11): bumped version up to 3.8.1 + +2002-11-02 Saturday 19:03 Thijmen Klok + + * id3lib.spec.in (1.27): added a line on mp3 headers + +2002-11-02 Saturday 18:49 Thijmen Klok + + * THANKS (1.19): added latest help + +2002-11-02 Saturday 18:48 Thijmen Klok + + * include/id3/globals.h (1.53), src/mp3_header.h (1.4), + src/mp3_parse.cpp (1.6): added vbr support + +2002-11-02 Saturday 18:35 Thijmen Klok + + * include/id3/tag.h (1.62), src/tag.cpp (1.54), src/tag_file.cpp + (1.41), src/tag_impl.h (1.10), src/tag_parse.cpp (1.45): added + streaming support + +2002-11-02 Saturday 18:03 Thijmen Klok + + * libprj/win32.readme.first.txt (1.3), + id3com/win32.readme.first.txt (1.3), prj/win32.readme.first.txt + (1.3): added comment about id3lib.pas + +2002-11-02 Saturday 17:56 Thijmen Klok + + * delphi/Id3lib.pas (1.1): added delphi interface to id3lib + +2002-11-02 Saturday 13:45 Thijmen Klok + + * id3com/: ID3Tag.cpp (1.14), id3com.dsp (1.19), id3com.idl (1.13): + Updated id3com in line with latest id3lib + +2002-10-04 Friday 10:57 Thijmen Klok + + * ChangeLog (1.136): added latest entries + +2002-10-04 Friday 10:52 Thijmen Klok + + * src/tag_parse_lyrics3.cpp (1.35): cleaning source + +2002-09-23 Monday 23:32 slackorama + + * src/tag_parse_lyrics3.cpp (1.34): Fixed a "version priority" + issue in the ID3 lyrics tagging stuff. Posted patch on id3lib-devel + first. + +2002-09-21 Saturday 19:23 Thijmen Klok + + * include/id3.h (1.21), include/id3/tag.h (1.61), src/c_wrapper.cpp + (1.22, rel-3-7-10), src/helpers.cpp (1.12), src/tag.cpp (1.53), + src/tag_impl.cpp (1.13), src/tag_impl.h (1.9): added boolean return + for AttachFrame + +2002-09-21 Saturday 18:04 Thijmen Klok + + * src/tag_impl.cpp (1.12): initializing _mp3_info to NULL + +2002-09-19 Thursday 12:20 Thijmen Klok + + * src/misc_support.cpp (1.39), include/id3/misc_support.h (1.29): + fixed prototpyes ID3_GetSyncLyrics + +2002-08-13 Tuesday 18:10 Thijmen Klok + + * include/id3/id3lib_strings.h (1.3): fixed compile for gcc 3.2 + +2002-08-11 Sunday 12:58 Thijmen Klok + + * cvs2cl.pl (1.2): changed command for use of ssh + +2002-08-10 Saturday 22:39 Thijmen Klok + + * config.h.win32.in (1.12): updated for version info on dll + +2002-08-10 Saturday 22:13 Thijmen Klok + + * ChangeLog (1.135): updated changelog for latest changes before + final + +2002-08-10 Saturday 22:02 Thijmen Klok + + * examples/getopt.c (1.3): fixed stupid gcc warning from external + code + +2002-08-10 Saturday 19:40 Thijmen Klok + + * include/id3/globals.h (1.52), include/id3/misc_support.h (1.28), + src/misc_support.cpp (1.38): added routines to misc_support + +2002-08-10 Saturday 18:33 Thijmen Klok + + * THANKS (1.18): added two busy developers + +2002-08-10 Saturday 15:27 Thijmen Klok + + * ChangeLog (1.134): added notes until final version + +2002-08-10 Saturday 15:13 Thijmen Klok + + * id3com/win32.readme.first.txt (1.2), + libprj/win32.readme.first.txt (1.2), prj/win32.readme.first.txt + (1.2): updated for MFC instructions + +2002-08-10 Saturday 13:51 Thijmen Klok + + * config.h.win32 (1.23), configure (1.77), configure.in (1.66), + macconfig.h (1.10, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10): + updated for final version 3.8.0 + +2002-08-10 Saturday 13:49 Thijmen Klok + + * makefile.win32 (1.3): updated to include new link option and + mp3_parse.cpp + +2002-08-10 Saturday 13:47 Thijmen Klok + + * id3com/id3com.dsp (1.18), include/id3.h (1.20), + include/id3/globals.h (1.51), libprj/id3lib.dsp (1.16), + prj/id3lib.dsp (1.18), src/c_wrapper.cpp (1.21): updated to include + CCONV definition and use the new linkoption + +2002-08-10 Saturday 12:50 Thijmen Klok + + * src/frame_impl.h (1.6): Added copyright + +2002-08-10 Saturday 12:42 Thijmen Klok + + * include/id3/Makefile.am (1.23), include/id3/Makefile.in (1.59), + include/id3/tag.h (1.60), src/c_wrapper.cpp (1.20), src/frame.cpp + (1.35), src/frame_impl.h (1.4), src/frame_impl.h (1.5), + include/id3/id3lib_frame.h (1.1), include/id3/frame.h (1.43): + Renamed frame.h to avoid conflict with windows and gcc header + +2002-08-10 Saturday 12:17 Thijmen Klok + + * include/id3/tag.h (1.59), src/tag.cpp (1.52), src/tag_impl.h + (1.8): changed HasTagType from uint16 to ID3_TagType for c_wrapper + +2002-08-08 Thursday 23:28 Thijmen Klok + + * config.h.win32 (1.22), prj/version.rc (1.2): made dll versioning + automated + +2002-08-08 Thursday 17:41 Thijmen Klok + + * prj/: version.rc (1.1), Makefile.am (1.6), Makefile.in (1.5), + id3lib.def (1.1), id3lib.dsp (1.17): added version.rc and + id3lib.def + +2002-07-31 Wednesday 18:41 Thijmen Klok + + * src/tag_parse.cpp (1.44): fixed padding empty files + +2002-07-31 Wednesday 16:35 Thijmen Klok + + * src/tag_parse_lyrics3.cpp (1.33): added brackets for win32 + compilation + +2002-07-31 Wednesday 16:17 Thijmen Klok + + * config.h.win32 (1.21), configure (1.76), configure.in (1.65), + macconfig.h (1.9, rel-3-7-9): getting ready for pre3.3 + +2002-07-31 Wednesday 16:16 Thijmen Klok + + * libtool (1.15): these are generated + +2002-07-31 Wednesday 16:02 Thijmen Klok + + * config.win32 (1.9): is obsolete + +2002-07-31 Wednesday 15:59 Thijmen Klok + + * AUTHORS (1.13, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10): + added a desciption for Cedrics involment + +2002-07-31 Wednesday 15:45 Thijmen Klok + + * src/: field.cpp (1.46), frame_render.cpp (1.27), misc_support.cpp + (1.37), tag.cpp (1.51), tag_file.cpp (1.40), tag_parse_lyrics3.cpp + (1.32), tag_parse_v1.cpp (1.27): cosmetic changes + +2002-07-31 Wednesday 15:20 Thijmen Klok + + * src/: header.cpp (1.11), header.h (1.3), header_tag.cpp (1.24), + header_tag.h (1.2), spec.cpp (1.2), tag_impl.cpp (1.11), tag_impl.h + (1.7), tag_parse.cpp (1.43), tag_render.cpp (1.44): better support + for extended headers + +2002-07-31 Wednesday 14:47 Thijmen Klok + + * src/: mp3_header.h (1.3), mp3_parse.cpp (1.5), tag_impl.h (1.6): + making Mp3HeaderInfo read-only + +2002-07-28 Sunday 23:53 Thijmen Klok + + * examples/demo_info.cpp (1.32), include/id3/tag.h (1.58), + src/tag.cpp (1.50): making Mp3HeaderInfo read-only + +2002-07-28 Sunday 23:13 Thijmen Klok + + * src/tag_parse_v1.cpp (1.26): real fix for garbage after comment + +2002-07-28 Sunday 22:05 Thijmen Klok + + * src/tag_parse_v1.cpp (1.25): fix for garbage after comment + +2002-07-27 Saturday 18:06 Thijmen Klok + + * include/id3/: Makefile.am (1.22), Makefile.in (1.58): included + id3lib_strings.h and id3lib_streams.h to installed headers + +2002-07-27 Saturday 17:44 Thijmen Klok + + * libprj/id3lib.dsp (1.15), prj/id3lib.dsp (1.16): fixed header + location + +2002-07-27 Saturday 16:16 Thijmen Klok + + * ChangeLog (1.133): added past week + +2002-07-27 Saturday 15:03 Thijmen Klok + + * src/mp3_parse.cpp (1.4): change of reading in uint16 number to + use existing routines + +2002-07-26 Friday 13:09 Thijmen Klok + + * configure (1.75), Makefile.in (1.59), configure.in (1.64), + doc/Makefile.in (1.18), examples/Makefile.in (1.25), + id3com/Makefile.in (1.2), id3com/Sample/Makefile.in (1.2), + include/Makefile.in (1.13), include/id3/Makefile.in (1.57), + libprj/Makefile.in (1.4), m4/Makefile.in (1.18), prj/Makefile.in + (1.4), src/Makefile.in (1.57): made -liconv to work + +2002-07-25 Thursday 15:51 Thijmen Klok + + * src/tag_impl.cpp (1.10): fixed setting _mp3_info to NULL + +2002-07-25 Thursday 14:33 Thijmen Klok + + * src/mp3_parse.cpp (1.3): changed routine so 0 bitrate mp3s could + also be crc checked + +2002-07-23 Tuesday 22:06 Thijmen Klok + + * config.h.win32 (1.20), configure (1.74, rel-3-7-8), configure.in + (1.63), macconfig.h (1.8): yet another devel release upgrade of + version nr + +2002-07-23 Tuesday 21:55 Thijmen Klok + + * prj/id3lib.dsp (1.15), libprj/id3lib.dsp (1.14): included + mp3_parse.cpp and mp3_header.h + +2002-07-23 Tuesday 18:28 Thijmen Klok + + * include/id3/sized_types.h (1.7): added a better desciption on + what to send on error + +2002-07-23 Tuesday 16:15 Thijmen Klok + + * config.h.win32 (1.19), configure (1.73), configure.in (1.62), + macconfig.h (1.7), ChangeLog (1.132): higher version because of + devel release + +2002-07-23 Tuesday 15:57 Thijmen Klok + + * NEWS (1.27, rel-3-7-10): added url for latest news + +2002-07-23 Tuesday 15:47 Thijmen Klok + + * examples/: Makefile.am (1.22), Makefile.in (1.24), + demo_simple.cpp (1.1): renamed demo_simple.c to demo_simple.cpp + +2002-07-23 Tuesday 15:22 Thijmen Klok + + * examples/: Makefile.am (1.21), Makefile.in (1.23), crc53865.mp3 + (1.1): added crc53865.mp3 for new routine GetMp3HeaderInfo + +2002-07-23 Tuesday 15:20 Thijmen Klok + + * include/id3/globals.h (1.50), examples/demo_info.cpp (1.31), + include/id3/tag.h (1.57), src/mp3_header.h (1.2), src/mp3_parse.cpp + (1.2), src/tag.cpp (1.49), src/tag_impl.h (1.5): changed name of + GetMp3Header and Mp3_Header + +2002-07-22 Monday 20:28 Thijmen Klok + + * ChangeLog (1.131): added mp3 header info additions + +2002-07-22 Monday 19:56 Thijmen Klok + + * include/id3/globals.h (1.49), include/id3/tag.h (1.56), + src/Makefile.am (1.27), src/Makefile.in (1.56), src/tag.cpp (1.48), + src/tag_impl.h (1.4), src/tag_parse.cpp (1.42), src/mp3_header.h + (1.1), src/mp3_parse.cpp (1.1): Added mp3 header info + +2002-07-17 Wednesday 18:40 Thijmen Klok + + * Makefile.am (1.28), include/Makefile.am (1.6), + include/id3/Makefile.am (1.21), libprj/Makefile.am (1.6), + m4/Makefile.am (1.9), prj/Makefile.am (1.5, rel-3-7-13, + rel-3-7-12), src/Makefile.am (1.26): added copyright + +2002-07-17 Wednesday 18:35 Thijmen Klok + + * Makefile.in (1.58), configure.in (1.61), doc/Makefile.in (1.17), + examples/Makefile.in (1.22), id3com/Makefile.in (1.1), + id3com/Sample/Makefile.in (1.1), include/Makefile.in (1.12), + include/id3/Makefile.in (1.56), libprj/Makefile.in (1.3), + m4/Makefile.in (1.17), prj/Makefile.in (1.3), src/Makefile.in + (1.55), aclocal.m4 (1.18), configure (1.72, rel-3-7-7): regenerated + +2002-07-17 Wednesday 17:42 Thijmen Klok + + * configure.in (1.60): changed AC_PROG_LIBTOOL to AM_PROG_LIBTOOL + +2002-07-17 Wednesday 17:16 Thijmen Klok + + * id3com/Sample/Makefile.am (1.1): initial file + +2002-07-17 Wednesday 17:14 Thijmen Klok + + * id3com/Makefile.am (1.9): changed to reflect dir contents + +2002-07-17 Wednesday 17:03 Thijmen Klok + + * m4/Makefile.am (1.8): added id3_unicode.m4 + +2002-07-16 Tuesday 17:32 Thijmen Klok + + * include/id3/: Makefile.am (1.20), Makefile.in (1.55): added + id3lib_bitset + +2002-07-08 Monday 20:27 Thijmen Klok + + * prj/Makefile.am (1.4), prj/Makefile.in (1.2), libprj/Makefile.am + (1.5), libprj/Makefile.in (1.2): added win32.readme + +2002-07-06 Saturday 23:31 Thijmen Klok + + * ChangeLog (1.130): added last two days + +2002-07-06 Saturday 23:28 Thijmen Klok + + * src/tag_parse_v1.cpp (1.24): fixed setting field when previous + field was existing but empty + +2002-07-06 Saturday 19:04 Thijmen Klok + + * src/tag_parse_v1.cpp (1.23): fixed setting genre when previous + genre was existing but empty + +2002-07-06 Saturday 15:52 Thijmen Klok + + * src/: frame_render.cpp (1.26), frame_parse.cpp (1.34): fixed + empty frame bugs + +2002-07-05 Friday 18:12 Thijmen Klok + + * AUTHORS (1.12): Readded Cedric, welcome back :-) + +2002-07-05 Friday 14:35 Thijmen Klok + + * ChangeLog (1.129): added last few days + +2002-07-05 Friday 14:33 Thijmen Klok + + * src/tag_parse.cpp (1.41): cleanup of internal variable file added + +2002-07-05 Friday 14:31 Thijmen Klok + + * src/: header_frame.h (1.2), frame_render.cpp (1.25): Fixed bug + unknown frames corrupting tag + +2002-07-03 Wednesday 22:36 Thijmen Klok + + * src/tag_file.cpp (1.39): Fixed deleted MP3 after update + +2002-07-03 Wednesday 00:27 Thijmen Klok + + * ChangeLog (1.128): added last two days + +2002-07-03 Wednesday 00:10 Thijmen Klok + + * include/id3/field.h (1.47), include/id3/frame.h (1.42), + include/id3/globals.h (1.48), include/id3/helpers.h (1.9), + include/id3/io_decorators.h (1.5), include/id3/reader.h (1.13), + include/id3/utils.h (1.22), include/id3/writer.h (1.8), + include/id3/writers.h (1.11), include/id3.h (1.19), + src/c_wrapper.cpp (1.19), src/field.cpp (1.45), + src/field_binary.cpp (1.26), src/field_def.h (1.2), + src/field_integer.cpp (1.21), src/field_string_ascii.cpp (1.28), + src/field_string_unicode.cpp (1.32), src/frame_def.h (1.2), + src/frame_impl.cpp (1.9), src/frame_parse.cpp (1.33), + src/frame_render.cpp (1.24), src/globals.cpp (1.6), src/header.h + (1.2), src/header_frame.cpp (1.22), src/header_tag.cpp (1.23), + src/helpers.cpp (1.11), src/io_decorators.cpp (1.4), + src/io_helpers.cpp (1.13), src/misc_support.cpp (1.36), + src/readers.cpp (1.7), src/spec.h (1.2), src/tag.cpp (1.47), + src/tag_file.cpp (1.38), src/tag_find.cpp (1.27), src/tag_impl.cpp + (1.9), src/tag_impl.h (1.3), src/tag_parse.cpp (1.40), + src/tag_parse_lyrics3.cpp (1.31), src/tag_parse_musicmatch.cpp + (1.19), src/tag_parse_v1.cpp (1.22), src/tag_render.cpp (1.43): + cleaned header includes + +2002-07-03 Wednesday 00:04 Thijmen Klok + + * src/utils.cpp (1.26): Added safeguard for failed iconv calls + +2002-07-02 Tuesday 14:22 Thijmen Klok + + * src/utils.cpp (1.25): added prevention of going to unnecesary + code when empty + +2002-07-01 Monday 16:44 Thijmen Klok + + * ChangeLog (1.127): added last two days + +2002-07-01 Monday 16:03 Thijmen Klok + + * src/utils.cpp (1.24): Fix for iconv + +2002-07-01 Monday 15:20 Thijmen Klok + + * examples/get_local_codeset.c (1.1): added for unicode debugging + +2002-07-01 Monday 14:24 Thijmen Klok + + * examples/win-xp.mp3 (1.1): added for issue 547255 + +2002-07-01 Monday 02:13 Thijmen Klok + + * aclocal.m4 (1.17), m4/id3_unicode.m4 (1.2): Fix for iconv + +2002-06-30 Sunday 19:37 Thijmen Klok + + * include/id3/globals.h (1.47): removed unnessesary defines which + gave warnings one some compilers + +2002-06-30 Sunday 18:24 Thijmen Klok + + * configure.in (1.59), config.h.in (1.23, rel-3-7-9, rel-3-7-13), + configure (1.71), config.h.win32.in (1.11), config.h.win32 (1.18), + macconfig.h (1.6): Fix for iconv + +2002-06-29 Saturday 22:49 Thijmen Klok + + * ChangeLog (1.126): added past few days + +2002-06-29 Saturday 22:45 Thijmen Klok + + * macconfig.h (1.5): Added Define for NetBSD and MacOS X + +2002-06-29 Saturday 22:24 Thijmen Klok + + * configure.in (1.58), configure (1.70): Fixed horribly wrong file + +2002-06-29 Saturday 21:48 Thijmen Klok + + * config.h.win32 (1.16), config.h.win32.in (1.10, rel-3-7-13), + config.h.win32 (1.17), config.h.in (1.22), configure.in (1.57), + configure (1.69), src/frame_impl.h (1.3): change for new define + HAVE_BITSET for NetBSD and MacOS X + +2002-06-29 Saturday 21:16 Thijmen Klok + + * include/id3/id3lib_bitset (1.1): Added for NetBSD and MacOs X + +2002-06-29 Saturday 19:35 Thijmen Klok + + * src/field_integer.cpp (1.20), src/frame.cpp (1.34), + src/frame_parse.cpp (1.32), src/frame_render.cpp (1.23), + src/globals.cpp (1.5), src/header.cpp (1.10), src/header_frame.cpp + (1.21), src/header_tag.cpp (1.22), src/io.cpp (1.2), + src/io_decorators.cpp (1.3), src/io_helpers.cpp (1.12), + src/readers.cpp (1.6), src/tag.cpp (1.46), src/tag_file.cpp (1.37), + src/tag_parse.cpp (1.39), src/tag_parse_lyrics3.cpp (1.30), + src/tag_parse_musicmatch.cpp (1.18), src/tag_parse_v1.cpp (1.21), + src/tag_render.cpp (1.42), src/utils.cpp (1.23), + src/writer_decorators.cpp (1.2), src/writers.cpp (1.2), + include/id3/field.h (1.46), include/id3/frame.h (1.41), + include/id3/globals.h (1.46), include/id3/helpers.h (1.8), + include/id3/id3lib_strings.h (1.2), include/id3/io_decorators.h + (1.4), include/id3/io_helpers.h (1.7), include/id3/io_strings.h + (1.6), include/id3/misc_support.h (1.27), include/id3/reader.h + (1.12), include/id3/readers.h (1.12), include/id3/tag.h (1.55), + include/id3/utils.h (1.21), include/id3/writer.h (1.7), + include/id3/writers.h (1.10): added trailing newline to prevent + compiler warning + +2002-06-29 Saturday 19:18 Thijmen Klok + + * examples/: demo_tag.cpp (1.15), demo_info.cpp (1.30), + demo_copy.cpp (1.11), findeng.cpp (1.6), findstr.cpp (1.6), + get_pic.cpp (1.8), test_compression.cpp (1.9), test_io.cpp (1.5), + test_pic.cpp (1.10), test_remove.cpp (1.12), test_unicode.cpp + (1.8): added trailing linefeed + +2002-06-29 Saturday 19:11 Thijmen Klok + + * src/utils.cpp (1.22): quickfixed compiling on Solaris regarding + iconv, still looking into a more elegant solution + +2002-06-29 Saturday 16:43 Thijmen Klok + + * src/field_string_unicode.cpp (1.31): fixes compile on some + solarises + fix for unicode typo + +2002-06-29 Saturday 16:41 Thijmen Klok + + * include/dami/lyr3.h (1.3), include/dami/lyr3_impl.h (1.3), + include/id3.h (1.18), include/id3/field.h (1.45), + include/id3/frame.h (1.40), include/id3/helpers.h (1.7), + include/id3/tag.h (1.54), src/c_wrapper.cpp (1.18, rel-3-7-9), + src/field.cpp (1.44), src/field_impl.h (1.4), + src/field_string_ascii.cpp (1.27), src/frame.cpp (1.33), + src/helpers.cpp (1.10), src/io_helpers.cpp (1.11), src/tag.cpp + (1.45), src/utils.cpp (1.21), include/id3/globals.h (1.45): fixes + compile on some solarises + +2002-06-28 Friday 14:36 Thijmen Klok + + * src/tag.cpp (1.44): corrected type in comment + +2002-06-28 Friday 13:59 Thijmen Klok + + * zlib/: include/deflate.h (1.4), include/infblock.h (1.4), + include/infcodes.h (1.4), include/inffast.h (1.4), + include/inftrees.h (1.4), include/infutil.h (1.4), include/zconf.h + (1.5, rel-3-7-13, rel-3-7-12), include/zlib.h (1.5), + include/zutil.h (1.5), src/adler32.c (1.4, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9), src/compress.c (1.4), src/crc32.c (1.4), + src/deflate.c (1.4), src/gzio.c (1.5), src/infblock.c (1.4), + src/infcodes.c (1.4), src/inffast.c (1.4), src/inflate.c (1.4), + src/inftrees.c (1.4), src/infutil.c (1.4), src/trees.c (1.4), + src/uncompr.c (1.4), src/zutil.c (1.5): removed carriage return + +2002-06-28 Friday 10:32 Thijmen Klok + + * libtool (1.14): hardly any changes + +2002-06-28 Friday 10:29 Thijmen Klok + + * ChangeLog (1.125): Added the changes since i started working on + this + +2002-06-28 Friday 10:26 Thijmen Klok + + * configure.in (1.56), configure (1.68): added url for missing + headers + +2002-06-27 Thursday 15:02 Thijmen Klok + + * examples/demo_copy.cpp (1.10): corrected a typo + +2002-06-27 Thursday 14:51 Thijmen Klok + + * include/id3/strings.h (1.5): replaced by id3lib_strings.h for + compile on NetBSD + +2002-06-27 Thursday 14:41 Thijmen Klok + + * configure (1.67), src/io_helpers.cpp (1.10), libtool (1.13), + src/misc_support.cpp (1.35), src/utils.cpp (1.20), src/tag_file.cpp + (1.36), examples/demo_info.cpp (1.29), configure.in (1.55), + examples/demo_convert.cpp (1.15), include/id3/writers.h (1.9), + include/id3/readers.h (1.11), examples/test_unicode.cpp (1.7), + examples/findeng.cpp (1.5), examples/demo_tag.cpp (1.14), + examples/demo_main.cpp (1.3), examples/test_compression.cpp (1.8), + examples/get_pic.cpp (1.7), examples/findstr.cpp (1.5), + examples/test_pic.cpp (1.9), examples/test_remove.cpp (1.11), + src/tag.cpp (1.43), include/id3/utils.h (1.20), + include/id3/io_strings.h (1.5), include/id3/io_decorators.h (1.3), + include/id3/helpers.h (1.6), src/field_impl.h (1.3), src/tag_impl.h + (1.2), include/dami/v1.h (1.2), include/dami/mm.h (1.2), + include/dami/lyr3_impl.h (1.2), include/dami/lyr3.h (1.2), + include/id3/io_helpers.h (1.6), prj/id3lib.dsp (1.14), + libprj/id3lib.dsp (1.13), include/id3/Makefile.in (1.54), + include/id3/Makefile.am (1.19), examples/demo_copy.cpp (1.9): Fix + for compile with gcc 3.x, and compile on NetBSD and alpha + +2002-06-27 Thursday 14:00 Thijmen Klok + + * include/id3/id3lib_strings.h (1.1): Added as fix for compile + errors on NetBSD + +2002-06-27 Thursday 13:59 Thijmen Klok + + * include/id3/id3lib_streams.h (1.1): Added as fix for gcc 3.x + compile errors + +2002-06-27 Thursday 13:50 Thijmen Klok + + * THANKS (1.17): added thanx for email alias + +2002-06-27 Thursday 13:48 Thijmen Klok + + * AUTHORS (1.11, rel-3-7-9, rel-3-7-8, rel-3-7-7): Changing email, + added an 'old' entry + +2002-06-27 Thursday 12:09 Thijmen Klok + + * config.h.in (1.21): fixes a bug in autoconf, checking for + booleans in gcc while g++ is used for compiling + +2002-06-27 Thursday 12:05 Thijmen Klok + + * prj/win32.readme.first.txt (1.1), libprj/win32.readme.first.txt + (1.1): Added as clarification on directories + +2002-06-27 Thursday 11:55 Thijmen Klok + + * id3com/: Sample/frmID3Test.frm (1.8), Sample/ID3Test.vbp (1.8), + Sample/ID3Test.vbw (1.9), dlldata.c (1.6), EnumFields.cpp (1.7), + EnumFields.h (1.7), id3com.cpp (1.9), ID3COM.def (1.6), id3com.dsp + (1.17), id3com.dsw (1.7), id3com.idl (1.12), ID3COMps.def (1.6), + ID3COMps.mk (1.6), ID3COM.rc (1.7), ID3Field.cpp (1.8), ID3Field.h + (1.10), ID3Field.rgs (1.7), ID3Frame.cpp (1.11), ID3Frame.h (1.10), + ID3Frame.rgs (1.7), ID3Tag.cpp (1.13), ID3Tag.h (1.10), ID3Tag.rgs + (1.7), Makefile.am (1.8), resource.h (1.7), StdAfx.cpp (1.8), + StdAfx.h (1.8), win32.readme.first.txt (1.1): Re-Added as service + +2002-06-21 Friday 00:18 Thijmen Klok + + * configure (1.66), zlib/configure (1.3): updated from autoconf + 1.53a + +2002-06-20 Thursday 04:02 Thijmen Klok + + * zlib/: include/deflate.h (1.3), include/infblock.h (1.3), + include/infcodes.h (1.3), include/inffast.h (1.3), + include/inftrees.h (1.3), include/infutil.h (1.3), include/zconf.h + (1.4), include/zlib.h (1.4), include/zutil.h (1.4), src/adler32.c + (1.3), src/compress.c (1.3), src/crc32.c (1.3), src/deflate.c + (1.3), src/gzio.c (1.4), src/infblock.c (1.3), src/infcodes.c + (1.3), src/inffast.c (1.3), src/inflate.c (1.3), src/inftrees.c + (1.3), src/infutil.c (1.3), src/trees.c (1.3), src/uncompr.c (1.3), + src/zutil.c (1.4): updated to zlib version 1.1.4 + +2002-06-19 Wednesday 20:21 Thijmen Klok + + * THANKS (1.16): Added Simon Ferrett for the id3lib.org domain + "link" + +2002-06-19 Wednesday 19:59 Thijmen Klok + + * config.sub (1.2), config.guess (1.2): update from + ftp://ftp.gnu.org/pub/gnu/config/ timestamp 2002-05-28 + +2002-06-19 Wednesday 17:45 Thijmen Klok + + * AUTHORS (1.10): added t1mpy as author + +2002-03-20 Wednesday 11:32 slackorama + + * include/id3/misc_support.h (1.26, rel-3-7-10): This is the other + half of the commit for adding text based genres. + +2002-03-20 Wednesday 11:32 slackorama + + * src/misc_support.cpp (1.34): Added a method for adding text based + genres. + +2002-03-03 Sunday 21:04 slackorama + + * src/tag_file.cpp (1.35): This should fix a long standing bug on + UNIX systems. When a temp file is created in tag_file.cpp it always + used 0600 permissions. Now, when that file is moved over the file + being edited, the permissions will be restored to the original. + +2002-02-19 Tuesday 02:54 slackorama + + * src/io_helpers.cpp (1.9): changed line 306 in + io::writeTrailingSpaces() (io_helpers.cpp) from writer.writeChar(' + '); to writer.writeChar('\0'); + This pads id3v1 tags will null characters instead of spaces. + +2002-01-22 Tuesday 22:06 slackorama + + * src/: tag_parse_v1.cpp (1.20), tag_render.cpp (1.41): I added + Florian Heidenreich's fixes for the computation of padding size in + tag_render.cpp ID3_TagImpl::PaddingSize() and made change to + tag_parse_v1.cpp so that it doesn't return an undefined value for + the track number when parsing a file with just an id3v1.0 tag (and + no v2 or v1.1). || was changed to && on line 115. + +2001-12-18 Tuesday 10:12 shadrack + + * depcomp (1.1), src/.cvsignore (1.15), zlib/.cvsignore (1.7): Add + depcomp file needed for configure script + +2001-12-18 Tuesday 09:57 shadrack + + * libtool (1.12), src/tag_render.cpp (1.40), zlib/config.h (1.2), + zlib/libtool (1.3): Applied Florian Heidenreich's padding fix + +2001-12-17 Monday 18:40 shadrack + + * zlib/prj/: zlib.dsp (1.6), zlib.dsw (1.3), zlib.mak (1.3): + Switched EOL conventions to DOS in zlib VC++ project files + +2001-12-17 Monday 18:34 shadrack + + * reconf (1.4): More build tool updates + +2001-12-17 Monday 18:24 shadrack + + * libprj/Makefile.in (1.1), prj/Makefile.in (1.1): Makefile + templates for Visual C++ build directories + +2001-12-17 Monday 18:20 shadrack + + * Makefile.am (1.27), Makefile.in (1.57), aclocal.m4 (1.16), + config.h.in (1.20), configure (1.65), configure.in (1.54), + id3lib.spec.in (1.26), ltmain.sh (1.2), missing (1.2), + doc/Makefile.in (1.16), examples/Makefile.in (1.21), + include/Makefile.in (1.11), include/id3/Makefile.in (1.53), + libprj/Makefile.am (1.4), m4/Makefile.in (1.16), src/Makefile.in + (1.54), zlib/Makefile.in (1.3), zlib/aclocal.m4 (1.2), + zlib/config.h.in (1.2), zlib/configure (1.2), zlib/configure.in + (1.2), zlib/include/Makefile.in (1.3, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7), + zlib/lib/Makefile.in (1.3, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7), zlib/prj/Makefile.in + (1.3, rel-3-7-9, rel-3-7-8, rel-3-7-7), zlib/src/Makefile.in (1.6): + Updated build files for current versions of automake and the like. + +2001-12-16 Sunday 12:44 shadrack + + * config.h.in (1.19), config.h.win32 (1.15), config.win32 (1.8), + configure (1.64), configure.in (1.53), macconfig.h (1.4, rel-3-7-8, + rel-3-7-7), src/tag_parse_v1.cpp (1.19): V1 parsing fix + +2001-12-16 Sunday 12:11 shadrack + + * config.h.win32 (1.14), config.win32 (1.7), configure (1.63), + macconfig.h (1.3), makefile.win32 (1.2), makewin32.bat (1.2): + Cosmetic fixups to reflect 2001-12-16 snapshot + +2001-12-16 Sunday 11:32 shadrack + + * makefile.win32 (1.1), makewin32.bat (1.1): Added Win32 + command-line build files + +2001-12-16 Sunday 10:56 shadrack + + * src/tag_render.cpp (1.39): Applied fixes for bug 469112 + +2001-12-16 Sunday 10:40 shadrack + + * src/tag_file.cpp (1.34): Fixed overwrite bug in tag_file.cpp + +2001-12-16 Sunday 10:25 shadrack + + * src/tag.cpp (1.42): Applied fix from bug #232172 (overflow crash + under Win32) + +2001-12-16 Sunday 10:10 shadrack + + * src/tag_file.cpp (1.33): Daniel Hazelbaker's patch to fix ID3V1 + appending when only ID3V2 tag was read + +2001-12-16 Sunday 09:46 shadrack + + * libprj/id3lib.dsp (1.12), libprj/id3lib.dsw (1.7), prj/id3lib.dsp + (1.13), prj/id3lib.dsw (1.6): Fixed Visual C++ Workspace files + +2001-11-05 Monday 10:55 shadrack + + * include/id3/helpers.h (1.5), src/helpers.cpp (1.9), + src/misc_support.cpp (1.33), src/tag_parse_v1.cpp (1.18): Applied + Scott Wheeler's version priority bug fix + +2001-09-09 Sunday 01:53 shadrack + + * AUTHORS (1.9), ChangeLog (1.124), Makefile.in (1.56), NEWS + (1.26), config.h.win32 (1.13), config.win32 (1.6), configure + (1.62), configure.in (1.52, rel-3-7-4), id3lib.spec.in (1.25), + macconfig.h (1.2), src/field.cpp (1.43): Bumped version up to + 3.8.0pre2 for release + +2001-09-08 Saturday 23:33 shadrack + + * src/field.cpp (1.42): Implemented Matt Mueller's FrameInfo fixes + +2001-09-08 Saturday 23:19 shadrack + + * include/id3/io_strings.h (1.4), src/io_helpers.cpp (1.8): Back + out Mac port typecasts for compatibility reasons + +2001-09-08 Saturday 04:33 shadrack + + * include/id3.h (1.17), src/c_wrapper.cpp (1.17), src/tag.cpp + (1.41): Added ID3Tag_LinkWithFlags() function export + +2001-08-27 Monday 01:33 dmazzoni + + * src/field_binary.cpp (1.25), libprj/id3lib.mcp (1.1), + src/io_helpers.cpp (1.7), include/id3/io_strings.h (1.3), + macconfig.h (1.1), src/readers.cpp (1.5), include/id3/readers.h + (1.10), src/tag_file.cpp (1.32), src/tag_parse_musicmatch.cpp + (1.17), src/utils.cpp (1.19), include/id3/writers.h (1.8), + zlib/prj/zlib.mcp (1.1): Ported to MacOS and added Mac project + files (id3lib.mcp and zlib.mcp). + +2001-08-07 Tuesday 13:58 shadrack + + * Makefile.in (1.55, rel-3-7-5), doc/Makefile.in (1.15), + examples/Makefile.in (1.20), include/Makefile.in (1.10), + include/id3.h (1.16), include/id3/Makefile.in (1.52), + include/id3/field.h (1.44), include/id3/globals.h (1.44), + m4/Makefile.in (1.15), src/Makefile.in (1.53), src/field.cpp + (1.41), src/field_impl.h (1.2), src/tag.cpp (1.40): Added FrameInfo + class + +2001-08-05 Sunday 23:21 abscess + + * src/tag_parse_lyrics3.cpp (1.29): album parsing typo fix + (courtesy of J.P. Bergamin) + +2001-08-05 Sunday 23:18 abscess + + * src/frame_parse.cpp (1.31): zero-length frame fix (courtesy of + J.P. Bergamin) + +2001-08-05 Sunday 23:16 abscess + + * examples/demo_simple.c (1.4): displays artist and album + +2001-08-04 Saturday 02:05 thefrogprince + + * src/tag.cpp (1.39): Minor documentation fixes + +2001-07-30 Monday 20:22 abscess + + * include/id3/field.h (1.43), include/id3/frame.h (1.39), + include/id3/globals.h (1.43), include/id3/helpers.h (1.4), + include/id3/io_decorators.h (1.2), include/id3/io_helpers.h (1.5), + include/id3/io_strings.h (1.2), include/id3/misc_support.h (1.25), + include/id3/reader.h (1.11), include/id3/readers.h (1.9), + include/id3/tag.h (1.53), include/id3/utils.h (1.19), + include/id3/writer.h (1.6), include/id3/writers.h (1.7), + src/misc_support.cpp (1.32): applied changes made to repository + while stored temporarily on millweed.com + +2001-07-25 Wednesday 05:50 thefrogprince + + * src/tag.cpp (1.38): Fix ID3_Tag::HasTagType() bug + +2001-07-24 Tuesday 10:12 thefrogprince + + * libtool (1.11), examples/demo_convert.cpp (1.14), + examples/demo_copy.cpp (1.8), examples/demo_copy_options.c (1.5), + examples/demo_copy_options.h (1.2), examples/demo_info_options.c + (1.5), examples/demo_info_options.h (1.2), src/utils.cpp (1.18), + zlib/libtool (1.2): Fix compiler errors + +2000-11-20 Monday 10:17 eldamitri + + * src/utils.cpp (1.17): Minor namespace bugfix + +2000-11-20 Monday 10:06 eldamitri + + * NEWS (1.25), id3lib.spec.in (1.24): Updated for new release + +2000-11-20 Monday 09:30 eldamitri + + * id3com/: .cvsignore (1.6), BSTRCollection.h (1.2, rel-3-7-9, + rel-3-7-8, rel-3-7-7), EnumFields.cpp (1.6), EnumFields.h (1.6), + ID3COM.def (1.5), ID3COM.rc (1.6), ID3COMps.def (1.5), ID3COMps.mk + (1.5), ID3Field.cpp (1.7), ID3Field.h (1.9), ID3Field.rgs (1.6), + ID3Frame.cpp (1.10), ID3Frame.h (1.9), ID3Frame.rgs (1.6), + ID3Tag.cpp (1.12), ID3Tag.h (1.9), ID3Tag.rgs (1.6), Makefile.am + (1.7), MimeTypes.cpp (1.2), MimeTypes.h (1.2), StdAfx.cpp (1.7), + StdAfx.h (1.7), TextCollection.cpp (1.2), TextCollection.h (1.2), + TextCollection.rgs (1.2), dlldata.c (1.5), frmID3Test.frm (1.5), + id3com.cpp (1.8), id3com.dsp (1.16), id3com.dsw (1.6), id3com.idl + (1.11), mssccprj.scc (1.5), resource.h (1.6), vssver.scc (1.2), + Sample/.cvsignore (1.2), Sample/ID3Test.vbp (1.7), + Sample/ID3Test.vbw (1.8), Sample/MSSCCPRJ.SCC (1.5), + Sample/frmID3Test.frm (1.7): Now has its own project at sourceforge + +2000-11-20 Monday 09:19 eldamitri + + * doc/Doxyfile.in (1.7): Updated list of input files + +2000-11-20 Monday 09:18 eldamitri + + * src/tag.cpp (1.37): Updated tutorial docs + +2000-11-07 Tuesday 10:44 eldamitri + + * examples/: demo_convert_options.ggo (1.2), demo_copy_options.ggo + (1.2), demo_info_options.ggo (1.2), demo_tag_options.ggo (1.2): + Rely on automake's VERSION macro for assigning apps' version + +2000-11-07 Tuesday 10:40 eldamitri + + * examples/: Makefile.am (1.20), Makefile.in (1.19): Removed rule + for generating ggo file + +2000-11-07 Tuesday 10:39 eldamitri + + * examples/: demo_convert_options.ggo (1.1), demo_copy_options.ggo + (1.1), demo_info_options.ggo (1.1), demo_tag_options.ggo (1.1): + Initial release + +2000-11-07 Tuesday 10:27 eldamitri + + * configure (1.61), configure.in (1.51): Removed AC_PROG_RANLIB + + (deprecated) + +2000-11-07 Tuesday 10:19 eldamitri + + * src/utils.cpp (1.16): Removed "using namespace std" + +2000-11-07 Tuesday 10:18 eldamitri + + * src/frame_impl.h (1.2): Made iterator and const_iterator typedefs + public + +2000-11-07 Tuesday 10:17 eldamitri + + * src/Makefile.am (1.25): Add tag_impl.h to list of distributed + header files + +2000-11-07 Tuesday 10:17 eldamitri + + * config.h.win32 (1.11), config.h.win32.in (1.9): Brought up to + speed with current config.h + +2000-11-04 Saturday 03:56 eldamitri + + * examples/: demo_convert_options.ggo.in (1.2), + demo_copy_options.ggo.in (1.2), demo_info_options.ggo.in (1.2), + demo_tag_options.ggo.in (1.2): not needed + +2000-10-29 Sunday 09:15 eldamitri + + * configure.in (1.50), include/id3/globals.h (1.42), + include/id3/io_helpers.h (1.4), include/id3/utils.h (1.18), + src/field.cpp (1.40), src/io_helpers.cpp (1.6), src/utils.cpp + (1.15): Improved unicode support for systems that support iconv + +2000-10-29 Sunday 09:14 eldamitri + + * examples/test_io.cpp (1.4): Added tests for unicode transcoding + +2000-10-29 Sunday 09:14 eldamitri + + * m4/id3_unicode.m4 (1.1): Initial release + +2000-10-29 Sunday 02:39 eldamitri + + * m4/id3_debug.m4 (1.1): Initial release + +2000-10-29 Sunday 02:37 eldamitri + + * configure.in (1.49), examples/demo_convert.cpp (1.13), + examples/demo_convert_options.c (1.3), examples/demo_copy.cpp + (1.7), examples/demo_copy_options.c (1.3), examples/demo_info.cpp + (1.28), examples/demo_info_options.c (1.3), examples/demo_tag.cpp + (1.13), examples/demo_tag_options.c (1.3), examples/findeng.cpp + (1.4), examples/findstr.cpp (1.4), examples/get_pic.cpp (1.6), + examples/test_compression.cpp (1.7), examples/test_io.cpp (1.3), + examples/test_pic.cpp (1.8), examples/test_remove.cpp (1.10), + examples/test_unicode.cpp (1.6), include/id3/Makefile.am (1.18), + m4/Makefile.am (1.7), src/Makefile.am (1.24), src/field.cpp (1.39), + src/field_binary.cpp (1.24), src/field_integer.cpp (1.19), + src/field_string_ascii.cpp (1.26), src/field_string_unicode.cpp + (1.30), src/frame_parse.cpp (1.30), src/frame_render.cpp (1.22), + src/header_frame.cpp (1.20), src/header_tag.cpp (1.21), + src/helpers.cpp (1.8), src/io_decorators.cpp (1.2), + src/io_helpers.cpp (1.5), src/misc_support.cpp (1.31), + src/readers.cpp (1.4), src/tag.cpp (1.36), src/tag_file.cpp (1.31), + src/tag_find.cpp (1.26), src/tag_impl.cpp (1.8), src/tag_parse.cpp + (1.38), src/tag_parse_lyrics3.cpp (1.28), + src/tag_parse_musicmatch.cpp (1.16), src/tag_parse_v1.cpp (1.17), + src/tag_render.cpp (1.38), src/utils.cpp (1.14): + - Moved debug.h functionality to configure script + - Removed file debug.h and all its inclusion's + +2000-10-29 Sunday 02:18 eldamitri + + * src/debug.h (1.2): Moved functionality in configure.in + +2000-10-24 Tuesday 18:12 eldamitri + + * include/id3/field_def.h (1.5), src/field_def.h (1.1), + include/id3/field_impl.h (1.11), src/field_impl.h (1.1), + include/id3/frame_def.h (1.5), src/frame_def.h (1.1), + include/id3/frame_impl.h (1.5), src/frame_impl.h (1.1), + include/id3/header.h (1.22), src/header.h (1.1), + include/id3/header_frame.h (1.21), src/header_frame.h (1.1), + include/id3/header_tag.h (1.18), src/header_tag.h (1.1), + include/id3/spec.h (1.6), src/spec.h (1.1), include/id3/tag_impl.h + (1.9), src/tag_impl.h (1.1), include/id3/debug.h (1.6), src/debug.h + (1.1), include/id3/flags.h (1.5), src/flags.h (1.1): Moved from + include/id3/ to src/ + +2000-10-24 Tuesday 09:00 eldamitri + + * include/id3.h (1.15), include/id3/frame.h (1.38), + include/id3/frame_impl.h (1.4), include/id3/tag.h (1.52), + include/id3/tag_impl.h (1.8), src/c_wrapper.cpp (1.16), + src/frame.cpp (1.32), src/frame_impl.cpp (1.8), src/frame_parse.cpp + (1.29), src/frame_render.cpp (1.21), src/tag.cpp (1.35), + src/tag_find.cpp (1.25), src/tag_impl.cpp (1.7): Added + ID3_Frame::Iterator and ID3_Frame::ConstIterator to traverse an + ID3_Frame's fields. Dynamically created with + ID3_Frame::CreateIterator(), the iterator is to be used instead of + ID3_Frame::NumFields() and ID3_Tag::GetFieldNum() for efficiency. + +2000-10-24 Tuesday 07:55 eldamitri + + * examples/demo_info.cpp (1.27), examples/demo_simple.c (1.3), + include/id3.h (1.14), include/id3/tag.h (1.51), + include/id3/tag_impl.h (1.7), src/c_wrapper.cpp (1.15), + src/helpers.cpp (1.7), src/misc_support.cpp (1.30), src/tag.cpp + (1.34), src/tag_render.cpp (1.37): Added ID3_Tag::Iterator and + ID3_Tag::ConstIterator to traverse an ID3_Tag's frames. Dynamically + created with ID3_Tag::CreateIterator(), the iterator is to be used + instead of ID3_Tag::NumFrames() and ID3_Tag::GetFrameNum() for + efficiency. + +2000-10-23 Monday 10:20 eldamitri + + * include/: id3.h (1.13), id3/field.h (1.42), id3/frame.h (1.37), + id3/globals.h (1.41), id3/misc_support.h (1.24), id3/reader.h + (1.10), id3/readers.h (1.8), id3/tag.h (1.50), id3/writer.h (1.5), + id3/writers.h (1.6): Included id3lib files are now in brackets + +2000-10-23 Monday 09:48 eldamitri + + * src/frame_render.cpp (1.20): Moved renderFields into unnamed + namespace + +2000-10-23 Monday 09:45 eldamitri + + * src/frame_parse.cpp (1.28): Moved parseFields into unnamed + namespace + +2000-10-23 Monday 09:42 eldamitri + + * doc/Doxyfile.in (1.6, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7), include/id3/frame.h + (1.36), include/id3/globals.h (1.40), include/id3/tag.h (1.49), + src/field.cpp (1.38), src/frame.cpp (1.31), src/frame_impl.cpp + (1.7), src/frame_parse.cpp (1.27), src/frame_render.cpp (1.19), + src/tag.cpp (1.33): Updated documentation + +2000-10-23 Monday 09:41 eldamitri + + * include/dami/: dom.idl (1.1), io_base.h (1.1): Initial release + +2000-10-23 Monday 08:15 eldamitri + + * include/: dami/lyr3.h (1.1), id3/lyr3.h (1.3), dami/lyr3_impl.h + (1.1), id3/lyr3_impl.h (1.3), dami/v1.h (1.1), id3/v1.h (1.3), + dami/v1_impl.h (1.1), id3/v1_impl.h (1.3): Moved from include/id3 + to include/dami + +2000-10-23 Monday 08:09 eldamitri + + * include/: dami/mm_impl.h (1.1), id3/mm_impl.h (1.3): Moved + mm_impl.h from include/id3 to include/dami + +2000-10-23 Monday 08:09 eldamitri + + * include/: dami/mm.h (1.1), id3/mm.h (1.3): Moved mm.h from + include/id3 to include/dami + +2000-10-23 Monday 08:04 eldamitri + + * include/: dami/dami.idl (1.1), id3/dami.idl (1.2): Moved dami.idl + from include/id3 to include/dami + +2000-10-23 Monday 06:34 eldamitri + + * doc/Doxyfile.in (1.5): Updated to Doxygen configuration 1.2.2 + +2000-10-23 Monday 06:32 eldamitri + + * include/id3/: debug.h (1.5), field_def.h (1.4), flags.h (1.4), + frame.h (1.35), frame_def.h (1.4), globals.h (1.39), header_frame.h + (1.20), helpers.h (1.3), lyr3.h (1.2), lyr3_impl.h (1.2), + misc_support.h (1.23), mm.h (1.2), mm_impl.h (1.2), reader.h (1.9), + readers.h (1.7), sized_types.h (1.6), spec.h (1.5), strings.h + (1.4), utils.h (1.17), v1.h (1.2), v1_impl.h (1.2), writer.h (1.4), + writers.h (1.5): Added comment to indicate the file is a C++ header + +2000-10-22 Sunday 00:37 eldamitri + + * examples/test_remove.cpp (1.9): + (RemoveFrame): Use GetRawText rather than GetText + +2000-10-22 Sunday 00:36 eldamitri + + * examples/demo_info.cpp (1.26): + (PrintInformation): Use GetRawBinary rather than GetBinary + +2000-10-22 Sunday 00:33 eldamitri + + * src/utils.cpp (1.13): + - Removed all of the ucs* functions except ucslen + - Added mbstoucs(String) and ucstombs(String) + - All of the file util functions now take in a String for file name + +2000-10-22 Sunday 00:30 eldamitri + + * src/tag_parse.cpp (1.37): + (parseFrames): Use GetRawBinary rather than GetBinary + +2000-10-22 Sunday 00:28 eldamitri + + * src/tag_impl.cpp (1.6): Constructor initializer and destructor + for member _file_name updated to reflect use of String object for + type + +2000-10-22 Sunday 00:26 eldamitri + + * src/tag_find.cpp (1.24): + (Find): Use GetRawText rather than GetText + (GetFrameNum): Count upwards when searching for numbered frame, + rather than in reverse + +2000-10-22 Sunday 00:24 eldamitri + + * src/tag_file.cpp (1.30): + - Added 'using namespace dami' so 'dami' doesn't have to be used + explicitely + (Link): Uses String's assignment operator rathern than function + strcpy + (RenderV2ToFile): Use String objects rather than char*'s + +2000-10-22 Sunday 00:20 eldamitri + + * src/tag.cpp (1.32): + (GetFileName): Added call to c_str() on return value of TagImpl's + method GetFileName + +2000-10-22 Sunday 00:18 eldamitri + + * src/misc_support.cpp (1.29): + (ID3_GetSyncLyrics): Use GetRawBinary rather than GetBinary + +2000-10-22 Sunday 00:17 eldamitri + + * src/io_helpers.cpp (1.4): + - Move handling of unicode BOM's from field_string_unicode.cpp for + methods readUnicodeString, readUnicodeText + - Added methods writeString, writeText, writeUnicodeString, + writeUnicodeText + +2000-10-22 Sunday 00:10 eldamitri + + * src/helpers.cpp (1.6): + (getString): Use GetRawText rather than GetText + (getStringAtIndex): Use GetRawTextItem rather than GetTextItem + +2000-10-21 Saturday 17:46 eldamitri + + * src/frame_parse.cpp (1.26): + (parseFields): Added debug warning + +2000-10-21 Saturday 17:44 eldamitri + + * src/frame_impl.cpp (1.6): + - Updated constructor initialization for new members + - Removed methods _InitFieldBits + - Simplified destructor, method _ClearFields, _InitFields + - Use iterators to traverse field list + +2000-10-21 Saturday 17:41 eldamitri + + * src/: field_string_ascii.cpp (1.25), field_string_unicode.cpp + (1.29): Completely new implementations of all methods using new + String member variable _text. Both ASCII and unicode encodings + represented with the member, so many methods that were separate for + the two encodings are now handled with single methods + +2000-10-21 Saturday 17:35 eldamitri + + * src/field_integer.cpp (1.18): Added methods SetInteger, + GetInteger + +2000-10-21 Saturday 17:33 eldamitri + + * src/field_binary.cpp (1.23): + - Added implementation of SetBinary, GetBinary, GetRawBinary + - New implementation of Set, Get, Parse, Render using SetBinary, + GetBinary + +2000-10-21 Saturday 09:22 eldamitri + + * src/field.cpp (1.37): + - Updated constructor initialization for new members + - Using String and BString for text and binary members allows + simplified initialization, destruction + - methods Clear, BinSize, Parse, Render, SetEncoding updated for new + members, methods + +2000-10-21 Saturday 09:09 eldamitri + + * include/id3/utils.h (1.16): + - Added checks to make sure min and max weren't defined as macros + - Removed all of the ucs functions except ucslen + - Added mbstoucs(String) and ucstombs(String) + - All of the file util functions now take in a String for file name + +2000-10-21 Saturday 09:07 eldamitri + + * include/id3/tag_impl.h (1.6): (class ID3_TagImpl): file name is + now a String + +2000-10-21 Saturday 09:06 eldamitri + + * include/id3/io_helpers.h (1.3): Added new write helper functions + +2000-10-21 Saturday 09:05 eldamitri + + * include/id3/globals.h (1.38): Removed bitset code + +2000-10-21 Saturday 08:19 eldamitri + + * include/id3/frame_impl.h (1.3): (class ID3_FrameImpl): Use + std::vector and std::bitset + +2000-10-21 Saturday 08:14 eldamitri + + * include/id3/field_impl.h (1.10): (class ID3_FieldImpl): + - Changed function names GetText() GetRawText() + GetTextItem() GetRawTextItem() GetUnicodeText() + GetRawUnicodeText() GetUnicodeTextItem() GetRawUnicodeTextItem() + GetBinary() GetRawBinary() + - Added new methods that accept or return dami::String's GetText() + SetText() GetTextItem() AddText() GetBinary() + SetBinary() + +2000-10-21 Saturday 05:51 eldamitri + + * include/id3/field_def.h (1.3): (struct ID3_FieldDef): Changed + name of _fixed_length to _fixed_size + +2000-10-21 Saturday 05:50 eldamitri + + * include/id3/field.h (1.41): (class ID3_Field): Changed function + names GetText() GetRawText() GetTextItem() + GetRawTextItem() GetUnicodeText() GetRawUnicodeText() + GetUnicodeTextItem() GetRawUnicodeTextItem() GetBinary() + GetRawBinary() + +2000-10-16 Monday 10:59 eldamitri + + * src/tag_render.cpp (1.36): + (Size): Now use iterators to access the frames in the tag rather + than a pointer to an ID3_Elem + +2000-10-16 Monday 10:55 eldamitri + + * src/tag_find.cpp (1.23): Updated Find method to use iterators + rather than ID3_Elem's, String's rather than const char*'s + +2000-10-16 Monday 10:50 eldamitri + + * src/: field_string_ascii.cpp (1.24), field_string_unicode.cpp + (1.28), header_tag.cpp (1.20), helpers.cpp (1.5), misc_support.cpp + (1.28), tag.cpp (1.31): Minor bugfixes + +2000-10-16 Monday 10:46 eldamitri + + * include/id3/utils.h (1.15), src/utils.cpp (1.12): Added method + toWString(const unicode_t[], size_t) + +2000-10-16 Monday 10:45 eldamitri + + * include/id3/tag_impl.h (1.5), src/tag_impl.cpp (1.5): Now use a + std::list, instead of ID3_Elem, to store the frames Find methods now + accept dame::String and dami::WString rather than const char* and + const unicode_t* + +2000-10-16 Monday 10:43 eldamitri + + * include/id3/header.h (1.21): Minor bugfix + +2000-10-16 Monday 10:42 eldamitri + + * examples/: findeng.cpp (1.3), findstr.cpp (1.3): Enabled + debugging output, minor bugfixes + +2000-10-16 Monday 09:01 eldamitri + + * include/id3/spec.h (1.4): Removed interface ID3_Speccable + +2000-10-16 Monday 09:00 eldamitri + + * src/: tag.cpp (1.30), tag_find.cpp (1.22): Updated + comments/documentation + +2000-10-16 Monday 08:59 eldamitri + + * include/id3/tag_impl.h (1.4): class ID3_TagImpl no longer + inherits from ID3_Speccable + +2000-10-16 Monday 08:59 eldamitri + + * include/id3/tag.h (1.48): class ID3_Tag no longer inherits from + ID3_Speccable + +2000-10-16 Monday 08:58 eldamitri + + * include/id3/header.h (1.20): class ID3_Header no longer inherits + from ID3_Speccable + +2000-10-16 Monday 08:58 eldamitri + + * include/id3/frame.h (1.34): class ID3_Frame no longer inherits + from ID3_Speccable + +2000-10-16 Monday 08:55 eldamitri + + * include/id3/Makefile.am (1.17): + (the_headers): Moved spec.h to noinst + +2000-10-15 Sunday 18:37 eldamitri + + * AUTHORS (1.8), NEWS (1.24), id3lib.spec.in (1.23), reconf (1.3), + doc/index.html.in (1.10, rel-3-7-13), examples/demo_info.cpp + (1.25), include/id3/globals.h (1.37), zlib/reconf (1.2): Changed + name from "Scott Haug" to "Scott Thomas Haug" + +2000-10-15 Sunday 18:09 eldamitri + + * src/tag_parse.cpp (1.36): + (parse): Added buffering for use with unsynced reader + +2000-10-15 Sunday 18:08 eldamitri + + * config.h.win32.in (1.7, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-13): Removed + ID3LIB_DATE + +2000-10-15 Sunday 18:04 eldamitri + + * Makefile.am (1.26), doc/Makefile.am (1.14), examples/Makefile.am + (1.19), id3com/Makefile.am (1.6), include/Makefile.am (1.5), + include/id3/Makefile.am (1.16), libprj/Makefile.am (1.3), + m4/Makefile.am (1.6), prj/Makefile.am (1.3, rel-3-7-9, rel-3-7-8, + rel-3-7-7), src/Makefile.am (1.23), zlib/Makefile.am (1.3, + rel-3-7-9, rel-3-7-8, rel-3-7-7), zlib/include/Makefile.am (1.2, + rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, + rel-3-6-2, rel-3-6-0), zlib/lib/Makefile.am (1.2, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, + rel-3-6-0), zlib/prj/Makefile.am (1.2, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0), + zlib/src/Makefile.am (1.6): Updated email address to scott@id3.org + +2000-10-15 Sunday 09:06 eldamitri + + * src/tag_render.cpp (1.35): + (render): Minor bugfix + +2000-10-15 Sunday 09:05 eldamitri + + * src/globals.cpp (1.4): Removed ID3LIB_DATE + +2000-10-15 Sunday 09:04 eldamitri + + * src/io.cpp (1.1): Initial release + +2000-10-15 Sunday 09:02 eldamitri + + * configure.in (1.48, rel-3-7-3): Removed ID3LIB_DATE (and its + children) + +2000-10-15 Sunday 08:40 eldamitri + + * src/Makefile.am (1.22): + (id3lib_sources): Added io.cpp + +2000-10-15 Sunday 08:39 eldamitri + + * examples/demo_info.cpp (1.24), examples/getopt.c (1.2), + include/id3/field_impl.h (1.9), include/id3/frame_def.h (1.3), + include/id3/header_frame.h (1.19), include/id3/reader.h (1.8), + include/id3/readers.h (1.6), include/id3/writer.h (1.3), + include/id3/writers.h (1.4), libprj/id3lib.dsp (1.11), + libprj/id3lib.dsw (1.6), prj/id3lib.dsp (1.12), src/field.cpp + (1.36), src/field_string_ascii.cpp (1.23), + src/field_string_unicode.cpp (1.27), src/frame.cpp (1.30), + src/frame_impl.cpp (1.5), src/io_helpers.cpp (1.3), src/readers.cpp + (1.3), src/tag_find.cpp (1.21), src/tag_parse.cpp (1.35), + src/tag_parse_lyrics3.cpp (1.27), src/tag_parse_musicmatch.cpp + (1.15), src/tag_render.cpp (1.34): Various bugfixes so code will + compile under Windows w/o warning + +2000-10-15 Sunday 07:44 eldamitri + + * src/misc_support.cpp (1.27): Added include for utils.h + +2000-10-15 Sunday 07:44 eldamitri + + * src/field_binary.cpp (1.22): Minor include adjustment + +2000-10-15 Sunday 07:43 eldamitri + + * include/id3/Makefile.am (1.15): + (the_headers): Added helpers.h and tag_impl.h + +2000-10-15 Sunday 07:42 eldamitri + + * examples/: findeng.cpp (1.2), findstr.cpp (1.2): Added include + for iostream.h + +2000-10-15 Sunday 01:29 eldamitri + + * src/c_wrapper.cpp (1.14), src/tag_file.cpp (1.29), + zlib/include/zconf.h (1.3), zlib/include/zlib.h (1.3), + zlib/include/zutil.h (1.3), zlib/src/gzio.c (1.3), zlib/src/zutil.c + (1.3): Updates to allow functionality for WinCE + +2000-10-14 Saturday 23:26 eldamitri + + * include/id3/uint28.h (1.9), src/uint28.cpp (1.11): Removed; now + use functions readUInt28 and writeUInt28 + +2000-10-14 Saturday 23:23 eldamitri + + * include/id3/Makefile.am (1.14), include/id3/io_helpers.h (1.2), + src/Makefile.am (1.21), src/header_tag.cpp (1.19), + src/io_helpers.cpp (1.2), src/tag_impl.cpp (1.4), src/tag_parse.cpp + (1.34): Replaced class uint28 with functions + readUInt28(ID3_Reader&) and writeUInt28(ID3_Writer&, uint32) + +2000-10-14 Saturday 22:50 eldamitri + + * include/id3/error.h (1.15), src/error.cpp (1.11): Removed; id3lib + no longer uses exception handling + +2000-10-14 Saturday 22:46 eldamitri + + * examples/demo_convert.cpp (1.12), examples/demo_copy.cpp (1.6), + examples/demo_info.cpp (1.23), examples/demo_tag.cpp (1.12), + examples/get_pic.cpp (1.5), examples/test_compression.cpp (1.6), + examples/test_pic.cpp (1.7), examples/test_remove.cpp (1.8), + examples/test_unicode.cpp (1.5), include/id3/debug.h (1.4), + include/id3/field_impl.h (1.8), include/id3/globals.h (1.36), + src/c_wrapper.cpp (1.13, rel-3-7-8), src/header_frame.cpp (1.19), + src/misc_support.cpp (1.26): Removed references to error.h and + ID3_Error, as id3lib no longer uses exception handling + +2000-10-14 Saturday 22:45 eldamitri + + * src/Makefile.am (1.20): + (id3lib_sources): Removed error.cpp; no longer need exception + handling + +2000-10-14 Saturday 22:44 eldamitri + + * include/id3/Makefile.am (1.13): + (noinst_HEADERS): Removed error.h; no longer need exception handling + +2000-10-14 Saturday 22:43 eldamitri + + * id3lib.spec.in (1.22): Removed explicit architecture detection, + since we no longer need to build with exceptions + +2000-10-14 Saturday 22:03 eldamitri + + * include/id3/: readers_compressed.h (1.4), writers_compressed.h + (1.3): No longer needed. Moved to io_decorators.h + +2000-10-14 Saturday 21:24 eldamitri + + * examples/demo_info.cpp (1.22), examples/test_io.cpp (1.2), + src/field_binary.cpp (1.21), src/field_integer.cpp (1.17), + src/field_string_ascii.cpp (1.22), src/field_string_unicode.cpp + (1.26), src/frame_parse.cpp (1.25), src/frame_render.cpp (1.18), + src/header_frame.cpp (1.18), src/header_tag.cpp (1.18), + src/helpers.cpp (1.4), src/misc_support.cpp (1.25), src/tag.cpp + (1.29), src/tag_file.cpp (1.28), src/tag_impl.cpp (1.3), + src/tag_parse.cpp (1.33), src/tag_parse_lyrics3.cpp (1.26), + src/tag_parse_musicmatch.cpp (1.14), src/tag_parse_v1.cpp (1.16), + src/tag_render.cpp (1.33), src/uint28.cpp (1.10): + - Replaced some io decorators in favor of io helper functions + (better efficiency) BinaryReader -> readBinary, + readAllBinary TextReader -> readString, readUnicodeString, + readText, readUnicodeText BinaryNumberReader -> readBENumber + TrailingSpacesReader -> readTrailingSpaces TrailingSpacesWriter -> + writeTrailingSpaces BinaryNumberWriter -> writeBENumber + - replaced MIN and MAX macros with min and max template functions + +2000-10-14 Saturday 21:17 eldamitri + + * include/id3/writers.h (1.3): (class ID3_IOStreamWriter, class + ID3_OStreamWriter): only writes char* buffers to streams + +2000-10-14 Saturday 21:13 eldamitri + + * include/id3/writer.h (1.2): Minor code changes + +2000-10-14 Saturday 21:13 eldamitri + + * include/id3/reader.h (1.7): Renamed remainingChars to + remainingBytes, minor code changes + +2000-10-14 Saturday 21:03 eldamitri + + * include/id3/strings.h (1.3): BString is "unsigned char" again + +2000-10-14 Saturday 20:58 eldamitri + + * include/id3/globals.h (1.35): Removed MAX, MIN, ABS, and CLAMP + macros + +2000-10-14 Saturday 20:53 eldamitri + + * src/Makefile.am (1.19): + (id3lib_sources): Added io_decorators.cpp, io_helpers.cpp; removed + reader_decorators.cpp, writer_decorators.cpp + +2000-10-14 Saturday 20:48 eldamitri + + * include/id3/Makefile.am (1.12): + (noinst_HEADERS): Added io_decorators, io_helpers, io_strings; + removed reader_decorators.h, readers_compressed.h, + writer_decorators.h, writers_compressed.h + +2000-10-14 Saturday 20:45 eldamitri + + * include/id3/io_decorators.h (1.1), include/id3/io_helpers.h + (1.1), include/id3/io_strings.h (1.1), src/io_decorators.cpp (1.1), + src/io_helpers.cpp (1.1): Initial release + +2000-10-14 Saturday 20:15 eldamitri + + * include/id3/reader_decorators.h (1.8), + include/id3/writer_decorators.h (1.3), src/reader_decorators.cpp + (1.2): No longer needed. Replaced by io_helpers, io_decorators, + and io_strings + +2000-10-13 Friday 20:29 eldamitri + + * examples/demo_simple.c (1.2): + (main): Minor bugfixes to prevent compiler warnings + +2000-10-13 Friday 20:25 eldamitri + + * examples/: demo_convert.cpp (1.11), demo_copy.cpp (1.5), + demo_info.cpp (1.21), demo_tag.cpp (1.11): + (main): Bugfix with checking for warning, notice, v1tag, v2tag + +2000-10-13 Friday 20:22 eldamitri + + * src/uint28.cpp (1.9): Minor bugfix with placement of include for + config.h + +2000-10-13 Friday 20:21 eldamitri + + * src/tag_parse.cpp (1.32): + (parse): Bug fix for parsing tags with specs other than most current + +2000-10-13 Friday 20:20 eldamitri + + * src/header_frame.cpp (1.17): + (Parse): More debugging output, minor bugfix + +2000-10-13 Friday 20:19 eldamitri + + * include/id3/reader_decorators.h (1.7): (class + BinaryNumberReader): Fixed bug with masking + +2000-10-13 Friday 20:17 eldamitri + + * include/id3/debug.h (1.3): Removed debugging output + +2000-10-13 Friday 20:12 eldamitri + + * configure.in (1.47): Moved the version to 3.8.0pre1, added some + new checks, removed some redendant ones + +2000-10-13 Friday 00:36 eldamitri + + * src/tag_parse_musicmatch.cpp (1.13): + (parse): Fixed signed/unsigned bug + +2000-10-13 Friday 00:35 eldamitri + + * src/tag_parse_lyrics3.cpp (1.25): + (findText): Fixed =/== bug + +2000-10-13 Friday 00:35 eldamitri + + * src/tag_parse.cpp (1.31): + (parseFrames): Now returns true on successful parse + +2000-10-13 Friday 00:34 eldamitri + + * src/tag_file.cpp (1.27): Moved around some file includes + +2000-10-13 Friday 00:34 eldamitri + + * src/tag.cpp (1.28): + (Link): Fixed minor bug with not returning a value + +2000-10-13 Friday 00:33 eldamitri + + * src/helpers.cpp (1.3): + (getString): Now uses methods ID3_Field::GetText() to build new + string + (getStringAtIndex): Now uses methods ID3_Field::GetTextItem() to + build new string + (removeFrames): Minor fix to prevent compiler warning + (removeArtists): Minor fix to prevent compiler warning + +2000-10-13 Friday 00:30 eldamitri + + * src/frame_parse.cpp (1.24): + (parseFields): Now returns true on successful parse + +2000-10-13 Friday 00:30 eldamitri + + * src/frame_impl.cpp (1.4): (operator=): Now returns *this + +2000-10-13 Friday 00:30 eldamitri + + * src/field_string_unicode.cpp (1.25): Added method + GetTextItem(index_t) + +2000-10-13 Friday 00:30 eldamitri + + * src/field_string_ascii.cpp (1.21): Added method + GetUnicodeTextItem(index_t) + +2000-10-13 Friday 00:29 eldamitri + + * include/id3/: reader.h (1.6), reader_decorators.h (1.6), + readers.h (1.5), readers_compressed.h (1.3), writer_decorators.h + (1.2), writers.h (1.2), writers_compressed.h (1.2): Minor code + changes, fixed ansi-compliance problems that gave compiler warnings + +2000-10-13 Friday 00:29 eldamitri + + * include/id3/tag_impl.h (1.3): (class ID3_TagImpl): method + SetChanged(bool) is now void + +2000-10-13 Friday 00:28 eldamitri + + * include/id3/: field.h (1.40), field_impl.h (1.7): (class + ID3_Field): Added methods GetTextItem(size_t) and + GetUnicodeTextItem(index_t) + +2000-10-12 Thursday 10:15 eldamitri + + * m4/Makefile.am (1.5): Now only have a single m4 file + +2000-10-12 Thursday 10:14 eldamitri + + * m4/id3_cxx.m4 (1.1): Initial release + +2000-10-12 Thursday 10:13 eldamitri + + * m4/: lf_bash.m4 (1.2), lf_cc.m4 (1.2), lf_cxx_convenience.m4 + (1.2), lf_fortran.m4 (1.2), lf_host_type.m4 (1.2), lf_lisp.m4 + (1.2), lf_nm.m4 (1.2), lf_texidoc.m4 (1.2), lf_txtc.m4 (1.2), + lf_warnings.m4 (1.2), lf_x11.m4 (1.2): Removed. Unused. + +2000-10-10 Tuesday 06:16 eldamitri + + * include/id3/utils.h (1.14): + (mid): Added function; returns mid if it is between lo and hi, + otherwise returns lo or hi (whichever is closest to mid) + +2000-10-10 Tuesday 06:15 eldamitri + + * examples/: demo_convert.cpp (1.10), demo_copy.cpp (1.4), + demo_info.cpp (1.20), demo_tag.cpp (1.10): + - Removed everything assicatiated with popt + - Now uses files generated from gengetopt input files to parse args + - Left in function PrintUsage(), even though it isn't used, in case + gengetopt supports app descriptions eventually + +2000-10-10 Tuesday 06:09 eldamitri + + * examples/Makefile.am (1.18): + - Removed everything assicatiated with popt + - Added getopt object files to LDADD, if needed + - Added new getopt source files for demo apps + +2000-10-10 Tuesday 06:03 eldamitri + + * examples/: demo_convert_options.c (1.1), + demo_convert_options.ggo.in (1.1), demo_convert_options.h (1.1), + demo_copy_options.c (1.1), demo_copy_options.ggo.in (1.1), + demo_copy_options.h (1.1), demo_info_options.c (1.1), + demo_info_options.ggo.in (1.1), demo_info_options.h (1.1), + demo_tag_options.c (1.1), demo_tag_options.ggo.in (1.1), + demo_tag_options.h (1.1): Initial release + +2000-10-10 Tuesday 05:57 eldamitri + + * configure.in (1.46): + - Added AC_PROG_CC for initializing the C compiler + - Added AC_EXEEXT for determining any executable extension + - Removed everything assicatiated with popt + - Added check, conditional for getopt_long + +2000-10-10 Tuesday 05:54 eldamitri + + * Makefile.am (1.25): Removed everything associated with popt + +2000-10-09 Monday 06:40 eldamitri + + * popt/: .cvsignore (1.2), CHANGES (1.2), COPYING (1.2), Doxyfile + (1.2), Doxyfile.in (1.2), Makefile (1.2), Makefile.am (1.2), + Makefile.in (1.2), README (1.2), acconfig.h (1.2), aclocal.m4 + (1.2), autogen.sh (1.2), config.guess (1.2), config.h (1.2), + config.h.in (1.2), config.log (1.5), config.status (1.8, + rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7), config.sub (1.2), configure (1.2), configure.in (1.2), + findme.c (1.2), findme.h (1.2), install-sh (1.2), libtool (1.2), + ltconfig (1.2), ltmain.sh (1.2), missing (1.2), mkinstalldirs + (1.2), popt.3 (1.2), popt.c (1.2), popt.h (1.2), popt.ps (1.2), + popt.spec (1.2), poptconfig.c (1.2), popthelp.c (1.2), poptint.h + (1.2), poptparse.c (1.2), stamp-h (1.2), stamp-h.in (1.2), system.h + (1.2), test-poptrc (1.2), test1.c (1.2), test2.c (1.2), testit.sh + (1.2), intl/ChangeLog (1.2), intl/Makefile (1.2), intl/Makefile.in + (1.2), intl/VERSION (1.2), intl/bindtextdom.c (1.2), + intl/cat-compat.c (1.2), intl/dcgettext.c (1.2), intl/dgettext.c + (1.2), intl/explodename.c (1.2), intl/finddomain.c (1.2), + intl/gettext.c (1.2), intl/gettext.h (1.2), intl/gettextP.h (1.2), + intl/hash-string.h (1.2), intl/intl-compat.c (1.2), + intl/l10nflist.c (1.2), intl/libgettext.h (1.2), intl/linux-msg.sed + (1.2), intl/loadinfo.h (1.2), intl/loadmsgcat.c (1.2), + intl/localealias.c (1.2), intl/po2tbl.sed (1.2), intl/po2tbl.sed.in + (1.2), intl/textdomain.c (1.2), intl/xopen-msg.sed (1.2), + po/Makefile (1.2), po/Makefile.in (1.2), po/Makefile.in.in (1.2), + po/POTFILES (1.2), po/POTFILES.in (1.2), po/cat-id-tbl.c (1.2), + po/popt.pot (1.2), po/ro.gmo (1.2), po/ro.po (1.2), po/sk.gmo + (1.2), po/sk.po (1.2), po/stamp-cat-id (1.2): Not needed; moved + back to getopt_long (now using in conjunction with gengetopt) + +2000-10-09 Monday 06:34 eldamitri + + * examples/: getopt.c (1.1), getopt.h (1.1), getopt1.c (1.1): + Initial release + +2000-10-09 Monday 06:33 eldamitri + + * src/utils.cpp (1.11): Removed the following functions + (functionality in Readers/Writers): + - size_t timeToSeconds(const char*, size_t); + - bool isCRLF(const char*, const char*); + - size_t CRLFtoLF(char *, size_t); + - void removeTrailingSpaces(char*, size_t); + - String removeTrailingSpaces(String); + - uint32 parseNumber(const uchar*, size_t); + - size_t getUnSyncSize(uchar *, size_t); + - void unsync(uchar *, size_t, const uchar *, size_t); + - size_t resync(uchar *, size_t); + +2000-10-09 Monday 06:32 eldamitri + + * src/uint28.cpp (1.8): + - Added inclusion of files readers.h, reader_decorators.h, writers.h + - Removed constructor uint28(const uchar*) + - Removed methods Parse(const uchar*), Parse(const char*), + Render(uchar*) and Render(char*) + - Added methods Parse(ID3_Reader&) and Render(ID3_Writer&) + - Reimplemented operator<< and operator>> to use Readers, Writers + +2000-10-09 Monday 06:31 eldamitri + + * src/tag_render.cpp (1.32): + - Added inclusion of files writers.h and writer_decorators.h + - Moved docs to tag.cpp + - Added method id3::v1::render(ID3_Writer&, const ID3_TagImpl&) + - Added method id3::v2::renderFrames(ID3_Writer&, const + ID3_TagImpl&) + - Added method id3::v2::render(ID3_Writer&, const ID3_TagImpl&) + - Removed method Render(uchar*, ID3_TagType) + - Minor code cleanups + +2000-10-09 Monday 06:31 eldamitri + + * src/tag_parse_v1.cpp (1.15): + (parse): + - Moved declaration to tag_impl.h + - Fixed bug when detecting if there's enough data to parse + - Better use of Reader classes + - Checks to ensure empty text frames aren't added + +2000-10-09 Monday 06:30 eldamitri + + * src/tag_parse_musicmatch.cpp (1.12): + (readTextFrame): Converted from TextFrameReader class + (mm::parse): + - Fixed bug when detecting if there's enough data to parse + - Changed all calls to method ID3_Frame::Field() to be calls to + method ID3_Frame::GetField() + +2000-10-09 Monday 06:30 eldamitri + + * src/tag_parse_lyrics3.cpp (1.24): + - Updated debugging output + (lyr3::v1::parse): + - Fixed bug when detecting if there's enough data to parse + - Better use of Reader classes + - Minor code cleanup + +2000-10-09 Monday 06:30 eldamitri + + * src/tag_parse.cpp (1.30): + - Moved declarations to tag_impl.h + - Better use of new Reader classes + - More debugging output + - Minor code changes + +2000-10-09 Monday 06:29 eldamitri + + * src/tag_impl.cpp (1.2): + - Moved docs to tag.cpp + (IsV2Tag):Implemented to use new Reader classes + (AddFrames): Removed + (SetExtended): Renamed from SetExtendedHeader + (SetExperimental, GetUnsync, GetExtended, GetExperimental): Added + +2000-10-09 Monday 06:29 eldamitri + + * src/tag_find.cpp (1.20): + (Find): + - Moved docs to tag.cpp + - Reimplementation using new methods in TagImpl + +2000-10-09 Monday 06:29 eldamitri + + * src/tag_file.cpp (1.26): + - Added inclusion of files writers.h and writer_decorators.h + (RenderV1ToFile): reimplemented for use with a Writer + (RenderV2ToFile): reimplemented for use with a Writer + +2000-10-09 Monday 06:29 eldamitri + + * src/tag.cpp (1.27): + - Changed all calls to method ID3_Frame::Field() to be calls to + method ID3_Frame::GetField() + - Added documentation + - Added methods SetExperimental(bool), GetExperimental() + - Added implementation for Render(ID3_Writer&, ID3_TagType) + +2000-10-09 Monday 06:28 eldamitri + + * src/readers.cpp (1.2): + (readChars): Replaced types streamsize and streamoff with size_type + and pos_type, respectively + +2000-10-09 Monday 06:28 eldamitri + + * src/misc_support.cpp (1.24): + - Changed all calls to method ID3_Frame::Field() to be calls to + method ID3_Frame::GetField() + - Minor code changes + +2000-10-09 Monday 06:28 eldamitri + + * src/helpers.cpp (1.2): + (getV1Comment): Added + (getComment): Cleaned up implementation + +2000-10-09 Monday 06:28 eldamitri + + * src/header_tag.cpp (1.17): + - Added inclusion of file writer_decorators.h + - Replaced method Render(uchar*) with method Render(ID3_Writer&) + - Reimplemented Parse(ID3_Reader&) to better make use of reader + functionality + +2000-10-09 Monday 06:27 eldamitri + + * src/header_frame.cpp (1.16): + - Replaced method Render(uchar*) with method Render(ID3_Writer&) + - Added additional debuggin output + - Minor code changes + +2000-10-09 Monday 06:27 eldamitri + + * src/frame_render.cpp (1.17): + - Removed inclusion of file error.h + - Added inclusion of files wirter_decorators.h and + writers_compressed.h + - Removed irrelevant documentation + - Added function renderFields(ID3_Writer& writer, const + ID3_FrameImpl&) + - Replaced method Render(uchar*) with method Render(ID3_Writer&) + +2000-10-09 Monday 06:27 eldamitri + + * src/frame_parse.cpp (1.23): + - Removed inclusin of zlib.h + - Minor code changes + +2000-10-09 Monday 06:26 eldamitri + + * src/frame_impl.cpp (1.3): + - Changed all calls to method ID3_Frame::Field() to be calls to + method ID3_Frame::GetField() + - Removed implementation of Field(ID3_FieldID) + - Renamed method GetNumFields() to NumFields() + - Renamed method GetFieldAt() to GetFieldNum() + - Updated documentation + +2000-10-09 Monday 06:26 eldamitri + + * src/frame.cpp (1.29): + - Renamed method GetNumFields() to NumFields() + - Renamed method GetFieldAt() to GetFieldNum() + - Replaced method Render(uchar*) with method Render(ID3_Writer&) + (Field): Implemented in terms of method GetField(() + +2000-10-09 Monday 06:26 eldamitri + + * src/field_string_unicode.cpp (1.24): + - Changed all calls to method ID3_Frame::Field() to be calls to + method ID3_Frame::GetField() + +2000-10-09 Monday 06:26 eldamitri + + * src/field_string_ascii.cpp (1.20): + - Changed all calls to method ID3_Frame::Field() to be calls to + method ID3_Frame::GetField() + - Replaced method RenderString(uchar*) with method + RenderString(ID3_Writer&) + +2000-10-09 Monday 06:25 eldamitri + + * src/field_integer.cpp (1.16): + - Changed all calls to method ID3_Frame::Field() to be calls to + method ID3_Frame::GetField() + - Replaced method RenderInteger(uchar*) with method + RenderInteger(ID3_Writer&) + +2000-10-09 Monday 06:25 eldamitri + + * src/field_binary.cpp (1.20): + - Changed all calls to method ID3_Frame::Field() to be calls to + method ID3_Frame::GetField() + - Replaced method RenderBinary(uchar*) with method + RenderBinary(ID3_Writer&) + +2000-10-09 Monday 06:25 eldamitri + + * src/field.cpp (1.35): + - Changed all calls to method ID3_Frame::Field() to be calls to + method ID3_Frame::GetField() + - Removed implementation of method Parse(const uchar*, size_t) + - Replaced method Render(uchar*) with method Render(ID3_Writer&) + +2000-10-09 Monday 06:25 eldamitri + + * src/c_wrapper.cpp (1.12): + (ID3Frame_GetField): Changed call to method ID3_Frame::Field() to + method ID3_Frame::GetField() + +2000-10-09 Monday 03:59 eldamitri + + * include/id3/utils.h (1.13): Removed the following methods + (funcitonality in Readers/Writers): + - size_t timeToSeconds(const char*, size_t); + - bool isCRLF(const char*, const char*); + - size_t CRLFtoLF(char *, size_t); + - void removeTrailingSpaces(char*, size_t); + - String removeTrailingSpaces(String); + - uint32 parseNumber(const uchar*, size_t); + - size_t getUnSyncSize(uchar *, size_t); + - void unsync(uchar *, size_t, const uchar *, size_t); + - size_t resync(uchar *, size_t); + +2000-10-09 Monday 03:57 eldamitri + + * include/id3/uint28.h (1.8): + - Added forward declarations for ID3_Reader, ID3_Writer (class + + uint28): + - Removed constructor uint28(const uchar*) + - Removed methods operator=(const uchar*), operator=(const char*), + Parse(const uchar*), Parse(const char*), Render(uchar*) and + Render(char*) + - Added methods Parse(ID3_Reader&) and Render(ID3_Writer&) + +2000-10-09 Monday 03:56 eldamitri + + * include/id3/tag_impl.h (1.2): + - Added inclusion of file error.h + - Added forward decl for ID3_Writer + - Removed definition of constant STR_V1_COMMENT_DESC (moved to + globals.h) + - Added declarations for the following functions in namespace + + 'dami': + - id3::v1::parse(ID3_TagImpl&, ID3_Reader&) + - id3::v1::render(ID3_Writer&, ID3_TagImpl&) + - id3::v2::parse(ID3_TagImpl&, ID3_Reader&) + - id3::v2::render(ID3_Writer&, ID3_TagImpl&) + - lyr3::v1::parse(ID3_TagImpl&, ID3_Reader&) + - lyr3::v2::parse(ID3_TagImpl&, ID3_Reader&) + - mm::parse(ID3_TagImpl&, ID3_Reader&) (class ID3_TagImpl): + - Added methods SetChanged(bool), GetUnsync(), GetExtendedHeader(), + GetExperimental() + - Removed methods Parse(ID3_Reader&), Parse(const uchar*, size_t), + Parse(const ucharp[, const uchar*) + - Made PaddingSize(size_t) public + +2000-10-09 Monday 03:56 eldamitri + + * include/id3/tag.h (1.47): + - Added forward declaration for ID3_Writer + - Added methods GetUnsync(), GetExtendedHeader(), GetExperimental() + - Added method Render(ID3_Writer&, ID3_TagType) + +2000-10-09 Monday 03:56 eldamitri + + * include/id3/readers_compressed.h (1.2): (class + CompressedMemoryReader): Removed (class CompressedStreamReader): + - Renamed from CompressedMemoryReader + - Replaced types streamsize and streamoff with size_type and + pos_type, respectively + - Replaced type char with char_type + +2000-10-09 Monday 03:56 eldamitri + + * include/id3/readers.h (1.4): + - Replaced types streamsize and streamoff with size_type and + pos_type, respectively + - Replaced type char with char_type (class ID3_MemoryReader): Added + constructor for signed chars + +2000-10-09 Monday 03:55 eldamitri + + * include/id3/reader_decorators.h (1.5): + - Replaced types streamsize and streamoff with size_type and + pos_type, respectively + - Added more debugging output + - Removed references to 'dami' namespace (class WindowedReader): + Added method atEnd() (class TrailingSpacesReader): Added (class + + BinaryNumberReader): + - Renamed from NumberReader + - Replaced call to function parseNumber with new code (class + BinaryReader): renamed method getBinary() to readBinary() (class + StringReader): Added + +2000-10-09 Monday 03:55 eldamitri + + * include/id3/reader.h (1.5): (class ID3_Reader): + - Updated typedefs to be more explicit with size + - Removed typedefs for streamsize and streamoff (use size_type and + pos_type instead) + +2000-10-09 Monday 03:55 eldamitri + + * include/id3/helpers.h (1.2): Added function getV1Comment(const + ID3_TagImpl&) + +2000-10-09 Monday 03:55 eldamitri + + * include/id3/header_tag.h (1.17): (class ID3_FrameRender): + - Replaced method Render(uchar*) with method Render(ID3_Writer&) + - Added methods SetExperimental(bool), GetExperimental() + +2000-10-09 Monday 03:54 eldamitri + + * include/id3/header_frame.h (1.18): (class ID3_FrameHeader): + Replaced method Render(uchar*) with method Render(ID3_Writer&) + +2000-10-09 Monday 03:54 eldamitri + + * include/id3/header.h (1.19): + - Removed include of file 'reader.h' (not needed) + - Added forward declaration for ID3_Writer + - Removed methods Render(uchar*) and Parse(const uchar*, size_t) + - Added method Render(ID3_Writer&) + +2000-10-09 Monday 03:54 eldamitri + + * include/id3/globals.h (1.34): Added macro STR_V1_COMMENT_DESC + +2000-10-09 Monday 03:53 eldamitri + + * include/id3/frame_impl.h (1.2): (class ID3_FrameImpl): + - Renamed method GetNumFields() to NumFields() to be consistent with + ID3_Tag + - Renamed method GetFieldAt() to GetFieldNum() to be consistent with + ID3_Tag + - Replaced method Render(uchar*) with method Render(ID3_Writer&) + - Removed deprecated method Field(ID3_FieldID) + +2000-10-09 Monday 03:53 eldamitri + + * include/id3/frame.h (1.33): + - Added forward declaration for ID3_Writer (class ID3_Frame): + - Renamed method GetNumFields() to NumFields() to be consistent with + ID3_Tag + - Renamed method GetFieldAt() to GetFieldNum() to be consistent with + ID3_Tag + - Replaced method Render(uchar*) with metod Render(ID3_Writer&) + +2000-10-08 Sunday 23:36 eldamitri + + * include/id3/field_impl.h (1.6): (class ID3_FieldImpl): + - Removed methods Render(uchar*) and Parse(const uchar*, size_t) + - Added method Render(ID3_Writer&) + - Replaced methods renderInteger(uchar*), RenderString(uchar*), and + RenderBinary(uchar*) with ID3_Writer equivalents + +2000-10-08 Sunday 23:31 eldamitri + + * include/id3/field.h (1.39): + - Forward declaration for ID3_Writer + - Removed methods Render(uchar*) and Parse(const uchar*, size_t) + - Added method Render(ID3_Writer&) + +2000-10-08 Sunday 23:29 eldamitri + + * examples/test_unicode.cpp (1.4): + - Added include for file id3/error.h + - Changed all calls to method ID3_Frame::Field calls to be calls to + method ID3_Frame::GetField + +2000-10-08 Sunday 23:28 eldamitri + + * examples/test_remove.cpp (1.7): + - Added includes for files id3/error.h, id3/strings.h + - Changed all calls to method ID3_Frame::Field calls to be calls to + method ID3_Frame::GetField + - Minor formatting changes + +2000-10-08 Sunday 23:28 eldamitri + + * examples/get_pic.cpp (1.4): Added include for id3/error.h + +2000-10-08 Sunday 23:27 eldamitri + + * examples/: test_compression.cpp (1.5), test_pic.cpp (1.6): + - Added includes for files config.h, id3/debug.h, id3/error.h + - Added debugging output + - Changed all calls to method ID3_Frame::Field calls to be calls to + method ID3_Frame::GetField + +2000-10-08 Sunday 23:13 eldamitri + + * examples/demo_tag.cpp (1.9): + - Added include for file config.h + - Added debugging options + - Fixed a bug for parsing track numbers '08' and '09' with popt + (thanks Matt Sottek ) + +2000-10-08 Sunday 23:10 eldamitri + + * examples/demo_info.cpp (1.19): + (PrintInformation): When printing synced lyrics info, now uses a + MemoryReader, BinaryNumberReader, and TextReader to extract the + infromation from the binary field. This is a cheat, since these + classes aren't normally exposed to folks using the library. + Hopefully they will be exposed soon enough for the next major + release. + +2000-10-08 Sunday 23:05 eldamitri + + * src/tag_sync.cpp (1.9): Removed. No longer used. Reader/writer + decorators provide same functionality. + +2000-10-08 Sunday 23:03 eldamitri + + * src/Makefile.am (1.18): + (id3lib_sources): Added reader_decorators.cpp, writers.cpp, and + writer_decorators.cpp. Removed tag_sync.cpp + +2000-10-08 Sunday 23:01 eldamitri + + * include/id3/Makefile.am (1.11): + (the_headers): Added writer.h and writers.h + (noinst_HEADERS): Added writer_decorators.h and writers_compressed.h + +2000-10-08 Sunday 22:59 eldamitri + + * examples/Makefile.am (1.17): Removed testreader, added testio + +2000-10-08 Sunday 22:38 eldamitri + + * src/reader_decorators.cpp (1.1), src/writer_decorators.cpp (1.1), + src/writers.cpp (1.1), include/id3/writer.h (1.1), + include/id3/writer_decorators.h (1.1), include/id3/writers.h (1.1), + include/id3/writers_compressed.h (1.1): Initial release. + +2000-10-08 Sunday 22:32 eldamitri + + * examples/test_io.cpp (1.1): Added for testing io classes in + id3lib + +2000-10-08 Sunday 22:30 eldamitri + + * examples/test_reader.cpp (1.2): Removed. Replaced with + test_io.cpp + +2000-10-03 Tuesday 06:53 eldamitri + + * examples/demo_info.cpp (1.18): + - Use GetField() method rather than Field() + - Adjusted for changes in namespace + +2000-10-03 Tuesday 06:51 eldamitri + + * src/: tag_file.cpp (1.25), tag_find.cpp (1.19), tag_parse.cpp + (1.29), tag_parse_lyrics3.cpp (1.23), tag_parse_musicmatch.cpp + (1.11), tag_parse_v1.cpp (1.14), tag_render.cpp (1.31), + tag_sync.cpp (1.8): + - Adjusted for changes in namespace + - Implementation for methods of class ID3_TagImpl rather than class + ID3_Tag + - Removed calls to ID3_THROW + +2000-10-03 Tuesday 06:38 eldamitri + + * src/: field.cpp (1.34), field_binary.cpp (1.19), + field_integer.cpp (1.15), field_string_ascii.cpp (1.19), + field_string_unicode.cpp (1.23), frame_parse.cpp (1.22), + header_frame.cpp (1.15), header_tag.cpp (1.16): Adjusted for + changes in namespace. + +2000-10-03 Tuesday 06:37 eldamitri + + * src/utils.cpp (1.10): Adjusted for changes in namespace, added + method toString(uint32) + +2000-10-03 Tuesday 06:32 eldamitri + + * src/tag.cpp (1.26): ID3_Tag is now merely an interface. + Implementation details are hidden behind the lone member variable, + which is a pointer to the class ID3_TagImpl. ID3_Tag's methods are + implemented as calls to ID3_TagImpl + +2000-10-03 Tuesday 06:30 eldamitri + + * src/misc_support.cpp (1.23): + (ID3_GetString): Removed call to ID3_THROW + +2000-10-03 Tuesday 06:26 eldamitri + + * src/frame_render.cpp (1.16): Adjusted for changes in namespace, + removed calls to ID3_THROW + +2000-10-03 Tuesday 06:23 eldamitri + + * src/frame_impl.cpp (1.2): + (_InitFields): Creates a default binary field if no field info is + available; remove other throw clause + +2000-10-03 Tuesday 04:44 eldamitri + + * src/c_wrapper.cpp (1.11, rel-3-7-7): Added include for error.h + (should be removed soon). + +2000-10-03 Tuesday 04:43 eldamitri + + * include/id3/utils.h (1.12): + - Functions are now in namespace dami, replacing namespace id3 + - Change to reflect changes in string name, namespace + +2000-10-03 Tuesday 04:40 eldamitri + + * include/id3/tag.h (1.46): ID3_Tag is now merely an interface. + Implementation details are hidden behind the lone member variable, + which is a pointer to the class ID3_TagImpl. + +2000-10-03 Tuesday 03:57 eldamitri + + * include/id3/strings.h (1.2): Moved from namespace id3:: to + namespace dami::. Renamed from 'string' to 'String', 'bstring' to + 'BString', and 'wstring' to 'WString' + +2000-10-03 Tuesday 03:21 eldamitri + + * include/id3/readers.h (1.3): Moved Readers out of namespace id3. + As these will be exposed as part of the library, they are now in + global namespace. Classes have been renamed by prepending 'ID3_', + as with other classes. Moved class CompressedMemoryReader and + CompressedStreamReader into readers_compressed.h. + +2000-10-03 Tuesday 03:18 eldamitri + + * include/id3/reader_decorators.h (1.4): Restructured namespaces. + All Reader classes are now in namespace dami::io. method + readChars() in IdentityReader now supports signed and unsigned chars + +2000-10-03 Tuesday 02:53 eldamitri + + * include/id3/reader.h (1.4): + - method readChars() now supports signed and unsigned chars + +2000-10-03 Tuesday 02:45 eldamitri + + * include/id3/field_impl.h (1.5): (class ID3_FieldImpl): Added a + new char* Set method for binary data + +2000-10-03 Tuesday 02:36 eldamitri + + * src/Makefile.am (1.17): + (id3lib_sources): Added 'helpers.cpp', 'readers.cpp', 'tag_impl.cpp' + +2000-10-03 Tuesday 02:31 eldamitri + + * include/id3/Makefile.am (1.10): + (the_headers): Added 'reader.h' and 'readers.h', moved 'error.h', + 'flags.h', 'header.h', 'header_frame.h', and 'header_tag.h' to + noinst_HEADERS so that they're not part of an installed distribution + (noinst_HEADERS): Added 'readers_compressed.h' + +2000-10-02 Monday 19:03 eldamitri + + * include/id3/helpers.h (1.1), src/helpers.cpp (1.1), + include/id3/lyr3.h (1.1), include/id3/lyr3_impl.h (1.1), + include/id3/mm.h (1.1), include/id3/mm_impl.h (1.1), + include/id3/readers_compressed.h (1.1), include/id3/tag_impl.h + (1.1), include/id3/v1.h (1.1), include/id3/v1_impl.h (1.1), + src/readers.cpp (1.1), src/tag_impl.cpp (1.1): Initial release + +2000-10-02 Monday 19:01 eldamitri + + * examples/: demo_convert.cpp (1.9, rel-3-7-9), demo_copy.cpp + (1.3), demo_tag.cpp (1.8): Added include for error.h (should be + removed soon). + +2000-10-01 Sunday 02:05 eldamitri + + * src/Makefile.am (1.16): + (id3lib_sources): Added frame_impl.cpp + +2000-10-01 Sunday 02:03 eldamitri + + * include/id3/tag.h (1.45), src/misc_support.cpp (1.22), + src/tag_find.cpp (1.18): Added field.h to list of included files + +2000-10-01 Sunday 02:03 eldamitri + + * include/id3/frame_impl.h (1.1), src/frame_impl.cpp (1.1): Initial + release + +2000-10-01 Sunday 02:03 eldamitri + + * include/id3/frame.h (1.32), src/frame.cpp (1.28), + src/frame_parse.cpp (1.21), src/frame_render.cpp (1.15): + - Class ID3_Frame is now simply an interface. It will pass off all + of its funcitonality to a pointer to ID3_FrameImpl, which is its + only data member. In this way, the implementation of the ID3_Frame + can more easily change without affecting its interface. ID3_Frame + can't serve as a true "interface" (that is, abstract base class) + since so much code already relies on the ability to create + stack-based frame objects, but this is pretty close. + - Added methods SetEncryptionID(uchar), GetEncryptionID(), + SetGroupingID(uchar), and GetGroupingID() + +2000-10-01 Sunday 02:02 eldamitri + + * include/id3/field_impl.h (1.4): (class ID3_FieldImpl): Changed + 'friendship' to ID3_FrameImpl + +2000-10-01 Sunday 02:01 eldamitri + + * src/c_wrapper.cpp (1.10): Added include for "frame.h" and + "field.h" + +2000-10-01 Sunday 00:20 eldamitri + + * id3lib.spec.in (1.21): + (CXXFLAGS): Added "--enable-debug=no" to call to configure + +2000-10-01 Sunday 00:16 eldamitri + + * examples/demo_info.cpp (1.17): + (PrintInformation): Minor bugfix for printing out synced lyrics + +2000-10-01 Sunday 00:14 eldamitri + + * src/utils.cpp (1.9): + - Added implementation for method removeTrailingSpaces(id3::string) + and renderNumber(uint32, size_t) + +2000-10-01 Sunday 00:13 eldamitri + + * src/: tag_parse_lyrics3.cpp (1.22), tag_parse_musicmatch.cpp + (1.10), tag_parse_v1.cpp (1.13): Complete reimplementation of + parsing functionality to use ID3_Reader& objects rather char* arrays + +2000-10-01 Sunday 00:13 eldamitri + + * src/tag_parse.cpp (1.28): + - Renamed function ID3_ParseFrames to id3::parseFrames + - Method Parse(ID3_Reader&) now returns bool to indicate success + - Renamed function ParseID3v2 to id3::parseID3v2 + - method ParseFile() now uses ID3_Reader and related methods to + parse file + +2000-10-01 Sunday 00:13 eldamitri + + * src/: header_frame.cpp (1.14), header_tag.cpp (1.15): + (Parse): Now returns bool to indicate success of parse, other minor + changes, removed method Parse(const uchar*, size_t) + +2000-10-01 Sunday 00:12 eldamitri + + * src/frame_parse.cpp (1.20): + - Added function parseFields(ID3_Reader&, ID3_Frame&) + - Updated method ID3_Frame::Parse(ID3_Reader&) to return a bool to + indicate success + +2000-10-01 Sunday 00:12 eldamitri + + * src/frame.cpp (1.27): Removed all occurrences of _bad_parse, + removed throws for failed memory allocation, added implementations + for new methods defined in frame.h + +2000-10-01 Sunday 00:12 eldamitri + + * src/field_string_unicode.cpp (1.22): + (ParseUnicodeString): Now returns bool to indicate success of parse, + other minor changes + +2000-10-01 Sunday 00:12 eldamitri + + * src/field_string_ascii.cpp (1.18): + (ParseASCIIString): Now returns bool to indicate success of parse, + other minor changes + +2000-10-01 Sunday 00:11 eldamitri + + * src/field_integer.cpp (1.14): + (ParseInteger): Now returns bool to indicate success of parse + +2000-10-01 Sunday 00:11 eldamitri + + * src/field_binary.cpp (1.18): + (ParseBinary): Now returns bool to indicate success of parse + +2000-10-01 Sunday 00:11 eldamitri + + * src/field.cpp (1.33): + (Parse) Updated implementation due to new bool return value, issues + an ID3D_WARNING rather than throwing + +2000-10-01 Sunday 00:10 eldamitri + + * include/id3/utils.h (1.11): Added declarations for methods + removeTrailingSpaces(id3::string) and renderNumber(uint32, size_t) + +2000-10-01 Sunday 00:09 eldamitri + + * include/id3/tag.h (1.44): + - method Parse(ID3_Reader&) now returns bool + +2000-10-01 Sunday 00:09 eldamitri + + * include/id3/readers.h (1.2): (class IStreamReader): Added methods + getBeg() and getEnd() + +2000-10-01 Sunday 00:09 eldamitri + + * include/id3/reader.h (1.3): (class ID3_Reader) added atEnd() + method + +2000-10-01 Sunday 00:07 eldamitri + + * include/id3/frame.h (1.31): (class ID3_Frame): + - Added methods GetField(ID3_FieldID), GetNumFields(), and + GetFieldAt(index_t) + - Parse(ID3_Reader&) method now returns bool + - Deprecated method Field(ID3_FieldNum) + - Removed mehtod BadParse() + +2000-10-01 Sunday 00:07 eldamitri + + * include/id3/reader_decorators.h (1.3): (class IdentityReader): + Cleaned up implementation (class ExitTrigger): Added (class + WindowedReader): new constructors to make using it simpler (class + CharReader): Added (class UnsyncReader): Now inherits from + CharReader (class LineFeedReader): Added + +2000-10-01 Sunday 00:06 eldamitri + + * include/id3/: header.h (1.18), header_frame.h (1.17), + header_tag.h (1.16): + - method Parse(ID3_Reader&) now returns bool + - method Parse(const uchar*, size_t) removed + +2000-10-01 Sunday 00:06 eldamitri + + * include/id3/: field.h (1.38), field_impl.h (1.3): + Parse(ID3_Reader&) method(s) now return bool + +2000-09-27 Wednesday 11:08 eldamitri + + * Makefile.am (1.24): + (changelog): added for generating changelog using cvs2cl.pl + +2000-09-27 Wednesday 11:06 eldamitri + + * ChangeLog (1.123): Now auto-generated + +2000-09-27 Wednesday 11:05 eldamitri + + * cvs2cl.pl (1.1): Initial release + +2000-09-27 Wednesday 10:36 eldamitri + + * src/tag_parse.cpp (1.27): + (ID3_ParseFrames): Added implementation that uses ID3_Reader& + (Parse): Added implementation that uses ID3_Reader& + (ParseID3v2): Now makes use of ID3_Tag::Parse(ID3_Reader&) + +2000-09-27 Wednesday 10:31 eldamitri + + * src/: header_frame.cpp (1.13), header_tag.cpp (1.14): + (Parse): Added overloaded implementation using ID3_Reader& + +2000-09-27 Wednesday 10:28 eldamitri + + * src/field_string_unicode.cpp (1.21): + (ParseUnicodeString): Replaced with implementation using ID3_Reader& + +2000-09-27 Wednesday 10:25 eldamitri + + * src/field_string_ascii.cpp (1.17): + (ParseASCIIString): Replaced with implementation using ID3_Reader& + +2000-09-27 Wednesday 10:23 eldamitri + + * src/field_integer.cpp (1.13): + (ParseInteger): Replaced with implementation using ID3_Reader& + +2000-09-27 Wednesday 10:22 eldamitri + + * src/field_binary.cpp (1.17): + (ParseBinary): Replaced with implementation using ID3_Reader& + +2000-09-27 Wednesday 10:20 eldamitri + + * src/: field.cpp (1.32, rel-3-7-13), frame_parse.cpp (1.19): + (Parse): Reimplemented to use new Parse(ID3_Reader&) method, will be + soon deprecated + +2000-09-27 Wednesday 10:16 eldamitri + + * include/id3/utils.h (1.10): + - Reinstated namespace ::id3 + - Renamed all functions, removing 'ID3_' prefix and lowercasing + first letter + - Added templated versions of functions min, max, and abs + +2000-09-27 Wednesday 10:10 eldamitri + + * include/id3/reader_decorators.h (1.2): + - Removed definition of min (now defined in utils.h) + - Added new debugging output via ID3_NOTICE and ID3_WARNING (class + IdentityReader): Cleaned-up implementation of IdentityReader to + match new ID3_Reader interface (class WindowedReader): + - Cleaned-up implementation of inWindow, constructor, setWindow, + setBeg, setEnd + - Removed seekBeg and seekEnd + - Added implementation of remainingChars (class UnsyncedReader): + - Added new debugging output via ID3_NOTICE and ID3_WARNING + - Added implementation of skipChars + - Implementation of readChars can accept a NULL buffer + - Added implementation of remainingChars (class NumberReader, class + TextReader, class BinaryReader): added + +2000-09-27 Wednesday 10:02 eldamitri + + * include/id3/reader.h (1.2): + - Added END_OF_READER static const + - Added methods getBeg() and getEnd() + - Removed methods readByte(), readBytes(), and remainingChars() + - Replaced peek() with peekChar() + - Replaced tell() with getCur() + - Replaced seek() with setCur() + - skipChars() now returns a streamsize value + +2000-09-27 Wednesday 09:56 eldamitri + + * include/id3/header.h (1.17): Added forward declaration of + ID3_Reader + +2000-09-27 Wednesday 09:53 eldamitri + + * include/id3/field_impl.h (1.2): + - Added new Parse method that accepts an ID3_Reader& + - Replaced all protected Parse* methods that accept const uchar* + string with ones that accept ID3_Reader& + +2000-09-27 Wednesday 09:51 eldamitri + + * include/id3/: field.h (1.37), frame.h (1.30), header_frame.h + (1.16), header_tag.h (1.15), tag.h (1.43): Added new Parse method + that accepts an ID3_Reader& + +2000-09-27 Wednesday 09:47 eldamitri + + * src/: tag_file.cpp (1.24), tag_parse_lyrics3.cpp (1.21), + tag_parse_musicmatch.cpp (1.9), tag_parse_v1.cpp (1.12), + tag_render.cpp (1.30), frame_render.cpp (1.14): Updated for renamed + functions in utils.h. + +2000-09-27 Wednesday 09:40 eldamitri + + * src/tag_sync.cpp (1.7): + - All functions now in namespace ::id3 + - Renamed all functions to remove ID3_ prefix and uppercase first + char + +2000-09-27 Wednesday 09:38 eldamitri + + * src/: tag_find.cpp (1.17), utils.cpp (1.8): + - All functions now in 'id3' namespace + - Renamed functions w/ID3_ prefix, changed first letter to + lower-case + - (getFileSize): Added implementations for getFileSize(ifstream&) + and getFileSize(ofstream&) + - (openWritableFile): Added implementation for + openWritableFile(const char*, ofstream&) + - (openReadableFile): Added implementation for + openReadableFile(const char*, ifstream&) + +2000-09-27 Wednesday 09:31 eldamitri + + * src/Makefile.am (1.15): Don't link to shared zlib if we didn't + compile it. + +2000-09-27 Wednesday 09:26 eldamitri + + * include/id3/Makefile.am (1.9): + (noinst_HEADERS): Added new files + +2000-09-27 Wednesday 09:02 eldamitri + + * examples/demo_info.cpp (1.16): + - Added check and inclusion of config.h + - Updated for changed function name (ParseNumber -> + id3::parseNumber) + - Added -n and -w options for turning on NOTICE and WARNING output + in library + +2000-09-27 Wednesday 08:59 eldamitri + + * examples/Makefile.am (1.16): + - Added ID3_DEBUG_LIBS macro (for compiling with libcwd), + conditional on ID3_DEBUG_LIBS + - now compiles with ID3_DEBUG_LIBS + - added ID3LIB_DEBUG_FLAGS to INCLUDES + - added `testreader` app and sources + +2000-09-27 Wednesday 08:56 eldamitri + + * configure.in (1.45): Call to AC_CHECK_LIB for zlib and popt now + only define HAVE_ZLIB and HAVE_POPT_LIB, rather than also adding -lz + and -lpopt to LIBS (which is the default behavior). + +2000-09-27 Wednesday 08:54 eldamitri + + * AUTHORS (1.7): Reformat AUTHORS file for --usermap option to + cvs2cl.pl. + +2000-09-27 Wednesday 06:19 eldamitri + + * examples/test_reader.cpp (1.1), include/id3/debug.h (1.2), + include/id3/readers.h (1.1), include/id3/strings.h (1.1): Initial + release + +2000-09-27 Wednesday 05:32 eldamitri + + * include/id3/int28.h (1.11), src/int28.cpp (1.5): No long used + (replaced by uint28) + +2000-09-27 Wednesday 05:26 eldamitri + + * configure.in (1.44, rel-3-7-2): Fixed bug with header checking + +2000-09-22 Friday 06:40 eldamitri + + * include/id3/: reader.h (1.1), reader_decorators.h (1.1), dami.idl + (1.1): Initial release + +2000-09-22 Friday 01:45 eldamitri + + * doc/index.html.in (1.9): Added empeg to list of projects + +2000-09-22 Friday 01:41 eldamitri + + * include/id3/field_def.h (1.2): Minor fix for typo + +2000-09-22 Friday 01:37 eldamitri + + * src/tag_render.cpp (1.29): + (RenderV1): remove throwing of memory exception + (RenderV2): remove throwing of memory exception + +2000-09-22 Friday 01:22 eldamitri + + * src/tag_find.cpp (1.16): + (Find): remove throwing of memory exception + +2000-09-22 Friday 01:17 eldamitri + + * src/header_frame.cpp (1.12): Added inclusion of frame_def.h, + field_def.h, and field_impl.h + +2000-09-22 Friday 01:16 eldamitri + + * src/frame.cpp (1.26): + (_ClearFields): dynamic cast field pointer to fieldImpl so it can be + deleted + (_InitFields): create a FieldImpl rather than a Field + +2000-09-22 Friday 00:39 eldamitri + + * src/: field.cpp (1.31), field_binary.cpp (1.16), + field_integer.cpp (1.12), field_string_ascii.cpp (1.16), + field_string_unicode.cpp (1.20): Now an implementation of + ID3_FieldImpl instead of ID3_Field + +2000-09-22 Friday 00:23 eldamitri + + * include/id3/tag.h (1.42): Added inclusion of error.h for + convenience + +2000-09-22 Friday 00:21 eldamitri + + * include/id3/header_frame.h (1.15): Added a forward declaration + for FrameDef, since it was removed from field.h. + +2000-09-22 Friday 00:10 eldamitri + + * include/id3/header.h (1.16): (class ID3_Header): Bug fix in + initializing the constructor + +2000-09-22 Friday 00:03 eldamitri + + * include/id3/: field_def.h (1.1), field_impl.h (1.1), frame_def.h + (1.2): Initial release. + +2000-09-21 Thursday 23:28 eldamitri + + * include/id3/field.h (1.36): + - Made into an abstract base class so that the implementation can be + altered without affecting interface + - ID3_FieldDef and ID3_FrameDef now defined in separate files + +2000-09-15 Friday 03:49 eldamitri + + * Makefile.am (1.23, rel-3-7-13): Delete popt from windows release + (doesn't work on windows...) + +2000-09-15 Friday 02:03 eldamitri + + * NEWS (1.22), configure.in (1.43, rel-3-7-13, rel-3-7-13), + id3lib.spec.in (1.20, rel-3-7-13): Updated for 3.7.13 release + +2000-09-15 Friday 01:54 eldamitri + + * src/uint28.cpp (1.7, rel-3-7-13): Added check for iomanip + +2000-09-15 Friday 01:54 eldamitri + + * src/tag_parse.cpp (1.26, rel-3-7-13): Minor rearrangement of + include files + +2000-09-15 Friday 01:52 eldamitri + + * config.h.win32.in (1.6, rel-3-7-13): Fixed versioning constants + +2000-09-15 Friday 01:47 eldamitri + + * id3com/ID3Tag.cpp (1.11, rel-3-7-13): + (get_VersionString): Fixed version constants + +2000-09-15 Friday 00:36 eldamitri + + * include/id3/field.h (1.35, rel-3-7-13): (class ID3_Field): Made + BinSize() public, HasChanged() public and const + +2000-09-15 Friday 00:35 eldamitri + + * src/misc_support.cpp (1.21, rel-3-7-13): + (ID3_GetString): Fixed bug with encoding type + +2000-09-15 Friday 00:34 eldamitri + + * src/frame.cpp (1.25, rel-3-7-13): + (_InitFields): Access field id via method, not member + (Field): Access field id via method, not member + +2000-09-15 Friday 00:31 eldamitri + + * src/field.cpp (1.30, rel-3-7-13): + (HasChanged): changed to const + +2000-09-15 Friday 00:15 eldamitri + + * examples/demo_info.cpp (1.15, rel-3-7-13): + (PrintInformation): Adjustment for new indexing in IPLS + +2000-09-15 Friday 00:11 eldamitri + + * src/: field_string_ascii.cpp (1.15), field_string_unicode.cpp + (1.19) (utags: rel-3-7-13): A complete reimplementation for text + strings. Rather than storing all text strings as unicode, requiring + extra copies for every Set and Get, the field object stores a union + of a char* and unicode_t* pointer, converting back and forth only + when necessary. The result is a more efficient, easier-to-maintain + implementation. + +2000-09-15 Friday 00:06 eldamitri + + * src/misc_support.cpp (1.20): + (ID3_GetString): New implementation that retrieves entire string + (ID3_GetString): Indexing is no longer off by 1 + +2000-09-15 Friday 00:03 eldamitri + + * src/frame_parse.cpp (1.18, rel-3-7-13): + (Parse): No longer catches exceptions (none thrown in field objects) + +2000-09-15 Friday 00:01 eldamitri + + * src/frame.cpp (1.24): + (_InitFields): Fields initialized with field def object, rather than + manually copying the members + +2000-09-14 Thursday 23:58 eldamitri + + * src/field_integer.cpp (1.11, rel-3-7-13): + (Set): New implementation that is sensitive to the type of field, + new data members + (ParseInteger): New implementation that is sensitive to the fixed + length (if any) + (RenderInteger): Now renders _integer directly + +2000-09-14 Thursday 23:54 eldamitri + + * src/field_binary.cpp (1.15, rel-3-7-13): + (Set): Now returns number of bytes set; doesn't allocate new memory + for a fixed-length field + (ParseBinary): Change to take advantage of Set's return value + +2000-09-14 Thursday 23:50 eldamitri + + * src/field.cpp (1.29): + (ID3_Field): Bug fix; all member variables set appropriately before + calling Clear() (~ID3_Field): No longer calls Clear() to free + memory, as Clear() will allocate it for fixed-length fields + (Clear): Now ensures fixed-length fields have memory allocated + appropriately + +2000-09-14 Thursday 23:47 eldamitri + + * include/id3/field.h (1.34): (class ID3_Field): All Set() and + Add() methods now return number of bytes that were set or added + +2000-09-14 Thursday 19:59 eldamitri + + * src/field_binary.cpp (1.14): + (Set): New implementation that is sensitive to the type of field, + new data members + (Get): New implementation that is sensitive to the type of field, + new data members; returns nothing if field isn't binary + (FromFile): New implementation that is sensitive to the type of + field, new data members + (ToFile): New implementation that is sensitive to the type of field, + new data members + +2000-09-14 Thursday 18:26 eldamitri + + * src/field.cpp (1.28): + (ID3FD_GeneralText): All language fields changeed back to text + strings rather than binary due to improved implementation of text + strings + (ID3_Field): New constructor implementation w/ID3_FieldDef as param + (Clear): New implementation that is sensitive to the type of field + (Size, BinSize): new implementations for Size() and BinSize(); + Size() calculates the number of characters in a text string or the + number of bytes in anythings else, BinSize calculates the number of + bytes in the rendered field given the current encoding, etc. + (Render): Now calls same rendering function for both types of + strings (operator=): Will only assign fields that are the same type; + new field type-sensitive implementation + (SetEncoding): Now reponsible for changing the underlying encoding + of the string if a change is requested + +2000-09-14 Thursday 18:16 eldamitri + + * include/id3/misc_support.h (1.22, rel-3-7-13): + - added ID3_GetString(const ID3_Frame*, ID3FieldID) for retrieving + entire ascii string + - ID3_GetString(const ID3_Frame*, ID3_FieldID, size_t) no longer has + default parameter + +2000-09-14 Thursday 18:14 eldamitri + + * include/id3/field.h (1.33): (struct ID3_FieldDef): Renamed + members to be consistent with naming convention in rest of library + (class ID3_Field): + - Size() no longer implemented in the header + - Get() now checks to make sure this is an integer field + - added Get(char*, size_t) method for retrieving entire ascii string + - removed default parameter of Get(char*, size_t, index_t); indexing + now starts at 0 + - added Get(unicode_t*, size_t) for retrieving entire unicode string + - removed default parameter of Get(unicode_t*, size_t, index_t); + indexing now starts at 0 + - Get(uchar*, size_t) now returns the number of bytes retrieved + - BinSize() no longer has a parameter + - Added Set_i and Add_i methods + - Added (private) ID3_Field(const ID3_FieldDef&) constructor + - Member variables that don't change are now const + - Field data no longer represented by _data; rather, a union of the + various types of representations is used + - field size is now a union: _chars for text strings, _bytes for + everything else + +2000-09-11 Monday 09:46 eldamitri + + * include/id3.h (1.12, rel-3-7-13), include/id3/error.h (1.14, + rel-3-7-13), include/id3/field.h (1.32, rel-3-7-13), + include/id3/flags.h (1.3, rel-3-7-13), include/id3/frame.h (1.29, + rel-3-7-13), include/id3/globals.h (1.33, rel-3-7-13), + include/id3/header.h (1.15, rel-3-7-13), include/id3/header_frame.h + (1.14, rel-3-7-13), include/id3/header_tag.h (1.14, rel-3-7-13), + include/id3/int28.h (1.10, rel-3-7-13), include/id3/misc_support.h + (1.21), include/id3/sized_types.h (1.5, rel-3-7-13), + include/id3/spec.h (1.3, rel-3-7-13), include/id3/tag.h (1.41, + rel-3-7-13), include/id3/uint28.h (1.7, rel-3-7-13), + include/id3/utils.h (1.9, rel-3-7-13), src/error.cpp (1.10, + rel-3-7-13), src/field.cpp (1.27), src/field_binary.cpp (1.13), + src/field_integer.cpp (1.10), src/field_string_ascii.cpp (1.14), + src/field_string_unicode.cpp (1.18), src/frame.cpp (1.23), + src/frame_parse.cpp (1.17), src/frame_render.cpp (1.13, + rel-3-7-13), src/globals.cpp (1.3, rel-3-7-13), src/header.cpp + (1.9, rel-3-7-13), src/header_frame.cpp (1.11, rel-3-7-13), + src/header_tag.cpp (1.13, rel-3-7-13), src/int28.cpp (1.4, + rel-3-7-13), src/tag.cpp (1.25, rel-3-7-13), src/tag_file.cpp + (1.23, rel-3-7-13), src/tag_find.cpp (1.15, rel-3-7-13), + src/tag_parse.cpp (1.25), src/tag_parse_musicmatch.cpp (1.8, + rel-3-7-13), src/tag_render.cpp (1.28, rel-3-7-13), src/utils.cpp + (1.7, rel-3-7-13): Renamed all member variables. Changed '__' to + '_', since names with '__' aren't allowed in the C++ standard. + +2000-09-11 Monday 09:39 eldamitri + + * Makefile.in (1.35), acconfig.h (1.8, rel-3-7-13), config.h.in + (1.9, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-13), configure (1.41), examples/Makefile.in + (1.11, rel-3-7-13), include/id3/Makefile.in (1.30), + popt/config.status (1.4), src/Makefile.in (1.30), + zlib/config.status (1.4): Auto-update + +2000-09-10 Sunday 01:07 eldamitri + + * THANKS (1.15, rel-3-7-13): Added Steven Frank. + +2000-09-10 Sunday 01:04 eldamitri + + * src/field_binary.cpp (1.12): + (Set): No longer creates copies null or empty data + +2000-09-10 Sunday 01:03 eldamitri + + * src/field.cpp (1.26, rel-3-7-12): All LANGUAGE fields are now + binary so that they won't be converted unnecessarily to unicode. + +2000-09-10 Sunday 01:02 eldamitri + + * doc/musicmatch.txt (1.4, rel-3-7-13, rel-3-7-12): Minor typo + fixes (thanks Peter Luijer) + +2000-09-08 Friday 07:51 eldamitri + + * src/tag_parse_musicmatch.cpp (1.7): + (ParseMusicMatch): Minor changes for warning-free Windows + compilation + +2000-09-08 Friday 07:46 eldamitri + + * examples/Makefile.am (1.15, rel-3-7-13): + (EXTRA_DIST): Added 230-syncedlyrics.tag, thatspot.tag, and ozzy.tag + +2000-09-08 Friday 07:41 eldamitri + + * doc/musicmatch.txt (1.3): Minor formatting changes + +2000-09-07 Thursday 23:55 eldamitri + + * doc/Makefile.am (1.13, rel-3-7-13): + (EXTRA_DIST): Added 'musicmatch.txt' to the list of distribution + files + +2000-09-07 Thursday 23:53 eldamitri + + * doc/index.html.in (1.8, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-13): Updated info about + projects using idrlib: updated freeamp, added AmpBar + +2000-09-07 Thursday 23:22 eldamitri + + * doc/musicmatch.txt (1.2): Update documentation on MusicMatch + format. + +2000-09-06 Wednesday 09:04 eldamitri + + * src/error.cpp (1.9): + (ID3_Error): Replaced strdup, since it's not part of standard + libraries (thanks Steven Frank) + +2000-09-05 Tuesday 08:55 eldamitri + + * doc/musicmatch.txt (1.1): Initial release. + +2000-09-05 Tuesday 08:54 eldamitri + + * src/tag_parse_musicmatch.cpp (1.6): + (ParseMusicMatch): Complete reimplementation of the function to make + it more robust. Based on new information of the format (thanks to + the videoripper). + +2000-08-28 Monday 15:41 eldamitri + + * include/id3/field.h (1.31), include/id3/uint28.h (1.6), + src/tag_parse_musicmatch.cpp (1.5), src/uint28.cpp (1.6): + Portability fixes for the Mac (thanks John Firebaugh) + +2000-08-28 Monday 06:27 eldamitri + + * popt/: intl/ChangeLog (1.1), intl/Makefile (1.1), + intl/Makefile.in (1.1), intl/VERSION (1.1), intl/bindtextdom.c + (1.1), intl/cat-compat.c (1.1), intl/dcgettext.c (1.1), + intl/dgettext.c (1.1), intl/explodename.c (1.1), intl/finddomain.c + (1.1), intl/gettext.c (1.1), intl/gettext.h (1.1), intl/gettextP.h + (1.1), intl/hash-string.h (1.1), intl/intl-compat.c (1.1), + intl/l10nflist.c (1.1), intl/libgettext.h (1.1), intl/linux-msg.sed + (1.1), intl/loadinfo.h (1.1), intl/loadmsgcat.c (1.1), + intl/localealias.c (1.1), intl/po2tbl.sed (1.1), intl/po2tbl.sed.in + (1.1), intl/textdomain.c (1.1), intl/xopen-msg.sed (1.1), + po/Makefile (1.1), po/Makefile.in (1.1), po/Makefile.in.in (1.1), + po/POTFILES (1.1), po/POTFILES.in (1.1), po/cat-id-tbl.c (1.1), + po/popt.pot (1.1), po/ro.gmo (1.1), po/ro.po (1.1), po/sk.gmo + (1.1), po/sk.po (1.1), po/stamp-cat-id (1.1) (utags: rel-3-7-12, + rel-3-7-13): Initial release + +2000-08-28 Monday 02:32 eldamitri + + * zlib/config.h (1.1, rel-3-7-13, rel-3-7-12), zlib/config.log + (1.1, rel-3-7-13, rel-3-7-12), zlib/config.status (1.1), + zlib/libtool (1.1, rel-3-7-13, rel-3-7-12), zlib/stamp-h (1.1, + rel-3-7-13, rel-3-7-12), src/templates/cpp_template (1.1, + rel-3-7-13, rel-3-7-12), src/templates/header_template (1.1, + rel-3-7-13, rel-3-7-12), popt/CHANGES (1.1, rel-3-7-13, + rel-3-7-12), popt/COPYING (1.1, rel-3-7-13, rel-3-7-12), + popt/Doxyfile (1.1, rel-3-7-13, rel-3-7-12), popt/Doxyfile.in (1.1, + rel-3-7-13, rel-3-7-12), popt/Makefile (1.1, rel-3-7-13, + rel-3-7-12), popt/Makefile.am (1.1, rel-3-7-13, rel-3-7-12), + popt/Makefile.in (1.1, rel-3-7-13, rel-3-7-12), popt/README (1.1, + rel-3-7-13, rel-3-7-12), popt/acconfig.h (1.1, rel-3-7-13, + rel-3-7-12), popt/aclocal.m4 (1.1, rel-3-7-13, rel-3-7-12), + popt/autogen.sh (1.1, rel-3-7-13, rel-3-7-12), popt/config.guess + (1.1, rel-3-7-13, rel-3-7-12), popt/config.h (1.1, rel-3-7-13, + rel-3-7-12), popt/config.h.in (1.1, rel-3-7-13, rel-3-7-12), + popt/config.log (1.1, rel-3-7-13, rel-3-7-12), popt/config.status + (1.1), popt/config.sub (1.1, rel-3-7-13, rel-3-7-12), + popt/configure (1.1, rel-3-7-13, rel-3-7-12), popt/configure.in + (1.1, rel-3-7-13, rel-3-7-12), popt/findme.c (1.1, rel-3-7-13, + rel-3-7-12), popt/findme.h (1.1, rel-3-7-13, rel-3-7-12), + popt/install-sh (1.1, rel-3-7-13, rel-3-7-12), popt/libtool (1.1, + rel-3-7-13, rel-3-7-12), popt/ltconfig (1.1, rel-3-7-13, + rel-3-7-12), popt/ltmain.sh (1.1, rel-3-7-13, rel-3-7-12), + popt/missing (1.1, rel-3-7-13, rel-3-7-12), popt/mkinstalldirs + (1.1, rel-3-7-13, rel-3-7-12), popt/popt.3 (1.1, rel-3-7-13, + rel-3-7-12), popt/popt.c (1.1, rel-3-7-13, rel-3-7-12), popt/popt.h + (1.1, rel-3-7-13, rel-3-7-12), popt/popt.ps (1.1, rel-3-7-13, + rel-3-7-12), popt/popt.spec (1.1, rel-3-7-13, rel-3-7-12), + popt/poptconfig.c (1.1, rel-3-7-13, rel-3-7-12), popt/popthelp.c + (1.1, rel-3-7-13, rel-3-7-12), popt/poptint.h (1.1, rel-3-7-13, + rel-3-7-12), popt/poptparse.c (1.1, rel-3-7-13, rel-3-7-12), + popt/stamp-h (1.1, rel-3-7-13, rel-3-7-12), popt/stamp-h.in (1.1, + rel-3-7-13, rel-3-7-12), popt/system.h (1.1, rel-3-7-13, + rel-3-7-12), popt/test-poptrc (1.1, rel-3-7-13, rel-3-7-12), + popt/test1.c (1.1, rel-3-7-13, rel-3-7-12), popt/test2.c (1.1, + rel-3-7-13, rel-3-7-12), popt/testit.sh (1.1, rel-3-7-13, + rel-3-7-12): Initial release + +2000-08-28 Monday 00:59 eldamitri + + * examples/get_pic.cpp (1.3, rel-3-7-13): + - No longer #include's getopt.h (unused) + - return's 1 instead of exit(1) + +2000-08-28 Monday 00:58 eldamitri + + * examples/: demo_convert.cpp (1.8, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-13), demo_copy.cpp (1.2, rel-3-7-13), + demo_info.cpp (1.14), demo_tag.cpp (1.7, rel-3-7-13): + - Now uses popt instead of getopt for parameter processing + - VERSION_NUMBER now a static const char* rather than a macro + - PrintUsage, PrintVersion now accept const char* (rather than + char*) + +2000-08-28 Monday 00:42 eldamitri + + * examples/Makefile.am (1.13): Updated to link in libpopt for + parameter processing the examples + +2000-08-28 Monday 00:40 eldamitri + + * configure.in (1.42, rel-3-7-1): + - Added checks for popt, for use in examples for argument parsing + - zlib's Makefile's are no longer created; rather, it is listed as a + config subdir + +2000-08-28 Monday 00:37 eldamitri + + * Makefile.am (1.22): + (SUBDIRS): Made inclusion of popt and zlib conditional + (DIST_SUBDIRS): Added to keep track of all directories for + distribution + +2000-08-28 Monday 00:27 eldamitri + + * id3lib.kdevprj (1.1), id3lib.lsm (1.1) (utags: rel-3-7-12, + rel-3-7-13): Initial release + +2000-08-28 Monday 00:12 eldamitri + + * zlib/: AUTHORS (1.1), COPYING (1.1), ChangeLog (1.1), INSTALL + (1.1), NEWS (1.1, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7), README (1.1), acconfig (1.1), acconfig.h (1.1), + aclocal.m4 (1.1), config.h.in (1.1), configure (1.1), configure.in + (1.1), mkinstalldirs (1.1), reconf (1.1), stamp-h.in (1.1) (utags: + rel-3-7-12, rel-3-7-13): Added for updated conditional compilation + order in id3lib + +2000-08-28 Monday 00:11 eldamitri + + * zlib/: Makefile.am (1.2, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0), Makefile.in + (1.2), include/Makefile.in (1.2), lib/Makefile.in (1.2), + prj/Makefile.in (1.2), src/Makefile.am (1.5), src/Makefile.in (1.5) + (utags: rel-3-7-13): Updated for conditional compilation order in + id3lib + +2000-08-26 Saturday 23:42 eldamitri + + * id3lib.spec.in (1.19): + (RPM_OPT_FLAGS): Removed stack-boundary for RedHat 6.2 option, + updated release number + +2000-08-26 Saturday 22:25 eldamitri + + * src/tag_parse_lyrics3.cpp (1.20, rel-3-7-13): + (ParseLyrics3): Fixed compiler warning + (ParseLyrics3v2): Fixed compiler warning + +2000-08-26 Saturday 22:21 eldamitri + + * include/id3/tag.h (1.40): (class ID3_Tag): Removed unneccessary + method declartions. + +2000-08-18 Friday 19:02 adcockj + + * ChangeLog (1.114): Added Picture Functionality thanks to Philip + Oldaker + +2000-08-18 Friday 19:01 adcockj + + * id3com/: BSTRCollection.h (1.1, rel-3-7-13, rel-3-7-12), + ID3COM.rc (1.5, rel-3-7-13), ID3Field.cpp (1.6, rel-3-7-13), + ID3Field.h (1.8, rel-3-7-13), ID3Frame.cpp (1.9, rel-3-7-13), + ID3Frame.h (1.8, rel-3-7-13), ID3Tag.cpp (1.10), ID3Tag.h (1.8, + rel-3-7-13), MimeTypes.cpp (1.1, rel-3-7-13, rel-3-7-12), + MimeTypes.h (1.1, rel-3-7-13, rel-3-7-12), StdAfx.cpp (1.6, + rel-3-7-13), StdAfx.h (1.6, rel-3-7-13), TextCollection.cpp (1.1, + rel-3-7-13, rel-3-7-12), TextCollection.h (1.1, rel-3-7-13, + rel-3-7-12), TextCollection.rgs (1.1, rel-3-7-13, rel-3-7-12), + id3com.cpp (1.7, rel-3-7-13), id3com.dsp (1.15, rel-3-7-13), + id3com.idl (1.10, rel-3-7-13), resource.h (1.5, rel-3-7-13), + Sample/ID3Test.vbp (1.6, rel-3-7-13), Sample/ID3Test.vbw (1.7, + rel-3-7-13): Added Picture Functionality from Philip Oldaker + +2000-07-15 Saturday 18:20 adcockj + + * src/tag_parse.cpp (1.24), ChangeLog (1.113): fixed compile + warning under windows + +2000-07-14 Friday 09:13 adcockj + + * ChangeLog (1.112): ot compiling under windows + +2000-07-14 Friday 09:10 adcockj + + * src/: tag_file.cpp (1.22), utils.cpp (1.6): Got compiling under + windows + +2000-07-11 Tuesday 06:29 eldamitri + + * src/utils.cpp (1.5): Added implementations of exists, + ID3_CreateFile, ID3_OpenFileForWriting, ID3_OpenFileForReading, and + ID3_CloseFile + +2000-07-11 Tuesday 06:27 eldamitri + + * src/tag_parse_v1.cpp (1.11, rel-3-7-13): + - Removed inclusion of stdio.h + (ParseID3v1): Now manipulates an fstream rather than a FILE* + +2000-07-11 Tuesday 06:26 eldamitri + + * src/tag_parse_musicmatch.cpp (1.4): + - Removed inclusion of stdio.h + (MM_ParseTextField): Now manipulates an fstream rather than a FILE* + (ParseMusicMatch): Now manipulates an fstream rather than a FILE* + +2000-07-11 Tuesday 06:25 eldamitri + + * src/tag_parse_lyrics3.cpp (1.19): + - Removed inclusion of stdio.h + (ParseLyrics3): Now manipulates an fstream rather than a FILE* + (ParseLyrics3v2): Now manipulates an fstream rather than a FILE* + +2000-07-11 Tuesday 06:23 eldamitri + + * src/tag_parse.cpp (1.23): + - Removed inclusion of stdio.h + (ParseID3v2): + - Now manipulates an fstream rather than a FILE* + - Now uses ID3_Tag::IsV2Tag rather than ID3_IsTagHeader + (ParseFile): Now manipulates an fstream rather than a FILE* + +2000-07-11 Tuesday 06:21 eldamitri + + * src/tag_file.cpp (1.21): + - Added inclusion of utils.h + - Made inclusion of stdio.h dependent on HAVE_MKSTEMP's + non-defintion + - Removed definition of ID3_PATH_LENGTH (now in utils.h) + - Removed CreateFile, OpenFileForWriting, OpenFileForReading, and + CloseFile definitions (redefined in utils.cpp) + (Link): Removed handling of __file_handle, push all file + manipulation into ParseFile + (RenderV1ToFile): Now manipulates an fstream rather than a FILE* + (RenderV2ToFile): Now manipulates an fstream rather than a FILE* + (Update): Now manipulates an fstream rather than a FILE* + (Strip): Now manipulates an fstream rather than a FILE* + +2000-07-11 Tuesday 06:14 eldamitri + + * src/tag.cpp (1.24): + - Added inclusion of utils.h + - Removed definition of ID3_PATH_LENGTH (now in utils.h) + - Removed all mention of __file_handle + - Removed all calls to CloseFile() + +2000-07-11 Tuesday 06:12 eldamitri + + * src/: misc_support.cpp (1.19), tag_render.cpp (1.27): Removed + inclusion of stdio.h + +2000-07-11 Tuesday 06:02 eldamitri + + * include/id3/utils.h (1.8): + - Now includes config.h, since it isn't a distributed file + - Added definition of ID3_PATH_LENGTH + - Added declarations of file utils + +2000-07-11 Tuesday 06:00 eldamitri + + * include/id3/tag.h (1.39): (class ID3_Tag): Removed __file_handle + +2000-07-11 Tuesday 05:59 eldamitri + + * include/id3/Makefile.am (1.8, rel-3-7-13): + (the_headers): removed utils.h + (noinst_HEADERS): added utils.h + +2000-07-08 Saturday 23:26 eldamitri + + * src/tag_render.cpp (1.26): + (RenderV1): Converts ID3v2 COMM frames to ID3v1 comments more + liberally + +2000-07-08 Saturday 23:23 eldamitri + + * examples/test_remove.cpp (1.6, rel-3-7-13): + (main): Now adds an ID3v1 comment + +2000-07-08 Saturday 01:49 eldamitri + + * NEWS (1.21), configure.in (1.41), id3lib.spec.in (1.18) (utags: + rel-3-7-12): Updated for 3.7.12 release + +2000-07-08 Saturday 01:16 eldamitri + + * src/tag_render.cpp (1.25, rel-3-7-12): + (RenderV1): Renders comments in the id3v1 tag with a description of + STR_V1_COMMENT_DESC + +2000-07-08 Saturday 01:14 eldamitri + + * src/tag_file.cpp (1.20, rel-3-7-12): + (RenderV2ToHandle): Removed debugging output + +2000-07-08 Saturday 01:13 eldamitri + + * src/misc_support.cpp (1.18, rel-3-7-12): + (ID3_GetComment): Now a second, optional parameter to find a comment + with a specific description. Default value is NULL, which will find + the next comment in the tag, regardless of its description. + +2000-07-08 Saturday 01:05 eldamitri + + * include/id3/tag.h (1.38, rel-3-7-12): + (STR_V1_COMMENT_DESC): Now has the value "ID3v1 Comment" + (ID3_Tag): Update()'s default parameter changed from ID3TT_ID3V2 to + ID3TT_ALL + +2000-07-08 Saturday 01:03 eldamitri + + * include/id3/misc_support.h (1.20, rel-3-7-12): Added a secondary + optional parameter ID3_GetComment to find a comment with a specific + description. + +2000-07-08 Saturday 01:01 eldamitri + + * examples/test_remove.cpp (1.5, rel-3-7-12): + (main): If a file is given on the command-line, just remove the + description-less comments. + +2000-07-06 Thursday 14:26 eldamitri + + * NEWS (1.20, rel-3-7-11): Other minor updates for 3.7.11 + +2000-07-05 Wednesday 18:36 eldamitri + + * NEWS (1.19), THANKS (1.12, rel-3-7-12, rel-3-7-11), configure.in + (1.40, rel-3-7-0, rel-3-7-11), id3lib.spec.in (1.17, rel-3-7-11): + Updated for 3.7.11 release + +2000-07-05 Wednesday 00:54 eldamitri + + * src/tag_render.cpp (1.24, rel-3-7-11): + (RenderV2): Added + (Render): Now calls either RenderV1 or RenderV2 based on second + parameter + (RenderV1ToHandle): Moved to tag_file.cpp + (RenderV2ToHandle): Moved to tag_file.cpp + +2000-07-05 Wednesday 00:32 eldamitri + + * src/tag_parse_v1.cpp (1.10, rel-3-7-12, rel-3-7-11): + (ParseID3v1): New interface: now a stand-alone function, accepts a + ref to a tag object + +2000-07-05 Wednesday 00:24 eldamitri + + * src/tag_parse_musicmatch.cpp (1.3, rel-3-7-12, rel-3-7-11): + (ParseMusicMatch): New interface: now a stand-alone function, + accepts a ref to a tag object + +2000-07-05 Wednesday 00:21 eldamitri + + * src/tag_parse_lyrics3.cpp (1.18, rel-3-7-12, rel-3-7-11): + (ParseLyrics3): New interface: now a stand-alone function, accepts + a ref to a tag object + (ParseLyrics3v2): New interface: now a stand-alone function, accepts + a ref to a tag object + +2000-07-05 Wednesday 00:18 eldamitri + + * src/tag_parse.cpp (1.22, rel-3-7-12, rel-3-7-11): + (ParseID3v2): Now a standalone function + (ParseFile): Renamed from ParseFromHandle, update for new changes to + interface + +2000-07-05 Wednesday 00:05 eldamitri + + * src/tag_file.cpp (1.19, rel-3-7-11): + (Link): Updated for new changes to interface + (RenderV1ToHandle): Moved from tag_render.cpp, new interface + (RenderV2ToHandle): Moved from tag_render.cpp, new interface + (Update): Now updates __prepended_bytes, __appended_bytes + appropriately + (Strip): Updated for new changes to interface + +2000-07-04 Tuesday 23:54 eldamitri + + * src/tag.cpp (1.23, rel-3-7-12, rel-3-7-11): + (ID3_Tag): Initialize file-related members + (Clear): Don't clear file-related members + (ID3_GetDataSize): Added implementation + +2000-07-04 Tuesday 23:44 eldamitri + + * include/id3/tag.h (1.37, rel-3-7-11): Added ID3_GetDataSize(const + ID3_Tag&) function for calculating the size of the non-tag data in a + tag object (class ID3_Tag): + - RenderV1(uchar*) moved from public to protected + - Added GetPrependedBytes(), GetAppendedBytes(), GetFileSize(), and + GetFileName() + - __prepended_bytes and __appended_bytes renamed from + __starting_bytes and __ending_bytes, respectively + - Render() can now also accept an ID3_TagType as an optional second + parameter + - ParseFromHandle(FILE*) repaced with ParseFile() + - RenderV1ToHandle, RenderV2ToHandle, ParseID3v2, ParseID3v1, + ParseLyrics3*, and ParseMusicmatch methods removed + - RenderV2 protected method added + +2000-07-04 Tuesday 23:27 eldamitri + + * include/id3/globals.h (1.31): + (ID3_V2Spec): Added ID3V2_4_0 + +2000-07-04 Tuesday 04:48 eldamitri + + * id3com/id3com.dsp (1.14), libprj/id3lib.dsp (1.10, rel-3-7-13), + prj/id3lib.dsp (1.11, rel-3-7-13) (utags: rel-3-7-11, rel-3-7-12): + Added tag_parse_musicmatch.cpp + +2000-07-04 Tuesday 04:46 eldamitri + + * examples/test_remove.cpp (1.4, rel-3-7-11): + (main): Tests the ability to remove frames with NULL descriptions. + +2000-07-03 Monday 01:37 eldamitri + + * include/id3.h (1.11), src/c_wrapper.cpp (1.9, rel-3-7-13) (utags: + rel-3-7-11, rel-3-7-12): New function: ID3Tag_HasTagType(const + ID3Tag*, ID3_TagType) + +2000-07-03 Monday 01:03 eldamitri + + * include/id3/globals.h (1.30): Minor whitespace changes + +2000-07-01 Saturday 18:52 eldamitri + + * src/misc_support.cpp (1.17, rel-3-7-11): + (ID3_AddTrack): Fixed bug that wasn't returning the frame added + (thanks Benedikt Roth) + +2000-07-01 Saturday 09:48 eldamitri + + * src/tag_parse_v1.cpp (1.9): + (ParseID3v1): Now returns number of bytes parsed. + +2000-07-01 Saturday 09:48 eldamitri + + * src/tag_parse_musicmatch.cpp (1.2): + (ParseMusicMatch): Now returns number of bytes parsed. + +2000-07-01 Saturday 09:48 eldamitri + + * src/tag_parse_lyrics3.cpp (1.17): + (ParseLyrics3): Now returns number of bytes parsed. No longer + parses Lyrics3 v2.00 tags + (ParseLyrics3v2): Added implementation. + +2000-07-01 Saturday 09:48 eldamitri + + * src/tag_parse.cpp (1.21): + (Parse): __file_tags no longer updated + (ParseID3v2): Added implementation + (ParseFromHandle): Now takes responsibility for setting + __starting_bytes, __ending_bytes, and __file_tags. Now finds all + (known) tag types attached to the file by iteratively looking for a + tag starting where the last known tag was found. + +2000-07-01 Saturday 09:48 eldamitri + + * src/tag_file.cpp (1.18): + (Link): ParseFromHandle no longer returns a value, now accepts a + file handle + (Update): Now record the tags that have been updated in __file_tags + (Strip): If one appended tag type is stripped, they're all stripped. + Same for prepended tags + +2000-07-01 Saturday 09:48 eldamitri + + * include/id3/tag.h (1.36): (class ID3_Tag): New interface for + protected Parse methods + +2000-07-01 Saturday 09:48 eldamitri + + * include/id3/globals.h (1.29): + (ID3_TagTypes): Added LYRICS3, LYRICS3V2, PREPENDED, and APPENDED. + Deprecated LYRICS + +2000-07-01 Saturday 09:47 eldamitri + + * examples/demo_convert.cpp (1.7, rel-3-7-12, rel-3-7-11): + (main): Minor type change + +2000-06-25 Sunday 20:12 eldamitri + + * include/id3/globals.h (1.28): + (NULL_UNICODE): Defined using a #define so it will compile correctly + for C + +2000-06-25 Sunday 19:18 eldamitri + + * examples/: demo_convert.cpp (1.6), demo_info.cpp (1.13, + rel-3-7-12, rel-3-7-11): + (main): Now links against all tags + +2000-06-25 Sunday 08:23 eldamitri + + * src/utils.cpp (1.4, rel-3-7-12, rel-3-7-11): Added ID3_IsCRLF, + ID3_CRLFtoLF, ID3_TimeToSeconds, and RemoveTrailingSpaces to + utils.cpp + +2000-06-25 Sunday 08:22 eldamitri + + * src/tag_parse_v1.cpp (1.8): Moved RemoveTrailingSpaces to + utils.cpp + +2000-06-25 Sunday 08:21 eldamitri + + * src/tag_parse_lyrics3.cpp (1.16): Moved ID3_IsCRLF and + ID3_CRLFtoLF to utils.cpp + +2000-06-25 Sunday 08:21 eldamitri + + * src/tag_parse.cpp (1.20): + (ParseFromHandle): Added conditional call to ParseMusicMatch + +2000-06-25 Sunday 08:20 eldamitri + + * src/tag.cpp (1.22): + (AttachFrame): Now simply returns without error if a NULL frame is + passed in. + +2000-06-25 Sunday 08:19 eldamitri + + * include/id3/utils.h (1.7, rel-3-7-12, rel-3-7-11): Added decl's + for ID3_TimeToSeconds, ID3_IsCRLF, ID3_CRLFtoLF, and + RemoveTrailingSpaces functions. + +2000-06-25 Sunday 08:18 eldamitri + + * include/id3/tag.h (1.35): (class ID3_Tag): Added decl for + ParseMusicMatch + +2000-06-25 Sunday 08:16 eldamitri + + * include/id3/globals.h (1.27): + (ID3_TagType): Added ID3TT_MUSICMATCH + +2000-06-25 Sunday 08:15 eldamitri + + * src/Makefile.am (1.14, rel-3-7-13, rel-3-7-12, rel-3-7-11): + (id3lib_sources): Added tag_parse_musicmatch.cpp + +2000-06-25 Sunday 08:14 eldamitri + + * src/tag_parse_musicmatch.cpp (1.1): Initial revision + +2000-06-24 Saturday 03:11 eldamitri + + * examples/README.txt (1.1, rel-3-7-8, rel-3-7-7, rel-3-7-13, + rel-3-7-12, rel-3-7-11): Initial revision + +2000-06-23 Friday 19:24 adcockj + + * libprj/: .cvsignore (1.3, rel-3-7-13, rel-3-7-12, rel-3-7-11), + id3lib.dsp (1.9), id3lib.dsw (1.5, rel-3-7-13, rel-3-7-12, + rel-3-7-11) (utags: rel-3-7-10): Debug library now ib3libD.lib + +2000-06-23 Friday 19:24 adcockj + + * prj/: .cvsignore (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11), + id3lib.dsp (1.10) (utags: rel-3-7-10): Changed project for changes + to zlib + +2000-06-23 Friday 19:23 adcockj + + * zlib/prj/zlib.dsp (1.5, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10): Changed debug lib to zlibD.lib + +2000-06-23 Friday 19:22 adcockj + + * id3com/: .cvsignore (1.5, rel-3-7-13, rel-3-7-12, rel-3-7-11), + id3com.dsp (1.13), id3com.dsw (1.5, rel-3-7-13, rel-3-7-12, + rel-3-7-11) (utags: rel-3-7-10): Updated project files for zlib + +2000-06-23 Friday 18:58 eldamitri + + * NEWS (1.18, rel-3-7-8, rel-3-7-10): Updated with new changes for + 3.7.10. + +2000-06-23 Friday 18:34 eldamitri + + * examples/test_remove.cpp (1.3, rel-3-7-10): + (main): Now removes all frames to test rendering a frame-less tag. + +2000-06-23 Friday 18:33 eldamitri + + * src/tag_render.cpp (1.23, rel-3-7-10): + (RenderV2ToHandle): If the size of the v2 tag is 0, or there is + nothing to Render, then it now behaves just like Strip(ID3TT_ID3V2) + +2000-06-23 Friday 17:52 eldamitri + + * examples/Makefile.am (1.12, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-12, rel-3-7-11, rel-3-7-10): + (check_PROGRAMS): Added 'findstr' + +2000-06-23 Friday 17:52 eldamitri + + * examples/findstr.cpp (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10): Initial revision. + +2000-06-23 Friday 17:51 eldamitri + + * src/tag_parse_lyrics3.cpp (1.15, rel-3-7-10): + (ParseLyrics3): Fixed seek value calculation which was giving + warnings when compiling under windows. + +2000-06-23 Friday 17:49 eldamitri + + * src/tag_find.cpp (1.14, rel-3-7-12, rel-3-7-11, rel-3-7-10): + (Find): Fixed bug which prevented empty strings from being found. + +2000-06-23 Friday 07:05 eldamitri + + * examples/230-syncedlyrics.tag (1.2, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10): Updated based on new conversion rules for + lyrics3 v2.00 + +2000-06-23 Friday 06:22 eldamitri + + * NEWS (1.17), THANKS (1.11, rel-3-7-10), configure.in (1.39, + rel-3-7-10), id3lib.spec.in (1.16, rel-3-7-10): Updated for 3.7.10 + release + +2000-06-23 Friday 06:00 eldamitri + + * examples/Makefile.am (1.11): Added id3cp and testremove + +2000-06-23 Friday 05:55 eldamitri + + * src/tag_file.cpp (1.17, rel-3-7-10): + (Link): Reinitializes all file-related member variables when a new + file is linked to. + +2000-06-23 Friday 05:53 eldamitri + + * examples/: demo_copy.cpp (1.1), ozzy.tag (1.1, rel-3-7-13), + thatspot.tag (1.1, rel-3-7-13, rel-3-7-13) (utags: rel-3-7-10, + rel-3-7-11, rel-3-7-12): Initial revision. + +2000-06-23 Friday 04:50 eldamitri + + * Makefile.am (1.21, rel-3-7-12, rel-3-7-11, rel-3-7-10): + (release): Converts dsw and dsp files to dos format for windows + release + +2000-06-23 Friday 02:43 eldamitri + + * examples/230-unicode.tag (1.4, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10): The BOMs were incorrect. Now they're + correct. + +2000-06-23 Friday 02:37 eldamitri + + * src/field_string_unicode.cpp (1.17, rel-3-7-12, rel-3-7-11, + rel-3-7-10): + (ParseUnicodeString): Updated with definitive comment on the role + and value of the BOM. Fixed bug that was swapping byte-order when + it shouldn't, and not swapping when it should. + (RenderUnicodeString): Renders the BOM correctly now. + +2000-06-23 Friday 02:33 eldamitri + + * examples/: test_compression.cpp (1.4, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10), test_pic.cpp (1.5, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10), test_remove.cpp (1.2), test_unicode.cpp + (1.3, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10): + (main): Remove the call to Update() - it's unnecessary. + +2000-06-23 Friday 01:22 eldamitri + + * src/tag_parse_lyrics3.cpp (1.14): + (ParseLyrics3): + - Makes use of newly defined AddLyrics and AddSyncLyrics functions + in misc_support + - INF field converts to COMM frame, not as the description field for + SYLT + +2000-06-23 Friday 01:19 eldamitri + + * src/misc_support.cpp (1.16, rel-3-7-10): + (ID3_GetString): Catch block now catches an ID3_Error instead of an + ID3_Err + (ID3_AddComment): Added several new implementations, varying based + on their parameters. Description now defaults to "", language + defaults to "XXX" (for unknown) + (ID3_AddLyrics): Added several new implementations, varying based on + their parameters. Description now defaults to "", language defaults + to "XXX" (for unknown) + (ID3_AddSyncLyrics): Added several new implementations, varying on + their parameters. Description now defaults to "", language defaults + to "XXX" (for unknown), content type defaults to LYRICS. Base + function's parameters reordered to be consistent with other + functions. + +2000-06-23 Friday 01:05 eldamitri + + * include/id3/misc_support.h (1.19, rel-3-7-11, rel-3-7-10): Added + new declarations for ID3_AddComment, ID3_AddLyrics, and + ID3_AddSyncLyrics + +2000-06-22 Thursday 23:21 eldamitri + + * examples/: 230-syncedlyrics.tag (1.1), example.lyr (1.1, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10): Initial revision + +2000-06-22 Thursday 23:11 eldamitri + + * src/error.cpp (1.8, rel-3-7-12, rel-3-7-11, rel-3-7-10): + (ID3_Error): Use strdup rather than strlen + new + strncpy + (~ID3_Error): Use array delete to free memory + +2000-06-22 Thursday 23:02 eldamitri + + * include/id3/error.h (1.13, rel-3-7-8, rel-3-7-12, rel-3-7-11, + rel-3-7-10): (class ID3_Error): + - All methods return char strings now return const char strings + - Added default constructor + +2000-06-22 Thursday 22:20 eldamitri + + * src/tag_parse_lyrics3.cpp (1.13): + (ID3_IsCRLF): Added + (ID3_IsTimeStamp): Added + (ID3_CRLFtoLF): Now uses ID3_IsCRLF + (ID3_StripTimeStamps): Now uses ID3_IsTimeStamp + (ID3_Lyrics3ToSylt): New implementation using ID3_IsTimeStamp + (ParseLyrics3): Massive clean-up of implementation + +2000-06-22 Thursday 22:16 eldamitri + + * src/misc_support.cpp (1.15): + (ID3_AddSyncLyrics): Added initialization of time stamp format. + +2000-06-22 Thursday 22:11 eldamitri + + * src/frame.cpp (1.22, rel-3-7-12, rel-3-7-11, rel-3-7-10): + (ID3_Frame): Initialize spec in construcotr. + +2000-06-22 Thursday 22:09 eldamitri + + * include/id3/header.h (1.14, rel-3-7-12, rel-3-7-11, rel-3-7-10): + (class ID3_Header): Initialized spec in constructor. + +2000-06-22 Thursday 21:31 adcockj + + * src/error.cpp (1.7), src/uint28.cpp (1.5, rel-3-7-12, rel-3-7-11, + rel-3-7-10), include/id3/error.h (1.12), include/id3/uint28.h (1.5, + rel-3-7-12, rel-3-7-11, rel-3-7-10): Fixed ID3_Error memory Leak + and windows compiler incompatibilty with uint28 + +2000-06-21 Wednesday 05:30 eldamitri + + * examples/test_remove.cpp (1.1): Initial revision. + +2000-06-21 Wednesday 05:27 eldamitri + + * src/tag.cpp (1.21, rel-3-7-10): + (RemoveFrame): Now marks tag as being changed when a frame is + removed, which was preventing tags from being updated correctly + +2000-06-20 Tuesday 18:06 eldamitri + + * src/misc_support.cpp (1.14): Cleaned up memory leaks from + removing frames + +2000-06-14 Wednesday 18:43 eldamitri + + * src/uint28.cpp (1.4): + - Added new documentation + - Made constructors 'explicit' + - Defined new class constants BITSUSED, MINVAL, and MAXVAL + - New implementation for default constructor + - Destructor is now virtual + - Assigning a uint32 that is greater than the largest possible value + maximizes the internal value, rather than masking it + - Implementation of operator=(const char*) moved to Parse(const char + *) + - Render now returns number of characters rendered + - Removed unnecessary inclusion of string.h + - Cleaned up implementation of Parse(), Render(), operator<<, and + operator>> + +2000-06-14 Wednesday 18:41 eldamitri + + * src/header_frame.cpp (1.10, rel-3-7-12, rel-3-7-11, rel-3-7-10): + (SetUnknownFrame): Minor bugfixes in copying frame text id and + description + +2000-06-14 Wednesday 18:39 eldamitri + + * src/frame_parse.cpp (1.16, rel-3-7-12, rel-3-7-11, rel-3-7-10): + * src/frame.cpp: Minor updates + +2000-06-14 Wednesday 18:38 eldamitri + + * src/frame.cpp (1.21): Minor updates + +2000-06-14 Wednesday 18:37 eldamitri + + * src/field.cpp (1.25, rel-3-7-11, rel-3-7-12, rel-3-7-11, + rel-3-7-10): + (ID3FD_Unimplemented): Added { ID3FN_NOFIELD } entry to mark the end + (ID3_FindFrameDef): Removed const qualifer from parameter + +2000-06-14 Wednesday 18:24 eldamitri + + * include/id3/uint28.h (1.4): (class uint28): + - Added new documentation + - Made constructors 'explicit' + - Defined new class constants BITSUSED, MINVAL, and MAXVAL + - New implementation for default constructor + - Destructor is now virtual + - Assigning a uint32 that is greater than the largest possible value + maximizes the internal value, rather than masking it + - Implementation of operator=(const char*) moved to Parse(const char + *) + - Render now returns number of characters rendered + +2000-06-14 Wednesday 18:14 eldamitri + + * include/id3/frame.h (1.28, rel-3-7-12, rel-3-7-11, rel-3-7-10): + (class ID3_Frame): Added decl and def for GetTextID() + +2000-06-14 Wednesday 18:13 eldamitri + + * include/id3/field.h (1.30, rel-3-7-12, rel-3-7-11, rel-3-7-10): + Made FieldDef pointer const in FrameDef struct, and removed const + from FindFrameDef param + +2000-06-14 Wednesday 18:11 eldamitri + + * examples/demo_info.cpp (1.12, rel-3-7-10): + (PrintInformation): Changed output to disply 4-char id and + description in parentheses. + +2000-06-10 Saturday 18:11 adcockj + + * id3com/Sample/.cvsignore (1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10): Initial Version + +2000-06-10 Saturday 18:09 adcockj + + * .cvsignore (1.12), config.win32 (1.5, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10), id3com/.cvsignore (1.4), id3com/ID3Tag.cpp + (1.9, rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/ID3Tag.h (1.7, + rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/id3com.dsp (1.12), + id3com/id3com.idl (1.9, rel-3-7-12, rel-3-7-11, rel-3-7-10), + id3com/Sample/ID3Test.vbp (1.5, rel-3-7-12, rel-3-7-11, + rel-3-7-10), id3com/Sample/ID3Test.vbw (1.6, rel-3-7-12, + rel-3-7-11, rel-3-7-10), id3com/Sample/frmID3Test.frm (1.6, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10), src/c_wrapper.cpp + (1.8, rel-3-7-10), src/tag_parse.cpp (1.19, rel-3-7-10), + src/tag_parse_lyrics3.cpp (1.12), src/tag_render.cpp (1.22), + zlib/.cvsignore (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10), zlib/prj/.cvsignore (1.4, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10): Fixed Problem with HasV2Tag added + VersionString to id3com + +2000-06-08 Thursday 09:01 adcockj + + * delphi/ID3COM_TLB.pas (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10), delphi/Unit1.pas (1.2, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10), delphi/id3com.cfg (1.2, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10), delphi/id3com.dof (1.2, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10), delphi/id3com.dpr + (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10), + delphi/readme.txt (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10), id3com/EnumFields.cpp (1.5, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10), id3com/EnumFields.h (1.5, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/ID3COM.def (1.4, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/ID3COM.rc + (1.4, rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/ID3COMps.def + (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10), + id3com/ID3COMps.mk (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10), id3com/ID3Field.cpp (1.5, rel-3-7-12, rel-3-7-11, + rel-3-7-10), id3com/ID3Field.h (1.7, rel-3-7-12, rel-3-7-11, + rel-3-7-10), id3com/ID3Field.rgs (1.5, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10), id3com/ID3Frame.cpp (1.8, rel-3-7-12, + rel-3-7-11, rel-3-7-10), id3com/ID3Frame.h (1.7, rel-3-7-12, + rel-3-7-11, rel-3-7-10), id3com/ID3Frame.rgs (1.5, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/ID3Tag.cpp (1.8), + id3com/ID3Tag.h (1.6), id3com/ID3Tag.rgs (1.5, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/Makefile.am (1.5, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/StdAfx.cpp + (1.5, rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/StdAfx.h (1.5, + rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/dlldata.c (1.4, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10), + id3com/frmID3Test.frm (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10), id3com/id3com.cpp (1.6, rel-3-7-12, rel-3-7-11, + rel-3-7-10), id3com/id3com.dsp (1.11), id3com/id3com.dsw (1.4), + id3com/id3com.idl (1.8), id3com/mssccprj.scc (1.4, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/resource.h (1.4, + rel-3-7-12, rel-3-7-11, rel-3-7-10), id3com/Sample/ID3Test.vbp + (1.4), id3com/Sample/ID3Test.vbw (1.5), id3com/Sample/MSSCCPRJ.SCC + (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10), + id3com/Sample/frmID3Test.frm (1.5), libprj/id3lib.dsp (1.8), + libprj/id3lib.dsw (1.4), prj/id3lib.dsp (1.9, rel-3-7-13), + prj/id3lib.dsw (1.5, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10), prj/id3lib.mak (1.5, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10), zlib/prj/zlib.dsp (1.4), zlib/prj/zlib.dsw + (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10), + zlib/prj/zlib.mak (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10): Hopefully got rid of DOS/Unix file compatability All + text files orginally from DOS/windows have been changed to try and + remove extra cr + +2000-06-06 Tuesday 16:21 eldamitri + + * id3com/EnumFields.cpp (1.4), id3com/EnumFields.h (1.4), + id3com/ID3COM.def (1.3), id3com/ID3COM.rc (1.3), + id3com/ID3COMps.def (1.3), id3com/ID3COMps.mk (1.3), + id3com/ID3Field.cpp (1.4), id3com/ID3Field.h (1.6), + id3com/ID3Field.rgs (1.4), id3com/ID3Frame.cpp (1.7), + id3com/ID3Frame.h (1.6), id3com/ID3Frame.rgs (1.4), + id3com/ID3Tag.cpp (1.7), id3com/ID3Tag.h (1.5), id3com/ID3Tag.rgs + (1.4), id3com/Makefile.am (1.4), id3com/StdAfx.cpp (1.4), + id3com/StdAfx.h (1.4), id3com/dlldata.c (1.3), + id3com/frmID3Test.frm (1.3), id3com/id3com.cpp (1.5), + id3com/id3com.dsp (1.10), id3com/id3com.dsw (1.3), + id3com/id3com.idl (1.7), id3com/mssccprj.scc (1.3), + id3com/resource.h (1.3), id3com/Sample/ID3Test.vbp (1.3), + id3com/Sample/ID3Test.vbw (1.4), id3com/Sample/MSSCCPRJ.SCC (1.3), + id3com/Sample/frmID3Test.frm (1.4), libprj/Makefile.am (1.2, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10), libprj/id3lib.dsp (1.7), libprj/id3lib.dsw + (1.3), prj/Makefile.am (1.2, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10): Somehow they lost their + dos-ness. Converted back to DOS newlines. + +2000-06-06 Tuesday 14:23 eldamitri + + * src/tag.cpp (1.20): Minor updates to documentation + +2000-06-06 Tuesday 14:22 eldamitri + + * src/frame_render.cpp (1.12, rel-3-7-12, rel-3-7-11, rel-3-7-10): + (Render): Now returns 0 and renders nothing if either there aren't + any fields or rendering the fields results in nothing rendered + +2000-06-06 Tuesday 14:22 eldamitri + + * src/frame.cpp (1.20): + - Moved documentation from header file + - Minor code changes + - GetID() implementation moved to header file + - _FindField implementation removed + - Field implementation updated with code from _FindField + +2000-06-06 Tuesday 14:22 eldamitri + + * src/field_string_unicode.cpp (1.16): + - Moved documentation from header file + - operator=(const unicode_t*) implementation moved to header file + +2000-06-06 Tuesday 14:22 eldamitri + + * src/field_string_ascii.cpp (1.13, rel-3-7-12, rel-3-7-11, + rel-3-7-10): + - Moved documentation from header file + - operator=(const char*) implementation moved to header file + - Minor code changes + +2000-06-06 Tuesday 14:22 eldamitri + + * src/field_integer.cpp (1.9, rel-3-7-12, rel-3-7-11, rel-3-7-10): + - Moved documentation from header file + - operator=(uint32) and Get() implementations moved to header file + +2000-06-06 Tuesday 14:22 eldamitri + + * src/field_binary.cpp (1.11, rel-3-7-12, rel-3-7-11, rel-3-7-10): + - Moved documentation from header file + - Minor code changes + +2000-06-06 Tuesday 14:22 eldamitri + + * src/field.cpp (1.24): + - Moved documentation from header file + - Size() implementation moved to header file + +2000-06-06 Tuesday 14:22 eldamitri + + * include/id3/tag.h (1.34, rel-3-7-10): Minor whitespace changes + +2000-06-06 Tuesday 14:21 eldamitri + + * include/id3/frame.h (1.27): (class ID3_Frame): + - Moved most documentation to cpp files + - GetID() definition now inlined in the class + - _FindField() removed + +2000-06-06 Tuesday 14:21 eldamitri + + * include/id3/field.h (1.29): (class ID3_Field): + - Moved most documentation to cpp files + - ID3_Tag is no longer a friend + - Size, Get(uint32), and operator= definitions now inlined in the + class + +2000-06-06 Tuesday 04:04 eldamitri + + * config.h.win32.in (1.5, rel-3-7-12, rel-3-7-11, rel-3-7-10): + Apparently VC++ 6.0 has buggy for loops + +2000-06-05 Monday 21:14 adcockj + + * id3com/.cvsignore (1.3): Added some extra files to .cvsignore in + id3com + +2000-06-04 Sunday 17:13 adcockj + + * id3com/EnumFields.cpp (1.3), id3com/EnumFields.h (1.3), + id3com/ID3COM.def (1.2), id3com/ID3COM.rc (1.2), + id3com/ID3COMps.def (1.2), id3com/ID3COMps.mk (1.2), + id3com/ID3Field.cpp (1.3), id3com/ID3Field.h (1.5), + id3com/ID3Field.rgs (1.3), id3com/ID3Frame.cpp (1.6), + id3com/ID3Frame.h (1.5), id3com/ID3Frame.rgs (1.3), + id3com/ID3Tag.cpp (1.6), id3com/ID3Tag.h (1.4), id3com/ID3Tag.rgs + (1.3), id3com/StdAfx.cpp (1.3), id3com/StdAfx.h (1.3), + id3com/dlldata.c (1.2), id3com/frmID3Test.frm (1.2), + id3com/id3com.cpp (1.4), id3com/id3com.dsp (1.9), id3com/id3com.dsw + (1.2), id3com/id3com.idl (1.6), id3com/mssccprj.scc (1.2), + id3com/resource.h (1.2), id3com/Sample/ID3Test.vbp (1.2), + id3com/Sample/ID3Test.vbw (1.3), id3com/Sample/MSSCCPRJ.SCC (1.2), + id3com/Sample/frmID3Test.frm (1.3), libprj/id3lib.dsp (1.6), + libprj/id3lib.dsw (1.2): Removed extra cr at the end of all lines + in windows code caused by checking in windows code from linux + +2000-05-29 Monday 18:06 eldamitri + + * examples/findeng.cpp (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10): Initial revision + +2000-05-29 Monday 18:04 eldamitri + + * examples/Makefile.am (1.10): + (check_PROGRAMS): Added findeng + +2000-05-29 Monday 18:03 eldamitri + + * id3lib.spec.in (1.15): Fixed the date format, even though my way + is better... + +2000-05-29 Monday 18:00 eldamitri + + * config.h.win32.in (1.4, rel-3-7-12): Apparently VC++ 6.0 has + buggy for loops + +2000-05-29 Monday 17:59 eldamitri + + * src/frame.cpp (1.19): + (_ClearFields): Minor fix to for loop variable to allow compilation + in compilers with buggy for loops + +2000-05-29 Monday 17:58 eldamitri + + * src/tag_find.cpp (1.13): + (Find): Fix for finding strings w/o their own null terminator + +2000-05-29 Monday 08:57 eldamitri + + * NEWS (1.16, rel-3-7-7, rel-3-7-9): Further updates for 3.7.9 + release (hopefully this is it!) + +2000-05-29 Monday 08:55 eldamitri + + * zlib/src/Makefile.am (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9): Updated to compile cleanly on a + + (Unix-like) system that needs it + +2000-05-29 Monday 08:54 eldamitri + + * src/tag_file.cpp (1.16, rel-3-7-9): Moved inclusion of "tag.h" to + after other includes to compile correctly on Solaris (hack!) + +2000-05-29 Monday 08:53 eldamitri + + * src/field_string_unicode.cpp (1.15, rel-3-7-9): + (RenderUnicodeString): Minor updates (needs major updates to compile + and work on all platforms!) + +2000-05-29 Monday 08:52 eldamitri + + * src/Makefile.am (1.13, rel-3-7-10, rel-3-7-9): + (LDADD): Now conditionally includes distributions zlib if not + already in environment + +2000-05-29 Monday 08:51 eldamitri + + * include/id3/globals.h (1.25, rel-3-7-9): So it will compile on + Solaris, changed index_t typedef into #define + +2000-05-29 Monday 08:49 eldamitri + + * examples/: test_compression.cpp (1.3), test_pic.cpp (1.4), + test_unicode.cpp (1.2) (utags: rel-3-7-9): Removed inclusion of + unnecessary header files + +2000-05-29 Monday 08:47 eldamitri + + * configure.in (1.38, rel-3-7-9): Changed AC_SIZE_T to + AC_TYPE_SIZE_T + +2000-05-29 Monday 04:52 eldamitri + + * examples/get_pic.cpp (1.2, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9): + (main): Removed debugging output, added better regular output + +2000-05-29 Monday 04:48 eldamitri + + * src/field.cpp (1.23, rel-3-7-9): + (BinSize): Minor bugfix for rendering non-unicode textstrings + +2000-05-29 Monday 04:44 eldamitri + + * examples/test_compression.cpp (1.2): + (main): Removed debugging output + +2000-05-29 Monday 04:23 eldamitri + + * examples/: 230-compressed.tag (1.3, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10), 230-picture.tag (1.3, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10), 230-unicode.tag (1.3) (utags: rel-3-7-9): + Removed the experimental flag from the tag headers and the file + alter preservation flag from the frame headers + +2000-05-29 Monday 04:20 eldamitri + + * examples/Makefile.am (1.8): + (check_PROGRAMS): Added testunicode and testcompression + +2000-05-29 Monday 04:19 eldamitri + + * examples/: demo_convert.cpp (1.5, rel-3-7-10), demo_info.cpp + (1.11), demo_tag.cpp (1.6, rel-3-7-12, rel-3-7-11, rel-3-7-10) + (utags: rel-3-7-9): argc is now unsigned to prevent compiler + warning + +2000-05-29 Monday 04:18 eldamitri + + * examples/: test_compression.cpp (1.1), test_unicode.cpp (1.1): + Initial revision + +2000-05-29 Monday 04:13 eldamitri + + * include/id3/frame.h (1.26, rel-3-7-9): (class ID3_Frame): Removed + _UpdateStringTypes decl + +2000-05-29 Monday 04:11 eldamitri + + * src/frame.cpp (1.18, rel-3-7-9): Removed _UpdateStringTypes + implementation (no longer needed) + (Size): Updated to not use _UpdateStringTypes (operator=): Fixed to + now extract complete info from copied frame + +2000-05-29 Monday 04:01 eldamitri + + * src/field_string_unicode.cpp (1.14): + (RenderUnicodeString): Changed the byte order for rendering the BOM + (this is unlikely to be the right solution, though---the unicode + support needs to be much better than this!) + +2000-05-29 Monday 04:00 eldamitri + + * src/field.cpp (1.22): + (BinSize): Fixed bug that was reporting the wrong binary size for + unicode strings + +2000-05-29 Monday 03:57 eldamitri + + * include/id3/header_frame.h (1.13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9): (class ID3_FrameHeader): Minor code + reformatting + +2000-05-29 Monday 01:26 eldamitri + + * src/tag_sync.cpp (1.6, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9): + (ID3_ReSync): Fixed a bug in ReSync'ing that caused it to improperly + handle the last character + (ID3_ShouldUnsync): Fixed a bug with recognizing sync signals + +2000-05-29 Monday 01:25 eldamitri + + * src/tag_render.cpp (1.21, rel-3-7-9): + (Render): Now returns 0 with NULL buffer rather than throw, + +2000-05-29 Monday 01:08 eldamitri + + * src/tag_parse.cpp (1.18, rel-3-7-9): + (Parse): No longer saves the return value of ParseFrames to prevent + compiler warnings + +2000-05-29 Monday 01:07 eldamitri + + * src/tag.cpp (1.19, rel-3-7-9): + (ID3_Tag): Reorganized member variable initialization to avoid + compiler warnings + +2000-05-29 Monday 01:03 eldamitri + + * src/misc_support.cpp (1.13, rel-3-7-9): + (ID3_AddTrack): Changed size_t's to luints to prevent comiler + warnings + (ID3_AddGenre): Changed size_t's to luints to prevent comiler + warnings + +2000-05-29 Monday 00:56 eldamitri + + * src/frame.cpp (1.17): + (ID3_Frame): Reorganized member variable initialization to avoid + compiler warnings + +2000-05-29 Monday 00:55 eldamitri + + * src/field_string_unicode.cpp (1.13): + (ParseUnicodeString): Removed unnecessary cast + +2000-05-29 Monday 00:54 eldamitri + + * src/field.cpp (1.21): + (ID3_Field): Reorganized member variable initialization to avoid + compiler warnings (operator=): Added default clause to prevent + compiler warning + +2000-05-29 Monday 00:08 eldamitri + + * include/id3/tag.h (1.33, rel-3-7-9): Added GetUnsync() + +2000-05-29 Monday 00:07 eldamitri + + * examples/test_pic.cpp (1.3): + (main): Now includes actual picture data, unsyncs tag + +2000-05-29 Monday 00:03 eldamitri + + * examples/get_pic.cpp (1.1): Initial revision. + +2000-05-28 Sunday 23:59 eldamitri + + * examples/composer.jpg (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9): Added. Initial revision. + +2000-05-28 Sunday 23:57 eldamitri + + * examples/Makefile.am (1.7, rel-3-7-9): + (check_PROGRAMS): Added get_pic + +2000-05-28 Sunday 07:07 eldamitri + + * src/tag_render.cpp (1.20): + (RenderFrames): Added so that frames are rendered in correct order + (Render): Doesn't render if there aren't any frames, makes use of + new RenderFrames function + (Size): Size is 0 if there aren't any frames + +2000-05-28 Sunday 07:02 eldamitri + + * src/header_tag.cpp (1.12, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9): + (Render): Now always renders the latest version of the spec + +2000-05-28 Sunday 07:00 eldamitri + + * examples/test_pic.cpp (1.2): + (main): uncommented the frame additions + +2000-05-28 Sunday 05:51 eldamitri + + * examples/test_pic.cpp (1.1): Added. + +2000-05-28 Sunday 05:49 eldamitri + + * examples/Makefile.am (1.6): + (check_PROGRAMS): Added testpic + +2000-05-28 Sunday 05:48 eldamitri + + * src/tag_find.cpp (1.12, rel-3-7-9): + (Find): Changed luint to size_t + +2000-05-28 Sunday 05:47 eldamitri + + * src/tag_file.cpp (1.15): + (Link): If Linking to a tag that's already Linked, simply close the + current file and link to the new one + (Strip): Only Strips id3v2 if __starting_bytes > 0 + +2000-05-28 Sunday 05:44 eldamitri + + * src/tag.cpp (1.18): + (Clear): No longer removes file name. + +2000-05-28 Sunday 05:43 eldamitri + + * src/frame_render.cpp (1.11, rel-3-7-9): + (Render): Removed dangling semicolon, fixed call to Render + +2000-05-28 Sunday 05:42 eldamitri + + * src/frame.cpp (1.16): + (_ClearFields): Clears bitset field rather than deleting it. + +2000-05-28 Sunday 05:40 eldamitri + + * src/: field_binary.cpp (1.10, rel-3-7-9), field_string_ascii.cpp + (1.12, rel-3-7-9), field_string_unicode.cpp (1.12): All Get() + methods now const + +2000-05-28 Sunday 05:39 eldamitri + + * include/id3/field.h (1.28, rel-3-7-9): (class ID3_Field): All + Get() methods now const + +2000-05-28 Sunday 05:30 eldamitri + + * include/id3.h (1.10, rel-3-7-10), src/c_wrapper.cpp (1.7) (utags: + rel-3-7-9): + - ID3Tag_RemoveFrame returns a pointer to the frame removed + - ID3Tag_UpdateByTagType's 2nd parameter is no longer const + - luint was replaced with size_t, index_t, flags_t, or uint32 + - The following functions were updated with const parameters: + ID3Tag_HasChanged, ID3Tag_AddFrame, ID3Tag_AddFrames, + ID3_RemoveFrame, ID3Tag_Parse, ID3Tag_Link, ID3Tag_Strip, + ID3Tag_Find*, ID3Tag_GetFrameNum, ID3Frame_GetID, ID3Frame_GetField, + ID3Frame_GetCompression, ID3Field_Size, ID3Field_GetNumTextItems, + ID3Field_SetINT, ID3Field_*UNICODE, ID3Field_*ASCII, ID3Field_*File + +2000-05-28 Sunday 05:17 eldamitri + + * id3com/: ID3Field.h (1.4), ID3Tag.cpp (1.5), id3com.cpp (1.3), + id3com.idl (1.5) (utags: rel-3-7-9): Bugfixes (thanks John Adcock) + +2000-05-24 Wednesday 05:03 eldamitri + + * NEWS (1.15), THANKS (1.10, rel-3-7-9), configure.in (1.37, + rel-3-7-13, rel-3-7-12), id3lib.spec.in (1.14, rel-3-7-9): Updated + for 3.7.9 release + +2000-05-24 Wednesday 05:02 eldamitri + + * Makefile.am (1.20, rel-3-7-9): + (docs-release): Adds NEWS(.txt) and ChangeLog(.txt) to the docs + release + +2000-05-23 Tuesday 17:45 eldamitri + + * examples/demo_tag.cpp (1.5): + (main): Minor structural changes + +2000-05-23 Tuesday 17:42 eldamitri + + * Makefile.am (1.19): + (release): win build now copies over delphi directory + +2000-05-23 Tuesday 17:41 eldamitri + + * include/id3/frame.h (1.25): (class ID3_Frame): Render is now + const (again). Added comments to SetCompression() and + GetCompression() to indicate their limitations. Added protected + methods for getting and setting the grouping and encryption id's. + __encryption_id and __grouping_id are now just single chars, rather + than actual buffers. + +2000-05-23 Tuesday 17:30 eldamitri + + * include/id3/globals.h (1.24): Made inclusion of iostream.h + dependant on a c++ compiler + +2000-05-23 Tuesday 17:29 eldamitri + + * include/id3/header_frame.h (1.12): (class ID3_FrameHeader): + Removed methods GetExtrasSize(), SetExpandedSize(), GetExpandedSize, + SetEncryptionID(), GetEncryptionID(), SetGroupingID, + GetGroupingID(), since it was determined that these issues lie + outside the domain of the frame header. + +2000-05-23 Tuesday 17:27 eldamitri + + * src/frame.cpp (1.15): Updated to reflect changes in + __encryption_id and __grouping_id from char buffs to chars. + +2000-05-23 Tuesday 17:26 eldamitri + + * src/frame_parse.cpp (1.15, rel-3-7-9): + (Parse): Added parsing of "extra" information from frame header to + here so that the domain of the frame and frame header are more + clearly (and cleanly) defined. + +2000-05-23 Tuesday 17:24 eldamitri + + * src/frame_render.cpp (1.10): + (Render): Rewritten to make its operation easier to understand and + to make it a const method. Also added extensive comments to explain + reason for its somewhat convoluted implementation. + +2000-05-23 Tuesday 17:22 eldamitri + + * src/header_frame.cpp (1.9, rel-3-7-9): + (Parse): Now only responsible for parsing header proper, and not any + "extra" info in the data that is a result of the various flags being + set (encryiption id, grouping id, and decompressed frame size). + +2000-05-23 Tuesday 17:20 eldamitri + + * src/tag_file.cpp (1.14): + (Update): Added call to CloseFile so that the file isn't left open + when Update exits. + +2000-05-23 Tuesday 17:19 eldamitri + + * src/tag_render.cpp (1.19): + (RenderV1ToHandle): Put in a throw in wehn file handle is null. + (RenderV2ToHandle): Added a call to reopen new file for writing + after writing out v2 under linux so that the file handle isn't null + after leaving this function. + +2000-05-22 Monday 21:21 eldamitri + + * delphi/: ID3COM_TLB.dcu (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10), ID3COM_TLB.pas (1.1), Unit1.dcu (1.1, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10), Unit1.dfm (1.1, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10), Unit1.pas (1.1), id3com.cfg + (1.1), id3com.dof (1.1), id3com.dpr (1.1), id3com.res (1.1, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10), readme.txt (1.1) + (utags: rel-3-7-9): Added. Provided by Michael Little . + +2000-05-22 Monday 21:02 eldamitri + + * src/frame_parse.cpp (1.14): + (Parse): Fixed bug that wasn't dealing with compressed frames + correctly + +2000-05-22 Monday 20:58 eldamitri + + * src/header_frame.cpp (1.8): + (SetUnknownFrame): Minor change to return if allocation fails + +2000-05-15 Monday 18:38 eldamitri + + * src/misc_support.cpp (1.12): Replaced all frame->SetID() calls + with constructor calls that pass in the appropriate ID. + +2000-05-12 Friday 23:15 eldamitri + + * include/id3/field.h (1.27): + - Updated luint parameter, return type with more descriptive type + name (either size_t, index_t, or flags_t) + - (struct ID3_FrameDef): Removed lPriority and parseHandler fields + +2000-05-12 Friday 23:12 eldamitri + + * include/id3/tag.h (1.32, rel-3-7-12, rel-3-7-11): + - CreateFile now returns an ID3_Err + - ID3_IsTagHeader now returns an int32 + +2000-05-12 Friday 23:09 eldamitri + + * src/field.cpp (1.20): + - Removed priorities and parse handler func pointers from frame def + entries + - Updated luint parameter, return type with more descriptive type + name (either size_t, index_t, or flags_t) + +2000-05-12 Friday 23:09 eldamitri + + * src/frame_render.cpp (1.9): + (Render): + - Updated luint parameter, return type with more descriptive type + name (either size_t, index_t, or flags_t) + - No longer calls UpdateStringTypes, instead iterates through the + fields, setting the encoding for each depending on the value of the + ENCODING field. + +2000-05-12 Friday 23:09 eldamitri + + * src/header_frame.cpp (1.7): + (SetUnknownFrame): parseHandler no longer a member of FrameDef + (operator=): parseHandler no longer a member of FrameDef + +2000-05-12 Friday 23:09 eldamitri + + * src/: header_tag.cpp (1.11), header.cpp (1.8, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9): + (SetSpec): Parameter no longer const + +2000-05-12 Friday 23:08 eldamitri + + * src/tag.cpp (1.17): + (ID3_IsTagHeader): Return an int32 rather than an lsint + (Clear): Now sets the header's spec to the latest version + +2000-05-12 Friday 23:08 eldamitri + + * src/tag_file.cpp (1.13): + (exists): Returns 'false' rather than throwing + (CreateFile): Returns the error encountered rather than throwing + (OpenFileForWriting): Returns the error rather than throwing. + (OpenFileForReading): Returns the error rather than throwing. + (Link): Return 0 rather than throwing + (Update): Creates a file if opening it for writing files, now + renders a v2 tag before rendering a v1 tag + +2000-05-12 Friday 23:08 eldamitri + + * src/tag_parse.cpp (1.17): + (Parse): removed call to Clear(), since we might want to parse more + information into an already-full tag + (ParseFromHandle): Return with a 0 rather than throw if there's an + error either seeking or reading the file + +2000-05-12 Friday 23:07 eldamitri + + * src/tag_parse_v1.cpp (1.7, rel-3-7-10, rel-3-7-9): + (ParseID3v1): Exit from the function, rather than throw, if it isn't + possible to seek to 128 bytes from the end of the file (i.e., empty + files) + +2000-05-12 Friday 23:07 eldamitri + + * src/tag_render.cpp (1.18): + (RenderV1ToHandle): If file size is less than the length of an id3v1 + tag, don't even bother looking for one, but rather append the tag at + the end. This allows writing tags to empty files. + +2000-05-12 Friday 23:07 eldamitri + + * src/error.cpp (1.6, rel-3-7-9), src/field_binary.cpp (1.9), + src/field_integer.cpp (1.8, rel-3-7-9), src/field_string_ascii.cpp + (1.11), src/field_string_unicode.cpp (1.11), src/frame.cpp (1.14), + src/frame_parse.cpp (1.13), src/misc_support.cpp (1.11), + src/utils.cpp (1.3, rel-3-7-10, rel-3-7-9), include/id3/error.h + (1.11, rel-3-7-7, rel-3-7-9), include/id3/frame.h (1.24), + include/id3/globals.h (1.23), include/id3/header.h (1.13, + rel-3-7-9), include/id3/misc_support.h (1.18, rel-3-7-9), + include/id3/utils.h (1.6, rel-3-7-10, rel-3-7-9): Updated luint + parameter, return type with more descriptive type name (either + size_t, index_t, or flags_t) + +2000-05-12 Friday 06:31 eldamitri + + * include/id3/flags.h (1.2, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9): (class ID3_Flags): Changed TYPE to flags_t + +2000-05-12 Friday 06:25 eldamitri + + * include/id3/globals.h (1.22): Added typedefs for index_t (size_t) + and flags_t (uint16) + +2000-05-12 Friday 06:24 eldamitri + + * include/id3/header_tag.h (1.13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9): (class ID3_TagHeader): Added SetExtended(), + GetExtended() + +2000-05-12 Friday 06:24 eldamitri + + * include/id3/tag.h (1.31): + - Removed acBinary and bTagOwns fields from ID3_Elem (unused) + - Constructor parameter now const + - Changed all luint return types, parameters to one of index_t, + size_t, or flags_t, where appropriate + - RemoveFrame now returns a frame pointer + - Render, RenderV1 now const methods + - Added HasTagType() method in favor of deprecated HasV2Tag(), + HasV1Tag(), and HasLyrics() methods + - Removed all *Sync* methods (now standalone funcs declared in + utils.h) + - Removed all List, Elem helper methods (now standalone) + - Updated, reorganized private member variables + +2000-05-12 Friday 06:17 eldamitri + + * src/tag.cpp (1.16): + - Removed all occurrences of __instances (unused) + - Made RemoveFromList and ClearList local functions + - Removed implementation of SetupTag(), moved most of its + functionality to Clear() + - Updated constructors to no longer rely on SetupTag + - Updated destructor to make better use of Clear() + - Updated appropriate methods to increment/decrement __num_frames + when necessary + - RemoveFrame nwo returns the pointer to the frame returned (NULL if + not removed or not present) and therefore the tag is now released + from its responsibility of managing frame's memory + - Makes use of new __hdr member variable where appropriate + - NumFrames implementation removed (moved to header file) + +2000-05-12 Friday 06:05 eldamitri + + * src/tag_file.cpp (1.12): + - Updated member variables to new names + (Link): + - Updated luint return type to be size_t + - Updated to use new __tags_to_parse member variable + (Update): Updated luint parameter, return type to flags_t + (Strip): Updated luint parameter, return type to flags_t + +2000-05-12 Friday 06:01 eldamitri + + * src/tag_find.cpp (1.11): + (Find): Updated luint parameter to be uint32 + (GetFrameNum): + - Updated luint parameter to be index_t + - Reimplemented so that it returns the NumFrames - index element, + since the frames are stored in a stack and would otherwise be + traversed in reverse order (operator[]): Updated luint parameter to + be index_t + +2000-05-12 Friday 05:48 eldamitri + + * src/tag_parse.cpp (1.16): + (ID3_ParseFrames): Now a local function rather than an ID3_Tag + member function, accepts an ID3_Tag reference + (ParseFromHandle): Updated luint return type to size_t, updated to + use new __tags_to_parse member variable + +2000-05-12 Friday 05:45 eldamitri + + * src/: tag_parse_v1.cpp (1.6), tag_parse_lyrics3.cpp (1.11, + rel-3-7-9): Updated for new member variables + +2000-05-12 Friday 05:45 eldamitri + + * src/tag_render.cpp (1.17): + - Updated member variables to new names + (Render): + - Updated luint return type to size_t + - method now const + - No longer sets actual tag to have LATEST spec + - Made use of new __hdr member variable + (Size): + - Updated luint return type to size_t + - Made use of new __hdr member variable + (RenderV1): + - Updated luint return type to size_t + - method now const + - Made use of new __file_tags member variable + (PaddingSize): + - Updated luint return type to size_t + +2000-05-12 Friday 05:40 eldamitri + + * src/tag_sync.cpp (1.5): + (ID3_ReSync): Updated luint parameter, return type to size_t + (ID3_GetUnSyncSize): Updated luint parameter, return type to size_t + (ID3_UnSync): Updated luint parameters to size_t + +2000-05-11 Thursday 18:04 eldamitri + + * include/id3/utils.h (1.5), src/tag_sync.cpp (1.4): All syncing + functions are now stand-alone, rather than member functions of + ID3_Tag + +2000-05-11 Thursday 15:01 eldamitri + + * NEWS (1.14), configure.in (1.36, rel-3-7-11), id3lib.spec.in + (1.13) (utags: rel-3-7-8): Updated for 3.7.8 release + +2000-05-11 Thursday 14:49 eldamitri + + * src/tag_render.cpp (1.16, rel-3-7-8): + (RenderV1): Fixed bug with writing too many bytes to the v1 tag + +2000-05-11 Thursday 14:49 eldamitri + + * src/tag_file.cpp (1.11, rel-3-7-8): + (OpenFileForWriting): Fixed bug when stripping an id3v2 tag w/no + id3v1 tag + +2000-05-11 Thursday 14:49 eldamitri + + * src/: field.cpp (1.19), field_string_ascii.cpp (1.10), + field_string_unicode.cpp (1.10) (utags: rel-3-7-8): Fixed major bug + that caused all string tags to be written out as binary data with + wrong encoding. + +2000-05-10 Wednesday 18:33 eldamitri + + * NEWS (1.13), THANKS (1.9, rel-3-7-8), configure.in (1.35), + id3lib.spec.in (1.12) (utags: rel-3-7-7): Updated for 3.7.7 release + +2000-05-10 Wednesday 18:31 eldamitri + + * Makefile.am (1.18, rel-3-7-8, rel-3-7-7): Reordered subdirs to + put zlib before src so it will be compiled before id3lib if + necessary + +2000-05-10 Wednesday 18:30 eldamitri + + * include/id3/Makefile.am (1.7, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7): utils.h re-included as a + distributed file + +2000-05-10 Wednesday 18:29 eldamitri + + * zlib/src/Makefile.in (1.3, rel-3-7-8, rel-3-7-7, rel-3-7-8, + rel-3-7-7): Improved configuration for building zlib + +2000-05-10 Wednesday 17:21 eldamitri + + * include/id3/field.h (1.26, rel-3-7-12, rel-3-7-8, rel-3-7-7): + (class ID3_Field): Minor fix to IsEncodable so as to prevent + warnings in windows. + +2000-05-10 Wednesday 17:19 eldamitri + + * src/tag_render.cpp (1.15, rel-3-7-7): + (RenderV1): Minor bug fix + +2000-05-10 Wednesday 16:54 eldamitri + + * src/field_string_ascii.cpp (1.9, rel-3-7-7): + (ParseASCIIString): Minor fix + +2000-05-10 Wednesday 16:49 eldamitri + + * src/frame_parse.cpp (1.11, rel-3-7-8, rel-3-7-7): + (Parse): Fixed a minor bug with initializing fields not in scope + +2000-05-10 Wednesday 16:45 eldamitri + + * examples/demo_info.cpp (1.10, rel-3-7-8, rel-3-7-7): + (PrintInformation): Removed old comment that no longer described the + operation of the function accurately. + +2000-05-10 Wednesday 15:24 eldamitri + + * include/id3/misc_support.h (1.17, rel-3-7-8, rel-3-7-7): Updated + interface to synced lyrics helper funcs to accept refs instead of + pointers, where appropriate. + +2000-05-10 Wednesday 15:23 eldamitri + + * src/misc_support.cpp (1.10, rel-3-7-8, rel-3-7-7): Minor fixes, + interface changes + +2000-05-10 Wednesday 15:22 eldamitri + + * src/tag_parse_lyrics3.cpp (1.10, rel-3-7-8, rel-3-7-7): + (ParseLyrics3): Fixed bug in using new synced lyrics helper func. + +2000-05-10 Wednesday 05:41 eldamitri + + * include/id3/field.h (1.25, rel-3-7-11): (class ID3_Field): Added + GetType(), IsEncodable(); uncommented GetEncoding(), SetEncoding(); + added __enc member variable + +2000-05-10 Wednesday 05:39 eldamitri + + * include/id3/globals.h (1.21, rel-3-7-8, rel-3-7-7): (enum + ID3_FieldFlags): Renamed for clarity: NULL->CSTR, NULLDIVIDE->LIST, + ADJUSTENC->ENCODABLE; removed ADJUSTEDBY; added TEXTLIST (enum + ID3_FieldType): Added NONE, TEXTSTRING, and NUMTYPES; removed + ASCIISTRING and UNICODESTRING + +2000-05-10 Wednesday 05:36 eldamitri + + * include/id3/tag.h (1.30, rel-3-7-8, rel-3-7-7): (class ID3_Tag): + Removed decls of AddBinary(), ExpandBinaries(), and + ProcessBinaries(), since they'reno longer needed + +2000-05-10 Wednesday 05:35 eldamitri + + * src/field.cpp (1.18, rel-3-7-7): + - Updated for renamed field flags + - Changed ID3FTY_ASCIISTRING's to ID3FTY_TEXTSTRING's + (ID3_Field): Updated to initialize __enc + (Clear): Updated to clear __enc + (SetSpec): Removed, no lnger needed + (Parse): Updated for use with new text encoding scheme + (Render): Updated for use with new text encoding scheme + (SetEncoding): Uncommented, updated + +2000-05-10 Wednesday 05:30 eldamitri + + * src/field_string_ascii.cpp (1.8): Updated for renamed field flags + (Set): Changes encoding, rather that type, of field + (Add): Changes encoding, rather that type, of field + +2000-05-10 Wednesday 05:29 eldamitri + + * src/field_string_unicode.cpp (1.9, rel-3-7-7): Updated for + renamed field flags + (Set): Changes encoding, rather that type, of field + +2000-05-10 Wednesday 05:27 eldamitri + + * src/frame.cpp (1.13, rel-3-7-8, rel-3-7-7): + (_UpdateFieldDeps): Removed, never used + (_UpdateStringTypes): Reimplemented using new encoding code + +2000-05-10 Wednesday 05:25 eldamitri + + * src/frame_parse.cpp (1.10): + (Parse): Uncommented call to SetEncoding + +2000-05-10 Wednesday 05:24 eldamitri + + * src/tag_parse.cpp (1.15, rel-3-7-8, rel-3-7-7): + (ID3_GetLastElem): Removed, no longer necessary + (AddBinary): Removed, no longer necessary + (ExpandBinaries): Removed, no longer necessary + (ProcessBinaries): Removed, no longer necessary + +2000-05-10 Wednesday 03:50 eldamitri + + * include/id3/globals.h (1.20): (enum ID3_TextEnc): Added NONE and + NUMENCODINGS to enumeration. + +2000-05-10 Wednesday 03:50 eldamitri + + * include/id3/field.h (1.24): (class ID3_Field): Added (commented + out) decl's for SetEncoding() and GetEncoding(); removed __spec + member variable + +2000-05-10 Wednesday 03:45 eldamitri + + * src/frame_parse.cpp (1.9): + (Parse): Added call to SetEncoding (commented out for now) + +2000-05-10 Wednesday 03:42 eldamitri + + * src/header_tag.cpp (1.10, rel-3-7-8, rel-3-7-7): + (Parse): Fixed bug with determining data size. + +2000-05-10 Wednesday 03:42 eldamitri + + * src/tag_parse.cpp (1.14): + (ParseFrames): Fixed bug with setting the frame spec (it wasn't!) + +2000-05-10 Wednesday 03:39 eldamitri + + * src/field.cpp (1.17): + (SetEncoding): Added implementation (commented out for now) + +2000-05-09 Tuesday 16:32 eldamitri + + * zlib/: include/deflate.h (1.2), include/infblock.h (1.2), + include/infcodes.h (1.2), include/inffast.h (1.2), + include/inffixed.h (1.2), include/inftrees.h (1.2), + include/infutil.h (1.2), include/trees.h (1.2), include/zconf.h + (1.2), include/zlib.h (1.2), include/zutil.h (1.2), src/adler32.c + (1.2), src/compress.c (1.2), src/crc32.c (1.2), src/deflate.c + (1.2), src/gzio.c (1.2), src/infblock.c (1.2), src/infcodes.c + (1.2), src/inffast.c (1.2), src/inflate.c (1.2), src/inftrees.c + (1.2), src/infutil.c (1.2), src/trees.c (1.2), src/uncompr.c (1.2), + src/zutil.c (1.2) (utags: rel-3-7-10, rel-3-7-7, rel-3-7-11, + rel-3-7-8, rel-3-7-12, rel-3-7-9, rel-3-7-13): Converted to + unix-style carriage returns. + +2000-05-09 Tuesday 15:47 eldamitri + + * include/id3/field.h (1.23): (class ID3_Field): Added InScope and + GetID methods, removed SetSpec method and __spec member variable, + updated Parse* methods to only accept two parameters, not three + +2000-05-09 Tuesday 15:45 eldamitri + + * include/id3/frame.h (1.23, rel-3-7-8, rel-3-7-7): (class + ID3_Frame): Changed SetID() and Parse() methods to return a bool to + indicate if the frame has changed; added BadParse() and + GetDataSize() methods, added __bad_parse member variable + +2000-05-09 Tuesday 15:38 eldamitri + + * include/id3/header_frame.h (1.11, rel-3-7-8, rel-3-7-7): (class + ID3_FrameHeader): Added GetExtrasSize(), SetExpandedSize(), + GetExpandedSize(), SetEncryptionID(), GetEncryptionID(), + SetGroupingID(), and GetGroupingID() methods, as well as + __encryption_id, __grouping_id, and __expanded_size member variables + +2000-05-09 Tuesday 15:36 eldamitri + + * include/id3/header_tag.h (1.12, rel-3-7-8, rel-3-7-7): (class + ID3_TagHeader): Added GetUnsync() method + +2000-05-09 Tuesday 15:35 eldamitri + + * include/id3/tag.h (1.29): (class ID3_Tag): Added ParseFrames() + method, __hdr member variable + +2000-05-09 Tuesday 15:34 eldamitri + + * src/field.cpp (1.16): + (ID3_Field): Removed initialization of __spec + (SetSpec): Removed + (BinSize): No longer checks spec (relies on calling function) + (Parse): Updated for new parameters, no longer checks spec (relies + on calling function) + (Render): No longer checks spec (relies on calling function) + (operator=): No longer copies over spec + +2000-05-09 Tuesday 15:30 eldamitri + + * src/field_binary.cpp (1.8, rel-3-7-8, rel-3-7-7): + (ParseBinary): Updated for new parameters + +2000-05-09 Tuesday 15:29 eldamitri + + * src/field_integer.cpp (1.7, rel-3-7-8, rel-3-7-7): + (ParseInteger): Updated for new parameters + +2000-05-09 Tuesday 15:28 eldamitri + + * src/field_string_ascii.cpp (1.7): + (ParseASCIIString): Updated for new parameters + +2000-05-09 Tuesday 15:28 eldamitri + + * src/field_string_unicode.cpp (1.8): + (ParseUnicodeString): Updated for new parameter + +2000-05-09 Tuesday 15:26 eldamitri + + * src/frame.cpp (1.12): + (_ClearFields): Added implementation + (Clear): Updated to use _ClearFields + (_SetID): Added implementation + (SetID): Now returns bool indicating if the frame changed + (Size): Now checks to see if a field is in scope before adding its + size + +2000-05-09 Tuesday 15:18 eldamitri + + * src/frame_parse.cpp (1.8): + (Parse): New implementation + +2000-05-09 Tuesday 15:17 eldamitri + + * src/frame_render.cpp (1.8, rel-3-7-8, rel-3-7-7): + (Render): Minor implementation change + +2000-05-09 Tuesday 15:13 eldamitri + + * src/header_frame.cpp (1.6, rel-3-7-8, rel-3-7-7): + (SetFrameID): Minor implementation change + (Parse): Now checks for compression, encryption, and grouping + +2000-05-09 Tuesday 15:05 eldamitri + + * src/header_tag.cpp (1.9): + (Parse): Updated to prepare for handling extended headers + +2000-05-09 Tuesday 15:04 eldamitri + + * src/tag_parse.cpp (1.13): + (ParseFrames): Added implementation + (Parse): New implementation, using ParseFrames + +2000-05-08 Monday 15:57 eldamitri + + * include/id3/globals.h (1.19), include/id3/misc_support.h (1.16), + src/misc_support.cpp (1.9), src/tag_parse_lyrics3.cpp (1.9): + Updated with new enums, helper functions for adding synced lyrics + (thanks Severino Delaurenti). + +2000-05-08 Monday 15:55 eldamitri + + * examples/demo_info.cpp (1.9): + (PrintInformation): Updated for new names of ContentType enums + +2000-05-08 Monday 15:54 eldamitri + + * doc/index.html.in (1.7, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7): Updated to mention COM as a + supported language. + +2000-05-08 Monday 06:07 eldamitri + + * include/id3/error.h (1.10, rel-3-7-8, rel-3-7-7), + include/id3/field.h (1.22, rel-3-7-10), include/id3/frame.h (1.22), + include/id3/tag.h (1.28), src/field.cpp (1.15), + src/field_binary.cpp (1.7), src/field_string_unicode.cpp (1.7), + src/frame_parse.cpp (1.7), src/tag.cpp (1.15, rel-3-7-8, + rel-3-7-7), src/tag_find.cpp (1.10, rel-3-7-8, rel-3-7-7), + src/tag_parse.cpp (1.12), src/tag_render.cpp (1.14): Updated + interface to use const appropriately + +2000-05-08 Monday 05:13 eldamitri + + * include/id3/misc_support.h (1.15): All Get* functions now take + const pointers to tags, Minor cleanup + +2000-05-08 Monday 05:11 eldamitri + + * include/id3/tag.h (1.27): + - All Find methods are now const + - __cursor is now mutable so Find methods can be const + - Removed decl of protected GetLastElem (not dependant on tag data) + +2000-05-08 Monday 05:10 eldamitri + + * src/c_wrapper.cpp (1.6, rel-3-7-8, rel-3-7-7): + (ID3Frame_GetCompression): Now returns false by default (thanks John + Adcock) + +2000-05-08 Monday 05:08 eldamitri + + * src/misc_support.cpp (1.8): Fixed bug in AddGenre, all Get* + functions now take const pointers to tags, no function throws on + error. + +2000-05-08 Monday 05:06 eldamitri + + * src/tag_find.cpp (1.9): + (Find): All are now const methods + +2000-05-08 Monday 05:05 eldamitri + + * src/tag_parse.cpp (1.11): + (ID3_GetLastElem): Renamed from ID3_Tag::GetLastElem (local to file) + (AddBinary): Updated to use ID3_GetLastElem + (ProcessBinaries): Updated to use ID3_GetLastElem + +2000-05-08 Monday 05:04 eldamitri + + * id3com/: ID3Frame.cpp (1.5, rel-3-7-9), ID3Frame.h (1.4, + rel-3-7-9), id3com.idl (1.4) (utags: rel-3-7-7, rel-3-7-8): Updated + for the changes to compression in ID3_Tag and ID3_Frame + +2000-05-08 Monday 05:02 eldamitri + + * id3com/Makefile.am (1.3, rel-3-7-9, rel-3-7-8, rel-3-7-7): + Removed references to deleted files. + +2000-05-08 Monday 05:00 eldamitri + + * id3com/: ID3COM_p.c (1.3), ID3Test.vbp (1.2), ID3Test.vbw (1.2): + Not needed. + +2000-05-06 Saturday 23:41 eldamitri + + * examples/demo_info.cpp (1.8): + (PrintInformation): Now prints out timestamp format for synced + lyrics + +2000-05-06 Saturday 23:38 eldamitri + + * src/tag_parse.cpp (1.10), include/id3/tag.h (1.26): + (Parse): Now returns the tag size + +2000-05-06 Saturday 23:25 eldamitri + + * include/id3/utils.h (1.4, rel-3-7-8, rel-3-7-7): Commented out + namespace, RenderNumber now returns number of bytes rendered + +2000-05-06 Saturday 23:24 eldamitri + + * src/field_integer.cpp (1.6): Replaced '#include "misc_support.h"' + with '#include "utils.h"' + (RenderInteger): Minor cleanup + +2000-05-06 Saturday 23:22 eldamitri + + * src/frame_render.cpp (1.7): Replaced '#include "misc_support.h"' + with '#include "utils.h"' + (Render): Minor cleanup + +2000-05-06 Saturday 23:22 eldamitri + + * src/header_frame.cpp (1.5): + (Parse): Minor cleanup + (Render): Minor cleanup + +2000-05-06 Saturday 23:20 eldamitri + + * src/header_tag.cpp (1.8): + (Render): Minor cleanup + (Parse): Minor cleanup + +2000-05-06 Saturday 23:20 eldamitri + + * src/misc_support.cpp (1.7), include/id3/misc_support.h (1.14): + Moved utility functions to utils.cpp + +2000-05-06 Saturday 23:18 eldamitri + + * src/tag.cpp (1.14): + (SetupTag): Minor cleanups + +2000-05-06 Saturday 23:17 eldamitri + + * src/tag_file.cpp (1.10, rel-3-7-7): + (Link): Minor cleanups + +2000-05-06 Saturday 23:16 eldamitri + + * src/: tag_parse.cpp (1.9), tag_find.cpp (1.8), + field_string_unicode.cpp (1.6), field_string_ascii.cpp (1.6): + Replaced '#include "misc_support.h"' with '#include "utils.h"' + +2000-05-06 Saturday 23:16 eldamitri + + * src/tag_parse_lyrics3.cpp (1.8): + (ID3_RenderTimeStamp): Added new function + (ID3_Lyrics3ToSylt): Cleaned up the function, minor bugfix for + newlines + +2000-05-06 Saturday 23:13 eldamitri + + * src/tag_render.cpp (1.13): Minor cleanups + +2000-05-06 Saturday 23:10 eldamitri + + * src/utils.cpp (1.2, rel-3-7-8, rel-3-7-7): + (ParseNumber): New, easier-to-understand implementation + (RenderNumber): + - New, easier-to-understand implementation + - Now returns number of bytes rendered + +2000-05-06 Saturday 07:46 eldamitri + + * configure.in (1.34): Not having sys/param.h or wchar.h doesn't + prevent compilation. + +2000-05-06 Saturday 07:42 eldamitri + + * examples/demo_info.cpp (1.7): + (PrintUsage): Parameter now const + (PrintVersion): Parameter now const + (PrintInformation): Parameter now const, now prints out info about + synced lyrics + +2000-05-06 Saturday 07:42 eldamitri + + * include/id3/field.h (1.21): Added GetBinary() method + +2000-05-06 Saturday 07:42 eldamitri + + * include/id3/globals.h (1.18): Removed VerCtl enumeration, and + LyricsContent enumeration. + +2000-05-06 Saturday 07:42 eldamitri + + * src/tag_file.cpp (1.9), include/id3/tag.h (1.25): The Link() + methods' filename parameter is now const. + +2000-05-06 Saturday 07:42 eldamitri + + * src/tag_parse_lyrics3.cpp (1.7): Bugfixes to the synchronized + lyrics conversion. + +2000-05-05 Friday 05:36 eldamitri + + * Makefile.in (1.14), configure (1.20), libtool (1.2), + src/Makefile.am (1.12, rel-3-7-8, rel-3-7-7), src/Makefile.in + (1.8), zlib/src/Makefile.am (1.2, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0): Updated to + allow zlib to conditionally compile when it isn't found (not yet + working right) + +2000-05-05 Friday 05:35 eldamitri + + * include/id3/: Makefile.am (1.6), Makefile.in (1.9): Designated + utils.h and uint28.h as not needing to be installed + +2000-05-05 Friday 05:16 eldamitri + + * configure.in (1.33, rel-3-7-10): Updated to allow zlib to + conditionally compile when it isn't found. + +2000-05-05 Friday 05:15 eldamitri + + * include/id3/: frame.h (1.21), tag.h (1.24): Made destructor + virtual to avoid compilation warnings (thanks Peter Thorstenson) + +2000-05-05 Friday 05:13 eldamitri + + * doc/index.html.in (1.6): Added ref to new project: Sonize. + +2000-05-04 Thursday 22:52 eldamitri + + * src/tag_parse_lyrics3.cpp (1.6): + (ID3_StripTimeStamps): Fixed logic of bad data (thanks Severino) + (ID3_Lyrics3ToSylt): Added implementation (thanks Severino) + (ParseLyrics3): Adds description, language, lyricist, and + information (thanks Severino) + +2000-05-04 Thursday 22:52 eldamitri + + * src/misc_support.cpp (1.6): + (ID3_AddTitle): Now checks if memory wasn't allocated (thanks + Severino) + (ID3_GetLyricist): Added implementation (thanks Severino) + (ID3_AddLyricist): Added implementation (thanks Severino) + (ID3_RemoveLyricist): Added implementation (thanks Severino) + +2000-05-04 Thursday 22:51 eldamitri + + * src/field.cpp (1.14): + (ID3FD_LinkedInfo): Removed unnecessary (read: wrong) size field for + id3v2.2.x + (ID3FD_SyncLyrics): Added (thanks Severino) + (ID3_FrameDefs): Updated ID3FID_SYNCEDLYRICS frame def to use + ID3FD_SyncLyrics + +2000-05-04 Thursday 22:51 eldamitri + + * include/id3/misc_support.h (1.13): Added declaration of + ID3_GetLyricist, ID3_AddLyricist, and ID3_RemoveLyricist (thanks + Severino) + +2000-05-04 Thursday 22:51 eldamitri + + * include/id3/globals.h (1.17): Added ID3FN_TIMESTAMPFORMAT and + ID3FN_CONTENTTYPE constants for the new synced lyrics support + (thanks Severino) + +2000-05-04 Thursday 03:44 eldamitri + + * NEWS (1.12), THANKS (1.8), configure.in (1.32), id3lib.spec.in + (1.11): Updated for 3.7.6 release + +2000-05-04 Thursday 02:59 eldamitri + + * include/id3/frame.h (1.20): + (SetCompression): Added as a replacement for + ID3_Tag::GetCompression() + (GetCompression): Added + +2000-05-04 Thursday 02:56 eldamitri + + * include/id3.h (1.9, rel-3-7-8, rel-3-7-7), src/c_wrapper.cpp + (1.5): Added ID3Frame_SetCompression and ID3Frame_GetCompression. + Deprecated ID3Tag_SetCompression + +2000-05-04 Thursday 01:24 eldamitri + + * src/uint28.cpp (1.3, rel-3-7-9, rel-3-7-8, rel-3-7-7): + (operator=): Returns *this (operator>>): Removed std:: (will put + this in later when make the move to STL/STC) + +2000-05-04 Thursday 01:24 eldamitri + + * src/header_tag.cpp (1.7): Added static definition of + ID3_TagHeader::ID + +2000-05-04 Thursday 01:23 eldamitri + + * include/id3/uint28.h (1.3, rel-3-7-9, rel-3-7-8, rel-3-7-7): + Replaced #include iostream with #include iostream.h. Removed + #include algorithm (not needed) + +2000-05-04 Thursday 01:23 eldamitri + + * include/id3/header_tag.h (1.11): (class ID3_TagHeader): Replaced + definition of ID3_TagHeader with just a declaration (windows didn't + like having it defined in the header) + +2000-05-04 Thursday 01:23 eldamitri + + * include/id3/header.h (1.12, rel-3-7-8, rel-3-7-7): + (Clear): Updated to return boolean if the header actually changed + +2000-05-04 Thursday 01:23 eldamitri + + * include/id3/frame.h (1.19): + (Contains): Added comparison to ensure boolean output + +2000-05-04 Thursday 01:16 eldamitri + + * id3com/id3com.dsp (1.8), libprj/id3lib.dsp (1.5), prj/id3lib.dsp + (1.8) (utags: rel-3-7-7, rel-3-7-8, rel-3-7-9): Updated to compile + with new changes to the library + +2000-05-03 Wednesday 19:13 eldamitri + + * id3com/ID3Frame.cpp (1.4): + (get_FrameName): Updated for new ID3_Frame::GetDescription. + +2000-05-03 Wednesday 19:13 eldamitri + + * src/frame.cpp (1.11): + (GetDescription): Now returns NULL rather than "Unknown" for unknown + frames. + +2000-05-03 Wednesday 16:10 eldamitri + + * examples/demo_info.cpp (1.6): + (PrintInformation): Updated for new ID3_Frame::GetDescription() + +2000-05-03 Wednesday 16:09 eldamitri + + * include/id3/field.h (1.20), include/id3/frame.h (1.18), + src/field.cpp (1.13), src/frame.cpp (1.10): Replaced + ID3_GetFrameDescription() with ID3_Frame::GetDescription() and + static ID3_Frame::GetDescription(ID3_FrameID) + +2000-05-03 Wednesday 16:05 eldamitri + + * include/id3/header_tag.h (1.10), include/id3/tag.h (1.23), + src/header_tag.cpp (1.6), src/tag.cpp (1.13): Moved + ID3_TagHeader::IsHeader() to ID3_Tag::IsV2Tag() + +2000-05-03 Wednesday 06:20 eldamitri + + * src/tag_file.cpp (1.8): + (Strip): Fix of a major bug that would delete too much info when + stripping a file with an ID3v2 tag present + +2000-05-03 Wednesday 05:02 eldamitri + + * include/id3/error.h (1.9), include/id3/field.h (1.19), + include/id3/frame.h (1.17), include/id3/tag.h (1.22), src/error.cpp + (1.5, rel-3-7-8, rel-3-7-7), src/field.cpp (1.12), + src/field_binary.cpp (1.6), src/field_integer.cpp (1.5), + src/field_string_ascii.cpp (1.5), src/field_string_unicode.cpp + (1.5), src/frame.cpp (1.9), src/frame_parse.cpp (1.6), + src/frame_render.cpp (1.6), src/tag.cpp (1.12), src/tag_file.cpp + (1.7), src/tag_find.cpp (1.7), src/tag_parse.cpp (1.8), + src/tag_parse_lyrics3.cpp (1.5), src/tag_parse_v1.cpp (1.5, + rel-3-7-8, rel-3-7-7), src/tag_render.cpp (1.12): Renamed member + variables to something not so windows-ish (ick!) + +2000-05-03 Wednesday 00:43 eldamitri + + * src/field.cpp (1.11): + * src/field.cpp: Removed left over comment that wasn't commented + +2000-05-03 Wednesday 00:18 eldamitri + + * src/field.cpp (1.10): + (ID3_FrameDefs): Descriptions for PCNT, POSS, PRIV, and POPM were + not matched up with their appropriate frame def (thanks Daryl + Pawluk) + +2000-05-03 Wednesday 00:10 eldamitri + + * src/tag.cpp (1.11): + (SetPadding): Fixed minor bug (thanks Sasa olic) + +2000-05-03 Wednesday 00:00 eldamitri + + * include/id3.h (1.8): Minor bugfix for #endif (thanks John + Southerland) + +2000-05-02 Tuesday 23:59 eldamitri + + * include/id3/globals.h (1.16): Added ID3FID_METACOMPRESSION enum + for ID3v2.2.1's compressed-data meta-frame ("CDM") + +2000-05-02 Tuesday 23:59 eldamitri + + * include/id3/header.h (1.11): + (ID3_HeaderInfo): + - Struct now defined within ID3_Header + - renamed to Info (ID3_Header::Info) + - renamed member variables to something not so windows-ish (ick!) + - removed ID3_V2Spec member (redundant) + (ID3_Header): + - Most members now defined in header + - Removed *Flags() methods; replaced with __flags protected data + members subclasses should now provide subclasses to access this + member + - removed ID3_V2Spec member (redundant) + - Added Parse() pure virtual method to be implemented by subclasses + - renamed member variables to something not so windows-ish (ick!) + - SetSpec's parameter is no longer const, now returns bool to + indicate if the spec actually changed + - Clear() now returns bool to indicate if the tag actually needed + clearing + - Size() method is now const + +2000-05-02 Tuesday 23:59 eldamitri + + * include/id3/header_frame.h (1.10): + - ID3FL #define's now public enum's within the class + - Added SetCompression(), SetEncryption(), SetGrouping(), + GetCompression(), GetEncryption(), GetGrouping(), and GetReadOnly() + methods and their definitions + - renamed member variables to something not so windows-ish (ick!) + +2000-05-02 Tuesday 23:59 eldamitri + + * include/id3/header_tag.h (1.9): + - ID3HF #define's now public enum's within the class + - Added default constructor, copy constructor, destructor, + SetSpec(), Parse(), SetUnsync(), and static IsHeader() methods + - Added enumeration of offsets, sizes for header fields + - Added static const char* ID variable + - Deprecated ID3_IsTagHeader (use ID3_TagHeader::IsHeader() instead) + +2000-05-02 Tuesday 23:59 eldamitri + + * include/id3/spec.h (1.2, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7): + - SetSpec's, SetVersion's now return bool + - SetSpec's parameter is no longer const + +2000-05-02 Tuesday 23:58 eldamitri + + * include/id3/: tag.h (1.21), frame.h (1.16): SetSpec's parameter + is no longer const, now returns bool + +2000-05-02 Tuesday 23:58 eldamitri + + * src/field.cpp (1.9): + (ID3FD_LinkedInfo): Now is valid through ID3v2.2.1 + (ID3FD_CDM): Added for ID3v2.2.1's compressed data meta-frame + (ID3_FrameDefs): + - Added def for CDM + - If a frame isn't defined for a spec, this is now signified with an + empty id string, rather than one filled with spaces + +2000-05-02 Tuesday 23:58 eldamitri + + * src/frame.cpp (1.8): + (SetSpec): Updated for new SetSpec interface, now just calls + __FrmHdr's SetSpec + +2000-05-02 Tuesday 23:58 eldamitri + + * src/frame_parse.cpp (1.5): Removed #include + +2000-05-02 Tuesday 23:57 eldamitri + + * src/frame_render.cpp (1.5): + (Render): Now uses FrameHeader's GetCompression(), SetCompression(), + SetEncryption(), and SetGrouping() methods. + +2000-05-02 Tuesday 23:56 eldamitri + + * src/header.cpp (1.7, rel-3-7-8, rel-3-7-7): Moved most methods to + the header file. SetSpec reimplemented to assign __info pointer. + ID3_SpecInfo (renamed to _spec_info) is static to the file and no + longer has the V2Spec member. It is now accessed directly via + subscript in SetSpec. + +2000-05-02 Tuesday 23:56 eldamitri + + * src/header_frame.cpp (1.4): + (ID3_FrameHeader): Moved to header (~ID3_FrameHeader): Moved to + header + (SetFrameID): Now no-ops when the id is the same as the current + (Size): Now returns 0 if __info is NULL + (Parse): Updated to use new __flags member variable + (Render): New interface; method is now const, no longer throws + (Clear): New interface; now returns a boolean to indicate if the + header actually changed + +2000-05-02 Tuesday 23:56 eldamitri + + * src/header_tag.cpp (1.5): + (IsHeader): Added implementation; returns 0 if buffer isn't an id3v2 + tag header, otherwise returns the size of the tag (including the + header) + (ID3_IsTagHeader): Deprecated; now uses IsHeader + (SetSpec): Updated for new interface; now returns a boolean to + indicate if the spec actually changed + (Size): New interface; method is now const + (Render): New interface; method is now const, new implementation + (Parse): Added implementation (operator=): Implementation moved to + header file + +2000-05-02 Tuesday 23:56 eldamitri + + * src/tag.cpp (1.10): + (SetSpec): Updated for new interface; now returns a boolean to + indicate if the spec actually changed + +2000-05-02 Tuesday 23:56 eldamitri + + * src/tag_file.cpp (1.6): + (Strip): Added note to log error + +2000-05-02 Tuesday 23:55 eldamitri + + * src/tag_parse.cpp (1.7): + (ExpandBinaries): Now uses new METACOMPRESSION frame id rather than + comparing the text id directly + (ProcessBinaries): Updated for new FrameHeader methods: + GetCompression(),GetEncryption(), GetCrouping() + (Parse): Updated to use new uint28 class; updated to use new + TagHeader enum's + +2000-05-02 Tuesday 22:35 eldamitri + + * include/id3/Makefile.am (1.5): Removed int28.h, added flags.h, + uint28.h, and utils.h + +2000-05-02 Tuesday 22:34 eldamitri + + * src/Makefile.am (1.11): Removed int28.cpp, added uit28.cpp and + utils.cpp + +2000-05-02 Tuesday 18:57 eldamitri + + * src/tag_render.cpp (1.11): + (Render): Replaced call of SetFlags(ID3HF_UNSYNC) to SetUnsync(true) + +2000-05-02 Tuesday 18:54 eldamitri + + * include/id3/flags.h (1.1, rel-3-7-8, rel-3-7-7): Added; basic + class for manipulating a flags bitset + +2000-05-02 Tuesday 18:53 eldamitri + + * include/id3/utils.h (1.3), src/utils.cpp (1.1): Added; moved util + functions out of misc_support + +2000-05-02 Tuesday 18:50 eldamitri + + * include/id3/uint28.h (1.2), src/uint28.cpp (1.2): Added; better + implementation of the 28-bit unsigned int class. + +2000-05-01 Monday 18:41 eldamitri + + * include/id3/frame.h (1.15): + - No longer includes field.h, added advanced decl of ID3_Field + - ID3_Tag is no longer a friend class + - HasChanged(), Parse(), Size(), Render(), SetSpec() now public + - Added decl for Contains(ID3_FieldID) method + - Minor cleanup + +2000-05-01 Monday 18:38 eldamitri + + * include/id3/tag.h (1.20): No long er includes header_frame.h, + deprecated SetCompression (compression should be set on a + frame-by-frame basis). + +2000-05-01 Monday 18:36 eldamitri + + * src/tag.cpp (1.9): Removed all occurrences of SetCompression + + (deprecated) + +2000-05-01 Monday 17:51 eldamitri + + * src/tag_find.cpp (1.6): + (Find): Replaced direct access of field bits with call to Contains + +2000-05-01 Monday 17:30 eldamitri + + * src/tag_render.cpp (1.10): + (Render): Removed compression step - this will be handled in the + frame + +2000-05-01 Monday 15:04 eldamitri + + * Makefile.am (1.17), configure.in (1.31, rel-3-7-12), + src/Makefile.am (1.10), src/error.cpp (1.4), src/field.cpp (1.8), + src/field_binary.cpp (1.5), src/field_integer.cpp (1.4), + src/field_string_ascii.cpp (1.4), src/field_string_unicode.cpp + (1.4), src/frame.cpp (1.7), src/frame_parse.cpp (1.4), + src/frame_render.cpp (1.4), src/globals.cpp (1.2, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7), + src/header.cpp (1.6), src/header_frame.cpp (1.3), + src/header_tag.cpp (1.4), src/int28.cpp (1.3, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7), + src/misc_support.cpp (1.5), src/tag.cpp (1.8), src/tag_file.cpp + (1.5), src/tag_find.cpp (1.5), src/tag_parse.cpp (1.6), + src/tag_parse_lyrics3.cpp (1.4), src/tag_parse_v1.cpp (1.4), + src/tag_render.cpp (1.9), src/tag_sync.cpp (1.3, rel-3-7-8, + rel-3-7-7): Removed Log comments at the end of all files. + +2000-04-29 Saturday 00:04 eldamitri + + * include/id3/misc_support.h (1.12), src/misc_support.cpp (1.4): + All ID3_Add* functions now return pointers to ID3_Frame's rather + than bool's. They no longer throw; if a function isn't created, or + if an error occurs, a NULL frame is returned. The ID3_Frame pointer + that is returned is the pointer to the actual frame attached to the + tag, but it can be safely ignored as the tag will handle freeing its + memory. + +2000-04-28 Friday 19:27 eldamitri + + * NEWS (1.11), configure.in (1.30, rel-3-7-11), id3lib.spec.in + (1.10) (utags: rel-3-7-5): Updated for 3.7.5 release + +2000-04-28 Friday 18:56 eldamitri + + * THANKS (1.7, rel-3-7-5): Added mention of Severino's + contribution, other minor fixes + +2000-04-28 Friday 18:36 eldamitri + + * doc/Doxyfile.in (1.4, rel-3-7-2, rel-3-6-0, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5): Removed source browser + +2000-04-28 Friday 18:36 eldamitri + + * doc/index.html.in (1.5, rel-3-7-5): Updated to emphasize tagging + for both ID3v1 and ID3v2, now mentions C interface, added link to + javpc project, slight rewording in places. + +2000-04-28 Friday 18:32 eldamitri + + * id3com/ID3Frame.cpp (1.3), id3com/ID3Tag.cpp (1.4, rel-3-7-8, + rel-3-7-7), id3com/ID3Tag.h (1.3, rel-3-7-9, rel-3-7-8, rel-3-7-7), + id3com/id3com.idl (1.3), examples/demo_info.cpp (1.5) (utags: + rel-3-7-5): More id3com fixes and usage of new frame descriptions + (thanks John Adcock) + +2000-04-28 Friday 18:26 eldamitri + + * include/id3/field.h (1.18, rel-3-7-9, rel-3-7-5): (struct + ID3_FrameDef): Added sDescription field (thanks John Adcock) + (ID3_GetFrameDescription): Added declaration + +2000-04-28 Friday 18:23 eldamitri + + * src/field.cpp (1.7, rel-3-7-5): Added frame descriptions (thanks + John Adcock) and ID3_GetFrameDescription implementation. + +2000-04-28 Friday 18:22 eldamitri + + * src/frame.cpp (1.6), include/id3/frame.h (1.14) (utags: + rel-3-7-5): InitFields method no longer accepts a parameter. + +2000-04-28 Friday 18:08 eldamitri + + * src/tag.cpp (1.7), include/id3/tag.h (1.19) (utags: rel-3-7-5): + Updated documentation. + +2000-04-28 Friday 17:59 eldamitri + + * src/tag_parse.cpp (1.5, rel-3-7-5): + (ProcessBinaries): Removed parseHandler code (never used, and will + likely be replaced). + +2000-04-28 Friday 17:56 eldamitri + + * src/tag_parse_lyrics3.cpp (1.3, rel-3-7-5): + (ParseLyrics3): Added code for parsing Lyrics3 v1.00 tags (thanks + Severino Delaurenti) + +2000-04-27 Thursday 17:54 eldamitri + + * src/tag_render.cpp (1.8, rel-3-7-5): + (RenderV2ToHandle): Fixes a nasty bug when saving a V2 tag to a file + (thanks John Adcock) + +2000-04-27 Thursday 17:53 eldamitri + + * src/field.cpp (1.6): Fixed bugs in creation and assignment + (thanks John Adcock) + +2000-04-27 Thursday 17:51 eldamitri + + * src/field_binary.cpp (1.4, rel-3-7-5): + (Set): Now handles the case when null data is passed in (thanks John + Adcock) + +2000-04-27 Thursday 17:41 eldamitri + + * id3com/: Sample/ID3Test.vbw (1.2, rel-3-7-9, rel-3-7-8, + rel-3-7-7), id3com.dsp (1.7) (utags: rel-3-7-5): Minor update + +2000-04-27 Thursday 17:41 eldamitri + + * id3com/ID3Tag.cpp (1.3): + (FindFrame): Updated to use AttachFrame + (FindFrameString): Updated to use AttachFrame + +2000-04-27 Thursday 17:33 eldamitri + + * id3com/Sample/frmID3Test.frm (1.2, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5): Extended the sample with more utility + (thanks John Adcock) + +2000-04-27 Thursday 04:55 eldamitri + + * NEWS (1.10), THANKS (1.6), configure.in (1.29, rel-3-7-9), + id3lib.spec.in (1.9) (utags: rel-3-7-4): Updated for 3.7.4 release + +2000-04-27 Thursday 04:37 eldamitri + + * include/id3.h (1.7, rel-3-7-5, rel-3-7-4): Minor cleanup + +2000-04-27 Thursday 04:36 eldamitri + + * include/id3/globals.h (1.15, rel-3-7-5, rel-3-7-4): Fixed + ID3_C_EXPORT and ID3_C_VAR defs so windows funcs are exported + correctly + +2000-04-27 Thursday 04:36 eldamitri + + * include/id3.h (1.6): Every function declaration was prepended + with ID3_C_EXPORT so they will compile correctly under windows. + +2000-04-27 Thursday 04:35 eldamitri + + * id3com/id3com.dsp (1.6), libprj/id3lib.dsp (1.4, rel-3-7-5), + prj/id3lib.dsp (1.7, rel-3-7-5) (utags: rel-3-7-4): Fixed to work + with most current release + +2000-04-27 Thursday 04:35 eldamitri + + * Makefile.am (1.16, rel-3-6-2, rel-3-7-5, rel-3-7-4): Updated + release directive to clean up windows distribution of unneeded + files/directories. + +2000-04-26 Wednesday 22:30 eldamitri + + * Makefile.am (1.15): Copy windows projects over manually + +2000-04-26 Wednesday 22:30 eldamitri + + * configure.in (1.28): No longer generate Makefiles for windows + projects + +2000-04-26 Wednesday 22:26 eldamitri + + * include/id3.h (1.5, rel-3-7-13): Removed C++ comments + +2000-04-26 Wednesday 20:43 eldamitri + + * id3com/Sample/: ID3Test.vbp (1.1, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5), ID3Test.vbw (1.1), MSSCCPRJ.SCC (1.1, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5), frmID3Test.frm (1.1) + (utags: rel-3-7-4): Initial release; a simple VB app for testing + id3com.dll + +2000-04-26 Wednesday 19:02 eldamitri + + * id3com/: EnumFields.cpp (1.2, rel-3-7-9, rel-3-7-8, rel-3-7-7, + rel-3-7-5, rel-3-7-4), EnumFields.h (1.2, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4), ID3COM_p.c (1.2, rel-3-7-5, + rel-3-7-4), ID3Field.cpp (1.2, rel-3-7-9, rel-3-7-8, rel-3-7-7, + rel-3-7-5, rel-3-7-4), ID3Field.h (1.3, rel-3-7-8, rel-3-7-7, + rel-3-7-5, rel-3-7-4), ID3Field.rgs (1.2, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4), ID3Frame.cpp (1.2, rel-3-7-4), + ID3Frame.h (1.3, rel-3-7-5, rel-3-7-4), ID3Frame.rgs (1.2, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4), ID3Tag.cpp + (1.2, rel-3-7-4), ID3Tag.h (1.2, rel-3-7-4), ID3Tag.rgs (1.2, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4), StdAfx.cpp + (1.2, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4), + StdAfx.h (1.2, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4), id3com.cpp (1.2, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4), id3com.dsp (1.5), id3com.idl (1.2, rel-3-7-4): Thanks + to John Adcock for this update + - Fixes to work bring id3com up to speed with library. + - Fixed namespace collision caused by restructuring + - Changed the project file a bit so it is safer + - Changed license to LGPL to match rest of library + +2000-04-26 Wednesday 18:53 eldamitri + + * include/id3/globals.h (1.14): Fixed ID3_C_VAR and ID#_C_EXPORT + definitions, thanks to John Adcock + +2000-04-26 Wednesday 17:58 eldamitri + + * include/id3/frame.h (1.13, rel-3-7-4): ID3_Frame now inherits + from ID3_Speccable, SetSpec's parameter is now const, and declared + GetSpec + +2000-04-26 Wednesday 17:54 eldamitri + + * include/id3/header.h (1.10, rel-3-7-5, rel-3-7-4): Removed + SetSpec's default parameter, made parameter const + +2000-04-26 Wednesday 17:54 eldamitri + + * include/id3/tag.h (1.18, rel-3-7-4): SetSpec's parameter now + const + +2000-04-26 Wednesday 17:53 eldamitri + + * src/field.cpp (1.5, rel-3-7-4): Updated lists of + supported/unsupported frames (PRIV now supported) + (ID3FD_Private): Added definition + (ID3_FrameDefs): Updated Private's definition + +2000-04-26 Wednesday 17:51 eldamitri + + * src/frame.cpp (1.5, rel-3-7-4): + (SetSpec): Parameter now const + (GetSpec): Added implementation + +2000-04-26 Wednesday 17:50 eldamitri + + * src/header.cpp (1.5, rel-3-7-5, rel-3-7-4): + (ID3_Header): Made call to SetSpec have explicit parameter + (SetSpec): Parameter now const + +2000-04-26 Wednesday 17:49 eldamitri + + * src/tag.cpp (1.6, rel-3-7-4): + (SetSpec): Parameter now const + +2000-04-26 Wednesday 17:48 eldamitri + + * src/tag_render.cpp (1.7, rel-3-7-4): + (PaddingSize): Fix for padding logic, thanks to John Adcock for the + patch. + +2000-04-26 Wednesday 06:18 eldamitri + + * include/id3/spec.h (1.1, rel-3-7-5, rel-3-7-4): Added; defines + ID3_Speccable pure virtual class, which provides {Get,Set}Spec + methods and deprecated {Get,Set}Version, GetRevision + +2000-04-26 Wednesday 06:18 eldamitri + + * include/id3/header.h (1.9): + - Now inherits from ID3_Speccable + - Deprecated SetVersion, added SetSpec and GetSpec + - Deprecated ID3_LookupHeaderInfo(uchar, uchar) in favor of + ID3_LookupHeaderInfo(ID3_V2Spec) + - Removed ID3v2_{VERSION,REVISION}; now use ID3V2_LATEST instead + - Replaced version/revision uchar combination with ID3_V2Spec enums + +2000-04-26 Wednesday 06:18 eldamitri + + * include/id3/globals.h (1.13): + - Removed ID3_SpecVersion (not used anyway) + - Defined ID3_V1Spec and ID3_V2Spec to enumerate various iterations + of each specification + +2000-04-26 Wednesday 06:17 eldamitri + + * include/id3/frame.h (1.12): Replaced (protected) SetVersion with + SetSpec + +2000-04-26 Wednesday 06:17 eldamitri + + * include/id3/field.h (1.17, rel-3-7-4): + - ID3_VerCtl enumeration deprecated in favor of using two ID3_V2Spec + enums to denote field scope + - Deprecated (private) SetVersion in favor of SetSpec + - Replaced version/revision uchar combination with ID3_V2Spec enums + +2000-04-26 Wednesday 05:44 eldamitri + + * include/id3/Makefile.am (1.4, rel-3-7-5, rel-3-7-4): + (the_headers): Added spec.h + +2000-04-26 Wednesday 05:43 eldamitri + + * src/spec.cpp (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4): + Initial release; implements functions ID3_V2SpecToVer, + ID3_V2SpecToRev, and ID3_VerRevToV2Spec declared in spec.h + +2000-04-26 Wednesday 05:42 eldamitri + + * src/: field.cpp (1.4), frame.cpp (1.4), frame_parse.cpp (1.3, + rel-3-7-5, rel-3-7-4), frame_render.cpp (1.3, rel-3-7-5, + rel-3-7-4), header.cpp (1.4), header_tag.cpp (1.3, rel-3-7-5, + rel-3-7-4), tag.cpp (1.5), tag_parse.cpp (1.4, rel-3-7-4), + tag_render.cpp (1.6): + - Replaced version/revision uchar combination with ID3_V2Spec enums + - Deprecated {Get,Set}Version, GetRevision for {Get,Set}Spec + - ID3_VerCtl enumeration deprecated in favor of using two ID3_V2Spec + enums to denote field scope + - Replaced ID3v2_VERSION, ID3v2_REVISION constants with ID3V2_LATEST + enum + - Use ID3V2_UNKNOWN enum rather than 0 for version, revision + +2000-04-26 Wednesday 05:42 eldamitri + + * src/c_wrapper.cpp (1.4, rel-3-7-5, rel-3-7-4): + (ID3Tag_AttachFrame): Added implementation + +2000-04-26 Wednesday 05:41 eldamitri + + * src/Makefile.am (1.9, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-5, rel-3-7-4): + (the_sources): Added spec.cpp + +2000-04-26 Wednesday 04:49 eldamitri + + * include/id3/tag.h (1.17): + - Removed default params for deprecated Link(char *, bool, bool) + since they were causing ambiguity for Link(char *, luint) + - Now inherits from ID3_Speccable + - Deprecated SetVersion, added SetSpec and GetSpec + +2000-04-26 Wednesday 02:47 eldamitri + + * doc/index.html.in (1.4, rel-3-7-4): + - Minor reformatting + - Added Zlurp! to list of projects using id3lib + - Added "Valid HTML 4.01" image, link to validator + +2000-04-25 Tuesday 02:16 eldamitri + + * NEWS (1.9), configure.in (1.27) (utags: rel-3-7-3): Updated for + 3.7.3 release + +2000-04-24 Monday 22:21 eldamitri + + * id3lib.spec.in (1.8, rel-3-7-3): Added explicite RPM_OPT_FLAGS + def based on arch, since -fno-exceptions and -fno-rtti are part of + the default flags in rpmrc and we need both exceptions and rtti + (exceptions uses rtti) + +2000-04-24 Monday 22:18 eldamitri + + * doc/Makefile.am (1.12, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3): + (dox): Added to make the documentation generation more granular + (docs): Now uses dox + +2000-04-24 Monday 17:02 eldamitri + + * id3com/id3com.dsp (1.4, rel-3-7-3): Added c_wrapper.cpp and + globals.cpp + +2000-04-24 Monday 16:59 eldamitri + + * include/id3.h (1.4, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-3): + - Added decl for ID3Tag_AttachFrame + - ID3Tag_{Parse,Update,Strip} now all return ID3_Err's + - ID3Tag_UpdateType renamed to ID3Tag_UpdateByTagType, returns + ID3_Err + +2000-04-24 Monday 16:59 eldamitri + + * include/id3/field.h (1.16, rel-3-7-3): FixedLength is now + unsigned, since a 0 rather than a -1 will represent a + variable-length field + +2000-04-24 Monday 16:59 eldamitri + + * include/id3/frame.h (1.11, rel-3-7-3): Added decl for copy + constructor + +2000-04-24 Monday 16:59 eldamitri + + * include/id3/globals.h (1.12, rel-3-7-3): Replaced C++ comments + for C comments + +2000-04-24 Monday 16:59 eldamitri + + * include/id3/tag.h (1.16, rel-3-7-3): + - Moved doxygen comments to appropriate cpp file + - AddNewFrame deprecated for AttachFrame + - Link(char *, bool, bool) deprecated for Link(char *, luint) + - OpenFileFor{Reading,Writing} now returns an ID3_Err rather than + void + +2000-04-24 Monday 16:49 eldamitri + + * src/tag_parse.cpp (1.3, rel-3-7-3): + - Added comments originally in include/id3/tag.h + - (ParseFromHandle): Conditionally parses tag types based on + __ulTagsToParse, which replaces __bParseLyrics3 and __bParseID3v1 + +2000-04-24 Monday 16:48 eldamitri + + * src/: tag_find.cpp (1.4, rel-3-7-5, rel-3-7-4), tag_render.cpp + (1.5) (utags: rel-3-7-3): Added comments originally in + include/id3/tag.h + +2000-04-24 Monday 16:48 eldamitri + + * src/tag_file.cpp (1.4, rel-3-7-5, rel-3-7-4, rel-3-7-3): + - Added comments originally in include/id3/tag.h + - (OpenFileForWriting): Now returns ID3_Err rather than void + - (OpenFileForReading): Now returns ID3_Err rather than void + - (Link): Deprecated Link(char *, bool, bool) for Link(char *, + luint), which accepts an unsigned int representing the tag types to + parse. + +2000-04-24 Monday 16:48 eldamitri + + * src/tag.cpp (1.4, rel-3-7-3): + - Added comments originally in include/id3/tag.h + - (operator<<): Made frame parameter constant + - (AddFrame): + - Made frame parameter constant + - Now adds a copy of the frame onto the tag, rather than the frame + passed in, thus allowing the tag to be repsonsible for deleting + the frame + - (AddNewFrame): Deprecated in favor of AttachFrame + - (AddFrames): Adds copies of frames + +2000-04-24 Monday 16:48 eldamitri + + * src/misc_support.cpp (1.3, rel-3-7-5, rel-3-7-4, rel-3-7-3): + - Calls to AddNewFrame replaced with calls to AttachFrame + - Minor changes to prevent warnings w/gcc + +2000-04-24 Monday 16:48 eldamitri + + * src/frame.cpp (1.3, rel-3-7-3): + (ID3_Frame): Added copy constructor implementation + +2000-04-24 Monday 16:47 eldamitri + + * src/: field.cpp (1.3), field_binary.cpp (1.3, rel-3-7-4), + field_integer.cpp (1.3, rel-3-7-5, rel-3-7-4), + field_string_ascii.cpp (1.3, rel-3-7-5, rel-3-7-4), + field_string_unicode.cpp (1.3, rel-3-7-5, rel-3-7-4) (utags: + rel-3-7-3): __lFixedLength changed to __ulFixedLength. A fixed + length of 0, rather than -1, represents a variable-length field, + since we should never have a fixed field length of 0. + +2000-04-24 Monday 16:47 eldamitri + + * src/error.cpp (1.3, rel-3-7-5, rel-3-7-4, rel-3-7-3): + (ID3_ErrorDescs): Added "no error" to list + +2000-04-24 Monday 16:47 eldamitri + + * src/c_wrapper.cpp (1.3, rel-3-7-3): + (ID3Tag_Parse): Now returns an ID3_Err + (ID3Tag_Update): Now returns an ID3_Err + (ID3Tag_UpdateByTagType): Renamed from UpdateType, now returns an + ID3_Err + (ID3Tag_Strip): Now returns an ID3_Err + +2000-04-23 Sunday 19:38 eldamitri + + * src/tag_render.cpp (1.4): + - Moved def of ID3_PATH_LENGTH from tag.h, since its def requires a + macro defined in config.h, which isn't accessible from the .h files. + - Updated ID3_V1_LEN constants to new names + +2000-04-23 Sunday 19:38 eldamitri + + * src/tag_parse_v1.cpp (1.3, rel-3-7-5, rel-3-7-4, rel-3-7-3): + - Updated ID3_V1_LEN constants to new names + +2000-04-23 Sunday 19:38 eldamitri + + * src/tag_file.cpp (1.3): + - Updated ID3_TagType constants to new names + +2000-04-23 Sunday 19:37 eldamitri + + * src/tag.cpp (1.3): + - Moved def of ID3_PATH_LENGTH from tag.h, since its def requires a + macro defined in config.h, which isn't accessible from the .h files. + - __sFileName is now dynamically allocated + +2000-04-23 Sunday 19:37 eldamitri + + * include/id3/tag.h (1.15): + - Moved def of ID3_PATH_LENGTH from tag.h, since its def requires a + macro defined in config.h, which isn't accessible from the .h files. + - Moved LEN_V1 constants (renamed to ID3_V1_LEN constants) to + globals.h + - Moved ID3V1_Tag struct declaration to globals.h + - Moved ID3_TagType enum declaration to globals.h + - Updated ID3_TagType constants to new names + - __sFileName is no longer a fixed-length char array, but rather a + char pointer, since ID3_PATH_LENGTH can't be defined in tag.h + +2000-04-23 Sunday 19:37 eldamitri + + * include/id3/globals.h (1.11): + - Remove ID3_ENUM_TYPE macro, renamed and redefined ID3_ENUM_DECL + macro to ID3_ENUM to make it easier to use + - Added ID3_MACRO macro + - Renamed the ID3_SpecVersion, ID3_TatType enums to follow more + consistent naming of all enums + - Moved LEN_V1 constants into ID3_V1Lengths enumeration, since array + lengths can't be specified with consts in C + - Added ID3V1_Tag struct from tag.h + - Added ID3_FieldFlags, ID3_FieldType, ID3_VerCtl enums from field.h + - Added ID3_Err enum from error.h + +2000-04-23 Sunday 19:37 eldamitri + + * include/id3/field.h (1.15): Moved ID3_FieldFlags, ID3_FieldType, + ID3_VerCtl enums to globals.h + +2000-04-23 Sunday 19:36 eldamitri + + * include/id3/error.h (1.8, rel-3-7-5, rel-3-7-4, rel-3-7-3): Moved + ID3_Err enumeration to globals.h + +2000-04-23 Sunday 19:36 eldamitri + + * examples/demo_info.cpp (1.4, rel-3-7-4, rel-3-7-3): + - Removed dependency on config.h + +2000-04-23 Sunday 19:36 eldamitri + + * examples/: demo_convert.cpp (1.4), demo_tag.cpp (1.4) (utags: + rel-3-7-7, rel-3-7-8, rel-3-7-3, rel-3-7-4, rel-3-7-5): + - Removed dependency on config.h + - Updated ID3_TagType constants to new names + +2000-04-23 Sunday 01:35 eldamitri + + * include/id3.h (1.3): Added declaration from ID3Tag_UpdateType + +2000-04-23 Sunday 01:33 eldamitri + + * src/c_wrapper.cpp (1.2): Added implementations for + ID3Tag_UpdateType and ID3_Frame{New,NewID,Delete}. + +2000-04-23 Sunday 00:55 eldamitri + + * doc/index.html.in (1.3, rel-3-7-3): Updated DOCTYPE. + +2000-04-22 Saturday 06:50 eldamitri + + * id3lib.spec.in (1.7, rel-3-7-2): Fixed minor bugs in doc + cleaning, and better separation of noarch tasks. + +2000-04-21 Friday 22:13 eldamitri + + * NEWS (1.8), configure.in (1.26) (utags: rel-3-7-2): Updated for + 3.7.2 release + +2000-04-21 Friday 22:12 eldamitri + + * config.h.win32.in (1.3, rel-3-7-11, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2): Updated to + be in line with config.h.in + +2000-04-21 Friday 22:02 eldamitri + + * configure.in (1.25): Added DOX_DIR_{HTML,LATEX,MAN,RTF} so that + doxygen's output directories need only be adjusted in one file + +2000-04-21 Friday 21:55 eldamitri + + * Makefile.am (1.14, rel-3-7-3, rel-3-7-2): + (docs): Added for creating documentation from top directory + (docs-release): Added for automating creation of documentation + deliverables + (release): Updated to create documentation release + +2000-04-21 Friday 21:52 eldamitri + + * id3lib.spec.in (1.6): + - More conditional blocks for noarch + - More thorough cleaning of files for documentation + - Updated html directory + +2000-04-21 Friday 21:47 eldamitri + + * doc/Doxyfile.in (1.3, rel-3-7-4, rel-3-7-3, rel-3-7-2): + - Turned off verbatim headers + - Added *.c to example patterns + - Generalized output directories + +2000-04-21 Friday 21:45 eldamitri + + * doc/Makefile.am (1.11, rel-3-7-2): + (docs): + - More thorough building of documentation (pd.gz, pdf, html) + - Generalized doxygen's output directories + - Cleans up intermediate files + (dist-hook): Removed; doxygen-created docs no longer distributed + with main tarball release + +2000-04-21 Friday 21:39 eldamitri + + * doc/index.html.in (1.2, rel-3-7-2): Generalized doxygen's html + output directory + +2000-04-21 Friday 21:38 eldamitri + + * examples/Makefile.am (1.5, rel-3-7-8, rel-3-7-7, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2): + (EXTRA_DIST): mp3 files are no longer distributed + +2000-04-21 Friday 07:56 eldamitri + + * src/dll_wrapper.cpp (1.3): Removed; replaced by c_wrapper.cpp + +2000-04-21 Friday 07:53 eldamitri + + * id3lib.spec.in (1.5): + - Fixed date of changelog entry for 3.7.1-1 + - Added conditional blocks so docs only get built for noarch target + +2000-04-21 Friday 07:50 eldamitri + + * examples/Makefile.am (1.4): Updated for new example: id3simple + +2000-04-21 Friday 07:49 eldamitri + + * examples/demo_simple.c (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2): Initial release; simple example of how to + use the C interface + +2000-04-21 Friday 07:47 eldamitri + + * include/id3.h (1.2, rel-3-7-2): Fixed parameters for ID3Tag_Strip + +2000-04-21 Friday 07:46 eldamitri + + * include/id3/header_tag.h (1.8, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2): + - Moved ID3_{TAGID,TAGIDSIZE,TAGHEADERSIZE} macros to globals.h + +2000-04-21 Friday 07:45 eldamitri + + * include/id3/globals.h (1.10, rel-3-7-2): + - Updated WIN32 macros for creating dll's + - Added ID3_{TAGID,TAGIDSIZE,TAGHEADERSIZE} macros from header.h + - Changed all enumerations to use same syntax for C and C++ + +2000-04-21 Friday 07:10 eldamitri + + * prj/: id3lib.dsp (1.6), id3lib.mak (1.4, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4) (utags: rel-3-7-2, rel-3-7-3): + - Added globals.cpp + - Removed version.cpp, types.h, version.h + - Renamed src\dll_wrapper.cpp to src\c_wrapper.cpp + +2000-04-21 Friday 07:07 eldamitri + + * libprj/id3lib.dsp (1.3, rel-3-7-3, rel-3-7-2): + - Added globals.cpp + - Removed version.cpp, externals.h, types.h, version.h + - Renamed include\id3\dll.h to include\id3.h + +2000-04-21 Friday 07:05 eldamitri + + * id3com/id3com.dsp (1.3, rel-3-7-2): Removed version.cpp + +2000-04-21 Friday 06:59 eldamitri + + * src/Makefile.am (1.8, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-3, rel-3-7-2): + (the_sources): Added c_wrapper.cpp + (EXTRA_DIST): Removed, since dll_wrapper.cpp is no longer + distributed + +2000-04-21 Friday 06:58 eldamitri + + * src/c_wrapper.cpp (1.1, rel-3-7-2): Renamed and updated from + dll_wrapper.cpp + +2000-04-21 Friday 06:54 eldamitri + + * src/tag_find.cpp (1.3, rel-3-7-2): Minor updates + +2000-04-20 Thursday 17:12 eldamitri + + * doc/Makefile.am (1.10, rel-3-7-1): + (dist-hook): Copies latex code into dist package + +2000-04-20 Thursday 17:11 eldamitri + + * id3lib.spec.in (1.4, rel-3-7-1): Updated to make doc package as + lean as possible + +2000-04-20 Thursday 06:59 eldamitri + + * NEWS (1.7), configure.in (1.24, rel-3-7-8) (utags: rel-3-7-1): + Updated for 3.7.1 release + +2000-04-20 Thursday 06:58 eldamitri + + * id3lib.spec.in (1.3): + * id3lib.spec.in: Added HISTORY to all %doc's + +2000-04-20 Thursday 06:56 eldamitri + + * include/Makefile.am (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1): Fixed typo. + +2000-04-20 Thursday 06:55 eldamitri + + * id3com/: ID3Field.h (1.2), ID3Frame.h (1.2) (utags: rel-3-7-1, + rel-3-7-2, rel-3-7-3): Changed #include to #include + + +2000-04-20 Thursday 06:19 eldamitri + + * include/id3/dll.h (1.6): No longer needed + +2000-04-20 Thursday 06:03 eldamitri + + * id3lib.spec.in (1.2): + - Removed zlib-devel requirement from devel + - Added doc package to distribute documentation + - Added examples package to distribute binary examples + - Moved doc/ and examples/ source files from devel to doc package + +2000-04-20 Thursday 05:54 eldamitri + + * include/Makefile.am (1.3): Added id3.h to included directories + +2000-04-20 Thursday 05:52 eldamitri + + * configure.in (1.23): + - Added ID3LIB_NAME definition + - Prepended '__' onto all macros that will be defined in config.h to + alleviate namespace clashes + +2000-04-20 Thursday 05:50 eldamitri + + * src/tag_render.cpp (1.3, rel-3-7-2, rel-3-7-1): + (RenderV2ToHandle): Now uses ID3_PATH_LENGTH instead of MAXPATHLEN + +2000-04-20 Thursday 05:49 eldamitri + + * src/header.cpp (1.3, rel-3-7-3, rel-3-7-2, rel-3-7-1): + (ID3_LookupHeaderInfo): Minor update + +2000-04-20 Thursday 05:48 eldamitri + + * src/globals.cpp (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1): Initial release + +2000-04-20 Thursday 05:47 eldamitri + + * src/Makefile.am (1.7, rel-3-7-1): + (the_sources): Added globals.cpp, removed version.cpp + +2000-04-20 Thursday 05:45 eldamitri + + * include/id3/tag.h (1.14, rel-3-7-2, rel-3-7-1): + - Abstracted MAXPATHLEN into ID3_PATH_LENGTH macro for platform + differences (inspired by glib.h from http://www.gtk.org) + - Removed log comments to reduce file size + +2000-04-20 Thursday 05:43 eldamitri + + * include/id3/Makefile.am (1.3, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-3, rel-3-7-2, + rel-3-7-1): + (the_headers): Removed dll.h, externals.h, version.h, and types.h. + +2000-04-20 Thursday 05:43 eldamitri + + * include/id3/: error.h (1.7, rel-3-7-2), field.h (1.14, + rel-3-7-2), frame.h (1.10, rel-3-7-2), header.h (1.8, rel-3-7-3, + rel-3-7-2), header_frame.h (1.9, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2), header_tag.h (1.7), int28.h (1.9, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2) (utags: rel-3-7-1): Minor updates; + removed log comments to reduce file size + +2000-04-20 Thursday 05:42 eldamitri + + * include/id3/sized_types.h (1.4, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1): Made compilable with C (changed + comments, etc.). + +2000-04-20 Thursday 05:41 eldamitri + + * include/id3/misc_support.h (1.11, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1): + - Moved MASK macros to globals.h + - Removed log comments to reduce file size + +2000-04-20 Thursday 05:38 eldamitri + + * include/id3/globals.h (1.9, rel-3-7-1): + - Made compilable with C (changed comments, etc.). + - Merged in contents of types.h. + - Added bool typedef and true/false defines for C compilation. + - Added version constants (replacements for functions in version.h) + - Added ID3_SpecVersion enum + - Added new macros to abstract differences between latforms + +2000-04-20 Thursday 05:27 eldamitri + + * examples/: demo_convert.cpp (1.3), demo_info.cpp (1.3), + demo_tag.cpp (1.3) (utags: rel-3-7-1, rel-3-7-2): Replaced call to + ID3_FullName with ID3LIB_FULL_NAME constant + +2000-04-20 Thursday 05:24 eldamitri + + * include/id3.h (1.1, rel-3-7-1): Added; replaces include/id3/dll.h + +2000-04-20 Thursday 05:21 eldamitri + + * doc/Makefile.am (1.9): + (dist-hook): Made copying of the html more selective + +2000-04-20 Thursday 05:20 eldamitri + + * doc/Doxyfile.in (1.2, rel-3-6-2, rel-3-0-6pre1, rel-3-7-1): + (INPUT): Updated for new src code path. + (EXAMPLE_PATH): Updated for new example code path + +2000-04-20 Thursday 03:57 eldamitri + + * include/id3/externals.h (1.4), include/id3/utils.h (1.2), + include/id3/version.h (1.6), src/version.cpp (1.3): No longer + needed + +2000-04-20 Thursday 02:40 eldamitri + + * include/id3/: types.h (1.7), utils.h (1.1): Renamed from types.h + to utils.h to better match its special purpose + +2000-04-20 Thursday 00:52 eldamitri + + * examples/Makefile.am (1.3, rel-3-7-1): + (bin_PROGRAMS): Changed from check_PROGRAMS so that they build w/o + make check + (EXTRA_DIST): Removed readme.txt + +2000-04-19 Wednesday 04:04 eldamitri + + * configure.in (1.22, rel-3-7-7): + (AC_OUTPUT): Added examples/Makefile, removed src/id3/Makefile and + src/examples/Makefile + +2000-04-19 Wednesday 04:03 eldamitri + + * Makefile.am (1.13, rel-3-7-1): + (SUBDIRS): Added 'examples' + +2000-04-19 Wednesday 04:02 eldamitri + + * src/Makefile.am (1.6, rel-3-7-5, rel-3-7-4): Moved from src/id3 + to src. + +2000-04-19 Wednesday 04:02 eldamitri + + * src/.cvsignore (1.3, rel-3-7-1): Updated for new files + +2000-04-19 Wednesday 04:01 eldamitri + + * src/id3/.cvsignore (1.4): No longer needed + +2000-04-19 Wednesday 04:00 eldamitri + + * examples/.cvsignore (1.2, rel-3-7-1), src/examples/.cvsignore + (1.9): Moved .cvsignore from src/examples to examples + +2000-04-19 Wednesday 03:49 eldamitri + + * id3com/id3com.dsp (1.2), libprj/id3lib.dsp (1.2), prj/id3lib.dsp + (1.5), prj/id3lib.mak (1.3) (utags: rel-3-7-1): Updated for new + file paths. + +2000-04-19 Wednesday 00:14 eldamitri + + * src/: version.cpp (1.2), id3/version.cpp (1.6): Moved version.cpp + from src/id3/ to src/ + +2000-04-19 Wednesday 00:14 eldamitri + + * src/: tag_sync.cpp (1.2, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1), id3/tag_sync.cpp (1.11): Moved tag_sync.cpp + from src/id3/ to src/ + +2000-04-19 Wednesday 00:14 eldamitri + + * src/: tag_render.cpp (1.2), id3/tag_render.cpp (1.21): Moved + tag_render.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:13 eldamitri + + * src/: tag_parse_v1.cpp (1.2, rel-3-7-2, rel-3-7-1), + id3/tag_parse_v1.cpp (1.16): Moved tag_parse_v1.cpp from src/id3/ + to src/ + +2000-04-19 Wednesday 00:13 eldamitri + + * src/: tag_parse_lyrics3.cpp (1.2, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1), id3/tag_parse_lyrics3.cpp (1.13): Moved + tag_parse_lyrics3.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:13 eldamitri + + * src/: tag_parse.cpp (1.2, rel-3-7-2, rel-3-7-1), + id3/tag_parse.cpp (1.21): Moved tag_parse.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:13 eldamitri + + * src/: tag_find.cpp (1.2, rel-3-7-1), id3/tag_find.cpp (1.14): + Moved tag_find.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:13 eldamitri + + * src/: tag_file.cpp (1.2, rel-3-7-2, rel-3-7-1), id3/tag_file.cpp + (1.18): Moved tag_file.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:12 eldamitri + + * src/: tag.cpp (1.2, rel-3-7-2, rel-3-7-1), id3/tag.cpp (1.15): + Moved tag.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:12 eldamitri + + * src/: misc_support.cpp (1.2, rel-3-7-2, rel-3-7-1), + id3/misc_support.cpp (1.23): Moved misc_support.cpp from src/id3/ + to src/ + +2000-04-19 Wednesday 00:12 eldamitri + + * src/: int28.cpp (1.2, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1), id3/int28.cpp (1.13): Moved int28.cpp from src/id3/ to + src/ + +2000-04-19 Wednesday 00:12 eldamitri + + * src/: header_tag.cpp (1.2, rel-3-7-3, rel-3-7-2, rel-3-7-1), + id3/header_tag.cpp (1.15): Moved header_tag.cpp from src/id3/ to + src/ + +2000-04-19 Wednesday 00:12 eldamitri + + * src/: header_frame.cpp (1.2, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1), id3/header_frame.cpp (1.17): Moved + header_frame.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:11 eldamitri + + * src/: header.cpp (1.2), id3/header.cpp (1.15): Moved header.cpp + from src/id3/ to src/ + +2000-04-19 Wednesday 00:11 eldamitri + + * src/: frame_render.cpp (1.2, rel-3-7-3, rel-3-7-2, rel-3-7-1), + id3/frame_render.cpp (1.14): Moved frame_render.cpp from src/id3/ + to src/ + +2000-04-19 Wednesday 00:11 eldamitri + + * src/: frame_parse.cpp (1.2, rel-3-7-3, rel-3-7-2, rel-3-7-1), + id3/frame_parse.cpp (1.13): Moved frame_parse.cpp from src/id3/ to + src/ + +2000-04-19 Wednesday 00:11 eldamitri + + * src/: frame.cpp (1.2, rel-3-7-2, rel-3-7-1), id3/frame.cpp + (1.15): Moved frame.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:11 eldamitri + + * src/: field_string_unicode.cpp (1.2, rel-3-7-2, rel-3-7-1), + id3/field_string_unicode.cpp (1.17): Moved field_string_unicode.cpp + from src/id3/ to src/ + +2000-04-19 Wednesday 00:10 eldamitri + + * src/: field_string_ascii.cpp (1.2, rel-3-7-2, rel-3-7-1), + id3/field_string_ascii.cpp (1.21): Moved field_string_ascii.cpp + from src/id3/ to src/ + +2000-04-19 Wednesday 00:10 eldamitri + + * src/: field_integer.cpp (1.2, rel-3-7-2, rel-3-7-1), + id3/field_integer.cpp (1.15): Moved field_integer.cpp from src/id3/ + to src/ + +2000-04-19 Wednesday 00:10 eldamitri + + * src/: field.cpp (1.2, rel-3-7-2, rel-3-7-1), id3/field.cpp + (1.21): Moved field.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:10 eldamitri + + * src/: field_binary.cpp (1.2, rel-3-7-2, rel-3-7-1), + id3/field_binary.cpp (1.14): Moved field_binary.cpp from src/id3/ + to src/ + +2000-04-19 Wednesday 00:10 eldamitri + + * src/: error.cpp (1.2, rel-3-7-2, rel-3-7-1), id3/error.cpp + (1.14): Moved error.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:09 eldamitri + + * src/: dll_wrapper.cpp (1.2, rel-3-7-1), id3/dll_wrapper.cpp + (1.15): Moved dll_wrapper.cpp from src/id3/ to src/ + +2000-04-19 Wednesday 00:07 eldamitri + + * src/id3/Makefile.am (1.11): No longer needed + +2000-04-18 Tuesday 23:47 eldamitri + + * examples/Makefile.am (1.2), src/examples/Makefile.am (1.9): Moved + Makefile.am from src/examples to examples + +2000-04-18 Tuesday 23:46 eldamitri + + * examples/jules.mp3 (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1), src/examples/jules.mp3 (1.2): + Moved jules.mp3 from src/examples to examples + +2000-04-18 Tuesday 23:46 eldamitri + + * examples/jules-goodtag.mp3 (1.2, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1), + src/examples/jules-goodtag.mp3 (1.2): Moved jules-goodtag.mp3 from + src/examples to examples + +2000-04-18 Tuesday 23:46 eldamitri + + * examples/jules-badtag.mp3 (1.2, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1), + src/examples/jules-badtag.mp3 (1.2): Moved jules-badtag.mp3 from + src/examples to examples + +2000-04-18 Tuesday 23:45 eldamitri + + * examples/demo_tag.cpp (1.2), src/examples/demo_tag.cpp (1.4): + Moved demo_tag.cpp from src/examples to examples + +2000-04-18 Tuesday 23:45 eldamitri + + * examples/demo_main.cpp (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1), src/examples/demo_main.cpp (1.3): + Moved demo_main.cpp from src/examples to examples + +2000-04-18 Tuesday 23:45 eldamitri + + * examples/demo_info.cpp (1.2), src/examples/demo_info.cpp (1.8): + Moved demo_info.cpp from src/examples to examples + +2000-04-18 Tuesday 23:45 eldamitri + + * examples/demo_convert.cpp (1.2), src/examples/demo_convert.cpp + (1.11): Moved demo_convert.cpp from src/examples to examples + +2000-04-18 Tuesday 23:45 eldamitri + + * examples/230-unicode.tag (1.2, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1), + src/examples/230-unicode.tag (1.2): Moved 230-unicode.tag from + src/examples to examples + +2000-04-18 Tuesday 23:45 eldamitri + + * examples/230-picture.tag (1.2, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1), + src/examples/230-picture.tag (1.2): Moved 230-picture.tag from + src/examples to examples + +2000-04-18 Tuesday 23:44 eldamitri + + * examples/230-compressed.tag (1.2, rel-3-7-8, rel-3-7-7, + rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1), + src/examples/230-compressed.tag (1.2): Moved 230-compressed.tag + from src/examples to examples + +2000-04-18 Tuesday 23:40 eldamitri + + * examples/221-compressed.tag (1.2, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1), + src/examples/221-compressed.tag (1.2, rel-3-0-6pre1): Moved + 221-compressed.tag from src/examples to examples + +2000-04-18 Tuesday 23:38 eldamitri + + * src/examples/readme.txt (1.3): Moved readme.txt from src/examples + to examples + +2000-04-18 Tuesday 07:18 eldamitri + + * .cvsignore (1.5, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0): Ignore spec file + +2000-04-18 Tuesday 07:16 eldamitri + + * Makefile.am (1.12, rel-3-7-0): + (EXTRA_DIST): Added HISTORY and id3lib.spec[.in] + (id3lib.spec): Added rule for generating from id3lib.spec.in + (release): Now depends on id3lib.spec + +2000-04-18 Tuesday 07:14 eldamitri + + * id3lib.spec.in (1.1, rel-3-7-0): Added + +2000-04-17 Monday 15:10 eldamitri + + * doc/: html/.cvsignore (1.3), html/Makefile.am (1.2, rel-3-6-2), + latex/.cvsignore (1.3), latex/Makefile.am (1.2, rel-3-6-2), + man/.cvsignore (1.3), man/Makefile.am (1.2, rel-3-6-2), + texinfo/.cvsignore (1.3), texinfo/Makefile.am (1.2, rel-3-6-2): No + longer used. These directories will be automatically generated. + +2000-04-17 Monday 14:52 eldamitri + + * configure.in (1.21, rel-3-7-0): + (AC_OUTPUT): Removed doc's subdirs. + +2000-04-17 Monday 14:50 eldamitri + + * doc/Makefile.am (1.8, rel-3-7-0): Fixed bug which prevented + successful 'make distcheck' + +2000-04-17 Monday 07:11 eldamitri + + * configure.in (1.20): Minor updates. + +2000-04-17 Monday 07:10 eldamitri + + * NEWS (1.6, rel-3-6-0), THANKS (1.5, rel-3-7-3, rel-3-7-2, + rel-3-7-1), TODO (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1) (utags: rel-3-7-0): Updated for + release of 3.7.0 + +2000-04-17 Monday 07:07 eldamitri + + * doc/.cvsignore (1.3, rel-3-7-1, rel-3-7-0): Added Doxyfile and + index.html. + +2000-04-17 Monday 07:05 eldamitri + + * HISTORY (1.3, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0): Minor update. + +2000-04-17 Monday 07:04 eldamitri + + * AUTHORS (1.6, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0): Updated email address + +2000-04-17 Monday 06:58 eldamitri + + * doc/Makefile.am (1.7): + (EXTRA_DIST): Added new files. + (Doxyfile): Added new rule for generating Doxyfile. + (index.html): Added new rule for generating index.html. + (docs): Added new rule for generating documentation. + (dist-hook): Added hook for creating a distrbution (copies + documentation to the distribution directory) + +2000-04-17 Monday 06:55 eldamitri + + * doc/: Doxyfile.in (1.1), id3lib.css (1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1), index.html.in (1.1, + rel-3-7-1) (utags: rel-3-7-0): Added. + +2000-04-17 Monday 06:53 eldamitri + + * doc/index.html (1.2): Removed. Automatically generated from + index.html.in. + +2000-04-17 Monday 05:59 eldamitri + + * doc/id3guide.html (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0): Updated to use + id3lib.css. + +2000-04-17 Monday 04:31 eldamitri + + * src/id3/: field.cpp (1.20), field_binary.cpp (1.13), + field_integer.cpp (1.14), field_string_ascii.cpp (1.20), + tag_file.cpp (1.17) (utags: rel-3-7-0): Updated parameters of + certain methods with const modifier to match declaration. + +2000-04-15 Saturday 21:07 eldamitri + + * doc/Makefile.am (1.6): + (EXTRA_DIST): Updated to reflect documentation changes + +2000-04-15 Saturday 20:44 eldamitri + + * src/examples/demo_info.cpp (1.7, rel-3-7-0): + (PrintInformation): Renamed ID3FN_SYMBOL to ID3FN_ID + +2000-04-15 Saturday 20:34 eldamitri + + * doc/: id3lib-manual.php (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), index.html (1.1), + id3v2.3.0.html (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), id3v2.3.0.txt (1.1, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0): Added + +2000-04-15 Saturday 20:32 eldamitri + + * doc/: 3d-logo.gif (1.1), attilas_id3logo.jpg (1.1), fillpx.gif + (1.1) (utags: rel-3-7-10, rel-3-7-7, rel-3-7-11, rel-3-7-8, + rel-3-7-0, rel-3-7-12, rel-3-7-9, rel-3-7-1, rel-3-7-13, rel-3-7-2, + rel-3-7-3, rel-3-7-4, rel-3-7-5): Initial revision. + +2000-04-15 Saturday 20:25 eldamitri + + * doc/id3guide.html (1.3): Updated with version at + http://www.id3.org + +2000-04-14 Friday 22:33 eldamitri + + * doc/id3v2-3.00.txt (1.3): Out of date + +2000-04-14 Friday 22:27 eldamitri + + * doc/: bugreport.txt (1.3), logo.txt (1.3), software.txt (1.3): No + longer needed + +2000-04-14 Friday 05:39 eldamitri + + * src/id3/field.cpp (1.19): + (ID3FD_LinkedInfo): Fixed bug in definition of LinkedInfo array. + (ID3FD_Registration): Renamed ID3FN_SYMBOL to ID3FN_ID + +2000-04-14 Friday 05:39 eldamitri + + * include/id3/globals.h (1.8, rel-3-7-0): + (ID3_FieldID): Renamed ID3FN_SYMBOL to ID3FN_ID + +2000-04-12 Wednesday 18:52 eldamitri + + * prj/: id3lib.dsp (1.4), id3lib.dsw (1.4, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1), + id3lib.mak (1.2) (utags: rel-3-7-0): Fixed dos newlines + +2000-04-12 Wednesday 18:37 eldamitri + + * id3com/.cvsignore (1.1), libprj/.cvsignore (1.1) (utags: + rel-3-7-0, rel-3-7-1, rel-3-7-2, rel-3-7-3, rel-3-7-4, rel-3-7-5): + Initial revision + +2000-04-12 Wednesday 18:36 eldamitri + + * configure.in (1.19): + (AC_OUTPUT): Add id3com/Makefile and libprj/Makefile + +2000-04-12 Wednesday 18:31 eldamitri + + * Makefile.am (1.11): + (SUBDIRS): Added id3com and libprj + +2000-04-12 Wednesday 18:29 eldamitri + + * id3com/Makefile.am (1.2, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0): + (EXTRA_DIST): Removed files.txt + +2000-04-12 Wednesday 17:34 eldamitri + + * id3com/EnumFields.cpp (1.1, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0), id3com/EnumFields.h (1.1, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), id3com/ID3COM.def (1.1, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), id3com/ID3COM.rc (1.1, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0), id3com/ID3COM_p.c (1.1, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), id3com/ID3COMps.def (1.1, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), id3com/ID3COMps.mk (1.1, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), id3com/ID3Field.cpp (1.1, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/ID3Field.h (1.1, + rel-3-7-0), id3com/ID3Field.rgs (1.1, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), id3com/ID3Frame.cpp (1.1, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/ID3Frame.h (1.1, + rel-3-7-0), id3com/ID3Frame.rgs (1.1, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), id3com/ID3Tag.cpp (1.1, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/ID3Tag.h (1.1, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/ID3Tag.rgs (1.1, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/ID3Test.vbp + (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0), id3com/ID3Test.vbw (1.1, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/StdAfx.cpp + (1.1, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/StdAfx.h + (1.1, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/dlldata.c + (1.1, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/frmID3Test.frm + (1.1, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/id3com.cpp + (1.1, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), + id3com/id3com.dsp (1.1, rel-3-7-0), id3com/id3com.dsw (1.1, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/id3com.idl (1.1, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/mssccprj.scc + (1.1, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/resource.h + (1.1, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), id3com/vssver.scc + (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), libprj/id3lib.dsp (1.1, rel-3-7-0), + libprj/id3lib.dsw (1.1, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), + id3com/Makefile.am (1.1), libprj/Makefile.am (1.1, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0): Initial release + +2000-04-11 Tuesday 05:38 eldamitri + + * include/id3/: error.h (1.6, rel-3-7-0), field.h (1.13, + rel-3-7-0), frame.h (1.9, rel-3-7-0), globals.h (1.7), tag.h (1.13, + rel-3-7-0), version.h (1.5, rel-3-7-0): Updated comments for use + with doxygen. + +2000-04-10 Monday 22:58 eldamitri + + * src/id3/header_frame.cpp (1.16, rel-3-7-0): (operator=): Fixed + bug - now returns *this. + +2000-04-10 Monday 22:57 eldamitri + + * src/id3/tag_parse.cpp (1.20, rel-3-7-0): + * src/id3/tag_parse.cpp + (ProcessBinaries): Removed name of caught error since it isn't used. + +2000-04-10 Monday 22:17 eldamitri + + * include/id3/: field.h (1.12), frame.h (1.8): Updated comments for + use with doxygen. + +2000-04-10 Monday 22:14 eldamitri + + * prj/id3lib.dsp (1.3), prj/id3lib.dsw (1.3), zlib/prj/zlib.dsp + (1.3, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0): Updated to allow for + better compilation under windows. + +2000-04-10 Monday 18:57 eldamitri + + * src/id3/: misc_support.cpp (1.22), tag_find.cpp (1.13) (utags: + rel-3-7-0): Added inclusion of string.h + +2000-04-10 Monday 18:57 eldamitri + + * src/id3/: int28.cpp (1.12, rel-3-7-0), tag_parse.cpp (1.19): + (ProcessBinaries): Minor change to prevent warning in windows. + +2000-04-10 Monday 18:57 eldamitri + + * src/id3/header_tag.cpp (1.14, rel-3-7-0): (operator=): Added + implementation. + +2000-04-10 Monday 18:57 eldamitri + + * src/id3/: header.cpp (1.14, rel-3-7-0), header_frame.cpp (1.15): + (Copy): removed. (operator=): Updated implementation so it isn't + reliant on Copy. + +2000-04-10 Monday 18:57 eldamitri + + * include/id3/header_tag.h (1.6, rel-3-7-0): (class ID3_TagHeader): + Added decl for operator=. + +2000-04-10 Monday 18:56 eldamitri + + * include/id3/header_frame.h (1.8, rel-3-7-0): (class + ID3_FrameHeader): Added decl for operator=, removed decl of Copy + +2000-04-10 Monday 18:56 eldamitri + + * include/id3/header.h (1.7, rel-3-7-0): (class ID3_Header): + Removed decl of Copy. + +2000-04-10 Monday 05:40 eldamitri + + * include/id3/tag.h (1.12): Started updating comments for doxygen. + +2000-04-10 Monday 00:46 eldamitri + + * src/id3/tag_parse.cpp (1.18): Minor structure change. + +2000-04-10 Monday 00:42 eldamitri + + * src/id3/header_frame.cpp (1.14): + (ID3_FrameHeader): Added implementation. + (SetUnknownFrame): Added implementation. + (SetFrameID): Sanity checking inputs. + (Parse): Now checks to make sure frame id isn't bogus. If it is, + creates an "unknown" frame. + (Render): Fixed bug in short/long id determination logic + (GetTextID): Fixed bug in short/long id determination logic + (Copy): Handles case when copying a frame that has an "unknown" + frame type. + (Clear): Now deletes __pFrameDef is it was dynamically created. + +2000-04-10 Monday 00:37 eldamitri + + * src/id3/field.cpp (1.18): Added implementation for DEFAULT. + +2000-04-10 Monday 00:36 eldamitri + + * include/id3/header_frame.h (1.7): (class ID3_FrameHeader): Added + destructor and new method SetUnknownFrame(const char*) for creating + a frame with an unknown frame id. Added __bDynFrameDef member, set + when __pFrameDef has been dynamically created. + +2000-04-10 Monday 00:34 eldamitri + + * include/id3/field.h (1.11): (struct ID3_FieldDef): Added DEFAULT. + (struct ID3_FrameDef): Made text id's fixed length char arrays + rather than char ptrs. + +2000-04-09 Sunday 16:07 eldamitri + + * configure.in (1.18): Added check for mkstemp. + +2000-04-09 Sunday 16:07 eldamitri + + * config.h.win32.in (1.2, rel-3-7-1, rel-3-7-0): Updated for + HAVE_MKSTEMP, which it doesn't define, but it's at least + comprehensive. + +2000-04-09 Sunday 16:05 eldamitri + + * Makefile.am (1.10): + (config.h.win32): Fixed bug in creating config.h.win32. + (release): Added. Creates id3lib-$(VERSION).tar.gz and + id3lib-$(VERSION).zip. + (snapshot): Added. Created id3lib-$(DATE).tar.gz and + id3lib-$(DATE).zip + +2000-04-09 Sunday 16:03 eldamitri + + * src/id3/tag_render.cpp (1.20, rel-3-7-0): + (RenderV2ToHandle): Changed conditional from '#if defined WIN32' to + '#if !defined HAVE_MKSTEMP'. + +2000-04-08 Saturday 06:49 eldamitri + + * configure.in (1.17): Updated to version 3.7.0, per Kamran's + + (MusicMatch) suggestion. Other minor updates. + +2000-04-08 Saturday 06:47 eldamitri + + * Makefile.am (1.9): Updated for config.h.win32. + +2000-04-08 Saturday 06:45 eldamitri + + * zlib/prj/zlib.dsp (1.2), prj/id3lib.dsp (1.2), prj/id3lib.dsw + (1.2): Updated for Visual C++ 6.0. + +2000-04-08 Saturday 06:44 eldamitri + + * src/id3/tag_render.cpp (1.19): Changed new ANSI-standard C++ + include headers to old-style headers. + (RenderV2ToHandle): Added conditional code for rendering in windows. + +2000-04-08 Saturday 06:41 eldamitri + + * src/id3/tag_file.cpp (1.16): Changed new ANSI-standard C++ + include headers to old-style headers. Fixed minor problems for + windows. + +2000-04-08 Saturday 06:40 eldamitri + + * src/id3/misc_support.cpp (1.21): Changed new ANSI-standard C++ + include headers to old-style headers. + (ID3_GetString): Removed variable name to prevent warning in + windows. + +2000-04-08 Saturday 06:35 eldamitri + + * src/id3/: field.cpp (1.17), frame.cpp (1.14, rel-3-7-0): Changed + new ANSI-standard C++ include headers to old-style headers. Fixed + return bug in operator=. + +2000-04-08 Saturday 06:33 eldamitri + + * src/id3/dll_wrapper.cpp (1.14, rel-3-7-0): Changed new + ANSI-standard C++ include headers to old-style headers. Updated + ID3_VerInfo to represent major, minor, and patch versions. + +2000-04-08 Saturday 06:32 eldamitri + + * include/id3/field.h (1.10), include/id3/int28.h (1.8, rel-3-7-0), + include/id3/tag.h (1.11), src/id3/error.cpp (1.13, rel-3-7-0), + src/id3/field_string_ascii.cpp (1.19), + src/id3/field_string_unicode.cpp (1.16, rel-3-7-0), + src/id3/frame_render.cpp (1.13, rel-3-7-0), src/id3/header.cpp + (1.13), src/id3/header_frame.cpp (1.13), src/id3/header_tag.cpp + (1.13), src/id3/tag_parse.cpp (1.17), src/id3/tag_parse_lyrics3.cpp + (1.12, rel-3-7-0), src/id3/tag_parse_v1.cpp (1.15, rel-3-7-0): + Changed new ANSI-standard C++ include headers to old-style headers. + +2000-04-08 Saturday 06:30 eldamitri + + * config.h.win32.in (1.1, rel-3-7-10): Initial release. + +2000-04-07 Friday 21:35 eldamitri + + * include/id3/tag.h (1.10): Added HasV1Tag, HasV2Tag, and HasLyrics + (thanks John Adcock). + +2000-04-07 Friday 21:07 eldamitri + + * include/id3/dll.h (1.5, rel-3-7-0): Added extern "C" + +2000-04-07 Friday 06:47 eldamitri + + * src/id3/Makefile.am (1.10, rel-3-7-0): Updated versioning macros, + ala glib (http://www.gtk.org). Also added a few more tests. + +2000-04-07 Friday 06:46 eldamitri + + * configure.in (1.16): Changed occurrences of 'micro' to 'patch'. + +2000-04-07 Friday 06:45 eldamitri + + * include/id3/: error.h (1.5), field.h (1.9), int28.h (1.7), + misc_support.h (1.10, rel-3-7-0), tag.h (1.9), types.h (1.6, + rel-3-7-0): Minor cleanup for log comments. + +2000-04-07 Friday 06:40 eldamitri + + * include/id3/version.h (1.4), src/id3/version.cpp (1.5, + rel-3-7-0): Changed the version functions to reflect the name + change of release and revision to major and minor. + +2000-04-07 Friday 06:29 eldamitri + + * include/id3/tag.h (1.8), src/id3/tag_file.cpp (1.15), + src/id3/tag_parse.cpp (1.16): Added optional parameters to Link to + make parsing of id3v1/lyrics3 tags optional. + +2000-04-06 Thursday 23:19 eldamitri + + * README (1.6, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0), THANKS (1.4): Updated with + current information. + +2000-04-06 Thursday 21:36 eldamitri + + * Makefile.am (1.8): + * Makefile.am: Put in version requirement for automake (1.4). + +2000-04-06 Thursday 21:35 eldamitri + + * configure.in (1.15): Updated versioning macros, ala glib + (http://www.gtk.org). Also added a few more tests. + +2000-04-06 Thursday 21:34 eldamitri + + * HISTORY (1.2, rel-3-0-6pre1): Added note to refer to ChangeLog + for changes since 3.05a. + +2000-04-06 Thursday 21:34 eldamitri + + * AUTHORS (1.5): Updated to reflect MusicMatch's release of project + direction. + +2000-04-06 Thursday 01:59 eldamitri + + * reconf (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0): Now calls local acconfig. + +2000-04-06 Thursday 01:59 eldamitri + + * acconfig (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0): Recommitted. + +2000-04-05 Wednesday 07:20 eldamitri + + * include/id3/dll.h (1.4), include/id3/error.h (1.4), + include/id3/externals.h (1.3, rel-3-7-0), include/id3/field.h + (1.8), include/id3/frame.h (1.7), include/id3/globals.h (1.6), + include/id3/header.h (1.6), include/id3/header_frame.h (1.6), + include/id3/header_tag.h (1.5), include/id3/int28.h (1.6), + include/id3/misc_support.h (1.9), include/id3/sized_types.h (1.3, + rel-3-7-0), include/id3/tag.h (1.7), include/id3/types.h (1.5), + include/id3/version.h (1.3), src/id3/dll_wrapper.cpp (1.13), + src/id3/error.cpp (1.12), src/id3/field.cpp (1.16), + src/id3/field_binary.cpp (1.12), src/id3/field_integer.cpp (1.13), + src/id3/field_string_ascii.cpp (1.18), + src/id3/field_string_unicode.cpp (1.15), src/id3/frame.cpp (1.13), + src/id3/frame_parse.cpp (1.12, rel-3-7-0), src/id3/frame_render.cpp + (1.12), src/id3/header.cpp (1.12), src/id3/header_frame.cpp (1.12), + src/id3/header_tag.cpp (1.12), src/id3/int28.cpp (1.11), + src/id3/misc_support.cpp (1.20), src/id3/tag.cpp (1.14, rel-3-7-0), + src/id3/tag_file.cpp (1.14), src/id3/tag_find.cpp (1.12), + src/id3/tag_parse.cpp (1.15), src/id3/tag_parse_lyrics3.cpp (1.11), + src/id3/tag_parse_v1.cpp (1.14), src/id3/tag_render.cpp (1.18), + src/id3/tag_sync.cpp (1.10, rel-3-7-0), src/id3/version.cpp (1.4): + Updated initial comment information to reflect license, copyright + change. + +2000-04-05 Wednesday 07:09 eldamitri + + * COPYING (1.5, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0): Switched to the LGPL. + +2000-03-03 Friday 21:58 eldamitri + + * orig/dll/: id3lib.dll, id3lib.exp, id3lib.h, id3lib.lib, + readme.txt (rel-3-1.[1,1,1,1,1]): Removed + +2000-03-03 Friday 21:57 eldamitri + + * examples/Makefile.am (rel-3-1.2): Updated for development branch. + +2000-03-03 Friday 21:22 eldamitri + + * include/id3/Makefile.in (rel-3-1.3): Removed - automatically + generated + +2000-03-02 Thursday 23:17 eldamitri + + * examples/test_uint28.cpp (1.1): file test_uint28.cpp was + initially added on branch rel-3-1. + +2000-03-02 Thursday 23:17 eldamitri + + * examples/test_tag.cpp (1.1): file test_tag.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 23:17 eldamitri + + * examples/test_lib.cpp (1.1): file test_lib.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 23:17 eldamitri + + * examples/test_frame.cpp (1.1): file test_frame.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 23:17 eldamitri + + * examples/test_file.cpp (1.1): file test_file.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 23:14 eldamitri + + * examples/: demo_convert.cpp, demo_info.cpp, demo_main.cpp, + demo_tag.cpp, readme.txt (rel-3-1.[2,2,2,2,2]): Removed + +2000-03-02 Thursday 22:37 eldamitri + + * acconfig (1.1): file acconfig was initially added on branch + rel-3-1. + +2000-03-02 Thursday 22:36 eldamitri + + * Makefile.am, configure.in (rel-3-1.[1,1]): Updated for + development branch + +2000-03-02 Thursday 22:24 eldamitri + + * include/id3/uint28.h (1.1): file uint28.h was initially added on + branch rel-3-1. + +2000-03-02 Thursday 22:24 eldamitri + + * include/id3/tag_header.h (1.1): file tag_header.h was initially + added on branch rel-3-1. + +2000-03-02 Thursday 22:24 eldamitri + + * include/id3/tag_find.h (1.1): file tag_find.h was initially added + on branch rel-3-1. + +2000-03-02 Thursday 22:24 eldamitri + + * include/id3/macros.h (1.1): file macros.h was initially added on + branch rel-3-1. + +2000-03-02 Thursday 22:24 eldamitri + + * include/id3/lib.h (1.1): file lib.h was initially added on branch + rel-3-1. + +2000-03-02 Thursday 22:24 eldamitri + + * include/id3/genre.h (1.1): file genre.h was initially added on + branch rel-3-1. + +2000-03-02 Thursday 22:24 eldamitri + + * include/id3/frame_header.h (1.1): file frame_header.h was + initially added on branch rel-3-1. + +2000-03-02 Thursday 22:23 eldamitri + + * include/id3/frame_def.h (1.1): file frame_def.h was initially + added on branch rel-3-1. + +2000-03-02 Thursday 22:23 eldamitri + + * include/id3/enums.h (1.1): file enums.h was initially added on + branch rel-3-1. + +2000-03-02 Thursday 22:23 eldamitri + + * include/id3/details.h (1.1): file details.h was initially added + on branch rel-3-1. + +2000-03-02 Thursday 22:23 eldamitri + + * include/id3/debug.h (1.1): file debug.h was initially added on + branch rel-3-1. + +2000-03-02 Thursday 22:23 eldamitri + + * include/id3/conversion_ops.h (1.1): file conversion_ops.h was + initially added on branch rel-3-1. + +2000-03-02 Thursday 22:23 eldamitri + + * include/id3/constants.h (1.1): file constants.h was initially + added on branch rel-3-1. + +2000-03-02 Thursday 22:23 eldamitri + + * include/id3/common_ops.h (1.1): file common_ops.h was initially + added on branch rel-3-1. + +2000-03-02 Thursday 22:21 eldamitri + + * include/id3/Makefile.in, include/id3/Makefile.in, + include/id3/common_ops.h, include/id3/constants.h, + include/id3/conversion_ops.h, include/id3/debug.h, + include/id3/details.h, include/id3/enums.h, + include/id3/frame_def.h, include/id3/frame_header.h, + include/id3/genre.h, include/id3/lib.h, include/id3/macros.h, + include/id3/tag_find.h, include/id3/tag_header.h, + include/id3/uint28.h, acconfig, examples/test_file.cpp, + examples/test_frame.cpp, examples/test_lib.cpp, + examples/test_tag.cpp, examples/test_uint28.cpp + (rel-3-1.[1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]): Initial + revision + +2000-03-02 Thursday 22:20 eldamitri + + * include/id3/: Makefile.am, field.h, frame.h, header.h, + sized_types.h, tag.h, types.h (rel-3-1.[1,1,1,1,1,1,1]): Complete + rewrite for developer branch + +2000-03-02 Thursday 22:13 eldamitri + + * include/id3/: dll.h, error.h, externals.h, globals.h, + header_frame.h, header_tag.h, int28.h, misc_support.h, version.h + (rel-3-1.[1,1,1,1,1,1,1,1,1]): Removed + +2000-03-02 Thursday 21:35 eldamitri + + * src/Makefile.am (rel-3-1.3): Updated for development branch + +2000-03-02 Thursday 21:09 eldamitri + + * src/uint28.cpp (1.1): file uint28.cpp was initially added on + branch rel-3-1. + +2000-03-02 Thursday 21:09 eldamitri + + * src/text_field.cpp (1.1): file text_field.cpp was initially added + on branch rel-3-1. + +2000-03-02 Thursday 21:09 eldamitri + + * src/tag_header.cpp (1.1): file tag_header.cpp was initially added + on branch rel-3-1. + +2000-03-02 Thursday 21:09 eldamitri + + * src/lib.cpp (1.1): file lib.cpp was initially added on branch + rel-3-1. + +2000-03-02 Thursday 21:08 eldamitri + + * src/integer_field.cpp (1.1): file integer_field.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 21:08 eldamitri + + * src/genre.cpp (1.1): file genre.cpp was initially added on branch + rel-3-1. + +2000-03-02 Thursday 21:08 eldamitri + + * src/frame_header.cpp (1.1): file frame_header.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 21:08 eldamitri + + * src/frame_defs.cpp (1.1): file frame_defs.cpp was initially added + on branch rel-3-1. + +2000-03-02 Thursday 21:08 eldamitri + + * src/field_defs.cpp (1.1): file field_defs.cpp was initially added + on branch rel-3-1. + +2000-03-02 Thursday 21:08 eldamitri + + * src/details.cpp (1.1): file details.cpp was initially added on + branch rel-3-1. + +2000-03-02 Thursday 21:08 eldamitri + + * src/debug.cpp (1.1): file debug.cpp was initially added on branch + rel-3-1. + +2000-03-02 Thursday 21:08 eldamitri + + * src/conversion_ops.cpp (1.1): file conversion_ops.cpp was + initially added on branch rel-3-1. + +2000-03-02 Thursday 21:07 eldamitri + + * src/common_ops.cpp (1.1): file common_ops.cpp was initially added + on branch rel-3-1. + +2000-03-02 Thursday 21:07 eldamitri + + * src/: binary_field.cpp, common_ops.cpp, conversion_ops.cpp, + debug.cpp, details.cpp, field_defs.cpp, frame_defs.cpp, + frame_header.cpp, genre.cpp, integer_field.cpp, lib.cpp, + tag_header.cpp, text_field.cpp, uint28.cpp + (rel-3-1.[1,1,1,1,1,1,1,1,1,1,1,1,1,1]): Initial revision + +2000-03-02 Thursday 21:07 eldamitri + + * src/binary_field.cpp (1.1): file binary_field.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 21:05 eldamitri + + * src/: field.cpp, frame.cpp, header.cpp, tag.cpp + (rel-3-1.[2,2,2,2]): Complete rewrite for developer branch + +2000-03-02 Thursday 20:45 eldamitri + + * src/: dll_wrapper.cpp, error.cpp, field_binary.cpp, + field_integer.cpp, field_string_ascii.cpp, + field_string_unicode.cpp, frame_parse.cpp, frame_render.cpp, + header_frame.cpp, header_tag.cpp, int28.cpp, misc_support.cpp, + tag_file.cpp, tag_find.cpp, tag_parse.cpp, tag_parse_lyrics3.cpp, + tag_parse_v1.cpp, tag_render.cpp, tag_sync.cpp, version.cpp + (rel-3-1.[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]): Removed + +2000-03-02 Thursday 20:23 eldamitri + + * src/: .cvsignore, id3/.cvsignore (rel-3-1.[1,1]): Moved from + src/id3/ to src/ + +2000-03-02 Thursday 20:18 eldamitri + + * src/version.cpp (1.1): file version.cpp was initially added on + branch rel-3-1. + +2000-03-02 Thursday 20:18 eldamitri + + * src/tag_sync.cpp (1.1): file tag_sync.cpp was initially added on + branch rel-3-1. + +2000-03-02 Thursday 20:18 eldamitri + + * src/tag_render.cpp (1.1): file tag_render.cpp was initially added + on branch rel-3-1. + +2000-03-02 Thursday 20:18 eldamitri + + * src/tag_parse_v1.cpp (1.1): file tag_parse_v1.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/tag_parse_lyrics3.cpp (1.1): file tag_parse_lyrics3.cpp was + initially added on branch rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/tag_parse.cpp (1.1): file tag_parse.cpp was initially added + on branch rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/tag_find.cpp (1.1): file tag_find.cpp was initially added on + branch rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/tag_file.cpp (1.1): file tag_file.cpp was initially added on + branch rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/tag.cpp (1.1): file tag.cpp was initially added on branch + rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/misc_support.cpp (1.1): file misc_support.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/int28.cpp (1.1): file int28.cpp was initially added on branch + rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/header_tag.cpp (1.1): file header_tag.cpp was initially added + on branch rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/header_frame.cpp (1.1): file header_frame.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/header.cpp (1.1): file header.cpp was initially added on + branch rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/frame_render.cpp (1.1): file frame_render.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 20:17 eldamitri + + * src/frame_parse.cpp (1.1): file frame_parse.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 20:16 eldamitri + + * src/frame.cpp (1.1): file frame.cpp was initially added on branch + rel-3-1. + +2000-03-02 Thursday 20:16 eldamitri + + * src/field_string_unicode.cpp (1.1): file field_string_unicode.cpp + was initially added on branch rel-3-1. + +2000-03-02 Thursday 20:16 eldamitri + + * src/field_string_ascii.cpp (1.1): file field_string_ascii.cpp was + initially added on branch rel-3-1. + +2000-03-02 Thursday 20:16 eldamitri + + * src/field_integer.cpp (1.1): file field_integer.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 20:16 eldamitri + + * src/field.cpp (1.1): file field.cpp was initially added on branch + rel-3-1. + +2000-03-02 Thursday 20:16 eldamitri + + * src/field_binary.cpp (1.1): file field_binary.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 20:16 eldamitri + + * src/error.cpp (1.1): file error.cpp was initially added on branch + rel-3-1. + +2000-03-02 Thursday 20:16 eldamitri + + * src/: dll_wrapper.cpp, id3/dll_wrapper.cpp, error.cpp, + id3/error.cpp, field_binary.cpp, id3/field_binary.cpp, field.cpp, + id3/field.cpp, id3/field_integer.cpp, field_integer.cpp, + field_string_ascii.cpp, id3/field_string_ascii.cpp, + field_string_unicode.cpp, id3/field_string_unicode.cpp, frame.cpp, + id3/frame.cpp, frame_parse.cpp, id3/frame_parse.cpp, + frame_render.cpp, id3/frame_render.cpp, header.cpp, id3/header.cpp, + header_frame.cpp, id3/header_frame.cpp, header_tag.cpp, + id3/header_tag.cpp, int28.cpp, id3/int28.cpp, Makefile.am, + id3/Makefile.am, misc_support.cpp, id3/misc_support.cpp, tag.cpp, + id3/tag.cpp, tag_file.cpp, id3/tag_file.cpp, tag_find.cpp, + id3/tag_find.cpp, tag_parse.cpp, id3/tag_parse.cpp, + tag_parse_lyrics3.cpp, id3/tag_parse_lyrics3.cpp, tag_parse_v1.cpp, + id3/tag_parse_v1.cpp, tag_render.cpp, id3/tag_render.cpp, + tag_sync.cpp, id3/tag_sync.cpp, version.cpp, id3/version.cpp + (rel-3-1.[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2 + ,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]): Moved from src/id3/ + to rc/ + +2000-03-02 Thursday 20:16 eldamitri + + * src/dll_wrapper.cpp (1.1): file dll_wrapper.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 20:09 eldamitri + + * src/Makefile.am (rel-3-1.1): No longer has current directory + structure + +2000-03-02 Thursday 20:06 eldamitri + + * examples/.cvsignore (1.1): file .cvsignore was initially added on + branch rel-3-1. + +2000-03-02 Thursday 19:47 eldamitri + + * COPYING (rel-3-1.1): Updated to LGPL + +2000-03-02 Thursday 19:32 eldamitri + + * src/examples/221-compressed.tag, src/examples/230-compressed.tag, + src/examples/230-picture.tag, src/examples/230-unicode.tag, + src/examples/demo_convert.cpp, src/examples/demo_info.cpp, + src/examples/demo_main.cpp, src/examples/demo_tag.cpp, + src/examples/jules-badtag.mp3, src/examples/jules-goodtag.mp3, + src/examples/jules.mp3, src/examples/Makefile.am, + src/examples/readme.txt, examples/.cvsignore, + src/examples/.cvsignore (rel-3-1.[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]): + Moved from src/examples/ to examples/ + +2000-03-02 Thursday 18:46 eldamitri + + * examples/readme.txt (rel-3-1.1): Moved readme.txt from + src/examples/ to examples/ + +2000-03-02 Thursday 18:46 eldamitri + + * examples/readme.txt (1.1): file readme.txt was initially added on + branch rel-3-1. + +2000-03-02 Thursday 18:46 eldamitri + + * examples/Makefile.am (rel-3-1.1): Moved Makefile.am from + src/examples/ to examples/ + +2000-03-02 Thursday 18:46 eldamitri + + * examples/Makefile.am (1.1): file Makefile.am was initially added + on branch rel-3-1. + +2000-03-02 Thursday 18:45 eldamitri + + * examples/jules.mp3 (1.1): file jules.mp3 was initially added on + branch rel-3-1. + +2000-03-02 Thursday 18:45 eldamitri + + * examples/jules.mp3 (rel-3-1.1): Moved jules.mp3 from + src/examples/ to examples/ + +2000-03-02 Thursday 18:45 eldamitri + + * examples/jules-goodtag.mp3 (1.1): file jules-goodtag.mp3 was + initially added on branch rel-3-1. + +2000-03-02 Thursday 18:45 eldamitri + + * examples/jules-goodtag.mp3 (rel-3-1.1): Moved jules-goodtag.mp3 + from src/examples/ to examples/ + +2000-03-02 Thursday 18:45 eldamitri + + * examples/jules-badtag.mp3 (1.1): file jules-badtag.mp3 was + initially added on branch rel-3-1. + +2000-03-02 Thursday 18:45 eldamitri + + * examples/jules-badtag.mp3 (rel-3-1.1): Moved jules-badtag.mp3 + from src/examples/ to examples/ + +2000-03-02 Thursday 18:44 eldamitri + + * examples/demo_tag.cpp (rel-3-1.1): Moved demo_tag.cpp from + src/examples/ to examples/ + +2000-03-02 Thursday 18:44 eldamitri + + * examples/demo_tag.cpp (1.1): file demo_tag.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 18:44 eldamitri + + * examples/demo_main.cpp (1.1): file demo_main.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 18:44 eldamitri + + * examples/demo_main.cpp (rel-3-1.1): Moved demo_main.cpp from + src/examples/ to examples/ + +2000-03-02 Thursday 18:43 eldamitri + + * examples/demo_info.cpp (rel-3-1.1): Moved demo_info.cpp from + src/examples/ to examples/ + +2000-03-02 Thursday 18:43 eldamitri + + * examples/demo_info.cpp (1.1): file demo_info.cpp was initially + added on branch rel-3-1. + +2000-03-02 Thursday 18:43 eldamitri + + * examples/demo_convert.cpp (1.1): file demo_convert.cpp was + initially added on branch rel-3-1. + +2000-03-02 Thursday 18:43 eldamitri + + * examples/demo_convert.cpp (rel-3-1.1): Moved demo_convert.cpp + from src/examples/ to examples/ + +2000-03-02 Thursday 18:43 eldamitri + + * examples/230-unicode.tag (1.1): file 230-unicode.tag was + initially added on branch rel-3-1. + +2000-03-02 Thursday 18:43 eldamitri + + * examples/230-unicode.tag (rel-3-1.1): Moved 230-unicode.tag from + src/examples/ to examples/ + +2000-03-02 Thursday 18:42 eldamitri + + * examples/230-picture.tag (rel-3-1.1): Moved 230-picture.tag from + src/examples/ to examples/ + +2000-03-02 Thursday 18:42 eldamitri + + * examples/230-picture.tag (1.1): file 230-picture.tag was + initially added on branch rel-3-1. + +2000-03-02 Thursday 18:42 eldamitri + + * examples/230-compressed.tag (1.1): file 230-compressed.tag was + initially added on branch rel-3-1. + +2000-03-02 Thursday 18:42 eldamitri + + * examples/230-compressed.tag (rel-3-1.1): Moved 230-compressed.tag + from src/examples/ to examples/ + +2000-03-02 Thursday 18:42 eldamitri + + * examples/221-compressed.tag (1.1): file 221-compressed.tag was + initially added on branch rel-3-1. + +2000-03-02 Thursday 18:42 eldamitri + + * examples/221-compressed.tag (rel-3-1.1): Moved 221-compressed.tag + from src/examples/ to examples/ + +2000-01-04 Tuesday 17:38 eldamitri + + * configure.in (1.14): Removed AC_C_CONST and AC_C_INLINE checks, + since we're using a C++ compiler and these check against the C + compiler. + +2000-01-04 Tuesday 17:33 eldamitri + + * src/id3/Makefile.am (1.9): + (the_sources): Moved dll_wrapper.cpp to EXTRA_DIST. + +2000-01-04 Tuesday 16:42 eldamitri + + * include/id3/field.h (1.7), include/id3/int28.h (1.5), + include/id3/misc_support.h (1.8), include/id3/tag.h (1.6), + include/id3/types.h (1.4), src/id3/dll_wrapper.cpp (1.12), + src/id3/error.cpp (1.11), src/id3/field.cpp (1.15), + src/id3/field_binary.cpp (1.11), src/id3/field_integer.cpp (1.12), + src/id3/field_string_ascii.cpp (1.17), + src/id3/field_string_unicode.cpp (1.14), src/id3/frame.cpp (1.12), + src/id3/frame_parse.cpp (1.11), src/id3/frame_render.cpp (1.11), + src/id3/header.cpp (1.11), src/id3/header_frame.cpp (1.11), + src/id3/header_tag.cpp (1.11), src/id3/int28.cpp (1.10), + src/id3/misc_support.cpp (1.19), src/id3/tag.cpp (1.13), + src/id3/tag_file.cpp (1.13), src/id3/tag_find.cpp (1.11), + src/id3/tag_parse.cpp (1.14), src/id3/tag_parse_lyrics3.cpp (1.10), + src/id3/tag_parse_v1.cpp (1.13), src/id3/tag_render.cpp (1.17), + src/id3/tag_sync.cpp (1.9), src/id3/version.cpp (1.3): + * include/id3/field.h: + * include/id3/int28.h: + * include/id3/misc_support.h: + * include/id3/tag.h: + * include/id3/types.h: + * src/id3/dll_wrapper.cpp + * src/id3/error.cpp + * src/id3/field.cpp + * src/id3/field_binary.cpp + * src/id3/field_integer.cpp + * src/id3/field_string_ascii.cpp + * src/id3/field_string_unicode.cpp + * src/id3/frame.cpp + * src/id3/frame_parse.cpp + * src/id3/frame_render.cpp + * src/id3/header.cpp + * src/id3/header_frame.cpp + * src/id3/header_tag.cpp + * src/id3/int28.cpp + * src/id3/misc_support.cpp + * src/id3/tag.cpp + * src/id3/tag_file.cpp: + * src/id3/tag_find.cpp: + * src/id3/tag_parse.cpp: + * src/id3/tag_parse_lyrics3.cpp: For compilation with gcc 2.95.2 and + better compatibility with ANSI/ISO standard C++, updated, + rearranged, and removed (where necessary) #include directives. + +1999-12-27 Monday 07:15 scott + + * configure.in (1.13), config.win32 (1.4, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0): Changed release information from 3.6.2 to 3.0.6, to + prepare for future MusicMatch release to happen Real Soon Now. + +1999-12-27 Monday 07:14 scott + + * include/id3/frame.h (1.6): (class ID3_Frame): Added declaration + for constructor which accepts a frame header to copy. Removed + redundant data members that are now encapsulated within new frame + header member. Added declaration for new methods InitFields and + InitFieldBits. + +1999-12-27 Monday 07:11 scott + + * include/id3/header.h (1.5): + (ID3_VERSION, ID3_REVISION): Renamed to ID3v2_* (class ID3_Header): + Added declarations for GetVersion, GetRevision, AddFlags, SetFlags, + Clear, Copy, and operator= methods. Changed return type for Size + and Render from luint to size_t. + +1999-12-27 Monday 07:09 scott + + * include/id3/header_frame.h (1.5): + (ID3_FrameAttr): Removed. (class ID3_FrameHeader): Added + declarations for default constructor and Parse, GetFrameID, + GetTextID, GetFrameDef, and Clear methods. Changed return type for + Size and Render. Replaced __eFrameID data member with __pFrameDef, + which encapsulates more information about the frame header. + +1999-12-27 Monday 07:06 scott + + * include/id3/header_tag.h (1.4): + (ID3_TAGIDSIZE): Added constant. (class ID3_TagHeader): Minor + return type changes for Size and Render. + +1999-12-27 Monday 07:05 scott + + * src/id3/frame.cpp (1.11): + (ID3_Frame): Added data member initialization list. Updated to + reflect abstraction of field bits initialization. Added new + constructor which accepts a frame header to copy into the frame. + (InitFieldBits): Added implementation. Abstracted from the + constuctor. + (Clear): Updated to reflect addition of new header data member. + Restructured method so it can be used in more situations. + (InitFields): Added implementation. Abstracted from the SetID + method. + (SetID): Updated to reflect new method abstractions. + (GetID, SetVersion, Size): Updated to reflect new frame header data + member. + +1999-12-27 Monday 06:55 scott + + * src/id3/frame_parse.cpp (1.10): + (Parse): Moved header processing tasks to the header object, now a + member of ID3_Frame. + +1999-12-27 Monday 06:48 scott + + * src/id3/frame_render.cpp (1.10): + (Render): Moved header processing tasks to the header object, now a + member of ID3_Frame. Similar changes made due to removal of + redundant information from frame object. + +1999-12-27 Monday 06:43 scott + + * src/id3/header.cpp (1.10): + (ID3_Header): Updated for new version constants. + (AddFlags): Added implementation. Adds flag(s) to current flags. + (RemoveFlags): Added implementation. Removes flag(s) from current + flags. + (GetVersion): Added implementation. Returns version number of + header. + (GetRevision): Added implementation. Returns revision of header. + (Clear): Added implementation. Clears contents of header. + (operator=): Added implementation. Assignment operator. + (Copy): Added implementation. Copies content of another header. + +1999-12-27 Monday 06:40 scott + + * src/id3/header_frame.cpp (1.10): + (ID3_FrameHeader): Added default constructor. + (SetFrameID): Modified to reflect internal representation change. + Now searches and stores frame definition associated with the frame + id. + (GetFrameInfo): Removed. + (Parse): Added implementation. Based on former GetFrameInfo. + (Render): Modified to reflect internal representation change. + (GetTextID): Added implementation. Gets text id associated with + frame header. + (Copy): Added implementation. Copies another frame header. + (GetFrameID): Added implementation. Gets frame id associated with + frame header. + (GetFrameDef): Added implementation. Gets frame definition + associated with frame header. + (Clear): Added implementation. Clears contents of frame header. + +1999-12-27 Monday 06:32 scott + + * src/id3/header_tag.cpp (1.10): + (Size, Render): Minor return type change. + (ID3_IsTagHeader): Updated for new version constants. + +1999-12-27 Monday 06:30 scott + + * src/id3/tag.cpp (1.12): + (SetupTag): Updated for new version constants. + +1999-12-27 Monday 06:29 scott + + * src/id3/tag_parse.cpp (1.13): + (ExpandBinaries, ProcessBinaries): Moved header processing tasks to + the header object, now a member of ID3_Frame. + +1999-12-27 Monday 06:26 scott + + * src/id3/tag_render.cpp (1.16): + (Render): Updated for new version constants and inclusion of header + in each frame. + +1999-12-26 Sunday 17:40 scott + + * TODO (1.3): Updated to reflect changes made to the library. + +1999-12-26 Sunday 17:40 scott + + * include/id3/misc_support.h (1.7): + (MASK): Defined macro for masking bits. (): Added declarations for + ParseNumber and RenderNumber, for converting between character + arrays and unsigned ints. + +1999-12-26 Sunday 17:40 scott + + * include/id3/int28.h (1.4): (class int28): Restructured. + +1999-12-26 Sunday 17:40 scott + + * include/id3/header_frame.h (1.4): + (ID3FL_READONLY): Renamed from ID3FL_SIGNED. (class + ID3_FrameHeader): Minor cleanup to interface. + +1999-12-26 Sunday 17:40 scott + + * include/id3/header.h (1.4): (class ID3_Header): Minor cleanup to + interface. + +1999-12-26 Sunday 17:40 scott + + * include/id3/frame.h (1.5): (class ID3_Frame): Added bReadOnly + property. + +1999-12-26 Sunday 17:40 scott + + * include/id3/field.h (1.6): (class ID3_Field): Cleaned up + interface to Parse* methods. + +1999-12-26 Sunday 16:11 scott + + * src/id3/tag_parse.cpp (1.12): + (ExpandBinaries): Now uses ParseNumber, defined in misc_support. + (ProcessBinaries): Now uses ParseNumber, defined in misc_support. + (Parse): Now uses ParseNumber, defined in misc_support. + +1999-12-26 Sunday 16:11 scott + + * src/id3/misc_support.cpp (1.18): + (ParseNumber): Defined. Converts a character buffer up to 4 bytes + in size into its equivalent big-endian integer equivalent. + (RenderNumber): Defined. Converts an integer into an equivalent + big-endian binary character array, up to 4 bytes in length. + +1999-12-26 Sunday 16:11 scott + + * src/id3/int28.cpp (1.9): + (set): Now uses ParseNumber, defined in misc_support. Restructured + code. + +1999-12-26 Sunday 16:11 scott + + * src/id3/header_frame.cpp (1.9): + (GetFrameInfo): Now uses ParseNumber, defined in misc_support. + (Render): Now uses RenderNumber, defined in misc_support. + +1999-12-26 Sunday 16:11 scott + + * src/id3/header.cpp (1.9): + (GetDataSize): Added implementation. + (GetFlags): Added implementation. + +1999-12-26 Sunday 16:11 scott + + * src/id3/: frame_render.cpp (1.9), header_tag.cpp (1.9): + (Render): Now uses RenderNumber, defined in misc_support. + +1999-12-26 Sunday 16:10 scott + + * src/id3/field_integer.cpp (1.11): + (ParseInteger): Now uses ParseNumber, defined in misc_support. + (RenderInteger): Now uses RenderNumber, defined in misc_support. + +1999-12-26 Sunday 16:10 scott + + * src/id3/: field_binary.cpp (1.10), field_string_ascii.cpp (1.16), + field_string_unicode.cpp (1.13), frame.cpp (1.10), frame_parse.cpp + (1.9): Minor reformatting. + +1999-12-26 Sunday 01:33 scott + + * src/id3/tag_render.cpp (1.15): Minor comment change. + +1999-12-26 Sunday 01:33 scott + + * src/id3/field.cpp (1.14): (): Updated list of implemented and + unimplemented frames to include their id3lib frame id, id3v2.2 id, + and www.id3.org description. + (ID3FD_Unimplemented): Added for unimplemented frames so that their + data is preseved when parsing and rendering. + (ID3_FrameDefs): Added entries for new frames, using + ID3FD_Unimplemented as frame definition. Updated renamed entries. + +1999-12-26 Sunday 01:29 scott + + * src/examples/demo_info.cpp (1.6): + (GetDescription): Reformatted. Descriptions now match those from + www.id3.org. Added descriptions for new frame id's. + (PrintInformation): Updated for added frames. Now handles + unimplemented frames. + +1999-12-26 Sunday 01:26 scott + + * src/examples/demo_convert.cpp (1.10, rel-3-7-0): + (PrintUsage): Included new padding option. + (main): Added new option for padding the tag. + +1999-12-26 Sunday 01:23 scott + + * include/id3/globals.h (1.5): + (ID3_FieldID): Reformatted. + (ID3_FrameID): Reformatted. Commented descriptions from + www.id3.org. Renamed some frame id's: ID3FID_KEY -> + ID3FID_INITIALKEY, ID3FID_BEATSPERMINUTE -> ID3FID_BPM, ID3FID_OWNER + -> ID3FID_FILEOWNER. Added new frame id's: ID3FID_AUDIOCRYPTO + + (AENC/CRA), ID3FID_COMMERCIAL (COMR/), ID3FID_EQUALIZATION + + (EQUA/EQU), ID3FID_EVENTTIMING (ETCO/ETC), ID3FID_CDID (MCDI/MCI), + ID3FID_MPEGLOOKUP (MLLT/MLL), ID3FID_OWNERSHIP (OWNE/), + ID3FID_POSITIONSYNC (POSS/), ID3FID_PRIVATE (PRIV/) + ID3FID_BUFFERSIZE (RBUF/BUF), ID3FID_VOLUMEADJ (RVAD/RVA), + ID3FID_SYNCEDLYRICS (SYLT/SLT), ID3FID_SYNCEDTEMPO (SYTC/STC), + ID3FID_METACRYPTO (/CRM). + +1999-12-23 Thursday 16:56 scott + + * src/id3/field_string_ascii.cpp (1.15), ChangeLog (1.24): + (RenderASCIIString): Rewrote the function so that it doesn't create + temporary dynamic storage, and so that it copies the number of + characters, not the number of bytes, in the string. + +1999-12-23 Thursday 16:56 scott + + * src/examples/demo_tag.cpp (1.3, rel-3-7-0): Fixed a bug which + prevented comment descriptions from being added. Added check and + include for config.h. + +1999-12-23 Thursday 16:56 scott + + * src/examples/: demo_convert.cpp (1.9), demo_info.cpp (1.5): Added + check and include for config.h. + +1999-12-17 Friday 17:22 scott + + * THANKS (1.3): Updated with thanks for those of who have submitted + recent bugfixes. + +1999-12-17 Friday 17:22 scott + + * README (1.5): Removed BRIEF HISTORY. Fixed typos in FURTHER + READING. Added CONTACT information. Added original contact.txt + information. + +1999-12-17 Friday 17:22 scott + + * COPYING (1.4): Named MusicMatch as project coordinator. + +1999-12-17 Friday 17:21 scott + + * AUTHORS (1.4): + * AUTHORS: Listed MusicMatch as contact project maintainer. Moved + contact.txt info to README. + +1999-12-17 Friday 17:12 scott + + * src/id3/tag_sync.cpp (1.8): Updated opening comment block. + (ShouldUnsync): Added for use with GetUnSyncSize and UnSync. + (ReSync, GetUnSyncSize, UnSync): Renamed variables. Restructured + code. + +1999-12-17 Friday 17:05 scott + + * include/id3/dll.h (1.3), include/id3/error.h (1.3), + include/id3/externals.h (1.2), include/id3/field.h (1.5), + include/id3/frame.h (1.4), include/id3/globals.h (1.4), + include/id3/header.h (1.3), include/id3/header_frame.h (1.3), + include/id3/header_tag.h (1.3), include/id3/int28.h (1.3), + include/id3/misc_support.h (1.6), include/id3/sized_types.h (1.2), + include/id3/tag.h (1.5), include/id3/types.h (1.3), + include/id3/version.h (1.2), src/id3/dll_wrapper.cpp (1.11), + src/id3/error.cpp (1.10), src/id3/field.cpp (1.13), + src/id3/field_binary.cpp (1.9), src/id3/field_integer.cpp (1.10), + src/id3/field_string_ascii.cpp (1.14), + src/id3/field_string_unicode.cpp (1.12), src/id3/frame.cpp (1.9), + src/id3/frame_parse.cpp (1.8), src/id3/frame_render.cpp (1.8), + src/id3/header.cpp (1.8), src/id3/header_frame.cpp (1.8), + src/id3/header_tag.cpp (1.8), src/id3/int28.cpp (1.8), + src/id3/misc_support.cpp (1.17), src/id3/tag.cpp (1.11), + src/id3/tag_file.cpp (1.12), src/id3/tag_find.cpp (1.10), + src/id3/tag_parse.cpp (1.11), src/id3/tag_parse_lyrics3.cpp (1.9), + src/id3/tag_parse_v1.cpp (1.12), src/id3/tag_render.cpp (1.14), + src/id3/version.cpp (1.2): Updated opening comment block. + +1999-12-16 Thursday 15:40 scott + + * src/id3/tag_parse_v1.cpp (1.11), ChangeLog (1.22): Fixed + inclusion config.h (thanks Alexander Voronin). + +1999-12-16 Thursday 15:40 scott + + * src/id3/tag_parse_lyrics3.cpp (1.8): + (ID3_CRLFtoLF): Fixed memory allocation bug (thanks Alexander + Voronin). + +1999-12-16 Thursday 15:39 scott + + * src/id3/tag_render.cpp (1.13): Minor formatting cleanup. + +1999-12-15 Wednesday 07:38 scott + + * ChangeLog (1.21): Added ChangeLog entries from before 11/15/1999 + rom cvs log. + +1999-12-15 Wednesday 07:37 scott + + * include/id3/field.h (1.4): Reformatted some comments. + +1999-12-15 Wednesday 07:36 scott + + * src/id3/field_string_ascii.cpp (1.13): + (ParseASCIIString): Better comment for assigning bytesUsed. + +1999-12-13 Monday 17:49 scott + + * src/id3/tag_parse.cpp (1.10): Minor code cleanup. + +1999-12-13 Monday 06:26 scott + + * configure.in (1.12): + (AC_HAVE_HEADERS): Added check for sys/param.h. + +1999-12-13 Monday 06:26 scott + + * config.win32 (1.3): Added definition of MAXPATHLEN. + +1999-12-13 Monday 06:24 scott + + * src/id3/field.cpp (1.12): + (ID3FD_TermsOfUse): Added for defining USER frame. + (ID3FD_LinkedInfo): Added for defining LINK frame. (): Added + comments that detail which frames are defined and which aren't. + (ID3_FrameDefs): Added definitions for the following new frames: + ID3FID_LINKEDINFO, ID3FID_BEATSPERMINUTE, ID3FID_PLAYLISTDELAY, + ID3FID_KEY, ID3FID_SONGLEN, ID3FID_ORIGYEAR, ID3FID_OWNER, + ID3FID_SIZE, ID3FID_ISRC, and ID3FID_TERMSOFUSE. Also sorted the + elements of the FrameDefs array based on the long id field. + +1999-12-13 Monday 05:44 scott + + * src/examples/demo_tag.cpp (1.2): Added new option for adding a + comment description to a comment. + +1999-12-13 Monday 05:44 scott + + * src/examples/demo_convert.cpp (1.8): + (main): Minor code cleanup. + +1999-12-13 Monday 05:44 scott + + * src/id3/tag_render.cpp (1.12): + (RenderV2ToHandle): Cleaned up creation of temp files. Now ensures + temp file will be in same directory as original file, thereby + ensuring that the call to rename will not be used across partitions. + +1999-12-13 Monday 05:44 scott + + * src/id3/tag_file.cpp (1.11): + (exists): Add const qualifier to parameter. + (Link): Change to reflect new __sFileName type. + +1999-12-13 Monday 05:44 scott + + * src/id3/tag.cpp (1.10): + (SetupTag, ~ID3_Tag): Slight changes to reflect new __sFileName + type. + +1999-12-13 Monday 05:44 scott + + * src/id3/misc_support.cpp (1.16): + (ID3_AddComment): Fixed bug that wasn't adding specified comment + description to comment. + +1999-12-13 Monday 05:44 scott + + * src/id3/field_string_ascii.cpp (1.12): + (Get): Potential memory leaks plugged (thanks MusicMatch). + (RenderASCIIString): Bugfix for coversion from unicode to ascii + string (thanks MusicMatch). Some code cleanup. + +1999-12-13 Monday 05:23 scott + + * include/id3/tag.h (1.4): (): Include sys/param.h (if available) + to define MAXPATHLEN. (class ID3_Tag): Made private methods + protected. Changed __sFileName from a char * to a char array of + size MAXPATHLEN+1. + +1999-12-13 Monday 05:23 scott + + * include/id3/globals.h (1.3): + (ID3_FrameID): Added constants for the following newly supported + frames: linked information (LINK), BPM (TBPM), playlist delay + + (TDLY), initial key (TKEY), song length (TLEN), original year + + (TORY), original owner (TOWN), file size (TSIZ), International + Standard Recording Code (TSRC), and terms of use (USER). + +1999-12-09 Thursday 04:32 scott + + * src/id3/tag_file.cpp (1.10): Minor code cleanup. + +1999-12-09 Thursday 04:32 scott + + * src/id3/tag.cpp (1.9): + (ID3_Tag): Added copy constructor implementation. (operator=): + Added implementation. + +1999-12-09 Thursday 04:32 scott + + * src/id3/misc_support.cpp (1.15): + (ID3_GetString): Added implementation for new nIndex parameter, + which will pull out the nIndex'th string from the field, such as for + the involved people list frame. + (ID3_GetGenre): Fixed bug that wasn't finding the track num frame + rather than the genre frame (thanks Alexander Voronin). + +1999-12-09 Thursday 04:32 scott + + * src/id3/frame.cpp (1.8): (operator=): Added implementation. + +1999-12-09 Thursday 04:32 scott + + * src/id3/field_string_unicode.cpp (1.11): + (Add): Cleaned up and restructured code to make for easier reading. + Also fixed a bug in adding strings to an involved people list frame. + +1999-12-09 Thursday 04:32 scott + + * src/id3/field_string_ascii.cpp (1.11): + (ParseASCIIString): Fixed bug which prevented correct parsing of + fields separated with NULL dividers (such as the involved people + frame). Slightly restructured the code for better performance. + +1999-12-09 Thursday 04:32 scott + + * src/id3/field_integer.cpp (1.9): + (Get): Added const qualifier. + +1999-12-09 Thursday 04:31 scott + + * src/id3/field.cpp (1.11): (): Better comments of the + ID3VC_HIGHER/ID3VC_LOWER section in the field defs. (operator=): + Added implementation. + +1999-12-09 Thursday 03:48 scott + + * src/examples/demo_info.cpp (1.4): + (PrintInformation): Separated out information printing code into + this separate function. + (main): Added new runtime option -a that will test the ability of + id3lib to make copies of tags. Not very useful in general, but nice + for testing the new operator= code. + +1999-12-09 Thursday 03:45 scott + + * include/id3/tag.h (1.3): (class ID3_Tag): Added copy constructor + and operator= method declarations. + +1999-12-09 Thursday 03:45 scott + + * include/id3/misc_support.h (1.5): + (ID3_GetString): Added nItems parameter for retrieving a string from + a list (for example, the involved people list). + +1999-12-09 Thursday 03:45 scott + + * include/id3/frame.h (1.3): (class ID3_Frame): Added operator= + method declaration. + +1999-12-09 Thursday 03:45 scott + + * include/id3/field.h (1.3): (class ID3_Field): Added const to Get + method. Added operator= method declaration. + +1999-12-06 Monday 08:01 scott + + * src/examples/Makefile.am (1.8, rel-3-7-0, rel-3-7-0): + (check_PROGRAMS): Added id3lib + (id3tag_SOURCES): Added + +1999-12-06 Monday 08:00 scott + + * src/examples/demo_tag.cpp (1.1): Added. Allows for simple + tagging of files from the command line. + +1999-12-06 Monday 07:46 scott + + * src/id3/tag_render.cpp (1.11): + (RenderV2ToHandle): Use mkstemp instead of tmpfile for creating a + temporary file, enabling only a single copy for rendering new id3v2 + tag. Used an fstream for the temporary file. + +1999-12-05 Sunday 06:34 scott + + * include/id3/misc_support.h (1.4): Updated the Add functions so + that they accept an option boolean parameter which indicates if the + function should replace the current frame, if any. Made any char * + parameters const, if appropriate. Added a Remove function for each + of the frame types handled in this file. Also generalized + AddComment so that it now accepts a Description string, which + defaults to "". + +1999-12-05 Sunday 06:34 scott + + * src/id3/misc_support.cpp (1.14): + (ID3_AddArtist): Added extra boolean parameter (see changes for + misc_support.h above) as well as the functionality that implements + the feature. If bReplace is true, than the new information replaces + the information in the previous Artist frame, if any. If bReplace + is false, the information is added only if no previous Artist frame + existed. + (ID3_AddAlbum): See changes for ID3_AddArtist. + (ID3_AddTitle): See changes for ID3_AddArtist. + (ID3_AddYear): See changes for ID3_AddArtist. + (ID3_AddComment): See changes for ID3_AddArtist. Also generalized + implementaiton using the new sDescription parameter. + (ID3_AddTrack): See changes for ID3_AddArtist. + (ID3_AddGenre): See changes for ID3_AddArtist. + (ID3_AddLyrics): See changes for ID3_AddArtist. + (ID3_RemoveArtists): Added. Removes any and all frames that are + associated with artist information (namely, ID3FID_LEADARTIST, + ID3FID_BAND, ID3FID_CONDUCTOR, and ID3FID_COMPOSER) from the tag. + (ID3_RemoveAlbums): Added. Removes any and all album name frames + (ID3_RemoveTitles): Added. Removes any and all song title frames + (ID3_RemoveYears): Added. Removes any and all year frames + (ID3_RemoveComments): Added. Removes any and all comment frames + that match the sDescription parameter. If sDescription is NULL, all + comment frames are removed. + (ID3_RemoveTracks): Added. Removes any and all track number frames + (ID3_RemoveGenres): Added. Removes any and all content type frames + (ID3_RemoveLyrics): Added. Removes any and all unsynced lyrics + frames + +1999-12-05 Sunday 06:34 scott + + * src/id3/tag_parse_v1.cpp (1.10): + (ParseID3v1): Added STR_V1_COMMENT_DESC as description parameter to + call to ID3_AddComment + +1999-12-03 Friday 15:10 scott + + * Makefile.am (1.7, rel-3-6-0, rel-3-6-2): + (EXTRA_DIST): Added config.win32. + +1999-12-03 Friday 04:42 scott + + * config.win32 (1.2, rel-3-6-2, rel-3-6-0): Updated for release + 3.6.2. + +1999-12-03 Friday 04:42 scott + + * NEWS (1.5, rel-3-6-2): Added update for release 3.6.2. + +1999-12-03 Friday 01:47 scott + + * configure.in (1.11, rel-3-6-0, rel-3-6-2): + (id3lib_patch): Upped to 2 for new release 3.6.2 + (AC_OUTPUT): Added Makefiles for prj and zlib and its subdirs + +1999-12-03 Friday 01:45 scott + + * Makefile.am (1.6): + (SUBDIRS): Added prj and zlib + +1999-12-03 Friday 01:44 scott + + * prj/Makefile.am (1.1, rel-3-7-9, rel-3-7-8, rel-3-7-7), + zlib/Makefile.am (1.1, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7), zlib/include/Makefile.am (1.1, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, + rel-3-7-8, rel-3-7-7), zlib/lib/Makefile.am (1.1, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7), zlib/prj/Makefile.am (1.1, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7), zlib/src/Makefile.am (1.1) (utags: rel-3-6-2, + rel-3-7-0, rel-3-7-1, rel-3-7-2, rel-3-7-3, rel-3-7-4, rel-3-6-0, + rel-3-7-5): Added for distribution purposes. + +1999-12-03 Friday 00:09 scott + + * zlib/: include/deflate.h (1.1, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), include/infblock.h + (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0), include/infcodes.h (1.1, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), include/inffast.h + (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0), include/inffixed.h (1.1, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), include/inftrees.h + (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0), include/infutil.h (1.1, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), include/trees.h (1.1, + rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), + include/zconf.h (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), include/zlib.h (1.1, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), include/zutil.h (1.1, + rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), + prj/zlib.dsp (1.1, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, + rel-3-7-8, rel-3-7-7), prj/zlib.dsw (1.1, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0), prj/zlib.mak (1.1, rel-3-7-9, rel-3-7-8, rel-3-7-7, + rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), + src/adler32.c (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), src/compress.c (1.1, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), src/crc32.c (1.1, + rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), + src/deflate.c (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), src/gzio.c (1.1, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), src/infblock.c (1.1, + rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), + src/infcodes.c (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), src/inffast.c (1.1, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), src/inflate.c (1.1, + rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), + src/inftrees.c (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), src/infutil.c (1.1, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), src/trees.c (1.1, + rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0), + src/uncompr.c (1.1, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0), src/zutil.c (1.1, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0) (utags: rel-3-6-2, + rel-3-6-0): Added for windows compilation. (thanks elrod) + +1999-12-02 Thursday 23:51 scott + + * src/id3/dll_wrapper.cpp (1.10, rel-3-6-2): Fixed config.h macros. + +1999-12-02 Thursday 23:46 scott + + * config.win32 (1.1), prj/id3lib.dsp (1.1, rel-3-6-2, rel-3-6-0), + prj/id3lib.dsw (1.1, rel-3-6-2, rel-3-6-0), prj/id3lib.mak (1.1, + rel-3-6-2, rel-3-6-0): Added to the distribution for windows + compilation. + +1999-12-02 Thursday 23:45 scott + + * include/id3/: dll.h (1.2), error.h (1.2), field.h (1.2), frame.h + (1.2), globals.h (1.2), header.h (1.2), header_frame.h (1.2), + header_tag.h (1.2), int28.h (1.2), misc_support.h (1.3), tag.h + (1.2), types.h (1.2) (utags: rel-3-6-2, rel-3-6-0): Changed all of + the #include to #include "*" to help ensure that the sources + are searched for in the right places. + +1999-12-02 Thursday 02:58 scott + + * Makefile.in (1.12), acconfig.h (1.6), aclocal.m4 (1.8), + config.h.in (1.6), configure (1.17), doc/Makefile.in (1.7), + doc/html/Makefile.in (1.3), doc/latex/Makefile.in (1.3), + doc/man/Makefile.in (1.3), doc/texinfo/Makefile.in (1.3), + include/Makefile (1.3), include/Makefile.in (1.3), + include/id3/Makefile (1.7), include/id3/Makefile.in (1.7), + m4/Makefile.in (1.7), src/Makefile.in (1.6), + src/examples/Makefile.in (1.9), src/id3/Makefile.in (1.15): Removed + automatically generated files. Will be generated in the normal + process of ./reconf && ./configure. + +1999-12-02 Thursday 02:47 scott + + * src/: Makefile.am (1.5, rel-3-7-3, rel-3-7-2, rel-3-7-0, + rel-3-6-2), Makefile.in (1.5), id3/Makefile.am (1.8, rel-3-6-0, + rel-3-6-2), id3/Makefile.in (1.14): Removed EXTRA_DIST (no more + ChangeLog) + +1999-12-02 Thursday 02:46 scott + + * doc/Makefile.am (1.5, rel-3-6-2), doc/Makefile.in (1.6), + src/examples/Makefile.am (1.7, rel-3-6-2), src/examples/Makefile.in + (1.8): + (EXTRA_DIST): Removed ChangeLog. + +1999-12-02 Thursday 02:33 scott + + * ChangeLog (1.11): Coalesced all the ChangeLog's (previously one + for each directory) into this toplevel ChangeLog. + +1999-12-02 Thursday 02:33 scott + + * README (1.4, rel-3-6-2): Spelling error corrected. + +1999-12-02 Thursday 02:33 scott + + * NEWS (1.4): Updated for the 3.6.1 release. + +1999-12-02 Thursday 02:24 scott + + * doc/ChangeLog (1.5, rel-3-7-5, rel-3-7-4, rel-3-7-3), + m4/ChangeLog (1.5), src/ChangeLog (1.2, rel-3-7-0, rel-3-6-2), + src/examples/ChangeLog (1.7), src/id3/ChangeLog (1.10): Merged into + the top-level ChangeLog. + +1999-12-01 Wednesday 23:22 scott + + * src/id3/tag_render.cpp (1.10, rel-3-6-2): + (RenderV1ToHandle): Removed reference to tagV1---not used. Other + minor windows-compatibility fixes. (thanks elrod) + +1999-12-01 Wednesday 23:19 scott + + * src/id3/tag_parse_v1.cpp (1.9, rel-3-6-2): + (ParseID3v1): Minor fix for windows compatibility (thanks elrod). + +1999-12-01 Wednesday 23:16 scott + + * src/id3/tag_file.cpp (1.9, rel-3-6-2): + (truncate): Added. Defined only for windows, which doesn't have + unistd.h available (thanks elrod). + +1999-12-01 Wednesday 23:11 scott + + * src/id3/misc_support.cpp (1.13, rel-3-6-2): Now returns 0 when + input is NULL. + +1999-12-01 Wednesday 23:10 scott + + * include/id3/misc_support.h (1.2): Minor declaraction problem + + (thanks, elrod). + +1999-12-01 Wednesday 20:13 scott + + * configure (1.13), configure.in (1.10): Upped the patch number to + 1. + +1999-12-01 Wednesday 20:10 scott + + * include/: Makefile (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7), Makefile.am (1.2, + rel-3-7-0, rel-3-6-2, rel-3-6-0), Makefile.in (1.2), id3/Makefile + (1.2), id3/Makefile.am (1.2, rel-3-7-0, rel-3-6-2, rel-3-6-0), + id3/Makefile.in (1.2): + (EXTRA_DIST): Removed. No extra files to distribute + +1999-12-01 Wednesday 20:08 scott + + * Makefile.am (1.5), Makefile.in (1.8): + (SUBDIRS): Added "include". + +1999-12-01 Wednesday 19:13 scott + + * src/examples/Makefile.am (1.6, rel-3-6-2): + (INCLUDES): Updated to point to new toplevel include directory. + +1999-12-01 Wednesday 19:12 scott + + * configure.in (1.9): + (AC_OUTPUT): Added include/Makefile and include/id3/Makefile + +1999-12-01 Wednesday 19:09 scott + + * include/: Makefile.am (1.1), id3/Makefile.am (1.1) (utags: + rel-3-6-2, rel-3-7-0, rel-3-7-1, rel-3-7-2, rel-3-7-3, rel-3-7-4, + rel-3-6-0, rel-3-7-5): Initial revision. + +1999-12-01 Wednesday 19:03 scott + + * src/id3/: Makefile.am (1.7), Makefile.in (1.9): + (INCLUDES): Now points to new, toplevel include directory. + (the_headers, id3includedir, id3include_HEADERS): Removed. Headers + are no longer in this directory. + +1999-12-01 Wednesday 19:00 scott + + * src/id3/: dll_wrapper.cpp (1.9), error.cpp (1.9, rel-3-6-2), + field.cpp (1.10, rel-3-6-2), field_binary.cpp (1.8, rel-3-6-2), + field_integer.cpp (1.8, rel-3-6-2), field_string_ascii.cpp (1.10, + rel-3-6-2), field_string_unicode.cpp (1.10, rel-3-6-2), frame.cpp + (1.7, rel-3-6-2), frame_parse.cpp (1.7, rel-3-6-2), + frame_render.cpp (1.7, rel-3-6-2), header.cpp (1.7, rel-3-6-2), + header_frame.cpp (1.7, rel-3-6-2), header_tag.cpp (1.7, rel-3-6-2), + int28.cpp (1.7, rel-3-6-2), misc_support.cpp (1.12), tag.cpp (1.8, + rel-3-6-2), tag_file.cpp (1.8), tag_find.cpp (1.9, rel-3-6-2), + tag_parse.cpp (1.9, rel-3-6-2), tag_parse_lyrics3.cpp (1.7, + rel-3-6-2), tag_parse_v1.cpp (1.8), tag_render.cpp (1.9), + tag_sync.cpp (1.7, rel-3-6-2): Changed all of the #include + to #include "*" to help ensure that the sources are searched for in + the right places (and to make compiling under windows easier). + +1999-12-01 Wednesday 18:14 scott + + * include/id3/dll.h (1.1), src/id3/dll.h (1.8, rel-3-6-0), + include/id3/error.h (1.1), src/id3/error.h (1.10), + include/id3/externals.h (1.1, rel-3-6-2, rel-3-6-0), + src/id3/externals.h (1.6), include/id3/field.h (1.1), + src/id3/field.h (1.11), include/id3/frame.h (1.1), src/id3/frame.h + (1.10), include/id3/globals.h (1.1), src/id3/globals.h (1.5), + include/id3/header.h (1.1), src/id3/header.h (1.7), + include/id3/header_frame.h (1.1), src/id3/header_frame.h (1.7), + include/id3/header_tag.h (1.1), src/id3/header_tag.h (1.6), + include/id3/int28.h (1.1), src/id3/int28.h (1.6), + include/id3/misc_support.h (1.1), src/id3/misc_support.h (1.9), + include/id3/sized_types.h (1.1, rel-3-6-2, rel-3-6-0), + src/id3/sized_types.h (1.2), include/id3/tag.h (1.1), src/id3/tag.h + (1.11), include/id3/types.h (1.1), src/id3/types.h (1.8), + include/id3/version.h (1.1, rel-3-6-2, rel-3-6-0), + src/id3/version.h (1.9): moved from src/id3 to include/id3 + +1999-12-01 Wednesday 05:26 scott + + * TODO (1.2, rel-3-6-2, rel-3-6-0): New stuff todo. + +1999-12-01 Wednesday 05:25 scott + + * README (1.3, rel-3-6-0, rel-3-6-0): Renamed ID3Lib to id3lib. + +1999-12-01 Wednesday 05:21 scott + + * COPYING (1.3, rel-3-6-2, rel-3-6-0): Renamed ID3Lib to id3lib. + Fixed spelling of "optimizations". + +1999-11-30 Tuesday 21:32 scott + + * m4/: Makefile.am (1.4, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2), Makefile.in + (1.5) (utags: rel-3-6-0): + (m4macros): Removed sh_types.m4. + +1999-11-30 Tuesday 21:19 scott + + * src/id3/version.cpp (1.1, rel-3-6-2, rel-3-6-0): Added. + Implements version functions declared in version.h. + +1999-11-30 Tuesday 21:18 scott + + * src/id3/sized_types.h (1.1, rel-3-6-0): Added. Converted from + sh_types.h in toplevel m4 directory. Defines size-specific types + based on macros in limits.h. int8, uint8, int16, uint16, int32, + uint32. + +1999-11-30 Tuesday 21:16 scott + + * src/id3/version.h (1.8, rel-3-6-0): Changed from preprocessor + macros to functions. Now changes to top level configure.in with + regards to version info will be reflected in these functions without + having to change this file. + +1999-11-30 Tuesday 21:13 scott + + * src/id3/: misc_support.h (1.8), types.h (1.7) (utags: rel-3-6-0): + Removed include for wchar.h + +1999-11-30 Tuesday 21:12 scott + + * src/id3/misc_support.cpp (1.11, rel-3-6-0): No more + SIZE_SPECIFIC_TYPES code. No more code for wchar's. Typedefs in + sized_types.h guarantee that unicode_t will be two bytes. + +1999-11-30 Tuesday 21:09 scott + + * src/id3/globals.h (1.4, rel-3-6-0): No longer includes config.h. + No more SIZE_SPECIFIC_TYPES code. No more code for wchar_t. Added + include for sized_types.h. + +1999-11-30 Tuesday 21:08 scott + + * src/id3/: Makefile.am (1.6, rel-3-6-0), Makefile.in (1.6): + (the_headers): Added sized_headers.h + (the_sources): Added version.cpp + (LTVERSION): Updated to make use of configure.in variables. + +1999-11-30 Tuesday 21:05 scott + + * src/examples/: demo_convert.cpp (1.7), demo_info.cpp (1.3) + (utags: rel-3-6-2, rel-3-6-0): Updated to reflect changes from + version macros to version functions. + +1999-11-30 Tuesday 21:02 scott + + * acconfig.h (1.5, rel-3-6-0), aclocal.m4 (1.5, rel-3-6-0), + config.h.in (1.5, rel-3-6-0), configure (1.9), doc/Makefile.in + (1.5, rel-3-6-0), doc/html/Makefile.in (1.2, rel-3-6-0), + doc/latex/Makefile.in (1.2, rel-3-6-0), doc/man/Makefile.in (1.2, + rel-3-6-0), doc/texinfo/Makefile.in (1.2, rel-3-6-0), + m4/Makefile.in (1.4), src/Makefile.in (1.4, rel-3-6-0), + src/examples/Makefile.in (1.6, rel-3-6-0): Changed as a result of + changes to Makefile.am and configure.in. + +1999-11-30 Tuesday 21:01 scott + + * configure.in (1.8, rel-3-6-0): + * configure.in: Minor modifications. Removed call to + SH_SIZE_SPECIFIC_TYPES---these types are now defined in + src/id3/sized_types.h. Removed ID3LIB_NAME macro (same as PACKAGE). + Removed ID3LIB_RELEASE macro (same as VERSION). Renamed + ID3LIB_IDSTRING to ID3LIB_FULLNAME and removed the date part of it. + +1999-11-30 Tuesday 20:54 scott + + * Makefile.am (1.4, rel-3-6-0), Makefile.in (1.4): + (EXTRA_DIST): Removed ChangeLog, configure, HISTORY, and TODO. + These are included in the distribution automatically. + +1999-11-30 Tuesday 20:41 scott + + * m4/sh_types.m4 (1.2): Removed. Content now in + src/id3/sized_types.h (a more appropriate file). + +1999-11-30 Tuesday 15:25 scott + + * configure.in (1.7): Generalized versioning mechanism so it only + has to be changed in this file to be propagated throughout rest of + source code. Used a hack to make libtool version coincide with + release versioning. This is expressly warned against in the libtool + docs, so it might be changed. However, it also seems to be a common + practice amongst other library writers, so I'm torn. Added + versioning macro definitions normally found in version.h. Probably + not the best place for this... + +1999-11-29 Monday 23:57 scott + + * doc/: html/Makefile.am (1.1, rel-3-6-0, rel-3-6-2, rel-3-6-0), + html/Makefile.in (1.1), latex/Makefile.am (1.1, rel-3-6-0, + rel-3-6-2, rel-3-6-0), latex/Makefile.in (1.1), man/Makefile.am + (1.1, rel-3-6-0, rel-3-6-2, rel-3-6-0), man/Makefile.in (1.1), + texinfo/Makefile.am (1.1, rel-3-6-0, rel-3-6-2, rel-3-6-0), + texinfo/Makefile.in (1.1): Initial revision. + +1999-11-29 Monday 23:53 scott + + * configure (1.8), configure.in (1.6): Added doc/*/Makefile to + AC_OUPUT + +1999-11-29 Monday 23:50 scott + + * src/id3/: Makefile.am (1.5), Makefile.in (1.5): + (the_headers): Added globals.h to header file listing. + +1999-11-29 Monday 21:18 scott + + * doc/: Makefile.am (1.4, rel-3-6-0), Makefile.in (1.4): + * Makefile.am: Removed refs to removed files. + +1999-11-29 Monday 20:42 scott + + * src/examples/Makefile.am (1.5, rel-3-6-0, rel-3-6-0, rel-3-6-0): + Added the test tags to the distribution. + +1999-11-29 Monday 20:39 scott + + * src/examples/: 221-compressed.tag (1.1), 230-compressed.tag + (1.1), 230-picture.tag (1.1), 230-unicode.tag (1.1), jules.mp3 + (1.1) (utags: rel-3-6-2, rel-3-7-0, rel-3-6-0): Initial revision. + +1999-11-29 Monday 20:26 scott + + * src/id3/: dll.h (1.7, rel-3-6-0), dll_wrapper.cpp (1.8, + rel-3-6-0), error.cpp (1.8, rel-3-6-0), error.h (1.9, rel-3-6-0), + externals.h (1.5, rel-3-6-0), field.cpp (1.9, rel-3-6-0), field.h + (1.10, rel-3-6-0), field_binary.cpp (1.7, rel-3-6-0), + field_integer.cpp (1.7, rel-3-6-0), field_string_ascii.cpp (1.9, + rel-3-6-0), field_string_unicode.cpp (1.9, rel-3-6-0), frame.cpp + (1.6, rel-3-6-0), frame.h (1.9, rel-3-6-0), frame_parse.cpp (1.6, + rel-3-6-0), frame_render.cpp (1.6, rel-3-6-0), globals.h (1.3), + header.cpp (1.6, rel-3-6-0), header.h (1.6, rel-3-6-0), + header_frame.cpp (1.6, rel-3-6-0), header_frame.h (1.6, rel-3-6-0), + header_tag.cpp (1.6, rel-3-6-0), header_tag.h (1.5, rel-3-6-0), + int28.cpp (1.6, rel-3-6-0), int28.h (1.5, rel-3-6-0), + misc_support.cpp (1.10), misc_support.h (1.7), tag.cpp (1.7, + rel-3-6-0), tag.h (1.10, rel-3-6-0), tag_file.cpp (1.7, rel-3-6-0), + tag_find.cpp (1.8, rel-3-6-0), tag_parse.cpp (1.8, rel-3-6-0), + tag_parse_lyrics3.cpp (1.6, rel-3-6-0), tag_parse_v1.cpp (1.7, + rel-3-6-0), tag_render.cpp (1.8, rel-3-6-0), tag_sync.cpp (1.6, + rel-3-6-0), types.h (1.6), version.h (1.7): Updated the leading + license information of the file to reflect new maintainer. + +1999-11-29 Monday 20:17 scott + + * src/id3/misc_support.h (1.6): Renamed ID3_ASCIItoUnicode to + mbstoucs. Renamed ID3_UnicodeToASCII to ucstombs. Added + declarations for ucslen, ucscpy, ucsncpy, ucscmp, and ucsncmp. + +1999-11-29 Monday 20:15 scott + + * src/id3/globals.h (1.2): Updated documentation to work better + with doc++ (probably doesn't work well with kdoc anymore). Added + the unicode_t typedef. + +1999-11-29 Monday 20:13 scott + + * src/id3/version.h (1.6): Updated documentation to work better + with doc++ (probably doesn't work well with kdoc anymore). Updated + the constants. + +1999-11-29 Monday 20:05 scott + + * src/id3/: field.h (1.9), frame.h (1.8), tag.h (1.9): Updated + documentation to work better with doc++ (probably doesn't work well + with kdoc anymore). + +1999-11-29 Monday 19:56 scott + + * src/id3/misc_support.cpp (1.9): (): Made includsion of wchar.h + dependant on SIZE_SPECIFIC_TYPES. Put in compile-time checks to + compile differently based on the definition of unicode_t. + (mbstoucs): Renamed from ID3_ASCIItoUnicode. + (ucstombs): Renamed from ID3_UnicodeToASCII. + (ucslen): Added. Returns the length of a unicode character string. + (ucscpy): Added. Copies one unicode string to another. + (ucsncpy): Added. Copies n chars from one unicode string to + another. + (ucscmp): Added. Compares two unicode strings. + (ucsncmp): Added. Compares the first n chars of two unicode + strings. + +1999-11-29 Monday 19:47 scott + + * src/id3/tag_find.cpp (1.7): (): Updated methods to use unicode_t + instead of wchar_t. unicode_t is defined in globals.h. The type + unicode_t is more likely to be two bytes on every platform. Updated + calls to unicode methods to more general methods defined in + misc_support.cpp. + +1999-11-29 Monday 19:15 scott + + * src/id3/field_string_unicode.cpp (1.8): (): Updated methods to + use unicode_t instead of wchar_t. unicode_t is defined in + globals.h. The type unicode_t is more likely to be two bytes on + every platform. Updated calls to unicode methods to more general + methods defined in misc_support.cpp. + (ParseUnicodeString): Fixed a bug (?) to make unicode parsing work. + Not really sure if this is the source of the bug, or if there is a + more pervasive misunderstanding of the format of unicode. Need to + check on this. + +1999-11-29 Monday 18:23 scott + + * src/id3/field_string_ascii.cpp (1.8): Updated methods to use + unicode_t instead of wchar_t. unicode_t is defined in globals.h. + The type unicode_t is more likely to be two bytes on every platform. + Updated calls to unicode methods to more general methods defined in + misc_support.cpp. + +1999-11-29 Monday 18:21 scott + + * src/id3/field.cpp (1.8): Updated methods to use unicode_t instead + of wchar_t. unicode_t is defined in globals.h. The type unicode_t + is more likely to be two bytes on every platform. + +1999-11-29 Monday 18:00 scott + + * src/id3/error.h (1.8): Updated documentation to work better with + doc++ (probably doesn't work well with kdoc anymore). + +1999-11-29 Monday 16:11 scott + + * src/id3/: dll.h (1.6), dll_wrapper.cpp (1.7): Updated unicode + function declarations to now pass unicode_t instead of wchar_t. + unicode_t now defined in globals.h. + +1999-11-29 Monday 16:04 scott + + * doc/Makefile.in (1.3): Updated as a result of changes to + Makefile.am. + +1999-11-29 Monday 16:04 scott + + * doc/Makefile.am (1.3): Added. + +1999-11-29 Monday 16:03 scott + + * AUTHORS (1.3, rel-3-6-2, rel-3-6-2, rel-3-6-0): Included text + from contact.txt in original distribution. + +1999-11-29 Monday 16:01 scott + + * Makefile.in (1.3), acconfig.h (1.4), aclocal.m4 (1.4), + config.h.in (1.4), configure (1.7): Updated as a result of changes + to configure.in. + +1999-11-29 Monday 16:00 scott + + * configure.in (1.5): Added many more checks. Restructured into + more logical groups. + +1999-11-29 Monday 15:56 scott + + * m4/sh_types.m4 (1.1): Added. Defines size-specific typedefs + based on macro defs in limits.h. + +1999-11-29 Monday 15:55 scott + + * m4/lf_cxx_convenience.m4 (1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, + rel-3-6-0): Added. Pulled out non-portability macros from + lf_cxx.m4. + +1999-11-29 Monday 15:45 scott + + * m4/lf_cxx.m4 (1.2, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0): + Moved conenience macros to lf_cxx_convenience.m4. + +1999-11-29 Monday 15:44 scott + + * m4/: Makefile.am (1.3, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7), Makefile.in (1.3): + Added sh_types.m4 and lf_cxx_convenience.m4 to distribution. + +1999-11-26 Friday 18:29 scott + + * doc/contact.txt (1.3): + * contact.txt: Removed. Relevant information updated and included + in README and AUTHORS. + +1999-11-26 Friday 18:09 scott + + * doc/software.txt (1.2, rel-3-6-2, rel-3-6-0): Removed. No longer + applies to this fork. + +1999-11-26 Friday 17:17 scott + + * doc/: id3v2-3.00.txt (1.2, rel-3-6-2, rel-3-6-0), id3guide.html + (1.2, rel-3-6-2, rel-3-6-0), logo.txt (1.2, rel-3-6-2, rel-3-6-0), + contact.txt (1.2), bugreport.txt (1.2, rel-3-6-2, rel-3-6-0): + dos2unix'ified + +1999-11-26 Friday 17:01 scott + + * doc/licence.txt (1.2): Removed. Replaced with COPYING file in + top dir. + +1999-11-26 Friday 16:58 scott + + * doc/id3libhistory.txt (1.3): Removed. Replaced with HISTORY file + in top dir. + +1999-11-26 Friday 16:06 scott + + * doc/zlib_readme.txt (1.2): + * zlib_readme.txt: Removed. zlib sources no longer included in the + distribution. + +1999-11-26 Friday 16:03 scott + + * doc/id3lib305.doc (1.2): + * id3lib305.doc: Removed. Replaced with inline documentation found + in source, converted into various formats (html, latex, texinfo, + man) using doc++ or kdoc. + +1999-11-25 Thursday 20:25 scott + + * src/id3/version.h (1.5): Added doc++/kdoc/javadoc-like + documentation. Replaced #define's with const's. + +1999-11-25 Thursday 20:24 scott + + * src/id3/types.h (1.5): Removed typedefs, which are now included + in the globas.h file. + +1999-11-25 Thursday 20:22 scott + + * src/id3/tag.h (1.8): (): Added doc++/kdoc/javadoc-like + documentation, mostly transcribed from Dirk's ID3Lib Documentation + MSWord doc. + (ID3_TagTypes): Added. The different types of tags that can be + parsed and/or rendered by id3lib. (class ID3_Tag): Changed the + interface to AddFrame slightly. Now there is two AddTag-like + methods: AddTag and AddNewTag. The former merely attaches the frame + to the tag without taking repsonsibility for deallocating the frame + when the tag goes out of scope or is deleted. The latter does take + this responsibility. Granted, there could be a better interface for + this, but it works for now... Update and Strip now return flags + which indicate what tags were actually updated or stripped. Removed + OpenLinkedFile method; replaced with OpenFileForReading, + OpenFileForWriting, and CreateFile. + +1999-11-25 Thursday 20:15 scott + + * src/id3/frame.h (1.7): Added doc++/kdoc/javadoc-like + documentation, mostly transcribed from Dirk's ID3Lib Documentation + MSWord doc. + +1999-11-25 Thursday 20:11 scott + + * src/id3/field.h (1.8): Added doc++/kdoc/javadoc-like + documentation, mostly transcribed from Dirk's ID3Lib Documentation + MSWord doc. (ID3_FieldFlags ): Created enumeration to replace + generic constants. + (ID3_FieldID): Removed. Replaced in globals.h. + (ID3_FrameID): Removed. Replaced in globals.h. (class ID3_Field): + Made the constructor private. + +1999-11-25 Thursday 20:05 scott + + * src/id3/error.h (1.7): Added doc++/kdoc/javadoc-like + documentation. + (ID3_Err): Added error types SmallBuffer and ReadOnly. + +1999-11-25 Thursday 19:52 scott + + * src/id3/misc_support.cpp (1.8): + * misc_support.cpp: Replaced every call to AddFrame with + AddNewFrame. + +1999-11-25 Thursday 19:51 scott + + * src/id3/tag_render.cpp (1.7): + (Render): Replaced manual array initialization with call to memset. + (GenerateTempName): Removed method. No longer used. + (RenderV1): New method. Renders an id3v1 tag to an array. + (RenderV1ToHandle): Moved work of writing tag to array to RenderV1. + (RenderV2ToHandle): Rather than generating a temporary file name + with mktemp (or similar) and opening that file name to a temporary + file, we now use tmpfile to create a temporary file directly. + Unfortunately, this means we can't just rename the tempfile to the + original file when all the copying is done, so we have to perform a + second copy from the temp file back to the original. This makes the + code less efficient but more portable, as we rely on tmpfile for + knowing where to create the temporary file. To improve, we'll need + to figure out a portable mechanism for creating temporary files + + (i.e., resolve the differences between /tmp/ and C:\temp\). + +1999-11-25 Thursday 19:41 scott + + * src/id3/tag_parse.cpp (1.7): + (ProcessBinaries): Minor code reorg. + +1999-11-25 Thursday 19:39 scott + + * src/id3/tag_file.cpp (1.6): + (OpenLinkedFile): Removed method. Replaced with CreateFile, + OpenFileForReading, and OpenFileForWriting. + (CreateFile): New method. Creates a new file with file name + sFileName. Throws if unable to. + (OpenFileForWriting): New method. Opens a file with write + permissions. Throws if unable to. + (OpenFileForReading): New method. Opens a file with read + permissions. Throws if unable to. + (CloseFile): New method. Closes a file. Returns true if + successful, false otherwise. + (Link): Now dynamically allocate sFileName. Make use of new method + OpenFileForReading rather than OpenLinkedFile. Closes the file when + done. + (Update): Now returns a flag indicating which tags were actually + written. Calls OpenFileForWriting to open the file appropriately. + Closes the file when done. + (Strip): Now returns a flag indicating which tags were actually + written. Now strips a file "in place," by copying the non-stripped + information to the beginning of the file and using ftruncate to chop + off the rest. Prevents having to create a temporary file. Calls + OpenFileForWriting to open the file appropriately. Closes the file + when done. + +1999-11-25 Thursday 19:24 scott + + * src/id3/tag.cpp (1.6): + (SetupTag): Initialized sFileName to NULL rather than the empty + string to indicate no filename is present. + (ID3_Tag): Deleted sFileName if allocated. Added call to CloseFile. + (AddFrame): Modified to reflect change in interface. AddFrame now + adds a frame without taking responsibility for deallocating the + memory when the tag goes out of scope. + (AddNewFrame): New method. AddNewFrame adds a frame and takes + responsibility for deallocating the frame when the tag goes out of + scope. + +1999-11-25 Thursday 19:17 scott + + * src/id3/error.cpp (1.7): + (ID3_ErrorDescs): Added descriptions for new error types. + (ID3_Error): Minor bugfix in string copying. + +1999-11-25 Thursday 19:15 scott + + * src/id3/dll.h (1.5): Removed many of the enums and typedefs to + globals.h to reduce redundancy. + +1999-11-25 Thursday 19:13 scott + + * src/id3/globals.h (1.1): + * globals.h: Added. Includes constants, typedefs, and enums common + to several files that were redundantly copying them. + +1999-11-25 Thursday 19:11 scott + + * src/examples/Makefile.am (1.4): Removed demo_strip from the make + rules. + +1999-11-25 Thursday 19:01 scott + + * src/examples/demo_convert.cpp (1.6): Adding stripping + capabilities with the -s flag. + +1999-11-25 Thursday 18:38 scott + + * Makefile.am (1.3): + * Makefile.am (EXTRA_DIST): Added HISTORY and TODO + +1999-11-25 Thursday 18:15 scott + + * src/examples/demo_convert.cpp (1.5): + * demo_convert.cpp + (PrintUsage): Added for printing usage information. + (PrintVersion): Added for printing version information. + (DisplayTags): Added for printing out the contents of a tag flag. + (main): Modified to make use of command-line options via option.h. + Can now choose which type of tag to convert to, can convert multiple + tags at once. Can print out usage and version info. + +1999-11-25 Thursday 07:20 scott + + * doc/id3libhistory.txt (1.2): Reformatted to fit within 80 chars. + +1999-11-25 Thursday 07:19 scott + + * THANKS (1.2, rel-3-6-2, rel-3-6-0): Transcribed the Thanks + section from Dirk's original documentation. + +1999-11-25 Thursday 07:18 scott + + * README (1.2): Filled the README with semi-useful information. + +1999-11-25 Thursday 07:17 scott + + * NEWS (1.2): Actually added some news. + +1999-11-25 Thursday 07:14 scott + + * HISTORY (1.1, rel-3-6-2, rel-3-6-0), TODO (1.1): Initial + revision. + +1999-11-25 Thursday 07:14 scott + + * COPYING (1.2): Change from the GPL to the original statement + about being in the Public Domain. + +1999-11-25 Thursday 07:13 scott + + * AUTHORS (1.2, rel-3-6-0, rel-3-0-6pre1): Minor clarification. + +1999-11-19 Friday 20:27 scott + + * src/id3/tag_render.cpp (1.6): + (RenderV1ToHandle): Added. Adds or overwrites an id3v1 tag to a + file handle. Needs testing. + (RenderV2ToHandle): Renamed from RenderToHandle. + +1999-11-19 Friday 20:12 scott + + * src/id3/tag_parse_v1.cpp (1.6): + (ID3_RemoveTrailingSpaces): Minor code cleanup. + (ParseID3v1): Massive recoding of method to make use of new + functions defined in misc_support. Simplifies flow of method. + +1999-11-19 Friday 20:10 scott + + * src/id3/tag_find.cpp (1.6): + * tag_find.cpp (Find): Add const qualifier. + +1999-11-19 Friday 20:09 scott + + * src/id3/tag_file.cpp (1.5): + (Update): Changed parameter to be a flag which indicates which type + of tag to update, either V1_TAG, V2_TAG, or BOTH_TAGS. Updated + method to act appropriately based on the parameter passed in. + (Strip): Changed parameter to be a flag which indicates which type + of tag to update, either V1_TAG, V2_TAG, or BOTH_TAGS. Updated + method to act appropriately based on the parameter passed in. + +1999-11-19 Friday 20:07 scott + + * src/id3/tag.h (1.7): + * tag.h: Added new constants: STR_V1_COMMENT_DESC (to be added to + the description of comments converted from id3v1 tags); V1_TAG, + V2_TAG, and BOTH_TAGS (used for methods Strip and Update to + determine which tag to act on); and LEN_V1, LEN_V1_ID, LEN_V1_TITLE, + LEN_V1_ARTIST, LEN_V1_ALBUM, LEN_V1_YEAR, LEN_V1_COMMENT, + LEN_V1_GENRE (the lengths of the id3v1 tag and its fields). + Generalized ID3V1_Tag struct using newly defined constants. Added 1 + to each char array size for null terminator. Added const qualifier + to appropriate methods and parameters. Added declaration of + RenderV1ToHandle method. Renamed "RenderToHandle" to + "RenderV2ToHandle". + +1999-11-19 Friday 19:59 scott + + * src/id3/misc_support.h (1.5): + * misc_support.h: Added the function declarations for ID3_GetString, + ID3_GetArtist, ID3_GetAlbum, ID3_GetTitle, ID3_GetYear, ID3_AddYear, + ID3_GetComment, ID3_AddComment, ID3_GetTrack, ID3_GetTrackNum, + ID3_AddTrack, ID3_GetGenre, ID3_GetGenreNum, and ID3_GetLyrics. + +1999-11-19 Friday 19:53 scott + + * src/id3/misc_support.cpp (1.7): + (ID3_ASCIItoUnicode): Updated interface to make parameters const. + Replaced content of the code with call to mbstowcs, a function + defined in wchar.h for converting from a regular string to a wchar + string. The original code might be reinstated if another type is + used to store unicode characters. + (ID3_UnicodeToASCII): Updated interface to make parameters const. + Replaced content of the code with call to wcstombs, a function + defined in wchar.h for converting from a wchar string to a regular + string. The original code might be reinstated if another type is + used to store unicode characters. + (ID3_GetString): Added. Returns a dynamically-allocated copy of the + string contained in the frame/field parameters. + (ID3_GetArtist): Added. Returns the artist as a string. Will + return the LEADARTIST, the BAND, the CONDUCTOR, or the COMPOSER, + whichever is found first in that order. + (ID3_GetAlbum): Added. Returns the album as a string. + (ID3_GetTitle): Added. Returns the song title as a string. + (ID3_GetYear): Added. Returns the year as a string. + (ID3_AddYear): Added. Adds the year as a string to the frame. + (ID3_GetComment): Added. Returns the first comment found as a + string. + (ID3_AddComment): Added. Adds the comment as a string with the + description stored in STR_V1_COMMENT_DESC, currently + "ID3v1_Comment". Won't add if a tag with that or no description + already exists. + (ID3_GetTrack): Added. Returns the track number as a string. + (ID3_GetTrackNum): Added. Returns the track number as an unsigned + integer. + (ID3_AddTrack): Added. Adds the track number and track total as a + string in the form "N/T", where N is the track number and T is the + total. If no total is indicated, then only the track number is + added. + (ID3_GetGenre): Added. Returns the genre as a string. + (ID3_GetGenreNum): Added. Returns the genre as a number. + (ID3_AddGenre): Added. Adds the genre number as a string in the + form "(G)", where G is the genre number. + (ID3_GetLyrics): Added. Gets the unsynced lyrics as a string. + +1999-11-19 Friday 18:49 scott + + * src/id3/field_string_unicode.cpp (1.7): (operator=): Updated + interface to make parameters const. + (Set): Updated interface to make parameters const. Bug fix for + fixed length strings. Minor variable renaming. + (Add): Updated interface to make parameters const. + (Get): Updated interface to make parameters const. Fixed bug which + would add a null character to the string regardless of the length of + string requested. Now only adds a null when the actual length of + the string is less than the maxium number of characters requested. + +1999-11-19 Friday 18:34 scott + + * src/id3/field_string_ascii.cpp (1.7): (operator=): Updated + interface to make parameters const. + (Set): Updated interface to make parameters const. Bug fix for + fixed length strings. + (Get): Removed check for nonempty strings so empty strings would be + set correctly. Minor code cleanup. + (Add): Updated interface to make parameters const. Made variable + name more descriptive. + +1999-11-19 Friday 18:29 scott + + * src/id3/field_integer.cpp (1.6): + (ParseInteger): Updated interface to make parameters const. + +1999-11-19 Friday 18:28 scott + + * src/id3/field_binary.cpp (1.6): + (Set): Updated interface to make parameters const. + (FromFile): Updated interface to make parameters const. + (ToFile): Updated interface to make parameters const. + (ParseBinary): Updated interface to make parameters const. + +1999-11-19 Friday 18:19 scott + + * src/id3/field.h (1.7): + * field.h (class ID3_Field): Updated method interfaces to make + appropriate parameters const. + +1999-11-19 Friday 18:18 scott + + * src/id3/field.cpp (1.7): + * field.cpp + (BinSize): Added check for an ascii string when called by Size, + since we store every string internally as unicode. + (Parse): Updated interface to make parameters const. + (ID3_FindFrameDef): Updated interface to make parameter const. + (ID3_FindFrameID): Updated interface to make parameter const. + +1999-11-19 Friday 18:13 scott + + * src/id3/dll_wrapper.cpp (1.6): + * dll_wrapper.cpp (ID3Tag_Strip): Updated for interface change to + Tag::Strip. Now accepts tag flags rather than a v1 boolean. + +1999-11-19 Friday 18:10 scott + + * src/examples/: Makefile.am (1.3), Makefile.in (1.3): Added + compilation options for demo_strip.cpp + +1999-11-19 Friday 18:09 scott + + * src/examples/demo_info.cpp (1.2): + * demo_info.cpp: Added runtime options for version and help. Minor + code cleanup. + +1999-11-19 Friday 17:56 scott + + * src/examples/demo_strip.cpp (1.1): + * demo_strip.cpp: Initial revision. + +1999-11-16 Tuesday 23:50 scott + + * src/id3/tag_parse.cpp (1.6): + * tag_parse.cpp + (ProcessBinaries): Added try/catch block to catch any exceptions so + that the parser can carry on parsing the rest of the frames if any + particular frame is poorly encoded. Need to add some sort of + mechanism to determine how many frames exist, how many have been + parsed correctly and how many have been parsed incorrectly. + +1999-11-16 Tuesday 23:50 scott + + * src/id3/field_string_unicode.cpp (1.6): + * field_string_unicode.cpp + (ParseUnicodeString): Put in sanity check for indices so that memcpy + doesn't go out of bounds. Made unicode code more specific to the + type of data storing unicode characters. This fix doesn't work if + the type is different than two bytes in size. Need to fix so that + the type is guaranteed to be two bytes. + (RenderUnicodeString): Made unicode code more specific to the type + of data storing unicode characters. + +1999-11-16 Tuesday 23:50 scott + + * src/id3/field_string_ascii.cpp (1.6): + * field_string_ascii.cpp (ParseASCIIString): Added sanity check for + indices so we don't call memcpy with out-of-bounds indices. + +1999-11-16 Tuesday 23:50 scott + + * src/id3/field.cpp (1.6): + * field.cpp (Render): Minor reformatting. + +1999-11-16 Tuesday 23:50 scott + + * src/id3/error.h (1.6): + * error.h (ID3_Err): Added new ID3_Err: ID3E_BadData. + +1999-11-16 Tuesday 23:50 scott + + * src/id3/error.cpp (1.6): + * error.cpp (ID3_ErrorDescs): Added text entry for ID3E_BadData. + +1999-11-16 Tuesday 06:32 scott + + * src/id3/: Makefile.am (1.4), Makefile.in (1.3), ChangeLog (1.2, + rel-3-6-0) (utags: rel-3-0-6pre1): + * Makefile.am: Upped the version info to 3.0.6. + +1999-11-16 Tuesday 06:30 scott + + * src/examples/readme.txt (1.2, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1): Reformatted. + +1999-11-16 Tuesday 06:29 scott + + * src/examples/: Makefile.am (1.2), Makefile.in (1.2) (utags: + rel-3-0-6pre1): Added macros to allow for compiling test programs + id3convert and id3info. + +1999-11-16 Tuesday 06:28 scott + + * src/examples/demo_convert.cpp (1.4, rel-3-0-6pre1): More + descriptive error message. + +1999-11-16 Tuesday 06:27 scott + + * src/examples/demo_main.cpp (1.2, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1): Reformatted, dos2unix, cleaned up code, etc. + +1999-11-16 Tuesday 06:25 scott + + * doc/: Makefile.am (1.2), Makefile.in (1.2) (utags: + rel-3-0-6pre1): + (EXTRA_DIST): Added doc files that are to be distributed. + +1999-11-16 Tuesday 06:23 scott + + * m4/: Makefile.am (1.2, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2), Makefile.in (1.2) + (utags: rel-3-0-6pre1): Adjusted so that the macros aren't + installed. + +1999-11-16 Tuesday 06:21 scott + + * src/: Makefile.am (1.4, rel-3-6-0), Makefile.in (1.2) (utags: + rel-3-0-6pre1): + (EXTRA_DIST): Added ChangeLog. + (SUBDIRS): Added examples. + +1999-11-16 Tuesday 06:09 scott + + * doc/ChangeLog (1.1), src/examples/jules-badtag.mp3 (1.1, + rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), + src/examples/jules-goodtag.mp3 (1.1, rel-3-7-0, rel-3-6-2, + rel-3-6-0, rel-3-0-6pre1), src/examples/demo_info.cpp (1.1, + rel-3-0-6pre1): Initial revision. + +1999-11-16 Tuesday 06:09 scott + + * configure (1.5), configure.in (1.4) (utags: rel-3-0-6pre1): + Changed the distribution version to 3.0.6pre1. + +1999-11-16 Tuesday 06:00 scott + + * Makefile.am (1.2), Makefile.in (1.2) (utags: rel-3-0-6pre1): + Added EXTRA_DIST and moved EXTRA_SUBDIRS to SUBDIRS. + +1999-11-15 Monday 21:48 scott + + * .cvsignore (1.1), doc/.cvsignore (1.1, rel-3-6-0, rel-3-0-6pre1), + m4/.cvsignore (1.1, rel-3-6-0, rel-3-0-6pre1), src/.cvsignore (1.1, + rel-3-6-0, rel-3-0-6pre1), src/examples/.cvsignore (1.1), + src/id3/.cvsignore (1.1, rel-3-0-6pre1): Initial revision. + +1999-11-15 Monday 21:23 scott + + * src/id3/dll_wrapper.cpp (1.5, rel-3-0-6pre1): Added include for + config.h. + +1999-11-15 Monday 21:23 scott + + * src/id3/ChangeLog (1.1): Initial entry. The current entries are + actually entries culminated over a couple of weeks of work. I have + to make better use of this tool... + +1999-11-15 Monday 21:21 scott + + * src/id3/tag_render.cpp (1.5, rel-3-0-6pre1): Added include for + config.h. Minor code cleanup. Removed assignments from if checks; + first makes assignment, then checks for appropriate value. Made + private member variable names more descriptive. Now uses mktemp + rather than mkstemp in GenerateTempName so that a file descriptor + isn't created along with the temporary name. + +1999-11-15 Monday 21:20 scott + + * src/id3/tag_find.cpp (1.5, rel-3-0-6pre1): Added include for + config.h. Removed assignments from if checks; first makes + assignment, then checks for appropriate value. Made private member + variable names more descriptive. Major code cleanup: use of for + loops instead of while's to ease code readability, more compact + looping structures to reduce possibility in coding or human parsing + errors, + +1999-11-15 Monday 21:20 scott + + * src/id3/tag_file.cpp (1.4, rel-3-0-6pre1): Added include for + config.h. Minor code cleanup. Removed assignments from if checks; + first makes assignment, then checks for appropriate value. Made + private member variable names more descriptive. OpenLinkedFile now + checks to see if the file is writable or not, and still opens the + file, even if it can't be written to. This needs to be more robust + + (i.e., we shouldn't be creating temp files if the file isn't + writable). Made use of bFileWrtiable variable, which was + introduced. + +1999-11-15 Monday 21:20 scott + + * src/id3/tag.h (1.6, rel-3-0-6pre1): Made variable names more + descriptive. Added const qualifier to appropriate methods. + +1999-11-15 Monday 21:19 scott + + * src/id3/int28.cpp (1.5, rel-3-0-6pre1): Added include for + config.h. Changed some ints to luints to avoid compiler warnings. + +1999-11-15 Monday 21:18 scott + + * src/id3/: header.h (1.5), header_frame.h (1.5) (utags: + rel-3-0-6pre1): Made variable names more descriptive. + +1999-11-15 Monday 21:18 scott + + * src/id3/header.cpp (1.5, rel-3-0-6pre1): Added include for + config.h. Minor code cleanup. Made private member variable names + more descriptive. Fixed bug I introduced in logic of checking + version/revision numbers in ID3_LookupHeaderInfo, and cleaned up the + code in the process. + +1999-11-15 Monday 21:18 scott + + * src/id3/: frame_parse.cpp (1.5), header_tag.cpp (1.5) (utags: + rel-3-0-6pre1): Added include for config.h. Made variable names + more descriptive. + +1999-11-15 Monday 21:18 scott + + * src/id3/frame.h (1.6, rel-3-0-6pre1): Made ID3_Tag a friend of + ID3_Frame to allow access to the private members in ID3_Frame. Made + variable names more descriptive. Added const qualifier to + appropriate methods. + +1999-11-15 Monday 21:15 scott + + * src/id3/: field_binary.cpp (1.5), field_integer.cpp (1.5), + field_string_ascii.cpp (1.5), field_string_unicode.cpp (1.5), + frame.cpp (1.5), frame_render.cpp (1.5), header_frame.cpp (1.5), + misc_support.cpp (1.6), tag.cpp (1.5), tag_parse.cpp (1.5), + tag_parse_lyrics3.cpp (1.5), tag_parse_v1.cpp (1.5), tag_sync.cpp + (1.5) (utags: rel-3-0-6pre1): Added include for config.h. Minor + code cleanup. Removed assignments from if checks; first makes + assignment, then checks for appropriate value. Made private member + variable names more descriptive. + +1999-11-15 Monday 21:15 scott + + * src/id3/field.h (1.6, rel-3-0-6pre1): Made ID3_Frame and ID3_Tag + friends of the ID3_Field class to allow access to the private + members in ID3_Field. Made ID3FF field flags const luints, rather + than #define's. Made member variable names of classes and structs + more descriptive. + +1999-11-15 Monday 21:15 scott + + * src/id3/field.cpp (1.5, rel-3-0-6pre1): Added include for + config.h. Replaced LU_NULL with ID3FF_NONE for more consistency in + flag naming. Blocked out the ID3FD_Volume array definition since it + is currently unused. Reformatted ID3_FrameDefs for easier reading + (although most lines are more than 80 chars long now). Made private + member variable names more descriptive. Fixed bug in SetVersion + (was checking "rev != rev"). Adjusted logic somewhat in BinSize to + ease code reading. Fixed bug in BinSize that was causing incorrect + parsing of correct frames, such as COMM (previously assumed a + wchar_t is 2 bytes, which might not be true on some platforms). + +1999-11-15 Monday 21:15 scott + + * src/id3/error.h (1.5, rel-3-0-6pre1): Made constructor public. + Added new interface to error reporting to allow for more descriptive + error messages (this should still be worked on). Made private + member variable names more descriptive. Added const qualifier to + appropriate methods. + +1999-11-15 Monday 21:15 scott + + * src/id3/error.cpp (1.5, rel-3-0-6pre1): Added include for + config.h. Added new interface to error reporting to allow for more + descriptive error messages (this should still be worked on). Made + private member variable names more descriptive. + +1999-11-15 Monday 21:13 scott + + * src/id3/: Makefile.am (1.3, rel-3-7-0, rel-3-6-2), Makefile.in + (1.2): + * Makefile.am, Makefile.in: Updated versioning info and CXXFLAGS + +1999-11-04 Thursday 06:19 scott + + * src/examples/demo_convert.cpp (1.3): Removed deprecated call to + SetVersion (now a private method) + +1999-11-04 Thursday 05:33 scott + + * m4/Makefile.in (1.1), doc/Makefile.in (1.1), src/Makefile.in + (1.1), src/id3/Makefile.in (1.1), src/examples/Makefile.in (1.1): + Initial revision. + +1999-11-04 Thursday 05:32 scott + + * Makefile.in (1.1), acconfig.h (1.3, rel-3-0-6pre1), aclocal.m4 + (1.3, rel-3-0-6pre1), config.h.in (1.3, rel-3-0-6pre1), configure + (1.4), src/id3/error.h (1.4), src/id3/field.h (1.5), + src/id3/frame.h (1.5), src/id3/tag.h (1.5): Initial revision + +1999-11-04 Thursday 05:15 scott + + * src/id3/: dll.h (1.4, rel-3-0-6pre1), dll_wrapper.cpp (1.4), + error.cpp (1.4), error.h (1.3), externals.h (1.4, rel-3-0-6pre1), + field.cpp (1.4), field.h (1.4), field_binary.cpp (1.4), + field_integer.cpp (1.4), field_string_ascii.cpp (1.4), + field_string_unicode.cpp (1.4), frame.cpp (1.4), frame.h (1.4), + frame_parse.cpp (1.4), frame_render.cpp (1.4), header.cpp (1.4), + header.h (1.4), header_frame.cpp (1.4), header_frame.h (1.4), + header_tag.cpp (1.4), header_tag.h (1.4, rel-3-0-6pre1), int28.cpp + (1.4), int28.h (1.4, rel-3-0-6pre1), misc_support.cpp (1.5), + misc_support.h (1.4, rel-3-0-6pre1), tag.cpp (1.4), tag.h (1.4), + tag_file.cpp (1.3), tag_find.cpp (1.4), tag_parse.cpp (1.4), + tag_parse_lyrics3.cpp (1.4), tag_parse_v1.cpp (1.4), tag_render.cpp + (1.4), tag_sync.cpp (1.4), types.h (1.4, rel-3-0-6pre1), version.h + (1.4, rel-3-0-6pre1): Added cvs Id and Log tags to beginning and + end of file, respectively. + +1999-11-04 Thursday 04:58 scott + + * configure.in (1.3): Removed reference to zlib + +1999-11-04 Thursday 04:56 scott + + * src/id3/misc_support.cpp (1.4): Added log cvs tag. + +1999-11-04 Thursday 04:55 scott + + * src/id3/: dll_wrapper.cpp (1.3), error.cpp (1.3), field.cpp + (1.3), field_binary.cpp (1.3), field_integer.cpp (1.3), + field_string_ascii.cpp (1.3), field_string_unicode.cpp (1.3), + frame.cpp (1.3), frame_parse.cpp (1.3), frame_render.cpp (1.3), + header.cpp (1.3), header_frame.cpp (1.3), header_tag.cpp (1.3), + int28.cpp (1.3), misc_support.cpp (1.3), tag.cpp (1.3), + tag_find.cpp (1.3), tag_parse.cpp (1.3), tag_parse_lyrics3.cpp + (1.3), tag_parse_v1.cpp (1.3), tag_render.cpp (1.3), tag_sync.cpp + (1.3): Code clean up. No semantic changes. + +1999-11-02 Tuesday 06:54 scott + + * src/id3/: dll.h (1.3), externals.h (1.3), field.h (1.3), frame.h + (1.3), header.h (1.3), header_frame.h (1.3), header_tag.h (1.3), + int28.h (1.3), misc_support.h (1.3), tag.h (1.3), types.h (1.3), + version.h (1.3): Formatting changes (tabs to spaces, excess space + removal, etc.) + +1999-11-01 Monday 06:48 scott + + * src/: Makefile.am (1.3), zlib/Makefile.am (1.2), zlib/adler32.c + (1.2), zlib/compress.c (1.2), zlib/crc32.c (1.2), zlib/deflate.c + (1.2), zlib/deflate.h (1.2), zlib/gzio.c (1.2), zlib/infblock.c + (1.2), zlib/infblock.h (1.2), zlib/infcodes.c (1.2), + zlib/infcodes.h (1.2), zlib/inffast.c (1.2), zlib/inffast.h (1.2), + zlib/inffixed.h (1.2), zlib/inflate.c (1.2), zlib/inftrees.c (1.2), + zlib/inftrees.h (1.2), zlib/infutil.c (1.2), zlib/infutil.h (1.2), + zlib/trees.c (1.2), zlib/trees.h (1.2), zlib/uncompr.c (1.2), + zlib/zconf.h (1.2), zlib/zlib.h (1.2), zlib/zutil.c (1.2), + zlib/zutil.h (1.2): Removed zlib files -- unnecessary for linx + +1999-11-01 Monday 06:38 scott + + * src/examples/demo_convert.cpp (1.2): Cleaned up code (tabs, + whitespace, etc) + +1999-11-01 Monday 06:34 scott + + * acconfig.h (1.2), aclocal.m4 (1.2), config.h.in (1.2), configure + (1.3): Removed automatically generated files created with ./reconf + +1999-11-01 Monday 06:29 scott + + * configure (1.2), configure.in (1.2), src/Makefile.am (1.2), + src/id3/Makefile.am (1.2): Now makes Makefiles in src/zlib and + src/examples + +1999-11-01 Monday 06:23 scott + + * src/: zlib/Makefile.am (1.1), examples/Makefile.am (1.1, + rel-3-0-6pre1): Initial revision + +1999-11-01 Monday 06:19 scott + + * src/id3/: dll.h (1.2), dll_wrapper.cpp (1.2), error.cpp (1.2), + error.h (1.2), externals.h (1.2), field.cpp (1.2), field.h (1.2), + field_binary.cpp (1.2), field_integer.cpp (1.2), + field_string_ascii.cpp (1.2), field_string_unicode.cpp (1.2), + frame.cpp (1.2), frame.h (1.2), frame_parse.cpp (1.2), + frame_render.cpp (1.2), header.cpp (1.2), header.h (1.2), + header_frame.cpp (1.2), header_frame.h (1.2), header_tag.cpp (1.2), + header_tag.h (1.2), int28.cpp (1.2), int28.h (1.2), + misc_support.cpp (1.2), misc_support.h (1.2), tag.cpp (1.2), tag.h + (1.2), tag_file.cpp (1.2), tag_find.cpp (1.2), tag_parse.cpp (1.2), + tag_parse_lyrics3.cpp (1.2), tag_parse_v1.cpp (1.2), tag_render.cpp + (1.2), tag_sync.cpp (1.2), types.h (1.2), version.h (1.2): Cleaned + up the code somwhat. Made some of the files more readable in 80 + character displays. Switched tabs to spaces. Changed #include to + point to right directory for the id3 .h files. Changed call to + tmpnam to mkstemp in tag_render.cpp. + +1999-11-01 Monday 05:57 scott + + * orig/source/examples/readme.txt (1.2), src/examples/readme.txt + (1.1): Moved readme.txt from orig/sources/examples to src/examples + +1999-11-01 Monday 05:57 scott + + * orig/source/examples/demo_main.cpp (1.2), + src/examples/demo_main.cpp (1.1): Moved demo_main.cpp from + orig/sources/examples to src/examples + +1999-11-01 Monday 05:57 scott + + * orig/source/examples/demo_convert.cpp (1.2), + src/examples/demo_convert.cpp (1.1): Moved demo_convert.cpp from + orig/sources/examples to src/examples + +1999-11-01 Monday 05:52 scott + + * doc/id3v2.png (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), orig/documentation/id3v2.png (1.2): Moved id3v2.png + from orig/documentation to doc + +1999-11-01 Monday 05:52 scott + + * doc/id3v2.ico (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), orig/documentation/id3v2.ico (1.2): Moved id3v2.ico + from orig/documentation to doc + +1999-11-01 Monday 05:52 scott + + * doc/id3v2.gif (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), orig/documentation/id3v2.gif (1.2): Moved id3v2.gif + from orig/documentation to doc + +1999-11-01 Monday 05:52 scott + + * doc/id3lib305.doc (1.1, rel-3-0-6pre1), + orig/documentation/id3lib305.doc (1.2): Moved id3lib305.doc from + orig/documentation to doc + +1999-11-01 Monday 05:52 scott + + * doc/id3guide.html (1.1, rel-3-0-6pre1), + orig/documentation/id3guide.html (1.2): Moved id3guide.html from + orig/documentation to doc + +1999-11-01 Monday 05:48 scott + + * doc/zlib_readme.txt (1.1, rel-3-0-6pre1), + orig/documentation/zlib_readme.txt (1.2): Moved zlib_readme.txt + from orig/documentation to doc + +1999-11-01 Monday 05:48 scott + + * doc/software.txt (1.1, rel-3-0-6pre1), + orig/documentation/software.txt (1.2): Moved software.txt from + orig/documentation to doc + +1999-11-01 Monday 05:48 scott + + * doc/logo.txt (1.1, rel-3-0-6pre1), orig/documentation/logo.txt + (1.2): Moved logo.txt from orig/documentation to doc + +1999-11-01 Monday 05:48 scott + + * doc/licence.txt (1.1, rel-3-0-6pre1), + orig/documentation/licence.txt (1.2): Moved licence.txt from + orig/documentation to doc + +1999-11-01 Monday 05:48 scott + + * doc/id3v2-3.00.txt (1.1, rel-3-0-6pre1), + orig/documentation/id3v2-3.00.txt (1.2): Moved id3v2-3.00.txt from + orig/documentation to doc + +1999-11-01 Monday 05:48 scott + + * doc/id3libhistory.txt (1.1, rel-3-0-6pre1), + orig/documentation/id3libhistory.txt (1.2): Moved id3libhistory.txt + from orig/documentation to doc + +1999-11-01 Monday 05:48 scott + + * doc/contact.txt (1.1, rel-3-0-6pre1), + orig/documentation/contact.txt (1.2): Moved contact.txt from + orig/documentation to doc + +1999-11-01 Monday 05:48 scott + + * doc/bugreport.txt (1.1, rel-3-0-6pre1), + orig/documentation/bugreport.txt (1.2): Moved bugreport.txt from + orig/documentation to doc + +1999-11-01 Monday 05:40 scott + + * src/: id3/trees.h (1.2), zlib/trees.h (1.1): Moved trees.h from + src/id3 to src/zlib + +1999-11-01 Monday 05:40 scott + + * src/: id3/deflate.h (1.2), zlib/deflate.h (1.1): Moved deflate.h + from src/id3 to src/zlib + +1999-11-01 Monday 05:39 scott + + * src/: id3/zutil.h (1.2), zlib/zutil.h (1.1): Moved zutil.h from + src/id3 to src/zlib + +1999-11-01 Monday 05:39 scott + + * src/: id3/zlib.h (1.2), zlib/zlib.h (1.1): Moved zlib.h from + src/id3 to src/zlib + +1999-11-01 Monday 05:39 scott + + * src/: id3/zconf.h (1.2), zlib/zconf.h (1.1): Moved zconf.h from + src/id3 to src/zlib + +1999-11-01 Monday 05:39 scott + + * src/: id3/infutil.h (1.2), zlib/infutil.h (1.1): Moved infutil.h + from src/id3 to src/zlib + +1999-11-01 Monday 05:39 scott + + * src/: id3/inftrees.h (1.2), zlib/inftrees.h (1.1): Moved + inftrees.h from src/id3 to src/zlib + +1999-11-01 Monday 05:39 scott + + * src/: id3/inffixed.h (1.2), zlib/inffixed.h (1.1): Moved + inffixed.h from src/id3 to src/zlib + +1999-11-01 Monday 05:39 scott + + * src/: id3/inffast.h (1.2), zlib/inffast.h (1.1): Moved inffast.h + from src/id3 to src/zlib + +1999-11-01 Monday 05:39 scott + + * src/: id3/infcodes.h (1.2), zlib/infcodes.h (1.1): Moved + infcodes.h from src/id3 to src/zlib + +1999-11-01 Monday 05:39 scott + + * src/: id3/infblock.h (1.2), zlib/infblock.h (1.1): Moved + infblock.h from src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/zutil.c (1.2), zlib/zutil.c (1.1): Moved zutil.c from + src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/uncompr.c (1.2), zlib/uncompr.c (1.1): Moved uncompr.c + from src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/trees.c (1.2), zlib/trees.c (1.1): Moved trees.c from + src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/infutil.c (1.2), zlib/infutil.c (1.1): Moved infutil.c + from src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/inftrees.c (1.2), zlib/inftrees.c (1.1): Moved + inftrees.c from src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/inflate.c (1.2), zlib/inflate.c (1.1): Moved inflate.c + from src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/inffast.c (1.2), zlib/inffast.c (1.1): Moved inffast.c + from src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/infcodes.c (1.2), zlib/infcodes.c (1.1): Moved + infcodes.c from src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/infblock.c (1.2), zlib/infblock.c (1.1): Moved + infblock.c from src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/gzio.c (1.2), zlib/gzio.c (1.1): Moved gzio.c from + src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/deflate.c (1.2), zlib/deflate.c (1.1): Moved deflate.c + from src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/crc32.c (1.2), zlib/crc32.c (1.1): Moved crc32.c from + src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/compress.c (1.2), zlib/compress.c (1.1): Moved + compress.c from src/id3 to src/zlib + +1999-11-01 Monday 05:38 scott + + * src/: id3/adler32.c (1.2), zlib/adler32.c (1.1): Moved adler32.c + from src/id3 to src/zlib + +1999-11-01 Monday 05:36 scott + + * orig/source/library/zutil.h (1.2), src/id3/zutil.h (1.1): Moved + zutil.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/zlib.h (1.2), src/id3/zlib.h (1.1): Moved + zlib.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/zconf.h (1.2), src/id3/zconf.h (1.1): Moved + zconf.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/trees.h (1.2), src/id3/trees.h (1.1): Moved + trees.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/infutil.h (1.2), src/id3/infutil.h (1.1): + Moved infutil.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/inftrees.h (1.2), src/id3/inftrees.h (1.1): + Moved inftrees.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/inffixed.h (1.2), src/id3/inffixed.h (1.1): + Moved inffixed.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/inffast.h (1.2), src/id3/inffast.h (1.1): + Moved inffast.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/infcodes.h (1.2), src/id3/infcodes.h (1.1): + Moved infcodes.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/infblock.h (1.2), src/id3/infblock.h (1.1): + Moved infblock.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/deflate.h (1.2), src/id3/deflate.h (1.1): + Moved deflate.h to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/zutil.c (1.2), src/id3/zutil.c (1.1): Moved + zutil.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/uncompr.c (1.2), src/id3/uncompr.c (1.1): + Moved uncompr.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/trees.c (1.2), src/id3/trees.c (1.1): Moved + trees.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/infutil.c (1.2), src/id3/infutil.c (1.1): + Moved infutil.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/inftrees.c (1.2), src/id3/inftrees.c (1.1): + Moved inftrees.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/inflate.c (1.2), src/id3/inflate.c (1.1): + Moved inflate.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/inffast.c (1.2), src/id3/inffast.c (1.1): + Moved inffast.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/infcodes.c (1.2), src/id3/infcodes.c (1.1): + Moved infcodes.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/infblock.c (1.2), src/id3/infblock.c (1.1): + Moved infblock.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/gzio.c (1.2), src/id3/gzio.c (1.1): Moved + gzio.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/deflate.c (1.2), src/id3/deflate.c (1.1): + Moved deflate.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/crc32.c (1.2), src/id3/crc32.c (1.1): Moved + crc32.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/compress.c (1.2), src/id3/compress.c (1.1): + Moved compress.c to src/zlib + +1999-11-01 Monday 05:35 scott + + * orig/source/library/adler32.c (1.2), src/id3/adler32.c (1.1): + Moved adler32.c to src/zlib + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_version.h (1.2), src/id3/version.h (1.1): + Renamed id3_version.h to version.h and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_types.h (1.2), src/id3/types.h (1.1): + Renamed id3_types.h to types.h and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_tag_sync.cpp (1.2), src/id3/tag_sync.cpp + (1.1): Renamed id3_tag_sync.cpp to tag_sync.cpp and moved to + src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_tag_render.cpp (1.2), + src/id3/tag_render.cpp (1.1): Renamed id3_tag_render.cpp to + tag_render.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_tag_parse_v1.cpp (1.2), + src/id3/tag_parse_v1.cpp (1.1): Renamed id3_tag_parse_v1.cpp to + tag_parse_v1.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_tag_parse_lyrics3.cpp (1.2), + src/id3/tag_parse_lyrics3.cpp (1.1): Renamed + id3_tag_parse_lyrics3.cpp to tag_parse_lyrics3.cpp and moved to + src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_tag_parse.cpp (1.2), + src/id3/tag_parse.cpp (1.1): Renamed id3_tag_parse.cpp to + tag_parse.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_tag_find.cpp (1.2), src/id3/tag_find.cpp + (1.1): Renamed id3_tag_find.cpp to tag_find.cpp and moved to + src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_tag_file.cpp (1.2), src/id3/tag_file.cpp + (1.1): Renamed id3_tag_file.cpp to tag_file.cpp and moved to + src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_tag.h (1.2), src/id3/tag.h (1.1): Renamed + id3_tag.h to tag.h and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_tag.cpp (1.2), src/id3/tag.cpp (1.1): + Renamed id3_tag.cpp to tag.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_misc_support.h (1.2), + src/id3/misc_support.h (1.1): Renamed id3_misc_support.h to + misc_support.h and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_misc_support.cpp (1.2), + src/id3/misc_support.cpp (1.1): Renamed id3_misc_support.cpp to + misc_support.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_int28.h (1.2), src/id3/int28.h (1.1): + Renamed id3_int28.h to int28.h and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_int28.cpp (1.2), src/id3/int28.cpp (1.1): + Renamed id3_int28.cpp to int28.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_header_tag.h (1.2), src/id3/header_tag.h + (1.1): Renamed id3_header_tag.h to header_tag.h and moved to + src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_header_tag.cpp (1.2), + src/id3/header_tag.cpp (1.1): Renamed id3_header_tag.cpp to + header_tag.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_header_frame.h (1.2), + src/id3/header_frame.h (1.1): Renamed id3_header_frame.h to + header_frame.h and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_header_frame.cpp (1.2), + src/id3/header_frame.cpp (1.1): Renamed id3_header_frame.cpp to + header_frame.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_header.h (1.2), src/id3/header.h (1.1): + Renamed id3_header.h to header.h and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_header.cpp (1.2), src/id3/header.cpp + (1.1): Renamed id3_header.cpp to header.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_frame_render.cpp (1.2), + src/id3/frame_render.cpp (1.1): Renamed id3_frame_render.cpp to + frame_render.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_frame_parse.cpp (1.2), + src/id3/frame_parse.cpp (1.1): Renamed id3_frame_parse.cpp to + frame_parse.cpp and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_frame.h (1.2), src/id3/frame.h (1.1): + Renamed id3_frame.h to frame.h and moved to src/id3 + +1999-11-01 Monday 05:31 scott + + * orig/source/library/id3_frame.cpp (1.2), src/id3/frame.cpp (1.1): + Renamed id3_frame.cpp to frame.cpp and moved to src/id3 + +1999-11-01 Monday 05:30 scott + + * orig/source/library/id3_field_string_unicode.cpp (1.2), + src/id3/field_string_unicode.cpp (1.1): Renamed + id3_field_string_unicode.cpp to field_string_unicode.cpp and moved + to src/id3 + +1999-11-01 Monday 05:30 scott + + * orig/source/library/id3_field_string_ascii.cpp (1.2), + src/id3/field_string_ascii.cpp (1.1): Renamed + id3_field_string_ascii.cpp to field_string_ascii.cpp and moved to + src/id3 + +1999-11-01 Monday 05:30 scott + + * orig/source/library/id3_field_integer.cpp (1.2), + src/id3/field_integer.cpp (1.1): Renamed id3_field_integer.cpp to + field_integer.cpp and moved to src/id3 + +1999-11-01 Monday 05:30 scott + + * orig/source/library/id3_field_binary.cpp (1.2), + src/id3/field_binary.cpp (1.1): Renamed id3_field_binary.cpp to + field_binary.cpp and moved to src/id3 + +1999-11-01 Monday 05:30 scott + + * orig/source/library/id3_field.h (1.2), src/id3/field.h (1.1): + Renamed id3_field.h to field.h and moved to src/id3 + +1999-11-01 Monday 05:30 scott + + * orig/source/library/id3_field.cpp (1.2), src/id3/field.cpp (1.1): + Renamed id3_field.cpp to field.cpp and moved to src/id3 + +1999-11-01 Monday 05:30 scott + + * orig/source/library/id3_externals.h (1.2), src/id3/externals.h + (1.1): Renamed id3_externals.h to externals.h and moved to src/id3 + +1999-11-01 Monday 05:30 scott + + * orig/source/library/id3_error.h (1.2), src/id3/error.h (1.1): + Renamed id3_error.h to error.h and moved to src/id3 + +1999-11-01 Monday 05:30 scott + + * orig/source/library/id3_error.cpp (1.2), src/id3/error.cpp (1.1): + Renamed id3_error.cpp to error.cpp and moved to src/id3 + +1999-11-01 Monday 05:30 scott + + * orig/source/library/id3_dll_wrapper.cpp (1.2), + src/id3/dll_wrapper.cpp (1.1): Renamed id3_dll_wrapper.cpp to + dll_wrapper.cpp and moved to src/id3 + +1999-11-01 Monday 05:26 scott + + * orig/source/library/id3_dll.h (1.2), src/id3/dll.h (1.1): Renamed + id3_dll.h to dll.h and moved to src/id3 + +1999-11-01 Monday 04:14 scott + + * orig/dll/id3lib.dll (1.1), orig/dll/id3lib.exp (1.1), + orig/dll/id3lib.h (1.1), orig/dll/id3lib.lib (1.1), + orig/dll/readme.txt (1.1), orig/documentation/bugreport.txt (1.1), + orig/documentation/contact.txt (1.1), + orig/documentation/id3guide.html (1.1), + orig/documentation/id3lib305.doc (1.1), + orig/documentation/id3libhistory.txt (1.1), + orig/documentation/id3v2-3.00.txt (1.1), + orig/documentation/id3v2.gif (1.1), orig/documentation/id3v2.ico + (1.1), orig/documentation/id3v2.png (1.1), + orig/documentation/licence.txt (1.1), orig/documentation/logo.txt + (1.1), orig/documentation/software.txt (1.1), + orig/documentation/zlib_readme.txt (1.1), + orig/source/examples/demo_convert.cpp (1.1), + orig/source/examples/demo_main.cpp (1.1), + orig/source/examples/readme.txt (1.1), + orig/source/library/adler32.c (1.1), orig/source/library/compress.c + (1.1), orig/source/library/crc32.c (1.1), + orig/source/library/deflate.c (1.1), orig/source/library/deflate.h + (1.1), orig/source/library/gzio.c (1.1), + orig/source/library/id3_dll.h (1.1), + orig/source/library/id3_dll_wrapper.cpp (1.1), + orig/source/library/id3_error.cpp (1.1), + orig/source/library/id3_error.h (1.1), + orig/source/library/id3_externals.h (1.1), + orig/source/library/id3_field.cpp (1.1), + orig/source/library/id3_field.h (1.1), + orig/source/library/id3_field_binary.cpp (1.1), + orig/source/library/id3_field_integer.cpp (1.1), + orig/source/library/id3_field_string_ascii.cpp (1.1), + orig/source/library/id3_field_string_unicode.cpp (1.1), + orig/source/library/id3_frame.cpp (1.1), + orig/source/library/id3_frame.h (1.1), + orig/source/library/id3_frame_parse.cpp (1.1), + orig/source/library/id3_frame_render.cpp (1.1), + orig/source/library/id3_header.cpp (1.1), + orig/source/library/id3_header.h (1.1), + orig/source/library/id3_header_frame.cpp (1.1), + orig/source/library/id3_header_frame.h (1.1), + orig/source/library/id3_header_tag.cpp (1.1), + orig/source/library/id3_header_tag.h (1.1), + orig/source/library/id3_int28.cpp (1.1), + orig/source/library/id3_int28.h (1.1), + orig/source/library/id3_misc_support.cpp (1.1), + orig/source/library/id3_misc_support.h (1.1), + orig/source/library/id3_tag.cpp (1.1), + orig/source/library/id3_tag.h (1.1), + orig/source/library/id3_tag_file.cpp (1.1), + orig/source/library/id3_tag_find.cpp (1.1), + orig/source/library/id3_tag_parse.cpp (1.1), + orig/source/library/id3_tag_parse_lyrics3.cpp (1.1), + orig/source/library/id3_tag_parse_v1.cpp (1.1), + orig/source/library/id3_tag_render.cpp (1.1), + orig/source/library/id3_tag_sync.cpp (1.1), + orig/source/library/id3_types.h (1.1), + orig/source/library/id3_version.h (1.1), + orig/source/library/infblock.c (1.1), + orig/source/library/infblock.h (1.1), + orig/source/library/infcodes.c (1.1), + orig/source/library/infcodes.h (1.1), orig/source/library/inffast.c + (1.1), orig/source/library/inffast.h (1.1), + orig/source/library/inffixed.h (1.1), orig/source/library/inflate.c + (1.1), orig/source/library/inftrees.c (1.1), + orig/source/library/inftrees.h (1.1), orig/source/library/infutil.c + (1.1), orig/source/library/infutil.h (1.1), + orig/source/library/trees.c (1.1), orig/source/library/trees.h + (1.1), orig/source/library/uncompr.c (1.1), + orig/source/library/zconf.h (1.1), orig/source/library/zlib.h + (1.1), orig/source/library/zutil.c (1.1), + orig/source/library/zutil.h (1.1), AUTHORS (1.1, rel-3-0-6pre1), + COPYING (1.1, rel-3-0-6pre1), ChangeLog (1.1), INSTALL (1.1, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), + Makefile.am (1.1), NEWS (1.1, rel-3-0-6pre1), README (1.1, + rel-3-0-6pre1), THANKS (1.1, rel-3-0-6pre1), acconfig.h (1.1), + aclocal.m4 (1.1), config.guess (1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, + rel-3-6-0, rel-3-0-6pre1), config.h.in (1.1), config.sub (1.1, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), + configure (1.1), configure.in (1.1), install-sh (1.1, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), ltconfig (1.1, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), + ltmain.sh (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), missing (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), mkinstalldirs (1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, + rel-3-6-0, rel-3-0-6pre1), reconf (1.1, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), stamp-h.in (1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, + rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), + doc/Makefile.am (1.1), m4/Makefile.am (1.1, rel-3-0-6pre1), + m4/lf_bash.m4 (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), m4/lf_cc.m4 (1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, + rel-3-6-0, rel-3-0-6pre1), m4/lf_cxx.m4 (1.1, rel-3-0-6pre1), + m4/lf_fortran.m4 (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, + rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, + rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), m4/lf_host_type.m4 (1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, + rel-3-6-0, rel-3-0-6pre1), m4/lf_lisp.m4 (1.1, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), m4/lf_local.m4 + (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), + m4/lf_nm.m4 (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), m4/lf_texidoc.m4 (1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, + rel-3-6-0, rel-3-0-6pre1), m4/lf_txtc.m4 (1.1, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), m4/lf_warnings.m4 + (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, + rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, + rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), + m4/lf_x11.m4 (1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), src/Makefile.am (1.1, rel-3-6-0, rel-3-0-6pre1), + src/id3/Makefile.am (1.1): Initial revision + +1999-11-01 Monday 04:14 scott + + * orig/: dll/id3lib.dll (1.1.1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, + rel-3-6-0, rel-3-0-6pre1), dll/id3lib.exp (1.1.1.1, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), dll/id3lib.h + (1.1.1.1, rel-3-7-13, rel-3-7-12, rel-3-7-11, rel-3-7-10, + rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, + rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, rel-3-6-0, + rel-3-0-6pre1), dll/id3lib.lib (1.1.1.1, rel-3-7-13, rel-3-7-12, + rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, rel-3-7-7, rel-3-7-5, + rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, rel-3-7-0, rel-3-6-2, + rel-3-6-0, rel-3-0-6pre1), dll/readme.txt (1.1.1.1, rel-3-7-13, + rel-3-7-12, rel-3-7-11, rel-3-7-10, rel-3-7-9, rel-3-7-8, + rel-3-7-7, rel-3-7-5, rel-3-7-4, rel-3-7-3, rel-3-7-2, rel-3-7-1, + rel-3-7-0, rel-3-6-2, rel-3-6-0, rel-3-0-6pre1), + documentation/bugreport.txt (1.1.1.1), documentation/contact.txt + (1.1.1.1), documentation/id3guide.html (1.1.1.1), + documentation/id3lib305.doc (1.1.1.1), + documentation/id3libhistory.txt (1.1.1.1), + documentation/id3v2-3.00.txt (1.1.1.1), documentation/id3v2.gif + (1.1.1.1), documentation/id3v2.ico (1.1.1.1), + documentation/id3v2.png (1.1.1.1), documentation/licence.txt + (1.1.1.1), documentation/logo.txt (1.1.1.1), + documentation/software.txt (1.1.1.1), documentation/zlib_readme.txt + (1.1.1.1), source/examples/demo_convert.cpp (1.1.1.1), + source/examples/demo_main.cpp (1.1.1.1), source/examples/readme.txt + (1.1.1.1), source/library/adler32.c (1.1.1.1), + source/library/compress.c (1.1.1.1), source/library/crc32.c + (1.1.1.1), source/library/deflate.c (1.1.1.1), + source/library/deflate.h (1.1.1.1), source/library/gzio.c + (1.1.1.1), source/library/id3_dll.h (1.1.1.1), + source/library/id3_dll_wrapper.cpp (1.1.1.1), + source/library/id3_error.cpp (1.1.1.1), source/library/id3_error.h + (1.1.1.1), source/library/id3_externals.h (1.1.1.1), + source/library/id3_field.cpp (1.1.1.1), source/library/id3_field.h + (1.1.1.1), source/library/id3_field_binary.cpp (1.1.1.1), + source/library/id3_field_integer.cpp (1.1.1.1), + source/library/id3_field_string_ascii.cpp (1.1.1.1), + source/library/id3_field_string_unicode.cpp (1.1.1.1), + source/library/id3_frame.cpp (1.1.1.1), source/library/id3_frame.h + (1.1.1.1), source/library/id3_frame_parse.cpp (1.1.1.1), + source/library/id3_frame_render.cpp (1.1.1.1), + source/library/id3_header.cpp (1.1.1.1), + source/library/id3_header.h (1.1.1.1), + source/library/id3_header_frame.cpp (1.1.1.1), + source/library/id3_header_frame.h (1.1.1.1), + source/library/id3_header_tag.cpp (1.1.1.1), + source/library/id3_header_tag.h (1.1.1.1), + source/library/id3_int28.cpp (1.1.1.1), source/library/id3_int28.h + (1.1.1.1), source/library/id3_misc_support.cpp (1.1.1.1), + source/library/id3_misc_support.h (1.1.1.1), + source/library/id3_tag.cpp (1.1.1.1), source/library/id3_tag.h + (1.1.1.1), source/library/id3_tag_file.cpp (1.1.1.1), + source/library/id3_tag_find.cpp (1.1.1.1), + source/library/id3_tag_parse.cpp (1.1.1.1), + source/library/id3_tag_parse_lyrics3.cpp (1.1.1.1), + source/library/id3_tag_parse_v1.cpp (1.1.1.1), + source/library/id3_tag_render.cpp (1.1.1.1), + source/library/id3_tag_sync.cpp (1.1.1.1), + source/library/id3_types.h (1.1.1.1), source/library/id3_version.h + (1.1.1.1), source/library/infblock.c (1.1.1.1), + source/library/infblock.h (1.1.1.1), source/library/infcodes.c + (1.1.1.1), source/library/infcodes.h (1.1.1.1), + source/library/inffast.c (1.1.1.1), source/library/inffast.h + (1.1.1.1), source/library/inffixed.h (1.1.1.1), + source/library/inflate.c (1.1.1.1), source/library/inftrees.c + (1.1.1.1), source/library/inftrees.h (1.1.1.1), + source/library/infutil.c (1.1.1.1), source/library/infutil.h + (1.1.1.1), source/library/trees.c (1.1.1.1), source/library/trees.h + (1.1.1.1), source/library/uncompr.c (1.1.1.1), + source/library/zconf.h (1.1.1.1), source/library/zlib.h (1.1.1.1), + source/library/zutil.c (1.1.1.1), source/library/zutil.h (1.1.1.1) + (utags: id3lib-3-05a, ID3LIB_3_05a): Import of ID3LIB v. 3.05a + diff --git a/id3lib/HISTORY b/id3lib/HISTORY new file mode 100644 index 0000000..8d9d8cc --- /dev/null +++ b/id3lib/HISTORY @@ -0,0 +1,315 @@ +$Id: HISTORY,v 1.1 2007/12/11 20:21:18 pindakaasmod Exp $ + +ID3Lib History + +The following is a history of id3lib up to version 3.05a. Please see the +NEWS file for changes since then. + +23 Nov 1998 3.05a - Released 3.05a in which the only change was the + inclusion of a C header file for using the DLL + (how forgetful I am!). + +22 Nov 1998 3.05 - Released 3.05 and the DLL. + + 8 Nov 1998 3.05 - Finished the first revision of the DLL. Interesting + stuff. Contains both C++ class and C functions (the + C++ classes that are exported to the DLL are Tag, + Frame, Field and Error). + - Took out the SetVersion function from the ID3_Tag + class. This is because I no longer wish ID3Lib to be + able to create the old ID3v2-2.0 tags. ID3Lib will + always create the latest version tags it is capable + of creating. + + 1 Nov 1998 3.05 - Removed the encryption and grouping stuff. I have a + lot to do before I finish that section and I might + end up implementing it differently, so I thought it + best to remove it before people started using it + (no-one should since it wasn't fully functional + anyway). + +13 Oct 1998 3.05 - Work has begun on the Windows DLL. + + 9 Oct 1998 3.04 - Added the text list handling functions from 2.16, but + they are slightly different under 3.xx. + - Also added a Size() function for fields which + applications can use to allocate buffers and so on. + - Work has progressed on the encryption and grouping + side of things, but nothing usable by an application + just yet. + + 5 Oct 1998 3.04 - Changed the ID3_AddHandler() function to include a + parameter which specifies the factor by which the + size of the frame may increase as a result of + encryption or encoding. This is used for buffer and + size estimates. + + 3 Oct 1998 3.03a - Fixed a small Unicode BOM bug. + + 2 Oct 1998 3.03 - Added very minimal and not-totally-functional support + for the automatic handling of encryption and + grouping. + - Added a function to ID3_Tag which makes attaching + arrays of ID3_Frame objects easy. + + 1 Oct 1998 3.03 - Yesterday, ID3v2-3.0 became an informal standard. + Due to this, ID3Lib now does not create ID3v2-3.0 + tags with the EXPERIMENTAL bit set. + +30 Sep 1998 3.02 - Expanded the error handling class to include + functions which return the ID3Lib source file and + line number of the exception. This is useful for + debugging and generating bug reports (hint, hint). + +28 Sep 1998 3.02 - Added the grouping registration and encryption + registration frames. Also added support for parsing + and rendering frames with the grouping and encryption + symbols, although currently this data is ignored. I + plan to implement call backs to handle the encryption + and decryption of data. Also, there is currently no + checking at render-time that all frames which have + these symbols also have a corresponding rego frame. + +26 Sep 1998 3.02 - Changed the 'tag changed' stuff so that calls to + ID3_Tag::SetVersion(), ID3_Tag::SetCompression() etc + now constitute a change in the tag. This is because + of the relaxed restrictions on the calls to these + functions before rendering/updating. - Fixed a bug + in the ID3_Tag::Link() command. + +25 Sep 1998 3.01 - Added the ID3_Tag::RemoveFrame() function. + - Added the ID3_Tag::SetExtendedHeader() function, even + though this setting is currently ignored. + - Added luint return type to the Field::Get() functions + for ASCII and Unicode strings. These functions now + return how many characters (not bytes necessarily) of + the supplied buffer were used, not including the + NULL-termination. + - Added the 'unique file identifier' frame which I + omitted from 3.00 but was present in 2.xx. + - Added code that allows ID3Lib and applications to + track whether a tag has been altered since the last + parse or render. + - Slightly altered the padding strategy when a tag + shrinks in size. + - No more requirements on when ID3_Tag::SetVersion() + etc must be called, except that they should be called + prior to an update or render if you plan to use + different settings than the defaults. + +21 Sep 1998 3.00 - Released 3.00 + +15 Sep 1998 3.00 - Added support for parsing and converting ID3v1/1.1 + and Lyrics3 v2.0 tags and CDM frames from 2.01 + experimental tags. Also parses Unicode now. + + 9 Sep 1998 3.00 - Work almost done on 3.00. A little bit to fix up in + the parsing department (doesn't parse Unicode yet, or + CDMs from the old 2.01 draft). Then just add + validity checking and support for most of the frames. + + 2 Sep 1998 2.16 - Small Unicode string parsing bug fixed. + +25 Aug 1998 2.15 - Small bug fixes in the tag parsing routines. + - Completely removed support for creating extended + headers, and ID3Lib will now ignore tags which have + the EXTENDEDHEADER bit set (as under 2.00, this bit + isn't defined). + +24 Aug 1998 2.14 - Small bug fixes in the example file 'convert.cpp'. + - ID3Lib now sets the EXPERIMENTAL bit in the tag + header. + +13 Aug 1998 2.13 - As of 2.13, ID3Lib now comes in two flavours. The + first is the normal distribution as we have come to + know and love. The second is a machine-specific + archive which contains the static link libraries. + Currently, you can get Win32 link libraries. + +12 Aug 1998 2.12 - As of 2.12, the ID3Lib distribution will contain + precompiled static libraries for Visual C++ and + eventually for Linux i386. The MSVC static libs are + be compiled for the multi-threaded run-time library + and there will be one for debugging and one normal + one for release-quality applications. + + - Fixed a small exclusion in the 'id3_support.h' file. + It now contains a #include for the 'wchar.h' header + file. The absence of this line resulted in some + applications producing compilation errors if they + didn't already include it or 'stdio.h'. + +11 Aug 1998 2.12 - I created a small problem in 2.11 where the name of + the URL field in the 'ID3FID_WWWUSER' frame ('WXX') + was changed from ID3FN_URL to ID3FN_TEXT. This has + been fixed (is back to ID3FN_URL). + - When reading a binary tag, previous versions of + ID3Lib ignored the fact that some of the frames in + the tag may have been compressed, so when writing the + tag back out, those old frames were written without + compression. This is fixed so that all old frames + are written back out as they were read in, unless of + course you explicitly change the compression status + before rendering the new tag. + - Added the ID3C_SetSongSize and ID3C_GetSongSize + commands to the ID3_Tag class. These allow you to + tell ID3Lib how big (in bytes) the song file is to + which you intend attaching the tag. ID3Lib can then + work out how much padding the tag requires to + correctly make the entire resulting file fill an even + multiple of 2Kb. + - If the tag we are manipulating was read in as a + binary tag before we started playing with it, then + ID3Lib will record the size of tag before we started + fooling around with it. This way, the padding system + can pad the new tag out to the old size if the new + tag will still fit inside the old one. This makes + file manipulation much easier when writing tags to + existing song files. If it won't fit, then the new + tag will receive padding as per the 2K cluster + method. All this talk of padding only applies if the + tag's padding property is set to ID3PD_AUTOMATIC, + which it is by default. + +10 Aug 1998 2.11 - Replaced ID3C_SetID and GetID with proper field + names, and the same with ID3C_SetComp and GetComp. + This requires a change in source code for the + application. Without quotes, do a search and + replace... + + "ID3C_SetID," replace with "ID3C_Set, ID3FN_ID," + "ID3C_GetID," replace with "ID3C_Get, ID3FN_ID," + "ID3C_SetComp," replace with "ID3C_Set, ID3FN_COMPRESSED," + "ID3C_GetComp," replace with "ID3C_Get, ID3FN_COMPRESSED," + + - Thanks to a suggestion by Ilana Rudnik, I added a + generic frame type called 'ID3FID_UNSUPPORTED' which + is only to be used by applications as a + 'place-holder' in lists and arrays while waiting for + ID3Lib to support all the frames. + + 6 Aug 1998 2.11 - Created the ID3C_Locate and ID3C_GetNumFrames + commands. + - Made the documentation an HTML file instead of boring + text. + + 5 Aug 1998 2.11 - Thanks to Eng-Keong Lee, I have located and fixed a + bug which most-of-the-time caused a crash when + performing an ID3C_SetID on a frame for the first + time. + + 3 Aug 1998 2.10 - Fixed a few things to make ID3Lib compile completely + cleanly under Linux - thanks to Carlos Puchol for + finding the remaining hassles. + - Added two commands to adjust the unsync facility - + ID3C_SetUnsync and ID3C_GetUnsync. The default is + ID3SY_AUTOMATIC. + - Add support for the 2.01 extended tag header. By + default, ID3Lib will NOT write an extended header to + tags it creates. This can be adjusted by the + ID3C_SetExtHeader command. + - Changed the directory structure so that the required + zlib source is now in the same directory as the + ID3Lib source. + + 2 Aug 1998 2.10 - Fixed a small memory leak which occurred when + clearing a tag of frames which were read in from an + external binary tag. + - Added a 'bugreport.txt' file to the documentation to + improve effectiveness of bug reporting. + + 1 Aug 1998 2.10 - Adding support for tag padding. This results in two + new commands which operate on ID3_Tag objects: + ID3C_SetPadding and ID3C_GetPadding. + + 1 Aug 1998 2.09 - Fixed some bugs in the ID3C_ToFile and ID3C_FromFile + commands. + - Fixed a bug which prevented empty strings which were + supposed to be NULL-terminated from doing so. + +31 Jul 1998 2.09 - Changed the functionality of the error handling + mechanism. The function interface to the error + handler has changed - see the example source file + 'main.cpp' for details. + - Improved frame verification somewhat. + +28 July 1998 2.08 - Added ID3C_ToFile command to binary fields. + - Changed the format of the ID3C_Size command when + applied to frames. There is now a required second + parameter which specifies which field you require the + size of. If you request ID3FN_ALL, you will get the + size of the frame itself. + - The above change for ID3C_Size now also applies to + the ID3C_Clear command (again, only when applied to + frames). + - Enhanced the ID3C_Find command so as to allow + searches based on the ID3FN_LANGUAGE field and the + ID3FN_DESCRIPTION field. + +27 July 1998 2.07 - Fixed a bug which had the WXX and TXX frames + including a language field which they shouldn't. + - Fixed a bug in the string's ID3C_Get command which + wrongly interpreted the presence of a '/' symbol in + the string as meaning that the string was a textlist. + +21 July 1998 2.06 - Added support for frame compression via zlib. This + means that all frames have an extra attribute which + specifies whether the frame should be compressed. + - Changed some typedefs and macro names so as not to + clash with some of Windows' pre-defined + datatypes/names. Thanks to Chuck Zenkus for finding + this. + +14 July 1998 2.05 - Finished up Unicode support. All internal string + handling is done with Unicode strings. Strings are + converted as needed during rendering of the tag. + + 6 July 1998 2.05 - BINARY fields now support an 'ID3C_FromFile' command + which fills the field with data from the specified + file. The file is read and the contents placed in + the field immediately on the field encountering this + command. + + 2 July 1998 2.04 - Improved support for frame validation. + - Repaired a cool bug in the error handling which + prevented an application from finding further + information about the error. This fix resulted in a + new format for the application error handler + function. + + 2.03 - Added support for the ID3C_Add, ID3C_Remove, + ID3C_GetElement, ID3C_GetNumElements commands in the + STRING field type. This allows easy use of the text + lists as used in the 'TP1' frame. + + - Improved error handling once more. + - Added support for the ID3C_Increment command in the + INT field type. + - Added support for the CNT, POP, GEO, TCO, TCR and UFI + frames. + - Added preliminary validation checking for frames to + ensure they meet the ID3v2 standard requirements. + Not fully implemented. + + 2.02 - Adjusted the '::Do()' function slightly - you can now + chain commands together. The last parameter to this + call must now always be 'ID3C_DONE'. + + 1 July 1998 2.01 - Added the 'ID3_IsTagHeader()' function and an + appropriately adjusted ID3C_Parse command. + +30 June 1998 2.00 - First preliminary release of ID3Lib v2.00. Supports + lots of frames (even PIC). Lots of work still + needed. + +25 June 1998 2.00 - Abandoned the v1.xx framework in favour of a more + versatile and expandable one. This required a major + re-write of most of the internals of the library as + well as changes to any applications using the + previous framework. The new framework is part of all + ID3Libs which are 2.xx. + +23 June 1998 1.01 - Released v1.01 which added support for four new + frames. TXX, WXX, COM, ULT + +21 June 1998 1.00 - Initial Release (v1.0) diff --git a/id3lib/INSTALL b/id3lib/INSTALL new file mode 100644 index 0000000..421bc5c --- /dev/null +++ b/id3lib/INSTALL @@ -0,0 +1,179 @@ +Basic Installation +================== + + For more information specific to this package, please read the README +file. This source code distribution is autoconfiguring and you should be +able to compile it and install it without manual interventions such as +editing Makefiles, configuration files, and so on. These are generic +instructions for people who are not familiar with installing autoconfiguring +software. + +The simplest way to compile this package is to enter the source code +main directory and do the following: + + 1. Configure the source code by typing: + % sh ./configure + + If you're planning to install the package into your home directory + or to a location other than `/usr/local' then add the flag + `--prefix=PATH' to `configure'. For example, if your home directory + is `/home/luser' you can configure the package to install itself there + by invoking: + % sh ./configure --prefix=/home/luser + + While running, `configure' prints some messages telling which + features is it checking for. + + 2. Compile the package by typing: + % make + Running `make' takes a while. If this is a very large package, now + is the time to go make some coffee. + + 3. Some packages are bundled with self-tests for source-code + verification. If this package includes such tests, you can + optionally run them after compilation by typing + % make check + + 4. Type `make install' to install the programs and any data files and + documentation. Type `make uninstall' to undo the installation. + During installation, the following files go to the following directories: + Executables -> /prefix/bin + Libraries -> /prefix/lib + Public header files -> /prefix/include + Man pages -> /prefix/man/man? + Info files -> /prefix/info + where `prefix' is either `/usr/local' or the PATH that you specified + in the `--prefix' flag. + + If any of these directories do not presently exist, they will be + created on demand. + + If you are installing in your home directory make sure that + `/home/luser/bin' is in your path. If you're using the bash shell + add this line at the end of your .cshrc file: + PATH="/home/luser/bin:${PATH}" + export PATH + If you are using csh or tcsh, then use this line instead: + setenv PATH /home/luser/bin:${PATH} + By prepending your home directory to the rest of the PATH you can + override systemwide installed software with your own custom installation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. + +Compiler configuration +====================== + + The `configure' shell script is responsible for choosing and configuring +the compiler(s). + +The following options allow you to specify whether you +want to enable or disable various debugging mechanisms: + +`--with-warnings' + Make the compilers very picky about warnings. Try this whenever you + write new code since it may catch a few bugs. This is not active by + default because all too often warnings can be too picky and scare + the end-user. + +`--disable-assert' + Compile without using assertions. This results in faster code, + but should not be used during developerment, or to run `make check' + which depends on assertions. It should only be used for production + runs on code that you believe is bug free. + +All programs are compiled with optimization level 2 by default (-O2). +Occasionally that confuses the debugger when code is inlined. To disable +optimization and enable debugging, set the shell environment variables +CFLAGS, CXXFLAGS, FFLAGS to `-g'. On the bash shell, you can do this +like this: + $ export CFLAGS="-g" + $ export CXXFLAGS="-g" + $ export FFLAGS="-g" +On the tcsh shell, use the `setenv' command instead: + % setenv CFLAGS "-g" + ...etc... +For other shell, please consult your shell's documentation. + +Similarly, you can increase the optimization level by assigning these +variables to "-g -O3". + +The following options allow you to reconsider the `configure' shell script's +choice of Fortran compilers. + +`--with-f2c' + Compile the Fortran code by translating it to C, even if a native + Fortran compiler is available. A copy of the f2c translator should be + bundled in the distribution. It will be compiled and then used to + compile your Fortran code. +`--with-g77' + Compile the Fortran code with g77 even if a proprietary Fortran + compiler is available +`--with-f77=F77' + Compile the Fortran code with the specified Fortran compiler. + +Depending on what languages the package uses, some of these options may +or may not be available. To see what is available, type: + % sh ./configure --help + +About the configure script +========================== + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +Advanced installation options. +============================== + + The `configure' script also understands the following more advanced +options, to handle situations for which `--prefix' alone is not sufficient. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + diff --git a/id3lib/Makefile.am b/id3lib/Makefile.am new file mode 100644 index 0000000..3181288 --- /dev/null +++ b/id3lib/Makefile.am @@ -0,0 +1,87 @@ +# Copyright (C) 1999 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# require automake 1.5 +AUTOMAKE_OPTIONS = 1.5 + +EXTRA_DIST = \ + HISTORY \ + config.h.win32 \ + config.h.win32.in \ + id3lib.spec \ + id3lib.spec.in \ + reconf \ + makefile.win32 \ + makewin32.bat +if ID3_NEEDZLIB +zlib_subdir = zlib +else +zlib_subdir = +endif + +SUBDIRS = . m4 $(zlib_subdir) doc include id3com src examples +DIST_SUBDIRS = . m4 zlib doc include id3com src examples prj libprj + +INCLUDES = @ID3LIB_DEBUG_FLAGS@ + +config.h.win32: $(top_builddir)/config.status $(top_srcdir)/config.h.win32.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +id3lib.spec: $(top_builddir)/config.status $(top_srcdir)/id3lib.spec.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +docsdistdir = $(PACKAGE)-doc-$(VERSION) + +.PHONY: release snapshot docs-release docs + +changelog: + ./cvs2cl.pl --tags --branches --revisions --day-of-week --prune --fsf -U AUTHORS -W 3600 + +docs: + -cd doc && $(MAKE) $(AM_MAKEFLAGS) $@ + +docs-release: docs + -mv doc/$(docsdistdir).* . + -cd examples && $(MAKE) $(AM_MAKEFLAGS) clean + -mkdir $(docsdistdir) + -cp -R examples $(docsdistdir) + -cp doc/*.* $(docsdistdir) + -cp -R doc/@DOX_DIR_HTML@ $(docsdistdir) + -cp NEWS $(docsdistdir)/NEWS.txt + -cp ChangeLog $(docsdistdir)/ChangeLog.txt + -find $(docsdistdir) -name "Makefile*" -exec rm -f {} \; + -find $(docsdistdir) -name "*.mp3" -exec rm -f {} \; + GZIP=$(GZIP_ENV) $(TAR) zcf $(docsdistdir).tar.gz $(docsdistdir) + -rm -rf $(docsdistdir) + +release: config.h.win32 id3lib.spec + -rm -rf .deps */.deps $(distdir).zip + $(MAKE) $(AM_MAKEFLAGS) distcheck + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + -cp -R id3com/ prj/ libprj/ delphi/ $(distdir) + -find $(distdir) -name "*~" -exec rm {} \; + -find $(distdir) -type d -name CVS -exec rm -r {} \; + -find $(distdir) -name .cvsignore -exec rm {} \; + -find $(distdir) \( -name "*.dsp" -or -name "*.dsw" \) -exec unix2dos {} \; + cd $(distdir) && cp config.h.win32 config.h + cd $(distdir) && zip -r ../$(distdir).zip * + cd $(distdir) && ./configure && $(MAKE) $(AM_MAKEFLAGS) docs-release + mv $(distdir)/$(docsdistdir).* . + -rm -rf $(distdir) + +snapshot: config.h.win32 + ss_distdir=$(PACKAGE)-`date +"%Y%m%d"`; \ + $(MAKE) $(AM_MAKEFLAGS) distdir distdir=$$ss_distdir; \ + chmod -R a+r $$ss_distdir; \ + GZIP=$(GZIP_ENV) $(TAR) chozf $${ss_distdir}.tar.gz $$ss_distdir; \ + cd $$ss_distdir && cp config.h.win32 config.h && cd ..; \ + cd $$ss_distdir && zip -r ../$${ss_distdir}.zip * && cd ..; \ + rm -rf $$ss_distdir diff --git a/id3lib/Makefile.in b/id3lib/Makefile.in new file mode 100644 index 0000000..8c121c5 --- /dev/null +++ b/id3lib/Makefile.in @@ -0,0 +1,539 @@ +# Makefile.in generated by automake 1.6.2 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 1999 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOX_DIR_HTML = @DOX_DIR_HTML@ +DOX_DIR_LATEX = @DOX_DIR_LATEX@ +DOX_DIR_MAN = @DOX_DIR_MAN@ +DOX_DIR_RTF = @DOX_DIR_RTF@ +ECHO = @ECHO@ +ID3LIB_BINARY_AGE = @ID3LIB_BINARY_AGE@ +ID3LIB_DEBUG_FLAGS = @ID3LIB_DEBUG_FLAGS@ +ID3LIB_FULLNAME = @ID3LIB_FULLNAME@ +ID3LIB_INTERFACE_AGE = @ID3LIB_INTERFACE_AGE@ +ID3LIB_MAJOR_VERSION = @ID3LIB_MAJOR_VERSION@ +ID3LIB_MINOR_VERSION = @ID3LIB_MINOR_VERSION@ +ID3LIB_NAME = @ID3LIB_NAME@ +ID3LIB_PATCH_VERSION = @ID3LIB_PATCH_VERSION@ +ID3LIB_VERSION = @ID3LIB_VERSION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +cxxflags_set = @cxxflags_set@ +install_sh = @install_sh@ + +# require automake 1.5 +AUTOMAKE_OPTIONS = 1.5 + +EXTRA_DIST = \ + HISTORY \ + config.h.win32 \ + config.h.win32.in \ + id3lib.spec \ + id3lib.spec.in \ + reconf \ + makefile.win32 \ + makewin32.bat + +@ID3_NEEDZLIB_TRUE@zlib_subdir = zlib +@ID3_NEEDZLIB_FALSE@zlib_subdir = + +SUBDIRS = . m4 $(zlib_subdir) doc include id3com src examples +DIST_SUBDIRS = . m4 zlib doc include id3com src examples prj libprj + +INCLUDES = @ID3LIB_DEBUG_FLAGS@ + +docsdistdir = $(PACKAGE)-doc-$(VERSION) +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ + uninstall-info-recursive all-recursive install-data-recursive \ + install-exec-recursive installdirs-recursive install-recursive \ + uninstall-recursive check-recursive installcheck-recursive +DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ + Makefile.in NEWS THANKS TODO acconfig.h aclocal.m4 config.guess \ + config.h.in config.sub configure configure.in depcomp \ + install-sh ltconfig ltmain.sh missing mkinstalldirs +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: + +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) + +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h + +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h + cd $(top_srcdir) && $(AUTOHEADER) + touch $(srcdir)/config.h.in + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = . +distdir = $(PACKAGE)-$(VERSION) + +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } + +GZIP_ENV = --best +distcleancheck_listfiles = find . -type f -print + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + $(am__remove_distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ + && cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + find $$dc_install_base -type f -print ; \ + exit 1; } >&2 ) \ + && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ + && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +distcleancheck: distclean + if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) +distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf autom4te.cache +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive dist dist-all \ + dist-gzip distcheck distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-recursive distclean-tags \ + distcleancheck distdir dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-info install-info-am \ + install-info-recursive install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + tags tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + + +config.h.win32: $(top_builddir)/config.status $(top_srcdir)/config.h.win32.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +id3lib.spec: $(top_builddir)/config.status $(top_srcdir)/id3lib.spec.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +.PHONY: release snapshot docs-release docs + +changelog: + ./cvs2cl.pl --tags --branches --revisions --day-of-week --prune --fsf -U AUTHORS -W 3600 + +docs: + -cd doc && $(MAKE) $(AM_MAKEFLAGS) $@ + +docs-release: docs + -mv doc/$(docsdistdir).* . + -cd examples && $(MAKE) $(AM_MAKEFLAGS) clean + -mkdir $(docsdistdir) + -cp -R examples $(docsdistdir) + -cp doc/*.* $(docsdistdir) + -cp -R doc/@DOX_DIR_HTML@ $(docsdistdir) + -cp NEWS $(docsdistdir)/NEWS.txt + -cp ChangeLog $(docsdistdir)/ChangeLog.txt + -find $(docsdistdir) -name "Makefile*" -exec rm -f {} \; + -find $(docsdistdir) -name "*.mp3" -exec rm -f {} \; + GZIP=$(GZIP_ENV) $(TAR) zcf $(docsdistdir).tar.gz $(docsdistdir) + -rm -rf $(docsdistdir) + +release: config.h.win32 id3lib.spec + -rm -rf .deps */.deps $(distdir).zip + $(MAKE) $(AM_MAKEFLAGS) distcheck + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + -cp -R id3com/ prj/ libprj/ delphi/ $(distdir) + -find $(distdir) -name "*~" -exec rm {} \; + -find $(distdir) -type d -name CVS -exec rm -r {} \; + -find $(distdir) -name .cvsignore -exec rm {} \; + -find $(distdir) \( -name "*.dsp" -or -name "*.dsw" \) -exec unix2dos {} \; + cd $(distdir) && cp config.h.win32 config.h + cd $(distdir) && zip -r ../$(distdir).zip * + cd $(distdir) && ./configure && $(MAKE) $(AM_MAKEFLAGS) docs-release + mv $(distdir)/$(docsdistdir).* . + -rm -rf $(distdir) + +snapshot: config.h.win32 + ss_distdir=$(PACKAGE)-`date +"%Y%m%d"`; \ + $(MAKE) $(AM_MAKEFLAGS) distdir distdir=$$ss_distdir; \ + chmod -R a+r $$ss_distdir; \ + GZIP=$(GZIP_ENV) $(TAR) chozf $${ss_distdir}.tar.gz $$ss_distdir; \ + cd $$ss_distdir && cp config.h.win32 config.h && cd ..; \ + cd $$ss_distdir && zip -r ../$${ss_distdir}.zip * && cd ..; \ + rm -rf $$ss_distdir +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/id3lib/NEWS b/id3lib/NEWS new file mode 100644 index 0000000..70808aa --- /dev/null +++ b/id3lib/NEWS @@ -0,0 +1,325 @@ +$Id: NEWS,v 1.1 2007/12/11 20:21:19 pindakaasmod Exp $ + +this file will not be updated anymore. Please go to http://sourceforge.net/news/?group_id=979 for the latest news + +Old News: + +2001-09-08 Version 3.8.0pre2 +* ID3Lib maintainer has disappeared. Project maintenance taken over by existing + developers +* Many bug fixes -- mostly compilation problems -- more detailed info will be + provided in a later release. + +2000-11-20 Version 3.8.0pre1 + +* First prerelease of 3.8.0 stable. +* Clean separation of interface and implementation to help ensure interface and + binary compatibility of future releases +* Completely revamped implementation of tag reading and writing +* Better debugging output in debug mode +* New documentation (much more still needed) +* Command-line options processing now more cross-platform +* Removed all exception handling +* Minor changes to public interface +* Use of std::string and other STL classes in implementation +* id3com source code removed from source distribution. It has moved to its own + project at http://sourceforge.net/projects/id3com +* Many more changes than can be mentioned here: see ChangeLog file + +2000-09-07 Version 3.7.13 + +* id3com is broken; maintainer has disappeared; anyone care to fix it? +* Complete reimplementation of ID3_Field: cleaner, safer, faster, clearer, more + efficient +* Much more robust MusicMatch parsing +* Improved conversion from ID3v2 to ID3v1 +* Cleaner implementation of file processing +* Examples now use popt for command-line processing +* Improved portability for Macintosh +* Improved build process for platforms without popt or zlib +* New documentation about the MusicMatch tagging format +* Minor updates to ID3_Field interface +* New interface behavior: + // copies entire string (same for unicode_t*) + size_t ID3_Field::Get(const uchar*, size_t) + // for lists, copies a specific item in string (0-based) + size_t ID3_Field::Get(const uchar*, size_t, index_t); + // returns the size in characters for strings, in bytes for all else + size_t ID3_Field::Size() cosnt; + // returns the rendered size of the field + size_t ID3_Field::BinSize() cosnt; + +2000-07-07 Version 3.7.12 + +* Removed debugging output left over from 3.7.11 +* Update() now updates all tag types by default, not just ID3v2 +* Added a second, optional parameter to ID3_GetComment to find a comment with + a specific description +* Converting an ID3v1 comment to an ID3v2 COMM frame now has the description + "ID3v1 Comment" +* An ID3v2 COMM frame will only be converted to an ID3v1 comment if it has a + description of "ID3v1 Comment" + +2000-07-05 Version 3.7.11 + +* Now parses and converts files with MusicMatch tags (beta - needs testing!) +* New tag type enums: ID3TT_LYRICS3, ID3TT_LYRICS3V2, ID3TT_MUSICMATCH, + ID3TT_PREPENDED, ID3TT_APPENDED. Deprecated ID3TT_LYRICS +* Improved file processing routines; cleaned up interface w.r.t. files +* Stripping one type of appended tag strips them all +* New C function: ID3Tag_HasTagType +* New methods for ID3_Tag: GetPrependedBytes(), GetAppendedBytes(), + GetFileSize(), and GetFileName() +* New function for calculating size of non-tag data in file: ID3_GetDataSize() +* Render now parameterized on ID3_TagType +* Bug fixes + +2000-06-23 Version 3.7.10 + +* New and updated example tags +* Corrected unicode parsing and rendering +* Improved parsing/conversion of Lyrics3 v2.00 tags +* Fixed errors with exception handling (thanks to Luca Leonardo Scorcia for the + bug reports) +* Fixed bugs/memory leaks with removing frames and updating tag (thanks to Luca + Leonardo Scorcia for the bug reports) +* Fixed finding of frames with empty text fields (thanks to Luca Leonardo + Scorcia for the bug reports) +* Improved documentation/implementation for uint28 +* Added GetTextID() method for ID3_Frame objects +* Tag doesn't render if there aren't any frames; frame doesn't render if there + aren't any fields +* Reordered ID3_AddSyncLyrics() parameters for better consistency with other + helper functions +* ID3_GetSyncLyricsInfo() parameters updated to be more specific +* Several other minor bug fixes + +2000-05-28 Version 3.7.9 + +* Added new test programs in examples/ for creating example tag files +* Further improvements to compile on (Unix) systems that don't have zlib +* Fixed a bug when parsing compressed frames (thanks to Christian Becker for + the bug report and example file) +* Fixed several bugs when writing to files (thanks to Lothar Egger and Peter + Thorstenson for the bug reports) +* New delphi example code for use with id3com (thanks Michael Little) +* Bugfixes for id3com (thanks John Adcock) +* Changed behavior of Link() and Clear() in ID3_Tag: Clear() doesn't remove + file reference, and Link'ing to an already-linked tag just changes the file + reference +* Cleaned up the class interfaces to use size_t, flags_t, and index_t rather + than luint, so as to be more descriptive +* ID3_Tag::RemoveFrame() now returns the pointer to the frame removed (NULL if + not present), thus releasing the tag from its repsonsibility of managing that + frame's memory +* Cleaned up C interface so that appropriate function parameters are const +* Cleaned up implementation of ID3_Tag::Clear() to fix inconsistencies +* Deprecated ID3_Tag's HasV2Tag(), HasV1Tag(), and HasLyrics() methods in + favor of ID3_Tag::HasTagType() method +* All Render() methods now const +* Added GetUnsync() method to ID3_Tag +* Cleaned up internal class definitions (thereby destroying binary + compatibility) +* ID3v2 tag now won't render (and its reported size is 0) if there aren't any + frames (per the spec) +* Fixed a bug when copying frames that prevented rendering compressed frames in + certain situations +* Fixed a bug with resyncing that caused it to improperly handle the last byte +* Fixed a bug with recognizing certain sync signals +* Lots of other minor changes + +2000-05-11 Version 3.7.8 + +* Major bug fix that caused all string frames to be written out as unicode, yet + with the wrong encoding information given +* Bug fix for stripping id3v2 tags that wouldn't remove enough data +* Bug fix for writing id3v1 tags that might add extraneous data to the tag + +2000-05-10 Version 3.7.7 + +* As part of the major rewrite of underlying codebase started with previous + release, this release features near-complete reimplementation of most of the + ID3v2 parsing code - smaller, faster, and better organized +* Much imporved Lyrics3 v2 tag support, along with much improved synchronized + lyrics (SYLT) support (thanks Severino Delaurenti) +* Updated id3com to reflect changes to compression strategy introduced in last + release (thanks John Adcock) +* Cleaned up the parameters to several functions/methods with regards to + constness +* Several new methods to several classes +* A variety of bugfixes + +2000-05-03 Version 3.7.6 + +* Beginning of major rewrite of underlying codebase to improve efficiency, + expandability; the interface will need minor updates through this endeavor + (sorry!) +* Major bugfix in ID3_Tag::Strip which was deleting too much info from a file + in certain circumstances +* Add descriptions to frames; can access either through a ID3_Frame method for + a frame object, or via the static method on the class (w/ ID3_FrameID param) + (thanks John Adcock for descriptions, Daryl Pawluk for spotting misorder) +* Frame compression is determined frame by frame, so deprecated + ID3_Tag::SetCompression() for ID3_Frame::SetCompression(). + ID3_Tag::SetCompression() is now a no-op (updated C interface accordingly) +* New method ID3_Frame::Contains(ID3_FieldID) for determining if a frame + contains a particular field +* New static method ID3_Tag::IsV2Tag() deprecates ID3_IsTagHeader() +* Other minor bugfixes + +2000-04-28 Version 3.7.5 + +* Fixed nasty bug with rewriting tags to windows files (thanks John Adcock) +* More fixes, improvements to id3com files (thanks John Adcock) +* Added parsing of Lyrics3 v1.00 tags (thanks Severino Delaurenti) +* Updated documentation, but still in flux +* Other minor bugfixes + +2000-04-26 Version 3.7.4 + +* Fixed windows project files so that they all work correctly with new release + (thanks John Adcock, Robert Moon, and Lothar Egger) +* Added a simple VB app to test id3lib using id3com.dll (thanks John Adcock) +* Added better implementation of PRIV (Private) frame (thanks John Adcock) +* Fixed padding logic (thanks John Adcock) +* New "Spec Versioning" system under the hood produces minor interface change + - Defined new enum: ID3_V2Spec (ID3V2_2_0, ID3V2_2_1, ID3V2_3_0, etc.) + - {Get,Set}Spec now used in favor of deprected {Get,Set}Version, GetRevision + - Field definitions updated accordingly; now smaller and more exact + +2000-04-24 Version 3.7.3 + +* C/C++ interface changes: + - Moved V1_LEN* constants into an enumeration so that they can be used as + array size initializers in C. Renamed the constants for consistency + (LEN_V1 -> ID3_V1_LEN, LEN_V1_TITLE -> ID3_V1_LEN_TITLE, etc.) + - Renamed ID3_TagType's enums to be more consistent with rest of library's + enums (V1_TAG -> ID3TT_ID3V1, V2_TAG -> ID3TT_ID3V2, etc.) + - ID3_Err enumeration now defines ID3E_NoError +* C++ interface changes: + - ID3_Frame now has a copy constructor + - ID3_Tag::AddNewFrame deprecated for AttachFrame (no other difference in + behavior) + - ID3_Tag::Link(char *, bool, bool) deprecated for + ID3_Tag::Link(char *, luint). Now accepts ID3_TagTypes to determine which + tags to parse. i.e, mytag.Link("myfile.mp3", ID3TT_ID3V2 | ID3TT_LYRICS); + - ID3_Tag::operator<<, ID3_Tag::AddFrame: relevant parameters now const +* C interface changes: + - ID3Tag_Parse, ID3Tag_Update, ID3Tag_Strip now return an ID3_Err + - Added functions ID3Tag_UpdateByTagType, ID3Frame_New, ID3Frame_NewID, + ID3Frame_Delete +* Implementation changes: + - AddFrame, AddFrames now add copies of the frames passed in. + - AttachFrame adds the actual frame passed to it. + - The tag takes responsibility for managing its frames' memory in all cases. +* Miscellaneous changes: + - Moved most enum and struct declarations to include/id3/globals.h so they + are accessible to C interface + - id3com.dsp file is 'fixed', but the project still doesn't compile w/o + errors + - Most doxygen comments moved from tag.h to respective files + - Fixed a bug in id3lib.spec which caused rpm binaries to be compiled without + exception handling + - examples, include/id3/* header files no longer include config.h + - Other minor bugfixes + +2000-04-21 Version 3.7.2 + +* Implementation of C interface for all platforms (in src/c_wrapper.cpp, which + replaces dll_wrapper.cpp) +* Added examples/demo_simple.c which demonstrates basic use of C interface +* Auto-generated documentation no longer shipped with main tarball distribution +* mp3 example files no longer included (still available via CVS) +* Updated Windows project files so that they'll (hopefully) compile cleanly + again + +2000-04-19 Version 3.7.1 + +* Interface changed: functions in version.{h,cpp} replaced with constants + defined in globals.h +* Added a spec file for creating rpm's +* C interface now defined in include/id3.h, replaces include/src/dll.h; +* Lots of file movement. src/id3/* to src/; src/examples to examples; +* Examples now compiled as installable binaries, rather than 'checks' +* Removed unnecessary files: externals.h, types.h, version.{h,cpp}, dll.h + +2000-04-15 Version 3.7.0 + +* New project management: MusicMatch handed reigns over to Scott Thomas Haug +* New project licensing: LGPL (http://www.gnu.org/copyleft/lesser.html) +* New versioning: 3.7.x is unstable series leading up to 3.8.x stable +* Many bug fixes +* Better windows compatibility, with new windows project files +* Improved documentation, using the Doxygen documentation system + (http://www.stack.nl/~dimitri/doxygen/) +* Extended API, improved implementation +* More supported frames +* Now parses and rerenders unrecognized frame types +* Better version handling in configuration files, similar to the glib library + (http://www.gtk.org) + +1999-12-02 Version 3.6.2 + +* Improved portability: another minor portability fixes, along with the + inclusion of zlib sources and project files for windows compilation. + +1999-12-01 Version 3.6.1 + +* Code movement: moved the header files from src/id3 to include/id3 to allow + for easier windows compilation. +* Improved portability: made changes in several files to improve compilation + on windows. (thanks to elrod for the fixes) +* Random cleanup: some spelling errors fixed, some minor file administration, + etc. + +1999-11-30 Version 3.6.0 + +* Code overhaul: more descriptive variable naming, streamlined implementation + logic, cleaner interface specification, generalization of magic numbers and + strings. +* Better documentation: transcribed the the "Documentation for ID3Lib 3.05" + document (written by Dirk Mahoney, 22 Nov 1998) into the actual source, using + javadoc-like tags so as to create documentation with the application doc++. + Using this program (and ones like it) allows for creating the documentation + in many different formats, including html, texinfo, man, latex, and the like. +* Added functionality: Added additional functions for simplified access to + common tags, such as artist, title, and album. +* More robust error checking: Improved upon the exception handling already in + place to better handle error conditions, such as invalid tags, unrecognized + frames, and the like. Work is still needed to ensure the library can handle + error situations gracefully. +* Improved portability: restructured the code into a GNU-like directory. + hierarchy. By making use of the GNU tools automake and autoconf, a wide + variety of platforms can be easily supported. This allows for a standard + "./configure; make; make install" installation process, as well as an + equally trivial method for uninstallation: "make uninstall". Likewise, + "make check" builds the example applications (see below). +* Enhanced examples: the src/examples/ subdirectory has both new and improved + examples demonstrating how to make use of id3lib. The original "id3convert" + example now can convert both ways between id3v1 and id3v2 tags, as well as + strip both types of tags off of files via command-line switches. + Additionally, an "id3info" app has been added for displaying id3v1/v2 tag + information about a file. +* Bug fixing: Fixes, fixes, and more fixes. A continual process. +* The zlib library files were removed from the project. The need for zlib + was instead made a requirement through the configuration process via autoconf + and automake. +* All of the id3lib library files were renamed by removing the "id3_" prefix. + Instead, the library files were placed in an id3 subdirectory in the src + directory. Likewise, when the library is installed on a system, an "id3" + subdirectory is created in the indicated include directory, and the header + files are placed there. Pragmatically, this means that code that makes use + of id3lib needs to "#include " rather than "#include ". + This was done to create more structure and to avoid clutter in the include + directory. +* The versioning strategy has been updated to be more in line with the + "libtool" way. However, in order to be more compatible with how versions + progressed previously, I've taken the approach that many other libraries have + taken: I've "massaged" the version:revision:age numbers so that the resulting + compiled library shows up as id3lib.so.3.6.0 (or whatever the current release + is). This is /strongly/ advised against in the libtool documentation, so I'm + considering going to a more "traditional" libtool versioning approach (see + the libtool info page for more information). + +There is yet much to do! Please see the TODO file for known bugs and lacking +features... diff --git a/id3lib/README b/id3lib/README new file mode 100644 index 0000000..d813998 --- /dev/null +++ b/id3lib/README @@ -0,0 +1,98 @@ +General Information +=================== + +id3lib is a software library for manipulating ID3v1/v1.1 and ID3v2 tags. +id3lib 3.0.x conforms to all ID3v2 standards up to and including the ID3v2.3.0 +informal standard. + +The id3lib project makes use of the resources available through +SourceForge.net. Using SourceForge, the id3lib project is able to provide +several tools for developers, including a project homepage, a mailing list, a +patch manager, bug tracking, and cvs access, among other things. + +The id3lib project page, which includes links to all of the above, is: + http://sourceforge.net/project/?group_id=979 + +The official id3lib homepage is: + http://id3lib.sourceforge.net + +The id3lib developers' mailing list's address is: + id3lib-devel@lists.sourceforge.net + +You can subscribe, unsubscribe, and view mailing list archives at: + http://lists.sourceforge.net/mailman/listinfo/id3lib-devel + +Information about ID3v2 and related standards can be found at: + http://www.id3.org + +Installation +============ + +See the file 'INSTALL' + +Requirements +============ + +In order to successfully compile and use id3lib, the following programs and +libraries are needed: + +Compiling: +---------- +g++ 2.8/egcs 1.0.3 (or compatible) +GNU make +autoconf 2.13 +automake 1.4 +zlib +doxygen (optional, for creating documentation) + +Using: +---------- +zlib + +How to report bugs +================== + +To report a bug, submit it to the bug tracker, linked to from the id3lib +project page, or send mail to the id3lib-devel mailing list. + +If you send it to the mailing list, please include the following: + +* The version of id3lib + +* Information about your system. For instance: + + - What operating system and version + - For Linux, what version of the C library + + And anything else you think is relevant. + +* How to reproduce the bug. + + Please include either a short test program that exhibits the + behavior or an example tag that isn't correctly parsed/rendered by + the library. As a last resort, you can also provide a pointer to + a larger piece of software or tagged file that can be downloaded. + +* If the bug was a crash, the exact text that was printed out + when the crash occured. + +* Further information such as stack traces may be useful, but + is not necessary. + +Patches +======= + +Patches can be submitted to the patch manager at the id3lib project page, as +mentioned above. Please follow the instructions there. So as not to annoy +uniterested parties with large email messages, it is preferable that you not +send such patches to the mailing list. + +For Further Reading +=================== + +id3lib is free software. Please see the COPYING file for details. +For documentation, please see the files in the doc subdirectory. +See the HISTORY file for information about development up to version 3.05a. +See the NEWS file for information about development since 3.05a. +See the ChangeLog file for an account of changes made to files in the library. +See the AUTHORS and THANKS files to see who has contributed to id3lib. diff --git a/id3lib/THANKS b/id3lib/THANKS new file mode 100644 index 0000000..a079785 --- /dev/null +++ b/id3lib/THANKS @@ -0,0 +1,122 @@ +$Id: THANKS,v 1.1 2007/12/11 20:21:19 pindakaasmod Exp $ + +id3lib THANKS file + +See the AUTHORS file for a list of past and current project maintainers. + +Since version 3.05a, several individuals have helped further the development of +id3lib. They are listed below, in no particular order. Please inform the +current project maintainer if anyone has been missed. + +* Paul-Henri (paul-henri.ferme@noos.fr) and Christopher John Shaker <(cjshaker@shaker-net.com) + for pointing out where the code could have been more robust in tag_find.cpp. +* Bradley J. Marker for pointing out that checking for NULL in Set() can + prevent crashes. +* Todd Wilson for making a better field.cpp. +* Baz (thebaz@pluizig.com) for creating a patch to get vbr info. +* Tobias Hoppe (choppe@cs.uni-magdeburg.de) for providing a better way to + get the framesize. +* Philipp Thomas (pthomas@suse.de) for help with compiling id3lib for gcc 3.2, + and make it better compliant with libstdc++ +* John George (johngeorge_k@asianetindia.com) for donating a number of routines + in misc_support.cpp. +* Frog Prince (thefrogprince@hotmail.com) for helping with compatibility issues + for VB and Delphi +* Simon Ferrett (simon@musicmatch.com) made the id3lib.org domain point to our + project page. He also kindly created an email alias. +* Kamran (kamran@musicmatch.com) fixed several bugs in MusicMatch's internal + version of ID3Lib which were merged into the current public version of + id3lib. +* Alexander Voronin (av@oskarsb.ru) has submitted several patches to fix a + variety of bugs. +* John Adcock (johnadcock@hotmail.com) provided the COM wrapper and lib + projects for id3lib, the VB test app for id3com.dll, as well as several + bugfixes and improvements. +* Myers W. Carpenter (myers@fil.org) has submitted a patch for improving the + interface and functionality of the library. +* Justin Rogers (justin@mlstoday.com) has provided much valuable conversation + as to the design and implementation of id3lib. +* Mark B. Elrod (elrod@liquidmetal.com) has provided several patches for better + win32 functionality. +* Scott Moser (smoser@brickies.net) provided the php translation of the + original ID3Lib manual +* Robert Moon (rob@emusic.com) provided tremendous help getting the C interface + up to speed, as well as providing bugfixes for the Windows projects. +* Lothar Egger (lothar.egger@chello.at) also assisted in fixing the Windows + projects, as well as providing assistance for testing the dlls under Windows +* Severino Delaurenti (id3lib@castlems.com) added functionality for parsing + Lyrics3 v1.0 and v2.0 tags, as well as improving synchronized lyric frame + (SYLT) dramatically. +* Michael Little (mike@netlinear.com) provided the delphi code for use with + id3com. +* Peter Luijer (videoripper@hotmail.com) provided much useful documentation + on the MusicMatch tagging format. +* Steven Frank (stevenf@users.sourceforge.net) provided invaluable help in + tracking down runtime bugs for the Macintosh port. +* The following individuals have assisted by providing bug reports and (often) + suggestions for fixes: + - Ben Noblet (Ben.Noblet@xt3.com.au) + - Benedikt Roth (Benedikt.Roth@gmx.net) + - Christian Becker (chris@craze.de) + - Daryl Pawluk (dpawluk@home.com) + - John Firebaugh (jfirebaugh@mac.com) + - John Southerland (jbsouthe@home.com) + - Luca Leonardo Scorcia (scrlln@tin.it) + - Peter Thorstenson (swede@openlink.com.br) + - Sasa olic (sasad@moderngroove.com) + - Steven Frank (stevenf@users.sourceforge.net) + - Tim Newsome (nuisance@cmu.edu) + +Dirk Mahoney included the following at the end of his documentation on ID3Lib +3.05a. It is included in verbatim here. + + Special Thanks and Credits + + I would like to extend my many thanks to the people who have contributed to + the ID3Lib project. The show of support has been tremendous. I consider + ID3Lib to be a very 'international' product, as contributions have come from + almost literally every corner of the globe. If I have missed you, please + forgive my lapse of memory. + + * Jean-loup Gailly and Mark Adler - for their great zlib compression library + and for making it free. + * Tord Jansson - for much help with teaching me how to make and use DLLs. + * Slava Karpenko for creating the MacOS static link libraries for the PowerPC + and CodeWarrior. + * Bob Kohn - for his advice, input, and generally creating the ID3Lib license + agreement. + * Eng-Keong Lee - for finding a few bugs and for extensively testing ID3Lib + 2.xx. + * James Lin - for his 'ID3v2 Programming Guidelines', and many helpful + suggestions + * Michael Mutschler - for prompting me to write the Unicode support and for + his input on the ID3Lib calling convention. + * Martin Nilsson - for ID3v2, his support of the ID3Lib web page, for many, + many suggestions, debates, pointers, URLs, documents, and brightly coloured + fish. + * Chris Nunn - for the 3D animated ID3v2 logos which appear in the ID3Lib web + page and in the distribution. + * Lachlan Pitts - for general implementation ideas and his brief but helpful + work on the up-coming genre tree. + * Jukka Poikolainen - for prompting to implement error handling via the C++ + exception handling mechanism instead of the old 2.xx-style of using an + error handling function. + * Carson Puchol - for his help with some minor Linux compilation hassles. + * Andreas Sigfridsson - for his initial code for the unsync/resync support + and for his very valuable input in long brainstorming sessions. + * Michael Robertson - for helping support ID3Lib by posting announcements on + MP3.com. + * Ilana Rudnik - for bug finding and suggestions. + * Chuck Zenkus - for his support of ID3v2 and ID3Lib by providing us with a + mirror in the United States and for his bug finding and suggestions. + * And last but by no means least, all the others who support ID3Lib by + subscribing to the mailing list and to the contributors to the discussions + and debates in the ID3v2 discussion group. + + Without the help of all these people, ID3Lib would not be as good as it is, + and I dare say might not even exist if they all weren't around to provide + motivation to continue to write the thing! + + - Dirk Mahoney + 22 November 1998 + Brisbane, Australia diff --git a/id3lib/TODO b/id3lib/TODO new file mode 100644 index 0000000..b20c3c8 --- /dev/null +++ b/id3lib/TODO @@ -0,0 +1,42 @@ +$Id: TODO,v 1.1 2007/12/11 20:21:19 pindakaasmod Exp $ + +id3lib still requires the following work: + +* testing testing testing +* The interface for file access is muddled. It has been separated out from the + next unstable release (3.9.x), but perhaps it can be cleaned up for 3.7.x +* id3lib needs a C interface. Badly. +* Some of the limitations present in 3.05a have been fixed, but many still + exist. See below for the original list and what has been updated. + +Version 3.05a of ID3Lib has some known limitations... + +* Firstly, contrary to good programming ideas and contrary to the 'ID3v2 + Programming Guidelines', ID3Lib will explode in a ball of brilliant blue + flame if asked to parse an invalid ID3v2 tag. This will change. + + Update for 3.7.0: this has been improved, but still requires more testing. + +* Incorrect handling of unknown frames. This means that when ID3Lib encounters + an unknown frame, it is currently ignored. It is neither re-written to the + tag when re-rendered nor are the file or tag alter frame flags observed. + + 3.7.0 adds nominal support for all remaining known frames (as defined in + the spec for id3v2.2.0 and id3v2.3.0 at www.id3.org). Unknown frames are + now parsed and re-rendered, but the file and tag alter frame flags are not + yet observed + +* No support for the read-only frame flag. It is currently ignored---such + frames can be altered at will. + +* No support as yet for the verification of frames before rendering. + +* Does not yet render 3.0 extended headers. Although the functionality for + selecting this is present, the setting is ignored for now. + +* Does not yet parse 3.0 extended headers. They are quite adequately ignored + and the rest of the tag is parsed correctly. + +* ID3Lib currently has no direct support for things like the language and + currency fields. It is up to the application to generate the data for these + fields manually. Soon, ID3Lib will have these things assigned to IDs so that + the applications programmer will not have to remember the ISO tables for the + actual strings. \ No newline at end of file diff --git a/id3lib/acconfig.h b/id3lib/acconfig.h new file mode 100644 index 0000000..cfd284f --- /dev/null +++ b/id3lib/acconfig.h @@ -0,0 +1,105 @@ +/* +** This file has been automatically generated by 'acconfig' from aclocal.m4 +** Copyright (C) 1988 Eleftherios Gkioulekas +** +** This file is free software; as a special exception the author gives +** unlimited permission to copy and/or distribute it, with or without +** modifications, as long as this notice is preserved. +** +** This program is distributed in the hope that it will be useful, but +** WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +** implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* This is the top section */ + +@TOP@ +/* This is the template section */ + +/* These are standard for all packages using Automake */ +#undef PACKAGE +#undef VERSION + +/* And now the rest of the boys */ +#undef CXX_HAS_BUGGY_FOR_LOOPS +#undef CXX_HAS_NO_BOOL +#undef ID3_ENABLE_DEBUG +#undef ID3_DISABLE_ASSERT +#undef ID3_DISABLE_CHECKS +#undef ID3_ICONV_FORMAT_UTF16BE +#undef ID3_ICONV_FORMAT_UTF16 +#undef ID3_ICONV_FORMAT_UTF8 +#undef ID3_ICONV_FORMAT_ASCII + +/* config.h defines these preprocesser symbols to be used by id3lib for + * determining internal versioning information. The intent is that these + * macros will be made available in the library via constants, functions, + * or static methods. + */ +#undef HAVE_ZLIB +#undef HAVE_GETOPT_LONG +#undef _ID3LIB_NAME +#undef _ID3LIB_VERSION +#undef _ID3LIB_FULLNAME +#undef _ID3LIB_MAJOR_VERSION +#undef _ID3LIB_MINOR_VERSION +#undef _ID3LIB_PATCH_VERSION +#undef _ID3LIB_INTERFACE_AGE +#undef _ID3LIB_BINARY_AGE +#undef _ID3_COMPILED_WITH_DEBUGGING +/* */ + +@BOTTOM@ +/* This is the bottom section */ + +// This file defines portability work-arounds for various proprietory +// C++ compilers + +// Workaround for compilers with buggy for-loop scoping +// That's quite a few compilers actually including recent versions of +// Dec Alpha cxx, HP-UX CC and SGI CC. +// The trivial "if" statement provides the correct scoping to the +// for loop + +#ifdef CXX_HAS_BUGGY_FOR_LOOPS +#undef for +#define for if(1) for +#endif + +// +// If the C++ compiler we use doesn't have bool, then +// the following is a near-perfect work-around. +// You must make sure your code does not depend on "int" and "bool" +// being two different types, in overloading for instance. +// + +#ifdef CXX_HAS_NO_BOOL +#define bool int +#define true 1 +#define false 0 +#endif + +#if defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) && defined (__cplusplus) + +#define DEBUG + +#include +#include + +#define ID3D_INIT_DOUT() Debug( libcw_do.on() ) +#define ID3D_INIT_WARNING() Debug( dc::warning.on() ) +#define ID3D_INIT_NOTICE() Debug( dc::notice.on() ) +#define ID3D_NOTICE(x) Dout( dc::notice, x ) +#define ID3D_WARNING(x) Dout( dc::warning, x ) + +#else + +# define ID3D_INIT_DOUT() +# define ID3D_INIT_WARNING() +# define ID3D_INIT_NOTICE() +# define ID3D_NOTICE(x) +# define ID3D_WARNING(x) + +#endif /* defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) */ + + diff --git a/id3lib/aclocal.m4 b/id3lib/aclocal.m4 new file mode 100644 index 0000000..e49b53f --- /dev/null +++ b/id3lib/aclocal.m4 @@ -0,0 +1,4598 @@ +# aclocal.m4 generated automatically by aclocal 1.6.2 -*- Autoconf -*- + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_PREREQ([2.52]) + +# serial 6 + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. We must strip everything past the first ":", +# and everything past the last "/". + +# _AM_DIRNAME(PATH) +# ----------------- +# Like AS_DIRNAME, only do it during macro expansion +AC_DEFUN([_AM_DIRNAME], + [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, + m4_if(regexp([$1], [^//\([^/]\|$\)]), -1, + m4_if(regexp([$1], [^/.*]), -1, + [.], + patsubst([$1], [^\(/\).*], [\1])), + patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), + patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl +])# _AM_DIRNAME + + +# The stamp files are numbered to have different names. +# We could number them on a directory basis, but that's additional +# complications, let's have a unique counter. +m4_define([_AM_STAMP_Count], [0]) + + +# _AM_STAMP(HEADER) +# ----------------- +# The name of the stamp file for HEADER. +AC_DEFUN([_AM_STAMP], +[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl +AS_ESCAPE(_AM_DIRNAME(patsubst([$1], + [:.*])))/stamp-h[]_AM_STAMP_Count]) + + +# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS) +# ------------------------------------------------------------ +# We used to try to get a real timestamp in stamp-h. But the fear is that +# that will cause unnecessary cvs conflicts. +AC_DEFUN([_AM_CONFIG_HEADER], +[# Add the stamp file to the list of files AC keeps track of, +# along with our hook. +AC_CONFIG_HEADERS([$1], + [# update the timestamp +echo 'timestamp for $1' >"_AM_STAMP([$1])" +$2], + [$3]) +])# _AM_CONFIG_HEADER + + +# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS) +# -------------------------------------------------------------- +AC_DEFUN([AM_CONFIG_HEADER], +[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])]) +])# AM_CONFIG_HEADER + +# Do all the work for Automake. -*- Autoconf -*- + +# This macro actually does too much some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +AC_PREREQ([2.52]) + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl + AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl + +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_][CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_][CC], + defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_][CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_][CXX], + defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.6.2])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# +# Check to make sure that the build environment is sane. +# + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# -*- Autoconf -*- + + +# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_AUX_DIR_EXPAND + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +# Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50]) + +AC_DEFUN([AM_AUX_DIR_EXPAND], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# serial 4 -*- Autoconf -*- + +# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null +AC_SUBST([DEPDIR]) +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +#serial 2 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST(am__include) +AC_SUBST(am__quote) +AC_MSG_RESULT($_am_result) +rm -f confinc confmf +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 5 + +AC_PREREQ(2.52) + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([conditional \"$1\" was never defined. +Usually this means the macro was only invoked conditionally.]) +fi])]) + +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- + +# serial 46 AC_PROG_LIBTOOL + +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +_LT_AC_PROG_ECHO_BACKSLASH +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac + +_LT_AC_LTCONFIG_HACK + +]) + +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) + +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h) +])# _LT_AC_CHECK_DLFCN + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix*) + symcode='[[BCDEGRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if AC_TRY_EVAL(ac_link) && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AC_FD_CC + fi + else + echo "cannot find nm_test_var in $nlist" >&AC_FD_CC + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "$progname: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi +])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[if test "$cross_compiling" = yes; then : + [$4] +else + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + +AC_DEFUN([_LT_AC_LTCONFIG_HACK], +[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" + +AC_MSG_CHECKING([for objdir]) +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +AC_MSG_RESULT($objdir) + + +AC_ARG_WITH(pic, +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +pic_mode="$withval", pic_mode=default) +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +AC_MSG_CHECKING([for $compiler option to produce PIC]) +AC_CACHE_VAL(lt_cv_prog_cc_pic, +[ lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi +]) +if test -z "$lt_cv_prog_cc_pic"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$lt_cv_prog_cc_pic]) + + # Check to make sure the pic_flag actually works. + AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) + AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + AC_TRY_COMPILE([], [], [dnl + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + ], [dnl + lt_cv_prog_cc_pic_works=no + ]) + CFLAGS="$save_CFLAGS" + ]) + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no + fi +fi + +AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) + LDFLAGS="$save_LDFLAGS" +]) + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler +AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +AC_CACHE_VAL([lt_cv_compiler_c_o], [ +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&AC_FD_CC + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null +]) +compiler_c_o=$lt_cv_compiler_c_o +AC_MSG_RESULT([$compiler_c_o]) + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) + AC_CACHE_VAL([lt_cv_compiler_o_lo], [ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + ]) + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo + AC_MSG_RESULT([$compiler_o_lo]) +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi + +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$compiler_rtti_exceptions]) + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +AC_MSG_RESULT([$ld_shlibs]) +test "$ld_shlibs" = no && can_build_shared=no + +# Check hardcoding attributes. +AC_MSG_CHECKING([how to hardcode library paths into programs]) +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +AC_MSG_RESULT([$hardcode_action]) + +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +# PORTME Fill in your ld.so characteristics +AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +AC_LIBTOOL_DLOPEN_SELF + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], + [$rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile); then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi]) + AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + +])# _LT_AC_LTCONFIG_HACK + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | [[A-Za-z]]:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +# AC_PROG_LD_GNU - +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[[012]]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[[78]]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# Copyright 1996, 1998, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 1 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +dnl Autoconf support for C++ + +AC_DEFUN([ID3_CXX_WARNINGS],[ + AC_ARG_ENABLE(cxx-warnings, + [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C++ compiler) + warnCXXFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + if test "x$enable_cxx_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCXXFLAGS="-Wall -Wno-unused -Wno-inline -Woverloaded-virtual -Wmissing-declarations" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_cxx_warnings" = "xyes"; then + warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Woverloaded-virtual" + fi + fi + fi + AC_MSG_RESULT($warnCXXFLAGS) + + AC_ARG_ENABLE(iso-cxx, + [ --enable-iso-cxx Try to warn if code is not ISO C++ ],, + enable_iso_cxx=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler) + complCXXFLAGS= + if test "x$enable_iso_cxx" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -ansi" ;; + esac + + case " $CXXFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCXXFLAGS) + if test "x$cxxflags_set" != "xyes"; then + CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS" + cxxflags_set=yes + AC_SUBST(cxxflags_set) + fi +]) + + +# ----------------------------------------------------------------------- +# This macro tests the C++ compiler for various portability problem. +# 1. Defines CXX_HAS_NO_BOOL if the compiler does not support the bool +# data type +# 2. Defines CXX_HAS_BUGGY_FOR_LOOPS if the compiler has buggy +# scoping for the for-loop +# Seperately we provide some config.h.bot code to be added to acconfig.h +# that implements work-arounds for these problems. +# ----------------------------------------------------------------------- + +dnl ACCONFIG TEMPLATE +dnl #undef CXX_HAS_BUGGY_FOR_LOOPS +dnl #undef CXX_HAS_NO_BOOL +dnl END ACCONFIG + +AC_DEFUN(ID3_CXX_PORTABILITY,[ + + AC_PROVIDE([$0]) + + dnl + dnl Check for common C++ portability problems + dnl + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + dnl Check whether we have bool + AC_MSG_CHECKING(whether C++ has bool) + AC_TRY_RUN([main() { bool b1=true; bool b2=false; }], + [ AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no) + AC_DEFINE(CXX_HAS_NO_BOOL) ], + [ AC_MSG_WARN(Don't cross-compile)] + ) + + dnl Test whether C++ has buggy for-loops + AC_MSG_CHECKING(whether C++ has correct scoping in for-loops) + AC_TRY_COMPILE([#include ], [ + for (int i=0;i<10;i++) { } + for (int i=0;i<10;i++) { } +], [ AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no) + AC_DEFINE(CXX_HAS_BUGGY_FOR_LOOPS) ]) + + dnl Done with the portability checks + AC_LANG_RESTORE +]) + +dnl ACCONFIG BOTTOM +dnl +dnl // This file defines portability work-arounds for various proprietory +dnl // C++ compilers +dnl +dnl // Workaround for compilers with buggy for-loop scoping +dnl // That's quite a few compilers actually including recent versions of +dnl // Dec Alpha cxx, HP-UX CC and SGI CC. +dnl // The trivial "if" statement provides the correct scoping to the +dnl // for loop +dnl +dnl #ifdef CXX_HAS_BUGGY_FOR_LOOPS +dnl #undef for +dnl #define for if(1) for +dnl #endif +dnl +dnl // +dnl // If the C++ compiler we use doesn't have bool, then +dnl // the following is a near-perfect work-around. +dnl // You must make sure your code does not depend on "int" and "bool" +dnl // being two different types, in overloading for instance. +dnl // +dnl +dnl #ifdef CXX_HAS_NO_BOOL +dnl #define bool int +dnl #define true 1 +dnl #define false 0 +dnl #endif +dnl +dnl END ACCONFIG + + +AC_DEFUN([ID3_DEBUG],[ + AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default) + + if test "x$enable_debug" = "xyes"; then + test "$cflags_set" = set || CFLAGS="$CFLAGS -g" + AC_DEFINE(ID3_ENABLE_DEBUG) + else + if test "x$enable_debug" = "xno"; then + AC_DEFINE(ID3_DISABLE_ASSERT) + AC_DEFINE(ID3_DISABLE_CHECKS) + fi + fi +]) + +dnl ACCONFIG TEMPLATE +dnl #undef ID3_ENABLE_DEBUG +dnl #undef ID3_DISABLE_ASSERT +dnl #undef ID3_DISABLE_CHECKS +dnl END ACCONFIG +dnl ACCONFIG BOTTOM +dnl #if defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) && defined (__cplusplus) +dnl +dnl #define DEBUG +dnl +dnl #include +dnl #include +dnl +dnl #define ID3D_INIT_DOUT() Debug( libcw_do.on() ) +dnl #define ID3D_INIT_WARNING() Debug( dc::warning.on() ) +dnl #define ID3D_INIT_NOTICE() Debug( dc::notice.on() ) +dnl #define ID3D_NOTICE(x) Dout( dc::notice, x ) +dnl #define ID3D_WARNING(x) Dout( dc::warning, x ) +dnl +dnl #else +dnl +dnl # define ID3D_INIT_DOUT() +dnl # define ID3D_INIT_WARNING() +dnl # define ID3D_INIT_NOTICE() +dnl # define ID3D_NOTICE(x) +dnl # define ID3D_WARNING(x) +dnl +dnl #endif /* defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) */ +dnl +dnl END ACCONFIG + + +dnl ACCONFIG TEMPLATE +dnl #undef ID3_ICONV_FORMAT_UTF16BE +dnl #undef ID3_ICONV_FORMAT_UTF16 +dnl #undef ID3_ICONV_FORMAT_UTF8 +dnl #undef ID3_ICONV_FORMAT_ASCII +dnl END ACCONFIG + +AC_DEFUN(ID3_CHECK_ICONV_FORMAT,[ + if eval "test \"x\$$1\" = \"xno\""; then + AC_MSG_CHECKING(whether iconv supports $2) + AC_TRY_RUN([#include + int main() { return iconv_open("$2", "$2") == -1; } ], + [ eval $1=yes + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED($1, "$2") ], + [ AC_MSG_RESULT(no) ], + [ AC_MSG_WARN(Don't cross-compile) ]) + fi +]) + +AC_DEFUN([ID3_UNICODE],[ + if test "x$ac_cv_header_iconv_h" = "xyes"; then + ID3_ICONV_FORMAT_UTF8=no + ID3_ICONV_FORMAT_UTF16=no + ID3_ICONV_FORMAT_UTF16BE=no + ID3_ICONV_FORMAT_ASCII=no + + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF8, UTF-8) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF8, UTF8) +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF8) + + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE, UTF-16BE) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE, UTF16BE) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE, UCS-2BE) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE, UCS2BE) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE, UNICODEBIG) +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE) + + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16, UTF-16) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16, UTF16) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16, UNICODE) +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16) + + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII, ISO-8859-1) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII, ASCII) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII, US-ASCII) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII, US) +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII) + fi +]) + + diff --git a/id3lib/config.guess b/id3lib/config.guess new file mode 100644 index 0000000..cc726cd --- /dev/null +++ b/id3lib/config.guess @@ -0,0 +1,1388 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-02-22' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i586-pc-interix3 + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + case `uname -p` in + *86) UNAME_PROCESSOR=i686 ;; + powerpc) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/id3lib/config.h b/id3lib/config.h new file mode 100644 index 0000000..406d254 --- /dev/null +++ b/id3lib/config.h @@ -0,0 +1,181 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* +** This file has been automatically generated by 'acconfig' from aclocal.m4 +** Copyright (C) 1988 Eleftherios Gkioulekas +** +** This file is free software; as a special exception the author gives +** unlimited permission to copy and/or distribute it, with or without +** modifications, as long as this notice is preserved. +** +** This program is distributed in the hope that it will be useful, but +** WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +** implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* This is the top section */ + +/* Define if you need to in order for stat and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* And now the rest of the boys */ +#define CXX_HAS_BUGGY_FOR_LOOPS 1 +/* #undef CXX_HAS_NO_BOOL */ +/* #undef ID3_ENABLE_DEBUG */ +/* #undef ID3_DISABLE_ASSERT */ +/* #undef ID3_DISABLE_CHECKS */ +/* #undef ID3_ICONV_FORMAT_UTF16BE */ +/* #undef ID3_ICONV_FORMAT_UTF16 */ +/* #undef ID3_ICONV_FORMAT_UTF8 */ +/* #undef ID3_ICONV_FORMAT_ASCII */ +/* #undef ID3LIB_ICONV_OLDSTYLE */ +/* #undef ID3LIB_ICONV_CAST_OK */ + +/* config.h defines these preprocesser symbols to be used by id3lib for + * determining internal versioning information. The intent is that these + * macros will be made available in the library via constants, functions, + * or static methods. + */ +/* #undef HAVE_ZLIB */ +/* #undef HAVE_GETOPT_LONG */ +#define _ID3LIB_NAME "id3lib" +#define _ID3LIB_VERSION "3.8.3" +#define _ID3LIB_VERSION0 "3.8.3\0" +#define _ID3LIB_FULLNAME "id3lib-3.8.3" +#define _ID3LIB_MAJOR_VERSION 3 +#define _ID3LIB_MINOR_VERSION 8 +#define _ID3LIB_PATCH_VERSION 3 +#define _ID3LIB_INTERFACE_AGE 0 +#define _ID3LIB_BINARY_AGE 0 +/* #undef ID3_COMPILED_WITH_DEBUGGING */ +/* */ + +/* Define if you have the getopt_long function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define if you have the mkstemp function. */ +/* #undef HAVE_MKSTEMP */ + +/* Define if you have the ftruncate function. */ +/* #undef HAVE_TRUNCATE */ + +/* Define if you have the header file. */ +#define HAVE_CCTYPE 1 + +/* Define if you have the header file. */ +#define HAVE_CLIMITS 1 + +/* Define if you have the header file. */ +#define HAVE_CSTDIO 1 + +/* Define if you have the header file. */ +#define HAVE_CSTDLIB 1 + +/* Define if you have the header file. */ +#define HAVE_CSTRING 1 + +/* Define if you have the header file. */ +#define HAVE_FSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_FSTREAM_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_ICONV_H */ + +/* Define if you have the header file. */ +#define HAVE_IOMANIP 1 + +/* Define if you have the header file. */ +#define HAVE_IOMANIP_H 1 + +/* Define if you have the header file. */ +#define HAVE_IOSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_IOSTREAM_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_LIBCW_SYS_H */ + +/* Define if you have the header file. */ +#define HAVE_BITSET 1 + +/* Define if you have the header file. */ +#define HAVE_STRING 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_PARAM_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_ZLIB_H */ + +/* Name of package */ +#define PACKAGE "id3lib" + +/* Version number of package */ +#define VERSION _ID3LIB_VERSION + +/* This is the bottom section */ + +// This file defines portability work-arounds for various proprietory +// C++ compilers + +// Workaround for compilers with buggy for-loop scoping +// That's quite a few compilers actually including recent versions of +// Dec Alpha cxx, HP-UX CC and SGI CC. +// The trivial "if" statement provides the correct scoping to the +// for loop + +#ifdef CXX_HAS_BUGGY_FOR_LOOPS +/* #undef for */ +#define for if(1) for +#endif + +// +// If the C++ compiler we use doesn't have bool, then +// the following is a near-perfect work-around. +// You must make sure your code does not depend on "int" and "bool" +// being two different types, in overloading for instance. +// + +#ifdef CXX_HAS_NO_BOOL +#define bool int +#define true 1 +#define false 0 +#endif + +#if defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) && defined (__cplusplus) + +#define DEBUG + +#include +#include + +#define ID3D_INIT_DOUT() Debug( libcw_do.on() ) +#define ID3D_INIT_WARNING() Debug( dc::warning.on() ) +#define ID3D_INIT_NOTICE() Debug( dc::notice.on() ) +#define ID3D_NOTICE(x) Dout( dc::notice, x ) +#define ID3D_WARNING(x) Dout( dc::warning, x ) + +#else + +# define ID3D_INIT_DOUT() +# define ID3D_INIT_WARNING() +# define ID3D_INIT_NOTICE() +# define ID3D_NOTICE(x) +# define ID3D_WARNING(x) + +#endif /* defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) */ + diff --git a/id3lib/config.h.in b/id3lib/config.h.in new file mode 100644 index 0000000..82ca228 --- /dev/null +++ b/id3lib/config.h.in @@ -0,0 +1,217 @@ +/* config.h.in. Generated from configure.in by autoheader. */ +/* +** This file has been automatically generated by 'acconfig' from aclocal.m4 +** Copyright (C) 1988 Eleftherios Gkioulekas +** +** This file is free software; as a special exception the author gives +** unlimited permission to copy and/or distribute it, with or without +** modifications, as long as this notice is preserved. +** +** This program is distributed in the hope that it will be useful, but +** WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +** implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* This is the top section */ + +/* This is the template section */ + +/* These are standard for all packages using Automake */ +#undef PACKAGE +#undef VERSION + +/* And now the rest of the boys */ +#undef CXX_HAS_BUGGY_FOR_LOOPS +/* the following is added due to a bug in autoconf, checking for booleans in gcc while g++ is used for compiling */ +#ifndef __cplusplus +#undef CXX_HAS_NO_BOOL +#endif +#undef ID3_ENABLE_DEBUG +#undef ID3_DISABLE_ASSERT +#undef ID3_DISABLE_CHECKS +#undef ID3_ICONV_FORMAT_UTF16BE +#undef ID3_ICONV_FORMAT_UTF16 +#undef ID3_ICONV_FORMAT_UTF8 +#undef ID3_ICONV_FORMAT_ASCII +#undef ID3LIB_ICONV_OLDSTYLE +#undef ID3LIB_ICONV_CAST_OK + +/* config.h defines these preprocesser symbols to be used by id3lib for + * determining internal versioning information. The intent is that these + * macros will be made available in the library via constants, functions, + * or static methods. + */ +#undef HAVE_ZLIB +#undef HAVE_GETOPT_LONG +#undef _ID3LIB_NAME +#undef _ID3LIB_VERSION +#undef _ID3LIB_FULLNAME +#undef _ID3LIB_MAJOR_VERSION +#undef _ID3LIB_MINOR_VERSION +#undef _ID3LIB_PATCH_VERSION +#undef _ID3LIB_INTERFACE_AGE +#undef _ID3LIB_BINARY_AGE +#undef _ID3_COMPILED_WITH_DEBUGGING +/* */ + + +/* Define if you have the header file. */ +#undef HAVE_CCTYPE + +/* Define if you have the header file. */ +#undef HAVE_CLIMITS + +/* Define if you have the header file. */ +#undef HAVE_CSTDIO + +/* Define if you have the header file. */ +#undef HAVE_CSTDLIB + +/* Define if you have the header file. */ +#undef HAVE_CSTRING + +/* Define if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define if you have the header file. */ +#undef HAVE_FSTREAM + +/* Define if you have the header file. */ +#undef HAVE_FSTREAM_H + +/* Define if you have the `getopt_long' function. */ +#undef HAVE_GETOPT_LONG + +/* Define if you have the header file. */ +#undef HAVE_ICONV_H + +/* Define if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have the header file. */ +#undef HAVE_IOMANIP + +/* Define if you have the header file. */ +#undef HAVE_IOMANIP_H + +/* Define if you have the header file. */ +#undef HAVE_IOSTREAM + +/* Define if you have the header file. */ +#undef HAVE_IOSTREAM_H + +/* Define if you have the header file. */ +#undef HAVE_LIBCW_SYS_H + +/* Define if you have the header file. */ +#undef HAVE_BITSET + +/* Define if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have the `mkstemp' function. */ +#undef HAVE_MKSTEMP + +/* Define if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the header file. */ +#undef HAVE_STRING + +/* Define if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define if you have the `truncate' function. */ +#undef HAVE_TRUNCATE + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Define if you have the header file. */ +#undef HAVE_ZLIB_H + +/* Name of package */ +#undef PACKAGE + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define if you need to in order for stat and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to `unsigned' if does not define. */ +#undef size_t +/* This is the bottom section */ + +// This file defines portability work-arounds for various proprietory +// C++ compilers + +// Workaround for compilers with buggy for-loop scoping +// That's quite a few compilers actually including recent versions of +// Dec Alpha cxx, HP-UX CC and SGI CC. +// The trivial "if" statement provides the correct scoping to the +// for loop + +#ifdef CXX_HAS_BUGGY_FOR_LOOPS +#undef for +#define for if(1) for +#endif + +// +// If the C++ compiler we use doesn't have bool, then +// the following is a near-perfect work-around. +// You must make sure your code does not depend on "int" and "bool" +// being two different types, in overloading for instance. +// + +#ifdef CXX_HAS_NO_BOOL +#define bool int +#define true 1 +#define false 0 +#endif + +#if defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) && defined (__cplusplus) + +#define DEBUG + +#include +#include + +#define ID3D_INIT_DOUT() Debug( libcw_do.on() ) +#define ID3D_INIT_WARNING() Debug( dc::warning.on() ) +#define ID3D_INIT_NOTICE() Debug( dc::notice.on() ) +#define ID3D_NOTICE(x) Dout( dc::notice, x ) +#define ID3D_WARNING(x) Dout( dc::warning, x ) + +#else + +# define ID3D_INIT_DOUT() +# define ID3D_INIT_WARNING() +# define ID3D_INIT_NOTICE() +# define ID3D_NOTICE(x) +# define ID3D_WARNING(x) + +#endif /* defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) */ + + diff --git a/id3lib/config.h.win32 b/id3lib/config.h.win32 new file mode 100644 index 0000000..406d254 --- /dev/null +++ b/id3lib/config.h.win32 @@ -0,0 +1,181 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* +** This file has been automatically generated by 'acconfig' from aclocal.m4 +** Copyright (C) 1988 Eleftherios Gkioulekas +** +** This file is free software; as a special exception the author gives +** unlimited permission to copy and/or distribute it, with or without +** modifications, as long as this notice is preserved. +** +** This program is distributed in the hope that it will be useful, but +** WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +** implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* This is the top section */ + +/* Define if you need to in order for stat and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* And now the rest of the boys */ +#define CXX_HAS_BUGGY_FOR_LOOPS 1 +/* #undef CXX_HAS_NO_BOOL */ +/* #undef ID3_ENABLE_DEBUG */ +/* #undef ID3_DISABLE_ASSERT */ +/* #undef ID3_DISABLE_CHECKS */ +/* #undef ID3_ICONV_FORMAT_UTF16BE */ +/* #undef ID3_ICONV_FORMAT_UTF16 */ +/* #undef ID3_ICONV_FORMAT_UTF8 */ +/* #undef ID3_ICONV_FORMAT_ASCII */ +/* #undef ID3LIB_ICONV_OLDSTYLE */ +/* #undef ID3LIB_ICONV_CAST_OK */ + +/* config.h defines these preprocesser symbols to be used by id3lib for + * determining internal versioning information. The intent is that these + * macros will be made available in the library via constants, functions, + * or static methods. + */ +/* #undef HAVE_ZLIB */ +/* #undef HAVE_GETOPT_LONG */ +#define _ID3LIB_NAME "id3lib" +#define _ID3LIB_VERSION "3.8.3" +#define _ID3LIB_VERSION0 "3.8.3\0" +#define _ID3LIB_FULLNAME "id3lib-3.8.3" +#define _ID3LIB_MAJOR_VERSION 3 +#define _ID3LIB_MINOR_VERSION 8 +#define _ID3LIB_PATCH_VERSION 3 +#define _ID3LIB_INTERFACE_AGE 0 +#define _ID3LIB_BINARY_AGE 0 +/* #undef ID3_COMPILED_WITH_DEBUGGING */ +/* */ + +/* Define if you have the getopt_long function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define if you have the mkstemp function. */ +/* #undef HAVE_MKSTEMP */ + +/* Define if you have the ftruncate function. */ +/* #undef HAVE_TRUNCATE */ + +/* Define if you have the header file. */ +#define HAVE_CCTYPE 1 + +/* Define if you have the header file. */ +#define HAVE_CLIMITS 1 + +/* Define if you have the header file. */ +#define HAVE_CSTDIO 1 + +/* Define if you have the header file. */ +#define HAVE_CSTDLIB 1 + +/* Define if you have the header file. */ +#define HAVE_CSTRING 1 + +/* Define if you have the header file. */ +#define HAVE_FSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_FSTREAM_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_ICONV_H */ + +/* Define if you have the header file. */ +#define HAVE_IOMANIP 1 + +/* Define if you have the header file. */ +#define HAVE_IOMANIP_H 1 + +/* Define if you have the header file. */ +#define HAVE_IOSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_IOSTREAM_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_LIBCW_SYS_H */ + +/* Define if you have the header file. */ +#define HAVE_BITSET 1 + +/* Define if you have the header file. */ +#define HAVE_STRING 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_PARAM_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_ZLIB_H */ + +/* Name of package */ +#define PACKAGE "id3lib" + +/* Version number of package */ +#define VERSION _ID3LIB_VERSION + +/* This is the bottom section */ + +// This file defines portability work-arounds for various proprietory +// C++ compilers + +// Workaround for compilers with buggy for-loop scoping +// That's quite a few compilers actually including recent versions of +// Dec Alpha cxx, HP-UX CC and SGI CC. +// The trivial "if" statement provides the correct scoping to the +// for loop + +#ifdef CXX_HAS_BUGGY_FOR_LOOPS +/* #undef for */ +#define for if(1) for +#endif + +// +// If the C++ compiler we use doesn't have bool, then +// the following is a near-perfect work-around. +// You must make sure your code does not depend on "int" and "bool" +// being two different types, in overloading for instance. +// + +#ifdef CXX_HAS_NO_BOOL +#define bool int +#define true 1 +#define false 0 +#endif + +#if defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) && defined (__cplusplus) + +#define DEBUG + +#include +#include + +#define ID3D_INIT_DOUT() Debug( libcw_do.on() ) +#define ID3D_INIT_WARNING() Debug( dc::warning.on() ) +#define ID3D_INIT_NOTICE() Debug( dc::notice.on() ) +#define ID3D_NOTICE(x) Dout( dc::notice, x ) +#define ID3D_WARNING(x) Dout( dc::warning, x ) + +#else + +# define ID3D_INIT_DOUT() +# define ID3D_INIT_WARNING() +# define ID3D_INIT_NOTICE() +# define ID3D_NOTICE(x) +# define ID3D_WARNING(x) + +#endif /* defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) */ + diff --git a/id3lib/config.h.win32.in b/id3lib/config.h.win32.in new file mode 100644 index 0000000..1fbc30e --- /dev/null +++ b/id3lib/config.h.win32.in @@ -0,0 +1,181 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* +** This file has been automatically generated by 'acconfig' from aclocal.m4 +** Copyright (C) 1988 Eleftherios Gkioulekas +** +** This file is free software; as a special exception the author gives +** unlimited permission to copy and/or distribute it, with or without +** modifications, as long as this notice is preserved. +** +** This program is distributed in the hope that it will be useful, but +** WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +** implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* This is the top section */ + +/* Define if you need to in order for stat and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* And now the rest of the boys */ +#define CXX_HAS_BUGGY_FOR_LOOPS 1 +/* #undef CXX_HAS_NO_BOOL */ +/* #undef ID3_ENABLE_DEBUG */ +/* #undef ID3_DISABLE_ASSERT */ +/* #undef ID3_DISABLE_CHECKS */ +/* #undef ID3_ICONV_FORMAT_UTF16BE */ +/* #undef ID3_ICONV_FORMAT_UTF16 */ +/* #undef ID3_ICONV_FORMAT_UTF8 */ +/* #undef ID3_ICONV_FORMAT_ASCII */ +/* #undef ID3LIB_ICONV_OLDSTYLE */ +/* #undef ID3LIB_ICONV_CAST_OK */ + +/* config.h defines these preprocesser symbols to be used by id3lib for + * determining internal versioning information. The intent is that these + * macros will be made available in the library via constants, functions, + * or static methods. + */ +/* #undef HAVE_ZLIB */ +/* #undef HAVE_GETOPT_LONG */ +#define _ID3LIB_NAME "@ID3LIB_NAME@" +#define _ID3LIB_VERSION "@ID3LIB_VERSION@" +#define _ID3LIB_VERSION0 "@ID3LIB_VERSION@\0" +#define _ID3LIB_FULLNAME "@ID3LIB_FULLNAME@" +#define _ID3LIB_MAJOR_VERSION @ID3LIB_MAJOR_VERSION@ +#define _ID3LIB_MINOR_VERSION @ID3LIB_MINOR_VERSION@ +#define _ID3LIB_PATCH_VERSION @ID3LIB_PATCH_VERSION@ +#define _ID3LIB_INTERFACE_AGE @ID3LIB_INTERFACE_AGE@ +#define _ID3LIB_BINARY_AGE @ID3LIB_BINARY_AGE@ +/* #undef ID3_COMPILED_WITH_DEBUGGING */ +/* */ + +/* Define if you have the getopt_long function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define if you have the mkstemp function. */ +/* #undef HAVE_MKSTEMP */ + +/* Define if you have the ftruncate function. */ +/* #undef HAVE_TRUNCATE */ + +/* Define if you have the header file. */ +#define HAVE_CCTYPE 1 + +/* Define if you have the header file. */ +#define HAVE_CLIMITS 1 + +/* Define if you have the header file. */ +#define HAVE_CSTDIO 1 + +/* Define if you have the header file. */ +#define HAVE_CSTDLIB 1 + +/* Define if you have the header file. */ +#define HAVE_CSTRING 1 + +/* Define if you have the header file. */ +#define HAVE_FSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_FSTREAM_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_ICONV_H */ + +/* Define if you have the header file. */ +#define HAVE_IOMANIP 1 + +/* Define if you have the header file. */ +#define HAVE_IOMANIP_H 1 + +/* Define if you have the header file. */ +#define HAVE_IOSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_IOSTREAM_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_LIBCW_SYS_H */ + +/* Define if you have the header file. */ +#define HAVE_BITSET 1 + +/* Define if you have the header file. */ +#define HAVE_STRING 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_PARAM_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_ZLIB_H */ + +/* Name of package */ +#define PACKAGE "@PACKAGE@" + +/* Version number of package */ +#define VERSION _ID3LIB_VERSION + +/* This is the bottom section */ + +// This file defines portability work-arounds for various proprietory +// C++ compilers + +// Workaround for compilers with buggy for-loop scoping +// That's quite a few compilers actually including recent versions of +// Dec Alpha cxx, HP-UX CC and SGI CC. +// The trivial "if" statement provides the correct scoping to the +// for loop + +#ifdef CXX_HAS_BUGGY_FOR_LOOPS +/* #undef for */ +#define for if(1) for +#endif + +// +// If the C++ compiler we use doesn't have bool, then +// the following is a near-perfect work-around. +// You must make sure your code does not depend on "int" and "bool" +// being two different types, in overloading for instance. +// + +#ifdef CXX_HAS_NO_BOOL +#define bool int +#define true 1 +#define false 0 +#endif + +#if defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) && defined (__cplusplus) + +#define DEBUG + +#include +#include + +#define ID3D_INIT_DOUT() Debug( libcw_do.on() ) +#define ID3D_INIT_WARNING() Debug( dc::warning.on() ) +#define ID3D_INIT_NOTICE() Debug( dc::notice.on() ) +#define ID3D_NOTICE(x) Dout( dc::notice, x ) +#define ID3D_WARNING(x) Dout( dc::warning, x ) + +#else + +# define ID3D_INIT_DOUT() +# define ID3D_INIT_WARNING() +# define ID3D_INIT_NOTICE() +# define ID3D_NOTICE(x) +# define ID3D_WARNING(x) + +#endif /* defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) */ + diff --git a/id3lib/config.sub b/id3lib/config.sub new file mode 100644 index 0000000..9772e87 --- /dev/null +++ b/id3lib/config.sub @@ -0,0 +1,1489 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-02-22' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic4x | c4x*) + basic_machine=tic4x-unknown + os=-coff + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/id3lib/configure b/id3lib/configure new file mode 100644 index 0000000..37b66f3 --- /dev/null +++ b/id3lib/configure @@ -0,0 +1,13092 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.53a. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + + + +# Making releases: +# ID3LIB_PATCH_VERSION += 1; +# ID3LIB_INTERFACE_AGE += 1; +# ID3LIB_BINARY_AGE += 1; +# if any functions have been added, set ID3LIB_INTERFACE_AGE to 0. +# if backwards compatibility has been broken, +# set ID3LIB_BINARY_AGE _and_ ID3LIB_INTERFACE_AGE to 0. +# + +ID3LIB_MAJOR_VERSION=3 +ID3LIB_MINOR_VERSION=8 +ID3LIB_PATCH_VERSION=3 +ID3LIB_ADDED_VERSION= +ID3LIB_VERSION=$ID3LIB_MAJOR_VERSION.$ID3LIB_MINOR_VERSION.$ID3LIB_PATCH_VERSION$ID3LIB_ADDED_VERSION + +ID3LIB_INTERFACE_AGE=0 +ID3LIB_BINARY_AGE=0 + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + +if test `expr $ID3LIB_MINOR_VERSION \% 2` = 1 ; then + debug_default=yes +else + debug_default=minimum +fi + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="reconf" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subdirs_all="$ac_subdirs_all zlib" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors + --enable-shared=PKGS build shared libraries default=yes + --enable-static=PKGS build static libraries default=yes + --enable-fast-install=PKGS optimize for fast installation default=yes + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-ansi turn on strict ansi default=no + --enable-cxx-warnings=no/minimum/yes Turn on compiler warnings. + --enable-iso-cxx Try to warn if code is not ISO C++ + --enable-debug=no/minimum/yes turn on debugging default=$debug_default + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-pic try to use only PIC/non-PIC objects default=use both + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.53a. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n ) continue ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + +ID3LIB_NAME=id3lib + +#AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl + + + + + + + + + +# for documentation purposes +DOX_DIR_HTML=api +DOX_DIR_LATEX=latex +DOX_DIR_MAN=man +DOX_DIR_RTF=rtf + + + + + + +# libtool versioning +LT_RELEASE=$ID3LIB_MAJOR_VERSION.$ID3LIB_MINOR_VERSION +LT_CURRENT=`expr $ID3LIB_PATCH_VERSION - $ID3LIB_INTERFACE_AGE` +LT_REVISION=$ID3LIB_INTERFACE_AGE +LT_AGE=`expr $ID3LIB_BINARY_AGE - $ID3LIB_INTERFACE_AGE` + + + + + +VERSION=$ID3LIB_VERSION +PACKAGE=$ID3LIB_NAME + +ID3LIB_FULLNAME=$ID3LIB_NAME-$ID3LIB_VERSION + + + +# Add the stamp file to the list of files AC keeps track of, +# along with our hook. + ac_config_headers="$ac_config_headers config.h" + + + + +am__api_version="1.6" +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="${MAKE}"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + # test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# Define the identity of the package. + PACKAGE=$PACKAGE + VERSION=$VERSION + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + + + +rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null + + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +echo "$as_me:$LINENO: checking for library containing strerror" >&5 +echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 +if test "${ac_cv_search_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_strerror=no +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="none required" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_strerror" = no; then + for ac_lib in cposix; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6 +if test "$ac_cv_search_strerror" != no; then + test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" + +fi + + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi; +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi; +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi; +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi + +NM="$lt_cv_path_NM" +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 + +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5 +echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; +esac + +fi +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + + + + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in dlfcn.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 4471 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +lt_cv_cc_needs_belf=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + + +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$as_me:$LINENO: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 + + + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi + +fi + +if test -z "$lt_cv_prog_cc_pic"; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +else + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 + + # Check to make sure the pic_flag actually works. + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + lt_cv_prog_cc_pic_works=no + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + +fi + + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + +echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_prog_cc_static_works=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi + + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:5007: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +fi + +compiler_c_o=$lt_cv_compiler_c_o +echo "$as_me:$LINENO: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 +echo "${ECHO_T}$compiler_o_lo" >&6 +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [12].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 +test "$ld_shlibs" = no && can_build_shared=no + +# Check hardcoding attributes. +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +# PORTME Fill in your ld.so characteristics +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +f = shl_load; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +f = dlopen; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi + + echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi; + echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + +#AC_CANONICAL_HOST + + +# Check whether --enable-ansi or --disable-ansi was given. +if test "${enable_ansi+set}" = set; then + enableval="$enable_ansi" + +else + enable_ansi=no +fi; + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cxx_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 +echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + + +echo "$as_me:$LINENO: checking for uncompress in -lz" >&5 +echo $ECHO_N "checking for uncompress in -lz... $ECHO_C" >&6 +if test "${ac_cv_lib_z_uncompress+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char uncompress (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +uncompress (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_z_uncompress=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_z_uncompress=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_z_uncompress" >&5 +echo "${ECHO_T}$ac_cv_lib_z_uncompress" >&6 +if test $ac_cv_lib_z_uncompress = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_ZLIB 1 +_ACEOF + +fi +#,, +# AC_MSG_ERROR([id3lib requires zlib to process compressed frames])) + + + +if test x$ac_cv_lib_z_uncompress = xno; then + ID3_NEEDZLIB_TRUE= + ID3_NEEDZLIB_FALSE='#' +else + ID3_NEEDZLIB_TRUE='#' + ID3_NEEDZLIB_FALSE= +fi + + + +if test x$enable_debug = xyes; then + ID3_NEEDDEBUG_TRUE= + ID3_NEEDDEBUG_FALSE='#' +else + ID3_NEEDDEBUG_TRUE='#' + ID3_NEEDDEBUG_FALSE= +fi + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + + + +for ac_header in zlib.h wchar.h sys/param.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in iconv.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + has_iconv=1 +else + has_iconv=0 +fi + +done + + + +ICONV_LIB= +if test $has_iconv = 1; then + echo "$as_me:$LINENO: checking where to find iconv_open" >&5 +echo $ECHO_N "checking where to find iconv_open... $ECHO_C" >&6 + exec 6>/dev/null + +for ac_func in iconv_open +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + iconv_in_libc=1 +else + iconv_in_libc=0 +fi +done + + echo "$as_me:$LINENO: checking for iconv_open in -liconv" >&5 +echo $ECHO_N "checking for iconv_open in -liconv... $ECHO_C" >&6 +if test "${ac_cv_lib_iconv_iconv_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-liconv $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char iconv_open (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +iconv_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_iconv_iconv_open=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_iconv_iconv_open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_iconv_open" >&5 +echo "${ECHO_T}$ac_cv_lib_iconv_iconv_open" >&6 +if test $ac_cv_lib_iconv_iconv_open = yes; then + iconv_in_iconv=1 +else + iconv_in_iconv=0 +fi + + echo "$as_me:$LINENO: checking for libiconv_open in -liconv" >&5 +echo $ECHO_N "checking for libiconv_open in -liconv... $ECHO_C" >&6 +if test "${ac_cv_lib_iconv_libiconv_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-liconv $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char libiconv_open (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +libiconv_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_iconv_libiconv_open=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_iconv_libiconv_open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_libiconv_open" >&5 +echo "${ECHO_T}$ac_cv_lib_iconv_libiconv_open" >&6 +if test $ac_cv_lib_iconv_libiconv_open = yes; then + libiconv_in_iconv=1 +else + libiconv_in_iconv=0 +fi + + if test ! x$silent = xyes; then + exec 6>&1 + fi + #standalone library rules over libc + if test $iconv_in_iconv = 1 -o $libiconv_in_iconv = 1; then + echo "$as_me:$LINENO: result: libiconv" >&5 +echo "${ECHO_T}libiconv" >&6 + ICONV_LIB=-liconv + elif test $iconv_in_libc = 1; then + echo "$as_me:$LINENO: result: libc" >&5 +echo "${ECHO_T}libc" >&6 + else + echo "$as_me:$LINENO: result: not found (panic)" >&5 +echo "${ECHO_T}not found (panic)" >&6 + { { echo "$as_me:$LINENO: error: iconv.h found, while iconv library not found" >&5 +echo "$as_me: error: iconv.h found, while iconv library not found" >&2;} + { (exit 1); exit 1; }; } + fi + #we have iconv at this moment, better check which call to use + echo "$as_me:$LINENO: checking whether iconv takes const char ** or char **" >&5 +echo $ECHO_N "checking whether iconv takes const char ** or char **... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + { + size_t iconv (iconv_t a, const char ** b, size_t *c, char **d, size_t *e); + } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + iconv_oldstyle=1 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +iconv_oldstyle=0 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + if test $iconv_oldstyle = 1; then + echo "$as_me:$LINENO: result: const char **" >&5 +echo "${ECHO_T}const char **" >&6 + cat >>confdefs.h <<\_ACEOF +#define ID3LIB_ICONV_OLDSTYLE 1 +_ACEOF + + #we'll check out the need of + #typecast in the call of iconv_open + echo "$as_me:$LINENO: checking whether to typecast in iconv" >&5 +echo $ECHO_N "checking whether to typecast in iconv... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + { + const char *src = "nothing"; + char *outbuf; + size_t insize = 0; + size_t outsize = 0; + iconv_t cd; + iconv(cd, &src, &insize, &outbuf, &outsize); + } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + iconv_cast=0 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +iconv_cast=1 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + if test $iconv_cast = 1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<\_ACEOF +#define ID3LIB_ICONV_CAST_OK 1 +_ACEOF + + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + + else + echo "$as_me:$LINENO: result: char **" >&5 +echo "${ECHO_T}char **" >&6 + #we'll check out the need of + #typecast in the call of iconv_open + echo "$as_me:$LINENO: checking whether to typecast in iconv" >&5 +echo $ECHO_N "checking whether to typecast in iconv... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + { + char *src = "nothing"; + char *outbuf; + size_t insize = 0; + size_t outsize = 0; + iconv_t cd; + iconv(cd, &src, &insize, &outbuf, &outsize); + } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + iconv_cast=0 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +iconv_cast=1 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + if test $iconv_cast = 1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<\_ACEOF +#define ID3LIB_ICONV_CAST_OK 1 +_ACEOF + + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + fi + +fi +if test "x$ICONV_LIB" != "x"; then + LIBS="$LIBS $ICONV_LIB" +fi + + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +for ac_header in libcw/sys.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + +for ac_header in cctype climits cstdio cstdlib bitset cstring +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + +for ac_header in fstream iostream iomanip vector \ + +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + { { echo "$as_me:$LINENO: error: Missing a vital header file for id3lib - download them here: http://gcc.gnu.org/libstdc++/ or better - compile a newer compiler like gcc3.x" >&5 +echo "$as_me: error: Missing a vital header file for id3lib - download them here: http://gcc.gnu.org/libstdc++/ or better - compile a newer compiler like gcc3.x" >&2;} + { (exit 1); exit 1; }; } + +fi + +done + + + +for ac_header in \ + string \ + iomanip.h \ + +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + { { echo "$as_me:$LINENO: error: Missing a vital header file for id3lib" >&5 +echo "$as_me: error: Missing a vital header file for id3lib" >&2;} + { (exit 1); exit 1; }; } + +fi + +done + + + + + + + + + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + echo "$as_me:$LINENO: checking whether C++ has bool" >&5 +echo $ECHO_N "checking whether C++ has bool... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} + +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +main() { bool b1=true; bool b2=false; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + cat >>confdefs.h <<\_ACEOF +#define CXX_HAS_NO_BOOL 1 +_ACEOF + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + echo "$as_me:$LINENO: checking whether C++ has correct scoping in for-loops" >&5 +echo $ECHO_N "checking whether C++ has correct scoping in for-loops... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + for (int i=0;i<10;i++) { } + for (int i=0;i<10;i++) { } + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + cat >>confdefs.h <<\_ACEOF +#define CXX_HAS_BUGGY_FOR_LOOPS 1 +_ACEOF + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + + # Check whether --enable-cxx-warnings or --disable-cxx-warnings was given. +if test "${enable_cxx_warnings+set}" = set; then + enableval="$enable_cxx_warnings" + +else + enable_cxx_warnings=minimum +fi; + + echo "$as_me:$LINENO: checking what warning flags to pass to the C++ compiler" >&5 +echo $ECHO_N "checking what warning flags to pass to the C++ compiler... $ECHO_C" >&6 + warnCXXFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + if test "x$enable_cxx_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *\ \ -Wall\ \ *) ;; + *) warnCXXFLAGS="-Wall -Wno-unused -Wno-inline -Woverloaded-virtual -Wmissing-declarations" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_cxx_warnings" = "xyes"; then + warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Woverloaded-virtual" + fi + fi + fi + echo "$as_me:$LINENO: result: $warnCXXFLAGS" >&5 +echo "${ECHO_T}$warnCXXFLAGS" >&6 + + # Check whether --enable-iso-cxx or --disable-iso-cxx was given. +if test "${enable_iso_cxx+set}" = set; then + enableval="$enable_iso_cxx" + +else + enable_iso_cxx=no +fi; + + echo "$as_me:$LINENO: checking what language compliance flags to pass to the C++ compiler" >&5 +echo $ECHO_N "checking what language compliance flags to pass to the C++ compiler... $ECHO_C" >&6 + complCXXFLAGS= + if test "x$enable_iso_cxx" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *\ \ -ansi\ \ *) ;; + *) complCXXFLAGS="$complCXXFLAGS -ansi" ;; + esac + + case " $CXXFLAGS " in + *\ \ -pedantic\ \ *) ;; + *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;; + esac + fi + fi + echo "$as_me:$LINENO: result: $complCXXFLAGS" >&5 +echo "${ECHO_T}$complCXXFLAGS" >&6 + if test "x$cxxflags_set" != "xyes"; then + CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS" + cxxflags_set=yes + + fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + # Check whether --enable-debug or --disable-debug was given. +if test "${enable_debug+set}" = set; then + enableval="$enable_debug" + +else + enable_debug=$debug_default +fi; + + if test "x$enable_debug" = "xyes"; then + test "$cflags_set" = set || CFLAGS="$CFLAGS -g" + cat >>confdefs.h <<\_ACEOF +#define ID3_ENABLE_DEBUG 1 +_ACEOF + + else + if test "x$enable_debug" = "xno"; then + cat >>confdefs.h <<\_ACEOF +#define ID3_DISABLE_ASSERT 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define ID3_DISABLE_CHECKS 1 +_ACEOF + + fi + fi + + + if test "x$ac_cv_header_iconv_h" = "xyes"; then + ID3_ICONV_FORMAT_UTF8=no + ID3_ICONV_FORMAT_UTF16=no + ID3_ICONV_FORMAT_UTF16BE=no + ID3_ICONV_FORMAT_ASCII=no + + + if eval "test \"x\$ID3_ICONV_FORMAT_UTF8\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports UTF-8" >&5 +echo $ECHO_N "checking whether iconv supports UTF-8... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("UTF-8", "UTF-8") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_UTF8=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_UTF8 "UTF-8" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + + + if eval "test \"x\$ID3_ICONV_FORMAT_UTF8\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports UTF8" >&5 +echo $ECHO_N "checking whether iconv supports UTF8... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("UTF8", "UTF8") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_UTF8=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_UTF8 "UTF8" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF8) + + + if eval "test \"x\$ID3_ICONV_FORMAT_UTF16BE\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports UTF-16BE" >&5 +echo $ECHO_N "checking whether iconv supports UTF-16BE... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("UTF-16BE", "UTF-16BE") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_UTF16BE=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_UTF16BE "UTF-16BE" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + + + if eval "test \"x\$ID3_ICONV_FORMAT_UTF16BE\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports UTF16BE" >&5 +echo $ECHO_N "checking whether iconv supports UTF16BE... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("UTF16BE", "UTF16BE") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_UTF16BE=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_UTF16BE "UTF16BE" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + + + if eval "test \"x\$ID3_ICONV_FORMAT_UTF16BE\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports UCS-2BE" >&5 +echo $ECHO_N "checking whether iconv supports UCS-2BE... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("UCS-2BE", "UCS-2BE") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_UTF16BE=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_UTF16BE "UCS-2BE" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + + + if eval "test \"x\$ID3_ICONV_FORMAT_UTF16BE\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports UCS2BE" >&5 +echo $ECHO_N "checking whether iconv supports UCS2BE... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("UCS2BE", "UCS2BE") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_UTF16BE=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_UTF16BE "UCS2BE" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + + + if eval "test \"x\$ID3_ICONV_FORMAT_UTF16BE\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports UNICODEBIG" >&5 +echo $ECHO_N "checking whether iconv supports UNICODEBIG... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("UNICODEBIG", "UNICODEBIG") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_UTF16BE=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_UTF16BE "UNICODEBIG" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE) + + + if eval "test \"x\$ID3_ICONV_FORMAT_UTF16\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports UTF-16" >&5 +echo $ECHO_N "checking whether iconv supports UTF-16... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("UTF-16", "UTF-16") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_UTF16=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_UTF16 "UTF-16" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + + + if eval "test \"x\$ID3_ICONV_FORMAT_UTF16\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports UTF16" >&5 +echo $ECHO_N "checking whether iconv supports UTF16... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("UTF16", "UTF16") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_UTF16=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_UTF16 "UTF16" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + + + if eval "test \"x\$ID3_ICONV_FORMAT_UTF16\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports UNICODE" >&5 +echo $ECHO_N "checking whether iconv supports UNICODE... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("UNICODE", "UNICODE") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_UTF16=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_UTF16 "UNICODE" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16) + + + if eval "test \"x\$ID3_ICONV_FORMAT_ASCII\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports ISO-8859-1" >&5 +echo $ECHO_N "checking whether iconv supports ISO-8859-1... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("ISO-8859-1", "ISO-8859-1") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_ASCII=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_ASCII "ISO-8859-1" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + + + if eval "test \"x\$ID3_ICONV_FORMAT_ASCII\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports ASCII" >&5 +echo $ECHO_N "checking whether iconv supports ASCII... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("ASCII", "ASCII") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_ASCII=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_ASCII "ASCII" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + + + if eval "test \"x\$ID3_ICONV_FORMAT_ASCII\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports US-ASCII" >&5 +echo $ECHO_N "checking whether iconv supports US-ASCII... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("US-ASCII", "US-ASCII") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_ASCII=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_ASCII "US-ASCII" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + + + if eval "test \"x\$ID3_ICONV_FORMAT_ASCII\" = \"xno\""; then + echo "$as_me:$LINENO: checking whether iconv supports US" >&5 +echo $ECHO_N "checking whether iconv supports US... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: WARNING: Don't cross-compile" >&5 +echo "$as_me: WARNING: Don't cross-compile" >&2;} +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + int main() { return iconv_open("US", "US") == -1; } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval ID3_ICONV_FORMAT_ASCII=yes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<_ACEOF +#define ID3_ICONV_FORMAT_ASCII "US" +_ACEOF + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII) + fi + + + +# AC_FUNC_MEMCMP + +for ac_func in getopt_long +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + +if test x$ac_cv_func_getopt_long = xno; then + ID3_NEEDGETOPT_LONG_TRUE= + ID3_NEEDGETOPT_LONG_FALSE='#' +else + ID3_NEEDGETOPT_LONG_TRUE='#' + ID3_NEEDGETOPT_LONG_FALSE= +fi + + + +for ac_func in mkstemp +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in truncate \ + +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + { { echo "$as_me:$LINENO: error: Missing a vital function for id3lib" >&5 +echo "$as_me: error: Missing a vital function for id3lib" >&2;} + { (exit 1); exit 1; }; } + +fi +done + + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned +_ACEOF + +fi + + + + + +cat >>confdefs.h <<_ACEOF +#define _ID3LIB_NAME "$ID3LIB_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define _ID3LIB_VERSION "$ID3LIB_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define _ID3LIB_FULLNAME "$ID3LIB_FULLNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define _ID3LIB_MAJOR_VERSION $ID3LIB_MAJOR_VERSION +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define _ID3LIB_MINOR_VERSION $ID3LIB_MINOR_VERSION +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define _ID3LIB_PATCH_VERSION $ID3LIB_PATCH_VERSION +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define _ID3LIB_INTERFACE_AGE $ID3LIB_INTERFACE_AGE +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define _ID3LIB_BINARY_AGE $ID3LIB_BINARY_AGE +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define _ID3_COMPILED_WITH_DEBUGGING "${enable_debug}" +_ACEOF + + +CONDITIONAL_SUBDIRS= +if test "x$ac_cv_lib_z_uncompress" = "xno"; then + CONDITIONAL_SUBDIRS="$CONDITIONAL_SUBDIRS zlib" +fi + + +subdirs="$subdirs zlib" + + +CFLAGS="$CFLAGS -Wall" + + ac_config_files="$ac_config_files Makefile doc/Makefile m4/Makefile include/Makefile include/id3/Makefile id3com/Makefile id3com/Sample/Makefile src/Makefile examples/Makefile prj/Makefile libprj/Makefile" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${ID3_NEEDZLIB_TRUE}" && test -z "${ID3_NEEDZLIB_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ID3_NEEDZLIB\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ID3_NEEDZLIB\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${ID3_NEEDDEBUG_TRUE}" && test -z "${ID3_NEEDDEBUG_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ID3_NEEDDEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ID3_NEEDDEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${ID3_NEEDGETOPT_LONG_TRUE}" && test -z "${ID3_NEEDGETOPT_LONG_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ID3_NEEDGETOPT_LONG\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ID3_NEEDGETOPT_LONG\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.53a. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.53a, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; + "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/id3/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/id3/Makefile" ;; + "id3com/Makefile" ) CONFIG_FILES="$CONFIG_FILES id3com/Makefile" ;; + "id3com/Sample/Makefile" ) CONFIG_FILES="$CONFIG_FILES id3com/Sample/Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "prj/Makefile" ) CONFIG_FILES="$CONFIG_FILES prj/Makefile" ;; + "libprj/Makefile" ) CONFIG_FILES="$CONFIG_FILES libprj/Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@ID3LIB_NAME@,$ID3LIB_NAME,;t t +s,@ID3LIB_MAJOR_VERSION@,$ID3LIB_MAJOR_VERSION,;t t +s,@ID3LIB_MINOR_VERSION@,$ID3LIB_MINOR_VERSION,;t t +s,@ID3LIB_PATCH_VERSION@,$ID3LIB_PATCH_VERSION,;t t +s,@ID3LIB_VERSION@,$ID3LIB_VERSION,;t t +s,@ID3LIB_INTERFACE_AGE@,$ID3LIB_INTERFACE_AGE,;t t +s,@ID3LIB_BINARY_AGE@,$ID3LIB_BINARY_AGE,;t t +s,@DOX_DIR_HTML@,$DOX_DIR_HTML,;t t +s,@DOX_DIR_LATEX@,$DOX_DIR_LATEX,;t t +s,@DOX_DIR_MAN@,$DOX_DIR_MAN,;t t +s,@DOX_DIR_RTF@,$DOX_DIR_RTF,;t t +s,@LT_RELEASE@,$LT_RELEASE,;t t +s,@LT_CURRENT@,$LT_CURRENT,;t t +s,@LT_REVISION@,$LT_REVISION,;t t +s,@LT_AGE@,$LT_AGE,;t t +s,@ID3LIB_FULLNAME@,$ID3LIB_FULLNAME,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@AMTAR@,$AMTAR,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@CPP@,$CPP,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +s,@ID3LIB_DEBUG_FLAGS@,$ID3LIB_DEBUG_FLAGS,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@ID3_NEEDZLIB_TRUE@,$ID3_NEEDZLIB_TRUE,;t t +s,@ID3_NEEDZLIB_FALSE@,$ID3_NEEDZLIB_FALSE,;t t +s,@ID3_NEEDDEBUG_TRUE@,$ID3_NEEDDEBUG_TRUE,;t t +s,@ID3_NEEDDEBUG_FALSE@,$ID3_NEEDDEBUG_FALSE,;t t +s,@cxxflags_set@,$cxxflags_set,;t t +s,@ID3_NEEDGETOPT_LONG_TRUE@,$ID3_NEEDGETOPT_LONG_TRUE,;t t +s,@ID3_NEEDGETOPT_LONG_FALSE@,$ID3_NEEDGETOPT_LONG_FALSE,;t t +s,@subdirs@,$subdirs,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi + # Run the commands associated with the file. + case $ac_file in + config.h ) # update the timestamp +echo 'timestamp for config.h' >"./stamp-h1" + ;; + esac +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d $srcdir/$ac_dir || continue + + { echo "$as_me:$LINENO: configuring in $ac_dir" >&5 +echo "$as_me: configuring in $ac_dir" >&6;} + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + cd $ac_dir + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'" + elif test -f $ac_srcdir/configure; then + ac_sub_configure="$SHELL '$ac_srcdir/configure'" + elif test -f $ac_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 +echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file=$ac_top_builddir$cache_file ;; + esac + + { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval $ac_sub_configure $ac_sub_configure_args \ + --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir || + { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 +echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} + { (exit 1); exit 1; }; } + fi + + cd $ac_popdir + done +fi + diff --git a/id3lib/configure.in b/id3lib/configure.in new file mode 100644 index 0000000..f0e3256 --- /dev/null +++ b/id3lib/configure.in @@ -0,0 +1,319 @@ +# $Id: configure.in,v 1.1 2007/11/12 21:32:37 pindakaasmod Exp $ + +# Copyright 1999, 2000 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# require autoconf 2.13 +AC_PREREQ(2.13) + +# init autoconf (and check for presence fo reconf) +AC_INIT(reconf) + +ID3LIB_NAME=id3lib + +dnl The following has been adapted from glib (http://www.gtk.org) +dnl +dnl we need to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions so they +dnl are available for $ac_help expansion (don't we all *love* autoconf?) +#AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl +ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) + +# Making releases: +# ID3LIB_PATCH_VERSION += 1; +# ID3LIB_INTERFACE_AGE += 1; +# ID3LIB_BINARY_AGE += 1; +# if any functions have been added, set ID3LIB_INTERFACE_AGE to 0. +# if backwards compatibility has been broken, +# set ID3LIB_BINARY_AGE _and_ ID3LIB_INTERFACE_AGE to 0. +# + +ID3LIB_MAJOR_VERSION=3 +ID3LIB_MINOR_VERSION=8 +ID3LIB_PATCH_VERSION=3 +ID3LIB_ADDED_VERSION= +ID3LIB_VERSION=$ID3LIB_MAJOR_VERSION.$ID3LIB_MINOR_VERSION.$ID3LIB_PATCH_VERSION$ID3LIB_ADDED_VERSION + +ID3LIB_INTERFACE_AGE=0 +ID3LIB_BINARY_AGE=0 +AC_DIVERT_POP()dnl + +AC_SUBST(ID3LIB_NAME) +AC_SUBST(ID3LIB_MAJOR_VERSION) +AC_SUBST(ID3LIB_MINOR_VERSION) +AC_SUBST(ID3LIB_PATCH_VERSION) +AC_SUBST(ID3LIB_VERSION) +AC_SUBST(ID3LIB_INTERFACE_AGE) +AC_SUBST(ID3LIB_BINARY_AGE) + +# for documentation purposes +DOX_DIR_HTML=api +DOX_DIR_LATEX=latex +DOX_DIR_MAN=man +DOX_DIR_RTF=rtf + +AC_SUBST(DOX_DIR_HTML) +AC_SUBST(DOX_DIR_LATEX) +AC_SUBST(DOX_DIR_MAN) +AC_SUBST(DOX_DIR_RTF) + +# libtool versioning +LT_RELEASE=$ID3LIB_MAJOR_VERSION.$ID3LIB_MINOR_VERSION +LT_CURRENT=`expr $ID3LIB_PATCH_VERSION - $ID3LIB_INTERFACE_AGE` +LT_REVISION=$ID3LIB_INTERFACE_AGE +LT_AGE=`expr $ID3LIB_BINARY_AGE - $ID3LIB_INTERFACE_AGE` +AC_SUBST(LT_RELEASE) +AC_SUBST(LT_CURRENT) +AC_SUBST(LT_REVISION) +AC_SUBST(LT_AGE) + +VERSION=$ID3LIB_VERSION +PACKAGE=$ID3LIB_NAME + +dnl This is a hack to get the release date using cvs checkin macros +ID3LIB_FULLNAME=$ID3LIB_NAME-$ID3LIB_VERSION + +AC_SUBST(ID3LIB_FULLNAME) + +AM_CONFIG_HEADER(config.h) + +AM_INIT_AUTOMAKE($PACKAGE,$VERSION) + +AC_ISC_POSIX + +dnl Initialize libtool +AM_PROG_LIBTOOL + +dnl Initialize maintainer mode +AM_MAINTAINER_MODE + +#AC_CANONICAL_HOST + +dnl figure debugging default, prior to $ac_help setup +dnl +ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +if test `expr $ID3LIB_MINOR_VERSION \% 2` = 1 ; then + debug_default=yes +else + debug_default=minimum +fi +AC_DIVERT_POP()dnl + +dnl declare --enable-* args and collect ac_help strings +AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]], , enable_ansi=no) +dnl +AC_SUBST(ID3LIB_DEBUG_FLAGS) + +dnl Checks for programs +AC_PROG_CC +AC_PROG_CXX +AC_PROG_CXXCPP +AC_PROG_INSTALL + +dnl for executable extensions +AC_EXEEXT + +dnl Checks for libraries. +AC_CHECK_LIB(z,uncompress,AC_DEFINE_UNQUOTED(HAVE_ZLIB))#,, +# AC_MSG_ERROR([id3lib requires zlib to process compressed frames])) + +AM_CONDITIONAL(ID3_NEEDZLIB, test x$ac_cv_lib_z_uncompress = xno) +AM_CONDITIONAL(ID3_NEEDDEBUG, test x$enable_debug = xyes) + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(zlib.h wchar.h sys/param.h unistd.h ) + +dnl check wheter iconv is the part of libc. +AC_CHECK_HEADERS( iconv.h, has_iconv=1, has_iconv=0) + +dnl if we have iconv library, we have to decide if it +dnl is present in libc + +ICONV_LIB= +if test $has_iconv = 1; then + AC_MSG_CHECKING(where to find iconv_open) + exec 6>/dev/null + AC_CHECK_FUNCS(iconv_open, iconv_in_libc=1, iconv_in_libc=0) + AC_CHECK_LIB(iconv, iconv_open, iconv_in_iconv=1, iconv_in_iconv=0) + AC_CHECK_LIB(iconv, libiconv_open, libiconv_in_iconv=1, libiconv_in_iconv=0) + if test ! x$silent = xyes; then + exec 6>&1 + fi + #standalone library rules over libc + if test $iconv_in_iconv = 1 -o $libiconv_in_iconv = 1; then + AC_MSG_RESULT(libiconv) + ICONV_LIB=-liconv + elif test $iconv_in_libc = 1; then + AC_MSG_RESULT(libc) + else + AC_MSG_RESULT(not found (panic)) + AC_MSG_ERROR([iconv.h found, while iconv library not found]) + fi + #we have iconv at this moment, better check which call to use + AC_MSG_CHECKING(whether iconv takes const char ** or char **) + AC_TRY_COMPILE([#include ],[ + { + size_t iconv (iconv_t a, const char ** b, size_t *c, char **d, size_t *e); + }], + iconv_oldstyle=1, iconv_oldstyle=0) + if test $iconv_oldstyle = 1; then + AC_MSG_RESULT(const char **) + AC_DEFINE(ID3LIB_ICONV_OLDSTYLE) + #we'll check out the need of + #typecast in the call of iconv_open + AC_MSG_CHECKING(whether to typecast in iconv) + AC_TRY_COMPILE([#include ],[ + { + const char *src = "nothing"; + char *outbuf; + size_t insize = 0; + size_t outsize = 0; + iconv_t cd; + iconv(cd, &src, &insize, &outbuf, &outsize); + }], + iconv_cast=0, iconv_cast=1) + if test $iconv_cast = 1; then + AC_MSG_RESULT(yes) + AC_DEFINE(ID3LIB_ICONV_CAST_OK) + else + AC_MSG_RESULT(no) + fi + + else + AC_MSG_RESULT(char **) + #we'll check out the need of + #typecast in the call of iconv_open + AC_MSG_CHECKING(whether to typecast in iconv) + AC_TRY_COMPILE([#include ],[ + { + char *src = "nothing"; + char *outbuf; + size_t insize = 0; + size_t outsize = 0; + iconv_t cd; + iconv(cd, &src, &insize, &outbuf, &outsize); + }], + iconv_cast=0, iconv_cast=1) + if test $iconv_cast = 1; then + AC_MSG_RESULT(yes) + AC_DEFINE(ID3LIB_ICONV_CAST_OK) + else + AC_MSG_RESULT(no) + fi + fi + +fi +if test "x$ICONV_LIB" != "x"; then + LIBS="$LIBS $ICONV_LIB" +fi + +dnl Check for c++ features +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_CHECK_HEADERS(libcw/sys.h) +AC_CHECK_HEADERS(cctype climits cstdio cstdlib bitset cstring) +AC_CHECK_HEADERS(fstream iostream iomanip vector \ + ,,AC_MSG_ERROR([Missing a vital header file for id3lib - download them here: http://gcc.gnu.org/libstdc++/ or better - compile a newer compiler like gcc3.x]) +) +AC_CHECK_HEADERS( \ + string \ + iomanip.h \ + ,,AC_MSG_ERROR([Missing a vital header file for id3lib]) +) + +dnl Checks for the portability of certain c++ features: the bool type and +dnl for-loop scoping +ID3_CXX_PORTABILITY + +ID3_CXX_WARNINGS + +AC_LANG_RESTORE + +ID3_DEBUG +ID3_UNICODE + +dnl Check for functions. + +# AC_FUNC_MEMCMP +AC_CHECK_FUNCS(getopt_long) +AM_CONDITIONAL(ID3_NEEDGETOPT_LONG, test x$ac_cv_func_getopt_long = xno) + +AC_CHECK_FUNCS(mkstemp) +AC_CHECK_FUNCS( + truncate \ + ,,AC_MSG_ERROR([Missing a vital function for id3lib]) +) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_TYPE_SIZE_T + +dnl +dnl Checks with local macros +dnl + +dnl Provides a --honor-std option to the configure script that honors the +dnl std namespace. Must be used AFTER configuring ALL compilers. +dnl LF_HONOR_STD + +dnl ACCONFIG TEMPLATE +dnl +dnl /* config.h defines these preprocesser symbols to be used by id3lib for +dnl * determining internal versioning information. The intent is that these +dnl * macros will be made available in the library via constants, functions, +dnl * or static methods. +dnl */ +dnl #undef HAVE_ZLIB +dnl #undef HAVE_GETOPT_LONG +dnl #undef _ID3LIB_NAME +dnl #undef _ID3LIB_VERSION +dnl #undef _ID3LIB_FULLNAME +dnl #undef _ID3LIB_MAJOR_VERSION +dnl #undef _ID3LIB_MINOR_VERSION +dnl #undef _ID3LIB_PATCH_VERSION +dnl #undef _ID3LIB_INTERFACE_AGE +dnl #undef _ID3LIB_BINARY_AGE +dnl #undef _ID3_COMPILED_WITH_DEBUGGING +dnl /* */ +dnl END ACCONFIG + +AC_DEFINE_UNQUOTED(_ID3LIB_NAME, "$ID3LIB_NAME") +AC_DEFINE_UNQUOTED(_ID3LIB_VERSION, "$ID3LIB_VERSION") +AC_DEFINE_UNQUOTED(_ID3LIB_FULLNAME, "$ID3LIB_FULLNAME") +AC_DEFINE_UNQUOTED(_ID3LIB_MAJOR_VERSION, $ID3LIB_MAJOR_VERSION) +AC_DEFINE_UNQUOTED(_ID3LIB_MINOR_VERSION, $ID3LIB_MINOR_VERSION) +AC_DEFINE_UNQUOTED(_ID3LIB_PATCH_VERSION, $ID3LIB_PATCH_VERSION) +AC_DEFINE_UNQUOTED(_ID3LIB_INTERFACE_AGE, $ID3LIB_INTERFACE_AGE) +AC_DEFINE_UNQUOTED(_ID3LIB_BINARY_AGE, $ID3LIB_BINARY_AGE) +AC_DEFINE_UNQUOTED(_ID3_COMPILED_WITH_DEBUGGING, "${enable_debug}") + +CONDITIONAL_SUBDIRS= +if test "x$ac_cv_lib_z_uncompress" = "xno"; then + CONDITIONAL_SUBDIRS="$CONDITIONAL_SUBDIRS zlib" +fi +AC_CONFIG_SUBDIRS(zlib) + +CFLAGS="$CFLAGS -Wall" + +AC_OUTPUT( \ + Makefile \ + doc/Makefile \ + m4/Makefile \ + include/Makefile \ + include/id3/Makefile \ + id3com/Makefile \ + id3com/Sample/Makefile \ + src/Makefile \ + examples/Makefile \ + prj/Makefile \ + libprj/Makefile +) diff --git a/id3lib/depcomp b/id3lib/depcomp new file mode 100644 index 0000000..6589965 --- /dev/null +++ b/id3lib/depcomp @@ -0,0 +1,411 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 AIX compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + + tmpdepfile1="$object.d" + tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` + if test "$libtool" = yes; then + "$@" -Wc,-MD + else + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + test -z "$dashmflag" && dashmflag=-M + ( IFS=" " + case " $* " in + *" --mode=compile "*) # this is libtool, let us make it quiet + for arg + do # cycle over the arguments + case "$arg" in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + # X makedepend + ( + shift + cleared=no + for arg in "$@"; do + case $cleared in no) + set ""; shift + cleared=yes + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tail +3 "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + ( IFS=" " + case " $* " in + *" --mode=compile "*) + for arg + do # cycle over the arguments + case $arg in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + ( IFS=" " + case " $* " in + *" --mode=compile "*) + for arg + do # cycle over the arguments + case $arg in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/id3lib/doc/3d-logo.gif b/id3lib/doc/3d-logo.gif new file mode 100644 index 0000000..3f95829 Binary files /dev/null and b/id3lib/doc/3d-logo.gif differ diff --git a/id3lib/doc/Doxyfile.in b/id3lib/doc/Doxyfile.in new file mode 100644 index 0000000..7298cd5 --- /dev/null +++ b/id3lib/doc/Doxyfile.in @@ -0,0 +1,723 @@ +# Doxyfile 1.2.2 + +# This file describes the settings to be used by doxygen for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = @PACKAGE@ + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = @VERSION@ + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = . + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, +# Korean, Hungarian, Spanish, Romanian, Russian, Croatian, Polish, and +# Portuguese. + +OUTPUT_LANGUAGE = English + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = YES + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. + +STRIP_FROM_PATH = .. + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a class diagram (in Html and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. + +CLASS_DIAGRAMS = YES + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower case letters. If set to YES upper case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are adviced to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES (the default) then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the Javadoc-style will +# behave just like the Qt-style comments. + +JAVADOC_AUTOBRIEF = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. + +INHERIT_DOCS = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = YES + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# The ENABLE_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../src \ + ../include/id3/field.h \ + ../include/id3/frame.h \ + ../include/id3/globals.h \ + ../include/id3/misc_support.h \ + ../include/id3/reader.h \ + ../include/id3/readers.h \ + ../include/id3/sized_types.h \ + ../include/id3/tag.h \ + ../include/id3/tag.h \ + ../include/id3/writer.h \ + ../include/id3/writers.h + + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +FILE_PATTERNS = *.cpp \ + *.h + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = ../examples + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = *.cpp \ + *.c \ + *.h + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = . + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = @DOX_DIR_HTML@ + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet + +HTML_STYLESHEET = id3lib.css + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = @DOX_DIR_LATEX@ + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = letter + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = @DOX_DIR_RTF@ + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using a WORD or other. +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = @DOX_DIR_MAN@ + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. Warning: This feature +# is still experimental and very incomplete. + +GENERATE_XML = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = __cplusplus + +# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tagfiles. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to +# YES then doxygen will generate a graph for each documented file showing +# the direct and indirect include dependencies of the file with other +# documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to +# YES then doxygen will generate a graph for each documented header file showing +# the documented files that directly or indirectly include this file + +INCLUDED_BY_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO + +# The CGI_NAME tag should be the name of the CGI script that +# starts the search engine (doxysearch) with the correct parameters. +# A script with this name will be generated by doxygen. + +CGI_NAME = search.cgi + +# The CGI_URL tag should be the absolute URL to the directory where the +# cgi binaries are located. See the documentation of your http daemon for +# details. + +CGI_URL = + +# The DOC_URL tag should be the absolute URL to the directory where the +# documentation is located. If left blank the absolute path to the +# documentation, with file:// prepended to it, will be used. + +DOC_URL = + +# The DOC_ABSPATH tag should be the absolute path to the directory where the +# documentation is located. If left blank the directory on the local machine +# will be used. + +DOC_ABSPATH = + +# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +# is installed. + +BIN_ABSPATH = /usr/local/bin/ + +# The EXT_DOC_PATHS tag can be used to specify one or more paths to +# documentation generated for other projects. This allows doxysearch to search +# the documentation for these projects as well. + +EXT_DOC_PATHS = diff --git a/id3lib/doc/Makefile.am b/id3lib/doc/Makefile.am new file mode 100644 index 0000000..50eda87 --- /dev/null +++ b/id3lib/doc/Makefile.am @@ -0,0 +1,51 @@ +# Copyright (C) 1999 Scott Thomas Haug +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +EXTRA_DIST = \ + Doxyfile \ + Doxyfile.in \ + 3d-logo.gif \ + attilas_id3logo.jpg \ + fillpx.gif \ + id3guide.html \ + id3lib-manual.php \ + id3lib.css \ + id3v2.3.0.html \ + id3v2.3.0.txt \ + id3v2.gif \ + id3v2.ico \ + id3v2.png \ + index.html \ + index.html.in \ + musicmatch.txt + +Doxyfile: $(srcdir)/Doxyfile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +index.html: $(srcdir)/index.html.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +docsdistdir = $(PACKAGE)-doc-$(VERSION) + +dox: Doxyfile + -rm -rf @DOX_DIR_HTML@ @DOX_DIR_LATEX@ + cd $(srcdir) && doxygen Doxyfile + +docs: dox index.html id3lib.css + -rm -rf $(docsdistdir).* + cd $(srcdir)/@DOX_DIR_LATEX@ && \ + make pdf && \ + (cp *.pdf ../$(docsdistdir).pdf || true) && \ + cp *.ps ../$(docsdistdir).ps && \ + gzip -9 ../$(docsdistdir).ps + -rm -rf $(srcdir)/@DOX_DIR_LATEX@ + diff --git a/id3lib/doc/Makefile.in b/id3lib/doc/Makefile.in new file mode 100644 index 0000000..59db1ca --- /dev/null +++ b/id3lib/doc/Makefile.in @@ -0,0 +1,289 @@ +# Makefile.in generated by automake 1.6.2 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 1999 Scott Thomas Haug +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOX_DIR_HTML = @DOX_DIR_HTML@ +DOX_DIR_LATEX = @DOX_DIR_LATEX@ +DOX_DIR_MAN = @DOX_DIR_MAN@ +DOX_DIR_RTF = @DOX_DIR_RTF@ +ECHO = @ECHO@ +ID3LIB_BINARY_AGE = @ID3LIB_BINARY_AGE@ +ID3LIB_DEBUG_FLAGS = @ID3LIB_DEBUG_FLAGS@ +ID3LIB_FULLNAME = @ID3LIB_FULLNAME@ +ID3LIB_INTERFACE_AGE = @ID3LIB_INTERFACE_AGE@ +ID3LIB_MAJOR_VERSION = @ID3LIB_MAJOR_VERSION@ +ID3LIB_MINOR_VERSION = @ID3LIB_MINOR_VERSION@ +ID3LIB_NAME = @ID3LIB_NAME@ +ID3LIB_PATCH_VERSION = @ID3LIB_PATCH_VERSION@ +ID3LIB_VERSION = @ID3LIB_VERSION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +cxxflags_set = @cxxflags_set@ +install_sh = @install_sh@ + +EXTRA_DIST = \ + Doxyfile \ + Doxyfile.in \ + 3d-logo.gif \ + attilas_id3logo.jpg \ + fillpx.gif \ + id3guide.html \ + id3lib-manual.php \ + id3lib.css \ + id3v2.3.0.html \ + id3v2.3.0.txt \ + id3v2.gif \ + id3v2.ico \ + id3v2.png \ + index.html \ + index.html.in \ + musicmatch.txt + + +docsdistdir = $(PACKAGE)-doc-$(VERSION) +subdir = doc +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool uninstall uninstall-am uninstall-info-am + + +Doxyfile: $(srcdir)/Doxyfile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +index.html: $(srcdir)/index.html.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +dox: Doxyfile + -rm -rf @DOX_DIR_HTML@ @DOX_DIR_LATEX@ + cd $(srcdir) && doxygen Doxyfile + +docs: dox index.html id3lib.css + -rm -rf $(docsdistdir).* + cd $(srcdir)/@DOX_DIR_LATEX@ && \ + make pdf && \ + (cp *.pdf ../$(docsdistdir).pdf || true) && \ + cp *.ps ../$(docsdistdir).ps && \ + gzip -9 ../$(docsdistdir).ps + -rm -rf $(srcdir)/@DOX_DIR_LATEX@ +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/id3lib/doc/attilas_id3logo.jpg b/id3lib/doc/attilas_id3logo.jpg new file mode 100644 index 0000000..20238cc Binary files /dev/null and b/id3lib/doc/attilas_id3logo.jpg differ diff --git a/id3lib/doc/fillpx.gif b/id3lib/doc/fillpx.gif new file mode 100644 index 0000000..bdf7a77 Binary files /dev/null and b/id3lib/doc/fillpx.gif differ diff --git a/id3lib/doc/id3guide.html b/id3lib/doc/id3guide.html new file mode 100644 index 0000000..e82b555 --- /dev/null +++ b/id3lib/doc/id3guide.html @@ -0,0 +1,636 @@ + + + + ID3v2.3 Programming Guidelines + + + + + + +

ID3v2.3 Programming Guidelines

+ +
+ +

Applies to: ID3v2.3
+Old versions: ID3v2.2 Guidelines (ID3v2.2 is obsolete +and should not be used for new tags.)

+ +

Table of Contents

+ +

1. Introduction
+1.1. Use of this document
+2. What's new in ID3v2.3?
+3. Programming Considerations
+     3.1 Padding
+     3.2 Read-only media
+     3.3 "Insignificant" +frames
+     3.4 Preferred image formats +
+     3.5 Multiple tags
+     3.6 Unsynchronization
+4. Pitfalls & General Advice
+     4.1 RTFM and yes, the details +matter!
+     4.2 Compression before encryption +
+     4.3 Validating user input +
+5. Credits
+6. References
+7. Copyright & Legal Notices

+ +

+


+ +

Introduction

+ +

There are many people who enjoy .MP3 compressed music. The MP3 specification +only defined the storage of musical data and did not provide the storage +of metadata related to the musical composition; e.g., title, composer and +artist, publisher, etc. The ID3 tag standard was created to remedy this +need...

+ +

Rationale: Specifications are like grammar: they provide the +rules of formatting data but few clues as to how to speak concisely and +efficiently. The goal of this document is to answer the "Should I +do..." and "Would doing X make it easier/faster/smaller..." +type questions.

+ +

Audience: This document is geared toward programmers dealing +directly with ID3v2.3 tags. There is a heavy slant towards writing tags +correctly since decoding is relatively straightforward. You should familiarize +yourself with the ID3v2 and related +standards since this document refers to and uses the terminology from +those documents.

+ +

Coverage: Although ID3v2 tags were created for use with +MPEG Layer-3 audio streams, flexibility was a goal from the start. +Even though much of this document refers to .MP3 files, the principles +are generally applicable to other formats.

+ +

+


+ +

Use of this document

+ +

These are merely Guidelines and as such they are not part of the ID3v2 +standard.

+ +
    +
  1. If anything in this document contradicts the published ID3v2 standard, +then the standard shall prevail. The ID3v2 standard always has the final +word. + +
  2. These Guidelines are not binding on anyone (whereas the standard is +binding, for obvious reasons.) This means you, as a programmer, should +never assume anyone else will abide by these guidelines. A protocol designer +once said: + +
      +

      "Be flexible in what you accept, but strict in what you write." +

      +
    + +
  3. Use your judgement and common sense.
  4. +
+ +

+


+ +

What's new in ID3v2.3?

+ +

For starters, the naming convention changed. "ID3v2" now refers +to the family of frame-based tagging methods which utilize the 10-byte +header beginning with "ID3" followed by version information. +"ID3v2.3.0" refers to the informal standard dated September +1998. The informal standard formerly known as "ID3v2" has been +renamed to "ID3v2.2"

+ +

This document concentrates on ID3v2.3. The previous standard, ID3v2.2, is now +obsolete; the Guidelines for ID3v2.2 may still be found here.

+ +

A summary of the differences between ID3v2.3.0 and v2.2 is listed below. +Section numbers match the +ID3v2.3.0 Informal Standard.

+ +

Structural changes:

+ +
    +
  • The Frame Header has been expanded. The Frame ID and Frame Size +fields are now four bytes long. Two bytes of Flags have been added. See +§3.3.
  • + +
  • An optional Extended Header can follow the ID3v2 tag header +§3.2. Among other things, the extended header can store a CRC of the +entire tag.
  • +
+ +

Clarifications:

+ +
    +
  • Pre-defined Frame IDs have been renamed to four characters long.
  • + +
  • Unicode strings are now required to start with the Byte Order Mark (BOM) +character. See §3.3.
  • + +
  • Compression and encryption are done on a frame-by-frame basis. The +compression algorithm are those offered in zlib. §3.3
  • + +
  • Attached Picture [APIC] frame: the Image Format field has been +replaced MIME Type §4.15.
  • +
+ +

New frames:

+ +
    +
  • Position Synchronization frame [POSS] §4.22
  • + +
  • Terms of Use frame [USER] §4.23
  • + +
  • Ownership frame [OWNE] §4.24
  • + +
  • Commercial frame [COMR] §4.25
  • + +
  • Private frame [PRIV] §4.28
  • + +
  • Encryption Method Registration [ENCR] §4.25
  • + +
  • Group ID Registration [GRID] §4.26.Used in conjunction with +new frame features described in §3.3
  • + +
  • Text frames: Internet Radio Station Name [TRSN] and Internet Radio +Station Owner [TRSO]
  • + +
  • URL link frames: Official internet radio station homepage +[WORS] and Payment [WPAY]
  • +
+ +

Deleted frames: Encrypted meta-frame.

+ +

+


+ +

3.1 Padding

+ +

The use of padding and how much should be used has been a matter of +debate ever since the first draft of ID3v2. (Take a look in the mailing +list archives for arguments.)

+ +

Before making recommendations let's quantify the issue:

+ +
    +
  • A two minute song compressed at 44Khz and 128Kb/sec takes about 1990K (slightly +less than 2MB) of disk space. The average size of .MP3 files in my +collection is 3.5MB
  • + +
  • ID3v1 and Lyrics3 tags are only 128 bytes and 3K, respectively - and +they served most songs just fine.
  • + +
  • An ID3v2 tag with basic information (title, artist/composer, copyright) is +typically less than 1K in size. Toss in publisher information and lyrics +and it comes out to 3K or so.
  • + +
  • Adding a 3K tag to a 2MB song will increase its size by 0.15%
  • + +
  • Adding a 10K tag to a 2MB song increases its size by 0.5%
  • + +
  • Suppose a CD-ROM holds 160 songs. Tagging all of them with 3K +tags requires less than a megabyte.
  • +
+ +

So in reality tags are tiny compared to the amount of audio data accompanying +it. A few KB of padding will not increase the file size noticeably. Remember +also the padding is required to be 0's, which means on a slow modem link +the padding is compressed significantly.

+ +

There is but one reason to use padding: since ID3v2 tags are stored +at the beginning of the file, it would be a major pain to rewrite the entire +multi-megabyte file to add a 50-byte frame. Padding reserves space in advance.

+ +

The issue then is how much padding should be used.

+ +

James's recommendations:

+ +
    +
  • What do most people care about? Probably title, artist, composer, +band, publisher, lyrics and copyright. 4K will usually be enough for all +that plus some miscellaneous information such as media type, file size, +playcounter, time codes, etc.
  • + +
  • If you are editing an existing tag and run out of room (meaning you +must rewrite the entire file) then double the amount of space reserved +for the tag. For example, a file has a 4K tag filled with 3K of data. User +wants to add 2K of data, so you rewrite the file reserving 8K at the beginning; +then save the 5K of data and leaving 3K of padding.
  • + +

    Obviously there should be an upper bound on doubling; a reasonable number +would be 16K or 32K. For example, a file has a 25K tag but only 4K of padding +left and the user wants to add 7K of new data. Rewrite the file and reserve +41K: save 28K of tag data and leave 13K of padding.

    + +
  • Pictures are large and vary in size. If there are pictures then you +should add more padding; use your judgement here.
  • + +
  • Do not forgo padding in files destined for read-only media or streaming +applications. The user may want to save the file to another location and +edit the tag.
  • + +
  • Include an option to let the user disable padding if (s)he really +wants to.
  • +
+ +

Martin has a good idea: Add enough padding to round out the file +to a full cluster. Obviously a minimum amount of padding has to be added +to be useful, but beyond the minimum, everything up to the next cluster +size will not occupy additional disk space. (Each operating system has +its own terminology; Microsoft uses cluster, Apple uses allocation +block. How files are stored on disk is beyond the scope of this document; +consult an OS book and API reference for details.)

+ +

Here are some common cluster sizes:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Operating system
+(file system type)
Disk size
< 256MBup to 512MBup to 1GBup to 2GBup to 8GBup to 16GB> 16GB
DOS & Windows 95
+(FAT16)
4K8K16K32KN/A
+(FAT16 can't handle drives > 4GB)
Win95 OSR2 & Win98
+(FAT32)
N/A4K8K16K or 32K
Windows NT
+(NTFS)
0.5K to 64K
+(0.5K to 4K clusters are most common)
MacOS pre-8.1
+(HFS)
0.5K - 4K4.5K - 8K8.5K - 16K16.5K - 32KN/A
+(HFS can't handle disks > 2GB)
MacOS 8.1 and later
+(HFS+)
0.5K1K2KDefault is 4K; user-selectable up to 4K
CD-ROM, 650MB
+(ISO 9660)
always 2K
DVD-ROM
+(UDF)
always 2K
+ +

Advanced operating systems employ tricks to optimize disk space. For +example, Novell NetWare 4 uses 64K disk blocks but can split a block into +0.5K pieces, thus creating the illusion of 512-byte blocks. UNIX file +systems have their own methods to utilize disk space efficiently.

+ +

James's shortcut on choosing an appropriate cluster size: 2K +(Nice even number, not too big, not too small)

+ +

3.2 Read-only media

+ +

Never assume a .MP3 file is writable unless the user is specifically +editing the tag. MP3 files can be stored on read-only media such as a CD-ROM +or a network share. If the user is editing the tag, it is an error if the +file is write-protected because the user's changes cannot be saved. If +a player is merely updating the playcounter or popularity-meter, it should +not pop up a message complaining the file cannot be written to.

+ +

James: Include a visual cue to indicate whether the file is write-protected. +For example, a small icon similar in size and color to the stereo indicator +in WinAMP. A quick glance will determine whether certain settings will +be saved.

+ +

3.3 "Insignificant" frames

+ +

"Insignificant" frames are small frames that don't necessarily +have meaning when a ID3v2 tag is created. The issue is whether the tag +editor should add these frames when they do not already exist.

+ +

For example, if Joe is adding tags to a fresh batch of .MP3 files, should +the tag editor include a playcounter [PCNT] frame in the tag? The tag editor +has no idea how many times the particular file has been played; unless +Joe tells it otherwise, the editor has to create a [PCNT] frame with a +count of 0.

+ +

There are two ways to look at this. On the one hand, the frame is so +small it takes almost no effort to include it. Since there will usually +be a few hundred bytes of padding, the ten bytes used by the counter frame +is in a sense "free." A player will probably add it later anyway +when the file is used.

+ +

On the other hand, if the frame is not holding useful information, why +bother adding it? Padding, if used, effectively reserves space for these +frames. Consider also the absence of a frame can be meaningful: the lack +of a playcounter frame may indicate "I do not know how many times +this piece has been played" as opposed to a count of 0, which +indicates "This song has never been played."

+ +

These can be considered "insignificant" frames:

+ +
    +
  • Playcounter [PCNT]
    +(James: an integrated ripper-encoder-tagger can include a playcount +of 0 in newly created files, since by definition they have never been used..) +
  • + +
  • Others, anyone?
  • +
+ +

Martin: It is considered good manner to allow the user to disable +writing of frames (s)he doesn't want. At least in an advanced menu in a +hidden place. Perhaps the user doesn't want the TSI, TLE, TMT and MLL frame +to be added automatically, even though it might be the default setting.

+ +

3.4 Preferred image formats

+ +

A question Martin gets often is why the ID3v2 document says "... +PNG and JPEG picture format should be used..." Interoperability +means it is almost guaranteed another ID3v2 tag/picture decoder can handle +the PNG and JPEG formats. The chances a Macintosh application can display +BMP files are slim; likewise, the complexities of EPS and TIFF are best +left out.

+ +

Consider these other arguments favoring PNG and JPEG:

+ +
    +
  • PNG compresses better than BMP, GIF and most other lossless formats.
  • + +
  • JPEG has superior compression to most formats, especially for photographic +pictures. (JPEG is not suitable for line-art and computer-generated graphics +- use PNG for these.)
  • + +
  • Both formats are patent- and royalty-free (which is not the case with +GIF, whose LZW compression algorithm is patented by Unisys.)
  • +
+ +

Martin: The freedom to use whatever format you like in the picture +frame is of course a freedom under responsibility. Do you want to make +cross platform tags? Do you want to avoid legal trouble, at least for the +principle? If so, use PNG and JPEG.

+ +

Dirk: Applications may want to convert the incoming picture type +to PNG or JPEG first, or failing that, at least inform the user that they +should be using PNG or JPEG, but allow the user to override this +if they insist on using, say, a PCX.

+ +

3.5 Multiple tags

+ +

Decoders should be prepared to handle multiple ID3v2 tags per stream. +This is especially important for players/decoders wanting to handle netradio-type +applications since the notion of distinct files may not apply.

+ +

Dirk: An easy way to achieve this would be to use a central 'frame +dispatch' routine, kind of like a demultiplexer.

+ +

3.6 Unsynchronization

+ +

The ID3v2 standard states "The only purpose of the 'unsychronisation +scheme' is to make the ID3v2 tag as compatible as possible with existing +software [at the time the ID3v2.2 standard was drafted]" What +are the implications?

+ +
    +
  1. .MP3 decoders, regardless of age, will not be affected by extraneous +data (i.e., tags) that does not contain a MPEG sync sequence.
  2. + +
  3. There is minimal impact if a decoder does not recognize ID3v2 tags +but encounters something with a sync sequence. At worst a click or pop +will be heard at the beginning of the piece, as if some data corruption +has occurred.
  4. + +
  5. New software is expected to take advantage of ID3v2. Unsynchronization +is not necessary with ID3v2 compliant software.
  6. +
+ +

(Software which does not behave according to items 1 and 2 above are +categorically deemed "broken." Microsoft's Media Player is an +example of such software.)

+ +

Martin: I believe that unsynchronization should be done as seldom +as possible since it increases the size of the tag as well as the parsing +time. In other words, I think unsynchronization should be turned off as +default.

+ +

However, it is important to be able to undo unsynchronization when reading +tags; otherwise unsynchronized tags will not be read correctly.

+ +

+


+ +

4.1 RTFM (details are important!)

+ +

When the ID3v2 document refers to another standard it is assumed that +the implementor is familiar with that standard as well. When it says URL +it does not mean 'www.buymusic.com', it means 'http://www.buymusic.com/' +A "URL containing an e-mail address" must include the +'mailto:' qualifier. Those who at least take a quick look at the related +standards will not make these kinds of mistakes.

+ +

If these details are so important, why aren't they spelled out in the +ID3v2 standard? According to Martin, "There has been people who said +to me, 'You must write these kind of things in the document, or else people +will make these mistakes.' The latest ID3 v2.01 draft is only 74,657 +bytes of pure text because I did not. Guess why there are references to +the standards in the document!"

+ +

4.2 Compression before encryption

+ +

Encryption works by scrambling data to produce what amounts to random +bits for an attacker. Data compression works by replacing or removing redundant +information. It follows that the output of any decent crypto algorithm +will not be compressible; therefore if you wish to use both compression +and encryption, you must compress the data before encrypting it.

+ +

Compressing before encryption also affords better security, since predictable +headers and such will be hidden by compression.

+ +

Remember: compression comes before encryption in the dictionary +(at least in English) and that is how it should be in your application. +

+ +

4.3 Validating user input

+ +

Never trust the input from the user to be sensible or formatted correctly. +Is the ISRC a valid one? Does the month 13 exist? Could this piece of music +be from disc 5 out of a 3 disc set?

+ +

Dirk: Personally, I think having input validation occur +when the user signifies that the tag is "finished" is a good +way of going about it, if only because I know I'll get half way through +something and want to stop and do something else before I forget.

+ +

James: Extremely strict validation becomes restrictions +on versatility and usability. An option to turn off or accept potentially +invalid data can be included somewhere. For example, by default Microsoft +Visual Basic checks for syntax errors as code is entered; however, users +can disable that feature if they wish to delay syntax checking until compile +time.

+ +

Things to watch out for (this is by no means an all-inclusive list):

+ +
    +
  • Properly formatted URLs (see RTFM, above.) But +should your application verify whether the URL actually exists? That may +be too complicated; Martin and James's opinion is no verification.
  • + +
  • Proper MIME types.
  • + +
  • Are characters valid? Most text fields forbid control characters, +even newlines. NULs are not allowed except in Unicode strings or to indicate +end-of-string for terminated strings.
  • + +
  • Numerical strings must consist solely of the characters '0' through +'9'
  • + +
  • Are lists handled properly? The list separator is a slash: / +What happens if the user enters a / in an item?
  • + +
  • Are characters such as ( escaped where necessary?
  • + +
  • Do dates and times make sense? Years must be four digits long and be +in the right century. (No Y2K problems here!)
  • + +
  • Is an image really the format the user claims it is? Some people believe +renaming a .BMP file to .PNG will change its format accordingly.
  • +
+ +

Your application should never crash because the user does something +stupid. Likewise, your application should not crash because of erroneous +or malformed data in a tag. It is particularly important your application +can recognize Unicode text frames and ignore them if the operating system +or your program cannot handle Unicode.

+ +

+


+ +

Credits & Contributors

+ + + +

References

+ + + +

+


+ +

Copyright & Legal Notice

+ +

Copyright © 1998 James Lin and Merlin's Workshop.

+ +

The goal of this document is to provide hints on how to implement the +ID3v2 standard(s) correctly and efficiently. Distribution of this document +is unlimited as long as no changes are made to its content:

+ +

This document and translations of it may be copied and furnished +to others, in any format or medium, provided no modifications are made +to the content unless written permission has been obtained from the author. +

+ +

This document is provided "AS IS" without warranty of any +kind, either expressed or implied, including but not limited to, the implied +warranties of merchantability and fitness for a particular purpose. +

+ +

In no event unless required by applicable law will the author of +this document be liable for damages, including any general, special, incidental +or consequential damages arising out of the use or inability to use any +information (including but not limited to loss or corruption of data or +losses sustained by third parties), even if the author has been advised +of the possibility of such damages.

+ +

Copyright © 1998 Merlin's +Workshop. Last updated October 22, 1998

+ + + diff --git a/id3lib/doc/id3lib-manual.php b/id3lib/doc/id3lib-manual.php new file mode 100644 index 0000000..0530bd0 --- /dev/null +++ b/id3lib/doc/id3lib-manual.php @@ -0,0 +1,1029 @@ +$string\n"; + echo "

"; + $subsection++; + return; +} + +function startSection() { + $subsection++; + echo "

    \n"; +} + +function endSection() { + global $subsection; + echo "
\n"; + echo "

\n"; + $subsection--; +} + +function startCode() { + global $subsection; + +/* +
navigator
+*/ + + echo "
"; + echo "
\n"; + echo "
";
+}
+
+function endCode() {
+    global $subsection;
+    echo  "
\n"; + echo "
"; + echo "
\n"; +} + +?> + +Documentation for ID3Lib 3.05 + + +
+ +Documentation for
+ID3Lib 3.05

+ + + +Copyright Dirk Mahoney
+22 November 1998 +
+

+ +
+ID3Lib is a C++ class library for manipulating ID3v2 tags. ID3Lib 3.05 conforms to all ID3v2 standards up to and including the ID3v2-3.0 informal standard. +
+ +

+ + + No intro. Let's go! + + + + +The authors have released ID3Lib as Public Domain (PD) and claim no copyright, patent or other intellectual property protection in this work. This means that it may be modified, redistributed and used in commercial and non-commercial software or hardware without restrictions. ID3Lib is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +

+The ID3Lib authors encourage improvements and optimisations to be sent to the ID3Lib coordinator, currently Dirk Mahoney (dirk@id3.org). Approved submissions may be altered, and will be included and released under these terms. + + + + +

+This is the "container" class for everything else. It is through an ID3_Tag object that most of the productive stuff happens. Let's look at what's required to start using ID3v2 tags. + + +#include "id3_tag.h" + + +This simple #include does it all. In order to read an existing tag + + +ID3_Tag myTag; + +myTag.Link ( "something.mp3" ); + + +That is all there is to it. Now all you have to do is use the ::Find() member function to locate the frames you are interested in: + + +ID3_Frame *myFrame; + +if ( myFrame = myTag.Find ( ID3FID_TITLE ) ) +{ + char title[ 1024 ]; + + myFrame->Field ( ID3FN_TEXT ).Get ( title, 1024 ); + + cout << "Title: " << title << endl; +} + + +This code snippet locates the TITLE frame and copies the contents of the text field into a buffer and displays the buffer. Not difficult eh? + +When using the ::Link() facility of an ID3_Tag object, you automatically gain access to any ID3v1/1.1, ID3v2 and Lyrics3 v2.0 tags present in the file. The class will automatically parse and convert any of these foreign tag formats into ID3v2 tags. Also, ID3Lib will correctly parse any correctly formatted 'CDM' frames from the unreleased 2.01 draft that ID3Lib 2.16 supports. +

+Okay, let's analyse the ID3_Tag class function-by-function to see what an application can do with it. +

+ + +The ID3_Tag constructor can be called without any parameters. Alternatively, it can accept a single parameter that is a pointer to a file name. If this file exists, it will be opened and all ID3Lib-supported tags will be parsed and converted to ID3v2 if necessary. After the conversion, the file will remain unchanged, and will continue to do so until you use the ID3_Tag::Update() function on the tag (if you choose to ID3_Tag::Update() at all). This will be discussed later. + + + + +This function takes no parameters and simply clears the object and disassociates it from any files. It frees any resources for which the object is responsible, and the object is now free to be used again for any new or existing tag. + + + + +This function takes no parameters but returns a boolean indicating whether the tag has been altered since the last parse, render or update. If you have a tag linked to a file, you do not need this function since the ID3_Tag::Update() function will check for changes before writing the tag. +

+This function is primarily intended as a status indicator for applications and for applications that use the ID3_Tag::Parse() and ID3_Tag::Render() functions. +

+Setting a field, changing the ID of an attached frame, setting or changing grouping or encryption IDs and clearing a frame or field all constitute a change to the tag, as do calls to the ID3_Tag::SetUnsync(), ID3_Tag::SetExtendedHeader() and ID3_Tag::SetPadding() and ID3_Tag::SetCompression() functions. + + +if ( myTag.HasChanged() ) +{ + // render and output the tag + ... +} + + + + + +This function has been removed from 3.05. ID3Lib will now always create tags using the latest version of the standard. + + + + +This call takes a single boolean parameter and tells the object whether you wish the resulting binary tag to be unsynchronised if unsync is required. If you call this function with 'false' as the parameter, the binary tag will not be unsync'ed, regardless of whether the tag should be. This option is useful when the file is only going to be used by ID3v2-compliant software. See the ID3v2 standard document for further details on unsync. +

+By default, tags are created without unsync. + + +myTag.SetUnsync ( false ); + + + + + +This function tells the tag whether to create an extended header when rendering the tag. This option is currently ignored as ID3Lib doesn't yet create extended headers. This option only applies when rendering tags for ID3v2 versions that support extended headers. +

+By default, ID3Lib will generate extended headers for all tags in which extended headers are supported. + + +myTag.SetExtendedHeader ( true ); + + + + + +Under ID3v2-3.0, there is support for the compression of data in tags. The current standard defines compression on a frame-by-frame basis using the zlib data compression standard. Using this call, you tell the object whether to attempt to compress frames or not. If a frame doesn't compress well, it will not be compressed, regardless of this setting. This function takes a single boolean parameter. By default, ID3Lib will attempt to compress all the frames in a tag. + + +myTag.SetCompression ( true ); + + +When creating tags for a version of ID3v2 in which compression isn't defined, the tags are simply rendered without compression to ensure compliance to the relevant version of the standard. + + + + +When using ID3v2 tags in association with files, ID3Lib can optionally add padding to the tags to ensure minimal file write times when updating the tag in the future. +

+When the padding option is switched on, ID3Lib automatically creates padding according the 'ID3v2 Programming Guidelines'. Specifically, enough padding will be added to round out the entire file (song plus tag) to an even multiple of 2K. Padding will only be created when the tag is attached to a file and that file is not empty (aside from a pre-existing tag). +

+My own addition to the guidelines for padding, and that which ID3Lib follows is that if frames are removed from a pre-existing tag (or the tag simply shrinks because of other reasons), the new tag will continue to stay the same size as the old tag (with padding making the difference of course) until such time as the padding is greater than 4K. When this happens, the padding will be reduced and the new tag will be smaller than the old. +

+By default, padding is switched on. +

+ +myTag.SetPadding ( false ); + + +An alternate form of the SetPadding() function has been removed from 3.05. + + +myTag.SetPadding ( true ); // switch padding on +myTag.SetPadding ( 1024 ); // add 1K of padding + + + + + + +This function has been removed from 3.05. + + + + +To attach a frame object (see later) to a tag object, you can use the ID3_Tag::AddFrame() function or the << operator. To use the ID3_Tag::AddFrame() function, simply supply as it's sole parameter a pointer to the ID3_Frame object you wish to attach. Even though the 'id3_tag.h' file says that ID3_Tag::AddFrame also takes a boolean parameter, this parameter is for internal use only do not use it. +

+ +ID3_Frame myFrame; +myTag.AddFrame ( &myFrame ); + + +Alternatively, use the << operator to attach a frame to a tag. The << operator supports the addition of a pointer to a frame object, or the frame object itself. + + +ID3_Frame *framePoint, frameObj; +myTag << framePoint; +myTag << frameObj; + + +Both these functions simply attach the frames to the tag the tag does not create it's own copy of the frame. Frames created by an application must exist until the frame is removed or the tag is finished with. + + + + +This function takes a pointer to an array of ID3_Frame objects and a number that specifies the number of objects in the array. ID3Lib will then go and add all the frames to the tag. Even though the 'id3_tag.h' file says that ID3_Tag::AddFrames also takes a boolean parameter, this parameter is for internal use only do not use it. + + +ID3_Frame myFrame[ 10 ]; +myTag.AddFrames ( myFrame, 10 ); + + + + + +If you wish to remove a frame from a tag, use this function. If you already own the frame object in question, then you should already have a pointer to the frame you want to delete. If not, or if you wish to delete a pre-existing frame (from a tag you have parsed, for example), then use one of the ID3_Tag::Find() functions to obtain a frame pointer to pass to this function. + + +ID3_Frame *someFrame; + +if ( ( someFrame = myTag.Find ( ID3FID_TITLE ) ) + myTag.RemoveFrame ( someFrame ); + + + + + +This function returns an over estimate of the number of bytes required to store a binary version of a tag. When using ID3_Tag::Render() to render a binary tag to a memory buffer, first use the result of this call to allocate a buffer of unsigned chars. + + +luint tagSize; +uchar *buffer; + +if ( myTag.HasChanged() ) +{ + if ( ( tagSize = myTag.Size() ) > 0 ) + { + if ( buffer = new uchar[ tagSize ] ) + { + luint actualSize; + + actualSize = myTag.Render ( buffer ); + + // do something useful with the first + // 'actualSize' bytes of the buffer, + // like push it down a socket + ... + + delete[] buffer; + } + } +} + + + + + +This renders a binary image of the tag into the supplied buffer. See ID3_Tag::Size() for an example. This function returns the actual number of the bytes of the buffer used to store the tag. This will be less that the size of the buffer itself, because ID3_Tag::Size() over estimates the required buffer size. +

+Before calling this function, it is advisable to call ID3_Tag::HasChanged() first as this will let you know whether you should bother rendering the tag. + + + + +This function isn't a member of the ID3_Tag class, but is presented here because it is used before the actual ID3_Tag::Parse() function when parsing a tag from a memory buffer. +

+When you are scanning a stream for a tag, you should pass ID3_TAGHEADERSIZE bytes of unsigned chars into this function and it will return the number of extra bytes to read in order to obtain the rest of the tag. If the supplied ID3_TAGHEADERSIZE bytes don't constitute a valid ID3v2 tag header, this function will return 1. +

+Use this function only if you are using ID3_Tag::Parse()/Render() instead of ID3_Tag::Link()/Update(). + + +uchar buffer[ ID3_TAGHEADERSIZE ]; + +// get ID3_TAGHEADERSIZE bytes from a socket or somewhere +... + +luint tagSize; + +if ( ( tagSize = ID3_IsTagHeader ( buffer ) ) > -1 ) +{ + // read a further 'tagSize' bytes in + // from our data source + ... + + // now we will call ID3_Tag::Parse() + // with these values (explained later) + ... +} + + + + + + +This will turn a binary tag into a series of ID3_Frame objects attached to the specified tag. This function takes two parameters, the first is the ID3_TAGHEADERSIZE byte header you read in from your data source. The second is a pointer to an unsigned char buffer which is the rest of the tag (not including the header) you read from the data source. + + +ID3_Tag myTag; +uchar header[ ID3_TAGHEADERSIZE ]; +uchar *buffer; +luint tagSize; + +// get ID3_TAGHEADERSIZE from a socket or somewhere +... + +if ( ( tagSize = ID3_IsTagHeader ( ourSourceBuffer ) ) > -1 ) +{ + // read a further 'tagSize' bytes in + // from our data source + ... + + if ( buffer = new uchar[ tagSize ] ) + { + // now we will call ID3_Tag::Parse() + // with these values (explained later) + myTag.Parse ( header, buffer ); + + // do something with the objects, + // like look for titles, artists etc + ... + + // free the buffer + delete[] buffer; + } +} + + + + + +If you created your ID3_Tag object without supplying a parameter to the constructor (maybe you create an array of ID3_Tag pointers), you can use this function to attach the tag to a file. This is the preferred method of interacting with files, since ID3Lib can automatically do things like parse foreign tag formats and handle padding when linked to a file. When a tag is linked to a file, you do not need to use the ::Size(), ::Render(), ::Parse() or ID3_IsTagHeader() functions ID3Lib will take care of all that stuff for you. The single parameter is a pointer to a file name. +

+Link() returns a 'luint' which is the byte position within the file that the audio starts (ie. where the ID3v2 tag ends). + + +ID3_Tag *myTag; + +if ( myTag = new ID3_Tag ) +{ + myTag->Link ( "mysong.mp3" ); + + // do whatever we want with the tag + ... + + // setup all our rendering parameters + myTag->SetUnsync ( false ); + myTag->SetExtendedHeader ( true ); + myTag->SetCompression ( true ); + myTag->SetPadding ( true ); + + // write any changes to the file + myTag->Update(); + + // free the tag + delete myTag; +} + + + + + + +This little function takes no parameters, returns no results and simply renders the tag and writes it to the file to which this tag is attached. Make sure you setup your rendering parameters (including version number) before calling this function. See ID3_Tag::Link() for an example of this function. + + + + +This function takes no parameters and returns no results. When attached to a file, this function will strip any ID3v2 tag from the file. If you supply a 'true' boolean parameter then this tells the tag to strip any ID3v1/1.1 and Lyrics3 v2.0 tags from the file as well. + +myTag.Strip() +myTag.Strip ( true ); + + + + + +This function takes a required ID3_FrameID parameter that specifies the ID of the frame you wish to locate. If present in the tag, the first such frame will be returned as a pointer to an ID3_Frame object. If no frame is found, this returns NULL. If there are multiple frames in the tag with the same ID (which, for some frames, is allowed), then subsequent calls to ::Find() will return subsequent frame pointers, until it wraps around again. + + +ID3_Frame *myFrame; + +if ( myFrame = myTag.Find ( ID3FID_TITLE ) ) +{ + // do something with the frame, like copy + // the contents into a buffer, display the + // contents in a window etc + ... +} + + +You may optionally supply two more parameters to this function, being an ID3_FieldID and a value of some sort. Depending on the field name/ID you supply, you may supply an integer, a char * or a wchar_t * as the third parameter. If you supply an ID3_FrameID, you must also supply a data value to compare with. +

+This function will then return the first frame that has a matching frame ID, and which has a field with the same name as that which you supplied in the second parameter, whose value matches that which you supplied as the third parameter. For example: + + +ID3_Frame *myFrame; + +if ( myFrame = myTag.Find ( ID3FID_TITLE, ID3FN_TEXT, "Nirvana" ) ) +{ + // found it, do something with it + ... +} + + +This example with return the first frame that is a TITLE frame and whose TEXT field is 'Nirvana'. I emphasis 'is' because currently there is no provision for things like 'contains', 'greater than' or 'less than'. If there happens to be more than one of these frames, subsequent calls to the ::Find() function will return subsequent frames and will wrap around to the beginning. +

+Another example: + + +ID3_Frame *myFrame; + +if ( myFrame = myTag.Find ( ID3FID_COMMENT, ID3FN_TEXTENC, (luint) ID3TE_UNICODE ) ) +{ + // do something + ... +} + + +This returns the first COMMENT frame that uses Unicode as it's text encoding. + + + + +This returns the number of frames present in the tag object. This includes only those frames that ID3Lib recognises. This is used as the upper bound on calls to the ID3_Tag::GetFrame() and operator[] functions. + + + + +In 3.04 and earlier, this function was called ::GetFrame(). +

+These return pointers to the given frame number, or NULL if the specified frame number doesn't exist. Numbering starts at 0 (that is, the first frame is number 0, and the last frame in a tag that holds 34 frames is 33). +

+If you wish to have a more complex searching facility, then at least for now, you will have to devise it yourself and implement it using these functions. + + + + + + + +ID3Lib defines frames in a funny way. Using some nice C++ conventions, ID3_Frame class objects appear to be quite polymorphic, that is, they can take on many forms. The same ID3_Frame class provides the facilities for the implementation of a complex APIC frame and for a simple text frame. Here's how to use an ID3_Frame object: +

+ + +The optional parameter to the ID3_Frame constructor is of the type ID3_FrameID, which will internally set the frame's structure. See ID3_Frame::SetID() for more details. + + + + +Like it's ID3_Tag counterpart, ID3_Frame::Clear() takes no parameters and returns nothing. It just clears the frame of all data and resets the frame such that it can take on the form of any ID3v2 frame that ID3Lib supports. + + + + + +This function sets up the internal structure of an ID3_Frame object so that it represents any ID3v2 frame that ID3Lib supports. Given an ID3_FrameID (a list of which is found in 'id3_field.h'), ::SetID() will structure the object according to the frame you wish to implement. +

+Either using this call or via the constructor, this must be the first command performed on an ID3_Frame object. + +myFrame.SetID ( ID3FID_TITLE ); + + + + + +Useful in conjunction with the ID3_Tag::GetFrame() function, this function returns the type of frame that the object represents, just so you know what to expect. + + + + +This is a go-between function that returns a pointer to one of the frame's internal fields. A list of fields that are in given frames appears in 'id3_field.cpp'. This function returns a reference to the field in question, so that the result can be used as though it were a field itself: + + +ID3_TextEnc enc; +enc = (ID3_TextEnc) myFrame.Field ( ID3FN_TEXTENC ).Get(); + + +As far as frames go, that's all there is. The next step is to find out how to manipulate the fields contained in the frames. + + + + + +As a general rule, you need never create an object of this type. ID3Lib uses them internally as part of the ID3_Frame class. You must know how to interact with these objects though, and that's what this section is about. +

+The ID3_Field contains many overloaded functions to provide these facilities for four different data types. +

+As a general implementation note, you should be prepared to support all fields in an ID3Lib frame, even if all fields in the ID3Lib version of the frame aren't present in the ID3v2 version. This is because of frames like the picture frame, which changed slightly from one version of the ID3v2 standard to the next (the IMAGEFORMAT field in 2.0 changed to a MIMETYPE in 3.0). If you support all ID3Lib fields in a given frame, ID3Lib can generate the correct ID3v2 frame for the ID3v2 version you wish to support. Alternatively, just support the fields you know will be used in, say, 3.0 if you only plan to generate 3.0 tags. +

+ + +Regardless of the type of field, this function will clear any data and free any memory associated with the field. This function takes no parameters and returns no results. + + + + +This function returns the size of a field. +

+The value returned is dependent on the type of the field. For ASCII strings, this returns the number of characters in the field, not including any NULL-terminator. The same holds true for Unicode it returns the number of characters in the field, not bytes and this does not include the Unicode BOM, which isn't put in a Unicode string obtained by the ::Get() function anyway. For binary and integer fields, this returns the number of bytes in the field. + + +luint howBig; +howBig = myFrame.Field ( ID3FN_DATA ).Size(); + + + + + +This next bit talks about the ID3_Field class as it relates to integers only. +

+ + +This function takes a single parameter that is an integer. It sets the value of this field to the specified integer. + + +myFrame.Field ( ID3FN_PICTURETYPE ).Set ( 0x0B ); +ID3_Field::Get() + + +Taking no parameters, this function returns the value of the integer field. + + +luint picType; +picType = myFrame.Field ( ID3FN_PICTURETYPE ).Get(); + + + + + + +This functions as you would expect. + + +myFrame.Field ( ID3FN_PICTURETYPE ) = 0x0B; + + + + + + + + +In 3.04 and earlier, this function was called ::GetNumItems(). +

+This function returns the number of items in a text list. The numbering of items in the list begins at one (1). + +luint numItems; +numItems = myFrame.Field ( ID3FN_TEXT ).GetNumItems(); + + + + + + +This next bit talks about ID3_Field objects in reference to ASCII strings. +

+ + +This function takes a single parameter that is a pointer to an ASCII string. It copies the supplied string (as opposed to simply keeping a pointer to it), so you may dispose of the source string after a call to this function. + + +myFrame.Field ( ID3FN_TEXT ).Set ( "ID3Lib is very cool!" ); + + + + + +This functions much as you would expect; + + +myFrame.Field ( ID3FN_TEXT ) = "ID3Lib is very cool!"; + + +Like ID3_Field::Set(), this function copies the supplied string. + + + + +This adds a string to the list of strings currently in the field. This useful for using ID3v2 frames such as the involved people list, composer and part of set. You can use the ID3_Field::GetNumItems() to find out how many such items are in a list. + + +myFrame.Field ( ID3FN_TEXT ).Add ( "this is a test" ); + + + + + +This takes a pointer to a char buffer and an integer that says how big (in characters) the supplied buffer is. Optionally as the third parameter is the item number you wish to retrieve. This is useful when using text lists (see ID3_Field::Add() for more details). The default value for this third parameter is 1, which returns the entire string if the field contains only one item. +

+It returns the number of characters (not bytes necessarily, and not including any NULL terminator) of the supplied buffer that are now used. + + +char myBuffer[ 1024 ]; +luint charsUsed; + +charUsed = myFrame.Field ( ID3FN_TEXT ).Get ( buffer, 1024 ); + + +It fills the buffer with as much data from the field as is present in the field, or as large as the buffer, whichever is smaller. + + +char myBuffer[ 1024 ]; +luint charsUsed; + +charUsed = myFrame.Field ( ID3FN_TEXT ).Get ( buffer, 1024, 3 ); + + +This fills the buffer with up to the first 1024 characters from the third element of the text list. + + + + + + + +Without elaborating, the Unicode functions behave exactly as it's ASCII counterparts, taking wchar_t pointers in place of char pointers. The ::Get() function still takes a max size in characters (not bytes). + + +wchar_t buffer[ 1024 ]; +char charsUsed; + +charsUsed = myFrame.Field ( ID3FN_TEXT ).Get ( buffer, 1024 ); + + +All strings in ID3Lib are handled internally as Unicode. This means that when you set a field with an ASCII source type, it will be converted and stored internally as a Unicode string. ID3Lib will handle all necessary conversions when parsing, rendering and ::Get()ing. If you set a field as an ASCII string, then try to read the string into a wchar_t buffer, ID3Lib will automatically convert the string into Unicode so this will function as expected. The same holds true in reverse. +

+Of course, when converting from Unicode to ASCII, you will experience problems when the Unicode string contains characters that don't map to ISO-8859-1. + + + + +The last type field that ID3Lib provides support for is a binary field. This holds miscellaneous data that can't be easily described any other way, such a JPEG image. +

+ + +This takes a pointer to an unsigned char buffer and an integer that specifies how big the data is in bytes. Again, like the string types, the binary ::Set() function copies the data so you may dispose of the source data after a call to this function. + + +uchar myBuffer[ 1024 ]; +myFrame.Field ( ID3FN_DATA ).Set ( myBuffer, 1024 ); + + + + + +This takes the same parameters as the ::Set function. It copies the data in the field into the buffer, for as many bytes as the field contains, or the size of buffer, whichever is smaller. + + +uchar buffer[ 1024 ]; +myFrame.Field ( ID3FN_DATA ).Get ( buffer, sizeof ( buffer ) ); + + + + + +Taking a single char pointer as a parameter, this function takes the data in the specified file and stores it in the field. The file may be deleted after a call to this function as the source data is copied into the field. + + +myFrame.Field ( ID3FN_DATA ).FromFile ( "mypic.jpg" ); + + + + + +The exact reverse of ::FromFile(), this function copies the data in the field to the specified file. + + +myFrame.Field ( ID3FN_DATA ).ToFile ( "output.bin" ); + + + + + + + + +When ID3Lib encounters a nasty error, it throws an exception of type ID3_Error. A function that calls an ID3Lib routine can place the call in a try block and provide an appropriate catch block. + + +try +{ + // call some ID3Lib routine + ID3_Tag myTag ( "mySong.mp3" ); + ID3_Frame *myFrame = NULL; + + // this will generate an exception + myTag << myFrame; +} + +catch ( ID3_Error err ) +{ + // handle the error + ... +} + + +Let's have a look at the error handling functions provided by the ID3_Error class. +

+ + +This function takes no parameters but returns an ID3_Err value, which represents the ID of the error that caused the exception. + + + + + +Again, this function takes no parameters but returns a character pointer that is an English string that describes the error. + + + + +This function returns a pointer to a string of characters that is the name of the ID3Lib source file that generated the exception. When submitting bug reports, it is useful to include this. + + +cout << "Exception in file '" << err.GetErrorFile() << "'" << endl; + + + + + +This function returns the line number in the ID3Lib source file that threw the exception. + + +cout << "Line # " << err.GetErrorLine() << endl; + + + + + + + +Version 3.05 of ID3Lib has some known limitations: +

+ +

  • Firstly, contrary to good programming ideas and contrary to the 'ID3v2 Programming Guidelines', ID3Lib will explode in a ball of brilliant blue frame if asked to parse an invalid ID3v2 tag. This will change. +
  • Incorrect handling of unknown frames. This means that when ID3Lib encounters an unknown frame, it is currently ignored. It is neither re-written to the tag when re-rendered nor are the file or tag alter frame flags observed. +
  • No support for the read-only frame flag. It is currently ignored such frames can be altered at will. +
  • No support as yet for the verification of frames before rendering. +
  • Does not yet render 3.0 extended headers, although the function to select this is present but the setting is ignored for now. +
  • Does not yet parse 3.0 extended headers. They are quite adequately ignored and the rest of the tag is parsed correctly. +
  • ID3Lib currently has no direct support for things like the language and currency fields. It is up to the application to generate the data for these fields manually. Soon, ID3Lib will have these things assigned to IDs so that the applications programmer will not have to remember the ISO tables for the actual strings. + + + + + + +ID3Lib defines some preprocessor symbols that applications are free to use. They are used to identify the version and date of the ID3Lib that is currently being used. All these definitions are strings, defined in 'id3_version.h'. + + +ID3LIB_NAME defines the name of ID3Lib +ID3LIB_VERSION defines which version of ID3Lib is being used (string) +ID3LIB_VER defines which version of ID3Lib is being used (int) +ID3LIB_REV defines which revision of ID3Lib is being used (int) +ID3LIB_DATE the date which this version of ID3Lib was released +ID3LIB_VERSTRING an amalgamation of most of the above + + +For example: + + +cout << "Using " << ID3LIB_VERSTRING << endl; + + + + + + + +lsint ID3_IsTagHeader ( uchar header[ ID3_TAGHEADERSIZE ] ); + + ID3_Tag ( char *fileName = NULL ); +void Clear ( void ); +bool HasChanged ( void ); +void SetUnsync ( bool newSync ); +void SetExtendedHeader ( bool ext ); +void SetCompression ( bool comp ); +void SetPadding ( bool pad ); +void SetPadding ( luint fixedPaddingSize ); +void AddFrame ( ID3_Frame *newFrame ); +void AddFrames +( ID3_Frame *newFrames, luint numFrames, bool +freeWhenDone = false ); + +void RemoveFrame ( ID3_Frame *oldFrame ); +luint Size ( void ); +luint Render ( uchar *buffer ); +void Parse +( uchar header[ ID3_TAGHEADERSIZE ], uchar *buffer ); + +luint Link ( char *name ); +void Update ( void ); +void Strip ( bool v1Also = true ); +ID3_Frame *Find ( ID3_FrameID id ); +ID3_Frame *Find +( ID3_FrameID id, ID3_FieldID fld, luint data ); + +ID3_Frame *Find + ( ID3_FrameID id, ID3_FieldID fld, char *data ); + +ID3_Frame *Find + ( ID3_FrameID id, ID3_FieldID fld, wchar_t *data ); + +luint NumFrames ( void ); +ID3_Frame *GetFrameNum ( luint num ); +ID3_Frame *operator[] ( luint num ); + + + + + + + +ID3_Frame ( ID3_FrameID id = ID3FID_NOFRAME ); + +void Clear ( void ); + +void SetID ( ID3_FrameID id ); +ID3_FrameID GetID ( void ); + +ID3_Field& Field ( ID3_FieldID name ); + + + + + + +void Clear ( void ); +luint Size ( void ); +luint GetNumTextItems ( void ); + +// integer field functions +ID3_Field& operator= ( luint newData ); +void Set ( luint newData ); +luint Get ( void ); + +// Unicode string field functions +ID3_Field& operator= ( wchar_t *string ); +void Set ( wchar_t *string ); +luint Get +( wchar_t *buffer, luint maxChars, luint itemNum = 1 ); + +void Add ( wchar_t *string ); + +// ASCII string field functions +ID3_Field& operator= ( char *string ); +void Set ( char *string ); +luint Get +( wchar_t *buffer, luint maxChars, luint itemNum = 1 ); + +void Add ( char *string ); + +// binary field functions +void Set ( uchar *newData, luint newSize ); +void Get ( uchar *buffer, luint buffLength ); +void FromFile ( char *fileName ); +void ToFile ( char *fileName ); + + + + + + +ID3_Err GetErrorID ( void ); +char *GetErrorDesc ( void ); +char *GetErrorFile ( void ); +luint GetErrorLine ( void ); + + + + + + +void ID3_GetVersionInfo ( ID3_VerInfo *info ); + +lsint ID3_IsTagHeader ( uchar header[ ID3_TAGHEADERSIZE ] ); + +ID3_Tag *ID3Tag_New ( void ); +void ID3Tag_Delete ( ID3_Tag *tag ); +void ID3Tag_Clear ( ID3_Tag *tag ); +bool ID3Tag_HasChanged ( ID3_Tag *tag ); +void ID3Tag_SetUnsync ( ID3_Tag *tag, bool unsync ); +void ID3Tag_SetExtendedHeader +( ID3_Tag *tag, bool ext ); + +void ID3Tag_SetCompression +( ID3_Tag *tag, bool comp ); + +void ID3Tag_SetPadding ( ID3_Tag *tag, bool pad ); +void ID3Tag_AddFrame ( ID3_Tag *tag, ID3_Frame *frame ); +void ID3Tag_AddFrames +( ID3_Tag *tag, ID3_Frame *frames, luint num ); + +void ID3Tag_RemoveFrame ( ID3_Tag *tag, ID3_Frame *frame ); +void ID3Tag_Parse +( ID3_Tag *tag, uchar header[ ID3_TAGHEADERSIZE ], +uchar *buffer ); + +luint ID3Tag_Link ( ID3_Tag *tag, char *fileName ); +void ID3Tag_Update ( ID3_Tag *tag ); +void ID3Tag_Strip ( ID3_Tag *tag, bool v1Also ); +ID3_Frame *ID3Tag_FindFrameWithID + ( ID3_Tag *tag, ID3_FrameID id ); + +ID3_Frame *ID3Tag_FindFrameWithINT +( ID3_Tag *tag, ID3_FrameID id, ID3_FieldID fld, +luint data ); + +ID3_Frame *ID3Tag_FindFrameWithASCII +( ID3_Tag *tag, ID3_FrameID id, ID3_FieldID fld, +char *data ); + +ID3_Frame *ID3Tag_FindFrameWithUNICODE +( ID3_Tag *tag, ID3_FrameID id, ID3_FieldID fld, +wchar_t *data ); + +luint ID3Tag_NumFrames ( ID3_Tag *tag ); +ID3_Frame *ID3Tag_GetFrameNum ( ID3_Tag *tag, luint num ); + +void ID3Frame_Clear ( ID3_Frame *frame ); +void ID3Frame_SetID ( ID3_Frame *frame, ID3_FrameID id ); +ID3_FrameID ID3Frame_GetID ( ID3_Frame *frame ); +ID3_Field *ID3Frame_GetField ( ID3_Frame *frame, ID3_FieldID name ); + +void ID3Field_Clear ( ID3_Field *field ); +luint ID3Field_Size ( ID3_Field *field ); +luint ID3Field_GetNumTextItems + ( ID3_Field *field ); +void ID3Field_SetINT ( ID3_Field *field, luint data ); +luint ID3Field_GetINT ( ID3_Field *field ); +void ID3Field_SetUNICODE ( ID3_Field *field, wchar_t *string ); +luint ID3Field_GetUNICODE +( ID3_Field *field, wchar_t *buffer, luint maxChars, +luint itemNum ); + +void ID3Field_AddUNICODE ( ID3_Field *field, wchar_t *string ); + +void ID3Field_SetASCII ( ID3_Field *field, char *string ); +luint ID3Field_GetASCII ( ID3_Field *field, char *buffer, +luint maxChars, luint itemNum ); + +void ID3Field_AddASCII ( ID3_Field *field, char *string ); +void ID3Field_SetBINARY + ( ID3_Field *field, uchar *data, luint size ); + +void ID3Field_GetBINARY +( ID3_Field *field, uchar *buffer, luint buffLength ); + +void ID3Field_FromFile ( ID3_Field *field, char *fileName ); +void ID3Field_ToFile ( ID3_Field *field, char *fileName ); + + + + + + +I can be contacted by e-mail at dirk@id3.org or on ICQ UIN 808 7113. +

    +The ID3Lib mailing list is a general ID3Lib announcements list. To subscribe to it, send an e-mail message to dirk@id3.org with ID3LibSub as the subject and the automatic newsletter software will add you to the list. Same again but with ID3LibUnsub as the subject will remove you from the list. +

    +When you subscribe, please include a brief message about why you are subscribing. If you are writing software, tell me what you are writing and what platforms you will support. If ID3Lib is lacking in a certain area, I can look to see who is doing what and can ask for advice and ideas from the appropriate people. + + + + +I would like to extend my many thanks to the people who have contributed to the ID3Lib project. The show of support has been tremendous. I consider ID3Lib to be a very 'international' product, as contributions have come from almost literally every corner of the globe. If I have missed you, please forgive my lapse of memory. + +

      +
    • Jean-loup Gailly and Mark Adler for their great zlib compression library and for making it free. +
    • Tord Jansson for much help with teaching me how to make and use DLLs. +
    • Slava Karpenko for creating the MacOS static link libraries for the PowerPC and CodeWarrior. +
    • Bob Kohn for his advice, input and generally creating the ID3Lib licence agreement. +
    • Eng-Keong Lee for finding a few bugs and for extensively testing ID3Lib 2.xx. +
    • James Lin for his 'ID3v2 Programming Guidelines', and many helpful suggestions. +
    • Michael Mutschler for prompting me to write the Unicode support and for his input on the ID3Lib calling convention. +
    • Martin Nilsson for ID3v2, his support of the ID3Lib web page, for many, many suggestions, debates, pointers, URLs, documents and brightly coloured fish. +
    • Chris Nunn for the 3D animated ID3v2 logos which appear in the ID3Lib web page and in the distribution. +
    • Lachlan Pitts for general implementation ideas and his brief but helpful work on the up-coming genre tree. +
    • Jukka Poikolainen for prompting to implement error handling via the C++ exception handling mechanism instead of the old 2.xx-style of using an error handling function. Also for compiling the Borland static link libraries and greatly helping with the DLL. +
    • Carlos Puchol for his help with some minor Linux compilation hassles. +
    • Andreas Sigfridsson for his initial code for the unsync/resync support and for his very valuable input in long brainstorming sessions. +
    • Michael Robertson for helping support ID3Lib by posting announcements on MP3.com. +
    • Ilana Rudnik for bug finding and suggestions. +
    • Chuck Zenkus for his support of ID3v2 and ID3Lib by providing us with a mirror in the United States and for his bug finding and suggestions. +
    +

    +And last but by no means least, all the others who support ID3Lib by subscribing to the mailing list and to the contributors to the discussions and debates in the ID3v2 discussion group. +

    +Without the help of all these people, ID3Lib would not be as good as it is, and I dare say might not even exist if they all weren't around to provide motivation to continue to write the thing! +

    +- Dirk Mahoney
    +22 November 1998
    +Brisbane, Australia + + + + + + + + diff --git a/id3lib/doc/id3lib.css b/id3lib/doc/id3lib.css new file mode 100644 index 0000000..56a0d72 --- /dev/null +++ b/id3lib/doc/id3lib.css @@ -0,0 +1,28 @@ +/** $Id: id3lib.css,v 1.2 2008/05/14 09:21:35 pindakaasmod Exp $ + **/ + +body, p, h2, b, a, ol, ul {font-family: Arial, Helvetica, sans-serif;} +body { background-color: white; } +pre {font-family: monospace; font-size: small;} +h1 { text-align: center; font-size: x-large; } +h2 { font-size: large; font-weight: bold; } +h3 { font-size: large; } +a {color: #DD6600; text-decoration: none;} +A.qindex {} +A.qindexRef {} +A.el { text-decoration: none; font-weight: bold; } +A.elRef { font-weight: bold; } +A.code { text-decoration: none; font-weight: normal; /*color: #4444ee;*/ } +A.codeRef { font-weight: normal; color: #4444ee; } +DL.el { margin-left: -1cm; } +DIV.fragment { width: 100%; border: none; background-color: #eeeeee; } +DIV.in { margin-left: 16; } +DIV.ah { background-color: black; margin-bottom: 3; margin-top: 3; } +TD.md { background-color: #f2f2ff; } +DIV.groupHeader { margin-left: 16; margin-top: 12; margin-bottom: 6; font-weight: bold; } +DIV.groupText { margin-left: 16; font-style: italic; font-size: smaller; } +td.h1 {font: 43px Arial, Helvetica;} +td.h2 {font: 27px Arial, Helvetica;} +div.h5 {font: 14px Arial, Helvetica;} +td {font: 14px Arial, Helvetica;} +b {font-weight: bold;} diff --git a/id3lib/doc/id3v2.3.0.html b/id3lib/doc/id3v2.3.0.html new file mode 100644 index 0000000..af15f3c --- /dev/null +++ b/id3lib/doc/id3v2.3.0.html @@ -0,0 +1,2257 @@ +ID3v2 - Informal standard + + + + + + + +
      +

    Informal standard
    Document: id3v2.3.0.html
    +M. Nilsson
    3rd February 1999

    + +

    ID3 tag version 2.3.0

    + + +

    Status of this document

    +

    +This document is an informal standard and replaces the ID3v2.2.0 +standard. The informal standard is released so that +implementors could have a set standard before a formal standard is +set. The formal standard will use another version or revision number +if not identical to what is described in this document. The contents +in this document may change for clarifications but never for added or +altered functionallity. +

    +Distribution of this document is unlimited. +

    + + +

    Abstract

    +

    +This document describes the ID3v2.3.0, which is a more developed +version of the ID3v2 informal standard (version 2.2.0), +evolved from the ID3 tagging system. The ID3v2 offers a flexible way +of storing information about an audio file within itself to determine +its origin and contents. The information may be technical +information, such as equalisation curves, as well as related meta +information, such as title, performer, copyright etc. +

    + + +

    1.Table of contents

    + +

    +
    +
    2. Conventions in this document
    +
    3. ID3v2 overview +
    3.1. ID3v2 header
    +
    3.2. ID3v2 extended header
    +
    3.3. ID3v2 frames overview
    +
    3.3.1. Frame header flags
    +
    3.3.2. Default flags
    +
    4. Declared ID3v2 frames +
    4.1. Unique file identifier
    +
    4.2. Text information frames +
    4.2.1. Text information frames - details
    +
    4.2.2. User defined text information frame
    +
    4.3. URL link frames +
    4.3.1. URL link frames - details
    +
    4.3.2. User defined URL link frame
    +
    4.4. Involved people list
    +
    4.5. Music CD Identifier
    +
    4.6. Event timing codes
    +
    4.7. MPEG location lookup table
    +
    4.8. Synced tempo codes
    +
    4.9. Unsychronised lyrics/text transcription
    +
    4.10. Synchronised lyrics/text
    +
    4.11. Comments
    +
    4.12. Relative volume adjustment
    +
    4.13. Equalisation
    +
    4.14. Reverb
    +
    4.15. Attached picture
    +
    4.16. General encapsulated object
    +
    4.17. Play counter
    +
    4.18. Popularimeter
    +
    4.19. Recommended buffer size
    +
    4.20. Audio encryption
    +
    4.21. Linked information
    +
    4.22. Position synchronisation frame
    +
    4.23. Terms of use
    +
    4.24. Ownership frame
    +
    4.25. Commercial frame
    +
    4.26. Encryption method registration
    +
    4.27. Group identification registration
    +
    4.28. Private frame
    +
    5. The 'unsynchronisation scheme'
    +
    6. Copyright
    +
    7. References
    +
    8. Appendix +
    A. Appendix A - Genre List from ID3v1
    +
    9. Author's Address
    +
    +

    + + +

    2.Conventions in this document

    +

    +In the examples, text within "" is a text string exactly as it +appears in a file. Numbers preceded with $ are hexadecimal and +numbers preceded with % are binary. $xx is used to indicate a byte +with unknown content. %x is used to indicate a bit with unknown +content. The most significant bit (MSB) of a byte is called 'bit 7' +and the least significant bit (LSB) is called 'bit 0'. +

    +A tag is the whole tag described in this document. A frame is a block +of information in the tag. The tag consists of a header, frames and +optional padding. A field is a piece of information; one value, a +string etc. A numeric string is a string that consists of the +characters 0-9 only. +

    + + +

    3.ID3v2 overview

    +

    +The two biggest design goals were to be able to implement ID3v2 +without disturbing old software too much and that ID3v2 should be +as flexible and expandable as possible. +

    +The first criterion is met by the simple fact that the MPEG +decoding software uses a syncsignal, embedded in the audiostream, to +'lock on to' the audio. Since the ID3v2 tag doesn't contain a valid +syncsignal, no software will attempt to play the tag. If, for any +reason, coincidence make a syncsignal appear within the tag it will +be taken care of by the 'unsynchronisation scheme' described in +section 5. +

    +The second criterion has made a more noticeable impact on the design +of the ID3v2 tag. It is constructed as a container for several +information blocks, called frames, whose format need not be known to +the software that encounters them. At the start of every frame there +is an identifier that explains the frames' format and content, and a +size descriptor that allows software to skip unknown frames. +

    +If a total revision of the ID3v2 tag should be needed, there is a +version number and a size descriptor in the ID3v2 header. +

    +The ID3 tag described in this document is mainly targeted at files +encoded with MPEG-1/2 layer I, MPEG-1/2 layer II, MPEG-1/2 layer III +and MPEG-2.5, but may work with other types of encoded audio. +

    +The bitorder in ID3v2 is most significant bit first (MSB). The +byteorder in multibyte numbers is most significant byte first (e.g. +$12345678 would be encoded $12 34 56 78). +

    +It is permitted to include padding after all the final frame (at the +end of the ID3 tag), making the size of all the frames together +smaller than the size given in the head of the tag. A possible +purpose of this padding is to allow for adding a few additional +frames or enlarge existing frames within the tag without having to +rewrite the entire file. The value of the padding bytes must be $00. +

    + + +

    3.1.ID3v2 header

    +

    +The ID3v2 tag header, which should be the first information in the +file, is 10 bytes as follows: +

    +

    + + + + +
    ID3v2/file identifier "ID3"
    ID3v2 version$03 00
    ID3v2 flags%abc00000
    ID3v2 size4 * %0xxxxxxx

    +

    +The first three bytes of the tag are always "ID3" to indicate that +this is an ID3v2 tag, directly followed by the two version bytes. The +first byte of ID3v2 version is it's major version, while the second +byte is its revision number. In this case this is ID3v2.3.0. All +revisions are backwards compatible while major versions are not. If +software with ID3v2.2.0 and below support should encounter version +three or higher it should simply ignore the whole tag. Version and +revision will never be $FF. +

    +The version is followed by one the ID3v2 flags field, of which +currently only three flags are used. +

    +

    +a - Unsynchronisation +

    +Bit 7 in the 'ID3v2 flags' indicates whether or not unsynchronisation is used (see section 5 for details); a set bit indicates usage.

    +

    +b - Extended header +

    + The second bit (bit 6) indicates whether or not the header is + followed by an extended header. The extended header is described in + section 3.2. +

    +

    +c - Experimental indicator +

    + The third bit (bit 5) should be used as an 'experimental + indicator'. This flag should always be set when the tag is in an + experimental stage. +

    +All the other flags should be cleared. If one of these undefined +flags are set that might mean that the tag is not readable for a +parser that does not know the flags function. +

    +The ID3v2 tag size is encoded with four bytes where the most +significant bit (bit 7) is set to zero in every byte, making a total +of 28 bits. The zeroed bits are ignored, so a 257 bytes long tag is +represented as $00 00 02 01. +

    +The ID3v2 tag size is the size of the complete tag after +unsychronisation, including padding, excluding the header but not +excluding the extended header (total tag size - 10). Only 28 bits +(representing up to 256MB) are used in the size description to avoid +the introducuction of 'false syncsignals'. +

    +An ID3v2 tag can be detected with the following pattern:
    + $49 44 33 yy yy xx zz zz zz zz
    +Where yy is less than $FF, xx is the 'flags' byte and zz is less than +$80. +

    + + +

    3.2.ID3v2 extended header

    +

    +The extended header contains information that is not vital to the +correct parsing of the tag information, hence the extended header is +optional. +

    +

    + + + +
    Extended header size $xx xx xx xx
    Extended Flags$xx xx
    Size of padding$xx xx xx xx

    +

    +Where the 'Extended header size', currently 6 or 10 bytes, excludes +itself. The 'Size of padding' is simply the total tag size excluding +the frames and the headers, in other words the padding. The extended +header is considered separate from the header proper, and as such is +subject to unsynchronisation. +

    +The extended flags are a secondary flag set which describes further +attributes of the tag. These attributes are currently defined as +follows +

    + %x0000000 00000000 +

    +

    +x - CRC data present +

    + If this flag is set four bytes of CRC-32 data is appended to the + extended header. The CRC should be calculated before + unsynchronisation on the data between the extended header and the + padding, i.e. the frames and only the frames. +

    +

    + +
    Total frame CRC $xx xx xx xx

    + + + +

    3.3.ID3v2 frame overview

    +

    +As the tag consists of a tag header and a tag body with one or more +frames, all the frames consists of a frame header followed by one or +more fields containing the actual information. The layout of the +frame header: +

    +

    + + + +
    Frame ID $xx xx xx xx (four characters)
    Size$xx xx xx xx
    Flags$xx xx

    +

    +The frame ID made out of the characters capital A-Z and 0-9. +Identifiers beginning with "X", "Y" and "Z" are for experimental use +and free for everyone to use, without the need to set the +experimental bit in the tag header. Have in mind that someone else +might have used the same identifier as you. All other identifiers are +either used or reserved for future use. +

    +The frame ID is followed by a size descriptor, making a total header +size of ten bytes in every frame. The size is calculated as frame +size excluding frame header (frame size - 10). +

    +In the frame header the size descriptor is followed by two flags +bytes. These flags are described in section 3.3.1. +

    +There is no fixed order of the frames' appearance in the tag, +although it is desired that the frames are arranged in order of +significance concerning the recognition of the file. An example of +such order: UFID, TIT2, MCDI, TRCK ... +

    +A tag must contain at least one frame. A frame must be at least 1 +byte big, excluding the header. +

    +If nothing else is said a string is represented as +ISO-8859-1 characters in the range $20 - $FF. Such strings are +represented as <text string>, or <full text string> if newlines are +allowed, in the frame descriptions. All Unicode strings use +16-bit unicode 2.0 (ISO/IEC 10646-1:1993, UCS-2). Unicode strings +must begin with the Unicode BOM ($FF FE or $FE FF) to identify the +byte order. +

    +All numeric strings and URLs are always encoded as ISO-8859-1. +Terminated strings are terminated with $00 if encoded with ISO-8859-1 +and $00 00 if encoded as unicode. If nothing else is said newline +character is forbidden. In ISO-8859-1 a new line is represented, when +allowed, with $0A only. Frames that allow different types of text +encoding have a text encoding description byte directly after the +frame size. If ISO-8859-1 is used this byte should be $00, if Unicode +is used it should be $01. Strings dependent on encoding is +represented as <text string according to encoding>, or <full text +string according to encoding> if newlines are allowed. Any empty +Unicode strings which are NULL-terminated may have the Unicode BOM +followed by a Unicode NULL ($FF FE 00 00 or $FE FF 00 00). +

    +The three byte language field is used to describe the language of the +frame's content, according to ISO-639-2. +

    +All URLs may be relative, e.g. "picture.png", "../doc.txt". +

    +If a frame is longer than it should be, e.g. having more fields than +specified in this document, that indicates that additions to the +frame have been made in a later version of the ID3v2 standard. This +is reflected by the revision number in the header of the tag. +

    + + +

    3.3.1.Frame header flags

    +

    +In the frame header the size descriptor is followed by two flags +bytes. All unused flags must be cleared. The first byte is for +'status messages' and the second byte is for encoding purposes. If an +unknown flag is set in the first byte the frame may not be changed +without the bit cleared. If an unknown flag is set in the second byte +it is likely to not be readable. The flags field is defined as +follows. +

    + %abc00000 %ijk00000 +

    +

    +a - Tag alter preservation +

    + This flag tells the software what to do with this frame if it is + unknown and the tag is altered in any way. This applies to all + kinds of alterations, including adding more padding and reordering + the frames.

    +

    + + +
    Frame should be preserved.
    1Frame should be discarded.
    +

    +

    +b - File alter preservation +

    + This flag tells the software what to do with this frame if it is + unknown and the file, excluding the tag, is altered. This does not + apply when the audio is completely replaced with other audio data.

    +

    + + +
    Frame should be preserved.
    1Frame should be discarded.
    +

    +

    +c - Read only +

    +This flag, if set, tells the software that the contents of this +frame is intended to be read only. Changing the contents might +break something, e.g. a signature. If the contents are changed, +without knowledge in why the frame was flagged read only and +without taking the proper means to compensate, e.g. recalculating +the signature, the bit should be cleared. +

    +

    +i - Compression +

    +

    This flag indicates whether or not the frame is compressed.

    +

    + + +
    Frame is not compressed.
    1Frame is compressed using zlib with 4 bytes for 'decompressed size' appended to the frame header.
    +

    +

    +j - Encryption +

    +This flag indicates wether or not the frame is enrypted. If set +one byte indicating with which method it was encrypted will be +appended to the frame header. See section 4.26. for more +information about encryption method registration. +

    + + +
    Frame is not encrypted.
    1Frame is encrypted.
    +

    +

    +k - Grouping identity +

    +This flag indicates whether or not this frame belongs in a group +with other frames. If set a group identifier byte is added to the +frame header. Every frame with the same group identifier belongs +to the same group. +

    + + +
    Frame does not contain group information
    1Frame contains group information
    +

    +

    +Some flags indicates that the frame header is extended with +additional information. This information will be added to the frame +header in the same order as the flags indicating the additions. I.e. +the four bytes of decompressed size will preceed the encryption +method byte. These additions to the frame header, while not included +in the frame header size but are included in the 'frame size' field, +are not subject to encryption or compression. +

    + + +

    3.3.2.Default flags

    +

    +The default settings for the frames described in this document can be +divided into the following classes. The flags may be set differently +if found more suitable by the software. +

    + 1. Discarded if tag is altered, discarded if file is altered. +

    + None. +

    + 2. Discarded if tag is altered, preserved if file is altered. +

    + None. +

    + 3. Preserved if tag is altered, discarded if file is altered. +

    + ETCO, EQUA, MLLT, POSS, SYLT, SYTC, RVAD, TENC, TLEN, TSIZ +

    + 4. Preserved if tag is altered, preserved if file is altered. +

    + The rest of the frames. +

    + + +

    4.Declared ID3v2 frames

    +

    +The following frames are declared in this draft. +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    4.20AENC Audio encryption
    4.15APICAttached picture
    4.11COMMComments
    4.25COMRCommercial frame
    4.26ENCREncryption method registration
    4.13EQUAEqualization
    4.6 ETCOEvent timing codes
    4.16GEOBGeneral encapsulated object
    4.27GRIDGroup identification registration
    4.4 IPLSInvolved people list
    4.21LINKLinked information
    4.5 MCDIMusic CD identifier
    4.7 MLLTMPEG location lookup table
    4.24OWNEOwnership frame
    4.28PRIVPrivate frame
    4.17PCNTPlay counter
    4.18POPMPopularimeter
    4.22POSSPosition synchronisation frame
    4.19RBUFRecommended buffer size
    4.12RVADRelative volume adjustment
    4.14RVRBReverb
    4.10SYLTSynchronized lyric/text
    4.8 SYTCSynchronized tempo codes
    4.2.1TALBAlbum/Movie/Show title
    4.2.1TBPMBPM (beats per minute)
    4.2.1TCOMComposer
    4.2.1TCONContent type
    4.2.1TCOPCopyright message
    4.2.1TDATDate
    4.2.1TDLYPlaylist delay
    4.2.1TENCEncoded by
    4.2.1TEXTLyricist/Text writer
    4.2.1TFLTFile type
    4.2.1TIMETime
    4.2.1TIT1Content group description
    4.2.1TIT2Title/songname/content description
    4.2.1TIT3Subtitle/Description refinement
    4.2.1TKEYInitial key
    4.2.1TLANLanguage(s)
    4.2.1TLENLength
    4.2.1TMEDMedia type
    4.2.1TOALOriginal album/movie/show title
    4.2.1TOFNOriginal filename
    4.2.1TOLYOriginal lyricist(s)/text writer(s)
    4.2.1TOPEOriginal artist(s)/performer(s)
    4.2.1TORYOriginal release year
    4.2.1TOWNFile owner/licensee
    4.2.1TPE1Lead performer(s)/Soloist(s)
    4.2.1TPE2Band/orchestra/accompaniment
    4.2.1TPE3Conductor/performer refinement
    4.2.1TPE4Interpreted, remixed, or otherwise modified by
    4.2.1TPOSPart of a set
    4.2.1TPUBPublisher
    4.2.1TRCKTrack number/Position in set
    4.2.1TRDARecording dates
    4.2.1TRSNInternet radio station name
    4.2.1TRSOInternet radio station owner
    4.2.1TSIZSize
    4.2.1TSRCISRC (international standard recording code)
    4.2.1TSSESoftware/Hardware and settings used for encoding
    4.2.1TYERYear
    4.2.2TXXXUser defined text information frame
    4.1 UFIDUnique file identifier
    4.23USERTerms of use
    4.9 USLTUnsychronized lyric/text transcription
    4.3.1WCOMCommercial information
    4.3.1WCOPCopyright/Legal information
    4.3.1WOAFOfficial audio file webpage
    4.3.1WOAROfficial artist/performer webpage
    4.3.1WOASOfficial audio source webpage
    4.3.1WORSOfficial internet radio station homepage
    4.3.1WPAYPayment
    4.3.1WPUBPublishers official webpage
    4.3.2WXXXUser defined URL link frame
    +

    + + +

    4.1.Unique file identifier

    +

    +This frame's purpose is to be able to identify the audio file in a +database that may contain more information relevant to the content. +Since standardisation of such a database is beyond this document, all +frames begin with a null-terminated string with a URL +containing an email address, or a link to a location where an email +address can be found, that belongs to the organisation responsible +for this specific database implementation. Questions regarding the +database should be sent to the indicated email address. The URL +should not be used for the actual database queries. The string +"http://www.id3.org/dummy/ufid.html" should be used for tests. +Software that isn't told otherwise may safely remove such frames. The +'Owner identifier' must be non-empty (more than just a termination). +The 'Owner identifier' is then followed by the actual identifier, +which may be up to 64 bytes. There may be more than one "UFID" frame +in a tag, but only one with the same 'Owner identifier'. +

    +

    + + + +
    <Header for 'Unique file identifier', ID: "UFID">
    Owner identifier<text string> $00
    Identifier<up to 64 bytes binary data>

    + + +

    4.2.Text information frames

    +

    +The text information frames are the most important frames, containing +information like artist, album and more. There may only be one text +information frame of its kind in an tag. If the textstring is +followed by a termination ($00 (00)) all the following information +should be ignored and not be displayed. All text frame identifiers +begin with "T". Only text frame identifiers begin with "T", with the +exception of the "TXXX" frame. All the text information frames have +the following format: +

    +

    + + + +
    <Header for 'Text information frame', ID: "T000" - "TZZZ", excluding "TXXX" described in 4.2.2.>
    Text encoding$xx
    Information <text string according to encoding>

    + + +

    4.2.1.Text information frames - details

    +

    + +

    TALB
    +
    +The 'Album/Movie/Show title' frame is intended for the title of the +recording(/source of sound) which the audio in the file is taken +from. +
    +

    + +

    + +

    TBPM
    +
    The 'BPM' frame contains the number of beats per minute in the +mainpart of the audio. The BPM is an integer and represented as a +numerical string.
    +

    + +

    + +

    TCOM
    +
    The 'Composer(s)' frame is intended for the name of the composer(s). +They are seperated with the "/" character.
    +

    + +

    + +

    TCON
    +
    The 'Content type', which previously was +stored as a one byte numeric value only, is now a numeric string. You +may use one or several of the types as ID3v1.1 did or, since the +category list would be impossible to maintain with accurate and up to +date categories, define your own. +

    +

    +References to the ID3v1 genres can be made by, as first byte, enter +"(" followed by a number from the genres list (appendix A) and +ended with a ")" character. This is optionally followed by a +refinement, e.g. "(21)" or "(4)Eurodisco". Several references can be +made in the same frame, e.g. "(51)(39)". If the refinement should +begin with a "(" character it should be replaced with "((", e.g. "((I +can figure out any genre)" or "(55)((I think...)". The following new +content types is defined in ID3v2 and is implemented in the same way +as the numerig content types, e.g. "(RX)".
    +

    +

    + + +
    RXRemix
    CRCover
    +

    + +

    + +

    TCOP
    +
    The 'Copyright message' frame, which must begin with a year and a +space character (making five characters), is intended for the +copyright holder of the original sound, not the audio file itself. +The absence of this frame means only that the copyright information +is unavailable or has been removed, and must not be interpreted to +mean that the sound is public domain. Every time this field is +displayed the field must be preceded with "Copyright © ".
    +

    + +

    + +

    TDAT
    +
    The 'Date' frame is a numeric string in the DDMM format containing +the date for the recording. This field is always four characters +long.
    +

    + +

    + +

    TDLY
    +
    The 'Playlist delay' defines the numbers of milliseconds of silence +between every song in a playlist. The player should use the "ETC" +frame, if present, to skip initial silence and silence at the end of +the audio to match the 'Playlist delay' time. The time is represented +as a numeric string.
    +

    + +

    + +

    TENC
    +
    The 'Encoded by' frame contains the name of the person or +organisation that encoded the audio file. This field may contain a +copyright message, if the audio file also is copyrighted by the +encoder.
    +

    + +

    + +

    TEXT
    +
    The 'Lyricist(s)/Text writer(s)' frame is intended for the writer(s) +of the text or lyrics in the recording. They are seperated with the +"/" character.
    +

    + +

    + +

    TFLT
    +
    The 'File type' frame indicates which type of audio this tag defines. +The following type and refinements are defined: +

    +

    + + + + + + + + +
    MPG MPEG Audio
    /1MPEG 1/2 layer I
    /2MPEG 1/2 layer II
    /3MPEG 1/2 layer III
    /2.5MPEG 2.5
     /AACAdvanced audio compression
    VQFTransform-domain Weighted Interleave Vector Quantization
    PCMPulse Code Modulated audio

    +

    +but other types may be used, not for these types though. This is used +in a similar way to the predefined types in the "TMED" frame, but +without parentheses. If this frame is not present audio type is +assumed to be "MPG".
    +

    + +

    + +

    TIME
    +
    The 'Time' frame is a numeric string in the HHMM format containing +the time for the recording. This field is always four characters +long.
    +

    + +

    + +

    TIT1
    +
    The 'Content group description' frame is used if the sound belongs to +a larger category of sounds/music. For example, classical music is +often sorted in different musical sections (e.g. "Piano Concerto", +"Weather - Hurricane").
    +

    + +

    + +

    TIT2
    +
    The 'Title/Songname/Content description' frame is the actual name of +the piece (e.g. "Adagio", "Hurricane Donna").
    +

    + +

    + +

    TIT3
    +
    The 'Subtitle/Description refinement' frame is used for information +directly related to the contents title (e.g. "Op. 16" or "Performed +live at Wembley").
    +

    + +

    + +

    TKEY
    +
    The 'Initial key' frame contains the musical key in which the sound +starts. It is represented as a string with a maximum length of three +characters. The ground keys are represented with "A","B","C","D","E", +"F" and "G" and halfkeys represented with "b" and "#". Minor is +represented as "m". Example "Cbm". Off key is represented with an "o" +only.
    +

    + +

    + +

    TLAN
    +
    The 'Language(s)' frame should contain the languages of the text or +lyrics spoken or sung in the audio. The language is represented with +three characters according to ISO-639-2. If more than one language is +used in the text their language codes should follow according to +their usage.
    +

    + +

    + +

    TLEN
    +
    The 'Length' frame contains the length of the audiofile in +milliseconds, represented as a numeric string.
    +

    + +

    + +

    TMED
    +
    The 'Media type' frame describes from which media the sound +originated. This may be a text string or a reference to the +predefined media types found in the list below. References are made +within "(" and ")" and are optionally followed by a text refinement, +e.g. "(MC) with four channels". If a text refinement should begin +with a "(" character it should be replaced with "((" in the same way +as in the "TCO" frame. Predefined refinements is appended after the +media type, e.g. "(CD/A)" or "(VID/PAL/VHS)".
    +

    +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    DIG Other digital media
    /A
     
    Analog transfer from media
    ANAOther analog media
    /WACWax cylinder
    /8CA
     
    8-track tape cassette
    CDCD
    /AAnalog transfer from media
    /DDDDD
    /ADADD
    /AA
     
    AAD
    LDLaserdisc
    /A
     
    Analog transfer from media
    TTTurntable records
    /3333.33 rpm
    /4545 rpm
    /7171.29 rpm
    /7676.59 rpm
    /7878.26 rpm
    /80
     
    80 rpm
    MDMiniDisc
    /A
     
    Analog transfer from media
    DATDAT
    /AAnalog transfer from media
    /1standard, 48 kHz/16 bits, linear
    /2mode 2, 32 kHz/16 bits, linear
    /3mode 3, 32 kHz/12 bits, nonlinear, low speed
    /4mode 4, 32 kHz/12 bits, 4 channels
    /5mode 5, 44.1 kHz/16 bits, linear
    /6
     
    mode 6, 44.1 kHz/16 bits, 'wide track' play
    DCCDCC
    /A
     
    Analog transfer from media
    DVDDVD
    /A
     
    Analog transfer from media
    TVTelevision
    /PALPAL
    /NTSCNTSC
     /SECAM
     
    SECAM
    VIDVideo
    /PALPAL
    /NTSCNTSC
    /SECAMSECAM
    /VHSVHS
    /SVHSS-VHS
    /BETA
     
    BETAMAX
    RADRadio
    /FMFM
    /AMAM
    /LWLW
    /MW
     
    MW
    TELTelephone
    /I
     
    ISDN
    MCMC (normal cassette)
    /44.75 cm/s (normal speed for a two sided cassette)
    /99.5 cm/s
    /IType I cassette (ferric/normal)
    /IIType II cassette (chrome)
    /IIIType III cassette (ferric chrome)
    /IV
     
    Type IV cassette (metal)
    REEReel
    /99.5 cm/s
    /1919 cm/s
    /3838 cm/s
    /7676 cm/s
    /IType I cassette (ferric/normal)
    /IIType II cassette (chrome)
    /IIIType III cassette (ferric chrome)
    /IV
     
    Type IV cassette (metal)
    +

    + +

    + +

    TOAL
    +
    The 'Original album/movie/show title' frame is intended for the title +of the original recording (or source of sound), if for example the +music in the file should be a cover of a previously released song. +

    + +

    + +

    TOFN
    +
    The 'Original filename' frame contains the preferred filename for the +file, since some media doesn't allow the desired length of the +filename. The filename is case sensitive and includes its suffix.
    +

    + +

    + +

    TOLY
    +
    The 'Original lyricist(s)/text writer(s)' frame is intended for the +text writer(s) of the original recording, if for example the music in +the file should be a cover of a previously released song. The text +writers are seperated with the "/" character.
    +

    + +

    + +

    TOPE
    +
    The 'Original artist(s)/performer(s)' frame is intended for the +performer(s) of the original recording, if for example the music in +the file should be a cover of a previously released song. The +performers are seperated with the "/" character.
    +

    + +

    + +

    TORY
    +
    The 'Original release year' frame is intended for the year when the +original recording, if for example the music in the file should be a +cover of a previously released song, was released. The field is +formatted as in the "TYER" frame.
    +

    + +

    + +

    TOWN
    +
    The 'File owner/licensee' frame contains the name of the owner or +licensee of the file and it's contents.
    +

    + +

    + +

    TPE1
    +
    The 'Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group' is +used for the main artist(s). They are seperated with the "/" +character.
    +

    + +

    + +

    TPE2
    +
    The 'Band/Orchestra/Accompaniment' frame is used for additional +information about the performers in the recording.
    +

    + +

    + +

    TPE3
    +
    The 'Conductor' frame is used for the name of the conductor.
    +

    + +

    + +

    TPE4
    +
    The 'Interpreted, remixed, or otherwise modified by' frame contains +more information about the people behind a remix and similar +interpretations of another existing piece.
    +

    + +

    + +

    TPOS
    +
    The 'Part of a set' frame is a numeric string that describes which +part of a set the audio came from. This frame is used if the source +described in the "TALB" frame is divided into several mediums, e.g. a +double CD. The value may be extended with a "/" character and a +numeric string containing the total number of parts in the set. E.g. +"1/2".
    +

    + +

    + +

    TPUB
    +
    The 'Publisher' frame simply contains the name of the label or +publisher.
    +

    + +

    + +

    TRCK
    +
    The 'Track number/Position in set' frame is a numeric string +containing the order number of the audio-file on its original +recording. This may be extended with a "/" character and a numeric +string containing the total numer of tracks/elements on the original +recording. E.g. "4/9".
    +

    + +

    + +

    TRDA
    +
    The 'Recording dates' frame is a intended to be used as complement to +the "TYER", "TDAT" and "TIME" frames. E.g. "4th-7th June, 12th June" +in combination with the "TYER" frame.
    +

    + +

    + +

    TRSN
    +
    The 'Internet radio station name' frame contains the name of the +internet radio station from which the audio is streamed.
    +

    + +

    + +

    TRSO
    +
    The 'Internet radio station owner' frame contains the name of the +owner of the internet radio station from which the audio is +streamed.
    +

    + +

    + +

    TSIZ
    +
    The 'Size' frame contains the size of the audiofile in bytes, +excluding the ID3v2 tag, represented as a numeric string.
    +

    + +

    + +

    TSRC
    +
    The 'ISRC' frame should contain the International Standard Recording +Code (ISRC) (12 characters).
    +

    + +

    + +

    TSSE
    +
    The 'Software/Hardware and settings used for encoding' frame +includes the used audio encoder and its settings when the file was +encoded. Hardware refers to hardware encoders, not the computer on +which a program was run.
    +

    + +

    + +

    TYER
    +
    The 'Year' frame is a numeric string with a year of the recording. +This frames is always four characters long (until the year 10000).
    +

    + +

    4.2.2.User defined text information frame

    +

    +

    This frame is intended for one-string text information concerning the +audiofile in a similar way to the other "T"-frames. The frame body +consists of a description of the string, represented as a terminated +string, followed by the actual string. There may be more than one +"TXXX" frame in each tag, but only one with the same description. +

    +

    + + + +
    <Header for 'User defined text information frame', ID: "TXXX"> +
    Text encoding$xx
    Description<text string according to encoding> $00 (00)
    Value<text string according to encoding>

    + + +

    4.3.URL link frames

    +

    +With these frames dynamic data such as webpages with touring +information, price information or plain ordinary news can be added to +the tag. There may only be one URL link frame of its kind in an +tag, except when stated otherwise in the frame description. If the +textstring is followed by a termination ($00 (00)) all the following +information should be ignored and not be displayed. All URL link +frame identifiers begins with "W". Only URL link frame identifiers +begins with "W". All URL link frames have the following format: +

    +

    + + +
    <Header for 'URL link frame', ID: "W000" - "WZZZ", excluding "WXXX" described in 4.3.2.>
    URL<text string>

    + + +

    4.3.1.URL link frames - details

    +

    + +

    WCOM
    +
    The 'Commercial information' frame is a URL pointing at a webpage +with information such as where the album can be bought. There may be +more than one "WCOM" frame in a tag, but not with the same content.
    +

    + +

    + +

    WCOP
    +
    The 'Copyright/Legal information' frame is a URL pointing at a +webpage where the terms of use and ownership of the file is +described.
    +

    + +

    + +

    WOAF
    +
    The 'Official audio file webpage' frame is a URL pointing at a file +specific webpage.
    +

    + +

    + +

    WOAR
    +
    The 'Official artist/performer webpage' frame is a URL pointing at +the artists official webpage. There may be more than one "WOAR" frame +in a tag if the audio contains more than one performer, but not with +the same content.
    +

    + +

    + +

    WOAS
    +
    The 'Official audio source webpage' frame is a URL pointing at the +official webpage for the source of the audio file, e.g. a movie.
    +

    + +

    + +

    WORS
    +
    The 'Official internet radio station homepage' contains a URL +pointing at the homepage of the internet radio station.
    +

    + +

    + +

    WPAY
    +
    The 'Payment' frame is a URL pointing at a webpage that will handle +the process of paying for this file.
    +

    + +

    + +

    WPUB
    +
    The 'Publishers official webpage' frame is a URL pointing at the +official wepage for the publisher.
    +

    + + +

    4.3.2.User defined URL link frame

    +

    +This frame is intended for URL links concerning the audiofile +in a similar way to the other "W"-frames. The frame body consists +of a description of the string, represented as a terminated string, +followed by the actual URL. The URL is always encoded with ISO-8859-1. There may be more than one "WXXX" frame in each tag, +but only one with the same description. +

    +

    + + + + +
    <Header for 'User defined URL link frame', ID: "WXXX">
    Text encoding$xx
    Description <text string according to encoding> $00 (00)
    URL <text string>

    + + +

    4.4.Involved people list

    +

    +Since there might be a lot of people contributing to an audio file in +various ways, such as musicians and technicians, the 'Text +information frames' are often insufficient to list everyone involved +in a project. The 'Involved people list' is a frame containing the +names of those involved, and how they were involved. The body simply +contains a terminated string with the involvement directly followed +by a terminated string with the involvee followed by a new +involvement and so on. There may only be one "IPLS" frame in each +tag. +

    +

    + + + +
    <Header for 'Involved people list', ID: "IPLS">
    Text encoding$xx
    People list strings<text strings according to encoding>

    + + +

    4.5.Music CD identifier

    +

    +This frame is intended for music that comes from a CD, so that the CD +can be identified in databases such as the CDDB. The frame +consists of a binary dump of the Table Of Contents, TOC, from the CD, +which is a header of 4 bytes and then 8 bytes/track on the CD plus 8 +bytes for the 'lead out' making a maximum of 804 bytes. The offset to +the beginning of every track on the CD should be described with a +four bytes absolute CD-frame address per track, and not with absolute +time. This frame requires a present and valid "TRCK" frame, even if +the CD's only got one track. There may only be one "MCDI" frame in +each tag. +

    +

    + + +
    <Header for 'Music CD identifier', ID: "MCDI">
    CD TOC<binary data>

    + + +

    4.6.Event timing codes

    +

    +This frame allows synchronisation with key events in a song or sound. +The header is: +

    + + +
    <Header for 'Event timing codes', ID: "ETCO">
    Time stamp format$xx
    +

    +Where time stamp format is: +

    + $01 Absolute time, 32 bit sized, using MPEG frames as unit
    + $02 Absolute time, 32 bit sized, using milliseconds as unit +

    +Abolute time means that every stamp contains the time from the +beginning of the file. +

    +Followed by a list of key events in the following format: +

    + + +
    Type of event$xx
    Time stamp$xx (xx ...)
    +

    +The 'Time stamp' is set to zero if directly at the beginning of the +sound or after the previous event. All events should be sorted in +chronological order. The type of event is as follows: +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    $00padding (has no meaning)
    $01end of initial silence
    $02intro start
    $03mainpart start
    $04outro start
    $05outro end
    $06verse start
    $07refrain start
    $08interlude start
    $09theme start
    $0Avariation start
    $0Bkey change
    $0Ctime change
    $0Dmomentary unwanted noise (Snap, Crackle & Pop)
    $0Esustained noise
    $0Fsustained noise end
    $10intro end
    $11mainpart end
    $12verse end
    $13refrain end
    $14theme end
    $15-$DFreserved for future use
    $E0-$EFnot predefined sync 0-F
    $F0-$FCreserved for future use
    $FDaudio end (start of silence)
    $FEaudio file ends
    $FFone more byte of events follows (all the following bytes with the value $FF have the same function)
    +

    +Terminating the start events such as "intro start" is not required. +The 'Not predefined sync's ($E0-EF) are for user events. You might +want to synchronise your music to something, like setting of an +explosion on-stage, turning on your screensaver etc. +

    +

    There may only be one "ETCO" frame in each tag.

    + + +

    4.7.MPEG location lookup table

    +

    +To increase performance and accuracy of jumps within a MPEG +audio file, frames with timecodes in different locations in the file +might be useful. The ID3v2 frame includes references that the +software can use to calculate positions in the file. After the frame +header is a descriptor of how much the 'frame counter' should +increase for every reference. If this value is two then the first +reference points out the second frame, the 2nd reference the 4th +frame, the 3rd reference the 6th frame etc. In a similar way the +'bytes between reference' and 'milliseconds between reference' points +out bytes and milliseconds respectively. +

    +Each reference consists of two parts; a certain number of bits, as +defined in 'bits for bytes deviation', that describes the difference +between what is said in 'bytes between reference' and the reality and +a certain number of bits, as defined in 'bits for milliseconds +deviation', that describes the difference between what is said in +'milliseconds between reference' and the reality. The number of bits +in every reference, i.e. 'bits for bytes deviation'+'bits for +milliseconds deviation', must be a multiple of four. There may only +be one "MLLT" frame in each tag. +

    + + + + + + +
    <Header for 'Location lookup table', ID: "MLLT">
    MPEG frames between reference$xx xx
    Bytes between reference$xx xx xx
    Milliseconds between reference$xx xx xx
    Bits for bytes deviation$xx
    Bits for milliseconds dev.$xx
    +

    +Then for every reference the following data is included; +

    + + +
    Deviation in bytes%xxx....
    Deviation in milliseconds%xxx....
    +

    + + +

    4.8.Synchronised tempo codes

    +

    +For a more accurate description of the tempo of a musical piece this +frame might be used. After the header follows one byte describing +which time stamp format should be used. Then follows one or more +tempo codes. Each tempo code consists of one tempo part and one time +part. The tempo is in BPM described with one or two bytes. If the +first byte has the value $FF, one more byte follows, which is added +to the first giving a range from 2 - 510 BPM, since $00 and $01 is +reserved. $00 is used to describe a beat-free time period, which is +not the same as a music-free time period. $01 is used to indicate one +single beat-stroke followed by a beat-free period. +

    +The tempo descriptor is followed by a time stamp. Every time the +tempo in the music changes, a tempo descriptor may indicate this for +the player. All tempo descriptors should be sorted in chronological +order. The first beat-stroke in a time-period is at the same time as +the beat description occurs. There may only be one "SYTC" frame in +each tag. +

    + + + +
    <Header for 'Synchronised tempo codes', ID: "SYTC">
    Time stamp format$xx
    Tempo data <binary data>
    +

    +Where time stamp format is: +

    + $01 Absolute time, 32 bit sized, using MPEG frames as unit
    + $02 Absolute time, 32 bit sized, using milliseconds as unit +

    +Abolute time means that every stamp contains the time from the +beginning of the file. +

    + + +

    4.9.Unsychronised lyrics/text transcription

    +

    +This frame contains the lyrics of the song or a text transcription of +other vocal activities. The head includes an encoding descriptor and +a content descriptor. The body consists of the actual text. The +'Content descriptor' is a terminated string. If no descriptor is +entered, 'Content descriptor' is $00 (00) only. Newline characters +are allowed in the text. There may be more than one 'Unsynchronised +lyrics/text transcription' frame in each tag, but only one with the +same language and content descriptor. +

    + + + + + +
    <Header for 'Unsynchronised lyrics/text transcription', ID: "USLT">
    Text encoding$xx
    Language$xx xx xx
    Content descriptor<text string according to encoding> $00 (00)
    Lyrics/text<full text string according to encoding>
    +

    + + +

    4.10.Synchronised lyrics/text

    +

    +This is another way of incorporating the words, said or sung lyrics, +in the audio file as text, this time, however, in sync with the +audio. It might also be used to describing events e.g. occurring on a +stage or on the screen in sync with the audio. The header includes a +content descriptor, represented with as terminated textstring. If no +descriptor is entered, 'Content descriptor' is $00 (00) only. +

    + + + + + + +
    <Header for 'Synchronised lyrics/text', ID: "SYLT">
    Text encoding$xx
    Language$xx xx xx
    Time stamp format$xx
    Content type$xx
    Content descriptor<text string according to encoding> $00 (00)
    +

    +

    + + +
    Encoding:$00ISO-8859-1 character set is used => $00 + is sync identifier.
    $01Unicode character set is used => $00 00 is + sync identifier.

    + +

    + + + + + + + +
    Content type:$00is other
    $01is lyrics
    $02is text transcription
    $03is movement/part name (e.g. "Adagio")
    $04is events (e.g. "Don Quijote enters the stage")
    $05is chord (e.g. "Bb F Fsus")
    $06is trivia/'pop up' information

    +

    +Time stamp format is: +

    + $01 Absolute time, 32 bit sized, using MPEG frames as unit
    + $02 Absolute time, 32 bit sized, using milliseconds as unit +

    +

    +Abolute time means that every stamp contains the time from the +beginning of the file. +

    +The text that follows the frame header differs from that of the +unsynchronised lyrics/text transcription in one major way. Each +syllable (or whatever size of text is considered to be convenient by +the encoder) is a null terminated string followed by a time stamp +denoting where in the sound file it belongs. Each sync thus has the +following structure: +

    + + + +
    Terminated text to be synced (typically a syllable)
    Sync identifier (terminator to above string)$00 (00)
    Time stamp$xx (xx ...)
    +

    +The 'time stamp' is set to zero or the whole sync is omitted if +located directly at the beginning of the sound. All time stamps +should be sorted in chronological order. The sync can be considered +as a validator of the subsequent string. +

    +Newline ($0A) characters are allowed in all "SYLT" frames and should +be used after every entry (name, event etc.) in a frame with the +content type $03 - $04. +

    +A few considerations regarding whitespace characters: Whitespace +separating words should mark the beginning of a new word, thus +occurring in front of the first syllable of a new word. This is also +valid for new line characters. A syllable followed by a comma should +not be broken apart with a sync (both the syllable and the comma +should be before the sync).

    +

    An example: The "USLT" passage

    +

    "Strangers in the night" $0A "Exchanging glances"

    +

    would be "SYLT" encoded as:

    +

    + "Strang" $00 xx xx "ers" $00 xx xx " in" $00 xx xx " the" $00 xx xx + " night" $00 xx xx 0A "Ex" $00 xx xx "chang" $00 xx xx "ing" $00 xx + xx "glan" $00 xx xx "ces" $00 xx xx +

    +

    There may be more than one "SYLT" frame in each tag, but only one +with the same language and content descriptor.

    + + +

    4.11.Comments

    +

    +This frame is indended for any kind of full text information that +does not fit in any other frame. It consists of a frame header +followed by encoding, language and content descriptors and is ended +with the actual comment as a text string. Newline characters are +allowed in the comment text string. There may be more than one +comment frame in each tag, but only one with the same language and +content descriptor. +

    + + + + + +
    <Header for 'Comment', ID: "COMM">
    Text encoding$xx
    Language $xx xx xx
    Short content descrip.<text string according to encoding> $00 (00)
    The actual text <full text string according to encoding>
    +

    + + +

    4.12.Relative volume adjustment

    +

    +This is a more subjective function than the previous ones. It allows +the user to say how much he wants to increase/decrease the volume on +each channel while the file is played. The purpose is to be able to +align all files to a reference volume, so that you don't have to +change the volume constantly. This frame may also be used to balance +adjust the audio. If the volume peak levels are known then this could +be described with the 'Peak volume right' and 'Peak volume left' +field. If Peakvolume is not known these fields could be left zeroed +or, if no other data follows, be completely omitted. There may only +be one "RVAD" frame in each tag. +

    + + + + + + + +
    <Header for 'Relative volume adjustment', ID: "RVAD">
    Increment/decrement%00xxxxxx
    Bits used for volume descr.$xx
    Relative volume change, right$xx xx (xx ...)
    Relative volume change, left$xx xx (xx ...)
    Peak volume right$xx xx (xx ...)
    Peak volume left$xx xx (xx ...)

    +

    +In the increment/decrement field bit 0 is used to indicate the right +channel and bit 1 is used to indicate the left channel. 1 is +increment and 0 is decrement. +

    +The 'bits used for volume description' field is normally $10 (16 +bits) for MPEG 2 layer I, II and III and MPEG 2.5. This value +may not be $00. The volume is always represented with whole bytes, +padded in the beginning (highest bits) when 'bits used for volume +description' is not a multiple of eight. +

    +This datablock is then optionally followed by a volume definition for +the left and right back channels. If this information is appended to +the frame the first two channels will be treated as front channels. +In the increment/decrement field bit 2 is used to indicate the right +back channel and bit 3 for the left back channel. +

    + + + + +
    Relative volume change, right back$xx xx (xx ...)
    Relative volume change, left back$xx xx (xx ...)
    Peak volume right back$xx xx (xx ...)
    Peak volume left back$xx xx (xx ...)

    +

    +If the center channel adjustment is present the following is appended +to the existing frame, after the left and right back channels. The +center channel is represented by bit 4 in the increase/decrease +field. +

    + + +
    Relative volume change, center$xx xx (xx ...)
    Peak volume center$xx xx (xx ...)

    +

    +If the bass channel adjustment is present the following is appended +to the existing frame, after the center channel. The bass channel is +represented by bit 5 in the increase/decrease field. +

    + + +
    Relative volume change, bass$xx xx (xx ...)
    Peak volume bass$xx xx (xx ...)

    + + +

    4.13.Equalisation

    +

    +This is another subjective, alignment frame. It allows the user to +predefine an equalisation curve within the audio file. There may only +be one "EQUA" frame in each tag. +

    + + +
    <Header of 'Equalisation', ID: "EQUA">
    Adjustment bits$xx

    +

    +The 'adjustment bits' field defines the number of bits used for +representation of the adjustment. This is normally $10 (16 bits) for +MPEG 2 layer I, II and III and MPEG 2.5. This value may not be +$00. +

    +This is followed by 2 bytes + ('adjustment bits' rounded up to the +nearest byte) for every equalisation band in the following format, +giving a frequency range of 0 - 32767Hz: +

    + + + +
    Increment/decrement%x (MSB of the Frequency)
    Frequency (lower 15 bits)
    Adjustment$xx (xx ...)

    +

    +The increment/decrement bit is 1 for increment and 0 for decrement. +The equalisation bands should be ordered increasingly with reference +to frequency. All frequencies don't have to be declared. The +equalisation curve in the reading software should be interpolated +between the values in this frame. Three equal adjustments for three +subsequent frequencies. A frequency should only be described once in +the frame. +

    + + +

    4.14.Reverb

    +

    +Yet another subjective one. You may here adjust echoes of different +kinds. Reverb left/right is the delay between every bounce in ms. +Reverb bounces left/right is the number of bounces that should be +made. $FF equals an infinite number of bounces. Feedback is the +amount of volume that should be returned to the next echo bounce. $00 +is 0%, $FF is 100%. If this value were $7F, there would be 50% volume +reduction on the first bounce, 50% of that on the second and so on. +Left to left means the sound from the left bounce to be played in the +left speaker, while left to right means sound from the left bounce to +be played in the right speaker. +

    +'Premix left to right' is the amount of left sound to be mixed in the +right before any reverb is applied, where $00 id 0% and $FF is 100%. +'Premix right to left' does the same thing, but right to left. +Setting both premix to $FF would result in a mono output (if the +reverb is applied symmetric). There may only be one "RVRB" frame in +each tag. +

    + + + + + + + + + + + +
    <Header for 'Reverb', ID: "RVRB">
    Reverb left (ms) $xx xx
    Reverb right (ms) $xx xx
    Reverb bounces, left $xx
    Reverb bounces, right$xx
    Reverb feedback, left to left $xx
    Reverb feedback, left to right$xx
    Reverb feedback, right to right $xx
    Reverb feedback, right to left$xx
    Premix left to right $xx
    Premix right to left $xx

    + + +

    4.15.Attached picture

    +

    +This frame contains a picture directly related to the audio file. +Image format is the MIME type and subtype for the image. In +the event that the MIME media type name is omitted, "image/" will be +implied. The "image/png" or "image/jpeg" picture format +should be used when interoperability is wanted. Description is a +short description of the picture, represented as a terminated +textstring. The description has a maximum length of 64 characters, +but may be empty. There may be several pictures attached to one file, +each in their individual "APIC" frame, but only one with the same +content descriptor. There may only be one picture with the picture +type declared as picture type $01 and $02 respectively. There is the +possibility to put only a link to the image file by using the 'MIME +type' "-->" and having a complete URL instead of picture data. +The use of linked files should however be used sparingly since there +is the risk of separation of files. +

    + + + + + + +
    <Header for 'Attached picture', ID: "APIC">
    Text encoding$xx
    MIME type <text string> $00
    Picture type $xx
    Description <text string according to encoding> $00 (00)
    Picture data <binary data>
    +

    +

    + + + + + + + + + + + + + + + + + + + + + +
    Picture type:$00Other
    $0132x32 pixels 'file icon' (PNG only)
    $02Other file icon
    $03Cover (front)
    $04Cover (back)
    $05Leaflet page
    $06Media (e.g. lable side of CD)
    $07Lead artist/lead performer/soloist
    $08Artist/performer
    $09Conductor
    $0ABand/Orchestra
    $0BComposer
    $0CLyricist/text writer
    $0DRecording Location
    $0EDuring recording
    $0FDuring performance
    $10Movie/video screen capture
    $11A bright coloured fish
    $12Illustration
    $13Band/artist logotype
    $14Publisher/Studio logotype

    + + +

    4.16.General encapsulated object

    +

    +In this frame any type of file can be encapsulated. After the header, +'Frame size' and 'Encoding' follows 'MIME type' represented as +as a terminated string encoded with ISO-8859-1. The +filename is case sensitive and is encoded as 'Encoding'. Then follows +a content description as terminated string, encoded as 'Encoding'. +The last thing in the frame is the actual object. The first two +strings may be omitted, leaving only their terminations. There may be more than one "GEOB" +frame in each tag, but only one with the same content descriptor. +

    + + + + + + +
    <Header for 'General encapsulated object', ID: "GEOB">
    Text encoding $xx
    MIME type <text string> $00
    Filename<text string according to encoding> $00 (00)
    Content description $00 (00)
    Encapsulated object <binary data>

    + + +

    4.17.Play counter

    +

    +This is simply a counter of the number of times a file has been +played. The value is increased by one every time the file begins to +play. There may only be one "PCNT" frame in each tag. When the +counter reaches all one's, one byte is inserted in front of the +counter thus making the counter eight bits bigger. The counter must +be at least 32-bits long to begin with. +

    + + +
    <Header for 'Play counter', ID: "PCNT">
    Counter $xx xx xx xx (xx ...)

    + + + +

    4.18.Popularimeter

    +

    +The purpose of this frame is to specify how good an audio file is. +Many interesting applications could be found to this frame such as a +playlist that features better audiofiles more often than others or it +could be used to profile a person's taste and find other 'good' files +by comparing people's profiles. The frame is very simple. It contains +the email address to the user, one rating byte and a four byte play +counter, intended to be increased with one for every time the file is +played. The email is a terminated string. The rating is 1-255 where +1 is worst and 255 is best. 0 is unknown. If no personal counter is +wanted it may be omitted. When the counter reaches all one's, one +byte is inserted in front of the counter thus making the counter +eight bits bigger in the same away as the play counter ("PCNT"). +There may be more than one "POPM" frame in each tag, but only one +with the same email address. +

    + + + + +
    <Header for 'Popularimeter', ID: "POPM">
    Email to user<text string> $00
    Rating $xx
    Counter$xx xx xx xx (xx ...)

    + + +

    4.19.Recommended buffer size

    +

    +Sometimes the server from which a audio file is streamed is aware of +transmission or coding problems resulting in interruptions in the +audio stream. In these cases, the size of the buffer can be +recommended by the server using this frame. If the 'embedded info +flag' is true (1) then this indicates that an ID3 tag with the +maximum size described in 'Buffer size' may occur in the audiostream. +In such case the tag should reside between two MPEG frames, if +the audio is MPEG encoded. If the position of the next tag is known, +'offset to next tag' may be used. The offset is calculated from the +end of tag in which this frame resides to the first byte of the +header in the next. This field may be omitted. Embedded tags are +generally not recommended since this could render unpredictable +behaviour from present software/hardware. +

    +For applications like streaming audio it might be an idea to embed +tags into the audio stream though. If the clients connects to +individual connections like HTTP and there is a possibility to begin +every transmission with a tag, then this tag should include a +'recommended buffer size' frame. If the client is connected to a +arbitrary point in the stream, such as radio or multicast, then the +'recommended buffer size' frame should be included in every tag. +Every tag that is picked up after the initial/first tag is to be +considered as an update of the previous one. E.g. if there is a +"TIT2" frame in the first received tag and one in the second tag, +then the first should be 'replaced' with the second. +

    +The 'Buffer size' should be kept to a minimum. There may only be one +"RBUF" frame in each tag. +

    + + + + +
    <Header for 'Recommended buffer size', ID: "RBUF">
    Buffer size$xx xx xx
    Embedded info flag%0000000x
    Offset to next tag$xx xx xx xx

    + + +

    4.20.Audio encryption

    +

    +This frame indicates if the actual audio stream is encrypted, and by +whom. Since standardisation of such encrypion scheme is beyond this +document, all "AENC" frames begin with a terminated string with a +URL containing an email address, or a link to a location where an +email address can be found, that belongs to the organisation +responsible for this specific encrypted audio file. Questions +regarding the encrypted audio should be sent to the email address +specified. If a $00 is found directly after the 'Frame size' and the +audiofile indeed is encrypted, the whole file may be considered +useless. +

    +After the 'Owner identifier', a pointer to an unencrypted part of the +audio can be specified. The 'Preview start' and 'Preview length' is +described in frames. If no part is unencrypted, these fields should +be left zeroed. After the 'preview length' field follows optionally a +datablock required for decryption of the audio. There may be more +than one "AENC" frames in a tag, but only one with the same 'Owner +identifier'. +

    + + + + + +
    <Header for 'Audio encryption', ID: "AENC">
    Owner identifier<text string> $00
    Preview start$xx xx
    Preview length$xx xx
    Encryption info<binary data>

    + + +

    4.21.Linked information

    +

    +To keep space waste as low as possible this frame may be used to link +information from another ID3v2 tag that might reside in another audio +file or alone in a binary file. It is recommended that this method is +only used when the files are stored on a CD-ROM or other +circumstances when the risk of file seperation is low. The frame +contains a frame identifier, which is the frame that should be linked +into this tag, a URL field, where a reference to the file where +the frame is given, and additional ID data, if needed. Data should be +retrieved from the first tag found in the file to which this link +points. There may be more than one "LINK" frame in a tag, but only +one with the same contents. A linked frame is to be considered as +part of the tag and has the same restrictions as if it was a physical +part of the tag (i.e. only one "RVRB" frame allowed, whether it's +linked or not). +

    + + + + +
    <Header for 'Linked information', ID: "LINK">
    Frame identifier$xx xx xx
    URL<text string> $00
    ID and additional data<text string(s)>

    +

    +Frames that may be linked and need no additional data are "IPLS", +"MCID", "ETCO", "MLLT", "SYTC", "RVAD", "EQUA", "RVRB", "RBUF", the +text information frames and the URL link frames. +

    +The "TXXX", "APIC", "GEOB" and "AENC" frames may be linked with +the content descriptor as additional ID data. +

    +The "COMM", "SYLT" and "USLT" frames may be linked with three bytes +of language descriptor directly followed by a content descriptor as +additional ID data. +

    + + +

    4.22.Position synchronisation frame

    +

    +This frame delivers information to the listener of how far into the +audio stream he picked up; in effect, it states the time offset of +the first frame in the stream. The frame layout is: +

    + + + +
    <Head for 'Position synchronisation', ID: "POSS">
    Time stamp format$xx
    Position$xx (xx ...)

    +

    +Where time stamp format is: +

    +$01 Absolute time, 32 bit sized, using MPEG frames as unit
    +$02 Absolute time, 32 bit sized, using milliseconds as unit +

    +and position is where in the audio the listener starts to receive, +i.e. the beginning of the next frame. If this frame is used in the +beginning of a file the value is always 0. There may only be one +"POSS" frame in each tag. +

    + + +

    4.23.Terms of use frame

    +

    +This frame contains a brief description of the terms of use and +ownership of the file. More detailed information concerning the legal +terms might be available through the "WCOP" frame. Newlines are +allowed in the text. There may only be one "USER" frame in a tag. +

    + + + + +
    <Header for 'Terms of use frame', ID: "USER">
    Text encoding$xx
    Language$xx xx xx
    The actual text<text string according to encoding>

    + + +

    4.24.Ownership frame

    +

    +The ownership frame might be used as a reminder of a made transaction +or, if signed, as proof. Note that the "USER" and "TOWN" frames are +good to use in conjunction with this one. The frame begins, after the +frame ID, size and encoding fields, with a 'price payed' field. The +first three characters of this field contains the currency used for +the transaction, encoded according to ISO-4217 alphabetic +currency code. Concatenated to this is the actual price payed, as a +numerical string using "." as the decimal separator. Next is an 8 +character date string (YYYYMMDD) followed by a string with the name +of the seller as the last field in the frame. There may only be one +"OWNE" frame in a tag. +

    + + + + + +
    <Header for 'Ownership frame', ID: "OWNE">
    Text encoding$xx
    Price payed<text string> $00
    Date of purch.<text string>
    Seller<text string according to encoding>

    + + +

    4.25.Commercial frame

    +

    +This frame enables several competing offers in the same tag by +bundling all needed information. That makes this frame rather complex +but it's an easier solution than if one tries to achieve the same +result with several frames. The frame begins, after the frame ID, +size and encoding fields, with a price string field. A price is +constructed by one three character currency code, encoded according +to ISO-4217 alphabetic currency code, followed by a +numerical value where "." is used as decimal seperator. In the price +string several prices may be concatenated, seperated by a "/" +character, but there may only be one currency of each type. +

    +The price string is followed by an 8 character date string in the +format YYYYMMDD, describing for how long the price is valid. After +that is a contact URL, with which the user can contact the seller, +followed by a one byte 'received as' field. It describes how the +audio is delivered when bought according to the following list: +

    + + + + + + + + + +
    $00Other
    $01Standard CD album with other songs
    $02Compressed audio on CD
    $03File over the Internet
    $04Stream over the Internet
    $05As note sheets
    $06As note sheets in a book with other sheets
    $07Music on other media
    $08Non-musical merchandise

    +

    +Next follows a terminated string with the name of the seller followed +by a terminated string with a short description of the product. The +last thing is the ability to include a company logotype. The first of +them is the 'Picture MIME type' field containing information about +which picture format is used. In the event that the MIME media type +name is omitted, "image/" will be implied. Currently only "image/png" +and "image/jpeg" are allowed. This format string is followed by the +binary picture data. This two last fields may be omitted if no +picture is to attach. +

    + + + + + + + + + + +
    <Header for 'Commercial frame', ID: "COMR">
    Text encoding$xx
    Price string<text string> $00
    Valid until<text string>
    Contact URL<text string> $00
    Received as$xx
    Name of seller<text string according to encoding> $00 (00)
    Description<text string according to encoding> $00 (00)
    Picture MIME type<string> $00
    Seller logo<binary data>

    + + +

    4.26.Encryption method registration

    +

    +To identify with which method a frame has been encrypted the +encryption method must be registered in the tag with this frame. The +'Owner identifier' is a null-terminated string with a URL +containing an email address, or a link to a location where an email +address can be found, that belongs to the organisation responsible +for this specific encryption method. Questions regarding the +encryption method should be sent to the indicated email address. The +'Method symbol' contains a value that is associated with this method +throughout the whole tag. Values below $80 are reserved. The 'Method +symbol' may optionally be followed by encryption specific data. There +may be several "ENCR" frames in a tag but only one containing the +same symbol and only one containing the same owner identifier. The +method must be used somewhere in the tag. See section 3.3.1, flag j +for more information. +

    + + + + +
    <Header for 'Encryption method registration', ID: "ENCR">
    Owner identifier<text string> $00
    Method symbol$xx
    Encryption data<binary data>

    + + +

    4.27.Group identification registration

    +

    +This frame enables grouping of otherwise unrelated frames. This can +be used when some frames are to be signed. To identify which frames +belongs to a set of frames a group identifier must be registered in +the tag with this frame. The 'Owner identifier' is a null-terminated +string with a URL containing an email address, or a link to a +location where an email address can be found, that belongs to the +organisation responsible for this grouping. Questions regarding the +grouping should be sent to the indicated email address. The 'Group +symbol' contains a value that associates the frame with this group +throughout the whole tag. Values below $80 are reserved. The 'Group +symbol' may optionally be followed by some group specific data, e.g. +a digital signature. There may be several "GRID" frames in a tag but +only one containing the same symbol and only one containing the same +owner identifier. The group symbol must be used somewhere in the tag. +See section 3.3.1, flag j for more information. +

    + + + + +
    <Header for 'Group ID registration', ID: "GRID">
    Owner identifier<text string> $00
    Group symbol$xx
    Group dependent data<binary data>

    + + +

    4.28.Private frame

    +

    +This frame is used to contain information from a software producer +that its program uses and does not fit into the other frames. The +frame consists of an 'Owner identifier' string and the binary data. +The 'Owner identifier' is a null-terminated string with a URL +containing an email address, or a link to a location where an email +address can be found, that belongs to the organisation responsible +for the frame. Questions regarding the frame should be sent to the +indicated email address. The tag may contain more than one "PRIV" +frame but only with different contents. It is recommended to keep the +number of "PRIV" frames as low as possible. +

    + + + +
    <Header for 'Private frame', ID: "PRIV">
    Owner identifier<text string> $00
    The private data<binary data>

    + + +

    5.The 'unsynchronisation scheme'

    +

    +The only purpose of the 'unsynchronisation scheme' is to make the +ID3v2 tag as compatible as possible with existing software. There is +no use in 'unsynchronising' tags if the file is only to be processed +by new software. Unsynchronisation may only be made with MPEG 2 layer +I, II and III and MPEG 2.5 files. +

    +Whenever a false synchronisation is found within the tag, one zeroed +byte is inserted after the first false synchronisation byte. The +format of a correct sync that should be altered by ID3 encoders is as +follows: +

    +%11111111 111xxxxx +

    +And should be replaced with: +

    +%11111111 00000000 111xxxxx +

    +This has the side effect that all $FF 00 combinations have to be +altered, so they won't be affected by the decoding process. Therefore +all the $FF 00 combinations have to be replaced with the $FF 00 00 +combination during the unsynchronisation. +

    +To indicate usage of the unsynchronisation, the first bit in 'ID3 +flags' should be set. This bit should only be set if the tag +contains a, now corrected, false synchronisation. The bit should +only be clear if the tag does not contain any false synchronisations. +

    +Do bear in mind, that if a compression scheme is used by the encoder, +the unsynchronisation scheme should be applied *afterwards*. When +decoding a compressed, 'unsynchronised' file, the 'unsynchronisation +scheme' should be parsed first, decompression afterwards. +

    +If the last byte in the tag is $FF, and there is a need to eliminate +false synchronisations in the tag, at least one byte of padding +should be added. +

    + + +

    6.Copyright

    +

    +Copyright © Martin Nilsson 1998. All Rights Reserved. +

    +This document and translations of it may be copied and furnished to +others, and derivative works that comment on or otherwise explain it +or assist in its implementation may be prepared, copied, published +and distributed, in whole or in part, without restriction of any +kind, provided that a reference to this document is included on all +such copies and derivative works. However, this document itself may +not be modified in any way and reissued as the original document. +

    +The limited permissions granted above are perpetual and will not be revoked. +

    +This document and the information contained herein is provided on an +"AS IS" basis and THE AUTHORS DISCLAIMS ALL WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF +THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED +WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +

    + + + +

    7.References

    + + +

    [CDDB] Compact Disc Data Base

    +

    <url:http://www.cddb.com>

    + + +

    [ID3v2] Martin Nilsson, "ID3v2 informal standard".

    +

    <url:http://www.id3.org/id3v2-00.txt>

    + + +

    [ISO-639-2] ISO/FDIS 639-2.
    +Codes for the representation of names of languages, Part 2: Alpha-3 code. Technical committee / subcommittee: TC 37 / SC 2

    + + +

    [ISO-4217] ISO 4217:1995.
    +Codes for the representation of currencies and funds. Technical committee / subcommittee: TC 68

    + + +

    [ISO-8859-1] ISO/IEC DIS 8859-1.
    +8-bit single-byte coded graphic character sets, Part 1: Latin alphabet No. 1. Technical committee / subcommittee: JTC 1 / SC 2

    + + +

    [ISRC] ISO 3901:1986
    +International Standard Recording Code (ISRC). Technical committee / subcommittee: TC 46 / SC 9

    + + +

    [JFIF] JPEG File Interchange Format, version 1.02

    +

    <url:http://www.w3.org/Graphics/JPEG/jfif.txt>

    + + +

    [MIME] Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, November 1996.

    +

    <url:ftp://ftp.isi.edu/in-notes/rfc2045.txt>

    + + +

    [MPEG] ISO/IEC 11172-3:1993.
    +Coding of moving pictures and associated audio for digital storage media at up to about 1,5 Mbit/s, Part 3: Audio. Technical committee / subcommittee: JTC 1 / SC 29
    + and
    +ISO/IEC 13818-3:1995
    +Generic coding of moving pictures and associated audio information, Part 3: Audio. Technical committee / subcommittee: JTC 1 / SC 29
    + and
    +ISO/IEC DIS 13818-3
    +Generic coding of moving pictures and associated audio information, Part 3: Audio (Revision of ISO/IEC 13818-3:1995)

    + + +

    [PNG] Portable Network Graphics, version 1.0

    +

    <url:http://www.w3.org/TR/REC-png-multi.html>

    + + +

    [UNICODE] ISO/IEC 10646-1:1993.
    +Universal Multiple-Octet Coded Character Set (UCS), Part 1: Architecture and Basic Multilingual Plane. Technical committee / subcommittee: JTC 1 / SC 2

    +

    <url:http://www.unicode.org>

    + + +

    [URL] T. Berners-Lee, L. Masinter & M. McCahill, "Uniform Resource Locators (URL).", RFC 1738, December 1994.

    +

    <url:ftp://ftp.isi.edu/in-notes/rfc1738.txt>

    + + +

    [ZLIB] P. Deutsch, Aladdin Enterprises & J-L. Gailly, "ZLIB Compressed Data Format Specification version 3.3", RFC 1950, May 1996.

    +

    <url:ftp://ftp.isi.edu/in-notes/rfc1950.txt>

    + + + +

    8.Appendix

    + + +

    A.Appendix A - Genre List from ID3v1

    +
    +The following genres is defined in ID3v1 +
    + 0.Blues
    + 1.Classic Rock
    + 2.Country
    + 3.Dance
    + 4.Disco
    + 5.Funk
    + 6.Grunge
    + 7.Hip-Hop
    + 8.Jazz
    + 9.Metal
    + 10.New Age
    + 11.Oldies
    + 12.Other
    + 13.Pop
    + 14.R&B
    + 15.Rap
    + 16.Reggae
    + 17.Rock
    + 18.Techno
    + 19.Industrial
    + 20.Alternative
    + 21.Ska
    + 22.Death Metal
    + 23.Pranks
    + 24.Soundtrack
    + 25.Euro-Techno
    + 26.Ambient
    + 27.Trip-Hop
    + 28.Vocal
    + 29.Jazz+Funk
    + 30.Fusion
    + 31.Trance
    + 32.Classical
    + 33.Instrumental
    + 34.Acid
    + 35.House
    + 36.Game
    + 37.Sound Clip
    + 38.Gospel
    + 39.Noise
    + 40.AlternRock
    + 41.Bass
    + 42.Soul
    + 43.Punk
    + 44.Space
    + 45.Meditative
    + 46.Instrumental Pop
    + 47.Instrumental Rock
    + 48.Ethnic
    + 49.Gothic
    + 50.Darkwave
    + 51.Techno-Industrial
    + 52.Electronic
    + 53.Pop-Folk
    + 54.Eurodance
    + 55.Dream
    + 56.Southern Rock
    + 57.Comedy
    + 58.Cult
    + 59.Gangsta
    + 60.Top 40
    + 61.Christian Rap
    + 62.Pop/Funk
    + 63.Jungle
    + 64.Native American
    + 65.Cabaret
    + 66.New Wave
    + 67.Psychadelic
    + 68.Rave
    + 69.Showtunes
    + 70.Trailer
    + 71.Lo-Fi
    + 72.Tribal
    + 73.Acid Punk
    + 74.Acid Jazz
    + 75.Polka
    + 76.Retro
    + 77.Musical
    + 78.Rock & Roll
    + 79.Hard Rock
    +
    +
    +The following genres are Winamp extensions +
    + 80.Folk
    + 81.Folk-Rock
    + 82.National Folk
    + 83.Swing
    + 84.Fast Fusion
    + 85.Bebob
    + 86.Latin
    + 87.Revival
    + 88.Celtic
    + 89.Bluegrass
    + 90.Avantgarde
    + 91.Gothic Rock
    + 92.Progressive Rock
    + 93.Psychedelic Rock
    + 94.Symphonic Rock
    + 95.Slow Rock
    + 96.Big Band
    + 97.Chorus
    + 98.Easy Listening
    + 99.Acoustic
    +100.Humour
    +101.Speech
    +102.Chanson
    +103.Opera
    +104.Chamber Music
    +105.Sonata
    +106.Symphony
    +107.Booty Bass
    +108.Primus
    +109.Porn Groove
    +110.Satire
    +111.Slow Jam
    +112.Club
    +113.Tango
    +114.Samba
    +115.Folklore
    +116.Ballad
    +117.Power Ballad
    +118.Rhythmic Soul
    +119.Freestyle
    +120.Duet
    +121.Punk Rock
    +122.Drum Solo
    +123.A capella
    +124.Euro-House
    +125.Dance Hall
    +
    + + +

    9.Author's Address

    +

    +Written by +

    +Martin Nilsson
    +Rydsvgen 246 C. 30
    +S-584 34 Linkping
    +Sweden
    +

    +Email: nilsson@id3.org +

    + +

    +Edited by +

    +Dirk Mahoney
    +57 Pechey Street
    +Chermside Q
    +Australia 4032
    +

    +Email: dirk@id3.org +

    +

    +Johan Sundstrm
    +Alsttersgatan 5 A. 34
    +S-584 35 Linkping
    +Sweden
    +

    +Email: johan@id3.org +

    + + \ No newline at end of file diff --git a/id3lib/doc/id3v2.3.0.txt b/id3lib/doc/id3v2.3.0.txt new file mode 100644 index 0000000..dee1ed9 --- /dev/null +++ b/id3lib/doc/id3v2.3.0.txt @@ -0,0 +1,2025 @@ + +Informal standard M. Nilsson +Document: id3v2.3.0.txt 3rd February 1999 + + + ID3 tag version 2.3.0 + +Status of this document + + This document is an informal standard and replaces the ID3v2.2.0 + standard [ID3v2]. The informal standard is released so that + implementors could have a set standard before a formal standard is + set. The formal standard will use another version or revision number + if not identical to what is described in this document. The contents + in this document may change for clarifications but never for added or + altered functionallity. + + Distribution of this document is unlimited. + + +Abstract + + This document describes the ID3v2.3.0, which is a more developed + version of the ID3v2 informal standard [ID3v2] (version 2.2.0), + evolved from the ID3 tagging system. The ID3v2 offers a flexible way + of storing information about an audio file within itself to determine + its origin and contents. The information may be technical + information, such as equalisation curves, as well as related meta + information, such as title, performer, copyright etc. + + +1. Table of contents + + 2. Conventions in this document + 3. ID3v2 overview + 3.1. ID3v2 header + 3.2. ID3v2 extended header + 3.3. ID3v2 frames overview + 3.3.1. Frame header flags + 3.3.2. Default flags + 4. Declared ID3v2 frames + 4.1. Unique file identifier + 4.2. Text information frames + 4.2.1. Text information frames - details + 4.2.2. User defined text information frame + 4.3. URL link frames + 4.3.1. URL link frames - details + 4.3.2. User defined URL link frame + 4.4. Involved people list + 4.5. Music CD Identifier + 4.6. Event timing codes + 4.7. MPEG location lookup table + 4.8. Synced tempo codes + 4.9. Unsychronised lyrics/text transcription + 4.10. Synchronised lyrics/text + 4.11. Comments + 4.12. Relative volume adjustment + 4.13. Equalisation + 4.14. Reverb + 4.15. Attached picture + 4.16. General encapsulated object + 4.17. Play counter + 4.18. Popularimeter + 4.19. Recommended buffer size + 4.20. Audio encryption + 4.21. Linked information + 4.22. Position synchronisation frame + 4.23. Terms of use + 4.24. Ownership frame + 4.25. Commercial frame + 4.26. Encryption method registration + 4.27. Group identification registration + 4.28. Private frame + 5. The 'unsynchronisation scheme' + 6. Copyright + 7. References + 8. Appendix + A. Appendix A - Genre List from ID3v1 + 9. Author's Address + + +2. Conventions in this document + + In the examples, text within "" is a text string exactly as it + appears in a file. Numbers preceded with $ are hexadecimal and + numbers preceded with % are binary. $xx is used to indicate a byte + with unknown content. %x is used to indicate a bit with unknown + content. The most significant bit (MSB) of a byte is called 'bit 7' + and the least significant bit (LSB) is called 'bit 0'. + + A tag is the whole tag described in this document. A frame is a block + of information in the tag. The tag consists of a header, frames and + optional padding. A field is a piece of information; one value, a + string etc. A numeric string is a string that consists of the + characters 0-9 only. + + +3. ID3v2 overview + + The two biggest design goals were to be able to implement ID3v2 + without disturbing old software too much and that ID3v2 should be + as flexible and expandable as possible. + + The first criterion is met by the simple fact that the MPEG [MPEG] + decoding software uses a syncsignal, embedded in the audiostream, to + 'lock on to' the audio. Since the ID3v2 tag doesn't contain a valid + syncsignal, no software will attempt to play the tag. If, for any + reason, coincidence make a syncsignal appear within the tag it will + be taken care of by the 'unsynchronisation scheme' described in + section 5. + + The second criterion has made a more noticeable impact on the design + of the ID3v2 tag. It is constructed as a container for several + information blocks, called frames, whose format need not be known to + the software that encounters them. At the start of every frame there + is an identifier that explains the frames' format and content, and a + size descriptor that allows software to skip unknown frames. + + If a total revision of the ID3v2 tag should be needed, there is a + version number and a size descriptor in the ID3v2 header. + + The ID3 tag described in this document is mainly targeted at files + encoded with MPEG-1/2 layer I, MPEG-1/2 layer II, MPEG-1/2 layer III + and MPEG-2.5, but may work with other types of encoded audio. + + The bitorder in ID3v2 is most significant bit first (MSB). The + byteorder in multibyte numbers is most significant byte first (e.g. + $12345678 would be encoded $12 34 56 78). + + It is permitted to include padding after all the final frame (at the + end of the ID3 tag), making the size of all the frames together + smaller than the size given in the head of the tag. A possible + purpose of this padding is to allow for adding a few additional + frames or enlarge existing frames within the tag without having to + rewrite the entire file. The value of the padding bytes must be $00. + + +3.1. ID3v2 header + + The ID3v2 tag header, which should be the first information in the + file, is 10 bytes as follows: + + ID3v2/file identifier "ID3" + ID3v2 version $03 00 + ID3v2 flags %abc00000 + ID3v2 size 4 * %0xxxxxxx + + The first three bytes of the tag are always "ID3" to indicate that + this is an ID3v2 tag, directly followed by the two version bytes. The + first byte of ID3v2 version is it's major version, while the second + byte is its revision number. In this case this is ID3v2.3.0. All + revisions are backwards compatible while major versions are not. If + software with ID3v2.2.0 and below support should encounter version + three or higher it should simply ignore the whole tag. Version and + revision will never be $FF. + + The version is followed by one the ID3v2 flags field, of which + currently only three flags are used. + + + a - Unsynchronisation + + Bit 7 in the 'ID3v2 flags' indicates whether or not + unsynchronisation is used (see section 5 for details); a set bit + indicates usage. + + + b - Extended header + + The second bit (bit 6) indicates whether or not the header is + followed by an extended header. The extended header is described in + section 3.2. + + + c - Experimental indicator + + The third bit (bit 5) should be used as an 'experimental + indicator'. This flag should always be set when the tag is in an + experimental stage. + + All the other flags should be cleared. If one of these undefined + flags are set that might mean that the tag is not readable for a + parser that does not know the flags function. + + The ID3v2 tag size is encoded with four bytes where the most + significant bit (bit 7) is set to zero in every byte, making a total + of 28 bits. The zeroed bits are ignored, so a 257 bytes long tag is + represented as $00 00 02 01. + + The ID3v2 tag size is the size of the complete tag after + unsychronisation, including padding, excluding the header but not + excluding the extended header (total tag size - 10). Only 28 bits + (representing up to 256MB) are used in the size description to avoid + the introducuction of 'false syncsignals'. + + An ID3v2 tag can be detected with the following pattern: + $49 44 33 yy yy xx zz zz zz zz + Where yy is less than $FF, xx is the 'flags' byte and zz is less than + $80. + + +3.2. ID3v2 extended header + + The extended header contains information that is not vital to the + correct parsing of the tag information, hence the extended header is + optional. + + Extended header size $xx xx xx xx + Extended Flags $xx xx + Size of padding $xx xx xx xx + + Where the 'Extended header size', currently 6 or 10 bytes, excludes + itself. The 'Size of padding' is simply the total tag size excluding + the frames and the headers, in other words the padding. The extended + header is considered separate from the header proper, and as such is + subject to unsynchronisation. + + The extended flags are a secondary flag set which describes further + attributes of the tag. These attributes are currently defined as + follows + + %x0000000 00000000 + + + x - CRC data present + + If this flag is set four bytes of CRC-32 data is appended to the + extended header. The CRC should be calculated before + unsynchronisation on the data between the extended header and the + padding, i.e. the frames and only the frames. + + Total frame CRC $xx xx xx xx + + +3.3. ID3v2 frame overview + + As the tag consists of a tag header and a tag body with one or more + frames, all the frames consists of a frame header followed by one or + more fields containing the actual information. The layout of the + frame header: + + Frame ID $xx xx xx xx (four characters) + Size $xx xx xx xx + Flags $xx xx + + The frame ID made out of the characters capital A-Z and 0-9. + Identifiers beginning with "X", "Y" and "Z" are for experimental use + and free for everyone to use, without the need to set the + experimental bit in the tag header. Have in mind that someone else + might have used the same identifier as you. All other identifiers are + either used or reserved for future use. + + The frame ID is followed by a size descriptor, making a total header + size of ten bytes in every frame. The size is calculated as frame + size excluding frame header (frame size - 10). + + In the frame header the size descriptor is followed by two flags + bytes. These flags are described in section 3.3.1. + + There is no fixed order of the frames' appearance in the tag, + although it is desired that the frames are arranged in order of + significance concerning the recognition of the file. An example of + such order: UFID, TIT2, MCDI, TRCK ... + + A tag must contain at least one frame. A frame must be at least 1 + byte big, excluding the header. + + If nothing else is said a string is represented as ISO-8859-1 + [ISO-8859-1] characters in the range $20 - $FF. Such strings are + represented as , or if newlines are + allowed, in the frame descriptions. All Unicode strings [UNICODE] use + 16-bit unicode 2.0 (ISO/IEC 10646-1:1993, UCS-2). Unicode strings + must begin with the Unicode BOM ($FF FE or $FE FF) to identify the + byte order. + + All numeric strings and URLs [URL] are always encoded as ISO-8859-1. + Terminated strings are terminated with $00 if encoded with ISO-8859-1 + and $00 00 if encoded as unicode. If nothing else is said newline + character is forbidden. In ISO-8859-1 a new line is represented, when + allowed, with $0A only. Frames that allow different types of text + encoding have a text encoding description byte directly after the + frame size. If ISO-8859-1 is used this byte should be $00, if Unicode + is used it should be $01. Strings dependent on encoding is + represented as , or if newlines are allowed. Any empty + Unicode strings which are NULL-terminated may have the Unicode BOM + followed by a Unicode NULL ($FF FE 00 00 or $FE FF 00 00). + + The three byte language field is used to describe the language of the + frame's content, according to ISO-639-2 [ISO-639-2]. + + All URLs [URL] may be relative, e.g. "picture.png", "../doc.txt". + + If a frame is longer than it should be, e.g. having more fields than + specified in this document, that indicates that additions to the + frame have been made in a later version of the ID3v2 standard. This + is reflected by the revision number in the header of the tag. + + +3.3.1. Frame header flags + + In the frame header the size descriptor is followed by two flags + bytes. All unused flags must be cleared. The first byte is for + 'status messages' and the second byte is for encoding purposes. If an + unknown flag is set in the first byte the frame may not be changed + without the bit cleared. If an unknown flag is set in the second byte + it is likely to not be readable. The flags field is defined as + follows. + + %abc00000 %ijk00000 + + + a - Tag alter preservation + + This flag tells the software what to do with this frame if it is + unknown and the tag is altered in any way. This applies to all + kinds of alterations, including adding more padding and reordering + the frames. + + 0 Frame should be preserved. + 1 Frame should be discarded. + + + b - File alter preservation + + This flag tells the software what to do with this frame if it is + unknown and the file, excluding the tag, is altered. This does not + apply when the audio is completely replaced with other audio data. + + 0 Frame should be preserved. + 1 Frame should be discarded. + + + c - Read only + + This flag, if set, tells the software that the contents of this + frame is intended to be read only. Changing the contents might + break something, e.g. a signature. If the contents are changed, + without knowledge in why the frame was flagged read only and + without taking the proper means to compensate, e.g. recalculating + the signature, the bit should be cleared. + + + i - Compression + + This flag indicates whether or not the frame is compressed. + + 0 Frame is not compressed. + 1 Frame is compressed using zlib [zlib] with 4 bytes for + 'decompressed size' appended to the frame header. + + + j - Encryption + + This flag indicates wether or not the frame is enrypted. If set + one byte indicating with which method it was encrypted will be + appended to the frame header. See section 4.26. for more + information about encryption method registration. + + 0 Frame is not encrypted. + 1 Frame is encrypted. + + + k - Grouping identity + + This flag indicates whether or not this frame belongs in a group + with other frames. If set a group identifier byte is added to the + frame header. Every frame with the same group identifier belongs + to the same group. + + 0 Frame does not contain group information + 1 Frame contains group information + + + Some flags indicates that the frame header is extended with + additional information. This information will be added to the frame + header in the same order as the flags indicating the additions. I.e. + the four bytes of decompressed size will preceed the encryption + method byte. These additions to the frame header, while not included + in the frame header size but are included in the 'frame size' field, + are not subject to encryption or compression. + + +3.3.2. Default flags + + The default settings for the frames described in this document can be + divided into the following classes. The flags may be set differently + if found more suitable by the software. + + 1. Discarded if tag is altered, discarded if file is altered. + + None. + + 2. Discarded if tag is altered, preserved if file is altered. + + None. + + 3. Preserved if tag is altered, discarded if file is altered. + + AENC, ETCO, EQUA, MLLT, POSS, SYLT, SYTC, RVAD, TENC, TLEN, TSIZ + + 4. Preserved if tag is altered, preserved if file is altered. + + The rest of the frames. + + +4. Declared ID3v2 frames + + The following frames are declared in this draft. + + 4.21 AENC Audio encryption + 4.15 APIC Attached picture + + 4.11 COMM Comments + 4.25 COMR Commercial frame + + 4.26 ENCR Encryption method registration + 4.13 EQUA Equalization + 4.6 ETCO Event timing codes + + 4.16 GEOB General encapsulated object + 4.27 GRID Group identification registration + + 4.4 IPLS Involved people list + + 4.21 LINK Linked information + + 4.5 MCDI Music CD identifier + 4.7 MLLT MPEG location lookup table + + 4.24 OWNE Ownership frame + + 4.28. PRIV Private frame + 4.17 PCNT Play counter + 4.18 POPM Popularimeter + 4.22 POSS Position synchronisation frame + + 4.19 RBUF Recommended buffer size + 4.12 RVAD Relative volume adjustment + 4.14 RVRB Reverb + + 4.10 SYLT Synchronized lyric/text + 4.8 SYTC Synchronized tempo codes + + 4.2.1 TALB Album/Movie/Show title + 4.2.1 TBPM BPM (beats per minute) + 4.2.1 TCOM Composer + 4.2.1 TCON Content type + 4.2.1 TCOP Copyright message + 4.2.1 TDAT Date + 4.2.1 TDLY Playlist delay + 4.2.1 TENC Encoded by + 4.2.1 TEXT Lyricist/Text writer + 4.2.1 TFLT File type + 4.2.1 TIME Time + 4.2.1 TIT1 Content group description + 4.2.1 TIT2 Title/songname/content description + 4.2.1 TIT3 Subtitle/Description refinement + 4.2.1 TKEY Initial key + 4.2.1 TLAN Language(s) + 4.2.1 TLEN Length + 4.2.1 TMED Media type + 4.2.1 TOAL Original album/movie/show title + 4.2.1 TOFN Original filename + 4.2.1 TOLY Original lyricist(s)/text writer(s) + 4.2.1 TOPE Original artist(s)/performer(s) + 4.2.1 TORY Original release year + 4.2.1 TOWN File owner/licensee + 4.2.1 TPE1 Lead performer(s)/Soloist(s) + 4.2.1 TPE2 Band/orchestra/accompaniment + 4.2.1 TPE3 Conductor/performer refinement + 4.2.1 TPE4 Interpreted, remixed, or otherwise modified by + 4.2.1 TPOS Part of a set + 4.2.1 TPUB Publisher + 4.2.1 TRCK Track number/Position in set + 4.2.1 TRDA Recording dates + 4.2.1 TRSN Internet radio station name + 4.2.1 TRSO Internet radio station owner + 4.2.1 TSIZ Size + 4.2.1 TSRC ISRC (international standard recording code) + 4.2.1 TSSE Software/Hardware and settings used for encoding + 4.2.1 TYER Year + 4.2.2 TXXX User defined text information frame + + 4.1 UFID Unique file identifier + 4.23 USER Terms of use + 4.9 USLT Unsychronized lyric/text transcription + + 4.3.1 WCOM Commercial information + 4.3.1 WCOP Copyright/Legal information + 4.3.1 WOAF Official audio file webpage + 4.3.1 WOAR Official artist/performer webpage + 4.3.1 WOAS Official audio source webpage + 4.3.1 WORS Official internet radio station homepage + 4.3.1 WPAY Payment + 4.3.1 WPUB Publishers official webpage + 4.3.2 WXXX User defined URL link frame + + +4.1. Unique file identifier + + This frame's purpose is to be able to identify the audio file in a + database that may contain more information relevant to the content. + Since standardisation of such a database is beyond this document, all + frames begin with a null-terminated string with a URL [URL] + containing an email address, or a link to a location where an email + address can be found, that belongs to the organisation responsible + for this specific database implementation. Questions regarding the + database should be sent to the indicated email address. The URL + should not be used for the actual database queries. The string + "http://www.id3.org/dummy/ufid.html" should be used for tests. + Software that isn't told otherwise may safely remove such frames. The + 'Owner identifier' must be non-empty (more than just a termination). + The 'Owner identifier' is then followed by the actual identifier, + which may be up to 64 bytes. There may be more than one "UFID" frame + in a tag, but only one with the same 'Owner identifier'. + +
    + Owner identifier $00 + Identifier + + +4.2. Text information frames + + The text information frames are the most important frames, containing + information like artist, album and more. There may only be one text + information frame of its kind in an tag. If the textstring is + followed by a termination ($00 (00)) all the following information + should be ignored and not be displayed. All text frame identifiers + begin with "T". Only text frame identifiers begin with "T", with the + exception of the "TXXX" frame. All the text information frames have + the following format: + +
    + Text encoding $xx + Information + + +4.2.1. Text information frames - details + + TALB + The 'Album/Movie/Show title' frame is intended for the title of the + recording(/source of sound) which the audio in the file is taken + from. + + TBPM + The 'BPM' frame contains the number of beats per minute in the + mainpart of the audio. The BPM is an integer and represented as a + numerical string. + + TCOM + The 'Composer(s)' frame is intended for the name of the composer(s). + They are seperated with the "/" character. + + TCON + The 'Content type', which previously was stored as a one byte numeric + value only, is now a numeric string. You may use one or several of + the types as ID3v1.1 did or, since the category list would be + impossible to maintain with accurate and up to date categories, + define your own. + + References to the ID3v1 genres can be made by, as first byte, enter + "(" followed by a number from the genres list (appendix A.) and + ended with a ")" character. This is optionally followed by a + refinement, e.g. "(21)" or "(4)Eurodisco". Several references can be + made in the same frame, e.g. "(51)(39)". If the refinement should + begin with a "(" character it should be replaced with "((", e.g. "((I + can figure out any genre)" or "(55)((I think...)". The following new + content types is defined in ID3v2 and is implemented in the same way + as the numerig content types, e.g. "(RX)". + + RX Remix + CR Cover + + TCOP + The 'Copyright message' frame, which must begin with a year and a + space character (making five characters), is intended for the + copyright holder of the original sound, not the audio file itself. + The absence of this frame means only that the copyright information + is unavailable or has been removed, and must not be interpreted to + mean that the sound is public domain. Every time this field is + displayed the field must be preceded with "Copyright " (C) " ", where + (C) is one character showing a C in a circle. + + TDAT + The 'Date' frame is a numeric string in the DDMM format containing + the date for the recording. This field is always four characters + long. + + TDLY + The 'Playlist delay' defines the numbers of milliseconds of silence + between every song in a playlist. The player should use the "ETC" + frame, if present, to skip initial silence and silence at the end of + the audio to match the 'Playlist delay' time. The time is represented + as a numeric string. + + TENC + The 'Encoded by' frame contains the name of the person or + organisation that encoded the audio file. This field may contain a + copyright message, if the audio file also is copyrighted by the + encoder. + + TEXT + The 'Lyricist(s)/Text writer(s)' frame is intended for the writer(s) + of the text or lyrics in the recording. They are seperated with the + "/" character. + + TFLT + The 'File type' frame indicates which type of audio this tag defines. + The following type and refinements are defined: + + MPG MPEG Audio + /1 MPEG 1/2 layer I + /2 MPEG 1/2 layer II + /3 MPEG 1/2 layer III + /2.5 MPEG 2.5 + /AAC Advanced audio compression + VQF Transform-domain Weighted Interleave Vector Quantization + PCM Pulse Code Modulated audio + + but other types may be used, not for these types though. This is used + in a similar way to the predefined types in the "TMED" frame, but + without parentheses. If this frame is not present audio type is + assumed to be "MPG". + + TIME + The 'Time' frame is a numeric string in the HHMM format containing + the time for the recording. This field is always four characters + long. + + TIT1 + The 'Content group description' frame is used if the sound belongs to + a larger category of sounds/music. For example, classical music is + often sorted in different musical sections (e.g. "Piano Concerto", + "Weather - Hurricane"). + + TIT2 + The 'Title/Songname/Content description' frame is the actual name of + the piece (e.g. "Adagio", "Hurricane Donna"). + + TIT3 + The 'Subtitle/Description refinement' frame is used for information + directly related to the contents title (e.g. "Op. 16" or "Performed + live at Wembley"). + + TKEY + The 'Initial key' frame contains the musical key in which the sound + starts. It is represented as a string with a maximum length of three + characters. The ground keys are represented with "A","B","C","D","E", + "F" and "G" and halfkeys represented with "b" and "#". Minor is + represented as "m". Example "Cbm". Off key is represented with an "o" + only. + + TLAN + The 'Language(s)' frame should contain the languages of the text or + lyrics spoken or sung in the audio. The language is represented with + three characters according to ISO-639-2. If more than one language is + used in the text their language codes should follow according to + their usage. + + TLEN + The 'Length' frame contains the length of the audiofile in + milliseconds, represented as a numeric string. + + TMED + The 'Media type' frame describes from which media the sound + originated. This may be a text string or a reference to the + predefined media types found in the list below. References are made + within "(" and ")" and are optionally followed by a text refinement, + e.g. "(MC) with four channels". If a text refinement should begin + with a "(" character it should be replaced with "((" in the same way + as in the "TCO" frame. Predefined refinements is appended after the + media type, e.g. "(CD/A)" or "(VID/PAL/VHS)". + + DIG Other digital media + /A Analog transfer from media + + ANA Other analog media + /WAC Wax cylinder + /8CA 8-track tape cassette + + CD CD + /A Analog transfer from media + /DD DDD + /AD ADD + /AA AAD + + LD Laserdisc + /A Analog transfer from media + + TT Turntable records + /33 33.33 rpm + /45 45 rpm + /71 71.29 rpm + /76 76.59 rpm + /78 78.26 rpm + /80 80 rpm + + MD MiniDisc + /A Analog transfer from media + + DAT DAT + /A Analog transfer from media + /1 standard, 48 kHz/16 bits, linear + /2 mode 2, 32 kHz/16 bits, linear + /3 mode 3, 32 kHz/12 bits, nonlinear, low speed + /4 mode 4, 32 kHz/12 bits, 4 channels + /5 mode 5, 44.1 kHz/16 bits, linear + /6 mode 6, 44.1 kHz/16 bits, 'wide track' play + + DCC DCC + /A Analog transfer from media + + DVD DVD + /A Analog transfer from media + + TV Television + /PAL PAL + /NTSC NTSC + /SECAM SECAM + + VID Video + /PAL PAL + /NTSC NTSC + /SECAM SECAM + /VHS VHS + /SVHS S-VHS + /BETA BETAMAX + + RAD Radio + /FM FM + /AM AM + /LW LW + /MW MW + + TEL Telephone + /I ISDN + + MC MC (normal cassette) + /4 4.75 cm/s (normal speed for a two sided cassette) + /9 9.5 cm/s + /I Type I cassette (ferric/normal) + /II Type II cassette (chrome) + /III Type III cassette (ferric chrome) + /IV Type IV cassette (metal) + + REE Reel + /9 9.5 cm/s + /19 19 cm/s + /38 38 cm/s + /76 76 cm/s + /I Type I cassette (ferric/normal) + /II Type II cassette (chrome) + /III Type III cassette (ferric chrome) + /IV Type IV cassette (metal) + + TOAL + The 'Original album/movie/show title' frame is intended for the title + of the original recording (or source of sound), if for example the + music in the file should be a cover of a previously released song. + + TOFN + The 'Original filename' frame contains the preferred filename for the + file, since some media doesn't allow the desired length of the + filename. The filename is case sensitive and includes its suffix. + + TOLY + The 'Original lyricist(s)/text writer(s)' frame is intended for the + text writer(s) of the original recording, if for example the music in + the file should be a cover of a previously released song. The text + writers are seperated with the "/" character. + + TOPE + The 'Original artist(s)/performer(s)' frame is intended for the + performer(s) of the original recording, if for example the music in + the file should be a cover of a previously released song. The + performers are seperated with the "/" character. + + TORY + The 'Original release year' frame is intended for the year when the + original recording, if for example the music in the file should be a + cover of a previously released song, was released. The field is + formatted as in the "TYER" frame. + + TOWN + The 'File owner/licensee' frame contains the name of the owner or + licensee of the file and it's contents. + + TPE1 + The 'Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group' is + used for the main artist(s). They are seperated with the "/" + character. + + TPE2 + The 'Band/Orchestra/Accompaniment' frame is used for additional + information about the performers in the recording. + + TPE3 + The 'Conductor' frame is used for the name of the conductor. + + TPE4 + The 'Interpreted, remixed, or otherwise modified by' frame contains + more information about the people behind a remix and similar + interpretations of another existing piece. + + TPOS + The 'Part of a set' frame is a numeric string that describes which + part of a set the audio came from. This frame is used if the source + described in the "TALB" frame is divided into several mediums, e.g. a + double CD. The value may be extended with a "/" character and a + numeric string containing the total number of parts in the set. E.g. + "1/2". + + TPUB + The 'Publisher' frame simply contains the name of the label or + publisher. + + TRCK + The 'Track number/Position in set' frame is a numeric string + containing the order number of the audio-file on its original + recording. This may be extended with a "/" character and a numeric + string containing the total numer of tracks/elements on the original + recording. E.g. "4/9". + + TRDA + The 'Recording dates' frame is a intended to be used as complement to + the "TYER", "TDAT" and "TIME" frames. E.g. "4th-7th June, 12th June" + in combination with the "TYER" frame. + + TRSN + The 'Internet radio station name' frame contains the name of the + internet radio station from which the audio is streamed. + + TRSO + The 'Internet radio station owner' frame contains the name of the + owner of the internet radio station from which the audio is + streamed. + + TSIZ + The 'Size' frame contains the size of the audiofile in bytes, + excluding the ID3v2 tag, represented as a numeric string. + + TSRC + The 'ISRC' frame should contain the International Standard Recording + Code [ISRC] (12 characters). + + TSSE + The 'Software/Hardware and settings used for encoding' frame + includes the used audio encoder and its settings when the file was + encoded. Hardware refers to hardware encoders, not the computer on + which a program was run. + + TYER + The 'Year' frame is a numeric string with a year of the recording. + This frames is always four characters long (until the year 10000). + + +4.2.2. User defined text information frame + + This frame is intended for one-string text information concerning the + audiofile in a similar way to the other "T"-frames. The frame body + consists of a description of the string, represented as a terminated + string, followed by the actual string. There may be more than one + "TXXX" frame in each tag, but only one with the same description. + +
    + Text encoding $xx + Description $00 (00) + Value + + +4.3. URL link frames + + With these frames dynamic data such as webpages with touring + information, price information or plain ordinary news can be added to + the tag. There may only be one URL [URL] link frame of its kind in an + tag, except when stated otherwise in the frame description. If the + textstring is followed by a termination ($00 (00)) all the following + information should be ignored and not be displayed. All URL link + frame identifiers begins with "W". Only URL link frame identifiers + begins with "W". All URL link frames have the following format: + +
    + URL + + +4.3.1. URL link frames - details + + WCOM + The 'Commercial information' frame is a URL pointing at a webpage + with information such as where the album can be bought. There may be + more than one "WCOM" frame in a tag, but not with the same content. + + WCOP + The 'Copyright/Legal information' frame is a URL pointing at a + webpage where the terms of use and ownership of the file is + described. + + WOAF + The 'Official audio file webpage' frame is a URL pointing at a file + specific webpage. + + WOAR + The 'Official artist/performer webpage' frame is a URL pointing at + the artists official webpage. There may be more than one "WOAR" frame + in a tag if the audio contains more than one performer, but not with + the same content. + + WOAS + The 'Official audio source webpage' frame is a URL pointing at the + official webpage for the source of the audio file, e.g. a movie. + + WORS + The 'Official internet radio station homepage' contains a URL + pointing at the homepage of the internet radio station. + + WPAY + The 'Payment' frame is a URL pointing at a webpage that will handle + the process of paying for this file. + + WPUB + The 'Publishers official webpage' frame is a URL pointing at the + official wepage for the publisher. + + +4.3.2. User defined URL link frame + + This frame is intended for URL [URL] links concerning the audiofile + in a similar way to the other "W"-frames. The frame body consists + of a description of the string, represented as a terminated string, + followed by the actual URL. The URL is always encoded with ISO-8859-1 + [ISO-8859-1]. There may be more than one "WXXX" frame in each tag, + but only one with the same description. + +
    + Text encoding $xx + Description $00 (00) + URL + + +4.4. Involved people list + + Since there might be a lot of people contributing to an audio file in + various ways, such as musicians and technicians, the 'Text + information frames' are often insufficient to list everyone involved + in a project. The 'Involved people list' is a frame containing the + names of those involved, and how they were involved. The body simply + contains a terminated string with the involvement directly followed + by a terminated string with the involvee followed by a new + involvement and so on. There may only be one "IPLS" frame in each + tag. + +
    + Text encoding $xx + People list strings + + +4.5. Music CD identifier + + This frame is intended for music that comes from a CD, so that the CD + can be identified in databases such as the CDDB [CDDB]. The frame + consists of a binary dump of the Table Of Contents, TOC, from the CD, + which is a header of 4 bytes and then 8 bytes/track on the CD plus 8 + bytes for the 'lead out' making a maximum of 804 bytes. The offset to + the beginning of every track on the CD should be described with a + four bytes absolute CD-frame address per track, and not with absolute + time. This frame requires a present and valid "TRCK" frame, even if + the CD's only got one track. There may only be one "MCDI" frame in + each tag. + +
    + CD TOC + + +4.6. Event timing codes + + This frame allows synchronisation with key events in a song or sound. + The header is: + +
    + Time stamp format $xx + + Where time stamp format is: + + $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit + $02 Absolute time, 32 bit sized, using milliseconds as unit + + Abolute time means that every stamp contains the time from the + beginning of the file. + + Followed by a list of key events in the following format: + + Type of event $xx + Time stamp $xx (xx ...) + + The 'Time stamp' is set to zero if directly at the beginning of the + sound or after the previous event. All events should be sorted in + chronological order. The type of event is as follows: + + $00 padding (has no meaning) + $01 end of initial silence + $02 intro start + $03 mainpart start + $04 outro start + $05 outro end + $06 verse start + $07 refrain start + $08 interlude start + $09 theme start + $0A variation start + $0B key change + $0C time change + $0D momentary unwanted noise (Snap, Crackle & Pop) + $0E sustained noise + $0F sustained noise end + $10 intro end + $11 mainpart end + $12 verse end + $13 refrain end + $14 theme end + + $15-$DF reserved for future use + + $E0-$EF not predefined sync 0-F + + $F0-$FC reserved for future use + + $FD audio end (start of silence) + $FE audio file ends + $FF one more byte of events follows (all the following bytes with + the value $FF have the same function) + + Terminating the start events such as "intro start" is not required. + The 'Not predefined sync's ($E0-EF) are for user events. You might + want to synchronise your music to something, like setting of an + explosion on-stage, turning on your screensaver etc. + + There may only be one "ETCO" frame in each tag. + + +4.7. MPEG location lookup table + + To increase performance and accuracy of jumps within a MPEG [MPEG] + audio file, frames with timecodes in different locations in the file + might be useful. The ID3v2 frame includes references that the + software can use to calculate positions in the file. After the frame + header is a descriptor of how much the 'frame counter' should + increase for every reference. If this value is two then the first + reference points out the second frame, the 2nd reference the 4th + frame, the 3rd reference the 6th frame etc. In a similar way the + 'bytes between reference' and 'milliseconds between reference' points + out bytes and milliseconds respectively. + + Each reference consists of two parts; a certain number of bits, as + defined in 'bits for bytes deviation', that describes the difference + between what is said in 'bytes between reference' and the reality and + a certain number of bits, as defined in 'bits for milliseconds + deviation', that describes the difference between what is said in + 'milliseconds between reference' and the reality. The number of bits + in every reference, i.e. 'bits for bytes deviation'+'bits for + milliseconds deviation', must be a multiple of four. There may only + be one "MLLT" frame in each tag. + +
    + MPEG frames between reference $xx xx + Bytes between reference $xx xx xx + Milliseconds between reference $xx xx xx + Bits for bytes deviation $xx + Bits for milliseconds dev. $xx + + Then for every reference the following data is included; + + Deviation in bytes %xxx.... + Deviation in milliseconds %xxx.... + + +4.8. Synchronised tempo codes + + For a more accurate description of the tempo of a musical piece this + frame might be used. After the header follows one byte describing + which time stamp format should be used. Then follows one or more + tempo codes. Each tempo code consists of one tempo part and one time + part. The tempo is in BPM described with one or two bytes. If the + first byte has the value $FF, one more byte follows, which is added + to the first giving a range from 2 - 510 BPM, since $00 and $01 is + reserved. $00 is used to describe a beat-free time period, which is + not the same as a music-free time period. $01 is used to indicate one + single beat-stroke followed by a beat-free period. + + The tempo descriptor is followed by a time stamp. Every time the + tempo in the music changes, a tempo descriptor may indicate this for + the player. All tempo descriptors should be sorted in chronological + order. The first beat-stroke in a time-period is at the same time as + the beat description occurs. There may only be one "SYTC" frame in + each tag. + +
    + Time stamp format $xx + Tempo data + + Where time stamp format is: + + $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit + $02 Absolute time, 32 bit sized, using milliseconds as unit + + Abolute time means that every stamp contains the time from the + beginning of the file. + + +4.9. Unsychronised lyrics/text transcription + + This frame contains the lyrics of the song or a text transcription of + other vocal activities. The head includes an encoding descriptor and + a content descriptor. The body consists of the actual text. The + 'Content descriptor' is a terminated string. If no descriptor is + entered, 'Content descriptor' is $00 (00) only. Newline characters + are allowed in the text. There may be more than one 'Unsynchronised + lyrics/text transcription' frame in each tag, but only one with the + same language and content descriptor. + +
    + Text encoding $xx + Language $xx xx xx + Content descriptor $00 (00) + Lyrics/text + + +4.10. Synchronised lyrics/text + + This is another way of incorporating the words, said or sung lyrics, + in the audio file as text, this time, however, in sync with the + audio. It might also be used to describing events e.g. occurring on a + stage or on the screen in sync with the audio. The header includes a + content descriptor, represented with as terminated textstring. If no + descriptor is entered, 'Content descriptor' is $00 (00) only. + +
    + Text encoding $xx + Language $xx xx xx + Time stamp format $xx + Content type $xx + Content descriptor $00 (00) + + + Encoding: $00 ISO-8859-1 [ISO-8859-1] character set is used => $00 + is sync identifier. + $01 Unicode [UNICODE] character set is used => $00 00 is + sync identifier. + + Content type: $00 is other + $01 is lyrics + $02 is text transcription + $03 is movement/part name (e.g. "Adagio") + $04 is events (e.g. "Don Quijote enters the stage") + $05 is chord (e.g. "Bb F Fsus") + $06 is trivia/'pop up' information + + Time stamp format is: + + $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit + $02 Absolute time, 32 bit sized, using milliseconds as unit + + Abolute time means that every stamp contains the time from the + beginning of the file. + + The text that follows the frame header differs from that of the + unsynchronised lyrics/text transcription in one major way. Each + syllable (or whatever size of text is considered to be convenient by + the encoder) is a null terminated string followed by a time stamp + denoting where in the sound file it belongs. Each sync thus has the + following structure: + + Terminated text to be synced (typically a syllable) + Sync identifier (terminator to above string) $00 (00) + Time stamp $xx (xx ...) + + The 'time stamp' is set to zero or the whole sync is omitted if + located directly at the beginning of the sound. All time stamps + should be sorted in chronological order. The sync can be considered + as a validator of the subsequent string. + + Newline ($0A) characters are allowed in all "SYLT" frames and should + be used after every entry (name, event etc.) in a frame with the + content type $03 - $04. + + A few considerations regarding whitespace characters: Whitespace + separating words should mark the beginning of a new word, thus + occurring in front of the first syllable of a new word. This is also + valid for new line characters. A syllable followed by a comma should + not be broken apart with a sync (both the syllable and the comma + should be before the sync). + + An example: The "USLT" passage + + "Strangers in the night" $0A "Exchanging glances" + + would be "SYLT" encoded as: + + "Strang" $00 xx xx "ers" $00 xx xx " in" $00 xx xx " the" $00 xx xx + " night" $00 xx xx 0A "Ex" $00 xx xx "chang" $00 xx xx "ing" $00 xx + xx "glan" $00 xx xx "ces" $00 xx xx + + There may be more than one "SYLT" frame in each tag, but only one + with the same language and content descriptor. + + +4.11. Comments + + This frame is indended for any kind of full text information that + does not fit in any other frame. It consists of a frame header + followed by encoding, language and content descriptors and is ended + with the actual comment as a text string. Newline characters are + allowed in the comment text string. There may be more than one + comment frame in each tag, but only one with the same language and + content descriptor. + +
    + Text encoding $xx + Language $xx xx xx + Short content descrip. $00 (00) + The actual text + + +4.12. Relative volume adjustment + + This is a more subjective function than the previous ones. It allows + the user to say how much he wants to increase/decrease the volume on + each channel while the file is played. The purpose is to be able to + align all files to a reference volume, so that you don't have to + change the volume constantly. This frame may also be used to balance + adjust the audio. If the volume peak levels are known then this could + be described with the 'Peak volume right' and 'Peak volume left' + field. If Peakvolume is not known these fields could be left zeroed + or, if no other data follows, be completely omitted. There may only + be one "RVAD" frame in each tag. + +
    + Increment/decrement %00xxxxxx + Bits used for volume descr. $xx + Relative volume change, right $xx xx (xx ...) + Relative volume change, left $xx xx (xx ...) + Peak volume right $xx xx (xx ...) + Peak volume left $xx xx (xx ...) + + In the increment/decrement field bit 0 is used to indicate the right + channel and bit 1 is used to indicate the left channel. 1 is + increment and 0 is decrement. + + The 'bits used for volume description' field is normally $10 (16 + bits) for MPEG 2 layer I, II and III [MPEG] and MPEG 2.5. This value + may not be $00. The volume is always represented with whole bytes, + padded in the beginning (highest bits) when 'bits used for volume + description' is not a multiple of eight. + + This datablock is then optionally followed by a volume definition for + the left and right back channels. If this information is appended to + the frame the first two channels will be treated as front channels. + In the increment/decrement field bit 2 is used to indicate the right + back channel and bit 3 for the left back channel. + + Relative volume change, right back $xx xx (xx ...) + Relative volume change, left back $xx xx (xx ...) + Peak volume right back $xx xx (xx ...) + Peak volume left back $xx xx (xx ...) + + If the center channel adjustment is present the following is appended + to the existing frame, after the left and right back channels. The + center channel is represented by bit 4 in the increase/decrease + field. + + Relative volume change, center $xx xx (xx ...) + Peak volume center $xx xx (xx ...) + + If the bass channel adjustment is present the following is appended + to the existing frame, after the center channel. The bass channel is + represented by bit 5 in the increase/decrease field. + + Relative volume change, bass $xx xx (xx ...) + Peak volume bass $xx xx (xx ...) + + +4.13. Equalisation + + This is another subjective, alignment frame. It allows the user to + predefine an equalisation curve within the audio file. There may only + be one "EQUA" frame in each tag. + +
    + Adjustment bits $xx + + The 'adjustment bits' field defines the number of bits used for + representation of the adjustment. This is normally $10 (16 bits) for + MPEG 2 layer I, II and III [MPEG] and MPEG 2.5. This value may not be + $00. + + This is followed by 2 bytes + ('adjustment bits' rounded up to the + nearest byte) for every equalisation band in the following format, + giving a frequency range of 0 - 32767Hz: + + Increment/decrement %x (MSB of the Frequency) + Frequency (lower 15 bits) + Adjustment $xx (xx ...) + + The increment/decrement bit is 1 for increment and 0 for decrement. + The equalisation bands should be ordered increasingly with reference + to frequency. All frequencies don't have to be declared. The + equalisation curve in the reading software should be interpolated + between the values in this frame. Three equal adjustments for three + subsequent frequencies. A frequency should only be described once in + the frame. + + +4.14. Reverb + + Yet another subjective one. You may here adjust echoes of different + kinds. Reverb left/right is the delay between every bounce in ms. + Reverb bounces left/right is the number of bounces that should be + made. $FF equals an infinite number of bounces. Feedback is the + amount of volume that should be returned to the next echo bounce. $00 + is 0%, $FF is 100%. If this value were $7F, there would be 50% volume + reduction on the first bounce, 50% of that on the second and so on. + Left to left means the sound from the left bounce to be played in the + left speaker, while left to right means sound from the left bounce to + be played in the right speaker. + + 'Premix left to right' is the amount of left sound to be mixed in the + right before any reverb is applied, where $00 id 0% and $FF is 100%. + 'Premix right to left' does the same thing, but right to left. + Setting both premix to $FF would result in a mono output (if the + reverb is applied symmetric). There may only be one "RVRB" frame in + each tag. + +
    + Reverb left (ms) $xx xx + Reverb right (ms) $xx xx + Reverb bounces, left $xx + Reverb bounces, right $xx + Reverb feedback, left to left $xx + Reverb feedback, left to right $xx + Reverb feedback, right to right $xx + Reverb feedback, right to left $xx + Premix left to right $xx + Premix right to left $xx + + +4.15. Attached picture + + This frame contains a picture directly related to the audio file. + Image format is the MIME type and subtype [MIME] for the image. In + the event that the MIME media type name is omitted, "image/" will be + implied. The "image/png" [PNG] or "image/jpeg" [JFIF] picture format + should be used when interoperability is wanted. Description is a + short description of the picture, represented as a terminated + textstring. The description has a maximum length of 64 characters, + but may be empty. There may be several pictures attached to one file, + each in their individual "APIC" frame, but only one with the same + content descriptor. There may only be one picture with the picture + type declared as picture type $01 and $02 respectively. There is the + possibility to put only a link to the image file by using the 'MIME + type' "-->" and having a complete URL [URL] instead of picture data. + The use of linked files should however be used sparingly since there + is the risk of separation of files. + +
    + Text encoding $xx + MIME type $00 + Picture type $xx + Description $00 (00) + Picture data + + + Picture type: $00 Other + $01 32x32 pixels 'file icon' (PNG only) + $02 Other file icon + $03 Cover (front) + $04 Cover (back) + $05 Leaflet page + $06 Media (e.g. lable side of CD) + $07 Lead artist/lead performer/soloist + $08 Artist/performer + $09 Conductor + $0A Band/Orchestra + $0B Composer + $0C Lyricist/text writer + $0D Recording Location + $0E During recording + $0F During performance + $10 Movie/video screen capture + $11 A bright coloured fish + $12 Illustration + $13 Band/artist logotype + $14 Publisher/Studio logotype + + +4.16. General encapsulated object + + In this frame any type of file can be encapsulated. After the header, + 'Frame size' and 'Encoding' follows 'MIME type' [MIME] represented as + as a terminated string encoded with ISO 8859-1 [ISO-8859-1]. The + filename is case sensitive and is encoded as 'Encoding'. Then follows + a content description as terminated string, encoded as 'Encoding'. + The last thing in the frame is the actual object. The first two + strings may be omitted, leaving only their terminations. MIME type is + always an ISO-8859-1 text string. There may be more than one "GEOB" + frame in each tag, but only one with the same content descriptor. + +
    + Text encoding $xx + MIME type $00 + Filename $00 (00) + Content description $00 (00) + Encapsulated object + + +4.17. Play counter + + This is simply a counter of the number of times a file has been + played. The value is increased by one every time the file begins to + play. There may only be one "PCNT" frame in each tag. When the + counter reaches all one's, one byte is inserted in front of the + counter thus making the counter eight bits bigger. The counter must + be at least 32-bits long to begin with. + +
    + Counter $xx xx xx xx (xx ...) + + +4.18. Popularimeter + + The purpose of this frame is to specify how good an audio file is. + Many interesting applications could be found to this frame such as a + playlist that features better audiofiles more often than others or it + could be used to profile a person's taste and find other 'good' files + by comparing people's profiles. The frame is very simple. It contains + the email address to the user, one rating byte and a four byte play + counter, intended to be increased with one for every time the file is + played. The email is a terminated string. The rating is 1-255 where + 1 is worst and 255 is best. 0 is unknown. If no personal counter is + wanted it may be omitted. When the counter reaches all one's, one + byte is inserted in front of the counter thus making the counter + eight bits bigger in the same away as the play counter ("PCNT"). + There may be more than one "POPM" frame in each tag, but only one + with the same email address. + +
    + Email to user $00 + Rating $xx + Counter $xx xx xx xx (xx ...) + + +4.19. Recommended buffer size + + Sometimes the server from which a audio file is streamed is aware of + transmission or coding problems resulting in interruptions in the + audio stream. In these cases, the size of the buffer can be + recommended by the server using this frame. If the 'embedded info + flag' is true (1) then this indicates that an ID3 tag with the + maximum size described in 'Buffer size' may occur in the audiostream. + In such case the tag should reside between two MPEG [MPEG] frames, if + the audio is MPEG encoded. If the position of the next tag is known, + 'offset to next tag' may be used. The offset is calculated from the + end of tag in which this frame resides to the first byte of the + header in the next. This field may be omitted. Embedded tags are + generally not recommended since this could render unpredictable + behaviour from present software/hardware. + + For applications like streaming audio it might be an idea to embed + tags into the audio stream though. If the clients connects to + individual connections like HTTP and there is a possibility to begin + every transmission with a tag, then this tag should include a + 'recommended buffer size' frame. If the client is connected to a + arbitrary point in the stream, such as radio or multicast, then the + 'recommended buffer size' frame should be included in every tag. + Every tag that is picked up after the initial/first tag is to be + considered as an update of the previous one. E.g. if there is a + "TIT2" frame in the first received tag and one in the second tag, + then the first should be 'replaced' with the second. + + The 'Buffer size' should be kept to a minimum. There may only be one + "RBUF" frame in each tag. + +
    + Buffer size $xx xx xx + Embedded info flag %0000000x + Offset to next tag $xx xx xx xx + + +4.20. Audio encryption + + This frame indicates if the actual audio stream is encrypted, and by + whom. Since standardisation of such encrypion scheme is beyond this + document, all "AENC" frames begin with a terminated string with a + URL containing an email address, or a link to a location where an + email address can be found, that belongs to the organisation + responsible for this specific encrypted audio file. Questions + regarding the encrypted audio should be sent to the email address + specified. If a $00 is found directly after the 'Frame size' and the + audiofile indeed is encrypted, the whole file may be considered + useless. + + After the 'Owner identifier', a pointer to an unencrypted part of the + audio can be specified. The 'Preview start' and 'Preview length' is + described in frames. If no part is unencrypted, these fields should + be left zeroed. After the 'preview length' field follows optionally a + datablock required for decryption of the audio. There may be more + than one "AENC" frames in a tag, but only one with the same 'Owner + identifier'. + +
    + Owner identifier $00 + Preview start $xx xx + Preview length $xx xx + Encryption info + + +4.21. Linked information + + To keep space waste as low as possible this frame may be used to link + information from another ID3v2 tag that might reside in another audio + file or alone in a binary file. It is recommended that this method is + only used when the files are stored on a CD-ROM or other + circumstances when the risk of file seperation is low. The frame + contains a frame identifier, which is the frame that should be linked + into this tag, a URL [URL] field, where a reference to the file where + the frame is given, and additional ID data, if needed. Data should be + retrieved from the first tag found in the file to which this link + points. There may be more than one "LINK" frame in a tag, but only + one with the same contents. A linked frame is to be considered as + part of the tag and has the same restrictions as if it was a physical + part of the tag (i.e. only one "RVRB" frame allowed, whether it's + linked or not). + +
    + Frame identifier $xx xx xx + URL $00 + ID and additional data + + Frames that may be linked and need no additional data are "IPLS", + "MCID", "ETCO", "MLLT", "SYTC", "RVAD", "EQUA", "RVRB", "RBUF", the + text information frames and the URL link frames. + + The "TXXX", "APIC", "GEOB" and "AENC" frames may be linked with + the content descriptor as additional ID data. + + The "COMM", "SYLT" and "USLT" frames may be linked with three bytes + of language descriptor directly followed by a content descriptor as + additional ID data. + + +4.22. Position synchronisation frame + + This frame delivers information to the listener of how far into the + audio stream he picked up; in effect, it states the time offset of + the first frame in the stream. The frame layout is: + + + Time stamp format $xx + Position $xx (xx ...) + + Where time stamp format is: + + $01 Absolute time, 32 bit sized, using MPEG frames as unit + $02 Absolute time, 32 bit sized, using milliseconds as unit + + and position is where in the audio the listener starts to receive, + i.e. the beginning of the next frame. If this frame is used in the + beginning of a file the value is always 0. There may only be one + "POSS" frame in each tag. + + +4.23. Terms of use frame + + This frame contains a brief description of the terms of use and + ownership of the file. More detailed information concerning the legal + terms might be available through the "WCOP" frame. Newlines are + allowed in the text. There may only be one "USER" frame in a tag. + +
    + Text encoding $xx + Language $xx xx xx + The actual text + + +4.24. Ownership frame + + The ownership frame might be used as a reminder of a made transaction + or, if signed, as proof. Note that the "USER" and "TOWN" frames are + good to use in conjunction with this one. The frame begins, after the + frame ID, size and encoding fields, with a 'price payed' field. The + first three characters of this field contains the currency used for + the transaction, encoded according to ISO 4217 [ISO-4217] alphabetic + currency code. Concatenated to this is the actual price payed, as a + numerical string using "." as the decimal separator. Next is an 8 + character date string (YYYYMMDD) followed by a string with the name + of the seller as the last field in the frame. There may only be one + "OWNE" frame in a tag. + +
    + Text encoding $xx + Price payed $00 + Date of purch. + Seller + + +4.25. Commercial frame + + This frame enables several competing offers in the same tag by + bundling all needed information. That makes this frame rather complex + but it's an easier solution than if one tries to achieve the same + result with several frames. The frame begins, after the frame ID, + size and encoding fields, with a price string field. A price is + constructed by one three character currency code, encoded according + to ISO 4217 [ISO-4217] alphabetic currency code, followed by a + numerical value where "." is used as decimal seperator. In the price + string several prices may be concatenated, seperated by a "/" + character, but there may only be one currency of each type. + + The price string is followed by an 8 character date string in the + format YYYYMMDD, describing for how long the price is valid. After + that is a contact URL, with which the user can contact the seller, + followed by a one byte 'received as' field. It describes how the + audio is delivered when bought according to the following list: + + $00 Other + $01 Standard CD album with other songs + $02 Compressed audio on CD + $03 File over the Internet + $04 Stream over the Internet + $05 As note sheets + $06 As note sheets in a book with other sheets + $07 Music on other media + $08 Non-musical merchandise + + Next follows a terminated string with the name of the seller followed + by a terminated string with a short description of the product. The + last thing is the ability to include a company logotype. The first of + them is the 'Picture MIME type' field containing information about + which picture format is used. In the event that the MIME media type + name is omitted, "image/" will be implied. Currently only "image/png" + and "image/jpeg" are allowed. This format string is followed by the + binary picture data. This two last fields may be omitted if no + picture is to attach. + +
    + Text encoding $xx + Price string $00 + Valid until + Contact URL $00 + Received as $xx + Name of seller $00 (00) + Description $00 (00) + Picture MIME type $00 + Seller logo + + +4.26. Encryption method registration + + To identify with which method a frame has been encrypted the + encryption method must be registered in the tag with this frame. The + 'Owner identifier' is a null-terminated string with a URL [URL] + containing an email address, or a link to a location where an email + address can be found, that belongs to the organisation responsible + for this specific encryption method. Questions regarding the + encryption method should be sent to the indicated email address. The + 'Method symbol' contains a value that is associated with this method + throughout the whole tag. Values below $80 are reserved. The 'Method + symbol' may optionally be followed by encryption specific data. There + may be several "ENCR" frames in a tag but only one containing the + same symbol and only one containing the same owner identifier. The + method must be used somewhere in the tag. See section 3.3.1, flag j + for more information. + +
    + Owner identifier $00 + Method symbol $xx + Encryption data + + +4.27. Group identification registration + + This frame enables grouping of otherwise unrelated frames. This can + be used when some frames are to be signed. To identify which frames + belongs to a set of frames a group identifier must be registered in + the tag with this frame. The 'Owner identifier' is a null-terminated + string with a URL [URL] containing an email address, or a link to a + location where an email address can be found, that belongs to the + organisation responsible for this grouping. Questions regarding the + grouping should be sent to the indicated email address. The 'Group + symbol' contains a value that associates the frame with this group + throughout the whole tag. Values below $80 are reserved. The 'Group + symbol' may optionally be followed by some group specific data, e.g. + a digital signature. There may be several "GRID" frames in a tag but + only one containing the same symbol and only one containing the same + owner identifier. The group symbol must be used somewhere in the tag. + See section 3.3.1, flag j for more information. + +
    + Owner identifier $00 + Group symbol $xx + Group dependent data + + +4.28. Private frame + + This frame is used to contain information from a software producer + that its program uses and does not fit into the other frames. The + frame consists of an 'Owner identifier' string and the binary data. + The 'Owner identifier' is a null-terminated string with a URL [URL] + containing an email address, or a link to a location where an email + address can be found, that belongs to the organisation responsible + for the frame. Questions regarding the frame should be sent to the + indicated email address. The tag may contain more than one "PRIV" + frame but only with different contents. It is recommended to keep the + number of "PRIV" frames as low as possible. + +
    + Owner identifier $00 + The private data + + +5. The 'unsynchronisation scheme' + + The only purpose of the 'unsynchronisation scheme' is to make the + ID3v2 tag as compatible as possible with existing software. There is + no use in 'unsynchronising' tags if the file is only to be processed + by new software. Unsynchronisation may only be made with MPEG 2 layer + I, II and III and MPEG 2.5 files. + + Whenever a false synchronisation is found within the tag, one zeroed + byte is inserted after the first false synchronisation byte. The + format of a correct sync that should be altered by ID3 encoders is as + follows: + + %11111111 111xxxxx + + And should be replaced with: + + %11111111 00000000 111xxxxx + + This has the side effect that all $FF 00 combinations have to be + altered, so they won't be affected by the decoding process. Therefore + all the $FF 00 combinations have to be replaced with the $FF 00 00 + combination during the unsynchronisation. + + To indicate usage of the unsynchronisation, the first bit in 'ID3 + flags' should be set. This bit should only be set if the tag + contains a, now corrected, false synchronisation. The bit should + only be clear if the tag does not contain any false synchronisations. + + Do bear in mind, that if a compression scheme is used by the encoder, + the unsynchronisation scheme should be applied *afterwards*. When + decoding a compressed, 'unsynchronised' file, the 'unsynchronisation + scheme' should be parsed first, decompression afterwards. + + If the last byte in the tag is $FF, and there is a need to eliminate + false synchronisations in the tag, at least one byte of padding + should be added. + + +6. Copyright + + Copyright (C) Martin Nilsson 1998. All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that a reference to this document is included on all + such copies and derivative works. However, this document itself may + not be modified in any way and reissued as the original document. + + The limited permissions granted above are perpetual and will not be + revoked. + + This document and the information contained herein is provided on an + "AS IS" basis and THE AUTHORS DISCLAIMS ALL WARRANTIES, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF + THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED + WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + +7. References + + [CDDB] Compact Disc Data Base + + + + [ID3v2] Martin Nilsson, "ID3v2 informal standard". + + + + [ISO-639-2] ISO/FDIS 639-2. + Codes for the representation of names of languages, Part 2: Alpha-3 + code. Technical committee / subcommittee: TC 37 / SC 2 + + [ISO-4217] ISO 4217:1995. + Codes for the representation of currencies and funds. + Technical committee / subcommittee: TC 68 + + [ISO-8859-1] ISO/IEC DIS 8859-1. + 8-bit single-byte coded graphic character sets, Part 1: Latin + alphabet No. 1. Technical committee / subcommittee: JTC 1 / SC 2 + + [ISRC] ISO 3901:1986 + International Standard Recording Code (ISRC). + Technical committee / subcommittee: TC 46 / SC 9 + + [JFIF] JPEG File Interchange Format, version 1.02 + + + + [MIME] Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part One: Format of Internet Message Bodies", + RFC 2045, November 1996. + + + + [MPEG] ISO/IEC 11172-3:1993. + Coding of moving pictures and associated audio for digital storage + media at up to about 1,5 Mbit/s, Part 3: Audio. + Technical committee / subcommittee: JTC 1 / SC 29 + and + ISO/IEC 13818-3:1995 + Generic coding of moving pictures and associated audio information, + Part 3: Audio. + Technical committee / subcommittee: JTC 1 / SC 29 + and + ISO/IEC DIS 13818-3 + Generic coding of moving pictures and associated audio information, + Part 3: Audio (Revision of ISO/IEC 13818-3:1995) + + + [PNG] Portable Network Graphics, version 1.0 + + + + [UNICODE] ISO/IEC 10646-1:1993. + Universal Multiple-Octet Coded Character Set (UCS), Part 1: + Architecture and Basic Multilingual Plane. + Technical committee / subcommittee: JTC 1 / SC 2 + + + + [URL] T. Berners-Lee, L. Masinter & M. McCahill, "Uniform Resource + Locators (URL).", RFC 1738, December 1994. + + + + [ZLIB] P. Deutsch, Aladdin Enterprises & J-L. Gailly, "ZLIB + Compressed + Data Format Specification version 3.3", RFC 1950, May 1996. + + + + +8. Appendix + + +A. Appendix A - Genre List from ID3v1 + + The following genres is defined in ID3v1 + + 0.Blues + 1.Classic Rock + 2.Country + 3.Dance + 4.Disco + 5.Funk + 6.Grunge + 7.Hip-Hop + 8.Jazz + 9.Metal + 10.New Age + 11.Oldies + 12.Other + 13.Pop + 14.R&B + 15.Rap + 16.Reggae + 17.Rock + 18.Techno + 19.Industrial + 20.Alternative + 21.Ska + 22.Death Metal + 23.Pranks + 24.Soundtrack + 25.Euro-Techno + 26.Ambient + 27.Trip-Hop + 28.Vocal + 29.Jazz+Funk + 30.Fusion + 31.Trance + 32.Classical + 33.Instrumental + 34.Acid + 35.House + 36.Game + 37.Sound Clip + 38.Gospel + 39.Noise + 40.AlternRock + 41.Bass + 42.Soul + 43.Punk + 44.Space + 45.Meditative + 46.Instrumental Pop + 47.Instrumental Rock + 48.Ethnic + 49.Gothic + 50.Darkwave + 51.Techno-Industrial + 52.Electronic + 53.Pop-Folk + 54.Eurodance + 55.Dream + 56.Southern Rock + 57.Comedy + 58.Cult + 59.Gangsta + 60.Top 40 + 61.Christian Rap + 62.Pop/Funk + 63.Jungle + 64.Native American + 65.Cabaret + 66.New Wave + 67.Psychadelic + 68.Rave + 69.Showtunes + 70.Trailer + 71.Lo-Fi + 72.Tribal + 73.Acid Punk + 74.Acid Jazz + 75.Polka + 76.Retro + 77.Musical + 78.Rock & Roll + 79.Hard Rock + + The following genres are Winamp extensions + + 80.Folk + 81.Folk-Rock + 82.National Folk + 83.Swing + 84.Fast Fusion + 85.Bebob + 86.Latin + 87.Revival + 88.Celtic + 89.Bluegrass + 90.Avantgarde + 91.Gothic Rock + 92.Progressive Rock + 93.Psychedelic Rock + 94.Symphonic Rock + 95.Slow Rock + 96.Big Band + 97.Chorus + 98.Easy Listening + 99.Acoustic + 100.Humour + 101.Speech + 102.Chanson + 103.Opera + 104.Chamber Music + 105.Sonata + 106.Symphony + 107.Booty Bass + 108.Primus + 109.Porn Groove + 110.Satire + 111.Slow Jam + 112.Club + 113.Tango + 114.Samba + 115.Folklore + 116.Ballad + 117.Power Ballad + 118.Rhythmic Soul + 119.Freestyle + 120.Duet + 121.Punk Rock + 122.Drum Solo + 123.Acapella + 124.Euro-House + 125.Dance Hall + + +9. Author's Address + + Written by + + Martin Nilsson + Rydsvgen 246 C. 30 + S-584 34 Linkping + Sweden + + Email: nilsson@id3.org + + + Edited by + + Dirk Mahoney + 57 Pechey Street + Chermside Q + Australia 4032 + + Email: dirk@id3.org + + + Johan Sundstrm + Alsttersgatan 5 A. 34 + S-584 35 Linkping + Sweden + + Email: johan@id3.org + + diff --git a/id3lib/doc/id3v2.gif b/id3lib/doc/id3v2.gif new file mode 100644 index 0000000..a9bd030 Binary files /dev/null and b/id3lib/doc/id3v2.gif differ diff --git a/id3lib/doc/id3v2.ico b/id3lib/doc/id3v2.ico new file mode 100644 index 0000000..ed1421e Binary files /dev/null and b/id3lib/doc/id3v2.ico differ diff --git a/id3lib/doc/id3v2.png b/id3lib/doc/id3v2.png new file mode 100644 index 0000000..76dab63 Binary files /dev/null and b/id3lib/doc/id3v2.png differ diff --git a/id3lib/doc/index.html b/id3lib/doc/index.html new file mode 100644 index 0000000..42e3494 --- /dev/null +++ b/id3lib/doc/index.html @@ -0,0 +1,450 @@ + + + + + id3lib - The ID3v1/ID3v2 Tagging Library + + + + + + + + +
    + + + + + + + + + + + + + +
    + News + + Download + + Mailing list + + Bugs + + Patches + + CVS +
    ----------------------------------------------------------------------
    + +
    + + [ID3v2 logo] + + + + + + +
     id3lib 
    ------
    + + + + +
    Latest Release: + 3.8.3 +
    + +
    + + + +
    Overview
    + + + + +
    + + id3lib is an open-source, + cross-platform software development library for reading, writing, + and manipulating ID3v1 + and ID3v2 tags. It + is an on-going project whose primary goals are full compliance with + the ID3v2 standard, portability + across several platforms, and providing a powerful and feature-rich + API with a highly stable and efficient implementation. + +
    + +
    + + + +
    Features
    + + + +
    + +
    +
    Powerful
    +
    + + id3lib automatically handles most of the low-level details + involved with manipulating ID3v1 and ID3v2 tags in digital audio + files. It provides support for several tasks associated with + manipulating such tags, such as conversion between tagging + formats, identifying valid tags, converting + sizes, synchronisation, compression, and padding. + +
    + +
    Standards-compliant
    +
    + + While many digital audio libraries and applications provide + minimal support + for basic ID3v1 + tagging, few provide the same level of support for the up-and-coming + ID3v2 standard like id3lib. + The developers of id3lib work closely with the ID3v2 specification and go to + great effort to ensure the library correctly handles all its + nuances. By using id3lib for both your ID3v1 and ID3v2 tagging needs, you can be + assured that your application produces tags that comply with + the standard now and in the future. + +
    + +
    Cross-platform
    +
    + + A primary goal for id3lib is cross-platform compatibility. The + library is developed primarily on the GNU/Linux operating system but has + been compiled and tested on other Unix-like OS's as well as + Windows NT. +
    + +
    Multi-language
    +
    + + id3lib aspires to provide interfaces for multiple programming + languages, and currently fully supports both C and C++. A COM + wrapper (id3com) is also supplied allowing VB, VBA, VBScript and + other COM-enabled languages to use the library. + +
    +
    + +
    + +
    + + +
    Development
    + + + + +
    + + All development is centered around the the id3lib project + page hosted by SourceForge. Please go there + to find out the + latest news, download + the current release, join + the mailing list, file a bug + report, submit a patch, + browse the CVS + repository, or just look around. + +
    + +
    + + + +
    Licensing
    + + + +
    + + The id3lib library is open-source software, licensed + under the GNU + Library General Public License (LGPL). In short, this allows + any application to link to and use the library without affecting + their license, while guaranteeing that the id3lib library itself + (and any modifications to it) will remain freely available in + source code form. The project developers therefore greatly + encourage input from everyone, be it with feature suggestions, code + patches, bug reports, or anything. The best way to contribute to + this effort is to subscribe + to the mailing list and join in on the discussions! + +

    + + Versions of ID3Lib prior to and including version 3.05a were + released to the public domain. The last such release is still available + for download. These versions are therefore completely free of + any licence restrictions, but are no longer maintained. + +
    + +
    + + + +
    Documentation
    + + + + + +
    + The following documentation is available for those who wish to + develop software with id3lib: +
      + +
    • + + Documentation for the id3lib API + is available thanks to the Doxygen + documentation system. + +

      + +
    • + + There is a web-readable + translation of the original + ID3Lib manual, written by Dirk Mahoney, the original author + of ID3Lib. The API for the current library has changed + somewhat, but this documentation is still mostly valid. Many + thanks to Scott Moser + for the web-friendly translation. + +

      + +
    • + + James Lin wrote + some guidelines for those + programming with ID3v2 tags. + It, too, is outdated, and some of the links are broken. But + most of the information is still pertinent and quite valuable. + +
    +
    + +
    + + + +
    Projects
    + + + + +
    + + The following software projects have used, do use, or will use + id3lib for their ID3v1 + and ID3v2 tag + processing: + +
      +
    • + + MusicMatch, creators of + the MusicMatch Jukebox for Windows and a previous project + coordinator for ID3Lib + +

      + +
    • + + FreeAmp is a + cross-platform mp3 player and, as of version 2.1, is using + id3lib for their ID3v1/v2 + support. + +

      + +
    • + + empeg, creators of the + world-renowned in-car MP3 player, uses id3lib for reading and + writing ID3v1/v2 tags in their + various tools and utilities. + +

      + +
    • + + The id3v2 tagger is + a GNU/Linux command-line editor for + ID3v1/v2 tags + +

      + +
    • + + Zlurp! is an all-in-one CD + audio tool for Windows that rips, encodes and tags CDs. + +

      + +
    • + + The javpc + project's goal is to turn a PC into an audio/visual unit + sutibale for plugging into a Hi-Fi and TV. + +

      + +
    • + + Sonize is + a collection of small but powerful tools integrated in one + application that organizes and prepares your mp3 files for + publishing on CDROM + +

      + +
    • + + AmpBar uses a modified + version of the 3.05a library in their MP3 player and ID3v2 tag + editor. + +
    + + The following software projects used the original version of + ID3Lib. Whether or not they still do is currently unknown. + + + + If I have listed any of the above in error or if I have + neglected any other projects that use id3lib, please let me + know so that I might update the list accordingly. + +
    + +
    + + + + +
    Contacting the Author
    + + + + +
    + + The id3lib project is currently coordinated by Scott Thomas Haug. The original + ID3Lib library was written by Dirk + Mahoney. + +
    + +
    + + + + + + + + + + + + + +
    ----------------------------------------------------------------------
    + News + + Download + + Mailing list + + Bugs + + Patches + + CVS +
    + +

    + + + + + + +
    + + SourceForge.net + + + + Valid HTML 4.01! +
    +
    + + diff --git a/id3lib/doc/index.html.in b/id3lib/doc/index.html.in new file mode 100644 index 0000000..ae791af --- /dev/null +++ b/id3lib/doc/index.html.in @@ -0,0 +1,450 @@ + + + + + id3lib - The ID3v1/ID3v2 Tagging Library + + + + + + + + +
    + + + + + + + + + + + + + +
    + News + + Download + + Mailing list + + Bugs + + Patches + + CVS +
    ----------------------------------------------------------------------
    + +
    + + [ID3v2 logo] + + + + + + +
     @PACKAGE@ 
    ------
    + + + + +
    Latest Release: + @VERSION@ +
    + +
    + + + +
    Overview
    + + + + +
    + + id3lib is an open-source, + cross-platform software development library for reading, writing, + and manipulating ID3v1 + and ID3v2 tags. It + is an on-going project whose primary goals are full compliance with + the ID3v2 standard, portability + across several platforms, and providing a powerful and feature-rich + API with a highly stable and efficient implementation. + +
    + +
    + + + +
    Features
    + + + +
    + +
    +
    Powerful
    +
    + + id3lib automatically handles most of the low-level details + involved with manipulating ID3v1 and ID3v2 tags in digital audio + files. It provides support for several tasks associated with + manipulating such tags, such as conversion between tagging + formats, identifying valid tags, converting + sizes, synchronisation, compression, and padding. + +
    + +
    Standards-compliant
    +
    + + While many digital audio libraries and applications provide + minimal support + for basic ID3v1 + tagging, few provide the same level of support for the up-and-coming + ID3v2 standard like id3lib. + The developers of id3lib work closely with the ID3v2 specification and go to + great effort to ensure the library correctly handles all its + nuances. By using id3lib for both your ID3v1 and ID3v2 tagging needs, you can be + assured that your application produces tags that comply with + the standard now and in the future. + +
    + +
    Cross-platform
    +
    + + A primary goal for id3lib is cross-platform compatibility. The + library is developed primarily on the GNU/Linux operating system but has + been compiled and tested on other Unix-like OS's as well as + Windows NT. +
    + +
    Multi-language
    +
    + + id3lib aspires to provide interfaces for multiple programming + languages, and currently fully supports both C and C++. A COM + wrapper (id3com) is also supplied allowing VB, VBA, VBScript and + other COM-enabled languages to use the library. + +
    +
    + +
    + +
    + + +
    Development
    + + + + +
    + + All development is centered around the the id3lib project + page hosted by SourceForge. Please go there + to find out the + latest news, download + the current release, join + the mailing list, file a bug + report, submit a patch, + browse the CVS + repository, or just look around. + +
    + +
    + + + +
    Licensing
    + + + +
    + + The id3lib library is open-source software, licensed + under the GNU + Library General Public License (LGPL). In short, this allows + any application to link to and use the library without affecting + their license, while guaranteeing that the id3lib library itself + (and any modifications to it) will remain freely available in + source code form. The project developers therefore greatly + encourage input from everyone, be it with feature suggestions, code + patches, bug reports, or anything. The best way to contribute to + this effort is to subscribe + to the mailing list and join in on the discussions! + +

    + + Versions of ID3Lib prior to and including version 3.05a were + released to the public domain. The last such release is still available + for download. These versions are therefore completely free of + any licence restrictions, but are no longer maintained. + +
    + +
    + + + +
    Documentation
    + + + + + +
    + The following documentation is available for those who wish to + develop software with id3lib: +
      + +
    • + + Documentation for the id3lib API + is available thanks to the Doxygen + documentation system. + +

      + +
    • + + There is a web-readable + translation of the original + ID3Lib manual, written by Dirk Mahoney, the original author + of ID3Lib. The API for the current library has changed + somewhat, but this documentation is still mostly valid. Many + thanks to Scott Moser + for the web-friendly translation. + +

      + +
    • + + James Lin wrote + some guidelines for those + programming with ID3v2 tags. + It, too, is outdated, and some of the links are broken. But + most of the information is still pertinent and quite valuable. + +
    +
    + +
    + + + +
    Projects
    + + + + +
    + + The following software projects have used, do use, or will use + id3lib for their ID3v1 + and ID3v2 tag + processing: + +
      +
    • + + MusicMatch, creators of + the MusicMatch Jukebox for Windows and a previous project + coordinator for ID3Lib + +

      + +
    • + + FreeAmp is a + cross-platform mp3 player and, as of version 2.1, is using + id3lib for their ID3v1/v2 + support. + +

      + +
    • + + empeg, creators of the + world-renowned in-car MP3 player, uses id3lib for reading and + writing ID3v1/v2 tags in their + various tools and utilities. + +

      + +
    • + + The id3v2 tagger is + a GNU/Linux command-line editor for + ID3v1/v2 tags + +

      + +
    • + + Zlurp! is an all-in-one CD + audio tool for Windows that rips, encodes and tags CDs. + +

      + +
    • + + The javpc + project's goal is to turn a PC into an audio/visual unit + sutibale for plugging into a Hi-Fi and TV. + +

      + +
    • + + Sonize is + a collection of small but powerful tools integrated in one + application that organizes and prepares your mp3 files for + publishing on CDROM + +

      + +
    • + + AmpBar uses a modified + version of the 3.05a library in their MP3 player and ID3v2 tag + editor. + +
    + + The following software projects used the original version of + ID3Lib. Whether or not they still do is currently unknown. + + + + If I have listed any of the above in error or if I have + neglected any other projects that use id3lib, please let me + know so that I might update the list accordingly. + +
    + +
    + + + + +
    Contacting the Author
    + + + + +
    + + The id3lib project is currently coordinated by Scott Thomas Haug. The original + ID3Lib library was written by Dirk + Mahoney. + +
    + +
    + + + + + + + + + + + + + +
    ----------------------------------------------------------------------
    + News + + Download + + Mailing list + + Bugs + + Patches + + CVS +
    + +

    + + + + + + +
    + + SourceForge.net + + + + Valid HTML 4.01! +
    +
    + + diff --git a/id3lib/doc/musicmatch.txt b/id3lib/doc/musicmatch.txt new file mode 100644 index 0000000..11a6da6 --- /dev/null +++ b/id3lib/doc/musicmatch.txt @@ -0,0 +1,529 @@ +$Id: musicmatch.txt,v 1.2 2008/05/14 09:21:35 pindakaasmod Exp $ + + + MusicMatch (TM) tag format description + +Status of this document + + This document is a description of a deprecated tagging format. The + information contained herein is not a specification; its intent is to + interpret the format based on hundreds of examples. It also relies heavily + on information obtained by others who have done similar investigations. It + is not based on any official documentation of the format, as such + documentation is not publicly available. Therefore the contents of this + document may change to adjust for newly-discovered information, but the + format itself is unlikely to change due to its deprecation. + + Distribution of this document is unlimited. + + +Abstract + + This document describes the MusicMatch tagging format present in some + digital audio files. This format, like other tagging specifications, + provides a method for storing information about an audio file within itself + to document its contents. This format was developed by MusicMatch and + used exclusively by older versions of Jukebox, their popular, "all-in-one" + MP3 application. + +1. Table of contents + + Status of this document + Abstract + 1. Table of contents + 2. Introduction + 3. Conventions in this document + 4. Tagging format + 4.1. Header + 4.2. Image extension + 4.3. Image binary + 4.4. Unused + 4.5. Version information + 4.6. Audio meta-data + 4.6.1. Single-line text fields + 4.6.2. Non-text fields + 4.6.3. Multi-line text fields + 4.6.4. Internet addresses + 4.6.5. Padding + 4.7. Data offsets + 4.8. Footer + 5. Identifying and parsing a MusicMatch tag + 6. Converting to ID3v2 + 7. Copyright + 8. References + 9. Author's Address + + +2. Introduction + + The following document describes the structure of the tagging format used + by MusicMatch (TM) Jukebox, prior to version 4.0 of that application. This + program is a so-called "All-In-One" MP3 program and provides a CD-Ripper, + WAV-to-MP3 converter, database, and MP3 player. + + The MusicMatch tagging format has gone through several incremental + iterations in its format, although the basic structure has remained fairly + constant throughout its history. The various formats of the MusicMatch tag + have been tightly coupled with the version of Jukebox that created it. As + such, this document will refer to the Jukebox version and tagging format + version interchangeably. + + As of version 4.0, MusicMatch has deprecated the use of this format in + their own Jukebox application, transitioning instead to ID3v2, an open + standard for tagging digital audio. Unfortunately, despite repeated + requests, MusicMatch has not provided to the public any documents + describing this format, and the MusicMatch Jukebox is the only + widely-distributed software application that can read and write these tags. + + As such, this text may not be completely accurate and is surely incomplete, + but it covers enough to the format to enable one to write robust software + to find and parse tags in this format. For example, the id3lib tagging + library's MusicMatch parsing routines were written solely based on the + information found in this document. However, the authors cannot be held + responsible for any inaccuracies or any harm caused by using this + information. One can assume that the specifition is unlikely to change, + given MusicMatch's own abandonment of the format. It should also be noted + that incoporating functionality into applications to write tags in this + format is discouraged, as the format has been officially deprecated by + MusicMatch themselves. + +3. Conventions in this document + + This document borrows heavily from specifications written by Martin + Nillson, author of the ID3v2 tagging standard. Much of the structure, + formatting, and other such conventions used in the ID3v2 specifications are + carried over into this document. + + Text within "" is a text string exactly as it appears in a tag. Numbers + preceded with $ are hexadecimal and numbers preceded with % are binary. $xx + is used to indicate a byte with unknown content. + +4. Tag overview + + The MusicMatch Tagging Format was designed to store specific types of audio + meta-data inside the audio file itself. As the format was used exclusively + by the MusicMatch Jukebox application, it is used only with MPEG-1/2 layer + III files encoded with that program. However, its tagging format is not + inherently exclusive of other audio formats, and could conceivably be + used with other types of encodings. + + MusicMatch tags were originally designed to come at the very end of MP3 + files, after all of the MP3 audio frames. Starting with Jukebox version + 3.1, the application became more ID3-friendly and started placing ID3v1 + tags after the MusicMatch tag as well. In practice, since very few + applications outside of the MusicMatch Jukebox are capable of reading and + understanding this format, it is not unusual to find MusicMatch tags + "buried" within mp3 files, coming before other types of tagging formats in + a file, such as Lyrics3 or ID3v2.4.0. Such "relocations" are not uncommon, + and therefore any software application that intends to find, read, and + parse MusicMatch tags should be flexible in this endeavor, despite the + apparent intentions of the original specification. + + Although various sections of a MusicMatch tag are fixed in length, other + sections are not, and so tag lengths can vary from one file to another. A + valid MusicMatch tag will be at least 8 kilobytes (8192 bytes) in length. + Those tags with image data will often be much larger. + + The byte-order in 4-byte pointers and multibyte numbers for MusicMatch tags + is least-significant byte (LSB) first, also known as "little endian". For + example, $12345678 is encoded as $78 56 34 12. + + Overall tag structure: + + +-----------------------------+ + | Header | + | (256 bytes, OPTIONAL) | + +-----------------------------+ + | Image extension (4 bytes) | + +-----------------------------+ + | Image binary | + | (var. length >= 4 bytes) | + +-----------------------------+ + | Unused (4 bytes) | + +-----------------------------+ + | Version info (256 bytes) | + +-----------------------------+ + | Audio meta-data | + | (var. length >= 7868 bytes) | + +-----------------------------+ + | Data offsets (20 bytes) | + +-----------------------------+ + | Footer (48 bytes) | + +-----------------------------+ + + This document will describe the various sections of the tag in the order + listed above (that is, in the sequential order that they appear when + reading the tag from beginning to end). However, due to the nature of the + tag's format, in practice the tag's sections will often be parsed in the + reverse order. A robust parsing algorithm will be suggested and described + later in the document. + +4.1. Header + + An optional tag header often precedes the tag data in a MusicMatch tag. + Although the rules that determine this header's required presence are + unknown, the header is usually found in tag versions up to and including + 2.50, and is usually lacking otherwise. Luckily, its format is rigid and + therefore its presence is easy to determine. The data in the header are + not vital to the correct parsing of the rest of the tag and can thus be + discarded. The header is the only optional section in a MusicMatch tag. + All other sections are required to consider the tag valid. + + The header section is always 256 bytes in length. It begins with three + 10-byte subsections, and ends with 226 bytes of space ($20) padding. Each + of the first three subsections contains an 8-byte ASCII text string + followed by two bytes of null ($00) padding. + + The first subsection serves as a sync string: its 8-byte string is always + "18273645". + + The second subsection's 8-byte string is the version of the Xing encoder + used to encode the mp3 file. The last four bytes of this string are + usually '0' ($30). An example of this string is "1.010000". + + The third and final 10-byte subsection is the version of the MusicMatch + Jukebox used to encode the mp3 file. The last four bytes of this string + are usually '0' ($30). An example of this string is "2.120000". + + Sync string "18273645" + Null padding $00 00 + Xing encoder version <8-byte numerical ASCII string> + Null padding $00 00 + MusicMatch version <8-byte numerical ASCII string> + Null padding $00 00 + Space padding 226 * $20 + +4.2. Image extension + + MusicMatch tags can contain at most one image. This first required section + is the extension of the image when saved as a file (for example, "jpg" or + "bmp"). This section is 4 bytes in length, and the data is padded with + spaces ($20) if the extension doesn't use all 4 bytes (in practice, 3-byte + extensions are the most prevalent). Likewise, tags without images have all + spaces for this section (4 * $20). + + Picture extension $xx xx xx xx + +4.3. Image binary + + When an image is present in the tag, the image binary section consists of + two fields. The first field is the size of the image data, in bytes. The + second is the actual image data. + + Image size $xx xx xx xx + Image data + + If no image is present, the image binary section consists of exactly four + null bytes ($00 00 00 00). + +4.4. Unused + + This section is never used, to the best of the author's knowledge. It is + always 4 null ($00) bytes. + + Null padding $00 00 00 00 + +4.5. Version information + + This section of the tag has the exact same format as the header. Unlike + the header, this section is required for the tag to be considered valid. + + Sync string "18273645" + Null padding $00 00 + Xing encoder version <8-byte numerical ASCII string> + Null padding $00 00 + MusicMatch version <8-byte numerical ASCII string> + Null padding $00 00 + Space padding 226 * $20 + +4.6. Audio meta-data + + The audio meta-data is the heart of the MusicMatch tag. It contains most + of the pertinent information found in other tagging formats (song title, + album title, artist, etc.) and some that are unique to this format (mood, + prefernce, situation). + + In all versions of the MusicMatch format up to and including 3.00, this + section is always 7868 bytes in length. All subsequent versions allowed + three possible lengths for this section: 7936, 8004, and 8132 bytes. The + conditions under which a particular length from these three possibilities + was used is unknown. In all cases, this section is padded with dashes + ($2D) to achieve this constant size. + + Due to the great number of fields in this portion of the tag, they are + divided amongst the next four sections of the document: single-line text + fields, non-text fields, multi-line text fields, and internet addresses. + This clarification is somewhat arbitrary and somewhat inaccurate (some of + the fields described as "non-text" are indeed ASCII strings). However, the + clarification does allow for easier description of the meta-data as a + whole. At any rate, the actual fields in this section of the tag appear + sequentially in the order presented. + + +4.6.1. Single-line text fields + + The first group entries in this section of the tag are variable-length + ASCII text strings. Each of these strings are preceded by a two-byte field + describing the size of the following string (again, in LSB order). + Multiple entries in a text field are separated by a semicolon ($3B). An + empty (and non-existant) text field is indicated by a size field of 0 ($00 + 00). + + The first three of these entries are fairly-self explanatory: song title, + album title, and artist name. + + The final five entries are a little less common: Genre, Tempo, Mood, + Situation, and Preference. These fields can contain any information, but + do to the interface and default set-up for the Jukebox application, they + typically are limited to a subset of possibilities. + + The Genre entry differs from the ID3v1 tagging format in that it allows + a full-text genre description, whereas ID3v1 maps a number to a list of + genres. Again, the genre description could be anything, but the interface + in Jukebox typically limited most users to the standard ID3v1 genres. + + The Tempo entry is intended to describe the general tempo of the song. The + Jukebox application provided the following defaults: None, Fast, Pretty + fast, Moderate, Pretty slow, and Slow. + + The Mood entry describes what type of mood the audio establishes: Typical + values include the following: None, Wild, Upbeat, Morose, Mellow, Tranquil, + and Comatose. + + The Situation entry describes in which situation this music is best played. + Expect the following: None, Dance, Party, Romantic, Dinner, Background, + Seasonal, Rave, and Drunken Brawl. + + The Preference entry allows the user to rate the song. Possible values + include the following: None, Excellent, Very Good, Good, Fair, Poor, and + Bad Taste. + + Song title length $xx xx + Song title + Album title length $xx xx + Album title + Artist name length $xx xx + Artist name + Genre length $xx xx + Genre + Tempo length $xx xx + Tempo + Mood length $xx xx + Mood + Situation length $xx xx + Situation + Preference length $xx xx + Preference + +4.6.2. Non-text fields + + The next group of fields is described here as "non-text". They are + probably better described as entries that are auto-created (i.e., not + entered in by a user), although this isn't entirely accurate, either, as + the track number field is determined by user input. At any rate, they've + been separated to clarify the presentation of the material. + + The "Song duration" entry consists of two fields: a size and text. The + text is formatted as "minutes:seconds", and thus the size field is + typically 4 ($04 00). + + The only field that is neither a string nor a LSB numerical value is the + creation date. It is 8-byte floating-point value. It can be interpreted + as a TDateTime in the Delphi programming language, where the integral + portion is the number of elapsed days since 1899-12-30, and the mantissa + portion represents the fractional portion of that day, where .0 would be + midnight, .5 would be noon, and .99999... would be just before midnight + of the next day. In practice, this field is typically unused and will be + filled with 8 null ($00) bytes. + + The next field is the play counter, presumably maintained by the Jukebox + application. Most of the time this field is unused, and is typically 0 + ($00 00 00 00). + + The next entry is a size/text combo and represents the original filename + and path. As these tags were created almost universally on Windows + machines, the entries are typically in the form of "C:\path\to\file.mp3". + + The next size/text entry is the album serial number fetched from the online + CDDB when a track is ripped with MusicMatch. + + The final field is the track number, usually entered automatically when + ripping, encoding, and tagging the audio off from a CD using CDDB. + + Song duration length $xx xx + Song duration + Creation date <8-byte IEEE-64 float> + Play counter $xx xx xx xx + Original filename length $xx xx + Original filename + Serial number length $xx xx + Serial number + Track number $xx xx + +4.6.3. Multi-line text fields + + The next three entries are typically multi-line entries. All line + separators use the Windows-standard carriage return ($0D 0A). As with the + single-line text entries, the text fields are preceded by LSB size fields + which indicate their length. + + Notes length $xx xx + Notes + Artist bio length $xx xx + Artist bio + Lyrics length $xx xx + Lyrics + +4.6.4. Internet addresses + + The final group of meta-data are internet addresses. As with other text + entries, the text fields are preceded by LSB size fields. + + Artist URL length $xx xx + Artist URL + "Buy CD" URL length $xx xx + "Buy CD" URL + Artist email length $xx xx + Artist email + +4.6.5. Padding + + The data fields are then followed by 16 null ($00) bytes. Presumably these + were intended for (up to 8) future text fields. + + The remainder of this section is padded with '-' ($2D) characters. + +4.7. Data offsets + + This section of the tag was intended to give offsets into the file for each + of the five major required sections of the tag. The offsets, however, are + off by 1; for searching a file where the first position is offset 0, the + offset given here must be reduced by 1. In practice, however, these + offsets can often be invalid, since the data that comes before may be + increased or reduces (such as when an ID3v2 tag is appended to the file). + Therefore these offsets are best used to calculate the size of the sections + by finding the difference of two consecutive offsets. Obviously, the size + of the audio meta-data section must be calculated in a different manner. + + Image extension offset $xx xx xx xx + Image binary offset $xx xx xx xx + Unused offset $xx xx xx xx + Version info offset $xx xx xx xx + Audio meta-data offset $xx xx xx xx + +4.8. Footer + + Unlike the header, the footer is a required section of any MusicMatch tag, + and checking for its existance is an easy way to determine if a file has a + MusicMatch tag. It is always 48 bytes in length. The first 19 bytes is + the company name "Brava Software Inc." (Note: it seems that the company + name has officially changed to MusicMatch, as "Brava Software" is not + mentioned anywhere on their website), followed by 13 bytes of space ($20) + padding. The next 4 bytes is the tag version as a numerical ASCII string + (e.g., "3.05"), and should match the version string found in the Version + section and the (optional) header. This is followed by 12 bytes of space + ($20) padding. + + Signature "Brava Software Inc." + Space padding 13 * $20 + Tag version <4-byte numerical ASCII string> + Space padding 12 * $20 + +5. Identifying and parsing a MusicMatch tag + + Finding and parsing a MusicMatch tag is not difficult to do, but due to + lack of foresight and questionable design decisions by MusicMatch, care + must be taken to ensure it is done correctly. + + + +6. Converting to ID3v2 + + As of Jukebox 4.0, MusicMatch has abandoned the MusicMatch tagging format + in favor of the open standard ID3v2. The Jukebox application will convert + old tags to ID3v2 upon request, but as this is a closed application that + serves a limited number of platforms (currently on Windows and Macintosh), + having a public specification for performing this mapping is necessary. As + ID3v2 can encapsulate all of the information found in the original + MusicMatch format while being infinitely more flexible, the decision to + convert shouldn't be a difficult one. + + + +7. Copyright + + Copyright (C) Scott Thomas Haug 2000. All Rights Reserved. + + This document and translations of it may be copied and furnished to others, + and derivative works that comment on or otherwise explain it or assist in + its implementation may be prepared, copied, published and distributed, in + whole or in part, without restriction of any kind, provided that a + reference to this document is included on all such copies and derivative + works. However, this document itself may not be modified in any way and + reissued as the original document. + + The limited permissions granted above are perpetual and will not be + revoked. + + This document and the information contained herein is provided on an 'AS + IS' basis and THE AUTHORS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + +8. References + + [MMTrailer] Peter "The Videoripper" Luijer, + 'Description of the MusicMatch trailer in MP3 files' + + + + [ID3v2] Martin Nilsson, 'ID3v2 informal standard'. + + + + [id3lib] Scott Thomas Haug, 'The ID3v1/ID3v2 Tagging Library' + + + + [ISO-8859-1] ISO/IEC DIS 8859-1. + '8-bit single-byte coded graphic character sets, Part 1: Latin + alphabet No. 1.' Technical committee / subcommittee: JTC 1 / SC 2 + + [JFIF] 'JPEG File Interchange Format, version 1.02' + + + + [MPEG] ISO/IEC 11172-3:1993. + 'Coding of moving pictures and associated audio for digital storage + media at up to about 1,5 Mbit/s, Part 3: Audio.' + Technical committee / subcommittee: JTC 1 / SC 29 + and + ISO/IEC 13818-3:1995 + 'Generic coding of moving pictures and associated audio information, + Part 3: Audio.' + Technical committee / subcommittee: JTC 1 / SC 29 + and + ISO/IEC DIS 13818-3 + 'Generic coding of moving pictures and associated audio information, + Part 3: Audio (Revision of ISO/IEC 13818-3:1995)' + + [URL] T. Berners-Lee, L. Masinter & M. McCahill, 'Uniform Resource + Locators (URL)', RFC 1738, December 1994. + + + + [UTF-8] F. Yergeau, 'UTF-8, a transformation format of ISO 10646', + RFC 2279, January 1998. + + + + +9. Author's Address + + Written by + + Scott Thomas Haug + Seattle, WA + USA \ No newline at end of file diff --git a/id3lib/examples/221-compressed.tag b/id3lib/examples/221-compressed.tag new file mode 100644 index 0000000..121a240 Binary files /dev/null and b/id3lib/examples/221-compressed.tag differ diff --git a/id3lib/examples/230-compressed.tag b/id3lib/examples/230-compressed.tag new file mode 100644 index 0000000..238dc85 Binary files /dev/null and b/id3lib/examples/230-compressed.tag differ diff --git a/id3lib/examples/230-picture.tag b/id3lib/examples/230-picture.tag new file mode 100644 index 0000000..7c29582 Binary files /dev/null and b/id3lib/examples/230-picture.tag differ diff --git a/id3lib/examples/230-syncedlyrics.tag b/id3lib/examples/230-syncedlyrics.tag new file mode 100644 index 0000000..3f152bb Binary files /dev/null and b/id3lib/examples/230-syncedlyrics.tag differ diff --git a/id3lib/examples/230-unicode.tag b/id3lib/examples/230-unicode.tag new file mode 100644 index 0000000..1908713 Binary files /dev/null and b/id3lib/examples/230-unicode.tag differ diff --git a/id3lib/examples/Makefile.am b/id3lib/examples/Makefile.am new file mode 100644 index 0000000..8b087fb --- /dev/null +++ b/id3lib/examples/Makefile.am @@ -0,0 +1,98 @@ +# Copyright (C) 1999 Scott Thomas Haug +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +if ID3_NEEDDEBUG +ID3_DEBUG_LIBS = -lcwd -lbfd -liberty +else +ID3_DEBUG_LIBS = +endif + +if ID3_NEEDZLIB +zlib_lib = $(top_builddir)/zlib/src/libz.la +zlib_include = -I$(top_srcdir)/zlib/include +else +zlib_lib = -lz +zlib_include = +endif + +if ID3_NEEDGETOPT_LONG +getopt_lib = getopt.o getopt1.o +else +getopt_lib = +endif + +LDADD = $(top_builddir)/src/libid3.la $(zlib_lib) $(ID3_DEBUG_LIBS) $(getopt_lib) + +INCLUDES = @ID3LIB_DEBUG_FLAGS@ -I$(top_srcdir)/include + +bin_PROGRAMS = id3info id3convert id3tag id3cp +check_PROGRAMS = \ + id3simple \ + testpic \ + testunicode \ + testcompression \ + testremove \ + testio \ + get_pic \ + findstr \ + findeng + +id3cp_SOURCES = demo_copy_options.c demo_copy.cpp + +id3info_SOURCES = demo_info_options.c demo_info.cpp + +id3convert_SOURCES = demo_convert_options.c demo_convert.cpp + +id3tag_SOURCES = demo_tag_options.c demo_tag.cpp + +id3simple_SOURCES = demo_simple.cpp +testpic_SOURCES = test_pic.cpp +testunicode_SOURCES = test_unicode.cpp +testcompression_SOURCES = test_compression.cpp +testremove_SOURCES = test_remove.cpp +testio_SOURCES = test_io.cpp +get_pic_SOURCES = get_pic.cpp +findeng_SOURCES = findeng.cpp +findstr_SOURCES = findstr.cpp + +tag_files = \ + composer.jpg \ + demo_main.cpp \ + 221-compressed.tag \ + 230-compressed.tag \ + 230-picture.tag \ + 230-unicode.tag \ + 230-syncedlyrics.tag \ + thatspot.tag \ + ozzy.tag \ + crc53865.mp3 + +getopt_files = \ + getopt.c \ + getopt.h \ + getopt1.c + +header_files = \ + demo_tag_options.h \ + demo_copy_options.h \ + demo_info_options.h \ + demo_convert_options.h + +EXTRA_DIST = \ + $(tag_files) \ + $(getopt_files) \ + $(header_files) + +PROGNAME = gengetopt + +%.c: $(srcdir)/%.ggo + $(PROGNAME) --file-name=$* --unamed-opts --input=$< + +demo_%.cpp: demo_%_options.c diff --git a/id3lib/examples/Makefile.in b/id3lib/examples/Makefile.in new file mode 100644 index 0000000..d6d9da3 --- /dev/null +++ b/id3lib/examples/Makefile.in @@ -0,0 +1,986 @@ +# Makefile.in generated by automake 1.6.2 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 1999 Scott Thomas Haug +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOX_DIR_HTML = @DOX_DIR_HTML@ +DOX_DIR_LATEX = @DOX_DIR_LATEX@ +DOX_DIR_MAN = @DOX_DIR_MAN@ +DOX_DIR_RTF = @DOX_DIR_RTF@ +ECHO = @ECHO@ +ID3LIB_BINARY_AGE = @ID3LIB_BINARY_AGE@ +ID3LIB_DEBUG_FLAGS = @ID3LIB_DEBUG_FLAGS@ +ID3LIB_FULLNAME = @ID3LIB_FULLNAME@ +ID3LIB_INTERFACE_AGE = @ID3LIB_INTERFACE_AGE@ +ID3LIB_MAJOR_VERSION = @ID3LIB_MAJOR_VERSION@ +ID3LIB_MINOR_VERSION = @ID3LIB_MINOR_VERSION@ +ID3LIB_NAME = @ID3LIB_NAME@ +ID3LIB_PATCH_VERSION = @ID3LIB_PATCH_VERSION@ +ID3LIB_VERSION = @ID3LIB_VERSION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +cxxflags_set = @cxxflags_set@ +install_sh = @install_sh@ + +@ID3_NEEDDEBUG_TRUE@ID3_DEBUG_LIBS = -lcwd -lbfd -liberty +@ID3_NEEDDEBUG_FALSE@ID3_DEBUG_LIBS = + +@ID3_NEEDZLIB_TRUE@zlib_lib = $(top_builddir)/zlib/src/libz.la +@ID3_NEEDZLIB_FALSE@zlib_lib = -lz +@ID3_NEEDZLIB_TRUE@zlib_include = -I$(top_srcdir)/zlib/include +@ID3_NEEDZLIB_FALSE@zlib_include = + +@ID3_NEEDGETOPT_LONG_TRUE@getopt_lib = getopt.o getopt1.o +@ID3_NEEDGETOPT_LONG_FALSE@getopt_lib = + +LDADD = $(top_builddir)/src/libid3.la $(zlib_lib) $(ID3_DEBUG_LIBS) $(getopt_lib) + +INCLUDES = @ID3LIB_DEBUG_FLAGS@ -I$(top_srcdir)/include + +bin_PROGRAMS = id3info id3convert id3tag id3cp +check_PROGRAMS = \ + id3simple \ + testpic \ + testunicode \ + testcompression \ + testremove \ + testio \ + get_pic \ + findstr \ + findeng + + +id3cp_SOURCES = demo_copy_options.c demo_copy.cpp + +id3info_SOURCES = demo_info_options.c demo_info.cpp + +id3convert_SOURCES = demo_convert_options.c demo_convert.cpp + +id3tag_SOURCES = demo_tag_options.c demo_tag.cpp + +id3simple_SOURCES = demo_simple.cpp +testpic_SOURCES = test_pic.cpp +testunicode_SOURCES = test_unicode.cpp +testcompression_SOURCES = test_compression.cpp +testremove_SOURCES = test_remove.cpp +testio_SOURCES = test_io.cpp +get_pic_SOURCES = get_pic.cpp +findeng_SOURCES = findeng.cpp +findstr_SOURCES = findstr.cpp + +tag_files = \ + composer.jpg \ + demo_main.cpp \ + 221-compressed.tag \ + 230-compressed.tag \ + 230-picture.tag \ + 230-unicode.tag \ + 230-syncedlyrics.tag \ + thatspot.tag \ + ozzy.tag \ + crc53865.mp3 + + +getopt_files = \ + getopt.c \ + getopt.h \ + getopt1.c + + +header_files = \ + demo_tag_options.h \ + demo_copy_options.h \ + demo_info_options.h \ + demo_convert_options.h + + +EXTRA_DIST = \ + $(tag_files) \ + $(getopt_files) \ + $(header_files) + + +PROGNAME = gengetopt +subdir = examples +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = id3info$(EXEEXT) id3convert$(EXEEXT) id3tag$(EXEEXT) \ + id3cp$(EXEEXT) +check_PROGRAMS = id3simple$(EXEEXT) testpic$(EXEEXT) \ + testunicode$(EXEEXT) testcompression$(EXEEXT) \ + testremove$(EXEEXT) testio$(EXEEXT) get_pic$(EXEEXT) \ + findstr$(EXEEXT) findeng$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) + +am_findeng_OBJECTS = findeng.$(OBJEXT) +findeng_OBJECTS = $(am_findeng_OBJECTS) +findeng_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@findeng_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@findeng_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@findeng_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@findeng_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@findeng_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@findeng_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@findeng_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@findeng_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +findeng_LDFLAGS = +am_findstr_OBJECTS = findstr.$(OBJEXT) +findstr_OBJECTS = $(am_findstr_OBJECTS) +findstr_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@findstr_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@findstr_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@findstr_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@findstr_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@findstr_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@findstr_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@findstr_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@findstr_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +findstr_LDFLAGS = +am_get_pic_OBJECTS = get_pic.$(OBJEXT) +get_pic_OBJECTS = $(am_get_pic_OBJECTS) +get_pic_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@get_pic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@get_pic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@get_pic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@get_pic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@get_pic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@get_pic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@get_pic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@get_pic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +get_pic_LDFLAGS = +am_id3convert_OBJECTS = demo_convert_options.$(OBJEXT) \ + demo_convert.$(OBJEXT) +id3convert_OBJECTS = $(am_id3convert_OBJECTS) +id3convert_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@id3convert_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@id3convert_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@id3convert_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@id3convert_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@id3convert_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@id3convert_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@id3convert_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@id3convert_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +id3convert_LDFLAGS = +am_id3cp_OBJECTS = demo_copy_options.$(OBJEXT) demo_copy.$(OBJEXT) +id3cp_OBJECTS = $(am_id3cp_OBJECTS) +id3cp_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@id3cp_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@id3cp_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@id3cp_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@id3cp_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@id3cp_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@id3cp_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@id3cp_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@id3cp_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +id3cp_LDFLAGS = +am_id3info_OBJECTS = demo_info_options.$(OBJEXT) demo_info.$(OBJEXT) +id3info_OBJECTS = $(am_id3info_OBJECTS) +id3info_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@id3info_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@id3info_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@id3info_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@id3info_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@id3info_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@id3info_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@id3info_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@id3info_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +id3info_LDFLAGS = +am_id3simple_OBJECTS = demo_simple.$(OBJEXT) +id3simple_OBJECTS = $(am_id3simple_OBJECTS) +id3simple_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@id3simple_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@id3simple_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@id3simple_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@id3simple_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@id3simple_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@id3simple_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@id3simple_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@id3simple_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +id3simple_LDFLAGS = +am_id3tag_OBJECTS = demo_tag_options.$(OBJEXT) demo_tag.$(OBJEXT) +id3tag_OBJECTS = $(am_id3tag_OBJECTS) +id3tag_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@id3tag_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@id3tag_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@id3tag_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@id3tag_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@id3tag_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@id3tag_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@id3tag_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@id3tag_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +id3tag_LDFLAGS = +am_testcompression_OBJECTS = test_compression.$(OBJEXT) +testcompression_OBJECTS = $(am_testcompression_OBJECTS) +testcompression_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@testcompression_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@testcompression_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@testcompression_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@testcompression_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@testcompression_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@testcompression_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@testcompression_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@testcompression_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +testcompression_LDFLAGS = +am_testio_OBJECTS = test_io.$(OBJEXT) +testio_OBJECTS = $(am_testio_OBJECTS) +testio_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@testio_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@testio_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@testio_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@testio_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@testio_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@testio_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@testio_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@testio_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +testio_LDFLAGS = +am_testpic_OBJECTS = test_pic.$(OBJEXT) +testpic_OBJECTS = $(am_testpic_OBJECTS) +testpic_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@testpic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@testpic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@testpic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@testpic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@testpic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@testpic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@testpic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@testpic_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +testpic_LDFLAGS = +am_testremove_OBJECTS = test_remove.$(OBJEXT) +testremove_OBJECTS = $(am_testremove_OBJECTS) +testremove_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@testremove_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@testremove_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@testremove_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@testremove_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@testremove_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@testremove_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@testremove_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@testremove_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +testremove_LDFLAGS = +am_testunicode_OBJECTS = test_unicode.$(OBJEXT) +testunicode_OBJECTS = $(am_testunicode_OBJECTS) +testunicode_LDADD = $(LDADD) +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@testunicode_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@testunicode_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@testunicode_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@testunicode_DEPENDENCIES = \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_FALSE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@testunicode_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@testunicode_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_FALSE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@testunicode_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ $(top_builddir)/zlib/src/libz.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_TRUE@ getopt1.o +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@testunicode_DEPENDENCIES = \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ $(top_builddir)/src/libid3.la \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt.o \ +@ID3_NEEDDEBUG_TRUE@@ID3_NEEDGETOPT_LONG_TRUE@@ID3_NEEDZLIB_FALSE@ getopt1.o +testunicode_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/demo_convert.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/demo_convert_options.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/demo_copy.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/demo_copy_options.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/demo_info.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/demo_info_options.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/demo_simple.Po ./$(DEPDIR)/demo_tag.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/demo_tag_options.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/findeng.Po ./$(DEPDIR)/findstr.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/get_pic.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/test_compression.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/test_io.Po ./$(DEPDIR)/test_pic.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/test_remove.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/test_unicode.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CFLAGS = @CFLAGS@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(findeng_SOURCES) $(findstr_SOURCES) $(get_pic_SOURCES) \ + $(id3convert_SOURCES) $(id3cp_SOURCES) $(id3info_SOURCES) \ + $(id3simple_SOURCES) $(id3tag_SOURCES) \ + $(testcompression_SOURCES) $(testio_SOURCES) $(testpic_SOURCES) \ + $(testremove_SOURCES) $(testunicode_SOURCES) +DIST_COMMON = Makefile.am Makefile.in +SOURCES = $(findeng_SOURCES) $(findstr_SOURCES) $(get_pic_SOURCES) $(id3convert_SOURCES) $(id3cp_SOURCES) $(id3info_SOURCES) $(id3simple_SOURCES) $(id3tag_SOURCES) $(testcompression_SOURCES) $(testio_SOURCES) $(testpic_SOURCES) $(testremove_SOURCES) $(testunicode_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + p1=`echo "$$p1" | sed -e 's,^.*/,,'`; \ + f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + f=`echo "$$f" | sed -e 's,^.*/,,'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +findeng$(EXEEXT): $(findeng_OBJECTS) $(findeng_DEPENDENCIES) + @rm -f findeng$(EXEEXT) + $(CXXLINK) $(findeng_LDFLAGS) $(findeng_OBJECTS) $(findeng_LDADD) $(LIBS) +findstr$(EXEEXT): $(findstr_OBJECTS) $(findstr_DEPENDENCIES) + @rm -f findstr$(EXEEXT) + $(CXXLINK) $(findstr_LDFLAGS) $(findstr_OBJECTS) $(findstr_LDADD) $(LIBS) +get_pic$(EXEEXT): $(get_pic_OBJECTS) $(get_pic_DEPENDENCIES) + @rm -f get_pic$(EXEEXT) + $(CXXLINK) $(get_pic_LDFLAGS) $(get_pic_OBJECTS) $(get_pic_LDADD) $(LIBS) +id3convert$(EXEEXT): $(id3convert_OBJECTS) $(id3convert_DEPENDENCIES) + @rm -f id3convert$(EXEEXT) + $(CXXLINK) $(id3convert_LDFLAGS) $(id3convert_OBJECTS) $(id3convert_LDADD) $(LIBS) +id3cp$(EXEEXT): $(id3cp_OBJECTS) $(id3cp_DEPENDENCIES) + @rm -f id3cp$(EXEEXT) + $(CXXLINK) $(id3cp_LDFLAGS) $(id3cp_OBJECTS) $(id3cp_LDADD) $(LIBS) +id3info$(EXEEXT): $(id3info_OBJECTS) $(id3info_DEPENDENCIES) + @rm -f id3info$(EXEEXT) + $(CXXLINK) $(id3info_LDFLAGS) $(id3info_OBJECTS) $(id3info_LDADD) $(LIBS) +id3simple$(EXEEXT): $(id3simple_OBJECTS) $(id3simple_DEPENDENCIES) + @rm -f id3simple$(EXEEXT) + $(CXXLINK) $(id3simple_LDFLAGS) $(id3simple_OBJECTS) $(id3simple_LDADD) $(LIBS) +id3tag$(EXEEXT): $(id3tag_OBJECTS) $(id3tag_DEPENDENCIES) + @rm -f id3tag$(EXEEXT) + $(CXXLINK) $(id3tag_LDFLAGS) $(id3tag_OBJECTS) $(id3tag_LDADD) $(LIBS) +testcompression$(EXEEXT): $(testcompression_OBJECTS) $(testcompression_DEPENDENCIES) + @rm -f testcompression$(EXEEXT) + $(CXXLINK) $(testcompression_LDFLAGS) $(testcompression_OBJECTS) $(testcompression_LDADD) $(LIBS) +testio$(EXEEXT): $(testio_OBJECTS) $(testio_DEPENDENCIES) + @rm -f testio$(EXEEXT) + $(CXXLINK) $(testio_LDFLAGS) $(testio_OBJECTS) $(testio_LDADD) $(LIBS) +testpic$(EXEEXT): $(testpic_OBJECTS) $(testpic_DEPENDENCIES) + @rm -f testpic$(EXEEXT) + $(CXXLINK) $(testpic_LDFLAGS) $(testpic_OBJECTS) $(testpic_LDADD) $(LIBS) +testremove$(EXEEXT): $(testremove_OBJECTS) $(testremove_DEPENDENCIES) + @rm -f testremove$(EXEEXT) + $(CXXLINK) $(testremove_LDFLAGS) $(testremove_OBJECTS) $(testremove_LDADD) $(LIBS) +testunicode$(EXEEXT): $(testunicode_OBJECTS) $(testunicode_DEPENDENCIES) + @rm -f testunicode$(EXEEXT) + $(CXXLINK) $(testunicode_LDFLAGS) $(testunicode_OBJECTS) $(testunicode_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_convert.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_convert_options.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_copy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_copy_options.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_info.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_info_options.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_simple.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_tag.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_tag_options.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/findeng.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/findstr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_pic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_compression.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_remove.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_unicode.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + +.c.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CCDEPMODE = @CCDEPMODE@ + +.cpp.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` + +.cpp.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CXXDEPMODE = @CXXDEPMODE@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +check: check-am +all-am: Makefile $(PROGRAMS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ + clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-checkPROGRAMS clean-generic clean-libtool distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-binPROGRAMS install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am + + +%.c: $(srcdir)/%.ggo + $(PROGNAME) --file-name=$* --unamed-opts --input=$< + +demo_%.cpp: demo_%_options.c +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/id3lib/examples/composer.jpg b/id3lib/examples/composer.jpg new file mode 100644 index 0000000..4e55bef Binary files /dev/null and b/id3lib/examples/composer.jpg differ diff --git a/id3lib/examples/crc53865.mp3 b/id3lib/examples/crc53865.mp3 new file mode 100644 index 0000000..78fa397 Binary files /dev/null and b/id3lib/examples/crc53865.mp3 differ diff --git a/id3lib/examples/demo_convert.cpp b/id3lib/examples/demo_convert.cpp new file mode 100644 index 0000000..cd40a18 --- /dev/null +++ b/id3lib/examples/demo_convert.cpp @@ -0,0 +1,163 @@ +// $Id: demo_convert.cpp,v 1.2 2008/05/14 09:21:36 pindakaasmod Exp $ +// +// The authors have released ID3Lib as Public Domain (PD) and claim no +// copyright, patent or other intellectual property protection in this work. +// This means that it may be modified, redistributed and used in commercial +// and non-commercial software and hardware without restrictions. ID3Lib is +// distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either +// express or implied. +// +// The ID3Lib authors encourage improvements and optimisations to be sent to +// the ID3Lib coordinator, currently Dirk Mahoney (dirk@id3.org). Approved +// submissions may be altered, and will be included and released under these +// terms. + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include "id3/id3lib_streams.h" +#include "id3/tag.h" +#include "demo_convert_options.h" + +using std::cout; +using std::endl; + +static const char* VERSION_NUMBER = "$Revision: 1.2 $"; + +void PrintUsage(const char *sName) +{ + cout << "Converts between id3v1 and id3v2 tags of an mp3 file." << endl; + cout << endl; + cout << "Will render both types of tag by default. Only the last" << endl + << "tag type indicated in the option list will be used. Non-" << endl + << "rendered will remain unchanged in the original file. Will" << endl + << "also parse and convert Lyrics3 v2.0 frames, but will not" << endl + << "render them." << endl; +} + +void PrintVersion(const char *sName) +{ + size_t nIndex; + cout << sName << " "; + for (nIndex = 0; nIndex < strlen(VERSION_NUMBER); nIndex++) + { + if (VERSION_NUMBER[nIndex] == ' ') + { + break; + } + } + nIndex++; + for (; nIndex < strlen (VERSION_NUMBER); nIndex++) + { + if (VERSION_NUMBER[nIndex] == ' ') + { + break; + } + cout << VERSION_NUMBER[nIndex]; + } + cout << endl; + cout << "Uses " << ID3LIB_FULL_NAME << endl << endl; + + cout << "This program converts and strips ID3v1/1.1 and Lyrics3 v2.0" << endl; + cout << "tags to ID3v2 tags." << endl << endl; +} + +void DisplayTags(ostream &os, luint nTags) +{ + if (!((nTags & ID3TT_ID3V1) || (nTags & ID3TT_ID3V2))) + { + os << "no tag"; + } + if (nTags & ID3TT_ID3V1) + { + os << "v1"; + } + if ((nTags & ID3TT_ID3V1) && (nTags & ID3TT_ID3V2)) + { + os << " and "; + } + if (nTags & ID3TT_ID3V2) + { + os << "v2"; + } +} + +int main( unsigned int argc, char * const argv[]) +{ + flags_t ulFlag = ID3TT_ALL; + gengetopt_args_info args; + + if (cmdline_parser(argc, argv, &args) != 0) + { + exit(1); + } + +#if defined ID3_ENABLE_DEBUG + if (args.warning_flag) + { + ID3D_INIT_WARNING(); + ID3D_WARNING ( "warnings turned on" ); + } + if (args.notice_flag) + { + ID3D_INIT_NOTICE(); + ID3D_NOTICE ( "notices turned on" ); + } +#endif + + if (args.v1tag_flag) + { + ulFlag = ID3TT_ID3V1; + } + + if (args.v2tag_flag) + { + ulFlag = ID3TT_ID3V2; + } + + + const char* filename = NULL; + for (size_t i = 0; i < args.inputs_num; ++i) + { + filename = args.inputs[i]; + ID3_Tag myTag; + + if (args.strip_given) + { + cout << "Stripping "; + } + else + { + cout << "Converting "; + } + cout << filename << ": "; + + myTag.Clear(); + myTag.Link(filename, ID3TT_ALL); + myTag.SetPadding(args.padding_flag); + + cout << "attempting "; + DisplayTags(cout, ulFlag); + luint nTags; + + if (args.strip_flag) + { + nTags = myTag.Strip(ulFlag); + cout << ", stripped "; + } + else + { + nTags = myTag.Update(ulFlag); + cout << ", converted "; + } + + DisplayTags(cout, nTags); + cout << endl; + } + + return 0; +} + + diff --git a/id3lib/examples/demo_convert_options.c b/id3lib/examples/demo_convert_options.c new file mode 100644 index 0000000..98c3368 --- /dev/null +++ b/id3lib/examples/demo_convert_options.c @@ -0,0 +1,173 @@ +/* + File autogenerated by gengetopt version 2.1 + generated with the following command: + gengetopt --file-name=demo_convert_options --unamed-opts --input=demo_convert_options.ggo + + The developers of gengetopt consider the fixed text that goes in all + gengetopt output files to be in the public domain: + we make no copyright claims on it. +*/ + + +#include +#include +#include + +/* If we use autoconf. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* Check for configure's getopt check result. */ +#ifndef HAVE_GETOPT_LONG +#include "getopt.h" +#else +#include +#endif + +#include "demo_convert_options.h" + +/* Don't define PACKAGE and VERSION if we use automake. */ +#define GGO_PACKAGE "id3convert" +#ifndef VERSION +# define GGO_VERSION VERSION +#else +/* ******* WRITE THE VERSION OF YOUR PROGRAM HERE ******* */ +# define GGO_VERSION "" +#endif + + +void +print_version (void) +{ + printf ("%s %s\n", GGO_PACKAGE, GGO_VERSION); +} + +void +print_help (void) +{ + print_version (); + printf ("Usage: %s [OPTIONS]... [FILES]...\n\ + -h --help Print help and exit\n\ + -V --version Print version and exit\n\ + -1 --v1tag Render only the id3v1 tag (default=off)\n\ + -2 --v2tag Render only the id3v2 tag (default=off)\n\ + -s --strip Strip the tags instead of rendering (default=off)\n\ + -p --padding Use padding in the tag (default=off)\n\ + -w --warning Turn on warnings (for debugging) (default=off)\n\ + -n --notice Turn on notices (for debugging) (default=off)\n\ +", GGO_PACKAGE); +} + + +int +cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) +{ + int c; /* Character of the parsed option. */ + int missing_required_options = 0; + + args_info->help_given = 0 ; + args_info->version_given = 0 ; + args_info->v1tag_given = 0 ; + args_info->v2tag_given = 0 ; + args_info->strip_given = 0 ; + args_info->padding_given = 0 ; + args_info->warning_given = 0 ; + args_info->notice_given = 0 ; + +#define clear_args() +{ \ + args_info->v1tag_flag = 0;\ + args_info->v2tag_flag = 0;\ + args_info->strip_flag = 0;\ + args_info->padding_flag = 0;\ + args_info->warning_flag = 0;\ + args_info->notice_flag = 0;\ +} + + clear_args(); + + args_info->inputs = NULL; + args_info->inputs_num = 0; + + while (1) + { + int option_index = 0; + static struct option long_options[] = { + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, + { "v1tag", 0, NULL, '1' }, + { "v2tag", 0, NULL, '2' }, + { "strip", 0, NULL, 's' }, + { "padding", 0, NULL, 'p' }, + { "warning", 0, NULL, 'w' }, + { "notice", 0, NULL, 'n' }, + { NULL, 0, NULL, 0 } + }; + + c = getopt_long (argc, argv, "hV12spwn", long_options, &option_index); + + if (c == -1) break; /* Exit from `while (1)' loop. */ + + switch (c) + { + case 'h': /* Print help and exit. */ + clear_args (); + print_help (); + exit (0); + + case 'V': /* Print version and exit. */ + clear_args (); + print_version (); + exit (0); + + case '1': /* Render only the id3v1 tag. */ + args_info->v1tag_flag = !(args_info->v1tag_flag); + break; + + case '2': /* Render only the id3v2 tag. */ + args_info->v2tag_flag = !(args_info->v2tag_flag); + break; + + case 's': /* Strip the tags instead of rendering. */ + args_info->strip_flag = !(args_info->strip_flag); + break; + + case 'p': /* Use padding in the tag. */ + args_info->padding_flag = !(args_info->padding_flag); + break; + + case 'w': /* Turn on warnings (for debugging). */ + args_info->warning_flag = !(args_info->warning_flag); + break; + + case 'n': /* Turn on notices (for debugging). */ + args_info->notice_flag = !(args_info->notice_flag); + break; + + case '?': /* Invalid option. */ + /* `getopt_long' already printed an error message. */ + exit (1); + + default: /* bug: option not considered. */ + fprintf (stderr, "%s: option unknown: %c\n", GGO_PACKAGE, c); + abort (); + } /* switch */ + } /* while */ + + if ( missing_required_options ) + exit (1); + + if (optind < argc) + { + int i = 0 ; + + args_info->inputs_num = argc - optind ; + args_info->inputs = + (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; + while (optind < argc) + args_info->inputs[ i++ ] = strdup (argv[optind++]) ; + } + + return 0; +} \ No newline at end of file diff --git a/id3lib/examples/demo_convert_options.h b/id3lib/examples/demo_convert_options.h new file mode 100644 index 0000000..e6f62e6 --- /dev/null +++ b/id3lib/examples/demo_convert_options.h @@ -0,0 +1,38 @@ +/* demo_convert_options.h */ + +/* File autogenerated by gengetopt version 2.1 */ + +#ifndef _demo_convert_options_h +#define _demo_convert_options_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +struct gengetopt_args_info { + int v1tag_flag; /* Render only the id3v1 tag (default=off). */ + int v2tag_flag; /* Render only the id3v2 tag (default=off). */ + int strip_flag; /* Strip the tags instead of rendering (default=off). */ + int padding_flag; /* Use padding in the tag (default=off). */ + int warning_flag; /* Turn on warnings (for debugging) (default=off). */ + int notice_flag; /* Turn on notices (for debugging) (default=off). */ + + int help_given ; /* Wheter help was given. */ + int version_given ; /* Wheter version was given. */ + int v1tag_given ; /* Whether v1tag was given. */ + int v2tag_given ; /* Whether v2tag was given. */ + int strip_given ; /* Whether strip was given. */ + int padding_given ; /* Whether padding was given. */ + int warning_given ; /* Whether warning was given. */ + int notice_given ; /* Whether notice was given. */ + + char **inputs ; /* unamed options */ + unsigned inputs_num ; /* unamed options number */ +} ; + +int cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* _demo_convert_options_h */ diff --git a/id3lib/examples/demo_copy.cpp b/id3lib/examples/demo_copy.cpp new file mode 100644 index 0000000..584bd97 --- /dev/null +++ b/id3lib/examples/demo_copy.cpp @@ -0,0 +1,143 @@ +// $Id: demo_copy.cpp,v 1.2 2008/05/14 09:21:36 pindakaasmod Exp $ +// +// The authors have released ID3Lib as Public Domain (PD) and claim no +// copyright, patent or other intellectual property protection in this work. +// This means that it may be modified, redistributed and used in commercial +// and non-commercial software and hardware without restrictions. ID3Lib is +// distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either +// express or implied. +// +// The ID3Lib authors encourage improvements and optimisations to be sent to +// the ID3Lib coordinator, currently Dirk Mahoney (dirk@id3.org). Approved +// submissions may be altered, and will be included and released under these +// terms. + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include "id3/id3lib_streams.h" +#include "id3/tag.h" + +#include "demo_copy_options.h" + +using std::cout; +using std::endl; +using std::cerr; + +static const char* VERSION_NUMBER = "$Revision: 1.2 $"; + +void PrintUsage(const char *sName) +{ + cout << "Usage: " << sName << " [OPTION]... SOURCE DEST" << endl; + cout << "Copy the tag(s) from SOURCE to DEST." << endl; + cout << endl; +} + +void PrintVersion(const char *sName) +{ + size_t nIndex; + cout << sName << " "; + for (nIndex = 0; nIndex < strlen(VERSION_NUMBER); nIndex++) + { + if (VERSION_NUMBER[nIndex] == ' ') + { + break; + } + } + nIndex++; + for (; nIndex < strlen (VERSION_NUMBER); nIndex++) + { + if (VERSION_NUMBER[nIndex] == ' ') + { + break; + } + cout << VERSION_NUMBER[nIndex]; + } + cout << endl; + cout << "Uses " << ID3LIB_FULL_NAME << endl << endl; + + cout << "This program copies tags from one file to another" << endl; +} + +void DisplayTags(ostream &os, luint nTags) +{ + if (!((nTags & ID3TT_ID3V1) || (nTags & ID3TT_ID3V2))) + { + os << "no tag"; + } + if (nTags & ID3TT_ID3V1) + { + os << "v1"; + } + if ((nTags & ID3TT_ID3V1) && (nTags & ID3TT_ID3V2)) + { + os << " and "; + } + if (nTags & ID3TT_ID3V2) + { + os << "v2"; + } +} + +int main( unsigned int argc, char * const argv[]) +{ + int ulFlag = ID3TT_ID3; + ID3D_INIT_DOUT(); + gengetopt_args_info args; + + if (cmdline_parser(argc, argv, &args) != 0) + { + exit(1); + } + +#if defined ID3_ENABLE_DEBUG + if (args.warning_flag) + { + ID3D_INIT_WARNING(); + ID3D_WARNING ( "warnings turned on" ); + } + if (args.notice_flag) + { + ID3D_INIT_NOTICE(); + ID3D_NOTICE ( "notices turned on" ); + } +#endif + + if (args.v1tag_flag) + { + ulFlag = ID3TT_ID3V1; + } + + if (args.v2tag_flag) + { + ulFlag = ID3TT_ID3V2; + } + + + if (args.inputs_num != 2) + { + cerr << "Usage: id3cp [OPTIONS] SOURCE DEST" << endl; + exit(1); + } + + const char *source = args.inputs[0], *dest = args.inputs[1]; + + ID3_Tag myTag; + + cout << "Parsing " << source << ": "; + + myTag.Clear(); + myTag.Link(source, ID3TT_ALL); + + cout << "done. Copying to " << dest << ": "; + + myTag.Link(dest, ID3TT_NONE); + myTag.Update(ulFlag); + + cout << "done" << endl; + + return 0; +} + diff --git a/id3lib/examples/demo_copy_options.c b/id3lib/examples/demo_copy_options.c new file mode 100644 index 0000000..4d02a7b --- /dev/null +++ b/id3lib/examples/demo_copy_options.c @@ -0,0 +1,163 @@ +/* + File autogenerated by gengetopt version 2.3 + generated with the following command: + gengetopt --file-name=demo_copy_options --unamed-opts --input=demo_copy_options.ggo  + + The developers of gengetopt consider the fixed text that goes in all + gengetopt output files to be in the public domain: + we make no copyright claims on it. +*/ + + +#include +#include +#include +/* If we use autoconf. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +/* Check for configure's getopt check result. */ +#ifndef HAVE_GETOPT_LONG +#include "getopt.h" +#else +#include +#endif + +#include "demo_copy_options.h" + + +void +cmdline_parser_print_version (void) +{ + printf ("%s %s\n", PACKAGE, VERSION); +} + +void +cmdline_parser_print_help (void) +{ + cmdline_parser_print_version (); + printf("\n" +"Usage: %s [OPTIONS]... [FILES]...\n\ + -h --help Print help and exit\n\ + -V --version Print version and exit\n\ + -1 --v1tag Render only the id3v1 tag (default=off)\n\ + -2 --v2tag Render only the id3v2 tag (default=off)\n\ + -w --warning Turn on warnings (for debugging) (default=off)\n\ + -n --notice Turn on notices (for debugging) (default=off)\n\ +", PACKAGE); +} + + +static char * +gengetopt_strdup (char * s) +{ + char * n, * pn, * ps = s; + while (*ps) ps++; + n = (char *) malloc (1 + ps - s); + if (n != NULL) + { + for (ps=s,pn=n; *ps; ps++,pn++) + *pn = *ps; + *pn = 0; + } + return n; +} + + +int +cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) +{ + int c; /* Character of the parsed option. */ + int missing_required_options = 0; + + args_info->help_given = 0 ; + args_info->version_given = 0 ; + args_info->v1tag_given = 0 ; + args_info->v2tag_given = 0 ; + args_info->warning_given = 0 ; + args_info->notice_given = 0 ; +#define clear_args() { \ + args_info->v1tag_flag = 0;\ + args_info->v2tag_flag = 0;\ + args_info->warning_flag = 0;\ + args_info->notice_flag = 0;\ +} + + clear_args(); + + args_info->inputs = NULL; + args_info->inputs_num = 0; + + while (1) + { + int option_index = 0; + static struct option long_options[] = { + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, + { "v1tag", 0, NULL, '1' }, + { "v2tag", 0, NULL, '2' }, + { "warning", 0, NULL, 'w' }, + { "notice", 0, NULL, 'n' }, + { NULL, 0, NULL, 0 } + }; + + c = getopt_long (argc, argv, "hV12wn", long_options, &option_index); + + if (c == -1) break; /* Exit from `while (1)' loop. */ + + switch (c) + { + case 'h': /* Print help and exit. */ + clear_args (); + cmdline_parser_print_help (); + exit (0); + + case 'V': /* Print version and exit. */ + clear_args (); + cmdline_parser_print_version (); + exit (0); + + case '1': /* Render only the id3v1 tag. */ + args_info->v1tag_flag = !(args_info->v1tag_flag); + break; + + case '2': /* Render only the id3v2 tag. */ + args_info->v2tag_flag = !(args_info->v2tag_flag); + break; + + case 'w': /* Turn on warnings (for debugging). */ + args_info->warning_flag = !(args_info->warning_flag); + break; + + case 'n': /* Turn on notices (for debugging). */ + args_info->notice_flag = !(args_info->notice_flag); + break; + + case 0: /* Long option with no short option */ + + case '?': /* Invalid option. */ + /* `getopt_long' already printed an error message. */ + exit (1); + + default: /* bug: option not considered. */ + fprintf (stderr, "%s: option unknown: %c\n", PACKAGE, c); + abort (); + } /* switch */ + } /* while */ + + if ( missing_required_options ) + exit (1); + + if (optind < argc) + { + int i = 0 ; + + args_info->inputs_num = argc - optind ; + args_info->inputs = + (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; + while (optind < argc) + args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ; + } + + return 0; +} diff --git a/id3lib/examples/demo_copy_options.h b/id3lib/examples/demo_copy_options.h new file mode 100644 index 0000000..d64d276 --- /dev/null +++ b/id3lib/examples/demo_copy_options.h @@ -0,0 +1,47 @@ +/* demo_copy_options.h */ + +/* File autogenerated by gengetopt version 2.3 */ + +#ifndef _demo_copy_options_h +#define _demo_copy_options_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Don't define PACKAGE and VERSION if we use automake. */ +#if defined PACKAGE +# undef PACKAGE +#endif +#define PACKAGE "id3cp" +#ifndef VERSION +/* ******* WRITE THE VERSION OF YOUR PROGRAM HERE ******* */ +#define VERSION "" +#endif + +struct gengetopt_args_info { + int v1tag_flag; /* Render only the id3v1 tag (default=off). */ + int v2tag_flag; /* Render only the id3v2 tag (default=off). */ + int warning_flag; /* Turn on warnings (for debugging) (default=off). */ + int notice_flag; /* Turn on notices (for debugging) (default=off). */ + + int help_given ; /* Whether help was given. */ + int version_given ; /* Whether version was given. */ + int v1tag_given ; /* Whether v1tag was given. */ + int v2tag_given ; /* Whether v2tag was given. */ + int warning_given ; /* Whether warning was given. */ + int notice_given ; /* Whether notice was given. */ + + char **inputs ; /* unamed options */ + unsigned inputs_num ; /* unamed options number */ +} ; + +int cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info); + +void cmdline_parser_print_help(void); +void cmdline_parser_print_version(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* _demo_copy_options_h */ diff --git a/id3lib/examples/demo_info.cpp b/id3lib/examples/demo_info.cpp new file mode 100644 index 0000000..8a89316 --- /dev/null +++ b/id3lib/examples/demo_info.cpp @@ -0,0 +1,401 @@ +// Copyright 1999 Scott Thomas Haug +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// $Id: demo_info.cpp,v 1.2 2008/05/14 09:21:36 pindakaasmod Exp $ + + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include "demo_info_options.h" + +using namespace dami; +using std::cout; +using std::endl; + +static String VERSION_NUMBER = "$Revision: 1.2 $"; + +void PrintUsage(const char *sName) +{ + cout << "Usage: " << sName << " [OPTION]... [FILE]..." << endl; + cout << "Display the id3 (both v1 and v2) tag information for a file." << endl; + cout << endl; + cout << " -h, --help Display this help and exit" << endl; + cout << " -v, --version Display version information and exit" << endl; + cout << endl; + cout << "Will not differentiate between the two types of tags" << endl; +} + +void PrintVersion(const char *sName) +{ + cout << sName << " " << VERSION_NUMBER.c_str() << endl; + cout << "Displays ID3 Tag Information - Written by Scott Thomas Haug" << endl; + cout << "Uses " << ID3LIB_FULL_NAME << endl << endl; +} + +void PrintInformation(const ID3_Tag &myTag) +{ + ID3_Tag::ConstIterator* iter = myTag.CreateIterator(); + const ID3_Frame* frame = NULL; + while (NULL != (frame = iter->GetNext())) + { + const char* desc = frame->GetDescription(); + if (!desc) desc = ""; + cout << "=== " << frame->GetTextID() << " (" << desc << "): "; + ID3_FrameID eFrameID = frame->GetID(); + switch (eFrameID) + { + case ID3FID_ALBUM: + case ID3FID_BPM: + case ID3FID_COMPOSER: + case ID3FID_CONTENTTYPE: + case ID3FID_COPYRIGHT: + case ID3FID_DATE: + case ID3FID_PLAYLISTDELAY: + case ID3FID_ENCODEDBY: + case ID3FID_LYRICIST: + case ID3FID_FILETYPE: + case ID3FID_TIME: + case ID3FID_CONTENTGROUP: + case ID3FID_TITLE: + case ID3FID_SUBTITLE: + case ID3FID_INITIALKEY: + case ID3FID_LANGUAGE: + case ID3FID_SONGLEN: + case ID3FID_MEDIATYPE: + case ID3FID_ORIGALBUM: + case ID3FID_ORIGFILENAME: + case ID3FID_ORIGLYRICIST: + case ID3FID_ORIGARTIST: + case ID3FID_ORIGYEAR: + case ID3FID_FILEOWNER: + case ID3FID_LEADARTIST: + case ID3FID_BAND: + case ID3FID_CONDUCTOR: + case ID3FID_MIXARTIST: + case ID3FID_PARTINSET: + case ID3FID_PUBLISHER: + case ID3FID_TRACKNUM: + case ID3FID_RECORDINGDATES: + case ID3FID_NETRADIOSTATION: + case ID3FID_NETRADIOOWNER: + case ID3FID_SIZE: + case ID3FID_ISRC: + case ID3FID_ENCODERSETTINGS: + case ID3FID_YEAR: + { + char *sText = ID3_GetString(frame, ID3FN_TEXT); + cout << sText << endl; + delete [] sText; + break; + } + case ID3FID_USERTEXT: + { + char + *sText = ID3_GetString(frame, ID3FN_TEXT), + *sDesc = ID3_GetString(frame, ID3FN_DESCRIPTION); + cout << "(" << sDesc << "): " << sText << endl; + delete [] sText; + delete [] sDesc; + break; + } + case ID3FID_COMMENT: + case ID3FID_UNSYNCEDLYRICS: + { + char + *sText = ID3_GetString(frame, ID3FN_TEXT), + *sDesc = ID3_GetString(frame, ID3FN_DESCRIPTION), + *sLang = ID3_GetString(frame, ID3FN_LANGUAGE); + cout << "(" << sDesc << ")[" << sLang << "]: " + << sText << endl; + delete [] sText; + delete [] sDesc; + delete [] sLang; + break; + } + case ID3FID_WWWAUDIOFILE: + case ID3FID_WWWARTIST: + case ID3FID_WWWAUDIOSOURCE: + case ID3FID_WWWCOMMERCIALINFO: + case ID3FID_WWWCOPYRIGHT: + case ID3FID_WWWPUBLISHER: + case ID3FID_WWWPAYMENT: + case ID3FID_WWWRADIOPAGE: + { + char *sURL = ID3_GetString(frame, ID3FN_URL); + cout << sURL << endl; + delete [] sURL; + break; + } + case ID3FID_WWWUSER: + { + char + *sURL = ID3_GetString(frame, ID3FN_URL), + *sDesc = ID3_GetString(frame, ID3FN_DESCRIPTION); + cout << "(" << sDesc << "): " << sURL << endl; + delete [] sURL; + delete [] sDesc; + break; + } + case ID3FID_INVOLVEDPEOPLE: + { + size_t nItems = frame->GetField(ID3FN_TEXT)->GetNumTextItems(); + for (size_t nIndex = 0; nIndex < nItems; nIndex++) + { + char *sPeople = ID3_GetString(frame, ID3FN_TEXT, nIndex); + cout << sPeople; + delete [] sPeople; + if (nIndex + 1 < nItems) + { + cout << ", "; + } + } + cout << endl; + break; + } + case ID3FID_PICTURE: + { + char + *sMimeType = ID3_GetString(frame, ID3FN_MIMETYPE), + *sDesc = ID3_GetString(frame, ID3FN_DESCRIPTION), + *sFormat = ID3_GetString(frame, ID3FN_IMAGEFORMAT); + size_t + nPicType = frame->GetField(ID3FN_PICTURETYPE)->Get(), + nDataSize = frame->GetField(ID3FN_DATA)->Size(); + cout << "(" << sDesc << ")[" << sFormat << ", " + << nPicType << "]: " << sMimeType << ", " << nDataSize + << " bytes" << endl; + delete [] sMimeType; + delete [] sDesc; + delete [] sFormat; + break; + } + case ID3FID_GENERALOBJECT: + { + char + *sMimeType = ID3_GetString(frame, ID3FN_MIMETYPE), + *sDesc = ID3_GetString(frame, ID3FN_DESCRIPTION), + *sFileName = ID3_GetString(frame, ID3FN_FILENAME); + size_t + nDataSize = frame->GetField(ID3FN_DATA)->Size(); + cout << "(" << sDesc << ")[" + << sFileName << "]: " << sMimeType << ", " << nDataSize + << " bytes" << endl; + delete [] sMimeType; + delete [] sDesc; + delete [] sFileName; + break; + } + case ID3FID_UNIQUEFILEID: + { + char *sOwner = ID3_GetString(frame, ID3FN_OWNER); + size_t nDataSize = frame->GetField(ID3FN_DATA)->Size(); + cout << sOwner << ", " << nDataSize + << " bytes" << endl; + delete [] sOwner; + break; + } + case ID3FID_PLAYCOUNTER: + { + size_t nCounter = frame->GetField(ID3FN_COUNTER)->Get(); + cout << nCounter << endl; + break; + } + case ID3FID_POPULARIMETER: + { + char *sEmail = ID3_GetString(frame, ID3FN_EMAIL); + size_t + nCounter = frame->GetField(ID3FN_COUNTER)->Get(), + nRating = frame->GetField(ID3FN_RATING)->Get(); + cout << sEmail << ", counter=" + << nCounter << " rating=" << nRating << endl; + delete [] sEmail; + break; + } + case ID3FID_CRYPTOREG: + case ID3FID_GROUPINGREG: + { + char *sOwner = ID3_GetString(frame, ID3FN_OWNER); + size_t + nSymbol = frame->GetField(ID3FN_ID)->Get(), + nDataSize = frame->GetField(ID3FN_DATA)->Size(); + cout << "(" << nSymbol << "): " << sOwner + << ", " << nDataSize << " bytes" << endl; + break; + } + case ID3FID_SYNCEDLYRICS: + { + char + *sDesc = ID3_GetString(frame, ID3FN_DESCRIPTION), + *sLang = ID3_GetString(frame, ID3FN_LANGUAGE); + size_t + nTimestamp = frame->GetField(ID3FN_TIMESTAMPFORMAT)->Get(), + nRating = frame->GetField(ID3FN_CONTENTTYPE)->Get(); + const char* format = (2 == nTimestamp) ? "ms" : "frames"; + cout << "(" << sDesc << ")[" << sLang << "]: "; + switch (nRating) + { + case ID3CT_OTHER: cout << "Other"; break; + case ID3CT_LYRICS: cout << "Lyrics"; break; + case ID3CT_TEXTTRANSCRIPTION: cout << "Text transcription"; break; + case ID3CT_MOVEMENT: cout << "Movement/part name"; break; + case ID3CT_EVENTS: cout << "Events"; break; + case ID3CT_CHORD: cout << "Chord"; break; + case ID3CT_TRIVIA: cout << "Trivia/'pop up' information"; break; + } + cout << endl; + ID3_Field* fld = frame->GetField(ID3FN_DATA); + if (fld) + { + ID3_MemoryReader mr(fld->GetRawBinary(), fld->BinSize()); + while (!mr.atEnd()) + { + cout << io::readString(mr).c_str(); + cout << " [" << io::readBENumber(mr, sizeof(uint32)) << " " + << format << "] "; + } + } + cout << endl; + delete [] sDesc; + delete [] sLang; + break; + } + case ID3FID_AUDIOCRYPTO: + case ID3FID_EQUALIZATION: + case ID3FID_EVENTTIMING: + case ID3FID_CDID: + case ID3FID_MPEGLOOKUP: + case ID3FID_OWNERSHIP: + case ID3FID_PRIVATE: + case ID3FID_POSITIONSYNC: + case ID3FID_BUFFERSIZE: + case ID3FID_VOLUMEADJ: + case ID3FID_REVERB: + case ID3FID_SYNCEDTEMPO: + case ID3FID_METACRYPTO: + { + cout << " (unimplemented)" << endl; + break; + } + default: + { + cout << " frame" << endl; + break; + } + } + } + delete iter; +} + +#define DEBUG + +int main( unsigned int argc, char * const argv[]) +{ + ID3D_INIT_DOUT(); + + gengetopt_args_info args; + + if (cmdline_parser(argc, argv, &args) != 0) + { + exit(1); + } + +#if defined ID3_ENABLE_DEBUG + if (args.warning_flag) + { + ID3D_INIT_WARNING(); + ID3D_WARNING ( "warnings turned on" ); + } + if (args.notice_flag) + { + ID3D_INIT_NOTICE(); + ID3D_NOTICE ( "notices turned on" ); + } +#endif + + + const char* filename = NULL; + for (size_t i = 0; i < args.inputs_num; ++i) + { + filename = args.inputs[i]; + ID3_Tag myTag; + + myTag.Link(filename, ID3TT_ALL); + const Mp3_Headerinfo* mp3info; + mp3info = myTag.GetMp3HeaderInfo(); + + cout << endl << "*** Tag information for " << filename << endl; + if (!args.assign_given) + { + PrintInformation(myTag); + } + else + { + cout << "*** Testing assignment operator" << endl; + ID3_Tag tmpTag(myTag); + PrintInformation(tmpTag); + } + if (mp3info) + { + cout << "*** mp3 info\n"; + + switch (mp3info->version) + { + case MPEGVERSION_2_5: + cout << "MPEG2.5/"; + break; + case MPEGVERSION_2: + cout << "MPEG2/"; + break; + case MPEGVERSION_1: + cout << "MPEG1/"; + break; + default: + break; + } + + switch (mp3info->layer) + { + case MPEGLAYER_III: + cout << "layer III\n"; + break; + case MPEGLAYER_II: + cout << "layer II\n"; + break; + case MPEGLAYER_I: + cout << "layer I\n"; + break; + default: + break; + } + + cout << "Bitrate: " << mp3info->bitrate/1000 << "KBps\n"; + cout << "Frequency: " << mp3info->frequency/1000 << "KHz\n"; + } + + + } + + return 0; +} + diff --git a/id3lib/examples/demo_info_options.c b/id3lib/examples/demo_info_options.c new file mode 100644 index 0000000..76cfcae --- /dev/null +++ b/id3lib/examples/demo_info_options.c @@ -0,0 +1,155 @@ +/* + File autogenerated by gengetopt version 2.3 + generated with the following command: + gengetopt --file-name=demo_info_options --unamed-opts --input=demo_info_options.ggo  + + The developers of gengetopt consider the fixed text that goes in all + gengetopt output files to be in the public domain: + we make no copyright claims on it. +*/ + + +#include +#include +#include +/* If we use autoconf. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +/* Check for configure's getopt check result. */ +#ifndef HAVE_GETOPT_LONG +#include "getopt.h" +#else +#include +#endif + +#include "demo_info_options.h" + + +void +cmdline_parser_print_version (void) +{ + printf ("%s %s\n", PACKAGE, VERSION); +} + +void +cmdline_parser_print_help (void) +{ + cmdline_parser_print_version (); + printf("\n" +"Usage: %s [OPTIONS]... [FILES]...\n\ + -h --help Print help and exit\n\ + -V --version Print version and exit\n\ + -a --assign Test the assignment operator (default=off)\n\ + -w --warning Turn on warnings (for debugging) (default=off)\n\ + -n --notice Turn on notices (for debugging) (default=off)\n\ +", PACKAGE); +} + + +static char * +gengetopt_strdup (char * s) +{ + char * n, * pn, * ps = s; + while (*ps) ps++; + n = (char *) malloc (1 + ps - s); + if (n != NULL) + { + for (ps=s,pn=n; *ps; ps++,pn++) + *pn = *ps; + *pn = 0; + } + return n; +} + + +int +cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) +{ + int c; /* Character of the parsed option. */ + int missing_required_options = 0; + + args_info->help_given = 0 ; + args_info->version_given = 0 ; + args_info->assign_given = 0 ; + args_info->warning_given = 0 ; + args_info->notice_given = 0 ; +#define clear_args() { \ + args_info->assign_flag = 0;\ + args_info->warning_flag = 0;\ + args_info->notice_flag = 0;\ +} + + clear_args(); + + args_info->inputs = NULL; + args_info->inputs_num = 0; + + while (1) + { + int option_index = 0; + static struct option long_options[] = { + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, + { "assign", 0, NULL, 'a' }, + { "warning", 0, NULL, 'w' }, + { "notice", 0, NULL, 'n' }, + { NULL, 0, NULL, 0 } + }; + + c = getopt_long (argc, argv, "hVawn", long_options, &option_index); + + if (c == -1) break; /* Exit from `while (1)' loop. */ + + switch (c) + { + case 'h': /* Print help and exit. */ + clear_args (); + cmdline_parser_print_help (); + exit (0); + + case 'V': /* Print version and exit. */ + clear_args (); + cmdline_parser_print_version (); + exit (0); + + case 'a': /* Test the assignment operator. */ + args_info->assign_flag = !(args_info->assign_flag); + break; + + case 'w': /* Turn on warnings (for debugging). */ + args_info->warning_flag = !(args_info->warning_flag); + break; + + case 'n': /* Turn on notices (for debugging). */ + args_info->notice_flag = !(args_info->notice_flag); + break; + + case 0: /* Long option with no short option */ + + case '?': /* Invalid option. */ + /* `getopt_long' already printed an error message. */ + exit (1); + + default: /* bug: option not considered. */ + fprintf (stderr, "%s: option unknown: %c\n", PACKAGE, c); + abort (); + } /* switch */ + } /* while */ + + if ( missing_required_options ) + exit (1); + + if (optind < argc) + { + int i = 0 ; + + args_info->inputs_num = argc - optind ; + args_info->inputs = + (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; + while (optind < argc) + args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ; + } + + return 0; +} diff --git a/id3lib/examples/demo_info_options.h b/id3lib/examples/demo_info_options.h new file mode 100644 index 0000000..c6c4b82 --- /dev/null +++ b/id3lib/examples/demo_info_options.h @@ -0,0 +1,45 @@ +/* demo_info_options.h */ + +/* File autogenerated by gengetopt version 2.3 */ + +#ifndef _demo_info_options_h +#define _demo_info_options_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Don't define PACKAGE and VERSION if we use automake. */ +#if defined PACKAGE +# undef PACKAGE +#endif +#define PACKAGE "id3info" +#ifndef VERSION +/* ******* WRITE THE VERSION OF YOUR PROGRAM HERE ******* */ +#define VERSION "" +#endif + +struct gengetopt_args_info { + int assign_flag; /* Test the assignment operator (default=off). */ + int warning_flag; /* Turn on warnings (for debugging) (default=off). */ + int notice_flag; /* Turn on notices (for debugging) (default=off). */ + + int help_given ; /* Whether help was given. */ + int version_given ; /* Whether version was given. */ + int assign_given ; /* Whether assign was given. */ + int warning_given ; /* Whether warning was given. */ + int notice_given ; /* Whether notice was given. */ + + char **inputs ; /* unamed options */ + unsigned inputs_num ; /* unamed options number */ +} ; + +int cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info); + +void cmdline_parser_print_help(void); +void cmdline_parser_print_version(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* _demo_info_options_h */ diff --git a/id3lib/examples/demo_main.cpp b/id3lib/examples/demo_main.cpp new file mode 100644 index 0000000..c9d205e --- /dev/null +++ b/id3lib/examples/demo_main.cpp @@ -0,0 +1,135 @@ +// The authors have released ID3Lib as Public Domain (PD) and claim no +// copyright, patent or other intellectual property protection in this work. +// This means that it may be modified, redistributed and used in commercial +// and non-commercial software and hardware without restrictions. ID3Lib is +// distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either +// express or implied. +// +// The ID3Lib authors encourage improvements and optimisations to be sent to +// the ID3Lib coordinator, currently Dirk Mahoney (dirk@id3.org). Approved +// submissions may be altered, and will be included and released under these +// terms. +// +// Mon Nov 23 18:34:01 1998 + + +#ifndef __DLL + + +#include "id3/id3lib_streams.h" +#include "id3/tag.h" + +using std::cout; +using std::endl; +using std::cerr; + + +void MakeDummyTag(void) +{ + ID3_Tag myTag("dummy.tag"); + ID3_Frame myFrame[3]; + + myFrame[0].SetID(ID3FID_USERTEXT); + myFrame[0].Field(ID3FN_TEXTENC) = ID3TE_UNICODE; + myFrame[0].Field(ID3FN_DESCRIPTION) = "example #1"; + myFrame[0].Field(ID3FN_TEXT) = "This is the text for example #1"; + + myFrame[1].SetID(ID3FID_USERTEXT); + myFrame[1].Field(ID3FN_TEXTENC) = ID3TE_ASCII; + myFrame[1].Field(ID3FN_DESCRIPTION) = "example #2"; + myFrame[1].Field(ID3FN_TEXT) = "This is the text for example #2"; + + myFrame[2].SetID(ID3FID_INVOLVEDPEOPLE); + myFrame[2].Field(ID3FN_TEXTENC) = ID3TE_ASCII; + myFrame[2].Field(ID3FN_TEXT).Add("String 1"); + myFrame[2].Field(ID3FN_TEXT).Add("String 2"); + myFrame[2].Field(ID3FN_TEXT).Add("String 3"); + myFrame[2].Field(ID3FN_TEXT).Add("String 4"); + + myTag.AddFrames(myFrame, 3); + + //myTag.SetVersion(3, 0); + myTag.SetUnsync(false); + myTag.SetExtendedHeader(false); + myTag.SetCompression(false); + myTag.SetPadding(false); + + myTag.Strip(); + myTag.Update(); + + return; +} + + +void StripTags(char *file) +{ + ID3_Tag myTag; + + myTag.Link(file); + myTag.Strip(); + + return; +} + + +void GetTestTag(void) +{ + ID3_Tag myTag("dummy.tag"); + ID3_Frame *myFrame; + + if (myFrame = myTag.Find(ID3FID_PICTURE)) + { + cout << "Found a picture frame!\r\n" << endl; + + char *dada = "output.jpg"; + + myFrame->Field(ID3FN_DATA).ToFile(dada); + } + + if (myFrame = myTag.Find(ID3FID_USERTEXT, ID3FN_DESCRIPTION, "example #1")) + { + cout << "Found a user text frame!\r\n" << endl; + + char textBuff[1024]; + + myFrame->Field(ID3FN_DESCRIPTION).Get(textBuff, 1024); + cout << "Desc: " << textBuff << endl; + + myFrame->Field(ID3FN_TEXT).Get(textBuff, 1024); + cout << "Text: " << textBuff << endl; + } + + for (luint i = 0; i < myTag.NumFrames(); i++) + if (myFrame = myTag[i]) + cout << "Frame " << i << " has ID " << (luint) myFrame->GetID() << endl; + + return; +} + + +int main(int argc, char *argv[]) +{ + try + { + // CreateDemoTag1(); + // MakeDummyTag(); + // GetTestTag(); + StripTags("c:\\temp.mp3"); + } + + + catch(ID3_Error err) + { + cout << "Error in ID3Lib!" << endl; + cout << "Error: '" << err.GetErrorDesc() << "'" << endl; + cout << " File: '" << err.GetErrorFile() << "'" << endl; + cout << " Line: " << err.GetErrorLine() << endl; + } + + return 0; +} + + +#endif + + diff --git a/id3lib/examples/demo_simple.cpp b/id3lib/examples/demo_simple.cpp new file mode 100644 index 0000000..cc3d0ca --- /dev/null +++ b/id3lib/examples/demo_simple.cpp @@ -0,0 +1,104 @@ +/* $Id: demo_simple.cpp,v 1.2 2008/05/14 09:21:36 pindakaasmod Exp $ + + * Copyright 2000 Scott Thomas Haug + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include + +int +main( int argc, char *argv[] ) +{ + char *filename = NULL; + ID3Tag *tag; + + if (argc != 2) + { + printf("*** Usage: %s file\n", argv[0]); + exit (1); + } + filename = argv[1]; + printf("*** Reading %s\n", filename); + + if ((tag = ID3Tag_New()) != NULL) + { + ID3Frame *frame; + + (void) ID3Tag_Link(tag, filename); + if ((frame = ID3Tag_FindFrameWithID(tag, ID3FID_TITLE)) != NULL) + { + ID3Field *field; + if ((field = ID3Frame_GetField(frame, ID3FN_TEXT)) != NULL) + { + char title[1024]; + (void) ID3Field_GetASCII(field, title, 1024); + printf("Title: %s\n", title); + } + else + { + printf("Didn't get the field\n"); + } + } + else + { + printf("Didn't get the frame\n"); + } + + if ((frame = ID3Tag_FindFrameWithID(tag, ID3FID_LEADARTIST)) != NULL) + { + ID3Field *field; + if ((field = ID3Frame_GetField(frame, ID3FN_TEXT)) != NULL) + { + char artist[1024]; + (void) ID3Field_GetASCII(field, artist, 1024); + printf("Artist: %s\n", artist); + } + else + { + printf("Didn't get the field\n"); + } + } + else + { + printf("Didn't get the frame\n"); + } + + if ((frame = ID3Tag_FindFrameWithID(tag, ID3FID_ALBUM)) != NULL) + { + ID3Field *field; + if ((field = ID3Frame_GetField(frame, ID3FN_TEXT)) != NULL) + { + char album[1024]; + (void) ID3Field_GetASCII(field, album, 1024); + printf("Album: %s\n", album); + } + else + { + printf("Didn't get the field\n"); + } + } + else + { + printf("Didn't get the frame\n"); + } + } + else + { + printf("Didn't get the tag\n"); + } + exit (0); +} diff --git a/id3lib/examples/demo_tag.cpp b/id3lib/examples/demo_tag.cpp new file mode 100644 index 0000000..004a33e --- /dev/null +++ b/id3lib/examples/demo_tag.cpp @@ -0,0 +1,199 @@ +// $Id: demo_tag.cpp,v 1.2 2008/05/14 09:21:36 pindakaasmod Exp $ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "id3/id3lib_streams.h" +#include +#include + +#include +#include + +#include "demo_tag_options.h" + +using std::cout; +using std::endl; + +static const char* VERSION_NUMBER = "$Revision: 1.2 $"; + +void PrintUsage(const char *sName) +{ + cout << "Will render both types of tag by default. Only the last" << endl + << "tag type indicated in the option list will be used. Non-" << endl + << "rendered will remain unchanged in the original file. Will" << endl + << "also parse and convert Lyrics3 v2.0 frames, but will not" << endl + << "render them." << endl; +} + +void PrintVersion(const char *sName) +{ + cout << "Uses " << ID3LIB_FULL_NAME << endl << endl; + + cout << "This program tags mp3 files with ID3v1/1.1 and/or id3v2 tags" << endl; +} + +void DisplayTags(ostream &os, luint nTags) +{ + if (!((nTags & ID3TT_ID3V1) || (nTags & ID3TT_ID3V2))) + os << "no tag"; + if (nTags & ID3TT_ID3V1) + os << "v1"; + if ((nTags & ID3TT_ID3V1) && (nTags & ID3TT_ID3V2)) + os << " and "; + if (nTags & ID3TT_ID3V2) + os << "v2"; +} + +int main( unsigned int argc, char * const argv[]) +{ + int ulFlag = ID3TT_ID3; + ID3D_INIT_DOUT(); + gengetopt_args_info args; + + if (cmdline_parser(argc, argv, &args) != 0) + { + exit(1); + } + +#if defined ID3_ENABLE_DEBUG + if (args.warning_flag) + { + ID3D_INIT_WARNING(); + ID3D_WARNING ( "warnings turned on" ); + } + if (args.notice_flag) + { + ID3D_INIT_NOTICE(); + ID3D_NOTICE ( "notices turned on" ); + } +#endif + + if (args.v1tag_flag) + { + ulFlag = ID3TT_ID3V1; + } + + if (args.v2tag_flag) + { + ulFlag = ID3TT_ID3V2; + } + + const char + *sArtist = "", + *sAlbum = "", + *sTitle = "", + *sComment = "", + *sYear = "", + *sDesc = ""; + unsigned short + nYear = 0, + nTrack = 0, + nTotal = 0, + nGenre = 0; + + + if (args.artist_given) + { + sArtist = args.artist_arg; + cout << "+++ Artist = " << sArtist << endl; + } + if (args.album_given) + { + sAlbum = args.album_arg; + cout << "+++ Album = " << sAlbum << endl; + } + if (args.song_given) + { + sTitle = args.song_arg; + cout << "+++ Song = " << sTitle << endl; + } + if (args.year_given) + { + sYear = args.year_arg; + nYear = ::strtol(sYear, NULL, 10); + cout << "+++ Year = " << nYear << endl; + } + if (args.comment_given) + { + sComment = args.comment_arg; + cout << "+++ Comment = " << sComment << endl; + if (args.desc_given) + { + sDesc = args.desc_arg; + cout << "+++ Comment Description" << endl; + cout << " = " << sDesc << endl; + } + else + { + sDesc = ""; + } + } + if (args.genre_given && args.genre_arg > 0 && args.genre_arg < 0xFF) + { + nGenre = args.genre_arg; + cout << "+++ Genre = " << args.genre_arg << endl; + } + if (args.track_given) + { + nTrack = ::strtol(args.track_arg, NULL, 10); + cout << "+++ Track = " << nTrack << endl; + } + if (args.total_given) + { + nTotal = ::strtol(args.total_arg, NULL, 10); + cout << "+++ Total = " << nTotal << endl; + } + const char* filename = NULL; + for (size_t i = 0; i < args.inputs_num; ++i) + { + filename = args.inputs[i]; + ID3_Tag myTag; + + cout << "Tagging " << filename << ": "; + + myTag.Link(filename); + + cout << "attempting "; + DisplayTags(cout, ulFlag); + + if (args.artist_given) + { + ID3_AddArtist(&myTag, sArtist, true); + } + if (args.album_given) + { + ID3_AddAlbum(&myTag, sAlbum, true); + } + if (args.song_given) + { + ID3_AddTitle(&myTag, sTitle, true); + } + if (args.year_given) + { + ID3_AddYear(&myTag, sYear, true); + } + if (args.comment_given) + { + ID3_AddComment(&myTag, sComment, sDesc, true); + } + if (args.genre_given) + { + ID3_AddGenre(&myTag, nGenre, true); + } + if (args.track_given) + { + ID3_AddTrack(&myTag, nTrack, nTotal, true); + } + luint nTags = myTag.Update(ulFlag); + cout << ", tagged "; + + DisplayTags(cout, nTags); + + cout << endl; + } + + return 0; +} + diff --git a/id3lib/examples/demo_tag_options.c b/id3lib/examples/demo_tag_options.c new file mode 100644 index 0000000..bc5608d --- /dev/null +++ b/id3lib/examples/demo_tag_options.c @@ -0,0 +1,316 @@ +/* + File autogenerated by gengetopt version 2.1 + generated with the following command: + gengetopt --file-name=demo_tag_options --unamed-opts --input=demo_tag_options.ggo + + The developers of gengetopt consider the fixed text that goes in all + gengetopt output files to be in the public domain: + we make no copyright claims on it. +*/ + + +#include +#include +#include + +/* If we use autoconf. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* Check for configure's getopt check result. */ +#ifndef HAVE_GETOPT_LONG +#include "getopt.h" +#else +#include +#endif + +#include "demo_tag_options.h" + +/* Don't define PACKAGE and VERSION if we use automake. */ +#define GGO_PACKAGE "id3tag" +#ifndef VERSION +# define GGO_VERSION VERSION +#else +/* ******* WRITE THE VERSION OF YOUR PROGRAM HERE ******* */ +# define GGO_VERSION "" +#endif + + +void +print_version (void) +{ + printf ("%s %s\n", GGO_PACKAGE, GGO_VERSION); +} + +void +print_help (void) +{ + print_version (); + printf ("Usage: %s [OPTIONS]... [FILES]...\n\ + -h --help Print help and exit\n\ + -V --version Print version and exit\n\ + -1 --v1tag Render only the id3v1 tag (default=off)\n\ + -2 --v2tag Render only the id3v2 tag (default=off)\n\ + -aSTRING --artist=STRING Set the artist information\n\ + -ASTRING --album=STRING Set the album title information\n\ + -sSTRING --song=STRING Set the title information\n\ + -cSTRING --comment=STRING Set the comment information\n\ + -CSTRING --desc=STRING Set the comment description\n\ + -ySTRING --year=STRING Set the year\n\ + -tSTRING --track=STRING Set the track number\n\ + -TSTRING --total=STRING Set the total number of tracks\n\ + -gSHORT --genre=SHORT Set the genre\n\ + -w --warning Turn on warnings (for debugging) (default=off)\n\ + -n --notice Turn on notices (for debugging) (default=off)\n\ +", GGO_PACKAGE); +} + + +char * +gengetopt_strdup (char * s) +{ + char * n, * pn, * ps = s; + while (*ps) ps++; + n = (char *) malloc (1 + ps - s); + if (n != NULL) + { + for (ps=s,pn=n; *ps; ps++,pn++) + *pn = *ps; + *pn = 0; + } + return n; +} + + +int +cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) +{ + int c; /* Character of the parsed option. */ + int missing_required_options = 0; + + args_info->help_given = 0 ; + args_info->version_given = 0 ; + args_info->v1tag_given = 0 ; + args_info->v2tag_given = 0 ; + args_info->artist_given = 0 ; + args_info->album_given = 0 ; + args_info->song_given = 0 ; + args_info->comment_given = 0 ; + args_info->desc_given = 0 ; + args_info->year_given = 0 ; + args_info->track_given = 0 ; + args_info->total_given = 0 ; + args_info->genre_given = 0 ; + args_info->warning_given = 0 ; + args_info->notice_given = 0 ; + +#define clear_args() +{ \ + args_info->v1tag_flag = 0;\ + args_info->v2tag_flag = 0;\ + args_info->artist_arg = NULL; \ + args_info->album_arg = NULL; \ + args_info->song_arg = NULL; \ + args_info->comment_arg = NULL; \ + args_info->desc_arg = NULL; \ + args_info->year_arg = NULL; \ + args_info->track_arg = NULL; \ + args_info->total_arg = NULL; \ + args_info->warning_flag = 0;\ + args_info->notice_flag = 0;\ +} + + clear_args(); + + args_info->inputs = NULL; + args_info->inputs_num = 0; + + while (1) + { + int option_index = 0; + static struct option long_options[] = { + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, + { "v1tag", 0, NULL, '1' }, + { "v2tag", 0, NULL, '2' }, + { "artist", 1, NULL, 'a' }, + { "album", 1, NULL, 'A' }, + { "song", 1, NULL, 's' }, + { "comment", 1, NULL, 'c' }, + { "desc", 1, NULL, 'C' }, + { "year", 1, NULL, 'y' }, + { "track", 1, NULL, 't' }, + { "total", 1, NULL, 'T' }, + { "genre", 1, NULL, 'g' }, + { "warning", 0, NULL, 'w' }, + { "notice", 0, NULL, 'n' }, + { NULL, 0, NULL, 0 } + }; + + c = getopt_long (argc, argv, "hV12a:A:s:c:C:y:t:T:g:wn", long_options, &option_index); + + if (c == -1) break; /* Exit from `while (1)' loop. */ + + switch (c) + { + case 'h': /* Print help and exit. */ + clear_args (); + print_help (); + exit (0); + + case 'V': /* Print version and exit. */ + clear_args (); + print_version (); + exit (0); + + case '1': /* Render only the id3v1 tag. */ + args_info->v1tag_flag = !(args_info->v1tag_flag); + break; + + case '2': /* Render only the id3v2 tag. */ + args_info->v2tag_flag = !(args_info->v2tag_flag); + break; + + case 'a': /* Set the artist information. */ + if (args_info->artist_given) + { + fprintf (stderr, "%s: `--artist' (`-a') option given more than once\n", GGO_PACKAGE); + clear_args (); + print_help (); + exit (1); + } + args_info->artist_given = 1; + args_info->artist_arg = gengetopt_strdup (optarg); + break; + + case 'A': /* Set the album title information. */ + if (args_info->album_given) + { + fprintf (stderr, "%s: `--album' (`-A') option given more than once\n", GGO_PACKAGE); + clear_args (); + print_help (); + exit (1); + } + args_info->album_given = 1; + args_info->album_arg = gengetopt_strdup (optarg); + break; + + case 's': /* Set the title information. */ + if (args_info->song_given) + { + fprintf (stderr, "%s: `--song' (`-s') option given more than once\n", GGO_PACKAGE); + clear_args (); + print_help (); + exit (1); + } + args_info->song_given = 1; + args_info->song_arg = gengetopt_strdup (optarg); + break; + + case 'c': /* Set the comment information. */ + if (args_info->comment_given) + { + fprintf (stderr, "%s: `--comment' (`-c') option given more than once\n", GGO_PACKAGE); + clear_args (); + print_help (); + exit (1); + } + args_info->comment_given = 1; + args_info->comment_arg = gengetopt_strdup (optarg); + break; + + case 'C': /* Set the comment description. */ + if (args_info->desc_given) + { + fprintf (stderr, "%s: `--desc' (`-C') option given more than once\n", GGO_PACKAGE); + clear_args (); + print_help (); + exit (1); + } + args_info->desc_given = 1; + args_info->desc_arg = gengetopt_strdup (optarg); + break; + + case 'y': /* Set the year. */ + if (args_info->year_given) + { + fprintf (stderr, "%s: `--year' (`-y') option given more than once\n", GGO_PACKAGE); + clear_args (); + print_help (); + exit (1); + } + args_info->year_given = 1; + args_info->year_arg = gengetopt_strdup (optarg); + break; + + case 't': /* Set the track number. */ + if (args_info->track_given) + { + fprintf (stderr, "%s: `--track' (`-t') option given more than once\n", GGO_PACKAGE); + clear_args (); + print_help (); + exit (1); + } + args_info->track_given = 1; + args_info->track_arg = gengetopt_strdup (optarg); + break; + + case 'T': /* Set the total number of tracks. */ + if (args_info->total_given) + { + fprintf (stderr, "%s: `--total' (`-T') option given more than once\n", GGO_PACKAGE); + clear_args (); + print_help (); + exit (1); + } + args_info->total_given = 1; + args_info->total_arg = gengetopt_strdup (optarg); + break; + + case 'g': /* Set the genre. */ + if (args_info->genre_given) + { + fprintf (stderr, "%s: `--genre' (`-g') option given more than once\n", GGO_PACKAGE); + clear_args (); + print_help (); + exit (1); + } + args_info->genre_given = 1; + args_info->genre_arg = (short)atoi (optarg); + break; + + case 'w': /* Turn on warnings (for debugging). */ + args_info->warning_flag = !(args_info->warning_flag); + break; + + case 'n': /* Turn on notices (for debugging). */ + args_info->notice_flag = !(args_info->notice_flag); + break; + + case '?': /* Invalid option. */ + /* `getopt_long' already printed an error message. */ + exit (1); + + default: /* bug: option not considered. */ + fprintf (stderr, "%s: option unknown: %c\n", GGO_PACKAGE, c); + abort (); + } /* switch */ + } /* while */ + + if ( missing_required_options ) + exit (1); + + if (optind < argc) + { + int i = 0 ; + + args_info->inputs_num = argc - optind ; + args_info->inputs = + (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; + while (optind < argc) + args_info->inputs[ i++ ] = strdup (argv[optind++]) ; + } + + return 0; +} \ No newline at end of file diff --git a/id3lib/examples/demo_tag_options.h b/id3lib/examples/demo_tag_options.h new file mode 100644 index 0000000..36c9fb5 --- /dev/null +++ b/id3lib/examples/demo_tag_options.h @@ -0,0 +1,52 @@ +/* demo_tag_options.h */ + +/* File autogenerated by gengetopt version 2.1 */ + +#ifndef _demo_tag_options_h +#define _demo_tag_options_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +struct gengetopt_args_info { + int v1tag_flag; /* Render only the id3v1 tag (default=off). */ + int v2tag_flag; /* Render only the id3v2 tag (default=off). */ + char * artist_arg; /* Set the artist information. */ + char * album_arg; /* Set the album title information. */ + char * song_arg; /* Set the title information. */ + char * comment_arg; /* Set the comment information. */ + char * desc_arg; /* Set the comment description. */ + char * year_arg; /* Set the year. */ + char * track_arg; /* Set the track number. */ + char * total_arg; /* Set the total number of tracks. */ + short genre_arg; /* Set the genre. */ + int warning_flag; /* Turn on warnings (for debugging) (default=off). */ + int notice_flag; /* Turn on notices (for debugging) (default=off). */ + + int help_given ; /* Wheter help was given. */ + int version_given ; /* Wheter version was given. */ + int v1tag_given ; /* Whether v1tag was given. */ + int v2tag_given ; /* Whether v2tag was given. */ + int artist_given ; /* Whether artist was given. */ + int album_given ; /* Whether album was given. */ + int song_given ; /* Whether song was given. */ + int comment_given ; /* Whether comment was given. */ + int desc_given ; /* Whether desc was given. */ + int year_given ; /* Whether year was given. */ + int track_given ; /* Whether track was given. */ + int total_given ; /* Whether total was given. */ + int genre_given ; /* Whether genre was given. */ + int warning_given ; /* Whether warning was given. */ + int notice_given ; /* Whether notice was given. */ + + char **inputs ; /* unamed options */ + unsigned inputs_num ; /* unamed options number */ +} ; + +int cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* _demo_tag_options_h */ diff --git a/id3lib/examples/findeng.cpp b/id3lib/examples/findeng.cpp new file mode 100644 index 0000000..d5617e6 --- /dev/null +++ b/id3lib/examples/findeng.cpp @@ -0,0 +1,37 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "id3/id3lib_streams.h" +#include "id3/tag.h" +#include "id3/misc_support.h" + +using std::cout; +using std::endl; + +int main(unsigned argc, char* argv[]) +{ + ID3D_INIT_DOUT(); + ID3D_INIT_WARNING(); + ID3D_INIT_NOTICE(); + + if (argc != 2) + { + cout << "Usage: findeng " << endl; + exit(1); + } + ID3_Tag tag(argv[1]); + const ID3_Frame* frame = tag.Find(ID3FID_COMMENT, ID3FN_LANGUAGE, "eng"); + if (frame) + { + char* comment = ID3_GetString(frame, ID3FN_TEXT); + cout << "*** Found english comment: " << comment << endl; + delete [] comment; + } + else + { + cout << "*** No english comment to be found." << endl; + } + return 0; +} + diff --git a/id3lib/examples/findstr.cpp b/id3lib/examples/findstr.cpp new file mode 100644 index 0000000..6160981 --- /dev/null +++ b/id3lib/examples/findstr.cpp @@ -0,0 +1,41 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "id3/id3lib_streams.h" +#include "id3/tag.h" +#include "id3/misc_support.h" + +using std::cout; +using std::endl; + +int main(unsigned argc, char* argv[]) +{ + ID3D_INIT_DOUT(); + ID3D_INIT_WARNING(); + ID3D_INIT_NOTICE(); + + if (argc != 2) + { + cout << "Usage: findstr " << endl; + exit(1); + } + ID3_Tag tag(argv[1]); + ID3_Frame* first = NULL, *frame = NULL; + while(NULL != (frame = tag.Find(ID3FID_COMMENT, ID3FN_DESCRIPTION, ""))) + { + if (frame == first) + { + break; + } + if (first == NULL) + { + first = frame; + } + char* comment = ID3_GetString(frame, ID3FN_TEXT); + cout << "*** Found comment w/o description: " << comment << endl; + delete [] comment; + } + return 0; +} + diff --git a/id3lib/examples/get_pic.cpp b/id3lib/examples/get_pic.cpp new file mode 100644 index 0000000..9d1c77f --- /dev/null +++ b/id3lib/examples/get_pic.cpp @@ -0,0 +1,40 @@ +// $Id: get_pic.cpp,v 1.1 2007/11/12 21:32:57 pindakaasmod Exp $ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "id3/id3lib_streams.h" +#include + +#include +#include + +using std::cout; +using std::endl; + +int main( int argc, char *argv[]) +{ + if (argc != 3) + { + cout << "Usage: get_pic " << endl; + return 1; + } + + ID3_Tag tag(argv[1]); + const ID3_Frame* frame = tag.Find(ID3FID_PICTURE); + if (frame && frame->Contains(ID3FN_DATA)) + { + cout << "*** extracting picture to file \"" << argv[2] << "\"..."; + frame->Field(ID3FN_DATA).ToFile(argv[2]); + cout << " done!" << endl; + } + else + { + cout << "*** no picture frame found in \"" << argv[1] << "\"" << endl; + return 1; + } + + return 0; +} + diff --git a/id3lib/examples/getopt.c b/id3lib/examples/getopt.c new file mode 100644 index 0000000..566b8ef --- /dev/null +++ b/id3lib/examples/getopt.c @@ -0,0 +1,736 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* NOTE!!! AIX requires this to be the first thing in the file. + Do not put ANYTHING before it! */ +#if !defined (__GNUC__) && defined (_AIX) + #pragma alloca +#endif + +#include //for strncmp +#if defined (WIN32) +#include +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not __GNUC__ */ +#if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__)))) +#include +#else +#if !defined (_AIX) && !defined (WIN32) +char *alloca (); +#endif +#endif /* alloca.h */ +#endif /* not __GNUC__ */ + +#if !__STDC__ && !defined(const) && IN_GCC +#define const +#endif + +/* This tells Alpha OSF/1 not to define a getopt prototype in . */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#undef alloca +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +#include +#else /* Not GNU C library. */ +#define __alloca alloca +#endif /* GNU C library. */ + +/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a + long-named option. Because this is not POSIX.2 compliant, it is + being phased out. */ +/* #define GETOPT_COMPAT */ + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = 0; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* XXX 1003.2 says this must be 1 before any call. */ +int optind = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return EOF with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +#include +#define my_index strchr +#define my_bcopy(src, dst, n) memcpy ((dst), (src), (n)) +#else + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +char *getenv (); + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +static void +my_bcopy (from, to, size) + const char *from; + char *to; + int size; +{ + int i; + for (i = 0; i < size; i++) + to[i] = from[i]; +} +#endif /* GNU C library. */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +static void +exchange (argv) + char **argv; +{ + int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *); + char **temp = (char **) __alloca (nonopts_size); + + /* Interchange the two blocks of data in ARGV. */ + + my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size); + my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt], + (optind - last_nonopt) * sizeof (char *)); + my_bcopy ((char *) temp, + (char *) &argv[first_nonopt + optind - last_nonopt], + nonopts_size); + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns `EOF'. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + int option_index; + + optarg = 0; + + /* Initialize the internal data when the first call is made. + Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + if (optind == 0) + { + first_nonopt = last_nonopt = optind = 1; + + nextchar = NULL; + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (getenv ("POSIXLY_CORRECT") != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + } + + if (nextchar == NULL || *nextchar == '\0') + { + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Now skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc + && (argv[optind][0] != '-' || argv[optind][1] == '\0') +#ifdef GETOPT_COMPAT + && (longopts == NULL + || argv[optind][0] != '+' || argv[optind][1] == '\0') +#endif /* GETOPT_COMPAT */ + ) + optind++; + last_nonopt = optind; + } + + /* Special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return EOF; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if ((argv[optind][0] != '-' || argv[optind][1] == '\0') +#ifdef GETOPT_COMPAT + && (longopts == NULL + || argv[optind][0] != '+' || argv[optind][1] == '\0') +#endif /* GETOPT_COMPAT */ + ) + { + if (ordering == REQUIRE_ORDER) + return EOF; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Start decoding its characters. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + if (longopts != NULL + && ((argv[optind][0] == '-' + && (argv[optind][1] == '-' || long_only)) +#ifdef GETOPT_COMPAT + || argv[optind][0] == '+' +#endif /* GETOPT_COMPAT */ + )) + { + const struct option *p; + char *s = nextchar; + int exact = 0; + int ambig = 0; + const struct option *pfound = NULL; + int indfound = 0 ; + + while (*s && *s != '=') + s++; + + /* Test all options for either exact match or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; + p++, option_index++) + if (!strncmp (p->name, nextchar, s - nextchar)) + { + if ((size_t)(s - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, "%s: option `%s' is ambiguous\n", + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*s) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = s + 1; + else + { + if (opterr) + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + "%s: option `--%s' doesn't allow an argument\n", + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + "%s: option `%c%s' doesn't allow an argument\n", + argv[0], argv[optind - 1][0], pfound->name); + } + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, "%s: option `%s' requires an argument\n", + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' +#ifdef GETOPT_COMPAT + || argv[optind][0] == '+' +#endif /* GETOPT_COMPAT */ + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, "%s: unrecognized option `--%s'\n", + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, "%s: unrecognized option `%c%s'\n", + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + return '?'; + } + } + + /* Look at and handle the next option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { +#if 0 + if (c < 040 || c >= 0177) + fprintf (stderr, "%s: unrecognized option, character code 0%o\n", + argv[0], c); + else + fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c); +#else + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); +#endif + } + optopt = c; + return '?'; + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = 0; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { +#if 0 + fprintf (stderr, "%s: option `-%c' requires an argument\n", + argv[0], c); +#else + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, "%s: option requires an argument -- %c\n", + argv[0], c); +#endif + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == EOF) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/id3lib/examples/getopt.h b/id3lib/examples/getopt.h new file mode 100644 index 0000000..45541f5 --- /dev/null +++ b/id3lib/examples/getopt.h @@ -0,0 +1,129 @@ +/* Declarations for getopt. + Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if __STDC__ +#if defined(__GNU_LIBRARY__) +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* not __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* not __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/id3lib/examples/getopt1.c b/id3lib/examples/getopt1.c new file mode 100644 index 0000000..a32615c --- /dev/null +++ b/id3lib/examples/getopt1.c @@ -0,0 +1,176 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "getopt.h" + +#if !__STDC__ && !defined(const) && IN_GCC +#define const +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#else +char *getenv (); +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +#include + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == EOF) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/id3lib/examples/ozzy.tag b/id3lib/examples/ozzy.tag new file mode 100644 index 0000000..d88ab60 Binary files /dev/null and b/id3lib/examples/ozzy.tag differ diff --git a/id3lib/examples/test_compression.cpp b/id3lib/examples/test_compression.cpp new file mode 100644 index 0000000..768d406 --- /dev/null +++ b/id3lib/examples/test_compression.cpp @@ -0,0 +1,35 @@ +// $Id: test_compression.cpp,v 1.1 2007/11/12 21:32:59 pindakaasmod Exp $ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "id3/id3lib_streams.h" +#include "id3/tag.h" + +int main( int argc, char *argv[]) +{ + ID3D_INIT_DOUT(); + ID3D_INIT_WARNING(); + ID3D_INIT_NOTICE(); + + ID3_Tag tag; + ID3_Frame frame; + + tag.Link("test-230-compressed.tag"); + tag.Strip(ID3TT_ALL); + tag.Clear(); + + frame.SetID(ID3FID_USERTEXT); + frame.GetField(ID3FN_DESCRIPTION)->Set("compression example"); + frame.GetField(ID3FN_TEXT)->Set("This sample user text frame came from an ID3v2-3.0 tag. The frame has the 'compression' bit set in it's frame header. This is the new method for compressing frames, which supercedes the 2.01 Compressed Data Metaframe."); + frame.SetCompression(true); + tag.AddFrame(frame); + + tag.SetPadding(false); + tag.SetUnsync(false); + tag.Update(ID3TT_ID3V2); + + return 0; +} + diff --git a/id3lib/examples/test_io.cpp b/id3lib/examples/test_io.cpp new file mode 100644 index 0000000..9157a7f --- /dev/null +++ b/id3lib/examples/test_io.cpp @@ -0,0 +1,207 @@ +// $Id: test_io.cpp,v 1.1 2007/11/12 21:33:00 pindakaasmod Exp $ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +using std::cout; +using std::endl; +using std::cerr; + +using namespace dami; + +int +main(size_t argc, const char** argv) +{ + ID3D_INIT_DOUT(); + ID3D_INIT_WARNING(); + ID3D_INIT_NOTICE(); + + ID3_IStreamReader isr(cin); + BString orig = io::readAllBinary(isr); + + cout << "input size: " << orig.size() << endl; + + cout << endl; + + cout << "=== Testing Synchronization ===" << endl; + BString synced; + + { + io::BStringReader sr(orig); + io::UnsyncedReader ur(sr); + + synced = io::readAllBinary(ur); + } + + cout << "synced size: " << synced.size() << endl; + + BString unsynced; + + { + io::BStringWriter sw(unsynced); + io::UnsyncedWriter uw(sw); + + uw.writeChars(synced.data(), synced.size()); + } + + cout << "unsynced size: " << unsynced.size() << endl; + + BString resynced; + + { + io::BStringReader sr(unsynced); + io::UnsyncedReader ur(sr); + + resynced = io::readAllBinary(ur); + } + + cout << "resynced size: " << resynced.size() << endl; + + if (unsynced == orig) + { + cout << "orig == unsynced" << endl; + } + else + { + cout << "orig != unsynced" << endl; + } + if (synced == resynced) + { + cout << "synced == resynced" << endl; + } + else + { + cout << "synced != resynced" << endl; + } + + cout << endl; + cout << "=== Testing Trailing Spaces ===" << endl; + + String text; + + { + io::StringWriter sw(text); + io::writeTrailingSpaces (sw, "hello, world", 50); + } + + cout << "new text = \"" << text << "\"" << endl; + + String origText; + + { + io::StringReader sr(text); + origText = io::readTrailingSpaces(sr, 100); + } + + cout << "orig text = \"" << origText << "\"" << endl; + + cout << endl; + cout << "=== Testing Binary Numbers ===" << endl; + + String number; + + { + io::StringWriter sw(number); + io::writeBENumber(sw, 1234567890, 4); + } + + cout << "binary number:"; + for (size_t i = 0; i < number.size(); ++i) + { + cout << " 0x" << hex << (size_t) (0xFF & number[i]) << dec; + } + cout << endl; + + size_t val; + + { + io::StringReader sr(number); + val = io::readBENumber(sr, 4); + } + + cout << "orig number: " << val << endl; + + cout << endl; + cout << "=== Testing Compression ===" << endl; + + String compressed; + size_t origSize = orig.size(); + cout << "origSize = " << origSize << endl; + + + { + io::StringWriter sw(compressed); + io::CompressedWriter cw(sw); + cw.writeChars(orig.data(), orig.size()); + cw.flush(); + if (origSize != cw.getOrigSize()) + { + origSize = cw.getOrigSize(); + cout << "cw.getOrigSize() = " << origSize << endl; + } + } + + cout << "compressed size = " << compressed.size() << endl; + + BString uncompressed; + + if (origSize == 0) + { + cout << "no compression" << endl; + } + else + { + io::StringReader sr(compressed); + io::CompressedReader cr(sr, origSize); + + uncompressed = io::readAllBinary(cr); + cout << "uncompressed size = " << uncompressed.size() << endl; + } + + if (uncompressed.size() == orig.size()) + { + if (uncompressed == orig) + { + cout << "orig == uncompressed" << endl; + } + else + { + cout << "orig != uncompressed" << endl; + } + } + + String ascii; + ascii.reserve(8192); + + for (size_t i = 0; i < 8192; ++i) + { + ascii += 'a' + (i % 26); + } + + cout << endl; + cout << "ascii.size() = " << ascii.size() << endl; + String unicode = dami::convert(ascii, ID3TE_ASCII, ID3TE_UTF16BE); + cout << "uncicode.size() = " << unicode.size() << endl; + String ascii_2 = dami::convert(unicode, ID3TE_UTF16BE, ID3TE_ASCII); + if (ascii != ascii_2) + { + cout << "ascii != ascii_2" << endl; + } + else + { + cout << "ascii == ascii_2" << endl; + } + + + + return 0; +} + diff --git a/id3lib/examples/test_pic.cpp b/id3lib/examples/test_pic.cpp new file mode 100644 index 0000000..6b00db4 --- /dev/null +++ b/id3lib/examples/test_pic.cpp @@ -0,0 +1,71 @@ +// $Id: test_pic.cpp,v 1.1 2007/11/12 21:33:00 pindakaasmod Exp $ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "id3/id3lib_streams.h" +#include "id3/tag.h" + +int main( int argc, char *argv[]) +{ + ID3D_INIT_DOUT(); + ID3D_INIT_WARNING(); + ID3D_INIT_NOTICE(); + + ID3_Tag tag; + ID3_Frame frame; + + tag.Link("test-230-picture.tag"); + tag.Strip(ID3TT_ALL); + tag.Clear(); + + frame.SetID(ID3FID_TITLE); + frame.GetField(ID3FN_TEXT)->Set("Aquarium"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_CONTENTGROUP); + frame.GetField(ID3FN_TEXT)->Set("Short fraction of 'Carnival of the Animals: A Grand Zoological Fantasy'"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_COMPOSER); + frame.GetField(ID3FN_TEXT)->Set("Camille Saint-Sans"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_BAND); + frame.GetField(ID3FN_TEXT)->Set("Slovakia Radio Symphony Orchestra"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_CONDUCTOR); + frame.GetField(ID3FN_TEXT)->Set("Ondrej Lenrd"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_COPYRIGHT); + frame.GetField(ID3FN_TEXT)->Set("1996 HNH international Ltd."); + tag.AddFrame(frame); + + frame.SetID(ID3FID_CONTENTTYPE); + frame.GetField(ID3FN_TEXT)->Set("(32)"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_INVOLVEDPEOPLE); + frame.GetField(ID3FN_TEXT)->Add("Producer"); + frame.GetField(ID3FN_TEXT)->Add("Martin Sauer"); + frame.GetField(ID3FN_TEXT)->Add("Piano"); + frame.GetField(ID3FN_TEXT)->Add("Peter Toperczer"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_PICTURE); + frame.GetField(ID3FN_MIMETYPE)->Set("image/jpeg"); + frame.GetField(ID3FN_PICTURETYPE)->Set(11); + frame.GetField(ID3FN_DESCRIPTION)->Set("B/W picture of Saint-Sans"); + frame.GetField(ID3FN_DATA)->FromFile("composer.jpg"); + tag.AddFrame(frame); + + tag.SetPadding(false); + tag.SetUnsync(true); + tag.Update(ID3TT_ID3V2); + + return 0; +} + diff --git a/id3lib/examples/test_remove.cpp b/id3lib/examples/test_remove.cpp new file mode 100644 index 0000000..c009437 --- /dev/null +++ b/id3lib/examples/test_remove.cpp @@ -0,0 +1,118 @@ +// $Id: test_remove.cpp,v 1.1 2007/11/12 21:33:01 pindakaasmod Exp $ + +#if defined(HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "id3/id3lib_streams.h" +#include "id3/tag.h" +#include "id3/misc_support.h" +#include "id3/id3lib_strings.h" + +using std::cout; +using std::endl; +using std::cerr; + +using namespace dami; + +typedef const char* LPCTSTR; + +/* CSharedTag is a wrapper I made for some features I need */ +/* LPCTSTR means const char * */ +size_t RemoveFrame(ID3_Tag& pTag, ID3_FrameID fID, LPCTSTR sDescription) +{ + size_t nCount = 0; + const ID3_Frame * frame = NULL; + + do { + if (!sDescription) + { + cerr << "*** description is null" << endl; + frame = pTag.Find(fID); + } + else + { + cerr << "*** description is \"" << sDescription << "\"" << endl; + frame = pTag.Find(fID, ID3FN_DESCRIPTION, sDescription); + } + + if (frame) + { + ID3_Field* fld = frame->GetField(ID3FN_TEXT); + String text(fld->GetRawText(), fld->Size()); + cerr << "*** delete frame with text \"" << text << "\"" << endl; + /* pTag is an ID3_Tag */ + delete pTag.RemoveFrame(frame); + nCount++; + } + } while (frame != NULL); + + return nCount; +} + +int main( int argc, char *argv[]) +{ + ID3_Tag tag; + ID3_Frame frame; + + if (argc == 2) + { + tag.Link(argv[1]); + cerr << "removed " << RemoveFrame(tag, ID3FID_COMMENT, "") << " descriptionless comment frames" << endl; + tag.Update(); + + } + else + { + tag.Link("test-remove.tag"); + tag.Strip(ID3TT_ALL); + tag.Clear(); + + frame.SetID(ID3FID_TITLE); + frame.GetField(ID3FN_TEXT)->Set("Test title"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_COMPOSER); + frame.GetField(ID3FN_TEXT)->Set("Test composer"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_BAND); + frame.GetField(ID3FN_TEXT)->Set("Test band"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_CONDUCTOR); + frame.GetField(ID3FN_TEXT)->Set("Test conductor"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_COMMENT); + frame.GetField(ID3FN_LANGUAGE)->Set("eng"); + frame.GetField(ID3FN_TEXT)->Set("Test comment"); + frame.GetField(ID3FN_DESCRIPTION)->Set("A Description"); + tag.AddFrame(frame); + + frame.SetID(ID3FID_COMMENT); + frame.GetField(ID3FN_LANGUAGE)->Set("eng"); + frame.GetField(ID3FN_TEXT)->Set("Test comment 2"); + frame.GetField(ID3FN_DESCRIPTION)->Set(""); + tag.AddFrame(frame); + + frame.SetID(ID3FID_COMMENT); + frame.GetField(ID3FN_LANGUAGE)->Set("eng"); + frame.GetField(ID3FN_TEXT)->Set("ID3v1 comment text?"); + frame.GetField(ID3FN_DESCRIPTION)->Set(STR_V1_COMMENT_DESC); + tag.AddFrame(frame); + + tag.SetPadding(false); + tag.Update(ID3TT_ID3V2); + + cerr << "removed " << ID3_RemoveArtists(&tag) << " artist frames" << endl; + tag.Update(); + cerr << "removed " << ID3_RemoveTitles(&tag) << " title frames" << endl; + tag.Update(); + cerr << "removed " << RemoveFrame(tag, ID3FID_COMMENT, "") << " descriptionless comment frames" << endl; + tag.Update(); + } + + return 0; +} + diff --git a/id3lib/examples/test_unicode.cpp b/id3lib/examples/test_unicode.cpp new file mode 100644 index 0000000..96fd8aa --- /dev/null +++ b/id3lib/examples/test_unicode.cpp @@ -0,0 +1,31 @@ +// $Id: test_unicode.cpp,v 1.1 2007/11/12 21:33:01 pindakaasmod Exp $ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "id3/id3lib_streams.h" +#include + +int main( int argc, char *argv[]) +{ + ID3_Tag tag; + ID3_Frame frame; + + tag.Link("test-230-unicode.tag"); + tag.Strip(ID3TT_ALL); + tag.Clear(); + + frame.SetID(ID3FID_USERTEXT); + frame.GetField(ID3FN_DESCRIPTION)->Set("example text frame"); + frame.GetField(ID3FN_TEXT)->Set("This text and the description should be in Unicode."); + frame.GetField(ID3FN_TEXTENC)->Set(ID3TE_UNICODE); + tag.AddFrame(frame); + + tag.SetPadding(false); + tag.SetUnsync(false); + tag.Update(ID3TT_ID3V2); + + return 0; +} + diff --git a/id3lib/examples/thatspot.tag b/id3lib/examples/thatspot.tag new file mode 100644 index 0000000..5e46d81 Binary files /dev/null and b/id3lib/examples/thatspot.tag differ diff --git a/id3lib/id3com/EnumFields.cpp b/id3lib/id3com/EnumFields.cpp new file mode 100644 index 0000000..6fbfdce --- /dev/null +++ b/id3lib/id3com/EnumFields.cpp @@ -0,0 +1,111 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ +// +///////////////////////////////////////////////////////////////////////////// +// EnumFields.cpp : Implementation of DLL Exports. +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 26 Apr 2000 John Adcock Got working with id3lib 3.7.3 +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ID3COM.h" +#include "EnumFields.h" +#include + +///////////////////////////////////////////////////////////////////////////// +// CEnumFields +CEnumFields::CEnumFields() +{ + m_Tag = NULL; + m_CurrentNum = 0; +} + +CEnumFields::~CEnumFields() +{ + if(m_Tag != NULL) + { + m_Tag->Release(); + } +} + +IEnumVARIANT* CEnumFields::CreateObject(IID3ComTag* Tag) +{ + CComObject* pRetVal = new CComObject; + pRetVal->m_Tag = Tag; + pRetVal->m_Tag->AddRef(); + return pRetVal; +} + +STDMETHODIMP CEnumFields::Next(ULONG celt, VARIANT* rgelt, ULONG * pceltFetched) +{ + long NumItems; + m_Tag->get_Count(&NumItems); + for(long i(0); i < (long)((pceltFetched==NULL)?1:(*pceltFetched)); i++) + { + if(m_CurrentNum + i >= NumItems) + { + return S_FALSE; + } + else + { + IID3ComFrame* Frame; + m_Tag->get_Item(m_CurrentNum + i, &Frame); + *(_variant_t*)rgelt = Frame; + Frame->Release(); + rgelt++; + } + } + m_CurrentNum += ((pceltFetched==NULL)?1:(*pceltFetched)); + return S_OK; +} + +STDMETHODIMP CEnumFields::Skip(ULONG celt) +{ + m_CurrentNum += celt; + return S_OK; +} + +STDMETHODIMP CEnumFields::Reset(void) +{ + m_CurrentNum = 0; + return S_OK; +} + +STDMETHODIMP CEnumFields::Clone(IEnumVARIANT ** ppenum) +{ + CComObject* pRetVal = new CComObject; + pRetVal->m_Tag = m_Tag; + pRetVal->m_CurrentNum = m_CurrentNum; + pRetVal->m_Tag->AddRef(); + *ppenum = pRetVal; + return S_OK; +} + diff --git a/id3lib/id3com/EnumFields.h b/id3lib/id3com/EnumFields.h new file mode 100644 index 0000000..2b90394 --- /dev/null +++ b/id3lib/id3com/EnumFields.h @@ -0,0 +1,70 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ +// +///////////////////////////////////////////////////////////////////////////// +// EnumFields,h +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 26 Apr 2000 John Adcock Got working with id3lib 3.7.3 +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef __ENUMFIELDS_H_ +#define __ENUMFIELDS_H_ + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CEnumFields +class ATL_NO_VTABLE CEnumFields : + public CComObjectRootEx, + public IEnumVARIANT +{ +public: + CEnumFields(); + ~CEnumFields(); + + static IEnumVARIANT* CreateObject(IID3ComTag* Tag); + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CEnumFields) + COM_INTERFACE_ENTRY(IEnumVARIANT) +END_COM_MAP() + + STDMETHOD(Next)(ULONG celt, VARIANT* rgelt, ULONG * pceltFetched); + STDMETHOD(Skip)(ULONG celt); + STDMETHOD(Reset)(void); + STDMETHOD(Clone)(IEnumVARIANT ** ppenum); +protected: + IID3ComTag* m_Tag; + long m_CurrentNum; +}; + +#endif //__ENUMVBWORKITEMS_H_ diff --git a/id3lib/id3com/ID3COM.def b/id3lib/id3com/ID3COM.def new file mode 100644 index 0000000..5c89dda --- /dev/null +++ b/id3lib/id3com/ID3COM.def @@ -0,0 +1,9 @@ +; ID3COM.def : Declares the module parameters. + +LIBRARY "ID3COM.DLL" + +EXPORTS + DllCanUnloadNow @1 PRIVATE + DllGetClassObject @2 PRIVATE + DllRegisterServer @3 PRIVATE + DllUnregisterServer @4 PRIVATE diff --git a/id3lib/id3com/ID3COM.rc b/id3lib/id3com/ID3COM.rc new file mode 100644 index 0000000..076593d --- /dev/null +++ b/id3lib/id3com/ID3COM.rc @@ -0,0 +1,137 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""ID3COM.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 3,7,12,2 + PRODUCTVERSION 3,7,12,2 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "\0" + VALUE "FileDescription", "ID3libCOM Module\0" + VALUE "FileVersion", "3, 7, 12, 2\0" + VALUE "InternalName", "ID3libCOM\0" + VALUE "LegalCopyright", "Copyright 2000\0" + VALUE "LegalTrademarks", "\0" + VALUE "OLESelfRegister", "\0" + VALUE "OriginalFilename", "ID3libCOM.DLL\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "ID3libCOM Module\0" + VALUE "ProductVersion", "3, 7, 12, 2\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_ID3TAG REGISTRY DISCARDABLE "ID3Tag.rgs" +IDR_ID3FRAME REGISTRY DISCARDABLE "ID3Frame.rgs" +IDR_ID3FIELD REGISTRY DISCARDABLE "ID3Field.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "ID3libCOM" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_UNEXPECTED_ERROR "An unexpected error has occurred" + IDS_ERROR_BAD_FILENAME "You must specify a file and not a directory" + IDS_ERROR_BAD_URL "The URL could not be resolved" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "ID3COM.tlb" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/id3lib/id3com/ID3COMps.def b/id3lib/id3com/ID3COMps.def new file mode 100644 index 0000000..8116a7e --- /dev/null +++ b/id3lib/id3com/ID3COMps.def @@ -0,0 +1,11 @@ + +LIBRARY "ID3libCOMPS" + +DESCRIPTION 'Proxy/Stub DLL' + +EXPORTS + DllGetClassObject @1 PRIVATE + DllCanUnloadNow @2 PRIVATE + GetProxyDllInfo @3 PRIVATE + DllRegisterServer @4 PRIVATE + DllUnregisterServer @5 PRIVATE diff --git a/id3lib/id3com/ID3COMps.mk b/id3lib/id3com/ID3COMps.mk new file mode 100644 index 0000000..eab182c --- /dev/null +++ b/id3lib/id3com/ID3COMps.mk @@ -0,0 +1,16 @@ + +ID3libCOMps.dll: dlldata.obj ID3libCOM_p.obj ID3libCOM_i.obj + link /dll /out:ID3libCOMps.dll /def:ID3libCOMps.def /entry:DllMain dlldata.obj ID3libCOM_p.obj ID3libCOM_i.obj \ + kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \ + +.c.obj: + cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \ + $< + +clean: + @del ID3libCOMps.dll + @del ID3libCOMps.lib + @del ID3libCOMps.exp + @del dlldata.obj + @del ID3libCOM_p.obj + @del ID3libCOM_i.obj diff --git a/id3lib/id3com/ID3Field.cpp b/id3lib/id3com/ID3Field.cpp new file mode 100644 index 0000000..bd1fb14 --- /dev/null +++ b/id3lib/id3com/ID3Field.cpp @@ -0,0 +1,270 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ +// +///////////////////////////////////////////////////////////////////////////// +// ID3Field.cpp : Implementation of CID3Field +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 26 Apr 2000 John Adcock Got working with id3lib 3.7.3 +// 18 Aug 2000 Philip Oldaker Added Picture Functionality +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ID3COM.h" +#include "ID3Field.h" +#include "ID3Frame.h" + +///////////////////////////////////////////////////////////////////////////// +// CID3Field + +CID3Field::CID3Field() +{ + m_Field = NULL; + m_FrameParent = NULL; +} + +CID3Field::~CID3Field() +{ + if(m_FrameParent != NULL) + { + m_FrameParent->Release(); + } + m_Field = NULL; +} + +IID3ComField* CID3Field::CreateObject(IID3ComFrame* FrameParent, ID3_Field* Field) +{ + CComObject* pRetVal = new CComObject; + pRetVal->m_Field = Field; + pRetVal->m_FrameParent = FrameParent; + FrameParent->AddRef(); + return (IID3ComField*)pRetVal; +} + +STDMETHODIMP CID3Field::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_IID3ComField + }; + for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++) + { + if (InlineIsEqualGUID(*arr[i],riid)) + return S_OK; + } + return S_FALSE; +} + +STDMETHODIMP CID3Field::get_Text(long ItemNum, BSTR *pVal) +{ + USES_CONVERSION; + luint TryChars = 0; + luint GotChars = 0; + try + { + *pVal = NULL; + size_t nText = m_Field->Size(); + if(m_Field->GetEncoding() == ID3TE_UNICODE) + { + unicode_t* sText = new unicode_t[nText + 1]; + try + { + m_Field->Get(sText, nText, ItemNum - 1); + sText[nText] = '\0'; + *pVal = SysAllocString(sText); + } + catch (...) + { + *pVal = NULL; + } + delete [] sText; + } + else + { + char* sText = new char[nText + 1]; + try + { + m_Field->Get(sText, nText, ItemNum - 1); + sText[nText] = '\0'; + *pVal = SysAllocString(A2W(sText)); + } + catch (...) + { + *pVal = NULL; + } + delete [] sText; + } + return S_OK; + } + catch (...) + { + return Error(IDS_UNEXPECTED_ERROR, IID_IID3ComField, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Field::put_Text(long ItemNum, BSTR newVal) +{ + try + { + m_Field->Set(newVal); + return S_OK; + } + catch (...) + { + return Error(IDS_UNEXPECTED_ERROR, IID_IID3ComField, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Field::get_Long(long *pVal) +{ + try + { + *pVal = m_Field->Get(); + return S_OK; + } + catch (...) + { + return Error(IDS_UNEXPECTED_ERROR, IID_IID3ComField, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Field::put_Long(long newVal) +{ + try + { + m_Field->Set(newVal); + return S_OK; + } + catch (...) + { + return Error(IDS_UNEXPECTED_ERROR, IID_IID3ComField, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Field::Clear() +{ + try + { + m_Field->Clear(); + return S_OK; + } + catch (...) + { + return Error(IDS_UNEXPECTED_ERROR, IID_IID3ComField, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Field::CopyDataToFile(BSTR FileName) +{ + USES_CONVERSION; + try + { + m_Field->ToFile(OLE2A(FileName)); + return S_OK; + } + catch (...) + { + return Error(IDS_UNEXPECTED_ERROR, IID_IID3ComField, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Field::CopyDataFromFile(BSTR FileName) +{ + USES_CONVERSION; + try + { + m_Field->FromFile(OLE2A(FileName)); + return S_OK; + } + catch (...) + { + return Error(IDS_UNEXPECTED_ERROR, IID_IID3ComField, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Field::get_NumTextItems(long *pVal) +{ + try + { + *pVal = m_Field->GetNumTextItems(); + return S_OK; + } + catch (...) + { + return Error(IDS_UNEXPECTED_ERROR, IID_IID3ComField, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Field::get_Binary(BSTR *pVal) +{ + // TODO: Add your implementation code here + if (pVal == NULL) + return E_POINTER; + try + { + *pVal = NULL; + const uchar *pData = m_Field->GetRawBinary(); + if (pData == NULL) + return E_FAIL; + ID3_Frame *pFrame = ((CID3Frame*)m_FrameParent)->GetID3Frame(); + if (pFrame->GetID() == ID3FID_PICTURE) + { + *pVal = _bstr_t((LPCTSTR)pData).copy(); + } + else + { + *pVal = SysAllocStringByteLen((const char *)pData,m_Field->Size()); + } + } + catch (...) + { + return Error(IDS_UNEXPECTED_ERROR, IID_IID3ComField, E_UNEXPECTED); + } + return S_OK; +} + +STDMETHODIMP CID3Field::put_Binary(BSTR newVal) +{ + // TODO: Add your implementation code here + try + { + size_t Size = SysStringByteLen(newVal); + m_Field->Set((const uchar *)newVal,Size); + } + catch (...) + { + return Error(IDS_UNEXPECTED_ERROR, IID_IID3ComField, E_UNEXPECTED); + } + return S_OK; +} +/////////////////////////////////////////////////////// +// End Added Philip Oldaker 12-Aug 2000 +/////////////////////////////////////////////////////// + diff --git a/id3lib/id3com/ID3Field.h b/id3lib/id3com/ID3Field.h new file mode 100644 index 0000000..7085dde --- /dev/null +++ b/id3lib/id3com/ID3Field.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ +// +///////////////////////////////////////////////////////////////////////////// +// ID3Field.h : Declaration of the CID3Field +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 26 Apr 2000 John Adcock Got working with id3lib 3.7.3 +// 18 Aug 2000 Philip Oldaker Added Picture Functionality +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef __ID3FIELD_H_ +#define __ID3FIELD_H_ + +#include "resource.h" // main symbols +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CID3Field +class ATL_NO_VTABLE CID3Field : + public CComObjectRootEx, + public CComCoClass, + public ISupportErrorInfo, + public IDispatchImpl +{ +public: + CID3Field(); + ~CID3Field(); + ID3_Field *GetID3Field() + { + return m_Field; + } + + static IID3ComField* CreateObject(IID3ComFrame* FrameParent, ID3_Field* Field); + +DECLARE_REGISTRY_RESOURCEID(IDR_ID3FIELD) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CID3Field) + COM_INTERFACE_ENTRY(IID3ComField) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISupportErrorInfo) +END_COM_MAP() + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// IID3ComField +public: + STDMETHOD(get_Binary)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_Binary)(/*[in]*/ BSTR newVal); + STDMETHOD(get_NumTextItems)(/*[out, retval]*/ long *pVal); + STDMETHOD(CopyDataFromFile)(BSTR FileName); + STDMETHOD(CopyDataToFile)(BSTR FileName); + STDMETHOD(Clear)(); + STDMETHOD(get_Long)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_Long)(/*[in]*/ long newVal); + STDMETHOD(get_Text)(/*[in]*/ long ItemNum, /*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_Text)(/*[in]*/ long ItemNum, /*[in]*/ BSTR newVal); +protected: + ID3_Field* m_Field; + IID3ComFrame* m_FrameParent; +}; + +#endif //__ID3FIELD_H_ diff --git a/id3lib/id3com/ID3Field.rgs b/id3lib/id3com/ID3Field.rgs new file mode 100644 index 0000000..863d754 --- /dev/null +++ b/id3lib/id3com/ID3Field.rgs @@ -0,0 +1,26 @@ +HKCR +{ + ID3COM.ID3ComField.1 = s 'ID3ComField Class' + { + CLSID = s '{A513A24F-C749-11D3-841C-0008C782A257}' + } + ID3COM.ID3ComField = s 'ID3ComField Class' + { + CLSID = s '{A513A24F-C749-11D3-841C-0008C782A257}' + CurVer = s 'ID3COM.ID3ComField.1' + } + NoRemove CLSID + { + ForceRemove {A513A24F-C749-11D3-841C-0008C782A257} = s 'ID3ComField Class' + { + ProgID = s 'ID3COM.ID3ComField.1' + VersionIndependentProgID = s 'ID3COM.ID3ComField' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{AEBA98B0-C36C-11D3-841B-0008C782A257}' + } + } +} diff --git a/id3lib/id3com/ID3Frame.cpp b/id3lib/id3com/ID3Frame.cpp new file mode 100644 index 0000000..67417aa --- /dev/null +++ b/id3lib/id3com/ID3Frame.cpp @@ -0,0 +1,202 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ +// +///////////////////////////////////////////////////////////////////////////// +// ID3Frame.cpp : Implementation of CID3Frame +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 26 Apr 2000 John Adcock Got working with id3lib 3.7.3 +// 18 Aug 2000 Philip Oldaker Added Picture Functionality +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ID3COM.h" +#include "ID3Frame.h" +#include "ID3Field.h" + +///////////////////////////////////////////////////////////////////////////// +// CID3Frame + +CID3Frame::CID3Frame() +{ + m_Frame = NULL; + m_TagParent = NULL; +} + +CID3Frame::~CID3Frame() +{ + if(m_TagParent != NULL) + { + m_TagParent->Release(); + } + m_Frame = NULL; +} + +IID3ComFrame* CID3Frame::CreateObject(IID3ComTag* TagParent, ID3_Frame* Frame) +{ + CComObject* pRetVal = new CComObject; + pRetVal->m_Frame = Frame; + pRetVal->m_TagParent = TagParent; + TagParent->AddRef(); + return (IID3ComFrame*)pRetVal; +} + +STDMETHODIMP CID3Frame::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_IID3ComFrame + }; + for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++) + { + if (InlineIsEqualGUID(*arr[i],riid)) + return S_OK; + } + return S_FALSE; +} + +STDMETHODIMP CID3Frame::get_Field(eID3FieldTypes FieldType, IID3ComField** pVal) +{ + try + { + *pVal = NULL; + ID3_Field* Field = &(m_Frame->Field((enum ID3_FieldID)FieldType)); + if(Field != NULL) + { + *pVal = CID3Field::CreateObject(this, Field); + (*pVal)->AddRef(); + } + else + { + *pVal = NULL; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComFrame, "An unexpected error has occurred", IID_IID3ComFrame, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Frame::Clear() +{ + try + { + m_Frame->Clear(); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComFrame, "An unexpected error has occurred", IID_IID3ComFrame, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Frame::get_ID(eID3FrameTypes *pVal) +{ + try + { + *pVal = ID3_NOFRAME; + *pVal = (eID3FrameTypes)m_Frame->GetID(); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComFrame, "An unexpected error has occurred", IID_IID3ComFrame, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Frame::put_ID(eID3FrameTypes newVal) +{ + try + { + m_Frame->SetID((ID3_FrameID)newVal); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComFrame, "An unexpected error has occurred", IID_IID3ComFrame, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Frame::get_FrameName(BSTR *pVal) +{ + USES_CONVERSION; + try + { + const char* sDesc = m_Frame->GetDescription(); + if(sDesc != NULL) + { + *pVal = SysAllocString(A2W(sDesc)); + } + else + { + *pVal = SysAllocString(L"Unknown Frame"); + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComFrame, "An unexpected error has occurred", IID_IID3ComFrame, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Frame::put_Compressed(VARIANT_BOOL newVal) +{ + try + { + m_Frame->SetCompression(newVal == VARIANT_TRUE); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComFrame, "An unexpected error has occurred", IID_IID3ComFrame, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Frame::get_Compressed(VARIANT_BOOL *pVal) +{ + USES_CONVERSION; + try + { + if(m_Frame->GetCompression()) + { + *pVal = VARIANT_TRUE; + } + else + { + *pVal = VARIANT_FALSE; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComFrame, "An unexpected error has occurred", IID_IID3ComFrame, E_UNEXPECTED); + } +} \ No newline at end of file diff --git a/id3lib/id3com/ID3Frame.h b/id3lib/id3com/ID3Frame.h new file mode 100644 index 0000000..ce656e1 --- /dev/null +++ b/id3lib/id3com/ID3Frame.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ +// +///////////////////////////////////////////////////////////////////////////// +// ID3Frame.h : Declaration of the CID3Frame +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 18 Aug 2000 Philip Oldaker Added Picture Functionality +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef __ID3FRAME_H_ +#define __ID3FRAME_H_ + +#include "resource.h" // main symbols +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CID3Frame +class ATL_NO_VTABLE CID3Frame : + public CComObjectRootEx, + public CComCoClass, + public ISupportErrorInfo, + public IDispatchImpl +{ +public: + CID3Frame(); + ~CID3Frame(); + ID3_Frame *GetID3Frame() + { + return m_Frame; + } + static IID3ComFrame* CreateObject(IID3ComTag* TagParent, ID3_Frame* Frame); + +DECLARE_REGISTRY_RESOURCEID(IDR_ID3FRAME) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CID3Frame) + COM_INTERFACE_ENTRY(IID3ComFrame) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISupportErrorInfo) +END_COM_MAP() + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// IID3ComFrame +public: + STDMETHOD(get_Compressed)(/*[out, retval]*/ VARIANT_BOOL *pVal); + STDMETHOD(put_Compressed)(/*[in]*/ VARIANT_BOOL newVal); + STDMETHOD(get_FrameName)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_ID)(/*[out, retval]*/ eID3FrameTypes *pVal); + STDMETHOD(put_ID)(/*[in]*/ eID3FrameTypes newVal); + STDMETHOD(Clear)(); + STDMETHOD(get_Field)(/*[in]*/ eID3FieldTypes FieldType, /*[out, retval]*/ IID3ComField** pVal); + +protected: + ID3_Frame* m_Frame; + IID3ComTag* m_TagParent; +}; + +#endif //__ID3FRAME_H_ diff --git a/id3lib/id3com/ID3Frame.rgs b/id3lib/id3com/ID3Frame.rgs new file mode 100644 index 0000000..062a2ff --- /dev/null +++ b/id3lib/id3com/ID3Frame.rgs @@ -0,0 +1,26 @@ +HKCR +{ + ID3COM.ID3ComFrame.1 = s 'ID3ComFrame Class' + { + CLSID = s '{AEBA98BF-C36C-11D3-841B-0008C782A257}' + } + ID3COM.ID3ComFrame = s 'ID3ComFrame Class' + { + CLSID = s '{AEBA98BF-C36C-11D3-841B-0008C782A257}' + CurVer = s 'ID3COM.ID3ComFrame.1' + } + NoRemove CLSID + { + ForceRemove {AEBA98BF-C36C-11D3-841B-0008C782A257} = s 'ID3ComFrame Class' + { + ProgID = s 'ID3COM.ID3ComFrame.1' + VersionIndependentProgID = s 'ID3COM.ID3ComFrame' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{AEBA98B0-C36C-11D3-841B-0008C782A257}' + } + } +} diff --git a/id3lib/id3com/ID3Tag.cpp b/id3lib/id3com/ID3Tag.cpp new file mode 100644 index 0000000..e583409 --- /dev/null +++ b/id3lib/id3com/ID3Tag.cpp @@ -0,0 +1,905 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ +// +///////////////////////////////////////////////////////////////////////////// +// ID3Tag.cpp : Implementation of CID3Tag +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 26 Apr 2000 John Adcock Got working with id3lib 3.7.3 +// 18 Aug 2000 Philip Oldaker Added Picture Functionality +// +///////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ID3COM.h" +#include "ID3Tag.h" +#include "config.h" +#include "ID3Frame.h" +#include "ID3Field.h" +#include "EnumFields.h" +#include "id3/misc_support.h" +#include "math.h" + +///////////////////////////////////////////////////////////////////////////// +// CID3Tag + +CID3Tag::CID3Tag() +{ + m_ID3Tag = new ID3_Tag(); +} + +CID3Tag::~CID3Tag() +{ + if(m_ID3Tag != NULL) + { + delete m_ID3Tag; + } +} + +STDMETHODIMP CID3Tag::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_IID3ComTag + }; + for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++) + { + if (InlineIsEqualGUID(*arr[i],riid)) + return S_OK; + } + return S_FALSE; +} + + +STDMETHODIMP CID3Tag::Link(BSTR *FileName) +{ + USES_CONVERSION; + + if(FileName == NULL) + { + return E_INVALIDARG; + } + + try + { + m_ID3Tag->Link(OLE2A(*FileName)); + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } + return S_OK; +} + +STDMETHODIMP CID3Tag::Clear() +{ + try + { + m_ID3Tag->Clear(); + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } + return S_OK; +} + +STDMETHODIMP CID3Tag::get_HasChanged(VARIANT_BOOL *pVal) +{ + try + { + *pVal = VARIANT_FALSE; + if(m_ID3Tag->HasChanged()) + { + *pVal = VARIANT_TRUE; + } + else + { + *pVal = VARIANT_FALSE; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::FindFrame(eID3FrameTypes FrameID, VARIANT_BOOL CreateNewIfNotFound, IID3ComFrame** pVal) +{ + try + { + *pVal = NULL; + ID3_Frame* pFrame = m_ID3Tag->Find((enum ID3_FrameID)FrameID); + if(CreateNewIfNotFound == VARIANT_TRUE && pFrame == NULL) + { + pFrame = new ID3_Frame((enum ID3_FrameID)FrameID); + m_ID3Tag->AttachFrame(pFrame); + } + if(pFrame != NULL) + { + *pVal = CID3Frame::CreateObject(this, pFrame); + (*pVal)->AddRef(); + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get__NewEnum(IUnknown** pRetVal) +{ + *pRetVal = CEnumFields::CreateObject(this); + (*pRetVal)->AddRef(); + return S_OK; +} + +STDMETHODIMP CID3Tag::get_Count(long *pVal) +{ + try + { + *pVal = 0; + *pVal = m_ID3Tag->NumFrames(); + return S_OK; + } + catch (...) + { + *pVal = 0; + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_Item(long FrameNum, IID3ComFrame** pVal) +{ + try + { + *pVal = NULL; + ID3_Frame* pFrame = NULL; + ID3_Tag::Iterator* it = m_ID3Tag->CreateIterator(); + pFrame = it->GetNext(); + while(FrameNum) + { + pFrame = it->GetNext(); + --FrameNum; + } + delete it; + if(pFrame != NULL) + { + *pVal = CID3Frame::CreateObject(this, pFrame); + (*pVal)->AddRef(); + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::SaveV1Tag() +{ + try + { + m_ID3Tag->Update(ID3TT_ID3V1); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::StripV1Tag() +{ + try + { + m_ID3Tag->Strip(ID3TT_ID3V1); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::SaveV2Tag() +{ + try + { + m_ID3Tag->Update(ID3TT_ID3V2); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::StripV2Tag() +{ + try + { + m_ID3Tag->Strip(ID3TT_ID3V2); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_Artist(BSTR *pVal) +{ + USES_CONVERSION; + try + { + *pVal = NULL; + char* RetStr = NULL; + RetStr = ID3_GetArtist(m_ID3Tag); + *pVal = SysAllocString(A2W(RetStr)); + if(RetStr != NULL) + { + delete [] RetStr; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_Artist(BSTR newVal) +{ + USES_CONVERSION; + try + { + ID3_Frame *pFrame; + if((pFrame = m_ID3Tag->Find(ID3FID_LEADARTIST)) == NULL && + (pFrame = m_ID3Tag->Find(ID3FID_BAND)) == NULL && + (pFrame = m_ID3Tag->Find(ID3FID_CONDUCTOR)) == NULL && + (pFrame = m_ID3Tag->Find(ID3FID_COMPOSER)) == NULL) + { + pFrame = new ID3_Frame(ID3FID_LEADARTIST); + m_ID3Tag->AttachFrame(pFrame); + } + pFrame->Field(ID3FN_TEXT) = OLE2A(newVal); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_Album(BSTR *pVal) +{ + USES_CONVERSION; + char* RetStr = NULL; + try + { + *pVal = NULL; + RetStr = ID3_GetAlbum(m_ID3Tag); + *pVal = SysAllocString(A2W(RetStr)); + if(RetStr != NULL) + { + delete [] RetStr; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_Album(BSTR newVal) +{ + USES_CONVERSION; + try + { + ID3_AddAlbum(m_ID3Tag, OLE2A(newVal), true); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_Title(BSTR *pVal) +{ + USES_CONVERSION; + char* RetStr = NULL; + try + { + *pVal = NULL; + RetStr = ID3_GetTitle(m_ID3Tag); + *pVal = SysAllocString(A2W(RetStr)); + if(RetStr != NULL) + { + delete [] RetStr; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_Title(BSTR newVal) +{ + USES_CONVERSION; + try + { + ID3_AddTitle(m_ID3Tag, OLE2A(newVal), true); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_Comment(BSTR *pVal) +{ + USES_CONVERSION; + try + { + *pVal = NULL; + char* RetStr = NULL; + RetStr = ID3_GetComment(m_ID3Tag); + *pVal = SysAllocString(A2W(RetStr)); + if(RetStr != NULL) + { + delete [] RetStr; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_Comment(BSTR newVal) +{ + USES_CONVERSION; + try + { + ID3_AddComment(m_ID3Tag, OLE2A(newVal), STR_V1_COMMENT_DESC, true); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_Genre(long *pVal) +{ + try + { + *pVal = 255; + *pVal = ID3_GetGenreNum(m_ID3Tag); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_Genre(long newVal) +{ + try + { + ID3_AddGenre(m_ID3Tag, newVal, true); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_Year(BSTR *pVal) +{ + USES_CONVERSION; + try + { + *pVal = 0; + char* RetStr = NULL; + RetStr = ID3_GetYear(m_ID3Tag); + *pVal = SysAllocString(A2W(RetStr)); + if(RetStr != NULL) + { + delete [] RetStr; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_Year(BSTR newVal) +{ + USES_CONVERSION; + try + { + ID3_AddYear(m_ID3Tag, OLE2A(newVal), true); + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } + return S_OK; +} + +STDMETHODIMP CID3Tag::get_Track(long *pVal) +{ + try + { + *pVal = -1; + *pVal = ID3_GetTrackNum(m_ID3Tag); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_Track(long newVal) +{ + try + { + ID3_AddTrack(m_ID3Tag, (uchar)newVal, 0, true); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_LastPlayed(DATE *pVal) +{ + try + { + *pVal = 0; + ID3_Frame *pFrame = m_ID3Tag->Find(ID3FID_USERTEXT, ID3FN_DESCRIPTION, "LastPlayed"); + if (pFrame != NULL) + { + char* szLastPlayed = ID3_GetString(pFrame, ID3FN_TEXT); + if(szLastPlayed != NULL) + { + *pVal = atof(szLastPlayed); + delete [] szLastPlayed; + } + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_LastPlayed(DATE newVal) +{ + try + { + ID3_Frame *pFrame = m_ID3Tag->Find(ID3FID_USERTEXT, ID3FN_DESCRIPTION, "LastPlayed"); + if(pFrame == NULL) + { + pFrame = new ID3_Frame(ID3FID_USERTEXT); + pFrame->Field(ID3FN_DESCRIPTION) = "LastPlayed"; + pFrame->Field(ID3FN_TEXTENC) = ID3TE_ASCII; + m_ID3Tag->AttachFrame(pFrame); + } + char Buffer[40]; + sprintf(Buffer, "%6.7f", newVal); + pFrame->Field(ID3FN_TEXT) = Buffer; + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_HasV1Tag(VARIANT_BOOL *pVal) +{ + try + { + *pVal = VARIANT_FALSE; + if (m_ID3Tag->HasTagType(ID3TT_ID3V1)) + { + *pVal = VARIANT_TRUE; + } + else + { + *pVal = VARIANT_FALSE; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_HasV2Tag(VARIANT_BOOL *pVal) +{ + try + { + *pVal = VARIANT_FALSE; + if (m_ID3Tag->HasTagType(ID3TT_ID3V2)) + { + *pVal = VARIANT_TRUE; + } + else + { + *pVal = VARIANT_FALSE; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_HasLyrics(VARIANT_BOOL *pVal) +{ + try + { + if (m_ID3Tag->HasTagType(ID3TT_LYRICS)) + { + *pVal = VARIANT_TRUE; + } + else + { + *pVal = VARIANT_FALSE; + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::FindFrameString(eID3FrameTypes FrameID, eID3FieldTypes FieldType, BSTR FindString, VARIANT_BOOL CreateNewIfNotFound, IID3ComFrame** pVal) +{ + try + { + *pVal = NULL; + ID3_Frame* pFrame = m_ID3Tag->Find((enum ID3_FrameID)FrameID, (enum ID3_FieldID)FieldType, FindString); + if(CreateNewIfNotFound == VARIANT_TRUE && pFrame == NULL) + { + pFrame = new ID3_Frame((enum ID3_FrameID)FrameID); + pFrame->Field((enum ID3_FieldID)FieldType) = FindString; + m_ID3Tag->AttachFrame(pFrame); + } + if(pFrame != NULL) + { + *pVal = CID3Frame::CreateObject(this, pFrame); + (*pVal)->AddRef(); + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + + +STDMETHODIMP CID3Tag::get_PlayCount(BSTR EMailAddress, long *pVal) +{ + try + { + *pVal = 0; + ID3_Frame *pFrame = m_ID3Tag->Find(ID3FID_POPULARIMETER, ID3FN_EMAIL, EMailAddress); + if (pFrame != NULL) + { + *pVal = pFrame->Field(ID3FN_COUNTER).Get(); + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_PlayCount(BSTR EMailAddress, long newVal) +{ + try + { + ID3_Frame *pFrame = m_ID3Tag->Find(ID3FID_POPULARIMETER, ID3FN_EMAIL, EMailAddress); + if(pFrame == NULL) + { + pFrame = new ID3_Frame(ID3FID_POPULARIMETER); + pFrame->Field(ID3FN_EMAIL) = EMailAddress; + m_ID3Tag->AttachFrame(pFrame); + } + pFrame->Field(ID3FN_COUNTER) = newVal; + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_Popularity(BSTR EMailAddress, short *pVal) +{ + try + { + *pVal = 0; + ID3_Frame *pFrame = m_ID3Tag->Find(ID3FID_POPULARIMETER, ID3FN_EMAIL, EMailAddress); + if (pFrame != NULL) + { + *pVal = (short)pFrame->Field(ID3FN_RATING).Get(); + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_Popularity(BSTR EMailAddress, short newVal) +{ + try + { + ID3_Frame *pFrame = m_ID3Tag->Find(ID3FID_POPULARIMETER, ID3FN_EMAIL, EMailAddress); + if(pFrame == NULL) + { + pFrame = new ID3_Frame(ID3FID_POPULARIMETER); + pFrame->Field(ID3FN_EMAIL) = EMailAddress; + m_ID3Tag->AttachFrame(pFrame); + } + pFrame->Field(ID3FN_RATING) = newVal; + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_TagCreated(DATE *pVal) +{ + try + { + *pVal = 0; + ID3_Frame *pFrame = m_ID3Tag->Find(ID3FID_USERTEXT, ID3FN_DESCRIPTION, "TagCreated"); + if (pFrame != NULL) + { + char* szTagCreated = ID3_GetString(pFrame, ID3FN_TEXT); + if(szTagCreated != NULL) + { + *pVal = atof(szTagCreated); + delete [] szTagCreated; + } + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_TagCreated(DATE newVal) +{ + try + { + ID3_Frame *pFrame = m_ID3Tag->Find(ID3FID_USERTEXT, ID3FN_DESCRIPTION, "TagCreated"); + if(pFrame == NULL) + { + pFrame = new ID3_Frame(ID3FID_USERTEXT); + pFrame->Field(ID3FN_DESCRIPTION) = "TagCreated"; + pFrame->Field(ID3FN_TEXTENC) = ID3TE_ASCII; + m_ID3Tag->AttachFrame(pFrame); + } + char Buffer[40]; + sprintf(Buffer, "%6.7f", newVal); + pFrame->Field(ID3FN_TEXT) = Buffer; + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_PercentVolumeAdjust(double *pVal) +{ + try + { + *pVal = 100; + ID3_Frame *pFrame = m_ID3Tag->Find(ID3FID_USERTEXT, ID3FN_DESCRIPTION, "PercentVolAdj"); + if (pFrame != NULL) + { + char* szVolAdjust = ID3_GetString(pFrame, ID3FN_TEXT); + if(szVolAdjust != NULL) + { + *pVal = atof(szVolAdjust); + delete [] szVolAdjust; + } + } + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_PercentVolumeAdjust(double newVal) +{ + try + { + ID3_Frame *pFrame = m_ID3Tag->Find(ID3FID_USERTEXT, ID3FN_DESCRIPTION, "PercentVolAdj"); + if(pFrame == NULL) + { + pFrame = new ID3_Frame(ID3FID_USERTEXT); + pFrame->Field(ID3FN_DESCRIPTION) = "PercentVolAdj"; + pFrame->Field(ID3FN_TEXTENC) = ID3TE_ASCII; + m_ID3Tag->AttachFrame(pFrame); + } + char Buffer[40]; + sprintf(Buffer, "%6.7f", newVal); + pFrame->Field(ID3FN_TEXT) = Buffer; + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_Padding(VARIANT_BOOL newVal) +{ + try + { + m_ID3Tag->SetPadding(newVal == VARIANT_TRUE); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::put_UnSync(VARIANT_BOOL newVal) +{ + try + { + m_ID3Tag->SetUnsync(newVal == VARIANT_TRUE); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::get_VersionString(BSTR *pVal) +{ + USES_CONVERSION; + try + { + // this buffer needs to be overly large + // for some unexplained reason + // if the size is small you get what? + char Buffer[1024]; + sprintf(Buffer, "id3com %d.%d.%d Compiled %s %s", _ID3LIB_MAJOR_VERSION, + _ID3LIB_MINOR_VERSION, + _ID3LIB_PATCH_VERSION, + __DATE__, + __TIME__); + *pVal = SysAllocString(A2W(Buffer)); + return S_OK; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } +} + +STDMETHODIMP CID3Tag::RemoveFrame(eID3FrameTypes FrameID) +{ + // TODO: Add your implementation code here + HRESULT hr=S_OK; + try + { + ID3_Frame* pFrame = m_ID3Tag->Find((enum ID3_FrameID)FrameID); + if (pFrame) + { + /* pTag is an ID3_Tag */ + delete m_ID3Tag->RemoveFrame(pFrame); + } + else + hr = E_POINTER; + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } + return hr; +} + +STDMETHODIMP CID3Tag::RemoveFrameByNum(long FrameNum) +{ + HRESULT hr=S_OK; + try + { + ID3_Frame* pFrame = NULL; + ID3_Tag::Iterator* it = m_ID3Tag->CreateIterator(); + pFrame = it->GetNext(); + while(FrameNum) + { + pFrame = it->GetNext(); + --FrameNum; + } + delete it; + + if(pFrame) + { + /* pTag is an ID3_Tag */ + delete m_ID3Tag->RemoveFrame(pFrame); + } + else + { + hr = E_POINTER; + } + } + catch (...) + { + return AtlReportError(CLSID_ID3ComTag, "An unexpected error has occurred", IID_IID3ComTag, E_UNEXPECTED); + } + + return hr; +} +/////////////////////////////////////////////////////// +// End Added Philip Oldaker 12-Aug 2000 +/////////////////////////////////////////////////////// + diff --git a/id3lib/id3com/ID3Tag.h b/id3lib/id3com/ID3Tag.h new file mode 100644 index 0000000..b9a954e --- /dev/null +++ b/id3lib/id3com/ID3Tag.h @@ -0,0 +1,121 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ +// +///////////////////////////////////////////////////////////////////////////// +// ID3Tag.h : Declaration of the CID3Tag +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 26 Apr 2000 John Adcock Got working with id3lib 3.7.3 +// 18 Aug 2000 Philip Oldaker Added Picture Functionality +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef __ID3TAG_H_ +#define __ID3TAG_H_ + +#include "resource.h" // main symbols +#include +#include "ID3COM.h" + +///////////////////////////////////////////////////////////////////////////// +// CID3Tag +class ATL_NO_VTABLE CID3Tag : + public CComObjectRootEx, + public CComCoClass, + public ISupportErrorInfo, + public IDispatchImpl +{ +public: + CID3Tag(); + ~CID3Tag(); + +DECLARE_REGISTRY_RESOURCEID(IDR_ID3TAG) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CID3Tag) + COM_INTERFACE_ENTRY(IID3ComTag) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISupportErrorInfo) +END_COM_MAP() + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// IID3ComTag +public: + STDMETHOD(RemoveFrameByNum)(/*[in]*/ long FrameNum); + STDMETHOD(RemoveFrame)(/*[in]*/ eID3FrameTypes FrameID); + STDMETHOD(get_VersionString)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_UnSync)(/*[in]*/ VARIANT_BOOL newVal); + STDMETHOD(put_Padding)(/*[in]*/ VARIANT_BOOL newVal); + STDMETHOD(get_PercentVolumeAdjust)(/*[out, retval]*/ double *pVal); + STDMETHOD(put_PercentVolumeAdjust)(/*[in]*/ double newVal); + STDMETHOD(get_TagCreated)(/*[out, retval]*/ DATE *pVal); + STDMETHOD(put_TagCreated)(/*[in]*/ DATE newVal); + STDMETHOD(get_Popularity)(/*[in]*/ BSTR EMailAddress, /*[out, retval]*/ short *pVal); + STDMETHOD(put_Popularity)(/*[in]*/ BSTR EMailAddress, /*[in]*/ short newVal); + STDMETHOD(get_PlayCount)(/*[in]*/ BSTR EMailAddress, /*[out, retval]*/ long *pVal); + STDMETHOD(put_PlayCount)(/*[in]*/ BSTR EMailAddress, /*[in]*/ long newVal); + STDMETHOD(FindFrameString)(/*[in]*/ eID3FrameTypes FrameID, /*[in]*/ eID3FieldTypes FieldType, /*[in]*/ BSTR FindString, /*[in]*/ VARIANT_BOOL CreateNewIfNotFound, /*[out, retval]*/ IID3ComFrame** pVal); + STDMETHOD(get_HasLyrics)(/*[out, retval]*/ VARIANT_BOOL *pVal); + STDMETHOD(get_HasV2Tag)(/*[out, retval]*/ VARIANT_BOOL *pVal); + STDMETHOD(get_HasV1Tag)(/*[out, retval]*/ VARIANT_BOOL *pVal); + STDMETHOD(get_LastPlayed)(/*[out, retval]*/ DATE *pVal); + STDMETHOD(put_LastPlayed)(/*[in]*/ DATE newVal); + STDMETHOD(get_Track)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_Track)(/*[in]*/ long newVal); + STDMETHOD(get_Year)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_Year)(/*[in]*/ BSTR newVal); + STDMETHOD(get_Genre)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_Genre)(/*[in]*/ long newVal); + STDMETHOD(get_Comment)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_Comment)(/*[in]*/ BSTR newVal); + STDMETHOD(get_Title)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_Title)(/*[in]*/ BSTR newVal); + STDMETHOD(get_Album)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_Album)(/*[in]*/ BSTR newVal); + STDMETHOD(get_Artist)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_Artist)(/*[in]*/ BSTR newVal); + STDMETHOD(StripV2Tag)(); + STDMETHOD(SaveV2Tag)(); + STDMETHOD(StripV1Tag)(); + STDMETHOD(SaveV1Tag)(); + STDMETHOD(get_Item)(/*[in]*/ long FrameNum, /*[out, retval]*/ IID3ComFrame** pVal); + STDMETHOD(get_Count)(/*[out, retval]*/ long *pVal); + STDMETHOD(FindFrame)(/*[in]*/ eID3FrameTypes FrameID, /*[in]*/ VARIANT_BOOL CreateNewIfNotFound, /*[out, retval]*/ IID3ComFrame** pVal); + STDMETHOD(get_HasChanged)(/*[out, retval]*/ VARIANT_BOOL *pVal); + STDMETHOD(Clear)(); + STDMETHOD(Link)(BSTR* FileName); + STDMETHOD(get__NewEnum)(/*[out, retval]*/ IUnknown** pRetVal); +protected: + ID3_Tag* m_ID3Tag; +}; + +#endif //__ID3TAG_H_ diff --git a/id3lib/id3com/ID3Tag.rgs b/id3lib/id3com/ID3Tag.rgs new file mode 100644 index 0000000..6b23610 --- /dev/null +++ b/id3lib/id3com/ID3Tag.rgs @@ -0,0 +1,26 @@ +HKCR +{ + ID3COM.ID3ComTag.1 = s 'ID3ComTag Class' + { + CLSID = s '{AEBA98BD-C36C-11D3-841B-0008C782A257}' + } + ID3COM.ID3ComTag = s 'ID3ComTag Class' + { + CLSID = s '{AEBA98BD-C36C-11D3-841B-0008C782A257}' + CurVer = s 'ID3libCOM.ID3ComTag.1' + } + NoRemove CLSID + { + ForceRemove {AEBA98BD-C36C-11D3-841B-0008C782A257} = s 'ID3ComTag Class' + { + ProgID = s 'ID3COM.ID3ComTag.1' + VersionIndependentProgID = s 'ID3COM.ID3ComTag' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{AEBA98B0-C36C-11D3-841B-0008C782A257}' + } + } +} diff --git a/id3lib/id3com/Makefile.am b/id3lib/id3com/Makefile.am new file mode 100644 index 0000000..6fef3aa --- /dev/null +++ b/id3lib/id3com/Makefile.am @@ -0,0 +1,37 @@ +# Copyright 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +SUBDIRS = Sample + +EXTRA_DIST = EnumFields.cpp \ +EnumFields.h \ +ID3COM.def \ +ID3COM.rc \ +ID3COMps.def \ +ID3COMps.mk \ +ID3Field.cpp \ +ID3Field.h \ +ID3Field.rgs \ +ID3Frame.cpp \ +ID3Frame.h \ +ID3Frame.rgs \ +ID3Tag.cpp \ +ID3Tag.h \ +ID3Tag.rgs \ +StdAfx.cpp \ +StdAfx.h \ +dlldata.c \ +id3com.cpp \ +id3com.dsp \ +id3com.dsw \ +id3com.idl \ +resource.h \ +win32.readme.first.txt + diff --git a/id3lib/id3com/Makefile.in b/id3lib/id3com/Makefile.in new file mode 100644 index 0000000..45bc8d7 --- /dev/null +++ b/id3lib/id3com/Makefile.in @@ -0,0 +1,396 @@ +# Makefile.in generated by automake 1.6.2 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOX_DIR_HTML = @DOX_DIR_HTML@ +DOX_DIR_LATEX = @DOX_DIR_LATEX@ +DOX_DIR_MAN = @DOX_DIR_MAN@ +DOX_DIR_RTF = @DOX_DIR_RTF@ +ECHO = @ECHO@ +ID3LIB_BINARY_AGE = @ID3LIB_BINARY_AGE@ +ID3LIB_DEBUG_FLAGS = @ID3LIB_DEBUG_FLAGS@ +ID3LIB_FULLNAME = @ID3LIB_FULLNAME@ +ID3LIB_INTERFACE_AGE = @ID3LIB_INTERFACE_AGE@ +ID3LIB_MAJOR_VERSION = @ID3LIB_MAJOR_VERSION@ +ID3LIB_MINOR_VERSION = @ID3LIB_MINOR_VERSION@ +ID3LIB_NAME = @ID3LIB_NAME@ +ID3LIB_PATCH_VERSION = @ID3LIB_PATCH_VERSION@ +ID3LIB_VERSION = @ID3LIB_VERSION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +cxxflags_set = @cxxflags_set@ +install_sh = @install_sh@ + +SUBDIRS = Sample + +EXTRA_DIST = EnumFields.cpp \ +EnumFields.h \ +ID3COM.def \ +ID3COM.rc \ +ID3COMps.def \ +ID3COMps.mk \ +ID3Field.cpp \ +ID3Field.h \ +ID3Field.rgs \ +ID3Frame.cpp \ +ID3Frame.h \ +ID3Frame.rgs \ +ID3Tag.cpp \ +ID3Tag.h \ +ID3Tag.rgs \ +StdAfx.cpp \ +StdAfx.h \ +dlldata.c \ +id3com.cpp \ +id3com.dsp \ +id3com.dsw \ +id3com.idl \ +resource.h \ +win32.readme.first.txt + +subdir = id3com +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ + uninstall-info-recursive all-recursive install-data-recursive \ + install-exec-recursive installdirs-recursive install-recursive \ + uninstall-recursive check-recursive installcheck-recursive +DIST_COMMON = Makefile.am Makefile.in +DIST_SUBDIRS = $(SUBDIRS) +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu id3com/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive distclean \ + distclean-generic distclean-libtool distclean-recursive \ + distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-info install-info-am \ + install-info-recursive install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + tags tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/id3lib/id3com/Sample/ID3Test.vbp b/id3lib/id3com/Sample/ID3Test.vbp new file mode 100644 index 0000000..4e187e4 --- /dev/null +++ b/id3lib/id3com/Sample/ID3Test.vbp @@ -0,0 +1,32 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{AEBA98B0-C36C-11D3-841B-0008C782A257}#1.0#0#..\Debug\id3com.dll#ID3COM 1.0 Type Library +Form=FRMID3~1.FRM +IconForm="frmID3Test" +Startup="frmID3Test" +ExeName32="ID3Test.exe" +Command32="" +Name="ID3Test" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Prebon Marshall Yemane" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 diff --git a/id3lib/id3com/Sample/ID3Test.vbw b/id3lib/id3com/Sample/ID3Test.vbw new file mode 100644 index 0000000..9c2e32e --- /dev/null +++ b/id3lib/id3com/Sample/ID3Test.vbw @@ -0,0 +1 @@ +frmID3Test = 114, -10, 648, 430, C, 22, 22, 566, 467, C diff --git a/id3lib/id3com/Sample/Makefile.am b/id3lib/id3com/Sample/Makefile.am new file mode 100644 index 0000000..acc7376 --- /dev/null +++ b/id3lib/id3com/Sample/Makefile.am @@ -0,0 +1,15 @@ +# Copyright 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + +EXTRA_DIST = ID3Test.vbp \ +ID3Test.vbw \ +frmID3Test.frm + diff --git a/id3lib/id3com/Sample/Makefile.in b/id3lib/id3com/Sample/Makefile.in new file mode 100644 index 0000000..4becd8c --- /dev/null +++ b/id3lib/id3com/Sample/Makefile.in @@ -0,0 +1,252 @@ +# Makefile.in generated by automake 1.6.2 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOX_DIR_HTML = @DOX_DIR_HTML@ +DOX_DIR_LATEX = @DOX_DIR_LATEX@ +DOX_DIR_MAN = @DOX_DIR_MAN@ +DOX_DIR_RTF = @DOX_DIR_RTF@ +ECHO = @ECHO@ +ID3LIB_BINARY_AGE = @ID3LIB_BINARY_AGE@ +ID3LIB_DEBUG_FLAGS = @ID3LIB_DEBUG_FLAGS@ +ID3LIB_FULLNAME = @ID3LIB_FULLNAME@ +ID3LIB_INTERFACE_AGE = @ID3LIB_INTERFACE_AGE@ +ID3LIB_MAJOR_VERSION = @ID3LIB_MAJOR_VERSION@ +ID3LIB_MINOR_VERSION = @ID3LIB_MINOR_VERSION@ +ID3LIB_NAME = @ID3LIB_NAME@ +ID3LIB_PATCH_VERSION = @ID3LIB_PATCH_VERSION@ +ID3LIB_VERSION = @ID3LIB_VERSION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +cxxflags_set = @cxxflags_set@ +install_sh = @install_sh@ + +EXTRA_DIST = ID3Test.vbp \ +ID3Test.vbw \ +frmID3Test.frm + +subdir = id3com/Sample +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu id3com/Sample/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/id3lib/id3com/Sample/frmID3Test.frm b/id3lib/id3com/Sample/frmID3Test.frm new file mode 100644 index 0000000..f2d8c2f --- /dev/null +++ b/id3lib/id3com/Sample/frmID3Test.frm @@ -0,0 +1,179 @@ +VERSION 5.00 +Begin VB.Form frmID3Test + Caption = "ID3 Test" + ClientHeight = 5595 + ClientLeft = 60 + ClientTop = 345 + ClientWidth = 7845 + LinkTopic = "Form1" + ScaleHeight = 5595 + ScaleWidth = 7845 + StartUpPosition = 3 'Windows Default + Begin VB.CommandButton cmdVersion + Caption = "Show ID3COM Version" + Height = 375 + Left = 5640 + TabIndex = 8 + Top = 2160 + Width = 2175 + End + Begin VB.CommandButton cmdRemoveV2 + Caption = "Remove ID3v2" + Height = 375 + Left = 5640 + TabIndex = 7 + Top = 1200 + Width = 2175 + End + Begin VB.CommandButton cmdAddTestTag + Caption = "Add Test Tag" + Height = 375 + Left = 5640 + TabIndex = 6 + Top = 1680 + Width = 2175 + End + Begin VB.CommandButton cmdCopyV1toV2 + Caption = "Copy ID3 v1 to v2" + Enabled = 0 'False + Height = 375 + Left = 5640 + TabIndex = 5 + Top = 240 + Width = 2175 + End + Begin VB.CommandButton cmdRemoveV1 + Caption = "Remove ID3v1" + Enabled = 0 'False + Height = 375 + Left = 5640 + TabIndex = 4 + Top = 720 + Width = 2175 + End + Begin VB.ListBox List1 + Height = 2595 + Left = 120 + TabIndex = 3 + Top = 2880 + Width = 5415 + End + Begin VB.FileListBox File1 + Height = 2625 + Left = 2400 + Pattern = "*.mp3;*.tag" + TabIndex = 2 + Top = 120 + Width = 3135 + End + Begin VB.DirListBox Dir1 + Height = 2115 + Left = 120 + TabIndex = 1 + Top = 600 + Width = 2055 + End + Begin VB.DriveListBox Drive1 + Height = 315 + Left = 120 + TabIndex = 0 + Top = 120 + Width = 2055 + End +End +Attribute VB_Name = "frmID3Test" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +Option Explicit +Private oTag As ID3ComTag + +Private Sub cmdAddTestTag_Click() + Dim oFrame As ID3ComFrame + If Not oTag Is Nothing Then + Set oFrame = oTag.FindFrameString(ID3_USERTEXT, ID3_FIELD_DESCRIPTION, "ID3ComTest") + oFrame.Field(ID3_FIELD_TEXT).Text(1) = "This is a test done at " & Time + oTag.SaveV2Tag + File1_Click + End If +End Sub + +Private Sub cmdCopyV1toV2_Click() + If Not oTag Is Nothing Then + If Not oTag.HasV2Tag Then + oTag.SaveV2Tag + File1_Click + Else + MsgBox "File already Has V2 Tag" + End If + End If +End Sub + +Private Sub cmdRemoveV1_Click() + If Not oTag Is Nothing Then + oTag.StripV1Tag + File1_Click + End If +End Sub + +Private Sub cmdRemoveV2_Click() + If Not oTag Is Nothing Then + oTag.StripV2Tag + File1_Click + End If +End Sub + +Private Sub cmdVersion_Click() + If Not oTag Is Nothing Then + MsgBox oTag.VersionString + End If +End Sub + +Private Sub Dir1_Change() + On Error Resume Next + File1.Path = Dir1.Path +End Sub + +Private Sub Drive1_Change() + On Error Resume Next + Dir1.Path = Drive1.Drive +End Sub + +Private Sub File1_Click() + Dim oFrame As ID3ComFrame + Dim oField As ID3ComField + Dim FrameLine As String + Dim n As Long + + List1.Clear + + Set oTag = New ID3ComTag + + oTag.Link File1.Path & "\" & File1.FileName + + cmdCopyV1toV2.Enabled = oTag.HasV1Tag And Not oTag.HasV2Tag + cmdRemoveV1.Enabled = oTag.HasV1Tag + cmdRemoveV2.Enabled = oTag.HasV2Tag + + For Each oFrame In oTag + FrameLine = oFrame.FrameName + Set oField = oFrame.Field(ID3_FIELD_DESCRIPTION) + If Not oField Is Nothing Then + FrameLine = FrameLine & " - " & oField.Text(1) + End If + Set oField = oFrame.Field(ID3_FIELD_EMAIL) + If Not oField Is Nothing Then + FrameLine = FrameLine & " - " & oField.Text(1) + End If + Set oField = oFrame.Field(ID3_FIELD_TEXT) + If Not oField Is Nothing Then + For n = 1 To oField.NumTextItems + FrameLine = FrameLine & " - " & oField.Text(n) + Next n + End If + ' could go on + List1.AddItem FrameLine + Next +End Sub + diff --git a/id3lib/id3com/StdAfx.cpp b/id3lib/id3com/StdAfx.cpp new file mode 100644 index 0000000..964f3cd --- /dev/null +++ b/id3lib/id3com/StdAfx.cpp @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ +// +///////////////////////////////////////////////////////////////////////////// +// stdafx.cpp : source file that includes just the standard includes +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 18 Aug 2000 Philip Oldaker Added Picture Functionality +// +///////////////////////////////////////////////////////////////////////////// + +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include diff --git a/id3lib/id3com/StdAfx.h b/id3lib/id3com/StdAfx.h new file mode 100644 index 0000000..a707ba2 --- /dev/null +++ b/id3lib/id3com/StdAfx.h @@ -0,0 +1,70 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This file is subject to the terms of the GNU General Public License as +// published by the Free Software Foundation. A copy of this license is +// included with this software distribution in the file COPYING. If you +// do not have a copy, you may obtain a copy by writing to the Free +// Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +// +// This software is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details +// +///////////////////////////////////////////////////////////////////////////// +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 26 Apr 2000 John Adcock Got working with id3lib 3.7.3 +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_STDAFX_H__AEBA98B3_C36C_11D3_841B_0008C782A257__INCLUDED_) +#define AFX_STDAFX_H__AEBA98B3_C36C_11D3_841B_0008C782A257__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define STRICT +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif + +#define _ATL_APARTMENT_THREADED + +#ifndef _ATL_STATIC_REGISTRY +#define _ATL_STATIC_REGISTRY +#endif + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include +#include +#include + +#include +#include +#include +#include + +#ifdef UNICODE +#define tstring std::wstring +#else +#define tstring std::string +#endif + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__AEBA98B3_C36C_11D3_841B_0008C782A257__INCLUDED) diff --git a/id3lib/id3com/id3com.cpp b/id3lib/id3com/id3com.cpp new file mode 100644 index 0000000..068c450 --- /dev/null +++ b/id3lib/id3com/id3com.cpp @@ -0,0 +1,109 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ +// +///////////////////////////////////////////////////////////////////////////// +// ID3COM.cpp : Implementation of DLL Exports. +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 26 Apr 2000 John Adcock Got working with id3lib 3.7.3 +// 18 Aug 2000 Philip Oldaker Added Picture Functionality +// +///////////////////////////////////////////////////////////////////////////// + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f ID3libCOMps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include +#include "ID3COM.h" + +#include "ID3COM_i.c" +#include "ID3Tag.h" +#include "ID3Frame.h" +#include "ID3Field.h" + + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_ID3ComTag, CID3Tag) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_ID3COM); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + + diff --git a/id3lib/id3com/id3com.dsp b/id3lib/id3com/id3com.dsp new file mode 100644 index 0000000..8c7fd5c --- /dev/null +++ b/id3lib/id3com/id3com.dsp @@ -0,0 +1,226 @@ +# Microsoft Developer Studio Project File - Name="id3com" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=id3com - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "id3com.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "id3com.mak" CFG="id3com - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "id3com - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "id3com - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "Desktop" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "id3com - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ID3LIB_LINKOPTION=1 /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\\" /I "..\include" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /D ID3LIB_LINKOPTION=1 /Yu"stdafx.h" /FD /GZ /c +# SUBTRACT CPP /Fr +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 ../libprj/id3libd.lib ../zlib/zlibd.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libcmtd" /pdbtype:sept +# ADD LINK32 ../libprj/id3libd.lib ../zlib/zlibd.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libcmtd" /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\Debug +TargetPath=.\Debug\id3com.dll +InputPath=.\Debug\id3com.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "id3com - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "id3com___Win32_Release" +# PROP BASE Intermediate_Dir "id3com___Win32_Release" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O1 /I ".\\" /I "..\\" /I "..\include" /I "..\include\id3" /I "..\zlib\include" /D "NDEBUG" /D "_MBCS" /D "_ATL_STATIC_REGISTRY" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /D ID3LIB_LINKOPTION=1 /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O1 /I "..\\" /I "..\include" /D "NDEBUG" /D "_MBCS" /D "_ATL_STATIC_REGISTRY" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /D ID3LIB_LINKOPTION=1 /Yu"stdafx.h" /FD /c +# SUBTRACT CPP /Fr +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 ../libprj/id3lib.lib ../zlib/zlib.lib /nologo /subsystem:windows /dll /machine:I386 /nodefaultlib:"libcmt" +# ADD LINK32 ../libprj/id3lib.lib ../zlib/zlib.lib /nologo /subsystem:windows /dll /machine:I386 /nodefaultlib:"libcmt" +# Begin Custom Build - Performing registration +OutDir=.\Release +TargetPath=.\Release\id3com.dll +InputPath=.\Release\id3com.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "id3com - Win32 Debug" +# Name "id3com - Win32 Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\EnumFields.cpp +# End Source File +# Begin Source File + +SOURCE=.\id3com.cpp +# End Source File +# Begin Source File + +SOURCE=.\id3com.def +# End Source File +# Begin Source File + +SOURCE=.\id3com.idl +# ADD MTL /tlb ".\id3com.tlb" /h "id3com.h" /iid "id3com_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\id3com.rc +# End Source File +# Begin Source File + +SOURCE=.\ID3Field.cpp +# End Source File +# Begin Source File + +SOURCE=.\ID3Frame.cpp +# End Source File +# Begin Source File + +SOURCE=.\ID3Tag.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\EnumFields.h +# End Source File +# Begin Source File + +SOURCE=.\ID3Field.h +# End Source File +# Begin Source File + +SOURCE=.\ID3Frame.h +# End Source File +# Begin Source File + +SOURCE=.\ID3Tag.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\ID3ComFieldLong.rgs +# End Source File +# Begin Source File + +SOURCE=.\ID3ComFieldPicture.rgs +# End Source File +# Begin Source File + +SOURCE=.\ID3ComFieldText.rgs +# End Source File +# Begin Source File + +SOURCE=.\ID3Field.rgs +# End Source File +# Begin Source File + +SOURCE=.\ID3Frame.rgs +# End Source File +# Begin Source File + +SOURCE=.\ID3Tag.rgs +# End Source File +# Begin Source File + +SOURCE=.\TextCollection.rgs +# End Source File +# End Group +# Begin Source File + +SOURCE=..\ChangeLog +# End Source File +# Begin Source File + +SOURCE=..\News +# End Source File +# Begin Source File + +SOURCE=..\Todo +# End Source File +# End Target +# End Project diff --git a/id3lib/id3com/id3com.dsw b/id3lib/id3com/id3com.dsw new file mode 100644 index 0000000..95edff9 --- /dev/null +++ b/id3lib/id3com/id3com.dsw @@ -0,0 +1,59 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "id3com"=.\id3com.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name id3lib + End Project Dependency +}}} + +############################################################################### + +Project: "id3lib"=..\libprj\id3lib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name zlib + End Project Dependency +}}} + +############################################################################### + +Project: "zlib"=..\zlib\prj\zlib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/id3lib/id3com/id3com.idl b/id3lib/id3com/id3com.idl new file mode 100644 index 0000000..1315868 --- /dev/null +++ b/id3lib/id3com/id3com.idl @@ -0,0 +1,323 @@ +///////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2000 John Adcock. All rights reserved. +///////////////////////////////////////////////////////////////////////////// +// +// This file is subject to the terms of the GNU General Public License as +// published by the Free Software Foundation. A copy of this license is +// included with this software distribution in the file COPYING. If you +// do not have a copy, you may obtain a copy by writing to the Free +// Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +// +// This software is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details +// +///////////////////////////////////////////////////////////////////////////// +// ID3COM.idl : IDL source for ID3COM.dll +///////////////////////////////////////////////////////////////////////////// +// Change Log +// +// Date Developer Changes +// +// 05 Jan 2000 John Adcock Original Release +// 18 Aug 2000 Philip Oldaker Added Picture Functionality +// 01 Nov 2002 John Adcock Changed fields to reflect changes to id3lib +// +///////////////////////////////////////////////////////////////////////////// + +// This file will be processed by the MIDL tool to +// produce the type library (ID3COM.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; + + typedef + [ + uuid(181CFC77-C770-11d3-841C-0008C782A257), + helpstring("ID3 Field Types") + ] + enum + { + ID3_FIELD_NOFIELD = 0, /**< No field */ + ID3_FIELD_TEXTENC, /**< Text encoding (unicode or ASCII) */ + ID3_FIELD_TEXT, /**< Text field */ + ID3_FIELD_URL, /**< A URL */ + ID3_FIELD_DATA, /**< Data field */ + ID3_FIELD_DESCRIPTION, /**< Description field */ + ID3_FIELD_OWNER, /**< Owner field */ + ID3_FIELD_EMAIL, /**< Email field */ + ID3_FIELD_RATING, /**< Rating field */ + ID3_FIELD_FILENAME, /**< Filename field */ + ID3_FIELD_LANGUAGE, /**< Language field */ + ID3_FIELD_PICTURETYPE, /**< Picture type field */ + ID3_FIELD_IMAGEFORMAT, /**< Image format field */ + ID3_FIELD_MIMETYPE, /**< Mimetype field */ + ID3_FIELD_COUNTER, /**< Counter field */ + ID3_FIELD_ID, /**< Identifier/Symbol field */ + ID3_FIELD_VOLUMEADJ, /**< Volume adjustment field */ + ID3_FIELD_NUMBITS, /**< Number of bits field */ + ID3_FIELD_NUMBER, /**< General Number, can be anything, as long it's an integer <= 32 bits */ + ID3_FIELD_VOLCHGRIGHT, /**< Volume chage on the right channel */ + ID3_FIELD_VOLCHGLEFT, /**< Volume chage on the left channel */ + ID3_FIELD_PEAKVOLRIGHT, /**< Peak volume on the right channel */ + ID3_FIELD_PEAKVOLLEFT, /**< Peak volume on the left channel */ + ID3_FIELD_TIMESTAMPFORMAT, /**< SYLT Timestamp Format */ + ID3_FIELD_CONTENTTYPE, /**< SYLT content type */ + ID3_FIELD_REVERBL, /**< Reverb Left */ + ID3_FIELD_REVERBR, /**< Reverb Right */ + ID3_FIELD_REVERBBOUNCESL, /**< Reverb Bounces Left */ + ID3_FIELD_REVERBBOUNCESR, /**< Reverb Bounces Right */ + ID3_FIELD_REVERBFEEDBACKL2L, /**< Reverb Feedback Left to Left */ + ID3_FIELD_REVERBFEEDBACKL2R, /**< Reverb Feedback Left to Right */ + ID3_FIELD_REVERBFEEDBACKR2R, /**< Reverb Feedback Right to Right */ + ID3_FIELD_REVERBFEEDBACKR2L, /**< Reverb Feedback Right to Left */ + ID3_FIELD_PREMIXL2R, /**< Premix Left to Right */ + ID3_FIELD_PREMIXR2L, /**< Premix Right to Left */ + ID3_FIELD_LENGTH, /**< Size field, can be bits, bytes, time etc */ + ID3_FIELD_FLAGS, /**< Flags field */ + ID3_FIELD_OFFSET, /**< Offset, can be bits, bytes, time etc */ + ID3_FIELD_PRICE, /**< Price Field, containing currency+amount */ + ID3_FIELD_8DATE, /**< Date Field, containing date as YYYYMMDD */ + ID3_FIELD_SELLER, /**< Seller */ + ID3_FIELD_DELIVERY, /**< Way of delivery field */ + ID3_FIELD_BITSSIZE, /**< contains the number of bits for other fields' fixed size */ + ID3_FIELD_BYTESSIZE, /**< contains the number of bytes for other fields' fixed size */ + ID3_FIELD_LASTFIELDID /**< Last field placeholder */ + } eID3FieldTypes; + + + typedef + [ + uuid(385B5F8C-1F3C-11d3-83C6-0008C782A257), + helpstring("ID3 Frame Types") + ] + enum + { + /* ???? */ ID3_NOFRAME = 0, /**< No known frame */ + /* AENC */ ID3_AUDIOCRYPTO, /**< Audio encryption */ + /* APIC */ ID3_PICTURE, /**< Attached picture */ + /* ASPI */ ID3_AUDIOSEEKPOINT, /**< Audio seek point index */ + /* COMM */ ID3_COMMENT, /**< Comments */ + /* COMR */ ID3_COMMERCIAL, /**< Commercial frame */ + /* ENCR */ ID3_CRYPTOREG, /**< Encryption method registration */ + /* EQU2 */ ID3_EQUALIZATION2, /**< Equalisation (2) */ + /* EQUA */ ID3_EQUALIZATION, /**< Equalization */ + /* ETCO */ ID3_EVENTTIMING, /**< Event timing codes */ + /* GEOB */ ID3_GENERALOBJECT, /**< General encapsulated object */ + /* GRID */ ID3_GROUPINGREG, /**< Group identification registration */ + /* IPLS */ ID3_INVOLVEDPEOPLE, /**< Involved people list */ + /* LINK */ ID3_LINKEDINFO, /**< Linked information */ + /* MCDI */ ID3_CDID, /**< Music CD identifier */ + /* MLLT */ ID3_MPEGLOOKUP, /**< MPEG location lookup table */ + /* OWNE */ ID3_OWNERSHIP, /**< Ownership frame */ + /* PRIV */ ID3_PRIVATE, /**< Private frame */ + /* PCNT */ ID3_PLAYCOUNTER, /**< Play counter */ + /* POPM */ ID3_POPULARIMETER, /**< Popularimeter */ + /* POSS */ ID3_POSITIONSYNC, /**< Position synchronisation frame */ + /* RBUF */ ID3_BUFFERSIZE, /**< Recommended buffer size */ + /* RVA2 */ ID3_VOLUMEADJ2, /**< Relative volume adjustment (2) */ + /* RVAD */ ID3_VOLUMEADJ, /**< Relative volume adjustment */ + /* RVRB */ ID3_REVERB, /**< Reverb */ + /* SEEK */ ID3_SEEKFRAME, /**< Seek frame */ + /* SIGN */ ID3_SIGNATURE, /**< Signature frame */ + /* SYLT */ ID3_SYNCEDLYRICS, /**< Synchronized lyric/text */ + /* SYTC */ ID3_SYNCEDTEMPO, /**< Synchronized tempo codes */ + /* TALB */ ID3_ALBUM, /**< Album/Movie/Show title */ + /* TBPM */ ID3_BPM, /**< BPM (beats per minute) */ + /* TCOM */ ID3_COMPOSER, /**< Composer */ + /* TCON */ ID3_CONTENTTYPE, /**< Content type */ + /* TCOP */ ID3_COPYRIGHT, /**< Copyright message */ + /* TDAT */ ID3_DATE, /**< Date */ + /* TDEN */ ID3_ENCODINGTIME, /**< Encoding time */ + /* TDLY */ ID3_PLAYLISTDELAY, /**< Playlist delay */ + /* TDOR */ ID3_ORIGRELEASETIME, /**< Original release time */ + /* TDRC */ ID3_RECORDINGTIME, /**< Recording time */ + /* TDRL */ ID3_RELEASETIME, /**< Release time */ + /* TDTG */ ID3_TAGGINGTIME, /**< Tagging time */ + /* TIPL */ ID3_INVOLVEDPEOPLE2, /**< Involved people list */ + /* TENC */ ID3_ENCODEDBY, /**< Encoded by */ + /* TEXT */ ID3_LYRICIST, /**< Lyricist/Text writer */ + /* TFLT */ ID3_FILETYPE, /**< File type */ + /* TIME */ ID3_TIME, /**< Time */ + /* TIT1 */ ID3_CONTENTGROUP, /**< Content group description */ + /* TIT2 */ ID3_TITLE, /**< Title/songname/content description */ + /* TIT3 */ ID3_SUBTITLE, /**< Subtitle/Description refinement */ + /* TKEY */ ID3_INITIALKEY, /**< Initial key */ + /* TLAN */ ID3_LANGUAGE, /**< Language(s) */ + /* TLEN */ ID3_SONGLEN, /**< Length */ + /* TMCL */ ID3_MUSICIANCREDITLIST,/**< Musician credits list */ + /* TMED */ ID3_MEDIATYPE, /**< Media type */ + /* TMOO */ ID3_MOOD, /**< Mood */ + /* TOAL */ ID3_ORIGALBUM, /**< Original album/movie/show title */ + /* TOFN */ ID3_ORIGFILENAME, /**< Original filename */ + /* TOLY */ ID3_ORIGLYRICIST, /**< Original lyricist(s)/text writer(s) */ + /* TOPE */ ID3_ORIGARTIST, /**< Original artist(s)/performer(s) */ + /* TORY */ ID3_ORIGYEAR, /**< Original release year */ + /* TOWN */ ID3_FILEOWNER, /**< File owner/licensee */ + /* TPE1 */ ID3_LEADARTIST, /**< Lead performer(s)/Soloist(s) */ + /* TPE2 */ ID3_BAND, /**< Band/orchestra/accompaniment */ + /* TPE3 */ ID3_CONDUCTOR, /**< Conductor/performer refinement */ + /* TPE4 */ ID3_MIXARTIST, /**< Interpreted, remixed, or otherwise modified by */ + /* TPOS */ ID3_PARTINSET, /**< Part of a set */ + /* TPRO */ ID3_PRODUCEDNOTICE, /**< Produced notice */ + /* TPUB */ ID3_PUBLISHER, /**< Publisher */ + /* TRCK */ ID3_TRACKNUM, /**< Track number/Position in set */ + /* TRDA */ ID3_RECORDINGDATES, /**< Recording dates */ + /* TRSN */ ID3_NETRADIOSTATION, /**< Internet radio station name */ + /* TRSO */ ID3_NETRADIOOWNER, /**< Internet radio station owner */ + /* TSIZ */ ID3_SIZE, /**< Size */ + /* TSOA */ ID3_ALBUMSORTORDER, /**< Album sort order */ + /* TSOP */ ID3_PERFORMERSORTORDER,/**< Performer sort order */ + /* TSOT */ ID3_TITLESORTORDER, /**< Title sort order */ + /* TSRC */ ID3_ISRC, /**< ISRC (international standard recording code) */ + /* TSSE */ ID3_ENCODERSETTINGS, /**< Software/Hardware and settings used for encoding */ + /* TSST */ ID3_SETSUBTITLE, /**< Set subtitle */ + /* TXXX */ ID3_USERTEXT, /**< User defined text information */ + /* TYER */ ID3_YEAR, /**< Year */ + /* UFID */ ID3_UNIQUEFILEID, /**< Unique file identifier */ + /* USER */ ID3_TERMSOFUSE, /**< Terms of use */ + /* USLT */ ID3_UNSYNCEDLYRICS, /**< Unsynchronized lyric/text transcription */ + /* WCOM */ ID3_WWWCOMMERCIALINFO, /**< Commercial information */ + /* WCOP */ ID3_WWWCOPYRIGHT, /**< Copyright/Legal infromation */ + /* WOAF */ ID3_WWWAUDIOFILE, /**< Official audio file webpage */ + /* WOAR */ ID3_WWWARTIST, /**< Official artist/performer webpage */ + /* WOAS */ ID3_WWWAUDIOSOURCE, /**< Official audio source webpage */ + /* WORS */ ID3_WWWRADIOPAGE, /**< Official internet radio station homepage */ + /* WPAY */ ID3_WWWPAYMENT, /**< Payment */ + /* WPUB */ ID3_WWWPUBLISHER, /**< Official publisher webpage */ + /* WXXX */ ID3_WWWUSER, /**< User defined URL link */ + /* */ ID3_METACRYPTO, /**< Encrypted meta frame (id3v2.2.x) */ + /* */ ID3_METACOMPRESSION, /**< Compressed meta frame (id3v2.2.1) */ + /* >>>> */ ID3_LASTFRAMEID /**< Last field placeholder */ + } eID3FrameTypes; + + [ + object, + uuid(A513A24E-C749-11D3-841C-0008C782A257), + dual, + helpstring("IID3ComField Interface"), + pointer_default(unique) + ] + interface IID3ComField : IDispatch + { + [propget, id(0), helpstring("property Text")] HRESULT Text([in] long ItemNum, [out, retval] BSTR *pVal); + [propput, id(0), helpstring("property Text")] HRESULT Text([in] long ItemNum, [in] BSTR newVal); + [propget, id(1), helpstring("property Long")] HRESULT Long([out, retval] long *pVal); + [propput, id(1), helpstring("property Long")] HRESULT Long([in] long newVal); + [id(4), helpstring("method Clear")] HRESULT Clear(); + [id(5), helpstring("method CopyDataToFile")] HRESULT CopyDataToFile(BSTR FileName); + [id(6), helpstring("method CopyDataFromFile")] HRESULT CopyDataFromFile(BSTR FileName); + [propget, id(7), helpstring("property NumTextItems")] HRESULT NumTextItems([out, retval] long *pVal); + [propget, id(8), helpstring("property Binary")] HRESULT Binary([out, retval] BSTR *pVal); + [propput, id(8), helpstring("property Binary")] HRESULT Binary([in] BSTR newVal); + }; + + [ + object, + uuid(AEBA98BE-C36C-11D3-841B-0008C782A257), + dual, + helpstring("IID3ComFrame Interface"), + pointer_default(unique) + ] + interface IID3ComFrame : IDispatch + { + [propget, id(1), helpstring("property Field")] HRESULT Field([in] eID3FieldTypes FieldType, [out, retval] IID3ComField** pVal); + [id(2), helpstring("method Clear")] HRESULT Clear(); + [propget, id(3), helpstring("property ID")] HRESULT ID([out, retval] eID3FrameTypes *pVal); + [propput, id(3), helpstring("property ID")] HRESULT ID([in] eID3FrameTypes newVal); + [propget, id(4), helpstring("property FrameName")] HRESULT FrameName([out, retval] BSTR *pVal); + [propget, id(5), helpstring("property Compressed")] HRESULT Compressed([out, retval] VARIANT_BOOL *pVal); + [propput, id(5), helpstring("property Compressed")] HRESULT Compressed([in] VARIANT_BOOL newVal); + }; + [ + object, + uuid(AEBA98BC-C36C-11D3-841B-0008C782A257), + dual, + helpstring("IID3ComTag Interface"), + pointer_default(unique) + ] + interface IID3ComTag : IDispatch + { + [id(1), helpstring("method Link")] HRESULT Link(BSTR* FileName); + [id(2), helpstring("method Clear")] HRESULT Clear(); + [propget, id(3), helpstring("property HasChanged")] HRESULT HasChanged([out, retval] VARIANT_BOOL *pVal); + [id(4), helpstring("method FindFrame")] HRESULT FindFrame([in] eID3FrameTypes FrameID, [in, defaultvalue(TRUE)] VARIANT_BOOL CreateNewIfNotFound, [out, retval] IID3ComFrame** pVal); + [propget, id(5), helpstring("property Count")] HRESULT Count([out, retval] long *pVal); + [propget, id(DISPID_VALUE), helpstring("property Item")] HRESULT Item([in] long FrameNum, [out, retval] IID3ComFrame** pVal); + [id(7), helpstring("method SaveV1Tag")] HRESULT SaveV1Tag(); + [id(8), helpstring("method StripV1Tag")] HRESULT StripV1Tag(); + [id(9), helpstring("method SaveV2Tag")] HRESULT SaveV2Tag(); + [id(10), helpstring("method StripV2Tag")] HRESULT StripV2Tag(); + [propget, id(11), helpstring("property Artist")] HRESULT Artist([out, retval] BSTR *pVal); + [propput, id(11), helpstring("property Artist")] HRESULT Artist([in] BSTR newVal); + [propget, id(12), helpstring("property Album")] HRESULT Album([out, retval] BSTR *pVal); + [propput, id(12), helpstring("property Album")] HRESULT Album([in] BSTR newVal); + [propget, id(13), helpstring("property Title")] HRESULT Title([out, retval] BSTR *pVal); + [propput, id(13), helpstring("property Title")] HRESULT Title([in] BSTR newVal); + [propget, id(14), helpstring("property Comment")] HRESULT Comment([out, retval] BSTR *pVal); + [propput, id(14), helpstring("property Comment")] HRESULT Comment([in] BSTR newVal); + [propget, id(15), helpstring("property Genre")] HRESULT Genre([out, retval] long *pVal); + [propput, id(15), helpstring("property Genre")] HRESULT Genre([in] long newVal); + [propget, id(16), helpstring("property Year")] HRESULT Year([out, retval] BSTR *pVal); + [propput, id(16), helpstring("property Year")] HRESULT Year([in] BSTR newVal); + [propget, id(17), helpstring("property Track")] HRESULT Track([out, retval] long *pVal); + [propput, id(17), helpstring("property Track")] HRESULT Track([in] long newVal); + [propget, id(18), helpstring("property LastPlayed")] HRESULT LastPlayed([out, retval] DATE *pVal); + [propput, id(18), helpstring("property LastPlayed")] HRESULT LastPlayed([in] DATE newVal); + [propget, id(19), helpstring("property HasV1Tag")] HRESULT HasV1Tag([out, retval] VARIANT_BOOL *pVal); + [propget, id(20), helpstring("property HasV2Tag")] HRESULT HasV2Tag([out, retval] VARIANT_BOOL *pVal); + [propget, id(21), helpstring("property HasLyrics")] HRESULT HasLyrics([out, retval] VARIANT_BOOL *pVal); + [id(22), helpstring("method FindFrameString")] HRESULT FindFrameString([in] eID3FrameTypes FrameID, [in] eID3FieldTypes FieldType, [in] BSTR FindString, [in, defaultvalue(TRUE)] VARIANT_BOOL CreateNewIfNotFound, [out, retval] IID3ComFrame** pVal); + [propget, id(23), helpstring("property PlayCount")] HRESULT PlayCount([in] BSTR EMailAddress, [out, retval] long *pVal); + [propput, id(23), helpstring("property PlayCount")] HRESULT PlayCount([in] BSTR EMailAddress, [in] long newVal); + [propget, id(24), helpstring("property Popularity")] HRESULT Popularity([in] BSTR EMailAddress, [out, retval] short *pVal); + [propput, id(24), helpstring("property Popularity")] HRESULT Popularity([in] BSTR EMailAddress, [in] short newVal); + [propget, id(25), helpstring("property TagCreated")] HRESULT TagCreated([out, retval] DATE *pVal); + [propput, id(25), helpstring("property TagCreated")] HRESULT TagCreated([in] DATE newVal); + [propget, id(26), helpstring("property PercentVolumeAdjust")] HRESULT PercentVolumeAdjust([out, retval] double *pVal); + [propput, id(26), helpstring("property PercentVolumeAdjust")] HRESULT PercentVolumeAdjust([in] double newVal); + [propput, id(27), helpstring("property Padding")] HRESULT Padding([in] VARIANT_BOOL newVal); + [propput, id(28), helpstring("property UnSync")] HRESULT UnSync([in] VARIANT_BOOL newVal); + [propget, id(29), helpstring("property VersionString")] HRESULT VersionString([out, retval] BSTR *pVal); + [id(35), helpstring("method RemoveFrame")] HRESULT RemoveFrame([in] eID3FrameTypes FrameID); + [id(37), helpstring("method RemoveFrameByNum")] HRESULT RemoveFrameByNum([in] long FrameNum); + [propget, id(DISPID_NEWENUM), restricted] HRESULT _NewEnum([out, retval] IUnknown** pRetVal); + }; +[ + uuid(AEBA98B0-C36C-11D3-841B-0008C782A257), + version(1.0), + helpstring("ID3COM 1.0 Type Library") +] +library ID3COM +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(AEBA98BD-C36C-11D3-841B-0008C782A257), + helpstring("ID3ComTag Class") + ] + coclass ID3ComTag + { + [default] interface IID3ComTag; + }; + [ + uuid(AEBA98BF-C36C-11D3-841B-0008C782A257), + helpstring("ID3ComFrame Class"), + noncreatable + ] + coclass ID3ComFrame + { + [default] interface IID3ComFrame; + }; + [ + uuid(A513A24F-C749-11D3-841C-0008C782A257), + helpstring("ID3ComField Class"), + noncreatable + ] + coclass ID3ComField + { + [default] interface IID3ComField; + }; +}; diff --git a/id3lib/id3com/resource.h b/id3lib/id3com/resource.h new file mode 100644 index 0000000..3555184 --- /dev/null +++ b/id3lib/id3com/resource.h @@ -0,0 +1,26 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by id3com.rc +// +#define IDS_PROJNAME 100 +#define IDR_ID3TAG 101 +#define IDR_ID3FRAME 102 +#define IDR_ID3FIELD 104 +#define IDR_ID3COMFIELDTEXT 105 +#define IDR_ID3COMFIELDLONG 106 +#define IDR_ID3COMFIELDPICTURE 107 +#define IDR_TEXTCOLLECTION 108 +#define IDS_UNEXPECTED_ERROR 0x0200 +#define IDS_ERROR_BAD_FILENAME 513 +#define IDS_ERROR_BAD_URL 514 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 109 +#endif +#endif diff --git a/id3lib/id3com/win32.readme.first.txt b/id3lib/id3com/win32.readme.first.txt new file mode 100644 index 0000000..584c0b0 --- /dev/null +++ b/id3lib/id3com/win32.readme.first.txt @@ -0,0 +1,75 @@ +Compiling on win32: + +So far, it has only been confirmed it compiles on visual C 6.0 (service pack 5), +but if you got it working on Borland or other compilers, drop me a mail, or better, add a patch +here: http://sourceforge.net/tracker/?group_id=979&atid=300979 with the (e.g.) borland project files. + +These are the directories you'll be needing: +id3lib/prj +id3lib/libprj +id3lib/id3com + +The first one (id3lib/prj) creates the standard dll (no COM interface) +The Second one (id3lib/libprj) creates the .lib file for static linking. +And the third one (id3lib/id3com) creates a dll with com interface. A Visual basic demo using it is included. + +Before you compile, you'll need to rename id3lib/config.h.win32 to id3lib/config.h + +The third one is not too much tested, it was created outside this project but +it doesn't seem to be maintained anymore. I've included it as a service. +The original location is http://sourceforge.net/projects/id3com + +And, last but not least, there is a delphi project in cvs +(http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/id3lib/id3lib-stable/delphi/) +which uses the allready compiled dll. +Also in there is a file called Id3lib.pas which has the interface to the dll +defined. + +How to start: + +A) ***Your project wants to link id3lib static, and has mfc linked static: +1) Rename config.h.win32 to config.h +2) include libprj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace +3) make your project dependend on id3lib, and make id3lib dependend on zlib +4) Add /D ID3LIB_LINKOPTION=1 to your project options (settings, C/C++ tab) +5) Add the following include dirs to your program: + /I \\include /I \\include\\id3 +6) (add your code which uses id3lib) +7) Try to compile, and see if you need any of the following: + (debug) /nodefaultlib:"msvcprtd" or(release) /nodefaultlib:"msvcprt" + (debug) /nodefaultlib:"MSVCRTD" or(release) /nodefaultlib:"MSVCRT" + (debug) /nodefaultlib:"libcd" or(release) /nodefaultlib:"libc" + different programs may require different 'nodefaultlib' 's, or none at all, these worked for me. + If none you try work, revert to C) + +B)***Your project wants to link id3lib static, and has mfc linked dynamic or has no MFC: +1) Rename config.h.win32 to config.h +2) include libprj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace +3) make your project dependend on id3lib, and make id3lib dependend on zlib +4) Add /D ID3LIB_LINKOPTION=1 to your project options (settings, C/C++ tab) +5) Add the following include dirs to your program: + /I \\include /I \\include\\id3 +6) (add your code which uses id3lib) +7) Try to compile, and see if you need any of the following: + (debug) /nodefaultlib:"msvcprtd" or(release) /nodefaultlib:"msvcprt" + (debug) /nodefaultlib:"MSVCRTD" or(release) /nodefaultlib:"MSVCRT" + (debug) /nodefaultlib:"libcmtd" or(release) /nodefaultlib:"libcmt" + different programs may require different 'nodefaultlib' 's, or none at all, these worked for me. + If none you try work, revert to C) + +C)***Your project wants to link id3lib dynamic: (instructions below for vc) +1) Rename config.h.win32 to config.h +2) include prj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace (*note this is a different id3lib than above) +3) make your project dependend on id3lib, and make id3lib dependend on zlib +4) Add /D ID3LIB_LINKOPTION=3 to your project options (settings, C/C++ tab) (*note this is a different option than above) +5) Add the following include dirs to your program: + /I \\include /I \\include\\id3 +6) (add your code which uses id3lib) +7) Compile. +8) dump id3lib.dll in your programs project dir. +9) distribute your program including id3lib.dll +(MS recommend you distribute it in your programs dir and not in system(32) to avoid version conficts) + +Thijmen +thijmen@id3lib.org + diff --git a/id3lib/id3lib.spec b/id3lib/id3lib.spec new file mode 100644 index 0000000..1ff5636 --- /dev/null +++ b/id3lib/id3lib.spec @@ -0,0 +1,192 @@ +# $Id: id3lib.spec,v 1.1 2007/11/12 21:32:37 pindakaasmod Exp $ + +%define name id3lib +%define version 3.8.3 +%define release 1 +%define prefix /usr + +Name: %{name} +Version: %{version} +Release: %{release} +Summary: A software library for manipulating ID3v1 and ID3v2 tags. +Source: http://download.sourceforge.net/id3lib/%{name}-%{version}.tar.gz +URL: http://id3lib.sourceforge.net +Group: System Environment/Libraries +BuildRoot: %{_tmppath}/%{name}-buildroot +Copyright: LGPL +Prefix: %{_prefix} +Docdir: %{prefix}/doc +Requires: zlib + +%description +This package provides a software library for manipulating ID3v1 and ID3v2 tags. +It provides a convenient interface for software developers to include +standards-compliant ID3v1/2 tagging capabilities in their applications. +Features include identification of valid tags, automatic size conversions, +(re)synchronisation of tag frames, seamless tag (de)compression, and optional +padding facilities. Additionally, it can tell mp3 header info, like bitrate etc. + +%package devel +Summary: Headers for developing programs that will use id3lib +Group: Development/Libraries +Requires: %{name} + +%description devel +This package contains the headers that programmers will need to develop +applications which will use id3lib, the software library for ID3v1 and ID3v2 +tag manipulation. + +%package doc +Summary: Documentation for developing programs that will use id3lib +Group: Documentation + +%description doc +This package contains the documentation of the id3lib API that programmers will +need to develop applications which will use id3lib, the software library for ID3v1 +and ID3v2 tag manipulation. + +%package examples +Summary: Example applications that make use of the id3lib library +Group: Applications/File +Requires: %{name} + +%description examples +This package contains simple example applications that make use of id3lib, a +software library for ID3v1 and ID3v2 tag manipulation. + +%prep +%setup -q + +%build + +CXXFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --enable-debug=no + +%ifnarch noarch + +uname -a|grep SMP && make -j 2 || make + +%endif + +%install +rm -rf $RPM_BUILD_ROOT + +%ifnarch noarch + +make prefix=$RPM_BUILD_ROOT%{prefix} install + +%else + +make docs + +# strip down the doc and examples directories so we can copy w/impunity +for i in doc/ examples/; do \ + find $i \ + \( -name 'Makefile*' -or \ + -name '*.ps.gz' -or \ + -name '*.pdf' \ + \) -exec rm {} \; ; done + +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%ifnarch noarch + +%files +%defattr(-, root, root) +%doc AUTHORS COPYING ChangeLog HISTORY NEWS README THANKS TODO +%{prefix}/lib/*.so.* + +%files devel +%defattr(-, root, root) +%doc AUTHORS COPYING ChangeLog HISTORY NEWS README THANKS TODO +%{prefix}/include/id3*.h +%{prefix}/include/id3 +%{prefix}/lib/*.la +%{prefix}/lib/*.a +%{prefix}/lib/*.so + +%files examples +%defattr(-, root, root) +%doc AUTHORS COPYING ChangeLog HISTORY NEWS README THANKS TODO +%{prefix}/bin/id3* + +%else + +%files doc +%defattr(-, root, root) +%doc AUTHORS COPYING ChangeLog HISTORY NEWS README THANKS TODO +%doc doc/*.* doc/api examples + +%endif + +%changelog +* Sat Sep 08 2001 Cedric Tefft 3.8.0pre2 +- Version 3.8.0pre2 + +* Mon Nov 20 2000 Scott Thomas Haug 3.8.0pre1-1 +- Version 3.8.0pre1 + +* Thu Sep 14 2000 Scott Thomas Haug 3.7.13-1 +- Version 3.7.13 + +* Sat Aug 26 2000 Scott Thomas Haug 3.7.12-2 +- Removed -mpreferred-stack-boundary option from RPM_OPT_FLAGS for RedHat 6.2 + +* Fri Jul 07 2000 Scott Thomas Haug 3.7.12-1 +- Version 3.7.12 + +* Fri Jul 05 2000 Scott Thomas Haug 3.7.11-1 +- Version 3.7.11 + +* Fri Jun 23 2000 Scott Thomas Haug 3.7.10-1 +- Version 3.7.10 + +* Wed May 24 2000 Scott Thomas Haug 3.7.9-1 +- Version 3.7.9 + +* Wed May 10 2000 Scott Thomas Haug 3.7.8-1 +- Version 3.7.8 + +* Wed May 10 2000 Scott Thomas Haug 3.7.7-1 +- Version 3.7.7 + +* Wed May 03 2000 Scott Thomas Haug 3.7.6-1 +- Version 3.7.6 + +* Fri Apr 28 2000 Scott Thomas Haug 3.7.5-1 +- Version 3.7.5 + +* Wed Apr 26 2000 Scott Thomas Haug 3.7.4-1 +- Version 3.7.4 + +* Mon Apr 24 2000 Scott Thomas Haug 3.7.3-1 +- Version 3.7.3 +- Added explicit RPM_OPT_FLAGS def based on arch, since -fno-exceptions and + -fno-rtti are part of the default flags in rpmrc and we need both exceptions + and rtti (exceptions uses rtti) + +* Fri Apr 21 2000 Scott Thomas Haug 3.7.2-1 +- Version 3.7.2 +- More conditional blocks for noarch +- More thorough cleaning of files for documentation +- Updated html directory + +* Thu Apr 20 2000 Scott Thomas Haug 3.7.1-2 +- Fixed date of changelog entry for 3.7.1-1 +- Added conditional blocks so docs only get built for noarch target + +* Wed Apr 19 2000 Scott Thomas Haug 3.7.1-1 +- Version 3.7.1 +- Removed zlib-devel requirement from devel +- Added doc package to distribute documentation +- Added examples package to distribute binary examples (id3tag, id3info, ...) +- Moved doc/ and examples/ source files from devel to doc package + +* Mon Apr 17 2000 Scott Thomas Haug 3.7.0-1 +- First (s)rpm build diff --git a/id3lib/id3lib.spec.in b/id3lib/id3lib.spec.in new file mode 100644 index 0000000..6f571c8 --- /dev/null +++ b/id3lib/id3lib.spec.in @@ -0,0 +1,192 @@ +# $Id: id3lib.spec.in,v 1.1 2007/11/12 21:32:38 pindakaasmod Exp $ + +%define name @PACKAGE@ +%define version @VERSION@ +%define release 1 +%define prefix /usr + +Name: %{name} +Version: %{version} +Release: %{release} +Summary: A software library for manipulating ID3v1 and ID3v2 tags. +Source: http://download.sourceforge.net/id3lib/%{name}-%{version}.tar.gz +URL: http://id3lib.sourceforge.net +Group: System Environment/Libraries +BuildRoot: %{_tmppath}/%{name}-buildroot +Copyright: LGPL +Prefix: %{_prefix} +Docdir: %{prefix}/doc +Requires: zlib + +%description +This package provides a software library for manipulating ID3v1 and ID3v2 tags. +It provides a convenient interface for software developers to include +standards-compliant ID3v1/2 tagging capabilities in their applications. +Features include identification of valid tags, automatic size conversions, +(re)synchronisation of tag frames, seamless tag (de)compression, and optional +padding facilities. Additionally, it can tell mp3 header info, like bitrate etc. + +%package devel +Summary: Headers for developing programs that will use id3lib +Group: Development/Libraries +Requires: %{name} + +%description devel +This package contains the headers that programmers will need to develop +applications which will use id3lib, the software library for ID3v1 and ID3v2 +tag manipulation. + +%package doc +Summary: Documentation for developing programs that will use id3lib +Group: Documentation + +%description doc +This package contains the documentation of the id3lib API that programmers will +need to develop applications which will use id3lib, the software library for ID3v1 +and ID3v2 tag manipulation. + +%package examples +Summary: Example applications that make use of the id3lib library +Group: Applications/File +Requires: %{name} + +%description examples +This package contains simple example applications that make use of id3lib, a +software library for ID3v1 and ID3v2 tag manipulation. + +%prep +%setup -q + +%build + +CXXFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --enable-debug=no + +%ifnarch noarch + +uname -a|grep SMP && make -j 2 || make + +%endif + +%install +rm -rf $RPM_BUILD_ROOT + +%ifnarch noarch + +make prefix=$RPM_BUILD_ROOT%{prefix} install + +%else + +make docs + +# strip down the doc and examples directories so we can copy w/impunity +for i in doc/ examples/; do \ + find $i \ + \( -name 'Makefile*' -or \ + -name '*.ps.gz' -or \ + -name '*.pdf' \ + \) -exec rm {} \; ; done + +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%ifnarch noarch + +%files +%defattr(-, root, root) +%doc AUTHORS COPYING ChangeLog HISTORY NEWS README THANKS TODO +%{prefix}/lib/*.so.* + +%files devel +%defattr(-, root, root) +%doc AUTHORS COPYING ChangeLog HISTORY NEWS README THANKS TODO +%{prefix}/include/id3*.h +%{prefix}/include/id3 +%{prefix}/lib/*.la +%{prefix}/lib/*.a +%{prefix}/lib/*.so + +%files examples +%defattr(-, root, root) +%doc AUTHORS COPYING ChangeLog HISTORY NEWS README THANKS TODO +%{prefix}/bin/id3* + +%else + +%files doc +%defattr(-, root, root) +%doc AUTHORS COPYING ChangeLog HISTORY NEWS README THANKS TODO +%doc doc/*.* doc/@DOX_DIR_HTML@ examples + +%endif + +%changelog +* Sat Sep 08 2001 Cedric Tefft 3.8.0pre2 +- Version 3.8.0pre2 + +* Mon Nov 20 2000 Scott Thomas Haug 3.8.0pre1-1 +- Version 3.8.0pre1 + +* Thu Sep 14 2000 Scott Thomas Haug 3.7.13-1 +- Version 3.7.13 + +* Sat Aug 26 2000 Scott Thomas Haug 3.7.12-2 +- Removed -mpreferred-stack-boundary option from RPM_OPT_FLAGS for RedHat 6.2 + +* Fri Jul 07 2000 Scott Thomas Haug 3.7.12-1 +- Version 3.7.12 + +* Fri Jul 05 2000 Scott Thomas Haug 3.7.11-1 +- Version 3.7.11 + +* Fri Jun 23 2000 Scott Thomas Haug 3.7.10-1 +- Version 3.7.10 + +* Wed May 24 2000 Scott Thomas Haug 3.7.9-1 +- Version 3.7.9 + +* Wed May 10 2000 Scott Thomas Haug 3.7.8-1 +- Version 3.7.8 + +* Wed May 10 2000 Scott Thomas Haug 3.7.7-1 +- Version 3.7.7 + +* Wed May 03 2000 Scott Thomas Haug 3.7.6-1 +- Version 3.7.6 + +* Fri Apr 28 2000 Scott Thomas Haug 3.7.5-1 +- Version 3.7.5 + +* Wed Apr 26 2000 Scott Thomas Haug 3.7.4-1 +- Version 3.7.4 + +* Mon Apr 24 2000 Scott Thomas Haug 3.7.3-1 +- Version 3.7.3 +- Added explicit RPM_OPT_FLAGS def based on arch, since -fno-exceptions and + -fno-rtti are part of the default flags in rpmrc and we need both exceptions + and rtti (exceptions uses rtti) + +* Fri Apr 21 2000 Scott Thomas Haug 3.7.2-1 +- Version 3.7.2 +- More conditional blocks for noarch +- More thorough cleaning of files for documentation +- Updated html directory + +* Thu Apr 20 2000 Scott Thomas Haug 3.7.1-2 +- Fixed date of changelog entry for 3.7.1-1 +- Added conditional blocks so docs only get built for noarch target + +* Wed Apr 19 2000 Scott Thomas Haug 3.7.1-1 +- Version 3.7.1 +- Removed zlib-devel requirement from devel +- Added doc package to distribute documentation +- Added examples package to distribute binary examples (id3tag, id3info, ...) +- Moved doc/ and examples/ source files from devel to doc package + +* Mon Apr 17 2000 Scott Thomas Haug 3.7.0-1 +- First (s)rpm build diff --git a/id3lib/id3lib100.vcxproj b/id3lib/id3lib100.vcxproj new file mode 100644 index 0000000..7ea3205 --- /dev/null +++ b/id3lib/id3lib100.vcxproj @@ -0,0 +1,462 @@ + + + + + debug100 + Win32 + + + Debug + Win32 + + + Release + Win32 + + + + {119FB498-E3AC-49A5-A310-20E8B466B413} + id3lib + Desktop + id3lib100 + + + + StaticLibrary + false + Unicode + v140_xp + + + StaticLibrary + false + Unicode + true + v140_xp + + + StaticLibrary + false + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)\build\$(Configuration)\ + $(SolutionDir)\build\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\build\$(Configuration)\ + $(SolutionDir)\build\$(Configuration)\$(ProjectName)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + false + .;.\include;.\include\id3;..\zlib;..\cryptopp;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_LIB;_WINDOWS;HAVE_CONFIG_H;ID3LIB_LINKOPTION=1;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebug + true + Level3 + true + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0809 + + + true + + + true + .\Debug/id3lib.bsc + + + + + MaxSpeed + AnySuitable + true + false + false + .;.\include;.\include\id3;..\zlib;..\cryptopp;%(AdditionalIncludeDirectories) + _ALLOW_KEYWORD_MACROS;NDEBUG;WIN32;_LIB;_WINDOWS;HAVE_CONFIG_H;ID3LIB_LINKOPTION=1;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Async + MultiThreaded + true + true + NotSet + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0809 + + + true + + + true + .\Release/id3lib.bsc + + + + + Disabled + false + .;.\include;.\include\id3;..\zlib;..\cryptopp;%(AdditionalIncludeDirectories) + _DEBUG;_ALLOW_KEYWORD_MACROS;WIN32;_LIB;_WINDOWS;HAVE_CONFIG_H;ID3LIB_LINKOPTION=1;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + Async + EnableFastChecks + MultiThreadedDebug + true + Level3 + true + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0809 + + + true + + + true + .\Debug/id3lib.bsc + true + + + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/id3lib/id3lib100.vcxproj.filters b/id3lib/id3lib100.vcxproj.filters new file mode 100644 index 0000000..00a71a7 --- /dev/null +++ b/id3lib/id3lib100.vcxproj.filters @@ -0,0 +1,206 @@ + + + + + {7930cbff-3d8f-4acb-953b-3a7cfc23d742} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {50b7093c-be72-4f39-b86b-04c81a07618f} + h;hpp;hxx;hm;inl + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + Include Files + + + \ No newline at end of file diff --git a/id3lib/id3lib80.vcproj b/id3lib/id3lib80.vcproj new file mode 100644 index 0000000..1837a1b --- /dev/null +++ b/id3lib/id3lib80.vcproj @@ -0,0 +1,1400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/id3lib/id3lib90.vcproj b/id3lib/id3lib90.vcproj new file mode 100644 index 0000000..ad7655f --- /dev/null +++ b/id3lib/id3lib90.vcproj @@ -0,0 +1,1401 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/id3lib/include/Makefile.am b/id3lib/include/Makefile.am new file mode 100644 index 0000000..25f19ec --- /dev/null +++ b/id3lib/include/Makefile.am @@ -0,0 +1,16 @@ +# Copyright (C) 1999 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +SUBDIRS = id3 + +id3includedir = $(includedir) +id3include_HEADERS = id3.h + diff --git a/id3lib/include/Makefile.in b/id3lib/include/Makefile.in new file mode 100644 index 0000000..2f320a0 --- /dev/null +++ b/id3lib/include/Makefile.in @@ -0,0 +1,396 @@ +# Makefile.in generated by automake 1.6.2 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 1999 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOX_DIR_HTML = @DOX_DIR_HTML@ +DOX_DIR_LATEX = @DOX_DIR_LATEX@ +DOX_DIR_MAN = @DOX_DIR_MAN@ +DOX_DIR_RTF = @DOX_DIR_RTF@ +ECHO = @ECHO@ +ID3LIB_BINARY_AGE = @ID3LIB_BINARY_AGE@ +ID3LIB_DEBUG_FLAGS = @ID3LIB_DEBUG_FLAGS@ +ID3LIB_FULLNAME = @ID3LIB_FULLNAME@ +ID3LIB_INTERFACE_AGE = @ID3LIB_INTERFACE_AGE@ +ID3LIB_MAJOR_VERSION = @ID3LIB_MAJOR_VERSION@ +ID3LIB_MINOR_VERSION = @ID3LIB_MINOR_VERSION@ +ID3LIB_NAME = @ID3LIB_NAME@ +ID3LIB_PATCH_VERSION = @ID3LIB_PATCH_VERSION@ +ID3LIB_VERSION = @ID3LIB_VERSION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +cxxflags_set = @cxxflags_set@ +install_sh = @install_sh@ + +SUBDIRS = id3 + +id3includedir = $(includedir) +id3include_HEADERS = id3.h +subdir = include +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +HEADERS = $(id3include_HEADERS) + + +RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ + uninstall-info-recursive all-recursive install-data-recursive \ + install-exec-recursive installdirs-recursive install-recursive \ + uninstall-recursive check-recursive installcheck-recursive +DIST_COMMON = $(id3include_HEADERS) Makefile.am Makefile.in +DIST_SUBDIRS = $(SUBDIRS) +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu include/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +id3includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-id3includeHEADERS: $(id3include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(id3includedir) + @list='$(id3include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(id3includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(id3includedir)/$$f"; \ + $(id3includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(id3includedir)/$$f; \ + done + +uninstall-id3includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(id3include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(id3includedir)/$$f"; \ + rm -f $(DESTDIR)$(id3includedir)/$$f; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(id3includedir) + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: install-id3includeHEADERS + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-id3includeHEADERS uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive distclean \ + distclean-generic distclean-libtool distclean-recursive \ + distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-id3includeHEADERS install-info \ + install-info-am install-info-recursive install-man \ + install-recursive install-strip installcheck installcheck-am \ + installdirs installdirs-am installdirs-recursive \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive tags tags-recursive \ + uninstall uninstall-am uninstall-id3includeHEADERS \ + uninstall-info-am uninstall-info-recursive uninstall-recursive + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/id3lib/include/id3.h b/id3lib/include/id3.h new file mode 100644 index 0000000..54d639b --- /dev/null +++ b/id3lib/include/id3.h @@ -0,0 +1,125 @@ +/* $Id: id3.h,v 1.2 2007/06/02 20:17:21 pindakaasmod Exp $ + * + * id3lib: a software library for creating and manipulating id3v1/v2 tags + * Copyright 1999, 2000 Scott Thomas Haug + * Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + * License for more details. + + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + * The id3lib authors encourage improvements and optimisations to be sent to + * the id3lib coordinator. Please see the README file for details on where to + * send such submissions. See the AUTHORS file for a list of people who have + * contributed to id3lib. See the ChangeLog file for a list of changes to + * id3lib. These files are distributed with id3lib at + * http://download.sourceforge.net/id3lib/ + */ + +#ifndef _ID3LIB_ID3_H_ +#define _ID3LIB_ID3_H_ + +#include "id3/globals.h" //has "id3/sized_types.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + typedef struct { char _dummy; } ID3Tag; + typedef struct { char _dummy; } ID3TagIterator; + typedef struct { char _dummy; } ID3TagConstIterator; + typedef struct { char _dummy; } ID3Frame; + typedef struct { char _dummy; } ID3Field; + typedef struct { char _dummy; } ID3FrameInfo; + + /* tag wrappers */ + ID3_C_EXPORT ID3Tag* CCONV ID3Tag_New (void); + ID3_C_EXPORT void CCONV ID3Tag_Delete (ID3Tag *tag); + ID3_C_EXPORT void CCONV ID3Tag_Clear (ID3Tag *tag); + ID3_C_EXPORT bool CCONV ID3Tag_HasChanged (const ID3Tag *tag); + ID3_C_EXPORT void CCONV ID3Tag_SetUnsync (ID3Tag *tag, bool unsync); + ID3_C_EXPORT void CCONV ID3Tag_SetExtendedHeader (ID3Tag *tag, bool ext); + ID3_C_EXPORT void CCONV ID3Tag_SetPadding (ID3Tag *tag, bool pad); + ID3_C_EXPORT void CCONV ID3Tag_AddFrame (ID3Tag *tag, const ID3Frame *frame); + ID3_C_EXPORT bool CCONV ID3Tag_AttachFrame (ID3Tag *tag, ID3Frame *frame); + ID3_C_EXPORT void CCONV ID3Tag_AddFrames (ID3Tag *tag, const ID3Frame *frames, size_t num); + ID3_C_EXPORT ID3Frame* CCONV ID3Tag_RemoveFrame (ID3Tag *tag, const ID3Frame *frame); + ID3_C_EXPORT ID3_Err CCONV ID3Tag_Parse (ID3Tag *tag, const uchar header[ID3_TAGHEADERSIZE], const uchar *buffer); + ID3_C_EXPORT size_t CCONV ID3Tag_Link (ID3Tag *tag, const char *fileName); + ID3_C_EXPORT size_t CCONV ID3Tag_LinkWithFlags (ID3Tag *tag, const char *fileName, flags_t flags); + ID3_C_EXPORT ID3_Err CCONV ID3Tag_Update (ID3Tag *tag); + ID3_C_EXPORT ID3_Err CCONV ID3Tag_UpdateByTagType (ID3Tag *tag, flags_t type); + ID3_C_EXPORT ID3_Err CCONV ID3Tag_Strip (ID3Tag *tag, flags_t ulTagFlags); + ID3_C_EXPORT ID3Frame* CCONV ID3Tag_FindFrameWithID (const ID3Tag *tag, ID3_FrameID id); + ID3_C_EXPORT ID3Frame* CCONV ID3Tag_FindFrameWithINT (const ID3Tag *tag, ID3_FrameID id, ID3_FieldID fld, uint32 data); + ID3_C_EXPORT ID3Frame* CCONV ID3Tag_FindFrameWithASCII (const ID3Tag *tag, ID3_FrameID id, ID3_FieldID fld, const char *data); + ID3_C_EXPORT ID3Frame* CCONV ID3Tag_FindFrameWithUNICODE (const ID3Tag *tag, ID3_FrameID id, ID3_FieldID fld, const unicode_t *data); + ID3_C_EXPORT size_t CCONV ID3Tag_NumFrames (const ID3Tag *tag); + ID3_C_EXPORT bool CCONV ID3Tag_HasTagType (const ID3Tag *tag, ID3_TagType); + ID3_C_EXPORT ID3TagIterator* CCONV ID3Tag_CreateIterator (ID3Tag *tag); + ID3_C_EXPORT ID3TagConstIterator* CCONV ID3Tag_CreateConstIterator (const ID3Tag *tag); + + ID3_C_EXPORT void CCONV ID3TagIterator_Delete (ID3TagIterator*); + ID3_C_EXPORT ID3Frame* CCONV ID3TagIterator_GetNext (ID3TagIterator*); + ID3_C_EXPORT void CCONV ID3TagConstIterator_Delete (ID3TagConstIterator*); + ID3_C_EXPORT const ID3Frame* CCONV ID3TagConstIterator_GetNext(ID3TagConstIterator*); + + /* frame wrappers */ + ID3_C_EXPORT ID3Frame* CCONV ID3Frame_New (void); + ID3_C_EXPORT ID3Frame* CCONV ID3Frame_NewID (ID3_FrameID id); + ID3_C_EXPORT void CCONV ID3Frame_Delete (ID3Frame *frame); + ID3_C_EXPORT void CCONV ID3Frame_Clear (ID3Frame *frame); + ID3_C_EXPORT void CCONV ID3Frame_SetID (ID3Frame *frame, ID3_FrameID id); + ID3_C_EXPORT ID3_FrameID CCONV ID3Frame_GetID (const ID3Frame *frame); + ID3_C_EXPORT ID3Field* CCONV ID3Frame_GetField (const ID3Frame *frame, ID3_FieldID name); + ID3_C_EXPORT void CCONV ID3Frame_SetCompression (ID3Frame *frame, bool comp); + ID3_C_EXPORT bool CCONV ID3Frame_GetCompression (const ID3Frame *frame); + + /* field wrappers */ + ID3_C_EXPORT void CCONV ID3Field_Clear (ID3Field *field); + ID3_C_EXPORT size_t CCONV ID3Field_Size (const ID3Field *field); + ID3_C_EXPORT size_t CCONV ID3Field_GetNumTextItems (const ID3Field *field); + ID3_C_EXPORT void CCONV ID3Field_SetINT (ID3Field *field, uint32 data); + ID3_C_EXPORT uint32 CCONV ID3Field_GetINT (const ID3Field *field); + ID3_C_EXPORT void CCONV ID3Field_SetUNICODE (ID3Field *field, const unicode_t *string); + ID3_C_EXPORT size_t CCONV ID3Field_GetUNICODE (const ID3Field *field, unicode_t *buffer, size_t maxChars); + ID3_C_EXPORT size_t CCONV ID3Field_GetUNICODEItem (const ID3Field *field, unicode_t *buffer, size_t maxChars, size_t itemNum); + ID3_C_EXPORT void CCONV ID3Field_AddUNICODE (ID3Field *field, const unicode_t *string); + ID3_C_EXPORT void CCONV ID3Field_SetASCII (ID3Field *field, const char *string); + ID3_C_EXPORT size_t CCONV ID3Field_GetASCII (const ID3Field *field, char *buffer, size_t maxChars); + ID3_C_EXPORT size_t CCONV ID3Field_GetASCIIItem (const ID3Field *field, char *buffer, size_t maxChars, size_t itemNum); + ID3_C_EXPORT void CCONV ID3Field_AddASCII (ID3Field *field, const char *string); + ID3_C_EXPORT void CCONV ID3Field_SetBINARY (ID3Field *field, const uchar *data, size_t size); + ID3_C_EXPORT void CCONV ID3Field_GetBINARY (const ID3Field *field, uchar *buffer, size_t buffLength); + ID3_C_EXPORT void CCONV ID3Field_FromFile (ID3Field *field, const char *fileName); + ID3_C_EXPORT void CCONV ID3Field_ToFile (const ID3Field *field, const char *fileName); + + /* field-info wrappers */ + ID3_C_EXPORT char* CCONV ID3FrameInfo_ShortName (ID3_FrameID frameid); + ID3_C_EXPORT char* CCONV ID3FrameInfo_LongName (ID3_FrameID frameid); + ID3_C_EXPORT const char* CCONV ID3FrameInfo_Description (ID3_FrameID frameid); + ID3_C_EXPORT int CCONV ID3FrameInfo_MaxFrameID (void); + ID3_C_EXPORT int CCONV ID3FrameInfo_NumFields (ID3_FrameID frameid); + ID3_C_EXPORT ID3_FieldType CCONV ID3FrameInfo_FieldType (ID3_FrameID frameid, int fieldnum); + ID3_C_EXPORT size_t CCONV ID3FrameInfo_FieldSize (ID3_FrameID frameid, int fieldnum); + ID3_C_EXPORT flags_t CCONV ID3FrameInfo_FieldFlags (ID3_FrameID frameid, int fieldnum); + + /* Deprecated */ + ID3_C_EXPORT void CCONV ID3Tag_SetCompression (ID3Tag *tag, bool comp); + +#ifdef __cplusplus +} +#endif /*__cplusplus*/ + +#endif /* _ID3LIB_ID3_H_ */ diff --git a/id3lib/include/id3/Makefile.am b/id3lib/include/id3/Makefile.am new file mode 100644 index 0000000..2ac7515 --- /dev/null +++ b/id3lib/include/id3/Makefile.am @@ -0,0 +1,36 @@ +# Copyright (C) 1999 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +the_headers = \ + field.h \ + id3lib_frame.h \ + globals.h \ + misc_support.h \ + reader.h \ + readers.h \ + sized_types.h \ + tag.h \ + writer.h \ + writers.h \ + utils.h \ + id3lib_streams.h \ + id3lib_strings.h + + +id3includedir = $(includedir)/id3 +id3include_HEADERS = $(the_headers) + +noinst_HEADERS = \ + helpers.h \ + io_decorators.h \ + io_helpers.h \ + io_strings.h \ + id3lib_bitset diff --git a/id3lib/include/id3/Makefile.in b/id3lib/include/id3/Makefile.in new file mode 100644 index 0000000..886efcd --- /dev/null +++ b/id3lib/include/id3/Makefile.in @@ -0,0 +1,333 @@ +# Makefile.in generated by automake 1.6.2 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 1999 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOX_DIR_HTML = @DOX_DIR_HTML@ +DOX_DIR_LATEX = @DOX_DIR_LATEX@ +DOX_DIR_MAN = @DOX_DIR_MAN@ +DOX_DIR_RTF = @DOX_DIR_RTF@ +ECHO = @ECHO@ +ID3LIB_BINARY_AGE = @ID3LIB_BINARY_AGE@ +ID3LIB_DEBUG_FLAGS = @ID3LIB_DEBUG_FLAGS@ +ID3LIB_FULLNAME = @ID3LIB_FULLNAME@ +ID3LIB_INTERFACE_AGE = @ID3LIB_INTERFACE_AGE@ +ID3LIB_MAJOR_VERSION = @ID3LIB_MAJOR_VERSION@ +ID3LIB_MINOR_VERSION = @ID3LIB_MINOR_VERSION@ +ID3LIB_NAME = @ID3LIB_NAME@ +ID3LIB_PATCH_VERSION = @ID3LIB_PATCH_VERSION@ +ID3LIB_VERSION = @ID3LIB_VERSION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +cxxflags_set = @cxxflags_set@ +install_sh = @install_sh@ + +the_headers = \ + field.h \ + id3lib_frame.h \ + globals.h \ + misc_support.h \ + reader.h \ + readers.h \ + sized_types.h \ + tag.h \ + writer.h \ + writers.h \ + utils.h \ + id3lib_streams.h \ + id3lib_strings.h + + +id3includedir = $(includedir)/id3 +id3include_HEADERS = $(the_headers) + +noinst_HEADERS = \ + helpers.h \ + io_decorators.h \ + io_helpers.h \ + io_strings.h \ + id3lib_bitset + +subdir = include/id3 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +HEADERS = $(id3include_HEADERS) $(noinst_HEADERS) + +DIST_COMMON = $(id3include_HEADERS) $(noinst_HEADERS) Makefile.am \ + Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu include/id3/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +id3includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-id3includeHEADERS: $(id3include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(id3includedir) + @list='$(id3include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(id3includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(id3includedir)/$$f"; \ + $(id3includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(id3includedir)/$$f; \ + done + +uninstall-id3includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(id3include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(id3includedir)/$$f"; \ + rm -f $(DESTDIR)$(id3includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(id3includedir) + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-id3includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-id3includeHEADERS uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-libtool distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-id3includeHEADERS install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool tags uninstall uninstall-am \ + uninstall-id3includeHEADERS uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/id3lib/include/id3/config.h b/id3lib/include/id3/config.h new file mode 100644 index 0000000..406d254 --- /dev/null +++ b/id3lib/include/id3/config.h @@ -0,0 +1,181 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* +** This file has been automatically generated by 'acconfig' from aclocal.m4 +** Copyright (C) 1988 Eleftherios Gkioulekas +** +** This file is free software; as a special exception the author gives +** unlimited permission to copy and/or distribute it, with or without +** modifications, as long as this notice is preserved. +** +** This program is distributed in the hope that it will be useful, but +** WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +** implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* This is the top section */ + +/* Define if you need to in order for stat and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* And now the rest of the boys */ +#define CXX_HAS_BUGGY_FOR_LOOPS 1 +/* #undef CXX_HAS_NO_BOOL */ +/* #undef ID3_ENABLE_DEBUG */ +/* #undef ID3_DISABLE_ASSERT */ +/* #undef ID3_DISABLE_CHECKS */ +/* #undef ID3_ICONV_FORMAT_UTF16BE */ +/* #undef ID3_ICONV_FORMAT_UTF16 */ +/* #undef ID3_ICONV_FORMAT_UTF8 */ +/* #undef ID3_ICONV_FORMAT_ASCII */ +/* #undef ID3LIB_ICONV_OLDSTYLE */ +/* #undef ID3LIB_ICONV_CAST_OK */ + +/* config.h defines these preprocesser symbols to be used by id3lib for + * determining internal versioning information. The intent is that these + * macros will be made available in the library via constants, functions, + * or static methods. + */ +/* #undef HAVE_ZLIB */ +/* #undef HAVE_GETOPT_LONG */ +#define _ID3LIB_NAME "id3lib" +#define _ID3LIB_VERSION "3.8.3" +#define _ID3LIB_VERSION0 "3.8.3\0" +#define _ID3LIB_FULLNAME "id3lib-3.8.3" +#define _ID3LIB_MAJOR_VERSION 3 +#define _ID3LIB_MINOR_VERSION 8 +#define _ID3LIB_PATCH_VERSION 3 +#define _ID3LIB_INTERFACE_AGE 0 +#define _ID3LIB_BINARY_AGE 0 +/* #undef ID3_COMPILED_WITH_DEBUGGING */ +/* */ + +/* Define if you have the getopt_long function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define if you have the mkstemp function. */ +/* #undef HAVE_MKSTEMP */ + +/* Define if you have the ftruncate function. */ +/* #undef HAVE_TRUNCATE */ + +/* Define if you have the header file. */ +#define HAVE_CCTYPE 1 + +/* Define if you have the header file. */ +#define HAVE_CLIMITS 1 + +/* Define if you have the header file. */ +#define HAVE_CSTDIO 1 + +/* Define if you have the header file. */ +#define HAVE_CSTDLIB 1 + +/* Define if you have the header file. */ +#define HAVE_CSTRING 1 + +/* Define if you have the header file. */ +#define HAVE_FSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_FSTREAM_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_ICONV_H */ + +/* Define if you have the header file. */ +#define HAVE_IOMANIP 1 + +/* Define if you have the header file. */ +#define HAVE_IOMANIP_H 1 + +/* Define if you have the header file. */ +#define HAVE_IOSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_IOSTREAM_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_LIBCW_SYS_H */ + +/* Define if you have the header file. */ +#define HAVE_BITSET 1 + +/* Define if you have the header file. */ +#define HAVE_STRING 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_PARAM_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_ZLIB_H */ + +/* Name of package */ +#define PACKAGE "id3lib" + +/* Version number of package */ +#define VERSION _ID3LIB_VERSION + +/* This is the bottom section */ + +// This file defines portability work-arounds for various proprietory +// C++ compilers + +// Workaround for compilers with buggy for-loop scoping +// That's quite a few compilers actually including recent versions of +// Dec Alpha cxx, HP-UX CC and SGI CC. +// The trivial "if" statement provides the correct scoping to the +// for loop + +#ifdef CXX_HAS_BUGGY_FOR_LOOPS +/* #undef for */ +#define for if(1) for +#endif + +// +// If the C++ compiler we use doesn't have bool, then +// the following is a near-perfect work-around. +// You must make sure your code does not depend on "int" and "bool" +// being two different types, in overloading for instance. +// + +#ifdef CXX_HAS_NO_BOOL +#define bool int +#define true 1 +#define false 0 +#endif + +#if defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) && defined (__cplusplus) + +#define DEBUG + +#include +#include + +#define ID3D_INIT_DOUT() Debug( libcw_do.on() ) +#define ID3D_INIT_WARNING() Debug( dc::warning.on() ) +#define ID3D_INIT_NOTICE() Debug( dc::notice.on() ) +#define ID3D_NOTICE(x) Dout( dc::notice, x ) +#define ID3D_WARNING(x) Dout( dc::warning, x ) + +#else + +# define ID3D_INIT_DOUT() +# define ID3D_INIT_WARNING() +# define ID3D_INIT_NOTICE() +# define ID3D_NOTICE(x) +# define ID3D_WARNING(x) + +#endif /* defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) */ + diff --git a/id3lib/include/id3/field.h b/id3lib/include/id3/field.h new file mode 100644 index 0000000..37cd5b1 --- /dev/null +++ b/id3lib/include/id3/field.h @@ -0,0 +1,113 @@ +// -*- C++ -*- +// $Id: field.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_FIELD_H_ +#define _ID3LIB_FIELD_H_ + +#include "id3/globals.h" //has "id3/sized_types.h" + +class ID3_Reader; +class ID3_Writer; + +class ID3_CPP_EXPORT ID3_Field +{ +public: + virtual void Clear() = 0; + + virtual size_t Size() const = 0; + virtual size_t BinSize() const = 0; + virtual size_t GetNumTextItems() const = 0; + + // integer field functions + virtual ID3_Field& operator= (uint32 val) = 0; + virtual void Set(uint32) = 0; + virtual uint32 Get() const = 0; + + // ASCII string field functions + virtual ID3_Field& operator= (const char* s) = 0; + virtual size_t Set(const char*) = 0; + virtual size_t Get(char*, size_t) const = 0; + virtual size_t Get(char*, size_t, size_t) const = 0; + virtual const char* GetRawText() const = 0; + virtual const char* GetRawTextItem(size_t) const = 0; + virtual size_t Add(const char*) = 0; + + // Unicode string field functions + virtual ID3_Field& operator= (const unicode_t* s) = 0; + virtual size_t Set(const unicode_t*) = 0; + virtual size_t Get(unicode_t *buffer, size_t) const = 0; + virtual size_t Get(unicode_t *buffer, size_t, size_t) const = 0; + virtual const unicode_t* GetRawUnicodeText() const = 0; + virtual const unicode_t* GetRawUnicodeTextItem(size_t) const = 0; + virtual size_t Add(const unicode_t*) = 0; + + // binary field functions + virtual size_t Set(const uchar*, size_t) = 0; + virtual size_t Get(uchar*, size_t) const = 0; + virtual const uchar* GetRawBinary() const = 0; + virtual void FromFile(const char*) = 0; + virtual void ToFile(const char *sInfo) const = 0; + + // miscelaneous functions + virtual ID3_Field& operator=( const ID3_Field & ) = 0; + virtual bool InScope(ID3_V2Spec spec) const = 0; + + virtual ID3_FieldID GetID() const = 0; + virtual ID3_FieldType GetType() const = 0; + virtual bool SetEncoding(ID3_TextEnc enc) = 0; + virtual ID3_TextEnc GetEncoding() const = 0; + virtual bool IsEncodable() const = 0; + + virtual void Render(ID3_Writer&) const = 0; + virtual bool Parse(ID3_Reader&) = 0; + virtual bool HasChanged() const = 0; + +protected: + virtual ~ID3_Field() { }; + + // To prevent public instantiation, the constructor is made protected + ID3_Field() { }; +}; + +class ID3_CPP_EXPORT ID3_FrameInfo +{ + +public: + ID3_FrameInfo() {}; + ~ID3_FrameInfo() {}; + char *ShortName(ID3_FrameID frameid); + char *LongName(ID3_FrameID frameid); + const char *Description(ID3_FrameID frameid); + int MaxFrameID(); + int NumFields(ID3_FrameID frameid); + ID3_FieldType FieldType(ID3_FrameID frameid, int fieldnum); + size_t FieldSize(ID3_FrameID frameid, int fieldnum); + flags_t FieldFlags(ID3_FrameID frameid, int fieldnum); +}; + +#endif /* _ID3LIB_FIELD_H_ */ + diff --git a/id3lib/include/id3/globals.h b/id3lib/include/id3/globals.h new file mode 100644 index 0000000..e3164d8 --- /dev/null +++ b/id3lib/include/id3/globals.h @@ -0,0 +1,747 @@ +// -*- C++ -*- +/* $Id: globals.h,v 1.3 2008/01/09 22:56:40 stulleamgym Exp $ + + * id3lib: a C++ library for creating and manipulating id3v1/v2 tags + * Copyright 1999, 2000 Scott Thomas Haug + * Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + * License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + * The id3lib authors encourage improvements and optimisations to be sent to + * the id3lib coordinator. Please see the README file for details on where to + * send such submissions. See the AUTHORS file for a list of people who have + * contributed to id3lib. See the ChangeLog file for a list of changes to + * id3lib. These files are distributed with id3lib at + * http://download.sourceforge.net/id3lib/ + */ + +/** This file defines common macros, types, constants, and enums used + ** throughout id3lib. + **/ + +#ifndef _ID3LIB_GLOBALS_H_ +#define _ID3LIB_GLOBALS_H_ + +#include +#include "id3/sized_types.h" + +/* id3lib version. + * we prefix variable declarations so they can + * properly get exported in windows dlls. + */ +#ifdef WIN32 +# define LINKOPTION_STATIC 1 //both for use and creation of static lib +# define LINKOPTION_CREATE_DYNAMIC 2 //should only be used by prj/id3lib.dsp +# define LINKOPTION_USE_DYNAMIC 3 //if your project links id3lib dynamic +# ifndef ID3LIB_LINKOPTION +# pragma message("*** NOTICE *** (not a real error)") +# pragma message("* You should include a define in your project which reflect how you link the library") +# pragma message("* If you use id3lib.lib or libprj/id3lib.dsp (you link static) you should add") +# pragma message("* ID3LIB_LINKOPTION=1 to your preprocessor definitions of your project.") +# pragma message("* If you use id3lib.dll (you link dynamic) you should add ID3LIB_LINKOPTION=3") +# pragma message("* to your preprocessor definitions of your project.") +# pragma message("***") +# error read message above or win32.readme.first.txt +# else +# if (ID3LIB_LINKOPTION == LINKOPTION_CREATE_DYNAMIC) + //used for creating a dynamic dll +# define ID3_C_EXPORT extern _declspec(dllexport) +# define ID3_CPP_EXPORT __declspec(dllexport) +# define CCONV __stdcall // Added for VB & Delphi Compatibility - By FrogPrince Advised By Lothar +# endif +# if (ID3LIB_LINKOPTION == LINKOPTION_STATIC) + //used for creating a static lib and using a static lib +# define ID3_C_EXPORT +# define ID3_CPP_EXPORT +# define CCONV +# endif +# if (ID3LIB_LINKOPTION == LINKOPTION_USE_DYNAMIC) + //used for those that do not link static and are using the dynamic dll by including a id3lib header +# define ID3_C_EXPORT extern _declspec(dllimport) +# define ID3_CPP_EXPORT __declspec(dllimport) //functions like these shouldn't be used by vb and delphi, +# define CCONV __stdcall // Added for VB & Delphi Compatibility - By FrogPrince Advised By Lothar +# endif +# endif +#else /* !WIN32 */ +# define ID3_C_EXPORT +# define ID3_CPP_EXPORT +# define CCONV +#endif /* !WIN32 */ + +#define ID3_C_VAR extern + +#ifndef __cplusplus + +typedef int bool; +# define false (0) +# define true (!false) + +#endif /* __cplusplus */ + +ID3_C_VAR const char * const ID3LIB_NAME; +ID3_C_VAR const char * const ID3LIB_RELEASE; +ID3_C_VAR const char * const ID3LIB_FULL_NAME; +ID3_C_VAR const int ID3LIB_MAJOR_VERSION; +ID3_C_VAR const int ID3LIB_MINOR_VERSION; +ID3_C_VAR const int ID3LIB_PATCH_VERSION; +ID3_C_VAR const int ID3LIB_INTERFACE_AGE; +ID3_C_VAR const int ID3LIB_BINARY_AGE; + +#define ID3_TAGID "ID3" +#define ID3_TAGIDSIZE (3) +#define ID3_TAGHEADERSIZE (10) + +/** String used for the description field of a comment tag converted from an + ** id3v1 tag to an id3v2 tag + ** + ** \sa #ID3V1_Tag + **/ +#define STR_V1_COMMENT_DESC "ID3v1 Comment" + + +typedef unsigned char uchar; +typedef long unsigned int luint; + +typedef uint16 unicode_t; +typedef uint16 flags_t; + +#define NULL_UNICODE ((unicode_t) '\0') + +/* These macros are used to make the C and C++ declarations for enums and + * structs have the same syntax. Basically, it allows C users to refer to an + * enum or a struct without prepending enum/struct. + */ +#ifdef __cplusplus +# define ID3_ENUM(E) enum E +# define ID3_STRUCT(S) struct S +#else +# define ID3_ENUM(E) typedef enum _ ## E E; enum _ ## E +# define ID3_STRUCT(S) typedef struct _ ## S S; struct _ ## S +#endif + +/** \enum ID3_TextEnc + ** Enumeration of the types of text encodings: ascii or unicode + **/ +ID3_ENUM(ID3_TextEnc) +{ + ID3TE_NONE = -1, + ID3TE_ISO8859_1, + ID3TE_UTF16, + ID3TE_UTF16BE, + ID3TE_UTF8, + ID3TE_NUMENCODINGS, + ID3TE_ASCII = ID3TE_ISO8859_1, // do not use this -> use ID3TE_IS_SINGLE_BYTE_ENC(enc) instead + ID3TE_UNICODE = ID3TE_UTF16 // do not use this -> use ID3TE_IS_DOUBLE_BYTE_ENC(enc) instead +}; + +#define ID3TE_IS_SINGLE_BYTE_ENC(enc) ((enc) == ID3TE_ISO8859_1 || (enc) == ID3TE_UTF8) +#define ID3TE_IS_DOUBLE_BYTE_ENC(enc) ((enc) == ID3TE_UTF16 || (enc) == ID3TE_UTF16BE) + +/** Enumeration of the various id3 specifications + **/ +ID3_ENUM(ID3_V1Spec) +{ + ID3V1_0 = 0, + ID3V1_1, + ID3V1_NUMSPECS +}; + +ID3_ENUM(ID3_V2Spec) +{ + ID3V2_UNKNOWN = -1, + ID3V2_2_0 = 0, + ID3V2_2_1, + ID3V2_3_0, + ID3V2_4_0, + ID3V2_EARLIEST = ID3V2_2_0, + ID3V2_LATEST = ID3V2_4_0 // Lex: changed for last version +}; + +/** The various types of tags that id3lib can handle + **/ +ID3_ENUM(ID3_TagType) +{ + ID3TT_NONE = 0, /**< Represents an empty or non-existant tag */ + ID3TT_ID3V1 = 1 << 0, /**< Represents an id3v1 or id3v1.1 tag */ + ID3TT_ID3V2 = 1 << 1, /**< Represents an id3v2 tag */ + ID3TT_LYRICS3 = 1 << 2, /**< Represents a Lyrics3 tag */ + ID3TT_LYRICS3V2 = 1 << 3, /**< Represents a Lyrics3 v2.00 tag */ + ID3TT_MUSICMATCH = 1 << 4, /**< Represents a MusicMatch tag */ + /**< Represents a Lyrics3 tag (for backwards compatibility) */ + ID3TT_LYRICS = ID3TT_LYRICS3, + /** Represents both id3 tags: id3v1 and id3v2 */ + ID3TT_ID3 = ID3TT_ID3V1 | ID3TT_ID3V2, + /** Represents all possible types of tags */ + ID3TT_ALL = ~ID3TT_NONE, + /** Represents all tag types that can be prepended to a file */ + ID3TT_PREPENDED = ID3TT_ID3V2, + /** Represents all tag types that can be appended to a file */ + ID3TT_APPENDED = ID3TT_ALL & ~ID3TT_ID3V2 +}; + +/** + ** Enumeration of the different types of fields in a frame. + **/ +ID3_ENUM(ID3_FieldID) +{ + ID3FN_NOFIELD = 0, /**< No field */ + ID3FN_TEXTENC, /**< Text encoding (unicode or ASCII) */ + ID3FN_TEXT, /**< Text field */ + ID3FN_URL, /**< A URL */ + ID3FN_DATA, /**< Data field */ + ID3FN_DESCRIPTION, /**< Description field */ + ID3FN_OWNER, /**< Owner field */ + ID3FN_EMAIL, /**< Email field */ + ID3FN_RATING, /**< Rating field */ + ID3FN_FILENAME, /**< Filename field */ + ID3FN_LANGUAGE, /**< Language field */ + ID3FN_PICTURETYPE, /**< Picture type field */ + ID3FN_IMAGEFORMAT, /**< Image format field */ + ID3FN_MIMETYPE, /**< Mimetype field */ + ID3FN_COUNTER, /**< Counter field */ + ID3FN_ID, /**< Identifier/Symbol field */ + ID3FN_VOLUMEADJ, /**< Volume adjustment field */ + ID3FN_NUMBITS, /**< Number of bits field */ + ID3FN_VOLCHGRIGHT, /**< Volume chage on the right channel */ + ID3FN_VOLCHGLEFT, /**< Volume chage on the left channel */ + ID3FN_PEAKVOLRIGHT, /**< Peak volume on the right channel */ + ID3FN_PEAKVOLLEFT, /**< Peak volume on the left channel */ + ID3FN_TIMESTAMPFORMAT,/**< SYLT Timestamp Format */ + ID3FN_CONTENTTYPE, /**< SYLT content type */ + ID3FN_LASTFIELDID /**< Last field placeholder */ +}; + +/** + ** Enumeration of the different types of frames recognized by id3lib + **/ +ID3_ENUM(ID3_FrameID) +{ + /* ???? */ ID3FID_NOFRAME = 0, /**< No known frame */ + /* AENC */ ID3FID_AUDIOCRYPTO, /**< Audio encryption */ + /* APIC */ ID3FID_PICTURE, /**< Attached picture */ + /* ASPI */ ID3FID_AUDIOSEEKPOINT, /**< Audio seek point index */ + /* COMM */ ID3FID_COMMENT, /**< Comments */ + /* COMR */ ID3FID_COMMERCIAL, /**< Commercial frame */ + /* ENCR */ ID3FID_CRYPTOREG, /**< Encryption method registration */ + /* EQU2 */ ID3FID_EQUALIZATION2, /**< Equalisation (2) */ + /* EQUA */ ID3FID_EQUALIZATION, /**< Equalization */ + /* ETCO */ ID3FID_EVENTTIMING, /**< Event timing codes */ + /* GEOB */ ID3FID_GENERALOBJECT, /**< General encapsulated object */ + /* GRID */ ID3FID_GROUPINGREG, /**< Group identification registration */ + /* IPLS */ ID3FID_INVOLVEDPEOPLE, /**< Involved people list */ + /* LINK */ ID3FID_LINKEDINFO, /**< Linked information */ + /* MCDI */ ID3FID_CDID, /**< Music CD identifier */ + /* MLLT */ ID3FID_MPEGLOOKUP, /**< MPEG location lookup table */ + /* OWNE */ ID3FID_OWNERSHIP, /**< Ownership frame */ + /* PRIV */ ID3FID_PRIVATE, /**< Private frame */ + /* PCNT */ ID3FID_PLAYCOUNTER, /**< Play counter */ + /* POPM */ ID3FID_POPULARIMETER, /**< Popularimeter */ + /* POSS */ ID3FID_POSITIONSYNC, /**< Position synchronisation frame */ + /* RBUF */ ID3FID_BUFFERSIZE, /**< Recommended buffer size */ + /* RVA2 */ ID3FID_VOLUMEADJ2, /**< Relative volume adjustment (2) */ + /* RVAD */ ID3FID_VOLUMEADJ, /**< Relative volume adjustment */ + /* RVRB */ ID3FID_REVERB, /**< Reverb */ + /* SEEK */ ID3FID_SEEKFRAME, /**< Seek frame */ + /* SIGN */ ID3FID_SIGNATURE, /**< Signature frame */ + /* SYLT */ ID3FID_SYNCEDLYRICS, /**< Synchronized lyric/text */ + /* SYTC */ ID3FID_SYNCEDTEMPO, /**< Synchronized tempo codes */ + /* TALB */ ID3FID_ALBUM, /**< Album/Movie/Show title */ + /* TBPM */ ID3FID_BPM, /**< BPM (beats per minute) */ + /* TCOM */ ID3FID_COMPOSER, /**< Composer */ + /* TCON */ ID3FID_CONTENTTYPE, /**< Content type */ + /* TCOP */ ID3FID_COPYRIGHT, /**< Copyright message */ + /* TDAT */ ID3FID_DATE, /**< Date */ + /* TDEN */ ID3FID_ENCODINGTIME, /**< Encoding time */ + /* TDLY */ ID3FID_PLAYLISTDELAY, /**< Playlist delay */ + /* TDOR */ ID3FID_ORIGRELEASETIME, /**< Original release time */ + /* TDRC */ ID3FID_RECORDINGTIME, /**< Recording time */ + /* TDRL */ ID3FID_RELEASETIME, /**< Release time */ + /* TDTG */ ID3FID_TAGGINGTIME, /**< Tagging time */ + /* TIPL */ ID3FID_INVOLVEDPEOPLE2, /**< Involved people list */ + /* TENC */ ID3FID_ENCODEDBY, /**< Encoded by */ + /* TEXT */ ID3FID_LYRICIST, /**< Lyricist/Text writer */ + /* TFLT */ ID3FID_FILETYPE, /**< File type */ + /* TIME */ ID3FID_TIME, /**< Time */ + /* TIT1 */ ID3FID_CONTENTGROUP, /**< Content group description */ + /* TIT2 */ ID3FID_TITLE, /**< Title/songname/content description */ + /* TIT3 */ ID3FID_SUBTITLE, /**< Subtitle/Description refinement */ + /* TKEY */ ID3FID_INITIALKEY, /**< Initial key */ + /* TLAN */ ID3FID_LANGUAGE, /**< Language(s) */ + /* TLEN */ ID3FID_SONGLEN, /**< Length */ + /* TMCL */ ID3FID_MUSICIANCREDITLIST,/**< Musician credits list */ + /* TMED */ ID3FID_MEDIATYPE, /**< Media type */ + /* TMOO */ ID3FID_MOOD, /**< Mood */ + /* TOAL */ ID3FID_ORIGALBUM, /**< Original album/movie/show title */ + /* TOFN */ ID3FID_ORIGFILENAME, /**< Original filename */ + /* TOLY */ ID3FID_ORIGLYRICIST, /**< Original lyricist(s)/text writer(s) */ + /* TOPE */ ID3FID_ORIGARTIST, /**< Original artist(s)/performer(s) */ + /* TORY */ ID3FID_ORIGYEAR, /**< Original release year */ + /* TOWN */ ID3FID_FILEOWNER, /**< File owner/licensee */ + /* TPE1 */ ID3FID_LEADARTIST, /**< Lead performer(s)/Soloist(s) */ + /* TPE2 */ ID3FID_BAND, /**< Band/orchestra/accompaniment */ + /* TPE3 */ ID3FID_CONDUCTOR, /**< Conductor/performer refinement */ + /* TPE4 */ ID3FID_MIXARTIST, /**< Interpreted, remixed, or otherwise modified by */ + /* TPOS */ ID3FID_PARTINSET, /**< Part of a set */ + /* TPRO */ ID3FID_PRODUCEDNOTICE, /**< Produced notice */ + /* TPUB */ ID3FID_PUBLISHER, /**< Publisher */ + /* TRCK */ ID3FID_TRACKNUM, /**< Track number/Position in set */ + /* TRDA */ ID3FID_RECORDINGDATES, /**< Recording dates */ + /* TRSN */ ID3FID_NETRADIOSTATION, /**< Internet radio station name */ + /* TRSO */ ID3FID_NETRADIOOWNER, /**< Internet radio station owner */ + /* TSIZ */ ID3FID_SIZE, /**< Size */ + /* TSOA */ ID3FID_ALBUMSORTORDER, /**< Album sort order */ + /* TSOP */ ID3FID_PERFORMERSORTORDER,/**< Performer sort order */ + /* TSOT */ ID3FID_TITLESORTORDER, /**< Title sort order */ + /* TSRC */ ID3FID_ISRC, /**< ISRC (international standard recording code) */ + /* TSSE */ ID3FID_ENCODERSETTINGS, /**< Software/Hardware and settings used for encoding */ + /* TSST */ ID3FID_SETSUBTITLE, /**< Set subtitle */ + /* TXXX */ ID3FID_USERTEXT, /**< User defined text information */ + /* TYER */ ID3FID_YEAR, /**< Year */ + /* UFID */ ID3FID_UNIQUEFILEID, /**< Unique file identifier */ + /* USER */ ID3FID_TERMSOFUSE, /**< Terms of use */ + /* USLT */ ID3FID_UNSYNCEDLYRICS, /**< Unsynchronized lyric/text transcription */ + /* WCOM */ ID3FID_WWWCOMMERCIALINFO, /**< Commercial information */ + /* WCOP */ ID3FID_WWWCOPYRIGHT, /**< Copyright/Legal infromation */ + /* WOAF */ ID3FID_WWWAUDIOFILE, /**< Official audio file webpage */ + /* WOAR */ ID3FID_WWWARTIST, /**< Official artist/performer webpage */ + /* WOAS */ ID3FID_WWWAUDIOSOURCE, /**< Official audio source webpage */ + /* WORS */ ID3FID_WWWRADIOPAGE, /**< Official internet radio station homepage */ + /* WPAY */ ID3FID_WWWPAYMENT, /**< Payment */ + /* WPUB */ ID3FID_WWWPUBLISHER, /**< Official publisher webpage */ + /* WXXX */ ID3FID_WWWUSER, /**< User defined URL link */ + /* */ ID3FID_METACRYPTO, /**< Encrypted meta frame (id3v2.2.x) */ + /* */ ID3FID_METACOMPRESSION, /**< Compressed meta frame (id3v2.2.1) */ + /* >>>> */ ID3FID_LASTFRAMEID /**< Last field placeholder */ +}; + +ID3_ENUM(ID3_V1Lengths) +{ + ID3_V1_LEN = 128, + ID3_V1_LEN_ID = 3, + ID3_V1_LEN_TITLE = 30, + ID3_V1_LEN_ARTIST = 30, + ID3_V1_LEN_ALBUM = 30, + ID3_V1_LEN_YEAR = 4, + ID3_V1_LEN_COMMENT = 30, + ID3_V1_LEN_GENRE = 1 +}; + +ID3_ENUM(ID3_FieldFlags) +{ + ID3FF_NONE = 0, + ID3FF_CSTR = 1 << 0, + ID3FF_LIST = 1 << 1, + ID3FF_ENCODABLE = 1 << 2, + ID3FF_TEXTLIST = ID3FF_CSTR | ID3FF_LIST | ID3FF_ENCODABLE +}; + +/** Enumeration of the types of field types */ +ID3_ENUM(ID3_FieldType) +{ + ID3FTY_NONE = -1, + ID3FTY_INTEGER = 0, + ID3FTY_BINARY, + ID3FTY_TEXTSTRING, + ID3FTY_NUMTYPES +}; + +/** + ** Predefined id3lib error types. + **/ +ID3_ENUM(ID3_Err) +{ + ID3E_NoError = 0, /**< No error reported */ + ID3E_NoMemory, /**< No available memory */ + ID3E_NoData, /**< No data to parse */ + ID3E_BadData, /**< Improperly formatted data */ + ID3E_NoBuffer, /**< No buffer to write to */ + ID3E_SmallBuffer, /**< Buffer is too small */ + ID3E_InvalidFrameID, /**< Invalid frame id */ + ID3E_FieldNotFound, /**< Requested field not found */ + ID3E_UnknownFieldType, /**< Unknown field type */ + ID3E_TagAlreadyAttached, /**< Tag is already attached to a file */ + ID3E_InvalidTagVersion, /**< Invalid tag version */ + ID3E_NoFile, /**< No file to parse */ + ID3E_ReadOnly, /**< Attempting to write to a read-only file */ + ID3E_zlibError /**< Error in compression/uncompression */ +}; + +ID3_ENUM(ID3_ContentType) +{ + ID3CT_OTHER = 0, + ID3CT_LYRICS, + ID3CT_TEXTTRANSCRIPTION, + ID3CT_MOVEMENT, + ID3CT_EVENTS, + ID3CT_CHORD, + ID3CT_TRIVIA +}; + +ID3_ENUM(ID3_PictureType) +{ + ID3PT_OTHER = 0, + ID3PT_PNG32ICON = 1, // 32x32 pixels 'file icon' (PNG only) + ID3PT_OTHERICON = 2, // Other file icon + ID3PT_COVERFRONT = 3, // Cover (front) + ID3PT_COVERBACK = 4, // Cover (back) + ID3PT_LEAFLETPAGE = 5, // Leaflet page + ID3PT_MEDIA = 6, // Media (e.g. lable side of CD) + ID3PT_LEADARTIST = 7, // Lead artist/lead performer/soloist + ID3PT_ARTIST = 8, // Artist/performer + ID3PT_CONDUCTOR = 9, // Conductor + ID3PT_BAND = 10, // Band/Orchestra + ID3PT_COMPOSER = 11, // Composer + ID3PT_LYRICIST = 12, // Lyricist/text writer + ID3PT_REC_LOCATION = 13, // Recording Location + ID3PT_RECORDING = 14, // During recording + ID3PT_PERFORMANCE = 15, // During performance + ID3PT_VIDEO = 16, // Movie/video screen capture + ID3PT_FISH = 17, // A bright coloured fish + ID3PT_ILLUSTRATION = 18, // Illustration + ID3PT_ARTISTLOGO = 19, // Band/artist logotype + ID3PT_PUBLISHERLOGO = 20 // Publisher/Studio logotype +}; + +ID3_ENUM(ID3_TimeStampFormat) +{ + ID3TSF_FRAME = 1, + ID3TSF_MS +}; + +ID3_ENUM(MP3_BitRates) +{ + MP3BITRATE_FALSE = -1, + MP3BITRATE_NONE = 0, + MP3BITRATE_8K = 8000, + MP3BITRATE_16K = 16000, + MP3BITRATE_24K = 24000, + MP3BITRATE_32K = 32000, + MP3BITRATE_40K = 40000, + MP3BITRATE_48K = 48000, + MP3BITRATE_56K = 56000, + MP3BITRATE_64K = 64000, + MP3BITRATE_80K = 80000, + MP3BITRATE_96K = 96000, + MP3BITRATE_112K = 112000, + MP3BITRATE_128K = 128000, + MP3BITRATE_144K = 144000, + MP3BITRATE_160K = 160000, + MP3BITRATE_176K = 176000, + MP3BITRATE_192K = 192000, + MP3BITRATE_224K = 224000, + MP3BITRATE_256K = 256000, + MP3BITRATE_288K = 288000, + MP3BITRATE_320K = 320000, + MP3BITRATE_352K = 352000, + MP3BITRATE_384K = 384000, + MP3BITRATE_416K = 416000, + MP3BITRATE_448K = 448000 +}; + +ID3_ENUM(Mpeg_Layers) +{ + MPEGLAYER_FALSE = -1, + MPEGLAYER_UNDEFINED, + MPEGLAYER_III, + MPEGLAYER_II, + MPEGLAYER_I +}; + +ID3_ENUM(Mpeg_Version) +{ + MPEGVERSION_FALSE = -1, + MPEGVERSION_2_5, + MPEGVERSION_Reserved, + MPEGVERSION_2, + MPEGVERSION_1 +}; + +ID3_ENUM(Mp3_Frequencies) +{ + MP3FREQUENCIES_FALSE = -1, + MP3FREQUENCIES_Reserved = 0, + MP3FREQUENCIES_8000HZ = 8000, + MP3FREQUENCIES_11025HZ = 11025, + MP3FREQUENCIES_12000HZ = 12000, + MP3FREQUENCIES_16000HZ = 16000, + MP3FREQUENCIES_22050HZ = 22050, + MP3FREQUENCIES_24000HZ = 24000, + MP3FREQUENCIES_32000HZ = 32000, + MP3FREQUENCIES_48000HZ = 48000, + MP3FREQUENCIES_44100HZ = 44100, +}; + +ID3_ENUM(Mp3_ChannelMode) +{ + MP3CHANNELMODE_FALSE = -1, + MP3CHANNELMODE_STEREO, + MP3CHANNELMODE_JOINT_STEREO, + MP3CHANNELMODE_DUAL_CHANNEL, + MP3CHANNELMODE_SINGLE_CHANNEL +}; + +ID3_ENUM(Mp3_ModeExt) +{ + MP3MODEEXT_FALSE = -1, + MP3MODEEXT_0, + MP3MODEEXT_1, + MP3MODEEXT_2, + MP3MODEEXT_3 +}; + +ID3_ENUM(Mp3_Emphasis) +{ + MP3EMPHASIS_FALSE = -1, + MP3EMPHASIS_NONE, + MP3EMPHASIS_50_15MS, + MP3EMPHASIS_Reserved, + MP3EMPHASIS_CCIT_J17 +}; + +ID3_ENUM(Mp3_Crc) +{ + MP3CRC_ERROR_SIZE = -2, + MP3CRC_MISMATCH = -1, + MP3CRC_NONE = 0, + MP3CRC_OK = 1 +}; + +ID3_STRUCT(Mp3_Headerinfo) +{ + Mpeg_Layers layer; + Mpeg_Version version; + MP3_BitRates bitrate; + Mp3_ChannelMode channelmode; + Mp3_ModeExt modeext; + Mp3_Emphasis emphasis; + Mp3_Crc crc; + uint32 vbr_bitrate; // avg bitrate from xing header + uint32 frequency; // samplerate + uint32 framesize; + uint32 frames; // nr of frames + uint32 time; // nr of seconds in song + bool privatebit; + bool copyrighted; + bool original; +}; + +#define ID3_NR_OF_V1_GENRES 148 + +static const char *ID3_v1_genre_description[ID3_NR_OF_V1_GENRES] = +{ + "Blues", //0 + "Classic Rock", //1 + "Country", //2 + "Dance", //3 + "Disco", //4 + "Funk", //5 + "Grunge", //6 + "Hip-Hop", //7 + "Jazz", //8 + "Metal", //9 + "New Age", //10 + "Oldies", //11 + "Other", //12 + "Pop", //13 + "R&B", //14 + "Rap", //15 + "Reggae", //16 + "Rock", //17 + "Techno", //18 + "Industrial", //19 + "Alternative", //20 + "Ska", //21 + "Death Metal", //22 + "Pranks", //23 + "Soundtrack", //24 + "Euro-Techno", //25 + "Ambient", //26 + "Trip-Hop", //27 + "Vocal", //28 + "Jazz+Funk", //29 + "Fusion", //30 + "Trance", //31 + "Classical", //32 + "Instrumental", //33 + "Acid", //34 + "House", //35 + "Game", //36 + "Sound Clip", //37 + "Gospel", //38 + "Noise", //39 + "AlternRock", //40 + "Bass", //41 + "Soul", //42 + "Punk", //43 + "Space", //44 + "Meditative", //45 + "Instrumental Pop", //46 + "Instrumental Rock", //47 + "Ethnic", //48 + "Gothic", //49 + "Darkwave", //50 + "Techno-Industrial", //51 + "Electronic", //52 + "Pop-Folk", //53 + "Eurodance", //54 + "Dream", //55 + "Southern Rock", //56 + "Comedy", //57 + "Cult", //58 + "Gangsta", //59 + "Top 40", //60 + "Christian Rap", //61 + "Pop/Funk", //62 + "Jungle", //63 + "Native American", //64 + "Cabaret", //65 + "New Wave", //66 + "Psychadelic", //67 + "Rave", //68 + "Showtunes", //69 + "Trailer", //70 + "Lo-Fi", //71 + "Tribal", //72 + "Acid Punk", //73 + "Acid Jazz", //74 + "Polka", //75 + "Retro", //76 + "Musical", //77 + "Rock & Roll", //78 + "Hard Rock", //79 +// following are winamp extentions + "Folk", //80 + "Folk-Rock", //81 + "National Folk", //82 + "Swing", //83 + "Fast Fusion", //84 + "Bebob", //85 + "Latin", //86 + "Revival", //87 + "Celtic", //88 + "Bluegrass", //89 + "Avantgarde", //90 + "Gothic Rock", //91 + "Progressive Rock", //92 + "Psychedelic Rock", //93 + "Symphonic Rock", //94 + "Slow Rock", //95 + "Big Band", //96 + "Chorus", //97 + "Easy Listening", //98 + "Acoustic", //99 + "Humour", //100 + "Speech", //101 + "Chanson", //102 + "Opera", //103 + "Chamber Music", //104 + "Sonata", //105 + "Symphony", //106 + "Booty Bass", //107 + "Primus", //108 + "Porn Groove", //109 + "Satire", //110 + "Slow Jam", //111 + "Club", //112 + "Tango", //113 + "Samba", //114 + "Folklore", //115 + "Ballad", //116 + "Power Ballad", //117 + "Rhythmic Soul", //118 + "Freestyle", //119 + "Duet", //120 + "Punk Rock", //121 + "Drum Solo", //122 + "A capella", //123 + "Euro-House", //124 + "Dance Hall", //125 + "Goa", //126 + "Drum & Bass", //127 + "Club-House", //128 + "Hardcore", //129 + "Terror", //130 + "Indie", //131 + "Britpop", //132 + "Negerpunk", //133 + "Polsk Punk", //134 + "Beat", //135 + "Christian Gangsta Rap", //136 + "Heavy Metal", //137 + "Black Metal", //138 + "Crossover", //139 + "Contemporary Christian",//140 + "Christian Rock ", //141 + "Merengue", //142 + "Salsa", //143 + "Trash Metal", //144 + "Anime", //145 + "JPop", //146 + "Synthpop" //147 +}; + +#define ID3_V1GENRE2DESCRIPTION(x) (x < ID3_NR_OF_V1_GENRES && x >= 0) ? ID3_v1_genre_description[x] : NULL + +#define MASK(bits) ((1 << (bits)) - 1) +#define MASK1 MASK(1) +#define MASK2 MASK(2) +#define MASK3 MASK(3) +#define MASK4 MASK(4) +#define MASK5 MASK(5) +#define MASK6 MASK(6) +#define MASK7 MASK(7) +#define MASK8 MASK(8) + +/* + * The following is borrowed from glib.h (http://www.gtk.org) + */ +#ifdef WIN32 + +/* On native Win32, directory separator is the backslash, and search path + * separator is the semicolon. + */ +# define ID3_DIR_SEPARATOR '\\' +# define ID3_DIR_SEPARATOR_S "\\" +# define ID3_SEARCHPATH_SEPARATOR ';' +# define ID3_SEARCHPATH_SEPARATOR_S ";" + +#else /* !WIN32 */ + +# ifndef _EMX_ +/* Unix */ + +# define ID3_DIR_SEPARATOR '/' +# define ID3_DIR_SEPARATOR_S "/" +# define ID3_SEARCHPATH_SEPARATOR ':' +# define ID3_SEARCHPATH_SEPARATOR_S ":" + +# else +/* EMX/OS2 */ + +# define ID3_DIR_SEPARATOR '/' +# define ID3_DIR_SEPARATOR_S "/" +# define ID3_SEARCHPATH_SEPARATOR ';' +# define ID3_SEARCHPATH_SEPARATOR_S ";" + +# endif + +#endif /* !WIN32 */ + +#ifndef NULL +# define NULL ((void*) 0) +#endif + +#endif /* _ID3LIB_GLOBALS_H_ */ + diff --git a/id3lib/include/id3/helpers.h b/id3lib/include/id3/helpers.h new file mode 100644 index 0000000..acd7674 --- /dev/null +++ b/id3lib/include/id3/helpers.h @@ -0,0 +1,109 @@ +// -*- C++ -*- +// $Id: helpers.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_HELPERS_H_ +#define _ID3LIB_HELPERS_H_ + +#include "id3/id3lib_strings.h" +#include "id3/globals.h" //has "id3/sized_types.h" + +class ID3_TagImpl; +class ID3_Frame; + +namespace dami +{ + namespace id3 + { + namespace v2 + { + ID3_C_EXPORT String getString(const ID3_Frame*, ID3_FieldID); + ID3_C_EXPORT String getStringAtIndex(const ID3_Frame*, ID3_FieldID, size_t); + + ID3_C_EXPORT String getFrameText(const ID3_TagImpl&, ID3_FrameID); + ID3_C_EXPORT ID3_Frame* setFrameText(ID3_TagImpl&, ID3_FrameID, String); + ID3_C_EXPORT size_t removeFrames(ID3_TagImpl&, ID3_FrameID); + + ID3_C_EXPORT ID3_Frame* hasArtist(const ID3_TagImpl&); + ID3_C_EXPORT String getArtist(const ID3_TagImpl&); + ID3_C_EXPORT ID3_Frame* setArtist(ID3_TagImpl&, String); + ID3_C_EXPORT size_t removeArtists(ID3_TagImpl&); + + ID3_C_EXPORT ID3_Frame* hasAlbum(const ID3_TagImpl&); + ID3_C_EXPORT String getAlbum(const ID3_TagImpl&); + ID3_C_EXPORT ID3_Frame* setAlbum(ID3_TagImpl&, String); + ID3_C_EXPORT size_t removeAlbums(ID3_TagImpl&); + + ID3_C_EXPORT ID3_Frame* hasTitle(const ID3_TagImpl&); + ID3_C_EXPORT String getTitle(const ID3_TagImpl&); + ID3_C_EXPORT ID3_Frame* setTitle(ID3_TagImpl&, String); + ID3_C_EXPORT size_t removeTitles(ID3_TagImpl&); + + ID3_C_EXPORT ID3_Frame* hasYear(const ID3_TagImpl&); + ID3_C_EXPORT String getYear(const ID3_TagImpl&); + ID3_C_EXPORT ID3_Frame* setYear(ID3_TagImpl&, String); + ID3_C_EXPORT size_t removeYears(ID3_TagImpl&); + + ID3_C_EXPORT ID3_Frame* hasV1Comment(const ID3_TagImpl&); + // ID3_C_EXPORT ID3_Frame* hasComment(const ID3_TagImpl&, String desc); + ID3_C_EXPORT ID3_Frame* hasComment(const ID3_TagImpl&); + ID3_C_EXPORT String getComment(const ID3_TagImpl&, String desc); + ID3_C_EXPORT String getV1Comment(const ID3_TagImpl&); + ID3_C_EXPORT ID3_Frame* setComment(ID3_TagImpl&, String, String, String); + ID3_C_EXPORT size_t removeComments(ID3_TagImpl&, String); + ID3_C_EXPORT size_t removeAllComments(ID3_TagImpl&); + + ID3_C_EXPORT ID3_Frame* hasTrack(const ID3_TagImpl&); + ID3_C_EXPORT String getTrack(const ID3_TagImpl&); + ID3_C_EXPORT size_t getTrackNum(const ID3_TagImpl&); + ID3_C_EXPORT ID3_Frame* setTrack(ID3_TagImpl&, uchar ucTrack, uchar ucTotal); + ID3_C_EXPORT size_t removeTracks(ID3_TagImpl&); + + ID3_C_EXPORT ID3_Frame* hasGenre(const ID3_TagImpl&); + ID3_C_EXPORT String getGenre(const ID3_TagImpl&); + ID3_C_EXPORT size_t getGenreNum(const ID3_TagImpl&); + ID3_C_EXPORT ID3_Frame* setGenre(ID3_TagImpl&, size_t ucGenre); + ID3_C_EXPORT size_t removeGenres(ID3_TagImpl&); + + ID3_C_EXPORT ID3_Frame* hasLyrics(const ID3_TagImpl&); + ID3_C_EXPORT String getLyrics(const ID3_TagImpl&); + ID3_C_EXPORT ID3_Frame* setLyrics(ID3_TagImpl&, String, String, String); + ID3_C_EXPORT size_t removeLyrics(ID3_TagImpl&); + + ID3_C_EXPORT String getLyricist(const ID3_TagImpl&); + ID3_C_EXPORT ID3_Frame* setLyricist(ID3_TagImpl&, String); + ID3_C_EXPORT size_t removeLyricists(ID3_TagImpl&); + + ID3_C_EXPORT ID3_Frame* hasSyncLyrics(const ID3_TagImpl&, String lang, String desc); + ID3_C_EXPORT ID3_Frame* setSyncLyrics(ID3_TagImpl&, BString, ID3_TimeStampFormat, + String, String, ID3_ContentType); + ID3_C_EXPORT BString getSyncLyrics(const ID3_TagImpl& tag, String lang, String desc); + }; + }; +}; + +#endif /* _ID3LIB_HELPERS_H_ */ + diff --git a/id3lib/include/id3/id3lib_bitset b/id3lib/include/id3/id3lib_bitset new file mode 100644 index 0000000..8b4f8b1 --- /dev/null +++ b/id3lib/include/id3/id3lib_bitset @@ -0,0 +1,1066 @@ +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_BITSET +#define __SGI_STL_BITSET + +// This implementation of bitset<> has a second template parameter, +// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE +// THIS FEATURE*. It is experimental, and it may be removed in +// future releases. + +// A bitset of size N, using words of type _WordT, will have +// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high- +// order bits in the highest word.) It is a class invariant +// of class bitset<> that those unused bits are always zero. + +// Most of the actual code isn't contained in bitset<> itself, but in the +// base class _Base_bitset. The base class works with whole words, not with +// individual bits. This allows us to specialize _Base_bitset for the +// important special case where the bitset is only a single word. + +// The C++ standard does not define the precise semantics of operator[]. +// In this implementation the const version of operator[] is equivalent +// to test(), except that it does no range checking. The non-const version +// returns a reference to a bit, again without doing any range checking. + + +#include // for size_t +#include // for CHAR_BIT +#include +#include // for invalid_argument, out_of_range, overflow_error +#include // for istream, ostream + +#define __BITS_PER_WORDT(__wt) (CHAR_BIT*sizeof(__wt)) +#define __BITSET_WORDS(__n,__wt) \ + ((__n) < 1 ? 1 : ((__n) + __BITS_PER_WORDT(__wt) - 1)/__BITS_PER_WORDT(__wt)) + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1209 +#endif + +// structure to aid in counting bits +template +struct _Bit_count { + static unsigned char _S_bit_count[256]; +}; + +// Mapping from 8 bit unsigned integers to the index of the first one +// bit: +template +struct _First_one { + static unsigned char _S_first_one[256]; +}; + +// +// Base class: general case. +// + +template +struct _Base_bitset { + _WordT _M_w[_Nw]; // 0 is the least significant word. + + _Base_bitset( void ) { _M_do_reset(); } + + _Base_bitset(unsigned long __val); + + static size_t _S_whichword( size_t __pos ) { + return __pos / __BITS_PER_WORDT(_WordT); + } + static size_t _S_whichbyte( size_t __pos ) { + return (__pos % __BITS_PER_WORDT(_WordT)) / CHAR_BIT; + } + static size_t _S_whichbit( size_t __pos ) { + return __pos % __BITS_PER_WORDT(_WordT); + } + static _WordT _S_maskbit( size_t __pos ) { + return (static_cast<_WordT>(1)) << _S_whichbit(__pos); + } + + _WordT& _M_getword(size_t __pos) { return _M_w[_S_whichword(__pos)]; } + _WordT _M_getword(size_t __pos) const { return _M_w[_S_whichword(__pos)]; } + + _WordT& _M_hiword() { return _M_w[_Nw - 1]; } + _WordT _M_hiword() const { return _M_w[_Nw - 1]; } + + void _M_do_and(const _Base_bitset<_Nw,_WordT>& __x) { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] &= __x._M_w[__i]; + } + } + + void _M_do_or(const _Base_bitset<_Nw,_WordT>& __x) { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] |= __x._M_w[__i]; + } + } + + void _M_do_xor(const _Base_bitset<_Nw,_WordT>& __x) { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] ^= __x._M_w[__i]; + } + } + + void _M_do_left_shift(size_t __shift); + + void _M_do_right_shift(size_t __shift); + + void _M_do_flip() { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] = ~_M_w[__i]; + } + } + + void _M_do_set() { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] = ~static_cast<_WordT>(0); + } + } + + void _M_do_reset() { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] = 0; + } + } + + bool _M_is_equal(const _Base_bitset<_Nw,_WordT>& __x) const { + for (size_t __i = 0; __i < _Nw; ++__i) { + if (_M_w[__i] != __x._M_w[__i]) + return false; + } + return true; + } + + bool _M_is_any() const { + for ( size_t __i = 0; __i < __BITSET_WORDS(_Nw,_WordT); __i++ ) { + if ( _M_w[__i] != static_cast<_WordT>(0) ) + return true; + } + return false; + } + + size_t _M_do_count() const { + size_t __result = 0; + const unsigned char* __byte_ptr = (const unsigned char*)_M_w; + const unsigned char* __end_ptr = (const unsigned char*)(_M_w+_Nw); + + while ( __byte_ptr < __end_ptr ) { + __result += _Bit_count::_S_bit_count[*__byte_ptr]; + __byte_ptr++; + } + return __result; + } + + unsigned long _M_do_to_ulong() const; + + // find first "on" bit + size_t _M_do_find_first(size_t __not_found) const; + + // find the next "on" bit that follows "prev" + size_t _M_do_find_next(size_t __prev, size_t __not_found) const; +}; + +// +// Definitions of non-inline functions from _Base_bitset. +// + +template +_Base_bitset<_Nw, _WordT>::_Base_bitset(unsigned long __val) +{ + _M_do_reset(); + const size_t __n = min(sizeof(unsigned long)*CHAR_BIT, + __BITS_PER_WORDT(_WordT)*_Nw); + for(size_t __i = 0; __i < __n; ++__i, __val >>= 1) + if ( __val & 0x1 ) + _M_getword(__i) |= _S_maskbit(__i); +} + +template +void _Base_bitset<_Nw, _WordT>::_M_do_left_shift(size_t __shift) +{ + if (__shift != 0) { + const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT); + const size_t __offset = __shift % __BITS_PER_WORDT(_WordT); + const size_t __sub_offset = __BITS_PER_WORDT(_WordT) - __offset; + size_t __n = _Nw - 1; + for ( ; __n > __wshift; --__n) + _M_w[__n] = (_M_w[__n - __wshift] << __offset) | + (_M_w[__n - __wshift - 1] >> __sub_offset); + if (__n == __wshift) + _M_w[__n] = _M_w[0] << __offset; + for (size_t __n1 = 0; __n1 < __n; ++__n1) + _M_w[__n1] = static_cast<_WordT>(0); + } +} + +template +void _Base_bitset<_Nw, _WordT>::_M_do_right_shift(size_t __shift) +{ + if (__shift != 0) { + const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT); + const size_t __offset = __shift % __BITS_PER_WORDT(_WordT); + const size_t __sub_offset = __BITS_PER_WORDT(_WordT) - __offset; + const size_t __limit = _Nw - __wshift - 1; + size_t __n = 0; + for ( ; __n < __limit; ++__n) + _M_w[__n] = (_M_w[__n + __wshift] >> __offset) | + (_M_w[__n + __wshift + 1] << __sub_offset); + _M_w[__limit] = _M_w[_Nw-1] >> __offset; + for (size_t __n1 = __limit + 1; __n1 < _Nw; ++__n1) + _M_w[__n1] = static_cast<_WordT>(0); + } +} + +template +unsigned long _Base_bitset<_Nw, _WordT>::_M_do_to_ulong() const +{ + const overflow_error __overflow("bitset"); + + if (sizeof(_WordT) >= sizeof(unsigned long)) { + for (size_t __i = 1; __i < _Nw; ++__i) + if (_M_w[__i]) + __STL_THROW(__overflow); + + const _WordT __mask = static_cast<_WordT>(static_cast(-1)); + if (_M_w[0] & ~__mask) + __STL_THROW(__overflow); + + return static_cast(_M_w[0] & __mask); + } + else { // sizeof(_WordT) < sizeof(unsigned long). + const size_t __nwords = + (sizeof(unsigned long) + sizeof(_WordT) - 1) / sizeof(_WordT); + + size_t __min_nwords = __nwords; + if (_Nw > __nwords) { + for (size_t __i = __nwords; __i < _Nw; ++__i) + if (_M_w[__i]) + __STL_THROW(__overflow); + } + else + __min_nwords = _Nw; + + // If unsigned long is 8 bytes and _WordT is 6 bytes, then an unsigned + // long consists of all of one word plus 2 bytes from another word. + const size_t __part = sizeof(unsigned long) % sizeof(_WordT); + + if (__part != 0 && __nwords <= _Nw && + (_M_w[__min_nwords - 1] >> ((sizeof(_WordT) - __part) * CHAR_BIT)) != 0) + __STL_THROW(__overflow); + + unsigned long __result = 0; + for (size_t __i = 0; __i < __min_nwords; ++__i) { + __result |= static_cast( + _M_w[__i]) << (__i * sizeof(_WordT) * CHAR_BIT); + } + return __result; + } +} // End _M_do_to_ulong + +template +size_t _Base_bitset<_Nw, _WordT>::_M_do_find_first(size_t __not_found) const +{ + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _WordT __thisword = _M_w[__i]; + if ( __thisword != static_cast<_WordT>(0) ) { + // find byte within word + for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = static_cast(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __i*__BITS_PER_WORDT(_WordT) + __j*CHAR_BIT + + _First_one::_S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + } + // not found, so return an indication of failure. + return __not_found; +} + +template +size_t +_Base_bitset<_Nw, _WordT>::_M_do_find_next(size_t __prev, + size_t __not_found) const +{ + // make bound inclusive + ++__prev; + + // check out of bounds + if ( __prev >= _Nw * __BITS_PER_WORDT(_WordT) ) + return __not_found; + + // search first word + size_t __i = _S_whichword(__prev); + _WordT __thisword = _M_w[__i]; + + // mask off bits below bound + __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); + + if ( __thisword != static_cast<_WordT>(0) ) { + // find byte within word + // get first byte into place + __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; + for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = static_cast(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __i*__BITS_PER_WORDT(_WordT) + __j*CHAR_BIT + + _First_one::_S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + + // check subsequent words + __i++; + for ( ; __i < _Nw; __i++ ) { + _WordT __thisword = _M_w[__i]; + if ( __thisword != static_cast<_WordT>(0) ) { + // find byte within word + for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = static_cast(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __i*__BITS_PER_WORDT(_WordT) + __j*CHAR_BIT + + _First_one::_S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + } + + // not found, so return an indication of failure. + return __not_found; +} // end _M_do_find_next + + +// ------------------------------------------------------------ + +// +// Base class: specialization for a single word. +// + +template +struct _Base_bitset<1, _WordT> { + _WordT _M_w; + + _Base_bitset( void ) { _M_do_reset(); } + + _Base_bitset(unsigned long __val); + + static size_t _S_whichword( size_t __pos ) { + return __pos / __BITS_PER_WORDT(_WordT); + } + static size_t _S_whichbyte( size_t __pos ) { + return (__pos % __BITS_PER_WORDT(_WordT)) / CHAR_BIT; + } + static size_t _S_whichbit( size_t __pos ) { + return __pos % __BITS_PER_WORDT(_WordT); + } + static _WordT _S_maskbit( size_t __pos ) { + return (static_cast<_WordT>(1)) << _S_whichbit(__pos); + } + + _WordT& _M_getword(size_t) { return _M_w; } + _WordT _M_getword(size_t) const { return _M_w; } + + _WordT& _M_hiword() { return _M_w; } + _WordT _M_hiword() const { return _M_w; } + + void _M_do_and(const _Base_bitset<1,_WordT>& __x) { _M_w &= __x._M_w; } + void _M_do_or(const _Base_bitset<1,_WordT>& __x) { _M_w |= __x._M_w; } + void _M_do_xor(const _Base_bitset<1,_WordT>& __x) { _M_w ^= __x._M_w; } + void _M_do_left_shift(size_t __shift) { _M_w <<= __shift; } + void _M_do_right_shift(size_t __shift) { _M_w >>= __shift; } + void _M_do_flip() { _M_w = ~_M_w; } + void _M_do_set() { _M_w = ~static_cast<_WordT>(0); } + void _M_do_reset() { _M_w = 0; } + + bool _M_is_equal(const _Base_bitset<1,_WordT>& __x) const { + return _M_w == __x._M_w; + } + bool _M_is_any() const { + return _M_w != 0; + } + + size_t _M_do_count() const { + size_t __result = 0; + const unsigned char* __byte_ptr = (const unsigned char*)&_M_w; + const unsigned char* __end_ptr = ((const unsigned char*)&_M_w)+sizeof(_M_w); + while ( __byte_ptr < __end_ptr ) { + __result += _Bit_count::_S_bit_count[*__byte_ptr]; + __byte_ptr++; + } + return __result; + } + + unsigned long _M_do_to_ulong() const { + if (sizeof(_WordT) <= sizeof(unsigned long)) + return static_cast(_M_w); + else { + const _WordT __mask = static_cast<_WordT>(static_cast(-1)); + if (_M_w & ~__mask) + __STL_THROW(overflow_error("bitset")); + return static_cast(_M_w); + } + } + + size_t _M_do_find_first(size_t __not_found) const; + + // find the next "on" bit that follows "prev" + size_t _M_do_find_next(size_t __prev, size_t __not_found) const; + +}; + +// +// Definitions of non-inline functions from the single-word version of +// _Base_bitset. +// + +template +_Base_bitset<1, _WordT>::_Base_bitset(unsigned long __val) +{ + _M_do_reset(); + const size_t __n = min(sizeof(unsigned long)*CHAR_BIT, + __BITS_PER_WORDT(_WordT)*_Nw); + for(size_t __i = 0; __i < __n; ++__i, __val >>= 1) + if ( __val & 0x1 ) + _M_w |= _S_maskbit(__i); +} + +template +size_t _Base_bitset<1, _WordT>::_M_do_find_first(size_t __not_found) const +{ + _WordT __thisword = _M_w; + + if ( __thisword != static_cast<_WordT>(0) ) { + // find byte within word + for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = static_cast(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __j*CHAR_BIT + _First_one::_S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + // not found, so return a value that indicates failure. + return __not_found; +} + +template +size_t +_Base_bitset<1, _WordT>::_M_do_find_next(size_t __prev, + size_t __not_found ) const +{ + // make bound inclusive + ++__prev; + + // check out of bounds + if ( __prev >= __BITS_PER_WORDT(_WordT) ) + return __not_found; + + // search first (and only) word + _WordT __thisword = _M_w; + + // mask off bits below bound + __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); + + if ( __thisword != static_cast<_WordT>(0) ) { + // find byte within word + // get first byte into place + __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; + for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = static_cast(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __j*CHAR_BIT + _First_one::_S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + + // not found, so return a value that indicates failure. + return __not_found; +} // end _M_do_find_next + +// +// One last specialization: _M_do_to_ulong() and the constructor from +// unsigned long are very simple if the bitset consists of a single +// word of type unsigned long. +// + +template<> +inline unsigned long +_Base_bitset<1, unsigned long>::_M_do_to_ulong() const { return _M_w; } + +template<> +inline _Base_bitset<1, unsigned long>::_Base_bitset(unsigned long __val) { + _M_w = __val; +} + + +// ------------------------------------------------------------ +// Helper class to zero out the unused high-order bits in the highest word. + +template struct _Sanitize { + static void _M_do_sanitize(_WordT& __val) + { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); } +}; + +template struct _Sanitize<_WordT, 0> { + static void _M_do_sanitize(_WordT) {} +}; + +// ------------------------------------------------------------ +// Class bitset. +// _Nb may be any nonzero number of type size_t. +// Type _WordT may be any unsigned integral type. + +template +class bitset : private _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> +{ +private: + typedef _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> _Base; + + // Import base's protected interface. Necessary because of new template + // name resolution rules. + using _Base::_S_whichword; + using _Base::_S_whichbyte; + using _Base::_S_whichbit; + using _Base::_S_maskbit; + using _Base::_M_getword; + using _Base::_M_hiword; + using _Base::_M_do_and; + using _Base::_M_do_or; + using _Base::_M_do_xor; + using _Base::_M_do_left_shift; + using _Base::_M_do_right_shift; + using _Base::_M_do_flip; + using _Base::_M_do_set; + using _Base::_M_do_reset; + using _Base::_M_is_equal; + using _Base::_M_is_any; + using _Base::_M_do_count; + using _Base::_M_do_to_ulong; + using _Base::_M_do_find_first; + using _Base::_M_do_find_next; + +private: + void _M_do_sanitize() { + _Sanitize<_WordT,_Nb%__BITS_PER_WORDT(_WordT) > + ::_M_do_sanitize(_M_hiword()); + } + +public: + + // bit reference: + class reference; + friend class reference; + class reference { + friend class bitset; + + _WordT *_M_wp; + size_t _M_bpos; + + // left undefined + reference(); + + reference( bitset& __b, size_t __pos ) { + _M_wp = &__b._M_getword(__pos); + _M_bpos = _S_whichbit(__pos); + } + + public: + ~reference() {} + + // for b[i] = __x; + reference& operator=(bool __x) { + if ( __x ) + *_M_wp |= _S_maskbit(_M_bpos); + else + *_M_wp &= ~_S_maskbit(_M_bpos); + + return *this; + } + + // for b[i] = b[__j]; + reference& operator=(const reference& __j) { + if ( (*(__j._M_wp) & _S_maskbit(__j._M_bpos)) ) + *_M_wp |= _S_maskbit(_M_bpos); + else + *_M_wp &= ~_S_maskbit(_M_bpos); + + return *this; + } + + // flips the bit + bool operator~() const { return (*(_M_wp) & _S_maskbit(_M_bpos)) == 0; } + + // for __x = b[i]; + operator bool() const { return (*(_M_wp) & _S_maskbit(_M_bpos)) != 0; } + + // for b[i].flip(); + reference& flip() { + *_M_wp ^= _S_maskbit(_M_bpos); + return *this; + } + }; + + // 23.3.5.1 constructors: + bitset() {} + bitset(unsigned long __val) : + _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT>(__val) {} + + template + explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s, + size_t __pos = 0, + size_t __n = size_t(basic_string<_CharT,_Traits,_Alloc>::npos)) + : _Base() + { + if (__pos > __s.size()) + __STL_THROW(out_of_range("bitset")); + _M_copy_from_string(__s, __pos, __n); + } + + // 23.3.5.2 bitset operations: + bitset<_Nb,_WordT>& operator&=(const bitset<_Nb,_WordT>& __rhs) { + _M_do_and(__rhs); + return *this; + } + + bitset<_Nb,_WordT>& operator|=(const bitset<_Nb,_WordT>& __rhs) { + _M_do_or(__rhs); + return *this; + } + + bitset<_Nb,_WordT>& operator^=(const bitset<_Nb,_WordT>& __rhs) { + _M_do_xor(__rhs); + return *this; + } + + bitset<_Nb,_WordT>& operator<<=(size_t __pos) { + _M_do_left_shift(__pos); + _M_do_sanitize(); + return *this; + } + + bitset<_Nb,_WordT>& operator>>=(size_t __pos) { + _M_do_right_shift(__pos); + _M_do_sanitize(); + return *this; + } + + // + // Extension: + // Versions of single-bit set, reset, flip, test with no range checking. + // + + bitset<_Nb,_WordT>& _Unchecked_set(size_t __pos) { + _M_getword(__pos) |= _S_maskbit(__pos); + return *this; + } + + bitset<_Nb,_WordT>& _Unchecked_set(size_t __pos, int __val) { + if (__val) + _M_getword(__pos) |= _S_maskbit(__pos); + else + _M_getword(__pos) &= ~_S_maskbit(__pos); + + return *this; + } + + bitset<_Nb,_WordT>& _Unchecked_reset(size_t __pos) { + _M_getword(__pos) &= ~_S_maskbit(__pos); + return *this; + } + + bitset<_Nb,_WordT>& _Unchecked_flip(size_t __pos) { + _M_getword(__pos) ^= _S_maskbit(__pos); + return *this; + } + + bool _Unchecked_test(size_t __pos) const { + return (_M_getword(__pos) & _S_maskbit(__pos)) != static_cast<_WordT>(0); + } + + // Set, reset, and flip. + + bitset<_Nb,_WordT>& set() { + _M_do_set(); + _M_do_sanitize(); + return *this; + } + + bitset<_Nb,_WordT>& set(size_t __pos) { + if (__pos >= _Nb) + __STL_THROW(out_of_range("bitset")); + + return _Unchecked_set(__pos); + } + + bitset<_Nb,_WordT>& set(size_t __pos, int __val) { + if (__pos >= _Nb) + __STL_THROW(out_of_range("bitset")); + + return _Unchecked_set(__pos, __val); + } + + bitset<_Nb,_WordT>& reset() { + _M_do_reset(); + return *this; + } + + bitset<_Nb,_WordT>& reset(size_t __pos) { + if (__pos >= _Nb) + __STL_THROW(out_of_range("bitset")); + + return _Unchecked_reset(__pos); + } + + bitset<_Nb,_WordT>& flip() { + _M_do_flip(); + _M_do_sanitize(); + return *this; + } + + bitset<_Nb,_WordT>& flip(size_t __pos) { + if (__pos >= _Nb) + __STL_THROW(out_of_range("bitset")); + + return _Unchecked_flip(__pos); + } + + bitset<_Nb,_WordT> operator~() const { + return bitset<_Nb,_WordT>(*this).flip(); + } + + // element access: + //for b[i]; + reference operator[](size_t __pos) { return reference(*this,__pos); } + bool operator[](size_t __pos) const { return _Unchecked_test(__pos); } + + unsigned long to_ulong() const { return _M_do_to_ulong(); } + +#ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS + template + basic_string<_CharT, _Traits, _Alloc> to_string() const { + basic_string<_CharT, _Traits, _Alloc> __result; + _M_copy_to_string(__result); + return __result; + } +#endif /* __STL_EXPLICIT_FUNCTION_TMPL_ARGS */ + + // Helper functions for string operations. + template + void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, + size_t, + size_t); + + // Helper functions for string operations. + template + void _M_copy_to_string(basic_string<_CharT,_Traits,_Alloc>&) const; + + size_t count() const { return _M_do_count(); } + + size_t size() const { return _Nb; } + + bool operator==(const bitset<_Nb,_WordT>& __rhs) const { + return _M_is_equal(__rhs); + } + bool operator!=(const bitset<_Nb,_WordT>& __rhs) const { + return !_M_is_equal(__rhs); + } + + bool test(size_t __pos) const { + if (__pos > _Nb) + __STL_THROW(out_of_range("bitset")); + + return _Unchecked_test(__pos); + } + + bool any() const { return _M_is_any(); } + bool none() const { return !_M_is_any(); } + + bitset<_Nb,_WordT> operator<<(size_t __pos) const + { return bitset<_Nb,_WordT>(*this) <<= __pos; } + bitset<_Nb,_WordT> operator>>(size_t __pos) const + { return bitset<_Nb,_WordT>(*this) >>= __pos; } + + // + // EXTENSIONS: bit-find operations. These operations are + // experimental, and are subject to change or removal in future + // versions. + // + + // find the index of the first "on" bit + size_t _Find_first() const + { return _M_do_find_first(_Nb); } + + // find the index of the next "on" bit after prev + size_t _Find_next( size_t __prev ) const + { return _M_do_find_next(__prev, _Nb); } + +}; + +// +// Definitions of non-inline member functions. +// + +template +template +void bitset<_Nb, _WordT> + ::_M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, + size_t __pos, + size_t __n) +{ + reset(); + const size_t __nbits = min(_Nb, min(__n, __s.size() - __pos)); + for (size_t __i = 0; __i < __nbits; ++__i) { + switch(__s[__pos + __nbits - __i - 1]) { + case '0': + break; + case '1': + set(__i); + break; + default: + __STL_THROW(invalid_argument("bitset")); + } + } +} + +template +template +void bitset<_Nb, _WordT> + ::_M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const +{ + __s.assign(_Nb, '0'); + + for (size_t __i = 0; __i < _Nb; ++__i) + if (_Unchecked_test(__i)) + __s[_Nb - 1 - __i] = '1'; +} + +// ------------------------------------------------------------ + +// +// 23.3.5.3 bitset operations: +// + +template +inline bitset<_Nb,_WordT> operator&(const bitset<_Nb,_WordT>& __x, + const bitset<_Nb,_WordT>& __y) { + bitset<_Nb,_WordT> __result(__x); + __result &= __y; + return __result; +} + + +template +inline bitset<_Nb,_WordT> operator|(const bitset<_Nb,_WordT>& __x, + const bitset<_Nb,_WordT>& __y) { + bitset<_Nb,_WordT> __result(__x); + __result |= __y; + return __result; +} + +template +inline bitset<_Nb,_WordT> operator^(const bitset<_Nb,_WordT>& __x, + const bitset<_Nb,_WordT>& __y) { + bitset<_Nb,_WordT> __result(__x); + __result ^= __y; + return __result; +} + +// NOTE: these must be rewritten once we have templatized iostreams. + +template +istream& +operator>>(istream& __is, bitset<_Nb,_WordT>& __x) { + string __tmp; + __tmp.reserve(_Nb); + + // In new templatized iostreams, use istream::sentry + if (__is.flags() & ios::skipws) { + char __c; + do + __is.get(__c); + while (__is && isspace(__c)); + if (__is) + __is.putback(__c); + } + + for (size_t __i = 0; __i < _Nb; ++__i) { + char __c; + __is.get(__c); + + if (!__is) + break; + else if (__c != '0' && __c != '1') { + __is.putback(__c); + break; + } + else + __tmp.push_back(__c); + } + + if (__tmp.empty()) + __is.clear(__is.rdstate() | ios::failbit); + else + __x._M_copy_from_string(__tmp, static_cast(0), _Nb); + + return __is; +} + +template +ostream& operator<<(ostream& __os, const bitset<_Nb,_WordT>& __x) { + string __tmp; + __x._M_copy_to_string(__tmp); + return __os << __tmp; +} + +// ------------------------------------------------------------ +// Lookup tables for find and count operations. + +template +unsigned char _Bit_count<__dummy>::_S_bit_count[] = { + 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */ + 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */ + 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */ + 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */ + 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */ + 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */ + 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */ + 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */ + 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */ + 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */ + 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */ + 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */ + 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */ + 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */ + 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */ + 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */ + 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */ + 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */ + 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */ + 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */ + 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */ + 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */ + 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */ + 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */ + 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */ + 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */ + 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */ + 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */ + 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */ + 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */ + 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */ + 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */ + 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */ + 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */ + 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */ + 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */ + 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */ + 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */ + 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */ + 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */ + 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */ + 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */ + 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */ + 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */ + 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */ + 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */ + 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */ + 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */ + 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */ + 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */ + 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */ + 8 /* 255 */ +}; // end _Bit_count + +template +unsigned char _First_one<__dummy>::_S_first_one[] = { + 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */ + 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */ + 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */ + 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */ + 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */ + 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */ + 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */ + 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */ + 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */ + 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */ + 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */ + 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */ + 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */ + 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */ + 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */ + 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */ + 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */ + 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */ + 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */ + 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */ + 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */ + 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */ + 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */ + 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */ + 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */ + 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */ + 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */ + 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */ + 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */ + 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */ + 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */ + 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */ + 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */ + 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */ + 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */ + 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */ + 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */ + 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */ + 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */ + 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */ + 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */ + 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */ + 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */ + 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */ + 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */ + 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */ + 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */ + 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */ + 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */ + 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */ + 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */ + 0, /* 255 */ +}; // end _First_one + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1209 +#endif + +__STL_END_NAMESPACE + + +#undef __BITS_PER_WORDT +#undef __BITSET_WORDS + +#endif /* __SGI_STL_BITSET */ + + +// Local Variables: +// mode:C++ +// End: diff --git a/id3lib/include/id3/id3lib_frame.h b/id3lib/include/id3/id3lib_frame.h new file mode 100644 index 0000000..96f59df --- /dev/null +++ b/id3lib/include/id3/id3lib_frame.h @@ -0,0 +1,105 @@ +// -*- C++ -*- +// $Id: id3lib_frame.h,v 1.2 2008/10/07 17:20:10 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_FRAME_H_ +#define _ID3LIB_FRAME_H_ + +#include "id3/globals.h" //has "id3/sized_types.h" + +class ID3_Field; +class ID3_FrameImpl; +class ID3_Reader; +class ID3_Writer; + +class ID3_CPP_EXPORT ID3_Frame +{ + ID3_FrameImpl* _impl; +public: + + class Iterator + { + public: + virtual ID3_Field* GetNext() = 0; + virtual ~Iterator() { } //Klenotic - Added by id3lib-3.8.3-VC8_AddFrame_Crash_Fix patch. + }; + + class ConstIterator + { + public: + virtual const ID3_Field* GetNext() = 0; + virtual ~ConstIterator() { } //Klenotic - Added by id3lib-3.8.3-VC8_AddFrame_Crash_Fix patch. + }; + +public: + ID3_Frame(ID3_FrameID id = ID3FID_NOFRAME); + ID3_Frame(const ID3_Frame&); + + virtual ~ID3_Frame(); + + void Clear(); + + bool SetID(ID3_FrameID id); + ID3_FrameID GetID() const; + + ID3_Field* GetField(ID3_FieldID name) const; + + size_t NumFields() const; + + const char* GetDescription() const; + static const char* GetDescription(ID3_FrameID); + + const char* GetTextID() const; + + ID3_Frame& operator=(const ID3_Frame &); + bool HasChanged() const; + bool Parse(ID3_Reader&); + void Render(ID3_Writer&) const; + size_t Size(); + bool Contains(ID3_FieldID fld) const; + bool SetSpec(ID3_V2Spec); + ID3_V2Spec GetSpec() const; + + bool SetCompression(bool b); + bool GetCompression() const; + size_t GetDataSize() const; + + bool SetEncryptionID(uchar id); + uchar GetEncryptionID() const; + + bool SetGroupingID(uchar id); + uchar GetGroupingID() const; + + Iterator* CreateIterator(); + ConstIterator* CreateIterator() const; + + // Deprecated + ID3_Field& Field(ID3_FieldID name) const; + //ID3_Field* GetFieldNum(size_t) const; +}; + +#endif /* _ID3LIB_FRAME_H_ */ + diff --git a/id3lib/include/id3/id3lib_streams.h b/id3lib/include/id3/id3lib_streams.h new file mode 100644 index 0000000..7ddd156 --- /dev/null +++ b/id3lib/include/id3/id3lib_streams.h @@ -0,0 +1,43 @@ +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 2002 Thijmen Klok + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef STREAMS_H_DEFINE +#define STREAMS_H_DEFINE +#include +#include +#include + +using std::ifstream; +using std::ofstream; +using std::fstream; + +using std::iostream; +using std::ostream; +using std::istream; +using std::ios; + +using std::streamoff; + +#endif // STREAMS_H_DEFINE + diff --git a/id3lib/include/id3/id3lib_strings.h b/id3lib/include/id3/id3lib_strings.h new file mode 100644 index 0000000..768384f --- /dev/null +++ b/id3lib/include/id3/id3lib_strings.h @@ -0,0 +1,203 @@ +// -*- C++ -*- +// $Id: id3lib_strings.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_STRINGS_H_ +#define _ID3LIB_STRINGS_H_ + +#include + +#if (defined(__GNUC__) && (__GNUC__ >= 3) || (defined(_MSC_VER) && _MSC_VER > 1000)) +namespace std +{ + template<> + struct char_traits + { + typedef unsigned char char_type; + // Unsigned as wint_t in unsigned. + typedef unsigned long int_type; + typedef streampos pos_type; + typedef streamoff off_type; + typedef mbstate_t state_type; + + static void + assign(char_type& __c1, const char_type& __c2) + { __c1 = __c2; } + + static bool + eq(const char_type& __c1, const char_type& __c2) + { return __c1 == __c2; } + + static bool + lt(const char_type& __c1, const char_type& __c2) + { return __c1 < __c2; } + + static int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { + for (size_t __i = 0; __i < __n; ++__i) + if (!eq(__s1[__i], __s2[__i])) + return lt(__s1[__i], __s2[__i]) ? -1 : 1; + return 0; + } + + static size_t + length(const char_type* __s) + { + const char_type* __p = __s; + while (__p) + ++__p; + return (__p - __s); + } + + static const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { + for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p) + if (*__p == __a) return __p; + return 0; + } + + static char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); } + + static char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); } + + static char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + for (char_type* __p = __s; __p < __s + __n; ++__p) + assign(*__p, __a); + return __s; + } + + static char_type + to_char_type(const int_type& __c) + { return char_type(); } + + static int_type + to_int_type(const char_type& __c) { return int_type(); } + + static bool + eq_int_type(const int_type& __c1, const int_type& __c2) + { return __c1 == __c2; } + + static int_type + eof() { return static_cast(-1); } + + static int_type + not_eof(const int_type& __c) + { return eq_int_type(__c, eof()) ? int_type(0) : __c; } + }; + +#ifndef _GLIBCPP_USE_WCHAR_T +#if (defined(ID3_NEED_WCHAR_TEMPLATE)) + template<> + struct char_traits + { + typedef wchar_t char_type; + typedef wint_t int_type; + typedef streamoff off_type; + typedef streampos pos_type; + typedef mbstate_t state_type; + + static void + assign(char_type& __c1, const char_type& __c2) + { __c1 = __c2; } + + static bool + eq(const char_type& __c1, const char_type& __c2) + { return __c1 == __c2; } + + static bool + lt(const char_type& __c1, const char_type& __c2) + { return __c1 < __c2; } + + static int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { return wmemcmp(__s1, __s2, __n); } + + static size_t + length(const char_type* __s) + { return wcslen(__s); } + + static const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { return wmemchr(__s, __a, __n); } + + static char_type* + move(char_type* __s1, const char_type* __s2, int_type __n) + { return wmemmove(__s1, __s2, __n); } + + static char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { return wmemcpy(__s1, __s2, __n); } + + static char_type* + assign(char_type* __s, size_t __n, char_type __a) + { return wmemset(__s, __a, __n); } + + static char_type + to_char_type(const int_type& __c) { return char_type(__c); } + + static int_type + to_int_type(const char_type& __c) { return int_type(__c); } + + static bool + eq_int_type(const int_type& __c1, const int_type& __c2) + { return __c1 == __c2; } + + static state_type + _S_get_state(const pos_type& __pos) { return __pos.state(); } + + static int_type + eof() { return static_cast(WEOF); } + + static int_type + _S_eos() { return char_type(); } + + static int_type + not_eof(const int_type& __c) + { return eq_int_type(__c, eof()) ? 0 : __c; } + }; +#endif +#endif +} // namespace std +#endif + +namespace dami +{ + typedef std::basic_string String; + typedef std::basic_string BString; + typedef std::basic_string WString; +}; + +#endif /* _ID3LIB_STRINGS_H_ */ + diff --git a/id3lib/include/id3/io_decorators.h b/id3lib/include/id3/io_decorators.h new file mode 100644 index 0000000..852d26e --- /dev/null +++ b/id3lib/include/id3/io_decorators.h @@ -0,0 +1,218 @@ +// -*- C++ -*- +// $Id: io_decorators.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_READER_DECORATORS_H_ +#define _ID3LIB_READER_DECORATORS_H_ + +#include "readers.h" +#include "io_helpers.h" +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" + +namespace dami +{ + namespace io + { + /** + * Set a window on the buffer. Characters can only be read within this + * window. + */ + class ID3_CPP_EXPORT WindowedReader : public ID3_Reader + { + typedef ID3_Reader SUPER; + + ID3_Reader& _reader; + pos_type _beg, _end; + + bool inWindow(pos_type cur) + { return this->getBeg() <= cur && cur < this->getEnd(); } + + public: + explicit WindowedReader(ID3_Reader& reader) + : _reader(reader), _beg(reader.getBeg()), _end(reader.getEnd()) { ; } + + WindowedReader(ID3_Reader& reader, size_type size) + : _reader(reader), _beg(reader.getBeg()), _end(reader.getEnd()) + { this->setWindow(this->getCur(), size); } + + WindowedReader(ID3_Reader& reader, pos_type beg, size_type size) + : _reader(reader), _beg(reader.getBeg()), _end(reader.getEnd()) + { this->setWindow(beg, size); } + + void setWindow(pos_type beg, size_type size); + + pos_type setBeg(pos_type); + pos_type setCur(pos_type cur) + { + return _reader.setCur(mid(this->getBeg(), cur, this->getEnd())); + } + pos_type setEnd(pos_type); + + pos_type getCur() { return _reader.getCur(); } + pos_type getBeg() { return _beg; } + pos_type getEnd() { return _end; } + + bool inWindow() { return this->inWindow(this->getCur()); } + + int_type readChar(); + int_type peekChar(); + + size_type readChars(char_type buf[], size_type len); + size_type readChars(char buf[], size_type len) + { + return this->readChars((char_type*) buf, len); + } + + void close() { ; } + }; + + class ID3_CPP_EXPORT CharReader : public ID3_Reader + { + typedef ID3_Reader SUPER; + + protected: + ID3_Reader& _reader; + + public: + + CharReader(ID3_Reader& reader) : _reader(reader) { } + virtual ~CharReader() { ; } + + /** + * Read \c len characters into the array \c buf. Since the stream needs + * might have been unsynced, this function copies the characters one at a + * time. + */ + size_type readChars(char_type buf[], size_type len); + size_type readChars(char buf[], size_type len) + { + return this->readChars((char_type*) buf, len); + } + + void close() { ; } + int_type peekChar() { return _reader.peekChar(); } + + pos_type getBeg() { return _reader.getBeg(); } + pos_type getCur() { return _reader.getCur(); } + pos_type getEnd() { return _reader.getEnd(); } + + pos_type setCur(pos_type cur) { return _reader.setCur(cur); } + }; + + + class ID3_CPP_EXPORT LineFeedReader : public CharReader + { + typedef CharReader SUPER; + + public: + LineFeedReader(ID3_Reader& reader) : SUPER(reader) { ; } + int_type readChar(); + }; + + class ID3_CPP_EXPORT UnsyncedReader : public CharReader + { + typedef CharReader SUPER; + + public: + UnsyncedReader(ID3_Reader& reader) : SUPER(reader) { } + int_type readChar(); + }; + + class ID3_CPP_EXPORT CompressedReader : public ID3_MemoryReader + { + char_type* _uncompressed; + public: + CompressedReader(ID3_Reader& reader, size_type newSize); + virtual ~CompressedReader(); + }; + + class ID3_CPP_EXPORT UnsyncedWriter : public ID3_Writer + { + typedef ID3_Writer SUPER; + + ID3_Writer& _writer; + int_type _last; + size_type _numSyncs; + + public: + UnsyncedWriter(ID3_Writer& writer) + : _writer(writer), _last('\0'), _numSyncs(0) + { ; } + + size_type getNumSyncs() const { return _numSyncs; } + int_type writeChar(char_type ch); + void flush(); + + /** + * Write \c len characters into the array \c buf. Since the stream needs + * might have been unsynced, this function copies the characters one at a + * time. + */ + size_type writeChars(const char_type[], size_type len); + size_type writeChars(const char buf[], size_type len) + { + return this->writeChars(reinterpret_cast(buf), len); + } + + void close() { ; } + + pos_type getBeg() { return _writer.getBeg(); } + pos_type getCur() { return _writer.getCur(); } + pos_type getEnd() { return _writer.getEnd(); } + }; + + class CompressedWriter : public ID3_Writer + { + typedef ID3_Writer SUPER; + + ID3_Writer& _writer; + BString _data; + size_type _origSize; + public: + + explicit CompressedWriter(ID3_Writer& writer) + : _writer(writer), _data(), _origSize(0) + { ; } + virtual ~CompressedWriter() { this->flush(); } + + size_type getOrigSize() const { return _origSize; } + + void flush(); + + size_type writeChars(const char_type buf[], size_type len); + size_type writeChars(const char buf[], size_type len) + { + return this->writeChars(reinterpret_cast(buf), len); + } + + pos_type getCur() { return _data.size(); } + void close() { ; } + }; + }; +}; + +#endif /* _ID3LIB_READER_DECORATORS_H_ */ + diff --git a/id3lib/include/id3/io_helpers.h b/id3lib/include/id3/io_helpers.h new file mode 100644 index 0000000..756703a --- /dev/null +++ b/id3lib/include/id3/io_helpers.h @@ -0,0 +1,82 @@ +// -*- C++ -*- +// $Id: io_helpers.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_IO_HELPERS_H_ +#define _ID3LIB_IO_HELPERS_H_ + +#include "id3/id3lib_strings.h" +#include "reader.h" +#include "writer.h" + +namespace dami +{ + namespace io + { + /** + **/ + class ID3_CPP_EXPORT ExitTrigger + { + ID3_Reader& _reader; + ID3_Reader::pos_type _pos; + bool _locked; + public: + ExitTrigger(ID3_Reader& rdr) + : _reader(rdr), _pos(rdr.getCur()), _locked(true) + { ; } + ExitTrigger(ID3_Reader& rdr, ID3_Reader::pos_type pos) + : _reader(rdr), _pos(pos) + { ; } + virtual ~ExitTrigger() { if (_locked) _reader.setCur(_pos); } + + void release() { _locked = false; } + void update() { _pos = _reader.getCur(); } + void setExitPos(ID3_Reader::pos_type pos) { _pos = pos; } + }; + + ID3_C_EXPORT String readString(ID3_Reader&); + ID3_C_EXPORT String readText(ID3_Reader&, size_t); + ID3_C_EXPORT String readUnicodeString(ID3_Reader&); + ID3_C_EXPORT String readUnicodeText(ID3_Reader&, size_t); + ID3_C_EXPORT BString readAllBinary(ID3_Reader&); + ID3_C_EXPORT BString readBinary(ID3_Reader&, size_t); + ID3_C_EXPORT uint32 readLENumber(ID3_Reader&, size_t); + ID3_C_EXPORT uint32 readBENumber(ID3_Reader&, size_t); + ID3_C_EXPORT String readTrailingSpaces(ID3_Reader&, size_t); + ID3_C_EXPORT uint32 readUInt28(ID3_Reader&); + + ID3_C_EXPORT size_t writeString(ID3_Writer&, String); + ID3_C_EXPORT size_t writeText(ID3_Writer&, String); + ID3_C_EXPORT size_t writeUnicodeString(ID3_Writer&, String, bool = true); + ID3_C_EXPORT size_t writeUnicodeText(ID3_Writer&, String, bool = true); + ID3_C_EXPORT size_t writeBENumber(ID3_Writer&, uint32 val, size_t); + ID3_C_EXPORT size_t writeTrailingSpaces(ID3_Writer&, String, size_t); + ID3_C_EXPORT size_t writeUInt28(ID3_Writer&, uint32); + }; +}; + +#endif /* _ID3LIB_IO_HELPERS_H_ */ + diff --git a/id3lib/include/id3/io_strings.h b/id3lib/include/id3/io_strings.h new file mode 100644 index 0000000..fde96e8 --- /dev/null +++ b/id3lib/include/id3/io_strings.h @@ -0,0 +1,238 @@ +// -*- C++ -*- +// $Id: io_strings.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_IO_STRINGS_H_ +#define _ID3LIB_IO_STRINGS_H_ + +#include "id3/id3lib_strings.h" +#include "reader.h" +#include "writer.h" + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +namespace dami +{ + namespace io + { + class ID3_CPP_EXPORT StringReader : public ID3_Reader + { + const String& _string; + pos_type _cur; + public: + StringReader(const String& string) : _string(string), _cur(0) { ; } + virtual ~StringReader() { ; } + + virtual void close() { ; } + virtual int_type peekChar() + { + if (!this->atEnd()) + { + return _string[_cur]; + } + return END_OF_READER; + } + + /** Read up to \c len chars into buf and advance the internal position + ** accordingly. Returns the number of characters read into buf. + **/ + size_type readChars(char buf[], size_type len) + { + return this->readChars((char_type*) buf, len); + } + virtual size_type readChars(char_type buf[], size_type len) + { + size_type size = min((unsigned int)len, (unsigned int)(_string.size() - _cur)); + _string.copy(reinterpret_cast(buf), size, _cur); + _cur += size; + return size; + } + + virtual pos_type getCur() + { + return _cur; + } + + virtual pos_type getBeg() + { + return 0; + } + + virtual pos_type getEnd() + { + return _string.size(); + } + + /** Set the value of the internal position for reading. + **/ + virtual pos_type setCur(pos_type pos) + { + pos_type end = this->getEnd(); + _cur = (pos < end) ? pos : end; + return _cur; + } + + virtual bool atEnd() + { + return _cur >= _string.size(); + } + + virtual size_type skipChars(size_type len) + { + size_type size = min((unsigned int)len, (unsigned int)(_string.size() - _cur)); + _cur += size; + return size; + } + }; + + class ID3_CPP_EXPORT BStringReader : public ID3_Reader + { + const BString& _string; + pos_type _cur; + public: + BStringReader(const BString& string) : _string(string), _cur(0) { ; } + virtual ~BStringReader() { ; } + + virtual void close() { ; } + virtual int_type peekChar() + { + if (!this->atEnd()) + { + return _string[_cur]; + } + return END_OF_READER; + } + + /** Read up to \c len chars into buf and advance the internal position + ** accordingly. Returns the number of characters read into buf. + **/ + size_type readChars(char buf[], size_type len) + { + return this->readChars((char_type*) buf, len); + } + virtual size_type readChars(char_type buf[], size_type len) + { + size_type size = min((unsigned int)len, (unsigned int)(_string.size() - _cur)); + _string.copy(reinterpret_cast(buf), size, _cur); + _cur += size; + return size; + } + + virtual pos_type getCur() + { + return _cur; + } + + virtual pos_type getBeg() + { + return 0; + } + + virtual pos_type getEnd() + { + return _string.size(); + } + + /** Set the value of the internal position for reading. + **/ + virtual pos_type setCur(pos_type pos) + { + pos_type end = this->getEnd(); + _cur = (pos < end) ? pos : end; + return _cur; + } + + virtual bool atEnd() + { + return _cur >= _string.size(); + } + + virtual size_type skipChars(size_type len) + { + size_type size = min((unsigned int)len,(unsigned int)( _string.size() - _cur)); + _cur += size; + return size; + } + }; + + class ID3_CPP_EXPORT StringWriter : public ID3_Writer + { + String& _string; + public: + StringWriter(String& string) : _string(string) { ; } + virtual ~StringWriter() { ; } + + void close() { ; } + void flush() { ; } + virtual size_type writeChars(const char buf[], size_type len) + { + _string.append(reinterpret_cast(buf), len); + return len; + } + size_type writeChars(const char_type buf[], size_type len) + { + _string.append(reinterpret_cast(buf), len); + return len; + } + + pos_type getCur() + { + return _string.size(); + } + }; + + class ID3_CPP_EXPORT BStringWriter : public ID3_Writer + { + BString& _string; + public: + BStringWriter(BString& string) : _string(string) { ; } + virtual ~BStringWriter() { ; } + + void close() { ; } + void flush() { ; } + virtual size_type writeChars(const char buf[], size_type len) + { + _string.append(reinterpret_cast(buf), len); + return len; + } + size_type writeChars(const char_type buf[], size_type len) + { + _string.append(reinterpret_cast(buf), len); + return len; + } + + pos_type getCur() + { + return _string.size(); + } + }; + }; +}; + +#endif /* _ID3LIB_IO_STRINGS_H_ */ + diff --git a/id3lib/include/id3/misc_support.h b/id3lib/include/id3/misc_support.h new file mode 100644 index 0000000..c52a623 --- /dev/null +++ b/id3lib/include/id3/misc_support.h @@ -0,0 +1,137 @@ +// -*- C++ -*- +// $Id: misc_support.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_MISC_SUPPORT_H_ +#define _ID3LIB_MISC_SUPPORT_H_ + +#include + +ID3_C_EXPORT char* ID3_GetString(const ID3_Frame *, ID3_FieldID); +ID3_C_EXPORT char* ID3_GetString(const ID3_Frame *, ID3_FieldID, size_t nItems); + +ID3_C_EXPORT void ID3_FreeString(char *str); + +// defined in 'id3_misc_support.cpp' +// these are 'convenience functions,' to make using the library easier for the +// most common of operations +ID3_C_EXPORT char* ID3_GetArtist(const ID3_Tag*); +ID3_C_EXPORT ID3_Frame* ID3_AddArtist(ID3_Tag*, const char*, bool replace = false); +ID3_C_EXPORT size_t ID3_RemoveArtists(ID3_Tag*); + +ID3_C_EXPORT char* ID3_GetAlbum(const ID3_Tag*); +ID3_C_EXPORT ID3_Frame* ID3_AddAlbum(ID3_Tag*, const char*, bool replace = false); +ID3_C_EXPORT size_t ID3_RemoveAlbums(ID3_Tag*); + +ID3_C_EXPORT char* ID3_GetTitle(const ID3_Tag*); +ID3_C_EXPORT ID3_Frame* ID3_AddTitle(ID3_Tag*, const char*, bool replace = false); +ID3_C_EXPORT size_t ID3_RemoveTitles(ID3_Tag*); + +ID3_C_EXPORT char* ID3_GetYear(const ID3_Tag*); +ID3_C_EXPORT ID3_Frame* ID3_AddYear(ID3_Tag*, const char*, bool replace = false); +ID3_C_EXPORT size_t ID3_RemoveYears(ID3_Tag*); + +ID3_C_EXPORT char* ID3_GetComment(const ID3_Tag*, const char* desc = NULL); +ID3_C_EXPORT ID3_Frame* ID3_AddComment(ID3_Tag*, const char*, bool = false); +ID3_C_EXPORT ID3_Frame* ID3_AddComment(ID3_Tag*, const char*, const char*, bool = false); +ID3_C_EXPORT ID3_Frame* ID3_AddComment(ID3_Tag*, const char*, const char*, const char*, + bool = false); +ID3_C_EXPORT size_t ID3_RemoveComments(ID3_Tag*, const char * = NULL); + +ID3_C_EXPORT char* ID3_GetTrack(const ID3_Tag*); +ID3_C_EXPORT size_t ID3_GetTrackNum(const ID3_Tag*); +//following routine courtesy of John George +ID3_C_EXPORT ID3_Frame* ID3_AddTrack(ID3_Tag*, uchar ucTrack, uchar ucTotal = 0, + bool replace = false); +ID3_C_EXPORT size_t ID3_RemoveTracks(ID3_Tag*); + +ID3_C_EXPORT char* ID3_GetGenre(const ID3_Tag*); +ID3_C_EXPORT size_t ID3_GetGenreNum(const ID3_Tag*); +ID3_C_EXPORT ID3_Frame* ID3_AddGenre(ID3_Tag*, size_t ucGenre, bool replace = false); +//following routine courtesy of John George +ID3_C_EXPORT ID3_Frame* ID3_AddGenre(ID3_Tag*, const char *, bool replace = false); +ID3_C_EXPORT size_t ID3_RemoveGenres(ID3_Tag*); + +ID3_C_EXPORT char* ID3_GetLyrics(const ID3_Tag*); +ID3_C_EXPORT ID3_Frame* ID3_AddLyrics(ID3_Tag*, const char*, bool = false); +ID3_C_EXPORT ID3_Frame* ID3_AddLyrics(ID3_Tag*, const char*, const char*, bool = false); +ID3_C_EXPORT ID3_Frame* ID3_AddLyrics(ID3_Tag*, const char*, const char*, const char*, + bool = false); +ID3_C_EXPORT size_t ID3_RemoveLyrics(ID3_Tag*); + +ID3_C_EXPORT char* ID3_GetLyricist(const ID3_Tag*); +ID3_C_EXPORT ID3_Frame* ID3_AddLyricist(ID3_Tag *, const char *, bool replace = false); +ID3_C_EXPORT size_t ID3_RemoveLyricist(ID3_Tag*); + +ID3_C_EXPORT ID3_Frame* ID3_AddSyncLyrics(ID3_Tag*, const uchar*, size_t, + ID3_TimeStampFormat, bool = false); +ID3_C_EXPORT ID3_Frame* ID3_AddSyncLyrics(ID3_Tag*, const uchar*, size_t, + ID3_TimeStampFormat, const char *, bool = false); +ID3_C_EXPORT ID3_Frame* ID3_AddSyncLyrics(ID3_Tag*, const uchar*, size_t, + ID3_TimeStampFormat, const char *, const char *, + bool = false); +ID3_C_EXPORT ID3_Frame* ID3_AddSyncLyrics(ID3_Tag*, const uchar*, size_t, + ID3_TimeStampFormat, const char *, const char *, + ID3_ContentType, bool = false); +ID3_C_EXPORT ID3_Frame* ID3_GetSyncLyricsInfo(const ID3_Tag *tag, const char *lang, + const char *desc, char &stampformat, + char &type, size_t &size); +ID3_C_EXPORT ID3_Frame* ID3_GetSyncLyrics(const ID3_Tag* tag, const char* lang, + const char* desc, const uchar* &pData, size_t& size); + + +//following routine courtesy of John George +ID3_C_EXPORT int ID3_GetPictureData(const ID3_Tag*, const char* TempPicPath); + +//following routine courtesy of John George +ID3_C_EXPORT char* ID3_GetPictureMimeType(const ID3_Tag*); + +//following routine courtesy of John George +ID3_C_EXPORT bool ID3_HasPicture(const ID3_Tag*); + +//following two routines courtesy of John George +ID3_C_EXPORT ID3_Frame* ID3_AddPicture(ID3_Tag*, const char* TempPicPath, const char* MimeType, bool replace = false); +ID3_C_EXPORT ID3_Frame* ID3_AddPicture(ID3_Tag*, const char* TempPicPath, const char* MimeType, ID3_PictureType pictype, const char* Description, bool replace = false); + +//following routine courtesy of John George +ID3_C_EXPORT size_t ID3_RemovePictures(ID3_Tag*); + +//following routine courtesy of John George +ID3_C_EXPORT size_t ID3_GetPictureDataOfPicType(ID3_Tag*, const char* TempPicPath, ID3_PictureType pictype); + +//following routine courtesy of John George +ID3_C_EXPORT char *ID3_GetMimeTypeOfPicType(ID3_Tag*, ID3_PictureType pictype); + +//following routine courtesy of John George +ID3_C_EXPORT char *ID3_GetDescriptionOfPicType(ID3_Tag*, ID3_PictureType pictype); + +//following routine courtesy of John George +ID3_C_EXPORT size_t ID3_RemovePictureType(ID3_Tag*, ID3_PictureType pictype); + + +#endif /* _ID3LIB_MISC_SUPPORT_H_ */ + diff --git a/id3lib/include/id3/reader.h b/id3lib/include/id3/reader.h new file mode 100644 index 0000000..17b135b --- /dev/null +++ b/id3lib/include/id3/reader.h @@ -0,0 +1,131 @@ +// -*- C++ -*- +// $Id: reader.h,v 1.2 2008/10/07 17:20:10 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_READER_H_ +#define _ID3LIB_READER_H_ + +#include "id3/globals.h" //has "id3/sized_types.h" + +class ID3_CPP_EXPORT ID3_Reader +{ + public: + // typedef uint32 size_type; + typedef size_t size_type; // netfinity: 64bit safe! + typedef uint8 char_type; +// typedef uint32 pos_type; + typedef size_t pos_type; // netfinity: 64bit safe! + typedef int32 off_type; + typedef int16 int_type; + static const int_type END_OF_READER; + + /** Close the reader. Any further actions on the reader should fail. + **/ + virtual void close() = 0; + + /** Return the beginning position in the reader */ + virtual pos_type getBeg() { return static_cast(0); } + + /** Return the ending position in the reader */ + virtual pos_type getEnd() { return static_cast(-1); } + + /** Return the current position in the reader */ + virtual pos_type getCur() = 0; + + /** Set the value of the current position for reading. + **/ + virtual pos_type setCur(pos_type pos) = 0; + + /** + ** Read a single character and advance the internal position. Note that the + ** interal position may advance more than one byte for a single character + ** read. Returns END_OF_READER if there isn't a character to read. + **/ + virtual int_type readChar() + { + if (this->atEnd()) + { + return END_OF_READER; + } + char_type ch; + this->readChars(&ch, 1); + return ch; + } + + /** + ** Return the next character to be read without advancing the internal + ** position. Returns END_OF_READER if there isn't a character to read. + **/ + virtual int_type peekChar() = 0; + + /** Read up to \c len characters into buf and advance the internal position + ** accordingly. Returns the number of characters read into buf. Note that + ** the value returned may be less than the number of bytes that the internal + ** position advances, due to multi-byte characters. + **/ + virtual size_type readChars(char_type buf[], size_type len) = 0; + virtual size_type readChars(char buf[], size_type len) + { + return this->readChars(reinterpret_cast(buf), len); + } + + /** Skip up to \c len chars in the stream and advance the internal position + ** accordingly. Returns the number of characters actually skipped (may be + ** less than requested). + **/ + virtual size_type skipChars(size_type len) + { + const size_type SIZE = 1024; + char_type bytes[SIZE]; + size_type remaining = len; + while (!this->atEnd() && remaining > 0) + { + remaining -= this->readChars(bytes, (remaining < SIZE ? remaining : SIZE)); + } + return len - remaining; + } + + virtual size_type remainingBytes() + { + pos_type end = this->getEnd(), cur = this->getCur(); + if (end == pos_type(-1)) + { + return size_type(-1); + } + + if (end >= cur) + { + return end - cur; + } + + return 0; + } + + virtual bool atEnd() { return this->getCur() >= this->getEnd(); } +}; + +#endif /* _ID3LIB_READER_H_ */ + diff --git a/id3lib/include/id3/readers.h b/id3lib/include/id3/readers.h new file mode 100644 index 0000000..ca50dd7 --- /dev/null +++ b/id3lib/include/id3/readers.h @@ -0,0 +1,161 @@ +// -*- C++ -*- +// $Id: readers.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_READERS_H_ +#define _ID3LIB_READERS_H_ + +#include "id3/id3lib_streams.h" +#include "id3/reader.h" + +class ID3_CPP_EXPORT ID3_IStreamReader : public ID3_Reader +{ + istream& _stream; + protected: + istream& getReader() const { return _stream; } + public: + ID3_IStreamReader(istream& reader) : _stream(reader) { ; } + virtual ~ID3_IStreamReader() { ; } + virtual void close() { ; } + + virtual int_type peekChar() { return _stream.peek(); } + + /** Read up to \c len chars into buf and advance the internal position + ** accordingly. Returns the number of characters read into buf. + **/ + virtual size_type readChars(char buf[], size_type len) + { + return this->readChars(reinterpret_cast(buf), len); + } + virtual size_type readChars(char_type buf[], size_type len) + { + _stream.read((char *)buf, len); + return _stream.gcount(); + } + + virtual pos_type getBeg() { return 0; } + virtual pos_type getCur() { return _stream.tellg(); } + virtual pos_type getEnd() + { + pos_type cur = this->getCur(); + _stream.seekg(0, ios::end); + pos_type end = this->getCur(); + this->setCur(cur); + return end; + } + + /** Set the value of the internal position for reading. + **/ + virtual pos_type setCur(pos_type pos) { _stream.seekg(pos); return pos; } +}; + +class ID3_CPP_EXPORT ID3_IFStreamReader : public ID3_IStreamReader +{ + ifstream& _file; + public: + ID3_IFStreamReader(ifstream& reader) + : ID3_IStreamReader(reader), _file(reader) { ; } + + virtual void close() + { + _file.close(); + } +}; + +class ID3_CPP_EXPORT ID3_MemoryReader : public ID3_Reader +{ + const char_type* _beg; + const char_type* _cur; + const char_type* _end; + protected: + void setBuffer(const char_type* buf, size_type size) + { + _beg = buf; + _cur = buf; + _end = buf + size; + }; + public: + ID3_MemoryReader() + { + this->setBuffer(NULL, 0); + } + ID3_MemoryReader(const char_type* buf, size_type size) + { + this->setBuffer(buf, size); + }; + ID3_MemoryReader(const char* buf, size_type size) + { + this->setBuffer(reinterpret_cast(buf), size); + }; + virtual ~ID3_MemoryReader() { ; } + virtual void close() { ; } + + virtual int_type peekChar() + { + if (!this->atEnd()) + { + return *_cur; + } + return END_OF_READER; + } + + /** Read up to \c len chars into buf and advance the internal position + ** accordingly. Returns the number of characters read into buf. + **/ + virtual size_type readChars(char buf[], size_type len) + { + return this->readChars(reinterpret_cast(buf), len); + } + virtual size_type readChars(char_type buf[], size_type len); + + virtual pos_type getCur() + { + return _cur - _beg; + } + + virtual pos_type getBeg() + { + return _beg - _beg; + } + + virtual pos_type getEnd() + { + return _end - _beg; + } + + /** Set the value of the internal position for reading. + **/ + virtual pos_type setCur(pos_type pos) + { + pos_type end = this->getEnd(); + size_type size = (pos < end) ? pos : end; + _cur = _beg + size; + return this->getCur(); + } +}; + +#endif /* _ID3LIB_READERS_H_ */ + diff --git a/id3lib/include/id3/sized_types.h b/id3lib/include/id3/sized_types.h new file mode 100644 index 0000000..c65f5b5 --- /dev/null +++ b/id3lib/include/id3/sized_types.h @@ -0,0 +1,87 @@ +// -*- C++ -*- +/* $Id: sized_types.h,v 1.2 2007/06/02 20:17:23 pindakaasmod Exp $ + + * id3lib: a C++ library for creating and manipulating id3v1/v2 tags Copyright + * 1999, 2000 Scott Thomas Haug + + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + * License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + * The id3lib authors encourage improvements and optimisations to be sent to + * the id3lib coordinator. Please see the README file for details on where to + * send such submissions. See the AUTHORS file for a list of people who have + * contributed to id3lib. See the ChangeLog file for a list of changes to + * id3lib. These files are distributed with id3lib at + * http://download.sourceforge.net/id3lib/ + */ + +/** + ** This file defines size-specific typedefs based on the macros defined in + ** limits.h + **/ + +#ifndef _SIZED_TYPES_H_ +#define _SIZED_TYPES_H_ + +#include + +/* define our datatypes */ + +/* Define 8-bit types */ +#if UCHAR_MAX == 0xff + +typedef unsigned char uint8; +typedef signed char int8; + +#else +#error This machine has no 8-bit type; report compiler, and the contents of your limits.h to the persons in the AUTHORS file +#endif /* UCHAR_MAX == 0xff */ + +/* Define 16-bit types */ +#if UINT_MAX == 0xffff + +typedef unsigned int uint16; +typedef int int16; + +#elif USHRT_MAX == 0xffff + +typedef unsigned short uint16; +typedef short int16; + +#else +#error This machine has no 16-bit type; report compiler, and the contents of your limits.h to the persons in the AUTHORS file +#endif /* UINT_MAX == 0xffff */ + +/* Define 32-bit types */ +#if UINT_MAX == 0xfffffffful + +typedef unsigned int uint32; +typedef int int32; + +#elif ULONG_MAX == 0xfffffffful + +typedef unsigned long uint32; +typedef long int32; + +#elif USHRT_MAX == 0xfffffffful + +typedef unsigned short uint32; +typedef short int32; + +#else +#error This machine has no 32-bit type; report compiler, and the contents of your limits.h to the persons in the AUTHORS file +#endif /* UINT_MAX == 0xfffffffful */ + +#endif /* _SIZED_TYPES_H_ */ + diff --git a/id3lib/include/id3/tag.h b/id3lib/include/id3/tag.h new file mode 100644 index 0000000..1aa6528 --- /dev/null +++ b/id3lib/include/id3/tag.h @@ -0,0 +1,143 @@ +// -*- C++ -*- +// $Id: tag.h,v 1.2 2008/10/07 17:20:10 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_TAG_H_ +#define _ID3LIB_TAG_H_ + +#include +#include +#include //for ID3_PATH_LENGTH + +class ID3_Reader; +class ID3_Writer; +class ID3_TagImpl; +class ID3_Tag; + +class ID3_CPP_EXPORT ID3_Tag +{ + ID3_TagImpl* _impl; + char _tmp_filename[ID3_PATH_LENGTH]; +public: + + class Iterator + { + public: + virtual ID3_Frame* GetNext() = 0; + virtual ~Iterator() { } //Klenotic - Added by id3lib-3.8.3-VC8_AddFrame_Crash_Fix patch. + }; + + class ConstIterator + { + public: + virtual const ID3_Frame* GetNext() = 0; + virtual ~ConstIterator() { } //Klenotic - Added by id3lib-3.8.3-VC8_AddFrame_Crash_Fix patch. + }; + +public: + + ID3_Tag(const char *name = NULL); + ID3_Tag(const ID3_Tag &tag); + virtual ~ID3_Tag(); + + void Clear(); + bool HasChanged() const; + size_t Size() const; + + bool SetUnsync(bool); + bool SetExtendedHeader(bool); + bool SetExperimental(bool); + + bool GetUnsync() const; + bool GetExtendedHeader() const; + bool GetExperimental() const; + + bool SetPadding(bool); + + void AddFrame(const ID3_Frame&); + void AddFrame(const ID3_Frame*); + bool AttachFrame(ID3_Frame*); + ID3_Frame* RemoveFrame(const ID3_Frame *); + + size_t Parse(const uchar*, size_t); + bool Parse(ID3_Reader& reader); + size_t Render(uchar*, ID3_TagType = ID3TT_ID3V2) const; + size_t Render(ID3_Writer&, ID3_TagType = ID3TT_ID3V2) const; + + size_t Link(const char *fileInfo, flags_t = (flags_t) ID3TT_ALL); + size_t Link(ID3_Reader &reader, flags_t = (flags_t) ID3TT_ALL); + flags_t Update(flags_t = (flags_t) ID3TT_ALL); + flags_t Strip(flags_t = (flags_t) ID3TT_ALL); + + size_t GetPrependedBytes() const; + size_t GetAppendedBytes() const; + size_t GetFileSize() const; + const char* GetFileName() const; + + ID3_Frame* Find(ID3_FrameID) const; + ID3_Frame* Find(ID3_FrameID, ID3_FieldID, uint32) const; + ID3_Frame* Find(ID3_FrameID, ID3_FieldID, const char*) const; + ID3_Frame* Find(ID3_FrameID, ID3_FieldID, const unicode_t*) const; + + size_t NumFrames() const; + + const Mp3_Headerinfo* GetMp3HeaderInfo() const; + + Iterator* CreateIterator(); + ConstIterator* CreateIterator() const; + + ID3_Tag& operator=( const ID3_Tag & ); + + bool HasTagType(ID3_TagType tt) const; + ID3_V2Spec GetSpec() const; + bool SetSpec(ID3_V2Spec); + + static size_t IsV2Tag(const uchar*); + static size_t IsV2Tag(ID3_Reader&); + + /* Deprecated! */ + void AddNewFrame(ID3_Frame* f); + size_t Link(const char *fileInfo, bool parseID3v1, bool parseLyrics3); + void SetCompression(bool); + void AddFrames(const ID3_Frame *, size_t); + bool HasLyrics() const; + bool HasV2Tag() const; + bool HasV1Tag() const; + size_t Parse(const uchar header[ID3_TAGHEADERSIZE], const uchar *buffer); + //ID3_Frame* operator[](size_t) const; + //ID3_Frame* GetFrameNum(size_t) const; + + ID3_Tag& operator<<(const ID3_Frame &); + ID3_Tag& operator<<(const ID3_Frame *); +}; + +// deprecated! +off_t ID3_C_EXPORT ID3_IsTagHeader(const uchar header[ID3_TAGHEADERSIZE]); + + +#endif /* _ID3LIB_TAG_H_ */ + diff --git a/id3lib/include/id3/utils.h b/id3lib/include/id3/utils.h new file mode 100644 index 0000000..5775cdc --- /dev/null +++ b/id3lib/include/id3/utils.h @@ -0,0 +1,103 @@ +// -*- C++ -*- +// $Id: utils.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_UTILS_H_ +#define _ID3LIB_UTILS_H_ + +#if defined HAVE_CONFIG_H +#include +#endif + +#include "id3/id3lib_streams.h" +#include "id3/globals.h" //has "id3/sized_types.h" +#include "id3/id3lib_strings.h" + +namespace dami +{ +#ifdef MAXPATHLEN +# define ID3_PATH_LENGTH (MAXPATHLEN + 1) +#elif defined (PATH_MAX) +# define ID3_PATH_LENGTH (PATH_MAX + 1) +#else /* !MAXPATHLEN */ +# define ID3_PATH_LENGTH (2048 + 1) +#endif /* !MAXPATHLEN && !PATH_MAX */ + +#ifndef min + template + const T& min(const T& a, const T& b) + { + return (a < b) ? a : b; + } +#endif + +#ifndef max + template + const T& max(const T& a, const T& b) + { + return (b < a) ? a : b; + } +#endif + +#ifndef mid + template + const T& mid(const T& lo, const T& mid, const T& hi) + { + return max(lo, min(mid, hi)); + } +#endif + +#ifndef abs + template + T abs(const T& a) + { + return (a < T(0)) ? -a : a; + } +#endif + + size_t ID3_C_EXPORT renderNumber(uchar *buffer, uint32 val, size_t size = sizeof(uint32)); + String ID3_C_EXPORT renderNumber(uint32 val, size_t size = sizeof(uint32)); + + String ID3_C_EXPORT toString(uint32 val); + WString ID3_C_EXPORT toWString(const unicode_t[], size_t); + + size_t ID3_C_EXPORT ucslen(const unicode_t *unicode); + String ID3_C_EXPORT convert(String data, ID3_TextEnc, ID3_TextEnc); + + // file utils + size_t ID3_C_EXPORT getFileSize(fstream&); + size_t ID3_C_EXPORT getFileSize(ifstream&); + size_t ID3_C_EXPORT getFileSize(ofstream&); + ID3_Err ID3_C_EXPORT createFile(String, fstream&); + ID3_Err ID3_C_EXPORT openWritableFile(String, fstream&); + ID3_Err ID3_C_EXPORT openWritableFile(String, ofstream&); + ID3_Err ID3_C_EXPORT openReadableFile(String, fstream&); + ID3_Err ID3_C_EXPORT openReadableFile(String, ifstream&); + +}; + +#endif /* _ID3LIB_UTILS_H_ */ + diff --git a/id3lib/include/id3/writer.h b/id3lib/include/id3/writer.h new file mode 100644 index 0000000..d5f5a39 --- /dev/null +++ b/id3lib/include/id3/writer.h @@ -0,0 +1,101 @@ +// -*- C++ -*- +// $Id: writer.h,v 1.2 2008/10/07 17:20:10 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_WRITER_H_ +#define _ID3LIB_WRITER_H_ + +#include "id3/globals.h" //has "id3/sized_types.h" + +class ID3_CPP_EXPORT ID3_Writer +{ + public: +// typedef uint32 size_type; + typedef size_t size_type; // netfinity: 64bit safe! + typedef uint8 char_type; +// typedef uint32 pos_type; + typedef size_t pos_type; // netfinity: 64bit safe! + typedef int32 off_type; + typedef int16 int_type; + static const int_type END_OF_WRITER; + + /** Close the writer. Any further actions on the writer should fail. **/ + virtual void close() = 0; + + /** Flush the writer. **/ + virtual void flush() = 0; + + /** Return the beginning position in the writer **/ + virtual pos_type getBeg() { return static_cast(0); } + + /** Return the first position that can't be written to. A return value of + ** -1 indicates no (reasonable) limit to the writer. + **/ + virtual pos_type getEnd() { return static_cast(-1); } + + /** Return the next position that will be written to */ + virtual pos_type getCur() = 0; + + /** Return the number of bytes written **/ + virtual size_type getSize() { return this->getCur() - this->getBeg(); } + + /** Return the maximum number of bytes that can be written **/ + virtual size_type getMaxSize() { return this->getEnd() - this->getBeg(); } + + /** Write a single character and advance the internal position. Note that + ** the interal position may advance more than one byte for a single + ** character write. Returns END_OF_WRITER if there isn't a character to + ** write. + **/ + virtual int_type writeChar(char_type ch) + { + if (this->atEnd()) + { + return END_OF_WRITER; + } + this->writeChars(&ch, 1); + return ch; + } + + /** Write up to \c len characters into buf and advance the internal position + ** accordingly. Returns the number of characters write into buf. Note that + ** the value returned may be less than the number of bytes that the internal + ** position advances, due to multi-byte characters. + **/ + virtual size_type writeChars(const char_type buf[], size_type len) = 0; + virtual size_type writeChars(const char buf[], size_type len) + { + return this->writeChars(reinterpret_cast(buf), len); + } + + virtual bool atEnd() + { + return this->getCur() >= this->getEnd(); + } +}; + +#endif /* _ID3LIB_WRITER_H_ */ + diff --git a/id3lib/include/id3/writers.h b/id3lib/include/id3/writers.h new file mode 100644 index 0000000..063938a --- /dev/null +++ b/id3lib/include/id3/writers.h @@ -0,0 +1,193 @@ +// -*- C++ -*- +// $Id: writers.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_WRITERS_H_ +#define _ID3LIB_WRITERS_H_ + +#include "id3/writer.h" +#include "id3/id3lib_streams.h" +//#include + +class ID3_CPP_EXPORT ID3_OStreamWriter : public ID3_Writer +{ + ostream& _stream; + pos_type _beg; + protected: + ostream& getWriter() const { return _stream; } + public: + ID3_OStreamWriter(ostream& writer) : _stream(writer), _beg(_stream.tellp()) { ; } + virtual ~ID3_OStreamWriter() { ; } + + virtual void close() { ; } + virtual void flush() { _stream.flush(); } + + virtual int_type writeChar(char_type ch) + { + _stream.put(ch); + return ch; + } + + /** Write up to \c len chars into buf and advance the internal position + ** accordingly. Returns the number of characters write into buf. + **/ + virtual size_type writeChars(const char buf[], size_type len) + { + _stream.write(buf, len); + return len; + } + virtual size_type writeChars(const char_type buf[], size_type len) + { + _stream.write(reinterpret_cast(buf), len); + return len; + } + + virtual pos_type getBeg() { return _beg; } + virtual pos_type getCur() { return _stream.tellp(); } +}; + +class ID3_CPP_EXPORT ID3_OFStreamWriter : public ID3_OStreamWriter +{ + ofstream& _file; + public: + ID3_OFStreamWriter(ofstream& writer) + : ID3_OStreamWriter(writer), _file(writer) { ; } + + virtual void close() + { + _file.close(); + } +}; + +class ID3_CPP_EXPORT ID3_IOStreamWriter : public ID3_Writer +{ + iostream& _stream; + pos_type _beg; + protected: + iostream& getWriter() const { return _stream; } + public: + ID3_IOStreamWriter(iostream& writer) : _stream(writer), _beg(_stream.tellp()) { ; } + virtual ~ID3_IOStreamWriter() { ; } + + virtual void close() { ; } + virtual void flush() { _stream.flush(); } + + virtual int_type writeChar(char_type ch) + { + _stream.put(ch); + return ch; + } + + /** Write up to \c len chars into buf and advance the internal position + ** accordingly. Returns the number of characters write into buf. + **/ + virtual size_type writeChars(const char buf[], size_type len) + { + _stream.write(buf, len); + return len; + } + virtual size_type writeChars(const char_type buf[], size_type len) + { + _stream.write(reinterpret_cast(buf), len); + return len; + } + + virtual pos_type getBeg() { return _beg; } + virtual pos_type getCur() { return _stream.tellp(); } +}; + +class ID3_CPP_EXPORT ID3_FStreamWriter : public ID3_IOStreamWriter +{ + fstream& _file; + public: + ID3_FStreamWriter(fstream& writer) + : ID3_IOStreamWriter(writer), _file(writer) { ; } + + virtual void close() + { + _file.close(); + } +}; + +class ID3_CPP_EXPORT ID3_MemoryWriter : public ID3_Writer +{ + const char_type* _beg; + /* */ char_type* _cur; + const char_type* _end; + protected: + void setBuffer(char_type* buf, size_t size) + { + _beg = buf; + _cur = buf; + _end = buf + size; + }; + public: + ID3_MemoryWriter() + { + this->setBuffer(NULL, 0); + } + ID3_MemoryWriter(char_type buf[], size_t size) + { + this->setBuffer(buf, size); + } + virtual ~ID3_MemoryWriter() { ; } + virtual void close() { ; } + virtual void flush() { ; } + + /** Write up to \c len chars from buf and advance the internal position + ** accordingly. Returns the number of characters written from buf. + **/ + virtual size_type writeChars(const char buf[], size_type len) + { + return this->writeChars(reinterpret_cast(buf), len); + } + virtual size_type writeChars(const char_type buf[], size_type len) + { + size_type remaining = _end - _cur; + size_type size = (remaining > len) ? len : remaining; + ::memcpy(_cur, buf, size); + _cur += size; + return size; + } + + virtual pos_type getCur() + { + return _cur - _beg; + } + + virtual pos_type getBeg() + { + return _beg - _beg; + } + + virtual pos_type getEnd() + { + return _end - _beg; + } +}; + +#endif /* _ID3LIB_WRITERS_H_ */ + diff --git a/id3lib/install-sh b/id3lib/install-sh new file mode 100644 index 0000000..e9de238 --- /dev/null +++ b/id3lib/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/id3lib/libprj/Makefile.am b/id3lib/libprj/Makefile.am new file mode 100644 index 0000000..fedb7b4 --- /dev/null +++ b/id3lib/libprj/Makefile.am @@ -0,0 +1,14 @@ +# Copyright 2000 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +EXTRA_DIST = id3lib.dsp id3lib.dsw id3lib.mcp win32.readme.first.txt + + diff --git a/id3lib/libprj/Makefile.in b/id3lib/libprj/Makefile.in new file mode 100644 index 0000000..384e254 --- /dev/null +++ b/id3lib/libprj/Makefile.in @@ -0,0 +1,250 @@ +# Makefile.in generated by automake 1.6.2 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2000 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOX_DIR_HTML = @DOX_DIR_HTML@ +DOX_DIR_LATEX = @DOX_DIR_LATEX@ +DOX_DIR_MAN = @DOX_DIR_MAN@ +DOX_DIR_RTF = @DOX_DIR_RTF@ +ECHO = @ECHO@ +ID3LIB_BINARY_AGE = @ID3LIB_BINARY_AGE@ +ID3LIB_DEBUG_FLAGS = @ID3LIB_DEBUG_FLAGS@ +ID3LIB_FULLNAME = @ID3LIB_FULLNAME@ +ID3LIB_INTERFACE_AGE = @ID3LIB_INTERFACE_AGE@ +ID3LIB_MAJOR_VERSION = @ID3LIB_MAJOR_VERSION@ +ID3LIB_MINOR_VERSION = @ID3LIB_MINOR_VERSION@ +ID3LIB_NAME = @ID3LIB_NAME@ +ID3LIB_PATCH_VERSION = @ID3LIB_PATCH_VERSION@ +ID3LIB_VERSION = @ID3LIB_VERSION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +cxxflags_set = @cxxflags_set@ +install_sh = @install_sh@ + +EXTRA_DIST = id3lib.dsp id3lib.dsw id3lib.mcp win32.readme.first.txt +subdir = libprj +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu libprj/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/id3lib/libprj/id3lib.dsp b/id3lib/libprj/id3lib.dsp new file mode 100644 index 0000000..67fb3e8 --- /dev/null +++ b/id3lib/libprj/id3lib.dsp @@ -0,0 +1,348 @@ +# Microsoft Developer Studio Project File - Name="id3lib" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=id3lib - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "id3lib.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "id3lib.mak" CFG="id3lib - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "id3lib - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "id3lib - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "Desktop" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "id3lib - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D ID3LIB_LINKOPTION=1 /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I ".\\" /I "..\\" /I "..\include" /I "..\include\id3" /I "..\zlib\include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "HAVE_CONFIG_H" /D ID3LIB_LINKOPTION=1 /YX /FD /c +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:".\id3lib.lib" + +!ELSEIF "$(CFG)" == "id3lib - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D ID3LIB_LINKOPTION=1 /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".\\" /I "..\\" /I "..\include" /I "..\include\id3" /I "..\zlib\include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "HAVE_CONFIG_H" /D ID3LIB_LINKOPTION=1 /FR /YX /FD /GZ /c +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:".\id3libD.lib" + +!ENDIF + +# Begin Target + +# Name "id3lib - Win32 Release" +# Name "id3lib - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\src\c_wrapper.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\field.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\field_binary.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\field_integer.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\field_string_ascii.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\field_string_unicode.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\frame.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\frame_impl.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\frame_parse.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\frame_render.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\globals.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\header.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\header_frame.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\header_tag.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\helpers.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\io.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\io_decorators.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\io_helpers.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\misc_support.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\mp3_parse.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\readers.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\spec.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\tag.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\tag_file.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\tag_find.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\tag_impl.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\tag_parse.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\tag_parse_lyrics3.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\tag_parse_musicmatch.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\tag_parse_v1.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\tag_render.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\utils.cpp +# End Source File +# Begin Source File + +SOURCE=..\src\writers.cpp +# End Source File +# End Group +# Begin Group "Include Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\config.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\field.h +# End Source File +# Begin Source File + +SOURCE=..\src\field_def.h +# End Source File +# Begin Source File + +SOURCE=..\src\field_impl.h +# End Source File +# Begin Source File + +SOURCE=..\src\flags.h +# End Source File +# Begin Source File + +SOURCE=..\src\frame_def.h +# End Source File +# Begin Source File + +SOURCE=..\src\frame_impl.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\globals.h +# End Source File +# Begin Source File + +SOURCE=..\src\header.h +# End Source File +# Begin Source File + +SOURCE=..\src\header_frame.h +# End Source File +# Begin Source File + +SOURCE=..\src\header_tag.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\helpers.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\id3lib_frame.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\id3lib_streams.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\id3lib_strings.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\io_decorators.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\io_helpers.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\io_strings.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\misc_support.h +# End Source File +# Begin Source File + +SOURCE=..\src\mp3_header.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\reader.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\readers.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\sized_types.h +# End Source File +# Begin Source File + +SOURCE=..\src\spec.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\tag.h +# End Source File +# Begin Source File + +SOURCE=..\src\tag_impl.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\utils.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\writer.h +# End Source File +# Begin Source File + +SOURCE=..\include\id3\writers.h +# End Source File +# Begin Source File + +SOURCE=..\Zlib\Include\Zlib.h +# End Source File +# End Group +# End Target +# End Project diff --git a/id3lib/libprj/id3lib.dsw b/id3lib/libprj/id3lib.dsw new file mode 100644 index 0000000..056949c --- /dev/null +++ b/id3lib/libprj/id3lib.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELSCHT WERDEN! + +############################################################################### + +Project: "id3lib"=.\id3lib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "zlib"=..\zlib\prj\zlib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/id3lib/libprj/id3lib.mcp b/id3lib/libprj/id3lib.mcp new file mode 100644 index 0000000..7866696 Binary files /dev/null and b/id3lib/libprj/id3lib.mcp differ diff --git a/id3lib/libprj/id3lib.sln b/id3lib/libprj/id3lib.sln new file mode 100644 index 0000000..1441aea --- /dev/null +++ b/id3lib/libprj/id3lib.sln @@ -0,0 +1,23 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "id3lib", "id3lib.vcproj", "{4AACBF8D-B90F-41AD-A5BE-D5E557C668E3}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {4AACBF8D-B90F-41AD-A5BE-D5E557C668E3}.Debug.ActiveCfg = Debug|Win32 + {4AACBF8D-B90F-41AD-A5BE-D5E557C668E3}.Debug.Build.0 = Debug|Win32 + {4AACBF8D-B90F-41AD-A5BE-D5E557C668E3}.Release.ActiveCfg = Release|Win32 + {4AACBF8D-B90F-41AD-A5BE-D5E557C668E3}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/id3lib/libprj/id3lib.vcproj b/id3lib/libprj/id3lib.vcproj new file mode 100644 index 0000000..2f9b43f --- /dev/null +++ b/id3lib/libprj/id3lib.vcproj @@ -0,0 +1,326 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/id3lib/libprj/win32.readme.first.txt b/id3lib/libprj/win32.readme.first.txt new file mode 100644 index 0000000..584c0b0 --- /dev/null +++ b/id3lib/libprj/win32.readme.first.txt @@ -0,0 +1,75 @@ +Compiling on win32: + +So far, it has only been confirmed it compiles on visual C 6.0 (service pack 5), +but if you got it working on Borland or other compilers, drop me a mail, or better, add a patch +here: http://sourceforge.net/tracker/?group_id=979&atid=300979 with the (e.g.) borland project files. + +These are the directories you'll be needing: +id3lib/prj +id3lib/libprj +id3lib/id3com + +The first one (id3lib/prj) creates the standard dll (no COM interface) +The Second one (id3lib/libprj) creates the .lib file for static linking. +And the third one (id3lib/id3com) creates a dll with com interface. A Visual basic demo using it is included. + +Before you compile, you'll need to rename id3lib/config.h.win32 to id3lib/config.h + +The third one is not too much tested, it was created outside this project but +it doesn't seem to be maintained anymore. I've included it as a service. +The original location is http://sourceforge.net/projects/id3com + +And, last but not least, there is a delphi project in cvs +(http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/id3lib/id3lib-stable/delphi/) +which uses the allready compiled dll. +Also in there is a file called Id3lib.pas which has the interface to the dll +defined. + +How to start: + +A) ***Your project wants to link id3lib static, and has mfc linked static: +1) Rename config.h.win32 to config.h +2) include libprj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace +3) make your project dependend on id3lib, and make id3lib dependend on zlib +4) Add /D ID3LIB_LINKOPTION=1 to your project options (settings, C/C++ tab) +5) Add the following include dirs to your program: + /I \\include /I \\include\\id3 +6) (add your code which uses id3lib) +7) Try to compile, and see if you need any of the following: + (debug) /nodefaultlib:"msvcprtd" or(release) /nodefaultlib:"msvcprt" + (debug) /nodefaultlib:"MSVCRTD" or(release) /nodefaultlib:"MSVCRT" + (debug) /nodefaultlib:"libcd" or(release) /nodefaultlib:"libc" + different programs may require different 'nodefaultlib' 's, or none at all, these worked for me. + If none you try work, revert to C) + +B)***Your project wants to link id3lib static, and has mfc linked dynamic or has no MFC: +1) Rename config.h.win32 to config.h +2) include libprj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace +3) make your project dependend on id3lib, and make id3lib dependend on zlib +4) Add /D ID3LIB_LINKOPTION=1 to your project options (settings, C/C++ tab) +5) Add the following include dirs to your program: + /I \\include /I \\include\\id3 +6) (add your code which uses id3lib) +7) Try to compile, and see if you need any of the following: + (debug) /nodefaultlib:"msvcprtd" or(release) /nodefaultlib:"msvcprt" + (debug) /nodefaultlib:"MSVCRTD" or(release) /nodefaultlib:"MSVCRT" + (debug) /nodefaultlib:"libcmtd" or(release) /nodefaultlib:"libcmt" + different programs may require different 'nodefaultlib' 's, or none at all, these worked for me. + If none you try work, revert to C) + +C)***Your project wants to link id3lib dynamic: (instructions below for vc) +1) Rename config.h.win32 to config.h +2) include prj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace (*note this is a different id3lib than above) +3) make your project dependend on id3lib, and make id3lib dependend on zlib +4) Add /D ID3LIB_LINKOPTION=3 to your project options (settings, C/C++ tab) (*note this is a different option than above) +5) Add the following include dirs to your program: + /I \\include /I \\include\\id3 +6) (add your code which uses id3lib) +7) Compile. +8) dump id3lib.dll in your programs project dir. +9) distribute your program including id3lib.dll +(MS recommend you distribute it in your programs dir and not in system(32) to avoid version conficts) + +Thijmen +thijmen@id3lib.org + diff --git a/id3lib/ltconfig b/id3lib/ltconfig new file mode 100644 index 0000000..65ec6f6 --- /dev/null +++ b/id3lib/ltconfig @@ -0,0 +1,3017 @@ +#! /bin/sh + +# ltconfig - Create a system-specific libtool. +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A lot of this script is taken from autoconf-2.10. + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} +echo=echo +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec "$SHELL" "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null`} + case X$UNAME in + *-DOS) PATH_SEPARATOR=';' ;; + *) PATH_SEPARATOR=':' ;; + esac +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi + +if test "X${echo_test_string+set}" != "Xset"; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || + test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running ltconfig again with it. + ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf "%s\n"' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # Cool, printf works + : + elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# The name of this program. +progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` + +# Constants: +PROGRAM=ltconfig +PACKAGE=libtool +VERSION=1.3.3 +TIMESTAMP=" (1.385.2.181 1999/07/02 15:49:11)" +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5' +rm="rm -f" + +help="Try \`$progname --help' for more information." + +# Global variables: +default_ofile=libtool +can_build_shared=yes +enable_shared=yes +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +enable_static=yes +enable_fast_install=yes +enable_dlopen=unknown +enable_win32_dll=no +ltmain= +silent= +srcdir= +ac_config_guess= +ac_config_sub= +host= +nonopt= +ofile="$default_ofile" +verify_host=yes +with_gcc=no +with_gnu_ld=no +need_locks=yes +ac_ext=c +objext=o +libext=a +exeext= +cache_file= + +old_AR="$AR" +old_CC="$CC" +old_CFLAGS="$CFLAGS" +old_CPPFLAGS="$CPPFLAGS" +old_LDFLAGS="$LDFLAGS" +old_LD="$LD" +old_LN_S="$LN_S" +old_LIBS="$LIBS" +old_NM="$NM" +old_RANLIB="$RANLIB" +old_DLLTOOL="$DLLTOOL" +old_OBJDUMP="$OBJDUMP" +old_AS="$AS" + +# Parse the command line options. +args= +prev= +for option +do + case "$option" in + -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + eval "$prev=\$option" + prev= + continue + fi + + case "$option" in + --help) cat <&2 + echo "$help" 1>&2 + exit 1 + ;; + + *) + if test -z "$ltmain"; then + ltmain="$option" + elif test -z "$host"; then +# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 +# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then +# echo "$progname: warning \`$option' is not a valid host type" 1>&2 +# fi + host="$option" + else + echo "$progname: too many arguments" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac +done + +if test -z "$ltmain"; then + echo "$progname: you must specify a LTMAIN file" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +if test ! -f "$ltmain"; then + echo "$progname: \`$ltmain' does not exist" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +# Quote any args containing shell metacharacters. +ltconfig_args= +for arg +do + case "$arg" in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ltconfig_args="$ltconfig_args '$arg'" ;; + *) ltconfig_args="$ltconfig_args $arg" ;; + esac +done + +# A relevant subset of AC_INIT. + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 5 compiler messages saved in config.log +# 6 checking for... messages and results +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>>./config.log + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +if test -n "$cache_file" && test -r "$cache_file"; then + echo "loading cache $cache_file within ltconfig" + . $cache_file +fi + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + +if test -z "$srcdir"; then + # Assume the source directory is the same one as the path to LTMAIN. + srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` + test "$srcdir" = "$ltmain" && srcdir=. +fi + +trap "$rm conftest*; exit 1" 1 2 15 +if test "$verify_host" = yes; then + # Check for config.guess and config.sub. + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/config.guess; then + ac_aux_dir=$ac_dir + break + fi + done + if test -z "$ac_aux_dir"; then + echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 + echo "$help" 1>&2 + exit 1 + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + + # Make sure we can run config.sub. + if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : + else + echo "$progname: cannot run $ac_config_sub" 1>&2 + echo "$help" 1>&2 + exit 1 + fi + + echo $ac_n "checking host system type""... $ac_c" 1>&6 + + host_alias=$host + case "$host_alias" in + "") + if host_alias=`$SHELL $ac_config_guess`; then : + else + echo "$progname: cannot guess host type; you must specify one" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac + host=`$SHELL $ac_config_sub $host_alias` + echo "$ac_t$host" 1>&6 + + # Make sure the host verified. + test -z "$host" && exit 1 + +elif test -z "$host"; then + echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 + echo "$help" 1>&2 + exit 1 +else + host_alias=$host +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case "$host_os" in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +case "$host_os" in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "${COLLECT_NAMES+set}" != set; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR cru $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +# Set a sane default for `AR'. +test -z "$AR" && AR=ar + +# Set a sane default for `OBJDUMP'. +test -z "$OBJDUMP" && OBJDUMP=objdump + +# If RANLIB is not set, then run the test. +if test "${RANLIB+set}" != "set"; then + result=no + + echo $ac_n "checking for ranlib... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then + RANLIB="ranlib" + result="ranlib" + break + fi + done + IFS="$save_ifs" + + echo "$ac_t$result" 1>&6 +fi + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" +fi + +# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$AS" && AS=as + +# Check to see if we are using GCC. +if test "$with_gcc" != yes || test -z "$CC"; then + # If CC is not set, then try to find GCC or a usable CC. + if test -z "$CC"; then + echo $ac_n "checking for gcc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then + CC="gcc" + break + fi + done + IFS="$save_ifs" + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + fi + + # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". + if test -z "$CC"; then + echo $ac_n "checking for cc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + cc_rejected=no + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/cc || test -f $dir/cc$ac_exeext; then + if test "$dir/cc" = "/usr/ucb/cc"; then + cc_rejected=yes + continue + fi + CC="cc" + break + fi + done + IFS="$save_ifs" + if test $cc_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same name, so the bogon will be chosen + # first if we set CC to just the name; use the full file name. + shift + set dummy "$dir/cc" "$@" + shift + CC="$@" + fi + fi + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$CC"; then + echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 + exit 1 + fi + fi + + # Now see if the compiler is really GCC. + with_gcc=no + echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 + echo "$progname:581: checking whether we are using GNU C" >&5 + + $rm conftest.c + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + with_gcc=yes + fi + $rm conftest.c + echo "$ac_t$with_gcc" 1>&6 +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo $ac_n "checking for object suffix... $ac_c" 1>&6 +$rm conftest* +echo 'int i = 1;' > conftest.c +echo "$progname:603: checking for object suffix" >& 5 +if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 +fi +$rm conftest* +echo "$ac_t$objext" 1>&6 + +echo $ac_n "checking for executable suffix... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_exeext="no" + $rm conftest* + echo 'main () { return 0; }' > conftest.c + echo "$progname:629: checking for executable suffix" >& 5 + if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c | *.err | *.$objext ) ;; + *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; + esac + done + else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* +fi +if test "X$ac_cv_exeext" = Xno; then + exeext="" +else + exeext="$ac_cv_exeext" +fi +echo "$ac_t$ac_cv_exeext" 1>&6 + +echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 +pic_flag= +special_shlib_compile_flags= +wl= +link_static_flag= +no_builtin_flag= + +if test "$with_gcc" = yes; then + wl='-Wl,' + link_static_flag='-static' + + case "$host_os" in + beos* | irix5* | irix6* | osf3* | osf4*) + # PIC is the default for these OSes. + ;; + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # we not sure about C++ programs. + link_static_flag="$link_static_flag ${wl}-lC" + ;; + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + pic_flag='-m68020 -resident32 -malways-restore-a4' + ;; + sysv4*MP*) + if test -d /usr/nec; then + pic_flag=-Kconform_pic + fi + ;; + *) + pic_flag='-fPIC' + ;; + esac +else + # PORTME Check for PIC flags for the system compiler. + case "$host_os" in + aix3* | aix4*) + # All AIX code is PIC. + link_static_flag='-bnso -bI:/lib/syscalls.exp' + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better link_static_flag that works with the bundled CC? + wl='-Wl,' + link_static_flag="${wl}-a ${wl}archive" + pic_flag='+Z' + ;; + + irix5* | irix6*) + wl='-Wl,' + link_static_flag='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + + osf3* | osf4*) + # All OSF/1 code is PIC. + wl='-Wl,' + link_static_flag='-non_shared' + ;; + + sco3.2v5*) + pic_flag='-Kpic' + link_static_flag='-dn' + special_shlib_compile_flags='-belf' + ;; + + solaris*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + sunos4*) + pic_flag='-PIC' + link_static_flag='-Bstatic' + wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + uts4*) + pic_flag='-pic' + link_static_flag='-Bstatic' + ;; + sysv4*MP*) + if test -d /usr/nec ;then + pic_flag='-Kconform_pic' + link_static_flag='-Bstatic' + fi + ;; + *) + can_build_shared=no + ;; + esac +fi + +if test -n "$pic_flag"; then + echo "$ac_t$pic_flag" 1>&6 + + # Check to make sure the pic_flag actually works. + echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $pic_flag -DPIC" + echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 + if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + case "$host_os" in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then they + # create non-PIC objects. So, if there were any warnings, we assume that + # PIC is not supported. + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + can_build_shared=no + pic_flag= + else + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + fi + ;; + *) + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + ;; + esac + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + can_build_shared=no + pic_flag= + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + echo "$ac_t"none 1>&6 +fi + +# Check to see if options -o and -c are simultaneously supported by compiler +echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +$rm conftest* +echo "int some_variable = 0;" > conftest.c +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.o" +echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 +if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + echo "$ac_t"no 1>&6 + compiler_c_o=no + else + echo "$ac_t"yes 1>&6 + compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + compiler_c_o=no + echo "$ac_t"no 1>&6 +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 +if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_o_lo=no + else + echo "$ac_t"yes 1>&6 + compiler_o_lo=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_o_lo=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$ac_t$hard_links" 1>&6 + $rm conftest* + if test "$hard_links" = no; then + echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 + need_locks=warn + fi +else + need_locks=no +fi + +if test "$with_gcc" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" + echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_rtti_exceptions=no + else + echo "$ac_t"yes 1>&6 + compiler_rtti_exceptions=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_rtti_exceptions=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi + +fi + +# Check for any special shared library compilation flags. +if test -n "$special_shlib_compile_flags"; then + echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : + else + echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 + can_build_shared=no + fi +fi + +echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 +$rm conftest* +echo 'main(){return(0);}' > conftest.c +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $link_static_flag" +echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 +if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + echo "$ac_t$link_static_flag" 1>&6 +else + echo "$ac_t"none 1>&6 + link_static_flag= +fi +LDFLAGS="$save_LDFLAGS" +$rm conftest* + +if test -z "$LN_S"; then + # Check to see if we can use ln -s, or we need hard links. + echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 + $rm conftest.dat + if ln -s X conftest.dat 2>/dev/null; then + $rm conftest.dat + LN_S="ln -s" + else + LN_S=ln + fi + if test "$LN_S" = "ln -s"; then + echo "$ac_t"yes 1>&6 + else + echo "$ac_t"no 1>&6 + fi +fi + +# Make sure LD is an absolute path. +if test -z "$LD"; then + ac_prog=ld + if test "$with_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 + echo "$progname:991: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we are not using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld... $ac_c" 1>&6 + echo "$progname:1015: checking for GNU ld" >&5 + else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 + echo "$progname:1018: checking for non-GNU ld" >&5 + fi + + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" + fi + + if test -n "$LD"; then + echo "$ac_t$LD" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$LD"; then + echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 + exit 1 + fi +fi + +# Check to see if it really is or is not GNU ld. +echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 +# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + with_gnu_ld=yes +else + with_gnu_ld=no +fi +echo "$ac_t$with_gnu_ld" 1>&6 + +# See if the linker supports building shared libraries. +echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. + +case "$host_os" in +cygwin* | mingw*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$with_gcc" != yes; then + with_gnu_ld=no + fi + ;; + +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case "$host_os" in + aix3* | aix4*) + # On AIX, the GNU linker is very broken + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols' + + archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ + _lt_hint=1; + for symbol in `cat $export_symbols`; do + echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def; + _lt_hint=`expr 1 + \$_lt_hint`; + done~ + test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' + + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' + ;; + + netbsd*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' + # can we support soname and/or expsyms with a.out? -oliva + fi + ;; + + solaris*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case "$host_os" in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$with_gcc" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4*) + hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' + hardcode_libdir_separator=':' + if test "$with_gcc" = yes; then + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + shared_flag='-shared' + else + shared_flag='${wl}-bM:SRE' + hardcode_direct=yes + fi + allow_undefined_flag=' ${wl}-berok' + archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' + archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' + case "$host_os" in aix4.[01]|aix4.[01].*) + # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on + always_export_symbols=yes ;; + esac + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs' + fix_srcfile_path='`cygpath -w $srcfile`' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case "$host_os" in + hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$with_gcc" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF + fi + hardcode_libdir_flag_spec='${wl}-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + openbsd*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' + ;; + + osf3* | osf4*) + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case "$host_os" in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + # archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' + archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$ac_t$ld_shlibs" 1>&6 +test "$ld_shlibs" = no && can_build_shared=no + +if test -z "$NM"; then + echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 + case "$NM" in + [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -p" + break + else + NM=${NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$NM" && NM=nm + ;; + esac + echo "$ac_t$NM" 1>&6 +fi + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Define system-specific variables. +case "$host_os" in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + $rm conftest* + cat > conftest.c <&5 + if { (eval echo $progname:1593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then + # Now try to grab the symbols. + nlist=conftest.nm + if { echo "$progname:1596: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then + + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.c +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' + + cat <> conftest.c +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c + cat <<\EOF >> conftest.c + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$objext conftstm.$objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo $progname:1648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + pipe_works=yes + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + LIBS="$save_LIBS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + global_symbol_pipe= + fi +done +if test "$pipe_works" = yes; then + echo "${ac_t}ok" 1>&6 +else + echo "${ac_t}failed" 1>&6 +fi + +if test -z "$global_symbol_pipe"; then + global_symbol_to_cdecl= +fi + +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$ac_t$hardcode_action" 1>&6 + + +reload_flag= +reload_cmds='$LD$reload_flag -o $output$reload_objs' +echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 +# PORTME Some linkers may need a different reload flag. +reload_flag='-r' +echo "$ac_t$reload_flag" 1>&6 +test -n "$reload_flag" && reload_flag=" $reload_flag" + +# PORTME Fill in your ld.so characteristics +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +file_magic_cmd= +file_magic_test_file= +deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. +echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 +case "$host_os" in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4*) + version_type=linux + # AIX has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + # We preserve .a as extension for shared libraries though AIX4.2 + # and later linker supports .so + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' + shlibpath_var=LIBPATH + deplibs_check_method=pass_all + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + deplibs_check_method=pass_all + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + +bsdi4*) + version_type=linux + library_names_spec='${libname}.so$major ${libname}.so' + soname_spec='${libname}.so' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw*) + version_type=windows + need_version=no + need_lib_prefix=no + if test "$with_gcc" = yes; then + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' + else + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + fi + dynamic_linker='Win32 ld.exe' + deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + file_magic_cmd='${OBJDUMP} -f' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case "$version_type" in + freebsd-elf*) + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + deplibs_check_method=unknown + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + finish_cmds='PATH="\$PATH:/sbin" OBJFORMAT="'"$objformat"'" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + case "$host_os" in + freebsd2* | freebsd3.[01]*) + shlibpath_overrides_runpath=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so.$major' + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' + case "$host_os" in + irix5*) + libsuff= shlibsuff= + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case "$LD" in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /lib${libsuff}/libc.so*` + deplibs_check_method='pass_all' + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + + if test -f /lib/ld.so.1; then + dynamic_linker='GNU ld.so' + else + # Only the GNU ld.so supports shared libraries on MkLinux. + case "$host_cpu" in + powerpc*) dynamic_linker=no ;; + *) dynamic_linker='Linux ld.so' ;; + esac + fi + ;; + +netbsd*) + version_type=sunos + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + ;; + +openbsd*) + version_type=sunos + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + need_version=no + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method='file_magic COFF format alpha shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + deplibs_check_method='pass_all' + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" + file_magic_cmd=/usr/bin/file + file_magic_test_file=/lib/libc.so + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case "$host_vendor" in + ncr) + deplibs_check_method='pass_all' + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$ac_t$dynamic_linker" 1>&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 + +# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in +# configure.in, otherwise build static only libraries. +case "$host_os" in +cygwin* | mingw* | os2*) + if test x$can_build_shared = xyes; then + test x$enable_win32_dll = xno && can_build_shared=no + echo "checking if package supports dlls... $can_build_shared" 1>&6 + fi +;; +esac + +if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then + case "$deplibs_check_method" in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac +fi + +echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac + +echo "$ac_t$enable_shared" 1>&6 + +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes + +echo "checking whether to build static libraries... $enable_static" 1>&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +echo $ac_n "checking for objdir... $ac_c" 1>&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$ac_t$objdir" 1>&6 + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else +if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then + lt_cv_dlopen=no lt_cv_dlopen_libs= +echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "$progname:2170: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +echo "$progname:2207: checking for dlopen" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +dlopen(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_dlopen=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_dlopen=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 +echo "$progname:2251: checking for dld_link in -ldld" >&5 +ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load""... $ac_c" 1>&6 +echo "$progname:2288: checking for shl_load" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +shl_load(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shl_load=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shl_load=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 +echo "$progname:2333: checking for shl_load in -ldld" >&5 +ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + +fi + +fi + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + fi + + case "$lt_cv_dlopen" in + dlopen) +for ac_hdr in dlfcn.h; do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "$progname:2395: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int fnord = 0; +EOF +ac_try="$ac_compile conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo $progname:2405: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "x$ac_cv_header_dlfcn_h" = xyes; then + CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + fi + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2433: checking whether a program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self" 1>&6 + + if test "$lt_cv_dlopen_self" = yes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2506: checking whether a statically linked program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self_static=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self_static=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self_static=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 +fi + ;; + esac + + case "$lt_cv_dlopen_self" in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case "$lt_cv_dlopen_self_static" in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + +# Copy echo and quote the copy, instead of the original, because it is +# used later. +ltecho="$echo" +if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ltecho="$CONFIG_SHELL \$0 --fallback-echo" +fi +LTSHELL="$SHELL" + +LTCONFIG_VERSION="$VERSION" + +# Only quote variables if we're using ltmain.sh. +case "$ltmain" in +*.sh) + # Now quote all the things that may contain metacharacters. + for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ + AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ + file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case "$var" in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case "$ltecho" in + *'\$0 --fallback-echo"') + ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + + trap "$rm \"$ofile\"; exit 1" 1 2 15 + echo "creating $ofile" + $rm "$ofile" + cat < "$ofile" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +EOF + cfgfile="$ofile" + ;; + +*) + # Double-quote the variables that need it (for aesthetics). + for var in old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do + eval "$var=\\\"\$var\\\"" + done + + # Just create a config file. + cfgfile="$ofile.cfg" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + echo "creating $cfgfile" + $rm "$cfgfile" + cat < "$cfgfile" +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +EOF + ;; +esac + +cat <> "$cfgfile" +# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ +# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ +# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ +# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ +# $0$ltconfig_args +# +# Compiler and other test output produced by $progname, useful for +# debugging $progname, is in ./config.log if it exists. + +# The version of $progname that generated this script. +LTCONFIG_VERSION=$LTCONFIG_VERSION + +# Shell to use when invoking shell scripts. +SHELL=$LTSHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$ltecho + +# The archiver. +AR=$AR + +# The default C compiler. +CC=$CC + +# The linker used to build libraries. +LD=$LD + +# Whether we need hard or soft links. +LN_S=$LN_S + +# A BSD-compatible nm program. +NM=$NM + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$reload_flag +reload_cmds=$reload_cmds + +# How to pass a linker flag through the compiler. +wl=$wl + +# Object file suffix (normally "o"). +objext="$objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$pic_flag + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$RANLIB +old_archive_cmds=$old_archive_cmds +old_postinstall_cmds=$old_postinstall_cmds +old_postuninstall_cmds=$old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$old_archive_from_new_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$archive_cmds +archive_expsym_cmds=$archive_expsym_cmds +postinstall_cmds=$postinstall_cmds +postuninstall_cmds=$postuninstall_cmds + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$global_symbol_to_cdecl + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$include_expsyms + +EOF + +case "$ltmain" in +*.sh) + echo '### END LIBTOOL CONFIG' >> "$ofile" + echo >> "$ofile" + case "$host_os" in + aix3*) + cat <<\EOF >> "$ofile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "${COLLECT_NAMES+set}" != set; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # Append the ltmain.sh script. + sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) + + chmod +x "$ofile" + ;; + +*) + # Compile the libtool program. + echo "FIXME: would compile $ltmain" + ;; +esac + +test -n "$cache_file" || exit 0 + +# AC_CACHE_SAVE +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/id3lib/ltmain.sh b/id3lib/ltmain.sh new file mode 100644 index 0000000..1113682 --- /dev/null +++ b/id3lib/ltmain.sh @@ -0,0 +1,5009 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case $nonopt in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + prev= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + # Accept any command-line options. + case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + else + # Don't build PIC code + command="$base_compile $srcfile" + fi + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if (test -z "$pic_flag" || test "$pic_mode" != default) && + test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $srcfile" + else + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n $prev + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test "$status" -ne 0 && test ! -d "$output_objdir"; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + libs="$libs $deplib" + done + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit 1 + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode" = prog; then + # Determine which files to process + case $pass in + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test "$linkmode" = oldlib && test "$linkmode" = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: This library needs some functionality provided by $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + else + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then + # Add dl[pre]opened files of deplib + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + continue + fi # $pass = conv + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" + fi + continue + fi + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || + { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + if test "$linkmode" = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`echo $soroot | sed -e 's/^.*\///'` + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + echo "*** Warning: This library needs some functionality provided by $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** Therefore, libtool will create a static module, that should work " + echo "*** as long as the dlopening application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="-L$absdir/$objdir" + else + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="-L$absdir" + fi + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + test "$pass" != scan && dependency_libs="$newdependency_libs" + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + *) + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case $current in + [0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $revision in + [0-9]*) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $age in + [0-9]*) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix) + major=`expr $current - $age + 1` + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring="" + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` + deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + # It is ok to link against an archive when + # building a shared library. + if $AR -t $potlib > /dev/null 2>&1; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + if eval echo \"$potent_lib\" 2>/dev/null \ + | sed 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + test -z "$dlname" && dlname=$soname + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + prog) + case $host in + *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit 0 + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) exeext=.exe ;; + *) exeext= ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + continue + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` + if test $? = 0 ; then : + else + tmpdir="$tmpdir/libtool-$$" + fi + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + /usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`echo $destfile | sed -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $0 --finish$current_libdirs' + else + exit 0 + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + rmdirs= + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$objdir" + else + objdir="$dir/$objdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test "$mode" = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + # Do a test to see if this is a libtool program. + if test "$mode" = clean && + (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/id3lib/m4/Makefile.am b/id3lib/m4/Makefile.am new file mode 100644 index 0000000..56891f3 --- /dev/null +++ b/id3lib/m4/Makefile.am @@ -0,0 +1,17 @@ +# Copyright 2000 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +m4macros = \ + id3_debug.m4 \ + id3_unicode.m4 \ + id3_cxx.m4 + +EXTRA_DIST = $(m4macros) diff --git a/id3lib/m4/Makefile.in b/id3lib/m4/Makefile.in new file mode 100644 index 0000000..047f0ae --- /dev/null +++ b/id3lib/m4/Makefile.in @@ -0,0 +1,256 @@ +# Makefile.in generated by automake 1.6.2 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2000 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOX_DIR_HTML = @DOX_DIR_HTML@ +DOX_DIR_LATEX = @DOX_DIR_LATEX@ +DOX_DIR_MAN = @DOX_DIR_MAN@ +DOX_DIR_RTF = @DOX_DIR_RTF@ +ECHO = @ECHO@ +ID3LIB_BINARY_AGE = @ID3LIB_BINARY_AGE@ +ID3LIB_DEBUG_FLAGS = @ID3LIB_DEBUG_FLAGS@ +ID3LIB_FULLNAME = @ID3LIB_FULLNAME@ +ID3LIB_INTERFACE_AGE = @ID3LIB_INTERFACE_AGE@ +ID3LIB_MAJOR_VERSION = @ID3LIB_MAJOR_VERSION@ +ID3LIB_MINOR_VERSION = @ID3LIB_MINOR_VERSION@ +ID3LIB_NAME = @ID3LIB_NAME@ +ID3LIB_PATCH_VERSION = @ID3LIB_PATCH_VERSION@ +ID3LIB_VERSION = @ID3LIB_VERSION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +cxxflags_set = @cxxflags_set@ +install_sh = @install_sh@ + +m4macros = \ + id3_debug.m4 \ + id3_unicode.m4 \ + id3_cxx.m4 + + +EXTRA_DIST = $(m4macros) +subdir = m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu m4/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/id3lib/m4/id3_cxx.m4 b/id3lib/m4/id3_cxx.m4 new file mode 100644 index 0000000..06248ae --- /dev/null +++ b/id3lib/m4/id3_cxx.m4 @@ -0,0 +1,134 @@ +dnl Autoconf support for C++ + +AC_DEFUN([ID3_CXX_WARNINGS],[ + AC_ARG_ENABLE(cxx-warnings, + [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C++ compiler) + warnCXXFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + if test "x$enable_cxx_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCXXFLAGS="-Wall -Wno-unused -Wno-inline -Woverloaded-virtual -Wmissing-declarations" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_cxx_warnings" = "xyes"; then + warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Woverloaded-virtual" + fi + fi + fi + AC_MSG_RESULT($warnCXXFLAGS) + + AC_ARG_ENABLE(iso-cxx, + [ --enable-iso-cxx Try to warn if code is not ISO C++ ],, + enable_iso_cxx=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler) + complCXXFLAGS= + if test "x$enable_iso_cxx" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -ansi" ;; + esac + + case " $CXXFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCXXFLAGS) + if test "x$cxxflags_set" != "xyes"; then + CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS" + cxxflags_set=yes + AC_SUBST(cxxflags_set) + fi +]) + + +# ----------------------------------------------------------------------- +# This macro tests the C++ compiler for various portability problem. +# 1. Defines CXX_HAS_NO_BOOL if the compiler does not support the bool +# data type +# 2. Defines CXX_HAS_BUGGY_FOR_LOOPS if the compiler has buggy +# scoping for the for-loop +# Seperately we provide some config.h.bot code to be added to acconfig.h +# that implements work-arounds for these problems. +# ----------------------------------------------------------------------- + +dnl ACCONFIG TEMPLATE +dnl #undef CXX_HAS_BUGGY_FOR_LOOPS +dnl #undef CXX_HAS_NO_BOOL +dnl END ACCONFIG + +AC_DEFUN(ID3_CXX_PORTABILITY,[ + + AC_PROVIDE([$0]) + + dnl + dnl Check for common C++ portability problems + dnl + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + dnl Check whether we have bool + AC_MSG_CHECKING(whether C++ has bool) + AC_TRY_RUN([main() { bool b1=true; bool b2=false; }], + [ AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no) + AC_DEFINE(CXX_HAS_NO_BOOL) ], + [ AC_MSG_WARN(Don't cross-compile)] + ) + + dnl Test whether C++ has buggy for-loops + AC_MSG_CHECKING(whether C++ has correct scoping in for-loops) + AC_TRY_COMPILE([#include ], [ + for (int i=0;i<10;i++) { } + for (int i=0;i<10;i++) { } +], [ AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no) + AC_DEFINE(CXX_HAS_BUGGY_FOR_LOOPS) ]) + + dnl Done with the portability checks + AC_LANG_RESTORE +]) + +dnl ACCONFIG BOTTOM +dnl +dnl // This file defines portability work-arounds for various proprietory +dnl // C++ compilers +dnl +dnl // Workaround for compilers with buggy for-loop scoping +dnl // That's quite a few compilers actually including recent versions of +dnl // Dec Alpha cxx, HP-UX CC and SGI CC. +dnl // The trivial "if" statement provides the correct scoping to the +dnl // for loop +dnl +dnl #ifdef CXX_HAS_BUGGY_FOR_LOOPS +dnl #undef for +dnl #define for if(1) for +dnl #endif +dnl +dnl // +dnl // If the C++ compiler we use doesn't have bool, then +dnl // the following is a near-perfect work-around. +dnl // You must make sure your code does not depend on "int" and "bool" +dnl // being two different types, in overloading for instance. +dnl // +dnl +dnl #ifdef CXX_HAS_NO_BOOL +dnl #define bool int +dnl #define true 1 +dnl #define false 0 +dnl #endif +dnl +dnl END ACCONFIG + diff --git a/id3lib/m4/id3_debug.m4 b/id3lib/m4/id3_debug.m4 new file mode 100644 index 0000000..c1a52ab --- /dev/null +++ b/id3lib/m4/id3_debug.m4 @@ -0,0 +1,45 @@ +AC_DEFUN([ID3_DEBUG],[ + AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default) + + if test "x$enable_debug" = "xyes"; then + test "$cflags_set" = set || CFLAGS="$CFLAGS -g" + AC_DEFINE(ID3_ENABLE_DEBUG) + else + if test "x$enable_debug" = "xno"; then + AC_DEFINE(ID3_DISABLE_ASSERT) + AC_DEFINE(ID3_DISABLE_CHECKS) + fi + fi +]) + +dnl ACCONFIG TEMPLATE +dnl #undef ID3_ENABLE_DEBUG +dnl #undef ID3_DISABLE_ASSERT +dnl #undef ID3_DISABLE_CHECKS +dnl END ACCONFIG +dnl ACCONFIG BOTTOM +dnl #if defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) && defined (__cplusplus) +dnl +dnl #define DEBUG +dnl +dnl #include +dnl #include +dnl +dnl #define ID3D_INIT_DOUT() Debug( libcw_do.on() ) +dnl #define ID3D_INIT_WARNING() Debug( dc::warning.on() ) +dnl #define ID3D_INIT_NOTICE() Debug( dc::notice.on() ) +dnl #define ID3D_NOTICE(x) Dout( dc::notice, x ) +dnl #define ID3D_WARNING(x) Dout( dc::warning, x ) +dnl +dnl #else +dnl +dnl # define ID3D_INIT_DOUT() +dnl # define ID3D_INIT_WARNING() +dnl # define ID3D_INIT_NOTICE() +dnl # define ID3D_NOTICE(x) +dnl # define ID3D_WARNING(x) +dnl +dnl #endif /* defined (ID3_ENABLE_DEBUG) && defined (HAVE_LIBCW_SYS_H) */ +dnl +dnl END ACCONFIG + diff --git a/id3lib/m4/id3_unicode.m4 b/id3lib/m4/id3_unicode.m4 new file mode 100644 index 0000000..b2cb2a1 --- /dev/null +++ b/id3lib/m4/id3_unicode.m4 @@ -0,0 +1,51 @@ +dnl ACCONFIG TEMPLATE +dnl #undef ID3_ICONV_FORMAT_UTF16BE +dnl #undef ID3_ICONV_FORMAT_UTF16 +dnl #undef ID3_ICONV_FORMAT_UTF8 +dnl #undef ID3_ICONV_FORMAT_ASCII +dnl END ACCONFIG + +AC_DEFUN(ID3_CHECK_ICONV_FORMAT,[ + if eval "test \"x\$$1\" = \"xno\""; then + AC_MSG_CHECKING(whether iconv supports $2) + AC_TRY_RUN([#include + int main() { return iconv_open("$2", "$2") == -1; } ], + [ eval $1=yes + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED($1, "$2") ], + [ AC_MSG_RESULT(no) ], + [ AC_MSG_WARN(Don't cross-compile) ]) + fi +]) + +AC_DEFUN([ID3_UNICODE],[ + if test "x$ac_cv_header_iconv_h" = "xyes"; then + ID3_ICONV_FORMAT_UTF8=no + ID3_ICONV_FORMAT_UTF16=no + ID3_ICONV_FORMAT_UTF16BE=no + ID3_ICONV_FORMAT_ASCII=no + + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF8, UTF-8) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF8, UTF8) +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF8) + + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE, UTF-16BE) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE, UTF16BE) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE, UCS-2BE) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE, UCS2BE) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE, UNICODEBIG) +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16BE) + + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16, UTF-16) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16, UTF16) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16, UNICODE) +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_UTF16) + + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII, ISO-8859-1) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII, ASCII) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII, US-ASCII) + ID3_CHECK_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII, US) +# ID3_CLEAR_ICONV_FORMAT(ID3_ICONV_FORMAT_ASCII) + fi +]) + diff --git a/id3lib/makefile.win32 b/id3lib/makefile.win32 new file mode 100644 index 0000000..851862e --- /dev/null +++ b/id3lib/makefile.win32 @@ -0,0 +1,148 @@ +# $Id: makefile.win32,v 1.1 2007/11/12 21:32:38 pindakaasmod Exp $ +# +# Win32 makefile for id3lib +# +# First off, copy config.h.win32 to config.h +# +# You should run this using 'name -f makefile.win32' from the +# id3lib root directory (for instance, c:\projects\id3lib-3.8.0\). +# +# If you want a debug version of the lib, add DEBUG=1 to +# the nmake command line. +# +# The library will be produced as 'id3lib.lib' for the release +# version, or 'id3libd.lib' for the debug version. +# +# Comments, bugs, go to johan@linkdata.se +# Mail me on how to run the command line compiler, and I'll flame you. RTFM. +# +# PS. +# Wtf is it that everyone insists on using the Visual C++ IDE? +# I mean, I found the instructions for building this lib under +# the IDE posted on a mailing list. It was 4 pages long, at least. +# + +CFLAGS=-nologo -I. -Iinclude -Iinclude\id3 -Izlib\include \ + -W3 -WX -GX \ + -DHAVE_CONFIG_H -DID3LIB_LINKOPTION=1 + +!ifdef DEBUG +SUFFIX=d +CFLAGS=$(CFLAGS) -Od -Z7 -Oy- -MD -D "WIN32" -D "_DEBUG" +!else +SUFFIX= +CFLAGS=$(CFLAGS) -Ox -Oy- -MD -D "WIN32" -D "NDEBUG" +!endif + +SRCDIR=src +ZLIBDIR=zlib\src +OBJDIR=obj$(SUFFIX) + +SRCS=\ + $(SRCDIR)\c_wrapper.cpp \ + $(SRCDIR)\field.cpp \ + $(SRCDIR)\field_binary.cpp \ + $(SRCDIR)\field_integer.cpp \ + $(SRCDIR)\field_string_ascii.cpp \ + $(SRCDIR)\field_string_unicode.cpp \ + $(SRCDIR)\frame.cpp \ + $(SRCDIR)\frame_impl.cpp \ + $(SRCDIR)\frame_parse.cpp \ + $(SRCDIR)\frame_render.cpp \ + $(SRCDIR)\globals.cpp \ + $(SRCDIR)\header.cpp \ + $(SRCDIR)\header_frame.cpp \ + $(SRCDIR)\header_tag.cpp \ + $(SRCDIR)\helpers.cpp \ + $(SRCDIR)\io.cpp \ + $(SRCDIR)\io_decorators.cpp \ + $(SRCDIR)\io_helpers.cpp \ + $(SRCDIR)\misc_support.cpp \ + $(SRCDIR)\mp3_parse.cpp \ + $(SRCDIR)\readers.cpp \ + $(SRCDIR)\spec.cpp \ + $(SRCDIR)\tag.cpp \ + $(SRCDIR)\tag_file.cpp \ + $(SRCDIR)\tag_find.cpp \ + $(SRCDIR)\tag_impl.cpp \ + $(SRCDIR)\tag_parse.cpp \ + $(SRCDIR)\tag_parse_lyrics3.cpp \ + $(SRCDIR)\tag_parse_musicmatch.cpp \ + $(SRCDIR)\tag_parse_v1.cpp \ + $(SRCDIR)\tag_render.cpp \ + $(SRCDIR)\utils.cpp \ + $(SRCDIR)\writers.cpp \ + $(ZLIBDIR)\adler32.c \ + $(ZLIBDIR)\compress.c \ + $(ZLIBDIR)\crc32.c \ + $(ZLIBDIR)\deflate.c \ + $(ZLIBDIR)\gzio.c \ + $(ZLIBDIR)\infblock.c \ + $(ZLIBDIR)\infcodes.c \ + $(ZLIBDIR)\inffast.c \ + $(ZLIBDIR)\inflate.c \ + $(ZLIBDIR)\inftrees.c \ + $(ZLIBDIR)\infutil.c \ + $(ZLIBDIR)\trees.c \ + $(ZLIBDIR)\uncompr.c \ + $(ZLIBDIR)\zutil.c + +OBJS=\ + $(OBJDIR)\c_wrapper.obj \ + $(OBJDIR)\field.obj \ + $(OBJDIR)\field_binary.obj \ + $(OBJDIR)\field_integer.obj \ + $(OBJDIR)\field_string_ascii.obj \ + $(OBJDIR)\field_string_unicode.obj \ + $(OBJDIR)\frame.obj \ + $(OBJDIR)\frame_impl.obj \ + $(OBJDIR)\frame_parse.obj \ + $(OBJDIR)\frame_render.obj \ + $(OBJDIR)\globals.obj \ + $(OBJDIR)\header.obj \ + $(OBJDIR)\header_frame.obj \ + $(OBJDIR)\header_tag.obj \ + $(OBJDIR)\helpers.obj \ + $(OBJDIR)\io.obj \ + $(OBJDIR)\io_decorators.obj \ + $(OBJDIR)\io_helpers.obj \ + $(OBJDIR)\misc_support.obj \ + $(OBJDIR)\mp3_parse.obj \ + $(OBJDIR)\readers.obj \ + $(OBJDIR)\spec.obj \ + $(OBJDIR)\tag.obj \ + $(OBJDIR)\tag_file.obj \ + $(OBJDIR)\tag_find.obj \ + $(OBJDIR)\tag_impl.obj \ + $(OBJDIR)\tag_parse.obj \ + $(OBJDIR)\tag_parse_lyrics3.obj \ + $(OBJDIR)\tag_parse_musicmatch.obj \ + $(OBJDIR)\tag_parse_v1.obj \ + $(OBJDIR)\tag_render.obj \ + $(OBJDIR)\utils.obj \ + $(OBJDIR)\writers.obj \ + $(OBJDIR)\adler32.obj \ + $(OBJDIR)\compress.obj \ + $(OBJDIR)\crc32.obj \ + $(OBJDIR)\deflate.obj \ + $(OBJDIR)\gzio.obj \ + $(OBJDIR)\infblock.obj \ + $(OBJDIR)\infcodes.obj \ + $(OBJDIR)\inffast.obj \ + $(OBJDIR)\inflate.obj \ + $(OBJDIR)\inftrees.obj \ + $(OBJDIR)\infutil.obj \ + $(OBJDIR)\trees.obj \ + $(OBJDIR)\uncompr.obj \ + $(OBJDIR)\zutil.obj + +{$(SRCDIR)}.cpp{$(OBJDIR)}.obj: + @if not exist $(OBJDIR) md $(OBJDIR) + @$(CC) $(CFLAGS) -Fo$*.obj -c $(SRCDIR)\$(*F).cpp + +{$(ZLIBDIR)}.c{$(OBJDIR)}.obj: + @if not exist $(OBJDIR) md $(OBJDIR) + @$(CC) $(CFLAGS) -Fo$*.obj -c $(ZLIBDIR)\$(*F).c + +id3lib$(SUFFIX).lib : $(OBJS) + @lib /nologo /out:id3lib$(SUFFIX).lib $(OBJS) diff --git a/id3lib/makewin32.bat b/id3lib/makewin32.bat new file mode 100644 index 0000000..587a4a6 --- /dev/null +++ b/id3lib/makewin32.bat @@ -0,0 +1,35 @@ +REM $Id: makewin32.bat,v 1.1 2007/11/12 21:32:41 pindakaasmod Exp $ +@echo off + +REM Comments, bugs go to johan@linkdata.se +REM Mail me on how to run the command line compiler, and I'll flame you. RTFM. + +if defined INCLUDE goto ok +if not exist "\program files\microsoft visual studio\VC98\bin\vcvars32.bat" goto altloc1 +call "\program files\microsoft visual studio\VC98\bin\vcvars32.bat" +goto ok + +:altloc1 +if not exist "\programs\microsoft visual studio\VC98\bin\vcvars32.bat" goto altloc2 +call "\programs\microsoft visual studio\VC98\bin\vcvars32.bat" +goto ok + +:altloc2 +if not exist "\programs\msvs\VC98\bin\vcvars32.bat" goto runvc +call "\programs\msvs\VC98\bin\vcvars32.bat" +goto ok + +:ok +if not defined INCLUDE goto runvc +if not exist config.h copy config.h.win32 config.h +nmake DEBUG=1 -f makefile.win32 +nmake -f makefile.win32 +goto done + +:runvc +echo You need to run the VCVARS32.BAT batch file. +echo You'll find it in the Visual C++ binaries directory. +echo Also, when installing Visual C++, you are asked if to automatically +echo run this file when starting a command shell. + +:done diff --git a/id3lib/missing b/id3lib/missing new file mode 100644 index 0000000..0a7fb5a --- /dev/null +++ b/id3lib/missing @@ -0,0 +1,283 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.3 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar ${1+"$@"} && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar ${1+"$@"} && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/id3lib/mkinstalldirs b/id3lib/mkinstalldirs new file mode 100644 index 0000000..639bd82 --- /dev/null +++ b/id3lib/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1 2007/12/11 20:21:19 pindakaasmod Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/id3lib/reconf b/id3lib/reconf new file mode 100644 index 0000000..662fe10 --- /dev/null +++ b/id3lib/reconf @@ -0,0 +1,27 @@ +# Copyright (C) 1999 Scott Thomas Haug +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +#!/bin/sh +rm -f config.cache +rm -f acconfig.h +echo "- aclocal." +aclocal -I m4 +echo "- autoconf." +autoconf +echo "- acconfig." +./acconfig +echo "- autoheader." +autoheader +echo "- automake." +automake -a +echo "- Cleaning up after automake." +rm -rf autom4te.cache +rm -rf zlib/autom4te.cache +exit diff --git a/id3lib/src/Makefile.am b/id3lib/src/Makefile.am new file mode 100644 index 0000000..8b0f682 --- /dev/null +++ b/id3lib/src/Makefile.am @@ -0,0 +1,82 @@ +# Copyright (C) 1999 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +LT_VERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) + +if ID3_NEEDZLIB +zlib_include = -I$(top_srcdir)/zlib/include +else +zlib_include = +endif + +INCLUDES = \ + @ID3LIB_DEBUG_FLAGS@ -I$(top_srcdir)/include/id3 -I$(top_srcdir)/include $(zlib_include) + +noinst_HEADERS = \ + field_def.h \ + field_impl.h \ + flags.h \ + frame_def.h \ + frame_impl.h \ + header.h \ + header_frame.h \ + header_tag.h \ + mp3_header.h \ + tag_impl.h \ + spec.h + +id3lib_sources = \ + c_wrapper.cpp \ + field.cpp \ + field_binary.cpp \ + field_integer.cpp \ + field_string_ascii.cpp \ + field_string_unicode.cpp \ + frame.cpp \ + frame_impl.cpp \ + frame_parse.cpp \ + frame_render.cpp \ + globals.cpp \ + header.cpp \ + header_frame.cpp \ + header_tag.cpp \ + helpers.cpp \ + io.cpp \ + io_decorators.cpp \ + io_helpers.cpp \ + misc_support.cpp \ + mp3_parse.cpp \ + readers.cpp \ + spec.cpp \ + tag.cpp \ + tag_file.cpp \ + tag_find.cpp \ + tag_impl.cpp \ + tag_parse.cpp \ + tag_parse_lyrics3.cpp \ + tag_parse_musicmatch.cpp \ + tag_parse_v1.cpp \ + tag_render.cpp \ + utils.cpp \ + writers.cpp + +lib_LTLIBRARIES = libid3.la + +libid3_la_SOURCES = $(id3lib_sources) + +if ID3_NEEDZLIB +LDADD = $(top_builddir)/zlib/src/libz.la +endif + +libid3_la_LDFLAGS = \ + -version-info $(LT_VERSION) \ + -release $(LT_RELEASE) \ + -export-dynamic diff --git a/id3lib/src/Makefile.in b/id3lib/src/Makefile.in new file mode 100644 index 0000000..ee16d5d --- /dev/null +++ b/id3lib/src/Makefile.in @@ -0,0 +1,509 @@ +# Makefile.in generated by automake 1.6.2 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 1999 Scott Thomas Haug +# Copyright (C) 2002 Thijmen Klok +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOX_DIR_HTML = @DOX_DIR_HTML@ +DOX_DIR_LATEX = @DOX_DIR_LATEX@ +DOX_DIR_MAN = @DOX_DIR_MAN@ +DOX_DIR_RTF = @DOX_DIR_RTF@ +ECHO = @ECHO@ +ID3LIB_BINARY_AGE = @ID3LIB_BINARY_AGE@ +ID3LIB_DEBUG_FLAGS = @ID3LIB_DEBUG_FLAGS@ +ID3LIB_FULLNAME = @ID3LIB_FULLNAME@ +ID3LIB_INTERFACE_AGE = @ID3LIB_INTERFACE_AGE@ +ID3LIB_MAJOR_VERSION = @ID3LIB_MAJOR_VERSION@ +ID3LIB_MINOR_VERSION = @ID3LIB_MINOR_VERSION@ +ID3LIB_NAME = @ID3LIB_NAME@ +ID3LIB_PATCH_VERSION = @ID3LIB_PATCH_VERSION@ +ID3LIB_VERSION = @ID3LIB_VERSION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +cxxflags_set = @cxxflags_set@ +install_sh = @install_sh@ + +LT_VERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) + +@ID3_NEEDZLIB_TRUE@zlib_include = -I$(top_srcdir)/zlib/include +@ID3_NEEDZLIB_FALSE@zlib_include = + +INCLUDES = \ + @ID3LIB_DEBUG_FLAGS@ -I$(top_srcdir)/include/id3 -I$(top_srcdir)/include $(zlib_include) + + +noinst_HEADERS = \ + field_def.h \ + field_impl.h \ + flags.h \ + frame_def.h \ + frame_impl.h \ + header.h \ + header_frame.h \ + header_tag.h \ + mp3_header.h \ + tag_impl.h \ + spec.h + + +id3lib_sources = \ + c_wrapper.cpp \ + field.cpp \ + field_binary.cpp \ + field_integer.cpp \ + field_string_ascii.cpp \ + field_string_unicode.cpp \ + frame.cpp \ + frame_impl.cpp \ + frame_parse.cpp \ + frame_render.cpp \ + globals.cpp \ + header.cpp \ + header_frame.cpp \ + header_tag.cpp \ + helpers.cpp \ + io.cpp \ + io_decorators.cpp \ + io_helpers.cpp \ + misc_support.cpp \ + mp3_parse.cpp \ + readers.cpp \ + spec.cpp \ + tag.cpp \ + tag_file.cpp \ + tag_find.cpp \ + tag_impl.cpp \ + tag_parse.cpp \ + tag_parse_lyrics3.cpp \ + tag_parse_musicmatch.cpp \ + tag_parse_v1.cpp \ + tag_render.cpp \ + utils.cpp \ + writers.cpp + + +lib_LTLIBRARIES = libid3.la + +libid3_la_SOURCES = $(id3lib_sources) + +@ID3_NEEDZLIB_TRUE@LDADD = $(top_builddir)/zlib/src/libz.la + +libid3_la_LDFLAGS = \ + -version-info $(LT_VERSION) \ + -release $(LT_RELEASE) \ + -export-dynamic + +subdir = src +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +libid3_la_LIBADD = +am__objects_1 = c_wrapper.lo field.lo field_binary.lo field_integer.lo \ + field_string_ascii.lo field_string_unicode.lo frame.lo \ + frame_impl.lo frame_parse.lo frame_render.lo globals.lo \ + header.lo header_frame.lo header_tag.lo helpers.lo io.lo \ + io_decorators.lo io_helpers.lo misc_support.lo mp3_parse.lo \ + readers.lo spec.lo tag.lo tag_file.lo tag_find.lo tag_impl.lo \ + tag_parse.lo tag_parse_lyrics3.lo tag_parse_musicmatch.lo \ + tag_parse_v1.lo tag_render.lo utils.lo writers.lo +am_libid3_la_OBJECTS = $(am__objects_1) +libid3_la_OBJECTS = $(am_libid3_la_OBJECTS) + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/c_wrapper.Plo ./$(DEPDIR)/field.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/field_binary.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/field_integer.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/field_string_ascii.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/field_string_unicode.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/frame.Plo ./$(DEPDIR)/frame_impl.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/frame_parse.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/frame_render.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/globals.Plo ./$(DEPDIR)/header.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/header_frame.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/header_tag.Plo ./$(DEPDIR)/helpers.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/io.Plo ./$(DEPDIR)/io_decorators.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/io_helpers.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/misc_support.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mp3_parse.Plo ./$(DEPDIR)/readers.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/spec.Plo ./$(DEPDIR)/tag.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/tag_file.Plo ./$(DEPDIR)/tag_find.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/tag_impl.Plo ./$(DEPDIR)/tag_parse.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/tag_parse_lyrics3.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/tag_parse_musicmatch.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/tag_parse_v1.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/tag_render.Plo ./$(DEPDIR)/utils.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/writers.Plo +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(libid3_la_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(libid3_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test -z "$dir" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libid3.la: $(libid3_la_OBJECTS) $(libid3_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libid3_la_LDFLAGS) $(libid3_la_OBJECTS) $(libid3_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_wrapper.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/field.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/field_binary.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/field_integer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/field_string_ascii.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/field_string_unicode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame_impl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame_parse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame_render.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/header.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/header_frame.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/header_tag.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helpers.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io_decorators.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io_helpers.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc_support.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp3_parse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readers.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spec.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag_file.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag_find.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag_impl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag_parse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag_parse_lyrics3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag_parse_musicmatch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag_parse_v1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag_render.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/writers.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` + +.cpp.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CXXDEPMODE = @CXXDEPMODE@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool tags uninstall \ + uninstall-am uninstall-info-am uninstall-libLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/id3lib/src/c_wrapper.cpp b/id3lib/src/c_wrapper.cpp new file mode 100644 index 0000000..4d5eacf --- /dev/null +++ b/id3lib/src/c_wrapper.cpp @@ -0,0 +1,687 @@ +// $Id: c_wrapper.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +//#include +#include "id3.h" +#include "tag.h" +#include "field.h" + +#if defined HAVE_CONFIG_H +#include +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + // tag wrappers + +#define ID3_CATCH(code) try { code; } catch (...) { } + + ID3_C_EXPORT ID3Tag* CCONV + ID3Tag_New(void) + { + ID3_Tag* tag = NULL; + ID3_CATCH(tag = new ID3_Tag); + return reinterpret_cast(tag); + } + + + ID3_C_EXPORT void CCONV + ID3Tag_Delete(ID3Tag *tag) + { + if (tag) + { + ID3_CATCH(delete reinterpret_cast(tag)); + } + } + + + ID3_C_EXPORT void CCONV + ID3Tag_Clear(ID3Tag *tag) + { + if (tag) + { + ID3_CATCH(reinterpret_cast(tag)->Clear()); + } + } + + + ID3_C_EXPORT bool CCONV + ID3Tag_HasChanged(const ID3Tag *tag) + { + bool changed = false; + + if (tag) + { + ID3_CATCH(changed = reinterpret_cast(tag)->HasChanged()); + } + + return changed; + } + + + ID3_C_EXPORT void CCONV + ID3Tag_SetUnsync(ID3Tag *tag, bool unsync) + { + if (tag) + { + ID3_CATCH(reinterpret_cast(tag)->SetUnsync(unsync)); + } + } + + + ID3_C_EXPORT void CCONV + ID3Tag_SetExtendedHeader(ID3Tag *tag, bool ext) + { + if (tag) + { + ID3_CATCH(reinterpret_cast(tag)->SetExtendedHeader(ext)); + } + } + + ID3_C_EXPORT void CCONV + ID3Tag_SetPadding(ID3Tag *tag, bool pad) + { + if (tag) + { + ID3_CATCH(reinterpret_cast(tag)->SetPadding(pad)); + } + } + + + ID3_C_EXPORT void CCONV + ID3Tag_AddFrame(ID3Tag *tag, const ID3Frame *frame) + { + if (tag) + { + ID3_CATCH(reinterpret_cast(tag)->AddFrame(reinterpret_cast(frame))); + } + } + + + ID3_C_EXPORT bool CCONV + ID3Tag_AttachFrame(ID3Tag *tag, ID3Frame *frame) + { + bool b = false; + if (tag) + { + ID3_CATCH(b = reinterpret_cast(tag)->AttachFrame(reinterpret_cast(frame))); + } + return b; + } + + + ID3_C_EXPORT void CCONV + ID3Tag_AddFrames(ID3Tag *tag, const ID3Frame *frames, size_t num) + { + if (tag) + { + ID3_CATCH(reinterpret_cast(tag)->AddFrames(reinterpret_cast(frames), num)); + } + } + + + ID3_C_EXPORT ID3Frame* CCONV + ID3Tag_RemoveFrame(ID3Tag *tag, const ID3Frame *frame) + { + ID3_Frame* rem_frame = NULL; + if (tag) + { + ID3_CATCH(rem_frame = reinterpret_cast(tag)->RemoveFrame(reinterpret_cast(frame))); + } + return reinterpret_cast(rem_frame); + } + + + ID3_C_EXPORT ID3_Err CCONV + ID3Tag_Parse(ID3Tag *tag, const uchar header[ ID3_TAGHEADERSIZE ], + const uchar *buffer) + { + size_t size = 0; + if (tag) + { + ID3_CATCH(size = reinterpret_cast(tag)->Parse(header, buffer)); + } + return ID3E_NoError; + } + + + ID3_C_EXPORT size_t CCONV + ID3Tag_Link(ID3Tag *tag, const char *fileName) + { + size_t offset = 0; + if (tag) + { + ID3_CATCH(offset = reinterpret_cast(tag)->Link(fileName)); + } + return offset; + } + + ID3_C_EXPORT size_t CCONV + ID3Tag_LinkWithFlags(ID3Tag *tag, const char *fileName, flags_t flags) + { + size_t offset = 0; + if (tag) + { + ID3_CATCH(offset = reinterpret_cast(tag)->Link(fileName,flags)); + } + return offset; + } + + + + ID3_C_EXPORT ID3_Err CCONV + ID3Tag_Update(ID3Tag *tag) + { + flags_t flags = 0; + if (tag) + { + ID3_CATCH(flags = reinterpret_cast(tag)->Update()); + } + return ID3E_NoError; + } + + ID3_C_EXPORT ID3_Err CCONV + ID3Tag_UpdateByTagType(ID3Tag *tag, flags_t tag_type) + { + flags_t flags = 0; + if (tag) + { + ID3_CATCH(flags = reinterpret_cast(tag)->Update(tag_type)); + } + return ID3E_NoError; + } + + + ID3_C_EXPORT ID3_Err CCONV + ID3Tag_Strip(ID3Tag *tag, flags_t ulTagFlags) + { + if (tag) + { + ID3_CATCH(reinterpret_cast(tag)->Strip(ulTagFlags)); + } + return ID3E_NoError; + } + + + ID3_C_EXPORT ID3Frame* CCONV + ID3Tag_FindFrameWithID(const ID3Tag *tag, ID3_FrameID id) + { + ID3_Frame *frame = NULL; + + if (tag) + { + ID3_CATCH(frame = reinterpret_cast(tag)->Find(id)); + } + + return reinterpret_cast(frame); + } + + + ID3_C_EXPORT ID3Frame* CCONV + ID3Tag_FindFrameWithINT(const ID3Tag *tag, ID3_FrameID id, + ID3_FieldID fld, uint32 data) + { + ID3_Frame *frame = NULL; + + if (tag) + { + ID3_CATCH(frame = reinterpret_cast(tag)->Find(id, fld, data)); + } + + return reinterpret_cast(frame); + } + + + ID3_C_EXPORT ID3Frame* CCONV + ID3Tag_FindFrameWithASCII(const ID3Tag *tag, ID3_FrameID id, + ID3_FieldID fld, const char *data) + { + ID3_Frame *frame = NULL; + + if (tag) + { + ID3_CATCH(frame = reinterpret_cast(tag)->Find(id, fld, data)); + } + + return reinterpret_cast(frame); + } + + + ID3_C_EXPORT ID3Frame* CCONV + ID3Tag_FindFrameWithUNICODE(const ID3Tag *tag, ID3_FrameID id, + ID3_FieldID fld, const unicode_t *data) + { + ID3_Frame *frame = NULL; + + if (tag) + { + ID3_CATCH(frame = reinterpret_cast(tag)->Find(id, fld, data)); + } + + return reinterpret_cast(frame); + } + + + ID3_C_EXPORT size_t CCONV + ID3Tag_NumFrames(const ID3Tag *tag) + { + size_t num = 0; + + if (tag) + { + ID3_CATCH(num = reinterpret_cast(tag)->NumFrames()); + } + + return num; + } + + + ID3_C_EXPORT bool CCONV + ID3Tag_HasTagType(const ID3Tag *tag, ID3_TagType tt) + { + bool has_tt = false; + + if (tag) + { + ID3_CATCH(has_tt = reinterpret_cast(tag)->HasTagType(tt)); + } + + return has_tt; + } + + ID3_C_EXPORT ID3TagIterator* CCONV + ID3Tag_CreateIterator(ID3Tag* tag) + { + ID3_Tag::Iterator* iter = NULL; + + if (tag) + { + ID3_CATCH(iter = reinterpret_cast(tag)->CreateIterator()); + } + + return reinterpret_cast(iter); + } + + ID3_C_EXPORT ID3TagConstIterator* CCONV + ID3Tag_CreateConstIterator(const ID3Tag* tag) + { + ID3_Tag::ConstIterator* iter = NULL; + + if (tag) + { + ID3_CATCH(iter = reinterpret_cast(tag)->CreateIterator()); + } + + return reinterpret_cast(iter); + } + + ID3_C_EXPORT void CCONV + ID3TagIterator_Delete(ID3TagIterator *iter) + { + if (iter) + { + ID3_CATCH(delete reinterpret_cast(iter)); + } + } + + ID3_C_EXPORT ID3Frame* CCONV + ID3TagIterator_GetNext(ID3TagIterator *iter) + { + ID3_Frame* frame = NULL; + if (iter) + { + ID3_CATCH(frame = reinterpret_cast(iter)->GetNext()); + } + return reinterpret_cast(frame); + } + + ID3_C_EXPORT void CCONV + ID3TagConstIterator_Delete(ID3TagConstIterator *iter) + { + if (iter) + { + ID3_CATCH(delete reinterpret_cast(iter)); + } + } + + ID3_C_EXPORT const ID3Frame* CCONV + ID3TagConstIterator_GetNext(ID3TagConstIterator *iter) + { + const ID3_Frame* frame = NULL; + if (iter) + { + ID3_CATCH(frame = reinterpret_cast(iter)->GetNext()); + } + return reinterpret_cast(frame); + } + + // frame wrappers + + ID3_C_EXPORT ID3Frame* CCONV + ID3Frame_New(void) + { + ID3_Frame* frame = NULL; + ID3_CATCH(frame = new ID3_Frame); + return reinterpret_cast(frame); + } + + ID3_C_EXPORT ID3Frame* CCONV + ID3Frame_NewID(ID3_FrameID id) + { + ID3_Frame* frame = NULL; + ID3_CATCH(frame = new ID3_Frame(id)); + return reinterpret_cast(frame); + } + + ID3_C_EXPORT void CCONV + ID3Frame_Delete(ID3Frame *frame) + { + if (frame) + { + ID3_CATCH(delete reinterpret_cast(frame)); + } + } + + + ID3_C_EXPORT void CCONV + ID3Frame_Clear(ID3Frame *frame) + { + if (frame) + { + ID3_CATCH(reinterpret_cast(frame)->Clear()); + } + } + + + ID3_C_EXPORT void CCONV + ID3Frame_SetID(ID3Frame *frame, ID3_FrameID id) + { + if (frame) + { + ID3_CATCH(reinterpret_cast(frame)->SetID(id)); + } + } + + + ID3_C_EXPORT ID3_FrameID CCONV + ID3Frame_GetID(const ID3Frame *frame) + { + ID3_FrameID id = ID3FID_NOFRAME; + + if (frame) + { + ID3_CATCH(id = reinterpret_cast(frame)->GetID()); + } + + return id; + } + + + ID3_C_EXPORT ID3Field* CCONV + ID3Frame_GetField(const ID3Frame *frame, ID3_FieldID name) + { + ID3_Field *field = NULL; + + if (frame) + { + ID3_CATCH(field = reinterpret_cast(frame)->GetField(name)); + } + + return reinterpret_cast(field); + } + + + ID3_C_EXPORT void CCONV + ID3Frame_SetCompression(ID3Frame *frame, bool comp) + { + if (frame) + { + ID3_CATCH(reinterpret_cast(frame)->SetCompression(comp)); + } + } + + + ID3_C_EXPORT bool CCONV + ID3Frame_GetCompression(const ID3Frame *frame) + { + bool compressed = false; + if (frame) + { + ID3_CATCH(compressed = reinterpret_cast(frame)->GetCompression()); + } + return compressed; + } + + + // field wrappers + + + ID3_C_EXPORT void CCONV + ID3Field_Clear(ID3Field *field) + { + if (field) + { + ID3_CATCH(reinterpret_cast(field)->Clear()); + } + } + + + ID3_C_EXPORT size_t CCONV + ID3Field_Size(const ID3Field *field) + { + size_t size = 0; + + if (field) + { + ID3_CATCH(size = reinterpret_cast(field)->Size()); + } + + return size; + } + + + ID3_C_EXPORT size_t CCONV + ID3Field_GetNumTextItems(const ID3Field *field) + { + size_t items = 0; + + if (field) + { + ID3_CATCH(items = reinterpret_cast(field)->GetNumTextItems()); + } + + return items; + } + + + ID3_C_EXPORT void CCONV + ID3Field_SetINT(ID3Field *field, uint32 data) + { + if (field) + { + ID3_CATCH(reinterpret_cast(field)->Set(data)); + } + } + + + ID3_C_EXPORT uint32 CCONV + ID3Field_GetINT(const ID3Field *field) + { + uint32 value = 0; + + if (field) + { + ID3_CATCH(value = reinterpret_cast(field)->Get()); + } + + return value; + } + + + ID3_C_EXPORT void CCONV + ID3Field_SetUNICODE(ID3Field *field, const unicode_t *string) + { + if (field) + { + ID3_CATCH(reinterpret_cast(field)->Set(string)); + } + } + + + ID3_C_EXPORT size_t CCONV + ID3Field_GetUNICODE(const ID3Field *field, unicode_t *buffer, size_t maxChars) + { + size_t numChars = 0; + + if (field) + { + ID3_CATCH(numChars = reinterpret_cast(field)->Get(buffer, maxChars)); + } + + return numChars; + } + + + ID3_C_EXPORT size_t CCONV + ID3Field_GetUNICODEItem(const ID3Field *field, unicode_t *buffer, + size_t maxChars, size_t itemNum) + { + size_t numChars = 0; + + if (field) + { + ID3_CATCH(numChars = reinterpret_cast(field)->Get(buffer, maxChars, itemNum)); + } + + return numChars; + } + + + ID3_C_EXPORT void CCONV + ID3Field_AddUNICODE(ID3Field *field, const unicode_t *string) + { + if (field) + { + ID3_CATCH(reinterpret_cast(field)->Add(string)); + } + } + + + ID3_C_EXPORT void CCONV + ID3Field_SetASCII(ID3Field *field, const char *string) + { + if (field) + { + ID3_CATCH(reinterpret_cast(field)->Set(string)); + } + } + + + ID3_C_EXPORT size_t CCONV + ID3Field_GetASCII(const ID3Field *field, char *buffer, size_t maxChars) + { + size_t numChars = 0; + + if (field) + { + ID3_CATCH(numChars = reinterpret_cast(field)->Get(buffer, maxChars)); + } + + return numChars; + } + + ID3_C_EXPORT size_t CCONV + ID3Field_GetASCIIItem(const ID3Field *field, char *buffer, + size_t maxChars, size_t itemNum) + { + size_t numChars = 0; + + if (field) + { + ID3_CATCH(numChars = reinterpret_cast(field)->Get(buffer, maxChars, itemNum)); + } + + return numChars; + } + + + ID3_C_EXPORT void CCONV + ID3Field_AddASCII(ID3Field *field, const char *string) + { + if (field) + { + ID3_CATCH(reinterpret_cast(field)->Add(string)); + } + } + + + ID3_C_EXPORT void CCONV + ID3Field_SetBINARY(ID3Field *field, const uchar *data, size_t size) + { + if (field) + { + ID3_CATCH(reinterpret_cast(field)->Set(data, size)); + } + } + + + ID3_C_EXPORT void CCONV + ID3Field_GetBINARY(const ID3Field *field, uchar *buffer, size_t buffLength) + { + if (field) + { + ID3_CATCH(reinterpret_cast(field)->Get(buffer, buffLength)); + } + } + + + ID3_C_EXPORT void CCONV + ID3Field_FromFile(ID3Field *field, const char *fileName) + { + if (field) + { + ID3_CATCH(reinterpret_cast(field)->FromFile(fileName)); + } + } + + + ID3_C_EXPORT void CCONV + ID3Field_ToFile(const ID3Field *field, const char *fileName) + { + if (field) + { + ID3_CATCH(reinterpret_cast(field)->ToFile(fileName)); + } + } + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + diff --git a/id3lib/src/field.cpp b/id3lib/src/field.cpp new file mode 100644 index 0000000..47f3354 --- /dev/null +++ b/id3lib/src/field.cpp @@ -0,0 +1,1319 @@ +// $Id: field.cpp,v 1.5 2008/01/15 11:20:36 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + + +#include "field_impl.h" +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" +#include "field_def.h" +#include "frame_def.h" +#include "readers.h" +#include + +using namespace dami; + +// This is used for unimplemented frames so that their data is preserved when +// parsing and rendering +static ID3_FieldDef ID3FD_Unimplemented[] = +{ + { + ID3FN_DATA, // FIELD NAME + ID3FTY_BINARY, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +const ID3_FieldDef* ID3_FieldDef::DEFAULT = ID3FD_Unimplemented; + +static ID3_FieldDef ID3FD_URL[] = +{ + { + ID3FN_URL, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_UserURL[] = +{ + { + ID3FN_TEXTENC, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DESCRIPTION, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR | ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_URL, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_Text[] = +{ + { + ID3FN_TEXTENC, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_TEXT, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + + +static ID3_FieldDef ID3FD_UserText[] = +{ + { + ID3FN_TEXTENC, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DESCRIPTION, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR | ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_TEXT, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + + +static ID3_FieldDef ID3FD_GeneralText[] = +{ + { + ID3FN_TEXTENC, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_LANGUAGE, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 3, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DESCRIPTION, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR | ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_TEXT, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_TermsOfUse[] = +{ + { + ID3FN_TEXTENC, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_3_0, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_LANGUAGE, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 3, // FIXED LEN + ID3V2_3_0, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_TEXT, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_3_0, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_LinkedInfo[] = +{ + { + ID3FN_ID, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 3, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_2_1, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_ID, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 4, // FIXED LEN + ID3V2_3_0, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_URL, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_TEXT, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_Picture[] = +{ + { + ID3FN_TEXTENC, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_IMAGEFORMAT, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 3, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_2_1, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_MIMETYPE, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_3_0, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_PICTURETYPE, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DESCRIPTION, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR | ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DATA, // FIELD NAME + ID3FTY_BINARY, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_GEO[] = +{ + { + ID3FN_TEXTENC, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_MIMETYPE, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_FILENAME, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR | ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DESCRIPTION, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR | ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DATA, // FIELD NAME + ID3FTY_BINARY, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_UFI[] = +{ + { + ID3FN_OWNER, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DATA, // FIELD NAME + ID3FTY_BINARY, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_PlayCounter[] = +{ + { + ID3FN_COUNTER, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 4, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_Popularimeter[] = +{ + { + ID3FN_EMAIL, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_RATING, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_COUNTER, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 4, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_Private[] = +{ + { + ID3FN_OWNER, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_3_0, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DATA, // FIELD NAME + ID3FTY_BINARY, // FIELD TYPE + 0, // FIXED LEN + ID3V2_3_0, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + + +static ID3_FieldDef ID3FD_Registration[] = +{ + { + ID3FN_OWNER, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_3_0, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_ID, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_3_0, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DATA, // FIELD NAME + ID3FTY_BINARY, // FIELD TYPE + 0, // FIXED LEN + ID3V2_3_0, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_InvolvedPeople[] = +{ + { + ID3FN_TEXTENC, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_TEXT, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_TEXTLIST, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + +static ID3_FieldDef ID3FD_CDM[] = +{ + { + ID3FN_DATA, // FIELD NAME + ID3FTY_BINARY, // FIELD TYPE + 0, // FIXED LEN + ID3V2_2_1, // INITIAL SPEC + ID3V2_2_1, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + } +}; + +static ID3_FieldDef ID3FD_SyncLyrics[] = +{ + { + ID3FN_TEXTENC, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_LANGUAGE, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 3, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_TIMESTAMPFORMAT, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_CONTENTTYPE, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DESCRIPTION, // FIELD NAME + ID3FTY_TEXTSTRING, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_CSTR | ID3FF_ENCODABLE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_DATA, // FIELD NAME + ID3FTY_BINARY, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; + + +/* + * Currently unused + */ +#if defined _UNDEFINED_ +static ID3_FieldDef ID3FD_Volume[] = +{ + { + ID3FN_VOLUMEADJ, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_NUMBITS, // FIELD NAME + ID3FTY_INTEGER, // FIELD TYPE + 1, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_NONE, // FLAGS + ID3FN_NOFIELD // LINKED FIELD + }, + { + ID3FN_VOLCHGRIGHT, // FIELD NAME + ID3FTY_BITFIELD, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_ADJUSTEDBY, // FLAGS + ID3FN_NUMBITS // LINKED FIELD + }, + { + ID3FN_VOLCHGLEFT, // FIELD NAME + ID3FTY_BITFIELD, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_ADJUSTEDBY, // FLAGS + ID3FN_NUMBITS // LINKED FIELD + }, + { + ID3FN_PEAKVOLRIGHT, // FIELD NAME + ID3FTY_BITFIELD, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_ADJUSTEDBY, // FLAGS + ID3FN_NUMBITS // LINKED FIELD + }, + { + ID3FN_PEAKVOLLEFT, // FIELD NAME + ID3FTY_BITFIELD, // FIELD TYPE + 0, // FIXED LEN + ID3V2_EARLIEST, // INITIAL SPEC + ID3V2_LATEST, // ENDING SPEC + ID3FF_ADJUSTEDBY, // FLAGS + ID3FN_NUMBITS // LINKED FIELD + }, + { ID3FN_NOFIELD } +}; +#endif /* _UNDEFINED_ */ + +// **** Currently Implemented Frames +// APIC PIC ID3FID_PICTURE Attached picture +// COMM COM ID3FID_COMMENT Comments +// ENCR ID3FID_CRYPTOREG Encryption method registration +// GEOB GEO ID3FID_GENERALOBJECT General encapsulated object +// GRID ID3FID_GROUPINGREG Group identification registration +// IPLS IPL ID3FID_INVOLVEDPEOPLE Involved people list +// LINK LNK ID3FID_LINKEDINFO Linked information +// PCNT CNT ID3FID_PLAYCOUNTER Play counter +// POPM POP ID3FID_POPULARIMETER Popularimeter +// PRIV ID3FID_PRIVATE Private frame +// SYLT SLT ID3FID_SYNCEDLYRICS Synchronized lyric/text +// TALB TAL ID3FID_ALBUM Album/Movie/Show title +// TBPM TBP ID3FID_BPM BPM (beats per minute) +// TCOM TCM ID3FID_COMPOSER Composer +// TCON TCO ID3FID_CONTENTTYPE Content type +// TCOP TCR ID3FID_COPYRIGHT Copyright message +// TDAT TDA ID3FID_DATE Date +// TDLY TDY ID3FID_PLAYLISTDELAY Playlist delay +// TENC TEN ID3FID_ENCODEDBY Encoded by +// TEXT TXT ID3FID_LYRICIST Lyricist/Text writer +// TFLT TFT ID3FID_FILETYPE File type +// TIME TKE ID3FID_TIME Time +// TIT1 TIM ID3FID_CONTENTGROUP Content group description +// TIT2 TT1 ID3FID_TITLE Title/songname/content description +// TIT3 TT2 ID3FID_SUBTITLE Subtitle/Description refinement +// TKEY TT3 ID3FID_INITIALKEY Initial key +// TLAN TLA ID3FID_LANGUAGE Language(s) +// TLEN TLE ID3FID_SONGLEN Length +// TMED TMT ID3FID_MEDIATYPE Media type +// TOAL TOT ID3FID_ORIGALBUM Original album/movie/show title +// TOFN TOF ID3FID_ORIGFILENAME Original filename +// TOLY TOL ID3FID_ORIGLYRICIST Original lyricist(s)/text writer(s) +// TOPE TOA ID3FID_ORIGARTIST Original artist(s)/performer(s) +// TORY TOR ID3FID_ORIGYEAR Original release year +// TOWN ID3FID_FILEOWNER File owner/licensee +// TPE1 TP1 ID3FID_LEADARTIST Lead performer(s)/Soloist(s) +// TPE2 TP2 ID3FID_BAND Band/orchestra/accompaniment +// TPE3 TP3 ID3FID_CONDUCTOR Conductor/performer refinement +// TPE4 TP4 ID3FID_MIXARTIST Interpreted, remixed, or otherwise modified +// TPOS TPA ID3FID_PARTINSET Part of a set +// TPUB TPB ID3FID_PUBLISHER Publisher +// TRCK TRK ID3FID_TRACKNUM Track number/Position in set +// TRDA TRD ID3FID_RECORDINGDATES Recording dates +// TRSN TRN ID3FID_NETRADIOSTATION Internet radio station name +// TRSO TRO ID3FID_NETRADIOOWNER Internet radio station owner +// TSIZ TSI ID3FID_SIZE Size +// TSRC TRC ID3FID_ISRC ISRC (international standard recording code) +// TSSE TSS ID3FID_ENCODERSETTINGS Software/Hardware and encoding settings +// TXXX TXX ID3FID_USERTEXT User defined text information +// TYER TYE ID3FID_YEAR Year +// UFID UFI ID3FID_UNIQUEFILEID Unique file identifier +// USER ID3FID_TERMSOFUSE Terms of use +// USLT ULT ID3FID_UNSYNCEDLYRICS Unsynchronized lyric/text transcription +// WCOM WCM ID3FID_WWWCOMMERCIALINFO Commercial information +// WCOP WCM ID3FID_WWWCOPYRIGHT Copyright/Legal infromation +// WOAF WCP ID3FID_WWWAUDIOFILE Official audio file webpage +// WOAR WAF ID3FID_WWWARTIST Official artist/performer webpage +// WOAS WAR ID3FID_WWWAUDIOSOURCE Official audio source webpage +// WORS WAS ID3FID_WWWRADIOPAGE Official internet radio station homepage +// WPAY WRA ID3FID_WWWPAYMENT Payment +// WPUB WPY ID3FID_WWWPUBLISHER Official publisher webpage +// WXXX WXX ID3FID_WWWUSER User defined URL link +// CDM ID3FID_METACOMPRESSION Compressed data meta frame + +// **** Currently unimplemented frames +// AENC CRA ID3FID_AUDIOCRYPTO Audio encryption +// COMR ID3FID_COMMERCIAL Commercial frame +// EQUA EQU ID3FID_EQUALIZATION Equalization +// ETCO ETC ID3FID_EVENTTIMING Event timing codes +// MCDI MCI ID3FID_CDID Music CD identifier +// MLLT MLL ID3FID_MPEGLOOKUP MPEG location lookup table +// OWNE ID3FID_OWNERSHIP Ownership frame +// POSS ID3FID_POSITIONSYNC Position synchronisation frame +// RBUF BUF ID3FID_BUFFERSIZE Recommended buffer size +// RVAD RVA ID3FID_VOLUMEADJ Relative volume adjustment +// RVRB REV ID3FID_REVERB Reverb +// SYTC STC ID3FID_SYNCEDTEMPO Synchronized tempo codes +// CRM ID3FID_METACRYPTO Encrypted meta frame +static ID3_FrameDef ID3_FrameDefs[] = +{ + // short long tag file + // frame id id id discrd discrd field defs description + {ID3FID_AUDIOCRYPTO, "CRA", "AENC", false, false, ID3FD_Unimplemented, "Audio encryption"}, + {ID3FID_PICTURE, "PIC", "APIC", false, false, ID3FD_Picture, "Attached picture"}, + {ID3FID_COMMENT, "COM", "COMM", false, false, ID3FD_GeneralText, "Comments"}, + {ID3FID_COMMERCIAL, "" , "COMR", false, false, ID3FD_Unimplemented, "Commercial"}, + {ID3FID_CRYPTOREG, "" , "ENCR", false, false, ID3FD_Registration, "Encryption method registration"}, + {ID3FID_EQUALIZATION, "EQU", "EQUA", false, true, ID3FD_Unimplemented, "Equalization"}, + {ID3FID_EVENTTIMING, "ETC", "ETCO", false, true, ID3FD_Unimplemented, "Event timing codes"}, + {ID3FID_GENERALOBJECT, "GEO", "GEOB", false, false, ID3FD_GEO, "General encapsulated object"}, + {ID3FID_GROUPINGREG, "" , "GRID", false, false, ID3FD_Registration, "Group identification registration"}, + {ID3FID_INVOLVEDPEOPLE, "IPL", "IPLS", false, false, ID3FD_InvolvedPeople,"Involved people list"}, + {ID3FID_LINKEDINFO, "LNK", "LINK", false, false, ID3FD_LinkedInfo, "Linked information"}, + {ID3FID_CDID, "MCI", "MCDI", false, false, ID3FD_Unimplemented, "Music CD identifier"}, + {ID3FID_MPEGLOOKUP, "MLL", "MLLT", false, true, ID3FD_Unimplemented, "MPEG location lookup table"}, + {ID3FID_OWNERSHIP, "" , "OWNE", false, false, ID3FD_Unimplemented, "Ownership frame"}, + {ID3FID_PRIVATE, "" , "PRIV", false, false, ID3FD_Private, "Private frame"}, + {ID3FID_PLAYCOUNTER, "CNT", "PCNT", false, false, ID3FD_PlayCounter, "Play counter"}, + {ID3FID_POPULARIMETER, "POP", "POPM", false, false, ID3FD_Popularimeter, "Popularimeter"}, + {ID3FID_POSITIONSYNC, "" , "POSS", false, true, ID3FD_Unimplemented, "Position synchronisation frame"}, + {ID3FID_BUFFERSIZE, "BUF", "RBUF", false, false, ID3FD_Unimplemented, "Recommended buffer size"}, + {ID3FID_VOLUMEADJ, "RVA", "RVAD", false, true, ID3FD_Unimplemented, "Relative volume adjustment"}, + {ID3FID_REVERB, "REV", "RVRB", false, false, ID3FD_Unimplemented, "Reverb"}, + {ID3FID_SYNCEDLYRICS, "SLT", "SYLT", false, false, ID3FD_SyncLyrics, "Synchronized lyric/text"}, + {ID3FID_SYNCEDTEMPO, "STC", "SYTC", false, true, ID3FD_Unimplemented, "Synchronized tempo codes"}, + {ID3FID_ALBUM, "TAL", "TALB", false, false, ID3FD_Text, "Album/Movie/Show title"}, + {ID3FID_BPM, "TBP", "TBPM", false, false, ID3FD_Text, "BPM (beats per minute)"}, + {ID3FID_COMPOSER, "TCM", "TCOM", false, false, ID3FD_Text, "Composer"}, + {ID3FID_CONTENTTYPE, "TCO", "TCON", false, false, ID3FD_Text, "Content type"}, + {ID3FID_COPYRIGHT, "TCR", "TCOP", false, false, ID3FD_Text, "Copyright message"}, + {ID3FID_DATE, "TDA", "TDAT", false, false, ID3FD_Text, "Date"}, + {ID3FID_PLAYLISTDELAY, "TDY", "TDLY", false, false, ID3FD_Text, "Playlist delay"}, + {ID3FID_ENCODEDBY, "TEN", "TENC", false, true, ID3FD_Text, "Encoded by"}, + {ID3FID_LYRICIST, "TXT", "TEXT", false, false, ID3FD_Text, "Lyricist/Text writer"}, + {ID3FID_FILETYPE, "TFT", "TFLT", false, false, ID3FD_Text, "File type"}, + {ID3FID_TIME, "TIM", "TIME", false, false, ID3FD_Text, "Time"}, + {ID3FID_CONTENTGROUP, "TT1", "TIT1", false, false, ID3FD_Text, "Content group description"}, + {ID3FID_TITLE, "TT2", "TIT2", false, false, ID3FD_Text, "Title/songname/content description"}, + {ID3FID_SUBTITLE, "TT3", "TIT3", false, false, ID3FD_Text, "Subtitle/Description refinement"}, + {ID3FID_INITIALKEY, "TKE", "TKEY", false, false, ID3FD_Text, "Initial key"}, + {ID3FID_LANGUAGE, "TLA", "TLAN", false, false, ID3FD_Text, "Language(s)"}, + {ID3FID_SONGLEN, "TLE", "TLEN", false, true, ID3FD_Text, "Length"}, + {ID3FID_MEDIATYPE, "TMT", "TMED", false, false, ID3FD_Text, "Media type"}, + {ID3FID_ORIGALBUM, "TOT", "TOAL", false, false, ID3FD_Text, "Original album/movie/show title"}, + {ID3FID_ORIGFILENAME, "TOF", "TOFN", false, false, ID3FD_Text, "Original filename"}, + {ID3FID_ORIGLYRICIST, "TOL", "TOLY", false, false, ID3FD_Text, "Original lyricist(s)/text writer(s)"}, + {ID3FID_ORIGARTIST, "TOA", "TOPE", false, false, ID3FD_Text, "Original artist(s)/performer(s)"}, + {ID3FID_ORIGYEAR, "TOR", "TORY", false, false, ID3FD_Text, "Original release year"}, + {ID3FID_FILEOWNER, "" , "TOWN", false, false, ID3FD_Text, "File owner/licensee"}, + {ID3FID_LEADARTIST, "TP1", "TPE1", false, false, ID3FD_Text, "Lead performer(s)/Soloist(s)"}, + {ID3FID_BAND, "TP2", "TPE2", false, false, ID3FD_Text, "Band/orchestra/accompaniment"}, + {ID3FID_CONDUCTOR, "TP3", "TPE3", false, false, ID3FD_Text, "Conductor/performer refinement"}, + {ID3FID_MIXARTIST, "TP4", "TPE4", false, false, ID3FD_Text, "Interpreted, remixed, or otherwise modified by"}, + {ID3FID_PARTINSET, "TPA", "TPOS", false, false, ID3FD_Text, "Part of a set"}, + {ID3FID_PUBLISHER, "TPB", "TPUB", false, false, ID3FD_Text, "Publisher"}, + {ID3FID_TRACKNUM, "TRK", "TRCK", false, false, ID3FD_Text, "Track number/Position in set"}, + {ID3FID_RECORDINGDATES, "TRD", "TRDA", false, false, ID3FD_Text, "Recording dates"}, + {ID3FID_NETRADIOSTATION, "TRN", "TRSN", false, false, ID3FD_Text, "Internet radio station name"}, + {ID3FID_NETRADIOOWNER, "TRO", "TRSO", false, false, ID3FD_Text, "Internet radio station owner"}, + {ID3FID_SIZE, "TSI", "TSIZ", false, true, ID3FD_Text, "Size"}, + {ID3FID_ISRC, "TRC", "TSRC", false, false, ID3FD_Text, "ISRC (international standard recording code)"}, + {ID3FID_ENCODERSETTINGS, "TSS", "TSSE", false, false, ID3FD_Text, "Software/Hardware and settings used for encoding"}, + {ID3FID_USERTEXT, "TXX", "TXXX", false, false, ID3FD_UserText, "User defined text information"}, + {ID3FID_YEAR, "TYE", "TYER", false, false, ID3FD_Text, "Year"}, + {ID3FID_UNIQUEFILEID, "UFI", "UFID", false, false, ID3FD_UFI, "Unique file identifier"}, + {ID3FID_TERMSOFUSE, "" , "USER", false, false, ID3FD_TermsOfUse, "Terms of use"}, + {ID3FID_UNSYNCEDLYRICS, "ULT", "USLT", false, false, ID3FD_GeneralText, "Unsynchronized lyric/text transcription"}, + {ID3FID_WWWCOMMERCIALINFO, "WCM", "WCOM", false, false, ID3FD_URL, "Commercial information"}, + {ID3FID_WWWCOPYRIGHT, "WCP", "WCOP", false, false, ID3FD_URL, "Copyright/Legal infromation"}, + {ID3FID_WWWAUDIOFILE, "WAF", "WOAF", false, false, ID3FD_URL, "Official audio file webpage"}, + {ID3FID_WWWARTIST, "WAR", "WOAR", false, false, ID3FD_URL, "Official artist/performer webpage"}, + {ID3FID_WWWAUDIOSOURCE, "WAS", "WOAS", false, false, ID3FD_URL, "Official audio source webpage"}, + {ID3FID_WWWRADIOPAGE, "WRA", "WORS", false, false, ID3FD_URL, "Official internet radio station homepage"}, + {ID3FID_WWWPAYMENT, "WPY", "WPAY", false, false, ID3FD_URL, "Payment"}, + {ID3FID_WWWPUBLISHER, "WPB", "WPUB", false, false, ID3FD_URL, "Official publisher webpage"}, + {ID3FID_WWWUSER, "WXX", "WXXX", false, false, ID3FD_UserURL, "User defined URL link"}, + {ID3FID_METACRYPTO, "CRM", "" , false, false, ID3FD_Unimplemented, "Encrypted meta frame"}, + {ID3FID_METACOMPRESSION, "CDM", "" , false, false, ID3FD_CDM, "Compressed data meta frame"}, + {ID3FID_NOFRAME} +}; + +/** \class ID3_Field field.h id3/field.h + ** \brief The representative class of an ID3v2 field. + ** + ** As a general rule, you need never create an object of this type. id3lib + ** uses them internally as part of the id3_frame class. You must know how to + ** interact with these objects, though, and that's what this section is about. + ** + ** The ID3_Field contains many overloaded methods to provide these facilities + ** for four different data types: integers, ASCII strings, Unicode strings, + ** and binary data. + ** + ** An integer field supports the Get(), Set(uint32), and operator=(uint32) + ** methods. + ** + ** Both types of strings support the GetNumTextItems() method. + ** + ** An ASCII string field supports the Get(char*, size_t, size_t)), + ** Set(const char*), Add(const char*), and operator=(const char*) methods. + ** + ** A Unicode field also supports Get(unicode_t*, size_t, size_t), + ** Set(const unicode_t*), Add(const unicode_t*), and + ** operator=(const unicode_t*). Without elaborating, the Unicode + ** methods behave exactly the same as their ASCII counterparts, taking + ** \c unicode_t pointers in place of \c char pointers. + ** + ** All strings in id3lib are handled internally as Unicode. This means that + ** when you set a field with an ASCII source type, it will be converted and + ** stored internally as a Unicode string. id3lib will handle all necessary + ** conversions when parsing, rendering, and retrieving. If you set a field as + ** an ASCII string, then try to read the string into a \c unicode_t buffer, + ** id3lib will automatically convert the string into Unicode so this will + ** function as expected. The same holds true in reverse. Of course, when + ** converting from Unicode to ASCII, you will experience problems when the + ** Unicode string contains characters that don't map to ISO-8859-1. + ** + ** A binary field supports the Get(uchar*, size_t), Set(const uchar*, size_t), + ** FromFile(const char*), and ToFile(const char*) methods. The binary field + ** holds miscellaneous data that can't easily be described any other way, such + ** as a JPEG image. + ** + ** As a general implementation note, you should be prepared to support all + ** fields in an id3lib frame, even if all fields in the id3lib version of the + ** frame aren't present in the id3v2 version. This is because of frames like + ** the picture frame, which changed slightly from one version of the id3v2 + ** standard to the next (the IMAGEFORMAT format in 2.0 changed to a MIMETYPE + ** in 3.0). If you support all id3lib fields in a given frame, id3lib can + ** generate the correct id3v2 frame for the id3v2 version you wish to support. + ** Alternatively, just support the fields you know will be used in, say, 3.0 + ** if you only plan to generate 3.0 tags. + ** + ** @author Dirk Mahoney + ** @version $Id: field.cpp,v 1.5 2008/01/15 11:20:36 stulleamgym Exp $ + ** \sa ID3_Tag + ** \sa ID3_Frame + ** \sa ID3_Err + **/ + +ID3_FieldImpl::ID3_FieldImpl() + : _id(ID3FN_NOFIELD), + _type(ID3FTY_INTEGER), + _spec_begin(ID3V2_EARLIEST), + _spec_end(ID3V2_LATEST), + _flags(0), + _changed(false), + _fixed_size(0), + _num_items(0), + _enc(ID3TE_NONE) +{ + this->Clear(); +} + +ID3_FieldImpl::ID3_FieldImpl(const ID3_FieldDef& def) + : _id(def._id), + _type(def._type), + _spec_begin(def._spec_begin), + _spec_end(def._spec_end), + _flags(def._flags), + _changed(false), + _fixed_size(def._fixed_size), + _num_items(0), + _enc((_type == ID3FTY_TEXTSTRING) ? ID3TE_ASCII : ID3TE_NONE) +{ + this->Clear(); +} + +ID3_FieldImpl::~ID3_FieldImpl() +{ +} + +/** Clears any data and frees any memory associated with the field + ** + ** \sa ID3_Tag::Clear() + ** \sa ID3_Frame::Clear() + **/ +void ID3_FieldImpl::Clear() +{ + switch (_type) + { + case ID3FTY_INTEGER: + { + _integer = 0; + break; + } + case ID3FTY_BINARY: + { + _binary.erase(); + if (_fixed_size > 0) + { + _binary.assign(_fixed_size, '\0'); + } + break; + } + case ID3FTY_TEXTSTRING: + { + _text.erase(); + if (_fixed_size > 0) + { + if (this->GetEncoding() == ID3TE_UNICODE) + { + _text.assign(_fixed_size * 2, '\0'); + } + else if (this->GetEncoding() == ID3TE_ASCII) + { + _text.assign(_fixed_size, '\0'); + } + } + else + _num_items = 0 ; + break; + } + default: + { + break; + } + } + _changed = true; + + return ; +} + +bool +ID3_FieldImpl::HasChanged() const +{ + return _changed; +} + +/** \fn size_t ID3_Field::Size() const + ** \brief Returns the size of a field. + ** + ** The value returned is dependent on the type of the field. For ASCII + ** strings, this returns the number of characters in the field, not including + ** any NULL-terminator. The same holds true for Unicode---it returns the + ** number of characters in the field, not bytes, and this does not include + ** the Unicode BOM, which isn't put in a Unicode string obtained by the + ** Get(unicode_t*, size_t, size_t) method anyway. For binary and + ** integer fields, this returns the number of bytes in the field. + ** + ** \code + ** size_t howBig = myFrame.GetField(ID3FN_DATA)->Size(); + ** \endcode + ** + ** \return The size of the field, either in bytes (for binary or integer + ** fields) or characters (for strings). + **/ + +size_t ID3_FieldImpl::BinSize() const +{ + if (_fixed_size > 0) + { + return _fixed_size; + } + size_t size = this->Size(); + if (_type == ID3FTY_TEXTSTRING) + { + ID3_TextEnc enc = this->GetEncoding(); + if (enc == ID3TE_UNICODE && size > 0) + { + size++; + } + if (_flags & ID3FF_CSTR) + { + size++; + } + if (enc == ID3TE_UNICODE) + { + size *= 2; + } + } + return size; +} + +size_t ID3_FieldImpl::Size() const +{ + size_t size = 0; + // check to see if we are within the legal limit for this field 0 means + // arbitrary length field + if (_fixed_size > 0) + { + size = _fixed_size; + } + else if (_type == ID3FTY_INTEGER) + { + size = sizeof(uint32); + } + else if (_type == ID3FTY_TEXTSTRING) + { + size = _text.size(); + if (ID3TE_IS_DOUBLE_BYTE_ENC(_enc)) { + size /= 2; + } + } + else + { + size = _binary.size(); + } + + return size; +} + +bool ID3_FieldImpl::Parse(ID3_Reader& reader) +{ + bool success = false; + switch (this->GetType()) + { + case ID3FTY_INTEGER: + { + success = this->ParseInteger(reader); + break; + } + + case ID3FTY_BINARY: + { + success = this->ParseBinary(reader); + break; + } + + case ID3FTY_TEXTSTRING: + { + success = this->ParseText(reader); + break; + } + + default: + { + ID3D_WARNING( "ID3_FieldImpl::Parse(): unknown field type" ); + break; + } + } + return success; +} + +ID3_FrameDef* ID3_FindFrameDef(ID3_FrameID id) +{ + ID3_FrameDef *info = NULL; + + for (size_t cur = 0; ID3_FrameDefs[cur].eID != ID3FID_NOFRAME; ++cur) + { + if (ID3_FrameDefs[cur].eID == id) + { + info = &ID3_FrameDefs[cur]; + break; + } + } + + return info; +} + +ID3_FrameID +ID3_FindFrameID(const char *id) +{ + ID3_FrameID fid = ID3FID_NOFRAME; + const size_t slen = strlen(id); + + for (size_t cur = 0; ID3_FrameDefs[cur].eID != ID3FID_NOFRAME; ++cur) + { + if (((strcmp(ID3_FrameDefs[cur].sShortTextID, id) == 0) && + slen == 3) || + ((strcmp(ID3_FrameDefs[cur].sLongTextID, id) == 0) && + slen == 4)) + { + fid = ID3_FrameDefs[cur].eID; + break; + } + } + + return fid; +} + +void ID3_FieldImpl::Render(ID3_Writer& writer) const +{ + switch (this->GetType()) + { + case ID3FTY_INTEGER: + { + RenderInteger(writer); + break; + } + + case ID3FTY_BINARY: + { + RenderBinary(writer); + break; + } + + case ID3FTY_TEXTSTRING: + { + RenderText(writer); + break; + } + + default: + { + ID3D_WARNING ( "ID3D_FieldImpl::Render(): unknown field type" ); + break; + } + } +} + +ID3_Field & +ID3_FieldImpl::operator=( const ID3_Field &rhs ) +{ + const ID3_FieldImpl* fld = (const ID3_FieldImpl*) &rhs; + if (this != &rhs && this->GetType() == fld->GetType()) + { + switch (fld->GetType()) + { + case ID3FTY_INTEGER: + { + this->SetInteger(fld->GetInteger()); + break; + } + case ID3FTY_TEXTSTRING: + { + this->SetEncoding(fld->GetEncoding()); + this->SetText(fld->GetText()); + break; + } + case ID3FTY_BINARY: + { + this->SetBinary(fld->GetBinary()); + break; + } + default: + { + break; + } + } + } + return *this; +} + +bool ID3_FieldImpl::SetEncoding(ID3_TextEnc enc) +{ + bool changed = this->IsEncodable() && (enc != this->GetEncoding()) && + (ID3TE_NONE < enc && enc < ID3TE_NUMENCODINGS); + if (changed) + { + _text = convert(_text, _enc, enc); + _enc = enc; + _changed = true; + } + return changed; +} + +/** \class ID3_FrameInfo field.h id3/field.h + ** \brief Provides information about the frame and field types supported by id3lib + ** + ** You normally only need (at most) one instance of the ID3_FrameInfo. It + ** has no member data -- only methods which provide information about the + ** frame types (and their component fields) supported by id3lib as defined + ** in field.cpp . + ** + ** Usage is straightforward. The following function uses ID3_FrameInfo + ** to display a summary of all the frames known to id3lib: + ** \code + ** + ** void ShowKnownFrameInfo { + ** ID3_FrameInfo myFrameInfo; + ** for (int cur = ID3FID_NOFRAME+1; cur <= myFrameInfo.MaxFrameID(); cur ++) + ** { + ** cout << "Short ID: " << myFrameInfo.ShortName(ID3_FrameID(cur)) << + ** " Long ID: " << myFrameInfo.LongName(ID3_FrameID(cur)) << + ** " Desription: " << myFrameInfo.Description(ID3_FrameID(cur)) << endl; + ** } + ** } + ** \endcode + ** + ** Functions are also provided to glean more information about the individual + ** fields which make up any given frame type. The following for() loop, + ** embedded into the previous for() loop would provide a raw look at such + ** information. Realize, of course, that the field type is meaningless + ** when printed. Only when it is taken in the context of the ID3_FieldType enum + ** does it take on any meaningful significance. + ** + ** \code + ** for (int cur = ID3FID_NOFRAME+1; cur <= fi.MaxFrameID(); cur ++) + ** { + ** int numfields = fi.NumFields(ID3_FrameID(cur)); + ** + ** cout << "ID: " << fi.LongName(ID3_FrameID(cur)) << + ** " FIELDS: " << numfields << endl; + ** for(int i=0;isShortTextID; + else + return NULL; +} + +char *ID3_FrameInfo::LongName(ID3_FrameID frameID) +{ + ID3_FrameDef *pFD = ID3_FindFrameDef(frameID); + if (pFD!=NULL) + return pFD->sLongTextID; + else + return NULL; +} + +const char *ID3_FrameInfo::Description(ID3_FrameID frameID) +{ + ID3_FrameDef *pFD = ID3_FindFrameDef(frameID); + if (pFD!=NULL) + return pFD->sDescription; + else + return NULL; +} + +int ID3_FrameInfo::MaxFrameID() +{ + return ID3FID_LASTFRAMEID-1; +} + +int ID3_FrameInfo::NumFields(ID3_FrameID frameID) +{ + int fieldnum=0; + ID3_FrameDef *pFD = ID3_FindFrameDef(frameID); + if (pFD!=NULL) + { + while (pFD->aeFieldDefs[fieldnum]._id != ID3FN_NOFIELD) + { + ++fieldnum; + } + } + return fieldnum; +} + +ID3_FieldType ID3_FrameInfo::FieldType(ID3_FrameID frameID, int fieldnum) +{ + ID3_FrameDef *pFD = ID3_FindFrameDef(frameID); + if (pFD!=NULL) + return (pFD->aeFieldDefs[fieldnum]._type); + else + return ID3FTY_NONE; +} + +size_t ID3_FrameInfo::FieldSize(ID3_FrameID frameID, int fieldnum) +{ + ID3_FrameDef *pFD = ID3_FindFrameDef(frameID); + if (pFD!=NULL) + return (pFD->aeFieldDefs[fieldnum]._fixed_size); + else + return 0; +} + +flags_t ID3_FrameInfo::FieldFlags(ID3_FrameID frameID, int fieldnum) +{ + ID3_FrameDef *pFD = ID3_FindFrameDef(frameID); + if (pFD!=NULL) + return (pFD->aeFieldDefs[fieldnum]._flags); + else + return 0; +} + diff --git a/id3lib/src/field_binary.cpp b/id3lib/src/field_binary.cpp new file mode 100644 index 0000000..0340ba9 --- /dev/null +++ b/id3lib/src/field_binary.cpp @@ -0,0 +1,211 @@ +// $Id: field_binary.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include +//#include +#include + +#include "field_impl.h" +#include "reader.h" +#include "writer.h" +#include "io_helpers.h" +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" + +#ifdef min +#undef min +#endif + +using namespace dami; + +size_t ID3_FieldImpl::Set(const uchar* data, size_t len) +{ + size_t size = 0; + if ((this->GetType() == ID3FTY_BINARY) && data && len) + { + BString str(data, len); + size = dami::min(len, this->SetBinary(str)); + } + return size; +} + +/** Copies the supplied unicode string to the field. + ** + ** Again, like the string types, the binary Set() function copies the data + ** so you may dispose of the source data after a call to this method. + **/ +size_t ID3_FieldImpl::SetBinary(BString data) //< data to assign to this field. +{ + size_t size = 0; + if (this->GetType() == ID3FTY_BINARY) + { + this->Clear(); + size_t fixed = _fixed_size; + size = data.size(); + if (fixed == 0) + { + _binary = data; + } + else + { + _binary.assign(data, 0, dami::min(size, fixed)); + if (size < fixed) + { + _binary.append(fixed - size, '\0'); + } + } + size = _binary.size(); + _changed = true; + } + return size; +} + +BString ID3_FieldImpl::GetBinary() const +{ + BString data; + if (this->GetType() == ID3FTY_BINARY) + { + data = _binary; + } + return data; +} + + +const uchar* ID3_FieldImpl::GetRawBinary() const +{ + const uchar* data = NULL; + if (this->GetType() == ID3FTY_BINARY) + { + data = _binary.data(); + } + return data; +} + + +/** Copies the field's internal string to the buffer. + ** + ** It copies the data in the field into the buffer, for as many bytes as the + ** field contains, or the size of buffer, whichever is smaller. + ** + ** \code + ** uchar buffer[1024]; + ** myFrame.GetField(ID3FN_DATA)->Get(buffer, sizeof(buffer)); + ** \endcode + **/ +size_t ID3_FieldImpl::Get(uchar *buffer, //< Destination of retrieved string + size_t max_bytes //< Max number of bytes to copy + ) const +{ + size_t bytes = 0; + if (this->GetType() == ID3FTY_BINARY) + { + bytes = dami::min(max_bytes, this->Size()); + if (NULL != buffer && bytes > 0) + { + ::memcpy(buffer, _binary.data(), bytes); + } + } + return bytes; +} + + +/** Copies binary data from the file specified to the field. + ** + ** \code + ** myFrame.GetField(ID3FN_DATA)->FromFile("mypic.jpg"); + ** \endcode + **/ +void ID3_FieldImpl::FromFile(const char *info //< Source filename + ) +{ + if (this->GetType() != ID3FTY_BINARY || NULL == info) + { + return; + } + + FILE* temp_file = ::fopen(info, "rb"); + if (temp_file != NULL) + { + ::fseek(temp_file, 0, SEEK_END); + size_t fileSize = ::ftell(temp_file); + ::fseek(temp_file, 0, SEEK_SET); + + uchar* buffer = new uchar[fileSize]; + if (buffer != NULL) + { + ::fread(buffer, 1, fileSize, temp_file); + + this->Set(buffer, fileSize); + + delete [] buffer; + } + + ::fclose(temp_file); + } +} + + +/** Copies binary data from the field to the specified file. + ** + ** \code + ** myFrame.GetField(ID3FN_DATA)->ToFile("output.bin"); + ** \endcode + **/ +void ID3_FieldImpl::ToFile(const char *info //< Destination filename + ) const +{ + if (this->GetType() != ID3FTY_BINARY || NULL == info) + { + return; + } + + size_t size = this->Size(); + if (size > 0) + { + FILE* temp_file = ::fopen(info, "wb"); + if (temp_file != NULL) + { + ::fwrite(_binary.data(), 1, size, temp_file); + ::fclose(temp_file); + } + } + + return ; +} + + +bool ID3_FieldImpl::ParseBinary(ID3_Reader& reader) +{ + // copy the remaining bytes, unless we're fixed length, in which case copy + // the minimum of the remaining bytes vs. the fixed length + _binary = io::readAllBinary(reader); + return true; +} + +void ID3_FieldImpl::RenderBinary(ID3_Writer& writer) const +{ + writer.writeChars(this->GetRawBinary(), this->Size()); +} + diff --git a/id3lib/src/field_def.h b/id3lib/src/field_def.h new file mode 100644 index 0000000..57e42fd --- /dev/null +++ b/id3lib/src/field_def.h @@ -0,0 +1,46 @@ +// -*- C++ -*- +// $Id: field_def.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_FIELD_DEF_H_ +#define _ID3LIB_FIELD_DEF_H_ + +#include "id3/globals.h" //has "id3/sized_types.h" + +struct ID3_FieldDef +{ + ID3_FieldID _id; + ID3_FieldType _type; + size_t _fixed_size; + ID3_V2Spec _spec_begin; + ID3_V2Spec _spec_end; + flags_t _flags; + ID3_FieldID _linked_field; + static const ID3_FieldDef* DEFAULT; +}; + +#endif + diff --git a/id3lib/src/field_impl.h b/id3lib/src/field_impl.h new file mode 100644 index 0000000..e5e87e5 --- /dev/null +++ b/id3lib/src/field_impl.h @@ -0,0 +1,153 @@ +// -*- C++ -*- +// $Id: field_impl.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_FIELD_IMPL_H_ +#define _ID3LIB_FIELD_IMPL_H_ + +#include +#include "field.h" +#include "id3/id3lib_strings.h" + +struct ID3_FieldDef; +struct ID3_FrameDef; +class ID3_Frame; +class ID3_Reader; + +class ID3_FieldImpl : public ID3_Field +{ + friend class ID3_FrameImpl; +public: + ~ID3_FieldImpl(); + + void Clear(); + + size_t Size() const; + size_t BinSize() const; + size_t GetNumTextItems() const; + + // integer field functions + ID3_Field& operator= (uint32 val) { this->Set(val); return *this; } + void Set(uint32); + uint32 Get() const; + + void SetInteger(uint32); + uint32 GetInteger() const; + + // ASCII string field functions + ID3_Field& operator= (const char* s) { this->Set(s); return *this; } + size_t Set(const char* data); + size_t Get(char*, size_t) const; + size_t Get(char*, size_t, size_t) const; + const char* GetRawText() const; + const char* GetRawTextItem(size_t) const; + size_t Add(const char* data); + + dami::String GetText() const; + dami::String GetTextItem(size_t) const; + size_t SetText(dami::String); + size_t AddText(dami::String); + + // Unicode string field functions + ID3_Field& operator= (const unicode_t* s) { this->Set(s); return *this; } + size_t Set(const unicode_t*); + size_t Get(unicode_t *buffer, size_t) const; + size_t Get(unicode_t *buffer, size_t, size_t) const; + size_t Add(const unicode_t*); + const unicode_t* GetRawUnicodeText() const; + const unicode_t* GetRawUnicodeTextItem(size_t) const; + + // binary field functions + size_t Set(const uchar* buf, size_t size); + size_t Set(const char* buf, size_t size) + { + return this->Set(reinterpret_cast(buf), size); + } + size_t Get(uchar*, size_t) const; + const uchar* GetRawBinary() const; + void FromFile(const char*); + void ToFile(const char *sInfo) const; + + size_t SetBinary(dami::BString); + dami::BString GetBinary() const; + + // miscelaneous functions + ID3_Field& operator=( const ID3_Field & ); + bool InScope(ID3_V2Spec spec) const + { return _spec_begin <= spec && spec <= _spec_end; } + + ID3_FieldID GetID() const { return _id; } + ID3_FieldType GetType() const { return _type; } + bool SetEncoding(ID3_TextEnc enc); + ID3_TextEnc GetEncoding() const { return _enc; } + bool IsEncodable() const { return (_flags & ID3FF_ENCODABLE) > 0; } + + + void Render(ID3_Writer&) const; + bool Parse(ID3_Reader&); + bool HasChanged() const; + +private: + size_t SetText_i(dami::String); + size_t AddText_i(dami::String); + +private: + // To prevent public instantiation, the constructor is made private + ID3_FieldImpl(); + ID3_FieldImpl(const ID3_FieldDef&); + + const ID3_FieldID _id; // the ID of this field + const ID3_FieldType _type; // what type is this field or should be + const ID3_V2Spec _spec_begin; // spec end + const ID3_V2Spec _spec_end; // spec begin + const flags_t _flags; // special field flags + mutable bool _changed; // field changed since last parse/render? + + dami::BString _binary; // for binary strings + dami::String _text; // for ascii strings + uint32 _integer; // for numbers + + const size_t _fixed_size; // for fixed length fields (0 if not) + size_t _num_items; // the number of items in the text string + ID3_TextEnc _enc; // encoding for text fields +protected: + void RenderInteger(ID3_Writer&) const; + void RenderText(ID3_Writer&) const; + void RenderBinary(ID3_Writer&) const; + + bool ParseInteger(ID3_Reader&); + bool ParseText(ID3_Reader&); + bool ParseBinary(ID3_Reader&); + +}; + + +// Ack! Not for public use +ID3_FrameDef *ID3_FindFrameDef(ID3_FrameID id); +ID3_FrameID ID3_FindFrameID(const char *id); + +#endif /* _ID3LIB_FIELD_H_ */ + diff --git a/id3lib/src/field_integer.cpp b/id3lib/src/field_integer.cpp new file mode 100644 index 0000000..774b2aa --- /dev/null +++ b/id3lib/src/field_integer.cpp @@ -0,0 +1,109 @@ +// $Id: field_integer.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include "field_impl.h" +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" +#include "io_helpers.h" + +using namespace dami; + +/** \fn ID3_Field& ID3_Field::operator=(uint32 val) + ** \brief A shortcut for the Set method. + ** + ** \code + ** myFrame.GetField(ID3FN_PICTURETYPE)->= 0x0B; + ** \endcode + ** + ** \param val The data to assign to this field + ** \sa Set(uint32) + **/ + +/** \brief Sets the value of the field to the specified integer. + ** \param data The data to assign to this field + **/ +void ID3_FieldImpl::Set(uint32 val) +{ + this->SetInteger(val); +} + +void ID3_FieldImpl::SetInteger(uint32 val) +{ + if (this->GetType() == ID3FTY_INTEGER) + { + this->Clear(); + + _integer = val; + _changed = true; + } +} + +/** \fn uint32 ID3_Field::Get() const + ** \brief Returns the value of the integer field. + ** + ** \code + ** uint32 picType = myFrame.GetField(ID3FN_PICTURETYPE)->Get(); + ** \endcode + ** + ** \return The value of the integer field + **/ +uint32 ID3_FieldImpl::Get() const +{ + return this->GetInteger(); +} + +uint32 ID3_FieldImpl::GetInteger() const +{ + uint32 val = 0; + if (this->GetType() == ID3FTY_INTEGER) + { + val = _integer; + } + return val; +} + +bool ID3_FieldImpl::ParseInteger(ID3_Reader& reader) +{ + ID3D_NOTICE( "ID3_FieldImpl::ParseInteger(): beg = " << reader.getBeg() ); + ID3D_NOTICE( "ID3_FieldImpl::ParseInteger(): cur = " << reader.getCur() ); + ID3D_NOTICE( "ID3_FieldImpl::ParseInteger(): end = " << reader.getEnd() ); + bool success = false; + if (!reader.atEnd()) + { + this->Clear(); + size_t fixed = this->Size(); + size_t nBytes = (fixed > 0) ? fixed : sizeof(uint32); + this->Set(io::readBENumber(reader, nBytes)); + _changed = false; + success = true; + } + return success; +} + +void ID3_FieldImpl::RenderInteger(ID3_Writer& writer) const +{ + io::writeBENumber(writer, _integer, this->Size()); +} + diff --git a/id3lib/src/field_string_ascii.cpp b/id3lib/src/field_string_ascii.cpp new file mode 100644 index 0000000..0eb8050 --- /dev/null +++ b/id3lib/src/field_string_ascii.cpp @@ -0,0 +1,407 @@ +// $Id: field_string_ascii.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include "field_impl.h" +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" +#include "io_helpers.h" + +#ifdef min +#undef min +#endif + +using namespace dami; + +/** \fn ID3_Field& ID3_Field::operator=(const char* data) + ** \brief Shortcut for the Set operator. + ** \param data The string to assign to this field + ** \sa Set(const char*) + **/ + +/** \brief Copies the supplied string to the field. + ** You may dispose of the source string after a call to this method. + ** \code + ** myFrame.GetField(ID3FN_TEXT)->Set("ID3Lib is very cool!"); + ** \endcode + **/ +size_t ID3_FieldImpl::Set(const char* data) +{ + size_t len = 0; + if ((this->GetType() == ID3FTY_TEXTSTRING) && data) + { + String str(data); + len = this->SetText_i(str); + } + return len; +} + +// the ::Get() function for ASCII + +/** Copies the contents of the field into the supplied buffer, up to the + ** number of characters specified; for fields with multiple entries, the + ** optional third parameter indicates which of the fields to retrieve. + ** + ** The third parameter is useful when using text lists (see Add(const char*) + ** for more details). The default value for this third parameter is 1, + ** which returns the entire string if the field contains only one item. + ** + ** It returns the number of characters (not bytes necessarily, and not + ** including any NULL terminator) of the supplied buffer that are now used. + ** + ** \code + ** char myBuffer[1024]; + ** size_t charsUsed = myFrame.GetField(ID3FN_TEXT)->Get(buffer, 1024); + ** \endcode + ** + ** It fills the buffer with as much data from the field as is present in the + ** field, or as large as the buffer, whichever is smaller. + ** + ** \code + ** char myBuffer[1024]; + ** size_t charsUsed = myFrame.GetField(ID3FN_TEXT)->Get(buffer, 1024, 3); + ** \endcode + ** + ** This fills the buffer with up to the first 1024 characters from the third + ** element of the text list. + ** + ** \sa Add(const char*) + **/ +size_t ID3_FieldImpl::Get(char* buffer, size_t maxLength) const +{ + size_t size = 0; + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_ASCII && + buffer != NULL && maxLength > 0) + { + String data = this->GetText(); + size = dami::min(maxLength, data.size()); + ::memcpy(buffer, data.data(), size); + if (size < maxLength) + { + buffer[size] = '\0'; + } + } + + return size; +} + +size_t ID3_FieldImpl::Get(char* buf, size_t maxLen, size_t index) const +{ + size_t size = 0; + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_ASCII && + buf != NULL && maxLen > 0) + { + String data = this->GetTextItem(index); + size = dami::min(maxLen, data.size()); + ::memcpy(buf, data.data(), size); + if (size < maxLen) + { + buf[size] = '\0'; + } + } + return size; +} + +String ID3_FieldImpl::GetText() const +{ + String data; + if (this->GetType() == ID3FTY_TEXTSTRING) + { + data = _text; + } + return data; +} + +String ID3_FieldImpl::GetTextItem(size_t index) const +{ + String data; + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_ASCII) + { + const char* raw = this->GetRawTextItem(index); + if (raw != NULL) + { + data = raw; + } + } + return data; +} + +namespace +{ + String getFixed(String data, size_t size) + { + String text(data, 0, size); + if (text.size() < size) + { + text.append(size - text.size(), '\0'); + } + return text; + } +} + + +size_t ID3_FieldImpl::SetText_i(String data) +{ + this->Clear(); + if (_fixed_size > 0) + { + _text = getFixed(data, _fixed_size); + } + else + { + _text = data; + } + ID3D_NOTICE( "SetText_i: text = \"" << _text << "\"" ); + _changed = true; + + if (_text.size() == 0) + { + _num_items = 0; + } + else + { + _num_items = 1; + } + + return _text.size(); +} + +size_t ID3_FieldImpl::SetText(String data) +{ + size_t len = 0; + if (this->GetType() == ID3FTY_TEXTSTRING) + { + len = this->SetText_i(data); + } + return len; +} + + +/** For fields which support this feature, adds a string to the list of + ** strings currently in the field. + ** + ** This is useful for using id3v2 frames such as the involved people list, + ** composer, and part of setp. You can use the GetNumTextItems() method to + ** find out how many such items are in a list. + ** + ** \code + ** myFrame.GetField(ID3FN_TEXT)->Add("this is a test"); + ** \endcode + ** + ** \param string The string to add to the field + **/ +size_t ID3_FieldImpl::AddText_i(String data) +{ + size_t len = 0; // how much of str we copied into this field (max is strLen) + ID3D_NOTICE ("ID3_FieldImpl::AddText_i: Adding \"" << data << "\"" ); + if (this->GetNumTextItems() == 0) + { + // there aren't any text items in the field so just assign the string to + // the field + len = this->SetText_i(data); + } + else + { + + // ASSERT(_fixed_size == 0) + _text += '\0'; + if (this->GetEncoding() == ID3TE_UNICODE) + { + _text += '\0'; + } + _text.append(data); + len = data.size(); + _num_items++; + } + + return len; +} + +size_t ID3_FieldImpl::AddText(String data) +{ + size_t len = 0; + if (this->GetType() == ID3FTY_TEXTSTRING) + { + len = this->AddText_i(data); + } + return len; +} + +size_t ID3_FieldImpl::Add(const char* data) +{ + size_t len = 0; + if (this->GetType() == ID3FTY_TEXTSTRING) + { + String str(data); + len = this->AddText_i(str); + } + return len; +} + +const char* ID3_FieldImpl::GetRawText() const +{ + const char* text = NULL; + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_ASCII) + { + text = _text.c_str(); + } + return text; +} + +const char* ID3_FieldImpl::GetRawTextItem(size_t index) const +{ + const char* text = NULL; + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_ASCII && + index < this->GetNumTextItems()) + { + text = _text.c_str(); + for (size_t i = 0; i < index; ++i) + { + text += strlen(text) + 1; + } + } + return text; +} + +namespace +{ + String readEncodedText(ID3_Reader& reader, size_t len, ID3_TextEnc enc) + { + if (enc == ID3TE_ASCII) + { + return io::readText(reader, len); + } + return io::readUnicodeText(reader, len); + } + + String readEncodedString(ID3_Reader& reader, ID3_TextEnc enc) + { + if (enc == ID3TE_ASCII) + { + return io::readString(reader); + } + return io::readUnicodeString(reader); + } + + size_t writeEncodedText(ID3_Writer& writer, String data, ID3_TextEnc enc) + { + if (enc == ID3TE_ASCII) + { + return io::writeText(writer, data); + } + return io::writeUnicodeText(writer, data); + } + + size_t writeEncodedString(ID3_Writer& writer, String data, ID3_TextEnc enc) + { + if (enc == ID3TE_ASCII) + { + return io::writeString(writer, data); + } + return io::writeUnicodeString(writer, data); + } +} + +bool ID3_FieldImpl::ParseText(ID3_Reader& reader) +{ + ID3D_NOTICE( "ID3_Field::ParseText(): reader.getBeg() = " << reader.getBeg() ); + ID3D_NOTICE( "ID3_Field::ParseText(): reader.getCur() = " << reader.getCur() ); + ID3D_NOTICE( "ID3_Field::ParseText(): reader.getEnd() = " << reader.getEnd() ); + this->Clear(); + + ID3_TextEnc enc = this->GetEncoding(); + size_t fixed_size = this->Size(); + if (fixed_size) + { + ID3D_NOTICE( "ID3_Field::ParseText(): fixed size string" ); + // The string is of fixed length + String text = readEncodedText(reader, fixed_size, enc); + this->SetText(text); + ID3D_NOTICE( "ID3_Field::ParseText(): fixed size string = " << text ); + } + else if (_flags & ID3FF_LIST) + { + ID3D_NOTICE( "ID3_Field::ParseText(): text list" ); + // lists are always the last field in a frame. parse all remaining + // characters in the reader + while (!reader.atEnd()) + { + String text = readEncodedString(reader, enc); + this->AddText(text); + ID3D_NOTICE( "ID3_Field::ParseText(): adding string = " << text ); + } + } + else if (_flags & ID3FF_CSTR) + { + ID3D_NOTICE( "ID3_Field::ParseText(): null terminated string" ); + String text = readEncodedString(reader, enc); + this->SetText(text); + ID3D_NOTICE( "ID3_Field::ParseText(): null terminated string = " << text ); + } + else + { + ID3D_NOTICE( "ID3_Field::ParseText(): last field string" ); + String text = readEncodedText(reader, reader.remainingBytes(), enc); + // not null terminated. + this->AddText(text); + ID3D_NOTICE( "ID3_Field::ParseText(): last field string = " << text ); + } + + _changed = false; + return true; +} + +void ID3_FieldImpl::RenderText(ID3_Writer& writer) const +{ + ID3_TextEnc enc = this->GetEncoding(); + + if (_flags & ID3FF_CSTR) + { + writeEncodedString(writer, _text, enc); + } + else + { + writeEncodedText(writer, _text, enc); + } + _changed = false; +}; + +/** Returns the number of items in a text list. + ** + ** \code + ** size_t numItems = myFrame.GetField(ID3FN_UNICODE)->GetNumItems(); + ** \endcode + ** + ** \return The number of items in a text list. + **/ +size_t ID3_FieldImpl::GetNumTextItems() const +{ + return _num_items; +} + diff --git a/id3lib/src/field_string_unicode.cpp b/id3lib/src/field_string_unicode.cpp new file mode 100644 index 0000000..29483dd --- /dev/null +++ b/id3lib/src/field_string_unicode.cpp @@ -0,0 +1,166 @@ +// $Id: field_string_unicode.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include "field_impl.h" +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" +#include "io_helpers.h" + +#ifdef min +#undef min +#endif + +using namespace dami; + +/** \fn ID3_Field& ID3_Field::operator=(const unicode_t*) + ** \brief Shortcut for the Set operator. + ** Performs similarly as operator=(const char*), taking a unicode_t + ** string as a parameter rather than an ascii string. + ** \sa Set(const unicode_t*) + ** \param string The string to assign to the field + **/ + +/** \brief Copies the supplied unicode string to the field. + ** + ** Performs similarly as the ASCII Set() method, taking a unicode_t string + ** as a parameter rather than an ascii string. + ** + ** \param string The unicode string to set this field to. + ** \sa Add(const unicode_t*) + **/ +size_t ID3_FieldImpl::Set(const unicode_t* data) +{ + size_t size = 0; + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_UNICODE && data) + { + String text((const char*) data, ucslen(data) * 2); + size = this->SetText_i(text); + } + return size; +} + +size_t ID3_FieldImpl::Add(const unicode_t* data) +{ + size_t size = 0; + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_UNICODE) + { + String text((const char*) data, ucslen(data) * 2); + size = this->AddText_i(text); + } + return size; +} + +/** Copies the contents of the field into the supplied buffer, up to the + ** number of characters specified; for fields with multiple entries, the + ** optional third parameter indicates which of the fields to retrieve. + ** + ** Performs similarly as the ASCII Get(char *, size_t, size_t) method, taking + ** a unicode_t string as a parameter rather than an ascii string. The + ** maxChars parameter still represents the maximum number of characters, not + ** bytes. + ** + ** \code + ** unicode_t myBuffer[1024]; + ** size_t charsUsed = myFrame.GetField(ID3FN_UNICODE)->Get(buffer, 1024); + ** \endcode + ** + ** \param buffer Where the field's data is copied to + ** \param maxChars The maximum number of characters to copy to the buffer. + ** \param itemNum For fields with multiple items (such as the involved + ** people frame, the item number to retrieve. + ** \sa Get(char *, size_t, size_t) + **/ +size_t ID3_FieldImpl::Get(unicode_t *buffer, size_t maxLength) const +{ + size_t length = 0; + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_UNICODE && + buffer != NULL && maxLength > 0) + { + size_t size = this->Size(); + length = dami::min(maxLength, size); + ::memcpy((void *)buffer, (void *)_text.data(), length * 2); + if (length < maxLength) + { + buffer[length] = NULL_UNICODE; + } + } + return length; +} + +const unicode_t* ID3_FieldImpl::GetRawUnicodeText() const +{ + const unicode_t* text = NULL; + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_UNICODE) + { + text = (unicode_t *)_text.data(); + } + return text; +} + +const unicode_t* ID3_FieldImpl::GetRawUnicodeTextItem(size_t index) const +{ + const unicode_t* text = NULL; + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_UNICODE && + index < this->GetNumTextItems()) + { + String unicode = _text + '\0' + '\0'; + text = (unicode_t *) unicode.data(); + for (size_t i = 0; i < index; ++i) + { + text += ucslen(text) + 1; + } + } + return text; +} + +size_t ID3_FieldImpl::Get(unicode_t *buffer, size_t maxLength, size_t itemNum) const +{ + size_t length = 0; + size_t total_items = this->GetNumTextItems(); + if (this->GetType() == ID3FTY_TEXTSTRING && + this->GetEncoding() == ID3TE_UNICODE && + buffer != NULL && maxLength > 0 && itemNum < total_items) + { + const unicode_t* text = this->GetRawUnicodeTextItem(itemNum); + if (NULL != text) + { + size_t length = dami::min(maxLength, ucslen(text)); + ::memcpy(buffer, text, length * 2); + if (length < maxLength) + { + buffer[length] = NULL_UNICODE; + } + } + } + + return length; +} + + diff --git a/id3lib/src/flags.h b/id3lib/src/flags.h new file mode 100644 index 0000000..7249261 --- /dev/null +++ b/id3lib/src/flags.h @@ -0,0 +1,56 @@ +// -*- C++ -*- +// $Id: flags.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_FLAGS_H_ +#define _ID3LIB_FLAGS_H_ + +#include "flags.h" + +class ID3_Flags +{ +public: + typedef flags_t TYPE; + + ID3_Flags() : _f(0) { ; } + virtual ~ID3_Flags() { ; } + + TYPE get() const { return _f; } + bool test(TYPE f) const { return (this->get() & f) == f; } + bool set(TYPE f) { bool r = (_f != f); _f = f; return r; } + bool add(TYPE f) { return this->set(this->get() | f); } + bool remove(TYPE f) { return this->set(this->get() & ~f); } + bool clear() { return this->set(0); } + bool set(TYPE f, bool b){ if (b) return this->add(f); return this->remove(f); } + + ID3_Flags& operator=(const ID3_Flags& f) + { if (this != &f) { this->set(f.get()); } return *this; } + +private: + TYPE _f; +}; + +#endif /* _ID3LIB_FLAGS_H_ */ diff --git a/id3lib/src/frame.cpp b/id3lib/src/frame.cpp new file mode 100644 index 0000000..538292c --- /dev/null +++ b/id3lib/src/frame.cpp @@ -0,0 +1,329 @@ +// $Id: frame.cpp,v 1.5 2008/01/15 11:20:37 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + + +#if defined HAVE_CONFIG_H +#include +#endif + +//#include "frame.h" +#include "readers.h" +#include "frame_impl.h" + +/** \class ID3_Frame frame.h id3/frame.h + ** \brief The representative class of an id3v2 frame. + ** + ** id3lib defines frames in a funny way. Using some nice c++ conventions, + ** ID3_FrameImpl class objects appear to be quite polymorphic; that is, they + ** can take on many forms. The same ID3_FrameImpl class provides the + ** facilities for the implementation of a complex APIC frame and for a simple + ** text frame. + ** + ** @author Dirk Mahoney + ** @version $Id: frame.cpp,v 1.5 2008/01/15 11:20:37 stulleamgym Exp $ + ** @see ID3_Tag + ** @see ID3_Field + ** @see ID3_Err + **/ + +/** Default constructor; accepts as a default parameter the type of frame + ** to create. + ** + ** The parameter which will internally set the frame's structure. See + ** SetID() for more details. + ** + ** @param id The type of frame to create + ** @see ID3_FrameID + ** @see SetID + **/ +ID3_Frame::ID3_Frame(ID3_FrameID id) + : _impl(new ID3_FrameImpl(id)) +{ +} + +ID3_Frame::ID3_Frame(const ID3_Frame& frame) + : _impl(new ID3_FrameImpl(frame)) +{ +} + +ID3_Frame::~ID3_Frame() +{ + delete _impl; +} + +/** Clears the frame of all data and resets the frame such that it can take + ** on the form of any id3v2 frame that id3lib supports. + ** + ** @see ID3_Tag::Clear + **/ +void ID3_Frame::Clear() +{ + _impl->Clear(); +} + +/** Returns the type of frame that the object represents. + ** + ** Useful in conjunction with ID3_Tag::Find() method + ** + ** @returns The type, or id, of the frame + ** @see ID3_Tag::Find + **/ +ID3_FrameID ID3_Frame::GetID() const +{ + return _impl->GetID(); +} + +/** Establishes the internal structure of an ID3_FrameImpl object so + ** that it represents the id3v2 frame indicated by the parameter + ** + ** Given an ID3_FrameID (a list of which is found in <id3/field.h>), + ** SetID() will structure the object according to the + ** frame you wish to implement. + ** + ** Either using this call or via the constructor, this must be the first + ** command performed on an ID3_FrameImpl object. + ** + ** \code + ** myFrame.SetID(ID3FID_TITLE); + ** \endcode + ** + ** @param id The type of frame this frame should be set to + ** @see ID3_FrameID + **/ +bool ID3_Frame::SetID(ID3_FrameID id) +{ + return _impl->SetID(id); +} + +bool ID3_Frame::SetSpec(ID3_V2Spec spec) +{ + return _impl->SetSpec(spec); +} + +ID3_V2Spec ID3_Frame::GetSpec() const +{ + return _impl->GetSpec(); +} + +/** Returns a pointer to the frame's internal field indicated by the + ** parameter. + ** + ** \code + ** ID3_TextEnc enc; + ** enc = (ID3_TextEnc) myFrame.GetField(ID3FN_TEXTENC)->Get(); + ** \endcode + ** + ** @param name The name of the field to be retrieved + ** @returns A reference to the desired field + **/ +ID3_Field& ID3_Frame::Field(ID3_FieldID fieldName) const +{ + return *this->GetField(fieldName); +} + +ID3_Field* ID3_Frame::GetField(ID3_FieldID fieldName) const +{ + return _impl->GetField(fieldName); +} + +size_t ID3_Frame::NumFields() const +{ + return _impl->NumFields(); +} + +/* +ID3_Field* ID3_Frame::GetFieldNum(size_t index) const +{ + return _impl->GetFieldNum(index); +} +*/ + +size_t ID3_Frame::Size() +{ + return _impl->Size(); +} + + +bool ID3_Frame::HasChanged() const +{ + return _impl->HasChanged(); +} + +ID3_Frame& ID3_Frame::operator=( const ID3_Frame &rFrame ) +{ + if (this != &rFrame) + { + *_impl = rFrame; + } + return *this; +} + +const char* ID3_Frame::GetDescription(ID3_FrameID id) +{ + return ID3_FrameImpl::GetDescription(id); +} + +const char* ID3_Frame::GetDescription() const +{ + return _impl->GetDescription(); +} + +const char* ID3_Frame::GetTextID() const +{ + return _impl->GetTextID(); +} + +bool ID3_Frame::Parse(ID3_Reader& reader) +{ + try // Klenotic: Catch errors and return false instead of crashing. + { + return _impl->Parse(reader); + } + catch(...) + { + ID3D_WARNING( "ID3_Frame::Parse: call to _impl->Parse() failed"); + return false; + } +} + +void ID3_Frame::Render(ID3_Writer& writer) const +{ + _impl->Render(writer); +} + +bool ID3_Frame::Contains(ID3_FieldID id) const +{ + return _impl->Contains(id); +} + +/** Sets the compression flag within the frame. When the compression flag is + ** is set, compression will be attempted. However, the frame might not + ** actually be compressed after it is rendered if the "compressed" data is + ** no smaller than the "uncompressed" data. + **/ +bool ID3_Frame::SetCompression(bool b) +{ + return _impl->SetCompression(b); +} + +/** Returns whether or not the compression flag is set. After parsing a tag, + ** this will indicate whether or not the frame was compressed. After + ** rendering a tag, however, it does not actually indicate if the frame is + ** compressed rendering. It only indicates whether or not compression was + ** attempted. A frame will not be compressed, even whent the compression + ** flag is set, if the "compressed" data is no smaller than the + ** "uncompressed" data. + **/ +bool ID3_Frame::GetCompression() const +{ + return _impl->GetCompression(); +} + +size_t ID3_Frame::GetDataSize() const +{ + return _impl->GetDataSize(); +} + +bool ID3_Frame::SetEncryptionID(uchar id) +{ + return _impl->SetEncryptionID(id); +} + +uchar ID3_Frame::GetEncryptionID() const +{ + return _impl->GetEncryptionID(); +} + +bool ID3_Frame::SetGroupingID(uchar id) +{ + return _impl->SetGroupingID(id); +} + +uchar ID3_Frame::GetGroupingID() const +{ + return _impl->GetGroupingID(); +} + +namespace +{ + class IteratorImpl : public ID3_Frame::Iterator + { + ID3_FrameImpl::iterator _cur; + ID3_FrameImpl::iterator _end; + public: + IteratorImpl(ID3_FrameImpl& frame) + : _cur(frame.begin()), _end(frame.end()) + { + } + + ID3_Field* GetNext() + { + ID3_Field* next = NULL; + while (next == NULL && _cur != _end) + { + next = *_cur; + ++_cur; + } + return next; + } + }; + + + class ConstIteratorImpl : public ID3_Frame::ConstIterator + { + ID3_FrameImpl::const_iterator _cur; + ID3_FrameImpl::const_iterator _end; + public: + ConstIteratorImpl(ID3_FrameImpl& frame) + : _cur(frame.begin()), _end(frame.end()) + { + } + const ID3_Field* GetNext() + { + ID3_Field* next = NULL; + while (next == NULL && _cur != _end) + { + next = *_cur; + ++_cur; + } + return next; + } + }; +} + +ID3_Frame::Iterator* +ID3_Frame::CreateIterator() +{ + return new IteratorImpl(*_impl); +} + +ID3_Frame::ConstIterator* +ID3_Frame::CreateIterator() const +{ + return new ConstIteratorImpl(*_impl); +} + diff --git a/id3lib/src/frame_def.h b/id3lib/src/frame_def.h new file mode 100644 index 0000000..cb8753d --- /dev/null +++ b/id3lib/src/frame_def.h @@ -0,0 +1,47 @@ +// -*- C++ -*- +// $Id: frame_def.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_FRAME_DEF_H_ +#define _ID3LIB_FRAME_DEF_H_ + +#include "id3/globals.h" //has "id3/sized_types.h" + +struct ID3_FieldDef; + +// Structure used for defining how frames are defined internally. +struct ID3_FrameDef +{ + ID3_FrameID eID; + char sShortTextID[3 + 1]; + char sLongTextID[4 + 1]; + bool bTagDiscard; + bool bFileDiscard; + const ID3_FieldDef* aeFieldDefs; + const char * sDescription; +}; + +#endif diff --git a/id3lib/src/frame_impl.cpp b/id3lib/src/frame_impl.cpp new file mode 100644 index 0000000..15b06ac --- /dev/null +++ b/id3lib/src/frame_impl.cpp @@ -0,0 +1,267 @@ +// $Id: frame_impl.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_CONFIG_H +#include +#endif + +//#include +#include "tag.h" +#include "frame_impl.h" +#include "field_impl.h" +#include "frame_def.h" +#include "field_def.h" + +ID3_FrameImpl::ID3_FrameImpl(ID3_FrameID id) + : _changed(false), + _bitset(), + _fields(), + _encryption_id('\0'), + _grouping_id('\0') +{ + this->SetSpec(ID3V2_LATEST); + this->SetID(id); +} + +ID3_FrameImpl::ID3_FrameImpl(const ID3_FrameHeader &hdr) + : _changed(false), + _bitset(), + _fields(), + _hdr(hdr), + _encryption_id('\0'), + _grouping_id('\0') +{ + this->_InitFields(); +} + +ID3_FrameImpl::ID3_FrameImpl(const ID3_Frame& frame) + : _changed(false), + _bitset(), + _fields(), + _encryption_id('\0'), + _grouping_id('\0') +{ + *this = frame; +} + +ID3_FrameImpl::~ID3_FrameImpl() +{ + Clear(); +} + +bool ID3_FrameImpl::_ClearFields() +{ + for (iterator fi = _fields.begin(); fi != _fields.end(); ++fi) + { + delete (ID3_FieldImpl*) *fi; + } + + _fields.clear(); + _bitset.reset(); + + _changed = true; + return true; +} + +void ID3_FrameImpl::Clear() +{ + this->_ClearFields(); + _hdr.Clear(); + _encryption_id = '\0'; + _grouping_id = '\0'; +} + +void ID3_FrameImpl::_InitFields() +{ + const ID3_FrameDef* info = _hdr.GetFrameDef(); + if (NULL == info) + { + // log this + ID3_Field* fld = new ID3_FieldImpl(ID3_FieldDef::DEFAULT[0]); + _fields.push_back(fld); + _bitset.set(fld->GetID()); + } + else + { + + for (size_t i = 0; info->aeFieldDefs[i]._id != ID3FN_NOFIELD; ++i) + { + ID3_Field* fld = new ID3_FieldImpl(info->aeFieldDefs[i]); + _fields.push_back(fld); + _bitset.set(fld->GetID()); + } + + _changed = true; + } +} + +bool ID3_FrameImpl::SetID(ID3_FrameID id) +{ + bool changed = (this->GetID() != id); + if (changed) + { + this->_SetID(id); + _changed = true; + } + return changed; +} + +bool ID3_FrameImpl::_SetID(ID3_FrameID id) +{ + bool changed = this->_ClearFields(); + changed = _hdr.SetFrameID(id) || changed; + this->_InitFields(); + return changed; +} + +bool ID3_FrameImpl::SetSpec(ID3_V2Spec spec) +{ + return _hdr.SetSpec(spec); +} + +ID3_V2Spec ID3_FrameImpl::GetSpec() const +{ + return _hdr.GetSpec(); +} + +ID3_Field* ID3_FrameImpl::GetField(ID3_FieldID fieldName) const +{ + ID3_Field* field = NULL; + if (this->Contains(fieldName)) + { + for (const_iterator fi = _fields.begin(); fi != _fields.end(); ++fi) + { + if ((*fi)->GetID() == fieldName) + { + field = *fi; + break; + } + } + } + return field; +} + +size_t ID3_FrameImpl::NumFields() const +{ + return _fields.size(); +} + +size_t ID3_FrameImpl::Size() +{ + size_t bytesUsed = _hdr.Size(); + + if (this->GetEncryptionID()) + { + bytesUsed++; + } + + if (this->GetGroupingID()) + { + bytesUsed++; + } + + ID3_TextEnc enc = ID3TE_ASCII; + for (iterator fi = _fields.begin(); fi != _fields.end(); ++fi) + { + if (*fi && (*fi)->InScope(this->GetSpec())) + { + if ((*fi)->GetID() == ID3FN_TEXTENC) + { + enc = (ID3_TextEnc) (*fi)->Get(); + } + else + { + (*fi)->SetEncoding(enc); + } + bytesUsed += (*fi)->BinSize(); + } + } + + return bytesUsed; +} + + +bool ID3_FrameImpl::HasChanged() const +{ + bool changed = _changed; + + for (const_iterator fi = _fields.begin(); fi != _fields.end(); ++fi) + { + if (*fi && (*fi)->InScope(this->GetSpec())) + { + changed = (*fi)->HasChanged(); + } + } + + return changed; +} + +ID3_FrameImpl & +ID3_FrameImpl::operator=( const ID3_Frame &rFrame ) +{ + ID3_FrameID eID = rFrame.GetID(); + this->SetID(eID); + ID3_Frame::ConstIterator* ri = rFrame.CreateIterator(); + iterator li = this->begin(); + while (li != this->end()) + { + ID3_Field* thisFld = *li++; + const ID3_Field* thatFld = ri->GetNext(); + if (thisFld != NULL && thatFld != NULL) + { + *thisFld = *thatFld; + } + } + delete ri; + this->SetEncryptionID(rFrame.GetEncryptionID()); + this->SetGroupingID(rFrame.GetGroupingID()); + this->SetCompression(rFrame.GetCompression()); + this->SetSpec(rFrame.GetSpec()); + _changed = false; + + return *this; +} + +const char* ID3_FrameImpl::GetDescription(ID3_FrameID id) +{ + ID3_FrameDef* myFrameDef = ID3_FindFrameDef(id); + if (myFrameDef != NULL) + { + return myFrameDef->sDescription; + } + return NULL; +} + +const char* ID3_FrameImpl::GetDescription() const +{ + const ID3_FrameDef* def = _hdr.GetFrameDef(); + if (def) + { + return def->sDescription; + } + return NULL; +} + diff --git a/id3lib/src/frame_impl.h b/id3lib/src/frame_impl.h new file mode 100644 index 0000000..d4666d6 --- /dev/null +++ b/id3lib/src/frame_impl.h @@ -0,0 +1,138 @@ +// -*- C++ -*- +// $Id: frame_impl.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_FRAME_IMPL_H_ +#define _ID3LIB_FRAME_IMPL_H_ + +#include +#ifndef HAVE_BITSET +#include "id3/id3lib_bitset" +#else +#include +#endif +#include "id3/id3lib_frame.h" +#include "header_frame.h" + +class ID3_FrameImpl +{ + typedef std::bitset Bitset; + typedef std::vector Fields; +public: + typedef Fields::iterator iterator; + typedef Fields::const_iterator const_iterator; +public: + ID3_FrameImpl(ID3_FrameID id = ID3FID_NOFRAME); + ID3_FrameImpl(const ID3_FrameHeader&); + ID3_FrameImpl(const ID3_Frame&); + + /// Destructor. + virtual ~ID3_FrameImpl(); + + void Clear(); + + bool SetID(ID3_FrameID id); + ID3_FrameID GetID() const { return _hdr.GetFrameID(); } + + ID3_Field* GetField(ID3_FieldID name) const; + + size_t NumFields() const; + + const char* GetDescription() const; + static const char* GetDescription(ID3_FrameID); + + const char* GetTextID() const { return _hdr.GetTextID(); } + + ID3_FrameImpl& operator=(const ID3_Frame &); + bool HasChanged() const; + bool Parse(ID3_Reader&); + void Render(ID3_Writer&) const; + size_t Size(); + bool Contains(ID3_FieldID fld) const + { return _bitset.test(fld); } + bool SetSpec(ID3_V2Spec); + ID3_V2Spec GetSpec() const; + + /** Sets the compression flag within the frame. When the compression flag is + ** is set, compression will be attempted. However, the frame might not + ** actually be compressed after it is rendered if the "compressed" data is + ** no smaller than the "uncompressed" data. + **/ + bool SetCompression(bool b) { return _hdr.SetCompression(b); } + /** Returns whether or not the compression flag is set. After parsing a tag, + ** this will indicate whether or not the frame was compressed. After + ** rendering a tag, however, it does not actually indicate if the frame is + ** compressed rendering. It only indicates whether or not compression was + ** attempted. A frame will not be compressed, even whent the compression + ** flag is set, if the "compressed" data is no smaller than the + ** "uncompressed" data. + **/ + bool GetCompression() const { return _hdr.GetCompression(); } + size_t GetDataSize() const { return _hdr.GetDataSize(); } + + bool SetEncryptionID(uchar id) + { + bool changed = id != _encryption_id; + _encryption_id = id; + _changed = _changed || changed; + _hdr.SetEncryption(true); + return changed; + } + uchar GetEncryptionID() const { return _encryption_id; } + bool SetGroupingID(uchar id) + { + bool changed = id != _grouping_id; + _grouping_id = id; + _changed = _changed || changed; + _hdr.SetGrouping(true); + return changed; + } + uchar GetGroupingID() const { return _grouping_id; } + + iterator begin() { return _fields.begin(); } + iterator end() { return _fields.end(); } + const_iterator begin() const { return _fields.begin(); } + const_iterator end() const { return _fields.end(); } + +protected: + bool _SetID(ID3_FrameID); + bool _ClearFields(); + void _InitFields(); + void _InitFieldBits(); + void _UpdateFieldDeps(); + +private: + mutable bool _changed; // frame changed since last parse/render? + Bitset _bitset; // which fields are present? + Fields _fields; + ID3_FrameHeader _hdr; // + uchar _encryption_id; // encryption id + uchar _grouping_id; // grouping id +} +; + +#endif /* _ID3LIB_FRAME_IMPL_H_ */ diff --git a/id3lib/src/frame_parse.cpp b/id3lib/src/frame_parse.cpp new file mode 100644 index 0000000..4974890 --- /dev/null +++ b/id3lib/src/frame_parse.cpp @@ -0,0 +1,192 @@ +// $Id: frame_parse.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_CONFIG_H +#include +#endif + +#include "frame_impl.h" +#include "id3/io_decorators.h" //has "readers.h" "io_helpers.h" "utils.h" + +using namespace dami; + +namespace +{ + bool parseFields(ID3_Reader& rdr, ID3_FrameImpl& frame) + { + int iLoop; + int iFields; + io::ExitTrigger et(rdr); + ID3_TextEnc enc = ID3TE_ASCII; // set the default encoding + ID3_V2Spec spec = frame.GetSpec(); + // parse the frame's fields + iFields = frame.NumFields(); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): num_fields = " << iFields ); + iLoop = 0; + for (ID3_FrameImpl::iterator fi = frame.begin(); fi != frame.end(); ++fi) + { + ID3_Field* fp = *fi; + ++iLoop; + + if (rdr.atEnd()) + { + // there's no remaining data to parse! + ID3D_WARNING( "ID3_FrameImpl::Parse(): out of data at postion " << + rdr.getCur() ); + if (iLoop == iFields) + { + //if we are at the last field, (the 'data' field) it's apparently + //an empty tag used for filling up padding, it's no problem + //break will set the current 'cursor' to the right spot outside the for loop + break; + } + return false; + } + + if (NULL == fp) + { + // Ack! Why is the field NULL? Log this... + ID3D_WARNING( "ID3_FrameImpl::Parse(): field is null" ); + continue; + } + + if (!fp->InScope(spec)) + { + ID3D_NOTICE( "ID3_FrameImpl::Parse(): field is not in scope" ); + // continue with the rest of the fields + continue; + } + + ID3D_NOTICE( "ID3_FrameImpl::Parse(): setting enc to " << enc ); + fp->SetEncoding(enc); + ID3_Reader::pos_type beg = rdr.getCur(); + et.setExitPos(beg); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): parsing field, cur = " << beg ); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): parsing field, end = " << + rdr.getEnd() ); + if (!fp->Parse(rdr) || rdr.getCur() == beg) + { + // nothing to parse! ack! parse error... + ID3D_WARNING( "ID3_FrameImpl::Parse(): no data parsed, bad parse" ); + return false; + } + + if (fp->GetID() == ID3FN_TEXTENC) + { + enc = static_cast(fp->Get()); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): found encoding = " << enc ); + } + } + et.setExitPos(rdr.getCur()); + + return true; + } +}; + +bool ID3_FrameImpl::Parse(ID3_Reader& reader) +{ + io::ExitTrigger et(reader); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): reader.getBeg() = " << reader.getBeg() ); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): reader.getCur() = " << reader.getCur() ); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): reader.getEnd() = " << reader.getEnd() ); + ID3_Reader::pos_type beg = reader.getCur(); + + if (!_hdr.Parse(reader) || reader.getCur() == beg) + { + ID3D_WARNING( "ID3_FrameImpl::Parse(): no header to parse" ); + return false; + } + ID3D_NOTICE( "ID3_FrameImpl::Parse(): after hdr, getCur() = " << reader.getCur() ); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): found frame! id = " << _hdr.GetTextID() ); + + // data is the part of the frame buffer that appears after the header + const size_t dataSize = _hdr.GetDataSize(); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): dataSize = " << dataSize ); + if (reader.getEnd() < beg + dataSize) + { + ID3D_WARNING( "ID3_FrameImpl::Parse(): not enough data to parse frame" ); + return false; + } + + if (dataSize > 16777216) //Klenotic: The max frame size is 16MB according to http://www.id3.org/easy.html. A corrupted tag that reports a frame size of (-1) will crash the program. + { + ID3D_WARNING( "ID3_FrameImpl::Parse(): frame size too large" ); + return false; + } + + + io::WindowedReader wr(reader, dataSize); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): window getBeg() = " << wr.getBeg() ); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): window getCur() = " << wr.getCur() ); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): window getEnd() = " << wr.getEnd() ); + + unsigned long origSize = 0; + if (_hdr.GetCompression()) + { + origSize = io::readBENumber(reader, sizeof(uint32)); + // allocate 2MB instead 4GB max in the decompressor later on (TODO decompressor should actually do the sanitycheck) + if (origSize > 2 * 1024 * 1024){ + ID3D_WARNING( "ID3_FrameImpl::Parse(): _hdr.GetCompression() exeeds sanity limit" ); + return false; + } + ID3D_NOTICE( "ID3_FrameImpl::Parse(): frame is compressed, origSize = " << origSize ); + } + + if (_hdr.GetEncryption()) + { + char ch = static_cast(wr.readChar()); + this->SetEncryptionID(ch); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): frame is encrypted, encryption_id = " << (int) ch ); + } + + if (_hdr.GetGrouping()) + { + char ch = static_cast(wr.readChar()); + this->SetGroupingID(ch); + ID3D_NOTICE( "ID3_FrameImpl::Parse(): frame is encrypted, grouping_id = " << (int) ch ); + } + + // set the type of frame based on the parsed header + this->_ClearFields(); + this->_InitFields(); + + bool success = false; + // expand out the data if it's compressed + if (!_hdr.GetCompression()) + { + success = parseFields(wr, *this); + } + else + { + io::CompressedReader csr(wr, origSize); + success = parseFields(csr, *this); + } + et.setExitPos(wr.getCur()); + + _changed = false; + return true; +} + diff --git a/id3lib/src/frame_render.cpp b/id3lib/src/frame_render.cpp new file mode 100644 index 0000000..f9b4898 --- /dev/null +++ b/id3lib/src/frame_render.cpp @@ -0,0 +1,161 @@ +// $Id: frame_render.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_CONFIG_H +#include +#endif + + + +//#include +#include +#include "../../zlib/zlib.h" + +#include "tag.h" +#include "frame_impl.h" +#include "id3/io_decorators.h" //has "readers.h" "io_helpers.h" "utils.h" +#include "io_strings.h" +#include "io_helpers.h" + +using namespace dami; + +namespace +{ + void renderFields(ID3_Writer& writer, const ID3_FrameImpl& frame) + { + ID3_TextEnc enc = ID3TE_ASCII; + for (ID3_FrameImpl::const_iterator fi = frame.begin(); fi != frame.end(); ++fi) + { + ID3_Field* fld = *fi; + if (fld != NULL && fld->InScope(frame.GetSpec())) + { + if (fld->GetID() == ID3FN_TEXTENC) + { + enc = static_cast(fld->Get()); + ID3D_NOTICE( "id3::v2::renderFields(): found encoding = " << enc ); + } + else + { + fld->SetEncoding(enc); + } + fld->Render(writer); + } + } + } +} + +void ID3_FrameImpl::Render(ID3_Writer& writer) const +{ + // Return immediately if we have no fields, which (usually) means we're + // trying to render a frame which has been Cleared or hasn't been initialized + if (!this->NumFields()) + { + return; + } + + ID3_FrameHeader hdr; + + const size_t hdr_size = hdr.Size(); + + // 1. Write out the field data to the buffer, with the assumption that + // we won't be decompressing, since this is the usual behavior + String flds; + io::StringWriter fldWriter(flds); + size_t origSize = 0; + if (!this->GetCompression()) + { + renderFields(fldWriter, *this); + origSize = flds.size(); + ID3D_NOTICE ( "ID3_FrameImpl::Render(): uncompressed fields" ); + } + else + { + io::CompressedWriter cr(fldWriter); + renderFields(cr, *this); + cr.flush(); + origSize = cr.getOrigSize(); + ID3D_NOTICE ( "ID3_FrameImpl::Render(): compressed fields, orig size = " << + origSize ); + } + + size_t fldSize = flds.size(); + ID3D_NOTICE ( "ID3_FrameImpl::Render(): field size = " << fldSize ); +// No need to not write empty frames, why would we not? They can be used to fill up padding space +// which is even recommended in the id3 spec. +// if (fldSize == 0) +// { +// ID3D_WARNING ( "ID3_FrameImpl::Render(): no field data" ); +// return; +// } + + // determine which flags need to be set + uchar eID = this->GetEncryptionID(), gID = this->GetGroupingID(); + ID3_FrameID fid = this->GetID(); + if (fid == ID3FID_NOFRAME) + { + const char *tid = this->GetTextID(); + hdr.SetUnknownFrame(tid); + } + else + { + hdr.SetFrameID(fid); + } + hdr.SetEncryption(eID > 0); + hdr.SetGrouping(gID > 0); + hdr.SetCompression(origSize > fldSize); + hdr.SetDataSize(fldSize + ((hdr.GetCompression() ? 4 : 0) + + (hdr.GetEncryption() ? 1 : 0) + + (hdr.GetGrouping() ? 1 : 0))); + + // write out the header + hdr.Render(writer); + + if (fldSize != 0) + { + // No-man's land! Not part of the header, not part of the data + if (hdr.GetCompression()) + { + io::writeBENumber(writer, origSize, sizeof(uint32)); + ID3D_NOTICE( "ID3_FrameImpl::Render(): frame is compressed, wrote origSize = " << origSize ); + } + if (hdr.GetEncryption()) + { + writer.writeChar(eID); + ID3D_NOTICE( "ID3_FrameImpl::Render(): frame is compressed, encryption id = " << eID ); + } + if (hdr.GetGrouping()) + { + writer.writeChar(gID); + ID3D_NOTICE( "ID3_FrameImpl::Render(): frame is compressed, grouping id = " << gID ); + } + + // Write the field data + writer.writeChars(flds.data(), fldSize); + } + _changed = false; +} + diff --git a/id3lib/src/globals.cpp b/id3lib/src/globals.cpp new file mode 100644 index 0000000..acf4287 --- /dev/null +++ b/id3lib/src/globals.cpp @@ -0,0 +1,50 @@ +// $Id: globals.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include "id3/globals.h" //has "id3/sized_types.h" + +#if defined HAVE_CONFIG_H +#include +#endif + +#ifdef _cplusplus +extern "C" +{ +#endif + + const char * const ID3LIB_NAME = _ID3LIB_NAME; + const char * const ID3LIB_VERSION = _ID3LIB_VERSION; + const char * const ID3LIB_FULL_NAME = _ID3LIB_FULLNAME; + const int ID3LIB_MAJOR_VERSION = _ID3LIB_MAJOR_VERSION; + const int ID3LIB_MINOR_VERSION = _ID3LIB_MINOR_VERSION; + const int ID3LIB_PATCH_VERSION = _ID3LIB_PATCH_VERSION; + const int ID3LIB_INTERFACE_AGE = _ID3LIB_INTERFACE_AGE; + const int ID3LIB_BINARY_AGE = _ID3LIB_BINARY_AGE; + +#ifdef _cplusplus +} +#endif + diff --git a/id3lib/src/header.cpp b/id3lib/src/header.cpp new file mode 100644 index 0000000..4996fd9 --- /dev/null +++ b/id3lib/src/header.cpp @@ -0,0 +1,63 @@ +// $Id: header.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include "header.h" + +#if defined HAVE_CONFIG_H +#include +#endif + +bool ID3_Header::SetSpec(ID3_V2Spec spec) +{ + static ID3_Header::Info _spec_info[] = + { + // Warning, EXT SIZE are minimum sizes, they can be bigger + // SIZEOF SIZEOF SIZEOF IS EXT EXT EXPERIM + // FRID FRSZ FRFL HEADER SIZE BIT + { 3, 3, 0, false, 0, false }, // ID3V2_2_0 + { 3, 3, 0, true, 8, true }, // ID3V2_2_1 + { 4, 4, 2, false, 10, false }, // ID3V2_3_0 + { 4, 4, 2, false, 6, false } // ID3V2_4_0 + }; + + bool changed = false; + if (spec < ID3V2_EARLIEST || spec > ID3V2_LATEST) + { + changed = _spec != ID3V2_UNKNOWN; + _spec = ID3V2_UNKNOWN; + _info = NULL; + } + else + { + changed = _spec != spec; + _spec = spec; + _info = &_spec_info[_spec - ID3V2_EARLIEST]; + } + _changed = _changed || changed; + return changed; +} + diff --git a/id3lib/src/header.h b/id3lib/src/header.h new file mode 100644 index 0000000..3b16525 --- /dev/null +++ b/id3lib/src/header.h @@ -0,0 +1,110 @@ +// -*- C++ -*- +// $Id: header.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_HEADER_H_ +#define _ID3LIB_HEADER_H_ + +#include "id3/globals.h" //has "id3/sized_types.h" +#include "flags.h" + +class ID3_Reader; +class ID3_Writer; + +class ID3_Header +{ +public: + struct Info + { + uchar frame_bytes_id; + uchar frame_bytes_size; + uchar frame_bytes_flags; + bool is_extended; + size_t extended_bytes; //including the extended header, so everything! + bool is_experimental; + }; + + ID3_Header() + : _spec (ID3V2_UNKNOWN), + _data_size (0), + _changed (false) + { + this->Clear(); + _changed = false; + } + virtual ~ID3_Header() { ; } + + virtual bool SetSpec(ID3_V2Spec); + /* */ ID3_V2Spec GetSpec() const { return _spec; } + + /* */ bool SetDataSize(size_t size) + { + bool changed = size != _data_size; + _changed = _changed || changed; + _data_size = size; + return changed; + } + /* */ size_t GetDataSize() const { return _data_size; } + + virtual bool Clear() + { + bool changed = this->SetDataSize(0); + if (this->GetSpec() == ID3V2_UNKNOWN) + { + this->SetSpec(ID3V2_LATEST); + changed = true; + } + changed = _flags.clear() || changed; + _changed = changed || _changed; + return changed; + } + virtual size_t Size() const = 0; + + virtual void Render(ID3_Writer&) const = 0; + virtual bool Parse(ID3_Reader&) = 0; + + ID3_Header &operator=( const ID3_Header &rhs) + { + if (this != &rhs) + { + this->SetSpec(rhs.GetSpec()); + this->SetDataSize(rhs.GetSpec()); + this->_flags = rhs._flags; + } + return *this; + } + +protected: + ID3_V2Spec _spec; // which version of the spec + size_t _data_size; // how big is the data? + ID3_Flags _flags; // header flags + Info* _info; // header info w.r.t. id3v2 spec + bool _changed; // has the header changed since parsing +} +; + +#endif /* _ID3LIB_HEADER_H */ diff --git a/id3lib/src/header_frame.cpp b/id3lib/src/header_frame.cpp new file mode 100644 index 0000000..74c940f --- /dev/null +++ b/id3lib/src/header_frame.cpp @@ -0,0 +1,241 @@ +// $Id: header_frame.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + + +#include +#include "header_frame.h" +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" +#include "frame_def.h" +#include "field_def.h" +#include "field_impl.h" +#include "io_helpers.h" + +using namespace dami; + +void ID3_FrameHeader::SetUnknownFrame(const char* id) +{ + Clear(); + _frame_def = new ID3_FrameDef; + if (NULL == _frame_def) + { + // log this; + return; + } + _frame_def->eID = ID3FID_NOFRAME; + _frame_def->bTagDiscard = false; + _frame_def->bFileDiscard = false; + _frame_def->aeFieldDefs = ID3_FieldDef::DEFAULT; + _frame_def->sDescription = NULL; + if (strlen(id) <= 3) + { + strcpy(_frame_def->sShortTextID, id); + strcpy(_frame_def->sLongTextID, ""); + } + else + { + strcpy(_frame_def->sLongTextID, id); + strcpy(_frame_def->sShortTextID, ""); + } + _dyn_frame_def = true; +} + +bool ID3_FrameHeader::SetFrameID(ID3_FrameID id) +{ + if (id == ID3FID_NOFRAME || id == this->GetFrameID()) + { + return false; + } + _frame_def = ID3_FindFrameDef(id); + _flags.set(TAGALTER, _frame_def->bTagDiscard); + _flags.set(FILEALTER, _frame_def->bFileDiscard); + + _changed = true; + return true; +} + +size_t ID3_FrameHeader::Size() const +{ + if (!_info) + { + return 0; + } + return + _info->frame_bytes_id + + _info->frame_bytes_size + + _info->frame_bytes_flags; +} + +bool ID3_FrameHeader::Parse(ID3_Reader& reader) +{ + ID3D_NOTICE( "ID3_FrameHeader::Parse(): getCur() = " << reader.getCur() ); + io::ExitTrigger et(reader); + if (!_info) + { + return false; + } + if (reader.getEnd() < reader.getCur() + 10) + { + return false; + } + + String textID = io::readText(reader, _info->frame_bytes_id); + + ID3D_NOTICE( "ID3_FrameHeader::Parse: textID = " << textID ); + ID3D_NOTICE( "ID3_FrameHeader::Parse: getCur() = " << reader.getCur() ); + + ID3_FrameID fid = ID3_FindFrameID(textID.c_str()); + if (ID3FID_NOFRAME == fid) + { + this->SetUnknownFrame(textID.c_str()); + ID3D_NOTICE( "ID3_FrameHeader::Parse: unknown frame id" ); + } + else + { + this->SetFrameID(fid); + } + + uint32 dataSize = io::readBENumber(reader, _info->frame_bytes_size); + ID3D_NOTICE( "ID3_FrameHeader::Parse: dataSize = " << dataSize ); + ID3D_NOTICE( "ID3_FrameHeader::Parse: getCur() = " << reader.getCur() ); + this->SetDataSize(dataSize); + + uint32 flags = io::readBENumber(reader, _info->frame_bytes_flags); + _flags.add(flags); + + ID3D_NOTICE( "ID3_FrameHeader::Parse: flags = " << flags ); + ID3D_NOTICE( "ID3_FrameHeader::Parse: getCur() = " << reader.getCur() ); + et.setExitPos(reader.getCur()); + + return true; +} + +void ID3_FrameHeader::Render(ID3_Writer& writer) const +{ + size_t size = 0; + + if (NULL == _frame_def) + { + // TODO: log this + ID3D_WARNING( "ID3_FrameHeader::Render(): _frame_def is NULL!" ); + return; + //ID3_THROW(ID3E_InvalidFrameID); + } + char *textID; + if (_info->frame_bytes_id == strlen(_frame_def->sShortTextID)) + { + textID = _frame_def->sShortTextID; + } + else + { + textID = _frame_def->sLongTextID; + } + + ID3D_NOTICE( "ID3_FrameHeader::Render(): writing " << textID << ", " << (int) _info->frame_bytes_size << " bytes"); + writer.writeChars((uchar *) textID, _info->frame_bytes_id); + + io::writeBENumber(writer, _data_size, _info->frame_bytes_size); + io::writeBENumber(writer, _flags.get(), _info->frame_bytes_flags); +} + +const char* ID3_FrameHeader::GetTextID() const +{ + char *textID = ""; + if (_info && _frame_def) + { + if (_info->frame_bytes_id == strlen(_frame_def->sShortTextID)) + { + textID = _frame_def->sShortTextID; + } + else + { + textID = _frame_def->sLongTextID; + } + } + return textID; +} + +ID3_FrameHeader& ID3_FrameHeader::operator=(const ID3_FrameHeader& hdr) +{ + if (this != &hdr) + { + this->Clear(); + this->ID3_Header::operator=(hdr); + if (!hdr._dyn_frame_def) + { + _frame_def = hdr._frame_def; + } + else + { + _frame_def = new ID3_FrameDef; + if (NULL == _frame_def) + { + // TODO: throw something here... + } + _frame_def->eID = hdr._frame_def->eID; + _frame_def->bTagDiscard = hdr._frame_def->bTagDiscard; + _frame_def->bFileDiscard = hdr._frame_def->bFileDiscard; + _frame_def->aeFieldDefs = hdr._frame_def->aeFieldDefs; + strcpy(_frame_def->sShortTextID, hdr._frame_def->sShortTextID); + strcpy(_frame_def->sLongTextID, hdr._frame_def->sLongTextID); + _dyn_frame_def = true; + } + } + return *this; +} + +ID3_FrameID ID3_FrameHeader::GetFrameID() const +{ + ID3_FrameID eID = ID3FID_NOFRAME; + if (NULL != _frame_def) + { + eID = _frame_def->eID; + } + + return eID; +} + +const ID3_FrameDef *ID3_FrameHeader::GetFrameDef() const +{ + return _frame_def; +} + +bool ID3_FrameHeader::Clear() +{ + bool changed = this->ID3_Header::Clear(); + if (_dyn_frame_def) + { + delete _frame_def; + _dyn_frame_def = false; + changed = true; + } + if (_frame_def) + { + _frame_def = NULL; + changed = true; + } + return changed; +} + diff --git a/id3lib/src/header_frame.h b/id3lib/src/header_frame.h new file mode 100644 index 0000000..c99bb2e --- /dev/null +++ b/id3lib/src/header_frame.h @@ -0,0 +1,89 @@ +// -*- C++ -*- +// $Id: header_frame.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_HEADER_FRAME_H_ +#define _ID3LIB_HEADER_FRAME_H_ + +#include "header.h" +#include "field.h" + +struct ID3_FrameDef; + +class ID3_FrameHeader : public ID3_Header +{ +public: + + enum + { + TAGALTER = 1 << 15, + FILEALTER = 1 << 14, + READONLY = 1 << 13, + COMPRESSION = 1 << 7, + ENCRYPTION = 1 << 6, + GROUPING = 1 << 5 + }; + + ID3_FrameHeader() : _frame_def(NULL), _dyn_frame_def(false) { ; } + virtual ~ID3_FrameHeader() { this->Clear(); } + + /* */ size_t Size() const; + /* */ bool Parse(ID3_Reader&); + /* */ void Render(ID3_Writer&) const; + /* */ bool SetFrameID(ID3_FrameID id); + /* */ ID3_FrameID GetFrameID() const; + const char* GetTextID() const; + const ID3_FrameDef* GetFrameDef() const; + /* */ bool Clear(); + ID3_FrameHeader& operator=(const ID3_FrameHeader&); + + bool SetCompression(bool b) { return this->SetFlags(COMPRESSION, b); } + bool SetEncryption(bool b) { return this->SetFlags(ENCRYPTION, b); } + bool SetGrouping(bool b) { return this->SetFlags(GROUPING, b); } + + bool GetCompression() const { return _flags.test(COMPRESSION); } + bool GetEncryption() const { return _flags.test(ENCRYPTION); } + bool GetGrouping() const { return _flags.test(GROUPING); } + bool GetReadOnly() const { return _flags.test(READONLY); } + void SetUnknownFrame(const char*); + +protected: + bool SetFlags(uint16 f, bool b) + { + bool changed = _flags.set(f, b); + _changed = _changed || changed; + return changed; + } +// following is moved to public due to bug unknownframes corrupting a tag +// void SetUnknownFrame(const char*); + +private: + ID3_FrameDef* _frame_def; + bool _dyn_frame_def; +} +; + +#endif /* _ID3LIB_HEADER_FRAME_ */ diff --git a/id3lib/src/header_tag.cpp b/id3lib/src/header_tag.cpp new file mode 100644 index 0000000..1262d9d --- /dev/null +++ b/id3lib/src/header_tag.cpp @@ -0,0 +1,224 @@ +// $Id: header_tag.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + + +#include "header_tag.h" +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" +#include "tag.h" +#include "io_helpers.h" +#include "spec.h" + +using namespace dami; + +const char* const ID3_TagHeader::ID = "ID3"; + +bool ID3_TagHeader::SetSpec(ID3_V2Spec spec) +{ + bool changed = this->ID3_Header::SetSpec(spec); + if (changed) + { + if (_info) + { + _flags.set(HEADER_FLAG_EXPERIMENTAL, _info->is_experimental); + _flags.set(HEADER_FLAG_EXTENDED, _info->is_extended); + } + } + return changed; +} + +size_t ID3_TagHeader::Size() const +{ + size_t bytesUsed = ID3_TagHeader::SIZE; + + if (_info->is_extended) + { + bytesUsed += _info->extended_bytes; + } + + return bytesUsed; +} + + +void ID3_TagHeader::Render(ID3_Writer& writer) const +{ + writer.writeChars((uchar *) ID, strlen(ID)); + + writer.writeChar(ID3_V2SpecToVer(ID3V2_LATEST)); + writer.writeChar(ID3_V2SpecToRev(ID3V2_LATEST)); + + // set the flags byte in the header + writer.writeChar(static_cast(_flags.get() & MASK8)); + io::writeUInt28(writer, this->GetDataSize()); //now includes the extended header + + // now we render the extended header + if (_flags.test(HEADER_FLAG_EXTENDED)) + { + if (this->GetSpec() == ID3V2_4_0) + { + io::writeUInt28(writer, 6); //write 4 bytes of v2.4.0 ext header containing size '6' + io::writeBENumber(writer, 1, 1); //write that it has only one flag byte (value '1') + io::writeBENumber(writer, 0, 1); //write flag byte with value '0' + } + else if (this->GetSpec() == ID3V2_3_0) + { + io::writeBENumber(writer, 6, sizeof(uint32)); + for (size_t i = 0; i < 6; ++i) + { + if (writer.writeChar('\0') == ID3_Writer::END_OF_WRITER) + { + break; + } + } + } + // else //not implemented + } +} + +bool ID3_TagHeader::Parse(ID3_Reader& reader) +{ + io::ExitTrigger et(reader); + if (!ID3_Tag::IsV2Tag(reader)) + { + ID3D_NOTICE( "ID3_TagHeader::Parse(): not an id3v2 header" ); + return false; + } + + uchar id[3]; + reader.readChars(id, 3); + // The spec version is determined with the MAJOR and MINOR OFFSETs + uchar major = static_cast(reader.readChar()); + uchar minor = static_cast(reader.readChar()); + this->SetSpec(ID3_VerRevToV2Spec(major, minor)); + + // Get the flags at the appropriate offset + _flags.set(static_cast(reader.readChar())); + + // set the data size + this->SetDataSize(io::readUInt28(reader)); + + if (_flags.test(HEADER_FLAG_EXTENDED) && this->GetSpec() == ID3V2_2_1) + { + //couldn't find anything about this in the draft specifying 2.2.1 -> http://www.id3.org/pipermail/id3v2/2000-April/000126.html + _flags.set(HEADER_FLAG_EXTENDED, false); + _info->extended_bytes = 0; + // rest is checked at ParseExtended() + } + et.setExitPos(reader.getCur()); + return true; +} + +void ID3_TagHeader::ParseExtended(ID3_Reader& reader) +{ + if (this->GetSpec() == ID3V2_3_0) + { +/* + Extended header size $xx xx xx xx + Extended Flags $xx xx + Size of padding $xx xx xx xx +*/ + // skip over header size, we are not using it anyway, we calculate it + reader.setCur(reader.getCur()+4); //Extended header size + //io::readBENumber(reader, 4); //Extended header size + uint16 tmpval = io::readBENumber(reader, 2); //Extended Flags + // skip over padding size, we are not using it anyway + reader.setCur(reader.getCur()+4); //Size of padding + // io::readBENumber(reader, 4); //Size of padding + if (tmpval != 0) //there is only one flag defined in ID3V2_3_0: crc + { + //skip over crc data, we are not using it anyway + reader.setCur(reader.getCur()+4); //Crc + //io::readBENumber(reader, 4); //Crc + _info->extended_bytes = 14; + } + else + _info->extended_bytes = 10; + } + if (this->GetSpec() == ID3V2_4_0) + { +/* + Extended header size 4 * %0xxxxxxx + Number of flag bytes $01 + Extended Flags $xx +*/ + uint16 i; + uint16 extrabytes; + + io::readUInt28(reader); + const int extflagbytes = reader.readChar(); //Number of flag bytes + ID3_Flags* extflags[1]; // ID3V2_4_0 has 1 flag byte, extflagbytes should be equal to 1 + for (i = 0; i < extflagbytes; ++i) + { + extflags[i] = new ID3_Flags; + extflags[i]->set(reader.readChar()); //flags + } + extrabytes = 0; + //extflags[0]->test(EXT_HEADER_FLAG_BIT1); // ID3V2_4_0 ext header flag bit 1 *should* be 0 + if (extflags[0]->test(EXT_HEADER_FLAG_BIT2)) + { + // ID3V2_4_0 ext header flag bit 2 = Tag is an update + // read size + extrabytes += 1; // add a byte for the char containing the extflagdatasize + const int extheaderflagdatasize = reader.readChar(); + extrabytes += extheaderflagdatasize; + // Set the cursor right; we are not parsing the data, no-one is using extended flags anyway + reader.setCur(reader.getCur() + extheaderflagdatasize); + //reader.readChars(buf, extheaderflagdatasize); //buf should be at least 127 bytes = max extended header flagdata size + } + if (extflags[0]->test(EXT_HEADER_FLAG_BIT3)) + { + // ID3V2_4_0 ext header flag bit 3 = CRC data present + // read size + extrabytes += 1; // add a byte for the char containing the extflagdatasize + const int extheaderflagdatasize = reader.readChar(); + extrabytes += extheaderflagdatasize; + // Set the cursor right; we are not parsing the data, no-one is using extended flags anyway + reader.setCur(reader.getCur() + extheaderflagdatasize); + //reader.readChars(buf, extheaderflagdatasize); //buf should be at least 127 bytes = max extended header flagdata size + } + if (extflags[0]->test(EXT_HEADER_FLAG_BIT4)) + { + // ID3V2_4_0 ext header flag bit 4 = Tag restrictions + // read size + extrabytes += 1; // add a byte for the char containing the extflagdatasize + const int extheaderflagdatasize = reader.readChar(); + extrabytes += extheaderflagdatasize; + // Set the cursor right; we are not parsing the data, no-one is using extended flags anyway + reader.setCur(reader.getCur() + extheaderflagdatasize); + //reader.readChars(buf, extheaderflagdatasize); //buf should be at least 127 bytes = max extended header flagdata size + } + _info->extended_bytes = 5 + extflagbytes + extrabytes; + } + // a bit unorthodox, but since we are not using any of the extended header, but were merely + // parsing it to get the cursor right, we delete it. Be Gone ! + _flags.set(HEADER_FLAG_EXTENDED, false); + if (_info) + { + _data_size -= _info->extended_bytes; + _info->extended_bytes = 0; + }//else there is a tag with a higher or lower version than supported +} + diff --git a/id3lib/src/header_tag.h b/id3lib/src/header_tag.h new file mode 100644 index 0000000..98d27af --- /dev/null +++ b/id3lib/src/header_tag.h @@ -0,0 +1,113 @@ +// -*- C++ -*- +// $Id: header_tag.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_HEADER_TAG_H_ +#define _ID3LIB_HEADER_TAG_H_ + +#include "header.h" + +class ID3_TagHeader : public ID3_Header +{ +public: + + enum + { + HEADER_FLAG_UNSYNC = 1 << 7, + HEADER_FLAG_EXTENDED = 1 << 6, + HEADER_FLAG_EXPERIMENTAL = 1 << 5, + HEADER_FLAG_FOOTER = 1 << 4 + }; + + enum + { + EXT_HEADER_FLAG_BIT1 = 1 << 7, + EXT_HEADER_FLAG_BIT2 = 1 << 6, + EXT_HEADER_FLAG_BIT3 = 1 << 5, + EXT_HEADER_FLAG_BIT4 = 1 << 4 + }; + + ID3_TagHeader() : ID3_Header() { ; } + virtual ~ID3_TagHeader() { ; } + ID3_TagHeader(const ID3_TagHeader& rhs) : ID3_Header() { *this = rhs; } + + bool SetSpec(ID3_V2Spec); + size_t Size() const; + void Render(ID3_Writer&) const; + bool Parse(ID3_Reader&); + void ParseExtended(ID3_Reader&); + ID3_TagHeader& operator=(const ID3_TagHeader&hdr) + { this->ID3_Header::operator=(hdr); return *this; } + + bool SetUnsync(bool b) + { + bool changed = _flags.set(HEADER_FLAG_UNSYNC, b); + _changed = _changed || changed; + return changed; + } + bool GetUnsync() const { return _flags.test(HEADER_FLAG_UNSYNC); } + bool SetExtended(bool b) + { + bool changed = _flags.set(HEADER_FLAG_EXTENDED, b); + _changed = _changed || changed; + return changed; + } + bool GetExtended() const { return _flags.test(HEADER_FLAG_EXTENDED); } + bool SetExperimental(bool b) + { + bool changed = _flags.set(HEADER_FLAG_EXPERIMENTAL, b); + _changed = _changed || changed; + return changed; + } + bool GetExperimental() const { return _flags.test(HEADER_FLAG_EXPERIMENTAL); } + bool SetFooter(bool b) + { + bool changed = _flags.set(HEADER_FLAG_FOOTER, b); + _changed = _changed || changed; + return changed; + } + bool GetFooter() const { return _flags.test(HEADER_FLAG_FOOTER); } + + // id3v2 tag header signature: $49 44 33 MM mm GG ss ss ss ss + // MM = major version (will never be 0xFF) + // mm = minor version (will never be 0xFF) + // ff = flags byte + // ss = size bytes (less than $80) + static const char* const ID; + enum + { + ID_SIZE = 3, + MAJOR_OFFSET = 3, + MINOR_OFFSET = 4, + FLAGS_OFFSET = 5, + SIZE_OFFSET = 6, + SIZE = 10 // does not include extented headers + }; + +}; + +#endif /* _ID3LIB_HEADER_TAG_H_ */ diff --git a/id3lib/src/helpers.cpp b/id3lib/src/helpers.cpp new file mode 100644 index 0000000..cd76ff4 --- /dev/null +++ b/id3lib/src/helpers.cpp @@ -0,0 +1,539 @@ +// $Id: helpers.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// Lots of hacking added to this file by Scott Wheeler (scott@slackorama.net) +// 11/02/2001 + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_CONFIG_H +#include +#endif + + + +#include + +#include "helpers.h" +#include "tag_impl.h" //has "tag.h" "header_tag.h" "frame.h" "field.h" "spec.h" "id3lib_strings.h" "utils.h" + +using namespace dami; + +String id3::v2::getString(const ID3_Frame* frame, ID3_FieldID fldName) +{ + if (!frame) + { + return ""; + } + ID3_Field* fp = frame->GetField(fldName); + if (!fp) + { + return ""; + } + ID3_TextEnc enc = fp->GetEncoding(); + fp->SetEncoding(ID3TE_ASCII); + + String text(fp->GetRawText(), fp->Size()); + + fp->SetEncoding(enc); + return text; +} + +String id3::v2::getStringAtIndex(const ID3_Frame* frame, ID3_FieldID fldName, + size_t nIndex) +{ + if (!frame) + { + return ""; + } + String text; + ID3_Field* fp = frame->GetField(fldName); + if (fp && fp->GetNumTextItems() < nIndex) + { + ID3_TextEnc enc = fp->GetEncoding(); + fp->SetEncoding(ID3TE_ASCII); + + text = fp->GetRawTextItem(nIndex); + + fp->SetEncoding(enc); + } + return text; +} + +size_t id3::v2::removeFrames(ID3_TagImpl& tag, ID3_FrameID id) +{ + size_t numRemoved = 0; + ID3_Frame* frame = NULL; + + while ((frame = tag.Find(id)) != NULL) + { + frame = tag.RemoveFrame(frame); + delete frame; + numRemoved++; + } + + return numRemoved; +} + +String id3::v2::getFrameText(const ID3_TagImpl& tag, ID3_FrameID id) +{ + ID3_Frame* frame = tag.Find(id); + return getString(frame, ID3FN_TEXT); +} + +ID3_Frame* id3::v2::setFrameText(ID3_TagImpl& tag, ID3_FrameID id, String text) +{ + ID3_Frame* frame = tag.Find(id); + if (!frame) + { + frame = new ID3_Frame(id); + if(!tag.AttachFrame(frame)) return NULL; + } + frame->GetField(ID3FN_TEXT)->Set(text.c_str()); + + return frame; +} + +//////////////////////////////////////////////////////////// + +ID3_Frame* id3::v2::hasArtist(const ID3_TagImpl& tag) +{ + ID3_Frame* fp = NULL; + (fp = tag.Find(ID3FID_LEADARTIST)) || + (fp = tag.Find(ID3FID_BAND)) || + (fp = tag.Find(ID3FID_CONDUCTOR)) || + (fp = tag.Find(ID3FID_COMPOSER)); + return fp; +} + +String id3::v2::getArtist(const ID3_TagImpl& tag) +{ + ID3_Frame* frame = hasArtist(tag); + return getString(frame, ID3FN_TEXT); +} + +ID3_Frame* id3::v2::setArtist(ID3_TagImpl& tag, String text) +{ + removeArtists(tag); + return setFrameText(tag, ID3FID_LEADARTIST, text); +} + +size_t id3::v2::removeArtists(ID3_TagImpl& tag) +{ + size_t numRemoved = 0; + ID3_Frame* frame = NULL; + + while ((frame = hasArtist(tag)) != NULL) + { + frame = tag.RemoveFrame(frame); + delete frame; + numRemoved++; + } + + return numRemoved; +} + +//////////////////////////////////////////////////////////// + +ID3_Frame* id3::v2::hasAlbum(const ID3_TagImpl& tag) +{ + ID3_Frame* frame = tag.Find(ID3FID_ALBUM); + return(frame); +} + +String id3::v2::getAlbum(const ID3_TagImpl& tag) +{ + return getFrameText(tag, ID3FID_ALBUM); +} + +ID3_Frame* id3::v2::setAlbum(ID3_TagImpl& tag, String text) +{ + return setFrameText(tag, ID3FID_ALBUM, text); +} + +size_t id3::v2::removeAlbums(ID3_TagImpl& tag) +{ + return removeFrames(tag, ID3FID_ALBUM); +} + +//////////////////////////////////////////////////////////// + +ID3_Frame* id3::v2::hasTitle(const ID3_TagImpl& tag) +{ + ID3_Frame* frame = tag.Find(ID3FID_TITLE); + return(frame); +} + +String id3::v2::getTitle(const ID3_TagImpl& tag) +{ + return getFrameText(tag, ID3FID_TITLE); +} + +ID3_Frame* id3::v2::setTitle(ID3_TagImpl& tag, String text) +{ + return setFrameText(tag, ID3FID_TITLE, text); +} + +size_t id3::v2::removeTitles(ID3_TagImpl& tag) +{ + return removeFrames(tag, ID3FID_TITLE); +} + +//////////////////////////////////////////////////////////// + +ID3_Frame* id3::v2::hasYear(const ID3_TagImpl& tag) +{ + ID3_Frame* frame = tag.Find(ID3FID_YEAR); + return(frame); +} + +String id3::v2::getYear(const ID3_TagImpl& tag) +{ + return getFrameText(tag, ID3FID_YEAR); +} + +ID3_Frame* id3::v2::setYear(ID3_TagImpl& tag, String text) +{ + return setFrameText(tag, ID3FID_YEAR, text); +} + +size_t id3::v2::removeYears(ID3_TagImpl& tag) +{ + return removeFrames(tag, ID3FID_YEAR); +} + +//////////////////////////////////////////////////////////// + +ID3_Frame* id3::v2::hasV1Comment(const ID3_TagImpl& tag) +{ + ID3_Frame* frame = NULL; + (frame = tag.Find(ID3FID_COMMENT, ID3FN_DESCRIPTION, STR_V1_COMMENT_DESC)) || + (frame = tag.Find(ID3FID_COMMENT, ID3FN_DESCRIPTION, "" )) || + (frame = tag.Find(ID3FID_COMMENT)); + return(frame); +} + +ID3_Frame* id3::v2::hasComment(const ID3_TagImpl& tag) +{ + ID3_Frame* frame = tag.Find(ID3FID_COMMENT); + return(frame); +} + +String id3::v2::getV1Comment(const ID3_TagImpl& tag) +{ + ID3_Frame* frame; + (frame = tag.Find(ID3FID_COMMENT, ID3FN_DESCRIPTION, STR_V1_COMMENT_DESC)) || + (frame = tag.Find(ID3FID_COMMENT, ID3FN_DESCRIPTION, "" )) || + (frame = tag.Find(ID3FID_COMMENT)); + return getString(frame, ID3FN_TEXT); +} + +String id3::v2::getComment(const ID3_TagImpl& tag, String desc) +{ + ID3_Frame* frame = tag.Find(ID3FID_COMMENT, ID3FN_DESCRIPTION, desc.c_str()); + return getString(frame, ID3FN_TEXT); +} + +ID3_Frame* id3::v2::setComment(ID3_TagImpl& tag, String text, String desc, + String lang) +{ + ID3D_NOTICE( "id3::v2::setComment: trying to find frame with description = " << desc ); + ID3_Frame* frame = NULL; + // See if there is already a comment with this description + for (ID3_TagImpl::iterator iter = tag.begin(); iter != tag.end(); ++iter) + { + frame = *iter; + if (frame == NULL) + { + continue; + } + if (frame->GetID() == ID3FID_COMMENT) + { + String tmpDesc = getString(frame, ID3FN_DESCRIPTION); + if (tmpDesc == desc) + { + ID3D_NOTICE( "id3::v2::setComment: found frame with description = " << desc ); + break; + } + } + frame = NULL; + } + if (frame == NULL) + { + ID3D_NOTICE( "id3::v2::setComment: creating new comment frame" ); + frame = new ID3_Frame(ID3FID_COMMENT); + if(!tag.AttachFrame(frame)) return NULL; + } + if (!frame) + { + ID3D_WARNING( "id3::v2::setComment: ack! no frame" ); + } + else + { + frame->GetField(ID3FN_LANGUAGE)->Set(lang.c_str()); + frame->GetField(ID3FN_DESCRIPTION)->Set(desc.c_str()); + frame->GetField(ID3FN_TEXT)->Set(text.c_str()); + } + + return frame; +} + +// Remove all comments from the tag +size_t id3::v2::removeAllComments(ID3_TagImpl& tag) +{ + return removeFrames(tag, ID3FID_COMMENT); +} + +// Remove all comments from the tag with the given description +size_t id3::v2::removeComments(ID3_TagImpl& tag, String desc) +{ + size_t numRemoved = 0; + + for (ID3_TagImpl::iterator iter = tag.begin(); iter != tag.end(); ++iter) + { + ID3_Frame* frame = *iter; + if (frame == NULL) + { + continue; + } + if (frame->GetID() == ID3FID_COMMENT) + { + // See if the description we have matches the description of the + // current comment. If so, remove the comment + String tmpDesc = getString(frame, ID3FN_DESCRIPTION); + if (tmpDesc == desc) + { + frame = tag.RemoveFrame(frame); + delete frame; + numRemoved++; + } + } + } + + return numRemoved; +} + +//////////////////////////////////////////////////////////// + +ID3_Frame* id3::v2::hasTrack(const ID3_TagImpl& tag) +{ + ID3_Frame* frame = tag.Find(ID3FID_TRACKNUM); + return(frame); +} + +String id3::v2::getTrack(const ID3_TagImpl& tag) +{ + return getFrameText(tag, ID3FID_TRACKNUM); +} + +size_t id3::v2::getTrackNum(const ID3_TagImpl& tag) +{ + String sTrack = getTrack(tag); + return ::atoi(sTrack.c_str()); +} + +ID3_Frame* id3::v2::setTrack(ID3_TagImpl& tag, uchar trk, uchar ttl) +{ + ID3_Frame* frame = NULL; + String track = toString((uint32)trk); + if (ttl > 0) + { + track += "/"; + track += toString((uint32)ttl); + } + setFrameText(tag, ID3FID_TRACKNUM, track); + + return frame; +} + +size_t id3::v2::removeTracks(ID3_TagImpl& tag) +{ + return removeFrames(tag, ID3FID_TRACKNUM); +} + +//////////////////////////////////////////////////////////// + +ID3_Frame* id3::v2::hasGenre(const ID3_TagImpl& tag) +{ + ID3_Frame* frame = tag.Find(ID3FID_CONTENTTYPE); + return(frame); +} + +String id3::v2::getGenre(const ID3_TagImpl& tag) +{ + return getFrameText(tag, ID3FID_CONTENTTYPE); +} + +size_t id3::v2::getGenreNum(const ID3_TagImpl& tag) +{ + String sGenre = getGenre(tag); + size_t ulGenre = 0xFF; + size_t size = sGenre.size(); + + // If the genre string begins with "(ddd)", where "ddd" is a number, then + // "ddd" is the genre number---get it + size_t i = 0; + if (i < size && size && sGenre[i] == '(') + { + ++i; + while (i < size && isdigit(sGenre[i])) + { + ++i; + } + if (i < size && sGenre[i] == ')') + { + // if the genre number is greater than 255, its invalid. + ulGenre = min(0xFF, atoi(&sGenre[1])); + } + } + + return ulGenre; +} + +ID3_Frame* id3::v2::setGenre(ID3_TagImpl& tag, size_t genre) +{ + String sGenre = "("; + sGenre += toString(genre) + ")"; + return setFrameText(tag, ID3FID_CONTENTTYPE, sGenre); +} + +size_t id3::v2::removeGenres(ID3_TagImpl& tag) +{ + return removeFrames(tag, ID3FID_CONTENTTYPE); +} + +//////////////////////////////////////////////////////////// + +ID3_Frame* id3::v2::hasLyrics(const ID3_TagImpl& tag) +{ + ID3_Frame* frame = tag.Find(ID3FID_UNSYNCEDLYRICS); + return(frame); +} + +String id3::v2::getLyrics(const ID3_TagImpl& tag) +{ + return getFrameText(tag, ID3FID_UNSYNCEDLYRICS); +} + +ID3_Frame* id3::v2::setLyrics(ID3_TagImpl& tag, String text, String desc, + String lang) +{ + ID3_Frame* frame = NULL; + // See if there is already a comment with this description + for (ID3_TagImpl::iterator iter = tag.begin(); iter != tag.end(); ++iter) + { + frame = *iter; + if (frame == NULL) + { + continue; + } + if (frame->GetID() == ID3FID_COMMENT) + { + String tmpDesc = getString(frame, ID3FN_DESCRIPTION); + if (tmpDesc == desc) + { + break; + } + } + frame = NULL; + } + if (frame == NULL) + { + frame = new ID3_Frame(ID3FID_UNSYNCEDLYRICS); + if(!tag.AttachFrame(frame)) return NULL; + } + frame->GetField(ID3FN_LANGUAGE)->Set(lang.c_str()); + frame->GetField(ID3FN_DESCRIPTION)->Set(desc.c_str()); + frame->GetField(ID3FN_TEXT)->Set(text.c_str()); + + return frame; +} + +size_t id3::v2::removeLyrics(ID3_TagImpl& tag) +{ + return removeFrames(tag, ID3FID_UNSYNCEDLYRICS); +} + +String id3::v2::getLyricist(const ID3_TagImpl& tag) +{ + return getFrameText(tag, ID3FID_LYRICIST); +} + +ID3_Frame* id3::v2::setLyricist(ID3_TagImpl& tag, String text) +{ + return setFrameText(tag, ID3FID_LYRICIST, text); +} + +size_t id3::v2::removeLyricists(ID3_TagImpl& tag) +{ + return removeFrames(tag, ID3FID_LYRICIST); +} + +//////////////////////////////////////////////////////////// + +ID3_Frame* id3::v2::hasSyncLyrics(const ID3_TagImpl& tag, String lang, String desc) +{ + ID3_Frame* frame=NULL; + (frame = tag.Find(ID3FID_SYNCEDLYRICS, ID3FN_LANGUAGE, lang)) || + (frame = tag.Find(ID3FID_SYNCEDLYRICS, ID3FN_DESCRIPTION, desc)); + return(frame); +} + +ID3_Frame* id3::v2::setSyncLyrics(ID3_TagImpl& tag, BString data, + ID3_TimeStampFormat format, String desc, + String lang, ID3_ContentType type) +{ + ID3_Frame* frame = NULL; + + // check if a SYLT frame of this language or descriptor already exists + (frame = tag.Find(ID3FID_SYNCEDLYRICS, ID3FN_LANGUAGE, lang)) || + (frame = tag.Find(ID3FID_SYNCEDLYRICS, ID3FN_DESCRIPTION, desc)); + + if (!frame) + { + frame = new ID3_Frame(ID3FID_SYNCEDLYRICS); + if(!tag.AttachFrame(frame)) return NULL; + } + frame->GetField(ID3FN_LANGUAGE)->Set(lang.c_str()); + frame->GetField(ID3FN_DESCRIPTION)->Set(desc.c_str()); + frame->GetField(ID3FN_TIMESTAMPFORMAT)->Set(format); + frame->GetField(ID3FN_CONTENTTYPE)->Set(type); + frame->GetField(ID3FN_DATA)->Set(data.data(), data.size()); + + return frame; +} + +BString id3::v2::getSyncLyrics(const ID3_TagImpl& tag, String lang, String desc) +{ + // check if a SYLT frame of this language or descriptor exists + ID3_Frame* frame = NULL; + (frame = tag.Find(ID3FID_SYNCEDLYRICS, ID3FN_LANGUAGE, lang)) || + (frame = tag.Find(ID3FID_SYNCEDLYRICS, ID3FN_DESCRIPTION, desc)) || + (frame = tag.Find(ID3FID_SYNCEDLYRICS)); + + // get the lyrics size + ID3_Field* fld = frame->GetField(ID3FN_DATA); + return BString(reinterpret_cast(fld->GetRawBinary()), fld->Size()); +} + diff --git a/id3lib/src/io.cpp b/id3lib/src/io.cpp new file mode 100644 index 0000000..fc176d3 --- /dev/null +++ b/id3lib/src/io.cpp @@ -0,0 +1,36 @@ +// $Id: io.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_CONFIG_H +#include +#endif + +#include "reader.h" +#include "writer.h" + +const ID3_Reader::int_type ID3_Reader::END_OF_READER = -1; +const ID3_Writer::int_type ID3_Writer::END_OF_WRITER = -1; + diff --git a/id3lib/src/io_decorators.cpp b/id3lib/src/io_decorators.cpp new file mode 100644 index 0000000..11d31e8 --- /dev/null +++ b/id3lib/src/io_decorators.cpp @@ -0,0 +1,300 @@ +// $Id: io_decorators.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_CONFIG_H +#include +#endif + + + +#include "id3/io_decorators.h" //has "readers.h" "io_helpers.h" "utils.h" +#include "../../zlib/zlib.h" + +using namespace dami; + +void io::WindowedReader::setWindow(pos_type beg, size_type size) +{ + ID3D_NOTICE( "WindowedReader::setWindow() [beg, size] = [" << + this->getBeg() << ", " << size << "]" ); + pos_type cur = this->getCur(); + + // reset the end marker so as to avoid errors + this->setEnd(_reader.getEnd()); + + // set the beginning marker + this->setBeg(beg); + + // since the characters might be more than a byte in size, we need to + // manually get all the chars to set the window appropriately + this->setCur(beg); + ID3D_NOTICE( "WindowedReader::setWindow(): after setCur(beg), cur = "<< + this->getCur() ); + + this->skipChars(size); + ID3D_NOTICE( "WindowedReader::setWindow(): after skipChars, cur = " << + this->getCur() ); + + this->setEnd(this->getCur()); + + ID3D_NOTICE( "WindowedReader::setWindow() [beg, cur, end] = [" << this->getBeg() << ", " << this->getCur() << ", " << this->getEnd() << "]" ); + + + // reset the stream + this->setCur(cur); +} + +ID3_Reader::pos_type io::WindowedReader::setBeg(pos_type beg) +{ + // make sure the position we want to set to isn't past the current + // end position or the superclass's beginning position + if (beg <= this->getEnd() && beg >= _reader.getBeg()) + { + _beg = beg; + } + else if (beg > this->getEnd()) + { + ID3D_WARNING( "WindowedReader::setBeg() failed, [beg, _end] = " << + beg << ", " << this->getEnd() << "]" ); + } + else + { + ID3D_WARNING( "WindowedReader::setBeg() failed, [beg, _beg] = " << + beg << ", " << this->getBeg() << "]" ); + } + return _beg; +} + +ID3_Reader::pos_type io::WindowedReader::setEnd(pos_type end) +{ + // make sure the position we want to set to isn't beforen the current + // beginning position or the superclass's end position + if (this->getBeg() <= end && end <= _reader.getEnd()) + { + _end = end; + } + else + { + ID3D_WARNING( "WindowedReader::setEnd() failed, end = " << end ); + ID3D_WARNING( "WindowedReader::setEnd() failed, beg = " << + this->getBeg() ); + ID3D_WARNING( "WindowedReader::setEnd() failed, super.end = " << + _reader.getEnd() ); + + } + return _end; +} + +ID3_Reader::int_type io::WindowedReader::readChar() +{ + int_type ch = END_OF_READER; + if (this->inWindow()) + { + ch = _reader.readChar(); + } + else + { + ID3D_WARNING( "io::WindowedReader::readChar: not in window, " << + "pos = " << this->getCur() << ", window = [" << + this->getBeg() << ", " << this->getEnd() << "]"); + } + return ch; +} + +ID3_Reader::int_type io::WindowedReader::peekChar() +{ + int_type ch = END_OF_READER; + if (this->inWindow()) + { + ch = _reader.peekChar(); + } + return ch; +} + +ID3_Reader::size_type io::WindowedReader::readChars(char_type buf[], size_type len) +{ + pos_type cur = this->getCur(); + size_type size = 0; + if (this->inWindow(cur)) + { + size = _reader.readChars(buf, min(len, _end - cur)); + } + return size; +} + +ID3_Reader::size_type io::CharReader::readChars(char_type buf[], size_type len) +{ + size_type numChars = 0; + ID3D_NOTICE( "CharReader::readChars(): len = " << len ); + for (; numChars < len; ++numChars) + { + if (this->atEnd()) + { + break; + } + char_type ch = static_cast(this->readChar()); + if (buf != NULL) + { + buf[numChars] = ch; + } + } + ID3D_NOTICE( "CharReader::readChars(): numChars = " << len ); + return numChars; +} + +ID3_Reader::int_type io::LineFeedReader::readChar() +{ + if (this->atEnd()) + { + return END_OF_READER; + } + char_type ch = static_cast(_reader.readChar()); + if (ch == 0x0D && this->peekChar() == 0x0A) + { + ID3D_NOTICE( "LineFeedReader::readChar(): found CRLF at pos " << + this->getCur() ); + ch = static_cast(_reader.readChar()); + } + return ch; +}; + +ID3_Reader::int_type io::UnsyncedReader::readChar() +{ + if (this->atEnd()) + { + return END_OF_READER; + } + char_type ch = static_cast(_reader.readChar()); + if (ch == 0xFF && this->peekChar() == 0x00) + { + ID3D_NOTICE( "UnsyncedReader::readChar(): found sync at pos " << + this->getCur() ); + _reader.readChar(); + } + return ch; +} + +io::CompressedReader::CompressedReader(ID3_Reader& reader, size_type newSize) + : _uncompressed(new char_type[newSize]) +{ + size_type oldSize = reader.remainingBytes(); + + BString binary = readBinary(reader, oldSize); + + int dwResult = ::uncompress(_uncompressed, + reinterpret_cast(&newSize), + reinterpret_cast(binary.data()), + oldSize); + if (dwResult != Z_OK) + newSize = 0; + this->setBuffer(_uncompressed, newSize); +} + +io::CompressedReader::~CompressedReader() +{ + delete [] _uncompressed; +} + +ID3_Writer::int_type io::UnsyncedWriter::writeChar(char_type ch) +{ + if (_last == 0xFF && (ch == 0x00 || ch >= 0xE0)) + { + _writer.writeChar('\0'); + _numSyncs++; + } + _last = _writer.writeChar(ch); + return _last; +} + +void io::UnsyncedWriter::flush() +{ + if (_last == 0xFF) + { + _last = _writer.writeChar('\0'); + _numSyncs++; + } + _writer.flush(); +} + +ID3_Writer::size_type +io::UnsyncedWriter::writeChars(const char_type buf[], size_type len) +{ + pos_type beg = this->getCur(); + ID3D_NOTICE( "UnsyncedWriter::writeChars(): len = " << len ); + for (size_t i = 0; i < len; ++i) + { + if (this->atEnd()) + { + break; + } + this->writeChar(buf[i]); + } + size_type numChars = this->getCur() - beg; + ID3D_NOTICE( "CharWriter::writeChars(): numChars = " << numChars ); + return numChars; +} + +void io::CompressedWriter::flush() +{ + if (_data.size() == 0) + { + return; + } + const char_type* data = reinterpret_cast(_data.data()); + size_type dataSize = _data.size(); + _origSize = dataSize; + // The zlib documentation specifies that the destination size needs to + // be an unsigned long at least 0.1% larger than the source buffer, + // plus 12 bytes + uLongf newDataSize = static_cast(dataSize + (dataSize / 10) + 12); + char_type* newData = new char_type[newDataSize]; + if (::compress(newData, &newDataSize, data, dataSize) != Z_OK) + { + // log this + ID3D_WARNING("io::CompressedWriter: error compressing"); + _writer.writeChars(data, dataSize); + } + else if (newDataSize < dataSize) + { + ID3D_NOTICE("io::CompressedWriter: compressed size = " << newDataSize << ", original size = " << dataSize ); + _writer.writeChars(newData, newDataSize); + } + else + { + ID3D_NOTICE("io::CompressedWriter: no compression!compressed size = " << newDataSize << ", original size = " << dataSize ); + _writer.writeChars(data, dataSize); + } + delete [] newData; + _data.erase(); +} + +ID3_Writer::size_type +io::CompressedWriter::writeChars(const char_type buf[], size_type len) +{ + ID3D_NOTICE("io::CompressedWriter: writing chars: " << len ); + _data.append(buf, len); + return len; +} + diff --git a/id3lib/src/io_helpers.cpp b/id3lib/src/io_helpers.cpp new file mode 100644 index 0000000..ad6577b --- /dev/null +++ b/id3lib/src/io_helpers.cpp @@ -0,0 +1,374 @@ +// $Id: io_helpers.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_CONFIG_H +#include +#endif + +#include "id3/io_decorators.h" //has "readers.h" "io_helpers.h" "utils.h" + +using namespace dami; + +String io::readString(ID3_Reader& reader) +{ + String str; + while (!reader.atEnd()) + { + ID3_Reader::char_type ch = static_cast(reader.readChar()); + if (ch == '\0') + { + break; + } + str += static_cast(ch); + } + return str; +} + +String io::readText(ID3_Reader& reader, size_t len) +{ + String str; + str.reserve(len); + const size_t SIZE = 1024; + ID3_Reader::char_type buf[SIZE]; + size_t remaining = len; + while (remaining > 0 && !reader.atEnd()) + { + size_t numRead = reader.readChars(buf, min(remaining, SIZE)); + remaining -= numRead; + str.append(reinterpret_cast(buf), numRead); + } + return str; +} + +namespace +{ + bool isNull(unsigned char ch1, unsigned char ch2) + { + return ch1 == '\0' && ch2 == '\0'; + } + + int isBOM(unsigned char ch1, unsigned char ch2) + { + // The following is taken from the following URL: + // http://community.roxen.com/developers/idocs/rfc/rfc2781.html + /* The Unicode Standard and ISO 10646 define the character "ZERO WIDTH + NON-BREAKING SPACE" (0xFEFF), which is also known informally as + "BYTE ORDER MARK" (abbreviated "BOM"). The latter name hints at a + second possible usage of the character, in addition to its normal + use as a genuine "ZERO WIDTH NON-BREAKING SPACE" within text. This + usage, suggested by Unicode section 2.4 and ISO 10646 Annex F + (informative), is to prepend a 0xFEFF character to a stream of + Unicode characters as a "signature"; a receiver of such a serialized + stream may then use the initial character both as a hint that the + stream consists of Unicode characters and as a way to recognize the + serialization order. In serialized UTF-16 prepended with such a + signature, the order is big-endian if the first two octets are 0xFE + followed by 0xFF; if they are 0xFF followed by 0xFE, the order is + little-endian. Note that 0xFFFE is not a Unicode character, + precisely to preserve the usefulness of 0xFEFF as a byte-order + mark. */ + + if (ch1 == 0xFE && ch2 == 0xFF) + { + return 1; + } + else if (ch1 == 0xFF && ch2 == 0xFE) + { + return -1; + } + return 0; + } + + bool readTwoChars(ID3_Reader& reader, + ID3_Reader::char_type& ch1, + ID3_Reader::char_type& ch2) + { + if (reader.atEnd()) + { + return false; + } + io::ExitTrigger et(reader); + ch1 = static_cast(reader.readChar()); + if (reader.atEnd()) + { + return false; + } + et.release(); + ch2 = static_cast(reader.readChar()); + return true; + } +} + +String io::readUnicodeString(ID3_Reader& reader) +{ + String unicode; + ID3_Reader::char_type ch1, ch2; + if (!readTwoChars(reader, ch1, ch2) || isNull(ch1, ch2)) + { + return unicode; + } + int bom = isBOM(ch1, ch2); + if (!bom) + { + unicode += static_cast(ch1); + unicode += static_cast(ch2); + } + while (!reader.atEnd()) + { + if (!readTwoChars(reader, ch1, ch2) || isNull(ch1, ch2)) + { + break; + } + if (bom == -1) + { + unicode += static_cast(ch2); + unicode += static_cast(ch1); + } + else + { + unicode += static_cast(ch1); + unicode += static_cast(ch2); + } + } + return unicode; +} + +String io::readUnicodeText(ID3_Reader& reader, size_t len) +{ + String unicode; + ID3_Reader::char_type ch1, ch2; + if (!readTwoChars(reader, ch1, ch2)) + { + return unicode; + } + len -= 2; + int bom = isBOM(ch1, ch2); + if (!bom) + { + unicode += ch1; + unicode += ch2; + unicode += readText(reader, len); + } + else if (bom == 1) + { + unicode = readText(reader, len); + } + else + { + for (size_t i = 0; i < len; i += 2) + { + if (!readTwoChars(reader, ch1, ch2)) + { + break; + } + unicode += ch2; + unicode += ch1; + } + } + return unicode; +} + +BString io::readAllBinary(ID3_Reader& reader) +{ + return readBinary(reader, reader.remainingBytes()); +} + +BString io::readBinary(ID3_Reader& reader, size_t len) +{ + BString binary; + binary.reserve(len); + + size_t remaining = len; + const size_t SIZE = 1024; + ID3_Reader::char_type buf[SIZE]; + while (!reader.atEnd() && remaining > 0) + { + size_t numRead = reader.readChars(buf, min(remaining, SIZE)); + remaining -= numRead; + binary.append(reinterpret_cast(buf), numRead); + } + + return binary; +} + +uint32 io::readLENumber(ID3_Reader& reader, size_t len) +{ + uint32 val = 0; + for (size_t i = 0; i < len; i++) + { + if (reader.atEnd()) + { + break; + } + val += (static_cast(0xFF & reader.readChar()) << (i * 8)); + } + return val; +} + +uint32 io::readBENumber(ID3_Reader& reader, size_t len) +{ + uint32 val = 0; + + for (ID3_Reader::size_type i = 0; i < len && !reader.atEnd(); ++i) + { + val *= 256; // 2^8 + val += static_cast(0xFF & reader.readChar()); + } + return val; +} + +String io::readTrailingSpaces(ID3_Reader& reader, size_t len) +{ + io::WindowedReader wr(reader, len); + String str; + String spaces; + str.reserve(len); + spaces.reserve(len); + while (!wr.atEnd()) + { + ID3_Reader::char_type ch = static_cast(wr.readChar()); + if (ch == '\0' || ch == ' ') + { + spaces += ch; + } + else + { + str += spaces + (char) ch; + spaces.erase(); + } + } + return str; +} + +uint32 io::readUInt28(ID3_Reader& reader) +{ + uint32 val = 0; + const unsigned short BITSUSED = 7; + const uint32 MAXVAL = MASK(BITSUSED * sizeof(uint32)); + // For each byte of the first 4 bytes in the string... + for (size_t i = 0; i < sizeof(uint32); ++i) + { + if (reader.atEnd()) + { + break; + } + // ...append the last 7 bits to the end of the temp integer... + val = (val << BITSUSED) | static_cast(reader.readChar()) & MASK(BITSUSED); + } + + // We should always parse 4 characters + return min(val, MAXVAL); +} + +size_t io::writeBENumber(ID3_Writer& writer, uint32 val, size_t len) +{ + ID3_Writer::char_type bytes[sizeof(uint32)]; + ID3_Writer::size_type size = min(len, sizeof(uint32)); + renderNumber(bytes, val, size); + return writer.writeChars(bytes, size); +} + +size_t io::writeTrailingSpaces(ID3_Writer& writer, String buf, size_t len) +{ + ID3_Writer::pos_type beg = writer.getCur(); + ID3_Writer::size_type strLen = buf.size(); + ID3_Writer::size_type size = min((unsigned int)len, (unsigned int)strLen); + writer.writeChars(buf.data(), size); + for (; size < len; ++size) + { + writer.writeChar('\0'); + } + return writer.getCur() - beg; +} + +size_t io::writeUInt28(ID3_Writer& writer, uint32 val) +{ + uchar data[sizeof(uint32)]; + const unsigned short BITSUSED = 7; + const uint32 MAXVAL = MASK(BITSUSED * sizeof(uint32)); + val = min(val, MAXVAL); + // This loop renders the value to the character buffer in reverse order, as + // it is easy to extract the last 7 bits of an integer. This is why the + // loop shifts the value of the integer by 7 bits for each iteration. + for (size_t i = 0; i < sizeof(uint32); ++i) + { + // Extract the last BITSUSED bits from val and put it in its appropriate + // place in the data buffer + data[sizeof(uint32) - i - 1] = static_cast(val & MASK(BITSUSED)); + + // The last BITSUSED bits were extracted from the val. So shift it to the + // right by that many bits for the next iteration + val >>= BITSUSED; + } + + // Should always render 4 bytes + return writer.writeChars(data, sizeof(uint32)); +} + +size_t io::writeString(ID3_Writer& writer, String data) +{ + size_t size = writeText(writer, data); + writer.writeChar('\0'); + return size + 1; +} + +size_t io::writeText(ID3_Writer& writer, String data) +{ + ID3_Writer::pos_type beg = writer.getCur(); + writer.writeChars(data.data(), data.size()); + return writer.getCur() - beg; +} + +size_t io::writeUnicodeString(ID3_Writer& writer, String data, bool bom) +{ + size_t size = writeUnicodeText(writer, data, bom); + unicode_t null = NULL_UNICODE; + writer.writeChars((const unsigned char*) &null, 2); + return size + 2; +} + +size_t io::writeUnicodeText(ID3_Writer& writer, String data, bool bom) +{ + ID3_Writer::pos_type beg = writer.getCur(); + size_t size = (data.size() / 2) * 2; + if (size == 0) + { + return 0; + } + if (bom) + { + // Write the BOM: 0xFEFF + unicode_t BOM = 0xFEFF; + writer.writeChars((const unsigned char*) &BOM, 2); + for (size_t i = 0; i < size; i += 2) + { + unicode_t ch = (data[i] << 8) | data[i+1]; + writer.writeChars((const unsigned char*) &ch, 2); + } + } + return writer.getCur() - beg; +} + diff --git a/id3lib/src/misc_support.cpp b/id3lib/src/misc_support.cpp new file mode 100644 index 0000000..184c61c --- /dev/null +++ b/id3lib/src/misc_support.cpp @@ -0,0 +1,1175 @@ +// $Id: misc_support.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +//#include +#include + +#include "misc_support.h" +//#include "field.h" +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" + +#ifdef min +#undef min +#endif +//using namespace dami; + +char *ID3_GetString(const ID3_Frame *frame, ID3_FieldID fldName) +{ + char *text = NULL; +// if (NULL != frame) + ID3_Field* fld; + if (NULL != frame && NULL != (fld = frame->GetField(fldName))) + { +// ID3_Field* fld = frame->GetField(fldName); + ID3_TextEnc enc = fld->GetEncoding(); + fld->SetEncoding(ID3TE_ISO8859_1); + size_t nText = fld->Size(); + text = new char[nText + 1]; + fld->Get(text, nText + 1); + fld->SetEncoding(enc); + } + return text; +} + +char *ID3_GetString(const ID3_Frame *frame, ID3_FieldID fldName, size_t nIndex) +{ + char *text = NULL; + if (NULL != frame) + { + size_t nText = frame->GetField(fldName)->Size(); + text = new char[nText + 1]; + frame->GetField(fldName)->Get(text, nText + 1, nIndex); + } + return text; +} + +void ID3_FreeString(char *str) +{ + if(str != NULL) + delete [] str; +} + +char *ID3_GetArtist(const ID3_Tag *tag) +{ + char *sArtist = NULL; + if (NULL == tag) + { + return sArtist; + } + + ID3_Frame *frame = NULL; + if ((frame = tag->Find(ID3FID_LEADARTIST)) || + (frame = tag->Find(ID3FID_BAND)) || + (frame = tag->Find(ID3FID_CONDUCTOR)) || + (frame = tag->Find(ID3FID_COMPOSER))) + { + sArtist = ID3_GetString(frame, ID3FN_TEXT); + } + return sArtist; +} + +ID3_Frame* ID3_AddArtist(ID3_Tag *tag, const char *text, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag && NULL != text && strlen(text) > 0) + { + if (replace) + { + ID3_RemoveArtists(tag); + } + if (replace || + (tag->Find(ID3FID_LEADARTIST) == NULL && + tag->Find(ID3FID_BAND) == NULL && + tag->Find(ID3FID_CONDUCTOR) == NULL && + tag->Find(ID3FID_COMPOSER) == NULL)) + { + frame = new ID3_Frame(ID3FID_LEADARTIST); + if (frame) + { + frame->GetField(ID3FN_TEXT)->Set(text); + tag->AttachFrame(frame); + } + } + } + return frame; +} + +size_t ID3_RemoveArtists(ID3_Tag *tag) +{ + size_t num_removed = 0; + ID3_Frame *frame = NULL; + + if (NULL == tag) + { + return num_removed; + } + + while ((frame = tag->Find(ID3FID_LEADARTIST))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + while ((frame = tag->Find(ID3FID_BAND))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + while ((frame = tag->Find(ID3FID_CONDUCTOR))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + while ((frame = tag->Find(ID3FID_COMPOSER))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + + return num_removed; +} + +char *ID3_GetAlbum(const ID3_Tag *tag) +{ + char *sAlbum = NULL; + if (NULL == tag) + { + return sAlbum; + } + + ID3_Frame *frame = tag->Find(ID3FID_ALBUM); + if (frame != NULL) + { + sAlbum = ID3_GetString(frame, ID3FN_TEXT); + } + return sAlbum; +} + +ID3_Frame* ID3_AddAlbum(ID3_Tag *tag, const char *text, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag && NULL != text && strlen(text) > 0) + { + if (replace) + { + ID3_RemoveAlbums(tag); + } + if (replace || tag->Find(ID3FID_ALBUM) == NULL) + { + frame = new ID3_Frame(ID3FID_ALBUM); + if (frame) + { + frame->GetField(ID3FN_TEXT)->Set(text); + tag->AttachFrame(frame); + } + } + } + + return frame; +} + +size_t ID3_RemoveAlbums(ID3_Tag *tag) +{ + size_t num_removed = 0; + ID3_Frame *frame = NULL; + + if (NULL == tag) + { + return num_removed; + } + + while ((frame = tag->Find(ID3FID_ALBUM))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + + return num_removed; +} + +char *ID3_GetTitle(const ID3_Tag *tag) +{ + char *sTitle = NULL; + if (NULL == tag) + { + return sTitle; + } + + ID3_Frame *frame = tag->Find(ID3FID_TITLE); + if (frame != NULL) + { + sTitle = ID3_GetString(frame, ID3FN_TEXT); + } + return sTitle; +} + +ID3_Frame* ID3_AddTitle(ID3_Tag *tag, const char *text, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag && NULL != text && strlen(text) > 0) + { + if (replace) + { + ID3_RemoveTitles(tag); + } + if (replace || tag->Find(ID3FID_TITLE) == NULL) + { + frame = new ID3_Frame(ID3FID_TITLE); + if (frame) + { + frame->GetField(ID3FN_TEXT)->Set(text); + tag->AttachFrame(frame); + } + } + } + + return frame; +} + +size_t ID3_RemoveTitles(ID3_Tag *tag) +{ + size_t num_removed = 0; + ID3_Frame *frame = NULL; + + if (NULL == tag) + { + return num_removed; + } + + while ((frame = tag->Find(ID3FID_TITLE))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + + return num_removed; +} + +char *ID3_GetYear(const ID3_Tag *tag) +{ + char *sYear = NULL; + if (NULL == tag) + { + return sYear; + } + + ID3_Frame *frame = tag->Find(ID3FID_YEAR); + if (frame != NULL) + { + sYear = ID3_GetString(frame, ID3FN_TEXT); + } + return sYear; +} + +ID3_Frame* ID3_AddYear(ID3_Tag *tag, const char *text, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag && NULL != text && strlen(text) > 0) + { + if (replace) + { + ID3_RemoveYears(tag); + } + if (replace || tag->Find(ID3FID_YEAR) == NULL) + { + frame = new ID3_Frame(ID3FID_YEAR); + if (NULL != frame) + { + frame->GetField(ID3FN_TEXT)->Set(text); + tag->AttachFrame(frame); + } + } + } + + return frame; +} + +size_t ID3_RemoveYears(ID3_Tag *tag) +{ + size_t num_removed = 0; + ID3_Frame *frame = NULL; + + if (NULL == tag) + { + return num_removed; + } + + while ((frame = tag->Find(ID3FID_YEAR))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + + return num_removed; +} + +char *ID3_GetComment(const ID3_Tag *tag, const char* desc) +{ + char *comment = NULL; + if (NULL == tag) + { + return comment; + } + + ID3_Frame* frame = NULL; + if (desc) + { + frame = tag->Find(ID3FID_COMMENT, ID3FN_DESCRIPTION, desc); + } + else + { + frame = tag->Find(ID3FID_COMMENT); + if(frame == tag->Find(ID3FID_COMMENT, ID3FN_DESCRIPTION, STR_V1_COMMENT_DESC)) + frame = tag->Find(ID3FID_COMMENT); + } + + if (frame) + comment = ID3_GetString(frame, ID3FN_TEXT); + return comment; +} + +ID3_Frame* ID3_AddComment(ID3_Tag *tag, const char *text, bool replace) +{ + return ID3_AddComment(tag, text, "", replace); +} + +ID3_Frame* ID3_AddComment(ID3_Tag *tag, const char *text, + const char *desc, bool replace) +{ + return ID3_AddComment(tag, text, desc, "XXX", replace); +} + +ID3_Frame* ID3_AddComment(ID3_Tag *tag, const char *text, + const char *desc, const char* lang, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag && + NULL != text && + NULL != desc && + strlen(text) > 0) + { + bool bAdd = true; + if (replace) + { + ID3_RemoveComments(tag, desc); + } + else + { + // See if there is already a comment with this description + ID3_Tag::Iterator* iter = tag->CreateIterator(); + ID3_Frame* frame = NULL; + while ((frame = iter->GetNext()) != NULL) + { + if (frame->GetID() == ID3FID_COMMENT) + { + char *tmp_desc = ID3_GetString(frame, ID3FN_DESCRIPTION); + if (strcmp(tmp_desc, desc) == 0) + { + bAdd = false; + } + delete [] tmp_desc; + if (!bAdd) + { + break; + } + } + } + delete iter; + } + if (bAdd) + { + frame = new ID3_Frame(ID3FID_COMMENT); + if (NULL != frame) + { + frame->GetField(ID3FN_LANGUAGE)->Set(lang); + frame->GetField(ID3FN_DESCRIPTION)->Set(desc); + frame->GetField(ID3FN_TEXT)->Set(text); + tag->AttachFrame(frame); + } + } + } + return frame; +} + +// Remove all comments with the given description (remove all comments if +// desc is NULL) +size_t ID3_RemoveComments(ID3_Tag *tag, const char *desc) +{ + size_t num_removed = 0; + + if (NULL == tag) + { + return num_removed; + } + + ID3_Tag::Iterator* iter = tag->CreateIterator(); + ID3_Frame* frame = NULL; + while ((frame = iter->GetNext()) != NULL) + { + if (frame->GetID() == ID3FID_COMMENT) + { + bool remove = false; + // A null description means remove all comments + if (NULL == desc) + { + remove = true; + } + else + { + // See if the description we have matches the description of the + // current comment. If so, set the "remove the comment" flag to true. + char *tmp_desc = ID3_GetString(frame, ID3FN_DESCRIPTION); + remove = (strcmp(tmp_desc, desc) == 0); + delete [] tmp_desc; + } + if (remove) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + } + } + delete iter; + + return num_removed; +} + +char *ID3_GetTrack(const ID3_Tag *tag) +{ + char *sTrack = NULL; + if (NULL == tag) + { + return sTrack; + } + + ID3_Frame *frame = tag->Find(ID3FID_TRACKNUM); + if (frame != NULL) + { + sTrack = ID3_GetString(frame, ID3FN_TEXT); + } + return sTrack; +} + +size_t ID3_GetTrackNum(const ID3_Tag *tag) +{ + char *sTrack = ID3_GetTrack(tag); + size_t nTrack = 0; + if (NULL != sTrack) + { + nTrack = atoi(sTrack); + delete [] sTrack; + } + return nTrack; +} + +ID3_Frame* ID3_AddTrack(ID3_Tag *tag, uchar trk, uchar ttl, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag && trk > 0) + { + if (replace) + { + ID3_RemoveTracks(tag); + } + if (replace || NULL == tag->Find(ID3FID_TRACKNUM)) + { + frame = new ID3_Frame(ID3FID_TRACKNUM); + if (frame) + { + char *sTrack = NULL; + if (0 == ttl) + { + sTrack = new char[4]; + sprintf(sTrack, "%lu", (luint) trk); + } + else + { + sTrack = new char[8]; + sprintf(sTrack, "%lu/%lu", (luint) trk, (luint) ttl); + } + + frame->GetField(ID3FN_TEXT)->Set(sTrack); + tag->AttachFrame(frame); + + delete [] sTrack; + } + } + } + + return frame; +} + +//following routine courtesy of John George +int ID3_GetPictureData(const ID3_Tag *tag, const char *TempPicPath) +{ + if (NULL == tag) + return 0; + else + { + ID3_Frame* frame = NULL; + frame = tag->Find(ID3FID_PICTURE); + if (frame != NULL) + { + ID3_Field* myField = frame->GetField(ID3FN_DATA); + if (myField != NULL) + { + myField->ToFile(TempPicPath); + return (int)myField->Size(); + } + else return 0; + } + else return 0; + } +} + +//following routine courtesy of John George +char* ID3_GetPictureMimeType(const ID3_Tag *tag) +{ + char* sPicMimetype = NULL; + if (NULL == tag) + return sPicMimetype; + + ID3_Frame* frame = NULL; + frame = tag->Find(ID3FID_PICTURE); + if (frame != NULL) + { + sPicMimetype = ID3_GetString(frame, ID3FN_MIMETYPE); + } + return sPicMimetype; +} + +//following routine courtesy of John George +bool ID3_HasPicture(const ID3_Tag* tag) +{ + if (NULL == tag) + return false; + else + { + ID3_Frame* frame = tag->Find(ID3FID_PICTURE); + if (frame != NULL) + { + ID3_Field* myField = frame->GetField(ID3FN_DATA); + if (myField != NULL) + return true; + else + return false; + } + else return false; + } +} + +//following routine courtesy of John George +ID3_Frame* ID3_AddPicture(ID3_Tag* tag, const char* TempPicPath, const char* MimeType, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag ) + { + if (replace) + ID3_RemovePictures(tag); + if (replace || NULL == tag->Find(ID3FID_PICTURE)) + { + frame = new ID3_Frame(ID3FID_PICTURE); + if (NULL != frame) + { + frame->GetField(ID3FN_DATA)->FromFile(TempPicPath); + frame->GetField(ID3FN_MIMETYPE)->Set(MimeType); + tag->AttachFrame(frame); + } + } + } + return frame; +} + +//following routine courtesy of John George +size_t ID3_RemovePictures(ID3_Tag* tag) +{ + size_t num_removed = 0; + ID3_Frame* frame = NULL; + + if (NULL == tag) + return num_removed; + + while ((frame = tag->Find(ID3FID_PICTURE))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + return num_removed; +} + +//following routine courtesy of John George +size_t ID3_RemovePictureType(ID3_Tag* tag, ID3_PictureType pictype) +{ + size_t bremoved = 0; + ID3_Frame* frame = NULL; + + if (NULL == tag) + return bremoved; + + ID3_Tag::Iterator* iter = tag->CreateIterator(); + + while (NULL != (frame = iter->GetNext())) + { + if (frame->GetID() == ID3FID_PICTURE) + { + if (frame->GetField(ID3FN_PICTURETYPE)->Get() == (uint32)pictype) + break; + } + } + delete iter; + + if (NULL != frame) + { + frame = tag->RemoveFrame(frame); + delete frame; + bremoved = 1; + } + return bremoved; +} + +//following routine courtesy of John George +ID3_Frame* ID3_AddPicture(ID3_Tag *tag, const char *TempPicPath, const char *MimeType, ID3_PictureType pictype, const char* Description, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag ) + { + if (replace) + ID3_RemovePictureType(tag, pictype); + if (replace || NULL == tag->Find(ID3FID_PICTURE)) + { + frame = new ID3_Frame(ID3FID_PICTURE); + if (NULL != frame) + { + frame->GetField(ID3FN_DATA)->FromFile(TempPicPath); + frame->GetField(ID3FN_MIMETYPE)->Set(MimeType); + frame->GetField(ID3FN_PICTURETYPE)->Set((uint32)pictype); + frame->GetField(ID3FN_DESCRIPTION)->Set(Description); + tag->AttachFrame(frame); + } + } + } + return frame; +} + +//following routine courtesy of John George +size_t ID3_GetPictureDataOfPicType(ID3_Tag* tag, const char* TempPicPath, ID3_PictureType pictype) +{ + if (NULL == tag) + return 0; + else + { + ID3_Frame* frame = NULL; + ID3_Tag::Iterator* iter = tag->CreateIterator(); + + while (NULL != (frame = iter->GetNext() )) + { + if(frame->GetID() == ID3FID_PICTURE) + { + if(frame->GetField(ID3FN_PICTURETYPE)->Get() == (uint32)pictype) + break; + } + } + delete iter; + + if (frame != NULL) + { + ID3_Field* myField = frame->GetField(ID3FN_DATA); + if (myField != NULL) + { + myField->ToFile(TempPicPath); + return (size_t)myField->Size(); + } + else return 0; + } + else return 0; + } +} + +//following routine courtesy of John George +char* ID3_GetMimeTypeOfPicType(ID3_Tag* tag, ID3_PictureType pictype) +{ + char* sPicMimetype = NULL; + if (NULL == tag) + return sPicMimetype; + + ID3_Frame* frame = NULL; + ID3_Tag::Iterator* iter = tag->CreateIterator(); + + while (NULL != (frame = iter->GetNext())) + { + if(frame->GetID() == ID3FID_PICTURE) + { + if(frame->GetField(ID3FN_PICTURETYPE)->Get() == (uint32)pictype) + break; + } + } + delete iter; + + if (frame != NULL) + { + sPicMimetype = ID3_GetString(frame, ID3FN_MIMETYPE); + } + return sPicMimetype; +} + +//following routine courtesy of John George +char* ID3_GetDescriptionOfPicType(ID3_Tag* tag, ID3_PictureType pictype) +{ + char* sPicDescription = NULL; + if (NULL == tag) + return sPicDescription; + + ID3_Frame* frame = NULL; + ID3_Tag::Iterator* iter = tag->CreateIterator(); + + while (NULL != (frame = iter->GetNext())) + { + if(frame->GetID() == ID3FID_PICTURE) + { + if(frame->GetField(ID3FN_PICTURETYPE)->Get() == (uint32)pictype) + break; + } + } + delete iter; + + if (frame != NULL) + { + sPicDescription = ID3_GetString(frame, ID3FN_DESCRIPTION); + } + return sPicDescription; +} + + +size_t ID3_RemoveTracks(ID3_Tag* tag) +{ + size_t num_removed = 0; + ID3_Frame* frame = NULL; + + if (NULL == tag) + { + return num_removed; + } + + while ((frame = tag->Find(ID3FID_TRACKNUM))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + + return num_removed; +} + +char *ID3_GetGenre(const ID3_Tag *tag) +{ + char *sGenre = NULL; + if (NULL == tag) + { + return sGenre; + } + + ID3_Frame *frame = tag->Find(ID3FID_CONTENTTYPE); + if (frame != NULL) + { + sGenre = ID3_GetString(frame, ID3FN_TEXT); + } + + return sGenre; +} + +size_t ID3_GetGenreNum(const ID3_Tag *tag) +{ + char *sGenre = ID3_GetGenre(tag); + size_t ulGenre = 0xFF; + if (NULL == sGenre) + { + return ulGenre; + } + + // If the genre string begins with "(ddd)", where "ddd" is a number, then + // "ddd" is the genre number---get it + if (sGenre[0] == '(') + { + char *pCur = &sGenre[1]; + while (isdigit(*pCur)) + { + pCur++; + } + if (*pCur == ')') + { + // if the genre number is greater than 255, its invalid. + ulGenre = dami::min(0xFF, atoi(&sGenre[1])); + } + } + + delete [] sGenre; + return ulGenre; +} + +//following routine courtesy of John George +ID3_Frame* ID3_AddGenre(ID3_Tag* tag, const char* genre, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag && NULL != genre && strlen(genre) > 0) + { + if (replace) + { + ID3_RemoveGenres(tag); + } + if (replace || NULL == tag->Find(ID3FID_CONTENTTYPE)) + { + frame = new ID3_Frame(ID3FID_CONTENTTYPE); + if (NULL != frame) + { + frame->GetField(ID3FN_TEXT)->Set(genre); + tag->AttachFrame(frame); + } + } + } + + return frame; +} + +ID3_Frame* ID3_AddGenre(ID3_Tag *tag, size_t genreNum, bool replace) +{ + if(0xFF != genreNum) + { + char sGenre[6]; + sprintf(sGenre, "(%lu)", (luint) genreNum); + return(ID3_AddGenre(tag, sGenre, replace)); + } + else + { + return(NULL); + } +} + +size_t ID3_RemoveGenres(ID3_Tag *tag) +{ + size_t num_removed = 0; + ID3_Frame *frame = NULL; + + if (NULL == tag) + { + return num_removed; + } + + while ((frame = tag->Find(ID3FID_CONTENTTYPE))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + + return num_removed; +} + +char *ID3_GetLyrics(const ID3_Tag *tag) +{ + char *sLyrics = NULL; + if (NULL == tag) + { + return sLyrics; + } + + ID3_Frame *frame = tag->Find(ID3FID_UNSYNCEDLYRICS); + if (frame != NULL) + { + sLyrics = ID3_GetString(frame, ID3FN_TEXT); + } + return sLyrics; +} + +ID3_Frame* ID3_AddLyrics(ID3_Tag *tag, const char *text, bool replace) +{ + return ID3_AddLyrics(tag, text, "", replace); +} + +ID3_Frame* ID3_AddLyrics(ID3_Tag *tag, const char *text, const char* desc, + bool replace) +{ + return ID3_AddLyrics(tag, text, desc, "XXX", replace); +} + +ID3_Frame* ID3_AddLyrics(ID3_Tag *tag, const char *text, const char* desc, + const char* lang, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag && strlen(text) > 0) + { + if (replace) + { + ID3_RemoveLyrics(tag); + } + if (replace || tag->Find(ID3FID_UNSYNCEDLYRICS) == NULL) + { + frame = new ID3_Frame(ID3FID_UNSYNCEDLYRICS); + if (NULL != frame) + { + frame->GetField(ID3FN_LANGUAGE)->Set(lang); + frame->GetField(ID3FN_DESCRIPTION)->Set(desc); + frame->GetField(ID3FN_TEXT)->Set(text); + tag->AttachFrame(frame); + } + } + } + + return frame; +} + +size_t ID3_RemoveLyrics(ID3_Tag *tag) +{ + size_t num_removed = 0; + ID3_Frame *frame = NULL; + + if (NULL == tag) + { + return num_removed; + } + + while ((frame = tag->Find(ID3FID_UNSYNCEDLYRICS))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + + return num_removed; +} + +char *ID3_GetLyricist(const ID3_Tag *tag) +{ + char *sLyricist = NULL; + if (NULL == tag) + { + return sLyricist; + } + + ID3_Frame *frame = tag->Find(ID3FID_LYRICIST); + if (frame != NULL) + { + sLyricist = ID3_GetString(frame, ID3FN_TEXT); + } + return sLyricist; +} + +ID3_Frame* ID3_AddLyricist(ID3_Tag *tag, const char *text, bool replace) +{ + ID3_Frame* frame = NULL; + if (NULL != tag && NULL != text && strlen(text) > 0) + { + if (replace) + { + ID3_RemoveLyricist(tag); + } + if (replace || (tag->Find(ID3FID_LYRICIST) == NULL)) + { + frame = new ID3_Frame(ID3FID_LYRICIST); + if (frame) + { + frame->GetField(ID3FN_TEXT)->Set(text); + tag->AttachFrame(frame); + } + } + } + + return frame; +} + +size_t ID3_RemoveLyricist(ID3_Tag *tag) +{ + size_t num_removed = 0; + ID3_Frame *frame = NULL; + + if (NULL == tag) + { + return num_removed; + } + + while ((frame = tag->Find(ID3FID_LYRICIST))) + { + frame = tag->RemoveFrame(frame); + delete frame; + num_removed++; + } + + return num_removed; +} + +ID3_Frame* ID3_AddSyncLyrics(ID3_Tag *tag, const uchar *data, size_t datasize, + ID3_TimeStampFormat format, bool replace) +{ + return ID3_AddSyncLyrics(tag, data, datasize, format, "", replace); +} + +ID3_Frame* ID3_AddSyncLyrics(ID3_Tag *tag, const uchar *data, size_t datasize, + ID3_TimeStampFormat format, const char *desc, + bool replace) +{ + return ID3_AddSyncLyrics(tag, data, datasize, format, desc, "XXX", replace); +} + +ID3_Frame* ID3_AddSyncLyrics(ID3_Tag *tag, const uchar *data, size_t datasize, + ID3_TimeStampFormat format, const char *desc, + const char *lang, bool replace) +{ + return ID3_AddSyncLyrics(tag, data, datasize, format, desc, lang, + ID3CT_LYRICS, replace); +} + +ID3_Frame* ID3_AddSyncLyrics(ID3_Tag *tag, const uchar *data, size_t datasize, + ID3_TimeStampFormat format, const char *desc, + const char *lang, ID3_ContentType type, + bool replace) +{ + ID3_Frame* frame = NULL; + // language and descriptor should be mandatory + if ((NULL == lang) || (NULL == desc)) + { + return NULL; + } + + // check if a SYLT frame of this language or descriptor already exists + ID3_Frame* frmExist = tag->Find(ID3FID_SYNCEDLYRICS, ID3FN_LANGUAGE, lang); + if (!frmExist) + { + frmExist = tag->Find(ID3FID_SYNCEDLYRICS, ID3FN_DESCRIPTION, desc); + } + + if (NULL != tag && NULL != data) + { + if (replace && frmExist) + { + frmExist = tag->RemoveFrame (frmExist); + delete frmExist; + frmExist = NULL; + } + + // if the frame still exist, cannot continue + if (frmExist) + { + return NULL; + } + + ID3_Frame* frame = new ID3_Frame(ID3FID_SYNCEDLYRICS); + + frame->GetField(ID3FN_LANGUAGE)->Set(lang); + frame->GetField(ID3FN_DESCRIPTION)->Set(desc); + frame->GetField(ID3FN_TIMESTAMPFORMAT)->Set(format); + frame->GetField(ID3FN_CONTENTTYPE)->Set(type); + frame->GetField(ID3FN_DATA)->Set(data, datasize); + tag->AttachFrame(frame); + } + + return frame; +} + +ID3_Frame *ID3_GetSyncLyricsInfo(const ID3_Tag *tag, const char *desc, + const char *lang, + ID3_TimeStampFormat& format, + ID3_ContentType& type, size_t& size) +{ + // check if a SYLT frame of this language or descriptor exists + ID3_Frame* frmExist = NULL; + if (NULL != lang) + { + // search through language + frmExist = tag->Find(ID3FID_SYNCEDLYRICS, ID3FN_LANGUAGE, lang); + } + else if (NULL != desc) + { + // search through descriptor + frmExist = tag->Find(ID3FID_SYNCEDLYRICS, ID3FN_DESCRIPTION, desc); + } + else + { + // both language and description not specified, search the first SYLT frame + frmExist = tag->Find(ID3FID_SYNCEDLYRICS); + } + + if (!frmExist) + { + return NULL; + } + + // get the lyrics time stamp format + format = static_cast(frmExist->GetField(ID3FN_TIMESTAMPFORMAT)->Get ()); + + // get the lyrics content type + type = static_cast(frmExist->GetField(ID3FN_CONTENTTYPE)->Get ()); + + // get the lyrics size + size = frmExist->GetField (ID3FN_DATA)->Size (); + + // return the frame pointer for further uses + return frmExist; +} + +ID3_Frame *ID3_GetSyncLyrics(const ID3_Tag* tag, const char* lang, + const char* desc, const uchar* &pData, size_t& size) +{ + // check if a SYLT frame of this language or descriptor exists + ID3_Frame* frmExist = NULL; + if (NULL != lang) + { + // search through language + frmExist = tag->Find(ID3FID_SYNCEDLYRICS, ID3FN_LANGUAGE, lang); + } + else if (NULL != desc) + { + // search through descriptor + frmExist = tag->Find(ID3FID_SYNCEDLYRICS, ID3FN_DESCRIPTION, desc); + } + else + { + // both language and description not specified, search the first SYLT frame + frmExist = tag->Find(ID3FID_SYNCEDLYRICS); + } + + if (NULL == frmExist) + { + return NULL; + } + + // get the lyrics size + size = dami::min(size, frmExist->GetField(ID3FN_DATA)->Size()); + + // get the lyrics data + pData = frmExist->GetField (ID3FN_DATA)->GetRawBinary(); + + // return the frame pointer for further uses + return frmExist; +} + diff --git a/id3lib/src/mp3_header.h b/id3lib/src/mp3_header.h new file mode 100644 index 0000000..5edd0a7 --- /dev/null +++ b/id3lib/src/mp3_header.h @@ -0,0 +1,87 @@ +// -*- C++ -*- +// $Id: mp3_header.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _MP3_HEADER_H_ +#define _MP3_HEADER_H_ + +#include "io_decorators.h" //has "readers.h" "io_helpers.h" "utils.h" + +class Mp3Info +{ +public: + Mp3Info() { _mp3_header_output = new Mp3_Headerinfo; }; + ~Mp3Info() { this->Clean(); }; + void Clean(); + + const Mp3_Headerinfo* GetMp3HeaderInfo() const { return _mp3_header_output; }; + bool Parse(ID3_Reader&, size_t mp3size); + + Mpeg_Layers Layer() const { return _mp3_header_output->layer; }; + Mpeg_Version Version() const { return _mp3_header_output->version; }; + MP3_BitRates Bitrate() const { return _mp3_header_output->bitrate; }; + Mp3_ChannelMode ChannelMode() const { return _mp3_header_output->channelmode; }; + Mp3_ModeExt ModeExt() const { return _mp3_header_output->modeext; }; + Mp3_Emphasis Emphasis() const { return _mp3_header_output->emphasis; }; + Mp3_Crc Crc() const { return _mp3_header_output->crc; }; + uint32 VbrBitrate() const { return _mp3_header_output->vbr_bitrate; }; + uint32 Frequency() const { return _mp3_header_output->frequency; }; + uint32 Framesize() const { return _mp3_header_output->framesize; }; + uint32 Frames() const { return _mp3_header_output->frames; }; + bool Private() const { return _mp3_header_output->privatebit; }; + bool Copyrighted() const { return _mp3_header_output->copyrighted; }; + bool Original() const { return _mp3_header_output->original; }; + uint32 Seconds() const { return _mp3_header_output->time; }; + +private: + + struct _mp3_header_internal //http://www.mp3-tech.org/programmer/frame_header.html + { +//byte 1 + unsigned char frame_sync_a : 8; /* all bits should be set */ +//byte 2 + unsigned char protection_bit : 1; + unsigned char layer : 2; + unsigned char id : 2; + unsigned char frame_sync_b : 3; /* all bits should be set */ +//byte 3 + unsigned char private_bit : 1; + unsigned char padding_bit : 1; + unsigned char frequency : 2; + unsigned char bitrate_index : 4; +//byte 4 + unsigned char emphasis : 2; + unsigned char original : 1; + unsigned char copyright : 1; + unsigned char mode_ext : 2;//only used in joint stereo + unsigned char mode : 2; + }; + + Mp3_Headerinfo* _mp3_header_output; +}; //Info + +#endif /* _MP3_HEADER_H_ */ + diff --git a/id3lib/src/mp3_parse.cpp b/id3lib/src/mp3_parse.cpp new file mode 100644 index 0000000..feae36a --- /dev/null +++ b/id3lib/src/mp3_parse.cpp @@ -0,0 +1,568 @@ +// -*- C++ -*- +// $Id: mp3_parse.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 2002, Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include "mp3_header.h" + +#define FRAMES_FLAG 0x0001 +#define BYTES_FLAG 0x0002 +#define TOC_FLAG 0x0004 +#define SCALE_FLAG 0x0008 + +static int ExtractI4(unsigned char *buf) +{ + int x; + // big endian extract + + x = buf[0]; + x <<= 8; + x |= buf[1]; + x <<= 8; + x |= buf[2]; + x <<= 8; + x |= buf[3]; + + return x; +} + +uint32 fto_nearest_i(float f) +{ + uint32 i; + + i = (uint32)f; + if (i < f) + { + f -= i; + if (f >= 0.5) + return i+1; + else + return i; + } + else + return i; +} + +uint16 calcCRC(char *pFrame, size_t audiodatasize) +{ + size_t icounter; + int tmpchar, crcmask, tmpi; + uint16 crc = 0xffff; + + for (icounter = 2; icounter < audiodatasize; ++icounter) + { + if (icounter != 4 && icounter != 5) //skip the 2 chars of the crc itself + { + crcmask = 1 << 8; + tmpchar = pFrame[icounter]; + while (crcmask >>= 1) + { + tmpi = crc & 0x8000; + crc <<= 1; + if (!tmpi ^ !(tmpchar & crcmask)) + crc ^= 0x8005; + } + } + } + crc &= 0xffff; + return crc; +} + +void Mp3Info::Clean() +{ + if (_mp3_header_output != NULL) + delete _mp3_header_output; + _mp3_header_output = NULL; +} + +using namespace dami; + +bool Mp3Info::Parse(ID3_Reader& reader, size_t mp3size) +{ + MP3_BitRates _mp3_bitrates[2][3][16] = + { + { + { //MPEG 1, LAYER I + MP3BITRATE_NONE, + MP3BITRATE_32K, + MP3BITRATE_64K, + MP3BITRATE_96K, + MP3BITRATE_128K, + MP3BITRATE_160K, + MP3BITRATE_192K, + MP3BITRATE_224K, + MP3BITRATE_256K, + MP3BITRATE_288K, + MP3BITRATE_320K, + MP3BITRATE_352K, + MP3BITRATE_384K, + MP3BITRATE_416K, + MP3BITRATE_448K, + MP3BITRATE_FALSE + }, + { //MPEG 1, LAYER II + MP3BITRATE_NONE, + MP3BITRATE_32K, + MP3BITRATE_48K, + MP3BITRATE_56K, + MP3BITRATE_64K, + MP3BITRATE_80K, + MP3BITRATE_96K, + MP3BITRATE_112K, + MP3BITRATE_128K, + MP3BITRATE_160K, + MP3BITRATE_192K, + MP3BITRATE_224K, + MP3BITRATE_256K, + MP3BITRATE_320K, + MP3BITRATE_384K, + MP3BITRATE_FALSE + }, + { //MPEG 1, LAYER III + MP3BITRATE_NONE, + MP3BITRATE_32K, + MP3BITRATE_40K, + MP3BITRATE_48K, + MP3BITRATE_56K, + MP3BITRATE_64K, + MP3BITRATE_80K, + MP3BITRATE_96K, + MP3BITRATE_112K, + MP3BITRATE_128K, + MP3BITRATE_160K, + MP3BITRATE_192K, + MP3BITRATE_224K, + MP3BITRATE_256K, + MP3BITRATE_320K, + MP3BITRATE_FALSE + } + }, + { + { //MPEG 2 or 2.5, LAYER I + MP3BITRATE_NONE, + MP3BITRATE_32K, + MP3BITRATE_48K, + MP3BITRATE_56K, + MP3BITRATE_64K, + MP3BITRATE_80K, + MP3BITRATE_96K, + MP3BITRATE_112K, + MP3BITRATE_128K, + MP3BITRATE_144K, + MP3BITRATE_160K, + MP3BITRATE_176K, + MP3BITRATE_192K, + MP3BITRATE_224K, + MP3BITRATE_256K, + MP3BITRATE_FALSE + }, + { //MPEG 2 or 2.5, LAYER II + MP3BITRATE_NONE, + MP3BITRATE_8K, + MP3BITRATE_16K, + MP3BITRATE_24K, + MP3BITRATE_32K, + MP3BITRATE_40K, + MP3BITRATE_48K, + MP3BITRATE_56K, + MP3BITRATE_64K, + MP3BITRATE_80K, + MP3BITRATE_96K, + MP3BITRATE_112K, + MP3BITRATE_128K, + MP3BITRATE_144K, + MP3BITRATE_160K, + MP3BITRATE_FALSE + }, + { //MPEG 2 or 2.5, LAYER III + MP3BITRATE_NONE, + MP3BITRATE_8K, + MP3BITRATE_16K, + MP3BITRATE_24K, + MP3BITRATE_32K, + MP3BITRATE_40K, + MP3BITRATE_48K, + MP3BITRATE_56K, + MP3BITRATE_64K, + MP3BITRATE_80K, + MP3BITRATE_96K, + MP3BITRATE_112K, + MP3BITRATE_128K, + MP3BITRATE_144K, + MP3BITRATE_160K, + MP3BITRATE_FALSE + } + } + }; + + Mp3_Frequencies _mp3_frequencies[4][4] = + { + { MP3FREQUENCIES_11025HZ, MP3FREQUENCIES_12000HZ, MP3FREQUENCIES_8000HZ,MP3FREQUENCIES_Reserved }, //MPEGVERSION_2_5 + { MP3FREQUENCIES_Reserved, MP3FREQUENCIES_Reserved, MP3FREQUENCIES_Reserved, MP3FREQUENCIES_Reserved}, //MPEGVERSION_Reserved + { MP3FREQUENCIES_22050HZ, MP3FREQUENCIES_24000HZ, MP3FREQUENCIES_16000HZ, MP3FREQUENCIES_Reserved }, //MPEGVERSION_2 + { MP3FREQUENCIES_44100HZ, MP3FREQUENCIES_48000HZ, MP3FREQUENCIES_32000HZ, MP3FREQUENCIES_Reserved } //MPEGVERSION_1 + }; + + _mp3_header_internal *_tmpheader; + + const size_t HEADERSIZE = 4;// + char buf[HEADERSIZE+1]; //+1 to hold the \0 char + ID3_Reader::pos_type beg = reader.getCur() ; + ID3_Reader::pos_type end = beg + HEADERSIZE ; + reader.setCur(beg); + int bitrate_index; + + _mp3_header_output->layer = MPEGLAYER_FALSE; + _mp3_header_output->version = MPEGVERSION_FALSE; + _mp3_header_output->bitrate = MP3BITRATE_FALSE; + _mp3_header_output->channelmode = MP3CHANNELMODE_FALSE; + _mp3_header_output->modeext = MP3MODEEXT_FALSE; + _mp3_header_output->emphasis = MP3EMPHASIS_FALSE; + _mp3_header_output->crc = MP3CRC_MISMATCH; + _mp3_header_output->frequency = 0; + _mp3_header_output->framesize = 0; + _mp3_header_output->frames = 0; + _mp3_header_output->time = 0; + _mp3_header_output->vbr_bitrate = 0; + + reader.readChars(buf, HEADERSIZE); + buf[HEADERSIZE]='\0'; + // copy the pointer to the struct + + if (((buf[0] & 0xFF) != 0xFF) || ((buf[1] & 0xE0) != 0xE0)) //first 11 bits should be 1 + { + this->Clean(); + return false; + } + + _tmpheader = reinterpret_cast<_mp3_header_internal *>(buf); + + bitrate_index = 0; + switch (_tmpheader->id) + { + case 3: + _mp3_header_output->version = MPEGVERSION_1; + bitrate_index = 0; + break; + case 2: + _mp3_header_output->version = MPEGVERSION_2; + bitrate_index = 1; + break; + case 1: + this->Clean(); + return false; //wouldn't know how to handle it + break; + case 0: + _mp3_header_output->version = MPEGVERSION_2_5; + bitrate_index = 1; + break; + default: + this->Clean(); + return false; + break; + }; + + switch (_tmpheader->layer) + { + case 3: + _mp3_header_output->layer = MPEGLAYER_I; + break; + case 2: + _mp3_header_output->layer = MPEGLAYER_II; + break; + case 1: + _mp3_header_output->layer = MPEGLAYER_III; + break; + case 0: + this->Clean(); + return false; //wouldn't know how to handle it + break; + default: + this->Clean(); + return false; //how can two unsigned bits be something else?? + break; + }; + + // mpegversion, layer and bitrate are all valid + _mp3_header_output->bitrate = _mp3_bitrates[bitrate_index][3-_tmpheader->layer][_tmpheader->bitrate_index]; + if (_mp3_header_output->bitrate == MP3BITRATE_FALSE) + { + this->Clean(); + return false; + } + _mp3_header_output->frequency = _mp3_frequencies[_tmpheader->id][_tmpheader->frequency]; + if (_mp3_header_output->frequency == MP3FREQUENCIES_Reserved) + { + this->Clean(); + return false; + } + + _mp3_header_output->privatebit = (bool)_tmpheader->private_bit; + _mp3_header_output->copyrighted = (bool)_tmpheader->copyright; + _mp3_header_output->original = (bool)_tmpheader->original; + _mp3_header_output->crc = (Mp3_Crc)!(bool)_tmpheader->protection_bit; + + switch (_tmpheader->mode) + { + case 3: + _mp3_header_output->channelmode = MP3CHANNELMODE_SINGLE_CHANNEL; + break; + case 2: + _mp3_header_output->channelmode = MP3CHANNELMODE_DUAL_CHANNEL; + break; + case 1: + _mp3_header_output->channelmode = MP3CHANNELMODE_JOINT_STEREO; + break; + case 0: + _mp3_header_output->channelmode = MP3CHANNELMODE_STEREO; + break; + default: + this->Clean(); + return false; //wouldn't know how to handle it + break; + } + + if (_mp3_header_output->channelmode == MP3CHANNELMODE_JOINT_STEREO) + { + // these have a different meaning for different layers, better give them a generic name in the enum + switch (_tmpheader->mode_ext) + { + case 3: + _mp3_header_output->modeext = MP3MODEEXT_3; + break; + case 2: + _mp3_header_output->modeext = MP3MODEEXT_2; + break; + case 1: + _mp3_header_output->modeext = MP3MODEEXT_1; + break; + case 0: + _mp3_header_output->modeext = MP3MODEEXT_0; + break; + default: + this->Clean(); + return false; //wouldn't know how to handle it + break; + } + } + else //it's valid to have a valid false one in this case, since it's only used with joint stereo + _mp3_header_output->modeext = MP3MODEEXT_FALSE; + + switch (_tmpheader->emphasis) + { + case 3: + _mp3_header_output->emphasis = MP3EMPHASIS_CCIT_J17; + break; + case 2: + _mp3_header_output->emphasis = MP3EMPHASIS_Reserved; + break; + case 1: + _mp3_header_output->emphasis = MP3EMPHASIS_50_15MS; + break; + case 0: + _mp3_header_output->emphasis = MP3EMPHASIS_NONE; + break; + default: + this->Clean(); + return false; //wouldn't know how to handle it + break; + } + +//http://www.mp3-tech.org/programmer/frame_header.html + if (_mp3_header_output->bitrate != MP3BITRATE_NONE && _mp3_header_output->frequency > 0) + { + + switch(_mp3_header_output->layer) + { + case MPEGLAYER_I: // Layer 1 + _mp3_header_output->framesize = 4 * (12 * _mp3_header_output->bitrate / _mp3_header_output->frequency + (_tmpheader->padding_bit ? 1 : 0)); + break; + case MPEGLAYER_II: // Layer 2 + _mp3_header_output->framesize = 144 * _mp3_header_output->bitrate / _mp3_header_output->frequency + (_tmpheader->padding_bit ? 1 : 0); + break; + case MPEGLAYER_III: // Layer 3 + if(_mp3_header_output->version == MPEGVERSION_2_5) + _mp3_header_output->framesize = 144 * _mp3_header_output->bitrate / _mp3_header_output->frequency + (_tmpheader->padding_bit ? 1 : 0); //Mpeg1 + else + _mp3_header_output->framesize = 72000 * _mp3_header_output->bitrate / _mp3_header_output->frequency + (_tmpheader->padding_bit ? 1 : 0); //Mpeg2 + Mpeg2.5 + break; + } +// if (_mp3_header_output->layer == MPEGLAYER_I) +// _mp3_header_output->framesize = fto_nearest_i((float)((48 * (float)_mp3_header_output->bitrate) / _mp3_header_output->frequency)) + (_tmpheader->padding_bit ? 4 : 0); +// else +// _mp3_header_output->framesize = fto_nearest_i((float)((144 * (float)_mp3_header_output->bitrate) / _mp3_header_output->frequency)) + (_tmpheader->padding_bit ? 1 : 0); + } + else + _mp3_header_output->framesize = 0; //unable to determine + + const size_t CRCSIZE = 2; + size_t sideinfo_len; + + if (_mp3_header_output->version == MPEGVERSION_1) /* MPEG 1 */ + sideinfo_len = (_mp3_header_output->channelmode == MP3CHANNELMODE_SINGLE_CHANNEL) ? 4 + 17 : 4 + 32; + else /* MPEG 2 */ + sideinfo_len = (_mp3_header_output->channelmode == MP3CHANNELMODE_SINGLE_CHANNEL) ? 4 + 9 : 4 + 17; + + off_t vbr_header_offest = beg + sideinfo_len; + int vbr_frames = 0; + + sideinfo_len += 2; // add two for the crc itself + + if ((_mp3_header_output->crc == MP3CRC_OK) && mp3size < sideinfo_len) + _mp3_header_output->crc = MP3CRC_ERROR_SIZE; + + if (_mp3_header_output->crc == MP3CRC_OK) + { + char audiodata[38 + 1]; //+1 to hold the 0 char + uint16 crc16; + uint16 crcstored; + + _mp3_header_output->crc = MP3CRC_MISMATCH; //as a starting point, we assume the worst + + reader.setCur(beg); + + reader.readChars(audiodata, sideinfo_len); + audiodata[sideinfo_len] = '\0'; + + crc16 = calcCRC(audiodata, sideinfo_len); + + beg = end; + end = beg + CRCSIZE; + + reader.setCur(beg); + crcstored = (uint16)io::readBENumber(reader, CRCSIZE); + + // a mismatch doesn't mean the file is unusable + // it has just some bits in the wrong place + if (crcstored == crc16) + _mp3_header_output->crc = MP3CRC_OK; + } + + // read xing/vbr header if present + // derived from code in vbrheadersdk.zip + // from http://www.xingtech.com/developer/mp3/ + + const size_t VBR_HEADER_MIN_SIZE = 8; // "xing" + flags are fixed + const size_t VBR_HEADER_MAX_SIZE = 120; // frames, bytes, toc and scale are optional + + if (mp3size >= vbr_header_offest + VBR_HEADER_MIN_SIZE) + { + char vbrheaderdata[VBR_HEADER_MAX_SIZE+1]; //+1 to hold the 0 char + unsigned char *pvbrdata = (unsigned char *)vbrheaderdata; + int vbr_filesize = 0; + int vbr_scale = 0; + int vbr_flags = 0; + + // get fixed part of vbr header + // and check if valid + + beg = vbr_header_offest; + reader.setCur(beg); + reader.readChars(vbrheaderdata, VBR_HEADER_MIN_SIZE); + vbrheaderdata[VBR_HEADER_MIN_SIZE] = '\0'; + + if (pvbrdata[0] == 'X' && + pvbrdata[1] == 'i' && + pvbrdata[2] == 'n' && + pvbrdata[3] == 'g') + { + // get vbr flags + pvbrdata += 4; + vbr_flags = ExtractI4(pvbrdata); + pvbrdata += 4; + + // read entire vbr header + int vbr_header_size = VBR_HEADER_MIN_SIZE + + ((vbr_flags & FRAMES_FLAG)? 4:0) + + ((vbr_flags & BYTES_FLAG)? 4:0) + + ((vbr_flags & TOC_FLAG)? 100:0) + + ((vbr_flags & SCALE_FLAG)? 4:0); + + if ((int)mp3size >= vbr_header_offest + vbr_header_size) + { + reader.readChars(&vbrheaderdata[VBR_HEADER_MIN_SIZE], vbr_header_size - VBR_HEADER_MIN_SIZE); + vbrheaderdata[vbr_header_size] = '\0'; + + // get frames, bytes, toc and scale + + if (vbr_flags & FRAMES_FLAG) + { + vbr_frames = ExtractI4(pvbrdata); + pvbrdata +=4; + } + + if (vbr_flags & BYTES_FLAG) + { + vbr_filesize = ExtractI4(pvbrdata); + pvbrdata +=4; + } + + if (vbr_flags & TOC_FLAG) + { + // seek offsets + // we are not using + // for(i=0;i<100;i++) seek_offsets[i] = pvbrdata[i]; + + pvbrdata +=100; + } + + if (vbr_flags & SCALE_FLAG) + { + vbr_scale = ExtractI4(pvbrdata); + pvbrdata +=4; + } + + if (vbr_frames > 0) + { + _mp3_header_output->vbr_bitrate = (((vbr_filesize!=0) ? vbr_filesize : mp3size) / vbr_frames) * _mp3_header_output->frequency / 144; + _mp3_header_output->vbr_bitrate -= _mp3_header_output->vbr_bitrate%1000; // round the bitrate: + } + } + } + } + + if (_mp3_header_output->framesize > 0 && mp3size >= _mp3_header_output->framesize) // this means bitrate is not none too + { + if (vbr_frames == 0) + _mp3_header_output->frames = fto_nearest_i((float)mp3size / _mp3_header_output->framesize); + else + _mp3_header_output->frames = vbr_frames; + + // bitrate becomes byterate (per second) if divided by 8 + if (_mp3_header_output->vbr_bitrate == 0) + _mp3_header_output->time = fto_nearest_i( (float)mp3size / (_mp3_header_output->bitrate / 8) ); + else + _mp3_header_output->time = fto_nearest_i( (float)mp3size / (_mp3_header_output->vbr_bitrate / 8) ); + } + else + { + _mp3_header_output->frames = 0; + _mp3_header_output->time = 0; + } + //if we got to here it's okay + return true; +} + + diff --git a/id3lib/src/readers.cpp b/id3lib/src/readers.cpp new file mode 100644 index 0000000..9646786 --- /dev/null +++ b/id3lib/src/readers.cpp @@ -0,0 +1,40 @@ +// $Id: readers.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include "readers.h" +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" + +using namespace dami; + +ID3_Reader::size_type +ID3_MemoryReader::readChars(char_type buf[], size_type len) +{ + size_type size = dami::min(len, _end - _cur); + ::memcpy(buf, _cur, size); + _cur += size; + return size; +} + diff --git a/id3lib/src/spec.cpp b/id3lib/src/spec.cpp new file mode 100644 index 0000000..b461a0a --- /dev/null +++ b/id3lib/src/spec.cpp @@ -0,0 +1,109 @@ +// $Id: spec.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_CONFIG_H +#include +#endif + +#include "spec.h" + +ID3_V2Spec ID3_VerRevToV2Spec(uchar ver, uchar rev) +{ + ID3_V2Spec spec = ID3V2_UNKNOWN; + if (2 == ver) + { + if (0 == rev) + { + spec = ID3V2_2_0; + } + else if (1 == rev) + { + spec = ID3V2_2_1; + } + } + else if (3 == ver) + { + if (0 == rev) + { + spec = ID3V2_3_0; + } + } + else if (4 == ver) + { + if (0 == rev) + { + spec = ID3V2_4_0; + } + } + + return spec; +} + +uchar ID3_V2SpecToVer(ID3_V2Spec spec) +{ + uchar ver = 0; + switch (spec) + { + case ID3V2_2_0: + case ID3V2_2_1: + ver = 2; + break; + case ID3V2_3_0: + ver = 3; + break; + case ID3V2_4_0: + ver = 4; + break; + default: + break; + } + return ver; +} + +uchar ID3_V2SpecToRev(ID3_V2Spec spec) +{ + uchar rev = 0; + switch (spec) + { + case ID3V2_4_0: + rev = 0; + break; + case ID3V2_3_0: + rev = 0; + break; + case ID3V2_2_1: + rev = 1; + break; + case ID3V2_2_0: + rev = 0; + break; + default: + break; + } + return rev; +} + diff --git a/id3lib/src/spec.h b/id3lib/src/spec.h new file mode 100644 index 0000000..96e3039 --- /dev/null +++ b/id3lib/src/spec.h @@ -0,0 +1,38 @@ +// -*- C++ -*- +// $Id: spec.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_SPEC_H_ +#define _ID3LIB_SPEC_H_ + +#include "id3/globals.h" //has "id3/sized_types.h" + +ID3_V2Spec ID3_VerRevToV2Spec(uchar ver, uchar rev); +uchar ID3_V2SpecToVer(ID3_V2Spec spec); +uchar ID3_V2SpecToRev(ID3_V2Spec spec); + +#endif /* _ID3LIB_SPEC_H_ */ + diff --git a/id3lib/src/tag.cpp b/id3lib/src/tag.cpp new file mode 100644 index 0000000..a9d230f --- /dev/null +++ b/id3lib/src/tag.cpp @@ -0,0 +1,1125 @@ +// $Id: tag.cpp,v 1.5 2008/01/15 11:20:40 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +//#include "readers.h" +#include "writers.h" +#include "tag_impl.h" //has "tag.h" "header_tag.h" "frame.h" "field.h" "spec.h" "id3lib_strings.h" "utils.h" + +using namespace dami; + +/** \mainpage id3lib Library Documentation + ** + ** \section tutorial Quick Tutorial + ** + ** This tutorial will quickly get you up and running with id3lib. + ** + ** \subsection download Downloading id3lib + ** + ** First, id3lib must be a part of your development environment. The latest + ** files can always be downloaded from the id3lib homepage. + ** + ** \subsection include Preparing your source code + ** + ** To use the basic functionality of id3lib in your C++ code, a single + ** \c #include is necessary. + ** + ** \code + ** #include + ** \endcode + ** + ** There are other files that must be included to access more advanced + ** functionality, but this will do most of the core functionality. + ** + ** \subsection creation Creating a tag + ** + ** Almost all functionality occurs via an ID3_Tag object. An ID3_Tag object + ** basically encapsulates two things: a collection of ID3_Frame objects and + ** file information. The goal is to populate an ID3_Tag object with ID3_Frame + ** objects, and the easiest way to do this is to associate the tag with a + ** file. This is done primarily via the ID3_Tag constructor, like so: + ** + ** \code + ** ID3_Tag myTag("song.mp3"); + ** \endcode + ** + ** This constructor links, or associates, the object \c myTag with the file + ** "song.mp3". In doing so, the tagging information from "song.mp3" is parsed + ** and added to \c myTag. This association can also be accomplished by creating + ** an empty tag and making an explicit call to Link(). + ** + ** \code + ** ID3_Tag myTag; + ** myTag.Link("song.mp3"); + ** \endcode + ** + ** The default behavior of Link() is to parse all possible tagging information + ** and convert it into ID3v2 frames. The tagging information parsed can be + ** limited to a particular type (or types) of tag by passing an ID3_TagType + ** (or combination of ID3_TagTypes). For example, to read only the ID3v1 + ** tag, pass in the constant ID3TT_ID3V1. + ** + ** \code + ** myTag.Link("song.mp3", ID3TT_ID3V1); + ** \endcode + ** + ** Another example would be to read in all tags that could possibly appear at + ** the end of the file. + ** + ** \code + ** myTag.Link("song.mp3", ID3TT_ID3V1 | ID3TT_LYRICS3V2 | ID3TT_MUSICMATCH); + ** \endcode + ** + ** \section accessing Accessing the Tag Data + ** + ** After linking with a file, the object \c myTag now contains some or all of + ** the tagging information present in the file "song.mp3", represented as + ** ID3v2 frames. How can that information be accessed? There are a variety of + ** ways to do this. One is to iterate through all the frames in the tag. + ** + ** \code + ** // use an std::auto_ptr here to handle object cleanup automatically + ** ID3_Tag::Iterator* iter = myTag.CreateIterator(); + ** ID3_Frame* myFrame = NULL; + ** while (NULL != (myFrame = iter->GetNext())) + ** { + ** // do something with myFrame + ** } + ** delete iter; + ** \endcode + ** + ** Another way to access tagging information is by searching for specific + ** frames using the Find() method. For example, the album frame can be found + ** in the following manner: + ** + ** \code + ** ID3_Frame* myFrame = myTag.Find(ID3FID_ALBUM); + ** if (NULL != myFrame) + ** { + ** // do something with myFrame + ** } + ** \endcode + ** + ** The Find() method can be used to search for frames with specific + ** information. For example, the following code can be used to find the frame + ** with the title "Nirvana". + ** + ** \code + ** ID3_Frame* myFrame = myTag.Find(ID3FID_TITLE, ID3FN_TEXT, "Nirvana"))); + ** if (NULL != myFrame) + ** { + ** // do something with myFrame + ** } + ** \endcode + ** + ** As indicated, the Find() method will return a NULL pointer if no such frame + ** can be found. If more than one frame meets the search criteria, subsequent + ** calls to Find() with the same parameters will return the other matching + ** frames. The Find() method is guaranteed to return all matching frames + ** before it wraps around to return the first matching frame. + ** + ** All ID3_Frame objects are comprised of a collection of ID3_Field objects. + ** These fields can represent text, numbers, or binary data. As with frames, + ** fields can be accessed in a variety of manners. The fields of a frame + ** can be iterated over in much the same manner of the frames of a tag. + ** + ** \code + ** // use an std::auto_ptr here to handle object cleanup automatically + ** ID3_Frame::Iterator* iter = myFrame->CreateIterator(); + ** ID3_Field* myField = NULL; + ** while (NULL != (myField = iter->GetNext())) + ** { + ** // do something with myField + ** } + ** delete iter; + ** \endcode + ** + ** If you know which field type you're looking for, you can access it + ** directly. + ** + ** \code + ** ID3_Field* myField = myFrame->GetField(ID3FN_TEXT); + ** while (NULL != myField) + ** { + ** // do something with myField + ** } + ** \endcode + ** + ** Note: The ID3_FrameInfo class provides information about the frame types known + ** to id3lib. + ** + ** The ID3_Field represents a single piece of data within an ID3v2 frame. As + ** mentioned, an ID3_Field can represent three possible types of + ** data: integers, binary data, and text strings. The type of a particular + ** field object is immutable; it is determined at the time of its construction + ** (almost always when a frame is constructed) and can't be changed. If in + ** doubt, the field type can be accessed through its GetType() method. + ** + ** Having an ID3_Field object isn't much use if you cannot access and/or + ** alter its data. Luckily, the id3lib API provides overloaded \c Set and + ** \c Get methods for all data types. + ** + ** If the field is an integer, the following methods can be used to access + ** the data. + ** + ** \code + ** uint32 val = myField->Get(); + ** myField->Set(5); + ** (*myField) = 10; + ** \endcode + ** + ** All text data is accessed in a slightly different manner. The following + ** code example best illustrates these differences. + ** + ** \code + ** // for ascii strings + ** char str1[1024]; + ** const char* p1 = "My String"; + ** const char* p2 = "My Other String"; + ** + ** myField->Set(p1); + ** (*myField) = p2; // equivalent to Set + ** + ** myField->Get(str1, 1024); // copies up to 1024 bytes of the field data into str1 + ** p1 = myField->GetRawText(); // returns a pointer to the internal string + ** \endcode + ** + ** Binary data is similar to text data, except that its base type is a pointer + ** to an unsigned, rather than a signed, char. + ** + ** \code + ** // for binary strings + ** uchar data[1024]; + ** const uchar *p1 = getBinaryData(); // not an id3lib function + ** size_t size = getBinarySize(); // not an id3lib function + ** + ** myField->Set(p1, size); + ** + ** myField->Get(data, 1024); // copies up to 1024 bytes of the field data into str1 + ** p1 = myField->GetRawBinary(); // returns a pointer to the internal string + ** \endcode + ** + ** \section updating Updating the Tag + ** + ** When you're ready to save your changes back to the file, a single call to + ** Update() is sufficient. + ** + ** \code + ** tag.Update(); + ** \endcode + ** + **/ + +/** \class ID3_Tag tag.h id3/tag.h + ** \brief The representative class of an id3 tag. + ** + ** The ID3_Tag is, at its simplest, a container for ID3v2 frames. At its + ** most complicated, it's a kitchen-sink, monolithic "catch-all" class for + ** handling almost every task associated with creating, parsing, rendering, + ** and manipulating digital audio data using id3lib. + ** + ** This simple \c #include does it all. In order to read an existing tag, do + ** the following: + ** + ** \code + ** ID3_Tag myTag; + ** myTag.Link("something.mp3"); + ** \endcode + ** + ** That is all there is to it. Now all you have to do is use the Find() + ** method to locate the frames you are interested in is the following: + ** + ** \code + ** ID3_Frame* myFrame = myTag.Find(ID3FID_TITLE); + ** if (NULL != myFrame) + ** { + ** const char* title = myFrame->GetField(ID3FN_TEXT)->GetText(); + ** cout << "Title: " << title << endl; + ** } + ** \endcode + ** + ** This code snippet locates the ID3FID_TITLE frame and displays the + ** text field. + ** + ** When using the ID3_Tag::Link() method, you automatically gain access to any + ** ID3v1/1.1, ID3v2, Lyrics3 v2.0, and MusicMatch tags present in the file. + ** The class will automaticaly parse and convert any of these foreign tag + ** formats into ID3v2 tags. Also, id3lib will correctly parse any correctly + ** formatted 'CDM' frames from the unreleased ID3v2 2.01 draft specification. + ** + ** \author Dirk Mahoney + ** \version $Id: tag.cpp,v 1.5 2008/01/15 11:20:40 stulleamgym Exp $ + ** \sa ID3_Frame + ** \sa ID3_Field + ** \sa ID3_Err + **/ + +/** Default constructor; it can accept an optional filename as a parameter. + ** + ** If this file exists, it will be opened and all id3lib-supported tags will + ** be parsed and converted to ID3v2 if necessary. After the conversion, the + ** file will remain unchanged, and will continue to do so until you use the + ** Update() method on the tag (if you choose to Update() at all). + ** + ** \param name The filename of the mp3 file to link to + **/ +ID3_Tag::ID3_Tag(const char *name) + : _impl(new ID3_TagImpl(name)) +{ +} + +/** Standard copy constructor. + ** + ** \param tag What is copied into this tag + **/ +ID3_Tag::ID3_Tag(const ID3_Tag &tag) + : _impl(new ID3_TagImpl(tag)) +{ +} + +ID3_Tag::~ID3_Tag() +{ + delete _impl; +} + +/** Clears the object and disassociates it from any files. + ** + ** Frees any resources for which the object is responsible, including all + ** frames and files. After a call to Clear(), the object can be used + ** again for any new or existing tag. + **/ +void ID3_Tag::Clear() +{ + _impl->Clear(); +} + + +/** Indicates whether the tag has been altered since the last parse, render, + ** or update. + ** + ** If you have a tag linked to a file, you do not need this method since the + ** Update() method will check for changes before writing the tag. + ** + ** This method is primarily intended as a status indicator for applications + ** and for applications that use the Parse() and Render() methods. + ** + ** Setting a field, changed the ID of an attached frame, setting or grouping + ** or encryption IDs, and clearing a frame or field all constitute a change + ** to the tag, as do calls to the SetUnsync(), SetExtendedHeader(), and + ** SetPadding() methods. + ** + ** \code + ** if (myTag.HasChanged()) + ** { + ** // render and output the tag + ** } + ** \endcode + ** + ** \return Whether or not the tag has been altered. + **/ +bool ID3_Tag::HasChanged() const +{ + return _impl->HasChanged(); +} + +/** Returns an over estimate of the number of bytes required to store a + ** binary version of a tag. + ** + ** When using Render() to render a binary tag to a + ** memory buffer, first use the result of this call to allocate a buffer of + ** unsigned chars. + ** + ** \code + ** if (myTag.HasChanged()) + ** { + ** size_t tagSize; = myTag.Size(); + ** if (tagSize > 0) + ** { + ** uchar *buffer = new uchar[tagSize]; + ** if (NULL != buffer) + ** { + ** size_t actualSize = myTag.Render(buffer); + ** // do something useful with the first + ** // 'actualSize' bytes of the buffer, + ** // like push it down a socket + ** delete [] buffer; + ** } + ** } + ** } + ** \endcode + ** + ** @see #Render + ** @return The (overestimated) number of bytes required to store a binary + ** version of a tag + **/ +size_t ID3_Tag::Size() const +{ + return _impl->Size(); +} + +/** Turns unsynchronization on or off, dependant on the value of the boolean + ** parameter. + ** + ** If you call this method with 'false' as the parameter, the + ** binary tag will not be unsync'ed, regardless of whether the tag should + ** be. This option is useful when the file is only going to be used by + ** ID3v2-compliant software. See the ID3v2 standard document for futher + ** details on unsync. + ** + ** Be default, tags are created without unsync. + ** + ** \code + ** myTag.SetUnsync(false); + ** \endcode + ** + ** \param bSync Whether the tag should be unsynchronized + **/ +bool ID3_Tag::SetUnsync(bool b) +{ + return _impl->SetUnsync(b); +} + + +/** Turns extended header rendering on or off, dependant on the value of the + ** boolean parameter. + ** + ** This option is currently ignored as id3lib doesn't yet create extended + ** headers. This option only applies when rendering tags for ID3v2 versions + ** that support extended headers. + ** + ** \code + ** myTag.SetExtendedHeader(true); + ** \endcode + ** + ** \param bExt Whether to render an extended header + **/ +bool ID3_Tag::SetExtendedHeader(bool ext) +{ + return _impl->SetExtended(ext); +} + +/** Turns padding on or off, dependant on the value of the boolean + ** parameter. + ** + ** When using ID3v2 tags in association with files, id3lib can optionally + ** add padding to the tags to ensure minmal file write times when updating + ** the tag in the future. + ** + ** When the padding option is switched on, id3lib automatically creates + ** padding according to the 'ID3v2 Programming Guidelines'. Specifically, + ** enough padding will be added to round out the entire file (song plus + ** tag) to an even multiple of 2K. Padding will only be created when the + ** tag is attached to a file and that file is not empty (aside from a + ** pre-existing tag). + ** + ** id3lib's addition to the guidelines for padding, is that if frames are + ** removed from a pre-existing tag (or the tag simply shrinks because of + ** other reasons), the new tag will continue to stay the same size as the + ** old tag (with padding making the difference of course) until such time as + ** the padding is greater than 4K. When this happens, the padding will be + ** reduced and the new tag will be smaller than the old. + ** + ** By default, padding is switched on. + ** + ** \code + ** myTag.SetPadding(false); + ** \endcode + ** + ** \param bPad Whether or not render the tag with padding. + **/ +bool ID3_Tag::SetPadding(bool pad) +{ + return _impl->SetPadding(pad); +} + +bool ID3_Tag::SetExperimental(bool exp) +{ + return _impl->SetExperimental(exp); +} + +bool ID3_Tag::GetUnsync() const +{ + return _impl->GetUnsync(); +} + +bool ID3_Tag::GetExtendedHeader() const +{ + return _impl->GetExtended(); +} + +bool ID3_Tag::GetExperimental() const +{ + return _impl->GetExperimental(); +} + +void ID3_Tag::AddFrame(const ID3_Frame& frame) +{ + _impl->AddFrame(frame); +} + +/** Attaches a frame to the tag; the tag doesn't take responsibility for + ** releasing the frame's memory when tag goes out of scope. + ** + ** Optionally, operator<< can also be used to attach a frame to a tag. To + ** use, simply supply its parameter a pointer to the ID3_Frame object you wish + ** to attach. + ** + ** \code + ** ID3_Frame myFrame; + ** myTag.AddFrame(&myFrame); + ** \endcode + ** + ** As stated, this method attaches the frames to the tag---the tag does + ** not create its own copy of the frame. Frames created by an application + ** must exist until the frame is removed or the tag is finished with it. + ** + ** \param pFrame A pointer to the frame that is being added to the tag. + ** \sa ID3_Frame + **/ +void ID3_Tag::AddFrame(const ID3_Frame* frame) +{ + _impl->AddFrame(frame); +} + +/** Attaches a frame to the tag; the tag takes responsibility for + ** releasing the frame's memory when tag goes out of scope. + ** + ** This method accepts responsibility for the attached frame's memory, and + ** will delete the frame and its contents when the tag goes out of scope or is + ** deleted. Therefore, be sure the frame isn't "Attached" to other tags. + ** + ** \code + ** ID3_Frame *frame = new ID3_Frame; + ** myTag.AttachFrame(frame); + ** \endcode + ** + ** \param frame A pointer to the frame that is being added to the tag. + **/ +bool ID3_Tag::AttachFrame(ID3_Frame *frame) +{ + return _impl->AttachFrame(frame); +} + + +/** Removes a frame from the tag. + ** + ** If you already own the frame object in question, then you should already + ** have a pointer to the frame you want to delete. If not, or if you wish to + ** delete a pre-existing frame (from a tag you have parsed, for example), the + ** use one of the Find methods to obtain a frame pointer to pass to this + ** method. + ** + ** \code + ** ID3_Frame *someFrame; + ** if (someFrame = myTag.Find(ID3FID_TITLE)) + ** { + ** myTag.RemoveFrame(someFrame); + ** } + ** \endcode + ** + ** \sa ID3_Tag#Find + ** \param pOldFrame A pointer to the frame that is to be removed from the + ** tag + **/ +ID3_Frame* ID3_Tag::RemoveFrame(const ID3_Frame *frame) +{ + return _impl->RemoveFrame(frame); +} + +bool ID3_Tag::Parse(ID3_Reader& reader) +{ + return id3::v2::parse(*_impl, reader); +} + +size_t ID3_Tag::Parse(const uchar* buffer, size_t bytes) +{ + ID3_MemoryReader mr(buffer, bytes); + ID3_Reader::pos_type beg = mr.getCur(); + id3::v2::parse(*_impl, mr); + return mr.getEnd() - beg; +} + +/** Turns a binary tag into a series of ID3_Frame objects attached to the + ** tag. + ** + ** \code + ** ID3_Tag myTag; + ** uchar header[ID3_TAGHEADERSIZE]; + ** uchar *buffer; + ** luint tagSize; + ** + ** // get ID3_TAGHEADERSIZE from a socket or somewhere + ** // ... + ** + ** if ((tagSize = ID3_IsTagHeader(ourSourceBuffer)) > -1) + ** { + ** // read a further 'tagSize' bytes in + ** // from our data source + ** // ... + ** + ** if (buffer = new uchar[tagSize]) + ** { + ** // now we will call ID3_Tag::Parse() + ** // with these values (explained later) + ** myTag.Parse(header, buffer); + ** + ** // do something with the objects, + ** // like look for titles, artists, etc. + ** // ... + ** + ** // free the buffer + ** delete [] buffer; + ** } + ** } + ** \endcode + ** + ** \sa ID3_Frame + ** @param header The byte header read in from the data source. + ** @param buffer The remainder of the tag (not including the data source) + ** read in from the data source. + **/ +size_t ID3_Tag::Parse(const uchar header[ID3_TAGHEADERSIZE], const uchar *buffer) +{ + size_t size = ID3_Tag::IsV2Tag(header); + if (0 == size) + { + return 0; + } + BString buf; + buf.reserve(ID3_TagHeader::SIZE + size); + buf.append(reinterpret_cast(header), + ID3_TagHeader::SIZE); + buf.append(reinterpret_cast(buffer), size); + return this->Parse(buf.data(), buf.size()); +} + +/** Renders the tag and writes it to the attached file; the type of tag + ** rendered can be specified as a parameter. The default is to update only + ** the ID3v2 tag. See the ID3_TagType enumeration for the constants that + ** can be used. + ** + ** Make sure the rendering parameters are set before calling the method. + ** See the Link documentation for an example of this method in use. + ** + ** \sa ID3_TagType + ** \sa Link + ** \param tt The type of tag to update. + **/ +/** Renders a binary image of the tag into the supplied buffer. + ** + ** See Size() for an example. This method returns the actual number of the + ** bytes of the buffer used to store the tag. This will be no more than the + ** size of the buffer itself, because Size() over estimates the required + ** buffer size when padding is enabled. + ** + ** Before calling this method, it is advisable to call HasChanged() first as + ** this will let you know whether you should bother rendering the tag. + ** + ** @see ID3_IsTagHeader + ** @see ID3_Tag#HasChanged + ** @return The actual number of the bytes of the buffer used to store the + ** tag + ** @param buffer The buffer that will contain the rendered tag. + **/ +size_t ID3_Tag::Render(uchar* buffer, ID3_TagType tt) const +{ + ID3_MemoryWriter mw(buffer, -1); + return this->Render(mw, tt); +} + +size_t ID3_Tag::Render(ID3_Writer& writer, ID3_TagType tt) const +{ + ID3_Writer::pos_type beg = writer.getCur(); + if (ID3TT_ID3V2 & tt) + { + id3::v2::render(writer, *this); + } + else if (ID3TT_ID3V1 & tt) + { + id3::v1::render(writer, *this); + } + return writer.getCur() - beg; +} + + +/** Attaches a file to the tag, parses the file, and adds any tag information + ** found in the file to the tag. + ** + ** Use this method if you created your ID3_Tag object without supplying a + ** parameter to the constructor (maybe you created an array of ID3_Tag + ** pointers). This is the preferred method of interacting with files, since + ** id3lib can automatically do things like parse foreign tag formats and + ** handle padding when linked to a file. When a tag is linked to a file, you + ** do not need to use the Size(), Render(const uchar*, size_t), or + ** Parse(ID3_Reader&) methods or the IsV2Tag(ID3_Reader&) static function-- + ** id3lib will take care of those details for you. The single parameter is a + ** pointer to a file name. + ** + ** Link returns the size of the the ID3v2 tag (if any) that begins the file. + ** + ** \code + ** ID3_Tag myTag; + ** myTag.Link("mysong.mp3"); + ** + ** // do whatever we want with the tag + ** // ... + ** + ** // setup all our rendering parameters + ** myTag->SetUnsync(false); + ** myTag->SetExtendedHeader(true); + ** myTag->SetCompression(true); + ** myTag->SetPadding(true); + ** + ** // write any changes to the file + ** myTag->Update() + ** + ** \endcode + ** + ** @see IsV2Tag + ** @param fileInfo The filename of the file to link to. + **/ +size_t ID3_Tag::Link(const char *fileInfo, flags_t flags) +{ + return _impl->Link(fileInfo, flags); +} + +/** + ** Same as above, but takes a ID3_Reader as argument. + */ +size_t ID3_Tag::Link(ID3_Reader &reader, flags_t flags) +{ + return _impl->Link(reader, flags); +} + +flags_t ID3_Tag::Update(flags_t flags) +{ + return _impl->Update(flags); +} + +/** + ** Get's the mp3 Info like bitrate, mpeg version, etc. + ** Can be run after Link() + ** + **/ +const Mp3_Headerinfo* ID3_Tag::GetMp3HeaderInfo() const +{ + return _impl->GetMp3HeaderInfo(); +} + +/** Strips the tag(s) from the attached file. The type of tag stripped + ** can be specified as a parameter. The default is to strip all tag types. + ** + ** \param tt The type of tag to strip + ** \sa ID3_TagType + **/ +flags_t ID3_Tag::Strip(flags_t flags) +{ + return _impl->Strip(flags); +} + +size_t ID3_Tag::GetPrependedBytes() const +{ + return _impl->GetPrependedBytes(); +} + +size_t ID3_Tag::GetAppendedBytes() const +{ + return _impl->GetAppendedBytes(); +} + +size_t ID3_Tag::GetFileSize() const +{ + return _impl->GetFileSize(); +} + +const char* ID3_Tag::GetFileName() const +{ + //fix because GetFileName need to return a pointer which keeps to be valid + String fn = _impl->GetFileName(); + if (fn.size()) + { + memset((char *)_tmp_filename, 0, ID3_PATH_LENGTH); + memmove((char *)_tmp_filename, fn.c_str(), fn.size()); + return _tmp_filename; //_impl->GetFileName().c_str(); + } + else + return NULL; +} + +/// Finds frame with given frame id + /** Returns a pointer to the next ID3_Frame with the given ID3_FrameID; + ** returns NULL if no such frame found. + ** + ** If there are multiple frames in the tag with the same ID (which, for some + ** frames, is allowed), then subsequent calls to Find() will return + ** subsequent frame pointers, wrapping if necessary. + ** + ** \code + ** ID3_Frame *myFrame; + ** if (myFrame = myTag.Find(ID3FID_TITLE)) + ** { + ** // do something with the frame, like copy + ** // the contents into a buffer, display the + ** // contents in a window, etc. + ** // ... + ** } + ** \endcode + ** + ** You may optionally supply to more parameters ot this method, being an + ** ID3_FieldID and a value of some sort. Depending on the field name/ID you + ** supply, you may supply an integer, a char* or a unicode_t* as the third + ** parameter. If you supply an ID3_FrameID, you must also supply a data + ** value to compare against. + ** + ** This method will then return the first frame that has a matching frame + ** ID, and which has a field with the same name as that which you supplied + ** in the second parameter, whose calue matches that which you supplied as + ** the third parameter. For example: + ** + ** \code + ** ID3_Frame *myFrame; + ** if (myFrame = myTag.Find(ID3FID_TITLE, ID3FN_TEXT, "Nirvana")) + ** { + ** // found it, do something with it. + ** // ... + ** } + ** \endcode + ** + ** This example will return the first TITLE frame and whose TEXT field is + ** 'Nirvana'. Currently there is no provision for things like 'contains', + ** 'greater than', or 'less than'. If there happens to be more than one of + ** these frames, subsequent calls to the Find() method will return + ** subsequent frames and will wrap around to the beginning. + ** + ** Another example... + ** + ** \code + ** ID3_Frame *myFrame; + ** if (myFrame = myTag.Find(ID3FID_COMMENT, ID3FN_TEXTENC, ID3TE_UNICODE)) + ** { + ** // found it, do something with it. + ** // ... + ** } + ** \endcode + ** + ** This returns the first COMMENT frame that uses Unicode as its text + ** encdoing. + ** + ** @name Find + ** @param id The ID of the frame that is to be located + ** @return A pointer to the first frame found that has the given frame id, + ** or NULL if no such frame. + **/ +ID3_Frame* ID3_Tag::Find(ID3_FrameID id) const +{ + return _impl->Find(id); +} + +/// Finds frame with given frame id, fld id, and integer data +ID3_Frame* ID3_Tag::Find(ID3_FrameID id, ID3_FieldID fld, uint32 data) const +{ + return _impl->Find(id, fld, data); +} + +/// Finds frame with given frame id, fld id, and ascii data +ID3_Frame* ID3_Tag::Find(ID3_FrameID id, ID3_FieldID fld, const char* data) const +{ + String str(data); + return _impl->Find(id, fld, str); +} + +/// Finds frame with given frame id, fld id, and unicode data +ID3_Frame* ID3_Tag::Find(ID3_FrameID id, ID3_FieldID fld, const unicode_t* data) const +{ + WString str = toWString(data, ucslen(data)); + return _impl->Find(id, fld, str); +} + +/** Returns the number of frames present in the tag object. + ** + ** This includes only those frames that id3lib recognises. This is used as + ** the upper bound on calls to the GetFrame() and operator[]() methods. + ** + ** \return The number of frames present in the tag object. + **/ +size_t ID3_Tag::NumFrames() const +{ + return _impl->NumFrames(); +} + +/** Returns a pointer to the frame with the given index; returns NULL if + ** there is no such frame at that index. + ** + ** Optionally, operator[](size_t) can be used as an alternative to this + ** method. Indexing is 0-based (that is, the first frame is number 0, and the + ** last frame in a tag that holds n frames is n-1). + ** + ** If you wish to have a more comlex searching facility, then at least for + ** now you will have to devise it yourself and implement it useing these + ** methods. + ** + ** @param nIndex The index of the frame that is to be retrieved + ** @return A pointer to the requested frame, or NULL if no such frame. + **/ +/* +ID3_Frame* ID3_Tag::GetFrameNum(size_t num) const +{ + const size_t numFrames = this->NumFrames(); + if (num >= numFrames) + { + return NULL; + } + + ID3_Frame* frame = NULL; + size_t curNum = 0; + // search from the cursor to the end + for (ID3_TagImpl::const_iterator cur = _impl->begin(); cur != _impl->end(); ++cur) + { + if (curNum++ == num) + { + frame = *cur; + break; + } + } + + return frame; +} +*/ + +/** Returns a pointer to the frame with the given index; returns NULL if + ** there is no such frame at that index. + ** + ** @name operator[] + ** @param index The index of the frame that is to be retrieved + ** @return A pointer to the requested frame, or NULL if no such frame. + ** @see #GetFrameNum + **/ +/* +ID3_Frame* ID3_Tag::operator[](size_t index) const +{ + return this->GetFrameNum(index); +} +*/ + +ID3_Tag& ID3_Tag::operator=( const ID3_Tag &rTag ) +{ + if (this != &rTag) + { + *_impl = rTag; + } + return *this; +} + +bool ID3_Tag::HasTagType(ID3_TagType tt) const +{ + return _impl->HasTagType(tt); +} + +ID3_V2Spec ID3_Tag::GetSpec() const +{ + return _impl->GetSpec(); +} + +bool ID3_Tag::SetSpec(ID3_V2Spec spec) +{ + return _impl->SetSpec(spec); +} + +/** Analyses a buffer to determine if we have a valid ID3v2 tag header. + ** If so, return the total number of bytes (including the header) to + ** read so we get all of the tag + **/ +size_t ID3_Tag::IsV2Tag(const uchar* const data) +{ + ID3_MemoryReader mr(data, ID3_TagHeader::SIZE); + return ID3_TagImpl::IsV2Tag(mr); +} + +size_t ID3_Tag::IsV2Tag(ID3_Reader& reader) +{ + return ID3_TagImpl::IsV2Tag(reader); +} + +/// Deprecated +void ID3_Tag::AddNewFrame(ID3_Frame* f) +{ + _impl->AttachFrame(f); +} + +/** Copies an array of frames to the tag. + ** + ** This method copies each frame in an array to the tag. As in + ** AddFrame, the tag adds a copy of the frame, and it assumes responsiblity + ** for freeing the frames' memory when the tag goes out of scope. + ** + ** \code + ** ID3_Frame myFrames[10]; + ** myTag.AddFrames(myFrames, 10); + ** \endcode + ** + ** \sa ID3_Frame + ** \sa ID3_Frame#AddFrame + ** \param pNewFrames A pointer to an array of frames to be added to the tag. + ** \param nFrames The number of frames in the array pNewFrames. + **/ +void ID3_Tag::AddFrames(const ID3_Frame *frames, size_t numFrames) +{ + for (size_t i = numFrames; i > 0; i--) + { + this->AddFrame(frames[i-1]); + } +} + +size_t ID3_Tag::Link(const char *fileInfo, bool parseID3v1, bool parseLyrics3) +{ + return _impl->Link(fileInfo, parseID3v1, parseLyrics3); +} + +void ID3_Tag::SetCompression(bool b) +{ + ; +} + +bool ID3_Tag::HasLyrics() const +{ + return this->HasTagType(ID3TT_LYRICS); +} +bool ID3_Tag::HasV2Tag() const +{ + return this->HasTagType(ID3TT_ID3V2); +} +bool ID3_Tag::HasV1Tag() const +{ + return this->HasTagType(ID3TT_ID3V1); +} + +/** Copies a frame to the tag. The frame parameter can thus safely be deleted + ** or allowed to go out of scope. + ** + ** Operator<< supports the addition of a pointer to a frame object, or + ** the frame object itself. + ** + ** \code + ** ID3_Frame *pFrame, frame; + ** p_frame = &frame; + ** myTag << pFrame; + ** myTag << frame; + ** \endcode + ** + ** Both these methods copy the given frame to the tag---the tag creates its + ** own copy of the frame. + ** + ** \name operator<< + ** \param frame The frame to be added to the tag. + **/ +ID3_Tag& ID3_Tag::operator<<(const ID3_Frame& frame) +{ + this->AddFrame(frame); + return *this; +} + + +ID3_Tag& ID3_Tag::operator<<(const ID3_Frame* frame) +{ + if (frame) + { + this->AddFrame(frame); + } + return *this; +} + +off_t ID3_IsTagHeader(const uchar data[ID3_TAGHEADERSIZE]) +{ + size_t size = ID3_Tag::IsV2Tag(data); + + if (!size) + { + return -1; + } + + return size - ID3_TagHeader::SIZE; +} + + +namespace +{ + class IteratorImpl : public ID3_Tag::Iterator + { + ID3_TagImpl::iterator _cur; + ID3_TagImpl::iterator _end; + public: + IteratorImpl(ID3_TagImpl& tag) + : _cur(tag.begin()), _end(tag.end()) + { + } + + ID3_Frame* GetNext() + { + ID3_Frame* next = NULL; + while (next == NULL && _cur != _end) + { + next = *_cur; + ++_cur; + } + return next; + } + }; + + + class ConstIteratorImpl : public ID3_Tag::ConstIterator + { + ID3_TagImpl::const_iterator _cur; + ID3_TagImpl::const_iterator _end; + public: + ConstIteratorImpl(ID3_TagImpl& tag) + : _cur(tag.begin()), _end(tag.end()) + { + } + const ID3_Frame* GetNext() + { + ID3_Frame* next = NULL; + while (next == NULL && _cur != _end) + { + next = *_cur; + ++_cur; + } + return next; + } + }; +} + +ID3_Tag::Iterator* +ID3_Tag::CreateIterator() +{ + return new IteratorImpl(*_impl); +} + +ID3_Tag::ConstIterator* +ID3_Tag::CreateIterator() const +{ + return new ConstIteratorImpl(*_impl); +} + diff --git a/id3lib/src/tag_file.cpp b/id3lib/src/tag_file.cpp new file mode 100644 index 0000000..dd0db5a --- /dev/null +++ b/id3lib/src/tag_file.cpp @@ -0,0 +1,485 @@ +// $Id: tag_file.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include //for BUFSIZ and functions remove & rename +#include "writers.h" +#include "io_strings.h" +#include "tag_impl.h" //has "tag.h" "header_tag.h" "frame.h" "field.h" "spec.h" "id3lib_strings.h" "utils.h" + +using namespace dami; + +#if !defined HAVE_MKSTEMP +# include +#endif + +#if defined HAVE_UNISTD_H +# include +#endif + +#if defined HAVE_SYS_STAT_H +# include +#endif + +#if defined WIN32 && (!defined(WINCE)) +# include +static int truncate(const char *path, size_t length) +{ + int result = -1; + HANDLE fh; + + fh = ::CreateFileA(path, + GENERIC_WRITE | GENERIC_READ, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if(INVALID_HANDLE_VALUE != fh) + { + SetFilePointer(fh, length, NULL, FILE_BEGIN); + SetEndOfFile(fh); + CloseHandle(fh); + result = 0; + } + + return result; +} + +// prevents a weird error I was getting compiling this under windows +# if defined CreateFile +# undef CreateFile +# endif + +#elif defined(WINCE) +// Createfile is apparently to defined to CreateFileW. (Bad Bad Bad), so we +// work around it by converting path to Unicode +# include +static int truncate(const char *path, size_t length) +{ + int result = -1; + wchar_t wcTempPath[256]; + mbstowcs(wcTempPath,path,255); + HANDLE fh; + fh = ::CreateFile(wcTempPath, + GENERIC_WRITE | GENERIC_READ, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (INVALID_HANDLE_VALUE != fh) + { + SetFilePointer(fh, length, NULL, FILE_BEGIN); + SetEndOfFile(fh); + CloseHandle(fh); + result = 0; + } + + return result; +} + +#elif defined(macintosh) + +static int truncate(const char *path, size_t length) +{ + /* not implemented on the Mac */ + return -1; +} + +#endif + +size_t ID3_TagImpl::Link(const char *fileInfo, bool parseID3v1, bool parseLyrics3) +{ + flags_t tt = ID3TT_NONE; + if (parseID3v1) + { + tt |= ID3TT_ID3V1; + } + if (parseLyrics3) + { + tt |= ID3TT_LYRICS; + } + return this->Link(fileInfo, tt); +} + +size_t ID3_TagImpl::Link(const char *fileInfo, flags_t tag_types) +{ + _tags_to_parse.set(tag_types); + + if (NULL == fileInfo) + { + return 0; + } + + _file_name = fileInfo; + _changed = true; + + this->ParseFile(); + + return this->GetPrependedBytes(); +} + +// used for streaming: +size_t ID3_TagImpl::Link(ID3_Reader &reader, flags_t tag_types) +{ + _tags_to_parse.set(tag_types); + + _file_name = ""; + _changed = true; + + this->ParseReader(reader); + + return this->GetPrependedBytes(); +} + +size_t RenderV1ToFile(ID3_TagImpl& tag, fstream& file) +{ + if (!file) + { + return 0; + } + + // Heck no, this is stupid. If we do not read in an initial V1(.1) + // header then we are constantly appending new V1(.1) headers. Files + // can get very big that way if we never overwrite the old ones. + // if (ID3_V1_LEN > tag.GetAppendedBytes()) - Daniel Hazelbaker + if (ID3_V1_LEN > tag.GetFileSize()) + { + file.seekp(0, ios::end); + } + else + { + // We want to check if there is already an id3v1 tag, so we can write over + // it. First, seek to the beginning of any possible id3v1 tag + file.seekg(0-ID3_V1_LEN, ios::end); + char sID[ID3_V1_LEN_ID]; + + // Read in the TAG characters + file.read(sID, ID3_V1_LEN_ID); + + // If those three characters are TAG, then there's a preexisting id3v1 tag, + // so we should set the file cursor so we can overwrite it with a new tag. + if (memcmp(sID, "TAG", ID3_V1_LEN_ID) == 0) + { + file.seekp(0-ID3_V1_LEN, ios::end); + } + // Otherwise, set the cursor to the end of the file so we can append on + // the new tag. + else + { + file.seekp(0, ios::end); + } + } + + ID3_IOStreamWriter out(file); + + id3::v1::render(out, tag); + + return ID3_V1_LEN; +} + +size_t RenderV2ToFile(const ID3_TagImpl& tag, fstream& file) +{ + ID3D_NOTICE( "RenderV2ToFile: starting" ); + if (!file) + { + ID3D_WARNING( "RenderV2ToFile: error in file" ); + return 0; + } + + String tagString; + io::StringWriter writer(tagString); + id3::v2::render(writer, tag); + ID3D_NOTICE( "RenderV2ToFile: rendered v2" ); + + const char* tagData = tagString.data(); + size_t tagSize = tagString.size(); + // if the new tag fits perfectly within the old and the old one + // actually existed (ie this isn't the first tag this file has had) + if ((!tag.GetPrependedBytes() && !ID3_GetDataSize(tag)) || + (tagSize == tag.GetPrependedBytes())) + { + file.seekp(0, ios::beg); + file.write(tagData, tagSize); + } + else + { + String filename = tag.GetFileName(); + String sTmpSuffix = ".XXXXXX"; + if (filename.size() + sTmpSuffix.size() > ID3_PATH_LENGTH) + { + // log this + return 0; + //ID3_THROW_DESC(ID3E_NoFile, "filename too long"); + } + char sTempFile[ID3_PATH_LENGTH]; + strcpy(sTempFile, filename.c_str()); + strcat(sTempFile, sTmpSuffix.c_str()); + +#if ((defined(__GNUC__) && __GNUC__ >= 3 ) || !defined(HAVE_MKSTEMP)) + // This section is for Windows folk && gcc 3.x folk + fstream tmpOut; + createFile(sTempFile, tmpOut); + + tmpOut.write(tagData, tagSize); + file.seekg(tag.GetPrependedBytes(), ios::beg); + char *tmpBuffer[BUFSIZ]; + while (!file.eof()) + { + file.read((char *)tmpBuffer, BUFSIZ); + size_t nBytes = file.gcount(); + tmpOut.write((char *)tmpBuffer, nBytes); + } + +#else //((defined(__GNUC__) && __GNUC__ >= 3 ) || !defined(HAVE_MKSTEMP)) + + // else we gotta make a temp file, copy the tag into it, copy the + // rest of the old file after the tag, delete the old file, rename + // this new file to the old file's name and update the handle + + int fd = mkstemp(sTempFile); + if (fd < 0) + { + remove(sTempFile); + //ID3_THROW_DESC(ID3E_NoFile, "couldn't open temp file"); + } + + ofstream tmpOut(fd); + if (!tmpOut) + { + tmpOut.close(); + remove(sTempFile); + return 0; + // log this + //ID3_THROW(ID3E_ReadOnly); + } + + tmpOut.write(tagData, tagSize); + file.seekg(tag.GetPrependedBytes(), ios::beg); + uchar tmpBuffer[BUFSIZ]; + while (file) + { + file.read(tmpBuffer, BUFSIZ); + size_t nBytes = file.gcount(); + tmpOut.write(tmpBuffer, nBytes); + } + + close(fd); //closes the file + +#endif ////((defined(__GNUC__) && __GNUC__ >= 3 ) || !defined(HAVE_MKSTEMP)) + + tmpOut.close(); + file.close(); + + // the following sets the permissions of the new file + // to be the same as the original +#if defined(HAVE_SYS_STAT_H) + struct stat fileStat; + if(stat(filename.c_str(), &fileStat) == 0) + { +#endif //defined(HAVE_SYS_STAT_H) + remove(filename.c_str()); + rename(sTempFile, filename.c_str()); +#if defined(HAVE_SYS_STAT_H) + chmod(filename.c_str(), fileStat.st_mode); + } +#endif //defined(HAVE_SYS_STAT_H) + +// file = tmpOut; + file.clear();//to clear the eof mark + openWritableFile(filename, file); + } + + return tagSize; +} + + +flags_t ID3_TagImpl::Update(flags_t ulTagFlag) +{ + flags_t tags = ID3TT_NONE; + + fstream file; + String filename = this->GetFileName(); + ID3_Err err = openWritableFile(filename, file); + _file_size = getFileSize(file); + + if (err == ID3E_NoFile) + { + err = createFile(filename, file); + } + if (err == ID3E_ReadOnly) + { + return tags; + } + + if ((ulTagFlag & ID3TT_ID3V2) && this->HasChanged()) + { + _prepended_bytes = RenderV2ToFile(*this, file); + if (_prepended_bytes) + { + tags |= ID3TT_ID3V2; + } + } + + if ((ulTagFlag & ID3TT_ID3V1) && + (!this->HasTagType(ID3TT_ID3V1) || this->HasChanged())) + { + size_t tag_bytes = RenderV1ToFile(*this, file); + if (tag_bytes) + { + // only add the tag_bytes if there wasn't an id3v1 tag before + if (! _file_tags.test(ID3TT_ID3V1)) + { + _appended_bytes += tag_bytes; + } + tags |= ID3TT_ID3V1; + } + } + _changed = false; + _file_tags.add(tags); + _file_size = getFileSize(file); + file.close(); + return tags; +} + +flags_t ID3_TagImpl::Strip(flags_t ulTagFlag) +{ + flags_t ulTags = ID3TT_NONE; + const size_t data_size = ID3_GetDataSize(*this); + + // First remove the v2 tag, if requested + if (ulTagFlag & ID3TT_PREPENDED & _file_tags.get()) + { + fstream file; + if (ID3E_NoError != openWritableFile(this->GetFileName(), file)) + { + return ulTags; + } + _file_size = getFileSize(file); + + // We will remove the id3v2 tag in place: since it comes at the beginning + // of the file, we'll effectively move all the data that comes after the + // tag back n bytes, where n is the size of the id3v2 tag. Once we've + // copied the data, we'll truncate the file. + file.seekg(this->GetPrependedBytes(), ios::beg); + + uchar aucBuffer[BUFSIZ]; + + // The nBytesRemaining variable indicates how many bytes are to be copied + size_t nBytesToCopy = data_size; + + // Here we increase the nBytesToCopy by the size of any tags that appear + // at the end of the file if we don't want to strip them + if (!(ulTagFlag & ID3TT_APPENDED)) + { + nBytesToCopy += this->GetAppendedBytes(); + } + + // The nBytesRemaining variable indicates how many bytes are left to be + // moved in the actual file. + // The nBytesCopied variable keeps track of how many actual bytes were + // copied (or moved) so far. + size_t nBytesRemaining = nBytesToCopy, + nBytesCopied = 0; + while (!file.eof()) + { +#if (defined(__GNUC__) && __GNUC__ == 2) + size_t nBytesToRead = (size_t)dami::min((unsigned int)(nBytesRemaining - nBytesCopied), (unsigned int)BUFSIZ); +#else + size_t nBytesToRead = min((unsigned int)(nBytesRemaining - nBytesCopied), (unsigned int)BUFSIZ); +#endif + file.read((char *)aucBuffer, nBytesToRead); + size_t nBytesRead = file.gcount(); + + if (nBytesRead != nBytesToRead) + { + // TODO: log this + //cerr << "--- attempted to write " << nBytesRead << " bytes, " + // << "only wrote " << nBytesWritten << endl; + } + if (nBytesRead > 0) + { + off_t offset = nBytesRead + this->GetPrependedBytes(); + file.seekp(-offset, ios::cur); + file.write((char *)aucBuffer, nBytesRead); + file.seekg(this->GetPrependedBytes(), ios::cur); + nBytesCopied += nBytesRead; + } + + if (nBytesCopied == nBytesToCopy || nBytesToRead < BUFSIZ) + { + break; + } + } + file.close(); + } + + size_t nNewFileSize = data_size; + + if ((_file_tags.get() & ID3TT_APPENDED) && (ulTagFlag & ID3TT_APPENDED)) + { + ulTags |= _file_tags.get() & ID3TT_APPENDED; + } + else + { + // if we're not stripping the appended tags, be sure to increase the file + // size by those bytes + nNewFileSize += this->GetAppendedBytes(); + } + + if ((ulTagFlag & ID3TT_PREPENDED) && (_file_tags.get() & ID3TT_PREPENDED)) + { + // If we're stripping the ID3v2 tag, there's no need to adjust the new + // file size, since it doesn't account for the ID3v2 tag size + ulTags |= _file_tags.get() & ID3TT_PREPENDED; + } + else + { + // add the original prepended tag size since we don't want to delete it, + // and the new file size represents the file size _not_ counting the ID3v2 + // tag + nNewFileSize += this->GetPrependedBytes(); + } + + if (ulTags && (truncate(_file_name.c_str(), nNewFileSize) == -1)) + { + // log this + return 0; + //ID3_THROW(ID3E_NoFile); + } + + _prepended_bytes = (ulTags & ID3TT_PREPENDED) ? 0 : _prepended_bytes; + _appended_bytes = (ulTags & ID3TT_APPENDED) ? 0 : _appended_bytes; + _file_size = data_size + _prepended_bytes + _appended_bytes; + + _changed = _file_tags.remove(ulTags) || _changed; + + return ulTags; +} + diff --git a/id3lib/src/tag_find.cpp b/id3lib/src/tag_find.cpp new file mode 100644 index 0000000..67ee6fa --- /dev/null +++ b/id3lib/src/tag_find.cpp @@ -0,0 +1,239 @@ +// $Id: tag_find.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include "tag_impl.h" //has "tag.h" "header_tag.h" "frame.h" "field.h" "spec.h" "id3lib_strings.h" "utils.h" + +using namespace dami; + +ID3_TagImpl::const_iterator ID3_TagImpl::Find(const ID3_Frame *frame) const +{ + const_iterator cur = _frames.begin(); + + for (; cur != _frames.end(); ++cur) + { + if (*cur == frame) + { + break; + } + } + + return cur; +} + +ID3_TagImpl::iterator ID3_TagImpl::Find(const ID3_Frame *frame) +{ + iterator cur = _frames.begin(); + + for (; cur != _frames.end(); ++cur) + { + if (*cur == frame) + { + break; + } + } + + return cur; +} + +ID3_Frame *ID3_TagImpl::Find(ID3_FrameID id) const +{ + ID3_Frame *frame = NULL; + + // reset the cursor if it isn't set + if (_frames.end() == _cursor) + { + _cursor = _frames.begin(); + } + + + for (int iCount = 0; iCount < 2 && frame == NULL; iCount++) + { + // We want to cycle through the list to find the matching frame. We + // should begin from the cursor, search each successive frame, wrapping + // if necessary. The enclosing loop and the assignment statments below + // ensure that we first begin at the cursor and search to the end of the + // list and, if unsuccessful, start from the beginning of the list and + // search to the cursor. + const_iterator + begin = (0 == iCount ? _cursor : _frames.begin()), + end = (0 == iCount ? _frames.end() : _cursor); + // search from the cursor to the end + for (const_iterator cur = begin; cur != end; ++cur) + { + if ((*cur != NULL) && ((*cur)->GetID() == id)) + { + // We've found a valid frame. Set the cursor to be the next element + frame = *cur; + _cursor = ++cur; + break; + } + } + } + + return frame; +} + +ID3_Frame *ID3_TagImpl::Find(ID3_FrameID id, ID3_FieldID fldID, String data) const +{ + ID3_Frame *frame = NULL; + ID3D_NOTICE( "Find: looking for comment with data = " << data.c_str() ); + + // reset the cursor if it isn't set + if (_frames.end() == _cursor) + { + _cursor = _frames.begin(); + ID3D_NOTICE( "Find: resetting cursor" ); + } + + for (int iCount = 0; iCount < 2 && frame == NULL; iCount++) + { + ID3D_NOTICE( "Find: iCount = " << iCount ); + // We want to cycle through the list to find the matching frame. We + // should begin from the cursor, search each successive frame, wrapping + // if necessary. The enclosing loop and the assignment statments below + // ensure that we first begin at the cursor and search to the end of the + // list and, if unsuccessful, start from the beginning of the list and + // search to the cursor. + const_iterator + begin = (0 == iCount ? _cursor : _frames.begin()), + end = (0 == iCount ? _frames.end() : _cursor); + // search from the cursor to the end + for (const_iterator cur = begin; cur != end; ++cur) + { + ID3D_NOTICE( "Find: frame = 0x" << hex << (uint32) *cur << dec ); + if ((*cur != NULL) && ((*cur)->GetID() == id) && + (*cur)->Contains(fldID)) + { + ID3_Field* fld = (*cur)->GetField(fldID); + if (NULL == fld) + { + continue; + ID3D_NOTICE( "Find: didn't have the right field" ); + } + + String text( NULL == fld->GetRawText() ? "" : fld->GetRawText() , fld->Size()); //PHF + ID3D_NOTICE( "Find: text = " << text.c_str() ); + + if (text == data) + { + // We've found a valid frame. Set cursor to be the next element + frame = *cur; + _cursor = ++cur; + break; + } + } + } + } + + return frame; +} + +ID3_Frame *ID3_TagImpl::Find(ID3_FrameID id, ID3_FieldID fldID, WString data) const +{ + ID3_Frame *frame = NULL; + + // reset the cursor if it isn't set + if (_frames.end() == _cursor) + { + _cursor = _frames.begin(); + } + + for (int iCount = 0; iCount < 2 && frame == NULL; iCount++) + { + // We want to cycle through the list to find the matching frame. We + // should begin from the cursor, search each successive frame, wrapping + // if necessary. The enclosing loop and the assignment statments below + // ensure that we first begin at the cursor and search to the end of the + // list and, if unsuccessful, start from the beginning of the list and + // search to the cursor. + const_iterator + begin = (0 == iCount ? _cursor : _frames.begin()), + end = (0 == iCount ? _frames.end() : _cursor); + // search from the cursor to the end + for (const_iterator cur = begin; cur != end; ++cur) + { + if ((*cur != NULL) && ((*cur)->GetID() == id) && + (*cur)->Contains(fldID)) + { + ID3_Field* fld = (*cur)->GetField(fldID); + if (NULL == fld) + { + continue; + } + WString text = toWString(fld->GetRawUnicodeText(), fld->Size()); + + if (text == data) + { + // We've found a valid frame. Set cursor to be the next element + frame = *cur; + _cursor = ++cur; + break; + } + } + } + } + + return frame; +} + +ID3_Frame *ID3_TagImpl::Find(ID3_FrameID id, ID3_FieldID fldID, uint32 data) const +{ + ID3_Frame *frame = NULL; + + // reset the cursor if it isn't set + if (_frames.end() == _cursor) + { + _cursor = _frames.begin(); + } + + for (int iCount = 0; iCount < 2 && frame == NULL; iCount++) + { + // We want to cycle through the list to find the matching frame. We + // should begin from the cursor, search each successive frame, wrapping + // if necessary. The enclosing loop and the assignment statments below + // ensure that we first begin at the cursor and search to the end of the + // list and, if unsuccessful, start from the beginning of the list and + // search to the cursor. + const_iterator + begin = (0 == iCount ? _cursor : _frames.begin()), + end = (0 == iCount ? _frames.end() : _cursor); + // search from the cursor to the end + for (const_iterator cur = begin; cur != end; ++cur) + { + if ((*cur != NULL) && ((*cur)->GetID() == id) && + ((*cur)->GetField(fldID)->Get() == data)) + { + // We've found a valid frame. Set the cursor to be the next element + frame = *cur; + _cursor = ++cur; + break; + } + } + } + + return frame; +} + diff --git a/id3lib/src/tag_impl.cpp b/id3lib/src/tag_impl.cpp new file mode 100644 index 0000000..d20f4a1 --- /dev/null +++ b/id3lib/src/tag_impl.cpp @@ -0,0 +1,327 @@ +// $Id: tag_impl.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_SYS_PARAM_H +#include +#endif + +#include "tag_impl.h" //has "tag.h" "header_tag.h" "frame.h" "field.h" "spec.h" "id3lib_strings.h" "utils.h" +//#include "io_helpers.h" +#include "io_strings.h" + +using namespace dami; + +size_t ID3_TagImpl::IsV2Tag(ID3_Reader& reader) +{ + io::ExitTrigger et(reader); + size_t tagSize = 0; + String id = io::readText(reader, ID3_TagHeader::ID_SIZE); + String ver = io::readText(reader, 2); + char flags = static_cast(reader.readChar()); + String size = io::readText(reader, 4); + + if (id == ID3_TagHeader::ID && + (uchar) ver [0] < 0xFF && (uchar) ver [1] < 0xFF && + (uchar) size[0] < 0x80 && (uchar) size[1] < 0x80 && + (uchar) size[2] < 0x80 && (uchar) size[3] < 0x80) + { + io::StringReader sr(size); + tagSize = io::readUInt28(sr) + ID3_TagHeader::SIZE; + } + else if (id != ID3_TagHeader::ID) + { + // clog << "*** IsV2Tag: Not an id3v2 tag header" << endl; + } + else if ((uchar)ver[0] >= 0xFF) + { + // clog << "*** IsV2Tag: Major offset" << endl; + } + else if ((uchar)ver[1] >= 0xFF) + { + // clog << "*** ISV2Tag: Minor offset" << endl; + } + else if ((uchar)size[0] >= 0x80) + { + // clog << "*** ISV2Tag: 1st size offset" << endl; + } + else if ((uchar)size[1] >= 0x80) + { + // clog << "*** ISV2Tag: 2nd size offset" << endl; + } + else if ((uchar)size[2] >= 0x80) + { + // clog << "*** ISV2Tag: 3rd size offset" << endl; + } + else if ((uchar)size[3] >= 0x80) + { + // clog << "*** ISV2Tag: 4th size offset" << endl; + } + else + { + // clog << "*** shouldn't get here!" << endl; + } + + return tagSize; +} + +ID3_TagImpl::ID3_TagImpl(const char *name) + : _frames(), + _cursor(_frames.begin()), + _file_name(), + _file_size(0), + _prepended_bytes(0), + _appended_bytes(0), + _is_file_writable(false), + _mp3_info(NULL) // need to do this before this->Clear() +{ + this->Clear(); + if (name) + { + this->Link(name); + } +} + +ID3_TagImpl::ID3_TagImpl(const ID3_Tag &tag) + : _frames(), + _cursor(_frames.begin()), + _file_name(), + _file_size(0), + _prepended_bytes(0), + _appended_bytes(0), + _is_file_writable(false), + _mp3_info(NULL) // need to do this before this->Clear() +{ + *this = tag; +} + +ID3_TagImpl::~ID3_TagImpl() +{ + this->Clear(); +} + +void ID3_TagImpl::Clear() +{ + for (iterator cur = _frames.begin(); cur != _frames.end(); ++cur) + { + if (*cur) + { + delete *cur; + *cur = NULL; + } + } + _frames.clear(); + _cursor = _frames.begin(); + _is_padded = true; + + _hdr.Clear(); + _hdr.SetSpec(ID3V2_LATEST); + + _tags_to_parse.clear(); + if (_mp3_info) + delete _mp3_info; // Also deletes _mp3_header + + _mp3_info = NULL; + + _changed = true; +} + + +void ID3_TagImpl::AddFrame(const ID3_Frame& frame) +{ + this->AddFrame(&frame); +} + +void ID3_TagImpl::AddFrame(const ID3_Frame* frame) +{ + if (frame) + { + ID3_Frame* frm = new ID3_Frame(*frame); + this->AttachFrame(frm); + } +} + +bool ID3_TagImpl::AttachFrame(ID3_Frame *frame) +{ + + if (NULL == frame) + { + // log this + return false; + //ID3_THROW(ID3E_NoData); + } + + _frames.push_back(frame); + _cursor = _frames.begin(); + + _changed = true; + return true; +} + + +ID3_Frame* ID3_TagImpl::RemoveFrame(const ID3_Frame *frame) +{ + ID3_Frame *frm = NULL; + + iterator fi = Find(frame); + if (fi != _frames.end()) + { + frm = *fi; + _frames.erase(fi); + _cursor = _frames.begin(); + _changed = true; + } + + return frm; +} + + +bool ID3_TagImpl::HasChanged() const +{ + bool changed = _changed; + + if (! changed) + { + for (const_iterator fi = _frames.begin(); fi != _frames.end(); ++fi) + { + if (*fi) + { + changed = (*fi)->HasChanged(); + } + + if (changed) + { + break; + } + } + } + + return changed; +} + +bool ID3_TagImpl::SetSpec(ID3_V2Spec spec) +{ + bool changed = _hdr.SetSpec(spec); + _changed = _changed || changed; + return changed; +} + +ID3_V2Spec ID3_TagImpl::GetSpec() const +{ + return _hdr.GetSpec(); +} + +bool ID3_TagImpl::SetUnsync(bool b) +{ + bool changed = _hdr.SetUnsync(b); + _changed = changed || _changed; + return changed; +} + +bool ID3_TagImpl::SetExtended(bool ext) +{ + bool changed = _hdr.SetExtended(ext); + _changed = changed || _changed; + return changed; +} + +bool ID3_TagImpl::SetExperimental(bool exp) +{ + bool changed = _hdr.SetExperimental(exp); + _changed = changed || _changed; + return changed; +} + +bool ID3_TagImpl::GetUnsync() const +{ + return _hdr.GetUnsync(); +} + +bool ID3_TagImpl::GetExtended() const +{ + return _hdr.GetExtended(); +} + +bool ID3_TagImpl::GetExperimental() const +{ + return _hdr.GetExperimental(); +} + +bool ID3_TagImpl::GetFooter() const +{ + return _hdr.GetFooter(); +} + +size_t ID3_TagImpl::GetExtendedBytes() const +{ + if (this->GetExtended()) + if (this->GetSpec() == ID3V2_4_0) + return 6; //minimal ID3v2.4 ext header size + else if (this->GetSpec() == ID3V2_3_0) + return 10; //minimal ID3v2.3 ext header size + else + return 0; //not implemented + else + return 0;; +} + +bool ID3_TagImpl::SetPadding(bool pad) +{ + bool changed = (_is_padded != pad); + _changed = changed || _changed; + if (changed) + { + _is_padded = pad; + } + + return changed; +} + + +ID3_TagImpl & +ID3_TagImpl::operator=( const ID3_Tag &rTag ) +{ + this->Clear(); + + this->SetUnsync(rTag.GetUnsync()); + this->SetExtended(rTag.GetExtendedHeader()); + this->SetExperimental(rTag.GetExperimental()); + + ID3_Tag::ConstIterator* iter = rTag.CreateIterator(); + const ID3_Frame* frame = NULL; + while (NULL != (frame = iter->GetNext())) + { + this->AttachFrame(new ID3_Frame(*frame)); + } + delete iter; + return *this; +} + +size_t ID3_GetDataSize(const ID3_TagImpl& tag) +{ + return tag.GetFileSize() - tag.GetPrependedBytes() - tag.GetAppendedBytes(); +} + diff --git a/id3lib/src/tag_impl.h b/id3lib/src/tag_impl.h new file mode 100644 index 0000000..a8dc0e5 --- /dev/null +++ b/id3lib/src/tag_impl.h @@ -0,0 +1,179 @@ +// -*- C++ -*- +// $Id: tag_impl.h,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a software library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#ifndef _ID3LIB_TAG_IMPL_H_ +#define _ID3LIB_TAG_IMPL_H_ + +#include +#include +#include "tag.h" // has frame.h, field.h +#include "header_tag.h" +#include "mp3_header.h" //has io_decorators.h + +class ID3_Reader; +class ID3_Writer; + +namespace dami +{ + namespace id3 + { + namespace v1 + { + bool parse(ID3_TagImpl&, ID3_Reader&); + void render(ID3_Writer&, const ID3_TagImpl&); + }; + namespace v2 + { + bool parse(ID3_TagImpl& tag, ID3_Reader& rdr); + void render(ID3_Writer& writer, const ID3_TagImpl& tag); + }; + }; + namespace lyr3 + { + namespace v1 + { + bool parse(ID3_TagImpl&, ID3_Reader&); + }; + namespace v2 + { + bool parse(ID3_TagImpl&, ID3_Reader&); + }; + }; + namespace mm + { + bool parse(ID3_TagImpl&, ID3_Reader&); + }; +}; + +class ID3_TagImpl +{ + typedef std::list Frames; +public: + typedef Frames::iterator iterator; + typedef Frames::const_iterator const_iterator; +public: + ID3_TagImpl(const char *name = NULL); + ID3_TagImpl(const ID3_Tag &tag); + virtual ~ID3_TagImpl(); + + void Clear(); + bool HasChanged() const; + void SetChanged(bool b) { _changed = b; } + size_t Size() const; + + bool SetUnsync(bool); + bool SetExtended(bool); + bool SetExperimental(bool); + bool SetPadding(bool); + + bool GetUnsync() const; + bool GetExtended() const; + bool GetExperimental() const; + bool GetFooter() const; + + size_t GetExtendedBytes() const; + + void AddFrame(const ID3_Frame&); + void AddFrame(const ID3_Frame*); + bool AttachFrame(ID3_Frame*); + ID3_Frame* RemoveFrame(const ID3_Frame *); + + size_t Link(const char *fileInfo, flags_t = (flags_t) ID3TT_ALL); + size_t Link(ID3_Reader &reader, flags_t = (flags_t) ID3TT_ALL); + flags_t Update(flags_t = (flags_t) ID3TT_ALL); + flags_t Strip(flags_t = (flags_t) ID3TT_ALL); + + size_t GetPrependedBytes() const { return _prepended_bytes; } + size_t GetAppendedBytes() const { return _appended_bytes; } + size_t GetFileSize() const { return _file_size; } + dami::String GetFileName() const { return _file_name; } + + ID3_Frame* Find(ID3_FrameID id) const; + ID3_Frame* Find(ID3_FrameID id, ID3_FieldID fld, uint32 data) const; + ID3_Frame* Find(ID3_FrameID id, ID3_FieldID fld, dami::String) const; + ID3_Frame* Find(ID3_FrameID id, ID3_FieldID fld, dami::WString) const; + + size_t NumFrames() const { return _frames.size(); } + ID3_TagImpl& operator=( const ID3_Tag & ); + + bool HasTagType(ID3_TagType tt) const { return _file_tags.test(tt); } + ID3_V2Spec GetSpec() const; + bool SetSpec(ID3_V2Spec); + + static size_t IsV2Tag(ID3_Reader&); + + const Mp3_Headerinfo* GetMp3HeaderInfo() const { if (_mp3_info) return _mp3_info->GetMp3HeaderInfo(); else return NULL; } + + iterator begin() { return _frames.begin(); } + iterator end() { return _frames.end(); } + const_iterator begin() const { return _frames.begin(); } + const_iterator end() const { return _frames.end(); } + + /* Deprecated! */ + void AddNewFrame(ID3_Frame* f) { this->AttachFrame(f); } + size_t Link(const char *fileInfo, bool parseID3v1, bool parseLyrics3); + void SetCompression(bool) { ; } + void AddFrames(const ID3_Frame *, size_t); + bool HasLyrics() const { return this->HasTagType(ID3TT_LYRICS); } + bool HasV2Tag() const { return this->HasTagType(ID3TT_ID3V2); } + bool HasV1Tag() const { return this->HasTagType(ID3TT_ID3V1); } + size_t PaddingSize(size_t) const; + +protected: + const_iterator Find(const ID3_Frame *) const; + iterator Find(const ID3_Frame *); + + void RenderExtHeader(uchar *); + + void ParseFile(); + void ParseReader(ID3_Reader &reader); + +private: + ID3_TagHeader _hdr; // information relevant to the tag header + bool _is_padded; // add padding to tags? + + Frames _frames; + + mutable const_iterator _cursor; // which frame in list are we at + mutable bool _changed; // has tag changed since last parse or render? + + // file-related member variables + dami::String _file_name; // name of the file we are linked to + size_t _file_size; // the size of the file (without any tag(s)) + size_t _prepended_bytes; // number of tag bytes at start of file + size_t _appended_bytes; // number of tag bytes at end of file + bool _is_file_writable;// is the associated file (via Link) writable? + ID3_Flags _tags_to_parse; // which tag types should attempt to be parsed + ID3_Flags _file_tags; // which tag types does the file contain + Mp3Info *_mp3_info; // class used to retrieve _mp3_header +}; + +size_t ID3_GetDataSize(const ID3_TagImpl&); + +#endif /* _ID3LIB_TAG_IMPL_H_ */ + diff --git a/id3lib/src/tag_parse.cpp b/id3lib/src/tag_parse.cpp new file mode 100644 index 0000000..a6dbe93 --- /dev/null +++ b/id3lib/src/tag_parse.cpp @@ -0,0 +1,422 @@ +// $Id: tag_parse.cpp,v 1.5 2008/01/15 11:20:41 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +//#if defined HAVE_CONFIG_H +//#include // Must include before zlib.h to compile on WinCE +//#endif + +//#include +//#include +//#include + +#include "tag_impl.h" //has "tag.h" "header_tag.h" "frame.h" "field.h" "spec.h" "id3lib_strings.h" "utils.h" +//#include "id3/io_decorators.h" //has "readers.h" "io_helpers.h" "utils.h" +#include "io_strings.h" + +using namespace dami; + +namespace +{ + bool parseFrames(ID3_TagImpl& tag, ID3_Reader& rdr) + { + ID3_Reader::pos_type beg = rdr.getCur(); + io::ExitTrigger et(rdr, beg); + ID3_Reader::pos_type last_pos = beg; + size_t totalSize = 0; + size_t frameSize = 0; + while (!rdr.atEnd() && rdr.peekChar() != '\0') + { + ID3D_NOTICE( "id3::v2::parseFrames(): rdr.getBeg() = " << rdr.getBeg() ); + ID3D_NOTICE( "id3::v2::parseFrames(): rdr.getCur() = " << rdr.getCur() ); + ID3D_NOTICE( "id3::v2::parseFrames(): rdr.getEnd() = " << rdr.getEnd() ); + last_pos = rdr.getCur(); + ID3_Frame* f = new ID3_Frame; + f->SetSpec(tag.GetSpec()); + bool goodParse = f->Parse(rdr); + frameSize = rdr.getCur() - last_pos; + ID3D_NOTICE( "id3::v2::parseFrames(): frameSize = " << frameSize ); + totalSize += frameSize; + + if (frameSize == 0) + { + // There is a problem. + // If the frame size is 0, then we can't progress. + ID3D_WARNING( "id3::v2::parseFrames(): frame size is 0, can't " << + "continue parsing frames"); + delete f; + // Break for now. + break; + } + else if (!goodParse) + { + // bad parse! we can't attach this frame. + ID3D_WARNING( "id3::v2::parseFrames(): bad parse, deleting frame"); + delete f; + } + else if (f->GetID() != ID3FID_METACOMPRESSION) + { + ID3D_NOTICE( "id3::v2::parseFrames(): attaching non-compressed " << + "frame"); + // a good, uncompressed frame. attach away! + tag.AttachFrame(f); + } + else + { + ID3D_NOTICE( "id3::v2::parseFrames(): parsing ID3v2.2.1 " << + "compressed frame"); + // hmm. an ID3v2.2.1 compressed frame. It contains 1 or more + // compressed frames. Uncompress and call parseFrames recursively. + ID3_Field* fld = f->GetField(ID3FN_DATA); + if (fld) + { + ID3_MemoryReader mr(fld->GetRawBinary(), fld->BinSize()); + ID3_Reader::char_type ch = static_cast(mr.readChar()); + if (ch != 'z') + { + // unknown compression method + ID3D_WARNING( "id3::v2::parseFrames(): unknown compression id " << + " = '" << ch << "'" ); + } + else + { + uint32 newSize = io::readBENumber(mr, sizeof(uint32)); + // allocate 2MB instead 4GB max in the decompressor later on (TODO decompressor should actually do the sanitycheck) + if (newSize > 2 * 1024 * 1024){ + ID3D_WARNING( "id3::v2::parseFrames(): 'newSize' exeeds sanity limit" ); + delete f; + return false; + } + size_t oldSize = f->GetDataSize() - sizeof(uint32) - 1; + io::CompressedReader cr(mr, newSize); + parseFrames(tag, cr); + if (!cr.atEnd()) + { + // hmm. it didn't parse the entire uncompressed data. wonder + // why. + ID3D_WARNING( "id3::v2::parseFrames(): didn't parse entire " << + "id3v2.2.1 compressed memory stream"); + } + } + } + delete f; + } + et.setExitPos(rdr.getCur()); + } + if (rdr.peekChar() == '\0') + { + ID3D_NOTICE( "id3::v2::parseFrames: done parsing, padding at postion " << + rdr.getCur() ); + } + else + { + ID3D_NOTICE( "id3::v2::parseFrames: done parsing, [cur, end] = [" << + rdr.getCur() << ", " << rdr.getEnd() << "]" ); + } + return true; + } +}; + +bool id3::v2::parse(ID3_TagImpl& tag, ID3_Reader& reader) +{ + ID3_Reader::pos_type beg = reader.getCur(); + io::ExitTrigger et(reader); + + ID3_TagHeader hdr; + + io::WindowedReader wr(reader, ID3_TagHeader::SIZE); + + if (!hdr.Parse(wr) || wr.getCur() == beg) + { + ID3D_NOTICE( "id3::v2::parse(): parsing header failes" ); + return false; + } + if (hdr.GetExtended()) + { + hdr.ParseExtended(reader); + } + tag.SetSpec(hdr.GetSpec()); + + size_t dataSize = hdr.GetDataSize(); + ID3D_NOTICE( "ID3_TagImpl::Parse(ID3_Reader&): dataSize = " << dataSize); + + wr.setWindow(wr.getCur(), dataSize); + et.setExitPos(wr.getEnd()); + + ID3D_NOTICE( "ID3_TagImpl::Parse(ID3_Reader&): data window beg = " << wr.getBeg() ); + ID3D_NOTICE( "ID3_TagImpl::Parse(ID3_Reader&): data window cur = " << wr.getCur() ); + ID3D_NOTICE( "ID3_TagImpl::Parse(ID3_Reader&): data window end = " << wr.getEnd() ); + tag.SetExtended(hdr.GetExtended()); + if (!hdr.GetUnsync()) + { + tag.SetUnsync(false); + parseFrames(tag, wr); + } + else + { + // The buffer has been unsynced. It will have to be resynced to be + // readable. This has to be done a character at a time. + // + // The original reader may be reading in characters from a file. Doing + // this a character at a time is quite slow. To improve performance, read + // in the entire buffer into a string, then create an UnsyncedReader from + // the string. + // + // It might be better to implement a BufferedReader so that the details + // of this can be abstracted away behind a class + tag.SetUnsync(true); + BString raw = io::readAllBinary(wr); + io::BStringReader bsr(raw); + io::UnsyncedReader ur(bsr); + ID3D_NOTICE( "ID3_TagImpl::Parse(ID3_Reader&): unsync beg = " << ur.getBeg() ); + ID3D_NOTICE( "ID3_TagImpl::Parse(ID3_Reader&): unsync cur = " << ur.getCur() ); + ID3D_NOTICE( "ID3_TagImpl::Parse(ID3_Reader&): unsync end = " << ur.getEnd() ); + + // Now read the UnsyncedReader into another string, and parse the frames + // from the string. This is done so that 1. the unsynced reader is + // unsynced exactly once, removing the possibility of multiple unsyncings + // of the same string, and 2) so that calls to readChars aren't done a + // character at a time for every call + BString synced = io::readAllBinary(ur); + io::BStringReader sr(synced); + parseFrames(tag, sr); + } + + return true; +} + +void ID3_TagImpl::ParseFile() +{ + ifstream file; + if (ID3E_NoError != openReadableFile(this->GetFileName(), file)) + { + // log this... + return; + } + ID3_IFStreamReader ifsr(file); + ParseReader(ifsr); + file.close(); +} + +//used for streaming media +void ID3_TagImpl::ParseReader(ID3_Reader &reader) +{ + size_t mp3_core_size; + size_t bytes_till_sync; + + io::WindowedReader wr(reader); + wr.setBeg(wr.getCur()); + + _file_tags.clear(); + _file_size = reader.getEnd(); + + ID3_Reader::pos_type beg = wr.getBeg(); + ID3_Reader::pos_type cur = wr.getCur(); + ID3_Reader::pos_type end = wr.getEnd(); + + ID3_Reader::pos_type last = cur; + + if (_tags_to_parse.test(ID3TT_ID3V2)) + { + do + { + last = cur; + // Parse tags at the beginning of the file first... + if (id3::v2::parse(*this, wr)) + { + _file_tags.add(ID3TT_ID3V2); + } + cur = wr.getCur(); + wr.setBeg(cur); + } while (!wr.atEnd() && cur > last); + } + // add silly padding outside the tag to _prepended_bytes + if (!wr.atEnd() && wr.peekChar() == '\0') + { + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): found padding outside tag" ); + do + { + last = cur; + cur = wr.getCur() + 1; + wr.setBeg(cur); + wr.setCur(cur); + } while (!wr.atEnd() && cur > last && wr.peekChar() == '\0'); + } + if (!wr.atEnd() && _file_size - (cur - beg) > 4 && wr.peekChar() == 255) + { //unfortunatly, this is necessary for finding an invalid padding + wr.setCur(cur + 1); //cur is known by peekChar + if (wr.readChar() == '\0' && wr.readChar() == '\0' && wr.peekChar() == '\0') + { //three empty bytes found, enough for me, this is stupid padding + cur += 3; //those are now allready read in (excluding the peekChar, since it will be added by do{}) + do + { + last = cur; + cur = wr.getCur() + 1; + wr.setBeg(cur); + wr.setCur(cur); + } while (!wr.atEnd() && cur > last && wr.peekChar() == '\0'); + } + else + wr.setCur(cur); + } + _prepended_bytes = cur - beg; + // go looking for the first sync byte to add to bytes_till_sync + // by not adding it to _prepended_bytes, we preserve this 'unknown' data + // The routine's only effect is helping the lib to find things as bitrate etc. + beg = wr.getBeg(); + if (!wr.atEnd() && wr.peekChar() != 0xFF) //no sync byte, so, either this is not followed by a mp3 file or it's a fLaC file, or an encapsulating format, better check it + { + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): Didn't find mp3 sync byte" ); + if ((_file_size - (cur - beg)) >= 4) + { //there is room to search for some kind of ID + unsigned char buf[5]; + wr.readChars(buf, 4); + buf[4] = '\0'; + // check for RIFF (an encapsulating format) ID + if (strncmp((char*)buf, "RIFF", 4) == 0 || strncmp((char*)buf, "RIFX", 4) == 0) + { + // next 4 bytes are RIFF size, skip them + cur = wr.getCur() + 4; + wr.setCur(cur); + // loop until first possible sync byte + if (!wr.atEnd() && wr.peekChar() != 0xFF) + { + do + { + last = cur; + cur = wr.getCur() + 1; + wr.setCur(cur); + } while (!wr.atEnd() && cur > last && wr.peekChar() != 0xFF); + } + } + else if (strncmp((char*)buf, "fLaC", 4) == 0) + { //a FLAC file, no need looking for a sync byte + beg = cur; + } + else + { //since we set the cursor 4 bytes ahead for looking for RIFF, RIFX or fLaC, better set it back + // but peekChar allready checked the first one, so we add one + cur = cur + 1; + wr.setCur(cur); + //go looking for a sync byte + if (!wr.atEnd() && wr.peekChar() != 0xFF) //no sync byte, we have an unknown byte + { + do + { + last = cur; + cur = wr.getCur() + 1; + wr.setCur(cur); + } while (!wr.atEnd() && cur > last && wr.peekChar() != 0xFF); + } + } + } //if ((_file_size - (cur - beg)) >= 4) + else + { //remaining size is smaller than 4 bytes, can't be useful, but leave it for now + beg = cur; + //file.close(); + //return; + } + } + bytes_till_sync = cur - beg; + + cur = wr.setCur(end); + if (_file_size > _prepended_bytes) + { + do + { + last = cur; + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): beg = " << wr.getBeg() ); + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): cur = " << wr.getCur() ); + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): end = " << wr.getEnd() ); + // ...then the tags at the end + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): musicmatch? cur = " << wr.getCur() ); + if (_tags_to_parse.test(ID3TT_MUSICMATCH) && mm::parse(*this, wr)) + { + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): musicmatch! cur = " << wr.getCur() ); + _file_tags.add(ID3TT_MUSICMATCH); + wr.setEnd(wr.getCur()); + } + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): lyr3v1? cur = " << wr.getCur() ); + if (_tags_to_parse.test(ID3TT_LYRICS3) && lyr3::v1::parse(*this, wr)) + { + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): lyr3v1! cur = " << wr.getCur() ); + _file_tags.add(ID3TT_LYRICS3); + wr.setEnd(wr.getCur()); + } + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): lyr3v2? cur = " << wr.getCur() ); + if (_tags_to_parse.test(ID3TT_LYRICS3V2) && lyr3::v2::parse(*this, wr)) + { + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): lyr3v2! cur = " << wr.getCur() ); + _file_tags.add(ID3TT_LYRICS3V2); + cur = wr.getCur(); + wr.setCur(wr.getEnd());//set to end to seek id3v1 tag + //check for id3v1 tag and set End accordingly + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): id3v1? cur = " << wr.getCur() ); + if (_tags_to_parse.test(ID3TT_ID3V1) && id3::v1::parse(*this, wr)) + { + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): id3v1! cur = " << wr.getCur() ); + _file_tags.add(ID3TT_ID3V1); + } + wr.setCur(cur); + wr.setEnd(cur); + } + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): id3v1? cur = " << wr.getCur() ); + if (_tags_to_parse.test(ID3TT_ID3V1) && id3::v1::parse(*this, wr)) + { + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): id3v1! cur = " << wr.getCur() ); + wr.setEnd(wr.getCur()); + _file_tags.add(ID3TT_ID3V1); + } + cur = wr.getCur(); + } while (cur != last); + _appended_bytes = end - cur; + + // Now get the mp3 header + mp3_core_size = (_file_size - _appended_bytes) - (_prepended_bytes + bytes_till_sync); + if (mp3_core_size >= 4) + { //it has at least the size for a mp3 header (a mp3 header is 4 bytes) + wr.setBeg(_prepended_bytes + bytes_till_sync); + wr.setCur(_prepended_bytes + bytes_till_sync); + wr.setEnd(_file_size - _appended_bytes); + + _mp3_info = new Mp3Info; + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): mp3header? cur = " << wr.getCur() ); + + if (_mp3_info->Parse(wr, mp3_core_size)) + { + ID3D_NOTICE( "ID3_TagImpl::ParseReader(): mp3header! cur = " << wr.getCur() ); + } + else + { + delete _mp3_info; + _mp3_info = NULL; + } + } + } + else + this->SetPadding(false); //no need to pad an empty file +} + diff --git a/id3lib/src/tag_parse_lyrics3.cpp b/id3lib/src/tag_parse_lyrics3.cpp new file mode 100644 index 0000000..fb964f0 --- /dev/null +++ b/id3lib/src/tag_parse_lyrics3.cpp @@ -0,0 +1,370 @@ +// $Id: tag_parse_lyrics3.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include +#include +#include "tag_impl.h" //has "tag.h" "header_tag.h" "frame.h" "field.h" "spec.h" "id3lib_strings.h" "utils.h" +#include "helpers.h" +#include "id3/io_decorators.h" //has "readers.h" "io_helpers.h" "utils.h" +#include "io_strings.h" + +using namespace dami; + +namespace +{ + uint32 readIntegerString(ID3_Reader& reader, size_t numBytes) + { + uint32 val = 0; + for (size_t i = 0; i < numBytes && isdigit(reader.peekChar()); ++i) + { + val = (val * 10) + (reader.readChar() - '0'); + } + ID3D_NOTICE( "readIntegerString: val = " << val ); + return val; + } + + uint32 readIntegerString(ID3_Reader& reader) + { + return readIntegerString(reader, reader.remainingBytes()); + } + + bool isTimeStamp(ID3_Reader& reader) + { + ID3_Reader::pos_type cur = reader.getCur(); + if (reader.getEnd() < cur + 7) + { + return false; + } + bool its = ('[' == reader.readChar() && + isdigit(reader.readChar()) && isdigit(reader.readChar()) && + ':' == reader.readChar() && + isdigit(reader.readChar()) && isdigit(reader.readChar()) && + ']' == reader.readChar()); + reader.setCur(cur); + if (its) + { + ID3D_NOTICE( "isTimeStamp(): found timestamp, cur = " << reader.getCur() ); + } + return its; + } + + uint32 readTimeStamp(ID3_Reader& reader) + { + reader.skipChars(1); + uint32 sec = readIntegerString(reader, 2) * 60; + reader.skipChars(1); + sec += readIntegerString(reader, 2); + reader.skipChars(1); + ID3D_NOTICE( "readTimeStamp(): timestamp = " << sec ); + return sec * 1000; + } + + bool findText(ID3_Reader& reader, String text) + { + if (text.empty()) + { + return true; + } + + size_t index = 0; + while (!reader.atEnd()) + { + ID3_Reader::char_type ch = static_cast(reader.readChar()); + if (ch == text[index]) + { + index++; + } + else if (ch == text[0]) + { + index = 1; + } + else + { + index = 0; + } + if (index == text.size()) + { + reader.setCur(reader.getCur() - index); + ID3D_NOTICE( "findText: found \"" << text << "\" at " << + reader.getCur() ); + break; + } + } + return !reader.atEnd(); + }; + + void lyrics3ToSylt(ID3_Reader& reader, ID3_Writer& writer) + { + while (!reader.atEnd()) + { + bool lf = false; + uint32 ms = 0; + size_t count = 0; + while (isTimeStamp(reader)) + { + // For now, just skip over multiple time stamps + if (count++ > 0) + { + readTimeStamp(reader); + } + else + { + ms = readTimeStamp(reader); + } + } + while (!reader.atEnd() && !isTimeStamp(reader)) + { + ID3_Reader::char_type ch = static_cast(reader.readChar()); + if (0x0A == ch && (reader.atEnd() || isTimeStamp(reader))) + { + lf = true; + break; + } + else + { + writer.writeChar(ch); + } + } + + // put synch identifier + writer.writeChar('\0'); + + // put timestamp + ID3D_NOTICE( "lyrics3toSylt: ms = " << ms ); + + io::writeBENumber(writer, ms, sizeof(uint32)); + if (lf) + { + ID3D_NOTICE( "lyrics3toSylt: adding lf" ); + + // put the LF + writer.writeChar(0x0A); + } + } + } +}; + +bool lyr3::v1::parse(ID3_TagImpl& tag, ID3_Reader& reader) +{ + io::ExitTrigger et(reader); + ID3_Reader::pos_type end = reader.getCur(); + if (end < reader.getBeg() + 9 + 128) + { + ID3D_NOTICE( "id3::v1::parse: bailing, not enough bytes to parse, pos = " << end ); + return false; + } + reader.setCur(end - (9 + 128)); + + { + if (io::readText(reader, 9) != "LYRICSEND" || + io::readText(reader, 3) != "TAG") + { + return false; + } + } + + // we have a Lyrics3 v1.00 tag + if (end < reader.getBeg() + 11 + 9 + 128) + { + // the file size isn't large enough to actually hold lyrics + ID3D_WARNING( "id3::v1::parse: not enough data to parse lyrics3" ); + return false; + } + + // reserve enough space for lyrics3 + id3v1 tag + size_t window = end - reader.getBeg(); + size_t lyrDataSize = min(window, 11 + 5100 + 9 + 128); + reader.setCur(end - lyrDataSize); + io::WindowedReader wr(reader, lyrDataSize - (9 + 128)); + + if (!findText(wr, "LYRICSBEGIN")) + { + ID3D_WARNING( "id3::v1::parse: couldn't find LYRICSBEGIN, bailing" ); + return false; + } + + et.setExitPos(wr.getCur()); + wr.skipChars(11); + wr.setBeg(wr.getCur()); + + io::LineFeedReader lfr(wr); + String lyrics = io::readText(lfr, wr.remainingBytes()); + id3::v2::setLyrics(tag, lyrics, "Converted from Lyrics3 v1.00", "XXX"); + + return true; +} + +//bool parse(TagImpl& tag, ID3_Reader& reader) +bool lyr3::v2::parse(ID3_TagImpl& tag, ID3_Reader& reader) +{ + io::ExitTrigger et(reader); + ID3_Reader::pos_type end = reader.getCur(); + if (end < reader.getBeg() + 6 + 9 + 128) + { + ID3D_NOTICE( "lyr3::v2::parse: bailing, not enough bytes to parse, pos = " << reader.getCur() ); + return false; + } + + reader.setCur(end - (6 + 9 + 128)); + uint32 lyrSize = 0; + + ID3_Reader::pos_type beg = reader.getCur(); + lyrSize = readIntegerString(reader, 6); + if (reader.getCur() < beg + 6) + { + ID3D_NOTICE( "lyr3::v2::parse: couldn't find numeric string, lyrSize = " << + lyrSize ); + return false; + } + + if (io::readText(reader, 9) != "LYRICS200" || + io::readText(reader, 3) != "TAG") + { + return false; + } + + if (end < reader.getBeg() + lyrSize + 6 + 9 + 128) + { + ID3D_WARNING( "lyr3::v2::parse: not enough data to parse tag, lyrSize = " << lyrSize ); + return false; + } + reader.setCur(end - (lyrSize + 6 + 9 + 128)); + + io::WindowedReader wr(reader); + wr.setWindow(wr.getCur(), lyrSize); + + beg = wr.getCur(); + + if (io::readText(wr, 11) != "LYRICSBEGIN") + { + // not a lyrics v2.00 tag + ID3D_WARNING( "lyr3::v2::parse: couldn't find LYRICSBEGIN, bailing" ); + return false; + } + + bool has_time_stamps = false; + + ID3_Frame* lyr_frame = NULL; + + while (!wr.atEnd()) + { + uint32 fldSize; + + String fldName = io::readText(wr, 3); + ID3D_NOTICE( "lyr3::v2::parse: fldName = " << fldName ); + fldSize = readIntegerString(wr, 5); + ID3D_NOTICE( "lyr3::v2::parse: fldSize = " << fldSize ); + + String fldData; + + io::WindowedReader wr2(wr, fldSize); + io::LineFeedReader lfr(wr2); + + fldData = io::readText(lfr, fldSize); + ID3D_NOTICE( "lyr3::v2::parse: fldData = \"" << fldData << "\"" ); + + // the IND field + if (fldName == "IND") + { + has_time_stamps = (fldData.size() > 1 && fldData[1] == '1'); + } + + // the TITLE field + else if (fldName == "ETT" && !id3::v2::hasTitle(tag)) + { + //tag.setTitle(fldData); + id3::v2::setTitle(tag, fldData); + } + + // the ARTIST field + else if (fldName == "EAR" && !id3::v2::hasArtist(tag)) + { + //tag.setArtist(fldData); + id3::v2::setArtist(tag, fldData); + } + + // the ALBUM field + else if (fldName == "EAL" && !id3::v2::hasAlbum(tag)) + { + //tag.setAlbum(fldData); + id3::v2::setAlbum(tag, fldData); + } + + // the Lyrics/Music AUTHOR field + else if (fldName == "AUT") + { + //tag.setAuthor(fldData); + id3::v2::setLyricist(tag, fldData); + } + + // the INFORMATION field + else if (fldName == "INF") + { + //tag.setInfo(fldData); + id3::v2::setComment(tag, fldData, "Lyrics3 v2.00 INF", "XXX"); + } + + // the LYRICS field + else if (fldName == "LYR") + { + // if already found an INF field, use it as description + String desc = "Converted from Lyrics3 v2.00"; + //tag.setLyrics(fldData); + if (!has_time_stamps) + { + lyr_frame = id3::v2::setLyrics(tag, fldData, desc, "XXX"); + } + else + { + // converts from lyrics3 to SYLT in-place + io::StringReader sr(fldData); + ID3D_NOTICE( "lyr3::v2::parse: determining synced lyrics" ); + BString sylt; + io::BStringWriter sw(sylt); + lyrics3ToSylt(sr, sw); + + lyr_frame = id3::v2::setSyncLyrics(tag, sylt, ID3TSF_MS, desc, + "XXX", ID3CT_LYRICS); + ID3D_NOTICE( "lyr3::v2::parse: determined synced lyrics" ); + } + } + else if (fldName == "IMG") + { + // currently unsupported + ID3D_WARNING( "lyr3::v2::parse: IMG field unsupported" ); + } + else + { + ID3D_WARNING( "lyr3::v2::parse: undefined field id: " << + fldName ); + } + } + + et.setExitPos(beg); + return true; +} + diff --git a/id3lib/src/tag_parse_musicmatch.cpp b/id3lib/src/tag_parse_musicmatch.cpp new file mode 100644 index 0000000..d3cfbff --- /dev/null +++ b/id3lib/src/tag_parse_musicmatch.cpp @@ -0,0 +1,353 @@ +// $Id: tag_parse_musicmatch.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_CONFIG_H +#include +#endif + + +#include +#include "tag_impl.h" //has "tag.h" "header_tag.h" "frame.h" "field.h" "spec.h" "id3lib_strings.h" "utils.h" +#include "helpers.h" +#include "id3/io_decorators.h" //has "readers.h" "io_helpers.h" "utils.h" + +using namespace dami; + +namespace +{ + uint32 readSeconds(ID3_Reader& reader, size_t len) + { + io::ExitTrigger et(reader); + io::WindowedReader wr(reader, len); + ID3_Reader::pos_type beg = wr.getCur(); + uint32 seconds = 0; + uint32 cur = 0; + while (!wr.atEnd()) + { + ID3_Reader::char_type ch = static_cast(wr.readChar()); + if (':' == ch) + { + seconds += 60 * cur; + cur = 0; + } + else if (!isdigit(ch)) + { + return 0; + } + else + { + cur = cur * 10 + (ch - '0'); + } + } + et.release(); + return seconds + cur; + } + + ID3_Frame* readTextFrame(ID3_Reader& reader, ID3_FrameID id, const String desc = "") + { + uint32 size = io::readLENumber(reader, 2); + ID3D_NOTICE( "readTextFrame: size = " << size ); + if (size == 0) + { + return NULL; + } + + String text; + if (ID3FID_SONGLEN != id) + { + io::LineFeedReader lfr(reader); + text = io::readText(lfr, size); + ID3D_NOTICE( "readTextFrame: text = " << text ); + } + else + { + text = toString(readSeconds(reader, size) * 1000); + ID3D_NOTICE( "readTextFrame: songlen = " << text ); + } + + ID3_Frame* frame = new ID3_Frame(id); + if (frame) + { + if (frame->Contains(ID3FN_TEXT)) + { + frame->GetField(ID3FN_TEXT)->Set(text.c_str()); + } + else if (frame->Contains(ID3FN_URL)) + { + frame->GetField(ID3FN_URL)->Set(text.c_str()); + } + if (frame->Contains(ID3FN_LANGUAGE)) + { + frame->GetField(ID3FN_LANGUAGE)->Set("XXX"); + } + if (frame->Contains(ID3FN_DESCRIPTION)) + { + frame->GetField(ID3FN_DESCRIPTION)->Set(desc.c_str()); + } + } + return frame; + } +}; + +bool mm::parse(ID3_TagImpl& tag, ID3_Reader& rdr) +{ + io::ExitTrigger et(rdr); + ID3_Reader::pos_type end = rdr.getCur(); + if (end < rdr.getBeg() + 48) + { + ID3D_NOTICE( "mm::parse: bailing, not enough bytes to parse, pos = " << end ); + return false; + } + + rdr.setCur(end - 48); + String version; + + { + if (io::readText(rdr, 32) != "Brava Software Inc. ") + { + ID3D_NOTICE( "mm::parse: bailing, couldn't find footer" ); + return false; + } + + version = io::readText(rdr, 4); + if (version.size() != 4 || + !isdigit(version[0]) || version[1] != '.' || + !isdigit(version[2]) || + !isdigit(version[3])) + { + ID3D_WARNING( "mm::parse: bailing, nonstandard version = " << version ); + return false; + } + } + + ID3_Reader::pos_type beg = rdr.setCur(end - 48); + et.setExitPos(beg); + if (end < 68) + { + ID3D_NOTICE( "mm::parse: bailing, not enough bytes to parse offsets, pos = " << end ); + return false; + } + rdr.setCur(end - 68); + + io::WindowedReader dataWindow(rdr); + dataWindow.setEnd(rdr.getCur()); + + size_t offsets[5]; + + io::WindowedReader offsetWindow(rdr, 20); + for (size_t i = 0; i < 5; ++i) + { + offsets[i] = io::readLENumber(rdr, sizeof(uint32)); + } + + size_t metadataSize = 0; + if (version <= "3.00") + { + // All MusicMatch tags up to and including version 3.0 had metadata + // sections exactly 7868 bytes in length. + metadataSize = 7868; + } + else + { + // MusicMatch tags after version 3.0 had three possible lengths for their + // metadata sections. We can determine which it was by searching for + // the version section signature that should precede the metadata section + // by exactly 256 bytes. + size_t possibleSizes[] = { 8132, 8004, 7936 }; + + for (size_t i = 0; i < sizeof(possibleSizes)/sizeof(size_t); ++i) + { + dataWindow.setCur(dataWindow.getEnd()); + + // Our offset will be exactly 256 bytes prior to our potential metadata + // section + size_t offset = possibleSizes[i] + 256; + if (dataWindow.getCur() < offset) + { + // if our filesize is less than the offset, then it can't possibly + // be the correct offset, so try again. + continue; + } + dataWindow.setCur(dataWindow.getCur() - offset); + + // now read in the signature to see if it's a match + if (io::readText(dataWindow, 8) == "18273645") + { + metadataSize = possibleSizes[i]; + break; + } + } + } + if (0 == metadataSize) + { + // if we didn't establish a size for the metadata, then something is + // wrong. probably should log this. + ID3D_WARNING( "mm::parse: bailing, couldn't find meta data signature, end = " << end ); + return false; + } + + // parse the offset pointers to determine the actual sizes of all the + // sections + size_t sectionSizes[5]; + size_t tagSize = metadataSize; + + // we already know the size of the last section + sectionSizes[4] = metadataSize; + + size_t lastOffset = 0; + for (int i = 0; i < 5; i++) + { + size_t thisOffset = offsets[i]; + //ASSERT(thisOffset > lastOffset); + if (i > 0) + { + size_t sectionSize = thisOffset - lastOffset; + sectionSizes[i-1] = sectionSize; + tagSize += sectionSize; + } + lastOffset = thisOffset; + } + + // now check to see that our tag size is reasonable + if (dataWindow.getEnd() < tagSize) + { + // Ack! The tag size doesn't jive with the tag's ending position in + // the file. Bail! + ID3D_WARNING( "mm::parse: bailing, tag size is too big, tag size = " << tagSize << ", end = " << end ); + return false; + } + + dataWindow.setBeg(dataWindow.getEnd() - tagSize); + dataWindow.setCur(dataWindow.getBeg()); + + // Now calculate the adjusted offsets + offsets[0] = dataWindow.getBeg(); + for (size_t i = 0; i < 4; ++i) + { + offsets[i+1] = offsets[i] + sectionSizes[i]; + } + + // now check for a tag header and adjust the tag_beg pointer appropriately + if (dataWindow.getBeg() >= 256) + { + rdr.setCur(dataWindow.getBeg() - 256); + if (io::readText(rdr, 8) == "18273645") + { + et.setExitPos(rdr.getCur() - 8); + } + else + { + et.setExitPos(dataWindow.getBeg()); + } + dataWindow.setCur(dataWindow.getBeg()); + } + + // Now parse the various sections... + + // Parse the image extension at offset 0 + dataWindow.setCur(offsets[0]); + String imgExt = io::readTrailingSpaces(dataWindow, 4); + + // Parse the image binary at offset 1 + dataWindow.setCur(offsets[1]); + uint32 imgSize = io::readLENumber(dataWindow, 4); + if (imgSize == 0) + { + // no image binary. don't do anything. + } + else + { + io::WindowedReader imgWindow(dataWindow, imgSize); + if (imgWindow.getEnd() < imgWindow.getBeg() + imgSize) + { + // Ack! The image size given extends beyond the next offset! This is + // not good... log? + } + else + { + BString imgData = io::readAllBinary(imgWindow); + ID3_Frame* frame = new ID3_Frame(ID3FID_PICTURE); + if (frame) + { + String mimetype("image/"); + mimetype += imgExt; + frame->GetField(ID3FN_MIMETYPE)->Set(mimetype.c_str()); + frame->GetField(ID3FN_IMAGEFORMAT)->Set(""); + frame->GetField(ID3FN_PICTURETYPE)->Set(static_cast(0)); + frame->GetField(ID3FN_DESCRIPTION)->Set(""); + frame->GetField(ID3FN_DATA)->Set(reinterpret_cast(imgData.data()), imgData.size()); + tag.AttachFrame(frame); + } + } + } + + //file.seekg(offsets[2]); + //file.seekg(offsets[3]); + dataWindow.setCur(offsets[4]); + + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_TITLE)); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_ALBUM)); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_LEADARTIST)); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_CONTENTTYPE)); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_COMMENT, "MusicMatch_Tempo")); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_COMMENT, "MusicMatch_Mood")); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_COMMENT, "MusicMatch_Situation")); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_COMMENT, "MusicMatch_Preference")); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_SONGLEN)); + + // The next 12 bytes can be ignored. The first 8 represent the + // creation date as a 64 bit floating point number. The last 4 are + // for a play counter. + dataWindow.skipChars(12); + + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_COMMENT, "MusicMatch_Path")); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_COMMENT, "MusicMatch_Serial")); + + // 2 bytes for track + uint32 trkNum = io::readLENumber(dataWindow, 2); + if (trkNum > 0) + { + String trkStr = toString(trkNum); + ID3_Frame* frame = new ID3_Frame(ID3FID_TRACKNUM); + if (frame) + { + frame->GetField(ID3FN_TEXT)->Set(trkStr.c_str()); + tag.AttachFrame(frame); + } + } + + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_COMMENT, "MusicMatch_Notes")); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_COMMENT, "MusicMatch_Bio")); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_UNSYNCEDLYRICS)); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_WWWARTIST)); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_WWWCOMMERCIALINFO)); + tag.AttachFrame(readTextFrame(dataWindow, ID3FID_COMMENT, "MusicMatch_ArtistEmail")); + + // email? + + return true; +} + diff --git a/id3lib/src/tag_parse_v1.cpp b/id3lib/src/tag_parse_v1.cpp new file mode 100644 index 0000000..966e39f --- /dev/null +++ b/id3lib/src/tag_parse_v1.cpp @@ -0,0 +1,167 @@ +// $Id: tag_parse_v1.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include "tag_impl.h" //has "tag.h" "header_tag.h" "frame.h" "field.h" "spec.h" "id3lib_strings.h" "utils.h" +#include "helpers.h" +#include "id3/io_decorators.h" //has "readers.h" "io_helpers.h" "utils.h" +#include "io_strings.h" + +using namespace dami; + +bool id3::v1::parse(ID3_TagImpl& tag, ID3_Reader& reader) +{ + io::ExitTrigger et(reader); + + ID3_Reader::pos_type end = reader.getCur(); + // posn ourselves at 128 bytes from the current position + if (end < reader.getBeg() + ID3_V1_LEN) + { + ID3D_NOTICE( "id3::v1::parse: not enough bytes to parse, pos = " << end ); + return false; + } + reader.setCur(end - ID3_V1_LEN); + ID3_Reader::pos_type beg = reader.getCur(); + //file.seekg(-static_cast(ID3_V1_LEN), ios::cur); + if (end != beg + ID3_V1_LEN) + { + ID3D_WARNING( "id3::v1::parse: failed to reposition " << ID3_V1_LEN << + " bytes" ); + return false; + } + + // read the next 128 bytes in; + String field = io::readText(reader, ID3_V1_LEN_ID); + + // check to see if it was a tag + if (field != "TAG") + { + return false; + } + et.setExitPos(beg); + + // guess so, let's start checking the v2 tag for frames which are the + // equivalent of the v1 fields. When we come across a v1 field that has + // no current equivalent v2 frame, we create the frame, copy the data + // from the v1 frame and attach it to the tag + + // (Scott Wheeler) The above comment was nice in theory, but it wasn't + // first checking (before my hacks) to see if there already was v2 data. + + ID3D_NOTICE("id3::v1::parse: read bytes: " << reader.getCur() - beg); + String title = io::readTrailingSpaces(reader, ID3_V1_LEN_TITLE); + field = id3::v2::getTitle(tag); + if (title.size() > 0 && (field.size() == 0 || field == "")) + { + id3::v2::setTitle(tag, title); + } + ID3D_NOTICE( "id3::v1::parse: title = \"" << title << "\"" ); + + ID3D_NOTICE("id3::v1::parse: read bytes: " << reader.getCur() - beg); + String artist = io::readTrailingSpaces(reader, ID3_V1_LEN_ARTIST); + field = id3::v2::getArtist(tag); + if (artist.size() > 0 && (field.size() == 0 || field == "")) + { + id3::v2::setArtist(tag, artist); + } + ID3D_NOTICE( "id3::v1::parse: artist = \"" << artist << "\"" ); + + ID3D_NOTICE("id3::v1::parse: read bytes: " << reader.getCur() - beg); + String album = io::readTrailingSpaces(reader, ID3_V1_LEN_ALBUM); + field = id3::v2::getAlbum(tag); + if (album.size() > 0 && (field.size() == 0 || field == "")) + { + id3::v2::setAlbum(tag, album); + } + ID3D_NOTICE( "id3::v1::parse: album = \"" << title << "\"" ); + + ID3D_NOTICE("id3::v1::parse: read bytes: " << reader.getCur() - beg); + String year = io::readTrailingSpaces(reader, ID3_V1_LEN_YEAR); + field = id3::v2::getYear(tag); + if (year.size() > 0 && (field.size() == 0 || field == "")) + { + id3::v2::setYear(tag, year); + } + ID3D_NOTICE( "id3::v1::parse: year = \"" << year << "\"" ); + + ID3D_NOTICE("id3::v1::parse: read bytes: " << reader.getCur() - beg); + String comment = io::readTrailingSpaces(reader, ID3_V1_LEN_COMMENT-2); + // fixes bug for when tracknumber is 0x20 + BString trackno = io::readBinary(reader, ID3_V1_LEN_COMMENT-28); + if (trackno[0] == '\0') + { + if (trackno[1] != '\0') + { //we've got a tracknumber + uchar track = trackno[1]; + field = id3::v2::getTrack(tag); + if (field.size() == 0 || field == "00") + { + id3::v2::setTrack(tag, track, 0); + } + ID3D_NOTICE( "id3::v1::parse: track = \"" << track << "\"" ); + ID3D_NOTICE( "id3::v1::parse: comment length = \"" << comment.length() << "\"" ); + } + } + else + { + // trackno[0] != '\0' + const size_t paddingsize = (ID3_V1_LEN_COMMENT-2) - comment.size(); + const char * padding = " "; //28 spaces + + if (trackno[1] == '\0' || trackno[1] == 0x20 && trackno[0] != 0x20) + { + // if there used to be spaces they are gone now, we need to rebuild them + comment.append(padding, paddingsize); + comment.append((const char *)trackno.data(), 1); + } + else if (trackno[1] != '\0' && trackno[1] != 0x20 && trackno[0] != 0x20) + { + // if there used to be spaces they are gone now, we need to rebuild them + comment.append(padding, paddingsize); + comment.append((const char *)trackno.data(), 2); + } + } + ID3D_NOTICE( "id3::v1::parse: comment = \"" << comment << "\"" ); + if (comment.size() > 0) + { + id3::v2::setComment(tag, comment, STR_V1_COMMENT_DESC, "XXX"); + } + + ID3D_NOTICE("id3::v1::parse: read bytes: " << reader.getCur() - beg); + // the GENRE field/frame + uchar genre = static_cast(reader.readChar()); + field = id3::v2::getGenre(tag); + if (genre != 0xFF && (field.size() == 0 || field == "")) + { + id3::v2::setGenre(tag, genre); + } + ID3D_NOTICE( "id3::v1::parse: genre = \"" << (int) genre << "\"" ); + + ID3D_NOTICE("id3::v1::parse: read bytes: " << reader.getCur() - beg); + return true; +} + + diff --git a/id3lib/src/tag_render.cpp b/id3lib/src/tag_render.cpp new file mode 100644 index 0000000..8df1f9f --- /dev/null +++ b/id3lib/src/tag_render.cpp @@ -0,0 +1,228 @@ +// $Id: tag_render.cpp,v 1.2 2008/10/07 17:20:33 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug +// Copyright 2002 Thijmen Klok (thijmen@id3lib.org) + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include +#include "tag_impl.h" //has "tag.h" "header_tag.h" "frame.h" "field.h" "spec.h" "id3lib_strings.h" "utils.h" +#include "helpers.h" +#include "writers.h" +#include "id3/io_decorators.h" //has "readers.h" "io_helpers.h" "utils.h" +#include "io_helpers.h" +#include "io_strings.h" + +#if defined HAVE_SYS_PARAM_H +#include +#endif + +using namespace dami; + +void id3::v1::render(ID3_Writer& writer, const ID3_TagImpl& tag) +{ + writer.writeChars("TAG", 3); + + io::writeTrailingSpaces(writer, id3::v2::getTitle(tag), ID3_V1_LEN_TITLE); + io::writeTrailingSpaces(writer, id3::v2::getArtist(tag), ID3_V1_LEN_ARTIST); + io::writeTrailingSpaces(writer, id3::v2::getAlbum(tag), ID3_V1_LEN_ALBUM); + io::writeTrailingSpaces(writer, id3::v2::getYear(tag), ID3_V1_LEN_YEAR); + + size_t track = id3::v2::getTrackNum(tag); + String comment = id3::v2::getV1Comment(tag); + if (track > 0) + { + io::writeTrailingSpaces(writer, comment, ID3_V1_LEN_COMMENT - 2); + writer.writeChar('\0'); + writer.writeChar((char) track); + } + else + { + io::writeTrailingSpaces(writer, comment, ID3_V1_LEN_COMMENT); + } + writer.writeChar((char) id3::v2::getGenreNum(tag)); +} + +namespace +{ + void renderFrames(ID3_Writer& writer, const ID3_TagImpl& tag) + { + for (ID3_TagImpl::const_iterator iter = tag.begin(); iter != tag.end(); ++iter) + { + const ID3_Frame* frame = *iter; + if (frame) frame->Render(writer); + } + } +} + +void id3::v2::render(ID3_Writer& writer, const ID3_TagImpl& tag) +{ + // There has to be at least one frame for there to be a tag... + if (tag.NumFrames() == 0) + { + ID3D_WARNING( "id3::v2::render(): no frames to render" ); + return; + } + + ID3D_NOTICE( "id3::v2::render(): rendering" ); + ID3_TagHeader hdr; + hdr.SetSpec(tag.GetSpec()); + hdr.SetExtended(tag.GetExtended()); + hdr.SetExperimental(tag.GetExperimental()); + hdr.SetFooter(tag.GetFooter()); + + // set up the encryption and grouping IDs + + // ... + String frms; + io::StringWriter frmWriter(frms); + if (!tag.GetUnsync()) + { + ID3D_NOTICE( "id3::v2::render(): rendering frames" ); + renderFrames(frmWriter, tag); + hdr.SetUnsync(false); + } + else + { + ID3D_NOTICE( "id3::v2::render(): rendering unsynced frames" ); + io::UnsyncedWriter uw(frmWriter); + renderFrames(uw, tag); + uw.flush(); + ID3D_NOTICE( "id3::v2::render(): numsyncs = " << uw.getNumSyncs() ); + hdr.SetUnsync(uw.getNumSyncs() > 0); + } + size_t frmSize = frms.size(); + if (frmSize == 0) + { + ID3D_WARNING( "id3::v2::render(): rendered frame size is 0 bytes" ); + return; + } + + // zero the remainder of the buffer so that our padding bytes are zero + size_t nPadding = tag.PaddingSize(frmSize); + ID3D_NOTICE( "id3::v2::render(): padding size = " << nPadding ); + + hdr.SetDataSize(frmSize + tag.GetExtendedBytes() + nPadding); + + hdr.Render(writer); + + writer.writeChars(frms.data(), frms.size()); + + for (size_t i = 0; i < nPadding; ++i) + { + if (writer.writeChar('\0') == ID3_Writer::END_OF_WRITER) + { + break; + } + } +} + +size_t ID3_TagImpl::Size() const +{ + if (this->NumFrames() == 0) + { + return 0; + } + ID3_TagHeader hdr; + + hdr.SetSpec(this->GetSpec()); + size_t bytesUsed = hdr.Size(); + + size_t frameBytes = 0; + for (const_iterator cur = _frames.begin(); cur != _frames.end(); ++cur) + { + if (*cur) + { + (*cur)->SetSpec(this->GetSpec()); + frameBytes += (*cur)->Size(); + } + } + + if (!frameBytes) + { + return 0; + } + + bytesUsed += frameBytes; + // add 30% for sync + if (this->GetUnsync()) + { + bytesUsed += bytesUsed / 3; + } + + bytesUsed += this->PaddingSize(bytesUsed); + return bytesUsed; +} + + +void ID3_TagImpl::RenderExtHeader(uchar *buffer) +{ + if (this->GetSpec() == ID3V2_3_0) + { + } + + return ; +} + + +#define ID3_PADMULTIPLE (2048) +#define ID3_PADMAX (4096) + + +size_t ID3_TagImpl::PaddingSize(size_t curSize) const +{ + size_t newSize = 0; + + // if padding is switched off + if (! _is_padded) + { + return 0; + } + + // if the old tag was large enough to hold the new tag, then we will simply + // pad out the difference - that way the new tag can be written without + // shuffling the rest of the song file around + if ((this->GetPrependedBytes()-ID3_TagHeader::SIZE > 0) && + (this->GetPrependedBytes()-ID3_TagHeader::SIZE >= curSize) && + (this->GetPrependedBytes()-ID3_TagHeader::SIZE - curSize) < ID3_PADMAX) + { + newSize = this->GetPrependedBytes()-ID3_TagHeader::SIZE; + } + else + { + size_t tempSize = curSize + ID3_GetDataSize(*this) + + this->GetAppendedBytes() + ID3_TagHeader::SIZE; + + // this method of automatic padding rounds the COMPLETE FILE up to the + // nearest 2K. If the file will already be an even multiple of 2K (with + // the tag included) then we just add another 2K of padding + tempSize = ((tempSize / ID3_PADMULTIPLE) + 1) * ID3_PADMULTIPLE; + + // the size of the new tag is the new filesize minus the audio data + newSize = tempSize - ID3_GetDataSize(*this) - this->GetAppendedBytes () - + ID3_TagHeader::SIZE; + } + + return newSize - curSize; +} + diff --git a/id3lib/src/utils.cpp b/id3lib/src/utils.cpp new file mode 100644 index 0000000..862c4d4 --- /dev/null +++ b/id3lib/src/utils.cpp @@ -0,0 +1,394 @@ +// $Id: utils.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#include + +#if (defined(__GNUC__) && __GNUC__ == 2) +#define NOCREATE ios::nocreate +#else +#if defined(macintosh) //not sure if this is still needed +#define toascii(X) (X) //not sure if this is still needed +#endif //not sure if this is still needed +#define NOCREATE ((std::ios_base::openmode)0) +#endif + +#include "id3/utils.h" // has "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h" + +#if defined HAVE_ICONV_H +// check if we have all unicodes +#if (defined(ID3_ICONV_FORMAT_UTF16BE) && defined(ID3_ICONV_FORMAT_UTF16) && defined(ID3_ICONV_FORMAT_UTF8) && defined(ID3_ICONV_FORMAT_ASCII)) +# include +# include +#else +# undef HAVE_ICONV_H +#endif +#endif + + // converts an ASCII string into a Unicode one +dami::String mbstoucs(dami::String data) +{ + size_t size = data.size(); + dami::String unicode(size * 2, '\0'); + for (size_t i = 0; i < size; ++i) + { + unicode[i*2+1] = toascii(data[i]); + } + return unicode; +} + +// converts a Unicode string into ASCII +dami::String ucstombs(dami::String data) +{ + size_t size = data.size() / 2; + dami::String ascii(size, '\0'); + for (size_t i = 0; i < size; ++i) + { + ascii[i] = toascii(data[i*2+1]); + } + return ascii; +} + +dami::String oldconvert(dami::String data, ID3_TextEnc sourceEnc, ID3_TextEnc targetEnc) +{ + dami::String target; +#define ID3_IS_ASCII(enc) ((enc) == ID3TE_ASCII || (enc) == ID3TE_ISO8859_1 || (enc) == ID3TE_UTF8) +#define ID3_IS_UNICODE(enc) ((enc) == ID3TE_UNICODE || (enc) == ID3TE_UTF16 || (enc) == ID3TE_UTF16BE) + if (ID3_IS_ASCII(sourceEnc) && ID3_IS_UNICODE(targetEnc)) + { + target = mbstoucs(data); + } + else if (ID3_IS_UNICODE(sourceEnc) && ID3_IS_ASCII(targetEnc)) + { + target = ucstombs(data); + } + return target; +} + +using namespace dami; + +size_t dami::renderNumber(uchar *buffer, uint32 val, size_t size) +{ + uint32 num = val; + for (size_t i = 0; i < size; i++) + { + buffer[size - i - 1] = (uchar)(num & MASK8); + num >>= 8; + } + return size; +} + +String dami::renderNumber(uint32 val, size_t size) +{ + String str(size, '\0'); + uint32 num = val; + for (size_t i = 0; i < size; i++) + { + str[size - i - 1] = (uchar)(num & MASK8); + num >>= 8; + } + return str; +} + + +#if defined(HAVE_ICONV_H) + +namespace +{ + String convert_i(iconv_t cd, String source) + { + String target; + size_t source_size = source.size(); +#if defined(ID3LIB_ICONV_OLDSTYLE) + const char* source_str = source.data(); +#else + char *source_str = new char[source.size()+1]; + source.copy(source_str, String::npos); + source_str[source.length()] = 0; +#endif + +#define ID3LIB_BUFSIZ 1024 + char buf[ID3LIB_BUFSIZ]; + char* target_str = buf; + size_t target_size = ID3LIB_BUFSIZ; + + do + { + errno = 0; + size_t nconv = iconv(cd, + &source_str, &source_size, + &target_str, &target_size); + if (nconv == (size_t) -1 && errno != EINVAL && errno != E2BIG) + { +// errno is probably EILSEQ here, which means either an invalid byte sequence or a valid but unconvertible byte sequence + return target; + } + target.append(buf, ID3LIB_BUFSIZ - target_size); + target_str = buf; + target_size = ID3LIB_BUFSIZ; + } + while (source_size > 0); + return target; + } + + const char* getFormat(ID3_TextEnc enc) + { + const char* format = NULL; + switch (enc) + { + case ID3TE_ASCII: + format = ID3_ICONV_FORMAT_ASCII; + break; + + case ID3TE_UTF16: + format = ID3_ICONV_FORMAT_UTF16; + break; + + case ID3TE_UTF16BE: + format = ID3_ICONV_FORMAT_UTF16BE; + break; + + case ID3TE_UTF8: + format = ID3_ICONV_FORMAT_UTF8; + break; + + default: + break; + } + return format; + } +} +#endif + +String dami::convert(String data, ID3_TextEnc sourceEnc, ID3_TextEnc targetEnc) +{ + String target; + if ((sourceEnc != targetEnc) && (data.size() > 0 )) + { +#if !defined HAVE_ICONV_H + target = oldconvert(data, sourceEnc, targetEnc); +#else + const char* targetFormat = getFormat(targetEnc); + const char* sourceFormat = getFormat(sourceEnc); + + iconv_t cd = iconv_open (targetFormat, sourceFormat); + if (cd != (iconv_t) -1) + { + target = convert_i(cd, data); + if (target.size() == 0) + { + //try it without iconv + target = oldconvert(data, sourceEnc, targetEnc); + } + } + else + { + target = oldconvert(data, sourceEnc, targetEnc); + } + iconv_close (cd); +#endif + } + return target; +} + +size_t dami::ucslen(const unicode_t *unicode) +{ + if (NULL != unicode) + { + for (size_t size = 0; true; size++) + { + if (NULL_UNICODE == unicode[size]) + { + return size; + } + } + } + return 0; +} + +namespace +{ + bool exists(String name) + { + ifstream file(name.c_str(), NOCREATE); + return file.is_open() != 0; + } +}; + +ID3_Err dami::createFile(String name, fstream& file) +{ + if (file.is_open()) + { + file.close(); + } + + file.open(name.c_str(), ios::in | ios::out | ios::binary | ios::trunc); + if (!file) + { + return ID3E_ReadOnly; + } + + return ID3E_NoError; +} + +size_t dami::getFileSize(fstream& file) +{ + size_t size = 0; + if (file.is_open()) + { + streamoff curpos = file.tellg(); + file.seekg(0, ios::end); + size = file.tellg(); + file.seekg(curpos); + } + return size; +} + +size_t dami::getFileSize(ifstream& file) +{ + size_t size = 0; + if (file.is_open()) + { + streamoff curpos = file.tellg(); + file.seekg(0, ios::end); + size = file.tellg(); + file.seekg(curpos); + } + return size; +} + +size_t dami::getFileSize(ofstream& file) +{ + size_t size = 0; + if (file.is_open()) + { + streamoff curpos = file.tellp(); + file.seekp(0, ios::end); + size = file.tellp(); + file.seekp(curpos); + } + return size; +} + +ID3_Err dami::openWritableFile(String name, fstream& file) +{ + if (!exists(name)) + { + return ID3E_NoFile; + } + + if (file.is_open()) + { + file.close(); + } + file.open(name.c_str(), ios::in | ios::out | ios::binary | NOCREATE); + if (!file) + { + return ID3E_ReadOnly; + } + + return ID3E_NoError; +} + +ID3_Err dami::openWritableFile(String name, ofstream& file) +{ + if (!exists(name)) + { + return ID3E_NoFile; + } + + if (file.is_open()) + { + file.close(); + } + file.open(name.c_str(), ios::in | ios::out | ios::binary | NOCREATE); + if (!file) + { + return ID3E_ReadOnly; + } + + return ID3E_NoError; +} + +ID3_Err dami::openReadableFile(String name, fstream& file) +{ + if (file.is_open()) + { + file.close(); + } + file.open(name.c_str(), ios::in | ios::binary | NOCREATE); + if (!file) + { + return ID3E_NoFile; + } + + return ID3E_NoError; +} + +ID3_Err dami::openReadableFile(String name, ifstream& file) +{ + if (file.is_open()) + { + file.close(); + } + file.open(name.c_str(), ios::in | ios::binary | NOCREATE); + if (!file) + { + return ID3E_NoFile; + } + + return ID3E_NoError; +} + +String dami::toString(uint32 val) +{ + if (val == 0) + { + return "0"; + } + String text; + while (val > 0) + { + String tmp; + char ch = (val % 10) + '0'; + tmp += ch; + text = tmp + text; + val /= 10; + } + return text; +} + +WString dami::toWString(const unicode_t buf[], size_t len) +{ + WString str; + str.reserve(len); + + for (size_t i = 0; i < len; ++i) + { + str += static_cast(buf[i]); + } + return str; +} + diff --git a/id3lib/src/writers.cpp b/id3lib/src/writers.cpp new file mode 100644 index 0000000..bdcc155 --- /dev/null +++ b/id3lib/src/writers.cpp @@ -0,0 +1,45 @@ +// $Id: writers.cpp,v 1.1 2006/01/17 21:09:53 stulleamgym Exp $ + +// id3lib: a C++ library for creating and manipulating id3v1/v2 tags +// Copyright 1999, 2000 Scott Thomas Haug + +// This library is free software; you can redistribute it and/or modify it +// under the terms of the GNU Library General Public License as published by +// the Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +// License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this library; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// The id3lib authors encourage improvements and optimisations to be sent to +// the id3lib coordinator. Please see the README file for details on where to +// send such submissions. See the AUTHORS file for a list of people who have +// contributed to id3lib. See the ChangeLog file for a list of changes to +// id3lib. These files are distributed with id3lib at +// http://download.sourceforge.net/id3lib/ + +#if defined HAVE_CONFIG_H +#include +#endif + +#include "writers.h" + +//using namespace dami; + +/* +ID3_Writer::size_type +ID3_MemoryWriter::writeChars(const char_type buf[], size_type len) +{ + size_type size = ::min(len, this->getEnd() - this->getCur()); + ::memcpy(_cur, buf, size); + _cur += size; + return size; +} +*/ + diff --git a/id3lib/win32.readme.first.txt b/id3lib/win32.readme.first.txt new file mode 100644 index 0000000..584c0b0 --- /dev/null +++ b/id3lib/win32.readme.first.txt @@ -0,0 +1,75 @@ +Compiling on win32: + +So far, it has only been confirmed it compiles on visual C 6.0 (service pack 5), +but if you got it working on Borland or other compilers, drop me a mail, or better, add a patch +here: http://sourceforge.net/tracker/?group_id=979&atid=300979 with the (e.g.) borland project files. + +These are the directories you'll be needing: +id3lib/prj +id3lib/libprj +id3lib/id3com + +The first one (id3lib/prj) creates the standard dll (no COM interface) +The Second one (id3lib/libprj) creates the .lib file for static linking. +And the third one (id3lib/id3com) creates a dll with com interface. A Visual basic demo using it is included. + +Before you compile, you'll need to rename id3lib/config.h.win32 to id3lib/config.h + +The third one is not too much tested, it was created outside this project but +it doesn't seem to be maintained anymore. I've included it as a service. +The original location is http://sourceforge.net/projects/id3com + +And, last but not least, there is a delphi project in cvs +(http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/id3lib/id3lib-stable/delphi/) +which uses the allready compiled dll. +Also in there is a file called Id3lib.pas which has the interface to the dll +defined. + +How to start: + +A) ***Your project wants to link id3lib static, and has mfc linked static: +1) Rename config.h.win32 to config.h +2) include libprj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace +3) make your project dependend on id3lib, and make id3lib dependend on zlib +4) Add /D ID3LIB_LINKOPTION=1 to your project options (settings, C/C++ tab) +5) Add the following include dirs to your program: + /I \\include /I \\include\\id3 +6) (add your code which uses id3lib) +7) Try to compile, and see if you need any of the following: + (debug) /nodefaultlib:"msvcprtd" or(release) /nodefaultlib:"msvcprt" + (debug) /nodefaultlib:"MSVCRTD" or(release) /nodefaultlib:"MSVCRT" + (debug) /nodefaultlib:"libcd" or(release) /nodefaultlib:"libc" + different programs may require different 'nodefaultlib' 's, or none at all, these worked for me. + If none you try work, revert to C) + +B)***Your project wants to link id3lib static, and has mfc linked dynamic or has no MFC: +1) Rename config.h.win32 to config.h +2) include libprj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace +3) make your project dependend on id3lib, and make id3lib dependend on zlib +4) Add /D ID3LIB_LINKOPTION=1 to your project options (settings, C/C++ tab) +5) Add the following include dirs to your program: + /I \\include /I \\include\\id3 +6) (add your code which uses id3lib) +7) Try to compile, and see if you need any of the following: + (debug) /nodefaultlib:"msvcprtd" or(release) /nodefaultlib:"msvcprt" + (debug) /nodefaultlib:"MSVCRTD" or(release) /nodefaultlib:"MSVCRT" + (debug) /nodefaultlib:"libcmtd" or(release) /nodefaultlib:"libcmt" + different programs may require different 'nodefaultlib' 's, or none at all, these worked for me. + If none you try work, revert to C) + +C)***Your project wants to link id3lib dynamic: (instructions below for vc) +1) Rename config.h.win32 to config.h +2) include prj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace (*note this is a different id3lib than above) +3) make your project dependend on id3lib, and make id3lib dependend on zlib +4) Add /D ID3LIB_LINKOPTION=3 to your project options (settings, C/C++ tab) (*note this is a different option than above) +5) Add the following include dirs to your program: + /I \\include /I \\include\\id3 +6) (add your code which uses id3lib) +7) Compile. +8) dump id3lib.dll in your programs project dir. +9) distribute your program including id3lib.dll +(MS recommend you distribute it in your programs dir and not in system(32) to avoid version conficts) + +Thijmen +thijmen@id3lib.org + diff --git a/license/changelog_full.ger.txt b/license/changelog_full.ger.txt new file mode 100644 index 0000000..75b0323 --- /dev/null +++ b/license/changelog_full.ger.txt @@ -0,0 +1,4987 @@ + CHANGELOG FR EMULE + http://emule-project.net + ======================== + +eMule 0.49c +----------------------- +- Feb, 18. 2009 - +----------------------- +.: Ein kleiner Bug beim Zeichnen des Transferfensters wurde behoben [dolphinX] +.: Mehr Kad Anfragen haben nun auch einen Namen fr die Darstellung auf der Oberflche [tHeWiZaRdOfDoS] +.: Sicherheitscheck fr selten gesehendes Problem in Crashdumps beim SourceExchange-Antworten hinzugefgt +.: Der UDP-Socket-Puffer wurde vergrert vom Packetloss zu vermeiden + +eMule 0.49c BETA2 +----------------------- +- Feb, 10. 2009 - +----------------------- +.: Die preferences.ini Option "FileBufferTimeLimit" ("eMule" sektion) legt die maximale Zeit bis zum leeren der Puffer fr Downloads in Sekunden fest (default: 60) + +----------------------- +- Feb, 9. 2009 - +----------------------- +.: Wenn ein anderer Benutzer eure freigegebenen Verzeichnisse sehen will (und ihr es erlaubt habt), benutzt eMule nun nur noch die Verzeichnisnamen (oder rlative Pfade) statt den vollen Pfad aus Datenschutzgrnden + +----------------------- +- Feb, 8. 2009 - +----------------------- +.: Bei einer neuen eMule-Installation sind nun standardmig einige weniger wichtige Spalten in Listen versteckt um ein berladen der Oberflche zu vermeiden +.: Die maximale Breite der Buttons der Haupttoolbar wurde ein wenig erhht + +----------------------- +- Feb, 7. 2009 - +----------------------- +.: Sicherheitschecks fr einige Probleme aus Crashdumps beim Senden von Antworten wurde hinzugefgt +.: Wertecheck fr die preferences.ini Option "tcp obfuscation padding lnge" wurde hinzugefgt + +[Hinweis: Eintrge die sich ausschlielich auf Korrekturen der Betaversion beziehen sind im deutschen Changelog bersprungen] + +eMule 0.49c BETA1 +----------------------- +- Feb, 4. 2009 - +----------------------- +.: Zeitangaben in der Downloadliste haben nun ihr eigenes Format ("DateTimeFormat4Lists" in der preferences.ini), welches standardmig kompakter als das alte ist +.: Eine neue Spalte in der Downlaodliste zeigt den Zeitpunkt wann der Download hinzugefgt wurde + +----------------------- +- Feb, 2. 2009 - +----------------------- +.: Kontakte aus Kad Routingantworten werden nun zustzlich gegen die eigene Routingtabelle geprft +.: Kad erlaubt nicht mehr als 2 Kontakte aus dem gleichen Subnetz bei Routingantworten (auer LANs) +.: Ein kleine Bug im Uploadthrottler wurde behoben [tHeWiZaRdOfDoS] + +----------------------- +- Jan, 27. 2009 - +----------------------- +.: Der Kad UDP-Firewalltest fragt nun mehrere Kontakte zum externalen Port um zu vermeiden dass bei NATs die ihren Sourceport bei jeder Antwort wechseln ein falscher "Offen"-Status festgestellt wird +.: Kad berprft nun eingehende Suchantworten erneut mit dem genutzten Suchfilter und verwirft alle Antworten die den Kriterien nicht entsprechen (was nur bei fehlerhaten Clients oder Spam der Fall sein sollte) + +----------------------- +- Jan, 25. 2009 - +----------------------- +.: Wenn eine corrupte *.part.met-Datei entdeckt wird, versucht eMule nun automatisch ein Backup zu laden +.: Einige Daten (wie das AICH-Hashset, Statistiken, Metadaten, usw) von Dateien die ber einen Monat nicht mehr gesehen (freigegeben) wurden, werden nun gelscht um Ressourcen zu sparen und ein endloses wachsen der known*.met-Dateien zu verhindern + (die erste Lschung wird einem Monat nach dem Update erfolgen) +.: Falls du die teilweise Lschung von Informationen ber verwaiste Dateien aus irgendeinem Grund verhindern willst, kannst du "PartiallyPurgeOldKnownFiles=0" in die "eMule" Sektion der preferences.ini eintragen + +----------------------- +- Jan, 20. 2009 - +----------------------- +.: Beim Sortieren nach Dateitypen wird nun nachrangig nach der Endung sortiert wenn zwei Dateitypen gleich sind + +----------------------- +- Jan, 11. 2009 - +----------------------- +.: Bei einfachen Suchanfragen ordnet Kad die Schlsselwrter nun selbstndig neu und nutzt das lngste um zu bestimmen welche Node gefragt werden muss. Dies reduziert die Last fr Nodes mit kurzen, beliebten Schlsselwrtern wie "das", macht sie ein schlechteres Ziel fr Angriffe und erlaubt Suchen mit kurzen Startwrten wie "An eMule" +.: Das Umordnen von Schlsselwrten kann mit dem Eintrag "RearrangeKadSearchKeywords=0" in die "eMule" Sektion der preferences.ini deaktiviert werden (es gibt jedoch normalerweise keinen Grund dafr) + +----------------------- +- Jan, 10. 2009 - +----------------------- +.: Einzelne Dateien sowie Verzeichnisse knnen nun auch mit Drag&Drop freigegeben werden - ziehe einfach die Datei vom (z.B.) Windows Explorer in die Freigegebene Dateien-List +.: eMule kann nun auch einzelene Dateien (statt ganze Verzeichnisse) freigegeben oder entfernen, indem sie im Dateien-Dialog im "Alle Verzeichnisse"-Baum markiert werden. Downloads und Eintrge im "Fertige Dateien"-Verzeichnis knnen jedoch nicht entfernt werden. +.: Kad Datei/Quellen-Suchantworten versuchen nun fragmentierte Pakete zu vermeiden um besser mit bereifrigen Firewalls/Routers zu funktionieren (Effekt wird sichtbar sobald ein Groteil der Benutzer auf diese Version updated) + +----------------------- +- Jan, 5. 2009 - +----------------------- +.: Ein mglicher Absturz in der (minilib) UPnP-Implementation wurde behoben +.: Der Port fr das Webinterface kann nun auch von UPnP eingerichtet werden (Optionen->Webinterface) +.: Die UPnP-Eintrge werden vor einem Kad-Firewallcheck, beim Aufwachen aus dem StandBy-Modus und bei der Smart-LowID-Erkennung geprft und ggf. aufgefrischt + +----------------------- +- Jan, 3. 2009 - +----------------------- +.: Die maximale Lnge von Kommentaren wurde auf 128 Zeichen vergrert +.: Ein Bug der Text in der Downloadliste in falschen Farben darstellte (am auffligsten bei speziellen Windowsthemes) wurde behoben + +----------------------- +- Dec, 22. 2008 - +----------------------- +.: Support fr Windows-Sicherheitsfeature 'Heap Corruption Detection' hinzugefgt (Windows Vista) +.: Support fr Windows-Sicherheitsfeature 'Address Space Layout Randomization' hinzugefgt (Windows Vista) + +----------------------- +- Dec, 21. 2008 - +----------------------- +.: Support fr Previews des Inhalts von .ISO dateien hinzugefgt (liest den Inhalt von ISO9660, keine UDF-Untersttzung) +.: Es wurde sichergestellt dass eine Kad-Routing-Antwort nicht mehr Kontakte enthlt als angefordert wurden [Xin Sun] + +----------------------- +- Dec, 19. 2008 - +----------------------- +.: Support fr Windows-Sicherheitsfeature 'Data Execution Prevention' hinzugefgt (Windows XP SP2 / Windows Vista) +.: Support fr Windows-Sicherheitsfeature 'Exception Handling Protection' hinzugefgt (Windows XP SP2 / Windows Vista) + +----------------------- +- Oct, 22. 2008 - +----------------------- +.: Crashdumps werden nun im Konfigurationsverzeichnis gespeichert [tHeWiZaRdOfDoS] +.: Ein Bug beim erstellen eines neuen Benutzerhashs, der zu unzureichender Zuflligkeit fhrte, wurde behoben [godlaugh2007] + +----------------------- +- Oct, 21. 2008 - +----------------------- +.: Hinzugefgt: Anzeigen von Wasserzeichenbildern in Listen (siehe "LvBkImg" in "Template.eMuleSkin.ini")) + +----------------------- +- Oct, 18. 2008 - +----------------------- +.: Darstellung von multiplen ausgewhlten Eintrgen in allen Listenelementen vereinheitlicht +.: Verschiedene Optimierungen beim Darstellen von Listen +.: Cursor-Bild beim Drag&Drop im Transfer-Fenster hinzugefgt (beim ziehen in eine Kategorie) +.: Tooltips bei multiplen ausgewhlten Eintrgen um Server- und Suchfenster korrigiert + +----------------------- +- Oct, 11. 2008 - +----------------------- +.: Hinzugefgt: Automatische Grenanpassung bei Listenspalten (ein Doppelklick auf den Spaltenteiler verndert die Gre entsprechend) +.: Hinzugefgt: Labeltips fr alle teilweise verdeckten Eintrge in Listen +.: Hinzugefgt: Standardsuchreihenfolge fr Listen im Transferfenster +.: Listen knnen nun auch nach Untereintrge durchsucht werden +.: Ein Sortierungsbug im Dateinamen-Dialog wurde behoben + +----------------------- +- Sep, 27. 2008 - +----------------------- +.: Auswertung von Metadaten bei DVR-MS-Dateien zum Inhaltstab im Datei-Detailsdialog hinzugefgt. +.: Auswertung von Metadaten bei Wav-Dateien zum Inhaltstab im Datei-Detailsdialog hinzugefgt. +.: Verffentlichung von ED2k-spezifischen Metadaten fr WMA und WAV-Dateien hinzugefgt +.: Spalten fr Metadaten wurde in die freigegebene Dateien-List hinzugefgt + +----------------------- +- Sep, 23. 2008 - +----------------------- +.: eMule kann nun Windows Verknpfungen folgen (Optionen->Erweitert) und freigeben. Dadurch knnen z.B. auch Dateien die in nicht freigegebnen Verzeichnisse liegen durch eine Verknpfung in ein freigegebenes Verzeichnis verffentlicht werden. +.: Auswertung von Metadaten bei Windows Media-Dateien zum Inhaltstab im Datei-Detailsdialog hinzugefgt. + +----------------------- +- Sep, 14. 2008 - +----------------------- +.: Eine weitere Mehtode zum Auffinden der MediaInfo Bibliothek hinzugefgt +.: Support fr Multiuser-System unter Win0x/WinME/WinNT hinzugefgt (bentigt IE5) +.: Support fr Vorschau von Selbstextrahierenden RAR-Archiven hinzugefgt +.: Fehlerhafte ED2K-Link Registry Funtion unter Win98/ME/NT behoben + +----------------------- +- Sep, 13. 2008 - +----------------------- +.: Ein Bug bei der nderung der Gre der Haupttoolbar unter Win98 wurde behoben +.: Nachrichtenbox-Inhalte zum Download einer richtigen Version von DBGHELP.DLL unter Win9x/WinME/Win2000 wurde korrigiert +.: Ein Absturz beim Lschen von vollstndigen Downloads unter Win98 wurde behoben +.: Heruntergeladene Dateien werden nun in der selben Weise markiert wie beim Internet Explorer, was zu einem Warnhinweis beim ausfhren mglicher schdlicher Dateien fhrt +.: Beim ffnen von DRM-geschtzten Dateien zeigt eMule nun eine Wanrmeldung um zu verhindern dass versehentlich eine bsartige "Lizens"-Seite im Browser geffnet wird + +----------------------- +- Sep, 11. 2008 - +----------------------- +.: Beim wechseln der Sprache wurde der Text in Filtern nicht aktualisiert [JvA] +.: (Win98) Ein Bug beim Standard-Dateisuchtyp wurde behoben + +----------------------- +- Sep, 4. 2008 - +----------------------- +.: Neue "Verzeichnisse durchsuchen"-Buttons im Optionsdialog hinzugefgt + +----------------------- +- Sep, 2. 2008 - +----------------------- +.: Einige Akutalisierungs/Grennderungs-Probleme wurde behoben und Flickern in einigen Fenstern reduziert + +----------------------- +- Sep, 1. 2008 - +----------------------- +.: Ein Bug in den Tooltips unter Win98/2000 wurde behoben +.: Ein Problem mit korrupten gespeicherten Suchergebnissen wurde behoben [George1] + +----------------------- +- Aug, 30. 2008 - +----------------------- +.: Korrigiert: Es war mglich eMule Installationsordner freizugeben +.: Ein Bug in den Statistiken von neuen Downloads wurde behoben +.: Ein mgliches Kompabilittsproblem mit Windows NT 4.0 wurde behoben +.: Ein Problem mit fehlenden Icons unter Win98 wurde behoben + +----------------------- +- Aug, 24. 2008 - +----------------------- +.: Korrigiert: Einige Unicodestrings wurden nicht korrekt in den Meta-Daten von Downloads gespeichert +.: Mgliche Unicode-Probleme in Kad-Suchausdrcken wurden behoben +.: Die Suchoption "Suche mit Unicode" wurde entfernt - alle Suchen benutzen nun Unicode +.: Rckwrtskomptiblitt mit Pre-Unicode .met-Dateien wurde entfernt +.: Die preferences.ini-Option "SetSystemACP" wurde entfernt +.: eMule erkennt nun ob die MediaInfo Bibliothek (http://mediainfo.sourceforge.net/) installiert ist und nutzt diese automatisch fr den Inhaltsdialog von Downloads/freigegebenen Dateien +.: Die Kad Unicode Abbildungstabelle wurde aktualisiert um den in Vista verwendeten Standard zu untersttzen + +----------------------- +- Aug, 16. 2008 - +----------------------- +.: Korrigiert: Unicodestrings wurden nicht korrekt im Spamfilter gespeichert + +----------------------- +- Aug, 15. 2008 - +----------------------- +.: Hinzugefgt: NT-Volumeninfo-Cache um das verarbeiten von freigebenen Verzeichnissen auf nicht-festen Laufwerken zu beschleunigen +.: Korrigiert: Auf eingen Code-Seiten wurden Unicodezeichen nicht korrekt in den .met-Dateien gespeichert [Borschtsch] +.: Korrigiert: Einige Unicodestrings wurden nicht korrekt in den Meta-Daten von vergegebenen Dateien gespeichert + +----------------------- +- Aug, 11. 2008 - +----------------------- +.: Die "downloads.txt"-Datei wird nun im eMule-Knogurationsverzeichnis gespeichert + +----------------------- +- Aug, 10. 2008 - +----------------------- +.: Sortierung fr Entrge in "Alle freigegebenen Verzeichnisse" und "Fertige Dateien" im Freigegebene-Dateienfenster hinzugefgt +.: Anzeigen fr "Nicht verbundende" Verzeichnisse im Freigegebene-Dateienfenster hinzugefgt +.: "Nicht verbundene" freigegebene Verzeichnisse werden nun beim eMule-Start nicht mehr entfernt +.: Verzeichnisse die mindestens ein freigegebenes aber nicht verbundenes Verzeichnis haben werden durch ein Warnicon gekennzeichnet +.: Der Verbunden-Status wird beim "Neu Laden" der freigegebenen Dateien erneut berprft + +----------------------- +- Aug, 9. 2008 - +----------------------- +.: Korrigiert: Aktivierung vom Start/Abbrechen Button im Suchfenster fr geschlossende Kad-Suchen +.: Korrigiert: Unsichtbares Grpper-Element im Transferfenster +.: Korrigiert: Standard Windows-Eigenschaften-Dialog Verknpfungen im Optionsfenster +.: Einige unwahrscheinliche aber theoretisch Mgliche Absturzbugs wurden behoben +.: Die Beschrnkungen fr freigegebene Laufwerke mit dem Buchstaben 'A:' und 'B:' wurden entfern + +eMule 0.49b +----------------------- +- Jul, 31. 2008 - +----------------------- +.: Einige seltenere mgliche Abstrze wurden behoben + +eMule 0.49b BETA2 +----------------------- +- Jul, 28. 2008 - +----------------------- +.: Einzelne Eintrge der Autovervollstndigungslisten knnen mit der "Entf"-Taste gelscht werden +.: Eine zustzliche Suchmethodenoption "Automatisch" wurde hinzugefgt, die eMule whlen lsst welche Methode genutzt werden soll. eMule wird zwischen Server (Lokal) und Kad whlen, je nachdem zu welchen Netzwerk es verbunden ist und einige andere Faktoren wenn beide Netzwerke aktiv sind +.: In den Beta-Versionen wurde ein Ausnahmefehler-Handler entfernt. Die lsst eMule bei unbekannten Fehlern abstrzen statt sie zu ignorieren, was notwendig ist damit wir solche Fehler (falls sie existieren) in den Crashdumps entdecken knnen. + +----------------------- +- Jul, 26. 2008 - +----------------------- +.: Eine Implementierung einer spezielle nodes.dat Version, die sich fr die Massenverteilung eignet ohne die Kontakte zu sehr zu belasten, wurde hinzugefgt. Dies wird es uns hoffentlich ermglichen eine nodes.dat im Installer zu liefern so dass neue Nutzer nicht mehr mit Servern verbunden sein mssen um sich zum ersten mal zu Kad zu verbinden + +----------------------- +- Jul, 19. 2008 - +----------------------- +.: Eine zustzliche Methode um den Anzahl der Kadbenutzer abzuschtzen, die nicht auf der lokalen Routingtabelle beruht wurde hinzugefgt. Sie ist experimentell und wird nu im Netwerkdialog (Doppelklick auf das Welticon in der Statusbar) gezeigt +.: Die Anzeige der Benutzerzahlen wurde gendert, so dass nur noch die Zahlen angezeigt werden fr das Netzwerk zu dem eMule verbunden ist + +----------------------- +- 14. Jul 2008 - +----------------------- +.: Ein kleinerer Bug in Kad beim Antworten auf unobfuskierte Pakete wurde behoben +.: Kad sendet nun nur ein Testpaket zum verifizieren eines Kontaktes gleichzeitig an die selbe IP + +eMule 0.49b BETA1 +----------------------- +- 11. Jul 2008 - +----------------------- +.: MiniUPnPLib wurde als zustzliche UPnP-Implementierung hinzugefgt, die derzeitige Windowsservice-basierende Implementierung wird nun als Fallback genutzt. Die wird hoffentlich eMules UPnP kompatibel zu fast allen Routern machen [miniupnplib by Thomas Bernard, Test & Idee: leuk_he] +.: Eine spezielle UPnP-Implementierung kann abgeschaltet werden indem "DisableMiniUPNPLibImpl=1" oder "DisableWinServImpl=1" in die "UPnP"-Sektion der preferences.ini eingefgt wird + +----------------------- +- 5. Jul 2008 - +----------------------- +.: Wenn eine nodes.dat ohne verifizierte Kontakte gelesen wird (mglicherweise eine alte Version) nimmt eMule an dass alle Kontakte verifiziert sind um die Verbindungsphase nicht zu verlangsamen +.: Projektdateien fr VS2005 und VS2008 wurden hinzugefgt, die offizielle Version wird jedoch weiterhin auf VS2003 entwickelt und kompiliert + +----------------------- +- 27. Jun 2008 - +----------------------- +.: Verschiedene nderungen wurden in Kad gemacht um Routingangriffe abzuwehren, die von University of Minnesota Angehrigen untersucht wurden [Peng Wang, James Tyra, Eric Chan-Tin, Tyson Malchow, Denis Foo Kune, Nicholas Hopper, Yongdae Kim], im Detail: +.: Kad Kontakte knnen sich nun nur in den Routingtabellen von anderen Kontakten aktualisieren wenn sie den passenden Schlssel (0.49a+) nachweisen um unmglich zu machen sie zu "hijacken" +.: Kad nutzt nun einen 3-Wege-Handshake (oder fr ltere Versionen etwas hnliches) fr neue Kontakte um sicherzustellen dass sie keine geflschten IPs nutzen +.: Nicht verifizierte werden nicht mehr fr Routing-Aufgaben genutzt und in der GUI mit einem speziellen Icon gekennzeichnet + +----------------------- +- 22. Jun 2008 - +----------------------- +.: Korrigiert: Der Splitter im freigegebene Datei-Fenster speicherte seine Position nicht korrekt +.: Ein erster kleiner Schritt beim Entfernen des Kad1-Supports: Kad testet unbekannte Kontakte nicht mehr auf Kad1 um Overhead zu sparen, entsprechende Clienten funktionieren trotzdem bisher noch problemlos +.: Ein Bug wurde behoben der einen Kad2 manchmal als Kad1-Kontakt ansah, wenn Kad den Kontakt auf beide Versionen testete + +----------------------- +- 10. Jun 2008 - +----------------------- +.: Korrigiert: Speicherleck in den Contextmens +.: Hinzugefgt: Contextmens unter Vista haben nun das entsprechende Vista-Look&Feel + +----------------------- +- 10. Jun 2008 - +----------------------- +.: Korrigiert: Das Drcken von ESC im Freigegebene Dateien-Filter zerstrte das Fenster + +----------------------- +- 10. Jun 2008 - +----------------------- +.: Ein zustzliche Sicherheitscheck kontrolliert dass eMule niemals geladene Daten in einen bereits kompletten Teil schreibt +.: Der Kad-Paketverfolgungscode wurde optimiert so dass nur Pakete erfasst werden die spter auch kontrolliert werden um Ressourcesn zu sparen + +----------------------- +- 9. Jun 2008 - +----------------------- +.: Ein 100% CPU-Last Bug der Tooltips im Statistikgraphen wurde behoben +.: Der Tooltip im Statistikgraphen zeigt nun auch den Y-Wert +.: Kad versucht nicht lnger UDP Firewalled (und damit grtenteils unerreichbare) Nodes in seine Routingtabellen aufzunehmen, womit der Overhead reduziert und die Zuverlssigkeit gesteigert wird +.: Kad versucht das Verhltnis von Firewalled Nutzern im Netzwerk festzustellen und zeigt sie im Statistikbaum. Dies funktioniert nur wenn du selbst nicht Firewalled bist und genug 0.49b+ Nodes existieren +.: Beim Errechnen der Benutzerzahl in Kad wird nun die richtige Nummer (falls bekannt) von Firewalled Nutzern einbezogen, statt einen festen Wert anzunehmen. Dieser Effekt wird strker wenn 0.49b Nodes zahlreicher werden + +----------------------- +- 5. Jun 2008 - +----------------------- +.: Der "eD2k-Links"-Button in den Optionen funktioniert nun korrekt unter Vistas mit eingeschaltetem UAC + +----------------------- +- 31. Mai 2008 - +----------------------- +.: Context-Meneintrge zum entfernen der Freigabe von Verzeichnissen wurden im virtuellen "Freigegebene Versichnisse"-Ordnder hinzugefgt + +----------------------- +- 28. Mai 2008 - +----------------------- +.: Hinzugefgt: Vista-Theme fr alle Reiter-Elemente +.: Hinzugefgt: Vista-Theme fr alle Kategorieauswah-Elemente + +----------------------- +- 25. Mai 2008 - +----------------------- +.: Probleme beim Darstellen der Toolbar unter Vista wurden behoben +.: eMules Verbindungs-Funktion wurde berarbeitet und dabei einige kleinere sowie ein paar grere Bugs behoben, inkl. einer mglichen Endlosschleife bei unerreichbaren DirectCallback-Quellen + +----------------------- +- 19. Mai 2008 - +----------------------- +.: Reiter haben ein neues Schlieen-Icon +.: Kad ignoriert nun Routing-Antworten in den mehrere IDs auf eine IP zeigen + +----------------------- +- 18. Mai 2008 - +----------------------- +.: Korrektur: Reiter hatten nicht immer die korrekte Gre bei einigen Textinhalten + +----------------------- +- 17. Mai 2008 - +----------------------- +.: Korrektur: Kategorie-Reiter im Transfer-Fenster zeigten nicht die korrekte Standard-Textfarbe +.: Korrektur: Kategorie-Reiter im Details-Dialog zeigten nicht immer die korrekte Kategoriefarbe +.: Fr Vista wurden "Hot Tracking"-Effekte fr alle Reiter hinzugefgt + +----------------------- +- 12. Mai 2008 - +----------------------- +.: Korrektur: Tooltips wurden in Vista mit Aero Thema nicht richtig dargestellt + +0.49a +----------------------- +- 8. Mai 2008 - +----------------------- +.: Wenn erweiterte Steuerelemente eingeschaltet sind (und die Daten verfgbar) zeigt eMule bei Kad-Suchen in der Verfgbarkeitsspalte die Zahl der Bekannten Publisher in Klammern (das ist nicht das gleiche wie Quellen, aber ein etwas vertrauenswrdigerer Indikator wie verbreitet eine Datei ist). +.: CxImagelib wurde auf die aktuellste Version aktualisiert, wobei eine Schwachstelle behoben wurde (geringes Risiko fr eMule) [Berichtet: Steve Manzuik/Juniper Networks] +.: Ein Unicode-Problem beim anzeigen von gespeicherten Suchergebnissen wurde behoben +.: DirectCallback-Quellen werden nun korrekt zur "Deadsources"-Liste hinzugefgt bzw. getestet + +0.49a BETA3 +----------------------- +- 5. Mai 2008 - +----------------------- +.: Wenn sowohl der externe als auch der interne UDP Port beim Firewalltest ereichbar sind, wird nun sichergestellt dass immer der Interne genutzt wird +.: Steuerzeichen werden aus ed2k-links / empfangenden Dateinamen nun herausgefiltert [eklmn] +.: Ein kleiner Bug beim Laden von nicht mehr existierenden Kategorie-Verzeichnisse wurde behoben [tHeWiZaRdOfDoS] +.: Der Installer whlt nun die derzeit bereits genutzte Einstellung fr die "Gemeinsame Nutzung" von eMule als Standardeinstellungen bei Updates/Neuinstallationen + +----------------------- +- 3. Mai 2008 - +----------------------- +.: Ein weitere Bug beim neuen UDP firewalltest, der Ergebnisse zum externen Port und unerreichbaren Clienten falsch auswertete, wurde behoben +.: Captchas knnen nun auch aus Zahlen bestehen (auer 0) +.: Einige Probleme bei Suchen und Verbinden zu Buddys wurden behoben +.: Das Interval der Buddy-Suche wurde verringert, um die Chance zeitnahe einen Buddy zu finden zu erhhen + +----------------------- +- 1. Mai 2008 - +----------------------- +.: Die Krypt-Funktionen wurden etwas fr Geschwindigkeit optimier [netfinity] + +0.49a BETA2 +----------------------- +- 29. April 2008 - +----------------------- +.: Ein seltener Bug, der doppeltes Download von Daten die Bereits in eMules Puffern liegen mglich machte, wurde behoben [tHeWiZaRdOfDoS] +.: Der UPnP Support wurde ein wenig angepasst um einige zustzliche Router zu untersttzen [leuk_he] +.: Libpng wurde auf die aktuellste Version 1.2.27 aktualisiert + +----------------------- +- 27. April 2008 - +----------------------- +.: Das Protokoll fr Kad-TCP-Firewalltests wurde gendert um es mglich zu machen den "Offen"-Status fr TCP zu erhalten auch wenn der UDP Port nicht erreichbar ist +.: Jeder Dialog (Kad, Server, usw) hat nun seine eigene Einstiegs-Hilfeseite, die von eMule statt der Indexseite beim drcken von F1 aufgerufen (Derzeit noch nicht in allen Sprachen) + +----------------------- +- 20. April 2008 - +----------------------- +.: Zwei Bugs im neuem Firewalltest, die zu falschen Ergenissen fhren konnten, wurden behoben [tHeWiZaRdOfDoS] +.: eMule untersttzt nun ed2k-Links zum Downloaden der nodes.dat von einer URL. Ein solcher Link sollte so aussehen: ed2k://|nodeslist|http://domain/nodes.dat|/ +.: Zwei kleinere Anzeigefehler in den Statistiken und der Warteschleife wurden behoben [tHeWiZaRdOfDoS] + +----------------------- +- 23. April 2008 - +----------------------- +.: Das Laden und Speichern von Kad-Schlelwrtern und Quellen wurde in einen seperaten Thread verlegt um eine Interface-Blockierung whrend des Ladens der Daten zu vermeiden +.: Kad (tcp) Firewall und Buddy TCP Verbindungen untersttzen nun die Protokoll-Obfuskation korrekt + +----------------------- +- 15. April 2008 - +----------------------- +.: Strg+W schliet nun den aktiven Reiter im Suchfenster + +0.49a BETA1 +----------------------- +- 12. April 2008 - +----------------------- +.: Betaversionen erzeugen nun eine kleine Testdatei welche von eMule freigegeben wird. Sie soll uns helfen, nderungen im Protokoll zu debuggen (besonders Kad). Bei Programmende wird diese Datei gelscht. +.: Korrektur eines Fehlers mit dem "Eingangsverzeichnis ffnen..." Meneintrag bei den freigegebenen Dateien [Stulle] + +----------------------- +- 11. April 2008 - +----------------------- +.: Obfuskation-Einstellung zum Erststart-Assistenten hinzugefgt +.: Peercache Downloads standardmig deaktiviert (veraltet) +.: Beta nagging Dialog hinzugefgt + +----------------------- +- 06. April 2008 - +----------------------- +.: mehrere Fehler in den neuen Kad Firewall-Tests, Obfuskation und Callbackfunktionen korrigiert + +----------------------- +- 30, Mrz 2008 - +----------------------- +.: eMule erkennt nun Windows' Standby-Modus und stellt Verbindungen nach dem Aufwachen wieder her [MorphXt] + +----------------------- +- 18. Mrz 2008 - +----------------------- +.: Korrektur: Datei-Tooltips nutzten falsche Schriftgren wenn eigene Windows Metriken benutzt wurden +.: Hinzugefgt: Windows Standardschriftarten knnen nun in Listen und Baumansichten von eMules Hauptfenstern benutzt werden. Dadurch knnen grere Schriften fr fast alle eMule-Listenanzeigen verwendet werden (Systemeinstellung/Anzeige). Setze "UseSystemFontForMainControls=1" in "preferences.ini" um dies zu aktivieren. +.: Korrektur: Baumansicht der freigegebenen Verzeichnisse verlor die Icons nach dem ndern von Windows Systemeinstellungen. +.: Korrektur von falschen Schriftarten fr einzelne GUI-Elemente bei manchen Systemsprachen + +----------------------- +- 17. Mrz 2008 - +----------------------- +.: Korrektur: Liste freigegebener Dateien zeigte nicht Fokus-Umrandung der Eintrge + +----------------------- +- 16. Mrz 2008 - +----------------------- +.: Korrektur: Menpunkt "Suche zugehrige Dateien" im Kontextmen von Suchergebnissen war nicht immer korrekt aktiviert/deaktiviert [Tuxman] +.: Korrektur: Speicherfehler bei Spalteneigenschaften im Webinterface [tHeWiZaRdOfDoS] +.: Korrektur: Such-Labels im Webinterface normalisiert [ducho] +.: Korrektur: Einige Suchresultate tauchten noch auf, nachdem "Schliee alle Ergebnisse" bettigt wurde [bengarchy] +.: Korrektur: (De)Aktivieren der Transferanzeige von "In Warteschlange" und "Bekannte Clients" aktualisierte nicht immer korrekt die Liste [Xman] +.: Korrektur: Toolbars im Transferfenster zeigten nicht Tooltips nach dem Wechseln von "In Warteschlange" und "Bekannte Clients" + +----------------------- +- 15. Mrz 2008 - +----------------------- +.: Korrektur einiger GDI Ressource-Lecks [Rapid_Mule] +.: Korrektur beim Erzeugen von Zufallszahlen [leuk_he] +.: Korrektur eines Fehlers beim Speichern von Suchen [netfinity] + +----------------------- +- 26. Februar 2008 - +----------------------- +.: Beim Lschen vor mehr als 50 Dateien werden nur die ersten 50 Namen im Besttigungsdialog angezeigt [tHeWiZaRdOfDoS] +.: Korrektur eines Fehlers beim Aufspren von Sendern korrupter Daten, welcher zu falschen Treffern fhren konnte [DavidXanatos] + +----------------------- +- 10. Februar 2008 - +----------------------- +.: Kad erzwingt nun einige Limits beim Hinzufgen von neuen Kontakten zur Routingtablelle: Nicht mehr als 1 KadNode pro IP, 2 hnliche KadNodes (gleicher bin) von einem /24 Netzwerk und maximal 10 verschiedene KadNodes von einem /24 Netzwerk sind erlaubt. Dies soll Routingattacken gegen Kad schwieriger machen (bzw ressourcenintensiver). +(Man kann weiterhin mehr als einen Kad Client pro IP ohne Probleme oder Einschrnkungen nutzen. Sie werden nur nicht beide Teil des internen Kad Routings.) + +----------------------- +- 03. Februar 2008 - +----------------------- +.: Im Downloadkommentar-Dialog kann der Kommentarspamfilter nun direkt bearbeitet werden. nderungen werden sofort auf alle Kommentare angewendet. +.: Clients, welche Kommentare senden die vom Spamfilter ausgefiltert werden, werden nun wie Nachrichten-Spammer behandelt und gebannt. +.: Das "ed2k:" in ed2k-Links ist nicht mehr case sensitive +.: Beim Verbinden zum Ed2k-Netz wird mit einem zuflligen Server begonnen, anstatt des Ersten aus der server.met. Sortierungen, Prioritten,... haben keinen Einfluss auf die Erstauswahl. + +----------------------- +- 01. Februar 2008 - +----------------------- +.: Mehrere nderungen wurden implementiert um die Widerstandsfhigkeit gegen bsartiges keyword publishing zu verbessern: +.: Kad merkt sich nun, welche Dateinamen von verschiedenen Quellen fr die gleiche Datei bekanntgegeben wurden und nutzt den hufigsten Namen (anstatt des letzten gesendeten) beim Beantworten von Suchanfragen. +.: Gleiche File-Hashs mit verschiedenen Dateigren werden nun separat gespeichert anstatt sich gegenseitig zu berschreiben. +.: Kad errechnet eine Bewertung basierend darauf, wieviele verschiedene Quellen eine Datei verffentlichen und wieviele Dateien eine Quelle verffentlicht. Beim Beantworten einer Suchanfrage werden Dateien mit einer Bewertung kleiner als ein gesetztes Limit als letztes gesendet um zu verhindern, dass gespammte Dateien die gltigen ausstechen. +.: Das Kad-Rating fr verffentlichte Dateien wird auch in den Suchresultaten mitgesendet (als Indikator fr zuknftige Versionen) + +----------------------- +- 16. Januar 2008 - +----------------------- +.: Ein Anti-Flood-Schutz wurde zu Kad hinzugefgt. Wenn Kad mehr Anfragen eines spezifischen Typs von einer IP als erwartet erhlt, werden weitere dieser Anfragen ignoriert und evtl die Quelle gebannt. Dies soll verschiedene Angriffsszenarios verhindern oder erschweren. +.: Korrektur eines Fehlers, welcher DNS Server in die Routingtabellen einflieen lassen konnte. Alte Quellen mit Port 53 als Kad Port werden ignoriert, neue Clients (0.49a+) knnen den Port 53 als Kad Port wieder nutzen, es ist aber nicht empfohlen. [gefunden von netfinity] +.: Korrektur eines Fehlers in Kad2 bzgl. des Verffentlichens von Dateien >4GB [netfinity] + +----------------------- +- 11. Januar 2008 - +----------------------- +.: Wird ein neues Eingangsverzeichnis ausgewhlt welches Dateien enthlt, werden diese nun in die Liste freigegebener Dateien aufgenommen. + +----------------------- +- 08. Januar 2008 - +----------------------- +.: Eine Filtereingabe wurde zur Liste freigegebener Dateien hinzugefgt (wie bei Suchresultaten). Der Filter soll nur helfen, freigegebene Dateien zu finden, es hat keinen Einfluss darauf, welche Dateien nun verffentlicht werden. +.: Die Symbole im Verzeichnisbaum der freigegebenen Dateien wurden leicht umgeordnet. + +----------------------- +- 15. Dezember 2007 - +----------------------- +.: Die Onlinehilfe fr die Optionen-Dialoge sind nun themensensitiv (Hilfeseite des aktiven Dialog ffnet sich) fr alle Sprachen auer Englisch. Weitere Stellen werden in Zukunft Schritt fr Schritt erledigt. +.: Offene Suchen werden nun beim Beenden von eMule gespeichert und bei Neustart wiederhergestellt. Dies kann in den Optionen (Anzeige) deaktiviert werden. + +----------------------- +- 02. Dezember 2007 - +----------------------- +.: Kads Firewallhandling und -testen wurde berarbeitet: +Der Kad Firewallzustand ist jetzt in TCP und UDP aufgeteilt. Der TCP-Zustand ist quasi der der alte Zustand, welcher testet, ob die TCP-Port erreichbar ist. Der UDP-Zustand ist neu und prft ob dein UDP-Port erreichbar ist. Zum Beispiel bei "Full Cone" Routern ohne Portweiterleitung wirst du TCP-Firewalled erhalten (wie bisher) aber UDP-Offen (neu). Wenn der UDP-Test erfolgreich war (Offen), braucht eMule keinen Buddy mehr und kann vollstndig am Kad Netzwerk teilnehmen. Dadurch wird der Overhead wegfallen, welcher in vorigen Versionen auftrat. Du kannst dich aber weiterhin nicht zu anderen TCP-Firewalled Clients verbinden wenn du auch TCP-Firewalled bist. +.: Der neue UDP-Zustand wird im "Meine Info"-Feld des Server-Fensters angezeigt. Solange der UDP-Firewalltest nicht fertig ist, wird "unbesttigt" angezeigt. +.: Clients mit dem Kad UDP-Offen Zustand untersttzen nun direkte Callbacks (gestartet durch ein UDP Paket) um sich mit nicht-firewalled Clients zu verbinden. Diese Callbacks sind schneller, zuverlssiger und nutzen weniger Ressourcen als Buddies oder Server-Callbacks. +.: Der neue Firewall-Test korrigiert nun auch einen Fehler / Designschwche welcher dazu fhrte dass eMule immer des Clients Quell-IP-Port nutzte anstatt zu testen ob der intern gesetzte UDP-Port die bessere Wahl wre. Dies war vor allem bei "Restricted Cone" Routern mit PAT (Port Address Translation) ein Problem. + +----------------------- +- 29. November 2007 - +----------------------- +.: Korrektur eines Fehlers von u.U. einer falschen lokalen IP-Adresse wenn die "BindAddr" Option genutzt wurde +.: Korrektur eines Fehlers welche Details von markierten Freunden in der Freundesliste nicht aktualisierte + +----------------------- +- 24. November 2007 - +----------------------- +.: Korrektur eines Fehlers in Tooltips, welcher einige Inhalte teilweise in Fettschrift darstellte + +----------------------- +- 19. November 2007 - +----------------------- +.: Unicode-Untersttzung fr das "statische Server"-Feature hinzugefgt + +----------------------- +- 12. November 2007 - +----------------------- +.: Korrektur mehrerer Listenanzeigen in eMule um Windows' Kontextmens der Scrollbalken zu untersttzen +.: Option hinzugefgt (Optionen->Allgemein) um Windows daran zu hindern, in den Standbymodus zu wechseln whrend eMule luft (und etwas tut) + +----------------------- +- 11. November 2007 - +----------------------- +.: Korrektur eines Fehlers im IRC-Fenster, welcher die Kanal-Fenster in verkehrter Reihenfolge ffnete +.: Korrektur eines Fehlers welcher tote Server manchmal nicht aus der GUI entfernte [fox88]. +.: Korrektur eines Fehlers welcher auf einigen Windowssystemen die E-Mail Benachrichtigung deaktivierte [Lewpy] +.: Hinzugefgt: IRC-Warnungen und -Fehler werden im aktiven Kanal-Fenster angezeigt +.: Hinzugefgt: Privater IRC-Kanal wird automatisch aktiviert wenn Unterhaltung initiiert wird +.: Korrektur eines Fehlers mit extra groen Icons in den Dateitooltips +.: Korrektur eines Fehlers der bei HTTP-Downloads zu einem Crash bei voller Festplatte fhren konnte +.: Korrektur eines Speicherlecks bei fehlgeschlagenen "ge-gzipten" HTTP Downloads. + +----------------------- +- 07. November 2007 - +----------------------- +- Korrektur der Anzeige des HTTP-Statusfensters + +----------------------- +- 31. Oktober 2007 - +----------------------- +.: Das Nachrichtensystem ist jetzt in der Lage eure Freunde auch dann zu finden wenn ihre IP wechselte, solange alle Beteiligten 'Offen' mit Kad verbunden sind, also nicht 'Firewalled'. Dies ermglicht es, mit Freunden lnger als nur fr die jeweilige Session in Kontakt zu bleiben. (Funktioniert nur mit neu hinzugefgten bzw. neu gefundenen Freunden, die mit Kademlia verbunden sind) +.: Wenn einem Freund eine Nachricht geschickt wird, stellt eMule jetzt nach dem Verbinden sicher, dass der Userhash tatschlich bereinstimmt und SecureIdent benutzt wird (wenn aktiviert) um sicherzustellen, dass es sich auch wirklich um euren Freund handelt. + +----------------------- +- 28. Oktober 2007 - +----------------------- +.: Jetzt kann mit Angabe einer URL, welche auf eine nodes.dat verweist, mit dem Kademlia Netzwerk verbunden werden. (im Kademlia Reiter) + +----------------------- +- 22. Oktober 2007 - +----------------------- +.: Um Spamnachrichten zu reduzieren und somit das Nachrichtensystem wieder benutzbarer zu machen untersttzt eMule nun Captcha Authentifizierung. Wenn aktiviert muss jemand der euch eine Nachricht schicken will erst ein Captcha lsen (die Buchstaben aus einem Bildchen abschreiben) bevor die Nachricht bei euch angezeigt wird. +ltere Clients ohne diese Untersttzung fr Captchas knnen euch dann keine Nachrichten mehr schicken und erhalten eine dahingehende Rckmeldung. + +----------------------- +- 11. Juli 2007 - +----------------------- +.: Obfuskation zum Kad UDP Protokoll hinzugefgt. Kad Obfuskation ist Teil des Protokolls und unabhngig von den Einstellungen der Ed2K-Obfuskation. + +----------------------- +- 5. Juni 2007 - +----------------------- +.: Korrektur eines Fehlers, durch welchen Kad versuchte, seine Einstellungen vom ehemals gltigen config-Ordner zu laden. + +----------------------- +- 16. Mai 2007 - +----------------------- +- neue bersetzung hinzugefgt: Uyghur [von Abduqadir] + + + +0.48a +----------------------- +- May, 13. 2007 - +----------------------- +.: Happy Birthday eMule :) + +----------------------- +- May, 12. 2007 - +----------------------- +.: Fehlerkorrektur einiger Bugs in UPnP und etwas verndertes Verhalten fr ADSL-Gerte +.: Fehlerkorrektur eines Bugs beim doppelten Hinzufgen eines Freundes +.: Wenn eMule auf Vista mit Aero luft wird die "Zum Systemicon minimieren" bei Minimieren-Option standardmig aktiviert. Dies kann unter Anzeigeoptionen gendert werden + +0.48a BETA2 +----------------------- +- May, 08. 2007 - +----------------------- +Ornis: Der Installer setzt nun die richtigen Dateizugriffrechte fr die Config-Dateien +.: Fehlerkorrektur eines weiteren Bugs im Quellentausch [Xman1] +.: Sortieren nach kumulativen Eigenschaften wird nun von eMule nach einem Neustart richtig wiederhergestellt +.: Die "UDP deaktivieren" und das Aktivieren von Kad Optionen schlieen sich nun gegenseitig aus +.: IRC optionale Serverports sollten nur richtig funktionieren +.: Fehlerkorrektur eines Bugs im IRC beim empfangen von ED2k Links +.: Ein Excess-Flood Schutz fr eMule Antworten im IRC wurde hinzugefgt + +----------------------- +- May, 05. 2007 - +----------------------- +.: Das Spam-Indikator Icon wurde ausgetauscht [Icon von Daan] +.: Der Erste-Start Wizzard nutzt nun die richtigen Ports fr den UPnP test, falls diese vom Benutzer gendert wurden +.: Fehlerkorrektur das (Fehler-)Behandlung von Dateien deren Pathlnge das Systemlimit berschreitet +.: Wenn eMule den UPnP-Service startet, aber die Einrichtung der Port fehlschlgt, wird der Service von eMule danach wieder beendet +.: Eine Option um Smileys zu dekativieren wurde hinzugefgt +.: Ein kleines Speicherleck in den Simley-Auswahlfenstern wurde behoben + +0.48a BETA1 +----------------------- +- April, 29. 2007 - +----------------------- +.: Die "offizielle" Entwicklungsumgebung fr eMule ist nun VS2003 SP1. VS2002 wird nicht lnger untersttzt (sollte aber trotzdem funktionieren) + +----------------------- +- April, 28. 2007 - +----------------------- +.: Sorting in the ipfilter dialog has been fixed on Vista +.: Tooltips now have the proper size on Vista +.: All file related tooltips should look a bit nicer now (on all systems) +.: Added tooltips to the shared files list + +----------------------- +- April, 21. 2007 - +----------------------- +.: Sparse files have been disabled on Vista, due to a faulty / limited Vista implementation of them, which cannot be worked arround by eMule + +----------------------- +- April, 15. 2007 - +----------------------- +.: Ein Spamfilter fr suchergebnisse wurde hinzugefgt, der hauptschlich durch das ausfiltern von hnlichen Dateien, die vom Benutzer als Spam markiert wurden, funktioniert. +.: Spam-Suchergebnisse werden in Grau dargestellt und befinden sich immer am Ende der Liste +.: Spam-Suchergebnisse zhlen als max. 5 Quellen fr das 100 Quellen globale Suchlimit + +----------------------- +- April, 9. 2007 - +----------------------- +.: The default paddingsize for obfuscated TCP connections has been increased to 128 bytes (from 16) in order to be harder detectable by size pattern matchings +.: The paddinglength can be changed manually by adding "CryptTCPPaddingLength=[1-256]" into the eMule section in the preferences.ini + +----------------------- +- March, 12. 2007 - +----------------------- +.: eMule Unterstzt nun Mulit-Benutzer-Installationen, was insbesondere Rechteprobleme unter Vista lst. In Krze: Auf XP, 2000, 98, etc bleibt standardmig alles beim alten, unter Vista werden Benutzereigene Verzeichnise genutzt. +.: Die Einstellung fr die Art der Installation kann unter "Erweiterte Einstellungen" gendert werden + +----------------------- +- March, 11. 2007 - +----------------------- +.: In Vista wird das Limit fr Halb-Offene von eMule nun korrekt auf 9 gestellt (statt 50) + +----------------------- +- Feb, 20. 2007 - +----------------------- +.: Wenn "Automatischen Verbinden beim Start" aktiviert ist oder der Verbindenbutton gedrckt wurde und UPnP noch beschftigt ist, wartet eMule mit dem Verbinden. + +----------------------- +- Feb, 18. 2007 - +----------------------- +.: UPnP Unterstzung hinzugefgt [shareaza] +.: UPnP-Test button in den Erster Start-Wizzard eingefgt + +----------------------- +- Feb, 09. 2007 - +----------------------- +Ornis: Farsi bersetzung hinzugefgt [bersetzt von Mory Abdi & Ali Mojarad] +.: Die Berechnung der credits fr die ersten 9MB (weniger als ein teil) wurde etwas gendert um die Belohnung fr Clienten die weniger als ein Teil hochladen zu verringern + +----------------------- +- Jan, 20. 2007 - +----------------------- +.: Ein mit Obfuskation verbundener Bug im Quellentausch wurde behoben +.: Das Quellentauschprotokoll wurde gendert um Rckwrtkomptiblittsprobleme und andere Bugs in Zukunft zu vermeiden +.: Unterstzung fr Multiple-"Zugehrige Dateien"-Suchen wurde hinzugefgt [Serverseitige Implementation von Lugdunum] + +----------------------- +- Jan, 14. 2007 - +----------------------- +.: Ein Mglicher Crash im Statistikfenster wurde behoben +Ornis: bersetzung fr Valencian hinzugefgt [bersetz von "Valencian"] +Ornis: Grere berarbeitung der Slovenischen bersetzung [Gusar] +Ornis: Beschriftungen fr Kategorierreiter werden nun in der Kategorierfrabe dargestellt +Ornis: Rckkehr der Jedi.. contextmens fr Nachrichtenreiter + +----------------------- +- Jan, 5. 2007 - +----------------------- +.: Kad wurde fr Obfuskation-Untersttzung vorbereitet. Dies ist in dieser Version nur passiv. + +----------------------- +- Dec, 13. 2006 - +----------------------- +.: Ein Speicherleck in den list controls wurde behoben [eklmn] + +----------------------- +- Dec, 12. 2006 - +----------------------- +.: Fehlerkorrektur fr Performanceproblem bei zu groen ED2k-Links mit "Beaobachte Zwischenablage"-Funktion + +----------------------- +- Dec, 9. 2006 - +----------------------- +.: Verschiedene nderungen um eMule besser unter 640x480 Auflsungen laufen zu lassen + +----------------------- +- Dec, 6. 2006 - +----------------------- +.: Fehlerkorrektur der Speicherung und Wiederherstellung der Position/Gre des Kollektions-Dialogs +.: Win98: Fehlerkorrektur von fehlenden Volume-Lables und shell icons in der Verzeichnis-Eigenschaftenseite +.: Win98: Fehlerkorrektur von Mulitzeilen-Tooltip in der Traybar +.: Win98/WinME: Fehlerkorrektur von nicht untersttzter Toolbar-Personalisierung +.: Win98/WinME/Win2000: Fehlerkorrektur von toolbar chevron. +.: Win98/WinME: Fehlerkorrektur von vertikelen Achsenbeschriftungen im Statisikengraph. +.: Win98/WinME: Fehlerkorrektur fr speicher/wiederherstellen im von Items im Statistikbaum. +.: Win98/WinME/Win2000: Fehlerkorrektur fr unsichtbare Knpfe im Transferfewsnter +.: Win98: Fehlerkorrektur fr "ShowActiveDownloadsBold=1"-Option im Transferfenster + +----------------------- +- Nov, 22. 2006 - +----------------------- +.: Langzeit-Speicherverbrauch fr die GUI wurde reduziert +.: eMule speichert nun Hash von Hash in der cancelled met fr bessere Privatsphre + +----------------------- +- Nov, 21. 2006 - +----------------------- +.: Beide Fenster im Transerfenster zeigen nun toolsbars um den Inhalt auszuwhlen + +----------------------- +- Nov, 18. 2006 - +----------------------- +.: Edit controls im Nachrichten- und IRC-Fenster nutzen etwas grere Fonts + +----------------------- +- Nov, 17. 2006 - +----------------------- +.: Fehlerkorrektur eines Bugs im IRC-Fenster bei dem Namensnderungsnachrichten nicht immer gezeigt wurden +.: Fehlerkorrektur eines Bugs im IRC-Fenster bei URLs mit spezielle Zeichen am Ende + +----------------------- +- Nov, 15. 2006 - +----------------------- +.: Kleinere visuelle Verbesserungen fr IRC- und Nachrichtenfenster text format buttons +.: Multizeilen-Nachrichten im IRC-Fenster hinzugefgt +.: Kleinere visuelle im Kollektion-Dialog + +----------------------- +- Nov, 12. 2006 - +----------------------- +.: IRC Channel Filterung um die Netzwerklast zu reduzieren hinzugefgt +.: IRC-Fenster: Aktivitt wird nun auch im "Channels"-Fenster angezeigt +.: IRC-Fenster: Nicknamenliste zeigt die modes und namen + +----------------------- +- Nov, 11. 2006 - +----------------------- +.: Ein Bug beim Einzelklick auf das eMuleicon in der Traybar wurde behoben +.: Ein Bug beim Hinzufgen von Freunden aus IRC wurde behoben +.: Die eMule-Channelliste zeigt standardmig nun nur noch eMule-Hilfe channel +.: IRC Serveradressen knnen nun optional einen Port enthalten (getrent durch ':') +.: Fehlerkorrektur eines Bugs der Hintergrundfarbe bei farbigen Nachrichten im IRC +.: Titelfenster fr IRC Channel hinzugefgt + +----------------------- +- Nov, 9. 2006 - +----------------------- +.: Ein Smileyauswahl-Fenster wurde zum Nachrichten und IRC-Fenster hinzugefgt + +----------------------- +- Nov, 7. 2006 - +----------------------- +.: Fehlerkorrektur von nicht angezeigten IRC Notiz-Nachrichten +.: Fehlerkorrektur beim Nachrichten Fensterteiler + +----------------------- +- Nov, 6. 2006 - +----------------------- +.: Fehlerkorrektur beim IRC Fensterteiler + +----------------------- +- Nov, 5. 2006 - +----------------------- +.: Fehlerkorrektur von falschen Sortiereinstellungen bei neuen eMuleinstallationen +.: Fehlerkorrektur beim Verbinden zum IRC wenn der gewhlte Name schon genutzt wird +.: Fehlerkorrektur eines Bugs beim Wechseln von Fontsgren im IRC-Fenster + +----------------------- +- Nov, 1. 2006 - +----------------------- +.: Im IRC- und Nachrichtenfenster werden nun Simleays graphisch dargestellt [Simeys von Daan] +.: Die Autoscroll funktion in allen Logfenster wurde berarbeitet und deaktiviert sich whrend nicht das Ende des Fenster angezeigt wird +.: Fehlerkorrektur einiger Bugs im IRC Farbhandling +.: Fehlerkorrektur eines Bugs bei schwarzer Hintergrundfarbe im IRC Fenster +.: Skins: Ein Problem mit der Vordergrundskinfarbe in Richedit controls wurde behoben +.: Skins: Alle Icons knnen von allen Formaten gelesen werden die von GDI+ untersttzt werden (GIF, PNG, ...) + +----------------------- +- Oct, 26. 2006 - +----------------------- +.: Korrigiert: "exit" Kommandozeilenbefehl started eMule nicht mehr wenn es nicht bereits lief +.: Fehlerkorrektur beim behandeln von ED2k-Urls fr bessere Unterstzung beim Kopieren von URLs von Webseiten +.: Fehlerkorrektur eines Bugs in der Laufwerkspeicherplatz-Statistik bei pre-allocated Dateien +.: Fehlerkorrektur beim Nutzen des "ed2k::" Suchausdrucks zusammen mit anderen Attributen. Hinweis: "ed2k::" kann weiterhin nur fr ED2k-Suchen genutzt werden. +.: Fehlerkorrektur eines Bugs im lokalem Suchfilter beim Wechseln der Spalte +.: Fehlerkorrektur von Unicodestrings in Kategorieeigenschaften +.: Optionalen zeichnen von soliden Graphen im Statistikfenster hinzugefgt +.: Verschiedene Performanceverbesserungen und kleinere Fehlerkorrekturen im IRC-Modul + +----------------------- +- Sep, 23. 2006 - +----------------------- +.: Ein potentieller Crash beim Schlieen von eMule wurde behoben [DavidXanatos] + +----------------------- +- Sep, 21. 2006 - +----------------------- +.: Untersttzung fr RealMedia-Dateien zum "Content"-Dialog hinzugefgt (optional vorhandende MediaInfoLib wird nicht mehr fr RealMedia-Dateien genutzt) +.: Untersttzung fr Verffentlichung von Metadaten fr Realmedia-Dateien hinzugegt +.: Verschiedene Optimierungen fr Kad vorgenommen um Overhead und Speicher zu sparen + - Redunante Metadaten werden nicht mehr verffentlicht + - Dateiformat Metadaten werden nicht mehr explizit verffentlich und in speziellen Suchausdrcken behandelt + - Ungenutzte Daten vom Hello-Paket entfernt + +----------------------- +- Sep, 16. 2006 - +----------------------- +.: Fehlerkorrektur von unsichtbarem text im Suchfilter bei Hoch-KOntrast Farbschemen +.: Taskbar Benachrichtigung: Untersttzung fr Aplha-Channel Hintergrundbilder +.: Taskbar Benachrichtigung: nderungen in notitfier.ini whrend eMule luft werden automatisch ohne Neustart eingelesen +.: Unicode-Unterstzung fr id3lib hinzugefgt + + +v0.47c Hotfix +----------------------- +- Sep, 14. 2006 - +----------------------- +.: Einige grere Bugs im Kad 2.0 Quellen/Schlsselwort-Publishing wurden behoben + +----------------------- +- Sep, 13. 2006 - +----------------------- +.: Ein Bug beim verarbeiten von Kad1.0-Paketen, von dem wir annehmen das er von auen ausgenutzt werden kann und daher ein potentielles Risiko darstellt wenn Kad aktiviert ist [entdeckt von tHeWiZaRdOfDoS] +.: Ein Fehler beim speichern der Einstellungen fr einen deaktivierten UDP-Port wurde behoben +.: Ein Bug im First Runtime Wizzard der den UDP port deaktivierte wurde behoben +.: Mehr Kontrollen fr Kad-Pakete wurden hinzugefgt so dass alle unangeforderten Antworten ignoriert werden + +----------------------- +- Sep, 11. 2006 - +----------------------- +.: Ein Speicherleck in einem Fehlerhandler wurde behoeben [tHeWiZaRdOfDoS] +.: Das lesen von "addresses.dat" und "shareddir.dat" Dateien wurde verbessert um Leerzeichen und leere Zeilen zu ignorieren +.: Ein Bug bei der Warnung vor falschen Dateiendungen, der auftreten konnte wenn mehrer Dateien markiert waren wurde behoben + +0.47b +----------------------- +- Sep, 7. 2006 - +----------------------- +Ornis: Fortschrittsanzeige zur Archivdurchsuchung hinzugefgt (bei Live Archivvorschau) + +----------------------- +- Sep, 5. 2006 - +----------------------- +.: eMule achtet darauf dass die zufllig gewhlten Ports nicht bereits belegt sind +.: Ein mgliches Problem beim Suchen von Kad-Buddies wurde behoben [DavidXanatos] +.: Ein kleiner Bug im Sanitycheck fr bestimmte Kadantworten wurde behoben [WiZardofDoS] + +----------------------- +- Sep, 1. 2006 - +----------------------- +.: mehrere Optimierungen fr IP-Filterung in Kad. +.: Fehlerkorrektur bzgl. Senden falscher Kad 1.0 Kommentar-Pakete +.: Korrektur eines Fehlers, welcher MiniMule nicht ffnen lies, wenn eMule in ein Verzeichnis mit Sonderzeichen installiert wurde. + + +0.47b BETA1 +----------------------- +- Aug, 31. 2006 - +----------------------- +.: Korrektur eines Fehlers beim Verbinden zu einem gewhlten Server - wenn dieser nicht rechtzeitig antwortet versucht eMule nicht mehr, sich zu anderen Servern zu verbinden. +.: Korrektur eines Fehlers, welcher auftrat, wenn ED2K UDP Pakete von einem Client empfangen wurde, welcher sich hinter einem UDP portmapping router befindet. +Ornis: Vietnamesische bersetzung von Paul Tran HQ Loc hinzugefgt + +----------------------- +- Aug, 26. 2006 - +----------------------- +Ornis: Anzeige des Dateityps im Dateidetail-Dialog hinzugefgt. Fr die meist verbreiteten Formate wird der heruntergeladene Dateikopf geprft und mit der Dateiendung verglichen. Ein Warnicon erscheint, wenn die Endung zu einem anderen Format gehrt. +Ornis: Korrektur eines Fehlers im Webinterface beim Bannen von IPs nach zu vielen fehlerhaften Loginversuchen [thx DreamWalker] + +----------------------- +- Aug, 24. 2006 - +----------------------- +.: Bei einer KAD-Suche nach Kommentaren weist nun ein entsprechendes Icon (am Platz des Bewertungsicons) auf die aktive Suche hin. + Der Knopf um in Kad nach Kommentaren zu suchen ist deaktiviert solange eine Suche aktiv ist. + +----------------------- +- Aug, 21. 2006 - +----------------------- +.: Korrektur mehrerer mglicher Speicherlecks [WiZardofDoS] +.: Bei einer neuen Installation von eMule werden nun Zufallsports (TCP/UDP) ausgewhlt, anstatt der Standardports 4662 and 4672. Die Ports werden bei existierenden Installationen nicht gendert (und bleiben auch nach Neustarts). Die Hilfedateien werden entsprechend aktualisiert. + +----------------------- +- Aug, 20. 2006 - +----------------------- +.: Korrektur einer fehlenden IP-Filter-Prfung fr ausgehende UDP Pakete von KAD / KAD Knoten [leuk he] +.: Eingehende ED2K UDP Antwortpakete werden jetzt ignoriert wenn sie nicht angefordert wurden. +.: Eine Option zum An- und Ausschalten des MiniMule wurde zur Hauptseite des Optionsdialoges hinzugefgt. +.: (sehr seltener) potentieller Integerberlauf wurde korrigiert, der Probleme bereiten konnte, wenn sehr groe Dateien heruntergeladen wurden. [avi-3k] + +----------------------- +- Aug, 17. 2006 - +----------------------- +.: Korrektur eines potentiellen Fehlers in TryToConnect (verfrhtes Send) [eklm] +.: Server, welche von anderen Clients oder Servern geschickt wurden erhalten nun standardmig die niedrige Prioritt +.: Server werden nun mit dem IPFilter verglichen, auch wenn sie bereits in der Serverliste waren (im Gegensatz zum Prfen von nur neu hinzugefgten Servern) [BlueSonicBoy] + +----------------------- +- Aug, 15. 2006 - +----------------------- +.: berarbeitung des Dateikommentar-Fensters: Bewertungsicons, Netzwerkinformation und sortierbare Kommentarliste hinzugefgt. + +----------------------- +- Aug, 12. 2006 - +----------------------- +Ornis: 2 Fehlerkorrekturen im Statistikfenster, wenn der vertikale Splitter (Fensterteiler) nach ganz links oder recht bewegt wurde. [BlueSonicBoy] +Ornis: Korrektur eines Fehlers in der Transferliste der Weboberflche, bei Dateien mit Apostroph (fhrte zur fehlendem Javascript Popupmen) + +----------------------- +- Aug, 5. 2006 - +----------------------- +Ornis: Live-Vorschau fr ZIP,RAR und ACE-Archive implementiert. Die Seite "Inhaltsangabe" des Dateidetails-Dialoges (Tempdateien & freigegebene Dateien)) listet den Inhalt des Archivs auf (Dateinamen & -pfade, Dateigren, CRC,...) und Archivangaben wie vorhandener Passwortschutz und weitere Attribute... + Vollstndigkeit dieser Liste hngt vom Downloadstatus ab. Heruntergeladene Bereiche werden gescannt und das ZIP-Zentraldirectory wird ausgelesen sofern bereits heruntergeladen (Dateiende). +Ornis: Hinzugefgt: Archivwiederherstellung fr ACE-Archive. (Wie bereits fr ZIP & RAR: es wird eine Version des Archivs erstellt, welches nur die bereits komplett verfgbaren (heruntergeladenen) Dateien enthlt.) + Einige Korrekturen bei Archivwiederherstellungen, inklusive Lschen einer zustzlichen Tempdatei, wenn Wiederherstellung fehlschlug. +Ornis: Verbesserung der Verarbeitung von eingefgten Links in den Ed2k-Link-Dialog, wenn diese Leerzeilen und Whitespaces enthalten [zoom] + +----------------------- +- Jul, 26. 2006 - +----------------------- +.: Obfuskation (Protokoll-Verschleierung) fr ED2K/Kad TCP, ED2K UDP, Server TCP und Server UDP Verbindungen implementiert. Kad UDP ist noch nicht verschleierbar (obfuskierbar) . Fr eine detaillierte Erklrung dieses Features, siehe folgende Seite unserer Onlinehilfe: http://www.emule-project.net/home/perl/help.cgi?l=2&rm=show_topic&topic_id=848 +.: Einstellungsdialog: die Sicherheitsoptionsseite wurde geteilt und enthlt nun auch Einstellungen zur Obfuskation. Einstellungen zu Kommentaren und Nachrichten haben nun eine eigene Seite. + +----------------------- +- Jun, 24. 2006 - +----------------------- +zz: Verbesserung in der Chunkauswahl des Downloads: starke Verbesserung fr sehr seltene Dateien (weniger als 5 Quellen), und auch Verbesserungen fr normale Dateien und Vorschau-Chunks + +----------------------- +- Jun, 21. 2006 - +----------------------- +.: Untersttzung der MediaInfoLib v0.7.1+ hinzugefgt + +----------------------- +- Jun, 7. 2006 - +----------------------- +.: Korrektur eines Fehler in der Funktion zum Aufrufen des Standardplayers in der Vorschaufunktion - die Standardanwendung wurde fr manche Dateitypen nicht gestartet. +.: Option hinzugefgt, um die Vorschau-Kommandozeile anzugeben. + +----------------------- +- Jun, 6. 2006 - +----------------------- +.: Korrektur eines Fehler beim Umbenennen von Dateien in der Liste freigegebener Dateien [SiRoB] + +----------------------- +- Jun, 4. 2006 - +----------------------- +.: Korrektur eines Fehlers, der u.U. zu Dateikorruption fhren konnte, wenn eMule als 'sicherer Benutzer' lief und ein Systemlogoff/Reboot stattfand. + +----------------------- +- May, 31. 2006 - +----------------------- +.: Fehlerkorrektur im Verbindungsmanagement. + +----------------------- +- May, 29. 2006 - +----------------------- +.: zustzliches Informationsfenster im MediaInfo-Dialog berarbeitet. + +----------------------- +- May, 26. 2006 - +----------------------- +.: Mediainfo-Dialog (Inhaltsinformation) zeigt Hinweis fr Dateien, welche mit DRM geschtzt sind. +.: Korrektur eines Fehlers im Mediainfo-Dialoges (Inhaltsinformation) fr manche Tempdateien beim Abfragen von AVI-Eigenschaften +.: Hinzugefgt: Workaround fr den Mediainfo-Dialog hinzugefgt, um verlsslichere Angaben zur Spieldauer bei MPEG Datei zu machen, wenn die MediaInfoLib benutzt wird. + +----------------------- +- May, 21. 2006 - +----------------------- +.: Hinzugefgt: Suchergebnis-spezifisches Men (achte auf den Titel ber der Suchergebnislist!) fr folgende Funktionen: +- spezifiziere das Format/Einheit fr Angaben der Dateigre der Suchresultate (KB = zeigte Gren in Kilobyte im selben Format wie der Windows Explorer, MB = zeigt Gren in Megabyte, Voreinstellung = freier Stil) +- Suchergebnisfilter zurcksetzen + +----------------------- +- May, 17. 2006 - +----------------------- +.: Korrektur eines Fehlers in der "Suche" Funktion wenn fr nicht-Dateinamenfelder benutzt. + +----------------------- +- May, 16. 2006 - +----------------------- +.: Hinzugefgt: Einfacher On-the-fly Filter fr Suchergebnisse um die erhaltenen Resultate zu filtern. + Der Filter wird automatisch angewendet, wenn bei Tippen in der Filtereingabe pausiert wird. + Alle mit Leerzeichen getrennten Terme werden mit UND verbunden ausgewertet. Akzeptierte Suchergebnisse + mssen also diese Zeichenketten im Dateinamen enthalten, + Terme mit vorangestelltem '-' (Negativ-Filter) drfen darin nicht vorkommen. + Beispiel: -xyz -abc cool file + Dies wird nur noch die Sucheintrge angezeigt lassen, welche die Wrter "cool" und + "file" enthlt, aber weder "xyz" noch "abc". + +----------------------- +- May, 13. 2006 - +----------------------- +.: Kontextmen von Suchergebnis-Reitern bietet nun die Option an, alle benutzen Suchparameter dieser Suche wiederherzustellen + +----------------------- +- May, 12. 2006 - +----------------------- +.: Server Infoanzeige zeigt die mit Zeitangabe versehene "Verbunden mit..." Nachricht vor der Server-Info-Nachricht. +.: Korrektur eines Fehlers im Server UDP-Socket bzgl ignorierter empfangener Server Statistiken von dynIP-Servers. +.: Korrektur eines Fehlers im Server UDP-Socket bei der Behandlung von DNS Anfragen und ausgehenden UDP Paketen (fr dynIP-Server). +.: Server knnen aus der Serverliste mit Strg+X "ausgeschnitten" werden + +----------------------- +- May, 11. 2006 - +----------------------- +.: IP-Filter: dynIP-Servers werden nicht mehr abgewiesen wenn die Sicherheits-Option "Server anhand der IP filtern" aktiviert ist. Sie werden evtl gefiltert nachdem der DN aufgelst wurde. +.: IP-Filter: Nicht-dynIP-Server und dynIP-Servers mit bereits bekannter IP werden gefiltert wenn die IP-Filterliste oder eine entsprechende IP-Filter-Option gendert werden. +.: Korrektur eines Fehlers im Webinterface bzgl. Serversortierung und dynIP-Servern. +.: Korrektur eines Fehlers mit ed2k-Server-URLs und dynIP Servern +.: Korrektur eines Fehlers beim automatischen Serververbindens, welcher dazu fhren konnte, dass zu keinem Server verbunden wurde. +.: Korrektur mehrerer Fehler bzgl. doppelter DynIP-Servereintrge in Serverliste + +----------------------- +- May, 8. 2006 - +----------------------- +.: Fehlerkorrektur einiger Unicode Fehlermeldungen [Xman1] +.: Korrektur eines Fehlers bzgl. nicht fertigstellbarer Dateien aufgrund ungltigen Dateinamenprefixes + +----------------------- +- Apr, 27. 2006 - +----------------------- +Unk: Korrektur eines Absturzfehlers in Kad [Hinweis von Ani] + +----------------------- +- Apr, 10. 2006 - +----------------------- +.: Korrektur eines GUI-Problems in der Download-Fortschrittsanzeige fr Cients [SiRoB] + +----------------------- +- Apr, 1st 2006 :-> +----------------------- +.: Korrektur eines Fehlers bzgl. erneut heruntergeladener und erneut freigegebener Dateien. +.: Korrektur eines Fehlers bzgl. "Zusammenfassung nicht aktualisiert, nachdem eine freigegebene Datei gelscht wurde" [raccoon.i] +.: Hinzugefgt: preferences.ini Einstellung: "UserSortedServerList=1". Wenn aktiviert, wird beim Verbinden zu Servern die selbe Reihenfolge angewendet wie in der GUI dargestellt. + +----------------------- +- Mar, 26. 2006 - +----------------------- +.: Korrektur eines Fehlers, welcher eMule von minimiert in den Vordergrund holte, wenn eine Chatnachricht empfangen wurde [raccoon.i] +.: Korrektur eines Win2K-spezifischen GUI Problems bei den Suchergebnissen + +----------------------- +- Mar, 25. 2006 - +----------------------- +.: Korrektur einiger Icon Ressource-Lecks +.: Korrektur eines Fehlers beim Wechseln des Windows Farbeschemas whrend der Laufzeit und fr das Schema "Hoher Kontrast" +.: Korrektur eines Fehlers bzgl. ausgetauschter Bewertungs-Strings [Aenarion[ITA]] +.: Korrektur fehlender Eintrge im Verbindungsassistenten [FrankyFive] +.: Korrektur eines Fehlers im Webinterface bei Dateien >4GB [zAxel] +.: Korrektur eines Fehlers im Webinterface in Verbindung mit HTTP Fehlerantwort. + +----------------------- +- Mar, 9. 2006 - +----------------------- +Unk: Schlsselwortsuche fr Kad2.0 mit Kad1.0 Integration funktioniert. +Unk: Korrektur eines u.U. auftretenden Speicherlecks in Kad + +----------------------- +- Mar, 4. 2006 - +----------------------- +Unk: Schlsselwort speichern Kommentar Suche fr Kad2.0 mit Kad1.0 Integration funktioniert. Kad2.0/1.0 Integration fertig. + +----------------------- +- Feb, 4. 2006 - +----------------------- +Unk: SMIRC untersttzt nun Farben (BlueSonicBoy-TK4) +Unk: Fix: GetClosestTo gab nicht die Anzahl der gewnschten Resultate zurck (tatikiran) +.: Korrektur eines Absturzfehlers in Verbindung mit MiniMule +.: Quellcode fr VS2005 portiert +.: Mehrere Laufzeit-Performanceverbesserungen fr 64bit-Arithmetik +.: Korrektur eines Fehlers bei groen Suchergebnismengen + +----------------------- +- Jan, 29. 2006 - +----------------------- +Unk: Beginne Kad2.0 mit Kad1.0 Integration... Hello Pakete, Knotensuche, BootStraps, Quellen Speichern/Suchen, Kommentare speichern fertig. + + + +0.47a +----------------------- +- Jan, 25. 2006 - +----------------------- +Unk: Ein Bug bei Kad whrend des Suchens eines Buddy wurde korrigiert [leuk_he] +.: Ein Problem welches known2_64.met korrupiert wenn die "Merke heruntergeladene Dateien"-Funktion abgeschaltet ist wurde behoben + +----------------------- +- Jan, 24. 2006 - +----------------------- +.: Statistik der gebannten Benutzer wurde korrigiert [Xman1] +.: Statistik der kumulaitven bertragenen Daten wurde korrigiert [TimDzang] +.: Die Menge der bertragenden Daten wird nun wieder in der komplett-Spalte angezeigt wenn die bertragen-Spalte nicht sichtbar ist +.: Statistik fr IP-Filter wurde korregiert +.: Mgliches (kurzzeitiges) Einfrieren der GUI whrend der Allokation von Speicherplatz wurde fr Part-Dateien wurde behoben + + +0.47a BETA2 +----------------------- +- Jan, 23. 2006 - +----------------------- +.: Clients die gefilterte Nachrichten senden wurden nun auch als Spammer erkannt +.: Ein Bug mit HTTP/Peercache-Quellen wurde behoben (SiRob) +.: Ein Problem beim konvertieren der known2.met wurde behoben, Datei sollten nun nicht erneut gehasht werden beim Upgrade + +----------------------- +- Jan, 21. 2006 - +----------------------- +Unk: Arbeit an Kad2.0 fortgesetzt +Unk: Einige kleine Verbesserungen fr Kad1.0 +Unk: Korrektur der LPhant Versionsanzeige +Unk: Kad Konfigurationsdateien werden nicht mehr von lteren eMule versionen gelesen + +----------------------- +- Jan, 20. 2006 - +----------------------- +.: Ein Bug beim Laden der part.met Datei von groen Datein wurde behoben +.: Das Protocol wurde gendert um den Hash und Dateigre bei angefragten Dateien kontrollieren statt nur den Hash + + +0.47a BETA1 +----------------------- +- 15. Januar 2006 - +----------------------- +Unk: Arbeiten an Kad2.0 begonnen. Die Idee ist es, das Protokoll zu verbessern und einige neue Funktionen hinzuzufgen. Diese Version wird das neue Protokoll enthalten (aber nicht aktiv nutzen). Die nchste Version wird eine Option bereitstellen um zwischen Kad and Kad2.0 zu wechseln +.: Komplette Dateien knnen jetzt auch via Kontextmen von der Transferliste entfernt werden +.: MobileMule Protokoll fr groe Dateien aktualisiert + +----------------------- +- 14. Januar 2006 - +----------------------- +.: Clients, welche als Spammer identifiziert werden, werden jetzt gebannt anstatt nur deren Nachrichten zu ignorieren + +----------------------- +- 11. Januar 2006 - +----------------------- +Unk: Korrektur: Vermeidung dass ein Schlsselwort einer nicht freigegebenen Datei publiziert wird + +----------------------- +- 8. Januar 2006 - +----------------------- +.: Untersttzung fr groe Dateien hinzugefgt. Die neue Obergrenze fr Dateigren welche eMule erlaubt und verarbeitet ist jetzt 256GB (vorher 4GB) +.: es gelten folgende Kompatibilittseigenheiten: + - groe Dateien knnen nur von Clients gefunden, heruntergeladen und hochgeladen werden die dies untersttzen (gegenwrtig nur eMule v0.47a und hher) + - Kollektionen mit groen Dateien knnen nicht mehr von Clients gelesen werden welche groe Dateien nicht untersttzen + - part.met Dateien von groen Dateien knnen nicht mit alten eMuleversionen oder ed2k-Tools benutzt werden + - Wenn eine groe Datei freigegen wird oder bekannt ist, ist die known.met nicht mehr kompatibel zu lteren eMuleversionen + - Known2.met wird konvertiert zu Known2_64.met welche nicht von alten eMuleversionen benutzt werden kann +Unk: Kad aktualisiert um mit groen Dateien umgehen zu knnen + - ltere Clients knnen nicht Schlsselworte groer Dateien indeziert. Das bedeutet, dass Schlsselwort Resultate bei groen Dateien nicht gut funktioniert bis ein Groteil des Kadnetzes die neue Version benutzt. + +----------------------- +- 30. Dezember 2005 - +----------------------- +.: "Zum Systemicon minimieren" zum Systemmen hinzugefgt + +----------------------- +- 26. Dezember 2005 - +----------------------- +.: Korrektur einer falschen "Download Zeit", welche fr pausierte Dateien gemeldet wurden + +----------------------- +- 24. Dezember 2005 - +----------------------- +.: Korrektur eines Fehlers in der Prioritteneinstellung von statischen Servern, welche nach einem Neustart verloren gingen +.: Hinzugefgt: Durchlaufen der eMule-Hauptfenster mit Strg-Tab bzw. Shift+Strg+Tab + +----------------------- +- 17. Dezember 2005 - +----------------------- +.: Korrektur eines Problems mit freigegebenen Dateien mit ungltigem Dateidatum [thx Kro/MorphXT] + +----------------------- +- 3. Dezember 2005 - +----------------------- +.: Proxyuntersttzung: mehrere Optimierungen fr die Proxyuntersttzung +.: Proxyuntersttzung: Der Eintrag "Proxy/ShowErrors" in der preferences.ini hat keine Bedeutung mehr, da alle Proxyfehler jetzt als Teil der regulren Verbindungsfehlermeldungen fr Server und Clients angezeigt werden. +.: Proxyuntersttzung: Fehlerkorrektur in der SOCKS 5 Authentication. +.: Proxyuntersttzung: Untersttzung fr HTTP/1.0 proxies hinzugefgt, welche Proxy overhead sparen. Tipp: Wenn du einen HTTP proxy benutzt, sollte HTTP/1.0 benutzt werden, es sei denn HTTP/1.1 muss benutzt werden. + Die Reihenfolge der Proxy Protokoll Performance: + 1. SOCKS 4a (hchste Performance da geringster Overhead) + 2. SOCKS 4 + 3. SOCKS 5 + 4. HTTP/1.0 + 5. HTTP/1.1 (geringste Performance, da am meisten Overhead) +.: Beschleunigen des Ladens von groen IP-Filterlisten + +----------------------- +- 30. November 2005 - +----------------------- +zz: Option, um eMule einen hher auflsenden Timer nutzen zu lassen (hhere Przision fr Sleeps und einige Timer). Nutzung auf eigenes Risiko. :) Zum Aktivieren, trage in die preferences.ini in die Sektion "[eMule]" ein: "HighresTimer=1" + +----------------------- +- 26. November 2005 - +----------------------- +.: nderung der Suchfunktion im IP-Filter Dialog: Wenn nach einer IP in der "Start" Spalte gesucht wird, wird der "Bereich" gesucht in welchem die IP enthalten ist. Tipp: Auf diese Weise kann geprft werden, ob eine gegebene IP durch die Liste geblockt wird. +Ornis: Importer fr begonnen Downloads kann nun auch (ed2k)Shareaza Tempdateien einlesen [von David Xanatos] + +----------------------- +- 24. November 2005 - +----------------------- +.: Hinzugefgt: "BindAddr=" Einstellung in der preferences.ini , um eD2K/Kad+WebServer Sockets an eine bestimmte IP Adresse zu binden +.: Korrektur eines Fehlers bzgl. "minimiert Starten" und "zum Systemicon minimieren". +.: Hauptfenster kann nun auch wiederhergestellt werden, indem auf die Titelzeile des MiniMule doppelgeklickt wird. +.: Die "Enter"-Taste kann nun in Listen (Listviews) benutzt werden, um die Hauptaktion fr die ausgewhlten Eintrge auszufhren. + +----------------------- +- 20. November 2005 - +----------------------- +Unk: Bereinigung des SMIRC Codes +1) Codeformatierung vereinheitlicht +2) Nahezu komplettes Neuschreiben im Kerncode, um die folgenden Probleme zu beseitigen: +. eine nderung in den Default-Einstellungen veranlasste SMIRC nicht dazu, eine Aufforderung zum ndern des Default-Nicks anzuzeigen +. manche Nutzer konnten nicht sehen was sie tippen +. Channel Modes wurden in vielen Fllen nicht korrekt gehandhabt +. Senden von neuen Channel Modes vom Tabmen sendete oft nicht korrekte Modes +. Sortieren von Nicks in einem Raum funktionierte nicht richtig +. Notices wurden manchmal nicht korrekt verarbeitet +. Ping/Pong zwischen Nutzern funktionierte nicht +. Serverfilter-Option in den Einstellungen konnte nicht entfernt werden + +----------------------- +- 14. November 2005 - +----------------------- +Unk: Bereinigung des Kad Codes +1) Codeformatierung vereinheitlicht +2) Entfernung einiger ungenutzter Methodenparameter und -variablen. +3) Versuch einigen Code zu optimieren +4) Korrektur eines mglichen Problems, dass wenn das Ziel beim ersten Versuch gefunden wurde, kein Request/Store gesendet wurde +5) Hinzufgen von Codekommentaren fr besseres Verstndnis (wird langsam fortgefhrt wenn je beendet) +6) Sicherheitsprfung fr Schlsselwortresultate wieder eingefgt +7) Korrektur eines Problems mit nicht vereinten Zonen wenn die Kontaktzahl gering wurde [Danke an Kry] +8) gendert, wie Kontakte als aktiv gefhrt werden, um die Kontaktlist aktueller zu halten mit weniger CPU Last +9) Anpassungen bei Aufrufen vom Jumpstart, um CPU Last zu verringern +10) Anpassung in Nutzerzhlung um Firewalled Nutzer mit einzubeziehen + +----------------------- +- 13. November 2005 - +----------------------- +.: Codebereinigungen und Performanceoptimierungen bzgl. 16Bit Integer Nutzung +.: E-Mail Benachrichtigung fr nicht-XP-SP2 Systeme deaktiviert, wenn gebaut mit ATL 7.1 +.: das "Suchen"-Kommando nun zu allen Listen hinzugefgt (Tastenkrzel: Strg+F=neue Suche, F3=Weitersuchen, Shift+F3=voriges suchen) + +----------------------- +- 5. November 2005 - +----------------------- +.: Untersttzung fr geRARte IP-Filterlisten hinzugefgt. Downloade UNRAR.DLL von http://www.rarlab.com und kopiere sie in das eMule Installationsverzeichnis. +.: Untersttzung fr geRARte Skin-Profile hinhzugefgt. (wie mit geZIPten Skin-Profilen, knnen heruntergeladene geRARte Skin-Profile direkt von der Liste freigegebener Dateien ber "Installiere eMule-Skin" im Kontextmen angewendet werden. ) +Unk: Verringerung der CPU-Last im Routing von KAD. [Kry] + +----------------------- +- 30. Oktober 2005 - +----------------------- +.: Korrektur eines Fehlers in der IP-Filter-Combobox im Einstellungsdialog "Sicherheit" - welche alle Eintrge verlieren konnte. +.: Hinzugefgt: berprfung heruntergeladener IP-Filter Dateien, um Dateien ohne IP Filter zu erkennen (zB. tote URLs). +.: ein ZIP mit IP-Filter muss eine Datei (mit den Filtern) namens "guarding.p2p" oder "ipfilter.dat" enthalten. Alle anderen Dateien im ZIP werden ignoriert. + +----------------------- +- 15. Oktober 2005 - +----------------------- +Ornis: Option, Tempfiles mit der Endgre anzulegen (wenn erste Daten empfangen werden) (erweiterte Einstellungen) +Ornis: Systray-Icon blinkt mit Nachrichten-Icon, wenn eine neue Nachricht (Nachricht, (noch) nicht IRC !) bereit liegt. Zu aktivieren in der preferences.ini (Sektion "eMule" setze "IconflashOnNewMessage=1") + +----------------------- +- 8. Oktober 2005 - +----------------------- +.: Media Info Dialog zeigt nun auch Informationen ber zustzliche Audio/Video/Untertitel-Streams. (nutze MediaInfo DLL (http://mediainfo.sourceforge.net/) um diese Untersttzung fr nicht-AVI Dateien zu erhalten). +.: MP3 Dateien mit variabler Bitrate und Xing-VBR frame werden mit der durchschnittlichen VBR Bitrate gemeldet und verffentlicht. + +----------------------- +- September, 30. 2005 - +----------------------- +.: Die Speicherverwaltung fr kleine Blcke wurde optimiert +.: Zustzliche Sicherheitschecks beim verarbeiten von hello Paketen [thx Kry] + +----------------------- +- September, 29. 2005 - +----------------------- +.: Der Dateidetail-Dialog zeigt die akkumulierte verbleibende Gre wenn mehrere Dateien selektiert sind + +----------------------- +- September, 26. 2005 - +----------------------- +.: Ein Bug im 'Ext' Kommando der 'PreviewApps.dat'-Datei wurde behoben + +----------------------- +- September, 25. 2005 - +----------------------- +.: Untersttzungen fr ED2KServer-Dateibewertungen in den Suchergebnissen wurde hinzugefgt. Empfangene Bewertungen werden als zustzlichen Icon wie im Downloadfenster gezeigt. +.: Ein Bug durch den beim Doppelklicken auf das Bewerungsicon sich nicht immer die Bewerungs-Dialogseite ffnete wurde behoben +.: Ein Bug mit den Eigenschaften-Seiten, die nicht immer korrekt wiederhergestellt wurden wurde behoben + +----------------------- +- September, 24. 2005 - +----------------------- +.: Die Bedeutung des "Abbrechen"-Suchbuttons wurde etwas verndert: Es bricht nun nur die aktiven Suchen ab, dessen Ergebnisseite aktiv ist. + Damit kann nun eine Kad-Suche abgebrochen werden ohne das Ergebnis zu lschen + +----------------------- +- September, 20. 2005 - +----------------------- +.: Fliekommazahl-Untersttzung fr Suchen nach Attributen in der GUI und den Metadaten wurde hinzugefgt (z.B. @size<1.23g) +.: Gre-, Verfgbarkeits-, Komplette Quellen-, Bitrate und Lnge-Suchattribute knnen in der GUI-Suche genauso genutzt werden wie in der eMule-Suche (siehe dort) + + +----------------------- +- September, 19. 2005 - +----------------------- +.: Eine neue Methode Metadaten von AVI/WAV Dateien zu extrahieren ohne DirectShow-Filter zu nutzen wurde hinzugefgt + + +----------------------- +- September, 13. 2005 - +----------------------- +.: "Exakte Phrasen"-Suche fr Kad-Suchen wurde hinzugefgt (z.B. "dies das" statt dies das) - nur neue Kad-Knoten knnen diese korrekt verarbeiten +Ornis: Webinterface: Eine Fehler im Informations-Popup fr Uploadzeiten wurde behoben + +----------------------- +- September, 12. 2005 - +----------------------- +.: Die eMule-Suchfunktion wurde berarbeitet und bietet viele neue Funktionen wie z.B. "-" als nicht ("dies -das"). Eine detailierte Erklrung ist (bald) in der (Online)Hilfe zu finden + +----------------------- +- 11. September 2005 - +----------------------- +.: Suchausdrcke Bume wurden optimiert, um die CPU Last fr Server und Kad Knoten beim Auswerten des Baumes zu verringern (weniger Rekursionen). + +---------------------- +- 9. September 2005 - +---------------------- +.: Korrektur eines Problems mit dem Indikator aktiver Kad-Suchen, welcher zu frh deaktiviert wurde. +.: Hinzugefgt: "exakter String" Suche fr ED2K Suchen (Strings in Anfhrungszeichen werden an den Server unverndert bermittelt) +.: Meta-Daten Suche dem Suchausdrucksparser hinzugefgt +.: Boolean Suchausdrucksparser berarbeitet: Implizite ANDs mssen nicht mehr angegeben werden (zB. "a AND (b OR c)" kann nun angegeben werden als "a (b OR c)") + +---------------------- +- 4. September 2005 - +---------------------- +.: String file format meta Tags werden nicht mehr an eserver und eMule Clients gesendet um Bandbreite einzusparen [thx lugdunum] +.: Senden von neuen Integer Dateitypen Metatags hinzugefgt , fr eserver um Bandbreite zu sparen [thx lugdunum] +.: verfgbare 'Komplett' Info wird nun korrekt in Suchresultaten angezeigt, wenn die Freigaben von anderen Clients abgefragt werden. +.: verfgbare 'Komplett' Info wird nun korrekt fr Dateien <9280000 bytes in den Suchergebnissen fr Kad-Suchen angezeigt. +.: "Suche zugehrige Dateien" dem Kontextmen der Downloadliste hinzugefgt. +.: Korrektur: Menge der bertragenen Daten fr eine Quelle wird nicht lnger in der "Fertiggestellt"-Spalte sondern in der "bertragen"-Spalte angezeigt + +---------------------- +- 30. August 2005 - +---------------------- +Unk: unbenutztes Tag aus dem Login-Anfrage Paket entfernt [Avi-3k & Lug] +Unk: Korrektur: Wenn ein sehr populrer Server online kommt, erhielt er nun nicht mehr alle 4h einen groen Ping-Ansturm. [Lug] +Unk: Ablegen von Dateibewertungen in Servern [Lug] +Unk: wir senden nicht mehr FT_FILEFORMAT Tabs an Server [Lug] +Unk: Korrektur einiger falsch geformter Strings in MIRC [Avi-3k] + +---------------------- +- 18. August 2005 - +---------------------- +Ornis: bersetzung Maltese hinzugefgt [by Reuben] +Ornis: Korrektur eines Grafikfehlers in der Serveransicht (Log-Reset-Knopf nach Sprachwechsel; verhinderte minimierbares Log und Chat-Fenster) + +---------------------- +- 8. August 2005 - +---------------------- +Ornis: Korrektur eines Absturzes beim Klick aufs Systray-Icon (konnte unter seltenen Momenten auftreten, u.a. wenn der Rechner stark ausgelastet war) + +---------------------- +- 1. August 2005 - +---------------------- +Ornis: Ukrainische bersetzung hinzugefgt [von Kex] + +---------------------- +- 29. Juli 2005 - +---------------------- +Unk: Korrektur: "ffne Verzeichnis" (Avi-3k) +Unk: Korrektur: ClientCredit debug mode (Avi-3k) +Unk: Korrektur: DownloadListen Soriterfehler (Avi-3k) +Unk: Korrektur eines Fehlers in Ppgfiles (eMulefan83) +Unk: Korrektur eines Cursorfehlers (Slugfiller) +Unk: Codenderung in den Einstellungsfenstern fr leichteres Hinzufgen/Entfernen von Einstellungsfenstern (CiccioBastardo) +Unk: nderung in der Anzeige von LPhant Versionen (Famerlor) + + + +v0.46c +---------------------- +- 24. Juli 2005 - +---------------------- +.: Untersttzung fr die MediaInfo DLL v0.6.1 und v0.7.x hinzugefgt [von Zenitram] + +---------------------- +- 22. Juli 2005 - +---------------------- +.: Update auf zlib v1.2.3 , aufgrund von Sicherheitslcken in v1.2.2 + +---------------------- +- 18. Juli 2005 - +---------------------- +Unk: Korrektur eines mglichen Absturzes bei fehlerhaften Kad Paketen (Kry) +Unk: Kad reconnect repariert. Auto-Kad-Bootstrap wurde nicht fr eMules Multipacket-Protokoll angepasst. + +---------------------- +- 16. Juli 2005 - +---------------------- +Ornis: Korrektur eines Fehlers (aus v0.46b) durch welchen regulre Ausdrcke im Ansichtsfilter von Kategorien nicht funktionierte [thx kinmenalex] + +---------------------- +- 9. Juli 2005 - +---------------------- +Ornis: Korrektur eines Fehlers beim Prfen von Dateien/Ordnern auf Tempverzeichnis (wenn mehrere Tempverzeichnisse benutzt wurden); und eine Korrektur eines kleinen Fehlers in einem Fensterteiler (Splitterbar) [tHeWiZaRdOfDoS] +Ornis: neue und genderte Eingangsverzeichnisse von Kategorien erscheinen nun in der neuen Kontrolle der freigegebenen Dateien + +---------------------- +- 8. Juli 2005 - +---------------------- +.: Das Uploadlimit,Uploadkapazitt (Bandbreite) und Downloadlimit wird nun standardmig auf unbegrenzt (undefiniert) gesetzt +.: Wenn die Uploadkapazitt auf unbegrenzt (0) steht, wird USS automatisch aktiviert, um die beste Uploadgeschwindigkeit zu ermitteln +.: Wird die alte Standardkapazitt verwendet, wird diese einmalig fr diese Version auf den neuen Standard (unbegrenzt) gesetzt +zz: UploadSpeedSense erhht nun maximal 30KB/s ber die aktuelle Uploadgeschwindigkeit. Dies verhindert einen Anstieg auf zu hohe Limits wenn der Client nicht schnell genug Hochladen kann um das Limit zu erreichen, aufgrund fehlender Clients in der Warteschlange. +zz: Fehlerkorrektur+Erweiterung zum USS Code, welcher von langsamen Quellen weniger Daten der Datei anfragt. Dieser Code wird nun nur aktiviert, wenn nur noch wenig Daten bis zur Fertigstellung brig sind. +Ornis: Fenster fr Kollektionen sind nun grenvernderbar +Ornis: einige USS bersetzungen hinzugefgt +Unk: Einige CPU-Lastkorrekturen fr Kad (Kry) +Unk: nderung, wie Kad-Kontakte gehalten werden +Unk: Kad node lookup Algorithmus verndert um viel weniger Overhead und bessere Resultate zu erreichen +Unk: Kollektionen speicherten Extra Tags, welche die Dateien aufblhten. Korrigiert. + +---------------------- +- 5. Juli 2005 - +---------------------- +Ornis: Korrektur & Verbesserung bei Download von groen Dateien via Webinterface +Ornis: Korrektur eines kleinen Speicherlecks im Einstellungsdialog (Statistiken) + + +v0.46b +---------------------- +- July, 4. 2005 - +---------------------- +zz: Korrektur eines Upload-Sortierungsfehlers +Unk: Namenshandhabung fr Kollektionen wurde vereinfacht (z.B.: der Name wird nicht bereinigt oder umformatiert) +Unk: Kad: Verringerung der Anzahl zwischengespeicherter Informationen, um Router zu entlasten. +Ornis: Fehlerbeseitigung in Multi-Temp +Unk: Korrektur in bleibenden Icons, wenn keine Kommentare/Bewertungen mehr verfgbar sind. +.: Korrektur mehrerer kleiner Fehler in der neuen Kontrolle fr freigegebene Dateien +.: Korrektur fr das Dateigrenlimit fr Heruntergeladenene Dateien im Webinterface +.: Korrektur von Abstuzfehlern in Verbindung mit doppelten Dateien +.: Korrektur einiger kleiner GUI Fehler (Icons, Speicher&Wiederherstellen, etc) + +---------------------- +- July, 1. 2005 - +---------------------- +Unk: Statuszeile: da in manchen Sprachen der Platz fr die Angabe von "Benutzern | Dateianzahl" nicht ausreicht, wird nun beim Doppelklick darauf ein Fenster mit diesen Informationen erscheinen +Unk: einige weitere Informationen der Fullbildanzeige-Meine Informationen hinzugefgt [teils auf MorphMod basierend] + + +---------------------- +- June, 28. 2005 - +---------------------- +zz: "Automatisch alle (A4AF)-Quellen zu dieser Datei"-Meneintrag entfernt. Erhhe die Downloadprioritt der Datei fr den gleichen Effekt. +zz: Wenn von einer sehr langsamen Quelle geladen wird, werden weniger Daten auf einmal angefordert. +.: Kollektionen werden nun (optional) unterschrieben/verifiziert. Wenn die Unterschrift ungltig ist wird der Autor-Schlssel und Name entfernt +.: Downloadanfragen fr Sammlungen ignorieren die Warteschlange und werden sofort beantwortet +.: Eine Splitterbar wurde in das "Freigegebene Dateien"-Fenster hinzugefgt +.: Das Aussehen der Splitterbar wurde etwas verndert +.: Kollektionen-Dateien knnen nun mit eMule verknpft werden, klicke den "Nehme Ed2k-Links"-Button um dies zu tun, wenn es nicht schon der Installer tat + +---------------------- +- June, 27. 2005 - +---------------------- +Ornis: Crash bei HTTP-Quellen im Download-Clients Fenster behoben + +---------------------- +- June, 26. 2005 - +---------------------- +.: Erweiterung der "Ausfhren als unpriviligierter Benutzer"-Funktion: Wenn das Starten mit dem eMule-Benutzer fehlschlgt (z.B. wegen fehlender Rechte) + wird eMule als gleicher Benutz aber mit reduzierten Privilegien neustarten (aber den gleichen Dateirechten). + Dies hilft Benutzern die kein Admin-Konto verwenden die Sicherheit ein bisschen zu erhhen + +---------------------- +- June, 25. 2005 - +---------------------- +Ornis: MiniMule zeigt nun die Anzahl aller kompletten Dateien in allen Kategorien [by TED] + +---------------------- +- June, 19. 2005 - +---------------------- +.: Ein neues Fenster wurde in den "Freigegebene Datein"-Dialog eingefgt, welches das ansehen von freigegebenen Dateien nach Verzeichnissen erlaubt + und es ermglicht neue Verzeichnisse freizugeben/zu entfernen (per Drag&Drop ein Verzeichnis von "Alle Verzeichnisse" auf "Freigegebene Verzeichnisse" ziehen) +.: Support fr Verwandete/hnliche Dateien hinzugefgt, welches es erlaubt auf dem lokalen Servern nach Dateien zu suchen die von Benutzern freigegeben wurden, die auch die gewhlte Datei freigaben + +---------------------- +- June, 16. 2005 - +---------------------- +Unk: Kad Kommentare werden nun wie auch normale Kommentare gefiltert +Unk: Tray-Beenden bug behoben [Xman1] + +---------------------- +- June, 14. 2005 - +---------------------- +Unk: Bewertung-Icons zeigen nun eine Skala basierend auf den durchschnittlichen Bewertungen statt nur gut/schlecht +Unk: Alle Kommetarlisten in eMuleType-Listen konvertiert +.: 16 Farben Support hinzugefgt (eMule sieht besser aus beim betrachten mit 16 Farben, z.B. per Remote-Desktop) + +---------------------- +- June, 13. 2005 - +---------------------- +Unk: Ein Bug in Kad wurde behoben der die unkorrekte Abfolge von Kontakten beim Starten einer Suchen verursachte (thx Agthorr) +Unk: Sortierung bei Kad-Anfragen wurde verbessert +Unk: Ein bug wurde behoben der alle Kad-Ergebnisse als beste Ergebnisse behandelte und dadurch zustzlichen Overhead verursachte (thx Agthorr) +Unk: Ein bug wurde behoben der erwnschte Kontakte in der Suchliste lschte (thx Agthorr) +Ornis: Splitter-Bar im Server-Fenster +Ornis: Speichern/Wiederherstellen von Listeneigenschaften berarbeitet + - Speichern/Wiederherstellen fr Sortierungen hinzugefgt + - Spalten-Sortierfehler behoben + +---------------------- +- June, 10. 2005 - +---------------------- +Ornis: Untersttzung fr mehrere Temp-Verzeichnisse (zu trennen mit | ). Ein Temp-Verzeichnis wird automatisch beim hinzufgen eines Downloads gewhlt, basierend auf dem Incoming-Verzeichnis und freiem Speicherplatz) +Ornis: Webinterface links sind nun relativ +Unk: DialogDetailDialog wird nun bei allen CListCtrl verwendet die mit Dateien zu tun haben. +Unk: Allegemeine Codeberarbeitungen (Ex. AbstractFile, SearchFile, KnownFile, StatisticFile are now in seperate .cpp/.h files. Changed class name of kademlia tags to avoid confusion of ED2K tags.) + +---------------------- +- June, 5. 2005 - +---------------------- +zz: Schreibe "0" statt "<0" in der Komplette Quellen-Spalte in "Freigegebene Dateien"-Fenster + +---------------------- +- June, 3. 2005 - +---------------------- +.: Support fr MediaInfo library version 0.5.1 und 0.6.0 hinzugefgt (http://mediainfo.sourceforge.net) + +---------------------- +- June, 2. 2005 - +---------------------- +.: Support fr Vorschauen von verschlsselten RAR-Dateien mit "solid"-Kompression + +---------------------- +- June, 1. 2005 - +---------------------- +Unk: Alle Kommentarlisten aktualisieren automatisch +Unk: Kommentar-Icon fr Dateinen in der "Freigegebene Dateien"-Liste hinzugefgt +Unk: Mglicher Bug durch Zugriff auf ein gelschtes Objekt beim betrachten von Kommentaren behoben +Unk: Kommentare mehrerer Dateien knnen gleichzeitig angesehen werden + +---------------------- +- May, 31. 2005 - +---------------------- +.: Untersttzung fr die Vorschau von RAR-Archiven hinzugefgt, welche erweiterte Datums/Zeit-Informationen enthalten +Unk: Mglichkeit hinzugefgt, Kommentare (Kad Notizen) in Suchergebnissen einzusehen +Unk: mgliches Speicherleck bzgl. Kad Notizen korrigiert + +---------------------- +- May, 28. 2005 - +---------------------- +.: Fehlerkorrektur: mgliche Beseitigung des in-Tray-minimieren Problems, welches fr Windows NT SP6 gemeldet wurde +.: Hinzugefgt: Prfung beim eMule-Start auf eine korrekte Version der Windows Shell32 DLL - sollte auch Nutzern von Windows NT helfen Probleme zu vermeiden! +Unk: Korrektur eines Fehlers, welcher User mit niedriger ID eine falsche Buddy-IP/Port Informationen sendete +Unk: Kommentare (Kad Notizen) werden nun fr freigegebene Dateien angezeigt + +---------------------- +- May, 26. 2005 - +---------------------- +.: Korrektur eines Fehlers, durch welchen ED2K Suchergebnisse in Kad-Suchergebnissen angezeigt wurden + +---------------------- +- May, 26. 2005 - +---------------------- +.: Korrektur eines Fehlers in der Statistik bzgl. der Client-Versionen, durch welchen gleiche Clientzahlen nicht angezeigt wurden + +---------------------- +- May, 23. 2005 - +---------------------- +.: MiniMule zeigt die Anzahl der gegenwrtig fertig gestellten Dateien nur dann, wenn die Funktion "Beendete Downloads aus Liste entfernen" nicht aktiviert wurde, sonst wird die Anzahl fertig gestellter Dateien der aktuellen Sitzung angezeigt + +---------------------- +- May, 21. 2005 - +---------------------- +zz: Korrektur eines Unterlauffehlers fr die Spalte "freigegebene Teile" der Liste freigegebener Dateien. Dies konnte dazu fhren, dass sie als selten markiert wurden, obwohl sie weit verbreitet sind. +---------------------- +- May, 19. 2005 - +---------------------- +zz: Fehlerkorrektur im UploadSpeedSense (USS). Mit niedrigen Pingzeiten und niedriger Pingtoleranz-Einstellung, konnte USS bei der minimalen Geschwindigkeit fest hngen. +zz: USS erkennt nun wenn das Uploadlimit erhht wurde und schaltet fr eine kurze Zeit in den "fast reaction mode", um schnell feststellen zu knnen, ob das Limit erhht werden kann. +zz: Wenn mehrere Pings benutzt werden (erweiterte Einstellungen), nutzt USS nun einen Medianwert anstelle eines Mittelwertes, fr bessere Performance. Etwa 1-8 Pings sind empfohlen. +zz: Leicht vernderte Farben in der Anzeige der erhaltenen Teile: + White = du hast diesen Teil nicht + Red = Du bist der einzige, der diesen Teil freigegeben hat (daher: weiter freigegeben lassen!) + Blue = Du und auch andere geben diesen Teil frei. Je heller das Blau, desto weniger Benutzer haben diesen Teil + Black = Du hast diesen Teil aber die Verfgbarkeit ist unbekannt (z.B.: keener hat dich bisher nach dieser Datei gefragt und du ldst sie nicht herunter) + +---------------------- +- May, 16. 2005 - +---------------------- +.: verschiedene nderungen, um das Verschwinden des Suchparameterfensters zu verhindern +.: neue Funktion der PreviewApps.dat Datei hinzugefgt. Nach dem Kommandozeilenparameters (getrennt durch ';') kann angegeben werden: +Ext= (das Kommando wird nur fr die angegebene Dateiendung ausgefhrt, gib mehrmals das "Ext" Kommando an, wenn mehrere Erweiterungen zugewiesen werden sollen) +MinSize= (min. fertig gestellte Partdatei-Gre, um die Vorschau zu ermglichen) +MinStart= (fertig gestellte Partdatei-Gre vom Start aus, um die Vorschau zu ermglichen) +---------------------- +- May, 15. 2005 - +---------------------- +.: Neue Tooltips(anzeige) im Transferfenster +.: Fehlerkorrektur in der ZIP-Archivvorschau, fr Archive mit verzeichniseintrgen + +---------------------- +- May, 11. 2005 - +---------------------- +.: Korrektur eines Fehlers bzgl. der SetSystemACP Einstellung einer frischen eMule Installation +Ornis: Limit der Dateigre fr den Upload im Webinterface kann nun in der preferences.ini, Sektion [WebServer] : "MaxFileUploadSizeMB=5" (oder 0 fr kein Limit) angegeben werden + +---------------------- +- May, 10. 2005 - +---------------------- +.: Korrektur falscher kBit/s und KB/s -Nutzung an verschiedenen Stellen +.: Korrektur von Darstellungsfehlern der Hauptstatusleiste bei groen Systemschriftarten +.: nderung: ini-Datei der Benachrichtigen-Funktion wird nun standardmig im eMule-Config-Ordner gesucht + +---------------------- +- May, 9. 2005 - +---------------------- +.: Korrektur eines Fehlers mit den Dropdown-Knpfen im Transferfensters, bei groen Systemschriftarten +.: Hinzugefgt: Behandlung der mittleren Maustaste im Transferfenster [thx SiRoB] +.: .cbz und .cbr Dateiendungen als Archivtypen und vorschaufhige Archivtypen hinzugefgt + +---------------------- +- May, 8. 2005 - +---------------------- +.: Korrektur eines Crashs im Nachrichtenfensters, wenn mit Rechts der Schlieen-Knopf bettigt wurde +.: Neue Makros fr Webservices bereitgestellt: +#name Fgt den Dateiname ohne Dateiendung ein +#cleanname Fgt den bereinigten Dateinamen ohne Erweiterung ein +#cleanfilename Fgt den bereinigten Dateinamen ein +.: Korrektur eines Problems beim Registrieren von eD2K-Links fr eMule. +zz: A4af Code fr Quellen ohne bentigte Teile verbessert. (vorher konnte eine Quelle an einer NNP-Datei mit hoher Prioritt hngen bleiben, auch wenn es nicht-NNP-Dateien mit niedrigerer Prio gab. + +---------------------- +- 7. Mai 2005 - +---------------------- +.: Serverliste: Servers mit einem Fehlerstand von >= 2 oder grer des spezifizierten Limits werden in Graustufen angezeigt +.: 'Quelle-hinzufgen'-Dialog und 'Freund hinzufgen'-Dialog : die IP und Port kann optional auch rechts vom IP-Dialogelement angegeben werden +Ornis: Korrektur einiger Fehler im Webinterface (Kategorienwechsel, Javascriptproblemen mit manchen Sprachen, Geschwindigkeits-Balken, Timeout der Einstellungen speichern, verwechselte Priorittenzuweisung bei Servern) + +---------------------- +- 6. Mai 2005 - +---------------------- +Ornis: wurden dateieigene Quellenlimits angegeben, werden diese in der Quellenspalte der Downloadliste in [eckigen Klammern] angezeigt, und im Dateidetails-Dialog +Ornis: Korrektur des Status vom Quellenmanagement-Untermen (auswahlabhngig) + + +eMule v0.46a +---------------------- +- 3. Mai 2005 - +---------------------- +.: eMail-Benachrichtigung in der GUI konfigurierbar. Optionale Verschlsselung ist in der preferences.ini anzugeben +.: Einstellung fr zustzliche Toolbar des Transferfensters in den Einstellungdialog hinzugefgt +Ornis: Korrektur eines Fehlers beim Entfernen eines Servers aus der statischen Liste vom Webinterface aus + +---------------------- +- 2. Mai 2005 - +---------------------- +.: Korrektur eines Socket-Ressourceleaks im Webinterface +.: Der Zugriff auf das Webinterface kann fr bestimmte IP-Adressen eingegrenzt werden. preferences.ini, Eintrag: "AllowedIPs=[;]" in der Sektion "[WebServer]" +Ornis: Umbenennung der Konfigurationsdatei "adresses.dat" in "addresses.dat" (fr das automatische Laden von Serverlisten). Diese Umbenennung wird fr diese Version automatisch beim Programmstart durchgefhrt. + +---------------------- +- 1. Mai 2005 - +---------------------- +.: eMule merkt sich nun (optional) die abgebrochenen Downloads und markiert diese in den Suchlisten +.: das Merken von heruntergeladenen Dateien kann nun (in Einstellungen/Datei) deaktiviert werden. eMule lscht in diesem Fall alle unntigen Eintrge aus der known.met und known2.met +.: Korrektur eines Fehlers, welcher manchmal einen Dateizugriffsfehler beim Zugriff auf die known2.met beim Start von eMule verursachten konnte + +---------------------- +- 28.April 2005 - +---------------------- +.: Implementierung der von lugdunum vorgeschlagenen Protokollnderung fr GetSources (local/udp) + +---------------------- +- 26.April 2005 - +---------------------- +.: Hinzugefgt: neue aufklappbare Knpfe im Transferfenster, um verschiedene Ansichten der beiden Listen auszuwhlen +.: neue Einstellung in der preferences.ini: "WinaTransToolbar=1" (Sektion "eMule") zur Anzeige einer alternativen Toolbar im Transferfenster (anstatt der Dropdownbuttons) + +---------------------- +- 23.April 2005 - +---------------------- +.: Korrektur: Warteschlangenplatz von Quellen in der Downloadliste wurde nicht immer korrekt aktualisiert +.: Einige fehlende Protokoll-Overheadstatistiken hinzugefgt +Unk: einige kleine GUI-nderungen im Setup-Wizard und der Dateikommentarliste + +---------------------- +- 19.April 2005 - +---------------------- +.: Ansichtsauswahl im Transferfenster aus Mods hinzugefgt [TBH] + +---------------------- +- 17.April 2005 - +---------------------- +.: Korrektur eines Fehlers, welcher es theoretisch in seltenen Fllen erlaubte, dass eMule ungeprfte Daten an andere Clients sendete +Ornis: Korrektur eines Fehlers in der Downloadliste, durch welchen in bestimmten Situationen Befehle auf eine Dateimehrfachauswahl ignoriert wurden +Ornis: manuelles Dateinamenbereinigen fr ausgewhlte Dateien in der Downloadliste, durch Bettigung von Strg+F2 + +---------------------- +- 13.April 2005 - +---------------------- +.: Korrektur eines Fehlers bei der Dateikommentierung und -bewertung, welcher auftrat wenn eine Bewertung ohne Kommentar eintraf [thx MogTheCat] +.: Untersttzung des neuen PeerGuardian IP Filter Dateiformates v2 +.: um generelles Netzwerkoverhead zu reduzieren, werden nun tote Server schneller entdeckt und nicht fr UDP-Quellen und Dateisuchen benutzt +.: Die Prioritt in heruntergeladenen server.met -Dateien wird ignoriert. Serverprioritten kann jedoch weiterhin fr lokale Serverlisten benutzt werden. + +---------------------- +- 6.April 2005 - +---------------------- +.: Sortierreihenfolge und Scrollposition werden nun fr Suchresultate gemertk und wiederhergestellt, wenn zwischen verschiedenen Resultatslisten gewechselt wird. + +---------------------- +- 4.April 2005 - +---------------------- +.: Hinzugefgt: E-Mail Benachrichtigungen fr "Download beendet" und "wichtige Fehler". Konfigurierbar in der preferences.ini, Sektion [eMule] + Aktivieren mit "NotifierSendMail=1" + SMTP server: "NotifierMailServer=" + Empfngeradresse: "NotifierMailRecipient=" + Sender Emailadresse: "NotifierMailSender=" +Optional: Angabe eines Zertifikates fr die Verschlsselung der Email mit S/MIME: "NotifierMailEncryptCertName=". Das Zertifikat wird im lokalen Windows Adressbuch gesucht. + +---------------------- +- 1.April 2005 - +---------------------- +.: Korrektur eines Fehlers bei dem Parsen von eD2k Links ohne Dateinamen (oder Dateinamen mit ausschlielich Leerzeichen) +.: Korrektur eines Fehlers beim Umbenennen von Partfiles wenn der Dateiname nur Leerzeichen enthlt + +---------------------- +- 23. Mrz 2005 - +---------------------- +.: Quellcode wird nun mit Warninglevel 4 kompiliert (und wurde entsprechend korrigiert) +.: Kad Schlsselwortsuche und Publishing von kurzen Worten wurde gendert, um einige Einschrnkungen fr asiatische Wrter zu umgehen +.: Korrektur eines Fehlers beim Publishing von Schlsselworten in Verbindung mit Dateinamen mit zu vielen unverffentlichten Zeichen am Ende +.: Korrektur einiger GUI Fehler in der Freundesliste +.: Korrektur eines Fehlers, welcher das Minimieren in den Systray verhinderte +.: Einstellungen/Dateien: Kontextmen fr die Liste freigegebener Ordner aufpoliert +.: alle Funktionen zur Wiedergabe von Klngen gendert, um nicht den PC-Speaker zu anzusprechen falls keine Soundkarte installiert ist +.: Log-Dateien zeigen nun eindeutiger den Beginn und das Ende von Sessions +.: Korrektur eines Fehlers, welcher verhinderte, dass Log-Nachrichten nicht in die Logdateien beim Programmstart geschrieben wurden. +.: MiniMule zeigt das korrekte Verbindungsicon. +.: MiniMule zeigt die Anzahl fertiger Downloads, die gegenwrtig in der Downloadliste vorhanden sind +.: MiniMule kann an jede Ecke des Desktops angedockt werden (abhngig von der Position der Programmleiste). +.: MiniMule - Korrektur eines Problems wenn der eMule-Installationspfad Sonderzeichen enthlt +.: Hinzugefgt: Optionale Sprachausgabe fr Benachrichtigungen (siehe Einstellungen). Jede dargestellte Benachrichtigung kann von eMule mit der Standard-"Text-To-Speech-Engine" des Systems vorgelesen werden. +.: Untersttzung von GZip-komprimierten IP-Filter-Dateien hinzugefgt +.: Korrektur eines Fehlers in der Log-Anzeige, welcher eine Endloschleife im Nach-Oben-Scrollen erzeugen konnte +.: Korrektur eines Fehlers in der Log-Anzeige, welcher Text zu weit oben darstellte, wenn das Log das erste Mal aktiviert wurde +.: Deaktivierung des Auslesens von Metadaten mittels DirectShow - bis ein zuverlssigerer Weg gefunden wird +.: Experimentell: ein effizientere Methode zum Abweisen von TCP-Verbindungen von gefiltereten und/oder gebannten Clients; siehe Einstellungen/Erweitert +.: Alle Graphen im Statistik-Fenster haben ein anderes Aussehen, wenn "StraightWindowStyles=1" in der Preferences.ini, Sektion [emule] angegeben wird +.: Einige Optimierungen beim Zeichnen der Statistikgraphen. +.: Beim Schlieen des Einstellungen-Dialoges wird die preferences.ini nur noch gespeichert wenn ntig +.: Suchresultatslisten: Beim Schalten von/zu Listen mit aufgeklappten Eintrgen, wird dieser Status gespeichert & wiederhergestellt +.: Einige Optimierungen beim Behandeln von Suchergebnissen +.: Beim Empfangen von verschiedenen Dateinamen in Suchresultaten, wird der Dateiname mit der hchsten Verfgbarkeit als Wurzelname angezeigt +.: bei Anzeige der erweiterten Kontrollen: Suchresultate zeigen die Anzahl kompletter Quellen mit Prozentangabe und genauer Zahl +.: Korrektur eines Fehlers welcher verfgbare Quellen nicht dem Download hinzufgte, wenn ein Untereintrag zum Starten des Downloades ausgewhlt wurde + +---------------------- +- 14. Mrz 2005 - +---------------------- +Ornis: Dateinamenbereinigung: Zeichen hinter Apostroph nicht gro schreiben +Ornis: Korrektur falscher Dateistatistik von (zuvor) pausierten Dateien [Xman] +Ornis: Angabe einer maximalen Quellenanzahl pro Datei ber das Kontextmen in der Downloadliste (wenn erweiterte Kontrollen aktiviert) + +---------------------- +- 27. Februar 2005 - +---------------------- +.: Logdateiformat fr das Hauptlog und das Verboselog kann nun auf UTF-8 gesetzt werden, via preferences.ini Eintrag: "LogFileFormat=1" (Sektion "[eMule]"). +.: Untersttzung fr das neue PeerGuardian IP Filter Dateiformat v1 hinzugefgt. + +---------------------- +- 26. Februar 2005 - +---------------------- +.: Korrektur eines Fehlers welcher zu einem zu hohem PeerCache Sockettimeout fhrte [thx so8so] +zz: Korrektur fr USS, um zu verhindern dass es sich selbst deaktiviert wenn die Netzwerkverbindung abbrach. Wenn die erste Initialisierung von USS durchgefhrt wurde, solle es sich nicht mehr selber deaktivieren. + +---------------------- +- 22. Februar 2005 - +---------------------- +.: Korrektur eines Fehlers, wenn fehlerhafte kompatible Clients Quellen fr eine Datei erhalten konnten, nach welcher sie nicht gefragt haben. +.: Korrektur eines Fehlers mit Kad-Notizen, welche empfangen aber nicht gespeichert wurden. + +---------------------- +- 18. Februar 2005 - +---------------------- +Ornis: Wird die Maus ber Statistikgraphen bewegt und die linke Maustaste gedrckt gehalten, wird die Uhrzeit und Zeitdifferenz als Tooltip angezeigt (berechnet anhand der AKTUELLEN Statstikeinstellungen!) +Ornis: Webinterface von eMule+ integriert, angepasst, kleine Korrekturen und folgendes hinzugefgt: + - Kad + - zeigte Kommentare und Bewertungen von Dateien + - Download von fertig gestellten Downloads ber den Browser (nur Admin, nur bis zu 5MB Dateigre) + +---------------------- +- 12. Februar 2005 - +---------------------- +.: Korrektur der 'bertragen'-Spalte und Sortierung in der Upload-Liste. +.: Alle Dialoge berarbeitet, um das '&'-Zeichen in Dateinamen korrekt anzuzeigen. +.: Korrektur der Kommentar/Bewertung Beschriftungsreihenfolge. +.: Korrektur mglicherweise falsch platzierter Hoch/Runter-Knpfe im Detailsdialog. +.: Upgrade von zlib auf v1.2.2 +.: Experimentell: Rechts-nach-Links Lese Untersttzung. Aktivierbar in der Preferencs.ini: Sektion [eMule]; Eintrag: "RTLWindowsLayout=1" + + +eMule 0.45b +---------------------- +- 11. Februar 2005 - +---------------------- +.: Ein Fehler im Zusammenhang mit den neuen Kad-Dateikommentaren, der eMule einfrieren lassen konnte wurde behoben [thx gcostanza] +.: Ein Fehler im UDP-Server Protokoll, der dazu fhren konnte dass eMule Pakete ignorierte oder bei bsartig hergestellten Paketen einfrieren knnte wurde behoben [kry] +.: Das Download-Fenster merkt sich nun die 4 letzten Sortierreihenfolgen und benutzt sie als sekundre Sortierreihenfolgen +.: Ein Anzeigebug im Uploadfenster wurde behoben +.: Ein Problem welches eMule manchmal die Onlinehilfe aufrufen lie selbst wenn die passende Hilfedatei verfgbar war wurde behoben [cml] +Ornis: Korrektur von kleingeschriebenen Pfadangaben in der Liste freigegebener Dateien +Ornis: Automatisches Fortsetzen nach fertiggestellter Datei korrigiert +Ornis: >100% Statistikangabe der SecIdent-Angabe korrigiert + + +eMule 0.45a +---------------------- +- 25. Januar 2005 - +---------------------- +Ornis: kleinere Aktualisierungen im Webinterface, bzgl. Kategorienauswahl, Merken der gewhlten Kategorie innerhalb einer Session, erste Suchergebnisse gleich nach der Suche anzeigen,...) +Ornis: Statistikgraphen: vertikale Markierungen im Stundenabstand hinzugefgt; grere mgliche Zeitspanne in der Statistikupdateverzgerung [CB mod] +Ornis: neues Kommandozeilenargument hinzugefgt, um IPFilter-Datei neu zu laden: "emule.exe reloadipf" +Unk: Korrektur eines Problems, welches dazu fhrte, dass ein Keyword oder Quellenindex nicht wiederhergestellt wurde +.: Korrektur eines Fehler mit falscher User-ID/IP bei HTTP-Quellen [thx SiRoB] + +---------------------- +- 23. Januar 2005 - +---------------------- +Unk: Korrektur eines Fehlers, welcher zu einer Situation fhren konnte, in welcher Kad Quellen nicht speicherte +Unk: Entfernen einiger unntiger Parameter in der Suchklasse +Unk: Einfhrung von "Notizen" in Kad. Derzeit nur genutzt, um Dateikommentare zu speichern (sobald ein Groteil der Nutzer die neue Version nutzen) +Unk: Kad: die Zeit zwischen Quellenanfragen fr Dateien wird nun mit der Zeit stndig angepasst, um Overhead und Redundanz in den Resultaten zu verringern. + +---------------------- +- 17. Januar 2005 - +---------------------- +Unk: verschiedene Codecleanups, aufgrund der Integration des frher separaten Kad-Threads in den Main-Thread. +Unk: Korrektur eines Downloadliste-Sortierfehlers, durch welchem Quellen zur falschen Datei angezeigt werden konnten [Fix von KinkyJohn] +Ornis: Kategorien-Ansichtsfilter flexibler (allgemeingltige Filter nicht mehr nur fr die Standard-Kategorie) +Ornis: Kategorieninhalte knnen durch regulre Ausdrcke fr den Dateinamen gefiltert werden +Ornis: Klick mit der mittleren Maustaste auf Reiter schliet diese (Nachrichtenfenster, IRC, Suchresultate) +Ornis: farbliche Markierungen der Suchresultate in Skins anpassbar + +---------------------- +- 16. Januar 2005 - +---------------------- +Unk: Korrektur: das AddOnNextConnect flag welches fr LoadID-User gesetzt wurde welche ihren Uploadslot verpassten, hatte nicht korrekt gearbeitet, da der User innerhalb eines bestimmten Zeitfensters sich neu verbinden musste +- ein Client mit diesem Flag kann nun zu jeder Zeit (welche nicht das Protokoll verletzt) sich neu verbinden und erhlt den Uploadslot +- nur ein User kann diesen Slot halten, um zu vermeiden, dass die Uploadliste berschwemmt wird, wenn mehrere LowID-Users markiert wurden +- sobald ein solcher User wieder von der Uploadliste entfernt wird, ist dieser Slot wieder verfgbar +Unk: Aufweichung der Bedingungen fr User, um die Uploadqueue eines LowID Users zu betreten +- wir beobachten weiterhin User auf der Uploadliste, welche versuchen ber Server um das LowID-Callbacklimit herum zu kommen +- wir beobachten nicht Kad User auf der Uploadliste, da deren Callbacks derzeit alle ok sind +Ornis: automatische Kategorienzuweisung kann nun auch ber Auswertung eines regulren Ausdrucks gettigt werden +.: Navigation im Dateidetail-Fenster und Clientdetail-Fenster: Hoch/Runter-Knpfe in diesen Dialog erlauben das Durchlaufen der Eintrge innerhalb der aktuellen Liste + +---------------------- +- 14. Januar 2005 - +---------------------- +.: Korrektur eines Fehlers mit Unicode-Passwrter im Webinterface und MobileMule-Interface. Hinweis: das Passwort muss erneut fr diese Interfaces angegeben werden! + +---------------------- +- 9. Januar 2005 - +---------------------- +.: neue Einstellungen in der Preferences.ini hinzugefgt: (Section=[eMule], Keyword=PreviewOnIconDblClk, Value=1) um das Vorschaukommando auszufhren, wenn auf das Dateiicon in der Downloadliste gedoppelklickt wird. Die Einstellung wird nur genutzt, wenn "Doppelklick ffnet Download" (in Einstellungen/Anzeige) nicht aktiviert ist.) +Unk: Nutzung von Load Balancing: Beim Senden eines Keywords in eine Sektion des Netzwerkes mit hoher Last, erhhen wir die Verzgerung bis zum nchsten Senden (keyword Publishing). Diese Zeiten werden ber Programmneustarts gehalten. +Unk: Umarbeitungen der Schleife zur Prfung der zu sendenden Keywords, um die CPU Last zu verringern + +---------------------- +- 31. Dezember 2004 - +---------------------- +bluecow: nderung: Menge der Heruntergeladenen/Hochgeladeten Daten von/zu einem Client wird nun der tatschlich bertragenen (komprimierten) Gre angezeigt (welche auch fr die Kreditberechnung herangezogen wird). +bluecow: Korrektur eines Sortierungsfehlers in der Uploadliste. +bluecow: nderung: maximale untersttzte Dateigre ist 4290048000 Bytes + +---------------------- +- 30. Dezember 2004 - +---------------------- +bluecow: Fehlerkorrektur in der Clientstatistik fr gebannte Clients und IP-gefilterte Clients +bluecow: Korrektur eines Absturzes, beim Senden einer Nachricht an einen neu hinzugefgten Freund [thx Libbnor] +bluecow: Korrektur eines Fehlers mit falscher Hashseterstellung in dem Fall, dass die Datei nicht erfolgreich gelesen werden konnte (kann bei NTFS komprimierten Dateien mit sehr hoher Kompression geschehen!) +bluecow: Korrektur eines Fehlers beim Hinzufgen von zu groen Dateien (grer als untersttzt Gre) aus Suchresultaten heraus + +---------------------- +- 29. Dezember 2004 - +---------------------- +bluecow: Option 'Meta Daten extrahieren' zu den erweiterten Einstellungen hinzugefgt +Unk: Korrektur eines Fehlers in SMIRC, wenn CHANMODES nicht in der Willkommensnachricht enthalten war + +---------------------- +- 27. Dezember 2004 - +---------------------- +Unk: Ping/Pong System fr Buddies (Kad) hinzugefgt, um die Verbindung zu diesem Client aufrecht zu erhalten. +Unk: Korrekt mehrerer Fehler im Hello-Paket fr Buddy-Informationen +- ...falls du den Status "firewalled" hast und Quellen in der Warteschlange hast, knnen diese dir nun leichter folgen wenn du den Buddy wechselst +- ...nur User im Status "firewalled" mit einem Buddy senden die Buddy-Info, um den Overhead zu verringern + +---------------------- +- 26. Dezember 2004 - +---------------------- +bluecow: Erstellung des 'skins'-Unterverzeichnisses im eMule-Ordner. Dieses wird als Standardverzeichnis fr Skins und Toolbar-Bitmaps gesetzt. +Ornis: Sprache Bretonisch hinzugefgt [bersetzung von KAD-Korvigello an Drouizig] + Japanische bersetzung aktualisiert [Aktualisierung von DukeDog] + +---------------------- +- 24. Dezember 2004 - +---------------------- +bluecow: Windows Internet Security Manager fr extern geladene HTML-Dateien hinzugefgt +- Internet Security Zone Einstellungen werden vom Windows Internet Settings System Applet (same settings as used by Internet Explorer) bernommen. +- von eMule verwendete Standard Internet Security Zone ist auf hhste Stufe gesetzt: "nicht vertrauenswrdige Zone" +- Internet Security Zone kann in der Datei preferences.ini gendert werden: Sektion=[eMule], Schlssel=InternetSecurityZone, Werte=Untrusted|Internet|Intranet|Trusted|LocalMachine +bluecow: Sortierung von Kontextmeneintrgen fr die Toolbar Bitmaps und Skin-Profile +bluecow: freigegebene Dateien mit Kommentaren und/oder Bewertungen werden mit einem kleinen Overlayicon in der Liste markiert +bluecow: Hinzugefgt: Icons fr die Angabe, in welchen Netzen die einzelnen Dateien verffentlich wurden (Liste der freigegeben Dateien) +bluecow: Korrektur einiger GUI-Darstellungsfehler [thx apph] +bluecow: Korrektur einiger Fehler mit den Statistiken-Farben in der Einstellungen/Statistiken-Seite +bluecow: einige Doppelklick-Funktionen hinzugefgt: +- Serverfenster: Doppelklick auf Serverlistenicon (oben links) ffnet die Einstellungen/Server-Seite +- Fenster der freigegeben Dateien: Doppelklick auf das Icon fr freigegebene Dateien (oben links) ffnet die Einstellungen/Verzeichnisse-Seite. +- Nachrichtenfenster: Doppelklick auf das Freundeslisten-Icon (oben links) ffnet die Einstellungen/Dateien-Seite. +- Statistikenfenster: Doppelklick auf einen Graphen ffnet die Einstellungen/Statistiken-Seite. + +---------------------- +- 22. Dezember 2004 - +---------------------- +bluecow: Status.log Dateien gibt nun den kompletten Dateinahmen aus (vorher auf 50 Zeichen gekrzt) + +---------------------- +- 21. Dezember 2004 - +---------------------- +zz: Verbesserungen zum Downloadthrottler, um die Menge der fehlgeschlagenen Sessions und "timed out"-Sessions zu verringern + +---------------------- +- 19. Dezember 2004 - +---------------------- +bluecow: Korrektur eines Unicode-Fehlers mit ed2k-Links, welche ber das Webinterface hinzugefgt werden. +bluecow: Korrektur eines Fehlers mit der Dateiprioritt im Webinterface [thx CML] +bluecow: Unicode-Suchparameter dem Webinterface hinzugefgt [thx CML] +bluecow: lokaler Hostname (wenn in den erweiterten Einstellungen angegeben) wird fr die Anzeige der Webinterface-URL im "Meine Info" Kasten. +Unk: Knotensuche wird erzwungen, wenn es scheint das Kad die Verbindung verloren hat, um zu testen, ob wir wirklich keine Verbindung mehr haben +Unk: Firewalled Kad User sucht sofort nach einem neuen Buddy, wenn der aktuelle Buddy verloren wurde, anstatt bis zum nchsten Firewall-Check zu warten +Unk: Firewalled Users senden erneut seine Quellen, wenn sie ihren Buddy gewechselt haben +Unk: Wenn die Suche nach einem Kad Buddy fehlschlgt, wird dieser solange wiederholt, bis er erfolgreich ist + +---------------------- +- 13. Dezember 2004 - +---------------------- +Unk: Kad-Suchliste gendert, um die Information klarer darzustellen und um die Spalte "Knoten Last" hinzuzufgen +Unk: Korrektur eines Fehlers, welcher zu einem Zugriff auf einen NULL Kad Buddy Pointer fhren konnte +bluecow: Korrektur eines Absturzes in Verbindung mit dem Systemtray-Kontextmens, geffnetem Optionendialog und wiederhergestelltem Hauptfenster +bluecow: Korrektur eines Fehlers, welcher zum Ignorieren von freigegebenen Verzeichnissen mit Unicodezeichen im Namen beim Programmstart fhren konnte +bluecow: Dateiformat von "shareddir.dat" und "adresses.dat" in Unicode gendert. Alte (ANSI) Dateien werden gelesen und beim Programmstart automatisch ins Unicodeformat konvertiert. Alte (ANSI)-eMule-Versionen knnen diese Dateien nicht lesen. +Unk: Korrektur eines Fehlers, welcher LowID-Clients es nicht ermglichte, als Quelle im Kad-Netzwerk verffentlicht zu werden + +---------------------- +- 12. Dezember 2004 - +---------------------- +bluecow: Hinzugefgt: Beim Programmstart wird auf eine aktuelle Version von COMCTL32.DLL geprft +bluecow: Die Dumperstellung beim Programmabsturz wurde fr Release-builds bernommen. Um die Crash-Dump-Erstellung zu aktivieren, gebe "CreateCrashDump=1" in der "eMule" Sektion der preferences.ini Datei an. + +---------------------- +- 9. Dezember 2004 - +---------------------- +bluecow: Alle von ed2k-Servern empfangenen Pakete knnen Unicode-Strings enthalten. (Server admins knnen ihre Server-Beschreibung in Unicode senden). +bluecow: Hinzugefgt: Mini eMule Fenster mit den wichtigsten Statistiken und Funktionen. Ein einfacher Linksklick auf das eMule-System Trayicon ffnet das Fenster. +- Mini eMule Fenster kann ber ein HTML-Template angepasst werden (siehe Template.eMuleSkin.ini fr Details). +- Mini eMule Fenster kann deaktiviert werden durch folgende Einstellung in der "preferences.ini"-Datei, Sektion "[eMule]" : "MiniMule=0". (wird nur zum Programmstart ausgewertet) +- Mini eMule Fenster kann durch folgende Einstellungen in der "preferences.ini"-Datei angepasst werden (Sektion "[eMule]"): (diese Einstellungen werden whrend des Programmlaufes ausgewertet, kein Neustart ntig) +- "MiniMuleAutoClose=1" : das Mini eMule Fenster schliet sich automatisch selber, wenn der Mauszeiger nicht ber dem Fenster ist. (hnlich einem Tooltip) +- "MiniMuleTransparency=<0-100>" : Transparenz (in Prozent) des Mini eMule Fensters + +---------------------- +- 4. Dezember 2004 - +---------------------- +bluecow: Umarbeitung von 'Minimiert Starten' und dem Wiederherstellen des Hauptfensters nach dem Programmstart, um einige Fensterdarstellungsprobleme zu verhindern. + +---------------------- +- 21. November 2004 - +---------------------- +bluecow: Korrektur eines Sortierfehlers fr "verbleibende Zeit" in der Downloadliste + +---------------------- +- 17. November 2004 - +---------------------- +bluecow: eMule-Haupttoolbar berarbeitet: +- Chevron Untersttzung hinzugefgt: Wenn die Toolbar zu klein fr alle Knpfe ist, wird ein Chevron (">>" Icon) am rechten Rand dargestellt, welches ein Men mit den brigen Knpfen anzeigt. +- Tooltips werden fr abgetrennte Knopfbeschriftungen und im "Keine Beschriftungen"-Modus der Toolbar angezeigt +- Knpfe der Toolbar knnen umgeordnet und/oder entfernt werden, indem Strg+Alt gedrckt gehalten wird, whrend Knpfe mit der Maus bewegt werden (Drag) +- Knopfgre kann gewhlt werden zwischen gro und klein. +- Knopfgre hnelt mehr denen des Windows Explorers. +- Alle neuen Toolbarfunktionen knnen deaktiviert werden, durch Eintrag von "ReBarToolbar=0" in der "preferences.ini"-Datei +- Toolbar-Hintergrund kann ber ein Skin-Profil angepasst werden (siehe Template.eMuleSkin.ini) +bluecow: Korrektur eines Fehlers mit den vertikal ausgerichteten Schriften im Statistikfenster + +---------------------- +- 16. November 2004 - +---------------------- +bluecow: die Einstellung "ShowCopyEd2kLinkCmd=1" in der Datei "preferences.ini" ersetzt das "Zeige eD2K Links"-Kommando mit "Kopiere eD2K Links" +bluecow: Korrektur eines Darstellungsfehlers im Kontextmen in Log-, Nachrichten- und IRC-Listen + +---------------------- +- 14. November 2004 - +---------------------- +bluecow: die Suche in eD2K und Kad ist nun standardmig auf Unicode-Suchausdrcke gestellt +bluecow: der Dialog fr Dateikommentare im Fenster der freigegebenen Dateien kann nun auch fr mehrere Dateien aufgerufen werden +bluecow: Korrektur von nicht funktionierenden Knpfen im Nachrichtenfenster + + +v0.44c +---------------------- +- 14. November 2004 - +---------------------- +.: Icons in Contextmens wurden unter Win98/ME deaktiviert, da es Berichte ber Probleme unter diesen Windowsversionen gab +.: Kleines Bugfix in der neuen Korruptionserkennung + + +---------------------- +- 8. November 2004 - +---------------------- +.: eMule kann nun erkennen welche Clients fehlerhafte Daten bertragen hat und bannt diese wenn ein bestimmtes Limit erreicht wurde (basierend auf AICH) + + +---------------------- +- 1. November 2004 - +---------------------- +bluecow: Ein Zhlerberlauf in einigen Statistiken wurde behoben [thx BinGordon] +bluecow: Ein Bug mit der maximalen Downloadrate wurde behoben +bluecow: "Bentigter Speicher fr Downloads" statistik fr NTFS komprimierte Dateien wurde korrigiert +bluecow: Fixed bug with "Needed Spaced for Downloads" stats for NTFS compressed and sparse files. +bluecow: Der Einstellungsdialog wurde grafisch etwas verbessert. + +---------------------- +- Oct, 15th 2004 - +---------------------- +.: In die meisten Contextmens wurden Icons hinzugefgt [danke Daan fr die Icons] +.: Ein Unicodebug im MobileMule-Server wurde behoben +Ornis: die Befehle "Zeige Details" und "Als Freund hinzufgen" wurden in das Contextmenu der Reiter des Chatfensters eingefgt + + +---------------------- +- 14. Oktober 2004 - +---------------------- +Ornis: Ansicht von Unter-Kategorien kann nun auch nach Status oder Dateityp gefiltert werden. (+ Negator-Option des Filters bei aktivierten erweiterten Anzeigen) + +---------------------- +- 10. Oktober 2004 - +---------------------- +Ornis: importierte Tempdateien werden nun sofort freigegeben wenn mglich + +---------------------- +- 28. September 2004 - +---------------------- +bluecow: Korrekturen von Speicherlecks, bei Ausnahmebehandlungen und Tag-Listen-Auslesen von Kad tags. + +---------------------- +- 26. September 2004 - +---------------------- +bluecow: Fehlerkorrektur in einigen Log-Abzeigen, welche nicht das maximale Buffer-Limit eingehalten haben +bluecow: Untersttzung von NTFS Sparse Dateien fr neu erstelle Tempdateien + +---------------------- +- 25. September 2004 - +---------------------- +bluecow: Korrektur eines Fehlers der Berechnung der Downloaddatenrate [thx Aw3] +bluecow: Optimierter MD4 und SHA1 Hashing-Code, um die totale Hashing-Performance um ~50% zu verbessern [Camper] + +---------------------- +- 24. September 2004 - +---------------------- +bluecow: Korrektur der Standardschriftauswahl bei einigen GUI-Elementen fr Systeme mit multibyte-character Schriften. + +---------------------- +- 20. September 2004 - +---------------------- +bluecow: Wiederherstellung von Suchparametern. Doppelklicke oder Strg+Klick auf den Reiter (Tab) einer Suchresultats-Seite, um alle Suchparameter dieser Suche wieder einzutragen. +bluecow: alle eMule*.log Dateien werden im .\logs Verzeichnis abgelegt. Bereits existierende Log-Dateien werden automatisch verschoben +bluecow: Korrektur des Doppelte-Scrollbalken-Problems im Suchdialog bei Systemen mit geringer Bildschirmauflsung + +---------------------- +- 19. September 2004 - +---------------------- +bluecow: Korrektur eines Fehlers mit aufgestauten Thread-Log-Nachrichten, welcher in manchen Fllen zum Absturz fhren konnte +bluecow: Korrektur eines Unicode-Fehler beim HTML-Export von Statistiken +bluecow: Neu: Fehler/Warnungen/Erfolgs- Nachrichten werden in den Log-Listen mit entsprechenden Farben dargestellt +bluecow: Code zum ID3-Tag auslesen im Media-Info-Dialog neu berarbeitet um mehr entsprechende Informationen anzuzeigen + +---------------------- +- 15. September 2004 - +---------------------- +bluecow: Tooltip fr "Verbindungsstatus"-Abschnitt in der Statusleiste hinzugefgt, welcher den gegenwrtig verbundenen Server und User auf dem Server anzeigt + + +v0.44b +---------------------- +- 10. September 2004 - +---------------------- +bluecow: Korrektur eines Unicode-Win9x-Fehlers, bei dem ein falscher freier-Festplattenplatz-Wert ermittelt wurde +bluecow: Korrektur eines Unicode-Win9x-Fehlers: Kontrollen der Verzeichnisfreigabe-Einstellung funktionierten nicht +bluecow: Korrektur eines Unicode-Fehlers, welcher zu fehlenden UTF8 Umwandlungen im Webinterface fhrte +bluecow: 7-zip -Dateierweitung wurde zu den bekannten Archiv-Typen hinzugefgt, fr das Verffentlichen und Suchen von Dateien +bluecow: Korrektur eines Unicode-Fehlers mit der Haupt-Toolbar-Initialisierung, welcher zu nicht funktionierenden Tastaturkombinationen fhrte +bluecow: Korrektur eines Unicode-Win9x-Fehlers mit dem Kopieren von ed2k-Links in die Zwischenablage +bluecow: Workaround fr einen offensichtlichen Fehler in der Windows DNS Bibliothek, welche ungltige Daten lieferte +bluecow: Korrektur eines Fehlers, welcher fortgesetzte Dateien sofort wieder (aufgrund von Festplattenplatzmangels) in den Pausezustand wechseln lie. +bluecow: neue Option, um festzulegen, ob die Systemcodepage fpr die Nicht-Unicode-Stringumwandlungen genutzt werden soll (SetSystemACP=1). Dies ist nur zu Kompatibilittszwecken fr Nutzer, welche eine andere Codepage fr Nicht-Unicode-Anwendungen angegeben haben. Es ist nicht ratsam, diese Option ohne einen triftigen Grund zu nutzen. +bluecow: automatische Erkennung des Systemcodes und der aktuellen Codepage wenn eMule das erste Mal startet (setzt SetSystemACP=1). +bluecow: Korrektur eines Unicode-Win9x-Fehlers: leere IP-Filterlisten-Anzeige +bluecow: Korrektur eines Unicode-Win9x-Fehlers: fehlende Tooltips in der Downloadliste +.: Korrektur in der "Starten als unpriviligierter Benutzer"-Funktion +.: Korrektur eines "Laufzeitfehler"-Absturzes, welcher auftreten konnte, wenn Kad aktiviert war +.: Korrektur in der Behandlung von fehlerhaften known2.met Dateien +.: Korrektur eines Fehlers, welcher eMule zwischenzeitlich einen falschen AICH-Hash fr eine Tempdatei zuwies, welche nach dem Start neu gehasht wurde +.: Korrektur einiger potentieller Probleme beim Auslesen von Mediainfos aus Dateien + +---------------------- +- 9. September 2004 - +---------------------- +bluecow: Korrektur eines divide by zero Fehlers im Kad Kontakte Histogramm +zz, bluecow: Korrektur des UploadSpeedSense UDP Pingers +zz: Korrektur in der alphabetischen Sortierung fr das fortsetzen des nchsten Downloads +Unk: Korrektur: Die Verzgerung bei der Erstellung von Uploadslots konnte bei der creditsystembasierten Uploadmethode zu viele Upload Slots entfernen + +---------------------- +- 8. September 2004 - +---------------------- +Unk: mgliches Memleak durch ein fehlerhaftes Kad-Tag korrigiert +bluecow: Memleak im PC-Sucher- und im Einzelbildgrabber -Thread korrigiert +bluecow: Hinzugefgt: Bildseitenverhltnis wird nun im Mediainfo-Dialog angezeigt +bluecow: berprfung hinzugefgt, ob die Dateierweiterung herunterladener/freigegebener Dateien dem Dateityp entspricht. (wird nur genutzt, wenn die MediaInfo-Bibliothek installiert ist - siehe dazu auch ltere Changelog-Eintrge bzgl. MediaInfo-Bibliothek). +bluecow: neue Einstellung fr die preferences.ini: "InspectAllFileTypes=1", derzeit nur fr den MediaInfo-Dialog genutzt - um das Dateiformat von herunterladenen/freigegebenen Dateien durch Auswertung des Headers (am ntzlichsten, wenn die MediaInfo-Bibliothek installiert ist) zu ermitteln +bluecow: Korrektur von Fehlern in der Videovorschau und Archivvorschau, im Zusammengang mit falscher Dateipointer-Nutzung, welche in seltenen Fllen zur Vorschau einer falschen Datei fhrte +bluecow: neue Einstellung fr die preferences.ini: "PreviewCopiedArchives=0", um eine alternative Methode fr die Vorschau eines Archives zu nutzen (schneller und nutzt weniger Festplattenplatz auf dem Temp-Laufwerk). +bluecow: neue Einstellung fr die preferences.ini: "ShowActiveDownloadsBold=1". Aktive Downloads und uploadene Quellen werden fett im Transfer-Fenster angezeigt +bluecow: nderung: server.met und ipfilter.dat URLs werden zu der Autovervollstndigung hinzugefgt, auch wenn der Download fehlschlug, um keine eingegebenen URLs zu verlieren +bluecow: Hinzugefgt: Wenn mehrere Server in der Serverliste ausgewhlt werden, zeigt ein Tooltip die zusammengefassten Statistiken der Server an +bluecow: Hinzugefgt: wenn mehrere Suchergebnisse ausgewhlt werden, zeigt ein Tooltip die Gesamtdateigre aller gewhlten Dateien +bluecow: Unicode-Fehler korrigiert, beim manuellen Speichern von Log-Dateien +bluecow: Unicode-Fehler, wenn ein "?" im Datei-Kommentar angegeben wurde +bluecow: Unicode-Fehler korrigiert, wenn ANSI-Logfile in Unicode fortgefhrt wurde + +---------------------- +- 3. September 2004 - +---------------------- +Unk: nderung in der Quellenindexierung, so dass nur die neusten Eintrge gesendet werden + + +v0.44a +---------------------- +- Sep, 2nd 2004 - +---------------------- +Unk: Kad erinnert sich nun an den letzten offen/firewalled status whrend einer erneuten berprfung um zwischenzeitlich falsche Meldungen zu vermeiden. +Unk: Es werden nun zwei aufeinanderfolgende IP-Antworten bentigt um die derzeitig bekannte IP zu ndern um die Auswirkungen von falschen Antworten zu reduzieren +.: Das MobileMule Protokoll wurde auf 0.9a aktualisiert (bugfix) +.: Ein Bug der einen falschen Status von empfangenden Parts fr Uploads verursachen knnte wurde behoben. + +---------------------- +- Sep, 1th 2004 - +---------------------- +.: Eine neue Dialogseite fr die Erstellung von ED2K-Links von freigegebenen und downloadenen Dateien ersetzt die alten Contextmen Eintrge +.: LibPng wurde auf version 1.26 aktualisiert um eine Sicherheitslcke zu schlieen (die allerdings in eMule nur geringe Auswirkungen hat) +.: Der IP-Filter wird nun auch benutzt um eintreffende UDP-Pakete zu ignorieren +.: Eine Option in den Einstellungen erlaubt nun die Auswahl zwischen der einfachen (vor 0.43) und einer erweiterten Methode zur Berechnung der verbleibenen Zeit von zu ladenen Dateien +.: Ein neues zustzliches Hashsystem (AICH Hashs) wurde eingefhrt, welches den durchschnittlichen Datenverlust bei einer Korruption von 4.64MB (mit ICH) auf 180KB senkt (AICH). Das System ist im effektivsten wenn Links mit zustzlichem AICH Hash verwendet werden, die eMule nun auch erzeugen kann. +.: WICHTIG: Wegen des neuen Hashsystem ist es notwendig dass eMule alle freigegebenen Datei neu hasht - dies ist ein einmaliger Vorgang der sich nicht vermeiden lsst. + +---------------------- +- Aug, 26th 2004 - +---------------------- +Unk: eMule versucht nun zu schtzen wieviele Dateien in Kad vorhanden sind + +---------------------- +- Aug, 23rd 2004 - +---------------------- +Unk: Potentielles Memleak behoben +Unk: Die Berechnung der Anzahl der Benutzer von Kad wurde gendert + +---------------------- +- Aug, 22nd 2004 - +---------------------- +Unk: Die Methode wie Kad Kontakte lscht wurde gendert so dass die Kontakt aktueller bleiben sollte. +Unk: Es werden nicht mehr alle Kad Kontakte beim Beenden gespeichert sondern nur noch eine Stichprobe von bis zu 200 +Unk: Alle angezeigten Werte gehen durch ein Format-Funktion um sie zu standarisieren + +---------------------- +- Aug, 21st 2004 - +---------------------- +Unk: Es gibt nun die Mglichkeit eine Quelle manuell hinzuzufgen +Unk: wenn Kad keinen eingehenden Traffic fr eine bestimmte zeit feststellt nimmt es an dass die Verbingung verloren wurde +Unk: ein bug der viele unbntigte Kad Bootstrap Pakete sendete wurde behoben +Unk: Eine Wartung des Kad Codes (unntigen Code entfernen, log events ndern usw) + +---------------------- +- Aug, 20th 2004 - +---------------------- +Unk: Die Methode zu berenchnung der verbleibenen Downloadzeit wurde angepasst +.: Die Behandlung von toten Quellen wurde berarbeitet (verhindert das Quellen bei denen bekannt ist dass sie unerreichbar sind innerhalb einer bestimmten Zeit erneut befragt werden) + +---------------------- +- Aug, 19th 2004 - +---------------------- +Unk: Die Mglichkeit eMule automatisch beim Windowsstart zu starten wurde hinzugefgt +Unk: Ein bug der fr ausgehende Verbindungen die falsche ID/IP des Clienten beim IP-Filter kontrollieren knnte wurde behoben +unk: Die Anzahl der bekannten Clienten zu Kad/Ed2k verbunden sind wurde zur Statistik hinzugefgt + +---------------------- +- Aug, 18th 2004 - +---------------------- +Unk: eMuel kontrolliert nun die Anzahl der Halb-offenen Verbindungen und limitiert neue Verbingsversuche wenn ein Limit erreich ist (vermeidet das WinXP Sp2 alle Verbindungen verlangsamt) +Unk: We no longer allow a socket pending Connect to time out until OnConnect is called. ( If approved and kept in, it should help with SP2 and lost sources..) +Unk: Die Warnungen das Kad beta ist wurden entfernt + +---------------------- +- Aug, 15th 2004 - +---------------------- +Unk: Erste Schritte zur Einbindung von firewalled Clienten in Kad. Dies wird erst Wirkung zeigen wenn die meisten Benutzer die Version aktualisiert haben + +---------------------- +- Aug, 9th 2004 - +---------------------- +Unk: Die Zeit zwischen Verffentlichungen von Schlsseln in Kad wurde erhht um den Overhead zu senken +Unk: Mglichen Memleak bei eingehenen fehlerhaften Kad Verffentlichungen wurde behoben +Unk: Einige Limits wieviele Kad Schlssel indiziert werden wurden hinzugefgt + +---------------------- +- Aug, 8th 2004 - +---------------------- +zz: Nchste Datei fortsetzen benutzt nun die gleichen Optionen wie A4Af (alphabetisch, Kategorie-, Dateiprioritt usw.) + +---------------------- +- Aug, 5th 2004 - +---------------------- +zz: UploadSpeedSense minimum limit darf nun unter 10KB/s gehen, nutzt jedoch in dem Fall eine andere Ratio um reines Downloaden ohne Uploaden zu verhinden + +---------------------- +- Aug, 4th 2004 - +---------------------- +zz: die Behandlung im A4AF Managment von Quellen die keine bentigten Teile haben wurde verbessert + +---------------------- +- Aug, 1st 2004 - +---------------------- +bluecow: Ein Bug in der Client Versions-Statistik wurde korregiert + +---------------------- +- Jul, 31st 2004 - +---------------------- +Unk: Ein Bug der die Unterbrechung des Uploads nach einem kompletten Part selbst bei leerer queue verursachte wurde behoben +Unk: Die IRC-, Nachrichten- und Statistik GUI wurde mit Vernderungen aus Mods [] aktualisiert + +---------------------- +- Jul, 26th 2004 - +---------------------- +bluecow: Sortieren von String im Benutzerinterface ist abhngig von der lokalen Sprache (sehr hnlich zum IE) +Ornis: Ein bug in der Downloadliste des Webinterface wurde behoben + +---------------------- +- Jul, 24th 2004 - +---------------------- +bluecow: Eine Netzwerk Info-Dialog wurde hinzugefgt, der durch ein Doppelklick auf das verbindungsicon in der Statusbar geffnet wird. +bluecow: Einige kleinere Bugs im Dateikommentar-System wurden behoben +bluecow: Das Downloadfenster zeigt nun das Systemicon fr den entsprechenden Typ der Datei + +---------------------- +- Jul, 20th 2004 - +---------------------- +buecow: Ein bug der server auf, die per ED2K Link aufgenommen wurde, auf niedriege Prioritt setzte wurde behoben +Ornis: Ctrl-V fgt einen ED2k-Link aus der Zwischenablage in die Downloadliste ein + +---------------------- +- Jul, 17th 2004 - +---------------------- +bluecow: Ein Kad histogram welches die bekannten Kontakte zeigt wurde hinzugefgt +Ornis: Im Erster-Start Wizzard und in den Verbingungseinstellungen gibt es nun die Mglichkeit einen webbasierten Porttest durchzufhren. +Ornis: TCP und UDP Ports knnen whrend der Laufzeit gewechselt werden wenn eMule nicht bereits verbunden ist + +---------------------- +- Jul, 16th 2004 - +---------------------- +zz: USS wurde gendert um seltene Probleme mit TTLs besser zu handhaben +zz: Ein Fehler der nicht alle Dateien stoppte/pausierte wenn das Kontextmen dafr benutzt wurde, wurde beseitigt + +---------------------- +- Jul, 12th 2004 - +---------------------- +zz: Es wird verhindert das Clienten, die keinen Uploadslot haben Blockanforderungen zur Warteliste hinzufgen, was verhindert dass diese Blocks gesendet werden sobald die Clienten einen Slot bekommen + +---------------------- +- Jul, 7th 2004 - +---------------------- +zz: Die Anforderung von Quellen wird nun in der gleichen Reihenfolge wie A4AF Prioritt ausgefhrt +zz: Standby-Uploadslots werden grau gekennzeichnet + +---------------------- +- Jul, 6th 2004 - +---------------------- +zz: Das limit der Warteliste erlaubt nun maximal 25% zustzliche Clienten mit hohem Creditwert +Unk: Ein Bug in Datei-Prioritten wurde behoben + +---------------------- +- Jul, 5th 2004 - +---------------------- +zz: Versuche ersten und letzten Teil zuerst zu laden ist nun individuell fr jede Datei anwhlbar wenn die globale option ausgeschaltet ist. + +---------------------- +- Jul, 3rd 2004 - +---------------------- +bluecow: Bei mehrern markierten freigegeben Datein zeigt die Statistik nun eine Zusammenfassung aller Datein an + + +v0.43b - Hotfix +---------------------- +- Jul, 5th 2004 - +---------------------- +.: Fixed a bug which let eMule reject most available PeerCaches +Ornis:Statistics (requests,accepted requests,transfered) of partfiles are now saved and restored too (like for shared files) +zz: Opens less slots if UploadSpeedSense lowers upload limit + +v0.43a +---------------------- +- 28. Juni 2004 - +---------------------- +bluecow/. : eMule untersttzt nun PeerCache, eine Technologie, welche es Internet Providern erlaubt, Bandbreitennutzung durch Daten-Zwischenspeicherung (Caching) zu reduzieren +Unk: SMIRC: Option hinzugefgt, um andere User daran zu hindern, dich als Freund mittels SMIRC hinzuzufgen +Ornis: Option, um das automatische Fortsetzen von pausierten Download (sobald ein Download fertiggestellt wird) so zu regeln, dass das Fortsetzen nur in der gleichen Kategorie erfolgt (zustzlich zu Option, Downloads derselben Kategorien zu bevorzugen) +Ornis: Log-Nachricht "neue Nachricht" erscheint nun nicht mehr fr gefilterte Nachrichten +bluecow: eMule betritt defcon level 3... :) (verschiedene Sicherheitsvorkehrungen) +*) TCP Verbindungsversuche von gefilterten IPs werden nun direkt auf TCP-Protokoll Level abgewiesen +*) TCP Verbindungsversuche von gebannten Clients werden nun direkt auf TCP-Protokoll Level abgewiesen +*) LowID Callback-Requests von Servern werden ignoriert, wenn die IP gefiltert oder gebannt ist +*) erhaltende Quellen (von Servern / Quellenaustausch) werden gefiltert, um bereits gebannte Clients zu ignorieren +*) alle UDP Pakete von gebannten Clients werden ignoriert +*) Extra Sicherheitscode um das Verbinden zu gefilterten IPs und gebannten Clients zu verhindern + +---------------------- +- 25. Juni 2004 - +---------------------- +.: eMule kann nun selbststndig die bentigten Ports an der WinXP (SP1 & 0) -internen Firewall freischalten. Entweder permanent (Einstellungen->Verbindungen) oder temporr bei jedem Start (erweiterte Einstellungen) + +---------------------- +- 20. Juni 2004 - +---------------------- +zz: (mglicher) Fix fr die gemeldeten Flle, dass eMule nicht das Upload-Limit erreicht +bluecow: einige Protokoll-Prfungen hinzugefgt, um zu verhindern, von fehlerhaften Clients geflooded zu werden +bluecow: Korrektur einer Schwachstelle im IP-Filter beim Lesen einiger Zeilen einer PeerGuardian Filterliste mit fehlerhaftem Format + +---------------------- +- 15. Juni 2004 - +---------------------- +bluecow: neuer Kontextmenpunkt im Fenster der freigegebenen Dateien hinzugefgt (nur fr fertige 'eMuleSkin.zip' Dateien) um eMule-Skins direkt zu installieren +zz: Upload bandwidth throttler optimiert, um die Anzahl der ACK Pakete zu minimieren + +---------------------- +- 13. Juni 2004 - +---------------------- +zz: einige nderungen, um die UploadSpeedSense Startphase zu beschleunigen, wenn ein TTL nicht auf Pings reagiert. Und Erhhung des Uploadlimits whrend der Vorbereitungsphase auf 2 KB/s, um falschen "Firewall"-Modus bei Kad zu vermeiden. +zz: nderung der "Gleichheit fr alle"-Implementierung des Upload Bandwidth Throttlers, um die Paketfragmentierung zu minimieren bei TCP Paketen + +---------------------- +- 12. Juni 2004 - +---------------------- +bluecow: nderung der 'Zeichensatz' -Wahl fr das Webinterface, um die richtige Codepage fr den HTMLcode anzugeben +bluecow: Suche via Web-Interface bzgl. der Dateityp-Suchparameter berarbeitet (auch templates aktualisiert!) + +---------------------- +- 10. Juni 2004 - +---------------------- +bluecow: Option zum Entfernen toter Server gendert: Jeder Server, der die maximale Fehlschlaganzahl berschreitet, wird aus der Liste gelscht. +bluecow: "Dokument" -Dateityp fr das Bekanntgeben von Dateien hinzugefgt, wie auch zu den Suchparametern bei der ED2K- und Kad-Suche +Ornis: Statistiken werden nun in der Datei "Statistics.ini" gesichert (nicht mehr gemischt mit den Einstellungen in der preferences.ini) + +---------------------- +- 9. Juni 2004 - +---------------------- +bluecow: viele kleine Korrekturen beim Wechsel der Sprache whrend der Laufzeit. + +---------------------- +- 6. Juni 2004 - +---------------------- +zz: a4af-Manager verbessert. (Setze die Dateien, die du zuerst erhalten willst auf hohe Prioritt. A4af-Entscheidungen sind mehr priorittsgesteuert). Fr die Priorisierung der alphabetische Reihenfolge, kann diese Option pro Kategorie ber das Kategorie-Kontextmen aktiviert werden. Eine Quelle kann weiterhin (automatisch) gewechselt werden, um einen Quellenaustausch zu frdern. Da die Neuanfrage-Verzgerungen immer eingehalten werden, kann der Quellenwechsel (Swap) verzgert stattfinden (dies verhindert, wegen a4af-Aktionen gebannt zu werden). + +---------------------- +- 3. Juni 2004 - +---------------------- +bluecow: Unzipping von IP-Filter-Dateien von PeerGuardian ZIP-Dateien. + +---------------------- +- 2. Juni 2004 - +---------------------- +Unk: GUI-Struktur von SMIRC komplett berarbeitet. +Unk: SMIRC empfngt nun verfgbare Channel-Modes, beim Verbinden zum Server. +Unk: Es knnen nun TypeD -Channel-Modi gesetzt/aufgehoben werden. Es knnen auch TypeC Channel Modi aufgehoben werden. (mehr Untersttzung folgt evtl. spter) + +---------------------- +- 1. Juni 2004 - +---------------------- +bluecow: IP Filter-Werkzeug berarbeitet, um groe IP-Filter-Listen effizienter zu untersttzen. +bluecow: Fortschrittsinformation wird nun angezeigt, wenn Tempdateien gehasht oder in das Zielverzeichnis kopiert werden. +bluecow: Farben-Anpassungen (via Skin Profile) fr Serverinfo, Log, Chat- und IRC Fenster. +.: Loglevels fr die Verbose-Anzeigen hinzugefgt, um zu ermglichen, nur wichtige Nachrichten anzeigen zu lassen +.: Korrektur eines Fehlers, dass einige bekannte Kontakte niemals gelscht wurden, auch wenn sie nicht mehr gebraucht wurden +.: Vollstndige Quellen werden nun in Prozent in einer neuen Spalte im Suchfenster angezeigt. Wenn keine kompletten Quellen bekannt sind, wird diese Information rot dargestellt. + +---------------------- +- 31. Mai 2004 - +---------------------- +Unk: SMIRC empfngt nun verfgbare User-Modi beim Verbinden vom Server, um um auch nicht-Standard-Usermodi zu erlauben. +Unk: SMIRC erstellt nun ein dynamisches Nick-Men, welches die verfgbaren Op-Kommandos enthlt, abhngig vom markierten User und den verfgbaren UserModi. +Unk: SMIRC kann nun eine Nickliste vom Server verarbeiten, welche ALLE Usermodi enthlt - nicht nur die Haupt-Modi. +Unk: SMIRC kann nun erkennen, welcher Typ von MODE-Change gettigt wurde, um diesen korrekt zu verarbeiten und anzuzeigen. + +---------------------- +- 27. Mai 2004 - +---------------------- +bluecow: Korrektur eines Fehlers, welcher einen inkorrekten Wert fr "fertiggestellte Gre" fr Tempdateien zur Folge hatte. +bluecow: mehrere kleine Fehlerkorrekturen und Optimierungen bei der Nutzung des Bar-Shaders fr Tempdateien und downloading/uploading Clients. +bluecow: Korrektur eines Fehlers, welcher zufllig gelbe Blcke in Quellenanzeigen zeichnete. +Ornis: Kategorie-weites Fortsetzen von Downloads bercksichtigt nun auch "zu wenig Speicherplatz"-pausierte Downloads. + +---------------------- +- 26. Mai 2004 - +---------------------- +bluecow: Korrektur eines Fehlers, beim Angeben leerer Verzeichnisse fr Temp- und Eingangsverzeichnis. +bluecow: hinzugefgt: Server-LowID-Statistik zum Server- und Statistikfenster. +bluecow: hinzugefgt: Statistiken fr die, durch I.C.H. gerettete Daten +bluecow: hinzugefgt: Speichern/Wiederherstellen von fehlerhaften Partlisten zur part.met-Datei von Downloads. So dass I.C.H. an diesen Blcken auch nach einem Neustart arbeiten kann. + +---------------------- +- 23. Mai 2004 - +---------------------- +bluecow: Korrektur eines potentiellen Crashbugs unter Win98 mit Icons im Suchparameter-Fenster. +bluecow: Korrektur eines Fehlers mit falscher Part-Anzahl bei sehr groen Dateien. [thx Pichuein] +bluecow: Korrektur eines Fehlers im Einstellungen/Verzeichnisse-Fenster, welcher das aktive Verzeichnis vernderte. +Ornis: Korrektur eines Fehlers in der Toolbar, welcher beim Entfernen aller Knpfe auftrat. +Ornis: (mgliche) Korrektur des vereinzelt auftretenden Fehlplazierens des Kategorien-Reiters +Ornis: Korrektur eines Webinterface-Exploits (content lengt-Missbrauch) + +---------------------- +- 19. Mai 2004 - +---------------------- +bluecow: Im Freigegebene Dateien-Fenster ist gibt es neuen einen Menpunkt um Ed2K-links mit einem Hashset zu erzeugen + +---------------------- +- 14. Mai 2004 - +---------------------- +bluecow: Ein Bug im fr in der Datenratenkontrolle Raten ber 90KB wurde behoben [thx zz] + +---------------------- +- 13. Mai 2004 - +---------------------- +bluecow: Dateien mit fehlendem Hashset werden nun richtig behandelt beim komplettieren +bluecow: Dateien ohne Hashsets werden nicht mehr freigegeben bis sie komplett sind oder ein Hashset empfangen +bluecow: Untersttzung fr HTTP-Umleitung bei Webquellen wurde hinzugefgt +bluecow: Neue Icons fr Webquellen im Transferfenster +bluecow: Neue Einstellung fr preferences.ini fr Speicherintervall der Statistik: Sektion "Statistics", Keyword "SaveInterval" +Ornis: Titel tags fr images im Webinterface template "chicane" [mARKUS] + +---------------------- +- 12. Mai 2004 - +---------------------- +bluecow: Einfgen von erweiterten eD2k links fr http-Quellen und Hashsets hinzugefgt +bleucow: eMule kann nun auch von HTTP-Quellen downloaden (Webquellen) + +---------------------- +- 11. Mai 2004 - +---------------------- +Unk: Der Kern von SMIRC wurde neu geschrieben um ihn stabiler und schneller zu machen +Unk: Ein Bug beim empfangen von langen Nachrichten auf dem IRC-Socket wurde behoben +Unk: Der SMIRC Verbindungsstatus zeigte gelegentlichen falsche Informationen +Unk: Ein einfacher Nicknameerzeuger wurde im SMIRC eingebunden +Unk: zz's USS (UploadSpeedSense) und Throttler wurden geupdated + +---------------------- +- 10. Mai 2004 - +---------------------- +bluecow: Ein Crash beim downloaden von verschiedenen Dateien mit gleichem Namen und Neuladen der freigegebenen Dateien-Liste wurde behoben +bluecow: periodischen Schreiben der Statistikdaten-Datei wurde optimiert + +---------------------- +- 4. Mai 2004 - +---------------------- +bluecow: Komplette Dateien mit fehlendem hashset werden nun am Dateihash berprft +bluecow: Im Suchdialog sollten nun keine doppelten Scrollbalken mehr auftauchen +blueocw: Kad Suchausdruck-Verarbeitung: Das Kad Schlsselwort ist nun ein Teil des Ed2k-Suchausdruckes + + +---------------------- +- 3. Mai 2004 - +---------------------- +bluecow: ein Bug beim Empfangen von neuen ed2k Metatags wurde behoben +bluecow: das automatische Wiederherstellen von Suchparametern beim Anwhlen/Schlieen alter Suchen wurde wieder entfernt +bluecow: das Speichern der onlinesig.dat wurde berarbeitet um andere Programme, die diese Datei lesen besser zu untersttzen +bluecow: die Dateizugriffseinstellungen wurden gendert um anderen Programmen "Nur-Lesen" Zugriff zu erlauben +bluecow: ed2k and Kad suchen haben nun einen Icon welches zeigt ob sie grade in arbeit oder schon abgeschlossen sind +bluecow: Inaktive Suchergebnisseiten zeigen neu empfangene Ergebnisse durch roten Text im Tab an + + +v0.42f +---------------------- +- 1. Mai 2004 - +---------------------- +bluecow: Dateifehlerbehandlung beim Schreiben der onlinesig.dat hinzugefgt +.: Korrektur eines Fehlers, welcher eine zu schnelle Warteschlangenrotation verursachte, wenn die Option "mglichst volle chunks uploaden" deaktiviert war + +---------------------- +- 30. April 2004 - +---------------------- +bluecow: Fehlerbehebung im Kad Tagname Stringvergleich, im Zusammenhang mit multi byte character pages. [thx Big Mamma] +bluecow: Fehlerbehebung beim generellen Stringvergleich, welcher von Spracheinstellungen abhhing. +Ornis: Problembehebung von springenden Kategorie-Tooltips +Ornis: 2 weitere Statistiken zu Kategorien-Tooltips hinzugefgt + +---------------------- +- 29. April 2004 - +---------------------- +Unk: Wenn ein Client mehrmals nicht auf UDP Pakete antwortet, wird eine TCP Verbindung erzwungen +Unk: maximale Anzahl von Upload-Slots erhht, um sehr hohen Bandbreiten gerecht zu werden + +---------------------- +- 24. April 2004 - +---------------------- +bluecow: Kontextmen fr schliessbare Tabcontrols bei den Suchresultaten, Nachrichten und IRC-Chat-Tab hinzugefgt, um eine weitere Mglichkeit zum Schliessen zu bieten +Unk: mehrere Bereiche im Code wurden angepasst, um Clients mit *.*.*.0 -IPs zu helfen, welche im ed2k Netzwerk immer als LowID gefhrt werden +Unk: Fehlerbehebung: Wenn zu einem Server verbunden wurde, wurden die freigegebenen Dateien nicht bekannt gegeben, es sei denn, etwas in der Freigabeliste nderte sich [thx lugdunummaster] +Unk: Korrektur eines Fehlers, welcher es erlaubte, das "Mehr"-Kommando zu einem fascjem Suchfenster zu nutzen + +---------------------- +- 22. April 2004 - +---------------------- +.: wenn eMule mit Administratorrechten gestartet wird, knnen nun fr eMule diese Privilegien eingeschnkt werden, um ihn unter einem sichereren Benutzer-Account laufen zu lassen (Win 2k/XP) - dies kann in den Einstellungen / Sicherheit aktiviert werden +.: MobileMule Protokoll auf 0.8a aktualisiert +Unk: Kad - Benutzerabschtzung basiert nun nicht mehr auf den Nutzerzahlen von Overnet, da diese Zahl zu hoch zu sein scheint.... (knnte fr manche Nutzer noch immer hoch erscheinen, wird dann noch verbessert werden) +Unk: obwohl ich den Doppel-Text-Fehler im IRC nicht nachstellen konnte, wurden einige Dinge gendert, die dies verursacht haben knnten + +---------------------- +- 21. April 2004 - +---------------------- +bluecow: boch ein Absturzfehler beseitigt, welcher beim Umbenennen von fertiggestellten Dateien im Transferfenster auftrat +bluecow: mehrere nderungen in den Client-Statistiken: detaillierterte aMule-Versionsstatistiken, lphant ClientErkennung hinzugefgt, cDonkey zu den "eMule kompatibel" verschoben, und mehr... +bluecow: Suche nach eD2K-Datei-Hashes auf eD2K-Servern hinzugefgt. Um nach einem Datei-Hash zu suchen, gebe als Suchbegriff "ed2k::" an, oder den kompletten ed2k-Link [thx lugdunummaster] +bluecow: numerische Suchparameter werden nun auf sinnvolle Werte geprft, um ungltige Sucheausdrcke zu vermeiden. + +---------------------- +- 20. April 2004 - +---------------------- +bluecow: Fehler bei der globalen Serversuche korrigiert, welcher endlose Namen Anfragen in seltenen Situationen generieren konnte. [thx lugdunummaster] +bluecow: werden fertiggestellte Dateien vom dem "freigegebene Dateien"-Fenster aus gelscht, werden sie auch aus der Transfer-Anzeige entfernt +bluecow: Download-Statistiken fr UDP-File reask hinzugefgt + +---------------------- +- 19. April 2004 - +---------------------- +bluecow: Behebung von Fehlern, bzgl "letzter Empfang" und DST + +---------------------- +- 15. April 2004 - +---------------------- +bluecow: Absturzfehler beseitigt, welcher beim Umbenennen von fertiggestellten Dateien im Transferfenster auftrat +bluecow: kleine Fehlerkorrektur bzgl. AutoTakeEd2kLinks +Ornis: Kategorieauswahl zur "Download durch ed2k-Links"-Box hinzugefgt + +---------------------- +- 14. April 2004 - +---------------------- +bluecow: Korrektur eines "Fenstergre-ndern-Absturzfehlers" im Nachrichten-Fenster +bluecow: Nachrichten und IRC-Nachrichten auf 450 Zeichen begrenzt + +---------------------- +- 13. April 2004 - +---------------------- +bluecow: das Auslesen von Metadaten aus OGM/OGG-Datei wurde deaktiviert, da zu viele Probleme damit im Zusammenhang mit DirectShow-Filter berichtet wurden +Unk: IRC-Namen akzeptiert nun wieder Kleinschreibung +Unk: das Publishing von Kad stoppt nun in Echtzeit, um etwas Overhead zu sparen + +---------------------- +- 11. April 2004 - +---------------------- +bluecow: es knnten nun Dateien mit neuen Metadata Tags bei ed2k Servern bekannt gemacht werden [thx lugdunummaster] +bluecow: Fehlerkorrektur bzgl. Fehler-Messageboxen, welche durch eine ferngesteuerte Suchanfrage auftreten konnten +Ornis: einige kleinere GUI Erweiterungen und -korrekturen + +---------------------- +- 10. April 2004 - +---------------------- +bluecow: neue ed2k-Metadaten-Tags knnen geparsed werden [thx lugdunummaster] + +---------------------- +- 9. April 2004 - +---------------------- +bluecow: hinzugefgt: andockendes/frei bewegbares Such-Parameter-Fenster im Suchfenster + +---------------------- +- 7. April 2004 - +---------------------- +bluecow: sichereres Parsen der neuen OP_SERVER_DESC_RES Server Pakete +bluecow: besseres Parsen von ungenutzen eD2K meta data tag Typen +bluecow: Speicherleck korrigiert, welches im Zusammenhang mit known files Eintrgen und ungltigen Hashsets auftreten konnte [thx bzubzu.] + +---------------------- +- 6. April 2004 - +---------------------- +bluecow: Sortierfehler in der Liste der bekannten Clients korrigiert +bluecow: Syntax-Coloring im Suchdialog entfernt - hat zu viele Probleme bei einigen Sprachen verursacht +Ornis: Suche im Webinterface korrigiert (Verfgbarkeit=0) + +---------------------- +- 3. April 2004 - +---------------------- +bluecow: Strg+C Tastenkombination zu allen Listviews hinzugefgt, um eD2K-Links zu kopieren +bluecow: Strg+V Tastenkombination zum Einfgen von Servern aus der Zwischenablage, innerhalb der Server-Liste +Unk: Transfer: brige Zeit wird fr im Wartestatus befindliche Dateien, basierend auf bisheriger Warte- und Transferzeit, berechnet (Dateien, welche mit alten Clients oder Mods gestartet wurden, knnen seltsame Werte bringen) + +---------------------- +- 2. April 2004 - +---------------------- +bluecow: Jigle-Suchmethode entfernt +bluecow: Hilfe ist nun kontextsensitiv (F1 innerhalb eMule drcken) + + +v0.42e +---------------------- +- 1. April 2004 - +---------------------- +Ornis: Javascript-Abhngigkeit der Webinterface-Templates reduziert + +---------------------- +- 31. Mrz 2004 - +---------------------- +bluecow: Einfgen-Kommando fr ed2k-Datei/Server-Links ins Kontexmen des Transfer- und Server-Fenster hinzugefgt +bluecow: Memoryleak in der Kad-Paket-Verarbeitung korrigiert [thx bzubzu] + +---------------------- +- 30. Mrz 2004 - +---------------------- +bluecow: Security exploit im IRC_Modul und Webserver korrigiert (aka DecodeBase16 exploit) [thx DonDiego] + +---------------------- +- 29. Mrz 2004 - +---------------------- +bluecow: eigener Dialog fr das Einfgen von ed2k-Links hinzugefgt (zuvor 'Direkt Download' genannt). Der Dialog kann vom Tool-Men (Toolbar) oder Hotmenu (Alt X) aufgerufen werden +bluecow: Erkennung des MLdonkey-kompatibler Client-Tags hinzugefgt + +---------------------- +- 28. Mrz 2004 - +---------------------- +bluecow: Crashbug korrigiert, welcher beim Lschen von ausgeklappten Surchresultaten auftreten konnte +Ornis: wird der Kategorie-Dialog nach dessen Erstellung abgebrochen, wird die neue Kategorie nicht bernommen + +---------------------- +- 27. Mrz 2004 - +---------------------- +bluecow: Untersttzung fr das neue eserver v16.45 UDP description Paket + +---------------------- +- 25. Mrz 2004 - +---------------------- +Ornis: Sicherheitslcke im Webserver gefixt [thx fr Tipp an MKThunderStorm] +bluecow: Syntaxhighlighting fr Suchnamen (expression) +Unk: /topic und /msg funktioniert nun im IRC +Unk: einige nderungen, wie komplette Quellen ermittelt werden + - bessere Angabe bei kompletten Dateien + - tote Dateien haben komplette Quellen angezeigt. Dieses Verhalten sollte mit steigender Anzahl von Upgrades verschwinden. + +---------------------- +- 24. Mrz 2004 - +---------------------- +bluecow: Fehler-/Hilfenachrichten fr fehlerhafte Kad-Suchausdrcke hinzugefgt + +---------------------- +- 23. Mrz 2004 - +---------------------- +bluecow: Dateinamen-Detaildialog nutzt nun die Systemicons fr die Anzeige der Dateien des entfernten Clients + +---------------------- +- 21. Mrz 2004 - +---------------------- +bluecow: einige kleine Fehler in der ed2k-Suche in Bezug auf Vergleichsoperatoren behoben +bluecow: mehr Vergleichsoperatoren zur Kad-Suchausdrucks-Verarbeitung hinzugefgt + +---------------------- +- 20. Mrz 2004 - +---------------------- +bluecow: einige neue Suchparameter (komplette Quellen, Lnge, Bitrate, Codec, Titel, Album, Knstler) hinzugefgt +Ornis: Einstellungen/Anzeige: Option zum Lschen oder Deaktivierung der Autovervollstndigung (Historyfunktion) (Suchbegriff und Servermet-URLs) hinzugefgt. (Die History kann weiterhin mit Strg+Entfernen manuell gelscht werden! siehe Hilfe!) + +---------------------- +- 19. Mrz 2004 - +---------------------- +bluecow: Webservices aufgeteilt in Dateibasierte und allgemeine URLs. allgemeine URLs werden nur in Tools/Links angezeigt + +---------------------- +- 18. Mrz 2004 - +---------------------- +bluecow: Crashbug korrigiert, welcher beim Download von bereits heruntergeladenen Dateien auftrat, die bereits in der knownfile-Liste waren + +---------------------- +- 16. Mrz 2004 - +---------------------- +bluecow: Korrektur eines Fehler beim Wiederherstellen von block requests von komprimierten Paketen, nachdem ein zstream-Fehler auftrat + +---------------------- +- 15. Mrz 2004 - +---------------------- +bluecow: Hinzugefgt: 'aktive Downloadzeit' Statistik zu Partfiles (Dateidetailsdialog), welche die Zeit angibt, welche die Datei aktiv in der Downloadqueue war. +bluecow: Hinzugefgt: fertiggestellte Dateien werden den Servern bekannt gemacht, um die "komplette Quellen"-Info zu aktualisieren +bluecow: Korrektur eines Fehlers: Neuladen der freigegebenen Dateien, welche gerade fertiggestellt wurden und extern gelscht/umbenannt wurden - um falsche Anzeige zu vermeiden + +---------------------- +- 14. Mrz 2004 - +---------------------- +bluecow: mgliches Memleak bei der OP_REQUESTPARTS Nachricht behoben [thx eklmn] +bluecow: Untersttzung fr integer media length eD2K tag fr Server und Clients hinzugefgt [thx lugdunummaster] +bluecow: Hinzugefgt: Senden von grundlegendem Dateistatusinformationen (komplett/nicht komplett) an Server +bluecow: hinzugefgt: von Servern empfangende Anzahl kompletter Quellen, werden mit der Verfgbarkeit in der Suchresultatsliste angezeigt +bluecow: Hinzugefgt: Anzeige von freigegebenen Dateien anderer Clients bertrgt nun auch die Anzahl kompletter Quellen +unk: IRC speichert nun deinen zuletzt verwendeten Nick +unk: einige weitere IRC-Infonachrichten-Optionen hinzugefgt + +---------------------- +- 13. Mrz 2004 - +---------------------- +bluecow: konfigurierbares Vorschau-Kommando hinzugefgt (neue Konfig-Datei: PreviewApps.dat) + + +v0.42d +---------------------- +- 7. Mrz 2004 - +---------------------- +.: Ein Bug der eMule crashen lie sobald zu viel Belastung auf dem UDP Socket war wurde behoben + +v0.42c +---------------------- +- 5. Mrz 2004 - +---------------------- +bluecow: Problembehebung vom Rehashen beim Wechseln von Sommerzeit/Winterzeit [MightyKnife]. Um diesen Patch zu deaktivieren, trage "AdjustNTFSDaylightFileTime=0" in die "[eMule]" Sektion der preferences.ini -Datei ein. + +---------------------- +- 3. Mrz 2004 - +---------------------- +bluecow: Fehlerbehebung mit Farben und Bekanntheitstyp in der Suchliste, nachdem Dateien angebrochen und/oder Dateien von der Freigabe gelscht/hinzugefgt wurde +bluecow: Fehlerbehebung der Sortierung von Kategorien in der Downloadliste +Unk: USS wird temporr deaktiviert, wenn ein Uploadgeschwindigkeitslimit von 10K unterschritten wird - bis wir einige Probleme bei geringen Geschwindigkeiten beseitigt haben + +---------------------- +- 2. Mrz 2004 - +---------------------- +bluecow: Fehlerbehebung im UDP Socket, ReaskFilePings wurden fr Dateien in vielen Fllen nicht beantwortet +bluecow: Fehlerbehebung im IP Filter; angrenzende Bereiche verschiedener Levels werden nicht mehr zusammengefgt +Unk: IRC verarbeitet nun auch Klnge. (/sound [*.wav] [Nachricht]) (Klnge werden im "../eMule/Sounds/IRC" -Verzeichnis erwartet) +Unk: Behebung eines KadID Fehlers, welcher einige Cluster erzeugte und fehlerhafte User-Zahlen erzeugte + +---------------------- +- 1. Mrz 2004 - +---------------------- +Unk: Pakete fr die UDP Socket-Sendequeue haben nun eine Lebenszeit, um Rckstnde zu verhindern + +---------------------- +- 29. Februar 2004 - +---------------------- +Ornis: Korrektur, dass 2 Dateien fortgesetzt wurden in der Funktion "bei fertigem Download, nchste Datei forsetzen" +Ornis: Korrektur in der Statistik fr Quellenherkunft (passive) - und verschiedene kleine GUI Fixes +bluecow: Korrektur beim Aufruf der Kommentarinfos (entsprechender Tab wurde nicht aktiviert) +Ornis: Korrektur des Chicane Webinterface Templates, bzgl. Downloads aus Suchergebnissen heraus starten +Unk: IRC Crash-Fehler behoben - Dank einiger Meldungen von IRC-ops +Unk: Korrektur der Option, IRC Links nur von Freuden anzunehmen +Unk: IRC-Standardname erhlt einen zuflligen Pseudo-Nick, um Nick-Kollisionen zu vermeiden +Unk: Extra IRC Filter Optionen + +---------------------- +- 28. Februar 2004 - +---------------------- +bluecow: Problembehebung in einer Ausnahmebehandlung, welche nicht sofort die Verbindung zum Client trennte, welcher ungltige Dateidatenpakete schickt +bluecow: Fehlerbehebung beim UDP-Socket bei der Verarbeitung eines empfangenden Dateistatus +bluecow: Korrektur einiger Probleme im Kad-Fenster bei den Verbinden- und Bootstrap Funktionen/Buttons +Unk: Ping Info fr USS wieder eingearbeitet - und kleinere Anpassungen an USS gettigt - zz +Unk: einige Debug-Infos aus den Upload-Balken entfernt + + +v0.42b (Hotfix) +---------------------- +- 27. Februar 2004 - +---------------------- +Unk: dringende Fehlerbehebung im Keyword Publishing + +v0.42a +---------------------- +- 27. Februar 2004 - +---------------------- +Ornis: verschiedene kleine Korrekturen an der GUI + +---------------------- +- 22. Februar 2004 - +---------------------- +bluecow: mehrere nderungen und Optimierungen an den Verbose-Log Optionen +Unk: (hoffentlich) weitere Reduzierung des Keyword-Overheads, durch das Publishen von nur kompletten Dateien. + +---------------------- +- 21. Februar 2004 - +---------------------- +bluecow: neues Verbindungs-Status-Icon zeigt nun separat den Nertzwerkstatus des Ed2k und des Kad Netzwerkes und den LowID/HighID Status + +---------------------- +- 20. Februar 2004 - +---------------------- +bluecow: neuer Code zum Auslesen der AVI-Eigenschaften fr die Datei-Info-Anzeige +bluecow: Extra Thread fr das Auslesen der Audio/Video -Eigenschaften von mehreren Dateien ber die Datei-Info-Anzeige + +---------------------- +- 19. Februar 2004 - +---------------------- +bluecow: optionale Untersttzung fr die MediaInfoLib hinzugefgt (http://mediainfo.sourceforge.net) um Audio/Video -Eigenschaften von Tempdateien und freigegebenen Dateien auszulesen. Dieses Feature ist optional und wird nur verwendet, wenn Version 0.4.0.1 der MediaInfoLib (MediaInfo.DLL) ins eMule-Programmverzeichnis kopiert wurde. + +---------------------- +- 18. Februar 2004 - +---------------------- +bluecow: Zusammenfhrung von Audio/Video-Eigenschaften in der Dateiinfo-Anzeihe. Alle Audio/Video Eigenschaften von allen ausgewhlten (part-)Dateien werden zusammengefasst um mehrere Dateien auf gleiches Audio/Video Format zu berprfen. + +---------------------- +- 16. Februar 2004 - +---------------------- +bluecow: neue Spalte in der Suchresultatsliste hinzugefgt, um lokal ermittelte Dateiinfos anzuzeigen. + +---------------------- +- 15. Februar 2004 - +---------------------- +bluecow: Such-Typ bzw. Anfrage der freigegebenen Dateien werden fr jede Sucheresultatsliste separat angezeigt +bluecow: automatische Erstellung einer 'downloads.txt'-Datei im eMule-Programmverzeichnis. Diese Datei enthlt die Dateinamen der aktuellen Tempdateien (.part) und den ed2k-Link um Untersttzung bei verlorengegangenen part.met-Dateien zu geben. + +---------------------- +- 14. Februar 2004 - +---------------------- +bluecow: Windows thumbs.db -Dateien ohne System-Attribut werden nicht freigegeben +bluecow: durchgngige Behandlung der maximalen Namenslnge (Nickname) + +---------------------- +- 12. Februar 2004 - +---------------------- +bluecow: verbesserte Tab-Kontrollen im Server- & Chat-Fenster, um ungelesene Nachrichten zu kennzeichnen + +---------------------- +- 10. Februar 2004 - +---------------------- +bluecow: Webservices Meneintrge werden gecached +bluecow: Fehlerkorrektur von Multithreading-Problemen bei der Dateifertigstellung +bluecow: Korrektur einiger Probleme mit doppelten Eintrgen in der known-file-Liste und der Liste freigegebener Dateien + +---------------------- +- 9. Februar 2004 - +---------------------- +bluecow: viel Protokoll-Logging und Debug-Code implementiert +bluecow: verschiedene Optimierungen bei der Verarbeitung von Suchausdrcken fr den Keyword-Index hinzugefgt +bluecow: UDP-Socket-Ausnahmebehandldung erneuert +Unk: Suche und Keywordindexing getrennt, um sptere genauere Optimierungen zu erlauben + +---------------------- +- 6. Februar 2004 - +---------------------- +bluecow: mehr Logging-Optionen in den erweiterten Einstellungen hinzugefgt +Unk: Kad erlaubt nun kleinere lokale Netzwerke, wenn LANIP-Filtern deaktiviert wurde. (dies sollte nur frs Debugging und Testen genutzt werden!) +Unk: viel Kad-Code wurde zur Benutzung von CSafeMemFile gendert. Um die Konvertierung zu verfollstndigen, mssen noch die Kad-Tags und Kad's-Taglist angepasst werden, um damit zu arbeiten... +Unk: wenn Duplikate in der KnownFileList entdeckt werden, werden die Statistiken zusammengefhrt + +---------------------- +- 4. Februar 2004 - +---------------------- +bluecow: interne Speicherung von Einstellungen berarbeitet +bluecow: Fehler beseitigt, betreffend von Suchresultaten gestartete Downloads im Pause-Mode, welche durch die Suche ermittelte Quellen nicht bernahm +Unk: knownfilelist-Implementierung berarbeitet. Zuvor waren Mehrfacheintrge mglich. + +---------------------- +- 3. Februar 2004 - +---------------------- +bluecow: Fehlerkorrektur in der Kad keyword publishing Liste, hervorgerufen durch die Umbenennung einer freigegebenen Datei, die in der aktuellen Session fertiggestellt wurde + +---------------------- +- 2. Februar 2004 - +---------------------- +bluecow:Fehlerkorrektur in der Kad-Suche, bei Benutzung von AND +. : bernahme des erweiterten Trayicon-Mens [eMule+] + +---------------------- +- 1. Februar 2004 - +---------------------- +bluecow: IP-Filter berarbeitet + - IP Suche fr geringere CPU Belastung optimiert + - Laden der IP-Filterliste optimiert + - automatische Verschmelzung von berlappenden und angrenzenden Filter-Bereichen + - sichere Erkennung des IP-Filter-Formates (eMule IP filter Liste und PeerGuardianformat). + - grere Toleranz im eMule-IP-Filter-Format (Level und Beschreibung sind jetzt optional!). + - einfacher IP-Filter Dialog hinzugefgt, fr einfache nderungen und Ansicht von IP-Filtern (Erreichbar ber das Tools-Men). + - IP-Filter Treffer in Statistik +Unk: Fehlerkorrektur im UDP Port, welcher UDP-Pakete zu toten Clients sendete + +---------------------- +- 29. Januar 2004 - +---------------------- +Unk: groe berarbeitung des Kad codes... + - Kad ist nun Teil von eMule's Thread, so dass Nebenlufigkeitsprobleme minimiert wurden + - Auch wenn manche sagen, dass dies ein Performanceverlust ist denke ich, dass die Vereinfachung des Codes dies wieder ausgleicht. + - Kad nutzt nun den UDP Port von eMule (ed2k) (und eMule's TCP Port in der Zukunft) - statt des eigenen. + +---------------------- +- 27. Januar 2004 - +---------------------- +bluecow: neuer Daten (Pakete + Dateien) Verarbeitungs-Code fr geringere CPU Last + +---------------------- +- 25. Januar 2004 - +---------------------- +Unk: Korrektur einiger Probleme, welche auftraten wenn eine Tempdatei fertiggestellt wurde. + +---------------------- +- 22. Januar 2004 - +---------------------- +bluecow: Fehlerkorrektur: falsches Kategorie-Verzeichnis wurde fr neu erstellte Downloads angezeigt +bluecow: Korrektur einer printf-Schwche mit den Kategorien-Verzeichnissen +bluecow: Korrektur eines Problems mit leeren Datei-Datenpaketen, welche die Gap-Liste zerstren konnte +bluecow: Korrektur eines Timingproblems im PerfLog Modul. +bluecow: Korrektur eines Statistik-Fehlers bzgl I.C.H. im Download-Session-Zweig + +---------------------- +- 19. Januar 2004 - +---------------------- +bluecow: Korrektur: Wenn der allererste heruntergeladene Teil einer Datei von I.C.H. wiederhergestellt wurde, wurde die Datei nicht geshared, bis ein anderer Teil ohne I.C.H. fertiggestellt wurde +Unk: eingenende ExtendedFileInfo wurde angenommen, ohne die Versionsnummer zu prfen. - Korrigiert + - Diese Korrektur zeigte, dass einige ltere eMule Mods und Shareaza (und vielleicht einige andere Mods) hier falsche Versionnummern senden + - Diese sagten, dass sie die ExtendedFileInfo untersttzen - woraufhin wir unsere Info senden und vergeblich auf Antwort warten. +Unk: Ein Bereich des ED2K Protokolls wurde ins eMule Protokoll gelagert. Dies erlaubt es uns, mehrere ED2K-Pakete in nur einem Paket zu senden und so etwas Overhead zu sparen. +Unk: Der UDP-file reask aktualisiert nun den FileStatus und bermittelt die ExtendedFileInfo. +Unk: File reask wurde erweitert um Overhead zu verringern +Unk: Quellenaustauschzeiten wurden fr weniger Overhead angepasst. (bentigt evtl. einen Reset des received source request time check auf ltere Werte, um ltere Clients zu schonen. Braucht Tests.) + +---------------------- +- 17. Januar 2004 - +---------------------- +Unk: Korrektur von Fehlern im Switch zur Verarbeitung von Quellen eines Downloads +Unk: Korrektur eines Fehlers, der es dem Client erlaubte, einen UDP und TCP Filereask zur gleichen Zeit durchzufhren +Unk: NNP-Quellen konnten einen UDP-Reask durchfhren, welcher nicht unsere Chunk-Infos aktualisierte - was daher ein verschwendetes Paket war. +Unk: Fehlerkorrektur: Es war mglich (wenn auch unwahrscheinlich) fr einen Client, ein UDP reask zu einem Client zu ttigen, ohne ein TCP reask zuvor. +Unk: AskForDownload() gibt nun ein Resultat zurck, um zu Reagieren wenn die Quelle gelscht wurde. +Unk: Es wird nun nur Kad Overhead gezhlt, der tatschlich gesendet wurde, nicht gequeued oder fehlgeschlagen ist. +Unk: Korrektur: Clients ohne gltige Dateianfrage konnten in die Warteschlange kommen. +Unk: Es gab drei verschiedene Methoden um eine Uploadliste pro Datei zu erstellen. Manche erstellten diese Liste jedes Mal neu. Jetzt wird die Uploadliste pro Client in Echtzeit gepflegt, um dies zu vermeiden. +Unk: Quellenaustausch fr eine fertiggestelle Datei wird nun wie fr ein Part-file behandelt. Es werden nur Quellen gesendet, welche Chunks haben, die der User braucht. + +---------------------- +- 15. Januar 2004 - +---------------------- +Ornis: Neu: IP-Filter-Liste im PeerGuardian-Format kann nun auch eingelesen werden +Ornis: Neu: Einstellungen/Sicherheit: Option zum Download einer Ipfilter-Liste von einer URL +Ornis: Fix: Behandlung des Abbrechens von Download-Dateien, deren Platz gerade reserviert wird. Diese werden verzgert nach der Platzreservierung entfernt. +bluecow: Kommando zum Abfragen der freigegeben Dateien ist deaktiviert, wenn die Gegenseite dieses Feature nicht untersttzt. +bluecow: Fehlerkorrektur bei der Abfrage der freigegebenen Dateien eines anderen Clients. Partfiles (aktuelle Downloads) wurden nicht angezeigt. +bluecow: Verringerung der Speichernutzung von Client-Instanzen #2. +bluecow: Korrektur der Kad UDP Socket Nutzung, um ein Verlieren von zu sendenden Paketen zu vermeiden. +bluecow: Optimierte Client-Listenanzeige fr weniger CPU-Last. +bluecow: Korrektur einiger Probleme in Kontextmens, Shortcuts und der Nutzung des mittleren Maustaste. +Unk: verbessertes Filtern von sich selbst als eigene Quelle +Unk: Korrektur eines Fehlers, welcher manche Kad-Quellen blockierte, wenn die Datei viele Quellen von einem Server oder Quellenaustausch erhielt. Wir empfangen nun alle eingehenden Kad-Quellen. +Unk: LowID Callbacks hatten Probleme bei gewissen Kad- und ED2K Zustnden verursacht. Dies wird nun genauer geprft. +Unk: Nodal Suchen fr das Publishing erweitert, um volles Publishing zu ermglichen. Nodal Suchen nach Quellen wurde eingeschrnkt, um Overhead mit sehr seltenen Dateien zu reduzieren. + +---------------------- +- 10. Januar 2004 - +---------------------- +bluecow: Einige nderungen fr bessere Winsock Initialisierung Terminierung. +bluecow: Korrektur und Erweiterung von Statistiken fr den Datei-Datentransfer. +Unk: Nodal Suchen werden nun mit Verzgerung gelscht (wenn erlaubt). Dies ermglicht es hngenden eingehenden Paketen noch empfangen zu werden. (in anderen Worten, wir verschwenden keine eingehenden Pakete (mehr) ) +Unk: Es gab einen Fehler, mit dem Verfallstimer fr Nodal Suchen, wenn alle hngenden Kontakte abgebaut wurden. +Unk: Keyword republishing wird lnger verzgert, um den Overhead zu verringern. + + +0.41b.29 Test release +---------------------- +- 05. Januar 2004 - +---------------------- +bluecow: Korrektur mehrerer Schwchen in der Client- und Server-Overhead-Berechnung. (DESHALB wird ein hherer Overhead angezeigt werden). +bluecow: Hinzugefgt: Kademlia Overhead-Statistiken +bluecow: Hinzugefgt: Client-Protokoll Handshake berprfung +bluecow: Um die Verbreitung von falschen Metadaten zu vermeiden, werden (bereits) erhaltene Metadaten ignoriert und lokal durch Betrachtung des Dateiinhaltes neu erstellt. +bluecow: Fehlerkorrektur in der Statistik bzgl. der Server-Verbindungszeit [Gnaddelwarz] +Unk: Keyword-Publishing wird verzgert durchgefhrt, um eine berflutung des Netzwerkes von Usern zu vermeiden, wleche nur eine sehr kurze Zeit verbunden sind + +---------------------- +- 04. Januar 2004 - +---------------------- +bluecow: Hinzugefgt: thread safe synchronous command processing fr Kad-Listen-Socket. (in Achtung der deutschen Sprache, bersetze ich das nicht weiter!) +bluecow: Hinzugefgt: explizites Entfernen von Datei Block-Requests fr bereits getrennte Clients, um Datei-Fertigstellungs-Probleme zu vermeiden +bluecow: Korrektur von Sortierproblemen in der Liste freigegebener Dateien +bluecow: Fix eines Fehlers im structured exception handling des Client TCP Sockets. +bluecow: bereits empfangene aber nicht verarbeitete Pakete werden nun verworfen, wenn die Verbindung mit dem Client geschlossen wurde +bluecow: potentieller Crash beim Lschen eines Clients gefixt - im Zusammenhang mit dem IP-Filter +bluecow: Client-Protokoll Prozedurstatus-Fehler werden im Log protokolliert + +---------------------- +- 31. Dezember 2003 - +---------------------- +Unk: bergabe von Kademlia log Nachrichten an eMule jetzt thread safe. Sollte einige Probleme unter Win98 beheben +Ornis:Liste freigegebener Dateien bietet fr die Dateien via Kontextmen das Umbenennen, Lschen und Verzeichnis ffnen + (Lschen in Papierkorb! preferences.ini: "RemoveFilesToBin=false" fr wahrhaftiges Lschen) +Unk: Temporary Fix: Clients ID wird nur upgedatet, wenn ein Kad-Kontakt zur Liste hinzugefgt wird. Dies scheint Win98-Freeze zu verhindern. +Unk: kleine nderung in der Kad-Suchtoleranz und Bootstrapping. + +---------------------- +- 30. Dezember 2003 - +---------------------- +Ornis: Datei-Details-Dialog, Dateinamen-Reiter: Verbesserung der Auflistung und Sortierung von verfgbaren Dateinamen +Ornis: Platzreservierung von Tempdateien nicht mehr blockierend (Thread+Buffering) +Ornis: Downloadliste: Sortierung der Spalte "Verbleibend" fr Dateien nun im "4-Wege-Modus", um nach verbleibender Gre ODER verbleibender Zeit zu sortieren +Unk: Automatischer Kad-Bootstrap, wenn versuchst wird zu Kad zu Verbindungen und ein Kad-Client gefunden wird +Unk: Bootstrap nun wahlweise von IP&Port oder mittels eines Kad-Clients aus der aktuellen Liste der bekannten Clients +Unk: der Client erkennt nun Konflikte in der UDP-Port-Vergabe, um Programmhnger vorzubeugen +bluecow: Detail-Dialog fr Downloads berarbeitet. Fr Mehrfachauswahlen werden Summen ber verschiedene Werte gebildet +bluecow: Spalte "Erlaubnis" bei den freigegeben Dateien entfernt weil funktionslos +bluecow: Smtliche Kontextmens in den Hauptfenstern Suche, Server, Download und Dateien berarbeitet um Mehrfachauswahlen zu erlauben +bluecow: Fehler beim ersten Start von eMule im Assistenten behoben wenn die Option "Minimiert starten" aktiviert ist +bluecow: Option um das letzt genutzte Hauptfenster beim Start wiederherzustellen hinzugefgt. Hierfr in der prferences.ini den Wert RestoreLastMainWndDlg=1 anlegen. +bluecow: 4-Wege Sortierung fr die Liste der freigegebenen Dateien hinzugefgt + +---------------------- +- 28. Dezember 2003 - +---------------------- +Unk: viele Ausnahmebehandlungen fr Kad und SMIRC hinzugefgt +Unk: ein- und ausgehenden Kad UDP-Paketen haben nun gleiche Prioritt, um ausgehende Pakete vor Verzgerungen zu bewahren +Unk: es wird gespeichert, wie viele Pakete mit Kad-Node-Lookups gesendet wurden +Unk: Such-Jumpstarts wird nun nur genutzt, wenn die Suche stehen geblieben scheint +Unk: IRC: /hop hinzugefgt +Unk: IRC: betretene Rume erhalten den Fokus +Unk: Korrektur mehrerer Memleaks im Kad-Client +Unk: Hinzugefgt: mehrere flags zur Knotensuche fr sptere gesonderte Nutzung hinzugefgt. +Unk: kleine nderung im Kontakte-Baum. Mehr Knoten sind bekannt, um das Ziel schneller finden zu knnen. + +---------------------- +- 22. Dezember 2003 - +---------------------- +bluecow: Korrektur von Problemen mit Servern mit der IP 255.255.255.255, welche zur Serverliste hinzugefgt werden konnten +bluecow: IP-Auflsung von DynDNS Servern werden nun berprft und optional gefiltert (IP-filter). +bluecow: Verringerung der Speichernutzung von Clientinstanzen +Ornis: Option zum automatischen Entfernen von fertiggestellten Download aus der Downloadliste +Ornis: Fix: der "lang"-Ordner wird beim Sprachen-DLL-Download angelegt wenn ntig + +---------------------- +- 21. Dezember 2003 - +---------------------- +Unk: Korrektur eines Fehlers beim berprfen auf Firewall +Unk: beim Bootstrappen startet nun automatisch die Kad-Engine, wenn sie vorher deaktiviert war + +---------------------- +- 18. Dezember 2003 - +---------------------- +bluecow: Auslesen von Dateieigenschaften aus der known.met verbessert. Werte werden auf Plausibilitt geprft +bluecow: Speicherleck und ein mglicher Hnger in den Server-UDP-Sockets durch fehlgeschlagene DNS Anfragen behoben +Unk: Timeout fr Kademlia angepasst +Unk: Hinzufgen von Freunden im IRC verbessert + +---------------------- +- 17. Dezember 2003 - +---------------------- +bluecow: Verarbeitung der der zu verffentlichen Schlsselworte optimiert. +bluecow: Verwaltung der Quellliste fr Parts verbessert. Mehrfachlisten entfernt. +Unk: Kademlia-Suchanfragen geben jetzt maximal 300 Treffer zurck +Unk: Bis zu 150 Dateien werden gruppiert bei einer Verffentlichung von Schlsselworten. + +---------------------- +- 13. Dezember 2003 - +---------------------- +bluecow: Weitere Log Ausgaben zu Speicher und C++ Objekten in Debugbuilds hinzugefgt +bluecow: Fehler in der internen Listenverwaltung behoben [rayita] +bluecow: Verbesserte Aktualisierung der Downloadwarteschlange [rayita] +bluecow: Dateien die wegen unzureichendem Festplattenpltz gestoppt sind werden nicht mehr automatisch neu versucht. +bluecow: Option zum Fertigstellen von Downloads die wegen unzureichendem Festplattenpltz gestoppt sind hinzugefgt + +---------------------- +- 10. Dezember 2003 - +---------------------- +bluecow: Senden von OP_CANCELTRANSFER verbessert. + +---------------------- +- 08. Dezember 2003 - +---------------------- +bluecow: Die Include Angaben im gesamten Projekt berarbeitet. +bluecow: Server Informationen werden im "meine Info" Feld angezeigt. +bluecow: Seltener Fehler beim Entpacken von stark komprimierten Blcken behoben. +bluecow: Fehlerbehandlung beim Entpacken von fehlerhaften Blcken verbessert +bluecow: zlib 1.2.1 integriert + +---------------------- +- 27. November 2003 - +---------------------- +bluecow: Drag&Drop von ed2k Link Formaten und URLs erweitert um praktisch von jeder Quelle zu funktionieren. +bluecow: Handhabung der Quellisten verbessert. + +---------------------- +- 25. November 2003 - +---------------------- +bluecow: Drag&Drop (Ziehen & Ablegen) von ed2k Link Formaten und URLs hinzugefgt. Links wie eD2k-Downloads, eD2k-Server oder URLs zu Serverlisten vom Browser direkt in ein eMule Fenster gezogen werden. Funktioniert bei ANSI Text und auch bei mehreren Links im HTML Format. + +---------------------- +- 24. November 2003 - +---------------------- +bluecow: Absturz bei fehlerhaften Datumseintrgen von Dateien behoben. +bluecow: Handhabung von Log Dateien verbessert um Ressourcen zu schonen. +bluecow: Erreichen Log Dateien 1 MB Grsse wird das Datum des Erstellens an den Logdateinamen angehngt und eine neue Datei wird begonnen. + +---------------------- +- 23. November 2003 - +---------------------- +bluecow: Fehler in der Kontextmenu Untersttzung in Nachrichten und IRC behoben. +bluecow: Alle Kontexmens der Listen werden jetzt korrekt angezeigt wenn sie ber die Tastatur aufgerufen werden. +bluecow: Die Statistik Graphen werden nicht zurckgesetzt wenn die betreffende Einstellungsseite aufgerufen und ohne nderung wieder geschlossen wird + +---------------------- +- 22. November 2003 - +---------------------- +bluecow: Textauswahl, Kopieren und Abspeichern des Logs im IRC hinzugefgt +bluecow: Fehler in der Verarbeitung der Windows beenden Nachricht behoben (WM_QUERYENDSESSION) +bluecow: Ausgabe von Down-, Upload und Overhead in NT Leistungsprotokoll kompatiblen Log Dateien +bluecow: Socket Erstellung fr Verbindungen die nicht ber einen Proxy laufen wurde zur Ressourcenschonung optimiert + +---------------------- +- 21. November 2003 - +---------------------- +bluecow: Die Log Funktion konnte in manchen Fllen sehr viel CPU Leistung brauchen +bluecow: Speicherleck bei den UDP Sockets behoben [rayita] +bluecow: Textauswahl, Kopieren und Abspeichern des Logs in den beiden Log Fenstern + +---------------------- +- 20. November 2003 - +---------------------- +bluecow: Problem mit Grssennderung des Fensters behoben wenn Stile oder eMule Themen benutzt werden +bluecow: Hauptfenster wird jetzt korrekt Maximiert beim eMule Start. Problem trat bei Themen / visuellen Stilen auf +bluecow: Buffer overflow bei Verwendung des "status" Kommandozeilenarguments [KuSh] +bluecow: Probleme beim Aktualisieren von Icons behoben. +bluecow: Hintergrundfarbe fr IRC (Hauptfenster und Nicklist) einstellbar +bluecow: Closeable Tab Control im IRC Fenster entfernt +bluecow: "close" Kommando fr Nachrichten und IRC hinzugefgt. +bluecow: 3x Mausklick hintereinander markiert die ganze Zeile. + +---------------------- +- 7. November 2003 - +---------------------- +Ornis: Abspeichern von Chats (IRC/Messages) , bers Kontextmen (Req. Celvyn) + +---------------------- +- 5. November 2003 - +---------------------- +bluecow: Fehlerkorrektur vom selten auftretenden hngender Server-Quellenanfrage, aufgrund fehlerhaften part.met-Inhalts +bluecow: sicheres Lesen aus der part.met +bluecow: Korrektur eines Problems von zu hufigen Server-Verbindungsversuchen bei sehr kleinen Serverlisten + +---------------------- +- Nov 2nd, 2003 - +---------------------- +bluecow: Kleines Problem mit der Quellennachfrage beim lokalen Server nach Neuverbinden behoben. +bluecow: Sortierung der gepufferten Blcke im Dateipuffer verbessert. Geringere Festplattenbelastung +bluecow: Speicherleck behoben und Zurckschreiben des Dateipuffers verbessert wenn ein Download abgebrochen wird. +bluecow: Option zum manuellen fertig stellen einer Datei wenn diese wegen zu wenig freiem Festplattenspeicher nicht beendet werden konnte +bluecow: Fehler in der Festplattenspeicherprfung behoben der endlose "Zu wenig Festplattenspeicher" Warnungen verursachen konnte +bluecow: Festplattenspeicherprfung beim Umgang mit NTFS Kompression oder Sparsefile verbessert +bluecow: Eine NTFS komprimierte Datei konnte nicht angelegt werden falls nicht genug Speicher fr die unkomprimierte Grsse zur Verfgung stand +Unk: Bei pausierten oder gestoppten Dateien werden die Quellen nach einer Stunde entfernt +Unk: Kein Quellentausch fr gestoppte oder pausierte Dateien +Unk: Bessere berprfung der Quellen beim Quellentausch +Unk: Quellentausch bei fertigestellten Dateien sendet Quellen mit bereits erhaltenen Teilen zuerst +Unk: Einige berflssige Schleifen in der Downloadwarteschlange entfernt um die CPU zu schonen + +---------------------- +- Oct 30th, 2003 - +---------------------- +bluecow: Quellenanfragen beim lokalen Server werden in 1 TCP Paket gruppiert +bluecow: Fehler in der Festplattenspeicherprfung behoben +bluecow: Nach einem eMule Update konnte die "nur lesen" Berechtigung der preferences.ini verloren gehen +bluecow: Fehler in den Server TCP Overhead Statistiken beseitigt +bluecow: Strings im HTTP Dialog gefixt + +---------------------- +- Oct 29th, 2003 - +---------------------- +Unk: Die Verwendung von Threads in der Kontaktlistenverwaltung sicherer gemacht. +Unk: Fehler behoben, der verhinderte das weitere Kad-Quellen hinzugefgt werden. +Unk: Upload Kontrolle von zz hinzugefgt. + +---------------------- +- Oct 23rd, 2003 - +---------------------- +bluecow: Korrektur eines Problems bei Dateifertigstellung wenn die Datei zugleich hochgeladen wurde. + +---------------------- +- Oct 22th, 2003 - +---------------------- +bluecow: Korrektur eines Crashbugs und potentiellen Exploits im Webserverinterface [thx MoNKi] + +---------------------- +- Oct 21th, 2003 - +---------------------- +bluecow: Erstellung der Kademlia Threads gendert um eine korrekte RTL Initialisierung sicher zu stellen +bluecow: Einige Ungereimtheiten in Einstellungen -> Verzeichnisse beseitigt; Tastatursteuerung hinzugefgt; Laufwerksnamen hinzugefgt + +---------------------- +- Oct 19th, 2003 - +---------------------- +bluecow: Korrektur eines Fehlers, der erlaubte Clients ohne IP oder Hash als Freund hinzuzufgen +bluecow: Fehlerkorrektur in Verbindung mit ed2k URL Registry-Schlssel, welcher Sonderzeichen enthielt +bluecow: Verbindungsoptionen fr beide Netzwerke im Kontextmen der Taskleiste und im Tray berichtigt +bluecow: "meine Info" Feld berarbeitet, Inhalt markierbar, Kopieren in die Zwischenablage mit Strg+C; Alles auswhlen mit Strg+A + +---------------------- +- Oct 16th, 2003 - +---------------------- +bluecow: Korrektur eines GDI-Ressource-Leaks im Video-Vorschaudialog +bluecow: Mehr Optionen den visuellen Stil zu beeinflussen hinzugefgt (siehe Dokumentation in der Template.eMuleSkin.ini Datei) + +---------------------- +- Oct 15th, 2003 - +---------------------- +bluecow: Weitere Icons fr Kademlia hinzugefgt +bluecow: Fehler in der Freundesliste behoben +bluecow: Freundesliste nun sortierbar. +bluecow: Einige Kontextmens in Listen berichtigt (Suche, Warteschlange, bekannte Clients,...) + +---------------------- +- Oct 14th, 2003 - +---------------------- +bluecow: Einfrieren beim Beenden behoben +bluecow: Fehler beim "Dateien einsehen" Befehl behoben +bluecow: Fehler in der Listenanzeige von Kademlia behoben +bluecow: Icons zu den Listen des Kademlias Fensters hinzugefgt +bluecow: Fehler in den Zeichenketten zur Anpassung des Toolbars behoben +bluecow: Fehler im Kontextmen der Freundesliste behoben +bluecow: Tastaturkrzel fr die Freundesliste hinzugefgt: Einfg = Neuer Freund; Entf = Freund entfernen +bluecow: Fehler im Kontextmen der Liste der freigegebenen Dateien behoben +bluecow: Benutzerdefinierte Anpassung der Icons / Farbe fr alle Hauptlisten und Baumansichten hinzugefgt +bluecow: GDI Ressourcen Verbrauch aller Bilderlisten gesenkt +Unk: Fehler behoben der durch die neue Weise zu Verffentlichen entstanden ist +Unk: Kleiner Anpassungen in Kademlia und bei den Servern + +---------------------- +- Oct 13th, 2003 - +---------------------- +Unk: Die Verffentlichung von Quellen und Schlsselwrter wurde getrennt. Erlaubt bessere Kontrolle +Unk: Die Verwaltung von Schlsselwort und zugehrigen Quellen wurde verbessert. Dies stellt sicher, dass die aktuellsten Quellen als erste verwendet werden. +Unk: Fr jede Datei werden maximal 50 Quellen indiziert, da wir maximal 50 Quellen senden um Speicher zu sparen. + +---------------------- +- Oct 12th, 2003 - +---------------------- +Ornis: Webinterface: Verbindungssteuerung fr beide Netzwerke verbessert +Ornis: Webinterface: Fehler in der Darstellung der Statistiken behoben + +---------------------- +- Oct 8th, 2003 - +---------------------- +Unk: Vorherige nderungen am Kontaktbaum rckgngig gemacht. Der Kontaktbaum hat jetzt eine feste Grsse, die der Netzwerkgrsse nach und nach angepasst wird. +Unk: Die nderung am Kontaktbaum beeinflusst auch die Knotensuche und Verbindungspings +Unk: Spezielle "mich" Suche hinzugefgt um bei Neuverbinden den Kontaktbaum schnell zu fllen +Unk: Boot Funktion in den Kontextmens der Quellen und bekannte Clients Listen hinzugefgt um schnell einen Einstieg ins Kad Netz zu finden. +1) Funktioniert nur mit Clients die auch zu Kademlia verbunden sind +2) nur v.40e und darber senden ihren Kad UDP Port. Notwendig zur Verbindungsberprfung +Unk: Viele der ersten Kademliasuchen werden verzgert um bei kurzen Verbindungen ein "Spammen" zu verhindern +Unk: Knotensuchen werden beendet wenn eine Antwort gesendet wird. Es werden nicht mehr alle in der Kontaktliste gefragt. +Unk: Namenskonvention fr Toolbars auf ".eMuleToolbar.kad1.*" gendert um sie von der klassischen Version zu trennen +Unk: Das Standardverzeichnis fr ".eMuleToolbar.kad1.*" ist jetzt das fr die eingehenden Dateien. Damit ist ein Toolbar sofort nach Download verfgbar +Unk: Kontakte werden in der Startphase schneller berprft um die erste Verbindung zu beschleunigen + +---------------------- +- Oct 7th, 2003 - +---------------------- +bluecow: Fehlerkorrektur, die Uploadliste aktualisierte sich nicht automatisch [Xman1+KuSh] +bluecow: Fehlerkorrektur bei Maus/Tastatur-Zugriff in HyperText-Control [MoNKi] +bluecow: Hinzugefgt: Tastaturkrzel fr die Toolbarsteuerung +bluecow: Bilddateien knnen auch ber die GDIPLUS.DLL geladen werden, sofern diese installiert ist. Erlaubt transparente Bilder. + +---------------------- +- Oct 6th, 2003 - +---------------------- +Unk: Die Kontaktliste wchst zu schnell. Eine passive Kontaktmethode entfernt. +??? Unk: The Contact tree is now skewed even more to stop the Contact list from growning in log size. + +---------------------- +- Oct 5th, 2003 - +---------------------- +bluecow: Serverwarnungen wurden flschlich als Fehlermeldungen ausgegeben. +bluecow: Fehlerhafte Darstellung im Fortschrittsbalken behoben. + +---------------------- +- October 4th, 2003 - +---------------------- +Ornis: Webinterface um einige Kademlia Kontrollen / Informationen erweitert +Ornis: einige Sprachanpassungen +Unk: Neue Kontakte erhalten anfnglich Typ 1 um die Verbreitung toter Kontakte zu verhindern. +Unk: Indexe die sehr weit von der Client ID entfernt liegen werden ignoriert um Speicher und Overhead zu sparen. +Unk: Zu Clients die sehr weit vom Ziel entfernt liegen wird nicht mehr verffentlicht um Speicher und Overhead zu sparen +Unk: Grsserer Fehler im Kademlia Suchsystem behoben +1) Gezieltere Sprnge um das Ziel besser zu finden. +2) Es werden keine falschen Ziele mehr angefragt. +bluecow: nderung verschiedener Ressourcen-Strings-Lade-Algorithmen (bersetzung 5-) um stringbasierte Ressourcenidentifizierer zu untersttzen [SlugFiller+itsonlyme] +bluecow: Hinzugefgt: Downloadlinks knnen Hostnamen als Quellen enthalten anstatt nur IPs. Der eigene Hostname kann in den Einstellungen gesetzt werden um diese bei ed2k-Links mit Quellen zu nutzen. [SlugFiller+itsonlyme] +bluecow: Hinzugefgt: deutliche Geschwindigkeitsverbesserungen im bar-shader-Code (Balken-Zeichnung) [SlugFiller] +bluecow: Hinzugefgt: verbesserte/schnellere Sortierung von kompletten-Quellen-Angaben [SlugFiller] +bluecow: Fehlerkorrektur eines Darstellungsfehlers im Upload-Status-Balken [wistily] +bluecow: Hinzugefgt: Option zum Prfen des freien Festplattenspeichers, um sicherstellen zu knnen, dass komplette Downloads auch Platz haben [SlugFiller] +bluecow: Hinzugefgt: Option um sicherzustellen, dass ein angegebener Speicherplatz auf der Festplatte freigehalten wird +bluecow: Hinzugefgt: Dekomprimieren von NTFS-Komprimierten Dateien fr fertiggestellte Downloads +Unk: Weniger Knotensuchen im Netzwerk. +Unk: Partdateien werden nicht nach jedem Start neuverffentlicht. +Unk: Jedes Schlsselwort wird nur noch an 10 Ziele verffentlicht. +1) Erhht die Verffentlichungsgeschwindigkeit leicht. +2) Da schneller verffentlicht wird, knnte der Overhead hher werden. + +---------------------- +- October 2nd, 2003 - +---------------------- +Unk: Protokollnderung: Das Netzwerk muss neu gestartet werden. Neuesten Client verwenden! +Unk: Die Suche in Kademlia stark verbessert. + +---------------------- +- October 1st, 2003 - +---------------------- +Ornis: Verbindungsschaltflchen fr Server und Kademlia hinzugefgt. +Unk: nderung von passivem Kontaktfinden whrend der Verffentlichung. Dies lsst die Kontaktliste zu stark anwachsen. +1) Kontaktliste sollte kleiner bleiben +2) Durch weniger Kontakte sollte auch der Overhead sinken +Unk: Erste Teilnehmeranzahl Schtzung. +Unk: Datei Verffentlichung gendert: +1) Mehr Dateien werden verffentlicht. +2) Overhead wird Reduziert bei wenig freigegeben Dateien. +3) Die Anzahl der Indexes die jeder Verwalten muss ist gestiegen. +??? i ) This increase in indexes will actually be testing things for when publishing speed is increased.. +4) Mehr alte Quellen werden indiziert +Unk: Jeder Kontakttyp grsser 4 wird einmal pro Stunde berprft. +bluecow: ersehnter "Mehr"-Knopf in der Suche, um mehr Resultate vom lokalen Server abzufragen +bluecow: Tooltips fr das Transferfenster neu geschrieben, um mehrere kleine Unstimmigkeiten zu beheben +bluecow: zwischengespeicherte Partfile-Daten werden explizit geschrieben, bevor eine Vorschau ausgefhrt wird +bluecow: Partfile-Plattenplatznutzung wird unter Bercksichtigung der NTFS-Kompression und/oder NTFS-Sparse-Files-Nutzung ermittelt + +---------------------- +- Sep 25th, 2003 - +---------------------- +bluecow: Server TCP-Verbindung "keep-alive"-Funktion hinzugefgt (erweiterte Einstellungen). +bluecow: Die Tooltips bei den Suchergebnissen werden nur noch angezeigt wenn SHIFT und STRG gleichzeitig gedrckt werden whrend der Mauszeiger auf einem Ergebnis steht. + +---------------------- +- Sep 21th, 2003 - +---------------------- +bluecow: Alle Integerdatentypen (8,16,32,128 bit) ins Little Endian Format gendert. +Unk: Erste bernahme der eMule und eDonkey "hallo-Pakete" mit bluecows Hilfe +Unk: eMules Versionsnummern auf 0.xx.x erweitert. +Unk: Einige Index Routinen berarbeitet. +Unk: Bessere Verwaltung der Indexliste: +1) Passives Subern: Werden bei einer Suche veraltete Schlsselworte gefunden werden diese gelscht. +2) Aktives Subern: Alle 30 Minuten wird der Index auf Aktualitt berprft und alte Eintrge gelscht. + +---------------------- +- Sep 20th, 2003 - +---------------------- +bluecow: Alle Metatags mit Zeichenketten in integer IDs gendert +bluecow: Der Metatag "Lnge" wird nun intern in eMule/Kademlia als Integer verwaltet +bluecow: eMule/Kad Tags werden nach eD2k Tags gewandelt bevor sie zu Servern oder anderen Clients geschickt werden +bluecow: bereit empfange eD2k Tags werden nach eMule/Kad Tags gewandelt; gilt auch fr eD2k Tags aus der known.met +bluecow: Die Kad Metatag Klasse wurde berarbeitet: + - Wechsel des Datentyps in der Liste von uint32 nach uint8 + - "Dynamische" Integer Tags - Der passende Integerdatentyp (8,16,32 bit) wird nach Bedarf ausgewhlt + - Funktionen zur schnellen Datentypwandlung, ohne dabei Rcksicht auf den Inhalt nehmen zu mssen, hinzugefgt +Unk: Resultate von Suchen und Quellenanfragen werden gebndelt: + - Wird mehr als ein Resultat empfangen spart dies 16Bytes(data)+UDP(Paketoverhead) fr alle weiteren Resultate. + - Kompressionsgewinn bei diesen Paketen liegt bei ca. 50%. +Unk: Fehler wodurch Dateien ohne gltige Schlsselwrter die Verffentlichung anderer Dateien verhindern konnte wurde behoben. +Unk: Die Verfgbarkeitsabschtzung bei Suchresultaten wurde verbessert. + +---------------------- +- Sep 18th, 2003 - +---------------------- +bluecow: Bug Fix: Ungltige Client Objekte nachdem eine Datei aus der Freigabe genommen / hinzugefgt wurde [zegzav] +bluecow: ALT + Doppelklick ffnet den Dateidetail Dialog in der Liste der freigegebenen Dateien und bei den Suchergebnissen +bluecow: Einige Formatierungsfehler behoben [mandrag0re] + +---------------------- +- Sep 16th, 2003 - +---------------------- +Unk: Jedes grssere Kad-Paket wird komprimiert. + +---------------------- +- Sep 15th, 2003 - +---------------------- +bluecow: Alle vorhandenen mp3 ID Tags werden fr Downloads und freigegebene Dateien angezeigt +Unk: Kademlia Protokoll berarbeitet: + 1) Suchanfragen senden kein MaxResults mehr + 2) Pro Datenpaket knnen mehrer Suchresultate gebndelt werden. + a) Momentan wird noch ein Paket pro Resultat verwendet. Fr zuknftige Erweiterung. + b) Wenn die Kompression dem Protokoll hinzugefgt wird sollte die Resultatsbndelung eingefhrt werden + 3) Verffentlichungsanfragen knnen ebenfalls gebndelt werden. + a) Momentan wird noch ein Paket pro Resultat verwendet. Fr zuknftige Erweiterung. + b) Wenn die Kompression dem Protokoll hinzugefgt wird sollte die Bndelung eingefhrt werden + 4) Anzahl der Kontakttypen von 0-4 auf 0-2 reduziert. + a) Die Kontaktliste bleibt berschaubarer + b) Der Overhead knnte dadurch erhht werden. Weitere Anpassung in der Testphase + 5) Die Kontaktliste fhrt keine Knotensuchen mehr durch sobald ein Zweig der Baumstruktur die Tiefe 4 erreicht hat. + a) Dies bedeutet eine Verringerung der Kontaktanzahl im laufenden Netzwerk. Das Ausmass muss abgewartet werden. + b) Im Moment darf hauptschlich der rechte Ast wachsen. + i) Dadurch kann ein Client mehr andere Clients kennen, die nahe am eigenen Hashwert liegen + ii) Sollte die Suchgeschwindigkeit erhhen + iii) Knnte hohen Overhead erzeugen. Muss ggf angepasst werden. + 6) Kademlianafragen senden nun die Empfnger ID: + a) Erhht die Sicherheit. + b) Sollte sich die KadID ndern, sollte das Helfen die alte ID schnell aus dem Netzwerk zu entfernen + 7) Nur noch Kontakte die bei Anfragen auch antworten werden als "gut" genommen. + a) Dies spart das Durchsuchen der Kontaktliste bei jedem Paket + i) Da die Kontakt ID nicht bekannt ist, kann der Baum nicht durchsucht sondern nur der Reihe nach berprft werden. + ii) Die Kontakt ID kann nicht einfach einem Paket hinzugefgt werden, da sie nicht verifiziert ist + c) Es ergeben sich vermutlich Situation in den mehr Kontakte als "gut" markiert werden knnten + i) In einigen Fllen ist es egal, da es sich um eine Kadanfrage handelt + ii) In anderen spielt es eine Rolle da nur noch ein Ping entscheiden kann ob der Kontakt gut ist oder nicht + +---------------------- +- Sep 14th, 2003 - +---------------------- +bluecow: Lugdunum 16.40 Server Erweiterung: Suchergebnisse werden in einem UDP Paket gebndelt [Dank an Lugdunum fr Zusammenarbeit] +bluecow: Anpassung der UDP socket Behandlung fr grosse UDP Pakete +bluecow: Erweiterete Log Fehlerausgabe fr das Server UDP Protokoll +bluecow: Optimierung der UDP Server sockets fr geringere CPU Last (weniger Speicheroperationen) +bluecow: Bug-Fix: Sperrung der Client UDP sockets wurde nicht korrekt abgefragt +bluecow: Einzelne Suchergebnisse speichern ihre Einstellungen. Diese werden wiederhergestellt wenn man das betreffende Suchfenster aktiviert +bluecow: Verbesserung in der Bedienung: Wird ein Suchfenster geschlossen wird das vor dem geschlossenen aktiviert +bluecow: Die zuletzt verwendeten Suchparameter werden auch ber eMule Neustarts hinweg gespeichert +bluecow: Die IP Eingabe bei neuer Server akzeptiert Server jetzt auch im eD2k Link Format +bluecow: Freigegebne Dateien und welche die sich gerade im Download befinden werden nicht mehr gegen die maximale Anzahl der Suchergebnisse gezhlt + +----------------------- +- September 13th, 2003- +----------------------- +Unk: Fehler behoben, bei dem auf einen schon gelschten Kontakt zugegriffen wurde +Unk: berlauffehler behoben. +Unk: Kad ID und eMule ID wurden getrennt. Die eMule Tags im Hashwert stren beim Routen +Unk: Die Lebenszeit eines Kontakts wurde falsch berechnet +Unk: Einstellungen fr Down- und Upload- Limit werden jetzt als Schieberegler dargestellt. + +---------------------- +- Sep 11th, 2003 - +---------------------- +bluecow: Log-Funktion um das Server TCP/UDP Protokoll erweitert +bluecow: Untersttzung der Welcome Nachricht der neuen Lugdunum 16.40 hinzugefgt +bluecow: Untersttzung der Lugdunum 16.40 Protokoll Kompression: Welcome Nachricht und Suchresultate werden komprimiert empfangen; die Liste der freigegebene Dateien komprimiert gesendet +bluecow: Untersttzung der Lugdunum 16.40 UDP Protokollerweiterungen: Globale Quellensuche wird effizienter und verbraucht weniger Bandbreite +bluecow: Bug-Fix in der Namensauflsung +bluecow: Automatischer Start einer Globalen Suche falls der lokale Server nicht innerhalb 50s antwortet +bluecow: Bug-Fix: Das Fenster zum Hinzufgen mehrerer eD2k Links akzeptierte nur 3-4 Links + +---------------------- +- September 4th, 2003- +---------------------- +bluecow: Kademlia Fenster berarbeitet; Sortierung der Listen, Speichern der Spaltenbreite und Tooltips hinzugefgt +bluecow: Die Metataganzeige zeigt nun die klassischen und neuen Tags. +Unk: Uploadslots versuchen jetzt mglichst ber 3kB/s zu bleiben +Unk: Sehr weit entfernte Kontakte werden eingeschrnkt um Overhead zu sparen + +---------------------- +- September 3rd, 2003- +---------------------- +Unk: Die Indexerstellung kann aktualisiert werden. +Unk: Indizierte Dateien haben eine Lebenszeit. +Unk: Indizierte Dateien werden gespeichert und bei Neustart geladen. +Unk: Eine Datei ID wurde nur einmal verffentlicht - behoben. +Unk: Der "Firewalled" Status wird regelmssig berprft. Sollte auch die falsche IP bei 24h Zwangstrennung beheben. +Unk: Das Verffentlichen geht nicht automatisch von einer erfolgreichen Verffentlichung aus. Es werden nur positive Antworten gewertet +Unk: Kademliasuchen enden wenn es keine offenen Kontakte mehr gibt. + +---------------------- +- September 1st, 2003- +---------------------- +bluecow: Meta-Daten und Datei-Kommentare Dialoge in Eigenschaftsseiten konvertiert sodass diese gemeinsam mit dem neuen Dateidetail-Dialog angezeigt werden knnen. Alle Eigenschaftsseiten Dialoge in der Gre beliebig vernderbar; zuletzt benutzt Gre u. Position wird gespeichert +bluecow: Hinzugefgt: Neue "Match keywords" Suchoption fr beide Jigle-Suchmethoden. + +---------------------- +- Aug 30th, 2003 - +---------------------- +Unk: Rewrote the entire kademlia protocol.. We are no longer using Overnet.. +Unk: Adding availability to publishing. +bluecow: Bei einer Suche nach einem File mit Typ "Programm" werden die Suchresultate nicht mehr entsprechend den Windows Programm Fileextensions (*.exe, *.com, *.bat) lokal gefiltert. Die Bedeutung des eD2K Filetyps "Programm" beinhaltet alle Filetypen die von einem "Programm" benutzt werden, also z.B. komprimierte Archive oder CD-ROM Images. Das bedeuted, dass du mehr Suchresultate bekommst. Wenn du trotzdem nach einem Windows Programm File suchen mchtest, gibt die Fileextension "exe" an. +bluecow: Hinzugefgt: Proxy-Support fr IRC; alle Proxy-Einstellungen werden jetzt auch fr IRC benutzt +Ornis: bugfix in webserver socket code, [Jan B.,nice bugreport] + +---------------------- +- Aug 29th, 2003 - +---------------------- +Ornis: Dateidetail-Dialog neu strukturiert, + Datumsanzeige des Downloadstarts sowie der Zeitdauer seitem (bis zur aktuellen Zeit bzw. Downloadfertigstellung) +Ornis: hinzufgen einiger fehlender Prozentanzeigen +Ornis: Option fr Zeitplaner, um keine Endzeit anzugeben (-> nicht temporr) + +---------------------- +- August 26th, 2003 - +---------------------- +bluecow: nderungen im Jigle gSOAP Module fr bessere Performance und zuverlssige und korrekte Compilierung der Sourcen von Moddern (Modder: stelle sicher, dass die Jigle gSOAP Sourcen mit dem Symbol WITH_GZIP compiliert werden!); eine Jigle Suchanfrage muss entweder einen Filetyp oder eine Fileextension beinhalten; HTTP User-Agent Feld beinhaltet eMule-Version. +bluecow: Korrektur einiger Fehler im neuen ComboBox control (keyboard interface). +bluecow: Mehrere nderungen in der GUI der neuen Suchresultatliste; korrekte Farbdarstellung unter allen Windows Farbschema; Sortierung der Filenamen-Listeintrge + +---------------------- +- August 24th, 2003 - +---------------------- +bluecow: Hinzugefgt: Neue Suchmethode "Jigle SOAP Interface" um die Jigle-Datenbank mit eMule benutzen zu knnen [Vielen Dank an Melange von Jigle, der dieses groartige Feature eMule angeboten hat] +bluecow: Jigle SOAP Interface: Suchresultate werden auf 100 Files limitiert; Code-Optimierungen zur Entlastung des Servers; lokales Filtern der Suchresultate +bluecow: Hinzugefgt: Erweitertes ComboBox Control fr Suchmethode [eMulePlus] + +---------------------- +- August 20th, 2003 - +---------------------- +Unk: Changed how it detects firewalled users. +Unk: Indexed keywords now handles all tags. +Unk: Available is better updated during a search. +Ornis: added stats of where sources came from (ed2k-server, ON, source exchange) +Ornis: custimizable toolbar [eMule+] +Ornis: Downloadlist: F2 opens inputbox to change filename of the selected file +Ornis: Searchlist can expand items to show the received different filenames and their count + +---------------------- +- August 11th, 2003 - +---------------------- +Unk: One more change to smoothing out the packets.. Hopefully this is the last. +Unk: Contacts are now checked in a more systematic way to help lower bandwidth. +Unk: Only low buckets are updated to lower bandwidth. +Unk: Hopefully fixed another shutdown crash. + +---------------------- +- August 7th, 2003 - +---------------------- +Unk: More outgoing flood control to try to avoid lagging. (No more spikes) +Unk: Major change to how we sent shared files to servers for better efficiency. +Unk: Overnet status are now only updated once a sec to reduce CPU overhead. +Unk: Kademlia searches are now regulated by total and type to keep from two many searches at once. + +---------------------- +- July 29th, 2003 - +---------------------- +Unk: IRC: Now sorts nicks correctly. +Unk: IRC: Can now add other eMule nicks as friends. +Unk: IRC: Can now send each other ed2k links within the IRC. +Unk: IRC: Added security to Add nick and Sending links. You can choose to accept all links, links for friends only, and no links at all. + +---------------------- +- July 26th, 2003 - +---------------------- +Unk: Contacts are now filtered from invalid IP and Ports. +Unk: Again adjusted how dead contacts are removed. +Unk: Older contacts are no longer added on restart. +Unk: Trying to reduce UDP spikes that can flood connections. +Unk: Moved Overnet Log and Debug line info into eMules Log and Debuglogs.. + +---------------------- +- July 24th, 2003 - +---------------------- +Unk: Fixed a bug that allowed searches to access already deleted contacts. +Unk: Serverlist is now updated when connected to Kademlia only. +Unk: Seemed Kademila thread still tried to access some of it's main objects during shutdown. (Hopefully fixed) +Unk: Fixed some connected status issues. + +---------------------- +- July 16th, 2003 - +---------------------- +Unk: Testing out Maella request patch. +Unk: Dead contacts are removed more efficiently. + +---------------------- +- July 5th, 2003 - +---------------------- +Unk: Contact type is now being updated. May later use this and "madeContact" to update the contact list a little better. +Unk: Contact list no longer shows temp contacts during searches. Also, redid how contacts are updated to limit the number of refreshes needed. (Cpu Savers) +Unk: Converted the ED2K ID system to the Hyrbids ID system to avoid false lowIDs that the ED2K ID system created and to be more compatable with the Hyrbid. +---- Also standardized the LowID checks to 2 central methods (ED2K and Hybrid). We were using several different methods to check lowID. +---- This changed a lot of code and needs tested well. + +---------------------- +- July 1st, 2003 - +---------------------- +Unk: You can now see if your files are published to a ED2K Server and/or Overnet. +Unk: You no longer republish files to a ED2K server that is already on there. This should save a lot of bandwidth and allow more files to be listed.. + +---------------------- +- June 30th, 2003 - +---------------------- +Unk: Single keyword search requests are now processed. +Unk: Fixed a bug that could get the publishing stuck trying to publish a file over and over. + +---------------------- +- June 28th, 2003 - +---------------------- +bluecow: Added the code to process the incoming Keyword Search Requests. +Unk: Added a simple response packet to keywords. +bluecow: Fixed a crash on exit bug. + +---------------------- +- June 27th, 2003 - +---------------------- +Unk: Entries in the Index list can now be removed. Which also fixes a bug with a lot of dangling pointers when restarting the overnet connection.. :) +Unk: Fixed a bug that caused all kinds of issues if you disconnected and reconnected real fast with overnet. + +---------------------- +- June 26th, 2003 - +---------------------- +Unk: Overnets overhead is now processed and added to the server catagory. +Unk: Tweaked the overhead a little to try to get better estimates. +bluecow: Fixed a deadlock at shutdown. +bluecow: Fixed a bug when restarting ON during a single eMule session. +Unk: Fixed a bug that allow the connect button to get confused. +Unk: Fixed a bug that crash when trying to bootstrap + +---------------------- +- June 25th, 2003 - +---------------------- +Unk: There are now preferences that allow the user to choose which network to connect too. +Unk: Added Network Choice to First Time Wizard. +Unk: Changed how connection status is relayed between Overnet and eMule. +Unk: Fixed some issues with the search dialog. SearchID is no longer and issue between eMule and Overnet and you can now select which network so search. + +---------------------- +- June 24th, 2003 - +---------------------- +Unk: IP request now responds if the other client is firewalled. +Unk: Found that damn bug that wasn't deleting clients when the socket timed out.. +Unk: Cleaned up some code. + +---------------------- +- June 22nd, 2003 - +---------------------- +Unk: Corrected a bug that didn't let you just connect to Overnet. +Unk: Fixed duplicate keyword indexed files. +Unk: Rolled back to VS2002.. Seems to have corrected the socket bug. +Unk: Removed a gui slowdown when a search quit and all the temp contacts were removed. +Unk: Completely rewrote the messaging code between eMule and Overnet to clean it up. +Unk: Added refresh messages to the Overnet lists. There should be no more ghosts or blanks in the lists. +Unk: Your ID is now calculated differently. Also there is a better check if your firewalled if using both networks at once. +-If you are seen to not be firewalled by either Overnet or ED2K, eMule will assume your not firewalled. +-If either ED2K or Overnet has a high ID, eMule will use it. +-If the server things your firewalled and Overnet knows better, you can still download from lowID users. +-If the server things your firewalled and Overnet knows better, you will tell the other clients the correct ID. +-Because we do not support firewalled users in Overnet yet, if you want to use overnet, you must also connect to a server before eMule starts working. + +---------------------- +- June 6th, 2003 - +---------------------- +Unk: Tried to go through and clear up some areas that check for LowID and Connected status. + +---------------------- +- June 5th, 2003 - +---------------------- +Unk: Changed up the ON gui some.. Although it's not great, the lists are now seperate for easier manipulation later. +Unk: Fixed duplicates of fileID indexed files. + +---------------------- +- June 4th, 2003 - +---------------------- +Unk: Now responding to fileID search requests and sending and search_end packets +Unk: Connect button support added. +Unk: The OVERNET_IDENTIFY_ACK now updates the TCP port of the Contacts and Indexes. (This was messing this up, needs redone) +Unk: Added a Firewall recheck button. +Unk: Change how it checks if firewalled. (Less wasted packets, better timing.) + +---------------------- +- June 3rd, 2003 - +---------------------- +Unk: Changed how it displays connection status. +Unk: Searches are now terminated better when a file is Stoped, Paused, or Canceled. + +---------------------- +- June 1st, 2003 - +---------------------- +Unk: The timer for checking dead servers was changed to now get messed up when resetting your computer. +Unk: Server Description requests delay has been increased to save server bandwidth. +Unk: Found a major bug that sent packets to the wrong IP.. We now index Overnet publish requests. + +---------------------- +- May 26nd, 2003 - +---------------------- +Unk: Knownfile met is now saved periodically. +Unk: Published ON files are now remember between restarts to cut down over publishing. +Unk: We now detect if the our ON client is firewalled. Also, if the server side thinks we are firewalled but overnet isn't, we use the Overnet ID instead of the server ID. +Unk: Found out that many of the mldonkey clients don't publish correctly. Hours wasted trying to debug a packet that is incorrect.. +Unk: Changed the order of publishing to make it more efficient. +Unk: No longer treat bcp://hashid:ip:port as a source. These are firewalled sources and the ip and port is the firewalled server, not source.. +Unk: Corrected the searches to reflect correct search types. +Unk: Uploading clients could get stuck in the upload list without a socket. This is the same problem as noted above, therefore it's not the sole problem with FileNotFound. + +---------------------- +- May 26nd, 2003 - +---------------------- +Unk: Adding the overnet to the client brought up unknown issues with the original client. +1. Rewrote how clients and sockets delete each other to avoid clientlist & socketlist corruptions. +2. Clients are able to get in a connected or connecting state without a socket, these clients are now removed. (This may be releated to FileNotFound packets. Will rework that later..) + +---------------------- +- May 22nd, 2003 - +---------------------- +Unk: Merged the base Kademlia code into eMule with the help of bluecow. +Unk: Added a Overnet debug window. +Unk: Added many new Overnet opcodes. +Unk: Can now download from Overnet clients. +Unk: Note to self: Need to find out why incoming Publish Requests send UDP port, but when we send a publish request, we HAVE to send a TCP port??????? (Fixed: mldonkey is the one sending UDP port which is incorrect and very bad!) +Unk: Can now publish to the Overnet network. (Something still doesn't seem correct with Publish Requests) +Unk: Indexing Overnet files. (Something still doesn't seem correct with Publish Requests) +Unk: Beging to change the eMule base code to better handle the Overnet network as a seperate network. (So you can use both or just one) +Unk: Duplicate clients are now found a little better. More CPU power needed, but it had to be done to detect cross source findings.. +Unk: CUpDownClient::CalculateDownloadRate() is causing strange exceptions.. WHY? (Update: fixed) + +---------------------- +- March 16th, 2003 - +---------------------- +Unk: Changed opcodes to match eMule for easier merging later. + +---------------------- +- March 15th, 2003 - +---------------------- +Unk: Original Programmer seems to have left the building. I'm am going through the code trying to see where he was going with it.. + + + NDERUNGSPROTOKOLL VON EMULE + ============================ + + +v0.30e +---------------------- +- Dec 9th, 2003 - +---------------------- +bluecow: Korrektur eines selten auftretenden Fehlers, beim Entpacken von stark komprimierbaren Blcken +bluecow: verbesserte Fehlerbehandlung fr die Dekomprimierung fehlerhafter Blcke +bluecow: Upgrade auf zlib Verion 1.2.1. + + +v0.30d +---------------------- +- 20. November 2003 - +---------------------- +.: fehlende bentigte Sprach-Bibliotheken knnen durch eMule automatisch heruntergeladen und installiert werden +.: Auto-Versionsberprfung wurde zu einer DNS-basierten Methode gendert, welche nun effektiver ist. Die berprfung ist nun auch standardmig aktiv +.: MobileMule-Protokoll auf v6b aktualisiert + + +---------------------- +- 16. November 2003 - +---------------------- +Ornis: geringere CPU Last +Ornis: Suchliste: Kontextmen bietet nun auch an, die Datei im pausierten Modus den Downloads hinzuzufgen (wenn erweiterte Kontrollen aktiviert) +Ornis: ein ausgewhlter Datei-Kommentar kann nun in die Zwischenablage kopiert werden [NoamSon] + +---------------------- +- 7. November 2003 - +---------------------- +Ornis: Abspeichern von Chats (IRC/Nachrichten) , ber's Kontextmen +Ornis: Einstellungen-Webinterface: aktivieren/deaktivieren der GZIP-Kompression + +---------------------- +- 5. November 2003 - +---------------------- +bluecow: Fehlerkorrektur vom selten auftretenden hngender Server-Quellenanfrage, aufgrund fehlerhaften part.met-Inhalts +bluecow: sicheres Lesen aus der part.met +bluecow: Korrektur eines Problems von zu hufigen Server-Verbindungsversuchen bei sehr kleinen Serverlisten + +---------------------- +- 2. November 2003 - +---------------------- +bluecow: Fixed minor issue with queued local server source requests after new server connect. +bluecow: Fixed sorting of buffered part file blocks to achive less HD stress. +bluecow: Fixed memory leaks and flushing of buffered data to HD of paused files when file was canceled. +bluecow: Files which could not be completed because of not enough free disk space can be resumed manually to try another file completion process. +bluecow: Fixed bug in check min. free disk space which could cause endless low disk space notifications. +bluecow: Improved check min. free disk space for better handling NTFS compressed/sparse files. +bluecow: Fixed a bug where an NTFS compressed file could not be created because there was not enough free disk space to hold the uncompressed file. +Ornis: Importer aktualisiert, um Downloads von eD/ON v0.48 zu importieren + +Unk: Several bugs noted in the forum. Tried to check most of them. +* Sources to a Paused or Stopped file will be removed once an hour to remove old sources.. +* We no longer send sources to Paused or Stopped files. +* A better check of valid sources to Part files for source exchange. +* Source exchanges for complete files now sends sources with obtained parts first. +Unk: Removed some redundent For Loops to save CPU in the DownloadQueue.. + +---------------------- +- 30. Oktober 2003 - +---------------------- +bluecow: Added grouping of local server source reasks packets into one TCP frame +bluecow: Fixed bug with check diskspace +bluecow: Fixed problem with lost read-only settings in pref.ini after version change +bluecow: Fixed server TCP overhead statistics +bluecow: Fixed HTTP download dialog string resources + + +v0.30c +---------------------- +- 23. Oktober 2003 - +---------------------- +bluecow: Korrektur eines Problems bei Dateifertigstellung wenn die Datei zugleich upgeloaded wurde. + +---------------------- +- 22. Oktober 2003 - +---------------------- +Ornis: es knnen nun auch Downloads importiert werden, die mit ON/Edonkey im "alten Format" begonnen wurden +bluecow:Korrektur eines Crashbugs und potentiellen Exploits im Webserver interface [thx MoNKi] + +---------------------- +- 19. Oktober 2003 - +---------------------- +bluecow: Korrektur eines Fehlers, der erlaubte Clients ohne IP oder Hash als Freund hinzuzufgen +bluecow: Fehlerkorrektur in Verbindung mit ed2k URL Registry-Schlssel, welcher Sonderzeichen enthielt +bluecow: Korrektur eines GDI-Ressource-Leaks im Video-Vorschaudialog + +---------------------- +- 12. Oktober 2003 - +---------------------- +Ornis: Import von begonnenen Download von eDonkey/Overnet's "neuem Format" (gesplittete Partfiles). Integrierter Konverter um temporre Downloaddateien aus ausgewhlten Verzeichnissen direkt in eMule zu bernehmen. (Aufruf ber das Hotmen Alt+X) +Ornis: Serverliste markiert den aktuell verbundenen Server + +---------------------- +- 9. Oktober 2003 - +---------------------- +Ornis: dynamische Kategorien-Reiter-Gre +Ornis: verhindern von leerer Datum/Zeit Angabe bei fehlerhafter preferences.ini + +---------------------- +- 7. Oktober 2003 - +---------------------- +bluecow: Fehlerkorrektur, die Uploadliste aktualisierte sich nicht automatisch [Xman1+KuSh] +bluecow: Fehlerkorrektur bei Maus/Tastatur-Zugriff in HyperText-Control [MoNKi] +bluecow: Hinzugefgt: Tastaturkrzel zur Toolbar + +---------------------- +- 5. Oktober 2003 - +---------------------- +bluecow: Fixed bug with server warning messages which were shown as errors. +bluecow: Fixed bug with random drawn block requests in file progress bars. + +---------------------- +- 4. Oktober 2003 - +---------------------- +bluecow: nderung verschiedener Ressourcen-Strings-Lade-Algorithmen (bersetzung 5-) um stringbasierte Ressourcenidentifizierer zu untersttzen [SlugFiller+itsonlyme] +bluecow: Hinzugefgt: Downloadlinks knnen Hostnamen als Quellen enthalten anstatt nur IPs. Der eigene Hostname kann in den Einstellungen gesetzt werden um diese bei ed2k-Links mit Quellen zu nutzen. [SlugFiller+itsonlyme] +bluecow: Hinzugefgt: deutliche Geschwindigkeitsverbesserungen im bar-shader-Code (Balken-Zeichnung) [SlugFiller] +bluecow: Hinzugefgt: verbesserte/schnellere Sortierung von kompletten-Quellen-Angaben [SlugFiller] +bluecow: Fehlerkorrektur eines Darstellungfehlers im Upload-Status-Balken [wistily] +bluecow: Hinzugefgt: Option zum Prfen des freien Festplattenspeichers, um sicherstellen zu knnen, dass komplette Downloads auch Platz haben [SlugFiller] +bluecow: Hinzugefgt: Option um sicherzustellen, dass ein angegebener Speicherplatz auf der Festplatte freigehalten wird +bluecow: Hinzugefgt: Dekomprimieren von NTFS-Komprimierten Dateien fr fertiggestellte Downloads +Ornis: Download-Geschwindigkeitslimits manuell aufhebbar + +---------------------- +- 1. Oktober 2003 - +---------------------- +bluecow: ersehnter "Mehr"-Knopf in der Suche, um mehr Resultate vom lokalen Server abzufragen +bluecow: Tooltips fr das Transferfenster neu geschrieben, um mehrere kleine Unstimmigkeiten zu beheben +bluecow: zwischengespeicherte Partfile-Daten werden explizit geschrieben, bevor eine Vorschau ausgefhrt wird +bluecow: Partfile-Plattenplatznutzung wird unter Bercksichtigung der NTFS-Kompression und/oder NTFS-Sparse-Files-Nutzung ermittelt +Ornis: neue bersetzung: Tschechisch, von Patejl + + +v0.30b +---------------------- +- 25. September 2003 - +---------------------- +bluecow: Server TCP-Verbindung "keep-alive"-Funktion hinzugefgt (erweiterte Einstellungen). +bluecow: Die Tooltips bei den Suchergebnissen werden nur noch angezeigt wenn SHIFT und STRG gleichzeitg gedrckt werden whrend der Mauszeiger auf einem Ergebnis steht. + +---------------------- +- 24. September 2003 - +---------------------- +.: Erweiterung der Vorschau Funktion: Es knnen bis zu 5 Screenshots der ersten ~10min einer Video Datei empfangen werden, wenn der andere die Anzeige seiner freigegebenen Dateien erlaubt +.: MobileMule Protokoll v5. Es muss ebenfalls der neue Handyclient verwendet werden. +.: Einige Code nderungen von eMule+ bernommen +Ornis: Mehr Platz fr Kategorien +Ornis: Die Anzahl der Andere-Datei-Angefordert-Quellen wird fr jeden Download mit +xx angezeigt wenn die zustzlichen Kontrollen aktiviert sind. + +---------------------- +- 21. September 2003 - +---------------------- +Ornis: Statistiken ber den Festplatten Verbrauch hinzugefgt [emule+] + +---------------------- +- 18. September 2003 - +---------------------- +bluecow: Bug Fix: Ungltige Client Objekte nachdem eine Datei aus der Freigabe genommen / hinzugefgt wurde [zegzav] +bluecow: ALT + Doppelklick ffnet den Dateidetail Dialog in der Liste der freigegebenen Dateien und bei den Suchergebnissen +bluecow: Einige Formatierungsfehler behoben [mandrag0re] + +---------------------- +- 15. September 2003 - +---------------------- +bluecow: Alle vorhandenen mp3 ID Tags werden fr Downloads und freigegebene Dateien angezeigt + +---------------------- +- 14. September 2003 - +---------------------- +bluecow: Lugdunum 16.40 Server Erweiterung: Suchergebnisse werden in einem UDP Paket gebndelt [Dank an Lugdunum fr Zusammenarbeit] +bluecow: Anpassung der UDP socket Behandlung fr grosse UDP Pakete +bluecow: Erweiterete Log Fehlerausgabe fr das Server UDP Protokoll +bluecow: Optimierung der UDP Server sockets fr geringere CPU Last (weniger Speicheroperationen) +bluecow: Bug-Fix: Sperrung der Client UDP sockets wurde nicht korrekt abgefragt +bluecow: Einzelne Suchergebnisse speichern ihre Einstellungen. Diese werden wiederhergestellt wenn man das betreffende Suchfenster aktiviert +bluecow: Verbesserung in der Bedienung: Wird ein Suchfenster geschlossen wird das vor dem geschlossenen aktiviert +bluecow: Die zuletzt verwendeten Suchparameter werden auch ber eMule Neustarts hinweg gespeichert +bluecow: Die IP Eingabe bei neuer Server akzeptiert Server jetzt auch im eD2k Link Format +bluecow: Freigegebne Dateien und welche die sich gerade im Download befinden werden nicht mehr gegen die maximale Anzahl der Suchergebnisse gezhlt + +---------------------- +- 11. September 2003 - +---------------------- +bluecow: Log-Funktion um das Server TCP/UDP Protokoll erweitert +bluecow: Untersttzung der Welcome Nachricht der neuen Lugdunum 16.40 hinzugefgt +bluecow: Untersttzung der Lugdunum 16.40 Protokoll Kompression: Welcome Nachricht und Suchresultate werden komprimiert empfangen; die Liste der freigegebene Dateien komprimiert gesendet +bluecow: Untersttzung der Lugdunum 16.40 UDP Protokollerweiterungen: Globale Quellensuche wird effizienter und verbraucht weniger Bandbreite +bluecow: Bug-Fix in der Namensauflsung +bluecow: Automatischer Start einer Globalen Suche falls der lokale Server nicht innerhalb 50s antwortet +bluecow: Bug-Fix: Das Fenster zum Hinzufgen mehrerer eD2k Links akzeptierte nur 3-4 Links + +---------------------- +- 1. September 2003 - +---------------------- +bluecow: Meta-Daten und Datei-Kommentare Dialoge in Property Pages konvertiert sodass diese gemeinsam mit dem neuen Dateidetail-Dialog angezeigt werden knnen. Alle Property Sheets/Pages Dialoge in der Gre beliebig vernderbar; zuletzt benutzt Gre u. Position wird gespeichert +bluecow: Hinzugefgt: Neue "Match keywords" Suchoption fr beide Jigle-Suchmethoden. + +---------------------- +- 30. Aug 2003 - +---------------------- +bluecow: Bei einer Suche nach einem File mit Typ "Programm" werden die Suchresultate nicht mehr entsprechend den Windows Programm Fileextensions (*.exe, *.com, *.bat) lokal gefiltert. Die Bedeutung des eD2K Filetyps "Programm" beinhaltet alle Filetypen die von einem "Programm" benutzt werden, also z.B. komprimierte Archive oder CD-ROM Images. Das bedeuted, dass du mehr Suchresultate bekommst. Wenn du trotzdem nach einem Windows Programm File suchen mchtest, gibt die Fileextension "exe" an. +bluecow: Hinzugefgt: Proxy-Support fr IRC; alle Proxy-Einstellungen werden jetzt auch fr IRC benutzt +Ornis: bugfix im Webinterface socket code, [Jan B.,nice bugreport] + +---------------------- +- 29. Aug 2003 - +---------------------- +Ornis: Dateidetail-Dialog neu strukturiert, + Datumsanzeige des Downloadstarts sowie der Zeitdauer seitem (bis zur aktuellen Zeit bzw. Downloadfertigstellung) +Ornis: hinzufgen einiger fehlender Prozentanzeigen +Ornis: Option fr Zeitplaner, um keine Endzeit anzugeben (-> nicht temporr) + +---------------------- +- 26. Aug 2003 - +---------------------- +bluecow: nderungen im Jigle gSOAP Module fr bessere Performance und zuverlssige und korrekte Compilierung der Sourcen von Moddern (Modder: stelle sicher, dass die Jigle gSOAP Sourcen mit dem Symbol WITH_GZIP compiliert werden!); eine Jigle Suchanfrage muss entweder einen Filetyp oder eine Fileextension beinhalten; HTTP User-Agent Feld beinhaltet eMule-Version. +bluecow: Korrektur einiger Fehler im neuen ComboBox control (keyboard interface). +bluecow: Mehrere nderungen in der GUI der neuen Suchresultatliste; korrekte Farbdarstellung unter allen Windows Farbschema; Sortierung der Filenamen-Listeintrge + +---------------------- +- 24. Aug 2003 - +---------------------- +bluecow: Hinzugefgt: Neue Suchmethode "Jigle SOAP Interface" um die Jigle-Datenbank mit eMule benutzen zu knnen [Vielen Dank an Melange von Jigle, der dieses groartige Feature eMule angeboten hat] +bluecow: Jigle SOAP Interface: Suchresultate werden auf 100 Files limitiert; Code-Optimierungen zur Entlastung des Servers; lokales Filtern der Suchresultate +bluecow: Hinzugefgt: Erweitertes ComboBox Control fr Suchmethode [eMulePlus] + +---------------------- +- 22. Aug 2003 - +---------------------- +Unk: Irc: Nicks werden nun richtig sortiert +Unk: Irc: wenn ein anderer Nick ein eMule'er ist, kann dieser direkt als Freund hinzugefgt werden (beide Clients mssen v0.30b oder hher sein) +Unk: Irc: Downloadlinks knnen nun direkt an andere eMule-Clients gesendet werden. (DCC-hnlich, beide Clients mssen v0.30b oder hher sein) +Unk: Senden der freigegebenen Dateien an Server wurde verbessert, um Datenverkehr zu verringern +Unk: Hinzugefgt: Anzeige einer Abzahl-Abschtzung vollstndiger Quellen in der Downloadliste und Freigabeliste [Zegzav,modifiziert] + +---------------------- +- 20. Aug 2003 - +---------------------- +Ornis: Korrektur einiger Statistikwerte, gebannte Quellen, A4AF-Quellen +Ornis: Fehler in der Webinterface-Suche korrigiert +Ornis: Korrektur: beim Sprachenwechsel wurden einige Texte nicht aktualisiert [itsonlyme] + +---------------------- +- 19. Aug 2003 - +---------------------- +bluecow: Sprach-DLLs werden nur dann geladen, wenn die Versionsnummer mit der eMule-Version bereinstimmt. +bluecow: Textfarben fr Suchresultate u. Log-Fenster bzgl. Kontrast-Windows-Farbschema korrigiert. + + +v0.30a +---------------------- +- 15. Aug 2003 - +---------------------- +bluecow: Hinzugefgt: Dialog zur Anzeige von eD2K Meta Daten fr Suchresultate, Download-Files und Shared-Files. Der entsprechende Eintrag im Kontextmen ist nur im "Modus fr Fortgeschrittene" vorhanden. + +---------------------- +- 14. Aug, 2003 - +---------------------- +.: Einige neue berprfungen wurden hinzugefgt and Reparaturen gemacht um unfair Clients zu verhindern +.: Die TCP (lokal) und UDP (global) Quellensuche fr Benutzer die viele Dateien auf einmal laden wurde gendert um eine Serversoftware wieder glcklich zu machen und Blacklisting zu vermeiden +.: Nichtmehr benutzte Credits werden nach 5 Monaten gelscht (um den dafr bentigten Speicher in Grenzen zu halten) + +---------------------- +- 12. Aug, 2003 - +---------------------- +bluecow: Server-Fehlermeldungen werden nicht mehr im Serverinfo-Fenster sondern im Log-Fenster angezeigt. +bluecow: ED2K File Meta Daten die whrend einer Filesuche empfangen wurden, werden gefiltert um nicht unntige Daten im part.met und schlielich auch im known.met File zu speichern. +bluecow: Mehrere nderungen bei der Vorschau Funktion: Die Vorschau Funktion wird freigeschalten, wenn mindestens 16 KB (MPEG Audio/Video) oder 256 KB am Anfang des Files vorhanden sind. Die Vorschau Funktion wird auch fr Files vom Typ "CD-ROM Image" bzw. fr Files deren ED2K Meta Daten einen Audio/Video Eintrag beinhalten freigeschalten. Um diese neue Vorschau Funktion zu benutzen, ist entweder VideoLAN Client als Video Player fr Vorschau zu konfigurieren oder das 'PreviewSmallBlocks=1' (Section=eMule) Setting im preferences.ini File anzugeben und die Option "Erstelle Kopie fr die Vorschau" auszuschalten. +Ornis: przisere Statistiken fr: gerettet durch ICH, Kompressionsgewinn & Korruptionsverlust +Ornis: kleinere GUI Korrekturen/nderungen + +---------------------- +- 10. Aug, 2003 - +---------------------- +Ornis: "Quellenrecycling" (wenn Quellen an andere Dateien bergeben werden (NNP,...)) beachtet nun Prioritten der Downloaddateien und ist sicherer gegen endloses hin- & herreichen +Ornis: Alt-Enter ffnet Detail-Dialog fr Downloads & User +Ornis: hinzugefgt: Erweiterte Chunk Selektion, fr eine bessere Wahl, welcher Teil einer Datei als nchstes heruntergeladen wird [Maella & jicxicmic] + +---------------------- +- 4. Aug, 2003 - +---------------------- +bluecow: Hinzugefgt: Extrahieren von Meta Daten und Audio/Video Charakteristika fr MP3,AVI,MPEG und andere Files. Um diese Funktion auszuschalten benutze das "ExtractMetaData" Setting (File=preferences.ini, Section="eMule", Name=ExtractMetaData, Value=0 (disable), Value=1 (einschalten fr MP3 und AVI Files), value=2 (Standard; einschalten fr MP3, AVI, MPEG und andere Files). +bluecow: Hinzugefgt: Senden von Meta Daten und Audio/Video Charakteristika fr MP3,AVI,MPEG und andere Files an Server und andere Clients. Die Text Meta Daten (z.B. Title, Author, Album) werden nicht an die Server aber an andere Clients gesendet. Daten die an die Server gesendet werden, beinhalten: Audio/Video Codec, Media Lnge und Bitrate. +bluecow: Mehr Sicherheit beim berprfen von sharebaren Files im temporren Verzeichnis. + +---------------------- +- 2. Aug, 2003 - +---------------------- +bluecow: Hinzugefgt: Server Info Window mit optionalen Autoscroll, rotierendem Log, Copy+Paste. +bluecow: Hinzugefgt: Option um den Server UDP Port einzustellen bzw. auszuschalten (file=preferences.ini, section="eMule", name=ServerUDPPort, value=0 (keinen Server UDP Port verwenden), value=65535 (standard, einen zufllig gewhlten Server UDP Port verwenden), value= (UDP Port) +bluecow: Hinzugefgt: Einige ausfhrliche Server Socket Error Messages. +bluecow: Korrektur: Einige kleine Focus Problem im Suchfenster. +bluecow: Hinzugefgt: Mehr Spalten im Suchfenster um neue ed2k Meta Tags anzuzeigen. +bluecow: Format von Datum/Zeit Strings ist nicht mehr von der ausgewhlten Sprache abhngig. +bluecow: Hinzugefgt: Statusbars von Files im Pause Modus werden mit abgeschwchten Farben angezeigt [SlugFiller grayPause] + +---------------------- +- 1. Aug, 2003 - +---------------------- +bluecow: Taskbar Notification fr "Download beendet und hinzugefgt" aufgeteilt + +---------------------- +- 30. Juli, 2003 -- +---------------------- +bluecow: Sicherheitskorrekturen einiger Log-Meldungen [thx i0nic] + +---------------------- +- 29. Juli, 2003 -- +---------------------- +.: Einige kleinere nderungen/Bugfixes am SecureHash wurden gemacht. Auerdem kann ein Client mit dem Status "Ungltig" keinen FreundSlot mehr erhalten + : MobileMule Protokoll 0.3x wurde hinzugefgt (siehe mobil.emule-project.net fr mehr Infos) +bluecow: ED2K Protokoll: Korrektur von OP_FILESTATUS fr Files mit einer Lnge von PARTSIZE*N +bluecow: Korrektur: Absturz beim Schlieen wenn interne File Puffer auf HD geschrieben wurden +bluecow: Korrektur: Einige Clients die mehr als ein OP_HELLO sendeten wurden falsch behandelt. + +---------------------- +- 27. Juli, 2003 -- +---------------------- +bluecow: Korrektur: Behandlung von Hashsets fr Files mit einer Lnge von PARTSIZE*N +bluecow: Korrektur: Ungltige Eintrge in known.met werden beim Starten entfernt +bluecow: ED2K Protokoll: OP_SETREQFILEID wird nicht mehr fr Files mit einer Lnge <= PARTSIZE gesendet +bluecow: ED2K Protokoll: OP_FILEREQANSNOFIL wird nicht mehr beim Empfangen von OP_FILEREQUEST gesendet + +---------------------- +- 25. Juli, 2003 - +---------------------- +Ornis: manuelles Deaktivieren der Autovervollstndigung: setze in der "config\preferences.ini" den Eintrag "UseAutocompletion=0" +Ornis: Webinterface: Sortieren von Suchergebnissen ermglicht +bluecow: Es kann in allen Listen mit der Tastatur gesucht werden (einfach die ersten Zeichen des gesuchten Labels eintippen) [ZZ] + +---------------------- +- 22. Juli, 2003 - +---------------------- +bluecow: Korrektur/Hinzugefgt: Unbeabsichtigtes Freigeben der eMule Installationsverzeichnisse (config, lang, webserver) und einiger Dateitypen im Temp-Verzeichnis. +bluecow: Korrektur: Einem Client wurden manchmal korrekt komprimierte Daten gesendet, trotzdem konnte der empfangende Client diese nicht immer korrekt dekomprimieren. +Ornis : Position des Drag&Drop-Bildes beim Schieben von Downloadeintrgen korrigiert + +---------------------- +- 20. Juli, 2003 - +---------------------- +Ornis: IRC- & Nachrichten-Dialoge nutzen nun auch direkt schliebare Reiter +Ornis: History-Funktion fr das IRC- & Nachrichten-Fenster, um alte eingegeben Nachrichten via Cursor hoch/runter abzurufen +Ornis: Doppelklick auf die Serverinformation der Statusleiste ffnet ein Dialog mit den Details des aktuell verbundenen Servers +Ornis: neue Downloads via Browser-Link werden nun auch der in der Suche aktuell gewhlten Zielkategorie zugeordnet +Ornis: Leeren der History der Suchbegriffe/Serverlisten-URLs : ALT oder STRG gedrckt halten, + ENTFERNEN drcken +Ornis: Statistiken: Prozentanzeige der erfolgreichen&fehlgeschlagenen Uploadsessions eingefgt +Ornis: Zhlen der fehlgeschlagenen Uploadsessions korrigiert [Maella] + +---------------------- +- 19. Juli, 2003 - +---------------------- +bluecow: Korrektur: Download von Files mit einer Lnge von 9728000 Bytes. +bluecow: Korrekturen/Hinzugefgt: Mehrere Teile von SlugFiller's SafeHash [SlugFiller] +- SafeHash: Known file hashing features +- SafeHash: Miscellanious safety and tweaking features +Ornis: verbesserte Aktualisierung der Downloadliste bei neuen Quellen einer (Quelle-)aufgeklappten Download-Datei +Ornis: Korrektur eines Typos im Webinterface, der u.U. Instabilitten verursachten konnte +Ornis: 2 Einstellungsmglichkeiten im Webinterface (wieder) hinzugefgt +Ornis: automatisches Zuweisen von neuen Downloads zu Kategorien anhand eines Filters [HoaX69 +bluecow: Upgrade auf CTreeOptionsCtrl v1.55 [thx PJ Naughter] +bluecow: Neue Log Panes, Multiline Edit Controls mit optional Auto Scroll und Rotating Log. +(Note: The previously used "MaxLogMessages" entry in preferences.ini is obsolete and is replaced with "MaxLogBuff" which +can be used to specify the size of the buffer(s) in KByte. Default size = 64 KByte) +bluecow: Searchresult list: Search results which match files in the download list are shown in a fixed shade of red. +bluecow: Font for Server-, Message- and IRC-Window can be specified. +bluecow: Timestamp setting for IRC-Chat also applies timestamps to messages from clients in Message window. +bluecow: Timestamps in IRC-Window and Message-Window localized. +bluecow: Added memory debug statistics for debug builds only [UVman] + +---------------------- +- 18. Juli, 2003 - +---------------------- +Ornis: Hinzugefgt: manuelles Verwalten von Quellen, bei mehreren Anfragen bei gleichen Clients (A4AF) [basierend auf sivka,enkeyDEV] +Ornis: Hinzugefgt: automatisches Zuweisen neuer Downloads zu Kategorien, anhand von Dateinamen-Filtern [HoaX_69] +Ornis: Korrektur des Zeitplaner-ini-Speicherorts -> \config\ + +---------------------- +- 16. Juli, 2003 - +---------------------- +bluecow: Korrektur: Download von Files mit einer Gre von mehr als 2 GB [thx Maella] +Ornis: Korrektur: spanische & franz. bersetzungsfehler->wenig Suchergebnisse +Ornis: verbesserte Aktualisierung der Secure-Ident-Statistikanzeige + + +v0.29c +---------------------- +- 13. Juli, 2003 - +---------------------- +bluecow: Mehrere kleine Korrekturen und Code Verbesserungen [Maella, dpr, rayita] + +---------------------- +- 11. Juli, 2003 - +---------------------- +Ornis+bluecow: String Resourcen in Language Resource DLLs aufgeteilt [Elandal] + +---------------------- +- 9. Juli, 2003 - +---------------------- +bluecow: Korrektur im IPFilter. + +---------------------- +- 7. Juli, 2003 - +---------------------- +bluecow: Hinzugefgt: LAN-IP und IP-Filter fr Server IPs und fr Client IPs die von Servern oder von anderen +Clients empfangen wurden (Source Exchange). +Beachte: Die Option "Server/Filtere ungltige IPs" wurde dahingehen erweitert dass nun die Server IPs und die +Client IPs bzg. LAN IPs gefiltert werden. Weiters wurde diese Option von der "Server" Page auf die +"Erweitere Optionen" Page verschoben und lautet nun "Filtere Server und Client LAN IPs". Wenn eMule innerhalb +eines LANs eingesetzt wird, ist das Desaktivieren dieser Option womglich sinnvoll um die Kommunikation mit +Servern und Clients innerhalb des LANs zu ermglichen. + +---------------------- +- 5. Juli, 2003 - +---------------------- +.: Einige Sicherheitskorrekturen wurden am SecureHash gemacht. Auerdem ist dieser nun in der Standarteinstellung aktiviert. +.: Die Wartepostion ist nun auch durch SecureHash geschtzt (wenn eingeschlatet) +.: ein Bug der zur Folge hatte das Quellen falsche Informationen und Dateikommentare/namen hatten wurde behoben +bluecow: Korrektur mit 'completing' Datei die gleichzeitig im Uploaded stand. +bluecow: Korrektur von Datei Preview wenn der Pfad Leerzeichen beinhaltet [mediterranean] +bluecow: Korrektur: Fehler beim Disconnecten und Lschen Clients [SlugFiller] +bluecow: Korrektur: Fehler in Statistiken. Error- und Banned Clients wurden nicht korrekt ausgwertet. + +---------------------- +- 2. Juli, 2003 - +---------------------- +bluecow: Besseres Filtern der Sourcen bzlg. glter IP+Port die bei einer Dateisuche gefunden werden. +bluecow: Hinzugefgt: Boolsche Suchausdrcke (AND, OR und NOT Operator sowie Klammerungen) + +---------------------- +- 1. Juli, 2003 - +---------------------- +bluecow: Korrektur: Suchanfragen haben das falsche Metatag fr die File-Extension benutzt. +bluecow: Hinzugefgt: Spalte in Server-Fenster um Server-Version anzuzeigen. +bluecow: Korrektur: Server mit 0.0.0.0 IP wurden manchmal zur serverlist hinzugefgt +bluecow: Korrektur: Lnge der komprimierten Control Data Packete [thx MKThunderStorm] +bluecow: Optimierung bei Source Exchange wenn ein Client zum ersten mal nach Sourcen gefragt wird. + +---------------------- +- 30. Juni, 2003 - +---------------------- +bluecow: Hinzugefgt: min/max filesize im Suchendialog kann mit einer der Einheiten (b[yte],k[byte],m[byte],g[byte]) angegeben werden. +Ornis: kleine Anpassungen in der Dateinamen-Bereinigung +Ornis: Webinterface: Korrektur der Einstellung fr die richtige Seitencodierung trkischer Nutzer + +---------------------- +- 29. Juni, 2003 - +---------------------- +bluecow: Korrektur von Memleaks in Uploadclients, hervorgerufen durch Clients die zu groe Blcke anfragen +bluecow: Korrektur von Memleaks bei doppelt gehashten Dateien +bluecow: mehrere nderungen fr stabileren Code und weniger potentielle Memleaks +Ornis: Korrektur gegen Abstrze nach Verbindungstrennung des IRC +Ornis: Anzeige der aktuellen Gre von Partfiles auf der Festplatte (Dateidetails & Tooltips) +Ornis: kleinere GUI Korrekturen + +---------------------- +- 27. Juni, 2003 - +---------------------- +bluecow: Hinzugefgt: Liste freigegebener Dateien werden mit ClientIP & Port zum Server geschickt, um mehr Quellen bei globalen UDP-Suchanfragen zu erhalten +bluecow: Hinzugefgt: Liste freigegebener Dateien wird mit mehr Metatags zum Server geschickt, um genauere Suchresultate bei Dateierweiterung & -typ zu erhalten +bluecow: Hinzugefgt: Tooltips fr Suchresultate um alle Meta-Daten anzuzeigen. + +---------------------- +- 25. Juni, 2003 - +---------------------- +bluecow: Hinzugefgt: Overlay Icons fr Clients die erfolgreich mit Secure-Ident identifiziert wurden. +bluecow: Korrektur: Fehler bei GetTickCount Zeit Messung [dpr] +Ornis: Hinzugefgt: Secure-Ident-Statistik (wie viele erfolgreiche & fehlgeschlagene Clients bekannt) +Ornis: Korrektur: Men-Resourcen-Bug im Einstellungsdialog/Zeitplaner +Ornis: Korrektur: Crash der trkischen bersetzung + + +v0.29b +---------------------- +- 17. Juni, 2003 - +---------------------- +bluecow: Dragstart von Kategorien nicht mehr bersensibel +Unk: Irc: erkennt nun auch UnderOps. +Unk: Pings (fr Info) zu Servern sind nun seltener +Unk: Bugfix bzgl. der Pausen zwischen Server-Pings +Unk: kleiner Bugfix in den Statistiken +Ornis:genauere Downloadgeschwindigkeitsangabe [zz] + +---------------------- +- 15. Juni, 2003 - +---------------------- +bluecow: Korrektur: gelschter Client konnte u.U. fr die A4AF-Statistik genutzt werden +bluecow: berarbeiung d. Ext. Settings Dialog um zuknftig mehr Optionen zu untersttzen +Ornis: Webinterface: Links are relative now +Ornis: verbesserter Umgang mit UNC-Pfaden fr die Verzeichnisfreigabe +Ornis: known.met wird nun korrekt im Konfigurationsverzeichnis verarbeitet +Ornis: verbesserte Prfung, welche neuen Dateien gehasht werden mssen +.: Ein neues sichers Identifkationssystem (gegen userhash "stehlen") wurde implementiert. Aus Testgrnden ist es in Version 29b per Voreinstellung deaktiviert. Unter Sichherheitseinstellungen kann es aktiviert werden. Bitte konsultiere die FAQ fr mehr Infos. +.: Der erste Teil eines erweiterten Spamfilters, der automatisch verdchtige Nachrichten erkennt und filtert wurde implementiert. + +---------------------- +- 13. Juni, 2003 - +---------------------- +Ornis: Webinterface: Graphen verbessert, grer, schner, inklusive Verbindungsgraph [emule+] +Ornis: Webinterface: Knopf zum Entfernen fertiggestellter Downloads +Ornis: Liste freigegebener Dateien: Mittelklick auf einen Eintrag ffnet dessen Kommentardialog +bluecow: Implementierung der ed2k-Protokoll-Nachricht OP_CHANGE_CLIENT_ID fr besseren Umgang mit LowID-Quellen +bluecow: Korrektur mehrerer Probleme beim Umgang mit uninitialisierten Speicherinhalten [donq] +bluecow: Korrektur eines Problems beim Empfang falscher IDs von einem Client +bluecow: Workaround fr vereinzelte Abstrze durch Socket-Lschung bei Win-XP Nutzern + +---------------------- +- 12. Juni, 2003 - +---------------------- +bluecow: Korrektur mehrerer potentieller Heap-Corruptions. +bluecow: Korrektur von Problemen mit der Downloadraten-Messung, welche einen Absturz auf langsamen/Win98 Systemen hervorrufen konnte +bluecow: Korrektur eines Problems beim Verarbeiten von fehlerhaften OP_HELLO -Paketen von anderen Clients + +---------------------- +- 9. Juni, 2003 - +---------------------- +bluecow: Option hinzugefgt, um den Sicherheitsgrad fr das Schreiben von Kerndatei-Daten anzupassen (evtl. hilfreich fr Win98 Nutzer) [Idee SlugFiller] + +---------------------- +- 8. Juni, 2003 - +---------------------- +bluecow: Fr Modder: Mglichkeit fr das Compilieren des Sourcecodes fr stringbasierte Ressourcenidentifikation (suche nach USE_STRING_IDS !) + +---------------------- +- 7. Juni, 2003 - +---------------------- +bluecow: Fehlerkorrektur im Server-Nachrichtenhandler fr OP_SERVERIDENT +bluecow: verbessertes Handling der Server-Nachrichten OP_SERVERMESSAGE und Client-Nachrichten OP_MESSAGE. + +---------------------- +- 6. Juni, 2003 - +---------------------- +Ornis: Fix: Speicherort eigener Kommentare korrigiert (config-Ornder) +Ornis: Webinterface: Kategoriensupport bei Spaltensortierung korrigiert +bluecow: Korrektur eines potentiellen Problems mit dem Systemtray-Icon bei Win98-Systemen (Vielen Dank an Ergol/donq) +bluecow: Gre von Suchausdrcken verringert + + +0.29a +---------------------- +- 2. Juni, 2003 - +---------------------- +Ornis: Win9x-Inkompatibilitt korrigiert (Win9x absturzfreudig) +Ornis: einige Mens wurden nicht auf die neue Sprache umgestellt, wenn diese gendert wurde - korrigiert + +---------------------- +- 1. Juni, 2003 - +---------------------- +bluecow: Quellen von der lokalen/globalen Serversuche werdeb vorgefiltert, um falsche Anzeigen in der Quellenspalte der Suchliste zu vermeiden, als auch von manchen Servern falsch geschickten Quellen +bluecow: Korrektur eines Fehlers bei fertiggestellten Dateien, welche beim Neustart neu gehasht wurden und einen Doppeleintrag in der known.met verursachen konnte + +---------------------- +- 31. Mai, 2003 - +---------------------- +bluecow: Korrektur eines Problems mit Servern welche verschiedene Serverbeschreibungspakete whrend der Laufzeit schicken + +---------------------- +- 29. Mai, 2003 - +---------------------- +bluecow: Korrektur: Temp-Verzeichnis wurde unter Umstnden auf das Incoming-Verzeichnis gesetzt +bluecow: Korrektur: kleiner Fehler beim Dateiffnen- und Verzeichnissuchen-Dialog und den zugehrigen Property-Pages +Ornis: Erkennung von Shareaza fr allg. Information und Statistiken +Ornis: neue Sprache: Galizisch (von Emilio) + +---------------------- +- 28. Mai, 2003 - +---------------------- +bluecow: Fixed memory leaks in uploader. +bluecow: Fixed memory leaks in all timer callback functions; added exception handling. +bluecow: Reduced GDI resource usage for Win9x/WinME. +bluecow: Added more debug log messages for unknown TCP packets. +bluecow: Statusbar text is cleared when reseting the log or debug log. +bluecow: Fixed missing file exception handler in upload function. + +---------------------- +- 27. Mai, 2003 - +---------------------- +bluecow: Korrektur einiger Probleme mit part.met/part-Dateien die zu gross/klein sind (potentieller File-Completion bug). [SlugFiller] +bluecow: Korrektur: Nicht freigegebener Speicher im Archive Recovery thread. +bluecow: Korrektur: Absturz im Archive Recovery thread bei Archive das gerade "completed" wird. + +---------------------- +- 26. Mai, 2003 - +---------------------- +Ornis: Webinterface: Korrektur: u.U. wurden aktive Downloads als fertiggestellt dargestellt +Ornis: neue Sprache: Galizisch (von Emilio) +bluecow: Korrektur: Nicht freigegebener Speicher im WebSocket. +bluecow: Korrektur: Nicht freigegebene GDI Resourcen und falsch benutzt GDI Resourcen +bluecow: Proxy Error Meldungen. Einschalten mit Eintrag "ShowErrors=1" in "[Proxy]" Section von PREFERENCES.INI. +bluecow: Korrektur: Doppelte Quellen durch Source Exchange Packete mit falschen Versionsnummern. +bluecow: More reliable identification of clients sending an UDP packet by searching clients with IP and UDP port + +---------------------- +- 24. Mai, 2003 - +---------------------- +Ornis: Konfigurationsdateien haben ein eigenes Verzeichnis "config\". Dies kann nicht freigegeben werden. Beim Erststart werden alte Konfigurationen dorthin verschoben. +Ornis: Kategorien-Reiter sind nun sortierbar (Drag&Drop) + +---------------------- +- 21. Mai, 2003 - +---------------------- +VQB: LowID-Uploadslot-Behandlung alterniert nun mit HighID-Uploads +VQB: Code-cleanup und nderungen zu mehr Integerarithmetik [Elandal] +Ornis:Webinterface: Fortschrittsbalken zeigt Blauabstufungen, je nach Quellenanzahl von Dateiteilen [Ju1i3n] +VQB: Anpassung der Reihenfolde fr QR (high speed -> low speed DL gefolgt von low -> high QR) + +---------------------- +- 19. Mai, 2003 - +---------------------- +Ornis: Webinterface: fix: ED2k-Links in Kategorie downloaden +Ornis: Webinterface: Transferliste nun mit weiteren Kategorien (Dateityp,Status) +Ornis: Aktualisierung der Skala der Statistik-Graphen wenn up/down Bandbreite bers Webinterface gendert wird +Ornis: Asynchsocket auf v1.2 aktualisiert +bluecow: Korrektur potentieller Probleme unter Win98 betreffend einiger Windows Messages. + +---------------------- +- 17. Mai, 2003 - +---------------------- +bluecow: Korrektur im Serverfenster: Server werden korrekt nacj IP sortiert. +bluecow: Korrektur: Es werden keine Backup Dateien mit 0 Byte Lnge oder mit fehlerhaftem Inhalt erzeugt. +bluecow: Korrektur: Exception handling und zuverlssige Speicherfreigabe im Falle eines Fehlers fr alle met-Dateioperationen. +bluecow: Alle eMule Fehlermeldungen die sich auf Dateien beziehen beinhalten eine Fehlermeldung vom Betriebssystem. +bluecow: Suchen:Suchname , Server:Servermet-URL - diese Kontrollen beinhalten eine Liste der zuletzt benutzten Eintrge (aka Autovervollstndigung), AltGr+Entfernen lscht jeweils die History +bluecow: Serverfenster/Suchfenster: Im Listview kann mit einem Dialog gesucht werden (Ctrl+F,F3,Shift+F3) +Ornis: Korrektur: Win9x-Crash, beim Zugreifen auf das Kategorien-Reiter-Popupmen fr das Einstellen des Filters des ersten Reiters +Ornis: Korrektur, bzgl. Vorschau von Archiven vor jeglichem Download +Unk: Fix small overhead bug +Unk: irc: Liquid updated their ircd. It broke eMules IRC.. It is now updated.. +Unk: irc: eMule now should support multi mode commands. + +---------------------- +- 16. Mai, 2003 - +---------------------- +bluecow: Korrektur: Beim Kopieren von Text ins Windows Clipboard, konnte es zu nicht freigegebenen Windows Resourcen kommen. +Ornis: viele neue Statistiken hinzugefgt (von Khaos) +Ornis: Fehlerbehebung im Zeitplaner +Ornis: konfigurierbares Datums-/Zeitformat des Logs + +---------------------- +- 15. Mai, 2003 - +---------------------- +bluecow: Korrektur des LowID Fehlers der durch beschdigte part.met Dateien hervorgerufen wurde. +bluecow: Korrektur des Ladens der part.met Dateien: Bei einer beschdigten part.met Datei wird der Ladevorgang fortgesetzt. +Sony: Problem behoben fr sehr grosse Datein in MSVC 7.1 release builds; Korrektur beim "Minimiere zu Icon" Button (danke zegzav) + + +0.28b: +---------------------- +- 8. Mai, 2003 - +---------------------- +Ornis: Kategorien: erweiterte Auswahl von Funktionen des alten "alle"-Reiters. Umschaltbar auch zu u.a. Video, Audio, Pausiert, Ladend, bertragen,... +Ornis: Upload-, Warteschlange- und Bekannteclients-Listen werden nun mit der Anzahl der aufgelisteten Clients angezeigt +Ornis: anderes Trayicon, wenn eMule mit einer niedigen ID zum Server verbunden ist (eMule mit Augenbinde (emule+) ) +Ornis: Webinterface: Kategorienuntersttzung +Ornis: Webinterface: stellt nun auch fertig bertragende Dateien dar + +---------------------- +- 3. Mai, 2003 - +---------------------- +bluecow: Korrektur: Nicht freigegebener Speicher beim Download von server.met via HTTP [UVman] + +---------------------- +- 2. Mai 2003 - +---------------------- +bluecow: Korrektur einer weiteren Mglichkeit dass ein ungewollter Client zu einem Freund wird. + +---------------------- +- 28. April 2003 - +---------------------- +bluecow: Kleine Korrekturen bei Icons in Server- und Nachrichtenfenster. +bluecow: Standard Shortcuts fr Log- und Debug-Listview Controls (Kopieren=Strg+C, Alles Selektieren=Ctrl+A) +Ornis: Websuche von Filedonkey.com filtert nun auch mittels Dateigrenbeschrnkung + +---------------------- +- 27. April 2003 - +---------------------- +bluecow: berarbeitung des gesamten Packet Lese-Codes um ein zuverlssiges Exception Handling und Speicherfreigabe zu ermglichen. +bluecow: berarbeitung des Meta Tag Verarbeitung-Codes um neue Meta Tags zu untersttzen. +bluecow: Korrektur: Files die auf Pause oder Stopp gesetzt wurden konnten manchmal weiterhin empfangene Daten in das Partfile schreiben. +bluecow: Neu: Passive Quellensuche fr neu zur Downloadliste hinzugefgte Dateien die noch nicht geshared wurden. +bluecow: Korrektur: Kleinere nicht freigegebene Speicherblcke und nicht korrekte Verwendung des C++ delete Operators [NoamSon] +Ornis: Webinterface weist IPs nach 5 fehlgeschlagenen Loginversuchen fr 15 Minuten ab +Ornis: Bereinigung von Dateinamen: Anpassbarer Teilstringfilter (.ini : FilenameCleanups= ) +Ornis: Option zur automatischen Dateinamenbereinigung bei Downloadstart (Einstellungen/Dateien) + +---------------------- +- 26. April 2003 - +---------------------- +Ornis: wenn der verbundene Server ein Limit fr die Anname freigegebener Dateien hat, sendet eMule nur entsprechend viele + +---------------------- +- 25. April 2003 - +---------------------- +bluecow: Korrektur von leeren freigegebenen Verzeichnissen und eDonkey Protokoll Meldung OP_ASKSHAREDFILESDIR +bluecow: First Run Time wizard hat einen "Fertigstellen" Button bekommen. +Ornis: Links im Chat (hypertextctrl) stoppen nun nicht mehr an Umlauten +Ornis: bessere URL-Decodierung (z.B. Sonderzeichen in ed2k-Links) + +---------------------- +- 24. April 2003 - +---------------------- +bluecow: Korrektur bei Behandlung von eDonkey Protokoll Meldung OP_ASKSHAREDIRS. Ein Client konnte einen nach freigegebenen Verzeichnisse fragen obwohl gerade freigegebene Verzeichiss/Dateien empfangen wurden. +bluecow: Korrektur von nicht freigegebenen Speicher bei komprimierten Packeten (Danke Blackstar2) +bluecow: Korrektur von eDonkey Protokoll Meta Tags vom Typ "float", die von Servern gesendet wurden die freigegebene Dateien von Hybrids 0.48+ anbieten. +Ornis: Zeitplaner Korrekturen +Ornis: Zeitplaner-Eintrge knnen via Hotmen (Alt-X) direkt aktiviert werden, als auch (de)aktivieren des Zeitplaners +Ornis: Senden von gleichen freigegebenen Verzeichnissen nicht mehr mehrfacht (u.U.) +Ornis: Hinzugefgt: genauere Datentransfermessung auch unter CPU-Volllast [Ottavio84+Badwolf] +Ornis: kleinere GUI-Fixes + +---------------------- +- 23. April 2003 - +---------------------- +bluecow: Korrektur: Breite des Logfensters ist nun frei einstellbar, damit auch sehr lange Meldungen vollstndig gelesen werden knnen. +bluecow: Korrektur: Potentieller Bug in MFC der die Windows Sockets DLL nicht freigegeben hat. +Sony: neue Option in erw. Einstellungen (Abstellen von Source Exchange Meldungen im verbose Log) + +---------------------- +- 22. April 2003 - +---------------------- +Ornis: Zeitplaner-Kontrollen dem Hotmen hinzugefgt +Ornis: klarere Tastaturkontrolle fr Quellen ausklappen/einziehen via Tastatur + +---------------------- +- 20. April 2003 - +---------------------- +Ornis: Zeitplaner: Einstellungen sichern korrigiert +Ornis: Kategorie fortsetzen & Statistiken-nicht-neu-zeichnen - Einstellungen korrigiert +Ornis: wechselnde Kategorie Titel bei aktivierter Downloadinfo-in-den-Reitertiteln, korrigiert + +---------------------- +- 19. April 2003 - +---------------------- +bluecow:Korrektur: Einstellungen/Verzeichnisse - DirectoryTree Control hat die Windows Icon Image Liste gelscht. +bluecow:Korrektur: Einstellungen/Verzeichnisse Dialog hat nicht (mehr) existierende freigegebene Verzeichnisse angezeigt. +bluecow:Doppelklick im Freigegebenen Dateien Fenster ffnet die Datei mit dem assozierten Programm. +bluecow:Datei ffnen Befehl im Download/Freigegebenen Dateien Fenster bewirkt die gleiche Aktion wie ein Doppelklick im Windows Explorer. + +---------------------- +- 18. April 2003 - +---------------------- +bluecow:Korrektur: einige Log-Meldungen wurden beim Starten nicht angezeigt. + +---------------------- +- 17. April 2003 - +---------------------- +bluecow:Suchfenster und Freigegebene Dateienfenster zeigen die Dateiicons an. +bluecow:Korrektur im Suchfenster: Die Anzeige der Anzahl der gefundenen Dateien eines anderen Clients stimmte nicht, wenn er mehrere Verzeichnisse hatte. + + +v0.28a +---------------------- +- 15. April 2003 - +---------------------- +VQB: lange Uploadsessions werden auf die "voller-Chunk"-Methode geprft +VQB: vermeide mehrfaches hashen von Verzeichnissen (khaos) +Sony/bluecow: der Hashing-Algorithmus wurde verbessert, nimmt nun weniger CPU Zeit in Anspruch + +---------------------- +- 14. April 2003 - +---------------------- +VQB: Langzeit UL/DL-Verhlnis zu den Statistiken hinzugfgt + +---------------------- +- 13. April 2003 - +---------------------- +bluecow:"einen Freund hinzufgen" Dialog berarbeitet. +bluecow:"Zeige Details" Funktion fr Freund zeigt den Freund-"Details" Dialog wenn man nicht mit dem Freund verbunden ist. Wenn man gerade mit dem Freund verbunden ist, wird der "Quellen Details" Dialog angezeigt. + +---------------------- +- 12. April 2003 - +---------------------- +Unk: Es werden Dateilimits vom Server ausgewertet (Hard- und Softfile limits) +Unk: Serverliste wurde nicht aktualisiert, wenn eine Serverbeschreibung empfangen wurde +bluecow:Provisorische Lsung (wahrscheinlich fr immer :) um bei einem Doppelklick auf die Spaltenseparatoren die Spaltenbreite der Listen nicht auf 0 zu setzen. +bluecow:Korrektur der Mglichkeit dass ein ungewollter Client zu einem Freund wird. +bluecow:Korrektur von OP_ASKSHAREDFILESDIR: Dateien in freigegebenen Verzeichnissen die nicht mit einem Backslash geendet haben wurden nicht gesendet. +bluecow:Anzeige der freigegebenen Verzeichnisse eines anderen Clients im Suchfenster. +bluecow:Korrektur Quellenaustausch: Beim Wechsel von HighID zu LowID kann ein anderer Client eine Quelle zurckliefern die sich auf die aktuelle IP bezieht und eMule versucht zu sich selbst zu verbinden. + +---------------------- +- 11. April 2003 - +---------------------- +bluecow:Vereinheitlichen aller Hinweisdialoge. +bluecow:Optimierungen der Ausgabe- und Sortierungsfunktionen aller Listen-Fenster. +bluecow:Korrektur im Quellenaustausch: Ein Client bekam erst dann anderen Quellen, wenn er zumindest einen Teil der Datei zum Sharen anbieten konnte. +bluecow:Kleine Optimierungen beim Laden von server.met +bluecow:Behandlung von eDonkey Protokoll Meldung OP_END_OF_DOWNLOAD +bluecow:Mehrere kleine Source Code nderungen und Korrekturen von potentiellen Fehlern die durch die Kompilierung mit Warnungsstufe 4 erkannt wurden. + +---------------------- +- 9. April 2003 - +---------------------- +bluecow:Korrektur der Hashset Anfrage/Antwort wenn der andere Client nicht sofort einen Hashset sendet. +bluecow:Korrektur der Speicherstruktur bei Empfang des Server Datums OP_SERVERIDENT ohne Zeichenketten. + +---------------------- +- 7. April 2003 - +---------------------- +Ornis: Kategorien: Doppelklick ffnet die Kategorie-Eigenschaften; Kategorien knnen in der Downloadlist als Spalte angezeigt werden (optional) +Ornis: Kategorien: neu Auto-Priorittseigenschaft, neu zu einer Kategorie zugewiesene Dateien erhalten diese Downloadprioritt +Ornis: Kategorien: nchste pausierte Datei fortsetzen - fr die gleiche Kategorie mglich (optional & manuell) +Ornis,bluecow: bessere Erkennung von MLDonkey +Ornis: rotes Warn-Bewertungsicon erscheint wenn mehr als 1/3 der Bewertungen negativ sind + +---------------------- +- 6. April 2003 - +---------------------- +bluecow:Neuer First Run Time Wizard +bluecow:Hotfix fr zu lange geratene partfiles. +bluecow:Korrektur des Credit-bertragungszhlers fr Clients die mehr als 4GB mit einem anderen Client transferiert haben (Dank an le_fred+Harvey56) + +---------------------- +- 5. April 2003 - +---------------------- +bluecow:Neues Logfenster mit rotierendem Inhalt, max. Anzahl der Zeilen kann in PREFERENCES.INI angegeben werden (MaxLogMessages=; =-1 ... kein Limit) +Ornis: Webinterface: Downloadliste zeigt Prioritten an und die Kontrollen um diese zu ndern +Ornis: Webinterface gibt nun Bilddateien zurck, um diese auch fr die eigene Darstellung zu nutzen. (notwendige Bilder sind im Installer und dem Binary-Paket enthalten) + +---------------------- +- 4. April 2003 - +---------------------- +Ornis: unntiges Neuzeichnen (+Programmfreeze) der Statistikgraphen entfernt + +---------------------- +- 3. April 2003 - +---------------------- +bluecow:Korrektur des Dialoges "Es wurde versucht, auf eine Stelle hinter dem Ende von unbenannt zuzugreifen". +bluecow:Kleine Optimierungen um mit MD4 Hashs effektiver zu arbeiten. +bluecow:Unbekannte Packete werden mit einem kleinen hex-dump der Daten im Debug Window angezeigt (Maella). +bluecow:Doppel-Klick in allen Client bezogenen Fenstern ffnet den Quellendetaildialog. +bluecow:Doppel-Klick auf Dateiname im Downloadfenster, ffnet den Dateidetaildialog. +bluecow:Quellen die whrend des Suchens vom lokalen oder globalen Server retourniert werden, stehen beim Download sofort zur Verfgung. +bluecow:Beim Hinzufgen eines Downloads aus der Dateiliste eines anderen Clients, wird der Client sofort als Quelle eingetragen. +bluecow:Suchfenster: Bereits in KNOWN.MET eingetragene Dateien werden farblich angezeigt. +bluecow:Serverfenster: Zuletzt eingetippte SERVER.MET URL wird in Settings gespeichert. + +---------------------- +- 1. April 2003 - +---------------------- +bluecow:Korrektur von Deadlock nach Abbrechen eines HTTP Downloads von server.met +Ornis: Kategorie-Reiter zeigen als Tooltip einige Zusammenfassungs-Informationen an +Ornis: Optionale Anzeige der Kategorie-Reiter als "Titel (ladend/Gesamtanzahl)" (Einstellungen->Anzeige) +Ornis: Statusbar-Doppelklick Reaktion, z.B. auf Log-Spalte zeigt ganze letzte Log-Zeile in einem Infofenster, Doppelklick auf Nachricht-Icon ffnet das Nachrichten-Fenster +Ornis: Zeige Webinterface-Status in "Meine Info", inkl. aktive Sessions + +---------------------- +- 30. Mrz 2003 - +---------------------- +Ornis: Webinterface Transferliste nach Fortschritt sortieren verbessert +Ornis: Kategorien-Einstellungen werden nun nicht erst beim Programmende gespeichert +Ornis: Datum&Zeit in den Logs entsprechend nun Landeseinstellungen + +---------------------- +- 28. Mrz 2003 - +---------------------- +Ornis: Webinterface: Gast darf nicht mehr Logs lschen +Ornis: Webinterface: Server-Suche und Downloads starten +Ornis: Webinterface: Dateieinstellungen werden nun bernommen +Ornis: mehr Tastaturkrzel fr Listen:Strg+A whlt ganze Liste aus; Downloadliste: +,-,Cursor links/rechts fr Quellenanzeige ein/aus + +---------------------- +- 27. Mrz 2003 - +---------------------- +Ornis: Upload-Tooltipps zeigen bertragene Datenmengen besser an +Ornis: neu:Zeitplaner(Scheduler), um Einstellungsnderungen und Aktionen zeitgesteuert zu planen +Ornis: Webinterface-Vorlagendatei kann in den Einstellungen nun via Dateibrowser frei gewhlt werden + +---------------------- +- 26. Mrz 2003 - +---------------------- +Ornis: Webinterface: Portnderungen startet Webserver automatisch neu [cax2] +Ornis: Webinterface: Gastzugang deaktivieren funktioniert nun sofort +Ornis: einigen eventuellen Programmende-Crashes vorgebeugt [2bottleMOD] + + +v0.27c +---------------------- +- 23. Mrz 2003 - +---------------------- +Ornis:Korrektur eines Sicherheitsfehlers, der zum Absturz von eMule fhren konnte (neue Einstellungen in Einstellungen/Sicherheit) +Ornis:Webserver: Anzeige von Dateigren >2GB korrigiert +Ornis:Webserver-Template verbessert von Daan + + +v0.27b +---------------------- +- 21. Mrz 2003 - +---------------------- +Unk: Korrektur eines mglichen Crashs bzgl. Kommentarpaketen +Unk: Entpackte Gre von Paketen wird berprft, um Problemen vorzubeugen (emarc) +Ornis:Korrektur fr die Verzeichnisauswahlbox, wenn kein C-Laufwerk vorhanden ist +Ornis:Korrektur eines Zugriffsproblems bei sehr groen Dateien [gabest] +Ornis:bertragungszhler im Credit speichert nun auch >4GB + +---------------------- +- 19. Mrz 2003 - +---------------------- +VQB: Selber in die Zwischenablage kopierte ed2k Links werden nicht mehr durch die Zwischenablage-berwachung gemeldet +Ornis: Webserver Kontroll-Oberflche hinzugefgt [Dank an kuchin], mit folgenden nderungen/Korrekturen: + -Fortschrittbalken nun farbig (Part-Status-Farben)! + -mehrere Darstellungsverbesserungen + -Datengren besser umgerechnet + -neue Einstellungsmglichkeiten: Quellen-Pro-Datei-Limit, Verbindungen-Limit, neue Verbindungen pro 5sek, 2 Dateien-Einstellungen + -Zwei Nutzeraccounts mglich: Admin(voller Zugriff) & Gast(nur Einsicht) + -Inkompatibilitt der Kontrollen-Iconanzeige bzgl. Opera- & alte Mozillabrowser korrigiert + -Sicherheitsbug-Korrektur, bzgl der SessionsID Erstellung + -Anmeldungen und Abmeldungen werden im Log vermerkt +Unk: Eine alte Version oder MOD schaint den client hash auf Nullen zu setzen. eMule prft das und resettet diesen wenn ntig. +Unk: UDP nutzt jetzt zur Client IP auch den Port um einen Sender zu identifizieren/finden + +---------------------- +- 16. Mrz 2003 - +---------------------- +Unk: Doppelupdate in der bekannte-Clients-Liste behoben (JustusJonas) + +---------------------- +- 15. Mrz 2003 - +---------------------- +Ornis: Beim Abbruch von Downloads einer ganzen Kazegorie wird nun vorher nach Besttigung gefragt. +Ornis: Korrigiert: Es war mglich, die gleiche Datei via Weblink mehrfach hinzuzufgen, wenn eMule gerade nicht lief +Ornis: Es kann nun das Verbose-Log auf Disk protokolliert werden, ohne es im Serverfenster anzeigen zu mssen +Unk: Bugfix: beim Warteschlange dekaktivieren +Unk: Quellenaustausch aktualisiert, um den Usershash zu bercksichtigen - hilft gegen Doppelt-Clients +Unk: Client-Detailsanzeige Korrektur +Unk: Korrekur eines Fehlers, der "zuletzt gesehen" eines Clients nicht aktualisierte, wenn dieser nur UDP nutzte +Unk: bersetzungen der Bekannte-Clients-Liste erweitert +Unk: Korrektur eines Fehlers, der eine Quelle ewig beim Statusnachfragen lie + +---------------------- +- 14. Mrz 2003 - +---------------------- +Ornis: Korrektur: Versionstatistiken fr die Hybridversionen nun sichtbar +Ornis: Verzeichnisanzahl fr das Senden des Paketes SHAREDDIRS korrigiert +Ornis: Entscheidung ber das Packen vom Paket wurde Case sensitive von der Dateierweiterung gefllt - korrigiert +Ornis: Download-Tooltip korrigiert (eine Info war verloren) +Ornis: Kommandos an Kategorie "alle unkatalogisierten" werden nun auch entsprechend behandelt + + +v0.27a +---------------------- +- 13. Mrz 2003 - +---------------------- +Ornis:Neue Optionen um die Logs mitzuspeichern +Unk: Kredit-System optional +Unk: Einfacher Erst-Start-Assistent +Unk: Weitere Protokollnderung fr bessere Kompatibilitt mit dem Hybriden +Team:viele kleine Fixes, Anpassungen & kleine grafische Aktualisierungen + +---------------------- +- 11. Mrz 2003 - +---------------------- +Ornis:Liste freigegebener Dateien: Linkkopieren nun auch bei Mehrfachauswahl +Ornis:Suchfenster: Eingabe von mehreren ED2k-Dateilinks zum Download mglich +Ornis:Option zum berwachen der Zwischenablage auf ED2k-Dateilinks -> Abfrage ob diese zum Download hinzugefgt werden sollen +Ornis:Einstellungen: neue Sektion: Sicherheit (Filter,...) - neuer Filter fr Kommentare +Ornis:neue Spalte "Verzeichnis" in Liste freigegebener Dateien +Unk: lMule wird nun erkannt +Unk: eMule v0.19 und frher bekommen eine geringere Warteschlangenbewertung. Dies soll deren Nutzer zu einem Upgrade bewegen, da diese alten Clients u.U. an falsche Ports senden. +Ornis:"Hotmenu" hinzugefgt, fr schnellere Kontrolle via Tastatur. Drcke Alt+x ! + +---------------------- +- 10. Mrz 2003 - +---------------------- +Ornis: Fertiggestellter Download in der Downloadliste wird bei Aktivierung geffnet +Unk: Neue Liste "bekannte Clients" im Transferfenster +Unk: Uploadclients mit unbekanntem Dateinamen werden nicht entfernt- fr bessere Kompatibilitt mit dem Hybriden. +Unk: Liste der freigegebenen Dateien nutzt Warteschlange und Uploadliste, um einen Balken darzustellen, der anzeigt, wie verbreitet die Datei im Netzwerk ist. +Unk: Fehlerkorrektur im Assistenten +Ornis:Kommentaricon sollte nun mehr Uptodate sein [Moosetea] +Unk: Korrektur eines Bugs, der bei Internet-Verbindungsunterbrechung zum Crash fhren konnte + +---------------------- +- 2. Mrz 2003 - +---------------------- +Ornis:Fix: Speichern der gesamten gesendeten Datenmenge einzelner Dateien nicht mehr auf 4GB limitiert +Ornis:Korrektur eines Fehlers, der die Vorschau von Videodateien mir grogeschriebener Erweiterung verhinderte +Ornis:Einstellungendialog etwas umorganisiert +Ornis:Neue Option, um das Bewertungs-/Kommentar-Icon in der Downloadliste ein-/auszuschalten + +---------------------- +- 1. Mrz 2003 - +---------------------- +Unk: Quellen die gerade nicht downloaden, werden nun seltener (1/10 der Zeit) aktualisiert [basierend auf Maella] +Unk: Name und Beschreibung von Servern werden nun aktualisiert. Maximale Nutzeranzahl ist nun in separater Spalte +Unk: Auswahlknopf-Fehler im Assisten korrigiert +Unk: wie eMule den Versionstyp austauscht wurde verndert +Ornis:Downloadliste kann nun in Kategorien organisiert werden (Downloadliste einteilen, unterschiedliche Eingangsverzeichnisse setzen, farbliche Markierung konfigurieren, Befehle auf alle Downloads in der Gruppe absetzen,...) +Ornis:Datums/Zeitformat kann in der preferences.ini gendert werden - strftime()-kompatible Formatierung!!! + +---------------------- +- 26. Februar 2003 - +---------------------- +Ornis: Korrektur: Quellenaustausch war u.U. seltener +Ornis: gestoppte Downloads erhalten keine Quellen mehr +Unk: Korrektur eines Fehlers, der einen Upload lnger als einen Chunk erlaubte (im kompletten Chunk-Modus) + +---------------------- +- 25. Februar 2003 - +---------------------- +Unk: View transfering parts in uploadlist. (Lonestar) + +---------------------- +- 24. Februar 2003 - +---------------------- +Ornis: mittlerer Mausklick auf ein Kommentar-Symbol ffnet die Kommentarliste +Unk: Uploadbalken sind nun im 3D-Stil +Ornis: Korrektur in automatischer Versionsberprfung [thx bluecow] +Ornis: Anzeige des letzten Zeitpunktes wann fr die Downloads jeweils der letzte Empfang einging (Tooltip, Downloadlisten-Spalte, Dateidetaildialog) + +---------------------- +- 21. Februar 2003 - +---------------------- +Unk: Auto-Priorisierungs komplett erneuert. Download und Freigegebene Dateien sind nun komplett separat. Auto Prioritt ist nun standardmig aktiv + +---------------------- +- 19. Februar 2003 - +---------------------- +Unk: DownloadListCtrl. verbessert+Korrekturen (Maella) +Unk: Eingearbeitet: Abfrage der freigegebenen Datein von Hybrid-Clients. (Bluecow) +Unk: Aktualisiert die Warteschlange nicht dort, wo sie eh nicht sichtbar ist (zz) +Unk: Another Update on the Min to Tray Button. (Zegzav) +Ornis:Nachrichten-Benachrichtiger wurde erweitert, untersttzt nun frei definierbaren Skin, Schlie- & History-Funktion [enkeydev] +Ornis:Doppelklick auf eine Quelle in der Kommentarliste ffnen einen Nachrichten-Chat mit diesem Benutzer +Ornis:Fehlerkorrektur beim Limitieren der Downloadgeschwindigkeit whrend der Laufzeit und via Kommandozeile + + +v0.26d +---------------------- +- 15. Februar 2003 - +---------------------- +Unk: Fix: Warteschlangen-Rotation wurde korrgiert - einige Clients wurde sofort wieder aus der Uploadschlange gekickt +Unk: mehrer Optimierungen von BadWolf63,ichi +Unk: Darstellungsfehler des Knopfes fr Minimieren zum Tray korrigiert (zegzav) +Unk: cDonkey ist nun auch in den Statistiken +Unk: Splitter-bar Position wird nun prziser gespeichert + + +v0.26c +---------------------- +- 13. Februar 2003 - +---------------------- +Unk: Hybriden-Erkennung gendert +Unk: Uploadslot Management etwas verndert - es sind davon sehr langsame und sehr schneller Verbindungen betroffen (Koop. mit VQB) +Unk: Einige Uploads waren viel zu lange im Chunk-Modus. Dies wird nun geprft und vermieden. +Unk: Dateien im Auto-Modus bleiben nun nicht mehr beim Neustart hngen (jicxicmic) +Unk: Rundungsfehler korrigiert fr Datenraten (Maella) +Unk: Verbindungsvorgang etwas verndert. eMule verbindet nun klger bei "sicheres Verbinden" deaktiviert - um LowID zu vermeiden +Unk: Serverinformationen gehen nun nicht mehr beim Serverlistenupdate verloren +Ornis:Neuer Kommandozeilen-Befehl: "limits=up,down" (z.B.: "emule.exe limits=50,12") um die Limits fr den Up- & Download zu setzen +Ornis:neue Option um die Transferraten in der Titelleiste von eMule anzeigen zu lassen +Ornis:mittlerer Mausknopf ruft die Detailanzeige des aktivierten Eintrags auf in Download-, Upload- & Queueliste +Ornis:Fix: Webservices in der Liste freigegebener Dateien funktioniert wieder + +---------------------- +- 11. Februar 2003 - +---------------------- +Ornis:Fix: Statusbar-Icon erscheint wieder bei neuen Nachrichten +Ornis:eine Reihe kleiner Korrekturen, sowohl GUI als auch funktionale [Teils von JonnyB] +Unk: automatisches Speichern der Serverliste und Freundesliste nun im akzeptablen Abstand +Unk: Quellenaustausch sendet nun nur bettigte Quellen zu einem Client! +Unk: weitere kleine GUI-Fixes +Unk: Korrektur ein paar weiterer Sicherheitslcken (teils von beef2k & bluecow & juanjo) +Unk: kleiner Fix bzgl. der Max.Verbindungen in den Einstellungen +Unk: Pause und Prioritt werden nun wieder bei Programmende gesichert + +---------------------- +- 10. Februar 2003 - +---------------------- +Ozon: Bugfix: ED2k Links werden nun auch fr Dateien >2GB korrekt erstellt +Ornis:Darstellungsfehler im Kommentaranzeige-Fenster korrigiert +Ornis:Anzeige der Anzahl von Downloads ber der Downloadliste +Ornis:Korrigiert: Speichern&Wiederherstellen der Spaltenreihenfolge der Downloadliste +Ornis:Filter fr eingehende Nachrichten (Konfig. in Einstellungen/Benachrichtigung, Standard Filterbeispiel: "Your client has an infinite queue") + + +v0.26b +---------------------- +- 8. Februar 2003 - +---------------------- +Unk: Konvertierung vieler char[] in CStrings, um Pufferberlufe zu vermeiden +Unk: Wenn ein Hashset Probleme bereitet, wird er neu angefragt +Ornis:Fix: Webservices im Suchfenster aufrufen +Ornis:Fix: Vorschau starten [jicxicmic] +Ozon: neu: kontinuierliches Backup fr .part.met Dateien +Ornis:mehrere kleine GUI & andere Fixes +Ornis:IP-range Filter (fr Blacklists) - cDonkey's filter-file-Format wird benutzt (Grundfiltering-mehr wird kommen) (mehr siehe FAQ!) +Ornis:MeineInfo zeigt nun auch IP & Port an + +---------------------- +- 7. Februar 2003 - +---------------------- +Ozon: Netzung des macro THIS_FILE in allen Quellcodes, um Leaks im VS besser aufzuspren (nicht entfernen!) +Unk: Sicherheitslcke gestopft (bluecow/zegzav) +Unk: Serverliste und Freundeslist werden nun auch zwischendurch gesichert +Ornis:Kommentardialog (Ansicht) umgestaltet (Listenansicht) + +---------------------- +- 6. Februar 2003 - +---------------------- +Ozon: EMSOCKET_DEBUG definiert fr EMSocket-logfile +Ozon: Vernderter Packalgorithmus fr die meisten structs/classes (nicht die Kritischen, weiterhin 1 byte) zu 8 bytes. +(kann Performance verbessern...) +Ozon: Clients.met wird bei jedem Start von eMule gesichert +Ozon: Variablenumbenennung begonnen... (CAbstractFile, CClientCredits for now...) +Unk: Statistiken haben nun einen Paketzhler, und einige kleine Fehlerkorrekturen + +Fehlerkorrekturen, mit Hilfe von ZegZav, Bluecow, Ese Juani, jicxicmic +Optimierungen, mit Hilfe von ichi, Maella, zz + + +v0.26a +--------------- +2. Februar 2003 +--------------- +Ornis: Crash behoben (Absturz nach Lschen des Serverlogs) +Unk: Sicherheitslcke gestopft (Danke beef2k) + +--------------- +1. Februar 2003 +--------------- +Unk: Neuer Algorithmus zur gleichmssigeren Verteilung der TCP Connections. Ntzlich fr verschiedene Dinge.. + -weniger Spitzenbelastung der CPU und der Bandbreite, wenn viele Quellen auf einmal angefragt werden mssen + -Wenier Konflikte zwischen Source Exchange und UDP file reasks, daraus folgend weniger TCP Verbindungen sind ntig und damit weniger Overhead +Unk: IRC: Bug behoben "mgl. Absturz beim Verlassen eines Channels" +Unk: Die Lnge der Queue ist nun einstellbar (min. 2000) + Entgegen der blichen Meinung hat die Grsse der Queue NICHTS mit dem Verbrauch an Bandbreite zu tun. Der Standardwert ist nun 5000) +Unk: Die Grsse der Download Buffer pro Datei sind nun einstellbar. Wenn Du einer der wenigen bist, die meinen ein Problem zu haben mit zu viel Festplattenzugriffen, setze den Wert niedriger. +Unk: Die Downloadprioritten werden nun benutzt bei der Reihenfolge des Nachfragens bei Quellen. + +--------------- +31. Januar 2003 +--------------- +Unk: Einige Clients melden flschlicherweise sie hatten eine Datei komplett. Einige nderungen sollten dem entgegenwirken. +Unk: Der Queue Rank (QR) bei den neuen eDonkey/Overnet Hybriden wird nun erkannt und angezeigt +Unk: Protokoll-Fix: eMule rutscht nun nicht mehr stndig aus der Queue beim eDonkey/Obernet Hybriden (Anm. eDonkey hat das nicht absichtlich gemacht) +Unk: Beim Wechsel der IP muss man sich nun nicht mehr wieder hinten in der Queue anstellen :) +Unk: Nochmal am Sortieren der Downloadliste gearbeitet... +Unk: Quellen mit voller Queue werden nun behandelt wie "Keine bentigten Teile" (d.h. sie werden langsam durch andere ersetzt, sobald man die max. zulssige Anzahl der Quellen erreicht) + +--------------- +28. Januar 2003 +--------------- +Unk: Bugfix: eDonkey und eMule Versionen wurden manchmal falsch angezeigt +Unk: Die eDonkey/Overnet Hybriden werden nun erkannt, und auch in der Statistik aufgefhrt +Ornis: Fr das Fertigstellen eines Downloads wird nun ein eigener Thread benutzt (Danke Lord KiRon) +Ornis: Socket reading modifiziert (Danke Jordy) + +--------------- +24. Januar 2003 +--------------- +Ornis: Support fr Opcode 0x48 (OP_FILEREQANSNOFILE) des eDOnkey Protokolls [references: DoubleT,eMule+/Tarod] +Ornis: Der zu verwendende Videoplayer fr avi und mpg Dateien ist nun whlbar (bei VideoLAN kann das Backup der part Datei ausgeschaltet werden) +Unk: Komplettes Neuschreiben der Update Funktion der Queue und Uploadliste fr weniger CPU Verbrauch. +Unk: Die Overhead Anzeige wrde berarbeitet... Die Abschtzung der TCP/UDP Header ist entfallen, es werden nur noch die Nutzdaten angezeigt. Die Statistik wurde um einige Overhead Sachen erweitert. + +--------------- +21. Januar 2003 +--------------- +Ornis: Interne Handhabung der Quellen optimiert, weniger CPU Verbrauch +Ornis: diverse CPU Optimierungen (Stats, tray&maindlg, GUI) (Coop. mit Esejuani) +Ornis: Bei den shared files knnen nun mehrere Dateien fr Befehle ausgewhlt werden +Ornis: optionaler Update-Check (automatisch beim Start oder manuell) +Ornis: voll konfigurierbare Web-Services fr Downloads (z.B. Fakecheck oder hnliches) +Ozon: Crash behoben, wenn man den Statusbalken benutzen wollte befor er fertig erstellt war (AddLogLine) + +--------------- +20. Januar 2003 +--------------- +Unk: Protokoll-Erweiterung: Man kann nun sehen, welche Teile einer Datei der Downloader hat (wenn auch er eMule 0.26 oder hher benutzt) +Ornis: Dateien, fr die ein Kommentar oder Bewertung vorliegt, haben nun ein Symbol vor dem Dateinamen in der Downloadliste (Grn/rot) +Ornis: Downloadliste: die Quellen knnen nun speziell gefiltert werden.. bitte lest die FAQ wie es funktioniert! :) (Danke xrmb und Ese Juani) + +--------------- +19. Januar 2003 +--------------- +Unk: IRC: Crash beim Neuverbinden behoben +Unk: kleine nderung in der Downloadliste... +Unk: Der Server eines anderen Clients wird nun zur Serverliste hinzugefgt sobald man das erste Mal mit ihm Verbindung aufnimmt. + +--------------- +18. Januar 2003 +--------------- +Ornis: Die Sprachen in der Sprachauswahlbox werden nun in der eigenen Sprache angezeigt (pooz) +Ornis: Behoben: wenn man die Sprache mehrmals nderte, wurden die Toolbar Buttons immer grsser (pooz) + +. +. +. +ltere Eintrge sind im englischen Changelog verfgbar. diff --git a/license/changelog_full.txt b/license/changelog_full.txt new file mode 100644 index 0000000..2f6242d --- /dev/null +++ b/license/changelog_full.txt @@ -0,0 +1,6122 @@ + CHANGELOG FOR EMULE + http://emule-project.net + ======================== + +eMule 0.50a +----------------------- +- Apr, 5. 2010 - +----------------------- +.: Added preferences.ini-only option "ExtraPreviewWithMenu" (eMule section) which makes eMule put the "Preview with" command into the root context menu rather than into the preview menu (only applies to extended controls with multiple preview programs set) +.: Added "Open preferences.ini" button to the extended options. Remember that you have to close eMule _before_ saving any changes if you want to edit any not preferences.ini-only settings +.: AICH hashs work properly in all collection types now + +----------------------- +- Apr, 2. 2010 - +----------------------- +.: Added new ed2k link type: "ed2k://|search|[searchterm]|/" makes eMule start a search for the specified searchterm. Plugin for webbrowsers which make use of this will follow later +.: Fixed some minor bugs in the Kad graph +.: Fixed a possible bug with AICH recovery when downloading a searchresult which includes the AICH hash + +eMule 0.50a BETA3 +----------------------- +- Mar, 28. 2010 - +----------------------- +.: Keyboard shortcuts to switch the dialog work again in the transfer dialog +.: Fixed a small visual glitch in the tooltips of the webinterface +.: Fixed a issue regarding eMule deceiding if to trust an AICH hash on files which have no verified AICH has [tHeWiZaRdOfDoS] +.: Fixed minor issues with the exit commandline command and the multiple instances option [tHeWiZaRdOfDoS, leuk_he] + +----------------------- +- Mar, 23. 2010 - +----------------------- +.: Fixed ed2k links not containing the AICH hash on several locations (ctrl+c, webserver, etc) +.: Fixed further bugs leading to crashes or glitches in the new toolbar +.: Fixed a possible crash problem with the new Win7 features +.: The Beta versioncheck will now point to a seperate website instead the standard versioncheck (which doesn't works for betas) + +eMule 0.50a BETA2 +----------------------- +- Mar, 19. 2010 - +----------------------- +.: Update MiniUPnPlib to the latest version +.: The download commands toolbar now handles closing by pressing the X while in floating mode properly +.: The icons of the download commands toolbar are now properly drawn gray if disabled on WinXP and older Windows versions + +----------------------- +- Mar, 17. 2010 - +----------------------- +.: The new Windows7 taskbar features will no longer vanish when minimizing eMule to the system tray +.: Updated libpng to the latest version +.: The lables of the download commands toolbar are now properly adjusted immediately when switching to another language +.: The archive preview tab has now a context menu to update the contents as replacement for the "Update" button +.: Fixed a bug in handling part.met files which could cause corrupted parts if eMule paused the file due to insufficient diskspace +.: Fixed a small visual glitch when resizing the shared files list while the new tabs were hidden +.: fixed minor memleak in kad keyword storing [tHeWiZaRdOfDoS] + +----------------------- +- Mar, 14. 2010 - +----------------------- +.: Fixed the background color of the new Kad graph if custom themes/colors are enabled +.: eMule now selects the default color of the system icon tray speedbar depending on the color of your taskbar icon area, to avoid show a dark/bright bar on a dark/bright background +.: Fixed a crashbug in the new download commands toolbar (this bug was responsible for nearly all crashes you might have seen in Beta1). +.: Active searches are now automatically shown in the new Kad graph by default and eMule remembers the setting (can be siwtched in the contextmenu of the graph) +.: Fixed a small bug with itemdeletion when closing eMule [JvA] +.: Fixed a small bug regarding Kad search tolerance [Famerlor] + +eMule 0.50a BETA1 +----------------------- +- Mar, 8. 2010 - +----------------------- +.: Fixed a bug which caused the "Add files to download in paused mode" otpion to not work properly in all cases +.: Fixed a visual glitch on taksbar notifiers when using the Aero theme [gureedo] + +----------------------- +- Mar, 3. 2010 - +----------------------- +.: Added Windows 7 taskbar goodies: + - global progress bar in the eMule taskbar button, progress colors: green when downloading, red when a download is errorous, yellow otherwise + - Taskbar Buttons: when hovering over the eMule taskbar button (connect/disconnect/throttle/unthrottle/open preferences) + - Overlay icon: Overlay icon on the eMule taskbar button indicating active up- and downloads (disabled by default, enable by ini entry "ShowUpDownIconInTaskbar=1"). + +----------------------- +- Mar, 1. 2010 - +----------------------- +.: Tweaked uploadcode to significantly increase the possible uploadspeed per slot especially on LANs, making eMule more suitable for those +.: The number of maximal open upload slots has been decreased to 100 +.: Fixed a bug which caused the "Add files to download in paused mode" otpion to not work properly in all cases + +----------------------- +- Feb, 28. 2010 - +----------------------- +.: Fixed a problem with the sharedfiles list when deleting a shared files [dolphinX] +.: Fixed minor possible memory/ressource leak in the archive recovery and ipfilter [dolphinX] +.: Fixed possible problem when wrong incoming directory due to categories in certain cases [dolphinX] + +----------------------- +- Feb, 19. 2010 - +----------------------- +.: Fixed a bug in Kad which would not enforce the search tolerance in certain cases +.: Changed Kad to work better in small LANs. If Kad detects it is running on a LAN (only LAN IPs in the routing table), it will assume beeing open and not behind a NAT/Router without trying to verfiy (which would fail in a small LAN), + and also doesn't enforces several security features like flood detection for LAN IPs. Now even a small Kad LAN of 2 nodes works well without any setup issues +(To create such a Kad LAN, make sure all clients have Options->Extended->"Filter server and client LAN IPS" disabled, delete the existing nodes.dat if necessary, go to the Kad dialog and enter the IP+Port of one other client (which is either connected or in connecting mode for Kad) to the bootstrap box - done) + +----------------------- +- Jan, 25. 2010 - +----------------------- +.: The connection wizzard is no longer shown after finishing the first start wizzard (it's deprecated) +.: The first start wizzard is only shown on first starts and no longer after updates + +----------------------- +- Jan, 21. 2010 - +----------------------- +.: Added a new graph to the Kad window, which lets you watch each Kad lookup in detail. For non-Devs this is just for fun, you don't need to worry about anything shown there. A detailed explanation of the graph can be found in the onlinehelp. +.: Added "Automatically show active searches" option to the context menu of the new graph which lets it switch to active lookups automatically (instead having to select it in the list). Now you can watch Kad working for hours without a click! :) + +----------------------- +- Jan, 12. 2010 - +----------------------- +.: Added a new dockable toolbar to the transfer dialog. The buttons resemble the context menu options, but making them accessible easier and faster. The toolbar can be removed by right clicking on it and shown again by selecting context menue option of the downloadlist + +----------------------- +- Jan, 10. 2010 - +----------------------- +.: The context menu in of the downloadlist allows now directly assign a file to a new category (instead of having to create it separately first) +.: The "Unassign" category context menu entry is now only available if a file actually has a category + +----------------------- +- Dec, 7. 2009 - +----------------------- +.: Fixed missing setting saving after automatic adapting incoming folders of categories due to changed main incoming folder +.: Fixed a bug with overwriting the nodes.dat on times we actually don't want to write it [Nissenice] +.: Added a quick intermediate fix to make certain Kad lookups more reliable, improving the (search/source-) results in some cases [based on research from http://www-users.cs.umn.edu/~hopper/kad.pdf] + +----------------------- +- Nov, 28. 2009 - +----------------------- +.: Switched the eMule fileidentifiers from ED2k-Hash + Size to ED2k-Hash + AICH-Hash + Size. This means eMule is now using two hashing algorithms combined (based on MD4 and SHA1) to verify if a received part (and eventually the comlete files) is not corrupt + This change is necessary due to weaknesses in the MD4 algorithm and enables eMule to make sure to never complete a corrupt files for the next decade + All changes are backwards compatible, so no clients or files will be exluded from the network +.: AICH part hashsets are build out of existing AICH recovery hashsets, no rehashing is done +.: AICH verification is enabled when using an ed2k link with included AICH hash, or when searching and downloading a file from Kad when certain requirements are met (this will only start to work once the majority of nodes update) +.: The AICH hash can be seen in the search results list for kad searches if available +.: ed2k links can no longer be created without the AICH Hash, except if it is not available. ed2k links without AICH hash are considered deprecated, but are still accepted by eMule for now + +----------------------- +- Nov, 15. 2009 - +----------------------- +.: The shared files list now shows files in root directories properly [dolphinX] +.: Fixed a bug with determining if the filesystem can handle large files when using categories [dolphinX] +.: Added preferences.ini-only option "KeepUnavailableFixedSharedDirs" ("eMule"-Section) which lets eMule keep shared directories on fixed drives even if they are not found anymore +.: Fixed minor memleak on kad searches [tHeWiZaRdOfDoS] +----------------------- +- Oct, 13. 2009 - +----------------------- +.: Added preferences.ini-only option "ForceSpeedsToKB" ("eMule"-Section), which will make eMule display all speed values in KB/s (instead of B/s to TB/s depending on the speed) + +----------------------- +- Aug, 7. 2009 - +----------------------- +.: The shared files dialog has now a tab selector, letting you choose to view the statistics,(reduced versions of) the content, ed2k-link or metadata info for the selected file(s) +.: The statistics page on in the shared files dialog also has the following new entries: Popularity rank (ranking all your shared files based on Requests), On Queue (clients on queue for the selected file) and Uploading (current bandwidth used to upload the selected file) +.: The new tabs in the shared files dialog can be closed or restored by an arrow button on the right side + +----------------------- +- Aug, 3. 2009 - +----------------------- +.: Fixed possible resource leaks in ZIP file decompression [tHeWiZaRdOfDoS] +.: Fixed sorting bug in Shared Files window [moloko+] + +----------------------- +- Aug, 2. 2009 - +----------------------- +.: Fixed bug with downloading files via the built-in webserver [Stulle] +.: Fixed double/single click behaviour in search results window [tHeWiZaRdOfDoS] +.: Fixed bug in user hash validation [ilmira] +.: Fixed bug with space characters in ED2K URLs [moloko+] + +----------------------- +- Jul, 25. 2009 - +----------------------- +.: Fixed a bug which made search tabs in certain cases invisible after you closed one + +----------------------- +- Jul, 20. 2009 - +----------------------- +.: Cleand up options dialog a bit: + The following settings have been removed and are now preferences.ini-only: "BeepOnError", "DontRecreateStatGraphsOnResize", "UpdateQueueListPref", "MessageFromValidSourcesOnly" (Section "eMule") and "EnabledDeprecated" (section "PeerCache") +.: The exit conformation messagebox has now a "Don't ask me again" option +.: Added "Pause on when preview possible" option to the downloadlist context menu. Only visible when "advanced mode controls" is enabled + +----------------------- +- Jul, 09. 2009 - +----------------------- +.: Improved storing AICH hashsets after a download has finished - should be much faster now if you share many files +.: Sparse files are available on Windows7 again, Vista stays the only version were they are disabled + +----------------------- +- Jun, 12. 2009 - +----------------------- +.: Added basic checks and user warnings for wrong operator usage (like using OR on the first keyword) in Kad. Earlier version just delivered wrong/incomplete results in such cases. + +----------------------- +- Jun, 10. 2009 - +----------------------- +.: Fixed a bug in Kad with setting the proper searchkeywords when searching for exact phrases with quotes +.: Fixed a bug with rearranging quoted keywords on kad searches + +----------------------- +- Jun, 2. 2009 - +----------------------- +.: Kad1 is no longer supported and we will no longer answer or request any packets from Kad1 nodes (the last eMule Kad1 version was release about 4 years ago) + +----------------------- +- Mar - May 2009 - +----------------------- +.: eMule Summer of Non-Code :) + +eMule 0.49c +----------------------- +- Feb, 18. 2009 - +----------------------- +.: Fixed a minor GUI drawing issue in the transfer window [dolphinX] +.: Added GUI name references to some more Kad queries [tHeWiZaRdOfDoS] +.: Added sanity check for rare issue seen in crashdumps concerning SourceExchange responses +.: Increased the UDP-Socket buffer to avoid packetloss + +----------------------- +- Feb, 15. 2009 - +----------------------- +.: Fixed the following BETA bugs: +- Popups on the shared files list were not working +- The shared files count in the GUI wasn't always accurate +- Resolved shell links had some issues, preventing them from getting shared +- The GUI wasn't always properly updated when deleting a file in the shared files window + +eMule 0.49c BETA2 +----------------------- +- Feb, 11. 2009 - +----------------------- +.: Fixed a BETA bug in the new part.met recovery function + +----------------------- +- Feb, 10. 2009 - +----------------------- +.: Resolve shared shell links has now its own option in the extend dialog instead beeing a preferences.ini only option +.: Added the preferences.ini only option "FileBufferTimeLimit" ("eMule" section) which lets you set the maximum seconds before flushing the buffer of downloading files (default 60) + +----------------------- +- Feb, 9. 2009 - +----------------------- +.: When another client requests to view your shared files and directories (and you allow it), eMule will now attach only the directory names (or relative paths if it is a shared subdir) instead the full path for privacy reasons +.: Fixed a BETA bug which caused eMule to not send single shared files when answering view shared files requests + +----------------------- +- Feb, 8. 2009 - +----------------------- +.: On a fresh eMule installation, several less important list columns are now hidden by default to avoid overloading the interface +.: Fixed some BETA bugs with creating collections +.: Slightly increased the max. button size of the maintoolbar +.: You can no longer share single files within unshareable directories (like your temp dir) + +----------------------- +- Feb, 7. 2009 - +----------------------- +.: Fixed a BETA bug which made eMule ignore the longest keyword on server searches +.: Added sanity checks for some problems seen in crashdumps when sending responses +.: Added sanity range check for preferences.ini only option: tcp obfuscation padding length + +eMule 0.49c BETA1 +----------------------- +- Feb, 4. 2009 - +----------------------- +.: Dates shown in the download list have their own time format setting ("DateTimeFormat4Lists" in preferences.ini) which is by default more compact than the old one +.: Added a column to the download list which shows the date when the download was started + +----------------------- +- Feb, 2. 2009 - +----------------------- +.: Kad routing query contacts are checked against the routing table +.: Kad no longer allows more than 2 IPs from the same subnet within one routing query reply (except on LANs) +.: Fixed small bug in the uploadthrottler [tHeWiZaRdOfDoS] + +----------------------- +- Jan, 27. 2009 - +----------------------- +.: The Kad UDP firewalltest now asks several clients for its external port, avoiding to get a wrong "Open" state on NATs which change the source port on each request but behave like a Full-Cone otherwise +.: Kad now rechecks incoming search results against the filters used for a search and drops all results which fail (which should only happen for buggy clients and spam results) + +----------------------- +- Jan, 25. 2009 - +----------------------- +.: When corrupted part.met files are detected, eMule now automatically tries to use the part.met.bak files instead +.: Some data (like the AICH hashset, statistics, metadata etc) from known/downloaded files which were not shared within the last month now gets purged to save ressources and avoid an unlimited growth of the known.met files + (the first purge will be done one month after upgrading, if you have "Remember downloaded files" disabled all unshared files are completely deleted right away so this change would have no further effect) +.: If you want to avoid this purging for some reason you can put "PartiallyPurgeOldKnownFiles=0" in the "eMule" section of your preferences.ini + +----------------------- +- Jan, 20. 2009 - +----------------------- +.: When sorting lists for file types, eMule now further sorts by extension when the filetype is the equal + +----------------------- +- Jan, 11. 2009 - +----------------------- +: On simple search queries Kad now rearrenges the used keywords itself and uses the longest keyword to determine which node to ask. This reduces the search load on common used keyword nodes like "and", makes such keyword a less viable target to attackers and allows users to do a search which begina with a short keyword like "An eMule" +.: You can deactivate this by putting "RearrangeKadSearchKeywords=0" into the "eMule" section of the preferences.in (there isn't much reason to do so for normal users however) + +----------------------- +- Jan, 10. 2009 - +----------------------- +.: You can now also share single file and directories by Drag&Drop - simply drag them from (for example) the Windows Explorer into your Shared Files list +.: You can now share and unshare single files in the shared files window by chking/unchecking the files in the "All directories" tree. Downloading files and files in the incoming directory cannot be unshared + (first one is required for the network the second one is for consistency as the incoming dir is not handled as optional shared dir, therefore not marked in the tree as shared which again would make it pretty hard to find it to reshare any excluded files) +.: Kad file/source search answers now try to avoid using fragmented packets, making it more compatible to zealous firewalls routers which block those (effect increases as more nodes update to this version) + +----------------------- +- Jan, 5. 2009 - +----------------------- +.: Fixed a possible crash in the (minilib) UPnP implementation +.: The Webinterface port can now also be forwarded by UPnP (Options->Webinterface) +.: The UPnP mappings are checked and refreshed if needed before Kad firewallchecks, after waking up from suspend and on smart lowid detection when connecting to servers + +----------------------- +- Jan, 3. 2009 - +----------------------- +.: The allowed comment size has been increased to 128 characters +.: Fixed a bug which made the download list use the wrong text color in some cases, mostly noticed on special windows themes + +----------------------- +- Dec, 22. 2008 - +----------------------- +.: Added support for Windows 'Heap Corruption Detection' security feature (Windows Vista) +.: Added support for Windows 'Address Space Layout Randomization' security feature (Windows Vista) + +----------------------- +- Dec, 21. 2008 - +----------------------- +.: Added support for preview the content of ISO files. (file details->content) + Reads the content of ISO9660 and Joliet images. (no UDF support) +.: Made sure a received Kad routing answer doesn't contain more contacts than requested [Xin Sun] + +----------------------- +- Dec, 19. 2008 - +----------------------- +.: Added support for Windows 'Data Execution Prevention' security feature (Windows XP SP2 / Windows Vista) +.: Added support for Windows 'Exception Handling Protection' security feature (Windows XP SP2 / Windows Vista) + +----------------------- +- Oct, 22. 2008 - +----------------------- +.: Added: Crash dump files are created in the 'config' directory. [thx tHeWiZaRdOfDoS] +.: Fixed a flaw which caused too few randomness when generating a new ed2k userhash [godlaugh2007] + +----------------------- +- Oct, 21. 2008 - +----------------------- +.: Added showing of watermark images to listviews (see "LvBkImg" entries in "Template.eMuleSkin.ini") + +----------------------- +- Oct, 18. 2008 - +----------------------- +.: Unified drawing of multiple selected items in all listviews. +.: Several optimizations in listview drawing. +.: Added drag image for files in Transfers window (used when dragging selected items onto a category tab). +.: Fixed showing of tooltips for multiple selected items in Server and Search window. + +----------------------- +- Oct, 11. 2008 - +----------------------- +.: Added auto-sizezing of column widths to all list views (double clicking on column divider will size the column width appropriatly) +.: Added label tips for partially visible sub items in all list views. +.: Added default sort orders to list views in Transfers window. +.: Added list view search functions for sub items. +.: Fixed sorting bug in File Name dialog. + +----------------------- +- Sep, 27. 2008 - +----------------------- +.: Added support for DVR-MS files to "Content" page of File Details dialog and published meta data. +.: Minor change in auto-sizing controls of Search Parameters pane. +.: Added reading of meta data for WAV files to "Content" page of File Details dialog. +.: Added publishing of ED2K specific meta data for WAV and WMA files. +.: Added columns for ED2K meta data to Shared Files window. + +----------------------- +- Sep, 23. 2008 - +----------------------- +.: Added Options->Extended->Resolve shell links which lets eMule share 'linked' files (Windows Explorer shortcuts). This way one can also share single files within unshared directories. +.: Added reading of meta data for Windows Media files to "Content" page of File Details dialog. + +----------------------- +- Sep, 14. 2008 - +----------------------- +.: Added yet another method to determine whether the MediaInfo library is installed. +.: Added support for multi-user configurations for Win9X/WinME/WinNT (requires at least IE5). +.: Added support for previewing self extracting RAR archives. +.: Fixed broken ED2K link and eMule Collection file registry functions for Win98/WinME/WinNT. + +----------------------- +- Sep, 13. 2008 - +----------------------- +.: Fixed a resizing bug with the main toolbar under Win98. +.: Fixed message box contents for downloading a proper version of DBGHELP.DLL for Win9x/WinME/Win2000. +.: Fixed a crash with deleting completed or shared files under Win98. +.: Added: Downloaded files are marked in the same way as by 'Internet Explorer' which leads to showing a warning message from 'Windows' when opening potential malicious files (for Windows XP SP2 or later). +.: Added: Opening DRM protected files shows a warning message to prevent accidental opening of a web browser and navigating to malicious sites. + +----------------------- +- Sep, 11. 2008 - +----------------------- +.: Fixed bug with missing update for filter text on changing the language [JvA] +.: (Win98) Fixed bug with default search file type setting + +----------------------- +- Sep, 4. 2008 - +----------------------- +.: Added new browse file/directory buttons to property pages in Options dialog. + +----------------------- +- Sep, 2. 2008 - +----------------------- +.: Fixed some redrawing/resizing problems and reduced flickering in several main eMule windows. + +----------------------- +- Sep, 1. 2008 - +----------------------- +.: Fixed bugs with file tooltips for Win98/Win2000. +.: Fixed a problem with corrupt stored search results [George1] + +----------------------- +- Aug, 30. 2008 - +----------------------- +.: Fixed: It was possible to add eMule installation folder(s) to the shared files list when using the directory tree control in the Shared Files window. +.: Fixed a bug with disk space statistics for newly added downloads [fox88] +.: Fixed some potential compatibility problems with Windows NT 4.0. +.: Fixed problem with some missing icons under Win98. + +----------------------- +- Aug, 24. 2008 - +----------------------- +.: Fixed: Some Unicode strings where not stored correctly in meta data for part files. +.: Fixed some possible Unicode issues in Kad search expressions. +.: Removed the "Search with Unicode" search option - searches are always with Unicode. +.: Removed support for *.met file backward compatibility with non-Unicode eMule versions. +.: Removed support for the "SetSystemACP" setting in preferences.ini. +.: Added support for detecting if the MediaInfo library (http://mediainfo.sourceforge.net/) is installed on the system and automatically using it within the "Content" page for part/shared files. +.: Updated Kad Unicode mapping table for supporting current Unicode standard used by Vista. + +----------------------- +- Aug, 16. 2008 - +----------------------- +.: Fixed: Some Unicode strings where not stored correctly in search spam filter. + +----------------------- +- Aug, 15. 2008 - +----------------------- +.: Added a NT-volume info cache to speed up handling of shared directories on non-fixed drives. +.: Fixed: With certain code pages some Unicode characters where not stored correctly in *.met files [Borschtsch] +.: Fixed: Some Unicode strings where not stored correctly in meta data for shared files. + +----------------------- +- Aug, 11. 2008 - +----------------------- +.: Changed location for "downloads.txt" to eMule-config folder. + +----------------------- +- Aug, 10. 2008 - +----------------------- +.: Added sorting of entries in "Shared Directories" and "Incoming Files" section of "Shared Files" tree view. +.: Added showing of the parent folder for entries in "Shared Directories" and "Incoming Files" section of "Shared Files" tree view. +.: Added showing of 'not connected' shared directories to "Shared Directories" and "Incoming Files" section of "Shared Files" tree view. +.: Added keeping of shared directories which are 'not connected' when starting eMule. +.: Added populating of a warning icon overlay to "Shared Directories" and "Incoming Files" section of "Shared Files" tree view to indicate that there is at least one directory in that folder which is 'not connected'. +.: Added verifying of the 'connected' state for all shared directories when updating the "Shared Files" tree view by using the 'Reload' button. + +----------------------- +- Aug, 9. 2008 - +----------------------- +.: Fixed enablement of Start/Cancel button in Search Window for closed Kad searches. +.: Fixed invisible gripper control in Transfer Window. +.: Fixed standard Windows Property Sheet shortcuts in Options dialog. +.: Fixed several unlikely to happen but theoretically though possibles crashes. +.: Removed restrictions for sharing drives 'A:' and 'B:'. + +eMule 0.49b +----------------------- +- Jul, 31. 2008 - +----------------------- +.: Fixed some rare possible crashes + +eMule 0.49b BETA2 +----------------------- +- Jul, 28. 2008 - +----------------------- +.: Added deleting of single entries from AutoComplete drop down lists by pressing the DEL key. +.: Added a new search method option "Automatic" which lets eMule choose which search method to use. eMule will select either Servers (Local) or Kad, based on which network we are connected to and some other indicators if connected to both networks. +.: Removed a general exception handler for the Beta version. This means eMule crashes instead of ignoring unexpected errors, which however is needed so we actually can find such bugs (if any exist) in the crashdumps. + +----------------------- +- Jul, 26. 2008 - +----------------------- +.: Implemented a special nodes.dat version, which is more suited for mass distribution without causing significant additional traffic for the included nodes. This hopefully allows us to add a nodes.dat to the installer, so that new user can connect to Kad without having to connect to servers or downloading a nodes.dat themself + +----------------------- +- Jul, 19. 2008 - +----------------------- +.: Implemented an alternate method to estimate the total user count in the Kad network, which is not based on our local routing table. Its experimental and only shown in the network dialog (double click the world icon in the status bar) +.: Adjusted the displaying of the user count by not showing numbers for a network we are not connected to + +----------------------- +- Jul, 14. 2008 - +----------------------- +.: Fixed a minor bug with kad obfuscation when answering unbofuscated hello-requests +.: Made sure that only one challenge to verify a contact is sent at a time to the same IP + +eMule 0.49b BETA1 +----------------------- +- Jul, 11. 2008 - +----------------------- +.: Added MiniUPnPLib as additional UPnP implementation, the current Windows service based implementation is used as fallback. This will hopefully make eMule's UPnP compatible to most available routers. [miniupnplib by Thomas Bernard, Test & Suggestion: leuk_he] +.: A specific UPnP implementation can be disabled by adding "DisableMiniUPNPLibImpl=1" or "DisableWinServImpl=1" into the "UPnP" section of the preferences.ini + +----------------------- +- Jul, 5. 2008 - +----------------------- +.: When reading a nodes.dat without any verified contacts (possible an old file version), eMule will assume all contacts to be verified to avoid slowing down the connecting process +.: Project files for VS2005 and VS2008 have been added, however the official eMule is still developed and compiled on VS2003 + +----------------------- +- Jun, 27. 2008 - +----------------------- +.: Several changes were made to Kad in order to defy routing attacks researched by University of Minnesota guys [Peng Wang, James Tyra, Eric Chan-Tin, Tyson Malchow, Denis Foo Kune, Nicholas Hopper, Yongdae Kim], in particular: +.: Kad contacts will only be able to update themself in others routing tables if they provide the proper key (supported by 0.49a+ nodes) in order to make it impossible to hijack them +.: Kad uses now a three-way-handshake (or for older version a similar check) for new contacts, making sure they do not use a spoofed IP +.: Unverified contacts are not used for routing tasks and a marked with a special icon in the GUI + +----------------------- +- Jun, 22. 2008 - +----------------------- +.: Fixed: Shared Files window splitter did not properly save/restore position. +.: Did first small step in dropping Kad1 support by not probing unknown Kad contacts for Kad1 anymore to save overhead. Kad1 clients will nevertheless still be work for now. +.: Fixed a bug which let Kad sometimes assume a Kad2 contact to be Kad1 after probing for both versions + +----------------------- +- Jun, 18. 2008 - +----------------------- +.: Fixed: Memory leak in context menus. +.: Added: Vista styles for context menus. + +----------------------- +- Jun, 12. 2008 - +----------------------- +.: Fixed: Pressing ESC in Shared Files window filter destroyed the entire window. + +----------------------- +- Jun, 10. 2008 - +----------------------- +.: Added additional sanitize checks to make sure eMule never writes downloaded data into an already completed part +.: Optimized the Kad packettracking code to only tack packets which we check later, to save ressources + +----------------------- +- Jun, 9. 2008 - +----------------------- +.: Fixed 100% CPU usage bug with tooltips in Statistics Graphs. +.: Added: Tooltip in Statistics Graphs show the Y-value. +.: Kad no longer tries to add UDP firewalled (and therefore mostly unreachable) nodes into its routing table, reducing overhead and increasing reliability [Idea: Netfinity] +.: Kad tries to determine the overall ration of firewalled clients in the Kad network and shows them in the statistics tree. This will only work if you are not firewalled yourself and know enough 0.49b+ nodes +.: When calculating the total user count, Kad now uses (if available) the real number of firewalled clients for the calculation instead a fixed value. This will take more effect when 0.49+ nodes become common + +----------------------- +- Jun, 5. 2008 - +----------------------- +.: The "Handle eD2k-Links" button now also works properly with Vista's UAC enabled + +----------------------- +- May, 31. 2008 - +----------------------- +.: Added: Unshare context menu entries for directories within the virtual "Shared Directories" folder. + +----------------------- +- May, 28. 2008 - +----------------------- +.: Added: Vista themes for all owner drawn tab controls. +.: Added: Vista themes for category selector controls. + +----------------------- +- May, 25. 2008 - +----------------------- +.: Fixed main toolbar redrawing problems under Vista. +.: Reworked connecting code, fixing some minor and some major bugs, including a possible loop in unreachable DirectCallback sources + +----------------------- +- May, 19. 2008 - +----------------------- +.: Added new close icons for closeable tab controls. +.: Kad now ignores multiple IDs pointing to one IP in routing request answers + +----------------------- +- May, 18. 2008 - +----------------------- +.: Fixed: Tab controls were not sized correctly on certain text contents. + +----------------------- +- May, 17. 2008 - +----------------------- +.: Fixed: Category tabs in Transfers window did not show correct default text color. +.: Fixed: Category properties dialog did not always show the correct (default) category color. +.: Added: Hot tracking effects for Vista themes for all (owner drawn) tab controls. + +----------------------- +- May, 12. 2008 - +----------------------- +.: Fixed: Tooltips did not show correctly with Vista Aero theme. + + +0.49a +----------------------- +- May, 8. 2008 - +----------------------- +.: If extended controls are enabled (and if available) Kad search results show the amount of known unique publishers for a file in parentheses in the availability column (this isn't equal to sources, but it is a bit more trustworthy indicator how common a file is). +.: Updated CxImage lib to the latest version (6.0), fixes some image processing vulnability (low risk for eMule) [reported: Steve Manzuik/Juniper Networks] +.: Fixed Unicode issue in stored and loading searches +.: DirectCallback sources are now properly added to and checked against the deadsource list + +0.49a BETA3 +----------------------- +- May, 5. 2008 - +----------------------- +.: Made sure to always use the intern UDP port if both (intern and extern) ports succeed in the firewall test +.: Control chars are now filtered out of ed2k-links / received filenames [eklmn] +.: Fixed a small bug with handling removed category directories on startup [tHeWiZaRdOfDoS] +.: Changed installer to set the currently used shared usage setting as default if available + +----------------------- +- May, 3. 2008 - +----------------------- +.: Fixed another bug in the new UDP firewalltest, causing it to fail for results on the extern UDP port and for unreachable clients +.: Captchas can consist of numbers now too (except 0) +.: Fixed a smaller issue with finding and connecting to a buddy +.: Buddy search interval has been reduced, to increase the chance to find a buddy without waiting too long + +----------------------- +- May, 1. 2008 - +----------------------- +.: Changed the Crypt functions a bit for faster processing [netfinity] + +0.49a BETA2 +----------------------- +- Apr, 29. 2008 - +----------------------- +.: Fixed some rare bug which could cause rerequesting already transferred (buffered) data [tHeWiZaRdOfDoS] +.: Tweaked UPnP a bit to support some more routers [leuk_he] +.: Updated libpng to the most current version 1.2.27 + +----------------------- +- Apr, 27. 2008 - +----------------------- +.: Changed the kad tcp firewalltest protocol to make it possible to archive the tcp open state if the UDP port is firewalled +.: Each dialog (kad, server, etc) has now its own "doorway" helptopic which eMule shows when pressing F1 or the Helpbutton, instead of only calling the helpindex + +----------------------- +- Apr, 23. 2008 - +----------------------- +.: Fixed two bugs in the new kad firewalltesting which may lead to wrong results [tHeWiZaRdOfDoS] +.: eMule now supports ed2k-links for downloading the nodes.dat from an URL. A link to a nodes.dat should look this way: ed2k://|nodeslist|http://domain/nodes.dat|/ +.: Fixed two minor display bugs realted to the waiting queue and the requests statistics for files [tHeWiZaRdOfDoS] + +----------------------- +- Apr, 20. 2008 - +----------------------- +.: Loading stored kad keywords and sources has been moved into a seperate thread to avoid interface lockups, while the data is loading +.: Kad (tcp)firewalltest and buddy tcp connection now properly support protocol obfuscation too, on require obfuscation setting those connections (and therefore its functionality) didn't worked before + +----------------------- +- Apr, 15. 2008 - +----------------------- +.: Ctrl+W now closes the active searchtab in the search dialog + +0.49a BETA1 +----------------------- +- Apr, 12. 2008 - +----------------------- +.: Beta versions now create a small test text file which is shared by eMule to help us debugging protocol changes (esp Kad). On exit this file is deleted +.: Fixed a bug with the "Open Directory" menuitem in the shared files window [Stulle] + +----------------------- +- Apr, 11. 2008 - +----------------------- +.: Added the obfuscation setting to the First Time wizard and removed the full chunk upload setting instead +.: Disabled peercache downloads by default (deprecated) +.: Added a Beta nagging dialog + +----------------------- +- Apr, 6. 2008 - +----------------------- +.: Fixed several bugs in the new Kad firewall testing, obfuscation and direct callback functions + +----------------------- +- Mar, 30. 2008 - +----------------------- +.: eMule is now aware of windows standby modes and reconnects after waking up [MorphXt] + +----------------------- +- Mar, 18. 2008 - +----------------------- +.: Fixed: File tooltips used wrong font sizes when using customized Windows metrics. +.: Added: Support for using Windows default fonts for listview and treeview controls in eMule's main windows. This way one can specify larger fonts for almost all eMule lists via the Windows System Metrics. Specify "UseSystemFontForMainControls=1" in "preferences.ini" to enable. +.: Fixed: Shared directory treeview control lost icons after Windows System settings were changed. +.: Fixed: Wrong font mapping for some GUI elements in non-Western locales. + +----------------------- +- Mar, 17. 2008 - +----------------------- +.: Fixed: Shared Files list did not show focus rectangle for listview items. + +----------------------- +- Mar, 16. 2008 - +----------------------- +.: Fixed: "Search related Files" context menu entry in search results pane was not properly enabled/disabled [Tuxman] +.: Fixed: Memory corruption for column properties in WebServer [tHeWiZaRdOfDoS] +.: Fixed: Normalized search labels in WebServer [ducho] +.: Fixed: Some search results where still shown after invoking 'Close All Search Results' [bengarchy] +.: Fixed: Enabling/Disabling the "Queued Clients" and "Known Clients" lists did not always fill/clear the list views [Xman] +.: Fixed: Toolbars in Transfere window were not showing tooltips after enabling/disabling "Queued Clients" and/or "Known Clients". + +----------------------- +- Mar, 15. 2008 - +----------------------- +.: Fixed some GDI resouce leaks. [Rapid_Mule] +.: Fxied a minor possible bug in creating random numbers [leuk_he] +.: Fxied a bug in the new store searches function [netfinity] + +----------------------- +- Feb, 26. 2008 - +----------------------- +.: When deleting more than 50 files the first 50 names are shown in the confirmation dialog [tHeWiZaRdOfDoS] +.: Fixed a bug in finding the senders of corrupt data which may lead to false positives [DavidXanatos] + +----------------------- +- Feb, 10. 2008 - +----------------------- +.: Kad will now enforce certain limits when adding new contacts to the routing table: No more than 1 KadNode per IP, 2 similar KadNodes (same bin) from a /24 network and max 10 different KadNodes from a /24 network are allowed. This is supposed to make routing attacks against kad more difficult / resource-intensive +You can still run more than one kad client from a single IP without any problems, they just don't become part of the internal kad routing but still work without any limitations. + +----------------------- +- Feb, 3. 2008 - +----------------------- +.: The download comments dialog has now a direct possibility to edit the comment spam filter, changes are instantly applied to all existing comments +.: Clients which sent comments which get filtered by the comment spam filter are now treated like message spammers (banned) +.: The ed2k: in ed2k-links is no longer case sensitive +.: When connecting to Ed2K eMule starts with a random server instead using first on in the server.met. Any sorting, priority, etc. is not affected by this + +----------------------- +- Feb, 1. 2008 - +----------------------- +.: Several changes have been made to improve kads resistance against malicious keyword publishing: +.: Kad now keeps track which filenames were published by different sources for the same file and uses the most common name (instead the last published one) when responding search requests +.: Same hashs (files) which have different filesizes are now properly stored seperatly instead overwriting eachother +.: Kad calculates a rating based on how many different sources publish a file and how many files publishes a source. When responding to a search request, files with a rating below a set limit will be sent last in order to avoid that spammed files push out valid ones. +.: The Kad rating for published files is also sent in search results to be used in the future version as indicator + +----------------------- +- Jan, 16. 2008 - +----------------------- +.: Added a general anti-flood-protection to kad. If Kad receives more request of a specific type from one IP than it would expect, it starts ignoring those requests and envetually banning the source. This is supposed to avoid or slow down several attack scenarios. +.: Fixed a problem with injection of DNS servers into the routing tables which were able to stay because of a porotcol mixup between kad and dns. Old sources with port 53 as kad port are ignored, new clients (0.49a+) can use port 53 as kad port again but it is not recommended [found by netfinity] +.: Fixed a bug in kad2 with publishing >4GB files [netfinity] + +----------------------- +- Jan, 11. 2008 - +----------------------- +.: If you select a non-default incoming directory which already contains files, eMule notices you that those files are automatically shared by eMule + +----------------------- +- Jan, 8. 2008 - +----------------------- +.: Added a filter box (like in the search results) for on-the-fly filtering of shared files into the shared files tab. This filter is supposed to help finding specific shared files, it has no effect on which files are actually published +.: Rearranged the symbols in the shared files directory tree a bit + +----------------------- +- Dec, 15. 2007 - +----------------------- +.: The onlinehelp for the options dialog is now topic sensitive for all languages instead only for english (well actually it is not, but this is serverside work which will be done step by step till the release). More areas to get topic sensitive to come in the future +.: Open searches are now stored if you close eMule and restored on restart. This way you don't have to research your favourite words in case you didn't get to finish looking at the results. Can be disabled in Options->Display + +----------------------- +- Dec, 2. 2007 - +----------------------- +.: Reworked Kads Firewall handling and testing: +The kad firewall state is now split into TCP and UDP. The TCP state is basically the old state, which tests if your TCP port is reachable. The UDP state is new and checks if your UDP port is reachable. For example on Full Cone NAT Routers, without portforwarding you will get TCP firewalled (as before) but UDP open (new). If you have the UDP open state, eMule doesn't needs a buddy any longer and will fully participate in the KAD network and therefore take away the overhead they caused in earlier versions (you still cannot connect to other TCP firewalled clients if you are TCP firewalled yourself). +.: The new UDP state is shown in the MyInfo field in the Server Tab. As long as the UDP firewalltest is unfinished "(unverified)" is appended +.: Clients which have the Kad UDP open state, now support direct callbacks (invoked by an UDP packet) to connect to not firewalled clients. These callbacks are faster, more reliable and use less ressources than buddy or server callbacks. +.: The new firewall test also fixes a bug / design flaw which caused eMule to always use the use the clients source UDP port, instead testing if the internal set UDP port might be the propper choice instead. This was especially a problem on Restricted Cone Routers with PAT (Port Address Translation) + +----------------------- +- Nov, 29. 2007 - +----------------------- +.: Fixed bug with possible wrong local IP address in case the "BindAddr" option is used. +.: Fixed bug with missing update of details of a selected friend in friends list. + +----------------------- +- Nov, 24. 2007 - +----------------------- +.: Fixed bug in tooltips which were showing certain list items partially in bold. + +----------------------- +- Nov, 19. 2007 - +----------------------- +.: Added missing Unicode support for 'Static Servers' feature. + +----------------------- +- Nov, 12. 2007 - +----------------------- +.: Fixed several of our listcontrols to show Windows' context menu of scrollbars +.: Added an option (Options->General) to prevent Windows from going into standby mode while eMule is running (and doing something) + +----------------------- +- Nov, 11. 2007 - +----------------------- +.: Fixed bug in IRC window with channel windows opening in reverse order. +.: Fixed bug with dead servers occasionally not deleted from GUI [fox88]. +.: Fixed bug with disabled E-Mail notifications on particular Windows systems [Lewpy] +.: Added showing of IRC-warning and error messages to the active channel window. +.: Added auto-activating of private IRC channel windows when self-initiating the conversation. +.: Fixed bug with extra large icons in file tooltips. +.: Fixed bug with HTTP downloads which could create a crash in case the HD is full. +.: Fixed a memory leak with failed gzip'd HTTP downloads. + +----------------------- +- Nov, 07. 2007 - +----------------------- +.: Fixed garbled display of HTTP download status information + +----------------------- +- October, 31. 2007 - +----------------------- +.: The messagesystem is now able to find your friends even if their IP changed if you and they are in Kad and not firewalled. This will help to stay in contact with friends longer than one session (Only works for new added/new seen friends which have Kad enabled). +.: When messaging a friend, eMule now makes sure that the userhash still matches after connecting and SecureIdent (if enabled) is passed in order to ensure that its really your friend. + +----------------------- +- October, 28. 2007 - +----------------------- +.: You can now bootstrap to kad from an URL which points to a nodes.dat file (in the Kad tab) + +----------------------- +- October, 22. 2007 - +----------------------- +.: In order to reduce spam messages and by this make the messagesystem more useable again, eMule now supports Captcha authentification: +If enabled, someone who messages you has first to solve a cpatcha (an image which shows letters) before the message is shown to you. Older clients who do not support captchas will be unable to message you and receive a notice about this. + +----------------------- +- Jule, 11. 2007 - +----------------------- +.: Added obfuscation to the Kad UDP protocol. Kad obfuscation is part of the protocol and is unrelated to the Ed2K-Obfuscation settings + +----------------------- +- June, 5. 2007 - +----------------------- +.: Fixed a bug which let Kad try to load its preferences from the old config directory location + +----------------------- +- May, 16. 2007 - +----------------------- +.: Added Uyghur translation [translated by Abduqadir] + + + + +0.48a +----------------------- +- May, 13. 2007 - +----------------------- +.: Happy Birthday eMule :) + +----------------------- +- May, 12. 2007 - +----------------------- +.: Fixed some bugs in UPnP and changed the behavior for ADSL devices a bit +.: Fixed a bug concerning double adding friends +.: If Vista is running with Aero, eMule will enable Minimize to Tray on Minimize by default (can be changed in the display options) + +0.48a BETA2 +----------------------- +- May, 08. 2007 - +----------------------- +Ornis: Changed to wizard to set file proper file permission on installed config files +.: Fixed another Bug in the SourceExchange, which caused eMule to not response to requests in certain cases [Xman1] +.: Sorting for cumulative stats in the sharedfiles list is now properly remembered when restarting eMule +.: The "Disable UDP" and Enable "Kad" options now exclude eachother [leuk_he] +.: Fixed a bug in UPnP when the UDP port has been disabled by the user [leuk_he] +.: IRC optional serverports should work properly now +.: Fixed a bug in IRC when receiving ed2k links from other users +.: Added a excess flood protection for eMule IRC responses + +----------------------- +- May, 05. 2007 - +----------------------- +.: The Spam indicator icon has been replaced [icon by Daan] +.: The first time wizzard is now using the proper ports when testing UPnP in case a user has changed the ports in the wizzard +.: Fixed eMule (error-)handling for files whose paths exceed the operation system pathlength limit +.: If eMule started the Windows UPnP Service but failed to forward ports via UPnP it will shutdown the service afterwards +.: Added an option to disable smileys +.: Fixed a small memleak in the smileyselector window + + +0.48a BETA1 +----------------------- +- April, 29. 2007 - +----------------------- +.: The "official" development environment for eMule has switched to VS2003 SP1. VS2002 is no longer supported (but should still compile fine) + +----------------------- +- April, 28. 2007 - +----------------------- +.: Sorting in the ipfilter dialog has been fixed on Vista +.: Tooltips now have the proper size on Vista +.: All file related tooltips should look a bit nicer now (on all systems) +.: Added tooltips to the shared files list + +----------------------- +- April, 21. 2007 - +----------------------- +.: Sparse files have been disabled on Vista, due to a faulty / limited Vista implementation of them, which cannot be worked arround by eMule + +----------------------- +- April, 15. 2007 - +----------------------- +.: Added a spamfilter for search results. It mainly works by remembering files a user has marked as spam and marking files + which seems to be very similar as spam too. +.: Spam results are drawn gray and always put to the end of the list +.: Spam results count max. 5 sources towards the 100 sources global search limit + +----------------------- +- April, 9. 2007 - +----------------------- +.: The default paddingsize for obfuscated TCP connections has been increased to 128 bytes (from 16) in order to be harder detectable by size pattern matchings +.: The paddinglength can be changed manually by adding "CryptTCPPaddingLength=[1-256]" into the eMule section in the preferences.ini + +----------------------- +- March, 12. 2007 - +----------------------- +.: eMule now supports multi-user installations, which especially is supposed to fix the folder permission problems on Vista + In short: for Windows Versions before vista, nothing will change by default, on Vista eMule will use the current userspecific folders by default + Please consult the onlinehelp for a detailed explanation. The setting can be changed at the extended options. + +----------------------- +- March, 11. 2007 - +----------------------- +.: On Vista the half-open connection limit is now properly set to 9 by default (instead of 50) + +----------------------- +- Feb, 20. 2007 - +----------------------- +.: When using autoconnect on startup or pressing the Connect button while UPnP is still busy, eMule will wait for it to finish + or timeout. You can enforce on isntant connect by clicking the button again + +----------------------- +- Feb, 18. 2007 - +----------------------- +.: Added UPnP support [merged from Shareaza] +.: Added UPnP test button into the first time wizzard + +----------------------- +- Feb, 09. 2007 - +----------------------- +Ornis: added Farsi translation [translated by Mory Abdi & Ali Mojarad] +.: The calculation of credits given for the first 9MB (less than one part) has been changed slightly to decrease the reward for clients who upload less than one part + +----------------------- +- Jan, 20. 2007 - +----------------------- +.: Fixed a obfuscation related bug in the sourceexchange +.: Changed the sourceexchange protocol to avoid backwards compatibility problems and bugs in the future +.: Added support for multi-related files searches [serverside implementation by lugdunum] + +----------------------- +- Jan, 14. 2007 - +----------------------- +.: Fixed crash in Statistics window. +Ornis: added Valencian translation [translated by "Valencian"] +Ornis: major update of Slovenian translation [Gusar] +Ornis: label of category tabs are now displayed in category color +Ornis: return of the context menu on message tabs (Details, Add/Remove Friend, Close) + +----------------------- +- Jan, 5. 2007 - +----------------------- +.: Prepared Kad for support of obfuscated packets. This is only passive in this version yet. + +----------------------- +- Dec, 13. 2006 - +----------------------- +.: Fixed memory leak in list controls [eklmn] + +----------------------- +- Dec, 12. 2006 - +----------------------- +.: Fixed performance problem with too large eD2K links and enabled 'Monitor Clipboard' option. + +----------------------- +- Dec, 9. 2006 - +----------------------- +.: Several changes to make eMule work better under 640x480 resolutions. + +----------------------- +- Dec, 6. 2006 - +----------------------- +.: Fixed saving/restoring of size/position in collections dialogs. +.: Win98: Fixed missing volume labels and shell icons in directories property page's directory tree control. +.: Win98: Fixed not supported multiline tooltip in tray bar. +.: Win98/WinME: Fixed not supported toolbar customization. +.: Win98/WinME/Win2000: Fixed toolbar chevron. +.: Win98/WinME: Fixed vertical axis labels in statistics graphs. +.: Win98/WinME: Fixed saving/restoring of expanded sub trees in statistics tree. +.: Win98/WinME/Win2000: Fixed invisible buttons in transfers window. +.: Win98: Fixed bug with "ShowActiveDownloadsBold=1" setting in Transfers window. + +----------------------- +- Nov, 22. 2006 - +----------------------- +.: Reduced long time memory usage for GUI. +.: eMule stores now hashs of filehashs in the cancelled.met for privacy reasons + +----------------------- +- Nov, 21. 2006 - +----------------------- +.: Both windows in Transfere window are showing a toolbar to select the window contents. + +----------------------- +- Nov, 18. 2006 - +----------------------- +.: Edit controls for Message and IRC window are using slightly larger fonts. + +----------------------- +- Nov, 17. 2006 - +----------------------- +.: Fixed bug in IRC window with nick change messages which were not always shown. +.: Fixed bug in IRC window with URL detection with special chars at end of URLs. + +----------------------- +- Nov, 15. 2006 - +----------------------- +.: Minor visual improvements for IRC window and Message window text format buttons. +.: Multiline messages in Message and IRC chat windows are intended for improved readability. +.: Some visual improvements in Collection dialogs. + +----------------------- +- Nov, 12. 2006 - +----------------------- +.: IRC channel filtering is performed on IRC server to reduce network load, the filter string now supports the wildcard character '*'. (e.g. "#emule-*" to match all channel names which start with "#emule-") +.: IRC window: Activity is now also shown for the 'Channels' window to give some response when user explicitly invoked the "/LIST" command. +.: IRC window: Nick list shows joined modes and names. + +----------------------- +- Nov, 11. 2006 - +----------------------- +.: Fixed a bug with single clicking on emule tray bar icon. +.: Fixed bug with requesting eMule friendship via IRC. +.: Changed: By default the IRC channel list will contain only eMule-Help channels. +.: Added: IRC server can optionally contain a port (seperated by ':' character) +.: Fixed bug with background color not reset in IRC colored messages. +.: Added title window for IRC channels. + +----------------------- +- Nov, 9. 2006 - +----------------------- +.: Added smiley selector window to Message and IRC window. + +----------------------- +- Nov, 7. 2006 - +----------------------- +.: Fixed bug with not outputed IRC notice messages. +.: Fixed Message window splitter. + +----------------------- +- Nov, 6. 2006 - +----------------------- +.: Fixed IRC window splitter. + +----------------------- +- Nov, 5. 2006 - +----------------------- +.: Fixed bug with reversed sort orders for fresh emule installations. +.: Fixed bug with already used IRC nick when connecting. +.: Fixed bug with changing font size in IRC windows. + +----------------------- +- Nov, 1. 2006 - +----------------------- +.: Added showing of smileys to Chat and IRC windows [Smileys by Daan] +.: Reworked AutoScroll feature in all log and chat windows to automatically disable AutoScroll while viewing content not at the end of the window. +.: Fixed right click problem in IRC and chat windows. +.: Fixed some bugs in IRC color code handling. +.: Fixed bugs with black background color in IRC windows. +.: Skins: Fixed problems with foreground skin color in RichEdit controls. +.: Skins: All icons can be read from all file formats which are supported by GDI+ (GIF, PNG, ...) + +----------------------- +- Oct, 26. 2006 - +----------------------- +.: Fixed: "exit" command line option no longer starts eMule if it was not already running [DreamWalker] +.: Fixed edk2-URL handling for better support of copying URLs from webpages. +.: Fixed bug in file disk space statistics for pre-allocated files. [AnPapaSeiBua] +.: Fixed bugs in Comment dialog with copy to clipboard functions. +.: Fixed bug with "ed2k::" search expressions when combined with other search attributes. Note: "ed2k::" can still only be used in ED2K searches, not in Kad. +.: Fixed bug in local search result filter with changing column. +.: Fixed bug with Unicode strings in category properties. +.: Added optional drawing of filled graphs in Statistics window. +.: Several performance improvments and minor bug fixes in IRC module. + +----------------------- +- Sep, 23. 2006 - +----------------------- +.: Fixed a potential crash when shutting down eMule [DavidXanatos] + +----------------------- +- Sep, 21. 2006 - +----------------------- +.: Added support for RealMedia files to 'Content' dialog (any optional available MediaInfoLib will no longer be used for RealMedia files). +.: Added support for publishing meta data for RealMedia files. +.: Added several Kad optimizations to reduce overhead as well as memory usage: + - Redundant meta data will no longer get published. + - File format meta data is no longer published explicitly and handled special in search expressions. + - Removed (currently not used) data from Hello packet. + +----------------------- +- Sep, 16. 2006 - +----------------------- +.: Fixed bug with invisible text in search filter control for high contrast color scheme. +.: Taskbar Notifier: Added support for alpha channel background images. +.: Taskbar Notifier: Changes made to "notifier.ini" file while eMule is running are read automatically without needing to do a restart. +.: Added Unicode support for id3lib (Content dialog and metadata stored in Kad). + + +v0.47c Hotfix +----------------------- +- Sep, 14. 2006 - +----------------------- +.: Fixed some major bugs in Kad 2.0 source/keyword publishing + +----------------------- +- Sep, 13. 2006 - +----------------------- +.: Fixed Kad bug with processing Kad1.0-Packets which is believed to be remotely exploitable and therefore a potential risk if Kad is enabled [found by tHeWiZaRdOfDoS] +.: Fixed bug with lost setting for disabled UDP port. +.: Fixed bug in First Runtime Wizard with previously disabled UDP port. +.: Added more sanitizing for Kad packages to ignore all unrequested packets + +----------------------- +- Sep, 11. 2006 - +----------------------- +.: Fixed some Kad memory leaks in exception handlers [tHeWiZaRdOfDoS] +.: Tweaked reading of "addresses.dat" and "shareddir.dat" files to skip spaces and empty lines. +.: Fixed bug with wrong file type mismatch warning for multiple selected part files. + +v0.47b +----------------------- +- Sep, 7. 2006 - +----------------------- +Ornis: Added progressbar during archive scanning for live archive preview + +----------------------- +- Sep, 5. 2006 - +----------------------- +.: eMule will take care that the random choosen ports are not used already +.: Added a fix for a possible problem when search Kad-Buddies [DavidXanatos] +.: Fixed a small bug in a kad response sanitycheck [WiZardofDoS] + +----------------------- +- Sep, 1. 2006 - +----------------------- +.: Some optimizations for IP-filtering in Kad. +.: Fixed a bug where wrong Kad 1.0 Notes packets were sent. +.: Fixed bug with MiniMule which failed to open when eMule was installed in folders with special characters. + + +0.47b BETA1 +----------------------- +- Aug, 31. 2006 - +----------------------- +.: Bugfix: When trying to connect to a selected server which times out, eMule will no longer try to conenct to other servers instead +.: Added a fix for receiving ED2K UDP packets when the remote client is behind a UDP portmapping router +Ornis: Added vietnamese translation, by Paul Tran HQ Loc +.: Fixed a small rounding error on the filerateing icon + +----------------------- +- Aug, 26. 2006 - +----------------------- +Ornis: Added filetype display to Filedetail Dialog. For most common filestypes, the downloaded header is checked to match the file extention. A warning icon is shown if its file extention matches a different file type. +Ornis: Fixed a bug in the webserver with banning IPs after too many logintries[DreamWalker] + +----------------------- +- Aug, 24. 2006 - +----------------------- +.: When doing a search for comments on Kad, an icon (in the place of the rateing icon) will indicate that a search is in progress + The button to search for comments on Kad will be disabled while a search is in progress. + +----------------------- +- Aug, 21. 2006 - +----------------------- +.: Several minor possible memleaks have been corrected [WiZardofDoS] +.: On a fresh installation eMule will now select random ports instead the default port 4662 and 4672. The ports won't be changed on existing installations and stay the same after restarts. The helpfiles will be updated to reflect this. + +----------------------- +- Aug, 20. 2006 - +----------------------- +.: Fixed missing IPFilter checks for outgoing UDP packets from KAD / Kad Nodes [leuk he] +.: Incoming ED2K and some Kad UDP response packets are now ignored if they were not requested. +.: An option to enable or disable MiniMule has been added to the General options dialog +.: (extrem rare) possible integer overflow causing problems when downloading large files has been fixed [avi-3k] + +----------------------- +- Aug, 17. 2006 - +----------------------- +.: A possible premature send bug on TryToConnect has been fixed [eklm] +.: Servers added from other clients or servers will now get low priority by default + +----------------------- +- Aug, 15. 2006 - +----------------------- +.: Reworked file comment dialogs: added rating icons, network info and sortable comment list + +----------------------- +- Aug, 12. 2006 - +----------------------- +Ornis: 2 fixes for statistic dialog when moving vertical splitter to minimum or maximum position [BlueSonicBoy] +Ornis: Fixed bug in webserver to deal with filenames with apostrophes in transfer list (missing javascript controlled popupmenue) + +----------------------- +- Aug, 5. 2006 - +----------------------- +Ornis: Added live archive preview for ZIP,RAR and ACE. The Content-tab of the file detail dialog (partfiles and completed files) will list content of the archive (file name & path, size, CRC,...) and information like existing password protection, archive atttributes,... + Completeness of the list depends on download status. Downloaded parts are scanned, ZIP central directory is read if fileend was downloaded. +Ornis: Added archive recovery for ACE archives. (As for ZIP & RAR already present: create a version of the downloading archive containing the files that are already available.) + Some minor fixes in archive recovery, including remove tempfile when recovery failed. +Ornis: Fix for better handling of pasted links in the ed2k-link dialog to process empty lines and whitespaces [zoom] + +----------------------- +- Jul, 26. 2006 - +----------------------- +.: Added Obfuscation Layer for ED2K/Kad TCP, ED2K UDP, Server TCP and Server UDP connections. Kad UDP is not obuscatable yet. For a detailed explanation of this feature, please check this topic of our onlinehelp: http://www.emule-project.net/home/perl/help.cgi?l=2&rm=show_topic&topic_id=848 +.: The security options page has been split and now contains also obfuscation settings. Comments and message related setting have now there own page. + +----------------------- +- Jun, 24. 2006 - +----------------------- +zz: Improved chunk chooser: major improvements for very rare files (less than 5 sources), but also includes tweaks for common files and for preview chunks + +----------------------- +- Jun, 21. 2006 - +----------------------- +.: Added support for MediaInfoLib v0.7.1+ + +----------------------- +- Jun, 7. 2006 - +----------------------- +.: Fixed bug with default preview function which did not open default application for certain file types. +.: Added option to specify preview command line. + +----------------------- +- Jun, 6. 2006 - +----------------------- +.: Fixed bug with renameing files in shared files window [SiRoB] + +----------------------- +- Jun, 4. 2006 - +----------------------- +.: Fixed problem with possible file corruption when eMule is run as 'secure user' and system logoff/reboot. + +----------------------- +- May, 31. 2006 - +----------------------- +.: Fixed bug in connection management. + +----------------------- +- May, 29. 2006 - +----------------------- +.: Reworked Media Info dialog's additional information window. + +----------------------- +- May, 26. 2006 - +----------------------- +.: Media Info dialog shows hint about files which are protected with DRM. +.: Fixed bug in Media Info dialog with getting AVI properties for some part files. +.: Added workaround to Media Info dialog to show more reliable play length for MPEG files when used with MediaInfoLib. + +----------------------- +- May, 21. 2006 - +----------------------- +.: Added search results specific menu (look closely to the label above the search results list) for some minor important functions: +- specify the format of file size numbers for search results (KB = shows sizes in KByte with same format as used by Windows Explorer, MB = shows sizes in MByte, Default = free style) +- reset search results filter + +----------------------- +- May, 17. 2006 - +----------------------- +.: Fixed bug with 'Find' function in search results list when used for non-filename fields. + +----------------------- +- May, 16. 2006 - +----------------------- +.: Added simple on-the-fly filter for search results to filter already received results. The +filter will be invoked automatically after you stopped typing in the filter control. +Generally all specified strings (separated by space) are ANDed. Strings which do not +start with a '-' character (positive filter) must be found in the filename of the +search results while strings which are starting with '-' characters (negative filter) +must not be found in the filename of the search results. + +Example: -xyz -abc cool file +This will show only search entries where the filename contains the words "cool" and +"file" and which are not containing the strings "xyz" nor "abc". + + +----------------------- +- May, 13. 2006 - +----------------------- +.: Search results pane tab context menu offers function to restore all used search parameters for that particular search. + +----------------------- +- May, 12. 2006 - +----------------------- +.: Server Info pane shows time stamped "connected" messages before now server info messages. +.: Fixed bug in server UDP socket with ignoring received servers stats from dynIP-servers. +.: Fixed bugs in server UDP socket with race conditions of DNS queries and outgoing UDP packets (for dynIP-servers). +.: Servers can get cutted with Ctrl+X + +----------------------- +- May, 11. 2006 - +----------------------- +.: IP-Filter: dynIP-servers are no longer rejected when enableing "Filter servers too" and get eventually IP-filtered after the DN was resolved. +.: IP-Filter: Non-dynIP-servers and dynIP-servers with an already known IP are filtered whenever the IP-filter list or a related IP-filter option was changed. +.: Fixed bug in Webinterface with server sorting and dynIP servers. +.: Fixed bug with ed2k-server URLs and dynIP servers. +.: Fixed bug in auto server connecting which could lead to not connecting to any server at all. +.: Fixed several bugs related to duplicate dynIP-server entries in server list. + +----------------------- +- May, 8. 2006 - +----------------------- +.: Fixed some Unicode error message bugs [Xman1] +.: Fixed bug with not completing files due to invalid filename prefixes. + +----------------------- +- Apr, 27. 2006 - +----------------------- +Unk: Corrected Kad crash bug. (Pointed out by Ani) + +----------------------- +- Apr, 10. 2006 - +----------------------- +.: Fixed GUI glitch in download client progressbar [SiRoB] + +----------------------- +- Apr, 1st 2006 :-> +----------------------- +.: Fixed bug with re-downloaded and re-shared files. +.: Fixed bug with "Summary Not Updated After Deleting Shared File" [raccoon.i] +.: Added preferences.ini setting "UserSortedServerList=1". When enabled this will use the same server list sorting as shown in GUI when trying to connect to a server. + +----------------------- +- Mar, 26. 2006 - +----------------------- +.: Fixed bug with eMule getting focus on received chat message when minimized [raccoon.i] +.: Fixed Win2K specific GUI glitches in search results. + +----------------------- +- Mar, 25. 2006 - +----------------------- +.: Fixed some icon resource leaks. +.: Fixed bugs with changing Windows color schemes on-the-fly and for Windows "High Contrast" color schemes. +.: Fixed bug with exchanged rating strings [Aenarion[ITA]] +.: Fixed missing entries in connection wizard dialog [FrankyFive] +.: Fixed bug in webserver for files >4GB [zAxel] +.: Fixed bug in webserver related to HTTP error reply. + +----------------------- +- Mar, 9. 2006 - +----------------------- +Unk: Keyword search for Kad2.0 with Kad1.0 integration working. +Unk: Fixed possible mem leak in Kad.. + +----------------------- +- Mar, 4. 2006 - +----------------------- +Unk: Keyword store Note search for Kad2.0 with Kad1.0 integration working. Kad2.0/1.0 integration completed. + +----------------------- +- Feb, 4. 2006 - +----------------------- +Unk: SMIRC now supports color. (BlueSonicBoy-TK4) +Unk: Fixed GetClosestTo not return the number of results wanted.. (tatikiran) +.: Fixed potential crash with MiniMule. +.: Ported sources code to VS2005. +.: Several runtime performance optimizations for 64-bit arithmetics. +.: Fixed a minor bug with large file search results. + +----------------------- +- Jan, 29. 2006 - +----------------------- +Unk: Starting to use Kad2.0 with Kad1.0 integration... Hello Packets, Node Lookups, BootStraps, Source Store/Search, Note Store working. + +0.47a +----------------------- +- Jan, 25. 2006 - +----------------------- +Unk: Fixed a Kad bug when looking for a Buddy.. (leuk_he) +.: Fixed a problem with corrupting known2_64.met if "Remember downloaded files" is disabled + + +----------------------- +- Jan, 24. 2006 - +----------------------- +.: Fixed banned client statistics [Xman1] +.: Fixed cumulative part file data statistics [TimDzang] +.: Fixed download list transferred data shown in completed column, if transferred column is hidden. +.: Fixed stalling during part file allocation. +.: Fixed rejected connections (ip filter) stats. + + +0.47a BETA2 +----------------------- +- Jan, 23. 2006 - +----------------------- +.: Clients which send filtered messages will now also be identified as spammers +.: Fixed a bug with HTTP/Peercache sources (SiRob) +.: Fixed a problem with converting known2.met - it should not rehash files anymore when updating from a prior version + +----------------------- +- Jan, 21. 2006 - +----------------------- +Unk: Continued work with Kad2.0. Only host side funcational still +Unk: More tweaks to Kad1.0. +Unk: Correction to "Change in LPhant version display (Famerlor)" +Unk: Make sure Kad config files are not read by older clients as they may contain tags they cannot read. + +----------------------- +- Jan, 20. 2006 - +----------------------- +.: Fixed a bug which could cause problems when loading part.met files of large files (SiRob) +.: Changed the protocol to check the hash+filesize instead only the hash on requested files + + +0.47a BETA1 +----------------------- +- Jan, 15. 2006 - +----------------------- +Unk: Began work on Kad2.0.. The idea is to improve the protocol and add some features.. This client will only host the new protocol, the next version will have the option to switch between Kad and Kad2.0.. +.: Completed files can now be deleted from the download window +.: Updated MobileMule protocol for large files + +----------------------- +- Jan, 14. 2006 - +----------------------- +.: Clients which were identified as spammers will now be banned instead of only ignoring their messages + +----------------------- +- Jan, 11. 2006 - +----------------------- +Unk: It appears there is a rare possibility that a keyword to a known file that is not shared can attempt to be published, a check is in place to avoid it. + +----------------------- +- Jan, 8. 2006 - +----------------------- +.: Added support for large files. The new file size limit which eMule can handle is 256GB (the old one was 4GB) +.: The following compatibility issues for large files apply: + - Large files can be found, downloaded and uploaded only by clients which support it (right now eMule 0.47a and above) + - Collections which contain any large files can no longer be read by clients which don't support large files + - part.met files from large files can not be used with old eMule versions / ed2k tools + - If any large file is shared/known the known.met file will no longer be backward compatible to older eMule versions + - Known2.met will be converted to Known2_64.met which can not be read by old eMule versions +Unk: Updated Kad to handle large files.. + - Older clients cannot index large file keywords. This will mean getting keyword results on large files will not + work well until the majority of the network updates.. + +----------------------- +- Dec, 30. 2005 - +----------------------- +.: Added "Minimize to system tray" command to system menu. + +----------------------- +- Dec, 26. 2005 - +----------------------- +.: Fixed bug with wrong 'Download Time' reported for some paused files. + +----------------------- +- Dec, 24. 2005 - +----------------------- +.: Fixed bug with setting the priority of a static server which was lost after a restart. +.: Added cycling through main eMule windows with Ctrl+Tab and Shift+Ctrl+Tab respectively. + +----------------------- +- Dec, 17. 2005 - +----------------------- +.: Fixed problem with shared files which have invalid file date [thx Kro/MorphXT] + +----------------------- +- Dec, 3. 2005 - +----------------------- +.: Proxy support: Couple of optimizations for proxy support. +.: Proxy support: The "Proxy/ShowErrors" preferences.ini setting has no meaning any longer because all proxy errors are now shown as part of the regular connection error messages for servers and clients. +.: Proxy support: Fixed bug in SOCKS 5 authentication. +.: Proxy support: Added support for HTTP/1.0 proxies which saves proxy overhead. Hint: If you have to use a HTTP proxy, HTTP/1.0 is recommended unless you must use HTTP/1.1. +The precedence of the proxy protocol performance is as follows. +1. SOCKS 4a (highest performance because of least overhead) +2. SOCKS 4 +3. SOCKS 5 +4. HTTP/1.0 +5. HTTP/1.1 (lowest performance because of most overhead) +.: Speed up for large IP-filter list loading. + +----------------------- +- Nov, 30. 2005 - +----------------------- +zz: Option to make eMule use highres scheduling (better precision for sleeps and some timers). Currently the upload throttler takes advantage of it if enabled, which may give smoother upload performance and smoother pings while using eMule. Try it at your own risk. :) Use this preferences.ini setting in [eMule] section to activate: HighresTimer=1 + +----------------------- +- Nov, 26. 2005 - +----------------------- +.: Changed search function in IP-Filter Dialog: When searching for an IP in the "Start" column, the "range" where the specified IP is within is searched. Hint: This way one can check if a particular IP is blocked in the loaded IP filter list. +Ornis: Importer added for incomplete (ed2k)Shareaza tempfiles [by David Xanatos] + +----------------------- +- Nov, 24. 2005 - +----------------------- +.: Added "BindAddr=" setting to preferences.ini to bind eD2K/Kad+WebServer sockets to specified IP address. +.: Fixed bug with "Start Minimized" and "Minimize to Systemtray". +.: Main window can be restored from MiniMule window by double clicking on MiniMule's title bar. +.: Enter-key can be used in listviews to invoke the default action for selected items (like "Connect to server", "Download search result", "Open completed file", ...) + +----------------------- +- Nov, 20. 2005 - +----------------------- +Unk: Attempted to clean up all SMIRC Code. +1) Reformatted code so all has the same format. +2) Almost a complete rewrite in the core code which should correct the following issues. +. A change in the default preferences caused SMIRC to not display a popup for the user to change their nick. +. Some users could not see what they were typing.. +. Channel Modes were not handled correctly in many cases. +. Sending new channel modes from the tab menu didn't send correct modes in most cases. +. Sorting nicks within a channel didn't sort correctly. +. Notices were not process correctly in some cases.. +. Ping/Pong between users didn't work. +. Server filter option in prefs was unable to be cleared. + +----------------------- +- Nov, 14. 2005 - +----------------------- +Unk: Attemped to clean up all Kad Code. +1) Reformatted code so all has the same format. +2) Removed some unused method params and vars. +3) Tried to optimize some code. +4) Fixed a possible issue that if you found your target on first try, you wouldn't send a request/store. +5) Began adding comments to code for better understanding. (This will be done slowly if ever finished.) +6) Put back keyword results sanity check. +7) Fixed issue with Zones not being merged when contacts get low. (Help with Kry) +8) Changed how contacts are kept alive to keep contact list fresher with less CPU +9) Adjusted where Jumpstart is called to reduce CPU. +10) Adjusted user count to account for firewalled users. + +----------------------- +- Nov, 13. 2005 - +----------------------- +.: Code cleanups and performance optimizations regarding 16-bit integer usage. +.: E-Mail notifications are disabled for non-XP-SP2 systems when built with ATL 7.1. +.: Added "Find" command to all list views (shortcuts Ctrl+F=New search, F3=Search next, Shift+F3=Search prev.). + +----------------------- +- Nov, 5. 2005 - +----------------------- +.: Added support for RARed IP filter files. Download UNRAR.DLL from http://www.rarlab.com and copy to emule installation folder. +.: Added support for RARed eMule skin profiles. (As with ZIPed skin profiles, you can install downloaded RARed skin profiles right from Shared Files window by right clicking and invoking "Install eMule Skin" command.) +Unk: Lower CPU load within Kad's Routing. (Kry, idea by lupz) + +----------------------- +- Oct, 30. 2005 - +----------------------- +.: Fixed bug with IP Filter URL dropdown control in Security Dialog which was loosing all entries. +.: Added verification of downloaded IP Filter files to detect files without any IP filters (e.g. dead URLs). +.: A ZIPped IP filter file must contain one file (which holds the IP filter list) with the name "guarding.p2p" or "ipfilter.dat". All other files possible available in a ZIP file are ignored. + +----------------------- +- Oct, 15. 2005 - +----------------------- +Ornis: option for full filesize preallocation (extended settings) +Ornis: systray flashes with message icon on incoming new message (message, not IRC (yet)) when enabled in preferences.ini (Section "eMule" set "IconflashOnNewMessage=1") + +----------------------- +- Oct, 8. 2005 - +----------------------- +.: Media Info File Dialog shows information about additional audio/video/subtitle streams. (Use MediaInfo DLL (http://mediainfo.sourceforge.net/) to get this support for non-AVI files). +.: MP3 files with variable bitrates and Xing-VBR frame are report and published with the average VBR bitrate. + +----------------------- +- September, 30. 2005 - +----------------------- +.: Added more safety to tag parsing in hello packets [thx Kry] + +----------------------- +- September, 29. 2005 - +----------------------- +.: File detail dialog shows accumulated remaining size of multiple selected files. + +----------------------- +- September, 26. 2005 - +----------------------- +.: Fixed bug with 'Ext' command in 'PreviewApps.dat' file. + +----------------------- +- September, 25. 2005 - +----------------------- +.: Added file rating support for ED2K-server search results. Received ratings are shown with additional icon like in Transfers window and in 'Meta Data' details dialog. +.: Fixed bug with double clicking on rating icon in Transfere window not always opening comment dialog page. +.: Fixed bugs with property pages not restored correctly when using file details dialog in different main windows. + +----------------------- +- September, 24. 2005 - +----------------------- +.: The meaning of the 'Cancel' search button was modified slightly. The 'Cancel' button now cancels any +active search only if the according search result list is active. This means that active Kad searches +can be canceled without closing the search result list window. So, to cancel any active search (regardless +of the search type) without deleting the search results, activate the according search result list and click 'Cancel'. + +----------------------- +- September, 20. 2005 - +----------------------- +.: Added optional floating point number support to search attributes in GUI and meta data search attributes in parser. (e.g. @size<1.23g) +.: Size-, Availability-, Complete Sources-, Bitrate- and Length-search attributes can be specified in GUI in same way as in parser (see there). + +----------------------- +- September, 19. 2005 - +----------------------- +.: Added new method for extracting meta data from AVI/WAV files without using DirectShow filters. + +----------------------- +- September, 15. 2005 - +----------------------- +.: Added value checks for 'type' search tag: @type="audio"|"video"|"image"|"img"|"document"|"program"|"archive"|"iso"|"cd" + All type-values can be abbreviated with the first 3 characters (e.g. @type=doc is the same as @type=document) +.: Added parsing of value for @length seach tag: 'length' can be specied as HH:MM:SS or MM:SS or as 'seconds' + followed by a modifier (s=seconds(default), m=minutes, h=hours; e.g. "2m" is 2 minutes and is equal to "2:00") +.: Added abbreviations for search tags: all search tags can be abbreviated by their first 3 characters. + (e.g. "@siz" is equal to "@size") + +----------------------- +- September, 13. 2005 - +----------------------- +.: Added "exact string" search for Kad searches (quoted strings will be sent to nodes unchanged). + Note: Only newer Kad nodes will be able to process them correctly, older Kad nodes will not return a result. +Ornis: Webinterface: fixed information popup for upload items + +----------------------- +- September, 12. 2005 - +----------------------- +.: Added '-' as NOT shortcut to search expression (Google-style). + - Terms prefixed with '-' get interpreted as NOT operator (e.g. "file -avi" is equal to "file NOT avi"; also "file -@codec=wmv3" is equal to "file NOT @codec=wmv3") + - Strings can still contain the '-' character within the string (e.g "cool-file") +.: Breaking changes in search expression parser: + - the characters '<', '>' and '=' (and also partially '@') are treated special. If they are to be used in search terms, they have to be quoted. + - several meta-data IDs starting with '@' or when written all in uppercase are treated special. If they are to be used in search terms, they have to be quoted. + - the Kad comparison operators '<', '>', '>=' and '<=' are now equal to ED2K operators. + You should not see much difference in practice. If though (e.g. when searching for bitrate), specify the value decreased by one or increased by one (depending on the comparions operator). + This will vanish after more eMule clients have upgraded. + - all meta-data IDs used in search expressions are sent as integer tags for saving bandwidth and CPU load (for ED2K and Kad) + - precedence of AND and OR operator changed to get a Google-like interpretation: + "a b OR c d" (or "a AND b OR c AND d" respectively) does no longer evaluate to "(a AND b) OR (c AND d)" but to "a AND (b OR c) AND d" (Google-style) + You still can use paranthesis to force the precedence of evaluation to suite your needs. + - The '-' character is interpretated as NOT when seen 'outside' of a string. + +----------------------- +- September, 11. 2005 - +----------------------- +.: Optimized search expression trees for putting less CPU load on servers and Kad nodes when evaluating the trees (less recursions). + +---------------------- +- September, 9. 2005 - +---------------------- +.: Fixed problem with active Kad search indicator which was disabled too early. +.: Added "exact string" search for ED2K searches (quoted strings will be sent to servers unchanged) +.: Added meta-data searching to search expression parser. +.: Reworked boolean search expression parser: implicit ANDs do no longer need to be specified (e.g. "a AND (b OR c)" can be specified as "a (b OR c)") + +---------------------- +- September, 4. 2005 - +---------------------- +.: Removed sending of string file format meta tags to eserver and emule clients for saving bandwidth [thx lugdunum] +.: Added sending of new integer file type meta tags to eserver for saving bandwidth [thx lugdunum] +.: Available 'Complete' info is shown correctly in search results when viewing shared files of other clients. +.: Available 'Complete' info for files with less then 9280000 bytes is shown correctly in search results for Kad searches. +.: Added "Search Related Files" menu item to Download List context menu. +.: Fixed, amount of transferred data for a source is no longer shown in Completed but in Transferred column in Download List. + +---------------------- +- August, 30. 2005 - +---------------------- +Unk: Removed an unused tag in the loginrequest packet. (Avi-3k & Lug) +Unk: When a very large popular server come online, it experienced ping storms every 4 hours.. Fixed (Lug) +Unk: Store file rating to servers. (Lug) +Unk: We not longer send FT_FILEFORMAT tags to servers.. (Lug) +Unk: Fixed a couple malformed strings in MIRC. (Avi-3k) + +---------------------- +- August, 18. 2005 - +---------------------- +Ornis: added Maltese translation by Reuben +Ornis: fixed graphical issues (Log-Reset button on language change, avoid minimizable log/chat windows) + +---------------------- +- August, 8. 2005 - +---------------------- +Ornis: fixed a crash on systray clicking (happened on very certain click behaviour or heavily busy systems) + +---------------------- +- August, 1. 2005 - +---------------------- +Ornis: added Ukrainian translation [translated by Kex] + +---------------------- +- July, 29. 2005 - +---------------------- +Unk: Fix shared "Open Folder" (Avi-3k) +Unk: Fix ClientCredit debug mode (Avi-3k) +Unk: Fix DownloadList sort bug (Avi-3k) +Unk: Fix bug in Ppgfiles (eMulefan83) +Unk: Fix cursor bug (Slugfiller) +Unk: Change in Preference localize easier add/remove preference windows (CiccioBastardo) +Unk: Change in LPhant version display (Famerlor) + + +v0.46c +---------------------- +- July, 24. 2005 - +---------------------- +.: Added support for MediaInfo DLL versions 0.6.1 and 0.7.x [Thx to Zenitram] + +---------------------- +- July, 22. 2005 - +---------------------- +.: Updated to zlib 1.2.3 because of security flaws in 1.2.2 + +---------------------- +- July, 18. 2005 - +---------------------- +Unk: Fixed possible crash on malformed Kad packet.. (Kry) +Unk: Auto Kad bootstrap wasn't updated to work with eMule's Multipacket protocol. Fixed. + +---------------------- +- July, 16. 2005 - +---------------------- +Ornis: fixed bug (v0.46b) in using regular expressions as view filter in categories [thx kinmenalex] + +---------------------- +- July, 9. 2005 - +---------------------- +Ornis: fixed bug in checking for tempfolder when multiple folders were used, and a little splitterbar bug [tHeWiZaRdOfDoS] +Ornis: new and changed category incoming directories will now appear in the new shared files control + +---------------------- +- July, 8. 2005 - +---------------------- +.: The upload limit and capacity as well as the downloadlimit will now be set to unlimited by default +.: When the uploadcapacity is set to unlimited (0), USS will be automatically enabled to determinate the best uploadspeed +.: If using the prio default capacity (16KB), the new version will reset it (one time) to the new default unlimited +zz: UploadSpeedSense will at most raise speed 30 KBytes/s above current upload speed. This will prevent it from raising to very high limits if your client can't upload fast enough to reach the limit due to no clients in queue. +zz: Bugfix+enhancement to the code that requests less of the file from slow download sources. Will now only activate this code if there's little enough left of the file to complete. +Ornis: Resizeable collection windows +Ornis: added some USS localisations +Unk: Some cpu fixes for Kad. (Kry) +Unk: Changed how we maintain contacts for kad. +Unk: Kad node lookup algo modified to use far less overhead with better results. +Unk: Collections were storing extra tags causing them to be "bloated".. Fixed. + +---------------------- +- July, 5. 2005 - +---------------------- +Ornis: fixed/improved downloading big files via webinterface +Ornis: fixed tiny memleak in the preferences/statistics dialog + + +v0.46b +---------------------- +- July, 4. 2005 - +---------------------- +zz: fixed Uploading sort bug +Unk: Collection Names more relaxed for the users.. (ie: It doesn't reformat the name or remove tags) +Unk: Lowered number of stores to help with routers. +Ornis: Multi-Temp folders should work now. +Unk: Fixed Comment Icons staying when no comment/ratings are available. +.: Fixed several smaller glitches in the new share control +.: Fixed the filesizelimit for downlaoding files from the webinterface +.: Fixed some crashing bug with duplicated files +.: Fixed some minor general GUI glitches (Icons, save&restore, etc) + +---------------------- +- July, 1. 2005 - +---------------------- +Unk: Some users complained that the "Users | Files" box wasn't large enough for their lang. Double clicking that box now pulls up MyInfo with user/file counts included. +Unk: Added some extra info to the full screen MyInfo box. (Parts based on Morph mod) + +eMule 0.46b Beta +---------------------- +- June, 28. 2005 - +---------------------- +zz: Removed "Automatically Swap All (A4AF) Sources To This File" menu item. For the same effect, raise download priority on the file instead. See Web Help&Support -> Features -> Source Management +zz: When downloading from a really slow source, request less of the file at a time. This locks less of the file, so if there's a faster source available we have a better chance of downloading from it even when the file is almost completely downloaded. +Unk: Basic Collection framework and gui (see documentation for detailed information on this) +.: Improved Collection Gui. +.: Collections are now properly signed/verfied. If verifying failes, the authorname and key are removed +.: Downloadrequests for collections will bypass the downloadqueue and served immediately +.: Added splitter control to the shared files window +.: Changed the apperearence of the splitter slightly +.: Collection files can now be linked to eMule, click the "Take ED2k-links" Button to do so, if not already done by the installer + + +---------------------- +- June, 27. 2005 - +---------------------- +Ornis: Fixed crash when downloading via HTTP source and viewing the downloadclient-list + +---------------------- +- June, 26. 2005 - +---------------------- +.: Extended the "Run as unprivleged User" function: If starting with the eMule-Account fails (for example because of lacking privileges) + eMule will restart as the same users but with reduced privileges (but same file permissions). + This helps users which are already working with an Non-Admin account to improve the security a bit more + +---------------------- +- June, 25. 2005 - +---------------------- +Ornis: minimule shows now count of all completed files, in all categories [by TED] + +---------------------- +- June, 19. 2005 - +---------------------- +.: Added new control into the Shared Files window which lets you browser your shared files by directories and add/remove shared directories + (you can also drag&drop a directory from "All Directories" into "Shared Directories" to share it) +.: Added support for Related File-Search into the Search window (contextmenu). This allows you to search for files which are shared by users which also shared the selected file [lugdunum] + + +---------------------- +- June, 16. 2005 - +---------------------- +Unk: Kad Notes (Comments from the Kad network) are now filtered like normal comments. +Unk: Tray shutdown bug fix. [Xman1] + +---------------------- +- June, 13. 2005 - +---------------------- +Unk: Ratings icons now show a range of ratings based on the average total instead of just good/bad. +Unk: Converted all comment Lists to Mule Style Lists. (Do to sync issues, sorting doesn't work yet..) +.: 16 color support added. (eMule will now look better when viewing it with remote desktop at 16 color display.) + +---------------------- +- June, 13. 2005 - +---------------------- +Unk: Fixed a bug in kad that returned the incorrect order of contacts to start a search. (thx Agthorr for finding bug) +Unk: During a KadRequest, we now sort the contacts in the bin based on the target first to make sure we send the best results. +Unk: Fixed a bug that treated all KadResults as a best result causing extra overhead. (thx Agthorr for finding bug) +Unk: Fixed a bug that removed wanted contacts in the "possible" list during Kad searches. (thx Agthorr for finding bug) +Ornis: splitterbar for the serverwindow +Ornis: reworked dialog lists setup save&restore: + - added save&restore sort history + - fixed column order error + - sort history added for serverlist, sharedfileslist and all lists in the transferwindow + - Updating to this version will not load your previous lists sort orders + +---------------------- +- June, 10. 2005 - +---------------------- +Ornis: added support of multiple tempfolders (to seperate by | ). A tempfolder out of several is selected when adding a download, depending on the incomingfolder (category) and most free space. (temppath can not (yet) be changed lateron) +Ornis: webinterface links changed to be relative +Unk: FileDetailDialog is now used for all CListCtrl that deals with files. +Unk: General code changes.. (Ex. AbstractFile, SearchFile, KnownFile, StatisticFile are now in seperate .cpp/.h files. Changed class name of kademlia tags to avoid confusion of ED2K tags.) + +---------------------- +- June, 5. 2005 - +---------------------- +zz: Print "0" instead of "<0" in Complete sources column in shared files list. + +---------------------- +- June, 2. 2005 - +---------------------- +.: Added support for MediaInfo library versions 0.5.1 and 0.6.0 (http://mediainfo.sourceforge.net) + +---------------------- +- June, 2. 2005 - +---------------------- +.: Added support for previewing encrypted RAR files and RAR files with "solid" compression. + +---------------------- +- June, 1. 2005 - +---------------------- +Unk: All Comment lists auto refresh. +Unk: Added comment icon into sharedfile lists. +Unk: Comments found in search results are carried over into the download list. +Unk: Fixed possibility of accessing a deleted client object in the comment list. +Unk: Can view comments to more then one file at the same time. + +---------------------- +- May, 31. 2005 - +---------------------- +.: Added support for previewing RAR files which contain extended date/time file information. +Unk: Added the ability to view comments (Kad Notes) on search results. (Find out what people think of the file before downloading..) +Unk: Fixed a possible memleak with Kad Notes. + +---------------------- +- May, 28. 2005 - +---------------------- +.: Possible fix for minimize to tray problem reported for Windows NT SP6. +.: Added a startup check for proper version of Windows Shell32 DLL - should also help folks using Windows NT! +Unk: Fixed a lowID bug that caused a lowID user to report the wrong buddy IP/Port. +Unk: Added the ability to view comments (Kad Notes) for your shared files. (Find out what people think of your files..) + +---------------------- +- May, 26. 2005 - +---------------------- +.: Fixed bug where ED2K search results were shown in Kad search results. + +---------------------- +- May, 26. 2005 - +---------------------- +.: Fixed bug with client software statistics where equal client numbers were not shown. + +---------------------- +- May, 23. 2005 - +---------------------- +.: MiniMule shows the nr. of completed downloads currently available in Download list only if 'Autoclear completed downloads' is disabled. If 'Autoclear completed downloads' is enabled, it shows the nr. of completed files in the current session. + +---------------------- +- May, 21. 2005 - +---------------------- +zz: Fixed underflow error for "Shared parts" column in Shared files list, which caused parts to sometimes be shown as light blue even when they are common in the net. + +---------------------- +- May, 19. 2005 - +---------------------- +zz: Bugfix to UploadSpeedSense (USS). Sometimes with low ping times and low Ping Tolerance settings it could get stuck at min speed. +zz: USS now detects when max ul limit is raised in prefs, and goes into "fast reaction mode" for a short while to quickly find out if it can raise the limit. +zz: When using several pings (tweak prefs setting), USS now uses median value instead of average value. This removes some of the randomness in the ping times to better see the trend and give a more stable speed. About 1-8 pings recommended. +zz: Slightly changed colors in "Shared parts" (fka "Obtained parts") column in shared files list: + White = You don't have the part. + Red = You are the only one known to have/share this part. Please don't unshare the file. + Blue = You and others are sharing this part; the lighter blue, the less people sharing it. + Black = You have this part, but its availability in the net is unknown (i.e noone have asked you for this file yet, and you are not downloading it) + +---------------------- +- May, 16. 2005 - +---------------------- +.: Some modifications to avoid disapearing Search Parameters window. +.: Added new functions for PreviewApps.dat file. After the command line several parameters (separted by ';') can be specified: +Ext= (the command will be invoked only for the specified file extension, specify several "Ext" commands for more extensions) +MinSize= (min. completed part file size to enable the preview command) +MinStart= (min. completed part file size from the start of the file to enable the preview command) + +---------------------- +- May, 15. 2005 - +---------------------- +.: Added new tooltips for Transfers window. +.: Fixed bug in ZIP file archive preview for files containing a directory archive entry. + +---------------------- +- May, 11. 2005 - +---------------------- +.: Fixed bug with SetSystemACP setting for fresh eMule installations. +Ornis: filesize limit of fileupload via webinterface can now be set in the preferences.ini, Section [WebServer] : "MaxFileUploadSizeMB=5" (or 0 for no limit) + +---------------------- +- May, 10. 2005 - +---------------------- +.: Fixed wrong dealing with kBit/s and KB/s in several places. +.: Fixed glitches with main statusbar when using large system fonts. +.: Changed: Notifier.ini file is by default searched in eMule config folder. + +---------------------- +- May, 9. 2005 - +---------------------- +.: Fixed bug with dropdown buttons in transfer window for large system fonts. +.: Added missing middle mouse button handling to transfere windows [thx SiRoB] +.: Added .cbz and .cbr file extension to ed2k/kad archive file type and previewable archive types. + +---------------------- +- May, 8. 2005 - +---------------------- +.: Fixed a crash in Message window when right clicking on Close button. +.: Added new macros to webservices: +#name inserts the filename without extension +#cleanname inserts the cleaned up filename without extension +#cleanfilename inserts the cleaned up filename +.: Fixed a problem with registering eD2K links to be taken by eMule. +zz: Improved a4af code to work better for No Needed Part sources. Earlier code could make a source get stuck on a high prio NNP file even if there were other files (with lower prio) that weren't NNP. + +---------------------- +- May, 7. 2005 - +---------------------- +.: Servers with a failure count of >= 2 or with a failure count which exceeds the specified one are shown in gray shades in server list control +.: 'Add Source' dialog and 'Add Friend' dialog: the IP and port optionally can be specified right in the IP control. +Ornis: fixed some bugs in the webinterface ( category change, javascript problems for some languages, speedbar percentage display, + saving timeout from preferences, mixed priority assignment for servers) + +---------------------- +- May, 6. 2005 - +---------------------- +Ornis: show filespecific source limit in downloadlist [] (if modified) and in the filedetails dialog +Ornis: fixed disabled status of the source handling submenu (selection dependend), to allow access to the submenu items + + +v0.46a +---------------------- +- May, 3. 2005 - +---------------------- +.: Added eMail-Notification settings to the GUI, optional encryption still needs to be configured in the preferences.ini +.: Added the setting for alternate toolbar layout in the transferwindow into the preferences dialog +Ornis: fixed removing servers from static list from the webinterface + +---------------------- +- May, 2. 2005 - +---------------------- +.: Fixed a socket resource leak in web interface. +.: Access to web interface can be restricted to a list of specified IP addresses. preferences.ini setting "AllowedIPs=[;]" section "[WebServer]" +Ornis: Renamed "adresses.dat" to "addresses.dat" for automatic serverlist updates on startup. Renaming will be done automatically during startup on this upgrade. + +---------------------- +- May, 1. 2005 - +---------------------- +.: eMule now (optional) remembers files which were cancelled and marks them in the searchresults +.: Remembering downloaded files can be disabled and eMule will purge all unneeded records from known.met and known2.met +.: Fixed a bug which sometimes caused a sharing Violation in known2.met when starting eMule + +---------------------- +- Apr, 28. 2005 - +---------------------- +.: Implemented protocol change for server for getsources (local/udp) suggested by lugdunum + +---------------------- +- Apr, 26. 2005 - +---------------------- +.: Added new drop down buttons in Transfers window to select different view types for main and sub window. +.: Added preferences.ini setting "WinaTransToolbar=1" (section "eMule") to enable an alternate toolbar layout in Transfere window. + +---------------------- +- Apr, 23. 2005 - +---------------------- +.: Fixed: Queue Ranking of sources in Download Listview were not always updated properly. +.: Added some missing protocol overhead stats. +Unk: Couple very small gui changes to the setup wizard and file comment list. + +---------------------- +- Apr, 19. 2005 - +---------------------- +.: Merged the view selector and the downloadingclients view from Mods [TBH] + +---------------------- +- Apr, 17. 2005 - +---------------------- +.: Fixed a bug which made it theortical in some rare cases possible that eMule sent unverified data to other clients +Ornis: fixed not working commands on downloadlist multiselections in certain cases +Ornis: added manual filename cleanup on selected files in the downloadlist by pressing Ctrl+F2 + +---------------------- +- Apr, 13. 2005 - +---------------------- +.: Fixed bug with file comments/ratings when receiving a rating without a comment [thx MogTheCat] +.: Added support for new PeerGuardian IP filter file format v2. +.: To reduce overal network overhead, dead servers are detected faster and not used for UDP sources and file searches until they are deleted. +.: The priority specified in downloaded server.met files is ignored. Server priorities can still be used for the local server list. + +---------------------- +- Apr, 6. 2005 - +---------------------- +.: Sortorder and scrollposition are now saved for every open searchresult when switching between them + + +---------------------- +- Apr, 4. 2005 - +---------------------- +.: Added E-Mail notification for "Download finished" and "Important Error" eMule notifications. Configurable via preferences.ini file section [eMule] + Enable E-Mail notifications with: "NotifierSendMail=1" + Specify SMTP server with: "NotifierMailServer=" + Specify recipient's E-Mail address with: "NotifierMailRecipient=" + Specify sender's E-Mail address with: "NotifierMailSender=" +Optional: Specify certificate to be used for encrypting the e-Mail with S/MIME with: "NotifierMailEncryptCertName=". The certificate is searched in the local 'addressbook' certificate store only. + +---------------------- +- Apr, 1. 2005 - +---------------------- +.: Fixed bug with eD2k link parsing when no filename (or filename with just spaces) was specified in link. +.: Fixed bug with partfile renaming when new filename contains only spaces. + +---------------------- +- Mar, 23. 2005 - +---------------------- +.: Source base is compiled with warning level 4 (and corrected) +.: Kad keyword searching and publishing of short words changed to circumvent some limitations for Asian phrases. +.: Fixed bug in keyword publishing related to filenames ending with too much unpublished characters. +.: Fixed some GUI glitches in Friend listview. +.: Fixed bug which prevented eMule to minimize to system tray. +.: Brushed up Shared Folders context menu in Options/Files. +.: Changed all sound creating functions to not use the PC-speaker in case there is no sound card available. +.: Log files clearly show session start/end messages. +.: Fixed bug with log messages which were not written to log files during early startup. +.: MiniMule shows accurate connection icon. +.: MiniMule shows the nr. of completed downloads currently available in Download list. +.: MiniMule can be properly attached to each edge of the desktop window (depending on taskbar position). +.: MiniMule - fixed problem with eMule installation path containing some special characters. +.: Added optional Text-To-Speech notification. For each generated notification eMule will "read" the log message in the system's default Text-To-Speech engine. +.: Added support GZip compressed IP-filter files. +.: Fixed bug in log panes which could create auto-endless up-scrolling. +.: Fixed bug in log panes which displayed text too far on top if pane was first time enabled. +.: Disabled extracting of MetaData with DirectShow - until a more reliable way is implemented. +.: Experimental: Added a more efficient method to reject TCP connections of filtered and/or banned clients; see Options/Ext. settings +.: All graphs in Statistics window have a different appearance when "StraightWindowStyles=1" is specified in Preferences.ini, section [emule]. +.: Couple of optimizations in drawing the statistics graphs. +.: When closing the Options dialog, the preferences.ini file is saved only if really needed. +.: Searchresult panes: When switching to/from panes with collapsed search entries, the state is properly saved/restored. +.: Couple of optimizations in search result handling. +.: When receiving different file names for a search result, the filename with the highest availability is eventually used for showing the result +.: In ext. user mode only: Search results show nr. of complete sources by percent and accurate number. +.: Fixed bug with not adding all available source found during searching when adding a file via an sub-entry to the download queue. + +---------------------- +- Mar, 14. 2005 - +---------------------- +Ornis: Filename cleanup: dont uppercase character behind apostrophe +Ornis: Fixed wrong file statistics of (previously) stopped files [Xman] +Ornis: Set file based sources limit via downloadlist context menu (when extended controls enabled) + +---------------------- +- Feb, 27. 2005 - +---------------------- +.: Log file format for standard and verbose log files can be set to UTF-8 with preferences.ini setting "LogFileFormat=1" (section "[eMule]"). +.: Added support for new PeerGuardian IP filter file format v1. + +---------------------- +- Feb, 26. 2005 - +---------------------- +.: Fixed bug with too high PeerCache socket timeouts [thx so8so] +zz: Small fix to USS to prevent it from sometimes disabling itself when network connection is lost. Once the first init of USS is complete it should now never disable itself. + +---------------------- +- Feb, 22. 2005 - +---------------------- +.: Fixed issue where bugged compatible clients could receive sources for a file they did not ask for. +.: Fixed bug with Kad-notes which were received but not stored. + +---------------------- +- Feb, 18. 2005 - +---------------------- +Ornis: moving mouse over statisticgraphs and holding down left mousebutton will display a tooltip containing the corresponding date and time at the current mouseposition in the graph (calculated by the CURRENT statistic settings) +Ornis: merged webinterface from eMule+, adapted, did some fixes and added: + - Kad-window + - show comments & ratings + - download of completed files via browser (up to 5MB filesize) + +---------------------- +- Feb, 12. 2005 - +---------------------- +.: Fixed 'Transferred' column data display and sorting in Upload list control. +.: Reworked all dialogs to properly show the '&' characters in filenames. +.: Fixed comment rating label order. +.: Fixed possible misplaced up/down buttons in details dialog. +.: Upgraded to zlib 1.2.2. +.: Experimental: Added Right-to-Left reading support. Enable in Preferencs.ini: Section=[eMule]; Setting=RTLWindowsLayout=1 + + +v0.45b +---------------------- +- Feb, 11rd 2005 - +---------------------- +.: Fixed a bug related to the new kad-filecomments which would cause eMule to freeze [thx gcostanza] +.: Fixed a bug related to the udp-server protocol which could emule let drop packets or if malicious crafted freeze [kry] +.: The downloadwindow now remembers the 4 last sort orders and uses them as secondary sort orders +.: A displaybug in the uploadwindow has been fixed +.: A problem which caused eMule to call the onlinehelp even if an appropriate helpfile was available has been fixed[cml] +Ornis: Fixed lowercased path entries in the shared files list +Ornis: Fixed issue with autoresume after file completion +Ornis: Fixed secure identitfication statistics with a >100% entry + + +eMule 0.45a +---------------------- +- Jan, 25rd 2005 - +---------------------- +Ornis: little updates in the web interface to category items, remember last used category in session, display first results on new search) +Ornis: statistic graphs: added vertical marker for every hour and enlarged statistic update delay [CB mod] +Ornis: added command line argument to reload ipfilter: "emule.exe reloadipf" +Unk: Corrected a issue where the keyword or source index was not restored. +.: Fixed bug with wrong user-id/IP for http sources [thx SiRoB] + +---------------------- +- Jan, 23rd 2005 - +---------------------- +Unk: Fix a possible situation that may cause kad to not store sources. +Unk: Removed some unneeded parameters in the search class. +Unk: Added "Notes" for kad. Currently used to store file comments.. (Will not work until a majority of users upgrade.) +Unk: The time between Kad file source reasks slowly adjusts over time to ease up on overhead and redundant results. (Let the source exchange do it's job..) + +---------------------- +- Jan, 17th 2005 - +---------------------- +Unk: Some general cleanup in some code when Kad thread was integrated to the main thread. +Unk: Fixed Download List sort bug where sources could be displayed with the wrong file. (Fix by KinkyJohn) +Ornis: category view filters more flexible +Ornis: categories can be filtered by regular expressions on the filenames (as view filter) +Ornis: middle mouse click closes tabs (messagewnd, irc, search results) +Ornis: coloring of search results customizable via skin + +---------------------- +- Jan, 16th 2005 - +---------------------- +Unk: The AddOnNextConnect flag we gave to lowID users that missed their uploadslot still didn't work well as the user had to reconnect within a specific window. +- Now that flaged user can reconnect anytime that doesn't violate the protocol and get the upload slot. +- Only one user can have that slot at any given time to avoid the uploadlist from getting out of hand just in case more then one lowID user got flaged. +- Once a user is removed from the upload list, this slot is available again. +Unk: Relaxed the conditions for users to enter the upload queue of a lowID client. +- We still monitor for users on the upload list that try to get around the lowID callback limits through servers. +- We do not monitor Kad users on the upload list as the callbacks are all currently valid. +Ornis: automatic category assignment can now also be done by regular expression rules +.: Navigation in the file detail- and client detail dialog: up/down buttons allow scrolling through the items within the current list + +---------------------- +- Jan, 14th 2005 - +---------------------- +.: Fixed bug with Unicode passwords in Web-interface and MobileMule-interface. Note: Your need to specify new passwords for those interfaces. + +---------------------- +- Jan, 9th 2005 - +---------------------- +.: Added new setting in preferences.ini (Section=[eMule], Keyword=PreviewOnIconDblClk, Value=1) to invoke preview command when double clicking on file icon in download list. This setting is used only if "Downloadlist doubleclick to expand" (in Options/Display) is disabled. +Unk: We now use load balancing on publishes. If we publish a keyword to a section of network that has a high load, we increase delay for the next republish time. These times are also carried between restarts of the client. +Unk: Reworked the loop that rechecks what keywords to publish to reduce cpu load. + +---------------------- +- Dec, 31th 2004 - +---------------------- +bluecow: Changed: Amount of uploaded/downloaded data to/from a client shows the raw (compressed) data size (which is also used for credits). +bluecow: Fixed sorting bug in upload list control. +bluecow: Changed: Maximum supported file size is 4290048000 bytes. + +---------------------- +- Dec, 30th 2004 - +---------------------- +bluecow: Fixed bug in client statistics for banned and IP-filtered clients. +bluecow: Fixed crash with sending a message to an new added friend [thx Libbnor] +bluecow: Fixed bug with wrong hashset creation in case file could not successfully read (may indeed happen with NTFS compressed files with very high compression!?) +bluecow: Fixed bug with files of too large size when added via search results. + +---------------------- +- Dec, 29th 2004 - +---------------------- +bluecow: Added 'Extract Meta Data' setting to enhanced options dialog. +Unk: Fixed a bug in SMIRC if CHANMODES was missing from the welcome message. + +---------------------- +- Dec, 27th 2004 - +---------------------- +Unk: Ping/Pong system added for buddies to prevent stalled buddy connections. +Unk: Fixed a couple bugs in the hello packets for buddy information. +- If your firewalled and you have sources that are also in your queue, they will be able to more easily follow you if you change buddies. +- Only firewalled users with a buddy will send the buddy info to lower overhead. + +---------------------- +- Dec, 26th 2004 - +---------------------- +bluecow: Added default creation of 'skins' subdirectory in eMule application folder which will be used as default directory for eMule Skins and Toolbar bitmaps. + + -enabled Japanese translation, which was updated by DukeDog + +---------------------- +- Dec, 24th 2004 - +---------------------- +bluecow: Added Windows Internet Security Manager for external loaded HTML files. +- Internet Security Zone policies are taken from Windows Internet Settings System Applet (same settings as used by Internet Explorer). +- Default Internet Security Zone used by eMule is set to highest level: "Untrusted Zone" +- Internet Security Zone can be changed in preferences.ini file: Section=[eMule], Keyword=InternetSecurityZone, Values=Untrusted|Internet|Intranet|Trusted|LocalMachine +bluecow: Added sorting of context menu entries for toolbar bitmaps and skin profiles. +bluecow: Shared files which have a user comment and/or user rating attached are displayed with a small additional overlay icon in Shared Files window. +bluecow: Added icons for network share information column in Shared Files window. +bluecow: Fixed some GUI glitches [thx apph] +bluecow: Fixed some bugs with statistics colors in Options/Statistics page. +bluecow: Added some double-click shortcuts: +- Server window: Double-click on Server list icon opens Options/Server page. +- Shared Files window: Double-click on Shared Files list icon opens Options/Directories page. +- Messages window: Double-click on Friends list icon opens Options/Files page. +- Statistics window: Double-click on any graph opens Options/Statistics page. + +---------------------- +- Dec, 22th 2004 - +---------------------- +bluecow: Fixed bug with status.log file which truncated filenames to 50 chars. + +---------------------- +- Dec, 21st 2004 - +---------------------- +zz: Improvements to download throttler to lower amount of timed out/failed download sessions. + +---------------------- +- Dec, 19th 2004 - +---------------------- +bluecow: Fixed Unicode bug with ed2k links added via web interface. +bluecow: Fixed bug with file priority in web interface [thx CML] +bluecow: Added Unicode search parameter to web interface [thx CML] +bluecow: Local hostname (if specified in ext. settings) is used for web interface URL shown in MyInfo. +Unk: Force a node lookup when it appears Kad may be disconnected to verify if we are really disconnected. +Unk: Firewalled Kad users will instantly look for a new buddy when it loses it's current buddy instead of waiting for next firewall check. +Unk: Firewalled users will republish it's sources if they changed buddies. +Unk: If something happens and a Kad Buddy lookup fails, it will continue to retry the lookup until successful. + +---------------------- +- Dec, 13th 2004 - +---------------------- +Unk: Changed the Kad search list to show info clearer and to add the Node Load column. +Unk: Fixed a bug that could access a NULL kad buddy pointer. +bluecow: Fixed crash with system tray context menu, opened preferences dialog and restored main window. +bluecow: Fixed bug: Shared directory names with Unicode characters were ignored at startup. +bluecow: File format of "shareddir.dat" and "adresses.dat" changed to Unicode. Old (ANSI) files are read and converted to Unicode automatically at startup. Previous (ANSI) eMule versions can not read those files any longer. +Unk: Fixed a bug that prevented lowID clients from publishing as a source into the Kad network. + +---------------------- +- Dec, 12th 2004 - +---------------------- +bluecow: Added startup check for proper version of COMCTL32.DLL. +bluecow: Merged debug dump build into release build. To enable crash dump generation, specify "CreateCrashDump=1" in "eMule" section of preferences.ini file. + +---------------------- +- Dec, 9th 2004 - +---------------------- +bluecow: All packets received from eD2K servers can contain Unicode strings. (Server admins can announce their server's description in Unicode). +bluecow: Added new Mini eMule window with basic stats and functions. Single click in eMule System Tray icon to open it. +- Mini eMule window can be customized with HTML template (see Template.eMuleSkin.ini for details). +- Mini eMule window can be disabled with following setting in preferences.ini file (section "[eMule]") setting: "MiniMule=0". (read only on startup) +- Mini eMule window can be customized with following settings in preferences.ini file (section "[eMule]"). Those settings can be modified during eMule is running (no need to restart). +- Setting: "MiniMuleAutoClose=1" Mini eMule window will automatically close itself if mouse cursor is not located within the window (similar to a tooltip). +- Setting: "MiniMuleTransparency=<0-100>" Transparency (in percent) of Mini eMule window. + +---------------------- +- Dec, 4th 2004 - +---------------------- +bluecow: Reworked 'Startup Minimized' and main window restoring after startup to avoid some window redrawing problems. + +---------------------- +- Nov, 21th 2004 - +---------------------- +bluecow: Fixed sorting bug in download list with "Time Remaining". + +---------------------- +- Nov, 17th 2004 - +---------------------- +bluecow: Reworked eMule Main toolbar: +- Added chevron support: If toolbar is too small to display all buttons a chevron (">>" icon) is shown at the very right side which opens a menu with the remaining button commands. +- Tooltips are shown for truncated button titles and in "No Labels" mode of toolbar. +- Buttons can be moved and/or removed from the toolbar by holding down Ctrl+Alt key while draging a button with the mouse. +- Buttons can be set to large or small. +- Button sizes more similar to Windows Explorer. +- All new toolbar features can be disabled with "ReBarToolbar=0" setting in preferences.ini. +- Toolbar background can be customized with skin profile (see Template.eMuleSkin.ini file) +bluecow: Fixed bug with vertical oriented fonts in Statistics window. + +---------------------- +- Nov, 16th 2004 - +---------------------- +bluecow: Preferences.ini setting ShowCopyEd2kLinkCmd=1 replaces "Show eD2K Links" command with "Copy eD2K Links" +bluecow: Fixed GUI glitches with context menus in Log-, Message- and IRC panes. + +---------------------- +- Nov, 14th 2004 - +---------------------- +bluecow: Searching in eD2K and Kad is now defaulted to use Unicode search expressions. +bluecow: File comments dialog in Shared Files window can be invoked for multiple files. +bluecow: Fixed not working buttons in Message window. +.: Icons in contextmenus have been disabled for Win98/ME due to reported problems +.: Minor bugfix in the new corruption detector + +v0.44c +---------------------- +- Nov, 8th 2004 - +---------------------- +.: eMule is now able to detect which clients sent corrupt data and bans those if a threshold is reached (based on AICH) + +---------------------- +- Nov, 1st 2004 - +---------------------- +bluecow: Fixed counter overflows for some cumulative statistics. [thx BinGordon] +bluecow: Fixed bug with max. download rate. [thx ChrisV] +bluecow: Fixed bug with "Needed Spaced for Downloads" stats for NTFS compressed and sparse files. +bluecow: Brushed up preferences dialog. + +---------------------- +- Oct, 15th 2004 - +---------------------- +.: Added icons to most contextmenus [thanks Daan for providing the icons] +.: Fixed a unicode bug in the MobileMule server +Ornis: added commands (show details and add as friend) to the contextmenu for tabs in the chatwindow + +---------------------- +- Oct, 14th 2004 - +---------------------- +Ornis: view filer now available for all category tabs + +---------------------- +- Oct, 10th 2004 - +---------------------- +Ornis: imported part files will be shared immediately if possible + +---------------------- +- Sep, 28th 2004 - +---------------------- +bluecow: Fixed memory leaks, exception handling and tag list reading of Kad tags. + +---------------------- +- Sep, 26th 2004 - +---------------------- +bluecow: Fixed bug in some log panes which were not obeying the max. log buffer limit. +bluecow: Added support for NTFS sparse files for new created part files. + +---------------------- +- Sep, 25th 2004 - +---------------------- +bluecow: Fixed bug in client download data rate computation [thx Aw3] +bluecow: Optimized MD4 and SHA1 hashing code to a total increase of hashing performance by 50% [thx Camper(Shareaza)] + +---------------------- +- Sep, 24th 2004 - +---------------------- +bluecow: Fixed default font selection for some GUI elements for locales with multibyte character fonts. + +---------------------- +- Sep, 20th 2004 - +---------------------- +bluecow: Reawakening of search parameters restoring. Double-Click or Ctrl+Click on Search Result tab to restore all parameters used for that particular search. +bluecow: All eMule*.log files are stored in .\logs directory. Already existing log files are automatically moved there. +bluecow: Fixed duplicate scroll bar problem in search dialog for low screen resolutions. + +---------------------- +- Sep, 19th 2004 - +---------------------- +bluecow: Fixed bug with queued thread log messages which could lead to a crash in some cases. +bluecow: Fixed Unicode bug in Statistics HTML file export function. +bluecow: Added:Errors/Warnings/Success messages are shown in log panes with dedicated colors. +bluecow: Reworked ID3 tag reading code for Media Info dialog to show more proper information. + +---------------------- +- Sep, 15th 2004 - +---------------------- +bluecow: Added tooltip for "Connected" pane in status bar which shows the currently connected eD2K server and server users. + + +v0.44b +---------------------- +- Sep, 10th 2004 - +---------------------- +bluecow: Fixed Unicode (Win9x) bug with wrong displayed free disk space. +bluecow: Fixed Unicode (Win9x) bug with not working shared directories control. +bluecow: Fixed Unicode bug with missing UTF8 conversion in web interface. +bluecow: Added 7-zip file extension to known archive types for publishing and searching files. +bluecow: Fixed Unicode bug in main toolbar initialiation which could cause not working shortcuts. +bluecow: Fixed Unicode (Win9x) issue with copying ed2k links to clipboard. +bluecow: Workaround for an obvious bug in Windows DNS library which returned invalid data. +bluecow: Fixed a bug which could cause resumed files (due to less disk space) get paused again immediatly. +bluecow: Added option to specify whether the system code page shall be used to non-Unicode string conversions (SetSystemACP=1). This is only for backward compatibility for users which specified a different codepage for non-Unicode applications. It is not recommended to use this option without having a very special reason to do so. +bluecow: Added automatic detection of system code and current codepage when eMule is started the 1st time (semi-automatic setting of SetSystemACP=1). +bluecow: Fixed Unicode (Win9x) bug with empty IP filter listview control. +bluecow: Fixed Unicode (Win9x) bug with missing tooltips in download listview control. +.: Fixed the "Run As Secure User" function +.: Fixed a "Runtime Error"-crash which could appear when Kad is enabled +.: Fixed handling of corrupt known2.met files +.: Fixed a bug which let eMule temporary assume a wrong AICH hash for a partfile which was rehashed after startup +.: Fixed some potential problems with reading media info from files + +---------------------- +- Sep, 9th 2004 - +---------------------- +bluecow: Fixed divide by zero bug in Kad contact histogram +zz, bluecow: Fixed UploadSpeedSense UDP pinger. +zz: Fixed alphabetical sortorder for resume next file. +Unk: The delay in creating upload slots can cause the credit system upload method to remove too many upload slots.. (fixed) + +---------------------- +- Sep, 8th 2004 - +---------------------- +Unk: Fixed a possible memleak bug I added in 44a with a bad Kad Tag. +bluecow: Fixed memleaks in PC finder and frame grab threads. +bluecow: Added AspectRatio property to Media Info dialog. +bluecow: Added verification whether file extension of downloaded/shared files matches the file format (only used with MediaInfo library installed -- see also, older change log entries according MediaInfo Lib). +bluecow: Added new preferences setting 'InspectAllFileTypes=1', currently used only in MediaInfo dialog to determine the file format of downloading/shared files by evaluating the headers (most usefull when MediaInfo Lib is installed). +bluecow: Fixed bugs in Video Preview and Archive Preview threads related to wrong file pointer usage which could create wrong temporary files for previewing (in rare situations). +bluecow: Added new preferences setting 'PreviewCopiedArchives=0' to use an alternate method for previewing archive files (faster, uses less disk space on temporary folder drive). +bluecow: Added new preferences setting 'ShowActiveDownloadsBold=1'. Active downloading files and uploading sources are shown in bold font in Transfere window. +bluecow: Changed: server.met and ipfilter.dat URLs are added to auto-completion lists even the download failed to not loose the entered URLs. +bluecow: Added: When selecting multiple servers in servers list control, a tooltip is shown with summarized stats of selected servers. +bluecow: Added: When selecting multiple search results, a tooltip is shown with shows the summarized file sizes of the selected files. +bluecow: Fixed Unicode bug with manually saved log files. +bluecow: Fixed Unicode bug with "?" character in file comments dialog. +bluecow: Fixed Unicode bug with ANSI log files which were continued in Unicode. + +---------------------- +- Sep, 3rd 2004 - +---------------------- +Unk: Change in the source Index so it only sends the most recent entries.. + +v0.44a +---------------------- +- Sep, 2nd 2004 - +---------------------- +Unk: Kad now remembers Kad's last open/firewall state during the recheck process to prevent temporary false reports. +Unk: It now takes two consecutive matching IP responses for Kad to change your current known IP to help filter bad responses. +.: Updated MobileMule protocol to 0.9a (bugfix) +.: Fixed a bug which could lead to a wrong status of obtained parts for downloading clients + +---------------------- +- Sep, 1th 2004 - +---------------------- +.: Added new Dialogpage for creating ED2K Links with of shared and downloading files (replaces old context menue entries) +.: Update ligpng to 1.2.6 to fix security issues (which however had only minor influence on eMule) +.: IP Filter is now also used to ignore filtered incoming UDP packets +.: Added a preference option to choose between simple (prio 0.43) or adanced calculation of the remaining time for downloading files +.: Introduced additional new hashsystem (AICH Hashs) which will reduce the average amount of dataloss when a part is corrupted from + 4.64MB (with ICH) to 180KB. The system is most effective when using links with attached AICH hash, which eMule can now also create + Please refer check the helpfiles/onlinehelp for more information about this new feature. + IMPORTANT: Due to the additional hash algorithm, eMule has to rehash all your shared files - this is a one-time thing, which can't be avoided. + + +---------------------- +- Aug, 26th 2004 - +---------------------- +Unk: Attempt at a estimate file count in Kad. + +---------------------- +- Aug, 23rd 2004 - +---------------------- +Unk: Fixed potential memleak in a upload client. +Unk: Changed how we estimate Kad users. + +---------------------- +- Aug, 22nd 2004 - +---------------------- +Unk: Changed method of deleting Kad Contacts. Contact list should stay more up to date. +Unk: We do not save all Kad contacts on exit. Save a sample of up to 200 contacts to help lower to amount of pinging to dead contacts. +Unk: Changed it so all displayed transfering values goes through one method to try to standardize them. + +---------------------- +- Aug, 21st 2004 - +---------------------- +Unk: Added an option to manually add a source. +Unk: If Kad has seen no incoming traffic for a set time, it's assumed you lost your connection and will auto disconnect. +Unk: Fixed a bug that sends many Kad Bootstrap packets when not needed. +Unk: Some maintance with the Kad code.. (Removing some unneeded code, switching the log events to eMules, ect.) + +---------------------- +- Aug, 20th 2004 - +---------------------- +Unk: Adjusted the estimated time remaining again to hopefully get it more stable. +.: Reworked handling of dead sources (avoids that sources which are known to be unreachable are asked again within a certain time period) + +---------------------- +- Aug, 19th 2004 - +---------------------- +Unk: Added a option to auto start eMule when starting windows.. +Unk: Fixed a bug in TryToConnect that at times could check the wrong IP/ID with the IP filter.. +Unk: Added to the statistics how many known clients are connected to ED2K and/or Kad. + +---------------------- +- Aug, 18th 2004 - +---------------------- +Unk: We now keep track of Half Open sockets and limit new connection if Half Open sockets are too high. (If approved and kept in, it should help with SP2 and some nick cards and routers..) +Unk: We no longer allow a socket pending Connect to time out until OnConnect is called. ( If approved and kept in, it should help with SP2 and lost sources..) +Unk: Added to the statistics how many sources are connected to ED2K and/or Kad. +Unk: Added to the client details if the user is connected to Kad. +Unk: Removed warnings about Kad being beta. + +---------------------- +- Aug, 15th 2004 - +---------------------- +Unk: First phase in adding firewall user support for Kad. This support will not work well until most users upgrade within the Kad network.. + +---------------------- +- Aug, 9th 2004 - +---------------------- +Unk: Increased time between keyword publishes to reduce overall Kad overhead. +Unk: Fixed possible memleak if an incoming Kad publish failed. +Unk: Put some limits on how many keywords you index. +1) Global keyword limit.. (You never index more than this) +2) Local keyword limit. If your indexing one VERY popular index, it will be limited to allow less popular indexes to be stored. +3) Now if you happen to be one of the "lucky" ones that indexes a very popular node, your client will not freeze up trying to keep up. + +---------------------- +- Aug, 8th 2004 - +---------------------- +zz: Resume next now uses a4af order: Alphabetical order if enabled for a category, cat-prios, file-prios etc. If you select "Resume next" in a category popup menu, it will only resume a file in that category; none if no file is paused in that category. + +---------------------- +- Aug, 5th 2004 - +---------------------- +zz: UploadSpeedSense min limit is now allowed to be lower than 10 KB/s (default is 1 KB/s). Please note that when UploadSpeedSense lowers the speed below 10 KB/s, the ratio download limiter will dynamically kick in until the speed goes over 10 KB/s again. + +---------------------- +- Aug, 4th 2004 - +---------------------- +zz: improved No Needed Parts a4af management. Will now occasionally reask lower prio nnp files on a source, if all files are nnp on that file. This will prevent it from remaining on the highest prio file when it's nnp and lower prio files has stopped being nnp since last checked. + +---------------------- +- Aug, 1st 2004 - +---------------------- +bluecow: Fixed client version statistics. + +---------------------- +- Jul, 31st 2004 - +---------------------- +Unk: Fix a upload bug that caused uploads to stop sending after a complete chunk with a small queue. This should fix some issues with lost Friend Slots. +Unk: Did some merging from some Mods.. +1) IRC gui updated. +2) Message gui updated. +3) Statistics gui updated. + +---------------------- +- Jul, 26th 2004 - +---------------------- +bluecow: Sorting of strings in UI is locale dependant (very similar to sorting order of Windows Explorer) +Ornis:fixed a bug on processing the downloadlist in the webinterface + +---------------------- +- Jul, 24th 2004 - +---------------------- +bluecow: Added 'Network Info' dialog. Double click on connection icon in statusbar to open it. +bluecow: Fixed some minor bugs in file comments/ratings processing and GUI. +bluecow: Download listview shows system file icons for part files. + +---------------------- +- Jul, 20th 2004 - +---------------------- +bluecow: Fixed bug with servers which when added via ed2k link were set to low priority. +Ornis:on regular intervals, avoid recreating the same systrayicon as before +Ornis:Ctrl+V inserts ed2k-filelinks from the clipboard to the download + +---------------------- +- Jul, 17th 2004 - +---------------------- +bluecow: Added Kad contact histogram control. +Ornis: added port-checker. Integrated into the first-start-wizard and the connection preferences, you can start a port test. A webscript will check your eMule and display results and hints on your browser. +Ornis: TCP and UDP Port can be changed during the runtime of eMule, if no server or kad connection is established an no client has been connected yet. + +---------------------- +- Jul, 16th 2004 - +---------------------- +zz: Fixed USS bug to make it survive rare occasions when no earlier ttls is pingable than the differing ttl is found. +zz: Fixed bug that didn't resume/pause/stop all files in a category when context message for a category is used. + +---------------------- +- Jul, 12th 2004 - +---------------------- +zz: Prevent client that doesn't currently have an upload slot from successfully adding blocks to their request queue. This prevents us from sending these blocks when the client then receives an upload slot. + +---------------------- +- Jul, 7th 2004 - +---------------------- +zz: Small fix to make eMule request sources for files in the same order as the a4af priority (a4af auto, cat prio, file prio, alpha). +zz: Show which upload slots are in standby, with status text and graying them out. + +---------------------- +- Jul, 6th 2004 - +---------------------- +zz: Soft queue limit at whatever entered in preferences. Hard queue limit 25% higher. When soft limit is reached, eMule only allow high credit clients, or clients that want high prio files, to get on queue. +unk: Fixed an priority bug that cause lower priority files overseed high priority files. Also hopefully lowered some cpu cycles with this change. + +---------------------- +- Jul, 5th 2004 - +---------------------- +zz: "Try to get preview parts first" selectable on individual files if "Try to get preview parts first" is disabled in preferences. Please note that "Advanced mode controls" (tweak prefs) needs to be enabled for this menu option to show up. + +---------------------- +- Jul, 3rd 2004 - +---------------------- +bluecow: Statistics in Shared Files window show a summary of all selected files. + + +v0.43b - Hotfix +---------------------- +- Jul, 5th 2004 - +---------------------- +.: Fixed a bug which let eMule reject most available PeerCaches +Ornis:Statistics (requests,accepted requests,transfered) of partfiles are now saved and restored too (like for shared files) +zz: Opens less slots if UploadSpeedSense lowers upload limit + + +v0.43a +---------------------- +- Jun, 28th 2004 - +---------------------- +bluecow/. : eMule now supports PeerCache, a technology which allows ISPs to reduce the bandwidth usage by caching instead of throttling the downloadspeed +Unk: Option to block people from adding you as a friend through SMIRC. +Ornis: Option to auto resume paused downloads only for same category as a completed download (additional to option of prefering same category) +Ornis: Dont show "new message" loginfo for filtered messages +bluecow: eMule is entering defcon level 3.. +*) TCP connection attempts from filtered IPs are refused right at TCP protocol level. +*) TCP connection attempts from banned clients are refused at TCP protocol level. +*) LowID callback requests from servers are dropped if IP is filtered or banned. +*) Received sources (servers, source exchange) are filtered to drop already banned clients. +*) All UDP packets from banned clients are ignored. +*) Extra safety code to prevent connecting to an IP filtered IP or banned client. + +---------------------- +- Jun, 25th 2004 - +---------------------- +.: eMule can open the ports it needs on the internal WinXP(SP1 or 0) firewall itself either permanently (connection pref) or on each startup (extended settings) + +---------------------- +- Jun, 20th 2004 - +---------------------- +zz: Possible fix to the reported cases when eMule doesn't reach the upload limit. +bluecow: Added some protocol procedure sanity checks to avoid getting flooded by bugged clients. +bluecow: Fixed a flaw in the IP filter which lead to not reading some lines from PeerGuardian filter lists which had a bad format. + +---------------------- +- Jun, 15th 2004 - +---------------------- +bluecow: Added new context menu item in Shared Files window (only for completed 'eMuleSkin.zip' files) to install eMule Skins. +zz: Changed upload bandwidth throttler to minimize the number of ACK packets. + +---------------------- +- Jun, 13th 2004 - +---------------------- +zz: Some changes to speed up UploadSpeedSense preparing phase, when a ttl doesn't respond to pings. Also changed the upload limit during preparing phase to 2 KB/s instead of 512 bytes/s to prevent kademlia from getting false "firewalled" status. +zz: Changed the equal-for-all implementation in upload bandwidth throttler to minimize packet fragmentation on tcp level. + +---------------------- +- Jun, 12th 2004 - +---------------------- +bluecow: Reworked the 'charset' selection for emule web interface to use proper codepage value in returned HTML code. +bluecow: Reworked searching via web interface in relation to file type search parameter. (New web templates!) + +---------------------- +- Jun, 10th 2004 - +---------------------- +bluecow: Changed option to remove dead servers: Any server which exceeds a max. failure limit is removed from server list. +bluecow: Added "Document" file type for published files and also to search parameter for eD2K and Kad. +Ornis: Splitted statistics to be stored in "Statistics.ini" + +---------------------- +- Jun, 9th 2004 - +---------------------- +bluecow: Many small fixes for changing language during runtime. + +---------------------- +- Jun, 6th 2004 - +---------------------- +zz: Improved a4af manager. Set the file you want first to "high" download priority (priorities now effects a4af decisions). You can chose to get the files in a category in their alphabetical order. A source may be (automatically) swapped to another file to enable source exchange on that file. Respects reask times in all cases, so it may take a while before sources are moved (but this change prevents banning due to a4af actions). + +---------------------- +- Jun, 3nd 2004 - +---------------------- +bluecow: Added unzipping of IP filter files from PeerGuardian ZIP files. + +---------------------- +- Jun, 2nd 2004 - +---------------------- +Unk: Completely reworked the gui structure for SMIRC. +Unk: SMIRC will now get available channel modes from the server on connect. +Unk: You can now set/unset TypeD channel modes.. You can also unset TypeC channel modes. (More support may be added later) + +---------------------- +- Jun, 1st 2004 - +---------------------- +bluecow: Reworked IP Filter tool window to support large IP filter lists more effeciently. +bluecow: Added progress information for part files when getting hashed or copied to incoming folder. +bluecow: Added color customization (via skin profile) for server info, log, chat and IRC windows. +.: Added loglevels for verbose output in order to allow showing only important messages +.: Fixed a bug which caused that some known contacts were never deleted, even if not needed anymore +.: Complete sources are now shown as percentage in a new column. If there are zero complete sources for a file, this colum is marked red + +---------------------- +- May, 31st 2004 - +---------------------- +Unk: SMIRC will now get available user modes from the server on connect to allow it to use servers that use non standard usermodes. +Unk: SMIRC Now creates a dynamic nick menu showing which Op commands are available based on the user you click and user modes available. +Unk: SMIRC can now handle an nicklist from the server that contains ALL usermodes not just the major mode. +Unk: SMIRC is now able to detect what type of MODE change was done so it can handle/display it correctly. + +---------------------- +- May, 27th 2004 - +---------------------- +bluecow: Fixed bug with inaccurate completed size for part files. +bluecow: Couple of minor bug fixes and optimisations in bar shader related usage for part files and downloading/uploading clients. +bluecow: Fixed bug which sometimes draws randomly yellow blocks for sources. +Ornis: Category-wide resume will now also care for out-of-diskspace-paused downloads + +---------------------- +- May, 26th 2004 - +---------------------- +bluecow: Fixed bug with specifying empty directories for incoming and temp folders. +bluecow: Added server LowID statistics to Server and Statistics window. +bluecow: Added stats for showing amount of data saved by I.C.H. +bluecow: Added saving/restoring of corrupted part list to part.met files so that I.C.H. can work on those parts even after eMule was restarted. + +---------------------- +- May, 23th 2004 - +---------------------- +bluecow: Fixed potential crash bug under Win98 with helper icon in search parameters window. +bluecow: Fixed bug with wrong part count for very large files. [thx Pichuein] +bluecow: Fixed bug in Directory preferences dialog which changed the active directory. +Ornis: Fixed a bug in the toolbar button code, when all buttons were removed +Ornis: (possibly) fixed the issue of misplaced category tabs (couldnt reproduce it at all, for testing) +Ornis: Fixed webinterface exploit (content length misuse) + +---------------------- +- May, 19th 2004 - +---------------------- +bluecow: Added context menu command for creating eD2K links with hashsets to Shared Files window. + +---------------------- +- May, 14th 2004 - +---------------------- +bluecow: Fixed data rate control for rates > 80kb [thx zz] + +---------------------- +- May, 13th 2004 - +---------------------- +bluecow: Properly completing and sharing of files when no hashset is available. +bluecow: Files without hashsets are no longer shared until they are completed or a hashset was received. +bluecow: Added support for HTTP redirection for websources. +bluecow: Added icons for websources in transfer window. +bluecow: Added a setting to preferences.ini (Section "Statistics", Keyword "SaveInterval") to specify the time interval in seconds for saving statistics. Default value is 60 sec. +Ornis: title tags for images in Webinterface template "chicane" [mARKUS] + +---------------------- +- May, 12th 2004 - +---------------------- +bluecow: Added pasting of extended eD2K links for http:// sources and hashsets. +bluecow: Added downloading from http:// sources. + +---------------------- +- May, 11th 2004 - +---------------------- +Unk: Rewrote most of the core of SMIRC to make it more stable and faster.. +Unk: I now read the entire receive buffer in SMIRC's socket on each receive. Messages were getting left in the buffer and backlog'd.. +Unk: SMIRC connection status could get a little messed up and not tell the user it failed to connect. (fix) +Unk: Added a simple nick completer to SMIRC. +Unk: Updated zz's USS and throttler.. With some modifications.. (I'm commiting this because I know blue wants to merge, this is still a work in progress..) + +---------------------- +- May, 10th 2004 - +---------------------- +bluecow: Fixed crash with downloading of several files with same filename and reloading the shared files list. +bluecow: Optimized periodically stats file writing. + +---------------------- +- May, 4th 2004 - +---------------------- +bluecow: Added filehash evaluation for completed part files when hashset is missing. +bluecow: Fixed bug with duplicate scrollbars in search window. +bluecow: Kad search expression parsing: The Kad keyword is now part of the ed2k search expression to support " " expressions. + +---------------------- +- May, 3rd 2004 - +---------------------- +bluecow: Fixed bug with receiving of new ed2k meta tags which used a too large tag type range for string types. +bluecow: Removed auto restoring of search parameters when a search results tab is selected and/or closed. +bluecow: Reworked saving of onlinesig.dat to provide better support for other applications which are reading that file concurrently. +bluecow: Changed all file shareing modes (at OS level only) to allow read only access by other applications. +bluecow: eD2K and Kad searches are shown as still active or stopped with an appropriate icon in the search results list. +bluecow: Inactive search results panes show new received search results with red colored text in tab control. + + +v0.42f +---------------------- +- May, 1st 2004 - +---------------------- +bluecow: Added file error handling for writing of onlinesig.dat file. +.: Fixed a bug which could cause a too fast queue rotation when not using the option "try to upload full chunks" for uploading + +---------------------- +- April 30th, 2004 - +---------------------- +bluecow: Fixed bug in Kad tag name string compare which was dependent to locales with multi byte character pages. [thx Big Mamma] +bluecow: Fixed bug with general string compares which were dependent on locale. (Note: Depending on your locale, you may experience somewhat different sorting orders for strings.) +Ornis: Fixed issue of jumping category tooltips +Ornis: Added 2 more statistics to category tooltips + +---------------------- +- April 29th, 2004 - +---------------------- +Unk: If a client doesn't respond to udp packets after a few times, we force only tcp connections. +Unk: Increased the maximum number of upload slots to accomidate high rate connections. + +---------------------- +- April 24th, 2004 - +---------------------- +bluecow: Added context menu to closeable tab control in Search Results, Message and IRC Chat windows to have another way to closeing the tabs. +Unk: Changed several areas of the code to help with *.*.*.0 clients that is labeled a lowID in the ed2k network. +Unk: If you reconnect to a server, all your shares would not get published unless something in your share list changed..(fixed) (thanks lugdunummaster) +Unk: Fixed a bug that allowed you to do a more command in search to the wrong search window. + +---------------------- +- April 22th, 2004 - +---------------------- +.: eMule is now able to drop privileges and run on a secure user account on Win 2k/XP, when started as administrator (can be enabled in preferences -> security) +.: Updated MobileMule protocol to 0.8a +Unk: Kad user estimate is no longer based on Overnet's user count as the numbers appear to be to high.. (Numbers may still look to high for some users, will try to improve this as we go..) +Unk: Although I couldn't reproduce the double text bug in the IRC, I changed a couple things that may be the cause. (Seems some still get the bug) + +---------------------- +- April 21th, 2004 - +---------------------- +bluecow: Fixed another crash bug with renaming of completed files in transfere window. +bluecow: Several changes in client statistics: detailed aMule version stats, added lphant client detection, cDonkey moved to eMule Compatible and more... +bluecow: Added searching for eD2K file hashs on eD2K servers. To search for a file hash, either enter "ed2k::" or the complete ed2k link. [thx lugdunum] +bluecow: Numeric search parameters are checked for reasonable values to avoid invalid search expressions. + +---------------------- +- April 20th, 2004 - +---------------------- +bluecow: Fixed bug in global server searches which could send endless name queries in some rare situations. [thx lugdunum] +bluecow: Completed shared files which are deleted from Shared Files window are also removed from Transfer window. +bluecow: Added download statistics for UDP file reask. + +---------------------- +- April 19th, 2004 - +---------------------- +bluecow: Fixed bugs with "Last Reception Time" and DST fix. + +---------------------- +- April 15th, 2004 - +---------------------- +bluecow: Fixed crash bug with renaming of completed files in transfere window. +bluecow: Fixed small bug with AutoTakeEd2kLinks. +Ornis: added category selector to the ed2k-box + +---------------------- +- April 14th, 2004 - +---------------------- +bluecow: Fixed a window resizing crash bug in Message window. +bluecow: Client chat and IRC chat messages are limited to 450 characters. + +---------------------- +- April 13th, 2004 - +---------------------- +bluecow: Disabled extracting meta data from OGM/OGG files due to many bug reports about problems with according DirectShow filters. +Unk: IRC names accept uppercase again. +Unk: Kad Publishes now stop in real time to avoid some overhead. + +---------------------- +- April 11th, 2004 - +---------------------- +bluecow: Added capability to publish files on ed2k servers with new meta data tags. [thx lugdunum] +bluecow: Fixed bug with error message boxes which could show up due to a remote search invocation. +Ornis: some minor GUI addons & corrections + +---------------------- +- April 10th, 2004 - +---------------------- +bluecow: Added capability to parse new ed2k meta data tags. [thx lugdunum] + +---------------------- +- April 9th, 2004 - +---------------------- +bluecow: Added docking/floating search parameters window to search dialog. + +---------------------- +- April 7th, 2004 - +---------------------- +bluecow: More safety in parsing of new OP_SERVER_DESC_RES server packets. +bluecow: Proper parsing of unused eD2K meta data tag types. +bluecow: Fixed memory leak with known files entries and invalid hashsets in general [thx bzubzu.] + +---------------------- +- April 6th, 2004 - +---------------------- +bluecow: Fixed sorting bugs in Known Client listview control. +bluecow: Removed syntax coloring from search expression control (caused too much trouble for some languages). +Ornis: fixed search for webinterface + +---------------------- +- April 3nd, 2004 - +---------------------- +bluecow: Added Ctrl+C keyboard shortcuts in all list views for copying eD2K links to clipboard. +bluecow: Added Ctrl+V keyboard shortcut for pasting servers from clipboard to server list view. +Unk: For waiting files, an remaining time will be estimated, based on previous idle time and downloaded data. (Note: Files started with some mods or older clients may give strange relults) + +---------------------- +- April 2nd, 2004 - +---------------------- +bluecow: Removed Jigle search methods. +bluecow: Added context sensitive help. + +v0.42e +---------------------- +- April 1st, 2004 - +---------------------- +Ornis: reduced javascript dependence on webinterface templates + +---------------------- +- Mar 31th, 2004 - +---------------------- +bluecow: Added Paste command for ed2k file/server links to Transfer and Server window context menus. +bluecow: Fixed memory leak in Kad packet parsing [thx bzubzu.] + +---------------------- +- Mar 30th, 2004 - +---------------------- +bluecow: Fixed security exploit in IRC module and Web server (aka DecodeBase16 exploit) [thx DonDiego] + +---------------------- +- Mar 29th, 2004 - +---------------------- +bluecow: Add seperate dialog for "Paste eD2K Links" function (prev. called as 'Direct Download'). Dialog can be invoked from Tools menu or eMule context menu. +bluecow: Added MLdonkey compatible client tag recognition. + +---------------------- +- Mar 28th, 2004 - +---------------------- +bluecow: Fixed crash bug with selectively deleting of expanded search results. +Ornis: on category creation, if the edit dialog is canceled, no category will be created + +---------------------- +- Mar 27th, 2004 - +---------------------- +bluecow: Added support for new eserver 16.45 UDP description packet. + +---------------------- +- Mar 25th, 2004 - +---------------------- +Ornis: fixed security risk in the webserver [thx4hint2 MKThunderStorm] +bluecow: Added syntax coloring for search name (expression) control. +Unk: /topic and /msg now works with the IRC. +Unk: Changed some of how complete sources is determined.. + - Complete files will now show better complete numbers. + - Somehow dead files continued to show many complete sources? This should correct itself as people upgrade. + +---------------------- +- Mar 24th, 2004 - +---------------------- +bluecow: Added some error/help messages for invalid Kad search expressions. + +---------------------- +- Mar 23th, 2004 - +---------------------- +bluecow: Filename detail dialog, shows system file icons for remote client's filenames. + +---------------------- +- Mar 21th, 2004 - +---------------------- +bluecow: Fixed some minor bugs in ed2k searches related to comparison operators. +bluecow: Added more comparison operators to Kad search expression evaluation. + +---------------------- +- Mar 20th, 2004 - +---------------------- +bluecow: Added a set of additional search parameters (Complete sources, Length, Bitrate, Codec, Title, Album, Artist) +Ornis: Preferences/Display: Option to clear or disable autocompletion boxes (search-name, servermet-urls, ipfilter-urls). Disabling takes full effect after restart. + +---------------------- +- Mar 19th, 2004 - +---------------------- +bluecow: Webservices are split into file based and general URLs. General URLs are shown only in Tools/Links. + +---------------------- +- Mar 18th, 2004 - +---------------------- +bluecow: Fixed crash bug with downloading of already downloaded files which were already in known file list. + +---------------------- +- Mar 16th, 2004 - +---------------------- +bluecow: Fixed bug with recovering block requests of compressed packets after a zstream error occured. + +---------------------- +- Mar 15th, 2004 - +---------------------- +bluecow: Added 'Active download time' stats for part files which shows the amount of time the file was active in download queue. +bluecow: Added: Completed files are republished to servers to update the 'complete sources' info. +bluecow: Fixed bug with reloading of shared files where just completed and externaly removed/renamed files still showed up. + +---------------------- +- Mar 14th, 2004 - +---------------------- +bluecow: Fixed possible mem leak with OP_REQUESTPARTS message. [thx eklmn] +bluecow: Added support for integer media length eD2K tag for servers and clients. [thx lugdunummaster] +bluecow: Added publishing of basic file status (complete/incomplete) to servers. +bluecow: Added: Nr. of complete sources returned from servers are shown with availability data in search result list. +bluecow: Added: Viewing shared files of remote clients also transferes the nr. of complete sources. +unk: IRC now remembers your last nick. +unk: Added a couple more IRC info message options. + +---------------------- +- Mar 13th, 2004 - +---------------------- +bluecow: Added customizable preview commands (new config file PreviewApps.dat) + +---------------------- +- Mar 7th, 2004 - +---------------------- +bluecow: Verbose options are disabled and not shown by default. To enable the verbose options specify "VerboseOptions=1" in "eMule" section in preferences.ini. +bluecow: Fixed bug with processing of remote preview answer. +bluecow: Fixed bug in IRC property page; "Load channel list on connect" option was missing. +bluecow: Removed "ResizableLib" from source tree. Donwload the library at http://sourceforge.net/projects/resizablelib/ + +v0.42d +---------------------- +- Mar 7th, 2004 - +---------------------- +.: Fixed bug which let eMule crash when there is too much load on the UDP Socket + +v0.42c +---------------------- +- Mar 5th, 2004 - +---------------------- +bluecow: Fixed rehashing on change of Daylight Saving Time (DST) [MightyKnife]. To disable this patch, add "AdjustNTFSDaylightFileTime=0" in "[eMule]" section in preferences.ini file. + +---------------------- +- Mar 3rd, 2004 - +---------------------- +bluecow: Fixed bug with colors and known-type in searchlist control after files were canceled and/or added/removed from share. +bluecow: Fixed bug with sorting by category in download listview. +Unk: USS will temporarly be limited to a minimum of 10K until we correct a couple issues at lower speeds. + +---------------------- +- Mar 2nd, 2004 - +---------------------- +bluecow: Fixed bug in UDP socket with ReaskFilePing which was not answered for files in most cases +bluecow: Fixed bug in IP filter; adjacent ranges with different levels were merged. +Unk: IRC now handles sound events. (/sound [*.wav] [message]) (Sounds are stored in "../eMule/Sounds/IRC" dir) +Unk: Fix KadID bug which created some clusters and reported bad user counts.. + +---------------------- +- Mar 1st, 2004 - +---------------------- +Unk: Packets for the UDP socket send queue now have a lifetime now to keep from creating a backlog of packets. + +---------------------- +- Feb 29th, 2004 - +---------------------- +Ornis: fixed a bug, that resumed 2 (instead of 1) files for the function "start next paused file, when a files completes" +Ornis: correction in the statistics for source-type passive - and several minor GUI fixes +bluecow: fixed invoking the comment page +Ornis: fixed Chicane webinterface template, to be able to start downloads from searchresults +Unk: Fixed a IRC crash bug thanks to reports from several irc ops.. +Unk: Fixed the IRC Accept links from friends only option. +Unk: IRC default name gets a pseudo random nick on connect to avoid nick collisions. +Unk: Extra IRC filter options. + +---------------------- +- Feb 28th, 2004 - +---------------------- +bluecow: Fixed flaw in exception handling which did not immediatly disconnect a client which sends invalid file data packets. +bluecow: Fixed bug in UDP socket with processing of a received file status. +bluecow: Fixed several flaws in Kad window with connect and bootstrap function/buttons. +Unk: Put back ping info for USS and small adjustment to USS - zz +Unk: Removed some debug info in the upload bars + +v0.42b +---------------------- +- Feb 28th, 2004 - +---------------------- +Unk: Hotfix for keyword publishing.. + +v0.42a +---------------------- +- Feb 27th, 2004 - +---------------------- +Ornis: Several minor corrections on the GUI + +---------------------- +- Feb 22th, 2004 - +---------------------- +bluecow: Several changes and optimizations to verbose log options. +Unk: Hopefully reduced keyword overhead some more by only publishing complete files. + +---------------------- +- Feb 21th, 2004 - +---------------------- +bluecow: Added new connection state icon showing seperate eD2K and Kad network connection state and seperate LowID/HighID. + +---------------------- +- Feb 20th, 2004 - +---------------------- +bluecow: Added new AVI file parsing code for getting attributes in File Info dialog. +bluecow: Added a thread for getting audio/video attributes of multiple files when using File Info dialog. + +---------------------- +- Feb 19th, 2004 - +---------------------- +bluecow: Added optional support for MediaInfoLib (http://mediainfo.sourceforge.net) for viewing audio/video attributes of part and shared files. This feature is optional and will only be used if version 0.4.0.1 of MediaInfoLib (MediaInfo.DLL) is copied to eMule application folder. + +---------------------- +- Feb 18th, 2004 - +---------------------- +bluecow: Added merging of audio/video attributes in File Info dialog. All audio/video attributes from all selected (part) files are merged to verify if selected files are of same audio/video format. + +---------------------- +- Feb 16th, 2004 - +---------------------- +bluecow: Added new column to search results showing local file info. + +---------------------- +- Feb 15th, 2004 - +---------------------- +bluecow: Search type or shared files list request is shown in each search results tab. +bluecow: Added automatic creation of 'downloads.txt' file in eMule application folder. This file holds the current part file names and related ed2k links to recover more easily after lost part.met files. + +---------------------- +- Feb 14th, 2004 - +---------------------- +bluecow: Windows thumbs.db files with missing system file attribute are no longer shared. +bluecow: Thoroughly handling of max. nick name length. + +---------------------- +- Feb 12th, 2004 - +---------------------- +bluecow: Tweaked tab controls in server window/chat window to show unread log/chat messages. + +---------------------- +- Feb 10th, 2004 - +---------------------- +bluecow: Added caching of webservices menu entries. +bluecow: Fixed multi threading issue with file completion. +bluecow: Fixed some problems with duplicate entries in known file list and shared file list. + +---------------------- +- Feb 9th, 2004 - +---------------------- +bluecow: Added a lot of protocol logging and debugging code. +bluecow: Several optimizations in processing search expressions for keyword index. +bluecow: Reworked UDP socket exception handling. +Unk: Split source and keyword indexing to allow specific tweaking later. + +---------------------- +- Feb 6th, 2004 - +---------------------- +bluecow: Added more logging options in Extended Settings. +Unk: Kad now allows smaller local networks if you turn off LANIP filtering. (This should only be used for debuging and testing) +Unk: A lot of Kad has been converted to use CSafeMemFile.. To finish converting all, we need to convert the Kad's Tags and Kad's Taglist to work with it.. +Unk: When duplicates are found in the KnownFileList, the stats are now merged.. + +---------------------- +- Feb 4th, 2004 - +---------------------- +bluecow: Reworked internal storage of preferences. +bluecow: Fixed bug with downloads added from search result in paused mode which dropped possible found sources. +unk: Redid the knownfilelist.. Before you could have multi entires. + +---------------------- +- Feb 3nd, 2004 - +---------------------- +bluecow: Fixed bug with Kad keyword publishing list due to renaming a shared file which was completed in current session. + +---------------------- +- Feb 2nd, 2004 - +---------------------- +bluecow: Fixed bug in Kad search with implicit ANDed search expressions. +. : Merging of the extended trayicon menue [eMule+] + +---------------------- +- Feb 1st, 2004 - +---------------------- +bluecow: Reworked IP filter +- Optimized IP filter lookup for less CPU load. +- Optimized loading of IP filter files. +- Added merge of overlapping and adjacent filter ranges. +- More safety in determining format of IP filter files (support for eMule IP filter and PeerGuardian file formats). +- More tolerance in eMule IP filter format files (level and description is now optional). +- Added IP filter dialog for basic editing and viewing IP filters (accessible via Tool menu). +- Added IP filter rule hit statistics. +Unk: Fixed a bug in the UDP port that resent UDP packets to dead clients. + +---------------------- +- Jan 29th, 2004 - +---------------------- +Unk: Major rewrite of the Kad code.. + - Kad is now part of eMule's thread so we don't have to worry about Sync issues. + - Although many will say that this is a performance loss, I feel the the simplification of the code out ways this. + - Kad will now use eMule's UDP port (And eMule's TCP port in the future) instead of their own. + +---------------------- +- Jan 27th, 2004 - +---------------------- +bluecow: New data (packet + files) processing code for less CPU load. + +---------------------- +- Jan 25th, 2004 - +---------------------- +Unk: Fixed a few issues that occured when a partfile became a complete file. + +---------------------- +- Jan 22th, 2004 - +---------------------- +bluecow: Fixed bug with wrong category directory shown for new created downloads. +bluecow: Fixed printf-flaw with category directories. +bluecow: Fixed problem with empty file data packets which could corrupt the gap list. +bluecow: Fixed timing issue in PerfLog module. +bluecow: Fixed statistics bug with ICH in download session category. + +---------------------- +- Jan 19th, 2004 - +---------------------- +bluecow: Fixed: If the very first downloaded part of a file was recovered by ICH, the file was though not shared until another part was completed without ICH. +Unk: Incoming ExtendedFileInfo was done without checking the version number. + - This fix seems to have found that a couple older eMule Mods and Shareaza (And maybe a some other mods) are sending the wrong version number here. + - They say they support the ExtendedFileInfo which makes us send the our info, but they in return do not send it to us when we are expecting it.. +Unk: A part of the ED2K protocol has been redone into a eMule protocol. This allows us to do several ED2K type packets with just one packet hopeing to save overhead. +Unk: The UDP file reask now updates the FileStatus and it transmits all the ExtendedFileInfo. +Unk: File reasks have been extended for less overhead. +Unk: Source exchange times have been adjusted for less overhead. (May have to set the received source request time check back to older values so older clients don't suffer. Needs testing.) + +---------------------- +- Jan 17th, 2004 - +---------------------- +Unk: The switch for processing sources for a download had some fall through bugs. +Unk: There was a bug the allowed the client to send a UDP and TCP file reask at the same time. +Unk: NNP sources was allowed to do a UDP reask which does not update our chunk info.. So, this was a wasted packet.. +Unk: It was possible (But unlikely) for the client to send a UDP reask to a client he has never done a TCP reask.. +Unk: AskForDownload() now returns a result so we know if the source was deleted. +Unk: Only count sent Kad overhead that was actually sent, not queued or failed.. +Unk: Clients even without a valid file request could still get on the queue. +Unk: There were three different methods creating a per file upload list. Some of them rebuilt this list each time needed. We now maintain an upload list per each client in real time to avoid this. + - Update: there is a bug that allows the same file to be in the KnownFileList.. This messes up this real time management.. + - For the moment, there is a debug code in the client the saves from creating dangling pointers.. + - This code will be removed once we fix the issues.. +Unk: Source exhange for a complete file is now like part files, you only send sources that has chunks the user needs. + +---------------------- +- Jan 15th, 2004 - +---------------------- +Ornis: IPFilter - file can be now in peerguardian-format as well +Ornis: Preferences/Security: option to download the ipfilter-file from an URL +Ornis: Fix: Handling of deleting files, which are currently into diskspace allocation +bluecow: View Shared Files command of remote clients is disabled if client published that he does not support that feature. +bluecow: Fixed bug in viewing shared files from remote client - shared part files were not shown. +bluecow: Reduced memory usage of client instances #2. +bluecow: Fixed Kad UDP socket usage to avoid loss of packets to send. +bluecow: Optimized client listview controls for less CPU load. +bluecow: Fixed several flaws in context menus, shortcuts and usage of middle mouse button. +Unk: Try to filter self sources better. +Unk: We receive all incoming Kad sources now. (Was a bug that blocked them if the file got a lot of sources from a server or source exchange) +Unk: Again LowID Callbacks were messing up because of Kad and ED2K states. This is now checked more closly. +Unk: Nodal searches for publishing extended to allow full publish. Nodal searches for sources is lessened to reduce overhead with very rare files. + +---------------------- +- Jan 10th, 2004 - +---------------------- +bluecow: Some changes for more proper Winsock initialisation and termination. +bluecow: Fixed and added some statistics for file data transfer. +Unk: Nodal lookups are now deleted with a delay when allowed. In other words, we try not to waste delayed incoming result packets. +Unk: There is a bug with the experation timer to Nodal lookups when you exhausted all pending contacts. +Unk: Keyword republishing is delayed longer to lower overhead. + + +0.41b.29 release +---------------------- +- Jan 05th, 2004 - +---------------------- +bluecow: Fixed several flaws in client and server overhead computation. (Note: You will see somehow increased overhead). +bluecow: Added Kademlia overhead statistics. +bluecow: Added client protocol handshake validation. +bluecow: To avoid spreading of false meta data, any (already) received meta data is dropped and locally created by examining file contents only. +bluecow: Fixed bug server connection duration statistics [Gnaddelwarz] +Unk: We delay publishing keywords to avoid spamming network with users that only stay connected for a very short time. + +---------------------- +- Jan 04th, 2004 - +---------------------- +bluecow: Added thread safe synchronous command processing to Kad listener socket. +bluecow: Added explicit removing of file block requests for disconnected client to avoid file completion problems. +bluecow: Fixed sorting problems in shared files list control. +bluecow: Fixed very tricky bug in structured exception handling of client TCP socket. +bluecow: Already received but not processed packets are discarded after a client was disconnected. +bluecow: Fixed a potential client deletion crash bug related to IP filter. +bluecow: Added client protocol procedure state error log messages. + +---------------------- +- Dec 31th, 2003 - +---------------------- +Unk: Changed Log messaging from Kad to Emule to a thread safe method. win98 should be able to run a little better now.. But, there seem to still be issues. +Ornis:Sharefileslistcontrol offers rename,delete,open it's folder via contextmenu for files + (deletes to recycle bin! use preferences.ini: RemoveFilesToBin=false, to have a eternal deletion) +Unk: Until a fix is found, we only update the clients ID when adding a Kad Contact to the list. This seems to avoid the win98 freeze. +Unk: Small change in Kad search tolerance and bootstraping. + +---------------------- +- Dec 30th, 2003 - +---------------------- +Ornis: Downloadfile-Details, Filenametab: improved listing and sorting of the available filenames +Ornis: Allocating new filesize for tempfiles not blocking anymore (threading+buffering) +Ornis: Downloadlist: Sorting of the remain column for files now in 4-way-mode, to sort by remaining size OR by remaining time +Unk: Auto Kad bootstrap if you are trying to connect and see a Kad client. +Unk: The client now detects conflicts between UDP ports to prevent the client from freezing.. +Unk: Bootstrap selectable by IP:Port or by a known Kad-client (searches your known client list for a Kad client to boot from) +bluecow: Reworked part file details dialog; added showing of several accumulated values for multiple selected part files. +bluecow: Removed Permissions column from Shared Files window (don't worry, it was never used). +bluecow: Reworked all Server-, Search-. Download- and Shared Files window context menus for supporting multiple selections. +bluecow: Fixed bug with first runtime wizard and enabled startup minimized option. +bluecow: Added option to restore the last used main window dialog at startup; (specify "RestoreLastMainWndDlg=1" in preferences.ini) +bluecow: Added Ornis' 4-way sorting for shared column in shared files window. + +---------------------- +- Dec 28th, 2003 - +---------------------- +Unk: Added a lot of exception catching to Kad and SMIRC. +Unk: Gave incoming and outgoing Kad UDP packets same priority to keep outgoing packets from backlogging. +Unk: We now keep track on how many packets are sent with Kad Node lookups. +Unk: Search Jumpstarts are now only used when the search appears to have stalled. +Unk: IRC: /hop added. +Unk: Joined channels get focus now. +Unk: Fixed several memleaks with the Kad client +Unk: Added some flags to the Node lookups for future special purposes. (Can't be used until most client upgrade) +Unk: Small change to contact tree. More nodes known so that you find your target faster. + +---------------------- +- Dec 22th, 2003 - +---------------------- +bluecow: Fixed problem with servers with IP 255.255.255.255 which could be added to the server list. +bluecow: Resolved IPs of DynDNS servers are now verified and optionally filtered (IP-filter). +bluecow: Reduced memory usage of client instances. +Ornis: Option for automatic removal of completed downloads from list +Ornis: Create lang-folder if neccessary on language download + +---------------------- +- Dec 21st, 2003 - +---------------------- +Unk: Fixed a bug with rechecking firewall. +Unk: You can bootstrap into kad even if your not connected. + +---------------------- +- Dec 18th, 2003 - +---------------------- +bluecow: Improved reading of UL/DL priorities read from known.met and part.met files to avoid usage of unknown values. +bluecow: Fixed mem leak and possible stall in server UDP socket related to failed DNS queries. +Unk: Adjusted disconnect timeout for Kad. +Unk: IRC: Small tweak to add friend. +Ornis: Fix of auto resume next file of same category + +---------------------- +- Dec 17th, 2003 - +---------------------- +bluecow: Optimized processing of keyword publish list. +bluecow: Removed multiple part file source lists for more performance. +Unk: Search requests now send up to 300 results +Unk: Keywords now publish in Clusters of 150 files making use of the keyword publish list. + +---------------------- +- Dec 13th, 2003 - +---------------------- +bluecow: Added more memory and C++ object check code for debug builds. +bluecow: Fixed wrong usage of some internal lists [rayita] +bluecow: Improved updating of GUI for donwload queue [rayita] +bluecow: Removed automatically resuming of files with state Insufficient diskspace. +bluecow: Addeded manually resuming of files with state Insufficient diskspace. + +---------------------- +- Dec 10th, 2003 - +---------------------- +bluecow: Improved sending of OP_CANCELTRANSFER. + +---------------------- +- Dec 8th, 2003 - +---------------------- +bluecow: Reworked includes of entire source branch. +bluecow: Added showing of server attributes to MyInfo panel. +bluecow: Fixed very rare occuring bug with decompressing of high compressable blocks. +bluecow: Improved error handling for decompressing corrupted blocks. +bluecow: Upgraded to zlib 1.2.1 + +---------------------- +- Nov 27th, 2003 - +---------------------- +bluecow: Added Drag&Drop support for Windows Shell URLs and more IE URL formats. This means you can drag&drop eD2K-URLs which are stored as Windows Shell URLs (like the entries in IE Favorites folder) into the eMule window. Works for eD2K-file-, server- and serverlist-links. +bluecow: Couple of code optimizations for processing the sources lists. + +---------------------- +- Nov 25th, 2003 - +---------------------- +bluecow: Added Drag&Drop support for ANSI Text and HTML Text clipboard data formats. This means you can drag&drop eD2K-URLs from Internet Explorer Windows into eMule window. HTML fragments means: everything which is currently selected within the HTML page and which is allowed to contain more than just one eD2K-URL. Works for eD2K-file-, server- and serverlist-links. + +---------------------- +- Nov 24th, 2003 - +---------------------- +bluecow: Fixed crash bug when file date of local files was out of range. +bluecow: Fixed performance issue with log files which got too large. +bluecow: Log files which are larger than 1MB are renamed to a filename with the start of the log and the current log file is restarted. Max. log file size can be specified in preferences.ini section "eMule" keyword "MaxLogFileSize=". + +---------------------- +- Nov 23th, 2003 - +---------------------- +bluecow: Fixed context menu support in IRC and Message window. +bluecow: All listview context menus are positioned correctly when invoked with keyboard interface. +bluecow: Statistics graphs are not deleted if according property page was opened and closed without changing values. + +---------------------- +- Nov 22th, 2003 - +---------------------- +bluecow: Added support for selectable text, copy to clipboard, save log to disk and rotating log for IRC Chat windows. +bluecow: Fixed handling of windows shutdown message (WM_QUERYENDSESSION). +bluecow: Added support for external performance logging with NT Performance Monitor compatible log files. +bluecow: Changed socket creation code for non-proxy connections to reduce system resource usage. + +---------------------- +- Nov 21th, 2003 - +---------------------- +bluecow: Fixed performance problem with rotating log which could create very high CPU usage in some cases. +bluecow: Fixed mem leaks in UDP sockets [rayita] +bluecow: Added support for selectable text, copy to clipboard, save log to disk and rotating log for Message windows. + +---------------------- +- Nov 20th, 2003 - +---------------------- +bluecow: Fixed window resizing problem related to customizable toolbar and system color/theme change. +bluecow: Main windows are maximized correctly (depending on toolbar style/height) at startup. +bluecow: Fixed string format buffer overflow with status command line argument [KuSh]. +bluecow: Fixed several problems with skinnable icons which were not updated on the fly. +bluecow: Added background colors (skinnable) for IRC channel window and nick window. +bluecow: Removed closeable tab control for IRC windows. +bluecow: Added close command to context menus of IRC/Message windows. +bluecow: Added tripple click feature to search term edit control. + +---------------------- +- 7. November 2003 - +---------------------- + + +---------------------- +- Nov 5th, 2003 - +---------------------- +bluecow: Fixed rare occuring problem with staled server source request related to invalid part.met file contents. +bluecow: More safety in part.met file reading. +bluecow: Fixed problem with too frequently occuring server connection attempts with very short server lists. + +---------------------- +- Nov 2nd, 2003 - +---------------------- +bluecow: Fixed minor issue with queued local server source requests after new server connect. +bluecow: Fixed sorting of buffered part file blocks to achive less HD stress. +bluecow: Fixed memory leaks and flushing of buffered data to HD of paused files when file was canceled. +bluecow: Files which could not be completed because of not enough free disk space can be resumed manually to try another file completion process. +bluecow: Fixed bug in check min. free disk space which could cause endless low disk space notifications. +bluecow: Improved check min. free disk space for better handling NTFS compressed/sparse files. +bluecow: Fixed a bug where an NTFS compressed file could not be created because there was not enough free disk space to hold the uncompressed file. + +Unk: Several bugs noted in the forum. Tried to check most of them. +* Sources to a Paused or Stopped file will be removed once an hour to remove old sources.. +* We no longer send sources to Paused or Stopped files. +* A better check of valid sources to Part files for source exchange. +* Source exchanges for complete files now sends sources with obtained parts first. +Unk: Removed some redundent For Loops to save CPU in the DownloadQueue.. + +---------------------- +- Oct 30th, 2003 - +---------------------- +bluecow: Added grouping of local server source reasks packets into one TCP frame +bluecow: Fixed bug with check diskspace +bluecow: Fixed problem with lost read-only settings in preferences.ini after version change +bluecow: Fixed server TCP overhead statistics +bluecow: Fixed HTTP download dialog string resources + +---------------------- +- Oct 29th, 2003 - +---------------------- +Unk: Fixed a non thread safe area that moved Kad Contacts in the list. +Unk: Fixed a area that would stop Kad sources from being added. +Unk: Added zz upload throttler. + +---------------------- +- Oct 23th, 2003 - +---------------------- +bluecow: Fixed multi threading problem with a completing file which was concurrently uploaded. + +---------------------- +- Oct 22th, 2003 - +---------------------- +bluecow: Fixed bug in webserver which can cause memory corruption [MoNKi] + +---------------------- +- Oct 21th, 2003 - +---------------------- +bluecow: Changed creation of Kademlia threads for proper RTL initialization. +bluecow: Fixed some glitches in shared directories control; added keyboard interface; added volume labels + +---------------------- +- Oct 19th, 2003 - +---------------------- +bluecow: Fixed bug with friends where a client without an IP or hash could be added as a friend. +bluecow: Fixed bug with ed2k URL registry key where path contains special characters. +bluecow: Fixed system and tray context menu items for connecting/disconnect to/from both networks. +bluecow: Added new MyInfo control; shortcuts for Ctrl+C=copy selected text; Ctrl+A=select all text + +---------------------- +- Oct 16th, 2003 - +---------------------- +bluecow: Fixed GDI resource leaks in video preview dialog. +bluecow: Added more functions for icon customizing (see documentation in Template.eMuleSkin.ini file) + +---------------------- +- Oct 15th, 2003 - +---------------------- +bluecow: Added more icons for Kademlia windows [this and other eye candy icons were made all by Daan] +bluecow: Fixed bug in friend list/control. +bluecow: Added sorting to friend list control. +bluecow: Fixed more context menus (search listview, queue list, client list,...) + +---------------------- +- Oct 14th, 2003 - +---------------------- +bluecow: Fixed shutdown freezing bug +bluecow: Fixed bug with View Shared Files command +bluecow: Fixed glitches in Kademlia listviews +bluecow: Added icons for Kademlia listviews +bluecow: Fixed toolbar strings for customizing dialog +bluecow: Fixed context menu for friend listview +bluecow: Added keyboard shortcuts for friend listview (Del=Remove friend, Ins=Add Friend) +bluecow: Fixed context menu for shared files listview +bluecow: Added icon/color customization for all main listviews/treeviews +bluecow: Reduced GDI resource usage for all image lists +Unk: Fixed a bug introduced when changing how we published. +Unk: Adjusted the Server and Kademlia a little. + +---------------------- +- Oct 13th, 2003 - +---------------------- +Unk: Publishing of sources is now seperate from publishing keywords. This allows better control. +Unk: We now rotate the sources to a key better making sure the freshest sources are always first. +Unk: We also only index up to 50 sources per file since we only send a max of 50 sources to save memory. + +---------------------- +- Oct 12th, 2003 - +---------------------- +Ornis: Webinterface: better connection separation of both networks +Ornis: Webinterface: displaying statistics fixed + +---------------------- +- Oct 8th, 2003 - +---------------------- +Unk: Removed previous change to Contact tree, the contact tree is now a fixed size as the network grows.. +Unk: The change to the contact tree also changes when we do nodelookups and contact pings. +Unk: Added a special "me" lookup to fill the tree quickly when you've been connected for a small period of time +Unk: Added bootstrap options to the lists if your stuck at conneting on Kademlia. +1) Only works with clients that are "connected" to Kademlia. +2) v40e and up only send a KadUDP port if they are connected so we know that client is connected. +Unk: Many of the intial kademlia lookups are now delayed to avoid quick connections from spamming. +Unk: Node Lookups are now ended once we receive a answer and no longer asks evenone in the list. +Unk: Changed the prefix on emule toolbars to ".eMuleToolbar.kad1.*" so that you can seperate from the classic toolbars. +Unk: Also, the default directory for the ".eMuleToolbar.kad1.*" files are now the incoming dir. So, just download them and they are already installed. +Unk: Change the timing of when you start checking contacts to help speed up the inital connection process. + +---------------------- +- Oct 7th, 2003 - +---------------------- +bluecow: Fixed bug with upload list control which was not refreshed automatically [Xman1+KuSh] +bluecow: Fixed mouse/keyboard acces bug in HyperText control [MoNKi] +bluecow: Added keyboard shortcuts to main toolbar. +bluecow: Support for loading of toolbar bitmap images and taskbar notifier images with GDIPLUS.DLL if installed. Toolbar images can be transparent. + +---------------------- +- Oct 6th, 2003 - +---------------------- +Unk: Contact list was still growing to much. Removed one more passive contact method. +Unk: The Contact tree is now skewed even more to stop the Contact list from growning in log size. + +---------------------- +- Oct 5th, 2003 - +---------------------- +bluecow: Fixed bug with server warning messages which were shown as errors. +bluecow: Fixed bug with random drawn block requests in file progress bars. + +---------------------- +- October 4th, 2003 - +---------------------- +Ornis: enhanced webinterface for some kademlia control/information +Ornis: some more localisations +Unk: New contacts are set to type 1 initially to keep dead contacts from spreading. +Unk: The client now ignores indexes are are very far from it's clientID. +1) Saves wasted memory and a little overhead. +Unk: The client now skips publishing to contacts are are very far from the target. +1) Saves from wasting other clients memory and overhead. +Unk: Fixed a major bug in the Kademlia search algorithm. +1) It now does the correct hops to find a target better. +2) Stops from doing requests from the wrong target. +bluecow: Changed several resource string loading code to support string based resource identifiers [SlugFiller+itsonlyme] +bluecow: Added: download links can contain hostname sources, instead of just ip; You can set your own hostname in preferences, and create eD2K links with sources with your chosen hostname instead of your IP [SlugFiller+itsonlyme] +bluecow: Added speed improvements made to the bar shader, making it display much faster than before [SlugFiller] +bluecow: Added code improvements for faster sorting complete sources [SlugFiller] +bluecow: Added sorting of complete source column in shared files window [SlugFiller] +bluecow: Fixed visual bug in upload status bar [wistily] +bluecow: Added check free diskspace option which ensures that complete files can be stored [SlugFiller] +bluecow: Added check free diskspace option which ensures that a minimum of free diskspace remains available. +bluecow: Added uncompressing of NTFS compressed files for completed files. +Unk: Less Node lookups into the network. +Unk: Partfiles no longer republish into the Kademlia on every restart. +Unk: You now only publish each key to 10 targets. +1) Slightly speeds up publishing. +2) Since we are publishing faster, overhead may be a little higher. + +---------------------- +- October 2nd, 2003 - +---------------------- +Unk: Protocol change.. Going to have to restart the network.. (Everyone Update!) +Unk: Kademlia searches should be far be far better. + +---------------------- +- October 1st, 2003 - +---------------------- +Ornis: Added connect buttons to Kad and Servers. +Unk: Passive contact collection during publishing is causing the contact list to grow too large.. +1) This will help the contact list to stay at a lower level.. +2) Also should lower the overhead as you don't have to keep track of as many contacts.. +Unk: A very unreliable user estimate. +Unk: Extended the window to publish files.. +1) This allows more files to be published.. +2) Reduces overhead for those not sharing a lot of files.. +3) But will increase the amount of files everyone has to index. +i ) This increase in indexes will actually be testing things for when publishing speed is increased.. +4) Will cause a more old sources to be indexed.. +Unk: All contacts after level 4 are now checked at least once an hour. +bluecow: added the long awaited More button to search window for getting more search results from the local server. +bluecow: rewrote tooltips for transfer window to fix several small glitches. +bluecow: buffered partfile data is explicitly written to disk before a preview command is invoked. +bluecow: partfile disk usage is determined with respect to NTFS compression and/or NTFS sparse files. + +---------------------- +- Sep 25th, 2003 - +---------------------- +bluecow: Added server TCP connection keep alive function. +bluecow: Tooltips in search results listview are shown only if Shift+Ctrl is pressed while moving the mouse over a listview item. + +---------------------- +- Sep 21th, 2003 - +---------------------- +bluecow: Changed all integer (8,16,32,128 bit) data to little endian format at lowest (network) level. +Unk: Initial merging of eMule and eDonkey's hello packets with help from bluecow. +Unk: Created new format of eMule's version number to show more info. +Unk: Cleaned up some of the Indexing code. +Unk: Index list is now cleaned better. + Passive Cleaning) If someone does a search request and the client finds old keys to that request, they are deleted. + Acitve Cleaning) Once every 30 mins, the index is scrubbed of old keys. + +---------------------- +- Sep 20th, 2003 - +---------------------- +bluecow: changed all meta tags with string names into integer IDs +bluecow: changed "Length" meta tag for eMule/Kad internal to type "Integer" +bluecow: eMule/Kad tags are converted on-the-fly into ED2K tags when sent to a server or client +bluecow: received ED2K tags are converted into eMule/Kad tags; includes also ED2K tags read from known.met +bluecow: Redid Kad meta tag class to support: + - data type for nr. of meta tags (in list) changed from uint32 to uint8 + - "dynamic" integer tags - this tag type selects the appropriate integer (8,16,32 bit) depending on the actually value + - data conversion functions and property functions for each tag type to support on-the-fly and easy to use data conversion without caring about the actual data type +Unk: Search & source results are now bundled. + - If your going to recieve more then 1 result from a client, this will save 16Bytes(data)+UDP(packet overhead) for all extra results. + - Also, compression seems be able to compress these packets close to 50%.. +Unk: Files with no valid keywords were able to stall publishing of all other files.. This was fixed. +Unk: Kademlia search results are now process availability a little different to try to get a better idea of availability. + +---------------------- +- Sep 18th, 2003 - +---------------------- +bluecow: Fixed bug with invalid client objects in upload list after a file was unshared/reshared [zegzav] +bluecow: Shared files listview and Search Results list view; Alt+DoubleClick opens Details dialog. +bluecow: Fixed several format string errors [mandrag0re] + +---------------------- +- Sep 16th, 2003 - +---------------------- +Unk: Any large Kad packet is now compressed. + +---------------------- +- Sep 15th, 2003 - +---------------------- +bluecow: Added support for showing all available MP3 tag information for downloads and shared files. +Unk: Rework of the Kademlia protocol. + 1) Search requests no longer sends MaxResults. + 2) Search result packets now support sending more then one result per packet. + a) We still use one packet per result. This is for future expansion. + b) Once compression is added to the protocol, search results should start combining into one packets. + 3) Publish request packets new support sending more then one request per packet. + a) We also still send one packet per result. This is for future expansion. + b) Once compression is added to the protocol, these requests should also start combinging into one packets. + 4) Contact types went from 0-4 to 0-2. + a) This keeps a cleaner contact list + b) This also may increase overhead. Therefore, adjustment after first beta may change.. + 5) The contact list is set to stop Node requests when a branch in the tree reaches level 4. + a) This means that when the network is in full force, contacts will be limited. (Not sure how much yet.) + b) At the moment I allow the right most branch to continue to build. + i) This allows a client to know more clients close to it's own hash. + ii) Hopefully this allows searches to find home quicker.. + iii) This may cause to much overhead and may need adjustment. + 6) Kademlia Requests now sends the recievers ID. + a) This adds a little bit of security. + b) If you change your KadID, this will hopefully help remove your old ID from the system. + 7) Redid how you set contact as alive. + a) You only set contacts the respond to a request as alive. + b) This keeps from scanning the contact list on EVERY packet. + 1) Since we don't know the contacts ID we can't use the tree, but sequentually scan it. + 2) We can't just add the contactID to the packet as we can't trust them. + c) This will most likely miss some opportunities to mark a contact as alive. + 1) In some instances this wouldn't matter since it will be used in a Kad Request. + 2) In other casses, it will matter as you would need to ping that client to see if it's still there. + +---------------------- +- Sep 14th, 2003 - +---------------------- +bluecow: Added support for extended UDP server protocol for lugdunum 16.40 servers to receive multiple file search results in one UDP packet. +bluecow: Server UDP socket handles blocking socket state which could happen for larger UDP packets. +bluecow: More helpful error/logging messages for server UDP socket related functions. +bluecow: Optimizations in server UDP socket code for less CPU load (avoiding memory copy operations). +bluecow: Fixed bug in client UDP socket which did not handled the blocking state correctly. +bluecow: Search parameters are saved for each search result list; when selecting a search result list, the used search parameters are restored in the according controls +bluecow: When deleting a search result list the search result list following the deleted one is selected instead of the first one +bluecow: Last used search method is saved and restored in next eMule session. +bluecow: Servers can be added by pasting an eD2K server link into the IP address control of the server window. +bluecow: Shared files and downloading files are not counted in search results for the search result limit. + +----------------------- +- September 13th, 2003- +----------------------- +Unk: Fixed a bug that tried to access a Contact after deleting it. +Unk: Fixed a overflow bug. +Unk: Seperated the KadID from clientID. The eMule tags in the Hash interfered with the routing. +Unk: Fixed a bug that didn't set experation of a contact correctly. +Unk: Changed the MaxUp and Maxdown into sliders. + +---------------------- +- Sep 11th, 2003 - +---------------------- +bluecow: Added server TCP/UDP protocol logging+debug code. +bluecow: Added support for new welcome server message from lugdunum 16.40 servers. +bluecow: Added support for compressed server protocol for lugdunum 16.40 servers; welcome message and file search results are received as compressed data; shared files are sent to server as compressed data +bluecow: Added support for extended UDP server protocol for lugdunum 16.40 servers; global source finding is done more effeciently and with less bandwidth. +bluecow: Fixed crash bug in host name resolution. +bluecow: A global file search is started if the local server does not answer with file results within max. 50 seconds. +bluecow: Fixed bug with eD2K link control in search window which did not accept more than 3 or 4 links. + +----------------------- +- September 10th, 2003- +----------------------- +bluecow: Added support for compressed server protocol for lugdunum 16.40 servers. +bluecow: Added support for extended UDP server protocol for lugdunum 16.40 servers. + +---------------------- +- September 4th, 2003- +---------------------- +bluecow: Redid ON window listviews; sorting, restoring of col widths, sort order; tooltips for meta data +bluecow: Meta data dialog shows classic and new tags. +Unk: Slots now try as much as possible to stay at 3K or above. +Unk: Contacts further away from you are now limited to remove overhead. + +---------------------- +- September 3rd, 2003- +---------------------- +Unk: Indexing is now updatable.. +Unk: Indexed files now have a life time. +Unk: Indexed files are now reloaded on restarts. +Unk: Fixed a bug that only published the file ID once.. +Unk: Recheck firewalled periodically.. This "should" also correct your IP on those 24hr disconnect users. +Unk: Publishes no longer assumes a successful publish. It now only count successful responses. +Unk: Kademlia searches now terminate if they have no more contacts pending. + +---------------------- +- September 1st, 2003- +---------------------- +bluecow: Meta Data and File Comments dialogs changed into property pages which are shown together with File details property sheet. All property sheet/page related dialogs are resizeable and restore LRU size+position. Widths of columns in File Comments. File Names and Meta Data listviews saved+restored. Same applies for Meta Data dialogs for search results and shared files. +bluecow: New "Match keywords" search option for both Jigle search methods. + +---------------------- +- Aug 30th, 2003 - +---------------------- +Unk: Rewrote the entire kademlia protocol.. We are no longer using Overnet.. +Unk: Adding availability to publishing. +bluecow: Change in usage of search file type parameter "Program": When searching for a file of type "Program", the results are no longer locally filtered according Windows Program Files extension (*.exe, *.com, *.bat). The eD2K file type "Program" is meant to contain all file types which are "used" by a program like compressed archives and CD-ROM images. This means that you will get more search results than in previous versions. If you still want to search for a Windows Program File, specify "exe" for the file extension. +bluecow: Added proxy support for IRC; all proxy settings are also used for IRC +Ornis: bugfix in webserver socket code, [Jan B.,nice bugreport] + +---------------------- +- Aug 29th, 2003 - +---------------------- +Ornis: Filedetailsdialog restructured, + showing date of downloadstart and duration since (until now or until download completion) +Ornis: added some missing percentages in the statistic tree +Ornis: added option to scheduler, to disable the endtime and therefor make changes of an event permanent + +---------------------- +- August 26th, 2003 - +---------------------- +bluecow: More tweaks in the gSOAP module for better performance with Jigle server and reliable compiling by modders (always ensure that WITH_GZIP is defined!); a Jigle search request always has to include either a file type and/or a file extension, otherwise the request will not be sent for reducing server load; HTTP User-Agent field changed to reflect eMule version. +bluecow: Fixed several issues with the new CComboBoxEx control (keyboard interface). +bluecow: Several visual changes in the new search list view for proper windows color scheme handling and sorting of child items + +---------------------- +- August 24th, 2003 - +---------------------- +bluecow: Added support for Jigle SOAP interface to search the Jigle database with eMule [special thanks to Melange from Jigle for offering this great feature to eMule] +bluecow: Jigle SOAP interface: search results are limited to 100 results; optimized code for less server load; local filtering of search results +bluecow: Added extended combobox control for search methods [eMulePlus] + +---------------------- +- August 20th, 2003 - +---------------------- +Unk: Changed how it detects firewalled users. +Unk: Indexed keywords now handles all tags. +Unk: Available is better updated during a search. +Ornis: added stats of where sources came from (ed2k-server, ON, source exchange) +Ornis: custimizable toolbar [eMule+] +Ornis: Downloadlist: F2 opens inputbox to change filename of the selected file +Ornis: Searchlist can expand items to show the received different filenames and their count + +---------------------- +- August 11th, 2003 - +---------------------- +Unk: One more change to smoothing out the packets.. Hopefully this is the last. +Unk: Contacts are now checked in a more systematic way to help lower bandwidth. +Unk: Only low buckets are updated to lower bandwidth. +Unk: Hopefully fixed another shutdown crash. + +---------------------- +- August 7th, 2003 - +---------------------- +Unk: More outgoing flood control to try to avoid lagging. (No more spikes) +Unk: Major change to how we sent shared files to servers for better efficiency. +Unk: Overnet status are now only updated once a sec to reduce CPU overhead. +Unk: Kademlia searches are now regulated by total and type to keep from two many searches at once. + +---------------------- +- July 29th, 2003 - +---------------------- +Unk: IRC: Now sorts nicks correctly. +Unk: IRC: Can now add other eMule nicks as friends. +Unk: IRC: Can now send each other ed2k links within the IRC. +Unk: IRC: Added security to Add nick and Sending links. You can choose to accept all links, links for friends only, and no links at all. + +---------------------- +- July 26th, 2003 - +---------------------- +Unk: Contacts are now filtered from invalid IP and Ports. +Unk: Again adjusted how dead contacts are removed. +Unk: Older contacts are no longer added on restart. +Unk: Trying to reduce UDP spikes that can flood connections. +Unk: Moved Overnet Log and Debug line info into eMules Log and Debuglogs.. + +---------------------- +- July 24th, 2003 - +---------------------- +Unk: Fixed a bug that allowed searches to access already deleted contacts. +Unk: Serverlist is now updated when connected to Kademlia only. +Unk: Seemed Kademila thread still tried to access some of it's main objects during shutdown. (Hopefully fixed) +Unk: Fixed some connected status issues. + +---------------------- +- July 16th, 2003 - +---------------------- +Unk: Testing out Maella request patch. +Unk: Dead contacts are removed more efficiently. + +---------------------- +- July 5th, 2003 - +---------------------- +Unk: Contact type is now being updated. May later use this and "madeContact" to update the contact list a little better. +Unk: Contact list no longer shows temp contacts during searches. Also, redid how contacts are updated to limit the number of refreshes needed. (Cpu Savers) +Unk: Converted the ED2K ID system to the Hyrbids ID system to avoid false lowIDs that the ED2K ID system created and to be more compatable with the Hyrbid. +---- Also standardized the LowID checks to 2 central methods (ED2K and Hybrid). We were using several different methods to check lowID. +---- This changed a lot of code and needs tested well. + +---------------------- +- July 1st, 2003 - +---------------------- +Unk: You can now see if your files are published to a ED2K Server and/or Overnet. +Unk: You no longer republish files to a ED2K server that is already on there. This should save a lot of bandwidth and allow more files to be listed.. + +---------------------- +- June 30th, 2003 - +---------------------- +Unk: Single keyword search requests are now processed. +Unk: Fixed a bug that could get the publishing stuck trying to publish a file over and over. + +---------------------- +- June 28th, 2003 - +---------------------- +bluecow: Added the code to process the incoming Keyword Search Requests. +Unk: Added a simple response packet to keywords. +bluecow: Fixed a crash on exit bug. + +---------------------- +- June 27th, 2003 - +---------------------- +Unk: Entries in the Index list can now be removed. Which also fixes a bug with a lot of dangling pointers when restarting the overnet connection.. :) +Unk: Fixed a bug that caused all kinds of issues if you disconnected and reconnected real fast with overnet. + +---------------------- +- June 26th, 2003 - +---------------------- +Unk: Overnets overhead is now processed and added to the server catagory. +Unk: Tweaked the overhead a little to try to get better estimates. +bluecow: Fixed a deadlock at shutdown. +bluecow: Fixed a bug when restarting ON during a single eMule session. +Unk: Fixed a bug that allow the connect button to get confused. +Unk: Fixed a bug that crash when trying to bootstrap + +---------------------- +- June 25th, 2003 - +---------------------- +Unk: There are now preferences that allow the user to choose which network to connect too. +Unk: Added Network Choice to First Time Wizard. +Unk: Changed how connection status is relayed between Overnet and eMule. +Unk: Fixed some issues with the search dialog. SearchID is no longer and issue between eMule and Overnet and you can now select which network so search. + +---------------------- +- June 24th, 2003 - +---------------------- +Unk: IP request now responds if the other client is firewalled. +Unk: Found that damn bug that wasn't deleting clients when the socket timed out.. +Unk: Cleaned up some code. + +---------------------- +- June 22nd, 2003 - +---------------------- +Unk: Corrected a bug that didn't let you just connect to Overnet. +Unk: Fixed duplicate keyword indexed files. +Unk: Rolled back to VS2002.. Seems to have corrected the socket bug. +Unk: Removed a gui slowdown when a search quit and all the temp contacts were removed. +Unk: Completely rewrote the messaging code between eMule and Overnet to clean it up. +Unk: Added refresh messages to the Overnet lists. There should be no more ghosts or blanks in the lists. +Unk: Your ID is now calculated differently. Also there is a better check if your firewalled if using both networks at once. +-If you are seen to not be firewalled by either Overnet or ED2K, eMule will assume your not firewalled. +-If either ED2K or Overnet has a high ID, eMule will use it. +-If the server things your firewalled and Overnet knows better, you can still download from lowID users. +-If the server things your firewalled and Overnet knows better, you will tell the other clients the correct ID. +-Because we do not support firewalled users in Overnet yet, if you want to use overnet, you must also connect to a server before eMule starts working. + +---------------------- +- June 6th, 2003 - +---------------------- +Unk: Tried to go through and clear up some areas that check for LowID and Connected status. + +---------------------- +- June 5th, 2003 - +---------------------- +Unk: Changed up the ON gui some.. Although it's not great, the lists are now seperate for easier manipulation later. +Unk: Fixed duplicates of fileID indexed files. + +---------------------- +- June 4th, 2003 - +---------------------- +Unk: Now responding to fileID search requests and sending and search_end packets +Unk: Connect button support added. +Unk: The OVERNET_IDENTIFY_ACK now updates the TCP port of the Contacts and Indexes. (This was messing this up, needs redone) +Unk: Added a Firewall recheck button. +Unk: Change how it checks if firewalled. (Less wasted packets, better timing.) + +---------------------- +- June 3rd, 2003 - +---------------------- +Unk: Changed how it displays connection status. +Unk: Searches are now terminated better when a file is Stoped, Paused, or Canceled. + +---------------------- +- June 1st, 2003 - +---------------------- +Unk: The timer for checking dead servers was changed to now get messed up when resetting your computer. +Unk: Server Description requests delay has been increased to save server bandwidth. +Unk: Found a major bug that sent packets to the wrong IP.. We now index Overnet publish requests. + +---------------------- +- May 26nd, 2003 - +---------------------- +Unk: Knownfile met is now saved periodically. +Unk: Published ON files are now remember between restarts to cut down over publishing. +Unk: We now detect if the our ON client is firewalled. Also, if the server side thinks we are firewalled but overnet isn't, we use the Overnet ID instead of the server ID. +Unk: Found out that many of the mldonkey clients don't publish correctly. Hours wasted trying to debug a packet that is incorrect.. +Unk: Changed the order of publishing to make it more efficient. +Unk: No longer treat bcp://hashid:ip:port as a source. These are firewalled sources and the ip and port is the firewalled server, not source.. +Unk: Corrected the searches to reflect correct search types. +Unk: Uploading clients could get stuck in the upload list without a socket. This is the same problem as noted above, therefore it's not the sole problem with FileNotFound. + +---------------------- +- May 26nd, 2003 - +---------------------- +Unk: Adding the overnet to the client brought up unknown issues with the original client. +1. Rewrote how clients and sockets delete each other to avoid clientlist & socketlist corruptions. +2. Clients are able to get in a connected or connecting state without a socket, these clients are now removed. (This may be releated to FileNotFound packets. Will rework that later..) + +---------------------- +- May 22nd, 2003 - +---------------------- +Unk: Merged the base Kademlia code into eMule with the help of bluecow. +Unk: Added a Overnet debug window. +Unk: Added many new Overnet opcodes. +Unk: Can now download from Overnet clients. +Unk: Note to self: Need to find out why incoming Publish Requests send UDP port, but when we send a publish request, we HAVE to send a TCP port??????? (Fixed: mldonkey is the one sending UDP port which is incorrect and very bad!) +Unk: Can now publish to the Overnet network. (Something still doesn't seem correct with Publish Requests) +Unk: Indexing Overnet files. (Something still doesn't seem correct with Publish Requests) +Unk: Beging to change the eMule base code to better handle the Overnet network as a seperate network. (So you can use both or just one) +Unk: Duplicate clients are now found a little better. More CPU power needed, but it had to be done to detect cross source findings.. +Unk: CUpDownClient::CalculateDownloadRate() is causing strange exceptions.. WHY? (Update: fixed) + +---------------------- +- March 16th, 2003 - +---------------------- +Unk: Changed opcodes to match eMule for easier merging later. + +---------------------- +- March 15th, 2003 - +---------------------- +Unk: Original Programmer of Kad seems to have left the building. I'm am going through the code trying to see where he was going with it.. + + + +PRIOR 0.4x +=================== + +v0.30e +---------------------- +- Dec 9th, 2003 - +---------------------- +bluecow: Fixed very rare occuring bug with decompressing of high compressable blocks. +bluecow: Improved error handling for decompressing corrupted blocks. +bluecow: Upgraded to zlib 1.2.1. + + +0.30d +---------------------- +- Nov 20th, 2003 - +---------------------- +.: Missing language-dlls are now downloaded and installed automatically by emule +.: Changed auto-versioncheck to a DNS-based method which is more effictive. Also the auto-versioncheck is now enabled by default. +.: Updated MobileMule protocol to 6b + +---------------------- +- Nov 16th, 2003 - +---------------------- +Ornis: some changes for less CPU load +Ornis: Searchlist: contextmenu also provides download in paused mode selection +Ornis: copy a selected comment to the clipboard [NoamSon] + +---------------------- +- Nov 7th, 2003 - +---------------------- +Ornis: Save IRC/Messages-chats to disk (context menu) +Ornis: preferences-webinterface: enable/disable usage of GZIP compression + +---------------------- +- Nov 5th, 2003 - +---------------------- +bluecow: Fixed rare occuring problem with staled server source request related to invalid part.met file contents. +bluecow: More safety in part.met file reading. +bluecow: Fixed problem with too frequently occuring server connection attempts with very short server lists. + +---------------------- +- Nov 2nd, 2003 - +---------------------- +bluecow: Fixed minor issue with queued local server source requests after new server connect. +bluecow: Fixed sorting of buffered part file blocks to achive less HD stress. +bluecow: Fixed memory leaks and flushing of buffered data to HD of paused files when file was canceled. +bluecow: Files which could not be completed because of not enough free disk space can be resumed manually to try another file completion process. +bluecow: Fixed bug in check min. free disk space which could cause endless low disk space notifications. +bluecow: Improved check min. free disk space for better handling NTFS compressed/sparse files. +bluecow: Fixed a bug where an NTFS compressed file could not be created because there was not enough free disk space to hold the uncompressed file. +Ornis: updated importer to load eD/ON v0.48 partfiles + +Unk: Several bugs noted in the forum. Tried to check most of them. +* Sources to a Paused or Stopped file will be removed once an hour to remove old sources.. +* We no longer send sources to Paused or Stopped files. +* A better check of valid sources to Part files for source exchange. +* Source exchanges for complete files now sends sources with obtained parts first. +Unk: Removed some redundent For Loops to save CPU in the DownloadQueue.. + +---------------------- +- Oct 30th, 2003 - +---------------------- +bluecow: Added grouping of local server source reasks packets into one TCP frame +bluecow: Fixed bug with check diskspace +bluecow: Fixed problem with lost read-only settings in pref.ini after version change +bluecow: Fixed server TCP overhead statistics +bluecow: Fixed HTTP download dialog string resources + + +0.30c +---------------------- +- Oct 23th, 2003 - +---------------------- +bluecow: Fixed multi threading problem with a completing file which was concurrently uploaded. + +---------------------- +- Oct 22th, 2003 - +---------------------- +Ornis: added ability to import partial downloads from Overnet/eDonkey when having used the "old style" format +bluecow: Fixed potential exploit due to memory corruption in webserver [MoNKi] + +---------------------- +- Oct 19th, 2003 - +---------------------- +bluecow: Fixed bug with friends where a client without an IP or hash could be added as a friend. +bluecow: Fixed bug with ed2k URL registry key where path contains special characters. +bluecow: Fixed GDI resource leaks in video preview dialog. + +---------------------- +- Oct 12th, 2003 - +---------------------- +Ornis: Import partial downloads from eDonkey/Overnet ("new style"-splitted partfile). Build-in converter to import downloadfiles from a selected folder to your eMule-downloads right away. (use the Hotmenu Alt+X to access it) +Ornis: Serverlist highlights the currently connected server + +---------------------- +- Oct 9th, 2003 - +---------------------- +Ornis: dynamic category tabcontrol size +Ornis: prevent empty date/time output with faulty preferences.ini + +---------------------- +- Oct 7th, 2003 - +---------------------- +bluecow: Fixed bug with upload list control which was not refreshed automatically [Xman1+KuSh] +bluecow: Fixed mouse/keyboard acces bug in HyperText control [MoNKi] +bluecow: Added keyboard shortcuts to main toolbar. + +---------------------- +- Oct 5th, 2003 - +---------------------- +bluecow: Fixed bug with server warning messages which were shown as errors. +bluecow: Fixed bug with random drawn block requests in file progress bars. + +---------------------- +- Oct 4th, 2003 - +---------------------- +Ornis: set speedlimits to unlimited manually (again) +bluecow: Changed several resource string loading code to support string based resource identifiers [SlugFiller+itsonlyme] +bluecow: Added: download links can contain hostname sources, instead of just IP address; You can set your own hostname in preferences, and create eD2K links with sources with your chosen hostname instead of your IP [SlugFiller+itsonlyme] +bluecow: Added speed improvements made to the bar shader, making it display much faster than before [SlugFiller] +bluecow: Added code improvements for faster sorting complete sources [SlugFiller] +bluecow: Added sorting of complete source column in shared files window [SlugFiller] +bluecow: Fixed visual bug in upload status bar [wistily] +bluecow: Added check free diskspace option which ensures that complete files can be stored [SlugFiller] +bluecow: Added check free diskspace option which ensures that a minimum of free diskspace remains available. +bluecow: Added uncompressing of NTFS compressed files for completed files. + +---------------------- +- Oct 1st, 2003 - +---------------------- +bluecow: added the long awaited More button to search window for getting more search results from the local server. +bluecow: rewrote tooltips for transfer window to fix several small glitches. +bluecow: buffered partfile data is explicitly written to disk before a preview command is invoked. +bluecow: partfile disk usage is determined with respect to NTFS compression and/or NTFS sparse files. +Ornis: new translation: Czech, by Patejl + + +0.30b +---------------------- +- Sep 25th, 2003 - +---------------------- +bluecow: Added server TCP connection keep alive function. +bluecow: Tooltips in search results listview are shown only if Shift+Ctrl is pressed while moving the mouse over a listview item. + +---------------------- +- Sep 24th, 2003 - +---------------------- +.: You are now able to preview shared video files from clients who let you see their share. You will be able to view 5 screenshots of the first ~10 min. +.: Upgraded MobileMule Protocol to 5x. Note that you need to download the new clientversion too if you use MobileMule. +.: Merged some code changes from eMule Plus +Ornis: larger category control when several categories are added (simple condition for now) +Ornis: show A4AF-count for files in the downloadlist when additional controls are enabled + +---------------------- +- Sep 21th, 2003 - +---------------------- +Ornis: added disk usage statistics [emule+] + +---------------------- +- Sep 18th, 2003 - +---------------------- +bluecow: Fixed bug with invalid client objects in upload list after a file was unshared/reshared [zegzav] +bluecow: Shared files listview and Search Results list view; Alt+DoubleClick opens Details dialog. +bluecow: Fixed several format string errors [mandrag0re] + +---------------------- +- Sep 15th, 2003 - +---------------------- +bluecow: Added support for showing all available MP3 tag information for downloads and shared files. + +---------------------- +- Sep 14th, 2003 - +---------------------- +bluecow: Added support for extended UDP server protocol for lugdunum 16.40 servers to receive multiple file search results in one UDP packet. [thx lugdunum for coop.] +bluecow: Server UDP socket handles blocking socket state which could happen for larger UDP packets. +bluecow: More helpful error/logging messages for server UDP socket related functions. +bluecow: Optimizations in server UDP socket code for less CPU load (avoiding memory copy operations). +bluecow: Fixed bug in client UDP socket which did not handled the blocking state correctly. +bluecow: Search parameters are saved for each search result list; when selecting a search result list, the used search parameters are restored in the according controls +bluecow: When deleting a search result list the search result list following the deleted one is selected instead of the first one +bluecow: Last used search method is saved and restored in next eMule session. +bluecow: Servers can be added by pasting an eD2K server link into the IP address control of the server window. +bluecow: Shared files and downloading files are not counted in search results for the search result limit. + +---------------------- +- Sep 11th, 2003 - +---------------------- +bluecow: Added server TCP/UDP protocol logging+debug code. +bluecow: Added support for new welcome server message from lugdunum 16.40 servers. +bluecow: Added support for compressed server protocol for lugdunum 16.40 servers; welcome message and file search results are received as compressed data; shared files are sent to server as compressed data +bluecow: Added support for extended UDP server protocol for lugdunum 16.40 servers; global source finding is done more effeciently and with less bandwidth. +bluecow: Fixed crash bug in host name resolution. +bluecow: A global file search is started if the local server does not answer with file results within max. 50 seconds. +bluecow: Fixed bug with eD2K link control in search window which did not accept more than 3 or 4 links. + +---------------------- +- Sep 1st, 2003 - +---------------------- +bluecow: Meta Data and File Comments dialogs changed into property pages which are shown together with File details property sheet. All property sheet/page related dialogs are resizeable and restore LRU size+position. Widths of columns in File Comments. File Names and Meta Data listviews saved+restored. Same applies for Meta Data dialogs for search results and shared files. +bluecow: New "Match keywords" search option for both Jigle search methods. + +---------------------- +- Aug 30th, 2003 - +---------------------- +bluecow: Change in usage of search file type parameter "Program": When searching for a file of type "Program", the results are no longer locally filtered according Windows Program Files extension (*.exe, *.com, *.bat). The eD2K file type "Program" is meant to contain all file types which are "used" by a program like compressed archives and CD-ROM images. This means that you will get more search results than in previous versions. If you still want to search for a Windows Program File, specify "exe" for the file extension. +bluecow: Added proxy support for IRC; alle proxy settings are also used for IRC +Ornis: bugfix in webserver socket code, [Jan B.,nice bugreport] + +---------------------- +- Aug 29th, 2003 - +---------------------- +Ornis: Filedetailsdialog restructured, + showing date of downloadstart and duration since (until now or until download completion) +Ornis: added some missing percentages in the statistic tree +Ornis: added option to scheduler, to disable the endtime and therefor make changes of an event permanent + +---------------------- +- Aug 26th, 2003 - +---------------------- +bluecow: More tweaks in the gSOAP module for better performance with Jigle server and reliable compiling by modders (Modders: always ensure that WITH_GZIP is defined!); a Jigle search request always has to include either a file type and/or a file extension, otherwise the request will not be sent for reducing server load; HTTP User-Agent field changed to reflect eMule version. +bluecow: Fixed several issues with the new CComboBoxEx control (keyboard interface). +bluecow: Several visual changes in the new search list view for proper windows color scheme handling and sorting of child items + +---------------------- +- Aug 24th, 2003 - +---------------------- +bluecow: Added support for Jigle SOAP interface to search the Jigle database with eMule [special thanks to Melange from Jigle for offering this great feature to eMule] +bluecow: Jigle SOAP interface: search results are limited to 100 results; optimized code for less server load; local filtering of search results +bluecow: Added extended combobox control for search methods [eMulePlus] + +---------------------- +- Aug 22th, 2003 - +---------------------- +Unk: Irc: Nicks are now sorted correctly. +Unk: Irc: If another nick is an eMule you can add them as a friend. (Both clients must be v0.30b and up) +Unk: Irc: You can now directly send download links to other eMules. (Kinda like DCC, both clients must be v0.30b and up) +Unk: Publishing shares to the server is now done better to reduce traffic. +Unk: Added: Display of an estimated count of complete sources for files in the downloadlist and shared-files-list [modified Zegzav] + +---------------------- +- Aug 20th, 2003 - +---------------------- +Ornis: fixed some statistics, like count of banned sources, A4AF-sources +Ornis: fixed search via webinterface +Ornis: fixed some not updated labels when changing language [itsonlyme] + +---------------------- +- Aug 19th, 2003 - +---------------------- +bluecow: Language DLLs are no longer loaded if the version information stored in the DLL does not match the eMule application version information. +bluecow: Fixed colors of search results and log windows texts to be properly/visible in Contrast-Windows color schemes. + + +v0.30a +---------------------- +- Aug 15th, 2003 - +---------------------- +bluecow: Added dialog for showing the eD2K meta data for search results, download files and shared files. The according context menu item is only in "Advanced mode" available. + +---------------------- +- Aug 14th, 2003 - +---------------------- +.: Added some new checks and fixes in order to ban unfair clients +.: Changed the TCP (local) and UDP (global) source search for clients who are downloading many files, to make some server software happy one more time and to avoid blacklisting +.: Unused credits are removed after 5 month (to limit the memory usage for credits) + +---------------------- +- Aug 12th, 2003 - +---------------------- +bluecow: Server error messages are no longer displayed in the server info window, but in the application log window. +bluecow: ED2K file meta data received during a file search is filtered before adding it to the part.met and eventually to the known.met file to avoid storing of not needed data. +bluecow: Several changes in the file preview command: The preview command is enabled, if a minimum of 16 KB (MPEG audio/video) or 256 KB at the beginning of the file is available. The preview command is also enabled for files of type "CD-ROM image" or if the ED2K meta data indicates an audio/video file type. To enable the new features of the preview command specify VideoLAN client as the video player for preview or (if using some other player) specify the 'PreviewSmallBlocks=1' (section=eMule) setting in the preferences.ini file and disable the 'Create backup for preview' option. +Ornis: better counting of the stats: saved by ICH, lost due to corruption and saved by compression +Ornis: little GUI fixes/updates + +---------------------- +- Aug 10th, 2003 - +---------------------- +Ornis: Source-swapping cares for download priorities now and is more safe against useless handing over sources back and forth +Ornis: Alt-Return opens detail dialog for downloads and user +Ornis: added Enhanced Chunk Selection, better selection which part of a file to download next [Maella & jicxicmic] + +---------------------- +- Aug 4th, 2003 - +---------------------- +bluecow: Added extracting of meta data and audio/video characteristics for MP3,AVI,MPEG and other files. To disable this option use the "ExtractMetaData" setting (file=preferences.ini, section="eMule", name=ExtractMetaData, value=0 (disable), value=1 (enable for MP3 and AVI files), value=2 (default; enable for MP3, AVI, MPEG and other files). +bluecow: Added sending of extracted meta data and audio/video characteristics for MP3,AVI,MPEG and other files to servers and clients. The text meta data (e.g. Title, Author, Album) is not sent to the servers but to clients when viewing the shared files. Data sent to servers includes audio/video codec, media length and bitrate. +bluecow: More safety in checking shareable files in temporary directory. + +---------------------- +- Aug 2nd, 2003 - +---------------------- +bluecow: Added new Server Info window with optional auto scroll, rotating log, copy+paste +bluecow: Added new option to specify or to disable the server UDP port (file=preferences.ini, section=eMule, name=ServerUDPPort, value=0 (disable server UDP port), value=65535 (default; use random server UDP port), value= (UDP port) +bluecow: Added some helpful server socket error messages. +bluecow: Fixed some minor focus problems in search window. +bluecow: Added more columns to search list for showing new ed2k meta tags. +bluecow: Format of date/time strings is no longer dependent of the selected language. +bluecow: Statusbars of paused files are shown in a dimmed colors [SlugFiller grayPause] + +---------------------- +- Aug 1st, 2003 - +---------------------- +bluecow: Splitted the taskbar notification for "Download finished and new add file added" + +---------------------- +- July 30th, 2003 - +---------------------- +bluecow: Fixed some security bugs concerning log messages [thx i0nic] + +---------------------- +- July 29th, 2003 - +---------------------- +.: Made some changes and fixes in SecureHash. Also clients with the status "invalid" will no longer be able to use a Friend Slot +.:Implemented MobileMule protocol 0.4 (visit mobil.emule-project.net for more info) +bluecow: ED2K protocol: fixed handling of OP_FILESTATUS for files with a size of PARTSIZE*N +bluecow: Fixed crash at exit bug which occurred when flushing internal file data buffers to part files +bluecow: Fixed crash bug with clients sending more than one OP_HELLO packet. + +---------------------- +- July 27th, 2003 - +---------------------- +bluecow: Fixed handling of hashsets for files with a size of PARTSIZE*N +bluecow: Invalid entries in known.met are deleted at startup +bluecow: ED2K protocol: OP_SETREQFILEID is no longer sent for files <= PARTSIZE +bluecow: ED2K protocol: OP_FILEREQANSNOFIL is no longer sent when receiving OP_FILEREQUEST + +---------------------- +- July 25th, 2003 - +---------------------- +Ornis: manual disable textbox auto-completion in the preferences.ini file, by setting "UseAutocompletion=0" +Ornis: Webinterface: added sorting of search results +bluecow: searching of listview items for all owner drawn listview controls (just type the first view characters of the label to find) [ZZ] + +---------------------- +- July 22th, 2003 - +---------------------- +bluecow: Disabled sharing (by accident) of eMule installation folders (config, lang, webserver) and several files from the temporary directory. +bluecow: Fixed a rare problem where a client could receive properly compressed blocks but was though not capable of decompressing the entire compressed stream. +Ornis: Fixed Drag&Drop-image of downloadfiles + +---------------------- +- July 20th, 2003 - +---------------------- +Ornis: IRC- & Message-Windows use closeable tabs now +Ornis: history function in the IRC- & messages-dialog, scroll by cursor up & down +Ornis: Doubleclick on serverinfo in the statusbar opens a dialog with the details of the connected server +Ornis: new downloads catched from the browser are now assigned to the current targetcategory from the search-dialog +Ornis: to reset the popup-history of searchtext/serverlist-URL : press ALT or CTRL and then DEL +Ornis: Statistics: percent display of successful/failed upload sessions added +Ornis: Fixed count of failed upload sessions [Maella] + +---------------------- +- July 19th, 2003 - +---------------------- +bluecow: Fixed bug with downloading of files with a size of 9728000 bytes. +bluecow: Added several parts of SlugFiller's SafeHash [SlugFiller] +- SafeHash: Known file hashing features +- SafeHash: Miscellaneous safety and tweaking features +Ornis: improved update of the downloadlistcontrol, when new sources are added to an expanded downloadfile +Ornis: Fix of a typo in the webinterface, which could have led to instability on some systems +Ornis: Webinterface: (re)added two settings in the preferences +bluecow: Upgraded to CTreeOptionsCtrl v1.55 [thx PJ Naughter] +bluecow: New log panes, multiline edit controls with optional auto scroll and rotating log. +(Note: The previously used "MaxLogMessages" entry in preferences.ini is obsolete and is replaced with "MaxLogBuff" which +can be used to specify the size of the buffer(s) in KByte. Default size = 64 KByte) +bluecow: Searchresult list: Search results which match files in the download list are shown in a fixed shade of red. +bluecow: Font for Server-, Message- and IRC-Window can be specified. +bluecow: Timestamp setting for IRC-Chat also applies timestamps to messages from clients in Message window. +bluecow: Timestamps in IRC-Window and Message-Window localized. +bluecow: Added memory debug statistics for debug builds only [UVman] + +---------------------- +- July 18th, 2003 - +---------------------- +Ornis: Added extended control: manual handling of sources, at several requests to the same client (A4AF) [based on sivka,enkeyDEV] +Ornis: Added: automatic assignment of new Download to categories by filename filters [HoaX_69] +Ornis: corrected saving position for the scheduler-ini-file (-> \config\ ) + +---------------------- +- July 16th, 2003 - +---------------------- +bluecow: Fixed bug with downloading of files with a size greater thean 2 GB [thx Maella] +Ornis: Bugfix: spanish & french translation bugfix. (bug resulted in less search results) +Ornis: better update of the SecureIdent-statistic + + +v0.29c +---------------------- +- July 13th, 2003 - +---------------------- +bluecow: Several small bug fixes and code improvements [Maella, dpr, rayita] + +---------------------- +- July 11th, 2003 - +---------------------- +Ornis+bluecow: String resources split into language resource DLLs [Elandal] + +---------------------- +- July 9th, 2003 - +---------------------- +bluecow: Fixed flaw in IPFilter. + +---------------------- +- July 7th, 2003 - +---------------------- +bluecow: Added LAN-IP and IP-Filter for server IPs and client IPs received during source exchange and received from servers. +Note: The option "Server/always filter bad IPs" was changed to handle the LAN IP filtering of IPs for servers and +clients and was moved to the "Extended Settings" page and is now called "Filter server and client LAN IPs". +If you are running eMule within a LAN you may decide to disable this option to be able to communicate with +servers and clients within the LAN. + +---------------------- +- July 5th, 2003 - +---------------------- +.: Added some SecureHash security fixes, also SecreHash is now enabled by default +.: The Queueposition (waitingtime) is now also protected by SecureHash (if enabled) +.: Fixed a bug which caused source to have wrong information and filecomments/names +bluecow: Fixed problem with completing file which was concurrently uploaded. +bluecow: Fixed bug with previewing of files with spaces in the path [mediterranean] +bluecow: Fixed bug with client deletion [SlugFiller] +bluecow: Fixed minor bug in statistics with error and banned client stats. + +---------------------- +- July 2nd, 2003 - +---------------------- +bluecow: Better filtering of sources according valid IP+Port found during file searches. +bluecow: Added boolean search expressions (AND, OR and NOT operator and parenthesis) + +---------------------- +- July 1st, 2003 - +---------------------- +bluecow: Fixed minor bug in search query with file extension. +bluecow: Added version column of server software to server listview control. +bluecow: Fixed minor bug where the 0.0.0.0 ServerIP of some clients were added to the server list. +bluecow: Fixed bug with compressed control data packets length [thx MKThunderStorm] +bluecow: Optimized source exchange for clients which are asked for sources for the first time in the current session. + +---------------------- +- June 30th, 2003 - +---------------------- +bluecow: Added more units for specifying min/max filesize in search dialog. (append b[yte],k[byte],m[byte],g[byte] to the numbers to change the units). +Ornis: minor tweaks in the filename cleanup +Ornis: corrected codepage-settings for turkish language in the webinterface + +---------------------- +- June 29th, 2003 - +---------------------- +bluecow: Fixed mem leak in upload client caused by clients requesting too large blocks. +bluecow: Fixed mem leak with duplicate hashed files. +bluecow: Couple of changes for more stable code and less potential mem leaks. +Ornis: Fix, preventing crashes after IRC disconnection +Ornis: Show size of partfiles on disk (Filedetails & Tooltip) +Ornis: little GUI fixes + +---------------------- +- June 27th, 2003 - +---------------------- +bluecow: Added sending shared files list to server with ClientIP+Port to get more sources when performing global UDP search requests. +bluecow: Added sending shared files list to server with more meta tags for more accurat search results according file extension and file type. +bluecow: Added tooltip for showing the entire meta data for a search results which was received from the server/client. + +---------------------- +- June 25th, 2003 - +---------------------- +bluecow: Added overlay icons for clients which were successfully identified by a secure hash +bluecow: Fixed bug with GetTickCount timer meassurement [dpr] +Ornis: Added Secure-Ident-Statistic (how many successfully and how many failed identificated clients) +Ornis: Fixed menu-ressource bug in the preferences +Ornis: Turkish language fix + + +v0.29b +---------------------- +- June 17th, 2003 - +---------------------- +bluecow: Dragstart of category-tabs not hypersensible anymore +Unk: Irc: Now detects UnderOps. +Unk: Desc ping to servers are now done less frequent. +Unk: Fixed a bug in the server ping time delays. +Unk: Fixed a small bug in the stats. +Ornis:Speedmeasurement tweaked [zz] + +---------------------- +- June 15th, 2003 - +---------------------- +bluecow: Fixed bug with an deleted client instance which was used for the A4AF statistics value. +bluecow: Redid Ext. Settings dialog for more future options. +Ornis: Webinterface: Links are relative now +Ornis: improved UNC usage as shared folders +Ornis: Fixed known.met to be handled correctly in the config-folder +Ornis: better handling of the check which files to hash +.: Added a secure identification system (against userhash "stealing") based on RSA encryption. For test reasons, it is disabled by default in this version, you can enable it in "security settings". Please check the FAQ for more informations about this system +.: Added first part of an advanced spamfilter which automatically detects and filters suspicious messages + +---------------------- +- June 13th, 2003 - +---------------------- +Ornis: Webinterface: Improved Graphs, bigger, nicer, including the connection-graph [emule+] +Ornis: Webinterface: added button to remove completed files +Ornis: Sharedfileslist: Click with middle mouse button on an item opens the comment dialog of it +bluecow: Implemented ed2k protocol message OP_CHANGE_CLIENT_ID for better dealing with LowID sources. +bluecow: Fixed several issues in dealing with uninitialized memory contents [donq] +bluecow: Fixed problem with wrong file IDs received from clients. +bluecow: Workaround for strange socket deletion crashs which were experienced by WinXP users. + +---------------------- +- June 12th, 2003 - +---------------------- +bluecow: Fixed several potential heap corruptions. +bluecow: Fixed problems with download data rate meassurement which may cause crashs on slower/Win98 systems. +bluecow: Fixed problem with processing an invalid OP_HELLO packet from a client. + +---------------------- +- June 9th, 2003 - +---------------------- +bluecow: Added option "CommitFiles" to select the level of commiting file data to disk (may be interesting for Win98 users) [idea SlugFiller] + +---------------------- +- June 8th, 2003 - +---------------------- +bluecow: For modders only: Added the possibility to compile the sources for string based resource string identifiers (search for USE_STRING_IDS) + +---------------------- +- June 7th, 2003 - +---------------------- +bluecow: Fixed bug in server message handler for OP_SERVERIDENT. +bluecow: More safety in handling server message OP_SERVERMESSAGE and client message OP_MESSAGE. + +---------------------- +- June 6th, 2003 - +---------------------- +Ornis: saving location for own comments corrected (config-path) +Ornis: Webinterface: Categorysupport corrected for order by columns +bluecow: Fixed a potential problem with system tray icon on Win98 systems [Special thx to Ergol/donq] +bluecow: Reduced size of search expression + + +0.29a +---------------------- +- June 2nd, 2003 - +---------------------- +Ornis: fixed Win9x incompatibility (instable OS) +Ornis: some menues missed localization after runtime language change - fixed + +---------------------- +- June 1st, 2003 - +---------------------- +bluecow: Sources found during local/global server searching are pre-filtered to avoid false displayed results in the sources column of the searchlist and to avoid using false sources which are sent by some servers. +bluecow: Fixed bug with completed files which were rehashed at next startup and which caused a duplicate entry in known.met. + +---------------------- +- May 31th, 2003 - +---------------------- +bluecow: Fixed minor issue with servers sending different server description packets during runtime. + +---------------------- +- May 29th, 2003 - +---------------------- +bluecow: Fixed bug with temp folder which was set to incoming folder in some situations. +bluecow: Fixed minor bugs in file open and browse folder dialogs and according property pages. +Ornis: Shareaza recognition for Stats & Info +Ornis: added new language Galician (by Emilio) + +---------------------- +- May 28th, 2003 - +---------------------- +bluecow: Fixed memory leaks in uploader. +bluecow: Fixed memory leaks in all timer callback functions; added exception handling. +bluecow: Reduced GDI resource usage for Win9x/WinME. +bluecow: Added more debug log messages for unknown TCP packets. +bluecow: Statusbar text is cleared when reseting the log or debug log. +bluecow: Fixed missing file exception handler in upload function. + +---------------------- +- May 27th, 2003 - +---------------------- +bluecow: Fixed some problems with part.met/part files which could be to long or to small (potential file-completion bug) [SlugFiller] +bluecow: Fixed memory leaks in Archive Recovery thread. +bluecow: Fixed crash in Archive Recovery thread when previewing part files which are currently in "completing" state. + +---------------------- +- May 26th, 2003 - +---------------------- +Ornis: Webinterface: Fix: under certain circumstances, active downloads were displayed as completed +Ornis: added new language Galician (by Emilio) +bluecow: Fixed major memory leaks in WebSocket. +bluecow: Fixed couple of GDI resource leaks and inproper usage of GDI resources. +bluecow: Added proxy error messages. To enable it: Specify "ShowErrors=1" in "[Proxy]" section of preferences.ini. +bluecow: Fixed problems with duplicate sources due to source exchange packets with wrong version. +bluecow: More reliable identification of clients sending an UDP packet by searching clients with IP and UDP port + +---------------------- +- May 24th, 2003 - +---------------------- +Ornis: moved preferences files to "config\" subfolder (cant be shared, old preferences files are moved the at first start) +Ornis: Category-Tabs now sortable (Drag&Drop) + +---------------------- +- May 21th, 2003 - +---------------------- +VQB: changed LowID UL slot addition to alternate with HighID +VQB: some code cleanup and changes to use more integer math [Elandal] +Ornis:Webinterface: progressbar shows shades of blue, depending on the amount of found part-sources [Ju1i3n] +VQB: adjusted sort order for QR (high speed -> low speed DL followed by low -> high QR) + +---------------------- +- May 19th, 2003 - +---------------------- +Ornis: Webinterface: fix add ed2k-Download to a category +Ornis: Webinterface: transferlist offers more categories to filter for (file type, status) +Ornis: update statistic graphs scale when changing up/down capacities over the webinterface +Ornis: upgraded AsyncSocketEx to v1.2 +bluecow: Fixed potential problems for Win98 concering windows messaging. + +---------------------- +- May 17th, 2003 - +---------------------- +bluecow: Fixed bug in server window when sorting by server IP +bluecow: Fixed 0-size part.met backup file bug. +bluecow: Fixed potential mem leaks and crashes for several met-file IO related functions by rewriting exception handling. +bluecow: Added system error messages for all file-IO related eMule log messages. +bluecow: Added recently used list for search text and servemet-URL controls (aka autocompletion), reset history by AltGr+Delete) +bluecow: Added searching for listviews in serverwindow/searchwindow (Ctrl+F,F3,Shift+F3) +Ornis: fixed win9x-crash when the view-filter popupmenu of the category-tab was accessed +Ornis: fixed preview of archives before any download +Unk: Fix small overhead bug +Unk: irc: Liquid updated their ircd. It broke eMules IRC.. It is now updated.. +Unk: irc: eMule now should support multi mode commands. + +---------------------- +- May 16th, 2003 - +---------------------- +bluecow: Fixed potential mem leak when copying text into the Windows clipboard. +Ornis: Added a lot of new statistics (by Khaos) +Ornis: fixed Scheduler bug +Ornis: Added configuration for date/time-format of the log + +---------------------- +- May 15th, 2003 - +---------------------- +bluecow: Fixed LowID bug which was cause due to corrupted part.met files. +bluecow: Fixed loading of part.met file list: Corrupted part.met files do no longer stop the loading of other part.met files. +Sony: Fixed problem with very large files in MSVC 7.1 release build; Fixed Minimize to Tray icon (thanks zegzav) + + +v0.28b +---------------------- +- May 8rd, 2003 - +---------------------- +Ornis: Categories: extented choice of the function of the old "all" tab, switchable to Video,Audio,Transferring,Erroneous ,... +Ornis: Upload-, Queue- and Knownclientlists are titled with the number of the listed clients +Ornis: different trayicon when serverconnection with a lowID (emule with blindfold, from emule+) +Ornis: Webinterface: category support +Ornis: Webinterface: displays completed transfers + +---------------------- +- May 3rd, 2003 - +---------------------- +bluecow: Fixed mem leak when downloading server.met via HTTP [UVman] + +---------------------- +- May 2nd, 2003 - +---------------------- +bluecow: Fixed another bug where an unwanted client could become a friend. + +---------------------- +- April 28th, 2003 - +---------------------- +bluecow: Fixed minor glitch with icons in tab controls on server and message window. +bluecow: Added standard shortcuts to log and debug listview controls (Copy=Ctrl+C, Select All=Ctrl+A) +Ornis: Websearch Filedonkey.com now supports filter by filesize-limits + +---------------------- +- April 27th, 2003 - +---------------------- +bluecow: Rewrote entire packet processing code to use exception handling and proper memory cleanup. +bluecow: Rewrote most of the meta tag processing code to support new meta tags. +bluecow: Fixed downloading of stopped or paused files. +bluecow: Added passive source finding for files in download queue which were just started and not already in shared file list. +bluecow: Fixed minor mem leaks and improper usage of delete operator [NoamSon] +Ornis: Webinterface blocks IPs after 5 failed login attempts for 15 minutes +Ornis: Filenamecleaning: customizable substringfilter (.ini : FilenameCleanups= ) +Ornis: option to auto-clean filenames on downloadstarts + +---------------------- +- April 26th, 2003 - +---------------------- +Ornis: If the connected server has a filelimit, announce not more files than accepted + +---------------------- +- April 25th, 2003 - +---------------------- +bluecow: Fixed bug with empty shared directories and OP_ASKSHAREDFILESDIR. +bluecow: First Run Time wizard finally gets a "Finish" button. +Ornis: Links in Chat (hypertextctrl) dont break on special chars anymore +Ornis: better URL decoding (e.g. for special chars in ed2k links) + +---------------------- +- April 24th, 2003 - +---------------------- +bluecow: Fixed bug with OP_ASKSHAREDIRS where a client could ask for shared directories while there is a currently a shared files list received. Note: The viewing of shared directories of remote eMules was reset to 0.28+ because of a bug in 0.27. +bluecow: Fixed major memory leak with compressed packets (thx Blackstar2) +bluecow: Fixed bug with new meta tags of type "float" which were sent by servers which are offering shared files from Hybrid's 0.48+ +Ornis: Scheduler Fixes +Ornis: Schedules can be activated directly via hotmenu (Alt-X) , (de)activating of the scheduler as well +Ornis: identical shared folders are not sent multiple times anymore (under circumstances) +Ornis: added: accurate speed measurement also on busy CPU [based on Ottavio84+Badwolf] +Ornis: small GUI-fixes + +---------------------- +- April 23th, 2003 - +---------------------- +bluecow: Fixed resizing bug in log list controls +bluecow: Fixed potential winsock termination bug +Sony: added option in extened prefs to disable source exchange messages in verbose log + +---------------------- +- April 22th, 2003 - +---------------------- +Ornis: added scheduler controls to hotmenu +Ornis: cleared control of expand/collapse by key + +---------------------- +- April 20th, 2003 - +---------------------- +Ornis: Scheduler: fixed saving settings +Ornis: fixed resumesame-cat & dontRecreateStatGraph - settings +Ornis: fixed changing category-title when downloadinfos on tabs is activated + +---------------------- +- April 19th, 2003 - +---------------------- +bluecow:Fixed bug in preferences/directory control which was deleting the system's icon image list. +bluecow:Fixed bug with non existing shared directories which could not be unshared in preferences/directories. +bluecow:Double click in shared files list opens file with associated application. +bluecow:When opening a file from download list or shared files list, the open command used is the same as when double clicking in Windows Explorer. + +---------------------- +- April 18th, 2003 - +---------------------- +bluecow:Fixed bug with log messages not shown at startup. + +---------------------- +- April 17th, 2003 - +---------------------- +bluecow:Added filetype icons to search- and shared files listviews. +bluecow:Fixed bug with wrong nr. of search results shown in search tabcontrol when viewing files of different directories from remote client. + + +v0.28a +---------------------- +- April 15th, 2003 - +---------------------- +Sony/bluecow: tweaked hashing algorithm, should be less CPU intensive now +VQB: long UL sessions checked for not "full chunk" method +VQB: prevent multiple checks of directories when hashing (khaos) + +---------------------- +- April 14th, 2003 - +---------------------- +VQB: added Total UL/DL ratio to statstree + +---------------------- +- April 13th, 2003 - +---------------------- +bluecow:Redid "Add Friend" dialog. +bluecow:Added "Detail" dialog for not connected friends. If a friend is currently connected, the details function shows the "Client Details" dialog. + +---------------------- +- April 12th, 2003 - +---------------------- +Unk: Receive Hard and Soft file limit for servers. +Unk: Server list was not updated when a server description was received. +bluecow:Workaround for columns resizing to zero width when double clicking on divider. +bluecow:Fixed bug where unwanted client could become a friend. +bluecow:Fixed bug with OP_ASKSHAREDFILESDIR where remote client does not get the shared files from a folder which has no trailing backslash. +bluecow:Support for viewing remote client's shared directories in search results. +bluecow:Fixed bug where client changed from HighID to LowID and receives still the old HighID of itself via source exchange and wanted to connect to itself. + +---------------------- +- April 11th, 2003 - +---------------------- +bluecow:Unified all message boxes. +bluecow:Optimized drawing and sorting functions for several list controls. +bluecow:Fixed bug in source exchange where client gets no sources as long as it does not have at least one complete part. +bluecow:Little optimization on loading of server.met +bluecow:Implementation of eDonkey protol message OP_END_OF_DOWNLOAD +bluecow:Several small code changes and potential bug fixes due to temporary compiling with warning level 4! + +---------------------- +- April 9th, 2003 - +---------------------- +bluecow:Fixed bug when requesting hashset and remote client does not answer immediatly with the hashset. +bluecow:Fixed heap corruption when receiving a server's OP_SERVERIDENT without any strings + +---------------------- +- April 7th, 2003 - +---------------------- +Ornis: Categories: Doubleclick opens category-preferences; Category shown as downloadlist column (optional) +Ornis: Category: new priority preference - new assigned files get this priority +Ornis: Category: resume next paused download in the same category (optional & manual) +Ornis,bluecow: MLDonkey better recognized +Ornis: Red warning rating icon is shown when more than 1/3 of the ratings are bad + +---------------------- +- April 6th, 2003 - +---------------------- +bluecow:New first run time wizard. +bluecow:Hotfix for partfiles getting too large. +bluecow:Fixed credit score ratio computation for clients which have transfered >4GB to an other individual client. (thx le_fred+Harvey56) + +---------------------- +- April 5th, 2003 - +---------------------- +bluecow:New log window with a rotating log, max. nr. of lines can be specified in preferences.ini (MaxLogMessages=; =-1 ... unlimited) +Ornis: Webinterface: downloadlist shows priorities of files and the controls to change it +Ornis: Webinterface serves images. Local files (contained in binary zip & self installer) are now used for Webinterface display + +---------------------- +- April 4rd, 2003 - +---------------------- +Ornis: Removed unnecessary repaint (&program-freeze) of the statistic graphs + +---------------------- +- April 3rd, 2003 - +---------------------- +bluecow:Fixed bug with message box "An attempt was made to access an unnamed file". Instead of that message box the log entry "Invalid or corrupted packet received" is created. +bluecow:Minor speed improvements by replacing many functions which deal with MD4 hashs. +bluecow:Added small hex dump log output for unknown opcodes (Maella). +bluecow:Double click in all client related listview controls opens client detail dialogs. +bluecow:Double clicking on download filename opens file details dialog. +bluecow:Sources found during local server and UDP searching are stored and eventually added to the download file. +bluecow:If adding a file to donwloads from a remote clients file list, the remote client is added as a source. +bluecow:SearchList: Already downloaded files (found in known.met) are shown with an appropriate color. +bluecow:SearchWnd: Last typed in server-met URL is saved in preferences. + +---------------------- +- April 1st, 2003 - +---------------------- +bluecow:Fixed deadlock when canceling an HTTP download of server.met +Ornis: Tooltips over cat-tabs displays some summary information of that category +Ornis: optional display of the cat-tabs as "Title (loading/Filecount)" (Preferences->Display) +Ornis: Statusbar doubleclick: e.g. Log-Pane shows complete line in MessageBox, MessageIcon opens the message-window +Ornis: Show Webinterfacestatus in the "MyInfo"-box, incl. current active sessions + +---------------------- +- March 30th, 2003 - +---------------------- +Ornis: Webinterface: fixed sorting transferlist by progress +Ornis: Save category-setup during runtime (avoid loosing settings) +Ornis: Date and time representation appropriate for locale + +---------------------- +- March 28th, 2003 - +---------------------- +Ornis: Webinterface: Dont allow guests to clear the logs +Ornis: Webinterface: server-search control via webserver & start downloads +Ornis: Webinterfacetemplate: set file-settings are saved now +Ornis: more shortcuts for the lists: Ctrl+A selects the whole list; downloadlist +,-,Cursor left/right to expand&collapse sources of files + +---------------------- +- March 26th, 2003 - +---------------------- +Ornis: Uploads-Tooltip better display of transferred data +Ornis: new: Scheduler, to plan settingchanges & actions +Ornis: select the webserver-template as preference + +---------------------- +- March 26th, 2003 - +---------------------- +Ornis: Webinterface, portchange restarts webserver automatically [cax2] +Ornis: Webinterface, disable guestlogin reacts immediately +Ornis: Some potential (certain circumstances) exitcrashes fixed [2bottleMOD] + + +v0.27c +---------------------- +- March 23th, 2003 - +---------------------- +Ornis:Fixed security bug which could cause eMule be crashed (new settings in security preferences) +Ornis:Webserver: Fixed display if files>2GB +Ornis:Webserver Template updated by Daan + +v0.27b +---------------------- +- March 21th, 2003 - +---------------------- +Unk: Fixed possible crash with Comment packet. +Unk: Recheck unzip size to avoid problems. (emarc) +Ornis:Patch to enable folderselection when no C: is on system +Ornis:Fixed seek-failures on large files [gabest] +Ornis:Trafficcounter in credits save>4GB now + +---------------------- +- March 19th, 2003 - +---------------------- +Ornis: Added Webserver Control Panel [based on Kuchin], with changed/added: + -Progressbars with colored part-display! + -various style changes/corrections + -datasizes better casted + -additional preferences: set connectionlimits, sourcesperfile, new connections per 5 seconds, and 2 file settings + -Two access profiles: Admin(full power) & Guest (only watch) + -Fixed incompatiliby of control images concerning Opera & old Mozilla + -Fixed security bug, concerning sessionID creation + -Add log-message of Logins & Logouts +VQB: Eliminated just created ed2k links prompting to add links from clipboard +Unk: A previous version or mod seems to have set a clients hash to all 0. eMule now verifies your hash at startup and resets it if required. +Unk: UDP only use clients IP for finding the sender.. It now checks for UDP port also to make sure it finds the correct object.. + +---------------------- +- March 16th, 2003 - +---------------------- +Unk: Double update in Known Client List fixed. (JustusJonas) + +---------------------- +- March 15th, 2003 - +---------------------- +Ornis:Cancel downloads of a category are now prompted first +Unk: Disabling queue list bug. +Unk: Source Exchange updated to include the users hash to help prevent multiple clients. +Unk: Client Details bug. +Unk: Fixed a bug that didn't upldate last seen if a client in your queue only used UDP. +Unk: Added localization to the Known Client List. +Unk: Fixed a bug where a source could get stuck in the Asking state forever. +Ornis:Adding same ed2k-file multiple times via weblink was possible when eMule was not running +Ornis:You can now enable loggin the verbose-log to disk, without display it in serverwindow + +---------------------- +- March 14th, 2003 - +---------------------- +Ornis: Fix: Versionstats for the Hybridversion now visible +Ornis: Foldercount fixed when sending package SHAREDDIRS +Ornis: Fixed: decision about zipping a package was made case sensitive - not anymore +Ornis: Download-Tooltip corrected (one info was gone) +Orins: Fixed: Sending commands to categories handles "show all unassigned" now + + +v0.27a +---------------------- +- March 13th, 2003 - +---------------------- +Ornis:Added options to save logs to disk +Unk: Credit System Optional +Unk: Simple first time setup-wizard +Unk: Another Protocol change for better compatability to the Hybrid. +Team:and a number of tiny corrections, Fixes & graphical updates + +---------------------- +- March 11th, 2003 - +---------------------- +Ornis:Sharedfilelist: linkcopy now for multiple selection too +Ornis:Searchwindow: Box for Directlinks (ED2k-Filelinks) supports multiple links +Ornis:Option to watch the clipboard for new ED2k-Links to enter to the download (after a prompt) +Ornis:Preferences new group: Security (filters), new filter: comments +Ornis:new column "Folder" in the sharedfiles list +Unk: lMule is now detected. +Unk: eMule clients v0.19 and below are now given a lower queue rating.. This is to push these client to upgrade due to the client publishing to the wrong server port that doesn't use the standard port. +Ornis:Added a hotmenu for faster control via keyboard. Press Alt+x ! + +---------------------- +- March 10th, 2003 - +---------------------- +Ornis: Completed file in transferlist will be opened when item is activated +Unk: No longer remove uploadclients with a unknown file name to be more compatable with Hybrid. +Unk: ShareFileList now uses the queue&upload list to create a bar to show how spread a complete file is in the network. +Unk: Fixed a bug in the wizard. +Unk: Added a Known Client List to the transfer window. +Unk: UploadClients with unknown filename is no longer removed for better compatablity to the Hybrid client. +Unk: SharedFile list now has a bar that is generated from the queue&upload list to show how well spread a file is. +Unk: Fixed a bug that caused eMule to crash if you got disconnect from your ISP. +Ornis:Comment icon should be more up to date [Moosetea] + +---------------------- +- March 2st, 2003 - +---------------------- +Ornis: Fix: saving alltime transferred size for files not limited to 4GB anymore +Ornis: Fixed bug that didn't allow previews of movies with capital extention +Ornis: Preferences reorganized - new group: Display +Ornis: New option to switch on/off the rating/comment-icon in the downloadlist + +---------------------- +- March 1st, 2003 - +---------------------- +Unk: Nondownloading sources are now updated a 10th of the time. (based on Maella) +Unk: Name and Desc of servers are now updated. Max users is now a seperate column. +Unk: Radio button bug in wizard fixed. +Unk: Changing how eMule exchanges version type. +Ornis: Downloadlist can now be organized in categories, for switching/filter downloadlist, set different incoming folders, colors and perform commands on all files of the category... +Ornis: Date/Timeformat can be changed in the preferences.ini , strftime() compliant format string!!! + +---------------------- +- February 26st, 2003- +---------------------- +Ornis: Fixed: sourceexchange was more seldom under certain circumstances +Ornis: stopped downloads dont collect sources anymore +Unk: Fix bug that allowed a upload to upload for more then one chunk in Full Chunk Mode. + +----------------------- +- February 25th, 2003 - +----------------------- +Unk: View transfering parts in uploadlist. (Lonestar) + +---------------------- +- February 24st, 2003- +---------------------- +Ornis: middle-mouseclick on a comment-symbol opens the commentlist +Unk: Upload bars are now 3D. +Ornis: fixed auto-versioncheck [thx bluecow] +Ornis: added display of the last time data was received (written to disk) for every file (downloadcolumn, tooltip, filedetaildialog) + +----------------------- +- February 21st, 2003 - +----------------------- +Unk: Completely changed the auto priority methods. Download and Shared prio is now completely seperate. Auto priority is now defaulted. + +----------------------- +- February 19th, 2003 - +----------------------- +Unk: Merged in new DownloadListCtrl. (Maella) +Unk: Merged in view shared list of Hybrids. (Bluecow) +Unk: Don't try to update queue list at all if not visiable. (zz) +Unk: Another Update on the Min to Tray Button. (Zegzav) +Ornis:Upgraded Notifier, to support customizable skin, close- & history-function +Ornis:Doubleclick on a user in the commentlist starts a (Message)Chat to that user +Ornis:Fixed issue with limiting the downloadspeed at runtime and via commandline + + +v0.26d +----------------------- +- February 15th, 2003 - +----------------------- +Unk: Fix queue rotation bug. (Some clients were instantly kicked from upload) +Unk: Several optimizations by BadWolf63,ichi +Unk: Minimize to tray gui button bug fixed. (zegzav) +Unk: cDonkey is now in the stats. +Unk: Splitter bar position is now saved correctly. + + +v0.26c +----------------------- +- February 13th, 2003 - +----------------------- +Unk: Change how we detect Hybrids. +Unk: Changed some slot management. (Some help from VQB) +Unk: It seemed that some uploads tended to be extremely long in Chunk mode. There is now a check to make sure this doesn't happen. +Unk: Files set to auto no longer hang when you resart eMule. (jicxicmic) +Unk: Roundoff error correction for datarates. (Maella) +Unk: Changed some server connect code. eMule now connects a lot smarter with Safe Mode turned off helping with lowID problems. +Unk: Server stats is no longer lost on restart when autoupdate is turned on. +Ornis:Added commandline command: "limits=up,down" (e.g. "emule.exe limits=50,12") to set up-&down- transferlimits +Ornis:Added option to show up&down-rates in the title of the programwindow +Ornis:Middle mousebutton opens the detailwindow for the selected item in download-, upload- and queuelist +Ornis:Fix: webservices in sharedfileslist works again + +----------------------- +- February 11th, 2003 - +----------------------- +Ornis:Reenabled statusbaricon for new messages. +Ornis:a number of little fixes, GUI & functional [some from JonnyB] +Unk: Auto saving serverlist & friendlist list fixed. +Unk: Source exchange now only sends needed sources to the client. +Unk: Small gui fixes. +Unk: Fix some more possible secuity issues and memory managments. (Some by beef2k & bluecow & Juanjo) +Unk: Small fix to maxconnection preference. +Unk: Pausing and Priority now saved again at shutdown. + +----------------------- +- February 10th, 2003 - +----------------------- +Ozon: Bugfix; ed2k links is now correctly generated by emule for files larger than 2GB... +Ornis:Fixed GUI-issue in commentslistingdialog when resizing the window +Ornis:Show downloadcount above downloadlist +Ornis:Fixed save&restore columnorder of downloadlist +Ornis:Filter for incoming messages (config in prefs-notification, default filterexample "Your client has an infinite queue") + + +v0.26b +---------------------- +- February 8th, 2003 - +---------------------- +Unk: Converted a lot of char[] to CStrings to help avoid buffer overruns. +Unk: If hashset is found to have problems, it now reasks for it. +Ornis:Fixed Webservices in Searchview +Ornis:Fixed running preview [jicxicmic] +Ozon: Added persistent backups of .part.met files +Ornis:little GUI fixes +Ornis:added IP-ranges client-filtering (blacklist), using cDonkeys filter-file-format, basic filtering, more to come:) +Ornis:added own IP:Port to MyInfo-Window + +---------------------- +- February 7th, 2003 - +---------------------- +Ozon: Added the macro THIS_FILE to all source code files, to help in finding leaks with VS. (please don't remove) +Unk: Fixed secutity hole. (bluecow/zegzav) +Unk: Serverlist and Friendlist are now saved during runtime too +Ornis:Using list with columns for comments-dialog- looks better + +---------------------- +- February 6th, 2003 - +---------------------- +Ozon: Define EMSOCKET_DEBUG for trace log file for EMSocket... +Ozon: Changed packing alignment for most structs/classes (not the critical ones :), still 1 byte) to 8 bytes. +(can improve preformance...) +Ozon: Backup of Clients.met is now done every time emule starts. +Ozon: Variable renaming started... (CAbstractFile, CClientCredits for now...) +Unk: Few bug fixes. Stats now have a packet counter. + +Bug fixes, help from ZegZav, Bluecow, Ese Juani, jicxicmic +Optimizations, help from ichi, Maella, zz + + +v0.26a +---------------------- +- February 2st, 2003 - +---------------------- +Ornis: fixed reset serverlog crash +Unk: Fixed security hole. (beef2k) + +---------------------- +- February 1st, 2003 - +---------------------- +Unk: Created a new algorithm to smooth out the spikeing TCP connections. This will help several things.. +1) Spiking CPU & Bandwidth when many sources are added or reasked. +2) Help with conflicts between Source Exchange and UDP file reasks allowing UDP to be used more lowering the need for TCP and overhead. +Unk: Irc: Fixed another bug that could cause a crash when you close a channel. +Unk: Queue size is now adjustable.. (FYI: Contrary to belief, queue size has NOTHING to do with the amount of bandwidth overhead..) +Unk: File buffer size is now adjustable. If you are one of them people that is having problems with the buffer, try lowering it. +Unk: Download file priorities are now usable for rechecking sources. + +---------------------- +- January 31st, 2003 - +---------------------- +Unk: Some clients may be reporting completed file status. Did some changes to hopefully stop this. +Unk: Added queue rank of Hybrid eDonkey clients. +Unk: Fixed protocol to allow eMule to stay in the Hybrid's queue. +Unk: Changing IP shouldn't force you to move to the end of the queue anymore. +Unk: Redid sorting of Download list one more time. +Unk: Sources with a full queue is now treated the same as noneededparts.. + +---------------------- +- January 28th, 2003 - +---------------------- +Unk: Fixed a bug that displayed eDonkey & eMule versions incorrectly. +Unk: We now detect eDonkey Hybrid Clients and Added Stats in Statistics. +Ornis: Filecompletion in seperate thread [Lord KiRon] +Ornis: added moified socket reading [by Jordy] + +---------------------- +- January 24th, 2003 - +---------------------- +Ornis: support for Opcode 0x48 (OP_FILEREQANSNOFILE) of the protocol. [references: DoubleT,eMule+/Tarod] +Ornis: used videoplayer is now selectable +Unk: Did a complete rewrite with the Update functions in Queue and Upload list to speed things up.. You should now be able to turn on the Queue Auto update feature without CPU load.. +Unk: Redid the Overhead meter. (I no longer try to estimate the TCP and UDP headers) Also added some Overhead statistics. + +---------------------- +- January 21th, 2003 - +---------------------- +Ornis: optimized internal sources-handling, for reduced cpu-load +Ornis: various runtime optimization for reduced cpu-load (statstree, tray&maindlg, GUI) [coop. with EseJuani] +Ornis: Shared files list now supports more multiselect-commands +Ornis: versioncheck at startup (optional) or manually +Ornis: full customizable Web Services for files +Ozon: Fixed crash when trying to access statusbar before it was created (AddLogLine) + +---------------------- +- January 20th, 2003 - +---------------------- +Unk: Added protcol to allow you to see what chunks a uploader has of the file. +Ornis: indicate files with ratings/comments by an icon in front of the filename (green/red,rating dependend) +Ornis: downloadlist: added sources-viewfiltering using modifier keys (see faq or help for usage!) [xrmb+Ese Juani] + +---------------------- +- January 19th, 2003 - +---------------------- +Unk: IRC:Reconnect crash should be fixed. +Unk: Small change to downloadlist.. +Unk: A client's server is now added with you first connect to him, Now, all client's servers you connect to are added to the server list. + +---------------------- +- January 18th, 2003 - +---------------------- +Ornis: languages in selectionbox now labeled in local-language [pooz] +Ornis: fixed Toolbarbuttons always growing when changing languages [pooz] + + +v0.25b: +---------------------- +- January 17th, 2003 - +---------------------- +Ornis: file completion working! (thx to all users helping&testing with us) +Unk: fixed AutoConnect on startup +Ornis: fixed wrong colormapping on the selector +Ornis: Systray-icon speedbar: color selectable in stats-preferences +Ornis: removed titlebar-preferences-menu for win9x users, which caused crashes for them +Ornis: added button to edit "adresses.dat" (in the server-preferences) + + +v0.25a: +---------------------- +- January 12th, 2003 - +---------------------- +Unk: Fix for sources being left behind when a file completes causing crashes. +Unk: Fix hash warning when a file is less then one chunk. +Unk: Made some changes to the download list, sources show more information in columns +Ornis: Handling doubleclicks on trayicon safer in respect to other apps in the systray [thx to reCDVst] +Ornis: Basic command line control: + emule.exe { connect | disconnect | resume | status | exit } + status: writes the status to file "status.log" + resume: resumes next paused file + + +---------------------- +- January 11th, 2003 - +---------------------- +Ornis: the sort of Downloadlist by status is now using better order than alphabetically +Ornis: Statistics colorselection by colorpicker +Unk: You now have an idea of the bandwidth overhead eMule uses.. +Ornis: Search now includes minsizes, maxsizes, extension, availability (thanks to Juanjo) +Ornis: language depended date/time-format is now updated during runtime when switching language +Ornis: Help-file access (FAQ-conversion). Avaiable in the download-section and already in the installer version. +Ornis: all statstics of shared files now handle >4GB + +---------------------- +- January 9th, 2003 - +---------------------- +Ozon: Rewrote the hash thread code... +Changes: Now using worker threads instead of user interface threads; less overhead when creating threads. +Uses one thread for all new shared files that needs to be hashed instead of one thread for each file. +Cleans up the thread and associated objects if the user terminates the app when the thread is running. +And other changes... + +---------------------- +- January 8th, 2003 - +---------------------- +Unk: Source asked count was nonfunctional. Fixed. +Unk: All lists now are initialized on a timer to help with win98 compatabilities.. Partially modified patch from Lucus. +Sony: Search is now canceled when closing the active search tab; added support for Blindwrite, Alcohol 120% (CD Images) and flac (Audio) file extensions +Barry: When reading staticservers.dat file and looking for priority, only accept comma if it is in second position, try to avoid finding comma in server name. +Barry: When changing priority of a static server, also need to update staticservers.dat file. + +---------------------- +- January 7th, 2003 - +---------------------- +Ozon: Added version tag to preferences.ini, to help with compability. Backup of old file and creating a new file for every new version, thereby deleting old and unused tags. + +---------------------- +- January 6th, 2003 - +---------------------- +Unk: Wizard now auto detects OS version. +Unk: Sources now show if their queue is full. +Unk: Fixed a sort issue in the upload queue when the file a client wanted wasn't known yet. +Dirus: We no long ask for sources from clients that don't support it. +Dirus: Increased compatibility between clients (and future potential clients) by using special tags instead of version numbers. + +---------------------- +- January 4th, 2003 - +---------------------- +Unk: Minimize to tray button added [thanks to Zegzav] +Unk: Old MLDonkey clients are now identified. (Some code by Mav) +Unk: Option that allows the client to try to upload based on finishing chunks, not time.. [VQB] +Ornis: Corrected display of '&' on some places +Ornis: Bugfix: Filedetails now closeable by ESC and Titlebar-Closebutton +Unk: Option to auto resume files when a file Completes or is Canceled. (This is meant to work in conjunction with "Added option to start new files from link or search etc. in paused mode". ) + +Barry: +------ +-Saving received data without delay. When requesting files it now asks only for what is needed, not in 180k blocks. Compressed packets are now unzipped as they arrive and written to disk instead of waiting for full block. +-Write buffer:Writing to files is now buffered on a per file basis.The part file is flushed to disk when the buffer reaches 500k or 5 seconds since last flush. (Some code modified) +-Added option to auto-connect only to static servers. +-Added priorities to servers in staticservers.met (Modified for backward compatibiity) +-Option to change manually added servers to high. +-Option to refresh upload queue every 30 seconds. +-Automatically stores the last sort order of list views. +-Changed download list colour bar to show part downloading from client and part(s) pending in different yellows. +-Changed colour gradient to variable strength - level can be set in preferences (General) +-Give priority to part currently being downloaded when requesting next blocks. +-Changed priority order for parts of archives & movies as follows + 1) first (Optional) + 2) last (Optional) + 3) rarest, with priority to second then penultimate parts if same rarity +-Added preview for archives (zip, rar & ace) +-Enable preview when only first and last parts are complete, not first and last two +-Fixed bug that caused corrupt preview file if part wrote to disk during preview file copy. +-Fixed bug that did not tell remote client to stop sending file when it was cancelled. +-Don't run the normal timer processing if the app is shutting down - can cause unhandled exceptions. +-Added option to start new files from link or search etc. in paused mode. +-Added option to automatically set the registry values for ed2k-links to this application while running, then set them back when finished. + +---------------------- +- January 3rd, 2003 - +---------------------- +Ornis: merged fix for better handling of loading corrupt partfiles (gaplist) [from SlugFiller] + +---------------------- +- December 31st, 2002- +---------------------- +Unk: If you cancel a download, everyone queued for that file will be removed from the queue when the next upload slot is freed. +Unk: Support to upload to mutliple clients within a network. (Ie, clients with same IP, different ports) (Reported by Lord KiRon) + +---------------------- +- December 30th, 2002- +---------------------- +Unk: Option to download preview chunks first. (Leaving this option off helps spread files faster.) + +---------------------- +- December 28th, 2002- +---------------------- +Dirus: Fixed sorting by percent complete bug which caused the list to stay unsorted until all status bars had been drawn. +Unk: Small gui preference gui fix. General is no longer defaulted as the title in the preference window. +Unk: Small gui fix in download list. QR is now adjusted when you begin to download from that source. +Unk: Irc: ed2k file links with source attached now clickable. +Unk: Low2LowIP and NoNeededPart sources are slowly removed in the hopes of getting a better source. These sources are only removed when that file is close to it's max sources to prevent sources from being removed or added over and over. Also, if this souce is a AskedForAnotherFile source for another file, it will switch to that file. +Unk: Set up a verbose mode. This is for you people that like to watch useless info. Do Not Report Errors You See In This Window! + +---------------------- +- December 27th, 2002- +---------------------- +Dirus: Fixed finding yourself as source bug (at last). + +---------------------- +- December 26th, 2002- +---------------------- +Dirus: Added a check for fake versions to the program version statistics. + + +v0.24b +---------------------- +- December 24th, 2002- +---------------------- +Dirus: Fixed a bug that made caused eMule to ask the same person for sources instead of a new person after a set time. +Dirus: Fixed a bug that allowed eMule to respond too often (as often as asked) to source sharing requests, rather than according to our preset limits. + +---------------------- +- December 23rd, 2002- +---------------------- +Dirus: Fixed a bug that prevented people who use UDP from getting sources from those with complete files. + +---------------------- +- December 22th, 2002- +---------------------- +Unk: Changing max source per file bug fixed. +Unk: Highest and Release priority bug fixed. +Unk: Search results added to a search list with no tab fixed. +Unk: Some of the connection statistics wasn't updated while not in the statistic window.. Fixed. +Dirus: Made source exchange use compression more aggressively. + +---------------------- +- December 20th, 2002- +---------------------- +Dirus: Fixed crash due to stopped/canceled file corrupting the download list controller and the shared file list. +Dirus: Partial fix for preventing ourselves from being readded to a sourcelist when someone sends us back as a source. (some code by Lord KiRon) +Ornis: Connectionattempts restart when reaching the serverlist-end +Ornis: Added statistics: Clientversions (# of clients using the 4 latest edonkey-/emule-versions) [xrmb] ; server occupation (% of userload on servers with known userlimit) + +---------------------- +- December 19th, 2002- +---------------------- +Dirus: Fixed crash that can occur from a corrupted part.met file. +Dirus: Accepted fix for possible garbage displayed in labels when run with multibyte character set. (by pooz) + + +v0.24a +---------------------- +- December 16th, 2002- +---------------------- +Unk: Friend Upload Slots can now be toggled on/off.. +Dirus: Fixed a bug that prevent source sharing from working until you had at least one complete part of the file! + +---------------------- +- December 15th, 2002- +---------------------- +Unk: Smart LowId check now helps you keep that HighID when disconnected. +Unk: Safe connect option. (eDonkey style connect.) +Unk: Resumes collecting sources on reconnect. +Dirus: Fixed bug that caused column order to be loaded incorrectly. +Dirus: Fixed bug that could cause crash if invalid table values were manually written to the ini. +Dirus: Fixed bug that prevented source sharing packets from being compressed. +Dirus: Clients with complete files can now also share sources; a source list is built from their upload queue. (An even more intelligent means of picking sources from upload queue will be included in a later version.) + +---------------------- +- December 13th, 2002- +---------------------- +Dirus: The part.met files are now backed up before being replaced. The backup files are deleted when new part.met has been written to disk and safely closed. When loading part.met files we now also check for part.met.backup. +Juanjo: File comment and rating [Thanks to pitap for some code] +Unk: Main screen now shows Users and Files of the server your on.. It also shows a very loose estimate of all Users and Files in the Ed2k network. +Juanjo: Close buttons in search tabs [enkeyDev] +Ornis: Added [eMule+] idea of Sources-Sorting by QueueRating. +Unk/Dirus/Ornis: You can now manually add friends. +Unk: Irc: Some changes to the interface. +Unk: Irc: If another eMule client is in a channel, you can add him as friend. +Unk: Up/Down ration is now the same as eDonkey.. +Unk: Several bug and gui fixes. Merged some code from Mods.. + +---------------------- +- December 12th, 2002- +---------------------- +Unk: Getting booted from Lugdunum servers due to LowID during is now handled better.. +Unk: Using the Wizard did not update the statistic graphs correctly.. Fixed.. +Unk: Found the LowIP problem after first connect.. + +---------------------- +- December 9th, 2002- +---------------------- +Juanjo: Added "List files" to the sources context menus + +---------------------- +- December 7th, 2002- +---------------------- +Unk: Upcomming servers will have a new ServerStatus packet that will be incompatable with previous eMules.. Fixed. +Unk: Added a Max Users to the server list. +Unk: Connection failures to servers should now report the correct error. +Unk: Irc: Channel Tabs got confused when leaving channels.. Fixed. +Dirus: Fixed bug that caused program to leak some resources (GID Objects) + +---------------------- +- December 5th, 2002- +---------------------- +Ornis: New Serverconnecting handling - more reasonable order to connect to servers +Ornis: Pending serverconnection-attempts will be discarded after a timeout to prevent everlasting hanging connection attempts +Ornis: Preferences: Added configuration for maximal new connections per 5 seconds +Juanjo: Added autopriority patch [Thanks to Tarod] + + +v0.23b +---------------------- +- November 30th, 2002- +---------------------- +Juanjo: Fixed: when changing between windows without using the toolbar (context menus or taskbar notifier) the toolbar buttons state are not updated +Juanjo: Added support for multiple backup urls in addresses.dat [Thanks COOLER[T]] +Juanjo: Fixed bug when adding files to download from the search results and the temp directory is inexistent + +---------------------- +- November 29th, 2002- +---------------------- +Juanjo: Group of sources can be appended to ed2k links [Thanks Linearcity] this is the extended edk url format: + ed2k://|file|fname|size|hash|/|sources@expiration,src1ip:src1port,src2ip:src2port,...|/ + "@expiration" is optional: e.g. @021126 (YY,MM,DD) - always 6 digits +Juanjo: Fixed issue with multiple instances +Juanjo: Added two new statistics values: top download value and top download average value +Dirus: HttpDownload now also accepts x-gzip encoding. + +---------------------- +- November 26th, 2002- +---------------------- +Ornis: Added button in transferview, to switch between uploadlist and queuelist (title over the listcontrol) +Ornis: Added Patch in sharedfolderselection to mark multiple subfolders by Ctrl+Click on a folder-checkbox [by VQB] +Ornis: Fixed the disabled Speedselector on Systemmenue + +---------------------- +- November 25th, 2002- +---------------------- +Juanjo: Avoid multiple instances of emule +Ornis: UDP-Port is now configurable in the preferences (connection) +Ornis: Ensures some more status-feedbacks be uptodate +Dirus: Rewrote incoming part highlighted so it doesn't blink on slow or stalled downloads. + +---------------------- +- November 24th, 2002- +---------------------- +Dirus: Added support for gzip encoding to serverlist-download + +---------------------- +- November 23rd, 2002- +---------------------- +Dirus: IRC: Fixed bug where double clicking on empty users list caused a crash. + +---------------------- +- November 22th, 2002- +---------------------- +Juanjo: Patch to show active chunks (yellow) for each downloading source [Cax2] +Juanjo: Patch to avoid saving 0/0 Download Upload Clients to Clients.met [sulamidor] +Juanjo: Several cpu-optimizations [Insh_Allah] +Ornis: Addes some handling improvements to the searchwindow, like resultcount-display in search-tabs +Ornis: Added an option to remove servers from staticserver-list [DonGato] +Ornis: Now uses lowest free partfile number [InterCeptor] +Dirus: Some more tweaks and optimizations for autosort. + +---------------------- +- November 21st, 2002- +---------------------- +Unk: Irc: Fixed another crash bug when updating the channel list. +Unk: Irc: Removed SendLink and AddFriend popup menus to put in security mesures for next release. +Ornis: Fixed shifted columnheaders in the searchlist +Dirus: Added autosort to all lists. + +---------------------- +- November 20th, 2002- +---------------------- +Unk: Added a connection wizard in the preference's connection tab.. Win98 users having problems need to use this.. +Ornis: Reduced hashing files, when starting emule (tarod) +Ornis: various bugfixes (Insh_Allah) - fixed memleaks, buffer overruns, incomplete initialations, bad memoryaccess + +---------------------- +- November 19th, 2002- +---------------------- +Unk: Asked count is reset when a client reenters the queue to avoid confusion. +Unk: Small tweak to the queue list refresh function to better handle evil clients. + +---------------------- +- November 17th, 2002- +---------------------- +Dirus: Download list has autosort, code is in place to autosort other lists. +Unk: The HyperTextCtrl buffer wasn't able to handle the large amount of text caused by busy IRC channels which cause the channel's text to become unreadable.. Fixed.. +Unk: Irc: Added a preference to ignore all info messages so you can see through all the clutter in a channel. +Unk: Irc: Increased font size so those at 1024X768+ didn't need a magnifying glass to read the text. :) +Unk: Asked count is reset when a client reenters the queue to avoid confusion. +Unk: Small tweak to the queue list refresh function to better handle evil clients. + +---------------------- +- November 16th, 2002- +---------------------- +Unk: Upload prioity is now saved for files currently being downloaded. +Ornis: Added quick-Speedselector (xrmb +) to systray-popupmenu and systemmenu +Ornis: Fixed bug concerning column-handling at save&restoring + +---------------------- +- November 15th, 2002- +---------------------- +Ornis: Option to start emule minimized +Ornis: Fixed 2 bugs concerning sorting downloadlist by progress +Ornis: Stats: Fixed function and enabled slider in the stats-preferences to change the duration of the average graphs +Ornis: Stats: Graphcolors are now selectable (using RGB-values) +Unk: Changed tranfered data in shared files to support 4GB+.. + +---------------------- +- November 14th, 2002- +---------------------- +Ornis: Added mousecontrol to the Sourcefilenames-List in Filedetailsdialog + +---------------------- +- November 13th, 2002- +---------------------- +Dirus: Added a warning for windows 9X/ME users who set their max connections to high. +Unk: Irc:Added support so that two eMule clients can directly send ed2k links to each other. +Ornis: Show counts of Filenames at sources in the filedetails (Juanjo) +Ornis: Renaming filename of downloads (in filedetails) & cleanup name (. _ %20 leading caps) +Ornis: Copy Serverlink in popupmenu of the serverlist (Interceptor) + +---------------------- +- November 12th, 2002- (nice date) +---------------------- +Ornis: Show filetype in Sharedfiles-list +Ornis: Tabs in preferences now translated (Interceptor) + +---------------------- +- November 11th, 2002- +---------------------- +Unk: Irc:Fixed the nick already used when logging in bug. +Unk: Irc:Preference now has: Server, Nick, Perform, Load Serverlist, Serverlist Filters. ( Perform example: "/msg nickserv identify | /join #emule" ) +Unk: Irc:You can now use /msg nickserv and /msg chanserv... +Unk: Irc:Hyperlinks now work in a Notice and Info message. +Unk: Irc:The Strip Color function could crash with some strings. +Unk: Irc:The % char is now handled correctly. +Unk: Irc:Ready for the friends list. +Unk: Irc:Channels are now Tabs. + +---------------------- +- November 10th, 2002- +---------------------- +Dirus: Preview now works with extensions longer than 3 characters, fixed other minor issues related to extension length. +Dirus: Fixed bug where previewed file was not deleted when unable to spawn associated program. + +---------------------- +- November 8th, 2002- +---------------------- +Dirus: Download list now also has draggable columns. +Dirus: Increased accuracy of percent completed from int8 to float. + +---------------------- +- November 7th, 2002- +---------------------- +Dirus: Files with duplicate names are now saved correctly after download. + +---------------------- +- November 6th, 2002- +---------------------- +Dirus: Arrays are stored on 1 line in the ini. +Dirus: size, position, and hidden status of all tables are now saved. + +---------------------- +- November 3rd, 2002- +---------------------- +Unk: Added a IRC client (With help from Merkur) +Unk: HyperTextCtrl now detects ed2k:// +Unk: Some server were deleted even when the option was unchecked. +Ornis: Added preferences tab for statistics-setup +Ornis: Number in front of sources-count now gives the real useful-sources count (onqueue+downloading sources) + +---------------------- +- Oktober 31st, 2002- +---------------------- +Dirus: Added support for "double arrows" (for 3 columns of shared-files list) +Dirus: Small visual changes, download list can now hide/show columns. +Ornis: Added export of Online Signature (by Bouc7) +Ornis: Added logmessage when sharedfiles-list is requested + +---------------------- +- Oktober 30th, 2002- +---------------------- +Dirus: Update all column headers on language change (thanks to InterCeptor for the idea). Also, server list window will now localize. +Dirus: Added more colors to search results to indicate downloading file and already downloaded file (had to rewrite code but thanks to Amdribant for the idea). +Ornis: Downloads running out of diskspace can now be resumed without restart + +---------------------- +- Oktober 29th, 2002- +---------------------- +Dirus: Added hide/show columns to all lists except download. Use by right clicking on column header. +Ornis: Fixed changing userhash +Ornis: Fixed adding Serverlink at startup (Cax2) + +---------------------- +- Oktober 28th, 2002- +---------------------- +Dirus: Fixed a tooltip divide by 0 bug due to availability calculation in the transfer window + +---------------------- +- Oktober 26th, 2002- +---------------------- +Dirus: Added new icon for unknown sources. +Dirus: All lists except download list now have draggable column headers. +Ornis: fixed using Translations to work on Win9x + +---------------------- +- Oktober 25th, 2002- +---------------------- +Dirus: Changed appearance of all lists except download list, also added sort arrows for all of them. Changed icons in all lists to be theme friendly, background color now matches. Got rid of CIconList as it was no longer needed (it was a hack anyway). +Unk: Cleaned up some of the statistic code and added some stats. + +---------------------- +- Oktober 24th, 2002- +---------------------- +Unk: Some internal changes.. Servers now only use listname(Removed realname). Removed availible column in the search(It was a duplicate of sources). That freaking staticserver was still overwriten by a server.met.. Fixed. The Ban count was redone so it will not mess up anymore. +Unk/Dirus: Now updates server name and description at connect.. (Cax2)(Merkur didn't like the code, so it may need cleaned up..) + +---------------------- +- Oktober 20th, 2002- +---------------------- +Unk: Sorting the server list now supports dynamic ips. Sorting by description works better. All sorts are no longer case sensitive. +Unk: Added some network statistics. +Unk: If you add a server from a server.met url or manually and it's already in the list, the name and desctiption is updated. +Ornis: Added button to reset the log + +---------------------- +- Oktober 19th, 2002- +---------------------- +Unk: Added a "upload time" column to the upload list.. +Unk: The server list now has a few save points. Also, servers were deleted with fewer failures directly after connecting then while connected, fixed. +Unk: You can now do multiple searches. +Unk: You can now unban a person in the upload queue.. (Unless Merkur doesn't like it and deletes it.. :) +Unk: Small patch to the static servers. No longer over written with autoupdate and you can use a "," or a ":". (dongato) +Ornis: new average graph for the transfer-rates, calculated over time (5mins default) + +---------------------- +- Oktober 18th, 2002- +---------------------- +Unk: Added a "Entered Queue" column for the queue list. Asked count now continues to count for banned users. +Unk: More server statistics. +Ornis: Show number of available parts of a download and keeps the last date when all parts has been available + +---------------------- +- Oktober 17th, 2002- +---------------------- +Dirus: Downloadlist:improved drawing of the sources, general list-behaviour and sorting +Ornis: new statistic values and new columns for the shared-folder list (4phase sorting) which is now autoupdating +Ornis: Language support improved. Supporting sublanguages now and hopefully working on all systems. +---------------------- +- Oktober 14th, 2002- +---------------------- +Merkur: several bugfixes were added/merged + +---------------------- +- Oktober 12th, 2002- +---------------------- +Unk: You can now sort the Queue and Upload list. +Unk: Very Low priority bug fixed. +Merkur: localized all dialogs +Merkur: Upload spikes should be reduced +Merkur: dead clients are deleted form your uploadlist properly now +Merkur: Added a preview function which allows you to preview movies. Read the FAQ for more informations + +---------------------- +- Oktober 10th, 2002- +---------------------- +Unk: Fixed a bug with when you cancel multiple downloads.. (CML) +Ornis: main-preferences are now stored in an .ini -file. -> more compatibility for coming versions +Ornis: localized emule-output of messages. Thanks to various translators for translating the text itself:) + +---------------------- +- Oktober 09th, 2002- +---------------------- +Unk: The gui no longer lags as much when a lot of server are deleted. +Unk: You can now switch between the upload list and the queue list in the transfer window. (Based on Bouc7) +tecxx: updated tooltip info texts +tecxx: added upload priority, finally. +tecxx: added "staticservers.dat" file. file will be loaded at startup and includes your standard servers you always want to have in the list. format: "host:port,Servername" + +---------------------- +- Oktober 07th, 2002- +---------------------- +Unk: Reworked a little with how servers are maintained internallly, hopefully no more crashes when deleting servers.. +Unk: Tweaked how server stats are aquired. +Unk: Priority now works when connecting to servers and dead server are now removed while connected instead of only directly after connecting. + +---------------------- +- Oktober 03rd, 2002- +---------------------- +pach2: fixed the ed2k link creation, copy to clipboard feature (added missing / at the end of links) +pach2: added traces for some socket operations (debug build only) +Ornis: fixed a crashbug at shutdown with selected searchresults +Ornis: Added multiselection to searchresults +Ornis: Added multiselection to serverlist (multi-server-removal & try connecting to selected servers) +Ornis: Added stop-connecting-function to the connectbutton +Ornis: Shared-files-list made sortable +tecxx: added a tooltip control to the download & upload windows currently displaying the filename of the client u r loading from, more info will be added. +Merkur: Adjusted the antiagressive clientsystem to be less aggressive. Also banned clients are unbanned after 5 hours +Merkur: fixed some (crash)bugs and memleaks + +---------------------- +- Oktober 02nd, 2002- +---------------------- +Ornis: Added Transferdialog-Splitbar to resize Download/Uploadwindow +Ornis: Fixed GDI Memleak +Ornis: new statistic values: "Time Since First Transfer","Reconnects","Connected To Server Since","Transfer Ratio","Clientversions" +Ornis: Changed: Up/Down Graphs show 4 additional kB/s than the specified capacities (to see peaks) +Ornis: Added: File-Detaildialog for downloads +Merkur: fixed a UDP bug which caused that some incoming packets were ignored +Merkur: adjusted the creditsystem formula + +---------------------- +- Oktober 01st, 2002- +---------------------- +tecxx: hopefully solved the issues with the shared files selector on w9x. thanks LOVELACE from the board! +tecxx: added gui code in shared files window to set permission and priority levels +tecxx: emule now responds to "view shared files" command in edonkey friendslists, it shows only files based on permission settings + +---------------------- +- September 30th, 2002- +---------------------- +Unk: Outgoing udp packets was sometimes sent to the wrong port. +Unk: Detecting dead servers was buggy. + +---------------------- +- September 28th, 2002- +---------------------- +pach2: Fixed the following problem: + Description: When i download this link ed2k://|file|HL_CS_english_retail.iso|462401536|78b84dd256bde2fe9f4cdccea2868208| + via the search menu, emule tells me "invalid link" and CRASHES. when i download the link via START - RUN all is fine. +Ornis: Added file category-selection to search +Ornis: added option: "filter invalid IPs" in preferences +Merkur: added Splashscreen (thanks to DRSirius for the image) and fixed some bugs +Unk: Servers Stats are now recieved when a server is added.. +Unk: Fixed a memleak that was created when trying to search servers when not connected.. Also corrected a couple opcodes for the serverlist. +---------------------- +- September 27th, 2002- +---------------------- +tecxx: added "create ed2k link" feature (incl. html version) to download, shared files and search lists. +Merkur: you can now use addresses like myserver.dyndns.net instead of IPs for server. Server admins please read the faq(http://....) to learn how to automatically assign an address to your server when an emule client connects. +Ornis: added separat statistic window +Ornis: filtering bad servers extended to filter more invalid IP-ranges +Ornis: more options in preferences: prompt on exit, number of failed retries to connect a server before removing it + + +---------------------- +- September 26th, 2002- +---------------------- +Merkur: The anti aggressive client system is working now. read the faq to learn more about it (http://...) +Merkur: rewrote some parts of the networkcode, this shouldn't have any effects for the enduser though + + +---------------------- +- September 23th, 2002- +---------------------- +Merkur: Added a webbased-search option via filedonkey.com +Ornis: various interface tweaks, restoring program-window & download listcolumns,more keyboard support, ESC minimizes... + + +---------------------- +- September 21th, 2002- +---------------------- +Merkur: the new antiaggressive-client system seems to have some serious bugs and is disabled for now. It will be back in 0.20 when it is fixed & tested +Unk: Server list changed from a tree to a list. ( Based on MrFry code) +Unk: Server list now updates users and files information from connected server. +Unk: Mark and Delete server preference now works. (Only during the connection process) +Unk: Tweaked the queue so that it now skips dead clients. +Unk: Added Max source per file option. eMule will also back off the servers while a file is close to this value. +Unk: Opera should no longer have the %20 problem. +Unk: 0.0.0.0 IPs no longer added to server list. +Unk: Timestamp to log entries. (Ornis+) +Unk: Download list now has Status and Time remaining (Ornis+)(CML) +Unk: Completed and shared files can now be opened.. (CML) +Unk: Server list is now saved. +pach2: ed2k://|server| pseudo-URL links are now handled and added to server list + + +---------------------- +- September 20th, 2002- +---------------------- +Merkur: my new coded socketclass didn't worked too well and needs to be rewritten again (which takes a lot time) but I made some changes to the current networkcode in order to avoid the crashbug and it seems to work. So hopefully emule should run more stable now +Merkur: Fixed a bug which caused all partfiles to be unshared when using the reload button +Merkur: emule should now pay more attention to the Max_Connections setting +Merkur: The creditsystem does not use a part of the IP as userkey anymore +Merkur: emule detects "aggressive" clients, which reask too often for a file and bans them (for the current session) +Merkur: some other bugs are fixed + +---------------------- +- September 19th, 2002- +---------------------- +Unk: Servers with same IP but different Ports are now valid. +Unk: Small tweak to the add client's server to serverlist option. +Unk: Moved some messageboxes to the window log to avoid issues. + +---------------------- +- September 17th, 2002- +---------------------- +tecxx: 2 fixes by TALAN(icq) - fixed problems when resizing downloadwindow + +---------------------- +- September 16th, 2002- +---------------------- +tecxx: implemented new shared files selector +tecxx: new option: add server's serverlist. if active, emule asks the server for a list of know servers right after a successful connection +tecxx: new option: add client's server to serverlist. if active, emule adds the server ip and port of a connecting client to the serverlist +tecxx: fixed single server remove crash +tecxx: added multiselect code in download window (thanks to Mr.Fry from the board!) + +---------------------- +- September 14th, 2002- +---------------------- + +Merkur: implemented a new about dialog.. no it still doesn't show your id, but it looks way better ;) +Merkur: Finally the new credit system is in. Basically clients which uploaded to you will get a higher priority. Check the FAQ (emule-project.net) for a detailed description. A client with a yellow symbol in your uploadlist means that this client is prefered because of the credit system. You can check the detailed info screen to get more infos about his credits. However it's in the testing stage atm and probably some values will be adjusted later + +Merkur: shared files now have a statistic, which will show you how often a files was requested, accepted and how much bytes you uploaded. +Merkur: partfiles are now "writeprotected" while emule runs, so you can't mess them (and cause errors) by reading/writing them with another application. +Merkur: emule won't crash with a "out of memory" message anymore if it reads a corrupted .met file +Merkur: Fixed some bugs. Hopefully emule will run more stable now. Check for a "b" version in the next days, which will be released of any critical bug will be found in 0.19a (of course we test version before releasing them, but you knwo its impossible to find all bugs) + +---------------------- +- September 11th, 2002- +---------------------- +tecxx: shared files: added a reload button +tecxx: serverwnd.cpp - fixed problem when adding server with 5-digit port number +tecxx: download control now displays "Complete" when download is completed. +tecxx: invalid characters like < " and ? are now removed from completed files +tecxx: added 3 options: remove server, remove all servers and add external server.met +tecxx: added a tracker mechanism to keep track of opened/closed server-connect sockets +tecxx: "add server" function now checks if server is already in list +tecxx: fixed 2 small memleaks + +---------------------- +- September 10th, 2002- +---------------------- +(0.18b "Hotfix" ;) ) +Merkur: Fixed a critical bug which caused the client to drop all compressed packets (with the message: Corrupted compressed packet for X received) +Merkur: Some other bugs are fixed too + +---------------------- +- September 7th, 2002- +---------------------- +Merkur: Added a first part of the eMule-Protocol. This protocol will offer several features, but will only work for clients which are supporting this protocol (atm only emule v0.18 and higher). The download and uploadwindow will show an icon with a green "+" on clients which are supporting this protocol. + +Merkur: (eprot only) Files are now send in compressed packets. Depending on the file you are downloading this will reduce the downloadsize by (estaminated): +0% zip/ace/rar and other archives. These files are sent unpacked (because they are already max. compressed) +2-15% bin/avi/mp3 these files are already compressed very often, however a moderate-small size reduction is possible +15%-? unpacked files the size of unpacked files can be greatly reduced, however it doesn't happen that often that you download a unpacked file +Another advantage of compression is, that compressed packets are checked for transfer errors. That means emule will recognize a corrupted packet and you have to redownload 180KB instead of 10MB. +However everything has a downside: Compression needs some CPU time but you shouldn't notice it. +NOTE: This also means that it can happen that a file is finished before "transfered" has reached the filesize. this is no bug. + +Merkur: (eprot only) you can now see which rank you have on the uploadqueue of of sources. It's shown in the downloadwindow/priority tab. +Merkur/mbobka : emule crashed/frezzed somtimes while completing files. This should hopefully be fixed. We are working on all bugs (especially on crashbugs). Please be patient :) +Merkur: Added a autoconnect on startup option + + +---------------------- +- September 4th, 2002- +---------------------- +Merkur: If a servermessage contains a link (http, www, email etc) emule will make this link clickable. So if you click on this link you will browse to this site/open your mailprogramm etc. ED2K links are not clickable yet. +Merkur: emule should pay more attention to the downloadlimit now +Merkur: due to popular demand I changed the global search: the global search will not start untill your server gave a respond. This will slow down global searches a bit, but will avoid server-overhead. +Merkur: some bugs are fixed. however there are still many bugs, which I wasn't able to dectect yet. So if eMule crashes on your PC please use the Debug version and send me a bugreport (read the debug.txt) +Merkur: adresses.dat now doesn't contain any serverlist anymore. Maurices serverlist was for testing only, however quite a few ppl are using emule now which will cause lots of traffic. Of course you can still paste the serverlist of your choice into adresses.dat. +If you want to support eMule with a (good) serverlist-mirrow/generator which will be used as emules standart serverlist then mail me. + +---------------------- +- September 3th, 2002- +---------------------- +Merkur: Added clientdetails (right click on any client and select show details) +Merkur: You can pause & stop files now. Pause means emule tells its sources source to stop downloading but keeps them. Stop will delete all sources. Other than that pause & stop are equal. NOTE: pausing a download and resume it WILL NOT SPEED UP ANYTHING. This is not edonkey +Merkur: You can clear completed files from your downloadlist. + +---------------------- +- September 2th, 2002- +---------------------- +Merkur: optional emule will minimize to a systemtray icon +Merkur: the statusbar shows you if you have a low or high ID: if the connected icon has yellow arrows you have a low id, if it has green arrows you have a high id. + (BTW: keep in mind that low id's a VERY bad for emule at this point, because not all low id functions are implemented) +Merkur: you can now connect to a certain server (right click on the serverlist) +Merkur: there is a new emule Debug version. If emule crashes on your pc and you want to help to resolve this by sending a bugreport, then please download the debug version. Read the debug.txt for more informations. + +---------------------- +- September 1th, 2002- +---------------------- +Merkur: ED2k link were bugged and a wrong fileid was given to emule. this is fixed now +Merkur: fixed a interface bug (http://sf.net/tracker/index.php?func=detail&aid=602996&group_id=53489&atid=470504) +Merkur: added a small feature request (http://sf.net/tracker/index.php?func=detail&aid=603008&group_id=53489&atid=470507) +Merkur: canceling files could cause a crash + +-------------------- +- August 31th, 2002- +-------------------- +Merkur: emule now supports ED2K filelinks :) You can click links in your browser (like edonkey) or enter them directly on the search page to add a new file. +Merkur: if a client asks for a part file and is not known as a source for this partfile he will be asked & added +Merkur: rewrote udp search +Merkur: file priority works. Keep in mind that priorities are relativ. That means if you are downloading 10 files and set them all to high prio, it would have the same effect as if you would set them all to low priority. However if you set one of this ten files to high priority then this file will probably get more sources. + +-------------------- +- August 30th, 2002- +-------------------- +Merkur: the eMule window is now maximize- and resizeable (thanks to Paolo Messina, who coded a usesful resize-library) + +-------------------- +- August 28th, 2002- +-------------------- +Merkur: you are now able to send and receive messages +Merkur: as alwasy some other bugs are fixed (and probably some new introduced) (tm) + +-------------------- +- August 25th, 2002- +-------------------- +Merkur: emule will download the first and last two parts from movies first (if possible) to make it easier to preview movies. (but don't touch part files while emule is running!) + +-------------------- +- August 24th, 2002- +-------------------- +Merkur: fixed a problem with downloading files which are smaller than 10MB + +-------------------- +- August 22th, 2002- +-------------------- +Merkur: fixed some (crash) bugs. emule should be quite stable now. At least it didn't crashed in my longtime tests :) + +-------------------- +- August 21th, 2002- +-------------------- +Merkur: fixed a bug which caused problems with completing files (actually it was impossible) +Merkur: New Feature: Intelligent Corruption Handling - ICH (first stage). This should reduce the average (re)download size of corrupted parts form 10 MB (one full part) to 5 MB. However it needs some CPU time, so if you have a very fast connection (LAN for exmample) you should disable this. +Merkur: New Feature: Autoupdate serverlist. If you activate this (on your preferences screen) emule will download a new serverlist at startup. You can set the downloadadress in "adresses.dat". ATM it uses maurice's serverlist - please change this to your favorite serverlistadress :) +Merkur: fixed some minor memory leaks. emule is leakfree atm ;) +Merkur: as alwasy some minor bugs are fixed (and probably some new introduced ;) ) + +-------------------- +- August 20th, 2002- +-------------------- +Merkur: fixed more bugs (more crashbugs, some protocol errors and misc bugs :) ) +Merkur: fixed a huge memoryleak which was introduced in version 0.1a or 0.1b. However there is still a small memoryleak, which I wasn't able to track down yet, it should be fixed in the next version though +Merkur: you can now sort searchresults and downloads (/clients) + + +-------------------- +- August 19th, 2002- +-------------------- +Merkur: fixed several bugs (most of them crashed emule) + +-------------------- +- August 17th, 2002- +-------------------- +Merkur: Download is working now +Merkur: You can now cancel a downloading file +Merkur: some bugs and many other small things fixed + +-------------------- +- August 15th, 2002- +-------------------- +Merkur: the downloadwindow should be flicker free now +Merkur: serverstatus (users & files) is displayed + +-------------------- +- August 14th, 2002- +-------------------- +Merkur: After eMule found about 1000 sources for a file in my tests I deceided to implement the Max-Connections Setting. + +-------------------- +- August 13th, 2002- +-------------------- +Merkur: you can now connect to low ip clients (but you still need a high id) +Merkur: looking for sources on your server works. UDP source-lookup is in too now +Merkur: you can start downloading something from your searchlist (however download-transfer is not in yet) +Merkur: source part status is in and displayed +Merkur: fixed some bad crash bugs +Merkur: fixed some memoryleaks + +-------------------- +- August 9th, 2002 - +-------------------- +Merkur: part files are now shared and other edonkey clients are able to download parts +Merkur: uploading clients will be kicked after some time to allow other clients to download (depends on score of the uploading client und the clients in queue.. in general (without any factors) it should be ~ 15 min + +-------------------- +- August 8th, 2002 - +-------------------- +Merkur: finished the progressbar for downloading files +Merkur: fixed a bug in uploadwindow which showed wrong informations sometimes +Merkur: searchlist will now paint frequent files blue (like edonkey does) + +-------------------- +- August 5th, 2002 - +-------------------- +Merkur: emule can now read & check part.met files +Merkur: some code cleanups & some minor bugs fixed + +-------------------- +- August 4th, 2002 - +-------------------- +Merkur: Implemented basic upload abilities. However it's not complete yet and only high-ID to high-ID transfer is possible in most cases. + +-------------------- +- July 31th, 2002 - +-------------------- +Merkur: fixed a bug with fileids (checksum was wrong sometimes) + +-------------------- +- July 7th, 2002 - +-------------------- +Merkur: first (source only) Release diff --git a/license/license-CN.txt b/license/license-CN.txt new file mode 100644 index 0000000..c563bd2 --- /dev/null +++ b/license/license-CN.txt @@ -0,0 +1,133 @@ +GNU 通用公共授权 + +第二版, 1991年6月 + +著作权所有 (C) 1989,1991 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +允许每个人复制和发布本授权文件的完整副本, +但不允许对它进行任何修改。 + +本版本由 Leo-Hong (leohca (at) yahoo.com) 翻译整理, Chao-Hong Liu 校正. + + +导言 + +大多数软件授权声明是设计用以剥夺您共享与修改软件的自由。相反地,GNU通用公共授权力图保证您分享与修改自由软件的自由-确保软件对所有的使用者都是自由的。通用公共授权适用于大多数自由软件基金会的软件,以及任何作者指定使用本授权的其他软件。(有些自由软件基金会的软件,则适用GNU函式库通用公共授权规定。)您也可以让您的软件适用本授权规定。 + +当我们在谈论自由软件时,我们所指的是自由,而不是价格。我们的通用公共授权是设计用以确保使您拥有发布自由软件备份的自由(以及您可以决定此一服务是否收费),确保您能收到源码或者在您需要时能得到它,确保您能变更软件或将它的一部分用于新的自由软件;并且确保您知道您可以做上述的这些事情。 + +为了保障您的权利,我们需要作出限制:禁止任何人否认您上述的权利,或者要求您放弃这些权利。如果您发布软件的副本,或者对之加以修改,这些限制就转化成为您的责任。 + +例如,假如您发布此类程序的副本,无论是免费或收取费用,您必须将您所享有的一切权利给予收受者。您也必须确保他们也能收到或得到原始程序码。而且您必须向他们展示这些条款的內容,使他们知到他们所享有的权利。 + +我们采取两项措施來保护您的权利:(1)以著作权保护软件,以及(2)提供您本授权,赋与您复制、发布并且/或者修改软件的法律许可。 + +同时,为了保护作者与我们(按:指自由软件基金会),我们想要确定每个人都明白,自由软件是沒有担保责任的。如果软件被他人修改并加以传播,我们需要其收受者知道,他们所得到的并非原始版本,因此由他人所引出的任何问题对原作者的声誉将不会有任何的影响。 + +最后,所有自由软件不断地受到软件专利的威胁。我们希望能避免自由软件的再发布者以个人名义取得专利授权而使程序专有化的风险。为了防止上述的情事发生,我们在此明确声明:任何专利都必须为了每个人的自由使用而核准,否则就不应授与专利。 + +以下是有关复制、发布及修改的明确条款及条件。 + +复制、发布与修改的条款与条件 + +0. 凡著作权人在其程序或其他著作中声明,该程序或著作会在通用公共授权条款下发布,本授权对其均有适用。以下所称的"程序",是指任何一种适用通用公共授权的程序或著作;并且一个"基于本程序的著作",则指本程序或任何基于著作权法所产生的衍生著作,换言之,是指包含本程序全部或一部的著作,不论是完整的或经过修改的程序,以及(或)翻译成其他语言的程序(以下"修改"一词包括但不限于翻译行为在內)。被授权人则称为"您"。 + +本授权不适用于复制、发布与修改以外的行为;这些行为不在本授权范围内。执行本程序的行为并不受限制,而本程序的输出只有在其內容构成基于本程序所生的著作(而非只是因为执行本程序所造成)时,始受本授权拘束。至于程序的输出內容是否构成本程序的衍生著作,则取决于本程序的具体用途。 + +1. 您可以对所收受的本程序源代码,无论以何种媒介,复制与发布其完整的复制物,然而您必须符合以下要件:以显著及适当的方式在每一份复制物上发布适当的著作权标示及无担保声明;维持所有有关本授权以及无担保声明的原貌;并将本授权的副本连同本程序一起交付予其他任何一位本程序的收受者。 + +您可以对让与复制物的实际行为收取一定的费用,您也可以自由决定是否提供担保以作为对价的交换。 + +2. 您可以修改本程序的一个或数个复制物或者本程序的任何部份,以此形成基于本程序所生的著作,并依前述第一条规定,复制与发布此一修改过的程序或著作,但您必须符合以下要件: + +(a) 您必须在所修改的挡案上附加显著的标示,阐明您修改过这些挡案,以及修改日期。 + +(b) 您必须就您所发布或发行的著作,无论是包含本程序全部或一部的著作,或者是自本程序或其任何部份所衍生的著作,整体授权所有第三人依本授权规定使用,且不得因此项授权行为而收取任何费用。 + +(c) 若经过修改的程序在执行时通常以交互方式读取命令时,您必须在最常被使用的方式下,于开始进入这种交互式使用时,列印或展示以下宣告:适当的著作权标示及无担保声明(或者声明您提供担保)、使用者可以依这些条件再发布此程序,以及告知使用者如何浏览本授权的副本。(例外:若本程序本身是以交互的方式执行,然而通常却不会列印该宣告时,则您基于本程序所生的著作便无需列印该宣告。) + +这些要求对修改过的著作是整体适用的。倘著作中可识別的一部份并非衍生自本程序,并且可以合理地认为是一独立的、个別的著作,则当您将其作为个別著作加以发布时,本授权及其条款将不适用于该部分。然而当您将上述部分,作为基于本程序所生著作的一部而发布时,整个著作的发布必须符合本授权条款的规定,而本授权对于其他被授权人所为的许可及于著作整体。 + +因此,本条规定的意图不在于主张或剥夺您对于完全由您所完成著作的权利;应该說,本条规定意在行使对基于程序所生的之衍生著作或集合著作发布行为的控制权。 + +此外,非基于本程序所生的其他著作与本程序(或基于本程序所生的著作)在同一储存或发布的媒介上的单纯聚集行为,并不会使该著作因此受本授权条款约束。 + +3. 您可以依前述第一、二条规定,复制与发布本程序(或第二条所述基于本程序所产生的著作)的目的码或可执行形式,但您必须符合以下要件: + +(a) 附上完整、相对应的机器可判读源码,而这些源码必须依前述第一、二条规定在经常用以作为软件交换的媒介物上发布;或 + +(b) 附上至少三年有效的书面报价文件,提供任何第三人在支付不超过实际发布源码所需成本的费用下,取得相同源码的完整机器可读复制物,并依前述第一、二条规定在经常用以作为软件交换的媒介物上发布该复制物;或 + +(c) 附上您所收受有关发布相同源码的报价资讯。(本项选择仅在非赢利发布、且仅在您依前述b项方式自该书面报价文件收受程序目的码或可执行形式时,始有适用。) + +著作的源码,是指对著作进行修改时适用的形式。对于一个可执行的著作而言,完整的源码是指著作中所包含所有模组的全部源码,加上相关介面的定义挡,还加上用以控制该著作编译与安裝的描述。然而,特別的例外情况是,所发布的源码并不需包含任何通常会随著所执行作业系统的主要组成部分(编译器、核心等等)而发布的软件(无论以源码或二进位格式),除非该部分本身即附加在可执行程序中。 + +若可执行码或目的码的发布方式,是以指定的地点提供存取位置供人复制,则提供可自相同地点复制源码的使用机会,视同对于源码的发布,然而第三人并不因此而负有将目的码连同源码一起复制的义务。 + +4. 除本授权所明示的方式外,您不得对本程序加以复制、修改、再授权或发布。任何试图以其他方式进行复制、修改、再授权或者发布本程序的行为均为无效,并且将自动终止您基于本授权所得享有的权利。然而,依本授权规定自您手中收受复制物或权利之人,只要遵守本授权规定,他们所获得的授权并不会因此终止。 + +5. 因为您并未在本授权上签名,所以您无须接受本授权。然而,除此之外您別无其他修改或发布本程序或其衍生著作的授权许可。若您不接受本授权,则这些行为在法律上都是被禁止的。因此,藉由对本程序(或任何基于本程序所生的著作)的修改或发布行为,您表示了对于本授权的接受,以及接受所有关于复制、发布或修改本程序或基于本程序所生著作的条款与条件。 + +6. 每当您再发布本程序(或任何基于本程序所生的著作)时,收受者即自动获得原授权人所授予依本授权条款与条件复制、发布或修改本程序的权利。您不得就本授权所赋予收受者行使的权利附加任何进一步的限制。您对于第三人是否履行本授权一事,无须负责。 + +7. 若法院判决、专利侵权主张或者其他任何理由(不限于专利争议)的结果,使得加诸于您的条件(无论是由法院命令、协议书或其他方式造成)与本授权规定有所冲突,他们并不免除您对于本授权规定的遵守。若您无法同时符合依本授权所生义务及其他相关义务而进行发布,那么其结果便是您不得发布该程序。例如,若专利授权不允许其他人直接或间接取得复制物,通过您以免付权利金的方式再发布该程序,您唯一能同时滿足该义务及本授权的方式就是徹底避免进行该程序的发布。 + +若本条任一部份在特殊情况下被认定无效或无法执行时,本条其余部分仍应适用,且本条全部于其他情况下仍应适用。 + +本条的目的并不在诱使您侵害专利或其他財产权的权利主张,或就此类主张的有效性加以争执;本条的唯一目的,是在保障藉由公共授权惯例所执行自由软件发布系统的完整性。许多人信赖该系统一贯使用的应用程序,而对经由此系统发布的大量软件有相当多的贡献;作者/贡献者有权决定他或她是否希望经由其他的系统发布软件,而被授权人则无该种选择权。 + +本条的用意在于将本授权其他不确定的部分徹底解释清楚。 + +8. 若因为专利或享有著作权保护的介面问题,而使得本程序的发布与/或使用局限于某些国家时,则将本程序置于本授权规范之下的原著作权人得增列明确的发布地区限制条款,将这些国家排除在外,而使发布的许可只限在未受排除的国家之內或之中。在该等情况下,该限制条款如同以书面方式订定于本授权內容中,而成为本授权的条款。 + +9. 自由软件基金会得随时发表通用公共授权的修正版与/或新版本。新版本在精神上将近似于目前的版本,然而在细节上或所不同以因应新的问题或状况。 + +每一个版本都有个別的版本号码。若本程序指定有授权版本号码,表示其适用该版本或是"任何新版本"时,您可以选择遵循该版本或任何由自由软件基金会日后所发表新版本的条款与条件。若本程序并未指定授权版本号码时,您可以选择任一自由软件基金会所发表的版本。 + +10. 若您想将部分本程序纳入其他自由程序,而其发布的条件有所不同时,请写信取得作者的许可。若为自由软件基金会享有著作权的软件,请写信至自由软件基金会;我们有时会以例外方式予以处理。我们的决定取决于两项目标:确保我们自由软件的所有衍生著作均维持在自由的状态,并广泛地促进软件的分享与再利用。 + +无担保声明 + +11. 由于本程序是无偿授权,因此在法律许可范围內,本授权对本程序并不负担保责任。非经书面声明,著作权人与/或其他提供程序之人,无论明示或默许,均是依「现况」提供本程序而并无任何形式的担保责任,其包括但不限于,就适售性以及特定目的的适用性为默示性担保。有关本程序品质与效能的全部风险均由您承担。如本程序被证明有瑕疵,您应承担所有服务、修复或改正的费用。 + +12. 非经法律要求或书面同意,任何著作权人或任何可能依前述方式修改与/或发布本程序者,对于您因为使用或不能使用本程序所造成的一般性、特殊性、意外性或间接性损失,不负任何责任(包括但不限于,资料损失,资料执行不精确,或应由您或第三人承担的损失,或本程序无法与其他程序运作等),即便前述的著作权人或其他人已被告知该等损失的可能性时,也是一样。 + +-条文结束- + + + +您的新程序该如何采用这些条款? + + +如果您开发了一个新程序,并且希望能够让它尽可能地被大众使用,达成此目的的最好方式就是让它成为自由软件,任何人依这些条款规定都能就该软件再为发布及修改。 + +为了做到这一点,请将以下声明附加到程序上。最安全的作法,是将声明放在每份源码挡案的起始处,以有效传达无担保责任的讯息;且每份挡案至少应有「著作权」列以及本份声明全文位置的提示。 + +用一行描述程序的名称与其用途简述 +著作权所有(C) 〈年份〉〈作者姓名〉 + +本程序为自由软件;您可依据自由软件基金会所发表的GNU通用公共授权条款规定,就本程序再为发布与/或修改;无论您依据的是本授权的第二版或(您自行选择的)任一日后发行的版本。 + +本程序是基于使用目的而加以发布,然而不负任何担保责任;亦无对适售性或特定目的适用性所为的默示性担保。详情请参照GNU通用公共授权。 + +您应已收到附随于本程序的GNU通用公共授权的副本;如果没有,请写信至自由软件基金会:59 Temple Place - Suite 330, Boston, Ma 02111-1307, USA。 + +同时附上如何以电子及书面信件与您联系的资料。 + +若程序是以交互方式运作时,请在交互式模式开始时,输出简短提示如下: + +Gnomovision 第69版,著作权所有 (c) 年份 作者姓名 +Gnomovision不负担保责任,欲知详情请键入'show w'。这是一个自由软件,欢迎您在特定条件下再发布本程序;欲知详情请键入'show c'。 + +所假设的指令'show w'与'show c'应显示通用公共授权的相对应条款。当然,您可以使用'show w'与'show c'以外的指令名称;甚至以鼠标键击或选菜单方式进行-只要是合于您程序需要的方式都可以。 + +如有需要,您亦应取得您的雇主(若您的工作为程序设计師)或学校就本程序所签署的「著作权放弃承諾书」。其范例如下,您只要修改姓名即可: + +Yoyodyne公司,茲此放弃James Hacker所写之'Gnomovision'程序(该程序产出编译器所需资讯)所有的著作权利益。 + +〈Ty Coon公司签章〉,1989年四月一日 + +Ty Coon公司,副总裁 + +本通用公共授权并不允许您将本程序并入专有程序中。若您的程序是一子程序函数库时,您可能认为允许专有应用程序与该函式库相连结会更有帮助。若这是您所想做的,请使用GNU函式库通用公共授权代替本授权。 \ No newline at end of file diff --git a/license/license-DK.txt b/license/license-DK.txt new file mode 100644 index 0000000..882f32c --- /dev/null +++ b/license/license-DK.txt @@ -0,0 +1,276 @@ +Dette er en uofficiel dansk oversttelse af GNU General Public License. Denne +oversttelse er ikke offentliggjort af Free Software Foundation og er ikke en +juridisk beskrivelse af forhold, der gr sig gldende for software distribueret +under GNU GPL -- det er kun den originale engelske version af GNU GPL (se: +http://www.fsf.org/copyleft/gpl.html). Det er dog vores hb, at denne +oversttelse vil hjlpe dansktalende til at forst GNU GPL bedre. + +Denne oversttelse vedligeholdes af Christian Hansen +Sidst ndret 20020716 + +GNU GENERAL PUBLIC LICENSE +2. version, juni 1991 +Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite +330, Boston, MA 02111-1307, USA + +Enhver har tilladelse til at kopiere og distribuere ordrette eksemplarer af +dette licensdokument, men det er ikke tilladt at ndre det. + +Forord + +De fleste licenser p software har til forml at fjerne Deres ret til at dele +softwaren med andre og ndre i det. I modstning hertil har GNU General Public +License til forml at garantere Deres ret til at dele og ndre frit software - +for at sikre, at det pgldende software er tilgngeligt for alle brugere. Denne +licens, General Public License, er gldende for strstedelen af Free Software +Foundations software samt for ethvert andet program, hvis ophavsmnd nsker at +anvende licensen. (En del af Free Software Foundations programmer er i stedet +omfattet af "The GNU Library General Public License".) De kan ogs anvende +licensen til Deres programmer. + +Vi taler om frit software - ikke gratis software. Dvs. vi taler om +frihedsgraden, og ikke om prisen. Vores licenser, General Public Licenses, er +udarbejdet med henblik p at sikre Deres frihed til at distribuere kopier af +frit software (og evt. tage betaling for denne ydelse) og at srge for, at De +modtager den pgldende kildetekst eller kan f den, hvis De vil; at De kan +ndre softwaren eller bruge dele af det til nye programmer; og at De er klar +over, at De har disse rettigheder. + +For at beskytte Deres rettigheder er vi ndt til at lave restriktioner, der +forbyder andre at ngte Dem disse rettigheder eller krve, at De afstr disse +rettigheder. Disse restriktioner indebrer visse forpligtelser for Dem, hvis De +distribuerer kopier af softwaren eller ndrer det. + +Hvis De f.eks. distribuerer kopier af et sdant program, enten gratis eller mod +gebyr, er De forpligtet til at give modtagere alle de rettigheder, som De selv +har. De skal sikre, at ogs modtagerne fr eller kan f fat p kildeteksten. +Desuden er De forpligtet til, at vise modtagerne disse betingelser, s de ogs +er bekendt med deres rettigheder. + +Vi beskytter Deres rettigheder med en totrinsmodel: (1) vi tager ophavsret p +softwaren og (2) vi tilbyder Dem denne licens, der giver Dem juridisk ret til at +kopiere, distribuere og/eller ndre softwaren. + +Desuden vil vi med henblik p at beskytte os selv og de enkelte +softwareproducenter sikre os, at alle er bekendte med, at der ikke ydes nogen +garanti p dette frie software. Hvis programmet er ndret af en anden og givet +videre, vil vi have, at modtagerne skal vide, at deres version ikke er det +originale program. Sledes undgr vi, at eventuelle problemer indarbejdet af +andre ikke skader de oprindelige softwareproducenters ry. + +Endelig er ethvert frit program under konstant trussel fra softwarepatenter. Vi +nsker at undg faren for, at de, der videregiver et frit program, personligt +udtager patentlicens, hvorved programmet faktisk bliver beskyttet af ophavsret. +For at undg dette har vi gjort det klart, at ethvert patent skal registreres +til alles frie afbenyttelse eller slet ikke registreres. + +Nedenfor flger de betingelser og vilkr, der glder i forhold til at kopiere, +distribuere og ndre software under General Public License. + +BETINGELSER OG VILKR FOR KOPIERING, DISTRIBUTION OG NDRING AF SOFTWARE UNDER +GENERAL PUBLIC LICENSE +0. Denne licens glder for ethvert program eller andet vrk, som ved siden af +navnet p ophavsretindehaveren har en meddelelse om, at det pgldende produkt +m distribueres under de gldende betingelser for denne General Public License. +I det flgende henviser ordet "Program" til ethvert sdant program eller vrk, +og et "Vrk baseret p Programmet" betegner enten Programmet eller ethvert +afledt vrk i henhold til lovgivningen om ophavsret. Det betyder med andre ord +et vrk, der indeholder Programmet eller en del af det, enten ordret eller +ndret og/eller oversat til et andet sprog. (I det flgende omfattes +oversttelser, uden begrnsninger, af termen "ndring".) Enhver licenstager +tiltales som "De". + +Aktiviteter ud over kopiering, distribution og ndring er ikke dkket af denne +licens men falder uden for dens omrde. Der er ingen restriktioner p at kre +Programmet, og outputtet fra Programmet er kun omfattet, hvis indholdet heraf +udgr et Vrk baseret p Programmet (uafhngigt af at vre blevet lavet ved at +kre Programmet). Om dette er tilfldet, afhnger af, hvad Programmet gr. +1. De har ret til at kopiere og distribuere ordrette kopier af Programmets +kildetekst, sledes som De har modtaget den, i ethvert medium, under +forudstning af, at alle kopier tydeligt og p behrig vis forsynes med en +passende ophavsretmeddelelse og garantifraskrivelse; at alle meddelelser, der +refererer til denne licens og den manglende garanti, bibeholdes; og at en kopi +af denne licens vedlgges, nr De distribuerer Programmet. + +De har ret til at tage et gebyr for den fysiske handling at overfre en kopi, og +De kan eventuelt tilbyde garantibeskyttelse mod et gebyr. +2. De har ret til at ndre Deres kopi eller kopier, eller en hvilken som helst +del deraf, hvorved der skabes et Vrk baseret p Programmet, samt ret til at +kopiere og distribuere sdanne ndringer eller vrk i henhold til paragraf 1 +ovenfor, forudsat De ogs opfylder flgende betingelser: De er forpligtet til at +sikre, at de ndrede filer har en tydelig meddelelse om, at De har foretaget +ndringer i filerne samt datoen herfor. + +De er forpligtet til at sikre, at ethvert vrk, som De distribuerer eller +offentliggr, der helt eller delvis indeholder Programmet, eller som er afledt +af Programmet eller dele heraf, skal registreres til alles frie afbenyttelse i +henhold til denne licens. + +Hvis det ndrede program normalt lser kommandoer interaktivt, nr det kres, +skal De sikre, at der ved starten p programkrslen for interaktiv brug p den +mest normale vis udskrives eller vises en meddelelse, som indeholder behrig +ophavsretmeddelelse og garantifraskrivelse (eller alternativt tilkendegive, at +De nsker at tilbyde garanti) samt fortller, at brugere har ret til +videredistribuere Programmet under disse betingelser. Desuden skal meddelelsen +orientere brugeren om, hvordan en kopi af denne licens kan vises. (Undtagelse: +Hvis selve Programmet er interaktivt, men ikke normalt printer en sdan besked, +krves det ikke, at Deres Vrk baseret p Programmet printer den omtalte +besked.) +Disse krav er gldende for det ndrede vrk i sin helhed. Hvis identificerbare +sektioner af vrket ikke er afledt af Programmet, og hvis disse i sig selv med +rimelighed kan anses for at vre selvstndige og separate vrker, s glder +denne licens og dens betingelser ikke for de sektioner, nr De distribuerer dem +som separate vrker. Hvis De derimod distribuerer de samme sektioner som en del +af et hele, der udgr et Vrk baseret p Programmet, skal denne distribution +vre i overensstemmelse med licensens betingelser. De rettigheder, som licensen +yder alle, udvides til det pgldende vrk i sin helhed og glder sledes for +enhver del af vrket, uanset ophavsmanden. + +Det er sledes ikke vores hensigt med denne paragraf at pberbe os rettigheder +eller bestride Deres rettigheder til vrker skrevet af Dem alene. Hensigten er +derimod at udve vores ret til at kontrollere distributionen af afledte vrker +eller kollektive vrker baseret p Programmet. + +Hertil kommer, at forekomsten af et andet vrk p et lagrings- eller +distributionsmedium, der indeholder Programmet eller et Vrk baseret p +Programmet, medfrer ikke, at det andet vrk omfattes af betingelserne for denne +licens. +3. De har ret til at kopiere og distribuere Programmet (eller et Vrk baseret p +Programmet i henhold til paragraf 2) i objektkode eller i eksekverbar form i +henhold til betingelserne i paragraf 1 og 2 under forudstning af, at De ogs +flger n af disse retningslinjer: Programmet ledsages af den fuldstndige +maskinlsbare kildetekst, der skal distribueres under de anfrte betingelser i +paragraf 1 og 2 ovenfor i et medium, der sdvanligvis bruges til udveksling af +software; eller + +Programmet ledsages af et skriftligt tilbud - gldende i mindst tre r - om at +give tredjemand den fuldstndige maskinlsbare kildetekst, der skal distribueres +under de anfrte betingelser i paragraf 1 og 2 ovenfor i et medium, der +sdvanligvis bruges til udveksling af software, mod et gebyr, der maksimalt +dkker Deres omkostninger ved rent fysisk at udfre distributionen,; eller + +Programmet ledsages af den information, som De modtog vedrrende tilbuddet om at +distribuere kildeteksten. (Dette alternativ glder udelukkende for ukommerciel +distribution, og kun hvis De har modtaget Programmet i objektkode eller i +eksekverbar form med et sdant tilbud i henhold til stykke b ovenfor.) +Kildeteksten for et vrk betyder den form af et givet vrk, der foretrkkes som +grundlag for at ndre det. For et eksekverbart vrk betyder den fuldstndige +kildetekst hele kildeteksten for alle de moduler, det indeholder, plus +eventuelle tilhrende grnseflade-definitionsfiler plus de skripter, der +anvendes til at kontrollere kompileringen og installeringen af det eksekverbare +software. Helt undtagelsesvis behver den kildetekst, der distribueres, dog ikke +at indeholde noget, der normalt distribueres (enten i kildeform eller i binr +form) sammen med de strre komponenter i operativsystemet (compiler, +kerneprogram, osv.), som det eksekverbare program kres p, medmindre den +komponent selv ledsager det eksekverbare program. + +Hvis distributionen af det eksekverbare program eller objektkoden foretages ved +tilbud om adgang til at kopiere fra et angivet sted, regnes tilbud om +tilsvarende adgang til at kopiere kildeteksten fra det samme sted som +distribution af kildeteksten, ogs selv om tredjemand ikke er tvunget til at +kopiere kildeteksten sammen med objektkoden. +4. De har kun ret til at kopiere, ndre, udstede underlicenser for eller +distribuere Programmet som udtrykkeligt anfrt i de specifikke betingelser for +licensen. Herudover er ethvert forsg p at kopiere, ndre, udstede +underlicenser for eller distribuere Programmet ugyldigt og medfrer automatisk +ophr af Deres rettigheder i henhold til denne licens. P den anden side vil +tredjemand, der mtte have modtaget kopier eller rettigheder fra Dem i henhold +til denne licens, ikke miste sin licens s lnge alle betingelser for licensen +overholdes. +5. De er ikke forpligtet til at acceptere denne licens, eftersom De ikke har +skrevet under p den. De har dog ingen anden mulighed for at f tilladelse til +at ndre eller distribuere Programmet eller dets afledte vrker, og de +handlinger er forbudt ved lov, hvis De ikke accepterer denne licens. Ved at +ndre eller distribuere Programmet (eller et Vrk baseret p Programmet) +tilkendegiver De derfor Deres accept af licensen samt alle dens betingelser og +vilkr for at kopiere, distribuere eller ndre Programmet eller Vrker baseret +p Programmet. +6. Hver gang De distribuerer Programmet (eller et Vrk baseret p Programmet), +fr modtageren automatisk licens fra den oprindelige licensgiver til at kopiere, +distribuere eller ndre Programmet i henhold til disse betingelser og vilkr. De +har ikke ret til at plgge modtagerne yderligere restriktioner i deres brug af +de rettigheder, der herved ydes. De er ikke ansvarlig for at hndhve +tredjemands overholdelse af denne licens. +7. Hvis De som flge af en retsafgrelse eller pstand om krnkelse af patentret +eller af en hvilken som helst anden grund (ikke begrnset til patentudstedelse) +ptvinges vilkr (det vre sig ved retskendelse, kontrakt eller andet), der +strider mod vilkrene for denne licens, er De ikke dermed fritaget for vilkrene +for denne licens. Hvis De ikke kan distribuere Programmet, sledes at De p +samme tid opfylder Deres forpligtelser i henhold til denne licens og i +overensstemmelse med andre relevante forpligtelser, flger det, at De ikke har +tilladelse til at distribuere Programmet overhovedet. Hvis f.eks. en +patentlicens ikke ville tillade afgiftsfri videredistribution af Programmet via +alle dem, der modtager kopier direkte eller indirekte igennem Dem, ville den +eneste mde, hvorp De kunne overholde bde patentlicensen og denne licens, at +De fuldstndigt afholder Dem fra at distribuere Programmet. + +Dersom en del af denne paragraf erklres ugyldig eller bliver umulig at hndhve +i en bestemt situation, er det hensigten, at resten af paragraffen skal finde +anvendelse, ligesom det er hensigten, at paragraffen som helhed skal glde i +andre situationer. + +Det er sledes ikke formlet med denne paragraf at tilskynde Dem til at krnke +andre patenter eller ejendomskrav eller at bestride gyldigheden af sdanne krav. +Denne paragraf har udelukkende til forml at beskytte integriteten af +distributionssystemet for frit software, som er implementeret gennem offentlig +licenspraksis. Der er mange mennesker, der har ydet store bidrag til det brede +udvalg af software, der distribueres via dette system i tiltro til, at systemet +anvendes konsekvent. Det er op til softwareproducenten/donoren at beslutte, om +han eller hun er villig til at distribuere software via et andet system, og en +licenstager har ikke ret til at ptvinge nogen et sdant valg. + +Formlet med denne paragraf er at gre det fuldstndigt klart, hvad konsekvensen +af resten af denne licens menes at vre. +8. Hvis distributionen og/eller brugen af Programmet er underlagt restriktioner +i visse lande pga. enten patenter eller grnseflader, der er belagt med +ophavsret, kan den oprindelige ophavsretindehaver, der har placeret Programmet +under denne licens, tilfje en udtrykkelig geografisk distributionsbegrnsning, +der udelukker de pgldende lande, sledes at distribution kun er tilladt i +eller imellem lande, der ikke p denne vis er udelukket. I tilflde heraf +inkorporerer denne licens en sdan begrnsning som om den var indarbejdet i +selve licenstekstens ordlyd. +9. The Free Software Foundation offentliggr formodentligt reviderede og/eller +nye versioner af sin General Public License fra tid til anden. Sdanne nye +versioner vil udtrykke den samme grundlggende tankegang som den nuvrende +version, men visse detaljer vil sikkert ndres for at tage hjde for nye vinkler +eller problemer. + +Det er let at kende forskel p de forskellige versioner, idet de alle er +tydeligt forsynet med et nummer. Hvis Programmet specificerer et versionsnummer +for denne licens som gldende for Programmet, tillige med ordene "alle senere +versioner", har De mulighed for at vlge, om De vil flge vilkr og betingelser +for enten den version eller en anden senere version udgivet af The Free Software +Foundation. Hvis Programmet ikke specificerer et versionsnummer for denne +licens, kan De vlge blandt samtlige versioner, der nogensinde er udgivet af The +Free Software Foundation. +10. Hvis De nsker at inkorporere dele af Programmet i andre frie programmer, +der er underlagt andre distributionsbetingelser, foreslr vi, at De skriver til +ophavsmanden og anmoder om tilladelse. Hvis det drejer sig om software, hvor +ophavsretten tilhrer The Free Software Foundation, bedes De skrive til The Free +Software Foundation. Der er visse undtagelser. Vores afgrelse vil vre baseret +p to ml - at bevare den frie status for alle afledte vrker af vores frie +software og at fremme udvekslingen og genbrugen af software generelt. + +INGEN GARANTI +11. IDET LICENSEN GIVER GRATIS BRUGSTILLADELSE P PROGRAMMET, YDES DER INGEN +GARANTI P PROGRAMMET I DET OMFANG, DET ER TILLADT EFTER GLDENDE LOV. MEDMINDRE +DET UDTRYKKELIGT MEDDELES SKRIFTLIGT, YDER OPHAVSRETINDEHAVERNE OG/ELLER ANDRE +PARTER PROGRAMMET "SOM BESET" UDEN GARANTI AF NOGEN ART, DET VRE SIG UDTRYKTE +ELLER UNDERFORSTEDE GARANTIER, HERUNDER, MEN IKKE BEGRNSET TIL, DE +UNDERFORSTEDE GARANTIER VEDRRENDE SALGBARHED OG SPECIFIK BRUGSEGNETHED. DEN +FULDE RISIKO, HVAD ANGR PROGRAMMETS KVALITET OG FUNKTION, PHVILER DEM. SKULLE +DET VISE SIG, AT PROGRAMMET ER DEFEKT, SKAL DE ERHOLDE UDGIFTERNE TIL AL +NDVENDIG SERVICE, REPARATION ELLER JUSTERING. +12. UNDER INGEN OMSTNDIGHEDER - MEDMINDRE DET KRVES AF GLDENDE LOV ELLER ER +SKRIFTLIGT AFTALT - SKAL EN OPHAVSRETINDEHAVER ELLER EN ANDEN PART, DER HAR +TILLADELSE TIL AT NDRE OG/ELLER DISTRIBUERE PROGRAMMET SLEDES SOM BESKREVET +OVENFOR, VRE ERSTATNINGSANSVARLIG OVER FOR DEM VEDRRENDE SKADER, HERUNDER +GENERELLE, SPECIFIKKE OG TILFLDIGE SKADER SAMT FLGESKADER I FORBINDELSE MED +BRUG AF ELLER MANGLENDE BRUG AF PROGRAMMET (HERUNDER MEN IKKE BEGRNSET TIL TAB +AF DATA ELLER DATA, DER ER BLEVET UNJAGTIGE, ELLER TAB, DER ER PFRT DEM ELLER +TREDJEMAND, ELLER PROGRAMMETS MANGLENDE EVNE TIL AT KRE SAMMEN MED ANDRE +PROGRAMMER) SELV OM DEN PGLDENDE OPHAVSRETINDEHAVER ELLER ANDEN PART ER BLEVET +OPLYST OM MULIGHEDEN FOR, AT SDANNE TAB KUNNE OPST. + +HER SLUTTER BETINGELSER OG VILKR FOR GENERAL PUBLIC LICENSE + diff --git a/license/license-FR.txt b/license/license-FR.txt new file mode 100644 index 0000000..ad8d37e --- /dev/null +++ b/license/license-FR.txt @@ -0,0 +1,336 @@ +GPL + +Introduction +This is an unofficial translation of the GNU General Public License into French. +It was not published by the Free Software Foundation, and does not legally state +the distribution terms for software that uses the GNU GPL--only the original +English text of the GNU GPL does that. However, we hope that this translation +will help French speakers understand the GNU GPL better. + +Voici (http://www.linux-france.org/article/these/gpl.html) une adaptation non +officielle de la Licence Publique Gnrale du projet GNU. Elle n'a pas t +publie par la Free Software Foundation et son contenu n'a aucune porte lgale +car seule la version anglaise de ce document dtaille le mode de distribution +des logiciels sous GNU GPL. Nous esprons cependant qu'elle permettra aux +francophones de mieux comprendre la GPL. + +Licence Publique Gnrale GNU Version 2, Juin 1991 +Copyright Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 +tats-Unis, 1989, 1991. +La copie et la distribution de copies exactes de ce document sont autorises, +mais aucune modification n'est permise. + +Prambule +Les licences d'utilisation de la plupart des programmes sont dfinies pour +limiter ou supprimer toute libert l'utilisateur. l'inverse, la Licence +Publique Gnrale (General Public License) est destine vous garantir la +libert de partager et de modifier les logiciels libres, et de s'assurer que ces +logiciels sont effectivement accessibles tout utilisateur. + +Cette Licence Publique Gnrale s'applique la plupart des programmes de la +Free Software Foundation, comme tout autre programme dont l'auteur l'aura +dcid (d'autres logiciels de la FSF sont couverts pour leur part par la Licence +Publique Gnrale pour Bibliothques GNU (LGPL)). Vous pouvez aussi appliquer +les termes de cette Licence vos propres programmes, si vous le dsirez. + +Libert des logiciels ne signifie pas ncessairement gratuit. Notre Licence est +conue pour vous assurer la libert de distribuer des copies des programmes, +gratuitement ou non, de recevoir le code source ou de pouvoir l'obtenir, de +modifier les programmes ou d'en utiliser des lments dans de nouveaux +programmes libres, en sachant que vous y tes autoris. + +Afin de garantir ces droits, nous avons d introduire des restrictions +interdisant quiconque de vous les refuser ou de vous demander d'y renoncer. +Ces restrictions vous imposent en retour certaines obligations si vous +distribuez ou modifiez des copies de programmes protgs par la Licence. En d'autre +termes, il vous incombera en ce cas de : + +transmettre aux destinataires tous les droits que vous possdez, + +expdier aux destinataires le code source ou bien tenir celui-ci leur +disposition, + +leur remettre cette Licence afin qu'ils prennent connaissance de leurs droits. + +Nous protgeons vos droits de deux faons : d'abord par le copyright du logiciel, +ensuite par la remise de cette Licence qui vous autorise lgalement copier, +distribuer et/ou modifier le logiciel. + +En outre, pour protger chaque auteur ainsi que la FSF, nous affirmons +solennellement que le programme concern ne fait l'objet d'aucune garantie. Si +un tiers le modifie puis le redistribue, tous ceux qui en recevront une copie +doivent savoir qu'il ne s'agit pas de l'original afin qu'une copie dfectueuse n'entache +pas la rputation de l'auteur du logiciel. + +Enfin, tout programme libre est sans cesse menac par des dpts de brevets. +Nous souhaitons tout prix viter que des distributeurs puissent dposer des +brevets sur les Logiciels Libres pour leur propre compte. Pour viter cela, nous +stipulons bien que tout dpt ventuel de brevet doit accorder expressment +tout un chacun le libre usage du produit. + +Les dispositions prcises et les conditions de copie, de distribution et de +modification de nos logiciels sont les suivantes : + +Stipulations et conditions relatives la copie, la distribution et la +modification + +Article 0 +La prsente Licence s'applique tout Programme (ou autre travail) o figure une +note, place par le dtenteur des droits, stipulant que ledit Programme ou +travail peut tre distribu selon les termes de la prsente Licence. Le terme +Programme dsigne aussi bien le Programme lui-mme que tout travail qui en est +driv selon la loi, c'est--dire tout ouvrage reproduisant le Programme ou une +partie de celui-ci, l'identique ou bien modifi, et/ou traduit dans une autre +langue (la traduction est considre comme une modification). Chaque personne +concerne par la Licence Publique Gnrale sera dsigne par le terme Vous. + +Les activits autres que copie, distribution et modification ne sont pas +couvertes par la prsente Licence et sortent de son cadre. Rien ne restreint l'utilisation +du Programme et les donnes issues de celui-ci ne sont couvertes que si leur +contenu constitue un travail bas sur le logiciel (indpendemment du fait d'avoir +t ralis en lanant le Programme). Tout dpend de ce que le Programme est +cens produire. + +Article 1. +Vous pouvez copier et distribuer des copies conformes du code source du +Programme, tel que Vous l'avez reu, sur n'importe quel support, condition de +placer sur chaque copie un copyright appropri et une restriction de garantie, +de ne pas modifier ou omettre toutes les stipulations se rfrant la prsente +Licence et la limitation de garantie, et de fournir avec toute copie du +Programme un exemplaire de la Licence. + +Vous pouvez demander une rtribution financire pour la ralisation de la copie +et demeurez libre de proposer une garantie assure par vos soins, moyennant +finances. + +Article 2. +Vous pouvez modifier votre copie ou vos copies du Programme ou partie de celui-ci, +ou d'un travail bas sur ce Programme, et copier et distribuer ces modifications +selon les termes de l'article 1, condition de Vous conformer galement aux +conditions suivantes : + +a) Ajouter aux fichiers modifis l'indication trs claire des modifications +effectues, ainsi que la date de chaque changement. + +b) Distribuer sous les termes de la Licence Publique Gnrale l'ensemble de +toute ralisation contenant tout ou partie du Programme, avec ou sans +modifications. + +c) Si le Programme modifi lit des commandes de manire interactive lors de son +excution, faire en sorte qu'il affiche, lors d'une invocation ordinaire, le +copyright appropri en indiquant clairement la limitation de garantie (ou la +garantie que Vous Vous engagez fournir Vous-mme), qu'il stipule que tout +utilisateur peut librement redistribuer le Programme selon les conditions de la +Licence Publique Gnrale GNU, et qu'il montre tout utilisateur comment lire +une copie de celle-ci (exception : si le Programme original est interactif mais +n'affiche pas un tel message en temps normal, tout travail driv de ce +Programme ne sera pas non plus contraint de l'afficher). + +Toutes ces conditions s'appliquent l'ensemble des modifications. Si des +lments identifiables de ce travail ne sont pas drivs du Programme et peuvent +tre raisonnablement considrs comme indpendants, la prsente Licence ne s'applique +pas ces lments lorsque Vous les distribuez seuls. Mais, si Vous distribuez +ces mmes lments comme partie d'un ensemble cohrent dont le reste est bas +sur un Programme soumis la Licence, ils lui sont galement soumis, et la +Licence s'tend ainsi l'ensemble du produit, quel qu'en soit l'auteur. + +Cet article n'a pas pour but de s'approprier ou de contester vos droits sur un +travail entirement ralis par Vous, mais plutt d'ouvrir droit un contrle +de la libre distribution de tout travail driv ou collectif bas sur le +Programme. + +En outre, toute fusion d'un autre travail, non bas sur le Programme, avec le +Programme (ou avec un travail driv de ce dernier), effectue sur un support de +stockage ou de distribution, ne fait pas tomber cet autre travail sous le +contrle de la Licence. + +Article 3. +Vous pouvez copier et distribuer le Programme (ou tout travail driv selon les +conditions nonces dans l'article 1) sous forme de code objet ou excutable, +selon les termes des articles 0 et 1, condition de respecter les clauses +suivantes : + +a) Fournir le code source complet du Programme, sous une forme lisible par un +ordinateur et selon les termes des articles 0 et 1, sur un support +habituellement utilis pour l'change de donnes ; ou, + +b) Faire une offre crite, valable pendant au moins trois ans, prvoyant de +donner tout tiers qui en fera la demande une copie, sous forme lisible par un +ordinateur, du code source correspondant, pour un tarif n'excdant pas le cot +de la copie, selon les termes des articles 0 et 1, sur un support couramment +utilis pour l'change de donnes informatiques ; ou, + +c) Informer le destinataire de l'endroit o le code source peut tre obtenu (cette +solution n'est recevable que dans le cas d'une distribution non commerciale, et +uniquement si Vous avez reu le Programme sous forme de code objet ou excutable +avec l'offre prvue l'alina b ci-dessus). + +Le code source d'un travail dsigne la forme de cet ouvrage sous laquelle les +modifications sont les plus aises. Sont ainsi dsigns la totalit du code +source de tous les modules composant un Programme excutable, de mme que tout +fichier de dfinition associ, ainsi que les scripts utiliss pour effectuer la +compilation et l'installation du Programme excutable. Toutefois, l'environnement +standard de dveloppement du systme d'exploitation mis en oeuvre (source ou +binaire) -- compilateurs, bibliothques, noyau, etc. -- constitue une exception, +sauf si ces lments sont diffuss en mme temps que le Programme excutable. + +Si la distribution de l'excutable ou du code objet consiste offrir un accs +permettant de copier le Programme depuis un endroit particulier, l'offre d'un +accs quivalent pour se procurer le code source au mme endroit est considr +comme une distribution de ce code source, mme si l'utilisateur choisit de ne +pas profiter de cette offre. + +Article 4. +Vous ne pouvez pas copier, modifier, cder, dposer ou distribuer le Programme d'une +autre manire que l'autorise la Licence Publique Gnrale. Toute tentative de ce +type annule immdiatement vos droits d'utilisation du Programme sous cette +Licence. Toutefois, les tiers ayant reu de Vous des copies du Programme ou le +droit d'utiliser ces copies continueront bnficier de leur droit d'utilisation +tant qu'ils respecteront pleinement les conditions de la Licence. + +Article 5. +Ne l'ayant pas signe, Vous n'tes pas oblig d'accepter cette Licence. +Cependant, rien d'autre ne Vous autorise modifier ou distribuer le Programme +ou quelque travaux drivs : la loi l'interdit tant que Vous n'acceptez pas les +termes de cette Licence. En consquence, en modifiant ou en distribuant le +Programme (ou tout travail bas sur lui), Vous acceptez implicitement tous les +termes et conditions de cette Licence. + +Article 6. +La diffusion d'un Programme (ou de tout travail driv) suppose l'envoi +simultan d'une licence autorisant la copie, la distribution ou la modification +du Programme, aux termes et conditions de la Licence. Vous n'avez pas le droit d'imposer +de restrictions supplmentaires aux droits transmis au destinataire. Vous n'tes +pas responsable du respect de la Licence par un tiers. + +Article 7. +Si, la suite d'une dcision de Justice, d'une plainte en contrefaon ou pour +toute autre raison (lie ou non la contrefaon), des conditions Vous sont +imposes (que ce soit par ordonnance, accord amiable ou autre) qui se rvlent +incompatibles avec les termes de la prsente Licence, Vous n'tes pas pour +autant dgag des obligations lies celle-ci : si Vous ne pouvez concilier vos +obligations lgales ou autres avec les conditions de cette Licence, Vous ne +devez pas distribuer le Programme. + +Si une partie quelconque de cet article est invalide ou inapplicable pour +quelque raison que ce soit, le reste de l'article continue de s'appliquer et l'intgralit +de l'article s'appliquera en toute autre circonstance. + +Le prsent article n'a pas pour but de Vous pousser enfreindre des droits ou +des dispositions lgales ni en contester la validit ; son seul objectif est de +protger l'intgrit du systme de distribution du Logiciel Libre. De nombreuses +personnes ont gnreusement contribu la large gamme de Programmes distribue +de cette faon en toute confiance ; il appartient chaque auteur/donateur de +dcider de diffuser ses Programmes selon les critres de son choix. + +Article 8. +Si la distribution et/ou l'utilisation du Programme est limite dans certains +pays par des brevets ou des droits sur des interfaces, le dtenteur original des +droits qui place le Programme sous la Licence Publique Gnrale peut ajouter +explicitement une clause de limitation gographique excluant ces pays. Dans ce +cas, cette clause devient une partie intgrante de la Licence. + +Article 9. +La Free Software Foundation se rserve le droit de publier priodiquement des +mises jour ou de nouvelles versions de la Licence. Rdiges dans le mme +esprit que la prsente version, elles seront cependant susceptibles d'en +modifier certains dtails mesure que de nouveaux problmes se font jour. + +Chaque version possde un numro distinct. Si le Programme prcise un numro de +version de cette Licence et toute version ultrieure , Vous avez le choix de +suivre les termes et conditions de cette version ou de toute autre version plus +rcente publie par la Free Software Foundation. Si le Programme ne spcifie +aucun numro de version, Vous pouvez alors choisir l'une quelconque des versions +publies par la Free Software Foundation. + +Article 10. +Si Vous dsirez incorporer des lments du Programme dans d'autres Programmes +libres dont les conditions de distribution diffrent, Vous devez crire l'auteur +pour lui en demander la permission. Pour ce qui est des Programmes directement +dposs par la Free Software Foundation, crivez-nous : une exception est +toujours envisageable. Notre dcision sera base sur notre volont de prserver +la libert de notre Programme ou de ses drivs et celle de promouvoir le +partage et la rutilisation du logiciel en gnral. + +LIMITATION DE GARANTIE + +Article 11. +Parce que l'utilisation de ce Programme est libre et gratuite, aucune garantie n'est +fournie, comme le permet la loi. Sauf mention crite, les dtenteurs du +copyright et/ou les tiers fournissent le Programme en l'tat, sans aucune sorte +de garantie explicite ou implicite, y compris les garanties de commercialisation +ou d'adaptation dans un but particulier. Vous assumez tous les risques quant +la qualit et aux effets du Programme. Si le Programme est dfectueux, Vous +assumez le cot de tous les services, corrections ou rparations ncessaires. + +Article 12. +Sauf lorsqu'explicitement prvu par la Loi ou accept par crit, ni le dtenteur +des droits, ni quiconque autoris modifier et/ou redistribuer le Programme +comme il est permis ci-dessus ne pourra tre tenu pour responsable de tout +dommage direct, indirect, secondaire ou accessoire (pertes financires dues au +manque gagner, l'interruption d'activits ou la perte de donnes, etc., +dcoulant de l'utilisation du Programme ou de l'impossibilit d'utiliser celui-ci). + +FIN DES TERMES ET CONDITIONS + +Comment appliquer ces directives vos nouveaux programmes +Si vous dveloppez un nouveau programme et dsirez en faire bnficier tout un +chacun, la meilleure mthode est d'en faire un Logiciel Libre que tout le monde +pourra redistribuer et modifier selon les termes de la Licence Publique Gnrale. + +Pour cela, insrez les indications suivantes dans votre programme (il est +prfrable et plus sr de les faire figurer au dbut de chaque fichier source ; +dans tous les cas, chaque module source devra comporter au minimum la ligne de +copyright et indiquer o rsident toutes les autres indications) : + +((une ligne pour donner le nom du programme et donner une ide de sa finalit)) +Copyright (C) 19xx ((nom de l'auteur)) + +Ce programme est libre, vous pouvez le redistribuer et/ou le modifier selon les +termes de la Licence Publique Gnrale GNU publie par la Free Software +Foundation (version 2 ou bien toute autre version ultrieure choisie par vous). + +Ce programme est distribu car potentiellement utile, mais SANS AUCUNE GARANTIE, +ni explicite ni implicite, y compris les garanties de commercialisation ou d'adaptation +dans un but spcifique. Reportez-vous la Licence Publique Gnrale GNU pour +plus de dtails. + +Vous devez avoir reu une copie de la Licence Publique Gnrale GNU en mme +temps que ce programme ; si ce n'est pas le cas, crivez la Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, tats-Unis. + +Ajoutez galement votre adresse lectronique, le cas chant, ainsi que votre +adresse postale. + +Si le programme est interactif, faites-lui afficher un court avertissement du +type de celui-ci chaque invocation : + +...(nom du programme) version 69, Copyright (C) 19aa nom de l'auteur + +...(nom du programme) est fourni sans AUCUNE GARANTIE. +Pour plus de dtails, tapez `g'. + +Ce programme est libre et vous tes encourag le redistribuer sous certaines +conditions ; tapez `c' pour plus de dtails. + +Les commandes hypothtiques `g' et `c' doivent afficher les sections appropries +de la Licence Publique Gnrale GNU. Bien entendu, vous pouvez implanter ces +commandes comme bon vous semble : options dans un menu, ou bien accessibles d'un +clic de souris, etc., tout dpend de votre programme. + +Si vous officiez en tant que programmeur, n'omettez pas de demander votre +employeur, votre tablissement scolaire ou autres de signer une dcharge +stipulant leur renoncement aux droits qu'ils pourraient avoir sur le programme : + +...((employeur, cole...)) dclare par la prsente ne pas revendiquer de droits +sur le programme (nom du programme) ralis par ...((nom de l'auteur)). +((signature du responsable)), ...((date)), ...((nom et qualit du responsable)). + +La Licence Publique Gnrale ne permet pas d'inclure votre programme dans des +logiciels sous licence commerciale spcifique. Si votre programme est une +fonction de bibliothque, vous jugerez probablement plus judicieux de le faire +relever de la Licence Gnrale de Bibliothque GNU (LGPL) plutt que de la +prsente. + +Last modified: Tue Sep 29 22:41:45 MET DST 1998 \ No newline at end of file diff --git a/license/license-GER.txt b/license/license-GER.txt new file mode 100644 index 0000000..64ff14f --- /dev/null +++ b/license/license-GER.txt @@ -0,0 +1,105 @@ +GNU General Public License +Deutsche bersetzung der Version 2, Juni 1991 + +Copyright 1989, 1991 Free Software Foundation, Inc. + +59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + + +Diese bersetzung ist kein rechtskrftiger Ersatz fr die englischsprachige Originalversion! + + +Vorwort +Die meisten Softwarelizenzen sind daraufhin entworfen worden, Ihnen die Freiheit zu nehmen, die Software weiterzugeben und zu verndern. Im Gegensatz dazu soll Ihnen die GNU General Public License , die Allgemeine ffentliche GNU-Lizenz, ebendiese Freiheit garantieren. Sie soll sicherstellen, da die Software fr alle Benutzer frei ist. Diese Lizenz gilt fr den Groteil der von der Free Software Foundation herausgegebenen Software und fr alle anderen Programme, deren Autoren ihr Datenwerk dieser Lizenz unterstellt haben. Auch Sie knnen diese Mglichkeit der Lizenzierung fr Ihre Programme anwenden. (Ein anderer Teil der Software der Free Software Foundation unterliegt stattdessen der GNU Library General Public License , der Allgemeinen ffentlichen GNU-Lizenz fr Bibliotheken.) [Mittlerweile wurde die GNU Library Public License von der GNU Lesser Public License abgelst - Anmerkung des bersetzers.] + +Die Bezeichnung ,,freie`` Software bezieht sich auf Freiheit, nicht auf den Preis. Unsere Lizenzen sollen Ihnen die Freiheit garantieren, Kopien freier Software zu verbreiten (und etwas fr diesen Service zu berechnen, wenn Sie mchten), die Mglichkeit, die Software im Quelltext zu erhalten oder den Quelltext auf Wunsch zu bekommen. Die Lizenzen sollen garantieren, da Sie die Software ndern oder Teile davon in neuen freien Programmen verwenden drfen - und da Sie wissen, da Sie dies alles tun drfen. + +Um Ihre Rechte zu schtzen, mssen wir Einschrnkungen machen, die es jedem verbieten, Ihnen diese Rechte zu verweigern oder Sie aufzufordern, auf diese Rechte zu verzichten. Aus diesen Einschrnkungen folgen bestimmte Verantwortlichkeiten fr Sie, wenn Sie Kopien der Software verbreiten oder sie verndern. + +Beispielsweise mssen Sie den Empfngern alle Rechte gewhren, die Sie selbst haben, wenn Sie - kostenlos oder gegen Bezahlung - Kopien eines solchen Programms verbreiten. Sie mssen sicherstellen, da auch die Empfnger den Quelltext erhalten bzw. erhalten knnen. Und Sie mssen ihnen diese Bedingungen zeigen, damit sie ihre Rechte kennen. + +Wir schtzen Ihre Rechte in zwei Schritten: (1) Wir stellen die Software unter ein Urheberrecht (Copyright), und (2) wir bieten Ihnen diese Lizenz an, die Ihnen das Recht gibt, die Software zu vervielfltigen, zu verbreiten und/oder zu verndern. + +Um die Autoren und uns zu schtzen, wollen wir darberhinaus sicherstellen, da jeder erfhrt, da fr diese freie Software keinerlei Garantie besteht. Wenn die Software von jemand anderem modifiziert und weitergegeben wird, mchten wir, da die Empfnger wissen, da sie nicht das Original erhalten haben, damit irgendwelche von anderen verursachte Probleme nicht den Ruf des ursprnglichen Autors schdigen. + +Schlielich und endlich ist jedes freie Programm permanent durch Software-Patente bedroht. Wir mchten die Gefahr ausschlieen, da Distributoren eines freien Programms individuell Patente lizensieren - mit dem Ergebnis, da das Programm proprietr wrde. Um dies zu verhindern, haben wir klargestellt, da jedes Patent entweder fr freie Benutzung durch jedermann lizenziert werden mu oder berhaupt nicht lizenziert werden darf. + +Es folgen die genauen Bedingungen fr die Vervielfltigung, Verbreitung und Bearbeitung: + + +Allgemeine ffentliche GNU-Lizenz +Bedingungen fr die Vervielfltigung, +Verbreitung und Bearbeitung +0. Diese Lizenz gilt fr jedes Programm und jedes andere Datenwerk, in dem ein entsprechender Vermerk des Copyright-Inhabers darauf hinweist, da das Datenwerk unter den Bestimmungen dieser General Public License verbreitet werden darf. Im folgenden wird jedes derartige Programm oder Datenwerk als ,,das Programm`` bezeichnet; die Formulierung ,,auf dem Programm basierendes Datenwerk`` bezeichnet das Programm sowie jegliche Bearbeitung des Programms im urheberrechtlichen Sinne, also ein Datenwerk, welches das Programm, auch auszugsweise, sei es unverndert oder verndert und/oder in eine andere Sprache bersetzt, enthlt. (Im folgenden wird die bersetzung ohne Einschrnkung als ,,Bearbeitung`` eingestuft.) Jeder Lizenznehmer wird im folgenden als ,,Sie`` angesprochen. + +Andere Handlungen als Vervielfltigung, Verbreitung und Bearbeitung werden von dieser Lizenz nicht berhrt; sie fallen nicht in ihren Anwendungsbereich. Der Vorgang der Ausfhrung des Programms wird nicht eingeschrnkt, und die Ausgaben des Programms unterliegen dieser Lizenz nur, wenn der Inhalt ein auf dem Programm basierendes Datenwerk darstellt (unabhngig davon, da die Ausgabe durch die Ausfhrung des Programmes erfolgte). Ob dies zutrifft, hngt von den Funktionen des Programms ab. + +1. Sie drfen auf beliebigen Medien unvernderte Kopien des Quelltextes des Programms, wie sie ihn erhalten haben, anfertigen und verbreiten. Voraussetzung hierfr ist, da Sie mit jeder Kopie einen entsprechenden Copyright-Vermerk sowie einen Haftungsausschlu verffentlichen, alle Vermerke, die sich auf diese Lizenz und das Fehlen einer Garantie beziehen, unverndert lassen und desweiteren allen anderen Empfngern des Programms zusammen mit dem Programm eine Kopie dieser Lizenz zukommen lassen. + +Sie drfen fr den eigentlichen Kopiervorgang eine Gebhr verlangen. Wenn Sie es wnschen, drfen Sie auch gegen Entgeld eine Garantie fr das Programm anbieten. + +2. Sie drfen Ihre Kopie(n) des Programms oder eines Teils davon verndern, wodurch ein auf dem Programm basierendes Datenwerk entsteht; Sie drfen derartige Bearbeitungen unter den Bestimmungen von Paragraph 1 vervielfltigen und verbreiten, vorausgesetzt, da zustzlich alle im folgenden genannten Bedingungen erfllt werden: + + +1. +Sie mssen die vernderten Dateien mit einem aufflligen Vermerk versehen, der auf die von Ihnen vorgenommene Modifizierung und das Datum jeder nderung hinweist. + +2. +Sie mssen dafr sorgen, da jede von Ihnen verbreitete oder verffentlichte Arbeit, die ganz oder teilweise von dem Programm oder Teilen davon abgeleitet ist, Dritten gegenber als Ganzes unter den Bedingungen dieser Lizenz ohne Lizenzgebhren zur Verfgung gestellt wird. + +3. +Wenn das vernderte Programm normalerweise bei der Ausfhrung interaktiv Kommandos einliest, mssen Sie dafr sorgen, da es, wenn es auf dem blichsten Wege fr solche interaktive Nutzung gestartet wird, eine Meldung ausgibt oder ausdruckt, die einen geeigneten Copyright-Vermerk enthlt sowie einen Hinweis, da es keine Gewhrleistung gibt (oder anderenfalls, da Sie Garantie leisten), und da die Benutzer das Programm unter diesen Bedingungen weiter verbreiten drfen. Auch mu der Benutzer darauf hingewiesen werden, wie er eine Kopie dieser Lizenz ansehen kann. (Ausnahme: Wenn das Programm selbst interaktiv arbeitet, aber normalerweise keine derartige Meldung ausgibt, mu Ihr auf dem Programm basierendes Datenwerk auch keine solche Meldung ausgeben). + +Diese Anforderungen gelten fr das bearbeitete Datenwerk als Ganzes. Wenn identifizierbare Teile des Datenwerkes nicht von dem Programm abgeleitet sind und vernnftigerweise als unabhngige und eigenstndige Datenwerke fr sich selbst zu betrachten sind, dann gelten diese Lizenz und ihre Bedingungen nicht fr die betroffenen Teile, wenn Sie diese als eigenstndige Datenwerke weitergeben. Wenn Sie jedoch dieselben Abschnitte als Teil eines Ganzen weitergeben, das ein auf dem Programm basierendes Datenwerk darstellt, dann mu die Weitergabe des Ganzen nach den Bedingungen dieser Lizenz erfolgen, deren Bedingungen fr weitere Lizenznehmer somit auf das gesamte Ganze ausgedehnt werden - und somit auf jeden einzelnen Teil, unabhngig vom jeweiligen Autor. + +Somit ist es nicht die Absicht dieses Abschnittes, Rechte fr Datenwerke in Anspruch zu nehmen oder Ihnen die Rechte fr Datenwerke streitig zu machen, die komplett von Ihnen geschrieben wurden; vielmehr ist es die Absicht, die Rechte zur Kontrolle der Verbreitung von Datenwerken, die auf dem Programm basieren oder unter seiner auszugsweisen Verwendung zusammengestellt worden sind, auszuben. + +Ferner bringt auch das einfache Zusammenlegen eines anderen Datenwerkes, das nicht auf dem Programm basiert, mit dem Programm oder einem auf dem Programm basierenden Datenwerk auf ein- und demselben Speicher- oder Vertriebsmedium dieses andere Datenwerk nicht in den Anwendungsbereich dieser Lizenz. + +3. Sie drfen das Programm (oder ein darauf basierendes Datenwerk gem Paragraph 2) als Objectcode oder in ausfhrbarer Form unter den Bedingungen der Paragraphen 1 und 2 kopieren und weitergeben - vorausgesetzt, da Sie auerdem eine der folgenden Leistungen erbringen: + + +1. +Liefern Sie das Programm zusammen mit dem vollstndigen zugehrigen maschinenlesbaren Quelltext auf einem fr den Datenaustausch blichen Medium aus, wobei die Verteilung unter den Bedingungen der Paragraphen 1 und 2 erfolgen mu. Oder: + +2. +Liefern Sie das Programm zusammen mit einem mindestens drei Jahre lang gltigen schriftlichen Angebot aus, jedem Dritten eine vollstndige maschinenlesbare Kopie des Quelltextes zur Verfgung zu stellen - zu nicht hheren Kosten als denen, die durch den physikalischen Kopiervorgang anfallen -, wobei der Quelltext unter den Bedingungen der Paragraphen 1 und 2 auf einem fr den Datenaustausch blichen Medium weitergegeben wird. Oder: + +3. +Liefern Sie das Programm zusammen mit dem schriftlichen Angebot der Zurverfgungstellung des Quelltextes aus, das Sie selbst erhalten haben. (Diese Alternative ist nur fr nicht-kommerzielle Verbreitung zulssig und nur, wenn Sie das Programm als Objectcode oder in ausfhrbarer Form mit einem entsprechenden Angebot gem Absatz b erhalten haben.) + +Unter dem Quelltext eines Datenwerkes wird diejenige Form des Datenwerkes verstanden, die fr Bearbeitungen vorzugsweise verwendet wird. Fr ein ausfhrbares Programm bedeutet ,,der komplette Quelltext``: Der Quelltext aller im Programm enthaltenen Module einschlielich aller zugehrigen Modulschnittstellen-Definitionsdateien sowie der zur Compilation und Installation verwendeten Skripte. Als besondere Ausnahme jedoch braucht der verteilte Quelltext nichts von dem zu enthalten, was blicherweise (entweder als Quelltext oder in binrer Form) zusammen mit den Hauptkomponenten des Betriebssystems (Kernel, Compiler usw.) geliefert wird, unter dem das Programm luft - es sei denn, diese Komponente selbst gehrt zum ausfhrbaren Programm. + +Wenn die Verbreitung eines ausfhrbaren Programms oder von Objectcode dadurch erfolgt, da der Kopierzugriff auf eine dafr vorgesehene Stelle gewhrt wird, so gilt die Gewhrung eines gleichwertigen Zugriffs auf den Quelltext als Verbreitung des Quelltextes, auch wenn Dritte nicht dazu gezwungen sind, den Quelltext zusammen mit dem Objectcode zu kopieren. + +4. Sie drfen das Programm nicht vervielfltigen, verndern, weiter lizenzieren oder verbreiten, sofern es nicht durch diese Lizenz ausdrcklich gestattet ist. Jeder anderweitige Versuch der Vervielfltigung, Modifizierung, Weiterlizenzierung und Verbreitung ist nichtig und beendet automatisch Ihre Rechte unter dieser Lizenz. Jedoch werden die Lizenzen Dritter, die von Ihnen Kopien oder Rechte unter dieser Lizenz erhalten haben, nicht beendet, solange diese die Lizenz voll anerkennen und befolgen. + +5. Sie sind nicht verpflichtet, diese Lizenz anzunehmen, da Sie sie nicht unterzeichnet haben. Jedoch gibt Ihnen nichts anderes die Erlaubnis, das Programm oder von ihm abgeleitete Datenwerke zu verndern oder zu verbreiten. Diese Handlungen sind gesetzlich verboten, wenn Sie diese Lizenz nicht anerkennen. Indem Sie das Programm (oder ein darauf basierendes Datenwerk) verndern oder verbreiten, erklren Sie Ihr Einverstndnis mit dieser Lizenz und mit allen ihren Bedingungen bezglich der Vervielfltigung, Verbreitung und Vernderung des Programms oder eines darauf basierenden Datenwerks. + +6. Jedesmal, wenn Sie das Programm (oder ein auf dem Programm basierendes Datenwerk) weitergeben, erhlt der Empfnger automatisch vom ursprnglichen Lizenzgeber die Lizenz, das Programm entsprechend den hier festgelegten Bestimmungen zu vervielfltigen, zu verbreiten und zu verndern. Sie drfen keine weiteren Einschrnkungen der Durchsetzung der hierin zugestandenen Rechte des Empfngers vornehmen. Sie sind nicht dafr verantwortlich, die Einhaltung dieser Lizenz durch Dritte durchzusetzen. + +7. Sollten Ihnen infolge eines Gerichtsurteils, des Vorwurfs einer Patentverletzung oder aus einem anderen Grunde (nicht auf Patentfragen begrenzt) Bedingungen (durch Gerichtsbeschlu, Vergleich oder anderweitig) auferlegt werden, die den Bedingungen dieser Lizenz widersprechen, so befreien Sie diese Umstnde nicht von den Bestimmungen dieser Lizenz. Wenn es Ihnen nicht mglich ist, das Programm unter gleichzeitiger Beachtung der Bedingungen in dieser Lizenz und Ihrer anderweitigen Verpflichtungen zu verbreiten, dann drfen Sie als Folge das Programm berhaupt nicht verbreiten. Wenn zum Beispiel ein Patent nicht die gebhrenfreie Weiterverbreitung des Programms durch diejenigen erlaubt, die das Programm direkt oder indirekt von Ihnen erhalten haben, dann besteht der einzige Weg, sowohl das Patentrecht als auch diese Lizenz zu befolgen, darin, ganz auf die Verbreitung des Programms zu verzichten. + +Sollte sich ein Teil dieses Paragraphen als ungltig oder unter bestimmten Umstnden nicht durchsetzbar erweisen, so soll dieser Paragraph seinem Sinne nach angewandt werden; im brigen soll dieser Paragraph als Ganzes gelten. + +Zweck dieses Paragraphen ist nicht, Sie dazu zu bringen, irgendwelche Patente oder andere Eigentumsansprche zu verletzen oder die Gltigkeit solcher Ansprche zu bestreiten; dieser Paragraph hat einzig den Zweck, die Integritt des Verbreitungssystems der freien Software zu schtzen, das durch die Praxis ffentlicher Lizenzen verwirklicht wird. Viele Leute haben grozgige Beitrge zu dem groen Angebot der mit diesem System verbreiteten Software im Vertrauen auf die konsistente Anwendung dieses Systems geleistet; es liegt am Autor/Geber, zu entscheiden, ob er die Software mittels irgendeines anderen Systems verbreiten will; ein Lizenznehmer hat auf diese Entscheidung keinen Einflu. + +Dieser Paragraph ist dazu gedacht, deutlich klarzustellen, was als Konsequenz aus dem Rest dieser Lizenz betrachtet wird. + +8. Wenn die Verbreitung und/oder die Benutzung des Programms in bestimmten Staaten entweder durch Patente oder durch urheberrechtlich geschtzte Schnittstellen eingeschrnkt ist, kann der Urheberrechtsinhaber, der das Programm unter diese Lizenz gestellt hat, eine explizite geographische Begrenzung der Verbreitung angeben, in der diese Staaten ausgeschlossen werden, so da die Verbreitung nur innerhalb und zwischen den Staaten erlaubt ist, die nicht ausgeschlossen sind. In einem solchen Fall beinhaltet diese Lizenz die Beschrnkung, als wre sie in diesem Text niedergeschrieben. + +9. Die Free Software Foundation kann von Zeit zu Zeit berarbeitete und/oder neue Versionen der General Public License verffentlichen. Solche neuen Versionen werden vom Grundprinzip her der gegenwrtigen entsprechen, knnen aber im Detail abweichen, um neuen Problemen und Anforderungen gerecht zu werden. + +Jede Version dieser Lizenz hat eine eindeutige Versionsnummer. Wenn in einem Programm angegeben wird, da es dieser Lizenz in einer bestimmten Versionsnummer oder ,,jeder spteren Version`` (``any later version'') unterliegt, so haben Sie die Wahl, entweder den Bestimmungen der genannten Version zu folgen oder denen jeder beliebigen spteren Version, die von der Free Software Foundation verffentlicht wurde. Wenn das Programm keine Versionsnummer angibt, knnen Sie eine beliebige Version whlen, die je von der Free Software Foundation verffentlicht wurde. + +10. Wenn Sie den Wunsch haben, Teile des Programms in anderen freien Programmen zu verwenden, deren Bedingungen fr die Verbreitung anders sind, schreiben Sie an den Autor, um ihn um die Erlaubnis zu bitten. Fr Software, die unter dem Copyright der Free Software Foundation steht, schreiben Sie an die Free Software Foundation ; wir machen zu diesem Zweck gelegentlich Ausnahmen. Unsere Entscheidung wird von den beiden Zielen geleitet werden, zum einen den freien Status aller von unserer freien Software abgeleiteten Datenwerke zu erhalten und zum anderen das gemeinschaftliche Nutzen und Wiederverwenden von Software im allgemeinen zu frdern. + + +Keine Gewhrleistung + +11. Da das Programm ohne jegliche Kosten lizenziert wird, besteht keinerlei Gewhrleistung fr das Programm, soweit dies gesetzlich zulssig ist. Sofern nicht anderweitig schriftlich besttigt, stellen die Copyright-Inhaber und/oder Dritte das Programm so zur Verfgung, ,,wie es ist``, ohne irgendeine Gewhrleistung, weder ausdrcklich noch implizit, einschlielich - aber nicht begrenzt auf - Marktreife oder Verwendbarkeit fr einen bestimmten Zweck. Das volle Risiko bezglich Qualitt und Leistungsfhigkeit des Programms liegt bei Ihnen. Sollte sich das Programm als fehlerhaft herausstellen, liegen die Kosten fr notwendigen Service, Reparatur oder Korrektur bei Ihnen. + +12. In keinem Fall, auer wenn durch geltendes Recht gefordert oder schriftlich zugesichert, ist irgendein Copyright-Inhaber oder irgendein Dritter, der das Programm wie oben erlaubt modifiziert oder verbreitet hat, Ihnen gegenber fr irgendwelche Schden haftbar, einschlielich jeglicher allgemeiner oder spezieller Schden, Schden durch Seiteneffekte (Nebenwirkungen) oder Folgeschden, die aus der Benutzung des Programms oder der Unbenutzbarkeit des Programms folgen (einschlielich - aber nicht beschrnkt auf - Datenverluste, fehlerhafte Verarbeitung von Daten, Verluste, die von Ihnen oder anderen getragen werden mssen, oder dem Unvermgen des Programms, mit irgendeinem anderen Programm zusammenzuarbeiten), selbst wenn ein Copyright-Inhaber oder Dritter ber die Mglichkeit solcher Schden unterrichtet worden war. + + +Ende der Bedingungen diff --git a/license/license-GR.txt b/license/license-GR.txt new file mode 100644 index 0000000..16b8d2e --- /dev/null +++ b/license/license-GR.txt @@ -0,0 +1,155 @@ + +GNU (GNU GPL) . + (Free Software Foundation) + +GNU- (GNU GPL). +, + GNU GPL. + +This is an unofficial translation of the GNU General Public License into greek. It was not published by the Free Software Foundation, and does not legally state the distribution terms for software that uses the GNU GPL-only the original English text of the GNU GPL does that. However, we hope that this translation will help greek speakers understand the GNU GPL better. + + + GNU + + 2, 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + , . + + + + . , GNU -- . (Free Software Foundation), . ( GNU.) . + + , , + . ( , , ), , , -- . + + , + . . + + , , + , . , , . , . + + : (1) (2) , , / . + + , , . , , . + + , . , . , , . + + , . + + GNU + , + + 0. + , . "", , , " " : , , / . ( , "".) "/". + + , - . , ( ). . + + 1. , , : , , - - , , . + + , , , . + + 2. , , 1 , : + + ) . + + ) , , , , , . + + ) , , , , , (, , ) , . (: , .) + + . , , , . , , , , . + +, - , , . + +, , , ( ) , . + + 3. ( , 2) , 1 2 , : + + ) , , 1 2 , - , + ) , , , , 1 2 , - , + + ) . ( , [] .) + + . , , , . , , ( , ) (, ...) , . + + + , + - + . + + 4. , , . , , , . +, , , , + . + + 5. , . , . , . , ( ), , , . + + 6. ( ), , . . . + + 7. , ( ), ( , ) , . , , , . , , . + + , . + + + . , . , . / , . + + , . + + 8. / , , , , , , . , . + + 9. (Free Software Foundation) / . , , + . + + . + , , " ", (Free Software Foundation). + , . + + 10. +, , . (Free Software Foundation), ( ). , . + + + + 11. , , . , / " " , , , , . . , . + + 12. , , , / , , , , (, , , , ), . + + + + + + + + + , , . + , . , - " " . + + < .> + Copyright (C) <> < > + + . / GNU (GNU General Public License), (Free Software Foundation) - 2 , (' ) . + + , - . GNU (GNU General Public License). + + GNU (GNU General Public License) . , (Free Software Foundation), Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +, . + + , : + + <_> <_>, Copyright (C) <> <_> + <_> . `show w'. + , . `show c' . + + `show w' `show c' . `show w' `show c'. -- . + + , ( ) , , " " (copyright disclaimer) . + , : + + <_/> <_>', <_>. + + <__/>, <, > + + + . , . , GNU (GNU Library General Public License) . diff --git a/license/license-HE.txt b/license/license-HE.txt new file mode 100644 index 0000000..ddd7954 --- /dev/null +++ b/license/license-HE.txt @@ -0,0 +1,168 @@ +( ! http://www.law.co.il/computer-law/gpl-hebrew.html) + + + . , GNU -- . (Program) , . ( GNU). . + + , , . ( , ), , , . + + , . , . + +, , , . . , . + + : (1) - (2) , , / . + +, , , . - , , . + +, - . - - . , . + + , . + GNU + + , +0. , , - . "", , , " " -: , , / . ( , , ""). "". + + , ; . ( ). , . + +1. , , , , , , . + + , , (warranty protection) . + +2. , , - 1 , : + +. . + +. , , , - . + +. , , , , (, , ) - , . (: , ). + + . , , . , , - , - , . + + , ; , . + +, , , ( ) , . + +3. ( , - 2) (object code) - (executable form) - 1 - 2 : + +. , (machine-readable source code) - 1 - 2 - ; , + +. , , , , , , - 1 - 2 ; , + +. . ( - , - ' ). + + . -, (scripts) (compilation) -. , , ( ) (, [kernel] ") - , -. + + - - , , , , . + +4. , , . , , - , - . , - , . + +5. , . , . - . , - ( ), , , . + +6. ( ), , . . . + +7. - ( ) ( , ), , . - , . , - , , , , . + + - , . + + ; , . ; / . + + .8 + +8. / , , , , , . , . + +9. / . , . + + . " ", - . , - . + +10. , . , ; . - . + + + +11. , , - . , / " ", , , , , . . , . + +12. , - , , , / , , , , , - (, , ), . + + +( ! http://www.law.co.il/computer-law/gpl-hebrew.html) + + + . , GNU -- . (Program) , . ( GNU). . + + , , . ( , ), , , . + + , . , . + +, , , . . , . + + : (1) - (2) , , / . + +, , , . - , , . + +, - . - - . , . + + , . + GNU + + , +0. , , - . "", , , " " -: , , / . ( , , ""). "". + + , ; . ( ). , . + +1. , , , , , , . + + , , (warranty protection) . + +2. , , - 1 , : + +. . + +. , , , - . + +. , , , , (, , ) - , . (: , ). + + . , , . , , - , - , . + + , ; , . + +, , , ( ) , . + +3. ( , - 2) (object code) - (executable form) - 1 - 2 : + +. , (machine-readable source code) - 1 - 2 - ; , + +. , , , , , , - 1 - 2 ; , + +. . ( - , - ' ). + + . -, (scripts) (compilation) -. , , ( ) (, [kernel] ") - , -. + + - - , , , , . + +4. , , . , , - , - . , - , . + +5. , . , . - . , - ( ), , , . + +6. ( ), , . . . + +7. - ( ) ( , ), , . - , . , - , , , , . + + - , . + + ; , . ; / . + + .8 + +8. / , , , , , . , . + +9. / . , . + + . " ", - . , - . + +10. , . , ; . - . + + + +11. , , - . , / " ", , , , , . . , . + +12. , - , , , / , , , , , - (, , ), . + + diff --git a/license/license-IT.txt b/license/license-IT.txt new file mode 100644 index 0000000..1a671d7 --- /dev/null +++ b/license/license-IT.txt @@ -0,0 +1,403 @@ + +Questa una traduzione italiana non ufficiale della Licenza Pubblica +Generica GNU. Non pubblicata dalla Free Software Foundation e non +ha valore legale nell'esprimere i termini di distribuzione del +software che usa la licenza GPL. Solo la versione originale in inglese +della licenza ha valore legale. Ad ogni modo, speriamo che questa +traduzione aiuti le persone di lingua italiana a capire meglio il +significato della licenza GPL. + + This is an unofficial translation of the GNU General Public + License into Italian. It was not published by the Free + Software Foundation, and does not legally state the + distribution terms for software that uses the GNU GPL--only + the original English text of the GNU GPL does that. However, + we hope that this translation will help Italian speakers + understand the GNU GPL better. + + + + LICENZA PUBBLICA GENERICA (GPL) DEL PROGETTO GNU + Versione 2, Giugno 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Traduzione curata da gruppo Pluto, da ILS e dal gruppo italiano di +traduzione GNU. Ultimo aggiornamento 19 aprile 2000. + +Chiunque pu copiare e distribuire copie letterali di questo documento +di licenza, ma non ne permessa la modifica. + + Preambolo + +Le licenze della maggior parte dei programmi hanno lo scopo di +togliere all'utente la libert di condividere e modificare il +programma stesso. Viceversa, la Licenza Pubblica Generica GNU intesa +a garantire la libert di condividere e modificare il software libero, +al fine di assicurare che i programmi siano liberi per tutti i loro +utenti. Questa Licenza si applica alla maggioranza dei programmi +della Free Software Foundation e ad ogni altro programma i cui autori +hanno deciso di usare questa Licenza. Alcuni altri programmi della +Free Software Foundation sono invece coperti dalla Licenza Pubblica +Generica Minore. Chiunque pu usare questa Licenza per i propri +programmi. + +Quando si parla di software libero (free software), ci si riferisce +alla libert, non al prezzo. Le nostre Licenze (la GPL e la LGPL) +sono progettate per assicurarsi che ciascuno abbia la libert di +distribuire copie del software libero (e farsi pagare per questo, se +vuole), che ciascuno riceva il codice sorgente o che lo possa ottenere +se lo desidera, che ciascuno possa modificare il programma o usarne +delle parti in nuovi programmi liberi e che ciascuno sappia di potere +fare queste cose. + +Per proteggere i diritti dell'utente, abbiamo bisogno di creare delle +restrizioni che vietino a chiunque di negare questi diritti o di +chiedere di rinunciarvi. Queste restrizioni si traducono in certe +responsabilit per chi distribuisce copie del software e per chi lo +modifica. + +Per esempio, chi distribuisce copie di un programma coperto da GPL, +sia gratis sia in cambio di un compenso, deve concedere ai destinatari +tutti i diritti che ha ricevuto. Deve anche assicurarsi che i +destinatari ricevano o possano ottenere il codice sorgente. E deve +mostrar loro queste condizioni di licenza, in modo che essi conoscano +i propri diritti. + +Proteggiamo i diritti dell'utente in due modi: (1) proteggendo il +software con un copyright, e (2) offrendo una licenza che dia il +permesso legale di copiare, distribuire e modificare il Programma. + +Inoltre, per proteggere ogni autore e noi stessi, vogliamo assicurarci +che ognuno capisca che non ci sono garanzie per i programmi coperti da +GPL. Se il programma viene modificato da qualcun altro e +ridistribuito, vogliamo che gli acquirenti sappiano che ci che hanno +non l'originale, in modo che ogni problema introdotto da altri non +si rifletta sulla reputazione degli autori originari. + +Infine, ogni programma libero costantemente minacciato dai brevetti +sui programmi. Vogliamo evitare il pericolo che chi ridistribuisce un +programma libero ottenga la propriet di brevetti, rendendo in pratica +il programma cosa di sua propriet. Per prevenire questa evenienza, +abbiamo chiarito che ogni brevetto debba essere concesso in licenza +d'uso a chiunque, o non avere alcuna restrizione di licenza d'uso. + +Seguono i termini e le condizioni precisi per la copia, la +distribuzione e la modifica. + + LICENZA PUBBLICA GENERICA GNU + TERMINI E CONDIZIONI PER LA COPIA, LA DISTRIBUZIONE E LA MODIFICA + + 0. Questa Licenza si applica a ogni programma o altra opera che +contenga una nota da parte del detentore del copyright che dica che +tale opera pu essere distribuita sotto i termini di questa Licenza +Pubblica Generica. Il termine "Programma" nel seguito si riferisce ad +ogni programma o opera cos definita, e l'espressione "opera basata +sul Programma" indica sia il Programma sia ogni opera considerata +"derivata" in base alla legge sul copyright; in altre parole, un'opera +contenente il Programma o una porzione di esso, sia letteralmente sia +modificato o tradotto in un'altra lingua. Da qui in avanti, la +traduzione in ogni caso considerata una "modifica". Vengono ora +elencati i diritti dei beneficiari della licenza. + +Attivit diverse dalla copiatura, distribuzione e modifica non sono +coperte da questa Licenza e sono al di fuori della sua influenza. +L'atto di eseguire il Programma non viene limitato, e l'output del +programma coperto da questa Licenza solo se il suo contenuto +costituisce un'opera basata sul Programma (indipendentemente dal fatto +che sia stato creato eseguendo il Programma). In base alla natura del +Programma il suo output pu essere o meno coperto da questa Licenza. + + 1. lecito copiare e distribuire copie letterali del codice +sorgente del Programma cos come viene ricevuto, con qualsiasi mezzo, +a condizione che venga riprodotta chiaramente su ogni copia una +appropriata nota di copyright e di assenza di garanzia; che si +mantengano intatti tutti i riferimenti a questa Licenza e all'assenza +di ogni garanzia; che si dia a ogni altro destinatario del Programma +una copia di questa Licenza insieme al Programma. + + possibile richiedere un pagamento per il trasferimento fisico di una +copia del Programma, anche possibile a propria discrezione +richiedere un pagamento in cambio di una copertura assicurativa. + + 2. lecito modificare la propria copia o copie del Programma, o +parte di esso, creando perci un'opera basata sul Programma, e copiare +o distribuire tali modifiche o tale opera secondo i termini del +precedente comma 1, a patto che siano soddisfatte tutte le condizioni +che seguono: + + a) Bisogna indicare chiaramente nei file che si tratta di copie + modificate e la data di ogni modifica. + + b) Bisogna fare in modo che ogni opera distribuita o pubblicata, + che in parte o nella sua totalit derivi dal Programma o da parti + di esso, sia concessa nella sua interezza in licenza gratuita ad + ogni terza parte, secondo i termini di questa Licenza. + + c) Se normalmente il programma modificato legge comandi + interattivamente quando viene eseguito, bisogna fare in modo che + all'inizio dell'esecuzione interattiva usuale, esso stampi un + messaggio contenente una appropriata nota di copyright e di + assenza di garanzia (oppure che specifichi il tipo di garanzia che + si offre). Il messaggio deve inoltre specificare che chiunque pu + ridistribuire il programma alle condizioni qui descritte e deve + indicare come reperire questa Licenza. Se per il programma di + partenza interattivo ma normalmente non stampa tale messaggio, + non occorre che un'opera basata sul Programma lo stampi. + +Questi requisiti si applicano all'opera modificata nel suo complesso. +Se sussistono parti identificabili dell'opera modificata che non siano +derivate dal Programma e che possono essere ragionevolmente +considerate lavori indipendenti, allora questa Licenza e i suoi +termini non si applicano a queste parti quando queste vengono +distribuite separatamente. Se per queste parti vengono distribuite +all'interno di un prodotto che un'opera basata sul Programma, la +distribuzione di quest'opera nella sua interezza deve avvenire nei +termini di questa Licenza, le cui norme nei confronti di altri utenti +si estendono all'opera nella sua interezza, e quindi ad ogni sua +parte, chiunque ne sia l'autore. + +Quindi, non nelle intenzioni di questa sezione accampare diritti, n +contestare diritti su opere scritte interamente da altri; l'intento +piuttosto quello di esercitare il diritto di controllare la +distribuzione di opere derivati dal Programma o che lo contengano. + +Inoltre, la semplice aggregazione di un'opera non derivata dal +Programma col Programma o con un'opera da esso derivata su di un mezzo +di memorizzazione o di distribuzione, non sufficente a includere +l'opera non derivata nell'ambito di questa Licenza. + + 3. lecito copiare e distribuire il Programma (o un'opera basata su +di esso, come espresso al comma 2) sotto forma di codice oggetto o +eseguibile secondo i termini dei precedenti commi 1 e 2, a patto che +si applichi una delle seguenti condizioni: + + a) Il Programma sia corredato del codice sorgente completo, in una + forma leggibile da calcolatore, e tale sorgente sia fornito + secondo le regole dei precedenti commi 1 e 2 su di un mezzo + comunemente usato per lo scambio di programmi. + + b) Il Programma sia accompagnato da un'offerta scritta, valida per + almeno tre anni, di fornire a chiunque ne faccia richiesta una + copia completa del codice sorgente, in una forma leggibile da + calcolatore, in cambio di un compenso non superiore al costo del + trasferimento fisico di tale copia, che deve essere fornita + secondo le regole dei precedenti commi 1 e 2 su di un mezzo + comunemente usato per lo scambio di programmi. + + c) Il Programma sia accompagnato dalle informazioni che sono state + ricevute riguardo alla possibilit di ottenere il codice sorgente. + Questa alternativa permessa solo in caso di distribuzioni non + commerciali e solo se il programma stato ottenuto sotto forma di + codice oggetto o eseguibile in accordo al precedente comma B. + +Per "codice sorgente completo" di un'opera si intende la forma +preferenziale usata per modificare un'opera. Per un programma +eseguibile, "codice sorgente completo" significa tutto il codice +sorgente di tutti i moduli in esso contenuti, pi ogni file associato +che definisca le interfacce esterne del programma, pi gli script +usati per controllare la compilazione e l'installazione +dell'eseguibile. In ogni caso non necessario che il codice sorgente +fornito includa nulla che sia normalmente distribuito (in forma +sorgente o in formato binario) con i principali componenti del sistema +operativo sotto cui viene eseguito il Programma (compilatore, kernel, +e cos via), a meno che tali componenti accompagnino l'eseguibile. + +Se la distribuzione dell'eseguibile o del codice oggetto effettuata +indicando un luogo dal quale sia possibile copiarlo, permettere la +copia del codice sorgente dallo stesso luogo considerata una valida +forma di distribuzione del codice sorgente, anche se copiare il +sorgente facoltativo per l'acquirente. + + 4. Non lecito copiare, modificare, sublicenziare, o distribuire +il Programma in modi diversi da quelli espressamente previsti da +questa Licenza. Ogni tentativo di copiare, modificare, sublicenziare +o distribuire il Programma non autorizzato, e far terminare +automaticamente i diritti garantiti da questa Licenza. D'altra parte +ogni acquirente che abbia ricevuto copie, o diritti, coperti da questa +Licenza da parte di persone che violano la Licenza come qui indicato +non vedranno invalidata la loro Licenza, purch si comportino +conformemente ad essa. + + 5. L'acquirente non tenuto ad accettare questa Licenza, +poich non l'ha firmata. D'altra parte nessun altro documento +garantisce il permesso di modificare o distribuire il Programma o i +lavori derivati da esso. Queste azioni sono proibite dalla legge per +chi non accetta questa Licenza; perci, modificando o distribuendo il +Programma o un'opera basata sul programma, si indica nel fare ci +l'accettazione di questa Licenza e quindi di tutti i suoi termini e le +condizioni poste sulla copia, la distribuzione e la modifica del +Programma o di lavori basati su di esso. + + 6. Ogni volta che il Programma o un'opera basata su di esso vengono +distribuiti, l'acquirente riceve automaticamente una licenza d'uso da +parte del licenziatario originale. Tale licenza regola la copia, la +distribuzione e la modifica del Programma secondo questi termini e +queste condizioni. Non lecito imporre restrizioni ulteriori +all'acquirente nel suo esercizio dei diritti qui garantiti. Chi +distribuisce programmi coperti da questa Licenza non e' comunque +tenuto a imporre il rispetto di questa Licenza a terzi. + + 7. Se, come conseguenza del giudizio di un tribunale, o di una +imputazione per la violazione di un brevetto o per ogni altra ragione +(non limitatamente a questioni di brevetti), vengono imposte +condizioni che contraddicono le condizioni di questa licenza, che +queste condizioni siano dettate dalla corte, da accordi tra le parti o +altro, queste condizioni non esimono nessuno dall'osservazione di +questa Licenza. Se non possibile distribuire un prodotto in un modo +che soddisfi simultaneamente gli obblighi dettati da questa Licenza e +altri obblighi pertinenti, il prodotto non pu essere affatto +distribuito. Per esempio, se un brevetto non permettesse a tutti +quelli che lo ricevono di ridistribuire il Programma senza obbligare +al pagamento di diritti, allora l'unico modo per soddisfare +contemporaneamente il brevetto e questa Licenza e' di non distribuire +affatto il Programma. + +Se una qualunque parte di questo comma ritenuta non valida o non +applicabile in una qualunque circostanza, deve comunque essere +applicata l'idea espressa da questo comma; in ogni altra circostanza +invece deve essere applicato questo comma nel suo complesso. + +Non nelle finalit di questo comma indurre gli utenti ad infrangere +alcun brevetto n ogni altra rivendicazione di diritti di propriet, +n di contestare la validit di alcuna di queste rivendicazioni; lo +scopo di questo comma unicamente quello di proteggere l'integrit +del sistema di distribuzione dei programmi liberi, che viene +realizzato tramite l'uso di licenze pubbliche. Molte persone hanno +contribuito generosamente alla vasta gamma di programmi distribuiti +attraverso questo sistema, basandosi sull'applicazione fedele di tale +sistema. L'autore/donatore pu decidere di sua volont se preferisce +distribuire il software avvalendosi di altri sistemi, e l'acquirente +non pu imporre la scelta del sistema di distribuzione. + +Questo comma serve a rendere il pi chiaro possibile ci che crediamo +sia una conseguenza del resto di questa Licenza. + + 8. Se in alcuni paesi la distribuzione o l'uso del Programma sono +limitati da brevetto o dall'uso di interfacce coperte da copyright, il +detentore del copyright originale che pone il Programma sotto questa +Licenza pu aggiungere limiti geografici espliciti alla distribuzione, +per escludere questi paesi dalla distribuzione stessa, in modo che il +programma possa essere distribuito solo nei paesi non esclusi da +questa regola. In questo caso i limiti geografici sono inclusi in +questa Licenza e ne fanno parte a tutti gli effetti. + + 9. All'occorrenza la Free Software Foundation pu pubblicare +revisioni o nuove versioni di questa Licenza Pubblica Generica. Tali +nuove versioni saranno simili a questa nello spirito, ma potranno +differire nei dettagli al fine di coprire nuovi problemi e nuove +situazioni. + +Ad ogni versione viene dato un numero identificativo. Se il Programma +asserisce di essere coperto da una particolare versione di questa +Licenza e "da ogni versione successiva", l'acquirente pu scegliere se +seguire le condizioni della versione specificata o di una successiva. +Se il Programma non specifica quale versione di questa Licenza deve +applicarsi, l'acquirente pu scegliere una qualsiasi versione tra +quelle pubblicate dalla Free Software Foundation. + + 10. Se si desidera incorporare parti del Programma in altri +programmi liberi le cui condizioni di distribuzione differiscano da +queste, possibile scrivere all'autore del Programma per chiederne +l'autorizzazione. Per il software il cui copyright detenuto dalla +Free Software Foundation, si scriva alla Free Software Foundation; +talvolta facciamo eccezioni alle regole di questa Licenza. La nostra +decisione sar guidata da due finalit: preservare la libert di tutti +i prodotti derivati dal nostro software libero e promuovere la +condivisione e il riutilizzo del software in generale. + + + NON C' GARANZIA + + 11. POICH IL PROGRAMMA CONCESSO IN USO GRATUITAMENTE, NON C' +GARANZIA PER IL PROGRAMMA, NEI LIMITI PERMESSI DALLE VIGENTI LEGGI. +SE NON INDICATO DIVERSAMENTE PER ISCRITTO, IL DETENTORE DEL COPYRIGHT +E LE ALTRE PARTI FORNISCONO IL PROGRAMMA "COS COM'", SENZA ALCUN +TIPO DI GARANZIA, N ESPLICITA N IMPLICITA; CI COMPRENDE, SENZA +LIMITARSI A QUESTO, LA GARANZIA IMPLICITA DI COMMERCIABILIT E +UTILIZZABILIT PER UN PARTICOLARE SCOPO. L'INTERO RISCHIO CONCERNENTE +LA QUALIT E LE PRESTAZIONI DEL PROGRAMMA DELL'ACQUIRENTE. SE IL +PROGRAMMA DOVESSE RIVELARSI DIFETTOSO, L'ACQUIRENTE SI ASSUME IL COSTO +DI OGNI MANUTENZIONE, RIPARAZIONE O CORREZIONE NECESSARIA. + + 12. N IL DETENTORE DEL COPYRIGHT N ALTRE PARTI CHE POSSONO +MODIFICARE O RIDISTRIBUIRE IL PROGRAMMA COME PERMESSO IN QUESTA +LICENZA SONO RESPONSABILI PER DANNI NEI CONFRONTI DELL'ACQUIRENTE, A +MENO CHE QUESTO NON SIA RICHIESTO DALLE LEGGI VIGENTI O APPAIA IN UN +ACCORDO SCRITTO. SONO INCLUSI DANNI GENERICI, SPECIALI O INCIDENTALI, +COME PURE I DANNI CHE CONSEGUONO DALL'USO O DALL'IMPOSSIBILIT DI +USARE IL PROGRAMMA; CI COMPRENDE, SENZA LIMITARSI A QUESTO, LA +PERDITA DI DATI, LA CORRUZIONE DEI DATI, LE PERDITE SOSTENUTE +DALL'ACQUIRENTE O DA TERZI E L'INCAPACIT DEL PROGRAMMA A INTERAGIRE +CON ALTRI PROGRAMMI, ANCHE SE IL DETENTORE O ALTRE PARTI SONO STATE +AVVISATE DELLA POSSIBILIT DI QUESTI DANNI. + + FINE DEI TERMINI E DELLE CONDIZIONI + + Appendice: come applicare questi termini a nuovi programmi + +Se si sviluppa un nuovo programma e lo si vuole rendere della maggiore +utilit possibile per il pubblico, la cosa migliore da fare rendere +tale programma libero, cosicch ciascuno possa ridistribuirlo e +modificarlo sotto questi termini. + +Per fare questo, si inserisca nel programma la seguente nota. La cosa +migliore da fare mettere la nota all`inizio di ogni file sorgente, +per chiarire nel modo pi efficiente possibile l'assenza di garanzia; +ogni file dovrebbe contenere almeno la nota di copyright e +l'indicazione di dove trovare l'intera nota. + + + Copyright (C) + + Questo programma software libero; lecito redistribuirlo o + modificarlo secondo i termini della Licenza Pubblica Generica GNU + come pubblicata dalla Free Software Foundation; o la versione 2 + della licenza o (a propria scelta) una versione successiva. + + Questo programma distribuito nella speranza che sia utile, ma + SENZA ALCUNA GARANZIA; senza neppure la garanzia implicita di + NEGOZIABILIT o di APPLICABILIT PER UN PARTICOLARE SCOPO. Si + veda la Licenza Pubblica Generica GNU per avere maggiori dettagli. + + Questo programma deve essere distribuito assieme ad una copia + della Licenza Pubblica Generica GNU; in caso contrario, se ne pu + ottenere una scrivendo alla Free Software Foundation, Inc., 59 + Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Si aggiungano anche informazioni su come si pu essere contattati +tramite posta elettronica e cartacea. + +Se il programma interattivo, si faccia in modo che stampi una breve +nota simile a questa quando viene usato interattivamente: + + Orcaloca versione 69, Copyright (C) anno nome dell'autore + Orcaloca non ha ALCUNA GARANZIA; per dettagli usare il comando `show g'. + Questo software libero, e ognuno libero di ridistribuirlo secondo + certe condizioni; usare il comando `show c' per i dettagli. + +Gli ipotetici comandi "show g" e "show c" mostreranno le parti +appropriate della Licenza Pubblica Generica. Chiaramente, i comandi +usati possono essere chiamati diversamente da "show g" e "show c" e +possono anche essere selezionati con il mouse o attraverso un men, o +comunque sia pertinente al programma. + +Se necessario, si deve anche far firmare al proprio datore di lavoro +(per chi lavora come programmatore) o alla propria scuola, per chi +studente, una "rinuncia al copyright" per il programma. Ecco un +esempio con nomi fittizi: + + Yoyodinamica SPA rinuncia con questo documento ad ogni diritto sul + copyright del programma `Orcaloca' (che svolge dei passi di + compilazione) scritto da Giovanni Smanettone. + + , 1 April 3000 + Primo Tizio, Presidente + +I programmi coperti da questa Licenza Pubblica Generica non possono +essere incorporati all'interno di programmi proprietari. Se il +proprio programma una libreria di funzioni, pu essere pi utile +permettere di collegare applicazioni proprietarie alla libreria. Se +si ha questa intenzione consigliamo di usare la Licenza Pubblica +Generica Minore GNU (LGPL) invece di questa Licenza. diff --git a/license/license-KO.txt b/license/license-KO.txt new file mode 100644 index 0000000..e4ad3be --- /dev/null +++ b/license/license-KO.txt @@ -0,0 +1,90 @@ +GNU Ϲ 㰡 +2, 1991 6 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + 㰡 ִ ״ ϰ +ֽϴ. ׷ ʽϴ. + + + +Ʈ Ǵ κ 㰡(license) Ʈ Ϸ մϴ. ׷ GNU Ϲ 㰡(, ``GPL''̶ Īմϴ.) Ʈ ڵ鿡 ϱ ؼ Դϴ. Ʈ ϴ κ Ʈ GPL ؼ ǰ , Ʈ 㰡 GNU ̺귯 Ϲ 㰡(GNU Library General Public License) ϱ⵵ մϴ. Ʈ, ̸ Ϸ ϴ ؼ Ǹ Բ 絵Ǵ Ʈ ϸ α׷  α׷ GPL ֽϴ. α׷ GPL ֽϴ. + + Ʈ Ǵ ``'' ܾ () ǹϴ ƴ϶ ӵ ʴ´ٴ ǹϸ, GPL Ʈ ̿ , ϰ ֽϴ. ⿡ ڵ(source code) Ǵ Ϻθ ؼ α׷ ų ο α׷ â ִ ԵǸ, ڽſ 絵 ̷ Ǹ Ȯϰ ν ֵ ϱ ԵǾ ֽϴ. + +GPL GPL ȿ Ʈ 絵 Ǹ ϴ װ ܼ ߰Ű ϰ ν ڵ Ǹ ϰ ֽϴ. Ʈ ۰ ϰ ִ ̷ Ǹ 絵 ؼؾ߸ մϴ. + + GPL α׷ 쿡 α׷ Ǹų ڽ ش α׷ ؼ ־ Ǹ, α׷ ްԵ ״ 絵 ־ մϴ. , α׷ ڵ带 Բ ϰų ڵ带 ִ Ȯ ˷־ ϰ ̷ ׵ ڵ и ֵ ؾ մϴ. + + Ʈ ܰ踦 ؼ ڵ Ǹ ȣմϴ. (1) Ʈ ۱ մϴ. (2) ۱ 絵 ؼ ȿ ȿ GPL Ʈ ϰų ִ Ǹ ڵ鿡 οմϴ. + + Ʈ ϴ ݺ Ʈ ü Ͼ , ̴ ڰ Ʈ ִ ƴ ִٴ νϰ ־ մϴ. 츮 ۰ ٸ ߻ α׷ ڵ Ÿ ѼյǴ ʽϴ. GPL Ʈ  ʴ ̷ Ǿ ̸, ̴ α׷ ڿ Ʈ ο Ȱ ϴ ̱⵵ մϴ. + +Ư Ʈ ϴ ۿ ϴ. α׷ ϴ Ư㸦 ϰ Ǹ, α׷ Ʈ ɼ ֽϴ. Ʈ ̷ óϱ ؼ  Ư㿡 ؼ Ǹ (, ``()''̶ Īմϴ.) Ӱ ϴ 쿡 ؼ Ʈ Բ ִٴ Ȯ ֽϴ. + +(copying) (modification) (distribution) õ ü ǰ ϴ. + + + ǰ + 0 . 㰡 GNU Ϲ 㰡 ִٴ ۱ڿ ؼ õ ǻ α׷ ۹ ؼ ϰ ˴ϴ. ǻ α׷ ۹(, ``α׷''̶ Īմϴ.)̶ Ư ؼ ǻ ó ɷ ġ(, ``ǻ'' Īմϴ.) Ǵ Ǵ Ϸ ǥ â۹ ǹϰ, ``2 α׷''̶ α׷ ڽ Ǵ ۱ǹ α׷ Ǵ κ ϰų ٸ ִ ؼ â۵ ο α׷ ̿ õ ۹ ǹմϴ. (ķ ٸ ٸ Ѿ ԵǴ մϴ.) ``Ǿ絵'' GPL α׷ 絵 ǹϰ, ``()α׷''̶ α׷ ϰų 2 α׷ ؼ α׷ ǹմϴ. + + 㰡 α׷ ׸ ؼ ˴ϴ. α׷ Ű ϴ. α׷ (output), װ α׷ Ѽ ƴ ο α׷κ Ļ 2 α׷ ؼ 㰡 ˴ϴ. 2 α׷ δ 2 α׷ ȿ α׷ Ǵմϴ. + + 1 . ۱ ǥÿ α׷ ʴ´ٴ ϴ , Ǿ絵ڴ α׷ ڵ带 ڽ 絵 ״  ü ؼ ϰ ֽϴ. ̷ 㰡 α׷ ʴ´ٴ ǿ ؼ ޵Ǿ ״ Ѿ ϸ, GPL Բ ؾ մϴ. + +ڴ εϴµ ҿ û , ֽϴ. + + 2 . Ǿ絵ڴ ڽ 絵 α׷ γ Ϻθ , ̸ ؼ 2 α׷ â ֽϴ. ۵ α׷̳ â۵ 2 α׷ ׵ Ű ǿ ؼ, 1 Ǵٽ ǰ ֽϴ. + + 1 . ǰ ¥ ȿ ؾ մϴ. + 2 . ϰų ǥϷ ۹ Ǵ Ϻΰ 絵 α׷κ Ļ ̶, ۹ ü Ǹ 㰡 ߿ ؾ մϴ. + + 3 . ۵ α׷ Ϲ ° ȭ ɾ о ̴ ϰ 쿡, ۱ ǥÿ α׷ ʴ´ٴ , ( ش ) ׸ 絵 α׷ ִٴ ǰ GPL 纻 ִ Բ Ե α׷ ȭ ϰ Ŀ ȭ Ǵ µǵ ۼǾ մϴ. ( : 絵 α׷ ȭ ߰ ִ ϴ ȯ濡 ׵ µ ʴ ¿ 쿡 ̸ α׷ ׵ ½Ű ʾƵ մϴ.) + + ׵ ۵ α׷ ü ˴ϴ. , ۵ α׷ Ե Ư κ α׷κ Ļ ƴ ۹ 쿡 ش ۹ 㰡 ʽϴ. ׷ ̷ ۹ 2 α׷ Ϻημ Բ ȴٸ ۱ǰ ؿ ۹ ο 㰡 Ǿ ϸ, ü ۹ Ǹ ߿ 絵˴ϴ. + +̷ ۹ Ǹ ħϰų ƴ϶, α׷κ Ļ 2 α׷̳ ۹ ϰ ִ Ǹ ϱ Դϴ. + +α׷̳ α׷κ Ļ 2 α׷ ̵κ Ļ ٸ ۹ Բ ܼ ϰų ü չ 쿡, α׷κ Ļ ٸ ۹ 㰡 ʽϴ. + + 3 . Ǿ絵ڴ ϳ ׸ Ű ǿ ؼ 1 2 α׷(Ǵ 2 ޵ 2 α׷) ڵ(object code) ๰(executable form) · ϰ ֽϴ. + + 1 . ڵ峪 ๰ ϴ ǻͰ ν ִ ڵ带 Բ ؾ մϴ. ڵ 1 2 ־ ϸ, Ʈ ȯ ؼ Ϲ Ǵ ü Ǿ մϴ. + 2 . ʿ ּ 븸 ް ڵ峪 ๰ ϴ ڵ带 ϰڴٴ, ּ 3Ⱓ ȿ Բ ؾ մϴ. ִ  ؼ ȿؾ մϴ. ڵ ǻͰ ν ִ ¿ ϰ 1 2 ־ ϸ, Ʈ ȯ ؼ Ϲ Ǵ ü Ǿ մϴ. + + 3 . ڵ峪 ๰ ϴ ڵ带 ϰڴٴ ؼ ڽ 絵 Բ ؾ մϴ. (3 2׿ ڵ带 ϰڴٴ α׷ ڵ峪 ๰ Բ ޾Ұ, ÿ ϰ 쿡 ؼ ˴ϴ.) + +۹ ڵ ش ۹ ϱ⿡ ǹմϴ. ๰ ڵ ๰ Ե ڵ ̿ õ ̽ , ׸ ๰ ϰ ġ ϴµ ũƮ θ ǹմϴ. ׷ Ư ϳμ, ๰ ü ֿ κ(Ϸ Ŀ ) Բ ( ڵ峪 ̳ʸ ·) Ϲ Ǵ ҵ ̷ ü ๰ ݵ ʴ ڵ 󿡼 ܵǾ մϴ. + + ڵ峪 ๰ ҷκ ְ ϴ , ҷκ ڵ带 ִ Ѵٸ ̴ ڵ带 ڵ Բ ǵ ʾҴٰ ϴ ڵ带 ϴ ֵ˴ϴ. + + 4 . 㰡 ̷ ʴ α׷ 㰡 ϴ. ̿ õ  ȿ̸ 㰡 Ǹ ڵ Ҹ˴ϴ. ׷ 㰡 α׷ ̳ Ǹ 絵޾Ҵ 3ڴ 㰡 ؼϴ , Ǹ Ҹ꿡 Ǹ ؼ ֽϴ. + + 5 . 㰡 ̳ ݵǴ ʱ Ǿ絵ڰ 㰡 ݵ ޾Ƶ鿩 ʿ ϴ. ׷ α׷̳ α׷ 2 α׷ ϴ 㰡 ؼ մϴ. 㰡 쿡 ̷ ˴ϴ. α׷(Ǵ α׷ 2 α׷) ϰų ϴ ̿ 㰡 뿡 Ѵٴ ǹϸ, 㰡 ǰ ޾Ƶ̰ڴٴ ǹ̷ ֵ˴ϴ. + + 6 . Ǿ絵ڿ ؼ α׷(Ǵ α׷ 2 α׷) ݺ , ܰ迡 Ǿ絵ڴ 㰡 α׷ Ǹ 絵ڷκ 絵 ڵ ֵ˴ϴ. α׷(Ǵ α׷ 2 α׷) Ǿ絵 Ǹ 縦 ִ  ׵ ߰ ϴ. ׷ Ǿ絵ڿ, Ͼ 3 Ǿ絵ڿ 㰡 ؼϵ å ΰ ʽϴ. + + 7 . ǰ̳ Ư ħؿ Ǵ Ư ѵ ׹ ؼ 㰡 ġǴ ߻Ѵ ϴ ׷ ϰų 㰡 ǰ Ǵ ƴմϴ. ̳  ؼ 㰡 Ǵ ׵ ߻ Ȳ̶ θ ų ٸ α׷ ϴ. , Ư Ư 㰡 α׷ Ǵ 絵 3ڿ ش α׷ ְ ʴ´ٸ, ׷ 㰡 㰡 ÿ Ű鼭 α׷ ִ ϴ. + + Ư Ȳ Ϻΰ ȿ ʰų 쿡 κе ϱ ǵ ϴ. ̿ Ȳ ü ϸ ˴ϴ. + + Ư㳪 ۱ ħ ϰų ش Ǹ ƴ϶, GPL ؼ Ǿ ִ Ʈ ü踦 ȣϱ Դϴ. ü迡 ŷִ ν Ʈ پ о߿ ־ϴ. Ʈ  ü ΰ ϴ ڿ ڵ ޷ִ , Ϲ ڵ ִ ƴմϴ. + + 㰡 ٸ ׵鿡 ߿ϰ Ǿ ϴ Ȯϰ ϱ Դϴ. + + 8 . Ư㳪 ۱ ̽ ؼ Ư α׷ Բ Ǵ ѵǾ ִ , 㰡 α׷ ۱ڴ ߻ ʴ ؼ α׷ Ѵٴ , ̷ 㰡 Ϻη ֵ˴ϴ. + + 9 . Ʈ 㰡 ̳ ǥ ֽϴ. Ӱ ǥ óϱ ؼ 뿡 ̰ ߻ , ٺ ſ Դϴ. + + ǵ ǹȣ ؼ ˴ϴ. Ư ǹȣ ٴ õ α׷ ش ̳ Ŀ  ؼ ص ϰ, ǹȣ ϰ 쿡 Ʈ ǥ  ǹȣ ص մϴ. + + 10 . α׷ Ϻθ 㰡 ٸ α׷ Բ ϰ 쿡 ش α׷ ڷκ ޾ƾ մϴ. Ʈ ۱ ִ Ʈ 쿡 Ʈ մϴ. 츮 ̷ û ϱ ؼ ⵵ մϴ. Ʈ Ϲ Ʈ 2 ۹ ο · Ű Ʈ Ȱ Ű ΰ θ Դϴ. + + + Ῡ (11, 12) + 11 . 㰡 α׷ 絵DZ ϴ ѵ  ʽϴ. α׷ ۱ڿ ڰ Ǵ ϸ, Ư α׷ ռ̳ ο  ̳ ``ִ ״'' · α׷ մϴ. α׷ α׷ ࿡ ߻ ִ Ǿ絵ڿ μǸ ̿ Ǿ絵ڰ δؾ մϴ. + + 12 . ۱ڳ ڰ α׷ ջ ɼ ˰ ־ ϴ ߻ ս Կ ȣǰ ְų ̿ 찡 ƴ϶, ۱ڳ α׷ Ǵ · ڴ α׷ ̳ ۵ ߻ ս̳ α׷ ü սǿ å ʽϴ. ̷ å ڳ 3ڰ α׷ ν ߻ ս̳ ٸ Ʈ α׷ Բ ۽Ű ؼ ߻ Ȯ ѵǴ ƴմϴ. ߻ ս Ϲݼ̳ Ư ƴ϶ ߼ ʿ ʽϴ. + + + ǰ . \ No newline at end of file diff --git a/license/license-LT.txt b/license/license-LT.txt new file mode 100644 index 0000000..b3a7955 --- /dev/null +++ b/license/license-LT.txt @@ -0,0 +1,182 @@ +GNU BENDROJI VIEOJI LICENZIJA +1991 met birelis. Versijos numeris 2. + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Kiekvienas gali kopijuoti ir platinti io dokumento (anglikos originalios versijos) tikslias kopijas, bet keisti j (original) draudiama. +Pratarm +Daugumos programini produkt licencijos yra paraytos, kad neleist jums t produkt platinti ir keisti. GNU Bendroji vieoji licencija, prieingai, yra skirta garantuoti Js laisv platinti ir keisti iuo dokumentu apsaugotus produktus. Tuo siekiama, kad programin ranga bt laisvai prieinama visiems jos vartotojams. i Bendroji vieoji licencija (General Public License ) tinka daugumai Free Software Foundation produkt (dalis yra apsaugota GNU Library General Public License - GNU Bibliotekine Bendrja vieja licencija) ir bet kokiai kitai programai, kurios autoriai sipareigoja j naudoti. Js taip pat galite ia licencij taikyti savo programoms. + +Kalbdami apie laisvas programas, mes turim omeny laisv, o ne kain. Ms Bendroji vieoji licencija yra sukurta utikrinti Js laisv platinti laisv program kopijas (ir imti mokest u tai, jei norite). Taip pat ji skirta utikrinti, kad Js kartu su programa gautumte jos ieities tekstus arba galtumte juos gauti, jei tik jums prireikt. i licencija garantuoja, kad ja apsaugotus produktus Js galite keisti arba naudoti j dalis naujose atvirose programose ir skirta Jums pasakyti, kad tikrai turite teis atlikti aukiau mintus veiksmus. + +Nordami apsaugoti Js teises, mes turime vesti apribojimus, kurie udraudia bet kam varyti aukiau mintas teises ar prayti Js i teisi atsisakyti. ie suvarymai suprantami kaip tam tikra Js atsakomyb, jei Js modifikuojate ar platinate laisv program kopijas. + +Pavyzdiui, jeigu Js platinate toki program (nesvarbu u dyk ar u pinigus), Js privalote gavjui suteikti visas teises, kurias Js pats turite. Js taip pat privalote utikrinti, kad ir gavjas gaut ar galt gauti ieities tekstus. Be to, Js privalote jam parodyti ias slygas, kad ir gavjas inot savo teises. + +Mes Js teises apsaugome dviem ingsniais: (1) Programinio produkto autorinmis teismis ir (2) silome Jums i licencij, kuri suteikia teis kopijuoti, platinti ir/arba modifikuoti programin produkt. + +Kiekvieno autoriaus ir savo apsaugai mes norime utikrinti, kad kiekvienas suprast, jog iai laisvai programinei rangai nesuteikiama jokia garantija. Jei produktas yra kakieno modifikuotas ir platinamas, mes norime, kad gavjas inot, jog gauna pakeist, o ne originali program. itaip siekiama utikrinti, kad kakieno veltos klaidos ir j sukeltos problemos netert pradinio produkto autoriaus reputacijos. + +Pagaliau, bet kokiai laisvai programai nuolatos gresia programini produkt patentai. Mes norime ivengti pavojaus, kai laisv program platintojai individualiai sigyja patent licencijas ir taip padaro programas nuosavybinmis. Kad taip neatsitikt, mes nustatme, jog bet kokie patentai privalo bti licencijuoti kiekvieno laisvam naudojimui arba i viso nelicencijuoti. + +Tiksls kopijavimo, platinimo ir modifikavimo terminai bei slygos pateiktos emiau. + +KOPIJAVIMO, PLATINIMO IR MODIFIKAVIMO SLYGOS +0. i licencija taikoma visoms programoms ar kitokiems produktams, kuriuose yra autoriaus praneimas, sakantis, kad produktas yra platinamas pagal ios Bendrosios vieosios licencijos slygas. Programa tolimesniam tekste ir reikia toki program ar kit produkt, o darbas pagrstas ta Programa reikia Program ar bet kok ivestin produkt pagal autorini teisi statym, t.y. produkt, kur traukta Programa ar jos dalis, originali ar pakeista ir/arba iversta kit kalb. (Toliau Programos vertimas yra be apribojim trauktas svok modifikacija). kiekvien licencijos turtoj tekste kreipiamasi Js. + +Kitokia veikla nei kopijavimas, platinimas ir modifikavimas ia licencija nra numatoma ir ieina u jos rib. Programos vykdymas nra varomas ir jos vykdymo rezultatai yra ginami ios licencijos tik tuo atveju, jeigu j turinys sudarytas i darbo pagrsto Programa (rezultatai ginami licencijos tada, jei jie - modifikuota Programa ir nepriklausomai nuo to ar darbas atliktas Programa). Ar tai tiesa priklauso nuo to, k Programa daro. + +1. Js galite kopijuoti ir platinti originalius Programos ieities tekstus bet kokiose laikmenose, kuriose Js juos gavote ar patys patalpinote, aikiai ir kaip priklauso kiekvienoje kopijoje traukdami atitinkamus garantijos nebuvimo ir autorini teisi spjimus. Nekeiskite joki spjim susijusi su ia licencija bei garantijos nebuvimu ir visiems Programos gavjams pateikite ios licencijos (originalios anglikos versijos) kopij kartu su Programa. + +Js galite imti mokest u fizin kopijos perdavim ir taip pat galite savo nuoira silyti garantin aptarnavim mainais pinigus. + +2. Js galite modifikuoti savo Programos kopij (ar kopijas) ar bet kuri jos dal tuo bdu sukurdami Programa paremt produkt, kur Js galite kopijuoti, platinti arba dirbti su juo pagal 1-ame skyriuje pamintas slygas, jei Js taip pat laikysits i, emiau ivardint, slyg: + +Js privalote pakeistuose failuose terpti pastabas, kad Js pakeitte failus ir nurodyti pakeitim datas. +Js platinamas produktas, kur sudaro dalis ar visa Programa arba kurio dalis ar visas yra sukurtas pagal Program, turi bti licencijuotas pagal ios licencijos slygas be joki mokesi treiosioms alims. +Jeigu modifikuota Programa j vykdant interaktyviai nuskaito komandas, ji privalo kiekvien kart paleista tokiam interaktyviam naudojimui atspausdinti praneim, kuriame nurodomos atitinkamos autorins teiss ir spjimas, kad nesuteikiama jokia garantija (arba kitu atveju, kad Js suteikiate garantij) ir kad vartotojai gali Program platinti pagal ias slygas. Taip pat reikia vartotojui praneti, kaip jis galt perskaityti ios licencijos (originalios anglikos) kopij. Iimtis galioja tuo atveju, jei pati Programa yra interaktyvi (t.y. sveikaujanti, dialogin) ir paprastai nespausdina tokio praneimo, tai ir Js darbas pagrstas Programa neprivalo spausdinti praneimo. +ie reikalavimai taikomi modifikuotam darbui kaip visumai. Jeigu aikios, atskiriamos darbo dalys nra sukurtos naudojantis Programos ieities tekstais ir gali bti pagrstai vadinamos nepriklausomais bei atskirais darbais, tai i licencija ir jos slygos netaikomos toms dalims, kai Js jas platinate kaip atskirus produktus. Tuo atveju, kai ias savo sukurtas nepriklausomas dalis Js platinate kaip pagrsto Programa produkto dal, platinamas produktas privalo bti ginamas ios licencijos slyg. Tokiu atveju i licencija gina visum ir kiekvien jos dal nepriklausomai nuo to, kas j para. + +Taigi, io skyriaus tikslas nra reikti pretenzijas visikai Js parayt darb teises. Prieingai, siekiama gyvendinti teises, kuriomis bt kontroliuojamas Programa paremt ivestini ar kolektyvini darb platinimas. + +Be to, vien tik darbo, nepagrsto Programa, sudjimas vien rinkin su Programa ar darbu pagrstu Programa saugojimui ar platinimui nepadaro io darbo licenzijos objektu. + +3. Js galite Program (ar darb pagrsta ja, r. 2 skyri) kopijuoti ir platinti objektiniu kodu ar vykdoma forma laikydamiesi 1 ir 2 skyriuje minim slyg, jei Js taip pat: + +Kartu su Programa pateiksite pilnus ir perskaitomus ieities tekstus elektroniniu pavidalu kurie turi bti platinami pagal 1 bei 2 skyriaus slygas ir esantys laikmenose paprastai naudojamose programini produkt keitimuisi, arba +kartu su Programa pateiksite pasilym (galiojant maiausiai tris metus) suteikti pilnus perskaitomus atitinkamus ieities tekstus elektroniniu pavidalu bet kuriai treiajai aliai u mokest nedidesn nei kainuoja fizinis duomen perdavimas ir tie ieities tekstai bus platinami pagal 1 ir 2 skyriuose mintas slygas laikmenose, paprastai naudojamose programini produkt keitimuisi, arba +kartu su Programa pateiksite informacij, kuri Js gavote dl pasilymo platinti atitinkamus ieities tekstus. (i alternatyva leidiama tik nekomerciniam platinimui ir tik tada, jei Js gavote Program objektiniu kodu ar vykdomja forma su tokiu pat pasilymu sutinkamai su 3 skyriaus b) dalim.) +Darbo ieities tekstai tai pageidaujama darbo forma norint j modifikuoti. Prie vykdomos programos esantys ieities tekstai - tai pilni programos ieities tekstai su visais moduliais, bet kokie programos ssajos apraai ir skriptai naudojami programos kompiliavimui ir diegimui. Kaip speciali iimtis, platinami ieities tekstai neprivalo turti nieko, kas paprastai yra platinama (ieities tekstais ar vykdomja forma) su pagrindiniais operacins sistemos, kurioje minima programa veikia, komponentais (kompiliatoriumi, branduoliu ir pan.), nebent tie komponentai eina platinam programos vykdomj form. + +Jei Programos vykdomoji forma ar objektinis kodas platinami silant kopijuoti i tam tikros vietos, tai silymas ekvivalenios galimybs kopijuoti ieities tekstus i tos paios vietos laikomas ieities tekst platinimu net ir tuo atveju, kai treiosios alys neveriamos kopijuoti ieitinio kodo kartu su objektiniu kodu. + +4. Js negalite kopijuoti, modifikuoti, licencijuoti ar platinti Programos kitaip nei aikiai numatyta ios licencijos. Bet kokie bandymai kitaip kopijuoti, modifikuoti, licencijuoti ar platinti Program yra negaliojantys ir automatikai panaikina Js teises suteiktas ios licencijos. Tokiu atveju asmen, gavusi i Js kopijas ar teises remiantis ia licencija, teiss (licencijos) nebus panaikintos, jei ie asmenys nepaeid licencijos. + +5. Js nereikalaujama ios licencijos priimti, nes Js jos nepasirate. Vis dlto, niekas kitas Jums negarantuoja teiss modifikuoti ir platinti Program ar ja paremtus darbus. Be to, minti veiksmai yra draudiami statymo, jei Js nepriimate ios licencijos slyg. Taigi, modifikuodami ar platindami Program (ar bet kok darb paremt Programa), Js parodote, kad priimate i licencij ir visas jos slygas susijusias su Programos (ar bet kokio Programa paremto darbo) kopijavimu, platinimu ar modifikavimu. + +6. Kiekvien kart, kai Js platinate Program (ar bet kok Programa paremt darb), Programos gavjas automatikai gauna licencij i pirmojo Programos autoriaus, suteikiani teis kopijuoti, platinti ar modifikuoti Program remiantis iomis slygomis. Js negalite gavjui primesti joki papildom apribojim nesani ioje licencijoje. Js nesate atsakingas u treij ali vertim laikytis ios licencijos slyg. + +7. Jeigu (kaip teismo nuosprendis ar tarimas patent paeidimu ar bet kokiais kitais atvejais) Jums yra primetamos slygos (teismo potvarkiu, pagal susitarim ar kitaip), kurios prietarauja ios licencijos slygoms, tai primetamos slygos neatleidia Js nuo ios licencijos slyg. Jeigu Js negalite platinti Programos taip, kad vykdytumte savo sipareigojimus iai licencijai ir kitus susijusius sipareigojimus tuo pat metu, tai negalite platinti Programos i viso. Pavyzdiui, jeigu patentas neleis Programos platinti be autorini honorar tiems monms, kurie gaus kopijas tiesiogiai ar netiesiogiai i Js, tai vienintelis kelias patenkinti abi (Programos ir GNU Bendrj viej) licencijas yra i viso neplatinti Programos. + +Jeigu bet kuri io skyriaus dalis yra laikoma negaliojania (neturinia juridins galios) ar nevykdoma esant tam tikroms konkreioms aplinkybms, tai likusi skyriaus dalis lieka galioti. Visais kitais atvejais galioja visas skyrius. + +io skyriaus tikslas nra skatinti paeisti kokius nors patentus, nuosavybs teises ar uginyti toki teisi pagrstum. is skyrius siekia tiktai utikrinti nemokamos programins rangos platinimo sistemos vientisum, gyvendinam vieja licencija. Daug moni vairiai prisidjo prie programins rangos platinimo per i sistem vildamiesi, kad ta sistema bus nuolat taikoma. Tik nuo autoriaus (autors) priklauso, ar jis (ji) nors platinti savo programas per koki nors kit sistem ar ne ir ios licencijos turtojas negali primesti sprendimo. + +is skyrius turt detaliai paaikinti, kokios turt bti likusios licencijos dalies pasekms. + +8. Jeigu Programos platinimas ir/arba naudojimas tam tikrose alyse yra ribojamas patentais ar autorinmis teismis, pirminis autorini teisi turtojas, kurio Programa yra ileista pagal i licencij, turt pridti aikius geografinius platinimo apribojimus paalinanius tas alis ir taip informuodamas, kad platinimas yra leidiamas tik nepamintose alyse. Tokiu atveju apribojimai tampa licencijos dalimi. + +9. Free Software Foundation (angl. - Laisvosos Programins rangos fondas) gali periodikai paskelbti itaisytas ir/arba naujas Bendrosios vieosios licencijos (GPL) versijas. Naujos versijos savo dvasia bus panaios dabartin versij, bet siekiant isprsti naujai ikilusias problemas gali skirtis kai kurios detals. + +Kiekvienai licencijos versijai suteikiamas unikalus numeris. Jeigu Programa nurodo numer licencijos versijos, kuri taikoma Programai ir ?bet kuriai vlesnei jos versijai?, tai Js galite sekti arba nurodyta versija, arba bet kuria vlesne Free Software Foundation paskelbta licencijos versija. Tuo atveju, kai Programa nenurodo licencijos versijos numerio, Js galite pasirinkti bet kuri Free Software Fundation ileistos ios licencijos versij. + +10. Jeigu Js norite Programos dalis traukti kitas laisvas programas, kuri platinimo slygos skiriasi, paraykite autoriui ir papraykite leidimo. Free Software Foundation programins rangos atveju raykite Free Software Foundation organizacijai; mes kartais tokiu atveju padarome iimtis. Ms sprendimas remsis dviem tikslais: vis program, sukurt ms laisv Program pagrindu, laisvos programins rangos statuso isaugojimu ir bendru skatinimu dalintis ir naudoti programin rang laisvai. + +GARANTIJOS NEBUVIMAS + +11. KADANGI PROGRAMA LICENZIJUOJAMA NEMOKAMAI, TAI JOKIOS GARANTIJOS PROGRAMAI GALIOJANI STATYM LEISTU MSTU NESUTEIKIAMA. AUTORINI TEISI SAVININKAI IR/ARBA KITOS ALYS PATEIKIA PROGRAM TAIP KAIP YRA BE JOKI GARANTIJ, IREIKT AR NUMANOM, SKAITANT, BET NEAPSIRIBOJANT, NUMANOMOM PERKAMUMO BEI TINKAMUMO KONKREIAI UDUOIAI GARANTIJOM, NEBENT KITAIP NURODYTA RATU. JS PRISIIMATE VIS RIZIK, SUSIJUSI SU PROGRAMOS KOKYBE IR VEIKIMU. JEIGU PROGAMA PASIRODYS TURINTI DEFEKT, JS PRISIIMATE VISAS BTINAS TECHNINS PRIEIROS, SUTVARKYMO AR KOREGAVIMO ILAIDAS. + +12. JOKIU KITU ATVEJU, NEBENT REIKALAUJAMA PAGAL GALIOJANIUS STATYMUS ARBA SUSITARTA RATU, AUTORINI TEISI SAVININKAI ARBA BET KURI KITA ALIS, KURI GALI KEISTI IR/ARBA PLATINTI PROGRAM KAIP AUKIAU NURODYTA, NEBUS JUMS ATSAKINGA U VISUS, TRAUKIANT BET KOKIUS BENDRUS, ISKIRTINIUS, ATSITIKTINIUS AR IPLAUKIANIUS I PROGRAMOS NAUDOJIMO ARBA NESUGEBJIMO NAUDOTI PROGRAM NUOSTOLIUS (APIMANT BET NEAPSIRIBOJANT DUOMEN PRARADIMU, DUOMEN SUGADINIMU, PROGRAMOS NESUDERINAMUM SU KITOMIS PROGRAMOMIS AR BET KOKIUS KITUS NUOSTOLIUS, PATIRTUS JS AR TREIJ PUSI), NET IR TUO ATVEJU, KAI AUTORINI TEISI SAVINIKAS AR KITI ASMENYS INOJO APIE TOKI NUOSTOLI GALIMYB. + + +KOPIJAVIMO, PLATINIMO IR MODIFIKAVIMO SLYG PABAIGA +Kaip taikyti ias slygas savo naujoms programoms +Jeigu Js sukrte nauj program ir norite, kad ji bt kuo naudingesn isuomenei, geriausias bdas iam tikslui pasiekti yra padaryti j laisva programa, kuri kiekvienas gali platinti ir keisti pagal mintas slygas. + +Nordami pasiekti tiksl, prie programos prijunkite emiau esanius spjimus. Saugiausia informuojant apie garantijos nebuvim spjimus dti kiekvieno ieities tekst failo pradioje. Kiekvienas failas turi praneim. + + Viena eilut praneti programos autoriaus vardui ir k ta programa daro + + Copyright (C) metai autoriaus vardas + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Aukiau esani anglik praneim vertimai (vertimai tik paintiniai. Savo programoms taikykite anglikas versijas): + + i programa yra laisva. Js galite j platinti ir/arba modifikuoti + remdamiesi Free Software Foundation paskelbtomis GNU Bendrosios + Vieosios licencijos slygomis: 2 licencijos versija, arba (savo + nuoira) bet kuria vlesne versija. + + i programa platinama su viltimi, kad ji bus naudinga, bet BE JOKIOS + GARANTIJOS; be jokios numanomos PERKAMUMO ar TINKAMUMO KONKRETIEMS + TIKSLAMS garantijos. irkite GNU Bendrj Viej licencij nordami + suinoti smulkmenas. + + Js turjote kartu su ia programa gauti ir GNU Bendrosios Vieosios + licencjos kopija; jei ne - raykite Free Software Foundation, Inc., 59 + Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Taip pat pateikite informacij, kaip su jumis susisiekti elektroniniu ar paprastu patu. + +Jeigu programa interaktyvi (bendrauja su vartotoju), padarykite, kad startuodama interaktyviu reimu ji ivest pana praneim: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details + type `show w'. This is free software, and you are welcome + to redistribute it under certain conditions; type `show c' + for details. + +Vertimas: + + Gnomovizijos 69 versija, Copyright (C) metai autoriaus vardas + Gnomovizija pateikiama VISIKAI BE JOKIOS GARANTIJOS; smulkmenoms + surinkite 'show w'. i programa yra laisva programin ranga ir + jos platinimas yra sveikintinas laikantis tam tikr slyg; surinkite + 'show c' parodyti smulkmenoms. + +Hipotetins komandos 'show w' ir 'show c' turt parodyti atitinkamas Bendrosios vieosios licencijos dalis. inoma, Js komandos gali vadintis kitaip nei 'show w' ir 'show c'. Jos netgi gali bti pels spragteljimai ar meniu punktai - kas labiau tinka Js programai. + +Jei btina, Js taip pat turtumte gauti savo darbdavio (jei dirbate programuotoju) ar savo mokyklos (jei mokots) autorini teisi program atsisakym. ia pavyzdys; pakeiskite tik vardus: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + +Vertimas: + + AB "Netvarka" atsisako vis autorini teisi program 'Gnomovizija', + parayt Jono Programiiaus. + + M.A. Gnato paraas, 1989 m. balandio 1 d. + M.A. Gnatas, vyc prezidentas + + +i Bendroji Vieoji licenzija nedraudia traukti Js program privaias, patentuotas programas. Jeigu Js programa yra paprogramin biblioteka, Js galite manyti, kad bus naudingiau udrausti patentuotas programas susieti su Js biblioteka. Jei tai yra kaip tik tai, k Js norite padaryti, tai naudokite GNU Library General Public License (GNU Bibliotekin Bendrj Viej licenzij) vietoj ios licenzijos. + + +-------------------------------------------------------------------------------- + +This is an unofficial translation of the GNU General Public License into Lithuanian. It was not published by the Free Software Foundation, and does not legally state the distribution terms for software that uses the GNU GPL--only the original English text of the GNU GPL does that. However, we hope that this translation will help Lithuanian language speakers understand the GNU GPL better. + +is dokumentas yra neoficialus GNU General Public License vertimas lietuvi kalb. Jis nra platinamas Free Software Foundation organizacijos ir neturi jokios juridins galios - tik originalus angl kalba paraytas tekstas yra teisinis dokumentas, nusakantis GNU GPL slygas. Mes viliams, kad is vertimas pads lietuvikai kalbantiems monms geriau suprasti GNU GPL. + + +-------------------------------------------------------------------------------- + +Ivert VU MIF studentas VDD (Vytautas Dvaronaitis). + +Tais Aist Kesminait. + + +-------------------------------------------------------------------------------- +GNU antratinis puslapis. +Klausimus FSF ir GNU sisti gnu@gnu.org. Kiti bdai susisiekti su FSF. + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA \ No newline at end of file diff --git a/license/license-PT_BR.txt b/license/license-PT_BR.txt new file mode 100644 index 0000000..f73ace6 --- /dev/null +++ b/license/license-PT_BR.txt @@ -0,0 +1,379 @@ + LICENA PBLICA GERAL GNU + Verso 2, junho de 1991 + + This is an unofficial translation of the GNU General Public License + into Brazilian Portuguese. It was not published by the Free Software + Foundation, and does not legally state the distribution terms for + software that uses the GNU GPL -- only the original English text of + the GNU GPL does that. However, we hope that this translation will + help Brazilian Portuguese speakers understand the GNU GPL better. + + Esta uma traduo no-oficial da Licena Pblica Geral GNU ("GPL + GNU") para o portugus do Brasil. Ela no foi publicada pela Free +Software Foundation, e legalmente no afirma os termos de distribuio + de software que utiliza a GPL GNU -- apenas o texto original da GPL + GNU, em ingls, faz isso. Contudo, esperamos que esta traduo ajude + aos que utilizam o portugus do Brasil a entender melhor a GPL GNU. + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, + Cambridge, MA 02139, USA + +A qualquer pessoa permitido copiar e distribuir cpias desse +documento de licena, desde que sem qualquer alterao. + + Introduo + + As licenas de muitos software so desenvolvidas para restringir sua +liberdade de compartilh-lo e mud-lo. Contrria a isso, a Licena +Pblica Geral GNU pretende garantir sua liberdade de compartilhar e +alterar software livres -- garantindo que o software ser livre e +gratuito para os seus usurios. Esta Licena Pblica Geral aplica-se +maioria dos software da Free Software Foundation e a qualquer outro +programa cujo autor decida aplic-la. (Alguns outros software da FSF +so cobertos pela Licena Pblica Geral de Bibliotecas, no entanto.) +Voc pode aplic-la tambm aos seus programas. + + Quando nos referimos a software livre, estamos nos referindo a +liberdade e no a preo. Nossa Licena Pblica Geral foi desenvolvida +para garantir que voc tenha a liberdade de distribuir cpias de +software livre (e cobrar por isso, se quiser); que voc receba o +cdigo-fonte ou tenha acesso a ele, se quiser; que voc possa mudar o +software ou utilizar partes dele em novos programas livres e +gratuitos; e que voc saiba que pode fazer tudo isso. + + Para proteger seus direitos, precisamos fazer restries que impeam +a qualquer um negar estes direitos ou solicitar que voc deles +abdique. Estas restries traduzem-se em certas responsabilidades para +voc, se voc for distribuir cpias do software ou modific-lo. + + Por exemplo, se voc distribuir cpias de um programa, gratuitamente +ou por alguma quantia, voc tem que fornecer aos recebedores todos os +direitos que voc possui. Voc tem que garantir que eles tambm +recebam ou possam obter o cdigo-fonte. E voc tem que mostrar-lhes +estes termos para que eles possam conhecer seus direitos. + + Ns protegemos seus direitos em dois passos: (1) com copyright do +software e (2) com a oferta desta licena, que lhe d permisso legal +para copiar, distribuir e/ou modificar o software. + + Alm disso, tanto para a proteo do autor quanto a nossa, +gostaramos de certificar-nos que todos entendam que no h qualquer +garantia nestes software livres. Se o software modificado por algum +mais e passado adiante, queremos que seus recebedores saibam que o que +eles obtiveram no original, de forma que qualquer problema +introduzido por terceiros no interfira na reputao do autor +original. + + Finalmente, qualquer programa ameaado constantemente por patentes +de software. Queremos evitar o perigo de que distribuidores de +software livre obtenham patentes individuais, o que tem o efeito de +tornar o programa proprietrio. Para prevenir isso, deixamos claro que +qualquer patente tem que ser licenciada para uso livre e gratuito por +qualquer pessoa, ou ento que nem necessite ser licenciada. + + Os termos e condies precisas para cpia, distribuio e +modificao se encontram abaixo: + + LICENA PBLICA GERAL GNU + TERMOS E CONDIES PARA CPIA, DISTRIBUIO E MODIFICAO + + 0. Esta licena se aplica a qualquer programa ou outro trabalho que +contenha um aviso colocado pelo detentor dos direitos autorais +informando que aquele pode ser distribudo sob as condies desta +Licena Pblica Geral. O "Programa" abaixo refere-se a qualquer +programa ou trabalho, e "trabalho baseado no Programa" significa tanto +o Programa em si como quaisquer trabalhos derivados, de acordo com a +lei de direitos autorais: isto quer dizer um trabalho que contenha o +Programa ou parte dele, tanto originalmente ou com modificaes, e/ou +traduo para outros idiomas. (Doravante o processo de traduo est +includo sem limites no termo "modificao".) Cada licenciado +mencionado como "voc". + +Atividades outras que a cpia, a distribuio e modificao no esto +cobertas por esta Licena; elas esto fora de seu escopo. O ato de +executar o Programa no restringido e o resultado do Programa +coberto apenas se seu contedo contenha trabalhos baseados no Programa +(independentemente de terem sido gerados pela execuo do +Programa). Se isso verdadeiro depende do que o programa faz. + + 1. Voc pode copiar e distribuir cpias fiis do cdigo-fonte do +Programa da mesma forma que voc o recebeu, usando qualquer meio, +deste que voc conspcua e apropriadamente publique em cada cpia um +aviso de direitos autorais e uma declarao de inexistncia de +garantias; mantenha intactas todos os avisos que se referem a esta +Licena e ausncia total de garantias; e fornea a outros +recebedores do Programa uma cpia desta Licena, junto com o Programa. + + 2. Voc pode modificar sua cpia ou cpias do Programa, ou qualquer +parte dele, assim gerando um trabalho baseado no Programa, e copiar e +distribuir essas modificaes ou trabalhos sob os temos da seo 1 +acima, desde que voc tambm se enquadre em todas estas condies: + + a) Voc tem que fazer com que os arquivos modificados levem avisos + proeminentes afirmando que voc alterou os arquivos, incluindo a + data de qualquer alterao. + + b) Voc tem que fazer com que quaisquer trabalhos que voc + distribua ou publique, e que integralmente ou em partes contenham + ou sejam derivados do Programa ou de suas partes, sejam + licenciados, integralmente e sem custo algum para quaisquer + terceiros, sob os termos desta Licena. + + c) Se qualquer programa modificado normalmente l comandos + interativamente quando executados, voc tem que fazer com que, + quando iniciado tal uso interativo da forma mais simples, seja + impresso ou mostrado um anncio de que no h qualquer garantia + (ou ento que voc fornece a garantia) e que os usurios podem + redistribuir o programa sob estas condies, ainda informando os + usurios como consultar uma cpia desta Licena. (Exceo: se o + Programa em si interativo mas normalmente no imprime estes + tipos de anncios, seu trabalho baseado no Programa no precisa + imprimir um anncio.) + +Estas exigncias aplicam-se ao trabalho modificado como um todo. Se +sees identificveis de tal trabalho no so derivadas do Programa, e +podem ser razoavelmente consideradas trabalhos independentes e +separados por si s, ento esta Licena, e seus termos, no se aplicam +a estas sees quando voc distribui-las como trabalhos em +separado. Mas quando voc distribuir as mesmas sees como parte de um +todo que trabalho baseado no Programa, a distribuio como um todo +tem que se enquadrar nos termos desta Licena, cujas permisses para +outros licenciados se estendem ao todo, portanto tambm para cada e +toda parte independente de quem a escreveu. + +Desta forma, esta seo no tem a inteno de reclamar direitos os +contestar seus direitos sobre o trabalho escrito completamente por +voc; ao invs disso, a inteno a de exercitar o direito de +controlar a distribuio de trabalhos, derivados ou coletivos, +baseados no Programa. + +Adicionalmente, a mera adio ao Programa de outro trabalho no +baseado no Programa (ou de trabalho baseado no Programa) em um volume +de armazenamento ou meio de distribuio no faz o outro trabalho +parte do escopo desta Licena. + + 3. Voc pode copiar e distribuir o Programa (ou trabalho baseado +nele, conforme descrito na Seo 2) em cdigo-objeto ou em forma +executvel sob os termos das Sees 1 e 2 acima, desde que voc +faa um dos seguintes: + + a) O acompanhe com o cdigo-fonte completo e em forma acessvel + por mquinas, que tem que ser distribudo sob os termos das Sees + 1 e 2 acima e em meio normalmente utilizado para o intercmbio de + software; ou, + + b) O acompanhe com uma oferta escrita, vlida por pelo menos trs + anos, de fornecer a qualquer um, com um custo no superior ao + custo de distribuio fsica do material, uma cpia do + cdigo-fonte completo e em forma acessvel por mquinas, que tem + que ser distribudo sob os termos das Sees 1 e 2 acima e em meio + normalmente utilizado para o intercmbio de software; ou, + + c) O acompanhe com a informao que voc recebeu em relao + oferta de distribuio do cdigo-fonte correspondente. (Esta + alternativa permitida somente em distribuio no comerciais, e + apenas se voc recebeu o programa em forma de cdigo-objeto ou + executvel, com oferta de acordo com a Subseo b acima.) + +O cdigo-fonte de um trabalho corresponde forma de trabalho +preferida para se fazer modificaes. Para um trabalho em forma +executvel, o cdigo-fonte completo significa todo o cdigo-fonte de +todos os mdulos que ele contm, mais quaisquer arquivos de definio +de "interface", mais os "scripts" utilizados para se controlar a +compilao e a instalao do executvel. Contudo, como exceo +especial, o cdigo-fonte distribudo no precisa incluir qualquer +componente normalmente distribudo (tanto em forma original quanto +binria) com os maiores componentes (o compilador, o "kernel" etc.) do +sistema operacional sob o qual o executvel funciona, a menos que o +componente em si acompanhe o executvel. + +Se a distribuio do executvel ou cdigo-objeto feita atravs da +oferta de acesso a cpias de algum lugar, ento ofertar o acesso +equivalente a cpia, do mesmo lugar, do cdigo-fonte equivale +distribuio do cdigo-fonte, mesmo que terceiros no sejam compelidos +a copiar o cdigo-fonte com o cdigo-objeto. + + 4. Voc no pode copiar, modificar, sub-licenciar ou distribuir o +Programa, exceto de acordo com as condies expressas nesta +Licena. Qualquer outra tentativa de cpia, modificao, +sub-licenciamento ou distribuio do Programa no valida, e +cancelar automaticamente os direitos que lhe foram fornecidos por +esta Licena. No entanto, terceiros que de voc receberam cpias ou +direitos, fornecidos sob os termos desta Licena, no tero suas +licenas terminadas, desde que permaneam em total concordncia com +ela. + + 5. Voc no obrigado a aceitar esta Licena j que no a +assinou. No entanto, nada mais o dar permisso para modificar ou +distribuir o Programa ou trabalhos derivados deste. Estas aes so +proibidas por lei, caso voc no aceite esta Licena. Desta forma, ao +modificar ou distribuir o Programa (ou qualquer trabalho derivado do +Programa), voc estar indicando sua total aceitao desta Licena +para faz-los, e todos os seus termos e condies para copiar, +distribuir ou modificar o Programa, ou trabalhos baseados nele. + + 6. Cada vez que voc redistribuir o Programa (ou qualquer trabalho +baseado nele), os recebedores adquiriro automaticamente do +licenciador original uma licena para copiar, distribuir ou modificar +o Programa, sujeitos a estes termos e condies. Voc no poder impor +aos recebedores qualquer outra restrio ao exerccio dos direitos +ento adquiridos. Voc no responsvel em garantir a concordncia de +terceiros a esta Licena. + + 7. Se, em conseqncia de decises judiciais ou alegaes de +infringimento de patentes ou quaisquer outras razes (no limitadas a +assuntos relacionados a patentes), condies forem impostas a voc +(por ordem judicial, acordos ou outras formas) e que contradigam as +condies desta Licena, elas no o livram das condies desta +Licena. Se voc no puder distribuir de forma a satisfazer +simultaneamente suas obrigaes para com esta Licena e para com as +outras obrigaes pertinentes, ento como conseqncia voc no poder +distribuir o Programa. Por exemplo, se uma licena de patente no +permitir a redistribuio, livre de "royalties", do Programa, por +todos aqueles que receberem cpias direta ou indiretamente de voc, +ento a nica forma de voc satisfazer a ela e a esta Licena seria a +de desistir completamente de distribuir o Programa. + +Se qualquer parte desta seo for considerada invlida ou no +aplicvel em qualquer circunstncia particular, o restante da seo se +aplica, e a seo como um todo se aplica em outras circunstncias. + +O propsito desta seo no o de induzi-lo a infringir quaisquer +patentes ou reivindicao de direitos de propriedade outros, ou a +contestar a validade de quaisquer dessas reivindicaes; esta seo +tem como nico propsito proteger a integridade dos sistemas de +distribuio de software livres, o que implementado pela prtica de +licenas pblicas. Vrias pessoas tm contribudo generosamente e em +grande escala para os software distribudos usando este sistema, na +certeza de que sua aplicao feita de forma consistente; fica a +critrio do autor/doador decidir se ele ou ela est disposto a +distribuir software utilizando outro sistema, e um licenciado no pode +impor qualquer escolha. + +Esta seo destina-se a tornar bastante claro o que se acredita ser +conseqncia do restante desta Licena. + + 8. Se a distribuio e/ou uso do Programa so restringidos em certos +pases por patentes ou direitos autorais, o detentor dos direitos +autorais original, e que colocou o Programa sob esta Licena, pode +incluir uma limitao geogrfica de distribuio, excluindo aqueles +pases de forma a tornar a distribuio permitida apenas naqueles ou +entre aqueles pases ento no excludos. Nestes casos, esta Licena +incorpora a limitao como se a mesma constasse escrita nesta Licena. + + 9. A Free Software Foundation pode publicar verses revisadas e/ou +novas da Licena Pblica Geral de tempos em tempos. Estas novas +verses sero similares em esprito verso atual, mas podem diferir +em detalhes que resolvem novos problemas ou situaes. + +A cada verso dada um nmero distinto. Se o Programa especifica um +nmero de verso especfico desta Licena que se aplica a ele e a +"qualquer nova verso", voc tem a opo de aceitar os termos e +condies daquela verso ou de qualquer outra verso publicada pela +Free Software Foundation. Se o programa no especifica um nmero de +verso desta Licena, voc pode escolher qualquer verso j publicada +pela Free Software Foundation. + + 10. Se voc pretende incorporar partes do Programa em outros +programas livres cujas condies de distribuio so diferentes, +escreva ao autor e solicite permisso. Para o software que a Free +Software Foundation detm direitos autorais, escreva Free Software +Foundation; s vezes ns permitimos excees a este caso. Nossa +deciso ser guiada pelos dois objetivos de preservar a condio de +liberdade de todas as derivaes do nosso software livre, e de +promover o compartilhamento e reutilizao de software em aspectos +gerais. + + AUSNCIA DE GARANTIAS + + 11. UMA VEZ QUE O PROGRAMA LICENCIADO SEM NUS, NO H QUALQUER +GARANTIA PARA O PROGRAMA, NA EXTENSO PERMITIDA PELAS LEIS +APLICVEIS. EXCETO QUANDO EXPRESSADO DE FORMA ESCRITA, OS DETENTORES +DOS DIREITOS AUTORAIS E/OU TERCEIROS DISPONIBILIZAM O PROGRAMA "NO +ESTADO", SEM QUALQUER TIPO DE GARANTIAS, EXPRESSAS OU IMPLCITAS, +INCLUINDO, MAS NO LIMITADO A, AS GARANTIAS IMPLCITAS DE +COMERCIALIZAO E AS DE ADEQUAO A QUALQUER PROPSITO. O RISCO TOTAL +COM A QUALIDADE E DESEMPENHO DO PROGRAMA SEU. SE O PROGRAMA SE +MOSTRAR DEFEITUOSO, VOC ASSUME OS CUSTOS DE TODAS AS MANUTENES, +REPAROS E CORREES. + + 12. EM NENHUMA OCASIO, A MENOS QUE EXIGIDO PELAS LEIS APLICVEIS OU +ACORDO ESCRITO, OS DETENTORES DOS DIREITOS AUTORAIS, OU QUALQUER OUTRA +PARTE QUE POSSA MODIFICAR E/OU REDISTRIBUIR O PROGRAMA CONFORME +PERMITIDO ACIMA, SERO RESPONSABILIZADOS POR VOC POR DANOS, INCLUINDO +QUALQUER DANO EM GERAL, ESPECIAL, ACIDENTAL OU CONSEQENTE, +RESULTANTES DO USO OU INCAPACIDADE DE USO DO PROGRAMA (INCLUINDO, MAS +NO LIMITADO A, A PERDA DE DADOS OU DADOS TORNADOS INCORRETOS, OU +PERDAS SOFRIDAS POR VOC OU POR OUTRAS PARTES, OU FALHAS DO PROGRAMA +AO OPERAR COM QUALQUER OUTRO PROGRAMA), MESMO QUE TAL DETENTOR OU +PARTE TENHAM SIDO AVISADOS DA POSSIBILIDADE DE TAIS DANOS. + + FIM DOS TERMOS E CONDIES + + Como Aplicar Estes Termos aos Seus Novos Programas + + Se voc desenvolver um novo programa, e quer que ele seja utilizado +amplamente pelo pblico, a melhor forma de alcanar este objetivo +torn-lo software livre que qualquer um pode redistribuir e alterar, +sob estes termos. + + Para isso, anexe os seguintes avisos ao programa. mais seguro +anex-los logo no incio de cada arquivo-fonte para reforarem mais +efetivamente a inexistncia de garantias; e cada arquivo deve possuir +pelo menos a linha de "copyright" e uma indicao de onde o texto +completo se encontra. + + + Copyright (C) + + Este programa software livre; voc pode redistribu-lo e/ou + modific-lo sob os termos da Licena Pblica Geral GNU, conforme + publicada pela Free Software Foundation; tanto a verso 2 da + Licena como (a seu critrio) qualquer verso mais nova. + + Este programa distribudo na expectativa de ser til, mas SEM + QUALQUER GARANTIA; sem mesmo a garantia implcita de + COMERCIALIZAO ou de ADEQUAO A QUALQUER PROPSITO EM + PARTICULAR. Consulte a Licena Pblica Geral GNU para obter mais + detalhes. + + Voc deve ter recebido uma cpia da Licena Pblica Geral GNU + junto com este programa; se no, escreva para a Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307, USA. + +Inclua tambm informaes sobre como contact-lo eletronicamente e por +carta. + +Se o programa interativo, faa-o mostrar um aviso breve como este, +ao iniciar um modo interativo: + + Gnomovision verso 69, Copyright (C) ano nome do autor + O Gnomovision no possui QUALQUER GARANTIA; para obter mais + detalhes digite `show w'. Ele software livre e voc est + convidado a redistribui-lo sob certas condies; digite `show c' + para obter detalhes. + +Os comandos hipotticos `show w' e `show c' devem mostrar as partes +apropriadas da Licena Pblica Geral. Claro, os comandos que voc usar +podem ser ativados de outra forma que `show w' e `show c'; eles podem +at ser cliques do mouse ou itens de um menu -- o que melhor se +adequar ao programa. + +Voc tambm deve obter do seu empregador (se voc trabalha como +programador) ou escola, se houver, uma "declarao de ausncia de +direitos autorais" sobre o programa, se necessrio. Aqui est um +exemplo; altere os nomes: + + Yoyodyne, Inc., aqui declara a ausncia de quaisquer direitos + autorais sobre o programa `Gnomovision' (que executa interpretaes + em compiladores) escrito por James Hacker. + + , 1o. de abril de 1989 + Ty Con, Vice-presidente + +Esta Licena Pblica Geral no permite incorporar seu programa em +programas proprietrios. Se seu programa uma biblioteca de +sub-rotinas, voc deve considerar mais til permitir ligar aplicaes +proprietrias com a biblioteca. Se isto o que voc deseja, use a +Licena Pblica Geral de Bibliotecas GNU, ao invs desta Licena. diff --git a/license/license-PT_PT.txt b/license/license-PT_PT.txt new file mode 100644 index 0000000..03d3461 --- /dev/null +++ b/license/license-PT_PT.txt @@ -0,0 +1,378 @@ +LICENA PBLICA GERAL GNU +Verso 2, junho de 1991 + + This is an unofficial translation of the GNU General Public License into + Portuguese. It was not published by the Free Software Foundation, and does not + legally state the distribution terms for software that uses the GNU GPL -- only + the original English text of the GNU GPL does that. However, we hope that this + translation will help Portuguese speakers understand the GNU GPL better. + + Esta uma traduo no-oficial da Licena Pblica Geral GNU ("GPL GNU") para + Portugus. No foi publicada pela Free Software Foundation, e legalmente no + afirma os termos de distribuio de software que utilize a GPL GNU -- apenas o + texto original da GPL GNU, em ingls, faz isso. Contudo, esperamos que esta + traduo ajude aos que falam portugus a entender melhor a GPL GNU. + +Para sugestes ou correces a esta traduo, contacte: + +miguel.andrade@neoscopio.com + + +--- Traduo do documento original a partir desta linha --- + + +LICENA PBLICA GERAL GNU +Verso 2, junho de 1991 + + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, + Cambridge, MA 02139, USA + + A qualquer pessoa permitido copiar e distribuir cpias deste documento de + licena, desde que sem qualquer alterao. + +Introduo + + As licenas de software so normalmente desenvolvidas para restringir a + liberdade de compartilh-lo e modifica-lo. Pelo contrrio, a Licena Pblica + Geral GNU pretende garantir a sua liberdade de compartilhar e modificar o + software livre -- garantindo que o software ser livre para os seus + utilizadores. Esta Licena Pblica Geral aplica-se maioria do software da + Free Software Foundation e a qualquer outro programa ao qual o seu autor decida + aplic-la. (Algum software da FSF cobertos pela Licena Pblica Geral de + Bibliotecas.) Tambm poder aplic-la aos seus programas. + + Quando nos referimos a software livre, estamo-nos a referir liberdade e no + ao preo. A Licena Pblica Geral (GPL - General Public Licence - em Ingls.) + foi desenvolvida para garantir a sua liberdade de distribuir cpias de software + livre (e cobrar por isso, se quiser); receber o cdigo-fonte ou ter acesso a + ele, se quiser; poder modificar o software ou utilizar partes dele em novos + programas livres; e que saiba que est no seu direito de o fazer. + + Para proteger seus direitos, precisamos fazer restries que impeam a qualquer + um negar estes direitos ou solicitar que voc abdique deles. Estas restries + traduzem-se em certas responsabilidades para si, caso venha a distribuir cpias + do software, ou modific-lo. + + Por exemplo, se voc distribuir cpias de um programa sobre este tipo de + licenciamento, gratuitamente ou por alguma quantia, tem que fornecer igualmente + todos os direitos que possui sobre ele. Tem igualmente que garantir que os + destinatrios recebam ou possam obter o cdigo-fonte. Alm disto, tem que + fornecer-lhes estes termos para que possam conhecer seus direitos. + + Ns protegemos seus direitos por duas formas que se completam: (1) com + copyright do software e (2) com a oferta desta licena, que lhe d permisso + legal para copiar, distribuir e/ou modificar o software. + + Alm disso, tanto para a proteco do autor quanto a nossa, gostaramos de + certificar-nos de que todos entendam que no h qualquer garantia sobre o + software livre. Se o software modificado por algum e redistribudo, queremos + que seus destinatrios saibam que o que eles obtiveram no original, de forma + que qualquer problema introduzido por terceiros no interfira na reputao do + autor original. + + Finalmente, qualquer programa ameaado constantemente por patentes de + software. Queremos evitar o perigo de que distribuidores de software livre + obtenham patentes individuais sobre o software, o que teria o efeito de tornar + o software proprietrio. Para prevenir isso, deixamos claro que qualquer + patente tem que ser licenciada para uso livre e gratuito por qualquer pessoa, + ou ento que nem necessite ser licenciada. + + Os termos e condies precisas para cpia, distribuio e modificao + encontram-se abaixo: + +LICENA PBLICA GERAL GNU TERMOS E CONDIES PARA CPIA, DISTRIBUIO E +MODIFICAO + + 0. Esta licena aplica-se a qualquer programa ou outro trabalho que contenha um + aviso colocado pelo detentor dos direitos autorais informando que aquele pode + ser distribudo sob as condies desta Licena Pblica Geral. O "Programa" + abaixo refere-se a qualquer programa ou trabalho e "trabalho baseado no + Programa" significa tanto o Programa em si, como quaisquer trabalhos derivados, + de acordo com a lei de direitos de autor: isto quer dizer um trabalho que + contenha o Programa ou parte dele, tanto na forma original ou modificado, e/ou + traduo para outros idiomas. ***(Doravante o termo "modificao" ou sinnimos + sero usados livremente.) *** Cada licenciado mencionado como "voc". + + Actividades outras que a cpia, a distribuio e modificao no esto cobertas + por esta Licena; elas esto fora do seu mbito. O acto de executar o Programa + no restringido e o resultado do Programa coberto pela licena apenas se o + seu contedo contenha trabalhos baseados no Programa (independentemente de + terem sido gerados pela execuo do Programa). Este ltimo ponto depende das + funcionalidades especficas de cada programa. + + 1. Voc pode copiar e distribuir cpias fiis do cdigo-fonte do Programa da + mesma forma que voc o recebeu, usando qualquer meio, deste que inclua em cada + cpia um aviso de direitos de autor e uma declarao de inexistncia de + garantias; mantenha intactos todos os avisos que se referem a esta Licena e + ausncia total de garantias; e fornea aos destinatrios do Programa uma cpia + desta Licena, em conjunto com o Programa. + + Voc pode cobrar pelo acto fsico de transferir uma cpia e pode, + opcionalmente, oferecer garantias em troca de pagamento. + + 2. Voc pode modificar sua cpia ou cpias do Programa, ou qualquer parte dele, + gerando assim um trabalho derivado, copiar e distribuir essas modificaes ou + trabalhos sob os termos da seco 1 acima, desde que se enquadre nas seguintes + condies: + + a) Os arquivos modificados devem conter avisos proeminentes afirmando que voc + alterou os arquivos, incluindo a data de qualquer alterao. + + b) Deve ser licenciado, sob os termos desta Licena, integralmente e sem custo + algum para terceiros, qualquer trabalho seu que contenha ou seja derivado do + Programa ou de parte dele. + + c) Se qualquer programa modificado, quando executado, l normalmente comandos + interactivamente, tem que fazer com que, quando iniciado o uso interactivo, + seja impresso ou mostrado um anncio de que no h qualquer garantia (ou ento + que voc fornece a garantia) e que os utilizadores podem redistribuir o + programa sob estas condies, ainda informando os utilizadores como consultar + uma cpia desta Licena. (Excepo: se o Programa em si interactivo mas + normalmente no imprime estes tipos de anncios, ento o seu trabalho derivado + no precisa imprimir um anncio.) + + Estas exigncias aplicam-se ao trabalho derivado como um todo. Se seces + identificveis de tal trabalho no so derivadas do Programa, e podem ser + razoavelmente consideradas trabalhos independentes e separados por si s, ento + esta Licena, e seus termos, no se aplicam a estas seces caso as distribua + como um trabalho separado. Mas se distribuir as mesmas seces como parte de um + todo que constitui trabalho derivado, a distribuio como um todo tem que + enquadrar-se nos termos desta Licena, cujos direitos para outros licenciados + se estendem ao todo, portanto tambm para toda e qualquer parte do programa, + independente de quem a escreveu. + + Desta forma, esta seco no tem a inteno de reclamar direitos ou contestar + seus direitos sobre o trabalho escrito completamente por si; ao invs disso, a + inteno a de exercitar o direito de controlar a distribuio de trabalhos, + derivados ou colectivos, baseados no Programa. + + Adicionalmente, a mera adio ao Programa (ou a um trabalho derivado deste) de + um outro trabalho num volume de armazenamento ou meio de distribuio no faz + esse outro trabalho seja includo no mbito desta Licena. + + 3. Voc pode copiar e distribuir o Programa (ou trabalho derivado, conforme + descrito na Seco 2) em cdigo-objecto ou em forma executvel sob os termos + das Seces 1 e 2 acima, desde que cumpra uma das seguintes alienas: + + a) O faa acompanhar com o cdigo-fonte completo e em forma acessvel por + mquinas, cdigo esse que tem que ser distribudo sob os termos das Seces 1 e + 2 acima e em meio normalmente utilizado para o intercmbio de software; ou, + + b) O acompanhe com uma oferta escrita, vlida por pelo menos trs anos, de + fornecer a qualquer um, com um custo no superior ao custo de distribuio + fsica do material, uma cpia do cdigo-fonte completo e em forma acessvel por + mquinas, cdigo esse que tem que ser distribudo sob os termos das Seces 1 + e 2 acima e em meio normalmente utilizado para o intercmbio de software; ou, + + c) O acompanhe com a informao que voc recebeu em relao oferta de + distribuio do cdigo-fonte correspondente. (Esta alternativa permitida + somente em distribuio no comerciais, e apenas se voc recebeu o programa em + forma de cdigo-objecto ou executvel, com uma oferta de acordo com a Subseco + b) acima.) + + O cdigo-fonte de um trabalho corresponde forma de trabalho preferida para se + fazer modificaes. Para um trabalho em forma executvel, o cdigo-fonte + completo significa todo o cdigo-fonte de todos os mdulos que ele contm, mais + quaisquer arquivos de definio de "interface", mais os "scripts" utilizados + para se controlar a compilao e a instalao do executvel. Contudo, como + excepo especial, o cdigo-fonte distribudo no precisa incluir qualquer + componente normalmente distribudo (tanto em forma original quanto binria) com + os maiores componentes (o compilador, o "kernel" etc.) do sistema operativo sob + o qual o executvel funciona, a menos que o componente em si acompanhe o + executvel. + + Se a distribuio do executvel ou cdigo-objecto feita atravs da oferta de + acesso a cpias em algum lugar, ento oferecer o acesso equivalente a cpia, no + mesmo lugar, do cdigo-fonte, equivale distribuio do cdigo-fonte, mesmo + que terceiros no sejam compelidos a copiar o cdigo-fonte em conjunto com o + cdigo-objecto. + + 4. Voc no pode copiar, modificar, sublicenciar ou distribuir o Programa, + excepto de acordo com as condies expressas nesta Licena. Qualquer outra + tentativa de cpia, modificao, sublicenciamento ou distribuio do Programa + no valida, e cancelar automaticamente os direitos que lhe foram fornecidos + por esta Licena. No entanto, terceiros que receberam de si cpias ou direitos, + fornecidos sob os termos desta Licena, no tero a sua licena terminada, + desde que permaneam em total concordncia com ela. + + 5. Voc no obrigado a aceitar esta Licena j que no a assinou. No entanto, + nada mais lhe dar permisso para modificar ou distribuir o Programa ou + trabalhos derivados deste. Estas aces so proibidas por lei, caso voc no + aceite esta Licena. Desta forma, ao modificar ou distribuir o Programa (ou + qualquer trabalho derivado do Programa), voc estar a indicar a sua total + concordncia com os termos desta Licena, nomeadamente os termos e condies + para copiar, distribuir ou modificar o Programa, ou trabalhos baseados nele. + + 6. Cada vez que redistribuir o Programa (ou qualquer trabalho derivado), os + destinatrios adquiriro automaticamente do autor original uma licena para + copiar, distribuir ou modificar o Programa, sujeitos a estes termos e + condies. Voc no poder impor aos destinatrios qualquer outra restrio ao + exerccio dos direitos ento adquiridos. Voc no responsvel em garantir a + concordncia de terceiros a esta Licena. + + 7. Se, em consequncia de decises judiciais ou alegaes de violao de + patentes ou quaisquer outras razes (no limitadas a assuntos relacionados a + patentes), lhe forem impostas condies (por ordem judicial, acordos ou outras + formas) e que contradigam as condies desta Licena, elas no o livram das + condies desta Licena. Se no puder distribuir de forma a satisfazer + simultaneamente suas obrigaes para com esta Licena e para com as outras + obrigaes pertinentes, ento como consequncia voc no poder distribuir o + Programa. Por exemplo, se uma licena de patente no permitir a redistribuio, + sem obrigao ao pagamento de "royalties", por todos aqueles que receberem + cpias directa ou indirectamente de si, ento a nica forma de voc satisfazer + a licena de patente e a esta Licena seria a de desistir completamente de + distribuir o Programa. + + Se qualquer parte desta seco for considerada invlida ou no aplicvel em + qualquer circunstncia particular, o restante da seco aplica-se, e a seco + como um todo aplicar-se- em outras circunstncias. + + O propsito desta seco no o de induzi-lo a infringir quaisquer patentes ou + reivindicao de direitos de propriedade de outros, ou a contestar a validade + de quaisquer dessas reivindicaes; esta seco tem como nico propsito + proteger a integridade dos sistemas de distribuio de software livre, que + implementado pela prtica de licenas pblicas. Vrias pessoas tm contribudo + generosamente e em grande escala para software distribudo usando este sistema, + na certeza de que sua aplicao feita de forma consistente; fica a critrio + do autor/doador decidir se ele ou ela est disposto(a) a distribuir software + utilizando outro sistema, e um outro detentor de uma licena no pode impor + esta ou qualquer outra escolha. + + Esta seco destina-se a tornar bastante claro o que se acredita ser + consequncia do restante desta Licena. + + 8. Se a distribuio e/ou uso do Programa so restringidos em certos pases por + patentes ou direitos de autor, o detentor dos direitos de autor original, que + colocou o Programa sob esta Licena, pode incluir uma limitao geogrfica de + distribuio, excluindo aqueles pases, de forma a apenas permitir a + distribuio nos pases no excludos. Nestes casos, esta Licena incorpora a + limitao como se a mesma constasse escrita nesta Licena. + + 9. A Free Software Foundation pode publicar verses revistas e/ou novas da + Licena Pblica Geral de tempos em tempos. Estas novas verses sero similares + em esprito verso actual, mas podem diferir em detalhes que resolvam novos + problemas ou situaes. + + A cada verso dada um nmero distinto. Se o Programa especifica um nmero de + verso especfico desta Licena que se aplica a ele e a "qualquer nova verso", + voc tem a opo de aceitar os termos e condies daquela verso ou de qualquer + outra verso posterior publicada pela Free Software Foundation. Se o programa + no especificar um nmero de verso desta Licena, poder escolher qualquer + verso publicada pela Free Software Foundation. + + 10. Se voc pretende incorporar partes do Programa em outros programas livres + cujas condies de distribuio sejam diferentes, escreva ao autor e solicite + permisso para tal. Para o software que a Free Software Foundation detm + direitos de autor, escreva Free Software Foundation; s vezes ns permitimos + excepes para estes casos. A nossa deciso ser guiada por dois objectivos: o + de preservar a condio de liberdade de todas os trabalhos derivados do nosso + software livre, e o de promover a partilha e reutilizao de software de um + modo geral. + + +AUSNCIA DE GARANTIAS + + 11. UMA VEZ QUE O PROGRAMA LICENCIADO SEM NUS, NO H QUALQUER GARANTIA PARA + O PROGRAMA, NA EXTENSO PERMITIDA PELAS LEIS APLICVEIS. EXCEPTO QUANDO + EXPRESSO DE FORMA ESCRITA, OS DETENTORES DOS DIREITOS AUTORAIS E/OU TERCEIROS + DISPONIBILIZAM O PROGRAMA "COMO ESTA", SEM QUALQUER TIPO DE GARANTIAS, + EXPRESSAS OU IMPLCITAS, INCLUINDO, MAS NO LIMITADO A, S GARANTIAS IMPLCITAS + DE COMERCIALIZAO E S DE ADEQUAO A QUALQUER PROPSITO. O RISCO COM A + QUALIDADE E DESEMPENHO DO PROGRAMA TOTALMENTE SEU. CASO O PROGRAMA SE REVELE + DEFEITUOSO, VOC ASSUME OS CUSTOS DE TODAS AS MANUTENES, REPAROS E CORRECES + QUE JULGUE NECESSRIAS. + + 12. EM NENHUMA CIRCUNSTNCIA, A MENOS QUE EXIGIDO PELAS LEIS APLICVEIS OU + ACORDO ESCRITO, OS DETENTORES DOS DIREITOS DE AUTOR, OU QUALQUER OUTRA PARTE + QUE POSSA MODIFICAR E/OU REDISTRIBUIR O PROGRAMA CONFORME PERMITIDO ACIMA, + SERO RESPONSABILIZADOS POR SI OU POR SEU INTERMDIO, POR DANOS, INCLUINDO + QUALQUER DANO EM GERAL, ESPECIAL, ACIDENTAL OU CONSEQUENTE, RESULTANTES DO USO + OU INCAPACIDADE DE USO DO PROGRAMA (INCLUINDO, MAS NO LIMITADO A, A PERDA DE + DADOS OU DADOS TORNADOS INCORRECTOS, OU PERDAS SOFRIDAS POR SI OU POR OUTRAS + PARTES, OU FALHAS DO PROGRAMA AO OPERAR COM QUALQUER OUTRO PROGRAMA), MESMO QUE + TAIS DETENTORES OU PARTES TENHAM SIDO AVISADOS DA POSSIBILIDADE DE TAIS DANOS. + +FIM DOS TERMOS E CONDIES + +--------------------- + + + +Como Aplicar Estes Termos aos Seus Novos Programas + + Se voc desenvolver um novo programa, e quer que ele seja utilizado amplamente + pelo pblico, a melhor forma de alcanar este objectivo torn-lo software + livre, software que qualquer um pode redistribuir e alterar, sob estes termos. + + Para tal, inclua os seguintes avisos no programa. mais seguro inclui-los logo + no incio de cada arquivo-fonte para reforar mais efectivamente a inexistncia + de garantias; e cada arquivo deve conter pelo menos a linha de "copyright" e + uma indicao sobre onde encontrar o texto completo da licena. + +Exemplo: + + + + Copyright (C) + + Este programa software livre; voc pode redistribu-lo e/ou modific-lo sob + os termos da Licena Pblica Geral GNU, conforme publicada pela Free Software + Foundation; tanto a verso 2 da Licena como (a seu critrio) qualquer verso + mais actual. + + Este programa distribudo na expectativa de ser til, mas SEM QUALQUER + GARANTIA; incluindo as garantias implcitas de COMERCIALIZAO ou de ADEQUAO + A QUALQUER PROPSITO EM PARTICULAR. Consulte a Licena Pblica Geral GNU para + obter mais detalhes. + + Voc deve ter recebido uma cpia da Licena Pblica Geral GNU em conjunto com + este programa; caso contrrio, escreva para a Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + + + + Inclua tambm informaes sobre como contact-lo electronicamente e por carta. + + Se o programa interactivo, faa-o mostrar um aviso breve como este, ao + iniciar um modo interactivo: + +Exemplo: + + + Gnomovision verso 69, Copyright (C) O Gnomovision no + possui QUALQUER GARANTIA; para obter mais detalhes escreva `mostrar g'. + software livre e voc est convidado a redistribui-lo sob certas condies; + digite `mostrar c' para obter detalhes. + + Os comandos hipotticos `mostrar g e `mostrar c' devem mostrar as partes + apropriadas da Licena Pblica Geral. claro que os comandos que escolher usar + podem ser activados de outra forma que `mostrar g' e `mostrar c'; podem ser + cliques do rato ou itens de um menu -- o que melhor se adequar ao seu programa. + + Voc tambm deve obter da sua entidade patronal (se trabalhar como + programador) ou escola, conforme o caso, uma "declarao de ausncia de + direitos autorais" sobre o programa, se necessrio. Aqui est um exemplo: + + + Neoscopio Lda., declara a ausncia de quaisquer direitos autorais sobre o + programa `Gnomovision' escrito por Jorge Andrade. + +10 de Junho de 2004 + , + +Miguel Nunes, Gerente de Neoscopio Lda. + + + + Esta Licena Pblica Geral no permite incorporar o seu programa em programas + proprietrios. Se o seu programa uma biblioteca de sub-rotinas, poder + considerar mais til permitir ligar aplicaes proprietrias com a biblioteca. + Se isto que pretende, use a Licena Pblica Geral de Bibliotecas GNU, em vez + desta Licena. + + + + + + diff --git a/license/license-RU.txt b/license/license-RU.txt new file mode 100644 index 0000000..6d24c05 --- /dev/null +++ b/license/license-RU.txt @@ -0,0 +1,505 @@ +GPL russian translation GENERAL PUBLIC LICENSE GNU + [ tiapkina@hotmail.com ], 20-Mar-2002 + +This is an unofficial translation of the GNU General Public License into +Russian. It was not published by the Free Software Foundation, and does not +legally state the distribution terms for software that uses the GNU GPL - only +the original English text of the GNU GPL does that. However, we hope that this +translation will help Russian speakers understand the GNU GPL better. + GNU + . Free Software Foundation + +, + GNU. , , + GNU . +, + GNU. + GNU GPL +http://www.gnu.org/copyleft/gpl.html + + + + + GNU + + , + + + + + +GNU GENERAL PUBLIC LICENSE + 2, 1991. +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + + . + + e + . + GNU, , + , .. + . + + Free Software Foundation, + . ( + Free Software Foundation + GNU ). + . + , , +. + + ( ), + , + + , , + . + , , + + . +, + . +, + , +, . + . + . + : (1) + (2) , + , / + . + , , + , , + . , + , , +, , + , + . +, , + [1]. , , + , + + . , , + + +. + , + . + , +0. + , , + + . "" + . ", + " + [2], .. +, , + , / . ( +, "" +). +"". + , + , . + . + , + , ( +, ). + , . +1. + , , + , : + ; + , +; + . + , + . +2. + . + , . + , , + 1 + : +) , , , + , ; +b) , + +, + , + - . + ; +c) + , + , : + ; + ( , + ); + , + , , + . (: + , + , , + , ). + , + , . + , + , + . + , + , + , , +, , , + , . + 2 +, . + , + , , . + , , + +, , + . +3. +, , + 2 , + ..1 2 + : +) + , +.. 1 2 , + , +b) + , + , + .. 1 2 + , +, +c) +, +. ( , + , + + , .b .3 +). + , + . + , + , , , + +. , , + , ( + ) (, ..) + , , + , +. + + + , + +, + . +4. , , + +. , , + + , + . , + +, . +5. , +. + , . + , + . + , + , + , , +, , + . +6. , +, + , + . +- . + +. +7. + , + , + , + , , + . + , + + . , + + , +, + . + + , + . + . + + +. + , + . + , + + . + . + . + 7 , + . +8. / + , + , +, , + , +, . + + . +9. Free Software Foundation / + . + , , + , , + . + . , + , .. , + , + , Free Software +Foundation. + , +- Free Software Foundation. +10. + , , + , + . , + Free Software Foundation, Free +Software Foundation. Free Software Foundation +. Free Software Foundation + : +, Free Software +Foundation + . + +11. , + , . + " ". + , / + , , , + , + , + . , , + . , +, , +, . +12. + , / , + / , + , , , + ( , +, , + ). / + + , +. + + + + + + , +, - , + + . + . + + , +. + , +. +[ ] + () , + + . + / 2 + + GNU, Free Software Foundation. + , , + , + . + + GNU. + + GNU. , Free +Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + , . + , , + : +Gnomovision version 69, , +Gnomovision ; + , "show w". + + GNU. +, "show c". + "show w" "show c" + . + "show w" "show c". +, + . + + (, + ..) , + + [3 ]. + , : + "" + "Gnomovision", +, + , . + , , 1 2001. +[, , ], + GNU +, . + , , + , +, . + GNU . + + + + +[1] - 7 + GNU (Software Patents). + 90 XX + , , +, . , + . + , + . , + , + , . + , 23.09.1992. + . + + . + , +, . + + + +[2] - . +[3] - " " + , + ( ), + . + ( ) + , (), + . + + , , + , , + . , , + + . , , + + . + .7 . 39 " " + + , + . + " " ( 22 +1996. 125-). + + + + +My goal was not just a verbal translation of English text of GNU General Public +License in Russian, but a translation, which will follow the rules of current +legislation of Russian Federation on copyrights. I hope that this will help to +use GNU General Public License when distributing free software in Russian +Federation. Below you may find some comments (in Russian) on current legislation +of Russian Federation. + GNU, + , + , + GPL + . + + . + , + +" " 23.09.1992. 3523-1 + " " 09.07.1993. 5351-1. + + GNU + , , +, : + - , + + , + (EULA), . +" " +" ". + , + () + , +, , + . + - + : ( +); : +, ( ); + ( ), +( ); , + ( ), + " ". + ( ) - + () + : , + ( ) , , + , , + , + " ". + - + , + . + () - , + . + - + , + , , , , + , . + , 2001. + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + diff --git a/license/license-SP.txt b/license/license-SP.txt new file mode 100644 index 0000000..5f01881 --- /dev/null +++ b/license/license-SP.txt @@ -0,0 +1,363 @@ +Licencia Pblica GNU +Esta es la conocida GNU Public License (GPL), versin 2 (de junio de 1.991), que +cubre la mayor parte del software de la Free Software Foundation, y muchos ms +programas. + +Los autores de esta traduccin son: + +Jess Gonzlez Barahona + +Pedro de las Heras Quirs + +NOTA IMPORTANTE: + +Esta es una traduccin no oficial al espaol de la GNU General Public License. +No ha sido publicada por la Free Software Foundation, y no establece legalmente +las condiciones de distribucin para el software que usa la GNU GPL. Estas +condiciones se establecen solamente por el texto original, en ingls, de la GNU +GPL. Sin embargo, esperamos que esta traduccin ayude a los hispanohablantes a +entender mejor la GNU GPL. + +IMPORTANT NOTICE: + +This is an unofficial translation of the GNU General Public License into +Spanish. It was not published by the Free Software Foundation, and does not +legally state the distribution terms for software that uses the GNU GPL--only +the original English text of the GNU GPL does that. However, we hope that this +translation will help Spanish speakers understand the GNU GPL better. + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. + +675 Mass Ave, Cambridge, MA 02139, EEUU + +Se permite la copia y distribucin de copias literales de este documento, pero +no se permite su modificacin. + +Prembulo +Las licencias que cubren la mayor parte del software estn diseadas para +quitarle a usted la libertad de compartirlo y modificarlo. Por el contrario, la +Licencia Pblica General de GNU pretende garantizarle la libertad de compartir y +modificar software libre, para asegurar que el software es libre para todos sus +usuarios. Esta Licencia Pblica General se aplica a la mayor parte del software +del la Free Software Foundation y a cualquier otro programa si sus autores se +comprometen a utilizarla. (Existe otro software de la Free Software Foundation +que est cubierto por la Licencia Pblica General de GNU para Bibliotecas). Si +quiere, tambin puede aplicarla a sus propios programas. + +Cuando hablamos de software libre, estamos refirindonos a libertad, no a +precio. Nuestras Licencias Pblicas Generales estn diseadas para asegurarnos +de que tenga la libertad de distribuir copias de software libre (y cobrar por +ese servicio si quiere), de que reciba el cdigo fuente o que pueda conseguirlo +si lo quiere, de que pueda modificar el software o usar fragmentos de l en +nuevos programas libres, y de que sepa que puede hacer todas estas cosas. + +Para proteger sus derechos necesitamos algunas restricciones que prohiban a +cualquiera negarle a usted estos derechos o pedirle que renuncie a ellos. Estas +restricciones se traducen en ciertas obligaciones que le afectan si distribuye +copias del software, o si lo modifica. + +Por ejemplo, si distribuye copias de uno de estos programas, sea gratuitamente, +o a cambio de una contraprestacin, debe dar a los receptores todos los derechos +que tiene. Debe asegurarse de que ellos tambin reciben, o pueden conseguir, el +cdigo fuente. Y debe mostrarles estas condiciones de forma que conozcan sus +derechos. + +Protegemos sus derechos con la combinacin de dos medidas: + +Ponemos el software bajo copyright y + +le ofrecemos esta licencia, que le da permiso legal para copiar, distribuir y/o +modificar el software. +Tambin, para la proteccin de cada autor y la nuestra propia, queremos +asegurarnos de que todo el mundo comprende que no se proporciona ninguna +garanta para este software libre. Si el software se modifica por cualquiera y +ste a su vez lo distribuye, queremos que sus receptores sepan que lo que tienen +no es el original, de forma que cualquier problema introducido por otros no +afecte a la reputacin de los autores originales. + +Por ltimo, cualquier programa libre est constantemente amenazado por patentes +sobre el software. Queremos evitar el peligro de que los redistribuidores de un +programa libre obtengan patentes por su cuenta, convirtiendo de facto el +programa en propietario. Para evitar esto, hemos dejado claro que cualquier +patente debe ser pedida para el uso libre de cualquiera, o no ser pedida. + +Los trminos exactos y las condiciones para la copia, distribucin y +modificacin se exponen a continuacin. + +Trminos y condiciones para la copia, distribucin y modificacin + +Esta Licencia se aplica a cualquier programa u otro tipo de trabajo que contenga +una nota colocada por el tenedor del copyright diciendo que puede ser +distribuido bajo los trminos de esta Licencia Pblica General. En adelante, +Programa se referir a cualquier programa o trabajo que cumpla esa condicin y +trabajo basado en el Programa se referir bien al Programa o a cualquier +trabajo derivado de l segn la ley de copyright. Esto es, un trabajo que +contenga el programa o una procin de l, bien en forma literal o con +modificaciones y/o traducido en otro lenguaje. Por lo tanto, la traduccin est +incluida sin limitaciones en el trmino modificacin. Cada concesionario +(licenciatario) ser denominado usted. + +Cualquier otra actividad que no sea la copia, distribucin o modificacin no +est cubierta por esta Licencia, est fuera de su mbito. El acto de ejecutar el +Programa no est restringido, y los resultados del Programa estn cubiertos +nicamente si sus contenidos constituyen un trabajo basado en el Programa, +independientemente de haberlo producido mediante la ejecucin del programa. El +que esto se cumpla, depende de lo que haga el programa. + +Usted puede copiar y distribuir copias literales del cdigo fuente del Programa, +segn lo has recibido, en cualquier medio, supuesto que de forma adecuada y bien +visible publique en cada copia un anuncio de copyright adecuado y un repudio de +garanta, mantenga intactos todos los anuncios que se refieran a esta Licencia y +a la ausencia de garanta, y proporcione a cualquier otro receptor del programa +una copia de esta Licencia junto con el Programa. + +Puede cobrar un precio por el acto fsico de transferir una copia, y puede, +segn su libre albedro, ofrecer garanta a cambio de unos honorarios. + +Puede modificar su copia o copias del Programa o de cualquier porcin de l, +formando de esta manera un trabajo basado en el Programa, y copiar y distribuir +esa modificacin o trabajo bajo los trminos del apartado 1, antedicho, supuesto +que adems cumpla las siguientes condiciones: + +Debe hacer que los ficheros modificados lleven anuncios prominentes indicando +que los ha cambiado y la fecha de cualquier cambio. + +Debe hacer que cualquier trabajo que distribuya o publique y que en todo o en +parte contenga o sea derivado del Programa o de cualquier parte de l sea +licenciada como un todo, sin carga alguna, a todas las terceras partes y bajo +los trminos de esta Licencia. + +Si el programa modificado lee normalmente rdenes interactivamente cuando es +ejecutado, debe hacer que, cuando comience su ejecucin para ese uso interactivo +de la forma ms habitual, muestre o escriba un mensaje que incluya un anuncio de +copyright y un anuncio de que no se ofrece ninguna garanta (o por el contrario +que s se ofrece garanta) y que los usuarios pueden redistribuir el programa +bajo estas condiciones, e indicando al usuario cmo ver una copia de esta +licencia. (Excepcin: si el propio programa es interactivo pero normalmente no +muestra ese anuncio, no se requiere que su trabajo basado en el Programa muestre +ningn anuncio). +Estos requisitos se aplican al trabajo modificado como un todo. Si partes +identificables de ese trabajo no son derivadas del Programa, y pueden, +razonablemente, ser consideradas trabajos independientes y separados por ellos +mismos, entonces esta Licencia y sus trminos no se aplican a esas partes cuando +sean distribuidas como trabajos separados. Pero cuando distribuya esas mismas +secciones como partes de un todo que es un trabajo basado en el Programa, la +distribucin del todo debe ser segn los trminos de esta licencia, cuyos +permisos para otros licenciatarios se extienden al todo completo, y por lo tanto +a todas y cada una de sus partes, con independencia de quin la escribi. + +Por lo tanto, no es la intencin de este apartado reclamar derechos o desafiar +sus derechos sobre trabajos escritos totalmente por usted mismo. El intento es +ejercer el derecho a controlar la distribucin de trabajos derivados o +colectivos basados en el Programa. + +Adems, el simple hecho de reunir un trabajo no basado en el Programa con el +Programa (o con un trabajo basado en el Programa) en un volumen de +almacenamiento o en un medio de distribucin no hace que dicho trabajo entre +dentro del mbito cubierto por esta Licencia. + +Puede copiar y distribuir el Programa (o un trabajo basado en l, segn se +especifica en el apartado 2, como cdigo objeto o en formato ejecutable segn +los trminos de los apartados 1 y 2, supuesto que adems cumpla una de las +siguientes condiciones: + +Acompaarlo con el cdigo fuente completo correspondiente, en formato +electrnico, que debe ser distribuido segn se especifica en los apartados 1 y 2 +de esta Licencia en un medio habitualmente utilizado para el intercambio de +programas, o + +Acompaarlo con una oferta por escrito, vlida durante al menos tres aos, de +proporcionar a cualquier tercera parte una copia completa en formato electrnico +del cdigo fuente correspondiente, a un coste no mayor que el de realizar +fsicamente la distribucin del fuente, que ser distribuido bajo las +condiciones descritas en los apartados 1 y 2 anteriores, en un medio +habitualmente utilizado para el intercambio de programas, o + +Acompaarlo con la informacin que recibiste ofreciendo distribuir el cdigo +fuente correspondiente. (Esta opcin se permite slo para distribucin no +comercial y slo si usted recibi el programa como cdigo objeto o en formato +ejecutable con tal oferta, de acuerdo con el apartado b anterior). +Por cdigo fuente de un trabajo se entiende la forma preferida del trabajo +cuando se le hacen modificaciones. Para un trabajo ejecutable, se entiende por +cdigo fuente completo todo el cdigo fuente para todos los mdulos que +contiene, ms cualquier fichero asociado de definicin de interfaces, ms los +guiones utilizados para controlar la compilacin e instalacin del ejecutable. +Como excepcin especial el cdigo fuente distribuido no necesita incluir nada +que sea distribuido normalmente (bien como fuente, bien en forma binaria) con +los componentes principales (compilador, kernel y similares) del sistema +operativo en el cual funciona el ejecutable, a no ser que el propio componente +acompae al ejecutable. + +Si la distribucin del ejecutable o del cdigo objeto se hace mediante la oferta +acceso para copiarlo de un cierto lugar, entonces se considera la oferta de +acceso para copiar el cdigo fuente del mismo lugar como distribucin del cdigo +fuente, incluso aunque terceras partes no estn forzadas a copiar el fuente +junto con el cdigo objeto. + +No puede copiar, modificar, sublicenciar o distribuir el Programa excepto como +prev expresamente esta Licencia. Cualquier intento de copiar, modificar +sublicenciar o distribuir el Programa de otra forma es invlida, y har que +cesen automticamente los derechos que te proporciona esta Licencia. En +cualquier caso, las partes que hayan recibido copias o derechos de usted bajo +esta Licencia no cesarn en sus derechos mientras esas partes continen +cumplindola. + +No est obligado a aceptar esta licencia, ya que no la ha firmado. Sin embargo, +no hay hada ms que le proporcione permiso para modificar o distribuir el +Programa o sus trabajos derivados. Estas acciones estn prohibidas por la ley si +no acepta esta Licencia. Por lo tanto, si modifica o distribuye el Programa (o +cualquier trabajo basado en el Programa), est indicando que acepta esta +Licencia para poder hacerlo, y todos sus trminos y condiciones para copiar, +distribuir o modificar el Programa o trabajos basados en l. + +Cada vez que redistribuya el Programa (o cualquier trabajo basado en el +Programa), el receptor recibe automticamente una licencia del licenciatario +original para copiar, distribuir o modificar el Programa, de forma sujeta a +estos trminos y condiciones. No puede imponer al receptor ninguna restriccin +ms sobre el ejercicio de los derechos aqu garantizados. No es usted +responsable de hacer cumplir esta licencia por terceras partes. + +Si como consecuencia de una resolucin judicial o de una alegacin de infraccin +de patente o por cualquier otra razn (no limitada a asuntos relacionados con +patentes) se le imponen condiciones (ya sea por mandato judicial, por acuerdo o +por cualquier otra causa) que contradigan las condiciones de esta Licencia, ello +no le exime de cumplir las condiciones de esta Licencia. Si no puede realizar +distribuciones de forma que se satisfagan simultneamente sus obligaciones bajo +esta licencia y cualquier otra obligacin pertinente entonces, como +consecuencia, no puede distribuir el Programa de ninguna forma. Por ejemplo, si +una patente no permite la redistribucin libre de derechos de autor del Programa +por parte de todos aquellos que reciban copias directa o indirectamente a travs +de usted, entonces la nica forma en que podra satisfacer tanto esa condicin +como esta Licencia sera evitar completamente la distribucin del Programa. + +Si cualquier porcin de este apartado se considera invlida o imposible de +cumplir bajo cualquier circunstancia particular ha de cumplirse el resto y la +seccin por entero ha de cumplirse en cualquier otra circunstancia. + +No es el propsito de este apartado inducirle a infringir ninguna reivindicacin +de patente ni de ningn otro derecho de propiedad o impugnar la validez de +ninguna de dichas reivindicaciones. Este apartado tiene el nico propsito de +proteger la integridad del sistema de distribucin de software libre, que se +realiza mediante prcticas de licencia pblica. Mucha gente ha hecho +contribuciones generosas a la gran variedad de software distribuido mediante ese +sistema con la confianza de que el sistema se aplicar consistentemente. Ser el +autor/donante quien decida si quiere distribuir software mediante cualquier otro +sistema y una licencia no puede imponer esa eleccin. + +Este apartado pretende dejar completamente claro lo que se cree que es una +consecuencia del resto de esta Licencia. + +Si la distribucin y/o uso de el Programa est restringida en ciertos pases, +bien por patentes o por interfaces bajo copyright, el tenedor del copyright que +coloca este Programa bajo esta Licencia puede aadir una limitacin explcita de +distribucin geogrfica excluyendo esos pases, de forma que la distribucin se +permita slo en o entre los pases no excluidos de esta manera. En ese caso, +esta Licencia incorporar la limitacin como si estuviese escrita en el cuerpo +de esta Licencia. + +La Free Software Foundation puede publicar versiones revisadas y/o nuevas de la +Licencia Pblica General de tiempo en tiempo. Dichas nuevas versiones sern +similares en espritu a la presente versin, pero pueden ser diferentes en +detalles para considerar nuevos problemas o situaciones. + +Cada versin recibe un nmero de versin que la distingue de otras. Si el +Programa especifica un nmero de versin de esta Licencia que se refiere a ella +y a cualquier versin posterior, tienes la opcin de seguir los trminos y +condiciones, bien de esa versin, bien de cualquier versin posterior publicada +por la Free Software Foundation. Si el Programa no especifica un nmero de +versin de esta Licencia, puedes escoger cualquier versin publicada por la Free +Software Foundation. + +Si quiere incorporar partes del Programa en otros programas libres cuyas +condiciones de distribucin son diferentes, escribe al autor para pedirle +permiso. Si el software tiene copyright de la Free Software Foundation, escribe +a la Free Software Foundation: algunas veces hacemos excepciones en estos casos. +Nuestra decisin estar guiada por el doble objetivo de de preservar la libertad +de todos los derivados de nuestro software libre y promover el que se comparta y +reutilice el software en general. + +AUSENCIA DE GARANTA + +Como el programa se licencia libre de cargas, no se ofrece ninguna garanta +sobre el programa, en todas la extensin permitida por la legislacin aplicable. +Excepto cuando se indique de otra forma por escrito, los tenedores del copyright +y/u otras partes proporcionan el programa tal cual, sin garanta de ninguna +clase, bien expresa o implcita, con inclusin, pero sin limitacin a las +garantas mercantiles implcitas o a la conveniencia para un propsito +particular. Cualquier riesgo referente a la calidad y prestaciones del programa +es asumido por usted. Si se probase que el Programa es defectuoso, asume el +coste de cualquier servicio, reparacin o correccin. + +En ningn caso, salvo que lo requiera la legislacin aplicable o haya sido +acordado por escrito, ningn tenedor del copyright ni ninguna otra parte que +modifique y/o redistribuya el Programa segn se permite en esta Licencia ser +responsable ante usted por daos, incluyendo cualquier dao general, especial, +incidental o resultante producido por el uso o la imposibilidad de uso del +Programa (con inclusin, pero sin limitacin a la prdida de datos o a la +generacin incorrecta de datos o a prdidas sufridas por usted o por terceras +partes o a un fallo del Programa al funcionar en combinacin con cualquier otro +programa), incluso si dicho tenedor u otra parte ha sido advertido de la +posibilidad de dichos daos. +FIN DE TRMINOS Y CONDICIONES + +Apndice: Cmo aplicar estos trminos a sus nuevos programas. +Si usted desarrolla un nuevo Programa, y quiere que sea del mayor uso posible +para el pblico en general, la mejor forma de conseguirlo es convirtindolo en +software libre que cualquiera pueda redistribuir y cambiar bajo estos trminos. + +Para hacerlo, aada los siguientes anuncios al programa. Lo ms seguro es +aadirlos al principio de cada fichero fuente para transmitir lo ms +efectivamente posible la ausencia de garanta. Adems cada fichero debera tener +al menos la lnea de copyright y un indicador a dnde puede encontrarse el +anuncio completo. + + + +Copyright (C) 19aa + +Este programa es software libre. Puede redistribuirlo y/o modificarlo bajo los +trminos de la Licencia Pblica General de GNU segn es publicada por la Free +Software Foundation, bien de la versin 2 de dicha Licencia o bien (segn su +eleccin) de cualquier versin posterior. + +Este programa se distribuye con la esperanza de que sea til, pero SIN NINGUNA +GARANTA, incluso sin la garanta MERCANTIL implcita o sin garantizar la +CONVENIENCIA PARA UN PROPSITO PARTICULAR. Vase la Licencia Pblica General de +GNU para ms detalles. + +Debera haber recibido una copia de la Licencia Pblica General junto con este +programa. Si no ha sido as, escriba a la Free Software Foundation, Inc., en 675 +Mass Ave, Cambridge, MA 02139, EEUU. +Aada tambin informacin sobre cmo contactar con usted mediante correo +electrnico y postal. + +Si el programa es interactivo, haga que muestre un pequeo anuncio como el +siguiente, cuando comienza a funcionar en modo interactivo: + +Gnomovision versin 69, Copyright (C) 19aa nombre del autor + +Gnomovision no ofrece ABSOLUTAMENTE NINGUNA GARANTA. Para ms detalles escriba +show w. +Los comandos hipotticos show w y show c deberan mostrar las partes +adecuadas de la Licencia Pblica General. Por supuesto, los comandos que use +pueden llamarse de cualquier otra manera. Podran incluso ser pulsaciones del +ratn o elementos de un men (lo que sea apropiado para su programa). + +Tambin deberas conseguir que su empleador (si trabaja como programador) o tu +Universidad (si es el caso) firme un renuncia de copyright para el programa, +si es necesario. A continuacin se ofrece un ejemplo, altere los nombres segn +sea conveniente: + +Yoyodyne, Inc. mediante este documento renuncia a cualquier inters de derechos +de copyright con respecto al programa Gnomovision (que hace pasadas a +compiladores) escrito por Pepe Programador. + +, 20 de diciembre de 1996 + +Pepito Grillo, Presidente de Asuntillos Varios. + +Esta Licencia Pblica General no permite que incluya sus programas en programas +propietarios. Si su programa es una biblioteca de subrutinas, puede considerar +ms til el permitir el enlazado de aplicaciones propietarias con la biblioteca. +Si este es el caso, use la Licencia Pblica General de GNU para Bibliotecas en +lugar de esta Licencia. \ No newline at end of file diff --git a/license/license-TR.txt b/license/license-TR.txt new file mode 100644 index 0000000..1741add --- /dev/null +++ b/license/license-TR.txt @@ -0,0 +1,354 @@ +Bu, GNU Genel Kamu Lisansnn (GPL) Trke'ye gayrresmi evirisidir. Bu eviri +Free Software Foundation tarafndan yaynlanmam olup GNU GPL kullanan +yazlmlarn datm artlarn belirleme asndan hukuki balaycl yoktur +-- Hukuki adan yalnzca GNU GPL'in ngilizce metni balaycdr. Bu eviri, +Trke kullanclarnn GNU GPL'i daha iyi anlayabilmeleri iin hazrlanmtr. + +GNU Genel Kamu Lisans (GPL) + +Srm 2, Haziran 1991 + +Telif Hakk 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite +330, Boston, MA 02111-1307, USA + +Bu lisans dkmannn birebir kopyalarn yapma ve datma izni herkese +verilmitir, fakat metinde deiiklik yapma izni yoktur. + +GR + +Yazlm lisanslarnn ou sizin yazlm paylama ve deitirme hakknzn +elinizden alnmas iin hazrlanmtr. Buna karlk, GNU Genel Kamu Lisans +sizin serbest yazlmlar deitirme ve paylama hakknzn mahfuz tutulmas ve +yazlmn btn kullanclar iin serbest olmas amac ile yazlmtr. Bu +Genel Kamu Lisans, Free Software Foundation'un ou yazlm ve bu lisans +kullanmay dstur edinen dier yazlmclarn yazlmlar iin kullanlmaktadr. +(Free Software Foundation'un baz yazlmlar GNU Kitaplk Genel Kamu Lisans -- +GNU LGPL -- altnda datlmaktadr.) Siz de bu lisans yazlmlarnza +uygulayabilirsiniz. + +Serbest yazlmdan bahsettiimiz zaman fiyattan deil, zgrlkten bahsediyoruz. +Bizim Genel Kamu Lisanslarmz, sizin serbest yazlmlarn kopyalarn datma +zgrlnz (ve isterseniz bu hizmet iin para almanz), yazlm kaynak +kodlarnn size datm esnasnda veya eer isterseniz verilmesini, yazlm +deitirebilmenizi, yazlmn paralarn yeni yazlmlar ierisinde +kullanabilmenizi ve bunlar yapabileceinizi bilmenizi salamaktadr. + +Haklarnz koruyabilmemiz iin sizin haklarnz kstlama veya sizin bu +haklarnzdan feragat etmenizi isteme yollarn yasaklayc baz kstlamalar +getirmemiz gerekmektedir. Bu kstlamalar eer serbest yazlm datyor veya +deitiriyorsanz size baz ykmllkler getirmektedir. + +rnein byle bir programn kopyalarn, bedava veya cret karl +datyorsanz alclara sizin sahip olduunuz btn haklar salamalsnz. +Onlarn da kaynak kodlarna sahip olmalarn veya ulaabilmelerini +salamalsnz. Onlara da haklarn bilebilmeleri iin bu artlar +gstermelisiniz. + +Haklarnz iki koruma iki aamada gereklemektedir: + +Yazlma telif hakk alnmaktadr. + +Yazlm lisans olarak size, hukuki olarak, yazlm kopyalama, datma ve/veya +deitirme hakk tanyan bu lisans sunulmaktadr. + +Ayrca, yazarlarn ve bizim korunmamz iin bu serbest yazlmn herhangi bir +garantisi olmadn herkesin anlamasn istiyoruz. Eer yazlm bakas +tarafndan deitirilmi ve deitirilmi hali ile tarafnza ulatrlm ise +alclarn, ellerinde olan yazlmn orjinal olmadn, dolaysyla bakalar +tarafndan eklenen problemlerin ilk yazarlarn hretlerine olumsuz etkide +bulunmamas gerektiini bilmelerini istiyoruz. + +Son olarak, btn serbest yazlmlar yazlm patentleri tarafndan srekli +tehdit altnda bulunmaktadr. Serbest bir yazlmn datclarnn bireysel +olarak patent lisans almalarn ve bu yol ile yazlm mseccel hale +getirmelerine imkan vermemek istiyoruz. Bunu engellemek iin, yazlm iin +alnacak her patentin herkesin serbest kullanmna izin vermesi veya +patentlenmemesi gerektiini ak olarak ortaya koyuyoruz. + +Kopyalama, datm ve deitirme ile ilgili kesin art ve kaytlar aada yer +almaktadr. + +KOPYALAMA, DAITIM VE DETRME LE LGL ART VE KAYITLAR + +0. Bu Lisans, telif hakk sahibi tarafndan ierisine bu Genel Kamu Lisans +altnda datldna dair ibare konmu olan herhangi bir yazlm veya baka +eseri kapsamaktadr. Aada "Yazlm", bu kapsamdaki herhangi bir yazlm veya +eser, "Yazlm baz alan rn", ise Yazlm veya telif kanunu altnda Yazlm'dan +itikak etmi, yani Yazlm'n tamamn veya bir parasn, deitirmeden veya +deiiklikler ile, veya baka bir dile tercme edilmi hali ile ieren herhangi +bir rn, manasnda kullanlmaktadr. (Bundan sonra tercme "deitirme" +kapsamnda snrsz olarak ierilecektir.) Her ruhsat sahibine "siz" olarak +hitap edilmektedir. + +Kopyalama, datm ve deitirme haricinde kalan faaliyetler bu Lisans'n +kapsam dndadrlar. Yazlm' altrma eylemi snrlandrlmamtr ve +Yazlm'n kts yalnzca ktnn ierii (Yazlm' altrmak yolu ile +elde edilmesinden bamsz olarak) Yazlm' baz alan rn kapsamna girer ise +bu Lisans kapsamndadr. Bu koulun salanp salanmad Yazlm'n ne yapt +ile ilgilidir. + +1. Yazlm'n kaynak kodlarn birebir, aldnz ekilde, herhangi bir ortamda +ve vasta ile, uygun ve grnr bir ekilde telif hakk bildirimi ve garantisiz +olduuna dair bildirim koymak, bu Lisans'dan bahseden herhangi bir bildirimi +aynen muhafaza etmek ve btn dier alclara Yazlm ile birlikte bu Lisans'n +bir kopyasn vermek art ile kopyalayabilir ve databilirsiniz. + +Kopyalamak fiili ilemi iin bir cret talep edebilir ve sizin seiminize bal +olarak cret karl garanti verebilirsiniz. + +2. Yazlm'n kopyasn veya kopyalarn veya herhangi bir parasn +deitirerek Yazlm' baz alan rn elde edebilir, bu deiiklikleri veya +rnn kendisini yukarda 1. blmdeki artlar dahilinde ve aada sralanan +artlarn yerine getirilmesi koulu ile kopyalayabilir ve databilirsiniz. + +a) Deitirilen dosyalarn grnr bir ekilde dosyalarn sizin tarafnzdan +deitirildiine dair, tarihli bir bildirim iermesini salamalsnz. + +b) Yazlm'dan veya Yazlm'n bir parasndan tamamen veya ksmen itikak etmi +ve sizin tarafnzdan datlan veya yaynlanan herhangi bir rnn btn nc +ahslara bu Lisans artlar altnda cretsiz olarak ruhsatlanmasn +salamalsnz. + +c) Eer deitirilen yazlm olaan kullanm altnda komutlar interaktif olarak +alyor ise, yazlm, en olaan kullanm iin interaktif olarak altrld +zaman uygun bir telif hakk bildirimi, garantisi olmadna (veya sizin +tarafnzdan garanti verildiine), kullanclarn bu yazlm bu artlar altnda +tekrar databileceklerine, ve kullancnn bu Lisansn bir kopyasn nasl +grebileceine dair bir bildirim yazdrmal veya gstermelidir. (stisna: Eer +Yazlm'n kendisi interaktif ise fakat byle bir bildirimi olaan kullanm +esnasnda yazdrmyor ise, sizin Yazlm' baz alan rnnz byle bir +bildirimde bulunmak zorunda deildir.) + +Bu artlar deitirilmi eserin tamamn kapsamaktadr. Eer eserin tespit +edilebilir ksmlar Yazlm'dan itikak etmemi ise ve makul surette kendi +balarna bamsz ve ayr eserler olarak kabul edilebilir ise, o zaman bu +Lisans ve artlar, bu paralar ayr eser olarak dattnz zaman balayc +deildir. Fakat, ayn paralar Yazlm' baz alan bir rn btnnn bir +paras olarak dattnz zaman btnn datm, dier ruhsat sahiplerine +verilen izinlerin btne ait olduu ve paralarna, yazarnn kim olduuna +baklmakszn btn paralarna tek tek ve mterek olarak uyguland bu Lisans +artlarna uygun olmaldr. + +Bu blmn hedefi tamamen sizin tarafnzdan yazlan bir eser zerinde hak iddia +etmek veya sizin byle bir eser zerindeki haklarnza muhalefet etmek deil, +Yazlm' baz alan, Yazlm'dan itikak etmi veya mterek olarak ortaya +karlm eserlerin datmn kontrol etme haklarn dzenlemektir. + +Buna ek olarak, Yazlm' baz almayan herhangi bir rnn Yazlm ile (veya +Yazlm' baz alan bir rn ile) bir bilgi saklama ortamnda veya bir datm +ortamnda beraber tutulmas dier eseri bu Lisans kapsamna sokmaz. + +3. Yazlm' ( veya 2. blmde tanmland hali ile onu baz alan bir rn) ara +derlenmi veya uygulama hali ile 1. ve 2. Blm'deki artlar dahilinde ve +aada sralanan yntemlerden birisine uygun olarak kopyalayabilir ve +databilirsiniz. + +a) Yaygn olarak yazlm datmnda kullanlan bir ortam zerinde, yukarda 1. +ve 2. Blm'de bulunan artlar dahilinde, bilgisayar tarafndan okunabilir +kaynak kodlarnn tamam ile birlikte datmak. + +b)Herhangi bir nc ahsa, fiziksel olarak datm gerekletirme +masrafnzdan daha fazla cret almayarak, yaygn olarak yazlm datmnda +kullanlan bir ortam zerinde, yukarda 1. ve 2. Blm'de bulunan artlar +dahilinde, bilgisayar tarafndan okunabilir kaynak kodlarnn tamamn +datacanza dair en az yl geerli olacak yazl bir taahhtname ile +birlikte datmak. + +c)Size verilmi olan ilgili kaynak kodunu datma taahhtnamesi ile birlikte +datmak. (Bu alternatif yalnzca ticari olmayan datmlar iin ve yalnzca siz +de yazlm ara derlenmi veya uygulama bieminde ve yukarda b) blmnde +anlatlan ekli ile bir taahhtname ile birlikte alm iseniz geerlidir.) + +Bir eserin kaynak kodu, esere deitirme yapmak iin en uygun yntem ve imkan +anlamnda kullanlmaktadr. Uygulama bieminde bir eser iin, kaynak kodu, +ierdii btn paralar iin ilgili kaynak kodlar, ilgili arayz tanm +dosyalar ve derleme ve ykleme ilemlerinde kullanlan btn betikler anlamnda +kullanlmaktadr. Bir istisna olarak, datlan kaynak kodu, genelde uygulamann +zerinde alaca iletim sisteminin ana paralar (derleyici, ekirdek v.b.) +ile birlikte datlan herhangi bir bileeni,eer ilgili bileen, uygulama ile +birlikte datlmyorsa, iermek zorunda deildir. + +Eer uygulama veya ara derlenmi biemde yazlmn datm belli bir yere +eriim ve oradan kopyalama imkan olarak yaplyorsa, ayn yerden, ayn koullar +altnda kaynak koduna eriim imkan salamak, nc ahslarn ara derlenmi ve +uygulama biemleri ile birlikte kaynak kodunu kopyalama zorunluluklar olmasa +bile kaynak kodunu datmak olarak kabul edilmektedir. + +4. Yazlm' bu Lisans'ta sarih olarak belirtilen artlar haricinde kopyalayamaz, +deitiremez, ruhsat hakkn veremez ve datamazsnz. Buna aykr herhangi bir +kopyalama, deitirme, ruhsat hakk verme, veya datmda bulunma hkmszdr ve +byle bir teebbs halinde bu Lisans altndaki btn haklarnz iptal edilir. +Sizden, bu Lisans kapsamnda kopya veya hak alm olan nc ahslar, Lisans +artlarna uygunluklarn devam ettirdikleri srece, ruhsat haklarn muhafaza +edeceklerdir. + +5. Bu Lisans sizin tarafnzdan imzalanmad iin bu Lisans' kabul etmek +zorunda deilsiniz. Fakat, size Yazlm' veya onu baz alan rnleri deitirmek +veya datmak iin izin veren baka bir belge yoktur. Eer bu Lisans' kabul +etmiyorsanz bu eylemler kanun tarafndan sizin iin yasaklanmtr. Dolaysyla, +Yazlm' (veya onu baz alan bir rn) deitirmeniz veya datmanz bu Lisans' +ve Lisans'n Yazlm' veya ondan itikak etmi btn eserleri kopyalamak, +deitirmek ve datmak iin getirdii art ve kaytlar kabul ettiiniz +manasna gelmektedir. + +6. Yazlm' (veya onu baz alan herhangi bir rn) yeniden dattnz her +defada alc, ilk ruhsat sahibinden otomatik olarak Yazlm' bu artlar ve +kaytlar dahilinde kopyalamak, deitirmek ve datmak iin ruhsat almaktadr. +Alcnn burada verilen haklar kullanmasna ek bir takm kstlamalar +getiremezsiniz. nc ahslar bu Lisans mucibince hareket etmee mecbur etmek +sizin sorumluluk ve ykmllnz altnda deildir. + +7. Eer bir mahkeme karar veya patent ihlal iddias veya herhangi baka bir (patent +meseleleri ile snrl olmayan) sebep sonucunda size, bu Lisans'n art ve +kaytlarna aykr olan bir takm (mahkeme karar, zel anlama veya baka bir +ekilde) kstlamalar getirilirse, bu sizi bu Lisans art ve kaytlarna uyma +mecburiyetinden serbest brakmaz. Eer ayn anda hem bu Lisans'n artlarn +yerine getiren hem de dier kstlamalara uygun olan bir ekilde Yazlm' +datamyorsanz, o zaman Yazlm' datamazsnz. rnein, eer bir patent +lisans direkt veya endirekt olarak sizden kopya alacak olan nc ahslarn +bedel demeksizin Yazlm' datmalarna hak tanmyorsa o zaman sizin hem bu +koulu hem Lisans koullarn yerine getirmenizin tek yolu Yazlm' datmamak +olacaktr. + +Eer bu blmn herhangi bir paras herhangi bir art altnda uygulanamaz veya +hatal bulunur ise o artlar dahilinde blmn geri kalan ksm, btn dier +artlar altnda da blmn tamam geerlidir. + +Bu blmn amac sizin patent haklarn, herhangi bir mlkiyet hakkn ihlal +etmenize yol amak veya bu haklarn geerliliine muhalefet etmenizi salamak +deildir; bu blmn btn amac kamu lisans uygulamalar ile oluturulan +serbest yazlm datm sisteminin btnln ve ilerliini korumaktr. Bu +sistemin tutarl uygulanmasna dayanarak pek ok kii bu sistemle datlan +geni yelpazedeki yazlmlara katkda bulunmutur; yazlmn bu veya baka bir +sistemle datmak karar yazara aittir, herhangi bir kullanc bu karar veremez. + +Bu blm Lisans'n geri kalannn dourduu sonularn ne olduunu akla +kavuturmak amacn gtmektedir. + +8. Eer Yazlm'n kullanm ve/veya datm baz lkelerde telif hakk tayan +arayzler veya patentler yznden kstlanrsa, Yazlm' bu Lisans kapsamna +ilk koyan telif hakk sahibi, Yazlm'n yalnzca bu lkeler haricinde +datlabileceine dair ak bir corafi datm kstlamas koyabilir. Byle +bir durumda bu Lisans bu kstlamay sanki Lisans'n ierisine yazlm gibi +kapsar. + +9. Free Software Foundation zaman zaman Genel Kamu Lisans'nn yeni ve/veya +deitirilmi biimlerini yaynlayabilir. Byle yeni srmler mana olarak +imdiki haline benzer olacaktr, fakat doacak yeni problemler veya kayglara +cevap verecek ekilde detayda farkllk arzedebilir. + +Her yeni biime ayrdedici bir srm numaras verilmektedir. Eer Yazlm bir +srm numaras belirtiyor ve "bu ve bundan sonraki srmler" altnda +datlyorsa, belirtilen srm veya Free Software Foundation tarafndan +yaynlanan herhangi sonraki bir srmn art ve kaytlarna uymakta serbestsiniz. +Eer Yazlm Lisans iin bir srm numaras belirtmiyor ise, Free Software +Foundation tarafndan yaynlanm olan herhangi bir srmn art ve kaytlarna +uymakta serbestsiniz. + +10. Eer bu Yazlm'n paralarn datm koullar farkl olan baka serbest +yazlmlarn ierisinde kullanmak isterseniz, yazara sorarak izin isteyin. Telif +hakk Free Software Foundation'a ait olan yazlmlar iin Free Software +Foundation'a yazn, bazen istisnalar kabul edilmektedir. Kararmz, serbest +yazlmlarmzdan itikak etmi yazlmlarn serbest statlerini korumak ve +genel olarak yazlmlarn yeniden kullanlabilirliini ve paylamn salamak +amalar dorultusunda ekillenecektir. + +GARANT YOKTUR + +11. BU YAZILIM CRETSZ OLARAK RUHSATLANDII N, YAZILIM N LGL +KANUNLARIN ZN VERD LDE HERHANG BR GARANT VERLMEMEKTEDR. AKS YAZILI +OLARAK BELRTLMED MDDETE TELF HAKKI SAHPLER VE/VEYA BAKA AHISLAR +YAZILIMI "OLDUU GB", AKAR VEYA ZIMNEN, SATILABLRL VEYA HERHANG BR +AMACA UYGUNLUU DA DAHL OLMAK ZERE HBR GARANT VERMEKSZN DAITMAKTADIRLAR. +YAZILIMIN KALTES VEYA PERFORMANSI LE LGL TM SORUNLAR SZE ATTR. +YAZILIMDA HERHANG BR BOZUKLUKTAN DOLAYI DOABLECEK OLAN BTN SERVS, TAMR +VEYA DZELTME MASRAFLARI SZE ATTR. + +12. LGL KANUNUN CBAR ETT DURUMLAR VEYA YAZILI ANLAMA HARCNDE HERHANG +BR EKLDE TELF HAKKI SAHB VEYA YUKARIDA ZN VERLD EKLDE YAZILIMI +DETREN VEYA YENDEN DAITAN HERHANG BR K, YAZILIMIN KULLANIMI VEYA +KULLANILAMAMASI (VEYA VER KAYBI OLUMASI, VERNN YANLI HALE GELMES, SZN +VEYA NC AHISLARIN ZARARA URAMASI VEYA YAZILIMIN BAKA YAZILIMLARLA BERABER +ALIAMAMASI) YZNDEN OLUAN GENEL, ZEL, DORUDAN YA DA DOLAYLI HERHANG BR +ZARARDAN, BYLE BR TAZMNAT TALEB TELF HAKKI SAHB VEYA LGL KYE +BLDRLM OLSA DAH, SORUMLU DELDR. + +ART VE KAYITLARIN SONU + +Bu artlar Yeni Yazlmlara Nasl Uygulanr + +Eer yeni bir yazlm gelitiriyor ve bunun kamuya en fazla dzeyde yarar +salamasn istiyorsanz, yazlmnz herkesin datp, deitirebilecei zgr +yazlm haline getirmenizi neriyoruz. + +Bu koullar uygulamak iin yazlma aadaki bildirimleri ekleyin. En salkl +yntem her kaynak kodu dosyasnn bana bu bildirimi ekleyerek garanti +olmadna dair bilginin verildiinden emin olmaktr; her dosya en azndan "copyright" +(telif hakk) satrn ve bildirimin tam metninin nerede bulunabileceine dair +bilgi iermelidir. + +{yazlmn adn ve ne yaptn anlatan bir satr.} + +Copyright (C) {yl} {yazarn ad} + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this library; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +Size normal ve elektronik posta ile nasl ulalabileceine dair bilgi eklemeyi +unutmayn. + +Eer yazlmnz interaktif ise, interaktif kipte balatld zaman gsterilen +ksa bir bildirim koyun. + +Gnomovizyon version 69, Copyright (C) yl yazarn ad +Gnomovizyon comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This +is free software, and you are welcome to redistribute it under certain +conditions; type `show c' for details. + +Gnomovizyon srm 69, Telif hakk (C) yl yazarn ad +Gnomovizyon iin H BR GARANT verilmemektedir; detaylar iin `show w' yazn. +Bu bir serbest yazlmdr ve belli koullar altnda yeniden datlabilir; +detaylar iin `show c' yazn. + +rnekte verilen `show w' ve `show c' komutlar GNU Genel Kamu Lisans'nn ilgili +blmlerini gstermelidir. Elbette kullanlan komutlar daha farkl olabilir veya +yazlmnza uyan baka yntemlerle bu bildirim yaplabilir. + +vereninizin (eer programc olarak alyorsanz) veya, eer renci iseniz, +okulunuzun telif haklarndan feragat ettiklerine dair bir feragatname +imzalamalarn isteyebilirsiniz. Aada bir rnek yer almaktadr, isimleri +deitirin: + +Gereksizler, A.., Mehmet Herhangibiri tarafndan yazlm `AbidikGubidik' +yazlmnda (kapkolu evirmekte kullanlan bir yazlm) olabilecek btn telif +haklarndan feragat eder. + +{Yn Etici mzas}, 1 April 1990 +Yn Etici, Gereksizler Yetkilisi + +Bu Genel Kamu Lisans yazlmnzn serbest olmayan yazlmlarn ierisine dahil +edilmesine imkan tanmaz. Eer yazlmnz bir kitaplk ise, serbest olmayan +yazlmlarn kitaplnza balanmasna imkan tanmak isteyebilirsiniz. Eer +yapmak istediiniz bu ise, bu Lisans yerine GNU Kstl Genel Kamu Lisans'n +kullanabilirsiniz. + +eviren: Deniz Akku Kanca, 2001 +Translated by: Deniz Akku Kanca, 2001 + + +This is an unofficial translation of the GNU General Public License into Turkish. +It was not published by the Free Software Foundation, and does not legally state +the distribution terms for software that uses the GNU GPL--only the original +English text of the GNU GPL does that. However, we hope that this translation +will help Turkish speakers understand the GNU GPL better. + diff --git a/license/license.txt b/license/license.txt new file mode 100644 index 0000000..13db015 --- /dev/null +++ b/license/license.txt @@ -0,0 +1,88 @@ +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + +a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + +c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + +END OF TERMS AND CONDITIONS diff --git a/license/readme.txt b/license/readme.txt new file mode 100644 index 0000000..e020a4d --- /dev/null +++ b/license/readme.txt @@ -0,0 +1,376 @@ +eMule Copyright (C)2002-2006 Merkur (devteam at emule-project dot net) + + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 675 Mass +Ave, Cambridge, MA 02139, USA. + + +------------------------------------------------------------------------------- + + +Welcome to eMule, a filesharing client based on the eDonkey2000(C) network. + + +Visit us at + http://www.emule-project.net +and + http://sourceforge.net/projects/emule +or + the IRC chatroom, #emule on irc.emule-project.net + + + +Please remember that this is an early version, not all features are +implemented yet, and not everything might work as expected. + +Visit our forum for bugreports, feature requests, development or general +dicussion. + + +If you have questions or serious problems, please read the FAQ first :) It can +be found at www.emule-project.net. A small collection of questions is also +discussed later in this document. + + +If you didn't find an answer, SEARCH the forum for a topic related to your +problem, DO NOT open a new topic at once, most likely someone else had the +same problem before. + +The official Forum is also at http://www.emule-project.net Please use only +English there, except for the language-specific sections. (PLEASE do not +report bugs that are already posted by someone else, and keep the "Bug +Reports", "Feature Requests" and "Development" sections clean and shiny) + + +Would you like to donate to the eMule project? A PayPal link can be found on +the portal page (www.emule-project.net) Thanks ;) + + + + +INSTALLATION: +------------- + +-Unzip eMule to a directory of your choice, or start the installer if you + downloaded the .exe installer version. + +-You can move your "Temp" and "Incoming" folders from eDonkey (or a previous + version of eMule) to the new directory now, in order to continue your partial + downloads. If you don't want to move your folders, you can set the "temp" and + "incoming" path in the eMule preferences and restart it to get the same + result. + +-Updating from an earlier version of eMule: The best way to do this is simply + to download the .zip file (not the installer), and unzip the new emule.exe to + your old emule directory, overwriting the previous one. + + + +CONFIGURATION: +-------------- + +-Go to the "Preferences" tab + +-Enter a nice nickname ;) + +-Enter the "Download Capacity" and "Upload Capacity" according to your + internet connection. All values in eMule are kiloBytes (KB), your Internet + Service Provider's (ISP) numbers are most likely kiloBits (kB). 8 Bits make up + 1 Byte, so when your Internet Connection is 768kB Downstrean and 128kB + Upstrean (like German Telekom DSL), your correct values are: + + Downstrean: 768kB / 8 = 96KB, you enter 96 as "Download Capacity" + Upstream: 128kB / 8 = 16 KB, you enter 16 as "Upload Capacity" + + The "capacity" values are used for the statistics display only. Nevertheless, + you need to know them to determine the following down/upload limits: + + +-Enter "Download Limit" and "Upload Limit" (IMPORTANT!) + + Download Limit: leave this at 0 (should eMule become too fast and you are + unable to surf the Internet or whatever, reduce it to 80-90% of "Download + Capacity") + + Upload Limit: set this to ~80% of your "Upload Capacity" (so when your Upload + Capacity is 16, set Upload Limit to 12 or 13) + + Setting Upload Limit to a value < 10 will automatically reduce your Download + Limit, so upload as fast as you can. + + +NOTE: 56k Modem users: eMule only accepts integral values for these settings +at the moment, you can't enter 2.6 or whatever your sweet-spot setting is, +yet. Sorry :) Maybe later.. + + +-"Maximum Connections": depends on your operating system. As a general rule... + + -Windows 98/ME (and 56k Modem/ISDN) users enter 50 here + -Windows 2000/XP users should set this according to their + Internet Connection. 250 is a good value for 128k upstream connection, + for example. DO NOT set this too high. It will kill your upload and with + that, your download. + +-"Maximum Sources per File": decide for yourself how many you want :) when you + set this too high, your computer might slow down drastically or even crash. + 500-1000 are good values for people with DSL/cable connection. + +-Choose the directories you want to share with other users. DO NOT SHARE YOUR + COMPLETE HARDDISK! Put the stuff you want to share in a seperate Folder. If + you share more than ~200 files, you should reconsider that... + +-The other options are pretty self-explaining. If you dunno what it does, +don't touch it. + + + +FAQ: (for more, see http://www.emule-project.net/faq/ ) +---- + +--"Will I lose my credits when switching to a new version of eMule?" + + Not when move your old preferences.dat (your user ID) and clients.met (other + people's credits) files to the directory you installed the new version in. + The best way to update is just to replace your old emule.exe with the new one + from the .zip download. + + + +--"Why is eMule so slow? My brother/friend/whatever is downloading at 100K constantly" + + When you did setup eMule properly, it's all about the availibility of the + files you are downloading, a bit of luck and a lot of patience ;) + + + +--"Where can I get a new serverlist?" + + There are several lists availible. Some that I know of are: + -http://www.thedonkeynetwork.com + -http://ed2k.2x4u.de + Note that those sites are not related to the eMule project, we are not + responsible for their content. + + + +--"What is the addresses.dat file for?" + + You can enter a serverlist URL in that file. eMule will then get the + serverlist from that URL at startup (when the option "Auto-update serverlist + at startup" is activated) + + + +--"What is the staticservers.dat file good for?" + + You can enter your favorite servers here to have them permanently in your + serverlist with high priority. You can enter the static IP of the server, or + an adress like goodserver.dyndns.net. You can also add static servers to this + file via the server tab in eMule (right-click -> add to static serverlist) + + +--"Why do I always have a low ID (means: firewalled) ??? What can I do against that?" + + Look here: http://www.emule-project.net/faq/ports.htm + + + +--"How do I know whether my ID is high or low?" + + Look at the arrow in the bottom right corner, next to the server name you are + connected to. When it's green, your ID is high. When it's orange, your ID is + low. + + + +--"What does high and low ID mean anyway?" + + When your ID is high (green arrow), everything is fine :) When it's low + (orange arrow), you are behind a firewall or router, and other clients can't + connect to you directly (which is a bad thing). Plz read the FAQ or search + the forums on how to configure your firewall/router for eMule. + + NOTE: you can also get a low ID when the server you connected to is too busy + to answer properly, or simply badly configured. When you are sure your + settings are ok and you SHOULD have a high ID, connect to antoher server. + + + +--"What is the difference between up/down CAPACITY and LIMIT?" + + The CAPACITY is used only by the statistcs tab to determine the vertical + limits of the diagram. The LIMITS set the actual network traffic limits (see + configuration notes). + + + +--"I'd like to search for specific file types, what filter stands for which files?" + + File Type Extensions found + -------------------------------------------------------------------------------- + Audio .mp3 .mp2 .mpc .wav .ogg .aac .mp4 .ape .au .wma .flac + Video .avi .mpg .mpeg .ram .rm .vob .divx .mov .ogm .vivo + Program .exe .com + Archive .zip .rar .ace + CD-Image .bin .cue .iso .nrg .ccd .sub .img .bwt .bwi .bwa .bws .mdf .mds + Picture .jpg .jpeg .bmp .gif .tif .png + + + +--"What are all those fancy colors in the download progress bar about?" + + Each download in the the Transfer tab has a coloured bar to show current file + availability and progress. + + -Black shows the parts of the file you already have + -Red indicates a part missing in all known sources + -Different shades of blue represent the availability of this part in the + sources. The darker the blue is the higher the availability + -Yellow denotes a part being downloaded + -The green bar on top shows the total download progress of this file + + If you expand the download you see its sources with the corresponding bar. + Here the colours have a slightly different meaning: + + -Black shows parts you are still missing + -Silver stands for parts this source is also missing + -Green indicates parts you already have + -Yellow denotes a part being uploaded to you + + Learning how the progress bar works will greatly help your understanding of + the eDonkey2000 network. + + + +--"What do the "QR: xxxx" numbers mean that I see when I look at my sources?" + + QR stands for "Queue Rank" and it is your current position in this source's + queue. + + Obviously, a lower value is better :) If the source is an eMule client and + there is no QR number, it's likely that it's queue is full and cannot accept + more clients. + + + + +COMPILING THE SOURCECODE: +------------------------- + +The sourcecode of eMule is availible as seperate download at: + http://sourceforge.net/projects/emule +You need Microsoft(C) Visual Studio .NET 2002 Service Pack 1 to compile eMule. + +-Unzip the sources (with subdirs) into a new folder + +Since eMule v0.29b the separate download and compilation of additional +libraries is required. These libs are 3rd party and therefore - as usual - not +within our distribution. You need the following libs: + +1. Crypto++ v5.1 + http://www.eskimo.com/~weidai/cryptlib.html + +2. zlib v1.2.2 + http://www.gzip.org/zlib/ + +3. id3lib v3.8.3 + http://sourceforge.net/projects/id3lib/ + +4. (for MobileMule only!) + DirectX SDK + pnglib: http://www.libpng.org/pub/png/libpng.html + +5. ResizableLib 1.3 + http://sourceforge.net/projects/resizablelib/ + +Download and save their sourcecode one level above the eMule source code +folder and compile them (check the eMule-project file to learn about the +required foldernames, or adapt them to your needs!). + + +-Open the emule.sln Visual Studio Solution + +-If you get an error message like "wrong version of Visual C++", you have to +open emule.sln and emule.vcroj with an editor and change some values: + + emule.sln: "...Format Version 8.00" to 7.00 if you use Microsoft(C) Visual C++ .NET 2002 + emule.vcproj: Version="7.10" to 7.00 if you use Microsoft(C) Visual C++ .NET 2002 + +-Select "release" or "debug" build in the solution configuration manager +-Build the solution. That's it :) +-If the compile was successful, the emule.exe is either in the \Debug or + \Release directory +-When you build a debug dump version, you need the latest dbghelp.dll from + Microsoft to run the app + +-IMPORTANT: + + If you make modifications to eMule and you distribute the compiled version of + your build, be sure to obey the GPL license. You have to include the + sourcecode, or make it availible for download together with the binary + version. + + + + +MISC. STUFF: +------------ + +The eMule staff would like to thank the following (no particular order) + +-Jed "swamp" McCaleb and MetaMachine for bringing the eDonkey network to life +-DrSiRiUs for the awesome artwork (splashscreen and icons) +-OCBmaurice & Stillman for the serverlists and more (www.thedonkeynetwork.com) + +-many people who sent us code parts, useful bug reports and useful suggestions :) + + + + +STAFF: +------ + +Who are the guys that sacrifice so much time to bring you this wonderful +program? + +-John aka. Unknown1 - Developer +-Ornis - Developer +-bluecow - Developer +-zz - Developer +-Monk - Testers + +-Merkur (merkur-@users.sourceforge.net) - Master of the Mule - retired, we miss you :) +-Tecxx - Developer (retired) +-Pach2 - Developer (retired) +-Juanjo - Developer (retired) +-Dirus - Developer (retired) +-Barry - Developer (retired) +-Mr. Ozon, Sony, Myxin - Tester (retired) + + + +LEGAL: +------ + +eMule Copyright (C)2002-2005 Merkur (merkur-@users.sourceforge.net) + +eDonkey2000 (C)Jed McCaleb, MetaMachine (www.eDonkey2000.com) + +Windows(TM), Windows 95(TM), Windows 98(TM), Windows ME(TM), Windows NT(TM), +Windows 2000(TM) and Windows XP(TM) are Copyright (C)Microsoft Corporation. +All rights reserved. + + +Goodbye and happy sharing ;) diff --git a/png/ANNOUNCE b/png/ANNOUNCE new file mode 100644 index 0000000..5f6c7c2 --- /dev/null +++ b/png/ANNOUNCE @@ -0,0 +1,39 @@ + +Libpng 1.4.3 - June 26, 2010 + +This is a public release of libpng, intended for use in production codes. + +Files available for download: + +Source files with LF line endings (for Unix/Linux) and with a +"configure" script + + libpng-1.4.3.tar.xz (LZMA-compressed, recommended) + libpng-1.4.3.tar.gz + libpng-1.4.3.tar.bz2 + +Source files with CRLF line endings (for Windows), without the +"configure" script + + lpng143.zip + lpng143.7z + +Other information: + + libpng-1.4.3-README.txt + libpng-1.4.3-LICENSE.txt + +Changes since the last public release (1.4.2): + Added missing quotation marks in the aix block of configure.ac + The new "vstudio" project was missing from the zip and 7z distributions. + Rewrote png_process_IDAT_data to consistently treat extra data as warnings + and handle end conditions more cleanly. + Removed the now-redundant check for out-of-bounds new_row from example.c + Changed char *msg to PNG_CONST char *msg in pngrutil.c + Stop memory leak when reading a malformed sCAL chunk. + +Send comments/corrections/commendations to glennrp at users.sourceforge.net +or to png-mng-implement at lists.sf.net (subscription required; visit +https://lists.sourceforge.net/lists/listinfo/png-mng-implement). + +Glenn R-P diff --git a/png/CHANGES b/png/CHANGES new file mode 100644 index 0000000..0dff489 --- /dev/null +++ b/png/CHANGES @@ -0,0 +1,2619 @@ +#if 0 +libpng_changes(){ /* +CHANGES - changes for libpng + +version 0.2 + added reader into png.h + fixed small problems in stub file + +version 0.3 + added pull reader + split up pngwrite.c to several files + added pnglib.txt + added example.c + cleaned up writer, adding a few new transformations + fixed some bugs in writer + interfaced with zlib 0.5 + added K&R support + added check for 64 KB blocks for 16 bit machines + +version 0.4 + cleaned up code and commented code + simplified time handling into png_time + created png_color_16 and png_color_8 to handle color needs + cleaned up color type defines + fixed various bugs + made various names more consistent + interfaced with zlib 0.71 + cleaned up zTXt reader and writer (using zlib's Reset functions) + split transformations into pngrtran.c and pngwtran.c + +version 0.5 + interfaced with zlib 0.8 + fixed many reading and writing bugs + saved using 3 spaces instead of tabs + +version 0.6 + added png_large_malloc() and png_large_free() + added png_size_t + cleaned up some compiler warnings + added png_start_read_image() + +version 0.7 + cleaned up lots of bugs + finished dithering and other stuff + added test program + changed name from pnglib to libpng + +version 0.71 [June, 1995] + changed pngtest.png for zlib 0.93 + fixed error in libpng.txt and example.c + +version 0.8 + cleaned up some bugs + added png_set_filler() + split up pngstub.c into pngmem.c, pngio.c, and pngerror.c + added #define's to remove unwanted code + moved png_info_init() to png.c + added old_size into png_realloc() + added functions to manually set filtering and compression info + changed compression parameters based on image type + optimized filter selection code + added version info + changed external functions passing floats to doubles (k&r problems?) + put all the configurable stuff in pngconf.h + enabled png_set_shift to work with paletted images on read + added png_read_update_info() - updates info structure with + transformations + +version 0.81 [August, 1995] + incorporated Tim Wegner's medium model code (thanks, Tim) + +version 0.82 [September, 1995] + [unspecified changes] + +version 0.85 [December, 1995] + added more medium model code (almost everything's a far) + added i/o, error, and memory callback functions + fixed some bugs (16 bit, 4 bit interlaced, etc.) + added first run progressive reader (barely tested) + +version 0.86 [January, 1996] + fixed bugs + improved documentation + +version 0.87 [January, 1996] + fixed medium model bugs + fixed other bugs introduced in 0.85 and 0.86 + added some minor documentation + +version 0.88 [January, 1996] + fixed progressive bugs + replaced tabs with spaces + cleaned up documentation + added callbacks for read/write and warning/error functions + +version 0.89 [July, 1996] + added new initialization API to make libpng work better with shared libs + we now have png_create_read_struct(), png_create_write_struct(), + png_create_info_struct(), png_destroy_read_struct(), and + png_destroy_write_struct() instead of the separate calls to + malloc and png_read_init(), png_info_init(), and png_write_init() + changed warning/error callback functions to fix bug - this means you + should use the new initialization API if you were using the old + png_set_message_fn() calls, and that the old API no longer exists + so that people are aware that they need to change their code + changed filter selection API to allow selection of multiple filters + since it didn't work in previous versions of libpng anyways + optimized filter selection code + fixed png_set_background() to allow using an arbitrary RGB color for + paletted images + fixed gamma and background correction for paletted images, so + png_correct_palette is not needed unless you are correcting an + external palette (you will need to #define PNG_CORRECT_PALETTE_SUPPORTED + in pngconf.h) - if nobody uses this, it may disappear in the future. + fixed bug with Borland 64K memory allocation (Alexander Lehmann) + fixed bug in interlace handling (Smarasderagd, I think) + added more error checking for writing and image to reduce invalid files + separated read and write functions so that they won't both be linked + into a binary when only reading or writing functionality is used + new pngtest image also has interlacing and zTXt + updated documentation to reflect new API + +version 0.90 [January, 1997] + made CRC errors/warnings on critical and ancillary chunks configurable + libpng will use the zlib CRC routines by (compile-time) default + changed DOS small/medium model memory support - needs zlib 1.04 (Tim Wegner) + added external C++ wrapper statements to png.h (Gilles Dauphin) + allow PNG file to be read when some or all of file signature has already + been read from the beginning of the stream. ****This affects the size + of info_struct and invalidates all programs that use a shared libpng**** + fixed png_filler() declarations + fixed? background color conversions + fixed order of error function pointers to match documentation + current chunk name is now available in png_struct to reduce the number + of nearly identical error messages (will simplify multi-lingual + support when available) + try to get ready for unknown-chunk callback functions: + - previously read critical chunks are flagged, so the chunk handling + routines can determine if the chunk is in the right place + - all chunk handling routines have the same prototypes, so we will + be able to handle all chunks via a callback mechanism + try to fix Linux "setjmp" buffer size problems + removed png_large_malloc, png_large_free, and png_realloc functions. + +version 0.95 [March, 1997] + fixed bug in pngwutil.c allocating "up_row" twice and "avg_row" never + fixed bug in PNG file signature compares when start != 0 + changed parameter type of png_set_filler(...filler...) from png_byte + to png_uint_32 + added test for MACOS to ensure that both math.h and fp.h are not #included + added macros for libpng to be compiled as a Windows DLL (Andreas Kupries) + added "packswap" transformation, which changes the endianness of + packed-pixel bytes (Kevin Bracey) + added "strip_alpha" transformation, which removes the alpha channel of + input images without using it (not necessarily a good idea) + added "swap_alpha" transformation, which puts the alpha channel in front + of the color bytes instead of after + removed all implicit variable tests which assume NULL == 0 (I think) + changed several variables to "png_size_t" to show 16/32-bit limitations + added new pCAL chunk read/write support + added experimental filter selection weighting (Greg Roelofs) + removed old png_set_rgbx() and png_set_xrgb() functions that have been + obsolete for about 2 years now (use png_set_filler() instead) + added macros to read 16- and 32-bit ints directly from buffer, to be + used only on those systems that support it (namely PowerPC and 680x0) + With some testing, this may become the default for MACOS/PPC systems. + only calculate CRC on data if we are going to use it + added macros for zTXt compression type PNG_zTXt_COMPRESSION_??? + added macros for simple libpng debugging output selectable at compile time + removed PNG_READ_END_MODE in progressive reader (Smarasderagd) + more description of info_struct in libpng.txt and png.h + more instructions in example.c + more chunk types tested in pngtest.c + renamed pngrcb.c to pngset.c, and all png_read_ functions to be + png_set_. We now have corresponding png_get_ + functions in pngget.c to get information in info_ptr. This isolates + the application from the internal organization of png_info_struct + (good for shared library implementations). + +version 0.96 [May, 1997] + fixed serious bug with < 8bpp images introduced in 0.95 + fixed 256-color transparency bug (Greg Roelofs) + fixed up documentation (Greg Roelofs, Laszlo Nyul) + fixed "error" in pngconf.h for Linux setjmp() behaviour + fixed DOS medium model support (Tim Wegner) + fixed png_check_keyword() for case with error in static string text + added read of CRC after IEND chunk for embedded PNGs (Laszlo Nyul) + added typecasts to quiet compiler errors + added more debugging info + +version 0.97 [January, 1998] + removed PNG_USE_OWN_CRC capability + relocated png_set_crc_action from pngrutil.c to pngrtran.c + fixed typecasts of "new_key", etc. (Andreas Dilger) + added RFC 1152 [sic] date support + fixed bug in gamma handling of 4-bit grayscale + added 2-bit grayscale gamma handling (Glenn R-P) + added more typecasts. 65536L becomes (png_uint_32)65536L, etc. (Glenn R-P) + minor corrections in libpng.txt + added simple sRGB support (Glenn R-P) + easier conditional compiling, e.g. define PNG_READ/WRITE_NOT_FULLY_SUPPORTED; + all configurable options can be selected from command-line instead + of having to edit pngconf.h (Glenn R-P) + fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P) + added more conditions for png_do_background, to avoid changing + black pixels to background when a background is supplied and + no pixels are transparent + repaired PNG_NO_STDIO behaviour + tested NODIV support and made it default behaviour (Greg Roelofs) + added "-m" option and PNGTEST_DEBUG_MEMORY to pngtest (John Bowler) + regularized version numbering scheme and bumped shared-library major + version number to 2 to avoid problems with libpng 0.89 apps (Greg Roelofs) + +version 0.98 [January, 1998] + cleaned up some typos in libpng.txt and in code documentation + fixed memory leaks in pCAL chunk processing (Glenn R-P and John Bowler) + cosmetic change "display_gamma" to "screen_gamma" in pngrtran.c + changed recommendation about file_gamma for PC images to .51 from .45, + in example.c and libpng.txt, added comments to distinguish between + screen_gamma, viewing_gamma, and display_gamma. + changed all references to RFC1152 to read RFC1123 and changed the + PNG_TIME_RFC1152_SUPPORTED macro to PNG_TIME_RFC1123_SUPPORTED + added png_invert_alpha capability (Glenn R-P -- suggestion by Jon Vincent) + changed srgb_intent from png_byte to int to avoid compiler bugs + +version 0.99 [January 30, 1998] + free info_ptr->text instead of end_info_ptr->text in pngread.c (John Bowler) + fixed a longstanding "packswap" bug in pngtrans.c + fixed some inconsistencies in pngconf.h that prevented compiling with + PNG_READ_GAMMA_SUPPORTED and PNG_READ_hIST_SUPPORTED undefined + fixed some typos and made other minor rearrangement of libpng.txt (Andreas) + changed recommendation about file_gamma for PC images to .50 from .51 in + example.c and libpng.txt, and changed file_gamma for sRGB images to .45 + added a number of functions to access information from the png structure + png_get_image_height(), etc. (Glenn R-P, suggestion by Brad Pettit) + added TARGET_MACOS similar to zlib-1.0.8 + define PNG_ALWAYS_EXTERN when __MWERKS__ && WIN32 are defined + added type casting to all png_malloc() function calls +version 0.99a [January 31, 1998] + Added type casts and parentheses to all returns that return a value.(Tim W.) +version 0.99b [February 4, 1998] + Added type cast png_uint_32 on malloc function calls where needed. + Changed type of num_hist from png_uint_32 to int (same as num_palette). + Added checks for rowbytes overflow, in case png_size_t is less than 32 bits. + Renamed makefile.elf to makefile.lnx. +version 0.99c [February 7, 1998] + More type casting. Removed erroneous overflow test in pngmem.c. + Added png_buffered_memcpy() and png_buffered_memset(), apply them to rowbytes. + Added UNIX manual pages libpng.3 (incorporating libpng.txt) and png.5. +version 0.99d [February 11, 1998] + Renamed "far_to_near()" "png_far_to_near()" + Revised libpng.3 + Version 99c "buffered" operations didn't work as intended. Replaced them + with png_memcpy_check() and png_memset_check(). + Added many "if (png_ptr == NULL) return" to quell compiler warnings about + unused png_ptr, mostly in pngget.c and pngset.c. + Check for overlength tRNS chunk present when indexed-color PLTE is read. + Cleaned up spelling errors in libpng.3/libpng.txt + Corrected a problem with png_get_tRNS() which returned undefined trans array +version 0.99e [February 28, 1998] + Corrected png_get_tRNS() again. + Add parentheses for easier reading of pngget.c, fixed "||" should be "&&". + Touched up example.c to make more of it compileable, although the entire + file still can't be compiled (Willem van Schaik) + Fixed a bug in png_do_shift() (Bryan Tsai) + Added a space in png.h prototype for png_write_chunk_start() + Replaced pngtest.png with one created with zlib 1.1.1 + Changed pngtest to report PASS even when file size is different (Jean-loup G.) + Corrected some logic errors in png_do_invert_alpha() (Chris Patterson) +version 0.99f [March 5, 1998] + Corrected a bug in pngpread() introduced in version 99c (Kevin Bracey) + Moved makefiles into a "scripts" directory, and added INSTALL instruction file + Added makefile.os2 and pngos2.def (A. Zabolotny) and makefile.s2x (W. Sebok) + Added pointers to "note on libpng versions" in makefile.lnx and README + Added row callback feature when reading and writing nonprogressive rows + and added a test of this feature in pngtest.c + Added user transform callbacks, with test of the feature in pngtest.c +version 0.99g [March 6, 1998, morning] + Minor changes to pngtest.c to suppress compiler warnings. + Removed "beta" language from documentation. +version 0.99h [March 6, 1998, evening] + Minor changes to previous minor changes to pngtest.c + Changed PNG_READ_NOT_FULLY_SUPPORTED to PNG_READ_TRANSFORMS_NOT_SUPPORTED + and added PNG_PROGRESSIVE_READ_NOT_SUPPORTED macro + Added user transform capability + +version 1.00 [March 7, 1998] + Changed several typedefs in pngrutil.c + Added makefile.wat (Pawel Mrochen), updated makefile.tc3 (Willem van Schaik) + replaced "while(1)" with "for(;;)" + added PNGARG() to prototypes in pngtest.c and removed some prototypes + updated some of the makefiles (Tom Lane) + changed some typedefs (s_start, etc.) in pngrutil.c + fixed dimensions of "short_months" array in pngwrite.c + Replaced ansi2knr.c with the one from jpeg-v6 + +version 1.0.0 [March 8, 1998] + Changed name from 1.00 to 1.0.0 (Adam Costello) + Added smakefile.ppc (with SCOPTIONS.ppc) for Amiga PPC (Andreas Kleinert) +version 1.0.0a [March 9, 1998] + Fixed three bugs in pngrtran.c to make gamma+background handling consistent + (Greg Roelofs) + Changed format of the PNG_LIBPNG_VER integer to xyyzz instead of xyz + for major, minor, and bugfix releases. This is 10001. (Adam Costello, + Tom Lane) + Make months range from 1-12 in png_convert_to_rfc1123 +version 1.0.0b [March 13, 1998] + Quieted compiler complaints about two empty "for" loops in pngrutil.c + Minor changes to makefile.s2x + Removed #ifdef/#endif around a png_free() in pngread.c + +version 1.0.1 [March 14, 1998] + Changed makefile.s2x to reduce security risk of using a relative pathname + Fixed some typos in the documentation (Greg). + Fixed a problem with value of "channels" returned by png_read_update_info() +version 1.0.1a [April 21, 1998] + Optimized Paeth calculations by replacing abs() function calls with intrinsics + plus other loop optimizations. Improves avg decoding speed by about 20%. + Commented out i386istic "align" compiler flags in makefile.lnx. + Reduced the default warning level in some makefiles, to make them consistent. + Removed references to IJG and JPEG in the ansi2knr.c copyright statement. + Fixed a bug in png_do_strip_filler with XXRRGGBB => RRGGBB transformation. + Added grayscale and 16-bit capability to png_do_read_filler(). + Fixed a bug in pngset.c, introduced in version 0.99c, that sets rowbytes + too large when writing an image with bit_depth < 8 (Bob Dellaca). + Corrected some bugs in the experimental weighted filtering heuristics. + Moved a misplaced pngrutil code block that truncates tRNS if it has more + than num_palette entries -- test was done before num_palette was defined. + Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins). + Changed compiler flags in makefile.wat for better optimization (Pawel Mrochen). +version 1.0.1b [May 2, 1998] + Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg). + Relocated the png_composite macros from pngrtran.c to png.h (Greg). + Added makefile.sco (contributed by Mike Hopkirk). + Fixed two bugs (missing definitions of "istop") introduced in libpng-1.0.1a. + Fixed a bug in pngrtran.c that would set channels=5 under some circumstances. + More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert). + More work on loop optimization which may help when compiled with C++ compilers. + Added warnings when people try to use transforms they've defined out. + Collapsed 4 "i" and "c" loops into single "i" loops in pngrtran and pngwtran. + Revised paragraph about png_set_expand() in libpng.txt and libpng.3 (Greg) +version 1.0.1c [May 11, 1998] + Fixed a bug in pngrtran.c (introduced in libpng-1.0.1a) where the masks for + filler bytes should have been 0xff instead of 0xf. + Added max_pixel_depth=32 in pngrutil.c when using FILLER with palette images. + Moved PNG_WRITE_WEIGHTED_FILTER_SUPPORTED and PNG_WRITE_FLUSH_SUPPORTED + out of the PNG_WRITE_TRANSFORMS_NOT_SUPPORTED block of pngconf.h + Added "PNG_NO_WRITE_TRANSFORMS" etc., as alternatives for *_NOT_SUPPORTED, + for consistency, in pngconf.h + Added individual "ifndef PNG_NO_[CAPABILITY]" in pngconf.h to make it easier + to remove unwanted capabilities via the compile line + Made some corrections to grammar (which, it's) in documentation (Greg). + Corrected example.c, use of row_pointers in png_write_image(). +version 1.0.1d [May 24, 1998] + Corrected several statements that used side effects illegally in pngrutil.c + and pngtrans.c, that were introduced in version 1.0.1b + Revised png_read_rows() to avoid repeated if-testing for NULL (A Kleinert) + More corrections to example.c, use of row_pointers in png_write_image() + and png_read_rows(). + Added pngdll.mak and pngdef.pas to scripts directory, contributed by + Bob Dellaca, to make a png32bd.dll with Borland C++ 4.5 + Fixed error in example.c with png_set_text: num_text is 3, not 2 (Guido V.) + Changed several loops from count-down to count-up, for consistency. +version 1.0.1e [June 6, 1998] + Revised libpng.txt and libpng.3 description of png_set_read|write_fn(), and + added warnings when people try to set png_read_fn and png_write_fn in + the same structure. + Added a test such that png_do_gamma will be done when num_trans==0 + for truecolor images that have defined a background. This corrects an + error that was introduced in libpng-0.90 that can cause gamma processing + to be skipped. + Added tests in png.h to include "trans" and "trans_values" in structures + when PNG_READ_BACKGROUND_SUPPORTED or PNG_READ_EXPAND_SUPPORTED is defined. + Add png_free(png_ptr->time_buffer) in png_destroy_read_struct() + Moved png_convert_to_rfc_1123() from pngwrite.c to png.c + Added capability for user-provided malloc_fn() and free_fn() functions, + and revised pngtest.c to demonstrate their use, replacing the + PNGTEST_DEBUG_MEM feature. + Added makefile.w32, for Microsoft C++ 4.0 and later (Tim Wegner). + +version 1.0.2 [June 14, 1998] + Fixed two bugs in makefile.bor . +version 1.0.2a [December 30, 1998] + Replaced and extended code that was removed from png_set_filler() in 1.0.1a. + Fixed a bug in png_do_filler() that made it fail to write filler bytes in + the left-most pixel of each row (Kevin Bracey). + Changed "static pngcharp tIME_string" to "static char tIME_string[30]" + in pngtest.c (Duncan Simpson). + Fixed a bug in pngtest.c that caused pngtest to try to write a tIME chunk + even when no tIME chunk was present in the source file. + Fixed a problem in pngrutil.c: gray_to_rgb didn't always work with 16-bit. + Fixed a problem in png_read_push_finish_row(), which would not skip some + passes that it should skip, for images that are less than 3 pixels high. + Interchanged the order of calls to png_do_swap() and png_do_shift() + in pngwtran.c (John Cromer). + Added #ifdef PNG_DEBUG/#endif surrounding use of PNG_DEBUG in png.h . + Changed "bad adaptive filter type" from error to warning in pngrutil.c . + Fixed a documentation error about default filtering with 8-bit indexed-color. + Separated the PNG_NO_STDIO macro into PNG_NO_STDIO and PNG_NO_CONSOLE_IO + (L. Peter Deutsch). + Added png_set_rgb_to_gray() and png_get_rgb_to_gray_status() functions. + Added png_get_copyright() and png_get_header_version() functions. + Revised comments on png_set_progressive_read_fn() in libpng.txt and example.c + Added information about debugging in libpng.txt and libpng.3 . + Changed "ln -sf" to "ln -s -f" in makefile.s2x, makefile.lnx, and makefile.sco. + Removed lines after Dynamic Dependencies" in makefile.aco . + Revised makefile.dec to make a shared library (Jeremie Petit). + Removed trailing blanks from all files. +version 1.0.2a [January 6, 1999] + Removed misplaced #endif and #ifdef PNG_NO_EXTERN near the end of png.h + Added "if" tests to silence complaints about unused png_ptr in png.h and png.c + Changed "check_if_png" function in example.c to return true (nonzero) if PNG. + Changed libpng.txt to demonstrate png_sig_cmp() instead of png_check_sig() + which is obsolete. + +version 1.0.3 [January 14, 1999] + Added makefile.hux, for Hewlett Packard HPUX 10.20 and 11.00 (Jim Rice) + Added a statement of Y2K compliance in png.h, libpng.3, and Y2KINFO. +version 1.0.3a [August 12, 1999] + Added check for PNG_READ_INTERLACE_SUPPORTED in pngread.c; issue a warning + if an attempt is made to read an interlaced image when it's not supported. + Added check if png_ptr->trans is defined before freeing it in pngread.c + Modified the Y2K statement to include versions back to version 0.71 + Fixed a bug in the check for valid IHDR bit_depth/color_types in pngrutil.c + Modified makefile.wat (added -zp8 flag, ".symbolic", changed some comments) + Replaced leading blanks with tab characters in makefile.hux + Changed "dworkin.wustl.edu" to "ccrc.wustl.edu" in various documents. + Changed (float)red and (float)green to (double)red, (double)green + in png_set_rgb_to_gray() to avoid "promotion" problems in AIX. + Fixed a bug in pngconf.h that omitted when PNG_DEBUG==0 (K Bracey). + Reformatted libpng.3 and libpngpf.3 with proper fonts (script by J. vanZandt). + Updated documentation to refer to the PNG-1.2 specification. + Removed ansi2knr.c and left pointers to the latest source for ansi2knr.c + in makefile.knr, INSTALL, and README (L. Peter Deutsch) + Fixed bugs in calculation of the length of rowbytes when adding alpha + channels to 16-bit images, in pngrtran.c (Chris Nokleberg) + Added function png_set_user_transform_info() to store user_transform_ptr, + user_depth, and user_channels into the png_struct, and a function + png_get_user_transform_ptr() to retrieve the pointer (Chris Nokleberg) + Added function png_set_empty_plte_permitted() to make libpng useable + in MNG applications. + Corrected the typedef for png_free_ptr in png.h (Jesse Jones). + Correct gamma with srgb is 45455 instead of 45000 in pngrutil.c, to be + consistent with PNG-1.2, and allow variance of 500 before complaining. + Added assembler code contributed by Intel in file pngvcrd.c and modified + makefile.w32 to use it (Nirav Chhatrapati, INTEL Corporation, Gilles Vollant) + Changed "ln -s -f" to "ln -f -s" in the makefiles to make Solaris happy. + Added some aliases for png_set_expand() in pngrtran.c, namely + png_set_expand_PLTE(), png_set_expand_depth(), and png_set_expand_tRNS() + (Greg Roelofs, in "PNG: The Definitive Guide"). + Added makefile.beo for BEOS on X86, contributed by Sander Stok. +version 1.0.3b [August 26, 1999] + Replaced 2147483647L several places with PNG_MAX_UINT macro, defined in png.h + Changed leading blanks to tabs in all makefiles. + Define PNG_USE_PNGVCRD in makefile.w32, to get MMX assembler code. + Made alternate versions of png_set_expand() in pngrtran.c, namely + png_set_gray_1_2_4_to_8, png_set_palette_to_rgb, and png_set_tRNS_to_alpha + (Greg Roelofs, in "PNG: The Definitive Guide"). Deleted the 1.0.3a aliases. + Relocated start of 'extern "C"' block in png.h so it doesn't include pngconf.h + Revised calculation of num_blocks in pngmem.c to avoid a potentially + negative shift distance, whose results are undefined in the C language. + Added a check in pngset.c to prevent writing multiple tIME chunks. + Added a check in pngwrite.c to detect invalid small window_bits sizes. +version 1.0.3d [September 4, 1999] + Fixed type casting of igamma in pngrutil.c + Added new png_expand functions to scripts/pngdef.pas and pngos2.def + Added a demo read_user_transform_fn that examines the row filters in pngtest.c + +version 1.0.4 [September 24, 1999] + Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined + Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h + Made several minor corrections to pngtest.c + Renamed the makefiles with longer but more user friendly extensions. + Copied the PNG copyright and license to a separate LICENSE file. + Revised documentation, png.h, and example.c to remove reference to + "viewing_gamma" which no longer appears in the PNG specification. + Revised pngvcrd.c to use MMX code for interlacing only on the final pass. + Updated pngvcrd.c to use the faster C filter algorithms from libpng-1.0.1a + Split makefile.win32vc into two versions, makefile.vcawin32 (uses MMX + assembler code) and makefile.vcwin32 (doesn't). + Added a CPU timing report to pngtest.c (enabled by defining PNGTEST_TIMING) + Added a copy of pngnow.png to the distribution. +version 1.0.4a [September 25, 1999] + Increase max_pixel_depth in pngrutil.c if a user transform needs it. + Changed several division operations to right-shifts in pngvcrd.c +version 1.0.4b [September 30, 1999] + Added parentheses in line 3732 of pngvcrd.c + Added a comment in makefile.linux warning about buggy -O3 in pgcc 2.95.1 +version 1.0.4c [October 1, 1999] + Added a "png_check_version" function in png.c and pngtest.c that will generate + a helpful compiler error if an old png.h is found in the search path. + Changed type of png_user_transform_depth|channels from int to png_byte. +version 1.0.4d [October 6, 1999] + Changed 0.45 to 0.45455 in png_set_sRGB() + Removed unused PLTE entries from pngnow.png + Re-enabled some parts of pngvcrd.c (png_combine_row) that work properly. +version 1.0.4e [October 10, 1999] + Fixed sign error in pngvcrd.c (Greg Roelofs) + Replaced some instances of memcpy with simple assignments in pngvcrd (GR-P) +version 1.0.4f [October 15, 1999] + Surrounded example.c code with #if 0 .. #endif to prevent people from + inadvertently trying to compile it. + Changed png_get_header_version() from a function to a macro in png.h + Added type casting mostly in pngrtran.c and pngwtran.c + Removed some pointless "ptr = NULL" in pngmem.c + Added a "contrib" directory containing the source code from Greg's book. + +version 1.0.5 [October 15, 1999] + Minor editing of the INSTALL and README files. +version 1.0.5a [October 23, 1999] + Added contrib/pngsuite and contrib/pngminus (Willem van Schaik) + Fixed a typo in the png_set_sRGB() function call in example.c (Jan Nijtmans) + Further optimization and bugfix of pngvcrd.c + Revised pngset.c so that it does not allocate or free memory in the user's + text_ptr structure. Instead, it makes its own copy. + Created separate write_end_info_struct in pngtest.c for a more severe test. + Added code in pngwrite.c to free info_ptr->text[i].key to stop a memory leak. +version 1.0.5b [November 23, 1999] + Moved PNG_FLAG_HAVE_CHUNK_HEADER, PNG_FLAG_BACKGROUND_IS_GRAY and + PNG_FLAG_WROTE_tIME from flags to mode. + Added png_write_info_before_PLTE() function. + Fixed some typecasting in contrib/gregbook/*.c + Updated scripts/makevms.com and added makevms.com to contrib/gregbook + and contrib/pngminus (Martin Zinser) +version 1.0.5c [November 26, 1999] + Moved png_get_header_version from png.h to png.c, to accommodate ansi2knr. + Removed all global arrays (according to PNG_NO_GLOBAL_ARRAYS macro), to + accommodate making DLL's: Moved usr_png_ver from global variable to function + png_get_header_ver() in png.c. Moved png_sig to png_sig_bytes in png.c and + eliminated use of png_sig in pngwutil.c. Moved the various png_CHNK arrays + into pngtypes.h. Eliminated use of global png_pass arrays. Declared the + png_CHNK and png_pass arrays to be "const". Made the global arrays + available to applications (although none are used in libpng itself) when + PNG_NO_GLOBAL_ARRAYS is not defined or when PNG_GLOBAL_ARRAYS is defined. + Removed some extraneous "-I" from contrib/pngminus/makefile.std + Changed the PNG_sRGB_INTENT macros in png.h to be consistent with PNG-1.2. + Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3 +version 1.0.5d [November 29, 1999] + Add type cast (png_const_charp) two places in png.c + Eliminated pngtypes.h; use macros instead to declare PNG_CHNK arrays. + Renamed "PNG_GLOBAL_ARRAYS" to "PNG_USE_GLOBAL_ARRAYS" and made available + to applications a macro "PNG_USE_LOCAL_ARRAYS". + comment out (with #ifdef) all the new declarations when + PNG_USE_GLOBAL_ARRAYS is defined. + Added PNG_EXPORT_VAR macro to accommodate making DLL's. +version 1.0.5e [November 30, 1999] + Added iCCP, iTXt, and sPLT support; added "lang" member to the png_text + structure; refactored the inflate/deflate support to make adding new chunks + with trailing compressed parts easier in the future, and added new functions + png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP, + png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond). + NOTE: Applications that write text chunks MUST define png_text->lang + before calling png_set_text(). It must be set to NULL if you want to + write tEXt or zTXt chunks. If you want your application to be able to + run with older versions of libpng, use + + #ifdef PNG_iTXt_SUPPORTED + png_text[i].lang = NULL; + #endif + + Changed png_get_oFFs() and png_set_oFFs() to use signed rather than unsigned + offsets (Eric S. Raymond). + Combined PNG_READ_cHNK_SUPPORTED and PNG_WRITE_cHNK_SUPPORTED macros into + PNG_cHNK_SUPPORTED and combined the three types of PNG_text_SUPPORTED + macros, leaving the separate macros also available. + Removed comments on #endifs at the end of many short, non-nested #if-blocks. +version 1.0.5f [December 6, 1999] + Changed makefile.solaris to issue a warning about potential problems when + the ucb "ld" is in the path ahead of the ccs "ld". + Removed "- [date]" from the "synopsis" line in libpng.3 and libpngpf.3. + Added sCAL chunk support (Eric S. Raymond). +version 1.0.5g [December 7, 1999] + Fixed "png_free_spallettes" typo in png.h + Added code to handle new chunks in pngpread.c + Moved PNG_CHNK string macro definitions outside of PNG_NO_EXTERN block + Added "translated_key" to png_text structure and png_write_iTXt(). + Added code in pngwrite.c to work around a newly discovered zlib bug. +version 1.0.5h [December 10, 1999] + NOTE: regarding the note for version 1.0.5e, the following must also + be included in your code: + png_text[i].translated_key = NULL; + Unknown chunk handling is now supported. + Option to eliminate all floating point support was added. Some new + fixed-point functions such as png_set_gAMA_fixed() were added. + Expanded tabs and removed trailing blanks in source files. +version 1.0.5i [December 13, 1999] + Added some type casts to silence compiler warnings. + Renamed "png_free_spalette" to "png_free_spalettes" for consistency. + Removed leading blanks from a #define in pngvcrd.c + Added some parameters to the new png_set_keep_unknown_chunks() function. + Added a test for up->location != 0 in the first instance of writing + unknown chunks in pngwrite.c + Changed "num" to "i" in png_free_spalettes() and png_free_unknowns() to + prevent recursion. + Added png_free_hIST() function. + Various patches to fix bugs in the sCAL and integer cHRM processing, + and to add some convenience macros for use with sCAL. +version 1.0.5j [December 21, 1999] + Changed "unit" parameter of png_write_sCAL from png_byte to int, to work + around buggy compilers. + Added new type "png_fixed_point" for integers that hold float*100000 values + Restored backward compatibility of tEXt/zTXt chunk processing: + Restored the first four members of png_text to the same order as v.1.0.5d. + Added members "lang_key" and "itxt_length" to png_text struct. Set + text_length=0 when "text" contains iTXt data. Use the "compression" + member to distinguish among tEXt/zTXt/iTXt types. Added + PNG_ITXT_COMPRESSION_NONE (1) and PNG_ITXT_COMPRESSION_zTXt(2) macros. + The "Note" above, about backward incompatibility of libpng-1.0.5e, no + longer applies. + Fixed png_read|write_iTXt() to read|write parameters in the right order, + and to write the iTXt chunk after IDAT if it appears in the end_ptr. + Added pnggccrd.c, version of pngvcrd.c Intel assembler for gcc (Greg Roelofs) + Reversed the order of trying to write floating-point and fixed-point gAMA. +version 1.0.5k [December 27, 1999] + Added many parentheses, e.g., "if (a && b & c)" becomes "if (a && (b & c))" + Added png_handle_as_unknown() function (Glenn) + Added png_free_chunk_list() function and chunk_list and num_chunk_list members + of png_ptr. + Eliminated erroneous warnings about multiple sPLT chunks and sPLT-after-PLTE. + Fixed a libpng-1.0.5h bug in pngrutil.c that was issuing erroneous warnings + about ignoring incorrect gAMA with sRGB (gAMA was in fact not ignored) + Added png_free_tRNS(); png_set_tRNS() now malloc's its own trans array (ESR). + Define png_get_int_32 when oFFs chunk is supported as well as when pCAL is. + Changed type of proflen from png_int_32 to png_uint_32 in png_get_iCCP(). +version 1.0.5l [January 1, 2000] + Added functions png_set_read_user_chunk_fn() and png_get_user_chunk_ptr() + for setting a callback function to handle unknown chunks and for + retrieving the associated user pointer (Glenn). +version 1.0.5m [January 7, 2000] + Added high-level functions png_read_png(), png_write_png(), png_free_pixels(). +version 1.0.5n [January 9, 2000] + Added png_free_PLTE() function, and modified png_set_PLTE() to malloc its + own memory for info_ptr->palette. This makes it safe for the calling + application to free its copy of the palette any time after it calls + png_set_PLTE(). +version 1.0.5o [January 20, 2000] + Cosmetic changes only (removed some trailing blanks and TABs) +version 1.0.5p [January 31, 2000] + Renamed pngdll.mak to makefile.bd32 + Cosmetic changes in pngtest.c +version 1.0.5q [February 5, 2000] + Relocated the makefile.solaris warning about PATH problems. + Fixed pngvcrd.c bug by pushing/popping registers in mmxsupport (Bruce Oberg) + Revised makefile.gcmmx + Added PNG_SETJMP_SUPPORTED, PNG_SETJMP_NOT_SUPPORTED, and PNG_ABORT() macros +version 1.0.5r [February 7, 2000] + Removed superfluous prototype for png_get_itxt from png.h + Fixed a bug in pngrtran.c that improperly expanded the background color. + Return *num_text=0 from png_get_text() when appropriate, and fix documentation + of png_get_text() in libpng.txt/libpng.3. +version 1.0.5s [February 18, 2000] + Added "png_jmp_env()" macro to pngconf.h, to help people migrate to the + new error handler that's planned for the next libpng release, and changed + example.c, pngtest.c, and contrib programs to use this macro. + Revised some of the DLL-export macros in pngconf.h (Greg Roelofs) + Fixed a bug in png_read_png() that caused it to fail to expand some images + that it should have expanded. + Fixed some mistakes in the unused and undocumented INCH_CONVERSIONS functions + in pngget.c + Changed the allocation of palette, history, and trans arrays back to + the version 1.0.5 method (linking instead of copying) which restores + backward compatibility with version 1.0.5. Added some remarks about + that in example.c. Added "free_me" member to info_ptr and png_ptr + and added png_free_data() function. + Updated makefile.linux and makefile.gccmmx to make directories conditionally. + Made cosmetic changes to pngasmrd.h + Added png_set_rows() and png_get_rows(), for use with png_read|write_png(). + Modified png_read_png() to allocate info_ptr->row_pointers only if it + hasn't already been allocated. +version 1.0.5t [March 4, 2000] + Changed png_jmp_env() migration aiding macro to png_jmpbuf(). + Fixed "interlace" typo (should be "interlaced") in contrib/gregbook/read2-x.c + Fixed bug with use of PNG_BEFORE_IHDR bit in png_ptr->mode, introduced when + PNG_FLAG_HAVE_CHUNK_HEADER was moved into png_ptr->mode in version 1.0.5b + Files in contrib/gregbook were revised to use png_jmpbuf() and to select + a 24-bit visual if one is available, and to allow abbreviated options. + Files in contrib/pngminus were revised to use the png_jmpbuf() macro. + Removed spaces in makefile.linux and makefile.gcmmx, introduced in 1.0.5s +version 1.0.5u [March 5, 2000] + Simplified the code that detects old png.h in png.c and pngtest.c + Renamed png_spalette (_p, _pp) to png_sPLT_t (_tp, _tpp) + Increased precision of rgb_to_gray calculations from 8 to 15 bits and + added png_set_rgb_to_gray_fixed() function. + Added makefile.bc32 (32-bit Borland C++, C mode) +version 1.0.5v [March 11, 2000] + Added some parentheses to the png_jmpbuf macro definition. + Updated references to the zlib home page, which has moved to freesoftware.com. + Corrected bugs in documentation regarding png_read_row() and png_write_row(). + Updated documentation of png_rgb_to_gray calculations in libpng.3/libpng.txt. + Renamed makefile.borland,turboc3 back to makefile.bor,tc3 as in version 1.0.3, + revised borland makefiles; added makefile.ibmvac3 and makefile.gcc (Cosmin) + +version 1.0.6 [March 20, 2000] + Minor revisions of makefile.bor, libpng.txt, and gregbook/rpng2-win.c + Added makefile.sggcc (SGI IRIX with gcc) +version 1.0.6d [April 7, 2000] + Changed sprintf() to strcpy() in png_write_sCAL_s() to work without STDIO + Added data_length parameter to png_decompress_chunk() function + Revised documentation to remove reference to abandoned png_free_chnk functions + Fixed an error in png_rgb_to_gray_fixed() + Revised example.c, usage of png_destroy_write_struct(). + Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file + Added a check for info_ptr->free_me&PNG_FREE_TEXT when freeing text in png.c + Simplify png_sig_bytes() function to remove use of non-ISO-C strdup(). +version 1.0.6e [April 9, 2000] + Added png_data_freer() function. + In the code that checks for over-length tRNS chunks, added check of + info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann) + Minor revisions of libpng.txt/libpng.3. + Check for existing data and free it if the free_me flag is set, in png_set_*() + and png_handle_*(). + Only define PNG_WEIGHTED_FILTERS_SUPPORTED when PNG_FLOATING_POINT_SUPPORTED + is defined. + Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c + and mentioned the purposes of the two macros in libpng.txt/libpng.3. +version 1.0.6f [April 14, 2000] + Revised png_set_iCCP() and png_set_rows() to avoid prematurely freeing data. + Add checks in png_set_text() for NULL members of the input text structure. + Revised libpng.txt/libpng.3. + Removed superfluous prototype for png_set_itxt from png.h + Removed "else" from pngread.c, after png_error(), and changed "0" to "length". + Changed several png_errors about malformed ancillary chunks to png_warnings. +version 1.0.6g [April 24, 2000] + Added png_pass-* arrays to pnggccrd.c when PNG_USE_LOCAL_ARRAYS is defined. + Relocated paragraph about png_set_background() in libpng.3/libpng.txt + and other revisions (Matthias Benckmann) + Relocated info_ptr->free_me, png_ptr->free_me, and other info_ptr and + png_ptr members to restore binary compatibility with libpng-1.0.5 + (breaks compatibility with libpng-1.0.6). +version 1.0.6h [April 24, 2000] + Changed shared library so-number pattern from 2.x.y.z to xy.z (this builds + libpng.so.10 & libpng.so.10.6h instead of libpng.so.2 & libpng.so.2.1.0.6h) + This is a temporary change for test purposes. +version 1.0.6i [May 2, 2000] + Rearranged some members at the end of png_info and png_struct, to put + unknown_chunks_num and free_me within the original size of the png_structs + and free_me, png_read_user_fn, and png_free_fn within the original png_info, + because some old applications allocate the structs directly instead of + using png_create_*(). + Added documentation of user memory functions in libpng.txt/libpng.3 + Modified png_read_png so that it will use user_allocated row_pointers + if present, unless free_me directs that it be freed, and added description + of the use of png_set_rows() and png_get_rows() in libpng.txt/libpng.3. + Added PNG_LEGACY_SUPPORTED macro, and #ifdef out all new (since version + 1.00) members of png_struct and png_info, to regain binary compatibility + when you define this macro. Capabilities lost in this event + are user transforms (new in version 1.0.0),the user transform pointer + (new in version 1.0.2), rgb_to_gray (new in 1.0.5), iCCP, sCAL, sPLT, + the high-level interface, and unknown chunks support (all new in 1.0.6). + This was necessary because of old applications that allocate the structs + directly as authors were instructed to do in libpng-0.88 and earlier, + instead of using png_create_*(). + Added modes PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT which + can be used to detect codes that directly allocate the structs, and + code to check these modes in png_read_init() and png_write_init() and + generate a libpng error if the modes aren't set and PNG_LEGACY_SUPPORTED + was not defined. + Added makefile.intel and updated makefile.watcom (Pawel Mrochen) +version 1.0.6j [May 3, 2000] + Overloaded png_read_init() and png_write_init() with macros that convert + calls to png_read_init_2() or png_write_init_2() that check the version + and structure sizes. +version 1.0.7beta11 [May 7, 2000] + Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes + which are no longer used. + Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is + defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXT_SUPPORTED + is defined. + Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory + overrun when old applications fill the info_ptr->text structure directly. + Added PNGAPI macro, and added it to the definitions of all exported functions. + Relocated version macro definitions ahead of the includes of zlib.h and + pngconf.h in png.h. +version 1.0.7beta12 [May 12, 2000] + Revised pngset.c to avoid a problem with expanding the png_debug macro. + Deleted some extraneous defines from pngconf.h + Made PNG_NO_CONSOLE_IO the default condition when PNG_BUILD_DLL is defined. + Use MSC _RPTn debugging instead of fprintf if _MSC_VER is defined. + Added png_access_version_number() function. + Check for mask&PNG_FREE_CHNK (for TEXT, SCAL, PCAL) in png_free_data(). + Expanded libpng.3/libpng.txt information about png_data_freer(). +version 1.0.7beta14 [May 17, 2000] (beta13 was not published) + Changed pnggccrd.c and pngvcrd.c to handle bad adaptive filter types as + warnings instead of errors, as pngrutil.c does. + Set the PNG_INFO_IDAT valid flag in png_set_rows() so png_write_png() + will actually write IDATs. + Made the default PNG_USE_LOCAL_ARRAYS depend on PNG_DLL instead of WIN32. + Make png_free_data() ignore its final parameter except when freeing data + that can have multiple instances (text, sPLT, unknowns). + Fixed a new bug in png_set_rows(). + Removed info_ptr->valid tests from png_free_data(), as in version 1.0.5. + Added png_set_invalid() function. + Fixed incorrect illustrations of png_destroy_write_struct() in example.c. +version 1.0.7beta15 [May 30, 2000] + Revised the deliberately erroneous Linux setjmp code in pngconf.h to produce + fewer error messages. + Rearranged checks for Z_OK to check the most likely path first in pngpread.c + and pngwutil.c. + Added checks in pngtest.c for png_create_*() returning NULL, and mentioned + in libpng.txt/libpng.3 the need for applications to check this. + Changed names of png_default_*() functions in pngtest to pngtest_*(). + Changed return type of png_get_x|y_offset_*() from png_uint_32 to png_int_32. + Fixed some bugs in the unused PNG_INCH_CONVERSIONS functions in pngget.c + Set each pointer to NULL after freeing it in png_free_data(). + Worked around a problem in pngconf.h; AIX's strings.h defines an "index" + macro that conflicts with libpng's png_color_16.index. (Dimitri Papadapoulos) + Added "msvc" directory with MSVC++ project files (Simon-Pierre Cadieux). +version 1.0.7beta16 [June 4, 2000] + Revised the workaround of AIX string.h "index" bug. + Added a check for overlength PLTE chunk in pngrutil.c. + Added PNG_NO_POINTER_INDEXING macro to use array-indexing instead of pointer + indexing in pngrutil.c and pngwutil.c to accommodate a buggy compiler. + Added a warning in png_decompress_chunk() when it runs out of data, e.g. + when it tries to read an erroneous PhotoShop iCCP chunk. + Added PNG_USE_DLL macro. + Revised the copyright/disclaimer/license notice. + Added contrib/msvctest directory +version 1.0.7rc1 [June 9, 2000] + Corrected the definition of PNG_TRANSFORM_INVERT_ALPHA (0x0400 not 0x0200) + Added contrib/visupng directory (Willem van Schaik) +version 1.0.7beta18 [June 23, 2000] + Revised PNGAPI definition, and pngvcrd.c to work with __GCC__ + and do not redefine PNGAPI if it is passed in via a compiler directive. + Revised visupng/PngFile.c to remove returns from within the Try block. + Removed leading underscores from "_PNG_H" and "_PNG_SAVE_BSD_SOURCE" macros. + Updated contrib/visupng/cexcept.h to version 1.0.0. + Fixed bugs in pngwrite.c and pngwutil.c that prevented writing iCCP chunks. +version 1.0.7rc2 [June 28, 2000] + Updated license to include disclaimers required by UCITA. + Fixed "DJBPP" typo in pnggccrd.c introduced in beta18. + +version 1.0.7 [July 1, 2000] + Revised the definition of "trans_values" in libpng.3/libpng.txt +version 1.0.8beta1 [July 8, 2000] + Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks. + Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and + pngwutil.c. + Changed PNG_EXPORT_VAR to use PNG_IMPEXP, in pngconf.h. + Removed unused "#include " from png.c + Added WindowsCE support. + Revised pnggccrd.c to work with gcc-2.95.2 and in the Cygwin environment. +version 1.0.8beta2 [July 10, 2000] + Added project files to the wince directory and made further revisions + of pngtest.c, pngrio.c, and pngwio.c in support of WindowsCE. +version 1.0.8beta3 [July 11, 2000] + Only set the PNG_FLAG_FREE_TRNS or PNG_FREE_TRNS flag in png_handle_tRNS() + for indexed-color input files to avoid potential double-freeing trans array + under some unusual conditions; problem was introduced in version 1.0.6f. + Further revisions to pngtest.c and files in the wince subdirectory. +version 1.0.8beta4 [July 14, 2000] + Added the files pngbar.png and pngbar.jpg to the distribution. + Added makefile.cygwin, and cygwin support in pngconf.h + Added PNG_NO_ZALLOC_ZERO macro (makes png_zalloc skip zeroing memory) +version 1.0.8rc1 [July 16, 2000] + Revised png_debug() macros and statements to eliminate compiler warnings. + +version 1.0.8 [July 24, 2000] + Added png_flush() in pngwrite.c, after png_write_IEND(). + Updated makefile.hpux to build a shared library. +version 1.0.9beta1 [November 10, 2000] + Fixed typo in scripts/makefile.hpux + Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser) + Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser) + Changed "cdrom.com" in documentation to "libpng.org" + Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg). + Changed type of "params" from voidp to png_voidp in png_read|write_png(). + Make sure PNGAPI and PNG_IMPEXP are defined in pngconf.h. + Revised the 3 instances of WRITEFILE in pngtest.c. + Relocated "msvc" and "wince" project subdirectories into "dll" subdirectory. + Updated png.rc in dll/msvc project + Revised makefile.dec to define and use LIBPATH and INCPATH + Increased size of global png_libpng_ver[] array from 12 to 18 chars. + Made global png_libpng_ver[], png_sig[] and png_pass_*[] arrays const. + Removed duplicate png_crc_finish() from png_handle_bKGD() function. + Added a warning when application calls png_read_update_info() multiple times. + Revised makefile.cygwin + Fixed bugs in iCCP support in pngrutil.c and pngwutil.c. + Replaced png_set_empty_plte_permitted() with png_permit_mng_features(). +version 1.0.9beta2 [November 19, 2000] + Renamed the "dll" subdirectory "projects". + Added borland project files to "projects" subdirectory. + Set VS_FF_PRERELEASE and VS_FF_PATCHED flags in msvc/png.rc when appropriate. + Add error message in png_set_compression_buffer_size() when malloc fails. +version 1.0.9beta3 [November 23, 2000] + Revised PNG_LIBPNG_BUILD_TYPE macro in png.h, used in the msvc project. + Removed the png_flush() in pngwrite.c that crashes some applications + that don't set png_output_flush_fn. + Added makefile.macosx and makefile.aix to scripts directory. +version 1.0.9beta4 [December 1, 2000] + Change png_chunk_warning to png_warning in png_check_keyword(). + Increased the first part of msg buffer from 16 to 18 in png_chunk_error(). +version 1.0.9beta5 [December 15, 2000] + Added support for filter method 64 (for PNG datastreams embedded in MNG). +version 1.0.9beta6 [December 18, 2000] + Revised png_set_filter() to accept filter method 64 when appropriate. + Added new PNG_HAVE_PNG_SIGNATURE bit to png_ptr->mode and use it to + help prevent applications from using MNG features in PNG datastreams. + Added png_permit_mng_features() function. + Revised libpng.3/libpng.txt. Changed "filter type" to "filter method". +version 1.0.9rc1 [December 23, 2000] + Revised test for PNG_HAVE_PNG_SIGNATURE in pngrutil.c + Fixed error handling of unknown compression type in png_decompress_chunk(). + In pngconf.h, define __cdecl when _MSC_VER is defined. +version 1.0.9beta7 [December 28, 2000] + Changed PNG_TEXT_COMPRESSION_zTXt to PNG_COMPRESSION_TYPE_BASE several places. + Revised memory management in png_set_hIST and png_handle_hIST in a backward + compatible manner. PLTE and tRNS were revised similarly. + Revised the iCCP chunk reader to ignore trailing garbage. +version 1.0.9beta8 [January 12, 2001] + Moved pngasmrd.h into pngconf.h. + Improved handling of out-of-spec garbage iCCP chunks generated by PhotoShop. +version 1.0.9beta9 [January 15, 2001] + Added png_set_invalid, png_permit_mng_features, and png_mmx_supported to + wince and msvc project module definition files. + Minor revision of makefile.cygwin. + Fixed bug with progressive reading of narrow interlaced images in pngpread.c +version 1.0.9beta10 [January 16, 2001] + Do not typedef png_FILE_p in pngconf.h when PNG_NO_STDIO is defined. + Fixed "png_mmx_supported" typo in project definition files. +version 1.0.9beta11 [January 19, 2001] + Updated makefile.sgi to make shared library. + Removed png_mmx_support() function and disabled PNG_MNG_FEATURES_SUPPORTED + by default, for the benefit of DLL forward compatibility. These will + be re-enabled in version 1.2.0. +version 1.0.9rc2 [January 22, 2001] + Revised cygwin support. + +version 1.0.9 [January 31, 2001] + Added check of cygwin's ALL_STATIC in pngconf.h + Added "-nommx" parameter to contrib/gregbook/rpng2-win and rpng2-x demos. +version 1.0.10beta1 [March 14, 2001] + Revised makefile.dec, makefile.sgi, and makefile.sggcc; added makefile.hpgcc. + Reformatted libpng.3 to eliminate bad line breaks. + Added checks for _mmx_supported in the read_filter_row function of pnggccrd.c + Added prototype for png_mmx_support() near the top of pnggccrd.c + Moved some error checking from png_handle_IHDR to png_set_IHDR. + Added PNG_NO_READ_SUPPORTED and PNG_NO_WRITE_SUPPORTED macros. + Revised png_mmx_support() function in pnggccrd.c + Restored version 1.0.8 PNG_WRITE_EMPTY_PLTE_SUPPORTED behavior in pngwutil.c + Fixed memory leak in contrib/visupng/PngFile.c + Fixed bugs in png_combine_row() in pnggccrd.c and pngvcrd.c (C version) + Added warnings when retrieving or setting gamma=0. + Increased the first part of msg buffer from 16 to 18 in png_chunk_warning(). +version 1.0.10rc1 [March 23, 2001] + Changed all instances of memcpy, strcpy, and strlen to png_memcpy, png_strcpy, + and png_strlen. + Revised png_mmx_supported() function in pnggccrd.c to return proper value. + Fixed bug in progressive reading (pngpread.c) with small images (height < 8). + +version 1.0.10 [March 30, 2001] + Deleted extraneous space (introduced in 1.0.9) from line 42 of makefile.cygwin + Added beos project files (Chris Herborth) +version 1.0.11beta1 [April 3, 2001] + Added type casts on several png_malloc() calls (Dimitri Papadapoulos). + Removed a no-longer needed AIX work-around from pngconf.h + Changed several "//" single-line comments to C-style in pnggccrd.c +version 1.0.11beta2 [April 11, 2001] + Removed PNGAPI from several functions whose prototypes did not have PNGAPI. + Updated scripts/pngos2.def +version 1.0.11beta3 [April 14, 2001] + Added checking the results of many instances of png_malloc() for NULL +version 1.0.11beta4 [April 20, 2001] + Undid the changes from version 1.0.11beta3. Added a check for NULL return + from user's malloc_fn(). + Removed some useless type casts of the NULL pointer. + Added makefile.netbsd + +version 1.0.11 [April 27, 2001] + Revised makefile.netbsd +version 1.0.12beta1 [May 14, 2001] + Test for Windows platform in pngconf.h when including malloc.h (Emmanuel Blot) + Updated makefile.cygwin and handling of Cygwin's ALL_STATIC in pngconf.h + Added some never-to-be-executed code in pnggccrd.c to quiet compiler warnings. + Eliminated the png_error about apps using png_read|write_init(). Instead, + libpng will reallocate the png_struct and info_struct if they are too small. + This retains future binary compatibility for old applications written for + libpng-0.88 and earlier. +version 1.2.0beta1 [May 6, 2001] + Bumped DLLNUM to 2. + Re-enabled PNG_MNG_FEATURES_SUPPORTED and enabled PNG_ASSEMBLER_CODE_SUPPORTED + by default. + Added runtime selection of MMX features. + Added png_set_strip_error_numbers function and related macros. +version 1.2.0beta2 [May 7, 2001] + Finished merging 1.2.0beta1 with version 1.0.11 + Added a check for attempts to read or write PLTE in grayscale PNG datastreams. +version 1.2.0beta3 [May 17, 2001] + Enabled user memory function by default. + Modified png_create_struct so it passes user mem_ptr to user memory allocator. + Increased png_mng_features flag from png_byte to png_uint_32. + Bumped shared-library (so-number) and dll-number to 3. +version 1.2.0beta4 [June 23, 2001] + Check for missing profile length field in iCCP chunk and free chunk_data + in case of truncated iCCP chunk. + Bumped shared-library number to 3 in makefile.sgi and makefile.sggcc + Bumped dll-number from 2 to 3 in makefile.cygwin + Revised contrib/gregbook/rpng*-x.c to avoid a memory leak and to exit cleanly + if user attempts to run it on an 8-bit display. + Updated contrib/gregbook + Use png_malloc instead of png_zalloc to allocate palette in pngset.c + Updated makefile.ibmc + Added some typecasts to eliminate gcc 3.0 warnings. Changed prototypes + of png_write_oFFS width and height from png_uint_32 to png_int_32. + Updated example.c + Revised prototypes for png_debug_malloc and png_debug_free in pngtest.c +version 1.2.0beta5 [August 8, 2001] + Revised contrib/gregbook + Revised makefile.gcmmx + Revised pnggccrd.c to conditionally compile some thread-unsafe code only + when PNG_THREAD_UNSAFE_OK is defined. + Added tests to prevent pngwutil.c from writing a bKGD or tRNS chunk with + value exceeding 2^bit_depth-1 + Revised makefile.sgi and makefile.sggcc + Replaced calls to fprintf(stderr,...) with png_warning() in pnggccrd.c + Removed restriction that do_invert_mono only operate on 1-bit opaque files + +version 1.2.0 [September 1, 2001] + Changed a png_warning() to png_debug() in pnggccrd.c + Fixed contrib/gregbook/rpng-x.c, rpng2-x.c to avoid crash with XFreeGC(). +version 1.2.1beta1 [October 19, 2001] + Revised makefile.std in contrib/pngminus + Include background_1 in png_struct regardless of gamma support. + Revised makefile.netbsd and makefile.macosx, added makefile.darwin. + Revised example.c to provide more details about using row_callback(). +version 1.2.1beta2 [October 25, 2001] + Added type cast to each NULL appearing in a function call, except for + WINCE functions. + Added makefile.so9. +version 1.2.1beta3 [October 27, 2001] + Removed type casts from all NULLs. + Simplified png_create_struct_2(). +version 1.2.1beta4 [November 7, 2001] + Revised png_create_info_struct() and png_creat_struct_2(). + Added error message if png_write_info() was omitted. + Type cast NULLs appearing in function calls when _NO_PROTO or + PNG_TYPECAST_NULL is defined. +version 1.2.1rc1 [November 24, 2001] + Type cast NULLs appearing in function calls except when PNG_NO_TYPECAST_NULL + is defined. + Changed typecast of "size" argument to png_size_t in pngmem.c calls to + the user malloc_fn, to agree with the prototype in png.h + Added a pop/push operation to pnggccrd.c, to preserve Eflag (Maxim Sobolev) + Updated makefile.sgi to recognize LIBPATH and INCPATH. + Updated various makefiles so "make clean" does not remove previous major + version of the shared library. +version 1.2.1rc2 [December 4, 2001] + Always allocate 256-entry internal palette, hist, and trans arrays, to + avoid out-of-bounds memory reference caused by invalid PNG datastreams. + Added a check for prefix_length > data_length in iCCP chunk handler. + +version 1.2.1 [December 7, 2001] + None. +version 1.2.2beta1 [February 22, 2002] + Fixed a bug with reading the length of iCCP profiles (Larry Reeves). + Revised makefile.linux, makefile.gcmmx, and makefile.sgi to generate + libpng.a, libpng12.so (not libpng.so.3), and libpng12/png.h + Revised makefile.darwin to remove "-undefined suppress" option. + Added checks for gamma and chromaticity values over 21474.83, which exceed + the limit for PNG unsigned 32-bit integers when encoded. + Revised calls to png_create_read_struct() and png_create_write_struct() + for simpler debugging. + Revised png_zalloc() so zlib handles errors (uses PNG_FLAG_MALLOC_NULL_MEM_OK) +version 1.2.2beta2 [February 23, 2002] + Check chunk_length and idat_size for invalid (over PNG_MAX_UINT) lengths. + Check for invalid image dimensions in png_get_IHDR. + Added missing "fi;" in the install target of the SGI makefiles. + Added install-static to all makefiles that make shared libraries. + Always do gamma compensation when image is partially transparent. +version 1.2.2beta3 [March 7, 2002] + Compute background.gray and background_1.gray even when color_type is RGB + in case image gets reduced to gray later. + Modified shared-library makefiles to install pkgconfig/libpngNN.pc. + Export (with PNGAPI) png_zalloc, png_zfree, and png_handle_as_unknown + Removed unused png_write_destroy_info prototype from png.h + Eliminated incorrect use of width_mmx from pnggccrd.c in pixel_bytes == 8 case + Added install-shared target to all makefiles that make shared libraries. + Stopped a double free of palette, hist, and trans when not using free_me. + Added makefile.32sunu for Sun Ultra 32 and makefile.64sunu for Sun Ultra 64. +version 1.2.2beta4 [March 8, 2002] + Compute background.gray and background_1.gray even when color_type is RGB + in case image gets reduced to gray later (Jason Summers). + Relocated a misplaced /bin/rm in the "install-shared" makefile targets + Added PNG_1_0_X macro which can be used to build a 1.0.x-compatible library. +version 1.2.2beta5 [March 26, 2002] + Added missing PNGAPI to several function definitions. + Check for invalid bit_depth or color_type in png_get_IHDR(), and + check for missing PLTE or IHDR in png_push_read_chunk() (Matthias Clasen). + Revised iTXt support to accept NULL for lang and lang_key. + Compute gamma for color components of background even when color_type is gray. + Changed "()" to "{}" in scripts/libpng.pc.in. + Revised makefiles to put png.h and pngconf.h only in $prefix/include/libpngNN + Revised makefiles to make symlink to libpng.so.NN in addition to libpngNN.so +version 1.2.2beta6 [March 31, 2002] +version 1.0.13beta1 [March 31, 2002] + Prevent png_zalloc() from trying to memset memory that it failed to acquire. + Add typecasts of PNG_MAX_UINT in pngset_cHRM_fixed() (Matt Holgate). + Ensure that the right function (user or default) is used to free the + png_struct after an error in png_create_read_struct_2(). +version 1.2.2rc1 [April 7, 2002] +version 1.0.13rc1 [April 7, 2002] + Save the ebx register in pnggccrd.c (Sami Farin) + Add "mem_ptr = png_ptr->mem_ptr" in png_destroy_write_struct() (Paul Gardner). + Updated makefiles to put headers in include/libpng and remove old include/*.h. + +version 1.2.2 [April 15, 2002] +version 1.0.13 [April 15, 2002] + Revised description of png_set_filter() in libpng.3/libpng.txt. + Revised makefile.netbsd and added makefile.neNNbsd and makefile.freebsd +version 1.0.13patch01 [April 17, 2002] +version 1.2.2patch01 [April 17, 2002] + Changed ${PNGMAJ}.${PNGVER} bug to ${PNGVER} in makefile.sgi and makefile.sggcc + Fixed VER -> PNGVER typo in makefile.macosx and added install-static to install + Added install: target to makefile.32sunu and makefile.64sunu +version 1.0.13patch03 [April 18, 2002] +version 1.2.2patch03 [April 18, 2002] + Revised 15 makefiles to link libpng.a to libpngNN.a and the include libpng + subdirectory to libpngNN subdirectory without the full pathname. + Moved generation of libpng.pc from "install" to "all" in 15 makefiles. +version 1.2.3rc1 [April 28, 2002] + Added install-man target to 15 makefiles (Dimitri Papadopolous-Orfanos). + Added $(DESTDIR) feature to 24 makefiles (Tim Mooney) + Fixed bug with $prefix, should be $(prefix) in makefile.hpux. + Updated cygwin-specific portion of pngconf.h and revised makefile.cygwin + Added a link from libpngNN.pc to libpng.pc in 15 makefiles. + Added links from include/libpngNN/*.h to include/*.h in 24 makefiles. + Revised makefile.darwin to make relative links without full pathname. + Added setjmp() at the end of png_create_*_struct_2() in case user forgets + to put one in their application. + Restored png_zalloc() and png_zfree() prototypes to version 1.2.1 and + removed them from module definition files. +version 1.2.3rc2 [May 1, 2002] + Fixed bug in reporting number of channels in pngget.c and pngset.c, + that was introduced in version 1.2.2beta5. + Exported png_zalloc(), png_zfree(), png_default_read(), png_default_write(), + png_default_flush(), and png_push_fill_buffer() and included them in + module definition files. + Added "libpng.pc" dependency to the "install-shared" target in 15 makefiles. +version 1.2.3rc3 [May 1, 2002] + Revised prototype for png_default_flush() + Remove old libpng.pc and libpngNN.pc before installing new ones. +version 1.2.3rc4 [May 2, 2002] + Typos in *.def files (png_default_read|write -> png_default_read|write_data) + In makefiles, changed rm libpng.NN.pc to rm libpngNN.pc + Added libpng-config and libpngNN-config and modified makefiles to install them. + Changed $(MANPATH) to $(DESTDIR)$(MANPATH) in makefiles + Added "Win32 DLL VB" configuration to projects/msvc/libpng.dsp +version 1.2.3rc5 [May 11, 2002] + Changed "error" and "message" in prototypes to "error_message" and + "warning_message" to avoid namespace conflict. + Revised 15 makefiles to build libpng-config from libpng-config-*.in + Once more restored png_zalloc and png_zfree to regular nonexported form. + Restored png_default_read|write_data, png_default_flush, png_read_fill_buffer + to nonexported form, but with PNGAPI, and removed them from module def files. +version 1.2.3rc6 [May 14, 2002] + Removed "PNGAPI" from png_zalloc() and png_zfree() in png.c + Changed "Gz" to "Gd" in projects/msvc/libpng.dsp and zlib.dsp. + Removed leftover libpng-config "sed" script from four makefiles. + Revised libpng-config creating script in 16 makefiles. + +version 1.2.3 [May 22, 2002] + Revised libpng-config target in makefile.cygwin. + Removed description of png_set_mem_fn() from documentation. + Revised makefile.freebsd. + Minor cosmetic changes to 15 makefiles, e.g., $(DI) = $(DESTDIR)/$(INCDIR). + Revised projects/msvc/README.txt + Changed -lpng to -lpngNN in LDFLAGS in several makefiles. +version 1.2.4beta1 [May 24, 2002] + Added libpng.pc and libpng-config to "all:" target in 16 makefiles. + Fixed bug in 16 makefiles: $(DESTDIR)/$(LIBPATH) to $(DESTDIR)$(LIBPATH) + Added missing "\" before closing double quote in makefile.gcmmx. + Plugged various memory leaks; added png_malloc_warn() and png_set_text_2() + functions. +version 1.2.4beta2 [June 25, 2002] + Plugged memory leak of png_ptr->current_text (Matt Holgate). + Check for buffer overflow before reading CRC in pngpread.c (Warwick Allison) + Added -soname to the loader flags in makefile.dec, makefile.sgi, and + makefile.sggcc. + Added "test-installed" target to makefile.linux, makefile.gcmmx, + makefile.sgi, and makefile.sggcc. +version 1.2.4beta3 [June 28, 2002] + Plugged memory leak of row_buf in pngtest.c when there is a png_error(). + Detect buffer overflow in pngpread.c when IDAT is corrupted with extra data. + Added "test-installed" target to makefile.32sunu, makefile.64sunu, + makefile.beos, makefile.darwin, makefile.dec, makefile.macosx, + makefile.solaris, makefile.hpux, makefile.hpgcc, and makefile.so9. +version 1.2.4rc1 and 1.0.14rc1 [July 2, 2002] + Added "test-installed" target to makefile.cygwin and makefile.sco. + Revised pnggccrd.c to be able to back out version 1.0.x via PNG_1_0_X macro. + +version 1.2.4 and 1.0.14 [July 8, 2002] + Changed png_warning() to png_error() when width is too large to process. +version 1.2.4patch01 [July 20, 2002] + Revised makefile.cygwin to use DLL number 12 instead of 13. +version 1.2.5beta1 [August 6, 2002] + Added code to contrib/gregbook/readpng2.c to ignore unused chunks. + Replaced toucan.png in contrib/gregbook (it has been corrupt since 1.0.11) + Removed some stray *.o files from contrib/gregbook. + Changed png_error() to png_warning() about "Too much data" in pngpread.c + and about "Extra compressed data" in pngrutil.c. + Prevent png_ptr->pass from exceeding 7 in png_push_finish_row(). + Updated makefile.hpgcc + Updated png.c and pnggccrd.c handling of return from png_mmx_support() +version 1.2.5beta2 [August 15, 2002] + Only issue png_warning() about "Too much data" in pngpread.c when avail_in + is nonzero. + Updated makefiles to install a separate libpng.so.3 with its own rpath. +version 1.2.5rc1 and 1.0.15rc1 [August 24, 2002] + Revised makefiles to not remove previous minor versions of shared libraries. +version 1.2.5rc2 and 1.0.15rc2 [September 16, 2002] + Revised 13 makefiles to remove "-lz" and "-L$(ZLIBLIB)", etc., from shared + library loader directive. + Added missing "$OBJSDLL" line to makefile.gcmmx. + Added missing "; fi" to makefile.32sunu. +version 1.2.5rc3 and 1.0.15rc3 [September 18, 2002] + Revised libpng-config script. + +version 1.2.5 and 1.0.15 [October 3, 2002] + Revised makefile.macosx, makefile.darwin, makefile.hpgcc, and makefile.hpux, + and makefile.aix. + Relocated two misplaced PNGAPI lines in pngtest.c +version 1.2.6beta1 [October 22, 2002] + Commented out warning about uninitialized mmx_support in pnggccrd.c. + Changed "IBMCPP__" flag to "__IBMCPP__" in pngconf.h. + Relocated two more misplaced PNGAPI lines in pngtest.c + Fixed memory overrun bug in png_do_read_filler() with 16-bit datastreams, + introduced in version 1.0.2. + Revised makefile.macosx, makefile.dec, makefile.aix, and makefile.32sunu. +version 1.2.6beta2 [November 1, 2002] + Added libpng-config "--ldopts" output. + Added "AR=ar" and "ARFLAGS=rc" and changed "ar rc" to "$(AR) $(ARFLAGS)" + in makefiles. +version 1.2.6beta3 [July 18, 2004] + Reverted makefile changes from version 1.2.6beta2 and some of the changes + from version 1.2.6beta1; these will be postponed until version 1.2.7. + Version 1.2.6 is going to be a simple bugfix release. + Changed the one instance of "ln -sf" to "ln -f -s" in each Sun makefile. + Fixed potential overrun in pngerror.c by using strncpy instead of memcpy. + Added "#!/bin/sh" at the top of configure, for recognition of the + 'x' flag under Cygwin (Cosmin). + Optimized vacuous tests that silence compiler warnings, in png.c (Cosmin). + Added support for PNG_USER_CONFIG, in pngconf.h (Cosmin). + Fixed the special memory handler for Borland C under DOS, in pngmem.c + (Cosmin). + Removed some spurious assignments in pngrutil.c (Cosmin). + Replaced 65536 with 65536L, and 0xffff with 0xffffL, to silence warnings + on 16-bit platforms (Cosmin). + Enclosed shift op expressions in parentheses, to silence warnings (Cosmin). + Used proper type png_fixed_point, to avoid problems on 16-bit platforms, + in png_handle_sRGB() (Cosmin). + Added compression_type to png_struct, and optimized the window size + inside the deflate stream (Cosmin). + Fixed definition of isnonalpha(), in pngerror.c and pngrutil.c (Cosmin). + Fixed handling of unknown chunks that come after IDAT (Cosmin). + Allowed png_error() and png_warning() to work even if png_ptr == NULL + (Cosmin). + Replaced row_info->rowbytes with row_bytes in png_write_find_filter() + (Cosmin). + Fixed definition of PNG_LIBPNG_VER_DLLNUM (Simon-Pierre). + Used PNG_LIBPNG_VER and PNG_LIBPNG_VER_STRING instead of the hardcoded + values in png.c (Simon-Pierre, Cosmin). + Initialized png_libpng_ver[] with PNG_LIBPNG_VER_STRING (Simon-Pierre). + Replaced PNG_LIBPNG_VER_MAJOR with PNG_LIBPNG_VER_DLLNUM in png.rc + (Simon-Pierre). + Moved the definition of PNG_HEADER_VERSION_STRING near the definitions + of the other PNG_LIBPNG_VER_... symbols in png.h (Cosmin). + Relocated #ifndef PNGAPI guards in pngconf.h (Simon-Pierre, Cosmin). + Updated scripts/makefile.vc(a)win32 (Cosmin). + Updated the MSVC project (Simon-Pierre, Cosmin). + Updated the Borland C++ Builder project (Cosmin). + Avoided access to asm_flags in pngvcrd.c, if PNG_1_0_X is defined (Cosmin). + Commented out warning about uninitialized mmx_support in pngvcrd.c (Cosmin). + Removed scripts/makefile.bd32 and scripts/pngdef.pas (Cosmin). + Added extra guard around inclusion of Turbo C memory headers, in pngconf.h + (Cosmin). + Renamed projects/msvc/ to projects/visualc6/, and projects/borland/ to + projects/cbuilder5/ (Cosmin). + Moved projects/visualc6/png32ms.def to scripts/pngw32.def, + and projects/visualc6/png.rc to scripts/pngw32.rc (Cosmin). + Added projects/visualc6/pngtest.dsp; removed contrib/msvctest/ (Cosmin). + Changed line endings to DOS style in cbuilder5 and visualc6 files, even + in the tar.* distributions (Cosmin). + Updated contrib/visupng/VisualPng.dsp (Cosmin). + Updated contrib/visupng/cexcept.h to version 2.0.0 (Cosmin). + Added a separate distribution with "configure" and supporting files (Junichi). +version 1.2.6beta4 [July 28, 2004] + Added user ability to change png_size_t via a PNG_SIZE_T macro. + Added png_sizeof() and png_convert_size() functions. + Added PNG_SIZE_MAX (maximum value of a png_size_t variable. + Added check in png_malloc_default() for (size_t)size != (png_uint_32)size + which would indicate an overflow. + Changed sPLT failure action from png_error to png_warning and abandon chunk. + Changed sCAL and iCCP failures from png_error to png_warning and abandon. + Added png_get_uint_31(png_ptr, buf) function. + Added PNG_UINT_32_MAX macro. + Renamed PNG_MAX_UINT to PNG_UINT_31_MAX. + Made png_zalloc() issue a png_warning and return NULL on potential + overflow. + Turn on PNG_NO_ZALLOC_ZERO by default in version 1.2.x + Revised "clobber list" in pnggccrd.c so it will compile under gcc-3.4. + Revised Borland portion of png_malloc() to return NULL or issue + png_error() according to setting of PNG_FLAG_MALLOC_NULL_MEM_OK. + Added PNG_NO_SEQUENTIAL_READ_SUPPORTED macro to conditionally remove + sequential read support. + Added some "#if PNG_WRITE_SUPPORTED" blocks. + Added #ifdef to remove some redundancy in png_malloc_default(). + Use png_malloc instead of png_zalloc to allocate the pallete. +version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004] + Fixed buffer overflow vulnerability in png_handle_tRNS() + Fixed integer arithmetic overflow vulnerability in png_read_png(). + Fixed some harmless bugs in png_handle_sBIT, etc, that would cause + duplicate chunk types to go undetected. + Fixed some timestamps in the -config version + Rearranged order of processing of color types in png_handle_tRNS(). + Added ROWBYTES macro to calculate rowbytes without integer overflow. + Updated makefile.darwin and removed makefile.macosx from scripts directory. + Imposed default one million column, one-million row limits on the image + dimensions, and added png_set_user_limits() function to override them. + Revised use of PNG_SET_USER_LIMITS_SUPPORTED macro. + Fixed wrong cast of returns from png_get_user_width|height_max(). + Changed some "keep the compiler happy" from empty statements to returns, + Revised libpng.txt to remove 1.2.x stuff from the 1.0.x distribution +version 1.0.16rc2 and 1.2.6rc2 [August 7, 2004] + Revised makefile.darwin and makefile.solaris. Removed makefile.macosx. + Revised pngtest's png_debug_malloc() to use png_malloc() instead of + png_malloc_default() which is not supposed to be exported. + Fixed off-by-one error in one of the conversions to PNG_ROWBYTES() in + pngpread.c. Bug was introduced in 1.2.6rc1. + Fixed bug in RGB to RGBX transformation introduced in 1.2.6rc1. + Fixed old bug in RGB to Gray transformation. + Fixed problem with 64-bit compilers by casting arguments to abs() + to png_int_32. + Changed "ln -sf" to "ln -f -s" in three makefiles (solaris, sco, so9). + Changed "HANDLE_CHUNK_*" to "PNG_HANDLE_CHUNK_*" (Cosmin) + Added "-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)" to 15 *NIX makefiles. + Added code to update the row_info->colortype in png_do_read_filler() (MSB). +version 1.0.16rc3 and 1.2.6rc3 [August 9, 2004] + Eliminated use of "abs()" in testing cHRM and gAMA values, to avoid + trouble with some 64-bit compilers. Created PNG_OUT_OF_RANGE() macro. + Revised documentation of png_set_keep_unknown_chunks(). + Check handle_as_unknown status in pngpread.c, as in pngread.c previously. + Moved "PNG_HANDLE_CHUNK_*" macros out of PNG_INTERNAL section of png.h + Added "rim" definitions for CONST4 and CONST6 in pnggccrd.c +version 1.0.16rc4 and 1.2.6rc4 [August 10, 2004] + Fixed mistake in pngtest.c introduced in 1.2.6rc2 (declaration of + "pinfo" was out of place). +version 1.0.16rc5 and 1.2.6rc5 [August 10, 2004] + Moved "PNG_HANDLE_CHUNK_*" macros out of PNG_ASSEMBLER_CODE_SUPPORTED + section of png.h where they were inadvertently placed in version rc3. + +version 1.2.6 and 1.0.16 [August 15, 2004] + Revised pngtest so memory allocation testing is only done when PNG_DEBUG==1. +version 1.2.7beta1 [August 26, 2004] + Removed unused pngasmrd.h file. + Removed references to uu.net for archived files. Added references to + PNG Spec (second edition) and the PNG ISO/IEC Standard. + Added "test-dd" target in 15 makefiles, to run pngtest in DESTDIR. + Fixed bug with "optimized window size" in the IDAT datastream, that + causes libpng to write PNG files with incorrect zlib header bytes. +version 1.2.7beta2 [August 28, 2004] + Fixed bug with sCAL chunk and big-endian machines (David Munro). + Undid new code added in 1.2.6rc2 to update the color_type in + png_set_filler(). + Added png_set_add_alpha() that updates color type. +version 1.0.17rc1 and 1.2.7rc1 [September 4, 2004] + Revised png_set_strip_filler() to not remove alpha if color_type has alpha. + +version 1.2.7 and 1.0.17 [September 12, 2004] + Added makefile.hp64 + Changed projects/msvc/png32ms.def to scripts/png32ms.def in makefile.cygwin +version 1.2.8beta1 [November 1, 2004] + Fixed bug in png_text_compress() that would fail to complete a large block. + Fixed bug, introduced in libpng-1.2.7, that overruns a buffer during + strip alpha operation in png_do_strip_filler(). + Added PNG_1_2_X definition in pngconf.h + Use #ifdef to comment out png_info_init in png.c and png_read_init in + pngread.c (as of 1.3.0) +version 1.2.8beta2 [November 2, 2004] + Reduce color_type to a nonalpha type after strip alpha operation in + png_do_strip_filler(). +version 1.2.8beta3 [November 3, 2004] + Revised definitions of PNG_MAX_UINT_32, PNG_MAX_SIZE, and PNG_MAXSUM +version 1.2.8beta4 [November 12, 2004] + Fixed (again) definition of PNG_LIBPNG_VER_DLLNUM in png.h (Cosmin). + Added PNG_LIBPNG_BUILD_PRIVATE in png.h (Cosmin). + Set png_ptr->zstream.data_type to Z_BINARY, to avoid unnecessary detection + of data type in deflate (Cosmin). + Deprecated but continue to support SPECIALBUILD and PRIVATEBUILD in favor of + PNG_LIBPNG_BUILD_SPECIAL_STRING and PNG_LIBPNG_BUILD_PRIVATE_STRING. +version 1.2.8beta5 [November 20, 2004] + Use png_ptr->flags instead of png_ptr->transformations to pass + PNG_STRIP_ALPHA info to png_do_strip_filler(), to preserve ABI + compatibility. + Revised handling of SPECIALBUILD, PRIVATEBUILD, + PNG_LIBPNG_BUILD_SPECIAL_STRING and PNG_LIBPNG_BUILD_PRIVATE_STRING. +version 1.2.8rc1 [November 24, 2004] + Moved handling of BUILD macros from pngconf.h to png.h + Added definition of PNG_LIBPNG_BASE_TYPE in png.h, inadvertently + omitted from beta5. + Revised scripts/pngw32.rc + Despammed mailing addresses by masking "@" with "at". + Inadvertently installed a supposedly faster test version of pngrutil.c +version 1.2.8rc2 [November 26, 2004] + Added two missing "\" in png.h + Change tests in pngread.c and pngpread.c to + if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) + png_do_read_transformations(png_ptr); +version 1.2.8rc3 [November 28, 2004] + Reverted pngrutil.c to version libpng-1.2.8beta5. + Added scripts/makefile.elf with supporting code in pngconf.h for symbol + versioning (John Bowler). +version 1.2.8rc4 [November 29, 2004] + Added projects/visualc7 (Simon-pierre). +version 1.2.8rc5 [November 29, 2004] + Fixed new typo in scripts/pngw32.rc + +version 1.2.8 [December 3, 2004] + Removed projects/visualc7, added projects/visualc71. + +version 1.2.9beta1 [February 21, 2006] + + Initialized some structure members in pngwutil.c to avoid gcc-4.0.0 complaints + Revised man page and libpng.txt to make it clear that one should not call + png_read_end or png_write_end after png_read_png or png_write_png. + Updated references to png-mng-implement mailing list. + Fixed an incorrect typecast in pngrutil.c + Added PNG_NO_READ_SUPPORTED conditional for making a write-only library. + Added PNG_NO_WRITE_INTERLACING_SUPPORTED conditional. + Optimized alpha-inversion loops in pngwtran.c + Moved test for nonzero gamma outside of png_build_gamma_table() in pngrtran.c + Make sure num_trans is <= 256 before copying data in png_set_tRNS(). + Make sure num_palette is <= 256 before copying data in png_set_PLTE(). + Interchanged order of write_swap_alpha and write_invert_alpha transforms. + Added parentheses in the definition of PNG_LIBPNG_BUILD_TYPE (Cosmin). + Optimized zlib window flag (CINFO) in contrib/pngsuite/*.png (Cosmin). + Updated scripts/makefile.bc32 for Borland C++ 5.6 (Cosmin). + Exported png_get_uint_32, png_save_uint_32, png_get_uint_16, png_save_uint_16, + png_get_int_32, png_save_int_32, png_get_uint_31 (Cosmin). + Added type cast (png_byte) in png_write_sCAL() (Cosmin). + Fixed scripts/makefile.cygwin (Christian Biesinger, Cosmin). + Default iTXt support was inadvertently enabled. + +version 1.2.9beta2 [February 21, 2006] + + Check for png_rgb_to_gray and png_gray_to_rgb read transformations before + checking for png_read_dither in pngrtran.c + Revised checking of chromaticity limits to accommodate extended RGB + colorspace (John Denker). + Changed line endings in some of the project files to CRLF, even in the + "Unix" tar distributions (Cosmin). + Made png_get_int_32 and png_save_int_32 always available (Cosmin). + Updated scripts/pngos2.def, scripts/pngw32.def and projects/wince/png32ce.def + with the newly exported functions. + Eliminated distributions without the "configure" script. + Updated INSTALL instructions. + +version 1.2.9beta3 [February 24, 2006] + + Fixed CRCRLF line endings in contrib/visupng/VisualPng.dsp + Made libpng.pc respect EXEC_PREFIX (D. P. Kreil, J. Bowler) + Removed reference to pngasmrd.h from Makefile.am + Renamed CHANGES to ChangeLog. + Renamed LICENSE to COPYING. + Renamed ANNOUNCE to NEWS. + Created AUTHORS file. + +version 1.2.9beta4 [March 3, 2006] + + Changed definition of PKGCONFIG from $prefix/lib to $libdir in configure.ac + Reverted to filenames LICENSE and ANNOUNCE; removed AUTHORS and COPYING. + Removed newline from the end of some error and warning messages. + Removed test for sqrt() from configure.ac and configure. + Made swap tables in pngtrans.c PNG_CONST (Carlo Bramix). + Disabled default iTXt support that was inadvertently enabled in + libpng-1.2.9beta1. + Added "OS2" to list of systems that don't need underscores, in pnggccrd.c + Removed libpng version and date from *.c files. + +version 1.2.9beta5 [March 4, 2006] + Removed trailing blanks from source files. + Put version and date of latest change in each source file, and changed + copyright year accordingly. + More cleanup of configure.ac, Makefile.ac, and associated scripts. + Restored scripts/makefile.elf which was inadvertently deleted. + +version 1.2.9beta6 [March 6, 2006] + Fixed typo (RELEASE) in configuration files. + +version 1.2.9beta7 [March 7, 2006] + Removed libpng.vers and libpng.sym from libpng12_la_SOURCES in Makefile.am + Fixed inconsistent #ifdef's around png_sig_bytes() and png_set_sCAL_s() + in png.h. + Updated makefile.elf as suggested by debian. + Made cosmetic changes to some makefiles, adding LN_SF and other macros. + Made some makefiles accept "exec_prefix". + +version 1.2.9beta8 [March 9, 2006] + Fixed some "#if defined (..." which should be "#if defined(..." + Bug introduced in libpng-1.2.8. + Fixed inconsistency in definition of png_default_read_data() + Restored blank that was lost from makefile.sggcc "clean" target in beta7. + Revised calculation of "current" and "major" for irix in ltmain.sh + Changed "mkdir" to "MKDIR_P" in some makefiles. + Separated PNG_EXPAND and PNG_EXPAND_tRNS. + Added png_set_expand_gray_1_2_4_to_8() and deprecated + png_set_gray_1_2_4_to_8() which also expands tRNS to alpha. + +version 1.2.9beta9 [March 10, 2006] + Include "config.h" in pngconf.h when available. + Added some checks for NULL png_ptr or NULL info_ptr (timeless) + +version 1.2.9beta10 [March 20, 2006] + Removed extra CR from contrib/visualpng/VisualPng.dsw (Cosmin) + Made pnggccrd.c PIC-compliant (Christian Aichinger). + Added makefile.mingw (Wolfgang Glas). + Revised pngconf.h MMX checking. + +version 1.2.9beta11 [March 22, 2006] + Fixed out-of-order declaration in pngwrite.c that was introduced in beta9 + Simplified some makefiles by using LIBSO, LIBSOMAJ, and LIBSOVER macros. + +version 1.2.9rc1 [March 31, 2006] + Defined PNG_USER_PRIVATEBUILD when including "pngusr.h" (Cosmin). + Removed nonsensical assertion check from pngtest.c (Cosmin). + +version 1.2.9 [April 14, 2006] + Revised makefile.beos and added "none" selector in ltmain.sh + +version 1.2.10beta1 [April 15, 2006] + Renamed "config.h" to "png_conf.h" and revised Makefile.am to add + -DPNG_BUILDING_LIBPNG to compile directive, and modified pngconf.h + to include png_conf.h only when PNG_BUILDING_LIBPNG is defined. + +version 1.2.10beta2 [April 15, 2006] + Manually updated Makefile.in and configure. Changed png_conf.h.in + back to config.h. + +version 1.2.10beta3 [April 15, 2006] + Change png_conf.h back to config.h in pngconf.h. + +version 1.2.10beta4 [April 16, 2006] + Change PNG_BUILDING_LIBPNG to PNG_CONFIGURE_LIBPNG in config/Makefile*. + +version 1.2.10beta5 [April 16, 2006] + Added a configure check for compiling assembler code in pnggccrd.c + +version 1.2.10beta6 [April 17, 2006] + Revised the configure check for pnggccrd.c + Moved -DPNG_CONFIGURE_LIBPNG into @LIBPNG_DEFINES@ + Added @LIBPNG_DEFINES@ to arguments when building libpng.sym + +version 1.2.10beta7 [April 18, 2006] + Change "exec_prefix=$prefix" to "exec_prefix=$(prefix)" in makefiles. + +version 1.2.10rc1 [April 19, 2006] + Ensure pngconf.h doesn't define both PNG_USE_PNGGCCRD and PNG_USE_PNGVCRD + Fixed "LN_FS" typo in makefile.sco and makefile.solaris. + +version 1.2.10rc2 [April 20, 2006] + Added a backslash between -DPNG_CONFIGURE_LIBPNG and -DPNG_NO_ASSEMBLER_CODE + in configure.ac and configure + Made the configure warning about versioned symbols less arrogant. + +version 1.2.10rc3 [April 21, 2006] + Added a note in libpng.txt that png_set_sig_bytes(8) can be used when + writing an embedded PNG without the 8-byte signature. + Revised makefiles and configure to avoid making links to libpng.so.* + +version 1.2.10 [April 23, 2006] + Reverted configure to "rc2" state. + +version 1.2.11beta1 [May 31, 2006] + scripts/libpng.pc.in contained "configure" style version info and would + not work with makefiles. + The shared-library makefiles were linking to libpng.so.0 instead of + libpng.so.3 compatibility as the library. + +version 1.2.11beta2 [June 2, 2006] + Increased sprintf buffer from 50 to 52 chars in pngrutil.c to avoid + buffer overflow. + Fixed bug in example.c (png_set_palette_rgb -> png_set_palette_to_rgb) + +version 1.2.11beta3 [June 5, 2006] + Prepended "#! /bin/sh" to ltmail.sh and contrib/pngminus/*.sh (Cosmin). + Removed the accidental leftover Makefile.in~ (Cosmin). + Avoided potential buffer overflow and optimized buffer in + png_write_sCAL(), png_write_sCAL_s() (Cosmin). + Removed the include directories and libraries from CFLAGS and LDFLAGS + in scripts/makefile.gcc (Nelson A. de Oliveira, Cosmin). + +version 1.2.11beta4 [June 6, 2006] + Allow zero-length IDAT chunks after the entire zlib datastream, but not + after another intervening chunk type. + +version 1.0.19rc1, 1.2.11rc1 [June 13, 2006] + Deleted extraneous square brackets from [config.h] in configure.ac + +version 1.0.19rc2, 1.2.11rc2 [June 14, 2006] + Added prototypes for PNG_INCH_CONVERSIONS functions to png.h + Revised INSTALL and autogen.sh + Fixed typo in several makefiles (-W1 should be -Wl) + Added typedef for png_int_32 and png_uint_32 on 64-bit systems. + +version 1.0.19rc3, 1.2.11rc3 [June 15, 2006] + Removed the new typedefs for 64-bit systems (delay until version 1.4.0) + Added one zero element to png_gamma_shift[] array in pngrtran.c to avoid + reading out of bounds. + +version 1.0.19rc4, 1.2.11rc4 [June 15, 2006] + Really removed the new typedefs for 64-bit systems. + +version 1.0.19rc5, 1.2.11rc5 [June 22, 2006] + Removed png_sig_bytes entry from scripts/pngw32.def + +version 1.0.19, 1.2.11 [June 26, 2006] + None. + +version 1.0.20, 1.2.12 [June 27, 2006] + Really increased sprintf buffer from 50 to 52 chars in pngrutil.c to avoid + buffer overflow. + +version 1.2.13beta1 [October 2, 2006] + Removed AC_FUNC_MALLOC from configure.ac + Work around Intel-Mac compiler bug by setting PNG_NO_MMX_CODE in pngconf.h + Change "logical" to "bitwise" throughout documentation. + Detect and fix attempt to write wrong iCCP profile length. + +version 1.0.21, 1.2.13 [November 14, 2006] + Fix potential buffer overflow in sPLT chunk handler. + Fix Makefile.am to not try to link to noexistent files. + Check all exported functions for NULL png_ptr. + +version 1.2.14beta1 [November 17, 2006] + Relocated three misplaced tests for NULL png_ptr. + Built Makefile.in with automake-1.9.6 instead of 1.9.2. + Build configure with autoconf-2.60 instead of 2.59 + +version 1.2.14beta2 [November 17, 2006] + Added some typecasts in png_zalloc(). + +version 1.2.14rc1 [November 20, 2006] + Changed "strtod" to "png_strtod" in pngrutil.c + +version 1.0.22, 1.2.14 [November 27, 2006] + Added missing "$(srcdir)" in Makefile.am and Makefile.in + +version 1.2.15beta1 [December 3, 2006] + Generated configure with autoconf-2.61 instead of 2.60 + Revised configure.ac to update libpng.pc and libpng-config. + +version 1.2.15beta2 [December 3, 2006] + Always export MMX asm functions, just stubs if not building pnggccrd.c + +version 1.2.15beta3 [December 4, 2006] + Add "png_bytep" typecast to profile while calculating length in pngwutil.c + +version 1.2.15beta4 [December 7, 2006] + Added scripts/CMakeLists.txt + Changed PNG_NO_ASSEMBLER_CODE to PNG_NO_MMX_CODE in scripts, like 1.4.0beta + +version 1.2.15beta5 [December 7, 2006] + Changed some instances of PNG_ASSEMBLER_* to PNG_MMX_* in pnggccrd.c + Revised scripts/CMakeLists.txt + +version 1.2.15beta6 [December 13, 2006] + Revised scripts/CMakeLists.txt and configure.ac + +version 1.2.15rc1 [December 18, 2006] + Revised scripts/CMakeLists.txt + +version 1.2.15rc2 [December 21, 2006] + Added conditional #undef jmpbuf in pngtest.c to undo #define in AIX headers. + Added scripts/makefile.nommx + +version 1.2.15rc3 [December 25, 2006] + Fixed shared library numbering error that was introduced in 1.2.15beta6. + +version 1.2.15rc4 [December 27, 2006] + Fixed handling of rgb_to_gray when png_ptr->color.gray isn't set. + +version 1.2.15rc5 [December 31, 2006] + Revised handling of rgb_to_gray. + +version 1.2.15 [January 5, 2007] + Added some (unsigned long) typecasts in pngtest.c to avoid printing errors. + +version 1.2.16beta1 [January 6, 2007] + Fix bugs in makefile.nommx + +version 1.2.16beta2 [January 16, 2007] + Revised scripts/CMakeLists.txt + +version 1.2.16 [January 31, 2007] + No changes. + +version 1.2.17beta1 [March 6, 2007] + Revised scripts/CMakeLists.txt to install both shared and static libraries. + Deleted a redundant line from pngset.c. + +version 1.2.17beta2 [April 26, 2007] + Relocated misplaced test for png_ptr == NULL in pngpread.c + Change "==" to "&" for testing PNG_RGB_TO_GRAY_ERR & PNG_RGB_TO_GRAY_WARN + flags. + Changed remaining instances of PNG_ASSEMBLER_* to PNG_MMX_* + Added pngerror() when write_IHDR fails in deflateInit2(). + Added "const" to some array declarations. + Mention examples of libpng usage in the libpng*.txt and libpng.3 documents. + +version 1.2.17rc1 [May 4, 2007] + No changes. + +version 1.2.17rc2 [May 8, 2007] + Moved several PNG_HAVE_* macros out of PNG_INTERNAL because applications + calling set_unknown_chunk_location() need them. + Changed transformation flag from PNG_EXPAND_tRNS to PNG_EXPAND in + png_set_expand_gray_1_2_4_to_8(). + Added png_ptr->unknown_chunk to hold working unknown chunk data, so it + can be free'ed in case of error. Revised unknown chunk handling in + pngrutil.c and pngpread.c to use this structure. + +version 1.2.17rc3 [May 8, 2007] + Revised symbol-handling in configure script. + +version 1.2.17rc4 [May 10, 2007] + Revised unknown chunk handling to avoid storing unknown critical chunks. + +version 1.0.25 [May 15, 2007] +version 1.2.17 [May 15, 2007] + Added "png_ptr->num_trans=0" before error return in png_handle_tRNS, + to eliminate a vulnerability (CVE-2007-2445, CERT VU#684664) + +version 1.0.26 [May 15, 2007] +version 1.2.18 [May 15, 2007] + Reverted the libpng-1.2.17rc3 change to symbol-handling in configure script + +version 1.2.19beta1 [May 18, 2007] + Changed "const static" to "static PNG_CONST" everywhere, mostly undoing + change of libpng-1.2.17beta2. Changed other "const" to "PNG_CONST" + Changed some handling of unused parameters, to avoid compiler warnings. + "if (unused == NULL) return;" becomes "unused = unused". + +version 1.2.19beta2 [May 18, 2007] + Only use the valid bits of tRNS value in png_do_expand() (Brian Cartier) + +version 1.2.19beta3 [May 19, 2007] + Add some "png_byte" typecasts in png_check_keyword() and write new_key + instead of key in zTXt chunk (Kevin Ryde). + +version 1.2.19beta4 [May 21, 2007] + Add png_snprintf() function and use it in place of sprint() for improved + defense against buffer overflows. + +version 1.2.19beta5 [May 21, 2007] + Fixed png_handle_tRNS() to only use the valid bits of tRNS value. + Changed handling of more unused parameters, to avoid compiler warnings. + Removed some PNG_CONST in pngwutil.c to avoid compiler warnings. + +version 1.2.19beta6 [May 22, 2007] + Added some #ifdef PNG_MMX_CODE_SUPPORTED where needed in pngvcrd.c + Added a special "_MSC_VER" case that defines png_snprintf to _snprintf + +version 1.2.19beta7 [May 22, 2007] + Squelched png_squelch_warnings() in pnggccrd.c and added + an #ifdef PNG_MMX_CODE_SUPPORTED block around the declarations that caused + the warnings that png_squelch_warnings was squelching. + +version 1.2.19beta8 [May 22, 2007] + Removed __MMX__ from test in pngconf.h. + +version 1.2.19beta9 [May 23, 2007] + Made png_squelch_warnings() available via PNG_SQUELCH_WARNINGS macro. + Revised png_squelch_warnings() so it might work. + Updated makefile.sgcc and makefile.solaris; added makefile.solaris-x86. + +version 1.2.19beta10 [May 24, 2007] + Resquelched png_squelch_warnings(), use "__attribute__((used))" instead. + +version 1.4.0beta1 [April 20, 2006] + Enabled iTXt support (changes png_struct, thus requires so-number change). + Cleaned up PNG_ASSEMBLER_CODE_SUPPORTED vs PNG_MMX_CODE_SUPPORTED + Eliminated PNG_1_0_X and PNG_1_2_X macros. + Removed deprecated functions png_read_init, png_write_init, png_info_init, + png_permit_empty_plte, png_set_gray_1_2_4_to_8, png_check_sig, and + removed the deprecated macro PNG_MAX_UINT. + Moved "PNG_INTERNAL" parts of png.h and pngconf.h into pngintrn.h + Removed many WIN32_WCE #ifdefs (Cosmin). + Reduced dependency on C-runtime library when on Windows (Simon-Pierre) + Replaced sprintf() with png_sprintf() (Simon-Pierre) + +version 1.4.0beta2 [April 20, 2006] + Revised makefiles and configure to avoid making links to libpng.so.* + Moved some leftover MMX-related defines from pngconf.h to pngintrn.h + Updated scripts/pngos2.def, pngw32.def, and projects/wince/png32ce.def + +version 1.4.0beta3 [May 10, 2006] + Updated scripts/pngw32.def to comment out MMX functions. + Added PNG_NO_GET_INT_32 and PNG_NO_SAVE_INT_32 macros. + Scripts/libpng.pc.in contained "configure" style version info and would + not work with makefiles. + Revised pngconf.h and added pngconf.h.in, so makefiles and configure can + pass defines to libpng and applications. + +version 1.4.0beta4 [May 11, 2006] + Revised configure.ac, Makefile.am, and many of the makefiles to write + their defines in pngconf.h. + +version 1.4.0beta5 [May 15, 2006] + Added a missing semicolon in Makefile.am and Makefile.in + Deleted extraneous square brackets from configure.ac + +version 1.4.0beta6 [June 2, 2006] + Increased sprintf buffer from 50 to 52 chars in pngrutil.c to avoid + buffer overflow. + Changed sonum from 0 to 1. + Removed unused prototype for png_check_sig() from png.h + +version 1.4.0beta7 [June 16, 2006] + Exported png_write_sig (Cosmin). + Optimized buffer in png_handle_cHRM() (Cosmin). + Set pHYs = 2835 x 2835 pixels per meter, and added + sCAL = 0.352778e-3 x 0.352778e-3 meters, in pngtest.png (Cosmin). + Added png_set_benign_errors(), png_benign_error(), png_chunk_benign_error(). + Added typedef for png_int_32 and png_uint_32 on 64-bit systems. + Added "(unsigned long)" typecast on png_uint_32 variables in printf lists. + +version 1.4.0beta8 [June 22, 2006] + Added demonstration of user chunk support in pngtest.c, to support the + public sTER chunk and a private vpAg chunk. + +version 1.4.0beta9 [July 3, 2006] + Removed ordinals from scripts/pngw32.def and removed png_info_int and + png_set_gray_1_2_4_to_8 entries. + Inline call of png_get_uint_32() in png_get_uint_31(). + Use png_get_uint_31() to get vpAg width and height in pngtest.c + Removed WINCE and Netware projects. + Removed standalone Y2KINFO file. + +version 1.4.0beta10 [July 12, 2006] + Eliminated automatic copy of pngconf.h to pngconf.h.in from configure and + some makefiles, because it was not working reliably. Instead, distribute + pngconf.h.in along with pngconf.h and cause configure and some of the + makefiles to update pngconf.h from pngconf.h.in. + Added pngconf.h to DEPENDENCIES in Makefile.am + +version 1.4.0beta11 [August 19, 2006] + Removed AC_FUNC_MALLOC from configure.ac. + Added a warning when writing iCCP profile with mismatched profile length. + Patched pnggccrd.c to assemble on x86_64 platforms. + Moved chunk header reading into a separate function png_read_chunk_header() + in pngrutil.c. The chunk header (len+sig) is now serialized in a single + operation (Cosmin). + Implemented support for I/O states. Added png_ptr member io_state, and + functions png_get_io_chunk_name() and png_get_io_state() in pngget.c + (Cosmin). + Added png_get_io_chunk_name and png_get_io_state to scripts/*.def (Cosmin). + Renamed scripts/pngw32.* to scripts/pngwin.* (Cosmin). + Removed the include directories and libraries from CFLAGS and LDFLAGS + in scripts/makefile.gcc (Cosmin). + Used png_save_uint_32() to set vpAg width and height in pngtest.c (Cosmin). + Cast to proper type when getting/setting vpAg units in pngtest.c (Cosmin). + Added pngintrn.h to the Visual C++ projects (Cosmin). + Removed scripts/list (Cosmin). + Updated copyright year in scripts/pngwin.def (Cosmin). + Removed PNG_TYPECAST_NULL and used standard NULL consistently (Cosmin). + Disallowed the user to redefine png_size_t, and enforced a consistent use + of png_size_t across libpng (Cosmin). + Changed the type of png_ptr->rowbytes, PNG_ROWBYTES() and friends + to png_size_t (Cosmin). + Removed png_convert_size() and replaced png_sizeof with sizeof (Cosmin). + Removed some unnecessary type casts (Cosmin). + Changed prototype of png_get_compression_buffer_size() and + png_set_compression_buffer_size() to work with png_size_t instead of + png_uint_32 (Cosmin). + Removed png_memcpy_check() and png_memset_check() (Cosmin). + Fixed a typo (png_byte --> png_bytep) in libpng.3 and libpng.txt (Cosmin). + Clarified that png_zalloc() does not clear the allocated memory, + and png_zalloc() and png_zfree() cannot be PNGAPI (Cosmin). + Renamed png_mem_size_t to png_alloc_size_t, fixed its definition in + pngconf.h, and used it in all memory allocation functions (Cosmin). + Renamed pngintrn.h to pngpriv.h, added a comment at the top of the file + mentioning that the symbols declared in that file are private, and + updated the scripts and the Visual C++ projects accordingly (Cosmin). + Removed circular references between pngconf.h and pngconf.h.in in + scripts/makefile.vc*win32 (Cosmin). + Removing trailing '.' from the warning and error messages (Cosmin). + Added pngdefs.h that is built by makefile or configure, instead of + pngconf.h.in (Glenn). + Detect and fix attempt to write wrong iCCP profile length. + +version 1.4.0beta12 [October 19, 2006] + Changed "logical" to "bitwise" in the documentation. + Work around Intel-Mac compiler bug by setting PNG_NO_MMX_CODE in pngconf.h + Add a typecast to stifle compiler warning in pngrutil.c + +version 1.4.0beta13 [November 10, 2006] + Fix potential buffer overflow in sPLT chunk handler. + Fix Makefile.am to not try to link to noexistent files. + +version 1.4.0beta14 [November 15, 2006] + Check all exported functions for NULL png_ptr. + +version 1.4.0beta15 [November 17, 2006] + Relocated two misplaced tests for NULL png_ptr. + Built Makefile.in with automake-1.9.6 instead of 1.9.2. + Build configure with autoconf-2.60 instead of 2.59 + Add "install: all" in Makefile.am so "configure; make install" will work. + +version 1.4.0beta16 [November 17, 2006] + Added a typecast in png_zalloc(). + +version 1.4.0beta17 [December 4, 2006] + Changed "new_key[79] = '\0';" to "(*new_key)[79] = '\0';" in pngwutil.c + Add "png_bytep" typecast to profile while calculating length in pngwutil.c + +version 1.4.0beta18 [December 7, 2006] + Added scripts/CMakeLists.txt + +version 1.4.0beta19 [May 16, 2007] + Revised scripts/CMakeLists.txt + Rebuilt configure and Makefile.in with newer tools. + Added conditional #undef jmpbuf in pngtest.c to undo #define in AIX headers. + Added scripts/makefile.nommx + +version 1.4.0beta20 [July 9, 2008] + Moved several PNG_HAVE_* macros from pngpriv.h to png.h because applications + calling set_unknown_chunk_location() need them. + Moved several macro definitions from pngpriv.h to pngconf.h + Merge with changes to the 1.2.X branch, as of 1.2.30beta04. + Deleted all use of the MMX assembler code and Intel-licensed optimizations. + Revised makefile.mingw + +version 1.4.0beta21 [July 21, 2008] + Moved local array "chunkdata" from pngrutil.c to the png_struct, so + it will be freed by png_read_destroy() in case of a read error (Kurt + Christensen). + +version 1.4.0beta22 [July 21, 2008] + Change "purpose" and "buffer" to png_ptr->chunkdata to avoid memory leaking. + +version 1.4.0beta23 [July 22, 2008] + Change "chunkdata = NULL" to "png_ptr->chunkdata = NULL" several places in + png_decompress_chunk(). + +version 1.4.0beta24 [July 25, 2008] + Change all remaining "chunkdata" to "png_ptr->chunkdata" in + png_decompress_chunk(), and remove "chunkdata" from parameter list. + Put a call to png_check_chunk_name() in png_read_chunk_header(). + Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte. + Removed two calls to png_check_chunk_name() occuring later in the process. + Define PNG_NO_ERROR_NUMBERS by default in pngconf.h + +version 1.4.0beta25 [July 30, 2008] + Added a call to png_check_chunk_name() in pngpread.c + Reverted png_check_chunk_name() to accept a name with a lowercase 3rd byte. + Added png_push_have_buffer() function to pngpread.c + Eliminated PNG_BIG_ENDIAN_SUPPORTED and associated png_get_* macros. + Made inline expansion of png_get_*() optional with PNG_USE_READ_MACROS. + Eliminated all PNG_USELESS_TESTS and PNG_CORRECT_PALETTE_SUPPORTED code. + Synced contrib directory and configure files with libpng-1.2.30beta06. + Eliminated no-longer-used pngdefs.h (but it's still built in the makefiles) + Relocated a misplaced "#endif /* PNG_NO_WRITE_FILTER */" in pngwutil.c + +version 1.4.0beta26 [August 4, 2008] + Removed png_push_have_buffer() function in pngpread.c. It increased the + compiled library size slightly. + Changed "-Wall" to "-W -Wall" in the CFLAGS in all makefiles (Cosmin Truta) + Declared png_ptr "volatile" in pngread.c and pngwrite.c to avoid warnings. + Updated contrib/visupng/cexcept.h to version 2.0.1 + Added PNG_LITERAL_CHARACTER macros for #, [, and ]. + +version 1.4.0beta27 [August 5, 2008] + Revised usage of PNG_LITERAL_SHARP in pngerror.c. + Moved newline character from individual png_debug messages into the + png_debug macros. + Allow user to #define their own png_debug, png_debug1, and png_debug2. + +version 1.4.0beta28 [August 5, 2008] + Revised usage of PNG_LITERAL_SHARP in pngerror.c. + Added PNG_STRING_NEWLINE macro + +version 1.4.0beta29 [August 9, 2008] + Revised usage of PNG_STRING_NEWLINE to work on non-ISO compilers. + Added PNG_STRING_COPYRIGHT macro. + Added non-ISO versions of png_debug macros. + +version 1.4.0beta30 [August 14, 2008] + Added premultiplied alpha feature (Volker Wiendl). + +version 1.4.0beta31 [August 18, 2008] + Moved png_set_premultiply_alpha from pngtrans.c to pngrtran.c + Removed extra crc check at the end of png_handle_cHRM(). Bug introduced + in libpng-1.4.0beta20. + +version 1.4.0beta32 [August 19, 2008] + Added PNG_WRITE_FLUSH_SUPPORTED block around new png_flush() call. + Revised PNG_NO_STDIO version of png_write_flush() + +version 1.4.0beta33 [August 20, 2008] + Added png_get|set_chunk_cache_max() to limit the total number of sPLT, + text, and unknown chunks that can be stored. + +version 1.4.0beta34 [September 6, 2008] + Shortened tIME_string to 29 bytes in pngtest.c + Fixed off-by-one error introduced in png_push_read_zTXt() function in + libpng-1.2.30beta04/pngpread.c (Harald van Dijk) + +version 1.4.0beta35 [October 6, 2008] + Changed "trans_values" to "trans_color". + Changed so-number from 0 to 14. Some OS do not like 0. + Revised makefile.darwin to fix shared library numbering. + Change png_set_gray_1_2_4_to_8() to png_set_expand_gray_1_2_4_to_8() + in example.c (debian bug report) + +version 1.4.0beta36 [October 25, 2008] + Sync with tEXt vulnerability fix in libpng-1.2.33rc02. + +version 1.4.0beta37 [November 13, 2008] + Added png_check_cHRM in png.c and moved checking from pngget.c, pngrutil.c, + and pngwrite.c + +version 1.4.0beta38 [November 22, 2008] + Added check for zero-area RGB cHRM triangle in png_check_cHRM() and + png_check_cHRM_fixed(). + +version 1.4.0beta39 [November 23, 2008] + Revised png_warning() to write its message on standard output by default + when warning_fn is NULL. + +version 1.4.0beta40 [November 24, 2008] + Eliminated png_check_cHRM(). Instead, always use png_check_cHRM_fixed(). + In png_check_cHRM_fixed(), ensure white_y is > 0, and removed redundant + check for all-zero coordinates that is detected by the triangle check. + +version 1.4.0beta41 [November 26, 2008] + Fixed string vs pointer-to-string error in png_check_keyword(). + Rearranged test expressions in png_check_cHRM_fixed() to avoid internal + overflows. + Added PNG_NO_CHECK_cHRM conditional. + +version 1.4.0beta42, 43 [December 1, 2008] + Merge png_debug with version 1.2.34beta04. + +version 1.4.0beta44 [December 6, 2008] + Removed redundant check for key==NULL before calling png_check_keyword() + to ensure that new_key gets initialized and removed extra warning + (Merge with version 1.2.34beta05 -- Arvan Pritchard). + +version 1.4.0beta45 [December 9, 2008] + In png_write_png(), respect the placement of the filler bytes in an earlier + call to png_set_filler() (Jim Barry). + +version 1.4.0beta46 [December 10, 2008] + Undid previous change and added PNG_TRANSFORM_STRIP_FILLER_BEFORE and + PNG_TRANSFORM_STRIP_FILLER_AFTER conditionals and deprecated + PNG_TRANSFORM_STRIP_FILLER (Jim Barry). + +version 1.4.0beta47 [December 15, 2008] + Support for dithering was disabled by default, because it has never + been well tested and doesn't work very well. The code has not + been removed, however, and can be enabled by building libpng with + PNG_READ_DITHER_SUPPORTED defined. + +version 1.4.0beta48 [February 14, 2009] + Added new exported function png_calloc(). + Combined several instances of png_malloc(); png_memset() into png_calloc(). + Removed prototype for png_freeptr() that was added in libpng-1.4.0beta24 + but was never defined. + +version 1.4.0beta49 [February 28, 2009] + Added png_fileno() macro to pngconf.h, used in pngwio.c + Corrected order of #ifdef's in png_debug definition in png.h + Fixed bug introduced in libpng-1.4.0beta48 with the memset arguments + for pcal_params. + Fixed order of #ifdef directives in the png_debug defines in png.h + (bug introduced in libpng-1.2.34/1.4.0beta29). + Revised comments in png_set_read_fn() and png_set_write_fn(). + +version 1.4.0beta50 [March 18, 2009] + Use png_calloc() instead of png_malloc() to allocate big_row_buf when + reading an interlaced file, to avoid a possible UMR. + Undid revision of PNG_NO_STDIO version of png_write_flush(). Users + having trouble with fflush() can build with PNG_NO_WRITE_FLUSH defined + or supply their own flush_fn() replacement. + Revised libpng*.txt and png.h documentation about use of png_write_flush() + and png_set_write_fn(). + Removed fflush() from pngtest.c. + Added "#define PNG_NO_WRITE_FLUSH" to contrib/pngminim/encoder/pngusr.h + +version 1.4.0beta51 [March 21, 2009] + Removed new png_fileno() macro from pngconf.h . + +version 1.4.0beta52 [March 27, 2009] + Relocated png_do_chop() ahead of building gamma tables in pngrtran.c + This avoids building 16-bit gamma tables unnecessarily. + Removed fflush() from pngtest.c. + Added "#define PNG_NO_WRITE_FLUSH" to contrib/pngminim/encoder/pngusr.h + Added a section on differences between 1.0.x and 1.2.x to libpng.3/libpng.txt + +version 1.4.0beta53 [April 1, 2009] + Removed some remaining MMX macros from pngpriv.h + Fixed potential memory leak of "new_name" in png_write_iCCP() (Ralph Giles) + +version 1.4.0beta54 [April 13, 2009] + Added "ifndef PNG_SKIP_SETJMP_CHECK" block in pngconf.h to allow + application code writers to bypass the check for multiple inclusion + of setjmp.h when they know that it is safe to ignore the situation. + Eliminated internal use of setjmp() in pngread.c and pngwrite.c + Reordered ancillary chunks in pngtest.png to be the same as what + pngtest now produces, and made some cosmetic changes to pngtest output. + Eliminated deprecated png_read_init_3() and png_write_init_3() functions. + +version 1.4.0beta55 [April 15, 2009] + Simplified error handling in pngread.c and pngwrite.c by putting + the new png_read_cleanup() and png_write_cleanup() functions inline. + +version 1.4.0beta56 [April 25, 2009] + Renamed "user_chunk_data" to "my_user_chunk_data" in pngtest.c to suppress + "shadowed declaration" warning from gcc-4.3.3. + Renamed "gamma" to "png_gamma" in pngset.c to avoid "shadowed declaration" + warning about a global "gamma" variable in math.h on some platforms. + +version 1.4.0beta57 [May 2, 2009] + Removed prototype for png_freeptr() that was added in libpng-1.4.0beta24 + but was never defined (again). + Rebuilt configure scripts with autoconf-2.63 instead of 2.62 + Removed pngprefs.h and MMX from makefiles + +version 1.4.0beta58 [May 14, 2009] + Changed pngw32.def to pngwin.def in makefile.mingw (typo was introduced + in beta57). + Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri) + +version 1.4.0beta59 [May 15, 2009] + Reformated sources in libpng style (3-space intentation, comment format) + Fixed typo in libpng docs (PNG_FILTER_AVE should be PNG_FILTER_AVG) + Added sections about the git repository and our coding style to the + documentation + Relocated misplaced #endif in pngwrite.c, sCAL chunk handler. + +version 1.4.0beta60 [May 19, 2009] + Conditionally compile png_read_finish_row() which is not used by + progressive readers. + Added contrib/pngminim/preader to demonstrate building minimal progressive + decoder, based on contrib/gregbook with embedded libpng and zlib. + +version 1.4.0beta61 [May 20, 2009] + In contrib/pngminim/*, renamed "makefile.std" to "makefile", since there + is only one makefile in those directories, and revised the README files + accordingly. + More reformatting of comments, mostly to capitalize sentences. + +version 1.4.0beta62 [June 2, 2009] + Added "#define PNG_NO_WRITE_SWAP" to contrib/pngminim/encoder/pngusr.h + and "define PNG_NO_READ_SWAP" to decoder/pngusr.h and preader/pngusr.h + Reformatted several remaining "else statement" into two lines. + Added a section to the libpng documentation about using png_get_io_ptr() + in configure scripts to detect the presence of libpng. + +version 1.4.0beta63 [June 15, 2009] + Revised libpng*.txt and libpng.3 to mention calling png_set_IHDR() + multiple times and to specify the sample order in the tRNS chunk, + because the ISO PNG specification has a typo in the tRNS table. + Changed several PNG_UNKNOWN_CHUNK_SUPPORTED to + PNG_HANDLE_AS_UNKNOWN_SUPPORTED, to make the png_set_keep mechanism + available for ignoring known chunks even when not saving unknown chunks. + Adopted preference for consistent use of "#ifdef" and "#ifndef" versus + "#if defined()" and "if !defined()" where possible. + +version 1.4.0beta64 [June 24, 2009] + Eliminated PNG_LEGACY_SUPPORTED code. + Moved the various unknown chunk macro definitions outside of the + PNG_READ|WRITE_ANCILLARY_CHUNK_SUPPORTED blocks. + +version 1.4.0beta65 [June 26, 2009] + Added a reference to the libpng license in each file. + +version 1.4.0beta66 [June 27, 2009] + Refer to the libpng license instead of the libpng license in each file. + +version 1.4.0beta67 [July 6, 2009] + Relocated INVERT_ALPHA within png_read_png() and png_write_png(). + Added high-level API transform PNG_TRANSFORM_GRAY_TO_RGB. + Added an "xcode" project to the projects directory (Alam Arias). + +version 1.4.0beta68 [July 19, 2009] + Avoid some tests in filter selection in pngwutil.c + +version 1.4.0beta69 [July 25, 2009] + Simplified the new filter-selection test. This runs faster in the + common "PNG_ALL_FILTERS" and PNG_FILTER_NONE cases. + Removed extraneous declaration from the new call to png_read_gray_to_rgb() + (bug introduced in libpng-1.4.0beta67). + Fixed up xcode project (Alam Arias) + Added a prototype for png_64bit_product() in png.c + +version 1.4.0beta70 [July 27, 2009] + Avoid a possible NULL dereference in debug build, in png_set_text_2(). + (bug introduced in libpng-0.95, discovered by Evan Rouault) + +version 1.4.0beta71 [July 29, 2009] + Rebuilt configure scripts with autoconf-2.64. + +version 1.4.0beta72 [August 1, 2009] + Replaced *.tar.lzma with *.tar.xz in distribution. Get the xz codec + from . + +version 1.4.0beta73 [August 1, 2009] + Reject attempt to write iCCP chunk with negative embedded profile length + (JD Chen) + +version 1.4.0beta74 [August 8, 2009] + Changed png_ptr and info_ptr member "trans" to "trans_alpha". + +version 1.4.0beta75 [August 21, 2009] + Removed an extra png_debug() recently added to png_write_find_filter(). + Fixed incorrect #ifdef in pngset.c regarding unknown chunk support. + +version 1.4.0beta76 [August 22, 2009] + Moved an incorrectly located test in png_read_row() in pngread.c + +version 1.4.0beta77 [August 27, 2009] + Removed lpXYZ.tar.bz2 (with CRLF), KNOWNBUG, libpng-x.y.z-KNOWNBUG.txt, + and the "noconfig" files from the distribution. + Moved CMakeLists.txt from scripts into the main libpng directory. + Various bugfixes and improvements to CMakeLists.txt (Philip Lowman) + +version 1.4.0beta78 [August 31, 2009] + Converted all PNG_NO_* tests to PNG_*_SUPPORTED everywhere except pngconf.h + Eliminated PNG_NO_FREE_ME and PNG_FREE_ME_SUPPORTED macros. + Use png_malloc plus a loop instead of png_calloc() to initialize + row_pointers in png_read_png(). + +version 1.4.0beta79 [September 1, 2009] + Eliminated PNG_GLOBAL_ARRAYS and PNG_LOCAL_ARRAYS; always use local arrays. + Eliminated PNG_CALLOC_SUPPORTED macro and always provide png_calloc(). + +version 1.4.0beta80 [September 17, 2009] + Removed scripts/libpng.icc + Changed typecast of filler from png_byte to png_uint_16 in png_set_filler(). + (Dennis Gustafsson) + Fixed typo introduced in beta78 in pngtest.c ("#if def " should be "#ifdef ") + +version 1.4.0beta81 [September 23, 2009] + Eliminated unused PNG_FLAG_FREE_* defines from pngpriv.h + Expanded TAB characters in pngrtran.c + Removed PNG_CONST from all "PNG_CONST PNG_CHNK" declarations to avoid + compiler complaints about doubly declaring things "const". + Changed all "#if [!]defined(X)" to "if[n]def X" where possible. + Eliminated unused png_ptr->row_buf_size + +version 1.4.0beta82 [September 25, 2009] + Moved redundant IHDR checking into new png_check_IHDR() in png.c + and report all errors found in the IHDR data. + Eliminated useless call to png_check_cHRM() from pngset.c + +version 1.4.0beta83 [September 25, 2009] + Revised png_check_IHDR() to eliminate bogus complaint about filter_type. + +version 1.4.0beta84 [September 30, 2009] + Fixed some inconsistent indentation in pngconf.h + Revised png_check_IHDR() to add a test for width variable less than 32-bit. + +version 1.4.0beta85 [October 1, 2009] + Revised png_check_IHDR() again, to check info_ptr members instead of + the contents of the returned parameters. + +version 1.4.0beta86 [October 9, 2009] + Updated the "xcode" project (Alam Arias). + Eliminated a shadowed declaration of "pp" in png_handle_sPLT(). + +version 1.4.0rc01 [October 19, 2009] + Trivial cosmetic changes. + +version 1.4.0beta87 [October 30, 2009] + Moved version 1.4.0 back into beta. + +version 1.4.0beta88 [October 30, 2009] + Revised libpng*.txt section about differences between 1.2.x and 1.4.0 + because most of the new features have now been ported back to 1.2.41 + +version 1.4.0beta89 [November 1, 2009] + More bugfixes and improvements to CMakeLists.txt (Philip Lowman) + Removed a harmless extra png_set_invert_alpha() from pngwrite.c + Apply png_user_chunk_cache_max within png_decompress_chunk(). + Merged libpng-1.2.41.txt with libpng-1.4.0.txt where appropriate. + +version 1.4.0beta90 [November 2, 2009] + Removed all remaining WIN32_WCE #ifdefs except those involving the + time.h "tm" structure + +version 1.4.0beta91 [November 3, 2009] + Updated scripts/pngw32.def and projects/wince/png32ce.def + Copied projects/wince/png32ce.def to the scripts directory. + Added scripts/makefile.wce + Patched ltmain.sh for wince support. + Added PNG_CONVERT_tIME_SUPPORTED macro. + +version 1.4.0beta92 [November 4, 2009] + Make inclusion of time.h in pngconf.h depend on PNG_CONVERT_tIME_SUPPORTED + Make #define PNG_CONVERT_tIME_SUPPORTED depend on PNG_WRITE_tIME_SUPPORTED + Revised libpng*.txt to describe differences from 1.2.40 to 1.4.0 (instead + of differences from 1.2.41 to 1.4.0) + +version 1.4.0beta93 [November 7, 2009] + Added PNG_DEPSTRUCT, PNG_DEPRECATED, PNG_USE_RESULT, PNG_NORETURN, and + PNG_ALLOCATED macros to detect deprecated direct access to the + png_struct or info_struct members and other deprecated usage in + applications (John Bowler). + Updated scripts/makefile* to add "-DPNG_CONFIGURE_LIBPNG" to CFLAGS, + to prevent warnings about direct access to png structs by libpng + functions while building libpng. They need to be tested, especially + those using compilers other than gcc. + Updated projects/visualc6 and visualc71 with "/d PNG_CONFIGURE_LIBPNG". + They should work but still need to be updated to remove + references to pnggccrd.c or pngvcrd.c and ASM building. + Added README.txt to the beos, cbuilder5, netware, and xcode projects warning + that they need to be updated, to remove references to pnggccrd.c and + pngvcrd.c and to depend on pngpriv.h + Removed three direct references to read_info_ptr members in pngtest.c + that were detected by the new PNG_DEPSTRUCT macro. + Moved the png_debug macro definitions and the png_read_destroy(), + png_write_destroy() and png_far_to_near() prototypes from png.h + to pngpriv.h (John Bowler) + Moved the synopsis lines for png_read_destroy(), png_write_destroy() + png_debug(), png_debug1(), and png_debug2() from libpng.3 to libpngpf.3. + +version 1.4.0beta94 [November 9, 2009] + Removed the obsolete, unused pnggccrd.c and pngvcrd.c files. + Updated CMakeLists.txt to add "-DPNG_CONFIGURE_LIBPNG" to the definitions. + Removed dependency of pngtest.o on pngpriv.h in the makefiles. + Only #define PNG_DEPSTRUCT, etc. in pngconf.h if not already defined. + +version 1.4.0beta95 [November 10, 2009] + Changed png_check_sig() to !png_sig_cmp() in contrib programs. + Added -DPNG_CONFIGURE_LIBPNG to contrib/pngminm/*/makefile + Changed png_check_sig() to !png_sig_cmp() in contrib programs. + Corrected the png_get_IHDR() call in contrib/gregbook/readpng2.c + Changed pngminim/*/gather.sh to stop trying to remove pnggccrd.c and pngvcrd.c + Added dependency on pngpriv.h in contrib/pngminim/*/makefile + +version 1.4.0beta96 [November 12, 2009] + Renamed scripts/makefile.wce to scripts/makefile.cegcc + Revised Makefile.am to use libpng.sys while building libpng.so + so that only PNG_EXPORT functions are exported. + Removed the deprecated png_check_sig() function/macro. + Removed recently removed function names from scripts/*.def + Revised pngtest.png to put chunks in the same order written by pngtest + (evidently the same change made in libpng-1.0beta54 was lost). + Added PNG_PRIVATE macro definition in pngconf.h for possible future use. + +version 1.4.0beta97 [November 13, 2009] + Restored pngtest.png to the libpng-1.4.0beta7 version. + Removed projects/beos and netware.txt; no one seems to be supporting them. + Revised Makefile.in + +version 1.4.0beta98 [November 13, 2009] + Added the "xcode" project to zip distributions, + Fixed a typo in scripts/pngwin.def introduced in beta97. + +version 1.4.0beta99 [November 14, 2009] + Moved libpng-config.in and libpng.pc-configure.in out of the scripts + directory, to libpng-config.in and libpng-pc.in, respectively, and + modified Makefile.am and configure.ac accordingly. Now "configure" + needs nothing from the "scripts" directory. + Avoid redefining PNG_CONST in pngconf.h + +version 1.4.0beta100 [November 14, 2009] + Removed ASM builds from projects/visualc6 and projects/visualc71 + Removed scripts/makefile.nommx and makefile.vcawin32 + Revised CMakeLists.txt to account for new location of libpng-config.in + and libpng-pc.in + Updated INSTALL to reflect removal and relocation of files. + +version 1.4.0beta101 [November 14, 2009] + Restored the binary files (*.jpg, *.png, some project files) that were + accidentally deleted from the zip and 7z distributions when the xcode + project was added. + +version 1.4.0beta102 [November 18, 2009] + Added libpng-config.in and libpng-pc.in to the zip and 7z distributions. + Fixed a typo in projects/visualc6/pngtest.dsp, introduced in beta100. + Moved descriptions of makefiles and other scripts out of INSTALL into + scripts/README.txt + Updated the copyright year in scripts/pngwin.rc from 2006 to 2009. + +version 1.4.0beta103 [November 21, 2009] + Removed obsolete comments about ASM from projects/visualc71/README_zlib.txt + Align row_buf on 16-byte boundary in memory. + Restored the PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED guard around the call + to png_flush() after png_write_IEND(). See 1.4.0beta32, 1.4.0beta50 + changes above and 1.2.30, 1.2.30rc01 and rc03 in 1.2.41 CHANGES. Someone + needs this feature. + Make the 'png_jmpbuf' macro expand to a call that records the correct + longjmp function as well as returning a pointer to the setjmp + jmp_buf buffer, and marked direct access to jmpbuf 'deprecated'. + (John Bowler) + +version 1.4.0beta104 [November 22, 2009] + Removed png_longjmp_ptr from scripts/*.def and libpng.3 + Rebuilt configure scripts with autoconf-2.65 + +version 1.4.0beta105 [November 25, 2009] + Use fast integer PNG_DIVIDE_BY_255() or PNG_DIVIDE_BY_65535() + to accomplish alpha premultiplication when + PNG_READ_COMPOSITE_NODIV_SUPPORTED is defined. + Changed "/255" to "/255.0" in background calculations to make it clear + that the 255 is used as a double. + +version 1.4.0beta106 [November 27, 2009] + Removed premultiplied alpha feature. + +version 1.4.0beta107 [December 4, 2009] + Updated README + Added "#define PNG_NO_PEDANTIC_WARNINGS" in the libpng source files. + Removed "-DPNG_CONFIGURE_LIBPNG" from the makefiles and projects. + Revised scripts/makefile.netbsd, makefile.openbsd, and makefile.sco + to put png.h and pngconf.h in $prefix/include, like the other scripts, + instead of in $prefix/include/libpng. Also revised makefile.sco + to put them in $prefix/include/libpng14 instead of in + $prefix/include/libpng/libpng14. + +version 1.4.0beta108 [December 11, 2009] + Removed leftover "-DPNG_CONFIGURE_LIBPNG" from contrib/pngminim/*/makefile + Relocated png_do_chop() to its original position in pngrtran.c; the + change in version 1.2.41beta08 caused transparency to be handled wrong + in some 16-bit datastreams (Yusaku Sugai). + +version 1.4.0beta109 [December 13, 2009] + Added "bit_depth" parameter to the private png_build_gamma_table() function. + Pass bit_depth=8 to png_build_gamma_table() when bit_depth is 16 but the + PNG_16_TO_8 transform has been set, to avoid unnecessary build of 16-bit + tables. + +version 1.4.0rc02 [December 20, 2009] + Declared png_cleanup_needed "volatile" in pngread.c and pngwrite.c + +version 1.4.0rc03 [December 22, 2009] + Renamed libpng-pc.in back to libpng.pc.in and revised CMakeLists.txt + (revising the change in 1.4.0beta99) + +version 1.4.0rc04 [December 25, 2009] + Swapped PNG_UNKNOWN_CHUNKS_SUPPORTED and PNG_HANDLE_AS_UNKNOWN_SUPPORTED + in pngset.c to be consistent with other changes in version 1.2.38. + +version 1.4.0rc05 [December 25, 2009] + Changed "libpng-pc.in" to "libpng.pc.in" in configure.ac, configure, and + Makefile.in to be consistent with changes in libpng-1.4.0rc03 + +version 1.4.0rc06 [December 29, 2009] + Reverted the gamma_table changes from libpng-1.4.0beta109. + Fixed some indentation errors. + +version 1.4.0rc07 [January 1, 2010] + Revised libpng*.txt and libpng.3 about 1.2.x->1.4.x differences. + Use png_calloc() instead of png_malloc(); png_memset() in pngrutil.c + Update copyright year to 2010. + +version 1.4.0rc08 [January 2, 2010] + Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr + in pngtest.c + +version 1.4.0 [January 3, 2010] + No changes. + +version 1.4.1beta01 [January 8, 2010] + Updated CMakeLists.txt for consistent indentation and to avoid an + unclosed if-statement warning (Philip Lowman). + Revised Makefile.am and Makefile.in to remove references to Y2KINFO, + KNOWNBUG, and libpng.la (Robert Schwebel). + Revised the makefiles to install the same files and symbolic + links as configure, except for libpng.la and libpng14.la. + Make png_set|get_compression_buffer_size() available even when + PNG_WRITE_SUPPORTED is not enabled. + Revised Makefile.am and Makefile.in to simplify their maintenance. + Revised scripts/makefile.linux to install a link to libpng14.so.14.1 + +version 1.4.1beta02 [January 9, 2010] + Revised the rest of the makefiles to install a link to libpng14.so.14.1 + +version 1.4.1beta03 [January 10, 2010] + Removed png_set_premultiply_alpha() from scripts/*.def + +version 1.4.1rc01 [January 16, 2010] + No changes. + +version 1.4.1beta04 [January 23, 2010] + Revised png_decompress_chunk() to improve speed and memory usage when + decoding large chunks. + Added png_set|get_chunk_malloc_max() functions. + +version 1.4.1beta05 [January 26, 2010] + Relocated "int k" declaration in pngtest.c to minimize its scope. + +version 1.4.1beta06 [January 28, 2010] + Revised png_decompress_chunk() to use a two-pass method suggested by + John Bowler. + +version 1.4.1beta07 [February 6, 2010] + Folded some long lines in the source files. + Added defineable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX, + and a PNG_USER_LIMITS_SUPPORTED flag. + Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as + png_ptr->png_user_chunk_malloc_max. + Revised png_push_save_buffer() to do fewer but larger png_malloc() calls. + +version 1.4.1beta08 [February 6, 2010] + Minor cleanup and updating of dates and copyright year. + +version 1.4.1beta09 [February 7, 2010] + Reverted to original png_push_save_buffer() code. + +version 1.4.1beta10 [February 9, 2010] + Return allocated "old_buffer" in png_push_save_buffer() before calling + png_error(), to avoid a potential memory leak. + +version 1.4.1beta11 [February 12, 2010] + Relocated misplaced closing curley bracket in png_decompress_chunk(). + Removed unused "buffer_size" variable from png_decompress_chunk(). + Removed the cbuilder5 project, which has not been updated to 1.4.0. + Complete rewrite of two-pass png_decompress_chunk() by John Bowler. + +version 1.4.1beta12 [February 14, 2010] + Fixed type declaration of png_get_user_malloc_max() in pngget.c (Daisuke + Nishikawa) + +version 1.4.1rc02 [January 18, 2010] + No changes. + +version 1.4.1rc03 [February 19, 2010] + Noted in scripts/makefile.mingw that it expects to be run under MSYS. + Removed obsolete unused MMX-querying support from contrib/gregbook + Removed the AIX redefinition of jmpbuf in png.h + Define _ALL_SOURCE in configure.ac, makefile.aix, and CMakeLists.txt + when using AIX compiler. + +version 1.4.1rc04 [February 19, 2010] + Removed unused gzio.c from contrib/pngminim gather and makefile scripts + +version 1.4.1 [February 25, 2010] + +version 1.4.2beta01 [April 1, 2010] + Conditionally compile an "else" statement in png_decompress_chunk(). + Restored the macro definition of png_check_sig(). + +version 1.4.2rc01 [April 10, 2010] + No changes. + +version 1.4.2rc02 [April 16, 2010] + Documented the fact that png_set_dither() was disabled since libpng-1.4.0. + Reenabled png_set_dither() but renamed it to png_set_quantize() to reflect + more accurately what it actually does. At the same time, renamed + the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros to + PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS. + +version 1.4.2rc03 [April 24, 2010] + Added some "(long)" typecasts to printf calls in png_handle_cHRM(). + Relaxed the overly-restrictive permissions of some files. + +version 1.4.2rc04 [April 28, 2010] + Added the "vstudio" project to replace "visualc6" and "visualc71" which + will be removed from libpng-1.5.0. + Demonstrate in example.c that lang_key should be initialized. + Set PNG_NO_READ_BGR, PNG_NO_IO_STATE, and PNG_NO_TIME_RFC1123 in + contrib/pngminim/decoder/pngusr.h to make a smaller decoder application. + +version 1.4.2rc05 [April 29, 2010] + Include png_reset_zstream() in png.c only when PNG_READ_SUPPORTED is defined. + Removed dummy_inflate.c and uncompr.c from contrib/pngminim/encoder + Corrected PNG_UNKNOWN_CHUNKS_SUPPORTED to PNG_HANDLE_AS_UNKNOWN_SUPPORTED + in gregbook/readpng2.c + Corrected protection of png_get_user_transform_ptr. The API declaration in + png.h is removed if both READ and WRITE USER_TRANSFORM are turned off + but was left defined in pngtrans.c + +version 1.4.2rc06 [May 3, 2010] + Moved declarations of umsg[] inside the proper #ifdef blocks in pngrutil.c + +version 1.4.2 [May 6, 2010] + +version 1.4.3beta01 [June 18, 2010] + Added missing quotation marks in the aix block of configure.ac + The new "vstudio" project was missing from the zip and 7z distributions. + In pngpread.c: png_push_have_row() add check for new_row > height + +version 1.4.3beta02 [June 18, 2010] + Removed the now-redundant check for out-of-bounds new_row from example.c + +version 1.4.3beta03 [June 18, 2010] + In pngpread.c: png_push_finish_row() add check for too many rows. + +version 1.4.3beta04 [June 19, 2010] + In pngpread.c: png_push_process_row() add check for too many rows. + Removed the checks added in beta01 and beta03, as they are now redundant. + +version 1.4.3beta05 [June 20, 2010] + Rewrote png_process_IDAT_data to consistently treat extra data as warnings + and handle end conditions more cleanly. + Removed the new (beta04) check in png_push_process_row(). + +version 1.4.3rc01 [June 21, 2010] + Revised some comments in png_process_IDAT_data(). + +version 1.4.3rc02 [June 22, 2010] + Changed char *msg to PNG_CONST char *msg in pngrutil.c + Stop memory leak when reading a malformed sCAL chunk. + Removed some trailing blanks. + +version 1.4.3rc03 [June 23, 2010] + Revised pngpread.c patch of beta05 to avoid an endless loop. + +version 1.4.3 [June 26, 2010] + Updated some of the "last changed" dates. + +Send comments/corrections/commendations to glennrp at users.sourceforge.net +or to png-mng-implement at lists.sf.net (subscription required; visit +https://lists.sourceforge.net/lists/listinfo/png-mng-implement). + +Glenn R-P +*/ } +#endif diff --git a/png/CMakeLists.txt b/png/CMakeLists.txt new file mode 100644 index 0000000..5ce2780 --- /dev/null +++ b/png/CMakeLists.txt @@ -0,0 +1,282 @@ +cmake_minimum_required(VERSION 2.4.3) +set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) + +if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING + "Choose the type of build, options are: + None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) + Debug + Release + RelWithDebInfo + MinSizeRel.") +endif() + +project(libpng C) +enable_testing() + +# Copyright (C) 2007-2010 Glenn Randers-Pehrson + +# This code is released under the libpng license. +# For conditions of distribution and use, see the disclaimer +# and license in png.h + +set(PNGLIB_MAJOR 1) +set(PNGLIB_MINOR 4) +set(PNGLIB_RELEASE 3) +set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) +set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) + +# needed packages +find_package(ZLIB REQUIRED) +include_directories(${ZLIB_INCLUDE_DIR}) + +if(NOT WIN32) + find_library(M_LIBRARY + NAMES m + PATHS /usr/lib /usr/local/lib + ) + if(NOT M_LIBRARY) + message(STATUS + "math library 'libm' not found - floating point support disabled") + endif() +else() + # not needed on windows + set(M_LIBRARY "") +endif() + +# COMMAND LINE OPTIONS +if(DEFINED PNG_SHARED) + option(PNG_SHARED "Build shared lib" ${PNG_SHARED}) +else() + option(PNG_SHARED "Build shared lib" ON) +endif() +if(DEFINED PNG_STATIC) + option(PNG_STATIC "Build static lib" ${PNG_STATIC}) +else() + option(PNG_STATIC "Build static lib" ON) +endif() + +if(MINGW) + option(PNG_TESTS "Build pngtest" NO) +else() + option(PNG_TESTS "Build pngtest" YES) +endif() + +option(PNG_NO_CONSOLE_IO "FIXME" YES) +option(PNG_NO_STDIO "FIXME" YES) +option(PNG_DEBUG "Build with debug output" NO) +option(PNGARG "FIXME" YES) +#TODO: +# PNG_CONSOLE_IO_SUPPORTED + +# maybe needs improving, but currently I don't know when we can enable what :) +set(png_asm_tmp "OFF") +if(NOT WIN32) + find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin) + if(uname_executable) + exec_program(${uname_executable} + ARGS --machine OUTPUT_VARIABLE uname_output) + if("uname_output" MATCHES "^.*i[1-9]86.*$") + set(png_asm_tmp "ON") + else("uname_output" MATCHES "^.*i[1-9]86.*$") + set(png_asm_tmp "OFF") + endif("uname_output" MATCHES "^.*i[1-9]86.*$") + endif(uname_executable) +else() + # this env var is normally only set on win64 + set(TEXT "ProgramFiles(x86)") + if("$ENV{${TEXT}}" STREQUAL "") + set(png_asm_tmp "ON") + endif("$ENV{${TEXT}}" STREQUAL "") +endif() + +# SET LIBNAME +set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR}) + +# to distinguish between debug and release lib +set(CMAKE_DEBUG_POSTFIX "d") + + +# OUR SOURCES +set(libpng_sources + png.h + pngconf.h + pngpriv.h + png.c + pngerror.c + pngget.c + pngmem.c + pngpread.c + pngread.c + pngrio.c + pngrtran.c + pngrutil.c + pngset.c + pngtrans.c + pngwio.c + pngwrite.c + pngwtran.c + pngwutil.c +) +set(pngtest_sources + pngtest.c +) +# SOME NEEDED DEFINITIONS + +add_definitions(-DPNG_CONFIGURE_LIBPNG) + +if(_AIX) + add_definitions(-D_ALL_SOURCE) +endif(_AIX) + +if(MSVC) + add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE) +endif(MSVC) + +if(PNG_SHARED OR NOT MSVC) + #if building msvc static this has NOT to be defined + add_definitions(-DZLIB_DLL) +endif() + + +if(PNG_CONSOLE_IO_SUPPORTED) + add_definitions(-DPNG_CONSOLE_IO_SUPPORTED) +endif() + +if(PNG_NO_CONSOLE_IO) + add_definitions(-DPNG_NO_CONSOLE_IO) +endif() + +if(PNG_NO_STDIO) + add_definitions(-DPNG_NO_STDIO) +endif() + +if(PNG_DEBUG) + add_definitions(-DPNG_DEBUG) +endif() + +if(NOT M_LIBRARY AND NOT WIN32) + add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED) +endif() + +# NOW BUILD OUR TARGET +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) + +if(PNG_SHARED) + add_library(${PNG_LIB_NAME} SHARED ${libpng_sources}) + if(MSVC) + # msvc does not append 'lib' - do it here to have consistent name + set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib") + endif() + target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY}) +endif() + +if(PNG_STATIC) +# does not work without changing name + set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static) + add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources}) + if(MSVC) + # msvc does not append 'lib' - do it here to have consistent name + set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib") + endif() +endif() + + +if(PNG_SHARED AND WIN32) + set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL) +endif() + +if(PNG_TESTS AND PNG_SHARED) + # does not work with msvc due to png_lib_ver issue + add_executable(pngtest ${pngtest_sources}) + target_link_libraries(pngtest ${PNG_LIB_NAME}) + add_test(pngtest pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png) +endif() + + +# CREATE PKGCONFIG FILES +# we use the same files like ./configure, so we have to set its vars +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix ${CMAKE_INSTALL_PREFIX}) +set(libdir ${CMAKE_INSTALL_PREFIX}/lib) +set(includedir ${CMAKE_INSTALL_PREFIX}/include) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in + ${CMAKE_CURRENT_BINARY_DIR}/libpng-config) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in + ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config) + +# SET UP LINKS +if(PNG_SHARED) + set_target_properties(${PNG_LIB_NAME} PROPERTIES +# VERSION 14.${PNGLIB_RELEASE}.1.4.3 + VERSION 14.${PNGLIB_RELEASE}.0 + SOVERSION 14 + CLEAN_DIRECT_OUTPUT 1) +endif() +if(PNG_STATIC) + if(NOT WIN32) + # that's uncool on win32 - it overwrites our static import lib... + set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES + OUTPUT_NAME ${PNG_LIB_NAME} + CLEAN_DIRECT_OUTPUT 1) + endif() +endif() + +# INSTALL +if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) + if(PNG_SHARED) + install(TARGETS ${PNG_LIB_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + endif() + if(PNG_STATIC) + install(TARGETS ${PNG_LIB_NAME_STATIC} + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + endif() +endif() + +if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) + install(FILES png.h pngconf.h DESTINATION include) + install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME}) +endif() +if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL ) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config + DESTINATION bin) +endif() +if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) + # Install man pages + install(FILES libpng.3 libpngpf.3 DESTINATION man/man3) + install(FILES png.5 DESTINATION man/man5) + # Install pkg-config files + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc + DESTINATION lib/pkgconfig) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng-config + DESTINATION bin) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc + DESTINATION lib/pkgconfig) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config + DESTINATION bin) +endif() + +# what's with libpng.txt and all the extra files? + + +# UNINSTALL +# do we need this? + + +# DIST +# do we need this? + +# to create msvc import lib for mingw compiled shared lib +# pexports libpng.dll > libpng.def +# lib /def:libpng.def /machine:x86 + diff --git a/png/INSTALL b/png/INSTALL new file mode 100644 index 0000000..584ac04 --- /dev/null +++ b/png/INSTALL @@ -0,0 +1,143 @@ + +Installing libpng version 1.4.3 - June 26, 2010 + +On Unix/Linux and similar systems, you can simply type + + ./configure [--prefix=/path] + make check + make install + +and ignore the rest of this document. + +If configure does not work on your system and you have a reasonably +up-to-date set of tools, running ./autogen.sh before running ./configure +may fix the problem. You can also run the individual commands in +autogen.sh with the --force option, if supported by your version of +the tools. If you run 'libtoolize --force', though, this will replace +the distributed, patched, version of ltmain.sh with an unpatched version +and your shared library builds may fail to produce libraries with the +correct version numbers. + +Instead, you can use one of the custom-built makefiles in the +"scripts" directory + + cp scripts/makefile.system makefile + make test + make install + +The files that are presently available in the scripts directory +are listed and described in scripts/README.txt. + +Or you can use one of the "projects" in the "projects" directory. + +Before installing libpng, you must first install zlib, if it +is not already on your system. zlib can usually be found +wherever you got libpng. zlib can be placed in another directory, +at the same level as libpng. + +If you want to use "cmake" (see www.cmake.org), type + + cmake . -DCMAKE_INSTALL_PREFIX=/path + make + make install + +If your system already has a preinstalled zlib you will still need +to have access to the zlib.h and zconf.h include files that +correspond to the version of zlib that's installed. + +You can rename the directories that you downloaded (they +might be called "libpng-1.4.3" or "libpng14" and "zlib-1.2.3" +or "zlib123") so that you have directories called "zlib" and "libpng". + +Your directory structure should look like this: + + .. (the parent directory) + libpng (this directory) + INSTALL (this file) + README + *.h + *.c + CMakeLists.txt => "cmake" script + configuration files: + configure.ac, configure, Makefile.am, Makefile.in, + autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in, + libpng-config.in, aclocal.m4, config.h.in, config.sub, + depcomp, install-sh, mkinstalldirs, test-pngtest.sh + contrib + gregbook + pngminim + pngminus + pngsuite + visupng + projects + cbuilder5 (Borland) + visualc6 (msvc) + visualc71 + xcode + scripts + makefile.* + *.def (module definition files) + pngtest.png + etc. + zlib + README + *.h + *.c + contrib + etc. + +If the line endings in the files look funny, you may wish to get the other +distribution of libpng. It is available in both tar.gz (UNIX style line +endings) and zip (DOS style line endings) formats. + +If you are building libpng with MSVC, you can enter the +libpng projects\visualc6 or visualc71 directory and follow the instructions +in README.txt. + +Otherwise enter the zlib directory and follow the instructions in zlib/README, +then come back here and run "configure" or choose the appropriate +makefile.sys in the scripts directory. + +Copy the file (or files) that you need from the +scripts directory into this directory, for example + + MSDOS example: copy scripts\makefile.msc makefile + UNIX example: cp scripts/makefile.std makefile + +Read the makefile to see if you need to change any source or +target directories to match your preferences. + +Then read pngconf.h to see if you want to make any configuration +changes. + +Then just run "make" which will create the libpng library in +this directory and "make test" which will run a quick test that reads +the "pngtest.png" file and writes a "pngout.png" file that should be +identical to it. Look for "9782 zero samples" in the output of the +test. For more confidence, you can run another test by typing +"pngtest pngnow.png" and looking for "289 zero samples" in the output. +Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare +your output with the result shown in contrib/pngsuite/README. + +Most of the makefiles will allow you to run "make install" to +put the library in its final resting place (if you want to +do that, run "make install" in the zlib directory first if necessary). +Some also allow you to run "make test-installed" after you have +run "make install". + +If you encounter a compiler error message complaining about the +lines + + __png.h__ already includes setjmp.h; + __dont__ include it again.; + +this means you have compiled another module that includes setjmp.h, +which is hazardous because the two modules might not include exactly +the same setjmp.h. If you are sure that you know what you are doing +and that they are exactly the same, then you can comment out or +delete the two lines. Better yet, use the cexcept interface +instead, as demonstrated in contrib/visupng of the libpng distribution. + +Further information can be found in the README and libpng.txt +files, in the individual makefiles, in png.h, and the manual pages +libpng.3 and png.5. diff --git a/png/LICENSE b/png/LICENSE new file mode 100644 index 0000000..dd89a66 --- /dev/null +++ b/png/LICENSE @@ -0,0 +1,111 @@ + +This copy of the libpng notices is provided for your convenience. In case of +any discrepancy between this copy and the notices in the file png.h that is +included in the libpng distribution, the latter shall prevail. + +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + +If you modify libpng you may insert additional notices immediately following +this sentence. + +This code is released under the libpng license. + +libpng versions 1.2.6, August 15, 2004, through 1.4.3, June 26, 2010, are +Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-1.2.5 +with the following individual added to the list of Contributing Authors + + Cosmin Truta + +libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are +Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-1.0.6 +with the following individuals added to the list of Contributing Authors + + Simon-Pierre Cadieux + Eric S. Raymond + Gilles Vollant + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of the + library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is with + the user. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-0.96, +with the following individuals added to the list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996, 1997 Andreas Dilger +Distributed according to the same disclaimer and license as libpng-0.88, +with the following individuals added to the list of Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing Authors +and Group 42, Inc. disclaim all warranties, expressed or implied, +including, without limitation, the warranties of merchantability and of +fitness for any purpose. The Contributing Authors and Group 42, Inc. +assume no liability for direct, indirect, incidental, special, exemplary, +or consequential damages, which may result from the use of the PNG +Reference Library, even if advised of the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + +1. The origin of this source code must not be misrepresented. + +2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. + +3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, without +fee, and encourage the use of this source code as a component to +supporting the PNG file format in commercial products. If you use this +source code in a product, acknowledgment is not required but would be +appreciated. + + +A "png_get_copyright" function is available, for convenient use in "about" +boxes and the like: + + printf("%s",png_get_copyright(NULL)); + +Also, the PNG logo (in PNG format, of course) is supplied in the +files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). + +Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a +certification mark of the Open Source Initiative. + +Glenn Randers-Pehrson +glennrp at users.sourceforge.net +June 26, 2010 diff --git a/png/README b/png/README new file mode 100644 index 0000000..799f3eb --- /dev/null +++ b/png/README @@ -0,0 +1,257 @@ +README for libpng version 1.4.3 - June 26, 2010 (shared library 14.0) +See the note about version numbers near the top of png.h + +See INSTALL for instructions on how to install libpng. + +Libpng comes in several distribution formats. Get libpng-*.tar.gz, +libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings +in the text files, or lpng*.zip if you want DOS-style line endings. + +Version 0.89 was the first official release of libpng. Don't let the +fact that it's the first release fool you. The libpng library has been in +extensive use and testing since mid-1995. By late 1997 it had +finally gotten to the stage where there hadn't been significant +changes to the API in some time, and people have a bad feeling about +libraries with versions < 1.0. Version 1.0.0 was released in +March 1998. + +**** +Note that some of the changes to the png_info structure render this +version of the library binary incompatible with libpng-0.89 or +earlier versions if you are using a shared library. The type of the +"filler" parameter for png_set_filler() has changed from png_byte to +png_uint_32, which will affect shared-library applications that use +this function. + +To avoid problems with changes to the internals of png_info_struct, +new APIs have been made available in 0.95 to avoid direct application +access to info_ptr. These functions are the png_set_ and +png_get_ functions. These functions should be used when +accessing/storing the info_struct data, rather than manipulating it +directly, to avoid such problems in the future. + +It is important to note that the APIs do not make current programs +that access the info struct directly incompatible with the new +library. However, it is strongly suggested that new programs use +the new APIs (as shown in example.c and pngtest.c), and older programs +be converted to the new format, to facilitate upgrades in the future. +**** + +Additions since 0.90 include the ability to compile libpng as a +Windows DLL, and new APIs for accessing data in the info struct. +Experimental functions include the ability to set weighting and cost +factors for row filter selection, direct reads of integers from buffers +on big-endian processors that support misaligned data access, faster +methods of doing alpha composition, and more accurate 16->8 bit color +conversion. + +The additions since 0.89 include the ability to read from a PNG stream +which has had some (or all) of the signature bytes read by the calling +application. This also allows the reading of embedded PNG streams that +do not have the PNG file signature. As well, it is now possible to set +the library action on the detection of chunk CRC errors. It is possible +to set different actions based on whether the CRC error occurred in a +critical or an ancillary chunk. + +The changes made to the library, and bugs fixed are based on discussions +on the PNG-implement mailing list and not on material submitted +privately to Guy, Andreas, or Glenn. They will forward any good +suggestions to the list. + +For a detailed description on using libpng, read libpng.txt. For +examples of libpng in a program, see example.c and pngtest.c. For usage +information and restrictions (what little they are) on libpng, see +png.h. For a description on using zlib (the compression library used by +libpng) and zlib's restrictions, see zlib.h + +I have included a general makefile, as well as several machine and +compiler specific ones, but you may have to modify one for your own needs. + +You should use zlib 1.0.4 or later to run this, but it MAY work with +versions as old as zlib 0.95. Even so, there are bugs in older zlib +versions which can cause the output of invalid compression streams for +some images. You will definitely need zlib 1.0.4 or later if you are +taking advantage of the MS-DOS "far" structure allocation for the small +and medium memory models. You should also note that zlib is a +compression library that is useful for more things than just PNG files. +You can use zlib as a drop-in replacement for fread() and fwrite() if +you are so inclined. + +zlib should be available at the same place that libpng is, or at. +ftp://ftp.info-zip.org/pub/infozip/zlib + +You may also want a copy of the PNG specification. It is available +as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find +these at http://www.libpng.org/pub/png/documents/ + +This code is currently being archived at libpng.sf.net in the +[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT) +at GO GRAPHSUP. If you can't find it in any of those places, +e-mail me, and I'll help you find it. + +If you have any code changes, requests, problems, etc., please e-mail +them to me. Also, I'd appreciate any make files or project files, +and any modifications you needed to make to get libpng to compile, +along with a #define variable to tell what compiler/system you are on. +If you needed to add transformations to libpng, or wish libpng would +provide the image in a different way, drop me a note (and code, if +possible), so I can consider supporting the transformation. +Finally, if you get any warning messages when compiling libpng +(note: not zlib), and they are easy to fix, I'd appreciate the +fix. Please mention "libpng" somewhere in the subject line. Thanks. + +This release was created and will be supported by myself (of course +based in a large way on Guy's and Andreas' earlier work), and the PNG +development group. + +Send comments/corrections/commendations to png-mng-implement at +lists.sourceforge.net (subscription required; visit +https://lists.sourceforge.net/lists/listinfo/png-mng-implement +to subscribe) or to glennrp at users.sourceforge.net + +You can't reach Guy, the original libpng author, at the addresses +given in previous versions of this document. He and Andreas will +read mail addressed to the png-implement list, however. + +Please do not send general questions about PNG. Send them to +the (png-list at ccrc.wustl.edu, subscription required, write to +majordomo at ccrc.wustl.edu with "subscribe png-list" in your message). +On the other hand, +please do not send libpng questions to that address, send them to me +or to the png-implement list. I'll +get them in the end anyway. If you have a question about something +in the PNG specification that is related to using libpng, send it +to me. Send me any questions that start with "I was using libpng, +and ...". If in doubt, send questions to me. I'll bounce them +to others, if necessary. + +Please do not send suggestions on how to change PNG. We have +been discussing PNG for nine years now, and it is official and +finished. If you have suggestions for libpng, however, I'll +gladly listen. Even if your suggestion is not used immediately, +it may be used later. + +Files in this distribution: + + ANNOUNCE => Announcement of this version, with recent changes + CHANGES => Description of changes between libpng versions + KNOWNBUG => List of known bugs and deficiencies + LICENSE => License to use and redistribute libpng + README => This file + TODO => Things not implemented in the current library + Y2KINFO => Statement of Y2K compliance + example.c => Example code for using libpng functions + libpng.3 => manual page for libpng (includes libpng.txt) + libpng.txt => Description of libpng and its functions + libpngpf.3 => manual page for libpng's private functions + png.5 => manual page for the PNG format + png.c => Basic interface functions common to library + png.h => Library function and interface declarations + pngconf.h => System specific library configuration + pngerror.c => Error/warning message I/O functions + pngget.c => Functions for retrieving info from struct + pngmem.c => Memory handling functions + pngbar.png => PNG logo, 88x31 + pngnow.png => PNG logo, 98x31 + pngpread.c => Progressive reading functions + pngread.c => Read data/helper high-level functions + pngrio.c => Lowest-level data read I/O functions + pngrtran.c => Read data transformation functions + pngrutil.c => Read data utility functions + pngset.c => Functions for storing data into the info_struct + pngtest.c => Library test program + pngtest.png => Library test sample image + pngtrans.c => Common data transformation functions + pngwio.c => Lowest-level write I/O functions + pngwrite.c => High-level write functions + pngwtran.c => Write data transformations + pngwutil.c => Write utility functions + contrib => Contributions + gregbook => source code for PNG reading and writing, from + Greg Roelofs' "PNG: The Definitive Guide", + O'Reilly, 1999 + msvctest => Builds and runs pngtest using a MSVC workspace + pngminus => Simple pnm2png and png2pnm programs + pngsuite => Test images + visupng => Contains a MSVC workspace for VisualPng + projects => Contains project files and workspaces for + building a DLL + c5builder => Contains a Borland workspace for building + libpng and zlib + visualc6 => Contains a Microsoft Visual C++ (MSVC) + workspace for building libpng and zlib + scripts => Directory containing scripts for building libpng: + descrip.mms => VMS makefile for MMS or MMK + makefile.std => Generic UNIX makefile (cc, creates static + libpng.a) + makefile.elf => Linux/ELF makefile symbol versioning, + gcc, creates libpng14.so.14.1.4.3) + makefile.linux => Linux/ELF makefile + (gcc, creates libpng14.so.14.1.4.3) + makefile.gcc => Generic makefile (gcc, creates static libpng.a) + makefile.knr => Archaic UNIX Makefile that converts files with + ansi2knr (Requires ansi2knr.c from + ftp://ftp.cs.wisc.edu/ghost) + makefile.aix => AIX makefile + makefile.cygwin => Cygwin/gcc makefile + makefile.darwin => Darwin makefile + makefile.dec => DEC Alpha UNIX makefile + makefile.freebsd => FreeBSD makefile + makefile.hpgcc => HPUX makefile using gcc + makefile.hpux => HPUX (10.20 and 11.00) makefile + makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit + makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static) + makefile.intel => Intel C/C++ version 4.0 and later + makefile.mingw => Mingw/gcc makefile + makefile.netbsd => NetBSD/cc makefile, makes libpng.so. + makefile.ne14bsd => NetBSD/cc makefile, makes + libpng14.so + makefile.openbsd => OpenBSD makefile + makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) + makefile.sggcc => Silicon Graphics + (gcc, creates libpng14.so.14.1.4.3) + makefile.sunos => Sun makefile + makefile.solaris => Solaris 2.X makefile + (gcc, creates libpng14.so.14.1.4.3) + makefile.so9 => Solaris 9 makefile + (gcc, creates libpng14.so.14.1.4.3) + makefile.32sunu => Sun Ultra 32-bit makefile + makefile.64sunu => Sun Ultra 64-bit makefile + makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc + makefile.mips => MIPS makefile + makefile.acorn => Acorn makefile + makefile.amiga => Amiga makefile + smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC + compiler (Requires SCOPTIONS, copied from + scripts/SCOPTIONS.ppc) + makefile.atari => Atari makefile + makefile.beos => BEOS makefile for X86 + makefile.bor => Borland makefile (uses bcc) + makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode) + makefile.tc3 => Turbo C 3.0 makefile + makefile.dj2 => DJGPP 2 makefile + makefile.msc => Microsoft C makefile + makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and + later (does not use assembler code) + makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def) + png32ce.def => module definition for makefile.cegccg + pngos2.def => OS/2 module definition file used by + makefile.os2 + pngwin.def => module definition file used by + makefile.cygwin and makefile.mingw + makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model + makevms.com => VMS build script + SCOPTIONS.ppc => Used with smakefile.ppc + +Good luck, and happy coding. + +-Glenn Randers-Pehrson (current maintainer, since 1998) + Internet: glennrp at users.sourceforge.net + +-Andreas Eric Dilger (former maintainer, 1996-1997) + Internet: adilger at enel.ucalgary.ca + Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/ + +-Guy Eric Schalnat (original author and former maintainer, 1995-1996) + (formerly of Group 42, Inc) + Internet: gschal at infinet.com diff --git a/png/TODO b/png/TODO new file mode 100644 index 0000000..0af8d82 --- /dev/null +++ b/png/TODO @@ -0,0 +1,31 @@ +/* +TODO - list of things to do for libpng: + +Final bug fixes. +Improve API by hiding the png_struct and png_info structs. +Finish work on the no-floating-point version (including gamma compensation) +Better C++ wrapper/full C++ implementation? +Fix problem with C++ and EXTERN "C". +cHRM transformation. +Improve setjmp/longjmp usage or remove it in favor of returning error codes. +Add "grayscale->palette" transformation and "palette->grayscale" detection. +Improved quantizing and dithering. +Multi-lingual error and warning message support. +Complete sRGB transformation (presently it simply uses gamma=0.45455). +Man pages for function calls. +Better documentation. +Better filter selection + (counting huffman bits/precompression? filter inertia? filter costs?). +Histogram creation. +Text conversion between different code pages (Latin-1 -> Mac and DOS). +Build gamma tables using fixed point (and do away with floating point entirely). +Avoid building gamma tables whenever possible. +Use greater precision when changing to linear gamma for compositing against + background and doing rgb-to-gray transformation. +Investigate pre-incremented loop counters and other loop constructions. +Add interpolated method of handling interlacing. +Provide for conditional compilation of 16-bit support (except for the + initial stripping down to 8-bits when reading a 16-bit PNG datastream). +Switch to the simpler zlib (zlib/libpng) license if legally possible. + +*/ diff --git a/png/configure b/png/configure new file mode 100644 index 0000000..ea29399 --- /dev/null +++ b/png/configure @@ -0,0 +1,13 @@ +#!/bin/sh +echo " + There is no \"configure\" script in this distribution of + libpng-1.4.3. + + Instead, please copy the appropriate makefile for your system from the + \"scripts\" directory. Read the INSTALL file for more details. + + Update, July 2004: you can get a \"configure\" based distribution + from the libpng distribution sites. Download the file + libpng-1.4.3.tar.gz, libpng-1.4.3.tar.xz, or libpng-1.4.3.tar.bz2 +" + diff --git a/png/example.c b/png/example.c new file mode 100644 index 0000000..d739173 --- /dev/null +++ b/png/example.c @@ -0,0 +1,838 @@ + +#if 0 /* in case someone actually tries to compile this */ + +/* example.c - an example of using libpng + * Last changed in libpng 1.4.2 [May 6, 2010] + * This file has been placed in the public domain by the authors. + * Maintained 1998-2010 Glenn Randers-Pehrson + * Maintained 1996, 1997 Andreas Dilger) + * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + */ + +/* This is an example of how to use libpng to read and write PNG files. + * The file libpng.txt is much more verbose then this. If you have not + * read it, do so first. This was designed to be a starting point of an + * implementation. This is not officially part of libpng, is hereby placed + * in the public domain, and therefore does not require a copyright notice. + * + * This file does not currently compile, because it is missing certain + * parts, like allocating memory to hold an image. You will have to + * supply these parts to get it to compile. For an example of a minimal + * working PNG reader/writer, see pngtest.c, included in this distribution; + * see also the programs in the contrib directory. + */ + +#include "png.h" + + /* The png_jmpbuf() macro, used in error handling, became available in + * libpng version 1.0.6. If you want to be able to run your code with older + * versions of libpng, you must define the macro yourself (but only if it + * is not already defined by libpng!). + */ + +#ifndef png_jmpbuf +# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) +#endif + +/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp() + * returns zero if the image is a PNG and nonzero if it isn't a PNG. + * + * The function check_if_png() shown here, but not used, returns nonzero (true) + * if the file can be opened and is a PNG, 0 (false) otherwise. + * + * If this call is successful, and you are going to keep the file open, + * you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once + * you have created the png_ptr, so that libpng knows your application + * has read that many bytes from the start of the file. Make sure you + * don't call png_set_sig_bytes() with more than 8 bytes read or give it + * an incorrect number of bytes read, or you will either have read too + * many bytes (your fault), or you are telling libpng to read the wrong + * number of magic bytes (also your fault). + * + * Many applications already read the first 2 or 4 bytes from the start + * of the image to determine the file type, so it would be easiest just + * to pass the bytes to png_sig_cmp() or even skip that if you know + * you have a PNG file, and call png_set_sig_bytes(). + */ +#define PNG_BYTES_TO_CHECK 4 +int check_if_png(char *file_name, FILE **fp) +{ + char buf[PNG_BYTES_TO_CHECK]; + + /* Open the prospective PNG file. */ + if ((*fp = fopen(file_name, "rb")) == NULL) + return 0; + + /* Read in some of the signature bytes */ + if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK) + return 0; + + /* Compare the first PNG_BYTES_TO_CHECK bytes of the signature. + Return nonzero (true) if they match */ + + return(!png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK)); +} + +/* Read a PNG file. You may want to return an error code if the read + * fails (depending upon the failure). There are two "prototypes" given + * here - one where we are given the filename, and we need to open the + * file, and the other where we are given an open file (possibly with + * some or all of the magic bytes read - see comments above). + */ +#ifdef open_file /* prototype 1 */ +void read_png(char *file_name) /* We need to open the file */ +{ + png_structp png_ptr; + png_infop info_ptr; + unsigned int sig_read = 0; + png_uint_32 width, height; + int bit_depth, color_type, interlace_type; + FILE *fp; + + if ((fp = fopen(file_name, "rb")) == NULL) + return (ERROR); + +#else no_open_file /* prototype 2 */ +void read_png(FILE *fp, unsigned int sig_read) /* File is already open */ +{ + png_structp png_ptr; + png_infop info_ptr; + png_uint_32 width, height; + int bit_depth, color_type, interlace_type; +#endif no_open_file /* Only use one prototype! */ + + /* Create and initialize the png_struct with the desired error handler + * functions. If you want to use the default stderr and longjump method, + * you can supply NULL for the last three parameters. We also supply the + * the compiler header file version, so that we know if the application + * was compiled with a compatible version of the library. REQUIRED + */ + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, + png_voidp user_error_ptr, user_error_fn, user_warning_fn); + + if (png_ptr == NULL) + { + fclose(fp); + return (ERROR); + } + + /* Allocate/initialize the memory for image information. REQUIRED. */ + info_ptr = png_create_info_struct(png_ptr); + if (info_ptr == NULL) + { + fclose(fp); + png_destroy_read_struct(&png_ptr, NULL, NULL); + return (ERROR); + } + + /* Set error handling if you are using the setjmp/longjmp method (this is + * the normal method of doing things with libpng). REQUIRED unless you + * set up your own error handlers in the png_create_read_struct() earlier. + */ + + if (setjmp(png_jmpbuf(png_ptr))) + { + /* Free all of the memory associated with the png_ptr and info_ptr */ + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + fclose(fp); + /* If we get here, we had a problem reading the file */ + return (ERROR); + } + + /* One of the following I/O initialization methods is REQUIRED */ +#ifdef streams /* PNG file I/O method 1 */ + /* Set up the input control if you are using standard C streams */ + png_init_io(png_ptr, fp); + +#else no_streams /* PNG file I/O method 2 */ + /* If you are using replacement read functions, instead of calling + * png_init_io() here you would call: + */ + png_set_read_fn(png_ptr, (void *)user_io_ptr, user_read_fn); + /* where user_io_ptr is a structure you want available to the callbacks */ +#endif no_streams /* Use only one I/O method! */ + + /* If we have already read some of the signature */ + png_set_sig_bytes(png_ptr, sig_read); + +#ifdef hilevel + /* + * If you have enough memory to read in the entire image at once, + * and you need to specify only transforms that can be controlled + * with one of the PNG_TRANSFORM_* bits (this presently excludes + * quantizing, filling, setting background, and doing gamma + * adjustment), then you can read the entire image (including + * pixels) into the info structure with this call: + */ + png_read_png(png_ptr, info_ptr, png_transforms, NULL); + +#else + /* OK, you're doing it the hard way, with the lower-level functions */ + + /* The call to png_read_info() gives us all of the information from the + * PNG file before the first IDAT (image data chunk). REQUIRED + */ + png_read_info(png_ptr, info_ptr); + + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, + &interlace_type, NULL, NULL); + + /* Set up the data transformations you want. Note that these are all + * optional. Only call them if you want/need them. Many of the + * transformations only work on specific types of images, and many + * are mutually exclusive. + */ + + /* Tell libpng to strip 16 bit/color files down to 8 bits/color */ + png_set_strip_16(png_ptr); + + /* Strip alpha bytes from the input data without combining with the + * background (not recommended). + */ + png_set_strip_alpha(png_ptr); + + /* Extract multiple pixels with bit depths of 1, 2, and 4 from a single + * byte into separate bytes (useful for paletted and grayscale images). + */ + png_set_packing(png_ptr); + + /* Change the order of packed pixels to least significant bit first + * (not useful if you are using png_set_packing). */ + png_set_packswap(png_ptr); + + /* Expand paletted colors into true RGB triplets */ + if (color_type == PNG_COLOR_TYPE_PALETTE) + png_set_palette_to_rgb(png_ptr); + + /* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */ + if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) + png_set_expand_gray_1_2_4_to_8(png_ptr); + + /* Expand paletted or RGB images with transparency to full alpha channels + * so the data will be available as RGBA quartets. + */ + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) + png_set_tRNS_to_alpha(png_ptr); + + /* Set the background color to draw transparent and alpha images over. + * It is possible to set the red, green, and blue components directly + * for paletted images instead of supplying a palette index. Note that + * even if the PNG file supplies a background, you are not required to + * use it - you should use the (solid) application background if it has one. + */ + + png_color_16 my_background, *image_background; + + if (png_get_bKGD(png_ptr, info_ptr, &image_background)) + png_set_background(png_ptr, image_background, + PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); + else + png_set_background(png_ptr, &my_background, + PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); + + /* Some suggestions as to how to get a screen gamma value + * + * Note that screen gamma is the display_exponent, which includes + * the CRT_exponent and any correction for viewing conditions + */ + if (/* We have a user-defined screen gamma value */) + { + screen_gamma = user-defined screen_gamma; + } + /* This is one way that applications share the same screen gamma value */ + else if ((gamma_str = getenv("SCREEN_GAMMA")) != NULL) + { + screen_gamma = atof(gamma_str); + } + /* If we don't have another value */ + else + { + screen_gamma = 2.2; /* A good guess for a PC monitor in a dimly + lit room */ + screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */ + } + + /* Tell libpng to handle the gamma conversion for you. The final call + * is a good guess for PC generated images, but it should be configurable + * by the user at run time by the user. It is strongly suggested that + * your application support gamma correction. + */ + + int intent; + + if (png_get_sRGB(png_ptr, info_ptr, &intent)) + png_set_gamma(png_ptr, screen_gamma, 0.45455); + else + { + double image_gamma; + if (png_get_gAMA(png_ptr, info_ptr, &image_gamma)) + png_set_gamma(png_ptr, screen_gamma, image_gamma); + else + png_set_gamma(png_ptr, screen_gamma, 0.45455); + } + +#ifdef PNG_READ_QUANTIZE_SUPPORTED + /* Quantize RGB files down to 8 bit palette or reduce palettes + * to the number of colors available on your screen. + */ + if (color_type & PNG_COLOR_MASK_COLOR) + { + int num_palette; + png_colorp palette; + + /* This reduces the image to the application supplied palette */ + if (/* We have our own palette */) + { + /* An array of colors to which the image should be quantized */ + png_color std_color_cube[MAX_SCREEN_COLORS]; + + /* Prior to libpng-1.4.2, this was png_set_dither(). */ + png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS, + MAX_SCREEN_COLORS, NULL, 0); + } + /* This reduces the image to the palette supplied in the file */ + else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) + { + png_uint_16p histogram = NULL; + + png_get_hIST(png_ptr, info_ptr, &histogram); + + png_set_quantize(png_ptr, palette, num_palette, + max_screen_colors, histogram, 0); + } + } +#endif /* PNG_READ_QUANTIZE_SUPPORTED */ + + /* Invert monochrome files to have 0 as white and 1 as black */ + png_set_invert_mono(png_ptr); + + /* If you want to shift the pixel values from the range [0,255] or + * [0,65535] to the original [0,7] or [0,31], or whatever range the + * colors were originally in: + */ + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT)) + { + png_color_8p sig_bit_p; + + png_get_sBIT(png_ptr, info_ptr, &sig_bit_p); + png_set_shift(png_ptr, sig_bit_p); + } + + /* Flip the RGB pixels to BGR (or RGBA to BGRA) */ + if (color_type & PNG_COLOR_MASK_COLOR) + png_set_bgr(png_ptr); + + /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ + png_set_swap_alpha(png_ptr); + + /* Swap bytes of 16 bit files to least significant byte first */ + png_set_swap(png_ptr); + + /* Add filler (or alpha) byte (before/after each RGB triplet) */ + png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER); + + /* Turn on interlace handling. REQUIRED if you are not using + * png_read_image(). To see how to handle interlacing passes, + * see the png_read_row() method below: + */ + number_passes = png_set_interlace_handling(png_ptr); + + /* Optional call to gamma correct and add the background to the palette + * and update info structure. REQUIRED if you are expecting libpng to + * update the palette for you (ie you selected such a transform above). + */ + png_read_update_info(png_ptr, info_ptr); + + /* Allocate the memory to hold the image using the fields of info_ptr. */ + + /* The easiest way to read the image: */ + png_bytep row_pointers[height]; + + /* Clear the pointer array */ + for (row = 0; row < height; row++) + row_pointers[row] = NULL; + + for (row = 0; row < height; row++) + row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr, + info_ptr)); + + /* Now it's time to read the image. One of these methods is REQUIRED */ +#ifdef entire /* Read the entire image in one go */ + png_read_image(png_ptr, row_pointers); + +#else no_entire /* Read the image one or more scanlines at a time */ + /* The other way to read images - deal with interlacing: */ + + for (pass = 0; pass < number_passes; pass++) + { +#ifdef single /* Read the image a single row at a time */ + for (y = 0; y < height; y++) + { + png_read_rows(png_ptr, &row_pointers[y], NULL, 1); + } + +#else no_single /* Read the image several rows at a time */ + for (y = 0; y < height; y += number_of_rows) + { +#ifdef sparkle /* Read the image using the "sparkle" effect. */ + png_read_rows(png_ptr, &row_pointers[y], NULL, + number_of_rows); +#else no_sparkle /* Read the image using the "rectangle" effect */ + png_read_rows(png_ptr, NULL, &row_pointers[y], + number_of_rows); +#endif no_sparkle /* Use only one of these two methods */ + } + + /* If you want to display the image after every pass, do so here */ +#endif no_single /* Use only one of these two methods */ + } +#endif no_entire /* Use only one of these two methods */ + + /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ + png_read_end(png_ptr, info_ptr); +#endif hilevel + + /* At this point you have read the entire image */ + + /* Clean up after the read, and free any memory allocated - REQUIRED */ + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + + /* Close the file */ + fclose(fp); + + /* That's it */ + return (OK); +} + +/* Progressively read a file */ + +int +initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr) +{ + /* Create and initialize the png_struct with the desired error handler + * functions. If you want to use the default stderr and longjump method, + * you can supply NULL for the last three parameters. We also check that + * the library version is compatible in case we are using dynamically + * linked libraries. + */ + *png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, + png_voidp user_error_ptr, user_error_fn, user_warning_fn); + + if (*png_ptr == NULL) + { + *info_ptr = NULL; + return (ERROR); + } + + *info_ptr = png_create_info_struct(png_ptr); + + if (*info_ptr == NULL) + { + png_destroy_read_struct(png_ptr, info_ptr, NULL); + return (ERROR); + } + + if (setjmp(png_jmpbuf((*png_ptr)))) + { + png_destroy_read_struct(png_ptr, info_ptr, NULL); + return (ERROR); + } + + /* This one's new. You will need to provide all three + * function callbacks, even if you aren't using them all. + * If you aren't using all functions, you can specify NULL + * parameters. Even when all three functions are NULL, + * you need to call png_set_progressive_read_fn(). + * These functions shouldn't be dependent on global or + * static variables if you are decoding several images + * simultaneously. You should store stream specific data + * in a separate struct, given as the second parameter, + * and retrieve the pointer from inside the callbacks using + * the function png_get_progressive_ptr(png_ptr). + */ + png_set_progressive_read_fn(*png_ptr, (void *)stream_data, + info_callback, row_callback, end_callback); + + return (OK); +} + +int +process_data(png_structp *png_ptr, png_infop *info_ptr, + png_bytep buffer, png_uint_32 length) +{ + if (setjmp(png_jmpbuf((*png_ptr)))) + { + /* Free the png_ptr and info_ptr memory on error */ + png_destroy_read_struct(png_ptr, info_ptr, NULL); + return (ERROR); + } + + /* This one's new also. Simply give it chunks of data as + * they arrive from the data stream (in order, of course). + * On segmented machines, don't give it any more than 64K. + * The library seems to run fine with sizes of 4K, although + * you can give it much less if necessary (I assume you can + * give it chunks of 1 byte, but I haven't tried with less + * than 256 bytes yet). When this function returns, you may + * want to display any rows that were generated in the row + * callback, if you aren't already displaying them there. + */ + png_process_data(*png_ptr, *info_ptr, buffer, length); + return (OK); +} + +info_callback(png_structp png_ptr, png_infop info) +{ + /* Do any setup here, including setting any of the transformations + * mentioned in the Reading PNG files section. For now, you _must_ + * call either png_start_read_image() or png_read_update_info() + * after all the transformations are set (even if you don't set + * any). You may start getting rows before png_process_data() + * returns, so this is your last chance to prepare for that. + */ +} + +row_callback(png_structp png_ptr, png_bytep new_row, + png_uint_32 row_num, int pass) +{ + /* + * This function is called for every row in the image. If the + * image is interlaced, and you turned on the interlace handler, + * this function will be called for every row in every pass. + * + * In this function you will receive a pointer to new row data from + * libpng called new_row that is to replace a corresponding row (of + * the same data format) in a buffer allocated by your application. + * + * The new row data pointer "new_row" may be NULL, indicating there is + * no new data to be replaced (in cases of interlace loading). + * + * If new_row is not NULL then you need to call + * png_progressive_combine_row() to replace the corresponding row as + * shown below: + */ + + /* Get pointer to corresponding row in our + * PNG read buffer. + */ + png_bytep old_row = ((png_bytep *)our_data)[row_num]; + + /* If both rows are allocated then copy the new row + * data to the corresponding row data. + */ + if ((old_row != NULL) && (new_row != NULL)) + png_progressive_combine_row(png_ptr, old_row, new_row); + + /* + * The rows and passes are called in order, so you don't really + * need the row_num and pass, but I'm supplying them because it + * may make your life easier. + * + * For the non-NULL rows of interlaced images, you must call + * png_progressive_combine_row() passing in the new row and the + * old row, as demonstrated above. You can call this function for + * NULL rows (it will just return) and for non-interlaced images + * (it just does the png_memcpy for you) if it will make the code + * easier. Thus, you can just do this for all cases: + */ + + png_progressive_combine_row(png_ptr, old_row, new_row); + + /* where old_row is what was displayed for previous rows. Note + * that the first pass (pass == 0 really) will completely cover + * the old row, so the rows do not have to be initialized. After + * the first pass (and only for interlaced images), you will have + * to pass the current row as new_row, and the function will combine + * the old row and the new row. + */ +} + +end_callback(png_structp png_ptr, png_infop info) +{ + /* This function is called when the whole image has been read, + * including any chunks after the image (up to and including + * the IEND). You will usually have the same info chunk as you + * had in the header, although some data may have been added + * to the comments and time fields. + * + * Most people won't do much here, perhaps setting a flag that + * marks the image as finished. + */ +} + +/* Write a png file */ +void write_png(char *file_name /* , ... other image information ... */) +{ + FILE *fp; + png_structp png_ptr; + png_infop info_ptr; + png_colorp palette; + + /* Open the file */ + fp = fopen(file_name, "wb"); + if (fp == NULL) + return (ERROR); + + /* Create and initialize the png_struct with the desired error handler + * functions. If you want to use the default stderr and longjump method, + * you can supply NULL for the last three parameters. We also check that + * the library version is compatible with the one used at compile time, + * in case we are using dynamically linked libraries. REQUIRED. + */ + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + png_voidp user_error_ptr, user_error_fn, user_warning_fn); + + if (png_ptr == NULL) + { + fclose(fp); + return (ERROR); + } + + /* Allocate/initialize the image information data. REQUIRED */ + info_ptr = png_create_info_struct(png_ptr); + if (info_ptr == NULL) + { + fclose(fp); + png_destroy_write_struct(&png_ptr, NULL); + return (ERROR); + } + + /* Set error handling. REQUIRED if you aren't supplying your own + * error handling functions in the png_create_write_struct() call. + */ + if (setjmp(png_jmpbuf(png_ptr))) + { + /* If we get here, we had a problem writing the file */ + fclose(fp); + png_destroy_write_struct(&png_ptr, &info_ptr); + return (ERROR); + } + + /* One of the following I/O initialization functions is REQUIRED */ + +#ifdef streams /* I/O initialization method 1 */ + /* Set up the output control if you are using standard C streams */ + png_init_io(png_ptr, fp); + +#else no_streams /* I/O initialization method 2 */ + /* If you are using replacement write functions, instead of calling + * png_init_io() here you would call + */ + png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn, + user_IO_flush_function); + /* where user_io_ptr is a structure you want available to the callbacks */ +#endif no_streams /* Only use one initialization method */ + +#ifdef hilevel + /* This is the easy way. Use it if you already have all the + * image info living in the structure. You could "|" many + * PNG_TRANSFORM flags into the png_transforms integer here. + */ + png_write_png(png_ptr, info_ptr, png_transforms, NULL); + +#else + /* This is the hard way */ + + /* Set the image information here. Width and height are up to 2^31, + * bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on + * the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY, + * PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB, + * or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or + * PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST + * currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED + */ + png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???, + PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + /* Set the palette if there is one. REQUIRED for indexed-color images */ + palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH + * png_sizeof(png_color)); + /* ... Set palette colors ... */ + png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH); + /* You must not free palette here, because png_set_PLTE only makes a link to + * the palette that you malloced. Wait until you are about to destroy + * the png structure. + */ + + /* Optional significant bit (sBIT) chunk */ + png_color_8 sig_bit; + /* If we are dealing with a grayscale image then */ + sig_bit.gray = true_bit_depth; + /* Otherwise, if we are dealing with a color image then */ + sig_bit.red = true_red_bit_depth; + sig_bit.green = true_green_bit_depth; + sig_bit.blue = true_blue_bit_depth; + /* If the image has an alpha channel then */ + sig_bit.alpha = true_alpha_bit_depth; + png_set_sBIT(png_ptr, info_ptr, &sig_bit); + + + /* Optional gamma chunk is strongly suggested if you have any guess + * as to the correct gamma of the image. + */ + png_set_gAMA(png_ptr, info_ptr, gamma); + + /* Optionally write comments into the image */ + text_ptr[0].key = "Title"; + text_ptr[0].text = "Mona Lisa"; + text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr[1].key = "Author"; + text_ptr[1].text = "Leonardo DaVinci"; + text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr[2].key = "Description"; + text_ptr[2].text = ""; + text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt; +#ifdef PNG_iTXt_SUPPORTED + text_ptr[0].lang = NULL; + text_ptr[0].lang_key = NULL; + text_ptr[1].lang = NULL; + text_ptr[1].lang_key = NULL; + text_ptr[2].lang = NULL; + text_ptr[2].lang_key = NULL; +#endif + png_set_text(png_ptr, info_ptr, text_ptr, 3); + + /* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */ + + /* Note that if sRGB is present the gAMA and cHRM chunks must be ignored + * on read and, if your application chooses to write them, they must + * be written in accordance with the sRGB profile + */ + + /* Write the file header information. REQUIRED */ + png_write_info(png_ptr, info_ptr); + + /* If you want, you can write the info in two steps, in case you need to + * write your private chunk ahead of PLTE: + * + * png_write_info_before_PLTE(write_ptr, write_info_ptr); + * write_my_chunk(); + * png_write_info(png_ptr, info_ptr); + * + * However, given the level of known- and unknown-chunk support in 1.2.0 + * and up, this should no longer be necessary. + */ + + /* Once we write out the header, the compression type on the text + * chunks gets changed to PNG_TEXT_COMPRESSION_NONE_WR or + * PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again + * at the end. + */ + + /* Set up the transformations you want. Note that these are + * all optional. Only call them if you want them. + */ + + /* Invert monochrome pixels */ + png_set_invert_mono(png_ptr); + + /* Shift the pixels up to a legal bit depth and fill in + * as appropriate to correctly scale the image. + */ + png_set_shift(png_ptr, &sig_bit); + + /* Pack pixels into bytes */ + png_set_packing(png_ptr); + + /* Swap location of alpha bytes from ARGB to RGBA */ + png_set_swap_alpha(png_ptr); + + /* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into + * RGB (4 channels -> 3 channels). The second parameter is not used. + */ + png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); + + /* Flip BGR pixels to RGB */ + png_set_bgr(png_ptr); + + /* Swap bytes of 16-bit files to most significant byte first */ + png_set_swap(png_ptr); + + /* Swap bits of 1, 2, 4 bit packed pixel formats */ + png_set_packswap(png_ptr); + + /* Turn on interlace handling if you are not using png_write_image() */ + if (interlacing) + number_passes = png_set_interlace_handling(png_ptr); + else + number_passes = 1; + + /* The easiest way to write the image (you may have a different memory + * layout, however, so choose what fits your needs best). You need to + * use the first method if you aren't handling interlacing yourself. + */ + png_uint_32 k, height, width; + png_byte image[height][width*bytes_per_pixel]; + png_bytep row_pointers[height]; + + if (height > PNG_UINT_32_MAX/png_sizeof(png_bytep)) + png_error (png_ptr, "Image is too tall to process in memory"); + + for (k = 0; k < height; k++) + row_pointers[k] = image + k*width*bytes_per_pixel; + + /* One of the following output methods is REQUIRED */ + +#ifdef entire /* Write out the entire image data in one call */ + png_write_image(png_ptr, row_pointers); + + /* The other way to write the image - deal with interlacing */ + +#else no_entire /* Write out the image data by one or more scanlines */ + + /* The number of passes is either 1 for non-interlaced images, + * or 7 for interlaced images. + */ + for (pass = 0; pass < number_passes; pass++) + { + /* Write a few rows at a time. */ + png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows); + + /* If you are only writing one row at a time, this works */ + for (y = 0; y < height; y++) + png_write_rows(png_ptr, &row_pointers[y], 1); + } +#endif no_entire /* Use only one output method */ + + /* You can write optional chunks like tEXt, zTXt, and tIME at the end + * as well. Shouldn't be necessary in 1.2.0 and up as all the public + * chunks are supported and you can use png_set_unknown_chunks() to + * register unknown chunks into the info structure to be written out. + */ + + /* It is REQUIRED to call this to finish writing the rest of the file */ + png_write_end(png_ptr, info_ptr); +#endif hilevel + + /* If you png_malloced a palette, free it here (don't free info_ptr->palette, + * as recommended in versions 1.0.5m and earlier of this example; if + * libpng mallocs info_ptr->palette, libpng will free it). If you + * allocated it with malloc() instead of png_malloc(), use free() instead + * of png_free(). + */ + png_free(png_ptr, palette); + palette = NULL; + + /* Similarly, if you png_malloced any data that you passed in with + * png_set_something(), such as a hist or trans array, free it here, + * when you can be sure that libpng is through with it. + */ + png_free(png_ptr, trans); + trans = NULL; + /* Whenever you use png_free() it is a good idea to set the pointer to + * NULL in case your application inadvertently tries to png_free() it + * again. When png_free() sees a NULL it returns without action, thus + * avoiding the double-free security problem. + */ + + /* Clean up after the write, and free any memory allocated */ + png_destroy_write_struct(&png_ptr, &info_ptr); + + /* Close the file */ + fclose(fp); + + /* That's it */ + return (OK); +} + +#endif /* if 0 */ diff --git a/png/libpng-1.4.3.txt b/png/libpng-1.4.3.txt new file mode 100644 index 0000000..5451f2f --- /dev/null +++ b/png/libpng-1.4.3.txt @@ -0,0 +1,3352 @@ +libpng.txt - A description on how to use and modify libpng + + libpng version 1.4.3 - June 26, 2010 + Updated and distributed by Glenn Randers-Pehrson + + Copyright (c) 1998-2009 Glenn Randers-Pehrson + + This document is released under the libpng license. + For conditions of distribution and use, see the disclaimer + and license in png.h + + Based on: + + libpng versions 0.97, January 1998, through 1.4.3 - June 26, 2010 + Updated and distributed by Glenn Randers-Pehrson + Copyright (c) 1998-2009 Glenn Randers-Pehrson + + libpng 1.0 beta 6 version 0.96 May 28, 1997 + Updated and distributed by Andreas Dilger + Copyright (c) 1996, 1997 Andreas Dilger + + libpng 1.0 beta 2 - version 0.88 January 26, 1996 + For conditions of distribution and use, see copyright + notice in png.h. Copyright (c) 1995, 1996 Guy Eric + Schalnat, Group 42, Inc. + + Updated/rewritten per request in the libpng FAQ + Copyright (c) 1995, 1996 Frank J. T. Wojcik + December 18, 1995 & January 20, 1996 + +I. Introduction + +This file describes how to use and modify the PNG reference library +(known as libpng) for your own use. There are five sections to this +file: introduction, structures, reading, writing, and modification and +configuration notes for various special platforms. In addition to this +file, example.c is a good starting point for using the library, as +it is heavily commented and should include everything most people +will need. We assume that libpng is already installed; see the +INSTALL file for instructions on how to install libpng. + +For examples of libpng usage, see the files "example.c", "pngtest.c", +and the files in the "contrib" directory, all of which are included in +the libpng distribution. + +Libpng was written as a companion to the PNG specification, as a way +of reducing the amount of time and effort it takes to support the PNG +file format in application programs. + +The PNG specification (second edition), November 2003, is available as +a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at +. It is technically equivalent +to the PNG specification (second edition) but has some additional material. + +The PNG-1.0 specification is available +as RFC 2083 and as a +W3C Recommendation . + +Some additional chunks are described in the special-purpose public chunks +documents at . + +Other information +about PNG, and the latest version of libpng, can be found at the PNG home +page, . + +Most users will not have to modify the library significantly; advanced +users may want to modify it more. All attempts were made to make it as +complete as possible, while keeping the code easy to understand. +Currently, this library only supports C. Support for other languages +is being considered. + +Libpng has been designed to handle multiple sessions at one time, +to be easily modifiable, to be portable to the vast majority of +machines (ANSI, K&R, 16-, 32-, and 64-bit) available, and to be easy +to use. The ultimate goal of libpng is to promote the acceptance of +the PNG file format in whatever way possible. While there is still +work to be done (see the TODO file), libpng should cover the +majority of the needs of its users. + +Libpng uses zlib for its compression and decompression of PNG files. +Further information about zlib, and the latest version of zlib, can +be found at the zlib home page, . +The zlib compression utility is a general purpose utility that is +useful for more than PNG files, and can be used without libpng. +See the documentation delivered with zlib for more details. +You can usually find the source files for the zlib utility wherever you +find the libpng source files. + +Libpng is thread safe, provided the threads are using different +instances of the structures. Each thread should have its own +png_struct and png_info instances, and thus its own image. +Libpng does not protect itself against two threads using the +same instance of a structure. + +II. Structures + +There are two main structures that are important to libpng, png_struct +and png_info. The first, png_struct, is an internal structure that +will not, for the most part, be used by a user except as the first +variable passed to every libpng function call. + +The png_info structure is designed to provide information about the +PNG file. At one time, the fields of png_info were intended to be +directly accessible to the user. However, this tended to cause problems +with applications using dynamically loaded libraries, and as a result +a set of interface functions for png_info (the png_get_*() and png_set_*() +functions) was developed. The fields of png_info are still available for +older applications, but it is suggested that applications use the new +interfaces if at all possible. + +Applications that do make direct access to the members of png_struct (except +for png_ptr->jmpbuf) must be recompiled whenever the library is updated, +and applications that make direct access to the members of png_info must +be recompiled if they were compiled or loaded with libpng version 1.0.6, +in which the members were in a different order. In version 1.0.7, the +members of the png_info structure reverted to the old order, as they were +in versions 0.97c through 1.0.5. Starting with version 2.0.0, both +structures are going to be hidden, and the contents of the structures will +only be accessible through the png_get/png_set functions. + +The png.h header file is an invaluable reference for programming with libpng. +And while I'm on the topic, make sure you include the libpng header file: + +#include + +III. Reading + +We'll now walk you through the possible functions to call when reading +in a PNG file sequentially, briefly explaining the syntax and purpose +of each one. See example.c and png.h for more detail. While +progressive reading is covered in the next section, you will still +need some of the functions discussed in this section to read a PNG +file. + +Setup + +You will want to do the I/O initialization(*) before you get into libpng, +so if it doesn't work, you don't have much to undo. Of course, you +will also want to insure that you are, in fact, dealing with a PNG +file. Libpng provides a simple check to see if a file is a PNG file. +To use it, pass in the first 1 to 8 bytes of the file to the function +png_sig_cmp(), and it will return 0 (false) if the bytes match the +corresponding bytes of the PNG signature, or nonzero (true) otherwise. +Of course, the more bytes you pass in, the greater the accuracy of the +prediction. + +If you are intending to keep the file pointer open for use in libpng, +you must ensure you don't read more than 8 bytes from the beginning +of the file, and you also have to make a call to png_set_sig_bytes_read() +with the number of bytes you read from the beginning. Libpng will +then only check the bytes (if any) that your program didn't read. + +(*): If you are not using the standard I/O functions, you will need +to replace them with custom functions. See the discussion under +Customizing libpng. + + + FILE *fp = fopen(file_name, "rb"); + if (!fp) + { + return (ERROR); + } + fread(header, 1, number, fp); + is_png = !png_sig_cmp(header, 0, number); + if (!is_png) + { + return (NOT_PNG); + } + + +Next, png_struct and png_info need to be allocated and initialized. In +order to ensure that the size of these structures is correct even with a +dynamically linked libpng, there are functions to initialize and +allocate the structures. We also pass the library version, optional +pointers to error handling functions, and a pointer to a data struct for +use by the error functions, if necessary (the pointer and functions can +be NULL if the default error handlers are to be used). See the section +on Changes to Libpng below regarding the old initialization functions. +The structure allocation functions quietly return NULL if they fail to +create the structure, so your application should check for that. + + png_structp png_ptr = png_create_read_struct + (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, + user_error_fn, user_warning_fn); + if (!png_ptr) + return (ERROR); + + png_infop info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + { + png_destroy_read_struct(&png_ptr, + (png_infopp)NULL, (png_infopp)NULL); + return (ERROR); + } + + png_infop end_info = png_create_info_struct(png_ptr); + if (!end_info) + { + png_destroy_read_struct(&png_ptr, &info_ptr, + (png_infopp)NULL); + return (ERROR); + } + +If you want to use your own memory allocation routines, +define PNG_USER_MEM_SUPPORTED and use +png_create_read_struct_2() instead of png_create_read_struct(): + + png_structp png_ptr = png_create_read_struct_2 + (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, + user_error_fn, user_warning_fn, (png_voidp) + user_mem_ptr, user_malloc_fn, user_free_fn); + +The error handling routines passed to png_create_read_struct() +and the memory alloc/free routines passed to png_create_struct_2() +are only necessary if you are not using the libpng supplied error +handling and memory alloc/free functions. + +When libpng encounters an error, it expects to longjmp back +to your routine. Therefore, you will need to call setjmp and pass +your png_jmpbuf(png_ptr). If you read the file from different +routines, you will need to update the jmpbuf field every time you enter +a new routine that will call a png_*() function. + +See your documentation of setjmp/longjmp for your compiler for more +information on setjmp/longjmp. See the discussion on libpng error +handling in the Customizing Libpng section below for more information +on the libpng error handling. If an error occurs, and libpng longjmp's +back to your setjmp, you will want to call png_destroy_read_struct() to +free any memory. + + if (setjmp(png_jmpbuf(png_ptr))) + { + png_destroy_read_struct(&png_ptr, &info_ptr, + &end_info); + fclose(fp); + return (ERROR); + } + +If you would rather avoid the complexity of setjmp/longjmp issues, +you can compile libpng with PNG_NO_SETJMP, in which case +errors will result in a call to PNG_ABORT() which defaults to abort(). + +You can #define PNG_ABORT() to a function that does something +more useful than abort(), as long as your function does not +return. + +Now you need to set up the input code. The default for libpng is to +use the C function fread(). If you use this, you will need to pass a +valid FILE * in the function png_init_io(). Be sure that the file is +opened in binary mode. If you wish to handle reading data in another +way, you need not call the png_init_io() function, but you must then +implement the libpng I/O methods discussed in the Customizing Libpng +section below. + + png_init_io(png_ptr, fp); + +If you had previously opened the file and read any of the signature from +the beginning in order to see if this was a PNG file, you need to let +libpng know that there are some bytes missing from the start of the file. + + png_set_sig_bytes(png_ptr, number); + +You can change the zlib compression buffer size to be used while +reading compressed data with + + png_set_compression_buffer_size(png_ptr, buffer_size); + +where the default size is 8192 bytes. Note that the buffer size +is changed immediately and the buffer is reallocated immediately, +instead of setting a flag to be acted upon later. + +Setting up callback code + +You can set up a callback function to handle any unknown chunks in the +input stream. You must supply the function + + read_chunk_callback(png_ptr ptr, + png_unknown_chunkp chunk); + { + /* The unknown chunk structure contains your + chunk data, along with similar data for any other + unknown chunks: */ + + png_byte name[5]; + png_byte *data; + png_size_t size; + + /* Note that libpng has already taken care of + the CRC handling */ + + /* put your code here. Search for your chunk in the + unknown chunk structure, process it, and return one + of the following: */ + + return (-n); /* chunk had an error */ + return (0); /* did not recognize */ + return (n); /* success */ + } + +(You can give your function another name that you like instead of +"read_chunk_callback") + +To inform libpng about your function, use + + png_set_read_user_chunk_fn(png_ptr, user_chunk_ptr, + read_chunk_callback); + +This names not only the callback function, but also a user pointer that +you can retrieve with + + png_get_user_chunk_ptr(png_ptr); + +If you call the png_set_read_user_chunk_fn() function, then all unknown +chunks will be saved when read, in case your callback function will need +one or more of them. This behavior can be changed with the +png_set_keep_unknown_chunks() function, described below. + +At this point, you can set up a callback function that will be +called after each row has been read, which you can use to control +a progress meter or the like. It's demonstrated in pngtest.c. +You must supply a function + + void read_row_callback(png_ptr ptr, png_uint_32 row, + int pass); + { + /* put your code here */ + } + +(You can give it another name that you like instead of "read_row_callback") + +To inform libpng about your function, use + + png_set_read_status_fn(png_ptr, read_row_callback); + +Unknown-chunk handling + +Now you get to set the way the library processes unknown chunks in the +input PNG stream. Both known and unknown chunks will be read. Normal +behavior is that known chunks will be parsed into information in +various info_ptr members while unknown chunks will be discarded. This +behavior can be wasteful if your application will never use some known +chunk types. To change this, you can call: + + png_set_keep_unknown_chunks(png_ptr, keep, + chunk_list, num_chunks); + keep - 0: default unknown chunk handling + 1: ignore; do not keep + 2: keep only if safe-to-copy + 3: keep even if unsafe-to-copy + You can use these definitions: + PNG_HANDLE_CHUNK_AS_DEFAULT 0 + PNG_HANDLE_CHUNK_NEVER 1 + PNG_HANDLE_CHUNK_IF_SAFE 2 + PNG_HANDLE_CHUNK_ALWAYS 3 + chunk_list - list of chunks affected (a byte string, + five bytes per chunk, NULL or '\0' if + num_chunks is 0) + num_chunks - number of chunks affected; if 0, all + unknown chunks are affected. If nonzero, + only the chunks in the list are affected + +Unknown chunks declared in this way will be saved as raw data onto a +list of png_unknown_chunk structures. If a chunk that is normally +known to libpng is named in the list, it will be handled as unknown, +according to the "keep" directive. If a chunk is named in successive +instances of png_set_keep_unknown_chunks(), the final instance will +take precedence. The IHDR and IEND chunks should not be named in +chunk_list; if they are, libpng will process them normally anyway. + +Here is an example of the usage of png_set_keep_unknown_chunks(), +where the private "vpAg" chunk will later be processed by a user chunk +callback function: + + png_byte vpAg[5]={118, 112, 65, 103, (png_byte) '\0'}; + + #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) + png_byte unused_chunks[]= + { + 104, 73, 83, 84, (png_byte) '\0', /* hIST */ + 105, 84, 88, 116, (png_byte) '\0', /* iTXt */ + 112, 67, 65, 76, (png_byte) '\0', /* pCAL */ + 115, 67, 65, 76, (png_byte) '\0', /* sCAL */ + 115, 80, 76, 84, (png_byte) '\0', /* sPLT */ + 116, 73, 77, 69, (png_byte) '\0', /* tIME */ + }; + #endif + + ... + + #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) + /* ignore all unknown chunks: */ + png_set_keep_unknown_chunks(read_ptr, 1, NULL, 0); + /* except for vpAg: */ + png_set_keep_unknown_chunks(read_ptr, 2, vpAg, 1); + /* also ignore unused known chunks: */ + png_set_keep_unknown_chunks(read_ptr, 1, unused_chunks, + (int)sizeof(unused_chunks)/5); + #endif + +User limits + +The PNG specification allows the width and height of an image to be as +large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns. +Since very few applications really need to process such large images, +we have imposed an arbitrary 1-million limit on rows and columns. +Larger images will be rejected immediately with a png_error() call. If +you wish to override this limit, you can use + + png_set_user_limits(png_ptr, width_max, height_max); + +to set your own limits, or use width_max = height_max = 0x7fffffffL +to allow all valid dimensions (libpng may reject some very large images +anyway because of potential buffer overflow conditions). + +You should put this statement after you create the PNG structure and +before calling png_read_info(), png_read_png(), or png_process_data(). +If you need to retrieve the limits that are being applied, use + + width_max = png_get_user_width_max(png_ptr); + height_max = png_get_user_height_max(png_ptr); + +The PNG specification sets no limit on the number of ancillary chunks +allowed in a PNG datastream. You can impose a limit on the total number +of sPLT, tEXt, iTXt, zTXt, and unknown chunks that will be stored, with + + png_set_chunk_cache_max(png_ptr, user_chunk_cache_max); + +where 0x7fffffffL means unlimited. You can retrieve this limit with + + chunk_cache_max = png_get_chunk_cache_max(png_ptr); + +This limit also applies to the number of buffers that can be allocated +by png_decompress_chunk() while decompressing iTXt, zTXt, and iCCP chunks. + +You can also set a limit on the amount of memory that a compressed chunk +other than IDAT can occupy, with + + png_set_chunk_malloc_max(png_ptr, user_chunk_malloc_max); + +and you can retrieve the limit with + + chunk_malloc_max = png_get_chunk_malloc_max(png_ptr); + +Any chunks that would cause either of these limits to be exceeded will +be ignored. + +The high-level read interface + +At this point there are two ways to proceed; through the high-level +read interface, or through a sequence of low-level read operations. +You can use the high-level interface if (a) you are willing to read +the entire image into memory, and (b) the input transformations +you want to do are limited to the following set: + + PNG_TRANSFORM_IDENTITY No transformation + PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to + 8 bits + PNG_TRANSFORM_STRIP_ALPHA Discard the alpha channel + PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit + samples to bytes + PNG_TRANSFORM_PACKSWAP Change order of packed + pixels to LSB first + PNG_TRANSFORM_EXPAND Perform set_expand() + PNG_TRANSFORM_INVERT_MONO Invert monochrome images + PNG_TRANSFORM_SHIFT Normalize pixels to the + sBIT depth + PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA + to BGRA + PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA + to AG + PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity + to transparency + PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples + PNG_TRANSFORM_GRAY_TO_RGB Expand grayscale samples + to RGB (or GA to RGBA) + +(This excludes setting a background color, doing gamma transformation, +quantizing, and setting filler.) If this is the case, simply do this: + + png_read_png(png_ptr, info_ptr, png_transforms, NULL) + +where png_transforms is an integer containing the bitwise OR of some +set of transformation flags. This call is equivalent to png_read_info(), +followed the set of transformations indicated by the transform mask, +then png_read_image(), and finally png_read_end(). + +(The final parameter of this call is not yet used. Someday it might point +to transformation parameters required by some future input transform.) + +You must use png_transforms and not call any png_set_transform() functions +when you use png_read_png(). + +After you have called png_read_png(), you can retrieve the image data +with + + row_pointers = png_get_rows(png_ptr, info_ptr); + +where row_pointers is an array of pointers to the pixel data for each row: + + png_bytep row_pointers[height]; + +If you know your image size and pixel size ahead of time, you can allocate +row_pointers prior to calling png_read_png() with + + if (height > PNG_UINT_32_MAX/png_sizeof(png_byte)) + png_error (png_ptr, + "Image is too tall to process in memory"); + if (width > PNG_UINT_32_MAX/pixel_size) + png_error (png_ptr, + "Image is too wide to process in memory"); + row_pointers = png_malloc(png_ptr, + height*png_sizeof(png_bytep)); + for (int i=0; i) and +png_get_(png_ptr, info_ptr, ...) functions return non-zero if the +data has been read, or zero if it is missing. The parameters to the +png_get_ are set directly if they are simple data types, or a +pointer into the info_ptr is returned for any complex types. + + png_get_PLTE(png_ptr, info_ptr, &palette, + &num_palette); + palette - the palette for the file + (array of png_color) + num_palette - number of entries in the palette + + png_get_gAMA(png_ptr, info_ptr, &gamma); + gamma - the gamma the file is written + at (PNG_INFO_gAMA) + + png_get_sRGB(png_ptr, info_ptr, &srgb_intent); + srgb_intent - the rendering intent (PNG_INFO_sRGB) + The presence of the sRGB chunk + means that the pixel data is in the + sRGB color space. This chunk also + implies specific values of gAMA and + cHRM. + + png_get_iCCP(png_ptr, info_ptr, &name, + &compression_type, &profile, &proflen); + name - The profile name. + compression - The compression type; always + PNG_COMPRESSION_TYPE_BASE for PNG 1.0. + You may give NULL to this argument to + ignore it. + profile - International Color Consortium color + profile data. May contain NULs. + proflen - length of profile data in bytes. + + png_get_sBIT(png_ptr, info_ptr, &sig_bit); + sig_bit - the number of significant bits for + (PNG_INFO_sBIT) each of the gray, + red, green, and blue channels, + whichever are appropriate for the + given color type (png_color_16) + + png_get_tRNS(png_ptr, info_ptr, &trans_alpha, + &num_trans, &trans_color); + trans_alpha - array of alpha (transparency) + entries for palette (PNG_INFO_tRNS) + trans_color - graylevel or color sample values of + the single transparent color for + non-paletted images (PNG_INFO_tRNS) + num_trans - number of transparent entries + (PNG_INFO_tRNS) + + png_get_hIST(png_ptr, info_ptr, &hist); + (PNG_INFO_hIST) + hist - histogram of palette (array of + png_uint_16) + + png_get_tIME(png_ptr, info_ptr, &mod_time); + mod_time - time image was last modified + (PNG_VALID_tIME) + + png_get_bKGD(png_ptr, info_ptr, &background); + background - background color (PNG_VALID_bKGD) + valid 16-bit red, green and blue + values, regardless of color_type + + num_comments = png_get_text(png_ptr, info_ptr, + &text_ptr, &num_text); + num_comments - number of comments + text_ptr - array of png_text holding image + comments + text_ptr[i].compression - type of compression used + on "text" PNG_TEXT_COMPRESSION_NONE + PNG_TEXT_COMPRESSION_zTXt + PNG_ITXT_COMPRESSION_NONE + PNG_ITXT_COMPRESSION_zTXt + text_ptr[i].key - keyword for comment. Must contain + 1-79 characters. + text_ptr[i].text - text comments for current + keyword. Can be empty. + text_ptr[i].text_length - length of text string, + after decompression, 0 for iTXt + text_ptr[i].itxt_length - length of itxt string, + after decompression, 0 for tEXt/zTXt + text_ptr[i].lang - language of comment (empty + string for unknown). + text_ptr[i].lang_key - keyword in UTF-8 + (empty string for unknown). + Note that the itxt_length, lang, and lang_key + members of the text_ptr structure only exist + when the library is built with iTXt chunk support. + + num_text - number of comments (same as + num_comments; you can put NULL here + to avoid the duplication) + Note while png_set_text() will accept text, language, + and translated keywords that can be NULL pointers, the + structure returned by png_get_text will always contain + regular zero-terminated C strings. They might be + empty strings but they will never be NULL pointers. + + num_spalettes = png_get_sPLT(png_ptr, info_ptr, + &palette_ptr); + palette_ptr - array of palette structures holding + contents of one or more sPLT chunks + read. + num_spalettes - number of sPLT chunks read. + + png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, + &unit_type); + offset_x - positive offset from the left edge + of the screen + offset_y - positive offset from the top edge + of the screen + unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER + + png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y, + &unit_type); + res_x - pixels/unit physical resolution in + x direction + res_y - pixels/unit physical resolution in + x direction + unit_type - PNG_RESOLUTION_UNKNOWN, + PNG_RESOLUTION_METER + + png_get_sCAL(png_ptr, info_ptr, &unit, &width, + &height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are doubles) + + png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, + &height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are strings like "2.54") + + num_unknown_chunks = png_get_unknown_chunks(png_ptr, + info_ptr, &unknowns) + unknowns - array of png_unknown_chunk + structures holding unknown chunks + unknowns[i].name - name of unknown chunk + unknowns[i].data - data of unknown chunk + unknowns[i].size - size of unknown chunk's data + unknowns[i].location - position of chunk in file + + The value of "i" corresponds to the order in which the + chunks were read from the PNG file or inserted with the + png_set_unknown_chunks() function. + +The data from the pHYs chunk can be retrieved in several convenient +forms: + + res_x = png_get_x_pixels_per_meter(png_ptr, + info_ptr) + res_y = png_get_y_pixels_per_meter(png_ptr, + info_ptr) + res_x_and_y = png_get_pixels_per_meter(png_ptr, + info_ptr) + res_x = png_get_x_pixels_per_inch(png_ptr, + info_ptr) + res_y = png_get_y_pixels_per_inch(png_ptr, + info_ptr) + res_x_and_y = png_get_pixels_per_inch(png_ptr, + info_ptr) + aspect_ratio = png_get_pixel_aspect_ratio(png_ptr, + info_ptr) + + (Each of these returns 0 [signifying "unknown"] if + the data is not present or if res_x is 0; + res_x_and_y is 0 if res_x != res_y) + +The data from the oFFs chunk can be retrieved in several convenient +forms: + + x_offset = png_get_x_offset_microns(png_ptr, info_ptr); + y_offset = png_get_y_offset_microns(png_ptr, info_ptr); + x_offset = png_get_x_offset_inches(png_ptr, info_ptr); + y_offset = png_get_y_offset_inches(png_ptr, info_ptr); + + (Each of these returns 0 [signifying "unknown" if both + x and y are 0] if the data is not present or if the + chunk is present but the unit is the pixel) + +For more information, see the png_info definition in png.h and the +PNG specification for chunk contents. Be careful with trusting +rowbytes, as some of the transformations could increase the space +needed to hold a row (expand, filler, gray_to_rgb, etc.). +See png_read_update_info(), below. + +A quick word about text_ptr and num_text. PNG stores comments in +keyword/text pairs, one pair per chunk, with no limit on the number +of text chunks, and a 2^31 byte limit on their size. While there are +suggested keywords, there is no requirement to restrict the use to these +strings. It is strongly suggested that keywords and text be sensible +to humans (that's the point), so don't use abbreviations. Non-printing +symbols are not allowed. See the PNG specification for more details. +There is also no requirement to have text after the keyword. + +Keywords should be limited to 79 Latin-1 characters without leading or +trailing spaces, but non-consecutive spaces are allowed within the +keyword. It is possible to have the same keyword any number of times. +The text_ptr is an array of png_text structures, each holding a +pointer to a language string, a pointer to a keyword and a pointer to +a text string. The text string, language code, and translated +keyword may be empty or NULL pointers. The keyword/text +pairs are put into the array in the order that they are received. +However, some or all of the text chunks may be after the image, so, to +make sure you have read all the text chunks, don't mess with these +until after you read the stuff after the image. This will be +mentioned again below in the discussion that goes with png_read_end(). + +Input transformations + +After you've read the header information, you can set up the library +to handle any special transformations of the image data. The various +ways to transform the data will be described in the order that they +should occur. This is important, as some of these change the color +type and/or bit depth of the data, and some others only work on +certain color types and bit depths. Even though each transformation +checks to see if it has data that it can do something with, you should +make sure to only enable a transformation if it will be valid for the +data. For example, don't swap red and blue on grayscale data. + +The colors used for the background and transparency values should be +supplied in the same format/depth as the current image data. They +are stored in the same format/depth as the image data in a bKGD or tRNS +chunk, so this is what libpng expects for this data. The colors are +transformed to keep in sync with the image data when an application +calls the png_read_update_info() routine (see below). + +Data will be decoded into the supplied row buffers packed into bytes +unless the library has been told to transform it into another format. +For example, 4 bit/pixel paletted or grayscale data will be returned +2 pixels/byte with the leftmost pixel in the high-order bits of the +byte, unless png_set_packing() is called. 8-bit RGB data will be stored +in RGB RGB RGB format unless png_set_filler() or png_set_add_alpha() +is called to insert filler bytes, either before or after each RGB triplet. +16-bit RGB data will be returned RRGGBB RRGGBB, with the most significant +byte of the color value first, unless png_set_strip_16() is called to +transform it to regular RGB RGB triplets, or png_set_filler() or +png_set_add alpha() is called to insert filler bytes, either before or +after each RRGGBB triplet. Similarly, 8-bit or 16-bit grayscale data can +be modified with +png_set_filler(), png_set_add_alpha(), or png_set_strip_16(). + +The following code transforms grayscale images of less than 8 to 8 bits, +changes paletted images to RGB, and adds a full alpha channel if there is +transparency information in a tRNS chunk. This is most useful on +grayscale images with bit depths of 2 or 4 or if there is a multiple-image +viewing application that wishes to treat all images in the same way. + + if (color_type == PNG_COLOR_TYPE_PALETTE) + png_set_palette_to_rgb(png_ptr); + + if (color_type == PNG_COLOR_TYPE_GRAY && + bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr); + + if (png_get_valid(png_ptr, info_ptr, + PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); + +These three functions are actually aliases for png_set_expand(), added +in libpng version 1.0.4, with the function names expanded to improve code +readability. In some future version they may actually do different +things. + +As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was +added. It expands the sample depth without changing tRNS to alpha. + +As of libpng version 1.4.3, not all possible expansions are supported. + +In the following table, the 01 means grayscale with depth<8, 31 means +indexed with depth<8, other numerals represent the color type, "T" means +the tRNS chunk is present, A means an alpha channel is present, and O +means tRNS or alpha is present but all pixels in the image are opaque. + + FROM 01 31 0 0T 0O 2 2T 2O 3 3T 3O 4A 4O 6A 6O + TO + 01 - + 31 - + 0 1 - + 0T - + 0O - + 2 GX - + 2T - + 2O - + 3 1 - + 3T - + 3O - + 4A T - + 4O - + 6A GX TX TX - + 6O GX TX - + +Within the matrix, + "-" means the transformation is not supported. + "X" means the transformation is obtained by png_set_expand(). + "1" means the transformation is obtained by + png_set_expand_gray_1_2_4_to_8 + "G" means the transformation is obtained by + png_set_gray_to_rgb(). + "P" means the transformation is obtained by + png_set_expand_palette_to_rgb(). + "T" means the transformation is obtained by + png_set_tRNS_to_alpha(). + +PNG can have files with 16 bits per channel. If you only can handle +8 bits per channel, this will strip the pixels down to 8 bit. + + if (bit_depth == 16) + png_set_strip_16(png_ptr); + +If, for some reason, you don't need the alpha channel on an image, +and you want to remove it rather than combining it with the background +(but the image author certainly had in mind that you *would* combine +it with the background, so that's what you should probably do): + + if (color_type & PNG_COLOR_MASK_ALPHA) + png_set_strip_alpha(png_ptr); + +In PNG files, the alpha channel in an image +is the level of opacity. If you need the alpha channel in an image to +be the level of transparency instead of opacity, you can invert the +alpha channel (or the tRNS chunk data) after it's read, so that 0 is +fully opaque and 255 (in 8-bit or paletted images) or 65535 (in 16-bit +images) is fully transparent, with + + png_set_invert_alpha(png_ptr); + +PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as +they can, resulting in, for example, 8 pixels per byte for 1 bit +files. This code expands to 1 pixel per byte without changing the +values of the pixels: + + if (bit_depth < 8) + png_set_packing(png_ptr); + +PNG files have possible bit depths of 1, 2, 4, 8, and 16. All pixels +stored in a PNG image have been "scaled" or "shifted" up to the next +higher possible bit depth (e.g. from 5 bits/sample in the range [0,31] +to 8 bits/sample in the range [0, 255]). However, it is also possible +to convert the PNG pixel data back to the original bit depth of the +image. This call reduces the pixels back down to the original bit depth: + + png_color_8p sig_bit; + + if (png_get_sBIT(png_ptr, info_ptr, &sig_bit)) + png_set_shift(png_ptr, sig_bit); + +PNG files store 3-color pixels in red, green, blue order. This code +changes the storage of the pixels to blue, green, red: + + if (color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) + png_set_bgr(png_ptr); + +PNG files store RGB pixels packed into 3 or 6 bytes. This code expands them +into 4 or 8 bytes for windowing systems that need them in this format: + + if (color_type == PNG_COLOR_TYPE_RGB) + png_set_filler(png_ptr, filler, PNG_FILLER_BEFORE); + +where "filler" is the 8 or 16-bit number to fill with, and the location is +either PNG_FILLER_BEFORE or PNG_FILLER_AFTER, depending upon whether +you want the filler before the RGB or after. This transformation +does not affect images that already have full alpha channels. To add an +opaque alpha channel, use filler=0xff or 0xffff and PNG_FILLER_AFTER which +will generate RGBA pixels. + +Note that png_set_filler() does not change the color type. If you want +to do that, you can add a true alpha channel with + + if (color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_GRAY) + png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER); + +where "filler" contains the alpha value to assign to each pixel. +This function was added in libpng-1.2.7. + +If you are reading an image with an alpha channel, and you need the +data as ARGB instead of the normal PNG format RGBA: + + if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) + png_set_swap_alpha(png_ptr); + +For some uses, you may want a grayscale image to be represented as +RGB. This code will do that conversion: + + if (color_type == PNG_COLOR_TYPE_GRAY || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + png_set_gray_to_rgb(png_ptr); + +Conversely, you can convert an RGB or RGBA image to grayscale or grayscale +with alpha. + + if (color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) + png_set_rgb_to_gray_fixed(png_ptr, error_action, + int red_weight, int green_weight); + + error_action = 1: silently do the conversion + error_action = 2: issue a warning if the original + image has any pixel where + red != green or red != blue + error_action = 3: issue an error and abort the + conversion if the original + image has any pixel where + red != green or red != blue + + red_weight: weight of red component times 100000 + green_weight: weight of green component times 100000 + If either weight is negative, default + weights (21268, 71514) are used. + +If you have set error_action = 1 or 2, you can +later check whether the image really was gray, after processing +the image rows, with the png_get_rgb_to_gray_status(png_ptr) function. +It will return a png_byte that is zero if the image was gray or +1 if there were any non-gray pixels. bKGD and sBIT data +will be silently converted to grayscale, using the green channel +data, regardless of the error_action setting. + +With red_weight+green_weight<=100000, +the normalized graylevel is computed: + + int rw = red_weight * 65536; + int gw = green_weight * 65536; + int bw = 65536 - (rw + gw); + gray = (rw*red + gw*green + bw*blue)/65536; + +The default values approximate those recommended in the Charles +Poynton's Color FAQ, +Copyright (c) 1998-01-04 Charles Poynton + + Y = 0.212671 * R + 0.715160 * G + 0.072169 * B + +Libpng approximates this with + + Y = 0.21268 * R + 0.7151 * G + 0.07217 * B + +which can be expressed with integers as + + Y = (6969 * R + 23434 * G + 2365 * B)/32768 + +The calculation is done in a linear colorspace, if the image gamma +is known. + +If you have a grayscale and you are using png_set_expand_depth(), +png_set_expand(), or png_set_gray_to_rgb to change to truecolor or to +a higher bit-depth, you must either supply the background color as a gray +value at the original file bit-depth (need_expand = 1) or else supply the +background color as an RGB triplet at the final, expanded bit depth +(need_expand = 0). Similarly, if you are reading a paletted image, you +must either supply the background color as a palette index (need_expand = 1) +or as an RGB triplet that may or may not be in the palette (need_expand = 0). + + png_color_16 my_background; + png_color_16p image_background; + + if (png_get_bKGD(png_ptr, info_ptr, &image_background)) + png_set_background(png_ptr, image_background, + PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); + else + png_set_background(png_ptr, &my_background, + PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); + +The png_set_background() function tells libpng to composite images +with alpha or simple transparency against the supplied background +color. If the PNG file contains a bKGD chunk (PNG_INFO_bKGD valid), +you may use this color, or supply another color more suitable for +the current display (e.g., the background color from a web page). You +need to tell libpng whether the color is in the gamma space of the +display (PNG_BACKGROUND_GAMMA_SCREEN for colors you supply), the file +(PNG_BACKGROUND_GAMMA_FILE for colors from the bKGD chunk), or one +that is neither of these gammas (PNG_BACKGROUND_GAMMA_UNIQUE - I don't +know why anyone would use this, but it's here). + +To properly display PNG images on any kind of system, the application needs +to know what the display gamma is. Ideally, the user will know this, and +the application will allow them to set it. One method of allowing the user +to set the display gamma separately for each system is to check for a +SCREEN_GAMMA or DISPLAY_GAMMA environment variable, which will hopefully be +correctly set. + +Note that display_gamma is the overall gamma correction required to produce +pleasing results, which depends on the lighting conditions in the surrounding +environment. In a dim or brightly lit room, no compensation other than +the physical gamma exponent of the monitor is needed, while in a dark room +a slightly smaller exponent is better. + + double gamma, screen_gamma; + + if (/* We have a user-defined screen + gamma value */) + { + screen_gamma = user_defined_screen_gamma; + } + /* One way that applications can share the same + screen gamma value */ + else if ((gamma_str = getenv("SCREEN_GAMMA")) + != NULL) + { + screen_gamma = (double)atof(gamma_str); + } + /* If we don't have another value */ + else + { + screen_gamma = 2.2; /* A good guess for a + PC monitor in a bright office or a dim room */ + screen_gamma = 2.0; /* A good guess for a + PC monitor in a dark room */ + screen_gamma = 1.7 or 1.0; /* A good + guess for Mac systems */ + } + +The png_set_gamma() function handles gamma transformations of the data. +Pass both the file gamma and the current screen_gamma. If the file does +not have a gamma value, you can pass one anyway if you have an idea what +it is (usually 0.45455 is a good guess for GIF images on PCs). Note +that file gammas are inverted from screen gammas. See the discussions +on gamma in the PNG specification for an excellent description of what +gamma is, and why all applications should support it. It is strongly +recommended that PNG viewers support gamma correction. + + if (png_get_gAMA(png_ptr, info_ptr, &gamma)) + png_set_gamma(png_ptr, screen_gamma, gamma); + else + png_set_gamma(png_ptr, screen_gamma, 0.45455); + +If you need to reduce an RGB file to a paletted file, or if a paletted +file has more entries then will fit on your screen, png_set_quantize() +will do that. Note that this is a simple match dither that merely +finds the closest color available. This should work fairly well with +optimized palettes, and fairly badly with linear color cubes. If you +pass a palette that is larger then maximum_colors, the file will +reduce the number of colors in the palette so it will fit into +maximum_colors. If there is a histogram, it will use it to make +more intelligent choices when reducing the palette. If there is no +histogram, it may not do as good a job. + + if (color_type & PNG_COLOR_MASK_COLOR) + { + if (png_get_valid(png_ptr, info_ptr, + PNG_INFO_PLTE)) + { + png_uint_16p histogram = NULL; + + png_get_hIST(png_ptr, info_ptr, + &histogram); + png_set_quantize(png_ptr, palette, num_palette, + max_screen_colors, histogram, 1); + } + else + { + png_color std_color_cube[MAX_SCREEN_COLORS] = + { ... colors ... }; + + png_set_quantize(png_ptr, std_color_cube, + MAX_SCREEN_COLORS, MAX_SCREEN_COLORS, + NULL,0); + } + } + +PNG files describe monochrome as black being zero and white being one. +The following code will reverse this (make black be one and white be +zero): + + if (bit_depth == 1 && color_type == PNG_COLOR_TYPE_GRAY) + png_set_invert_mono(png_ptr); + +This function can also be used to invert grayscale and gray-alpha images: + + if (color_type == PNG_COLOR_TYPE_GRAY || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + png_set_invert_mono(png_ptr); + +PNG files store 16 bit pixels in network byte order (big-endian, +ie. most significant bits first). This code changes the storage to the +other way (little-endian, i.e. least significant bits first, the +way PCs store them): + + if (bit_depth == 16) + png_set_swap(png_ptr); + +If you are using packed-pixel images (1, 2, or 4 bits/pixel), and you +need to change the order the pixels are packed into bytes, you can use: + + if (bit_depth < 8) + png_set_packswap(png_ptr); + +Finally, you can write your own transformation function if none of +the existing ones meets your needs. This is done by setting a callback +with + + png_set_read_user_transform_fn(png_ptr, + read_transform_fn); + +You must supply the function + + void read_transform_fn(png_ptr ptr, row_info_ptr + row_info, png_bytep data) + +See pngtest.c for a working example. Your function will be called +after all of the other transformations have been processed. + +You can also set up a pointer to a user structure for use by your +callback function, and you can inform libpng that your transform +function will change the number of channels or bit depth with the +function + + png_set_user_transform_info(png_ptr, user_ptr, + user_depth, user_channels); + +The user's application, not libpng, is responsible for allocating and +freeing any memory required for the user structure. + +You can retrieve the pointer via the function +png_get_user_transform_ptr(). For example: + + voidp read_user_transform_ptr = + png_get_user_transform_ptr(png_ptr); + +The last thing to handle is interlacing; this is covered in detail below, +but you must call the function here if you want libpng to handle expansion +of the interlaced image. + + number_of_passes = png_set_interlace_handling(png_ptr); + +After setting the transformations, libpng can update your png_info +structure to reflect any transformations you've requested with this +call. This is most useful to update the info structure's rowbytes +field so you can use it to allocate your image memory. This function +will also update your palette with the correct screen_gamma and +background if these have been given with the calls above. + + png_read_update_info(png_ptr, info_ptr); + +After you call png_read_update_info(), you can allocate any +memory you need to hold the image. The row data is simply +raw byte data for all forms of images. As the actual allocation +varies among applications, no example will be given. If you +are allocating one large chunk, you will need to build an +array of pointers to each row, as it will be needed for some +of the functions below. + +Reading image data + +After you've allocated memory, you can read the image data. +The simplest way to do this is in one function call. If you are +allocating enough memory to hold the whole image, you can just +call png_read_image() and libpng will read in all the image data +and put it in the memory area supplied. You will need to pass in +an array of pointers to each row. + +This function automatically handles interlacing, so you don't need +to call png_set_interlace_handling() or call this function multiple +times, or any of that other stuff necessary with png_read_rows(). + + png_read_image(png_ptr, row_pointers); + +where row_pointers is: + + png_bytep row_pointers[height]; + +You can point to void or char or whatever you use for pixels. + +If you don't want to read in the whole image at once, you can +use png_read_rows() instead. If there is no interlacing (check +interlace_type == PNG_INTERLACE_NONE), this is simple: + + png_read_rows(png_ptr, row_pointers, NULL, + number_of_rows); + +where row_pointers is the same as in the png_read_image() call. + +If you are doing this just one row at a time, you can do this with +a single row_pointer instead of an array of row_pointers: + + png_bytep row_pointer = row; + png_read_row(png_ptr, row_pointer, NULL); + +If the file is interlaced (interlace_type != 0 in the IHDR chunk), things +get somewhat harder. The only current (PNG Specification version 1.2) +interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7) +is a somewhat complicated 2D interlace scheme, known as Adam7, that +breaks down an image into seven smaller images of varying size, based +on an 8x8 grid. + +libpng can fill out those images or it can give them to you "as is". +If you want them filled out, there are two ways to do that. The one +mentioned in the PNG specification is to expand each pixel to cover +those pixels that have not been read yet (the "rectangle" method). +This results in a blocky image for the first pass, which gradually +smooths out as more pixels are read. The other method is the "sparkle" +method, where pixels are drawn only in their final locations, with the +rest of the image remaining whatever colors they were initialized to +before the start of the read. The first method usually looks better, +but tends to be slower, as there are more pixels to put in the rows. + +If you don't want libpng to handle the interlacing details, just call +png_read_rows() seven times to read in all seven images. Each of the +images is a valid image by itself, or they can all be combined on an +8x8 grid to form a single image (although if you intend to combine them +you would be far better off using the libpng interlace handling). + +The first pass will return an image 1/8 as wide as the entire image +(every 8th column starting in column 0) and 1/8 as high as the original +(every 8th row starting in row 0), the second will be 1/8 as wide +(starting in column 4) and 1/8 as high (also starting in row 0). The +third pass will be 1/4 as wide (every 4th pixel starting in column 0) and +1/8 as high (every 8th row starting in row 4), and the fourth pass will +be 1/4 as wide and 1/4 as high (every 4th column starting in column 2, +and every 4th row starting in row 0). The fifth pass will return an +image 1/2 as wide, and 1/4 as high (starting at column 0 and row 2), +while the sixth pass will be 1/2 as wide and 1/2 as high as the original +(starting in column 1 and row 0). The seventh and final pass will be as +wide as the original, and 1/2 as high, containing all of the odd +numbered scanlines. Phew! + +If you want libpng to expand the images, call this before calling +png_start_read_image() or png_read_update_info(): + + if (interlace_type == PNG_INTERLACE_ADAM7) + number_of_passes + = png_set_interlace_handling(png_ptr); + +This will return the number of passes needed. Currently, this +is seven, but may change if another interlace type is added. +This function can be called even if the file is not interlaced, +where it will return one pass. + +If you are not going to display the image after each pass, but are +going to wait until the entire image is read in, use the sparkle +effect. This effect is faster and the end result of either method +is exactly the same. If you are planning on displaying the image +after each pass, the "rectangle" effect is generally considered the +better looking one. + +If you only want the "sparkle" effect, just call png_read_rows() as +normal, with the third parameter NULL. Make sure you make pass over +the image number_of_passes times, and you don't change the data in the +rows between calls. You can change the locations of the data, just +not the data. Each pass only writes the pixels appropriate for that +pass, and assumes the data from previous passes is still valid. + + png_read_rows(png_ptr, row_pointers, NULL, + number_of_rows); + +If you only want the first effect (the rectangles), do the same as +before except pass the row buffer in the third parameter, and leave +the second parameter NULL. + + png_read_rows(png_ptr, NULL, row_pointers, + number_of_rows); + +Finishing a sequential read + +After you are finished reading the image through the +low-level interface, you can finish reading the file. If you are +interested in comments or time, which may be stored either before or +after the image data, you should pass the separate png_info struct if +you want to keep the comments from before and after the image +separate. If you are not interested, you can pass NULL. + + png_read_end(png_ptr, end_info); + +When you are done, you can free all memory allocated by libpng like this: + + png_destroy_read_struct(&png_ptr, &info_ptr, + &end_info); + +It is also possible to individually free the info_ptr members that +point to libpng-allocated storage with the following function: + + png_free_data(png_ptr, info_ptr, mask, seq) + mask - identifies data to be freed, a mask + containing the bitwise OR of one or + more of + PNG_FREE_PLTE, PNG_FREE_TRNS, + PNG_FREE_HIST, PNG_FREE_ICCP, + PNG_FREE_PCAL, PNG_FREE_ROWS, + PNG_FREE_SCAL, PNG_FREE_SPLT, + PNG_FREE_TEXT, PNG_FREE_UNKN, + or simply PNG_FREE_ALL + seq - sequence number of item to be freed + (-1 for all items) + +This function may be safely called when the relevant storage has +already been freed, or has not yet been allocated, or was allocated +by the user and not by libpng, and will in those cases do nothing. +The "seq" parameter is ignored if only one item of the selected data +type, such as PLTE, is allowed. If "seq" is not -1, and multiple items +are allowed for the data type identified in the mask, such as text or +sPLT, only the n'th item in the structure is freed, where n is "seq". + +The default behavior is only to free data that was allocated internally +by libpng. This can be changed, so that libpng will not free the data, +or so that it will free data that was allocated by the user with png_malloc() +or png_zalloc() and passed in via a png_set_*() function, with + + png_data_freer(png_ptr, info_ptr, freer, mask) + mask - which data elements are affected + same choices as in png_free_data() + freer - one of + PNG_DESTROY_WILL_FREE_DATA + PNG_SET_WILL_FREE_DATA + PNG_USER_WILL_FREE_DATA + +This function only affects data that has already been allocated. +You can call this function after reading the PNG data but before calling +any png_set_*() functions, to control whether the user or the png_set_*() +function is responsible for freeing any existing data that might be present, +and again after the png_set_*() functions to control whether the user +or png_destroy_*() is supposed to free the data. When the user assumes +responsibility for libpng-allocated data, the application must use +png_free() to free it, and when the user transfers responsibility to libpng +for data that the user has allocated, the user must have used png_malloc() +or png_zalloc() to allocate it. + +If you allocated your row_pointers in a single block, as suggested above in +the description of the high level read interface, you must not transfer +responsibility for freeing it to the png_set_rows or png_read_destroy function, +because they would also try to free the individual row_pointers[i]. + +If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword +separately, do not transfer responsibility for freeing text_ptr to libpng, +because when libpng fills a png_text structure it combines these members with +the key member, and png_free_data() will free only text_ptr.key. Similarly, +if you transfer responsibility for free'ing text_ptr from libpng to your +application, your application must not separately free those members. + +The png_free_data() function will turn off the "valid" flag for anything +it frees. If you need to turn the flag off for a chunk that was freed by +your application instead of by libpng, you can use + + png_set_invalid(png_ptr, info_ptr, mask); + mask - identifies the chunks to be made invalid, + containing the bitwise OR of one or + more of + PNG_INFO_gAMA, PNG_INFO_sBIT, + PNG_INFO_cHRM, PNG_INFO_PLTE, + PNG_INFO_tRNS, PNG_INFO_bKGD, + PNG_INFO_hIST, PNG_INFO_pHYs, + PNG_INFO_oFFs, PNG_INFO_tIME, + PNG_INFO_pCAL, PNG_INFO_sRGB, + PNG_INFO_iCCP, PNG_INFO_sPLT, + PNG_INFO_sCAL, PNG_INFO_IDAT + +For a more compact example of reading a PNG image, see the file example.c. + +Reading PNG files progressively + +The progressive reader is slightly different then the non-progressive +reader. Instead of calling png_read_info(), png_read_rows(), and +png_read_end(), you make one call to png_process_data(), which calls +callbacks when it has the info, a row, or the end of the image. You +set up these callbacks with png_set_progressive_read_fn(). You don't +have to worry about the input/output functions of libpng, as you are +giving the library the data directly in png_process_data(). I will +assume that you have read the section on reading PNG files above, +so I will only highlight the differences (although I will show +all of the code). + +png_structp png_ptr; +png_infop info_ptr; + + /* An example code fragment of how you would + initialize the progressive reader in your + application. */ + int + initialize_png_reader() + { + png_ptr = png_create_read_struct + (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, + user_error_fn, user_warning_fn); + if (!png_ptr) + return (ERROR); + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + { + png_destroy_read_struct(&png_ptr, (png_infopp)NULL, + (png_infopp)NULL); + return (ERROR); + } + + if (setjmp(png_jmpbuf(png_ptr))) + { + png_destroy_read_struct(&png_ptr, &info_ptr, + (png_infopp)NULL); + return (ERROR); + } + + /* This one's new. You can provide functions + to be called when the header info is valid, + when each row is completed, and when the image + is finished. If you aren't using all functions, + you can specify NULL parameters. Even when all + three functions are NULL, you need to call + png_set_progressive_read_fn(). You can use + any struct as the user_ptr (cast to a void pointer + for the function call), and retrieve the pointer + from inside the callbacks using the function + + png_get_progressive_ptr(png_ptr); + + which will return a void pointer, which you have + to cast appropriately. + */ + png_set_progressive_read_fn(png_ptr, (void *)user_ptr, + info_callback, row_callback, end_callback); + + return 0; + } + + /* A code fragment that you call as you receive blocks + of data */ + int + process_data(png_bytep buffer, png_uint_32 length) + { + if (setjmp(png_jmpbuf(png_ptr))) + { + png_destroy_read_struct(&png_ptr, &info_ptr, + (png_infopp)NULL); + return (ERROR); + } + + /* This one's new also. Simply give it a chunk + of data from the file stream (in order, of + course). On machines with segmented memory + models machines, don't give it any more than + 64K. The library seems to run fine with sizes + of 4K. Although you can give it much less if + necessary (I assume you can give it chunks of + 1 byte, I haven't tried less then 256 bytes + yet). When this function returns, you may + want to display any rows that were generated + in the row callback if you don't already do + so there. + */ + png_process_data(png_ptr, info_ptr, buffer, length); + return 0; + } + + /* This function is called (as set by + png_set_progressive_read_fn() above) when enough data + has been supplied so all of the header has been + read. + */ + void + info_callback(png_structp png_ptr, png_infop info) + { + /* Do any setup here, including setting any of + the transformations mentioned in the Reading + PNG files section. For now, you _must_ call + either png_start_read_image() or + png_read_update_info() after all the + transformations are set (even if you don't set + any). You may start getting rows before + png_process_data() returns, so this is your + last chance to prepare for that. + */ + } + + /* This function is called when each row of image + data is complete */ + void + row_callback(png_structp png_ptr, png_bytep new_row, + png_uint_32 row_num, int pass) + { + /* If the image is interlaced, and you turned + on the interlace handler, this function will + be called for every row in every pass. Some + of these rows will not be changed from the + previous pass. When the row is not changed, + the new_row variable will be NULL. The rows + and passes are called in order, so you don't + really need the row_num and pass, but I'm + supplying them because it may make your life + easier. + + For the non-NULL rows of interlaced images, + you must call png_progressive_combine_row() + passing in the row and the old row. You can + call this function for NULL rows (it will just + return) and for non-interlaced images (it just + does the memcpy for you) if it will make the + code easier. Thus, you can just do this for + all cases: + */ + + png_progressive_combine_row(png_ptr, old_row, + new_row); + + /* where old_row is what was displayed for + previously for the row. Note that the first + pass (pass == 0, really) will completely cover + the old row, so the rows do not have to be + initialized. After the first pass (and only + for interlaced images), you will have to pass + the current row, and the function will combine + the old row and the new row. + */ + } + + void + end_callback(png_structp png_ptr, png_infop info) + { + /* This function is called after the whole image + has been read, including any chunks after the + image (up to and including the IEND). You + will usually have the same info chunk as you + had in the header, although some data may have + been added to the comments and time fields. + + Most people won't do much here, perhaps setting + a flag that marks the image as finished. + */ + } + + + +IV. Writing + +Much of this is very similar to reading. However, everything of +importance is repeated here, so you won't have to constantly look +back up in the reading section to understand writing. + +Setup + +You will want to do the I/O initialization before you get into libpng, +so if it doesn't work, you don't have anything to undo. If you are not +using the standard I/O functions, you will need to replace them with +custom writing functions. See the discussion under Customizing libpng. + + FILE *fp = fopen(file_name, "wb"); + if (!fp) + { + return (ERROR); + } + +Next, png_struct and png_info need to be allocated and initialized. +As these can be both relatively large, you may not want to store these +on the stack, unless you have stack space to spare. Of course, you +will want to check if they return NULL. If you are also reading, +you won't want to name your read structure and your write structure +both "png_ptr"; you can call them anything you like, such as +"read_ptr" and "write_ptr". Look at pngtest.c, for example. + + png_structp png_ptr = png_create_write_struct + (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, + user_error_fn, user_warning_fn); + if (!png_ptr) + return (ERROR); + + png_infop info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + { + png_destroy_write_struct(&png_ptr, + (png_infopp)NULL); + return (ERROR); + } + +If you want to use your own memory allocation routines, +define PNG_USER_MEM_SUPPORTED and use +png_create_write_struct_2() instead of png_create_write_struct(): + + png_structp png_ptr = png_create_write_struct_2 + (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, + user_error_fn, user_warning_fn, (png_voidp) + user_mem_ptr, user_malloc_fn, user_free_fn); + +After you have these structures, you will need to set up the +error handling. When libpng encounters an error, it expects to +longjmp() back to your routine. Therefore, you will need to call +setjmp() and pass the png_jmpbuf(png_ptr). If you +write the file from different routines, you will need to update +the png_jmpbuf(png_ptr) every time you enter a new routine that will +call a png_*() function. See your documentation of setjmp/longjmp +for your compiler for more information on setjmp/longjmp. See +the discussion on libpng error handling in the Customizing Libpng +section below for more information on the libpng error handling. + + if (setjmp(png_jmpbuf(png_ptr))) + { + png_destroy_write_struct(&png_ptr, &info_ptr); + fclose(fp); + return (ERROR); + } + ... + return; + +If you would rather avoid the complexity of setjmp/longjmp issues, +you can compile libpng with PNG_NO_SETJMP, in which case +errors will result in a call to PNG_ABORT() which defaults to abort(). + +You can #define PNG_ABORT() to a function that does something +more useful than abort(), as long as your function does not +return. + +Now you need to set up the output code. The default for libpng is to +use the C function fwrite(). If you use this, you will need to pass a +valid FILE * in the function png_init_io(). Be sure that the file is +opened in binary mode. Again, if you wish to handle writing data in +another way, see the discussion on libpng I/O handling in the Customizing +Libpng section below. + + png_init_io(png_ptr, fp); + +If you are embedding your PNG into a datastream such as MNG, and don't +want libpng to write the 8-byte signature, or if you have already +written the signature in your application, use + + png_set_sig_bytes(png_ptr, 8); + +to inform libpng that it should not write a signature. + +Write callbacks + +At this point, you can set up a callback function that will be +called after each row has been written, which you can use to control +a progress meter or the like. It's demonstrated in pngtest.c. +You must supply a function + + void write_row_callback(png_ptr, png_uint_32 row, + int pass); + { + /* put your code here */ + } + +(You can give it another name that you like instead of "write_row_callback") + +To inform libpng about your function, use + + png_set_write_status_fn(png_ptr, write_row_callback); + +You now have the option of modifying how the compression library will +run. The following functions are mainly for testing, but may be useful +in some cases, like if you need to write PNG files extremely fast and +are willing to give up some compression, or if you want to get the +maximum possible compression at the expense of slower writing. If you +have no special needs in this area, let the library do what it wants by +not calling this function at all, as it has been tuned to deliver a good +speed/compression ratio. The second parameter to png_set_filter() is +the filter method, for which the only valid values are 0 (as of the +July 1999 PNG specification, version 1.2) or 64 (if you are writing +a PNG datastream that is to be embedded in a MNG datastream). The third +parameter is a flag that indicates which filter type(s) are to be tested +for each scanline. See the PNG specification for details on the specific +filter types. + + + /* turn on or off filtering, and/or choose + specific filters. You can use either a single + PNG_FILTER_VALUE_NAME or the bitwise OR of one + or more PNG_FILTER_NAME masks. */ + png_set_filter(png_ptr, 0, + PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE | + PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB | + PNG_FILTER_UP | PNG_FILTER_VALUE_UP | + PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG | + PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH| + PNG_ALL_FILTERS); + +If an application +wants to start and stop using particular filters during compression, +it should start out with all of the filters (to ensure that the previous +row of pixels will be stored in case it's needed later), and then add +and remove them after the start of compression. + +If you are writing a PNG datastream that is to be embedded in a MNG +datastream, the second parameter can be either 0 or 64. + +The png_set_compression_*() functions interface to the zlib compression +library, and should mostly be ignored unless you really know what you are +doing. The only generally useful call is png_set_compression_level() +which changes how much time zlib spends on trying to compress the image +data. See the Compression Library (zlib.h and algorithm.txt, distributed +with zlib) for details on the compression levels. + + /* set the zlib compression level */ + png_set_compression_level(png_ptr, + Z_BEST_COMPRESSION); + + /* set other zlib parameters */ + png_set_compression_mem_level(png_ptr, 8); + png_set_compression_strategy(png_ptr, + Z_DEFAULT_STRATEGY); + png_set_compression_window_bits(png_ptr, 15); + png_set_compression_method(png_ptr, 8); + png_set_compression_buffer_size(png_ptr, 8192) + +extern PNG_EXPORT(void,png_set_zbuf_size) + +Setting the contents of info for output + +You now need to fill in the png_info structure with all the data you +wish to write before the actual image. Note that the only thing you +are allowed to write after the image is the text chunks and the time +chunk (as of PNG Specification 1.2, anyway). See png_write_end() and +the latest PNG specification for more information on that. If you +wish to write them before the image, fill them in now, and flag that +data as being valid. If you want to wait until after the data, don't +fill them until png_write_end(). For all the fields in png_info and +their data types, see png.h. For explanations of what the fields +contain, see the PNG specification. + +Some of the more important parts of the png_info are: + + png_set_IHDR(png_ptr, info_ptr, width, height, + bit_depth, color_type, interlace_type, + compression_type, filter_method) + width - holds the width of the image + in pixels (up to 2^31). + height - holds the height of the image + in pixels (up to 2^31). + bit_depth - holds the bit depth of one of the + image channels. + (valid values are 1, 2, 4, 8, 16 + and depend also on the + color_type. See also significant + bits (sBIT) below). + color_type - describes which color/alpha + channels are present. + PNG_COLOR_TYPE_GRAY + (bit depths 1, 2, 4, 8, 16) + PNG_COLOR_TYPE_GRAY_ALPHA + (bit depths 8, 16) + PNG_COLOR_TYPE_PALETTE + (bit depths 1, 2, 4, 8) + PNG_COLOR_TYPE_RGB + (bit_depths 8, 16) + PNG_COLOR_TYPE_RGB_ALPHA + (bit_depths 8, 16) + + PNG_COLOR_MASK_PALETTE + PNG_COLOR_MASK_COLOR + PNG_COLOR_MASK_ALPHA + + interlace_type - PNG_INTERLACE_NONE or + PNG_INTERLACE_ADAM7 + compression_type - (must be + PNG_COMPRESSION_TYPE_DEFAULT) + filter_method - (must be PNG_FILTER_TYPE_DEFAULT + or, if you are writing a PNG to + be embedded in a MNG datastream, + can also be + PNG_INTRAPIXEL_DIFFERENCING) + +If you call png_set_IHDR(), the call must appear before any of the +other png_set_*() functions, because they might require access to some of +the IHDR settings. The remaining png_set_*() functions can be called +in any order. + +If you wish, you can reset the compression_type, interlace_type, or +filter_method later by calling png_set_IHDR() again; if you do this, the +width, height, bit_depth, and color_type must be the same in each call. + + png_set_PLTE(png_ptr, info_ptr, palette, + num_palette); + palette - the palette for the file + (array of png_color) + num_palette - number of entries in the palette + + png_set_gAMA(png_ptr, info_ptr, gamma); + gamma - the gamma the image was created + at (PNG_INFO_gAMA) + + png_set_sRGB(png_ptr, info_ptr, srgb_intent); + srgb_intent - the rendering intent + (PNG_INFO_sRGB) The presence of + the sRGB chunk means that the pixel + data is in the sRGB color space. + This chunk also implies specific + values of gAMA and cHRM. Rendering + intent is the CSS-1 property that + has been defined by the International + Color Consortium + (http://www.color.org). + It can be one of + PNG_sRGB_INTENT_SATURATION, + PNG_sRGB_INTENT_PERCEPTUAL, + PNG_sRGB_INTENT_ABSOLUTE, or + PNG_sRGB_INTENT_RELATIVE. + + + png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, + srgb_intent); + srgb_intent - the rendering intent + (PNG_INFO_sRGB) The presence of the + sRGB chunk means that the pixel + data is in the sRGB color space. + This function also causes gAMA and + cHRM chunks with the specific values + that are consistent with sRGB to be + written. + + png_set_iCCP(png_ptr, info_ptr, name, compression_type, + profile, proflen); + name - The profile name. + compression - The compression type; always + PNG_COMPRESSION_TYPE_BASE for PNG 1.0. + You may give NULL to this argument to + ignore it. + profile - International Color Consortium color + profile data. May contain NULs. + proflen - length of profile data in bytes. + + png_set_sBIT(png_ptr, info_ptr, sig_bit); + sig_bit - the number of significant bits for + (PNG_INFO_sBIT) each of the gray, red, + green, and blue channels, whichever are + appropriate for the given color type + (png_color_16) + + png_set_tRNS(png_ptr, info_ptr, trans_alpha, + num_trans, trans_color); + trans_alpha - array of alpha (transparency) + entries for palette (PNG_INFO_tRNS) + trans_color - graylevel or color sample values + (in order red, green, blue) of the + single transparent color for + non-paletted images (PNG_INFO_tRNS) + num_trans - number of transparent entries + (PNG_INFO_tRNS) + + png_set_hIST(png_ptr, info_ptr, hist); + (PNG_INFO_hIST) + hist - histogram of palette (array of + png_uint_16) + + png_set_tIME(png_ptr, info_ptr, mod_time); + mod_time - time image was last modified + (PNG_VALID_tIME) + + png_set_bKGD(png_ptr, info_ptr, background); + background - background color (PNG_VALID_bKGD) + + png_set_text(png_ptr, info_ptr, text_ptr, num_text); + text_ptr - array of png_text holding image + comments + text_ptr[i].compression - type of compression used + on "text" PNG_TEXT_COMPRESSION_NONE + PNG_TEXT_COMPRESSION_zTXt + PNG_ITXT_COMPRESSION_NONE + PNG_ITXT_COMPRESSION_zTXt + text_ptr[i].key - keyword for comment. Must contain + 1-79 characters. + text_ptr[i].text - text comments for current + keyword. Can be NULL or empty. + text_ptr[i].text_length - length of text string, + after decompression, 0 for iTXt + text_ptr[i].itxt_length - length of itxt string, + after decompression, 0 for tEXt/zTXt + text_ptr[i].lang - language of comment (NULL or + empty for unknown). + text_ptr[i].translated_keyword - keyword in UTF-8 (NULL + or empty for unknown). + Note that the itxt_length, lang, and lang_key + members of the text_ptr structure only exist + when the library is built with iTXt chunk support. + + num_text - number of comments + + png_set_sPLT(png_ptr, info_ptr, &palette_ptr, + num_spalettes); + palette_ptr - array of png_sPLT_struct structures + to be added to the list of palettes + in the info structure. + num_spalettes - number of palette structures to be + added. + + png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, + unit_type); + offset_x - positive offset from the left + edge of the screen + offset_y - positive offset from the top + edge of the screen + unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER + + png_set_pHYs(png_ptr, info_ptr, res_x, res_y, + unit_type); + res_x - pixels/unit physical resolution + in x direction + res_y - pixels/unit physical resolution + in y direction + unit_type - PNG_RESOLUTION_UNKNOWN, + PNG_RESOLUTION_METER + + png_set_sCAL(png_ptr, info_ptr, unit, width, height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are doubles) + + png_set_sCAL_s(png_ptr, info_ptr, unit, width, height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are strings like "2.54") + + png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, + num_unknowns) + unknowns - array of png_unknown_chunk + structures holding unknown chunks + unknowns[i].name - name of unknown chunk + unknowns[i].data - data of unknown chunk + unknowns[i].size - size of unknown chunk's data + unknowns[i].location - position to write chunk in file + 0: do not write chunk + PNG_HAVE_IHDR: before PLTE + PNG_HAVE_PLTE: before IDAT + PNG_AFTER_IDAT: after IDAT + +The "location" member is set automatically according to +what part of the output file has already been written. +You can change its value after calling png_set_unknown_chunks() +as demonstrated in pngtest.c. Within each of the "locations", +the chunks are sequenced according to their position in the +structure (that is, the value of "i", which is the order in which +the chunk was either read from the input file or defined with +png_set_unknown_chunks). + +A quick word about text and num_text. text is an array of png_text +structures. num_text is the number of valid structures in the array. +Each png_text structure holds a language code, a keyword, a text value, +and a compression type. + +The compression types have the same valid numbers as the compression +types of the image data. Currently, the only valid number is zero. +However, you can store text either compressed or uncompressed, unlike +images, which always have to be compressed. So if you don't want the +text compressed, set the compression type to PNG_TEXT_COMPRESSION_NONE. +Because tEXt and zTXt chunks don't have a language field, if you +specify PNG_TEXT_COMPRESSION_NONE or PNG_TEXT_COMPRESSION_zTXt +any language code or translated keyword will not be written out. + +Until text gets around 1000 bytes, it is not worth compressing it. +After the text has been written out to the file, the compression type +is set to PNG_TEXT_COMPRESSION_NONE_WR or PNG_TEXT_COMPRESSION_zTXt_WR, +so that it isn't written out again at the end (in case you are calling +png_write_end() with the same struct. + +The keywords that are given in the PNG Specification are: + + Title Short (one line) title or + caption for image + Author Name of image's creator + Description Description of image (possibly long) + Copyright Copyright notice + Creation Time Time of original image creation + (usually RFC 1123 format, see below) + Software Software used to create the image + Disclaimer Legal disclaimer + Warning Warning of nature of content + Source Device used to create the image + Comment Miscellaneous comment; conversion + from other image format + +The keyword-text pairs work like this. Keywords should be short +simple descriptions of what the comment is about. Some typical +keywords are found in the PNG specification, as is some recommendations +on keywords. You can repeat keywords in a file. You can even write +some text before the image and some after. For example, you may want +to put a description of the image before the image, but leave the +disclaimer until after, so viewers working over modem connections +don't have to wait for the disclaimer to go over the modem before +they start seeing the image. Finally, keywords should be full +words, not abbreviations. Keywords and text are in the ISO 8859-1 +(Latin-1) character set (a superset of regular ASCII) and can not +contain NUL characters, and should not contain control or other +unprintable characters. To make the comments widely readable, stick +with basic ASCII, and avoid machine specific character set extensions +like the IBM-PC character set. The keyword must be present, but +you can leave off the text string on non-compressed pairs. +Compressed pairs must have a text string, as only the text string +is compressed anyway, so the compression would be meaningless. + +PNG supports modification time via the png_time structure. Two +conversion routines are provided, png_convert_from_time_t() for +time_t and png_convert_from_struct_tm() for struct tm. The +time_t routine uses gmtime(). You don't have to use either of +these, but if you wish to fill in the png_time structure directly, +you should provide the time in universal time (GMT) if possible +instead of your local time. Note that the year number is the full +year (e.g. 1998, rather than 98 - PNG is year 2000 compliant!), and +that months start with 1. + +If you want to store the time of the original image creation, you should +use a plain tEXt chunk with the "Creation Time" keyword. This is +necessary because the "creation time" of a PNG image is somewhat vague, +depending on whether you mean the PNG file, the time the image was +created in a non-PNG format, a still photo from which the image was +scanned, or possibly the subject matter itself. In order to facilitate +machine-readable dates, it is recommended that the "Creation Time" +tEXt chunk use RFC 1123 format dates (e.g. "22 May 1997 18:07:10 GMT"), +although this isn't a requirement. Unlike the tIME chunk, the +"Creation Time" tEXt chunk is not expected to be automatically changed +by the software. To facilitate the use of RFC 1123 dates, a function +png_convert_to_rfc1123(png_timep) is provided to convert from PNG +time to an RFC 1123 format string. + +Writing unknown chunks + +You can use the png_set_unknown_chunks function to queue up chunks +for writing. You give it a chunk name, raw data, and a size; that's +all there is to it. The chunks will be written by the next following +png_write_info_before_PLTE, png_write_info, or png_write_end function. +Any chunks previously read into the info structure's unknown-chunk +list will also be written out in a sequence that satisfies the PNG +specification's ordering rules. + +The high-level write interface + +At this point there are two ways to proceed; through the high-level +write interface, or through a sequence of low-level write operations. +You can use the high-level interface if your image data is present +in the info structure. All defined output +transformations are permitted, enabled by the following masks. + + PNG_TRANSFORM_IDENTITY No transformation + PNG_TRANSFORM_PACKING Pack 1, 2 and 4-bit samples + PNG_TRANSFORM_PACKSWAP Change order of packed + pixels to LSB first + PNG_TRANSFORM_INVERT_MONO Invert monochrome images + PNG_TRANSFORM_SHIFT Normalize pixels to the + sBIT depth + PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA + to BGRA + PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA + to AG + PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity + to transparency + PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples + PNG_TRANSFORM_STRIP_FILLER Strip out filler + bytes (deprecated). + PNG_TRANSFORM_STRIP_FILLER_BEFORE Strip out leading + filler bytes + PNG_TRANSFORM_STRIP_FILLER_AFTER Strip out trailing + filler bytes + +If you have valid image data in the info structure (you can use +png_set_rows() to put image data in the info structure), simply do this: + + png_write_png(png_ptr, info_ptr, png_transforms, NULL) + +where png_transforms is an integer containing the bitwise OR of some set of +transformation flags. This call is equivalent to png_write_info(), +followed the set of transformations indicated by the transform mask, +then png_write_image(), and finally png_write_end(). + +(The final parameter of this call is not yet used. Someday it might point +to transformation parameters required by some future output transform.) + +You must use png_transforms and not call any png_set_transform() functions +when you use png_write_png(). + +The low-level write interface + +If you are going the low-level route instead, you are now ready to +write all the file information up to the actual image data. You do +this with a call to png_write_info(). + + png_write_info(png_ptr, info_ptr); + +Note that there is one transformation you may need to do before +png_write_info(). In PNG files, the alpha channel in an image is the +level of opacity. If your data is supplied as a level of transparency, +you can invert the alpha channel before you write it, so that 0 is +fully transparent and 255 (in 8-bit or paletted images) or 65535 +(in 16-bit images) is fully opaque, with + + png_set_invert_alpha(png_ptr); + +This must appear before png_write_info() instead of later with the +other transformations because in the case of paletted images the tRNS +chunk data has to be inverted before the tRNS chunk is written. If +your image is not a paletted image, the tRNS data (which in such cases +represents a single color to be rendered as transparent) won't need to +be changed, and you can safely do this transformation after your +png_write_info() call. + +If you need to write a private chunk that you want to appear before +the PLTE chunk when PLTE is present, you can write the PNG info in +two steps, and insert code to write your own chunk between them: + + png_write_info_before_PLTE(png_ptr, info_ptr); + png_set_unknown_chunks(png_ptr, info_ptr, ...); + png_write_info(png_ptr, info_ptr); + +After you've written the file information, you can set up the library +to handle any special transformations of the image data. The various +ways to transform the data will be described in the order that they +should occur. This is important, as some of these change the color +type and/or bit depth of the data, and some others only work on +certain color types and bit depths. Even though each transformation +checks to see if it has data that it can do something with, you should +make sure to only enable a transformation if it will be valid for the +data. For example, don't swap red and blue on grayscale data. + +PNG files store RGB pixels packed into 3 or 6 bytes. This code tells +the library to strip input data that has 4 or 8 bytes per pixel down +to 3 or 6 bytes (or strip 2 or 4-byte grayscale+filler data to 1 or 2 +bytes per pixel). + + png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); + +where the 0 is unused, and the location is either PNG_FILLER_BEFORE or +PNG_FILLER_AFTER, depending upon whether the filler byte in the pixel +is stored XRGB or RGBX. + +PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as +they can, resulting in, for example, 8 pixels per byte for 1 bit files. +If the data is supplied at 1 pixel per byte, use this code, which will +correctly pack the pixels into a single byte: + + png_set_packing(png_ptr); + +PNG files reduce possible bit depths to 1, 2, 4, 8, and 16. If your +data is of another bit depth, you can write an sBIT chunk into the +file so that decoders can recover the original data if desired. + + /* Set the true bit depth of the image data */ + if (color_type & PNG_COLOR_MASK_COLOR) + { + sig_bit.red = true_bit_depth; + sig_bit.green = true_bit_depth; + sig_bit.blue = true_bit_depth; + } + else + { + sig_bit.gray = true_bit_depth; + } + if (color_type & PNG_COLOR_MASK_ALPHA) + { + sig_bit.alpha = true_bit_depth; + } + + png_set_sBIT(png_ptr, info_ptr, &sig_bit); + +If the data is stored in the row buffer in a bit depth other than +one supported by PNG (e.g. 3 bit data in the range 0-7 for a 4-bit PNG), +this will scale the values to appear to be the correct bit depth as +is required by PNG. + + png_set_shift(png_ptr, &sig_bit); + +PNG files store 16 bit pixels in network byte order (big-endian, +ie. most significant bits first). This code would be used if they are +supplied the other way (little-endian, i.e. least significant bits +first, the way PCs store them): + + if (bit_depth > 8) + png_set_swap(png_ptr); + +If you are using packed-pixel images (1, 2, or 4 bits/pixel), and you +need to change the order the pixels are packed into bytes, you can use: + + if (bit_depth < 8) + png_set_packswap(png_ptr); + +PNG files store 3 color pixels in red, green, blue order. This code +would be used if they are supplied as blue, green, red: + + png_set_bgr(png_ptr); + +PNG files describe monochrome as black being zero and white being +one. This code would be used if the pixels are supplied with this reversed +(black being one and white being zero): + + png_set_invert_mono(png_ptr); + +Finally, you can write your own transformation function if none of +the existing ones meets your needs. This is done by setting a callback +with + + png_set_write_user_transform_fn(png_ptr, + write_transform_fn); + +You must supply the function + + void write_transform_fn(png_ptr ptr, row_info_ptr + row_info, png_bytep data) + +See pngtest.c for a working example. Your function will be called +before any of the other transformations are processed. + +You can also set up a pointer to a user structure for use by your +callback function. + + png_set_user_transform_info(png_ptr, user_ptr, 0, 0); + +The user_channels and user_depth parameters of this function are ignored +when writing; you can set them to zero as shown. + +You can retrieve the pointer via the function png_get_user_transform_ptr(). +For example: + + voidp write_user_transform_ptr = + png_get_user_transform_ptr(png_ptr); + +It is possible to have libpng flush any pending output, either manually, +or automatically after a certain number of lines have been written. To +flush the output stream a single time call: + + png_write_flush(png_ptr); + +and to have libpng flush the output stream periodically after a certain +number of scanlines have been written, call: + + png_set_flush(png_ptr, nrows); + +Note that the distance between rows is from the last time png_write_flush() +was called, or the first row of the image if it has never been called. +So if you write 50 lines, and then png_set_flush 25, it will flush the +output on the next scanline, and every 25 lines thereafter, unless +png_write_flush() is called before 25 more lines have been written. +If nrows is too small (less than about 10 lines for a 640 pixel wide +RGB image) the image compression may decrease noticeably (although this +may be acceptable for real-time applications). Infrequent flushing will +only degrade the compression performance by a few percent over images +that do not use flushing. + +Writing the image data + +That's it for the transformations. Now you can write the image data. +The simplest way to do this is in one function call. If you have the +whole image in memory, you can just call png_write_image() and libpng +will write the image. You will need to pass in an array of pointers to +each row. This function automatically handles interlacing, so you don't +need to call png_set_interlace_handling() or call this function multiple +times, or any of that other stuff necessary with png_write_rows(). + + png_write_image(png_ptr, row_pointers); + +where row_pointers is: + + png_byte *row_pointers[height]; + +You can point to void or char or whatever you use for pixels. + +If you don't want to write the whole image at once, you can +use png_write_rows() instead. If the file is not interlaced, +this is simple: + + png_write_rows(png_ptr, row_pointers, + number_of_rows); + +row_pointers is the same as in the png_write_image() call. + +If you are just writing one row at a time, you can do this with +a single row_pointer instead of an array of row_pointers: + + png_bytep row_pointer = row; + + png_write_row(png_ptr, row_pointer); + +When the file is interlaced, things can get a good deal more complicated. +The only currently (as of the PNG Specification version 1.2, dated July +1999) defined interlacing scheme for PNG files is the "Adam7" interlace +scheme, that breaks down an image into seven smaller images of varying +size. libpng will build these images for you, or you can do them +yourself. If you want to build them yourself, see the PNG specification +for details of which pixels to write when. + +If you don't want libpng to handle the interlacing details, just +use png_set_interlace_handling() and call png_write_rows() the +correct number of times to write all seven sub-images. + +If you want libpng to build the sub-images, call this before you start +writing any rows: + + number_of_passes = + png_set_interlace_handling(png_ptr); + +This will return the number of passes needed. Currently, this is seven, +but may change if another interlace type is added. + +Then write the complete image number_of_passes times. + + png_write_rows(png_ptr, row_pointers, + number_of_rows); + +As some of these rows are not used, and thus return immediately, you may +want to read about interlacing in the PNG specification, and only update +the rows that are actually used. + +Finishing a sequential write + +After you are finished writing the image, you should finish writing +the file. If you are interested in writing comments or time, you should +pass an appropriately filled png_info pointer. If you are not interested, +you can pass NULL. + + png_write_end(png_ptr, info_ptr); + +When you are done, you can free all memory used by libpng like this: + + png_destroy_write_struct(&png_ptr, &info_ptr); + +It is also possible to individually free the info_ptr members that +point to libpng-allocated storage with the following function: + + png_free_data(png_ptr, info_ptr, mask, seq) + mask - identifies data to be freed, a mask + containing the bitwise OR of one or + more of + PNG_FREE_PLTE, PNG_FREE_TRNS, + PNG_FREE_HIST, PNG_FREE_ICCP, + PNG_FREE_PCAL, PNG_FREE_ROWS, + PNG_FREE_SCAL, PNG_FREE_SPLT, + PNG_FREE_TEXT, PNG_FREE_UNKN, + or simply PNG_FREE_ALL + seq - sequence number of item to be freed + (-1 for all items) + +This function may be safely called when the relevant storage has +already been freed, or has not yet been allocated, or was allocated +by the user and not by libpng, and will in those cases do nothing. +The "seq" parameter is ignored if only one item of the selected data +type, such as PLTE, is allowed. If "seq" is not -1, and multiple items +are allowed for the data type identified in the mask, such as text or +sPLT, only the n'th item in the structure is freed, where n is "seq". + +If you allocated data such as a palette that you passed in to libpng +with png_set_*, you must not free it until just before the call to +png_destroy_write_struct(). + +The default behavior is only to free data that was allocated internally +by libpng. This can be changed, so that libpng will not free the data, +or so that it will free data that was allocated by the user with png_malloc() +or png_zalloc() and passed in via a png_set_*() function, with + + png_data_freer(png_ptr, info_ptr, freer, mask) + mask - which data elements are affected + same choices as in png_free_data() + freer - one of + PNG_DESTROY_WILL_FREE_DATA + PNG_SET_WILL_FREE_DATA + PNG_USER_WILL_FREE_DATA + +For example, to transfer responsibility for some data from a read structure +to a write structure, you could use + + png_data_freer(read_ptr, read_info_ptr, + PNG_USER_WILL_FREE_DATA, + PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST) + png_data_freer(write_ptr, write_info_ptr, + PNG_DESTROY_WILL_FREE_DATA, + PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST) + +thereby briefly reassigning responsibility for freeing to the user but +immediately afterwards reassigning it once more to the write_destroy +function. Having done this, it would then be safe to destroy the read +structure and continue to use the PLTE, tRNS, and hIST data in the write +structure. + +This function only affects data that has already been allocated. +You can call this function before calling after the png_set_*() functions +to control whether the user or png_destroy_*() is supposed to free the data. +When the user assumes responsibility for libpng-allocated data, the +application must use +png_free() to free it, and when the user transfers responsibility to libpng +for data that the user has allocated, the user must have used png_malloc() +or png_zalloc() to allocate it. + +If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword +separately, do not transfer responsibility for freeing text_ptr to libpng, +because when libpng fills a png_text structure it combines these members with +the key member, and png_free_data() will free only text_ptr.key. Similarly, +if you transfer responsibility for free'ing text_ptr from libpng to your +application, your application must not separately free those members. +For a more compact example of writing a PNG image, see the file example.c. + +V. Modifying/Customizing libpng: + +There are two issues here. The first is changing how libpng does +standard things like memory allocation, input/output, and error handling. +The second deals with more complicated things like adding new chunks, +adding new transformations, and generally changing how libpng works. +Both of those are compile-time issues; that is, they are generally +determined at the time the code is written, and there is rarely a need +to provide the user with a means of changing them. + +Memory allocation, input/output, and error handling + +All of the memory allocation, input/output, and error handling in libpng +goes through callbacks that are user-settable. The default routines are +in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change +these functions, call the appropriate png_set_*_fn() function. + +Memory allocation is done through the functions png_malloc(), png_calloc(), +and png_free(). These currently just call the standard C functions. +png_calloc() calls png_malloc() and then png_memset() to clear the newly +allocated memory to zero. If your pointers can't access more then 64K +at a time, you will want to set MAXSEG_64K in zlib.h. Since it is +unlikely that the method of handling memory allocation on a platform +will change between applications, these functions must be modified in +the library at compile time. If you prefer to use a different method +of allocating and freeing data, you can use png_create_read_struct_2() or +png_create_write_struct_2() to register your own functions as described +above. These functions also provide a void pointer that can be retrieved +via + + mem_ptr=png_get_mem_ptr(png_ptr); + +Your replacement memory functions must have prototypes as follows: + + png_voidp malloc_fn(png_structp png_ptr, + png_alloc_size_t size); + void free_fn(png_structp png_ptr, png_voidp ptr); + +Your malloc_fn() must return NULL in case of failure. The png_malloc() +function will normally call png_error() if it receives a NULL from the +system memory allocator or from your replacement malloc_fn(). + +Your free_fn() will never be called with a NULL ptr, since libpng's +png_free() checks for NULL before calling free_fn(). + +Input/Output in libpng is done through png_read() and png_write(), +which currently just call fread() and fwrite(). The FILE * is stored in +png_struct and is initialized via png_init_io(). If you wish to change +the method of I/O, the library supplies callbacks that you can set +through the function png_set_read_fn() and png_set_write_fn() at run +time, instead of calling the png_init_io() function. These functions +also provide a void pointer that can be retrieved via the function +png_get_io_ptr(). For example: + + png_set_read_fn(png_structp read_ptr, + voidp read_io_ptr, png_rw_ptr read_data_fn) + + png_set_write_fn(png_structp write_ptr, + voidp write_io_ptr, png_rw_ptr write_data_fn, + png_flush_ptr output_flush_fn); + + voidp read_io_ptr = png_get_io_ptr(read_ptr); + voidp write_io_ptr = png_get_io_ptr(write_ptr); + +The replacement I/O functions must have prototypes as follows: + + void user_read_data(png_structp png_ptr, + png_bytep data, png_size_t length); + void user_write_data(png_structp png_ptr, + png_bytep data, png_size_t length); + void user_flush_data(png_structp png_ptr); + +The user_read_data() function is responsible for detecting and +handling end-of-data errors. + +Supplying NULL for the read, write, or flush functions sets them back +to using the default C stream functions, which expect the io_ptr to +point to a standard *FILE structure. It is probably a mistake +to use NULL for one of write_data_fn and output_flush_fn but not both +of them, unless you have built libpng with PNG_NO_WRITE_FLUSH defined. +It is an error to read from a write stream, and vice versa. + +Error handling in libpng is done through png_error() and png_warning(). +Errors handled through png_error() are fatal, meaning that png_error() +should never return to its caller. Currently, this is handled via +setjmp() and longjmp() (unless you have compiled libpng with +PNG_NO_SETJMP, in which case it is handled via PNG_ABORT()), +but you could change this to do things like exit() if you should wish, +as long as your function does not return. + +On non-fatal errors, png_warning() is called +to print a warning message, and then control returns to the calling code. +By default png_error() and png_warning() print a message on stderr via +fprintf() unless the library is compiled with PNG_NO_CONSOLE_IO defined +(because you don't want the messages) or PNG_NO_STDIO defined (because +fprintf() isn't available). If you wish to change the behavior of the error +functions, you will need to set up your own message callbacks. These +functions are normally supplied at the time that the png_struct is created. +It is also possible to redirect errors and warnings to your own replacement +functions after png_create_*_struct() has been called by calling: + + png_set_error_fn(png_structp png_ptr, + png_voidp error_ptr, png_error_ptr error_fn, + png_error_ptr warning_fn); + + png_voidp error_ptr = png_get_error_ptr(png_ptr); + +If NULL is supplied for either error_fn or warning_fn, then the libpng +default function will be used, calling fprintf() and/or longjmp() if a +problem is encountered. The replacement error functions should have +parameters as follows: + + void user_error_fn(png_structp png_ptr, + png_const_charp error_msg); + void user_warning_fn(png_structp png_ptr, + png_const_charp warning_msg); + +The motivation behind using setjmp() and longjmp() is the C++ throw and +catch exception handling methods. This makes the code much easier to write, +as there is no need to check every return code of every function call. +However, there are some uncertainties about the status of local variables +after a longjmp, so the user may want to be careful about doing anything +after setjmp returns non-zero besides returning itself. Consult your +compiler documentation for more details. For an alternative approach, you +may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net). + +Custom chunks + +If you need to read or write custom chunks, you may need to get deeper +into the libpng code. The library now has mechanisms for storing +and writing chunks of unknown type; you can even declare callbacks +for custom chunks. However, this may not be good enough if the +library code itself needs to know about interactions between your +chunk and existing `intrinsic' chunks. + +If you need to write a new intrinsic chunk, first read the PNG +specification. Acquire a first level of understanding of how it works. +Pay particular attention to the sections that describe chunk names, +and look at how other chunks were designed, so you can do things +similarly. Second, check out the sections of libpng that read and +write chunks. Try to find a chunk that is similar to yours and use +it as a template. More details can be found in the comments inside +the code. It is best to handle unknown chunks in a generic method, +via callback functions, instead of by modifying libpng functions. + +If you wish to write your own transformation for the data, look through +the part of the code that does the transformations, and check out some of +the simpler ones to get an idea of how they work. Try to find a similar +transformation to the one you want to add and copy off of it. More details +can be found in the comments inside the code itself. + +Configuring for 16 bit platforms + +You will want to look into zconf.h to tell zlib (and thus libpng) that +it cannot allocate more then 64K at a time. Even if you can, the memory +won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K. + +Configuring for DOS + +For DOS users who only have access to the lower 640K, you will +have to limit zlib's memory usage via a png_set_compression_mem_level() +call. See zlib.h or zconf.h in the zlib library for more information. + +Configuring for Medium Model + +Libpng's support for medium model has been tested on most of the popular +compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets +defined, and FAR gets defined to far in pngconf.h, and you should be +all set. Everything in the library (except for zlib's structure) is +expecting far data. You must use the typedefs with the p or pp on +the end for pointers (or at least look at them and be careful). Make +note that the rows of data are defined as png_bytepp, which is an +unsigned char far * far *. + +Configuring for gui/windowing platforms: + +You will need to write new error and warning functions that use the GUI +interface, as described previously, and set them to be the error and +warning functions at the time that png_create_*_struct() is called, +in order to have them available during the structure initialization. +They can be changed later via png_set_error_fn(). On some compilers, +you may also have to change the memory allocators (png_malloc, etc.). + +Configuring for compiler xxx: + +All includes for libpng are in pngconf.h. If you need to add, change +or delete an include, this is the place to do it. +The includes that are not needed outside libpng are placed in pngpriv.h, +which is only used by the routines inside libpng itself. +The files in libpng proper only include pngpriv.h and png.h, which +in turn includes pngconf.h. + +Configuring zlib: + +There are special functions to configure the compression. Perhaps the +most useful one changes the compression level, which currently uses +input compression values in the range 0 - 9. The library normally +uses the default compression level (Z_DEFAULT_COMPRESSION = 6). Tests +have shown that for a large majority of images, compression values in +the range 3-6 compress nearly as well as higher levels, and do so much +faster. For online applications it may be desirable to have maximum speed +(Z_BEST_SPEED = 1). With versions of zlib after v0.99, you can also +specify no compression (Z_NO_COMPRESSION = 0), but this would create +files larger than just storing the raw bitmap. You can specify the +compression level by calling: + + png_set_compression_level(png_ptr, level); + +Another useful one is to reduce the memory level used by the library. +The memory level defaults to 8, but it can be lowered if you are +short on memory (running DOS, for example, where you only have 640K). +Note that the memory level does have an effect on compression; among +other things, lower levels will result in sections of incompressible +data being emitted in smaller stored blocks, with a correspondingly +larger relative overhead of up to 15% in the worst case. + + png_set_compression_mem_level(png_ptr, level); + +The other functions are for configuring zlib. They are not recommended +for normal use and may result in writing an invalid PNG file. See +zlib.h for more information on what these mean. + + png_set_compression_strategy(png_ptr, + strategy); + png_set_compression_window_bits(png_ptr, + window_bits); + png_set_compression_method(png_ptr, method); + png_set_compression_buffer_size(png_ptr, size); + +Controlling row filtering + +If you want to control whether libpng uses filtering or not, which +filters are used, and how it goes about picking row filters, you +can call one of these functions. The selection and configuration +of row filters can have a significant impact on the size and +encoding speed and a somewhat lesser impact on the decoding speed +of an image. Filtering is enabled by default for RGB and grayscale +images (with and without alpha), but not for paletted images nor +for any images with bit depths less than 8 bits/pixel. + +The 'method' parameter sets the main filtering method, which is +currently only '0' in the PNG 1.2 specification. The 'filters' +parameter sets which filter(s), if any, should be used for each +scanline. Possible values are PNG_ALL_FILTERS and PNG_NO_FILTERS +to turn filtering on and off, respectively. + +Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB, +PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise +ORed together with '|' to specify one or more filters to use. +These filters are described in more detail in the PNG specification. +If you intend to change the filter type during the course of writing +the image, you should start with flags set for all of the filters +you intend to use so that libpng can initialize its internal +structures appropriately for all of the filter types. (Note that this +means the first row must always be adaptively filtered, because libpng +currently does not allocate the filter buffers until png_write_row() +is called for the first time.) + + filters = PNG_FILTER_NONE | PNG_FILTER_SUB + PNG_FILTER_UP | PNG_FILTER_AVG | + PNG_FILTER_PAETH | PNG_ALL_FILTERS; + + png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, + filters); + The second parameter can also be + PNG_INTRAPIXEL_DIFFERENCING if you are + writing a PNG to be embedded in a MNG + datastream. This parameter must be the + same as the value of filter_method used + in png_set_IHDR(). + +It is also possible to influence how libpng chooses from among the +available filters. This is done in one or both of two ways - by +telling it how important it is to keep the same filter for successive +rows, and by telling it the relative computational costs of the filters. + + double weights[3] = {1.5, 1.3, 1.1}, + costs[PNG_FILTER_VALUE_LAST] = + {1.0, 1.3, 1.3, 1.5, 1.7}; + + png_set_filter_heuristics(png_ptr, + PNG_FILTER_HEURISTIC_WEIGHTED, 3, + weights, costs); + +The weights are multiplying factors that indicate to libpng that the +row filter should be the same for successive rows unless another row filter +is that many times better than the previous filter. In the above example, +if the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a +"sum of absolute differences" 1.5 x 1.3 times higher than other filters +and still be chosen, while the NONE filter could have a sum 1.1 times +higher than other filters and still be chosen. Unspecified weights are +taken to be 1.0, and the specified weights should probably be declining +like those above in order to emphasize recent filters over older filters. + +The filter costs specify for each filter type a relative decoding cost +to be considered when selecting row filters. This means that filters +with higher costs are less likely to be chosen over filters with lower +costs, unless their "sum of absolute differences" is that much smaller. +The costs do not necessarily reflect the exact computational speeds of +the various filters, since this would unduly influence the final image +size. + +Note that the numbers above were invented purely for this example and +are given only to help explain the function usage. Little testing has +been done to find optimum values for either the costs or the weights. + +Removing unwanted object code + +There are a bunch of #define's in pngconf.h that control what parts of +libpng are compiled. All the defines end in _SUPPORTED. If you are +never going to use a capability, you can change the #define to #undef +before recompiling libpng and save yourself code and data space, or +you can turn off individual capabilities with defines that begin with +PNG_NO_. + +You can also turn all of the transforms and ancillary chunk capabilities +off en masse with compiler directives that define +PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS, +or all four, +along with directives to turn on any of the capabilities that you do +want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable the extra +transformations but still leave the library fully capable of reading +and writing PNG files with all known public chunks. Use of the +PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive produces a library +that is incapable of reading or writing ancillary chunks. If you are +not using the progressive reading capability, you can turn that off +with PNG_NO_PROGRESSIVE_READ (don't confuse this with the INTERLACING +capability, which you'll still have). + +All the reading and writing specific code are in separate files, so the +linker should only grab the files it needs. However, if you want to +make sure, or if you are building a stand alone library, all the +reading files start with pngr and all the writing files start with +pngw. The files that don't match either (like png.c, pngtrans.c, etc.) +are used for both reading and writing, and always need to be included. +The progressive reader is in pngpread.c + +If you are creating or distributing a dynamically linked library (a .so +or DLL file), you should not remove or disable any parts of the library, +as this will cause applications linked with different versions of the +library to fail if they call functions not available in your library. +The size of the library itself should not be an issue, because only +those sections that are actually used will be loaded into memory. + +Requesting debug printout + +The macro definition PNG_DEBUG can be used to request debugging +printout. Set it to an integer value in the range 0 to 3. Higher +numbers result in increasing amounts of debugging information. The +information is printed to the "stderr" file, unless another file +name is specified in the PNG_DEBUG_FILE macro definition. + +When PNG_DEBUG > 0, the following functions (macros) become available: + + png_debug(level, message) + png_debug1(level, message, p1) + png_debug2(level, message, p1, p2) + +in which "level" is compared to PNG_DEBUG to decide whether to print +the message, "message" is the formatted string to be printed, +and p1 and p2 are parameters that are to be embedded in the string +according to printf-style formatting directives. For example, + + png_debug1(2, "foo=%d\n", foo); + +is expanded to + + if(PNG_DEBUG > 2) + fprintf(PNG_DEBUG_FILE, "foo=%d\n", foo); + +When PNG_DEBUG is defined but is zero, the macros aren't defined, but you +can still use PNG_DEBUG to control your own debugging: + + #ifdef PNG_DEBUG + fprintf(stderr, ... + #endif + +When PNG_DEBUG = 1, the macros are defined, but only png_debug statements +having level = 0 will be printed. There aren't any such statements in +this version of libpng, but if you insert some they will be printed. + +VI. MNG support + +The MNG specification (available at http://www.libpng.org/pub/mng) allows +certain extensions to PNG for PNG images that are embedded in MNG datastreams. +Libpng can support some of these extensions. To enable them, use the +png_permit_mng_features() function: + + feature_set = png_permit_mng_features(png_ptr, mask) + mask is a png_uint_32 containing the bitwise OR of the + features you want to enable. These include + PNG_FLAG_MNG_EMPTY_PLTE + PNG_FLAG_MNG_FILTER_64 + PNG_ALL_MNG_FEATURES + feature_set is a png_uint_32 that is the bitwise AND of + your mask with the set of MNG features that is + supported by the version of libpng that you are using. + +It is an error to use this function when reading or writing a standalone +PNG file with the PNG 8-byte signature. The PNG datastream must be wrapped +in a MNG datastream. As a minimum, it must have the MNG 8-byte signature +and the MHDR and MEND chunks. Libpng does not provide support for these +or any other MNG chunks; your application must provide its own support for +them. You may wish to consider using libmng (available at +http://www.libmng.com) instead. + +VII. Changes to Libpng from version 0.88 + +It should be noted that versions of libpng later than 0.96 are not +distributed by the original libpng author, Guy Schalnat, nor by +Andreas Dilger, who had taken over from Guy during 1996 and 1997, and +distributed versions 0.89 through 0.96, but rather by another member +of the original PNG Group, Glenn Randers-Pehrson. Guy and Andreas are +still alive and well, but they have moved on to other things. + +The old libpng functions png_read_init(), png_write_init(), +png_info_init(), png_read_destroy(), and png_write_destroy() have been +moved to PNG_INTERNAL in version 0.95 to discourage their use. These +functions will be removed from libpng version 2.0.0. + +The preferred method of creating and initializing the libpng structures is +via the png_create_read_struct(), png_create_write_struct(), and +png_create_info_struct() because they isolate the size of the structures +from the application, allow version error checking, and also allow the +use of custom error handling routines during the initialization, which +the old functions do not. The functions png_read_destroy() and +png_write_destroy() do not actually free the memory that libpng +allocated for these structs, but just reset the data structures, so they +can be used instead of png_destroy_read_struct() and +png_destroy_write_struct() if you feel there is too much system overhead +allocating and freeing the png_struct for each image read. + +Setting the error callbacks via png_set_message_fn() before +png_read_init() as was suggested in libpng-0.88 is no longer supported +because this caused applications that do not use custom error functions +to fail if the png_ptr was not initialized to zero. It is still possible +to set the error callbacks AFTER png_read_init(), or to change them with +png_set_error_fn(), which is essentially the same function, but with a new +name to force compilation errors with applications that try to use the old +method. + +Starting with version 1.0.7, you can find out which version of the library +you are using at run-time: + + png_uint_32 libpng_vn = png_access_version_number(); + +The number libpng_vn is constructed from the major version, minor +version with leading zero, and release number with leading zero, +(e.g., libpng_vn for version 1.0.7 is 10007). + +You can also check which version of png.h you used when compiling your +application: + + png_uint_32 application_vn = PNG_LIBPNG_VER; + +VIII. Changes to Libpng from version 1.0.x to 1.2.x + +Support for user memory management was enabled by default. To +accomplish this, the functions png_create_read_struct_2(), +png_create_write_struct_2(), png_set_mem_fn(), png_get_mem_ptr(), +png_malloc_default(), and png_free_default() were added. + +Support for the iTXt chunk has been enabled by default as of +version 1.2.41. + +Support for certain MNG features was enabled. + +Support for numbered error messages was added. However, we never got +around to actually numbering the error messages. The function +png_set_strip_error_numbers() was added (Note: the prototype for this +function was inadvertently removed from png.h in PNG_NO_ASSEMBLER_CODE +builds of libpng-1.2.15. It was restored in libpng-1.2.36). + +The png_malloc_warn() function was added at libpng-1.2.3. This issues +a png_warning and returns NULL instead of aborting when it fails to +acquire the requested memory allocation. + +Support for setting user limits on image width and height was enabled +by default. The functions png_set_user_limits(), png_get_user_width_max(), +and png_get_user_height_max() were added at libpng-1.2.6. + +The png_set_add_alpha() function was added at libpng-1.2.7. + +The function png_set_expand_gray_1_2_4_to_8() was added at libpng-1.2.9. +Unlike png_set_gray_1_2_4_to_8(), the new function does not expand the +tRNS chunk to alpha. The png_set_gray_1_2_4_to_8() function is +deprecated. + +A number of macro definitions in support of runtime selection of +assembler code features (especially Intel MMX code support) were +added at libpng-1.2.0: + + PNG_ASM_FLAG_MMX_SUPPORT_COMPILED + PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU + PNG_ASM_FLAG_MMX_READ_COMBINE_ROW + PNG_ASM_FLAG_MMX_READ_INTERLACE + PNG_ASM_FLAG_MMX_READ_FILTER_SUB + PNG_ASM_FLAG_MMX_READ_FILTER_UP + PNG_ASM_FLAG_MMX_READ_FILTER_AVG + PNG_ASM_FLAG_MMX_READ_FILTER_PAETH + PNG_ASM_FLAGS_INITIALIZED + PNG_MMX_READ_FLAGS + PNG_MMX_FLAGS + PNG_MMX_WRITE_FLAGS + PNG_MMX_FLAGS + +We added the following functions in support of runtime +selection of assembler code features: + + png_get_mmx_flagmask() + png_set_mmx_thresholds() + png_get_asm_flags() + png_get_mmx_bitdepth_threshold() + png_get_mmx_rowbytes_threshold() + png_set_asm_flags() + +We replaced all of these functions with simple stubs in libpng-1.2.20, +when the Intel assembler code was removed due to a licensing issue. + +These macros are deprecated: + + PNG_READ_TRANSFORMS_NOT_SUPPORTED + PNG_PROGRESSIVE_READ_NOT_SUPPORTED + PNG_NO_SEQUENTIAL_READ_SUPPORTED + PNG_WRITE_TRANSFORMS_NOT_SUPPORTED + PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED + PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED + +They have been replaced, respectively, by: + + PNG_NO_READ_TRANSFORMS + PNG_NO_PROGRESSIVE_READ + PNG_NO_SEQUENTIAL_READ + PNG_NO_WRITE_TRANSFORMS + PNG_NO_READ_ANCILLARY_CHUNKS + PNG_NO_WRITE_ANCILLARY_CHUNKS + +PNG_MAX_UINT was replaced with PNG_UINT_31_MAX. It has been +deprecated since libpng-1.0.16 and libpng-1.2.6. + +The function + png_check_sig(sig, num) +was replaced with + !png_sig_cmp(sig, 0, num) +It has been deprecated since libpng-0.90. + +The function + png_set_gray_1_2_4_to_8() +which also expands tRNS to alpha was replaced with + png_set_expand_gray_1_2_4_to_8() +which does not. It has been deprecated since libpng-1.0.18 and 1.2.9. + +IX. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x + +Private libpng prototypes and macro definitions were moved from +png.h and pngconf.h into a new pngpriv.h header file. + +Functions png_set_benign_errors(), png_benign_error(), and +png_chunk_benign_error() were added. + +Support for setting the maximum amount of memory that the application +will allocate for reading chunks was added, as a security measure. +The functions png_set_chunk_cache_max() and png_get_chunk_cache_max() +were added to the library. + +We implemented support for I/O states by adding png_ptr member io_state +and functions png_get_io_chunk_name() and png_get_io_state() in pngget.c + +We added PNG_TRANSFORM_GRAY_TO_RGB to the available high-level +input transforms. + +Checking for and reporting of errors in the IHDR chunk is more thorough. + +Support for global arrays was removed, to improve thread safety. + +Some obsolete/deprecated macros and functions have been removed. + +Typecasted NULL definitions such as + #define png_voidp_NULL (png_voidp)NULL +were eliminated. If you used these in your application, just use +NULL instead. + +The png_struct and info_struct members "trans" and "trans_values" were +changed to "trans_alpha" and "trans_color", respectively. + +The obsolete, unused pnggccrd.c and pngvcrd.c files and related makefiles +were removed. + +The PNG_1_0_X and PNG_1_2_X macros were eliminated. + +The PNG_LEGACY_SUPPORTED macro was eliminated. + +Many WIN32_WCE #ifdefs were removed. + +The functions png_read_init(info_ptr), png_write_init(info_ptr), +png_info_init(info_ptr), png_read_destroy(), and png_write_destroy() +have been removed. They have been deprecated since libpng-0.95. + +The png_permit_empty_plte() was removed. It has been deprecated +since libpng-1.0.9. Use png_permit_mng_features() instead. + +We removed the obsolete stub functions png_get_mmx_flagmask(), +png_set_mmx_thresholds(), png_get_asm_flags(), +png_get_mmx_bitdepth_threshold(), png_get_mmx_rowbytes_threshold(), +png_set_asm_flags(), and png_mmx_supported() + +We removed the obsolete png_check_sig(), png_memcpy_check(), and +png_memset_check() functions. Instead use !png_sig_cmp(), png_memcpy(), +and png_memset(), respectively. + +The function png_set_gray_1_2_4_to_8() was removed. It has been +deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with +png_set_expand_gray_1_2_4_to_8() because the former function also +expanded palette images. + +We changed the prototype for png_malloc() from + png_malloc(png_structp png_ptr, png_uint_32 size) +to + png_malloc(png_structp png_ptr, png_alloc_size_t size) + +This also applies to the prototype for the user replacement malloc_fn(). + +The png_calloc() function was added and is used in place of +of "png_malloc(); png_memset();" except in the case in png_read_png() +where the array consists of pointers; in this case a "for" loop is used +after the png_malloc() to set the pointers to NULL, to give robust. +behavior in case the application runs out of memory part-way through +the process. + +We changed the prototypes of png_get_compression_buffer_size() and +png_set_compression_buffer_size() to work with png_size_t instead of +png_uint_32. + +Support for numbered error messages was removed by default, since we +never got around to actually numbering the error messages. The function +png_set_strip_error_numbers() was removed from the library by default. + +The png_zalloc() and png_zfree() functions are no longer exported. +The png_zalloc() function no longer zeroes out the memory that it +allocates. + +Support for dithering was disabled by default in libpng-1.4.0, because +been well tested and doesn't actually "dither". The code was not +removed, however, and could be enabled by building libpng with +PNG_READ_DITHER_SUPPORTED defined. In libpng-1.4.2, this support +was reenabled, but the function was renamed png_set_quantize() to +reflect more accurately what it actually does. At the same time, +the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to +PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS. + +We removed the trailing '.' from the warning and error messages. + +X. Detecting libpng + +The png_get_io_ptr() function has been present since libpng-0.88, has never +changed, and is unaffected by conditional compilation macros. It is the +best choice for use in configure scripts for detecting the presence of any +libpng version since 0.88. In an autoconf "configure.in" you could use + + AC_CHECK_LIB(png, png_get_io_ptr, ... + +XI. Source code repository + +Since about February 2009, version 1.2.34, libpng has been under "git" source +control. The git repository was built from old libpng-x.y.z.tar.gz files +going back to version 0.70. You can access the git repository (read only) +at + + git://libpng.git.sourceforge.net/gitroot/libpng + +or you can browse it via "gitweb" at + + http://libpng.git.sourceforge.net/git/gitweb.cgi?p=libpng + +Patches can be sent to glennrp at users.sourceforge.net or to +png-mng-implement at lists.sourceforge.net or you can upload them to +the libpng bug tracker at + + http://libpng.sourceforge.net + +XII. Coding style + +Our coding style is similar to the "Allman" style, with curly +braces on separate lines: + + if (condition) + { + action; + } + + else if (another condition) + { + another action; + } + +The braces can be omitted from simple one-line actions: + + if (condition) + return (0); + +We use 3-space indentation, except for continued statements which +are usually indented the same as the first line of the statement +plus four more spaces. + +For macro definitions we use 2-space indentation, always leaving the "#" +in the first column. + + #ifndef PNG_NO_FEATURE + # ifndef PNG_FEATURE_SUPPORTED + # define PNG_FEATURE_SUPPORTED + # endif + #endif + +Comments appear with the leading "/*" at the same indentation as +the statement that follows the comment: + + /* Single-line comment */ + statement; + + /* This is a multiple-line + * comment. + */ + statement; + +Very short comments can be placed after the end of the statement +to which they pertain: + + statement; /* comment */ + +We don't use C++ style ("//") comments. We have, however, +used them in the past in some now-abandoned MMX assembler +code. + +Functions and their curly braces are not indented, and +exported functions are marked with PNGAPI: + + /* This is a public function that is visible to + * application programers. It does thus-and-so. + */ + void PNGAPI + png_exported_function(png_ptr, png_info, foo) + { + body; + } + +The prototypes for all exported functions appear in png.h, +above the comment that says + + /* Maintainer: Put new public prototypes here ... */ + +We mark all non-exported functions with "/* PRIVATE */"": + + void /* PRIVATE */ + png_non_exported_function(png_ptr, png_info, foo) + { + body; + } + +The prototypes for non-exported functions (except for those in +pngtest) appear in +pngpriv.h +above the comment that says + + /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ + +The names of all exported functions and variables begin +with "png_", and all publicly visible C preprocessor +macros begin with "PNG_". + +We put a space after each comma and after each semicolon +in "for" statments, and we put spaces before and after each +C binary operator and after "for" or "while", and before +"?". We don't put a space between a typecast and the expression +being cast, nor do we put one between a function name and the +left parenthesis that follows it: + + for (i = 2; i > 0; --i) + y[i] = a(x) + (int)b; + +We prefer #ifdef and #ifndef to #if defined() and if !defined() +when there is only one macro being tested. + +We do not use the TAB character for indentation in the C sources. + +Lines do not exceed 80 characters. + +Other rules can be inferred by inspecting the libpng source. + +XIII. Y2K Compliance in libpng + +June 26, 2010 + +Since the PNG Development group is an ad-hoc body, we can't make +an official declaration. + +This is your unofficial assurance that libpng from version 0.71 and +upward through 1.4.3 are Y2K compliant. It is my belief that earlier +versions were also Y2K compliant. + +Libpng only has three year fields. One is a 2-byte unsigned integer that +will hold years up to 65535. The other two hold the date in text +format, and will hold years up to 9999. + +The integer is + "png_uint_16 year" in png_time_struct. + +The strings are + "png_charp time_buffer" in png_struct and + "near_time_buffer", which is a local character string in png.c. + +There are seven time-related functions: + + png_convert_to_rfc_1123() in png.c + (formerly png_convert_to_rfc_1152() in error) + png_convert_from_struct_tm() in pngwrite.c, called + in pngwrite.c + png_convert_from_time_t() in pngwrite.c + png_get_tIME() in pngget.c + png_handle_tIME() in pngrutil.c, called in pngread.c + png_set_tIME() in pngset.c + png_write_tIME() in pngwutil.c, called in pngwrite.c + +All appear to handle dates properly in a Y2K environment. The +png_convert_from_time_t() function calls gmtime() to convert from system +clock time, which returns (year - 1900), which we properly convert to +the full 4-digit year. There is a possibility that applications using +libpng are not passing 4-digit years into the png_convert_to_rfc_1123() +function, or that they are incorrectly passing only a 2-digit year +instead of "year - 1900" into the png_convert_from_struct_tm() function, +but this is not under our control. The libpng documentation has always +stated that it works with 4-digit years, and the APIs have been +documented as such. + +The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned +integer to hold the year, and can hold years as large as 65535. + +zlib, upon which libpng depends, is also Y2K compliant. It contains +no date-related code. + + + Glenn Randers-Pehrson + libpng maintainer + PNG Development Group diff --git a/png/libpng-config.in b/png/libpng-config.in new file mode 100644 index 0000000..2987cef --- /dev/null +++ b/png/libpng-config.in @@ -0,0 +1,127 @@ +#! /bin/sh + +# libpng-config +# provides configuration info for libpng. + +# Copyright (C) 2002, 2004, 2006, 2007 Glenn Randers-Pehrson + +# This code is released under the libpng license. +# For conditions of distribution and use, see the disclaimer +# and license in png.h + +# Modeled after libxml-config. + +version="@PNGLIB_VERSION@" +prefix="@prefix@" +exec_prefix="@exec_prefix@" +libdir="@libdir@" +includedir="@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" +libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" +all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ @LIBS@" +I_opts="-I${includedir}" +L_opts="-L${libdir}" +R_opts="" +cppflags="" +ccopts="" +ldopts="" + +usage() +{ + cat <\fP + +\fI\fB + +\fBpng_uint_32 png_access_version_number \fI(void\fP\fB);\fP + +\fI\fB + +\fBvoid png_benign_error (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fIerror\fP\fB);\fP + +\fI\fB + +\fBvoid png_chunk_benign_error (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fIerror\fP\fB);\fP + +\fI\fB + +\fBvoid png_chunk_error (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fIerror\fP\fB);\fP + +\fI\fB + +\fBvoid png_chunk_warning (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fImessage\fP\fB);\fP + +\fI\fB + +\fBvoid png_convert_from_struct_tm (png_timep \fP\fIptime\fP\fB, struct tm FAR * \fIttime\fP\fB);\fP + +\fI\fB + +\fBvoid png_convert_from_time_t (png_timep \fP\fIptime\fP\fB, time_t \fIttime\fP\fB);\fP + +\fI\fB + +\fBpng_charp png_convert_to_rfc1123 (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fIptime\fP\fB);\fP + +\fI\fB + +\fBpng_infop png_create_info_struct (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_structp png_create_read_struct (png_const_charp \fP\fIuser_png_ver\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fIwarn_fn\fP\fB);\fP + +\fI\fB + +\fBpng_structp png_create_read_struct_2(png_const_charp \fP\fIuser_png_ver\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fP\fIwarn_fn\fP\fB, png_voidp \fP\fImem_ptr\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_free_ptr \fIfree_fn\fP\fB);\fP + +\fI\fB + +\fBpng_structp png_create_write_struct (png_const_charp \fP\fIuser_png_ver\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fIwarn_fn\fP\fB);\fP + +\fI\fB + +\fBpng_structp png_create_write_struct_2(png_const_charp \fP\fIuser_png_ver\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fP\fIwarn_fn\fP\fB, png_voidp \fP\fImem_ptr\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_free_ptr \fIfree_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_destroy_info_struct (png_structp \fP\fIpng_ptr\fP\fB, png_infopp \fIinfo_ptr_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_destroy_read_struct (png_structpp \fP\fIpng_ptr_ptr\fP\fB, png_infopp \fP\fIinfo_ptr_ptr\fP\fB, png_infopp \fIend_info_ptr_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_destroy_write_struct (png_structpp \fP\fIpng_ptr_ptr\fP\fB, png_infopp \fIinfo_ptr_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_error (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fIerror\fP\fB);\fP + +\fI\fB + +\fBvoid png_free (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fIptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_free_chunk_list (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_free_default(png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fIptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_free_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fInum\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_bit_depth (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_16p \fI*background\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_channels (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, double \fP\fI*white_x\fP\fB, double \fP\fI*white_y\fP\fB, double \fP\fI*red_x\fP\fB, double \fP\fI*red_y\fP\fB, double \fP\fI*green_x\fP\fB, double \fP\fI*green_y\fP\fB, double \fP\fI*blue_x\fP\fB, double \fI*blue_y\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*white_x\fP\fB, png_uint_32 \fP\fI*white_y\fP\fB, png_uint_32 \fP\fI*red_x\fP\fB, png_uint_32 \fP\fI*red_y\fP\fB, png_uint_32 \fP\fI*green_x\fP\fB, png_uint_32 \fP\fI*green_y\fP\fB, png_uint_32 \fP\fI*blue_x\fP\fB, png_uint_32 \fI*blue_y\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_chunk_cache_max (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_color_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_compression_buffer_size (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_compression_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_copyright (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_voidp png_get_error_ptr (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_filter_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, double \fI*file_gamma\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fI*int_file_gamma\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_header_ver (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_header_version (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fI*hist\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_charpp \fP\fIname\fP\fB, int \fP\fI*compression_type\fP\fB, png_charpp \fP\fIprofile\fP\fB, png_uint_32 \fI*proflen\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*width\fP\fB, png_uint_32 \fP\fI*height\fP\fB, int \fP\fI*bit_depth\fP\fB, int \fP\fI*color_type\fP\fB, int \fP\fI*interlace_type\fP\fB, int \fP\fI*compression_type\fP\fB, int \fI*filter_type\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_image_height (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_image_width (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_int_32 png_get_int_32 (png_bytep \fIbuf\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_interlace_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_voidp png_get_io_ptr (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_libpng_ver (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_alloc_size_t png_get_chunk_malloc_max (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_voidp png_get_mem_ptr(png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*offset_x\fP\fB, png_uint_32 \fP\fI*offset_y\fP\fB, int \fI*unit_type\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_charp \fP\fI*purpose\fP\fB, png_int_32 \fP\fI*X0\fP\fB, png_int_32 \fP\fI*X1\fP\fB, int \fP\fI*type\fP\fB, int \fP\fI*nparams\fP\fB, png_charp \fP\fI*units\fP\fB, png_charpp \fI*params\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*res_x\fP\fB, png_uint_32 \fP\fI*res_y\fP\fB, int \fI*unit_type\fP\fB);\fP + +\fI\fB + +\fBfloat png_get_pixel_aspect_ratio (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_pixels_per_meter (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_voidp png_get_progressive_ptr (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_colorp \fP\fI*palette\fP\fB, int \fI*num_palette\fP\fB);\fP + +\fI\fB + +\fBpng_byte png_get_rgb_to_gray_status (png_structp \fIpng_ptr) + +\fBpng_uint_32 png_get_rowbytes (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_bytepp png_get_rows (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_8p \fI*sig_bit\fP\fB);\fP + +\fI\fB + +\fBpng_bytep png_get_signature (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fI*splt_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fI*intent\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_text (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fI*text_ptr\fP\fB, int \fI*num_text\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_timep \fI*mod_time\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fI*trans\fP\fB, int \fP\fI*num_trans\fP\fB, png_color_16p \fI*trans_color\fP\fB);\fP + +\fI\fB + +\fB/* This function is really an inline macro. \fI*/ + +\fBpng_uint_16 png_get_uint_16 (png_bytep \fIbuf\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_uint_31 (png_bytep \fIbuf\fP\fB);\fP + +\fI\fB + +\fB/* This function is really an inline macro. \fI*/ + +\fBpng_uint_32 png_get_uint_32 (png_bytep \fIbuf\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_unknown_chunks (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_unknown_chunkpp \fIunknowns\fP\fB);\fP + +\fI\fB + +\fBpng_voidp png_get_user_chunk_ptr (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_user_height_max( png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_voidp png_get_user_transform_ptr (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_user_width_max (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_valid (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIflag\fP\fB);\fP + +\fI\fB + +\fBpng_int_32 png_get_x_offset_microns (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_int_32 png_get_x_offset_pixels (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_x_pixels_per_meter (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_int_32 png_get_y_offset_microns (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_int_32 png_get_y_offset_pixels (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_get_y_pixels_per_meter (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBint png_handle_as_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP + +\fI\fB + +\fBvoid png_init_io (png_structp \fP\fIpng_ptr\fP\fB, FILE \fI*fp\fP\fB);\fP + +\fI\fB + +\fBpng_voidp png_malloc (png_structp \fP\fIpng_ptr\fP\fB, png_alloc_size_t \fIsize\fP\fB);\fP + +\fI\fB + +\fBpng_voidp png_malloc_default(png_structp \fP\fIpng_ptr\fP\fB, png_alloc_size_t \fIsize\fP\fB);\fP + +\fI\fB + +\fBvoidp png_memcpy (png_voidp \fP\fIs1\fP\fB, png_voidp \fP\fIs2\fP\fB, png_size_t \fIsize\fP\fB);\fP + +\fI\fB + +\fBvoidp png_memset (png_voidp \fP\fIs1\fP\fB, int \fP\fIvalue\fP\fB, png_size_t \fIsize\fP\fB);\fP + +\fI\fB + +\fBvoid png_process_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_size\fP\fB);\fP + +\fI\fB + +\fBvoid png_progressive_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIold_row\fP\fB, png_bytep \fInew_row\fP\fB);\fP + +\fI\fB + +\fBvoid png_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_read_image (png_structp \fP\fIpng_ptr\fP\fB, png_bytepp \fIimage\fP\fB);\fP + +\fI\fB + +\fBvoid png_read_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_read_png (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fP\fItransforms\fP\fB, png_voidp \fIparams\fP\fB);\fP + +\fI\fB + +\fBvoid png_read_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fIdisplay_row\fP\fB);\fP + +\fI\fB + +\fBvoid png_read_rows (png_structp \fP\fIpng_ptr\fP\fB, png_bytepp \fP\fIrow\fP\fB, png_bytepp \fP\fIdisplay_row\fP\fB, png_uint_32 \fInum_rows\fP\fB);\fP + +\fI\fB + +\fBvoid png_read_update_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_save_int_32 (png_bytep \fP\fIbuf\fP\fB, png_int_32 \fIi\fP\fB);\fP + +\fI\fB + +\fBvoid png_save_uint_16 (png_bytep \fP\fIbuf\fP\fB, unsigned int \fIi\fP\fB);\fP + +\fI\fB + +\fBvoid png_save_uint_32 (png_bytep \fP\fIbuf\fP\fB, png_uint_32 \fIi\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_add_alpha (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, int \fIflags\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_background (png_structp \fP\fIpng_ptr\fP\fB, png_color_16p \fP\fIbackground_color\fP\fB, int \fP\fIbackground_gamma_code\fP\fB, int \fP\fIneed_expand\fP\fB, double \fIbackground_gamma\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_bgr (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_16p \fIbackground\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_chunk_cache_max (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIuser_chunk_cache_max\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_compression_level (png_structp \fP\fIpng_ptr\fP\fB, int \fIlevel\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_compression_mem_level (png_structp \fP\fIpng_ptr\fP\fB, int \fImem_level\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_compression_method (png_structp \fP\fIpng_ptr\fP\fB, int \fImethod\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_compression_strategy (png_structp \fP\fIpng_ptr\fP\fB, int \fIstrategy\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_compression_window_bits (png_structp \fP\fIpng_ptr\fP\fB, int \fIwindow_bits\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_crc_action (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcrit_action\fP\fB, int \fIancil_action\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_error_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fIwarning_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_expand (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_expand_gray_1_2_4_to_8(png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_filler (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, int \fIflags\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_filter (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fImethod\fP\fB, int \fIfilters\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_filter_heuristics (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIheuristic_method\fP\fB, int \fP\fInum_weights\fP\fB, png_doublep \fP\fIfilter_weights\fP\fB, png_doublep \fIfilter_costs\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_flush (png_structp \fP\fIpng_ptr\fP\fB, int \fInrows\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_gamma (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIscreen_gamma\fP\fB, double \fIdefault_file_gamma\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIfile_gamma\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_gray_1_2_4_to_8(png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_gray_to_rgb (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fIhist\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, png_uint_32 \fIproflen\fP\fB);\fP + +\fI\fB + +\fBint png_set_interlace_handling (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_invalid (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fImask\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_invert_alpha (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_invert_mono (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIinterlace_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fIfilter_type\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_keep_unknown_chunks (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIkeep\fP\fB, png_bytep \fP\fIchunk_list\fP\fB, int \fInum_chunks\fP\fB);\fP + +\fI\fB + +\fBjmp_buf* png_set_longjmp_fn (png_structp \fP\fIpng_ptr\fP\fB, png_longjmp_ptr \fP\fIlongjmp_fn\fP\fB, size_t \fIjmp_buf_size\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_chunk_malloc_max (png_structp \fP\fIpng_ptr\fP\fB, png_alloc_size_t \fIuser_chunk_cache_max\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_mem_fn(png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fImem_ptr\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_free_ptr \fIfree_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fIoffset_x\fP\fB, png_uint_32 \fP\fIoffset_y\fP\fB, int \fIunit_type\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_packing (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_packswap (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_palette_to_rgb(png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fIres_x\fP\fB, png_uint_32 \fP\fIres_y\fP\fB, int \fIunit_type\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_progressive_read_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIprogressive_ptr\fP\fB, png_progressive_info_ptr \fP\fIinfo_fn\fP\fB, png_progressive_row_ptr \fP\fIrow_fn\fP\fB, png_progressive_end_ptr \fIend_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_quantize (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fP\fInum_palette\fP\fB, int \fP\fImaximum_colors\fP\fB, png_uint_16p \fP\fIhistogram\fP\fB, int \fIfull_quantize\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_read_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIio_ptr\fP\fB, png_rw_ptr \fIread_data_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_read_status_fn (png_structp \fP\fIpng_ptr\fP\fB, png_read_status_ptr \fIread_row_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_read_user_transform_fn (png_structp \fP\fIpng_ptr\fP\fB, png_user_transform_ptr \fIread_user_transform_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_rgb_to_gray (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIerror_action\fP\fB, double \fP\fIred\fP\fB, double \fIgreen\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_rgb_to_gray_fixed (png_structp \fP\fIpng_ptr\fP\fB, int error_action png_fixed_point \fP\fIred\fP\fB, png_fixed_point \fIgreen\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_rows (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytepp \fIrow_pointers\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_8p \fIsig_bit\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_shift (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fItrue_bits\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_sig_bytes (png_structp \fP\fIpng_ptr\fP\fB, int \fInum_bytes\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fP\fIsplt_ptr\fP\fB, int \fInum_spalettes\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fIintent\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_sRGB_gAMA_and_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fIintent\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_strip_16 (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_strip_alpha (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_swap (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_swap_alpha (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_text (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fP\fInum_trans\fP\fB, png_color_16p \fItrans_color\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_tRNS_to_alpha(png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBpng_uint_32 png_set_unknown_chunks (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_unknown_chunkp \fP\fIunknowns\fP\fB, int \fP\fInum\fP\fB, int \fIlocation\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_unknown_chunk_location(png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fP\fIchunk\fP\fB, int \fIlocation\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_read_user_chunk_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIuser_chunk_ptr\fP\fB, png_user_chunk_ptr \fIread_user_chunk_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_user_limits (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIuser_width_max\fP\fB, png_uint_32 \fIuser_height_max\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_user_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIuser_transform_ptr\fP\fB, int \fP\fIuser_transform_depth\fP\fB, int \fIuser_transform_channels\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_write_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIio_ptr\fP\fB, png_rw_ptr \fP\fIwrite_data_fn\fP\fB, png_flush_ptr \fIoutput_flush_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_write_status_fn (png_structp \fP\fIpng_ptr\fP\fB, png_write_status_ptr \fIwrite_row_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_write_user_transform_fn (png_structp \fP\fIpng_ptr\fP\fB, png_user_transform_ptr \fIwrite_user_transform_fn\fP\fB);\fP + +\fI\fB + +\fBvoid png_set_compression_buffer_size(png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIsize\fP\fB);\fP + +\fI\fB + +\fBint png_sig_cmp (png_bytep \fP\fIsig\fP\fB, png_size_t \fP\fIstart\fP\fB, png_size_t \fInum_to_check\fP\fB);\fP + +\fI\fB + +\fBvoid png_start_read_image (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_warning (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fImessage\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIchunk_name\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_chunk_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_chunk_end (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_chunk_start (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIchunk_name\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_flush (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_image (png_structp \fP\fIpng_ptr\fP\fB, png_bytepp \fIimage\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_info_before_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_png (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fP\fItransforms\fP\fB, png_voidp \fIparams\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_rows (png_structp \fP\fIpng_ptr\fP\fB, png_bytepp \fP\fIrow\fP\fB, png_uint_32 \fInum_rows\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP + +\fI\fB + +\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP + +\fI\fB + +.SH DESCRIPTION +The +.I libpng +library supports encoding, decoding, and various manipulations of +the Portable Network Graphics (PNG) format image files. It uses the +.IR zlib(3) +compression library. +Following is a copy of the libpng.txt file that accompanies libpng. +.SH LIBPNG.TXT +libpng.txt - A description on how to use and modify libpng + + libpng version 1.4.3 - June 26, 2010 + Updated and distributed by Glenn Randers-Pehrson + + Copyright (c) 1998-2009 Glenn Randers-Pehrson + + This document is released under the libpng license. + For conditions of distribution and use, see the disclaimer + and license in png.h + + Based on: + + libpng versions 0.97, January 1998, through 1.4.3 - June 26, 2010 + Updated and distributed by Glenn Randers-Pehrson + Copyright (c) 1998-2009 Glenn Randers-Pehrson + + libpng 1.0 beta 6 version 0.96 May 28, 1997 + Updated and distributed by Andreas Dilger + Copyright (c) 1996, 1997 Andreas Dilger + + libpng 1.0 beta 2 - version 0.88 January 26, 1996 + For conditions of distribution and use, see copyright + notice in png.h. Copyright (c) 1995, 1996 Guy Eric + Schalnat, Group 42, Inc. + + Updated/rewritten per request in the libpng FAQ + Copyright (c) 1995, 1996 Frank J. T. Wojcik + December 18, 1995 & January 20, 1996 + +.SH I. Introduction + +This file describes how to use and modify the PNG reference library +(known as libpng) for your own use. There are five sections to this +file: introduction, structures, reading, writing, and modification and +configuration notes for various special platforms. In addition to this +file, example.c is a good starting point for using the library, as +it is heavily commented and should include everything most people +will need. We assume that libpng is already installed; see the +INSTALL file for instructions on how to install libpng. + +For examples of libpng usage, see the files "example.c", "pngtest.c", +and the files in the "contrib" directory, all of which are included in +the libpng distribution. + +Libpng was written as a companion to the PNG specification, as a way +of reducing the amount of time and effort it takes to support the PNG +file format in application programs. + +The PNG specification (second edition), November 2003, is available as +a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at +. It is technically equivalent +to the PNG specification (second edition) but has some additional material. + +The PNG-1.0 specification is available +as RFC 2083 and as a +W3C Recommendation . + +Some additional chunks are described in the special-purpose public chunks +documents at . + +Other information +about PNG, and the latest version of libpng, can be found at the PNG home +page, . + +Most users will not have to modify the library significantly; advanced +users may want to modify it more. All attempts were made to make it as +complete as possible, while keeping the code easy to understand. +Currently, this library only supports C. Support for other languages +is being considered. + +Libpng has been designed to handle multiple sessions at one time, +to be easily modifiable, to be portable to the vast majority of +machines (ANSI, K&R, 16-, 32-, and 64-bit) available, and to be easy +to use. The ultimate goal of libpng is to promote the acceptance of +the PNG file format in whatever way possible. While there is still +work to be done (see the TODO file), libpng should cover the +majority of the needs of its users. + +Libpng uses zlib for its compression and decompression of PNG files. +Further information about zlib, and the latest version of zlib, can +be found at the zlib home page, . +The zlib compression utility is a general purpose utility that is +useful for more than PNG files, and can be used without libpng. +See the documentation delivered with zlib for more details. +You can usually find the source files for the zlib utility wherever you +find the libpng source files. + +Libpng is thread safe, provided the threads are using different +instances of the structures. Each thread should have its own +png_struct and png_info instances, and thus its own image. +Libpng does not protect itself against two threads using the +same instance of a structure. + +.SH II. Structures + +There are two main structures that are important to libpng, png_struct +and png_info. The first, png_struct, is an internal structure that +will not, for the most part, be used by a user except as the first +variable passed to every libpng function call. + +The png_info structure is designed to provide information about the +PNG file. At one time, the fields of png_info were intended to be +directly accessible to the user. However, this tended to cause problems +with applications using dynamically loaded libraries, and as a result +a set of interface functions for png_info (the png_get_*() and png_set_*() +functions) was developed. The fields of png_info are still available for +older applications, but it is suggested that applications use the new +interfaces if at all possible. + +Applications that do make direct access to the members of png_struct (except +for png_ptr->jmpbuf) must be recompiled whenever the library is updated, +and applications that make direct access to the members of png_info must +be recompiled if they were compiled or loaded with libpng version 1.0.6, +in which the members were in a different order. In version 1.0.7, the +members of the png_info structure reverted to the old order, as they were +in versions 0.97c through 1.0.5. Starting with version 2.0.0, both +structures are going to be hidden, and the contents of the structures will +only be accessible through the png_get/png_set functions. + +The png.h header file is an invaluable reference for programming with libpng. +And while I'm on the topic, make sure you include the libpng header file: + +#include + +.SH III. Reading + +We'll now walk you through the possible functions to call when reading +in a PNG file sequentially, briefly explaining the syntax and purpose +of each one. See example.c and png.h for more detail. While +progressive reading is covered in the next section, you will still +need some of the functions discussed in this section to read a PNG +file. + +.SS Setup + +You will want to do the I/O initialization(*) before you get into libpng, +so if it doesn't work, you don't have much to undo. Of course, you +will also want to insure that you are, in fact, dealing with a PNG +file. Libpng provides a simple check to see if a file is a PNG file. +To use it, pass in the first 1 to 8 bytes of the file to the function +png_sig_cmp(), and it will return 0 (false) if the bytes match the +corresponding bytes of the PNG signature, or nonzero (true) otherwise. +Of course, the more bytes you pass in, the greater the accuracy of the +prediction. + +If you are intending to keep the file pointer open for use in libpng, +you must ensure you don't read more than 8 bytes from the beginning +of the file, and you also have to make a call to png_set_sig_bytes_read() +with the number of bytes you read from the beginning. Libpng will +then only check the bytes (if any) that your program didn't read. + +(*): If you are not using the standard I/O functions, you will need +to replace them with custom functions. See the discussion under +Customizing libpng. + + + FILE *fp = fopen(file_name, "rb"); + if (!fp) + { + return (ERROR); + } + fread(header, 1, number, fp); + is_png = !png_sig_cmp(header, 0, number); + if (!is_png) + { + return (NOT_PNG); + } + + +Next, png_struct and png_info need to be allocated and initialized. In +order to ensure that the size of these structures is correct even with a +dynamically linked libpng, there are functions to initialize and +allocate the structures. We also pass the library version, optional +pointers to error handling functions, and a pointer to a data struct for +use by the error functions, if necessary (the pointer and functions can +be NULL if the default error handlers are to be used). See the section +on Changes to Libpng below regarding the old initialization functions. +The structure allocation functions quietly return NULL if they fail to +create the structure, so your application should check for that. + + png_structp png_ptr = png_create_read_struct + (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, + user_error_fn, user_warning_fn); + if (!png_ptr) + return (ERROR); + + png_infop info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + { + png_destroy_read_struct(&png_ptr, + (png_infopp)NULL, (png_infopp)NULL); + return (ERROR); + } + + png_infop end_info = png_create_info_struct(png_ptr); + if (!end_info) + { + png_destroy_read_struct(&png_ptr, &info_ptr, + (png_infopp)NULL); + return (ERROR); + } + +If you want to use your own memory allocation routines, +define PNG_USER_MEM_SUPPORTED and use +png_create_read_struct_2() instead of png_create_read_struct(): + + png_structp png_ptr = png_create_read_struct_2 + (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, + user_error_fn, user_warning_fn, (png_voidp) + user_mem_ptr, user_malloc_fn, user_free_fn); + +The error handling routines passed to png_create_read_struct() +and the memory alloc/free routines passed to png_create_struct_2() +are only necessary if you are not using the libpng supplied error +handling and memory alloc/free functions. + +When libpng encounters an error, it expects to longjmp back +to your routine. Therefore, you will need to call setjmp and pass +your png_jmpbuf(png_ptr). If you read the file from different +routines, you will need to update the jmpbuf field every time you enter +a new routine that will call a png_*() function. + +See your documentation of setjmp/longjmp for your compiler for more +information on setjmp/longjmp. See the discussion on libpng error +handling in the Customizing Libpng section below for more information +on the libpng error handling. If an error occurs, and libpng longjmp's +back to your setjmp, you will want to call png_destroy_read_struct() to +free any memory. + + if (setjmp(png_jmpbuf(png_ptr))) + { + png_destroy_read_struct(&png_ptr, &info_ptr, + &end_info); + fclose(fp); + return (ERROR); + } + +If you would rather avoid the complexity of setjmp/longjmp issues, +you can compile libpng with PNG_NO_SETJMP, in which case +errors will result in a call to PNG_ABORT() which defaults to abort(). + +You can #define PNG_ABORT() to a function that does something +more useful than abort(), as long as your function does not +return. + +Now you need to set up the input code. The default for libpng is to +use the C function fread(). If you use this, you will need to pass a +valid FILE * in the function png_init_io(). Be sure that the file is +opened in binary mode. If you wish to handle reading data in another +way, you need not call the png_init_io() function, but you must then +implement the libpng I/O methods discussed in the Customizing Libpng +section below. + + png_init_io(png_ptr, fp); + +If you had previously opened the file and read any of the signature from +the beginning in order to see if this was a PNG file, you need to let +libpng know that there are some bytes missing from the start of the file. + + png_set_sig_bytes(png_ptr, number); + +You can change the zlib compression buffer size to be used while +reading compressed data with + + png_set_compression_buffer_size(png_ptr, buffer_size); + +where the default size is 8192 bytes. Note that the buffer size +is changed immediately and the buffer is reallocated immediately, +instead of setting a flag to be acted upon later. + +.SS Setting up callback code + +You can set up a callback function to handle any unknown chunks in the +input stream. You must supply the function + + read_chunk_callback(png_ptr ptr, + png_unknown_chunkp chunk); + { + /* The unknown chunk structure contains your + chunk data, along with similar data for any other + unknown chunks: */ + + png_byte name[5]; + png_byte *data; + png_size_t size; + + /* Note that libpng has already taken care of + the CRC handling */ + + /* put your code here. Search for your chunk in the + unknown chunk structure, process it, and return one + of the following: */ + + return (-n); /* chunk had an error */ + return (0); /* did not recognize */ + return (n); /* success */ + } + +(You can give your function another name that you like instead of +"read_chunk_callback") + +To inform libpng about your function, use + + png_set_read_user_chunk_fn(png_ptr, user_chunk_ptr, + read_chunk_callback); + +This names not only the callback function, but also a user pointer that +you can retrieve with + + png_get_user_chunk_ptr(png_ptr); + +If you call the png_set_read_user_chunk_fn() function, then all unknown +chunks will be saved when read, in case your callback function will need +one or more of them. This behavior can be changed with the +png_set_keep_unknown_chunks() function, described below. + +At this point, you can set up a callback function that will be +called after each row has been read, which you can use to control +a progress meter or the like. It's demonstrated in pngtest.c. +You must supply a function + + void read_row_callback(png_ptr ptr, png_uint_32 row, + int pass); + { + /* put your code here */ + } + +(You can give it another name that you like instead of "read_row_callback") + +To inform libpng about your function, use + + png_set_read_status_fn(png_ptr, read_row_callback); + +.SS Unknown-chunk handling + +Now you get to set the way the library processes unknown chunks in the +input PNG stream. Both known and unknown chunks will be read. Normal +behavior is that known chunks will be parsed into information in +various info_ptr members while unknown chunks will be discarded. This +behavior can be wasteful if your application will never use some known +chunk types. To change this, you can call: + + png_set_keep_unknown_chunks(png_ptr, keep, + chunk_list, num_chunks); + keep - 0: default unknown chunk handling + 1: ignore; do not keep + 2: keep only if safe-to-copy + 3: keep even if unsafe-to-copy + You can use these definitions: + PNG_HANDLE_CHUNK_AS_DEFAULT 0 + PNG_HANDLE_CHUNK_NEVER 1 + PNG_HANDLE_CHUNK_IF_SAFE 2 + PNG_HANDLE_CHUNK_ALWAYS 3 + chunk_list - list of chunks affected (a byte string, + five bytes per chunk, NULL or '\0' if + num_chunks is 0) + num_chunks - number of chunks affected; if 0, all + unknown chunks are affected. If nonzero, + only the chunks in the list are affected + +Unknown chunks declared in this way will be saved as raw data onto a +list of png_unknown_chunk structures. If a chunk that is normally +known to libpng is named in the list, it will be handled as unknown, +according to the "keep" directive. If a chunk is named in successive +instances of png_set_keep_unknown_chunks(), the final instance will +take precedence. The IHDR and IEND chunks should not be named in +chunk_list; if they are, libpng will process them normally anyway. + +Here is an example of the usage of png_set_keep_unknown_chunks(), +where the private "vpAg" chunk will later be processed by a user chunk +callback function: + + png_byte vpAg[5]={118, 112, 65, 103, (png_byte) '\0'}; + + #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) + png_byte unused_chunks[]= + { + 104, 73, 83, 84, (png_byte) '\0', /* hIST */ + 105, 84, 88, 116, (png_byte) '\0', /* iTXt */ + 112, 67, 65, 76, (png_byte) '\0', /* pCAL */ + 115, 67, 65, 76, (png_byte) '\0', /* sCAL */ + 115, 80, 76, 84, (png_byte) '\0', /* sPLT */ + 116, 73, 77, 69, (png_byte) '\0', /* tIME */ + }; + #endif + + ... + + #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) + /* ignore all unknown chunks: */ + png_set_keep_unknown_chunks(read_ptr, 1, NULL, 0); + /* except for vpAg: */ + png_set_keep_unknown_chunks(read_ptr, 2, vpAg, 1); + /* also ignore unused known chunks: */ + png_set_keep_unknown_chunks(read_ptr, 1, unused_chunks, + (int)sizeof(unused_chunks)/5); + #endif + +.SS User limits + +The PNG specification allows the width and height of an image to be as +large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns. +Since very few applications really need to process such large images, +we have imposed an arbitrary 1-million limit on rows and columns. +Larger images will be rejected immediately with a png_error() call. If +you wish to override this limit, you can use + + png_set_user_limits(png_ptr, width_max, height_max); + +to set your own limits, or use width_max = height_max = 0x7fffffffL +to allow all valid dimensions (libpng may reject some very large images +anyway because of potential buffer overflow conditions). + +You should put this statement after you create the PNG structure and +before calling png_read_info(), png_read_png(), or png_process_data(). +If you need to retrieve the limits that are being applied, use + + width_max = png_get_user_width_max(png_ptr); + height_max = png_get_user_height_max(png_ptr); + +The PNG specification sets no limit on the number of ancillary chunks +allowed in a PNG datastream. You can impose a limit on the total number +of sPLT, tEXt, iTXt, zTXt, and unknown chunks that will be stored, with + + png_set_chunk_cache_max(png_ptr, user_chunk_cache_max); + +where 0x7fffffffL means unlimited. You can retrieve this limit with + + chunk_cache_max = png_get_chunk_cache_max(png_ptr); + +This limit also applies to the number of buffers that can be allocated +by png_decompress_chunk() while decompressing iTXt, zTXt, and iCCP chunks. + +You can also set a limit on the amount of memory that a compressed chunk +other than IDAT can occupy, with + + png_set_chunk_malloc_max(png_ptr, user_chunk_malloc_max); + +and you can retrieve the limit with + + chunk_malloc_max = png_get_chunk_malloc_max(png_ptr); + +Any chunks that would cause either of these limits to be exceeded will +be ignored. + +.SS The high-level read interface + +At this point there are two ways to proceed; through the high-level +read interface, or through a sequence of low-level read operations. +You can use the high-level interface if (a) you are willing to read +the entire image into memory, and (b) the input transformations +you want to do are limited to the following set: + + PNG_TRANSFORM_IDENTITY No transformation + PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to + 8 bits + PNG_TRANSFORM_STRIP_ALPHA Discard the alpha channel + PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit + samples to bytes + PNG_TRANSFORM_PACKSWAP Change order of packed + pixels to LSB first + PNG_TRANSFORM_EXPAND Perform set_expand() + PNG_TRANSFORM_INVERT_MONO Invert monochrome images + PNG_TRANSFORM_SHIFT Normalize pixels to the + sBIT depth + PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA + to BGRA + PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA + to AG + PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity + to transparency + PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples + PNG_TRANSFORM_GRAY_TO_RGB Expand grayscale samples + to RGB (or GA to RGBA) + +(This excludes setting a background color, doing gamma transformation, +quantizing, and setting filler.) If this is the case, simply do this: + + png_read_png(png_ptr, info_ptr, png_transforms, NULL) + +where png_transforms is an integer containing the bitwise OR of some +set of transformation flags. This call is equivalent to png_read_info(), +followed the set of transformations indicated by the transform mask, +then png_read_image(), and finally png_read_end(). + +(The final parameter of this call is not yet used. Someday it might point +to transformation parameters required by some future input transform.) + +You must use png_transforms and not call any png_set_transform() functions +when you use png_read_png(). + +After you have called png_read_png(), you can retrieve the image data +with + + row_pointers = png_get_rows(png_ptr, info_ptr); + +where row_pointers is an array of pointers to the pixel data for each row: + + png_bytep row_pointers[height]; + +If you know your image size and pixel size ahead of time, you can allocate +row_pointers prior to calling png_read_png() with + + if (height > PNG_UINT_32_MAX/png_sizeof(png_byte)) + png_error (png_ptr, + "Image is too tall to process in memory"); + if (width > PNG_UINT_32_MAX/pixel_size) + png_error (png_ptr, + "Image is too wide to process in memory"); + row_pointers = png_malloc(png_ptr, + height*png_sizeof(png_bytep)); + for (int i=0; i) and +png_get_(png_ptr, info_ptr, ...) functions return non-zero if the +data has been read, or zero if it is missing. The parameters to the +png_get_ are set directly if they are simple data types, or a +pointer into the info_ptr is returned for any complex types. + + png_get_PLTE(png_ptr, info_ptr, &palette, + &num_palette); + palette - the palette for the file + (array of png_color) + num_palette - number of entries in the palette + + png_get_gAMA(png_ptr, info_ptr, &gamma); + gamma - the gamma the file is written + at (PNG_INFO_gAMA) + + png_get_sRGB(png_ptr, info_ptr, &srgb_intent); + srgb_intent - the rendering intent (PNG_INFO_sRGB) + The presence of the sRGB chunk + means that the pixel data is in the + sRGB color space. This chunk also + implies specific values of gAMA and + cHRM. + + png_get_iCCP(png_ptr, info_ptr, &name, + &compression_type, &profile, &proflen); + name - The profile name. + compression - The compression type; always + PNG_COMPRESSION_TYPE_BASE for PNG 1.0. + You may give NULL to this argument to + ignore it. + profile - International Color Consortium color + profile data. May contain NULs. + proflen - length of profile data in bytes. + + png_get_sBIT(png_ptr, info_ptr, &sig_bit); + sig_bit - the number of significant bits for + (PNG_INFO_sBIT) each of the gray, + red, green, and blue channels, + whichever are appropriate for the + given color type (png_color_16) + + png_get_tRNS(png_ptr, info_ptr, &trans_alpha, + &num_trans, &trans_color); + trans_alpha - array of alpha (transparency) + entries for palette (PNG_INFO_tRNS) + trans_color - graylevel or color sample values of + the single transparent color for + non-paletted images (PNG_INFO_tRNS) + num_trans - number of transparent entries + (PNG_INFO_tRNS) + + png_get_hIST(png_ptr, info_ptr, &hist); + (PNG_INFO_hIST) + hist - histogram of palette (array of + png_uint_16) + + png_get_tIME(png_ptr, info_ptr, &mod_time); + mod_time - time image was last modified + (PNG_VALID_tIME) + + png_get_bKGD(png_ptr, info_ptr, &background); + background - background color (PNG_VALID_bKGD) + valid 16-bit red, green and blue + values, regardless of color_type + + num_comments = png_get_text(png_ptr, info_ptr, + &text_ptr, &num_text); + num_comments - number of comments + text_ptr - array of png_text holding image + comments + text_ptr[i].compression - type of compression used + on "text" PNG_TEXT_COMPRESSION_NONE + PNG_TEXT_COMPRESSION_zTXt + PNG_ITXT_COMPRESSION_NONE + PNG_ITXT_COMPRESSION_zTXt + text_ptr[i].key - keyword for comment. Must contain + 1-79 characters. + text_ptr[i].text - text comments for current + keyword. Can be empty. + text_ptr[i].text_length - length of text string, + after decompression, 0 for iTXt + text_ptr[i].itxt_length - length of itxt string, + after decompression, 0 for tEXt/zTXt + text_ptr[i].lang - language of comment (empty + string for unknown). + text_ptr[i].lang_key - keyword in UTF-8 + (empty string for unknown). + Note that the itxt_length, lang, and lang_key + members of the text_ptr structure only exist + when the library is built with iTXt chunk support. + + num_text - number of comments (same as + num_comments; you can put NULL here + to avoid the duplication) + Note while png_set_text() will accept text, language, + and translated keywords that can be NULL pointers, the + structure returned by png_get_text will always contain + regular zero-terminated C strings. They might be + empty strings but they will never be NULL pointers. + + num_spalettes = png_get_sPLT(png_ptr, info_ptr, + &palette_ptr); + palette_ptr - array of palette structures holding + contents of one or more sPLT chunks + read. + num_spalettes - number of sPLT chunks read. + + png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, + &unit_type); + offset_x - positive offset from the left edge + of the screen + offset_y - positive offset from the top edge + of the screen + unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER + + png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y, + &unit_type); + res_x - pixels/unit physical resolution in + x direction + res_y - pixels/unit physical resolution in + x direction + unit_type - PNG_RESOLUTION_UNKNOWN, + PNG_RESOLUTION_METER + + png_get_sCAL(png_ptr, info_ptr, &unit, &width, + &height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are doubles) + + png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, + &height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are strings like "2.54") + + num_unknown_chunks = png_get_unknown_chunks(png_ptr, + info_ptr, &unknowns) + unknowns - array of png_unknown_chunk + structures holding unknown chunks + unknowns[i].name - name of unknown chunk + unknowns[i].data - data of unknown chunk + unknowns[i].size - size of unknown chunk's data + unknowns[i].location - position of chunk in file + + The value of "i" corresponds to the order in which the + chunks were read from the PNG file or inserted with the + png_set_unknown_chunks() function. + +The data from the pHYs chunk can be retrieved in several convenient +forms: + + res_x = png_get_x_pixels_per_meter(png_ptr, + info_ptr) + res_y = png_get_y_pixels_per_meter(png_ptr, + info_ptr) + res_x_and_y = png_get_pixels_per_meter(png_ptr, + info_ptr) + res_x = png_get_x_pixels_per_inch(png_ptr, + info_ptr) + res_y = png_get_y_pixels_per_inch(png_ptr, + info_ptr) + res_x_and_y = png_get_pixels_per_inch(png_ptr, + info_ptr) + aspect_ratio = png_get_pixel_aspect_ratio(png_ptr, + info_ptr) + + (Each of these returns 0 [signifying "unknown"] if + the data is not present or if res_x is 0; + res_x_and_y is 0 if res_x != res_y) + +The data from the oFFs chunk can be retrieved in several convenient +forms: + + x_offset = png_get_x_offset_microns(png_ptr, info_ptr); + y_offset = png_get_y_offset_microns(png_ptr, info_ptr); + x_offset = png_get_x_offset_inches(png_ptr, info_ptr); + y_offset = png_get_y_offset_inches(png_ptr, info_ptr); + + (Each of these returns 0 [signifying "unknown" if both + x and y are 0] if the data is not present or if the + chunk is present but the unit is the pixel) + +For more information, see the png_info definition in png.h and the +PNG specification for chunk contents. Be careful with trusting +rowbytes, as some of the transformations could increase the space +needed to hold a row (expand, filler, gray_to_rgb, etc.). +See png_read_update_info(), below. + +A quick word about text_ptr and num_text. PNG stores comments in +keyword/text pairs, one pair per chunk, with no limit on the number +of text chunks, and a 2^31 byte limit on their size. While there are +suggested keywords, there is no requirement to restrict the use to these +strings. It is strongly suggested that keywords and text be sensible +to humans (that's the point), so don't use abbreviations. Non-printing +symbols are not allowed. See the PNG specification for more details. +There is also no requirement to have text after the keyword. + +Keywords should be limited to 79 Latin-1 characters without leading or +trailing spaces, but non-consecutive spaces are allowed within the +keyword. It is possible to have the same keyword any number of times. +The text_ptr is an array of png_text structures, each holding a +pointer to a language string, a pointer to a keyword and a pointer to +a text string. The text string, language code, and translated +keyword may be empty or NULL pointers. The keyword/text +pairs are put into the array in the order that they are received. +However, some or all of the text chunks may be after the image, so, to +make sure you have read all the text chunks, don't mess with these +until after you read the stuff after the image. This will be +mentioned again below in the discussion that goes with png_read_end(). + +.SS Input transformations + +After you've read the header information, you can set up the library +to handle any special transformations of the image data. The various +ways to transform the data will be described in the order that they +should occur. This is important, as some of these change the color +type and/or bit depth of the data, and some others only work on +certain color types and bit depths. Even though each transformation +checks to see if it has data that it can do something with, you should +make sure to only enable a transformation if it will be valid for the +data. For example, don't swap red and blue on grayscale data. + +The colors used for the background and transparency values should be +supplied in the same format/depth as the current image data. They +are stored in the same format/depth as the image data in a bKGD or tRNS +chunk, so this is what libpng expects for this data. The colors are +transformed to keep in sync with the image data when an application +calls the png_read_update_info() routine (see below). + +Data will be decoded into the supplied row buffers packed into bytes +unless the library has been told to transform it into another format. +For example, 4 bit/pixel paletted or grayscale data will be returned +2 pixels/byte with the leftmost pixel in the high-order bits of the +byte, unless png_set_packing() is called. 8-bit RGB data will be stored +in RGB RGB RGB format unless png_set_filler() or png_set_add_alpha() +is called to insert filler bytes, either before or after each RGB triplet. +16-bit RGB data will be returned RRGGBB RRGGBB, with the most significant +byte of the color value first, unless png_set_strip_16() is called to +transform it to regular RGB RGB triplets, or png_set_filler() or +png_set_add alpha() is called to insert filler bytes, either before or +after each RRGGBB triplet. Similarly, 8-bit or 16-bit grayscale data can +be modified with +png_set_filler(), png_set_add_alpha(), or png_set_strip_16(). + +The following code transforms grayscale images of less than 8 to 8 bits, +changes paletted images to RGB, and adds a full alpha channel if there is +transparency information in a tRNS chunk. This is most useful on +grayscale images with bit depths of 2 or 4 or if there is a multiple-image +viewing application that wishes to treat all images in the same way. + + if (color_type == PNG_COLOR_TYPE_PALETTE) + png_set_palette_to_rgb(png_ptr); + + if (color_type == PNG_COLOR_TYPE_GRAY && + bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr); + + if (png_get_valid(png_ptr, info_ptr, + PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); + +These three functions are actually aliases for png_set_expand(), added +in libpng version 1.0.4, with the function names expanded to improve code +readability. In some future version they may actually do different +things. + +As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was +added. It expands the sample depth without changing tRNS to alpha. + +As of libpng version 1.4.3, not all possible expansions are supported. + +In the following table, the 01 means grayscale with depth<8, 31 means +indexed with depth<8, other numerals represent the color type, "T" means +the tRNS chunk is present, A means an alpha channel is present, and O +means tRNS or alpha is present but all pixels in the image are opaque. + + FROM 01 31 0 0T 0O 2 2T 2O 3 3T 3O 4A 4O 6A 6O + TO + 01 - + 31 - + 0 1 - + 0T - + 0O - + 2 GX - + 2T - + 2O - + 3 1 - + 3T - + 3O - + 4A T - + 4O - + 6A GX TX TX - + 6O GX TX - + +Within the matrix, + "-" means the transformation is not supported. + "X" means the transformation is obtained by png_set_expand(). + "1" means the transformation is obtained by + png_set_expand_gray_1_2_4_to_8 + "G" means the transformation is obtained by + png_set_gray_to_rgb(). + "P" means the transformation is obtained by + png_set_expand_palette_to_rgb(). + "T" means the transformation is obtained by + png_set_tRNS_to_alpha(). + +PNG can have files with 16 bits per channel. If you only can handle +8 bits per channel, this will strip the pixels down to 8 bit. + + if (bit_depth == 16) + png_set_strip_16(png_ptr); + +If, for some reason, you don't need the alpha channel on an image, +and you want to remove it rather than combining it with the background +(but the image author certainly had in mind that you *would* combine +it with the background, so that's what you should probably do): + + if (color_type & PNG_COLOR_MASK_ALPHA) + png_set_strip_alpha(png_ptr); + +In PNG files, the alpha channel in an image +is the level of opacity. If you need the alpha channel in an image to +be the level of transparency instead of opacity, you can invert the +alpha channel (or the tRNS chunk data) after it's read, so that 0 is +fully opaque and 255 (in 8-bit or paletted images) or 65535 (in 16-bit +images) is fully transparent, with + + png_set_invert_alpha(png_ptr); + +PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as +they can, resulting in, for example, 8 pixels per byte for 1 bit +files. This code expands to 1 pixel per byte without changing the +values of the pixels: + + if (bit_depth < 8) + png_set_packing(png_ptr); + +PNG files have possible bit depths of 1, 2, 4, 8, and 16. All pixels +stored in a PNG image have been "scaled" or "shifted" up to the next +higher possible bit depth (e.g. from 5 bits/sample in the range [0,31] +to 8 bits/sample in the range [0, 255]). However, it is also possible +to convert the PNG pixel data back to the original bit depth of the +image. This call reduces the pixels back down to the original bit depth: + + png_color_8p sig_bit; + + if (png_get_sBIT(png_ptr, info_ptr, &sig_bit)) + png_set_shift(png_ptr, sig_bit); + +PNG files store 3-color pixels in red, green, blue order. This code +changes the storage of the pixels to blue, green, red: + + if (color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) + png_set_bgr(png_ptr); + +PNG files store RGB pixels packed into 3 or 6 bytes. This code expands them +into 4 or 8 bytes for windowing systems that need them in this format: + + if (color_type == PNG_COLOR_TYPE_RGB) + png_set_filler(png_ptr, filler, PNG_FILLER_BEFORE); + +where "filler" is the 8 or 16-bit number to fill with, and the location is +either PNG_FILLER_BEFORE or PNG_FILLER_AFTER, depending upon whether +you want the filler before the RGB or after. This transformation +does not affect images that already have full alpha channels. To add an +opaque alpha channel, use filler=0xff or 0xffff and PNG_FILLER_AFTER which +will generate RGBA pixels. + +Note that png_set_filler() does not change the color type. If you want +to do that, you can add a true alpha channel with + + if (color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_GRAY) + png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER); + +where "filler" contains the alpha value to assign to each pixel. +This function was added in libpng-1.2.7. + +If you are reading an image with an alpha channel, and you need the +data as ARGB instead of the normal PNG format RGBA: + + if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) + png_set_swap_alpha(png_ptr); + +For some uses, you may want a grayscale image to be represented as +RGB. This code will do that conversion: + + if (color_type == PNG_COLOR_TYPE_GRAY || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + png_set_gray_to_rgb(png_ptr); + +Conversely, you can convert an RGB or RGBA image to grayscale or grayscale +with alpha. + + if (color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) + png_set_rgb_to_gray_fixed(png_ptr, error_action, + int red_weight, int green_weight); + + error_action = 1: silently do the conversion + error_action = 2: issue a warning if the original + image has any pixel where + red != green or red != blue + error_action = 3: issue an error and abort the + conversion if the original + image has any pixel where + red != green or red != blue + + red_weight: weight of red component times 100000 + green_weight: weight of green component times 100000 + If either weight is negative, default + weights (21268, 71514) are used. + +If you have set error_action = 1 or 2, you can +later check whether the image really was gray, after processing +the image rows, with the png_get_rgb_to_gray_status(png_ptr) function. +It will return a png_byte that is zero if the image was gray or +1 if there were any non-gray pixels. bKGD and sBIT data +will be silently converted to grayscale, using the green channel +data, regardless of the error_action setting. + +With red_weight+green_weight<=100000, +the normalized graylevel is computed: + + int rw = red_weight * 65536; + int gw = green_weight * 65536; + int bw = 65536 - (rw + gw); + gray = (rw*red + gw*green + bw*blue)/65536; + +The default values approximate those recommended in the Charles +Poynton's Color FAQ, +Copyright (c) 1998-01-04 Charles Poynton + + Y = 0.212671 * R + 0.715160 * G + 0.072169 * B + +Libpng approximates this with + + Y = 0.21268 * R + 0.7151 * G + 0.07217 * B + +which can be expressed with integers as + + Y = (6969 * R + 23434 * G + 2365 * B)/32768 + +The calculation is done in a linear colorspace, if the image gamma +is known. + +If you have a grayscale and you are using png_set_expand_depth(), +png_set_expand(), or png_set_gray_to_rgb to change to truecolor or to +a higher bit-depth, you must either supply the background color as a gray +value at the original file bit-depth (need_expand = 1) or else supply the +background color as an RGB triplet at the final, expanded bit depth +(need_expand = 0). Similarly, if you are reading a paletted image, you +must either supply the background color as a palette index (need_expand = 1) +or as an RGB triplet that may or may not be in the palette (need_expand = 0). + + png_color_16 my_background; + png_color_16p image_background; + + if (png_get_bKGD(png_ptr, info_ptr, &image_background)) + png_set_background(png_ptr, image_background, + PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); + else + png_set_background(png_ptr, &my_background, + PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); + +The png_set_background() function tells libpng to composite images +with alpha or simple transparency against the supplied background +color. If the PNG file contains a bKGD chunk (PNG_INFO_bKGD valid), +you may use this color, or supply another color more suitable for +the current display (e.g., the background color from a web page). You +need to tell libpng whether the color is in the gamma space of the +display (PNG_BACKGROUND_GAMMA_SCREEN for colors you supply), the file +(PNG_BACKGROUND_GAMMA_FILE for colors from the bKGD chunk), or one +that is neither of these gammas (PNG_BACKGROUND_GAMMA_UNIQUE - I don't +know why anyone would use this, but it's here). + +To properly display PNG images on any kind of system, the application needs +to know what the display gamma is. Ideally, the user will know this, and +the application will allow them to set it. One method of allowing the user +to set the display gamma separately for each system is to check for a +SCREEN_GAMMA or DISPLAY_GAMMA environment variable, which will hopefully be +correctly set. + +Note that display_gamma is the overall gamma correction required to produce +pleasing results, which depends on the lighting conditions in the surrounding +environment. In a dim or brightly lit room, no compensation other than +the physical gamma exponent of the monitor is needed, while in a dark room +a slightly smaller exponent is better. + + double gamma, screen_gamma; + + if (/* We have a user-defined screen + gamma value */) + { + screen_gamma = user_defined_screen_gamma; + } + /* One way that applications can share the same + screen gamma value */ + else if ((gamma_str = getenv("SCREEN_GAMMA")) + != NULL) + { + screen_gamma = (double)atof(gamma_str); + } + /* If we don't have another value */ + else + { + screen_gamma = 2.2; /* A good guess for a + PC monitor in a bright office or a dim room */ + screen_gamma = 2.0; /* A good guess for a + PC monitor in a dark room */ + screen_gamma = 1.7 or 1.0; /* A good + guess for Mac systems */ + } + +The png_set_gamma() function handles gamma transformations of the data. +Pass both the file gamma and the current screen_gamma. If the file does +not have a gamma value, you can pass one anyway if you have an idea what +it is (usually 0.45455 is a good guess for GIF images on PCs). Note +that file gammas are inverted from screen gammas. See the discussions +on gamma in the PNG specification for an excellent description of what +gamma is, and why all applications should support it. It is strongly +recommended that PNG viewers support gamma correction. + + if (png_get_gAMA(png_ptr, info_ptr, &gamma)) + png_set_gamma(png_ptr, screen_gamma, gamma); + else + png_set_gamma(png_ptr, screen_gamma, 0.45455); + +If you need to reduce an RGB file to a paletted file, or if a paletted +file has more entries then will fit on your screen, png_set_quantize() +will do that. Note that this is a simple match dither that merely +finds the closest color available. This should work fairly well with +optimized palettes, and fairly badly with linear color cubes. If you +pass a palette that is larger then maximum_colors, the file will +reduce the number of colors in the palette so it will fit into +maximum_colors. If there is a histogram, it will use it to make +more intelligent choices when reducing the palette. If there is no +histogram, it may not do as good a job. + + if (color_type & PNG_COLOR_MASK_COLOR) + { + if (png_get_valid(png_ptr, info_ptr, + PNG_INFO_PLTE)) + { + png_uint_16p histogram = NULL; + + png_get_hIST(png_ptr, info_ptr, + &histogram); + png_set_quantize(png_ptr, palette, num_palette, + max_screen_colors, histogram, 1); + } + else + { + png_color std_color_cube[MAX_SCREEN_COLORS] = + { ... colors ... }; + + png_set_quantize(png_ptr, std_color_cube, + MAX_SCREEN_COLORS, MAX_SCREEN_COLORS, + NULL,0); + } + } + +PNG files describe monochrome as black being zero and white being one. +The following code will reverse this (make black be one and white be +zero): + + if (bit_depth == 1 && color_type == PNG_COLOR_TYPE_GRAY) + png_set_invert_mono(png_ptr); + +This function can also be used to invert grayscale and gray-alpha images: + + if (color_type == PNG_COLOR_TYPE_GRAY || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + png_set_invert_mono(png_ptr); + +PNG files store 16 bit pixels in network byte order (big-endian, +ie. most significant bits first). This code changes the storage to the +other way (little-endian, i.e. least significant bits first, the +way PCs store them): + + if (bit_depth == 16) + png_set_swap(png_ptr); + +If you are using packed-pixel images (1, 2, or 4 bits/pixel), and you +need to change the order the pixels are packed into bytes, you can use: + + if (bit_depth < 8) + png_set_packswap(png_ptr); + +Finally, you can write your own transformation function if none of +the existing ones meets your needs. This is done by setting a callback +with + + png_set_read_user_transform_fn(png_ptr, + read_transform_fn); + +You must supply the function + + void read_transform_fn(png_ptr ptr, row_info_ptr + row_info, png_bytep data) + +See pngtest.c for a working example. Your function will be called +after all of the other transformations have been processed. + +You can also set up a pointer to a user structure for use by your +callback function, and you can inform libpng that your transform +function will change the number of channels or bit depth with the +function + + png_set_user_transform_info(png_ptr, user_ptr, + user_depth, user_channels); + +The user's application, not libpng, is responsible for allocating and +freeing any memory required for the user structure. + +You can retrieve the pointer via the function +png_get_user_transform_ptr(). For example: + + voidp read_user_transform_ptr = + png_get_user_transform_ptr(png_ptr); + +The last thing to handle is interlacing; this is covered in detail below, +but you must call the function here if you want libpng to handle expansion +of the interlaced image. + + number_of_passes = png_set_interlace_handling(png_ptr); + +After setting the transformations, libpng can update your png_info +structure to reflect any transformations you've requested with this +call. This is most useful to update the info structure's rowbytes +field so you can use it to allocate your image memory. This function +will also update your palette with the correct screen_gamma and +background if these have been given with the calls above. + + png_read_update_info(png_ptr, info_ptr); + +After you call png_read_update_info(), you can allocate any +memory you need to hold the image. The row data is simply +raw byte data for all forms of images. As the actual allocation +varies among applications, no example will be given. If you +are allocating one large chunk, you will need to build an +array of pointers to each row, as it will be needed for some +of the functions below. + +.SS Reading image data + +After you've allocated memory, you can read the image data. +The simplest way to do this is in one function call. If you are +allocating enough memory to hold the whole image, you can just +call png_read_image() and libpng will read in all the image data +and put it in the memory area supplied. You will need to pass in +an array of pointers to each row. + +This function automatically handles interlacing, so you don't need +to call png_set_interlace_handling() or call this function multiple +times, or any of that other stuff necessary with png_read_rows(). + + png_read_image(png_ptr, row_pointers); + +where row_pointers is: + + png_bytep row_pointers[height]; + +You can point to void or char or whatever you use for pixels. + +If you don't want to read in the whole image at once, you can +use png_read_rows() instead. If there is no interlacing (check +interlace_type == PNG_INTERLACE_NONE), this is simple: + + png_read_rows(png_ptr, row_pointers, NULL, + number_of_rows); + +where row_pointers is the same as in the png_read_image() call. + +If you are doing this just one row at a time, you can do this with +a single row_pointer instead of an array of row_pointers: + + png_bytep row_pointer = row; + png_read_row(png_ptr, row_pointer, NULL); + +If the file is interlaced (interlace_type != 0 in the IHDR chunk), things +get somewhat harder. The only current (PNG Specification version 1.2) +interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7) +is a somewhat complicated 2D interlace scheme, known as Adam7, that +breaks down an image into seven smaller images of varying size, based +on an 8x8 grid. + +libpng can fill out those images or it can give them to you "as is". +If you want them filled out, there are two ways to do that. The one +mentioned in the PNG specification is to expand each pixel to cover +those pixels that have not been read yet (the "rectangle" method). +This results in a blocky image for the first pass, which gradually +smooths out as more pixels are read. The other method is the "sparkle" +method, where pixels are drawn only in their final locations, with the +rest of the image remaining whatever colors they were initialized to +before the start of the read. The first method usually looks better, +but tends to be slower, as there are more pixels to put in the rows. + +If you don't want libpng to handle the interlacing details, just call +png_read_rows() seven times to read in all seven images. Each of the +images is a valid image by itself, or they can all be combined on an +8x8 grid to form a single image (although if you intend to combine them +you would be far better off using the libpng interlace handling). + +The first pass will return an image 1/8 as wide as the entire image +(every 8th column starting in column 0) and 1/8 as high as the original +(every 8th row starting in row 0), the second will be 1/8 as wide +(starting in column 4) and 1/8 as high (also starting in row 0). The +third pass will be 1/4 as wide (every 4th pixel starting in column 0) and +1/8 as high (every 8th row starting in row 4), and the fourth pass will +be 1/4 as wide and 1/4 as high (every 4th column starting in column 2, +and every 4th row starting in row 0). The fifth pass will return an +image 1/2 as wide, and 1/4 as high (starting at column 0 and row 2), +while the sixth pass will be 1/2 as wide and 1/2 as high as the original +(starting in column 1 and row 0). The seventh and final pass will be as +wide as the original, and 1/2 as high, containing all of the odd +numbered scanlines. Phew! + +If you want libpng to expand the images, call this before calling +png_start_read_image() or png_read_update_info(): + + if (interlace_type == PNG_INTERLACE_ADAM7) + number_of_passes + = png_set_interlace_handling(png_ptr); + +This will return the number of passes needed. Currently, this +is seven, but may change if another interlace type is added. +This function can be called even if the file is not interlaced, +where it will return one pass. + +If you are not going to display the image after each pass, but are +going to wait until the entire image is read in, use the sparkle +effect. This effect is faster and the end result of either method +is exactly the same. If you are planning on displaying the image +after each pass, the "rectangle" effect is generally considered the +better looking one. + +If you only want the "sparkle" effect, just call png_read_rows() as +normal, with the third parameter NULL. Make sure you make pass over +the image number_of_passes times, and you don't change the data in the +rows between calls. You can change the locations of the data, just +not the data. Each pass only writes the pixels appropriate for that +pass, and assumes the data from previous passes is still valid. + + png_read_rows(png_ptr, row_pointers, NULL, + number_of_rows); + +If you only want the first effect (the rectangles), do the same as +before except pass the row buffer in the third parameter, and leave +the second parameter NULL. + + png_read_rows(png_ptr, NULL, row_pointers, + number_of_rows); + +.SS Finishing a sequential read + +After you are finished reading the image through the +low-level interface, you can finish reading the file. If you are +interested in comments or time, which may be stored either before or +after the image data, you should pass the separate png_info struct if +you want to keep the comments from before and after the image +separate. If you are not interested, you can pass NULL. + + png_read_end(png_ptr, end_info); + +When you are done, you can free all memory allocated by libpng like this: + + png_destroy_read_struct(&png_ptr, &info_ptr, + &end_info); + +It is also possible to individually free the info_ptr members that +point to libpng-allocated storage with the following function: + + png_free_data(png_ptr, info_ptr, mask, seq) + mask - identifies data to be freed, a mask + containing the bitwise OR of one or + more of + PNG_FREE_PLTE, PNG_FREE_TRNS, + PNG_FREE_HIST, PNG_FREE_ICCP, + PNG_FREE_PCAL, PNG_FREE_ROWS, + PNG_FREE_SCAL, PNG_FREE_SPLT, + PNG_FREE_TEXT, PNG_FREE_UNKN, + or simply PNG_FREE_ALL + seq - sequence number of item to be freed + (-1 for all items) + +This function may be safely called when the relevant storage has +already been freed, or has not yet been allocated, or was allocated +by the user and not by libpng, and will in those cases do nothing. +The "seq" parameter is ignored if only one item of the selected data +type, such as PLTE, is allowed. If "seq" is not -1, and multiple items +are allowed for the data type identified in the mask, such as text or +sPLT, only the n'th item in the structure is freed, where n is "seq". + +The default behavior is only to free data that was allocated internally +by libpng. This can be changed, so that libpng will not free the data, +or so that it will free data that was allocated by the user with png_malloc() +or png_zalloc() and passed in via a png_set_*() function, with + + png_data_freer(png_ptr, info_ptr, freer, mask) + mask - which data elements are affected + same choices as in png_free_data() + freer - one of + PNG_DESTROY_WILL_FREE_DATA + PNG_SET_WILL_FREE_DATA + PNG_USER_WILL_FREE_DATA + +This function only affects data that has already been allocated. +You can call this function after reading the PNG data but before calling +any png_set_*() functions, to control whether the user or the png_set_*() +function is responsible for freeing any existing data that might be present, +and again after the png_set_*() functions to control whether the user +or png_destroy_*() is supposed to free the data. When the user assumes +responsibility for libpng-allocated data, the application must use +png_free() to free it, and when the user transfers responsibility to libpng +for data that the user has allocated, the user must have used png_malloc() +or png_zalloc() to allocate it. + +If you allocated your row_pointers in a single block, as suggested above in +the description of the high level read interface, you must not transfer +responsibility for freeing it to the png_set_rows or png_read_destroy function, +because they would also try to free the individual row_pointers[i]. + +If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword +separately, do not transfer responsibility for freeing text_ptr to libpng, +because when libpng fills a png_text structure it combines these members with +the key member, and png_free_data() will free only text_ptr.key. Similarly, +if you transfer responsibility for free'ing text_ptr from libpng to your +application, your application must not separately free those members. + +The png_free_data() function will turn off the "valid" flag for anything +it frees. If you need to turn the flag off for a chunk that was freed by +your application instead of by libpng, you can use + + png_set_invalid(png_ptr, info_ptr, mask); + mask - identifies the chunks to be made invalid, + containing the bitwise OR of one or + more of + PNG_INFO_gAMA, PNG_INFO_sBIT, + PNG_INFO_cHRM, PNG_INFO_PLTE, + PNG_INFO_tRNS, PNG_INFO_bKGD, + PNG_INFO_hIST, PNG_INFO_pHYs, + PNG_INFO_oFFs, PNG_INFO_tIME, + PNG_INFO_pCAL, PNG_INFO_sRGB, + PNG_INFO_iCCP, PNG_INFO_sPLT, + PNG_INFO_sCAL, PNG_INFO_IDAT + +For a more compact example of reading a PNG image, see the file example.c. + +.SS Reading PNG files progressively + +The progressive reader is slightly different then the non-progressive +reader. Instead of calling png_read_info(), png_read_rows(), and +png_read_end(), you make one call to png_process_data(), which calls +callbacks when it has the info, a row, or the end of the image. You +set up these callbacks with png_set_progressive_read_fn(). You don't +have to worry about the input/output functions of libpng, as you are +giving the library the data directly in png_process_data(). I will +assume that you have read the section on reading PNG files above, +so I will only highlight the differences (although I will show +all of the code). + +png_structp png_ptr; +png_infop info_ptr; + + /* An example code fragment of how you would + initialize the progressive reader in your + application. */ + int + initialize_png_reader() + { + png_ptr = png_create_read_struct + (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, + user_error_fn, user_warning_fn); + if (!png_ptr) + return (ERROR); + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + { + png_destroy_read_struct(&png_ptr, (png_infopp)NULL, + (png_infopp)NULL); + return (ERROR); + } + + if (setjmp(png_jmpbuf(png_ptr))) + { + png_destroy_read_struct(&png_ptr, &info_ptr, + (png_infopp)NULL); + return (ERROR); + } + + /* This one's new. You can provide functions + to be called when the header info is valid, + when each row is completed, and when the image + is finished. If you aren't using all functions, + you can specify NULL parameters. Even when all + three functions are NULL, you need to call + png_set_progressive_read_fn(). You can use + any struct as the user_ptr (cast to a void pointer + for the function call), and retrieve the pointer + from inside the callbacks using the function + + png_get_progressive_ptr(png_ptr); + + which will return a void pointer, which you have + to cast appropriately. + */ + png_set_progressive_read_fn(png_ptr, (void *)user_ptr, + info_callback, row_callback, end_callback); + + return 0; + } + + /* A code fragment that you call as you receive blocks + of data */ + int + process_data(png_bytep buffer, png_uint_32 length) + { + if (setjmp(png_jmpbuf(png_ptr))) + { + png_destroy_read_struct(&png_ptr, &info_ptr, + (png_infopp)NULL); + return (ERROR); + } + + /* This one's new also. Simply give it a chunk + of data from the file stream (in order, of + course). On machines with segmented memory + models machines, don't give it any more than + 64K. The library seems to run fine with sizes + of 4K. Although you can give it much less if + necessary (I assume you can give it chunks of + 1 byte, I haven't tried less then 256 bytes + yet). When this function returns, you may + want to display any rows that were generated + in the row callback if you don't already do + so there. + */ + png_process_data(png_ptr, info_ptr, buffer, length); + return 0; + } + + /* This function is called (as set by + png_set_progressive_read_fn() above) when enough data + has been supplied so all of the header has been + read. + */ + void + info_callback(png_structp png_ptr, png_infop info) + { + /* Do any setup here, including setting any of + the transformations mentioned in the Reading + PNG files section. For now, you _must_ call + either png_start_read_image() or + png_read_update_info() after all the + transformations are set (even if you don't set + any). You may start getting rows before + png_process_data() returns, so this is your + last chance to prepare for that. + */ + } + + /* This function is called when each row of image + data is complete */ + void + row_callback(png_structp png_ptr, png_bytep new_row, + png_uint_32 row_num, int pass) + { + /* If the image is interlaced, and you turned + on the interlace handler, this function will + be called for every row in every pass. Some + of these rows will not be changed from the + previous pass. When the row is not changed, + the new_row variable will be NULL. The rows + and passes are called in order, so you don't + really need the row_num and pass, but I'm + supplying them because it may make your life + easier. + + For the non-NULL rows of interlaced images, + you must call png_progressive_combine_row() + passing in the row and the old row. You can + call this function for NULL rows (it will just + return) and for non-interlaced images (it just + does the memcpy for you) if it will make the + code easier. Thus, you can just do this for + all cases: + */ + + png_progressive_combine_row(png_ptr, old_row, + new_row); + + /* where old_row is what was displayed for + previously for the row. Note that the first + pass (pass == 0, really) will completely cover + the old row, so the rows do not have to be + initialized. After the first pass (and only + for interlaced images), you will have to pass + the current row, and the function will combine + the old row and the new row. + */ + } + + void + end_callback(png_structp png_ptr, png_infop info) + { + /* This function is called after the whole image + has been read, including any chunks after the + image (up to and including the IEND). You + will usually have the same info chunk as you + had in the header, although some data may have + been added to the comments and time fields. + + Most people won't do much here, perhaps setting + a flag that marks the image as finished. + */ + } + + + +.SH IV. Writing + +Much of this is very similar to reading. However, everything of +importance is repeated here, so you won't have to constantly look +back up in the reading section to understand writing. + +.SS Setup + +You will want to do the I/O initialization before you get into libpng, +so if it doesn't work, you don't have anything to undo. If you are not +using the standard I/O functions, you will need to replace them with +custom writing functions. See the discussion under Customizing libpng. + + FILE *fp = fopen(file_name, "wb"); + if (!fp) + { + return (ERROR); + } + +Next, png_struct and png_info need to be allocated and initialized. +As these can be both relatively large, you may not want to store these +on the stack, unless you have stack space to spare. Of course, you +will want to check if they return NULL. If you are also reading, +you won't want to name your read structure and your write structure +both "png_ptr"; you can call them anything you like, such as +"read_ptr" and "write_ptr". Look at pngtest.c, for example. + + png_structp png_ptr = png_create_write_struct + (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, + user_error_fn, user_warning_fn); + if (!png_ptr) + return (ERROR); + + png_infop info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + { + png_destroy_write_struct(&png_ptr, + (png_infopp)NULL); + return (ERROR); + } + +If you want to use your own memory allocation routines, +define PNG_USER_MEM_SUPPORTED and use +png_create_write_struct_2() instead of png_create_write_struct(): + + png_structp png_ptr = png_create_write_struct_2 + (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, + user_error_fn, user_warning_fn, (png_voidp) + user_mem_ptr, user_malloc_fn, user_free_fn); + +After you have these structures, you will need to set up the +error handling. When libpng encounters an error, it expects to +longjmp() back to your routine. Therefore, you will need to call +setjmp() and pass the png_jmpbuf(png_ptr). If you +write the file from different routines, you will need to update +the png_jmpbuf(png_ptr) every time you enter a new routine that will +call a png_*() function. See your documentation of setjmp/longjmp +for your compiler for more information on setjmp/longjmp. See +the discussion on libpng error handling in the Customizing Libpng +section below for more information on the libpng error handling. + + if (setjmp(png_jmpbuf(png_ptr))) + { + png_destroy_write_struct(&png_ptr, &info_ptr); + fclose(fp); + return (ERROR); + } + ... + return; + +If you would rather avoid the complexity of setjmp/longjmp issues, +you can compile libpng with PNG_NO_SETJMP, in which case +errors will result in a call to PNG_ABORT() which defaults to abort(). + +You can #define PNG_ABORT() to a function that does something +more useful than abort(), as long as your function does not +return. + +Now you need to set up the output code. The default for libpng is to +use the C function fwrite(). If you use this, you will need to pass a +valid FILE * in the function png_init_io(). Be sure that the file is +opened in binary mode. Again, if you wish to handle writing data in +another way, see the discussion on libpng I/O handling in the Customizing +Libpng section below. + + png_init_io(png_ptr, fp); + +If you are embedding your PNG into a datastream such as MNG, and don't +want libpng to write the 8-byte signature, or if you have already +written the signature in your application, use + + png_set_sig_bytes(png_ptr, 8); + +to inform libpng that it should not write a signature. + +.SS Write callbacks + +At this point, you can set up a callback function that will be +called after each row has been written, which you can use to control +a progress meter or the like. It's demonstrated in pngtest.c. +You must supply a function + + void write_row_callback(png_ptr, png_uint_32 row, + int pass); + { + /* put your code here */ + } + +(You can give it another name that you like instead of "write_row_callback") + +To inform libpng about your function, use + + png_set_write_status_fn(png_ptr, write_row_callback); + +You now have the option of modifying how the compression library will +run. The following functions are mainly for testing, but may be useful +in some cases, like if you need to write PNG files extremely fast and +are willing to give up some compression, or if you want to get the +maximum possible compression at the expense of slower writing. If you +have no special needs in this area, let the library do what it wants by +not calling this function at all, as it has been tuned to deliver a good +speed/compression ratio. The second parameter to png_set_filter() is +the filter method, for which the only valid values are 0 (as of the +July 1999 PNG specification, version 1.2) or 64 (if you are writing +a PNG datastream that is to be embedded in a MNG datastream). The third +parameter is a flag that indicates which filter type(s) are to be tested +for each scanline. See the PNG specification for details on the specific +filter types. + + + /* turn on or off filtering, and/or choose + specific filters. You can use either a single + PNG_FILTER_VALUE_NAME or the bitwise OR of one + or more PNG_FILTER_NAME masks. */ + png_set_filter(png_ptr, 0, + PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE | + PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB | + PNG_FILTER_UP | PNG_FILTER_VALUE_UP | + PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG | + PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH| + PNG_ALL_FILTERS); + +If an application +wants to start and stop using particular filters during compression, +it should start out with all of the filters (to ensure that the previous +row of pixels will be stored in case it's needed later), and then add +and remove them after the start of compression. + +If you are writing a PNG datastream that is to be embedded in a MNG +datastream, the second parameter can be either 0 or 64. + +The png_set_compression_*() functions interface to the zlib compression +library, and should mostly be ignored unless you really know what you are +doing. The only generally useful call is png_set_compression_level() +which changes how much time zlib spends on trying to compress the image +data. See the Compression Library (zlib.h and algorithm.txt, distributed +with zlib) for details on the compression levels. + + /* set the zlib compression level */ + png_set_compression_level(png_ptr, + Z_BEST_COMPRESSION); + + /* set other zlib parameters */ + png_set_compression_mem_level(png_ptr, 8); + png_set_compression_strategy(png_ptr, + Z_DEFAULT_STRATEGY); + png_set_compression_window_bits(png_ptr, 15); + png_set_compression_method(png_ptr, 8); + png_set_compression_buffer_size(png_ptr, 8192) + +extern PNG_EXPORT(void,png_set_zbuf_size) + +.SS Setting the contents of info for output + +You now need to fill in the png_info structure with all the data you +wish to write before the actual image. Note that the only thing you +are allowed to write after the image is the text chunks and the time +chunk (as of PNG Specification 1.2, anyway). See png_write_end() and +the latest PNG specification for more information on that. If you +wish to write them before the image, fill them in now, and flag that +data as being valid. If you want to wait until after the data, don't +fill them until png_write_end(). For all the fields in png_info and +their data types, see png.h. For explanations of what the fields +contain, see the PNG specification. + +Some of the more important parts of the png_info are: + + png_set_IHDR(png_ptr, info_ptr, width, height, + bit_depth, color_type, interlace_type, + compression_type, filter_method) + width - holds the width of the image + in pixels (up to 2^31). + height - holds the height of the image + in pixels (up to 2^31). + bit_depth - holds the bit depth of one of the + image channels. + (valid values are 1, 2, 4, 8, 16 + and depend also on the + color_type. See also significant + bits (sBIT) below). + color_type - describes which color/alpha + channels are present. + PNG_COLOR_TYPE_GRAY + (bit depths 1, 2, 4, 8, 16) + PNG_COLOR_TYPE_GRAY_ALPHA + (bit depths 8, 16) + PNG_COLOR_TYPE_PALETTE + (bit depths 1, 2, 4, 8) + PNG_COLOR_TYPE_RGB + (bit_depths 8, 16) + PNG_COLOR_TYPE_RGB_ALPHA + (bit_depths 8, 16) + + PNG_COLOR_MASK_PALETTE + PNG_COLOR_MASK_COLOR + PNG_COLOR_MASK_ALPHA + + interlace_type - PNG_INTERLACE_NONE or + PNG_INTERLACE_ADAM7 + compression_type - (must be + PNG_COMPRESSION_TYPE_DEFAULT) + filter_method - (must be PNG_FILTER_TYPE_DEFAULT + or, if you are writing a PNG to + be embedded in a MNG datastream, + can also be + PNG_INTRAPIXEL_DIFFERENCING) + +If you call png_set_IHDR(), the call must appear before any of the +other png_set_*() functions, because they might require access to some of +the IHDR settings. The remaining png_set_*() functions can be called +in any order. + +If you wish, you can reset the compression_type, interlace_type, or +filter_method later by calling png_set_IHDR() again; if you do this, the +width, height, bit_depth, and color_type must be the same in each call. + + png_set_PLTE(png_ptr, info_ptr, palette, + num_palette); + palette - the palette for the file + (array of png_color) + num_palette - number of entries in the palette + + png_set_gAMA(png_ptr, info_ptr, gamma); + gamma - the gamma the image was created + at (PNG_INFO_gAMA) + + png_set_sRGB(png_ptr, info_ptr, srgb_intent); + srgb_intent - the rendering intent + (PNG_INFO_sRGB) The presence of + the sRGB chunk means that the pixel + data is in the sRGB color space. + This chunk also implies specific + values of gAMA and cHRM. Rendering + intent is the CSS-1 property that + has been defined by the International + Color Consortium + (http://www.color.org). + It can be one of + PNG_sRGB_INTENT_SATURATION, + PNG_sRGB_INTENT_PERCEPTUAL, + PNG_sRGB_INTENT_ABSOLUTE, or + PNG_sRGB_INTENT_RELATIVE. + + + png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, + srgb_intent); + srgb_intent - the rendering intent + (PNG_INFO_sRGB) The presence of the + sRGB chunk means that the pixel + data is in the sRGB color space. + This function also causes gAMA and + cHRM chunks with the specific values + that are consistent with sRGB to be + written. + + png_set_iCCP(png_ptr, info_ptr, name, compression_type, + profile, proflen); + name - The profile name. + compression - The compression type; always + PNG_COMPRESSION_TYPE_BASE for PNG 1.0. + You may give NULL to this argument to + ignore it. + profile - International Color Consortium color + profile data. May contain NULs. + proflen - length of profile data in bytes. + + png_set_sBIT(png_ptr, info_ptr, sig_bit); + sig_bit - the number of significant bits for + (PNG_INFO_sBIT) each of the gray, red, + green, and blue channels, whichever are + appropriate for the given color type + (png_color_16) + + png_set_tRNS(png_ptr, info_ptr, trans_alpha, + num_trans, trans_color); + trans_alpha - array of alpha (transparency) + entries for palette (PNG_INFO_tRNS) + trans_color - graylevel or color sample values + (in order red, green, blue) of the + single transparent color for + non-paletted images (PNG_INFO_tRNS) + num_trans - number of transparent entries + (PNG_INFO_tRNS) + + png_set_hIST(png_ptr, info_ptr, hist); + (PNG_INFO_hIST) + hist - histogram of palette (array of + png_uint_16) + + png_set_tIME(png_ptr, info_ptr, mod_time); + mod_time - time image was last modified + (PNG_VALID_tIME) + + png_set_bKGD(png_ptr, info_ptr, background); + background - background color (PNG_VALID_bKGD) + + png_set_text(png_ptr, info_ptr, text_ptr, num_text); + text_ptr - array of png_text holding image + comments + text_ptr[i].compression - type of compression used + on "text" PNG_TEXT_COMPRESSION_NONE + PNG_TEXT_COMPRESSION_zTXt + PNG_ITXT_COMPRESSION_NONE + PNG_ITXT_COMPRESSION_zTXt + text_ptr[i].key - keyword for comment. Must contain + 1-79 characters. + text_ptr[i].text - text comments for current + keyword. Can be NULL or empty. + text_ptr[i].text_length - length of text string, + after decompression, 0 for iTXt + text_ptr[i].itxt_length - length of itxt string, + after decompression, 0 for tEXt/zTXt + text_ptr[i].lang - language of comment (NULL or + empty for unknown). + text_ptr[i].translated_keyword - keyword in UTF-8 (NULL + or empty for unknown). + Note that the itxt_length, lang, and lang_key + members of the text_ptr structure only exist + when the library is built with iTXt chunk support. + + num_text - number of comments + + png_set_sPLT(png_ptr, info_ptr, &palette_ptr, + num_spalettes); + palette_ptr - array of png_sPLT_struct structures + to be added to the list of palettes + in the info structure. + num_spalettes - number of palette structures to be + added. + + png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, + unit_type); + offset_x - positive offset from the left + edge of the screen + offset_y - positive offset from the top + edge of the screen + unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER + + png_set_pHYs(png_ptr, info_ptr, res_x, res_y, + unit_type); + res_x - pixels/unit physical resolution + in x direction + res_y - pixels/unit physical resolution + in y direction + unit_type - PNG_RESOLUTION_UNKNOWN, + PNG_RESOLUTION_METER + + png_set_sCAL(png_ptr, info_ptr, unit, width, height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are doubles) + + png_set_sCAL_s(png_ptr, info_ptr, unit, width, height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are strings like "2.54") + + png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, + num_unknowns) + unknowns - array of png_unknown_chunk + structures holding unknown chunks + unknowns[i].name - name of unknown chunk + unknowns[i].data - data of unknown chunk + unknowns[i].size - size of unknown chunk's data + unknowns[i].location - position to write chunk in file + 0: do not write chunk + PNG_HAVE_IHDR: before PLTE + PNG_HAVE_PLTE: before IDAT + PNG_AFTER_IDAT: after IDAT + +The "location" member is set automatically according to +what part of the output file has already been written. +You can change its value after calling png_set_unknown_chunks() +as demonstrated in pngtest.c. Within each of the "locations", +the chunks are sequenced according to their position in the +structure (that is, the value of "i", which is the order in which +the chunk was either read from the input file or defined with +png_set_unknown_chunks). + +A quick word about text and num_text. text is an array of png_text +structures. num_text is the number of valid structures in the array. +Each png_text structure holds a language code, a keyword, a text value, +and a compression type. + +The compression types have the same valid numbers as the compression +types of the image data. Currently, the only valid number is zero. +However, you can store text either compressed or uncompressed, unlike +images, which always have to be compressed. So if you don't want the +text compressed, set the compression type to PNG_TEXT_COMPRESSION_NONE. +Because tEXt and zTXt chunks don't have a language field, if you +specify PNG_TEXT_COMPRESSION_NONE or PNG_TEXT_COMPRESSION_zTXt +any language code or translated keyword will not be written out. + +Until text gets around 1000 bytes, it is not worth compressing it. +After the text has been written out to the file, the compression type +is set to PNG_TEXT_COMPRESSION_NONE_WR or PNG_TEXT_COMPRESSION_zTXt_WR, +so that it isn't written out again at the end (in case you are calling +png_write_end() with the same struct. + +The keywords that are given in the PNG Specification are: + + Title Short (one line) title or + caption for image + Author Name of image's creator + Description Description of image (possibly long) + Copyright Copyright notice + Creation Time Time of original image creation + (usually RFC 1123 format, see below) + Software Software used to create the image + Disclaimer Legal disclaimer + Warning Warning of nature of content + Source Device used to create the image + Comment Miscellaneous comment; conversion + from other image format + +The keyword-text pairs work like this. Keywords should be short +simple descriptions of what the comment is about. Some typical +keywords are found in the PNG specification, as is some recommendations +on keywords. You can repeat keywords in a file. You can even write +some text before the image and some after. For example, you may want +to put a description of the image before the image, but leave the +disclaimer until after, so viewers working over modem connections +don't have to wait for the disclaimer to go over the modem before +they start seeing the image. Finally, keywords should be full +words, not abbreviations. Keywords and text are in the ISO 8859-1 +(Latin-1) character set (a superset of regular ASCII) and can not +contain NUL characters, and should not contain control or other +unprintable characters. To make the comments widely readable, stick +with basic ASCII, and avoid machine specific character set extensions +like the IBM-PC character set. The keyword must be present, but +you can leave off the text string on non-compressed pairs. +Compressed pairs must have a text string, as only the text string +is compressed anyway, so the compression would be meaningless. + +PNG supports modification time via the png_time structure. Two +conversion routines are provided, png_convert_from_time_t() for +time_t and png_convert_from_struct_tm() for struct tm. The +time_t routine uses gmtime(). You don't have to use either of +these, but if you wish to fill in the png_time structure directly, +you should provide the time in universal time (GMT) if possible +instead of your local time. Note that the year number is the full +year (e.g. 1998, rather than 98 - PNG is year 2000 compliant!), and +that months start with 1. + +If you want to store the time of the original image creation, you should +use a plain tEXt chunk with the "Creation Time" keyword. This is +necessary because the "creation time" of a PNG image is somewhat vague, +depending on whether you mean the PNG file, the time the image was +created in a non-PNG format, a still photo from which the image was +scanned, or possibly the subject matter itself. In order to facilitate +machine-readable dates, it is recommended that the "Creation Time" +tEXt chunk use RFC 1123 format dates (e.g. "22 May 1997 18:07:10 GMT"), +although this isn't a requirement. Unlike the tIME chunk, the +"Creation Time" tEXt chunk is not expected to be automatically changed +by the software. To facilitate the use of RFC 1123 dates, a function +png_convert_to_rfc1123(png_timep) is provided to convert from PNG +time to an RFC 1123 format string. + +.SS Writing unknown chunks + +You can use the png_set_unknown_chunks function to queue up chunks +for writing. You give it a chunk name, raw data, and a size; that's +all there is to it. The chunks will be written by the next following +png_write_info_before_PLTE, png_write_info, or png_write_end function. +Any chunks previously read into the info structure's unknown-chunk +list will also be written out in a sequence that satisfies the PNG +specification's ordering rules. + +.SS The high-level write interface + +At this point there are two ways to proceed; through the high-level +write interface, or through a sequence of low-level write operations. +You can use the high-level interface if your image data is present +in the info structure. All defined output +transformations are permitted, enabled by the following masks. + + PNG_TRANSFORM_IDENTITY No transformation + PNG_TRANSFORM_PACKING Pack 1, 2 and 4-bit samples + PNG_TRANSFORM_PACKSWAP Change order of packed + pixels to LSB first + PNG_TRANSFORM_INVERT_MONO Invert monochrome images + PNG_TRANSFORM_SHIFT Normalize pixels to the + sBIT depth + PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA + to BGRA + PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA + to AG + PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity + to transparency + PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples + PNG_TRANSFORM_STRIP_FILLER Strip out filler + bytes (deprecated). + PNG_TRANSFORM_STRIP_FILLER_BEFORE Strip out leading + filler bytes + PNG_TRANSFORM_STRIP_FILLER_AFTER Strip out trailing + filler bytes + +If you have valid image data in the info structure (you can use +png_set_rows() to put image data in the info structure), simply do this: + + png_write_png(png_ptr, info_ptr, png_transforms, NULL) + +where png_transforms is an integer containing the bitwise OR of some set of +transformation flags. This call is equivalent to png_write_info(), +followed the set of transformations indicated by the transform mask, +then png_write_image(), and finally png_write_end(). + +(The final parameter of this call is not yet used. Someday it might point +to transformation parameters required by some future output transform.) + +You must use png_transforms and not call any png_set_transform() functions +when you use png_write_png(). + +.SS The low-level write interface + +If you are going the low-level route instead, you are now ready to +write all the file information up to the actual image data. You do +this with a call to png_write_info(). + + png_write_info(png_ptr, info_ptr); + +Note that there is one transformation you may need to do before +png_write_info(). In PNG files, the alpha channel in an image is the +level of opacity. If your data is supplied as a level of transparency, +you can invert the alpha channel before you write it, so that 0 is +fully transparent and 255 (in 8-bit or paletted images) or 65535 +(in 16-bit images) is fully opaque, with + + png_set_invert_alpha(png_ptr); + +This must appear before png_write_info() instead of later with the +other transformations because in the case of paletted images the tRNS +chunk data has to be inverted before the tRNS chunk is written. If +your image is not a paletted image, the tRNS data (which in such cases +represents a single color to be rendered as transparent) won't need to +be changed, and you can safely do this transformation after your +png_write_info() call. + +If you need to write a private chunk that you want to appear before +the PLTE chunk when PLTE is present, you can write the PNG info in +two steps, and insert code to write your own chunk between them: + + png_write_info_before_PLTE(png_ptr, info_ptr); + png_set_unknown_chunks(png_ptr, info_ptr, ...); + png_write_info(png_ptr, info_ptr); + +After you've written the file information, you can set up the library +to handle any special transformations of the image data. The various +ways to transform the data will be described in the order that they +should occur. This is important, as some of these change the color +type and/or bit depth of the data, and some others only work on +certain color types and bit depths. Even though each transformation +checks to see if it has data that it can do something with, you should +make sure to only enable a transformation if it will be valid for the +data. For example, don't swap red and blue on grayscale data. + +PNG files store RGB pixels packed into 3 or 6 bytes. This code tells +the library to strip input data that has 4 or 8 bytes per pixel down +to 3 or 6 bytes (or strip 2 or 4-byte grayscale+filler data to 1 or 2 +bytes per pixel). + + png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); + +where the 0 is unused, and the location is either PNG_FILLER_BEFORE or +PNG_FILLER_AFTER, depending upon whether the filler byte in the pixel +is stored XRGB or RGBX. + +PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as +they can, resulting in, for example, 8 pixels per byte for 1 bit files. +If the data is supplied at 1 pixel per byte, use this code, which will +correctly pack the pixels into a single byte: + + png_set_packing(png_ptr); + +PNG files reduce possible bit depths to 1, 2, 4, 8, and 16. If your +data is of another bit depth, you can write an sBIT chunk into the +file so that decoders can recover the original data if desired. + + /* Set the true bit depth of the image data */ + if (color_type & PNG_COLOR_MASK_COLOR) + { + sig_bit.red = true_bit_depth; + sig_bit.green = true_bit_depth; + sig_bit.blue = true_bit_depth; + } + else + { + sig_bit.gray = true_bit_depth; + } + if (color_type & PNG_COLOR_MASK_ALPHA) + { + sig_bit.alpha = true_bit_depth; + } + + png_set_sBIT(png_ptr, info_ptr, &sig_bit); + +If the data is stored in the row buffer in a bit depth other than +one supported by PNG (e.g. 3 bit data in the range 0-7 for a 4-bit PNG), +this will scale the values to appear to be the correct bit depth as +is required by PNG. + + png_set_shift(png_ptr, &sig_bit); + +PNG files store 16 bit pixels in network byte order (big-endian, +ie. most significant bits first). This code would be used if they are +supplied the other way (little-endian, i.e. least significant bits +first, the way PCs store them): + + if (bit_depth > 8) + png_set_swap(png_ptr); + +If you are using packed-pixel images (1, 2, or 4 bits/pixel), and you +need to change the order the pixels are packed into bytes, you can use: + + if (bit_depth < 8) + png_set_packswap(png_ptr); + +PNG files store 3 color pixels in red, green, blue order. This code +would be used if they are supplied as blue, green, red: + + png_set_bgr(png_ptr); + +PNG files describe monochrome as black being zero and white being +one. This code would be used if the pixels are supplied with this reversed +(black being one and white being zero): + + png_set_invert_mono(png_ptr); + +Finally, you can write your own transformation function if none of +the existing ones meets your needs. This is done by setting a callback +with + + png_set_write_user_transform_fn(png_ptr, + write_transform_fn); + +You must supply the function + + void write_transform_fn(png_ptr ptr, row_info_ptr + row_info, png_bytep data) + +See pngtest.c for a working example. Your function will be called +before any of the other transformations are processed. + +You can also set up a pointer to a user structure for use by your +callback function. + + png_set_user_transform_info(png_ptr, user_ptr, 0, 0); + +The user_channels and user_depth parameters of this function are ignored +when writing; you can set them to zero as shown. + +You can retrieve the pointer via the function png_get_user_transform_ptr(). +For example: + + voidp write_user_transform_ptr = + png_get_user_transform_ptr(png_ptr); + +It is possible to have libpng flush any pending output, either manually, +or automatically after a certain number of lines have been written. To +flush the output stream a single time call: + + png_write_flush(png_ptr); + +and to have libpng flush the output stream periodically after a certain +number of scanlines have been written, call: + + png_set_flush(png_ptr, nrows); + +Note that the distance between rows is from the last time png_write_flush() +was called, or the first row of the image if it has never been called. +So if you write 50 lines, and then png_set_flush 25, it will flush the +output on the next scanline, and every 25 lines thereafter, unless +png_write_flush() is called before 25 more lines have been written. +If nrows is too small (less than about 10 lines for a 640 pixel wide +RGB image) the image compression may decrease noticeably (although this +may be acceptable for real-time applications). Infrequent flushing will +only degrade the compression performance by a few percent over images +that do not use flushing. + +.SS Writing the image data + +That's it for the transformations. Now you can write the image data. +The simplest way to do this is in one function call. If you have the +whole image in memory, you can just call png_write_image() and libpng +will write the image. You will need to pass in an array of pointers to +each row. This function automatically handles interlacing, so you don't +need to call png_set_interlace_handling() or call this function multiple +times, or any of that other stuff necessary with png_write_rows(). + + png_write_image(png_ptr, row_pointers); + +where row_pointers is: + + png_byte *row_pointers[height]; + +You can point to void or char or whatever you use for pixels. + +If you don't want to write the whole image at once, you can +use png_write_rows() instead. If the file is not interlaced, +this is simple: + + png_write_rows(png_ptr, row_pointers, + number_of_rows); + +row_pointers is the same as in the png_write_image() call. + +If you are just writing one row at a time, you can do this with +a single row_pointer instead of an array of row_pointers: + + png_bytep row_pointer = row; + + png_write_row(png_ptr, row_pointer); + +When the file is interlaced, things can get a good deal more complicated. +The only currently (as of the PNG Specification version 1.2, dated July +1999) defined interlacing scheme for PNG files is the "Adam7" interlace +scheme, that breaks down an image into seven smaller images of varying +size. libpng will build these images for you, or you can do them +yourself. If you want to build them yourself, see the PNG specification +for details of which pixels to write when. + +If you don't want libpng to handle the interlacing details, just +use png_set_interlace_handling() and call png_write_rows() the +correct number of times to write all seven sub-images. + +If you want libpng to build the sub-images, call this before you start +writing any rows: + + number_of_passes = + png_set_interlace_handling(png_ptr); + +This will return the number of passes needed. Currently, this is seven, +but may change if another interlace type is added. + +Then write the complete image number_of_passes times. + + png_write_rows(png_ptr, row_pointers, + number_of_rows); + +As some of these rows are not used, and thus return immediately, you may +want to read about interlacing in the PNG specification, and only update +the rows that are actually used. + +.SS Finishing a sequential write + +After you are finished writing the image, you should finish writing +the file. If you are interested in writing comments or time, you should +pass an appropriately filled png_info pointer. If you are not interested, +you can pass NULL. + + png_write_end(png_ptr, info_ptr); + +When you are done, you can free all memory used by libpng like this: + + png_destroy_write_struct(&png_ptr, &info_ptr); + +It is also possible to individually free the info_ptr members that +point to libpng-allocated storage with the following function: + + png_free_data(png_ptr, info_ptr, mask, seq) + mask - identifies data to be freed, a mask + containing the bitwise OR of one or + more of + PNG_FREE_PLTE, PNG_FREE_TRNS, + PNG_FREE_HIST, PNG_FREE_ICCP, + PNG_FREE_PCAL, PNG_FREE_ROWS, + PNG_FREE_SCAL, PNG_FREE_SPLT, + PNG_FREE_TEXT, PNG_FREE_UNKN, + or simply PNG_FREE_ALL + seq - sequence number of item to be freed + (-1 for all items) + +This function may be safely called when the relevant storage has +already been freed, or has not yet been allocated, or was allocated +by the user and not by libpng, and will in those cases do nothing. +The "seq" parameter is ignored if only one item of the selected data +type, such as PLTE, is allowed. If "seq" is not -1, and multiple items +are allowed for the data type identified in the mask, such as text or +sPLT, only the n'th item in the structure is freed, where n is "seq". + +If you allocated data such as a palette that you passed in to libpng +with png_set_*, you must not free it until just before the call to +png_destroy_write_struct(). + +The default behavior is only to free data that was allocated internally +by libpng. This can be changed, so that libpng will not free the data, +or so that it will free data that was allocated by the user with png_malloc() +or png_zalloc() and passed in via a png_set_*() function, with + + png_data_freer(png_ptr, info_ptr, freer, mask) + mask - which data elements are affected + same choices as in png_free_data() + freer - one of + PNG_DESTROY_WILL_FREE_DATA + PNG_SET_WILL_FREE_DATA + PNG_USER_WILL_FREE_DATA + +For example, to transfer responsibility for some data from a read structure +to a write structure, you could use + + png_data_freer(read_ptr, read_info_ptr, + PNG_USER_WILL_FREE_DATA, + PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST) + png_data_freer(write_ptr, write_info_ptr, + PNG_DESTROY_WILL_FREE_DATA, + PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST) + +thereby briefly reassigning responsibility for freeing to the user but +immediately afterwards reassigning it once more to the write_destroy +function. Having done this, it would then be safe to destroy the read +structure and continue to use the PLTE, tRNS, and hIST data in the write +structure. + +This function only affects data that has already been allocated. +You can call this function before calling after the png_set_*() functions +to control whether the user or png_destroy_*() is supposed to free the data. +When the user assumes responsibility for libpng-allocated data, the +application must use +png_free() to free it, and when the user transfers responsibility to libpng +for data that the user has allocated, the user must have used png_malloc() +or png_zalloc() to allocate it. + +If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword +separately, do not transfer responsibility for freeing text_ptr to libpng, +because when libpng fills a png_text structure it combines these members with +the key member, and png_free_data() will free only text_ptr.key. Similarly, +if you transfer responsibility for free'ing text_ptr from libpng to your +application, your application must not separately free those members. +For a more compact example of writing a PNG image, see the file example.c. + +.SH V. Modifying/Customizing libpng: + +There are two issues here. The first is changing how libpng does +standard things like memory allocation, input/output, and error handling. +The second deals with more complicated things like adding new chunks, +adding new transformations, and generally changing how libpng works. +Both of those are compile-time issues; that is, they are generally +determined at the time the code is written, and there is rarely a need +to provide the user with a means of changing them. + +Memory allocation, input/output, and error handling + +All of the memory allocation, input/output, and error handling in libpng +goes through callbacks that are user-settable. The default routines are +in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change +these functions, call the appropriate png_set_*_fn() function. + +Memory allocation is done through the functions png_malloc(), png_calloc(), +and png_free(). These currently just call the standard C functions. +png_calloc() calls png_malloc() and then png_memset() to clear the newly +allocated memory to zero. If your pointers can't access more then 64K +at a time, you will want to set MAXSEG_64K in zlib.h. Since it is +unlikely that the method of handling memory allocation on a platform +will change between applications, these functions must be modified in +the library at compile time. If you prefer to use a different method +of allocating and freeing data, you can use png_create_read_struct_2() or +png_create_write_struct_2() to register your own functions as described +above. These functions also provide a void pointer that can be retrieved +via + + mem_ptr=png_get_mem_ptr(png_ptr); + +Your replacement memory functions must have prototypes as follows: + + png_voidp malloc_fn(png_structp png_ptr, + png_alloc_size_t size); + void free_fn(png_structp png_ptr, png_voidp ptr); + +Your malloc_fn() must return NULL in case of failure. The png_malloc() +function will normally call png_error() if it receives a NULL from the +system memory allocator or from your replacement malloc_fn(). + +Your free_fn() will never be called with a NULL ptr, since libpng's +png_free() checks for NULL before calling free_fn(). + +Input/Output in libpng is done through png_read() and png_write(), +which currently just call fread() and fwrite(). The FILE * is stored in +png_struct and is initialized via png_init_io(). If you wish to change +the method of I/O, the library supplies callbacks that you can set +through the function png_set_read_fn() and png_set_write_fn() at run +time, instead of calling the png_init_io() function. These functions +also provide a void pointer that can be retrieved via the function +png_get_io_ptr(). For example: + + png_set_read_fn(png_structp read_ptr, + voidp read_io_ptr, png_rw_ptr read_data_fn) + + png_set_write_fn(png_structp write_ptr, + voidp write_io_ptr, png_rw_ptr write_data_fn, + png_flush_ptr output_flush_fn); + + voidp read_io_ptr = png_get_io_ptr(read_ptr); + voidp write_io_ptr = png_get_io_ptr(write_ptr); + +The replacement I/O functions must have prototypes as follows: + + void user_read_data(png_structp png_ptr, + png_bytep data, png_size_t length); + void user_write_data(png_structp png_ptr, + png_bytep data, png_size_t length); + void user_flush_data(png_structp png_ptr); + +The user_read_data() function is responsible for detecting and +handling end-of-data errors. + +Supplying NULL for the read, write, or flush functions sets them back +to using the default C stream functions, which expect the io_ptr to +point to a standard *FILE structure. It is probably a mistake +to use NULL for one of write_data_fn and output_flush_fn but not both +of them, unless you have built libpng with PNG_NO_WRITE_FLUSH defined. +It is an error to read from a write stream, and vice versa. + +Error handling in libpng is done through png_error() and png_warning(). +Errors handled through png_error() are fatal, meaning that png_error() +should never return to its caller. Currently, this is handled via +setjmp() and longjmp() (unless you have compiled libpng with +PNG_NO_SETJMP, in which case it is handled via PNG_ABORT()), +but you could change this to do things like exit() if you should wish, +as long as your function does not return. + +On non-fatal errors, png_warning() is called +to print a warning message, and then control returns to the calling code. +By default png_error() and png_warning() print a message on stderr via +fprintf() unless the library is compiled with PNG_NO_CONSOLE_IO defined +(because you don't want the messages) or PNG_NO_STDIO defined (because +fprintf() isn't available). If you wish to change the behavior of the error +functions, you will need to set up your own message callbacks. These +functions are normally supplied at the time that the png_struct is created. +It is also possible to redirect errors and warnings to your own replacement +functions after png_create_*_struct() has been called by calling: + + png_set_error_fn(png_structp png_ptr, + png_voidp error_ptr, png_error_ptr error_fn, + png_error_ptr warning_fn); + + png_voidp error_ptr = png_get_error_ptr(png_ptr); + +If NULL is supplied for either error_fn or warning_fn, then the libpng +default function will be used, calling fprintf() and/or longjmp() if a +problem is encountered. The replacement error functions should have +parameters as follows: + + void user_error_fn(png_structp png_ptr, + png_const_charp error_msg); + void user_warning_fn(png_structp png_ptr, + png_const_charp warning_msg); + +The motivation behind using setjmp() and longjmp() is the C++ throw and +catch exception handling methods. This makes the code much easier to write, +as there is no need to check every return code of every function call. +However, there are some uncertainties about the status of local variables +after a longjmp, so the user may want to be careful about doing anything +after setjmp returns non-zero besides returning itself. Consult your +compiler documentation for more details. For an alternative approach, you +may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net). + +.SS Custom chunks + +If you need to read or write custom chunks, you may need to get deeper +into the libpng code. The library now has mechanisms for storing +and writing chunks of unknown type; you can even declare callbacks +for custom chunks. However, this may not be good enough if the +library code itself needs to know about interactions between your +chunk and existing `intrinsic' chunks. + +If you need to write a new intrinsic chunk, first read the PNG +specification. Acquire a first level of understanding of how it works. +Pay particular attention to the sections that describe chunk names, +and look at how other chunks were designed, so you can do things +similarly. Second, check out the sections of libpng that read and +write chunks. Try to find a chunk that is similar to yours and use +it as a template. More details can be found in the comments inside +the code. It is best to handle unknown chunks in a generic method, +via callback functions, instead of by modifying libpng functions. + +If you wish to write your own transformation for the data, look through +the part of the code that does the transformations, and check out some of +the simpler ones to get an idea of how they work. Try to find a similar +transformation to the one you want to add and copy off of it. More details +can be found in the comments inside the code itself. + +.SS Configuring for 16 bit platforms + +You will want to look into zconf.h to tell zlib (and thus libpng) that +it cannot allocate more then 64K at a time. Even if you can, the memory +won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K. + +.SS Configuring for DOS + +For DOS users who only have access to the lower 640K, you will +have to limit zlib's memory usage via a png_set_compression_mem_level() +call. See zlib.h or zconf.h in the zlib library for more information. + +.SS Configuring for Medium Model + +Libpng's support for medium model has been tested on most of the popular +compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets +defined, and FAR gets defined to far in pngconf.h, and you should be +all set. Everything in the library (except for zlib's structure) is +expecting far data. You must use the typedefs with the p or pp on +the end for pointers (or at least look at them and be careful). Make +note that the rows of data are defined as png_bytepp, which is an +unsigned char far * far *. + +.SS Configuring for gui/windowing platforms: + +You will need to write new error and warning functions that use the GUI +interface, as described previously, and set them to be the error and +warning functions at the time that png_create_*_struct() is called, +in order to have them available during the structure initialization. +They can be changed later via png_set_error_fn(). On some compilers, +you may also have to change the memory allocators (png_malloc, etc.). + +.SS Configuring for compiler xxx: + +All includes for libpng are in pngconf.h. If you need to add, change +or delete an include, this is the place to do it. +The includes that are not needed outside libpng are placed in pngpriv.h, +which is only used by the routines inside libpng itself. +The files in libpng proper only include pngpriv.h and png.h, which +in turn includes pngconf.h. + +.SS Configuring zlib: + +There are special functions to configure the compression. Perhaps the +most useful one changes the compression level, which currently uses +input compression values in the range 0 - 9. The library normally +uses the default compression level (Z_DEFAULT_COMPRESSION = 6). Tests +have shown that for a large majority of images, compression values in +the range 3-6 compress nearly as well as higher levels, and do so much +faster. For online applications it may be desirable to have maximum speed +(Z_BEST_SPEED = 1). With versions of zlib after v0.99, you can also +specify no compression (Z_NO_COMPRESSION = 0), but this would create +files larger than just storing the raw bitmap. You can specify the +compression level by calling: + + png_set_compression_level(png_ptr, level); + +Another useful one is to reduce the memory level used by the library. +The memory level defaults to 8, but it can be lowered if you are +short on memory (running DOS, for example, where you only have 640K). +Note that the memory level does have an effect on compression; among +other things, lower levels will result in sections of incompressible +data being emitted in smaller stored blocks, with a correspondingly +larger relative overhead of up to 15% in the worst case. + + png_set_compression_mem_level(png_ptr, level); + +The other functions are for configuring zlib. They are not recommended +for normal use and may result in writing an invalid PNG file. See +zlib.h for more information on what these mean. + + png_set_compression_strategy(png_ptr, + strategy); + png_set_compression_window_bits(png_ptr, + window_bits); + png_set_compression_method(png_ptr, method); + png_set_compression_buffer_size(png_ptr, size); + +.SS Controlling row filtering + +If you want to control whether libpng uses filtering or not, which +filters are used, and how it goes about picking row filters, you +can call one of these functions. The selection and configuration +of row filters can have a significant impact on the size and +encoding speed and a somewhat lesser impact on the decoding speed +of an image. Filtering is enabled by default for RGB and grayscale +images (with and without alpha), but not for paletted images nor +for any images with bit depths less than 8 bits/pixel. + +The 'method' parameter sets the main filtering method, which is +currently only '0' in the PNG 1.2 specification. The 'filters' +parameter sets which filter(s), if any, should be used for each +scanline. Possible values are PNG_ALL_FILTERS and PNG_NO_FILTERS +to turn filtering on and off, respectively. + +Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB, +PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise +ORed together with '|' to specify one or more filters to use. +These filters are described in more detail in the PNG specification. +If you intend to change the filter type during the course of writing +the image, you should start with flags set for all of the filters +you intend to use so that libpng can initialize its internal +structures appropriately for all of the filter types. (Note that this +means the first row must always be adaptively filtered, because libpng +currently does not allocate the filter buffers until png_write_row() +is called for the first time.) + + filters = PNG_FILTER_NONE | PNG_FILTER_SUB + PNG_FILTER_UP | PNG_FILTER_AVG | + PNG_FILTER_PAETH | PNG_ALL_FILTERS; + + png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, + filters); + The second parameter can also be + PNG_INTRAPIXEL_DIFFERENCING if you are + writing a PNG to be embedded in a MNG + datastream. This parameter must be the + same as the value of filter_method used + in png_set_IHDR(). + +It is also possible to influence how libpng chooses from among the +available filters. This is done in one or both of two ways - by +telling it how important it is to keep the same filter for successive +rows, and by telling it the relative computational costs of the filters. + + double weights[3] = {1.5, 1.3, 1.1}, + costs[PNG_FILTER_VALUE_LAST] = + {1.0, 1.3, 1.3, 1.5, 1.7}; + + png_set_filter_heuristics(png_ptr, + PNG_FILTER_HEURISTIC_WEIGHTED, 3, + weights, costs); + +The weights are multiplying factors that indicate to libpng that the +row filter should be the same for successive rows unless another row filter +is that many times better than the previous filter. In the above example, +if the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a +"sum of absolute differences" 1.5 x 1.3 times higher than other filters +and still be chosen, while the NONE filter could have a sum 1.1 times +higher than other filters and still be chosen. Unspecified weights are +taken to be 1.0, and the specified weights should probably be declining +like those above in order to emphasize recent filters over older filters. + +The filter costs specify for each filter type a relative decoding cost +to be considered when selecting row filters. This means that filters +with higher costs are less likely to be chosen over filters with lower +costs, unless their "sum of absolute differences" is that much smaller. +The costs do not necessarily reflect the exact computational speeds of +the various filters, since this would unduly influence the final image +size. + +Note that the numbers above were invented purely for this example and +are given only to help explain the function usage. Little testing has +been done to find optimum values for either the costs or the weights. + +.SS Removing unwanted object code + +There are a bunch of #define's in pngconf.h that control what parts of +libpng are compiled. All the defines end in _SUPPORTED. If you are +never going to use a capability, you can change the #define to #undef +before recompiling libpng and save yourself code and data space, or +you can turn off individual capabilities with defines that begin with +PNG_NO_. + +You can also turn all of the transforms and ancillary chunk capabilities +off en masse with compiler directives that define +PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS, +or all four, +along with directives to turn on any of the capabilities that you do +want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable the extra +transformations but still leave the library fully capable of reading +and writing PNG files with all known public chunks. Use of the +PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive produces a library +that is incapable of reading or writing ancillary chunks. If you are +not using the progressive reading capability, you can turn that off +with PNG_NO_PROGRESSIVE_READ (don't confuse this with the INTERLACING +capability, which you'll still have). + +All the reading and writing specific code are in separate files, so the +linker should only grab the files it needs. However, if you want to +make sure, or if you are building a stand alone library, all the +reading files start with pngr and all the writing files start with +pngw. The files that don't match either (like png.c, pngtrans.c, etc.) +are used for both reading and writing, and always need to be included. +The progressive reader is in pngpread.c + +If you are creating or distributing a dynamically linked library (a .so +or DLL file), you should not remove or disable any parts of the library, +as this will cause applications linked with different versions of the +library to fail if they call functions not available in your library. +The size of the library itself should not be an issue, because only +those sections that are actually used will be loaded into memory. + +.SS Requesting debug printout + +The macro definition PNG_DEBUG can be used to request debugging +printout. Set it to an integer value in the range 0 to 3. Higher +numbers result in increasing amounts of debugging information. The +information is printed to the "stderr" file, unless another file +name is specified in the PNG_DEBUG_FILE macro definition. + +When PNG_DEBUG > 0, the following functions (macros) become available: + + png_debug(level, message) + png_debug1(level, message, p1) + png_debug2(level, message, p1, p2) + +in which "level" is compared to PNG_DEBUG to decide whether to print +the message, "message" is the formatted string to be printed, +and p1 and p2 are parameters that are to be embedded in the string +according to printf-style formatting directives. For example, + + png_debug1(2, "foo=%d\n", foo); + +is expanded to + + if(PNG_DEBUG > 2) + fprintf(PNG_DEBUG_FILE, "foo=%d\n", foo); + +When PNG_DEBUG is defined but is zero, the macros aren't defined, but you +can still use PNG_DEBUG to control your own debugging: + + #ifdef PNG_DEBUG + fprintf(stderr, ... + #endif + +When PNG_DEBUG = 1, the macros are defined, but only png_debug statements +having level = 0 will be printed. There aren't any such statements in +this version of libpng, but if you insert some they will be printed. + +.SH VI. MNG support + +The MNG specification (available at http://www.libpng.org/pub/mng) allows +certain extensions to PNG for PNG images that are embedded in MNG datastreams. +Libpng can support some of these extensions. To enable them, use the +png_permit_mng_features() function: + + feature_set = png_permit_mng_features(png_ptr, mask) + mask is a png_uint_32 containing the bitwise OR of the + features you want to enable. These include + PNG_FLAG_MNG_EMPTY_PLTE + PNG_FLAG_MNG_FILTER_64 + PNG_ALL_MNG_FEATURES + feature_set is a png_uint_32 that is the bitwise AND of + your mask with the set of MNG features that is + supported by the version of libpng that you are using. + +It is an error to use this function when reading or writing a standalone +PNG file with the PNG 8-byte signature. The PNG datastream must be wrapped +in a MNG datastream. As a minimum, it must have the MNG 8-byte signature +and the MHDR and MEND chunks. Libpng does not provide support for these +or any other MNG chunks; your application must provide its own support for +them. You may wish to consider using libmng (available at +http://www.libmng.com) instead. + +.SH VII. Changes to Libpng from version 0.88 + +It should be noted that versions of libpng later than 0.96 are not +distributed by the original libpng author, Guy Schalnat, nor by +Andreas Dilger, who had taken over from Guy during 1996 and 1997, and +distributed versions 0.89 through 0.96, but rather by another member +of the original PNG Group, Glenn Randers-Pehrson. Guy and Andreas are +still alive and well, but they have moved on to other things. + +The old libpng functions png_read_init(), png_write_init(), +png_info_init(), png_read_destroy(), and png_write_destroy() have been +moved to PNG_INTERNAL in version 0.95 to discourage their use. These +functions will be removed from libpng version 2.0.0. + +The preferred method of creating and initializing the libpng structures is +via the png_create_read_struct(), png_create_write_struct(), and +png_create_info_struct() because they isolate the size of the structures +from the application, allow version error checking, and also allow the +use of custom error handling routines during the initialization, which +the old functions do not. The functions png_read_destroy() and +png_write_destroy() do not actually free the memory that libpng +allocated for these structs, but just reset the data structures, so they +can be used instead of png_destroy_read_struct() and +png_destroy_write_struct() if you feel there is too much system overhead +allocating and freeing the png_struct for each image read. + +Setting the error callbacks via png_set_message_fn() before +png_read_init() as was suggested in libpng-0.88 is no longer supported +because this caused applications that do not use custom error functions +to fail if the png_ptr was not initialized to zero. It is still possible +to set the error callbacks AFTER png_read_init(), or to change them with +png_set_error_fn(), which is essentially the same function, but with a new +name to force compilation errors with applications that try to use the old +method. + +Starting with version 1.0.7, you can find out which version of the library +you are using at run-time: + + png_uint_32 libpng_vn = png_access_version_number(); + +The number libpng_vn is constructed from the major version, minor +version with leading zero, and release number with leading zero, +(e.g., libpng_vn for version 1.0.7 is 10007). + +You can also check which version of png.h you used when compiling your +application: + + png_uint_32 application_vn = PNG_LIBPNG_VER; + +.SH VIII. Changes to Libpng from version 1.0.x to 1.2.x + +Support for user memory management was enabled by default. To +accomplish this, the functions png_create_read_struct_2(), +png_create_write_struct_2(), png_set_mem_fn(), png_get_mem_ptr(), +png_malloc_default(), and png_free_default() were added. + +Support for the iTXt chunk has been enabled by default as of +version 1.2.41. + +Support for certain MNG features was enabled. + +Support for numbered error messages was added. However, we never got +around to actually numbering the error messages. The function +png_set_strip_error_numbers() was added (Note: the prototype for this +function was inadvertently removed from png.h in PNG_NO_ASSEMBLER_CODE +builds of libpng-1.2.15. It was restored in libpng-1.2.36). + +The png_malloc_warn() function was added at libpng-1.2.3. This issues +a png_warning and returns NULL instead of aborting when it fails to +acquire the requested memory allocation. + +Support for setting user limits on image width and height was enabled +by default. The functions png_set_user_limits(), png_get_user_width_max(), +and png_get_user_height_max() were added at libpng-1.2.6. + +The png_set_add_alpha() function was added at libpng-1.2.7. + +The function png_set_expand_gray_1_2_4_to_8() was added at libpng-1.2.9. +Unlike png_set_gray_1_2_4_to_8(), the new function does not expand the +tRNS chunk to alpha. The png_set_gray_1_2_4_to_8() function is +deprecated. + +A number of macro definitions in support of runtime selection of +assembler code features (especially Intel MMX code support) were +added at libpng-1.2.0: + + PNG_ASM_FLAG_MMX_SUPPORT_COMPILED + PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU + PNG_ASM_FLAG_MMX_READ_COMBINE_ROW + PNG_ASM_FLAG_MMX_READ_INTERLACE + PNG_ASM_FLAG_MMX_READ_FILTER_SUB + PNG_ASM_FLAG_MMX_READ_FILTER_UP + PNG_ASM_FLAG_MMX_READ_FILTER_AVG + PNG_ASM_FLAG_MMX_READ_FILTER_PAETH + PNG_ASM_FLAGS_INITIALIZED + PNG_MMX_READ_FLAGS + PNG_MMX_FLAGS + PNG_MMX_WRITE_FLAGS + PNG_MMX_FLAGS + +We added the following functions in support of runtime +selection of assembler code features: + + png_get_mmx_flagmask() + png_set_mmx_thresholds() + png_get_asm_flags() + png_get_mmx_bitdepth_threshold() + png_get_mmx_rowbytes_threshold() + png_set_asm_flags() + +We replaced all of these functions with simple stubs in libpng-1.2.20, +when the Intel assembler code was removed due to a licensing issue. + +These macros are deprecated: + + PNG_READ_TRANSFORMS_NOT_SUPPORTED + PNG_PROGRESSIVE_READ_NOT_SUPPORTED + PNG_NO_SEQUENTIAL_READ_SUPPORTED + PNG_WRITE_TRANSFORMS_NOT_SUPPORTED + PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED + PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED + +They have been replaced, respectively, by: + + PNG_NO_READ_TRANSFORMS + PNG_NO_PROGRESSIVE_READ + PNG_NO_SEQUENTIAL_READ + PNG_NO_WRITE_TRANSFORMS + PNG_NO_READ_ANCILLARY_CHUNKS + PNG_NO_WRITE_ANCILLARY_CHUNKS + +PNG_MAX_UINT was replaced with PNG_UINT_31_MAX. It has been +deprecated since libpng-1.0.16 and libpng-1.2.6. + +The function + png_check_sig(sig, num) +was replaced with + !png_sig_cmp(sig, 0, num) +It has been deprecated since libpng-0.90. + +The function + png_set_gray_1_2_4_to_8() +which also expands tRNS to alpha was replaced with + png_set_expand_gray_1_2_4_to_8() +which does not. It has been deprecated since libpng-1.0.18 and 1.2.9. + +.SH IX. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x + +Private libpng prototypes and macro definitions were moved from +png.h and pngconf.h into a new pngpriv.h header file. + +Functions png_set_benign_errors(), png_benign_error(), and +png_chunk_benign_error() were added. + +Support for setting the maximum amount of memory that the application +will allocate for reading chunks was added, as a security measure. +The functions png_set_chunk_cache_max() and png_get_chunk_cache_max() +were added to the library. + +We implemented support for I/O states by adding png_ptr member io_state +and functions png_get_io_chunk_name() and png_get_io_state() in pngget.c + +We added PNG_TRANSFORM_GRAY_TO_RGB to the available high-level +input transforms. + +Checking for and reporting of errors in the IHDR chunk is more thorough. + +Support for global arrays was removed, to improve thread safety. + +Some obsolete/deprecated macros and functions have been removed. + +Typecasted NULL definitions such as + #define png_voidp_NULL (png_voidp)NULL +were eliminated. If you used these in your application, just use +NULL instead. + +The png_struct and info_struct members "trans" and "trans_values" were +changed to "trans_alpha" and "trans_color", respectively. + +The obsolete, unused pnggccrd.c and pngvcrd.c files and related makefiles +were removed. + +The PNG_1_0_X and PNG_1_2_X macros were eliminated. + +The PNG_LEGACY_SUPPORTED macro was eliminated. + +Many WIN32_WCE #ifdefs were removed. + +The functions png_read_init(info_ptr), png_write_init(info_ptr), +png_info_init(info_ptr), png_read_destroy(), and png_write_destroy() +have been removed. They have been deprecated since libpng-0.95. + +The png_permit_empty_plte() was removed. It has been deprecated +since libpng-1.0.9. Use png_permit_mng_features() instead. + +We removed the obsolete stub functions png_get_mmx_flagmask(), +png_set_mmx_thresholds(), png_get_asm_flags(), +png_get_mmx_bitdepth_threshold(), png_get_mmx_rowbytes_threshold(), +png_set_asm_flags(), and png_mmx_supported() + +We removed the obsolete png_check_sig(), png_memcpy_check(), and +png_memset_check() functions. Instead use !png_sig_cmp(), png_memcpy(), +and png_memset(), respectively. + +The function png_set_gray_1_2_4_to_8() was removed. It has been +deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with +png_set_expand_gray_1_2_4_to_8() because the former function also +expanded palette images. + +We changed the prototype for png_malloc() from + png_malloc(png_structp png_ptr, png_uint_32 size) +to + png_malloc(png_structp png_ptr, png_alloc_size_t size) + +This also applies to the prototype for the user replacement malloc_fn(). + +The png_calloc() function was added and is used in place of +of "png_malloc(); png_memset();" except in the case in png_read_png() +where the array consists of pointers; in this case a "for" loop is used +after the png_malloc() to set the pointers to NULL, to give robust. +behavior in case the application runs out of memory part-way through +the process. + +We changed the prototypes of png_get_compression_buffer_size() and +png_set_compression_buffer_size() to work with png_size_t instead of +png_uint_32. + +Support for numbered error messages was removed by default, since we +never got around to actually numbering the error messages. The function +png_set_strip_error_numbers() was removed from the library by default. + +The png_zalloc() and png_zfree() functions are no longer exported. +The png_zalloc() function no longer zeroes out the memory that it +allocates. + +Support for dithering was disabled by default in libpng-1.4.0, because +been well tested and doesn't actually "dither". The code was not +removed, however, and could be enabled by building libpng with +PNG_READ_DITHER_SUPPORTED defined. In libpng-1.4.2, this support +was reenabled, but the function was renamed png_set_quantize() to +reflect more accurately what it actually does. At the same time, +the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to +PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS. + +We removed the trailing '.' from the warning and error messages. + +.SH X. Detecting libpng + +The png_get_io_ptr() function has been present since libpng-0.88, has never +changed, and is unaffected by conditional compilation macros. It is the +best choice for use in configure scripts for detecting the presence of any +libpng version since 0.88. In an autoconf "configure.in" you could use + + AC_CHECK_LIB(png, png_get_io_ptr, ... + +.SH XI. Source code repository + +Since about February 2009, version 1.2.34, libpng has been under "git" source +control. The git repository was built from old libpng-x.y.z.tar.gz files +going back to version 0.70. You can access the git repository (read only) +at + + git://libpng.git.sourceforge.net/gitroot/libpng + +or you can browse it via "gitweb" at + + http://libpng.git.sourceforge.net/git/gitweb.cgi?p=libpng + +Patches can be sent to glennrp at users.sourceforge.net or to +png-mng-implement at lists.sourceforge.net or you can upload them to +the libpng bug tracker at + + http://libpng.sourceforge.net + +.SH XII. Coding style + +Our coding style is similar to the "Allman" style, with curly +braces on separate lines: + + if (condition) + { + action; + } + + else if (another condition) + { + another action; + } + +The braces can be omitted from simple one-line actions: + + if (condition) + return (0); + +We use 3-space indentation, except for continued statements which +are usually indented the same as the first line of the statement +plus four more spaces. + +For macro definitions we use 2-space indentation, always leaving the "#" +in the first column. + + #ifndef PNG_NO_FEATURE + # ifndef PNG_FEATURE_SUPPORTED + # define PNG_FEATURE_SUPPORTED + # endif + #endif + +Comments appear with the leading "/*" at the same indentation as +the statement that follows the comment: + + /* Single-line comment */ + statement; + + /* This is a multiple-line + * comment. + */ + statement; + +Very short comments can be placed after the end of the statement +to which they pertain: + + statement; /* comment */ + +We don't use C++ style ("//") comments. We have, however, +used them in the past in some now-abandoned MMX assembler +code. + +Functions and their curly braces are not indented, and +exported functions are marked with PNGAPI: + + /* This is a public function that is visible to + * application programers. It does thus-and-so. + */ + void PNGAPI + png_exported_function(png_ptr, png_info, foo) + { + body; + } + +The prototypes for all exported functions appear in png.h, +above the comment that says + + /* Maintainer: Put new public prototypes here ... */ + +We mark all non-exported functions with "/* PRIVATE */"": + + void /* PRIVATE */ + png_non_exported_function(png_ptr, png_info, foo) + { + body; + } + +The prototypes for non-exported functions (except for those in +pngtest) appear in +pngpriv.h +above the comment that says + + /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ + +The names of all exported functions and variables begin +with "png_", and all publicly visible C preprocessor +macros begin with "PNG_". + +We put a space after each comma and after each semicolon +in "for" statments, and we put spaces before and after each +C binary operator and after "for" or "while", and before +"?". We don't put a space between a typecast and the expression +being cast, nor do we put one between a function name and the +left parenthesis that follows it: + + for (i = 2; i > 0; --i) + y[i] = a(x) + (int)b; + +We prefer #ifdef and #ifndef to #if defined() and if !defined() +when there is only one macro being tested. + +We do not use the TAB character for indentation in the C sources. + +Lines do not exceed 80 characters. + +Other rules can be inferred by inspecting the libpng source. + +.SH XIII. Y2K Compliance in libpng + +June 26, 2010 + +Since the PNG Development group is an ad-hoc body, we can't make +an official declaration. + +This is your unofficial assurance that libpng from version 0.71 and +upward through 1.4.3 are Y2K compliant. It is my belief that earlier +versions were also Y2K compliant. + +Libpng only has three year fields. One is a 2-byte unsigned integer that +will hold years up to 65535. The other two hold the date in text +format, and will hold years up to 9999. + +The integer is + "png_uint_16 year" in png_time_struct. + +The strings are + "png_charp time_buffer" in png_struct and + "near_time_buffer", which is a local character string in png.c. + +There are seven time-related functions: + + png_convert_to_rfc_1123() in png.c + (formerly png_convert_to_rfc_1152() in error) + png_convert_from_struct_tm() in pngwrite.c, called + in pngwrite.c + png_convert_from_time_t() in pngwrite.c + png_get_tIME() in pngget.c + png_handle_tIME() in pngrutil.c, called in pngread.c + png_set_tIME() in pngset.c + png_write_tIME() in pngwutil.c, called in pngwrite.c + +All appear to handle dates properly in a Y2K environment. The +png_convert_from_time_t() function calls gmtime() to convert from system +clock time, which returns (year - 1900), which we properly convert to +the full 4-digit year. There is a possibility that applications using +libpng are not passing 4-digit years into the png_convert_to_rfc_1123() +function, or that they are incorrectly passing only a 2-digit year +instead of "year - 1900" into the png_convert_from_struct_tm() function, +but this is not under our control. The libpng documentation has always +stated that it works with 4-digit years, and the APIs have been +documented as such. + +The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned +integer to hold the year, and can hold years as large as 65535. + +zlib, upon which libpng depends, is also Y2K compliant. It contains +no date-related code. + + + Glenn Randers-Pehrson + libpng maintainer + PNG Development Group + +.SH NOTE + +Note about libpng version numbers: + +Due to various miscommunications, unforeseen code incompatibilities +and occasional factors outside the authors' control, version numbering +on the library has not always been consistent and straightforward. +The following table summarizes matters since version 0.89c, which was +the first widely used release: + + source png.h png.h shared-lib + version string int version + ------- ------ ----- ---------- + 0.89c ("beta 3") 0.89 89 1.0.89 + 0.90 ("beta 4") 0.90 90 0.90 + 0.95 ("beta 5") 0.95 95 0.95 + 0.96 ("beta 6") 0.96 96 0.96 + 0.97b ("beta 7") 1.00.97 97 1.0.1 + 0.97c 0.97 97 2.0.97 + 0.98 0.98 98 2.0.98 + 0.99 0.99 98 2.0.99 + 0.99a-m 0.99 99 2.0.99 + 1.00 1.00 100 2.1.0 + 1.0.0 1.0.0 100 2.1.0 + 1.0.0 (from here on, the 100 2.1.0 + 1.0.1 png.h string is 10001 2.1.0 + 1.0.1a-e identical to the 10002 from here on, the + 1.0.2 source version) 10002 shared library is 2.V + 1.0.2a-b 10003 where V is the source + 1.0.1 10001 code version except as + 1.0.1a-e 10002 2.1.0.1a-e noted. + 1.0.2 10002 2.1.0.2 + 1.0.2a-b 10003 2.1.0.2a-b + 1.0.3 10003 2.1.0.3 + 1.0.3a-d 10004 2.1.0.3a-d + 1.0.4 10004 2.1.0.4 + 1.0.4a-f 10005 2.1.0.4a-f + 1.0.5 (+ 2 patches) 10005 2.1.0.5 + 1.0.5a-d 10006 2.1.0.5a-d + 1.0.5e-r 10100 2.1.0.5e-r + 1.0.5s-v 10006 2.1.0.5s-v + 1.0.6 (+ 3 patches) 10006 2.1.0.6 + 1.0.6d-g 10007 2.1.0.6d-g + 1.0.6h 10007 10.6h + 1.0.6i 10007 10.6i + 1.0.6j 10007 2.1.0.6j + 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 + 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 + 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 + 1.0.7 1 10007 2.1.0.7 + 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 + 1.0.8rc1 1 10008 2.1.0.8rc1 + 1.0.8 1 10008 2.1.0.8 + 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 + 1.0.9rc1 1 10009 2.1.0.9rc1 + 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 + 1.0.9rc2 1 10009 2.1.0.9rc2 + 1.0.9 1 10009 2.1.0.9 + 1.0.10beta1 1 10010 2.1.0.10beta1 + 1.0.10rc1 1 10010 2.1.0.10rc1 + 1.0.10 1 10010 2.1.0.10 + 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 + 1.0.11rc1 1 10011 2.1.0.11rc1 + 1.0.11 1 10011 2.1.0.11 + 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 + 1.0.12rc1 2 10012 2.1.0.12rc1 + 1.0.12 2 10012 2.1.0.12 + 1.1.0a-f - 10100 2.1.1.0a-f abandoned + 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 + 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 + 1.2.0rc1 3 10200 3.1.2.0rc1 + 1.2.0 3 10200 3.1.2.0 + 1.2.1beta-4 3 10201 3.1.2.1beta1-4 + 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 + 1.2.1 3 10201 3.1.2.1 + 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 + 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 + 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 + 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 + 1.0.13 10 10013 10.so.0.1.0.13 + 1.2.2 12 10202 12.so.0.1.2.2 + 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 + 1.2.3 12 10203 12.so.0.1.2.3 + 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 + 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 + 1.0.14 10 10014 10.so.0.1.0.14 + 1.2.4 13 10204 12.so.0.1.2.4 + 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 + 1.0.15rc1 10 10015 10.so.0.1.0.15rc1 + 1.0.15 10 10015 10.so.0.1.0.15 + 1.2.5 13 10205 12.so.0.1.2.5 + 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 + 1.2.6rc1-5 13 10206 12.so.0.1.2.6rc1-5 + 1.0.16 10 10016 10.so.0.1.0.16 + 1.2.6 13 10206 12.so.0.1.2.6 + 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 + 1.0.17rc1 10 10017 12.so.0.1.0.17rc1 + 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 + 1.0.17 10 10017 12.so.0.1.0.17 + 1.2.7 13 10207 12.so.0.1.2.7 + 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5 + 1.0.18rc1-5 10 10018 12.so.0.1.0.18rc1-5 + 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5 + 1.0.18 10 10018 12.so.0.1.0.18 + 1.2.8 13 10208 12.so.0.1.2.8 + 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3 + 1.2.9beta4-11 13 10209 12.so.0.9[.0] + 1.2.9rc1 13 10209 12.so.0.9[.0] + 1.2.9 13 10209 12.so.0.9[.0] + 1.2.10beta1-7 13 10210 12.so.0.10[.0] + 1.2.10rc1-2 13 10210 12.so.0.10[.0] + 1.2.10 13 10210 12.so.0.10[.0] + 1.4.0beta1-6 14 10400 14.so.0.0[.0] + 1.2.11beta1-4 13 10210 12.so.0.11[.0] + 1.4.0beta7-8 14 10400 14.so.0.0[.0] + 1.2.11 13 10211 12.so.0.11[.0] + 1.2.12 13 10212 12.so.0.12[.0] + 1.4.0beta9-14 14 10400 14.so.0.0[.0] + 1.2.13 13 10213 12.so.0.13[.0] + 1.4.0beta15-36 14 10400 14.so.0.0[.0] + 1.4.0beta37-87 14 10400 14.so.14.0[.0] + 1.4.0rc01 14 10400 14.so.14.0[.0] + 1.4.0beta88-109 14 10400 14.so.14.0[.0] + 1.4.0rc02-08 14 10400 14.so.14.0[.0] + 1.4.0 14 10400 14.so.14.0[.0] + 1.4.1beta01-03 14 10401 14.so.14.1[.0] + 1.4.1rc01 14 10401 14.so.14.1[.0] + 1.4.1beta04-12 14 10401 14.so.14.1[.0] + 1.4.1rc02-04 14 10401 14.so.14.1[.0] + 1.4.1 14 10401 14.so.14.1[.0] + 1.4.2beta01 14 10402 14.so.14.2[.0] + 1.4.2rc02-06 14 10402 14.so.14.2[.0] + 1.4.2 14 10402 14.so.14.2[.0] + 1.4.3beta01-05 14 10403 14.so.14.3[.0] + 1.4.3rc01-03 14 10403 14.so.14.3[.0] + 1.4.3 14 10403 14.so.14.3[.0] + +Henceforth the source version will match the shared-library minor +and patch numbers; the shared-library major version number will be +used for changes in backward compatibility, as it is intended. The +PNG_PNGLIB_VER macro, which is not used within libpng but is available +for applications, is an unsigned integer of the form xyyzz corresponding +to the source version x.y.z (leading zeros in y and z). Beta versions +were given the previous public release number plus a letter, until +version 1.0.6j; from then on they were given the upcoming public +release number plus "betaNN" or "rcN". + +.SH "SEE ALSO" +libpngpf(3), png(5) +.LP +.IR libpng : +.IP +http://libpng.sourceforge.net (follow the [DOWNLOAD] link) +http://www.libpng.org/pub/png + +.LP +.IR zlib : +.IP +(generally) at the same location as +.I libpng +or at +.br +ftp://ftp.info-zip.org/pub/infozip/zlib + +.LP +.IR PNG specification: RFC 2083 +.IP +(generally) at the same location as +.I libpng +or at +.br +ftp://ds.internic.net/rfc/rfc2083.txt +.br +or (as a W3C Recommendation) at +.br +http://www.w3.org/TR/REC-png.html + +.LP +In the case of any inconsistency between the PNG specification +and this library, the specification takes precedence. + +.SH AUTHORS +This man page: Glenn Randers-Pehrson + + +The contributing authors would like to thank all those who helped +with testing, bug fixes, and patience. This wouldn't have been +possible without all of you. + +Thanks to Frank J. T. Wojcik for helping with the documentation. + +Libpng version 1.4.3 - June 26, 2010: +Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. +Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). + +Supported by the PNG development group +.br +png-mng-implement at lists.sf.net +(subscription required; visit +png-mng-implement at lists.sourceforge.net (subscription required; visit +https://lists.sourceforge.net/lists/listinfo/png-mng-implement +to subscribe). + +.SH COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + +(This copy of the libpng notices is provided for your convenience. In case of +any discrepancy between this copy and the notices in the file png.h that is +included in the libpng distribution, the latter shall prevail.) + +If you modify libpng you may insert additional notices immediately following +this sentence. + +This code is released under the libpng license. + +libpng versions 1.2.6, August 15, 2004, through 1.4.3, June 26, 2010, are +Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-1.2.5 +with the following individual added to the list of Contributing Authors + + Cosmin Truta + +libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are +Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-1.0.6 +with the following individuals added to the list of Contributing Authors + + Simon-Pierre Cadieux + Eric S. Raymond + Gilles Vollant + +and with the following additions to the disclaimer: + + There is no warranty against interference with your + enjoyment of the library or against infringement. + There is no warranty that our efforts or the library + will fulfill any of your particular purposes or needs. + This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and + effort is with the user. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998, 1999 Glenn Randers-Pehrson +Distributed according to the same disclaimer and license as libpng-0.96, +with the following individuals added to the list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996, 1997 Andreas Dilger +Distributed according to the same disclaimer and license as libpng-0.88, +with the following individuals added to the list of Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing Authors +and Group 42, Inc. disclaim all warranties, expressed or implied, +including, without limitation, the warranties of merchantability and of +fitness for any purpose. The Contributing Authors and Group 42, Inc. +assume no liability for direct, indirect, incidental, special, exemplary, +or consequential damages, which may result from the use of the PNG +Reference Library, even if advised of the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + +1. The origin of this source code must not be misrepresented. + +2. Altered versions must be plainly marked as such and + must not be misrepresented as being the original source. + +3. This Copyright notice may not be removed or altered from + any source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, without +fee, and encourage the use of this source code as a component to +supporting the PNG file format in commercial products. If you use this +source code in a product, acknowledgment is not required but would be +appreciated. + + +A "png_get_copyright" function is available, for convenient use in "about" +boxes and the like: + + printf("%s",png_get_copyright(NULL)); + +Also, the PNG logo (in PNG format, of course) is supplied in the +files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). + +Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a +certification mark of the Open Source Initiative. + +Glenn Randers-Pehrson +glennrp at users.sourceforge.net +June 26, 2010 + +.\" end of man page + diff --git a/png/libpng.pc.in b/png/libpng.pc.in new file mode 100644 index 0000000..3e7e2c5 --- /dev/null +++ b/png/libpng.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ + +Name: libpng +Description: Loads and saves PNG files +Version: @PNGLIB_VERSION@ +Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ +Libs.private: @LIBS@ +Cflags: -I${includedir} diff --git a/png/libpngpf.3 b/png/libpngpf.3 new file mode 100644 index 0000000..a05b267 --- /dev/null +++ b/png/libpngpf.3 @@ -0,0 +1,808 @@ +.TH LIBPNGPF 3 "June 26, 2010" +.SH NAME +libpng \- Portable Network Graphics (PNG) Reference Library 1.4.3 +(private functions) +.SH SYNOPSIS +\fB#include \fP + +\fB#include \fI"pngpriv.h" + +\fI\fB + +\fBvoid png_64bit_product (long \fP\fIv1\fP\fB, long \fP\fIv2\fP\fB, unsigned long \fI*hi_product, + +\fBunsigned long \fI*lo_product\fP\fB);\fP + +\fI\fB + +\fBvoid png_build_gamma_table (png_structp \fP\fIpng_ptr\fP\fB, png_byte \fIbit_depth\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_build_grayscale_palette (int \fP\fIbit_depth\fP\fB, png_colorp \fIpalette\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_calculate_crc (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIptr\fP\fB, png_size_t \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBint png_check_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_fixed_point \fP\fIint_white_x\fP\fB, png_fixed_point \fP\fIint_white_y\fP\fB, png_fixed_point \fP\fIint_red_x\fP\fB, png_fixed_point \fP\fIint_red_y\fP\fB, png_fixed_point \fP\fIint_green_x\fP\fB, png_fixed_point \fP\fIint_green_y\fP\fB, png_fixed_point \fP\fIint_blue_x\fP\fB, png_fixed_point \fIint_blue_y\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_check_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIinterlace_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fIfilter_type\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_correct_palette (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBint png_crc_error (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBint png_crc_finish (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIskip\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_crc_read (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuf\fP\fB, png_size_t \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBpng_voidp png_create_struct (int \fItype\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBpng_voidp png_create_struct_2 (int \fP\fItype\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBint png_debug(int \fP\fIlevel\fP\fB, png_const_charp \fImessage\fP\fB);\fP + +\fI\fB + +\fBint png_debug1(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fIp1\fP\fB);\fP + +\fI\fB + +\fBint png_debug2(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fP\fIp1\fP\fB, \fIp2\fP\fB);\fP + +\fI\fB + +\fBvoid png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fP\fIfree_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_color\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_bgr (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_chop (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_expand_palette (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fInum_trans\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_gamma (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_uint_16pp \fP\fIgamma_16_table\fP\fB, int \fIgamma_shift\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_gray_to_rgb (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_invert (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_pack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIbit_depth\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_packswap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_quantize (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIquantize_lookup\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_read_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fP\fIpass\fP\fB, png_uint_32 \fItransformations\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_read_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBint png_do_rgb_to_gray (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_shift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIbit_depth\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_strip_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIflags\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_swap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_unpack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_unshift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIsig_bits\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_write_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fIpass\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_write_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_write_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_do_write_transformations (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid *png_far_to_near (png_structp png_ptr,png_voidp \fP\fIptr\fP\fB, int \fIcheck\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_flush (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_IEND (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_iTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_info_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_init_mmx_flags (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_init_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_process_IDAT_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_process_some_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_check_crc (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_crc_finish (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_crc_skip (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_fill_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_have_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_have_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_have_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_process_row (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_read_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_read_IDAT (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_read_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_read_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_restore_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_read_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP + +\fI\fB + +\fBvoid png_read_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_infop \fIend_info_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_read_finish_row (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_destroy (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_find_filter (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fIrow_info\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_finish_row (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_gAMA (png_structp \fP\fIpng_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIint_file_gamma\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_uint_16p \fP\fIhist\fP\fB, int \fInum_hist\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, int \fIproflen\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_IDAT (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_IEND (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fP\fIfilter_type\fP\fB, int \fIinterlace_type\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_offset\fP\fB, png_uint_32 \fP\fIy_offset\fP\fB, int \fIunit_type\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_pixels_per_unit\fP\fB, png_uint_32 \fP\fIy_pixels_per_unit\fP\fB, int \fIunit_type\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_uint_32 \fInum_pal\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fP\fIsbit\fP\fB, int \fIcolor_type\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_sCAL_s (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, png_charp \fP\fIwidth\fP\fB, png_charp \fIheight\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_spalette_p \fIpalette\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_start_row (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fItext_len\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, png_color_16p \fP\fIvalues\fP\fB, int \fP\fInumber\fP\fB, int \fIcolor_type\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_write_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fP\fItext_len\fP\fB, int \fIcompression\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP + +\fI\fB + +\fI\fB + +\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP + +\fI\fB + +\fI\fB + +.SH DESCRIPTION +The functions listed above are used privately by libpng +and are not recommended for use by applications. They are +not "exported" to applications using shared libraries. They +are listed alphabetically here as an aid to libpng maintainers. +See png.h for more information on these functions. + +.SH SEE ALSO +libpng(3), png(5) +.SH AUTHOR +Glenn Randers-Pehrson diff --git a/png/new_push_process_row.c b/png/new_push_process_row.c new file mode 100644 index 0000000..fbd7dcf --- /dev/null +++ b/png/new_push_process_row.c @@ -0,0 +1,204 @@ +void /* PRIVATE */ +png_push_process_row(png_structp png_ptr) +{ + png_ptr->row_info.color_type = png_ptr->color_type; + png_ptr->row_info.width = png_ptr->iwidth; + png_ptr->row_info.channels = png_ptr->channels; + png_ptr->row_info.bit_depth = png_ptr->bit_depth; + png_ptr->row_info.pixel_depth = png_ptr->pixel_depth; + + png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, + png_ptr->row_info.width); + + png_read_filter_row(png_ptr, &(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->prev_row + 1, + (int)(png_ptr->row_buf[0])); + + png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1); + + if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) + png_do_read_transformations(png_ptr); + +#ifdef PNG_READ_INTERLACING_SUPPORTED + /* Blow up interlaced rows to full size */ + if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) + { + if (png_ptr->pass < 6) +/* old interface (pre-1.0.9): + png_do_read_interlace(&(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); + */ + png_do_read_interlace(png_ptr); + + switch (png_ptr->pass) + { + case 0: + { + int i; + for (i = 0; i < 8 && png_ptr->pass == 0; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); /* Updates png_ptr->pass */ + } + + if (png_ptr->pass == 2) /* Pass 1 might be empty */ + { + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + + if (png_ptr->pass == 4 && png_ptr->height <= 4) + { + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + + if (png_ptr->pass == 6 && png_ptr->height <= 4) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + + break; + } + + case 1: + { + int i; + for (i = 0; i < 8 && png_ptr->pass == 1; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + + if (png_ptr->pass == 2) /* Skip top 4 generated rows */ + { + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + + break; + } + + case 2: + { + int i; + + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + + if (png_ptr->pass == 4) /* Pass 3 might be empty */ + { + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + + break; + } + + case 3: + { + int i; + + for (i = 0; i < 4 && png_ptr->pass == 3; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + + if (png_ptr->pass == 4) /* Skip top two generated rows */ + { + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + + break; + } + + case 4: + { + int i; + + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + + if (png_ptr->pass == 6) /* Pass 5 might be empty */ + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + + break; + } + + case 5: + { + int i; + + for (i = 0; i < 2 && png_ptr->pass == 5; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + + if (png_ptr->pass == 6) /* Skip top generated row */ + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + + break; + } + case 6: + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + + if (png_ptr->pass != 6) + break; + + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + } + else +#endif + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } +} diff --git a/png/png.5 b/png/png.5 new file mode 100644 index 0000000..b89d29b --- /dev/null +++ b/png/png.5 @@ -0,0 +1,74 @@ +.TH PNG 5 "June 26, 2010" +.SH NAME +png \- Portable Network Graphics (PNG) format +.SH DESCRIPTION +PNG (Portable Network Graphics) is an extensible file format for the +lossless, portable, well-compressed storage of raster images. PNG provides +a patent-free replacement for GIF and can also replace many +common uses of TIFF. Indexed-color, grayscale, and truecolor images are +supported, plus an optional alpha channel. Sample depths range from +1 to 16 bits. +.br + +PNG is designed to work well in online viewing applications, such as the +World Wide Web, so it is fully streamable with a progressive display +option. PNG is robust, providing both full file integrity checking and +fast, simple detection of common transmission errors. Also, PNG can store +gamma and chromaticity data for improved color matching on heterogeneous +platforms. + +.SH "SEE ALSO" +.IR libpng(3), zlib(3), deflate(5), and zlib(5) +.LP +PNG specification (second edition), November 2003: +.IP +.br + 8) + png_error(png_ptr, "Too many bytes for PNG signature"); + + png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes); +} + +/* Checks whether the supplied bytes match the PNG signature. We allow + * checking less than the full 8-byte signature so that those apps that + * already read the first few bytes of a file to determine the file type + * can simply check the remaining bytes for extra assurance. Returns + * an integer less than, equal to, or greater than zero if sig is found, + * respectively, to be less than, to match, or be greater than the correct + * PNG signature (this is the same behaviour as strcmp, memcmp, etc). + */ +int PNGAPI +png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check) +{ + png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; + if (num_to_check > 8) + num_to_check = 8; + else if (num_to_check < 1) + return (-1); + + if (start > 7) + return (-1); + + if (start + num_to_check > 8) + num_to_check = 8 - start; + + return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check))); +} + +#endif /* PNG_READ_SUPPORTED */ + +#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) +/* Function to allocate memory for zlib and clear it to 0. */ +voidpf /* PRIVATE */ +png_zalloc(voidpf png_ptr, uInt items, uInt size) +{ + png_voidp ptr; + png_structp p=(png_structp)png_ptr; + png_uint_32 save_flags=p->flags; + png_alloc_size_t num_bytes; + + if (png_ptr == NULL) + return (NULL); + if (items > PNG_UINT_32_MAX/size) + { + png_warning (p, "Potential overflow in png_zalloc()"); + return (NULL); + } + num_bytes = (png_alloc_size_t)items * size; + + p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK; + ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes); + p->flags=save_flags; + + return ((voidpf)ptr); +} + +/* Function to free memory for zlib */ +void /* PRIVATE */ +png_zfree(voidpf png_ptr, voidpf ptr) +{ + png_free((png_structp)png_ptr, (png_voidp)ptr); +} + +/* Reset the CRC variable to 32 bits of 1's. Care must be taken + * in case CRC is > 32 bits to leave the top bits 0. + */ +void /* PRIVATE */ +png_reset_crc(png_structp png_ptr) +{ + png_ptr->crc = crc32(0, Z_NULL, 0); +} + +/* Calculate the CRC over a section of data. We can only pass as + * much data to this routine as the largest single buffer size. We + * also check that this data will actually be used before going to the + * trouble of calculating it. + */ +void /* PRIVATE */ +png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length) +{ + int need_crc = 1; + + if (png_ptr->chunk_name[0] & 0x20) /* ancillary */ + { + if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) == + (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN)) + need_crc = 0; + } + else /* critical */ + { + if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) + need_crc = 0; + } + + if (need_crc) + png_ptr->crc = crc32(png_ptr->crc, ptr, (uInt)length); +} + +/* Allocate the memory for an info_struct for the application. We don't + * really need the png_ptr, but it could potentially be useful in the + * future. This should be used in favour of malloc(png_sizeof(png_info)) + * and png_info_init() so that applications that want to use a shared + * libpng don't have to be recompiled if png_info changes size. + */ +png_infop PNGAPI +png_create_info_struct(png_structp png_ptr) +{ + png_infop info_ptr; + + png_debug(1, "in png_create_info_struct"); + + if (png_ptr == NULL) + return (NULL); + +#ifdef PNG_USER_MEM_SUPPORTED + info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO, + png_ptr->malloc_fn, png_ptr->mem_ptr); +#else + info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO); +#endif + if (info_ptr != NULL) + png_info_init_3(&info_ptr, png_sizeof(png_info)); + + return (info_ptr); +} + +/* This function frees the memory associated with a single info struct. + * Normally, one would use either png_destroy_read_struct() or + * png_destroy_write_struct() to free an info struct, but this may be + * useful for some applications. + */ +void PNGAPI +png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr) +{ + png_infop info_ptr = NULL; + + png_debug(1, "in png_destroy_info_struct"); + + if (png_ptr == NULL) + return; + + if (info_ptr_ptr != NULL) + info_ptr = *info_ptr_ptr; + + if (info_ptr != NULL) + { + png_info_destroy(png_ptr, info_ptr); + +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn, + png_ptr->mem_ptr); +#else + png_destroy_struct((png_voidp)info_ptr); +#endif + *info_ptr_ptr = NULL; + } +} + +/* Initialize the info structure. This is now an internal function (0.89) + * and applications using it are urged to use png_create_info_struct() + * instead. + */ + +void PNGAPI +png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size) +{ + png_infop info_ptr = *ptr_ptr; + + png_debug(1, "in png_info_init_3"); + + if (info_ptr == NULL) + return; + + if (png_sizeof(png_info) > png_info_struct_size) + { + png_destroy_struct(info_ptr); + info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO); + *ptr_ptr = info_ptr; + } + + /* Set everything to 0 */ + png_memset(info_ptr, 0, png_sizeof(png_info)); +} + +void PNGAPI +png_data_freer(png_structp png_ptr, png_infop info_ptr, + int freer, png_uint_32 mask) +{ + png_debug(1, "in png_data_freer"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (freer == PNG_DESTROY_WILL_FREE_DATA) + info_ptr->free_me |= mask; + else if (freer == PNG_USER_WILL_FREE_DATA) + info_ptr->free_me &= ~mask; + else + png_warning(png_ptr, + "Unknown freer parameter in png_data_freer"); +} + +void PNGAPI +png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, + int num) +{ + png_debug(1, "in png_free_data"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + +#ifdef PNG_TEXT_SUPPORTED + /* Free text item num or (if num == -1) all text items */ + if ((mask & PNG_FREE_TEXT) & info_ptr->free_me) + { + if (num != -1) + { + if (info_ptr->text && info_ptr->text[num].key) + { + png_free(png_ptr, info_ptr->text[num].key); + info_ptr->text[num].key = NULL; + } + } + else + { + int i; + for (i = 0; i < info_ptr->num_text; i++) + png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, i); + png_free(png_ptr, info_ptr->text); + info_ptr->text = NULL; + info_ptr->num_text=0; + } + } +#endif + +#ifdef PNG_tRNS_SUPPORTED + /* Free any tRNS entry */ + if ((mask & PNG_FREE_TRNS) & info_ptr->free_me) + { + png_free(png_ptr, info_ptr->trans_alpha); + info_ptr->trans_alpha = NULL; + info_ptr->valid &= ~PNG_INFO_tRNS; + } +#endif + +#ifdef PNG_sCAL_SUPPORTED + /* Free any sCAL entry */ + if ((mask & PNG_FREE_SCAL) & info_ptr->free_me) + { +#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) + png_free(png_ptr, info_ptr->scal_s_width); + png_free(png_ptr, info_ptr->scal_s_height); + info_ptr->scal_s_width = NULL; + info_ptr->scal_s_height = NULL; +#endif + info_ptr->valid &= ~PNG_INFO_sCAL; + } +#endif + +#ifdef PNG_pCAL_SUPPORTED + /* Free any pCAL entry */ + if ((mask & PNG_FREE_PCAL) & info_ptr->free_me) + { + png_free(png_ptr, info_ptr->pcal_purpose); + png_free(png_ptr, info_ptr->pcal_units); + info_ptr->pcal_purpose = NULL; + info_ptr->pcal_units = NULL; + if (info_ptr->pcal_params != NULL) + { + int i; + for (i = 0; i < (int)info_ptr->pcal_nparams; i++) + { + png_free(png_ptr, info_ptr->pcal_params[i]); + info_ptr->pcal_params[i] = NULL; + } + png_free(png_ptr, info_ptr->pcal_params); + info_ptr->pcal_params = NULL; + } + info_ptr->valid &= ~PNG_INFO_pCAL; + } +#endif + +#ifdef PNG_iCCP_SUPPORTED + /* Free any iCCP entry */ + if ((mask & PNG_FREE_ICCP) & info_ptr->free_me) + { + png_free(png_ptr, info_ptr->iccp_name); + png_free(png_ptr, info_ptr->iccp_profile); + info_ptr->iccp_name = NULL; + info_ptr->iccp_profile = NULL; + info_ptr->valid &= ~PNG_INFO_iCCP; + } +#endif + +#ifdef PNG_sPLT_SUPPORTED + /* Free a given sPLT entry, or (if num == -1) all sPLT entries */ + if ((mask & PNG_FREE_SPLT) & info_ptr->free_me) + { + if (num != -1) + { + if (info_ptr->splt_palettes) + { + png_free(png_ptr, info_ptr->splt_palettes[num].name); + png_free(png_ptr, info_ptr->splt_palettes[num].entries); + info_ptr->splt_palettes[num].name = NULL; + info_ptr->splt_palettes[num].entries = NULL; + } + } + else + { + if (info_ptr->splt_palettes_num) + { + int i; + for (i = 0; i < (int)info_ptr->splt_palettes_num; i++) + png_free_data(png_ptr, info_ptr, PNG_FREE_SPLT, i); + + png_free(png_ptr, info_ptr->splt_palettes); + info_ptr->splt_palettes = NULL; + info_ptr->splt_palettes_num = 0; + } + info_ptr->valid &= ~PNG_INFO_sPLT; + } + } +#endif + +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED + if (png_ptr->unknown_chunk.data) + { + png_free(png_ptr, png_ptr->unknown_chunk.data); + png_ptr->unknown_chunk.data = NULL; + } + + if ((mask & PNG_FREE_UNKN) & info_ptr->free_me) + { + if (num != -1) + { + if (info_ptr->unknown_chunks) + { + png_free(png_ptr, info_ptr->unknown_chunks[num].data); + info_ptr->unknown_chunks[num].data = NULL; + } + } + else + { + int i; + + if (info_ptr->unknown_chunks_num) + { + for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++) + png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i); + + png_free(png_ptr, info_ptr->unknown_chunks); + info_ptr->unknown_chunks = NULL; + info_ptr->unknown_chunks_num = 0; + } + } + } +#endif + +#ifdef PNG_hIST_SUPPORTED + /* Free any hIST entry */ + if ((mask & PNG_FREE_HIST) & info_ptr->free_me) + { + png_free(png_ptr, info_ptr->hist); + info_ptr->hist = NULL; + info_ptr->valid &= ~PNG_INFO_hIST; + } +#endif + + /* Free any PLTE entry that was internally allocated */ + if ((mask & PNG_FREE_PLTE) & info_ptr->free_me) + { + png_zfree(png_ptr, info_ptr->palette); + info_ptr->palette = NULL; + info_ptr->valid &= ~PNG_INFO_PLTE; + info_ptr->num_palette = 0; + } + +#ifdef PNG_INFO_IMAGE_SUPPORTED + /* Free any image bits attached to the info structure */ + if ((mask & PNG_FREE_ROWS) & info_ptr->free_me) + { + if (info_ptr->row_pointers) + { + int row; + for (row = 0; row < (int)info_ptr->height; row++) + { + png_free(png_ptr, info_ptr->row_pointers[row]); + info_ptr->row_pointers[row] = NULL; + } + png_free(png_ptr, info_ptr->row_pointers); + info_ptr->row_pointers = NULL; + } + info_ptr->valid &= ~PNG_INFO_IDAT; + } +#endif + + if (num == -1) + info_ptr->free_me &= ~mask; + else + info_ptr->free_me &= ~(mask & ~PNG_FREE_MUL); +} + +/* This is an internal routine to free any memory that the info struct is + * pointing to before re-using it or freeing the struct itself. Recall + * that png_free() checks for NULL pointers for us. + */ +void /* PRIVATE */ +png_info_destroy(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_info_destroy"); + + png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); + +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + if (png_ptr->num_chunk_list) + { + png_free(png_ptr, png_ptr->chunk_list); + png_ptr->chunk_list = NULL; + png_ptr->num_chunk_list = 0; + } +#endif + + png_info_init_3(&info_ptr, png_sizeof(png_info)); +} +#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ + +/* This function returns a pointer to the io_ptr associated with the user + * functions. The application should free any memory associated with this + * pointer before png_write_destroy() or png_read_destroy() are called. + */ +png_voidp PNGAPI +png_get_io_ptr(png_structp png_ptr) +{ + if (png_ptr == NULL) + return (NULL); + return (png_ptr->io_ptr); +} + +#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) +#ifdef PNG_STDIO_SUPPORTED +/* Initialize the default input/output functions for the PNG file. If you + * use your own read or write routines, you can call either png_set_read_fn() + * or png_set_write_fn() instead of png_init_io(). If you have defined + * PNG_NO_STDIO, you must use a function of your own because "FILE *" isn't + * necessarily available. + */ +void PNGAPI +png_init_io(png_structp png_ptr, png_FILE_p fp) +{ + png_debug(1, "in png_init_io"); + + if (png_ptr == NULL) + return; + + png_ptr->io_ptr = (png_voidp)fp; +} +#endif + +#ifdef PNG_TIME_RFC1123_SUPPORTED +/* Convert the supplied time into an RFC 1123 string suitable for use in + * a "Creation Time" or other text-based time string. + */ +png_charp PNGAPI +png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime) +{ + static PNG_CONST char short_months[12][4] = + {"Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + + if (png_ptr == NULL) + return (NULL); + if (png_ptr->time_buffer == NULL) + { + png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29* + png_sizeof(char))); + } + +#ifdef USE_FAR_KEYWORD + { + char near_time_buf[29]; + png_snprintf6(near_time_buf, 29, "%d %s %d %02d:%02d:%02d +0000", + ptime->day % 32, short_months[(ptime->month - 1) % 12], + ptime->year, ptime->hour % 24, ptime->minute % 60, + ptime->second % 61); + png_memcpy(png_ptr->time_buffer, near_time_buf, + 29*png_sizeof(char)); + } +#else + png_snprintf6(png_ptr->time_buffer, 29, "%d %s %d %02d:%02d:%02d +0000", + ptime->day % 32, short_months[(ptime->month - 1) % 12], + ptime->year, ptime->hour % 24, ptime->minute % 60, + ptime->second % 61); +#endif + return ((png_charp)png_ptr->time_buffer); +} +#endif /* PNG_TIME_RFC1123_SUPPORTED */ + +#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ + +png_charp PNGAPI +png_get_copyright(png_structp png_ptr) +{ + png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ +#ifdef PNG_STRING_COPYRIGHT + return PNG_STRING_COPYRIGHT +#else +#ifdef __STDC__ + return ((png_charp) PNG_STRING_NEWLINE \ + "libpng version 1.4.3 - June 26, 2010" PNG_STRING_NEWLINE \ + "Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ + "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ + "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ + PNG_STRING_NEWLINE); +#else + return ((png_charp) "libpng version 1.4.3 - June 26, 2010\ + Copyright (c) 1998-2010 Glenn Randers-Pehrson\ + Copyright (c) 1996-1997 Andreas Dilger\ + Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."); +#endif +#endif +} + +/* The following return the library version as a short string in the + * format 1.0.0 through 99.99.99zz. To get the version of *.h files + * used with your application, print out PNG_LIBPNG_VER_STRING, which + * is defined in png.h. + * Note: now there is no difference between png_get_libpng_ver() and + * png_get_header_ver(). Due to the version_nn_nn_nn typedef guard, + * it is guaranteed that png.c uses the correct version of png.h. + */ +png_charp PNGAPI +png_get_libpng_ver(png_structp png_ptr) +{ + /* Version of *.c files used when building libpng */ + png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ + return ((png_charp) PNG_LIBPNG_VER_STRING); +} + +png_charp PNGAPI +png_get_header_ver(png_structp png_ptr) +{ + /* Version of *.h files used when building libpng */ + png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ + return ((png_charp) PNG_LIBPNG_VER_STRING); +} + +png_charp PNGAPI +png_get_header_version(png_structp png_ptr) +{ + /* Returns longer string containing both version and date */ + png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ +#ifdef __STDC__ + return ((png_charp) PNG_HEADER_VERSION_STRING +#ifndef PNG_READ_SUPPORTED + " (NO READ SUPPORT)" +#endif + PNG_STRING_NEWLINE); +#else + return ((png_charp) PNG_HEADER_VERSION_STRING); +#endif +} + +#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +int PNGAPI +png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name) +{ + /* Check chunk_name and return "keep" value if it's on the list, else 0 */ + int i; + png_bytep p; + if (png_ptr == NULL || chunk_name == NULL || png_ptr->num_chunk_list<=0) + return 0; + p = png_ptr->chunk_list + png_ptr->num_chunk_list*5 - 5; + for (i = png_ptr->num_chunk_list; i; i--, p -= 5) + if (!png_memcmp(chunk_name, p, 4)) + return ((int)*(p + 4)); + return 0; +} +#endif +#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ + +#ifdef PNG_READ_SUPPORTED +/* This function, added to libpng-1.0.6g, is untested. */ +int PNGAPI +png_reset_zstream(png_structp png_ptr) +{ + if (png_ptr == NULL) + return Z_STREAM_ERROR; + return (inflateReset(&png_ptr->zstream)); +} +#endif /* PNG_READ_SUPPORTED */ + +/* This function was added to libpng-1.0.7 */ +png_uint_32 PNGAPI +png_access_version_number(void) +{ + /* Version of *.c files used when building libpng */ + return((png_uint_32) PNG_LIBPNG_VER); +} + + + +#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) +#ifdef PNG_SIZE_T +/* Added at libpng version 1.2.6 */ + PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size)); +png_size_t PNGAPI +png_convert_size(size_t size) +{ + if (size > (png_size_t)-1) + PNG_ABORT(); /* We haven't got access to png_ptr, so no png_error() */ + return ((png_size_t)size); +} +#endif /* PNG_SIZE_T */ + +/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */ +#ifdef PNG_cHRM_SUPPORTED +#ifdef PNG_CHECK_cHRM_SUPPORTED + +/* + * Multiply two 32-bit numbers, V1 and V2, using 32-bit + * arithmetic, to produce a 64 bit result in the HI/LO words. + * + * A B + * x C D + * ------ + * AD || BD + * AC || CB || 0 + * + * where A and B are the high and low 16-bit words of V1, + * C and D are the 16-bit words of V2, AD is the product of + * A and D, and X || Y is (X << 16) + Y. +*/ + +void /* PRIVATE */ +png_64bit_product (long v1, long v2, unsigned long *hi_product, + unsigned long *lo_product) +{ + int a, b, c, d; + long lo, hi, x, y; + + a = (v1 >> 16) & 0xffff; + b = v1 & 0xffff; + c = (v2 >> 16) & 0xffff; + d = v2 & 0xffff; + + lo = b * d; /* BD */ + x = a * d + c * b; /* AD + CB */ + y = ((lo >> 16) & 0xffff) + x; + + lo = (lo & 0xffff) | ((y & 0xffff) << 16); + hi = (y >> 16) & 0xffff; + + hi += a * c; /* AC */ + + *hi_product = (unsigned long)hi; + *lo_product = (unsigned long)lo; +} + +int /* PRIVATE */ +png_check_cHRM_fixed(png_structp png_ptr, + png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x, + png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, + png_fixed_point blue_x, png_fixed_point blue_y) +{ + int ret = 1; + unsigned long xy_hi,xy_lo,yx_hi,yx_lo; + + png_debug(1, "in function png_check_cHRM_fixed"); + + if (png_ptr == NULL) + return 0; + + if (white_x < 0 || white_y <= 0 || + red_x < 0 || red_y < 0 || + green_x < 0 || green_y < 0 || + blue_x < 0 || blue_y < 0) + { + png_warning(png_ptr, + "Ignoring attempt to set negative chromaticity value"); + ret = 0; + } + if (white_x > (png_fixed_point) PNG_UINT_31_MAX || + white_y > (png_fixed_point) PNG_UINT_31_MAX || + red_x > (png_fixed_point) PNG_UINT_31_MAX || + red_y > (png_fixed_point) PNG_UINT_31_MAX || + green_x > (png_fixed_point) PNG_UINT_31_MAX || + green_y > (png_fixed_point) PNG_UINT_31_MAX || + blue_x > (png_fixed_point) PNG_UINT_31_MAX || + blue_y > (png_fixed_point) PNG_UINT_31_MAX ) + { + png_warning(png_ptr, + "Ignoring attempt to set chromaticity value exceeding 21474.83"); + ret = 0; + } + if (white_x > 100000L - white_y) + { + png_warning(png_ptr, "Invalid cHRM white point"); + ret = 0; + } + if (red_x > 100000L - red_y) + { + png_warning(png_ptr, "Invalid cHRM red point"); + ret = 0; + } + if (green_x > 100000L - green_y) + { + png_warning(png_ptr, "Invalid cHRM green point"); + ret = 0; + } + if (blue_x > 100000L - blue_y) + { + png_warning(png_ptr, "Invalid cHRM blue point"); + ret = 0; + } + + png_64bit_product(green_x - red_x, blue_y - red_y, &xy_hi, &xy_lo); + png_64bit_product(green_y - red_y, blue_x - red_x, &yx_hi, &yx_lo); + + if (xy_hi == yx_hi && xy_lo == yx_lo) + { + png_warning(png_ptr, + "Ignoring attempt to set cHRM RGB triangle with zero area"); + ret = 0; + } + + return ret; +} +#endif /* PNG_CHECK_cHRM_SUPPORTED */ +#endif /* PNG_cHRM_SUPPORTED */ + +void /* PRIVATE */ +png_check_IHDR(png_structp png_ptr, + png_uint_32 width, png_uint_32 height, int bit_depth, + int color_type, int interlace_type, int compression_type, + int filter_type) +{ + int error = 0; + + /* Check for width and height valid values */ + if (width == 0) + { + png_warning(png_ptr, "Image width is zero in IHDR"); + error = 1; + } + + if (height == 0) + { + png_warning(png_ptr, "Image height is zero in IHDR"); + error = 1; + } + +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + if (width > png_ptr->user_width_max || width > PNG_USER_WIDTH_MAX) +#else + if (width > PNG_USER_WIDTH_MAX) +#endif + { + png_warning(png_ptr, "Image width exceeds user limit in IHDR"); + error = 1; + } + +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + if (height > png_ptr->user_height_max || height > PNG_USER_HEIGHT_MAX) +#else + if (height > PNG_USER_HEIGHT_MAX) +#endif + { + png_warning(png_ptr, "Image height exceeds user limit in IHDR"); + error = 1; + } + + if (width > PNG_UINT_31_MAX) + { + png_warning(png_ptr, "Invalid image width in IHDR"); + error = 1; + } + + if ( height > PNG_UINT_31_MAX) + { + png_warning(png_ptr, "Invalid image height in IHDR"); + error = 1; + } + + if ( width > (PNG_UINT_32_MAX + >> 3) /* 8-byte RGBA pixels */ + - 64 /* bigrowbuf hack */ + - 1 /* filter byte */ + - 7*8 /* rounding of width to multiple of 8 pixels */ + - 8) /* extra max_pixel_depth pad */ + png_warning(png_ptr, "Width is too large for libpng to process pixels"); + + /* Check other values */ + if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && + bit_depth != 8 && bit_depth != 16) + { + png_warning(png_ptr, "Invalid bit depth in IHDR"); + error = 1; + } + + if (color_type < 0 || color_type == 1 || + color_type == 5 || color_type > 6) + { + png_warning(png_ptr, "Invalid color type in IHDR"); + error = 1; + } + + if (((color_type == PNG_COLOR_TYPE_PALETTE) && bit_depth > 8) || + ((color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8)) + { + png_warning(png_ptr, "Invalid color type/bit depth combination in IHDR"); + error = 1; + } + + if (interlace_type >= PNG_INTERLACE_LAST) + { + png_warning(png_ptr, "Unknown interlace method in IHDR"); + error = 1; + } + + if (compression_type != PNG_COMPRESSION_TYPE_BASE) + { + png_warning(png_ptr, "Unknown compression method in IHDR"); + error = 1; + } + +#ifdef PNG_MNG_FEATURES_SUPPORTED + /* Accept filter_method 64 (intrapixel differencing) only if + * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and + * 2. Libpng did not read a PNG signature (this filter_method is only + * used in PNG datastreams that are embedded in MNG datastreams) and + * 3. The application called png_permit_mng_features with a mask that + * included PNG_FLAG_MNG_FILTER_64 and + * 4. The filter_method is 64 and + * 5. The color_type is RGB or RGBA + */ + if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) && + png_ptr->mng_features_permitted) + png_warning(png_ptr, "MNG features are not allowed in a PNG datastream"); + + if (filter_type != PNG_FILTER_TYPE_BASE) + { + if (!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + (filter_type == PNG_INTRAPIXEL_DIFFERENCING) && + ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) == 0) && + (color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA))) + { + png_warning(png_ptr, "Unknown filter method in IHDR"); + error = 1; + } + + if (png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) + { + png_warning(png_ptr, "Invalid filter method in IHDR"); + error = 1; + } + } + +#else + if (filter_type != PNG_FILTER_TYPE_BASE) + { + png_warning(png_ptr, "Unknown filter method in IHDR"); + error = 1; + } +#endif + + if (error == 1) + png_error(png_ptr, "Invalid IHDR data"); +} +#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ diff --git a/png/png.h b/png/png.h new file mode 100644 index 0000000..842f3fc --- /dev/null +++ b/png/png.h @@ -0,0 +1,2701 @@ + +/* png.h - header file for PNG reference library + * + * libpng version 1.4.3 - June 26, 2010 + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license (See LICENSE, below) + * + * Authors and maintainers: + * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat + * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger + * libpng versions 0.97, January 1998, through 1.4.3 - June 26, 2010: Glenn + * See also "Contributing Authors", below. + * + * Note about libpng version numbers: + * + * Due to various miscommunications, unforeseen code incompatibilities + * and occasional factors outside the authors' control, version numbering + * on the library has not always been consistent and straightforward. + * The following table summarizes matters since version 0.89c, which was + * the first widely used release: + * + * source png.h png.h shared-lib + * version string int version + * ------- ------ ----- ---------- + * 0.89c "1.0 beta 3" 0.89 89 1.0.89 + * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] + * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] + * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] + * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] + * 0.97c 0.97 97 2.0.97 + * 0.98 0.98 98 2.0.98 + * 0.99 0.99 98 2.0.99 + * 0.99a-m 0.99 99 2.0.99 + * 1.00 1.00 100 2.1.0 [100 should be 10000] + * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] + * 1.0.1 png.h string is 10001 2.1.0 + * 1.0.1a-e identical to the 10002 from here on, the shared library + * 1.0.2 source version) 10002 is 2.V where V is the source code + * 1.0.2a-b 10003 version, except as noted. + * 1.0.3 10003 + * 1.0.3a-d 10004 + * 1.0.4 10004 + * 1.0.4a-f 10005 + * 1.0.5 (+ 2 patches) 10005 + * 1.0.5a-d 10006 + * 1.0.5e-r 10100 (not source compatible) + * 1.0.5s-v 10006 (not binary compatible) + * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) + * 1.0.6d-f 10007 (still binary incompatible) + * 1.0.6g 10007 + * 1.0.6h 10007 10.6h (testing xy.z so-numbering) + * 1.0.6i 10007 10.6i + * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) + * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) + * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) + * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) + * 1.0.7 1 10007 (still compatible) + * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 + * 1.0.8rc1 1 10008 2.1.0.8rc1 + * 1.0.8 1 10008 2.1.0.8 + * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 + * 1.0.9rc1 1 10009 2.1.0.9rc1 + * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 + * 1.0.9rc2 1 10009 2.1.0.9rc2 + * 1.0.9 1 10009 2.1.0.9 + * 1.0.10beta1 1 10010 2.1.0.10beta1 + * 1.0.10rc1 1 10010 2.1.0.10rc1 + * 1.0.10 1 10010 2.1.0.10 + * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 + * 1.0.11rc1 1 10011 2.1.0.11rc1 + * 1.0.11 1 10011 2.1.0.11 + * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 + * 1.0.12rc1 2 10012 2.1.0.12rc1 + * 1.0.12 2 10012 2.1.0.12 + * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned) + * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 + * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 + * 1.2.0rc1 3 10200 3.1.2.0rc1 + * 1.2.0 3 10200 3.1.2.0 + * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4 + * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 + * 1.2.1 3 10201 3.1.2.1 + * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 + * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 + * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 + * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 + * 1.0.13 10 10013 10.so.0.1.0.13 + * 1.2.2 12 10202 12.so.0.1.2.2 + * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 + * 1.2.3 12 10203 12.so.0.1.2.3 + * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 + * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1 + * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 + * 1.0.14 10 10014 10.so.0.1.0.14 + * 1.2.4 13 10204 12.so.0.1.2.4 + * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 + * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3 + * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3 + * 1.0.15 10 10015 10.so.0.1.0.15 + * 1.2.5 13 10205 12.so.0.1.2.5 + * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 + * 1.0.16 10 10016 10.so.0.1.0.16 + * 1.2.6 13 10206 12.so.0.1.2.6 + * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 + * 1.0.17rc1 10 10017 12.so.0.1.0.17rc1 + * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 + * 1.0.17 10 10017 12.so.0.1.0.17 + * 1.2.7 13 10207 12.so.0.1.2.7 + * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5 + * 1.0.18rc1-5 10 10018 12.so.0.1.0.18rc1-5 + * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5 + * 1.0.18 10 10018 12.so.0.1.0.18 + * 1.2.8 13 10208 12.so.0.1.2.8 + * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3 + * 1.2.9beta4-11 13 10209 12.so.0.9[.0] + * 1.2.9rc1 13 10209 12.so.0.9[.0] + * 1.2.9 13 10209 12.so.0.9[.0] + * 1.2.10beta1-7 13 10210 12.so.0.10[.0] + * 1.2.10rc1-2 13 10210 12.so.0.10[.0] + * 1.2.10 13 10210 12.so.0.10[.0] + * 1.4.0beta1-5 14 10400 14.so.0.0[.0] + * 1.2.11beta1-4 13 10211 12.so.0.11[.0] + * 1.4.0beta7-8 14 10400 14.so.0.0[.0] + * 1.2.11 13 10211 12.so.0.11[.0] + * 1.2.12 13 10212 12.so.0.12[.0] + * 1.4.0beta9-14 14 10400 14.so.0.0[.0] + * 1.2.13 13 10213 12.so.0.13[.0] + * 1.4.0beta15-36 14 10400 14.so.0.0[.0] + * 1.4.0beta37-87 14 10400 14.so.14.0[.0] + * 1.4.0rc01 14 10400 14.so.14.0[.0] + * 1.4.0beta88-109 14 10400 14.so.14.0[.0] + * 1.4.0rc02-08 14 10400 14.so.14.0[.0] + * 1.4.0 14 10400 14.so.14.0[.0] + * 1.4.1beta01-03 14 10401 14.so.14.1[.0] + * 1.4.1rc01 14 10401 14.so.14.1[.0] + * 1.4.1beta04-12 14 10401 14.so.14.1[.0] + * 1.4.1rc02-04 14 10401 14.so.14.1[.0] + * 1.4.1 14 10401 14.so.14.1[.0] + * 1.4.2beta01 14 10402 14.so.14.2[.0] + * 1.4.2rc02-06 14 10402 14.so.14.2[.0] + * 1.4.2 14 10402 14.so.14.2[.0] + * 1.4.3beta01-05 14 10403 14.so.14.3[.0] + * 1.4.3rc01-03 14 10403 14.so.14.3[.0] + * 1.4.3 14 10403 14.so.14.3[.0] + * + * Henceforth the source version will match the shared-library major + * and minor numbers; the shared-library major version number will be + * used for changes in backward compatibility, as it is intended. The + * PNG_LIBPNG_VER macro, which is not used within libpng but is available + * for applications, is an unsigned integer of the form xyyzz corresponding + * to the source version x.y.z (leading zeros in y and z). Beta versions + * were given the previous public release number plus a letter, until + * version 1.0.6j; from then on they were given the upcoming public + * release number plus "betaNN" or "rcN". + * + * Binary incompatibility exists only when applications make direct access + * to the info_ptr or png_ptr members through png.h, and the compiled + * application is loaded with a different version of the library. + * + * DLLNUM will change each time there are forward or backward changes + * in binary compatibility (e.g., when a new feature is added). + * + * See libpng.txt or libpng.3 for more information. The PNG specification + * is available as a W3C Recommendation and as an ISO Specification, + * defines should NOT be changed. + */ +#define PNG_INFO_gAMA 0x0001 +#define PNG_INFO_sBIT 0x0002 +#define PNG_INFO_cHRM 0x0004 +#define PNG_INFO_PLTE 0x0008 +#define PNG_INFO_tRNS 0x0010 +#define PNG_INFO_bKGD 0x0020 +#define PNG_INFO_hIST 0x0040 +#define PNG_INFO_pHYs 0x0080 +#define PNG_INFO_oFFs 0x0100 +#define PNG_INFO_tIME 0x0200 +#define PNG_INFO_pCAL 0x0400 +#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ +#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ +#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ +#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ +#define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */ + +/* This is used for the transformation routines, as some of them + * change these values for the row. It also should enable using + * the routines for other purposes. + */ +typedef struct png_row_info_struct +{ + png_uint_32 width; /* width of row */ + png_size_t rowbytes; /* number of bytes in row */ + png_byte color_type; /* color type of row */ + png_byte bit_depth; /* bit depth of row */ + png_byte channels; /* number of channels (1, 2, 3, or 4) */ + png_byte pixel_depth; /* bits per pixel (depth * channels) */ +} png_row_info; + +typedef png_row_info FAR * png_row_infop; +typedef png_row_info FAR * FAR * png_row_infopp; + +/* These are the function types for the I/O functions and for the functions + * that allow the user to override the default I/O functions with his or her + * own. The png_error_ptr type should match that of user-supplied warning + * and error functions, while the png_rw_ptr type should match that of the + * user read/write data functions. + */ +typedef struct png_struct_def png_struct; +typedef png_struct FAR * png_structp; + +typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp)); +typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t)); +typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp)); +typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32, + int)); +typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32, + int)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, + png_infop)); +typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop)); +typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep, + png_uint_32, int)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp, + png_row_infop, png_bytep)); +#endif + +#ifdef PNG_USER_CHUNKS_SUPPORTED +typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, + png_unknown_chunkp)); +#endif +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED +typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp)); +#endif +#ifdef PNG_SETJMP_SUPPORTED +/* This must match the function definition in , and the + * application must include this before png.h to obtain the definition + * of jmp_buf. + */ +typedef void (PNGAPI *png_longjmp_ptr) PNGARG((jmp_buf, int)); +#endif + +/* Transform masks for the high-level interface */ +#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ +#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ +#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ +#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ +#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ +#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ +#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ +#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ +#define PNG_TRANSFORM_BGR 0x0080 /* read and write */ +#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ +#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ +#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ +#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only */ +/* Added to libpng-1.2.34 */ +#define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER +#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */ +/* Added to libpng-1.4.0 */ +#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */ + +/* Flags for MNG supported features */ +#define PNG_FLAG_MNG_EMPTY_PLTE 0x01 +#define PNG_FLAG_MNG_FILTER_64 0x04 +#define PNG_ALL_MNG_FEATURES 0x05 + +typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_alloc_size_t)); +typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp)); + +/* The structure that holds the information to read and write PNG files. + * The only people who need to care about what is inside of this are the + * people who will be modifying the library for their own special needs. + * It should NOT be accessed directly by an application, except to store + * the jmp_buf. + */ + +struct png_struct_def +{ +#ifdef PNG_SETJMP_SUPPORTED + jmp_buf jmpbuf PNG_DEPSTRUCT; /* used in png_error */ + png_longjmp_ptr longjmp_fn PNG_DEPSTRUCT;/* setjmp non-local goto + function. */ +#endif + png_error_ptr error_fn PNG_DEPSTRUCT; /* function for printing + errors and aborting */ + png_error_ptr warning_fn PNG_DEPSTRUCT; /* function for printing + warnings */ + png_voidp error_ptr PNG_DEPSTRUCT; /* user supplied struct for + error functions */ + png_rw_ptr write_data_fn PNG_DEPSTRUCT; /* function for writing + output data */ + png_rw_ptr read_data_fn PNG_DEPSTRUCT; /* function for reading + input data */ + png_voidp io_ptr PNG_DEPSTRUCT; /* ptr to application struct + for I/O functions */ + +#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED + png_user_transform_ptr read_user_transform_fn PNG_DEPSTRUCT; /* user read + transform */ +#endif + +#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED + png_user_transform_ptr write_user_transform_fn PNG_DEPSTRUCT; /* user write + transform */ +#endif + +/* These were added in libpng-1.0.2 */ +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) + png_voidp user_transform_ptr PNG_DEPSTRUCT; /* user supplied struct + for user transform */ + png_byte user_transform_depth PNG_DEPSTRUCT; /* bit depth of user + transformed pixels */ + png_byte user_transform_channels PNG_DEPSTRUCT; /* channels in user + transformed pixels */ +#endif +#endif + + png_uint_32 mode PNG_DEPSTRUCT; /* tells us where we are in + the PNG file */ + png_uint_32 flags PNG_DEPSTRUCT; /* flags indicating various + things to libpng */ + png_uint_32 transformations PNG_DEPSTRUCT; /* which transformations + to perform */ + + z_stream zstream PNG_DEPSTRUCT; /* pointer to decompression + structure (below) */ + png_bytep zbuf PNG_DEPSTRUCT; /* buffer for zlib */ + png_size_t zbuf_size PNG_DEPSTRUCT; /* size of zbuf */ + int zlib_level PNG_DEPSTRUCT; /* holds zlib compression level */ + int zlib_method PNG_DEPSTRUCT; /* holds zlib compression method */ + int zlib_window_bits PNG_DEPSTRUCT; /* holds zlib compression window + bits */ + int zlib_mem_level PNG_DEPSTRUCT; /* holds zlib compression memory + level */ + int zlib_strategy PNG_DEPSTRUCT; /* holds zlib compression + strategy */ + + png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels */ + png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels */ + png_uint_32 num_rows PNG_DEPSTRUCT; /* number of rows in current pass */ + png_uint_32 usr_width PNG_DEPSTRUCT; /* width of row at start of write */ + png_size_t rowbytes PNG_DEPSTRUCT; /* size of row in bytes */ +#if 0 /* Replaced with the following in libpng-1.4.1 */ + png_size_t irowbytes PNG_DEPSTRUCT; +#endif +/* Added in libpng-1.4.1 */ +#ifdef PNG_USER_LIMITS_SUPPORTED + /* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk + * can occupy when decompressed. 0 means unlimited. + * We will change the typedef from png_size_t to png_alloc_size_t + * in libpng-1.6.0 + */ + png_alloc_size_t user_chunk_malloc_max PNG_DEPSTRUCT; +#endif + png_uint_32 iwidth PNG_DEPSTRUCT; /* width of current interlaced + row in pixels */ + png_uint_32 row_number PNG_DEPSTRUCT; /* current row in interlace pass */ + png_bytep prev_row PNG_DEPSTRUCT; /* buffer to save previous + (unfiltered) row */ + png_bytep row_buf PNG_DEPSTRUCT; /* buffer to save current + (unfiltered) row */ + png_bytep sub_row PNG_DEPSTRUCT; /* buffer to save "sub" row + when filtering */ + png_bytep up_row PNG_DEPSTRUCT; /* buffer to save "up" row + when filtering */ + png_bytep avg_row PNG_DEPSTRUCT; /* buffer to save "avg" row + when filtering */ + png_bytep paeth_row PNG_DEPSTRUCT; /* buffer to save "Paeth" row + when filtering */ + png_row_info row_info PNG_DEPSTRUCT; /* used for transformation + routines */ + + png_uint_32 idat_size PNG_DEPSTRUCT; /* current IDAT size for read */ + png_uint_32 crc PNG_DEPSTRUCT; /* current chunk CRC value */ + png_colorp palette PNG_DEPSTRUCT; /* palette from the input file */ + png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in + palette */ + png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparency values */ + png_byte chunk_name[5] PNG_DEPSTRUCT; /* null-terminated name of current + chunk */ + png_byte compression PNG_DEPSTRUCT; /* file compression type + (always 0) */ + png_byte filter PNG_DEPSTRUCT; /* file filter type (always 0) */ + png_byte interlaced PNG_DEPSTRUCT; /* PNG_INTERLACE_NONE, + PNG_INTERLACE_ADAM7 */ + png_byte pass PNG_DEPSTRUCT; /* current interlace pass (0 - 6) */ + png_byte do_filter PNG_DEPSTRUCT; /* row filter flags (see + PNG_FILTER_ below ) */ + png_byte color_type PNG_DEPSTRUCT; /* color type of file */ + png_byte bit_depth PNG_DEPSTRUCT; /* bit depth of file */ + png_byte usr_bit_depth PNG_DEPSTRUCT; /* bit depth of users row */ + png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */ + png_byte channels PNG_DEPSTRUCT; /* number of channels in file */ + png_byte usr_channels PNG_DEPSTRUCT; /* channels at start of write */ + png_byte sig_bytes PNG_DEPSTRUCT; /* magic bytes read/written from + start of file */ + +#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) + png_uint_16 filler PNG_DEPSTRUCT; /* filler bytes for pixel + expansion */ +#endif + +#ifdef PNG_bKGD_SUPPORTED + png_byte background_gamma_type PNG_DEPSTRUCT; +# ifdef PNG_FLOATING_POINT_SUPPORTED + float background_gamma PNG_DEPSTRUCT; +# endif + png_color_16 background PNG_DEPSTRUCT; /* background color in + screen gamma space */ +#ifdef PNG_READ_GAMMA_SUPPORTED + png_color_16 background_1 PNG_DEPSTRUCT; /* background normalized + to gamma 1.0 */ +#endif +#endif /* PNG_bKGD_SUPPORTED */ + +#ifdef PNG_WRITE_FLUSH_SUPPORTED + png_flush_ptr output_flush_fn PNG_DEPSTRUCT; /* Function for flushing + output */ + png_uint_32 flush_dist PNG_DEPSTRUCT; /* how many rows apart to flush, + 0 - no flush */ + png_uint_32 flush_rows PNG_DEPSTRUCT; /* number of rows written since + last flush */ +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + int gamma_shift PNG_DEPSTRUCT; /* number of "insignificant" bits + 16-bit gamma */ +#ifdef PNG_FLOATING_POINT_SUPPORTED + float gamma PNG_DEPSTRUCT; /* file gamma value */ + float screen_gamma PNG_DEPSTRUCT; /* screen gamma value + (display_exponent) */ +#endif +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_bytep gamma_table PNG_DEPSTRUCT; /* gamma table for 8-bit + depth files */ + png_bytep gamma_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to screen */ + png_bytep gamma_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */ + png_uint_16pp gamma_16_table PNG_DEPSTRUCT; /* gamma table for 16-bit + depth files */ + png_uint_16pp gamma_16_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to + screen */ + png_uint_16pp gamma_16_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */ +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED) + png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in each + available channel */ +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) + png_color_8 shift PNG_DEPSTRUCT; /* shift for significant bit + tranformation */ +#endif + +#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ + || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_bytep trans_alpha PNG_DEPSTRUCT; /* alpha values for + paletted files */ + png_color_16 trans_color PNG_DEPSTRUCT; /* transparent color for + non-paletted files */ +#endif + + png_read_status_ptr read_row_fn PNG_DEPSTRUCT; /* called after each + row is decoded */ + png_write_status_ptr write_row_fn PNG_DEPSTRUCT; /* called after each + row is encoded */ +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED + png_progressive_info_ptr info_fn PNG_DEPSTRUCT; /* called after header + data fully read */ + png_progressive_row_ptr row_fn PNG_DEPSTRUCT; /* called after each + prog. row is decoded */ + png_progressive_end_ptr end_fn PNG_DEPSTRUCT; /* called after image + is complete */ + png_bytep save_buffer_ptr PNG_DEPSTRUCT; /* current location in + save_buffer */ + png_bytep save_buffer PNG_DEPSTRUCT; /* buffer for previously + read data */ + png_bytep current_buffer_ptr PNG_DEPSTRUCT; /* current location in + current_buffer */ + png_bytep current_buffer PNG_DEPSTRUCT; /* buffer for recently + used data */ + png_uint_32 push_length PNG_DEPSTRUCT; /* size of current input + chunk */ + png_uint_32 skip_length PNG_DEPSTRUCT; /* bytes to skip in + input data */ + png_size_t save_buffer_size PNG_DEPSTRUCT; /* amount of data now + in save_buffer */ + png_size_t save_buffer_max PNG_DEPSTRUCT; /* total size of + save_buffer */ + png_size_t buffer_size PNG_DEPSTRUCT; /* total amount of + available input data */ + png_size_t current_buffer_size PNG_DEPSTRUCT; /* amount of data now + in current_buffer */ + int process_mode PNG_DEPSTRUCT; /* what push library + is currently doing */ + int cur_palette PNG_DEPSTRUCT; /* current push library + palette index */ + +# ifdef PNG_TEXT_SUPPORTED + png_size_t current_text_size PNG_DEPSTRUCT; /* current size of + text input data */ + png_size_t current_text_left PNG_DEPSTRUCT; /* how much text left + to read in input */ + png_charp current_text PNG_DEPSTRUCT; /* current text chunk + buffer */ + png_charp current_text_ptr PNG_DEPSTRUCT; /* current location + in current_text */ +# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */ + +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) +/* For the Borland special 64K segment handler */ + png_bytepp offset_table_ptr PNG_DEPSTRUCT; + png_bytep offset_table PNG_DEPSTRUCT; + png_uint_16 offset_table_number PNG_DEPSTRUCT; + png_uint_16 offset_table_count PNG_DEPSTRUCT; + png_uint_16 offset_table_count_free PNG_DEPSTRUCT; +#endif + +#ifdef PNG_READ_QUANTIZE_SUPPORTED + png_bytep palette_lookup PNG_DEPSTRUCT; /* lookup table for quantizing */ + png_bytep quantize_index PNG_DEPSTRUCT; /* index translation for palette + files */ +#endif + +#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED) + png_uint_16p hist PNG_DEPSTRUCT; /* histogram */ +#endif + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + png_byte heuristic_method PNG_DEPSTRUCT; /* heuristic for row + filter selection */ + png_byte num_prev_filters PNG_DEPSTRUCT; /* number of weights + for previous rows */ + png_bytep prev_filters PNG_DEPSTRUCT; /* filter type(s) of + previous row(s) */ + png_uint_16p filter_weights PNG_DEPSTRUCT; /* weight(s) for previous + line(s) */ + png_uint_16p inv_filter_weights PNG_DEPSTRUCT; /* 1/weight(s) for + previous line(s) */ + png_uint_16p filter_costs PNG_DEPSTRUCT; /* relative filter + calculation cost */ + png_uint_16p inv_filter_costs PNG_DEPSTRUCT; /* 1/relative filter + calculation cost */ +#endif + +#ifdef PNG_TIME_RFC1123_SUPPORTED + png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */ +#endif + +/* New members added in libpng-1.0.6 */ + + png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is + responsible for freeing */ + +#ifdef PNG_USER_CHUNKS_SUPPORTED + png_voidp user_chunk_ptr PNG_DEPSTRUCT; + png_user_chunk_ptr read_user_chunk_fn PNG_DEPSTRUCT; /* user read + chunk handler */ +#endif + +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + int num_chunk_list PNG_DEPSTRUCT; + png_bytep chunk_list PNG_DEPSTRUCT; +#endif + +/* New members added in libpng-1.0.3 */ +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED + png_byte rgb_to_gray_status PNG_DEPSTRUCT; + /* These were changed from png_byte in libpng-1.0.6 */ + png_uint_16 rgb_to_gray_red_coeff PNG_DEPSTRUCT; + png_uint_16 rgb_to_gray_green_coeff PNG_DEPSTRUCT; + png_uint_16 rgb_to_gray_blue_coeff PNG_DEPSTRUCT; +#endif + +/* New member added in libpng-1.0.4 (renamed in 1.0.9) */ +#if defined(PNG_MNG_FEATURES_SUPPORTED) || \ + defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ + defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) +/* Changed from png_byte to png_uint_32 at version 1.2.0 */ + png_uint_32 mng_features_permitted PNG_DEPSTRUCT; +#endif + +/* New member added in libpng-1.0.7 */ +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_fixed_point int_gamma PNG_DEPSTRUCT; +#endif + +/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */ +#ifdef PNG_MNG_FEATURES_SUPPORTED + png_byte filter_type PNG_DEPSTRUCT; +#endif + +/* New members added in libpng-1.2.0 */ + +/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ +#ifdef PNG_USER_MEM_SUPPORTED + png_voidp mem_ptr PNG_DEPSTRUCT; /* user supplied struct for + mem functions */ + png_malloc_ptr malloc_fn PNG_DEPSTRUCT; /* function for + allocating memory */ + png_free_ptr free_fn PNG_DEPSTRUCT; /* function for + freeing memory */ +#endif + +/* New member added in libpng-1.0.13 and 1.2.0 */ + png_bytep big_row_buf PNG_DEPSTRUCT; /* buffer to save current + (unfiltered) row */ + +#ifdef PNG_READ_QUANTIZE_SUPPORTED +/* The following three members were added at version 1.0.14 and 1.2.4 */ + png_bytep quantize_sort PNG_DEPSTRUCT; /* working sort array */ + png_bytep index_to_palette PNG_DEPSTRUCT; /* where the original + index currently is + in the palette */ + png_bytep palette_to_index PNG_DEPSTRUCT; /* which original index + points to this + palette color */ +#endif + +/* New members added in libpng-1.0.16 and 1.2.6 */ + png_byte compression_type PNG_DEPSTRUCT; + +#ifdef PNG_USER_LIMITS_SUPPORTED + png_uint_32 user_width_max PNG_DEPSTRUCT; + png_uint_32 user_height_max PNG_DEPSTRUCT; + /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown + * chunks that can be stored (0 means unlimited). + */ + png_uint_32 user_chunk_cache_max PNG_DEPSTRUCT; +#endif + +/* New member added in libpng-1.0.25 and 1.2.17 */ +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED + /* Storage for unknown chunk that the library doesn't recognize. */ + png_unknown_chunk unknown_chunk PNG_DEPSTRUCT; +#endif + +/* New members added in libpng-1.2.26 */ + png_uint_32 old_big_row_buf_size PNG_DEPSTRUCT; + png_uint_32 old_prev_row_size PNG_DEPSTRUCT; + +/* New member added in libpng-1.2.30 */ + png_charp chunkdata PNG_DEPSTRUCT; /* buffer for reading chunk data */ + +#ifdef PNG_IO_STATE_SUPPORTED +/* New member added in libpng-1.4.0 */ + png_uint_32 io_state PNG_DEPSTRUCT; +#endif +}; + + +/* This triggers a compiler error in png.c, if png.c and png.h + * do not agree upon the version number. + */ +typedef png_structp version_1_4_3; + +typedef png_struct FAR * FAR * png_structpp; + +/* Here are the function definitions most commonly used. This is not + * the place to find out how to use libpng. See libpng.txt for the + * full explanation, see example.c for the summary. This just provides + * a simple one line description of the use of each function. + */ + +/* Returns the version number of the library */ +extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void)); + +/* Tell lib we have already handled the first magic bytes. + * Handling more than 8 bytes from the beginning of the file is an error. + */ +extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr, + int num_bytes)); + +/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a + * PNG file. Returns zero if the supplied bytes match the 8-byte PNG + * signature, and non-zero otherwise. Having num_to_check == 0 or + * start > 7 will always fail (ie return non-zero). + */ +extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start, + png_size_t num_to_check)); + +/* Simple signature checking function. This is the same as calling + * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). + */ +#define png_check_sig(sig,n) !png_sig_cmp((sig), 0, (n)) + +/* Allocate and initialize png_ptr struct for reading, and any other memory. */ +extern PNG_EXPORT(png_structp,png_create_read_struct) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED; + +/* Allocate and initialize png_ptr struct for writing, and any other memory */ +extern PNG_EXPORT(png_structp,png_create_write_struct) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED; + +extern PNG_EXPORT(png_size_t,png_get_compression_buffer_size) + PNGARG((png_structp png_ptr)); + +extern PNG_EXPORT(void,png_set_compression_buffer_size) + PNGARG((png_structp png_ptr, png_size_t size)); + +/* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp + * match up. + */ +#ifdef PNG_SETJMP_SUPPORTED +/* This function returns the jmp_buf built in to *png_ptr. It must be + * supplied with an appropriate 'longjmp' function to use on that jmp_buf + * unless the default error function is overridden in which case NULL is + * acceptable. The size of the jmp_buf is checked against the actual size + * allocated by the library - the call will return NULL on a mismatch + * indicating an ABI mismatch. + */ +extern PNG_EXPORT(jmp_buf*, png_set_longjmp_fn) + PNGARG((png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t + jmp_buf_size)); +# define png_jmpbuf(png_ptr) \ + (*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf))) +#else +# define png_jmpbuf(png_ptr) \ + (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) +#endif + +#ifdef PNG_READ_SUPPORTED +/* Reset the compression stream */ +extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr)); +#endif + +/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ +#ifdef PNG_USER_MEM_SUPPORTED +extern PNG_EXPORT(png_structp,png_create_read_struct_2) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn)) PNG_ALLOCATED; +extern PNG_EXPORT(png_structp,png_create_write_struct_2) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn)) PNG_ALLOCATED; +#endif + +/* Write the PNG file signature. */ +extern PNG_EXPORT(void,png_write_sig) PNGARG((png_structp png_ptr)); + +/* Write a PNG chunk - size, type, (optional) data, CRC. */ +extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr, + png_bytep chunk_name, png_bytep data, png_size_t length)); + +/* Write the start of a PNG chunk - length and chunk name. */ +extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr, + png_bytep chunk_name, png_uint_32 length)); + +/* Write the data of a PNG chunk started with png_write_chunk_start(). */ +extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +/* Finish a chunk started with png_write_chunk_start() (includes CRC). */ +extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr)); + +/* Allocate and initialize the info structure */ +extern PNG_EXPORT(png_infop,png_create_info_struct) + PNGARG((png_structp png_ptr)) PNG_ALLOCATED; + +extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr, + png_size_t png_info_struct_size)); + +/* Writes all the PNG information before the image. */ +extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +/* Read the information before the actual image data. */ +extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +#ifdef PNG_TIME_RFC1123_SUPPORTED +extern PNG_EXPORT(png_charp,png_convert_to_rfc1123) + PNGARG((png_structp png_ptr, png_timep ptime)); +#endif + +#ifdef PNG_CONVERT_tIME_SUPPORTED +/* Convert from a struct tm to png_time */ +extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime, + struct tm FAR * ttime)); + +/* Convert from time_t to png_time. Uses gmtime() */ +extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime, + time_t ttime)); +#endif /* PNG_CONVERT_tIME_SUPPORTED */ + +#ifdef PNG_READ_EXPAND_SUPPORTED +/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ +extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp + png_ptr)); +extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) +/* Use blue, green, red order for pixels. */ +extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED +/* Expand the grayscale to 24-bit RGB if necessary. */ +extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED +/* Reduce RGB to grayscale. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr, + int error_action, double red, double green )); +#endif +extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr, + int error_action, png_fixed_point red, png_fixed_point green )); +extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp + png_ptr)); +#endif + +extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, + png_colorp palette)); + +#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED +extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ + defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ + defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) +/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ +extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr, + png_uint_32 filler, int flags)); +/* The values of the PNG_FILLER_ defines should NOT be changed */ +#define PNG_FILLER_BEFORE 0 +#define PNG_FILLER_AFTER 1 +/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ +extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr, + png_uint_32 filler, int flags)); +#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ + +#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) +/* Swap bytes in 16-bit depth files. */ +extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) +/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ +extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ + defined(PNG_WRITE_PACKSWAP_SUPPORTED) +/* Swap packing order of pixels in bytes. */ +extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) +/* Converts files to legal bit depths. */ +extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr, + png_color_8p true_bits)); +#endif + +#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ + defined(PNG_WRITE_INTERLACING_SUPPORTED) +/* Have the code handle the interlacing. Returns the number of passes. */ +extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) +/* Invert monochrome files */ +extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_READ_BACKGROUND_SUPPORTED +/* Handle alpha and tRNS by replacing with a background color. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr, + png_color_16p background_color, int background_gamma_code, + int need_expand, double background_gamma)); +#endif +#define PNG_BACKGROUND_GAMMA_UNKNOWN 0 +#define PNG_BACKGROUND_GAMMA_SCREEN 1 +#define PNG_BACKGROUND_GAMMA_FILE 2 +#define PNG_BACKGROUND_GAMMA_UNIQUE 3 +#endif + +#ifdef PNG_READ_16_TO_8_SUPPORTED +/* Strip the second byte of information from a 16-bit depth file. */ +extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_READ_QUANTIZE_SUPPORTED +/* Turn on quantizing, and reduce the palette to the number of colors + * available. Prior to libpng-1.4.2, this was png_set_dither(). + */ +extern PNG_EXPORT(void,png_set_quantize) PNGARG((png_structp png_ptr, + png_colorp palette, int num_palette, int maximum_colors, + png_uint_16p histogram, int full_quantize)); +#endif +/* This migration aid will be removed from libpng-1.5.0 */ +#define png_set_dither png_set_quantize + +#ifdef PNG_READ_GAMMA_SUPPORTED +/* Handle gamma correction. Screen_gamma=(display_exponent) */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr, + double screen_gamma, double default_file_gamma)); +#endif +#endif + + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +/* Set how many lines between output flushes - 0 for no flushing */ +extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows)); +/* Flush the current PNG output buffer */ +extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr)); +#endif + +/* Optional update palette with requested transformations */ +extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); + +/* Optional call to update the users info structure */ +extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +/* Read one or more rows of image data. */ +extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, + png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); +#endif + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +/* Read a row of data. */ +extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, + png_bytep row, + png_bytep display_row)); +#endif + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +/* Read the whole image into memory at once. */ +extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, + png_bytepp image)); +#endif + +/* Write a row of image data */ +extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr, + png_bytep row)); + +/* Write a few rows of image data */ +extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr, + png_bytepp row, png_uint_32 num_rows)); + +/* Write the image data */ +extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, + png_bytepp image)); + +/* Write the end of the PNG file. */ +extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +/* Read the end of the PNG file. */ +extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +/* Free any memory associated with the png_info_struct */ +extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr, + png_infopp info_ptr_ptr)); + +/* Free any memory associated with the png_struct and the png_info_structs */ +extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp + png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); + +/* Free any memory associated with the png_struct and the png_info_structs */ +extern PNG_EXPORT(void,png_destroy_write_struct) + PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); + +/* Set the libpng method of handling chunk CRC errors */ +extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr, + int crit_action, int ancil_action)); + +/* Values for png_set_crc_action() to say how to handle CRC errors in + * ancillary and critical chunks, and whether to use the data contained + * therein. Note that it is impossible to "discard" data in a critical + * chunk. For versions prior to 0.90, the action was always error/quit, + * whereas in version 0.90 and later, the action for CRC errors in ancillary + * chunks is warn/discard. These values should NOT be changed. + * + * value action:critical action:ancillary + */ +#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ +#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ +#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ +#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ +#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ +#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ + +/* These functions give the user control over the scan-line filtering in + * libpng and the compression methods used by zlib. These functions are + * mainly useful for testing, as the defaults should work with most users. + * Those users who are tight on memory or want faster performance at the + * expense of compression can modify them. See the compression library + * header file (zlib.h) for an explination of the compression functions. + */ + +/* Set the filtering method(s) used by libpng. Currently, the only valid + * value for "method" is 0. + */ +extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, + int filters)); + +/* Flags for png_set_filter() to say which filters to use. The flags + * are chosen so that they don't conflict with real filter types + * below, in case they are supplied instead of the #defined constants. + * These values should NOT be changed. + */ +#define PNG_NO_FILTERS 0x00 +#define PNG_FILTER_NONE 0x08 +#define PNG_FILTER_SUB 0x10 +#define PNG_FILTER_UP 0x20 +#define PNG_FILTER_AVG 0x40 +#define PNG_FILTER_PAETH 0x80 +#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ + PNG_FILTER_AVG | PNG_FILTER_PAETH) + +/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. + * These defines should NOT be changed. + */ +#define PNG_FILTER_VALUE_NONE 0 +#define PNG_FILTER_VALUE_SUB 1 +#define PNG_FILTER_VALUE_UP 2 +#define PNG_FILTER_VALUE_AVG 3 +#define PNG_FILTER_VALUE_PAETH 4 +#define PNG_FILTER_VALUE_LAST 5 + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */ +/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ + * defines, either the default (minimum-sum-of-absolute-differences), or + * the experimental method (weighted-minimum-sum-of-absolute-differences). + * + * Weights are factors >= 1.0, indicating how important it is to keep the + * filter type consistent between rows. Larger numbers mean the current + * filter is that many times as likely to be the same as the "num_weights" + * previous filters. This is cumulative for each previous row with a weight. + * There needs to be "num_weights" values in "filter_weights", or it can be + * NULL if the weights aren't being specified. Weights have no influence on + * the selection of the first row filter. Well chosen weights can (in theory) + * improve the compression for a given image. + * + * Costs are factors >= 1.0 indicating the relative decoding costs of a + * filter type. Higher costs indicate more decoding expense, and are + * therefore less likely to be selected over a filter with lower computational + * costs. There needs to be a value in "filter_costs" for each valid filter + * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't + * setting the costs. Costs try to improve the speed of decompression without + * unduly increasing the compressed image size. + * + * A negative weight or cost indicates the default value is to be used, and + * values in the range [0.0, 1.0) indicate the value is to remain unchanged. + * The default values for both weights and costs are currently 1.0, but may + * change if good general weighting/cost heuristics can be found. If both + * the weights and costs are set to 1.0, this degenerates the WEIGHTED method + * to the UNWEIGHTED method, but with added encoding time/computation. + */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, + int heuristic_method, int num_weights, png_doublep filter_weights, + png_doublep filter_costs)); +#endif +#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ + +/* Heuristic used for row filter selection. These defines should NOT be + * changed. + */ +#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ +#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ +#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ +#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ + +/* Set the library compression level. Currently, valid values range from + * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 + * (0 - no compression, 9 - "maximal" compression). Note that tests have + * shown that zlib compression levels 3-6 usually perform as well as level 9 + * for PNG images, and do considerably fewer caclulations. In the future, + * these values may not correspond directly to the zlib compression levels. + */ +extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr, + int level)); + +extern PNG_EXPORT(void,png_set_compression_mem_level) + PNGARG((png_structp png_ptr, int mem_level)); + +extern PNG_EXPORT(void,png_set_compression_strategy) + PNGARG((png_structp png_ptr, int strategy)); + +extern PNG_EXPORT(void,png_set_compression_window_bits) + PNGARG((png_structp png_ptr, int window_bits)); + +extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr, + int method)); + +/* These next functions are called for input/output, memory, and error + * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, + * and call standard C I/O routines such as fread(), fwrite(), and + * fprintf(). These functions can be made to use other I/O routines + * at run time for those applications that need to handle I/O in a + * different manner by calling png_set_???_fn(). See libpng.txt for + * more information. + */ + +#ifdef PNG_STDIO_SUPPORTED +/* Initialize the input/output for the PNG file to the default functions. */ +extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, + png_FILE_p fp)); +#endif + +/* Replace the (error and abort), and warning functions with user + * supplied functions. If no messages are to be printed you must still + * write and use replacement functions. The replacement error_fn should + * still do a longjmp to the last setjmp location if you are using this + * method of error handling. If error_fn or warning_fn is NULL, the + * default function will be used. + */ + +extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, + png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); + +/* Return the user pointer associated with the error functions */ +extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); + +/* Replace the default data output functions with a user supplied one(s). + * If buffered output is not used, then output_flush_fn can be set to NULL. + * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time + * output_flush_fn will be ignored (and thus can be NULL). + * It is probably a mistake to use NULL for output_flush_fn if + * write_data_fn is not also NULL unless you have built libpng with + * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's + * default flush function, which uses the standard *FILE structure, will + * be used. + */ +extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, + png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); + +/* Replace the default data input function with a user supplied one. */ +extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr, + png_voidp io_ptr, png_rw_ptr read_data_fn)); + +/* Return the user pointer associated with the I/O functions */ +extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr)); + +extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr, + png_read_status_ptr read_row_fn)); + +extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, + png_write_status_ptr write_row_fn)); + +#ifdef PNG_USER_MEM_SUPPORTED +/* Replace the default memory allocation functions with user supplied one(s). */ +extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, + png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +/* Return the user pointer associated with the memory functions */ +extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED +extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp + png_ptr, png_user_transform_ptr read_user_transform_fn)); +#endif + +#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED +extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp + png_ptr, png_user_transform_ptr write_user_transform_fn)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp + png_ptr, png_voidp user_transform_ptr, int user_transform_depth, + int user_transform_channels)); +/* Return the user pointer associated with the user transform functions */ +extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr) + PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_USER_CHUNKS_SUPPORTED +extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr, + png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); +extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp + png_ptr)); +#endif + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +/* Sets the function callbacks for the push reader, and a pointer to a + * user-defined structure available to the callback functions. + */ +extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, + png_voidp progressive_ptr, + png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, + png_progressive_end_ptr end_fn)); + +/* Returns the user pointer associated with the push read functions */ +extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) + PNGARG((png_structp png_ptr)); + +/* Function to be called when data becomes available */ +extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); + +/* Function that combines rows. Not very much different than the + * png_combine_row() call. Is this even used????? + */ +extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, + png_bytep old_row, png_bytep new_row)); +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr, + png_alloc_size_t size)) PNG_ALLOCATED; +/* Added at libpng version 1.4.0 */ +extern PNG_EXPORT(png_voidp,png_calloc) PNGARG((png_structp png_ptr, + png_alloc_size_t size)) PNG_ALLOCATED; + +/* Added at libpng version 1.2.4 */ +extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr, + png_alloc_size_t size)) PNG_ALLOCATED; + +/* Frees a pointer allocated by png_malloc() */ +extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); + +/* Free data that was allocated internally */ +extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 free_me, int num)); +/* Reassign responsibility for freeing existing data, whether allocated + * by libpng or by the application */ +extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, + png_infop info_ptr, int freer, png_uint_32 mask)); +/* Assignments for png_data_freer */ +#define PNG_DESTROY_WILL_FREE_DATA 1 +#define PNG_SET_WILL_FREE_DATA 1 +#define PNG_USER_WILL_FREE_DATA 2 +/* Flags for png_ptr->free_me and info_ptr->free_me */ +#define PNG_FREE_HIST 0x0008 +#define PNG_FREE_ICCP 0x0010 +#define PNG_FREE_SPLT 0x0020 +#define PNG_FREE_ROWS 0x0040 +#define PNG_FREE_PCAL 0x0080 +#define PNG_FREE_SCAL 0x0100 +#define PNG_FREE_UNKN 0x0200 +#define PNG_FREE_LIST 0x0400 +#define PNG_FREE_PLTE 0x1000 +#define PNG_FREE_TRNS 0x2000 +#define PNG_FREE_TEXT 0x4000 +#define PNG_FREE_ALL 0x7fff +#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ + +#ifdef PNG_USER_MEM_SUPPORTED +extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, + png_alloc_size_t size)) PNG_ALLOCATED; +extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr, + png_voidp ptr)); +#endif + +#ifndef PNG_NO_ERROR_TEXT +/* Fatal error in PNG image of libpng - can't continue */ +extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, + png_const_charp error_message)) PNG_NORETURN; + +/* The same, but the chunk name is prepended to the error string. */ +extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, + png_const_charp error_message)) PNG_NORETURN; + +#else +/* Fatal error in PNG image of libpng - can't continue */ +extern PNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr)) PNG_NORETURN; +#endif + +/* Non-fatal error in libpng. Can continue, but may have a problem. */ +extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, + png_const_charp warning_message)); + +/* Non-fatal error in libpng, chunk name is prepended to message. */ +extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, + png_const_charp warning_message)); + +#ifdef PNG_BENIGN_ERRORS_SUPPORTED +/* Benign error in libpng. Can continue, but may have a problem. + * User can choose whether to handle as a fatal error or as a warning. */ +extern PNG_EXPORT(void,png_benign_error) PNGARG((png_structp png_ptr, + png_const_charp warning_message)); + +/* Same, chunk name is prepended to message. */ +extern PNG_EXPORT(void,png_chunk_benign_error) PNGARG((png_structp png_ptr, + png_const_charp warning_message)); + +extern PNG_EXPORT(void,png_set_benign_errors) PNGARG((png_structp + png_ptr, int allowed)); +#endif + +/* The png_set_ functions are for storing values in the png_info_struct. + * Similarly, the png_get_ calls are used to read values from the + * png_info_struct, either storing the parameters in the passed variables, or + * setting pointers into the png_info_struct where the data is stored. The + * png_get_ functions return a non-zero value if the data was available + * in info_ptr, or return zero and do not change any of the parameters if the + * data was not available. + * + * These functions should be used instead of directly accessing png_info + * to avoid problems with future changes in the size and internal layout of + * png_info_struct. + */ +/* Returns "flag" if chunk data is valid in info_ptr. */ +extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr, +png_infop info_ptr, png_uint_32 flag)); + +/* Returns number of bytes needed to hold a transformed row. */ +extern PNG_EXPORT(png_size_t,png_get_rowbytes) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#ifdef PNG_INFO_IMAGE_SUPPORTED +/* Returns row_pointers, which is an array of pointers to scanlines that was + * returned from png_read_png(). + */ +extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr, +png_infop info_ptr)); +/* Set row_pointers, which is an array of pointers to scanlines for use + * by png_write_png(). + */ +extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytepp row_pointers)); +#endif + +/* Returns number of color channels in image. */ +extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#ifdef PNG_EASY_ACCESS_SUPPORTED +/* Returns image width in pixels. */ +extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image height in pixels. */ +extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image bit_depth. */ +extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image color_type. */ +extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image filter_type. */ +extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image interlace_type. */ +extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image compression_type. */ +extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image resolution in pixels per meter, from pHYs chunk data. */ +extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns pixel aspect ratio, computed from pHYs chunk data. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +#endif + +/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ +extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +#endif /* PNG_EASY_ACCESS_SUPPORTED */ + +/* Returns pointer to signature string read from PNG header */ +extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#ifdef PNG_bKGD_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_16p *background)); +#endif + +#ifdef PNG_bKGD_SUPPORTED +extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_16p background)); +#endif + +#ifdef PNG_cHRM_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr, + png_infop info_ptr, double *white_x, double *white_y, double *red_x, + double *red_y, double *green_x, double *green_y, double *blue_x, + double *blue_y)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point + *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, + png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point + *int_blue_x, png_fixed_point *int_blue_y)); +#endif +#endif + +#ifdef PNG_cHRM_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr, + png_infop info_ptr, double white_x, double white_y, double red_x, + double red_y, double green_x, double green_y, double blue_x, double blue_y)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, + png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point + int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, + png_fixed_point int_blue_y)); +#endif +#endif + +#ifdef PNG_gAMA_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr, + png_infop info_ptr, double *file_gamma)); +#endif +extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point *int_file_gamma)); +#endif + +#ifdef PNG_gAMA_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, + png_infop info_ptr, double file_gamma)); +#endif +extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_file_gamma)); +#endif + +#ifdef PNG_hIST_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_16p *hist)); +#endif + +#ifdef PNG_hIST_SUPPORTED +extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_16p hist)); +#endif + +extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, + int *bit_depth, int *color_type, int *interlace_method, + int *compression_method, int *filter_method)); + +extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, + int color_type, int interlace_method, int compression_method, + int filter_method)); + +#ifdef PNG_oFFs_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, + int *unit_type)); +#endif + +#ifdef PNG_oFFs_SUPPORTED +extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, + int unit_type)); +#endif + +#ifdef PNG_pCAL_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, + int *type, int *nparams, png_charp *units, png_charpp *params)); +#endif + +#ifdef PNG_pCAL_SUPPORTED +extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, + int type, int nparams, png_charp units, png_charpp params)); +#endif + +#ifdef PNG_pHYs_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); +#endif + +#ifdef PNG_pHYs_SUPPORTED +extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); +#endif + +extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_colorp *palette, int *num_palette)); + +extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_colorp palette, int num_palette)); + +#ifdef PNG_sBIT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_8p *sig_bit)); +#endif + +#ifdef PNG_sBIT_SUPPORTED +extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_8p sig_bit)); +#endif + +#ifdef PNG_sRGB_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *intent)); +#endif + +#ifdef PNG_sRGB_SUPPORTED +extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, + png_infop info_ptr, int intent)); +extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, + png_infop info_ptr, int intent)); +#endif + +#ifdef PNG_iCCP_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charpp name, int *compression_type, + png_charpp profile, png_uint_32 *proflen)); + /* Note to maintainer: profile should be png_bytepp */ +#endif + +#ifdef PNG_iCCP_SUPPORTED +extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charp name, int compression_type, + png_charp profile, png_uint_32 proflen)); + /* Note to maintainer: profile should be png_bytep */ +#endif + +#ifdef PNG_sPLT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_sPLT_tpp entries)); +#endif + +#ifdef PNG_sPLT_SUPPORTED +extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_sPLT_tp entries, int nentries)); +#endif + +#ifdef PNG_TEXT_SUPPORTED +/* png_get_text also returns the number of text chunks in *num_text */ +extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp *text_ptr, int *num_text)); +#endif + +/* Note while png_set_text() will accept a structure whose text, + * language, and translated keywords are NULL pointers, the structure + * returned by png_get_text will always contain regular + * zero-terminated C strings. They might be empty strings but + * they will never be NULL pointers. + */ + +#ifdef PNG_TEXT_SUPPORTED +extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp text_ptr, int num_text)); +#endif + +#ifdef PNG_tIME_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_timep *mod_time)); +#endif + +#ifdef PNG_tIME_SUPPORTED +extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_timep mod_time)); +#endif + +#ifdef PNG_tRNS_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep *trans_alpha, int *num_trans, + png_color_16p *trans_color)); +#endif + +#ifdef PNG_tRNS_SUPPORTED +extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep trans_alpha, int num_trans, + png_color_16p trans_color)); +#endif + +#ifdef PNG_tRNS_SUPPORTED +#endif + +#ifdef PNG_sCAL_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *unit, double *width, double *height)); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); +#endif +#endif +#endif /* PNG_sCAL_SUPPORTED */ + +#ifdef PNG_sCAL_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, int unit, double width, double height)); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr, + png_infop info_ptr, int unit, png_charp swidth, png_charp sheight)); +#endif +#endif +#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */ + +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +/* Provide a list of chunks and how they are to be handled, if the built-in + handling or default unknown chunk handling is not desired. Any chunks not + listed will be handled in the default manner. The IHDR and IEND chunks + must not be listed. + keep = 0: follow default behaviour + = 1: do not keep + = 2: keep only if safe-to-copy + = 3: keep even if unsafe-to-copy +*/ +extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp + png_ptr, int keep, png_bytep chunk_list, int num_chunks)); +PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep + chunk_name)); +#endif +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED +extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)); +extern PNG_EXPORT(void, png_set_unknown_chunk_location) + PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location)); +extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp + png_ptr, png_infop info_ptr, png_unknown_chunkpp entries)); +#endif + +/* Png_free_data() will turn off the "valid" flag for anything it frees. + * If you need to turn it off for a chunk that your application has freed, + * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); + */ +extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr, + png_infop info_ptr, int mask)); + +#ifdef PNG_INFO_IMAGE_SUPPORTED +/* The "params" pointer is currently not used and is for future expansion. */ +extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, + png_infop info_ptr, + int transforms, + png_voidp params)); +extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, + png_infop info_ptr, + int transforms, + png_voidp params)); +#endif + +extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp + png_ptr)); +extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); + +#ifdef PNG_MNG_FEATURES_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp + png_ptr, png_uint_32 mng_features_permitted)); +#endif + +/* For use in png_set_keep_unknown, added to version 1.2.6 */ +#define PNG_HANDLE_CHUNK_AS_DEFAULT 0 +#define PNG_HANDLE_CHUNK_NEVER 1 +#define PNG_HANDLE_CHUNK_IF_SAFE 2 +#define PNG_HANDLE_CHUNK_ALWAYS 3 + +/* Strip the prepended error numbers ("#nnn ") from error and warning + * messages before passing them to the error or warning handler. + */ +#ifdef PNG_ERROR_NUMBERS_SUPPORTED +extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp + png_ptr, png_uint_32 strip_mode)); +#endif + +/* Added in libpng-1.2.6 */ +#ifdef PNG_SET_USER_LIMITS_SUPPORTED +extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp + png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); +extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp + png_ptr)); +extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp + png_ptr)); +/* Added in libpng-1.4.0 */ +extern PNG_EXPORT(void,png_set_chunk_cache_max) PNGARG((png_structp + png_ptr, png_uint_32 user_chunk_cache_max)); +extern PNG_EXPORT(png_uint_32,png_get_chunk_cache_max) + PNGARG((png_structp png_ptr)); +/* Added in libpng-1.4.1 */ +extern PNG_EXPORT(void,png_set_chunk_malloc_max) PNGARG((png_structp + png_ptr, png_alloc_size_t user_chunk_cache_max)); +extern PNG_EXPORT(png_alloc_size_t,png_get_chunk_malloc_max) + PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) +PNG_EXPORT(png_uint_32,png_get_pixels_per_inch) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +PNG_EXPORT(png_uint_32,png_get_x_pixels_per_inch) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +PNG_EXPORT(png_uint_32,png_get_y_pixels_per_inch) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +PNG_EXPORT(float,png_get_x_offset_inches) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +PNG_EXPORT(float,png_get_y_offset_inches) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#ifdef PNG_pHYs_SUPPORTED +PNG_EXPORT(png_uint_32,png_get_pHYs_dpi) PNGARG((png_structp png_ptr, +png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); +#endif /* PNG_pHYs_SUPPORTED */ +#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ + +/* Added in libpng-1.4.0 */ +#ifdef PNG_IO_STATE_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_io_state) PNGARG((png_structp png_ptr)); + +extern PNG_EXPORT(png_bytep,png_get_io_chunk_name) + PNGARG((png_structp png_ptr)); + +/* The flags returned by png_get_io_state() are the following: */ +#define PNG_IO_NONE 0x0000 /* no I/O at this moment */ +#define PNG_IO_READING 0x0001 /* currently reading */ +#define PNG_IO_WRITING 0x0002 /* currently writing */ +#define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */ +#define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */ +#define PNG_IO_CHUNK_DATA 0x0040 /* currently at the chunk data */ +#define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */ +#define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */ +#define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */ +#endif /* ?PNG_IO_STATE_SUPPORTED */ + +/* Maintainer: Put new public prototypes here ^, in libpng.3, and project + * defs + */ + +#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED +/* With these routines we avoid an integer divide, which will be slower on + * most machines. However, it does take more operations than the corresponding + * divide method, so it may be slower on a few RISC systems. There are two + * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. + * + * Note that the rounding factors are NOT supposed to be the same! 128 and + * 32768 are correct for the NODIV code; 127 and 32767 are correct for the + * standard method. + * + * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] + */ + + /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ + +# define png_composite(composite, fg, alpha, bg) \ + { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \ + * (png_uint_16)(alpha) \ + + (png_uint_16)(bg)*(png_uint_16)(255 \ + - (png_uint_16)(alpha)) + (png_uint_16)128); \ + (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } + +# define png_composite_16(composite, fg, alpha, bg) \ + { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \ + * (png_uint_32)(alpha) \ + + (png_uint_32)(bg)*(png_uint_32)(65535L \ + - (png_uint_32)(alpha)) + (png_uint_32)32768L); \ + (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } + +#else /* Standard method using integer division */ + +# define png_composite(composite, fg, alpha, bg) \ + (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ + (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ + (png_uint_16)127) / 255) + +# define png_composite_16(composite, fg, alpha, bg) \ + (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ + (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \ + (png_uint_32)32767) / (png_uint_32)65535L) +#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ + +#ifdef PNG_USE_READ_MACROS +/* Inline macros to do direct reads of bytes from the input buffer. + * The png_get_int_32() routine assumes we are using two's complement + * format for negative values, which is almost certainly true. + */ +/* We could make special-case BIG_ENDIAN macros that do direct reads here */ +# define png_get_uint_32(buf) \ + (((png_uint_32)(*(buf)) << 24) + \ + ((png_uint_32)(*((buf) + 1)) << 16) + \ + ((png_uint_32)(*((buf) + 2)) << 8) + \ + ((png_uint_32)(*((buf) + 3)))) +# define png_get_uint_16(buf) \ + (((png_uint_32)(*(buf)) << 8) + \ + ((png_uint_32)(*((buf) + 1)))) +#ifdef PNG_GET_INT_32_SUPPORTED +# define png_get_int_32(buf) \ + (((png_int_32)(*(buf)) << 24) + \ + ((png_int_32)(*((buf) + 1)) << 16) + \ + ((png_int_32)(*((buf) + 2)) << 8) + \ + ((png_int_32)(*((buf) + 3)))) +#endif +#else +extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf)); +extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf)); +#ifdef PNG_GET_INT_32_SUPPORTED +extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf)); +#endif +#endif +extern PNG_EXPORT(png_uint_32,png_get_uint_31) + PNGARG((png_structp png_ptr, png_bytep buf)); +/* No png_get_int_16 -- may be added if there's a real need for it. */ + +/* Place a 32-bit number into a buffer in PNG byte order (big-endian). */ +extern PNG_EXPORT(void,png_save_uint_32) + PNGARG((png_bytep buf, png_uint_32 i)); +extern PNG_EXPORT(void,png_save_int_32) + PNGARG((png_bytep buf, png_int_32 i)); + +/* Place a 16-bit number into a buffer in PNG byte order. + * The parameter is declared unsigned int, not png_uint_16, + * just to avoid potential problems on pre-ANSI C compilers. + */ +extern PNG_EXPORT(void,png_save_uint_16) + PNGARG((png_bytep buf, unsigned int i)); +/* No png_save_int_16 -- may be added if there's a real need for it. */ + +/* ************************************************************************* */ + +/* Various modes of operation. Note that after an init, mode is set to + * zero automatically when the structure is created. + */ +#define PNG_HAVE_IHDR 0x01 +#define PNG_HAVE_PLTE 0x02 +#define PNG_HAVE_IDAT 0x04 +#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */ +#define PNG_HAVE_IEND 0x10 +#define PNG_HAVE_gAMA 0x20 +#define PNG_HAVE_cHRM 0x40 + +#ifdef __cplusplus +} +#endif + +#endif /* PNG_VERSION_INFO_ONLY */ +/* Do not put anything past this line */ +#endif /* PNG_H */ diff --git a/png/pngbar.jpg b/png/pngbar.jpg new file mode 100644 index 0000000..70ba8d8 Binary files /dev/null and b/png/pngbar.jpg differ diff --git a/png/pngbar.png b/png/pngbar.png new file mode 100644 index 0000000..49798c8 Binary files /dev/null and b/png/pngbar.png differ diff --git a/png/pngconf.h b/png/pngconf.h new file mode 100644 index 0000000..0c1065c --- /dev/null +++ b/png/pngconf.h @@ -0,0 +1,1525 @@ + +/* pngconf.h - machine configurable file for libpng + * + * libpng version 1.4.3 - June 26, 2010 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + */ + +/* Any machine specific code is near the front of this file, so if you + * are configuring libpng for a machine, you may want to read the section + * starting here down to where it starts to typedef png_color, png_text, + * and png_info. + */ + +#ifndef PNGCONF_H +#define PNGCONF_H + +#ifndef PNG_NO_LIMITS_H +# include +#endif + +/* Added at libpng-1.2.9 */ + +/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" + * script. + */ +#ifdef PNG_CONFIGURE_LIBPNG +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif +#endif + +/* + * Added at libpng-1.2.8 + * + * PNG_USER_CONFIG has to be defined on the compiler command line. This + * includes the resource compiler for Windows DLL configurations. + */ +#ifdef PNG_USER_CONFIG +# ifndef PNG_USER_PRIVATEBUILD +# define PNG_USER_PRIVATEBUILD +# endif +# include "pngusr.h" +#endif + +/* + * If you create a private DLL you need to define in "pngusr.h" the followings: + * #define PNG_USER_PRIVATEBUILD + * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons." + * #define PNG_USER_DLLFNAME_POSTFIX + * e.g. // private DLL "libpng13gx.dll" + * #define PNG_USER_DLLFNAME_POSTFIX "gx" + * + * The following macros are also at your disposal if you want to complete the + * DLL VERSIONINFO structure. + * - PNG_USER_VERSIONINFO_COMMENTS + * - PNG_USER_VERSIONINFO_COMPANYNAME + * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS + */ + +#ifdef __STDC__ +# ifdef SPECIALBUILD +# pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\ + are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.") +# endif + +# ifdef PRIVATEBUILD +# pragma message("PRIVATEBUILD is deprecated.\ + Use PNG_USER_PRIVATEBUILD instead.") +# define PNG_USER_PRIVATEBUILD PRIVATEBUILD +# endif +#endif /* __STDC__ */ + +/* End of material added to libpng-1.2.8 */ + +#ifndef PNG_VERSION_INFO_ONLY + +/* This is the size of the compression buffer, and thus the size of + * an IDAT chunk. Make this whatever size you feel is best for your + * machine. One of these will be allocated per png_struct. When this + * is full, it writes the data to the disk, and does some other + * calculations. Making this an extremely small size will slow + * the library down, but you may want to experiment to determine + * where it becomes significant, if you are concerned with memory + * usage. Note that zlib allocates at least 32Kb also. For readers, + * this describes the size of the buffer available to read the data in. + * Unless this gets smaller than the size of a row (compressed), + * it should not make much difference how big this is. + */ + +#ifndef PNG_ZBUF_SIZE +# define PNG_ZBUF_SIZE 8192 +#endif + +/* Enable if you want a write-only libpng */ + +#ifndef PNG_NO_READ_SUPPORTED +# define PNG_READ_SUPPORTED +#endif + +/* Enable if you want a read-only libpng */ + +#ifndef PNG_NO_WRITE_SUPPORTED +# define PNG_WRITE_SUPPORTED +#endif + +/* Enabled in 1.4.0. */ +#ifdef PNG_ALLOW_BENIGN_ERRORS +# define png_benign_error png_warning +# define png_chunk_benign_error png_chunk_warning +#else +# ifndef PNG_BENIGN_ERRORS_SUPPORTED +# define png_benign_error png_error +# define png_chunk_benign_error png_chunk_error +# endif +#endif + +/* Added at libpng version 1.4.0 */ +#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED) +# define PNG_WARNINGS_SUPPORTED +#endif + +/* Added at libpng version 1.4.0 */ +#if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED) +# define PNG_ERROR_TEXT_SUPPORTED +#endif + +/* Added at libpng version 1.4.0 */ +#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED) +# define PNG_CHECK_cHRM_SUPPORTED +#endif + +/* Added at libpng version 1.4.0 */ +#if !defined(PNG_NO_ALIGNED_MEMORY) && !defined(PNG_ALIGNED_MEMORY_SUPPORTED) +# define PNG_ALIGNED_MEMORY_SUPPORTED +#endif + +/* Enabled by default in 1.2.0. You can disable this if you don't need to + support PNGs that are embedded in MNG datastreams */ +#ifndef PNG_NO_MNG_FEATURES +# ifndef PNG_MNG_FEATURES_SUPPORTED +# define PNG_MNG_FEATURES_SUPPORTED +# endif +#endif + +/* Added at libpng version 1.4.0 */ +#ifndef PNG_NO_FLOATING_POINT_SUPPORTED +# ifndef PNG_FLOATING_POINT_SUPPORTED +# define PNG_FLOATING_POINT_SUPPORTED +# endif +#endif + +/* Added at libpng-1.4.0beta49 for testing (this test is no longer used + in libpng and png_calloc() is always present) + */ +#define PNG_CALLOC_SUPPORTED + +/* If you are running on a machine where you cannot allocate more + * than 64K of memory at once, uncomment this. While libpng will not + * normally need that much memory in a chunk (unless you load up a very + * large file), zlib needs to know how big of a chunk it can use, and + * libpng thus makes sure to check any memory allocation to verify it + * will fit into memory. +#define PNG_MAX_MALLOC_64K + */ +#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) +# define PNG_MAX_MALLOC_64K +#endif + +/* Special munging to support doing things the 'cygwin' way: + * 'Normal' png-on-win32 defines/defaults: + * PNG_BUILD_DLL -- building dll + * PNG_USE_DLL -- building an application, linking to dll + * (no define) -- building static library, or building an + * application and linking to the static lib + * 'Cygwin' defines/defaults: + * PNG_BUILD_DLL -- (ignored) building the dll + * (no define) -- (ignored) building an application, linking to the dll + * PNG_STATIC -- (ignored) building the static lib, or building an + * application that links to the static lib. + * ALL_STATIC -- (ignored) building various static libs, or building an + * application that links to the static libs. + * Thus, + * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and + * this bit of #ifdefs will define the 'correct' config variables based on + * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but + * unnecessary. + * + * Also, the precedence order is: + * ALL_STATIC (since we can't #undef something outside our namespace) + * PNG_BUILD_DLL + * PNG_STATIC + * (nothing) == PNG_USE_DLL + * + * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent + * of auto-import in binutils, we no longer need to worry about + * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, + * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes + * to __declspec() stuff. However, we DO need to worry about + * PNG_BUILD_DLL and PNG_STATIC because those change some defaults + * such as CONSOLE_IO. + */ +#ifdef __CYGWIN__ +# ifdef ALL_STATIC +# ifdef PNG_BUILD_DLL +# undef PNG_BUILD_DLL +# endif +# ifdef PNG_USE_DLL +# undef PNG_USE_DLL +# endif +# ifdef PNG_DLL +# undef PNG_DLL +# endif +# ifndef PNG_STATIC +# define PNG_STATIC +# endif +# else +# ifdef PNG_BUILD_DLL +# ifdef PNG_STATIC +# undef PNG_STATIC +# endif +# ifdef PNG_USE_DLL +# undef PNG_USE_DLL +# endif +# ifndef PNG_DLL +# define PNG_DLL +# endif +# else +# ifdef PNG_STATIC +# ifdef PNG_USE_DLL +# undef PNG_USE_DLL +# endif +# ifdef PNG_DLL +# undef PNG_DLL +# endif +# else +# ifndef PNG_USE_DLL +# define PNG_USE_DLL +# endif +# ifndef PNG_DLL +# define PNG_DLL +# endif +# endif +# endif +# endif +#endif + +/* This protects us against compilers that run on a windowing system + * and thus don't have or would rather us not use the stdio types: + * stdin, stdout, and stderr. The only one currently used is stderr + * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will + * prevent these from being compiled and used. #defining PNG_NO_STDIO + * will also prevent these, plus will prevent the entire set of stdio + * macros and functions (FILE *, printf, etc.) from being compiled and used, + * unless (PNG_DEBUG > 0) has been #defined. + * + * #define PNG_NO_CONSOLE_IO + * #define PNG_NO_STDIO + */ + +#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED) +# define PNG_STDIO_SUPPORTED +#endif + + +#ifdef PNG_BUILD_DLL +# if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO) +# define PNG_NO_CONSOLE_IO +# endif +#endif + +# ifdef PNG_NO_STDIO +# ifndef PNG_NO_CONSOLE_IO +# define PNG_NO_CONSOLE_IO +# endif +# ifdef PNG_DEBUG +# if (PNG_DEBUG > 0) +# include +# endif +# endif +# else +# include +# endif + +#if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED) +# define PNG_CONSOLE_IO_SUPPORTED +#endif + +/* This macro protects us against machines that don't have function + * prototypes (ie K&R style headers). If your compiler does not handle + * function prototypes, define this macro and use the included ansi2knr. + * I've always been able to use _NO_PROTO as the indicator, but you may + * need to drag the empty declaration out in front of here, or change the + * ifdef to suit your own needs. + */ +#ifndef PNGARG + +#ifdef OF /* zlib prototype munger */ +# define PNGARG(arglist) OF(arglist) +#else + +#ifdef _NO_PROTO +# define PNGARG(arglist) () +#else +# define PNGARG(arglist) arglist +#endif /* _NO_PROTO */ + +#endif /* OF */ + +#endif /* PNGARG */ + +/* Try to determine if we are compiling on a Mac. Note that testing for + * just __MWERKS__ is not good enough, because the Codewarrior is now used + * on non-Mac platforms. + */ +#ifndef MACOS +# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ + defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) +# define MACOS +# endif +#endif + +/* Enough people need this for various reasons to include it here */ +#if !defined(MACOS) && !defined(RISCOS) +# include +#endif + +/* PNG_SETJMP_NOT_SUPPORTED and PNG_NO_SETJMP_SUPPORTED are deprecated. */ +#if !defined(PNG_NO_SETJMP) && \ + !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) +# define PNG_SETJMP_SUPPORTED +#endif + +#ifdef PNG_SETJMP_SUPPORTED +/* This is an attempt to force a single setjmp behaviour on Linux. If + * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. + * + * You can bypass this test if you know that your application uses exactly + * the same setjmp.h that was included when libpng was built. Only define + * PNG_SKIP_SETJMP_CHECK while building your application, prior to the + * application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK + * while building a separate libpng library for general use. + */ + +# ifndef PNG_SKIP_SETJMP_CHECK +# ifdef __linux__ +# ifdef _BSD_SOURCE +# define PNG_SAVE_BSD_SOURCE +# undef _BSD_SOURCE +# endif +# ifdef _SETJMP_H + /* If you encounter a compiler error here, see the explanation + * near the end of INSTALL. + */ + __pngconf.h__ in libpng already includes setjmp.h; + __dont__ include it again.; +# endif +# endif /* __linux__ */ +# endif /* PNG_SKIP_SETJMP_CHECK */ + + /* Include setjmp.h for error handling */ +# include + +# ifdef __linux__ +# ifdef PNG_SAVE_BSD_SOURCE +# ifdef _BSD_SOURCE +# undef _BSD_SOURCE +# endif +# define _BSD_SOURCE +# undef PNG_SAVE_BSD_SOURCE +# endif +# endif /* __linux__ */ +#endif /* PNG_SETJMP_SUPPORTED */ + +#ifdef BSD +# include +#else +# include +#endif + +/* Other defines for things like memory and the like can go here. */ + +/* This controls how fine the quantizing gets. As this allocates + * a largish chunk of memory (32K), those who are not as concerned + * with quantizing quality can decrease some or all of these. + */ + +/* Prior to libpng-1.4.2, these were PNG_DITHER_*_BITS + * These migration aids will be removed from libpng-1.5.0. + */ +#ifdef PNG_DITHER_RED_BITS +# define PNG_QUANTIZE_RED_BITS PNG_DITHER_RED_BITS +#endif +#ifdef PNG_DITHER_GREEN_BITS +# define PNG_QUANTIZE_GREEN_BITS PNG_DITHER_GREEN_BITS +#endif +#ifdef PNG_DITHER_BLUE_BITS +# define PNG_QUANTIZE_BLUE_BITS PNG_DITHER_BLUE_BITS +#endif + +#ifndef PNG_QUANTIZE_RED_BITS +# define PNG_QUANTIZE_RED_BITS 5 +#endif +#ifndef PNG_QUANTIZE_GREEN_BITS +# define PNG_QUANTIZE_GREEN_BITS 5 +#endif +#ifndef PNG_QUANTIZE_BLUE_BITS +# define PNG_QUANTIZE_BLUE_BITS 5 +#endif + +/* This controls how fine the gamma correction becomes when you + * are only interested in 8 bits anyway. Increasing this value + * results in more memory being used, and more pow() functions + * being called to fill in the gamma tables. Don't set this value + * less then 8, and even that may not work (I haven't tested it). + */ + +#ifndef PNG_MAX_GAMMA_8 +# define PNG_MAX_GAMMA_8 11 +#endif + +/* This controls how much a difference in gamma we can tolerate before + * we actually start doing gamma conversion. + */ +#ifndef PNG_GAMMA_THRESHOLD +# define PNG_GAMMA_THRESHOLD 0.05 +#endif + +/* The following uses const char * instead of char * for error + * and warning message functions, so some compilers won't complain. + * If you do not want to use const, define PNG_NO_CONST here. + */ + +#ifndef PNG_CONST +# ifndef PNG_NO_CONST +# define PNG_CONST const +# else +# define PNG_CONST +# endif +#endif + +/* The following defines give you the ability to remove code from the + * library that you will not be using. I wish I could figure out how to + * automate this, but I can't do that without making it seriously hard + * on the users. So if you are not using an ability, change the #define + * to and #undef, and that part of the library will not be compiled. If + * your linker can't find a function, you may want to make sure the + * ability is defined here. Some of these depend upon some others being + * defined. I haven't figured out all the interactions here, so you may + * have to experiment awhile to get everything to compile. If you are + * creating or using a shared library, you probably shouldn't touch this, + * as it will affect the size of the structures, and this will cause bad + * things to happen if the library and/or application ever change. + */ + +/* Any features you will not be using can be undef'ed here */ + +/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user + * to turn it off with PNG_NO_READ|WRITE_TRANSFORMS on the compile line, + * then pick and choose which ones to define without having to edit this + * file. It is safe to use the PNG_NO_READ|WRITE_TRANSFORMS + * if you only want to have a png-compliant reader/writer but don't need + * any of the extra transformations. This saves about 80 kbytes in a + * typical installation of the library. (PNG_NO_* form added in version + * 1.0.1c, for consistency; PNG_*_TRANSFORMS_NOT_SUPPORTED deprecated in + * 1.4.0) + */ + +/* Ignore attempt to turn off both floating and fixed point support */ +#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \ + !defined(PNG_NO_FIXED_POINT_SUPPORTED) +# define PNG_FIXED_POINT_SUPPORTED +#endif + +#ifdef PNG_READ_SUPPORTED + +/* PNG_READ_TRANSFORMS_NOT_SUPPORTED is deprecated. */ +#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ + !defined(PNG_NO_READ_TRANSFORMS) +# define PNG_READ_TRANSFORMS_SUPPORTED +#endif + +#ifdef PNG_READ_TRANSFORMS_SUPPORTED +# ifndef PNG_NO_READ_EXPAND +# define PNG_READ_EXPAND_SUPPORTED +# endif +# ifndef PNG_NO_READ_SHIFT +# define PNG_READ_SHIFT_SUPPORTED +# endif +# ifndef PNG_NO_READ_PACK +# define PNG_READ_PACK_SUPPORTED +# endif +# ifndef PNG_NO_READ_BGR +# define PNG_READ_BGR_SUPPORTED +# endif +# ifndef PNG_NO_READ_SWAP +# define PNG_READ_SWAP_SUPPORTED +# endif +# ifndef PNG_NO_READ_PACKSWAP +# define PNG_READ_PACKSWAP_SUPPORTED +# endif +# ifndef PNG_NO_READ_INVERT +# define PNG_READ_INVERT_SUPPORTED +# endif +# ifndef PNG_NO_READ_QUANTIZE + /* Prior to libpng-1.4.0 this was PNG_READ_DITHER_SUPPORTED */ +# ifndef PNG_NO_READ_DITHER /* This migration aid will be removed */ +# define PNG_READ_QUANTIZE_SUPPORTED +# endif +# endif +# ifndef PNG_NO_READ_BACKGROUND +# define PNG_READ_BACKGROUND_SUPPORTED +# endif +# ifndef PNG_NO_READ_16_TO_8 +# define PNG_READ_16_TO_8_SUPPORTED +# endif +# ifndef PNG_NO_READ_FILLER +# define PNG_READ_FILLER_SUPPORTED +# endif +# ifndef PNG_NO_READ_GAMMA +# define PNG_READ_GAMMA_SUPPORTED +# endif +# ifndef PNG_NO_READ_GRAY_TO_RGB +# define PNG_READ_GRAY_TO_RGB_SUPPORTED +# endif +# ifndef PNG_NO_READ_SWAP_ALPHA +# define PNG_READ_SWAP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_INVERT_ALPHA +# define PNG_READ_INVERT_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_STRIP_ALPHA +# define PNG_READ_STRIP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_USER_TRANSFORM +# define PNG_READ_USER_TRANSFORM_SUPPORTED +# endif +# ifndef PNG_NO_READ_RGB_TO_GRAY +# define PNG_READ_RGB_TO_GRAY_SUPPORTED +# endif +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ + +/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */ +#if !defined(PNG_NO_PROGRESSIVE_READ) && \ + !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ +# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ +#endif /* about interlacing capability! You'll */ + /* still have interlacing unless you change the following define: */ + +#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ + +/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */ +#if !defined(PNG_NO_SEQUENTIAL_READ) && \ + !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \ + !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED) +# define PNG_SEQUENTIAL_READ_SUPPORTED +#endif + +#ifndef PNG_NO_READ_COMPOSITE_NODIV +# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ +# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ +# endif +#endif + +#if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \ + defined(PNG_READ_pCAL_SUPPORTED) +# ifndef PNG_GET_INT_32_SUPPORTED +# define PNG_GET_INT_32_SUPPORTED +# endif +#endif + +#endif /* PNG_READ_SUPPORTED */ + +#ifdef PNG_WRITE_SUPPORTED + +/* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */ +#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ + !defined(PNG_NO_WRITE_TRANSFORMS) +# define PNG_WRITE_TRANSFORMS_SUPPORTED +#endif + +#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED +# ifndef PNG_NO_WRITE_SHIFT +# define PNG_WRITE_SHIFT_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_PACK +# define PNG_WRITE_PACK_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_BGR +# define PNG_WRITE_BGR_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_SWAP +# define PNG_WRITE_SWAP_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_PACKSWAP +# define PNG_WRITE_PACKSWAP_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_INVERT +# define PNG_WRITE_INVERT_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_FILLER +# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */ +# endif +# ifndef PNG_NO_WRITE_SWAP_ALPHA +# define PNG_WRITE_SWAP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_INVERT_ALPHA +# define PNG_WRITE_INVERT_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_USER_TRANSFORM +# define PNG_WRITE_USER_TRANSFORM_SUPPORTED +# endif +#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ + +#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \ + !defined(PNG_WRITE_INTERLACING_SUPPORTED) + /* This is not required for PNG-compliant encoders, but can cause + * trouble if left undefined + */ +# define PNG_WRITE_INTERLACING_SUPPORTED +#endif + +#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ + !defined(PNG_WRITE_WEIGHTED_FILTER) && \ + defined(PNG_FLOATING_POINT_SUPPORTED) +# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED +#endif + +#ifndef PNG_NO_WRITE_FLUSH +# define PNG_WRITE_FLUSH_SUPPORTED +#endif + +#if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \ + defined(PNG_WRITE_pCAL_SUPPORTED) +# ifndef PNG_SAVE_INT_32_SUPPORTED +# define PNG_SAVE_INT_32_SUPPORTED +# endif +#endif + +#endif /* PNG_WRITE_SUPPORTED */ + +#define PNG_NO_ERROR_NUMBERS + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +# ifndef PNG_NO_USER_TRANSFORM_PTR +# define PNG_USER_TRANSFORM_PTR_SUPPORTED +# endif +#endif + +#if defined(PNG_STDIO_SUPPORTED) && !defined(PNG_TIME_RFC1123_SUPPORTED) +# define PNG_TIME_RFC1123_SUPPORTED +#endif + +/* This adds extra functions in pngget.c for accessing data from the + * info pointer (added in version 0.99) + * png_get_image_width() + * png_get_image_height() + * png_get_bit_depth() + * png_get_color_type() + * png_get_compression_type() + * png_get_filter_type() + * png_get_interlace_type() + * png_get_pixel_aspect_ratio() + * png_get_pixels_per_meter() + * png_get_x_offset_pixels() + * png_get_y_offset_pixels() + * png_get_x_offset_microns() + * png_get_y_offset_microns() + */ +#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED) +# define PNG_EASY_ACCESS_SUPPORTED +#endif + +/* Added at libpng-1.2.0 */ +#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) +# define PNG_USER_MEM_SUPPORTED +#endif + +/* Added at libpng-1.2.6 */ +#ifndef PNG_NO_SET_USER_LIMITS +# ifndef PNG_SET_USER_LIMITS_SUPPORTED +# define PNG_SET_USER_LIMITS_SUPPORTED +# endif + /* Feature added at libpng-1.4.0, this flag added at 1.4.1 */ +# ifndef PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED +# define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED +# endif + /* Feature added at libpng-1.4.1, this flag added at 1.4.1 */ +# ifndef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED +# define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED +# endif +#endif + +/* Added at libpng-1.2.43 */ +#ifndef PNG_USER_LIMITS_SUPPORTED +# ifndef PNG_NO_USER_LIMITS +# define PNG_USER_LIMITS_SUPPORTED +# endif +#endif + +/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGs no matter + * how large, set these two limits to 0x7fffffffL + */ +#ifndef PNG_USER_WIDTH_MAX +# define PNG_USER_WIDTH_MAX 1000000L +#endif +#ifndef PNG_USER_HEIGHT_MAX +# define PNG_USER_HEIGHT_MAX 1000000L +#endif + +/* Added at libpng-1.2.43. To accept all valid PNGs no matter + * how large, set these two limits to 0. + */ +#ifndef PNG_USER_CHUNK_CACHE_MAX +# define PNG_USER_CHUNK_CACHE_MAX 0 +#endif + +/* Added at libpng-1.2.43 */ +#ifndef PNG_USER_CHUNK_MALLOC_MAX +# define PNG_USER_CHUNK_MALLOC_MAX 0 +#endif + +/* Added at libpng-1.4.0 */ +#if !defined(PNG_NO_IO_STATE) && !defined(PNG_IO_STATE_SUPPORTED) +# define PNG_IO_STATE_SUPPORTED +#endif + +#ifndef PNG_LITERAL_SHARP +# define PNG_LITERAL_SHARP 0x23 +#endif +#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET +# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b +#endif +#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET +# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d +#endif +#ifndef PNG_STRING_NEWLINE +#define PNG_STRING_NEWLINE "\n" +#endif + +/* These are currently experimental features, define them if you want */ + +/* Very little testing */ +/* +#ifdef PNG_READ_SUPPORTED +# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# endif +#endif +*/ + +/* This is only for PowerPC big-endian and 680x0 systems */ +/* some testing */ +/* +#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED +# define PNG_READ_BIG_ENDIAN_SUPPORTED +#endif +*/ + +#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS) +# define PNG_USE_READ_MACROS +#endif + +/* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING */ + +#if !defined(PNG_NO_POINTER_INDEXING) && \ + !defined(PNG_POINTER_INDEXING_SUPPORTED) +# define PNG_POINTER_INDEXING_SUPPORTED +#endif + + +/* Any chunks you are not interested in, you can undef here. The + * ones that allocate memory may be expecially important (hIST, + * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info + * a bit smaller. + */ + +/* The size of the png_text structure changed in libpng-1.0.6 when + * iTXt support was added. iTXt support was turned off by default through + * libpng-1.2.x, to support old apps that malloc the png_text structure + * instead of calling png_set_text() and letting libpng malloc it. It + * was turned on by default in libpng-1.4.0. + */ + +/* PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */ +#if defined(PNG_READ_SUPPORTED) && \ + !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ + !defined(PNG_NO_READ_ANCILLARY_CHUNKS) +# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED +#endif + +/* PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */ +#if defined(PNG_WRITE_SUPPORTED) && \ + !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ + !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) +# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED +#endif + +#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED + +#ifdef PNG_NO_READ_TEXT +# define PNG_NO_READ_iTXt +# define PNG_NO_READ_tEXt +# define PNG_NO_READ_zTXt +#endif + +#ifndef PNG_NO_READ_bKGD +# define PNG_READ_bKGD_SUPPORTED +# define PNG_bKGD_SUPPORTED +#endif +#ifndef PNG_NO_READ_cHRM +# define PNG_READ_cHRM_SUPPORTED +# define PNG_cHRM_SUPPORTED +#endif +#ifndef PNG_NO_READ_gAMA +# define PNG_READ_gAMA_SUPPORTED +# define PNG_gAMA_SUPPORTED +#endif +#ifndef PNG_NO_READ_hIST +# define PNG_READ_hIST_SUPPORTED +# define PNG_hIST_SUPPORTED +#endif +#ifndef PNG_NO_READ_iCCP +# define PNG_READ_iCCP_SUPPORTED +# define PNG_iCCP_SUPPORTED +#endif +#ifndef PNG_NO_READ_iTXt +# ifndef PNG_READ_iTXt_SUPPORTED +# define PNG_READ_iTXt_SUPPORTED +# endif +# ifndef PNG_iTXt_SUPPORTED +# define PNG_iTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_READ_oFFs +# define PNG_READ_oFFs_SUPPORTED +# define PNG_oFFs_SUPPORTED +#endif +#ifndef PNG_NO_READ_pCAL +# define PNG_READ_pCAL_SUPPORTED +# define PNG_pCAL_SUPPORTED +#endif +#ifndef PNG_NO_READ_sCAL +# define PNG_READ_sCAL_SUPPORTED +# define PNG_sCAL_SUPPORTED +#endif +#ifndef PNG_NO_READ_pHYs +# define PNG_READ_pHYs_SUPPORTED +# define PNG_pHYs_SUPPORTED +#endif +#ifndef PNG_NO_READ_sBIT +# define PNG_READ_sBIT_SUPPORTED +# define PNG_sBIT_SUPPORTED +#endif +#ifndef PNG_NO_READ_sPLT +# define PNG_READ_sPLT_SUPPORTED +# define PNG_sPLT_SUPPORTED +#endif +#ifndef PNG_NO_READ_sRGB +# define PNG_READ_sRGB_SUPPORTED +# define PNG_sRGB_SUPPORTED +#endif +#ifndef PNG_NO_READ_tEXt +# define PNG_READ_tEXt_SUPPORTED +# define PNG_tEXt_SUPPORTED +#endif +#ifndef PNG_NO_READ_tIME +# define PNG_READ_tIME_SUPPORTED +# define PNG_tIME_SUPPORTED +#endif +#ifndef PNG_NO_READ_tRNS +# define PNG_READ_tRNS_SUPPORTED +# define PNG_tRNS_SUPPORTED +#endif +#ifndef PNG_NO_READ_zTXt +# define PNG_READ_zTXt_SUPPORTED +# define PNG_zTXt_SUPPORTED +#endif +#ifndef PNG_NO_READ_OPT_PLTE +# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ +#endif /* optional PLTE chunk in RGB and RGBA images */ +#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ + defined(PNG_READ_zTXt_SUPPORTED) +# define PNG_READ_TEXT_SUPPORTED +# define PNG_TEXT_SUPPORTED +#endif + +#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ + +#ifndef PNG_NO_READ_UNKNOWN_CHUNKS +# ifndef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +# endif +# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_UNKNOWN_CHUNKS_SUPPORTED +# endif +# ifndef PNG_READ_USER_CHUNKS_SUPPORTED +# define PNG_READ_USER_CHUNKS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_READ_USER_CHUNKS +# ifndef PNG_READ_USER_CHUNKS_SUPPORTED +# define PNG_READ_USER_CHUNKS_SUPPORTED +# endif +# ifndef PNG_USER_CHUNKS_SUPPORTED +# define PNG_USER_CHUNKS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_HANDLE_AS_UNKNOWN +# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# endif +#endif + +#ifdef PNG_WRITE_SUPPORTED +#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED + +#ifdef PNG_NO_WRITE_TEXT +# define PNG_NO_WRITE_iTXt +# define PNG_NO_WRITE_tEXt +# define PNG_NO_WRITE_zTXt +#endif +#ifndef PNG_NO_WRITE_bKGD +# define PNG_WRITE_bKGD_SUPPORTED +# ifndef PNG_bKGD_SUPPORTED +# define PNG_bKGD_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_cHRM +# define PNG_WRITE_cHRM_SUPPORTED +# ifndef PNG_cHRM_SUPPORTED +# define PNG_cHRM_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_gAMA +# define PNG_WRITE_gAMA_SUPPORTED +# ifndef PNG_gAMA_SUPPORTED +# define PNG_gAMA_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_hIST +# define PNG_WRITE_hIST_SUPPORTED +# ifndef PNG_hIST_SUPPORTED +# define PNG_hIST_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_iCCP +# define PNG_WRITE_iCCP_SUPPORTED +# ifndef PNG_iCCP_SUPPORTED +# define PNG_iCCP_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_iTXt +# ifndef PNG_WRITE_iTXt_SUPPORTED +# define PNG_WRITE_iTXt_SUPPORTED +# endif +# ifndef PNG_iTXt_SUPPORTED +# define PNG_iTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_oFFs +# define PNG_WRITE_oFFs_SUPPORTED +# ifndef PNG_oFFs_SUPPORTED +# define PNG_oFFs_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_pCAL +# define PNG_WRITE_pCAL_SUPPORTED +# ifndef PNG_pCAL_SUPPORTED +# define PNG_pCAL_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sCAL +# define PNG_WRITE_sCAL_SUPPORTED +# ifndef PNG_sCAL_SUPPORTED +# define PNG_sCAL_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_pHYs +# define PNG_WRITE_pHYs_SUPPORTED +# ifndef PNG_pHYs_SUPPORTED +# define PNG_pHYs_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sBIT +# define PNG_WRITE_sBIT_SUPPORTED +# ifndef PNG_sBIT_SUPPORTED +# define PNG_sBIT_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sPLT +# define PNG_WRITE_sPLT_SUPPORTED +# ifndef PNG_sPLT_SUPPORTED +# define PNG_sPLT_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sRGB +# define PNG_WRITE_sRGB_SUPPORTED +# ifndef PNG_sRGB_SUPPORTED +# define PNG_sRGB_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tEXt +# define PNG_WRITE_tEXt_SUPPORTED +# ifndef PNG_tEXt_SUPPORTED +# define PNG_tEXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tIME +# define PNG_WRITE_tIME_SUPPORTED +# ifndef PNG_tIME_SUPPORTED +# define PNG_tIME_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tRNS +# define PNG_WRITE_tRNS_SUPPORTED +# ifndef PNG_tRNS_SUPPORTED +# define PNG_tRNS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_zTXt +# define PNG_WRITE_zTXt_SUPPORTED +# ifndef PNG_zTXt_SUPPORTED +# define PNG_zTXt_SUPPORTED +# endif +#endif +#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ + defined(PNG_WRITE_zTXt_SUPPORTED) +# define PNG_WRITE_TEXT_SUPPORTED +# ifndef PNG_TEXT_SUPPORTED +# define PNG_TEXT_SUPPORTED +# endif +#endif + +#ifdef PNG_WRITE_tIME_SUPPORTED +# ifndef PNG_NO_CONVERT_tIME +# ifndef _WIN32_WCE +/* The "tm" structure is not supported on WindowsCE */ +# ifndef PNG_CONVERT_tIME_SUPPORTED +# define PNG_CONVERT_tIME_SUPPORTED +# endif +# endif +# endif +#endif + +#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ + +#ifndef PNG_NO_WRITE_FILTER +# ifndef PNG_WRITE_FILTER_SUPPORTED +# define PNG_WRITE_FILTER_SUPPORTED +# endif +#endif + +#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS +# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED +# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_UNKNOWN_CHUNKS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_HANDLE_AS_UNKNOWN +# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# endif +#endif +#endif /* PNG_WRITE_SUPPORTED */ + +/* Turn this off to disable png_read_png() and + * png_write_png() and leave the row_pointers member + * out of the info structure. + */ +#ifndef PNG_NO_INFO_IMAGE +# define PNG_INFO_IMAGE_SUPPORTED +#endif + +/* Need the time information for converting tIME chunks */ +#ifdef PNG_CONVERT_tIME_SUPPORTED + /* "time.h" functions are not supported on WindowsCE */ +# include +#endif + +/* Some typedefs to get us started. These should be safe on most of the + * common platforms. The typedefs should be at least as large as the + * numbers suggest (a png_uint_32 must be at least 32 bits long), but they + * don't have to be exactly that size. Some compilers dislike passing + * unsigned shorts as function parameters, so you may be better off using + * unsigned int for png_uint_16. + */ + +#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL) +typedef unsigned int png_uint_32; +typedef int png_int_32; +#else +typedef unsigned long png_uint_32; +typedef long png_int_32; +#endif +typedef unsigned short png_uint_16; +typedef short png_int_16; +typedef unsigned char png_byte; + +#ifdef PNG_NO_SIZE_T + typedef unsigned int png_size_t; +#else + typedef size_t png_size_t; +#endif +#define png_sizeof(x) sizeof(x) + +/* The following is needed for medium model support. It cannot be in the + * pngpriv.h header. Needs modification for other compilers besides + * MSC. Model independent support declares all arrays and pointers to be + * large using the far keyword. The zlib version used must also support + * model independent data. As of version zlib 1.0.4, the necessary changes + * have been made in zlib. The USE_FAR_KEYWORD define triggers other + * changes that are needed. (Tim Wegner) + */ + +/* Separate compiler dependencies (problem here is that zlib.h always + * defines FAR. (SJT) + */ +#ifdef __BORLANDC__ +# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) +# define LDATA 1 +# else +# define LDATA 0 +# endif + /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ +# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) +# define PNG_MAX_MALLOC_64K +# if (LDATA != 1) +# ifndef FAR +# define FAR __far +# endif +# define USE_FAR_KEYWORD +# endif /* LDATA != 1 */ + /* Possibly useful for moving data out of default segment. + * Uncomment it if you want. Could also define FARDATA as + * const if your compiler supports it. (SJT) +# define FARDATA FAR + */ +# endif /* __WIN32__, __FLAT__, __CYGWIN__ */ +#endif /* __BORLANDC__ */ + + +/* Suggest testing for specific compiler first before testing for + * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, + * making reliance oncertain keywords suspect. (SJT) + */ + +/* MSC Medium model */ +#ifdef FAR +# ifdef M_I86MM +# define USE_FAR_KEYWORD +# define FARDATA FAR +# include +# endif +#endif + +/* SJT: default case */ +#ifndef FAR +# define FAR +#endif + +/* At this point FAR is always defined */ +#ifndef FARDATA +# define FARDATA +#endif + +/* Typedef for floating-point numbers that are converted + to fixed-point with a multiple of 100,000, e.g., int_gamma */ +typedef png_int_32 png_fixed_point; + +/* Add typedefs for pointers */ +typedef void FAR * png_voidp; +typedef png_byte FAR * png_bytep; +typedef png_uint_32 FAR * png_uint_32p; +typedef png_int_32 FAR * png_int_32p; +typedef png_uint_16 FAR * png_uint_16p; +typedef png_int_16 FAR * png_int_16p; +typedef PNG_CONST char FAR * png_const_charp; +typedef char FAR * png_charp; +typedef png_fixed_point FAR * png_fixed_point_p; + +#ifndef PNG_NO_STDIO +typedef FILE * png_FILE_p; +#endif + +#ifdef PNG_FLOATING_POINT_SUPPORTED +typedef double FAR * png_doublep; +#endif + +/* Pointers to pointers; i.e. arrays */ +typedef png_byte FAR * FAR * png_bytepp; +typedef png_uint_32 FAR * FAR * png_uint_32pp; +typedef png_int_32 FAR * FAR * png_int_32pp; +typedef png_uint_16 FAR * FAR * png_uint_16pp; +typedef png_int_16 FAR * FAR * png_int_16pp; +typedef PNG_CONST char FAR * FAR * png_const_charpp; +typedef char FAR * FAR * png_charpp; +typedef png_fixed_point FAR * FAR * png_fixed_point_pp; +#ifdef PNG_FLOATING_POINT_SUPPORTED +typedef double FAR * FAR * png_doublepp; +#endif + +/* Pointers to pointers to pointers; i.e., pointer to array */ +typedef char FAR * FAR * FAR * png_charppp; + +/* Define PNG_BUILD_DLL if the module being built is a Windows + * LIBPNG DLL. + * + * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL. + * It is equivalent to Microsoft predefined macro _DLL that is + * automatically defined when you compile using the share + * version of the CRT (C Run-Time library) + * + * The cygwin mods make this behavior a little different: + * Define PNG_BUILD_DLL if you are building a dll for use with cygwin + * Define PNG_STATIC if you are building a static library for use with cygwin, + * -or- if you are building an application that you want to link to the + * static library. + * PNG_USE_DLL is defined by default (no user action needed) unless one of + * the other flags is defined. + */ + +#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL)) +# define PNG_DLL +#endif + +#ifdef __CYGWIN__ +# undef PNGAPI +# define PNGAPI __cdecl +# undef PNG_IMPEXP +# define PNG_IMPEXP +#endif + +#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */ + +/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", + * you may get warnings regarding the linkage of png_zalloc and png_zfree. + * Don't ignore those warnings; you must also reset the default calling + * convention in your compiler to match your PNGAPI, and you must build + * zlib and your applications the same way you build libpng. + */ + +#if defined(__MINGW32__) && !defined(PNG_MODULEDEF) +# ifndef PNG_NO_MODULEDEF +# define PNG_NO_MODULEDEF +# endif +#endif + +#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF) +# define PNG_IMPEXP +#endif + +#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ + (( defined(_Windows) || defined(_WINDOWS) || \ + defined(WIN32) || defined(_WIN32) || defined(__WIN32__) )) + +# ifndef PNGAPI +# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) +# define PNGAPI __cdecl +# else +# define PNGAPI _cdecl +# endif +# endif + +# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ + 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */) +# define PNG_IMPEXP +# endif + +# ifndef PNG_IMPEXP + +# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol +# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol + + /* Borland/Microsoft */ +# if defined(_MSC_VER) || defined(__BORLANDC__) +# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) +# define PNG_EXPORT PNG_EXPORT_TYPE1 +# else +# define PNG_EXPORT PNG_EXPORT_TYPE2 +# ifdef PNG_BUILD_DLL +# define PNG_IMPEXP __export +# else +# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */ +# endif /* Exists in Borland C++ for + C++ classes (== huge) */ +# endif +# endif + +# ifndef PNG_IMPEXP +# ifdef PNG_BUILD_DLL +# define PNG_IMPEXP __declspec(dllexport) +# else +# define PNG_IMPEXP __declspec(dllimport) +# endif +# endif +# endif /* PNG_IMPEXP */ +#else /* !(DLL || non-cygwin WINDOWS) */ +# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) +# ifndef PNGAPI +# define PNGAPI _System +# endif +# else +# if 0 /* ... other platforms, with other meanings */ +# endif +# endif +#endif + +#ifndef PNGAPI +# define PNGAPI +#endif +#ifndef PNG_IMPEXP +# define PNG_IMPEXP +#endif + +#ifdef PNG_BUILDSYMS +# ifndef PNG_EXPORT +# define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END +# endif +#endif + +#ifndef PNG_EXPORT +# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol +#endif + +/* Support for compiler specific function attributes. These are used + * so that where compiler support is available incorrect use of API + * functions in png.h will generate compiler warnings. + * + * Added at libpng-1.2.41. + */ + +#ifndef PNG_NO_PEDANTIC_WARNINGS +# ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED +# define PNG_PEDANTIC_WARNINGS_SUPPORTED +# endif +#endif + +#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED +/* Support for compiler specific function attributes. These are used + * so that where compiler support is available incorrect use of API + * functions in png.h will generate compiler warnings. Added at libpng + * version 1.2.41. + */ +# ifdef __GNUC__ +# ifndef PNG_USE_RESULT +# define PNG_USE_RESULT __attribute__((__warn_unused_result__)) +# endif +# ifndef PNG_NORETURN +# define PNG_NORETURN __attribute__((__noreturn__)) +# endif +# ifndef PNG_ALLOCATED +# define PNG_ALLOCATED __attribute__((__malloc__)) +# endif + + /* This specifically protects structure members that should only be + * accessed from within the library, therefore should be empty during + * a library build. + */ +# ifndef PNG_DEPRECATED +# define PNG_DEPRECATED __attribute__((__deprecated__)) +# endif +# ifndef PNG_DEPSTRUCT +# define PNG_DEPSTRUCT __attribute__((__deprecated__)) +# endif +# ifndef PNG_PRIVATE +# if 0 /* Doesn't work so we use deprecated instead*/ +# define PNG_PRIVATE \ + __attribute__((warning("This function is not exported by libpng."))) +# else +# define PNG_PRIVATE \ + __attribute__((__deprecated__)) +# endif +# endif /* PNG_PRIVATE */ +# endif /* __GNUC__ */ +#endif /* PNG_PEDANTIC_WARNINGS */ + +#ifndef PNG_DEPRECATED +# define PNG_DEPRECATED /* Use of this function is deprecated */ +#endif +#ifndef PNG_USE_RESULT +# define PNG_USE_RESULT /* The result of this function must be checked */ +#endif +#ifndef PNG_NORETURN +# define PNG_NORETURN /* This function does not return */ +#endif +#ifndef PNG_ALLOCATED +# define PNG_ALLOCATED /* The result of the function is new memory */ +#endif +#ifndef PNG_DEPSTRUCT +# define PNG_DEPSTRUCT /* Access to this struct member is deprecated */ +#endif +#ifndef PNG_PRIVATE +# define PNG_PRIVATE /* This is a private libpng function */ +#endif + +/* Users may want to use these so they are not private. Any library + * functions that are passed far data must be model-independent. + */ + +/* memory model/platform independent fns */ +#ifndef PNG_ABORT +# ifdef _WINDOWS_ +# define PNG_ABORT() ExitProcess(0) +# else +# define PNG_ABORT() abort() +# endif +#endif + +#ifdef USE_FAR_KEYWORD +/* Use this to make far-to-near assignments */ +# define CHECK 1 +# define NOCHECK 0 +# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) +# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) +# define png_strcpy _fstrcpy +# define png_strncpy _fstrncpy /* Added to v 1.2.6 */ +# define png_strlen _fstrlen +# define png_memcmp _fmemcmp /* SJT: added */ +# define png_memcpy _fmemcpy +# define png_memset _fmemset +# define png_sprintf sprintf +#else +# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */ +# define CVT_PTR(ptr) (ptr) +# define CVT_PTR_NOCHECK(ptr) (ptr) +# define png_strcpy lstrcpyA +# define png_strncpy lstrcpynA +# define png_strlen lstrlenA +# define png_memcmp memcmp +# define png_memcpy CopyMemory +# define png_memset memset +# define png_sprintf wsprintfA +# else +# define CVT_PTR(ptr) (ptr) +# define CVT_PTR_NOCHECK(ptr) (ptr) +# define png_strcpy strcpy +# define png_strncpy strncpy /* Added to v 1.2.6 */ +# define png_strlen strlen +# define png_memcmp memcmp /* SJT: added */ +# define png_memcpy memcpy +# define png_memset memset +# define png_sprintf sprintf +# ifndef PNG_NO_SNPRINTF +# ifdef _MSC_VER +# define png_snprintf _snprintf /* Added to v 1.2.19 */ +# define png_snprintf2 _snprintf +# define png_snprintf6 _snprintf +# else +# define png_snprintf snprintf /* Added to v 1.2.19 */ +# define png_snprintf2 snprintf +# define png_snprintf6 snprintf +# endif +# else + /* You don't have or don't want to use snprintf(). Caution: Using + * sprintf instead of snprintf exposes your application to accidental + * or malevolent buffer overflows. If you don't have snprintf() + * as a general rule you should provide one (you can get one from + * Portable OpenSSH). + */ +# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1) +# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2) +# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ + sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) +# endif +# endif +#endif + +/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, + * and no smaller than png_uint_32. Casts from png_size_t or png_uint_32 + * to png_alloc_size_t are not necessary; in fact, it is recommended + * not to use them at all so that the compiler can complain when something + * turns out to be problematic. + * Casts in the other direction (from png_alloc_size_t to png_size_t or + * png_uint_32) should be explicitly applied; however, we do not expect + * to encounter practical situations that require such conversions. + */ +#if defined(__TURBOC__) && !defined(__FLAT__) +# define png_mem_alloc farmalloc +# define png_mem_free farfree + typedef unsigned long png_alloc_size_t; +#else +# if defined(_MSC_VER) && defined(MAXSEG_64K) +# define png_mem_alloc(s) halloc(s, 1) +# define png_mem_free hfree + typedef unsigned long png_alloc_size_t; +# else +# if defined(_WINDOWS_) && (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL) +# define png_mem_alloc(s) HeapAlloc(GetProcessHeap(), 0, s) +# define png_mem_free(p) HeapFree(GetProcessHeap(), 0, p) + typedef DWORD png_alloc_size_t; +# else +# define png_mem_alloc malloc +# define png_mem_free free + typedef png_size_t png_alloc_size_t; +# endif +# endif +#endif +/* End of memory model/platform independent support */ + +/* Just a little check that someone hasn't tried to define something + * contradictory. + */ +#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) +# undef PNG_ZBUF_SIZE +# define PNG_ZBUF_SIZE 65536L +#endif + + +/* Added at libpng-1.2.8 */ +#endif /* PNG_VERSION_INFO_ONLY */ + +#endif /* PNGCONF_H */ diff --git a/png/pngerror.c b/png/pngerror.c new file mode 100644 index 0000000..633eae2 --- /dev/null +++ b/png/pngerror.c @@ -0,0 +1,402 @@ + +/* pngerror.c - stub functions for i/o and memory allocation + * + * Last changed in libpng 1.4.0 [January 3, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + * This file provides a location for all error handling. Users who + * need special error handling are expected to write replacement functions + * and use png_set_error_fn() to use those functions. See the instructions + * at each function. + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) +#include "pngpriv.h" + +static void /* PRIVATE */ +png_default_error PNGARG((png_structp png_ptr, + png_const_charp error_message)) PNG_NORETURN; +#ifdef PNG_WARNINGS_SUPPORTED +static void /* PRIVATE */ +png_default_warning PNGARG((png_structp png_ptr, + png_const_charp warning_message)); +#endif /* PNG_WARNINGS_SUPPORTED */ + +/* This function is called whenever there is a fatal error. This function + * should not be changed. If there is a need to handle errors differently, + * you should supply a replacement error function and use png_set_error_fn() + * to replace the error function at run-time. + */ +#ifdef PNG_ERROR_TEXT_SUPPORTED +void PNGAPI +png_error(png_structp png_ptr, png_const_charp error_message) +{ +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + char msg[16]; + if (png_ptr != NULL) + { + if (png_ptr->flags& + (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) + { + if (*error_message == PNG_LITERAL_SHARP) + { + /* Strip "#nnnn " from beginning of error message. */ + int offset; + for (offset = 1; offset<15; offset++) + if (error_message[offset] == ' ') + break; + if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT) + { + int i; + for (i = 0; i < offset - 1; i++) + msg[i] = error_message[i + 1]; + msg[i - 1] = '\0'; + error_message = msg; + } + else + error_message += offset; + } + else + { + if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT) + { + msg[0] = '0'; + msg[1] = '\0'; + error_message = msg; + } + } + } + } +#endif + if (png_ptr != NULL && png_ptr->error_fn != NULL) + (*(png_ptr->error_fn))(png_ptr, error_message); + + /* If the custom handler doesn't exist, or if it returns, + use the default handler, which will not return. */ + png_default_error(png_ptr, error_message); +} +#else +void PNGAPI +png_err(png_structp png_ptr) +{ + if (png_ptr != NULL && png_ptr->error_fn != NULL) + (*(png_ptr->error_fn))(png_ptr, '\0'); + + /* If the custom handler doesn't exist, or if it returns, + use the default handler, which will not return. */ + png_default_error(png_ptr, '\0'); +} +#endif /* PNG_ERROR_TEXT_SUPPORTED */ + +#ifdef PNG_WARNINGS_SUPPORTED +/* This function is called whenever there is a non-fatal error. This function + * should not be changed. If there is a need to handle warnings differently, + * you should supply a replacement warning function and use + * png_set_error_fn() to replace the warning function at run-time. + */ +void PNGAPI +png_warning(png_structp png_ptr, png_const_charp warning_message) +{ + int offset = 0; + if (png_ptr != NULL) + { +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + if (png_ptr->flags& + (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) +#endif + { + if (*warning_message == PNG_LITERAL_SHARP) + { + for (offset = 1; offset < 15; offset++) + if (warning_message[offset] == ' ') + break; + } + } + } + if (png_ptr != NULL && png_ptr->warning_fn != NULL) + (*(png_ptr->warning_fn))(png_ptr, warning_message + offset); + else + png_default_warning(png_ptr, warning_message + offset); +} +#endif /* PNG_WARNINGS_SUPPORTED */ + +#ifdef PNG_BENIGN_ERRORS_SUPPORTED +void PNGAPI +png_benign_error(png_structp png_ptr, png_const_charp error_message) +{ + if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) + png_warning(png_ptr, error_message); + else + png_error(png_ptr, error_message); +} +#endif + +/* These utilities are used internally to build an error message that relates + * to the current chunk. The chunk name comes from png_ptr->chunk_name, + * this is used to prefix the message. The message is limited in length + * to 63 bytes, the name characters are output as hex digits wrapped in [] + * if the character is invalid. + */ +#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) +static PNG_CONST char png_digit[16] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' +}; + +#define PNG_MAX_ERROR_TEXT 64 +#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED) +static void /* PRIVATE */ +png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp + error_message) +{ + int iout = 0, iin = 0; + + while (iin < 4) + { + int c = png_ptr->chunk_name[iin++]; + if (isnonalpha(c)) + { + buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET; + buffer[iout++] = png_digit[(c & 0xf0) >> 4]; + buffer[iout++] = png_digit[c & 0x0f]; + buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET; + } + else + { + buffer[iout++] = (png_byte)c; + } + } + + if (error_message == NULL) + buffer[iout] = '\0'; + else + { + buffer[iout++] = ':'; + buffer[iout++] = ' '; + png_memcpy(buffer + iout, error_message, PNG_MAX_ERROR_TEXT); + buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0'; + } +} + +#ifdef PNG_READ_SUPPORTED +void PNGAPI +png_chunk_error(png_structp png_ptr, png_const_charp error_message) +{ + char msg[18+PNG_MAX_ERROR_TEXT]; + if (png_ptr == NULL) + png_error(png_ptr, error_message); + else + { + png_format_buffer(png_ptr, msg, error_message); + png_error(png_ptr, msg); + } +} +#endif /* PNG_READ_SUPPORTED */ +#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */ + +#ifdef PNG_WARNINGS_SUPPORTED +void PNGAPI +png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) +{ + char msg[18+PNG_MAX_ERROR_TEXT]; + if (png_ptr == NULL) + png_warning(png_ptr, warning_message); + else + { + png_format_buffer(png_ptr, msg, warning_message); + png_warning(png_ptr, msg); + } +} +#endif /* PNG_WARNINGS_SUPPORTED */ + +#ifdef PNG_READ_SUPPORTED +#ifdef PNG_BENIGN_ERRORS_SUPPORTED +void PNGAPI +png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message) +{ + if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) + png_chunk_warning(png_ptr, error_message); + else + png_chunk_error(png_ptr, error_message); +} +#endif +#endif /* PNG_READ_SUPPORTED */ + +#ifdef PNG_SETJMP_SUPPORTED +/* This API only exists if ANSI-C style error handling is used, + * otherwise it is necessary for png_default_error to be overridden. + */ +jmp_buf* PNGAPI +png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn, + size_t jmp_buf_size) +{ + if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf)) + return NULL; + + png_ptr->longjmp_fn = longjmp_fn; + return &png_ptr->jmpbuf; +} +#endif + +/* This is the default error handling function. Note that replacements for + * this function MUST NOT RETURN, or the program will likely crash. This + * function is used by default, or if the program supplies NULL for the + * error function pointer in png_set_error_fn(). + */ +static void /* PRIVATE */ +png_default_error(png_structp png_ptr, png_const_charp error_message) +{ +#ifdef PNG_CONSOLE_IO_SUPPORTED +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + if (*error_message == PNG_LITERAL_SHARP) + { + /* Strip "#nnnn " from beginning of error message. */ + int offset; + char error_number[16]; + for (offset = 0; offset<15; offset++) + { + error_number[offset] = error_message[offset + 1]; + if (error_message[offset] == ' ') + break; + } + if ((offset > 1) && (offset < 15)) + { + error_number[offset - 1] = '\0'; + fprintf(stderr, "libpng error no. %s: %s", + error_number, error_message + offset + 1); + fprintf(stderr, PNG_STRING_NEWLINE); + } + else + { + fprintf(stderr, "libpng error: %s, offset=%d", + error_message, offset); + fprintf(stderr, PNG_STRING_NEWLINE); + } + } + else +#endif + { + fprintf(stderr, "libpng error: %s", error_message); + fprintf(stderr, PNG_STRING_NEWLINE); + } +#endif + +#ifdef PNG_SETJMP_SUPPORTED + if (png_ptr && png_ptr->longjmp_fn) + { +# ifdef USE_FAR_KEYWORD + { + jmp_buf jmpbuf; + png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf)); + png_ptr->longjmp_fn(jmpbuf, 1); + } +# else + png_ptr->longjmp_fn(png_ptr->jmpbuf, 1); +# endif + } +#endif + /* Here if not setjmp support or if png_ptr is null. */ + PNG_ABORT(); +#ifndef PNG_CONSOLE_IO_SUPPORTED + error_message = error_message; /* Make compiler happy */ +#endif +} + +#ifdef PNG_WARNINGS_SUPPORTED +/* This function is called when there is a warning, but the library thinks + * it can continue anyway. Replacement functions don't have to do anything + * here if you don't want them to. In the default configuration, png_ptr is + * not used, but it is passed in case it may be useful. + */ +static void /* PRIVATE */ +png_default_warning(png_structp png_ptr, png_const_charp warning_message) +{ +#ifdef PNG_CONSOLE_IO_SUPPORTED +# ifdef PNG_ERROR_NUMBERS_SUPPORTED + if (*warning_message == PNG_LITERAL_SHARP) + { + int offset; + char warning_number[16]; + for (offset = 0; offset < 15; offset++) + { + warning_number[offset] = warning_message[offset + 1]; + if (warning_message[offset] == ' ') + break; + } + if ((offset > 1) && (offset < 15)) + { + warning_number[offset + 1] = '\0'; + fprintf(stderr, "libpng warning no. %s: %s", + warning_number, warning_message + offset); + fprintf(stderr, PNG_STRING_NEWLINE); + } + else + { + fprintf(stderr, "libpng warning: %s", + warning_message); + fprintf(stderr, PNG_STRING_NEWLINE); + } + } + else +# endif + { + fprintf(stderr, "libpng warning: %s", warning_message); + fprintf(stderr, PNG_STRING_NEWLINE); + } +#else + warning_message = warning_message; /* Make compiler happy */ +#endif + png_ptr = png_ptr; /* Make compiler happy */ +} +#endif /* PNG_WARNINGS_SUPPORTED */ + +/* This function is called when the application wants to use another method + * of handling errors and warnings. Note that the error function MUST NOT + * return to the calling routine or serious problems will occur. The return + * method used in the default routine calls longjmp(png_ptr->jmpbuf, 1) + */ +void PNGAPI +png_set_error_fn(png_structp png_ptr, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warning_fn) +{ + if (png_ptr == NULL) + return; + png_ptr->error_ptr = error_ptr; + png_ptr->error_fn = error_fn; + png_ptr->warning_fn = warning_fn; +} + + +/* This function returns a pointer to the error_ptr associated with the user + * functions. The application should free any memory associated with this + * pointer before png_write_destroy and png_read_destroy are called. + */ +png_voidp PNGAPI +png_get_error_ptr(png_structp png_ptr) +{ + if (png_ptr == NULL) + return NULL; + return ((png_voidp)png_ptr->error_ptr); +} + + +#ifdef PNG_ERROR_NUMBERS_SUPPORTED +void PNGAPI +png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode) +{ + if (png_ptr != NULL) + { + png_ptr->flags &= + ((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode); + } +} +#endif +#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff --git a/png/pngget.c b/png/pngget.c new file mode 100644 index 0000000..abe721b --- /dev/null +++ b/png/pngget.c @@ -0,0 +1,925 @@ + +/* pngget.c - retrieval of values from info struct + * + * Last changed in libpng 1.4.2 [May 6, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) +#include "pngpriv.h" + +png_uint_32 PNGAPI +png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag) +{ + if (png_ptr != NULL && info_ptr != NULL) + return(info_ptr->valid & flag); + + else + return(0); +} + +png_size_t PNGAPI +png_get_rowbytes(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return(info_ptr->rowbytes); + + else + return(0); +} + +#ifdef PNG_INFO_IMAGE_SUPPORTED +png_bytepp PNGAPI +png_get_rows(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return(info_ptr->row_pointers); + + else + return(0); +} +#endif + +#ifdef PNG_EASY_ACCESS_SUPPORTED +/* Easy access to info, added in libpng-0.99 */ +png_uint_32 PNGAPI +png_get_image_width(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return info_ptr->width; + + return (0); +} + +png_uint_32 PNGAPI +png_get_image_height(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return info_ptr->height; + + return (0); +} + +png_byte PNGAPI +png_get_bit_depth(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return info_ptr->bit_depth; + + return (0); +} + +png_byte PNGAPI +png_get_color_type(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return info_ptr->color_type; + + return (0); +} + +png_byte PNGAPI +png_get_filter_type(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return info_ptr->filter_type; + + return (0); +} + +png_byte PNGAPI +png_get_interlace_type(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return info_ptr->interlace_type; + + return (0); +} + +png_byte PNGAPI +png_get_compression_type(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return info_ptr->compression_type; + + return (0); +} + +png_uint_32 PNGAPI +png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) +#ifdef PNG_pHYs_SUPPORTED + if (info_ptr->valid & PNG_INFO_pHYs) + { + png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter"); + + if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER) + return (0); + + else + return (info_ptr->x_pixels_per_unit); + } +#else + return (0); +#endif + return (0); +} + +png_uint_32 PNGAPI +png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) +#ifdef PNG_pHYs_SUPPORTED + if (info_ptr->valid & PNG_INFO_pHYs) + { + png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter"); + + if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER) + return (0); + + else + return (info_ptr->y_pixels_per_unit); + } +#else + return (0); +#endif + return (0); +} + +png_uint_32 PNGAPI +png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) +#ifdef PNG_pHYs_SUPPORTED + if (info_ptr->valid & PNG_INFO_pHYs) + { + png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter"); + + if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER || + info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit) + return (0); + + else + return (info_ptr->x_pixels_per_unit); + } +#else + return (0); +#endif + return (0); +} + +#ifdef PNG_FLOATING_POINT_SUPPORTED +float PNGAPI +png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr) + { + if (png_ptr != NULL && info_ptr != NULL) +#ifdef PNG_pHYs_SUPPORTED + + if (info_ptr->valid & PNG_INFO_pHYs) + { + png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio"); + + if (info_ptr->x_pixels_per_unit == 0) + return ((float)0.0); + + else + return ((float)((float)info_ptr->y_pixels_per_unit + /(float)info_ptr->x_pixels_per_unit)); + } +#else + return (0.0); +#endif + return ((float)0.0); +} +#endif + +png_int_32 PNGAPI +png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) +#ifdef PNG_oFFs_SUPPORTED + + if (info_ptr->valid & PNG_INFO_oFFs) + { + png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns"); + + if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) + return (0); + + else + return (info_ptr->x_offset); + } +#else + return (0); +#endif + return (0); +} + +png_int_32 PNGAPI +png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + +#ifdef PNG_oFFs_SUPPORTED + if (info_ptr->valid & PNG_INFO_oFFs) + { + png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns"); + + if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) + return (0); + + else + return (info_ptr->y_offset); + } +#else + return (0); +#endif + return (0); +} + +png_int_32 PNGAPI +png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + +#ifdef PNG_oFFs_SUPPORTED + if (info_ptr->valid & PNG_INFO_oFFs) + { + png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns"); + + if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) + return (0); + + else + return (info_ptr->x_offset); + } +#else + return (0); +#endif + return (0); +} + +png_int_32 PNGAPI +png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + +#ifdef PNG_oFFs_SUPPORTED + if (info_ptr->valid & PNG_INFO_oFFs) + { + png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns"); + + if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) + return (0); + + else + return (info_ptr->y_offset); + } +#else + return (0); +#endif + return (0); +} + +#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) +png_uint_32 PNGAPI +png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) +{ + return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr) + *.0254 +.5)); +} + +png_uint_32 PNGAPI +png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) +{ + return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr) + *.0254 +.5)); +} + +png_uint_32 PNGAPI +png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) +{ + return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr) + *.0254 +.5)); +} + +float PNGAPI +png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr) +{ + return ((float)png_get_x_offset_microns(png_ptr, info_ptr) + *.00003937); +} + +float PNGAPI +png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr) +{ + return ((float)png_get_y_offset_microns(png_ptr, info_ptr) + *.00003937); +} + +#ifdef PNG_pHYs_SUPPORTED +png_uint_32 PNGAPI +png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr, + png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) +{ + png_uint_32 retval = 0; + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) + { + png_debug1(1, "in %s retrieval function", "pHYs"); + + if (res_x != NULL) + { + *res_x = info_ptr->x_pixels_per_unit; + retval |= PNG_INFO_pHYs; + } + if (res_y != NULL) + { + *res_y = info_ptr->y_pixels_per_unit; + retval |= PNG_INFO_pHYs; + } + if (unit_type != NULL) + { + *unit_type = (int)info_ptr->phys_unit_type; + retval |= PNG_INFO_pHYs; + if (*unit_type == 1) + { + if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50); + if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50); + } + } + } + return (retval); +} +#endif /* PNG_pHYs_SUPPORTED */ +#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ + +/* png_get_channels really belongs in here, too, but it's been around longer */ + +#endif /* PNG_EASY_ACCESS_SUPPORTED */ + +png_byte PNGAPI +png_get_channels(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return(info_ptr->channels); + else + return (0); +} + +png_bytep PNGAPI +png_get_signature(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr != NULL && info_ptr != NULL) + return(info_ptr->signature); + else + return (NULL); +} + +#ifdef PNG_bKGD_SUPPORTED +png_uint_32 PNGAPI +png_get_bKGD(png_structp png_ptr, png_infop info_ptr, + png_color_16p *background) +{ + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) + && background != NULL) + { + png_debug1(1, "in %s retrieval function", "bKGD"); + + *background = &(info_ptr->background); + return (PNG_INFO_bKGD); + } + return (0); +} +#endif + +#ifdef PNG_cHRM_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +png_uint_32 PNGAPI +png_get_cHRM(png_structp png_ptr, png_infop info_ptr, + double *white_x, double *white_y, double *red_x, double *red_y, + double *green_x, double *green_y, double *blue_x, double *blue_y) +{ + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) + { + png_debug1(1, "in %s retrieval function", "cHRM"); + + if (white_x != NULL) + *white_x = (double)info_ptr->x_white; + if (white_y != NULL) + *white_y = (double)info_ptr->y_white; + if (red_x != NULL) + *red_x = (double)info_ptr->x_red; + if (red_y != NULL) + *red_y = (double)info_ptr->y_red; + if (green_x != NULL) + *green_x = (double)info_ptr->x_green; + if (green_y != NULL) + *green_y = (double)info_ptr->y_green; + if (blue_x != NULL) + *blue_x = (double)info_ptr->x_blue; + if (blue_y != NULL) + *blue_y = (double)info_ptr->y_blue; + return (PNG_INFO_cHRM); + } + return (0); +} +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +png_uint_32 PNGAPI +png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, + png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x, + png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, + png_fixed_point *blue_x, png_fixed_point *blue_y) +{ + png_debug1(1, "in %s retrieval function", "cHRM"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) + { + if (white_x != NULL) + *white_x = info_ptr->int_x_white; + if (white_y != NULL) + *white_y = info_ptr->int_y_white; + if (red_x != NULL) + *red_x = info_ptr->int_x_red; + if (red_y != NULL) + *red_y = info_ptr->int_y_red; + if (green_x != NULL) + *green_x = info_ptr->int_x_green; + if (green_y != NULL) + *green_y = info_ptr->int_y_green; + if (blue_x != NULL) + *blue_x = info_ptr->int_x_blue; + if (blue_y != NULL) + *blue_y = info_ptr->int_y_blue; + return (PNG_INFO_cHRM); + } + return (0); +} +#endif +#endif + +#ifdef PNG_gAMA_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +png_uint_32 PNGAPI +png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma) +{ + png_debug1(1, "in %s retrieval function", "gAMA"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) + && file_gamma != NULL) + { + *file_gamma = (double)info_ptr->gamma; + return (PNG_INFO_gAMA); + } + return (0); +} +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +png_uint_32 PNGAPI +png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, + png_fixed_point *int_file_gamma) +{ + png_debug1(1, "in %s retrieval function", "gAMA"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) + && int_file_gamma != NULL) + { + *int_file_gamma = info_ptr->int_gamma; + return (PNG_INFO_gAMA); + } + return (0); +} +#endif +#endif + +#ifdef PNG_sRGB_SUPPORTED +png_uint_32 PNGAPI +png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent) +{ + png_debug1(1, "in %s retrieval function", "sRGB"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB) + && file_srgb_intent != NULL) + { + *file_srgb_intent = (int)info_ptr->srgb_intent; + return (PNG_INFO_sRGB); + } + return (0); +} +#endif + +#ifdef PNG_iCCP_SUPPORTED +png_uint_32 PNGAPI +png_get_iCCP(png_structp png_ptr, png_infop info_ptr, + png_charpp name, int *compression_type, + png_charpp profile, png_uint_32 *proflen) +{ + png_debug1(1, "in %s retrieval function", "iCCP"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP) + && name != NULL && profile != NULL && proflen != NULL) + { + *name = info_ptr->iccp_name; + *profile = info_ptr->iccp_profile; + /* Compression_type is a dummy so the API won't have to change + * if we introduce multiple compression types later. + */ + *proflen = (int)info_ptr->iccp_proflen; + *compression_type = (int)info_ptr->iccp_compression; + return (PNG_INFO_iCCP); + } + return (0); +} +#endif + +#ifdef PNG_sPLT_SUPPORTED +png_uint_32 PNGAPI +png_get_sPLT(png_structp png_ptr, png_infop info_ptr, + png_sPLT_tpp spalettes) +{ + if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) + { + *spalettes = info_ptr->splt_palettes; + return ((png_uint_32)info_ptr->splt_palettes_num); + } + return (0); +} +#endif + +#ifdef PNG_hIST_SUPPORTED +png_uint_32 PNGAPI +png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist) +{ + png_debug1(1, "in %s retrieval function", "hIST"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) + && hist != NULL) + { + *hist = info_ptr->hist; + return (PNG_INFO_hIST); + } + return (0); +} +#endif + +png_uint_32 PNGAPI +png_get_IHDR(png_structp png_ptr, png_infop info_ptr, + png_uint_32 *width, png_uint_32 *height, int *bit_depth, + int *color_type, int *interlace_type, int *compression_type, + int *filter_type) + +{ + png_debug1(1, "in %s retrieval function", "IHDR"); + + if (png_ptr == NULL || info_ptr == NULL || width == NULL || + height == NULL || bit_depth == NULL || color_type == NULL) + return (0); + + *width = info_ptr->width; + *height = info_ptr->height; + *bit_depth = info_ptr->bit_depth; + *color_type = info_ptr->color_type; + + if (compression_type != NULL) + *compression_type = info_ptr->compression_type; + + if (filter_type != NULL) + *filter_type = info_ptr->filter_type; + + if (interlace_type != NULL) + *interlace_type = info_ptr->interlace_type; + + /* This is redundant if we can be sure that the info_ptr values were all + * assigned in png_set_IHDR(). We do the check anyhow in case an + * application has ignored our advice not to mess with the members + * of info_ptr directly. + */ + png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height, + info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type, + info_ptr->compression_type, info_ptr->filter_type); + + return (1); +} + +#ifdef PNG_oFFs_SUPPORTED +png_uint_32 PNGAPI +png_get_oFFs(png_structp png_ptr, png_infop info_ptr, + png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type) +{ + png_debug1(1, "in %s retrieval function", "oFFs"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) + && offset_x != NULL && offset_y != NULL && unit_type != NULL) + { + *offset_x = info_ptr->x_offset; + *offset_y = info_ptr->y_offset; + *unit_type = (int)info_ptr->offset_unit_type; + return (PNG_INFO_oFFs); + } + return (0); +} +#endif + +#ifdef PNG_pCAL_SUPPORTED +png_uint_32 PNGAPI +png_get_pCAL(png_structp png_ptr, png_infop info_ptr, + png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, + png_charp *units, png_charpp *params) +{ + png_debug1(1, "in %s retrieval function", "pCAL"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL) + && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL && + nparams != NULL && units != NULL && params != NULL) + { + *purpose = info_ptr->pcal_purpose; + *X0 = info_ptr->pcal_X0; + *X1 = info_ptr->pcal_X1; + *type = (int)info_ptr->pcal_type; + *nparams = (int)info_ptr->pcal_nparams; + *units = info_ptr->pcal_units; + *params = info_ptr->pcal_params; + return (PNG_INFO_pCAL); + } + return (0); +} +#endif + +#ifdef PNG_sCAL_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +png_uint_32 PNGAPI +png_get_sCAL(png_structp png_ptr, png_infop info_ptr, + int *unit, double *width, double *height) +{ + if (png_ptr != NULL && info_ptr != NULL && + (info_ptr->valid & PNG_INFO_sCAL)) + { + *unit = info_ptr->scal_unit; + *width = info_ptr->scal_pixel_width; + *height = info_ptr->scal_pixel_height; + return (PNG_INFO_sCAL); + } + return(0); +} +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +png_uint_32 PNGAPI +png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr, + int *unit, png_charpp width, png_charpp height) +{ + if (png_ptr != NULL && info_ptr != NULL && + (info_ptr->valid & PNG_INFO_sCAL)) + { + *unit = info_ptr->scal_unit; + *width = info_ptr->scal_s_width; + *height = info_ptr->scal_s_height; + return (PNG_INFO_sCAL); + } + return(0); +} +#endif +#endif +#endif + +#ifdef PNG_pHYs_SUPPORTED +png_uint_32 PNGAPI +png_get_pHYs(png_structp png_ptr, png_infop info_ptr, + png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) +{ + png_uint_32 retval = 0; + + png_debug1(1, "in %s retrieval function", "pHYs"); + + if (png_ptr != NULL && info_ptr != NULL && + (info_ptr->valid & PNG_INFO_pHYs)) + { + if (res_x != NULL) + { + *res_x = info_ptr->x_pixels_per_unit; + retval |= PNG_INFO_pHYs; + } + + if (res_y != NULL) + { + *res_y = info_ptr->y_pixels_per_unit; + retval |= PNG_INFO_pHYs; + } + + if (unit_type != NULL) + { + *unit_type = (int)info_ptr->phys_unit_type; + retval |= PNG_INFO_pHYs; + } + } + return (retval); +} +#endif + +png_uint_32 PNGAPI +png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette, + int *num_palette) +{ + png_debug1(1, "in %s retrieval function", "PLTE"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE) + && palette != NULL) + { + *palette = info_ptr->palette; + *num_palette = info_ptr->num_palette; + png_debug1(3, "num_palette = %d", *num_palette); + return (PNG_INFO_PLTE); + } + return (0); +} + +#ifdef PNG_sBIT_SUPPORTED +png_uint_32 PNGAPI +png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) +{ + png_debug1(1, "in %s retrieval function", "sBIT"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) + && sig_bit != NULL) + { + *sig_bit = &(info_ptr->sig_bit); + return (PNG_INFO_sBIT); + } + return (0); +} +#endif + +#ifdef PNG_TEXT_SUPPORTED +png_uint_32 PNGAPI +png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, + int *num_text) +{ + if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0) + { + png_debug1(1, "in %s retrieval function", + (png_ptr->chunk_name[0] == '\0' ? "text" + : (png_const_charp)png_ptr->chunk_name)); + + if (text_ptr != NULL) + *text_ptr = info_ptr->text; + + if (num_text != NULL) + *num_text = info_ptr->num_text; + + return ((png_uint_32)info_ptr->num_text); + } + if (num_text != NULL) + *num_text = 0; + return(0); +} +#endif + +#ifdef PNG_tIME_SUPPORTED +png_uint_32 PNGAPI +png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) +{ + png_debug1(1, "in %s retrieval function", "tIME"); + + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) + && mod_time != NULL) + { + *mod_time = &(info_ptr->mod_time); + return (PNG_INFO_tIME); + } + return (0); +} +#endif + +#ifdef PNG_tRNS_SUPPORTED +png_uint_32 PNGAPI +png_get_tRNS(png_structp png_ptr, png_infop info_ptr, + png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color) +{ + png_uint_32 retval = 0; + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) + { + png_debug1(1, "in %s retrieval function", "tRNS"); + + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (trans_alpha != NULL) + { + *trans_alpha = info_ptr->trans_alpha; + retval |= PNG_INFO_tRNS; + } + + if (trans_color != NULL) + *trans_color = &(info_ptr->trans_color); + } + else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */ + { + if (trans_color != NULL) + { + *trans_color = &(info_ptr->trans_color); + retval |= PNG_INFO_tRNS; + } + + if (trans_alpha != NULL) + *trans_alpha = NULL; + } + if (num_trans != NULL) + { + *num_trans = info_ptr->num_trans; + retval |= PNG_INFO_tRNS; + } + } + return (retval); +} +#endif + +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED +png_uint_32 PNGAPI +png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, + png_unknown_chunkpp unknowns) +{ + if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL) + { + *unknowns = info_ptr->unknown_chunks; + return ((png_uint_32)info_ptr->unknown_chunks_num); + } + return (0); +} +#endif + +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED +png_byte PNGAPI +png_get_rgb_to_gray_status (png_structp png_ptr) +{ + return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0); +} +#endif + +#ifdef PNG_USER_CHUNKS_SUPPORTED +png_voidp PNGAPI +png_get_user_chunk_ptr(png_structp png_ptr) +{ + return (png_ptr? png_ptr->user_chunk_ptr : NULL); +} +#endif + +png_size_t PNGAPI +png_get_compression_buffer_size(png_structp png_ptr) +{ + return (png_ptr ? png_ptr->zbuf_size : 0L); +} + + +#ifdef PNG_SET_USER_LIMITS_SUPPORTED +/* These functions were added to libpng 1.2.6 and were enabled + * by default in libpng-1.4.0 */ +png_uint_32 PNGAPI +png_get_user_width_max (png_structp png_ptr) +{ + return (png_ptr? png_ptr->user_width_max : 0); +} +png_uint_32 PNGAPI +png_get_user_height_max (png_structp png_ptr) +{ + return (png_ptr? png_ptr->user_height_max : 0); +} +/* This function was added to libpng 1.4.0 */ +png_uint_32 PNGAPI +png_get_chunk_cache_max (png_structp png_ptr) +{ + return (png_ptr? png_ptr->user_chunk_cache_max : 0); +} +/* This function was added to libpng 1.4.1 */ +png_alloc_size_t PNGAPI +png_get_chunk_malloc_max (png_structp png_ptr) +{ + return (png_ptr? + png_ptr->user_chunk_malloc_max : 0); +} +#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ + +/* These functions were added to libpng 1.4.0 */ +#ifdef PNG_IO_STATE_SUPPORTED +png_uint_32 PNGAPI +png_get_io_state (png_structp png_ptr) +{ + return png_ptr->io_state; +} + +png_bytep PNGAPI +png_get_io_chunk_name (png_structp png_ptr) +{ + return png_ptr->chunk_name; +} +#endif /* ?PNG_IO_STATE_SUPPORTED */ + +#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff --git a/png/pngmem.c b/png/pngmem.c new file mode 100644 index 0000000..c8a3f6f --- /dev/null +++ b/png/pngmem.c @@ -0,0 +1,611 @@ + +/* pngmem.c - stub functions for memory allocation + * + * Last changed in libpng 1.4.2 [May 6, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + * This file provides a location for all memory allocation. Users who + * need special memory handling are expected to supply replacement + * functions for png_malloc() and png_free(), and to use + * png_create_read_struct_2() and png_create_write_struct_2() to + * identify the replacement functions. + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) +#include "pngpriv.h" + +/* Borland DOS special memory handler */ +#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) +/* If you change this, be sure to change the one in png.h also */ + +/* Allocate memory for a png_struct. The malloc and memset can be replaced + by a single call to calloc() if this is thought to improve performance. */ +png_voidp /* PRIVATE */ +png_create_struct(int type) +{ +#ifdef PNG_USER_MEM_SUPPORTED + return (png_create_struct_2(type, NULL, NULL)); +} + +/* Alternate version of png_create_struct, for use with user-defined malloc. */ +png_voidp /* PRIVATE */ +png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) +{ +#endif /* PNG_USER_MEM_SUPPORTED */ + png_size_t size; + png_voidp struct_ptr; + + if (type == PNG_STRUCT_INFO) + size = png_sizeof(png_info); + else if (type == PNG_STRUCT_PNG) + size = png_sizeof(png_struct); + else + return (png_get_copyright(NULL)); + +#ifdef PNG_USER_MEM_SUPPORTED + if (malloc_fn != NULL) + { + png_struct dummy_struct; + png_structp png_ptr = &dummy_struct; + png_ptr->mem_ptr=mem_ptr; + struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size); + } + else +#endif /* PNG_USER_MEM_SUPPORTED */ + struct_ptr = (png_voidp)farmalloc(size); + if (struct_ptr != NULL) + png_memset(struct_ptr, 0, size); + return (struct_ptr); +} + +/* Free memory allocated by a png_create_struct() call */ +void /* PRIVATE */ +png_destroy_struct(png_voidp struct_ptr) +{ +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2(struct_ptr, NULL, NULL); +} + +/* Free memory allocated by a png_create_struct() call */ +void /* PRIVATE */ +png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, + png_voidp mem_ptr) +{ +#endif + if (struct_ptr != NULL) + { +#ifdef PNG_USER_MEM_SUPPORTED + if (free_fn != NULL) + { + png_struct dummy_struct; + png_structp png_ptr = &dummy_struct; + png_ptr->mem_ptr=mem_ptr; + (*(free_fn))(png_ptr, struct_ptr); + return; + } +#endif /* PNG_USER_MEM_SUPPORTED */ + farfree (struct_ptr); + } +} + +/* Allocate memory. For reasonable files, size should never exceed + * 64K. However, zlib may allocate more then 64K if you don't tell + * it not to. See zconf.h and png.h for more information. zlib does + * need to allocate exactly 64K, so whatever you call here must + * have the ability to do that. + * + * Borland seems to have a problem in DOS mode for exactly 64K. + * It gives you a segment with an offset of 8 (perhaps to store its + * memory stuff). zlib doesn't like this at all, so we have to + * detect and deal with it. This code should not be needed in + * Windows or OS/2 modes, and only in 16 bit mode. This code has + * been updated by Alexander Lehmann for version 0.89 to waste less + * memory. + * + * Note that we can't use png_size_t for the "size" declaration, + * since on some systems a png_size_t is a 16-bit quantity, and as a + * result, we would be truncating potentially larger memory requests + * (which should cause a fatal error) and introducing major problems. + */ +png_voidp PNGAPI +png_calloc(png_structp png_ptr, png_alloc_size_t size) +{ + png_voidp ret; + + ret = (png_malloc(png_ptr, size)); + if (ret != NULL) + png_memset(ret,0,(png_size_t)size); + return (ret); +} + +png_voidp PNGAPI +png_malloc(png_structp png_ptr, png_alloc_size_t size) +{ + png_voidp ret; + + if (png_ptr == NULL || size == 0) + return (NULL); + +#ifdef PNG_USER_MEM_SUPPORTED + if (png_ptr->malloc_fn != NULL) + ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); + else + ret = (png_malloc_default(png_ptr, size)); + if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) + png_error(png_ptr, "Out of memory"); + return (ret); +} + +png_voidp PNGAPI +png_malloc_default(png_structp png_ptr, png_alloc_size_t size) +{ + png_voidp ret; +#endif /* PNG_USER_MEM_SUPPORTED */ + + if (png_ptr == NULL || size == 0) + return (NULL); + +#ifdef PNG_MAX_MALLOC_64K + if (size > (png_uint_32)65536L) + { + png_warning(png_ptr, "Cannot Allocate > 64K"); + ret = NULL; + } + else +#endif + + if (size != (size_t)size) + ret = NULL; + else if (size == (png_uint_32)65536L) + { + if (png_ptr->offset_table == NULL) + { + /* Try to see if we need to do any of this fancy stuff */ + ret = farmalloc(size); + if (ret == NULL || ((png_size_t)ret & 0xffff)) + { + int num_blocks; + png_uint_32 total_size; + png_bytep table; + int i; + png_byte huge * hptr; + + if (ret != NULL) + { + farfree(ret); + ret = NULL; + } + + if (png_ptr->zlib_window_bits > 14) + num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14)); + else + num_blocks = 1; + if (png_ptr->zlib_mem_level >= 7) + num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7)); + else + num_blocks++; + + total_size = ((png_uint_32)65536L) * (png_uint_32)num_blocks+16; + + table = farmalloc(total_size); + + if (table == NULL) + { +#ifndef PNG_USER_MEM_SUPPORTED + if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) + png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */ + else + png_warning(png_ptr, "Out Of Memory"); +#endif + return (NULL); + } + + if ((png_size_t)table & 0xfff0) + { +#ifndef PNG_USER_MEM_SUPPORTED + if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) + png_error(png_ptr, + "Farmalloc didn't return normalized pointer"); + else + png_warning(png_ptr, + "Farmalloc didn't return normalized pointer"); +#endif + return (NULL); + } + + png_ptr->offset_table = table; + png_ptr->offset_table_ptr = farmalloc(num_blocks * + png_sizeof(png_bytep)); + + if (png_ptr->offset_table_ptr == NULL) + { +#ifndef PNG_USER_MEM_SUPPORTED + if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) + png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */ + else + png_warning(png_ptr, "Out Of memory"); +#endif + return (NULL); + } + + hptr = (png_byte huge *)table; + if ((png_size_t)hptr & 0xf) + { + hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L); + hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */ + } + for (i = 0; i < num_blocks; i++) + { + png_ptr->offset_table_ptr[i] = (png_bytep)hptr; + hptr = hptr + (png_uint_32)65536L; /* "+=" fails on TC++3.0 */ + } + + png_ptr->offset_table_number = num_blocks; + png_ptr->offset_table_count = 0; + png_ptr->offset_table_count_free = 0; + } + } + + if (png_ptr->offset_table_count >= png_ptr->offset_table_number) + { +#ifndef PNG_USER_MEM_SUPPORTED + if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) + png_error(png_ptr, "Out of Memory"); /* Note "o" and "M" */ + else + png_warning(png_ptr, "Out of Memory"); +#endif + return (NULL); + } + + ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++]; + } + else + ret = farmalloc(size); + +#ifndef PNG_USER_MEM_SUPPORTED + if (ret == NULL) + { + if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) + png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */ + else + png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */ + } +#endif + + return (ret); +} + +/* Free a pointer allocated by png_malloc(). In the default + * configuration, png_ptr is not used, but is passed in case it + * is needed. If ptr is NULL, return without taking any action. + */ +void PNGAPI +png_free(png_structp png_ptr, png_voidp ptr) +{ + if (png_ptr == NULL || ptr == NULL) + return; + +#ifdef PNG_USER_MEM_SUPPORTED + if (png_ptr->free_fn != NULL) + { + (*(png_ptr->free_fn))(png_ptr, ptr); + return; + } + else + png_free_default(png_ptr, ptr); +} + +void PNGAPI +png_free_default(png_structp png_ptr, png_voidp ptr) +{ +#endif /* PNG_USER_MEM_SUPPORTED */ + + if (png_ptr == NULL || ptr == NULL) + return; + + if (png_ptr->offset_table != NULL) + { + int i; + + for (i = 0; i < png_ptr->offset_table_count; i++) + { + if (ptr == png_ptr->offset_table_ptr[i]) + { + ptr = NULL; + png_ptr->offset_table_count_free++; + break; + } + } + if (png_ptr->offset_table_count_free == png_ptr->offset_table_count) + { + farfree(png_ptr->offset_table); + farfree(png_ptr->offset_table_ptr); + png_ptr->offset_table = NULL; + png_ptr->offset_table_ptr = NULL; + } + } + + if (ptr != NULL) + { + farfree(ptr); + } +} + +#else /* Not the Borland DOS special memory handler */ + +/* Allocate memory for a png_struct or a png_info. The malloc and + memset can be replaced by a single call to calloc() if this is thought + to improve performance noticably. */ +png_voidp /* PRIVATE */ +png_create_struct(int type) +{ +#ifdef PNG_USER_MEM_SUPPORTED + return (png_create_struct_2(type, NULL, NULL)); +} + +/* Allocate memory for a png_struct or a png_info. The malloc and + memset can be replaced by a single call to calloc() if this is thought + to improve performance noticably. */ +png_voidp /* PRIVATE */ +png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) +{ +#endif /* PNG_USER_MEM_SUPPORTED */ + png_size_t size; + png_voidp struct_ptr; + + if (type == PNG_STRUCT_INFO) + size = png_sizeof(png_info); + else if (type == PNG_STRUCT_PNG) + size = png_sizeof(png_struct); + else + return (NULL); + +#ifdef PNG_USER_MEM_SUPPORTED + if (malloc_fn != NULL) + { + png_struct dummy_struct; + png_structp png_ptr = &dummy_struct; + png_ptr->mem_ptr=mem_ptr; + struct_ptr = (*(malloc_fn))(png_ptr, size); + if (struct_ptr != NULL) + png_memset(struct_ptr, 0, size); + return (struct_ptr); + } +#endif /* PNG_USER_MEM_SUPPORTED */ + +#if defined(__TURBOC__) && !defined(__FLAT__) + struct_ptr = (png_voidp)farmalloc(size); +#else +# if defined(_MSC_VER) && defined(MAXSEG_64K) + struct_ptr = (png_voidp)halloc(size, 1); +# else + struct_ptr = (png_voidp)malloc(size); +# endif +#endif + if (struct_ptr != NULL) + png_memset(struct_ptr, 0, size); + + return (struct_ptr); +} + + +/* Free memory allocated by a png_create_struct() call */ +void /* PRIVATE */ +png_destroy_struct(png_voidp struct_ptr) +{ +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2(struct_ptr, NULL, NULL); +} + +/* Free memory allocated by a png_create_struct() call */ +void /* PRIVATE */ +png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, + png_voidp mem_ptr) +{ +#endif /* PNG_USER_MEM_SUPPORTED */ + if (struct_ptr != NULL) + { +#ifdef PNG_USER_MEM_SUPPORTED + if (free_fn != NULL) + { + png_struct dummy_struct; + png_structp png_ptr = &dummy_struct; + png_ptr->mem_ptr=mem_ptr; + (*(free_fn))(png_ptr, struct_ptr); + return; + } +#endif /* PNG_USER_MEM_SUPPORTED */ +#if defined(__TURBOC__) && !defined(__FLAT__) + farfree(struct_ptr); +#else +# if defined(_MSC_VER) && defined(MAXSEG_64K) + hfree(struct_ptr); +# else + free(struct_ptr); +# endif +#endif + } +} + +/* Allocate memory. For reasonable files, size should never exceed + * 64K. However, zlib may allocate more then 64K if you don't tell + * it not to. See zconf.h and png.h for more information. zlib does + * need to allocate exactly 64K, so whatever you call here must + * have the ability to do that. + */ + +png_voidp PNGAPI +png_calloc(png_structp png_ptr, png_alloc_size_t size) +{ + png_voidp ret; + + ret = (png_malloc(png_ptr, size)); + if (ret != NULL) + png_memset(ret,0,(png_size_t)size); + return (ret); +} + +png_voidp PNGAPI +png_malloc(png_structp png_ptr, png_alloc_size_t size) +{ + png_voidp ret; + +#ifdef PNG_USER_MEM_SUPPORTED + if (png_ptr == NULL || size == 0) + return (NULL); + + if (png_ptr->malloc_fn != NULL) + ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); + else + ret = (png_malloc_default(png_ptr, size)); + if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) + png_error(png_ptr, "Out of Memory"); + return (ret); +} + +png_voidp PNGAPI +png_malloc_default(png_structp png_ptr, png_alloc_size_t size) +{ + png_voidp ret; +#endif /* PNG_USER_MEM_SUPPORTED */ + + if (png_ptr == NULL || size == 0) + return (NULL); + +#ifdef PNG_MAX_MALLOC_64K + if (size > (png_uint_32)65536L) + { +#ifndef PNG_USER_MEM_SUPPORTED + if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) + png_error(png_ptr, "Cannot Allocate > 64K"); + else +#endif + return NULL; + } +#endif + + /* Check for overflow */ +#if defined(__TURBOC__) && !defined(__FLAT__) + if (size != (unsigned long)size) + ret = NULL; + else + ret = farmalloc(size); +#else +# if defined(_MSC_VER) && defined(MAXSEG_64K) + if (size != (unsigned long)size) + ret = NULL; + else + ret = halloc(size, 1); +# else + if (size != (size_t)size) + ret = NULL; + else + ret = malloc((size_t)size); +# endif +#endif + +#ifndef PNG_USER_MEM_SUPPORTED + if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) + png_error(png_ptr, "Out of Memory"); +#endif + + return (ret); +} + +/* Free a pointer allocated by png_malloc(). If ptr is NULL, return + * without taking any action. + */ +void PNGAPI +png_free(png_structp png_ptr, png_voidp ptr) +{ + if (png_ptr == NULL || ptr == NULL) + return; + +#ifdef PNG_USER_MEM_SUPPORTED + if (png_ptr->free_fn != NULL) + { + (*(png_ptr->free_fn))(png_ptr, ptr); + return; + } + else + png_free_default(png_ptr, ptr); +} +void PNGAPI +png_free_default(png_structp png_ptr, png_voidp ptr) +{ + if (png_ptr == NULL || ptr == NULL) + return; + +#endif /* PNG_USER_MEM_SUPPORTED */ + +#if defined(__TURBOC__) && !defined(__FLAT__) + farfree(ptr); +#else +# if defined(_MSC_VER) && defined(MAXSEG_64K) + hfree(ptr); +# else + free(ptr); +# endif +#endif +} + +#endif /* Not Borland DOS special memory handler */ + +/* This function was added at libpng version 1.2.3. The png_malloc_warn() + * function will set up png_malloc() to issue a png_warning and return NULL + * instead of issuing a png_error, if it fails to allocate the requested + * memory. + */ +png_voidp PNGAPI +png_malloc_warn(png_structp png_ptr, png_alloc_size_t size) +{ + png_voidp ptr; + png_uint_32 save_flags; + if (png_ptr == NULL) + return (NULL); + + save_flags = png_ptr->flags; + png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK; + ptr = (png_voidp)png_malloc((png_structp)png_ptr, size); + png_ptr->flags=save_flags; + return(ptr); +} + + +#ifdef PNG_USER_MEM_SUPPORTED +/* This function is called when the application wants to use another method + * of allocating and freeing memory. + */ +void PNGAPI +png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr + malloc_fn, png_free_ptr free_fn) +{ + if (png_ptr != NULL) + { + png_ptr->mem_ptr = mem_ptr; + png_ptr->malloc_fn = malloc_fn; + png_ptr->free_fn = free_fn; + } +} + +/* This function returns a pointer to the mem_ptr associated with the user + * functions. The application should free any memory associated with this + * pointer before png_write_destroy and png_read_destroy are called. + */ +png_voidp PNGAPI +png_get_mem_ptr(png_structp png_ptr) +{ + if (png_ptr == NULL) + return (NULL); + return ((png_voidp)png_ptr->mem_ptr); +} +#endif /* PNG_USER_MEM_SUPPORTED */ +#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff --git a/png/pngnow.png b/png/pngnow.png new file mode 100644 index 0000000..82793eb Binary files /dev/null and b/png/pngnow.png differ diff --git a/png/pngpread.c b/png/pngpread.c new file mode 100644 index 0000000..3280d34 --- /dev/null +++ b/png/pngpread.c @@ -0,0 +1,1765 @@ + +/* pngpread.c - read a png file in push mode + * + * Last changed in libpng 1.4.3 [June 26, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +#include "pngpriv.h" + +/* Push model modes */ +#define PNG_READ_SIG_MODE 0 +#define PNG_READ_CHUNK_MODE 1 +#define PNG_READ_IDAT_MODE 2 +#define PNG_SKIP_MODE 3 +#define PNG_READ_tEXt_MODE 4 +#define PNG_READ_zTXt_MODE 5 +#define PNG_READ_DONE_MODE 6 +#define PNG_READ_iTXt_MODE 7 +#define PNG_ERROR_MODE 8 + +void PNGAPI +png_process_data(png_structp png_ptr, png_infop info_ptr, + png_bytep buffer, png_size_t buffer_size) +{ + if (png_ptr == NULL || info_ptr == NULL) + return; + + png_push_restore_buffer(png_ptr, buffer, buffer_size); + + while (png_ptr->buffer_size) + { + png_process_some_data(png_ptr, info_ptr); + } +} + +/* What we do with the incoming data depends on what we were previously + * doing before we ran out of data... + */ +void /* PRIVATE */ +png_process_some_data(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr == NULL) + return; + + switch (png_ptr->process_mode) + { + case PNG_READ_SIG_MODE: + { + png_push_read_sig(png_ptr, info_ptr); + break; + } + + case PNG_READ_CHUNK_MODE: + { + png_push_read_chunk(png_ptr, info_ptr); + break; + } + + case PNG_READ_IDAT_MODE: + { + png_push_read_IDAT(png_ptr); + break; + } + +#ifdef PNG_READ_tEXt_SUPPORTED + case PNG_READ_tEXt_MODE: + { + png_push_read_tEXt(png_ptr, info_ptr); + break; + } + +#endif +#ifdef PNG_READ_zTXt_SUPPORTED + case PNG_READ_zTXt_MODE: + { + png_push_read_zTXt(png_ptr, info_ptr); + break; + } + +#endif +#ifdef PNG_READ_iTXt_SUPPORTED + case PNG_READ_iTXt_MODE: + { + png_push_read_iTXt(png_ptr, info_ptr); + break; + } + +#endif + case PNG_SKIP_MODE: + { + png_push_crc_finish(png_ptr); + break; + } + + default: + { + png_ptr->buffer_size = 0; + break; + } + } +} + +/* Read any remaining signature bytes from the stream and compare them with + * the correct PNG signature. It is possible that this routine is called + * with bytes already read from the signature, either because they have been + * checked by the calling application, or because of multiple calls to this + * routine. + */ +void /* PRIVATE */ +png_push_read_sig(png_structp png_ptr, png_infop info_ptr) +{ + png_size_t num_checked = png_ptr->sig_bytes, + num_to_check = 8 - num_checked; + + if (png_ptr->buffer_size < num_to_check) + { + num_to_check = png_ptr->buffer_size; + } + + png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]), + num_to_check); + png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check); + + if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check)) + { + if (num_checked < 4 && + png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) + png_error(png_ptr, "Not a PNG file"); + else + png_error(png_ptr, "PNG file corrupted by ASCII conversion"); + } + else + { + if (png_ptr->sig_bytes >= 8) + { + png_ptr->process_mode = PNG_READ_CHUNK_MODE; + } + } +} + +void /* PRIVATE */ +png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) +{ + PNG_IHDR; + PNG_IDAT; + PNG_IEND; + PNG_PLTE; +#ifdef PNG_READ_bKGD_SUPPORTED + PNG_bKGD; +#endif +#ifdef PNG_READ_cHRM_SUPPORTED + PNG_cHRM; +#endif +#ifdef PNG_READ_gAMA_SUPPORTED + PNG_gAMA; +#endif +#ifdef PNG_READ_hIST_SUPPORTED + PNG_hIST; +#endif +#ifdef PNG_READ_iCCP_SUPPORTED + PNG_iCCP; +#endif +#ifdef PNG_READ_iTXt_SUPPORTED + PNG_iTXt; +#endif +#ifdef PNG_READ_oFFs_SUPPORTED + PNG_oFFs; +#endif +#ifdef PNG_READ_pCAL_SUPPORTED + PNG_pCAL; +#endif +#ifdef PNG_READ_pHYs_SUPPORTED + PNG_pHYs; +#endif +#ifdef PNG_READ_sBIT_SUPPORTED + PNG_sBIT; +#endif +#ifdef PNG_READ_sCAL_SUPPORTED + PNG_sCAL; +#endif +#ifdef PNG_READ_sRGB_SUPPORTED + PNG_sRGB; +#endif +#ifdef PNG_READ_sPLT_SUPPORTED + PNG_sPLT; +#endif +#ifdef PNG_READ_tEXt_SUPPORTED + PNG_tEXt; +#endif +#ifdef PNG_READ_tIME_SUPPORTED + PNG_tIME; +#endif +#ifdef PNG_READ_tRNS_SUPPORTED + PNG_tRNS; +#endif +#ifdef PNG_READ_zTXt_SUPPORTED + PNG_zTXt; +#endif + + /* First we make sure we have enough data for the 4 byte chunk name + * and the 4 byte chunk length before proceeding with decoding the + * chunk data. To fully decode each of these chunks, we also make + * sure we have enough data in the buffer for the 4 byte CRC at the + * end of every chunk (except IDAT, which is handled separately). + */ + if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) + { + png_byte chunk_length[4]; + + if (png_ptr->buffer_size < 8) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_fill_buffer(png_ptr, chunk_length, 4); + png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length); + png_reset_crc(png_ptr); + png_crc_read(png_ptr, png_ptr->chunk_name, 4); + png_check_chunk_name(png_ptr, png_ptr->chunk_name); + png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; + } + + if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + if (png_ptr->mode & PNG_AFTER_IDAT) + png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; + + if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) + { + if (png_ptr->push_length != 13) + png_error(png_ptr, "Invalid IHDR length"); + + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length); + } + + else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length); + + png_ptr->process_mode = PNG_READ_DONE_MODE; + png_push_have_end(png_ptr, info_ptr); + } + +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + png_ptr->mode |= PNG_HAVE_IDAT; + + png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); + + if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) + png_ptr->mode |= PNG_HAVE_PLTE; + + else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + { + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before IDAT"); + + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + !(png_ptr->mode & PNG_HAVE_PLTE)) + png_error(png_ptr, "Missing PLTE before IDAT"); + } + } + +#endif + else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length); + } + + else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + { + /* If we reach an IDAT chunk, this means we have read all of the + * header chunks, and we can start reading the image (or if this + * is called after the image has been read - we have an error). + */ + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before IDAT"); + + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + !(png_ptr->mode & PNG_HAVE_PLTE)) + png_error(png_ptr, "Missing PLTE before IDAT"); + + if (png_ptr->mode & PNG_HAVE_IDAT) + { + if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT)) + if (png_ptr->push_length == 0) + return; + + if (png_ptr->mode & PNG_AFTER_IDAT) + png_benign_error(png_ptr, "Too many IDATs found"); + } + + png_ptr->idat_size = png_ptr->push_length; + png_ptr->mode |= PNG_HAVE_IDAT; + png_ptr->process_mode = PNG_READ_IDAT_MODE; + png_push_have_info(png_ptr, info_ptr); + png_ptr->zstream.avail_out = + (uInt) PNG_ROWBYTES(png_ptr->pixel_depth, + png_ptr->iwidth) + 1; + png_ptr->zstream.next_out = png_ptr->row_buf; + return; + } + +#ifdef PNG_READ_gAMA_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_sBIT_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_cHRM_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_sRGB_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_iCCP_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_sPLT_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_tRNS_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_bKGD_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_hIST_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_pHYs_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_oFFs_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length); + } +#endif + +#ifdef PNG_READ_pCAL_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_sCAL_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_tIME_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_tEXt_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_zTXt_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif +#ifdef PNG_READ_iTXt_SUPPORTED + else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif + else + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); + } + + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; +} + +void /* PRIVATE */ +png_push_crc_skip(png_structp png_ptr, png_uint_32 skip) +{ + png_ptr->process_mode = PNG_SKIP_MODE; + png_ptr->skip_length = skip; +} + +void /* PRIVATE */ +png_push_crc_finish(png_structp png_ptr) +{ + if (png_ptr->skip_length && png_ptr->save_buffer_size) + { + png_size_t save_size; + + if (png_ptr->skip_length < (png_uint_32)png_ptr->save_buffer_size) + save_size = (png_size_t)png_ptr->skip_length; + else + save_size = png_ptr->save_buffer_size; + + png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); + + png_ptr->skip_length -= save_size; + png_ptr->buffer_size -= save_size; + png_ptr->save_buffer_size -= save_size; + png_ptr->save_buffer_ptr += save_size; + } + if (png_ptr->skip_length && png_ptr->current_buffer_size) + { + png_size_t save_size; + + if (png_ptr->skip_length < (png_uint_32)png_ptr->current_buffer_size) + save_size = (png_size_t)png_ptr->skip_length; + else + save_size = png_ptr->current_buffer_size; + + png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); + + png_ptr->skip_length -= save_size; + png_ptr->buffer_size -= save_size; + png_ptr->current_buffer_size -= save_size; + png_ptr->current_buffer_ptr += save_size; + } + if (!png_ptr->skip_length) + { + if (png_ptr->buffer_size < 4) + { + png_push_save_buffer(png_ptr); + return; + } + + png_crc_finish(png_ptr, 0); + png_ptr->process_mode = PNG_READ_CHUNK_MODE; + } +} + +void PNGAPI +png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) +{ + png_bytep ptr; + + if (png_ptr == NULL) + return; + + ptr = buffer; + if (png_ptr->save_buffer_size) + { + png_size_t save_size; + + if (length < png_ptr->save_buffer_size) + save_size = length; + else + save_size = png_ptr->save_buffer_size; + + png_memcpy(ptr, png_ptr->save_buffer_ptr, save_size); + length -= save_size; + ptr += save_size; + png_ptr->buffer_size -= save_size; + png_ptr->save_buffer_size -= save_size; + png_ptr->save_buffer_ptr += save_size; + } + if (length && png_ptr->current_buffer_size) + { + png_size_t save_size; + + if (length < png_ptr->current_buffer_size) + save_size = length; + + else + save_size = png_ptr->current_buffer_size; + + png_memcpy(ptr, png_ptr->current_buffer_ptr, save_size); + png_ptr->buffer_size -= save_size; + png_ptr->current_buffer_size -= save_size; + png_ptr->current_buffer_ptr += save_size; + } +} + +void /* PRIVATE */ +png_push_save_buffer(png_structp png_ptr) +{ + if (png_ptr->save_buffer_size) + { + if (png_ptr->save_buffer_ptr != png_ptr->save_buffer) + { + png_size_t i, istop; + png_bytep sp; + png_bytep dp; + + istop = png_ptr->save_buffer_size; + for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer; + i < istop; i++, sp++, dp++) + { + *dp = *sp; + } + } + } + if (png_ptr->save_buffer_size + png_ptr->current_buffer_size > + png_ptr->save_buffer_max) + { + png_size_t new_max; + png_bytep old_buffer; + + if (png_ptr->save_buffer_size > PNG_SIZE_MAX - + (png_ptr->current_buffer_size + 256)) + { + png_error(png_ptr, "Potential overflow of save_buffer"); + } + + new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256; + old_buffer = png_ptr->save_buffer; + png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr, + (png_size_t)new_max); + if (png_ptr->save_buffer == NULL) + { + png_free(png_ptr, old_buffer); + png_error(png_ptr, "Insufficient memory for save_buffer"); + } + png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size); + png_free(png_ptr, old_buffer); + png_ptr->save_buffer_max = new_max; + } + if (png_ptr->current_buffer_size) + { + png_memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size, + png_ptr->current_buffer_ptr, png_ptr->current_buffer_size); + png_ptr->save_buffer_size += png_ptr->current_buffer_size; + png_ptr->current_buffer_size = 0; + } + png_ptr->save_buffer_ptr = png_ptr->save_buffer; + png_ptr->buffer_size = 0; +} + +void /* PRIVATE */ +png_push_restore_buffer(png_structp png_ptr, png_bytep buffer, + png_size_t buffer_length) +{ + png_ptr->current_buffer = buffer; + png_ptr->current_buffer_size = buffer_length; + png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size; + png_ptr->current_buffer_ptr = png_ptr->current_buffer; +} + +void /* PRIVATE */ +png_push_read_IDAT(png_structp png_ptr) +{ + PNG_IDAT; + if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) + { + png_byte chunk_length[4]; + + if (png_ptr->buffer_size < 8) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_fill_buffer(png_ptr, chunk_length, 4); + png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length); + png_reset_crc(png_ptr); + png_crc_read(png_ptr, png_ptr->chunk_name, 4); + png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; + + if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + { + png_ptr->process_mode = PNG_READ_CHUNK_MODE; + if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) + png_error(png_ptr, "Not enough compressed data"); + return; + } + + png_ptr->idat_size = png_ptr->push_length; + } + if (png_ptr->idat_size && png_ptr->save_buffer_size) + { + png_size_t save_size; + + if (png_ptr->idat_size < (png_uint_32)png_ptr->save_buffer_size) + { + save_size = (png_size_t)png_ptr->idat_size; + + /* Check for overflow */ + if ((png_uint_32)save_size != png_ptr->idat_size) + png_error(png_ptr, "save_size overflowed in pngpread"); + } + else + save_size = png_ptr->save_buffer_size; + + png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); + + png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size); + + png_ptr->idat_size -= save_size; + png_ptr->buffer_size -= save_size; + png_ptr->save_buffer_size -= save_size; + png_ptr->save_buffer_ptr += save_size; + } + if (png_ptr->idat_size && png_ptr->current_buffer_size) + { + png_size_t save_size; + + if (png_ptr->idat_size < (png_uint_32)png_ptr->current_buffer_size) + { + save_size = (png_size_t)png_ptr->idat_size; + + /* Check for overflow */ + if ((png_uint_32)save_size != png_ptr->idat_size) + png_error(png_ptr, "save_size overflowed in pngpread"); + } + else + save_size = png_ptr->current_buffer_size; + + png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); + + png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size); + + png_ptr->idat_size -= save_size; + png_ptr->buffer_size -= save_size; + png_ptr->current_buffer_size -= save_size; + png_ptr->current_buffer_ptr += save_size; + } + if (!png_ptr->idat_size) + { + if (png_ptr->buffer_size < 4) + { + png_push_save_buffer(png_ptr); + return; + } + + png_crc_finish(png_ptr, 0); + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; + png_ptr->mode |= PNG_AFTER_IDAT; + } +} + +void /* PRIVATE */ +png_process_IDAT_data(png_structp png_ptr, png_bytep buffer, + png_size_t buffer_length) +{ + /* The caller checks for a non-zero buffer length. */ + if (!(buffer_length > 0) || buffer == NULL) + png_error(png_ptr, "No IDAT data (internal error)"); + + /* This routine must process all the data it has been given + * before returning, calling the row callback as required to + * handle the uncompressed results. + */ + png_ptr->zstream.next_in = buffer; + png_ptr->zstream.avail_in = (uInt)buffer_length; + + /* Keep going until the decompressed data is all processed + * or the stream marked as finished. + */ + while (png_ptr->zstream.avail_in > 0 && + !(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) + { + int ret; + + /* We have data for zlib, but we must check that zlib + * has somewhere to put the results. It doesn't matter + * if we don't expect any results -- it may be the input + * data is just the LZ end code. + */ + if (!(png_ptr->zstream.avail_out > 0)) + { + png_ptr->zstream.avail_out = + (uInt) PNG_ROWBYTES(png_ptr->pixel_depth, + png_ptr->iwidth) + 1; + png_ptr->zstream.next_out = png_ptr->row_buf; + } + + /* Using Z_SYNC_FLUSH here means that an unterminated + * LZ stream can still be handled (a stream with a missing + * end code), otherwise (Z_NO_FLUSH) a future zlib + * implementation might defer output and, therefore, + * change the current behavior. (See comments in inflate.c + * for why this doesn't happen at present with zlib 1.2.5.) + */ + ret = inflate(&png_ptr->zstream, Z_SYNC_FLUSH); + + /* Check for any failure before proceeding. */ + if (ret != Z_OK && ret != Z_STREAM_END) + { + /* Terminate the decompression. */ + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + + /* This may be a truncated stream (missing or + * damaged end code). Treat that as a warning. + */ + if (png_ptr->row_number >= png_ptr->num_rows || + png_ptr->pass > 6) + png_warning(png_ptr, "Truncated compressed data in IDAT"); + else + png_error(png_ptr, "Decompression error in IDAT"); + + /* Skip the check on unprocessed input */ + return; + } + + /* Did inflate output any data? */ + if (png_ptr->zstream.next_out != png_ptr->row_buf) + { + /* Is this unexpected data after the last row? + * If it is, artificially terminate the LZ output + * here. + */ + if (png_ptr->row_number >= png_ptr->num_rows || + png_ptr->pass > 6) + { + /* Extra data. */ + png_warning(png_ptr, "Extra compressed data in IDAT"); + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + /* Do no more processing; skip the unprocessed + * input check below. + */ + return; + } + + /* Do we have a complete row? */ + if (png_ptr->zstream.avail_out == 0) + png_push_process_row(png_ptr); + } + + /* And check for the end of the stream. */ + if (ret == Z_STREAM_END) + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + } + + /* All the data should have been processed, if anything + * is left at this point we have bytes of IDAT data + * after the zlib end code. + */ + if (png_ptr->zstream.avail_in > 0) + png_warning(png_ptr, "Extra compression data"); +} + +void /* PRIVATE */ +png_push_process_row(png_structp png_ptr) +{ + png_ptr->row_info.color_type = png_ptr->color_type; + png_ptr->row_info.width = png_ptr->iwidth; + png_ptr->row_info.channels = png_ptr->channels; + png_ptr->row_info.bit_depth = png_ptr->bit_depth; + png_ptr->row_info.pixel_depth = png_ptr->pixel_depth; + + png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, + png_ptr->row_info.width); + + png_read_filter_row(png_ptr, &(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->prev_row + 1, + (int)(png_ptr->row_buf[0])); + + png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1); + + if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) + png_do_read_transformations(png_ptr); + +#ifdef PNG_READ_INTERLACING_SUPPORTED + /* Blow up interlaced rows to full size */ + if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) + { + if (png_ptr->pass < 6) +/* old interface (pre-1.0.9): + png_do_read_interlace(&(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); + */ + png_do_read_interlace(png_ptr); + + switch (png_ptr->pass) + { + case 0: + { + int i; + for (i = 0; i < 8 && png_ptr->pass == 0; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); /* Updates png_ptr->pass */ + } + + if (png_ptr->pass == 2) /* Pass 1 might be empty */ + { + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + + if (png_ptr->pass == 4 && png_ptr->height <= 4) + { + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + + if (png_ptr->pass == 6 && png_ptr->height <= 4) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + + break; + } + + case 1: + { + int i; + for (i = 0; i < 8 && png_ptr->pass == 1; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + + if (png_ptr->pass == 2) /* Skip top 4 generated rows */ + { + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + + break; + } + + case 2: + { + int i; + + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + + if (png_ptr->pass == 4) /* Pass 3 might be empty */ + { + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + + break; + } + + case 3: + { + int i; + + for (i = 0; i < 4 && png_ptr->pass == 3; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + + if (png_ptr->pass == 4) /* Skip top two generated rows */ + { + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + + break; + } + + case 4: + { + int i; + + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + + if (png_ptr->pass == 6) /* Pass 5 might be empty */ + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + + break; + } + + case 5: + { + int i; + + for (i = 0; i < 2 && png_ptr->pass == 5; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + + if (png_ptr->pass == 6) /* Skip top generated row */ + { + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + + break; + } + case 6: + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + + if (png_ptr->pass != 6) + break; + + png_push_have_row(png_ptr, NULL); + png_read_push_finish_row(png_ptr); + } + } + } + else +#endif + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } +} + +void /* PRIVATE */ +png_read_push_finish_row(png_structp png_ptr) +{ + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* Start of interlace block */ + PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; + + /* Offset to next interlace block */ + PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; + + /* Start of interlace block in the y direction */ + PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; + + /* Offset to next interlace block in the y direction */ + PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; + + /* Height of interlace block. This is not currently used - if you need + * it, uncomment it here and in png.h + PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; + */ + + png_ptr->row_number++; + if (png_ptr->row_number < png_ptr->num_rows) + return; + +#ifdef PNG_READ_INTERLACING_SUPPORTED + if (png_ptr->interlaced) + { + png_ptr->row_number = 0; + png_memset(png_ptr->prev_row, 0, + png_ptr->rowbytes + 1); + do + { + png_ptr->pass++; + if ((png_ptr->pass == 1 && png_ptr->width < 5) || + (png_ptr->pass == 3 && png_ptr->width < 3) || + (png_ptr->pass == 5 && png_ptr->width < 2)) + png_ptr->pass++; + + if (png_ptr->pass > 7) + png_ptr->pass--; + + if (png_ptr->pass >= 7) + break; + + png_ptr->iwidth = (png_ptr->width + + png_pass_inc[png_ptr->pass] - 1 - + png_pass_start[png_ptr->pass]) / + png_pass_inc[png_ptr->pass]; + + if (png_ptr->transformations & PNG_INTERLACE) + break; + + png_ptr->num_rows = (png_ptr->height + + png_pass_yinc[png_ptr->pass] - 1 - + png_pass_ystart[png_ptr->pass]) / + png_pass_yinc[png_ptr->pass]; + + } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); + } +#endif /* PNG_READ_INTERLACING_SUPPORTED */ +} + +#ifdef PNG_READ_tEXt_SUPPORTED +void /* PRIVATE */ +png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 + length) +{ + if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) + { + png_error(png_ptr, "Out of place tEXt"); + info_ptr = info_ptr; /* To quiet some compiler warnings */ + } + +#ifdef PNG_MAX_MALLOC_64K + png_ptr->skip_length = 0; /* This may not be necessary */ + + if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */ + { + png_warning(png_ptr, "tEXt chunk too large to fit in memory"); + png_ptr->skip_length = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + png_ptr->current_text = (png_charp)png_malloc(png_ptr, + (png_size_t)(length + 1)); + png_ptr->current_text[length] = '\0'; + png_ptr->current_text_ptr = png_ptr->current_text; + png_ptr->current_text_size = (png_size_t)length; + png_ptr->current_text_left = (png_size_t)length; + png_ptr->process_mode = PNG_READ_tEXt_MODE; +} + +void /* PRIVATE */ +png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr->buffer_size && png_ptr->current_text_left) + { + png_size_t text_size; + + if (png_ptr->buffer_size < png_ptr->current_text_left) + text_size = png_ptr->buffer_size; + + else + text_size = png_ptr->current_text_left; + + png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); + png_ptr->current_text_left -= text_size; + png_ptr->current_text_ptr += text_size; + } + if (!(png_ptr->current_text_left)) + { + png_textp text_ptr; + png_charp text; + png_charp key; + int ret; + + if (png_ptr->buffer_size < 4) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_crc_finish(png_ptr); + +#ifdef PNG_MAX_MALLOC_64K + if (png_ptr->skip_length) + return; +#endif + + key = png_ptr->current_text; + + for (text = key; *text; text++) + /* Empty loop */ ; + + if (text < key + png_ptr->current_text_size) + text++; + + text_ptr = (png_textp)png_malloc(png_ptr, + png_sizeof(png_text)); + text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr->key = key; +#ifdef PNG_iTXt_SUPPORTED + text_ptr->lang = NULL; + text_ptr->lang_key = NULL; +#endif + text_ptr->text = text; + + ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_free(png_ptr, key); + png_free(png_ptr, text_ptr); + png_ptr->current_text = NULL; + + if (ret) + png_warning(png_ptr, "Insufficient memory to store text chunk"); + } +} +#endif + +#ifdef PNG_READ_zTXt_SUPPORTED +void /* PRIVATE */ +png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 + length) +{ + if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) + { + png_error(png_ptr, "Out of place zTXt"); + info_ptr = info_ptr; /* To quiet some compiler warnings */ + } + +#ifdef PNG_MAX_MALLOC_64K + /* We can't handle zTXt chunks > 64K, since we don't have enough space + * to be able to store the uncompressed data. Actually, the threshold + * is probably around 32K, but it isn't as definite as 64K is. + */ + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "zTXt chunk too large to fit in memory"); + png_push_crc_skip(png_ptr, length); + return; + } +#endif + + png_ptr->current_text = (png_charp)png_malloc(png_ptr, + (png_size_t)(length + 1)); + png_ptr->current_text[length] = '\0'; + png_ptr->current_text_ptr = png_ptr->current_text; + png_ptr->current_text_size = (png_size_t)length; + png_ptr->current_text_left = (png_size_t)length; + png_ptr->process_mode = PNG_READ_zTXt_MODE; +} + +void /* PRIVATE */ +png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr->buffer_size && png_ptr->current_text_left) + { + png_size_t text_size; + + if (png_ptr->buffer_size < (png_uint_32)png_ptr->current_text_left) + text_size = png_ptr->buffer_size; + + else + text_size = png_ptr->current_text_left; + + png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); + png_ptr->current_text_left -= text_size; + png_ptr->current_text_ptr += text_size; + } + if (!(png_ptr->current_text_left)) + { + png_textp text_ptr; + png_charp text; + png_charp key; + int ret; + png_size_t text_size, key_size; + + if (png_ptr->buffer_size < 4) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_crc_finish(png_ptr); + + key = png_ptr->current_text; + + for (text = key; *text; text++) + /* Empty loop */ ; + + /* zTXt can't have zero text */ + if (text >= key + png_ptr->current_text_size) + { + png_ptr->current_text = NULL; + png_free(png_ptr, key); + return; + } + + text++; + + if (*text != PNG_TEXT_COMPRESSION_zTXt) /* Check compression byte */ + { + png_ptr->current_text = NULL; + png_free(png_ptr, key); + return; + } + + text++; + + png_ptr->zstream.next_in = (png_bytep )text; + png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size - + (text - key)); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + + key_size = text - key; + text_size = 0; + text = NULL; + ret = Z_STREAM_END; + + while (png_ptr->zstream.avail_in) + { + ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); + if (ret != Z_OK && ret != Z_STREAM_END) + { + inflateReset(&png_ptr->zstream); + png_ptr->zstream.avail_in = 0; + png_ptr->current_text = NULL; + png_free(png_ptr, key); + png_free(png_ptr, text); + return; + } + if (!(png_ptr->zstream.avail_out) || ret == Z_STREAM_END) + { + if (text == NULL) + { + text = (png_charp)png_malloc(png_ptr, + (png_ptr->zbuf_size + - png_ptr->zstream.avail_out + key_size + 1)); + + png_memcpy(text + key_size, png_ptr->zbuf, + png_ptr->zbuf_size - png_ptr->zstream.avail_out); + + png_memcpy(text, key, key_size); + + text_size = key_size + png_ptr->zbuf_size - + png_ptr->zstream.avail_out; + + *(text + text_size) = '\0'; + } + else + { + png_charp tmp; + + tmp = text; + text = (png_charp)png_malloc(png_ptr, text_size + + (png_ptr->zbuf_size + - png_ptr->zstream.avail_out + 1)); + + png_memcpy(text, tmp, text_size); + png_free(png_ptr, tmp); + + png_memcpy(text + text_size, png_ptr->zbuf, + png_ptr->zbuf_size - png_ptr->zstream.avail_out); + + text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out; + *(text + text_size) = '\0'; + } + if (ret != Z_STREAM_END) + { + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + } + } + else + { + break; + } + + if (ret == Z_STREAM_END) + break; + } + + inflateReset(&png_ptr->zstream); + png_ptr->zstream.avail_in = 0; + + if (ret != Z_STREAM_END) + { + png_ptr->current_text = NULL; + png_free(png_ptr, key); + png_free(png_ptr, text); + return; + } + + png_ptr->current_text = NULL; + png_free(png_ptr, key); + key = text; + text += key_size; + + text_ptr = (png_textp)png_malloc(png_ptr, + png_sizeof(png_text)); + text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt; + text_ptr->key = key; +#ifdef PNG_iTXt_SUPPORTED + text_ptr->lang = NULL; + text_ptr->lang_key = NULL; +#endif + text_ptr->text = text; + + ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_free(png_ptr, key); + png_free(png_ptr, text_ptr); + + if (ret) + png_warning(png_ptr, "Insufficient memory to store text chunk"); + } +} +#endif + +#ifdef PNG_READ_iTXt_SUPPORTED +void /* PRIVATE */ +png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 + length) +{ + if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) + { + png_error(png_ptr, "Out of place iTXt"); + info_ptr = info_ptr; /* To quiet some compiler warnings */ + } + +#ifdef PNG_MAX_MALLOC_64K + png_ptr->skip_length = 0; /* This may not be necessary */ + + if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */ + { + png_warning(png_ptr, "iTXt chunk too large to fit in memory"); + png_ptr->skip_length = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + png_ptr->current_text = (png_charp)png_malloc(png_ptr, + (png_size_t)(length + 1)); + png_ptr->current_text[length] = '\0'; + png_ptr->current_text_ptr = png_ptr->current_text; + png_ptr->current_text_size = (png_size_t)length; + png_ptr->current_text_left = (png_size_t)length; + png_ptr->process_mode = PNG_READ_iTXt_MODE; +} + +void /* PRIVATE */ +png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr) +{ + + if (png_ptr->buffer_size && png_ptr->current_text_left) + { + png_size_t text_size; + + if (png_ptr->buffer_size < png_ptr->current_text_left) + text_size = png_ptr->buffer_size; + + else + text_size = png_ptr->current_text_left; + + png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); + png_ptr->current_text_left -= text_size; + png_ptr->current_text_ptr += text_size; + } + if (!(png_ptr->current_text_left)) + { + png_textp text_ptr; + png_charp key; + int comp_flag; + png_charp lang; + png_charp lang_key; + png_charp text; + int ret; + + if (png_ptr->buffer_size < 4) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_crc_finish(png_ptr); + +#ifdef PNG_MAX_MALLOC_64K + if (png_ptr->skip_length) + return; +#endif + + key = png_ptr->current_text; + + for (lang = key; *lang; lang++) + /* Empty loop */ ; + + if (lang < key + png_ptr->current_text_size - 3) + lang++; + + comp_flag = *lang++; + lang++; /* Skip comp_type, always zero */ + + for (lang_key = lang; *lang_key; lang_key++) + /* Empty loop */ ; + + lang_key++; /* Skip NUL separator */ + + text=lang_key; + + if (lang_key < key + png_ptr->current_text_size - 1) + { + for (; *text; text++) + /* Empty loop */ ; + } + + if (text < key + png_ptr->current_text_size) + text++; + + text_ptr = (png_textp)png_malloc(png_ptr, + png_sizeof(png_text)); + + text_ptr->compression = comp_flag + 2; + text_ptr->key = key; + text_ptr->lang = lang; + text_ptr->lang_key = lang_key; + text_ptr->text = text; + text_ptr->text_length = 0; + text_ptr->itxt_length = png_strlen(text); + + ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_ptr->current_text = NULL; + + png_free(png_ptr, text_ptr); + if (ret) + png_warning(png_ptr, "Insufficient memory to store iTXt chunk"); + } +} +#endif + +/* This function is called when we haven't found a handler for this + * chunk. If there isn't a problem with the chunk itself (ie a bad chunk + * name or a critical chunk), the chunk is (currently) silently ignored. + */ +void /* PRIVATE */ +png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 + length) +{ + png_uint_32 skip = 0; + + if (!(png_ptr->chunk_name[0] & 0x20)) + { +#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED + if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != + PNG_HANDLE_CHUNK_ALWAYS +#ifdef PNG_READ_USER_CHUNKS_SUPPORTED + && png_ptr->read_user_chunk_fn == NULL +#endif + ) +#endif + png_chunk_error(png_ptr, "unknown critical chunk"); + + info_ptr = info_ptr; /* To quiet some compiler warnings */ + } + +#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED + if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) + { +#ifdef PNG_MAX_MALLOC_64K + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "unknown chunk too large to fit in memory"); + skip = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + png_memcpy((png_charp)png_ptr->unknown_chunk.name, + (png_charp)png_ptr->chunk_name, + png_sizeof(png_ptr->unknown_chunk.name)); + png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name) - 1] + = '\0'; + + png_ptr->unknown_chunk.size = (png_size_t)length; + + if (length == 0) + png_ptr->unknown_chunk.data = NULL; + + else + { + png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, + (png_size_t)length); + png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); + } + +#ifdef PNG_READ_USER_CHUNKS_SUPPORTED + if (png_ptr->read_user_chunk_fn != NULL) + { + /* Callback to user unknown chunk handler */ + int ret; + ret = (*(png_ptr->read_user_chunk_fn)) + (png_ptr, &png_ptr->unknown_chunk); + + if (ret < 0) + png_chunk_error(png_ptr, "error in user chunk"); + + if (ret == 0) + { + if (!(png_ptr->chunk_name[0] & 0x20)) + if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != + PNG_HANDLE_CHUNK_ALWAYS) + png_chunk_error(png_ptr, "unknown critical chunk"); + png_set_unknown_chunks(png_ptr, info_ptr, + &png_ptr->unknown_chunk, 1); + } + } + + else +#endif + png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); + png_free(png_ptr, png_ptr->unknown_chunk.data); + png_ptr->unknown_chunk.data = NULL; + } + + else +#endif + skip=length; + png_push_crc_skip(png_ptr, skip); +} + +void /* PRIVATE */ +png_push_have_info(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr->info_fn != NULL) + (*(png_ptr->info_fn))(png_ptr, info_ptr); +} + +void /* PRIVATE */ +png_push_have_end(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr->end_fn != NULL) + (*(png_ptr->end_fn))(png_ptr, info_ptr); +} + +void /* PRIVATE */ +png_push_have_row(png_structp png_ptr, png_bytep row) +{ + if (png_ptr->row_fn != NULL) + (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number, + (int)png_ptr->pass); +} + +void PNGAPI +png_progressive_combine_row (png_structp png_ptr, + png_bytep old_row, png_bytep new_row) +{ + PNG_CONST int FARDATA png_pass_dsp_mask[7] = + {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; + + if (png_ptr == NULL) + return; + + if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */ + png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]); +} + +void PNGAPI +png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, + png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, + png_progressive_end_ptr end_fn) +{ + if (png_ptr == NULL) + return; + + png_ptr->info_fn = info_fn; + png_ptr->row_fn = row_fn; + png_ptr->end_fn = end_fn; + + png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); +} + +png_voidp PNGAPI +png_get_progressive_ptr(png_structp png_ptr) +{ + if (png_ptr == NULL) + return (NULL); + + return png_ptr->io_ptr; +} +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ diff --git a/png/pngpriv.h b/png/pngpriv.h new file mode 100644 index 0000000..19b797c --- /dev/null +++ b/png/pngpriv.h @@ -0,0 +1,956 @@ + +/* pngpriv.h - private declarations for use inside libpng + * + * libpng version 1.4.3 - June 26, 2010 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + */ + +/* The symbols declared in this file (including the functions declared + * as PNG_EXTERN) are PRIVATE. They are not part of the libpng public + * interface, and are not recommended for use by regular applications. + * Some of them may become public in the future; others may stay private, + * change in an incompatible way, or even disappear. + * Although the libpng users are not forbidden to include this header, + * they should be well aware of the issues that may arise from doing so. + */ + +#ifndef PNGPRIV_H +#define PNGPRIV_H + +#ifndef PNG_VERSION_INFO_ONLY + +#include + +/* The functions exported by PNG_EXTERN are internal functions, which + * aren't usually used outside the library (as far as I know), so it is + * debatable if they should be exported at all. In the future, when it + * is possible to have run-time registry of chunk-handling functions, + * some of these will be made available again. +#define PNG_EXTERN extern + */ +#define PNG_EXTERN + +/* Other defines specific to compilers can go here. Try to keep + * them inside an appropriate ifdef/endif pair for portability. + */ + +#ifdef PNG_FLOATING_POINT_SUPPORTED +# ifdef MACOS + /* We need to check that hasn't already been included earlier + * as it seems it doesn't agree with , yet we should really use + * if possible. + */ +# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) +# include +# endif +# else +# include +# endif +# if defined(_AMIGA) && defined(__SASC) && defined(_M68881) + /* Amiga SAS/C: We must include builtin FPU functions when compiling using + * MATH=68881 + */ +# include +# endif +#endif + +/* Codewarrior on NT has linking problems without this. */ +#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__) +# define PNG_ALWAYS_EXTERN +#endif + +/* This provides the non-ANSI (far) memory allocation routines. */ +#if defined(__TURBOC__) && defined(__MSDOS__) +# include +# include +#endif + +#if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ + defined(_WIN32) || defined(__WIN32__) +# include /* defines _WINDOWS_ macro */ +/* I have no idea why is this necessary... */ +# ifdef _MSC_VER +# include +# endif +#endif + +/* Various modes of operation. Note that after an init, mode is set to + * zero automatically when the structure is created. + */ +#define PNG_HAVE_IHDR 0x01 +#define PNG_HAVE_PLTE 0x02 +#define PNG_HAVE_IDAT 0x04 +#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */ +#define PNG_HAVE_IEND 0x10 +#define PNG_HAVE_gAMA 0x20 +#define PNG_HAVE_cHRM 0x40 +#define PNG_HAVE_sRGB 0x80 +#define PNG_HAVE_CHUNK_HEADER 0x100 +#define PNG_WROTE_tIME 0x200 +#define PNG_WROTE_INFO_BEFORE_PLTE 0x400 +#define PNG_BACKGROUND_IS_GRAY 0x800 +#define PNG_HAVE_PNG_SIGNATURE 0x1000 +#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ + +/* Flags for the transformations the PNG library does on the image data */ +#define PNG_BGR 0x0001 +#define PNG_INTERLACE 0x0002 +#define PNG_PACK 0x0004 +#define PNG_SHIFT 0x0008 +#define PNG_SWAP_BYTES 0x0010 +#define PNG_INVERT_MONO 0x0020 +#define PNG_QUANTIZE 0x0040 /* formerly PNG_DITHER */ +#define PNG_BACKGROUND 0x0080 +#define PNG_BACKGROUND_EXPAND 0x0100 + /* 0x0200 unused */ +#define PNG_16_TO_8 0x0400 +#define PNG_RGBA 0x0800 +#define PNG_EXPAND 0x1000 +#define PNG_GAMMA 0x2000 +#define PNG_GRAY_TO_RGB 0x4000 +#define PNG_FILLER 0x8000L +#define PNG_PACKSWAP 0x10000L +#define PNG_SWAP_ALPHA 0x20000L +#define PNG_STRIP_ALPHA 0x40000L +#define PNG_INVERT_ALPHA 0x80000L +#define PNG_USER_TRANSFORM 0x100000L +#define PNG_RGB_TO_GRAY_ERR 0x200000L +#define PNG_RGB_TO_GRAY_WARN 0x400000L +#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */ + /* 0x800000L Unused */ +#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */ +#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */ + /* 0x4000000L unused */ + /* 0x8000000L unused */ + /* 0x10000000L unused */ + /* 0x20000000L unused */ + /* 0x40000000L unused */ + +/* Flags for png_create_struct */ +#define PNG_STRUCT_PNG 0x0001 +#define PNG_STRUCT_INFO 0x0002 + +/* Scaling factor for filter heuristic weighting calculations */ +#define PNG_WEIGHT_SHIFT 8 +#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) +#define PNG_COST_SHIFT 3 +#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) + +/* Flags for the png_ptr->flags rather than declaring a byte for each one */ +#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 +#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 +#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 +#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 +#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 +#define PNG_FLAG_ZLIB_FINISHED 0x0020 +#define PNG_FLAG_ROW_INIT 0x0040 +#define PNG_FLAG_FILLER_AFTER 0x0080 +#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 +#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 +#define PNG_FLAG_CRC_CRITICAL_USE 0x0400 +#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 + /* 0x1000 unused */ + /* 0x2000 unused */ + /* 0x4000 unused */ +#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L +#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L +#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L +#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L +#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L +#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L +#define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */ +#define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */ +#define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000L /* Added to libpng-1.4.0 */ + /* 0x1000000L unused */ + /* 0x2000000L unused */ + /* 0x4000000L unused */ + /* 0x8000000L unused */ + /* 0x10000000L unused */ + /* 0x20000000L unused */ + /* 0x40000000L unused */ + +#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ + PNG_FLAG_CRC_ANCILLARY_NOWARN) + +#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ + PNG_FLAG_CRC_CRITICAL_IGNORE) + +#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ + PNG_FLAG_CRC_CRITICAL_MASK) + +/* Save typing and make code easier to understand */ + +#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ + abs((int)((c1).green) - (int)((c2).green)) + \ + abs((int)((c1).blue) - (int)((c2).blue))) + +/* Added to libpng-1.2.6 JB */ +#define PNG_ROWBYTES(pixel_bits, width) \ + ((pixel_bits) >= 8 ? \ + ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \ + (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) ) + +/* PNG_OUT_OF_RANGE returns true if value is outside the range + * ideal-delta..ideal+delta. Each argument is evaluated twice. + * "ideal" and "delta" should be constants, normally simple + * integers, "value" a variable. Added to libpng-1.2.6 JB + */ +#define PNG_OUT_OF_RANGE(value, ideal, delta) \ + ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) + +/* Constant strings for known chunk types. If you need to add a chunk, + * define the name here, and add an invocation of the macro wherever it's + * needed. + */ +#define PNG_IHDR PNG_CONST png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'} +#define PNG_IDAT PNG_CONST png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'} +#define PNG_IEND PNG_CONST png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'} +#define PNG_PLTE PNG_CONST png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'} +#define PNG_bKGD PNG_CONST png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'} +#define PNG_cHRM PNG_CONST png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'} +#define PNG_gAMA PNG_CONST png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'} +#define PNG_hIST PNG_CONST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'} +#define PNG_iCCP PNG_CONST png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'} +#define PNG_iTXt PNG_CONST png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'} +#define PNG_oFFs PNG_CONST png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'} +#define PNG_pCAL PNG_CONST png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'} +#define PNG_sCAL PNG_CONST png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'} +#define PNG_pHYs PNG_CONST png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'} +#define PNG_sBIT PNG_CONST png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'} +#define PNG_sPLT PNG_CONST png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'} +#define PNG_sRGB PNG_CONST png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'} +#define PNG_sTER PNG_CONST png_byte png_sTER[5] = {115, 84, 69, 82, '\0'} +#define PNG_tEXt PNG_CONST png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'} +#define PNG_tIME PNG_CONST png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} +#define PNG_tRNS PNG_CONST png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} +#define PNG_zTXt PNG_CONST png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} + + +/* Inhibit C++ name-mangling for libpng functions but not for system calls. */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* These functions are used internally in the code. They generally + * shouldn't be used unless you are writing code to add or replace some + * functionality in libpng. More information about most functions can + * be found in the files where the functions are located. + */ + +/* Allocate memory for an internal libpng struct */ +PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); + +/* Free memory from internal libpng struct */ +PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); + +PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr + malloc_fn, png_voidp mem_ptr)); +PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, + png_free_ptr free_fn, png_voidp mem_ptr)); + +/* Free any memory that info_ptr points to and reset struct. */ +PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +/* Function to allocate memory for zlib. PNGAPI is disallowed. */ +PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); + +/* Function to free memory for zlib. PNGAPI is disallowed. */ +PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); + +/* Next four functions are used internally as callbacks. PNGAPI is required + * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */ + +PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t length)); +#endif + +PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +#ifdef PNG_STDIO_SUPPORTED +PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr)); +#endif +#endif + +/* Reset the CRC variable */ +PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); + +/* Write the "data" buffer to whatever output you are using */ +PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +/* Read the chunk header (length + type name) */ +PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr)); + +/* Read data from whatever input you are using into the "data" buffer */ +PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +/* Read bytes into buf, and update png_ptr->crc */ +PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, + png_size_t length)); + +/* Decompress data in a chunk that uses compression */ +#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ + defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) +PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr, + int comp_type, png_size_t chunklength, png_size_t prefix_length, + png_size_t *data_length)); +#endif + +/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ +PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); + +/* Read the CRC from the file and compare it to the libpng calculated CRC */ +PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); + +/* Calculate the CRC over a section of data. Note that we are only + * passing a maximum of 64K on systems that have this as a memory limit, + * since this is the maximum buffer size we can specify. + */ +PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr, + png_size_t length)); + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); +#endif + +/* Write various chunks */ + +/* Write the IHDR chunk, and update the png_struct with the necessary + * information. + */ +PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, + png_uint_32 height, + int bit_depth, int color_type, int compression_method, int filter_method, + int interlace_method)); + +PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette, + png_uint_32 num_pal)); + +PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); + +#ifdef PNG_WRITE_gAMA_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, + png_fixed_point file_gamma)); +#endif +#endif + +#ifdef PNG_WRITE_sBIT_SUPPORTED +PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit, + int color_type)); +#endif + +#ifdef PNG_WRITE_cHRM_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, + double white_x, double white_y, + double red_x, double red_y, double green_x, double green_y, + double blue_x, double blue_y)); +#endif +PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, + png_fixed_point int_white_x, png_fixed_point int_white_y, + png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point + int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, + png_fixed_point int_blue_y)); +#endif + +#ifdef PNG_WRITE_sRGB_SUPPORTED +PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, + int intent)); +#endif + +#ifdef PNG_WRITE_iCCP_SUPPORTED +PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, + png_charp name, int compression_type, + png_charp profile, int proflen)); + /* Note to maintainer: profile should be png_bytep */ +#endif + +#ifdef PNG_WRITE_sPLT_SUPPORTED +PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, + png_sPLT_tp palette)); +#endif + +#ifdef PNG_WRITE_tRNS_SUPPORTED +PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans, + png_color_16p values, int number, int color_type)); +#endif + +#ifdef PNG_WRITE_bKGD_SUPPORTED +PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, + png_color_16p values, int color_type)); +#endif + +#ifdef PNG_WRITE_hIST_SUPPORTED +PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist, + int num_hist)); +#endif + +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ + defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) +PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, + png_charp key, png_charpp new_key)); +#endif + +#ifdef PNG_WRITE_tEXt_SUPPORTED +PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key, + png_charp text, png_size_t text_len)); +#endif + +#ifdef PNG_WRITE_zTXt_SUPPORTED +PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key, + png_charp text, png_size_t text_len, int compression)); +#endif + +#ifdef PNG_WRITE_iTXt_SUPPORTED +PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, + int compression, png_charp key, png_charp lang, png_charp lang_key, + png_charp text)); +#endif + +#ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */ +PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp text_ptr, int num_text)); +#endif + +#ifdef PNG_WRITE_oFFs_SUPPORTED +PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, + png_int_32 x_offset, png_int_32 y_offset, int unit_type)); +#endif + +#ifdef PNG_WRITE_pCAL_SUPPORTED +PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, + png_int_32 X0, png_int_32 X1, int type, int nparams, + png_charp units, png_charpp params)); +#endif + +#ifdef PNG_WRITE_pHYs_SUPPORTED +PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, + png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, + int unit_type)); +#endif + +#ifdef PNG_WRITE_tIME_SUPPORTED +PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, + png_timep mod_time)); +#endif + +#ifdef PNG_WRITE_sCAL_SUPPORTED +#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) +PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr, + int unit, double width, double height)); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, + int unit, png_charp width, png_charp height)); +#endif +#endif +#endif + +/* Called when finished processing a row of data */ +PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); + +/* Internal use only. Called before first row of data */ +PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); + +#ifdef PNG_READ_GAMMA_SUPPORTED +PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr, + png_byte bit_depth)); +#endif + +/* Combine a row of data, dealing with alpha, etc. if requested */ +PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, + int mask)); + +#ifdef PNG_READ_INTERLACING_SUPPORTED +/* Expand an interlaced row */ +/* OLD pre-1.0.9 interface: +PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, + png_bytep row, int pass, png_uint_32 transformations)); + */ +PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)); +#endif + +/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED +/* Grab pixels out of a row for an interlaced pass */ +PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, + png_bytep row, int pass)); +#endif + +/* Unfilter a row */ +PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr, + png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); + +/* Choose the best filter to use and filter the row data */ +PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, + png_row_infop row_info)); + +/* Write out the filtered row. */ +PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr, + png_bytep filtered_row)); +/* Finish a row while reading, dealing with interlacing passes, etc. */ +PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); + +/* Initialize the row buffers, etc. */ +PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); +/* Optional call to update the users info structure */ +PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +/* These are the functions that do the transformations */ +#ifdef PNG_READ_FILLER_SUPPORTED +PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 filler, png_uint_32 flags)); +#endif + +#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED +PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED +PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED +PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED +PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ + defined(PNG_READ_STRIP_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 flags)); +#endif + +#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) +PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ + defined(PNG_WRITE_PACKSWAP_SUPPORTED) +PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED +PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop + row_info, png_bytep row)); +#endif + +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED +PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#ifdef PNG_READ_PACK_SUPPORTED +PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#ifdef PNG_READ_SHIFT_SUPPORTED +PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row, + png_color_8p sig_bits)); +#endif + +#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) +PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#ifdef PNG_READ_16_TO_8_SUPPORTED +PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#ifdef PNG_READ_QUANTIZE_SUPPORTED +PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info, + png_bytep row, png_bytep palette_lookup, png_bytep quantize_lookup)); + +# ifdef PNG_CORRECT_PALETTE_SUPPORTED +PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, + png_colorp palette, int num_palette)); +# endif +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) +PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#ifdef PNG_WRITE_PACK_SUPPORTED +PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 bit_depth)); +#endif + +#ifdef PNG_WRITE_SHIFT_SUPPORTED +PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row, + png_color_8p bit_depth)); +#endif + +#ifdef PNG_READ_BACKGROUND_SUPPORTED +#ifdef PNG_READ_GAMMA_SUPPORTED +PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, + png_color_16p trans_color, png_color_16p background, + png_color_16p background_1, + png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, + png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, + png_uint_16pp gamma_16_to_1, int gamma_shift)); +#else +PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, + png_color_16p trans_color, png_color_16p background)); +#endif +#endif + +#ifdef PNG_READ_GAMMA_SUPPORTED +PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row, + png_bytep gamma_table, png_uint_16pp gamma_16_table, + int gamma_shift)); +#endif + +#ifdef PNG_READ_EXPAND_SUPPORTED +PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, + png_bytep row, png_colorp palette, png_bytep trans, int num_trans)); +PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, + png_bytep row, png_color_16p trans_value)); +#endif + +/* The following decodes the appropriate chunks, and does error correction, + * then calls the appropriate callback for the chunk if it is valid. + */ + +/* Decode the IHDR chunk */ +PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); + +#ifdef PNG_READ_bKGD_SUPPORTED +PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_cHRM_SUPPORTED +PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_gAMA_SUPPORTED +PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_hIST_SUPPORTED +PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_iCCP_SUPPORTED +extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif /* PNG_READ_iCCP_SUPPORTED */ + +#ifdef PNG_READ_iTXt_SUPPORTED +PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_oFFs_SUPPORTED +PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_pCAL_SUPPORTED +PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_pHYs_SUPPORTED +PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_sBIT_SUPPORTED +PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_sCAL_SUPPORTED +PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_sPLT_SUPPORTED +extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif /* PNG_READ_sPLT_SUPPORTED */ + +#ifdef PNG_READ_sRGB_SUPPORTED +PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_tEXt_SUPPORTED +PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_tIME_SUPPORTED +PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_tRNS_SUPPORTED +PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#ifdef PNG_READ_zTXt_SUPPORTED +PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); + +PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, + png_bytep chunk_name)); + +/* Handle the transformations for reading and writing */ +PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); + +PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, + png_uint_32 length)); +PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t buffer_length)); +PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t buffer_length)); +PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); +PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); +#ifdef PNG_READ_tEXt_SUPPORTED +PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif +#ifdef PNG_READ_zTXt_SUPPORTED +PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif +#ifdef PNG_READ_iTXt_SUPPORTED +PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +#ifdef PNG_MNG_FEATURES_SUPPORTED +PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, + png_bytep row)); +PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +/* Added at libpng version 1.4.0 */ +#ifdef PNG_cHRM_SUPPORTED +PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr, + png_fixed_point int_white_x, png_fixed_point int_white_y, + png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point + int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, + png_fixed_point int_blue_y)); +#endif + +#ifdef PNG_cHRM_SUPPORTED +#ifdef PNG_CHECK_cHRM_SUPPORTED +/* Added at libpng version 1.2.34 and 1.4.0 */ +PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2, + unsigned long *hi_product, unsigned long *lo_product)); +#endif +#endif + +/* Added at libpng version 1.4.0 */ +PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr, + png_uint_32 width, png_uint_32 height, int bit_depth, + int color_type, int interlace_type, int compression_type, + int filter_type)); + +/* Free all memory used by the read (old method - NOT DLL EXPORTED) */ +extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, + png_infop end_info_ptr)); + +/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ +extern void png_write_destroy PNGARG((png_structp png_ptr)); + +#ifdef USE_FAR_KEYWORD /* memory model conversion function */ +extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr, + int check)); +#endif /* USE_FAR_KEYWORD */ + +/* Define PNG_DEBUG at compile time for debugging information. Higher + * numbers for PNG_DEBUG mean more debugging information. This has + * only been added since version 0.95 so it is not implemented throughout + * libpng yet, but more support will be added as needed. + */ +#ifdef PNG_DEBUG +#if (PNG_DEBUG > 0) +#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) +#include +#if (PNG_DEBUG > 1) +#ifndef _DEBUG +# define _DEBUG +#endif +#ifndef png_debug +#define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE) +#endif +#ifndef png_debug1 +#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1) +#endif +#ifndef png_debug2 +#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2) +#endif +#endif +#else /* PNG_DEBUG_FILE || !_MSC_VER */ +#ifndef PNG_DEBUG_FILE +#define PNG_DEBUG_FILE stderr +#endif /* PNG_DEBUG_FILE */ + +#if (PNG_DEBUG > 1) +/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on + * non-ISO compilers + */ +# ifdef __STDC__ +# ifndef png_debug +# define png_debug(l,m) \ + { \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ + } +# endif +# ifndef png_debug1 +# define png_debug1(l,m,p1) \ + { \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ + } +# endif +# ifndef png_debug2 +# define png_debug2(l,m,p1,p2) \ + { \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ + } +# endif +# else /* __STDC __ */ +# ifndef png_debug +# define png_debug(l,m) \ + { \ + int num_tabs=l; \ + char format[256]; \ + snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ + m,PNG_STRING_NEWLINE); \ + fprintf(PNG_DEBUG_FILE,format); \ + } +# endif +# ifndef png_debug1 +# define png_debug1(l,m,p1) \ + { \ + int num_tabs=l; \ + char format[256]; \ + snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ + m,PNG_STRING_NEWLINE); \ + fprintf(PNG_DEBUG_FILE,format,p1); \ + } +# endif +# ifndef png_debug2 +# define png_debug2(l,m,p1,p2) \ + { \ + int num_tabs=l; \ + char format[256]; \ + snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ + m,PNG_STRING_NEWLINE); \ + fprintf(PNG_DEBUG_FILE,format,p1,p2); \ + } +# endif +# endif /* __STDC __ */ +#endif /* (PNG_DEBUG > 1) */ + +#endif /* _MSC_VER */ +#endif /* (PNG_DEBUG > 0) */ +#endif /* PNG_DEBUG */ +#ifndef png_debug +#define png_debug(l, m) +#endif +#ifndef png_debug1 +#define png_debug1(l, m, p1) +#endif +#ifndef png_debug2 +#define png_debug2(l, m, p1, p2) +#endif + +/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ + +#ifdef __cplusplus +} +#endif + +#endif /* PNG_VERSION_INFO_ONLY */ +#endif /* PNGPRIV_H */ diff --git a/png/pngread.c b/png/pngread.c new file mode 100644 index 0000000..92060d2 --- /dev/null +++ b/png/pngread.c @@ -0,0 +1,1361 @@ + +/* pngread.c - read a PNG file + * + * Last changed in libpng 1.4.1 [February 25, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + * This file contains routines that an application calls directly to + * read a PNG file or stream. + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#ifdef PNG_READ_SUPPORTED +#include "pngpriv.h" + + +/* Create a PNG structure for reading, and allocate any memory needed. */ +png_structp PNGAPI +png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn) +{ + +#ifdef PNG_USER_MEM_SUPPORTED + return (png_create_read_struct_2(user_png_ver, error_ptr, error_fn, + warn_fn, NULL, NULL, NULL)); +} + +/* Alternate create PNG structure for reading, and allocate any memory + * needed. + */ +png_structp PNGAPI +png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn) +{ +#endif /* PNG_USER_MEM_SUPPORTED */ + +#ifdef PNG_SETJMP_SUPPORTED + volatile +#endif + png_structp png_ptr; + volatile int png_cleanup_needed = 0; + +#ifdef PNG_SETJMP_SUPPORTED +#ifdef USE_FAR_KEYWORD + jmp_buf jmpbuf; +#endif +#endif + + int i; + + png_debug(1, "in png_create_read_struct"); + +#ifdef PNG_USER_MEM_SUPPORTED + png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, + malloc_fn, mem_ptr); +#else + png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); +#endif + if (png_ptr == NULL) + return (NULL); + + /* Added at libpng-1.2.6 */ +#ifdef PNG_USER_LIMITS_SUPPORTED + png_ptr->user_width_max = PNG_USER_WIDTH_MAX; + png_ptr->user_height_max = PNG_USER_HEIGHT_MAX; +# ifdef PNG_USER_CHUNK_CACHE_MAX + /* Added at libpng-1.2.43 and 1.4.0 */ + png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX; +# endif +# ifdef PNG_SET_USER_CHUNK_MALLOC_MAX + /* Added at libpng-1.2.43 and 1.4.1 */ + png_ptr->user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX; +# endif +#endif + +#ifdef PNG_SETJMP_SUPPORTED +/* Applications that neglect to set up their own setjmp() and then + encounter a png_error() will longjmp here. Since the jmpbuf is + then meaningless we abort instead of returning. */ +#ifdef USE_FAR_KEYWORD + if (setjmp(jmpbuf)) +#else + if (setjmp(png_jmpbuf(png_ptr))) /* Sets longjmp to match setjmp */ +#endif + PNG_ABORT(); +#ifdef USE_FAR_KEYWORD + png_memcpy(png_jmpbuf(png_ptr), jmpbuf, png_sizeof(jmp_buf)); +#endif +#endif /* PNG_SETJMP_SUPPORTED */ + +#ifdef PNG_USER_MEM_SUPPORTED + png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn); +#endif + + png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); + + if (user_png_ver) + { + i = 0; + do + { + if (user_png_ver[i] != png_libpng_ver[i]) + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; + } while (png_libpng_ver[i++]); + } + else + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; + + + if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) + { + /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so + * we must recompile any applications that use any older library version. + * For versions after libpng 1.0, we will be compatible, so we need + * only check the first digit. + */ + if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] || + (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || + (user_png_ver[0] == '0' && user_png_ver[2] < '9')) + { +#ifdef PNG_STDIO_SUPPORTED + char msg[80]; + if (user_png_ver) + { + png_snprintf(msg, 80, + "Application was compiled with png.h from libpng-%.20s", + user_png_ver); + png_warning(png_ptr, msg); + } + png_snprintf(msg, 80, + "Application is running with png.c from libpng-%.20s", + png_libpng_ver); + png_warning(png_ptr, msg); +#endif +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + png_ptr->flags = 0; +#endif + png_warning(png_ptr, + "Incompatible libpng version in application and library"); + + png_cleanup_needed = 1; + } + } + + if (!png_cleanup_needed) + { + /* Initialize zbuf - compression buffer */ + png_ptr->zbuf_size = PNG_ZBUF_SIZE; + png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr, + png_ptr->zbuf_size); + if (png_ptr->zbuf == NULL) + png_cleanup_needed = 1; + } + png_ptr->zstream.zalloc = png_zalloc; + png_ptr->zstream.zfree = png_zfree; + png_ptr->zstream.opaque = (voidpf)png_ptr; + + if (!png_cleanup_needed) + { + switch (inflateInit(&png_ptr->zstream)) + { + case Z_OK: /* Do nothing */ break; + case Z_MEM_ERROR: + case Z_STREAM_ERROR: png_warning(png_ptr, "zlib memory error"); + png_cleanup_needed = 1; break; + case Z_VERSION_ERROR: png_warning(png_ptr, "zlib version error"); + png_cleanup_needed = 1; break; + default: png_warning(png_ptr, "Unknown zlib error"); + png_cleanup_needed = 1; + } + } + + if (png_cleanup_needed) + { + /* Clean up PNG structure and deallocate any memory. */ + png_free(png_ptr, png_ptr->zbuf); + png_ptr->zbuf = NULL; +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)png_ptr, + (png_free_ptr)free_fn, (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)png_ptr); +#endif + return (NULL); + } + + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + + png_set_read_fn(png_ptr, NULL, NULL); + + + return (png_ptr); +} + + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +/* Read the information before the actual image data. This has been + * changed in v0.90 to allow reading a file that already has the magic + * bytes read from the stream. You can tell libpng how many bytes have + * been read from the beginning of the stream (up to the maximum of 8) + * via png_set_sig_bytes(), and we will only check the remaining bytes + * here. The application can then have access to the signature bytes we + * read if it is determined that this isn't a valid PNG file. + */ +void PNGAPI +png_read_info(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_read_info"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + /* If we haven't checked all of the PNG signature bytes, do so now. */ + if (png_ptr->sig_bytes < 8) + { + png_size_t num_checked = png_ptr->sig_bytes, + num_to_check = 8 - num_checked; + +#ifdef PNG_IO_STATE_SUPPORTED + png_ptr->io_state = PNG_IO_READING | PNG_IO_SIGNATURE; +#endif + + png_read_data(png_ptr, &(info_ptr->signature[num_checked]), num_to_check); + png_ptr->sig_bytes = 8; + + if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check)) + { + if (num_checked < 4 && + png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) + png_error(png_ptr, "Not a PNG file"); + else + png_error(png_ptr, "PNG file corrupted by ASCII conversion"); + } + if (num_checked < 3) + png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE; + } + + for (;;) + { + PNG_IHDR; + PNG_IDAT; + PNG_IEND; + PNG_PLTE; +#ifdef PNG_READ_bKGD_SUPPORTED + PNG_bKGD; +#endif +#ifdef PNG_READ_cHRM_SUPPORTED + PNG_cHRM; +#endif +#ifdef PNG_READ_gAMA_SUPPORTED + PNG_gAMA; +#endif +#ifdef PNG_READ_hIST_SUPPORTED + PNG_hIST; +#endif +#ifdef PNG_READ_iCCP_SUPPORTED + PNG_iCCP; +#endif +#ifdef PNG_READ_iTXt_SUPPORTED + PNG_iTXt; +#endif +#ifdef PNG_READ_oFFs_SUPPORTED + PNG_oFFs; +#endif +#ifdef PNG_READ_pCAL_SUPPORTED + PNG_pCAL; +#endif +#ifdef PNG_READ_pHYs_SUPPORTED + PNG_pHYs; +#endif +#ifdef PNG_READ_sBIT_SUPPORTED + PNG_sBIT; +#endif +#ifdef PNG_READ_sCAL_SUPPORTED + PNG_sCAL; +#endif +#ifdef PNG_READ_sPLT_SUPPORTED + PNG_sPLT; +#endif +#ifdef PNG_READ_sRGB_SUPPORTED + PNG_sRGB; +#endif +#ifdef PNG_READ_tEXt_SUPPORTED + PNG_tEXt; +#endif +#ifdef PNG_READ_tIME_SUPPORTED + PNG_tIME; +#endif +#ifdef PNG_READ_tRNS_SUPPORTED + PNG_tRNS; +#endif +#ifdef PNG_READ_zTXt_SUPPORTED + PNG_zTXt; +#endif + png_uint_32 length = png_read_chunk_header(png_ptr); + PNG_CONST png_bytep chunk_name = png_ptr->chunk_name; + + /* This should be a binary subdivision search or a hash for + * matching the chunk name rather than a linear search. + */ + if (!png_memcmp(chunk_name, png_IDAT, 4)) + if (png_ptr->mode & PNG_AFTER_IDAT) + png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; + + if (!png_memcmp(chunk_name, png_IHDR, 4)) + png_handle_IHDR(png_ptr, info_ptr, length); + else if (!png_memcmp(chunk_name, png_IEND, 4)) + png_handle_IEND(png_ptr, info_ptr, length); +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + else if (png_handle_as_unknown(png_ptr, chunk_name)) + { + if (!png_memcmp(chunk_name, png_IDAT, 4)) + png_ptr->mode |= PNG_HAVE_IDAT; + png_handle_unknown(png_ptr, info_ptr, length); + if (!png_memcmp(chunk_name, png_PLTE, 4)) + png_ptr->mode |= PNG_HAVE_PLTE; + else if (!png_memcmp(chunk_name, png_IDAT, 4)) + { + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before IDAT"); + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + !(png_ptr->mode & PNG_HAVE_PLTE)) + png_error(png_ptr, "Missing PLTE before IDAT"); + break; + } + } +#endif + else if (!png_memcmp(chunk_name, png_PLTE, 4)) + png_handle_PLTE(png_ptr, info_ptr, length); + else if (!png_memcmp(chunk_name, png_IDAT, 4)) + { + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before IDAT"); + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + !(png_ptr->mode & PNG_HAVE_PLTE)) + png_error(png_ptr, "Missing PLTE before IDAT"); + + png_ptr->idat_size = length; + png_ptr->mode |= PNG_HAVE_IDAT; + break; + } +#ifdef PNG_READ_bKGD_SUPPORTED + else if (!png_memcmp(chunk_name, png_bKGD, 4)) + png_handle_bKGD(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_cHRM_SUPPORTED + else if (!png_memcmp(chunk_name, png_cHRM, 4)) + png_handle_cHRM(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_gAMA_SUPPORTED + else if (!png_memcmp(chunk_name, png_gAMA, 4)) + png_handle_gAMA(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_hIST_SUPPORTED + else if (!png_memcmp(chunk_name, png_hIST, 4)) + png_handle_hIST(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_oFFs_SUPPORTED + else if (!png_memcmp(chunk_name, png_oFFs, 4)) + png_handle_oFFs(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_pCAL_SUPPORTED + else if (!png_memcmp(chunk_name, png_pCAL, 4)) + png_handle_pCAL(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_sCAL_SUPPORTED + else if (!png_memcmp(chunk_name, png_sCAL, 4)) + png_handle_sCAL(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_pHYs_SUPPORTED + else if (!png_memcmp(chunk_name, png_pHYs, 4)) + png_handle_pHYs(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_sBIT_SUPPORTED + else if (!png_memcmp(chunk_name, png_sBIT, 4)) + png_handle_sBIT(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_sRGB_SUPPORTED + else if (!png_memcmp(chunk_name, png_sRGB, 4)) + png_handle_sRGB(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_iCCP_SUPPORTED + else if (!png_memcmp(chunk_name, png_iCCP, 4)) + png_handle_iCCP(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_sPLT_SUPPORTED + else if (!png_memcmp(chunk_name, png_sPLT, 4)) + png_handle_sPLT(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_tEXt_SUPPORTED + else if (!png_memcmp(chunk_name, png_tEXt, 4)) + png_handle_tEXt(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_tIME_SUPPORTED + else if (!png_memcmp(chunk_name, png_tIME, 4)) + png_handle_tIME(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_tRNS_SUPPORTED + else if (!png_memcmp(chunk_name, png_tRNS, 4)) + png_handle_tRNS(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_zTXt_SUPPORTED + else if (!png_memcmp(chunk_name, png_zTXt, 4)) + png_handle_zTXt(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_iTXt_SUPPORTED + else if (!png_memcmp(chunk_name, png_iTXt, 4)) + png_handle_iTXt(png_ptr, info_ptr, length); +#endif + else + png_handle_unknown(png_ptr, info_ptr, length); + } +} +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ + +/* Optional call to update the users info_ptr structure */ +void PNGAPI +png_read_update_info(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_read_update_info"); + + if (png_ptr == NULL) + return; + if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) + png_read_start_row(png_ptr); + else + png_warning(png_ptr, + "Ignoring extra png_read_update_info() call; row buffer not reallocated"); + + png_read_transform_info(png_ptr, info_ptr); +} + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +/* Initialize palette, background, etc, after transformations + * are set, but before any reading takes place. This allows + * the user to obtain a gamma-corrected palette, for example. + * If the user doesn't call this, we will do it ourselves. + */ +void PNGAPI +png_start_read_image(png_structp png_ptr) +{ + png_debug(1, "in png_start_read_image"); + + if (png_ptr == NULL) + return; + if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) + png_read_start_row(png_ptr); +} +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +void PNGAPI +png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) +{ + PNG_IDAT; + PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, + 0xff}; + PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; + int ret; + + if (png_ptr == NULL) + return; + + png_debug2(1, "in png_read_row (row %lu, pass %d)", + (unsigned long) png_ptr->row_number, png_ptr->pass); + + if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) + png_read_start_row(png_ptr); + if (png_ptr->row_number == 0 && png_ptr->pass == 0) + { + /* Check for transforms that have been set but were defined out */ +#if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED) + if (png_ptr->transformations & PNG_INVERT_MONO) + png_warning(png_ptr, "PNG_READ_INVERT_SUPPORTED is not defined"); +#endif +#if defined(PNG_WRITE_FILLER_SUPPORTED) && !defined(PNG_READ_FILLER_SUPPORTED) + if (png_ptr->transformations & PNG_FILLER) + png_warning(png_ptr, "PNG_READ_FILLER_SUPPORTED is not defined"); +#endif +#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \ + !defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + png_warning(png_ptr, "PNG_READ_PACKSWAP_SUPPORTED is not defined"); +#endif +#if defined(PNG_WRITE_PACK_SUPPORTED) && !defined(PNG_READ_PACK_SUPPORTED) + if (png_ptr->transformations & PNG_PACK) + png_warning(png_ptr, "PNG_READ_PACK_SUPPORTED is not defined"); +#endif +#if defined(PNG_WRITE_SHIFT_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) + if (png_ptr->transformations & PNG_SHIFT) + png_warning(png_ptr, "PNG_READ_SHIFT_SUPPORTED is not defined"); +#endif +#if defined(PNG_WRITE_BGR_SUPPORTED) && !defined(PNG_READ_BGR_SUPPORTED) + if (png_ptr->transformations & PNG_BGR) + png_warning(png_ptr, "PNG_READ_BGR_SUPPORTED is not defined"); +#endif +#if defined(PNG_WRITE_SWAP_SUPPORTED) && !defined(PNG_READ_SWAP_SUPPORTED) + if (png_ptr->transformations & PNG_SWAP_BYTES) + png_warning(png_ptr, "PNG_READ_SWAP_SUPPORTED is not defined"); +#endif + } + +#ifdef PNG_READ_INTERLACING_SUPPORTED + /* If interlaced and we do not need a new row, combine row and return */ + if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) + { + switch (png_ptr->pass) + { + case 0: + if (png_ptr->row_number & 0x07) + { + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 1: + if ((png_ptr->row_number & 0x07) || png_ptr->width < 5) + { + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 2: + if ((png_ptr->row_number & 0x07) != 4) + { + if (dsp_row != NULL && (png_ptr->row_number & 4)) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 3: + if ((png_ptr->row_number & 3) || png_ptr->width < 3) + { + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 4: + if ((png_ptr->row_number & 3) != 2) + { + if (dsp_row != NULL && (png_ptr->row_number & 2)) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 5: + if ((png_ptr->row_number & 1) || png_ptr->width < 2) + { + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 6: + if (!(png_ptr->row_number & 1)) + { + png_read_finish_row(png_ptr); + return; + } + break; + } + } +#endif + + if (!(png_ptr->mode & PNG_HAVE_IDAT)) + png_error(png_ptr, "Invalid attempt to read row data"); + + png_ptr->zstream.next_out = png_ptr->row_buf; + png_ptr->zstream.avail_out = + (uInt)(PNG_ROWBYTES(png_ptr->pixel_depth, + png_ptr->iwidth) + 1); + do + { + if (!(png_ptr->zstream.avail_in)) + { + while (!png_ptr->idat_size) + { + png_crc_finish(png_ptr, 0); + + png_ptr->idat_size = png_read_chunk_header(png_ptr); + if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + png_error(png_ptr, "Not enough image data"); + } + png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_in = png_ptr->zbuf; + if (png_ptr->zbuf_size > png_ptr->idat_size) + png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size; + png_crc_read(png_ptr, png_ptr->zbuf, + (png_size_t)png_ptr->zstream.avail_in); + png_ptr->idat_size -= png_ptr->zstream.avail_in; + } + ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); + if (ret == Z_STREAM_END) + { + if (png_ptr->zstream.avail_out || png_ptr->zstream.avail_in || + png_ptr->idat_size) + png_benign_error(png_ptr, "Extra compressed data"); + png_ptr->mode |= PNG_AFTER_IDAT; + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + break; + } + if (ret != Z_OK) + png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : + "Decompression error"); + + } while (png_ptr->zstream.avail_out); + + png_ptr->row_info.color_type = png_ptr->color_type; + png_ptr->row_info.width = png_ptr->iwidth; + png_ptr->row_info.channels = png_ptr->channels; + png_ptr->row_info.bit_depth = png_ptr->bit_depth; + png_ptr->row_info.pixel_depth = png_ptr->pixel_depth; + png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, + png_ptr->row_info.width); + + if (png_ptr->row_buf[0]) + png_read_filter_row(png_ptr, &(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->prev_row + 1, + (int)(png_ptr->row_buf[0])); + + png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1); + +#ifdef PNG_MNG_FEATURES_SUPPORTED + if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING)) + { + /* Intrapixel differencing */ + png_do_read_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1); + } +#endif + + + if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) + png_do_read_transformations(png_ptr); + +#ifdef PNG_READ_INTERLACING_SUPPORTED + /* Blow up interlaced rows to full size */ + if (png_ptr->interlaced && + (png_ptr->transformations & PNG_INTERLACE)) + { + if (png_ptr->pass < 6) + /* Old interface (pre-1.0.9): + * png_do_read_interlace(&(png_ptr->row_info), + * png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); + */ + png_do_read_interlace(png_ptr); + + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + if (row != NULL) + png_combine_row(png_ptr, row, + png_pass_mask[png_ptr->pass]); + } + else +#endif + { + if (row != NULL) + png_combine_row(png_ptr, row, 0xff); + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, 0xff); + } + png_read_finish_row(png_ptr); + + if (png_ptr->read_row_fn != NULL) + (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); +} +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +/* Read one or more rows of image data. If the image is interlaced, + * and png_set_interlace_handling() has been called, the rows need to + * contain the contents of the rows from the previous pass. If the + * image has alpha or transparency, and png_handle_alpha()[*] has been + * called, the rows contents must be initialized to the contents of the + * screen. + * + * "row" holds the actual image, and pixels are placed in it + * as they arrive. If the image is displayed after each pass, it will + * appear to "sparkle" in. "display_row" can be used to display a + * "chunky" progressive image, with finer detail added as it becomes + * available. If you do not want this "chunky" display, you may pass + * NULL for display_row. If you do not want the sparkle display, and + * you have not called png_handle_alpha(), you may pass NULL for rows. + * If you have called png_handle_alpha(), and the image has either an + * alpha channel or a transparency chunk, you must provide a buffer for + * rows. In this case, you do not have to provide a display_row buffer + * also, but you may. If the image is not interlaced, or if you have + * not called png_set_interlace_handling(), the display_row buffer will + * be ignored, so pass NULL to it. + * + * [*] png_handle_alpha() does not exist yet, as of this version of libpng + */ + +void PNGAPI +png_read_rows(png_structp png_ptr, png_bytepp row, + png_bytepp display_row, png_uint_32 num_rows) +{ + png_uint_32 i; + png_bytepp rp; + png_bytepp dp; + + png_debug(1, "in png_read_rows"); + + if (png_ptr == NULL) + return; + rp = row; + dp = display_row; + if (rp != NULL && dp != NULL) + for (i = 0; i < num_rows; i++) + { + png_bytep rptr = *rp++; + png_bytep dptr = *dp++; + + png_read_row(png_ptr, rptr, dptr); + } + else if (rp != NULL) + for (i = 0; i < num_rows; i++) + { + png_bytep rptr = *rp; + png_read_row(png_ptr, rptr, NULL); + rp++; + } + else if (dp != NULL) + for (i = 0; i < num_rows; i++) + { + png_bytep dptr = *dp; + png_read_row(png_ptr, NULL, dptr); + dp++; + } +} +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +/* Read the entire image. If the image has an alpha channel or a tRNS + * chunk, and you have called png_handle_alpha()[*], you will need to + * initialize the image to the current image that PNG will be overlaying. + * We set the num_rows again here, in case it was incorrectly set in + * png_read_start_row() by a call to png_read_update_info() or + * png_start_read_image() if png_set_interlace_handling() wasn't called + * prior to either of these functions like it should have been. You can + * only call this function once. If you desire to have an image for + * each pass of a interlaced image, use png_read_rows() instead. + * + * [*] png_handle_alpha() does not exist yet, as of this version of libpng + */ +void PNGAPI +png_read_image(png_structp png_ptr, png_bytepp image) +{ + png_uint_32 i, image_height; + int pass, j; + png_bytepp rp; + + png_debug(1, "in png_read_image"); + + if (png_ptr == NULL) + return; + +#ifdef PNG_READ_INTERLACING_SUPPORTED + pass = png_set_interlace_handling(png_ptr); +#else + if (png_ptr->interlaced) + png_error(png_ptr, + "Cannot read interlaced image -- interlace handler disabled"); + pass = 1; +#endif + + + image_height=png_ptr->height; + png_ptr->num_rows = image_height; /* Make sure this is set correctly */ + + for (j = 0; j < pass; j++) + { + rp = image; + for (i = 0; i < image_height; i++) + { + png_read_row(png_ptr, *rp, NULL); + rp++; + } + } +} +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +/* Read the end of the PNG file. Will not read past the end of the + * file, will verify the end is accurate, and will read any comments + * or time information at the end of the file, if info is not NULL. + */ +void PNGAPI +png_read_end(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_read_end"); + + if (png_ptr == NULL) + return; + png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */ + + do + { + PNG_IHDR; + PNG_IDAT; + PNG_IEND; + PNG_PLTE; +#ifdef PNG_READ_bKGD_SUPPORTED + PNG_bKGD; +#endif +#ifdef PNG_READ_cHRM_SUPPORTED + PNG_cHRM; +#endif +#ifdef PNG_READ_gAMA_SUPPORTED + PNG_gAMA; +#endif +#ifdef PNG_READ_hIST_SUPPORTED + PNG_hIST; +#endif +#ifdef PNG_READ_iCCP_SUPPORTED + PNG_iCCP; +#endif +#ifdef PNG_READ_iTXt_SUPPORTED + PNG_iTXt; +#endif +#ifdef PNG_READ_oFFs_SUPPORTED + PNG_oFFs; +#endif +#ifdef PNG_READ_pCAL_SUPPORTED + PNG_pCAL; +#endif +#ifdef PNG_READ_pHYs_SUPPORTED + PNG_pHYs; +#endif +#ifdef PNG_READ_sBIT_SUPPORTED + PNG_sBIT; +#endif +#ifdef PNG_READ_sCAL_SUPPORTED + PNG_sCAL; +#endif +#ifdef PNG_READ_sPLT_SUPPORTED + PNG_sPLT; +#endif +#ifdef PNG_READ_sRGB_SUPPORTED + PNG_sRGB; +#endif +#ifdef PNG_READ_tEXt_SUPPORTED + PNG_tEXt; +#endif +#ifdef PNG_READ_tIME_SUPPORTED + PNG_tIME; +#endif +#ifdef PNG_READ_tRNS_SUPPORTED + PNG_tRNS; +#endif +#ifdef PNG_READ_zTXt_SUPPORTED + PNG_zTXt; +#endif + png_uint_32 length = png_read_chunk_header(png_ptr); + PNG_CONST png_bytep chunk_name = png_ptr->chunk_name; + + if (!png_memcmp(chunk_name, png_IHDR, 4)) + png_handle_IHDR(png_ptr, info_ptr, length); + else if (!png_memcmp(chunk_name, png_IEND, 4)) + png_handle_IEND(png_ptr, info_ptr, length); +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + else if (png_handle_as_unknown(png_ptr, chunk_name)) + { + if (!png_memcmp(chunk_name, png_IDAT, 4)) + { + if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT)) + png_benign_error(png_ptr, "Too many IDATs found"); + } + png_handle_unknown(png_ptr, info_ptr, length); + if (!png_memcmp(chunk_name, png_PLTE, 4)) + png_ptr->mode |= PNG_HAVE_PLTE; + } +#endif + else if (!png_memcmp(chunk_name, png_IDAT, 4)) + { + /* Zero length IDATs are legal after the last IDAT has been + * read, but not after other chunks have been read. + */ + if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT)) + png_benign_error(png_ptr, "Too many IDATs found"); + png_crc_finish(png_ptr, length); + } + else if (!png_memcmp(chunk_name, png_PLTE, 4)) + png_handle_PLTE(png_ptr, info_ptr, length); +#ifdef PNG_READ_bKGD_SUPPORTED + else if (!png_memcmp(chunk_name, png_bKGD, 4)) + png_handle_bKGD(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_cHRM_SUPPORTED + else if (!png_memcmp(chunk_name, png_cHRM, 4)) + png_handle_cHRM(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_gAMA_SUPPORTED + else if (!png_memcmp(chunk_name, png_gAMA, 4)) + png_handle_gAMA(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_hIST_SUPPORTED + else if (!png_memcmp(chunk_name, png_hIST, 4)) + png_handle_hIST(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_oFFs_SUPPORTED + else if (!png_memcmp(chunk_name, png_oFFs, 4)) + png_handle_oFFs(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_pCAL_SUPPORTED + else if (!png_memcmp(chunk_name, png_pCAL, 4)) + png_handle_pCAL(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_sCAL_SUPPORTED + else if (!png_memcmp(chunk_name, png_sCAL, 4)) + png_handle_sCAL(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_pHYs_SUPPORTED + else if (!png_memcmp(chunk_name, png_pHYs, 4)) + png_handle_pHYs(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_sBIT_SUPPORTED + else if (!png_memcmp(chunk_name, png_sBIT, 4)) + png_handle_sBIT(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_sRGB_SUPPORTED + else if (!png_memcmp(chunk_name, png_sRGB, 4)) + png_handle_sRGB(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_iCCP_SUPPORTED + else if (!png_memcmp(chunk_name, png_iCCP, 4)) + png_handle_iCCP(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_sPLT_SUPPORTED + else if (!png_memcmp(chunk_name, png_sPLT, 4)) + png_handle_sPLT(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_tEXt_SUPPORTED + else if (!png_memcmp(chunk_name, png_tEXt, 4)) + png_handle_tEXt(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_tIME_SUPPORTED + else if (!png_memcmp(chunk_name, png_tIME, 4)) + png_handle_tIME(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_tRNS_SUPPORTED + else if (!png_memcmp(chunk_name, png_tRNS, 4)) + png_handle_tRNS(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_zTXt_SUPPORTED + else if (!png_memcmp(chunk_name, png_zTXt, 4)) + png_handle_zTXt(png_ptr, info_ptr, length); +#endif +#ifdef PNG_READ_iTXt_SUPPORTED + else if (!png_memcmp(chunk_name, png_iTXt, 4)) + png_handle_iTXt(png_ptr, info_ptr, length); +#endif + else + png_handle_unknown(png_ptr, info_ptr, length); + } while (!(png_ptr->mode & PNG_HAVE_IEND)); +} +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ + +/* Free all memory used by the read */ +void PNGAPI +png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, + png_infopp end_info_ptr_ptr) +{ + png_structp png_ptr = NULL; + png_infop info_ptr = NULL, end_info_ptr = NULL; +#ifdef PNG_USER_MEM_SUPPORTED + png_free_ptr free_fn = NULL; + png_voidp mem_ptr = NULL; +#endif + + png_debug(1, "in png_destroy_read_struct"); + + if (png_ptr_ptr != NULL) + png_ptr = *png_ptr_ptr; + if (png_ptr == NULL) + return; + +#ifdef PNG_USER_MEM_SUPPORTED + free_fn = png_ptr->free_fn; + mem_ptr = png_ptr->mem_ptr; +#endif + + if (info_ptr_ptr != NULL) + info_ptr = *info_ptr_ptr; + + if (end_info_ptr_ptr != NULL) + end_info_ptr = *end_info_ptr_ptr; + + png_read_destroy(png_ptr, info_ptr, end_info_ptr); + + if (info_ptr != NULL) + { +#ifdef PNG_TEXT_SUPPORTED + png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, -1); +#endif + +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)info_ptr); +#endif + *info_ptr_ptr = NULL; + } + + if (end_info_ptr != NULL) + { +#ifdef PNG_READ_TEXT_SUPPORTED + png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1); +#endif +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)end_info_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)end_info_ptr); +#endif + *end_info_ptr_ptr = NULL; + } + + if (png_ptr != NULL) + { +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)png_ptr); +#endif + *png_ptr_ptr = NULL; + } +} + +/* Free all memory used by the read (old method) */ +void /* PRIVATE */ +png_read_destroy(png_structp png_ptr, png_infop info_ptr, + png_infop end_info_ptr) +{ +#ifdef PNG_SETJMP_SUPPORTED + jmp_buf tmp_jmp; +#endif + png_error_ptr error_fn; + png_error_ptr warning_fn; + png_voidp error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + png_free_ptr free_fn; +#endif + + png_debug(1, "in png_read_destroy"); + + if (info_ptr != NULL) + png_info_destroy(png_ptr, info_ptr); + + if (end_info_ptr != NULL) + png_info_destroy(png_ptr, end_info_ptr); + + png_free(png_ptr, png_ptr->zbuf); + png_free(png_ptr, png_ptr->big_row_buf); + png_free(png_ptr, png_ptr->prev_row); + png_free(png_ptr, png_ptr->chunkdata); +#ifdef PNG_READ_QUANTIZE_SUPPORTED + png_free(png_ptr, png_ptr->palette_lookup); + png_free(png_ptr, png_ptr->quantize_index); +#endif +#ifdef PNG_READ_GAMMA_SUPPORTED + png_free(png_ptr, png_ptr->gamma_table); +#endif +#ifdef PNG_READ_BACKGROUND_SUPPORTED + png_free(png_ptr, png_ptr->gamma_from_1); + png_free(png_ptr, png_ptr->gamma_to_1); +#endif + if (png_ptr->free_me & PNG_FREE_PLTE) + png_zfree(png_ptr, png_ptr->palette); + png_ptr->free_me &= ~PNG_FREE_PLTE; +#if defined(PNG_tRNS_SUPPORTED) || \ + defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->free_me & PNG_FREE_TRNS) + png_free(png_ptr, png_ptr->trans_alpha); + png_ptr->free_me &= ~PNG_FREE_TRNS; +#endif +#ifdef PNG_READ_hIST_SUPPORTED + if (png_ptr->free_me & PNG_FREE_HIST) + png_free(png_ptr, png_ptr->hist); + png_ptr->free_me &= ~PNG_FREE_HIST; +#endif +#ifdef PNG_READ_GAMMA_SUPPORTED + if (png_ptr->gamma_16_table != NULL) + { + int i; + int istop = (1 << (8 - png_ptr->gamma_shift)); + for (i = 0; i < istop; i++) + { + png_free(png_ptr, png_ptr->gamma_16_table[i]); + } + png_free(png_ptr, png_ptr->gamma_16_table); + } +#ifdef PNG_READ_BACKGROUND_SUPPORTED + if (png_ptr->gamma_16_from_1 != NULL) + { + int i; + int istop = (1 << (8 - png_ptr->gamma_shift)); + for (i = 0; i < istop; i++) + { + png_free(png_ptr, png_ptr->gamma_16_from_1[i]); + } + png_free(png_ptr, png_ptr->gamma_16_from_1); + } + if (png_ptr->gamma_16_to_1 != NULL) + { + int i; + int istop = (1 << (8 - png_ptr->gamma_shift)); + for (i = 0; i < istop; i++) + { + png_free(png_ptr, png_ptr->gamma_16_to_1[i]); + } + png_free(png_ptr, png_ptr->gamma_16_to_1); + } +#endif +#endif +#ifdef PNG_TIME_RFC1123_SUPPORTED + png_free(png_ptr, png_ptr->time_buffer); +#endif + + inflateEnd(&png_ptr->zstream); +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED + png_free(png_ptr, png_ptr->save_buffer); +#endif + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +#ifdef PNG_TEXT_SUPPORTED + png_free(png_ptr, png_ptr->current_text); +#endif /* PNG_TEXT_SUPPORTED */ +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + + /* Save the important info out of the png_struct, in case it is + * being used again. + */ +#ifdef PNG_SETJMP_SUPPORTED + png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); +#endif + + error_fn = png_ptr->error_fn; + warning_fn = png_ptr->warning_fn; + error_ptr = png_ptr->error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + free_fn = png_ptr->free_fn; +#endif + + png_memset(png_ptr, 0, png_sizeof(png_struct)); + + png_ptr->error_fn = error_fn; + png_ptr->warning_fn = warning_fn; + png_ptr->error_ptr = error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + png_ptr->free_fn = free_fn; +#endif + +#ifdef PNG_SETJMP_SUPPORTED + png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); +#endif + +} + +void PNGAPI +png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn) +{ + if (png_ptr == NULL) + return; + png_ptr->read_row_fn = read_row_fn; +} + + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +#ifdef PNG_INFO_IMAGE_SUPPORTED +void PNGAPI +png_read_png(png_structp png_ptr, png_infop info_ptr, + int transforms, + voidp params) +{ + int row; + + if (png_ptr == NULL) + return; + + /* png_read_info() gives us all of the information from the + * PNG file before the first IDAT (image data chunk). + */ + png_read_info(png_ptr, info_ptr); + if (info_ptr->height > PNG_UINT_32_MAX/png_sizeof(png_bytep)) + png_error(png_ptr, "Image is too high to process with png_read_png()"); + + /* -------------- image transformations start here ------------------- */ + +#ifdef PNG_READ_16_TO_8_SUPPORTED + /* Tell libpng to strip 16 bit/color files down to 8 bits per color. + */ + if (transforms & PNG_TRANSFORM_STRIP_16) + png_set_strip_16(png_ptr); +#endif + +#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED + /* Strip alpha bytes from the input data without combining with + * the background (not recommended). + */ + if (transforms & PNG_TRANSFORM_STRIP_ALPHA) + png_set_strip_alpha(png_ptr); +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) && !defined(PNG_READ_EXPAND_SUPPORTED) + /* Extract multiple pixels with bit depths of 1, 2, or 4 from a single + * byte into separate bytes (useful for paletted and grayscale images). + */ + if (transforms & PNG_TRANSFORM_PACKING) + png_set_packing(png_ptr); +#endif + +#ifdef PNG_READ_PACKSWAP_SUPPORTED + /* Change the order of packed pixels to least significant bit first + * (not useful if you are using png_set_packing). + */ + if (transforms & PNG_TRANSFORM_PACKSWAP) + png_set_packswap(png_ptr); +#endif + +#ifdef PNG_READ_EXPAND_SUPPORTED + /* Expand paletted colors into true RGB triplets + * Expand grayscale images to full 8 bits from 1, 2, or 4 bits/pixel + * Expand paletted or RGB images with transparency to full alpha + * channels so the data will be available as RGBA quartets. + */ + if (transforms & PNG_TRANSFORM_EXPAND) + if ((png_ptr->bit_depth < 8) || + (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) || + (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))) + png_set_expand(png_ptr); +#endif + + /* We don't handle background color or gamma transformation or quantizing. + */ + +#ifdef PNG_READ_INVERT_SUPPORTED + /* Invert monochrome files to have 0 as white and 1 as black + */ + if (transforms & PNG_TRANSFORM_INVERT_MONO) + png_set_invert_mono(png_ptr); +#endif + +#ifdef PNG_READ_SHIFT_SUPPORTED + /* If you want to shift the pixel values from the range [0,255] or + * [0,65535] to the original [0,7] or [0,31], or whatever range the + * colors were originally in: + */ + if ((transforms & PNG_TRANSFORM_SHIFT) + && png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT)) + { + png_color_8p sig_bit; + + png_get_sBIT(png_ptr, info_ptr, &sig_bit); + png_set_shift(png_ptr, sig_bit); + } +#endif + +#ifdef PNG_READ_BGR_SUPPORTED + /* Flip the RGB pixels to BGR (or RGBA to BGRA) + */ + if (transforms & PNG_TRANSFORM_BGR) + png_set_bgr(png_ptr); +#endif + +#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED + /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) + */ + if (transforms & PNG_TRANSFORM_SWAP_ALPHA) + png_set_swap_alpha(png_ptr); +#endif + +#ifdef PNG_READ_SWAP_SUPPORTED + /* Swap bytes of 16 bit files to least significant byte first + */ + if (transforms & PNG_TRANSFORM_SWAP_ENDIAN) + png_set_swap(png_ptr); +#endif + +/* Added at libpng-1.2.41 */ +#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED + /* Invert the alpha channel from opacity to transparency + */ + if (transforms & PNG_TRANSFORM_INVERT_ALPHA) + png_set_invert_alpha(png_ptr); +#endif + +/* Added at libpng-1.2.41 */ +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED + /* Expand grayscale image to RGB + */ + if (transforms & PNG_TRANSFORM_GRAY_TO_RGB) + png_set_gray_to_rgb(png_ptr); +#endif + + /* We don't handle adding filler bytes */ + + /* Optional call to gamma correct and add the background to the palette + * and update info structure. REQUIRED if you are expecting libpng to + * update the palette for you (i.e., you selected such a transform above). + */ + png_read_update_info(png_ptr, info_ptr); + + /* -------------- image transformations end here ------------------- */ + + png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); + if (info_ptr->row_pointers == NULL) + { + png_uint_32 iptr; + + info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr, + info_ptr->height * png_sizeof(png_bytep)); + for (iptr=0; iptrheight; iptr++) + info_ptr->row_pointers[iptr] = NULL; + + info_ptr->free_me |= PNG_FREE_ROWS; + + for (row = 0; row < (int)info_ptr->height; row++) + info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, + png_get_rowbytes(png_ptr, info_ptr)); + } + + png_read_image(png_ptr, info_ptr->row_pointers); + info_ptr->valid |= PNG_INFO_IDAT; + + /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ + png_read_end(png_ptr, info_ptr); + + transforms = transforms; /* Quiet compiler warnings */ + params = params; + +} +#endif /* PNG_INFO_IMAGE_SUPPORTED */ +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ +#endif /* PNG_READ_SUPPORTED */ diff --git a/png/pngrio.c b/png/pngrio.c new file mode 100644 index 0000000..59059ca --- /dev/null +++ b/png/pngrio.c @@ -0,0 +1,163 @@ + +/* pngrio.c - functions for data input + * + * Last changed in libpng 1.4.1 [February 25, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + * This file provides a location for all input. Users who need + * special handling are expected to write a function that has the same + * arguments as this and performs a similar function, but that possibly + * has a different input method. Note that you shouldn't change this + * function, but rather write a replacement function and then make + * libpng use it at run time with png_set_read_fn(...). + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#ifdef PNG_READ_SUPPORTED +#include "pngpriv.h" + +/* Read the data from whatever input you are using. The default routine + * reads from a file pointer. Note that this routine sometimes gets called + * with very small lengths, so you should implement some kind of simple + * buffering if you are using unbuffered reads. This should never be asked + * to read more then 64K on a 16 bit machine. + */ +void /* PRIVATE */ +png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + png_debug1(4, "reading %d bytes", (int)length); + + if (png_ptr->read_data_fn != NULL) + (*(png_ptr->read_data_fn))(png_ptr, data, length); + else + png_error(png_ptr, "Call to NULL read function"); +} + +#ifdef PNG_STDIO_SUPPORTED +/* This is the function that does the actual reading of data. If you are + * not reading from a standard C stream, you should create a replacement + * read_data function and use it at run time with png_set_read_fn(), rather + * than changing the library. + */ +#ifndef USE_FAR_KEYWORD +void PNGAPI +png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + png_size_t check; + + if (png_ptr == NULL) + return; + /* fread() returns 0 on error, so it is OK to store this in a png_size_t + * instead of an int, which is what fread() actually returns. + */ + check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr); + + if (check != length) + png_error(png_ptr, "Read Error"); +} +#else +/* This is the model-independent version. Since the standard I/O library + can't handle far buffers in the medium and small models, we have to copy + the data. +*/ + +#define NEAR_BUF_SIZE 1024 +#define MIN(a,b) (a <= b ? a : b) + +static void PNGAPI +png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + png_size_t check; + png_byte *n_data; + png_FILE_p io_ptr; + + if (png_ptr == NULL) + return; + /* Check if data really is near. If so, use usual code. */ + n_data = (png_byte *)CVT_PTR_NOCHECK(data); + io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); + if ((png_bytep)n_data == data) + { + check = fread(n_data, 1, length, io_ptr); + } + else + { + png_byte buf[NEAR_BUF_SIZE]; + png_size_t read, remaining, err; + check = 0; + remaining = length; + do + { + read = MIN(NEAR_BUF_SIZE, remaining); + err = fread(buf, 1, read, io_ptr); + png_memcpy(data, buf, read); /* copy far buffer to near buffer */ + if (err != read) + break; + else + check += err; + data += read; + remaining -= read; + } + while (remaining != 0); + } + if ((png_uint_32)check != (png_uint_32)length) + png_error(png_ptr, "read Error"); +} +#endif +#endif + +/* This function allows the application to supply a new input function + * for libpng if standard C streams aren't being used. + * + * This function takes as its arguments: + * png_ptr - pointer to a png input data structure + * io_ptr - pointer to user supplied structure containing info about + * the input functions. May be NULL. + * read_data_fn - pointer to a new input function that takes as its + * arguments a pointer to a png_struct, a pointer to + * a location where input data can be stored, and a 32-bit + * unsigned int that is the number of bytes to be read. + * To exit and output any fatal error messages the new write + * function should call png_error(png_ptr, "Error msg"). + * May be NULL, in which case libpng's default function will + * be used. + */ +void PNGAPI +png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, + png_rw_ptr read_data_fn) +{ + if (png_ptr == NULL) + return; + png_ptr->io_ptr = io_ptr; + +#ifdef PNG_STDIO_SUPPORTED + if (read_data_fn != NULL) + png_ptr->read_data_fn = read_data_fn; + else + png_ptr->read_data_fn = png_default_read_data; +#else + png_ptr->read_data_fn = read_data_fn; +#endif + + /* It is an error to write to a read device */ + if (png_ptr->write_data_fn != NULL) + { + png_ptr->write_data_fn = NULL; + png_warning(png_ptr, + "It's an error to set both read_data_fn and write_data_fn in the "); + png_warning(png_ptr, + "same structure. Resetting write_data_fn to NULL"); + } + +#ifdef PNG_WRITE_FLUSH_SUPPORTED + png_ptr->output_flush_fn = NULL; +#endif +} +#endif /* PNG_READ_SUPPORTED */ diff --git a/png/pngrtran.c b/png/pngrtran.c new file mode 100644 index 0000000..b5e8f1a --- /dev/null +++ b/png/pngrtran.c @@ -0,0 +1,4203 @@ + +/* pngrtran.c - transforms the data in a row for PNG readers + * + * Last changed in libpng 1.4.2 [May 6, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + * This file contains functions optionally called by an application + * in order to tell libpng how to handle data when reading a PNG. + * Transformations that are used in both reading and writing are + * in pngtrans.c. + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#ifdef PNG_READ_SUPPORTED +#include "pngpriv.h" + +/* Set the action on getting a CRC error for an ancillary or critical chunk. */ +void PNGAPI +png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action) +{ + png_debug(1, "in png_set_crc_action"); + + if (png_ptr == NULL) + return; + + /* Tell libpng how we react to CRC errors in critical chunks */ + switch (crit_action) + { + case PNG_CRC_NO_CHANGE: /* Leave setting as is */ + break; + + case PNG_CRC_WARN_USE: /* Warn/use data */ + png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; + png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE; + break; + + case PNG_CRC_QUIET_USE: /* Quiet/use data */ + png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; + png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE | + PNG_FLAG_CRC_CRITICAL_IGNORE; + break; + + case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */ + png_warning(png_ptr, + "Can't discard critical data on CRC error"); + case PNG_CRC_ERROR_QUIT: /* Error/quit */ + + case PNG_CRC_DEFAULT: + default: + png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; + break; + } + + /* Tell libpng how we react to CRC errors in ancillary chunks */ + switch (ancil_action) + { + case PNG_CRC_NO_CHANGE: /* Leave setting as is */ + break; + + case PNG_CRC_WARN_USE: /* Warn/use data */ + png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; + png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE; + break; + + case PNG_CRC_QUIET_USE: /* Quiet/use data */ + png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; + png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE | + PNG_FLAG_CRC_ANCILLARY_NOWARN; + break; + + case PNG_CRC_ERROR_QUIT: /* Error/quit */ + png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; + png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_NOWARN; + break; + + case PNG_CRC_WARN_DISCARD: /* Warn/discard data */ + + case PNG_CRC_DEFAULT: + default: + png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; + break; + } +} + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ + defined(PNG_FLOATING_POINT_SUPPORTED) +/* Handle alpha and tRNS via a background color */ +void PNGAPI +png_set_background(png_structp png_ptr, + png_color_16p background_color, int background_gamma_code, + int need_expand, double background_gamma) +{ + png_debug(1, "in png_set_background"); + + if (png_ptr == NULL) + return; + if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN) + { + png_warning(png_ptr, "Application must supply a known background gamma"); + return; + } + + png_ptr->transformations |= PNG_BACKGROUND; + png_memcpy(&(png_ptr->background), background_color, + png_sizeof(png_color_16)); + png_ptr->background_gamma = (float)background_gamma; + png_ptr->background_gamma_type = (png_byte)(background_gamma_code); + png_ptr->transformations |= (need_expand ? PNG_BACKGROUND_EXPAND : 0); +} +#endif + +#ifdef PNG_READ_16_TO_8_SUPPORTED +/* Strip 16 bit depth files to 8 bit depth */ +void PNGAPI +png_set_strip_16(png_structp png_ptr) +{ + png_debug(1, "in png_set_strip_16"); + + if (png_ptr == NULL) + return; + png_ptr->transformations |= PNG_16_TO_8; +} +#endif + +#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED +void PNGAPI +png_set_strip_alpha(png_structp png_ptr) +{ + png_debug(1, "in png_set_strip_alpha"); + + if (png_ptr == NULL) + return; + png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; +} +#endif + +#ifdef PNG_READ_QUANTIZE_SUPPORTED +/* Quantize file to 8 bit. Supply a palette, the current number + * of elements in the palette, the maximum number of elements + * allowed, and a histogram if possible. If the current number + * of colors is greater then the maximum number, the palette will be + * modified to fit in the maximum number. "full_quantize" indicates + * whether we need a quantizeing cube set up for RGB images, or if we + * simply are reducing the number of colors in a paletted image. + */ + +typedef struct png_dsort_struct +{ + struct png_dsort_struct FAR * next; + png_byte left; + png_byte right; +} png_dsort; +typedef png_dsort FAR * png_dsortp; +typedef png_dsort FAR * FAR * png_dsortpp; + +void PNGAPI +png_set_quantize(png_structp png_ptr, png_colorp palette, + int num_palette, int maximum_colors, png_uint_16p histogram, + int full_quantize) +{ + png_debug(1, "in png_set_quantize"); + + if (png_ptr == NULL) + return; + png_ptr->transformations |= PNG_QUANTIZE; + + if (!full_quantize) + { + int i; + + png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr, + (png_uint_32)(num_palette * png_sizeof(png_byte))); + for (i = 0; i < num_palette; i++) + png_ptr->quantize_index[i] = (png_byte)i; + } + + if (num_palette > maximum_colors) + { + if (histogram != NULL) + { + /* This is easy enough, just throw out the least used colors. + * Perhaps not the best solution, but good enough. + */ + + int i; + + /* Initialize an array to sort colors */ + png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr, + (png_uint_32)(num_palette * png_sizeof(png_byte))); + + /* Initialize the quantize_sort array */ + for (i = 0; i < num_palette; i++) + png_ptr->quantize_sort[i] = (png_byte)i; + + /* Find the least used palette entries by starting a + * bubble sort, and running it until we have sorted + * out enough colors. Note that we don't care about + * sorting all the colors, just finding which are + * least used. + */ + + for (i = num_palette - 1; i >= maximum_colors; i--) + { + int done; /* To stop early if the list is pre-sorted */ + int j; + + done = 1; + for (j = 0; j < i; j++) + { + if (histogram[png_ptr->quantize_sort[j]] + < histogram[png_ptr->quantize_sort[j + 1]]) + { + png_byte t; + + t = png_ptr->quantize_sort[j]; + png_ptr->quantize_sort[j] = png_ptr->quantize_sort[j + 1]; + png_ptr->quantize_sort[j + 1] = t; + done = 0; + } + } + if (done) + break; + } + + /* Swap the palette around, and set up a table, if necessary */ + if (full_quantize) + { + int j = num_palette; + + /* Put all the useful colors within the max, but don't + * move the others. + */ + for (i = 0; i < maximum_colors; i++) + { + if ((int)png_ptr->quantize_sort[i] >= maximum_colors) + { + do + j--; + while ((int)png_ptr->quantize_sort[j] >= maximum_colors); + palette[i] = palette[j]; + } + } + } + else + { + int j = num_palette; + + /* Move all the used colors inside the max limit, and + * develop a translation table. + */ + for (i = 0; i < maximum_colors; i++) + { + /* Only move the colors we need to */ + if ((int)png_ptr->quantize_sort[i] >= maximum_colors) + { + png_color tmp_color; + + do + j--; + while ((int)png_ptr->quantize_sort[j] >= maximum_colors); + + tmp_color = palette[j]; + palette[j] = palette[i]; + palette[i] = tmp_color; + /* Indicate where the color went */ + png_ptr->quantize_index[j] = (png_byte)i; + png_ptr->quantize_index[i] = (png_byte)j; + } + } + + /* Find closest color for those colors we are not using */ + for (i = 0; i < num_palette; i++) + { + if ((int)png_ptr->quantize_index[i] >= maximum_colors) + { + int min_d, k, min_k, d_index; + + /* Find the closest color to one we threw out */ + d_index = png_ptr->quantize_index[i]; + min_d = PNG_COLOR_DIST(palette[d_index], palette[0]); + for (k = 1, min_k = 0; k < maximum_colors; k++) + { + int d; + + d = PNG_COLOR_DIST(palette[d_index], palette[k]); + + if (d < min_d) + { + min_d = d; + min_k = k; + } + } + /* Point to closest color */ + png_ptr->quantize_index[i] = (png_byte)min_k; + } + } + } + png_free(png_ptr, png_ptr->quantize_sort); + png_ptr->quantize_sort = NULL; + } + else + { + /* This is much harder to do simply (and quickly). Perhaps + * we need to go through a median cut routine, but those + * don't always behave themselves with only a few colors + * as input. So we will just find the closest two colors, + * and throw out one of them (chosen somewhat randomly). + * [We don't understand this at all, so if someone wants to + * work on improving it, be our guest - AED, GRP] + */ + int i; + int max_d; + int num_new_palette; + png_dsortp t; + png_dsortpp hash; + + t = NULL; + + /* Initialize palette index arrays */ + png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr, + (png_uint_32)(num_palette * png_sizeof(png_byte))); + png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr, + (png_uint_32)(num_palette * png_sizeof(png_byte))); + + /* Initialize the sort array */ + for (i = 0; i < num_palette; i++) + { + png_ptr->index_to_palette[i] = (png_byte)i; + png_ptr->palette_to_index[i] = (png_byte)i; + } + + hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 * + png_sizeof(png_dsortp))); + + num_new_palette = num_palette; + + /* Initial wild guess at how far apart the farthest pixel + * pair we will be eliminating will be. Larger + * numbers mean more areas will be allocated, Smaller + * numbers run the risk of not saving enough data, and + * having to do this all over again. + * + * I have not done extensive checking on this number. + */ + max_d = 96; + + while (num_new_palette > maximum_colors) + { + for (i = 0; i < num_new_palette - 1; i++) + { + int j; + + for (j = i + 1; j < num_new_palette; j++) + { + int d; + + d = PNG_COLOR_DIST(palette[i], palette[j]); + + if (d <= max_d) + { + + t = (png_dsortp)png_malloc_warn(png_ptr, + (png_uint_32)(png_sizeof(png_dsort))); + if (t == NULL) + break; + t->next = hash[d]; + t->left = (png_byte)i; + t->right = (png_byte)j; + hash[d] = t; + } + } + if (t == NULL) + break; + } + + if (t != NULL) + for (i = 0; i <= max_d; i++) + { + if (hash[i] != NULL) + { + png_dsortp p; + + for (p = hash[i]; p; p = p->next) + { + if ((int)png_ptr->index_to_palette[p->left] + < num_new_palette && + (int)png_ptr->index_to_palette[p->right] + < num_new_palette) + { + int j, next_j; + + if (num_new_palette & 0x01) + { + j = p->left; + next_j = p->right; + } + else + { + j = p->right; + next_j = p->left; + } + + num_new_palette--; + palette[png_ptr->index_to_palette[j]] + = palette[num_new_palette]; + if (!full_quantize) + { + int k; + + for (k = 0; k < num_palette; k++) + { + if (png_ptr->quantize_index[k] == + png_ptr->index_to_palette[j]) + png_ptr->quantize_index[k] = + png_ptr->index_to_palette[next_j]; + if ((int)png_ptr->quantize_index[k] == + num_new_palette) + png_ptr->quantize_index[k] = + png_ptr->index_to_palette[j]; + } + } + + png_ptr->index_to_palette[png_ptr->palette_to_index + [num_new_palette]] = png_ptr->index_to_palette[j]; + png_ptr->palette_to_index[png_ptr->index_to_palette[j]] + = png_ptr->palette_to_index[num_new_palette]; + + png_ptr->index_to_palette[j] = + (png_byte)num_new_palette; + png_ptr->palette_to_index[num_new_palette] = + (png_byte)j; + } + if (num_new_palette <= maximum_colors) + break; + } + if (num_new_palette <= maximum_colors) + break; + } + } + + for (i = 0; i < 769; i++) + { + if (hash[i] != NULL) + { + png_dsortp p = hash[i]; + while (p) + { + t = p->next; + png_free(png_ptr, p); + p = t; + } + } + hash[i] = 0; + } + max_d += 96; + } + png_free(png_ptr, hash); + png_free(png_ptr, png_ptr->palette_to_index); + png_free(png_ptr, png_ptr->index_to_palette); + png_ptr->palette_to_index = NULL; + png_ptr->index_to_palette = NULL; + } + num_palette = maximum_colors; + } + if (png_ptr->palette == NULL) + { + png_ptr->palette = palette; + } + png_ptr->num_palette = (png_uint_16)num_palette; + + if (full_quantize) + { + int i; + png_bytep distance; + int total_bits = PNG_QUANTIZE_RED_BITS + PNG_QUANTIZE_GREEN_BITS + + PNG_QUANTIZE_BLUE_BITS; + int num_red = (1 << PNG_QUANTIZE_RED_BITS); + int num_green = (1 << PNG_QUANTIZE_GREEN_BITS); + int num_blue = (1 << PNG_QUANTIZE_BLUE_BITS); + png_size_t num_entries = ((png_size_t)1 << total_bits); + + png_ptr->palette_lookup = (png_bytep )png_calloc(png_ptr, + (png_uint_32)(num_entries * png_sizeof(png_byte))); + + distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries * + png_sizeof(png_byte))); + png_memset(distance, 0xff, num_entries * png_sizeof(png_byte)); + + for (i = 0; i < num_palette; i++) + { + int ir, ig, ib; + int r = (palette[i].red >> (8 - PNG_QUANTIZE_RED_BITS)); + int g = (palette[i].green >> (8 - PNG_QUANTIZE_GREEN_BITS)); + int b = (palette[i].blue >> (8 - PNG_QUANTIZE_BLUE_BITS)); + + for (ir = 0; ir < num_red; ir++) + { + /* int dr = abs(ir - r); */ + int dr = ((ir > r) ? ir - r : r - ir); + int index_r = (ir << (PNG_QUANTIZE_BLUE_BITS + + PNG_QUANTIZE_GREEN_BITS)); + + for (ig = 0; ig < num_green; ig++) + { + /* int dg = abs(ig - g); */ + int dg = ((ig > g) ? ig - g : g - ig); + int dt = dr + dg; + int dm = ((dr > dg) ? dr : dg); + int index_g = index_r | (ig << PNG_QUANTIZE_BLUE_BITS); + + for (ib = 0; ib < num_blue; ib++) + { + int d_index = index_g | ib; + /* int db = abs(ib - b); */ + int db = ((ib > b) ? ib - b : b - ib); + int dmax = ((dm > db) ? dm : db); + int d = dmax + dt + db; + + if (d < (int)distance[d_index]) + { + distance[d_index] = (png_byte)d; + png_ptr->palette_lookup[d_index] = (png_byte)i; + } + } + } + } + } + + png_free(png_ptr, distance); + } +} +#endif /* PNG_READ_QUANTIZE_SUPPORTED */ + +#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) +/* Transform the image from the file_gamma to the screen_gamma. We + * only do transformations on images where the file_gamma and screen_gamma + * are not close reciprocals, otherwise it slows things down slightly, and + * also needlessly introduces small errors. + * + * We will turn off gamma transformation later if no semitransparent entries + * are present in the tRNS array for palette images. We can't do it here + * because we don't necessarily have the tRNS chunk yet. + */ +void PNGAPI +png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) +{ + png_debug(1, "in png_set_gamma"); + + if (png_ptr == NULL) + return; + + if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) || + (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) || + (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)) + png_ptr->transformations |= PNG_GAMMA; + png_ptr->gamma = (float)file_gamma; + png_ptr->screen_gamma = (float)scrn_gamma; +} +#endif + +#ifdef PNG_READ_EXPAND_SUPPORTED +/* Expand paletted images to RGB, expand grayscale images of + * less than 8-bit depth to 8-bit depth, and expand tRNS chunks + * to alpha channels. + */ +void PNGAPI +png_set_expand(png_structp png_ptr) +{ + png_debug(1, "in png_set_expand"); + + if (png_ptr == NULL) + return; + + png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); + png_ptr->flags &= ~PNG_FLAG_ROW_INIT; +} + +/* GRR 19990627: the following three functions currently are identical + * to png_set_expand(). However, it is entirely reasonable that someone + * might wish to expand an indexed image to RGB but *not* expand a single, + * fully transparent palette entry to a full alpha channel--perhaps instead + * convert tRNS to the grayscale/RGB format (16-bit RGB value), or replace + * the transparent color with a particular RGB value, or drop tRNS entirely. + * IOW, a future version of the library may make the transformations flag + * a bit more fine-grained, with separate bits for each of these three + * functions. + * + * More to the point, these functions make it obvious what libpng will be + * doing, whereas "expand" can (and does) mean any number of things. + * + * GRP 20060307: In libpng-1.2.9, png_set_gray_1_2_4_to_8() was modified + * to expand only the sample depth but not to expand the tRNS to alpha + * and its name was changed to png_set_expand_gray_1_2_4_to_8(). + */ + +/* Expand paletted images to RGB. */ +void PNGAPI +png_set_palette_to_rgb(png_structp png_ptr) +{ + png_debug(1, "in png_set_palette_to_rgb"); + + if (png_ptr == NULL) + return; + + png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); + png_ptr->flags &= ~PNG_FLAG_ROW_INIT; +} + +/* Expand grayscale images of less than 8-bit depth to 8 bits. */ +void PNGAPI +png_set_expand_gray_1_2_4_to_8(png_structp png_ptr) +{ + png_debug(1, "in png_set_expand_gray_1_2_4_to_8"); + + if (png_ptr == NULL) + return; + + png_ptr->transformations |= PNG_EXPAND; + png_ptr->flags &= ~PNG_FLAG_ROW_INIT; +} + + + +/* Expand tRNS chunks to alpha channels. */ +void PNGAPI +png_set_tRNS_to_alpha(png_structp png_ptr) +{ + png_debug(1, "in png_set_tRNS_to_alpha"); + + png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); + png_ptr->flags &= ~PNG_FLAG_ROW_INIT; +} +#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */ + +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED +void PNGAPI +png_set_gray_to_rgb(png_structp png_ptr) +{ + png_debug(1, "in png_set_gray_to_rgb"); + + png_ptr->transformations |= PNG_GRAY_TO_RGB; + png_ptr->flags &= ~PNG_FLAG_ROW_INIT; +} +#endif + +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +/* Convert a RGB image to a grayscale of the same width. This allows us, + * for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image. + */ + +void PNGAPI +png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red, + double green) +{ + int red_fixed = (int)((float)red*100000.0 + 0.5); + int green_fixed = (int)((float)green*100000.0 + 0.5); + if (png_ptr == NULL) + return; + png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed); +} +#endif + +void PNGAPI +png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, + png_fixed_point red, png_fixed_point green) +{ + png_debug(1, "in png_set_rgb_to_gray"); + + if (png_ptr == NULL) + return; + + switch(error_action) + { + case 1: png_ptr->transformations |= PNG_RGB_TO_GRAY; + break; + + case 2: png_ptr->transformations |= PNG_RGB_TO_GRAY_WARN; + break; + + case 3: png_ptr->transformations |= PNG_RGB_TO_GRAY_ERR; + } + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) +#ifdef PNG_READ_EXPAND_SUPPORTED + png_ptr->transformations |= PNG_EXPAND; +#else + { + png_warning(png_ptr, + "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED"); + png_ptr->transformations &= ~PNG_RGB_TO_GRAY; + } +#endif + { + png_uint_16 red_int, green_int; + if (red < 0 || green < 0) + { + red_int = 6968; /* .212671 * 32768 + .5 */ + green_int = 23434; /* .715160 * 32768 + .5 */ + } + else if (red + green < 100000L) + { + red_int = (png_uint_16)(((png_uint_32)red*32768L)/100000L); + green_int = (png_uint_16)(((png_uint_32)green*32768L)/100000L); + } + else + { + png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients"); + red_int = 6968; + green_int = 23434; + } + png_ptr->rgb_to_gray_red_coeff = red_int; + png_ptr->rgb_to_gray_green_coeff = green_int; + png_ptr->rgb_to_gray_blue_coeff = + (png_uint_16)(32768 - red_int - green_int); + } +} +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +void PNGAPI +png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr + read_user_transform_fn) +{ + png_debug(1, "in png_set_read_user_transform_fn"); + + if (png_ptr == NULL) + return; + +#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED + png_ptr->transformations |= PNG_USER_TRANSFORM; + png_ptr->read_user_transform_fn = read_user_transform_fn; +#endif +} +#endif + +/* Initialize everything needed for the read. This includes modifying + * the palette. + */ +void /* PRIVATE */ +png_init_read_transformations(png_structp png_ptr) +{ + png_debug(1, "in png_init_read_transformations"); + + { +#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \ + defined(PNG_READ_SHIFT_SUPPORTED) || \ + defined(PNG_READ_GAMMA_SUPPORTED) + int color_type = png_ptr->color_type; +#endif + +#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED) + +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED + /* Detect gray background and attempt to enable optimization + * for gray --> RGB case + * + * Note: if PNG_BACKGROUND_EXPAND is set and color_type is either RGB or + * RGB_ALPHA (in which case need_expand is superfluous anyway), the + * background color might actually be gray yet not be flagged as such. + * This is not a problem for the current code, which uses + * PNG_BACKGROUND_IS_GRAY only to decide when to do the + * png_do_gray_to_rgb() transformation. + */ + if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) && + !(color_type & PNG_COLOR_MASK_COLOR)) + { + png_ptr->mode |= PNG_BACKGROUND_IS_GRAY; + } else if ((png_ptr->transformations & PNG_BACKGROUND) && + !(png_ptr->transformations & PNG_BACKGROUND_EXPAND) && + (png_ptr->transformations & PNG_GRAY_TO_RGB) && + png_ptr->background.red == png_ptr->background.green && + png_ptr->background.red == png_ptr->background.blue) + { + png_ptr->mode |= PNG_BACKGROUND_IS_GRAY; + png_ptr->background.gray = png_ptr->background.red; + } +#endif + + if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) && + (png_ptr->transformations & PNG_EXPAND)) + { + if (!(color_type & PNG_COLOR_MASK_COLOR)) /* i.e., GRAY or GRAY_ALPHA */ + { + /* Expand background and tRNS chunks */ + switch (png_ptr->bit_depth) + { + case 1: + png_ptr->background.gray *= (png_uint_16)0xff; + png_ptr->background.red = png_ptr->background.green + = png_ptr->background.blue = png_ptr->background.gray; + if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) + { + png_ptr->trans_color.gray *= (png_uint_16)0xff; + png_ptr->trans_color.red = png_ptr->trans_color.green + = png_ptr->trans_color.blue = png_ptr->trans_color.gray; + } + break; + + case 2: + png_ptr->background.gray *= (png_uint_16)0x55; + png_ptr->background.red = png_ptr->background.green + = png_ptr->background.blue = png_ptr->background.gray; + if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) + { + png_ptr->trans_color.gray *= (png_uint_16)0x55; + png_ptr->trans_color.red = png_ptr->trans_color.green + = png_ptr->trans_color.blue = png_ptr->trans_color.gray; + } + break; + + case 4: + png_ptr->background.gray *= (png_uint_16)0x11; + png_ptr->background.red = png_ptr->background.green + = png_ptr->background.blue = png_ptr->background.gray; + if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) + { + png_ptr->trans_color.gray *= (png_uint_16)0x11; + png_ptr->trans_color.red = png_ptr->trans_color.green + = png_ptr->trans_color.blue = png_ptr->trans_color.gray; + } + break; + + case 8: + + case 16: + png_ptr->background.red = png_ptr->background.green + = png_ptr->background.blue = png_ptr->background.gray; + break; + } + } + else if (color_type == PNG_COLOR_TYPE_PALETTE) + { + png_ptr->background.red = + png_ptr->palette[png_ptr->background.index].red; + png_ptr->background.green = + png_ptr->palette[png_ptr->background.index].green; + png_ptr->background.blue = + png_ptr->palette[png_ptr->background.index].blue; + +#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED + if (png_ptr->transformations & PNG_INVERT_ALPHA) + { +#ifdef PNG_READ_EXPAND_SUPPORTED + if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) +#endif + { + /* Invert the alpha channel (in tRNS) unless the pixels are + * going to be expanded, in which case leave it for later + */ + int i, istop; + istop=(int)png_ptr->num_trans; + for (i=0; itrans_alpha[i] = (png_byte)(255 - png_ptr->trans_alpha[i]); + } + } +#endif + + } + } +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED) + png_ptr->background_1 = png_ptr->background; +#endif +#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) + + if ((color_type == PNG_COLOR_TYPE_PALETTE && png_ptr->num_trans != 0) + && (fabs(png_ptr->screen_gamma * png_ptr->gamma - 1.0) + < PNG_GAMMA_THRESHOLD)) + { + int i, k; + k=0; + for (i=0; inum_trans; i++) + { + if (png_ptr->trans_alpha[i] != 0 && png_ptr->trans_alpha[i] != 0xff) + k=1; /* Partial transparency is present */ + } + if (k == 0) + png_ptr->transformations &= ~PNG_GAMMA; + } + + if ((png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY)) && + png_ptr->gamma != 0.0) + { + png_build_gamma_table(png_ptr, png_ptr->bit_depth); + +#ifdef PNG_READ_BACKGROUND_SUPPORTED + if (png_ptr->transformations & PNG_BACKGROUND) + { + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + /* Could skip if no transparency */ + png_color back, back_1; + png_colorp palette = png_ptr->palette; + int num_palette = png_ptr->num_palette; + int i; + if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_FILE) + { + back.red = png_ptr->gamma_table[png_ptr->background.red]; + back.green = png_ptr->gamma_table[png_ptr->background.green]; + back.blue = png_ptr->gamma_table[png_ptr->background.blue]; + + back_1.red = png_ptr->gamma_to_1[png_ptr->background.red]; + back_1.green = png_ptr->gamma_to_1[png_ptr->background.green]; + back_1.blue = png_ptr->gamma_to_1[png_ptr->background.blue]; + } + else + { + double g, gs; + + switch (png_ptr->background_gamma_type) + { + case PNG_BACKGROUND_GAMMA_SCREEN: + g = (png_ptr->screen_gamma); + gs = 1.0; + break; + + case PNG_BACKGROUND_GAMMA_FILE: + g = 1.0 / (png_ptr->gamma); + gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); + break; + + case PNG_BACKGROUND_GAMMA_UNIQUE: + g = 1.0 / (png_ptr->background_gamma); + gs = 1.0 / (png_ptr->background_gamma * + png_ptr->screen_gamma); + break; + default: + g = 1.0; /* back_1 */ + gs = 1.0; /* back */ + } + + if ( fabs(gs - 1.0) < PNG_GAMMA_THRESHOLD) + { + back.red = (png_byte)png_ptr->background.red; + back.green = (png_byte)png_ptr->background.green; + back.blue = (png_byte)png_ptr->background.blue; + } + else + { + back.red = (png_byte)(pow( + (double)png_ptr->background.red/255.0, gs) * 255.0 + .5); + back.green = (png_byte)(pow( + (double)png_ptr->background.green/255.0, gs) * 255.0 + + .5); + back.blue = (png_byte)(pow( + (double)png_ptr->background.blue/255.0, gs) * 255.0 + .5); + } + + back_1.red = (png_byte)(pow( + (double)png_ptr->background.red/255.0, g) * 255.0 + .5); + back_1.green = (png_byte)(pow( + (double)png_ptr->background.green/255.0, g) * 255.0 + .5); + back_1.blue = (png_byte)(pow( + (double)png_ptr->background.blue/255.0, g) * 255.0 + .5); + } + for (i = 0; i < num_palette; i++) + { + if (i < (int)png_ptr->num_trans && png_ptr->trans_alpha[i] != 0xff) + { + if (png_ptr->trans_alpha[i] == 0) + { + palette[i] = back; + } + else /* if (png_ptr->trans_alpha[i] != 0xff) */ + { + png_byte v, w; + + v = png_ptr->gamma_to_1[palette[i].red]; + png_composite(w, v, png_ptr->trans_alpha[i], back_1.red); + palette[i].red = png_ptr->gamma_from_1[w]; + + v = png_ptr->gamma_to_1[palette[i].green]; + png_composite(w, v, png_ptr->trans_alpha[i], back_1.green); + palette[i].green = png_ptr->gamma_from_1[w]; + + v = png_ptr->gamma_to_1[palette[i].blue]; + png_composite(w, v, png_ptr->trans_alpha[i], back_1.blue); + palette[i].blue = png_ptr->gamma_from_1[w]; + } + } + else + { + palette[i].red = png_ptr->gamma_table[palette[i].red]; + palette[i].green = png_ptr->gamma_table[palette[i].green]; + palette[i].blue = png_ptr->gamma_table[palette[i].blue]; + } + } + /* Prevent the transformations being done again, and make sure + * that the now spurious alpha channel is stripped - the code + * has just reduced background composition and gamma correction + * to a simple alpha channel strip. + */ + png_ptr->transformations &= ~PNG_BACKGROUND; + png_ptr->transformations &= ~PNG_GAMMA; + png_ptr->transformations |= PNG_STRIP_ALPHA; + } + /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */ + else + /* color_type != PNG_COLOR_TYPE_PALETTE */ + { + double m = (double)(((png_uint_32)1 << png_ptr->bit_depth) - 1); + double g = 1.0; + double gs = 1.0; + + switch (png_ptr->background_gamma_type) + { + case PNG_BACKGROUND_GAMMA_SCREEN: + g = (png_ptr->screen_gamma); + gs = 1.0; + break; + + case PNG_BACKGROUND_GAMMA_FILE: + g = 1.0 / (png_ptr->gamma); + gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); + break; + + case PNG_BACKGROUND_GAMMA_UNIQUE: + g = 1.0 / (png_ptr->background_gamma); + gs = 1.0 / (png_ptr->background_gamma * + png_ptr->screen_gamma); + break; + } + + png_ptr->background_1.gray = (png_uint_16)(pow( + (double)png_ptr->background.gray / m, g) * m + .5); + png_ptr->background.gray = (png_uint_16)(pow( + (double)png_ptr->background.gray / m, gs) * m + .5); + + if ((png_ptr->background.red != png_ptr->background.green) || + (png_ptr->background.red != png_ptr->background.blue) || + (png_ptr->background.red != png_ptr->background.gray)) + { + /* RGB or RGBA with color background */ + png_ptr->background_1.red = (png_uint_16)(pow( + (double)png_ptr->background.red / m, g) * m + .5); + png_ptr->background_1.green = (png_uint_16)(pow( + (double)png_ptr->background.green / m, g) * m + .5); + png_ptr->background_1.blue = (png_uint_16)(pow( + (double)png_ptr->background.blue / m, g) * m + .5); + png_ptr->background.red = (png_uint_16)(pow( + (double)png_ptr->background.red / m, gs) * m + .5); + png_ptr->background.green = (png_uint_16)(pow( + (double)png_ptr->background.green / m, gs) * m + .5); + png_ptr->background.blue = (png_uint_16)(pow( + (double)png_ptr->background.blue / m, gs) * m + .5); + } + else + { + /* GRAY, GRAY ALPHA, RGB, or RGBA with gray background */ + png_ptr->background_1.red = png_ptr->background_1.green + = png_ptr->background_1.blue = png_ptr->background_1.gray; + png_ptr->background.red = png_ptr->background.green + = png_ptr->background.blue = png_ptr->background.gray; + } + } + } + else + /* Transformation does not include PNG_BACKGROUND */ +#endif /* PNG_READ_BACKGROUND_SUPPORTED */ + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + png_colorp palette = png_ptr->palette; + int num_palette = png_ptr->num_palette; + int i; + + for (i = 0; i < num_palette; i++) + { + palette[i].red = png_ptr->gamma_table[palette[i].red]; + palette[i].green = png_ptr->gamma_table[palette[i].green]; + palette[i].blue = png_ptr->gamma_table[palette[i].blue]; + } + + /* Done the gamma correction. */ + png_ptr->transformations &= ~PNG_GAMMA; + } + } +#ifdef PNG_READ_BACKGROUND_SUPPORTED + else +#endif +#endif /* PNG_READ_GAMMA_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */ +#ifdef PNG_READ_BACKGROUND_SUPPORTED + /* No GAMMA transformation */ + if ((png_ptr->transformations & PNG_BACKGROUND) && + (color_type == PNG_COLOR_TYPE_PALETTE)) + { + int i; + int istop = (int)png_ptr->num_trans; + png_color back; + png_colorp palette = png_ptr->palette; + + back.red = (png_byte)png_ptr->background.red; + back.green = (png_byte)png_ptr->background.green; + back.blue = (png_byte)png_ptr->background.blue; + + for (i = 0; i < istop; i++) + { + if (png_ptr->trans_alpha[i] == 0) + { + palette[i] = back; + } + else if (png_ptr->trans_alpha[i] != 0xff) + { + /* The png_composite() macro is defined in png.h */ + png_composite(palette[i].red, palette[i].red, + png_ptr->trans_alpha[i], back.red); + png_composite(palette[i].green, palette[i].green, + png_ptr->trans_alpha[i], back.green); + png_composite(palette[i].blue, palette[i].blue, + png_ptr->trans_alpha[i], back.blue); + } + } + + /* Handled alpha, still need to strip the channel. */ + png_ptr->transformations &= ~PNG_BACKGROUND; + png_ptr->transformations |= PNG_STRIP_ALPHA; + } +#endif /* PNG_READ_BACKGROUND_SUPPORTED */ + +#ifdef PNG_READ_SHIFT_SUPPORTED + if ((png_ptr->transformations & PNG_SHIFT) && + (color_type == PNG_COLOR_TYPE_PALETTE)) + { + png_uint_16 i; + png_uint_16 istop = png_ptr->num_palette; + int sr = 8 - png_ptr->sig_bit.red; + int sg = 8 - png_ptr->sig_bit.green; + int sb = 8 - png_ptr->sig_bit.blue; + + if (sr < 0 || sr > 8) + sr = 0; + if (sg < 0 || sg > 8) + sg = 0; + if (sb < 0 || sb > 8) + sb = 0; + for (i = 0; i < istop; i++) + { + png_ptr->palette[i].red >>= sr; + png_ptr->palette[i].green >>= sg; + png_ptr->palette[i].blue >>= sb; + } + } +#endif /* PNG_READ_SHIFT_SUPPORTED */ + } +#if !defined(PNG_READ_GAMMA_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) \ + && !defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr) + return; +#endif +} + +/* Modify the info structure to reflect the transformations. The + * info should be updated so a PNG file could be written with it, + * assuming the transformations result in valid PNG data. + */ +void /* PRIVATE */ +png_read_transform_info(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_read_transform_info"); + +#ifdef PNG_READ_EXPAND_SUPPORTED + if (png_ptr->transformations & PNG_EXPAND) + { + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (png_ptr->num_trans && + (png_ptr->transformations & PNG_EXPAND_tRNS)) + info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA; + else + info_ptr->color_type = PNG_COLOR_TYPE_RGB; + info_ptr->bit_depth = 8; + info_ptr->num_trans = 0; + } + else + { + if (png_ptr->num_trans) + { + if (png_ptr->transformations & PNG_EXPAND_tRNS) + info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; + } + if (info_ptr->bit_depth < 8) + info_ptr->bit_depth = 8; + info_ptr->num_trans = 0; + } + } +#endif + +#ifdef PNG_READ_BACKGROUND_SUPPORTED + if (png_ptr->transformations & PNG_BACKGROUND) + { + info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA; + info_ptr->num_trans = 0; + info_ptr->background = png_ptr->background; + } +#endif + +#ifdef PNG_READ_GAMMA_SUPPORTED + if (png_ptr->transformations & PNG_GAMMA) + { +#ifdef PNG_FLOATING_POINT_SUPPORTED + info_ptr->gamma = png_ptr->gamma; +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + info_ptr->int_gamma = png_ptr->int_gamma; +#endif + } +#endif + +#ifdef PNG_READ_16_TO_8_SUPPORTED + if ((png_ptr->transformations & PNG_16_TO_8) && (info_ptr->bit_depth == 16)) + info_ptr->bit_depth = 8; +#endif + +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED + if (png_ptr->transformations & PNG_GRAY_TO_RGB) + info_ptr->color_type |= PNG_COLOR_MASK_COLOR; +#endif + +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED + if (png_ptr->transformations & PNG_RGB_TO_GRAY) + info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR; +#endif + +#ifdef PNG_READ_QUANTIZE_SUPPORTED + if (png_ptr->transformations & PNG_QUANTIZE) + { + if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) || + (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)) && + png_ptr->palette_lookup && info_ptr->bit_depth == 8) + { + info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; + } + } +#endif + +#ifdef PNG_READ_PACK_SUPPORTED + if ((png_ptr->transformations & PNG_PACK) && (info_ptr->bit_depth < 8)) + info_ptr->bit_depth = 8; +#endif + + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + info_ptr->channels = 1; + else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) + info_ptr->channels = 3; + else + info_ptr->channels = 1; + +#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED + if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA) + info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA; +#endif + + if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) + info_ptr->channels++; + +#ifdef PNG_READ_FILLER_SUPPORTED + /* STRIP_ALPHA and FILLER allowed: MASK_ALPHA bit stripped above */ + if ((png_ptr->transformations & PNG_FILLER) && + ((info_ptr->color_type == PNG_COLOR_TYPE_RGB) || + (info_ptr->color_type == PNG_COLOR_TYPE_GRAY))) + { + info_ptr->channels++; + /* If adding a true alpha channel not just filler */ + if (png_ptr->transformations & PNG_ADD_ALPHA) + info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; + } +#endif + +#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \ +defined(PNG_READ_USER_TRANSFORM_SUPPORTED) + if (png_ptr->transformations & PNG_USER_TRANSFORM) + { + if (info_ptr->bit_depth < png_ptr->user_transform_depth) + info_ptr->bit_depth = png_ptr->user_transform_depth; + if (info_ptr->channels < png_ptr->user_transform_channels) + info_ptr->channels = png_ptr->user_transform_channels; + } +#endif + + info_ptr->pixel_depth = (png_byte)(info_ptr->channels * + info_ptr->bit_depth); + + info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, info_ptr->width); + +#ifndef PNG_READ_EXPAND_SUPPORTED + if (png_ptr) + return; +#endif +} + +/* Transform the row. The order of transformations is significant, + * and is very touchy. If you add a transformation, take care to + * decide how it fits in with the other transformations here. + */ +void /* PRIVATE */ +png_do_read_transformations(png_structp png_ptr) +{ + png_debug(1, "in png_do_read_transformations"); + + if (png_ptr->row_buf == NULL) + { +#ifdef PNG_STDIO_SUPPORTED + char msg[50]; + + png_snprintf2(msg, 50, + "NULL row buffer for row %ld, pass %d", (long)png_ptr->row_number, + png_ptr->pass); + png_error(png_ptr, msg); +#else + png_error(png_ptr, "NULL row buffer"); +#endif + } +#ifdef PNG_WARN_UNINITIALIZED_ROW + if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) + /* Application has failed to call either png_read_start_image() + * or png_read_update_info() after setting transforms that expand + * pixels. This check added to libpng-1.2.19 + */ +#if (PNG_WARN_UNINITIALIZED_ROW==1) + png_error(png_ptr, "Uninitialized row"); +#else + png_warning(png_ptr, "Uninitialized row"); +#endif +#endif + +#ifdef PNG_READ_EXPAND_SUPPORTED + if (png_ptr->transformations & PNG_EXPAND) + { + if (png_ptr->row_info.color_type == PNG_COLOR_TYPE_PALETTE) + { + png_do_expand_palette(&(png_ptr->row_info), png_ptr->row_buf + 1, + png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans); + } + else + { + if (png_ptr->num_trans && + (png_ptr->transformations & PNG_EXPAND_tRNS)) + png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1, + &(png_ptr->trans_color)); + else + png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1, + NULL); + } + } +#endif + +#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED + if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA) + png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, + PNG_FLAG_FILLER_AFTER | (png_ptr->flags & PNG_FLAG_STRIP_ALPHA)); +#endif + +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED + if (png_ptr->transformations & PNG_RGB_TO_GRAY) + { + int rgb_error = + png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info), + png_ptr->row_buf + 1); + if (rgb_error) + { + png_ptr->rgb_to_gray_status=1; + if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == + PNG_RGB_TO_GRAY_WARN) + png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel"); + if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == + PNG_RGB_TO_GRAY_ERR) + png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel"); + } + } +#endif + +/* From Andreas Dilger e-mail to png-implement, 26 March 1998: + * + * In most cases, the "simple transparency" should be done prior to doing + * gray-to-RGB, or you will have to test 3x as many bytes to check if a + * pixel is transparent. You would also need to make sure that the + * transparency information is upgraded to RGB. + * + * To summarize, the current flow is: + * - Gray + simple transparency -> compare 1 or 2 gray bytes and composite + * with background "in place" if transparent, + * convert to RGB if necessary + * - Gray + alpha -> composite with gray background and remove alpha bytes, + * convert to RGB if necessary + * + * To support RGB backgrounds for gray images we need: + * - Gray + simple transparency -> convert to RGB + simple transparency, + * compare 3 or 6 bytes and composite with + * background "in place" if transparent + * (3x compare/pixel compared to doing + * composite with gray bkgrnd) + * - Gray + alpha -> convert to RGB + alpha, composite with background and + * remove alpha bytes (3x float + * operations/pixel compared with composite + * on gray background) + * + * Greg's change will do this. The reason it wasn't done before is for + * performance, as this increases the per-pixel operations. If we would check + * in advance if the background was gray or RGB, and position the gray-to-RGB + * transform appropriately, then it would save a lot of work/time. + */ + +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED + /* If gray -> RGB, do so now only if background is non-gray; else do later + * for performance reasons + */ + if ((png_ptr->transformations & PNG_GRAY_TO_RGB) && + !(png_ptr->mode & PNG_BACKGROUND_IS_GRAY)) + png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#ifdef PNG_READ_BACKGROUND_SUPPORTED + if ((png_ptr->transformations & PNG_BACKGROUND) && + ((png_ptr->num_trans != 0 ) || + (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) + png_do_background(&(png_ptr->row_info), png_ptr->row_buf + 1, + &(png_ptr->trans_color), &(png_ptr->background) +#ifdef PNG_READ_GAMMA_SUPPORTED + , &(png_ptr->background_1), + png_ptr->gamma_table, png_ptr->gamma_from_1, + png_ptr->gamma_to_1, png_ptr->gamma_16_table, + png_ptr->gamma_16_from_1, png_ptr->gamma_16_to_1, + png_ptr->gamma_shift +#endif +); +#endif + +#ifdef PNG_READ_GAMMA_SUPPORTED + if ((png_ptr->transformations & PNG_GAMMA) && +#ifdef PNG_READ_BACKGROUND_SUPPORTED + !((png_ptr->transformations & PNG_BACKGROUND) && + ((png_ptr->num_trans != 0) || + (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) && +#endif + (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)) + png_do_gamma(&(png_ptr->row_info), png_ptr->row_buf + 1, + png_ptr->gamma_table, png_ptr->gamma_16_table, + png_ptr->gamma_shift); +#endif + +#ifdef PNG_READ_16_TO_8_SUPPORTED + if (png_ptr->transformations & PNG_16_TO_8) + png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#ifdef PNG_READ_QUANTIZE_SUPPORTED + if (png_ptr->transformations & PNG_QUANTIZE) + { + png_do_quantize((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1, + png_ptr->palette_lookup, png_ptr->quantize_index); + if (png_ptr->row_info.rowbytes == (png_uint_32)0) + png_error(png_ptr, "png_do_quantize returned rowbytes=0"); + } +#endif + +#ifdef PNG_READ_INVERT_SUPPORTED + if (png_ptr->transformations & PNG_INVERT_MONO) + png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#ifdef PNG_READ_SHIFT_SUPPORTED + if (png_ptr->transformations & PNG_SHIFT) + png_do_unshift(&(png_ptr->row_info), png_ptr->row_buf + 1, + &(png_ptr->shift)); +#endif + +#ifdef PNG_READ_PACK_SUPPORTED + if (png_ptr->transformations & PNG_PACK) + png_do_unpack(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#ifdef PNG_READ_BGR_SUPPORTED + if (png_ptr->transformations & PNG_BGR) + png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#ifdef PNG_READ_PACKSWAP_SUPPORTED + if (png_ptr->transformations & PNG_PACKSWAP) + png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED + /* If gray -> RGB, do so now only if we did not do so above */ + if ((png_ptr->transformations & PNG_GRAY_TO_RGB) && + (png_ptr->mode & PNG_BACKGROUND_IS_GRAY)) + png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#ifdef PNG_READ_FILLER_SUPPORTED + if (png_ptr->transformations & PNG_FILLER) + png_do_read_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, + (png_uint_32)png_ptr->filler, png_ptr->flags); +#endif + +#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED + if (png_ptr->transformations & PNG_INVERT_ALPHA) + png_do_read_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED + if (png_ptr->transformations & PNG_SWAP_ALPHA) + png_do_read_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#ifdef PNG_READ_SWAP_SUPPORTED + if (png_ptr->transformations & PNG_SWAP_BYTES) + png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED + if (png_ptr->transformations & PNG_USER_TRANSFORM) + { + if (png_ptr->read_user_transform_fn != NULL) + (*(png_ptr->read_user_transform_fn)) /* User read transform function */ + (png_ptr, /* png_ptr */ + &(png_ptr->row_info), /* row_info: */ + /* png_uint_32 width; width of row */ + /* png_uint_32 rowbytes; number of bytes in row */ + /* png_byte color_type; color type of pixels */ + /* png_byte bit_depth; bit depth of samples */ + /* png_byte channels; number of channels (1-4) */ + /* png_byte pixel_depth; bits per pixel (depth*channels) */ + png_ptr->row_buf + 1); /* start of pixel data for row */ +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED + if (png_ptr->user_transform_depth) + png_ptr->row_info.bit_depth = png_ptr->user_transform_depth; + if (png_ptr->user_transform_channels) + png_ptr->row_info.channels = png_ptr->user_transform_channels; +#endif + png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth * + png_ptr->row_info.channels); + png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, + png_ptr->row_info.width); + } +#endif + +} + +#ifdef PNG_READ_PACK_SUPPORTED +/* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel, + * without changing the actual values. Thus, if you had a row with + * a bit depth of 1, you would end up with bytes that only contained + * the numbers 0 or 1. If you would rather they contain 0 and 255, use + * png_do_shift() after this. + */ +void /* PRIVATE */ +png_do_unpack(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_unpack"); + + if (row_info->bit_depth < 8) + { + png_uint_32 i; + png_uint_32 row_width=row_info->width; + + switch (row_info->bit_depth) + { + case 1: + { + png_bytep sp = row + (png_size_t)((row_width - 1) >> 3); + png_bytep dp = row + (png_size_t)row_width - 1; + png_uint_32 shift = 7 - (int)((row_width + 7) & 0x07); + for (i = 0; i < row_width; i++) + { + *dp = (png_byte)((*sp >> shift) & 0x01); + if (shift == 7) + { + shift = 0; + sp--; + } + else + shift++; + + dp--; + } + break; + } + + case 2: + { + + png_bytep sp = row + (png_size_t)((row_width - 1) >> 2); + png_bytep dp = row + (png_size_t)row_width - 1; + png_uint_32 shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); + for (i = 0; i < row_width; i++) + { + *dp = (png_byte)((*sp >> shift) & 0x03); + if (shift == 6) + { + shift = 0; + sp--; + } + else + shift += 2; + + dp--; + } + break; + } + + case 4: + { + png_bytep sp = row + (png_size_t)((row_width - 1) >> 1); + png_bytep dp = row + (png_size_t)row_width - 1; + png_uint_32 shift = (int)((1 - ((row_width + 1) & 0x01)) << 2); + for (i = 0; i < row_width; i++) + { + *dp = (png_byte)((*sp >> shift) & 0x0f); + if (shift == 4) + { + shift = 0; + sp--; + } + else + shift = 4; + + dp--; + } + break; + } + } + row_info->bit_depth = 8; + row_info->pixel_depth = (png_byte)(8 * row_info->channels); + row_info->rowbytes = row_width * row_info->channels; + } +} +#endif + +#ifdef PNG_READ_SHIFT_SUPPORTED +/* Reverse the effects of png_do_shift. This routine merely shifts the + * pixels back to their significant bits values. Thus, if you have + * a row of bit depth 8, but only 5 are significant, this will shift + * the values back to 0 through 31. + */ +void /* PRIVATE */ +png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits) +{ + png_debug(1, "in png_do_unshift"); + + if ( + row_info->color_type != PNG_COLOR_TYPE_PALETTE) + { + int shift[4]; + int channels = 0; + int c; + png_uint_16 value = 0; + png_uint_32 row_width = row_info->width; + + if (row_info->color_type & PNG_COLOR_MASK_COLOR) + { + shift[channels++] = row_info->bit_depth - sig_bits->red; + shift[channels++] = row_info->bit_depth - sig_bits->green; + shift[channels++] = row_info->bit_depth - sig_bits->blue; + } + else + { + shift[channels++] = row_info->bit_depth - sig_bits->gray; + } + if (row_info->color_type & PNG_COLOR_MASK_ALPHA) + { + shift[channels++] = row_info->bit_depth - sig_bits->alpha; + } + + for (c = 0; c < channels; c++) + { + if (shift[c] <= 0) + shift[c] = 0; + else + value = 1; + } + + if (!value) + return; + + switch (row_info->bit_depth) + { + case 2: + { + png_bytep bp; + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + + for (bp = row, i = 0; i < istop; i++) + { + *bp >>= 1; + *bp++ &= 0x55; + } + break; + } + + case 4: + { + png_bytep bp = row; + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + png_byte mask = (png_byte)((((int)0xf0 >> shift[0]) & (int)0xf0) | + (png_byte)((int)0xf >> shift[0])); + + for (i = 0; i < istop; i++) + { + *bp >>= shift[0]; + *bp++ &= mask; + } + break; + } + + case 8: + { + png_bytep bp = row; + png_uint_32 i; + png_uint_32 istop = row_width * channels; + + for (i = 0; i < istop; i++) + { + *bp++ >>= shift[i%channels]; + } + break; + } + + case 16: + { + png_bytep bp = row; + png_uint_32 i; + png_uint_32 istop = channels * row_width; + + for (i = 0; i < istop; i++) + { + value = (png_uint_16)((*bp << 8) + *(bp + 1)); + value >>= shift[i%channels]; + *bp++ = (png_byte)(value >> 8); + *bp++ = (png_byte)(value & 0xff); + } + break; + } + } + } +} +#endif + +#ifdef PNG_READ_16_TO_8_SUPPORTED +/* Chop rows of bit depth 16 down to 8 */ +void /* PRIVATE */ +png_do_chop(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_chop"); + + if (row_info->bit_depth == 16) + { + png_bytep sp = row; + png_bytep dp = row; + png_uint_32 i; + png_uint_32 istop = row_info->width * row_info->channels; + + for (i = 0; i> 8)) >> 8; + * + * Approximate calculation with shift/add instead of multiply/divide: + * *dp = ((((png_uint_32)(*sp) << 8) | + * (png_uint_32)((int)(*(sp + 1)) - *sp)) + 128) >> 8; + * + * What we actually do to avoid extra shifting and conversion: + */ + + *dp = *sp + ((((int)(*(sp + 1)) - *sp) > 128) ? 1 : 0); +#else + /* Simply discard the low order byte */ + *dp = *sp; +#endif + } + row_info->bit_depth = 8; + row_info->pixel_depth = (png_byte)(8 * row_info->channels); + row_info->rowbytes = row_info->width * row_info->channels; + } +} +#endif + +#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED +void /* PRIVATE */ +png_do_read_swap_alpha(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_read_swap_alpha"); + + { + png_uint_32 row_width = row_info->width; + if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + { + /* This converts from RGBA to ARGB */ + if (row_info->bit_depth == 8) + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_byte save; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + save = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = save; + } + } + /* This converts from RRGGBBAA to AARRGGBB */ + else + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_byte save[2]; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + save[0] = *(--sp); + save[1] = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = save[0]; + *(--dp) = save[1]; + } + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + { + /* This converts from GA to AG */ + if (row_info->bit_depth == 8) + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_byte save; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + save = *(--sp); + *(--dp) = *(--sp); + *(--dp) = save; + } + } + /* This converts from GGAA to AAGG */ + else + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_byte save[2]; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + save[0] = *(--sp); + save[1] = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = save[0]; + *(--dp) = save[1]; + } + } + } + } +} +#endif + +#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED +void /* PRIVATE */ +png_do_read_invert_alpha(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_read_invert_alpha"); + + { + png_uint_32 row_width = row_info->width; + if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + { + /* This inverts the alpha channel in RGBA */ + if (row_info->bit_depth == 8) + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + *(--dp) = (png_byte)(255 - *(--sp)); + +/* This does nothing: + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + We can replace it with: +*/ + sp-=3; + dp=sp; + } + } + /* This inverts the alpha channel in RRGGBBAA */ + else + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + *(--dp) = (png_byte)(255 - *(--sp)); + *(--dp) = (png_byte)(255 - *(--sp)); + +/* This does nothing: + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + We can replace it with: +*/ + sp-=6; + dp=sp; + } + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + { + /* This inverts the alpha channel in GA */ + if (row_info->bit_depth == 8) + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + *(--dp) = (png_byte)(255 - *(--sp)); + *(--dp) = *(--sp); + } + } + /* This inverts the alpha channel in GGAA */ + else + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + *(--dp) = (png_byte)(255 - *(--sp)); + *(--dp) = (png_byte)(255 - *(--sp)); +/* + *(--dp) = *(--sp); + *(--dp) = *(--sp); +*/ + sp-=2; + dp=sp; + } + } + } + } +} +#endif + +#ifdef PNG_READ_FILLER_SUPPORTED +/* Add filler channel if we have RGB color */ +void /* PRIVATE */ +png_do_read_filler(png_row_infop row_info, png_bytep row, + png_uint_32 filler, png_uint_32 flags) +{ + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + png_byte hi_filler = (png_byte)((filler>>8) & 0xff); + png_byte lo_filler = (png_byte)(filler & 0xff); + + png_debug(1, "in png_do_read_filler"); + + if ( + row_info->color_type == PNG_COLOR_TYPE_GRAY) + { + if (row_info->bit_depth == 8) + { + /* This changes the data from G to GX */ + if (flags & PNG_FLAG_FILLER_AFTER) + { + png_bytep sp = row + (png_size_t)row_width; + png_bytep dp = sp + (png_size_t)row_width; + for (i = 1; i < row_width; i++) + { + *(--dp) = lo_filler; + *(--dp) = *(--sp); + } + *(--dp) = lo_filler; + row_info->channels = 2; + row_info->pixel_depth = 16; + row_info->rowbytes = row_width * 2; + } + /* This changes the data from G to XG */ + else + { + png_bytep sp = row + (png_size_t)row_width; + png_bytep dp = sp + (png_size_t)row_width; + for (i = 0; i < row_width; i++) + { + *(--dp) = *(--sp); + *(--dp) = lo_filler; + } + row_info->channels = 2; + row_info->pixel_depth = 16; + row_info->rowbytes = row_width * 2; + } + } + else if (row_info->bit_depth == 16) + { + /* This changes the data from GG to GGXX */ + if (flags & PNG_FLAG_FILLER_AFTER) + { + png_bytep sp = row + (png_size_t)row_width * 2; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 1; i < row_width; i++) + { + *(--dp) = hi_filler; + *(--dp) = lo_filler; + *(--dp) = *(--sp); + *(--dp) = *(--sp); + } + *(--dp) = hi_filler; + *(--dp) = lo_filler; + row_info->channels = 2; + row_info->pixel_depth = 32; + row_info->rowbytes = row_width * 4; + } + /* This changes the data from GG to XXGG */ + else + { + png_bytep sp = row + (png_size_t)row_width * 2; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 0; i < row_width; i++) + { + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = hi_filler; + *(--dp) = lo_filler; + } + row_info->channels = 2; + row_info->pixel_depth = 32; + row_info->rowbytes = row_width * 4; + } + } + } /* COLOR_TYPE == GRAY */ + else if (row_info->color_type == PNG_COLOR_TYPE_RGB) + { + if (row_info->bit_depth == 8) + { + /* This changes the data from RGB to RGBX */ + if (flags & PNG_FLAG_FILLER_AFTER) + { + png_bytep sp = row + (png_size_t)row_width * 3; + png_bytep dp = sp + (png_size_t)row_width; + for (i = 1; i < row_width; i++) + { + *(--dp) = lo_filler; + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + } + *(--dp) = lo_filler; + row_info->channels = 4; + row_info->pixel_depth = 32; + row_info->rowbytes = row_width * 4; + } + /* This changes the data from RGB to XRGB */ + else + { + png_bytep sp = row + (png_size_t)row_width * 3; + png_bytep dp = sp + (png_size_t)row_width; + for (i = 0; i < row_width; i++) + { + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = lo_filler; + } + row_info->channels = 4; + row_info->pixel_depth = 32; + row_info->rowbytes = row_width * 4; + } + } + else if (row_info->bit_depth == 16) + { + /* This changes the data from RRGGBB to RRGGBBXX */ + if (flags & PNG_FLAG_FILLER_AFTER) + { + png_bytep sp = row + (png_size_t)row_width * 6; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 1; i < row_width; i++) + { + *(--dp) = hi_filler; + *(--dp) = lo_filler; + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + } + *(--dp) = hi_filler; + *(--dp) = lo_filler; + row_info->channels = 4; + row_info->pixel_depth = 64; + row_info->rowbytes = row_width * 8; + } + /* This changes the data from RRGGBB to XXRRGGBB */ + else + { + png_bytep sp = row + (png_size_t)row_width * 6; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 0; i < row_width; i++) + { + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = hi_filler; + *(--dp) = lo_filler; + } + row_info->channels = 4; + row_info->pixel_depth = 64; + row_info->rowbytes = row_width * 8; + } + } + } /* COLOR_TYPE == RGB */ +} +#endif + +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED +/* Expand grayscale files to RGB, with or without alpha */ +void /* PRIVATE */ +png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) +{ + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + png_debug(1, "in png_do_gray_to_rgb"); + + if (row_info->bit_depth >= 8 && + !(row_info->color_type & PNG_COLOR_MASK_COLOR)) + { + if (row_info->color_type == PNG_COLOR_TYPE_GRAY) + { + if (row_info->bit_depth == 8) + { + png_bytep sp = row + (png_size_t)row_width - 1; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 0; i < row_width; i++) + { + *(dp--) = *sp; + *(dp--) = *sp; + *(dp--) = *(sp--); + } + } + else + { + png_bytep sp = row + (png_size_t)row_width * 2 - 1; + png_bytep dp = sp + (png_size_t)row_width * 4; + for (i = 0; i < row_width; i++) + { + *(dp--) = *sp; + *(dp--) = *(sp - 1); + *(dp--) = *sp; + *(dp--) = *(sp - 1); + *(dp--) = *(sp--); + *(dp--) = *(sp--); + } + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + { + if (row_info->bit_depth == 8) + { + png_bytep sp = row + (png_size_t)row_width * 2 - 1; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 0; i < row_width; i++) + { + *(dp--) = *(sp--); + *(dp--) = *sp; + *(dp--) = *sp; + *(dp--) = *(sp--); + } + } + else + { + png_bytep sp = row + (png_size_t)row_width * 4 - 1; + png_bytep dp = sp + (png_size_t)row_width * 4; + for (i = 0; i < row_width; i++) + { + *(dp--) = *(sp--); + *(dp--) = *(sp--); + *(dp--) = *sp; + *(dp--) = *(sp - 1); + *(dp--) = *sp; + *(dp--) = *(sp - 1); + *(dp--) = *(sp--); + *(dp--) = *(sp--); + } + } + } + row_info->channels += (png_byte)2; + row_info->color_type |= PNG_COLOR_MASK_COLOR; + row_info->pixel_depth = (png_byte)(row_info->channels * + row_info->bit_depth); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); + } +} +#endif + +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED +/* Reduce RGB files to grayscale, with or without alpha + * using the equation given in Poynton's ColorFAQ at + * (THIS LINK IS DEAD June 2008) + * New link: + * + * Charles Poynton poynton at poynton.com + * + * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B + * + * We approximate this with + * + * Y = 0.21268 * R + 0.7151 * G + 0.07217 * B + * + * which can be expressed with integers as + * + * Y = (6969 * R + 23434 * G + 2365 * B)/32768 + * + * The calculation is to be done in a linear colorspace. + * + * Other integer coefficents can be used via png_set_rgb_to_gray(). + */ +int /* PRIVATE */ +png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) + +{ + png_uint_32 i; + + png_uint_32 row_width = row_info->width; + int rgb_error = 0; + + png_debug(1, "in png_do_rgb_to_gray"); + + if ( + (row_info->color_type & PNG_COLOR_MASK_COLOR)) + { + png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff; + png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff; + png_uint_32 bc = png_ptr->rgb_to_gray_blue_coeff; + + if (row_info->color_type == PNG_COLOR_TYPE_RGB) + { + if (row_info->bit_depth == 8) + { +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL) + { + png_bytep sp = row; + png_bytep dp = row; + + for (i = 0; i < row_width; i++) + { + png_byte red = png_ptr->gamma_to_1[*(sp++)]; + png_byte green = png_ptr->gamma_to_1[*(sp++)]; + png_byte blue = png_ptr->gamma_to_1[*(sp++)]; + if (red != green || red != blue) + { + rgb_error |= 1; + *(dp++) = png_ptr->gamma_from_1[ + (rc*red + gc*green + bc*blue)>>15]; + } + else + *(dp++) = *(sp - 1); + } + } + else +#endif + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_byte red = *(sp++); + png_byte green = *(sp++); + png_byte blue = *(sp++); + if (red != green || red != blue) + { + rgb_error |= 1; + *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15); + } + else + *(dp++) = *(sp - 1); + } + } + } + + else /* RGB bit_depth == 16 */ + { +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->gamma_16_to_1 != NULL && + png_ptr->gamma_16_from_1 != NULL) + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 red, green, blue, w; + + red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + + if (red == green && red == blue) + w = red; + else + { + png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >> + png_ptr->gamma_shift][red>>8]; + png_uint_16 green_1 = + png_ptr->gamma_16_to_1[(green&0xff) >> + png_ptr->gamma_shift][green>>8]; + png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >> + png_ptr->gamma_shift][blue>>8]; + png_uint_16 gray16 = (png_uint_16)((rc*red_1 + gc*green_1 + + bc*blue_1)>>15); + w = png_ptr->gamma_16_from_1[(gray16&0xff) >> + png_ptr->gamma_shift][gray16 >> 8]; + rgb_error |= 1; + } + + *(dp++) = (png_byte)((w>>8) & 0xff); + *(dp++) = (png_byte)(w & 0xff); + } + } + else +#endif + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 red, green, blue, gray16; + + red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + + if (red != green || red != blue) + rgb_error |= 1; + gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15); + *(dp++) = (png_byte)((gray16>>8) & 0xff); + *(dp++) = (png_byte)(gray16 & 0xff); + } + } + } + } + if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + { + if (row_info->bit_depth == 8) + { +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL) + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_byte red = png_ptr->gamma_to_1[*(sp++)]; + png_byte green = png_ptr->gamma_to_1[*(sp++)]; + png_byte blue = png_ptr->gamma_to_1[*(sp++)]; + if (red != green || red != blue) + rgb_error |= 1; + *(dp++) = png_ptr->gamma_from_1 + [(rc*red + gc*green + bc*blue)>>15]; + *(dp++) = *(sp++); /* alpha */ + } + } + else +#endif + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_byte red = *(sp++); + png_byte green = *(sp++); + png_byte blue = *(sp++); + if (red != green || red != blue) + rgb_error |= 1; + *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15); + *(dp++) = *(sp++); /* alpha */ + } + } + } + else /* RGBA bit_depth == 16 */ + { +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->gamma_16_to_1 != NULL && + png_ptr->gamma_16_from_1 != NULL) + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 red, green, blue, w; + + red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + + if (red == green && red == blue) + w = red; + else + { + png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >> + png_ptr->gamma_shift][red>>8]; + png_uint_16 green_1 = + png_ptr->gamma_16_to_1[(green&0xff) >> + png_ptr->gamma_shift][green>>8]; + png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >> + png_ptr->gamma_shift][blue>>8]; + png_uint_16 gray16 = (png_uint_16)((rc * red_1 + + gc * green_1 + bc * blue_1)>>15); + w = png_ptr->gamma_16_from_1[(gray16&0xff) >> + png_ptr->gamma_shift][gray16 >> 8]; + rgb_error |= 1; + } + + *(dp++) = (png_byte)((w>>8) & 0xff); + *(dp++) = (png_byte)(w & 0xff); + *(dp++) = *(sp++); /* alpha */ + *(dp++) = *(sp++); + } + } + else +#endif + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 red, green, blue, gray16; + red = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; + green = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; + blue = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; + if (red != green || red != blue) + rgb_error |= 1; + gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15); + *(dp++) = (png_byte)((gray16>>8) & 0xff); + *(dp++) = (png_byte)(gray16 & 0xff); + *(dp++) = *(sp++); /* alpha */ + *(dp++) = *(sp++); + } + } + } + } + row_info->channels -= (png_byte)2; + row_info->color_type &= ~PNG_COLOR_MASK_COLOR; + row_info->pixel_depth = (png_byte)(row_info->channels * + row_info->bit_depth); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); + } + return rgb_error; +} +#endif + +/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth + * large of png_color. This lets grayscale images be treated as + * paletted. Most useful for gamma correction and simplification + * of code. + */ +void PNGAPI +png_build_grayscale_palette(int bit_depth, png_colorp palette) +{ + int num_palette; + int color_inc; + int i; + int v; + + png_debug(1, "in png_do_build_grayscale_palette"); + + if (palette == NULL) + return; + + switch (bit_depth) + { + case 1: + num_palette = 2; + color_inc = 0xff; + break; + + case 2: + num_palette = 4; + color_inc = 0x55; + break; + + case 4: + num_palette = 16; + color_inc = 0x11; + break; + + case 8: + num_palette = 256; + color_inc = 1; + break; + + default: + num_palette = 0; + color_inc = 0; + break; + } + + for (i = 0, v = 0; i < num_palette; i++, v += color_inc) + { + palette[i].red = (png_byte)v; + palette[i].green = (png_byte)v; + palette[i].blue = (png_byte)v; + } +} + + +#ifdef PNG_READ_BACKGROUND_SUPPORTED +/* Replace any alpha or transparency with the supplied background color. + * "background" is already in the screen gamma, while "background_1" is + * at a gamma of 1.0. Paletted files have already been taken care of. + */ +void /* PRIVATE */ +png_do_background(png_row_infop row_info, png_bytep row, + png_color_16p trans_color, png_color_16p background +#ifdef PNG_READ_GAMMA_SUPPORTED + , png_color_16p background_1, + png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, + png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, + png_uint_16pp gamma_16_to_1, int gamma_shift +#endif + ) +{ + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width=row_info->width; + int shift; + + png_debug(1, "in png_do_background"); + + if (background != NULL && + (!(row_info->color_type & PNG_COLOR_MASK_ALPHA) || + (row_info->color_type != PNG_COLOR_TYPE_PALETTE && trans_color))) + { + switch (row_info->color_type) + { + case PNG_COLOR_TYPE_GRAY: + { + switch (row_info->bit_depth) + { + case 1: + { + sp = row; + shift = 7; + for (i = 0; i < row_width; i++) + { + if ((png_uint_16)((*sp >> shift) & 0x01) + == trans_color->gray) + { + *sp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); + *sp |= (png_byte)(background->gray << shift); + } + if (!shift) + { + shift = 7; + sp++; + } + else + shift--; + } + break; + } + + case 2: + { +#ifdef PNG_READ_GAMMA_SUPPORTED + if (gamma_table != NULL) + { + sp = row; + shift = 6; + for (i = 0; i < row_width; i++) + { + if ((png_uint_16)((*sp >> shift) & 0x03) + == trans_color->gray) + { + *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); + *sp |= (png_byte)(background->gray << shift); + } + else + { + png_byte p = (png_byte)((*sp >> shift) & 0x03); + png_byte g = (png_byte)((gamma_table [p | (p << 2) | + (p << 4) | (p << 6)] >> 6) & 0x03); + *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); + *sp |= (png_byte)(g << shift); + } + if (!shift) + { + shift = 6; + sp++; + } + else + shift -= 2; + } + } + else +#endif + { + sp = row; + shift = 6; + for (i = 0; i < row_width; i++) + { + if ((png_uint_16)((*sp >> shift) & 0x03) + == trans_color->gray) + { + *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); + *sp |= (png_byte)(background->gray << shift); + } + if (!shift) + { + shift = 6; + sp++; + } + else + shift -= 2; + } + } + break; + } + + case 4: + { +#ifdef PNG_READ_GAMMA_SUPPORTED + if (gamma_table != NULL) + { + sp = row; + shift = 4; + for (i = 0; i < row_width; i++) + { + if ((png_uint_16)((*sp >> shift) & 0x0f) + == trans_color->gray) + { + *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); + *sp |= (png_byte)(background->gray << shift); + } + else + { + png_byte p = (png_byte)((*sp >> shift) & 0x0f); + png_byte g = (png_byte)((gamma_table[p | + (p << 4)] >> 4) & 0x0f); + *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); + *sp |= (png_byte)(g << shift); + } + if (!shift) + { + shift = 4; + sp++; + } + else + shift -= 4; + } + } + else +#endif + { + sp = row; + shift = 4; + for (i = 0; i < row_width; i++) + { + if ((png_uint_16)((*sp >> shift) & 0x0f) + == trans_color->gray) + { + *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); + *sp |= (png_byte)(background->gray << shift); + } + if (!shift) + { + shift = 4; + sp++; + } + else + shift -= 4; + } + } + break; + } + + case 8: + { +#ifdef PNG_READ_GAMMA_SUPPORTED + if (gamma_table != NULL) + { + sp = row; + for (i = 0; i < row_width; i++, sp++) + { + if (*sp == trans_color->gray) + { + *sp = (png_byte)background->gray; + } + else + { + *sp = gamma_table[*sp]; + } + } + } + else +#endif + { + sp = row; + for (i = 0; i < row_width; i++, sp++) + { + if (*sp == trans_color->gray) + { + *sp = (png_byte)background->gray; + } + } + } + break; + } + + case 16: + { +#ifdef PNG_READ_GAMMA_SUPPORTED + if (gamma_16 != NULL) + { + sp = row; + for (i = 0; i < row_width; i++, sp += 2) + { + png_uint_16 v; + + v = (png_uint_16)(((*sp) << 8) + *(sp + 1)); + if (v == trans_color->gray) + { + /* Background is already in screen gamma */ + *sp = (png_byte)((background->gray >> 8) & 0xff); + *(sp + 1) = (png_byte)(background->gray & 0xff); + } + else + { + v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + } + } + } + else +#endif + { + sp = row; + for (i = 0; i < row_width; i++, sp += 2) + { + png_uint_16 v; + + v = (png_uint_16)(((*sp) << 8) + *(sp + 1)); + if (v == trans_color->gray) + { + *sp = (png_byte)((background->gray >> 8) & 0xff); + *(sp + 1) = (png_byte)(background->gray & 0xff); + } + } + } + break; + } + } + break; + } + + case PNG_COLOR_TYPE_RGB: + { + if (row_info->bit_depth == 8) + { +#ifdef PNG_READ_GAMMA_SUPPORTED + if (gamma_table != NULL) + { + sp = row; + for (i = 0; i < row_width; i++, sp += 3) + { + if (*sp == trans_color->red && + *(sp + 1) == trans_color->green && + *(sp + 2) == trans_color->blue) + { + *sp = (png_byte)background->red; + *(sp + 1) = (png_byte)background->green; + *(sp + 2) = (png_byte)background->blue; + } + else + { + *sp = gamma_table[*sp]; + *(sp + 1) = gamma_table[*(sp + 1)]; + *(sp + 2) = gamma_table[*(sp + 2)]; + } + } + } + else +#endif + { + sp = row; + for (i = 0; i < row_width; i++, sp += 3) + { + if (*sp == trans_color->red && + *(sp + 1) == trans_color->green && + *(sp + 2) == trans_color->blue) + { + *sp = (png_byte)background->red; + *(sp + 1) = (png_byte)background->green; + *(sp + 2) = (png_byte)background->blue; + } + } + } + } + else /* if (row_info->bit_depth == 16) */ + { +#ifdef PNG_READ_GAMMA_SUPPORTED + if (gamma_16 != NULL) + { + sp = row; + for (i = 0; i < row_width; i++, sp += 6) + { + png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1)); + png_uint_16 g = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); + png_uint_16 b = (png_uint_16)(((*(sp+4)) << 8) + *(sp+5)); + if (r == trans_color->red && g == trans_color->green && + b == trans_color->blue) + { + /* Background is already in screen gamma */ + *sp = (png_byte)((background->red >> 8) & 0xff); + *(sp + 1) = (png_byte)(background->red & 0xff); + *(sp + 2) = (png_byte)((background->green >> 8) & 0xff); + *(sp + 3) = (png_byte)(background->green & 0xff); + *(sp + 4) = (png_byte)((background->blue >> 8) & 0xff); + *(sp + 5) = (png_byte)(background->blue & 0xff); + } + else + { + png_uint_16 v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + v = gamma_16[*(sp + 3) >> gamma_shift][*(sp + 2)]; + *(sp + 2) = (png_byte)((v >> 8) & 0xff); + *(sp + 3) = (png_byte)(v & 0xff); + v = gamma_16[*(sp + 5) >> gamma_shift][*(sp + 4)]; + *(sp + 4) = (png_byte)((v >> 8) & 0xff); + *(sp + 5) = (png_byte)(v & 0xff); + } + } + } + else +#endif + { + sp = row; + for (i = 0; i < row_width; i++, sp += 6) + { + png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp+1)); + png_uint_16 g = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); + png_uint_16 b = (png_uint_16)(((*(sp+4)) << 8) + *(sp+5)); + + if (r == trans_color->red && g == trans_color->green && + b == trans_color->blue) + { + *sp = (png_byte)((background->red >> 8) & 0xff); + *(sp + 1) = (png_byte)(background->red & 0xff); + *(sp + 2) = (png_byte)((background->green >> 8) & 0xff); + *(sp + 3) = (png_byte)(background->green & 0xff); + *(sp + 4) = (png_byte)((background->blue >> 8) & 0xff); + *(sp + 5) = (png_byte)(background->blue & 0xff); + } + } + } + } + break; + } + + case PNG_COLOR_TYPE_GRAY_ALPHA: + { + if (row_info->bit_depth == 8) + { +#ifdef PNG_READ_GAMMA_SUPPORTED + if (gamma_to_1 != NULL && gamma_from_1 != NULL && + gamma_table != NULL) + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 2, dp++) + { + png_uint_16 a = *(sp + 1); + + if (a == 0xff) + { + *dp = gamma_table[*sp]; + } + else if (a == 0) + { + /* Background is already in screen gamma */ + *dp = (png_byte)background->gray; + } + else + { + png_byte v, w; + + v = gamma_to_1[*sp]; + png_composite(w, v, a, background_1->gray); + *dp = gamma_from_1[w]; + } + } + } + else +#endif + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 2, dp++) + { + png_byte a = *(sp + 1); + + if (a == 0xff) + { + *dp = *sp; + } +#ifdef PNG_READ_GAMMA_SUPPORTED + else if (a == 0) + { + *dp = (png_byte)background->gray; + } + else + { + png_composite(*dp, *sp, a, background_1->gray); + } +#else + *dp = (png_byte)background->gray; +#endif + } + } + } + else /* if (png_ptr->bit_depth == 16) */ + { +#ifdef PNG_READ_GAMMA_SUPPORTED + if (gamma_16 != NULL && gamma_16_from_1 != NULL && + gamma_16_to_1 != NULL) + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 4, dp += 2) + { + png_uint_16 a = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); + + if (a == (png_uint_16)0xffff) + { + png_uint_16 v; + + v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; + *dp = (png_byte)((v >> 8) & 0xff); + *(dp + 1) = (png_byte)(v & 0xff); + } +#ifdef PNG_READ_GAMMA_SUPPORTED + else if (a == 0) +#else + else +#endif + { + /* Background is already in screen gamma */ + *dp = (png_byte)((background->gray >> 8) & 0xff); + *(dp + 1) = (png_byte)(background->gray & 0xff); + } +#ifdef PNG_READ_GAMMA_SUPPORTED + else + { + png_uint_16 g, v, w; + + g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; + png_composite_16(v, g, a, background_1->gray); + w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8]; + *dp = (png_byte)((w >> 8) & 0xff); + *(dp + 1) = (png_byte)(w & 0xff); + } +#endif + } + } + else +#endif + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 4, dp += 2) + { + png_uint_16 a = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); + if (a == (png_uint_16)0xffff) + { + png_memcpy(dp, sp, 2); + } +#ifdef PNG_READ_GAMMA_SUPPORTED + else if (a == 0) +#else + else +#endif + { + *dp = (png_byte)((background->gray >> 8) & 0xff); + *(dp + 1) = (png_byte)(background->gray & 0xff); + } +#ifdef PNG_READ_GAMMA_SUPPORTED + else + { + png_uint_16 g, v; + + g = (png_uint_16)(((*sp) << 8) + *(sp + 1)); + png_composite_16(v, g, a, background_1->gray); + *dp = (png_byte)((v >> 8) & 0xff); + *(dp + 1) = (png_byte)(v & 0xff); + } +#endif + } + } + } + break; + } + + case PNG_COLOR_TYPE_RGB_ALPHA: + { + if (row_info->bit_depth == 8) + { +#ifdef PNG_READ_GAMMA_SUPPORTED + if (gamma_to_1 != NULL && gamma_from_1 != NULL && + gamma_table != NULL) + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 4, dp += 3) + { + png_byte a = *(sp + 3); + + if (a == 0xff) + { + *dp = gamma_table[*sp]; + *(dp + 1) = gamma_table[*(sp + 1)]; + *(dp + 2) = gamma_table[*(sp + 2)]; + } + else if (a == 0) + { + /* Background is already in screen gamma */ + *dp = (png_byte)background->red; + *(dp + 1) = (png_byte)background->green; + *(dp + 2) = (png_byte)background->blue; + } + else + { + png_byte v, w; + + v = gamma_to_1[*sp]; + png_composite(w, v, a, background_1->red); + *dp = gamma_from_1[w]; + v = gamma_to_1[*(sp + 1)]; + png_composite(w, v, a, background_1->green); + *(dp + 1) = gamma_from_1[w]; + v = gamma_to_1[*(sp + 2)]; + png_composite(w, v, a, background_1->blue); + *(dp + 2) = gamma_from_1[w]; + } + } + } + else +#endif + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 4, dp += 3) + { + png_byte a = *(sp + 3); + + if (a == 0xff) + { + *dp = *sp; + *(dp + 1) = *(sp + 1); + *(dp + 2) = *(sp + 2); + } + else if (a == 0) + { + *dp = (png_byte)background->red; + *(dp + 1) = (png_byte)background->green; + *(dp + 2) = (png_byte)background->blue; + } + else + { + png_composite(*dp, *sp, a, background->red); + png_composite(*(dp + 1), *(sp + 1), a, + background->green); + png_composite(*(dp + 2), *(sp + 2), a, + background->blue); + } + } + } + } + else /* if (row_info->bit_depth == 16) */ + { +#ifdef PNG_READ_GAMMA_SUPPORTED + if (gamma_16 != NULL && gamma_16_from_1 != NULL && + gamma_16_to_1 != NULL) + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 8, dp += 6) + { + png_uint_16 a = (png_uint_16)(((png_uint_16)(*(sp + 6)) + << 8) + (png_uint_16)(*(sp + 7))); + if (a == (png_uint_16)0xffff) + { + png_uint_16 v; + + v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; + *dp = (png_byte)((v >> 8) & 0xff); + *(dp + 1) = (png_byte)(v & 0xff); + v = gamma_16[*(sp + 3) >> gamma_shift][*(sp + 2)]; + *(dp + 2) = (png_byte)((v >> 8) & 0xff); + *(dp + 3) = (png_byte)(v & 0xff); + v = gamma_16[*(sp + 5) >> gamma_shift][*(sp + 4)]; + *(dp + 4) = (png_byte)((v >> 8) & 0xff); + *(dp + 5) = (png_byte)(v & 0xff); + } + else if (a == 0) + { + /* Background is already in screen gamma */ + *dp = (png_byte)((background->red >> 8) & 0xff); + *(dp + 1) = (png_byte)(background->red & 0xff); + *(dp + 2) = (png_byte)((background->green >> 8) & 0xff); + *(dp + 3) = (png_byte)(background->green & 0xff); + *(dp + 4) = (png_byte)((background->blue >> 8) & 0xff); + *(dp + 5) = (png_byte)(background->blue & 0xff); + } + else + { + png_uint_16 v, w, x; + + v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; + png_composite_16(w, v, a, background_1->red); + x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; + *dp = (png_byte)((x >> 8) & 0xff); + *(dp + 1) = (png_byte)(x & 0xff); + v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)]; + png_composite_16(w, v, a, background_1->green); + x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; + *(dp + 2) = (png_byte)((x >> 8) & 0xff); + *(dp + 3) = (png_byte)(x & 0xff); + v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)]; + png_composite_16(w, v, a, background_1->blue); + x = gamma_16_from_1[(w & 0xff) >> gamma_shift][w >> 8]; + *(dp + 4) = (png_byte)((x >> 8) & 0xff); + *(dp + 5) = (png_byte)(x & 0xff); + } + } + } + else +#endif + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 8, dp += 6) + { + png_uint_16 a = (png_uint_16)(((png_uint_16)(*(sp + 6)) + << 8) + (png_uint_16)(*(sp + 7))); + if (a == (png_uint_16)0xffff) + { + png_memcpy(dp, sp, 6); + } + else if (a == 0) + { + *dp = (png_byte)((background->red >> 8) & 0xff); + *(dp + 1) = (png_byte)(background->red & 0xff); + *(dp + 2) = (png_byte)((background->green >> 8) & 0xff); + *(dp + 3) = (png_byte)(background->green & 0xff); + *(dp + 4) = (png_byte)((background->blue >> 8) & 0xff); + *(dp + 5) = (png_byte)(background->blue & 0xff); + } + else + { + png_uint_16 v; + + png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1)); + png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8) + + *(sp + 3)); + png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8) + + *(sp + 5)); + + png_composite_16(v, r, a, background->red); + *dp = (png_byte)((v >> 8) & 0xff); + *(dp + 1) = (png_byte)(v & 0xff); + png_composite_16(v, g, a, background->green); + *(dp + 2) = (png_byte)((v >> 8) & 0xff); + *(dp + 3) = (png_byte)(v & 0xff); + png_composite_16(v, b, a, background->blue); + *(dp + 4) = (png_byte)((v >> 8) & 0xff); + *(dp + 5) = (png_byte)(v & 0xff); + } + } + } + } + break; + } + } + + if (row_info->color_type & PNG_COLOR_MASK_ALPHA) + { + row_info->color_type &= ~PNG_COLOR_MASK_ALPHA; + row_info->channels--; + row_info->pixel_depth = (png_byte)(row_info->channels * + row_info->bit_depth); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); + } + } +} +#endif + +#ifdef PNG_READ_GAMMA_SUPPORTED +/* Gamma correct the image, avoiding the alpha channel. Make sure + * you do this after you deal with the transparency issue on grayscale + * or RGB images. If your bit depth is 8, use gamma_table, if it + * is 16, use gamma_16_table and gamma_shift. Build these with + * build_gamma_table(). + */ +void /* PRIVATE */ +png_do_gamma(png_row_infop row_info, png_bytep row, + png_bytep gamma_table, png_uint_16pp gamma_16_table, + int gamma_shift) +{ + png_bytep sp; + png_uint_32 i; + png_uint_32 row_width=row_info->width; + + png_debug(1, "in png_do_gamma"); + + if ( + ((row_info->bit_depth <= 8 && gamma_table != NULL) || + (row_info->bit_depth == 16 && gamma_16_table != NULL))) + { + switch (row_info->color_type) + { + case PNG_COLOR_TYPE_RGB: + { + if (row_info->bit_depth == 8) + { + sp = row; + for (i = 0; i < row_width; i++) + { + *sp = gamma_table[*sp]; + sp++; + *sp = gamma_table[*sp]; + sp++; + *sp = gamma_table[*sp]; + sp++; + } + } + else /* if (row_info->bit_depth == 16) */ + { + sp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 v; + + v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + } + } + break; + } + + case PNG_COLOR_TYPE_RGB_ALPHA: + { + if (row_info->bit_depth == 8) + { + sp = row; + for (i = 0; i < row_width; i++) + { + *sp = gamma_table[*sp]; + sp++; + *sp = gamma_table[*sp]; + sp++; + *sp = gamma_table[*sp]; + sp++; + sp++; + } + } + else /* if (row_info->bit_depth == 16) */ + { + sp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 4; + } + } + break; + } + + case PNG_COLOR_TYPE_GRAY_ALPHA: + { + if (row_info->bit_depth == 8) + { + sp = row; + for (i = 0; i < row_width; i++) + { + *sp = gamma_table[*sp]; + sp += 2; + } + } + else /* if (row_info->bit_depth == 16) */ + { + sp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 4; + } + } + break; + } + + case PNG_COLOR_TYPE_GRAY: + { + if (row_info->bit_depth == 2) + { + sp = row; + for (i = 0; i < row_width; i += 4) + { + int a = *sp & 0xc0; + int b = *sp & 0x30; + int c = *sp & 0x0c; + int d = *sp & 0x03; + + *sp = (png_byte)( + ((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)]) ) & 0xc0)| + ((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)| + ((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)| + ((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) )); + sp++; + } + } + + if (row_info->bit_depth == 4) + { + sp = row; + for (i = 0; i < row_width; i += 2) + { + int msb = *sp & 0xf0; + int lsb = *sp & 0x0f; + + *sp = (png_byte)((((int)gamma_table[msb | (msb >> 4)]) & 0xf0) + | (((int)gamma_table[(lsb << 4) | lsb]) >> 4)); + sp++; + } + } + + else if (row_info->bit_depth == 8) + { + sp = row; + for (i = 0; i < row_width; i++) + { + *sp = gamma_table[*sp]; + sp++; + } + } + + else if (row_info->bit_depth == 16) + { + sp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + } + } + break; + } + } + } +} +#endif + +#ifdef PNG_READ_EXPAND_SUPPORTED +/* Expands a palette row to an RGB or RGBA row depending + * upon whether you supply trans and num_trans. + */ +void /* PRIVATE */ +png_do_expand_palette(png_row_infop row_info, png_bytep row, + png_colorp palette, png_bytep trans_alpha, int num_trans) +{ + int shift, value; + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width=row_info->width; + + png_debug(1, "in png_do_expand_palette"); + + if ( + row_info->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (row_info->bit_depth < 8) + { + switch (row_info->bit_depth) + { + case 1: + { + sp = row + (png_size_t)((row_width - 1) >> 3); + dp = row + (png_size_t)row_width - 1; + shift = 7 - (int)((row_width + 7) & 0x07); + for (i = 0; i < row_width; i++) + { + if ((*sp >> shift) & 0x01) + *dp = 1; + else + *dp = 0; + if (shift == 7) + { + shift = 0; + sp--; + } + else + shift++; + + dp--; + } + break; + } + + case 2: + { + sp = row + (png_size_t)((row_width - 1) >> 2); + dp = row + (png_size_t)row_width - 1; + shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); + for (i = 0; i < row_width; i++) + { + value = (*sp >> shift) & 0x03; + *dp = (png_byte)value; + if (shift == 6) + { + shift = 0; + sp--; + } + else + shift += 2; + + dp--; + } + break; + } + + case 4: + { + sp = row + (png_size_t)((row_width - 1) >> 1); + dp = row + (png_size_t)row_width - 1; + shift = (int)((row_width & 0x01) << 2); + for (i = 0; i < row_width; i++) + { + value = (*sp >> shift) & 0x0f; + *dp = (png_byte)value; + if (shift == 4) + { + shift = 0; + sp--; + } + else + shift += 4; + + dp--; + } + break; + } + } + row_info->bit_depth = 8; + row_info->pixel_depth = 8; + row_info->rowbytes = row_width; + } + switch (row_info->bit_depth) + { + case 8: + { + if (trans_alpha != NULL) + { + sp = row + (png_size_t)row_width - 1; + dp = row + (png_size_t)(row_width << 2) - 1; + + for (i = 0; i < row_width; i++) + { + if ((int)(*sp) >= num_trans) + *dp-- = 0xff; + else + *dp-- = trans_alpha[*sp]; + *dp-- = palette[*sp].blue; + *dp-- = palette[*sp].green; + *dp-- = palette[*sp].red; + sp--; + } + row_info->bit_depth = 8; + row_info->pixel_depth = 32; + row_info->rowbytes = row_width * 4; + row_info->color_type = 6; + row_info->channels = 4; + } + else + { + sp = row + (png_size_t)row_width - 1; + dp = row + (png_size_t)(row_width * 3) - 1; + + for (i = 0; i < row_width; i++) + { + *dp-- = palette[*sp].blue; + *dp-- = palette[*sp].green; + *dp-- = palette[*sp].red; + sp--; + } + + row_info->bit_depth = 8; + row_info->pixel_depth = 24; + row_info->rowbytes = row_width * 3; + row_info->color_type = 2; + row_info->channels = 3; + } + break; + } + } + } +} + +/* If the bit depth < 8, it is expanded to 8. Also, if the already + * expanded transparency value is supplied, an alpha channel is built. + */ +void /* PRIVATE */ +png_do_expand(png_row_infop row_info, png_bytep row, + png_color_16p trans_value) +{ + int shift, value; + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width=row_info->width; + + png_debug(1, "in png_do_expand"); + + { + if (row_info->color_type == PNG_COLOR_TYPE_GRAY) + { + png_uint_16 gray = (png_uint_16)(trans_value ? trans_value->gray : 0); + + if (row_info->bit_depth < 8) + { + switch (row_info->bit_depth) + { + case 1: + { + gray = (png_uint_16)((gray&0x01)*0xff); + sp = row + (png_size_t)((row_width - 1) >> 3); + dp = row + (png_size_t)row_width - 1; + shift = 7 - (int)((row_width + 7) & 0x07); + for (i = 0; i < row_width; i++) + { + if ((*sp >> shift) & 0x01) + *dp = 0xff; + else + *dp = 0; + if (shift == 7) + { + shift = 0; + sp--; + } + else + shift++; + + dp--; + } + break; + } + + case 2: + { + gray = (png_uint_16)((gray&0x03)*0x55); + sp = row + (png_size_t)((row_width - 1) >> 2); + dp = row + (png_size_t)row_width - 1; + shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); + for (i = 0; i < row_width; i++) + { + value = (*sp >> shift) & 0x03; + *dp = (png_byte)(value | (value << 2) | (value << 4) | + (value << 6)); + if (shift == 6) + { + shift = 0; + sp--; + } + else + shift += 2; + + dp--; + } + break; + } + + case 4: + { + gray = (png_uint_16)((gray&0x0f)*0x11); + sp = row + (png_size_t)((row_width - 1) >> 1); + dp = row + (png_size_t)row_width - 1; + shift = (int)((1 - ((row_width + 1) & 0x01)) << 2); + for (i = 0; i < row_width; i++) + { + value = (*sp >> shift) & 0x0f; + *dp = (png_byte)(value | (value << 4)); + if (shift == 4) + { + shift = 0; + sp--; + } + else + shift = 4; + + dp--; + } + break; + } + } + + row_info->bit_depth = 8; + row_info->pixel_depth = 8; + row_info->rowbytes = row_width; + } + + if (trans_value != NULL) + { + if (row_info->bit_depth == 8) + { + gray = gray & 0xff; + sp = row + (png_size_t)row_width - 1; + dp = row + (png_size_t)(row_width << 1) - 1; + for (i = 0; i < row_width; i++) + { + if (*sp == gray) + *dp-- = 0; + else + *dp-- = 0xff; + *dp-- = *sp--; + } + } + + else if (row_info->bit_depth == 16) + { + png_byte gray_high = (gray >> 8) & 0xff; + png_byte gray_low = gray & 0xff; + sp = row + row_info->rowbytes - 1; + dp = row + (row_info->rowbytes << 1) - 1; + for (i = 0; i < row_width; i++) + { + if (*(sp - 1) == gray_high && *(sp) == gray_low) + { + *dp-- = 0; + *dp-- = 0; + } + else + { + *dp-- = 0xff; + *dp-- = 0xff; + } + *dp-- = *sp--; + *dp-- = *sp--; + } + } + + row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA; + row_info->channels = 2; + row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, + row_width); + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_RGB && trans_value) + { + if (row_info->bit_depth == 8) + { + png_byte red = trans_value->red & 0xff; + png_byte green = trans_value->green & 0xff; + png_byte blue = trans_value->blue & 0xff; + sp = row + (png_size_t)row_info->rowbytes - 1; + dp = row + (png_size_t)(row_width << 2) - 1; + for (i = 0; i < row_width; i++) + { + if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue) + *dp-- = 0; + else + *dp-- = 0xff; + *dp-- = *sp--; + *dp-- = *sp--; + *dp-- = *sp--; + } + } + else if (row_info->bit_depth == 16) + { + png_byte red_high = (trans_value->red >> 8) & 0xff; + png_byte green_high = (trans_value->green >> 8) & 0xff; + png_byte blue_high = (trans_value->blue >> 8) & 0xff; + png_byte red_low = trans_value->red & 0xff; + png_byte green_low = trans_value->green & 0xff; + png_byte blue_low = trans_value->blue & 0xff; + sp = row + row_info->rowbytes - 1; + dp = row + (png_size_t)(row_width << 3) - 1; + for (i = 0; i < row_width; i++) + { + if (*(sp - 5) == red_high && + *(sp - 4) == red_low && + *(sp - 3) == green_high && + *(sp - 2) == green_low && + *(sp - 1) == blue_high && + *(sp ) == blue_low) + { + *dp-- = 0; + *dp-- = 0; + } + else + { + *dp-- = 0xff; + *dp-- = 0xff; + } + *dp-- = *sp--; + *dp-- = *sp--; + *dp-- = *sp--; + *dp-- = *sp--; + *dp-- = *sp--; + *dp-- = *sp--; + } + } + row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA; + row_info->channels = 4; + row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); + } + } +} +#endif + +#ifdef PNG_READ_QUANTIZE_SUPPORTED +void /* PRIVATE */ +png_do_quantize(png_row_infop row_info, png_bytep row, + png_bytep palette_lookup, png_bytep quantize_lookup) +{ + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width=row_info->width; + + png_debug(1, "in png_do_quantize"); + + { + if (row_info->color_type == PNG_COLOR_TYPE_RGB && + palette_lookup && row_info->bit_depth == 8) + { + int r, g, b, p; + sp = row; + dp = row; + for (i = 0; i < row_width; i++) + { + r = *sp++; + g = *sp++; + b = *sp++; + + /* This looks real messy, but the compiler will reduce + * it down to a reasonable formula. For example, with + * 5 bits per color, we get: + * p = (((r >> 3) & 0x1f) << 10) | + * (((g >> 3) & 0x1f) << 5) | + * ((b >> 3) & 0x1f); + */ + p = (((r >> (8 - PNG_QUANTIZE_RED_BITS)) & + ((1 << PNG_QUANTIZE_RED_BITS) - 1)) << + (PNG_QUANTIZE_GREEN_BITS + PNG_QUANTIZE_BLUE_BITS)) | + (((g >> (8 - PNG_QUANTIZE_GREEN_BITS)) & + ((1 << PNG_QUANTIZE_GREEN_BITS) - 1)) << + (PNG_QUANTIZE_BLUE_BITS)) | + ((b >> (8 - PNG_QUANTIZE_BLUE_BITS)) & + ((1 << PNG_QUANTIZE_BLUE_BITS) - 1)); + + *dp++ = palette_lookup[p]; + } + row_info->color_type = PNG_COLOR_TYPE_PALETTE; + row_info->channels = 1; + row_info->pixel_depth = row_info->bit_depth; + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); + } + else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA && + palette_lookup != NULL && row_info->bit_depth == 8) + { + int r, g, b, p; + sp = row; + dp = row; + for (i = 0; i < row_width; i++) + { + r = *sp++; + g = *sp++; + b = *sp++; + sp++; + + p = (((r >> (8 - PNG_QUANTIZE_RED_BITS)) & + ((1 << PNG_QUANTIZE_RED_BITS) - 1)) << + (PNG_QUANTIZE_GREEN_BITS + PNG_QUANTIZE_BLUE_BITS)) | + (((g >> (8 - PNG_QUANTIZE_GREEN_BITS)) & + ((1 << PNG_QUANTIZE_GREEN_BITS) - 1)) << + (PNG_QUANTIZE_BLUE_BITS)) | + ((b >> (8 - PNG_QUANTIZE_BLUE_BITS)) & + ((1 << PNG_QUANTIZE_BLUE_BITS) - 1)); + + *dp++ = palette_lookup[p]; + } + row_info->color_type = PNG_COLOR_TYPE_PALETTE; + row_info->channels = 1; + row_info->pixel_depth = row_info->bit_depth; + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); + } + else if (row_info->color_type == PNG_COLOR_TYPE_PALETTE && + quantize_lookup && row_info->bit_depth == 8) + { + sp = row; + for (i = 0; i < row_width; i++, sp++) + { + *sp = quantize_lookup[*sp]; + } + } + } +} +#endif + +#ifdef PNG_FLOATING_POINT_SUPPORTED +#ifdef PNG_READ_GAMMA_SUPPORTED +static PNG_CONST int png_gamma_shift[] = + {0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00}; + +/* We build the 8- or 16-bit gamma tables here. Note that for 16-bit + * tables, we don't make a full table if we are reducing to 8-bit in + * the future. Note also how the gamma_16 tables are segmented so that + * we don't need to allocate > 64K chunks for a full 16-bit table. + * + * See the PNG extensions document for an integer algorithm for creating + * the gamma tables. Maybe we will implement that here someday. + * + * We should only reach this point if + * + * the file_gamma is known (i.e., the gAMA or sRGB chunk is present, + * or the application has provided a file_gamma) + * + * AND + * { + * the screen_gamma is known + * + * OR + * + * RGB_to_gray transformation is being performed + * } + * + * AND + * { + * the screen_gamma is different from the reciprocal of the + * file_gamma by more than the specified threshold + * + * OR + * + * a background color has been specified and the file_gamma + * and screen_gamma are not 1.0, within the specified threshold. + * } + */ + +void /* PRIVATE */ +png_build_gamma_table(png_structp png_ptr, png_byte bit_depth) +{ + png_debug(1, "in png_build_gamma_table"); + + if (bit_depth <= 8) + { + int i; + double g; + + if (png_ptr->screen_gamma > .000001) + g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); + + else + g = 1.0; + + png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr, + (png_uint_32)256); + + for (i = 0; i < 256; i++) + { + png_ptr->gamma_table[i] = (png_byte)(pow((double)i / 255.0, + g) * 255.0 + .5); + } + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \ + defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) + if (png_ptr->transformations & ((PNG_BACKGROUND) | PNG_RGB_TO_GRAY)) + { + + g = 1.0 / (png_ptr->gamma); + + png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr, + (png_uint_32)256); + + for (i = 0; i < 256; i++) + { + png_ptr->gamma_to_1[i] = (png_byte)(pow((double)i / 255.0, + g) * 255.0 + .5); + } + + + png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr, + (png_uint_32)256); + + if (png_ptr->screen_gamma > 0.000001) + g = 1.0 / png_ptr->screen_gamma; + + else + g = png_ptr->gamma; /* Probably doing rgb_to_gray */ + + for (i = 0; i < 256; i++) + { + png_ptr->gamma_from_1[i] = (png_byte)(pow((double)i / 255.0, + g) * 255.0 + .5); + + } + } +#endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */ + } + else + { + double g; + int i, j, shift, num; + int sig_bit; + png_uint_32 ig; + + if (png_ptr->color_type & PNG_COLOR_MASK_COLOR) + { + sig_bit = (int)png_ptr->sig_bit.red; + + if ((int)png_ptr->sig_bit.green > sig_bit) + sig_bit = png_ptr->sig_bit.green; + + if ((int)png_ptr->sig_bit.blue > sig_bit) + sig_bit = png_ptr->sig_bit.blue; + } + else + { + sig_bit = (int)png_ptr->sig_bit.gray; + } + + if (sig_bit > 0) + shift = 16 - sig_bit; + + else + shift = 0; + + if (png_ptr->transformations & PNG_16_TO_8) + { + if (shift < (16 - PNG_MAX_GAMMA_8)) + shift = (16 - PNG_MAX_GAMMA_8); + } + + if (shift > 8) + shift = 8; + + if (shift < 0) + shift = 0; + + png_ptr->gamma_shift = (png_byte)shift; + + num = (1 << (8 - shift)); + + if (png_ptr->screen_gamma > .000001) + g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); + else + g = 1.0; + + png_ptr->gamma_16_table = (png_uint_16pp)png_calloc(png_ptr, + (png_uint_32)(num * png_sizeof(png_uint_16p))); + + if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND)) + { + double fin, fout; + png_uint_32 last, max; + + for (i = 0; i < num; i++) + { + png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(256 * png_sizeof(png_uint_16))); + } + + g = 1.0 / g; + last = 0; + for (i = 0; i < 256; i++) + { + fout = ((double)i + 0.5) / 256.0; + fin = pow(fout, g); + max = (png_uint_32)(fin * (double)((png_uint_32)num << 8)); + while (last <= max) + { + png_ptr->gamma_16_table[(int)(last & (0xff >> shift))] + [(int)(last >> (8 - shift))] = (png_uint_16)( + (png_uint_16)i | ((png_uint_16)i << 8)); + last++; + } + } + while (last < ((png_uint_32)num << 8)) + { + png_ptr->gamma_16_table[(int)(last & (0xff >> shift))] + [(int)(last >> (8 - shift))] = (png_uint_16)65535L; + last++; + } + } + else + { + for (i = 0; i < num; i++) + { + png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(256 * png_sizeof(png_uint_16))); + + ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4); + + for (j = 0; j < 256; j++) + { + png_ptr->gamma_16_table[i][j] = + (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) / + 65535.0, g) * 65535.0 + .5); + } + } + } + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \ + defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) + if (png_ptr->transformations & (PNG_BACKGROUND | PNG_RGB_TO_GRAY)) + { + + g = 1.0 / (png_ptr->gamma); + + png_ptr->gamma_16_to_1 = (png_uint_16pp)png_calloc(png_ptr, + (png_uint_32)(num * png_sizeof(png_uint_16p ))); + + for (i = 0; i < num; i++) + { + png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(256 * png_sizeof(png_uint_16))); + + ig = (((png_uint_32)i * + (png_uint_32)png_gamma_shift[shift]) >> 4); + for (j = 0; j < 256; j++) + { + png_ptr->gamma_16_to_1[i][j] = + (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) / + 65535.0, g) * 65535.0 + .5); + } + } + + if (png_ptr->screen_gamma > 0.000001) + g = 1.0 / png_ptr->screen_gamma; + + else + g = png_ptr->gamma; /* Probably doing rgb_to_gray */ + + png_ptr->gamma_16_from_1 = (png_uint_16pp)png_calloc(png_ptr, + (png_uint_32)(num * png_sizeof(png_uint_16p))); + + for (i = 0; i < num; i++) + { + png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(256 * png_sizeof(png_uint_16))); + + ig = (((png_uint_32)i * + (png_uint_32)png_gamma_shift[shift]) >> 4); + + for (j = 0; j < 256; j++) + { + png_ptr->gamma_16_from_1[i][j] = + (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) / + 65535.0, g) * 65535.0 + .5); + } + } + } +#endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */ + } +} +#endif +/* To do: install integer version of png_build_gamma_table here */ +#endif + +#ifdef PNG_MNG_FEATURES_SUPPORTED +/* Undoes intrapixel differencing */ +void /* PRIVATE */ +png_do_read_intrapixel(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_read_intrapixel"); + + if ( + (row_info->color_type & PNG_COLOR_MASK_COLOR)) + { + int bytes_per_pixel; + png_uint_32 row_width = row_info->width; + if (row_info->bit_depth == 8) + { + png_bytep rp; + png_uint_32 i; + + if (row_info->color_type == PNG_COLOR_TYPE_RGB) + bytes_per_pixel = 3; + + else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + bytes_per_pixel = 4; + + else + return; + + for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) + { + *(rp) = (png_byte)((256 + *rp + *(rp+1))&0xff); + *(rp+2) = (png_byte)((256 + *(rp+2) + *(rp+1))&0xff); + } + } + else if (row_info->bit_depth == 16) + { + png_bytep rp; + png_uint_32 i; + + if (row_info->color_type == PNG_COLOR_TYPE_RGB) + bytes_per_pixel = 6; + + else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + bytes_per_pixel = 8; + + else + return; + + for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) + { + png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1); + png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3); + png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5); + png_uint_32 red = (png_uint_32)((s0 + s1 + 65536L) & 0xffffL); + png_uint_32 blue = (png_uint_32)((s2 + s1 + 65536L) & 0xffffL); + *(rp ) = (png_byte)((red >> 8) & 0xff); + *(rp+1) = (png_byte)(red & 0xff); + *(rp+4) = (png_byte)((blue >> 8) & 0xff); + *(rp+5) = (png_byte)(blue & 0xff); + } + } + } +} +#endif /* PNG_MNG_FEATURES_SUPPORTED */ +#endif /* PNG_READ_SUPPORTED */ diff --git a/png/pngrutil.c b/png/pngrutil.c new file mode 100644 index 0000000..416e5d2 --- /dev/null +++ b/png/pngrutil.c @@ -0,0 +1,3381 @@ + +/* pngrutil.c - utilities to read a PNG file + * + * Last changed in libpng 1.4.3 [June 26, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + * This file contains routines that are only called from within + * libpng itself during the course of reading an image. + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#ifdef PNG_READ_SUPPORTED +#include "pngpriv.h" + +# define png_strtod(p,a,b) strtod(a,b) +png_uint_32 PNGAPI +png_get_uint_31(png_structp png_ptr, png_bytep buf) +{ + png_uint_32 i = png_get_uint_32(buf); + if (i > PNG_UINT_31_MAX) + png_error(png_ptr, "PNG unsigned integer out of range"); + return (i); +} +#ifndef PNG_USE_READ_MACROS +/* Grab an unsigned 32-bit integer from a buffer in big-endian format. */ +png_uint_32 PNGAPI +png_get_uint_32(png_bytep buf) +{ + png_uint_32 i = ((png_uint_32)(*buf) << 24) + + ((png_uint_32)(*(buf + 1)) << 16) + + ((png_uint_32)(*(buf + 2)) << 8) + + (png_uint_32)(*(buf + 3)); + + return (i); +} + +/* Grab a signed 32-bit integer from a buffer in big-endian format. The + * data is stored in the PNG file in two's complement format, and it is + * assumed that the machine format for signed integers is the same. + */ +png_int_32 PNGAPI +png_get_int_32(png_bytep buf) +{ + png_int_32 i = ((png_int_32)(*buf) << 24) + + ((png_int_32)(*(buf + 1)) << 16) + + ((png_int_32)(*(buf + 2)) << 8) + + (png_int_32)(*(buf + 3)); + + return (i); +} + +/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */ +png_uint_16 PNGAPI +png_get_uint_16(png_bytep buf) +{ + png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) + + (png_uint_16)(*(buf + 1))); + + return (i); +} +#endif /* PNG_USE_READ_MACROS */ + +/* Read the chunk header (length + type name). + * Put the type name into png_ptr->chunk_name, and return the length. + */ +png_uint_32 /* PRIVATE */ +png_read_chunk_header(png_structp png_ptr) +{ + png_byte buf[8]; + png_uint_32 length; + +#ifdef PNG_IO_STATE_SUPPORTED + /* Inform the I/O callback that the chunk header is being read. + * PNG_IO_CHUNK_HDR requires a single I/O call. + */ + png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_HDR; +#endif + + /* Read the length and the chunk name */ + png_read_data(png_ptr, buf, 8); + length = png_get_uint_31(png_ptr, buf); + + /* Put the chunk name into png_ptr->chunk_name */ + png_memcpy(png_ptr->chunk_name, buf + 4, 4); + + png_debug2(0, "Reading %s chunk, length = %lu", + png_ptr->chunk_name, length); + + /* Reset the crc and run it over the chunk name */ + png_reset_crc(png_ptr); + png_calculate_crc(png_ptr, png_ptr->chunk_name, 4); + + /* Check to see if chunk name is valid */ + png_check_chunk_name(png_ptr, png_ptr->chunk_name); + +#ifdef PNG_IO_STATE_SUPPORTED + /* Inform the I/O callback that chunk data will (possibly) be read. + * PNG_IO_CHUNK_DATA does NOT require a specific number of I/O calls. + */ + png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA; +#endif + + return length; +} + +/* Read data, and (optionally) run it through the CRC. */ +void /* PRIVATE */ +png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length) +{ + if (png_ptr == NULL) + return; + png_read_data(png_ptr, buf, length); + png_calculate_crc(png_ptr, buf, length); +} + +/* Optionally skip data and then check the CRC. Depending on whether we + * are reading a ancillary or critical chunk, and how the program has set + * things up, we may calculate the CRC on the data and print a message. + * Returns '1' if there was a CRC error, '0' otherwise. + */ +int /* PRIVATE */ +png_crc_finish(png_structp png_ptr, png_uint_32 skip) +{ + png_size_t i; + png_size_t istop = png_ptr->zbuf_size; + + for (i = (png_size_t)skip; i > istop; i -= istop) + { + png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); + } + if (i) + { + png_crc_read(png_ptr, png_ptr->zbuf, i); + } + + if (png_crc_error(png_ptr)) + { + if (((png_ptr->chunk_name[0] & 0x20) && /* Ancillary */ + !(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)) || + (!(png_ptr->chunk_name[0] & 0x20) && /* Critical */ + (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_USE))) + { + png_chunk_warning(png_ptr, "CRC error"); + } + else + { + png_chunk_benign_error(png_ptr, "CRC error"); + return (0); + } + return (1); + } + + return (0); +} + +/* Compare the CRC stored in the PNG file with that calculated by libpng from + * the data it has read thus far. + */ +int /* PRIVATE */ +png_crc_error(png_structp png_ptr) +{ + png_byte crc_bytes[4]; + png_uint_32 crc; + int need_crc = 1; + + if (png_ptr->chunk_name[0] & 0x20) /* ancillary */ + { + if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) == + (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN)) + need_crc = 0; + } + else /* critical */ + { + if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) + need_crc = 0; + } + +#ifdef PNG_IO_STATE_SUPPORTED + /* Inform the I/O callback that the chunk CRC is being read */ + /* PNG_IO_CHUNK_CRC requires the I/O to be done at once */ + png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_CRC; +#endif + + png_read_data(png_ptr, crc_bytes, 4); + + if (need_crc) + { + crc = png_get_uint_32(crc_bytes); + return ((int)(crc != png_ptr->crc)); + } + else + return (0); +} + +#if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \ + defined(PNG_READ_iCCP_SUPPORTED) +static png_size_t +png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size, + png_bytep output, png_size_t output_size) +{ + png_size_t count = 0; + + png_ptr->zstream.next_in = (png_bytep)data; /* const_cast: VALID */ + png_ptr->zstream.avail_in = size; + + while (1) + { + int ret, avail; + + /* Reset the output buffer each time round - we empty it + * after every inflate call. + */ + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = png_ptr->zbuf_size; + + ret = inflate(&png_ptr->zstream, Z_NO_FLUSH); + avail = png_ptr->zbuf_size - png_ptr->zstream.avail_out; + + /* First copy/count any new output - but only if we didn't + * get an error code. + */ + if ((ret == Z_OK || ret == Z_STREAM_END) && avail > 0) + { + if (output != 0 && output_size > count) + { + int copy = output_size - count; + if (avail < copy) copy = avail; + png_memcpy(output + count, png_ptr->zbuf, copy); + } + count += avail; + } + + if (ret == Z_OK) + continue; + + /* Termination conditions - always reset the zstream, it + * must be left in inflateInit state. + */ + png_ptr->zstream.avail_in = 0; + inflateReset(&png_ptr->zstream); + + if (ret == Z_STREAM_END) + return count; /* NOTE: may be zero. */ + + /* Now handle the error codes - the API always returns 0 + * and the error message is dumped into the uncompressed + * buffer if available. + */ + { + PNG_CONST char *msg; + if (png_ptr->zstream.msg != 0) + msg = png_ptr->zstream.msg; + else + { +#ifdef PNG_STDIO_SUPPORTED + char umsg[52]; + + switch (ret) + { + case Z_BUF_ERROR: + msg = "Buffer error in compressed datastream in %s chunk"; + break; + case Z_DATA_ERROR: + msg = "Data error in compressed datastream in %s chunk"; + break; + default: + msg = "Incomplete compressed datastream in %s chunk"; + break; + } + + png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name); + msg = umsg; +#else + msg = "Damaged compressed datastream in chunk other than IDAT"; +#endif + } + + png_warning(png_ptr, msg); + } + + /* 0 means an error - notice that this code simple ignores + * zero length compressed chunks as a result. + */ + return 0; + } +} + +/* + * Decompress trailing data in a chunk. The assumption is that chunkdata + * points at an allocated area holding the contents of a chunk with a + * trailing compressed part. What we get back is an allocated area + * holding the original prefix part and an uncompressed version of the + * trailing part (the malloc area passed in is freed). + */ +void /* PRIVATE */ +png_decompress_chunk(png_structp png_ptr, int comp_type, + png_size_t chunklength, + png_size_t prefix_size, png_size_t *newlength) +{ + /* The caller should guarantee this */ + if (prefix_size > chunklength) + { + /* The recovery is to delete the chunk. */ + png_warning(png_ptr, "invalid chunklength"); + prefix_size = 0; /* To delete everything */ + } + + else if (comp_type == PNG_COMPRESSION_TYPE_BASE) + { + png_size_t expanded_size = png_inflate(png_ptr, + (png_bytep)(png_ptr->chunkdata + prefix_size), + chunklength - prefix_size, + 0/*output*/, 0/*output size*/); + + /* Now check the limits on this chunk - if the limit fails the + * compressed data will be removed, the prefix will remain. + */ +#ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED + if (png_ptr->user_chunk_malloc_max && + (prefix_size + expanded_size >= png_ptr->user_chunk_malloc_max - 1)) +#else +# ifdef PNG_USER_CHUNK_MALLOC_MAX + if ((PNG_USER_CHUNK_MALLOC_MAX > 0) && + prefix_size + expanded_size >= PNG_USER_CHUNK_MALLOC_MAX - 1) +# endif +#endif + png_warning(png_ptr, "Exceeded size limit while expanding chunk"); + + /* If the size is zero either there was an error and a message + * has already been output (warning) or the size really is zero + * and we have nothing to do - the code will exit through the + * error case below. + */ +#if defined(PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED) || \ + defined(PNG_USER_CHUNK_MALLOC_MAX) + else +#endif + if (expanded_size > 0) + { + /* Success (maybe) - really uncompress the chunk. */ + png_size_t new_size = 0; + png_charp text = png_malloc_warn(png_ptr, + prefix_size + expanded_size + 1); + + if (text != NULL) + { + png_memcpy(text, png_ptr->chunkdata, prefix_size); + new_size = png_inflate(png_ptr, + (png_bytep)(png_ptr->chunkdata + prefix_size), + chunklength - prefix_size, + (png_bytep)(text + prefix_size), expanded_size); + text[prefix_size + expanded_size] = 0; /* just in case */ + + if (new_size == expanded_size) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = text; + *newlength = prefix_size + expanded_size; + return; /* The success return! */ + } + + png_warning(png_ptr, "png_inflate logic error"); + png_free(png_ptr, text); + } + else + png_warning(png_ptr, "Not enough memory to decompress chunk"); + } + } + + else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */ + { +#ifdef PNG_STDIO_SUPPORTED + char umsg[50]; + + png_snprintf(umsg, sizeof umsg, "Unknown zTXt compression type %d", + comp_type); + png_warning(png_ptr, umsg); +#else + png_warning(png_ptr, "Unknown zTXt compression type"); +#endif + + /* The recovery is to simply drop the data. */ + } + + /* Generic error return - leave the prefix, delete the compressed + * data, reallocate the chunkdata to remove the potentially large + * amount of compressed data. + */ + { + png_charp text = png_malloc_warn(png_ptr, prefix_size + 1); + if (text != NULL) + { + if (prefix_size > 0) + png_memcpy(text, png_ptr->chunkdata, prefix_size); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = text; + + /* This is an extra zero in the 'uncompressed' part. */ + *(png_ptr->chunkdata + prefix_size) = 0x00; + } + /* Ignore a malloc error here - it is safe. */ + } + + *newlength = prefix_size; +} +#endif + +/* Read and check the IDHR chunk */ +void /* PRIVATE */ +png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte buf[13]; + png_uint_32 width, height; + int bit_depth, color_type, compression_type, filter_type; + int interlace_type; + + png_debug(1, "in png_handle_IHDR"); + + if (png_ptr->mode & PNG_HAVE_IHDR) + png_error(png_ptr, "Out of place IHDR"); + + /* Check the length */ + if (length != 13) + png_error(png_ptr, "Invalid IHDR chunk"); + + png_ptr->mode |= PNG_HAVE_IHDR; + + png_crc_read(png_ptr, buf, 13); + png_crc_finish(png_ptr, 0); + + width = png_get_uint_31(png_ptr, buf); + height = png_get_uint_31(png_ptr, buf + 4); + bit_depth = buf[8]; + color_type = buf[9]; + compression_type = buf[10]; + filter_type = buf[11]; + interlace_type = buf[12]; + + /* Set internal variables */ + png_ptr->width = width; + png_ptr->height = height; + png_ptr->bit_depth = (png_byte)bit_depth; + png_ptr->interlaced = (png_byte)interlace_type; + png_ptr->color_type = (png_byte)color_type; +#ifdef PNG_MNG_FEATURES_SUPPORTED + png_ptr->filter_type = (png_byte)filter_type; +#endif + png_ptr->compression_type = (png_byte)compression_type; + + /* Find number of channels */ + switch (png_ptr->color_type) + { + case PNG_COLOR_TYPE_GRAY: + case PNG_COLOR_TYPE_PALETTE: + png_ptr->channels = 1; + break; + + case PNG_COLOR_TYPE_RGB: + png_ptr->channels = 3; + break; + + case PNG_COLOR_TYPE_GRAY_ALPHA: + png_ptr->channels = 2; + break; + + case PNG_COLOR_TYPE_RGB_ALPHA: + png_ptr->channels = 4; + break; + } + + /* Set up other useful info */ + png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * + png_ptr->channels); + png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width); + png_debug1(3, "bit_depth = %d", png_ptr->bit_depth); + png_debug1(3, "channels = %d", png_ptr->channels); + png_debug1(3, "rowbytes = %lu", png_ptr->rowbytes); + png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, + color_type, interlace_type, compression_type, filter_type); +} + +/* Read and check the palette */ +void /* PRIVATE */ +png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_color palette[PNG_MAX_PALETTE_LENGTH]; + int num, i; +#ifdef PNG_POINTER_INDEXING_SUPPORTED + png_colorp pal_ptr; +#endif + + png_debug(1, "in png_handle_PLTE"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before PLTE"); + + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid PLTE after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + + else if (png_ptr->mode & PNG_HAVE_PLTE) + png_error(png_ptr, "Duplicate PLTE chunk"); + + png_ptr->mode |= PNG_HAVE_PLTE; + + if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR)) + { + png_warning(png_ptr, + "Ignoring PLTE chunk in grayscale PNG"); + png_crc_finish(png_ptr, length); + return; + } +#ifndef PNG_READ_OPT_PLTE_SUPPORTED + if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE) + { + png_crc_finish(png_ptr, length); + return; + } +#endif + + if (length > 3*PNG_MAX_PALETTE_LENGTH || length % 3) + { + if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE) + { + png_warning(png_ptr, "Invalid palette chunk"); + png_crc_finish(png_ptr, length); + return; + } + + else + { + png_error(png_ptr, "Invalid palette chunk"); + } + } + + num = (int)length / 3; + +#ifdef PNG_POINTER_INDEXING_SUPPORTED + for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++) + { + png_byte buf[3]; + + png_crc_read(png_ptr, buf, 3); + pal_ptr->red = buf[0]; + pal_ptr->green = buf[1]; + pal_ptr->blue = buf[2]; + } +#else + for (i = 0; i < num; i++) + { + png_byte buf[3]; + + png_crc_read(png_ptr, buf, 3); + /* Don't depend upon png_color being any order */ + palette[i].red = buf[0]; + palette[i].green = buf[1]; + palette[i].blue = buf[2]; + } +#endif + + /* If we actually NEED the PLTE chunk (ie for a paletted image), we do + * whatever the normal CRC configuration tells us. However, if we + * have an RGB image, the PLTE can be considered ancillary, so + * we will act as though it is. + */ +#ifndef PNG_READ_OPT_PLTE_SUPPORTED + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) +#endif + { + png_crc_finish(png_ptr, 0); + } +#ifndef PNG_READ_OPT_PLTE_SUPPORTED + else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */ + { + /* If we don't want to use the data from an ancillary chunk, + we have two options: an error abort, or a warning and we + ignore the data in this chunk (which should be OK, since + it's considered ancillary for a RGB or RGBA image). */ + if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE)) + { + if (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) + { + png_chunk_benign_error(png_ptr, "CRC error"); + } + else + { + png_chunk_warning(png_ptr, "CRC error"); + return; + } + } + /* Otherwise, we (optionally) emit a warning and use the chunk. */ + else if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)) + { + png_chunk_warning(png_ptr, "CRC error"); + } + } +#endif + + png_set_PLTE(png_ptr, info_ptr, palette, num); + +#ifdef PNG_READ_tRNS_SUPPORTED + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) + { + if (png_ptr->num_trans > (png_uint_16)num) + { + png_warning(png_ptr, "Truncating incorrect tRNS chunk length"); + png_ptr->num_trans = (png_uint_16)num; + } + if (info_ptr->num_trans > (png_uint_16)num) + { + png_warning(png_ptr, "Truncating incorrect info tRNS chunk length"); + info_ptr->num_trans = (png_uint_16)num; + } + } + } +#endif + +} + +void /* PRIVATE */ +png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_debug(1, "in png_handle_IEND"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR) || !(png_ptr->mode & PNG_HAVE_IDAT)) + { + png_error(png_ptr, "No image in file"); + } + + png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND); + + if (length != 0) + { + png_warning(png_ptr, "Incorrect IEND chunk length"); + } + png_crc_finish(png_ptr, length); + + info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */ +} + +#ifdef PNG_READ_gAMA_SUPPORTED +void /* PRIVATE */ +png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_fixed_point igamma; +#ifdef PNG_FLOATING_POINT_SUPPORTED + float file_gamma; +#endif + png_byte buf[4]; + + png_debug(1, "in png_handle_gAMA"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before gAMA"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid gAMA after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + /* Should be an error, but we can cope with it */ + png_warning(png_ptr, "Out of place gAMA chunk"); + + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) +#ifdef PNG_READ_sRGB_SUPPORTED + && !(info_ptr->valid & PNG_INFO_sRGB) +#endif + ) + { + png_warning(png_ptr, "Duplicate gAMA chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (length != 4) + { + png_warning(png_ptr, "Incorrect gAMA chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 4); + if (png_crc_finish(png_ptr, 0)) + return; + + igamma = (png_fixed_point)png_get_uint_32(buf); + /* Check for zero gamma */ + if (igamma == 0) + { + png_warning(png_ptr, + "Ignoring gAMA chunk with gamma=0"); + return; + } + +#ifdef PNG_READ_sRGB_SUPPORTED + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)) + if (PNG_OUT_OF_RANGE(igamma, 45500L, 500)) + { + png_warning(png_ptr, + "Ignoring incorrect gAMA value when sRGB is also present"); +#ifdef PNG_CONSOLE_IO_SUPPORTED + fprintf(stderr, "gamma = (%d/100000)", (int)igamma); +#endif + return; + } +#endif /* PNG_READ_sRGB_SUPPORTED */ + +#ifdef PNG_FLOATING_POINT_SUPPORTED + file_gamma = (float)igamma / (float)100000.0; +# ifdef PNG_READ_GAMMA_SUPPORTED + png_ptr->gamma = file_gamma; +# endif + png_set_gAMA(png_ptr, info_ptr, file_gamma); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + png_set_gAMA_fixed(png_ptr, info_ptr, igamma); +#endif +} +#endif + +#ifdef PNG_READ_sBIT_SUPPORTED +void /* PRIVATE */ +png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_size_t truelen; + png_byte buf[4]; + + png_debug(1, "in png_handle_sBIT"); + + buf[0] = buf[1] = buf[2] = buf[3] = 0; + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before sBIT"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid sBIT after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + { + /* Should be an error, but we can cope with it */ + png_warning(png_ptr, "Out of place sBIT chunk"); + } + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)) + { + png_warning(png_ptr, "Duplicate sBIT chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + truelen = 3; + else + truelen = (png_size_t)png_ptr->channels; + + if (length != truelen || length > 4) + { + png_warning(png_ptr, "Incorrect sBIT chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, truelen); + if (png_crc_finish(png_ptr, 0)) + return; + + if (png_ptr->color_type & PNG_COLOR_MASK_COLOR) + { + png_ptr->sig_bit.red = buf[0]; + png_ptr->sig_bit.green = buf[1]; + png_ptr->sig_bit.blue = buf[2]; + png_ptr->sig_bit.alpha = buf[3]; + } + else + { + png_ptr->sig_bit.gray = buf[0]; + png_ptr->sig_bit.red = buf[0]; + png_ptr->sig_bit.green = buf[0]; + png_ptr->sig_bit.blue = buf[0]; + png_ptr->sig_bit.alpha = buf[1]; + } + png_set_sBIT(png_ptr, info_ptr, &(png_ptr->sig_bit)); +} +#endif + +#ifdef PNG_READ_cHRM_SUPPORTED +void /* PRIVATE */ +png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte buf[32]; +#ifdef PNG_FLOATING_POINT_SUPPORTED + float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; +#endif + png_fixed_point int_x_white, int_y_white, int_x_red, int_y_red, int_x_green, + int_y_green, int_x_blue, int_y_blue; + + png_uint_32 uint_x, uint_y; + + png_debug(1, "in png_handle_cHRM"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before cHRM"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid cHRM after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + /* Should be an error, but we can cope with it */ + png_warning(png_ptr, "Missing PLTE before cHRM"); + + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM) +#ifdef PNG_READ_sRGB_SUPPORTED + && !(info_ptr->valid & PNG_INFO_sRGB) +#endif + ) + { + png_warning(png_ptr, "Duplicate cHRM chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (length != 32) + { + png_warning(png_ptr, "Incorrect cHRM chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 32); + if (png_crc_finish(png_ptr, 0)) + return; + + uint_x = png_get_uint_32(buf); + uint_y = png_get_uint_32(buf + 4); + int_x_white = (png_fixed_point)uint_x; + int_y_white = (png_fixed_point)uint_y; + + uint_x = png_get_uint_32(buf + 8); + uint_y = png_get_uint_32(buf + 12); + int_x_red = (png_fixed_point)uint_x; + int_y_red = (png_fixed_point)uint_y; + + uint_x = png_get_uint_32(buf + 16); + uint_y = png_get_uint_32(buf + 20); + int_x_green = (png_fixed_point)uint_x; + int_y_green = (png_fixed_point)uint_y; + + uint_x = png_get_uint_32(buf + 24); + uint_y = png_get_uint_32(buf + 28); + int_x_blue = (png_fixed_point)uint_x; + int_y_blue = (png_fixed_point)uint_y; + +#ifdef PNG_FLOATING_POINT_SUPPORTED + white_x = (float)int_x_white / (float)100000.0; + white_y = (float)int_y_white / (float)100000.0; + red_x = (float)int_x_red / (float)100000.0; + red_y = (float)int_y_red / (float)100000.0; + green_x = (float)int_x_green / (float)100000.0; + green_y = (float)int_y_green / (float)100000.0; + blue_x = (float)int_x_blue / (float)100000.0; + blue_y = (float)int_y_blue / (float)100000.0; +#endif + +#ifdef PNG_READ_sRGB_SUPPORTED + if ((info_ptr != NULL) && (info_ptr->valid & PNG_INFO_sRGB)) + { + if (PNG_OUT_OF_RANGE(int_x_white, 31270, 1000) || + PNG_OUT_OF_RANGE(int_y_white, 32900, 1000) || + PNG_OUT_OF_RANGE(int_x_red, 64000L, 1000) || + PNG_OUT_OF_RANGE(int_y_red, 33000, 1000) || + PNG_OUT_OF_RANGE(int_x_green, 30000, 1000) || + PNG_OUT_OF_RANGE(int_y_green, 60000L, 1000) || + PNG_OUT_OF_RANGE(int_x_blue, 15000, 1000) || + PNG_OUT_OF_RANGE(int_y_blue, 6000, 1000)) + { + png_warning(png_ptr, + "Ignoring incorrect cHRM value when sRGB is also present"); +#ifdef PNG_CONSOLE_IO_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED + fprintf(stderr, "wx=%f, wy=%f, rx=%f, ry=%f\n", + white_x, white_y, red_x, red_y); + fprintf(stderr, "gx=%f, gy=%f, bx=%f, by=%f\n", + green_x, green_y, blue_x, blue_y); +#else + fprintf(stderr, "wx=%ld, wy=%ld, rx=%ld, ry=%ld\n", + (long)int_x_white, (long)int_y_white, + (long)int_x_red, (long)int_y_red); + fprintf(stderr, "gx=%ld, gy=%ld, bx=%ld, by=%ld\n", + (long)int_x_green, (long)int_y_green, + (long)int_x_blue, (long)int_y_blue); +#endif +#endif /* PNG_CONSOLE_IO_SUPPORTED */ + } + return; + } +#endif /* PNG_READ_sRGB_SUPPORTED */ + +#ifdef PNG_FLOATING_POINT_SUPPORTED + png_set_cHRM(png_ptr, info_ptr, + white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + png_set_cHRM_fixed(png_ptr, info_ptr, + int_x_white, int_y_white, int_x_red, int_y_red, int_x_green, + int_y_green, int_x_blue, int_y_blue); +#endif +} +#endif + +#ifdef PNG_READ_sRGB_SUPPORTED +void /* PRIVATE */ +png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + int intent; + png_byte buf[1]; + + png_debug(1, "in png_handle_sRGB"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before sRGB"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid sRGB after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + /* Should be an error, but we can cope with it */ + png_warning(png_ptr, "Out of place sRGB chunk"); + + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)) + { + png_warning(png_ptr, "Duplicate sRGB chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (length != 1) + { + png_warning(png_ptr, "Incorrect sRGB chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 1); + if (png_crc_finish(png_ptr, 0)) + return; + + intent = buf[0]; + /* Check for bad intent */ + if (intent >= PNG_sRGB_INTENT_LAST) + { + png_warning(png_ptr, "Unknown sRGB intent"); + return; + } + +#if defined(PNG_READ_gAMA_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED) + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)) + { + png_fixed_point igamma; +#ifdef PNG_FIXED_POINT_SUPPORTED + igamma=info_ptr->int_gamma; +#else +# ifdef PNG_FLOATING_POINT_SUPPORTED + igamma=(png_fixed_point)(info_ptr->gamma * 100000.); +# endif +#endif + if (PNG_OUT_OF_RANGE(igamma, 45500L, 500)) + { + png_warning(png_ptr, + "Ignoring incorrect gAMA value when sRGB is also present"); +#ifdef PNG_CONSOLE_IO_SUPPORTED +# ifdef PNG_FIXED_POINT_SUPPORTED + fprintf(stderr, "incorrect gamma=(%d/100000)\n", + (int)png_ptr->int_gamma); +# else +# ifdef PNG_FLOATING_POINT_SUPPORTED + fprintf(stderr, "incorrect gamma=%f\n", png_ptr->gamma); +# endif +# endif +#endif + } + } +#endif /* PNG_READ_gAMA_SUPPORTED */ + +#ifdef PNG_READ_cHRM_SUPPORTED +#ifdef PNG_FIXED_POINT_SUPPORTED + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) + if (PNG_OUT_OF_RANGE(info_ptr->int_x_white, 31270, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_y_white, 32900, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_x_red, 64000L, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_y_red, 33000, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_x_green, 30000, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_y_green, 60000L, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_x_blue, 15000, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_y_blue, 6000, 1000)) + { + png_warning(png_ptr, + "Ignoring incorrect cHRM value when sRGB is also present"); + } +#endif /* PNG_FIXED_POINT_SUPPORTED */ +#endif /* PNG_READ_cHRM_SUPPORTED */ + + png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, intent); +} +#endif /* PNG_READ_sRGB_SUPPORTED */ + +#ifdef PNG_READ_iCCP_SUPPORTED +void /* PRIVATE */ +png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +/* Note: this does not properly handle chunks that are > 64K under DOS */ +{ + png_byte compression_type; + png_bytep pC; + png_charp profile; + png_uint_32 skip = 0; + png_uint_32 profile_size, profile_length; + png_size_t slength, prefix_length, data_length; + + png_debug(1, "in png_handle_iCCP"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before iCCP"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid iCCP after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + /* Should be an error, but we can cope with it */ + png_warning(png_ptr, "Out of place iCCP chunk"); + + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)) + { + png_warning(png_ptr, "Duplicate iCCP chunk"); + png_crc_finish(png_ptr, length); + return; + } + +#ifdef PNG_MAX_MALLOC_64K + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "iCCP chunk too large to fit in memory"); + skip = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = (png_charp)png_malloc(png_ptr, length + 1); + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength); + + if (png_crc_finish(png_ptr, skip)) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + + png_ptr->chunkdata[slength] = 0x00; + + for (profile = png_ptr->chunkdata; *profile; profile++) + /* Empty loop to find end of name */ ; + + ++profile; + + /* There should be at least one zero (the compression type byte) + * following the separator, and we should be on it + */ + if ( profile >= png_ptr->chunkdata + slength - 1) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + png_warning(png_ptr, "Malformed iCCP chunk"); + return; + } + + /* Compression_type should always be zero */ + compression_type = *profile++; + if (compression_type) + { + png_warning(png_ptr, "Ignoring nonzero compression type in iCCP chunk"); + compression_type = 0x00; /* Reset it to zero (libpng-1.0.6 through 1.0.8 + wrote nonzero) */ + } + + prefix_length = profile - png_ptr->chunkdata; + png_decompress_chunk(png_ptr, compression_type, + slength, prefix_length, &data_length); + + profile_length = data_length - prefix_length; + + if ( prefix_length > data_length || profile_length < 4) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + png_warning(png_ptr, "Profile size field missing from iCCP chunk"); + return; + } + + /* Check the profile_size recorded in the first 32 bits of the ICC profile */ + pC = (png_bytep)(png_ptr->chunkdata + prefix_length); + profile_size = ((*(pC ))<<24) | + ((*(pC + 1))<<16) | + ((*(pC + 2))<< 8) | + ((*(pC + 3)) ); + + if (profile_size < profile_length) + profile_length = profile_size; + + if (profile_size > profile_length) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + png_warning(png_ptr, "Ignoring truncated iCCP profile"); +#ifdef PNG_STDIO_SUPPORTED + { + char umsg[50]; + + png_snprintf(umsg, 50, "declared profile size = %lu", + (unsigned long)profile_size); + png_warning(png_ptr, umsg); + png_snprintf(umsg, 50, "actual profile length = %lu", + (unsigned long)profile_length); + png_warning(png_ptr, umsg); + } +#endif + return; + } + + png_set_iCCP(png_ptr, info_ptr, png_ptr->chunkdata, + compression_type, png_ptr->chunkdata + prefix_length, profile_length); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; +} +#endif /* PNG_READ_iCCP_SUPPORTED */ + +#ifdef PNG_READ_sPLT_SUPPORTED +void /* PRIVATE */ +png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +/* Note: this does not properly handle chunks that are > 64K under DOS */ +{ + png_bytep entry_start; + png_sPLT_t new_palette; +#ifdef PNG_POINTER_INDEXING_SUPPORTED + png_sPLT_entryp pp; +#endif + int data_length, entry_size, i; + png_uint_32 skip = 0; + png_size_t slength; + + png_debug(1, "in png_handle_sPLT"); + +#ifdef PNG_USER_LIMITS_SUPPORTED + + if (png_ptr->user_chunk_cache_max != 0) + { + if (png_ptr->user_chunk_cache_max == 1) + { + png_crc_finish(png_ptr, length); + return; + } + if (--png_ptr->user_chunk_cache_max == 1) + { + png_warning(png_ptr, "No space in chunk cache for sPLT"); + png_crc_finish(png_ptr, length); + return; + } + } +#endif + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before sPLT"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid sPLT after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + +#ifdef PNG_MAX_MALLOC_64K + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "sPLT chunk too large to fit in memory"); + skip = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = (png_charp)png_malloc(png_ptr, length + 1); + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength); + + if (png_crc_finish(png_ptr, skip)) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + + png_ptr->chunkdata[slength] = 0x00; + + for (entry_start = (png_bytep)png_ptr->chunkdata; *entry_start; + entry_start++) + /* Empty loop to find end of name */ ; + ++entry_start; + + /* A sample depth should follow the separator, and we should be on it */ + if (entry_start > (png_bytep)png_ptr->chunkdata + slength - 2) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + png_warning(png_ptr, "malformed sPLT chunk"); + return; + } + + new_palette.depth = *entry_start++; + entry_size = (new_palette.depth == 8 ? 6 : 10); + data_length = (slength - (entry_start - (png_bytep)png_ptr->chunkdata)); + + /* Integrity-check the data length */ + if (data_length % entry_size) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + png_warning(png_ptr, "sPLT chunk has bad length"); + return; + } + + new_palette.nentries = (png_int_32) ( data_length / entry_size); + if ((png_uint_32) new_palette.nentries > + (png_uint_32) (PNG_SIZE_MAX / png_sizeof(png_sPLT_entry))) + { + png_warning(png_ptr, "sPLT chunk too long"); + return; + } + new_palette.entries = (png_sPLT_entryp)png_malloc_warn( + png_ptr, new_palette.nentries * png_sizeof(png_sPLT_entry)); + if (new_palette.entries == NULL) + { + png_warning(png_ptr, "sPLT chunk requires too much memory"); + return; + } + +#ifdef PNG_POINTER_INDEXING_SUPPORTED + for (i = 0; i < new_palette.nentries; i++) + { + pp = new_palette.entries + i; + + if (new_palette.depth == 8) + { + pp->red = *entry_start++; + pp->green = *entry_start++; + pp->blue = *entry_start++; + pp->alpha = *entry_start++; + } + else + { + pp->red = png_get_uint_16(entry_start); entry_start += 2; + pp->green = png_get_uint_16(entry_start); entry_start += 2; + pp->blue = png_get_uint_16(entry_start); entry_start += 2; + pp->alpha = png_get_uint_16(entry_start); entry_start += 2; + } + pp->frequency = png_get_uint_16(entry_start); entry_start += 2; + } +#else + pp = new_palette.entries; + for (i = 0; i < new_palette.nentries; i++) + { + + if (new_palette.depth == 8) + { + pp[i].red = *entry_start++; + pp[i].green = *entry_start++; + pp[i].blue = *entry_start++; + pp[i].alpha = *entry_start++; + } + else + { + pp[i].red = png_get_uint_16(entry_start); entry_start += 2; + pp[i].green = png_get_uint_16(entry_start); entry_start += 2; + pp[i].blue = png_get_uint_16(entry_start); entry_start += 2; + pp[i].alpha = png_get_uint_16(entry_start); entry_start += 2; + } + pp->frequency = png_get_uint_16(entry_start); entry_start += 2; + } +#endif + + /* Discard all chunk data except the name and stash that */ + new_palette.name = png_ptr->chunkdata; + + png_set_sPLT(png_ptr, info_ptr, &new_palette, 1); + + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + png_free(png_ptr, new_palette.entries); +} +#endif /* PNG_READ_sPLT_SUPPORTED */ + +#ifdef PNG_READ_tRNS_SUPPORTED +void /* PRIVATE */ +png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte readbuf[PNG_MAX_PALETTE_LENGTH]; + + png_debug(1, "in png_handle_tRNS"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before tRNS"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid tRNS after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) + { + png_warning(png_ptr, "Duplicate tRNS chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY) + { + png_byte buf[2]; + + if (length != 2) + { + png_warning(png_ptr, "Incorrect tRNS chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 2); + png_ptr->num_trans = 1; + png_ptr->trans_color.gray = png_get_uint_16(buf); + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) + { + png_byte buf[6]; + + if (length != 6) + { + png_warning(png_ptr, "Incorrect tRNS chunk length"); + png_crc_finish(png_ptr, length); + return; + } + png_crc_read(png_ptr, buf, (png_size_t)length); + png_ptr->num_trans = 1; + png_ptr->trans_color.red = png_get_uint_16(buf); + png_ptr->trans_color.green = png_get_uint_16(buf + 2); + png_ptr->trans_color.blue = png_get_uint_16(buf + 4); + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (!(png_ptr->mode & PNG_HAVE_PLTE)) + { + /* Should be an error, but we can cope with it. */ + png_warning(png_ptr, "Missing PLTE before tRNS"); + } + if (length > (png_uint_32)png_ptr->num_palette || + length > PNG_MAX_PALETTE_LENGTH) + { + png_warning(png_ptr, "Incorrect tRNS chunk length"); + png_crc_finish(png_ptr, length); + return; + } + if (length == 0) + { + png_warning(png_ptr, "Zero length tRNS chunk"); + png_crc_finish(png_ptr, length); + return; + } + png_crc_read(png_ptr, readbuf, (png_size_t)length); + png_ptr->num_trans = (png_uint_16)length; + } + else + { + png_warning(png_ptr, "tRNS chunk not allowed with alpha channel"); + png_crc_finish(png_ptr, length); + return; + } + + if (png_crc_finish(png_ptr, 0)) + { + png_ptr->num_trans = 0; + return; + } + + png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans, + &(png_ptr->trans_color)); +} +#endif + +#ifdef PNG_READ_bKGD_SUPPORTED +void /* PRIVATE */ +png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_size_t truelen; + png_byte buf[6]; + + png_debug(1, "in png_handle_bKGD"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before bKGD"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid bKGD after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + !(png_ptr->mode & PNG_HAVE_PLTE)) + { + png_warning(png_ptr, "Missing PLTE before bKGD"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)) + { + png_warning(png_ptr, "Duplicate bKGD chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + truelen = 1; + else if (png_ptr->color_type & PNG_COLOR_MASK_COLOR) + truelen = 6; + else + truelen = 2; + + if (length != truelen) + { + png_warning(png_ptr, "Incorrect bKGD chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, truelen); + if (png_crc_finish(png_ptr, 0)) + return; + + /* We convert the index value into RGB components so that we can allow + * arbitrary RGB values for background when we have transparency, and + * so it is easy to determine the RGB values of the background color + * from the info_ptr struct. */ + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + png_ptr->background.index = buf[0]; + if (info_ptr && info_ptr->num_palette) + { + if (buf[0] >= info_ptr->num_palette) + { + png_warning(png_ptr, "Incorrect bKGD chunk index value"); + return; + } + png_ptr->background.red = + (png_uint_16)png_ptr->palette[buf[0]].red; + png_ptr->background.green = + (png_uint_16)png_ptr->palette[buf[0]].green; + png_ptr->background.blue = + (png_uint_16)png_ptr->palette[buf[0]].blue; + } + } + else if (!(png_ptr->color_type & PNG_COLOR_MASK_COLOR)) /* GRAY */ + { + png_ptr->background.red = + png_ptr->background.green = + png_ptr->background.blue = + png_ptr->background.gray = png_get_uint_16(buf); + } + else + { + png_ptr->background.red = png_get_uint_16(buf); + png_ptr->background.green = png_get_uint_16(buf + 2); + png_ptr->background.blue = png_get_uint_16(buf + 4); + } + + png_set_bKGD(png_ptr, info_ptr, &(png_ptr->background)); +} +#endif + +#ifdef PNG_READ_hIST_SUPPORTED +void /* PRIVATE */ +png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + unsigned int num, i; + png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH]; + + png_debug(1, "in png_handle_hIST"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before hIST"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid hIST after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (!(png_ptr->mode & PNG_HAVE_PLTE)) + { + png_warning(png_ptr, "Missing PLTE before hIST"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)) + { + png_warning(png_ptr, "Duplicate hIST chunk"); + png_crc_finish(png_ptr, length); + return; + } + + num = length / 2 ; + if (num != (unsigned int) png_ptr->num_palette || num > + (unsigned int) PNG_MAX_PALETTE_LENGTH) + { + png_warning(png_ptr, "Incorrect hIST chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + for (i = 0; i < num; i++) + { + png_byte buf[2]; + + png_crc_read(png_ptr, buf, 2); + readbuf[i] = png_get_uint_16(buf); + } + + if (png_crc_finish(png_ptr, 0)) + return; + + png_set_hIST(png_ptr, info_ptr, readbuf); +} +#endif + +#ifdef PNG_READ_pHYs_SUPPORTED +void /* PRIVATE */ +png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte buf[9]; + png_uint_32 res_x, res_y; + int unit_type; + + png_debug(1, "in png_handle_pHYs"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before pHYs"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid pHYs after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) + { + png_warning(png_ptr, "Duplicate pHYs chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (length != 9) + { + png_warning(png_ptr, "Incorrect pHYs chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 9); + if (png_crc_finish(png_ptr, 0)) + return; + + res_x = png_get_uint_32(buf); + res_y = png_get_uint_32(buf + 4); + unit_type = buf[8]; + png_set_pHYs(png_ptr, info_ptr, res_x, res_y, unit_type); +} +#endif + +#ifdef PNG_READ_oFFs_SUPPORTED +void /* PRIVATE */ +png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte buf[9]; + png_int_32 offset_x, offset_y; + int unit_type; + + png_debug(1, "in png_handle_oFFs"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before oFFs"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid oFFs after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) + { + png_warning(png_ptr, "Duplicate oFFs chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (length != 9) + { + png_warning(png_ptr, "Incorrect oFFs chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 9); + if (png_crc_finish(png_ptr, 0)) + return; + + offset_x = png_get_int_32(buf); + offset_y = png_get_int_32(buf + 4); + unit_type = buf[8]; + png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, unit_type); +} +#endif + +#ifdef PNG_READ_pCAL_SUPPORTED +/* Read the pCAL chunk (described in the PNG Extensions document) */ +void /* PRIVATE */ +png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_int_32 X0, X1; + png_byte type, nparams; + png_charp buf, units, endptr; + png_charpp params; + png_size_t slength; + int i; + + png_debug(1, "in png_handle_pCAL"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before pCAL"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid pCAL after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)) + { + png_warning(png_ptr, "Duplicate pCAL chunk"); + png_crc_finish(png_ptr, length); + return; + } + + png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)", + length + 1); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (png_ptr->chunkdata == NULL) + { + png_warning(png_ptr, "No memory for pCAL purpose"); + return; + } + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength); + + if (png_crc_finish(png_ptr, 0)) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + + png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */ + + png_debug(3, "Finding end of pCAL purpose string"); + for (buf = png_ptr->chunkdata; *buf; buf++) + /* Empty loop */ ; + + endptr = png_ptr->chunkdata + slength; + + /* We need to have at least 12 bytes after the purpose string + in order to get the parameter information. */ + if (endptr <= buf + 12) + { + png_warning(png_ptr, "Invalid pCAL data"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + + png_debug(3, "Reading pCAL X0, X1, type, nparams, and units"); + X0 = png_get_int_32((png_bytep)buf+1); + X1 = png_get_int_32((png_bytep)buf+5); + type = buf[9]; + nparams = buf[10]; + units = buf + 11; + + png_debug(3, "Checking pCAL equation type and number of parameters"); + /* Check that we have the right number of parameters for known + equation types. */ + if ((type == PNG_EQUATION_LINEAR && nparams != 2) || + (type == PNG_EQUATION_BASE_E && nparams != 3) || + (type == PNG_EQUATION_ARBITRARY && nparams != 3) || + (type == PNG_EQUATION_HYPERBOLIC && nparams != 4)) + { + png_warning(png_ptr, "Invalid pCAL parameters for equation type"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + else if (type >= PNG_EQUATION_LAST) + { + png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); + } + + for (buf = units; *buf; buf++) + /* Empty loop to move past the units string. */ ; + + png_debug(3, "Allocating pCAL parameters array"); + params = (png_charpp)png_malloc_warn(png_ptr, + (png_size_t)(nparams * png_sizeof(png_charp))); + if (params == NULL) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + png_warning(png_ptr, "No memory for pCAL params"); + return; + } + + /* Get pointers to the start of each parameter string. */ + for (i = 0; i < (int)nparams; i++) + { + buf++; /* Skip the null string terminator from previous parameter. */ + + png_debug1(3, "Reading pCAL parameter %d", i); + for (params[i] = buf; buf <= endptr && *buf != 0x00; buf++) + /* Empty loop to move past each parameter string */ ; + + /* Make sure we haven't run out of data yet */ + if (buf > endptr) + { + png_warning(png_ptr, "Invalid pCAL data"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + png_free(png_ptr, params); + return; + } + } + + png_set_pCAL(png_ptr, info_ptr, png_ptr->chunkdata, X0, X1, type, nparams, + units, params); + + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + png_free(png_ptr, params); +} +#endif + +#ifdef PNG_READ_sCAL_SUPPORTED +/* Read the sCAL chunk */ +void /* PRIVATE */ +png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_charp ep; +#ifdef PNG_FLOATING_POINT_SUPPORTED + double width, height; + png_charp vp; +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + png_charp swidth, sheight; +#endif +#endif + png_size_t slength; + + png_debug(1, "in png_handle_sCAL"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before sCAL"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid sCAL after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL)) + { + png_warning(png_ptr, "Duplicate sCAL chunk"); + png_crc_finish(png_ptr, length); + return; + } + + png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)", + length + 1); + png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (png_ptr->chunkdata == NULL) + { + png_warning(png_ptr, "Out of memory while processing sCAL chunk"); + png_crc_finish(png_ptr, length); + return; + } + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength); + + if (png_crc_finish(png_ptr, 0)) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + + png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */ + + ep = png_ptr->chunkdata + 1; /* Skip unit byte */ + +#ifdef PNG_FLOATING_POINT_SUPPORTED + width = png_strtod(png_ptr, ep, &vp); + if (*vp) + { + png_warning(png_ptr, "malformed width string in sCAL chunk"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + swidth = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1); + if (swidth == NULL) + { + png_warning(png_ptr, "Out of memory while processing sCAL chunk width"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + png_memcpy(swidth, ep, png_strlen(ep)); +#endif +#endif + + for (ep = png_ptr->chunkdata; *ep; ep++) + /* Empty loop */ ; + ep++; + + if (png_ptr->chunkdata + slength < ep) + { + png_warning(png_ptr, "Truncated sCAL chunk"); +#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) + png_free(png_ptr, swidth); +#endif + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + +#ifdef PNG_FLOATING_POINT_SUPPORTED + height = png_strtod(png_ptr, ep, &vp); + if (*vp) + { + png_warning(png_ptr, "malformed height string in sCAL chunk"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; +#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) + png_free(png_ptr, swidth); +#endif + return; + } +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + sheight = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1); + if (sheight == NULL) + { + png_warning(png_ptr, "Out of memory while processing sCAL chunk height"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; +#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) + png_free(png_ptr, swidth); +#endif + return; + } + png_memcpy(sheight, ep, png_strlen(ep)); +#endif +#endif + + if (png_ptr->chunkdata + slength < ep +#ifdef PNG_FLOATING_POINT_SUPPORTED + || width <= 0. || height <= 0. +#endif + ) + { + png_warning(png_ptr, "Invalid sCAL data"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; +#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) + png_free(png_ptr, swidth); + png_free(png_ptr, sheight); +#endif + return; + } + + +#ifdef PNG_FLOATING_POINT_SUPPORTED + png_set_sCAL(png_ptr, info_ptr, png_ptr->chunkdata[0], width, height); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + png_set_sCAL_s(png_ptr, info_ptr, png_ptr->chunkdata[0], swidth, sheight); +#endif +#endif + + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; +#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) + png_free(png_ptr, swidth); + png_free(png_ptr, sheight); +#endif +} +#endif + +#ifdef PNG_READ_tIME_SUPPORTED +void /* PRIVATE */ +png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte buf[7]; + png_time mod_time; + + png_debug(1, "in png_handle_tIME"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Out of place tIME chunk"); + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)) + { + png_warning(png_ptr, "Duplicate tIME chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (png_ptr->mode & PNG_HAVE_IDAT) + png_ptr->mode |= PNG_AFTER_IDAT; + + if (length != 7) + { + png_warning(png_ptr, "Incorrect tIME chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 7); + if (png_crc_finish(png_ptr, 0)) + return; + + mod_time.second = buf[6]; + mod_time.minute = buf[5]; + mod_time.hour = buf[4]; + mod_time.day = buf[3]; + mod_time.month = buf[2]; + mod_time.year = png_get_uint_16(buf); + + png_set_tIME(png_ptr, info_ptr, &mod_time); +} +#endif + +#ifdef PNG_READ_tEXt_SUPPORTED +/* Note: this does not properly handle chunks that are > 64K under DOS */ +void /* PRIVATE */ +png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_textp text_ptr; + png_charp key; + png_charp text; + png_uint_32 skip = 0; + png_size_t slength; + int ret; + + png_debug(1, "in png_handle_tEXt"); + +#ifdef PNG_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_cache_max != 0) + { + if (png_ptr->user_chunk_cache_max == 1) + { + png_crc_finish(png_ptr, length); + return; + } + if (--png_ptr->user_chunk_cache_max == 1) + { + png_warning(png_ptr, "No space in chunk cache for tEXt"); + png_crc_finish(png_ptr, length); + return; + } + } +#endif + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before tEXt"); + + if (png_ptr->mode & PNG_HAVE_IDAT) + png_ptr->mode |= PNG_AFTER_IDAT; + +#ifdef PNG_MAX_MALLOC_64K + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "tEXt chunk too large to fit in memory"); + skip = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + png_free(png_ptr, png_ptr->chunkdata); + + png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (png_ptr->chunkdata == NULL) + { + png_warning(png_ptr, "No memory to process text chunk"); + return; + } + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength); + + if (png_crc_finish(png_ptr, skip)) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + + key = png_ptr->chunkdata; + + key[slength] = 0x00; + + for (text = key; *text; text++) + /* Empty loop to find end of key */ ; + + if (text != key + slength) + text++; + + text_ptr = (png_textp)png_malloc_warn(png_ptr, + png_sizeof(png_text)); + if (text_ptr == NULL) + { + png_warning(png_ptr, "Not enough memory to process text chunk"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr->key = key; +#ifdef PNG_iTXt_SUPPORTED + text_ptr->lang = NULL; + text_ptr->lang_key = NULL; + text_ptr->itxt_length = 0; +#endif + text_ptr->text = text; + text_ptr->text_length = png_strlen(text); + + ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + png_free(png_ptr, text_ptr); + if (ret) + png_warning(png_ptr, "Insufficient memory to process text chunk"); +} +#endif + +#ifdef PNG_READ_zTXt_SUPPORTED +/* Note: this does not correctly handle chunks that are > 64K under DOS */ +void /* PRIVATE */ +png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_textp text_ptr; + png_charp text; + int comp_type; + int ret; + png_size_t slength, prefix_len, data_len; + + png_debug(1, "in png_handle_zTXt"); + +#ifdef PNG_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_cache_max != 0) + { + if (png_ptr->user_chunk_cache_max == 1) + { + png_crc_finish(png_ptr, length); + return; + } + if (--png_ptr->user_chunk_cache_max == 1) + { + png_warning(png_ptr, "No space in chunk cache for zTXt"); + png_crc_finish(png_ptr, length); + return; + } + } +#endif + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before zTXt"); + + if (png_ptr->mode & PNG_HAVE_IDAT) + png_ptr->mode |= PNG_AFTER_IDAT; + +#ifdef PNG_MAX_MALLOC_64K + /* We will no doubt have problems with chunks even half this size, but + there is no hard and fast rule to tell us where to stop. */ + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "zTXt chunk too large to fit in memory"); + png_crc_finish(png_ptr, length); + return; + } +#endif + + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (png_ptr->chunkdata == NULL) + { + png_warning(png_ptr, "Out of memory processing zTXt chunk"); + return; + } + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength); + if (png_crc_finish(png_ptr, 0)) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + + png_ptr->chunkdata[slength] = 0x00; + + for (text = png_ptr->chunkdata; *text; text++) + /* Empty loop */ ; + + /* zTXt must have some text after the chunkdataword */ + if (text >= png_ptr->chunkdata + slength - 2) + { + png_warning(png_ptr, "Truncated zTXt chunk"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + else + { + comp_type = *(++text); + if (comp_type != PNG_TEXT_COMPRESSION_zTXt) + { + png_warning(png_ptr, "Unknown compression type in zTXt chunk"); + comp_type = PNG_TEXT_COMPRESSION_zTXt; + } + text++; /* Skip the compression_method byte */ + } + prefix_len = text - png_ptr->chunkdata; + + png_decompress_chunk(png_ptr, comp_type, + (png_size_t)length, prefix_len, &data_len); + + text_ptr = (png_textp)png_malloc_warn(png_ptr, + png_sizeof(png_text)); + if (text_ptr == NULL) + { + png_warning(png_ptr, "Not enough memory to process zTXt chunk"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + text_ptr->compression = comp_type; + text_ptr->key = png_ptr->chunkdata; +#ifdef PNG_iTXt_SUPPORTED + text_ptr->lang = NULL; + text_ptr->lang_key = NULL; + text_ptr->itxt_length = 0; +#endif + text_ptr->text = png_ptr->chunkdata + prefix_len; + text_ptr->text_length = data_len; + + ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_free(png_ptr, text_ptr); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + if (ret) + png_error(png_ptr, "Insufficient memory to store zTXt chunk"); +} +#endif + +#ifdef PNG_READ_iTXt_SUPPORTED +/* Note: this does not correctly handle chunks that are > 64K under DOS */ +void /* PRIVATE */ +png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_textp text_ptr; + png_charp key, lang, text, lang_key; + int comp_flag; + int comp_type = 0; + int ret; + png_size_t slength, prefix_len, data_len; + + png_debug(1, "in png_handle_iTXt"); + +#ifdef PNG_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_cache_max != 0) + { + if (png_ptr->user_chunk_cache_max == 1) + { + png_crc_finish(png_ptr, length); + return; + } + if (--png_ptr->user_chunk_cache_max == 1) + { + png_warning(png_ptr, "No space in chunk cache for iTXt"); + png_crc_finish(png_ptr, length); + return; + } + } +#endif + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before iTXt"); + + if (png_ptr->mode & PNG_HAVE_IDAT) + png_ptr->mode |= PNG_AFTER_IDAT; + +#ifdef PNG_MAX_MALLOC_64K + /* We will no doubt have problems with chunks even half this size, but + there is no hard and fast rule to tell us where to stop. */ + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "iTXt chunk too large to fit in memory"); + png_crc_finish(png_ptr, length); + return; + } +#endif + + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (png_ptr->chunkdata == NULL) + { + png_warning(png_ptr, "No memory to process iTXt chunk"); + return; + } + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength); + if (png_crc_finish(png_ptr, 0)) + { + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + + png_ptr->chunkdata[slength] = 0x00; + + for (lang = png_ptr->chunkdata; *lang; lang++) + /* Empty loop */ ; + lang++; /* Skip NUL separator */ + + /* iTXt must have a language tag (possibly empty), two compression bytes, + * translated keyword (possibly empty), and possibly some text after the + * keyword + */ + + if (lang >= png_ptr->chunkdata + slength - 3) + { + png_warning(png_ptr, "Truncated iTXt chunk"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + else + { + comp_flag = *lang++; + comp_type = *lang++; + } + + for (lang_key = lang; *lang_key; lang_key++) + /* Empty loop */ ; + lang_key++; /* Skip NUL separator */ + + if (lang_key >= png_ptr->chunkdata + slength) + { + png_warning(png_ptr, "Truncated iTXt chunk"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + + for (text = lang_key; *text; text++) + /* Empty loop */ ; + text++; /* Skip NUL separator */ + if (text >= png_ptr->chunkdata + slength) + { + png_warning(png_ptr, "Malformed iTXt chunk"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + + prefix_len = text - png_ptr->chunkdata; + + key=png_ptr->chunkdata; + if (comp_flag) + png_decompress_chunk(png_ptr, comp_type, + (size_t)length, prefix_len, &data_len); + else + data_len = png_strlen(png_ptr->chunkdata + prefix_len); + text_ptr = (png_textp)png_malloc_warn(png_ptr, + png_sizeof(png_text)); + if (text_ptr == NULL) + { + png_warning(png_ptr, "Not enough memory to process iTXt chunk"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; + } + text_ptr->compression = (int)comp_flag + 1; + text_ptr->lang_key = png_ptr->chunkdata + (lang_key - key); + text_ptr->lang = png_ptr->chunkdata + (lang - key); + text_ptr->itxt_length = data_len; + text_ptr->text_length = 0; + text_ptr->key = png_ptr->chunkdata; + text_ptr->text = png_ptr->chunkdata + prefix_len; + + ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_free(png_ptr, text_ptr); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + if (ret) + png_error(png_ptr, "Insufficient memory to store iTXt chunk"); +} +#endif + +/* This function is called when we haven't found a handler for a + chunk. If there isn't a problem with the chunk itself (ie bad + chunk name, CRC, or a critical chunk), the chunk is silently ignored + -- unless the PNG_FLAG_UNKNOWN_CHUNKS_SUPPORTED flag is on in which + case it will be saved away to be written out later. */ +void /* PRIVATE */ +png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_uint_32 skip = 0; + + png_debug(1, "in png_handle_unknown"); + +#ifdef PNG_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_cache_max != 0) + { + if (png_ptr->user_chunk_cache_max == 1) + { + png_crc_finish(png_ptr, length); + return; + } + if (--png_ptr->user_chunk_cache_max == 1) + { + png_warning(png_ptr, "No space in chunk cache for unknown chunk"); + png_crc_finish(png_ptr, length); + return; + } + } +#endif + + if (png_ptr->mode & PNG_HAVE_IDAT) + { + PNG_IDAT; + if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* Not an IDAT */ + png_ptr->mode |= PNG_AFTER_IDAT; + } + + if (!(png_ptr->chunk_name[0] & 0x20)) + { +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != + PNG_HANDLE_CHUNK_ALWAYS +#ifdef PNG_READ_USER_CHUNKS_SUPPORTED + && png_ptr->read_user_chunk_fn == NULL +#endif + ) +#endif + png_chunk_error(png_ptr, "unknown critical chunk"); + } + +#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED + if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) +#ifdef PNG_READ_USER_CHUNKS_SUPPORTED + || (png_ptr->read_user_chunk_fn != NULL) +#endif + ) + { +#ifdef PNG_MAX_MALLOC_64K + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "unknown chunk too large to fit in memory"); + skip = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + png_memcpy((png_charp)png_ptr->unknown_chunk.name, + (png_charp)png_ptr->chunk_name, + png_sizeof(png_ptr->unknown_chunk.name)); + png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1] + = '\0'; + png_ptr->unknown_chunk.size = (png_size_t)length; + if (length == 0) + png_ptr->unknown_chunk.data = NULL; + else + { + png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); + png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); + } +#ifdef PNG_READ_USER_CHUNKS_SUPPORTED + if (png_ptr->read_user_chunk_fn != NULL) + { + /* Callback to user unknown chunk handler */ + int ret; + ret = (*(png_ptr->read_user_chunk_fn)) + (png_ptr, &png_ptr->unknown_chunk); + if (ret < 0) + png_chunk_error(png_ptr, "error in user chunk"); + if (ret == 0) + { + if (!(png_ptr->chunk_name[0] & 0x20)) +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != + PNG_HANDLE_CHUNK_ALWAYS) +#endif + png_chunk_error(png_ptr, "unknown critical chunk"); + png_set_unknown_chunks(png_ptr, info_ptr, + &png_ptr->unknown_chunk, 1); + } + } + else +#endif + png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); + png_free(png_ptr, png_ptr->unknown_chunk.data); + png_ptr->unknown_chunk.data = NULL; + } + else +#endif + skip = length; + + png_crc_finish(png_ptr, skip); + +#ifndef PNG_READ_USER_CHUNKS_SUPPORTED + info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */ +#endif +} + +/* This function is called to verify that a chunk name is valid. + This function can't have the "critical chunk check" incorporated + into it, since in the future we will need to be able to call user + functions to handle unknown critical chunks after we check that + the chunk name itself is valid. */ + +#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) + +void /* PRIVATE */ +png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name) +{ + png_debug(1, "in png_check_chunk_name"); + if (isnonalpha(chunk_name[0]) || isnonalpha(chunk_name[1]) || + isnonalpha(chunk_name[2]) || isnonalpha(chunk_name[3])) + { + png_chunk_error(png_ptr, "invalid chunk type"); + } +} + +/* Combines the row recently read in with the existing pixels in the + row. This routine takes care of alpha and transparency if requested. + This routine also handles the two methods of progressive display + of interlaced images, depending on the mask value. + The mask value describes which pixels are to be combined with + the row. The pattern always repeats every 8 pixels, so just 8 + bits are needed. A one indicates the pixel is to be combined, + a zero indicates the pixel is to be skipped. This is in addition + to any alpha or transparency value associated with the pixel. If + you want all pixels to be combined, pass 0xff (255) in mask. */ + +void /* PRIVATE */ +png_combine_row(png_structp png_ptr, png_bytep row, int mask) +{ + png_debug(1, "in png_combine_row"); + if (mask == 0xff) + { + png_memcpy(row, png_ptr->row_buf + 1, + PNG_ROWBYTES(png_ptr->row_info.pixel_depth, png_ptr->width)); + } + else + { + switch (png_ptr->row_info.pixel_depth) + { + case 1: + { + png_bytep sp = png_ptr->row_buf + 1; + png_bytep dp = row; + int s_inc, s_start, s_end; + int m = 0x80; + int shift; + png_uint_32 i; + png_uint_32 row_width = png_ptr->width; + +#ifdef PNG_READ_PACKSWAP_SUPPORTED + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 7; + s_inc = 1; + } + else +#endif + { + s_start = 7; + s_end = 0; + s_inc = -1; + } + + shift = s_start; + + for (i = 0; i < row_width; i++) + { + if (m & mask) + { + int value; + + value = (*sp >> shift) & 0x01; + *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + case 2: + { + png_bytep sp = png_ptr->row_buf + 1; + png_bytep dp = row; + int s_start, s_end, s_inc; + int m = 0x80; + int shift; + png_uint_32 i; + png_uint_32 row_width = png_ptr->width; + int value; + +#ifdef PNG_READ_PACKSWAP_SUPPORTED + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 6; + s_inc = 2; + } + else +#endif + { + s_start = 6; + s_end = 0; + s_inc = -2; + } + + shift = s_start; + + for (i = 0; i < row_width; i++) + { + if (m & mask) + { + value = (*sp >> shift) & 0x03; + *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + case 4: + { + png_bytep sp = png_ptr->row_buf + 1; + png_bytep dp = row; + int s_start, s_end, s_inc; + int m = 0x80; + int shift; + png_uint_32 i; + png_uint_32 row_width = png_ptr->width; + int value; + +#ifdef PNG_READ_PACKSWAP_SUPPORTED + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 4; + s_inc = 4; + } + else +#endif + { + s_start = 4; + s_end = 0; + s_inc = -4; + } + shift = s_start; + + for (i = 0; i < row_width; i++) + { + if (m & mask) + { + value = (*sp >> shift) & 0xf; + *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + default: + { + png_bytep sp = png_ptr->row_buf + 1; + png_bytep dp = row; + png_size_t pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); + png_uint_32 i; + png_uint_32 row_width = png_ptr->width; + png_byte m = 0x80; + + + for (i = 0; i < row_width; i++) + { + if (m & mask) + { + png_memcpy(dp, sp, pixel_bytes); + } + + sp += pixel_bytes; + dp += pixel_bytes; + + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + } + } +} + +#ifdef PNG_READ_INTERLACING_SUPPORTED +/* OLD pre-1.0.9 interface: +void png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, + png_uint_32 transformations) + */ +void /* PRIVATE */ +png_do_read_interlace(png_structp png_ptr) +{ + png_row_infop row_info = &(png_ptr->row_info); + png_bytep row = png_ptr->row_buf + 1; + int pass = png_ptr->pass; + png_uint_32 transformations = png_ptr->transformations; + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + /* Offset to next interlace block */ + PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + png_debug(1, "in png_do_read_interlace"); + if (row != NULL && row_info != NULL) + { + png_uint_32 final_width; + + final_width = row_info->width * png_pass_inc[pass]; + + switch (row_info->pixel_depth) + { + case 1: + { + png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3); + png_bytep dp = row + (png_size_t)((final_width - 1) >> 3); + int sshift, dshift; + int s_start, s_end, s_inc; + int jstop = png_pass_inc[pass]; + png_byte v; + png_uint_32 i; + int j; + +#ifdef PNG_READ_PACKSWAP_SUPPORTED + if (transformations & PNG_PACKSWAP) + { + sshift = (int)((row_info->width + 7) & 0x07); + dshift = (int)((final_width + 7) & 0x07); + s_start = 7; + s_end = 0; + s_inc = -1; + } + else +#endif + { + sshift = 7 - (int)((row_info->width + 7) & 0x07); + dshift = 7 - (int)((final_width + 7) & 0x07); + s_start = 0; + s_end = 7; + s_inc = 1; + } + + for (i = 0; i < row_info->width; i++) + { + v = (png_byte)((*sp >> sshift) & 0x01); + for (j = 0; j < jstop; j++) + { + *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + case 2: + { + png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2); + png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2); + int sshift, dshift; + int s_start, s_end, s_inc; + int jstop = png_pass_inc[pass]; + png_uint_32 i; + +#ifdef PNG_READ_PACKSWAP_SUPPORTED + if (transformations & PNG_PACKSWAP) + { + sshift = (int)(((row_info->width + 3) & 0x03) << 1); + dshift = (int)(((final_width + 3) & 0x03) << 1); + s_start = 6; + s_end = 0; + s_inc = -2; + } + else +#endif + { + sshift = (int)((3 - ((row_info->width + 3) & 0x03)) << 1); + dshift = (int)((3 - ((final_width + 3) & 0x03)) << 1); + s_start = 0; + s_end = 6; + s_inc = 2; + } + + for (i = 0; i < row_info->width; i++) + { + png_byte v; + int j; + + v = (png_byte)((*sp >> sshift) & 0x03); + for (j = 0; j < jstop; j++) + { + *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + case 4: + { + png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1); + png_bytep dp = row + (png_size_t)((final_width - 1) >> 1); + int sshift, dshift; + int s_start, s_end, s_inc; + png_uint_32 i; + int jstop = png_pass_inc[pass]; + +#ifdef PNG_READ_PACKSWAP_SUPPORTED + if (transformations & PNG_PACKSWAP) + { + sshift = (int)(((row_info->width + 1) & 0x01) << 2); + dshift = (int)(((final_width + 1) & 0x01) << 2); + s_start = 4; + s_end = 0; + s_inc = -4; + } + else +#endif + { + sshift = (int)((1 - ((row_info->width + 1) & 0x01)) << 2); + dshift = (int)((1 - ((final_width + 1) & 0x01)) << 2); + s_start = 0; + s_end = 4; + s_inc = 4; + } + + for (i = 0; i < row_info->width; i++) + { + png_byte v = (png_byte)((*sp >> sshift) & 0xf); + int j; + + for (j = 0; j < jstop; j++) + { + *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + default: + { + png_size_t pixel_bytes = (row_info->pixel_depth >> 3); + png_bytep sp = row + (png_size_t)(row_info->width - 1) + * pixel_bytes; + png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes; + + int jstop = png_pass_inc[pass]; + png_uint_32 i; + + for (i = 0; i < row_info->width; i++) + { + png_byte v[8]; + int j; + + png_memcpy(v, sp, pixel_bytes); + for (j = 0; j < jstop; j++) + { + png_memcpy(dp, v, pixel_bytes); + dp -= pixel_bytes; + } + sp -= pixel_bytes; + } + break; + } + } + row_info->width = final_width; + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width); + } +#ifndef PNG_READ_PACKSWAP_SUPPORTED + transformations = transformations; /* Silence compiler warning */ +#endif +} +#endif /* PNG_READ_INTERLACING_SUPPORTED */ + +void /* PRIVATE */ +png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row, + png_bytep prev_row, int filter) +{ + png_debug(1, "in png_read_filter_row"); + png_debug2(2, "row = %lu, filter = %d", png_ptr->row_number, filter); + switch (filter) + { + case PNG_FILTER_VALUE_NONE: + break; + case PNG_FILTER_VALUE_SUB: + { + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_bytep rp = row + bpp; + png_bytep lp = row; + + for (i = bpp; i < istop; i++) + { + *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff); + rp++; + } + break; + } + case PNG_FILTER_VALUE_UP: + { + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + png_bytep rp = row; + png_bytep pp = prev_row; + + for (i = 0; i < istop; i++) + { + *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); + rp++; + } + break; + } + case PNG_FILTER_VALUE_AVG: + { + png_uint_32 i; + png_bytep rp = row; + png_bytep pp = prev_row; + png_bytep lp = row; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_uint_32 istop = row_info->rowbytes - bpp; + + for (i = 0; i < bpp; i++) + { + *rp = (png_byte)(((int)(*rp) + + ((int)(*pp++) / 2 )) & 0xff); + rp++; + } + + for (i = 0; i < istop; i++) + { + *rp = (png_byte)(((int)(*rp) + + (int)(*pp++ + *lp++) / 2 ) & 0xff); + rp++; + } + break; + } + case PNG_FILTER_VALUE_PAETH: + { + png_uint_32 i; + png_bytep rp = row; + png_bytep pp = prev_row; + png_bytep lp = row; + png_bytep cp = prev_row; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_uint_32 istop=row_info->rowbytes - bpp; + + for (i = 0; i < bpp; i++) + { + *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); + rp++; + } + + for (i = 0; i < istop; i++) /* Use leftover rp,pp */ + { + int a, b, c, pa, pb, pc, p; + + a = *lp++; + b = *pp++; + c = *cp++; + + p = b - c; + pc = a - c; + +#ifdef PNG_USE_ABS + pa = abs(p); + pb = abs(pc); + pc = abs(p + pc); +#else + pa = p < 0 ? -p : p; + pb = pc < 0 ? -pc : pc; + pc = (p + pc) < 0 ? -(p + pc) : p + pc; +#endif + + /* + if (pa <= pb && pa <= pc) + p = a; + else if (pb <= pc) + p = b; + else + p = c; + */ + + p = (pa <= pb && pa <= pc) ? a : (pb <= pc) ? b : c; + + *rp = (png_byte)(((int)(*rp) + p) & 0xff); + rp++; + } + break; + } + default: + png_warning(png_ptr, "Ignoring bad adaptive filter type"); + *row = 0; + break; + } +} + +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED +void /* PRIVATE */ +png_read_finish_row(png_structp png_ptr) +{ +#ifdef PNG_READ_INTERLACING_SUPPORTED + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* Start of interlace block */ + PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* Offset to next interlace block */ + PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* Start of interlace block in the y direction */ + PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* Offset to next interlace block in the y direction */ + PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; +#endif /* PNG_READ_INTERLACING_SUPPORTED */ + + png_debug(1, "in png_read_finish_row"); + png_ptr->row_number++; + if (png_ptr->row_number < png_ptr->num_rows) + return; + +#ifdef PNG_READ_INTERLACING_SUPPORTED + if (png_ptr->interlaced) + { + png_ptr->row_number = 0; + png_memset(png_ptr->prev_row, 0, + png_ptr->rowbytes + 1); + do + { + png_ptr->pass++; + if (png_ptr->pass >= 7) + break; + png_ptr->iwidth = (png_ptr->width + + png_pass_inc[png_ptr->pass] - 1 - + png_pass_start[png_ptr->pass]) / + png_pass_inc[png_ptr->pass]; + + if (!(png_ptr->transformations & PNG_INTERLACE)) + { + png_ptr->num_rows = (png_ptr->height + + png_pass_yinc[png_ptr->pass] - 1 - + png_pass_ystart[png_ptr->pass]) / + png_pass_yinc[png_ptr->pass]; + if (!(png_ptr->num_rows)) + continue; + } + else /* if (png_ptr->transformations & PNG_INTERLACE) */ + break; + } while (png_ptr->iwidth == 0); + + if (png_ptr->pass < 7) + return; + } +#endif /* PNG_READ_INTERLACING_SUPPORTED */ + + if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) + { + PNG_IDAT; + char extra; + int ret; + + png_ptr->zstream.next_out = (Byte *)&extra; + png_ptr->zstream.avail_out = (uInt)1; + for (;;) + { + if (!(png_ptr->zstream.avail_in)) + { + while (!png_ptr->idat_size) + { + png_byte chunk_length[4]; + + png_crc_finish(png_ptr, 0); + + png_read_data(png_ptr, chunk_length, 4); + png_ptr->idat_size = png_get_uint_31(png_ptr, chunk_length); + png_reset_crc(png_ptr); + png_crc_read(png_ptr, png_ptr->chunk_name, 4); + if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + png_error(png_ptr, "Not enough image data"); + + } + png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_in = png_ptr->zbuf; + if (png_ptr->zbuf_size > png_ptr->idat_size) + png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size; + png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zstream.avail_in); + png_ptr->idat_size -= png_ptr->zstream.avail_in; + } + ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); + if (ret == Z_STREAM_END) + { + if (!(png_ptr->zstream.avail_out) || png_ptr->zstream.avail_in || + png_ptr->idat_size) + png_warning(png_ptr, "Extra compressed data"); + png_ptr->mode |= PNG_AFTER_IDAT; + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + break; + } + if (ret != Z_OK) + png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : + "Decompression Error"); + + if (!(png_ptr->zstream.avail_out)) + { + png_warning(png_ptr, "Extra compressed data"); + png_ptr->mode |= PNG_AFTER_IDAT; + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + break; + } + + } + png_ptr->zstream.avail_out = 0; + } + + if (png_ptr->idat_size || png_ptr->zstream.avail_in) + png_warning(png_ptr, "Extra compression data"); + + inflateReset(&png_ptr->zstream); + + png_ptr->mode |= PNG_AFTER_IDAT; +} +#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ + +void /* PRIVATE */ +png_read_start_row(png_structp png_ptr) +{ +#ifdef PNG_READ_INTERLACING_SUPPORTED + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* Start of interlace block */ + PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* Offset to next interlace block */ + PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* Start of interlace block in the y direction */ + PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* Offset to next interlace block in the y direction */ + PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; +#endif + + int max_pixel_depth; + png_size_t row_bytes; + + png_debug(1, "in png_read_start_row"); + png_ptr->zstream.avail_in = 0; + png_init_read_transformations(png_ptr); +#ifdef PNG_READ_INTERLACING_SUPPORTED + if (png_ptr->interlaced) + { + if (!(png_ptr->transformations & PNG_INTERLACE)) + png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 - + png_pass_ystart[0]) / png_pass_yinc[0]; + else + png_ptr->num_rows = png_ptr->height; + + png_ptr->iwidth = (png_ptr->width + + png_pass_inc[png_ptr->pass] - 1 - + png_pass_start[png_ptr->pass]) / + png_pass_inc[png_ptr->pass]; + } + else +#endif /* PNG_READ_INTERLACING_SUPPORTED */ + { + png_ptr->num_rows = png_ptr->height; + png_ptr->iwidth = png_ptr->width; + } + max_pixel_depth = png_ptr->pixel_depth; + +#ifdef PNG_READ_PACK_SUPPORTED + if ((png_ptr->transformations & PNG_PACK) && png_ptr->bit_depth < 8) + max_pixel_depth = 8; +#endif + +#ifdef PNG_READ_EXPAND_SUPPORTED + if (png_ptr->transformations & PNG_EXPAND) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (png_ptr->num_trans) + max_pixel_depth = 32; + else + max_pixel_depth = 24; + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY) + { + if (max_pixel_depth < 8) + max_pixel_depth = 8; + if (png_ptr->num_trans) + max_pixel_depth *= 2; + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) + { + if (png_ptr->num_trans) + { + max_pixel_depth *= 4; + max_pixel_depth /= 3; + } + } + } +#endif + +#ifdef PNG_READ_FILLER_SUPPORTED + if (png_ptr->transformations & (PNG_FILLER)) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + max_pixel_depth = 32; + else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY) + { + if (max_pixel_depth <= 8) + max_pixel_depth = 16; + else + max_pixel_depth = 32; + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) + { + if (max_pixel_depth <= 32) + max_pixel_depth = 32; + else + max_pixel_depth = 64; + } + } +#endif + +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED + if (png_ptr->transformations & PNG_GRAY_TO_RGB) + { + if ( +#ifdef PNG_READ_EXPAND_SUPPORTED + (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND)) || +#endif +#ifdef PNG_READ_FILLER_SUPPORTED + (png_ptr->transformations & (PNG_FILLER)) || +#endif + png_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + { + if (max_pixel_depth <= 16) + max_pixel_depth = 32; + else + max_pixel_depth = 64; + } + else + { + if (max_pixel_depth <= 8) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + max_pixel_depth = 32; + else + max_pixel_depth = 24; + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + max_pixel_depth = 64; + else + max_pixel_depth = 48; + } + } +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) && \ +defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) + if (png_ptr->transformations & PNG_USER_TRANSFORM) + { + int user_pixel_depth = png_ptr->user_transform_depth* + png_ptr->user_transform_channels; + if (user_pixel_depth > max_pixel_depth) + max_pixel_depth=user_pixel_depth; + } +#endif + + /* Align the width on the next larger 8 pixels. Mainly used + * for interlacing + */ + row_bytes = ((png_ptr->width + 7) & ~((png_uint_32)7)); + /* Calculate the maximum bytes needed, adding a byte and a pixel + * for safety's sake + */ + row_bytes = PNG_ROWBYTES(max_pixel_depth, row_bytes) + + 1 + ((max_pixel_depth + 7) >> 3); +#ifdef PNG_MAX_MALLOC_64K + if (row_bytes > (png_uint_32)65536L) + png_error(png_ptr, "This image requires a row greater than 64KB"); +#endif + + if (row_bytes + 48 > png_ptr->old_big_row_buf_size) + { + png_free(png_ptr, png_ptr->big_row_buf); + if (png_ptr->interlaced) + png_ptr->big_row_buf = (png_bytep)png_calloc(png_ptr, + row_bytes + 48); + else + png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, + row_bytes + 48); + png_ptr->old_big_row_buf_size = row_bytes + 48; + +#ifdef PNG_ALIGNED_MEMORY_SUPPORTED + /* Use 16-byte aligned memory for row_buf with at least 16 bytes + * of padding before and after row_buf. + */ + png_ptr->row_buf = png_ptr->big_row_buf + 32 + - (((png_alloc_size_t)&(png_ptr->big_row_buf[0]) + 15) % 16); + png_ptr->old_big_row_buf_size = row_bytes + 48; +#else + /* Use 32 bytes of padding before and 16 bytes after row_buf. */ + png_ptr->row_buf = png_ptr->big_row_buf + 32; +#endif + png_ptr->old_big_row_buf_size = row_bytes + 48; + } + +#ifdef PNG_MAX_MALLOC_64K + if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L) + png_error(png_ptr, "This image requires a row greater than 64KB"); +#endif + if ((png_uint_32)png_ptr->rowbytes > (png_uint_32)(PNG_SIZE_MAX - 1)) + png_error(png_ptr, "Row has too many bytes to allocate in memory"); + + if (png_ptr->rowbytes + 1 > png_ptr->old_prev_row_size) + { + png_free(png_ptr, png_ptr->prev_row); + png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)( + png_ptr->rowbytes + 1)); + png_ptr->old_prev_row_size = png_ptr->rowbytes + 1; + } + + png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1); + + png_debug1(3, "width = %lu,", png_ptr->width); + png_debug1(3, "height = %lu,", png_ptr->height); + png_debug1(3, "iwidth = %lu,", png_ptr->iwidth); + png_debug1(3, "num_rows = %lu,", png_ptr->num_rows); + png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes); + png_debug1(3, "irowbytes = %lu", + PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1); + + png_ptr->flags |= PNG_FLAG_ROW_INIT; +} +#endif /* PNG_READ_SUPPORTED */ diff --git a/png/pngset.c b/png/pngset.c new file mode 100644 index 0000000..1f972c4 --- /dev/null +++ b/png/pngset.c @@ -0,0 +1,1167 @@ + +/* pngset.c - storage of image information into info struct + * + * Last changed in libpng 1.4.1 [February 25, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + * The functions here are used during reads to store data from the file + * into the info struct, and during writes to store application data + * into the info struct for writing into the file. This abstracts the + * info struct and allows us to change the structure in the future. + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) +#include "pngpriv.h" + +#ifdef PNG_bKGD_SUPPORTED +void PNGAPI +png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background) +{ + png_debug1(1, "in %s storage function", "bKGD"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + png_memcpy(&(info_ptr->background), background, png_sizeof(png_color_16)); + info_ptr->valid |= PNG_INFO_bKGD; +} +#endif + +#ifdef PNG_cHRM_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +void PNGAPI +png_set_cHRM(png_structp png_ptr, png_infop info_ptr, + double white_x, double white_y, double red_x, double red_y, + double green_x, double green_y, double blue_x, double blue_y) +{ + png_debug1(1, "in %s storage function", "cHRM"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->x_white = (float)white_x; + info_ptr->y_white = (float)white_y; + info_ptr->x_red = (float)red_x; + info_ptr->y_red = (float)red_y; + info_ptr->x_green = (float)green_x; + info_ptr->y_green = (float)green_y; + info_ptr->x_blue = (float)blue_x; + info_ptr->y_blue = (float)blue_y; +#ifdef PNG_FIXED_POINT_SUPPORTED + info_ptr->int_x_white = (png_fixed_point)(white_x*100000.+0.5); + info_ptr->int_y_white = (png_fixed_point)(white_y*100000.+0.5); + info_ptr->int_x_red = (png_fixed_point)( red_x*100000.+0.5); + info_ptr->int_y_red = (png_fixed_point)( red_y*100000.+0.5); + info_ptr->int_x_green = (png_fixed_point)(green_x*100000.+0.5); + info_ptr->int_y_green = (png_fixed_point)(green_y*100000.+0.5); + info_ptr->int_x_blue = (png_fixed_point)( blue_x*100000.+0.5); + info_ptr->int_y_blue = (png_fixed_point)( blue_y*100000.+0.5); +#endif + info_ptr->valid |= PNG_INFO_cHRM; +} +#endif /* PNG_FLOATING_POINT_SUPPORTED */ + +#ifdef PNG_FIXED_POINT_SUPPORTED +void PNGAPI +png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, + png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x, + png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, + png_fixed_point blue_x, png_fixed_point blue_y) +{ + png_debug1(1, "in %s storage function", "cHRM fixed"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + +#ifdef PNG_CHECK_cHRM_SUPPORTED + if (png_check_cHRM_fixed(png_ptr, + white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y)) +#endif + { + info_ptr->int_x_white = white_x; + info_ptr->int_y_white = white_y; + info_ptr->int_x_red = red_x; + info_ptr->int_y_red = red_y; + info_ptr->int_x_green = green_x; + info_ptr->int_y_green = green_y; + info_ptr->int_x_blue = blue_x; + info_ptr->int_y_blue = blue_y; +#ifdef PNG_FLOATING_POINT_SUPPORTED + info_ptr->x_white = (float)(white_x/100000.); + info_ptr->y_white = (float)(white_y/100000.); + info_ptr->x_red = (float)( red_x/100000.); + info_ptr->y_red = (float)( red_y/100000.); + info_ptr->x_green = (float)(green_x/100000.); + info_ptr->y_green = (float)(green_y/100000.); + info_ptr->x_blue = (float)( blue_x/100000.); + info_ptr->y_blue = (float)( blue_y/100000.); +#endif + info_ptr->valid |= PNG_INFO_cHRM; + } +} +#endif /* PNG_FIXED_POINT_SUPPORTED */ +#endif /* PNG_cHRM_SUPPORTED */ + +#ifdef PNG_gAMA_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED +void PNGAPI +png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) +{ + double png_gamma; + + png_debug1(1, "in %s storage function", "gAMA"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + /* Check for overflow */ + if (file_gamma > 21474.83) + { + png_warning(png_ptr, "Limiting gamma to 21474.83"); + png_gamma=21474.83; + } + else + png_gamma = file_gamma; + info_ptr->gamma = (float)png_gamma; +#ifdef PNG_FIXED_POINT_SUPPORTED + info_ptr->int_gamma = (int)(png_gamma*100000.+.5); +#endif + info_ptr->valid |= PNG_INFO_gAMA; + if (png_gamma == 0.0) + png_warning(png_ptr, "Setting gamma=0"); +} +#endif +void PNGAPI +png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point + int_gamma) +{ + png_fixed_point png_gamma; + + png_debug1(1, "in %s storage function", "gAMA"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (int_gamma > (png_fixed_point)PNG_UINT_31_MAX) + { + png_warning(png_ptr, "Limiting gamma to 21474.83"); + png_gamma=PNG_UINT_31_MAX; + } + else + { + if (int_gamma < 0) + { + png_warning(png_ptr, "Setting negative gamma to zero"); + png_gamma = 0; + } + else + png_gamma = int_gamma; + } +#ifdef PNG_FLOATING_POINT_SUPPORTED + info_ptr->gamma = (float)(png_gamma/100000.); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + info_ptr->int_gamma = png_gamma; +#endif + info_ptr->valid |= PNG_INFO_gAMA; + if (png_gamma == 0) + png_warning(png_ptr, "Setting gamma=0"); +} +#endif + +#ifdef PNG_hIST_SUPPORTED +void PNGAPI +png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist) +{ + int i; + + png_debug1(1, "in %s storage function", "hIST"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (info_ptr->num_palette == 0 || info_ptr->num_palette + > PNG_MAX_PALETTE_LENGTH) + { + png_warning(png_ptr, + "Invalid palette size, hIST allocation skipped"); + return; + } + + png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0); + /* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in + * version 1.2.1 + */ + png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr, + PNG_MAX_PALETTE_LENGTH * png_sizeof(png_uint_16)); + if (png_ptr->hist == NULL) + { + png_warning(png_ptr, "Insufficient memory for hIST chunk data"); + return; + } + + for (i = 0; i < info_ptr->num_palette; i++) + png_ptr->hist[i] = hist[i]; + info_ptr->hist = png_ptr->hist; + info_ptr->valid |= PNG_INFO_hIST; + + info_ptr->free_me |= PNG_FREE_HIST; +} +#endif + +void PNGAPI +png_set_IHDR(png_structp png_ptr, png_infop info_ptr, + png_uint_32 width, png_uint_32 height, int bit_depth, + int color_type, int interlace_type, int compression_type, + int filter_type) +{ + png_debug1(1, "in %s storage function", "IHDR"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->width = width; + info_ptr->height = height; + info_ptr->bit_depth = (png_byte)bit_depth; + info_ptr->color_type = (png_byte)color_type; + info_ptr->compression_type = (png_byte)compression_type; + info_ptr->filter_type = (png_byte)filter_type; + info_ptr->interlace_type = (png_byte)interlace_type; + + png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height, + info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type, + info_ptr->compression_type, info_ptr->filter_type); + + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + info_ptr->channels = 1; + else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) + info_ptr->channels = 3; + else + info_ptr->channels = 1; + if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) + info_ptr->channels++; + info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth); + + /* Check for potential overflow */ + if (width > (PNG_UINT_32_MAX + >> 3) /* 8-byte RGBA pixels */ + - 64 /* bigrowbuf hack */ + - 1 /* filter byte */ + - 7*8 /* rounding of width to multiple of 8 pixels */ + - 8) /* extra max_pixel_depth pad */ + info_ptr->rowbytes = 0; + else + info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width); +} + +#ifdef PNG_oFFs_SUPPORTED +void PNGAPI +png_set_oFFs(png_structp png_ptr, png_infop info_ptr, + png_int_32 offset_x, png_int_32 offset_y, int unit_type) +{ + png_debug1(1, "in %s storage function", "oFFs"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->x_offset = offset_x; + info_ptr->y_offset = offset_y; + info_ptr->offset_unit_type = (png_byte)unit_type; + info_ptr->valid |= PNG_INFO_oFFs; +} +#endif + +#ifdef PNG_pCAL_SUPPORTED +void PNGAPI +png_set_pCAL(png_structp png_ptr, png_infop info_ptr, + png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, + png_charp units, png_charpp params) +{ + png_size_t length; + int i; + + png_debug1(1, "in %s storage function", "pCAL"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + length = png_strlen(purpose) + 1; + png_debug1(3, "allocating purpose for info (%lu bytes)", + (unsigned long)length); + info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length); + if (info_ptr->pcal_purpose == NULL) + { + png_warning(png_ptr, "Insufficient memory for pCAL purpose"); + return; + } + png_memcpy(info_ptr->pcal_purpose, purpose, length); + + png_debug(3, "storing X0, X1, type, and nparams in info"); + info_ptr->pcal_X0 = X0; + info_ptr->pcal_X1 = X1; + info_ptr->pcal_type = (png_byte)type; + info_ptr->pcal_nparams = (png_byte)nparams; + + length = png_strlen(units) + 1; + png_debug1(3, "allocating units for info (%lu bytes)", + (unsigned long)length); + info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length); + if (info_ptr->pcal_units == NULL) + { + png_warning(png_ptr, "Insufficient memory for pCAL units"); + return; + } + png_memcpy(info_ptr->pcal_units, units, length); + + info_ptr->pcal_params = (png_charpp)png_malloc_warn(png_ptr, + (png_size_t)((nparams + 1) * png_sizeof(png_charp))); + if (info_ptr->pcal_params == NULL) + { + png_warning(png_ptr, "Insufficient memory for pCAL params"); + return; + } + + png_memset(info_ptr->pcal_params, 0, (nparams + 1) * png_sizeof(png_charp)); + + for (i = 0; i < nparams; i++) + { + length = png_strlen(params[i]) + 1; + png_debug2(3, "allocating parameter %d for info (%lu bytes)", i, + (unsigned long)length); + info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length); + if (info_ptr->pcal_params[i] == NULL) + { + png_warning(png_ptr, "Insufficient memory for pCAL parameter"); + return; + } + png_memcpy(info_ptr->pcal_params[i], params[i], length); + } + + info_ptr->valid |= PNG_INFO_pCAL; + info_ptr->free_me |= PNG_FREE_PCAL; +} +#endif + +#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +void PNGAPI +png_set_sCAL(png_structp png_ptr, png_infop info_ptr, + int unit, double width, double height) +{ + png_debug1(1, "in %s storage function", "sCAL"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->scal_unit = (png_byte)unit; + info_ptr->scal_pixel_width = width; + info_ptr->scal_pixel_height = height; + + info_ptr->valid |= PNG_INFO_sCAL; +} +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +void PNGAPI +png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr, + int unit, png_charp swidth, png_charp sheight) +{ + png_size_t length; + + png_debug1(1, "in %s storage function", "sCAL"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->scal_unit = (png_byte)unit; + + length = png_strlen(swidth) + 1; + png_debug1(3, "allocating unit for info (%u bytes)", + (unsigned int)length); + info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length); + if (info_ptr->scal_s_width == NULL) + { + png_warning(png_ptr, + "Memory allocation failed while processing sCAL"); + return; + } + png_memcpy(info_ptr->scal_s_width, swidth, length); + + length = png_strlen(sheight) + 1; + png_debug1(3, "allocating unit for info (%u bytes)", + (unsigned int)length); + info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length); + if (info_ptr->scal_s_height == NULL) + { + png_free (png_ptr, info_ptr->scal_s_width); + info_ptr->scal_s_width = NULL; + png_warning(png_ptr, + "Memory allocation failed while processing sCAL"); + return; + } + png_memcpy(info_ptr->scal_s_height, sheight, length); + info_ptr->valid |= PNG_INFO_sCAL; + info_ptr->free_me |= PNG_FREE_SCAL; +} +#endif +#endif +#endif + +#ifdef PNG_pHYs_SUPPORTED +void PNGAPI +png_set_pHYs(png_structp png_ptr, png_infop info_ptr, + png_uint_32 res_x, png_uint_32 res_y, int unit_type) +{ + png_debug1(1, "in %s storage function", "pHYs"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->x_pixels_per_unit = res_x; + info_ptr->y_pixels_per_unit = res_y; + info_ptr->phys_unit_type = (png_byte)unit_type; + info_ptr->valid |= PNG_INFO_pHYs; +} +#endif + +void PNGAPI +png_set_PLTE(png_structp png_ptr, png_infop info_ptr, + png_colorp palette, int num_palette) +{ + + png_debug1(1, "in %s storage function", "PLTE"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH) + { + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + png_error(png_ptr, "Invalid palette length"); + else + { + png_warning(png_ptr, "Invalid palette length"); + return; + } + } + + /* It may not actually be necessary to set png_ptr->palette here; + * we do it for backward compatibility with the way the png_handle_tRNS + * function used to do the allocation. + */ + png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0); + + /* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead + * of num_palette entries, in case of an invalid PNG file that has + * too-large sample values. + */ + png_ptr->palette = (png_colorp)png_calloc(png_ptr, + PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color)); + png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof(png_color)); + info_ptr->palette = png_ptr->palette; + info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette; + + info_ptr->free_me |= PNG_FREE_PLTE; + + info_ptr->valid |= PNG_INFO_PLTE; +} + +#ifdef PNG_sBIT_SUPPORTED +void PNGAPI +png_set_sBIT(png_structp png_ptr, png_infop info_ptr, + png_color_8p sig_bit) +{ + png_debug1(1, "in %s storage function", "sBIT"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + png_memcpy(&(info_ptr->sig_bit), sig_bit, png_sizeof(png_color_8)); + info_ptr->valid |= PNG_INFO_sBIT; +} +#endif + +#ifdef PNG_sRGB_SUPPORTED +void PNGAPI +png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent) +{ + png_debug1(1, "in %s storage function", "sRGB"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->srgb_intent = (png_byte)intent; + info_ptr->valid |= PNG_INFO_sRGB; +} + +void PNGAPI +png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, + int intent) +{ +#ifdef PNG_gAMA_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED + float file_gamma; +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + png_fixed_point int_file_gamma; +#endif +#endif +#ifdef PNG_cHRM_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED + float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; +#endif + png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, + int_green_y, int_blue_x, int_blue_y; +#endif + png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + png_set_sRGB(png_ptr, info_ptr, intent); + +#ifdef PNG_gAMA_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED + file_gamma = (float).45455; + png_set_gAMA(png_ptr, info_ptr, file_gamma); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + int_file_gamma = 45455L; + png_set_gAMA_fixed(png_ptr, info_ptr, int_file_gamma); +#endif +#endif + +#ifdef PNG_cHRM_SUPPORTED + int_white_x = 31270L; + int_white_y = 32900L; + int_red_x = 64000L; + int_red_y = 33000L; + int_green_x = 30000L; + int_green_y = 60000L; + int_blue_x = 15000L; + int_blue_y = 6000L; + +#ifdef PNG_FLOATING_POINT_SUPPORTED + white_x = (float).3127; + white_y = (float).3290; + red_x = (float).64; + red_y = (float).33; + green_x = (float).30; + green_y = (float).60; + blue_x = (float).15; + blue_y = (float).06; +#endif + +#ifdef PNG_FIXED_POINT_SUPPORTED + png_set_cHRM_fixed(png_ptr, info_ptr, + int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, + int_green_y, int_blue_x, int_blue_y); +#endif +#ifdef PNG_FLOATING_POINT_SUPPORTED + png_set_cHRM(png_ptr, info_ptr, + white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); +#endif +#endif /* cHRM */ +} +#endif /* sRGB */ + + +#ifdef PNG_iCCP_SUPPORTED +void PNGAPI +png_set_iCCP(png_structp png_ptr, png_infop info_ptr, + png_charp name, int compression_type, + png_charp profile, png_uint_32 proflen) +{ + png_charp new_iccp_name; + png_charp new_iccp_profile; + png_uint_32 length; + + png_debug1(1, "in %s storage function", "iCCP"); + + if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL) + return; + + length = png_strlen(name)+1; + new_iccp_name = (png_charp)png_malloc_warn(png_ptr, length); + if (new_iccp_name == NULL) + { + png_warning(png_ptr, "Insufficient memory to process iCCP chunk"); + return; + } + png_memcpy(new_iccp_name, name, length); + new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen); + if (new_iccp_profile == NULL) + { + png_free (png_ptr, new_iccp_name); + png_warning(png_ptr, + "Insufficient memory to process iCCP profile"); + return; + } + png_memcpy(new_iccp_profile, profile, (png_size_t)proflen); + + png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0); + + info_ptr->iccp_proflen = proflen; + info_ptr->iccp_name = new_iccp_name; + info_ptr->iccp_profile = new_iccp_profile; + /* Compression is always zero but is here so the API and info structure + * does not have to change if we introduce multiple compression types + */ + info_ptr->iccp_compression = (png_byte)compression_type; + info_ptr->free_me |= PNG_FREE_ICCP; + info_ptr->valid |= PNG_INFO_iCCP; +} +#endif + +#ifdef PNG_TEXT_SUPPORTED +void PNGAPI +png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, + int num_text) +{ + int ret; + ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text); + if (ret) + png_error(png_ptr, "Insufficient memory to store text"); +} + +int /* PRIVATE */ +png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, + int num_text) +{ + int i; + + png_debug1(1, "in %s storage function", ((png_ptr == NULL || + png_ptr->chunk_name[0] == '\0') ? + "text" : (png_const_charp)png_ptr->chunk_name)); + + if (png_ptr == NULL || info_ptr == NULL || num_text == 0) + return(0); + + /* Make sure we have enough space in the "text" array in info_struct + * to hold all of the incoming text_ptr objects. + */ + if (info_ptr->num_text + num_text > info_ptr->max_text) + { + if (info_ptr->text != NULL) + { + png_textp old_text; + int old_max; + + old_max = info_ptr->max_text; + info_ptr->max_text = info_ptr->num_text + num_text + 8; + old_text = info_ptr->text; + info_ptr->text = (png_textp)png_malloc_warn(png_ptr, + (png_size_t)(info_ptr->max_text * png_sizeof(png_text))); + if (info_ptr->text == NULL) + { + png_free(png_ptr, old_text); + return(1); + } + png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max * + png_sizeof(png_text))); + png_free(png_ptr, old_text); + } + else + { + info_ptr->max_text = num_text + 8; + info_ptr->num_text = 0; + info_ptr->text = (png_textp)png_malloc_warn(png_ptr, + (png_size_t)(info_ptr->max_text * png_sizeof(png_text))); + if (info_ptr->text == NULL) + return(1); + info_ptr->free_me |= PNG_FREE_TEXT; + } + png_debug1(3, "allocated %d entries for info_ptr->text", + info_ptr->max_text); + } + for (i = 0; i < num_text; i++) + { + png_size_t text_length, key_len; + png_size_t lang_len, lang_key_len; + png_textp textp = &(info_ptr->text[info_ptr->num_text]); + + if (text_ptr[i].key == NULL) + continue; + + key_len = png_strlen(text_ptr[i].key); + + if (text_ptr[i].compression <= 0) + { + lang_len = 0; + lang_key_len = 0; + } + + else +#ifdef PNG_iTXt_SUPPORTED + { + /* Set iTXt data */ + + if (text_ptr[i].lang != NULL) + lang_len = png_strlen(text_ptr[i].lang); + else + lang_len = 0; + if (text_ptr[i].lang_key != NULL) + lang_key_len = png_strlen(text_ptr[i].lang_key); + else + lang_key_len = 0; + } +#else /* PNG_iTXt_SUPPORTED */ + { + png_warning(png_ptr, "iTXt chunk not supported"); + continue; + } +#endif + + if (text_ptr[i].text == NULL || text_ptr[i].text[0] == '\0') + { + text_length = 0; +#ifdef PNG_iTXt_SUPPORTED + if (text_ptr[i].compression > 0) + textp->compression = PNG_ITXT_COMPRESSION_NONE; + else +#endif + textp->compression = PNG_TEXT_COMPRESSION_NONE; + } + + else + { + text_length = png_strlen(text_ptr[i].text); + textp->compression = text_ptr[i].compression; + } + + textp->key = (png_charp)png_malloc_warn(png_ptr, + (png_size_t) + (key_len + text_length + lang_len + lang_key_len + 4)); + if (textp->key == NULL) + return(1); + png_debug2(2, "Allocated %lu bytes at %x in png_set_text", + (unsigned long)(png_uint_32) + (key_len + lang_len + lang_key_len + text_length + 4), + (int)textp->key); + + png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len)); + *(textp->key + key_len) = '\0'; +#ifdef PNG_iTXt_SUPPORTED + if (text_ptr[i].compression > 0) + { + textp->lang = textp->key + key_len + 1; + png_memcpy(textp->lang, text_ptr[i].lang, lang_len); + *(textp->lang + lang_len) = '\0'; + textp->lang_key = textp->lang + lang_len + 1; + png_memcpy(textp->lang_key, text_ptr[i].lang_key, lang_key_len); + *(textp->lang_key + lang_key_len) = '\0'; + textp->text = textp->lang_key + lang_key_len + 1; + } + else +#endif + { +#ifdef PNG_iTXt_SUPPORTED + textp->lang=NULL; + textp->lang_key=NULL; +#endif + textp->text = textp->key + key_len + 1; + } + if (text_length) + png_memcpy(textp->text, text_ptr[i].text, + (png_size_t)(text_length)); + *(textp->text + text_length) = '\0'; + +#ifdef PNG_iTXt_SUPPORTED + if (textp->compression > 0) + { + textp->text_length = 0; + textp->itxt_length = text_length; + } + else +#endif + + { + textp->text_length = text_length; +#ifdef PNG_iTXt_SUPPORTED + textp->itxt_length = 0; +#endif + } + info_ptr->num_text++; + png_debug1(3, "transferred text chunk %d", info_ptr->num_text); + } + return(0); +} +#endif + +#ifdef PNG_tIME_SUPPORTED +void PNGAPI +png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) +{ + png_debug1(1, "in %s storage function", "tIME"); + + if (png_ptr == NULL || info_ptr == NULL || + (png_ptr->mode & PNG_WROTE_tIME)) + return; + + png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof(png_time)); + info_ptr->valid |= PNG_INFO_tIME; +} +#endif + +#ifdef PNG_tRNS_SUPPORTED +void PNGAPI +png_set_tRNS(png_structp png_ptr, png_infop info_ptr, + png_bytep trans_alpha, int num_trans, png_color_16p trans_color) +{ + png_debug1(1, "in %s storage function", "tRNS"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (trans_alpha != NULL) + { + /* It may not actually be necessary to set png_ptr->trans_alpha here; + * we do it for backward compatibility with the way the png_handle_tRNS + * function used to do the allocation. + */ + + png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0); + + /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */ + png_ptr->trans_alpha = info_ptr->trans_alpha = (png_bytep)png_malloc(png_ptr, + (png_size_t)PNG_MAX_PALETTE_LENGTH); + if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH) + png_memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans); + } + + if (trans_color != NULL) + { + int sample_max = (1 << info_ptr->bit_depth); + if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY && + (int)trans_color->gray > sample_max) || + (info_ptr->color_type == PNG_COLOR_TYPE_RGB && + ((int)trans_color->red > sample_max || + (int)trans_color->green > sample_max || + (int)trans_color->blue > sample_max))) + png_warning(png_ptr, + "tRNS chunk has out-of-range samples for bit_depth"); + png_memcpy(&(info_ptr->trans_color), trans_color, + png_sizeof(png_color_16)); + if (num_trans == 0) + num_trans = 1; + } + + info_ptr->num_trans = (png_uint_16)num_trans; + if (num_trans != 0) + { + info_ptr->valid |= PNG_INFO_tRNS; + info_ptr->free_me |= PNG_FREE_TRNS; + } +} +#endif + +#ifdef PNG_sPLT_SUPPORTED +void PNGAPI +png_set_sPLT(png_structp png_ptr, + png_infop info_ptr, png_sPLT_tp entries, int nentries) +/* + * entries - array of png_sPLT_t structures + * to be added to the list of palettes + * in the info structure. + * nentries - number of palette structures to be + * added. + */ +{ + png_sPLT_tp np; + int i; + + if (png_ptr == NULL || info_ptr == NULL) + return; + + np = (png_sPLT_tp)png_malloc_warn(png_ptr, + (info_ptr->splt_palettes_num + nentries) * + (png_size_t)png_sizeof(png_sPLT_t)); + if (np == NULL) + { + png_warning(png_ptr, "No memory for sPLT palettes"); + return; + } + + png_memcpy(np, info_ptr->splt_palettes, + info_ptr->splt_palettes_num * png_sizeof(png_sPLT_t)); + png_free(png_ptr, info_ptr->splt_palettes); + info_ptr->splt_palettes=NULL; + + for (i = 0; i < nentries; i++) + { + png_sPLT_tp to = np + info_ptr->splt_palettes_num + i; + png_sPLT_tp from = entries + i; + png_uint_32 length; + + length = png_strlen(from->name) + 1; + to->name = (png_charp)png_malloc_warn(png_ptr, (png_size_t)length); + if (to->name == NULL) + { + png_warning(png_ptr, + "Out of memory while processing sPLT chunk"); + continue; + } + png_memcpy(to->name, from->name, length); + to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr, + (png_size_t)(from->nentries * png_sizeof(png_sPLT_entry))); + if (to->entries == NULL) + { + png_warning(png_ptr, + "Out of memory while processing sPLT chunk"); + png_free(png_ptr, to->name); + to->name = NULL; + continue; + } + png_memcpy(to->entries, from->entries, + from->nentries * png_sizeof(png_sPLT_entry)); + to->nentries = from->nentries; + to->depth = from->depth; + } + + info_ptr->splt_palettes = np; + info_ptr->splt_palettes_num += nentries; + info_ptr->valid |= PNG_INFO_sPLT; + info_ptr->free_me |= PNG_FREE_SPLT; +} +#endif /* PNG_sPLT_SUPPORTED */ + +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED +void PNGAPI +png_set_unknown_chunks(png_structp png_ptr, + png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns) +{ + png_unknown_chunkp np; + int i; + + if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0) + return; + + np = (png_unknown_chunkp)png_malloc_warn(png_ptr, + (png_size_t)((info_ptr->unknown_chunks_num + num_unknowns) * + png_sizeof(png_unknown_chunk))); + if (np == NULL) + { + png_warning(png_ptr, + "Out of memory while processing unknown chunk"); + return; + } + + png_memcpy(np, info_ptr->unknown_chunks, + info_ptr->unknown_chunks_num * png_sizeof(png_unknown_chunk)); + png_free(png_ptr, info_ptr->unknown_chunks); + info_ptr->unknown_chunks = NULL; + + for (i = 0; i < num_unknowns; i++) + { + png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i; + png_unknown_chunkp from = unknowns + i; + + png_memcpy((png_charp)to->name, (png_charp)from->name, + png_sizeof(from->name)); + to->name[png_sizeof(to->name)-1] = '\0'; + to->size = from->size; + /* Note our location in the read or write sequence */ + to->location = (png_byte)(png_ptr->mode & 0xff); + + if (from->size == 0) + to->data=NULL; + else + { + to->data = (png_bytep)png_malloc_warn(png_ptr, + (png_size_t)from->size); + if (to->data == NULL) + { + png_warning(png_ptr, + "Out of memory while processing unknown chunk"); + to->size = 0; + } + else + png_memcpy(to->data, from->data, from->size); + } + } + + info_ptr->unknown_chunks = np; + info_ptr->unknown_chunks_num += num_unknowns; + info_ptr->free_me |= PNG_FREE_UNKN; +} +void PNGAPI +png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr, + int chunk, int location) +{ + if (png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk < + (int)info_ptr->unknown_chunks_num) + info_ptr->unknown_chunks[chunk].location = (png_byte)location; +} +#endif + + +#ifdef PNG_MNG_FEATURES_SUPPORTED +png_uint_32 PNGAPI +png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features) +{ + png_debug(1, "in png_permit_mng_features"); + + if (png_ptr == NULL) + return (png_uint_32)0; + png_ptr->mng_features_permitted = + (png_byte)(mng_features & PNG_ALL_MNG_FEATURES); + return (png_uint_32)png_ptr->mng_features_permitted; +} +#endif + +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +void PNGAPI +png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep + chunk_list, int num_chunks) +{ + png_bytep new_list, p; + int i, old_num_chunks; + if (png_ptr == NULL) + return; + if (num_chunks == 0) + { + if (keep == PNG_HANDLE_CHUNK_ALWAYS || keep == PNG_HANDLE_CHUNK_IF_SAFE) + png_ptr->flags |= PNG_FLAG_KEEP_UNKNOWN_CHUNKS; + else + png_ptr->flags &= ~PNG_FLAG_KEEP_UNKNOWN_CHUNKS; + + if (keep == PNG_HANDLE_CHUNK_ALWAYS) + png_ptr->flags |= PNG_FLAG_KEEP_UNSAFE_CHUNKS; + else + png_ptr->flags &= ~PNG_FLAG_KEEP_UNSAFE_CHUNKS; + return; + } + if (chunk_list == NULL) + return; + old_num_chunks = png_ptr->num_chunk_list; + new_list=(png_bytep)png_malloc(png_ptr, + (png_size_t) + (5*(num_chunks + old_num_chunks))); + if (png_ptr->chunk_list != NULL) + { + png_memcpy(new_list, png_ptr->chunk_list, + (png_size_t)(5*old_num_chunks)); + png_free(png_ptr, png_ptr->chunk_list); + png_ptr->chunk_list=NULL; + } + png_memcpy(new_list + 5*old_num_chunks, chunk_list, + (png_size_t)(5*num_chunks)); + for (p = new_list + 5*old_num_chunks + 4, i = 0; inum_chunk_list = old_num_chunks + num_chunks; + png_ptr->chunk_list = new_list; + png_ptr->free_me |= PNG_FREE_LIST; +} +#endif + +#ifdef PNG_READ_USER_CHUNKS_SUPPORTED +void PNGAPI +png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, + png_user_chunk_ptr read_user_chunk_fn) +{ + png_debug(1, "in png_set_read_user_chunk_fn"); + + if (png_ptr == NULL) + return; + + png_ptr->read_user_chunk_fn = read_user_chunk_fn; + png_ptr->user_chunk_ptr = user_chunk_ptr; +} +#endif + +#ifdef PNG_INFO_IMAGE_SUPPORTED +void PNGAPI +png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers) +{ + png_debug1(1, "in %s storage function", "rows"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (info_ptr->row_pointers && (info_ptr->row_pointers != row_pointers)) + png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); + info_ptr->row_pointers = row_pointers; + if (row_pointers) + info_ptr->valid |= PNG_INFO_IDAT; +} +#endif + +void PNGAPI +png_set_compression_buffer_size(png_structp png_ptr, + png_size_t size) +{ + if (png_ptr == NULL) + return; + png_free(png_ptr, png_ptr->zbuf); + png_ptr->zbuf_size = size; + png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; +} + +void PNGAPI +png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask) +{ + if (png_ptr && info_ptr) + info_ptr->valid &= ~mask; +} + + + +#ifdef PNG_SET_USER_LIMITS_SUPPORTED +/* This function was added to libpng 1.2.6 */ +void PNGAPI +png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max, + png_uint_32 user_height_max) +{ + /* Images with dimensions larger than these limits will be + * rejected by png_set_IHDR(). To accept any PNG datastream + * regardless of dimensions, set both limits to 0x7ffffffL. + */ + if (png_ptr == NULL) + return; + png_ptr->user_width_max = user_width_max; + png_ptr->user_height_max = user_height_max; +} + +/* This function was added to libpng 1.4.0 */ +void PNGAPI +png_set_chunk_cache_max (png_structp png_ptr, + png_uint_32 user_chunk_cache_max) +{ + if (png_ptr) + png_ptr->user_chunk_cache_max = user_chunk_cache_max; +} + +/* This function was added to libpng 1.4.1 */ +void PNGAPI +png_set_chunk_malloc_max (png_structp png_ptr, + png_alloc_size_t user_chunk_malloc_max) +{ + if (png_ptr) + png_ptr->user_chunk_malloc_max = + (png_size_t)user_chunk_malloc_max; +} +#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ + + +#ifdef PNG_BENIGN_ERRORS_SUPPORTED +void PNGAPI +png_set_benign_errors(png_structp png_ptr, int allowed) +{ + png_debug(1, "in png_set_benign_errors"); + + if (allowed) + png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN; + else + png_ptr->flags &= ~PNG_FLAG_BENIGN_ERRORS_WARN; +} +#endif /* PNG_BENIGN_ERRORS_SUPPORTED */ +#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff --git a/png/pngtest.c b/png/pngtest.c new file mode 100644 index 0000000..836441d --- /dev/null +++ b/png/pngtest.c @@ -0,0 +1,1630 @@ + +/* pngtest.c - a simple test program to test libpng + * + * Last changed in libpng 1.4.1 [February 25, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + * This program reads in a PNG image, writes it out again, and then + * compares the two files. If the files are identical, this shows that + * the basic chunk handling, filtering, and (de)compression code is working + * properly. It does not currently test all of the transforms, although + * it probably should. + * + * The program will report "FAIL" in certain legitimate cases: + * 1) when the compression level or filter selection method is changed. + * 2) when the maximum IDAT size (PNG_ZBUF_SIZE in pngconf.h) is not 8192. + * 3) unknown unsafe-to-copy ancillary chunks or unknown critical chunks + * exist in the input file. + * 4) others not listed here... + * In these cases, it is best to check with another tool such as "pngcheck" + * to see what the differences between the two files are. + * + * If a filename is given on the command-line, then this file is used + * for the input, rather than the default "pngtest.png". This allows + * testing a wide variety of files easily. You can also test a number + * of files at once by typing "pngtest -m file1.png file2.png ..." + */ + +#include "png.h" +#include "pngpriv.h" + +# include +# include +# define FCLOSE(file) fclose(file) + +#ifndef PNG_STDIO_SUPPORTED + typedef FILE * png_FILE_p; +#endif + +/* Makes pngtest verbose so we can find problems (needs to be before png.h) */ +#ifndef PNG_DEBUG +# define PNG_DEBUG 0 +#endif + +#if !PNG_DEBUG +# define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */ +#endif + +/* Turn on CPU timing +#define PNGTEST_TIMING +*/ + +#ifndef PNG_FLOATING_POINT_SUPPORTED +#undef PNGTEST_TIMING +#endif + +#ifdef PNGTEST_TIMING +static float t_start, t_stop, t_decode, t_encode, t_misc; +#include +#endif + +#ifdef PNG_TIME_RFC1123_SUPPORTED +#define PNG_tIME_STRING_LENGTH 29 +static int tIME_chunk_present = 0; +static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present"; +#endif + +static int verbose = 0; + +int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname)); + +#ifdef __TURBOC__ +#include +#endif + +/* Defined so I can write to a file on gui/windowing platforms */ +/* #define STDERR stderr */ +#define STDERR stdout /* For DOS */ + +/* In case a system header (e.g., on AIX) defined jmpbuf */ +#ifdef jmpbuf +# undef jmpbuf +#endif + +/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */ +#ifndef png_jmpbuf +# define png_jmpbuf(png_ptr) png_ptr->jmpbuf +#endif + +/* Example of using row callbacks to make a simple progress meter */ +static int status_pass = 1; +static int status_dots_requested = 0; +static int status_dots = 1; + +void +read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass); +void +read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) +{ + if (png_ptr == NULL || row_number > PNG_UINT_31_MAX) + return; + if (status_pass != pass) + { + fprintf(stdout, "\n Pass %d: ", pass); + status_pass = pass; + status_dots = 31; + } + status_dots--; + if (status_dots == 0) + { + fprintf(stdout, "\n "); + status_dots=30; + } + fprintf(stdout, "r"); +} + +void +write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass); +void +write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) +{ + if (png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7) + return; + fprintf(stdout, "w"); +} + + +#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED +/* Example of using user transform callback (we don't transform anything, + * but merely examine the row filters. We set this to 256 rather than + * 5 in case illegal filter values are present.) + */ +static png_uint_32 filters_used[256]; +void +count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data); +void +count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data) +{ + if (png_ptr != NULL && row_info != NULL) + ++filters_used[*(data - 1)]; +} +#endif + +#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED +/* Example of using user transform callback (we don't transform anything, + * but merely count the zero samples) + */ + +static png_uint_32 zero_samples; + +void +count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data); +void +count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) +{ + png_bytep dp = data; + if (png_ptr == NULL)return; + + /* Contents of row_info: + * png_uint_32 width width of row + * png_uint_32 rowbytes number of bytes in row + * png_byte color_type color type of pixels + * png_byte bit_depth bit depth of samples + * png_byte channels number of channels (1-4) + * png_byte pixel_depth bits per pixel (depth*channels) + */ + + /* Counts the number of zero samples (or zero pixels if color_type is 3 */ + + if (row_info->color_type == 0 || row_info->color_type == 3) + { + int pos = 0; + png_uint_32 n, nstop; + for (n = 0, nstop=row_info->width; nbit_depth == 1) + { + if (((*dp << pos++ ) & 0x80) == 0) + zero_samples++; + if (pos == 8) + { + pos = 0; + dp++; + } + } + if (row_info->bit_depth == 2) + { + if (((*dp << (pos+=2)) & 0xc0) == 0) + zero_samples++; + if (pos == 8) + { + pos = 0; + dp++; + } + } + if (row_info->bit_depth == 4) + { + if (((*dp << (pos+=4)) & 0xf0) == 0) + zero_samples++; + if (pos == 8) + { + pos = 0; + dp++; + } + } + if (row_info->bit_depth == 8) + if (*dp++ == 0) + zero_samples++; + if (row_info->bit_depth == 16) + { + if ((*dp | *(dp+1)) == 0) + zero_samples++; + dp+=2; + } + } + } + else /* Other color types */ + { + png_uint_32 n, nstop; + int channel; + int color_channels = row_info->channels; + if (row_info->color_type > 3)color_channels--; + + for (n = 0, nstop=row_info->width; nbit_depth == 8) + if (*dp++ == 0) + zero_samples++; + if (row_info->bit_depth == 16) + { + if ((*dp | *(dp+1)) == 0) + zero_samples++; + dp+=2; + } + } + if (row_info->color_type > 3) + { + dp++; + if (row_info->bit_depth == 16) + dp++; + } + } + } +} +#endif /* PNG_WRITE_USER_TRANSFORM_SUPPORTED */ + +static int wrote_question = 0; + +#ifndef PNG_STDIO_SUPPORTED +/* START of code to validate stdio-free compilation */ +/* These copies of the default read/write functions come from pngrio.c and + * pngwio.c. They allow "don't include stdio" testing of the library. + * This is the function that does the actual reading of data. If you are + * not reading from a standard C stream, you should create a replacement + * read_data function and use it at run time with png_set_read_fn(), rather + * than changing the library. + */ + +#ifndef USE_FAR_KEYWORD +static void +pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + png_size_t check = 0; + png_voidp io_ptr; + + /* fread() returns 0 on error, so it is OK to store this in a png_size_t + * instead of an int, which is what fread() actually returns. + */ + io_ptr = png_get_io_ptr(png_ptr); + if (io_ptr != NULL) + { + check = fread(data, 1, length, (png_FILE_p)io_ptr); + } + + if (check != length) + { + png_error(png_ptr, "Read Error!"); + } +} +#else +/* This is the model-independent version. Since the standard I/O library + can't handle far buffers in the medium and small models, we have to copy + the data. +*/ + +#define NEAR_BUF_SIZE 1024 +#define MIN(a,b) (a <= b ? a : b) + +static void +pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + png_size_t check; + png_byte *n_data; + png_FILE_p io_ptr; + + /* Check if data really is near. If so, use usual code. */ + n_data = (png_byte *)CVT_PTR_NOCHECK(data); + io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); + if ((png_bytep)n_data == data) + { + check = fread(n_data, 1, length, io_ptr); + } + else + { + png_byte buf[NEAR_BUF_SIZE]; + png_size_t read, remaining, err; + check = 0; + remaining = length; + do + { + read = MIN(NEAR_BUF_SIZE, remaining); + err = fread(buf, 1, 1, io_ptr); + png_memcpy(data, buf, read); /* Copy far buffer to near buffer */ + if (err != read) + break; + else + check += err; + data += read; + remaining -= read; + } + while (remaining != 0); + } + if (check != length) + png_error(png_ptr, "read Error"); +} +#endif /* USE_FAR_KEYWORD */ + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +static void +pngtest_flush(png_structp png_ptr) +{ + /* Do nothing; fflush() is said to be just a waste of energy. */ + png_ptr = png_ptr; /* Stifle compiler warning */ +} +#endif + +/* This is the function that does the actual writing of data. If you are + * not writing to a standard C stream, you should create a replacement + * write_data function and use it at run time with png_set_write_fn(), rather + * than changing the library. + */ +#ifndef USE_FAR_KEYWORD +static void +pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + png_size_t check; + + check = fwrite(data, 1, length, (png_FILE_p)png_ptr->io_ptr); + if (check != length) + { + png_error(png_ptr, "Write Error"); + } +} +#else +/* This is the model-independent version. Since the standard I/O library + can't handle far buffers in the medium and small models, we have to copy + the data. +*/ + +#define NEAR_BUF_SIZE 1024 +#define MIN(a,b) (a <= b ? a : b) + +static void +pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + png_size_t check; + png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */ + png_FILE_p io_ptr; + + /* Check if data really is near. If so, use usual code. */ + near_data = (png_byte *)CVT_PTR_NOCHECK(data); + io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); + if ((png_bytep)near_data == data) + { + check = fwrite(near_data, 1, length, io_ptr); + } + else + { + png_byte buf[NEAR_BUF_SIZE]; + png_size_t written, remaining, err; + check = 0; + remaining = length; + do + { + written = MIN(NEAR_BUF_SIZE, remaining); + png_memcpy(buf, data, written); /* Copy far buffer to near buffer */ + err = fwrite(buf, 1, written, io_ptr); + if (err != written) + break; + else + check += err; + data += written; + remaining -= written; + } + while (remaining != 0); + } + if (check != length) + { + png_error(png_ptr, "Write Error"); + } +} +#endif /* USE_FAR_KEYWORD */ + +/* This function is called when there is a warning, but the library thinks + * it can continue anyway. Replacement functions don't have to do anything + * here if you don't want to. In the default configuration, png_ptr is + * not used, but it is passed in case it may be useful. + */ +static void +pngtest_warning(png_structp png_ptr, png_const_charp message) +{ + PNG_CONST char *name = "UNKNOWN (ERROR!)"; + char *test; + test = png_get_error_ptr(png_ptr); + if (test == NULL) + fprintf(STDERR, "%s: libpng warning: %s\n", name, message); + else + fprintf(STDERR, "%s: libpng warning: %s\n", test, message); +} + +/* This is the default error handling function. Note that replacements for + * this function MUST NOT RETURN, or the program will likely crash. This + * function is used by default, or if the program supplies NULL for the + * error function pointer in png_set_error_fn(). + */ +static void +pngtest_error(png_structp png_ptr, png_const_charp message) +{ + pngtest_warning(png_ptr, message); + /* We can return because png_error calls the default handler, which is + * actually OK in this case. + */ +} +#endif /* !PNG_STDIO_SUPPORTED */ +/* END of code to validate stdio-free compilation */ + +/* START of code to validate memory allocation and deallocation */ +#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG + +/* Allocate memory. For reasonable files, size should never exceed + * 64K. However, zlib may allocate more then 64K if you don't tell + * it not to. See zconf.h and png.h for more information. zlib does + * need to allocate exactly 64K, so whatever you call here must + * have the ability to do that. + * + * This piece of code can be compiled to validate max 64K allocations + * by setting MAXSEG_64K in zlib zconf.h *or* PNG_MAX_MALLOC_64K. + */ +typedef struct memory_information +{ + png_alloc_size_t size; + png_voidp pointer; + struct memory_information FAR *next; +} memory_information; +typedef memory_information FAR *memory_infop; + +static memory_infop pinformation = NULL; +static int current_allocation = 0; +static int maximum_allocation = 0; +static int total_allocation = 0; +static int num_allocations = 0; + +png_voidp png_debug_malloc + PNGARG((png_structp png_ptr, png_alloc_size_t size)); +void png_debug_free PNGARG((png_structp png_ptr, png_voidp ptr)); + +png_voidp +png_debug_malloc(png_structp png_ptr, png_alloc_size_t size) +{ + + /* png_malloc has already tested for NULL; png_create_struct calls + * png_debug_malloc directly, with png_ptr == NULL which is OK + */ + + if (size == 0) + return (NULL); + + /* This calls the library allocator twice, once to get the requested + buffer and once to get a new free list entry. */ + { + /* Disable malloc_fn and free_fn */ + memory_infop pinfo; + png_set_mem_fn(png_ptr, NULL, NULL, NULL); + pinfo = (memory_infop)png_malloc(png_ptr, + png_sizeof(*pinfo)); + pinfo->size = size; + current_allocation += size; + total_allocation += size; + num_allocations ++; + if (current_allocation > maximum_allocation) + maximum_allocation = current_allocation; + pinfo->pointer = png_malloc(png_ptr, size); + /* Restore malloc_fn and free_fn */ + png_set_mem_fn(png_ptr, + NULL, png_debug_malloc, png_debug_free); + if (size != 0 && pinfo->pointer == NULL) + { + current_allocation -= size; + total_allocation -= size; + png_error(png_ptr, + "out of memory in pngtest->png_debug_malloc"); + } + pinfo->next = pinformation; + pinformation = pinfo; + /* Make sure the caller isn't assuming zeroed memory. */ + png_memset(pinfo->pointer, 0xdd, pinfo->size); + if (verbose) + printf("png_malloc %lu bytes at %x\n", (unsigned long)size, + pinfo->pointer); + return (png_voidp)(pinfo->pointer); + } +} + +/* Free a pointer. It is removed from the list at the same time. */ +void +png_debug_free(png_structp png_ptr, png_voidp ptr) +{ + if (png_ptr == NULL) + fprintf(STDERR, "NULL pointer to png_debug_free.\n"); + if (ptr == 0) + { +#if 0 /* This happens all the time. */ + fprintf(STDERR, "WARNING: freeing NULL pointer\n"); +#endif + return; + } + + /* Unlink the element from the list. */ + { + memory_infop FAR *ppinfo = &pinformation; + for (;;) + { + memory_infop pinfo = *ppinfo; + if (pinfo->pointer == ptr) + { + *ppinfo = pinfo->next; + current_allocation -= pinfo->size; + if (current_allocation < 0) + fprintf(STDERR, "Duplicate free of memory\n"); + /* We must free the list element too, but first kill + the memory that is to be freed. */ + png_memset(ptr, 0x55, pinfo->size); + png_free_default(png_ptr, pinfo); + pinfo = NULL; + break; + } + if (pinfo->next == NULL) + { + fprintf(STDERR, "Pointer %x not found\n", (unsigned int)ptr); + break; + } + ppinfo = &pinfo->next; + } + } + + /* Finally free the data. */ + if (verbose) + printf("Freeing %x\n", ptr); + png_free_default(png_ptr, ptr); + ptr = NULL; +} +#endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */ +/* END of code to test memory allocation/deallocation */ + + +/* Demonstration of user chunk support of the sTER and vpAg chunks */ +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED + +/* (sTER is a public chunk not yet known by libpng. vpAg is a private +chunk used in ImageMagick to store "virtual page" size). */ + +static png_uint_32 user_chunk_data[4]; + + /* 0: sTER mode + 1 + * 1: vpAg width + * 2: vpAg height + * 3: vpAg units + */ + +static int read_user_chunk_callback(png_struct *png_ptr, + png_unknown_chunkp chunk) +{ + png_uint_32 + *my_user_chunk_data; + + /* Return one of the following: + * return (-n); chunk had an error + * return (0); did not recognize + * return (n); success + * + * The unknown chunk structure contains the chunk data: + * png_byte name[5]; + * png_byte *data; + * png_size_t size; + * + * Note that libpng has already taken care of the CRC handling. + */ + + if (chunk->name[0] == 115 && chunk->name[1] == 84 && /* s T */ + chunk->name[2] == 69 && chunk->name[3] == 82) /* E R */ + { + /* Found sTER chunk */ + if (chunk->size != 1) + return (-1); /* Error return */ + if (chunk->data[0] != 0 && chunk->data[0] != 1) + return (-1); /* Invalid mode */ + my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr); + my_user_chunk_data[0]=chunk->data[0]+1; + return (1); + } + + if (chunk->name[0] != 118 || chunk->name[1] != 112 || /* v p */ + chunk->name[2] != 65 || chunk->name[3] != 103) /* A g */ + return (0); /* Did not recognize */ + + /* Found ImageMagick vpAg chunk */ + + if (chunk->size != 9) + return (-1); /* Error return */ + + my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr); + + my_user_chunk_data[1]=png_get_uint_31(png_ptr, chunk->data); + my_user_chunk_data[2]=png_get_uint_31(png_ptr, chunk->data + 4); + my_user_chunk_data[3]=(png_uint_32)chunk->data[8]; + + return (1); + +} +#endif +/* END of code to demonstrate user chunk support */ + +/* Test one file */ +int +test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) +{ + static png_FILE_p fpin; + static png_FILE_p fpout; /* "static" prevents setjmp corruption */ + png_structp read_ptr; + png_infop read_info_ptr, end_info_ptr; +#ifdef PNG_WRITE_SUPPORTED + png_structp write_ptr; + png_infop write_info_ptr; + png_infop write_end_info_ptr; +#else + png_structp write_ptr = NULL; + png_infop write_info_ptr = NULL; + png_infop write_end_info_ptr = NULL; +#endif + png_bytep row_buf; + png_uint_32 y; + png_uint_32 width, height; + int num_pass, pass; + int bit_depth, color_type; +#ifdef PNG_SETJMP_SUPPORTED +#ifdef USE_FAR_KEYWORD + jmp_buf jmpbuf; +#endif +#endif + + char inbuf[256], outbuf[256]; + + row_buf = NULL; + + if ((fpin = fopen(inname, "rb")) == NULL) + { + fprintf(STDERR, "Could not find input file %s\n", inname); + return (1); + } + + if ((fpout = fopen(outname, "wb")) == NULL) + { + fprintf(STDERR, "Could not open output file %s\n", outname); + FCLOSE(fpin); + return (1); + } + + png_debug(0, "Allocating read and write structures"); +#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG + read_ptr = + png_create_read_struct_2(PNG_LIBPNG_VER_STRING, NULL, + NULL, NULL, NULL, + (png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free); +#else + read_ptr = + png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); +#endif +#ifndef PNG_STDIO_SUPPORTED + png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error, + pngtest_warning); +#endif + +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED + user_chunk_data[0] = 0; + user_chunk_data[1] = 0; + user_chunk_data[2] = 0; + user_chunk_data[3] = 0; + png_set_read_user_chunk_fn(read_ptr, user_chunk_data, + read_user_chunk_callback); + +#endif +#ifdef PNG_WRITE_SUPPORTED +#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG + write_ptr = + png_create_write_struct_2(PNG_LIBPNG_VER_STRING, NULL, + NULL, NULL, NULL, png_debug_malloc, png_debug_free); +#else + write_ptr = + png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); +#endif +#ifndef PNG_STDIO_SUPPORTED + png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error, + pngtest_warning); +#endif +#endif + png_debug(0, "Allocating read_info, write_info and end_info structures"); + read_info_ptr = png_create_info_struct(read_ptr); + end_info_ptr = png_create_info_struct(read_ptr); +#ifdef PNG_WRITE_SUPPORTED + write_info_ptr = png_create_info_struct(write_ptr); + write_end_info_ptr = png_create_info_struct(write_ptr); +#endif + +#ifdef PNG_SETJMP_SUPPORTED + png_debug(0, "Setting jmpbuf for read struct"); +#ifdef USE_FAR_KEYWORD + if (setjmp(jmpbuf)) +#else + if (setjmp(png_jmpbuf(read_ptr))) +#endif + { + fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname); + png_free(read_ptr, row_buf); + row_buf = NULL; + png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); +#ifdef PNG_WRITE_SUPPORTED + png_destroy_info_struct(write_ptr, &write_end_info_ptr); + png_destroy_write_struct(&write_ptr, &write_info_ptr); +#endif + FCLOSE(fpin); + FCLOSE(fpout); + return (1); + } +#ifdef USE_FAR_KEYWORD + png_memcpy(png_jmpbuf(read_ptr), jmpbuf, png_sizeof(jmp_buf)); +#endif + +#ifdef PNG_WRITE_SUPPORTED + png_debug(0, "Setting jmpbuf for write struct"); +#ifdef USE_FAR_KEYWORD + if (setjmp(jmpbuf)) +#else + if (setjmp(png_jmpbuf(write_ptr))) +#endif + { + fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname); + png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); + png_destroy_info_struct(write_ptr, &write_end_info_ptr); +#ifdef PNG_WRITE_SUPPORTED + png_destroy_write_struct(&write_ptr, &write_info_ptr); +#endif + FCLOSE(fpin); + FCLOSE(fpout); + return (1); + } +#ifdef USE_FAR_KEYWORD + png_memcpy(png_jmpbuf(write_ptr), jmpbuf, png_sizeof(jmp_buf)); +#endif +#endif +#endif + + png_debug(0, "Initializing input and output streams"); +#ifdef PNG_STDIO_SUPPORTED + png_init_io(read_ptr, fpin); +# ifdef PNG_WRITE_SUPPORTED + png_init_io(write_ptr, fpout); +# endif +#else + png_set_read_fn(read_ptr, (png_voidp)fpin, pngtest_read_data); +# ifdef PNG_WRITE_SUPPORTED + png_set_write_fn(write_ptr, (png_voidp)fpout, pngtest_write_data, +# ifdef PNG_WRITE_FLUSH_SUPPORTED + pngtest_flush); +# else + NULL); +# endif +# endif +#endif + if (status_dots_requested == 1) + { +#ifdef PNG_WRITE_SUPPORTED + png_set_write_status_fn(write_ptr, write_row_callback); +#endif + png_set_read_status_fn(read_ptr, read_row_callback); + } + else + { +#ifdef PNG_WRITE_SUPPORTED + png_set_write_status_fn(write_ptr, NULL); +#endif + png_set_read_status_fn(read_ptr, NULL); + } + +#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED + { + int i; + for (i = 0; i<256; i++) + filters_used[i] = 0; + png_set_read_user_transform_fn(read_ptr, count_filters); + } +#endif +#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED + zero_samples = 0; + png_set_write_user_transform_fn(write_ptr, count_zero_samples); +#endif + +#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +# ifndef PNG_HANDLE_CHUNK_ALWAYS +# define PNG_HANDLE_CHUNK_ALWAYS 3 +# endif + png_set_keep_unknown_chunks(read_ptr, PNG_HANDLE_CHUNK_ALWAYS, + NULL, 0); +#endif +#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED +# ifndef PNG_HANDLE_CHUNK_IF_SAFE +# define PNG_HANDLE_CHUNK_IF_SAFE 2 +# endif + png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_IF_SAFE, + NULL, 0); +#endif + + png_debug(0, "Reading info struct"); + png_read_info(read_ptr, read_info_ptr); + + png_debug(0, "Transferring info struct"); + { + int interlace_type, compression_type, filter_type; + + if (png_get_IHDR(read_ptr, read_info_ptr, &width, &height, &bit_depth, + &color_type, &interlace_type, &compression_type, &filter_type)) + { + png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth, +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + color_type, interlace_type, compression_type, filter_type); +#else + color_type, PNG_INTERLACE_NONE, compression_type, filter_type); +#endif + } + } +#ifdef PNG_FIXED_POINT_SUPPORTED +#ifdef PNG_cHRM_SUPPORTED + { + png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x, + blue_y; + if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y, + &red_x, &red_y, &green_x, &green_y, &blue_x, &blue_y)) + { + png_set_cHRM_fixed(write_ptr, write_info_ptr, white_x, white_y, red_x, + red_y, green_x, green_y, blue_x, blue_y); + } + } +#endif +#ifdef PNG_gAMA_SUPPORTED + { + png_fixed_point gamma; + + if (png_get_gAMA_fixed(read_ptr, read_info_ptr, &gamma)) + png_set_gAMA_fixed(write_ptr, write_info_ptr, gamma); + } +#endif +#else /* Use floating point versions */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +#ifdef PNG_cHRM_SUPPORTED + { + double white_x, white_y, red_x, red_y, green_x, green_y, blue_x, + blue_y; + if (png_get_cHRM(read_ptr, read_info_ptr, &white_x, &white_y, &red_x, + &red_y, &green_x, &green_y, &blue_x, &blue_y)) + { + png_set_cHRM(write_ptr, write_info_ptr, white_x, white_y, red_x, + red_y, green_x, green_y, blue_x, blue_y); + } + } +#endif +#ifdef PNG_gAMA_SUPPORTED + { + double gamma; + + if (png_get_gAMA(read_ptr, read_info_ptr, &gamma)) + png_set_gAMA(write_ptr, write_info_ptr, gamma); + } +#endif +#endif /* Floating point */ +#endif /* Fixed point */ +#ifdef PNG_iCCP_SUPPORTED + { + png_charp name; + png_charp profile; + png_uint_32 proflen; + int compression_type; + + if (png_get_iCCP(read_ptr, read_info_ptr, &name, &compression_type, + &profile, &proflen)) + { + png_set_iCCP(write_ptr, write_info_ptr, name, compression_type, + profile, proflen); + } + } +#endif +#ifdef PNG_sRGB_SUPPORTED + { + int intent; + + if (png_get_sRGB(read_ptr, read_info_ptr, &intent)) + png_set_sRGB(write_ptr, write_info_ptr, intent); + } +#endif + { + png_colorp palette; + int num_palette; + + if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette)) + png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette); + } +#ifdef PNG_bKGD_SUPPORTED + { + png_color_16p background; + + if (png_get_bKGD(read_ptr, read_info_ptr, &background)) + { + png_set_bKGD(write_ptr, write_info_ptr, background); + } + } +#endif +#ifdef PNG_hIST_SUPPORTED + { + png_uint_16p hist; + + if (png_get_hIST(read_ptr, read_info_ptr, &hist)) + png_set_hIST(write_ptr, write_info_ptr, hist); + } +#endif +#ifdef PNG_oFFs_SUPPORTED + { + png_int_32 offset_x, offset_y; + int unit_type; + + if (png_get_oFFs(read_ptr, read_info_ptr, &offset_x, &offset_y, + &unit_type)) + { + png_set_oFFs(write_ptr, write_info_ptr, offset_x, offset_y, unit_type); + } + } +#endif +#ifdef PNG_pCAL_SUPPORTED + { + png_charp purpose, units; + png_charpp params; + png_int_32 X0, X1; + int type, nparams; + + if (png_get_pCAL(read_ptr, read_info_ptr, &purpose, &X0, &X1, &type, + &nparams, &units, ¶ms)) + { + png_set_pCAL(write_ptr, write_info_ptr, purpose, X0, X1, type, + nparams, units, params); + } + } +#endif +#ifdef PNG_pHYs_SUPPORTED + { + png_uint_32 res_x, res_y; + int unit_type; + + if (png_get_pHYs(read_ptr, read_info_ptr, &res_x, &res_y, &unit_type)) + png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type); + } +#endif +#ifdef PNG_sBIT_SUPPORTED + { + png_color_8p sig_bit; + + if (png_get_sBIT(read_ptr, read_info_ptr, &sig_bit)) + png_set_sBIT(write_ptr, write_info_ptr, sig_bit); + } +#endif +#ifdef PNG_sCAL_SUPPORTED +#ifdef PNG_FLOATING_POINT_SUPPORTED + { + int unit; + double scal_width, scal_height; + + if (png_get_sCAL(read_ptr, read_info_ptr, &unit, &scal_width, + &scal_height)) + { + png_set_sCAL(write_ptr, write_info_ptr, unit, scal_width, scal_height); + } + } +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + { + int unit; + png_charp scal_width, scal_height; + + if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &scal_width, + &scal_height)) + { + png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width, + scal_height); + } + } +#endif +#endif +#endif +#ifdef PNG_TEXT_SUPPORTED + { + png_textp text_ptr; + int num_text; + + if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0) + { + png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text); + png_set_text(write_ptr, write_info_ptr, text_ptr, num_text); + } + } +#endif +#ifdef PNG_tIME_SUPPORTED + { + png_timep mod_time; + + if (png_get_tIME(read_ptr, read_info_ptr, &mod_time)) + { + png_set_tIME(write_ptr, write_info_ptr, mod_time); +#ifdef PNG_TIME_RFC1123_SUPPORTED + /* We have to use png_memcpy instead of "=" because the string + * pointed to by png_convert_to_rfc1123() gets free'ed before + * we use it. + */ + png_memcpy(tIME_string, + png_convert_to_rfc1123(read_ptr, mod_time), + png_sizeof(tIME_string)); + tIME_string[png_sizeof(tIME_string) - 1] = '\0'; + tIME_chunk_present++; +#endif /* PNG_TIME_RFC1123_SUPPORTED */ + } + } +#endif +#ifdef PNG_tRNS_SUPPORTED + { + png_bytep trans_alpha; + int num_trans; + png_color_16p trans_color; + + if (png_get_tRNS(read_ptr, read_info_ptr, &trans_alpha, &num_trans, + &trans_color)) + { + int sample_max = (1 << bit_depth); + /* libpng doesn't reject a tRNS chunk with out-of-range samples */ + if (!((color_type == PNG_COLOR_TYPE_GRAY && + (int)trans_color->gray > sample_max) || + (color_type == PNG_COLOR_TYPE_RGB && + ((int)trans_color->red > sample_max || + (int)trans_color->green > sample_max || + (int)trans_color->blue > sample_max)))) + png_set_tRNS(write_ptr, write_info_ptr, trans_alpha, num_trans, + trans_color); + } + } +#endif +#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED + { + png_unknown_chunkp unknowns; + int num_unknowns = (int)png_get_unknown_chunks(read_ptr, read_info_ptr, + &unknowns); + if (num_unknowns) + { + png_size_t i; + png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns, + num_unknowns); + /* Copy the locations from the read_info_ptr. The automatically + * generated locations in write_info_ptr are wrong because we + * haven't written anything yet. + */ + for (i = 0; i < (png_size_t)num_unknowns; i++) + png_set_unknown_chunk_location(write_ptr, write_info_ptr, i, + unknowns[i].location); + } + } +#endif + +#ifdef PNG_WRITE_SUPPORTED + png_debug(0, "Writing info struct"); + +/* If we wanted, we could write info in two steps: + * png_write_info_before_PLTE(write_ptr, write_info_ptr); + */ + png_write_info(write_ptr, write_info_ptr); + +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED + if (user_chunk_data[0] != 0) + { + png_byte png_sTER[5] = {115, 84, 69, 82, '\0'}; + + unsigned char + ster_chunk_data[1]; + + if (verbose) + fprintf(STDERR, "\n stereo mode = %lu\n", + (unsigned long)(user_chunk_data[0] - 1)); + ster_chunk_data[0]=(unsigned char)(user_chunk_data[0] - 1); + png_write_chunk(write_ptr, png_sTER, ster_chunk_data, 1); + } + if (user_chunk_data[1] != 0 || user_chunk_data[2] != 0) + { + png_byte png_vpAg[5] = {118, 112, 65, 103, '\0'}; + + unsigned char + vpag_chunk_data[9]; + + if (verbose) + fprintf(STDERR, " vpAg = %lu x %lu, units = %lu\n", + (unsigned long)user_chunk_data[1], + (unsigned long)user_chunk_data[2], + (unsigned long)user_chunk_data[3]); + png_save_uint_32(vpag_chunk_data, user_chunk_data[1]); + png_save_uint_32(vpag_chunk_data + 4, user_chunk_data[2]); + vpag_chunk_data[8] = (unsigned char)(user_chunk_data[3] & 0xff); + png_write_chunk(write_ptr, png_vpAg, vpag_chunk_data, 9); + } + +#endif +#endif + +#ifdef SINGLE_ROWBUF_ALLOC + png_debug(0, "Allocating row buffer..."); + row_buf = (png_bytep)png_malloc(read_ptr, + png_get_rowbytes(read_ptr, read_info_ptr)); + png_debug1(0, "0x%08lx", (unsigned long)row_buf); +#endif /* SINGLE_ROWBUF_ALLOC */ + png_debug(0, "Writing row data"); + +#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ + defined(PNG_WRITE_INTERLACING_SUPPORTED) + num_pass = png_set_interlace_handling(read_ptr); +# ifdef PNG_WRITE_SUPPORTED + png_set_interlace_handling(write_ptr); +# endif +#else + num_pass = 1; +#endif + +#ifdef PNGTEST_TIMING + t_stop = (float)clock(); + t_misc += (t_stop - t_start); + t_start = t_stop; +#endif + for (pass = 0; pass < num_pass; pass++) + { + png_debug1(0, "Writing row data for pass %d", pass); + for (y = 0; y < height; y++) + { +#ifndef SINGLE_ROWBUF_ALLOC + png_debug2(0, "Allocating row buffer (pass %d, y = %ld)...", pass, y); + row_buf = (png_bytep)png_malloc(read_ptr, + png_get_rowbytes(read_ptr, read_info_ptr)); + png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf, + png_get_rowbytes(read_ptr, read_info_ptr)); +#endif /* !SINGLE_ROWBUF_ALLOC */ + png_read_rows(read_ptr, (png_bytepp)&row_buf, NULL, 1); + +#ifdef PNG_WRITE_SUPPORTED +#ifdef PNGTEST_TIMING + t_stop = (float)clock(); + t_decode += (t_stop - t_start); + t_start = t_stop; +#endif + png_write_rows(write_ptr, (png_bytepp)&row_buf, 1); +#ifdef PNGTEST_TIMING + t_stop = (float)clock(); + t_encode += (t_stop - t_start); + t_start = t_stop; +#endif +#endif /* PNG_WRITE_SUPPORTED */ + +#ifndef SINGLE_ROWBUF_ALLOC + png_debug2(0, "Freeing row buffer (pass %d, y = %ld)", pass, y); + png_free(read_ptr, row_buf); + row_buf = NULL; +#endif /* !SINGLE_ROWBUF_ALLOC */ + } + } + +#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED + png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1); +#endif +#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED + png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1); +#endif + + png_debug(0, "Reading and writing end_info data"); + + png_read_end(read_ptr, end_info_ptr); +#ifdef PNG_TEXT_SUPPORTED + { + png_textp text_ptr; + int num_text; + + if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0) + { + png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text); + png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text); + } + } +#endif +#ifdef PNG_tIME_SUPPORTED + { + png_timep mod_time; + + if (png_get_tIME(read_ptr, end_info_ptr, &mod_time)) + { + png_set_tIME(write_ptr, write_end_info_ptr, mod_time); +#ifdef PNG_TIME_RFC1123_SUPPORTED + /* We have to use png_memcpy instead of "=" because the string + pointed to by png_convert_to_rfc1123() gets free'ed before + we use it */ + png_memcpy(tIME_string, + png_convert_to_rfc1123(read_ptr, mod_time), + png_sizeof(tIME_string)); + tIME_string[png_sizeof(tIME_string) - 1] = '\0'; + tIME_chunk_present++; +#endif /* PNG_TIME_RFC1123_SUPPORTED */ + } + } +#endif +#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED + { + png_unknown_chunkp unknowns; + int num_unknowns; + num_unknowns = (int)png_get_unknown_chunks(read_ptr, end_info_ptr, + &unknowns); + if (num_unknowns) + { + png_size_t i; + png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns, + num_unknowns); + /* Copy the locations from the read_info_ptr. The automatically + * generated locations in write_end_info_ptr are wrong because we + * haven't written the end_info yet. + */ + for (i = 0; i < (png_size_t)num_unknowns; i++) + png_set_unknown_chunk_location(write_ptr, write_end_info_ptr, i, + unknowns[i].location); + } + } +#endif +#ifdef PNG_WRITE_SUPPORTED + png_write_end(write_ptr, write_end_info_ptr); +#endif + +#ifdef PNG_EASY_ACCESS_SUPPORTED + if (verbose) + { + png_uint_32 iwidth, iheight; + iwidth = png_get_image_width(write_ptr, write_info_ptr); + iheight = png_get_image_height(write_ptr, write_info_ptr); + fprintf(STDERR, "\n Image width = %lu, height = %lu\n", + (unsigned long)iwidth, (unsigned long)iheight); + } +#endif + + png_debug(0, "Destroying data structs"); +#ifdef SINGLE_ROWBUF_ALLOC + png_debug(1, "destroying row_buf for read_ptr"); + png_free(read_ptr, row_buf); + row_buf = NULL; +#endif /* SINGLE_ROWBUF_ALLOC */ + png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr"); + png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); +#ifdef PNG_WRITE_SUPPORTED + png_debug(1, "destroying write_end_info_ptr"); + png_destroy_info_struct(write_ptr, &write_end_info_ptr); + png_debug(1, "destroying write_ptr, write_info_ptr"); + png_destroy_write_struct(&write_ptr, &write_info_ptr); +#endif + png_debug(0, "Destruction complete."); + + FCLOSE(fpin); + FCLOSE(fpout); + + png_debug(0, "Opening files for comparison"); + if ((fpin = fopen(inname, "rb")) == NULL) + { + fprintf(STDERR, "Could not find file %s\n", inname); + return (1); + } + + if ((fpout = fopen(outname, "rb")) == NULL) + { + fprintf(STDERR, "Could not find file %s\n", outname); + FCLOSE(fpin); + return (1); + } + + for (;;) + { + png_size_t num_in, num_out; + + num_in = fread(inbuf, 1, 1, fpin); + num_out = fread(outbuf, 1, 1, fpout); + + if (num_in != num_out) + { + fprintf(STDERR, "\nFiles %s and %s are of a different size\n", + inname, outname); + if (wrote_question == 0) + { + fprintf(STDERR, + " Was %s written with the same maximum IDAT chunk size (%d bytes),", + inname, PNG_ZBUF_SIZE); + fprintf(STDERR, + "\n filtering heuristic (libpng default), compression"); + fprintf(STDERR, + " level (zlib default),\n and zlib version (%s)?\n\n", + ZLIB_VERSION); + wrote_question = 1; + } + FCLOSE(fpin); + FCLOSE(fpout); + return (0); + } + + if (!num_in) + break; + + if (png_memcmp(inbuf, outbuf, num_in)) + { + fprintf(STDERR, "\nFiles %s and %s are different\n", inname, outname); + if (wrote_question == 0) + { + fprintf(STDERR, + " Was %s written with the same maximum IDAT chunk size (%d bytes),", + inname, PNG_ZBUF_SIZE); + fprintf(STDERR, + "\n filtering heuristic (libpng default), compression"); + fprintf(STDERR, + " level (zlib default),\n and zlib version (%s)?\n\n", + ZLIB_VERSION); + wrote_question = 1; + } + FCLOSE(fpin); + FCLOSE(fpout); + return (0); + } + } + + FCLOSE(fpin); + FCLOSE(fpout); + + return (0); +} + +/* Input and output filenames */ +#ifdef RISCOS +static PNG_CONST char *inname = "pngtest/png"; +static PNG_CONST char *outname = "pngout/png"; +#else +static PNG_CONST char *inname = "pngtest.png"; +static PNG_CONST char *outname = "pngout.png"; +#endif + +int +main(int argc, char *argv[]) +{ + int multiple = 0; + int ierror = 0; + + fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING); + fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION); + fprintf(STDERR, "%s", png_get_copyright(NULL)); + /* Show the version of libpng used in building the library */ + fprintf(STDERR, " library (%lu):%s", + (unsigned long)png_access_version_number(), + png_get_header_version(NULL)); + /* Show the version of libpng used in building the application */ + fprintf(STDERR, " pngtest (%lu):%s", (unsigned long)PNG_LIBPNG_VER, + PNG_HEADER_VERSION_STRING); + fprintf(STDERR, " sizeof(png_struct)=%ld, sizeof(png_info)=%ld\n", + (long)png_sizeof(png_struct), (long)png_sizeof(png_info)); + + /* Do some consistency checking on the memory allocation settings, I'm + * not sure this matters, but it is nice to know, the first of these + * tests should be impossible because of the way the macros are set + * in pngconf.h + */ +#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) + fprintf(STDERR, " NOTE: Zlib compiled for max 64k, libpng not\n"); +#endif + /* I think the following can happen. */ +#if !defined(MAXSEG_64K) && defined(PNG_MAX_MALLOC_64K) + fprintf(STDERR, " NOTE: libpng compiled for max 64k, zlib not\n"); +#endif + + if (strcmp(png_libpng_ver, PNG_LIBPNG_VER_STRING)) + { + fprintf(STDERR, + "Warning: versions are different between png.h and png.c\n"); + fprintf(STDERR, " png.h version: %s\n", PNG_LIBPNG_VER_STRING); + fprintf(STDERR, " png.c version: %s\n\n", png_libpng_ver); + ++ierror; + } + + if (argc > 1) + { + if (strcmp(argv[1], "-m") == 0) + { + multiple = 1; + status_dots_requested = 0; + } + else if (strcmp(argv[1], "-mv") == 0 || + strcmp(argv[1], "-vm") == 0 ) + { + multiple = 1; + verbose = 1; + status_dots_requested = 1; + } + else if (strcmp(argv[1], "-v") == 0) + { + verbose = 1; + status_dots_requested = 1; + inname = argv[2]; + } + else + { + inname = argv[1]; + status_dots_requested = 0; + } + } + + if (!multiple && argc == 3 + verbose) + outname = argv[2 + verbose]; + + if ((!multiple && argc > 3 + verbose) || (multiple && argc < 2)) + { + fprintf(STDERR, + "usage: %s [infile.png] [outfile.png]\n\t%s -m {infile.png}\n", + argv[0], argv[0]); + fprintf(STDERR, + " reads/writes one PNG file (without -m) or multiple files (-m)\n"); + fprintf(STDERR, + " with -m %s is used as a temporary file\n", outname); + exit(1); + } + + if (multiple) + { + int i; +#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG + int allocation_now = current_allocation; +#endif + for (i=2; isize, + (unsigned int) pinfo->pointer); + pinfo = pinfo->next; + } + } +#endif + } +#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG + fprintf(STDERR, " Current memory allocation: %10d bytes\n", + current_allocation); + fprintf(STDERR, " Maximum memory allocation: %10d bytes\n", + maximum_allocation); + fprintf(STDERR, " Total memory allocation: %10d bytes\n", + total_allocation); + fprintf(STDERR, " Number of allocations: %10d\n", + num_allocations); +#endif + } + else + { + int i; + for (i = 0; i<3; ++i) + { + int kerror; +#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG + int allocation_now = current_allocation; +#endif + if (i == 1) status_dots_requested = 1; + else if (verbose == 0)status_dots_requested = 0; + if (i == 0 || verbose == 1 || ierror != 0) + fprintf(STDERR, "\n Testing %s:", inname); + kerror = test_one_file(inname, outname); + if (kerror == 0) + { + if (verbose == 1 || i == 2) + { +#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED + int k; +#endif +#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED + fprintf(STDERR, "\n PASS (%lu zero samples)\n", + (unsigned long)zero_samples); +#else + fprintf(STDERR, " PASS\n"); +#endif +#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED + for (k = 0; k<256; k++) + if (filters_used[k]) + fprintf(STDERR, " Filter %d was used %lu times\n", + k, (unsigned long)filters_used[k]); +#endif +#ifdef PNG_TIME_RFC1123_SUPPORTED + if (tIME_chunk_present != 0) + fprintf(STDERR, " tIME = %s\n", tIME_string); +#endif /* PNG_TIME_RFC1123_SUPPORTED */ + } + } + else + { + if (verbose == 0 && i != 2) + fprintf(STDERR, "\n Testing %s:", inname); + fprintf(STDERR, " FAIL\n"); + ierror += kerror; + } +#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG + if (allocation_now != current_allocation) + fprintf(STDERR, "MEMORY ERROR: %d bytes lost\n", + current_allocation - allocation_now); + if (current_allocation != 0) + { + memory_infop pinfo = pinformation; + + fprintf(STDERR, "MEMORY ERROR: %d bytes still allocated\n", + current_allocation); + while (pinfo != NULL) + { + fprintf(STDERR, " %lu bytes at %x\n", + (unsigned long)pinfo->size, (unsigned int)pinfo->pointer); + pinfo = pinfo->next; + } + } +#endif + } +#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG + fprintf(STDERR, " Current memory allocation: %10d bytes\n", + current_allocation); + fprintf(STDERR, " Maximum memory allocation: %10d bytes\n", + maximum_allocation); + fprintf(STDERR, " Total memory allocation: %10d bytes\n", + total_allocation); + fprintf(STDERR, " Number of allocations: %10d\n", + num_allocations); +#endif + } + +#ifdef PNGTEST_TIMING + t_stop = (float)clock(); + t_misc += (t_stop - t_start); + t_start = t_stop; + fprintf(STDERR, " CPU time used = %.3f seconds", + (t_misc+t_decode+t_encode)/(float)CLOCKS_PER_SEC); + fprintf(STDERR, " (decoding %.3f,\n", + t_decode/(float)CLOCKS_PER_SEC); + fprintf(STDERR, " encoding %.3f ,", + t_encode/(float)CLOCKS_PER_SEC); + fprintf(STDERR, " other %.3f seconds)\n\n", + t_misc/(float)CLOCKS_PER_SEC); +#endif + + if (ierror == 0) + fprintf(STDERR, " libpng passes test\n"); + else + fprintf(STDERR, " libpng FAILS test\n"); + return (int)(ierror != 0); +} + +/* Generate a compiler error if there is an old png.h in the search path. */ +typedef version_1_4_3 your_png_h_is_not_version_1_4_3; diff --git a/png/pngtest.png b/png/pngtest.png new file mode 100644 index 0000000..cfdd36f Binary files /dev/null and b/png/pngtest.png differ diff --git a/png/pngtrans.c b/png/pngtrans.c new file mode 100644 index 0000000..f80679a --- /dev/null +++ b/png/pngtrans.c @@ -0,0 +1,677 @@ + +/* pngtrans.c - transforms the data in a row (used by both readers and writers) + * + * Last changed in libpng 1.4.2 [April 29, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) +#include "pngpriv.h" + +#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) +/* Turn on BGR-to-RGB mapping */ +void PNGAPI +png_set_bgr(png_structp png_ptr) +{ + png_debug(1, "in png_set_bgr"); + + if (png_ptr == NULL) + return; + png_ptr->transformations |= PNG_BGR; +} +#endif + +#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) +/* Turn on 16 bit byte swapping */ +void PNGAPI +png_set_swap(png_structp png_ptr) +{ + png_debug(1, "in png_set_swap"); + + if (png_ptr == NULL) + return; + if (png_ptr->bit_depth == 16) + png_ptr->transformations |= PNG_SWAP_BYTES; +} +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) +/* Turn on pixel packing */ +void PNGAPI +png_set_packing(png_structp png_ptr) +{ + png_debug(1, "in png_set_packing"); + + if (png_ptr == NULL) + return; + if (png_ptr->bit_depth < 8) + { + png_ptr->transformations |= PNG_PACK; + png_ptr->usr_bit_depth = 8; + } +} +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) +/* Turn on packed pixel swapping */ +void PNGAPI +png_set_packswap(png_structp png_ptr) +{ + png_debug(1, "in png_set_packswap"); + + if (png_ptr == NULL) + return; + if (png_ptr->bit_depth < 8) + png_ptr->transformations |= PNG_PACKSWAP; +} +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) +void PNGAPI +png_set_shift(png_structp png_ptr, png_color_8p true_bits) +{ + png_debug(1, "in png_set_shift"); + + if (png_ptr == NULL) + return; + png_ptr->transformations |= PNG_SHIFT; + png_ptr->shift = *true_bits; +} +#endif + +#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ + defined(PNG_WRITE_INTERLACING_SUPPORTED) +int PNGAPI +png_set_interlace_handling(png_structp png_ptr) +{ + png_debug(1, "in png_set_interlace handling"); + + if (png_ptr && png_ptr->interlaced) + { + png_ptr->transformations |= PNG_INTERLACE; + return (7); + } + + return (1); +} +#endif + +#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) +/* Add a filler byte on read, or remove a filler or alpha byte on write. + * The filler type has changed in v0.95 to allow future 2-byte fillers + * for 48-bit input data, as well as to avoid problems with some compilers + * that don't like bytes as parameters. + */ +void PNGAPI +png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc) +{ + png_debug(1, "in png_set_filler"); + + if (png_ptr == NULL) + return; + png_ptr->transformations |= PNG_FILLER; + png_ptr->filler = (png_uint_16)filler; + if (filler_loc == PNG_FILLER_AFTER) + png_ptr->flags |= PNG_FLAG_FILLER_AFTER; + else + png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER; + + /* This should probably go in the "do_read_filler" routine. + * I attempted to do that in libpng-1.0.1a but that caused problems + * so I restored it in libpng-1.0.2a + */ + + if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) + { + png_ptr->usr_channels = 4; + } + + /* Also I added this in libpng-1.0.2a (what happens when we expand + * a less-than-8-bit grayscale to GA? */ + + if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8) + { + png_ptr->usr_channels = 2; + } +} + +/* Added to libpng-1.2.7 */ +void PNGAPI +png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc) +{ + png_debug(1, "in png_set_add_alpha"); + + if (png_ptr == NULL) + return; + png_set_filler(png_ptr, filler, filler_loc); + png_ptr->transformations |= PNG_ADD_ALPHA; +} + +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ + defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) +void PNGAPI +png_set_swap_alpha(png_structp png_ptr) +{ + png_debug(1, "in png_set_swap_alpha"); + + if (png_ptr == NULL) + return; + png_ptr->transformations |= PNG_SWAP_ALPHA; +} +#endif + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ + defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) +void PNGAPI +png_set_invert_alpha(png_structp png_ptr) +{ + png_debug(1, "in png_set_invert_alpha"); + + if (png_ptr == NULL) + return; + png_ptr->transformations |= PNG_INVERT_ALPHA; +} +#endif + +#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) +void PNGAPI +png_set_invert_mono(png_structp png_ptr) +{ + png_debug(1, "in png_set_invert_mono"); + + if (png_ptr == NULL) + return; + png_ptr->transformations |= PNG_INVERT_MONO; +} + +/* Invert monochrome grayscale data */ +void /* PRIVATE */ +png_do_invert(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_invert"); + + /* This test removed from libpng version 1.0.13 and 1.2.0: + * if (row_info->bit_depth == 1 && + */ + if (row_info->color_type == PNG_COLOR_TYPE_GRAY) + { + png_bytep rp = row; + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + + for (i = 0; i < istop; i++) + { + *rp = (png_byte)(~(*rp)); + rp++; + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && + row_info->bit_depth == 8) + { + png_bytep rp = row; + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + + for (i = 0; i < istop; i+=2) + { + *rp = (png_byte)(~(*rp)); + rp+=2; + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && + row_info->bit_depth == 16) + { + png_bytep rp = row; + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + + for (i = 0; i < istop; i+=4) + { + *rp = (png_byte)(~(*rp)); + *(rp+1) = (png_byte)(~(*(rp+1))); + rp+=4; + } + } +} +#endif + +#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) +/* Swaps byte order on 16 bit depth images */ +void /* PRIVATE */ +png_do_swap(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_swap"); + + if ( + row_info->bit_depth == 16) + { + png_bytep rp = row; + png_uint_32 i; + png_uint_32 istop= row_info->width * row_info->channels; + + for (i = 0; i < istop; i++, rp += 2) + { + png_byte t = *rp; + *rp = *(rp + 1); + *(rp + 1) = t; + } + } +} +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) +static PNG_CONST png_byte onebppswaptable[256] = { + 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, + 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, + 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, + 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, + 0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, + 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4, + 0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, + 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC, + 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, + 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2, + 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, + 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA, + 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, + 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6, + 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, + 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE, + 0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, + 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1, + 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, + 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9, + 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, + 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5, + 0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, + 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD, + 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, + 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, + 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, + 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB, + 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, + 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7, + 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, + 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF +}; + +static PNG_CONST png_byte twobppswaptable[256] = { + 0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0, + 0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0, + 0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4, + 0x24, 0x64, 0xA4, 0xE4, 0x34, 0x74, 0xB4, 0xF4, + 0x08, 0x48, 0x88, 0xC8, 0x18, 0x58, 0x98, 0xD8, + 0x28, 0x68, 0xA8, 0xE8, 0x38, 0x78, 0xB8, 0xF8, + 0x0C, 0x4C, 0x8C, 0xCC, 0x1C, 0x5C, 0x9C, 0xDC, + 0x2C, 0x6C, 0xAC, 0xEC, 0x3C, 0x7C, 0xBC, 0xFC, + 0x01, 0x41, 0x81, 0xC1, 0x11, 0x51, 0x91, 0xD1, + 0x21, 0x61, 0xA1, 0xE1, 0x31, 0x71, 0xB1, 0xF1, + 0x05, 0x45, 0x85, 0xC5, 0x15, 0x55, 0x95, 0xD5, + 0x25, 0x65, 0xA5, 0xE5, 0x35, 0x75, 0xB5, 0xF5, + 0x09, 0x49, 0x89, 0xC9, 0x19, 0x59, 0x99, 0xD9, + 0x29, 0x69, 0xA9, 0xE9, 0x39, 0x79, 0xB9, 0xF9, + 0x0D, 0x4D, 0x8D, 0xCD, 0x1D, 0x5D, 0x9D, 0xDD, + 0x2D, 0x6D, 0xAD, 0xED, 0x3D, 0x7D, 0xBD, 0xFD, + 0x02, 0x42, 0x82, 0xC2, 0x12, 0x52, 0x92, 0xD2, + 0x22, 0x62, 0xA2, 0xE2, 0x32, 0x72, 0xB2, 0xF2, + 0x06, 0x46, 0x86, 0xC6, 0x16, 0x56, 0x96, 0xD6, + 0x26, 0x66, 0xA6, 0xE6, 0x36, 0x76, 0xB6, 0xF6, + 0x0A, 0x4A, 0x8A, 0xCA, 0x1A, 0x5A, 0x9A, 0xDA, + 0x2A, 0x6A, 0xAA, 0xEA, 0x3A, 0x7A, 0xBA, 0xFA, + 0x0E, 0x4E, 0x8E, 0xCE, 0x1E, 0x5E, 0x9E, 0xDE, + 0x2E, 0x6E, 0xAE, 0xEE, 0x3E, 0x7E, 0xBE, 0xFE, + 0x03, 0x43, 0x83, 0xC3, 0x13, 0x53, 0x93, 0xD3, + 0x23, 0x63, 0xA3, 0xE3, 0x33, 0x73, 0xB3, 0xF3, + 0x07, 0x47, 0x87, 0xC7, 0x17, 0x57, 0x97, 0xD7, + 0x27, 0x67, 0xA7, 0xE7, 0x37, 0x77, 0xB7, 0xF7, + 0x0B, 0x4B, 0x8B, 0xCB, 0x1B, 0x5B, 0x9B, 0xDB, + 0x2B, 0x6B, 0xAB, 0xEB, 0x3B, 0x7B, 0xBB, 0xFB, + 0x0F, 0x4F, 0x8F, 0xCF, 0x1F, 0x5F, 0x9F, 0xDF, + 0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF +}; + +static PNG_CONST png_byte fourbppswaptable[256] = { + 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, + 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, + 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, + 0x81, 0x91, 0xA1, 0xB1, 0xC1, 0xD1, 0xE1, 0xF1, + 0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x62, 0x72, + 0x82, 0x92, 0xA2, 0xB2, 0xC2, 0xD2, 0xE2, 0xF2, + 0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73, + 0x83, 0x93, 0xA3, 0xB3, 0xC3, 0xD3, 0xE3, 0xF3, + 0x04, 0x14, 0x24, 0x34, 0x44, 0x54, 0x64, 0x74, + 0x84, 0x94, 0xA4, 0xB4, 0xC4, 0xD4, 0xE4, 0xF4, + 0x05, 0x15, 0x25, 0x35, 0x45, 0x55, 0x65, 0x75, + 0x85, 0x95, 0xA5, 0xB5, 0xC5, 0xD5, 0xE5, 0xF5, + 0x06, 0x16, 0x26, 0x36, 0x46, 0x56, 0x66, 0x76, + 0x86, 0x96, 0xA6, 0xB6, 0xC6, 0xD6, 0xE6, 0xF6, + 0x07, 0x17, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77, + 0x87, 0x97, 0xA7, 0xB7, 0xC7, 0xD7, 0xE7, 0xF7, + 0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x68, 0x78, + 0x88, 0x98, 0xA8, 0xB8, 0xC8, 0xD8, 0xE8, 0xF8, + 0x09, 0x19, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79, + 0x89, 0x99, 0xA9, 0xB9, 0xC9, 0xD9, 0xE9, 0xF9, + 0x0A, 0x1A, 0x2A, 0x3A, 0x4A, 0x5A, 0x6A, 0x7A, + 0x8A, 0x9A, 0xAA, 0xBA, 0xCA, 0xDA, 0xEA, 0xFA, + 0x0B, 0x1B, 0x2B, 0x3B, 0x4B, 0x5B, 0x6B, 0x7B, + 0x8B, 0x9B, 0xAB, 0xBB, 0xCB, 0xDB, 0xEB, 0xFB, + 0x0C, 0x1C, 0x2C, 0x3C, 0x4C, 0x5C, 0x6C, 0x7C, + 0x8C, 0x9C, 0xAC, 0xBC, 0xCC, 0xDC, 0xEC, 0xFC, + 0x0D, 0x1D, 0x2D, 0x3D, 0x4D, 0x5D, 0x6D, 0x7D, + 0x8D, 0x9D, 0xAD, 0xBD, 0xCD, 0xDD, 0xED, 0xFD, + 0x0E, 0x1E, 0x2E, 0x3E, 0x4E, 0x5E, 0x6E, 0x7E, + 0x8E, 0x9E, 0xAE, 0xBE, 0xCE, 0xDE, 0xEE, 0xFE, + 0x0F, 0x1F, 0x2F, 0x3F, 0x4F, 0x5F, 0x6F, 0x7F, + 0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF +}; + +/* Swaps pixel packing order within bytes */ +void /* PRIVATE */ +png_do_packswap(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_packswap"); + + if ( + row_info->bit_depth < 8) + { + png_bytep rp, end, table; + + end = row + row_info->rowbytes; + + if (row_info->bit_depth == 1) + table = (png_bytep)onebppswaptable; + else if (row_info->bit_depth == 2) + table = (png_bytep)twobppswaptable; + else if (row_info->bit_depth == 4) + table = (png_bytep)fourbppswaptable; + else + return; + + for (rp = row; rp < end; rp++) + *rp = table[*rp]; + } +} +#endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */ + +#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ + defined(PNG_READ_STRIP_ALPHA_SUPPORTED) +/* Remove filler or alpha byte(s) */ +void /* PRIVATE */ +png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags) +{ + png_debug(1, "in png_do_strip_filler"); + + { + png_bytep sp=row; + png_bytep dp=row; + png_uint_32 row_width=row_info->width; + png_uint_32 i; + + if ((row_info->color_type == PNG_COLOR_TYPE_RGB || + (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA && + (flags & PNG_FLAG_STRIP_ALPHA))) && + row_info->channels == 4) + { + if (row_info->bit_depth == 8) + { + /* This converts from RGBX or RGBA to RGB */ + if (flags & PNG_FLAG_FILLER_AFTER) + { + dp+=3; sp+=4; + for (i = 1; i < row_width; i++) + { + *dp++ = *sp++; + *dp++ = *sp++; + *dp++ = *sp++; + sp++; + } + } + /* This converts from XRGB or ARGB to RGB */ + else + { + for (i = 0; i < row_width; i++) + { + sp++; + *dp++ = *sp++; + *dp++ = *sp++; + *dp++ = *sp++; + } + } + row_info->pixel_depth = 24; + row_info->rowbytes = row_width * 3; + } + else /* if (row_info->bit_depth == 16) */ + { + if (flags & PNG_FLAG_FILLER_AFTER) + { + /* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */ + sp += 8; dp += 6; + for (i = 1; i < row_width; i++) + { + /* This could be (although png_memcpy is probably slower): + png_memcpy(dp, sp, 6); + sp += 8; + dp += 6; + */ + + *dp++ = *sp++; + *dp++ = *sp++; + *dp++ = *sp++; + *dp++ = *sp++; + *dp++ = *sp++; + *dp++ = *sp++; + sp += 2; + } + } + else + { + /* This converts from XXRRGGBB or AARRGGBB to RRGGBB */ + for (i = 0; i < row_width; i++) + { + /* This could be (although png_memcpy is probably slower): + png_memcpy(dp, sp, 6); + sp += 8; + dp += 6; + */ + + sp+=2; + *dp++ = *sp++; + *dp++ = *sp++; + *dp++ = *sp++; + *dp++ = *sp++; + *dp++ = *sp++; + *dp++ = *sp++; + } + } + row_info->pixel_depth = 48; + row_info->rowbytes = row_width * 6; + } + row_info->channels = 3; + } + else if ((row_info->color_type == PNG_COLOR_TYPE_GRAY || + (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && + (flags & PNG_FLAG_STRIP_ALPHA))) && + row_info->channels == 2) + { + if (row_info->bit_depth == 8) + { + /* This converts from GX or GA to G */ + if (flags & PNG_FLAG_FILLER_AFTER) + { + for (i = 0; i < row_width; i++) + { + *dp++ = *sp++; + sp++; + } + } + /* This converts from XG or AG to G */ + else + { + for (i = 0; i < row_width; i++) + { + sp++; + *dp++ = *sp++; + } + } + row_info->pixel_depth = 8; + row_info->rowbytes = row_width; + } + else /* if (row_info->bit_depth == 16) */ + { + if (flags & PNG_FLAG_FILLER_AFTER) + { + /* This converts from GGXX or GGAA to GG */ + sp += 4; dp += 2; + for (i = 1; i < row_width; i++) + { + *dp++ = *sp++; + *dp++ = *sp++; + sp += 2; + } + } + else + { + /* This converts from XXGG or AAGG to GG */ + for (i = 0; i < row_width; i++) + { + sp += 2; + *dp++ = *sp++; + *dp++ = *sp++; + } + } + row_info->pixel_depth = 16; + row_info->rowbytes = row_width * 2; + } + row_info->channels = 1; + } + if (flags & PNG_FLAG_STRIP_ALPHA) + row_info->color_type &= ~PNG_COLOR_MASK_ALPHA; + } +} +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) +/* Swaps red and blue bytes within a pixel */ +void /* PRIVATE */ +png_do_bgr(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_bgr"); + + if ( + (row_info->color_type & PNG_COLOR_MASK_COLOR)) + { + png_uint_32 row_width = row_info->width; + if (row_info->bit_depth == 8) + { + if (row_info->color_type == PNG_COLOR_TYPE_RGB) + { + png_bytep rp; + png_uint_32 i; + + for (i = 0, rp = row; i < row_width; i++, rp += 3) + { + png_byte save = *rp; + *rp = *(rp + 2); + *(rp + 2) = save; + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + { + png_bytep rp; + png_uint_32 i; + + for (i = 0, rp = row; i < row_width; i++, rp += 4) + { + png_byte save = *rp; + *rp = *(rp + 2); + *(rp + 2) = save; + } + } + } + else if (row_info->bit_depth == 16) + { + if (row_info->color_type == PNG_COLOR_TYPE_RGB) + { + png_bytep rp; + png_uint_32 i; + + for (i = 0, rp = row; i < row_width; i++, rp += 6) + { + png_byte save = *rp; + *rp = *(rp + 4); + *(rp + 4) = save; + save = *(rp + 1); + *(rp + 1) = *(rp + 5); + *(rp + 5) = save; + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + { + png_bytep rp; + png_uint_32 i; + + for (i = 0, rp = row; i < row_width; i++, rp += 8) + { + png_byte save = *rp; + *rp = *(rp + 4); + *(rp + 4) = save; + save = *(rp + 1); + *(rp + 1) = *(rp + 5); + *(rp + 5) = save; + } + } + } + } +} +#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */ + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +void PNGAPI +png_set_user_transform_info(png_structp png_ptr, png_voidp + user_transform_ptr, int user_transform_depth, int user_transform_channels) +{ + png_debug(1, "in png_set_user_transform_info"); + + if (png_ptr == NULL) + return; +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED + png_ptr->user_transform_ptr = user_transform_ptr; + png_ptr->user_transform_depth = (png_byte)user_transform_depth; + png_ptr->user_transform_channels = (png_byte)user_transform_channels; +#else + if (user_transform_ptr || user_transform_depth || user_transform_channels) + png_warning(png_ptr, + "This version of libpng does not support user transform info"); +#endif +} + +/* This function returns a pointer to the user_transform_ptr associated with + * the user transform functions. The application should free any memory + * associated with this pointer before png_write_destroy and png_read_destroy + * are called. + */ +png_voidp PNGAPI +png_get_user_transform_ptr(png_structp png_ptr) +{ + if (png_ptr == NULL) + return (NULL); +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED + return ((png_voidp)png_ptr->user_transform_ptr); +#else + return (NULL); +#endif +} +#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED || + PNG_WRITE_USER_TRANSFORM_SUPPORTED */ +#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff --git a/png/pngwio.c b/png/pngwio.c new file mode 100644 index 0000000..513a71a --- /dev/null +++ b/png/pngwio.c @@ -0,0 +1,241 @@ + +/* pngwio.c - functions for data output + * + * Last changed in libpng 1.4.0 [January 3, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + * This file provides a location for all output. Users who need + * special handling are expected to write functions that have the same + * arguments as these and perform similar functions, but that possibly + * use different output methods. Note that you shouldn't change these + * functions, but rather write replacement functions and then change + * them at run time with png_set_write_fn(...). + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#ifdef PNG_WRITE_SUPPORTED +#include "pngpriv.h" + +/* Write the data to whatever output you are using. The default routine + * writes to a file pointer. Note that this routine sometimes gets called + * with very small lengths, so you should implement some kind of simple + * buffering if you are using unbuffered writes. This should never be asked + * to write more than 64K on a 16 bit machine. + */ + +void /* PRIVATE */ +png_write_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + if (png_ptr->write_data_fn != NULL ) + (*(png_ptr->write_data_fn))(png_ptr, data, length); + else + png_error(png_ptr, "Call to NULL write function"); +} + +#ifdef PNG_STDIO_SUPPORTED +/* This is the function that does the actual writing of data. If you are + * not writing to a standard C stream, you should create a replacement + * write_data function and use it at run time with png_set_write_fn(), rather + * than changing the library. + */ +#ifndef USE_FAR_KEYWORD +void PNGAPI +png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + png_uint_32 check; + + if (png_ptr == NULL) + return; + check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr)); + if (check != length) + png_error(png_ptr, "Write Error"); +} +#else +/* This is the model-independent version. Since the standard I/O library + * can't handle far buffers in the medium and small models, we have to copy + * the data. + */ + +#define NEAR_BUF_SIZE 1024 +#define MIN(a,b) (a <= b ? a : b) + +void PNGAPI +png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + png_uint_32 check; + png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */ + png_FILE_p io_ptr; + + if (png_ptr == NULL) + return; + /* Check if data really is near. If so, use usual code. */ + near_data = (png_byte *)CVT_PTR_NOCHECK(data); + io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); + if ((png_bytep)near_data == data) + { + check = fwrite(near_data, 1, length, io_ptr); + } + else + { + png_byte buf[NEAR_BUF_SIZE]; + png_size_t written, remaining, err; + check = 0; + remaining = length; + do + { + written = MIN(NEAR_BUF_SIZE, remaining); + png_memcpy(buf, data, written); /* Copy far buffer to near buffer */ + err = fwrite(buf, 1, written, io_ptr); + if (err != written) + break; + + else + check += err; + + data += written; + remaining -= written; + } + while (remaining != 0); + } + if (check != length) + png_error(png_ptr, "Write Error"); +} + +#endif +#endif + +/* This function is called to output any data pending writing (normally + * to disk). After png_flush is called, there should be no data pending + * writing in any buffers. + */ +#ifdef PNG_WRITE_FLUSH_SUPPORTED +void /* PRIVATE */ +png_flush(png_structp png_ptr) +{ + if (png_ptr->output_flush_fn != NULL) + (*(png_ptr->output_flush_fn))(png_ptr); +} + +#ifdef PNG_STDIO_SUPPORTED +void PNGAPI +png_default_flush(png_structp png_ptr) +{ + png_FILE_p io_ptr; + if (png_ptr == NULL) + return; + io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); + fflush(io_ptr); +} +#endif +#endif + +/* This function allows the application to supply new output functions for + * libpng if standard C streams aren't being used. + * + * This function takes as its arguments: + * png_ptr - pointer to a png output data structure + * io_ptr - pointer to user supplied structure containing info about + * the output functions. May be NULL. + * write_data_fn - pointer to a new output function that takes as its + * arguments a pointer to a png_struct, a pointer to + * data to be written, and a 32-bit unsigned int that is + * the number of bytes to be written. The new write + * function should call png_error(png_ptr, "Error msg") + * to exit and output any fatal error messages. May be + * NULL, in which case libpng's default function will + * be used. + * flush_data_fn - pointer to a new flush function that takes as its + * arguments a pointer to a png_struct. After a call to + * the flush function, there should be no data in any buffers + * or pending transmission. If the output method doesn't do + * any buffering of output, a function prototype must still be + * supplied although it doesn't have to do anything. If + * PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile + * time, output_flush_fn will be ignored, although it must be + * supplied for compatibility. May be NULL, in which case + * libpng's default function will be used, if + * PNG_WRITE_FLUSH_SUPPORTED is defined. This is not + * a good idea if io_ptr does not point to a standard + * *FILE structure. + */ +void PNGAPI +png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, + png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn) +{ + if (png_ptr == NULL) + return; + + png_ptr->io_ptr = io_ptr; + +#ifdef PNG_STDIO_SUPPORTED + if (write_data_fn != NULL) + png_ptr->write_data_fn = write_data_fn; + + else + png_ptr->write_data_fn = png_default_write_data; +#else + png_ptr->write_data_fn = write_data_fn; +#endif + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +#ifdef PNG_STDIO_SUPPORTED + if (output_flush_fn != NULL) + png_ptr->output_flush_fn = output_flush_fn; + + else + png_ptr->output_flush_fn = png_default_flush; +#else + png_ptr->output_flush_fn = output_flush_fn; +#endif +#endif /* PNG_WRITE_FLUSH_SUPPORTED */ + + /* It is an error to read while writing a png file */ + if (png_ptr->read_data_fn != NULL) + { + png_ptr->read_data_fn = NULL; + png_warning(png_ptr, + "Attempted to set both read_data_fn and write_data_fn in"); + png_warning(png_ptr, + "the same structure. Resetting read_data_fn to NULL"); + } +} + +#ifdef USE_FAR_KEYWORD +#ifdef _MSC_VER +void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check) +{ + void *near_ptr; + void FAR *far_ptr; + FP_OFF(near_ptr) = FP_OFF(ptr); + far_ptr = (void FAR *)near_ptr; + + if (check != 0) + if (FP_SEG(ptr) != FP_SEG(far_ptr)) + png_error(png_ptr, "segment lost in conversion"); + + return(near_ptr); +} +# else +void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check) +{ + void *near_ptr; + void FAR *far_ptr; + near_ptr = (void FAR *)ptr; + far_ptr = (void FAR *)near_ptr; + + if (check != 0) + if (far_ptr != ptr) + png_error(png_ptr, "segment lost in conversion"); + + return(near_ptr); +} +# endif +# endif +#endif /* PNG_WRITE_SUPPORTED */ diff --git a/png/pngwrite.c b/png/pngwrite.c new file mode 100644 index 0000000..0252051 --- /dev/null +++ b/png/pngwrite.c @@ -0,0 +1,1457 @@ + +/* pngwrite.c - general routines to write a PNG file + * + * Last changed in libpng 1.4.0 [January 3, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + */ + +/* Get internal access to png.h */ +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#ifdef PNG_WRITE_SUPPORTED +#include "pngpriv.h" + +/* Writes all the PNG information. This is the suggested way to use the + * library. If you have a new chunk to add, make a function to write it, + * and put it in the correct location here. If you want the chunk written + * after the image data, put it in png_write_end(). I strongly encourage + * you to supply a PNG_INFO_ flag, and check info_ptr->valid before writing + * the chunk, as that will keep the code from breaking if you want to just + * write a plain PNG file. If you have long comments, I suggest writing + * them in png_write_end(), and compressing them. + */ +void PNGAPI +png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_write_info_before_PLTE"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) + { + /* Write PNG signature */ + png_write_sig(png_ptr); +#ifdef PNG_MNG_FEATURES_SUPPORTED + if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) && \ + (png_ptr->mng_features_permitted)) + { + png_warning(png_ptr, "MNG features are not allowed in a PNG datastream"); + png_ptr->mng_features_permitted = 0; + } +#endif + /* Write IHDR information. */ + png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height, + info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type, + info_ptr->filter_type, +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + info_ptr->interlace_type); +#else + 0); +#endif + /* The rest of these check to see if the valid field has the appropriate + * flag set, and if it does, writes the chunk. + */ +#ifdef PNG_WRITE_gAMA_SUPPORTED + if (info_ptr->valid & PNG_INFO_gAMA) + { +# ifdef PNG_FLOATING_POINT_SUPPORTED + png_write_gAMA(png_ptr, info_ptr->gamma); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + png_write_gAMA_fixed(png_ptr, info_ptr->int_gamma); +# endif +#endif + } +#endif +#ifdef PNG_WRITE_sRGB_SUPPORTED + if (info_ptr->valid & PNG_INFO_sRGB) + png_write_sRGB(png_ptr, (int)info_ptr->srgb_intent); +#endif +#ifdef PNG_WRITE_iCCP_SUPPORTED + if (info_ptr->valid & PNG_INFO_iCCP) + png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE, + info_ptr->iccp_profile, (int)info_ptr->iccp_proflen); +#endif +#ifdef PNG_WRITE_sBIT_SUPPORTED + if (info_ptr->valid & PNG_INFO_sBIT) + png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type); +#endif +#ifdef PNG_WRITE_cHRM_SUPPORTED + if (info_ptr->valid & PNG_INFO_cHRM) + { +#ifdef PNG_FLOATING_POINT_SUPPORTED + png_write_cHRM(png_ptr, + info_ptr->x_white, info_ptr->y_white, + info_ptr->x_red, info_ptr->y_red, + info_ptr->x_green, info_ptr->y_green, + info_ptr->x_blue, info_ptr->y_blue); +#else +# ifdef PNG_FIXED_POINT_SUPPORTED + png_write_cHRM_fixed(png_ptr, + info_ptr->int_x_white, info_ptr->int_y_white, + info_ptr->int_x_red, info_ptr->int_y_red, + info_ptr->int_x_green, info_ptr->int_y_green, + info_ptr->int_x_blue, info_ptr->int_y_blue); +# endif +#endif + } +#endif +#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED + if (info_ptr->unknown_chunks_num) + { + png_unknown_chunk *up; + + png_debug(5, "writing extra chunks"); + + for (up = info_ptr->unknown_chunks; + up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; + up++) + { + int keep = png_handle_as_unknown(png_ptr, up->name); + if (keep != PNG_HANDLE_CHUNK_NEVER && + up->location && !(up->location & PNG_HAVE_PLTE) && + !(up->location & PNG_HAVE_IDAT) && + ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || + (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) + { + if (up->size == 0) + png_warning(png_ptr, "Writing zero-length unknown chunk"); + png_write_chunk(png_ptr, up->name, up->data, up->size); + } + } + } +#endif + png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE; + } +} + +void PNGAPI +png_write_info(png_structp png_ptr, png_infop info_ptr) +{ +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) + int i; +#endif + + png_debug(1, "in png_write_info"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + png_write_info_before_PLTE(png_ptr, info_ptr); + + if (info_ptr->valid & PNG_INFO_PLTE) + png_write_PLTE(png_ptr, info_ptr->palette, + (png_uint_32)info_ptr->num_palette); + else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + png_error(png_ptr, "Valid palette required for paletted images"); + +#ifdef PNG_WRITE_tRNS_SUPPORTED + if (info_ptr->valid & PNG_INFO_tRNS) + { +#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED + /* Invert the alpha channel (in tRNS) */ + if ((png_ptr->transformations & PNG_INVERT_ALPHA) && + info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + int j; + for (j = 0; j<(int)info_ptr->num_trans; j++) + info_ptr->trans_alpha[j] = (png_byte)(255 - info_ptr->trans_alpha[j]); + } +#endif + png_write_tRNS(png_ptr, info_ptr->trans_alpha, &(info_ptr->trans_color), + info_ptr->num_trans, info_ptr->color_type); + } +#endif +#ifdef PNG_WRITE_bKGD_SUPPORTED + if (info_ptr->valid & PNG_INFO_bKGD) + png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type); +#endif +#ifdef PNG_WRITE_hIST_SUPPORTED + if (info_ptr->valid & PNG_INFO_hIST) + png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette); +#endif +#ifdef PNG_WRITE_oFFs_SUPPORTED + if (info_ptr->valid & PNG_INFO_oFFs) + png_write_oFFs(png_ptr, info_ptr->x_offset, info_ptr->y_offset, + info_ptr->offset_unit_type); +#endif +#ifdef PNG_WRITE_pCAL_SUPPORTED + if (info_ptr->valid & PNG_INFO_pCAL) + png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0, + info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams, + info_ptr->pcal_units, info_ptr->pcal_params); +#endif + +#ifdef PNG_sCAL_SUPPORTED + if (info_ptr->valid & PNG_INFO_sCAL) +#ifdef PNG_WRITE_sCAL_SUPPORTED +#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) + png_write_sCAL(png_ptr, (int)info_ptr->scal_unit, + info_ptr->scal_pixel_width, info_ptr->scal_pixel_height); +#else /* !FLOATING_POINT */ +#ifdef PNG_FIXED_POINT_SUPPORTED + png_write_sCAL_s(png_ptr, (int)info_ptr->scal_unit, + info_ptr->scal_s_width, info_ptr->scal_s_height); +#endif /* FIXED_POINT */ +#endif /* FLOATING_POINT */ +#else /* !WRITE_sCAL */ + png_warning(png_ptr, + "png_write_sCAL not supported; sCAL chunk not written"); +#endif /* WRITE_sCAL */ +#endif /* sCAL */ + +#ifdef PNG_WRITE_pHYs_SUPPORTED + if (info_ptr->valid & PNG_INFO_pHYs) + png_write_pHYs(png_ptr, info_ptr->x_pixels_per_unit, + info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type); +#endif /* pHYs */ + +#ifdef PNG_WRITE_tIME_SUPPORTED + if (info_ptr->valid & PNG_INFO_tIME) + { + png_write_tIME(png_ptr, &(info_ptr->mod_time)); + png_ptr->mode |= PNG_WROTE_tIME; + } +#endif /* tIME */ + +#ifdef PNG_WRITE_sPLT_SUPPORTED + if (info_ptr->valid & PNG_INFO_sPLT) + for (i = 0; i < (int)info_ptr->splt_palettes_num; i++) + png_write_sPLT(png_ptr, info_ptr->splt_palettes + i); +#endif /* sPLT */ + +#ifdef PNG_WRITE_TEXT_SUPPORTED + /* Check to see if we need to write text chunks */ + for (i = 0; i < info_ptr->num_text; i++) + { + png_debug2(2, "Writing header text chunk %d, type %d", i, + info_ptr->text[i].compression); + /* An internationalized chunk? */ + if (info_ptr->text[i].compression > 0) + { +#ifdef PNG_WRITE_iTXt_SUPPORTED + /* Write international chunk */ + png_write_iTXt(png_ptr, + info_ptr->text[i].compression, + info_ptr->text[i].key, + info_ptr->text[i].lang, + info_ptr->text[i].lang_key, + info_ptr->text[i].text); +#else + png_warning(png_ptr, "Unable to write international text"); +#endif + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; + } + /* If we want a compressed text chunk */ + else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_zTXt) + { +#ifdef PNG_WRITE_zTXt_SUPPORTED + /* Write compressed chunk */ + png_write_zTXt(png_ptr, info_ptr->text[i].key, + info_ptr->text[i].text, 0, + info_ptr->text[i].compression); +#else + png_warning(png_ptr, "Unable to write compressed text"); +#endif + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; + } + else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) + { +#ifdef PNG_WRITE_tEXt_SUPPORTED + /* Write uncompressed chunk */ + png_write_tEXt(png_ptr, info_ptr->text[i].key, + info_ptr->text[i].text, + 0); + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; +#else + /* Can't get here */ + png_warning(png_ptr, "Unable to write uncompressed text"); +#endif + } + } +#endif /* tEXt */ + +#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED + if (info_ptr->unknown_chunks_num) + { + png_unknown_chunk *up; + + png_debug(5, "writing extra chunks"); + + for (up = info_ptr->unknown_chunks; + up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; + up++) + { + int keep = png_handle_as_unknown(png_ptr, up->name); + if (keep != PNG_HANDLE_CHUNK_NEVER && + up->location && (up->location & PNG_HAVE_PLTE) && + !(up->location & PNG_HAVE_IDAT) && + ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || + (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) + { + png_write_chunk(png_ptr, up->name, up->data, up->size); + } + } + } +#endif +} + +/* Writes the end of the PNG file. If you don't want to write comments or + * time information, you can pass NULL for info. If you already wrote these + * in png_write_info(), do not write them again here. If you have long + * comments, I suggest writing them here, and compressing them. + */ +void PNGAPI +png_write_end(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_write_end"); + + if (png_ptr == NULL) + return; + if (!(png_ptr->mode & PNG_HAVE_IDAT)) + png_error(png_ptr, "No IDATs written into file"); + + /* See if user wants us to write information chunks */ + if (info_ptr != NULL) + { +#ifdef PNG_WRITE_TEXT_SUPPORTED + int i; /* local index variable */ +#endif +#ifdef PNG_WRITE_tIME_SUPPORTED + /* Check to see if user has supplied a time chunk */ + if ((info_ptr->valid & PNG_INFO_tIME) && + !(png_ptr->mode & PNG_WROTE_tIME)) + png_write_tIME(png_ptr, &(info_ptr->mod_time)); +#endif +#ifdef PNG_WRITE_TEXT_SUPPORTED + /* Loop through comment chunks */ + for (i = 0; i < info_ptr->num_text; i++) + { + png_debug2(2, "Writing trailer text chunk %d, type %d", i, + info_ptr->text[i].compression); + /* An internationalized chunk? */ + if (info_ptr->text[i].compression > 0) + { +#ifdef PNG_WRITE_iTXt_SUPPORTED + /* Write international chunk */ + png_write_iTXt(png_ptr, + info_ptr->text[i].compression, + info_ptr->text[i].key, + info_ptr->text[i].lang, + info_ptr->text[i].lang_key, + info_ptr->text[i].text); +#else + png_warning(png_ptr, "Unable to write international text"); +#endif + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; + } + else if (info_ptr->text[i].compression >= PNG_TEXT_COMPRESSION_zTXt) + { +#ifdef PNG_WRITE_zTXt_SUPPORTED + /* Write compressed chunk */ + png_write_zTXt(png_ptr, info_ptr->text[i].key, + info_ptr->text[i].text, 0, + info_ptr->text[i].compression); +#else + png_warning(png_ptr, "Unable to write compressed text"); +#endif + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; + } + else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) + { +#ifdef PNG_WRITE_tEXt_SUPPORTED + /* Write uncompressed chunk */ + png_write_tEXt(png_ptr, info_ptr->text[i].key, + info_ptr->text[i].text, 0); +#else + png_warning(png_ptr, "Unable to write uncompressed text"); +#endif + + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; + } + } +#endif +#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED + if (info_ptr->unknown_chunks_num) + { + png_unknown_chunk *up; + + png_debug(5, "writing extra chunks"); + + for (up = info_ptr->unknown_chunks; + up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; + up++) + { + int keep = png_handle_as_unknown(png_ptr, up->name); + if (keep != PNG_HANDLE_CHUNK_NEVER && + up->location && (up->location & PNG_AFTER_IDAT) && + ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || + (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) + { + png_write_chunk(png_ptr, up->name, up->data, up->size); + } + } + } +#endif + } + + png_ptr->mode |= PNG_AFTER_IDAT; + + /* Write end of PNG file */ + png_write_IEND(png_ptr); + /* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03, + * and restored again in libpng-1.2.30, may cause some applications that + * do not set png_ptr->output_flush_fn to crash. If your application + * experiences a problem, please try building libpng with + * PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED defined, and report the event to + * png-mng-implement at lists.sf.net . + */ +#ifdef PNG_WRITE_FLUSH_SUPPORTED +# ifdef PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED + png_flush(png_ptr); +# endif +#endif +} + +#ifdef PNG_CONVERT_tIME_SUPPORTED +/* "tm" structure is not supported on WindowsCE */ +void PNGAPI +png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime) +{ + png_debug(1, "in png_convert_from_struct_tm"); + + ptime->year = (png_uint_16)(1900 + ttime->tm_year); + ptime->month = (png_byte)(ttime->tm_mon + 1); + ptime->day = (png_byte)ttime->tm_mday; + ptime->hour = (png_byte)ttime->tm_hour; + ptime->minute = (png_byte)ttime->tm_min; + ptime->second = (png_byte)ttime->tm_sec; +} + +void PNGAPI +png_convert_from_time_t(png_timep ptime, time_t ttime) +{ + struct tm *tbuf; + + png_debug(1, "in png_convert_from_time_t"); + + tbuf = gmtime(&ttime); + png_convert_from_struct_tm(ptime, tbuf); +} +#endif + +/* Initialize png_ptr structure, and allocate any memory needed */ +png_structp PNGAPI +png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn) +{ +#ifdef PNG_USER_MEM_SUPPORTED + return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn, + warn_fn, NULL, NULL, NULL)); +} + +/* Alternate initialize png_ptr structure, and allocate any memory needed */ +png_structp PNGAPI +png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn) +{ +#endif /* PNG_USER_MEM_SUPPORTED */ + volatile int png_cleanup_needed = 0; +#ifdef PNG_SETJMP_SUPPORTED + volatile +#endif + png_structp png_ptr; +#ifdef PNG_SETJMP_SUPPORTED +#ifdef USE_FAR_KEYWORD + jmp_buf jmpbuf; +#endif +#endif + int i; + + png_debug(1, "in png_create_write_struct"); + +#ifdef PNG_USER_MEM_SUPPORTED + png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, + (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr); +#else + png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); +#endif /* PNG_USER_MEM_SUPPORTED */ + if (png_ptr == NULL) + return (NULL); + + /* Added at libpng-1.2.6 */ +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + png_ptr->user_width_max = PNG_USER_WIDTH_MAX; + png_ptr->user_height_max = PNG_USER_HEIGHT_MAX; +#endif + +#ifdef PNG_SETJMP_SUPPORTED +/* Applications that neglect to set up their own setjmp() and then + encounter a png_error() will longjmp here. Since the jmpbuf is + then meaningless we abort instead of returning. */ +#ifdef USE_FAR_KEYWORD + if (setjmp(jmpbuf)) +#else + if (setjmp(png_jmpbuf(png_ptr))) /* sets longjmp to match setjmp */ +#endif +#ifdef USE_FAR_KEYWORD + png_memcpy(png_jmpbuf(png_ptr), jmpbuf, png_sizeof(jmp_buf)); +#endif + PNG_ABORT(); +#endif + +#ifdef PNG_USER_MEM_SUPPORTED + png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn); +#endif /* PNG_USER_MEM_SUPPORTED */ + png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); + + if (user_png_ver) + { + i = 0; + do + { + if (user_png_ver[i] != png_libpng_ver[i]) + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; + } while (png_libpng_ver[i++]); + } + + if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) + { + /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so + * we must recompile any applications that use any older library version. + * For versions after libpng 1.0, we will be compatible, so we need + * only check the first digit. + */ + if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] || + (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || + (user_png_ver[0] == '0' && user_png_ver[2] < '9')) + { +#ifdef PNG_STDIO_SUPPORTED + char msg[80]; + if (user_png_ver) + { + png_snprintf(msg, 80, + "Application was compiled with png.h from libpng-%.20s", + user_png_ver); + png_warning(png_ptr, msg); + } + png_snprintf(msg, 80, + "Application is running with png.c from libpng-%.20s", + png_libpng_ver); + png_warning(png_ptr, msg); +#endif +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + png_ptr->flags = 0; +#endif + png_warning(png_ptr, + "Incompatible libpng version in application and library"); + png_cleanup_needed = 1; + } + } + + /* Initialize zbuf - compression buffer */ + png_ptr->zbuf_size = PNG_ZBUF_SIZE; + if (!png_cleanup_needed) + { + png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr, + png_ptr->zbuf_size); + if (png_ptr->zbuf == NULL) + png_cleanup_needed = 1; + } + if (png_cleanup_needed) + { + /* Clean up PNG structure and deallocate any memory. */ + png_free(png_ptr, png_ptr->zbuf); + png_ptr->zbuf = NULL; +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)png_ptr, + (png_free_ptr)free_fn, (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)png_ptr); +#endif + return (NULL); + } + + png_set_write_fn(png_ptr, NULL, NULL, NULL); + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT, + 1, NULL, NULL); +#endif + + return (png_ptr); +} + + +/* Write a few rows of image data. If the image is interlaced, + * either you will have to write the 7 sub images, or, if you + * have called png_set_interlace_handling(), you will have to + * "write" the image seven times. + */ +void PNGAPI +png_write_rows(png_structp png_ptr, png_bytepp row, + png_uint_32 num_rows) +{ + png_uint_32 i; /* row counter */ + png_bytepp rp; /* row pointer */ + + png_debug(1, "in png_write_rows"); + + if (png_ptr == NULL) + return; + + /* Loop through the rows */ + for (i = 0, rp = row; i < num_rows; i++, rp++) + { + png_write_row(png_ptr, *rp); + } +} + +/* Write the image. You only need to call this function once, even + * if you are writing an interlaced image. + */ +void PNGAPI +png_write_image(png_structp png_ptr, png_bytepp image) +{ + png_uint_32 i; /* row index */ + int pass, num_pass; /* pass variables */ + png_bytepp rp; /* points to current row */ + + if (png_ptr == NULL) + return; + + png_debug(1, "in png_write_image"); + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + /* Initialize interlace handling. If image is not interlaced, + * this will set pass to 1 + */ + num_pass = png_set_interlace_handling(png_ptr); +#else + num_pass = 1; +#endif + /* Loop through passes */ + for (pass = 0; pass < num_pass; pass++) + { + /* Loop through image */ + for (i = 0, rp = image; i < png_ptr->height; i++, rp++) + { + png_write_row(png_ptr, *rp); + } + } +} + +/* Called by user to write a row of image data */ +void PNGAPI +png_write_row(png_structp png_ptr, png_bytep row) +{ + if (png_ptr == NULL) + return; + + png_debug2(1, "in png_write_row (row %ld, pass %d)", + png_ptr->row_number, png_ptr->pass); + + /* Initialize transformations and other stuff if first time */ + if (png_ptr->row_number == 0 && png_ptr->pass == 0) + { + /* Make sure we wrote the header info */ + if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) + png_error(png_ptr, + "png_write_info was never called before png_write_row"); + + /* Check for transforms that have been set but were defined out */ +#if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED) + if (png_ptr->transformations & PNG_INVERT_MONO) + png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined"); +#endif +#if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED) + if (png_ptr->transformations & PNG_FILLER) + png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined"); +#endif +#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \ + defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + png_warning(png_ptr, + "PNG_WRITE_PACKSWAP_SUPPORTED is not defined"); +#endif +#if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED) + if (png_ptr->transformations & PNG_PACK) + png_warning(png_ptr, "PNG_WRITE_PACK_SUPPORTED is not defined"); +#endif +#if !defined(PNG_WRITE_SHIFT_SUPPORTED) && defined(PNG_READ_SHIFT_SUPPORTED) + if (png_ptr->transformations & PNG_SHIFT) + png_warning(png_ptr, "PNG_WRITE_SHIFT_SUPPORTED is not defined"); +#endif +#if !defined(PNG_WRITE_BGR_SUPPORTED) && defined(PNG_READ_BGR_SUPPORTED) + if (png_ptr->transformations & PNG_BGR) + png_warning(png_ptr, "PNG_WRITE_BGR_SUPPORTED is not defined"); +#endif +#if !defined(PNG_WRITE_SWAP_SUPPORTED) && defined(PNG_READ_SWAP_SUPPORTED) + if (png_ptr->transformations & PNG_SWAP_BYTES) + png_warning(png_ptr, "PNG_WRITE_SWAP_SUPPORTED is not defined"); +#endif + + png_write_start_row(png_ptr); + } + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + /* If interlaced and not interested in row, return */ + if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) + { + switch (png_ptr->pass) + { + case 0: + if (png_ptr->row_number & 0x07) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 1: + if ((png_ptr->row_number & 0x07) || png_ptr->width < 5) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 2: + if ((png_ptr->row_number & 0x07) != 4) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 3: + if ((png_ptr->row_number & 0x03) || png_ptr->width < 3) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 4: + if ((png_ptr->row_number & 0x03) != 2) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 5: + if ((png_ptr->row_number & 0x01) || png_ptr->width < 2) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 6: + if (!(png_ptr->row_number & 0x01)) + { + png_write_finish_row(png_ptr); + return; + } + break; + } + } +#endif + + /* Set up row info for transformations */ + png_ptr->row_info.color_type = png_ptr->color_type; + png_ptr->row_info.width = png_ptr->usr_width; + png_ptr->row_info.channels = png_ptr->usr_channels; + png_ptr->row_info.bit_depth = png_ptr->usr_bit_depth; + png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth * + png_ptr->row_info.channels); + + png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, + png_ptr->row_info.width); + + png_debug1(3, "row_info->color_type = %d", png_ptr->row_info.color_type); + png_debug1(3, "row_info->width = %lu", png_ptr->row_info.width); + png_debug1(3, "row_info->channels = %d", png_ptr->row_info.channels); + png_debug1(3, "row_info->bit_depth = %d", png_ptr->row_info.bit_depth); + png_debug1(3, "row_info->pixel_depth = %d", png_ptr->row_info.pixel_depth); + png_debug1(3, "row_info->rowbytes = %lu", png_ptr->row_info.rowbytes); + + /* Copy user's row into buffer, leaving room for filter byte. */ + png_memcpy(png_ptr->row_buf + 1, row, png_ptr->row_info.rowbytes); + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + /* Handle interlacing */ + if (png_ptr->interlaced && png_ptr->pass < 6 && + (png_ptr->transformations & PNG_INTERLACE)) + { + png_do_write_interlace(&(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->pass); + /* This should always get caught above, but still ... */ + if (!(png_ptr->row_info.width)) + { + png_write_finish_row(png_ptr); + return; + } + } +#endif + + /* Handle other transformations */ + if (png_ptr->transformations) + png_do_write_transformations(png_ptr); + +#ifdef PNG_MNG_FEATURES_SUPPORTED + /* Write filter_method 64 (intrapixel differencing) only if + * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and + * 2. Libpng did not write a PNG signature (this filter_method is only + * used in PNG datastreams that are embedded in MNG datastreams) and + * 3. The application called png_permit_mng_features with a mask that + * included PNG_FLAG_MNG_FILTER_64 and + * 4. The filter_method is 64 and + * 5. The color_type is RGB or RGBA + */ + if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING)) + { + /* Intrapixel differencing */ + png_do_write_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1); + } +#endif + + /* Find a filter if necessary, filter the row and write it out. */ + png_write_find_filter(png_ptr, &(png_ptr->row_info)); + + if (png_ptr->write_row_fn != NULL) + (*(png_ptr->write_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); +} + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +/* Set the automatic flush interval or 0 to turn flushing off */ +void PNGAPI +png_set_flush(png_structp png_ptr, int nrows) +{ + png_debug(1, "in png_set_flush"); + + if (png_ptr == NULL) + return; + png_ptr->flush_dist = (nrows < 0 ? 0 : nrows); +} + +/* Flush the current output buffers now */ +void PNGAPI +png_write_flush(png_structp png_ptr) +{ + int wrote_IDAT; + + png_debug(1, "in png_write_flush"); + + if (png_ptr == NULL) + return; + /* We have already written out all of the data */ + if (png_ptr->row_number >= png_ptr->num_rows) + return; + + do + { + int ret; + + /* Compress the data */ + ret = deflate(&png_ptr->zstream, Z_SYNC_FLUSH); + wrote_IDAT = 0; + + /* Check for compression errors */ + if (ret != Z_OK) + { + if (png_ptr->zstream.msg != NULL) + png_error(png_ptr, png_ptr->zstream.msg); + else + png_error(png_ptr, "zlib error"); + } + + if (!(png_ptr->zstream.avail_out)) + { + /* Write the IDAT and reset the zlib output buffer */ + png_write_IDAT(png_ptr, png_ptr->zbuf, + png_ptr->zbuf_size); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + wrote_IDAT = 1; + } + } while(wrote_IDAT == 1); + + /* If there is any data left to be output, write it into a new IDAT */ + if (png_ptr->zbuf_size != png_ptr->zstream.avail_out) + { + /* Write the IDAT and reset the zlib output buffer */ + png_write_IDAT(png_ptr, png_ptr->zbuf, + png_ptr->zbuf_size - png_ptr->zstream.avail_out); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + } + png_ptr->flush_rows = 0; + png_flush(png_ptr); +} +#endif /* PNG_WRITE_FLUSH_SUPPORTED */ + +/* Free all memory used by the write */ +void PNGAPI +png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) +{ + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; +#ifdef PNG_USER_MEM_SUPPORTED + png_free_ptr free_fn = NULL; + png_voidp mem_ptr = NULL; +#endif + + png_debug(1, "in png_destroy_write_struct"); + + if (png_ptr_ptr != NULL) + { + png_ptr = *png_ptr_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + free_fn = png_ptr->free_fn; + mem_ptr = png_ptr->mem_ptr; +#endif + } + +#ifdef PNG_USER_MEM_SUPPORTED + if (png_ptr != NULL) + { + free_fn = png_ptr->free_fn; + mem_ptr = png_ptr->mem_ptr; + } +#endif + + if (info_ptr_ptr != NULL) + info_ptr = *info_ptr_ptr; + + if (info_ptr != NULL) + { + if (png_ptr != NULL) + { + png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); + +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + if (png_ptr->num_chunk_list) + { + png_free(png_ptr, png_ptr->chunk_list); + png_ptr->num_chunk_list = 0; + } +#endif + } + +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)info_ptr); +#endif + *info_ptr_ptr = NULL; + } + + if (png_ptr != NULL) + { + png_write_destroy(png_ptr); +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)png_ptr); +#endif + *png_ptr_ptr = NULL; + } +} + + +/* Free any memory used in png_ptr struct (old method) */ +void /* PRIVATE */ +png_write_destroy(png_structp png_ptr) +{ +#ifdef PNG_SETJMP_SUPPORTED + jmp_buf tmp_jmp; /* Save jump buffer */ +#endif + png_error_ptr error_fn; + png_error_ptr warning_fn; + png_voidp error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + png_free_ptr free_fn; +#endif + + png_debug(1, "in png_write_destroy"); + + /* Free any memory zlib uses */ + deflateEnd(&png_ptr->zstream); + + /* Free our memory. png_free checks NULL for us. */ + png_free(png_ptr, png_ptr->zbuf); + png_free(png_ptr, png_ptr->row_buf); +#ifdef PNG_WRITE_FILTER_SUPPORTED + png_free(png_ptr, png_ptr->prev_row); + png_free(png_ptr, png_ptr->sub_row); + png_free(png_ptr, png_ptr->up_row); + png_free(png_ptr, png_ptr->avg_row); + png_free(png_ptr, png_ptr->paeth_row); +#endif + +#ifdef PNG_TIME_RFC1123_SUPPORTED + png_free(png_ptr, png_ptr->time_buffer); +#endif + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + png_free(png_ptr, png_ptr->prev_filters); + png_free(png_ptr, png_ptr->filter_weights); + png_free(png_ptr, png_ptr->inv_filter_weights); + png_free(png_ptr, png_ptr->filter_costs); + png_free(png_ptr, png_ptr->inv_filter_costs); +#endif + +#ifdef PNG_SETJMP_SUPPORTED + /* Reset structure */ + png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); +#endif + + error_fn = png_ptr->error_fn; + warning_fn = png_ptr->warning_fn; + error_ptr = png_ptr->error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + free_fn = png_ptr->free_fn; +#endif + + png_memset(png_ptr, 0, png_sizeof(png_struct)); + + png_ptr->error_fn = error_fn; + png_ptr->warning_fn = warning_fn; + png_ptr->error_ptr = error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + png_ptr->free_fn = free_fn; +#endif + +#ifdef PNG_SETJMP_SUPPORTED + png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); +#endif +} + +/* Allow the application to select one or more row filters to use. */ +void PNGAPI +png_set_filter(png_structp png_ptr, int method, int filters) +{ + png_debug(1, "in png_set_filter"); + + if (png_ptr == NULL) + return; +#ifdef PNG_MNG_FEATURES_SUPPORTED + if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + (method == PNG_INTRAPIXEL_DIFFERENCING)) + method = PNG_FILTER_TYPE_BASE; +#endif + if (method == PNG_FILTER_TYPE_BASE) + { + switch (filters & (PNG_ALL_FILTERS | 0x07)) + { +#ifdef PNG_WRITE_FILTER_SUPPORTED + case 5: + case 6: + case 7: png_warning(png_ptr, "Unknown row filter for method 0"); +#endif /* PNG_WRITE_FILTER_SUPPORTED */ + case PNG_FILTER_VALUE_NONE: + png_ptr->do_filter = PNG_FILTER_NONE; break; +#ifdef PNG_WRITE_FILTER_SUPPORTED + case PNG_FILTER_VALUE_SUB: + png_ptr->do_filter = PNG_FILTER_SUB; break; + case PNG_FILTER_VALUE_UP: + png_ptr->do_filter = PNG_FILTER_UP; break; + case PNG_FILTER_VALUE_AVG: + png_ptr->do_filter = PNG_FILTER_AVG; break; + case PNG_FILTER_VALUE_PAETH: + png_ptr->do_filter = PNG_FILTER_PAETH; break; + default: png_ptr->do_filter = (png_byte)filters; break; +#else + default: png_warning(png_ptr, "Unknown row filter for method 0"); +#endif /* PNG_WRITE_FILTER_SUPPORTED */ + } + + /* If we have allocated the row_buf, this means we have already started + * with the image and we should have allocated all of the filter buffers + * that have been selected. If prev_row isn't already allocated, then + * it is too late to start using the filters that need it, since we + * will be missing the data in the previous row. If an application + * wants to start and stop using particular filters during compression, + * it should start out with all of the filters, and then add and + * remove them after the start of compression. + */ + if (png_ptr->row_buf != NULL) + { +#ifdef PNG_WRITE_FILTER_SUPPORTED + if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL) + { + png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB; + } + + if ((png_ptr->do_filter & PNG_FILTER_UP) && png_ptr->up_row == NULL) + { + if (png_ptr->prev_row == NULL) + { + png_warning(png_ptr, "Can't add Up filter after starting"); + png_ptr->do_filter &= ~PNG_FILTER_UP; + } + else + { + png_ptr->up_row = (png_bytep)png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->up_row[0] = PNG_FILTER_VALUE_UP; + } + } + + if ((png_ptr->do_filter & PNG_FILTER_AVG) && png_ptr->avg_row == NULL) + { + if (png_ptr->prev_row == NULL) + { + png_warning(png_ptr, "Can't add Average filter after starting"); + png_ptr->do_filter &= ~PNG_FILTER_AVG; + } + else + { + png_ptr->avg_row = (png_bytep)png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG; + } + } + + if ((png_ptr->do_filter & PNG_FILTER_PAETH) && + png_ptr->paeth_row == NULL) + { + if (png_ptr->prev_row == NULL) + { + png_warning(png_ptr, "Can't add Paeth filter after starting"); + png_ptr->do_filter &= (png_byte)(~PNG_FILTER_PAETH); + } + else + { + png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH; + } + } + + if (png_ptr->do_filter == PNG_NO_FILTERS) +#endif /* PNG_WRITE_FILTER_SUPPORTED */ + png_ptr->do_filter = PNG_FILTER_NONE; + } + } + else + png_error(png_ptr, "Unknown custom filter method"); +} + +/* This allows us to influence the way in which libpng chooses the "best" + * filter for the current scanline. While the "minimum-sum-of-absolute- + * differences metric is relatively fast and effective, there is some + * question as to whether it can be improved upon by trying to keep the + * filtered data going to zlib more consistent, hopefully resulting in + * better compression. + */ +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */ +void PNGAPI +png_set_filter_heuristics(png_structp png_ptr, int heuristic_method, + int num_weights, png_doublep filter_weights, + png_doublep filter_costs) +{ + int i; + + png_debug(1, "in png_set_filter_heuristics"); + + if (png_ptr == NULL) + return; + if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST) + { + png_warning(png_ptr, "Unknown filter heuristic method"); + return; + } + + if (heuristic_method == PNG_FILTER_HEURISTIC_DEFAULT) + { + heuristic_method = PNG_FILTER_HEURISTIC_UNWEIGHTED; + } + + if (num_weights < 0 || filter_weights == NULL || + heuristic_method == PNG_FILTER_HEURISTIC_UNWEIGHTED) + { + num_weights = 0; + } + + png_ptr->num_prev_filters = (png_byte)num_weights; + png_ptr->heuristic_method = (png_byte)heuristic_method; + + if (num_weights > 0) + { + if (png_ptr->prev_filters == NULL) + { + png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr, + (png_uint_32)(png_sizeof(png_byte) * num_weights)); + + /* To make sure that the weighting starts out fairly */ + for (i = 0; i < num_weights; i++) + { + png_ptr->prev_filters[i] = 255; + } + } + + if (png_ptr->filter_weights == NULL) + { + png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(png_sizeof(png_uint_16) * num_weights)); + + png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(png_sizeof(png_uint_16) * num_weights)); + for (i = 0; i < num_weights; i++) + { + png_ptr->inv_filter_weights[i] = + png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; + } + } + + for (i = 0; i < num_weights; i++) + { + if (filter_weights[i] < 0.0) + { + png_ptr->inv_filter_weights[i] = + png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; + } + else + { + png_ptr->inv_filter_weights[i] = + (png_uint_16)((double)PNG_WEIGHT_FACTOR*filter_weights[i]+0.5); + png_ptr->filter_weights[i] = + (png_uint_16)((double)PNG_WEIGHT_FACTOR/filter_weights[i]+0.5); + } + } + } + + /* If, in the future, there are other filter methods, this would + * need to be based on png_ptr->filter. + */ + if (png_ptr->filter_costs == NULL) + { + png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST)); + + png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST)); + + for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) + { + png_ptr->inv_filter_costs[i] = + png_ptr->filter_costs[i] = PNG_COST_FACTOR; + } + } + + /* Here is where we set the relative costs of the different filters. We + * should take the desired compression level into account when setting + * the costs, so that Paeth, for instance, has a high relative cost at low + * compression levels, while it has a lower relative cost at higher + * compression settings. The filter types are in order of increasing + * relative cost, so it would be possible to do this with an algorithm. + */ + for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) + { + if (filter_costs == NULL || filter_costs[i] < 0.0) + { + png_ptr->inv_filter_costs[i] = + png_ptr->filter_costs[i] = PNG_COST_FACTOR; + } + else if (filter_costs[i] >= 1.0) + { + png_ptr->inv_filter_costs[i] = + (png_uint_16)((double)PNG_COST_FACTOR / filter_costs[i] + 0.5); + png_ptr->filter_costs[i] = + (png_uint_16)((double)PNG_COST_FACTOR * filter_costs[i] + 0.5); + } + } +} +#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ + +void PNGAPI +png_set_compression_level(png_structp png_ptr, int level) +{ + png_debug(1, "in png_set_compression_level"); + + if (png_ptr == NULL) + return; + png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL; + png_ptr->zlib_level = level; +} + +void PNGAPI +png_set_compression_mem_level(png_structp png_ptr, int mem_level) +{ + png_debug(1, "in png_set_compression_mem_level"); + + if (png_ptr == NULL) + return; + png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL; + png_ptr->zlib_mem_level = mem_level; +} + +void PNGAPI +png_set_compression_strategy(png_structp png_ptr, int strategy) +{ + png_debug(1, "in png_set_compression_strategy"); + + if (png_ptr == NULL) + return; + png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY; + png_ptr->zlib_strategy = strategy; +} + +void PNGAPI +png_set_compression_window_bits(png_structp png_ptr, int window_bits) +{ + if (png_ptr == NULL) + return; + if (window_bits > 15) + png_warning(png_ptr, "Only compression windows <= 32k supported by PNG"); + else if (window_bits < 8) + png_warning(png_ptr, "Only compression windows >= 256 supported by PNG"); +#ifndef WBITS_8_OK + /* Avoid libpng bug with 256-byte windows */ + if (window_bits == 8) + { + png_warning(png_ptr, "Compression window is being reset to 512"); + window_bits = 9; + } +#endif + png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS; + png_ptr->zlib_window_bits = window_bits; +} + +void PNGAPI +png_set_compression_method(png_structp png_ptr, int method) +{ + png_debug(1, "in png_set_compression_method"); + + if (png_ptr == NULL) + return; + if (method != 8) + png_warning(png_ptr, "Only compression method 8 is supported by PNG"); + png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_METHOD; + png_ptr->zlib_method = method; +} + +void PNGAPI +png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn) +{ + if (png_ptr == NULL) + return; + png_ptr->write_row_fn = write_row_fn; +} + +#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED +void PNGAPI +png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr + write_user_transform_fn) +{ + png_debug(1, "in png_set_write_user_transform_fn"); + + if (png_ptr == NULL) + return; + png_ptr->transformations |= PNG_USER_TRANSFORM; + png_ptr->write_user_transform_fn = write_user_transform_fn; +} +#endif + + +#ifdef PNG_INFO_IMAGE_SUPPORTED +void PNGAPI +png_write_png(png_structp png_ptr, png_infop info_ptr, + int transforms, voidp params) +{ + if (png_ptr == NULL || info_ptr == NULL) + return; + + /* Write the file header information. */ + png_write_info(png_ptr, info_ptr); + + /* ------ these transformations don't touch the info structure ------- */ + +#ifdef PNG_WRITE_INVERT_SUPPORTED + /* Invert monochrome pixels */ + if (transforms & PNG_TRANSFORM_INVERT_MONO) + png_set_invert_mono(png_ptr); +#endif + +#ifdef PNG_WRITE_SHIFT_SUPPORTED + /* Shift the pixels up to a legal bit depth and fill in + * as appropriate to correctly scale the image. + */ + if ((transforms & PNG_TRANSFORM_SHIFT) + && (info_ptr->valid & PNG_INFO_sBIT)) + png_set_shift(png_ptr, &info_ptr->sig_bit); +#endif + +#ifdef PNG_WRITE_PACK_SUPPORTED + /* Pack pixels into bytes */ + if (transforms & PNG_TRANSFORM_PACKING) + png_set_packing(png_ptr); +#endif + +#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED + /* Swap location of alpha bytes from ARGB to RGBA */ + if (transforms & PNG_TRANSFORM_SWAP_ALPHA) + png_set_swap_alpha(png_ptr); +#endif + +#ifdef PNG_WRITE_FILLER_SUPPORTED + /* Pack XRGB/RGBX/ARGB/RGBA into * RGB (4 channels -> 3 channels) */ + if (transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER) + png_set_filler(png_ptr, 0, PNG_FILLER_AFTER); + else if (transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE) + png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); +#endif + +#ifdef PNG_WRITE_BGR_SUPPORTED + /* Flip BGR pixels to RGB */ + if (transforms & PNG_TRANSFORM_BGR) + png_set_bgr(png_ptr); +#endif + +#ifdef PNG_WRITE_SWAP_SUPPORTED + /* Swap bytes of 16-bit files to most significant byte first */ + if (transforms & PNG_TRANSFORM_SWAP_ENDIAN) + png_set_swap(png_ptr); +#endif + +#ifdef PNG_WRITE_PACKSWAP_SUPPORTED + /* Swap bits of 1, 2, 4 bit packed pixel formats */ + if (transforms & PNG_TRANSFORM_PACKSWAP) + png_set_packswap(png_ptr); +#endif + +#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED + /* Invert the alpha channel from opacity to transparency */ + if (transforms & PNG_TRANSFORM_INVERT_ALPHA) + png_set_invert_alpha(png_ptr); +#endif + + /* ----------------------- end of transformations ------------------- */ + + /* Write the bits */ + if (info_ptr->valid & PNG_INFO_IDAT) + png_write_image(png_ptr, info_ptr->row_pointers); + + /* It is REQUIRED to call this to finish writing the rest of the file */ + png_write_end(png_ptr, info_ptr); + + transforms = transforms; /* Quiet compiler warnings */ + params = params; +} +#endif +#endif /* PNG_WRITE_SUPPORTED */ diff --git a/png/pngwtran.c b/png/pngwtran.c new file mode 100644 index 0000000..070caa5 --- /dev/null +++ b/png/pngwtran.c @@ -0,0 +1,566 @@ + +/* pngwtran.c - transforms the data in a row for PNG writers + * + * Last changed in libpng 1.4.1 [February 25, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#ifdef PNG_WRITE_SUPPORTED +#include "pngpriv.h" + +/* Transform the data according to the user's wishes. The order of + * transformations is significant. + */ +void /* PRIVATE */ +png_do_write_transformations(png_structp png_ptr) +{ + png_debug(1, "in png_do_write_transformations"); + + if (png_ptr == NULL) + return; + +#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED + if (png_ptr->transformations & PNG_USER_TRANSFORM) + if (png_ptr->write_user_transform_fn != NULL) + (*(png_ptr->write_user_transform_fn)) /* User write transform + function */ + (png_ptr, /* png_ptr */ + &(png_ptr->row_info), /* row_info: */ + /* png_uint_32 width; width of row */ + /* png_uint_32 rowbytes; number of bytes in row */ + /* png_byte color_type; color type of pixels */ + /* png_byte bit_depth; bit depth of samples */ + /* png_byte channels; number of channels (1-4) */ + /* png_byte pixel_depth; bits per pixel (depth*channels) */ + png_ptr->row_buf + 1); /* start of pixel data for row */ +#endif +#ifdef PNG_WRITE_FILLER_SUPPORTED + if (png_ptr->transformations & PNG_FILLER) + png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, + png_ptr->flags); +#endif +#ifdef PNG_WRITE_PACKSWAP_SUPPORTED + if (png_ptr->transformations & PNG_PACKSWAP) + png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif +#ifdef PNG_WRITE_PACK_SUPPORTED + if (png_ptr->transformations & PNG_PACK) + png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1, + (png_uint_32)png_ptr->bit_depth); +#endif +#ifdef PNG_WRITE_SWAP_SUPPORTED + if (png_ptr->transformations & PNG_SWAP_BYTES) + png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif +#ifdef PNG_WRITE_SHIFT_SUPPORTED + if (png_ptr->transformations & PNG_SHIFT) + png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1, + &(png_ptr->shift)); +#endif +#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED + if (png_ptr->transformations & PNG_SWAP_ALPHA) + png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif +#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED + if (png_ptr->transformations & PNG_INVERT_ALPHA) + png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif +#ifdef PNG_WRITE_BGR_SUPPORTED + if (png_ptr->transformations & PNG_BGR) + png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif +#ifdef PNG_WRITE_INVERT_SUPPORTED + if (png_ptr->transformations & PNG_INVERT_MONO) + png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif +} + +#ifdef PNG_WRITE_PACK_SUPPORTED +/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The + * row_info bit depth should be 8 (one pixel per byte). The channels + * should be 1 (this only happens on grayscale and paletted images). + */ +void /* PRIVATE */ +png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) +{ + png_debug(1, "in png_do_pack"); + + if (row_info->bit_depth == 8 && + row_info->channels == 1) + { + switch ((int)bit_depth) + { + case 1: + { + png_bytep sp, dp; + int mask, v; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + sp = row; + dp = row; + mask = 0x80; + v = 0; + + for (i = 0; i < row_width; i++) + { + if (*sp != 0) + v |= mask; + sp++; + if (mask > 1) + mask >>= 1; + else + { + mask = 0x80; + *dp = (png_byte)v; + dp++; + v = 0; + } + } + if (mask != 0x80) + *dp = (png_byte)v; + break; + } + case 2: + { + png_bytep sp, dp; + int shift, v; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + sp = row; + dp = row; + shift = 6; + v = 0; + for (i = 0; i < row_width; i++) + { + png_byte value; + + value = (png_byte)(*sp & 0x03); + v |= (value << shift); + if (shift == 0) + { + shift = 6; + *dp = (png_byte)v; + dp++; + v = 0; + } + else + shift -= 2; + sp++; + } + if (shift != 6) + *dp = (png_byte)v; + break; + } + case 4: + { + png_bytep sp, dp; + int shift, v; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + sp = row; + dp = row; + shift = 4; + v = 0; + for (i = 0; i < row_width; i++) + { + png_byte value; + + value = (png_byte)(*sp & 0x0f); + v |= (value << shift); + + if (shift == 0) + { + shift = 4; + *dp = (png_byte)v; + dp++; + v = 0; + } + else + shift -= 4; + + sp++; + } + if (shift != 4) + *dp = (png_byte)v; + break; + } + } + row_info->bit_depth = (png_byte)bit_depth; + row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, + row_info->width); + } +} +#endif + +#ifdef PNG_WRITE_SHIFT_SUPPORTED +/* Shift pixel values to take advantage of whole range. Pass the + * true number of bits in bit_depth. The row should be packed + * according to row_info->bit_depth. Thus, if you had a row of + * bit depth 4, but the pixels only had values from 0 to 7, you + * would pass 3 as bit_depth, and this routine would translate the + * data to 0 to 15. + */ +void /* PRIVATE */ +png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth) +{ + png_debug(1, "in png_do_shift"); + + if ( + row_info->color_type != PNG_COLOR_TYPE_PALETTE) + { + int shift_start[4], shift_dec[4]; + int channels = 0; + + if (row_info->color_type & PNG_COLOR_MASK_COLOR) + { + shift_start[channels] = row_info->bit_depth - bit_depth->red; + shift_dec[channels] = bit_depth->red; + channels++; + shift_start[channels] = row_info->bit_depth - bit_depth->green; + shift_dec[channels] = bit_depth->green; + channels++; + shift_start[channels] = row_info->bit_depth - bit_depth->blue; + shift_dec[channels] = bit_depth->blue; + channels++; + } + else + { + shift_start[channels] = row_info->bit_depth - bit_depth->gray; + shift_dec[channels] = bit_depth->gray; + channels++; + } + if (row_info->color_type & PNG_COLOR_MASK_ALPHA) + { + shift_start[channels] = row_info->bit_depth - bit_depth->alpha; + shift_dec[channels] = bit_depth->alpha; + channels++; + } + + /* With low row depths, could only be grayscale, so one channel */ + if (row_info->bit_depth < 8) + { + png_bytep bp = row; + png_uint_32 i; + png_byte mask; + png_uint_32 row_bytes = row_info->rowbytes; + + if (bit_depth->gray == 1 && row_info->bit_depth == 2) + mask = 0x55; + else if (row_info->bit_depth == 4 && bit_depth->gray == 3) + mask = 0x11; + else + mask = 0xff; + + for (i = 0; i < row_bytes; i++, bp++) + { + png_uint_16 v; + int j; + + v = *bp; + *bp = 0; + for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0]) + { + if (j > 0) + *bp |= (png_byte)((v << j) & 0xff); + else + *bp |= (png_byte)((v >> (-j)) & mask); + } + } + } + else if (row_info->bit_depth == 8) + { + png_bytep bp = row; + png_uint_32 i; + png_uint_32 istop = channels * row_info->width; + + for (i = 0; i < istop; i++, bp++) + { + + png_uint_16 v; + int j; + int c = (int)(i%channels); + + v = *bp; + *bp = 0; + for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c]) + { + if (j > 0) + *bp |= (png_byte)((v << j) & 0xff); + else + *bp |= (png_byte)((v >> (-j)) & 0xff); + } + } + } + else + { + png_bytep bp; + png_uint_32 i; + png_uint_32 istop = channels * row_info->width; + + for (bp = row, i = 0; i < istop; i++) + { + int c = (int)(i%channels); + png_uint_16 value, v; + int j; + + v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1)); + value = 0; + for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c]) + { + if (j > 0) + value |= (png_uint_16)((v << j) & (png_uint_16)0xffff); + else + value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff); + } + *bp++ = (png_byte)(value >> 8); + *bp++ = (png_byte)(value & 0xff); + } + } + } +} +#endif + +#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED +void /* PRIVATE */ +png_do_write_swap_alpha(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_write_swap_alpha"); + + { + if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + { + /* This converts from ARGB to RGBA */ + if (row_info->bit_depth == 8) + { + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + for (i = 0, sp = dp = row; i < row_width; i++) + { + png_byte save = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = save; + } + } + /* This converts from AARRGGBB to RRGGBBAA */ + else + { + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + for (i = 0, sp = dp = row; i < row_width; i++) + { + png_byte save[2]; + save[0] = *(sp++); + save[1] = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = save[0]; + *(dp++) = save[1]; + } + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + { + /* This converts from AG to GA */ + if (row_info->bit_depth == 8) + { + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + for (i = 0, sp = dp = row; i < row_width; i++) + { + png_byte save = *(sp++); + *(dp++) = *(sp++); + *(dp++) = save; + } + } + /* This converts from AAGG to GGAA */ + else + { + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + for (i = 0, sp = dp = row; i < row_width; i++) + { + png_byte save[2]; + save[0] = *(sp++); + save[1] = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = save[0]; + *(dp++) = save[1]; + } + } + } + } +} +#endif + +#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED +void /* PRIVATE */ +png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_write_invert_alpha"); + + { + if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + { + /* This inverts the alpha channel in RGBA */ + if (row_info->bit_depth == 8) + { + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + for (i = 0, sp = dp = row; i < row_width; i++) + { + /* Does nothing + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + */ + sp+=3; dp = sp; + *(dp++) = (png_byte)(255 - *(sp++)); + } + } + /* This inverts the alpha channel in RRGGBBAA */ + else + { + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + for (i = 0, sp = dp = row; i < row_width; i++) + { + /* Does nothing + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + */ + sp+=6; dp = sp; + *(dp++) = (png_byte)(255 - *(sp++)); + *(dp++) = (png_byte)(255 - *(sp++)); + } + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + { + /* This inverts the alpha channel in GA */ + if (row_info->bit_depth == 8) + { + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + for (i = 0, sp = dp = row; i < row_width; i++) + { + *(dp++) = *(sp++); + *(dp++) = (png_byte)(255 - *(sp++)); + } + } + /* This inverts the alpha channel in GGAA */ + else + { + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + for (i = 0, sp = dp = row; i < row_width; i++) + { + /* Does nothing + *(dp++) = *(sp++); + *(dp++) = *(sp++); + */ + sp+=2; dp = sp; + *(dp++) = (png_byte)(255 - *(sp++)); + *(dp++) = (png_byte)(255 - *(sp++)); + } + } + } + } +} +#endif + +#ifdef PNG_MNG_FEATURES_SUPPORTED +/* Undoes intrapixel differencing */ +void /* PRIVATE */ +png_do_write_intrapixel(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_write_intrapixel"); + + if ( + (row_info->color_type & PNG_COLOR_MASK_COLOR)) + { + int bytes_per_pixel; + png_uint_32 row_width = row_info->width; + if (row_info->bit_depth == 8) + { + png_bytep rp; + png_uint_32 i; + + if (row_info->color_type == PNG_COLOR_TYPE_RGB) + bytes_per_pixel = 3; + else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + bytes_per_pixel = 4; + else + return; + + for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) + { + *(rp) = (png_byte)((*rp - *(rp+1))&0xff); + *(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff); + } + } + else if (row_info->bit_depth == 16) + { + png_bytep rp; + png_uint_32 i; + + if (row_info->color_type == PNG_COLOR_TYPE_RGB) + bytes_per_pixel = 6; + else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + bytes_per_pixel = 8; + else + return; + + for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) + { + png_uint_32 s0 = (*(rp ) << 8) | *(rp+1); + png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3); + png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5); + png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL); + png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL); + *(rp ) = (png_byte)((red >> 8) & 0xff); + *(rp+1) = (png_byte)(red & 0xff); + *(rp+4) = (png_byte)((blue >> 8) & 0xff); + *(rp+5) = (png_byte)(blue & 0xff); + } + } + } +} +#endif /* PNG_MNG_FEATURES_SUPPORTED */ +#endif /* PNG_WRITE_SUPPORTED */ diff --git a/png/pngwutil.c b/png/pngwutil.c new file mode 100644 index 0000000..19feb1d --- /dev/null +++ b/png/pngwutil.c @@ -0,0 +1,2786 @@ + +/* pngwutil.c - utilities to write a PNG file + * + * Last changed in libpng 1.4.1 [February 25, 2010] + * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + */ + +#define PNG_NO_PEDANTIC_WARNINGS +#include "png.h" +#ifdef PNG_WRITE_SUPPORTED +#include "pngpriv.h" + +/* Place a 32-bit number into a buffer in PNG byte order. We work + * with unsigned numbers for convenience, although one supported + * ancillary chunk uses signed (two's complement) numbers. + */ +void PNGAPI +png_save_uint_32(png_bytep buf, png_uint_32 i) +{ + buf[0] = (png_byte)((i >> 24) & 0xff); + buf[1] = (png_byte)((i >> 16) & 0xff); + buf[2] = (png_byte)((i >> 8) & 0xff); + buf[3] = (png_byte)(i & 0xff); +} + +#ifdef PNG_SAVE_INT_32_SUPPORTED +/* The png_save_int_32 function assumes integers are stored in two's + * complement format. If this isn't the case, then this routine needs to + * be modified to write data in two's complement format. + */ +void PNGAPI +png_save_int_32(png_bytep buf, png_int_32 i) +{ + buf[0] = (png_byte)((i >> 24) & 0xff); + buf[1] = (png_byte)((i >> 16) & 0xff); + buf[2] = (png_byte)((i >> 8) & 0xff); + buf[3] = (png_byte)(i & 0xff); +} +#endif + +/* Place a 16-bit number into a buffer in PNG byte order. + * The parameter is declared unsigned int, not png_uint_16, + * just to avoid potential problems on pre-ANSI C compilers. + */ +void PNGAPI +png_save_uint_16(png_bytep buf, unsigned int i) +{ + buf[0] = (png_byte)((i >> 8) & 0xff); + buf[1] = (png_byte)(i & 0xff); +} + +/* Simple function to write the signature. If we have already written + * the magic bytes of the signature, or more likely, the PNG stream is + * being embedded into another stream and doesn't need its own signature, + * we should call png_set_sig_bytes() to tell libpng how many of the + * bytes have already been written. + */ +void PNGAPI +png_write_sig(png_structp png_ptr) +{ + png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; + +#ifdef PNG_IO_STATE_SUPPORTED + /* Inform the I/O callback that the signature is being written */ + png_ptr->io_state = PNG_IO_WRITING | PNG_IO_SIGNATURE; +#endif + + /* Write the rest of the 8 byte signature */ + png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes], + (png_size_t)(8 - png_ptr->sig_bytes)); + if (png_ptr->sig_bytes < 3) + png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE; +} + +/* Write a PNG chunk all at once. The type is an array of ASCII characters + * representing the chunk name. The array must be at least 4 bytes in + * length, and does not need to be null terminated. To be safe, pass the + * pre-defined chunk names here, and if you need a new one, define it + * where the others are defined. The length is the length of the data. + * All the data must be present. If that is not possible, use the + * png_write_chunk_start(), png_write_chunk_data(), and png_write_chunk_end() + * functions instead. + */ +void PNGAPI +png_write_chunk(png_structp png_ptr, png_bytep chunk_name, + png_bytep data, png_size_t length) +{ + if (png_ptr == NULL) + return; + png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length); + png_write_chunk_data(png_ptr, data, (png_size_t)length); + png_write_chunk_end(png_ptr); +} + +/* Write the start of a PNG chunk. The type is the chunk type. + * The total_length is the sum of the lengths of all the data you will be + * passing in png_write_chunk_data(). + */ +void PNGAPI +png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name, + png_uint_32 length) +{ + png_byte buf[8]; + + png_debug2(0, "Writing %s chunk, length = %lu", chunk_name, + (unsigned long)length); + + if (png_ptr == NULL) + return; + +#ifdef PNG_IO_STATE_SUPPORTED + /* Inform the I/O callback that the chunk header is being written. + * PNG_IO_CHUNK_HDR requires a single I/O call. + */ + png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_HDR; +#endif + + /* Write the length and the chunk name */ + png_save_uint_32(buf, length); + png_memcpy(buf + 4, chunk_name, 4); + png_write_data(png_ptr, buf, (png_size_t)8); + /* Put the chunk name into png_ptr->chunk_name */ + png_memcpy(png_ptr->chunk_name, chunk_name, 4); + /* Reset the crc and run it over the chunk name */ + png_reset_crc(png_ptr); + png_calculate_crc(png_ptr, chunk_name, 4); + +#ifdef PNG_IO_STATE_SUPPORTED + /* Inform the I/O callback that chunk data will (possibly) be written. + * PNG_IO_CHUNK_DATA does NOT require a specific number of I/O calls. + */ + png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_DATA; +#endif +} + +/* Write the data of a PNG chunk started with png_write_chunk_start(). + * Note that multiple calls to this function are allowed, and that the + * sum of the lengths from these calls *must* add up to the total_length + * given to png_write_chunk_start(). + */ +void PNGAPI +png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + /* Write the data, and run the CRC over it */ + if (png_ptr == NULL) + return; + if (data != NULL && length > 0) + { + png_write_data(png_ptr, data, length); + /* Update the CRC after writing the data, + * in case that the user I/O routine alters it. + */ + png_calculate_crc(png_ptr, data, length); + } +} + +/* Finish a chunk started with png_write_chunk_start(). */ +void PNGAPI +png_write_chunk_end(png_structp png_ptr) +{ + png_byte buf[4]; + + if (png_ptr == NULL) return; + +#ifdef PNG_IO_STATE_SUPPORTED + /* Inform the I/O callback that the chunk CRC is being written. + * PNG_IO_CHUNK_CRC requires a single I/O function call. + */ + png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_CRC; +#endif + + /* Write the crc in a single operation */ + png_save_uint_32(buf, png_ptr->crc); + + png_write_data(png_ptr, buf, (png_size_t)4); +} + +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED) +/* This pair of functions encapsulates the operation of (a) compressing a + * text string, and (b) issuing it later as a series of chunk data writes. + * The compression_state structure is shared context for these functions + * set up by the caller in order to make the whole mess thread-safe. + */ + +typedef struct +{ + char *input; /* The uncompressed input data */ + int input_len; /* Its length */ + int num_output_ptr; /* Number of output pointers used */ + int max_output_ptr; /* Size of output_ptr */ + png_charpp output_ptr; /* Array of pointers to output */ +} compression_state; + +/* Compress given text into storage in the png_ptr structure */ +static int /* PRIVATE */ +png_text_compress(png_structp png_ptr, + png_charp text, png_size_t text_len, int compression, + compression_state *comp) +{ + int ret; + + comp->num_output_ptr = 0; + comp->max_output_ptr = 0; + comp->output_ptr = NULL; + comp->input = NULL; + comp->input_len = 0; + + /* We may just want to pass the text right through */ + if (compression == PNG_TEXT_COMPRESSION_NONE) + { + comp->input = text; + comp->input_len = text_len; + return((int)text_len); + } + + if (compression >= PNG_TEXT_COMPRESSION_LAST) + { +#ifdef PNG_STDIO_SUPPORTED + char msg[50]; + png_snprintf(msg, 50, "Unknown compression type %d", compression); + png_warning(png_ptr, msg); +#else + png_warning(png_ptr, "Unknown compression type"); +#endif + } + + /* We can't write the chunk until we find out how much data we have, + * which means we need to run the compressor first and save the + * output. This shouldn't be a problem, as the vast majority of + * comments should be reasonable, but we will set up an array of + * malloc'd pointers to be sure. + * + * If we knew the application was well behaved, we could simplify this + * greatly by assuming we can always malloc an output buffer large + * enough to hold the compressed text ((1001 * text_len / 1000) + 12) + * and malloc this directly. The only time this would be a bad idea is + * if we can't malloc more than 64K and we have 64K of random input + * data, or if the input string is incredibly large (although this + * wouldn't cause a failure, just a slowdown due to swapping). + */ + + /* Set up the compression buffers */ + png_ptr->zstream.avail_in = (uInt)text_len; + png_ptr->zstream.next_in = (Bytef *)text; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_out = (Bytef *)png_ptr->zbuf; + + /* This is the same compression loop as in png_write_row() */ + do + { + /* Compress the data */ + ret = deflate(&png_ptr->zstream, Z_NO_FLUSH); + if (ret != Z_OK) + { + /* Error */ + if (png_ptr->zstream.msg != NULL) + png_error(png_ptr, png_ptr->zstream.msg); + else + png_error(png_ptr, "zlib error"); + } + /* Check to see if we need more room */ + if (!(png_ptr->zstream.avail_out)) + { + /* Make sure the output array has room */ + if (comp->num_output_ptr >= comp->max_output_ptr) + { + int old_max; + + old_max = comp->max_output_ptr; + comp->max_output_ptr = comp->num_output_ptr + 4; + if (comp->output_ptr != NULL) + { + png_charpp old_ptr; + + old_ptr = comp->output_ptr; + comp->output_ptr = (png_charpp)png_malloc(png_ptr, + (png_alloc_size_t) + (comp->max_output_ptr * png_sizeof(png_charpp))); + png_memcpy(comp->output_ptr, old_ptr, old_max + * png_sizeof(png_charp)); + png_free(png_ptr, old_ptr); + } + else + comp->output_ptr = (png_charpp)png_malloc(png_ptr, + (png_alloc_size_t) + (comp->max_output_ptr * png_sizeof(png_charp))); + } + + /* Save the data */ + comp->output_ptr[comp->num_output_ptr] = + (png_charp)png_malloc(png_ptr, + (png_alloc_size_t)png_ptr->zbuf_size); + png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, + png_ptr->zbuf_size); + comp->num_output_ptr++; + + /* and reset the buffer */ + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_out = png_ptr->zbuf; + } + /* Continue until we don't have any more to compress */ + } while (png_ptr->zstream.avail_in); + + /* Finish the compression */ + do + { + /* Tell zlib we are finished */ + ret = deflate(&png_ptr->zstream, Z_FINISH); + + if (ret == Z_OK) + { + /* Check to see if we need more room */ + if (!(png_ptr->zstream.avail_out)) + { + /* Check to make sure our output array has room */ + if (comp->num_output_ptr >= comp->max_output_ptr) + { + int old_max; + + old_max = comp->max_output_ptr; + comp->max_output_ptr = comp->num_output_ptr + 4; + if (comp->output_ptr != NULL) + { + png_charpp old_ptr; + + old_ptr = comp->output_ptr; + /* This could be optimized to realloc() */ + comp->output_ptr = (png_charpp)png_malloc(png_ptr, + (png_alloc_size_t)(comp->max_output_ptr * + png_sizeof(png_charp))); + png_memcpy(comp->output_ptr, old_ptr, + old_max * png_sizeof(png_charp)); + png_free(png_ptr, old_ptr); + } + else + comp->output_ptr = (png_charpp)png_malloc(png_ptr, + (png_alloc_size_t)(comp->max_output_ptr * + png_sizeof(png_charp))); + } + + /* Save the data */ + comp->output_ptr[comp->num_output_ptr] = + (png_charp)png_malloc(png_ptr, + (png_alloc_size_t)png_ptr->zbuf_size); + png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, + png_ptr->zbuf_size); + comp->num_output_ptr++; + + /* and reset the buffer pointers */ + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_out = png_ptr->zbuf; + } + } + else if (ret != Z_STREAM_END) + { + /* We got an error */ + if (png_ptr->zstream.msg != NULL) + png_error(png_ptr, png_ptr->zstream.msg); + else + png_error(png_ptr, "zlib error"); + } + } while (ret != Z_STREAM_END); + + /* Text length is number of buffers plus last buffer */ + text_len = png_ptr->zbuf_size * comp->num_output_ptr; + if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) + text_len += png_ptr->zbuf_size - (png_size_t)png_ptr->zstream.avail_out; + + return((int)text_len); +} + +/* Ship the compressed text out via chunk writes */ +static void /* PRIVATE */ +png_write_compressed_data_out(png_structp png_ptr, compression_state *comp) +{ + int i; + + /* Handle the no-compression case */ + if (comp->input) + { + png_write_chunk_data(png_ptr, (png_bytep)comp->input, + (png_size_t)comp->input_len); + return; + } + + /* Write saved output buffers, if any */ + for (i = 0; i < comp->num_output_ptr; i++) + { + png_write_chunk_data(png_ptr, (png_bytep)comp->output_ptr[i], + (png_size_t)png_ptr->zbuf_size); + png_free(png_ptr, comp->output_ptr[i]); + } + if (comp->max_output_ptr != 0) + png_free(png_ptr, comp->output_ptr); + /* Write anything left in zbuf */ + if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size) + png_write_chunk_data(png_ptr, png_ptr->zbuf, + (png_size_t)(png_ptr->zbuf_size - png_ptr->zstream.avail_out)); + + /* Reset zlib for another zTXt/iTXt or image data */ + deflateReset(&png_ptr->zstream); + png_ptr->zstream.data_type = Z_BINARY; +} +#endif + +/* Write the IHDR chunk, and update the png_struct with the necessary + * information. Note that the rest of this code depends upon this + * information being correct. + */ +void /* PRIVATE */ +png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, + int bit_depth, int color_type, int compression_type, int filter_type, + int interlace_type) +{ + PNG_IHDR; + int ret; + + png_byte buf[13]; /* Buffer to store the IHDR info */ + + png_debug(1, "in png_write_IHDR"); + + /* Check that we have valid input data from the application info */ + switch (color_type) + { + case PNG_COLOR_TYPE_GRAY: + switch (bit_depth) + { + case 1: + case 2: + case 4: + case 8: + case 16: png_ptr->channels = 1; break; + default: png_error(png_ptr, + "Invalid bit depth for grayscale image"); + } + break; + case PNG_COLOR_TYPE_RGB: + if (bit_depth != 8 && bit_depth != 16) + png_error(png_ptr, "Invalid bit depth for RGB image"); + png_ptr->channels = 3; + break; + case PNG_COLOR_TYPE_PALETTE: + switch (bit_depth) + { + case 1: + case 2: + case 4: + case 8: png_ptr->channels = 1; break; + default: png_error(png_ptr, "Invalid bit depth for paletted image"); + } + break; + case PNG_COLOR_TYPE_GRAY_ALPHA: + if (bit_depth != 8 && bit_depth != 16) + png_error(png_ptr, "Invalid bit depth for grayscale+alpha image"); + png_ptr->channels = 2; + break; + case PNG_COLOR_TYPE_RGB_ALPHA: + if (bit_depth != 8 && bit_depth != 16) + png_error(png_ptr, "Invalid bit depth for RGBA image"); + png_ptr->channels = 4; + break; + default: + png_error(png_ptr, "Invalid image color type specified"); + } + + if (compression_type != PNG_COMPRESSION_TYPE_BASE) + { + png_warning(png_ptr, "Invalid compression type specified"); + compression_type = PNG_COMPRESSION_TYPE_BASE; + } + + /* Write filter_method 64 (intrapixel differencing) only if + * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and + * 2. Libpng did not write a PNG signature (this filter_method is only + * used in PNG datastreams that are embedded in MNG datastreams) and + * 3. The application called png_permit_mng_features with a mask that + * included PNG_FLAG_MNG_FILTER_64 and + * 4. The filter_method is 64 and + * 5. The color_type is RGB or RGBA + */ + if ( +#ifdef PNG_MNG_FEATURES_SUPPORTED + !((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) && + (color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) && + (filter_type == PNG_INTRAPIXEL_DIFFERENCING)) && +#endif + filter_type != PNG_FILTER_TYPE_BASE) + { + png_warning(png_ptr, "Invalid filter type specified"); + filter_type = PNG_FILTER_TYPE_BASE; + } + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + if (interlace_type != PNG_INTERLACE_NONE && + interlace_type != PNG_INTERLACE_ADAM7) + { + png_warning(png_ptr, "Invalid interlace type specified"); + interlace_type = PNG_INTERLACE_ADAM7; + } +#else + interlace_type=PNG_INTERLACE_NONE; +#endif + + /* Save the relevent information */ + png_ptr->bit_depth = (png_byte)bit_depth; + png_ptr->color_type = (png_byte)color_type; + png_ptr->interlaced = (png_byte)interlace_type; +#ifdef PNG_MNG_FEATURES_SUPPORTED + png_ptr->filter_type = (png_byte)filter_type; +#endif + png_ptr->compression_type = (png_byte)compression_type; + png_ptr->width = width; + png_ptr->height = height; + + png_ptr->pixel_depth = (png_byte)(bit_depth * png_ptr->channels); + png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width); + /* Set the usr info, so any transformations can modify it */ + png_ptr->usr_width = png_ptr->width; + png_ptr->usr_bit_depth = png_ptr->bit_depth; + png_ptr->usr_channels = png_ptr->channels; + + /* Pack the header information into the buffer */ + png_save_uint_32(buf, width); + png_save_uint_32(buf + 4, height); + buf[8] = (png_byte)bit_depth; + buf[9] = (png_byte)color_type; + buf[10] = (png_byte)compression_type; + buf[11] = (png_byte)filter_type; + buf[12] = (png_byte)interlace_type; + + /* Write the chunk */ + png_write_chunk(png_ptr, (png_bytep)png_IHDR, buf, (png_size_t)13); + + /* Initialize zlib with PNG info */ + png_ptr->zstream.zalloc = png_zalloc; + png_ptr->zstream.zfree = png_zfree; + png_ptr->zstream.opaque = (voidpf)png_ptr; + if (!(png_ptr->do_filter)) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE || + png_ptr->bit_depth < 8) + png_ptr->do_filter = PNG_FILTER_NONE; + else + png_ptr->do_filter = PNG_ALL_FILTERS; + } + if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_STRATEGY)) + { + if (png_ptr->do_filter != PNG_FILTER_NONE) + png_ptr->zlib_strategy = Z_FILTERED; + else + png_ptr->zlib_strategy = Z_DEFAULT_STRATEGY; + } + if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_LEVEL)) + png_ptr->zlib_level = Z_DEFAULT_COMPRESSION; + if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL)) + png_ptr->zlib_mem_level = 8; + if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS)) + png_ptr->zlib_window_bits = 15; + if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD)) + png_ptr->zlib_method = 8; + ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level, + png_ptr->zlib_method, png_ptr->zlib_window_bits, + png_ptr->zlib_mem_level, png_ptr->zlib_strategy); + if (ret != Z_OK) + { + if (ret == Z_VERSION_ERROR) png_error(png_ptr, + "zlib failed to initialize compressor -- version error"); + if (ret == Z_STREAM_ERROR) png_error(png_ptr, + "zlib failed to initialize compressor -- stream error"); + if (ret == Z_MEM_ERROR) png_error(png_ptr, + "zlib failed to initialize compressor -- mem error"); + png_error(png_ptr, "zlib failed to initialize compressor"); + } + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + /* libpng is not interested in zstream.data_type */ + /* Set it to a predefined value, to avoid its evaluation inside zlib */ + png_ptr->zstream.data_type = Z_BINARY; + + png_ptr->mode = PNG_HAVE_IHDR; +} + +/* Write the palette. We are careful not to trust png_color to be in the + * correct order for PNG, so people can redefine it to any convenient + * structure. + */ +void /* PRIVATE */ +png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) +{ + PNG_PLTE; + png_uint_32 i; + png_colorp pal_ptr; + png_byte buf[3]; + + png_debug(1, "in png_write_PLTE"); + + if (( +#ifdef PNG_MNG_FEATURES_SUPPORTED + !(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) && +#endif + num_pal == 0) || num_pal > 256) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + png_error(png_ptr, "Invalid number of colors in palette"); + } + else + { + png_warning(png_ptr, "Invalid number of colors in palette"); + return; + } + } + + if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR)) + { + png_warning(png_ptr, + "Ignoring request to write a PLTE chunk in grayscale PNG"); + return; + } + + png_ptr->num_palette = (png_uint_16)num_pal; + png_debug1(3, "num_palette = %d", png_ptr->num_palette); + + png_write_chunk_start(png_ptr, (png_bytep)png_PLTE, + (png_uint_32)(num_pal * 3)); +#ifdef PNG_POINTER_INDEXING_SUPPORTED + for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++) + { + buf[0] = pal_ptr->red; + buf[1] = pal_ptr->green; + buf[2] = pal_ptr->blue; + png_write_chunk_data(png_ptr, buf, (png_size_t)3); + } +#else + /* This is a little slower but some buggy compilers need to do this + * instead + */ + pal_ptr=palette; + for (i = 0; i < num_pal; i++) + { + buf[0] = pal_ptr[i].red; + buf[1] = pal_ptr[i].green; + buf[2] = pal_ptr[i].blue; + png_write_chunk_data(png_ptr, buf, (png_size_t)3); + } +#endif + png_write_chunk_end(png_ptr); + png_ptr->mode |= PNG_HAVE_PLTE; +} + +/* Write an IDAT chunk */ +void /* PRIVATE */ +png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) +{ + PNG_IDAT; + + png_debug(1, "in png_write_IDAT"); + + /* Optimize the CMF field in the zlib stream. */ + /* This hack of the zlib stream is compliant to the stream specification. */ + if (!(png_ptr->mode & PNG_HAVE_IDAT) && + png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE) + { + unsigned int z_cmf = data[0]; /* zlib compression method and flags */ + if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70) + { + /* Avoid memory underflows and multiplication overflows. + * + * The conditions below are practically always satisfied; + * however, they still must be checked. + */ + if (length >= 2 && + png_ptr->height < 16384 && png_ptr->width < 16384) + { + png_uint_32 uncompressed_idat_size = png_ptr->height * + ((png_ptr->width * + png_ptr->channels * png_ptr->bit_depth + 15) >> 3); + unsigned int z_cinfo = z_cmf >> 4; + unsigned int half_z_window_size = 1 << (z_cinfo + 7); + while (uncompressed_idat_size <= half_z_window_size && + half_z_window_size >= 256) + { + z_cinfo--; + half_z_window_size >>= 1; + } + z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4); + if (data[0] != (png_byte)z_cmf) + { + data[0] = (png_byte)z_cmf; + data[1] &= 0xe0; + data[1] += (png_byte)(0x1f - ((z_cmf << 8) + data[1]) % 0x1f); + } + } + } + else + png_error(png_ptr, + "Invalid zlib compression method or flags in IDAT"); + } + + png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length); + png_ptr->mode |= PNG_HAVE_IDAT; +} + +/* Write an IEND chunk */ +void /* PRIVATE */ +png_write_IEND(png_structp png_ptr) +{ + PNG_IEND; + + png_debug(1, "in png_write_IEND"); + + png_write_chunk(png_ptr, (png_bytep)png_IEND, NULL, + (png_size_t)0); + png_ptr->mode |= PNG_HAVE_IEND; +} + +#ifdef PNG_WRITE_gAMA_SUPPORTED +/* Write a gAMA chunk */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +void /* PRIVATE */ +png_write_gAMA(png_structp png_ptr, double file_gamma) +{ + PNG_gAMA; + png_uint_32 igamma; + png_byte buf[4]; + + png_debug(1, "in png_write_gAMA"); + + /* file_gamma is saved in 1/100,000ths */ + igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5); + png_save_uint_32(buf, igamma); + png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); +} +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +void /* PRIVATE */ +png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma) +{ + PNG_gAMA; + png_byte buf[4]; + + png_debug(1, "in png_write_gAMA"); + + /* file_gamma is saved in 1/100,000ths */ + png_save_uint_32(buf, (png_uint_32)file_gamma); + png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); +} +#endif +#endif + +#ifdef PNG_WRITE_sRGB_SUPPORTED +/* Write a sRGB chunk */ +void /* PRIVATE */ +png_write_sRGB(png_structp png_ptr, int srgb_intent) +{ + PNG_sRGB; + png_byte buf[1]; + + png_debug(1, "in png_write_sRGB"); + + if (srgb_intent >= PNG_sRGB_INTENT_LAST) + png_warning(png_ptr, + "Invalid sRGB rendering intent specified"); + buf[0]=(png_byte)srgb_intent; + png_write_chunk(png_ptr, (png_bytep)png_sRGB, buf, (png_size_t)1); +} +#endif + +#ifdef PNG_WRITE_iCCP_SUPPORTED +/* Write an iCCP chunk */ +void /* PRIVATE */ +png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type, + png_charp profile, int profile_len) +{ + PNG_iCCP; + png_size_t name_len; + png_charp new_name; + compression_state comp; + int embedded_profile_len = 0; + + png_debug(1, "in png_write_iCCP"); + + comp.num_output_ptr = 0; + comp.max_output_ptr = 0; + comp.output_ptr = NULL; + comp.input = NULL; + comp.input_len = 0; + + if ((name_len = png_check_keyword(png_ptr, name, + &new_name)) == 0) + return; + + if (compression_type != PNG_COMPRESSION_TYPE_BASE) + png_warning(png_ptr, "Unknown compression type in iCCP chunk"); + + if (profile == NULL) + profile_len = 0; + + if (profile_len > 3) + embedded_profile_len = + ((*( (png_bytep)profile ))<<24) | + ((*( (png_bytep)profile + 1))<<16) | + ((*( (png_bytep)profile + 2))<< 8) | + ((*( (png_bytep)profile + 3)) ); + + if (embedded_profile_len < 0) + { + png_warning(png_ptr, + "Embedded profile length in iCCP chunk is negative"); + png_free(png_ptr, new_name); + return; + } + + if (profile_len < embedded_profile_len) + { + png_warning(png_ptr, + "Embedded profile length too large in iCCP chunk"); + png_free(png_ptr, new_name); + return; + } + + if (profile_len > embedded_profile_len) + { + png_warning(png_ptr, + "Truncating profile to actual length in iCCP chunk"); + profile_len = embedded_profile_len; + } + + if (profile_len) + profile_len = png_text_compress(png_ptr, profile, + (png_size_t)profile_len, PNG_COMPRESSION_TYPE_BASE, &comp); + + /* Make sure we include the NULL after the name and the compression type */ + png_write_chunk_start(png_ptr, (png_bytep)png_iCCP, + (png_uint_32)(name_len + profile_len + 2)); + new_name[name_len + 1] = 0x00; + png_write_chunk_data(png_ptr, (png_bytep)new_name, + (png_size_t)(name_len + 2)); + + if (profile_len) + png_write_compressed_data_out(png_ptr, &comp); + + png_write_chunk_end(png_ptr); + png_free(png_ptr, new_name); +} +#endif + +#ifdef PNG_WRITE_sPLT_SUPPORTED +/* Write a sPLT chunk */ +void /* PRIVATE */ +png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette) +{ + PNG_sPLT; + png_size_t name_len; + png_charp new_name; + png_byte entrybuf[10]; + png_size_t entry_size = (spalette->depth == 8 ? 6 : 10); + png_size_t palette_size = entry_size * spalette->nentries; + png_sPLT_entryp ep; +#ifndef PNG_POINTER_INDEXING_SUPPORTED + int i; +#endif + + png_debug(1, "in png_write_sPLT"); + + if ((name_len = png_check_keyword(png_ptr,spalette->name, &new_name))==0) + return; + + /* Make sure we include the NULL after the name */ + png_write_chunk_start(png_ptr, (png_bytep)png_sPLT, + (png_uint_32)(name_len + 2 + palette_size)); + png_write_chunk_data(png_ptr, (png_bytep)new_name, + (png_size_t)(name_len + 1)); + png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, (png_size_t)1); + + /* Loop through each palette entry, writing appropriately */ +#ifdef PNG_POINTER_INDEXING_SUPPORTED + for (ep = spalette->entries; epentries + spalette->nentries; ep++) + { + if (spalette->depth == 8) + { + entrybuf[0] = (png_byte)ep->red; + entrybuf[1] = (png_byte)ep->green; + entrybuf[2] = (png_byte)ep->blue; + entrybuf[3] = (png_byte)ep->alpha; + png_save_uint_16(entrybuf + 4, ep->frequency); + } + else + { + png_save_uint_16(entrybuf + 0, ep->red); + png_save_uint_16(entrybuf + 2, ep->green); + png_save_uint_16(entrybuf + 4, ep->blue); + png_save_uint_16(entrybuf + 6, ep->alpha); + png_save_uint_16(entrybuf + 8, ep->frequency); + } + png_write_chunk_data(png_ptr, entrybuf, (png_size_t)entry_size); + } +#else + ep=spalette->entries; + for (i=0; i>spalette->nentries; i++) + { + if (spalette->depth == 8) + { + entrybuf[0] = (png_byte)ep[i].red; + entrybuf[1] = (png_byte)ep[i].green; + entrybuf[2] = (png_byte)ep[i].blue; + entrybuf[3] = (png_byte)ep[i].alpha; + png_save_uint_16(entrybuf + 4, ep[i].frequency); + } + else + { + png_save_uint_16(entrybuf + 0, ep[i].red); + png_save_uint_16(entrybuf + 2, ep[i].green); + png_save_uint_16(entrybuf + 4, ep[i].blue); + png_save_uint_16(entrybuf + 6, ep[i].alpha); + png_save_uint_16(entrybuf + 8, ep[i].frequency); + } + png_write_chunk_data(png_ptr, entrybuf, (png_size_t)entry_size); + } +#endif + + png_write_chunk_end(png_ptr); + png_free(png_ptr, new_name); +} +#endif + +#ifdef PNG_WRITE_sBIT_SUPPORTED +/* Write the sBIT chunk */ +void /* PRIVATE */ +png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type) +{ + PNG_sBIT; + png_byte buf[4]; + png_size_t size; + + png_debug(1, "in png_write_sBIT"); + + /* Make sure we don't depend upon the order of PNG_COLOR_8 */ + if (color_type & PNG_COLOR_MASK_COLOR) + { + png_byte maxbits; + + maxbits = (png_byte)(color_type==PNG_COLOR_TYPE_PALETTE ? 8 : + png_ptr->usr_bit_depth); + if (sbit->red == 0 || sbit->red > maxbits || + sbit->green == 0 || sbit->green > maxbits || + sbit->blue == 0 || sbit->blue > maxbits) + { + png_warning(png_ptr, "Invalid sBIT depth specified"); + return; + } + buf[0] = sbit->red; + buf[1] = sbit->green; + buf[2] = sbit->blue; + size = 3; + } + else + { + if (sbit->gray == 0 || sbit->gray > png_ptr->usr_bit_depth) + { + png_warning(png_ptr, "Invalid sBIT depth specified"); + return; + } + buf[0] = sbit->gray; + size = 1; + } + + if (color_type & PNG_COLOR_MASK_ALPHA) + { + if (sbit->alpha == 0 || sbit->alpha > png_ptr->usr_bit_depth) + { + png_warning(png_ptr, "Invalid sBIT depth specified"); + return; + } + buf[size++] = sbit->alpha; + } + + png_write_chunk(png_ptr, (png_bytep)png_sBIT, buf, size); +} +#endif + +#ifdef PNG_WRITE_cHRM_SUPPORTED +/* Write the cHRM chunk */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +void /* PRIVATE */ +png_write_cHRM(png_structp png_ptr, double white_x, double white_y, + double red_x, double red_y, double green_x, double green_y, + double blue_x, double blue_y) +{ + PNG_cHRM; + png_byte buf[32]; + + png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, + int_green_x, int_green_y, int_blue_x, int_blue_y; + + png_debug(1, "in png_write_cHRM"); + + int_white_x = (png_uint_32)(white_x * 100000.0 + 0.5); + int_white_y = (png_uint_32)(white_y * 100000.0 + 0.5); + int_red_x = (png_uint_32)(red_x * 100000.0 + 0.5); + int_red_y = (png_uint_32)(red_y * 100000.0 + 0.5); + int_green_x = (png_uint_32)(green_x * 100000.0 + 0.5); + int_green_y = (png_uint_32)(green_y * 100000.0 + 0.5); + int_blue_x = (png_uint_32)(blue_x * 100000.0 + 0.5); + int_blue_y = (png_uint_32)(blue_y * 100000.0 + 0.5); + +#ifdef PNG_CHECK_cHRM_SUPPORTED + if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y, + int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y)) +#endif + { + /* Each value is saved in 1/100,000ths */ + + png_save_uint_32(buf, int_white_x); + png_save_uint_32(buf + 4, int_white_y); + + png_save_uint_32(buf + 8, int_red_x); + png_save_uint_32(buf + 12, int_red_y); + + png_save_uint_32(buf + 16, int_green_x); + png_save_uint_32(buf + 20, int_green_y); + + png_save_uint_32(buf + 24, int_blue_x); + png_save_uint_32(buf + 28, int_blue_y); + + png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); + } +} +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +void /* PRIVATE */ +png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x, + png_fixed_point white_y, png_fixed_point red_x, png_fixed_point red_y, + png_fixed_point green_x, png_fixed_point green_y, png_fixed_point blue_x, + png_fixed_point blue_y) +{ + PNG_cHRM; + png_byte buf[32]; + + png_debug(1, "in png_write_cHRM"); + + /* Each value is saved in 1/100,000ths */ +#ifdef PNG_CHECK_cHRM_SUPPORTED + if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y, + green_x, green_y, blue_x, blue_y)) +#endif + { + png_save_uint_32(buf, (png_uint_32)white_x); + png_save_uint_32(buf + 4, (png_uint_32)white_y); + + png_save_uint_32(buf + 8, (png_uint_32)red_x); + png_save_uint_32(buf + 12, (png_uint_32)red_y); + + png_save_uint_32(buf + 16, (png_uint_32)green_x); + png_save_uint_32(buf + 20, (png_uint_32)green_y); + + png_save_uint_32(buf + 24, (png_uint_32)blue_x); + png_save_uint_32(buf + 28, (png_uint_32)blue_y); + + png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); + } +} +#endif +#endif + +#ifdef PNG_WRITE_tRNS_SUPPORTED +/* Write the tRNS chunk */ +void /* PRIVATE */ +png_write_tRNS(png_structp png_ptr, png_bytep trans_alpha, png_color_16p tran, + int num_trans, int color_type) +{ + PNG_tRNS; + png_byte buf[6]; + + png_debug(1, "in png_write_tRNS"); + + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette) + { + png_warning(png_ptr, "Invalid number of transparent colors specified"); + return; + } + /* Write the chunk out as it is */ + png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans_alpha, + (png_size_t)num_trans); + } + else if (color_type == PNG_COLOR_TYPE_GRAY) + { + /* One 16 bit value */ + if (tran->gray >= (1 << png_ptr->bit_depth)) + { + png_warning(png_ptr, + "Ignoring attempt to write tRNS chunk out-of-range for bit_depth"); + return; + } + png_save_uint_16(buf, tran->gray); + png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)2); + } + else if (color_type == PNG_COLOR_TYPE_RGB) + { + /* Three 16 bit values */ + png_save_uint_16(buf, tran->red); + png_save_uint_16(buf + 2, tran->green); + png_save_uint_16(buf + 4, tran->blue); + if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4])) + { + png_warning(png_ptr, + "Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8"); + return; + } + png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)6); + } + else + { + png_warning(png_ptr, "Can't write tRNS with an alpha channel"); + } +} +#endif + +#ifdef PNG_WRITE_bKGD_SUPPORTED +/* Write the background chunk */ +void /* PRIVATE */ +png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) +{ + PNG_bKGD; + png_byte buf[6]; + + png_debug(1, "in png_write_bKGD"); + + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + if ( +#ifdef PNG_MNG_FEATURES_SUPPORTED + (png_ptr->num_palette || + (!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) && +#endif + back->index >= png_ptr->num_palette) + { + png_warning(png_ptr, "Invalid background palette index"); + return; + } + buf[0] = back->index; + png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)1); + } + else if (color_type & PNG_COLOR_MASK_COLOR) + { + png_save_uint_16(buf, back->red); + png_save_uint_16(buf + 2, back->green); + png_save_uint_16(buf + 4, back->blue); + if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4])) + { + png_warning(png_ptr, + "Ignoring attempt to write 16-bit bKGD chunk when bit_depth is 8"); + return; + } + png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)6); + } + else + { + if (back->gray >= (1 << png_ptr->bit_depth)) + { + png_warning(png_ptr, + "Ignoring attempt to write bKGD chunk out-of-range for bit_depth"); + return; + } + png_save_uint_16(buf, back->gray); + png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)2); + } +} +#endif + +#ifdef PNG_WRITE_hIST_SUPPORTED +/* Write the histogram */ +void /* PRIVATE */ +png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) +{ + PNG_hIST; + int i; + png_byte buf[3]; + + png_debug(1, "in png_write_hIST"); + + if (num_hist > (int)png_ptr->num_palette) + { + png_debug2(3, "num_hist = %d, num_palette = %d", num_hist, + png_ptr->num_palette); + png_warning(png_ptr, "Invalid number of histogram entries specified"); + return; + } + + png_write_chunk_start(png_ptr, (png_bytep)png_hIST, + (png_uint_32)(num_hist * 2)); + for (i = 0; i < num_hist; i++) + { + png_save_uint_16(buf, hist[i]); + png_write_chunk_data(png_ptr, buf, (png_size_t)2); + } + png_write_chunk_end(png_ptr); +} +#endif + +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ + defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) +/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification, + * and if invalid, correct the keyword rather than discarding the entire + * chunk. The PNG 1.0 specification requires keywords 1-79 characters in + * length, forbids leading or trailing whitespace, multiple internal spaces, + * and the non-break space (0x80) from ISO 8859-1. Returns keyword length. + * + * The new_key is allocated to hold the corrected keyword and must be freed + * by the calling routine. This avoids problems with trying to write to + * static keywords without having to have duplicate copies of the strings. + */ +png_size_t /* PRIVATE */ +png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) +{ + png_size_t key_len; + png_charp kp, dp; + int kflag; + int kwarn=0; + + png_debug(1, "in png_check_keyword"); + + *new_key = NULL; + + if (key == NULL || (key_len = png_strlen(key)) == 0) + { + png_warning(png_ptr, "zero length keyword"); + return ((png_size_t)0); + } + + png_debug1(2, "Keyword to be checked is '%s'", key); + + *new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2)); + if (*new_key == NULL) + { + png_warning(png_ptr, "Out of memory while procesing keyword"); + return ((png_size_t)0); + } + + /* Replace non-printing characters with a blank and print a warning */ + for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++) + { + if ((png_byte)*kp < 0x20 || + ((png_byte)*kp > 0x7E && (png_byte)*kp < 0xA1)) + { +#ifdef PNG_STDIO_SUPPORTED + char msg[40]; + + png_snprintf(msg, 40, + "invalid keyword character 0x%02X", (png_byte)*kp); + png_warning(png_ptr, msg); +#else + png_warning(png_ptr, "invalid character in keyword"); +#endif + *dp = ' '; + } + else + { + *dp = *kp; + } + } + *dp = '\0'; + + /* Remove any trailing white space. */ + kp = *new_key + key_len - 1; + if (*kp == ' ') + { + png_warning(png_ptr, "trailing spaces removed from keyword"); + + while (*kp == ' ') + { + *(kp--) = '\0'; + key_len--; + } + } + + /* Remove any leading white space. */ + kp = *new_key; + if (*kp == ' ') + { + png_warning(png_ptr, "leading spaces removed from keyword"); + + while (*kp == ' ') + { + kp++; + key_len--; + } + } + + png_debug1(2, "Checking for multiple internal spaces in '%s'", kp); + + /* Remove multiple internal spaces. */ + for (kflag = 0, dp = *new_key; *kp != '\0'; kp++) + { + if (*kp == ' ' && kflag == 0) + { + *(dp++) = *kp; + kflag = 1; + } + else if (*kp == ' ') + { + key_len--; + kwarn=1; + } + else + { + *(dp++) = *kp; + kflag = 0; + } + } + *dp = '\0'; + if (kwarn) + png_warning(png_ptr, "extra interior spaces removed from keyword"); + + if (key_len == 0) + { + png_free(png_ptr, *new_key); + png_warning(png_ptr, "Zero length keyword"); + } + + if (key_len > 79) + { + png_warning(png_ptr, "keyword length must be 1 - 79 characters"); + (*new_key)[79] = '\0'; + key_len = 79; + } + + return (key_len); +} +#endif + +#ifdef PNG_WRITE_tEXt_SUPPORTED +/* Write a tEXt chunk */ +void /* PRIVATE */ +png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text, + png_size_t text_len) +{ + PNG_tEXt; + png_size_t key_len; + png_charp new_key; + + png_debug(1, "in png_write_tEXt"); + + if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0) + return; + + if (text == NULL || *text == '\0') + text_len = 0; + else + text_len = png_strlen(text); + + /* Make sure we include the 0 after the key */ + png_write_chunk_start(png_ptr, (png_bytep)png_tEXt, + (png_uint_32)(key_len + text_len + 1)); + /* + * We leave it to the application to meet PNG-1.0 requirements on the + * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of + * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them. + * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG. + */ + png_write_chunk_data(png_ptr, (png_bytep)new_key, + (png_size_t)(key_len + 1)); + if (text_len) + png_write_chunk_data(png_ptr, (png_bytep)text, (png_size_t)text_len); + + png_write_chunk_end(png_ptr); + png_free(png_ptr, new_key); +} +#endif + +#ifdef PNG_WRITE_zTXt_SUPPORTED +/* Write a compressed text chunk */ +void /* PRIVATE */ +png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text, + png_size_t text_len, int compression) +{ + PNG_zTXt; + png_size_t key_len; + char buf[1]; + png_charp new_key; + compression_state comp; + + png_debug(1, "in png_write_zTXt"); + + comp.num_output_ptr = 0; + comp.max_output_ptr = 0; + comp.output_ptr = NULL; + comp.input = NULL; + comp.input_len = 0; + + if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0) + { + png_free(png_ptr, new_key); + return; + } + + if (text == NULL || *text == '\0' || compression==PNG_TEXT_COMPRESSION_NONE) + { + png_write_tEXt(png_ptr, new_key, text, (png_size_t)0); + png_free(png_ptr, new_key); + return; + } + + text_len = png_strlen(text); + + /* Compute the compressed data; do it now for the length */ + text_len = png_text_compress(png_ptr, text, text_len, compression, + &comp); + + /* Write start of chunk */ + png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, + (png_uint_32)(key_len+text_len + 2)); + /* Write key */ + png_write_chunk_data(png_ptr, (png_bytep)new_key, + (png_size_t)(key_len + 1)); + png_free(png_ptr, new_key); + + buf[0] = (png_byte)compression; + /* Write compression */ + png_write_chunk_data(png_ptr, (png_bytep)buf, (png_size_t)1); + /* Write the compressed data */ + png_write_compressed_data_out(png_ptr, &comp); + + /* Close the chunk */ + png_write_chunk_end(png_ptr); +} +#endif + +#ifdef PNG_WRITE_iTXt_SUPPORTED +/* Write an iTXt chunk */ +void /* PRIVATE */ +png_write_iTXt(png_structp png_ptr, int compression, png_charp key, + png_charp lang, png_charp lang_key, png_charp text) +{ + PNG_iTXt; + png_size_t lang_len, key_len, lang_key_len, text_len; + png_charp new_lang; + png_charp new_key = NULL; + png_byte cbuf[2]; + compression_state comp; + + png_debug(1, "in png_write_iTXt"); + + comp.num_output_ptr = 0; + comp.max_output_ptr = 0; + comp.output_ptr = NULL; + comp.input = NULL; + + if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0) + return; + + if ((lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0) + { + png_warning(png_ptr, "Empty language field in iTXt chunk"); + new_lang = NULL; + lang_len = 0; + } + + if (lang_key == NULL) + lang_key_len = 0; + else + lang_key_len = png_strlen(lang_key); + + if (text == NULL) + text_len = 0; + else + text_len = png_strlen(text); + + /* Compute the compressed data; do it now for the length */ + text_len = png_text_compress(png_ptr, text, text_len, compression-2, + &comp); + + + /* Make sure we include the compression flag, the compression byte, + * and the NULs after the key, lang, and lang_key parts */ + + png_write_chunk_start(png_ptr, (png_bytep)png_iTXt, + (png_uint_32)( + 5 /* comp byte, comp flag, terminators for key, lang and lang_key */ + + key_len + + lang_len + + lang_key_len + + text_len)); + + /* We leave it to the application to meet PNG-1.0 requirements on the + * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of + * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them. + * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG. + */ + png_write_chunk_data(png_ptr, (png_bytep)new_key, + (png_size_t)(key_len + 1)); + + /* Set the compression flag */ + if (compression == PNG_ITXT_COMPRESSION_NONE || \ + compression == PNG_TEXT_COMPRESSION_NONE) + cbuf[0] = 0; + else /* compression == PNG_ITXT_COMPRESSION_zTXt */ + cbuf[0] = 1; + /* Set the compression method */ + cbuf[1] = 0; + png_write_chunk_data(png_ptr, cbuf, (png_size_t)2); + + cbuf[0] = 0; + png_write_chunk_data(png_ptr, (new_lang ? (png_bytep)new_lang : cbuf), + (png_size_t)(lang_len + 1)); + png_write_chunk_data(png_ptr, (lang_key ? (png_bytep)lang_key : cbuf), + (png_size_t)(lang_key_len + 1)); + png_write_compressed_data_out(png_ptr, &comp); + + png_write_chunk_end(png_ptr); + png_free(png_ptr, new_key); + png_free(png_ptr, new_lang); +} +#endif + +#ifdef PNG_WRITE_oFFs_SUPPORTED +/* Write the oFFs chunk */ +void /* PRIVATE */ +png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset, + int unit_type) +{ + PNG_oFFs; + png_byte buf[9]; + + png_debug(1, "in png_write_oFFs"); + + if (unit_type >= PNG_OFFSET_LAST) + png_warning(png_ptr, "Unrecognized unit type for oFFs chunk"); + + png_save_int_32(buf, x_offset); + png_save_int_32(buf + 4, y_offset); + buf[8] = (png_byte)unit_type; + + png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9); +} +#endif +#ifdef PNG_WRITE_pCAL_SUPPORTED +/* Write the pCAL chunk (described in the PNG extensions document) */ +void /* PRIVATE */ +png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, + png_int_32 X1, int type, int nparams, png_charp units, png_charpp params) +{ + PNG_pCAL; + png_size_t purpose_len, units_len, total_len; + png_uint_32p params_len; + png_byte buf[10]; + png_charp new_purpose; + int i; + + png_debug1(1, "in png_write_pCAL (%d parameters)", nparams); + + if (type >= PNG_EQUATION_LAST) + png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); + + purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1; + png_debug1(3, "pCAL purpose length = %d", (int)purpose_len); + units_len = png_strlen(units) + (nparams == 0 ? 0 : 1); + png_debug1(3, "pCAL units length = %d", (int)units_len); + total_len = purpose_len + units_len + 10; + + params_len = (png_uint_32p)png_malloc(png_ptr, + (png_alloc_size_t)(nparams * png_sizeof(png_uint_32))); + + /* Find the length of each parameter, making sure we don't count the + null terminator for the last parameter. */ + for (i = 0; i < nparams; i++) + { + params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1); + png_debug2(3, "pCAL parameter %d length = %lu", i, + (unsigned long) params_len[i]); + total_len += (png_size_t)params_len[i]; + } + + png_debug1(3, "pCAL total length = %d", (int)total_len); + png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len); + png_write_chunk_data(png_ptr, (png_bytep)new_purpose, + (png_size_t)purpose_len); + png_save_int_32(buf, X0); + png_save_int_32(buf + 4, X1); + buf[8] = (png_byte)type; + buf[9] = (png_byte)nparams; + png_write_chunk_data(png_ptr, buf, (png_size_t)10); + png_write_chunk_data(png_ptr, (png_bytep)units, (png_size_t)units_len); + + png_free(png_ptr, new_purpose); + + for (i = 0; i < nparams; i++) + { + png_write_chunk_data(png_ptr, (png_bytep)params[i], + (png_size_t)params_len[i]); + } + + png_free(png_ptr, params_len); + png_write_chunk_end(png_ptr); +} +#endif + +#ifdef PNG_WRITE_sCAL_SUPPORTED +/* Write the sCAL chunk */ +#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED) +void /* PRIVATE */ +png_write_sCAL(png_structp png_ptr, int unit, double width, double height) +{ + PNG_sCAL; + char buf[64]; + png_size_t total_len; + + png_debug(1, "in png_write_sCAL"); + + buf[0] = (char)unit; + png_snprintf(buf + 1, 63, "%12.12e", width); + total_len = 1 + png_strlen(buf + 1) + 1; + png_snprintf(buf + total_len, 64-total_len, "%12.12e", height); + total_len += png_strlen(buf + total_len); + + png_debug1(3, "sCAL total length = %u", (unsigned int)total_len); + png_write_chunk(png_ptr, (png_bytep)png_sCAL, (png_bytep)buf, total_len); +} +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +void /* PRIVATE */ +png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width, + png_charp height) +{ + PNG_sCAL; + png_byte buf[64]; + png_size_t wlen, hlen, total_len; + + png_debug(1, "in png_write_sCAL_s"); + + wlen = png_strlen(width); + hlen = png_strlen(height); + total_len = wlen + hlen + 2; + if (total_len > 64) + { + png_warning(png_ptr, "Can't write sCAL (buffer too small)"); + return; + } + + buf[0] = (png_byte)unit; + png_memcpy(buf + 1, width, wlen + 1); /* Append the '\0' here */ + png_memcpy(buf + wlen + 2, height, hlen); /* Do NOT append the '\0' here */ + + png_debug1(3, "sCAL total length = %u", (unsigned int)total_len); + png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len); +} +#endif +#endif +#endif + +#ifdef PNG_WRITE_pHYs_SUPPORTED +/* Write the pHYs chunk */ +void /* PRIVATE */ +png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, + png_uint_32 y_pixels_per_unit, + int unit_type) +{ + PNG_pHYs; + png_byte buf[9]; + + png_debug(1, "in png_write_pHYs"); + + if (unit_type >= PNG_RESOLUTION_LAST) + png_warning(png_ptr, "Unrecognized unit type for pHYs chunk"); + + png_save_uint_32(buf, x_pixels_per_unit); + png_save_uint_32(buf + 4, y_pixels_per_unit); + buf[8] = (png_byte)unit_type; + + png_write_chunk(png_ptr, (png_bytep)png_pHYs, buf, (png_size_t)9); +} +#endif + +#ifdef PNG_WRITE_tIME_SUPPORTED +/* Write the tIME chunk. Use either png_convert_from_struct_tm() + * or png_convert_from_time_t(), or fill in the structure yourself. + */ +void /* PRIVATE */ +png_write_tIME(png_structp png_ptr, png_timep mod_time) +{ + PNG_tIME; + png_byte buf[7]; + + png_debug(1, "in png_write_tIME"); + + if (mod_time->month > 12 || mod_time->month < 1 || + mod_time->day > 31 || mod_time->day < 1 || + mod_time->hour > 23 || mod_time->second > 60) + { + png_warning(png_ptr, "Invalid time specified for tIME chunk"); + return; + } + + png_save_uint_16(buf, mod_time->year); + buf[2] = mod_time->month; + buf[3] = mod_time->day; + buf[4] = mod_time->hour; + buf[5] = mod_time->minute; + buf[6] = mod_time->second; + + png_write_chunk(png_ptr, (png_bytep)png_tIME, buf, (png_size_t)7); +} +#endif + +/* Initializes the row writing capability of libpng */ +void /* PRIVATE */ +png_write_start_row(png_structp png_ptr) +{ +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* Start of interlace block */ + int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* Offset to next interlace block */ + int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* Start of interlace block in the y direction */ + int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* Offset to next interlace block in the y direction */ + int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; +#endif + + png_size_t buf_size; + + png_debug(1, "in png_write_start_row"); + + buf_size = (png_size_t)(PNG_ROWBYTES( + png_ptr->usr_channels*png_ptr->usr_bit_depth, png_ptr->width) + 1); + + /* Set up row buffer */ + png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, + (png_alloc_size_t)buf_size); + png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE; + +#ifdef PNG_WRITE_FILTER_SUPPORTED + /* Set up filtering buffer, if using this filter */ + if (png_ptr->do_filter & PNG_FILTER_SUB) + { + png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, + (png_alloc_size_t)(png_ptr->rowbytes + 1)); + png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB; + } + + /* We only need to keep the previous row if we are using one of these. */ + if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) + { + /* Set up previous row buffer */ + png_ptr->prev_row = (png_bytep)png_calloc(png_ptr, + (png_alloc_size_t)buf_size); + + if (png_ptr->do_filter & PNG_FILTER_UP) + { + png_ptr->up_row = (png_bytep)png_malloc(png_ptr, + (png_size_t)(png_ptr->rowbytes + 1)); + png_ptr->up_row[0] = PNG_FILTER_VALUE_UP; + } + + if (png_ptr->do_filter & PNG_FILTER_AVG) + { + png_ptr->avg_row = (png_bytep)png_malloc(png_ptr, + (png_alloc_size_t)(png_ptr->rowbytes + 1)); + png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG; + } + + if (png_ptr->do_filter & PNG_FILTER_PAETH) + { + png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr, + (png_size_t)(png_ptr->rowbytes + 1)); + png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH; + } + } +#endif /* PNG_WRITE_FILTER_SUPPORTED */ + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + /* If interlaced, we need to set up width and height of pass */ + if (png_ptr->interlaced) + { + if (!(png_ptr->transformations & PNG_INTERLACE)) + { + png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 - + png_pass_ystart[0]) / png_pass_yinc[0]; + png_ptr->usr_width = (png_ptr->width + png_pass_inc[0] - 1 - + png_pass_start[0]) / png_pass_inc[0]; + } + else + { + png_ptr->num_rows = png_ptr->height; + png_ptr->usr_width = png_ptr->width; + } + } + else +#endif + { + png_ptr->num_rows = png_ptr->height; + png_ptr->usr_width = png_ptr->width; + } + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_out = png_ptr->zbuf; +} + +/* Internal use only. Called when finished processing a row of data. */ +void /* PRIVATE */ +png_write_finish_row(png_structp png_ptr) +{ +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* Start of interlace block */ + int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* Offset to next interlace block */ + int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* Start of interlace block in the y direction */ + int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* Offset to next interlace block in the y direction */ + int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; +#endif + + int ret; + + png_debug(1, "in png_write_finish_row"); + + /* Next row */ + png_ptr->row_number++; + + /* See if we are done */ + if (png_ptr->row_number < png_ptr->num_rows) + return; + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + /* If interlaced, go to next pass */ + if (png_ptr->interlaced) + { + png_ptr->row_number = 0; + if (png_ptr->transformations & PNG_INTERLACE) + { + png_ptr->pass++; + } + else + { + /* Loop until we find a non-zero width or height pass */ + do + { + png_ptr->pass++; + if (png_ptr->pass >= 7) + break; + png_ptr->usr_width = (png_ptr->width + + png_pass_inc[png_ptr->pass] - 1 - + png_pass_start[png_ptr->pass]) / + png_pass_inc[png_ptr->pass]; + png_ptr->num_rows = (png_ptr->height + + png_pass_yinc[png_ptr->pass] - 1 - + png_pass_ystart[png_ptr->pass]) / + png_pass_yinc[png_ptr->pass]; + if (png_ptr->transformations & PNG_INTERLACE) + break; + } while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0); + + } + + /* Reset the row above the image for the next pass */ + if (png_ptr->pass < 7) + { + if (png_ptr->prev_row != NULL) + png_memset(png_ptr->prev_row, 0, + (png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels* + png_ptr->usr_bit_depth, png_ptr->width)) + 1); + return; + } + } +#endif + + /* If we get here, we've just written the last row, so we need + to flush the compressor */ + do + { + /* Tell the compressor we are done */ + ret = deflate(&png_ptr->zstream, Z_FINISH); + /* Check for an error */ + if (ret == Z_OK) + { + /* Check to see if we need more room */ + if (!(png_ptr->zstream.avail_out)) + { + png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + } + } + else if (ret != Z_STREAM_END) + { + if (png_ptr->zstream.msg != NULL) + png_error(png_ptr, png_ptr->zstream.msg); + else + png_error(png_ptr, "zlib error"); + } + } while (ret != Z_STREAM_END); + + /* Write any extra space */ + if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) + { + png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size - + png_ptr->zstream.avail_out); + } + + deflateReset(&png_ptr->zstream); + png_ptr->zstream.data_type = Z_BINARY; +} + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED +/* Pick out the correct pixels for the interlace pass. + * The basic idea here is to go through the row with a source + * pointer and a destination pointer (sp and dp), and copy the + * correct pixels for the pass. As the row gets compacted, + * sp will always be >= dp, so we should never overwrite anything. + * See the default: case for the easiest code to understand. + */ +void /* PRIVATE */ +png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) +{ + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* Start of interlace block */ + int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* Offset to next interlace block */ + int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + png_debug(1, "in png_do_write_interlace"); + + /* We don't have to do anything on the last pass (6) */ + if (pass < 6) + { + /* Each pixel depth is handled separately */ + switch (row_info->pixel_depth) + { + case 1: + { + png_bytep sp; + png_bytep dp; + int shift; + int d; + int value; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + dp = row; + d = 0; + shift = 7; + for (i = png_pass_start[pass]; i < row_width; + i += png_pass_inc[pass]) + { + sp = row + (png_size_t)(i >> 3); + value = (int)(*sp >> (7 - (int)(i & 0x07))) & 0x01; + d |= (value << shift); + + if (shift == 0) + { + shift = 7; + *dp++ = (png_byte)d; + d = 0; + } + else + shift--; + + } + if (shift != 7) + *dp = (png_byte)d; + break; + } + case 2: + { + png_bytep sp; + png_bytep dp; + int shift; + int d; + int value; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + dp = row; + shift = 6; + d = 0; + for (i = png_pass_start[pass]; i < row_width; + i += png_pass_inc[pass]) + { + sp = row + (png_size_t)(i >> 2); + value = (*sp >> ((3 - (int)(i & 0x03)) << 1)) & 0x03; + d |= (value << shift); + + if (shift == 0) + { + shift = 6; + *dp++ = (png_byte)d; + d = 0; + } + else + shift -= 2; + } + if (shift != 6) + *dp = (png_byte)d; + break; + } + case 4: + { + png_bytep sp; + png_bytep dp; + int shift; + int d; + int value; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + dp = row; + shift = 4; + d = 0; + for (i = png_pass_start[pass]; i < row_width; + i += png_pass_inc[pass]) + { + sp = row + (png_size_t)(i >> 1); + value = (*sp >> ((1 - (int)(i & 0x01)) << 2)) & 0x0f; + d |= (value << shift); + + if (shift == 0) + { + shift = 4; + *dp++ = (png_byte)d; + d = 0; + } + else + shift -= 4; + } + if (shift != 4) + *dp = (png_byte)d; + break; + } + default: + { + png_bytep sp; + png_bytep dp; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + png_size_t pixel_bytes; + + /* Start at the beginning */ + dp = row; + /* Find out how many bytes each pixel takes up */ + pixel_bytes = (row_info->pixel_depth >> 3); + /* Loop through the row, only looking at the pixels that + matter */ + for (i = png_pass_start[pass]; i < row_width; + i += png_pass_inc[pass]) + { + /* Find out where the original pixel is */ + sp = row + (png_size_t)i * pixel_bytes; + /* Move the pixel */ + if (dp != sp) + png_memcpy(dp, sp, pixel_bytes); + /* Next pixel */ + dp += pixel_bytes; + } + break; + } + } + /* Set new row width */ + row_info->width = (row_info->width + + png_pass_inc[pass] - 1 - + png_pass_start[pass]) / + png_pass_inc[pass]; + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, + row_info->width); + } +} +#endif + +/* This filters the row, chooses which filter to use, if it has not already + * been specified by the application, and then writes the row out with the + * chosen filter. + */ +#define PNG_MAXSUM (((png_uint_32)(-1)) >> 1) +#define PNG_HISHIFT 10 +#define PNG_LOMASK ((png_uint_32)0xffffL) +#define PNG_HIMASK ((png_uint_32)(~PNG_LOMASK >> PNG_HISHIFT)) +void /* PRIVATE */ +png_write_find_filter(png_structp png_ptr, png_row_infop row_info) +{ + png_bytep best_row; +#ifdef PNG_WRITE_FILTER_SUPPORTED + png_bytep prev_row, row_buf; + png_uint_32 mins, bpp; + png_byte filter_to_do = png_ptr->do_filter; + png_uint_32 row_bytes = row_info->rowbytes; +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + int num_p_filters = (int)png_ptr->num_prev_filters; +#endif + + png_debug(1, "in png_write_find_filter"); + +#ifndef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + if (png_ptr->row_number == 0 && filter_to_do == PNG_ALL_FILTERS) + { + /* These will never be selected so we need not test them. */ + filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH); + } +#endif + + /* Find out how many bytes offset each pixel is */ + bpp = (row_info->pixel_depth + 7) >> 3; + + prev_row = png_ptr->prev_row; +#endif + best_row = png_ptr->row_buf; +#ifdef PNG_WRITE_FILTER_SUPPORTED + row_buf = best_row; + mins = PNG_MAXSUM; + + /* The prediction method we use is to find which method provides the + * smallest value when summing the absolute values of the distances + * from zero, using anything >= 128 as negative numbers. This is known + * as the "minimum sum of absolute differences" heuristic. Other + * heuristics are the "weighted minimum sum of absolute differences" + * (experimental and can in theory improve compression), and the "zlib + * predictive" method (not implemented yet), which does test compressions + * of lines using different filter methods, and then chooses the + * (series of) filter(s) that give minimum compressed data size (VERY + * computationally expensive). + * + * GRR 980525: consider also + * (1) minimum sum of absolute differences from running average (i.e., + * keep running sum of non-absolute differences & count of bytes) + * [track dispersion, too? restart average if dispersion too large?] + * (1b) minimum sum of absolute differences from sliding average, probably + * with window size <= deflate window (usually 32K) + * (2) minimum sum of squared differences from zero or running average + * (i.e., ~ root-mean-square approach) + */ + + + /* We don't need to test the 'no filter' case if this is the only filter + * that has been chosen, as it doesn't actually do anything to the data. + */ + if ((filter_to_do & PNG_FILTER_NONE) && + filter_to_do != PNG_FILTER_NONE) + { + png_bytep rp; + png_uint_32 sum = 0; + png_uint_32 i; + int v; + + for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++) + { + v = *rp; + sum += (v < 128) ? v : 256 - v; + } + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + png_uint_32 sumhi, sumlo; + int j; + sumlo = sum & PNG_LOMASK; + sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */ + + /* Reduce the sum if we match any of the previous rows */ + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE) + { + sumlo = (sumlo * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + sumhi = (sumhi * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + /* Factor in the cost of this filter (this is here for completeness, + * but it makes no sense to have a "cost" for the NONE filter, as + * it has the minimum possible computational cost - none). + */ + sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >> + PNG_COST_SHIFT; + sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >> + PNG_COST_SHIFT; + + if (sumhi > PNG_HIMASK) + sum = PNG_MAXSUM; + else + sum = (sumhi << PNG_HISHIFT) + sumlo; + } +#endif + mins = sum; + } + + /* Sub filter */ + if (filter_to_do == PNG_FILTER_SUB) + /* It's the only filter so no testing is needed */ + { + png_bytep rp, lp, dp; + png_uint_32 i; + for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp; + i++, rp++, dp++) + { + *dp = *rp; + } + for (lp = row_buf + 1; i < row_bytes; + i++, rp++, lp++, dp++) + { + *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff); + } + best_row = png_ptr->sub_row; + } + + else if (filter_to_do & PNG_FILTER_SUB) + { + png_bytep rp, dp, lp; + png_uint_32 sum = 0, lmins = mins; + png_uint_32 i; + int v; + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + /* We temporarily increase the "minimum sum" by the factor we + * would reduce the sum of this filter, so that we can do the + * early exit comparison without scaling the sum each time. + */ + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 lmhi, lmlo; + lmlo = lmins & PNG_LOMASK; + lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB) + { + lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> + PNG_COST_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> + PNG_COST_SHIFT; + + if (lmhi > PNG_HIMASK) + lmins = PNG_MAXSUM; + else + lmins = (lmhi << PNG_HISHIFT) + lmlo; + } +#endif + + for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp; + i++, rp++, dp++) + { + v = *dp = *rp; + + sum += (v < 128) ? v : 256 - v; + } + for (lp = row_buf + 1; i < row_bytes; + i++, rp++, lp++, dp++) + { + v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff); + + sum += (v < 128) ? v : 256 - v; + + if (sum > lmins) /* We are already worse, don't continue. */ + break; + } + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 sumhi, sumlo; + sumlo = sum & PNG_LOMASK; + sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB) + { + sumlo = (sumlo * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + sumhi = (sumhi * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + sumlo = (sumlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> + PNG_COST_SHIFT; + sumhi = (sumhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> + PNG_COST_SHIFT; + + if (sumhi > PNG_HIMASK) + sum = PNG_MAXSUM; + else + sum = (sumhi << PNG_HISHIFT) + sumlo; + } +#endif + + if (sum < mins) + { + mins = sum; + best_row = png_ptr->sub_row; + } + } + + /* Up filter */ + if (filter_to_do == PNG_FILTER_UP) + { + png_bytep rp, dp, pp; + png_uint_32 i; + + for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1, + pp = prev_row + 1; i < row_bytes; + i++, rp++, pp++, dp++) + { + *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff); + } + best_row = png_ptr->up_row; + } + + else if (filter_to_do & PNG_FILTER_UP) + { + png_bytep rp, dp, pp; + png_uint_32 sum = 0, lmins = mins; + png_uint_32 i; + int v; + + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 lmhi, lmlo; + lmlo = lmins & PNG_LOMASK; + lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP) + { + lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >> + PNG_COST_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >> + PNG_COST_SHIFT; + + if (lmhi > PNG_HIMASK) + lmins = PNG_MAXSUM; + else + lmins = (lmhi << PNG_HISHIFT) + lmlo; + } +#endif + + for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1, + pp = prev_row + 1; i < row_bytes; i++) + { + v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); + + sum += (v < 128) ? v : 256 - v; + + if (sum > lmins) /* We are already worse, don't continue. */ + break; + } + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 sumhi, sumlo; + sumlo = sum & PNG_LOMASK; + sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP) + { + sumlo = (sumlo * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + sumhi = (sumhi * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >> + PNG_COST_SHIFT; + sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >> + PNG_COST_SHIFT; + + if (sumhi > PNG_HIMASK) + sum = PNG_MAXSUM; + else + sum = (sumhi << PNG_HISHIFT) + sumlo; + } +#endif + + if (sum < mins) + { + mins = sum; + best_row = png_ptr->up_row; + } + } + + /* Avg filter */ + if (filter_to_do == PNG_FILTER_AVG) + { + png_bytep rp, dp, pp, lp; + png_uint_32 i; + for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1, + pp = prev_row + 1; i < bpp; i++) + { + *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff); + } + for (lp = row_buf + 1; i < row_bytes; i++) + { + *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) + & 0xff); + } + best_row = png_ptr->avg_row; + } + + else if (filter_to_do & PNG_FILTER_AVG) + { + png_bytep rp, dp, pp, lp; + png_uint_32 sum = 0, lmins = mins; + png_uint_32 i; + int v; + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 lmhi, lmlo; + lmlo = lmins & PNG_LOMASK; + lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_AVG) + { + lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >> + PNG_COST_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >> + PNG_COST_SHIFT; + + if (lmhi > PNG_HIMASK) + lmins = PNG_MAXSUM; + else + lmins = (lmhi << PNG_HISHIFT) + lmlo; + } +#endif + + for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1, + pp = prev_row + 1; i < bpp; i++) + { + v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff); + + sum += (v < 128) ? v : 256 - v; + } + for (lp = row_buf + 1; i < row_bytes; i++) + { + v = *dp++ = + (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) & 0xff); + + sum += (v < 128) ? v : 256 - v; + + if (sum > lmins) /* We are already worse, don't continue. */ + break; + } + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 sumhi, sumlo; + sumlo = sum & PNG_LOMASK; + sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE) + { + sumlo = (sumlo * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + sumhi = (sumhi * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >> + PNG_COST_SHIFT; + sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >> + PNG_COST_SHIFT; + + if (sumhi > PNG_HIMASK) + sum = PNG_MAXSUM; + else + sum = (sumhi << PNG_HISHIFT) + sumlo; + } +#endif + + if (sum < mins) + { + mins = sum; + best_row = png_ptr->avg_row; + } + } + + /* Paeth filter */ + if (filter_to_do == PNG_FILTER_PAETH) + { + png_bytep rp, dp, pp, cp, lp; + png_uint_32 i; + for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1, + pp = prev_row + 1; i < bpp; i++) + { + *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); + } + + for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++) + { + int a, b, c, pa, pb, pc, p; + + b = *pp++; + c = *cp++; + a = *lp++; + + p = b - c; + pc = a - c; + +#ifdef PNG_USE_ABS + pa = abs(p); + pb = abs(pc); + pc = abs(p + pc); +#else + pa = p < 0 ? -p : p; + pb = pc < 0 ? -pc : pc; + pc = (p + pc) < 0 ? -(p + pc) : p + pc; +#endif + + p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; + + *dp++ = (png_byte)(((int)*rp++ - p) & 0xff); + } + best_row = png_ptr->paeth_row; + } + + else if (filter_to_do & PNG_FILTER_PAETH) + { + png_bytep rp, dp, pp, cp, lp; + png_uint_32 sum = 0, lmins = mins; + png_uint_32 i; + int v; + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 lmhi, lmlo; + lmlo = lmins & PNG_LOMASK; + lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH) + { + lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >> + PNG_COST_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >> + PNG_COST_SHIFT; + + if (lmhi > PNG_HIMASK) + lmins = PNG_MAXSUM; + else + lmins = (lmhi << PNG_HISHIFT) + lmlo; + } +#endif + + for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1, + pp = prev_row + 1; i < bpp; i++) + { + v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); + + sum += (v < 128) ? v : 256 - v; + } + + for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++) + { + int a, b, c, pa, pb, pc, p; + + b = *pp++; + c = *cp++; + a = *lp++; + +#ifndef PNG_SLOW_PAETH + p = b - c; + pc = a - c; +#ifdef PNG_USE_ABS + pa = abs(p); + pb = abs(pc); + pc = abs(p + pc); +#else + pa = p < 0 ? -p : p; + pb = pc < 0 ? -pc : pc; + pc = (p + pc) < 0 ? -(p + pc) : p + pc; +#endif + p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; +#else /* PNG_SLOW_PAETH */ + p = a + b - c; + pa = abs(p - a); + pb = abs(p - b); + pc = abs(p - c); + if (pa <= pb && pa <= pc) + p = a; + else if (pb <= pc) + p = b; + else + p = c; +#endif /* PNG_SLOW_PAETH */ + + v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff); + + sum += (v < 128) ? v : 256 - v; + + if (sum > lmins) /* We are already worse, don't continue. */ + break; + } + +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 sumhi, sumlo; + sumlo = sum & PNG_LOMASK; + sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH) + { + sumlo = (sumlo * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + sumhi = (sumhi * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >> + PNG_COST_SHIFT; + sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >> + PNG_COST_SHIFT; + + if (sumhi > PNG_HIMASK) + sum = PNG_MAXSUM; + else + sum = (sumhi << PNG_HISHIFT) + sumlo; + } +#endif + + if (sum < mins) + { + best_row = png_ptr->paeth_row; + } + } +#endif /* PNG_WRITE_FILTER_SUPPORTED */ + /* Do the actual writing of the filtered row data from the chosen filter. */ + + png_write_filtered_row(png_ptr, best_row); + +#ifdef PNG_WRITE_FILTER_SUPPORTED +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED + /* Save the type of filter we picked this time for future calculations */ + if (png_ptr->num_prev_filters > 0) + { + int j; + for (j = 1; j < num_p_filters; j++) + { + png_ptr->prev_filters[j] = png_ptr->prev_filters[j - 1]; + } + png_ptr->prev_filters[j] = best_row[0]; + } +#endif +#endif /* PNG_WRITE_FILTER_SUPPORTED */ +} + + +/* Do the actual writing of a previously filtered row. */ +void /* PRIVATE */ +png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) +{ + png_debug(1, "in png_write_filtered_row"); + + png_debug1(2, "filter = %d", filtered_row[0]); + /* Set up the zlib input buffer */ + + png_ptr->zstream.next_in = filtered_row; + png_ptr->zstream.avail_in = (uInt)png_ptr->row_info.rowbytes + 1; + /* Repeat until we have compressed all the data */ + do + { + int ret; /* Return of zlib */ + + /* Compress the data */ + ret = deflate(&png_ptr->zstream, Z_NO_FLUSH); + /* Check for compression errors */ + if (ret != Z_OK) + { + if (png_ptr->zstream.msg != NULL) + png_error(png_ptr, png_ptr->zstream.msg); + else + png_error(png_ptr, "zlib error"); + } + + /* See if it is time to write another IDAT */ + if (!(png_ptr->zstream.avail_out)) + { + /* Write the IDAT and reset the zlib output buffer */ + png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + } + /* Repeat until all data has been compressed */ + } while (png_ptr->zstream.avail_in); + + /* Swap the current and previous rows */ + if (png_ptr->prev_row != NULL) + { + png_bytep tptr; + + tptr = png_ptr->prev_row; + png_ptr->prev_row = png_ptr->row_buf; + png_ptr->row_buf = tptr; + } + + /* Finish row - updates counters and flushes zlib if last row */ + png_write_finish_row(png_ptr); + +#ifdef PNG_WRITE_FLUSH_SUPPORTED + png_ptr->flush_rows++; + + if (png_ptr->flush_dist > 0 && + png_ptr->flush_rows >= png_ptr->flush_dist) + { + png_write_flush(png_ptr); + } +#endif +} +#endif /* PNG_WRITE_SUPPORTED */ diff --git a/png/projects/visualc71/PRJ0041.mak b/png/projects/visualc71/PRJ0041.mak new file mode 100644 index 0000000..e15e12b --- /dev/null +++ b/png/projects/visualc71/PRJ0041.mak @@ -0,0 +1,21 @@ +# Prevent "Cannot find missing dependency..." warnings while compiling +# pngwin.rc (PRJ0041). + +all: $(IntDir)\alloc.h \ + $(IntDir)\fp.h \ + $(IntDir)\m68881.h \ + $(IntDir)\mem.h \ + $(IntDir)\pngusr.h \ + $(IntDir)\strings.h \ + $(IntDir)\unistd.h \ + $(IntDir)\unixio.h + +$(IntDir)\alloc.h \ +$(IntDir)\fp.h \ +$(IntDir)\m68881.h \ +$(IntDir)\mem.h \ +$(IntDir)\pngusr.h \ +$(IntDir)\strings.h \ +$(IntDir)\unistd.h \ +$(IntDir)\unixio.h: + @!echo.>$@ diff --git a/png/projects/visualc71/README.txt b/png/projects/visualc71/README.txt new file mode 100644 index 0000000..755a82a --- /dev/null +++ b/png/projects/visualc71/README.txt @@ -0,0 +1,58 @@ +Microsoft Developer Studio Project File, Format Version 7.10 for libpng. + +Copyright (C) 2004 Simon-Pierre Cadieux. + +This code is released under the libpng license. +For conditions of distribution and use, see copyright notice in png.h + +NOTE: This project will be removed from libpng-1.5.0. It has +been replaced with the "vstudio" project. + +Assumptions: +* The libpng source files are in ..\.. +* The zlib source files are in ..\..\..\zlib +* The zlib project file is in . /* Warning: This is until the zlib project + files get intergrated into the next zlib release. The final zlib project + directory will then be ..\..\..\zlib\projects\visualc71. */ + +To use: + +1) On the main menu, select "File | Open Solution". + Open "libpng.sln". + +2) Display the Solution Explorer view (Ctrl+Alt+L) + +3) Set one of the project as the StartUp project. If you just want to build the + binaries set "libpng" as the startup project (Select "libpng" tree view + item + Project | Set as StartUp project). If you want to build and test the + binaries set it to "pngtest" (Select "pngtest" tree view item + + Project | Set as StartUp project) + +4) Select "Build | Configuration Manager...". + Choose the configuration you wish to build. + +5) Select "Build | Clean Solution". + +6) Select "Build | Build Solution (Ctrl-Shift-B)" + +This project builds the libpng binaries as follows: + +* Win32_DLL_Release\libpng14.dll DLL build +* Win32_DLL_Debug\libpng14d.dll DLL build (debug version) +* Win32_DLL_VB\libpng14vb.dll DLL build for Visual Basic, using stdcall +* Win32_LIB_Release\libpng.lib static build +* Win32_LIB_Debug\libpngd.lib static build (debug version) + +Notes: + +If you change anything in the source files, or select different compiler +settings, please change the DLL name to something different than any of +the above names. Also, make sure that in your "pngusr.h" you define +PNG_USER_PRIVATEBUILD and PNG_USER_DLLFNAME_POSTFIX according to the +instructions provided in "pngconf.h". + +All DLLs built by this project use the Microsoft dynamic C runtime library +MSVCR71.DLL (MSVCR71D.DLL for debug versions). If you distribute any of the +above mentioned libraries you may have to include this DLL in your package. +For a list of files that are redistributable in Visual Studio see +$(VCINSTALLDIR)\redist.txt. diff --git a/png/projects/visualc71/README_zlib.txt b/png/projects/visualc71/README_zlib.txt new file mode 100644 index 0000000..81d11cb --- /dev/null +++ b/png/projects/visualc71/README_zlib.txt @@ -0,0 +1,44 @@ +/* WARNING: This file was put in the LibPNG distribution for convenience only. + It is expected to be part of the next zlib release under + "projects\visualc71\README.txt." */ + +Microsoft Developer Studio Project File, Format Version 7.10 for zlib. + +Copyright (C) 2004 Simon-Pierre Cadieux. +Copyright (C) 2004 Cosmin Truta. + +This code is released under the libpng license. +For conditions of distribution and use, see copyright notice in zlib.h. + +NOTE: This project will be removed from libpng-1.5.0. It has +been replaced with the "vstudio" project. + +To use: + +1) On the main menu, select "File | Open Solution". + Open "zlib.sln". + +2) Display the Solution Explorer view (Ctrl+Alt+L) + +3) Set one of the project as the StartUp project. If you just want to build the + binaries set "zlib" as the startup project (Select "zlib" tree view item + + Project | Set as StartUp project). If you want to build and test the + binaries set it to "example" (Select "example" tree view item + Project | + Set as StartUp project), If you want to build the minigzip utility set it to + "minigzip" (Select "minigzip" tree view item + Project | Set as StartUp + project + +4) Select "Build | Configuration Manager...". + Choose the configuration you wish to build. + +5) Select "Build | Clean Solution". + +6) Select "Build | Build Solution (Ctrl-Shift-B)" + +This project builds the zlib binaries as follows: + +* Win32_DLL_Release\zlib1.dll DLL build +* Win32_DLL_Debug\zlib1d.dll DLL build (debug version) +* Win32_LIB_Release\zlib.lib static build +* Win32_LIB_Debug\zlibd.lib static build (debug version) + diff --git a/png/projects/visualc71/libpng.sln b/png/projects/visualc71/libpng.sln new file mode 100644 index 0000000..eeb101f --- /dev/null +++ b/png/projects/visualc71/libpng.sln @@ -0,0 +1,60 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "libpng.vcproj", "{0008960E-E0DD-41A6-8265-00B31DDB4C21}" + ProjectSection(ProjectDependencies) = postProject + {2D4F8105-7D21-454C-9932-B47CAB71A5C0} = {2D4F8105-7D21-454C-9932-B47CAB71A5C0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pngtest", "pngtest.vcproj", "{FD1C2F86-9EEF-47BD-95A4-530917E17FDA}" + ProjectSection(ProjectDependencies) = postProject + {0008960E-E0DD-41A6-8265-00B31DDB4C21} = {0008960E-E0DD-41A6-8265-00B31DDB4C21} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcproj", "{2D4F8105-7D21-454C-9932-B47CAB71A5C0}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + DLL Debug = DLL Debug + DLL Release = DLL Release + DLL VB = DLL VB + LIB Debug = LIB Debug + LIB Release = LIB Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {0008960E-E0DD-41A6-8265-00B31DDB4C21}.DLL Debug.ActiveCfg = DLL Debug|Win32 + {0008960E-E0DD-41A6-8265-00B31DDB4C21}.DLL Debug.Build.0 = DLL Debug|Win32 + {0008960E-E0DD-41A6-8265-00B31DDB4C21}.DLL Release.ActiveCfg = DLL Release|Win32 + {0008960E-E0DD-41A6-8265-00B31DDB4C21}.DLL Release.Build.0 = DLL Release|Win32 + {0008960E-E0DD-41A6-8265-00B31DDB4C21}.DLL VB.ActiveCfg = DLL VB|Win32 + {0008960E-E0DD-41A6-8265-00B31DDB4C21}.DLL VB.Build.0 = DLL VB|Win32 + {0008960E-E0DD-41A6-8265-00B31DDB4C21}.LIB Debug.ActiveCfg = LIB Debug|Win32 + {0008960E-E0DD-41A6-8265-00B31DDB4C21}.LIB Debug.Build.0 = LIB Debug|Win32 + {0008960E-E0DD-41A6-8265-00B31DDB4C21}.LIB Release.ActiveCfg = LIB Release|Win32 + {0008960E-E0DD-41A6-8265-00B31DDB4C21}.LIB Release.Build.0 = LIB Release|Win32 + {FD1C2F86-9EEF-47BD-95A4-530917E17FDA}.DLL Debug.ActiveCfg = DLL Debug|Win32 + {FD1C2F86-9EEF-47BD-95A4-530917E17FDA}.DLL Debug.Build.0 = DLL Debug|Win32 + {FD1C2F86-9EEF-47BD-95A4-530917E17FDA}.DLL Release.ActiveCfg = DLL Release|Win32 + {FD1C2F86-9EEF-47BD-95A4-530917E17FDA}.DLL Release.Build.0 = DLL Release|Win32 + {FD1C2F86-9EEF-47BD-95A4-530917E17FDA}.DLL VB.ActiveCfg = DLL VB|Win32 + {FD1C2F86-9EEF-47BD-95A4-530917E17FDA}.DLL VB.Build.0 = DLL VB|Win32 + {FD1C2F86-9EEF-47BD-95A4-530917E17FDA}.LIB Debug.ActiveCfg = LIB Debug|Win32 + {FD1C2F86-9EEF-47BD-95A4-530917E17FDA}.LIB Debug.Build.0 = LIB Debug|Win32 + {FD1C2F86-9EEF-47BD-95A4-530917E17FDA}.LIB Release.ActiveCfg = LIB Release|Win32 + {FD1C2F86-9EEF-47BD-95A4-530917E17FDA}.LIB Release.Build.0 = LIB Release|Win32 + {2D4F8105-7D21-454C-9932-B47CAB71A5C0}.DLL Debug.ActiveCfg = DLL Debug|Win32 + {2D4F8105-7D21-454C-9932-B47CAB71A5C0}.DLL Debug.Build.0 = DLL Debug|Win32 + {2D4F8105-7D21-454C-9932-B47CAB71A5C0}.DLL Release.ActiveCfg = DLL Release|Win32 + {2D4F8105-7D21-454C-9932-B47CAB71A5C0}.DLL Release.Build.0 = DLL Release|Win32 + {2D4F8105-7D21-454C-9932-B47CAB71A5C0}.DLL VB.ActiveCfg = DLL Release|Win32 + {2D4F8105-7D21-454C-9932-B47CAB71A5C0}.DLL VB.Build.0 = DLL Release|Win32 + {2D4F8105-7D21-454C-9932-B47CAB71A5C0}.LIB Debug.ActiveCfg = LIB Debug|Win32 + {2D4F8105-7D21-454C-9932-B47CAB71A5C0}.LIB Debug.Build.0 = LIB Debug|Win32 + {2D4F8105-7D21-454C-9932-B47CAB71A5C0}.LIB Release.ActiveCfg = LIB Release|Win32 + {2D4F8105-7D21-454C-9932-B47CAB71A5C0}.LIB Release.Build.0 = LIB Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/png/projects/visualc71/libpng.vcproj b/png/projects/visualc71/libpng.vcproj new file mode 100644 index 0000000..eeb7732 --- /dev/null +++ b/png/projects/visualc71/libpng.vcproj @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/png/projects/visualc71/libpng100.vcxproj b/png/projects/visualc71/libpng100.vcxproj new file mode 100644 index 0000000..29e64d1 --- /dev/null +++ b/png/projects/visualc71/libpng100.vcxproj @@ -0,0 +1,548 @@ + + + + + debug100 + Win32 + + + DLL ASM Debug + Win32 + + + DLL ASM Release + Win32 + + + DLL Debug + Win32 + + + DLL Release + Win32 + + + DLL VB + Win32 + + + LIB ASM Debug + Win32 + + + LIB ASM Release + Win32 + + + LIB Debug + Win32 + + + LIB Release + Win32 + + + Template + Win32 + + + + {3E1649FA-0B0F-460D-9AE4-7B702737B13D} + libpng + libpng100 + + + + StaticLibrary + Static + v140_xp + Unicode + + + StaticLibrary + Static + v140_xp + + + StaticLibrary + Static + v140_xp + + + StaticLibrary + v140_xp + + + StaticLibrary + Static + Unicode + v140_xp + + + DynamicLibrary + v140_xp + + + DynamicLibrary + v140_xp + + + DynamicLibrary + v140_xp + + + DynamicLibrary + v140_xp + + + DynamicLibrary + v140_xp + + + v140_xp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\Win32_DLL_Release\ + .\Win32_DLL_Release\ + false + .\Win32_DLL_Debug\ + .\Win32_DLL_Debug\ + .\Win32_DLL_ASM_Release\ + .\Win32_DLL_ASM_Release\ + false + .\Win32_DLL_ASM_Debug\ + .\Win32_DLL_ASM_Debug\ + .\Win32_DLL_VB\ + .\Win32_DLL_VB\ + false + ..\..\Release\ + ..\..\Release\ + .\Win32_LIB_Debug\ + .\Win32_LIB_Debug\ + .\Win32_LIB_ASM_Release\ + .\Win32_LIB_ASM_Release\ + .\Win32_LIB_ASM_Debug\ + .\Win32_LIB_ASM_Debug\ + $(Configuration)\ + $(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + OnlyExplicitInline + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;PNG_BUILD_DLL;ZLIB_DLL;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + Use + png.h + Level3 + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + ..\..;..\..\..\zlib;$(IntDir);%(AdditionalIncludeDirectories) + + + $(OutDir)libpng14.dll + ..\..\scripts\pngwin.def + false + + + + + + + Disabled + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_BUILD_DLL;ZLIB_DLL;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + Use + png.h + Level3 + EditAndContinue + Default + + + _DEBUG;PNG_DEBUG=1;%(PreprocessorDefinitions) + 0x0409 + ..\..;..\..\..\zlib;$(IntDir);%(AdditionalIncludeDirectories) + + + $(OutDir)libpng14d.dll + ..\..\scripts\pngwin.def + true + false + + + + + + + OnlyExplicitInline + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;PNG_USE_PNGVCRD;PNG_BUILD_DLL;ZLIB_DLL;PNG_LIBPNG_SPECIALBUILD;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + Use + png.h + Level3 + Default + + + /d PNG_LIBPNG_SPECIALBUILD=""""Use MMX instructions"""" %(AdditionalOptions) + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + ..\..;..\..\..\zlib;$(IntDir);%(AdditionalIncludeDirectories) + + + $(OutDir)libpng14.dll + ..\..\scripts\pngwin.def + false + + + + + + + Disabled + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_USE_PNGVCRD;PNG_BUILD_DLL;ZLIB_DLL;PNG_LIBPNG_SPECIALBUILD;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + Use + png.h + Level3 + EditAndContinue + Default + + + /d PNG_LIBPNG_SPECIALBUILD=""""Use MMX instructions"""" %(AdditionalOptions) + _DEBUG;PNG_DEBUG=1;%(PreprocessorDefinitions) + 0x0409 + ..\..;..\..\..\zlib;$(IntDir);%(AdditionalIncludeDirectories) + + + $(OutDir)libpng14d.dll + ..\..\scripts\pngwin.def + true + false + + + + + + + OnlyExplicitInline + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;PNG_BUILD_DLL;ZLIB_DLL;PNGAPI=__stdcall;PNG_NO_MODULEDEF;PNG_LIBPNG_SPECIALBUILD;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + Use + png.h + Level3 + Default + + + /d PNG_NO_PEDANTIC_WARNINGS /d PNG_LIBPNG_DLLFNAME_POSTFIX=""""VB"""" /d PNG_LIBPNG_SPECIALBUILD=""""__stdcall calling convention used for exported functions"""" %(AdditionalOptions) + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + ..\..;..\..\..\zlib;$(IntDir);%(AdditionalIncludeDirectories) + + + $(OutDir)libpng14vb.dll + false + + + + + + + OnlyExplicitInline + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + _ALLOW_KEYWORD_MACROS;WIN32;NDEBUG;%(PreprocessorDefinitions) + true + Async + MultiThreaded + true + true + Use + png.h + ..\..\release/libpng.pch + ..\..\release/ + ..\..\release/ + ..\..\release/ + Level3 + Default + + + ..\..\Release\png.lib + true + + + + + Disabled + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + Use + png.h + Level3 + EditAndContinue + Default + + + $(OutDir)libpngd.lib + + + + + OnlyExplicitInline + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;%(PreprocessorDefinitions) + true + MultiThreaded + true + Use + png.h + Level3 + Default + + + $(OutDir)libpng.lib + + + + + Disabled + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;%(PreprocessorDefinitions) + Async + EnableFastChecks + MultiThreadedDebug + Use + png.h + Level3 + EditAndContinue + Default + + + $(OutDir)libpngd.lib + + + + + Disabled + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;%(PreprocessorDefinitions) + Async + EnableFastChecks + MultiThreadedDebug + Use + png.h + Level3 + EditAndContinue + Default + true + + + $(OutDir)libpngd.lib + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + Create dummy include files to prevent "Cannot find missing dependency..." warnings. + nmake -f PRJ0041.mak IntDir=$(IntDir) + + $(IntDir)alloc.h;$(IntDir)fp.h;$(IntDir)m68881.h;$(IntDir)mem.h;$(IntDir)pngusr.h;$(IntDir)strings.h;$(IntDir)unistd.h;$(IntDir)unixio.h;%(Outputs) + Create dummy include files to prevent "Cannot find missing dependency..." warnings. + nmake -f PRJ0041.mak IntDir=$(IntDir) + + $(IntDir)alloc.h;$(IntDir)fp.h;$(IntDir)m68881.h;$(IntDir)mem.h;$(IntDir)pngusr.h;$(IntDir)strings.h;$(IntDir)unistd.h;$(IntDir)unixio.h;%(Outputs) + Create dummy include files to prevent "Cannot find missing dependency..." warnings. + nmake -f PRJ0041.mak IntDir=$(IntDir) + + $(IntDir)alloc.h;$(IntDir)fp.h;$(IntDir)m68881.h;$(IntDir)mem.h;$(IntDir)pngusr.h;$(IntDir)strings.h;$(IntDir)unistd.h;$(IntDir)unixio.h;%(Outputs) + Create dummy include files to prevent "Cannot find missing dependency..." warnings. + nmake -f PRJ0041.mak IntDir=$(IntDir) + + $(IntDir)alloc.h;$(IntDir)fp.h;$(IntDir)m68881.h;$(IntDir)mem.h;$(IntDir)pngusr.h;$(IntDir)strings.h;$(IntDir)unistd.h;$(IntDir)unixio.h;%(Outputs) + Create dummy include files to prevent "Cannot find missing dependency..." warnings. + nmake -f PRJ0041.mak IntDir=$(IntDir) + + $(IntDir)alloc.h;$(IntDir)fp.h;$(IntDir)m68881.h;$(IntDir)mem.h;$(IntDir)pngusr.h;$(IntDir)strings.h;$(IntDir)unistd.h;$(IntDir)unixio.h;%(Outputs) + + + + + + + + + + true + true + true + true + true + + + + + {5c2d7860-d1ee-4d75-b42b-ee548ad6e9f9} + false + + + + + + + + + + + \ No newline at end of file diff --git a/png/projects/visualc71/libpng100.vcxproj.filters b/png/projects/visualc71/libpng100.vcxproj.filters new file mode 100644 index 0000000..cab7ae8 --- /dev/null +++ b/png/projects/visualc71/libpng100.vcxproj.filters @@ -0,0 +1,88 @@ + + + + + {801c596a-581d-4da6-95dc-c2fa07fabf38} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {c91917f6-ce5d-4027-a515-050cc51bff53} + h;hpp;hxx;hm;inl + + + {7dba824c-b104-43fb-b9e5-b8ca3c8fc6cf} + ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + + + Header Files + + + Header Files + + + + + Resource Files + + + + + Source Files + + + + + + \ No newline at end of file diff --git a/png/projects/visualc71/libpng80.vcproj b/png/projects/visualc71/libpng80.vcproj new file mode 100644 index 0000000..d83475d --- /dev/null +++ b/png/projects/visualc71/libpng80.vcproj @@ -0,0 +1,1151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/png/projects/visualc71/libpng90.vcproj b/png/projects/visualc71/libpng90.vcproj new file mode 100644 index 0000000..80bd651 --- /dev/null +++ b/png/projects/visualc71/libpng90.vcproj @@ -0,0 +1,1147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/ChineseSimp-12-5.1.11.isl b/script/ChineseSimp-12-5.1.11.isl new file mode 100644 index 0000000..9a9bed0 --- /dev/null +++ b/script/ChineseSimp-12-5.1.11.isl @@ -0,0 +1,320 @@ +; *** Inno Setup version 5.1.11+ Simplified Chinese messages *** +; +; Based on previous version by Peng Bai +; Update by Mack Zhang (hua_wuxin@21cn.com) on Apr. 10, 2008 +; +; To download user-contributed translations of this file, go to: +; http://www.jrsoftware.org/files/istrans/ +; +; Note: When translating this text, do not add periods (.) to the end of +; messages that didn't have them already, because on those messages Inno +; Setup adds the periods automatically (appending a period would result in +; two periods being displayed). + +[LangOptions] +; The following three entries are very important. Be sure to read and +; understand the '[LangOptions] section' topic in the help file. +LanguageName=<4E2D><6587> (<7B80><4F53>) +LanguageID=$0804 +LanguageCodePage=936 +; If the language you are translating to requires special font faces or +; sizes, uncomment any of the following entries and change them accordingly. +DialogFontName= +DialogFontSize=9 +;WelcomeFontName=Verdana +;WelcomeFontSize=12 +;TitleFontName=Arial +;TitleFontSize=29 +;CopyrightFontName=Arial +;CopyrightFontSize=8 + +[Messages] + +; *** Application titles +SetupAppTitle=װ +SetupWindowTitle=װ - %1 +UninstallAppTitle=ж +UninstallAppFullTitle=%1 ж + +; *** Misc. common +InformationTitle=Ϣ +ConfirmTitle=ȷ +ErrorTitle= + +; *** SetupLdr messages +SetupLdrStartupMessage=װ򵼽ĵϰװ %1ȷҪ +LdrCannotCreateTemp=޷ʱļװֹ +LdrCannotExecTemp=޷ʱļеļװֹ + +; *** Startup error messages +LastErrorMessage=%1.%n%n %2%3 +SetupFileMissing=װļȱļ %1ȡ°汾 +SetupFileCorrupt=װļ𻵡ȡ°汾 +SetupFileCorruptOrWrongVer=װļ𻵣˰װ򵼵İ汾ݡȡ°汾 +NotOnThisPlatform=˳ %1 С +OnlyOnThisPlatform=˳ %1 С +OnlyOnTheseArchitectures=˳ֻܰװΪдܹƵ Windows 汾У%n%n%1 +MissingWOW64APIs=ǰ Windows 汾ûаִ 64 λװĺҪ⣬밲װ Service Pack %1 +WinVersionTooLowError=˳Ҫ %1 v%2 ߰汾 +WinVersionTooHighError=˳ܰװ %1 v%2 ߰汾ϡ +AdminPrivilegesRequired=װ˳ʱԹԱݵ¼ +PowerUserPrivilegesRequired=װ˳ʱԹԱ Power Users Աݵ¼ +SetupAppRunningError=װ򵼷 %1 С%n%nرʵȻ󵥻ȷ򵥻ȡ˳ +UninstallAppRunningError=жس %1 С%n%nرʵȻ󵥻ȷ򵥻ȡ˳ + +; *** Misc. errors +ErrorCreatingDir=װ޷ļС%1 +ErrorTooManyFilesInDir=޷ļС%1дļΪ̫ļ + +; *** Setup common messages +ExitSetupTitle=˳װ +ExitSetupMessage=װδɡ˳ᰲװ%n%nʱаװɰװ%n%n˳װ +AboutSetupMenuItem=ڰװ(&A)... +AboutSetupTitle=ڰװ +AboutSetupMessage=%1 汾 %2%n%3%n%n%1 ҳ%n%4 +AboutSetupNote= +TranslatorNote= + +; *** Buttons +ButtonBack=< һ(&B) +ButtonNext=һ(&N) > +ButtonInstall=װ(&I) +ButtonOK=ȷ +ButtonCancel=ȡ +ButtonYes=(&Y) +ButtonYesToAll=ȫ(&A) +ButtonNo=(&N) +ButtonNoToAll=ȫ(&O) +ButtonFinish=(&F) +ButtonBrowse=(&B)... +ButtonWizardBrowse=(&R)... +ButtonNewFolder=ļ(&M) + +; *** "Select Language" dialog messages +SelectLanguageTitle=ѡװ +SelectLanguageLabel=ѡװڼҪʹõԣ + +; *** Common wizard text +ClickNext=һ򵥻ȡ˳װ +BeveledLabel= +BrowseDialogTitle=ļ +BrowseDialogLabel=ѡһļУȻ󵥻ȷ +NewFolderName=½ļ + +; *** "Welcome" wizard page +WelcomeLabel1=ӭʹ [name] װ +WelcomeLabel2=װ򵼽ĵϰװ [name/ver]%n%nڼ֮ǰرӦó + +; *** "Password" wizard page +WizardPassword= +PasswordLabel1=˰װ뱣 +PasswordLabel3=룬Ȼ󵥻һһִСд +PasswordEditLabel=(&P) +IncorrectPassword=벻ȷԡ + +; *** "License Agreement" wizard page +WizardLicense=Э +LicenseLabel=ڼ֮ǰĶҪϢ +LicenseLabel3=ĶЭ顣ڼװ֮ǰܴЭ +LicenseAccepted=ҽЭ(&A) +LicenseNotAccepted=ҲЭ(&D) + +; *** "Information" wizard pages +WizardInfoBefore=Ϣ +InfoBeforeLabel=ڼ֮ǰĶҪϢ +InfoBeforeClickLabel=׼üװ뵥һ +WizardInfoAfter=Ϣ +InfoAfterLabel=ڼ֮ǰĶҪϢ +InfoAfterClickLabel=׼üװ뵥һ + +; *** "User Information" wizard page +WizardUserInfo=ûϢ +UserInfoDesc=Ϣ +UserInfoName=û(&U) +UserInfoOrg=֯(&O) +UserInfoSerial=к(&S) +UserInfoNameRequired=û + +; *** "Select Destination Location" wizard page +WizardSelectDir=ѡĿλ +SelectDirDesc= [name] װ +SelectDirLabel3=װ򵼽 [name] װļС +SelectDirBrowseLabel=ҪһҪѡͬļУ뵥 +DiskSpaceMBLabel=Ҫ [mb] MB Ŀд̿ռ䡣 +ToUNCPathname=װ򵼲ܰװ UNC ·Ҫͨ簲װӳ +InvalidPath=̷·磺%n%nC:\APP%n%n UNC ·ʽ%n%n\\server\share +InvalidDrive=ѡ UNC ڻ򲻿ɷʡѡ +DiskSpaceWarningTitle=û㹻Ĵ̿ռ +DiskSpaceWarning=װҪ %1 KB ʣռ䣬ѡֻ %2 KB á%n%nҲҪ +DirNameTooLong=ļƻ·̫ +InvalidDirName=ļЧ +BadDirName32=ļƲַܰ%n%n%1 +DirExistsTitle=ļѴ +DirExists=ļУ%n%n%1%n%nѴڡȷҪװļ +DirDoesntExistTitle=ļв +DirDoesntExist=ļУ%n%n%1%n%nڡļ + +; *** "Select Components" wizard page +WizardSelectComponents=ѡ +SelectComponentsDesc=ҪװЩ +SelectComponentsLabel2=ѡҪװ㲻밲װ׼úһ +FullInstallation=װ +; if possible don't translate 'Compact' as 'Minimal' (I mean 'Minimal' in your language) +CompactInstallation=లװ +CustomInstallation=ưװ +NoUninstallWarningTitle=Ѵ +NoUninstallWarning=װ򵼷Ѿװ%n%n%1%n%nȡѡжЩ%n%nװ +ComponentSize1=%1 KB +ComponentSize2=%1 MB +ComponentsDiskSpaceMBLabel=ǰѡҪ [mb] MB ̿ռ䡣 + +; *** "Select Additional Tasks" wizard page +WizardSelectTasks=ѡ񸽼 +SelectTasksDesc=ҪִЩ +SelectTasksLabel2=ѡڰװ [name] ڼ䰲װҪִеĸȻһ + +; *** "Select Start Menu Folder" wizard page +WizardSelectProgramGroup=ѡʼ˵ļ +SelectStartMenuFolderDesc=ѳݷʽŵ +SelectStartMenuFolderLabel3=װ򵼽¿ʼ˵ļдݷʽ +SelectStartMenuFolderBrowseLabel=һһҪѡͬļУ +MustEnterGroupName=ļ +GroupNameTooLong=ļƻ·̫ +InvalidGroupName=ļЧ +BadGroupName=ļƲַܰ%n%n%1 +NoProgramGroupCheck2=ֹʼ˵ļ(&D) + +; *** "Ready to Install" wizard page +WizardReady=׼װ +ReadyLabel1=װ׼ʼװ [name] +ReadyLabel2a=װװҪ鿴߸һ +ReadyLabel2b=װװ +ReadyMemoUserInfo=ûϢ +ReadyMemoDir=Ŀλã +ReadyMemoType=װͣ +ReadyMemoComponents=ѡ +ReadyMemoGroup=ʼ˵ļУ +ReadyMemoTasks= + +; *** "Preparing to Install" wizard page +WizardPreparing=׼װ +PreparingDesc=װ׼װ [name] +PreviousInstallNotCompleted=ǰİװ/жδɡҪɰװ%n%n֮аװ [name] İװ +CannotContinue=װ򵼲ܼȡ˳ + +; *** "Installing" wizard page +WizardInstalling=ڰװ +InstallingLabel=ļаװ [name]Ե... + +; *** "Setup Completed" wizard page +FinishedHeadingLabel= [name] װ +FinishedLabelNoIcons=װ [name] İװ +FinishedLabel=װ [name] İװͨѡѰװͼӦó +ClickFinish=ɡ˳װ +FinishedRestartLabel=Ϊ [name] İװװ򵼱ԡҪ +FinishedRestartMessage=Ϊ [name] İװװ򵼱ԡ%n%nҪ +ShowReadmeCheck=ǣҪ鿴ļ +YesRadio=ǣ(&Y) +NoRadio=Ժ(&N) +; used for example as 'Run MyProg.exe' +RunEntryExec= %1 +; used for example as 'View Readme.txt' +RunEntryShellExec=鿴 %1 + +; *** "Setup Needs the Next Disk" stuff +ChangeDiskTitle=װҪһ +SelectDiskLabel2= %1 ȷ%n%nڳʾļļҲôϵļȷ· +PathLabel=·(&P) +FileNotInDir2=ļ%1ڡ%2СȷĴ̻ѡļС +SelectDirectoryLabel=ָһ̵λá + +; *** Installation phase messages +SetupAborted=װδɡ%n%nⲢаװ򵼡 +EntryAbortRetryIgnore=ԡ³ԣԡװֹȡװ + +; *** Installation status messages +StatusCreateDirs=ڴļ... +StatusExtractFiles=ȡļ... +StatusCreateIcons=ڴݷʽ... +StatusCreateIniEntries=ڴ INI Ŀ... +StatusCreateRegistryEntries=ڴעĿ... +StatusRegisterFiles=עļ... +StatusSavingUninstall=ڱжϢ... +StatusRunProgram=ɰװ... +StatusRollback=ڻع... + +; *** Misc. errors +ErrorInternal2=ڲ%1 +ErrorFunctionFailedNoCode=%1 ʧ +ErrorFunctionFailed=%1 ʧܡ %2 +ErrorFunctionFailedWithMessage=%1 ʧܡ %2%n%3 +ErrorExecutingProgram=޷ִļ%n%1 + +; *** Registry errors +ErrorRegOpenKey=עʱ%n%1\%2 +ErrorRegCreateKey=עʱ%n%1\%2 +ErrorRegWriteKey=дעʱ%n%1\%2 + +; *** INI errors +ErrorIniEntry=ļ%1д INI Ŀʱ + +; *** File copying errors +FileAbortRetryIgnore=ԡ³ԣԡļ (Ƽ)ֹȡװ +FileAbortRetryIgnore2=ԡ³ԣԡװ (Ƽ)ֹȡװ +SourceIsCorrupted=Դļ +SourceDoesntExist=Դļ%1 +ExistingFileReadOnly=ļΪֻ%n%nԡƳֻԲԣԡļֹȡװ +ErrorReadingExistingDest=ȡļʱ +FileExists=ļѴڡ%n%nҪ +ExistingFileNewer=ļȰװҪװĻ¡㱣ļ%n%nļ +ErrorChangingAttr=ļʱ +ErrorCreatingTemp=Ŀļдļʱ +ErrorReadingSource=ȡԴļʱ +ErrorCopying=ļʱ +ErrorReplacingExistingFile=滻ļʱ +ErrorRestartReplace=滻ʧܣ +ErrorRenamingTemp=Ŀļеļʱ +ErrorRegisterServer=޷ע DLL/OCX%1 +ErrorRegSvr32Failed=RegSvr32 ʧܡֵ%1 +ErrorRegisterTypeLib=޷עͿ⣺%1 + +; *** Post-installation errors +ErrorOpeningReadme=ļʱ +ErrorRestartingComputer=װ޷ԡֶ + +; *** Uninstaller messages +UninstallNotFound=ļ%1ڡжء +UninstallOpenError=ļ%1ܴ򿪡ж +UninstallUnsupportedVer=ж־ļ%1ĸʽܱ˰汾жسʶ𡣲ж +UninstallUnknownEntry=ж־һδ֪Ŀ (%1) +ConfirmUninstall=ǷȷҪȫɾ %1 +UninstallOnlyOnWin64=˰װֻ 64 λ Windows жء +OnlyAdminCanUninstall=˰װֻɾ߱ԱȨ޵ûжء +UninstallStatusLabel=ɾ %1Ե... +UninstalledAll=%1 ѳɹɾ +UninstalledMost=%1 жɡ%n%nijЩĿɾֶɾ +UninstalledAndNeedsRestart=Ҫ %1 жأԡ%n%nҪ +UninstallDataCorrupted=ļ%1𻵡ж + +; *** Uninstallation phase messages +ConfirmDeleteSharedFileTitle=ɾļ +ConfirmDeleteSharedFile2=йļٱκγʹáҪɾùļ%n%nгʹøļѱɾЩ޷С㲻ȷѡ񡰷񡱡¸ļϵͳκΣ +SharedFileNameLabel=ļ +SharedFileLocationLabel=λã +WizardUninstalling=ж״̬ +StatusUninstalling=ж %1... + +; The custom messages below aren't used by Setup itself, but if you make +; use of them in your scripts, you'll want to translate them. + +[CustomMessages] + +NameAndVersion=%1 汾 %2 +AdditionalIcons=ͼ꣺ +CreateDesktopIcon=ͼ(&D) +CreateQuickLaunchIcon=ͼ(&Q) +ProgramOnTheWeb=%1 վ +UninstallProgram=ж %1 +LaunchProgram= %1 +AssocFileExtension= %1 %2 ļչ(&A) +AssocingFileExtension=ڽ %1 %2 ļչ... diff --git a/script/ChineseTrad-2-5.1.11.isl b/script/ChineseTrad-2-5.1.11.isl new file mode 100644 index 0000000..cc4f2a5 --- /dev/null +++ b/script/ChineseTrad-2-5.1.11.isl @@ -0,0 +1,317 @@ +; *** Inno Setup version 5.1.11+ Chinese (Traditional) messages *** +; +; To download user-contributed translations of this file, go to: +; http://www.jrsoftware.org/is3rdparty.php +; +; Translated by: Patrick Pang (uncleleft at yahoo.com.hk) +; +; Note: When translating this text, do not add periods (.) to the end of +; messages that didn't have them already, because on those messages Inno +; Setup adds the periods automatically (appending a period would result in +; two periods being displayed). + +[LangOptions] +LanguageName=<7e41><9ad4><4e2d><6587> +LanguageID=$0404 +LanguageCodepage=950 +; If the language you are translating to requires special font faces or +; sizes, uncomment any of the following entries and change them accordingly. +DialogFontName=sө +DialogFontSize=9 +TitleFontName=Arial +TitleFontSize=28 +WelcomeFontName=sө +WelcomeFontSize=12 +CopyrightFontName=sө +CopyrightFontSize=9 + +[Messages] + +; *** Application titles +SetupAppTitle=w˵{ +SetupWindowTitle=%1 w˵{ +UninstallAppTitle=Ѱw +UninstallAppFullTitle=Ѱw %1 + +; *** Misc. common +InformationTitle=T +ConfirmTitle=T{ +ErrorTitle=~ + +; *** SetupLdr messages +SetupLdrStartupMessage=oN|w %1CzQn~? +LdrCannotCreateTemp=Lkإ߼ȦsɮסCw˵{N|C +LdrCannotExecTemp=LkȦsɮסCw˵{N|C + +; *** Startup error messages +LastErrorMessage=%1%n%n~ %2: %3 +SetupFileMissing=w˸Ƨɮ %1CЭץDέsonC +SetupFileCorrupt=wɮפwglCЭsonC +SetupFileCorruptOrWrongVer=wɮפwglAλPw˵{šCЭsonC +NotOnThisPlatform=oӵ{Lkb %1 C +OnlyOnThisPlatform=oӵ{b %1 C +OnlyOnTheseArchitectures=oӵ{ubMHUBz[cӳ]p Windows Ww:%n%n%1 +MissingWOW64APIs=oӪ Windows ]tw˵{ 64 줸w˩һݪ\CЦw Service Pack %1 hץDC +WinVersionTooLowError=oӵ{b %1 %2 ΥHWtΰC +WinVersionTooHighError=oӵ{Lkw˦b %1 %2 ΥHWtΡC +AdminPrivilegesRequired=znJtκ޲zHw˳oӵ{C +PowerUserPrivilegesRequired=znJ㦳tκ޲z Power User vϥΪ̥Hw˳oӵ{C +SetupAppRunningError=w˵{ %1 bC%n%nӵ{ [Tw] ~AΫ [] }C +UninstallAppRunningError=Ѱw˵{ %1 bC%n%nӵ{ [Tw] ~AΫ [] }C + +; *** Misc. errors +ErrorCreatingDir=w˵{Lkإ߸Ƨ "%1"C +ErrorTooManyFilesInDir=LkbƧ "%1" إɮסA]ƧӦhɮסC + +; *** Setup common messages +ExitSetupTitle=w˵{ +ExitSetupMessage=w˩|CpGz{bw˵{Aoӵ{N|QwˡC%n%nziHyAw˵{Hw˵{ǡCz{bnw˵{? +AboutSetupMenuItem=w˵{(&A)... +AboutSetupTitle=w˵{ +AboutSetupMessage=%1 %2%n%3%n%n%1 }:%n%4 +AboutSetupNote= +TranslatorNote=c餤yt Patrick Pang (uncleleft@yahoo.com.hk) @C + +; *** Buttons +ButtonBack=< W@B(&B) +ButtonNext=U@B(&N) > +ButtonInstall=w(&I) +ButtonOK=Tw +ButtonCancel= +ButtonYes=O(&Y) +ButtonYesToAll=ҬO(&A) +ButtonNo=_(&N) +ButtonNoToAll=ҧ_(&O) +ButtonFinish=(&F) +ButtonBrowse=s(&B)... +ButtonWizardBrowse=s(&R)... +ButtonNewFolder=إ߷sƧ(&M) + +; *** "Select Language" dialog messages +SelectLanguageTitle=ܦw˻y +SelectLanguageLabel=ܦbw˹L{ϥΪy: + +; *** Common wizard text +ClickNext= [U@B] ~wˡAΫ [] w˵{C +BeveledLabel= +BrowseDialogTitle=sƧ +BrowseDialogLabel=bUƧCܤ@ӸƧAM [Tw]C +NewFolderName=sƧ + +; *** "Welcome" wizard page +WelcomeLabel1=wϥ [name] w˵{ +WelcomeLabel2=oӦw˵{N|w [name/ver] zqC%n%nڭ̱jPijzbw˹L{䥦ε{AHקKPw˵{oͽĬC + +; *** "Password" wizard page +WizardPassword=KX +PasswordLabel1=oӦw˵{㦳KXO@C +PasswordLabel3=пJKXAM [U@B] ~CKXOϤjpgC +PasswordEditLabel=KX(&P): +IncorrectPassword=zJKXTAЭsJC + +; *** "License Agreement" wizard page +WizardLicense=vX +LicenseLabel=о\ŪHUvXC +LicenseLabel3=о\ŪHUvXAzXUڤ~~wˡC +LicenseAccepted=ڦPN(&A) +LicenseNotAccepted=ڤPN(&D) + +; *** "Information" wizard pages +WizardInfoBefore=T +InfoBeforeLabel=b~wˤeо\ŪHUnTC +InfoBeforeClickLabel=zdzƦn~wˡAЫ [U@B]C +WizardInfoAfter=T +InfoAfterLabel=b~wˤeо\ŪHUnTC +InfoAfterClickLabel=zdzƦn~wˡAЫ [U@B]C + +; *** "User Information" wizard page +WizardUserInfo=ϥΪ̸T +UserInfoDesc=пJzơC +UserInfoName=ϥΪ̦W(&U): +UserInfoOrg=´(&O): +UserInfoSerial=Ǹ(&S): +UserInfoNameRequired=zJzW١C + +; *** "Select Destination Location" wizard page +WizardSelectDir=ܥتƧ +SelectDirDesc=ܦw˵{w [name] mC +SelectDirLabel3=w˵{N| [name] w˨UƧC +SelectDirBrowseLabel= [Tw] ~ApGzQܥt@ӸƧAЫ [s]C +DiskSpaceMBLabel=ֻ̤ݭn [mb] MB ϺЪŶC +ToUNCPathname=w˵{Lkw˩ UNC |W١CpGzƱw˩WLqAzإߤ@өTwsϺоC +InvalidPath=zJ㪺|W٤κϺоNXC%n%nҦp C:\App UNC |榡 \\A\@θƧC +InvalidDrive=zϺо UNC W٤sbεLksAпܨLتaC +DiskSpaceWarningTitle=ϺЪŶ +DiskSpaceWarning=w˵{ݭnܤ %1 KB ϺЪŶAzҿϺХu %2 KB iΪŶC%n%nzn~w˶? +DirNameTooLong=ƧW٩θ|ӪC +InvalidDirName=ƧW٤TC +BadDirName32=ƧW٤o]tHUSr:%n%n%1 +DirExistsTitle=Ƨwgsb +DirExists=Ƨ %1 wgsbC%n%nzn~w˨oӸƧ? +DirDoesntExistTitle=Ƨsb +DirDoesntExist=Ƨ %1 sbC%n%nznإ߳oӸƧ? + +; *** "Select Components" wizard page +WizardSelectComponents=ܤ +SelectComponentsDesc=ܱN|Qw˪C +SelectComponentsLabel2=ܱzQnw˪βMzQw˪AM [U@B] ~wˡC +FullInstallation=w +; if possible don't translate 'Compact' as 'Minimal' (I mean 'Minimal' in your language) +CompactInstallation=̤pw +CustomInstallation=ۭqw +NoUninstallWarningTitle=wsb +NoUninstallWarning=w˵{HUwgw˦bzqW:%n%n%1%n%nܳoǤN|̡C%n%nzMn~? +ComponentSize1=%1 KB +ComponentSize2=%1 MB +ComponentsDiskSpaceMBLabel=ثeܻݭnܤ [mb] MB ϺЪŶC + +; *** "Select Additional Tasks" wizard page +WizardSelectTasks=ܪ[u@ +SelectTasksDesc=ܭn檺[u@C +SelectTasksLabel2=ܦw˵{bw [name] ɭn檺[u@AM [U@B]C + +; *** "Select Start Menu Folder" wizard page +WizardSelectProgramGroup=ܡu}lv\Ƨ +SelectStartMenuFolderDesc=ܦw˵{إߵ{|mC +SelectStartMenuFolderLabel3=w˵{N|{|إߦbUu}lv\ƧC +SelectStartMenuFolderBrowseLabel= [Tw] ~ApGzQܥt@ӸƧAЫ [s]C +MustEnterGroupName=zJ@ӸƧW١C +GroupNameTooLong=ƧW٩θ|ӪC +InvalidGroupName=ƧW٤TC +BadGroupName=ƧW٤o]tUCr:%n%n%1 +NoProgramGroupCheck2=nbu}lv\إ߸Ƨ(&D) + +; *** "Ready to Install" wizard page +WizardReady=dzƦw +ReadyLabel1=w˵{N}lw [name] zqC +ReadyLabel2a=U [w] ~wˡAΫ [W@B] s˵γ]wUﶵeC +ReadyLabel2b=U [w] ~wˡC +ReadyMemoUserInfo=ϥΪ̸T +ReadyMemoDir=تƧ: +ReadyMemoType=w˫A: +ReadyMemoComponents=ܪ: +ReadyMemoGroup=u}lv\Ƨ: +ReadyMemoTasks=[u@: + +; *** "Preparing to Install" wizard page +WizardPreparing=dzƦw˵{ +PreparingDesc=w˵{dzƱN [name] w˨zqWC +PreviousInstallNotCompleted=ew/ Ѱw˩|AzsҰʹqHӦwˡC%n%nbsҰʹqAЦAoӵ{Ӧw [name]C +CannotContinue=w˵{Lk~CЫ [] }C + +; *** "Installing" wizard page +WizardInstalling=bw +InstallingLabel=еyԡAw˵{bN [name] w˨zqWC + +; *** "Setup Completed" wizard page +FinishedHeadingLabel=w˧ +FinishedLabelNoIcons=w˵{wgN [name] w˦bzqWC +FinishedLabel=w˵{wgN [name] w˦bzqAziHܵ{ϥܨӰε{C +ClickFinish= [] Hw˵{C +FinishedRestartLabel=n [name] wˡAw˵{sҰʱzqCzQn{bsҰʹq? +FinishedRestartMessage=n [name] wˡAw˵{sҰʱzqC%n%nzQn{bsҰʹq? +ShowReadmeCheck=OAڭn\ŪŪɮסC +YesRadio=OAߧYsҰʹq(&Y) +NoRadio=_Aڵy᭫sҰʹq(&N) +; used for example as 'Run MyProg.exe' +RunEntryExec= %1 +; used for example as 'View Readme.txt' +RunEntryShellExec=˵ %1 + +; *** "Setup Needs the Next Disk" stuff +ChangeDiskTitle=w˵{ݭnU@iϤ +SelectDiskLabel2=дJϤ %1AM [Tw]C%n%npGɮפbHUܪƧAпJTƧW٩Ϋ [s] C +PathLabel=|(&P): +FileNotInDir2=ɮ "%1" Lkb "%2" CдJTϤοܨ䥦ƧC +SelectDirectoryLabel=ЫwU@iϤmC + +; *** Installation phase messages +SetupAborted=w˨SC%n%nЧ󥿰D᭫swˤ@C +EntryAbortRetryIgnore= [] դ@AU [L] LoɮסAΫU [] wˡC + +; *** Installation status messages +StatusCreateDirs=bإ߸Ƨ... +StatusExtractFiles=bYɮ... +StatusCreateIcons=bإߵ{ϥ... +StatusCreateIniEntries=gJ INI ɮת... +StatusCreateRegistryEntries=bstεn... +StatusRegisterFiles=bnɮ... +StatusSavingUninstall=xsѰw˸T... +StatusRunProgram=bw... +StatusRollback=b_ܧ... + +; *** Misc. errors +ErrorInternal2=~: %1C +ErrorFunctionFailedNoCode=%1 ѡC +ErrorFunctionFailed=%1 ѡCNX %2C +ErrorFunctionFailedWithMessage=%1 ѡCNX %2C%n%3 +ErrorExecutingProgram=Lkɮ:%n%1 + +; *** Registry errors +ErrorRegOpenKey=Lk}ҵn:%n%1\%2 +ErrorRegCreateKey=Lkإߵn:%n%1\%2 +ErrorRegWriteKey=Lkܧn:%n%1\%2 + +; *** INI errors +ErrorIniEntry=Lkإ INI "%1"C + +; *** File copying errors +FileAbortRetryIgnore= [] Aդ@A [L] Loɮס]ij^AΫ [] wˡC +FileAbortRetryIgnore2= [] Aդ@A [L] ~i]ij^AΫ [] wˡC +SourceIsCorrupted=ӷɮפwglC +SourceDoesntExist=ӷɮ "%1" sbC +ExistingFileReadOnly=ɮݩʤw]ŪC%n%n [] NŪݩʲæAդ@A [L] LoɮסAΫ [] wˡC +ErrorReadingExistingDest=Ū@Ӥwsbɮ׮ɵoͿ~: +FileExists=ɮפwgsbCznNثeɮ׶? +ExistingFileNewer=sbɮתsAijzOdثewsbɮסC%n%nznOdثewsbɮ׶? +ErrorChangingAttr=bܧɮݩʮɵoͿ~: +ErrorCreatingTemp=bتƧإɮ׮ɵoͿ~: +ErrorReadingSource=Ūlɮ׮ɵoͿ~: +ErrorCopying=ƻsɮ׮ɵoͿ~: +ErrorReplacingExistingFile=Nɮ׮ɵoͿ~: +ErrorRestartReplace=sҰʹqNɮץ: +ErrorRenamingTemp=bتƧܧɮצWٮɵoͿ~: +ErrorRegisterServer=Lkn DLL/OCX ɮ: %1C +ErrorRegSvr32Failed= RegSvr32 ѡA~X %1C +ErrorRegisterTypeLib=Lkn Type Library: %1C + +; *** Post-installation errors +ErrorOpeningReadme=}Ūɮ׮ɵoͿ~C +ErrorRestartingComputer=w˵{LksҰʹqAХHʤ覡ۦ歫sҰʹqC + +; *** Uninstaller messages +UninstallNotFound=ɮ "%1" sbALk{C +UninstallOpenError=Lk}ɮ "%1"ALk{C +UninstallUnsupportedVer=oӪѰw˵{LkѰO "%1" 榡ALkѰwˡC +UninstallUnknownEntry=Ѱw˰Oɤo{O (%1)C +ConfirmUninstall=zTwn %1 Ψɮ׶? +UninstallOnlyOnWin64=oӵ{ub 64 줸 Windows WѰwˡC +OnlyAdminCanUninstall=oӵ{nƨtκ޲zvϥΪ̤iѰwˡC +UninstallStatusLabel=bqzq %1 Aеy... +UninstalledAll=%1 wg\qzqC +UninstalledMost=%1 Ѱw˧C%n%nYɮפΤLkAziHۦRoɮסC +UninstalledAndNeedsRestart=n %1 Ѱw˵{ǡAzsҰʹqC%n%nzQn{bsҰʹq? +UninstallDataCorrupted=ɮ "%1" wglALkѰwˡC + +; *** Uninstallation phase messages +ConfirmDeleteSharedFileTitle=@ɮ +ConfirmDeleteSharedFile2=tܤUC@ɮפwAQ{ҨϥΡAznoɮ׶?%n%n%1%n%nխYzFHWɮצ{ݭnϥΥ̡ANyoǵ{Lk`A]zYLkTwп [_]COdoɮצbztΤ|yl`C +SharedFileNameLabel=ɮצW: +SharedFileLocationLabel=m: +WizardUninstalling=Ѱw˪A +StatusUninstalling=bѰw %1... + +; The custom messages below aren't used by Setup itself, but if you make +; use of them in your scripts, you'll want to translate them. + +[CustomMessages] + +NameAndVersion=%1 %2 +AdditionalIcons=[ϥ: +CreateDesktopIcon=إ߮ୱϥ(&D) +CreateQuickLaunchIcon=إߧֳtҰʹϥ(&Q) +ProgramOnTheWeb=%1 +UninstallProgram=Ѱw %1 +LaunchProgram=Ұ %1 +AssocFileExtension=N %1 PɮװɦW %2 p(&A) +AssocingFileExtension=bN %1 PɮװɦW %2 p... diff --git a/script/ScarBanner.bmp b/script/ScarBanner.bmp new file mode 100644 index 0000000..1313556 Binary files /dev/null and b/script/ScarBanner.bmp differ diff --git a/script/Turkish-3-5.1.11.isl b/script/Turkish-3-5.1.11.isl new file mode 100644 index 0000000..2703aa8 --- /dev/null +++ b/script/Turkish-3-5.1.11.isl @@ -0,0 +1,310 @@ +; Translation made with Stonevoice Translator 2.1 (http://www.stonevoice.com/auto/translator) +; $Translator:NL=%n:TB=%t +; *** Inno Setup version 5.1.11+ Turkish messages *** +; Language " Tke" :::::: Turkish +; Translate by " eviren " :::::: Adil YILDIZ +; E-Mail " Elektronik Posta " :::::: adil@kde.org.tr +; Home Page " Web Adresi " :::::: http://www.adilyildiz.com.tr +; +; $jrsoftware: issrc/Files/Default.isl,v 1.66 2005/02/25 20:23:48 mlaan Exp $ +[LangOptions] +LanguageName=T<00FC>rk<00E7>e +LanguageID=$041f +LanguageCodePage=1254 +; If the language you are translating to requires special font faces or +; sizes, uncomment any of the following entries and change them accordingly. +;DialogFontName= +;DialogFontSize=8 +;WelcomeFontName=Verdana +;WelcomeFontSize=12 +;TitleFontName=Arial +;TitleFontSize=29 +;CopyrightFontName=Arial +;CopyrightFontSize=8 +DialogFontName= +[Messages] + +; *** Application titles +SetupAppTitle=Kur +SetupWindowTitle=%1 - Kur +UninstallAppTitle=Kaldr +UninstallAppFullTitle=%1 Kaldr + +; *** Misc. common +InformationTitle=Bilgi +ConfirmTitle=Sorgu +ErrorTitle=Hata + +; *** SetupLdr messages +SetupLdrStartupMessage=Bu kurulum %1 programn ykleyecektir. Devam etmek istiyor musunuz? +LdrCannotCreateTemp=Geici bir dosya oluturulamad. Kurulum iptal edildi +LdrCannotExecTemp=Geici dizindeki dosya altrlamad. Kurulum iptal edildi + +; *** Startup error messages +LastErrorMessage=%1.%n%nHata %2: %3 +SetupFileMissing=%1 adl dosya kurulum dizininde bulunamad. Ltfen problemi dzeltiniz veya programn yeni bir kopyasn edininiz. +SetupFileCorrupt=Kurulum dosyalar bozulmu. Ltfen programn yeni bir kopyasn edininiz. +SetupFileCorruptOrWrongVer=Kurulum dosyalar bozulmu veya kurulumun bu srm ile uyumuyor olabilir. Ltfen problemi dzeltiniz veya Programn yeni bir kopyasn edininiz. +NotOnThisPlatform=Bu program %1 zerinde altrlamaz. +OnlyOnThisPlatform=Bu program sadece %1 zerinde altrlmaldr. +OnlyOnTheseArchitectures=Bu program sadece aadaki mimarilere sahip Windows srmlerinde alr:%n%n%1 +MissingWOW64APIs=Kullandnz Windows srm Kur'un 64-bit ykleme yapabilmesi iin gerekli olan zelliklere sahip deildir. Bu problemi ortadan kaldrmak iin ltfen Service Pack %1 ykleyiniz. +WinVersionTooLowError=Bu program altrabilmek iin %1 %2 srm veya daha sonras ykl olmaldr. +WinVersionTooHighError=Bu program %1 %2 srm veya sonrasnda almaz. +AdminPrivilegesRequired=Bu program kurulurken ynetici olarak oturum alm olmak gerekmektedir. +PowerUserPrivilegesRequired=Bu program kurulurken Ynetici veya G Yneticisi Grubu yesi olarak giri yaplm olmas gerekmektedir. +SetupAppRunningError=Kur %1 programnn altn tespit etti.%n%nLtfen bu programn alan btn paralarn imdi kapatnz, daha sonra devam etmek iin Tamam'a veya kmak iin ptal'e basnz. +UninstallAppRunningError=Kaldr %1 programnn altn tespit etti.%n%nLtfen bu programn alan btn paralarn imdi kapatnz, daha sonra devam etmek iin Tamam'a veya kmak iin ptal'e basnz. + +; *** Misc. errors +ErrorCreatingDir=Kur " %1 " dizinini oluturamad. +ErrorTooManyFilesInDir=" %1 " dizininde bir dosya oluturulamad. nk dizin ok fazla dosya ieriyor + +; *** Setup common messages +ExitSetupTitle=Kur'dan k +ExitSetupMessage=Kurulum tamamlanmad. imdi karsanz program kurulmu olmayacak.%n%nDaha sonra Kur'u tekrar altrarak kurulumu tamamlayabilirsiniz.%n%nKur'dan kmak istediinizden emin misiniz? +AboutSetupMenuItem=Kur H&akknda... +AboutSetupTitle=Kur Hakknda +AboutSetupMessage=%1 %2 srm%n%3%n%n%1 internet:%n%4 +AboutSetupNote= +TranslatorNote=yi bir kurulum program aryorsanz buldunuz...%nhttp://www.adilyildiz.com.tr + +; *** Buttons +ButtonBack=< G&eri +ButtonNext=&leri > +ButtonInstall=&Kur +ButtonOK=Tamam +ButtonCancel=ptal +ButtonYes=E&vet +ButtonYesToAll=Tmne E&vet +ButtonNo=&Hayr +ButtonNoToAll=Tmne Ha&yr +ButtonFinish=&Son +ButtonBrowse=&Gzat... +ButtonWizardBrowse=Gza&t... +ButtonNewFolder=Ye&ni Dizin Olutur + +; *** "Select Language" dialog messages +SelectLanguageTitle=Kur Dilini Seiniz +SelectLanguageLabel=Ltfen kurulum srasnda kullanacanz dili seiniz: + +; *** Common wizard text +ClickNext=Devam etmek iin leri'ye , kmak iin ptal 'e basnz. +BeveledLabel=Inno Setup 5.1+ Trke +BrowseDialogTitle=Dizine Gzat +BrowseDialogLabel=Aadaki listeden bir dizin seip, daha sonra Tamam tuuna basnz. +NewFolderName=Yeni Dizin + +; *** "Welcome" wizard page +WelcomeLabel1=[name] Kurulum Sihirbazna Hogeldiniz. +WelcomeLabel2=Kur imdi [name/ver] programn bilgisayarnza ykleyecektir.%n%nDevam etmeden nce alan dier btn programlar kapatmanz tavsiye edilir. + +; *** "Password" wizard page +WizardPassword=ifre +PasswordLabel1=Bu kurulum ifre korumaldr. +PasswordLabel3=Ltfen ifreyi giriniz. Daha sonra devam etmek iin leri'ye basnz. Ltfen ifreyi girerken Byk-Kk harflere dikkat ediniz. +PasswordEditLabel=&ifre: +IncorrectPassword=Girdiiniz ifre hatal. Ltfen tekrar deneyiniz. + +; *** "License Agreement" wizard page +WizardLicense=Lisans Anlamas +LicenseLabel=Ltfen devam etmeden nce aadaki nemli bilgileri okuyunuz. +LicenseLabel3=Ltfen Aadaki Lisans Anlamasn okuyunuz. Kuruluma devam edebilmek iin bu anlamann koullarn kabul etmi olmalsnz. +LicenseAccepted=Anlamay Kabul &Ediyorum. +LicenseNotAccepted=Anlamay Kabul Et&miyorum. + +; *** "Information" wizard pages +WizardInfoBefore=Bilgi +InfoBeforeLabel=Ltfen devam etmeden nce aadaki nemli bilgileri okuyunuz. +InfoBeforeClickLabel=Kur ile devam etmeye hazr olduunuzda leri'yi tklaynz. +WizardInfoAfter=Bilgi +InfoAfterLabel=Ltfen devam etmeden nce aadaki nemli bilgileri okuyunuz. +InfoAfterClickLabel=Kur ile devam etmeye hazr olduunuzda leri'yi tklaynz. + +; *** "User Information" wizard page +WizardUserInfo=Kullanc Bilgileri +UserInfoDesc=Ltfen bilgilerinizi giriniz. +UserInfoName=K&ullanc Ad: +UserInfoOrg=i&rket: +UserInfoSerial=&Seri Numaras: +UserInfoNameRequired=Bir isim girmelisiniz. + +; *** "Select Destination Directory" wizard page +WizardSelectDir=Kurulacak Dizini Seiniz +SelectDirDesc=[name] hangi dizine kurulsun? +SelectDirLabel3=Kur [name] programn aadaki dizine kuracaktr. +SelectDirBrowseLabel=Devam etmek iin leri'ye basnz. Baka bir dizin semek istiyorsanz, Gzat'a basnz. +DiskSpaceMBLabel=Bu program en az [mb] MB disk alan gerektirmektedir. +ToUNCPathname=Kur UNC tipindeki dizin yollarna (rn:\\yol vb.) kurulum yapamaz. Eer A zerinde kurulum yapmaya alyorsanz. Bir a srcs tantmanz gerekir. +InvalidPath=Src ismi ile birlikte tam yolu girmelisiniz; rnein %nC:\APP%n%n veya bir UNC yolunu %n%n\\sunucu\paylam%n%n eklinde girmelisiniz. +InvalidDrive=Setiiniz src bulunamad veya ulalamyor. Ltfen baka bir src seiniz. +DiskSpaceWarningTitle=Yetersiz Disk Alan +DiskSpaceWarning=Kur en az %1 KB kullanlabilir disk alan gerektirmektedir. Ancak seili diskte %2 KB bo alan bulunmaktadr.%n%nYine de devam etmek istiyor musunuz? +DirNameTooLong=Dizin ad veya yolu ok uzun. +InvalidDirName=Dizin ad geersiz. +BadDirName32=Dizin ad takib eden karakterlerden her hangi birini ieremez:%n%n%1 +DirExistsTitle=Dizin Bulundu +DirExists=Dizin:%n%n%1%n%n zaten var. Yine de bu dizine kurmak istediinizden emin misiniz? +DirDoesntExistTitle=Dizin Bulunamad +DirDoesntExist=Dizin:%n%n%1%n%nbulunmamaktadr. Bu dizini oluturmak ister misiniz? + +; *** "Select Components" wizard page +WizardSelectComponents=Bileen Se +SelectComponentsDesc=Hangi bileenler kurulsun? +SelectComponentsLabel2=Kurmak istediiniz bileenleri seiniz; istemediklerinizi temizleyiniz.Devam etmeye hazr olduunuz zaman leri'ye tklaynz. +FullInstallation=Tam Kurulum +; if possible don't translate 'Compact' as 'Minimal' (I mean 'Minimal' in your language) +CompactInstallation=Normal Kurulum +CustomInstallation=zel Kurulum +NoUninstallWarningTitle=Mevcut Bileenler +NoUninstallWarning=Kur aadaki bileenlerin kurulu olduunu tespit etti:%n%n%1%n%nBu bileenlerin seimini kaldrmak bileenleri silmeyecek.%n%nYine de devam etmek istiyor musunuz? +ComponentSize1=%1 KB +ComponentSize2=%1 MB +ComponentsDiskSpaceMBLabel=Seili bileenler iin en az [mb] MB disk alan gerekmektedir. + +; *** "Select Additional Tasks" wizard page +WizardSelectTasks=Ek Grevleri Seiniz +SelectTasksDesc=Hangi grevler yerine getirilsin? +SelectTasksLabel2=[name] kurulurken istediiniz ek grevleri seip leri'ye tklaynz. + +; *** "Balat Mens Dizini Se" sihirbaz sayfas +WizardSelectProgramGroup=Balat Mens Dizinini Seiniz +SelectStartMenuFolderDesc=Kur program ksayollarn nereye yerletirsin? +SelectStartMenuFolderLabel3=Kur programn ksayollarn aadaki Balat Mens dizinine kuracak. +SelectStartMenuFolderBrowseLabel=Devam etmek iin, leri'ye basnz. Baka bir dizin semek istiyorsanz, Gzat'a basnz. +MustEnterGroupName=Bir dizin ismi girmelisiniz. +GroupNameTooLong=Dizin ad veya yolu ok uzun. +InvalidGroupName=Dizin ad geersiz. +BadGroupName=Dizin ad, takip eden karakterlerden her hangi birini ieremez:%n%n%1 +NoProgramGroupCheck2=&Balat mensnde ksayol oluturma + +; *** "Ready to Install" wizard page +WizardReady=Ykleme iin Hazr +ReadyLabel1=Kur [name] programn bilgisayarnza kurmak iin hazr. +ReadyLabel2a=Kuruluma devam etmek iin Kur'a , ayarlarnz kontrol etmek veya deitirmek iin Geri'ye tklaynz. +ReadyLabel2b=Kuruluma devam etmek iin Kur'a tklaynz. +ReadyMemoUserInfo=Kullanc bilgisi: +ReadyMemoDir=Hedef dizin: +ReadyMemoType=Kurulum tipi: +ReadyMemoComponents=Seili bileenler: +ReadyMemoGroup=Balat Mens : +ReadyMemoTasks=Ek grevler: + +; *** "Kur Hazlanyor" sihirbaz sayfas +WizardPreparing=Kurulum Hazrlanyor +PreparingDesc=Kur [name] programn bilgisayarnza kurmak iin hazrlanyor. +PreviousInstallNotCompleted=Bir nceki Kurulum/Kaldr programna ait ilem tamamlanmam.nceki kurulum ileminin tamamlanmas iin bilgisayarnz yeniden balatmalsnz.%n%nBilgisayarnz tekrar baladktan sonra,Kurulum'u tekrar altrarak [name] programn kurma ilemine devam edebilirsiniz. +CannotContinue=Kur devam edemiyor. Ltfen ptal'e tklayp kn. + +; *** "Kuruluyor" sihirbaz +WizardInstalling=Kuruluyor +InstallingLabel=Ltfen [name] bilgisayarnza kurulurken bekleyiniz. + +; *** "Setup Completed" wizard page +FinishedHeadingLabel=[name] Kur Sihirbaz tamamlanyor +FinishedLabelNoIcons=Kur [name] programn bilgisayarnza kurma ilemini tamamlad. +FinishedLabel=Kur [name] programn bilgisayarnza kurma ilemini tamamlad. Program yklenen ksayol ikonlarna tklanarak altrlabilir. +ClickFinish=Kur'dan kmak iin Son'a tklaynz. +FinishedRestartLabel=[name] programnn kurulumunu bitirmek iin, Kur bilgisayarnz yeniden balatacak. Bilgisayarnz yeniden balatlsn m? +FinishedRestartMessage=[name] kurulumunu bitirmek iin, bilgisayarnzn yeniden balatlmas gerekmektedir. %n%nBiligisayarnz yeniden balatlsn m? +ShowReadmeCheck=Beni Oku dosyasn okumak istiyorum. +YesRadio=&Evet , bilgisayar yeniden balatlsn. +NoRadio=&Hayr, daha sonra yeniden balatrm. +; used for example as 'Run MyProg.exe' +RunEntryExec=%1 uygulamasn altr +; used for example as 'View Readme.txt' +RunEntryShellExec=%1 dosyasn grntle + +; *** "Setup Needs the Next Disk" stuff +ChangeDiskTitle=Bir Sonraki Diski Taknz +SelectDiskLabel2=%1 numaral diski takp, Tamam' tklaynz.%n%nEer dosyalar baka bir yerde bulunuyor ise doru yolu yaznz veya Gzat' tklaynz. +PathLabel=&Yol: +FileNotInDir2=" %1 " adl dosya " %2 " dizininde bulunamad. Ltfen doru diski veya dosyay seiniz. +SelectDirectoryLabel=Ltfen sonraki diskin yerini belirleyiniz. + +; *** Installation phase messages +SetupAborted=Kurulum tamamlanamad.%n%nLtfen problemi dzeltiniz veya Kurulum'u tekrar altrnz. +EntryAbortRetryIgnore=Tekrar denemek iin "Tekrar Dene" ye , yine de devam etmek iin Yoksay'a , kurulumu iptal etmek iin ise ptal'e tklaynz. + +; *** Installation status messages +StatusCreateDirs=Dizinler oluturuluyor... +StatusExtractFiles=Dosyalar kartlyor... +StatusCreateIcons=Program ksayollar oluturuluyor... +StatusCreateIniEntries=INI girdileri oluturuluyor... +StatusCreateRegistryEntries=Kayt Defteri girdileri oluturuluyor... +StatusRegisterFiles=Dosyalar sisteme kaydediliyor... +StatusSavingUninstall=Kaldr bilgileri kaydediliyor... +StatusRunProgram=Kurulum sonlandrlyor... +StatusRollback=Deiiklikler geri alnyor... + +; *** Misc. errors +ErrorInternal2= hata: %1 +ErrorFunctionFailedNoCode=%1 baarsz oldu. +ErrorFunctionFailed=%1 baarsz oldu; kod %2 +ErrorFunctionFailedWithMessage=%1 baarsz oldu ; kod %2.%n%3 +ErrorExecutingProgram=%1 adl dosya altrlamad. + +; *** Registry errors +ErrorRegOpenKey=Aadaki Kayt Defteri anahtar alrken hata olutu:%n%1\%2 +ErrorRegCreateKey=Aadaki Kayt Defteri anahtar oluturulurken hata olutu:%n%1\%2 +ErrorRegWriteKey=Aadaki Kayt Defteri anahtarna yazlrken hata olutu:%n%1\%2 + +; *** INI errors +ErrorIniEntry=" %1 " adl dosyada INI girdisi yazma hatas. + +; *** File copying errors +FileAbortRetryIgnore=Yeniden denemek iin "Yeniden Dene" ye, dosyay atlamak iin Yoksay'a (nerilmez), Kurulumu iptal etmek iin ptal'e tklaynz. +FileAbortRetryIgnore2=Yeniden denemek iin "Yeniden Dene" ye , yine de devam etmek iin Yoksay'a (nerilmez), Kurulumu ptal etmek iin ptal'e tklaynz. +SourceIsCorrupted=Kaynak dosya bozulmu +SourceDoesntExist=%1 adl kaynak dosya bulunamad. +ExistingFileReadOnly=Dosya Salt Okunur.%n%nSalt Okunur zelliini kaldrp yeniden denemek iin Yeniden Dene'yi , dosyas atlamak iin Yoksay' , Kurulumu iptal etmek iin ptal'i tklaynz. +ErrorReadingExistingDest=Dosyay okurken bir hata olutu : +FileExists=Dosya zaten var.%n%nKurulum'un zerine yazmasn ister misiniz? +ExistingFileNewer=Zaten var olan dosya Kurulum'un yklemek istedii dosyadan daha yeni. Var olan dosyay saklamanz nerilir.%n%nVar olan dosya saklansn m? +ErrorChangingAttr=Zaten var olan dosyann zellii deitirilirken bir hata olutu: +ErrorCreatingTemp=Hedef dizinde dosya oluturulurken bir hata olutu: +ErrorReadingSource=Kaynak dosya okunurken bir hata olutu: +ErrorCopying=Bir dosya kopyalanrken bir hata olutu: +ErrorReplacingExistingFile=Zaten var olan dosya deitirilirken bir hata olutu: +ErrorRestartReplace=RestartReplace baarsz oldu: +ErrorRenamingTemp=Hedef dizinde bulunan dosyann ad deitirilirken hata oldu: +ErrorRegisterServer=%1 adl DLL/OCX sisteme tantlamad. +ErrorRegSvr32Failed=RegSvr32 k hatas %1 ile baarsz oldu +ErrorRegisterTypeLib=%1 adl tip ktphanesi (Type Library) sisteme tantlamad + +; *** Post-installation errors +ErrorOpeningReadme=Beni Oku dosyas alrken hata olutu. +ErrorRestartingComputer=Kurulum bilgisayar yeniden balatamad. Ltfen kendiniz kapatnz. + +; *** Uninstaller messages +UninstallNotFound=%1 adl dosya bulunamad. Kaldrma program altrlamad. +UninstallOpenError="%1" dosyas alamyor. Kaldrma program altrlamad. +UninstallUnsupportedVer=%1 adl Kaldr bilgi dosyas kaldrma programnn bu srm ile uyumuyor. Kaldrma program altrlamad. +UninstallUnknownEntry=Kaldr Bilgi dosyasndaki %1 adl satr anlalamad +ConfirmUninstall=%1 ve bileenlerini kaldrmak istediinizden emin misiniz? +UninstallOnlyOnWin64=Bu kurulum sadece 64-bit Windows'lardan kaldrlabilir. +OnlyAdminCanUninstall=Bu kurulum sadece ynetici yetkisine sahip kullanclar tarafndan kaldrabilir. +UninstallStatusLabel=Ltfen %1 program bilgisayarnzdan kaldrlrken bekleyin... +UninstalledAll=%1 program bilgisayarnzdan tamamen kaldrld. +UninstalledMost=%1 programnn kaldrlma ilemi sona erdi.%n%nBaz bileenler kaldrlamad. Bu dosyalar kendiniz silebilirsiniz. +UninstalledAndNeedsRestart=%1 programnn kaldrlmas tamamland, Bilgisayarnz yeniden balatmalsnz.%n%nimdi yeniden balatlsn m? +UninstallDataCorrupted="%1" adl dosya bozuk. . Kaldrma program altrlamad. + +; *** Uninstallation phase messages +ConfirmDeleteSharedFileTitle=Paylalan Dosya Kaldrlsn M? +ConfirmDeleteSharedFile2=Sistemde paylalan baz dosyalarn artk hibir program tarafndan kullanlmadn belirtiyor. Kaldr bu paylalan dosyalar silsin mi?%n%n Bu dosya baz programlar tafarndan kullanlyorsa ve silinmesini isterseniz, bu programalar dzgn almayabilir. Emin deilseniz, Hayr'a tklaynz. Dosyann sisteminizde durmas hibir zarar vermez. +SharedFileNameLabel=Dosya ad: +SharedFileLocationLabel=Yol: +WizardUninstalling=Kaldrma Durumu +StatusUninstalling=%1 Kaldrlyor... +[CustomMessages] + +NameAndVersion=%1 %2 srm +AdditionalIcons=Ek simgeler: +CreateDesktopIcon=Masast simg&esi olutur +CreateQuickLaunchIcon=Hzl Balat simgesi &olutur +ProgramOnTheWeb=%1 Web Sitesi +UninstallProgram=%1 Programn Kaldr +LaunchProgram=%1 Programn altr +AssocFileExtension=%2 dosya uzantlarn %1 ile ilikilendir +AssocingFileExtension=%2 dosya uzantlar %1 ile ilikilendiriliyor... diff --git a/script/cn_tw.isl b/script/cn_tw.isl new file mode 100644 index 0000000..7b4d30c --- /dev/null +++ b/script/cn_tw.isl @@ -0,0 +1,19 @@ +;Chinese traditional (TW) text for inno setup installer, save in codepage 950. (some chinese chars should start this file to give the editor a good hint about this) + +ChineseTrad.tasks_firewall=bWindows FirewallW[@Өҥ~ +ChineseTrad.dialog_firewall=bsWeMuleWindowsɦw˥.%nФʼW[eMuleܨҥ~M椤 +ChineseTrad.shellextention=.metP.partɮצw˪ɦW +ChineseTrad.othertasks=䥦u@ +ChineseTrad.tasks_assocurl=UeMuleHϥed2ks.emulecollection +ChineseTrad.languagesupport=F^大~ytdll +ChineseTrad.configfiles=B~w, ip-a ɮ +ChineseTrad.configfilesipf=B~w, ipLyM +ChineseTrad.tparty=Ӧۨ䥦peu{ +ChineseTrad.mediainfo=Mediainfo.dlliѦhCɮ^B~T +ChineseTrad.unrar=Unrar.dllΩYǤUɮ +ChineseTrad.corefiles=ݭnɮ +ChineseTrad.helpfile=䴩 +ChineseTrad.locofdata=ɮצm +ChineseTrad.progdir=N]wθɮצw˦ܵ{lؿ +ChineseTrad.appdir=Nɮצw˦common applicationsؿ +ChineseTrad.userdocdir=Nɮצw˦ܥaϥΪ̸| diff --git a/script/emule.iss b/script/emule.iss new file mode 100644 index 0000000..6a02dc7 --- /dev/null +++ b/script/emule.iss @@ -0,0 +1,461 @@ +; create by leuk_he on 10-01-2006 +; (c) 2006-2009 leuk_he (leukhe at gmail dot com) + +[Setup] +AppName=eMule +AppVerName=eMule ScarAngel 4.1 +AppPublisher=Stulle +AppPublisherURL=http://scarangel.sourceforge.net/ +AppSupportURL=http://forum.emule-project.net/index.php?showforum=97 +AppUpdatesURL=https://sourceforge.net/projects/scarangel/files/ +AppCopyright=(c) 2011 Stulle + +UsePreviousAppDir=yes +DirExistsWarning=No +DefaultDirName={pf}\eMule +DefaultGroupName=eMule +AllowNoIcons=yes +; gpl: no accept is required, see point 5 of the gpl +InfoBeforeFile=..\staging\license\license.txt +WizardImageFile=ScarBanner.bmp +WizardImageStretch=no + +; this dir: +OutputDir=. +OutputBaseFilename=scaremuleversion-installer +SetupIconFile=..\srchybrid\res\scar_inst_256.ico +Compression=lzma +;fast for debug: +;Compression=zip +SolidCompression=yes +;emule does not work on win98 due to high "rc" resource usage. +minversion=0,5.0 + + +PrivilegesRequired=poweruser + + +[Languages] +Name: english; MessagesFile: compiler:Default.isl +;Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl" +Name: german; MessagesFile: compiler:Languages\German.isl; InfoBeforeFile: ..\staging\license\license-GER.txt +Name: italian; MessagesFile: compiler:Languages\Italian.isl; InfoBeforeFile: ..\staging\license\license-IT.txt +Name: spanish; MessagesFile: compiler:Languages\Spanish.isl; InfoBeforeFile: ..\staging\license\license-SP.txt +Name: polish; MessagesFile: compiler:Languages\Polish.isl +Name: french; MessagesFile: compiler:Languages\French.isl; InfoBeforeFile: ..\staging\license\license-FR.txt +Name: BrazilianPortuguese; MessagesFile: compiler:Languages\BrazilianPortuguese.isl; InfoBeforeFile: ..\staging\license\license-PT_BR.txt +Name: ChineseSimpl; MessagesFile: ChineseSimp-12-5.1.11.isl; InfoBeforeFile: ..\staging\license\license-CN.txt +Name: ChineseTrad; MessagesFile: ChineseTrad-2-5.1.11.isl +Name: turkish; MessagesFile: Turkish-3-5.1.11.isl; InfoBeforeFile: ..\staging\license\license-TR.txt + +[Dirs] +;make dir writeable for other users than administrator +Name: {app}\config; Permissions: users-modify; tasks: progsdir +Name: {app}\temp; Permissions: users-modify; tasks: progsdir +Name: {app}\incoming; Permissions: users-modify; tasks: progsdir + +Name: {commonappdata}\eMule\config; Permissions: users-modify; components: configfiles; tasks: commonapp +Name: {commonappdata}\eMule\temp; Permissions: users-modify; tasks: commonapp +Name: {commonappdata}\eMule\incoming; Permissions: users-modify; tasks: commonapp +; DO not make dir for user directory userwrteable since that would be openeing up the system to not permitted users. + +[Files] +;todo show correct languge in startup +Source: ..\staging\Template.eMuleSkin.ini; DestDir: {app}; Flags: ignoreversion +Source: ..\staging\Template.Notifier.ini; DestDir: {app}; Flags: ignoreversion +Source: ..\staging\changelog xtreme.txt; DestDir: {app}; Flags: ignoreversion +Source: ..\staging\Changelog.ScarAngel.txt; DestDir: {app}; Flags: ignoreversion +Source: ..\staging\dbghelp.dll; DestDir: {app}; Flags: ignoreversion +Source: ..\staging\eMule.exe; DestDir: {app}; Flags: ignoreversion +;official changelogs and license files are in the license subdir +Source: ..\staging\license\*; DestDir: {app}\license; Flags: ignoreversion recursesubdirs createallsubdirs +Source: ..\staging\webserver\*; DestDir: {app}\webserver; Flags: ignoreversion recursesubdirs createallsubdirs +Source: ..\staging\eMule.chm; DestDir: {app}; Flags: ignoreversion onlyifdoesntexist; components: helpfiles +Source: ..\staging\eMule.1031.chm; DestDir: {app}; Flags: ignoreversion onlyifdoesntexist; components: helpfiles +Source: ..\staging\unrar.dll; DestDir: {app}; components: tpartytools\unrar +Source: ..\staging\unrarlicense.txt; DestDir: {app}; Flags: ignoreversion; components: tpartytools\unrar +Source: ..\staging\mediainfo.dll; DestDir: {app}; Flags: ignoreversion onlyifdoesntexist; components: tpartytools\mediainfo +Source: ..\staging\mediainfo_ReadMe_DLL.txt; DestDir: {app}; Flags: ignoreversion onlyifdoesntexist; components: tpartytools\mediainfo +; shell extension files +Source: ..\eMuleShellExt\Release\eMuleShellExt.dll; DestDir: {app}; Flags: regserver ignoreversion; components: shellextention +Source: ..\eMuleShellExt\doc\eMule Shell Extension.htm; DestDir: {app}; Flags: ignoreversion; components: shellextention +Source: ..\eMuleShellExt\doc\eMule Shell Extension-DE.PNG; DestDir: {app}; Flags: ignoreversion; components: shellextention + +Source: ..\staging\lang\*; DestDir: {app}\lang; Flags: ignoreversion recursesubdirs createallsubdirs; Components: langs + +; task: config is in progdir: +Source: ..\staging\emule\config\AC_ServerMetURLs.dat; DestDir: {app}\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: progsdir +;Source: ..\staging\emule\config\AC_SearchStrings.dat; DestDir: {app}\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: progsdir +Source: ..\staging\emule\config\countryflag.dll; DestDir: {app}\config; Flags: ignoreversion; tasks: progsdir +Source: ..\staging\emule\config\countryflag32.dll; DestDir: {app}\config; Flags: ignoreversion; tasks: progsdir +Source: ..\staging\emule\config\eMule Light.tmpl; DestDir: {app}\config; Flags: ignoreversion; tasks: progsdir +Source: ..\staging\emule\config\Multiuser eMule.tmpl; DestDir: {app}\config; Flags: ignoreversion; tasks: progsdir +Source: ..\staging\emule\config\eMule.tmpl; DestDir: {app}\config; Flags: ignoreversion; tasks: progsdir +Source: ..\staging\emule\config\startup.wav; DestDir: {app}\config; Flags: ignoreversion; tasks: progsdir +Source: ..\staging\emule\config\webservices.dat; DestDir: {app}\config; Flags: ignoreversion; components: configfiles; tasks: progsdir +;Source: ..\staging\emule\config\server.met; DestDir: {app}\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; tasks: progsdir +;Source: ..\staging\emule\config\addresses.dat; DestDir: {app}\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: progsdir +Source: ..\staging\emule\config\nodes.dat; DestDir: {app}\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: progsdir +;not needed, will automatically loaded on first start +;Source: ..\staging\emule\config\ip-to-country.csv; DestDir: {app}\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: progsdir +;Source: ..\staging\emule\config\ipfilter.dat; DestDir: {app}\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfilesipf; tasks: progsdir +Source: ..\staging\emule\config\staticservers.dat; DestDir: {app}\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: progsdir +; to assing correct rights: +Source: ..\staging\emule\config\preferences.ini; DestDir: {app}\config; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Permissions: users-modify; tasks: progsdir + +;appdir +Source: ..\staging\emule\config\AC_ServerMetURLs.dat; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: commonapp +;Source: ..\staging\emule\config\AC_SearchStrings.dat; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: commonapp +Source: ..\staging\emule\config\countryflag.dll; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion; tasks: commonapp +Source: ..\staging\emule\config\countryflag32.dll; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion; tasks: commonapp +Source: ..\staging\emule\config\eMule Light.tmpl; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion; tasks: commonapp +Source: ..\staging\emule\config\Multiuser eMule.tmpl; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion; tasks: commonapp +Source: ..\staging\emule\config\eMule.tmpl; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion; tasks: commonapp +Source: ..\staging\emule\config\startup.wav; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion; tasks: commonapp +Source: ..\staging\emule\config\webservices.dat; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion; components: configfiles; tasks: commonapp +;Source: ..\staging\emule\config\server.met; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; tasks: commonapp +;Source: ..\staging\emule\config\addresses.dat; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: commonapp +Source: ..\staging\emule\config\nodes.dat; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: commonapp +;not needed, will automatically loaded on first start +;Source: ..\staging\emule\config\ip-to-country.csv; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: commonapp +;Source: ..\staging\emule\config\ipfilter.dat; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfilesipf; tasks: commonapp +Source: ..\staging\emule\config\staticservers.dat; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: commonapp +; to assing correct rights: +Source: ..\staging\emule\config\preferences.ini; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Permissions: users-modify; tasks: commonapp + +;mydocuments xp +Source: ..\staging\emule\config\AC_ServerMetURLs.dat; DestDir: {userappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; OnlyBelowVersion: 0,6 +;Source: ..\staging\emule\config\AC_SearchStrings.dat; DestDir: {userappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; OnlyBelowVersion: 0,6 +Source: ..\staging\emule\config\countryflag.dll; DestDir: {userappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; OnlyBelowVersion: 0,6 +Source: ..\staging\emule\config\countryflag32.dll; DestDir: {userappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; OnlyBelowVersion: 0,6 +Source: ..\staging\emule\config\eMule Light.tmpl; DestDir: {userappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; OnlyBelowVersion: 0,6 +Source: ..\staging\emule\config\Multiuser eMule.tmpl; DestDir: {userappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; OnlyBelowVersion: 0,6 +Source: ..\staging\emule\config\eMule.tmpl; DestDir: {userappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; OnlyBelowVersion: 0,6 +Source: ..\staging\emule\config\startup.wav; DestDir: {userappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; OnlyBelowVersion: 0,6 +Source: ..\staging\emule\config\webservices.dat; DestDir: {userappdata}\eMule\config; Flags: ignoreversion; components: configfiles; tasks: userdata; OnlyBelowVersion: 0,6 +;Source: ..\staging\emule\config\server.met; DestDir: {userappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; tasks: userdata; OnlyBelowVersion: 0,6 +;Source: ..\staging\emule\config\addresses.dat; DestDir: {userappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; OnlyBelowVersion: 0,6 +Source: ..\staging\emule\config\nodes.dat; DestDir: {commonappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; OnlyBelowVersion: 0,6 +;not needed, will automatically loaded on first start +;Source: ..\staging\emule\config\ip-to-country.csv; DestDir: {userappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; OnlyBelowVersion: 0,6 +;Source: ..\staging\emule\config\ipfilter.dat; DestDir: {userappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfilesipf; tasks: userdata; OnlyBelowVersion: 0,6 +Source: ..\staging\emule\config\staticservers.dat; DestDir: {userappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; OnlyBelowVersion: 0,6 + + +;mydocuments vista +Source: ..\staging\emule\config\AC_ServerMetURLs.dat; DestDir: {localappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; minversion: 0,6 +;Source: ..\staging\emule\config\AC_SearchStrings.dat; DestDir: {localappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; minversion: 0,6 +Source: ..\staging\emule\config\countryflag.dll; DestDir: {localappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; minversion: 0,6 +Source: ..\staging\emule\config\countryflag32.dll; DestDir: {localappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; minversion: 0,6 +Source: ..\staging\emule\config\eMule Light.tmpl; DestDir: {localappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; minversion: 0,6 +Source: ..\staging\emule\config\Multiuser eMule.tmpl; DestDir: {localappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; minversion: 0,6 +Source: ..\staging\emule\config\eMule.tmpl; DestDir: {localappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; minversion: 0,6 +Source: ..\staging\emule\config\startup.wav; DestDir: {localappdata}\eMule\config; Flags: ignoreversion; tasks: userdata; minversion: 0,6 +Source: ..\staging\emule\config\webservices.dat; DestDir: {localappdata}\eMule\config; Flags: ignoreversion; components: configfiles; tasks: userdata; minversion: 0,6 +;Source: ..\staging\emule\config\server.met; DestDir: {localappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; tasks: userdata; minversion: 0,6 +;Source: ..\staging\emule\config\addresses.dat; DestDir: {localappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; minversion: 0,6 +Source: ..\staging\emule\config\nodes.dat; DestDir: {localappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; minversion: 0,6 +;not needed, will automatically loaded on first start +;Source: ..\staging\emule\config\ip-to-country.csv; DestDir: {localappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; minversion: 0,6 +;Source: ..\staging\emule\config\ipfilter.dat; DestDir: {localappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfilesipf; tasks: userdata; minversion: 0,6 +Source: ..\staging\emule\config\staticservers.dat; DestDir: {localappdata}\eMule\config; Flags: ignoreversion onlyifdoesntexist; Permissions: users-modify; components: configfiles; tasks: userdata; minversion: 0,6 + + +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Components] +Name: Main; Description: {cm:corefiles}; Types: full compact custom; FLAGS: fixed +Name: helpfiles; Description: {cm:helpfile}; Types: full +Name: langs; Description: {cm:languagesupport}; Types: full +Name: shellextention; Description: {cm:shellextention}; Types: full +Name: configfiles; Description: {cm:configfiles}; Types: full +;Name: configfilesipf; Description: {cm:configfilesipf} +;Types: full Not because ipfilter is too old at current release speed +Name: tpartytools; Description: {cm:tparty}; Types: full +Name: tpartytools\mediainfo; Description: {cm:mediainfo}; Types: full +Name: tpartytools\unrar; Description: {cm:unrar}; Types: full + + +[Tasks] +; trick it here: since i connot find documentatuib how to set a check box programmatically from +; pascal script there are just 3 instances with a different check to set the default according +; to the current regististry (default is userdata on vista and above, prog dir on xp and below [like official]) +Name: progsdir; Description: {cm:progdir}; Check: UsePublicUserDirectories2; GroupDescription: {cm:locofdata}; Flags: exclusive +Name: commonapp; Description: {cm:appdir}; Check: UsePublicUserDirectories2; GroupDescription: {cm:locofdata}; Flags: exclusive unchecked; MinVersion: 0,6.0 +Name: userdata; Description: {cm:userdocdir}; Check: UsePublicUserDirectories2; GroupDescription: {cm:locofdata}; Flags: exclusive unchecked + +Name: progsdir; Description: {cm:progdir}; Check: UsePublicUserDirectories1; GroupDescription: {cm:locofdata}; Flags: exclusive unchecked +Name: commonapp; Description: {cm:appdir}; Check: UsePublicUserDirectories1; GroupDescription: {cm:locofdata}; Flags: exclusive; MinVersion: 0,6.0 +Name: userdata; Description: {cm:userdocdir}; Check: UsePublicUserDirectories1; GroupDescription: {cm:locofdata}; Flags: exclusive unchecked + +Name: progsdir; Description: {cm:progdir}; Check: UsePublicUserDirectories0; GroupDescription: {cm:locofdata}; Flags: exclusive unchecked +Name: commonapp; Description: {cm:appdir}; Check: UsePublicUserDirectories0; GroupDescription: {cm:locofdata}; Flags: exclusive unchecked; MinVersion: 0,6.0 +Name: userdata; Description: {cm:userdocdir}; Check: UsePublicUserDirectories0; GroupDescription: {cm:locofdata}; Flags: exclusive +;; - end trick with CHECK +Name: desktopicon; Description: {cm:CreateDesktopIcon}; flags: unchecked +Name: firewall; Description: {cm:tasks_firewall}; MinVersion: 0,5.01sp2 +Name: urlassoc; Description: {cm:tasks_assocurl}; GroupDescription: {cm:othertasks} + +[INI] +Filename: {app}\_eMule_Support__german_english.url; Section: InternetShortcut; Key: URL; String: http://www.emule-web.de/board +Filename: {app}\_eMule_Support__german_english.url; Section: InternetShortcut; Key: IconFile; String: http://www.emule-web.de/favicon.ico +Filename: {app}\_eMule-MODs__Infos_Ratings_Downloads.url; Section: InternetShortcut; Key: URL; String: http://www.emule-mods.de/ +Filename: {app}\_Fake_Free__Server-List_and_MET.url; Section: InternetShortcut; Key: URL; String: http://www.server-met.de/ +Filename: {app}\_get_updated_IP-Filter.url; Section: InternetShortcut; Key: URL; String: http://www.emule-mods.de/?mods=ipfilter +Filename: {app}\_get_updated_nodes-dat.url; Section: InternetShortcut; Key: URL; String: http://www.emule-mods.de/?mods=ipfilter +Filename: {app}\emulescarhome.url; Section: InternetShortcut; Key: URL; String: http://scarangel.sourceforge.net/ + +[Icons] +Name: {group}\eMule ScarAngel; Filename: {app}\emule.exe; Comment: eMule ScarAngel +Name: {group}\{cm:ProgramOnTheWeb,eMule ScarAngel}; Filename: {app}\emulescarhome.url +Name: {group}\eMule_Support__german_english; Filename: {app}\_eMule_Support__german_english.url +Name: {group}\eMule-MODs__Infos_Ratings_Downloads; Filename: {app}\_eMule-MODs__Infos_Ratings_Downloads.url +Name: {group}\Fake_Free__Server-List_and_MET; Filename: {app}\_Fake_Free__Server-List_and_MET.url +Name: {group}\get_updated_IP-Filter; Filename: {app}\_get_updated_IP-Filter.url +Name: {group}\get_updated_nodes-dat; Filename: {app}\_get_updated_nodes-dat.url +Name: {group}\{cm:UninstallProgram,eMule}; Filename: {uninstallexe} +Name: {group}\Shell extension doc; Filename: {app}\eMule Shell Extension.htm; components: shellextention +Name: {userdesktop}\eMule; Filename: {app}\emule.exe; Tasks: desktopicon + +[Registry] +Root: HKCR; Subkey: ed2k; ValueType: string; ValueData: URL:ed2k Protocol; Flags: uninsdeletekey; Tasks: urlassoc +Root: HKCR; Subkey: ed2k; ValueName: URL Protocol; ValueType: string; Flags: uninsdeletekey; Tasks: urlassoc +Root: HKCR; Subkey: ed2k\Shell; ValueType: string; Flags: uninsdeletekey; Tasks: urlassoc +Root: HKCR; Subkey: ed2k\Shell\open; ValueType: string; Flags: uninsdeletekey; Tasks: urlassoc +Root: HKCR; Subkey: ed2k\Shell\open\Command; ValueType: string; ValueData: "{app}\emule.exe ""%1"""; Flags: uninsdeletekey; Tasks: urlassoc + +Root: HKCR; Subkey: .emulecollection; ValueType: string; ValueName: ; ValueData: eMule; Flags: uninsdeletevalue; Tasks: urlassoc +Root: HKCR; Subkey: eMule; ValueType: string; ValueName: ; ValueData: eMule; Flags: uninsdeletekey; Tasks: urlassoc +Root: HKCR; Subkey: eMule\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\eMule.exe,1; Tasks: urlassoc +Root: HKCR; Subkey: eMule\shell\open\Command; ValueType: string; ValueData: "{app}\emule.exe ""%1"""; Flags: uninsdeletekey; Tasks: urlassoc +; shell extension uninstall: +Root: HKCR; Subkey: .met; ValueType: string; ValueName: ; ValueData: "metfile "; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: .part; ValueType: string; ValueName: ; ValueData: "partfile "; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: CLSID\{{5F081689-CE7D-43E7-8B11-DAD99A4A96D6}; ValueName: ; ValueData: eMule shell extension; ValueType: string; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: CLSID\{{5F081689-CE7D-43E7-8B11-DAD99A4A96D6}\InprocServer32; ValueName: ; ValueData: {app}\eMuleShellExt.dll; ValueType: string; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: CLSID\{{5F081689-CE7D-43E7-8B11-DAD99A4A96D6}\InprocServer32; ValueName: ThreadingModel; ValueData: Both; ValueType: string; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: metfile; ValueType: string; ValueName: Details; ValueData: "prop:DocTitle;Artist;Album;Duration;Bitrate;Write"; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: metfile; ValueType: string; ValueName: infoTip; ValueData: "prop:DocTitle;Artist;Album;Duration;Bitrate;Write"; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: metfile; ValueType: string; ValueName: Tileinfo; ValueData: "prop:DocTitle;Size"; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: metfile\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\eMuleShellExt.dll,-201; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: partfile\ShellEx\PropertyHandler; ValueType: string; ValueName: """"""; ValueData: {{5F081689-CE7D-43E7-8B11-DAD99A4A96D6}}; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: partfile; ValueType: string; ValueName: Details; ValueData: "prop:DocTitle;Artist;Album;Duration;Bitrate;Write"; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: partfile; ValueType: string; ValueName: infoTip; ValueData: "prop:DocTitle;Artist;Album;Duration;Bitrate;Write"; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: partfile; ValueType: string; ValueName: Tileinfo; ValueData: "prop:DocTitle;Size"; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: partfile\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\eMuleShellExt.dll,-202; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: partfile\ShellEx\PropertyHandler; ValueType: string; ValueName: """"""; ValueData: {{5F081689-CE7D-43E7-8B11-DAD99A4A96D6}; Flags: uninsdeletevalue; components: shellextention +Root: HKCR; Subkey: Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved; ValueType: string; ValueName: """{{5F081689-CE7D-43E7-8B11-DAD99A4A96D6}"""; ValueData: eMule shell extension; Flags: uninsdeletevalue; components: shellextention +; datadir + +Root: HKCU; Subkey: SOFTWARE\eMule; Flags: uninsdeletekey +;install correct value based on task: +Root: HKCU; Subkey: SOFTWARE\eMule; ValueType: dword; ValueName: UsePublicUserDirectories; ValueData: 002; Flags: uninsdeletekey; Tasks: progsdir +Root: HKCU; Subkey: SOFTWARE\eMule; ValueType: dword; ValueName: UsePublicUserDirectories; ValueData: 001; Flags: uninsdeletekey; Tasks: commonapp +Root: HKCU; Subkey: SOFTWARE\eMule; ValueType: dword; ValueName: UsePublicUserDirectories; ValueData: 000; Flags: uninsdeletekey; Tasks: userdata + +[Run] +Filename: {app}\emule.exe; Description: {cm:LaunchProgram,eMule}; Flags: nowait postinstall skipifsilent; OnlyBelowVersion: 0,6 +Filename: netsh; Parameters: "firewall add allowedprogram ""{app}\emule.exe"" ""eMule ScarAngel"" ENABLE"; flags: runminimized shellexec; Tasks: firewall; OnlyBelowVersion: 0,6 +Filename: netsh; Parameters: "advfirewall firewall add rule name=""eMule ScarAngel"" dir=in action=allow program=""{app}\emule.exe"" enable=yes description=""eMule ScarAngel inbound traffic"" profile=any"; flags: runminimized shellexec; Tasks: firewall; MinVersion: 0,6 +Filename: netsh; Parameters: "advfirewall firewall add rule name=""eMule ScarAngel"" dir=out action=allow program=""{app}\emule.exe"" enable=yes description=""eMule ScarAngel outbound traffic"" profile=any"; flags: runminimized shellexec; Tasks: firewall; MinVersion: 0,6 + +[UninstallRun] +Filename: {app}\emule.exe; Parameters: uninstall +Filename: netsh; Parameters: "firewall delete allowedprogram ""{app}\emule.exe"""; flags: runminimized shellexec; Tasks: firewall; OnlyBelowVersion: 0,6 +Filename: netsh; Parameters: "advfirewall firewall delete rule name=""eMule ScarAngel"" profile=any program=""{app}\emule.exe"""; flags: runminimized shellexec; Tasks: firewall; MinVersion: 0,6 + + +[UninstallDelete] +Type: files; Name: {app}\emulescarhome.url +Type: files; Name: {app}\_eMule_Support__german_english.url +Type: files; Name: {app}\_eMule-MODs__Infos_Ratings_Downloads.url +Type: files; Name: {app}\_Fake_Free__Server-List_and_MET.url +Type: files; Name: {app}\_get_updated_IP-Filter.url +Type: files; Name: {app}\_get_updated_nodes-dat.url +Type: files; Name: {app}\antiLeech.dll + +[CustomMessages] +; This section specifies phrazes and words not specified in the ISL files +; Avoid customizing the ISL files since they will change with each version of Inno Setup. +; English +;dutch.tasks_firewall=Voeg een uitzonderings regel toe aan de windows firewall. +;dutch.dialog_firewall=Setup heeft emule niet als uitzondering aan de Windows Firewall kunnen toevoegen .%nWellicht moet u dit nog handmatig doen. +;dutch.assocurl=eD2K links doorsturen naar eMule. + + +#include "english.isl" + +;translations in sepeate file now 10.1 + +#include "italian.isl" +#include "spanish.isl" +#include "german.isl" +#include "portugesebr.isl" +#include "french.isl" +;codepage: +#include "polish.isl" +;codepage: +#include "emulechinese.iss" +;codepage 950: +#include "cn_tw.isl" +;codepage: +#include "turkish.isl" + +; Code sections need to be the last section in a script or the compiler will get confused +[Code] +const + WM_CLOSE = $0010; + NET_FW_SCOPE_ALL = 0; + NET_FW_IP_VERSION_ANY = 2; +var + registrychecked: Boolean; + registrychecksuccessful: Boolean; + UsePublicUserDirectories: Cardinal; + Version: TWindowsVersion; + +Procedure ReadRegInternal() ; +begin + UsePublicUserDirectories:=-1; + if RegQueryDWordValue(HKEY_CURRENT_USER, 'SOFTWARE\eMule', + 'UsePublicUserDirectories',UsePublicUserDirectories) then begin + registrychecksuccessful:= true; + end + else + begin + registrychecksuccessful:= false; + end; + GetWindowsVersionEx(Version); + registrychecked:=true; +end; + +function UsePublicUserDirectories2(): Boolean; +begin + if not registrychecked then begin + ReadRegInternal() + end; + if UsePublicUserDirectories = 2 then + begin + Result:= true; + end + else + begin + if (not registrychecksuccessful) and (Version.Major < 6) then begin + Result:= true; + end + else + begin + Result:= False; + end + end +end; + +function UsePublicUserDirectories1(): Boolean; +begin + if not registrychecked then begin + ReadRegInternal() + end; + if UsePublicUserDirectories = 1 then + begin + Result:= true; + end + else + begin + Result:= False; + end +end; + +function UsePublicUserDirectories0(): Boolean; +begin + if not registrychecked then begin + ReadRegInternal() + end; + if UsePublicUserDirectories = 0 then + begin + Result:= true; + end + else + begin + if (not registrychecksuccessful) and (Version.Major >= 6) then begin + Result:= true; + end + else + begin + Result:= False; + end + end +end; + + + + + +Procedure CurStepChanged(CurStep: TSetupStep); +var + pref: string; + //Reset: boolean; +Begin + if CurStep=ssPostInstall then begin + if IsTaskSelected('progsdir') then + begin + pref := ExpandConstant('{app}\config\preferences.ini'); + end; + if IsTaskSelected('commonapp') then + begin + pref := ExpandConstant('{commonappdata}\eMule\config\preferences.ini'); + end; + if IsTaskSelected('userdata') then //; todo vista dir for userdata + begin + pref := ExpandConstant('{userappdata}\eMule\config\preferences.ini'); + end; + + if CompareText(activelanguage,'dutch')=0 then + if not IniKeyExists('eMule', 'Language', pref) then + begin + SetIniString('eMule', 'Language','1043',pref ); + end; + if CompareText(activelanguage,'german')=0 then + if not IniKeyExists('eMule', 'Language', pref) then + begin + SetIniString('eMule', 'Language','1031',pref ); + end; + if CompareText(activelanguage,'italian')=0 then + if not IniKeyExists('eMule', 'Language', pref) then + begin + SetIniString('eMule', 'Language','1040',pref ); + end; + if CompareText(activelanguage,'polish')=0 then + if not IniKeyExists('eMule', 'Language', pref) then + begin + SetIniString('eMule', 'Language','1045',pref ); + end; + if CompareText(activelanguage,'spanish')=0 then + if not IniKeyExists('eMule', 'Language', pref) then + begin + SetIniString('eMule', 'Language','1034',pref ); + end; + if CompareText(activelanguage,'french')=0 then + if not IniKeyExists('eMule', 'Language', pref) then + begin + SetIniString('eMule', 'Language','1036',pref ); + end; + if CompareText(activelanguage,'BrazilianPortuguese')=0 then + if not IniKeyExists('eMule', 'Language', pref) then + begin + SetIniString('eMule', 'Language','1046',pref ); + end; + if CompareText(activelanguage,'ChineseSimpl')=0 then + if not IniKeyExists('eMule', 'Language', pref) then + begin + SetIniString('eMule', 'Language','2052',pref ); + end; + // + if not IniKeyExists('eMule', 'SetSystemACP', pref) then + if not FileExists('{app}\known.met') then + begin + // for a new installion system uni code is recommended anyway: + SetIniString('eMule', 'SetSystemACP','0',pref ); + end; + end; + +// ;if CurStep=ssDone then Reset := ResetLanguages; +End; diff --git a/script/emulechinese.iss b/script/emulechinese.iss new file mode 100644 index 0000000..b6206b3 --- /dev/null +++ b/script/emulechinese.iss @@ -0,0 +1,20 @@ +;chinese strings edit in codepage +; save as codepage 936 (Not unicode or utf8!) + +ChineseSimpl.tasks_firewall=WindowsǽпŶ˿ +ChineseSimpl.dialog_firewall=װ޷WindowsǽΪeMuleŶ˿.%nֶŶ˿. +ChineseSimpl.shellextention=Ϊ.met.partļʾϢ +ChineseSimpl.othertasks= +ChineseSimpl.tasks_assocurl=ʹeMuleED2K +ChineseSimpl.configfilesipf=ļ(IP) +ChineseSimpl.configfiles=ļ(IPϢ) +ChineseSimpl.languagesupport=Ӣ֮ļ +ChineseSimpl.tparty= +ChineseSimpl.mediainfo=Mediainfo.dll ڴýļлȡļϢ +ChineseSimpl.unrar=Unrar.dll ijЩļ +ChineseSimpl.corefiles=ļ +ChineseSimpl.helpfile=ļ +ChineseSimpl.locofdata=ļλ +ChineseSimpl.progdir=ļļװĿ¼Ŀ¼(Ĭ) +ChineseSimpl.appdir=ļװϵͳApplication DataĿ¼ +ChineseSimpl.userdocdir=ļװûıĿ¼ \ No newline at end of file diff --git a/script/english.isl b/script/english.isl new file mode 100644 index 0000000..9b88db6 --- /dev/null +++ b/script/english.isl @@ -0,0 +1,20 @@ +;english text for inno setup installer (no prefix with english.code) + +tasks_firewall=Add an exception to the Windows Firewall +dialog_firewall=Setup failed to add eMule to the Windows Firewall.%nPlease add eMule to the exception list manually +shellextention=Install shell extention for .met and .part files +othertasks=Other tasks +tasks_assocurl=Registers eMule to take ed2k-Links and .emulecollection + +languagesupport=Language dll other than English +configfiles=Extra configuration files, IP-to-Country file +configfilesipf=Extra configuration files, IP-Filter +tparty=Tools from other projects +mediainfo=Mediainfo.dll to extract extra information from media files +unrar=Unrar.dll for certain downloads +corefiles=Required files +helpfile=Helpfiles +locofdata=Location of datafiles +progdir=Install configuration and data files into subdir of program +appdir=Install data files into common applications directory +userdocdir=Install data files into local user path diff --git a/script/french.isl b/script/french.isl new file mode 100644 index 0000000..1d3b9e3 --- /dev/null +++ b/script/french.isl @@ -0,0 +1,22 @@ +;save in local codepage, not utf8/unicode + +french.tasks_assocurl=Associer avec les liens Ed2k et .emulecollection. +french.tasks_firewall=Ajouter une exception dans le Pare-feu Windows +french.dialog_firewall=Impossible d'ajouter emule dans le firewall de windows.%nMerci d'ajouter emule dans la liste du firewall de windows. +french.shellextention=Installer shell extention pour les fichiers .met et .part files +french.othertasks=Autres tches + +french.languagesupport=DLL de langue autre que l'anglais +french.configfiles=Fichiers supplmentaires de configuration, fichiers IP-to-Country +french.configfilesipf=Fichiers supplmentaires de configuration, fichiers ipfilter +french.tparty=Outils d'autres projets +french.mediainfo=Mediainfo.dll pour extraire les informations supplmentaires des fichiers multimdia +french.unrar=Unrar.dll pour certains tlchargements. +french.corefiles=Fichiers indispensables. +french.helpfile=Fichiers d'aide. +french.locofdata=Localisation des fichiers de donnes +french.progdir=Fichiers d'installation et de configuration dans le sous-rpertoire programme +french.appdir=Installe les fichiers de donnes dans le rpertoire commun des applications +french.userdocdir=Installe les fichiers de donnes dans le rpertoire personnel de l'utilisateur + + diff --git a/script/german.isl b/script/german.isl new file mode 100644 index 0000000..6763efb --- /dev/null +++ b/script/german.isl @@ -0,0 +1,22 @@ +; save in local codepage, not utf8/unicode + +german.tasks_firewall=Eine Ausnahme fr Windows Firewall erstellen +german.dialog_firewall=Setup konnte keine Ausnamhe fr eMule in der Windows Firewall hinzufgen.%nBitte eMule manuell auf die Liste der Ausnahmen setzen. +german.tasks_assocurl=Ed2k-Links nehmen und .emulecollection +german.shellextention=Installiere Shell-Erweiterung fr .met und .part Dateien +german.othertasks=Andere Aufgaben + +german.languagesupport=Sprach DLLs (nicht Englisch) +german.configfiles=Zustzliche Konfigurationsdateien, IP-zu-Land Dateien +german.configfilesipf=Zustzliche Konfigurationsdateien, IP-Filter +german.tparty=Werkzeuge von anderen Projekten +german.mediainfo=Mediainfo.dll um Extrainformationen aus Mediendateien zu extrahieren +german.unrar=Unrar.dll fr bestimmte Downaloads +german.corefiles=Bentigte Dateien +german.helpfile=Hilfedateien +german.locofdata=Ort fr Dateien +german.progdir=Installiere Konfiguration und Dateien in Unterordner von Programme +german.appdir=Installiere Dateien in typisches Programmverzeichnis +german.userdocdir=Installiere Dateien in Lokalen Nutzer Ordner + + diff --git a/script/italian.isl b/script/italian.isl new file mode 100644 index 0000000..c5e8d4b --- /dev/null +++ b/script/italian.isl @@ -0,0 +1,20 @@ +; NOT UTF8/unicode.. + +italian.tasks_firewall=Aggiungi un'eccezione nel Firewall di Windows +italian.dialog_firewall=Il Setup non riuscito ad aggiungere eMule nel Firewall di Windows.%nAggiungere manualmente eMule nella lista delle eccezioni. +italian.shellextention=Installa un'estensione nella shell per i File .met e .part +italian.tasks_assocurl=Registra eMule per prendere i Link ed2k e .emulecollection +italian.languagesupport=Altre lingue (.dll) oltre all'inglese +italian.configfiles=File di configurazione, IPtoCountry +italian.configfilesipf=File di configurazione, IPFilter +italian.tparty=Strumenti da altri progetti +italian.mediainfo=Mediainfo.dll per estrapolare informazioni extra dai File multimediali +italian.unrar=Unrar.dll utile per alcuni Download +italian.corefiles=File Necessari +italian.helpfile=File della Guida +italian.locofdata=Posizione dei File dati +italian.progdir=Installa i File di configurazione e i File dati in una sottocartella del programma +italian.appdir=Installa i File dati nella cartella dei File condivisi +italian.userdocdir=Installa i File dati nella cartella principale dei File utente +italian.othertasks=Altri strumenti + diff --git a/script/polish.isl b/script/polish.isl new file mode 100644 index 0000000..13f6972 --- /dev/null +++ b/script/polish.isl @@ -0,0 +1,25 @@ +; poslh translation for installer +; use codepage 1250 to edit (not utf8 or unicode) + +polish.languagesupport=Pliki dla jzykw innych ni angielski +polish.configfiles=Dodatkowy plik ustawie, oraz IPtoCountry +polish.configfilesipf=Dodatkowy plik ustawie, oraz IPfilter +polish.tparty=Narzdzia z innych projektw +polish.mediainfo=Mediainfo.dll dla uzyskania dodatkowych informacji o plikach multimedialnych +polish.unrar=Unrar.dll dla pewnego pobierania +polish.corefiles=Wymagane pliki +polish.helpfile=Pliki pomocy +polish.locofdata=Miejsce dla plikw danych +polish.progdir=Zainstaluj konfiguracje i pliki danych do podkatalogu programu +polish.appdir=Zainstaluj pliki danych do katalogu wsplnego dla wszystkich aplikacji +polish.othertasks=Inne zadania +polish.userdocdir=Zainstaluj pliki danych do lokalnego domowego katalogu uytkownika + +polish.tasks_firewall=Dodaj do wyjtkw Zapory Systemu Windows +polish.dialog_firewall=Nie udao sie doda eMule do wyjtkw Zapory Systemu Windows.% Zatem wykonaj to rcznie! +polish.shellextention=Zainstaluj warstwe rozszerzenia dla plikw .met i .part. +polish.tasks_assocurl=Skojarz eMule z linkami ed2k i plikami .emulecollection. + + + + diff --git a/script/portugesebr.isl b/script/portugesebr.isl new file mode 100644 index 0000000..99af30b --- /dev/null +++ b/script/portugesebr.isl @@ -0,0 +1,21 @@ +;save in local codepage, not utf8/unicode + +BrazilianPortuguese.shellextention=Instalar a extenso shell para os ficheiros .met e .part +BrazilianPortuguese.othertasks=Outras tarefas +BrazilianPortuguese.tasks_firewall=Adiciona uma exceo ao Firewall do Windows +BrazilianPortuguese.dialog_firewall=O Setup falhou ao adicionar o eMule ao Firewall do Windows.%nPor favor adicione o eMule na lista de excees manualmente. +BrazilianPortuguese.tasks_assocurl=Registrar eMule para pegar links ed2k e arquivos .emulecollection + +BrazilianPortuguese.languagesupport=Suporte a lnguas alm do Ingls +BrazilianPortuguese.configfiles=Arquivos de configurao extras, IP-para-pas +BrazilianPortuguese.configfilesipf=Arquivos de configurao extras, Filtro-de-IP +BrazilianPortuguese.tparty=Ferramentas de outros projetos +BrazilianPortuguese.mediainfo=Mediainfo.dll para extrair informaes de arquivos de mdia +BrazilianPortuguese.unrar=Unrar.dll para certos downloads +BrazilianPortuguese.corefiles=Arquivos Essenciais +BrazilianPortuguese.helpfile=Arquivos de ajuda +BrazilianPortuguese.locofdata=Local dos arquivos de dados +BrazilianPortuguese.progdir=Instalar arquivos de configurao e dados dentro da subpasta do programa +BrazilianPortuguese.appdir=Instalar arquivos de dados na pasta comum de aplicativos +BrazilianPortuguese.userdocdir=Instalar arquivos de dados na pasta home do usurio + diff --git a/script/spanish.isl b/script/spanish.isl new file mode 100644 index 0000000..a368b27 --- /dev/null +++ b/script/spanish.isl @@ -0,0 +1,20 @@ +;save in local codepage (not utf8/unicode) + +spanish.tasks_firewall=Aadir una excepcin al Cortafuegos de Windows +spanish.dialog_firewall=No se pudo aadir eMule al Cortafuegos de Windows. Aada el eMule a la lista del cortafuegos manualmente +spanish.tasks_assocurl=Capturar enlaces eD2K y .emulecollection +spanish.othertasks=Otras tareas +spanish.shellextention=Los archivos con extensiones .met y .part, estarn en el ncleo del sistema + +spanish.languagesupport=Archivos dll de idiomas extra aparte de Ingls +spanish.configfiles=Archivos de configuracin extra, archivos IPtoCountry +spanish.configfilesipf=Archivos de configuracin extra, archivos IPFilter +spanish.tparty=Herramientas de otros proyectos +spanish.mediainfo=Mediainfo.dll para extraer informacin extra de los archivos multimedia +spanish.unrar=Unrar.dll para ciertas descargas +spanish.corefiles=Archivos necesarios +spanish.helpfile=Archivos de ayuda +spanish.locofdata=Localizacin de los archivos de datos +spanish.progdir=Instalar los archivos de la configuracin y de datos en el subdirectorio del programa +spanish.appdir=Instalar los archivos de datos del programa en el directorio comn a las aplicaciones +spanish.userdocdir=Instalar los archivos de datos en un directorio local del usuario actual \ No newline at end of file diff --git a/script/turkish.isl b/script/turkish.isl new file mode 100644 index 0000000..f5a6dd3 --- /dev/null +++ b/script/turkish.isl @@ -0,0 +1,18 @@ +; save in local codepage, not utf8/unicode + +turkish.tasks_firewall=Windows Gvenlik Duvarna kural ekle +turkish.dialog_firewall=Kur Windows Gvenlik Duvarna eMule'u ekleyemedi.%nLtfen eMule'u el ile listeye eklemeyi deneyiniz. +turkish.shellextention=.met ve .part dosyalar iin shell eklentisi ykle +turkish.tasks_assocurl=.emulecollection ve ed2k-balantlarn alabilmesi iin eMule'u kayt defterine kaydet +turkish.languagesupport=ngilizce haricindeki dil dll dosyalar +turkish.configfiles=Fazladan yaplandrma dosyalar, ipszgeci ve iptocountry dosyalar +turkish.configfilesipf=Fazladan yaplandrma dosyalar, IPSzgeci +turkish.tparty=Dier proje aralar +turkish.mediainfo=oklu ortam dosyalar hakknda ilave bilgi kartabilmek iin Mediainfo.dll +turkish.unrar=Baz indirmeler iin gerekli Unrar.dll +turkish.corefiles=Gerekli program dosyalar +turkish.helpfile=Yardm dosyalar +turkish.locofdata=Veri dosyalarnn konumu +turkish.progdir=Yaplandrma ve veri dosyalarn program dizininde ykle (varsaylan) +turkish.appdir=Yaplandrma ve veri dosyalarn ortak uygulamalar dizinine ykle +turkish.userdocdir=Yaplandrma ve veri dosyalarn kullanc hesab profil dizinine ykle diff --git a/3DPreviewControl.cpp b/srchybrid/3DPreviewControl.cpp similarity index 100% rename from 3DPreviewControl.cpp rename to srchybrid/3DPreviewControl.cpp diff --git a/3DPreviewControl.h b/srchybrid/3DPreviewControl.h similarity index 100% rename from 3DPreviewControl.h rename to srchybrid/3DPreviewControl.h diff --git a/AICHSyncThread.cpp b/srchybrid/AICHSyncThread.cpp similarity index 100% rename from AICHSyncThread.cpp rename to srchybrid/AICHSyncThread.cpp diff --git a/AICHSyncThread.h b/srchybrid/AICHSyncThread.h similarity index 100% rename from AICHSyncThread.h rename to srchybrid/AICHSyncThread.h diff --git a/ATLServer/License.txt b/srchybrid/ATLServer/License.txt similarity index 100% rename from ATLServer/License.txt rename to srchybrid/ATLServer/License.txt diff --git a/ATLServer/include/atlcache.h b/srchybrid/ATLServer/include/atlcache.h similarity index 100% rename from ATLServer/include/atlcache.h rename to srchybrid/ATLServer/include/atlcache.h diff --git a/ATLServer/include/atlcrypt.h b/srchybrid/ATLServer/include/atlcrypt.h similarity index 100% rename from ATLServer/include/atlcrypt.h rename to srchybrid/ATLServer/include/atlcrypt.h diff --git a/ATLServer/include/atlcrypt.inl b/srchybrid/ATLServer/include/atlcrypt.inl similarity index 100% rename from ATLServer/include/atlcrypt.inl rename to srchybrid/ATLServer/include/atlcrypt.inl diff --git a/ATLServer/include/atlextmgmt.h b/srchybrid/ATLServer/include/atlextmgmt.h similarity index 100% rename from ATLServer/include/atlextmgmt.h rename to srchybrid/ATLServer/include/atlextmgmt.h diff --git a/ATLServer/include/atlhtml.h b/srchybrid/ATLServer/include/atlhtml.h similarity index 100% rename from ATLServer/include/atlhtml.h rename to srchybrid/ATLServer/include/atlhtml.h diff --git a/ATLServer/include/atlhttp.h b/srchybrid/ATLServer/include/atlhttp.h similarity index 100% rename from ATLServer/include/atlhttp.h rename to srchybrid/ATLServer/include/atlhttp.h diff --git a/ATLServer/include/atlhttp.inl b/srchybrid/ATLServer/include/atlhttp.inl similarity index 100% rename from ATLServer/include/atlhttp.inl rename to srchybrid/ATLServer/include/atlhttp.inl diff --git a/ATLServer/include/atlisapi.h b/srchybrid/ATLServer/include/atlisapi.h similarity index 100% rename from ATLServer/include/atlisapi.h rename to srchybrid/ATLServer/include/atlisapi.h diff --git a/ATLServer/include/atlmime.h b/srchybrid/ATLServer/include/atlmime.h similarity index 100% rename from ATLServer/include/atlmime.h rename to srchybrid/ATLServer/include/atlmime.h diff --git a/ATLServer/include/atlperf.h b/srchybrid/ATLServer/include/atlperf.h similarity index 100% rename from ATLServer/include/atlperf.h rename to srchybrid/ATLServer/include/atlperf.h diff --git a/ATLServer/include/atlperf.inl b/srchybrid/ATLServer/include/atlperf.inl similarity index 100% rename from ATLServer/include/atlperf.inl rename to srchybrid/ATLServer/include/atlperf.inl diff --git a/ATLServer/include/atlrx.h b/srchybrid/ATLServer/include/atlrx.h similarity index 100% rename from ATLServer/include/atlrx.h rename to srchybrid/ATLServer/include/atlrx.h diff --git a/ATLServer/include/atlserr.h b/srchybrid/ATLServer/include/atlserr.h similarity index 100% rename from ATLServer/include/atlserr.h rename to srchybrid/ATLServer/include/atlserr.h diff --git a/ATLServer/include/atlsession.h b/srchybrid/ATLServer/include/atlsession.h similarity index 100% rename from ATLServer/include/atlsession.h rename to srchybrid/ATLServer/include/atlsession.h diff --git a/ATLServer/include/atlsharedsvc.h b/srchybrid/ATLServer/include/atlsharedsvc.h similarity index 100% rename from ATLServer/include/atlsharedsvc.h rename to srchybrid/ATLServer/include/atlsharedsvc.h diff --git a/ATLServer/include/atlsiface.h b/srchybrid/ATLServer/include/atlsiface.h similarity index 100% rename from ATLServer/include/atlsiface.h rename to srchybrid/ATLServer/include/atlsiface.h diff --git a/ATLServer/include/atlsmtpconnection.h b/srchybrid/ATLServer/include/atlsmtpconnection.h similarity index 100% rename from ATLServer/include/atlsmtpconnection.h rename to srchybrid/ATLServer/include/atlsmtpconnection.h diff --git a/ATLServer/include/atlsmtputil.h b/srchybrid/ATLServer/include/atlsmtputil.h similarity index 100% rename from ATLServer/include/atlsmtputil.h rename to srchybrid/ATLServer/include/atlsmtputil.h diff --git a/ATLServer/include/atlsoap.h b/srchybrid/ATLServer/include/atlsoap.h similarity index 100% rename from ATLServer/include/atlsoap.h rename to srchybrid/ATLServer/include/atlsoap.h diff --git a/ATLServer/include/atlspriv.h b/srchybrid/ATLServer/include/atlspriv.h similarity index 100% rename from ATLServer/include/atlspriv.h rename to srchybrid/ATLServer/include/atlspriv.h diff --git a/ATLServer/include/atlspriv.inl b/srchybrid/ATLServer/include/atlspriv.inl similarity index 100% rename from ATLServer/include/atlspriv.inl rename to srchybrid/ATLServer/include/atlspriv.inl diff --git a/ATLServer/include/atlsrv.rc b/srchybrid/ATLServer/include/atlsrv.rc similarity index 100% rename from ATLServer/include/atlsrv.rc rename to srchybrid/ATLServer/include/atlsrv.rc diff --git a/ATLServer/include/atlsrvres.h b/srchybrid/ATLServer/include/atlsrvres.h similarity index 100% rename from ATLServer/include/atlsrvres.h rename to srchybrid/ATLServer/include/atlsrvres.h diff --git a/ATLServer/include/atlstencil.h b/srchybrid/ATLServer/include/atlstencil.h similarity index 100% rename from ATLServer/include/atlstencil.h rename to srchybrid/ATLServer/include/atlstencil.h diff --git a/ATLServer/include/l.chs/atlsrv.rc b/srchybrid/ATLServer/include/l.chs/atlsrv.rc similarity index 100% rename from ATLServer/include/l.chs/atlsrv.rc rename to srchybrid/ATLServer/include/l.chs/atlsrv.rc diff --git a/ATLServer/include/l.cht/atlsrv.rc b/srchybrid/ATLServer/include/l.cht/atlsrv.rc similarity index 100% rename from ATLServer/include/l.cht/atlsrv.rc rename to srchybrid/ATLServer/include/l.cht/atlsrv.rc diff --git a/ATLServer/include/l.deu/atlsrv.rc b/srchybrid/ATLServer/include/l.deu/atlsrv.rc similarity index 100% rename from ATLServer/include/l.deu/atlsrv.rc rename to srchybrid/ATLServer/include/l.deu/atlsrv.rc diff --git a/ATLServer/include/l.esp/atlsrv.rc b/srchybrid/ATLServer/include/l.esp/atlsrv.rc similarity index 100% rename from ATLServer/include/l.esp/atlsrv.rc rename to srchybrid/ATLServer/include/l.esp/atlsrv.rc diff --git a/ATLServer/include/l.fra/atlsrv.rc b/srchybrid/ATLServer/include/l.fra/atlsrv.rc similarity index 100% rename from ATLServer/include/l.fra/atlsrv.rc rename to srchybrid/ATLServer/include/l.fra/atlsrv.rc diff --git a/ATLServer/include/l.ita/atlsrv.rc b/srchybrid/ATLServer/include/l.ita/atlsrv.rc similarity index 100% rename from ATLServer/include/l.ita/atlsrv.rc rename to srchybrid/ATLServer/include/l.ita/atlsrv.rc diff --git a/ATLServer/include/l.jpn/atlsrv.rc b/srchybrid/ATLServer/include/l.jpn/atlsrv.rc similarity index 100% rename from ATLServer/include/l.jpn/atlsrv.rc rename to srchybrid/ATLServer/include/l.jpn/atlsrv.rc diff --git a/ATLServer/include/l.kor/atlsrv.rc b/srchybrid/ATLServer/include/l.kor/atlsrv.rc similarity index 100% rename from ATLServer/include/l.kor/atlsrv.rc rename to srchybrid/ATLServer/include/l.kor/atlsrv.rc diff --git a/ATLServer/include/res/dllmgr.srf b/srchybrid/ATLServer/include/res/dllmgr.srf similarity index 100% rename from ATLServer/include/res/dllmgr.srf rename to srchybrid/ATLServer/include/res/dllmgr.srf diff --git a/ATLServer/include/res/stencilmgr.srf b/srchybrid/ATLServer/include/res/stencilmgr.srf similarity index 100% rename from ATLServer/include/res/stencilmgr.srf rename to srchybrid/ATLServer/include/res/stencilmgr.srf diff --git a/ATLServer/include/res/threadmgr.srf b/srchybrid/ATLServer/include/res/threadmgr.srf similarity index 100% rename from ATLServer/include/res/threadmgr.srf rename to srchybrid/ATLServer/include/res/threadmgr.srf diff --git a/ATLServer/source/CLStencil/ReadMe.htm b/srchybrid/ATLServer/source/CLStencil/ReadMe.htm similarity index 100% rename from ATLServer/source/CLStencil/ReadMe.htm rename to srchybrid/ATLServer/source/CLStencil/ReadMe.htm diff --git a/ATLServer/source/CLStencil/StdAfx.cpp b/srchybrid/ATLServer/source/CLStencil/StdAfx.cpp similarity index 100% rename from ATLServer/source/CLStencil/StdAfx.cpp rename to srchybrid/ATLServer/source/CLStencil/StdAfx.cpp diff --git a/ATLServer/source/CLStencil/StdAfx.h b/srchybrid/ATLServer/source/CLStencil/StdAfx.h similarity index 100% rename from ATLServer/source/CLStencil/StdAfx.h rename to srchybrid/ATLServer/source/CLStencil/StdAfx.h diff --git a/ATLServer/source/CLStencil/clstencil.cpp b/srchybrid/ATLServer/source/CLStencil/clstencil.cpp similarity index 100% rename from ATLServer/source/CLStencil/clstencil.cpp rename to srchybrid/ATLServer/source/CLStencil/clstencil.cpp diff --git a/ATLServer/source/CLStencil/clstencil.h b/srchybrid/ATLServer/source/CLStencil/clstencil.h similarity index 100% rename from ATLServer/source/CLStencil/clstencil.h rename to srchybrid/ATLServer/source/CLStencil/clstencil.h diff --git a/ATLServer/source/CLStencil/clstencil.rc b/srchybrid/ATLServer/source/CLStencil/clstencil.rc similarity index 100% rename from ATLServer/source/CLStencil/clstencil.rc rename to srchybrid/ATLServer/source/CLStencil/clstencil.rc diff --git a/ATLServer/source/CLStencil/clstencil.sln b/srchybrid/ATLServer/source/CLStencil/clstencil.sln similarity index 100% rename from ATLServer/source/CLStencil/clstencil.sln rename to srchybrid/ATLServer/source/CLStencil/clstencil.sln diff --git a/ATLServer/source/CLStencil/clstencil.vcproj b/srchybrid/ATLServer/source/CLStencil/clstencil.vcproj similarity index 100% rename from ATLServer/source/CLStencil/clstencil.vcproj rename to srchybrid/ATLServer/source/CLStencil/clstencil.vcproj diff --git a/ATLServer/source/CLStencil/clstencilui.mak b/srchybrid/ATLServer/source/CLStencil/clstencilui.mak similarity index 100% rename from ATLServer/source/CLStencil/clstencilui.mak rename to srchybrid/ATLServer/source/CLStencil/clstencilui.mak diff --git a/ATLServer/source/CLStencil/clstencilui.vcproj b/srchybrid/ATLServer/source/CLStencil/clstencilui.vcproj similarity index 100% rename from ATLServer/source/CLStencil/clstencilui.vcproj rename to srchybrid/ATLServer/source/CLStencil/clstencilui.vcproj diff --git a/ATLServer/source/CLStencil/resource.h b/srchybrid/ATLServer/source/CLStencil/resource.h similarity index 100% rename from ATLServer/source/CLStencil/resource.h rename to srchybrid/ATLServer/source/CLStencil/resource.h diff --git a/ATLServer/source/SProxy/Attribute.h b/srchybrid/ATLServer/source/SProxy/Attribute.h similarity index 100% rename from ATLServer/source/SProxy/Attribute.h rename to srchybrid/ATLServer/source/SProxy/Attribute.h diff --git a/ATLServer/source/SProxy/AttributeParser.cpp b/srchybrid/ATLServer/source/SProxy/AttributeParser.cpp similarity index 100% rename from ATLServer/source/SProxy/AttributeParser.cpp rename to srchybrid/ATLServer/source/SProxy/AttributeParser.cpp diff --git a/ATLServer/source/SProxy/AttributeParser.h b/srchybrid/ATLServer/source/SProxy/AttributeParser.h similarity index 100% rename from ATLServer/source/SProxy/AttributeParser.h rename to srchybrid/ATLServer/source/SProxy/AttributeParser.h diff --git a/ATLServer/source/SProxy/CodeTypeBuilder.cpp b/srchybrid/ATLServer/source/SProxy/CodeTypeBuilder.cpp similarity index 100% rename from ATLServer/source/SProxy/CodeTypeBuilder.cpp rename to srchybrid/ATLServer/source/SProxy/CodeTypeBuilder.cpp diff --git a/ATLServer/source/SProxy/CodeTypeBuilder.h b/srchybrid/ATLServer/source/SProxy/CodeTypeBuilder.h similarity index 100% rename from ATLServer/source/SProxy/CodeTypeBuilder.h rename to srchybrid/ATLServer/source/SProxy/CodeTypeBuilder.h diff --git a/ATLServer/source/SProxy/CodeTypes.h b/srchybrid/ATLServer/source/SProxy/CodeTypes.h similarity index 100% rename from ATLServer/source/SProxy/CodeTypes.h rename to srchybrid/ATLServer/source/SProxy/CodeTypes.h diff --git a/ATLServer/source/SProxy/ComplexType.cpp b/srchybrid/ATLServer/source/SProxy/ComplexType.cpp similarity index 100% rename from ATLServer/source/SProxy/ComplexType.cpp rename to srchybrid/ATLServer/source/SProxy/ComplexType.cpp diff --git a/ATLServer/source/SProxy/ComplexType.h b/srchybrid/ATLServer/source/SProxy/ComplexType.h similarity index 100% rename from ATLServer/source/SProxy/ComplexType.h rename to srchybrid/ATLServer/source/SProxy/ComplexType.h diff --git a/ATLServer/source/SProxy/ComplexTypeParser.cpp b/srchybrid/ATLServer/source/SProxy/ComplexTypeParser.cpp similarity index 100% rename from ATLServer/source/SProxy/ComplexTypeParser.cpp rename to srchybrid/ATLServer/source/SProxy/ComplexTypeParser.cpp diff --git a/ATLServer/source/SProxy/ComplexTypeParser.h b/srchybrid/ATLServer/source/SProxy/ComplexTypeParser.h similarity index 100% rename from ATLServer/source/SProxy/ComplexTypeParser.h rename to srchybrid/ATLServer/source/SProxy/ComplexTypeParser.h diff --git a/ATLServer/source/SProxy/Content.cpp b/srchybrid/ATLServer/source/SProxy/Content.cpp similarity index 100% rename from ATLServer/source/SProxy/Content.cpp rename to srchybrid/ATLServer/source/SProxy/Content.cpp diff --git a/ATLServer/source/SProxy/Content.h b/srchybrid/ATLServer/source/SProxy/Content.h similarity index 100% rename from ATLServer/source/SProxy/Content.h rename to srchybrid/ATLServer/source/SProxy/Content.h diff --git a/ATLServer/source/SProxy/ContentParser.cpp b/srchybrid/ATLServer/source/SProxy/ContentParser.cpp similarity index 100% rename from ATLServer/source/SProxy/ContentParser.cpp rename to srchybrid/ATLServer/source/SProxy/ContentParser.cpp diff --git a/ATLServer/source/SProxy/ContentParser.h b/srchybrid/ATLServer/source/SProxy/ContentParser.h similarity index 100% rename from ATLServer/source/SProxy/ContentParser.h rename to srchybrid/ATLServer/source/SProxy/ContentParser.h diff --git a/ATLServer/source/SProxy/CppCodeGenerator.cpp b/srchybrid/ATLServer/source/SProxy/CppCodeGenerator.cpp similarity index 100% rename from ATLServer/source/SProxy/CppCodeGenerator.cpp rename to srchybrid/ATLServer/source/SProxy/CppCodeGenerator.cpp diff --git a/ATLServer/source/SProxy/CppCodeGenerator.h b/srchybrid/ATLServer/source/SProxy/CppCodeGenerator.h similarity index 100% rename from ATLServer/source/SProxy/CppCodeGenerator.h rename to srchybrid/ATLServer/source/SProxy/CppCodeGenerator.h diff --git a/ATLServer/source/SProxy/CppKeywordTable.h b/srchybrid/ATLServer/source/SProxy/CppKeywordTable.h similarity index 100% rename from ATLServer/source/SProxy/CppKeywordTable.h rename to srchybrid/ATLServer/source/SProxy/CppKeywordTable.h diff --git a/ATLServer/source/SProxy/DiscoMapDocument.cpp b/srchybrid/ATLServer/source/SProxy/DiscoMapDocument.cpp similarity index 100% rename from ATLServer/source/SProxy/DiscoMapDocument.cpp rename to srchybrid/ATLServer/source/SProxy/DiscoMapDocument.cpp diff --git a/ATLServer/source/SProxy/DiscoMapDocument.h b/srchybrid/ATLServer/source/SProxy/DiscoMapDocument.h similarity index 100% rename from ATLServer/source/SProxy/DiscoMapDocument.h rename to srchybrid/ATLServer/source/SProxy/DiscoMapDocument.h diff --git a/ATLServer/source/SProxy/DiscoMapParser.cpp b/srchybrid/ATLServer/source/SProxy/DiscoMapParser.cpp similarity index 100% rename from ATLServer/source/SProxy/DiscoMapParser.cpp rename to srchybrid/ATLServer/source/SProxy/DiscoMapParser.cpp diff --git a/ATLServer/source/SProxy/DiscoMapParser.h b/srchybrid/ATLServer/source/SProxy/DiscoMapParser.h similarity index 100% rename from ATLServer/source/SProxy/DiscoMapParser.h rename to srchybrid/ATLServer/source/SProxy/DiscoMapParser.h diff --git a/ATLServer/source/SProxy/Element.cpp b/srchybrid/ATLServer/source/SProxy/Element.cpp similarity index 100% rename from ATLServer/source/SProxy/Element.cpp rename to srchybrid/ATLServer/source/SProxy/Element.cpp diff --git a/ATLServer/source/SProxy/Element.h b/srchybrid/ATLServer/source/SProxy/Element.h similarity index 100% rename from ATLServer/source/SProxy/Element.h rename to srchybrid/ATLServer/source/SProxy/Element.h diff --git a/ATLServer/source/SProxy/ElementParser.cpp b/srchybrid/ATLServer/source/SProxy/ElementParser.cpp similarity index 100% rename from ATLServer/source/SProxy/ElementParser.cpp rename to srchybrid/ATLServer/source/SProxy/ElementParser.cpp diff --git a/ATLServer/source/SProxy/ElementParser.h b/srchybrid/ATLServer/source/SProxy/ElementParser.h similarity index 100% rename from ATLServer/source/SProxy/ElementParser.h rename to srchybrid/ATLServer/source/SProxy/ElementParser.h diff --git a/ATLServer/source/SProxy/Emit.cpp b/srchybrid/ATLServer/source/SProxy/Emit.cpp similarity index 100% rename from ATLServer/source/SProxy/Emit.cpp rename to srchybrid/ATLServer/source/SProxy/Emit.cpp diff --git a/ATLServer/source/SProxy/Emit.h b/srchybrid/ATLServer/source/SProxy/Emit.h similarity index 100% rename from ATLServer/source/SProxy/Emit.h rename to srchybrid/ATLServer/source/SProxy/Emit.h diff --git a/ATLServer/source/SProxy/ErrorHandler.cpp b/srchybrid/ATLServer/source/SProxy/ErrorHandler.cpp similarity index 100% rename from ATLServer/source/SProxy/ErrorHandler.cpp rename to srchybrid/ATLServer/source/SProxy/ErrorHandler.cpp diff --git a/ATLServer/source/SProxy/ErrorHandler.h b/srchybrid/ATLServer/source/SProxy/ErrorHandler.h similarity index 100% rename from ATLServer/source/SProxy/ErrorHandler.h rename to srchybrid/ATLServer/source/SProxy/ErrorHandler.h diff --git a/ATLServer/source/SProxy/FacetMappingTable.h b/srchybrid/ATLServer/source/SProxy/FacetMappingTable.h similarity index 100% rename from ATLServer/source/SProxy/FacetMappingTable.h rename to srchybrid/ATLServer/source/SProxy/FacetMappingTable.h diff --git a/ATLServer/source/SProxy/Namespaces.h b/srchybrid/ATLServer/source/SProxy/Namespaces.h similarity index 100% rename from ATLServer/source/SProxy/Namespaces.h rename to srchybrid/ATLServer/source/SProxy/Namespaces.h diff --git a/ATLServer/source/SProxy/Parser.cpp b/srchybrid/ATLServer/source/SProxy/Parser.cpp similarity index 100% rename from ATLServer/source/SProxy/Parser.cpp rename to srchybrid/ATLServer/source/SProxy/Parser.cpp diff --git a/ATLServer/source/SProxy/Parser.h b/srchybrid/ATLServer/source/SProxy/Parser.h similarity index 100% rename from ATLServer/source/SProxy/Parser.h rename to srchybrid/ATLServer/source/SProxy/Parser.h diff --git a/ATLServer/source/SProxy/QName.cpp b/srchybrid/ATLServer/source/SProxy/QName.cpp similarity index 100% rename from ATLServer/source/SProxy/QName.cpp rename to srchybrid/ATLServer/source/SProxy/QName.cpp diff --git a/ATLServer/source/SProxy/QName.h b/srchybrid/ATLServer/source/SProxy/QName.h similarity index 100% rename from ATLServer/source/SProxy/QName.h rename to srchybrid/ATLServer/source/SProxy/QName.h diff --git a/ATLServer/source/SProxy/ReadMe.txt b/srchybrid/ATLServer/source/SProxy/ReadMe.txt similarity index 100% rename from ATLServer/source/SProxy/ReadMe.txt rename to srchybrid/ATLServer/source/SProxy/ReadMe.txt diff --git a/ATLServer/source/SProxy/Schema.cpp b/srchybrid/ATLServer/source/SProxy/Schema.cpp similarity index 100% rename from ATLServer/source/SProxy/Schema.cpp rename to srchybrid/ATLServer/source/SProxy/Schema.cpp diff --git a/ATLServer/source/SProxy/Schema.h b/srchybrid/ATLServer/source/SProxy/Schema.h similarity index 100% rename from ATLServer/source/SProxy/Schema.h rename to srchybrid/ATLServer/source/SProxy/Schema.h diff --git a/ATLServer/source/SProxy/SchemaDocument.h b/srchybrid/ATLServer/source/SProxy/SchemaDocument.h similarity index 100% rename from ATLServer/source/SProxy/SchemaDocument.h rename to srchybrid/ATLServer/source/SProxy/SchemaDocument.h diff --git a/ATLServer/source/SProxy/SchemaParser.cpp b/srchybrid/ATLServer/source/SProxy/SchemaParser.cpp similarity index 100% rename from ATLServer/source/SProxy/SchemaParser.cpp rename to srchybrid/ATLServer/source/SProxy/SchemaParser.cpp diff --git a/ATLServer/source/SProxy/SchemaParser.h b/srchybrid/ATLServer/source/SProxy/SchemaParser.h similarity index 100% rename from ATLServer/source/SProxy/SchemaParser.h rename to srchybrid/ATLServer/source/SProxy/SchemaParser.h diff --git a/ATLServer/source/SProxy/SimpleType.h b/srchybrid/ATLServer/source/SProxy/SimpleType.h similarity index 100% rename from ATLServer/source/SProxy/SimpleType.h rename to srchybrid/ATLServer/source/SProxy/SimpleType.h diff --git a/ATLServer/source/SProxy/SimpleTypeParser.cpp b/srchybrid/ATLServer/source/SProxy/SimpleTypeParser.cpp similarity index 100% rename from ATLServer/source/SProxy/SimpleTypeParser.cpp rename to srchybrid/ATLServer/source/SProxy/SimpleTypeParser.cpp diff --git a/ATLServer/source/SProxy/SimpleTypeParser.h b/srchybrid/ATLServer/source/SProxy/SimpleTypeParser.h similarity index 100% rename from ATLServer/source/SProxy/SimpleTypeParser.h rename to srchybrid/ATLServer/source/SProxy/SimpleTypeParser.h diff --git a/ATLServer/source/SProxy/SkipParser.h b/srchybrid/ATLServer/source/SProxy/SkipParser.h similarity index 100% rename from ATLServer/source/SProxy/SkipParser.h rename to srchybrid/ATLServer/source/SProxy/SkipParser.h diff --git a/ATLServer/source/SProxy/SproxyColl.h b/srchybrid/ATLServer/source/SProxy/SproxyColl.h similarity index 100% rename from ATLServer/source/SProxy/SproxyColl.h rename to srchybrid/ATLServer/source/SProxy/SproxyColl.h diff --git a/ATLServer/source/SProxy/SproxyError.h b/srchybrid/ATLServer/source/SProxy/SproxyError.h similarity index 100% rename from ATLServer/source/SProxy/SproxyError.h rename to srchybrid/ATLServer/source/SProxy/SproxyError.h diff --git a/ATLServer/source/SProxy/StdAfx.cpp b/srchybrid/ATLServer/source/SProxy/StdAfx.cpp similarity index 100% rename from ATLServer/source/SProxy/StdAfx.cpp rename to srchybrid/ATLServer/source/SProxy/StdAfx.cpp diff --git a/ATLServer/source/SProxy/StdAfx.h b/srchybrid/ATLServer/source/SProxy/StdAfx.h similarity index 100% rename from ATLServer/source/SProxy/StdAfx.h rename to srchybrid/ATLServer/source/SProxy/StdAfx.h diff --git a/ATLServer/source/SProxy/Util.cpp b/srchybrid/ATLServer/source/SProxy/Util.cpp similarity index 100% rename from ATLServer/source/SProxy/Util.cpp rename to srchybrid/ATLServer/source/SProxy/Util.cpp diff --git a/ATLServer/source/SProxy/Util.h b/srchybrid/ATLServer/source/SProxy/Util.h similarity index 100% rename from ATLServer/source/SProxy/Util.h rename to srchybrid/ATLServer/source/SProxy/Util.h diff --git a/ATLServer/source/SProxy/WSDLBinding.cpp b/srchybrid/ATLServer/source/SProxy/WSDLBinding.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLBinding.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLBinding.cpp diff --git a/ATLServer/source/SProxy/WSDLBinding.h b/srchybrid/ATLServer/source/SProxy/WSDLBinding.h similarity index 100% rename from ATLServer/source/SProxy/WSDLBinding.h rename to srchybrid/ATLServer/source/SProxy/WSDLBinding.h diff --git a/ATLServer/source/SProxy/WSDLBindingParser.cpp b/srchybrid/ATLServer/source/SProxy/WSDLBindingParser.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLBindingParser.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLBindingParser.cpp diff --git a/ATLServer/source/SProxy/WSDLBindingParser.h b/srchybrid/ATLServer/source/SProxy/WSDLBindingParser.h similarity index 100% rename from ATLServer/source/SProxy/WSDLBindingParser.h rename to srchybrid/ATLServer/source/SProxy/WSDLBindingParser.h diff --git a/ATLServer/source/SProxy/WSDLDocument.h b/srchybrid/ATLServer/source/SProxy/WSDLDocument.h similarity index 100% rename from ATLServer/source/SProxy/WSDLDocument.h rename to srchybrid/ATLServer/source/SProxy/WSDLDocument.h diff --git a/ATLServer/source/SProxy/WSDLMessage.h b/srchybrid/ATLServer/source/SProxy/WSDLMessage.h similarity index 100% rename from ATLServer/source/SProxy/WSDLMessage.h rename to srchybrid/ATLServer/source/SProxy/WSDLMessage.h diff --git a/ATLServer/source/SProxy/WSDLMessageParser.cpp b/srchybrid/ATLServer/source/SProxy/WSDLMessageParser.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLMessageParser.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLMessageParser.cpp diff --git a/ATLServer/source/SProxy/WSDLMessageParser.h b/srchybrid/ATLServer/source/SProxy/WSDLMessageParser.h similarity index 100% rename from ATLServer/source/SProxy/WSDLMessageParser.h rename to srchybrid/ATLServer/source/SProxy/WSDLMessageParser.h diff --git a/ATLServer/source/SProxy/WSDLMessagePart.cpp b/srchybrid/ATLServer/source/SProxy/WSDLMessagePart.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLMessagePart.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLMessagePart.cpp diff --git a/ATLServer/source/SProxy/WSDLMessagePart.h b/srchybrid/ATLServer/source/SProxy/WSDLMessagePart.h similarity index 100% rename from ATLServer/source/SProxy/WSDLMessagePart.h rename to srchybrid/ATLServer/source/SProxy/WSDLMessagePart.h diff --git a/ATLServer/source/SProxy/WSDLOperationIOParser.cpp b/srchybrid/ATLServer/source/SProxy/WSDLOperationIOParser.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLOperationIOParser.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLOperationIOParser.cpp diff --git a/ATLServer/source/SProxy/WSDLOperationIOParser.h b/srchybrid/ATLServer/source/SProxy/WSDLOperationIOParser.h similarity index 100% rename from ATLServer/source/SProxy/WSDLOperationIOParser.h rename to srchybrid/ATLServer/source/SProxy/WSDLOperationIOParser.h diff --git a/ATLServer/source/SProxy/WSDLOperationParser.cpp b/srchybrid/ATLServer/source/SProxy/WSDLOperationParser.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLOperationParser.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLOperationParser.cpp diff --git a/ATLServer/source/SProxy/WSDLOperationParser.h b/srchybrid/ATLServer/source/SProxy/WSDLOperationParser.h similarity index 100% rename from ATLServer/source/SProxy/WSDLOperationParser.h rename to srchybrid/ATLServer/source/SProxy/WSDLOperationParser.h diff --git a/ATLServer/source/SProxy/WSDLParser.cpp b/srchybrid/ATLServer/source/SProxy/WSDLParser.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLParser.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLParser.cpp diff --git a/ATLServer/source/SProxy/WSDLParser.h b/srchybrid/ATLServer/source/SProxy/WSDLParser.h similarity index 100% rename from ATLServer/source/SProxy/WSDLParser.h rename to srchybrid/ATLServer/source/SProxy/WSDLParser.h diff --git a/ATLServer/source/SProxy/WSDLPort.cpp b/srchybrid/ATLServer/source/SProxy/WSDLPort.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLPort.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLPort.cpp diff --git a/ATLServer/source/SProxy/WSDLPort.h b/srchybrid/ATLServer/source/SProxy/WSDLPort.h similarity index 100% rename from ATLServer/source/SProxy/WSDLPort.h rename to srchybrid/ATLServer/source/SProxy/WSDLPort.h diff --git a/ATLServer/source/SProxy/WSDLPortType.h b/srchybrid/ATLServer/source/SProxy/WSDLPortType.h similarity index 100% rename from ATLServer/source/SProxy/WSDLPortType.h rename to srchybrid/ATLServer/source/SProxy/WSDLPortType.h diff --git a/ATLServer/source/SProxy/WSDLPortTypeIO.cpp b/srchybrid/ATLServer/source/SProxy/WSDLPortTypeIO.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLPortTypeIO.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLPortTypeIO.cpp diff --git a/ATLServer/source/SProxy/WSDLPortTypeIO.h b/srchybrid/ATLServer/source/SProxy/WSDLPortTypeIO.h similarity index 100% rename from ATLServer/source/SProxy/WSDLPortTypeIO.h rename to srchybrid/ATLServer/source/SProxy/WSDLPortTypeIO.h diff --git a/ATLServer/source/SProxy/WSDLPortTypeOperation.h b/srchybrid/ATLServer/source/SProxy/WSDLPortTypeOperation.h similarity index 100% rename from ATLServer/source/SProxy/WSDLPortTypeOperation.h rename to srchybrid/ATLServer/source/SProxy/WSDLPortTypeOperation.h diff --git a/ATLServer/source/SProxy/WSDLPortTypeParser.cpp b/srchybrid/ATLServer/source/SProxy/WSDLPortTypeParser.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLPortTypeParser.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLPortTypeParser.cpp diff --git a/ATLServer/source/SProxy/WSDLPortTypeParser.h b/srchybrid/ATLServer/source/SProxy/WSDLPortTypeParser.h similarity index 100% rename from ATLServer/source/SProxy/WSDLPortTypeParser.h rename to srchybrid/ATLServer/source/SProxy/WSDLPortTypeParser.h diff --git a/ATLServer/source/SProxy/WSDLService.h b/srchybrid/ATLServer/source/SProxy/WSDLService.h similarity index 100% rename from ATLServer/source/SProxy/WSDLService.h rename to srchybrid/ATLServer/source/SProxy/WSDLService.h diff --git a/ATLServer/source/SProxy/WSDLServiceParser.cpp b/srchybrid/ATLServer/source/SProxy/WSDLServiceParser.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLServiceParser.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLServiceParser.cpp diff --git a/ATLServer/source/SProxy/WSDLServiceParser.h b/srchybrid/ATLServer/source/SProxy/WSDLServiceParser.h similarity index 100% rename from ATLServer/source/SProxy/WSDLServiceParser.h rename to srchybrid/ATLServer/source/SProxy/WSDLServiceParser.h diff --git a/ATLServer/source/SProxy/WSDLServicePortParser.cpp b/srchybrid/ATLServer/source/SProxy/WSDLServicePortParser.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLServicePortParser.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLServicePortParser.cpp diff --git a/ATLServer/source/SProxy/WSDLServicePortParser.h b/srchybrid/ATLServer/source/SProxy/WSDLServicePortParser.h similarity index 100% rename from ATLServer/source/SProxy/WSDLServicePortParser.h rename to srchybrid/ATLServer/source/SProxy/WSDLServicePortParser.h diff --git a/ATLServer/source/SProxy/WSDLSoapElement.cpp b/srchybrid/ATLServer/source/SProxy/WSDLSoapElement.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLSoapElement.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLSoapElement.cpp diff --git a/ATLServer/source/SProxy/WSDLSoapElement.h b/srchybrid/ATLServer/source/SProxy/WSDLSoapElement.h similarity index 100% rename from ATLServer/source/SProxy/WSDLSoapElement.h rename to srchybrid/ATLServer/source/SProxy/WSDLSoapElement.h diff --git a/ATLServer/source/SProxy/WSDLType.h b/srchybrid/ATLServer/source/SProxy/WSDLType.h similarity index 100% rename from ATLServer/source/SProxy/WSDLType.h rename to srchybrid/ATLServer/source/SProxy/WSDLType.h diff --git a/ATLServer/source/SProxy/WSDLTypesParser.cpp b/srchybrid/ATLServer/source/SProxy/WSDLTypesParser.cpp similarity index 100% rename from ATLServer/source/SProxy/WSDLTypesParser.cpp rename to srchybrid/ATLServer/source/SProxy/WSDLTypesParser.cpp diff --git a/ATLServer/source/SProxy/WSDLTypesParser.h b/srchybrid/ATLServer/source/SProxy/WSDLTypesParser.h similarity index 100% rename from ATLServer/source/SProxy/WSDLTypesParser.h rename to srchybrid/ATLServer/source/SProxy/WSDLTypesParser.h diff --git a/ATLServer/source/SProxy/XMLDocParser.cpp b/srchybrid/ATLServer/source/SProxy/XMLDocParser.cpp similarity index 100% rename from ATLServer/source/SProxy/XMLDocParser.cpp rename to srchybrid/ATLServer/source/SProxy/XMLDocParser.cpp diff --git a/ATLServer/source/SProxy/XMLDocParser.h b/srchybrid/ATLServer/source/SProxy/XMLDocParser.h similarity index 100% rename from ATLServer/source/SProxy/XMLDocParser.h rename to srchybrid/ATLServer/source/SProxy/XMLDocParser.h diff --git a/ATLServer/source/SProxy/XMLDocument.cpp b/srchybrid/ATLServer/source/SProxy/XMLDocument.cpp similarity index 100% rename from ATLServer/source/SProxy/XMLDocument.cpp rename to srchybrid/ATLServer/source/SProxy/XMLDocument.cpp diff --git a/ATLServer/source/SProxy/XMLDocument.h b/srchybrid/ATLServer/source/SProxy/XMLDocument.h similarity index 100% rename from ATLServer/source/SProxy/XMLDocument.h rename to srchybrid/ATLServer/source/SProxy/XMLDocument.h diff --git a/ATLServer/source/SProxy/XMLElement.cpp b/srchybrid/ATLServer/source/SProxy/XMLElement.cpp similarity index 100% rename from ATLServer/source/SProxy/XMLElement.cpp rename to srchybrid/ATLServer/source/SProxy/XMLElement.cpp diff --git a/ATLServer/source/SProxy/XMLElement.h b/srchybrid/ATLServer/source/SProxy/XMLElement.h similarity index 100% rename from ATLServer/source/SProxy/XMLElement.h rename to srchybrid/ATLServer/source/SProxy/XMLElement.h diff --git a/ATLServer/source/SProxy/XSDElement.h b/srchybrid/ATLServer/source/SProxy/XSDElement.h similarity index 100% rename from ATLServer/source/SProxy/XSDElement.h rename to srchybrid/ATLServer/source/SProxy/XSDElement.h diff --git a/ATLServer/source/SProxy/XSDMappingTable.h b/srchybrid/ATLServer/source/SProxy/XSDMappingTable.h similarity index 100% rename from ATLServer/source/SProxy/XSDMappingTable.h rename to srchybrid/ATLServer/source/SProxy/XSDMappingTable.h diff --git a/ATLServer/source/SProxy/cppkeywords.in b/srchybrid/ATLServer/source/SProxy/cppkeywords.in similarity index 100% rename from ATLServer/source/SProxy/cppkeywords.in rename to srchybrid/ATLServer/source/SProxy/cppkeywords.in diff --git a/ATLServer/source/SProxy/errordefs.h b/srchybrid/ATLServer/source/SProxy/errordefs.h similarity index 100% rename from ATLServer/source/SProxy/errordefs.h rename to srchybrid/ATLServer/source/SProxy/errordefs.h diff --git a/ATLServer/source/SProxy/facets.in b/srchybrid/ATLServer/source/SProxy/facets.in similarity index 100% rename from ATLServer/source/SProxy/facets.in rename to srchybrid/ATLServer/source/SProxy/facets.in diff --git a/ATLServer/source/SProxy/makefile b/srchybrid/ATLServer/source/SProxy/makefile similarity index 100% rename from ATLServer/source/SProxy/makefile rename to srchybrid/ATLServer/source/SProxy/makefile diff --git a/ATLServer/source/SProxy/makefile.inc b/srchybrid/ATLServer/source/SProxy/makefile.inc similarity index 100% rename from ATLServer/source/SProxy/makefile.inc rename to srchybrid/ATLServer/source/SProxy/makefile.inc diff --git a/ATLServer/source/SProxy/msxml2.h b/srchybrid/ATLServer/source/SProxy/msxml2.h similarity index 100% rename from ATLServer/source/SProxy/msxml2.h rename to srchybrid/ATLServer/source/SProxy/msxml2.h diff --git a/ATLServer/source/SProxy/resource.h b/srchybrid/ATLServer/source/SProxy/resource.h similarity index 100% rename from ATLServer/source/SProxy/resource.h rename to srchybrid/ATLServer/source/SProxy/resource.h diff --git a/ATLServer/source/SProxy/sources b/srchybrid/ATLServer/source/SProxy/sources similarity index 100% rename from ATLServer/source/SProxy/sources rename to srchybrid/ATLServer/source/SProxy/sources diff --git a/ATLServer/source/SProxy/sproxy.cpp b/srchybrid/ATLServer/source/SProxy/sproxy.cpp similarity index 100% rename from ATLServer/source/SProxy/sproxy.cpp rename to srchybrid/ATLServer/source/SProxy/sproxy.cpp diff --git a/ATLServer/source/SProxy/sproxy.mak b/srchybrid/ATLServer/source/SProxy/sproxy.mak similarity index 100% rename from ATLServer/source/SProxy/sproxy.mak rename to srchybrid/ATLServer/source/SProxy/sproxy.mak diff --git a/ATLServer/source/SProxy/sproxy.rc b/srchybrid/ATLServer/source/SProxy/sproxy.rc similarity index 100% rename from ATLServer/source/SProxy/sproxy.rc rename to srchybrid/ATLServer/source/SProxy/sproxy.rc diff --git a/ATLServer/source/SProxy/sproxy.sln b/srchybrid/ATLServer/source/SProxy/sproxy.sln similarity index 100% rename from ATLServer/source/SProxy/sproxy.sln rename to srchybrid/ATLServer/source/SProxy/sproxy.sln diff --git a/ATLServer/source/SProxy/sproxy.srf b/srchybrid/ATLServer/source/SProxy/sproxy.srf similarity index 100% rename from ATLServer/source/SProxy/sproxy.srf rename to srchybrid/ATLServer/source/SProxy/sproxy.srf diff --git a/ATLServer/source/SProxy/sproxy.vcproj b/srchybrid/ATLServer/source/SProxy/sproxy.vcproj similarity index 100% rename from ATLServer/source/SProxy/sproxy.vcproj rename to srchybrid/ATLServer/source/SProxy/sproxy.vcproj diff --git a/ATLServer/source/SProxy/utils/cppkw.c b/srchybrid/ATLServer/source/SProxy/utils/cppkw.c similarity index 100% rename from ATLServer/source/SProxy/utils/cppkw.c rename to srchybrid/ATLServer/source/SProxy/utils/cppkw.c diff --git a/ATLServer/source/SProxy/utils/mkutils.cmd b/srchybrid/ATLServer/source/SProxy/utils/mkutils.cmd similarity index 100% rename from ATLServer/source/SProxy/utils/mkutils.cmd rename to srchybrid/ATLServer/source/SProxy/utils/mkutils.cmd diff --git a/ATLServer/source/SProxy/utils/static_hash.c b/srchybrid/ATLServer/source/SProxy/utils/static_hash.c similarity index 100% rename from ATLServer/source/SProxy/utils/static_hash.c rename to srchybrid/ATLServer/source/SProxy/utils/static_hash.c diff --git a/ATLServer/source/SProxy/wsdl_rpc.srf b/srchybrid/ATLServer/source/SProxy/wsdl_rpc.srf similarity index 100% rename from ATLServer/source/SProxy/wsdl_rpc.srf rename to srchybrid/ATLServer/source/SProxy/wsdl_rpc.srf diff --git a/ATLServer/source/SProxy/xsdtypes.in b/srchybrid/ATLServer/source/SProxy/xsdtypes.in similarity index 100% rename from ATLServer/source/SProxy/xsdtypes.in rename to srchybrid/ATLServer/source/SProxy/xsdtypes.in diff --git a/ATLServer/source/VCDeploy/api.cpp b/srchybrid/ATLServer/source/VCDeploy/api.cpp similarity index 100% rename from ATLServer/source/VCDeploy/api.cpp rename to srchybrid/ATLServer/source/VCDeploy/api.cpp diff --git a/ATLServer/source/VCDeploy/api.h b/srchybrid/ATLServer/source/VCDeploy/api.h similarity index 100% rename from ATLServer/source/VCDeploy/api.h rename to srchybrid/ATLServer/source/VCDeploy/api.h diff --git a/ATLServer/source/VCDeploy/atlsdply.cpp b/srchybrid/ATLServer/source/VCDeploy/atlsdply.cpp similarity index 100% rename from ATLServer/source/VCDeploy/atlsdply.cpp rename to srchybrid/ATLServer/source/VCDeploy/atlsdply.cpp diff --git a/ATLServer/source/VCDeploy/atlsdply.rc b/srchybrid/ATLServer/source/VCDeploy/atlsdply.rc similarity index 100% rename from ATLServer/source/VCDeploy/atlsdply.rc rename to srchybrid/ATLServer/source/VCDeploy/atlsdply.rc diff --git a/ATLServer/source/VCDeploy/depsettings.cpp b/srchybrid/ATLServer/source/VCDeploy/depsettings.cpp similarity index 100% rename from ATLServer/source/VCDeploy/depsettings.cpp rename to srchybrid/ATLServer/source/VCDeploy/depsettings.cpp diff --git a/ATLServer/source/VCDeploy/depsettings.h b/srchybrid/ATLServer/source/VCDeploy/depsettings.h similarity index 100% rename from ATLServer/source/VCDeploy/depsettings.h rename to srchybrid/ATLServer/source/VCDeploy/depsettings.h diff --git a/ATLServer/source/VCDeploy/iiisext.h b/srchybrid/ATLServer/source/VCDeploy/iiisext.h similarity index 100% rename from ATLServer/source/VCDeploy/iiisext.h rename to srchybrid/ATLServer/source/VCDeploy/iiisext.h diff --git a/ATLServer/source/VCDeploy/resource.h b/srchybrid/ATLServer/source/VCDeploy/resource.h similarity index 100% rename from ATLServer/source/VCDeploy/resource.h rename to srchybrid/ATLServer/source/VCDeploy/resource.h diff --git a/ATLServer/source/VCDeploy/stdafx.cpp b/srchybrid/ATLServer/source/VCDeploy/stdafx.cpp similarity index 100% rename from ATLServer/source/VCDeploy/stdafx.cpp rename to srchybrid/ATLServer/source/VCDeploy/stdafx.cpp diff --git a/ATLServer/source/VCDeploy/stdafx.h b/srchybrid/ATLServer/source/VCDeploy/stdafx.h similarity index 100% rename from ATLServer/source/VCDeploy/stdafx.h rename to srchybrid/ATLServer/source/VCDeploy/stdafx.h diff --git a/ATLServer/source/VCDeploy/vcdeploy.sln b/srchybrid/ATLServer/source/VCDeploy/vcdeploy.sln similarity index 100% rename from ATLServer/source/VCDeploy/vcdeploy.sln rename to srchybrid/ATLServer/source/VCDeploy/vcdeploy.sln diff --git a/ATLServer/source/VCDeploy/vcdeploy.vcproj b/srchybrid/ATLServer/source/VCDeploy/vcdeploy.vcproj similarity index 100% rename from ATLServer/source/VCDeploy/vcdeploy.vcproj rename to srchybrid/ATLServer/source/VCDeploy/vcdeploy.vcproj diff --git a/AbstractFile.cpp b/srchybrid/AbstractFile.cpp similarity index 100% rename from AbstractFile.cpp rename to srchybrid/AbstractFile.cpp diff --git a/AbstractFile.h b/srchybrid/AbstractFile.h similarity index 100% rename from AbstractFile.h rename to srchybrid/AbstractFile.h diff --git a/AddFriend.cpp b/srchybrid/AddFriend.cpp similarity index 100% rename from AddFriend.cpp rename to srchybrid/AddFriend.cpp diff --git a/AddFriend.h b/srchybrid/AddFriend.h similarity index 100% rename from AddFriend.h rename to srchybrid/AddFriend.h diff --git a/AddSourceDlg.cpp b/srchybrid/AddSourceDlg.cpp similarity index 100% rename from AddSourceDlg.cpp rename to srchybrid/AddSourceDlg.cpp diff --git a/AddSourceDlg.h b/srchybrid/AddSourceDlg.h similarity index 100% rename from AddSourceDlg.h rename to srchybrid/AddSourceDlg.h diff --git a/AfxBeginMsgMapTemplate.h b/srchybrid/AfxBeginMsgMapTemplate.h similarity index 100% rename from AfxBeginMsgMapTemplate.h rename to srchybrid/AfxBeginMsgMapTemplate.h diff --git a/ArchivePreviewDlg.cpp b/srchybrid/ArchivePreviewDlg.cpp similarity index 100% rename from ArchivePreviewDlg.cpp rename to srchybrid/ArchivePreviewDlg.cpp diff --git a/ArchivePreviewDlg.h b/srchybrid/ArchivePreviewDlg.h similarity index 100% rename from ArchivePreviewDlg.h rename to srchybrid/ArchivePreviewDlg.h diff --git a/ArchiveRecovery.cpp b/srchybrid/ArchiveRecovery.cpp similarity index 100% rename from ArchiveRecovery.cpp rename to srchybrid/ArchiveRecovery.cpp diff --git a/ArchiveRecovery.h b/srchybrid/ArchiveRecovery.h similarity index 100% rename from ArchiveRecovery.h rename to srchybrid/ArchiveRecovery.h diff --git a/AskExitDlg.cpp b/srchybrid/AskExitDlg.cpp similarity index 100% rename from AskExitDlg.cpp rename to srchybrid/AskExitDlg.cpp diff --git a/AskExitDlg.h b/srchybrid/AskExitDlg.h similarity index 100% rename from AskExitDlg.h rename to srchybrid/AskExitDlg.h diff --git a/AsyncProxySocketLayer.cpp b/srchybrid/AsyncProxySocketLayer.cpp similarity index 100% rename from AsyncProxySocketLayer.cpp rename to srchybrid/AsyncProxySocketLayer.cpp diff --git a/AsyncProxySocketLayer.h b/srchybrid/AsyncProxySocketLayer.h similarity index 100% rename from AsyncProxySocketLayer.h rename to srchybrid/AsyncProxySocketLayer.h diff --git a/AsyncSocketEx.cpp b/srchybrid/AsyncSocketEx.cpp similarity index 100% rename from AsyncSocketEx.cpp rename to srchybrid/AsyncSocketEx.cpp diff --git a/AsyncSocketEx.h b/srchybrid/AsyncSocketEx.h similarity index 100% rename from AsyncSocketEx.h rename to srchybrid/AsyncSocketEx.h diff --git a/AsyncSocketExLayer.cpp b/srchybrid/AsyncSocketExLayer.cpp similarity index 100% rename from AsyncSocketExLayer.cpp rename to srchybrid/AsyncSocketExLayer.cpp diff --git a/AsyncSocketExLayer.h b/srchybrid/AsyncSocketExLayer.h similarity index 100% rename from AsyncSocketExLayer.h rename to srchybrid/AsyncSocketExLayer.h diff --git a/BandWidthControl.cpp b/srchybrid/BandWidthControl.cpp similarity index 100% rename from BandWidthControl.cpp rename to srchybrid/BandWidthControl.cpp diff --git a/BandWidthControl.h b/srchybrid/BandWidthControl.h similarity index 100% rename from BandWidthControl.h rename to srchybrid/BandWidthControl.h diff --git a/BarShader.cpp b/srchybrid/BarShader.cpp similarity index 100% rename from BarShader.cpp rename to srchybrid/BarShader.cpp diff --git a/BarShader.h b/srchybrid/BarShader.h similarity index 100% rename from BarShader.h rename to srchybrid/BarShader.h diff --git a/BaseClient.cpp b/srchybrid/BaseClient.cpp similarity index 100% rename from BaseClient.cpp rename to srchybrid/BaseClient.cpp diff --git a/BtnST.cpp b/srchybrid/BtnST.cpp similarity index 100% rename from BtnST.cpp rename to srchybrid/BtnST.cpp diff --git a/BtnST.h b/srchybrid/BtnST.h similarity index 100% rename from BtnST.h rename to srchybrid/BtnST.h diff --git a/BuddyButton.cpp b/srchybrid/BuddyButton.cpp similarity index 100% rename from BuddyButton.cpp rename to srchybrid/BuddyButton.cpp diff --git a/ButtonVE.cpp b/srchybrid/ButtonVE.cpp similarity index 100% rename from ButtonVE.cpp rename to srchybrid/ButtonVE.cpp diff --git a/ButtonVE.h b/srchybrid/ButtonVE.h similarity index 100% rename from ButtonVE.h rename to srchybrid/ButtonVE.h diff --git a/ButtonVE_Helper.h b/srchybrid/ButtonVE_Helper.h similarity index 100% rename from ButtonVE_Helper.h rename to srchybrid/ButtonVE_Helper.h diff --git a/ButtonsTabCtrl.cpp b/srchybrid/ButtonsTabCtrl.cpp similarity index 100% rename from ButtonsTabCtrl.cpp rename to srchybrid/ButtonsTabCtrl.cpp diff --git a/ButtonsTabCtrl.h b/srchybrid/ButtonsTabCtrl.h similarity index 100% rename from ButtonsTabCtrl.h rename to srchybrid/ButtonsTabCtrl.h diff --git a/CBase64Coding.cpp b/srchybrid/CBase64Coding.cpp similarity index 100% rename from CBase64Coding.cpp rename to srchybrid/CBase64Coding.cpp diff --git a/CBase64Coding.hpp b/srchybrid/CBase64Coding.hpp similarity index 100% rename from CBase64Coding.hpp rename to srchybrid/CBase64Coding.hpp diff --git a/CaptchaGenerator.cpp b/srchybrid/CaptchaGenerator.cpp similarity index 100% rename from CaptchaGenerator.cpp rename to srchybrid/CaptchaGenerator.cpp diff --git a/CaptchaGenerator.h b/srchybrid/CaptchaGenerator.h similarity index 100% rename from CaptchaGenerator.h rename to srchybrid/CaptchaGenerator.h diff --git a/CatDialog.cpp b/srchybrid/CatDialog.cpp similarity index 100% rename from CatDialog.cpp rename to srchybrid/CatDialog.cpp diff --git a/CatDialog.h b/srchybrid/CatDialog.h similarity index 100% rename from CatDialog.h rename to srchybrid/CatDialog.h diff --git a/ChatSelector.cpp b/srchybrid/ChatSelector.cpp similarity index 100% rename from ChatSelector.cpp rename to srchybrid/ChatSelector.cpp diff --git a/ChatSelector.h b/srchybrid/ChatSelector.h similarity index 100% rename from ChatSelector.h rename to srchybrid/ChatSelector.h diff --git a/ChatWnd.cpp b/srchybrid/ChatWnd.cpp similarity index 100% rename from ChatWnd.cpp rename to srchybrid/ChatWnd.cpp diff --git a/ChatWnd.h b/srchybrid/ChatWnd.h similarity index 100% rename from ChatWnd.h rename to srchybrid/ChatWnd.h diff --git a/ClientCredits.cpp b/srchybrid/ClientCredits.cpp similarity index 100% rename from ClientCredits.cpp rename to srchybrid/ClientCredits.cpp diff --git a/ClientCredits.h b/srchybrid/ClientCredits.h similarity index 100% rename from ClientCredits.h rename to srchybrid/ClientCredits.h diff --git a/ClientDetailDialog.cpp b/srchybrid/ClientDetailDialog.cpp similarity index 100% rename from ClientDetailDialog.cpp rename to srchybrid/ClientDetailDialog.cpp diff --git a/ClientDetailDialog.h b/srchybrid/ClientDetailDialog.h similarity index 100% rename from ClientDetailDialog.h rename to srchybrid/ClientDetailDialog.h diff --git a/ClientList.cpp b/srchybrid/ClientList.cpp similarity index 100% rename from ClientList.cpp rename to srchybrid/ClientList.cpp diff --git a/ClientList.h b/srchybrid/ClientList.h similarity index 97% rename from ClientList.h rename to srchybrid/ClientList.h index 293edc1..4ee5405 100644 --- a/ClientList.h +++ b/srchybrid/ClientList.h @@ -117,6 +117,10 @@ class CClientList CUpDownClient* FindClientByServerID(uint32 uServerIP, uint32 uUserID) const; CUpDownClient* FindClientByUserID_KadPort(uint32 clientID,uint16 kadPort) const; CUpDownClient* FindClientByIP_KadPort(uint32 ip, uint16 port) const; + + void FindHeadClient() { usedToFindByNumber = list.GetHeadPosition(); } + CUpDownClient* FindNextClient() { return list.GetNext(usedToFindByNumber); } + POSITION usedToFindByNumber; // Banned clients void AddBannedClient(uint32 dwIP); diff --git a/ClientListCtrl.cpp b/srchybrid/ClientListCtrl.cpp similarity index 100% rename from ClientListCtrl.cpp rename to srchybrid/ClientListCtrl.cpp diff --git a/ClientListCtrl.h b/srchybrid/ClientListCtrl.h similarity index 100% rename from ClientListCtrl.h rename to srchybrid/ClientListCtrl.h diff --git a/ClientStateDefs.h b/srchybrid/ClientStateDefs.h similarity index 100% rename from ClientStateDefs.h rename to srchybrid/ClientStateDefs.h diff --git a/ClientUDPSocket.cpp b/srchybrid/ClientUDPSocket.cpp similarity index 100% rename from ClientUDPSocket.cpp rename to srchybrid/ClientUDPSocket.cpp diff --git a/ClientUDPSocket.h b/srchybrid/ClientUDPSocket.h similarity index 100% rename from ClientUDPSocket.h rename to srchybrid/ClientUDPSocket.h diff --git a/ClientVersionInfo.h b/srchybrid/ClientVersionInfo.h similarity index 100% rename from ClientVersionInfo.h rename to srchybrid/ClientVersionInfo.h diff --git a/ClosableTabCtrl.cpp b/srchybrid/ClosableTabCtrl.cpp similarity index 100% rename from ClosableTabCtrl.cpp rename to srchybrid/ClosableTabCtrl.cpp diff --git a/ClosableTabCtrl.h b/srchybrid/ClosableTabCtrl.h similarity index 100% rename from ClosableTabCtrl.h rename to srchybrid/ClosableTabCtrl.h diff --git a/Collection.cpp b/srchybrid/Collection.cpp similarity index 100% rename from Collection.cpp rename to srchybrid/Collection.cpp diff --git a/Collection.h b/srchybrid/Collection.h similarity index 100% rename from Collection.h rename to srchybrid/Collection.h diff --git a/CollectionCreateDialog.cpp b/srchybrid/CollectionCreateDialog.cpp similarity index 100% rename from CollectionCreateDialog.cpp rename to srchybrid/CollectionCreateDialog.cpp diff --git a/CollectionCreateDialog.h b/srchybrid/CollectionCreateDialog.h similarity index 100% rename from CollectionCreateDialog.h rename to srchybrid/CollectionCreateDialog.h diff --git a/CollectionFile.cpp b/srchybrid/CollectionFile.cpp similarity index 100% rename from CollectionFile.cpp rename to srchybrid/CollectionFile.cpp diff --git a/CollectionFile.h b/srchybrid/CollectionFile.h similarity index 100% rename from CollectionFile.h rename to srchybrid/CollectionFile.h diff --git a/CollectionListCtrl.cpp b/srchybrid/CollectionListCtrl.cpp similarity index 100% rename from CollectionListCtrl.cpp rename to srchybrid/CollectionListCtrl.cpp diff --git a/CollectionListCtrl.h b/srchybrid/CollectionListCtrl.h similarity index 100% rename from CollectionListCtrl.h rename to srchybrid/CollectionListCtrl.h diff --git a/CollectionViewDialog.cpp b/srchybrid/CollectionViewDialog.cpp similarity index 100% rename from CollectionViewDialog.cpp rename to srchybrid/CollectionViewDialog.cpp diff --git a/CollectionViewDialog.h b/srchybrid/CollectionViewDialog.h similarity index 100% rename from CollectionViewDialog.h rename to srchybrid/CollectionViewDialog.h diff --git a/ColorButton.cpp b/srchybrid/ColorButton.cpp similarity index 100% rename from ColorButton.cpp rename to srchybrid/ColorButton.cpp diff --git a/ColorButton.h b/srchybrid/ColorButton.h similarity index 100% rename from ColorButton.h rename to srchybrid/ColorButton.h diff --git a/ColorFrameCtrl.cpp b/srchybrid/ColorFrameCtrl.cpp similarity index 100% rename from ColorFrameCtrl.cpp rename to srchybrid/ColorFrameCtrl.cpp diff --git a/ColorFrameCtrl.h b/srchybrid/ColorFrameCtrl.h similarity index 100% rename from ColorFrameCtrl.h rename to srchybrid/ColorFrameCtrl.h diff --git a/ColourPopup.cpp b/srchybrid/ColourPopup.cpp similarity index 100% rename from ColourPopup.cpp rename to srchybrid/ColourPopup.cpp diff --git a/ColourPopup.h b/srchybrid/ColourPopup.h similarity index 100% rename from ColourPopup.h rename to srchybrid/ColourPopup.h diff --git a/ComboBoxEx2.cpp b/srchybrid/ComboBoxEx2.cpp similarity index 100% rename from ComboBoxEx2.cpp rename to srchybrid/ComboBoxEx2.cpp diff --git a/ComboBoxEx2.h b/srchybrid/ComboBoxEx2.h similarity index 100% rename from ComboBoxEx2.h rename to srchybrid/ComboBoxEx2.h diff --git a/CommentDialog.cpp b/srchybrid/CommentDialog.cpp similarity index 100% rename from CommentDialog.cpp rename to srchybrid/CommentDialog.cpp diff --git a/CommentDialog.h b/srchybrid/CommentDialog.h similarity index 100% rename from CommentDialog.h rename to srchybrid/CommentDialog.h diff --git a/CommentDialogLst.cpp b/srchybrid/CommentDialogLst.cpp similarity index 100% rename from CommentDialogLst.cpp rename to srchybrid/CommentDialogLst.cpp diff --git a/CommentDialogLst.h b/srchybrid/CommentDialogLst.h similarity index 100% rename from CommentDialogLst.h rename to srchybrid/CommentDialogLst.h diff --git a/CommentListCtrl.cpp b/srchybrid/CommentListCtrl.cpp similarity index 100% rename from CommentListCtrl.cpp rename to srchybrid/CommentListCtrl.cpp diff --git a/CommentListCtrl.h b/srchybrid/CommentListCtrl.h similarity index 100% rename from CommentListCtrl.h rename to srchybrid/CommentListCtrl.h diff --git a/CorruptionBlackBox.cpp b/srchybrid/CorruptionBlackBox.cpp similarity index 100% rename from CorruptionBlackBox.cpp rename to srchybrid/CorruptionBlackBox.cpp diff --git a/CorruptionBlackBox.h b/srchybrid/CorruptionBlackBox.h similarity index 100% rename from CorruptionBlackBox.h rename to srchybrid/CorruptionBlackBox.h diff --git a/CreditsDlg.cpp b/srchybrid/CreditsDlg.cpp similarity index 100% rename from CreditsDlg.cpp rename to srchybrid/CreditsDlg.cpp diff --git a/CreditsDlg.h b/srchybrid/CreditsDlg.h similarity index 100% rename from CreditsDlg.h rename to srchybrid/CreditsDlg.h diff --git a/CreditsThread.cpp b/srchybrid/CreditsThread.cpp similarity index 100% rename from CreditsThread.cpp rename to srchybrid/CreditsThread.cpp diff --git a/CreditsThread.h b/srchybrid/CreditsThread.h similarity index 100% rename from CreditsThread.h rename to srchybrid/CreditsThread.h diff --git a/CustomAutoComplete.cpp b/srchybrid/CustomAutoComplete.cpp similarity index 100% rename from CustomAutoComplete.cpp rename to srchybrid/CustomAutoComplete.cpp diff --git a/CustomAutoComplete.h b/srchybrid/CustomAutoComplete.h similarity index 100% rename from CustomAutoComplete.h rename to srchybrid/CustomAutoComplete.h diff --git a/CxImage/cximage.dsp b/srchybrid/CxImage/cximage.dsp similarity index 100% rename from CxImage/cximage.dsp rename to srchybrid/CxImage/cximage.dsp diff --git a/CxImage/cximage.dsw b/srchybrid/CxImage/cximage.dsw similarity index 100% rename from CxImage/cximage.dsw rename to srchybrid/CxImage/cximage.dsw diff --git a/CxImage/cximage.sln b/srchybrid/CxImage/cximage.sln similarity index 100% rename from CxImage/cximage.sln rename to srchybrid/CxImage/cximage.sln diff --git a/CxImage/cximage.vcproj b/srchybrid/CxImage/cximage.vcproj similarity index 100% rename from CxImage/cximage.vcproj rename to srchybrid/CxImage/cximage.vcproj diff --git a/CxImage/cximage100.vcxproj b/srchybrid/CxImage/cximage100.vcxproj similarity index 100% rename from CxImage/cximage100.vcxproj rename to srchybrid/CxImage/cximage100.vcxproj diff --git a/CxImage/cximage100.vcxproj.filters b/srchybrid/CxImage/cximage100.vcxproj.filters similarity index 100% rename from CxImage/cximage100.vcxproj.filters rename to srchybrid/CxImage/cximage100.vcxproj.filters diff --git a/CxImage/cximage80.vcproj b/srchybrid/CxImage/cximage80.vcproj similarity index 100% rename from CxImage/cximage80.vcproj rename to srchybrid/CxImage/cximage80.vcproj diff --git a/CxImage/cximage90.vcproj b/srchybrid/CxImage/cximage90.vcproj similarity index 100% rename from CxImage/cximage90.vcproj rename to srchybrid/CxImage/cximage90.vcproj diff --git a/CxImage/license.txt b/srchybrid/CxImage/license.txt similarity index 100% rename from CxImage/license.txt rename to srchybrid/CxImage/license.txt diff --git a/CxImage/tif_xfile.cpp b/srchybrid/CxImage/tif_xfile.cpp similarity index 100% rename from CxImage/tif_xfile.cpp rename to srchybrid/CxImage/tif_xfile.cpp diff --git a/CxImage/xfile.h b/srchybrid/CxImage/xfile.h similarity index 100% rename from CxImage/xfile.h rename to srchybrid/CxImage/xfile.h diff --git a/CxImage/ximabmp.cpp b/srchybrid/CxImage/ximabmp.cpp similarity index 100% rename from CxImage/ximabmp.cpp rename to srchybrid/CxImage/ximabmp.cpp diff --git a/CxImage/ximabmp.h b/srchybrid/CxImage/ximabmp.h similarity index 100% rename from CxImage/ximabmp.h rename to srchybrid/CxImage/ximabmp.h diff --git a/CxImage/ximacfg.h b/srchybrid/CxImage/ximacfg.h similarity index 100% rename from CxImage/ximacfg.h rename to srchybrid/CxImage/ximacfg.h diff --git a/CxImage/ximadef.h b/srchybrid/CxImage/ximadef.h similarity index 100% rename from CxImage/ximadef.h rename to srchybrid/CxImage/ximadef.h diff --git a/CxImage/ximadsp.cpp b/srchybrid/CxImage/ximadsp.cpp similarity index 100% rename from CxImage/ximadsp.cpp rename to srchybrid/CxImage/ximadsp.cpp diff --git a/CxImage/ximaenc.cpp b/srchybrid/CxImage/ximaenc.cpp similarity index 100% rename from CxImage/ximaenc.cpp rename to srchybrid/CxImage/ximaenc.cpp diff --git a/CxImage/ximaexif.cpp b/srchybrid/CxImage/ximaexif.cpp similarity index 100% rename from CxImage/ximaexif.cpp rename to srchybrid/CxImage/ximaexif.cpp diff --git a/CxImage/ximage.cpp b/srchybrid/CxImage/ximage.cpp similarity index 100% rename from CxImage/ximage.cpp rename to srchybrid/CxImage/ximage.cpp diff --git a/CxImage/ximage.h b/srchybrid/CxImage/ximage.h similarity index 100% rename from CxImage/ximage.h rename to srchybrid/CxImage/ximage.h diff --git a/CxImage/ximagif.cpp b/srchybrid/CxImage/ximagif.cpp similarity index 100% rename from CxImage/ximagif.cpp rename to srchybrid/CxImage/ximagif.cpp diff --git a/CxImage/ximagif.h b/srchybrid/CxImage/ximagif.h similarity index 100% rename from CxImage/ximagif.h rename to srchybrid/CxImage/ximagif.h diff --git a/CxImage/ximahist.cpp b/srchybrid/CxImage/ximahist.cpp similarity index 100% rename from CxImage/ximahist.cpp rename to srchybrid/CxImage/ximahist.cpp diff --git a/CxImage/ximaico.cpp b/srchybrid/CxImage/ximaico.cpp similarity index 100% rename from CxImage/ximaico.cpp rename to srchybrid/CxImage/ximaico.cpp diff --git a/CxImage/ximaico.h b/srchybrid/CxImage/ximaico.h similarity index 100% rename from CxImage/ximaico.h rename to srchybrid/CxImage/ximaico.h diff --git a/CxImage/ximainfo.cpp b/srchybrid/CxImage/ximainfo.cpp similarity index 100% rename from CxImage/ximainfo.cpp rename to srchybrid/CxImage/ximainfo.cpp diff --git a/CxImage/ximaint.cpp b/srchybrid/CxImage/ximaint.cpp similarity index 100% rename from CxImage/ximaint.cpp rename to srchybrid/CxImage/ximaint.cpp diff --git a/CxImage/ximaiter.h b/srchybrid/CxImage/ximaiter.h similarity index 100% rename from CxImage/ximaiter.h rename to srchybrid/CxImage/ximaiter.h diff --git a/CxImage/ximajas.cpp b/srchybrid/CxImage/ximajas.cpp similarity index 100% rename from CxImage/ximajas.cpp rename to srchybrid/CxImage/ximajas.cpp diff --git a/CxImage/ximajas.h b/srchybrid/CxImage/ximajas.h similarity index 100% rename from CxImage/ximajas.h rename to srchybrid/CxImage/ximajas.h diff --git a/CxImage/ximajbg.cpp b/srchybrid/CxImage/ximajbg.cpp similarity index 100% rename from CxImage/ximajbg.cpp rename to srchybrid/CxImage/ximajbg.cpp diff --git a/CxImage/ximajbg.h b/srchybrid/CxImage/ximajbg.h similarity index 100% rename from CxImage/ximajbg.h rename to srchybrid/CxImage/ximajbg.h diff --git a/CxImage/ximajpg.cpp b/srchybrid/CxImage/ximajpg.cpp similarity index 100% rename from CxImage/ximajpg.cpp rename to srchybrid/CxImage/ximajpg.cpp diff --git a/CxImage/ximajpg.h b/srchybrid/CxImage/ximajpg.h similarity index 100% rename from CxImage/ximajpg.h rename to srchybrid/CxImage/ximajpg.h diff --git a/CxImage/ximalpha.cpp b/srchybrid/CxImage/ximalpha.cpp similarity index 100% rename from CxImage/ximalpha.cpp rename to srchybrid/CxImage/ximalpha.cpp diff --git a/CxImage/ximalyr.cpp b/srchybrid/CxImage/ximalyr.cpp similarity index 100% rename from CxImage/ximalyr.cpp rename to srchybrid/CxImage/ximalyr.cpp diff --git a/CxImage/ximamng.cpp b/srchybrid/CxImage/ximamng.cpp similarity index 100% rename from CxImage/ximamng.cpp rename to srchybrid/CxImage/ximamng.cpp diff --git a/CxImage/ximamng.h b/srchybrid/CxImage/ximamng.h similarity index 100% rename from CxImage/ximamng.h rename to srchybrid/CxImage/ximamng.h diff --git a/CxImage/ximapal.cpp b/srchybrid/CxImage/ximapal.cpp similarity index 100% rename from CxImage/ximapal.cpp rename to srchybrid/CxImage/ximapal.cpp diff --git a/CxImage/ximapcx.cpp b/srchybrid/CxImage/ximapcx.cpp similarity index 100% rename from CxImage/ximapcx.cpp rename to srchybrid/CxImage/ximapcx.cpp diff --git a/CxImage/ximapcx.h b/srchybrid/CxImage/ximapcx.h similarity index 100% rename from CxImage/ximapcx.h rename to srchybrid/CxImage/ximapcx.h diff --git a/CxImage/ximapng.cpp b/srchybrid/CxImage/ximapng.cpp similarity index 100% rename from CxImage/ximapng.cpp rename to srchybrid/CxImage/ximapng.cpp diff --git a/CxImage/ximapng.h b/srchybrid/CxImage/ximapng.h similarity index 100% rename from CxImage/ximapng.h rename to srchybrid/CxImage/ximapng.h diff --git a/CxImage/ximaraw.cpp b/srchybrid/CxImage/ximaraw.cpp similarity index 100% rename from CxImage/ximaraw.cpp rename to srchybrid/CxImage/ximaraw.cpp diff --git a/CxImage/ximaraw.h b/srchybrid/CxImage/ximaraw.h similarity index 100% rename from CxImage/ximaraw.h rename to srchybrid/CxImage/ximaraw.h diff --git a/CxImage/ximasel.cpp b/srchybrid/CxImage/ximasel.cpp similarity index 100% rename from CxImage/ximasel.cpp rename to srchybrid/CxImage/ximasel.cpp diff --git a/CxImage/ximaska.cpp b/srchybrid/CxImage/ximaska.cpp similarity index 100% rename from CxImage/ximaska.cpp rename to srchybrid/CxImage/ximaska.cpp diff --git a/CxImage/ximaska.h b/srchybrid/CxImage/ximaska.h similarity index 100% rename from CxImage/ximaska.h rename to srchybrid/CxImage/ximaska.h diff --git a/CxImage/ximatga.cpp b/srchybrid/CxImage/ximatga.cpp similarity index 100% rename from CxImage/ximatga.cpp rename to srchybrid/CxImage/ximatga.cpp diff --git a/CxImage/ximatga.h b/srchybrid/CxImage/ximatga.h similarity index 100% rename from CxImage/ximatga.h rename to srchybrid/CxImage/ximatga.h diff --git a/CxImage/ximath.cpp b/srchybrid/CxImage/ximath.cpp similarity index 100% rename from CxImage/ximath.cpp rename to srchybrid/CxImage/ximath.cpp diff --git a/CxImage/ximath.h b/srchybrid/CxImage/ximath.h similarity index 100% rename from CxImage/ximath.h rename to srchybrid/CxImage/ximath.h diff --git a/CxImage/ximatif.cpp b/srchybrid/CxImage/ximatif.cpp similarity index 100% rename from CxImage/ximatif.cpp rename to srchybrid/CxImage/ximatif.cpp diff --git a/CxImage/ximatif.h b/srchybrid/CxImage/ximatif.h similarity index 100% rename from CxImage/ximatif.h rename to srchybrid/CxImage/ximatif.h diff --git a/CxImage/ximatran.cpp b/srchybrid/CxImage/ximatran.cpp similarity index 100% rename from CxImage/ximatran.cpp rename to srchybrid/CxImage/ximatran.cpp diff --git a/CxImage/ximawbmp.cpp b/srchybrid/CxImage/ximawbmp.cpp similarity index 100% rename from CxImage/ximawbmp.cpp rename to srchybrid/CxImage/ximawbmp.cpp diff --git a/CxImage/ximawbmp.h b/srchybrid/CxImage/ximawbmp.h similarity index 100% rename from CxImage/ximawbmp.h rename to srchybrid/CxImage/ximawbmp.h diff --git a/CxImage/ximawmf.cpp b/srchybrid/CxImage/ximawmf.cpp similarity index 100% rename from CxImage/ximawmf.cpp rename to srchybrid/CxImage/ximawmf.cpp diff --git a/CxImage/ximawmf.h b/srchybrid/CxImage/ximawmf.h similarity index 100% rename from CxImage/ximawmf.h rename to srchybrid/CxImage/ximawmf.h diff --git a/CxImage/ximawnd.cpp b/srchybrid/CxImage/ximawnd.cpp similarity index 100% rename from CxImage/ximawnd.cpp rename to srchybrid/CxImage/ximawnd.cpp diff --git a/CxImage/xiofile.h b/srchybrid/CxImage/xiofile.h similarity index 100% rename from CxImage/xiofile.h rename to srchybrid/CxImage/xiofile.h diff --git a/CxImage/xmemfile.cpp b/srchybrid/CxImage/xmemfile.cpp similarity index 100% rename from CxImage/xmemfile.cpp rename to srchybrid/CxImage/xmemfile.cpp diff --git a/CxImage/xmemfile.h b/srchybrid/CxImage/xmemfile.h similarity index 100% rename from CxImage/xmemfile.h rename to srchybrid/CxImage/xmemfile.h diff --git a/DLP.cpp b/srchybrid/DLP.cpp similarity index 100% rename from DLP.cpp rename to srchybrid/DLP.cpp diff --git a/DLP.h b/srchybrid/DLP.h similarity index 100% rename from DLP.h rename to srchybrid/DLP.h diff --git a/DeadSourceList.cpp b/srchybrid/DeadSourceList.cpp similarity index 100% rename from DeadSourceList.cpp rename to srchybrid/DeadSourceList.cpp diff --git a/DeadSourceList.h b/srchybrid/DeadSourceList.h similarity index 100% rename from DeadSourceList.h rename to srchybrid/DeadSourceList.h diff --git a/DebugHelpers.h b/srchybrid/DebugHelpers.h similarity index 100% rename from DebugHelpers.h rename to srchybrid/DebugHelpers.h diff --git a/Debug_FileSize.h b/srchybrid/Debug_FileSize.h similarity index 100% rename from Debug_FileSize.h rename to srchybrid/Debug_FileSize.h diff --git a/DialogMinTrayBtn.cpp b/srchybrid/DialogMinTrayBtn.cpp similarity index 100% rename from DialogMinTrayBtn.cpp rename to srchybrid/DialogMinTrayBtn.cpp diff --git a/DialogMinTrayBtn.h b/srchybrid/DialogMinTrayBtn.h similarity index 100% rename from DialogMinTrayBtn.h rename to srchybrid/DialogMinTrayBtn.h diff --git a/DirectDownloadDlg.cpp b/srchybrid/DirectDownloadDlg.cpp similarity index 100% rename from DirectDownloadDlg.cpp rename to srchybrid/DirectDownloadDlg.cpp diff --git a/DirectDownloadDlg.h b/srchybrid/DirectDownloadDlg.h similarity index 100% rename from DirectDownloadDlg.h rename to srchybrid/DirectDownloadDlg.h diff --git a/DirectX/Extras/DirectShow/Include/amstream.h b/srchybrid/DirectX/Extras/DirectShow/Include/amstream.h similarity index 100% rename from DirectX/Extras/DirectShow/Include/amstream.h rename to srchybrid/DirectX/Extras/DirectShow/Include/amstream.h diff --git a/DirectX/Extras/DirectShow/Include/austream.h b/srchybrid/DirectX/Extras/DirectShow/Include/austream.h similarity index 100% rename from DirectX/Extras/DirectShow/Include/austream.h rename to srchybrid/DirectX/Extras/DirectShow/Include/austream.h diff --git a/DirectX/Extras/DirectShow/Include/ddstream.h b/srchybrid/DirectX/Extras/DirectShow/Include/ddstream.h similarity index 100% rename from DirectX/Extras/DirectShow/Include/ddstream.h rename to srchybrid/DirectX/Extras/DirectShow/Include/ddstream.h diff --git a/DirectX/Extras/DirectShow/Include/mmstream.h b/srchybrid/DirectX/Extras/DirectShow/Include/mmstream.h similarity index 100% rename from DirectX/Extras/DirectShow/Include/mmstream.h rename to srchybrid/DirectX/Extras/DirectShow/Include/mmstream.h diff --git a/DirectX/Extras/DirectShow/Include/qedit.h b/srchybrid/DirectX/Extras/DirectShow/Include/qedit.h similarity index 100% rename from DirectX/Extras/DirectShow/Include/qedit.h rename to srchybrid/DirectX/Extras/DirectShow/Include/qedit.h diff --git a/DirectX/Include/d3d.h b/srchybrid/DirectX/Include/d3d.h similarity index 100% rename from DirectX/Include/d3d.h rename to srchybrid/DirectX/Include/d3d.h diff --git a/DirectX/Include/d3dcaps.h b/srchybrid/DirectX/Include/d3dcaps.h similarity index 100% rename from DirectX/Include/d3dcaps.h rename to srchybrid/DirectX/Include/d3dcaps.h diff --git a/DirectX/Include/d3drm.h b/srchybrid/DirectX/Include/d3drm.h similarity index 100% rename from DirectX/Include/d3drm.h rename to srchybrid/DirectX/Include/d3drm.h diff --git a/DirectX/Include/d3drmdef.h b/srchybrid/DirectX/Include/d3drmdef.h similarity index 100% rename from DirectX/Include/d3drmdef.h rename to srchybrid/DirectX/Include/d3drmdef.h diff --git a/DirectX/Include/d3drmobj.h b/srchybrid/DirectX/Include/d3drmobj.h similarity index 100% rename from DirectX/Include/d3drmobj.h rename to srchybrid/DirectX/Include/d3drmobj.h diff --git a/DirectX/Include/d3dtypes.h b/srchybrid/DirectX/Include/d3dtypes.h similarity index 100% rename from DirectX/Include/d3dtypes.h rename to srchybrid/DirectX/Include/d3dtypes.h diff --git a/DirectX/Include/ddraw.h b/srchybrid/DirectX/Include/ddraw.h similarity index 100% rename from DirectX/Include/ddraw.h rename to srchybrid/DirectX/Include/ddraw.h diff --git a/DirectX/Include/dxtrans.h b/srchybrid/DirectX/Include/dxtrans.h similarity index 100% rename from DirectX/Include/dxtrans.h rename to srchybrid/DirectX/Include/dxtrans.h diff --git a/DirectoryTreeCtrl.cpp b/srchybrid/DirectoryTreeCtrl.cpp similarity index 100% rename from DirectoryTreeCtrl.cpp rename to srchybrid/DirectoryTreeCtrl.cpp diff --git a/DirectoryTreeCtrl.h b/srchybrid/DirectoryTreeCtrl.h similarity index 100% rename from DirectoryTreeCtrl.h rename to srchybrid/DirectoryTreeCtrl.h diff --git a/DownloadClient.cpp b/srchybrid/DownloadClient.cpp similarity index 100% rename from DownloadClient.cpp rename to srchybrid/DownloadClient.cpp diff --git a/DownloadClientsCtrl.cpp b/srchybrid/DownloadClientsCtrl.cpp similarity index 100% rename from DownloadClientsCtrl.cpp rename to srchybrid/DownloadClientsCtrl.cpp diff --git a/DownloadClientsCtrl.h b/srchybrid/DownloadClientsCtrl.h similarity index 100% rename from DownloadClientsCtrl.h rename to srchybrid/DownloadClientsCtrl.h diff --git a/DownloadListCtrl.cpp b/srchybrid/DownloadListCtrl.cpp similarity index 100% rename from DownloadListCtrl.cpp rename to srchybrid/DownloadListCtrl.cpp diff --git a/DownloadListCtrl.h b/srchybrid/DownloadListCtrl.h similarity index 100% rename from DownloadListCtrl.h rename to srchybrid/DownloadListCtrl.h diff --git a/DownloadQueue.cpp b/srchybrid/DownloadQueue.cpp similarity index 100% rename from DownloadQueue.cpp rename to srchybrid/DownloadQueue.cpp diff --git a/DownloadQueue.h b/srchybrid/DownloadQueue.h similarity index 100% rename from DownloadQueue.h rename to srchybrid/DownloadQueue.h diff --git a/Drawgdix.h b/srchybrid/Drawgdix.h similarity index 100% rename from Drawgdix.h rename to srchybrid/Drawgdix.h diff --git a/DropDownButton.cpp b/srchybrid/DropDownButton.cpp similarity index 100% rename from DropDownButton.cpp rename to srchybrid/DropDownButton.cpp diff --git a/DropDownButton.h b/srchybrid/DropDownButton.h similarity index 100% rename from DropDownButton.h rename to srchybrid/DropDownButton.h diff --git a/DropTarget.cpp b/srchybrid/DropTarget.cpp similarity index 100% rename from DropTarget.cpp rename to srchybrid/DropTarget.cpp diff --git a/DropTarget.h b/srchybrid/DropTarget.h similarity index 100% rename from DropTarget.h rename to srchybrid/DropTarget.h diff --git a/ED2KLink.cpp b/srchybrid/ED2KLink.cpp similarity index 100% rename from ED2KLink.cpp rename to srchybrid/ED2KLink.cpp diff --git a/ED2KLink.h b/srchybrid/ED2KLink.h similarity index 100% rename from ED2KLink.h rename to srchybrid/ED2KLink.h diff --git a/ED2kLinkDlg.cpp b/srchybrid/ED2kLinkDlg.cpp similarity index 100% rename from ED2kLinkDlg.cpp rename to srchybrid/ED2kLinkDlg.cpp diff --git a/ED2kLinkDlg.h b/srchybrid/ED2kLinkDlg.h similarity index 100% rename from ED2kLinkDlg.h rename to srchybrid/ED2kLinkDlg.h diff --git a/EMSocket.cpp b/srchybrid/EMSocket.cpp similarity index 100% rename from EMSocket.cpp rename to srchybrid/EMSocket.cpp diff --git a/EMSocket.h b/srchybrid/EMSocket.h similarity index 100% rename from EMSocket.h rename to srchybrid/EMSocket.h diff --git a/EditDelayed.cpp b/srchybrid/EditDelayed.cpp similarity index 100% rename from EditDelayed.cpp rename to srchybrid/EditDelayed.cpp diff --git a/EditDelayed.h b/srchybrid/EditDelayed.h similarity index 100% rename from EditDelayed.h rename to srchybrid/EditDelayed.h diff --git a/EditX.cpp b/srchybrid/EditX.cpp similarity index 100% rename from EditX.cpp rename to srchybrid/EditX.cpp diff --git a/EditX.h b/srchybrid/EditX.h similarity index 100% rename from EditX.h rename to srchybrid/EditX.h diff --git a/Emule.cpp b/srchybrid/Emule.cpp similarity index 100% rename from Emule.cpp rename to srchybrid/Emule.cpp diff --git a/EnBitmap.cpp b/srchybrid/EnBitmap.cpp similarity index 100% rename from EnBitmap.cpp rename to srchybrid/EnBitmap.cpp diff --git a/EnBitmap.h b/srchybrid/EnBitmap.h similarity index 100% rename from EnBitmap.h rename to srchybrid/EnBitmap.h diff --git a/EncryptedDatagramSocket.cpp b/srchybrid/EncryptedDatagramSocket.cpp similarity index 100% rename from EncryptedDatagramSocket.cpp rename to srchybrid/EncryptedDatagramSocket.cpp diff --git a/EncryptedDatagramSocket.h b/srchybrid/EncryptedDatagramSocket.h similarity index 100% rename from EncryptedDatagramSocket.h rename to srchybrid/EncryptedDatagramSocket.h diff --git a/EncryptedStreamSocket.cpp b/srchybrid/EncryptedStreamSocket.cpp similarity index 100% rename from EncryptedStreamSocket.cpp rename to srchybrid/EncryptedStreamSocket.cpp diff --git a/EncryptedStreamSocket.h b/srchybrid/EncryptedStreamSocket.h similarity index 100% rename from EncryptedStreamSocket.h rename to srchybrid/EncryptedStreamSocket.h diff --git a/Exceptions.h b/srchybrid/Exceptions.h similarity index 100% rename from Exceptions.h rename to srchybrid/Exceptions.h diff --git a/FileDetailDialog.cpp b/srchybrid/FileDetailDialog.cpp similarity index 100% rename from FileDetailDialog.cpp rename to srchybrid/FileDetailDialog.cpp diff --git a/FileDetailDialog.h b/srchybrid/FileDetailDialog.h similarity index 100% rename from FileDetailDialog.h rename to srchybrid/FileDetailDialog.h diff --git a/FileDetailDialogInfo.cpp b/srchybrid/FileDetailDialogInfo.cpp similarity index 100% rename from FileDetailDialogInfo.cpp rename to srchybrid/FileDetailDialogInfo.cpp diff --git a/FileDetailDialogInfo.h b/srchybrid/FileDetailDialogInfo.h similarity index 100% rename from FileDetailDialogInfo.h rename to srchybrid/FileDetailDialogInfo.h diff --git a/FileDetailDialogName.cpp b/srchybrid/FileDetailDialogName.cpp similarity index 100% rename from FileDetailDialogName.cpp rename to srchybrid/FileDetailDialogName.cpp diff --git a/FileDetailDialogName.h b/srchybrid/FileDetailDialogName.h similarity index 100% rename from FileDetailDialogName.h rename to srchybrid/FileDetailDialogName.h diff --git a/FileDetailDlgStatistics.cpp b/srchybrid/FileDetailDlgStatistics.cpp similarity index 100% rename from FileDetailDlgStatistics.cpp rename to srchybrid/FileDetailDlgStatistics.cpp diff --git a/FileDetailDlgStatistics.h b/srchybrid/FileDetailDlgStatistics.h similarity index 100% rename from FileDetailDlgStatistics.h rename to srchybrid/FileDetailDlgStatistics.h diff --git a/FileIdentifier.cpp b/srchybrid/FileIdentifier.cpp similarity index 100% rename from FileIdentifier.cpp rename to srchybrid/FileIdentifier.cpp diff --git a/FileIdentifier.h b/srchybrid/FileIdentifier.h similarity index 100% rename from FileIdentifier.h rename to srchybrid/FileIdentifier.h diff --git a/FileInfoDialog.cpp b/srchybrid/FileInfoDialog.cpp similarity index 100% rename from FileInfoDialog.cpp rename to srchybrid/FileInfoDialog.cpp diff --git a/FileInfoDialog.h b/srchybrid/FileInfoDialog.h similarity index 100% rename from FileInfoDialog.h rename to srchybrid/FileInfoDialog.h diff --git a/FirewallOpener.cpp b/srchybrid/FirewallOpener.cpp similarity index 100% rename from FirewallOpener.cpp rename to srchybrid/FirewallOpener.cpp diff --git a/FirewallOpener.h b/srchybrid/FirewallOpener.h similarity index 100% rename from FirewallOpener.h rename to srchybrid/FirewallOpener.h diff --git a/Flex.skl b/srchybrid/Flex.skl similarity index 100% rename from Flex.skl rename to srchybrid/Flex.skl diff --git a/FrameGrabThread.cpp b/srchybrid/FrameGrabThread.cpp similarity index 100% rename from FrameGrabThread.cpp rename to srchybrid/FrameGrabThread.cpp diff --git a/FrameGrabThread.h b/srchybrid/FrameGrabThread.h similarity index 100% rename from FrameGrabThread.h rename to srchybrid/FrameGrabThread.h diff --git a/Friend.cpp b/srchybrid/Friend.cpp similarity index 100% rename from Friend.cpp rename to srchybrid/Friend.cpp diff --git a/Friend.h b/srchybrid/Friend.h similarity index 100% rename from Friend.h rename to srchybrid/Friend.h diff --git a/FriendList.cpp b/srchybrid/FriendList.cpp similarity index 100% rename from FriendList.cpp rename to srchybrid/FriendList.cpp diff --git a/FriendList.h b/srchybrid/FriendList.h similarity index 100% rename from FriendList.h rename to srchybrid/FriendList.h diff --git a/FriendListCtrl.cpp b/srchybrid/FriendListCtrl.cpp similarity index 100% rename from FriendListCtrl.cpp rename to srchybrid/FriendListCtrl.cpp diff --git a/FriendListCtrl.h b/srchybrid/FriendListCtrl.h similarity index 100% rename from FriendListCtrl.h rename to srchybrid/FriendListCtrl.h diff --git a/GDIThread.cpp b/srchybrid/GDIThread.cpp similarity index 100% rename from GDIThread.cpp rename to srchybrid/GDIThread.cpp diff --git a/GDIThread.h b/srchybrid/GDIThread.h similarity index 100% rename from GDIThread.h rename to srchybrid/GDIThread.h diff --git a/GZipFile.cpp b/srchybrid/GZipFile.cpp similarity index 100% rename from GZipFile.cpp rename to srchybrid/GZipFile.cpp diff --git a/GZipFile.h b/srchybrid/GZipFile.h similarity index 100% rename from GZipFile.h rename to srchybrid/GZipFile.h diff --git a/GradientStatic.cpp b/srchybrid/GradientStatic.cpp similarity index 100% rename from GradientStatic.cpp rename to srchybrid/GradientStatic.cpp diff --git a/GradientStatic.h b/srchybrid/GradientStatic.h similarity index 100% rename from GradientStatic.h rename to srchybrid/GradientStatic.h diff --git a/HTRichEditCtrl.cpp b/srchybrid/HTRichEditCtrl.cpp similarity index 100% rename from HTRichEditCtrl.cpp rename to srchybrid/HTRichEditCtrl.cpp diff --git a/HTRichEditCtrl.h b/srchybrid/HTRichEditCtrl.h similarity index 100% rename from HTRichEditCtrl.h rename to srchybrid/HTRichEditCtrl.h diff --git a/HelpIDs.h b/srchybrid/HelpIDs.h similarity index 100% rename from HelpIDs.h rename to srchybrid/HelpIDs.h diff --git a/HighColorTab.hpp b/srchybrid/HighColorTab.hpp similarity index 100% rename from HighColorTab.hpp rename to srchybrid/HighColorTab.hpp diff --git a/HistoryListCtrl.cpp b/srchybrid/HistoryListCtrl.cpp similarity index 100% rename from HistoryListCtrl.cpp rename to srchybrid/HistoryListCtrl.cpp diff --git a/HistoryListCtrl.h b/srchybrid/HistoryListCtrl.h similarity index 100% rename from HistoryListCtrl.h rename to srchybrid/HistoryListCtrl.h diff --git a/HttpClientReqSocket.cpp b/srchybrid/HttpClientReqSocket.cpp similarity index 100% rename from HttpClientReqSocket.cpp rename to srchybrid/HttpClientReqSocket.cpp diff --git a/HttpClientReqSocket.h b/srchybrid/HttpClientReqSocket.h similarity index 100% rename from HttpClientReqSocket.h rename to srchybrid/HttpClientReqSocket.h diff --git a/HttpDownloadDlg.cpp b/srchybrid/HttpDownloadDlg.cpp similarity index 100% rename from HttpDownloadDlg.cpp rename to srchybrid/HttpDownloadDlg.cpp diff --git a/HttpDownloadDlg.h b/srchybrid/HttpDownloadDlg.h similarity index 100% rename from HttpDownloadDlg.h rename to srchybrid/HttpDownloadDlg.h diff --git a/HyperTextCtrl.cpp b/srchybrid/HyperTextCtrl.cpp similarity index 100% rename from HyperTextCtrl.cpp rename to srchybrid/HyperTextCtrl.cpp diff --git a/HyperTextCtrl.h b/srchybrid/HyperTextCtrl.h similarity index 100% rename from HyperTextCtrl.h rename to srchybrid/HyperTextCtrl.h diff --git a/I18n.cpp b/srchybrid/I18n.cpp similarity index 100% rename from I18n.cpp rename to srchybrid/I18n.cpp diff --git a/IESecurity.cpp b/srchybrid/IESecurity.cpp similarity index 100% rename from IESecurity.cpp rename to srchybrid/IESecurity.cpp diff --git a/IESecurity.h b/srchybrid/IESecurity.h similarity index 100% rename from IESecurity.h rename to srchybrid/IESecurity.h diff --git a/IP2Country.cpp b/srchybrid/IP2Country.cpp similarity index 100% rename from IP2Country.cpp rename to srchybrid/IP2Country.cpp diff --git a/IP2Country.h b/srchybrid/IP2Country.h similarity index 100% rename from IP2Country.h rename to srchybrid/IP2Country.h diff --git a/IPFilter.cpp b/srchybrid/IPFilter.cpp similarity index 100% rename from IPFilter.cpp rename to srchybrid/IPFilter.cpp diff --git a/IPFilter.h b/srchybrid/IPFilter.h similarity index 100% rename from IPFilter.h rename to srchybrid/IPFilter.h diff --git a/IPFilterDlg.cpp b/srchybrid/IPFilterDlg.cpp similarity index 100% rename from IPFilterDlg.cpp rename to srchybrid/IPFilterDlg.cpp diff --git a/IPFilterDlg.h b/srchybrid/IPFilterDlg.h similarity index 100% rename from IPFilterDlg.h rename to srchybrid/IPFilterDlg.h diff --git a/IconStatic.cpp b/srchybrid/IconStatic.cpp similarity index 100% rename from IconStatic.cpp rename to srchybrid/IconStatic.cpp diff --git a/IconStatic.h b/srchybrid/IconStatic.h similarity index 100% rename from IconStatic.h rename to srchybrid/IconStatic.h diff --git a/InputBox.cpp b/srchybrid/InputBox.cpp similarity index 100% rename from InputBox.cpp rename to srchybrid/InputBox.cpp diff --git a/InputBox.h b/srchybrid/InputBox.h similarity index 100% rename from InputBox.h rename to srchybrid/InputBox.h diff --git a/IrcChannelListCtrl.cpp b/srchybrid/IrcChannelListCtrl.cpp similarity index 100% rename from IrcChannelListCtrl.cpp rename to srchybrid/IrcChannelListCtrl.cpp diff --git a/IrcChannelListCtrl.h b/srchybrid/IrcChannelListCtrl.h similarity index 100% rename from IrcChannelListCtrl.h rename to srchybrid/IrcChannelListCtrl.h diff --git a/IrcChannelTabCtrl.cpp b/srchybrid/IrcChannelTabCtrl.cpp similarity index 100% rename from IrcChannelTabCtrl.cpp rename to srchybrid/IrcChannelTabCtrl.cpp diff --git a/IrcChannelTabCtrl.h b/srchybrid/IrcChannelTabCtrl.h similarity index 100% rename from IrcChannelTabCtrl.h rename to srchybrid/IrcChannelTabCtrl.h diff --git a/IrcMain.cpp b/srchybrid/IrcMain.cpp similarity index 100% rename from IrcMain.cpp rename to srchybrid/IrcMain.cpp diff --git a/IrcMain.h b/srchybrid/IrcMain.h similarity index 100% rename from IrcMain.h rename to srchybrid/IrcMain.h diff --git a/IrcNickListCtrl.cpp b/srchybrid/IrcNickListCtrl.cpp similarity index 100% rename from IrcNickListCtrl.cpp rename to srchybrid/IrcNickListCtrl.cpp diff --git a/IrcNickListCtrl.h b/srchybrid/IrcNickListCtrl.h similarity index 100% rename from IrcNickListCtrl.h rename to srchybrid/IrcNickListCtrl.h diff --git a/IrcSocket.cpp b/srchybrid/IrcSocket.cpp similarity index 100% rename from IrcSocket.cpp rename to srchybrid/IrcSocket.cpp diff --git a/IrcSocket.h b/srchybrid/IrcSocket.h similarity index 100% rename from IrcSocket.h rename to srchybrid/IrcSocket.h diff --git a/IrcWnd.cpp b/srchybrid/IrcWnd.cpp similarity index 100% rename from IrcWnd.cpp rename to srchybrid/IrcWnd.cpp diff --git a/IrcWnd.h b/srchybrid/IrcWnd.h similarity index 100% rename from IrcWnd.h rename to srchybrid/IrcWnd.h diff --git a/KCSideBannerWnd.cpp b/srchybrid/KCSideBannerWnd.cpp similarity index 100% rename from KCSideBannerWnd.cpp rename to srchybrid/KCSideBannerWnd.cpp diff --git a/KCSideBannerWnd.h b/srchybrid/KCSideBannerWnd.h similarity index 100% rename from KCSideBannerWnd.h rename to srchybrid/KCSideBannerWnd.h diff --git a/KadContactHistogramCtrl.cpp b/srchybrid/KadContactHistogramCtrl.cpp similarity index 100% rename from KadContactHistogramCtrl.cpp rename to srchybrid/KadContactHistogramCtrl.cpp diff --git a/KadContactHistogramCtrl.h b/srchybrid/KadContactHistogramCtrl.h similarity index 100% rename from KadContactHistogramCtrl.h rename to srchybrid/KadContactHistogramCtrl.h diff --git a/KadContactListCtrl.cpp b/srchybrid/KadContactListCtrl.cpp similarity index 100% rename from KadContactListCtrl.cpp rename to srchybrid/KadContactListCtrl.cpp diff --git a/KadContactListCtrl.h b/srchybrid/KadContactListCtrl.h similarity index 100% rename from KadContactListCtrl.h rename to srchybrid/KadContactListCtrl.h diff --git a/KadLookupGraph.cpp b/srchybrid/KadLookupGraph.cpp similarity index 100% rename from KadLookupGraph.cpp rename to srchybrid/KadLookupGraph.cpp diff --git a/KadLookupGraph.h b/srchybrid/KadLookupGraph.h similarity index 100% rename from KadLookupGraph.h rename to srchybrid/KadLookupGraph.h diff --git a/KadSearchListCtrl.cpp b/srchybrid/KadSearchListCtrl.cpp similarity index 100% rename from KadSearchListCtrl.cpp rename to srchybrid/KadSearchListCtrl.cpp diff --git a/KadSearchListCtrl.h b/srchybrid/KadSearchListCtrl.h similarity index 100% rename from KadSearchListCtrl.h rename to srchybrid/KadSearchListCtrl.h diff --git a/KademliaWnd.cpp b/srchybrid/KademliaWnd.cpp similarity index 100% rename from KademliaWnd.cpp rename to srchybrid/KademliaWnd.cpp diff --git a/KademliaWnd.h b/srchybrid/KademliaWnd.h similarity index 100% rename from KademliaWnd.h rename to srchybrid/KademliaWnd.h diff --git a/KeyHelper.cpp b/srchybrid/KeyHelper.cpp similarity index 100% rename from KeyHelper.cpp rename to srchybrid/KeyHelper.cpp diff --git a/KeyHelper.h b/srchybrid/KeyHelper.h similarity index 100% rename from KeyHelper.h rename to srchybrid/KeyHelper.h diff --git a/KnownFile.cpp b/srchybrid/KnownFile.cpp similarity index 100% rename from KnownFile.cpp rename to srchybrid/KnownFile.cpp diff --git a/KnownFile.h b/srchybrid/KnownFile.h similarity index 100% rename from KnownFile.h rename to srchybrid/KnownFile.h diff --git a/KnownFileList.cpp b/srchybrid/KnownFileList.cpp similarity index 100% rename from KnownFileList.cpp rename to srchybrid/KnownFileList.cpp diff --git a/KnownFileList.h b/srchybrid/KnownFileList.h similarity index 93% rename from KnownFileList.h rename to srchybrid/KnownFileList.h index 06231cd..a651256 100644 --- a/KnownFileList.h +++ b/srchybrid/KnownFileList.h @@ -60,6 +60,16 @@ class CKnownFileList CKnownFile* FindKnownFile(LPCTSTR filename, uint32 date, uint64 size) const; CKnownFile* FindKnownFileByID(const uchar* hash) const; CKnownFile* FindKnownFileByPath(const CString& sFilePath) const; + + POSITION usedToFindByNumber; + void FindHeadKnownFile() { usedToFindByNumber = m_Files_map.GetStartPosition(); } + CKnownFile* FindNextKnownFile() { + CKnownFile* cur_file; + CCKey key; + m_Files_map.GetNextAssoc(usedToFindByNumber, key, cur_file); + return cur_file; + } + bool IsKnownFile(const CKnownFile* file) const; bool IsFilePtrInList(const CKnownFile* file) const; diff --git a/LayeredWindowHelperST.cpp b/srchybrid/LayeredWindowHelperST.cpp similarity index 100% rename from LayeredWindowHelperST.cpp rename to srchybrid/LayeredWindowHelperST.cpp diff --git a/LayeredWindowHelperST.h b/srchybrid/LayeredWindowHelperST.h similarity index 100% rename from LayeredWindowHelperST.h rename to srchybrid/LayeredWindowHelperST.h diff --git a/ListBoxST.cpp b/srchybrid/ListBoxST.cpp similarity index 100% rename from ListBoxST.cpp rename to srchybrid/ListBoxST.cpp diff --git a/ListBoxST.h b/srchybrid/ListBoxST.h similarity index 100% rename from ListBoxST.h rename to srchybrid/ListBoxST.h diff --git a/ListCtrlEditable.cpp b/srchybrid/ListCtrlEditable.cpp similarity index 100% rename from ListCtrlEditable.cpp rename to srchybrid/ListCtrlEditable.cpp diff --git a/ListCtrlEditable.h b/srchybrid/ListCtrlEditable.h similarity index 100% rename from ListCtrlEditable.h rename to srchybrid/ListCtrlEditable.h diff --git a/ListCtrlItemWalk.h b/srchybrid/ListCtrlItemWalk.h similarity index 100% rename from ListCtrlItemWalk.h rename to srchybrid/ListCtrlItemWalk.h diff --git a/ListCtrlX.cpp b/srchybrid/ListCtrlX.cpp similarity index 100% rename from ListCtrlX.cpp rename to srchybrid/ListCtrlX.cpp diff --git a/ListCtrlX.h b/srchybrid/ListCtrlX.h similarity index 100% rename from ListCtrlX.h rename to srchybrid/ListCtrlX.h diff --git a/ListViewSearchDlg.cpp b/srchybrid/ListViewSearchDlg.cpp similarity index 100% rename from ListViewSearchDlg.cpp rename to srchybrid/ListViewSearchDlg.cpp diff --git a/ListViewSearchDlg.h b/srchybrid/ListViewSearchDlg.h similarity index 100% rename from ListViewSearchDlg.h rename to srchybrid/ListViewSearchDlg.h diff --git a/ListViewWalkerPropertySheet.cpp b/srchybrid/ListViewWalkerPropertySheet.cpp similarity index 100% rename from ListViewWalkerPropertySheet.cpp rename to srchybrid/ListViewWalkerPropertySheet.cpp diff --git a/ListViewWalkerPropertySheet.h b/srchybrid/ListViewWalkerPropertySheet.h similarity index 100% rename from ListViewWalkerPropertySheet.h rename to srchybrid/ListViewWalkerPropertySheet.h diff --git a/ListenSocket.cpp b/srchybrid/ListenSocket.cpp similarity index 100% rename from ListenSocket.cpp rename to srchybrid/ListenSocket.cpp diff --git a/ListenSocket.h b/srchybrid/ListenSocket.h similarity index 100% rename from ListenSocket.h rename to srchybrid/ListenSocket.h diff --git a/Log.cpp b/srchybrid/Log.cpp similarity index 100% rename from Log.cpp rename to srchybrid/Log.cpp diff --git a/Log.h b/srchybrid/Log.h similarity index 100% rename from Log.h rename to srchybrid/Log.h diff --git a/LogEditCtrl.cpp b/srchybrid/LogEditCtrl.cpp similarity index 100% rename from LogEditCtrl.cpp rename to srchybrid/LogEditCtrl.cpp diff --git a/LogEditCtrl.h b/srchybrid/LogEditCtrl.h similarity index 100% rename from LogEditCtrl.h rename to srchybrid/LogEditCtrl.h diff --git a/MD4.cpp b/srchybrid/MD4.cpp similarity index 100% rename from MD4.cpp rename to srchybrid/MD4.cpp diff --git a/MD4.h b/srchybrid/MD4.h similarity index 100% rename from MD4.h rename to srchybrid/MD4.h diff --git a/MD4_asm.asm b/srchybrid/MD4_asm.asm similarity index 100% rename from MD4_asm.asm rename to srchybrid/MD4_asm.asm diff --git a/MD5Sum.cpp b/srchybrid/MD5Sum.cpp similarity index 100% rename from MD5Sum.cpp rename to srchybrid/MD5Sum.cpp diff --git a/MD5Sum.h b/srchybrid/MD5Sum.h similarity index 100% rename from MD5Sum.h rename to srchybrid/MD5Sum.h diff --git a/MMServer.cpp b/srchybrid/MMServer.cpp similarity index 100% rename from MMServer.cpp rename to srchybrid/MMServer.cpp diff --git a/MMServer.h b/srchybrid/MMServer.h similarity index 100% rename from MMServer.h rename to srchybrid/MMServer.h diff --git a/MMSocket.cpp b/srchybrid/MMSocket.cpp similarity index 100% rename from MMSocket.cpp rename to srchybrid/MMSocket.cpp diff --git a/MMSocket.h b/srchybrid/MMSocket.h similarity index 100% rename from MMSocket.h rename to srchybrid/MMSocket.h diff --git a/MapKey.h b/srchybrid/MapKey.h similarity index 100% rename from MapKey.h rename to srchybrid/MapKey.h diff --git a/MassRename.cpp b/srchybrid/MassRename.cpp similarity index 100% rename from MassRename.cpp rename to srchybrid/MassRename.cpp diff --git a/MassRename.h b/srchybrid/MassRename.h similarity index 100% rename from MassRename.h rename to srchybrid/MassRename.h diff --git a/MediaInfo.cpp b/srchybrid/MediaInfo.cpp similarity index 100% rename from MediaInfo.cpp rename to srchybrid/MediaInfo.cpp diff --git a/MediaInfo.h b/srchybrid/MediaInfo.h similarity index 100% rename from MediaInfo.h rename to srchybrid/MediaInfo.h diff --git a/MemDC.h b/srchybrid/MemDC.h similarity index 100% rename from MemDC.h rename to srchybrid/MemDC.h diff --git a/MenuCmds.h b/srchybrid/MenuCmds.h similarity index 100% rename from MenuCmds.h rename to srchybrid/MenuCmds.h diff --git a/MenuXP.cpp b/srchybrid/MenuXP.cpp similarity index 100% rename from MenuXP.cpp rename to srchybrid/MenuXP.cpp diff --git a/MenuXP.h b/srchybrid/MenuXP.h similarity index 100% rename from MenuXP.h rename to srchybrid/MenuXP.h diff --git a/MetaDataDlg.cpp b/srchybrid/MetaDataDlg.cpp similarity index 100% rename from MetaDataDlg.cpp rename to srchybrid/MetaDataDlg.cpp diff --git a/MetaDataDlg.h b/srchybrid/MetaDataDlg.h similarity index 100% rename from MetaDataDlg.h rename to srchybrid/MetaDataDlg.h diff --git a/MeterIcon.cpp b/srchybrid/MeterIcon.cpp similarity index 100% rename from MeterIcon.cpp rename to srchybrid/MeterIcon.cpp diff --git a/MeterIcon.h b/srchybrid/MeterIcon.h similarity index 100% rename from MeterIcon.h rename to srchybrid/MeterIcon.h diff --git a/MfcStaticBinaryCompatible.cpp b/srchybrid/MfcStaticBinaryCompatible.cpp similarity index 100% rename from MfcStaticBinaryCompatible.cpp rename to srchybrid/MfcStaticBinaryCompatible.cpp diff --git a/MiniMule.cpp b/srchybrid/MiniMule.cpp similarity index 100% rename from MiniMule.cpp rename to srchybrid/MiniMule.cpp diff --git a/MiniMule.h b/srchybrid/MiniMule.h similarity index 100% rename from MiniMule.h rename to srchybrid/MiniMule.h diff --git a/MiniMule/CDialogSK.cpp b/srchybrid/MiniMule/CDialogSK.cpp similarity index 100% rename from MiniMule/CDialogSK.cpp rename to srchybrid/MiniMule/CDialogSK.cpp diff --git a/MiniMule/CDialogSK.h b/srchybrid/MiniMule/CDialogSK.h similarity index 100% rename from MiniMule/CDialogSK.h rename to srchybrid/MiniMule/CDialogSK.h diff --git a/MiniMule/CPU.cpp b/srchybrid/MiniMule/CPU.cpp similarity index 100% rename from MiniMule/CPU.cpp rename to srchybrid/MiniMule/CPU.cpp diff --git a/MiniMule/CPU.h b/srchybrid/MiniMule/CPU.h similarity index 100% rename from MiniMule/CPU.h rename to srchybrid/MiniMule/CPU.h diff --git a/MiniMule/DblScope.cpp b/srchybrid/MiniMule/DblScope.cpp similarity index 100% rename from MiniMule/DblScope.cpp rename to srchybrid/MiniMule/DblScope.cpp diff --git a/MiniMule/DblScope.h b/srchybrid/MiniMule/DblScope.h similarity index 100% rename from MiniMule/DblScope.h rename to srchybrid/MiniMule/DblScope.h diff --git a/MiniMule/MibAccess.cpp b/srchybrid/MiniMule/MibAccess.cpp similarity index 100% rename from MiniMule/MibAccess.cpp rename to srchybrid/MiniMule/MibAccess.cpp diff --git a/MiniMule/MibAccess.h b/srchybrid/MiniMule/MibAccess.h similarity index 100% rename from MiniMule/MibAccess.h rename to srchybrid/MiniMule/MibAccess.h diff --git a/MiniMule/PerfCounters.h b/srchybrid/MiniMule/PerfCounters.h similarity index 100% rename from MiniMule/PerfCounters.h rename to srchybrid/MiniMule/PerfCounters.h diff --git a/MiniMule/SmartLock.h b/srchybrid/MiniMule/SmartLock.h similarity index 100% rename from MiniMule/SmartLock.h rename to srchybrid/MiniMule/SmartLock.h diff --git a/MiniMule/SnapDialog.cpp b/srchybrid/MiniMule/SnapDialog.cpp similarity index 100% rename from MiniMule/SnapDialog.cpp rename to srchybrid/MiniMule/SnapDialog.cpp diff --git a/MiniMule/SnapDialog.h b/srchybrid/MiniMule/SnapDialog.h similarity index 100% rename from MiniMule/SnapDialog.h rename to srchybrid/MiniMule/SnapDialog.h diff --git a/MiniMule/SysInfo.cpp b/srchybrid/MiniMule/SysInfo.cpp similarity index 100% rename from MiniMule/SysInfo.cpp rename to srchybrid/MiniMule/SysInfo.cpp diff --git a/MiniMule/SysInfo.h b/srchybrid/MiniMule/SysInfo.h similarity index 100% rename from MiniMule/SysInfo.h rename to srchybrid/MiniMule/SysInfo.h diff --git a/MiniMule/SystemInfo.cpp b/srchybrid/MiniMule/SystemInfo.cpp similarity index 100% rename from MiniMule/SystemInfo.cpp rename to srchybrid/MiniMule/SystemInfo.cpp diff --git a/MiniMule/SystemInfo.h b/srchybrid/MiniMule/SystemInfo.h similarity index 100% rename from MiniMule/SystemInfo.h rename to srchybrid/MiniMule/SystemInfo.h diff --git a/MiniMule/TKTime.h b/srchybrid/MiniMule/TKTime.h similarity index 100% rename from MiniMule/TKTime.h rename to srchybrid/MiniMule/TKTime.h diff --git a/MiniMule/TKTypes.h b/srchybrid/MiniMule/TKTypes.h similarity index 100% rename from MiniMule/TKTypes.h rename to srchybrid/MiniMule/TKTypes.h diff --git a/MiniMule/tbhmm.cpp b/srchybrid/MiniMule/tbhmm.cpp similarity index 100% rename from MiniMule/tbhmm.cpp rename to srchybrid/MiniMule/tbhmm.cpp diff --git a/MiniMule/tbhmm.h b/srchybrid/MiniMule/tbhmm.h similarity index 100% rename from MiniMule/tbhmm.h rename to srchybrid/MiniMule/tbhmm.h diff --git a/ModVersion.cpp b/srchybrid/ModVersion.cpp similarity index 100% rename from ModVersion.cpp rename to srchybrid/ModVersion.cpp diff --git a/ModVersion.h b/srchybrid/ModVersion.h similarity index 100% rename from ModVersion.h rename to srchybrid/ModVersion.h diff --git a/MuleListCtrl.cpp b/srchybrid/MuleListCtrl.cpp similarity index 100% rename from MuleListCtrl.cpp rename to srchybrid/MuleListCtrl.cpp diff --git a/MuleListCtrl.h b/srchybrid/MuleListCtrl.h similarity index 100% rename from MuleListCtrl.h rename to srchybrid/MuleListCtrl.h diff --git a/MuleStatusBarCtrl.cpp b/srchybrid/MuleStatusBarCtrl.cpp similarity index 100% rename from MuleStatusBarCtrl.cpp rename to srchybrid/MuleStatusBarCtrl.cpp diff --git a/MuleStatusBarCtrl.h b/srchybrid/MuleStatusBarCtrl.h similarity index 100% rename from MuleStatusBarCtrl.h rename to srchybrid/MuleStatusBarCtrl.h diff --git a/MuleSystrayDlg.cpp b/srchybrid/MuleSystrayDlg.cpp similarity index 100% rename from MuleSystrayDlg.cpp rename to srchybrid/MuleSystrayDlg.cpp diff --git a/MuleSystrayDlg.h b/srchybrid/MuleSystrayDlg.h similarity index 100% rename from MuleSystrayDlg.h rename to srchybrid/MuleSystrayDlg.h diff --git a/MuleToolBarCtrl.cpp b/srchybrid/MuleToolBarCtrl.cpp similarity index 100% rename from MuleToolBarCtrl.cpp rename to srchybrid/MuleToolBarCtrl.cpp diff --git a/MuleToolBarCtrl.h b/srchybrid/MuleToolBarCtrl.h similarity index 100% rename from MuleToolBarCtrl.h rename to srchybrid/MuleToolBarCtrl.h diff --git a/NTService.cpp b/srchybrid/NTService.cpp similarity index 100% rename from NTService.cpp rename to srchybrid/NTService.cpp diff --git a/NTService.h b/srchybrid/NTService.h similarity index 100% rename from NTService.h rename to srchybrid/NTService.h diff --git a/NetF.cpp b/srchybrid/NetF.cpp similarity index 100% rename from NetF.cpp rename to srchybrid/NetF.cpp diff --git a/NetF.h b/srchybrid/NetF.h similarity index 100% rename from NetF.h rename to srchybrid/NetF.h diff --git a/NetworkInfoDlg.cpp b/srchybrid/NetworkInfoDlg.cpp similarity index 100% rename from NetworkInfoDlg.cpp rename to srchybrid/NetworkInfoDlg.cpp diff --git a/NetworkInfoDlg.h b/srchybrid/NetworkInfoDlg.h similarity index 100% rename from NetworkInfoDlg.h rename to srchybrid/NetworkInfoDlg.h diff --git a/NumEdit.cpp b/srchybrid/NumEdit.cpp similarity index 100% rename from NumEdit.cpp rename to srchybrid/NumEdit.cpp diff --git a/NumEdit.h b/srchybrid/NumEdit.h similarity index 100% rename from NumEdit.h rename to srchybrid/NumEdit.h diff --git a/OScopeCtrl.cpp b/srchybrid/OScopeCtrl.cpp similarity index 100% rename from OScopeCtrl.cpp rename to srchybrid/OScopeCtrl.cpp diff --git a/OScopeCtrl.h b/srchybrid/OScopeCtrl.h similarity index 100% rename from OScopeCtrl.h rename to srchybrid/OScopeCtrl.h diff --git a/P2PThreat.cpp b/srchybrid/P2PThreat.cpp similarity index 100% rename from P2PThreat.cpp rename to srchybrid/P2PThreat.cpp diff --git a/P2PThreat.h b/srchybrid/P2PThreat.h similarity index 100% rename from P2PThreat.h rename to srchybrid/P2PThreat.h diff --git a/PPGProxy.cpp b/srchybrid/PPGProxy.cpp similarity index 100% rename from PPGProxy.cpp rename to srchybrid/PPGProxy.cpp diff --git a/PPGProxy.h b/srchybrid/PPGProxy.h similarity index 100% rename from PPGProxy.h rename to srchybrid/PPGProxy.h diff --git a/PPgConnection.cpp b/srchybrid/PPgConnection.cpp similarity index 100% rename from PPgConnection.cpp rename to srchybrid/PPgConnection.cpp diff --git a/PPgConnection.h b/srchybrid/PPgConnection.h similarity index 100% rename from PPgConnection.h rename to srchybrid/PPgConnection.h diff --git a/PPgDebug.cpp b/srchybrid/PPgDebug.cpp similarity index 100% rename from PPgDebug.cpp rename to srchybrid/PPgDebug.cpp diff --git a/PPgDebug.h b/srchybrid/PPgDebug.h similarity index 100% rename from PPgDebug.h rename to srchybrid/PPgDebug.h diff --git a/PPgDirectories.cpp b/srchybrid/PPgDirectories.cpp similarity index 100% rename from PPgDirectories.cpp rename to srchybrid/PPgDirectories.cpp diff --git a/PPgDirectories.h b/srchybrid/PPgDirectories.h similarity index 100% rename from PPgDirectories.h rename to srchybrid/PPgDirectories.h diff --git a/PPgDisplay.cpp b/srchybrid/PPgDisplay.cpp similarity index 100% rename from PPgDisplay.cpp rename to srchybrid/PPgDisplay.cpp diff --git a/PPgDisplay.h b/srchybrid/PPgDisplay.h similarity index 100% rename from PPgDisplay.h rename to srchybrid/PPgDisplay.h diff --git a/PPgFiles.cpp b/srchybrid/PPgFiles.cpp similarity index 100% rename from PPgFiles.cpp rename to srchybrid/PPgFiles.cpp diff --git a/PPgFiles.h b/srchybrid/PPgFiles.h similarity index 100% rename from PPgFiles.h rename to srchybrid/PPgFiles.h diff --git a/PPgGeneral.cpp b/srchybrid/PPgGeneral.cpp similarity index 100% rename from PPgGeneral.cpp rename to srchybrid/PPgGeneral.cpp diff --git a/PPgGeneral.h b/srchybrid/PPgGeneral.h similarity index 100% rename from PPgGeneral.h rename to srchybrid/PPgGeneral.h diff --git a/PPgIrc.cpp b/srchybrid/PPgIrc.cpp similarity index 100% rename from PPgIrc.cpp rename to srchybrid/PPgIrc.cpp diff --git a/PPgIrc.h b/srchybrid/PPgIrc.h similarity index 100% rename from PPgIrc.h rename to srchybrid/PPgIrc.h diff --git a/PPgMessages.cpp b/srchybrid/PPgMessages.cpp similarity index 100% rename from PPgMessages.cpp rename to srchybrid/PPgMessages.cpp diff --git a/PPgMessages.h b/srchybrid/PPgMessages.h similarity index 100% rename from PPgMessages.h rename to srchybrid/PPgMessages.h diff --git a/PPgNotify.cpp b/srchybrid/PPgNotify.cpp similarity index 100% rename from PPgNotify.cpp rename to srchybrid/PPgNotify.cpp diff --git a/PPgNotify.h b/srchybrid/PPgNotify.h similarity index 100% rename from PPgNotify.h rename to srchybrid/PPgNotify.h diff --git a/PPgScar.cpp b/srchybrid/PPgScar.cpp similarity index 100% rename from PPgScar.cpp rename to srchybrid/PPgScar.cpp diff --git a/PPgScar.h b/srchybrid/PPgScar.h similarity index 100% rename from PPgScar.h rename to srchybrid/PPgScar.h diff --git a/PPgScheduler.cpp b/srchybrid/PPgScheduler.cpp similarity index 100% rename from PPgScheduler.cpp rename to srchybrid/PPgScheduler.cpp diff --git a/PPgScheduler.h b/srchybrid/PPgScheduler.h similarity index 100% rename from PPgScheduler.h rename to srchybrid/PPgScheduler.h diff --git a/PPgSecurity.cpp b/srchybrid/PPgSecurity.cpp similarity index 100% rename from PPgSecurity.cpp rename to srchybrid/PPgSecurity.cpp diff --git a/PPgSecurity.h b/srchybrid/PPgSecurity.h similarity index 100% rename from PPgSecurity.h rename to srchybrid/PPgSecurity.h diff --git a/PPgServer.cpp b/srchybrid/PPgServer.cpp similarity index 100% rename from PPgServer.cpp rename to srchybrid/PPgServer.cpp diff --git a/PPgServer.h b/srchybrid/PPgServer.h similarity index 100% rename from PPgServer.h rename to srchybrid/PPgServer.h diff --git a/PPgStats.cpp b/srchybrid/PPgStats.cpp similarity index 100% rename from PPgStats.cpp rename to srchybrid/PPgStats.cpp diff --git a/PPgStats.h b/srchybrid/PPgStats.h similarity index 100% rename from PPgStats.h rename to srchybrid/PPgStats.h diff --git a/PPgTweaks.cpp b/srchybrid/PPgTweaks.cpp similarity index 100% rename from PPgTweaks.cpp rename to srchybrid/PPgTweaks.cpp diff --git a/PPgTweaks.h b/srchybrid/PPgTweaks.h similarity index 100% rename from PPgTweaks.h rename to srchybrid/PPgTweaks.h diff --git a/PPgWebServer.cpp b/srchybrid/PPgWebServer.cpp similarity index 100% rename from PPgWebServer.cpp rename to srchybrid/PPgWebServer.cpp diff --git a/PPgWebServer.h b/srchybrid/PPgWebServer.h similarity index 100% rename from PPgWebServer.h rename to srchybrid/PPgWebServer.h diff --git a/PPgXtreme.cpp b/srchybrid/PPgXtreme.cpp similarity index 100% rename from PPgXtreme.cpp rename to srchybrid/PPgXtreme.cpp diff --git a/PPgXtreme.h b/srchybrid/PPgXtreme.h similarity index 100% rename from PPgXtreme.h rename to srchybrid/PPgXtreme.h diff --git a/PPgXtreme2.cpp b/srchybrid/PPgXtreme2.cpp similarity index 100% rename from PPgXtreme2.cpp rename to srchybrid/PPgXtreme2.cpp diff --git a/PPgXtreme2.h b/srchybrid/PPgXtreme2.h similarity index 100% rename from PPgXtreme2.h rename to srchybrid/PPgXtreme2.h diff --git a/PShtWiz1.cpp b/srchybrid/PShtWiz1.cpp similarity index 100% rename from PShtWiz1.cpp rename to srchybrid/PShtWiz1.cpp diff --git a/PartFile.cpp b/srchybrid/PartFile.cpp similarity index 100% rename from PartFile.cpp rename to srchybrid/PartFile.cpp diff --git a/PartFile.h b/srchybrid/PartFile.h similarity index 100% rename from PartFile.h rename to srchybrid/PartFile.h diff --git a/PartFileConvert.cpp b/srchybrid/PartFileConvert.cpp similarity index 100% rename from PartFileConvert.cpp rename to srchybrid/PartFileConvert.cpp diff --git a/PartFileConvert.h b/srchybrid/PartFileConvert.h similarity index 100% rename from PartFileConvert.h rename to srchybrid/PartFileConvert.h diff --git a/PeerCacheClient.cpp b/srchybrid/PeerCacheClient.cpp similarity index 100% rename from PeerCacheClient.cpp rename to srchybrid/PeerCacheClient.cpp diff --git a/PeerCacheFinder.cpp b/srchybrid/PeerCacheFinder.cpp similarity index 100% rename from PeerCacheFinder.cpp rename to srchybrid/PeerCacheFinder.cpp diff --git a/PeerCacheFinder.h b/srchybrid/PeerCacheFinder.h similarity index 100% rename from PeerCacheFinder.h rename to srchybrid/PeerCacheFinder.h diff --git a/PeerCacheSocket.h b/srchybrid/PeerCacheSocket.h similarity index 100% rename from PeerCacheSocket.h rename to srchybrid/PeerCacheSocket.h diff --git a/PerfLog.cpp b/srchybrid/PerfLog.cpp similarity index 100% rename from PerfLog.cpp rename to srchybrid/PerfLog.cpp diff --git a/PerfLog.h b/srchybrid/PerfLog.h similarity index 100% rename from PerfLog.h rename to srchybrid/PerfLog.h diff --git a/Pinger.cpp b/srchybrid/Pinger.cpp similarity index 100% rename from Pinger.cpp rename to srchybrid/Pinger.cpp diff --git a/Pinger.h b/srchybrid/Pinger.h similarity index 100% rename from Pinger.h rename to srchybrid/Pinger.h diff --git a/Preferences.cpp b/srchybrid/Preferences.cpp similarity index 100% rename from Preferences.cpp rename to srchybrid/Preferences.cpp diff --git a/Preferences.h b/srchybrid/Preferences.h similarity index 100% rename from Preferences.h rename to srchybrid/Preferences.h diff --git a/PreferencesDlg.cpp b/srchybrid/PreferencesDlg.cpp similarity index 100% rename from PreferencesDlg.cpp rename to srchybrid/PreferencesDlg.cpp diff --git a/PreferencesDlg.h b/srchybrid/PreferencesDlg.h similarity index 100% rename from PreferencesDlg.h rename to srchybrid/PreferencesDlg.h diff --git a/Preview.cpp b/srchybrid/Preview.cpp similarity index 100% rename from Preview.cpp rename to srchybrid/Preview.cpp diff --git a/Preview.h b/srchybrid/Preview.h similarity index 100% rename from Preview.h rename to srchybrid/Preview.h diff --git a/PreviewDlg.cpp b/srchybrid/PreviewDlg.cpp similarity index 100% rename from PreviewDlg.cpp rename to srchybrid/PreviewDlg.cpp diff --git a/PreviewDlg.h b/srchybrid/PreviewDlg.h similarity index 100% rename from PreviewDlg.h rename to srchybrid/PreviewDlg.h diff --git a/ProgressCtrlX.cpp b/srchybrid/ProgressCtrlX.cpp similarity index 100% rename from ProgressCtrlX.cpp rename to srchybrid/ProgressCtrlX.cpp diff --git a/ProgressCtrlX.h b/srchybrid/ProgressCtrlX.h similarity index 100% rename from ProgressCtrlX.h rename to srchybrid/ProgressCtrlX.h diff --git a/QArray.h b/srchybrid/QArray.h similarity index 100% rename from QArray.h rename to srchybrid/QArray.h diff --git a/Quantize.cpp b/srchybrid/Quantize.cpp similarity index 100% rename from Quantize.cpp rename to srchybrid/Quantize.cpp diff --git a/Quantize.h b/srchybrid/Quantize.h similarity index 100% rename from Quantize.h rename to srchybrid/Quantize.h diff --git a/QueueListCtrl.cpp b/srchybrid/QueueListCtrl.cpp similarity index 100% rename from QueueListCtrl.cpp rename to srchybrid/QueueListCtrl.cpp diff --git a/QueueListCtrl.h b/srchybrid/QueueListCtrl.h similarity index 100% rename from QueueListCtrl.h rename to srchybrid/QueueListCtrl.h diff --git a/RARFile.cpp b/srchybrid/RARFile.cpp similarity index 100% rename from RARFile.cpp rename to srchybrid/RARFile.cpp diff --git a/RARFile.h b/srchybrid/RARFile.h similarity index 100% rename from RARFile.h rename to srchybrid/RARFile.h diff --git a/ReadWriteLock.cpp b/srchybrid/ReadWriteLock.cpp similarity index 100% rename from ReadWriteLock.cpp rename to srchybrid/ReadWriteLock.cpp diff --git a/ReadWriteLock.h b/srchybrid/ReadWriteLock.h similarity index 100% rename from ReadWriteLock.h rename to srchybrid/ReadWriteLock.h diff --git a/RichEditCtrlX.cpp b/srchybrid/RichEditCtrlX.cpp similarity index 100% rename from RichEditCtrlX.cpp rename to srchybrid/RichEditCtrlX.cpp diff --git a/RichEditCtrlX.h b/srchybrid/RichEditCtrlX.h similarity index 100% rename from RichEditCtrlX.h rename to srchybrid/RichEditCtrlX.h diff --git a/RichEditStream.cpp b/srchybrid/RichEditStream.cpp similarity index 100% rename from RichEditStream.cpp rename to srchybrid/RichEditStream.cpp diff --git a/RichEditStream.h b/srchybrid/RichEditStream.h similarity index 100% rename from RichEditStream.h rename to srchybrid/RichEditStream.h diff --git a/SHA.cpp b/srchybrid/SHA.cpp similarity index 100% rename from SHA.cpp rename to srchybrid/SHA.cpp diff --git a/SHA.h b/srchybrid/SHA.h similarity index 100% rename from SHA.h rename to srchybrid/SHA.h diff --git a/SHAHashSet.cpp b/srchybrid/SHAHashSet.cpp similarity index 100% rename from SHAHashSet.cpp rename to srchybrid/SHAHashSet.cpp diff --git a/SHAHashSet.h b/srchybrid/SHAHashSet.h similarity index 100% rename from SHAHashSet.h rename to srchybrid/SHAHashSet.h diff --git a/SHA_asm.asm b/srchybrid/SHA_asm.asm similarity index 100% rename from SHA_asm.asm rename to srchybrid/SHA_asm.asm diff --git a/SR13-ImportParts.cpp b/srchybrid/SR13-ImportParts.cpp similarity index 100% rename from SR13-ImportParts.cpp rename to srchybrid/SR13-ImportParts.cpp diff --git a/SR13-ImportParts.h b/srchybrid/SR13-ImportParts.h similarity index 100% rename from SR13-ImportParts.h rename to srchybrid/SR13-ImportParts.h diff --git a/SafeFile.cpp b/srchybrid/SafeFile.cpp similarity index 100% rename from SafeFile.cpp rename to srchybrid/SafeFile.cpp diff --git a/SafeFile.h b/srchybrid/SafeFile.h similarity index 100% rename from SafeFile.h rename to srchybrid/SafeFile.h diff --git a/Scanner.cpp b/srchybrid/Scanner.cpp similarity index 100% rename from Scanner.cpp rename to srchybrid/Scanner.cpp diff --git a/Scanner.h b/srchybrid/Scanner.h similarity index 100% rename from Scanner.h rename to srchybrid/Scanner.h diff --git a/Scanner.l b/srchybrid/Scanner.l similarity index 100% rename from Scanner.l rename to srchybrid/Scanner.l diff --git a/Scheduler.cpp b/srchybrid/Scheduler.cpp similarity index 100% rename from Scheduler.cpp rename to srchybrid/Scheduler.cpp diff --git a/Scheduler.h b/srchybrid/Scheduler.h similarity index 100% rename from Scheduler.h rename to srchybrid/Scheduler.h diff --git a/SearchDlg.cpp b/srchybrid/SearchDlg.cpp similarity index 100% rename from SearchDlg.cpp rename to srchybrid/SearchDlg.cpp diff --git a/SearchDlg.h b/srchybrid/SearchDlg.h similarity index 100% rename from SearchDlg.h rename to srchybrid/SearchDlg.h diff --git a/SearchExpr.h b/srchybrid/SearchExpr.h similarity index 100% rename from SearchExpr.h rename to srchybrid/SearchExpr.h diff --git a/SearchFile.cpp b/srchybrid/SearchFile.cpp similarity index 100% rename from SearchFile.cpp rename to srchybrid/SearchFile.cpp diff --git a/SearchFile.h b/srchybrid/SearchFile.h similarity index 100% rename from SearchFile.h rename to srchybrid/SearchFile.h diff --git a/SearchList.cpp b/srchybrid/SearchList.cpp similarity index 100% rename from SearchList.cpp rename to srchybrid/SearchList.cpp diff --git a/SearchList.h b/srchybrid/SearchList.h similarity index 100% rename from SearchList.h rename to srchybrid/SearchList.h diff --git a/SearchListCtrl.cpp b/srchybrid/SearchListCtrl.cpp similarity index 100% rename from SearchListCtrl.cpp rename to srchybrid/SearchListCtrl.cpp diff --git a/SearchListCtrl.h b/srchybrid/SearchListCtrl.h similarity index 100% rename from SearchListCtrl.h rename to srchybrid/SearchListCtrl.h diff --git a/SearchParams.h b/srchybrid/SearchParams.h similarity index 100% rename from SearchParams.h rename to srchybrid/SearchParams.h diff --git a/SearchParamsWnd.cpp b/srchybrid/SearchParamsWnd.cpp similarity index 100% rename from SearchParamsWnd.cpp rename to srchybrid/SearchParamsWnd.cpp diff --git a/SearchParamsWnd.h b/srchybrid/SearchParamsWnd.h similarity index 100% rename from SearchParamsWnd.h rename to srchybrid/SearchParamsWnd.h diff --git a/SearchResultsWnd.cpp b/srchybrid/SearchResultsWnd.cpp similarity index 100% rename from SearchResultsWnd.cpp rename to srchybrid/SearchResultsWnd.cpp diff --git a/SearchResultsWnd.h b/srchybrid/SearchResultsWnd.h similarity index 100% rename from SearchResultsWnd.h rename to srchybrid/SearchResultsWnd.h diff --git a/SecRunAsUser.cpp b/srchybrid/SecRunAsUser.cpp similarity index 100% rename from SecRunAsUser.cpp rename to srchybrid/SecRunAsUser.cpp diff --git a/SecRunAsUser.h b/srchybrid/SecRunAsUser.h similarity index 100% rename from SecRunAsUser.h rename to srchybrid/SecRunAsUser.h diff --git a/SelCategoryDlg.cpp b/srchybrid/SelCategoryDlg.cpp similarity index 100% rename from SelCategoryDlg.cpp rename to srchybrid/SelCategoryDlg.cpp diff --git a/SelCategoryDlg.h b/srchybrid/SelCategoryDlg.h similarity index 100% rename from SelCategoryDlg.h rename to srchybrid/SelCategoryDlg.h diff --git a/SelfTest.cpp b/srchybrid/SelfTest.cpp similarity index 100% rename from SelfTest.cpp rename to srchybrid/SelfTest.cpp diff --git a/SendMail.cpp b/srchybrid/SendMail.cpp similarity index 100% rename from SendMail.cpp rename to srchybrid/SendMail.cpp diff --git a/SendMail.h b/srchybrid/SendMail.h similarity index 100% rename from SendMail.h rename to srchybrid/SendMail.h diff --git a/ServerList.cpp b/srchybrid/ServerList.cpp similarity index 100% rename from ServerList.cpp rename to srchybrid/ServerList.cpp diff --git a/ServerList.h b/srchybrid/ServerList.h similarity index 100% rename from ServerList.h rename to srchybrid/ServerList.h diff --git a/ServerListCtrl.cpp b/srchybrid/ServerListCtrl.cpp similarity index 100% rename from ServerListCtrl.cpp rename to srchybrid/ServerListCtrl.cpp diff --git a/ServerListCtrl.h b/srchybrid/ServerListCtrl.h similarity index 100% rename from ServerListCtrl.h rename to srchybrid/ServerListCtrl.h diff --git a/ServerSocket.cpp b/srchybrid/ServerSocket.cpp similarity index 100% rename from ServerSocket.cpp rename to srchybrid/ServerSocket.cpp diff --git a/ServerSocket.h b/srchybrid/ServerSocket.h similarity index 100% rename from ServerSocket.h rename to srchybrid/ServerSocket.h diff --git a/ServerWnd.cpp b/srchybrid/ServerWnd.cpp similarity index 100% rename from ServerWnd.cpp rename to srchybrid/ServerWnd.cpp diff --git a/ServerWnd.h b/srchybrid/ServerWnd.h similarity index 100% rename from ServerWnd.h rename to srchybrid/ServerWnd.h diff --git a/SettingsSaver.cpp b/srchybrid/SettingsSaver.cpp similarity index 100% rename from SettingsSaver.cpp rename to srchybrid/SettingsSaver.cpp diff --git a/SettingsSaver.h b/srchybrid/SettingsSaver.h similarity index 100% rename from SettingsSaver.h rename to srchybrid/SettingsSaver.h diff --git a/ShareableFile.cpp b/srchybrid/ShareableFile.cpp similarity index 100% rename from ShareableFile.cpp rename to srchybrid/ShareableFile.cpp diff --git a/ShareableFile.h b/srchybrid/ShareableFile.h similarity index 100% rename from ShareableFile.h rename to srchybrid/ShareableFile.h diff --git a/SharedDirsTreeCtrl.cpp b/srchybrid/SharedDirsTreeCtrl.cpp similarity index 100% rename from SharedDirsTreeCtrl.cpp rename to srchybrid/SharedDirsTreeCtrl.cpp diff --git a/SharedDirsTreeCtrl.h b/srchybrid/SharedDirsTreeCtrl.h similarity index 100% rename from SharedDirsTreeCtrl.h rename to srchybrid/SharedDirsTreeCtrl.h diff --git a/SharedFileList.cpp b/srchybrid/SharedFileList.cpp similarity index 99% rename from SharedFileList.cpp rename to srchybrid/SharedFileList.cpp index 02b2ed2..e2ce386 100644 --- a/SharedFileList.cpp +++ b/srchybrid/SharedFileList.cpp @@ -1402,6 +1402,7 @@ CKnownFile* CSharedFileList::GetFileByIdentifier(const CFileIdentifierBase& rFil } + bool CSharedFileList::IsFilePtrInList(const CKnownFile* file) const { if (file) diff --git a/SharedFileList.h b/srchybrid/SharedFileList.h similarity index 96% rename from SharedFileList.h rename to srchybrid/SharedFileList.h index 4e90f81..18d0278 100644 --- a/SharedFileList.h +++ b/srchybrid/SharedFileList.h @@ -78,6 +78,14 @@ class CSharedFileList CKnownFile* GetFileByID(const uchar* filehash) const; CKnownFile* GetFileByIdentifier(const CFileIdentifierBase& rFileIdent, bool bStrict = false) const; CKnownFile* GetFileByIndex(int index); + POSITION usedToFindByNumber; + void FindHeadKnownFile() { usedToFindByNumber = m_Files_map.GetStartPosition(); } + CKnownFile* FindNextKnownFile() { + CKnownFile* cur_file; + CCKey key; + m_Files_map.GetNextAssoc(usedToFindByNumber, key, cur_file); + return cur_file; + } bool IsFilePtrInList(const CKnownFile* file) const; // slow bool IsUnsharedFile(const uchar* auFileHash) const; bool ShouldBeShared(CString strPath, CString strFilePath, bool bMustBeShared) const; diff --git a/SharedFilesCtrl.cpp b/srchybrid/SharedFilesCtrl.cpp similarity index 100% rename from SharedFilesCtrl.cpp rename to srchybrid/SharedFilesCtrl.cpp diff --git a/SharedFilesCtrl.h b/srchybrid/SharedFilesCtrl.h similarity index 100% rename from SharedFilesCtrl.h rename to srchybrid/SharedFilesCtrl.h diff --git a/SharedFilesWnd.cpp b/srchybrid/SharedFilesWnd.cpp similarity index 100% rename from SharedFilesWnd.cpp rename to srchybrid/SharedFilesWnd.cpp diff --git a/SharedFilesWnd.h b/srchybrid/SharedFilesWnd.h similarity index 100% rename from SharedFilesWnd.h rename to srchybrid/SharedFilesWnd.h diff --git a/SimpleCleanup.cpp b/srchybrid/SimpleCleanup.cpp similarity index 100% rename from SimpleCleanup.cpp rename to srchybrid/SimpleCleanup.cpp diff --git a/SimpleCleanup.h b/srchybrid/SimpleCleanup.h similarity index 100% rename from SimpleCleanup.h rename to srchybrid/SimpleCleanup.h diff --git a/SivkaFileSettings.cpp b/srchybrid/SivkaFileSettings.cpp similarity index 100% rename from SivkaFileSettings.cpp rename to srchybrid/SivkaFileSettings.cpp diff --git a/SivkaFileSettings.h b/srchybrid/SivkaFileSettings.h similarity index 100% rename from SivkaFileSettings.h rename to srchybrid/SivkaFileSettings.h diff --git a/SmileySelector.cpp b/srchybrid/SmileySelector.cpp similarity index 100% rename from SmileySelector.cpp rename to srchybrid/SmileySelector.cpp diff --git a/SmileySelector.h b/srchybrid/SmileySelector.h similarity index 100% rename from SmileySelector.h rename to srchybrid/SmileySelector.h diff --git a/SourceSaver.cpp b/srchybrid/SourceSaver.cpp similarity index 100% rename from SourceSaver.cpp rename to srchybrid/SourceSaver.cpp diff --git a/SourceSaver.h b/srchybrid/SourceSaver.h similarity index 100% rename from SourceSaver.h rename to srchybrid/SourceSaver.h diff --git a/SpeedGraph.cpp b/srchybrid/SpeedGraph.cpp similarity index 100% rename from SpeedGraph.cpp rename to srchybrid/SpeedGraph.cpp diff --git a/SpeedGraph.h b/srchybrid/SpeedGraph.h similarity index 100% rename from SpeedGraph.h rename to srchybrid/SpeedGraph.h diff --git a/SplashScreen.cpp b/srchybrid/SplashScreen.cpp similarity index 100% rename from SplashScreen.cpp rename to srchybrid/SplashScreen.cpp diff --git a/SplashScreen.h b/srchybrid/SplashScreen.h similarity index 100% rename from SplashScreen.h rename to srchybrid/SplashScreen.h diff --git a/SplashScreenEx.cpp b/srchybrid/SplashScreenEx.cpp similarity index 100% rename from SplashScreenEx.cpp rename to srchybrid/SplashScreenEx.cpp diff --git a/SplashScreenEx.h b/srchybrid/SplashScreenEx.h similarity index 100% rename from SplashScreenEx.h rename to srchybrid/SplashScreenEx.h diff --git a/SplitterControl.cpp b/srchybrid/SplitterControl.cpp similarity index 100% rename from SplitterControl.cpp rename to srchybrid/SplitterControl.cpp diff --git a/SplitterControl.h b/srchybrid/SplitterControl.h similarity index 100% rename from SplitterControl.h rename to srchybrid/SplitterControl.h diff --git a/StatisticFile.cpp b/srchybrid/StatisticFile.cpp similarity index 100% rename from StatisticFile.cpp rename to srchybrid/StatisticFile.cpp diff --git a/StatisticFile.h b/srchybrid/StatisticFile.h similarity index 100% rename from StatisticFile.h rename to srchybrid/StatisticFile.h diff --git a/Statistics.cpp b/srchybrid/Statistics.cpp similarity index 100% rename from Statistics.cpp rename to srchybrid/Statistics.cpp diff --git a/Statistics.h b/srchybrid/Statistics.h similarity index 100% rename from Statistics.h rename to srchybrid/Statistics.h diff --git a/StatisticsDlg.cpp b/srchybrid/StatisticsDlg.cpp similarity index 100% rename from StatisticsDlg.cpp rename to srchybrid/StatisticsDlg.cpp diff --git a/StatisticsDlg.h b/srchybrid/StatisticsDlg.h similarity index 100% rename from StatisticsDlg.h rename to srchybrid/StatisticsDlg.h diff --git a/StatisticsTree.cpp b/srchybrid/StatisticsTree.cpp similarity index 100% rename from StatisticsTree.cpp rename to srchybrid/StatisticsTree.cpp diff --git a/StatisticsTree.h b/srchybrid/StatisticsTree.h similarity index 100% rename from StatisticsTree.h rename to srchybrid/StatisticsTree.h diff --git a/StringConversion.cpp b/srchybrid/StringConversion.cpp similarity index 100% rename from StringConversion.cpp rename to srchybrid/StringConversion.cpp diff --git a/StringConversion.h b/srchybrid/StringConversion.h similarity index 100% rename from StringConversion.h rename to srchybrid/StringConversion.h diff --git a/TaskbarNotifier.cpp b/srchybrid/TaskbarNotifier.cpp similarity index 100% rename from TaskbarNotifier.cpp rename to srchybrid/TaskbarNotifier.cpp diff --git a/TaskbarNotifier.h b/srchybrid/TaskbarNotifier.h similarity index 100% rename from TaskbarNotifier.h rename to srchybrid/TaskbarNotifier.h diff --git a/TextToSpeech.cpp b/srchybrid/TextToSpeech.cpp similarity index 100% rename from TextToSpeech.cpp rename to srchybrid/TextToSpeech.cpp diff --git a/TextToSpeech.h b/srchybrid/TextToSpeech.h similarity index 100% rename from TextToSpeech.h rename to srchybrid/TextToSpeech.h diff --git a/ThrottledSocket.h b/srchybrid/ThrottledSocket.h similarity index 100% rename from ThrottledSocket.h rename to srchybrid/ThrottledSocket.h diff --git a/TimeTick.cpp b/srchybrid/TimeTick.cpp similarity index 100% rename from TimeTick.cpp rename to srchybrid/TimeTick.cpp diff --git a/TimeTick.h b/srchybrid/TimeTick.h similarity index 100% rename from TimeTick.h rename to srchybrid/TimeTick.h diff --git a/ToolBarCtrlX.cpp b/srchybrid/ToolBarCtrlX.cpp similarity index 100% rename from ToolBarCtrlX.cpp rename to srchybrid/ToolBarCtrlX.cpp diff --git a/ToolBarCtrlX.h b/srchybrid/ToolBarCtrlX.h similarity index 100% rename from ToolBarCtrlX.h rename to srchybrid/ToolBarCtrlX.h diff --git a/ToolTipCtrlX.cpp b/srchybrid/ToolTipCtrlX.cpp similarity index 100% rename from ToolTipCtrlX.cpp rename to srchybrid/ToolTipCtrlX.cpp diff --git a/ToolTipCtrlX.h b/srchybrid/ToolTipCtrlX.h similarity index 100% rename from ToolTipCtrlX.h rename to srchybrid/ToolTipCtrlX.h diff --git a/ToolbarWnd.cpp b/srchybrid/ToolbarWnd.cpp similarity index 100% rename from ToolbarWnd.cpp rename to srchybrid/ToolbarWnd.cpp diff --git a/ToolbarWnd.h b/srchybrid/ToolbarWnd.h similarity index 100% rename from ToolbarWnd.h rename to srchybrid/ToolbarWnd.h diff --git a/TransferDlg.cpp b/srchybrid/TransferDlg.cpp similarity index 100% rename from TransferDlg.cpp rename to srchybrid/TransferDlg.cpp diff --git a/TransferDlg.h b/srchybrid/TransferDlg.h similarity index 100% rename from TransferDlg.h rename to srchybrid/TransferDlg.h diff --git a/TransferWnd.cpp b/srchybrid/TransferWnd.cpp similarity index 100% rename from TransferWnd.cpp rename to srchybrid/TransferWnd.cpp diff --git a/TransferWnd.h b/srchybrid/TransferWnd.h similarity index 100% rename from TransferWnd.h rename to srchybrid/TransferWnd.h diff --git a/TrayDialog.cpp b/srchybrid/TrayDialog.cpp similarity index 100% rename from TrayDialog.cpp rename to srchybrid/TrayDialog.cpp diff --git a/TrayDialog.h b/srchybrid/TrayDialog.h similarity index 100% rename from TrayDialog.h rename to srchybrid/TrayDialog.h diff --git a/TrayMenuBtn.cpp b/srchybrid/TrayMenuBtn.cpp similarity index 100% rename from TrayMenuBtn.cpp rename to srchybrid/TrayMenuBtn.cpp diff --git a/TrayMenuBtn.h b/srchybrid/TrayMenuBtn.h similarity index 100% rename from TrayMenuBtn.h rename to srchybrid/TrayMenuBtn.h diff --git a/TreeOptionsCtrl.cpp b/srchybrid/TreeOptionsCtrl.cpp similarity index 100% rename from TreeOptionsCtrl.cpp rename to srchybrid/TreeOptionsCtrl.cpp diff --git a/TreeOptionsCtrl.h b/srchybrid/TreeOptionsCtrl.h similarity index 100% rename from TreeOptionsCtrl.h rename to srchybrid/TreeOptionsCtrl.h diff --git a/TreeOptionsCtrlEx.cpp b/srchybrid/TreeOptionsCtrlEx.cpp similarity index 100% rename from TreeOptionsCtrlEx.cpp rename to srchybrid/TreeOptionsCtrlEx.cpp diff --git a/TreeOptionsCtrlEx.h b/srchybrid/TreeOptionsCtrlEx.h similarity index 100% rename from TreeOptionsCtrlEx.h rename to srchybrid/TreeOptionsCtrlEx.h diff --git a/TreeOptionsInvisibleKeyCombo.cpp b/srchybrid/TreeOptionsInvisibleKeyCombo.cpp similarity index 100% rename from TreeOptionsInvisibleKeyCombo.cpp rename to srchybrid/TreeOptionsInvisibleKeyCombo.cpp diff --git a/TreeOptionsInvisibleKeyCombo.h b/srchybrid/TreeOptionsInvisibleKeyCombo.h similarity index 100% rename from TreeOptionsInvisibleKeyCombo.h rename to srchybrid/TreeOptionsInvisibleKeyCombo.h diff --git a/TreeOptionsInvisibleModCombo.cpp b/srchybrid/TreeOptionsInvisibleModCombo.cpp similarity index 100% rename from TreeOptionsInvisibleModCombo.cpp rename to srchybrid/TreeOptionsInvisibleModCombo.cpp diff --git a/TreeOptionsInvisibleModCombo.h b/srchybrid/TreeOptionsInvisibleModCombo.h similarity index 100% rename from TreeOptionsInvisibleModCombo.h rename to srchybrid/TreeOptionsInvisibleModCombo.h diff --git a/TreePropSheet.cpp b/srchybrid/TreePropSheet.cpp similarity index 100% rename from TreePropSheet.cpp rename to srchybrid/TreePropSheet.cpp diff --git a/TreePropSheet.h b/srchybrid/TreePropSheet.h similarity index 100% rename from TreePropSheet.h rename to srchybrid/TreePropSheet.h diff --git a/TreePropSheetPgFrame.cpp b/srchybrid/TreePropSheetPgFrame.cpp similarity index 100% rename from TreePropSheetPgFrame.cpp rename to srchybrid/TreePropSheetPgFrame.cpp diff --git a/TreePropSheetPgFrame.h b/srchybrid/TreePropSheetPgFrame.h similarity index 100% rename from TreePropSheetPgFrame.h rename to srchybrid/TreePropSheetPgFrame.h diff --git a/TreePropSheetPgFrameDef.cpp b/srchybrid/TreePropSheetPgFrameDef.cpp similarity index 100% rename from TreePropSheetPgFrameDef.cpp rename to srchybrid/TreePropSheetPgFrameDef.cpp diff --git a/TreePropSheetPgFrameDef.h b/srchybrid/TreePropSheetPgFrameDef.h similarity index 100% rename from TreePropSheetPgFrameDef.h rename to srchybrid/TreePropSheetPgFrameDef.h diff --git a/UDPSocket.cpp b/srchybrid/UDPSocket.cpp similarity index 100% rename from UDPSocket.cpp rename to srchybrid/UDPSocket.cpp diff --git a/UDPSocket.h b/srchybrid/UDPSocket.h similarity index 100% rename from UDPSocket.h rename to srchybrid/UDPSocket.h diff --git a/UPnP_IGDControlPoint.cpp b/srchybrid/UPnP_IGDControlPoint.cpp similarity index 100% rename from UPnP_IGDControlPoint.cpp rename to srchybrid/UPnP_IGDControlPoint.cpp diff --git a/UPnP_IGDControlPoint.h b/srchybrid/UPnP_IGDControlPoint.h similarity index 100% rename from UPnP_IGDControlPoint.h rename to srchybrid/UPnP_IGDControlPoint.h diff --git a/URLClient.cpp b/srchybrid/URLClient.cpp similarity index 100% rename from URLClient.cpp rename to srchybrid/URLClient.cpp diff --git a/URLClient.h b/srchybrid/URLClient.h similarity index 100% rename from URLClient.h rename to srchybrid/URLClient.h diff --git a/UploadBandwidthThrottler.cpp b/srchybrid/UploadBandwidthThrottler.cpp similarity index 100% rename from UploadBandwidthThrottler.cpp rename to srchybrid/UploadBandwidthThrottler.cpp diff --git a/UploadBandwidthThrottler.h b/srchybrid/UploadBandwidthThrottler.h similarity index 100% rename from UploadBandwidthThrottler.h rename to srchybrid/UploadBandwidthThrottler.h diff --git a/UploadClient.cpp b/srchybrid/UploadClient.cpp similarity index 100% rename from UploadClient.cpp rename to srchybrid/UploadClient.cpp diff --git a/UploadListCtrl.cpp b/srchybrid/UploadListCtrl.cpp similarity index 100% rename from UploadListCtrl.cpp rename to srchybrid/UploadListCtrl.cpp diff --git a/UploadListCtrl.h b/srchybrid/UploadListCtrl.h similarity index 100% rename from UploadListCtrl.h rename to srchybrid/UploadListCtrl.h diff --git a/UploadQueue.cpp b/srchybrid/UploadQueue.cpp similarity index 100% rename from UploadQueue.cpp rename to srchybrid/UploadQueue.cpp diff --git a/UploadQueue.h b/srchybrid/UploadQueue.h similarity index 100% rename from UploadQueue.h rename to srchybrid/UploadQueue.h diff --git a/UserMsgs.h b/srchybrid/UserMsgs.h similarity index 100% rename from UserMsgs.h rename to srchybrid/UserMsgs.h diff --git a/Version.cpp b/srchybrid/Version.cpp similarity index 100% rename from Version.cpp rename to srchybrid/Version.cpp diff --git a/Version.h b/srchybrid/Version.h similarity index 100% rename from Version.h rename to srchybrid/Version.h diff --git a/VistaDefines.h b/srchybrid/VistaDefines.h similarity index 100% rename from VistaDefines.h rename to srchybrid/VistaDefines.h diff --git a/VisualStylesXP.cpp b/srchybrid/VisualStylesXP.cpp similarity index 100% rename from VisualStylesXP.cpp rename to srchybrid/VisualStylesXP.cpp diff --git a/VisualStylesXP.h b/srchybrid/VisualStylesXP.h similarity index 100% rename from VisualStylesXP.h rename to srchybrid/VisualStylesXP.h diff --git a/WMSDK/include9/WMSInternalAdminNetsource.idl b/srchybrid/WMSDK/include9/WMSInternalAdminNetsource.idl similarity index 100% rename from WMSDK/include9/WMSInternalAdminNetsource.idl rename to srchybrid/WMSDK/include9/WMSInternalAdminNetsource.idl diff --git a/WMSDK/include9/asferr.h b/srchybrid/WMSDK/include9/asferr.h similarity index 100% rename from WMSDK/include9/asferr.h rename to srchybrid/WMSDK/include9/asferr.h diff --git a/WMSDK/include9/drmexternals.h b/srchybrid/WMSDK/include9/drmexternals.h similarity index 100% rename from WMSDK/include9/drmexternals.h rename to srchybrid/WMSDK/include9/drmexternals.h diff --git a/WMSDK/include9/drmexternals.idl b/srchybrid/WMSDK/include9/drmexternals.idl similarity index 100% rename from WMSDK/include9/drmexternals.idl rename to srchybrid/WMSDK/include9/drmexternals.idl diff --git a/WMSDK/include9/dshowasf.h b/srchybrid/WMSDK/include9/dshowasf.h similarity index 100% rename from WMSDK/include9/dshowasf.h rename to srchybrid/WMSDK/include9/dshowasf.h diff --git a/WMSDK/include9/dshowasf.idl b/srchybrid/WMSDK/include9/dshowasf.idl similarity index 100% rename from WMSDK/include9/dshowasf.idl rename to srchybrid/WMSDK/include9/dshowasf.idl diff --git a/WMSDK/include9/nserror.h b/srchybrid/WMSDK/include9/nserror.h similarity index 100% rename from WMSDK/include9/nserror.h rename to srchybrid/WMSDK/include9/nserror.h diff --git a/WMSDK/include9/wmdxva.h b/srchybrid/WMSDK/include9/wmdxva.h similarity index 100% rename from WMSDK/include9/wmdxva.h rename to srchybrid/WMSDK/include9/wmdxva.h diff --git a/WMSDK/include9/wmdxva.idl b/srchybrid/WMSDK/include9/wmdxva.idl similarity index 100% rename from WMSDK/include9/wmdxva.idl rename to srchybrid/WMSDK/include9/wmdxva.idl diff --git a/WMSDK/include9/wmnetsourcecreator.h b/srchybrid/WMSDK/include9/wmnetsourcecreator.h similarity index 100% rename from WMSDK/include9/wmnetsourcecreator.h rename to srchybrid/WMSDK/include9/wmnetsourcecreator.h diff --git a/WMSDK/include9/wmnetsourcecreator.idl b/srchybrid/WMSDK/include9/wmnetsourcecreator.idl similarity index 100% rename from WMSDK/include9/wmnetsourcecreator.idl rename to srchybrid/WMSDK/include9/wmnetsourcecreator.idl diff --git a/WMSDK/include9/wmsbuffer.h b/srchybrid/WMSDK/include9/wmsbuffer.h similarity index 100% rename from WMSDK/include9/wmsbuffer.h rename to srchybrid/WMSDK/include9/wmsbuffer.h diff --git a/WMSDK/include9/wmsbuffer.idl b/srchybrid/WMSDK/include9/wmsbuffer.idl similarity index 100% rename from WMSDK/include9/wmsbuffer.idl rename to srchybrid/WMSDK/include9/wmsbuffer.idl diff --git a/WMSDK/include9/wmsdk.h b/srchybrid/WMSDK/include9/wmsdk.h similarity index 100% rename from WMSDK/include9/wmsdk.h rename to srchybrid/WMSDK/include9/wmsdk.h diff --git a/WMSDK/include9/wmsdkidl.h b/srchybrid/WMSDK/include9/wmsdkidl.h similarity index 100% rename from WMSDK/include9/wmsdkidl.h rename to srchybrid/WMSDK/include9/wmsdkidl.h diff --git a/WMSDK/include9/wmsdkidl.idl b/srchybrid/WMSDK/include9/wmsdkidl.idl similarity index 100% rename from WMSDK/include9/wmsdkidl.idl rename to srchybrid/WMSDK/include9/wmsdkidl.idl diff --git a/WMSDK/include9/wmsdkvalidate.h b/srchybrid/WMSDK/include9/wmsdkvalidate.h similarity index 100% rename from WMSDK/include9/wmsdkvalidate.h rename to srchybrid/WMSDK/include9/wmsdkvalidate.h diff --git a/WMSDK/include9/wmsinternaladminnetsource.h b/srchybrid/WMSDK/include9/wmsinternaladminnetsource.h similarity index 100% rename from WMSDK/include9/wmsinternaladminnetsource.h rename to srchybrid/WMSDK/include9/wmsinternaladminnetsource.h diff --git a/WMSDK/include9/wmsysprf.h b/srchybrid/WMSDK/include9/wmsysprf.h similarity index 100% rename from WMSDK/include9/wmsysprf.h rename to srchybrid/WMSDK/include9/wmsysprf.h diff --git a/WMSDK/lib9/WMVCORE.lib b/srchybrid/WMSDK/lib9/WMVCORE.lib similarity index 100% rename from WMSDK/lib9/WMVCORE.lib rename to srchybrid/WMSDK/lib9/WMVCORE.lib diff --git a/WebServer.cpp b/srchybrid/WebServer.cpp similarity index 100% rename from WebServer.cpp rename to srchybrid/WebServer.cpp diff --git a/WebServer.h b/srchybrid/WebServer.h similarity index 99% rename from WebServer.h rename to srchybrid/WebServer.h index 1f48756..3a8d9c1 100644 --- a/WebServer.h +++ b/srchybrid/WebServer.h @@ -347,6 +347,7 @@ struct WebServDef{ class CWebServer { friend class CWebSocket; + friend class WebServerRESTAPI; public: CWebServer(void); diff --git a/srchybrid/WebServerRESTAPI.cpp b/srchybrid/WebServerRESTAPI.cpp new file mode 100644 index 0000000..8097a68 --- /dev/null +++ b/srchybrid/WebServerRESTAPI.cpp @@ -0,0 +1,654 @@ +#include "stdafx.h" +#include +#include "emule.h" +#include "StringConversion.h" +#include "WebServer.h" +#include "ClientCredits.h" +#include "ClientList.h" +#include "DownloadQueue.h" +#include "ED2KLink.h" +#include "emuledlg.h" +#include "FriendList.h" +#include "MD5Sum.h" +#include "ini2.h" +#include "Kademlia/Kademlia/Kademlia.h" +#include "KademliaWnd.h" +#include "KadSearchListCtrl.h" +#include "kademlia/kademlia/Entry.h" +#include "KnownFileList.h" +#include "ListenSocket.h" +#include "Log.h" +#include "MenuCmds.h" +#include "OtherFunctions.h" +#include "Preferences.h" +#include "Server.h" +#include "ServerList.h" +#include "ServerWnd.h" +#include "SearchList.h" +#include "SearchDlg.h" +#include "SearchParams.h" +#include "SharedFileList.h" +#include "Sockets.h" +#include "StatisticsDlg.h" +#include "Opcodes.h" +#include "QArray.h" +#include "TransferDlg.h" +#include "UploadQueue.h" +#include "UpDownClient.h" +#include "UserMsgs.h" + +#include "WebServerRESTAPI.h" +#include "SafeFile.h" +#include "Kademlia/Utils/KadClientSearcher.h" +#include +#include "Friend.h" +#include "emuledlg.h" +#include "FriendListCtrl.h" +#include "Packets.h" +#include "clientlist.h" + +using namespace rapidjson; + +#ifdef DEBUG +static const char* JSONInit = "Server: eMule REST API\r\nConnection: close\r\nContent-Type: application/json; charset=UTF-8\r\nAccess-Control-Allow-Origin: *\r\n"; +#else +static const char* JSONInit = "Server: eMule REST API\r\nConnection: close\r\nContent-Type: application/json; charset=UTF-8\r\n"; +#endif // DEBUG + + +class JSONWriter :public WriterT { +public: + JSONWriter(StringBufferT&os) :WriterT(os) {} + + //或许需要增加emule的版本?并像游览器一样提供操作系统等的信息? By 柚子 + //这个事情在WebServerRESTAPI类中来做可能更合适 + //Object应该读取那些种类的数据? + void Object(CServer* server){ + StartObject(); + Key(_T("name")); String(server->GetListName()); + Key(_T("address")); String(server->GetAddress()); + Key(_T("port")); Uint(server->GetPort()); + Key(_T("description")); String(server->GetDescription()); + Key(_T("IP")); Uint(server->GetIP()); + Key(_T("IPstr")); String(server->GetFullIP()); + Key(_T("files")); Uint(server->GetFiles()); + Key(_T("users")); Uint(server->GetUsers()); + Key(_T("preference")); Uint(server->GetPreference()); + Key(_T("ping")); Uint(server->GetPing()); + Key(_T("failedCount")); Uint(server->GetFailedCount()); + Key(_T("lastPinged")); Uint(server->GetLastPinged()); + Key(_T("lastDescPingedCount")); Uint(server->GetLastDescPingedCount()); + Key(_T("isStaticMember")); Bool(server->IsStaticMember()); + Key(_T("softFiles")); Uint(server->GetSoftFiles()); + Key(_T("hardFiles")); Uint(server->GetHardFiles()); + Key(_T("version")); String(server->GetVersion()); + Key(_T("lowIDUsers")); Uint(server->GetLowIDUsers()); + //删除了不必要的项目 by Yuzu @ 2016-6-1 15:45 + EndObject(); + } + + //我正在尝试写一个返回好友的函数,因为好友列表所需要返回的数据相对独立 + //我忽然想到 WriteObiect的函数名或许有歧义, + //可能与前端操作对象(比如增加好友)的函数名重复?@ 2016-5-24 3:00 + //CFriend类的风格与CServer类的风格有一定差异,需要注意一下。 + void Object(CClientCredits* credit, unsigned char index = 0) { + if (!index)StartObject(); + Key(_T("uploadedTotal")); Uint64(credit->GetUploadedTotal()); + Key(_T("downloadedTotal")); Uint64(credit->GetDownloadedTotal()); + if (!index)EndObject(); + } + //TODO:完成CUpDownClient类型的返回 + //list=CClientList + CString ArrToHex(const uchar* str, unsigned int len) { + const char T16[] = "0123456789abcdef"; + char hex[4095]; + if (len != 0) { + for (int i = 0; i < len; i++) { + hex[i * 2] = T16[str[i] % 16]; + hex[i * 2 + 1] = T16[str[i] / 16]; + } + hex[i * 2] = '\0'; + return CString(hex); + } + return CString(""); + } + void Object(CUpDownClient* client, unsigned char index = 0) + { //我注意到CUpDownClient类中有GetFriend()方法返回CFriend类 + //CFriend类中有GetLinkedClient()方法返回CUpDownClient类 + //如何才能避免无限递归? + //一个可行的方法是,所有Object中调用的Object方法,只返回索引信息,不返回详细信息 + + StartObject(); + Key(_T("uploadDatarate")); Uint(client->GetUploadDatarate()); + Key(_T("userHash")); String(CString(ArrToHex(client->GetUserHash(),16))); + Key(_T("hashType")); Int(client->GetHashType()); + Key(_T("isBanned")); Bool(client->IsBanned()); + Key(_T("userName")); String(CString(client->GetUserName())); + Key(_T("SoftVer")); String(client->GetClientSoftVer()); + /* + case SO_EMULE: return _T("1"); + case SO_OLDEMULE: return _T("1"); + case SO_EDONKEY: return _T("0"); + case SO_EDONKEYHYBRID: return _T("h"); + case SO_AMULE: return _T("a"); + case SO_SHAREAZA: return _T("s"); + case SO_MLDONKEY: return _T("m"); + case SO_LPHANT: return _T("l"); + case SO_URL: return _T("u"); + */ + Key(_T("IP")); Uint(client->GetIP()); + Key(_T("connectIP")); Uint(client->GetConnectIP()); + Key(_T("userPort")); Uint(client->GetUserPort()); + Key(_T("isFriend")); Bool(client->IsFriend()); + //Object(client->CheckAndGetReqUpFile());//CKnownFile + Key(_T("transferredUp")); Uint(client->GetTransferredUp()); + Key(_T("transferredDown")); Uint(client->GetTransferredDown()); + Key(_T("clientVersion")); Int(client->GetClientSoft()); + Key(_T("clientModVer")); String(client->GetClientModVer()); + Key(_T("version")); Uint(client->GetVersion()); + Key(_T("muleVersion")); Uint(client->GetMuleVersion()); + if (client->Credits()) + Object(client->Credits(), index + 1); + else { + Key(_T("credit")); String(_T("null")); + } + Key(_T("hasLowID")); Bool(client->HasLowID()); + Key(_T("isEd2kClient")); Bool(client->IsEd2kClient()); + //Object(client->GetFriend(),index+1);//警告:可能产生无穷递归 + EndObject(); + + } + void Object(CFriend* pail, unsigned char index = 0)//因为friend是关键字,这里用pail + { + if (!index)StartObject(); + Key(_T("lastSeen")); Uint64(pail->m_dwLastSeen);//有可能是64位时间 + Key(_T("friendName")); String(pail->m_strName); + //Key(_T("isFriendSlotted")); Bool(pail->GetFriendSlot()); + if (!index)EndObject(); + } + //似乎返回CFriend是完全没有必要的?返回CUpDownClient类就好了 + //里面也有isFriend方法,如果需要返回所有Friend,通过查询所有 + //isFriend()=Ture的Client就好 + + + void Object(CAbstractFile* file, unsigned char index = 0) { + if (!index)StartObject(); + Key(_T("fileName")); String(file->GetFileName()); + Key(_T("fileType")); String(file->GetFileType()); + Key(_T("fileTypeDisplayName")); String(file->GetFileTypeDisplayStr()); + Key(_T("hasNullHash")); Bool(file->HasNullHash()); + Key(_T("fileHash")); String(ArrToHex(file->GetFileHash(),16)); + Key(_T("eD2kLink")); String(file->GetED2kLink());//without Hashset;HTMLTag;HostName;Source;dwSourceIP + Key(_T("fileSize")); Uint64((uint64)(file->GetFileSize()));//TODO: Object for EMFileSize + Key(_T("hasComment")); Bool(file->HasComment()); + Key(_T("hasUserRating")); Bool(file->HasRating()); + Key(_T("userRating")); Int(file->UserRating()); + Key(_T("hasBadRating")); Bool(file->HasBadRating()); + Key(_T("fileComment")); String(file->GetFileComment()); + Key(_T("fileRating")); Int(file->GetFileRating()); + //Object(file->getNotes()); //TODO:Object for CKadEntryPtrList + if (!index)EndObject(); + } + void Object(CShareableFile* file, unsigned char index = 0) { + if (!index)StartObject(); + Object((CAbstractFile*)file, index + 1); + Key(_T("path")); String(file->GetPath()); + Key(_T("filePath")); String(file->GetFilePath()); + if (!index)EndObject(); + } + void Object(CKnownFile* file, unsigned char index = 0) { + if (!index)StartObject(); + Object((CShareableFile*)file, index + 1); + Key(_T("utcFileDate")); Int(file->GetUtcFileDate()); + Key(_T("isMovie")); Bool(file->IsMovie()); + Key(_T("upPriorityDisplayString")); String(file->GetUpPriorityDisplayString()); + Key(_T("utcLastModified")); Int(file->m_tUtcLastModified); + Key(_T("completeSourcesTime")); Int(file->m_nCompleteSourcesTime); + //Object(writer,file->m_ClientUploadList)//TODO: WriterObject for CUpDownClientPtrList + if (!index)EndObject(); + } + void Object(CAICHHash* hash, unsigned char index = 0) { + //StartObject(); + String(hash->GetString()); + //EndObject(); + } + void Object(CAICHHashTree* hash, unsigned char index = 0) { + //StartObject(); + Object(&(hash->m_Hash)); + //EndObject(); + } + void Object(CAICHRecoveryHashSet* hash, unsigned char index = 0) { + //StartObject(); + Object(&(hash->m_pHashTree)); + //EndObject(); + } + void Object(CPartFile* file, unsigned char index = 0) { + if (!index)StartObject(); + Object((CKnownFile*)file, index + 1); + Key(_T("isPartFile")); Bool(file->IsPartFile()); + Key(_T("partMetFileName")); String(file->GetPartMetFileName()); + Key(_T("AICHHash")); Object(file->GetAICHRecoveryHashSet()); + if (!index)EndObject(); + } +}; +//以上 + +const char * WebServerRESTAPI::_getStatusString(int status) +{ + switch (status) { + case 100: return "Continue"; + case 101: return "Switching Protocols"; + case 200: return "OK"; + case 201: return "Created"; + case 202: return "Accepted"; + case 203: return "Non-Authoritative Information"; + case 204: return "No Content"; + case 205: return "Reset Content"; + case 206: return "Partial Content"; + case 300: return "Multiple Choices"; + case 301: return "Moved Permanently"; + case 302: return "Found"; + case 303: return "See Other"; + case 304: return "Not Modified"; + case 305: return "Use Proxy"; + //case 306: return "(reserved)"; + case 307: return "Temporary Redirect"; + case 400: return "Bad Request"; + case 401: return "Unauthorized"; + case 402: return "Payment Required"; + case 403: return "Forbidden"; + case 404: return "Not Found"; + case 405: return "Method Not Allowed"; + case 406: return "Not Acceptable"; + case 407: return "Proxy Authentication Required"; + case 408: return "Request Timeout"; + case 409: return "Conflict"; + case 410: return "Gone"; + case 411: return "Length Required"; + case 412: return "Precondition Failed"; + case 413: return "Request Entity Too Large"; + case 414: return "Request-URI Too Long"; + case 415: return "Unsupported Media Type"; + case 416: return "Requested Range Not Satisfiable"; + case 417: return "Expectation Failed"; + case 500: return "Internal Server Error"; + case 501: return "Not Implemented"; + case 502: return "Bad Gateway"; + case 503: return "Service Unavailable"; + case 504: return "Gateway Timeout"; + case 505: return "HTTP Version Not Supported"; + default: throw CString("Not supported status code."); + } +} + +void WebServerRESTAPI::_ProcessHeader(char * pHeader, DWORD dwHeaderLen) +{ + CStringA header(pHeader, dwHeaderLen); + //处理头部 + int tokenPos = 0; + Method = header.Tokenize(" ", tokenPos); + URL = header.Tokenize(" ", tokenPos); + header.Tokenize("\n", tokenPos); + + while (tokenPos >= 0) { + CString key(header.Tokenize(":", tokenPos)); + if (tokenPos < 0) break; + CString value(header.Tokenize("\n", tokenPos).TrimLeft()); + if (tokenPos < 0) break; + Headers[key.MakeLower()] = value; + } + + //分离路径和查询字符串 + int queryPos = URL.FindOneOf(_T("?")); + if (queryPos > 0) { + RawPath = OptUtf8ToStr(URLDecode(URL.Left(queryPos))); + RawQueryString = URL.Mid(queryPos + 1); + } else { + RawPath = URL; + } + + //处理路径 + CString sToken; + tokenPos = 1; + while ((sToken = RawPath.Tokenize(_T("/?"), tokenPos)) != _T("")) { + Path.Add(sToken); + } + + //处理查询字符串 + tokenPos = 0; + while (tokenPos >= 0) { + CString key(RawQueryString.Tokenize(_T("="), tokenPos)); + if (tokenPos < 0) break; + CString value(RawQueryString.Tokenize(_T("&"), tokenPos)); + if (tokenPos < 0) break; + QueryString[key] = OptUtf8ToStr(URLDecode(value)); + } +} + +void WebServerRESTAPI::_Response(int status, LPCSTR szStdResponse, StringBufferT & data) +{ + _Response(status, szStdResponse, data.GetString(), data.GetSize()); +} + +void WebServerRESTAPI::_Response(int status, LPCSTR szStdResponse, const void * data, DWORD dwDataLen) +{ + CString acceptEncoding; + bool isUseGzip; + + if (Headers.Lookup(_T("accept-encoding"), acceptEncoding) && acceptEncoding.Find(_T("gzip")) >= 0) { + isUseGzip = true; + } else { + isUseGzip = false; + } + + + TCHAR* gzipOut = NULL; + long gzipLen = 0; + + if (isUseGzip) { + bool bOk = false; + try { + uLongf destLen = dwDataLen + 1024; + gzipOut = new TCHAR[destLen]; + if (CWebServer::_GzipCompress((Bytef*)gzipOut, &destLen, (const Bytef*)data, dwDataLen, Z_DEFAULT_COMPRESSION) == Z_OK) { + bOk = true; + gzipLen = destLen; + } + } + catch (...) { + ASSERT(0); + } + if (!bOk) { + isUseGzip = false; + delete[] gzipOut; + gzipOut = NULL; + } + } + + char szBuf[0x1000]; + if (isUseGzip) { + int nLen = _snprintf(szBuf, _countof(szBuf), + "HTTP/1.1 %d %s\r\n%sContent-Encoding: gzip\r\nContent-Length: %ld\r\n\r\n", + status, _getStatusString(status), szStdResponse, gzipLen); + if (nLen > 0) { + Socket->SendData(szBuf, nLen); + Socket->SendData(gzipOut, gzipLen); + } + delete[] gzipOut; + gzipOut = NULL; + } else { + int nLen = _snprintf(szBuf, _countof(szBuf), + "HTTP/1.1 %d %s\r\n%sContent-Length: %ld\r\n\r\n", + status, _getStatusString(status), szStdResponse, dwDataLen); + if (nLen > 0) { + Socket->SendData(szBuf, nLen); + Socket->SendData(data, dwDataLen); + } + } +} + +#ifdef DEBUG +bool WebServerRESTAPI::_Dump() +{ + StringBufferT s; + + WriterT writer(s); + writer.StartObject(); + + writer.Key(_T("Method")); writer.String(Method); + writer.Key(_T("URL")); writer.String(URL); + writer.Key(_T("RawQueryString")); writer.String(RawQueryString); + writer.Key(_T("RawPath")); writer.String(RawPath); + + writer.Key(_T("Headers")); + writer.StartObject(); + { + POSITION i = Headers.GetStartPosition(); + while (i != NULL) { + CString key; + CString value; + Headers.GetNextAssoc(i, key, value); + writer.Key(key); writer.String(value); + } + } + writer.EndObject(); + + writer.Key(_T("Path")); + writer.StartArray(); + for (int i = 0; i < Path.GetCount(); i++) + writer.String(Path[i]); + writer.EndArray(); + + writer.Key(_T("QueryString")); + writer.StartObject(); + { + POSITION i = QueryString.GetStartPosition(); + while (i != NULL) { + CString key; + CString value; + QueryString.GetNextAssoc(i, key, value); + writer.Key(key); writer.String(value); + } + } + writer.EndObject(); + + writer.Key(_T("Data")); writer.String(CString(CStringA(Data, DataLen))); + writer.Key(_T("DataLen")); writer.Uint(DataLen); + + writer.EndObject(); + + _Response(200, JSONInit, s); + return true; +} +#endif + +bool WebServerRESTAPI::_GetServerList() +{ + StringBufferT s; + JSONWriter writer(s); + + writer.StartArray(); + + for (uint32 sc = 0; sc < theApp.serverlist->GetServerCount(); sc++) + { + CServer* cur = theApp.serverlist->GetServerAt(sc); + writer.Object(cur); + } + writer.EndArray(); + + _Response(200, JSONInit, s); + return true; +} + +bool WebServerRESTAPI::_GetClientList() +{ + StringBufferT s; + JSONWriter writer(s); + + writer.StartArray(); + theApp.clientlist->FindHeadClient(); + CUpDownClient* cur; + while(theApp.clientlist->usedToFindByNumber != NULL) { + cur = theApp.clientlist->FindNextClient(); + if(cur)writer.Object(cur); + } + writer.EndArray(); + theApp.clientlist->FindHeadClient(); + + _Response(200, JSONInit, s); + return true; +} + +bool WebServerRESTAPI::_GetSharedList() +{ + StringBufferT s; + JSONWriter writer(s); + + writer.StartArray(); + theApp.sharedfiles->FindHeadKnownFile(); + CKnownFile* cur; + while (theApp.sharedfiles->usedToFindByNumber != NULL) { + cur = theApp.sharedfiles->FindNextKnownFile(); + if (cur)writer.Object(cur); + } + writer.EndArray(); + theApp.sharedfiles->FindHeadKnownFile(); + + _Response(200, JSONInit, s); + return true; +} + +bool WebServerRESTAPI::_GetknownfList() +{ + StringBufferT s; + JSONWriter writer(s); + + writer.StartArray(); + theApp.knownfiles->FindHeadKnownFile(); + CKnownFile* cur; + while (theApp.knownfiles->usedToFindByNumber != NULL) { + cur = theApp.knownfiles->FindNextKnownFile(); + if (cur)writer.Object(cur); + } + writer.EndArray(); + theApp.knownfiles->FindHeadKnownFile(); + + _Response(200, JSONInit, s); + return true; +} + +// TODO: 这里函数名貌似不对? +bool progressed2klink(CString & link, CString & action) { + CString type; + int iStart = 0; + type = link.Tokenize(_T("|"), iStart); + type = link.Tokenize(_T("|"), iStart); + if (_T("friend") == type) { + if (_T("add") == action) { + theApp.emuledlg->ProcessED2KLink(link); + } + else if (_T("del") == action) { + return false; + } + } + else if (_T("server") == type) { + if (_T("add") == action) { + theApp.emuledlg->ProcessED2KLink(link); + } + else if (_T("del") == action) { + return false; + }; + return true; + } +} + +// TODO: 这里可以根据兔子那边增加的请求头处理函数处理后的数据来优化代码结构 +CString WebServerRESTAPI::_Action(CString & param, CString action) +{ + if (param == _T("")) return _T("{message:\"null\"}"); + CMap list; + CString keyword, value; + list.SetAt(_T("action"), action); + do { + int pos = 0,nextpos = 0; + keyword = param.Tokenize(_T("=&"), pos); + value = param.Tokenize(_T("&"), nextpos).Mid(pos); + list.SetAt(keyword, value); + param = param.Mid(nextpos); + } while (param != _T("")); + + do { + CString link; + if (list.Lookup(_T("link"), link)) { + int iStart = 0; + CString type; + type = link.Tokenize(_T(":"), iStart); + if (_T("ed2k") == type) { + if (progressed2klink(link, action)) { + list.SetAt(_T("result"), _T("no_support_action")); + } + else { + break; + } + } + else if (_T("file") == type) { + break; + } + else if (_T("http") == type) { + break; + } + else { + break; + } + } + else { + break; + } + } while (0); + if (!list[_T("resule")]) { + list.SetAt(_T("result"), _T("no_support_action")); + } + + StringBufferT s; + JSONWriter writer(s); + POSITION pos = list.GetStartPosition(); + writer.StartObject(); + while (pos) { + list.GetNextAssoc(pos, keyword, value); + writer.Key(keyword); writer.String(value); + } + writer.EndObject(); + + return CString(CStringA(s.GetString())); +} + +WebServerRESTAPI::WebServerRESTAPI(CWebSocket *socket) +{ + Socket = socket; +} + +WebServerRESTAPI::~WebServerRESTAPI() +{ +} + +bool WebServerRESTAPI::Process(char* pHeader, DWORD dwHeaderLen, char* pData, DWORD dwDataLen, in_addr inad) +{ + _ProcessHeader(pHeader, dwHeaderLen); + Data = pData; + DataLen = dwDataLen; + + // 处理访问根路径的情况 + if (Path.GetCount() == 0) return false; + + //TODO: 在这里增加共享文件,下载文件,上传队列,下载队列等处理,用if...else if...else的形式 + if (Path[0] == _T("server")) { + return _GetServerList(); + } + else if (Path[0] == _T("client")) { + return _GetClientList(); + } + else if (Path[0] == _T("shared")) { + return _GetSharedList(); + } + else if (Path[0] == _T("knownf")) { + return _GetknownfList(); + } + else if (Path[0] == _T("action")) { + if (Path.GetCount() == 2) { + Socket->SendContent(JSONInit, _Action(RawQueryString, Path[1])); + return true; + } else { + return false; + } + } + else if (Path[0] == _T("dump")) { +#ifdef DEBUG + return _Dump(); +#else + return false; +#endif + } + else{ + return false; + } +} diff --git a/srchybrid/WebServerRESTAPI.h b/srchybrid/WebServerRESTAPI.h new file mode 100644 index 0000000..3cde91d --- /dev/null +++ b/srchybrid/WebServerRESTAPI.h @@ -0,0 +1,88 @@ +#pragma once +#include "WebServer.h" + +#include "rapidjson/reader.h" +#include "rapidjson/writer.h" +#ifdef DEBUG +#include "rapidjson/prettywriter.h" +#endif +#include "rapidjson/filereadstream.h" +#include "rapidjson/filewritestream.h" +#include "rapidjson/error/en.h" + +namespace rapidjson +{ +#ifdef UNICODE + typedef StringBuffer StringBufferT; +#ifdef DEBUG + typedef PrettyWriter> WriterT; +#else + typedef Writer> WriterT; +#endif +#else + typedef StringBuffer StringBufferT; +#ifdef DEBUG + typedef PrettyWriter WriterT; +#else + typedef Writer WriterT; +#endif +#endif +} + +class WebServerRESTAPI +{ + // HTTP״̬Ӧʾַ + static const char* _getStatusString(int status); +private: + // ӦSocket + CWebSocket *Socket; + // ķ + CString Method; + // URL + CString URL; + // δIJѯַ + CString RawQueryString; + // δ· + CString RawPath; + // ·, URL + // URL:/aaa/bbb/ccc + // ô: + // Path[0] = "aaa" + // Path[1] = "bbb" + // Path[2] = "ccc" + CStringArray Path; + // ͷ + CMapStringToString Headers; + // ѯַ, URL"?"źaaa=bbb&ccc=dddд + CMapStringToString QueryString; + // + char* Data; + // 󸽴ݵij + DWORD DataLen; + +private: + // ͷ + void _ProcessHeader(char* pHeader, DWORD dwHeaderLen); + // ؽ + void _Response(int status, LPCSTR szStdResponse, rapidjson::StringBufferT& data); + void _Response(int status, LPCSTR szStdResponse, const void* data, DWORD dwDataLen); +#ifdef DEBUG + // ú,ݽԭ + bool _Dump(); +#endif // DEBUG + + bool _GetServerList(); + bool _GetClientList(); + bool _GetSharedList(); + bool _GetknownfList(); + CString _Action(CString & param,CString action=NULL); + + +public: + WebServerRESTAPI(CWebSocket* socket); + ~WebServerRESTAPI(); + + bool Process(char* pHeader, DWORD dwHeaderLen, char* pData, DWORD dwDataLen, in_addr inad); + +}; + diff --git a/WebServices.h b/srchybrid/WebServices.h similarity index 100% rename from WebServices.h rename to srchybrid/WebServices.h diff --git a/WebSocket.cpp b/srchybrid/WebSocket.cpp similarity index 87% rename from WebSocket.cpp rename to srchybrid/WebSocket.cpp index b95ee7e..4c334a1 100644 --- a/WebSocket.cpp +++ b/srchybrid/WebSocket.cpp @@ -3,6 +3,7 @@ #include "OtherFunctions.h" #include "WebSocket.h" #include "WebServer.h" +#include "WebServerRESTAPI.h" #include "Preferences.h" #include "StringConversion.h" #include "Log.h" @@ -31,50 +32,63 @@ void CWebSocket::SetParent(CWebServer *pParent) void CWebSocket::OnRequestReceived(char* pHeader, DWORD dwHeaderLen, char* pData, DWORD dwDataLen, in_addr inad) { - CStringA sHeader(pHeader, dwHeaderLen); - CStringA sData(pData, dwDataLen); - CStringA sURL; - CStringA sCookie; // Multiuser WebInterface Cookie settings [Aireoreion] - Stulle - bool filereq=false; - - if(sHeader.Left(3) == "GET") - sURL = sHeader.Trim(); - - else if(sHeader.Left(4) == "POST") - sURL = "?" + sData.Trim(); // '?' to imitate GET syntax for ParseURL - - // ==> Multiuser WebInterface Cookie settings [Aireoreion] - Stulle - int pos = sHeader.Find("Cookie:"); - if(pos != -1) //found - sCookie = sHeader.Mid(pos+7); - sCookie.Trim(); - // <== Multiuser WebInterface Cookie settings [Aireoreion] - Stulle - - if(sURL.Find(" ") > -1) - sURL = sURL.Mid(sURL.Find(" ")+1, sURL.GetLength()); - if(sURL.Find(" ") > -1) - sURL = sURL.Left(sURL.Find(" ")); - //TODO: Ҫ߿Ƕ.htmlļ׺֧ - if (sURL.GetLength()>4 && // min length (for valid extentions) - (sURL.Right(4).MakeLower()==".gif" || sURL.Right(4).MakeLower()==".jpg" || sURL.Right(4).MakeLower()==".png" || - sURL.Right(4).MakeLower()==".ico" ||sURL.Right(4).MakeLower()==".css" ||sURL.Right(3).MakeLower()==".js" || - sURL.Right(4).MakeLower()==".bmp" || sURL.Right(5).MakeLower()==".jpeg" - ) - && sURL.Find("..")==-1 // dont allow leaving the emule-webserver-folder for accessing files - ) - filereq=true; - - ThreadData Data; - Data.sURL = sURL; - Data.pThis = m_pParent; - Data.inadr = inad; - Data.pSocket = this; - Data.sCookie = sCookie; // Multiuser WebInterface Cookie settings [Aireoreion] - Stulle - - if (!filereq) - m_pParent->ProcessURL(Data); - else - m_pParent->ProcessFileReq(Data); + //TODO: ҪĴ֧ + // : + // 1.HeaderĻȡ + // 2.Method֧ + // 3.dataֶǷsURL + // ļWebServer::ProcessURLд + + WebServerRESTAPI restAPI(this); + + bool processed = restAPI.Process(pHeader, dwHeaderLen, pData, dwDataLen, inad); + + if (!processed) { + CStringA sHeader(pHeader, dwHeaderLen); + CStringA sData(pData, dwDataLen); + CStringA sURL; + CStringA sCookie; // Multiuser WebInterface Cookie settings [Aireoreion] - Stulle + bool filereq=false; + + if(sHeader.Left(3) == "GET") + sURL = sHeader.Trim(); + + else if(sHeader.Left(4) == "POST") + sURL = "?" + sData.Trim(); // '?' to imitate GET syntax for ParseURL + + // ==> Multiuser WebInterface Cookie settings [Aireoreion] - Stulle + int pos = sHeader.Find("Cookie:"); + if(pos != -1) //found + sCookie = sHeader.Mid(pos+7); + sCookie.Trim(); + // <== Multiuser WebInterface Cookie settings [Aireoreion] - Stulle + + if(sURL.Find(" ") > -1) + sURL = sURL.Mid(sURL.Find(" ")+1, sURL.GetLength()); + if(sURL.Find(" ") > -1) + sURL = sURL.Left(sURL.Find(" ")); + //TODO: Ҫ߿Ƕ.htmlļ׺֧ + if (sURL.GetLength()>4 && // min length (for valid extentions) + (sURL.Right(4).MakeLower()==".gif" || sURL.Right(4).MakeLower()==".jpg" || sURL.Right(4).MakeLower()==".png" || + sURL.Right(4).MakeLower()==".ico" ||sURL.Right(4).MakeLower()==".css" ||sURL.Right(3).MakeLower()==".js" || + sURL.Right(4).MakeLower()==".bmp" || sURL.Right(5).MakeLower()==".jpeg" + ) + && sURL.Find("..")==-1 // dont allow leaving the emule-webserver-folder for accessing files + ) + filereq=true; + + ThreadData Data; + Data.sURL = sURL; + Data.pThis = m_pParent; + Data.inadr = inad; + Data.pSocket = this; + Data.sCookie = sCookie; // Multiuser WebInterface Cookie settings [Aireoreion] - Stulle + + if (!filereq) + m_pParent->ProcessURL(Data); + else + m_pParent->ProcessFileReq(Data); + } Disconnect(); } diff --git a/WebSocket.h b/srchybrid/WebSocket.h similarity index 100% rename from WebSocket.h rename to srchybrid/WebSocket.h diff --git a/Wizard.cpp b/srchybrid/Wizard.cpp similarity index 100% rename from Wizard.cpp rename to srchybrid/Wizard.cpp diff --git a/Wizard.h b/srchybrid/Wizard.h similarity index 100% rename from Wizard.h rename to srchybrid/Wizard.h diff --git a/WndUtil.h b/srchybrid/WndUtil.h similarity index 100% rename from WndUtil.h rename to srchybrid/WndUtil.h diff --git a/XMessageBox.cpp b/srchybrid/XMessageBox.cpp similarity index 100% rename from XMessageBox.cpp rename to srchybrid/XMessageBox.cpp diff --git a/XMessageBox.h b/srchybrid/XMessageBox.h similarity index 100% rename from XMessageBox.h rename to srchybrid/XMessageBox.h diff --git a/ZIPFile.cpp b/srchybrid/ZIPFile.cpp similarity index 100% rename from ZIPFile.cpp rename to srchybrid/ZIPFile.cpp diff --git a/ZIPFile.h b/srchybrid/ZIPFile.h similarity index 100% rename from ZIPFile.h rename to srchybrid/ZIPFile.h diff --git a/emule.h b/srchybrid/emule.h similarity index 100% rename from emule.h rename to srchybrid/emule.h diff --git a/emule.rc b/srchybrid/emule.rc similarity index 100% rename from emule.rc rename to srchybrid/emule.rc diff --git a/emule.sln b/srchybrid/emule.sln similarity index 100% rename from emule.sln rename to srchybrid/emule.sln diff --git a/emule.vcproj b/srchybrid/emule.vcproj similarity index 100% rename from emule.vcproj rename to srchybrid/emule.vcproj diff --git a/emule100.sln b/srchybrid/emule100.sln similarity index 92% rename from emule100.sln rename to srchybrid/emule100.sln index dfde4f9..9ea4e52 100644 --- a/emule100.sln +++ b/srchybrid/emule100.sln @@ -22,11 +22,19 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "upnpLib100", "upnplib\win32project\upnpLib100.vcxproj", "{313EDA74-70F6-481B-8F05-C49A16481905}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "emule", "emule100.vcxproj", "{584EA69D-3443-4197-8994-364880FC1B9B}" + ProjectSection(ProjectDependencies) = postProject + {A5743026-DE7A-4C3D-86EA-46D6B6847F14} = {A5743026-DE7A-4C3D-86EA-46D6B6847F14} + {98A1AD27-110A-4C3E-AF0C-4F967E536517} = {98A1AD27-110A-4C3E-AF0C-4F967E536517} + {8FEC2660-7F95-4C2E-8747-36176E1FCF82} = {8FEC2660-7F95-4C2E-8747-36176E1FCF82} + {5C2D7860-D1EE-4D75-B42B-EE548AD6E9F9} = {5C2D7860-D1EE-4D75-B42B-EE548AD6E9F9} + {313EDA74-70F6-481B-8F05-C49A16481905} = {313EDA74-70F6-481B-8F05-C49A16481905} + {58A54F98-FF3F-472F-9282-DA411EE850A2} = {58A54F98-FF3F-472F-9282-DA411EE850A2} + {119FB498-E3AC-49A5-A310-20E8B466B413} = {119FB498-E3AC-49A5-A310-20E8B466B413} + {3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF} + {3E1649FA-0B0F-460D-9AE4-7B702737B13D} = {3E1649FA-0B0F-460D-9AE4-7B702737B13D} + EndProjectSection EndProject Global - GlobalSection(Performance) = preSolution - HasPerformanceSessions = true - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution debug100|Win32 = debug100|Win32 debug100|x64 = debug100|x64 diff --git a/emule100.vcxproj b/srchybrid/emule100.vcxproj similarity index 99% rename from emule100.vcxproj rename to srchybrid/emule100.vcxproj index 191dae6..0523b72 100644 --- a/emule100.vcxproj +++ b/srchybrid/emule100.vcxproj @@ -41,7 +41,7 @@ false Unicode true - v120_xp + v140_xp @@ -86,9 +86,14 @@ .debug.exe + $(ProjectDir)rapidjson\include;$(IncludePath) + + + $(ProjectDir)rapidjson\include;$(IncludePath) + + + $(ProjectDir)rapidjson\include;$(IncludePath) - - true @@ -238,6 +243,7 @@ del $(IntDir)emule.obj Use Level4 EditAndContinue + true _DEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions) @@ -267,6 +273,9 @@ del $(IntDir)emule.obj + + true + @@ -388,6 +397,7 @@ del $(IntDir)emule.obj + @@ -1061,6 +1071,7 @@ del $(IntDir)emule.obj + diff --git a/emule100.vcxproj.filters b/srchybrid/emule100.vcxproj.filters similarity index 99% rename from emule100.vcxproj.filters rename to srchybrid/emule100.vcxproj.filters index b15cbc4..9657bc6 100644 --- a/emule100.vcxproj.filters +++ b/srchybrid/emule100.vcxproj.filters @@ -912,6 +912,9 @@ MiniMule + + Interface Source + @@ -2889,6 +2892,9 @@ Header Files\Kademlia + + Interface Header + diff --git a/emule80.sln b/srchybrid/emule80.sln similarity index 100% rename from emule80.sln rename to srchybrid/emule80.sln diff --git a/emule80.vcproj b/srchybrid/emule80.vcproj similarity index 100% rename from emule80.vcproj rename to srchybrid/emule80.vcproj diff --git a/emule90.sln b/srchybrid/emule90.sln similarity index 100% rename from emule90.sln rename to srchybrid/emule90.sln diff --git a/emule90.vcproj b/srchybrid/emule90.vcproj similarity index 100% rename from emule90.vcproj rename to srchybrid/emule90.vcproj diff --git a/emuleDlg.cpp b/srchybrid/emuleDlg.cpp similarity index 100% rename from emuleDlg.cpp rename to srchybrid/emuleDlg.cpp diff --git a/emuleDlg.h b/srchybrid/emuleDlg.h similarity index 100% rename from emuleDlg.h rename to srchybrid/emuleDlg.h diff --git a/emule_site_config.h b/srchybrid/emule_site_config.h similarity index 99% rename from emule_site_config.h rename to srchybrid/emule_site_config.h index 83d06e8..b7bfd97 100644 --- a/emule_site_config.h +++ b/srchybrid/emule_site_config.h @@ -154,7 +154,7 @@ #define HAVE_VISTA_SDK // VS2010 is already shipped with a Windows 7 SDK #define HAVE_WMF_SDK // WMF SDK is part of the Vista SDK -#define HAVE_DIRECTX_SDK // DirectX 9(!) SDK +//#define HAVE_DIRECTX_SDK // DirectX 9(!) SDK // 'sapi.h' is shipped with VS2010 as part of the Windows 7 SDK #ifndef HAVE_VISTA_SDK diff --git a/flag/flag.rc b/srchybrid/flag/flag.rc similarity index 100% rename from flag/flag.rc rename to srchybrid/flag/flag.rc diff --git a/flag/flag.sln b/srchybrid/flag/flag.sln similarity index 100% rename from flag/flag.sln rename to srchybrid/flag/flag.sln diff --git a/flag/flag.vcproj b/srchybrid/flag/flag.vcproj similarity index 100% rename from flag/flag.vcproj rename to srchybrid/flag/flag.vcproj diff --git a/flag/readme.txt b/srchybrid/flag/readme.txt similarity index 100% rename from flag/readme.txt rename to srchybrid/flag/readme.txt diff --git a/flag/res/Put the icons in here.txt b/srchybrid/flag/res/Put the icons in here.txt similarity index 100% rename from flag/res/Put the icons in here.txt rename to srchybrid/flag/res/Put the icons in here.txt diff --git a/flag/res24/ad.ico b/srchybrid/flag/res24/ad.ico similarity index 100% rename from flag/res24/ad.ico rename to srchybrid/flag/res24/ad.ico diff --git a/flag/res24/ae.ico b/srchybrid/flag/res24/ae.ico similarity index 100% rename from flag/res24/ae.ico rename to srchybrid/flag/res24/ae.ico diff --git a/flag/res24/af.ico b/srchybrid/flag/res24/af.ico similarity index 100% rename from flag/res24/af.ico rename to srchybrid/flag/res24/af.ico diff --git a/flag/res24/ag.ico b/srchybrid/flag/res24/ag.ico similarity index 100% rename from flag/res24/ag.ico rename to srchybrid/flag/res24/ag.ico diff --git a/flag/res24/ai.ico b/srchybrid/flag/res24/ai.ico similarity index 100% rename from flag/res24/ai.ico rename to srchybrid/flag/res24/ai.ico diff --git a/flag/res24/al.ico b/srchybrid/flag/res24/al.ico similarity index 100% rename from flag/res24/al.ico rename to srchybrid/flag/res24/al.ico diff --git a/flag/res24/am.ico b/srchybrid/flag/res24/am.ico similarity index 100% rename from flag/res24/am.ico rename to srchybrid/flag/res24/am.ico diff --git a/flag/res24/an.ico b/srchybrid/flag/res24/an.ico similarity index 100% rename from flag/res24/an.ico rename to srchybrid/flag/res24/an.ico diff --git a/flag/res24/ao.ico b/srchybrid/flag/res24/ao.ico similarity index 100% rename from flag/res24/ao.ico rename to srchybrid/flag/res24/ao.ico diff --git a/flag/res24/ap.ico b/srchybrid/flag/res24/ap.ico similarity index 100% rename from flag/res24/ap.ico rename to srchybrid/flag/res24/ap.ico diff --git a/flag/res24/aq.ico b/srchybrid/flag/res24/aq.ico similarity index 100% rename from flag/res24/aq.ico rename to srchybrid/flag/res24/aq.ico diff --git a/flag/res24/ar.ico b/srchybrid/flag/res24/ar.ico similarity index 100% rename from flag/res24/ar.ico rename to srchybrid/flag/res24/ar.ico diff --git a/flag/res24/as.ico b/srchybrid/flag/res24/as.ico similarity index 100% rename from flag/res24/as.ico rename to srchybrid/flag/res24/as.ico diff --git a/flag/res24/at.ico b/srchybrid/flag/res24/at.ico similarity index 100% rename from flag/res24/at.ico rename to srchybrid/flag/res24/at.ico diff --git a/flag/res24/au.ico b/srchybrid/flag/res24/au.ico similarity index 100% rename from flag/res24/au.ico rename to srchybrid/flag/res24/au.ico diff --git a/flag/res24/aw.ico b/srchybrid/flag/res24/aw.ico similarity index 100% rename from flag/res24/aw.ico rename to srchybrid/flag/res24/aw.ico diff --git a/flag/res24/ax.ico b/srchybrid/flag/res24/ax.ico similarity index 100% rename from flag/res24/ax.ico rename to srchybrid/flag/res24/ax.ico diff --git a/flag/res24/az.ico b/srchybrid/flag/res24/az.ico similarity index 100% rename from flag/res24/az.ico rename to srchybrid/flag/res24/az.ico diff --git a/flag/res24/ba.ico b/srchybrid/flag/res24/ba.ico similarity index 100% rename from flag/res24/ba.ico rename to srchybrid/flag/res24/ba.ico diff --git a/flag/res24/bb.ico b/srchybrid/flag/res24/bb.ico similarity index 100% rename from flag/res24/bb.ico rename to srchybrid/flag/res24/bb.ico diff --git a/flag/res24/bd.ico b/srchybrid/flag/res24/bd.ico similarity index 100% rename from flag/res24/bd.ico rename to srchybrid/flag/res24/bd.ico diff --git a/flag/res24/be.ico b/srchybrid/flag/res24/be.ico similarity index 100% rename from flag/res24/be.ico rename to srchybrid/flag/res24/be.ico diff --git a/flag/res24/bf.ico b/srchybrid/flag/res24/bf.ico similarity index 100% rename from flag/res24/bf.ico rename to srchybrid/flag/res24/bf.ico diff --git a/flag/res24/bg.ico b/srchybrid/flag/res24/bg.ico similarity index 100% rename from flag/res24/bg.ico rename to srchybrid/flag/res24/bg.ico diff --git a/flag/res24/bh.ico b/srchybrid/flag/res24/bh.ico similarity index 100% rename from flag/res24/bh.ico rename to srchybrid/flag/res24/bh.ico diff --git a/flag/res24/bi.ico b/srchybrid/flag/res24/bi.ico similarity index 100% rename from flag/res24/bi.ico rename to srchybrid/flag/res24/bi.ico diff --git a/flag/res24/bj.ico b/srchybrid/flag/res24/bj.ico similarity index 100% rename from flag/res24/bj.ico rename to srchybrid/flag/res24/bj.ico diff --git a/flag/res24/bl.ico b/srchybrid/flag/res24/bl.ico similarity index 100% rename from flag/res24/bl.ico rename to srchybrid/flag/res24/bl.ico diff --git a/flag/res24/bm.ico b/srchybrid/flag/res24/bm.ico similarity index 100% rename from flag/res24/bm.ico rename to srchybrid/flag/res24/bm.ico diff --git a/flag/res24/bn.ico b/srchybrid/flag/res24/bn.ico similarity index 100% rename from flag/res24/bn.ico rename to srchybrid/flag/res24/bn.ico diff --git a/flag/res24/bo.ico b/srchybrid/flag/res24/bo.ico similarity index 100% rename from flag/res24/bo.ico rename to srchybrid/flag/res24/bo.ico diff --git a/flag/res24/br.ico b/srchybrid/flag/res24/br.ico similarity index 100% rename from flag/res24/br.ico rename to srchybrid/flag/res24/br.ico diff --git a/flag/res24/bs.ico b/srchybrid/flag/res24/bs.ico similarity index 100% rename from flag/res24/bs.ico rename to srchybrid/flag/res24/bs.ico diff --git a/flag/res24/bt.ico b/srchybrid/flag/res24/bt.ico similarity index 100% rename from flag/res24/bt.ico rename to srchybrid/flag/res24/bt.ico diff --git a/flag/res24/bv.ico b/srchybrid/flag/res24/bv.ico similarity index 100% rename from flag/res24/bv.ico rename to srchybrid/flag/res24/bv.ico diff --git a/flag/res24/bw.ico b/srchybrid/flag/res24/bw.ico similarity index 100% rename from flag/res24/bw.ico rename to srchybrid/flag/res24/bw.ico diff --git a/flag/res24/by.ico b/srchybrid/flag/res24/by.ico similarity index 100% rename from flag/res24/by.ico rename to srchybrid/flag/res24/by.ico diff --git a/flag/res24/bz.ico b/srchybrid/flag/res24/bz.ico similarity index 100% rename from flag/res24/bz.ico rename to srchybrid/flag/res24/bz.ico diff --git a/flag/res24/ca.ico b/srchybrid/flag/res24/ca.ico similarity index 100% rename from flag/res24/ca.ico rename to srchybrid/flag/res24/ca.ico diff --git a/flag/res24/cc.ico b/srchybrid/flag/res24/cc.ico similarity index 100% rename from flag/res24/cc.ico rename to srchybrid/flag/res24/cc.ico diff --git a/flag/res24/cd.ico b/srchybrid/flag/res24/cd.ico similarity index 100% rename from flag/res24/cd.ico rename to srchybrid/flag/res24/cd.ico diff --git a/flag/res24/cf.ico b/srchybrid/flag/res24/cf.ico similarity index 100% rename from flag/res24/cf.ico rename to srchybrid/flag/res24/cf.ico diff --git a/flag/res24/cg.ico b/srchybrid/flag/res24/cg.ico similarity index 100% rename from flag/res24/cg.ico rename to srchybrid/flag/res24/cg.ico diff --git a/flag/res24/ch.ico b/srchybrid/flag/res24/ch.ico similarity index 100% rename from flag/res24/ch.ico rename to srchybrid/flag/res24/ch.ico diff --git a/flag/res24/ci.ico b/srchybrid/flag/res24/ci.ico similarity index 100% rename from flag/res24/ci.ico rename to srchybrid/flag/res24/ci.ico diff --git a/flag/res24/ck.ico b/srchybrid/flag/res24/ck.ico similarity index 100% rename from flag/res24/ck.ico rename to srchybrid/flag/res24/ck.ico diff --git a/flag/res24/cl.ico b/srchybrid/flag/res24/cl.ico similarity index 100% rename from flag/res24/cl.ico rename to srchybrid/flag/res24/cl.ico diff --git a/flag/res24/cm.ico b/srchybrid/flag/res24/cm.ico similarity index 100% rename from flag/res24/cm.ico rename to srchybrid/flag/res24/cm.ico diff --git a/flag/res24/cn.ico b/srchybrid/flag/res24/cn.ico similarity index 100% rename from flag/res24/cn.ico rename to srchybrid/flag/res24/cn.ico diff --git a/flag/res24/co.ico b/srchybrid/flag/res24/co.ico similarity index 100% rename from flag/res24/co.ico rename to srchybrid/flag/res24/co.ico diff --git a/flag/res24/cr.ico b/srchybrid/flag/res24/cr.ico similarity index 100% rename from flag/res24/cr.ico rename to srchybrid/flag/res24/cr.ico diff --git a/flag/res24/cs.ico b/srchybrid/flag/res24/cs.ico similarity index 100% rename from flag/res24/cs.ico rename to srchybrid/flag/res24/cs.ico diff --git a/flag/res24/cu.ico b/srchybrid/flag/res24/cu.ico similarity index 100% rename from flag/res24/cu.ico rename to srchybrid/flag/res24/cu.ico diff --git a/flag/res24/cv.ico b/srchybrid/flag/res24/cv.ico similarity index 100% rename from flag/res24/cv.ico rename to srchybrid/flag/res24/cv.ico diff --git a/flag/res24/cx.ico b/srchybrid/flag/res24/cx.ico similarity index 100% rename from flag/res24/cx.ico rename to srchybrid/flag/res24/cx.ico diff --git a/flag/res24/cy.ico b/srchybrid/flag/res24/cy.ico similarity index 100% rename from flag/res24/cy.ico rename to srchybrid/flag/res24/cy.ico diff --git a/flag/res24/cz.ico b/srchybrid/flag/res24/cz.ico similarity index 100% rename from flag/res24/cz.ico rename to srchybrid/flag/res24/cz.ico diff --git a/flag/res24/de.ico b/srchybrid/flag/res24/de.ico similarity index 100% rename from flag/res24/de.ico rename to srchybrid/flag/res24/de.ico diff --git a/flag/res24/dj.ico b/srchybrid/flag/res24/dj.ico similarity index 100% rename from flag/res24/dj.ico rename to srchybrid/flag/res24/dj.ico diff --git a/flag/res24/dk.ico b/srchybrid/flag/res24/dk.ico similarity index 100% rename from flag/res24/dk.ico rename to srchybrid/flag/res24/dk.ico diff --git a/flag/res24/dm.ico b/srchybrid/flag/res24/dm.ico similarity index 100% rename from flag/res24/dm.ico rename to srchybrid/flag/res24/dm.ico diff --git a/flag/res24/do.ico b/srchybrid/flag/res24/do.ico similarity index 100% rename from flag/res24/do.ico rename to srchybrid/flag/res24/do.ico diff --git a/flag/res24/dz.ico b/srchybrid/flag/res24/dz.ico similarity index 100% rename from flag/res24/dz.ico rename to srchybrid/flag/res24/dz.ico diff --git a/flag/res24/ec.ico b/srchybrid/flag/res24/ec.ico similarity index 100% rename from flag/res24/ec.ico rename to srchybrid/flag/res24/ec.ico diff --git a/flag/res24/ee.ico b/srchybrid/flag/res24/ee.ico similarity index 100% rename from flag/res24/ee.ico rename to srchybrid/flag/res24/ee.ico diff --git a/flag/res24/eg.ico b/srchybrid/flag/res24/eg.ico similarity index 100% rename from flag/res24/eg.ico rename to srchybrid/flag/res24/eg.ico diff --git a/flag/res24/eh.ico b/srchybrid/flag/res24/eh.ico similarity index 100% rename from flag/res24/eh.ico rename to srchybrid/flag/res24/eh.ico diff --git a/flag/res24/eng.ico b/srchybrid/flag/res24/eng.ico similarity index 100% rename from flag/res24/eng.ico rename to srchybrid/flag/res24/eng.ico diff --git a/flag/res24/er.ico b/srchybrid/flag/res24/er.ico similarity index 100% rename from flag/res24/er.ico rename to srchybrid/flag/res24/er.ico diff --git a/flag/res24/es.ico b/srchybrid/flag/res24/es.ico similarity index 100% rename from flag/res24/es.ico rename to srchybrid/flag/res24/es.ico diff --git a/flag/res24/et.ico b/srchybrid/flag/res24/et.ico similarity index 100% rename from flag/res24/et.ico rename to srchybrid/flag/res24/et.ico diff --git a/flag/res24/eu.ico b/srchybrid/flag/res24/eu.ico similarity index 100% rename from flag/res24/eu.ico rename to srchybrid/flag/res24/eu.ico diff --git a/flag/res24/fi.ico b/srchybrid/flag/res24/fi.ico similarity index 100% rename from flag/res24/fi.ico rename to srchybrid/flag/res24/fi.ico diff --git a/flag/res24/fj.ico b/srchybrid/flag/res24/fj.ico similarity index 100% rename from flag/res24/fj.ico rename to srchybrid/flag/res24/fj.ico diff --git a/flag/res24/fk.ico b/srchybrid/flag/res24/fk.ico similarity index 100% rename from flag/res24/fk.ico rename to srchybrid/flag/res24/fk.ico diff --git a/flag/res24/fm.ico b/srchybrid/flag/res24/fm.ico similarity index 100% rename from flag/res24/fm.ico rename to srchybrid/flag/res24/fm.ico diff --git a/flag/res24/fo.ico b/srchybrid/flag/res24/fo.ico similarity index 100% rename from flag/res24/fo.ico rename to srchybrid/flag/res24/fo.ico diff --git a/flag/res24/fr.ico b/srchybrid/flag/res24/fr.ico similarity index 100% rename from flag/res24/fr.ico rename to srchybrid/flag/res24/fr.ico diff --git a/flag/res24/ga.ico b/srchybrid/flag/res24/ga.ico similarity index 100% rename from flag/res24/ga.ico rename to srchybrid/flag/res24/ga.ico diff --git a/flag/res24/gb.ico b/srchybrid/flag/res24/gb.ico similarity index 100% rename from flag/res24/gb.ico rename to srchybrid/flag/res24/gb.ico diff --git a/flag/res24/gd.ico b/srchybrid/flag/res24/gd.ico similarity index 100% rename from flag/res24/gd.ico rename to srchybrid/flag/res24/gd.ico diff --git a/flag/res24/ge.ico b/srchybrid/flag/res24/ge.ico similarity index 100% rename from flag/res24/ge.ico rename to srchybrid/flag/res24/ge.ico diff --git a/flag/res24/gf.ico b/srchybrid/flag/res24/gf.ico similarity index 100% rename from flag/res24/gf.ico rename to srchybrid/flag/res24/gf.ico diff --git a/flag/res24/gg.ico b/srchybrid/flag/res24/gg.ico similarity index 100% rename from flag/res24/gg.ico rename to srchybrid/flag/res24/gg.ico diff --git a/flag/res24/gh.ico b/srchybrid/flag/res24/gh.ico similarity index 100% rename from flag/res24/gh.ico rename to srchybrid/flag/res24/gh.ico diff --git a/flag/res24/gi.ico b/srchybrid/flag/res24/gi.ico similarity index 100% rename from flag/res24/gi.ico rename to srchybrid/flag/res24/gi.ico diff --git a/flag/res24/gk.ico b/srchybrid/flag/res24/gk.ico similarity index 100% rename from flag/res24/gk.ico rename to srchybrid/flag/res24/gk.ico diff --git a/flag/res24/gl.ico b/srchybrid/flag/res24/gl.ico similarity index 100% rename from flag/res24/gl.ico rename to srchybrid/flag/res24/gl.ico diff --git a/flag/res24/gm.ico b/srchybrid/flag/res24/gm.ico similarity index 100% rename from flag/res24/gm.ico rename to srchybrid/flag/res24/gm.ico diff --git a/flag/res24/gn.ico b/srchybrid/flag/res24/gn.ico similarity index 100% rename from flag/res24/gn.ico rename to srchybrid/flag/res24/gn.ico diff --git a/flag/res24/gp.ico b/srchybrid/flag/res24/gp.ico similarity index 100% rename from flag/res24/gp.ico rename to srchybrid/flag/res24/gp.ico diff --git a/flag/res24/gq.ico b/srchybrid/flag/res24/gq.ico similarity index 100% rename from flag/res24/gq.ico rename to srchybrid/flag/res24/gq.ico diff --git a/flag/res24/gr.ico b/srchybrid/flag/res24/gr.ico similarity index 100% rename from flag/res24/gr.ico rename to srchybrid/flag/res24/gr.ico diff --git a/flag/res24/gs.ico b/srchybrid/flag/res24/gs.ico similarity index 100% rename from flag/res24/gs.ico rename to srchybrid/flag/res24/gs.ico diff --git a/flag/res24/gt.ico b/srchybrid/flag/res24/gt.ico similarity index 100% rename from flag/res24/gt.ico rename to srchybrid/flag/res24/gt.ico diff --git a/flag/res24/gu.ico b/srchybrid/flag/res24/gu.ico similarity index 100% rename from flag/res24/gu.ico rename to srchybrid/flag/res24/gu.ico diff --git a/flag/res24/gw.ico b/srchybrid/flag/res24/gw.ico similarity index 100% rename from flag/res24/gw.ico rename to srchybrid/flag/res24/gw.ico diff --git a/flag/res24/gy.ico b/srchybrid/flag/res24/gy.ico similarity index 100% rename from flag/res24/gy.ico rename to srchybrid/flag/res24/gy.ico diff --git a/flag/res24/hk.ico b/srchybrid/flag/res24/hk.ico similarity index 100% rename from flag/res24/hk.ico rename to srchybrid/flag/res24/hk.ico diff --git a/flag/res24/hn.ico b/srchybrid/flag/res24/hn.ico similarity index 100% rename from flag/res24/hn.ico rename to srchybrid/flag/res24/hn.ico diff --git a/flag/res24/hr.ico b/srchybrid/flag/res24/hr.ico similarity index 100% rename from flag/res24/hr.ico rename to srchybrid/flag/res24/hr.ico diff --git a/flag/res24/ht.ico b/srchybrid/flag/res24/ht.ico similarity index 100% rename from flag/res24/ht.ico rename to srchybrid/flag/res24/ht.ico diff --git a/flag/res24/hu.ico b/srchybrid/flag/res24/hu.ico similarity index 100% rename from flag/res24/hu.ico rename to srchybrid/flag/res24/hu.ico diff --git a/flag/res24/id.ico b/srchybrid/flag/res24/id.ico similarity index 100% rename from flag/res24/id.ico rename to srchybrid/flag/res24/id.ico diff --git a/flag/res24/ie.ico b/srchybrid/flag/res24/ie.ico similarity index 100% rename from flag/res24/ie.ico rename to srchybrid/flag/res24/ie.ico diff --git a/flag/res24/il.ico b/srchybrid/flag/res24/il.ico similarity index 100% rename from flag/res24/il.ico rename to srchybrid/flag/res24/il.ico diff --git a/flag/res24/im.ico b/srchybrid/flag/res24/im.ico similarity index 100% rename from flag/res24/im.ico rename to srchybrid/flag/res24/im.ico diff --git a/flag/res24/in.ico b/srchybrid/flag/res24/in.ico similarity index 100% rename from flag/res24/in.ico rename to srchybrid/flag/res24/in.ico diff --git a/flag/res24/io.ico b/srchybrid/flag/res24/io.ico similarity index 100% rename from flag/res24/io.ico rename to srchybrid/flag/res24/io.ico diff --git a/flag/res24/iq.ico b/srchybrid/flag/res24/iq.ico similarity index 100% rename from flag/res24/iq.ico rename to srchybrid/flag/res24/iq.ico diff --git a/flag/res24/ir.ico b/srchybrid/flag/res24/ir.ico similarity index 100% rename from flag/res24/ir.ico rename to srchybrid/flag/res24/ir.ico diff --git a/flag/res24/is.ico b/srchybrid/flag/res24/is.ico similarity index 100% rename from flag/res24/is.ico rename to srchybrid/flag/res24/is.ico diff --git a/flag/res24/it.ico b/srchybrid/flag/res24/it.ico similarity index 100% rename from flag/res24/it.ico rename to srchybrid/flag/res24/it.ico diff --git a/flag/res24/je.ico b/srchybrid/flag/res24/je.ico similarity index 100% rename from flag/res24/je.ico rename to srchybrid/flag/res24/je.ico diff --git a/flag/res24/jm.ico b/srchybrid/flag/res24/jm.ico similarity index 100% rename from flag/res24/jm.ico rename to srchybrid/flag/res24/jm.ico diff --git a/flag/res24/jo.ico b/srchybrid/flag/res24/jo.ico similarity index 100% rename from flag/res24/jo.ico rename to srchybrid/flag/res24/jo.ico diff --git a/flag/res24/jp.ico b/srchybrid/flag/res24/jp.ico similarity index 100% rename from flag/res24/jp.ico rename to srchybrid/flag/res24/jp.ico diff --git a/flag/res24/ke.ico b/srchybrid/flag/res24/ke.ico similarity index 100% rename from flag/res24/ke.ico rename to srchybrid/flag/res24/ke.ico diff --git a/flag/res24/kg.ico b/srchybrid/flag/res24/kg.ico similarity index 100% rename from flag/res24/kg.ico rename to srchybrid/flag/res24/kg.ico diff --git a/flag/res24/kh.ico b/srchybrid/flag/res24/kh.ico similarity index 100% rename from flag/res24/kh.ico rename to srchybrid/flag/res24/kh.ico diff --git a/flag/res24/ki.ico b/srchybrid/flag/res24/ki.ico similarity index 100% rename from flag/res24/ki.ico rename to srchybrid/flag/res24/ki.ico diff --git a/flag/res24/km.ico b/srchybrid/flag/res24/km.ico similarity index 100% rename from flag/res24/km.ico rename to srchybrid/flag/res24/km.ico diff --git a/flag/res24/kn.ico b/srchybrid/flag/res24/kn.ico similarity index 100% rename from flag/res24/kn.ico rename to srchybrid/flag/res24/kn.ico diff --git a/flag/res24/kp.ico b/srchybrid/flag/res24/kp.ico similarity index 100% rename from flag/res24/kp.ico rename to srchybrid/flag/res24/kp.ico diff --git a/flag/res24/kr.ico b/srchybrid/flag/res24/kr.ico similarity index 100% rename from flag/res24/kr.ico rename to srchybrid/flag/res24/kr.ico diff --git a/flag/res24/kw.ico b/srchybrid/flag/res24/kw.ico similarity index 100% rename from flag/res24/kw.ico rename to srchybrid/flag/res24/kw.ico diff --git a/flag/res24/ky.ico b/srchybrid/flag/res24/ky.ico similarity index 100% rename from flag/res24/ky.ico rename to srchybrid/flag/res24/ky.ico diff --git a/flag/res24/kz.ico b/srchybrid/flag/res24/kz.ico similarity index 100% rename from flag/res24/kz.ico rename to srchybrid/flag/res24/kz.ico diff --git a/flag/res24/la.ico b/srchybrid/flag/res24/la.ico similarity index 100% rename from flag/res24/la.ico rename to srchybrid/flag/res24/la.ico diff --git a/flag/res24/lb.ico b/srchybrid/flag/res24/lb.ico similarity index 100% rename from flag/res24/lb.ico rename to srchybrid/flag/res24/lb.ico diff --git a/flag/res24/lc.ico b/srchybrid/flag/res24/lc.ico similarity index 100% rename from flag/res24/lc.ico rename to srchybrid/flag/res24/lc.ico diff --git a/flag/res24/li.ico b/srchybrid/flag/res24/li.ico similarity index 100% rename from flag/res24/li.ico rename to srchybrid/flag/res24/li.ico diff --git a/flag/res24/lk.ico b/srchybrid/flag/res24/lk.ico similarity index 100% rename from flag/res24/lk.ico rename to srchybrid/flag/res24/lk.ico diff --git a/flag/res24/lr.ico b/srchybrid/flag/res24/lr.ico similarity index 100% rename from flag/res24/lr.ico rename to srchybrid/flag/res24/lr.ico diff --git a/flag/res24/ls.ico b/srchybrid/flag/res24/ls.ico similarity index 100% rename from flag/res24/ls.ico rename to srchybrid/flag/res24/ls.ico diff --git a/flag/res24/lt.ico b/srchybrid/flag/res24/lt.ico similarity index 100% rename from flag/res24/lt.ico rename to srchybrid/flag/res24/lt.ico diff --git a/flag/res24/lu.ico b/srchybrid/flag/res24/lu.ico similarity index 100% rename from flag/res24/lu.ico rename to srchybrid/flag/res24/lu.ico diff --git a/flag/res24/lv.ico b/srchybrid/flag/res24/lv.ico similarity index 100% rename from flag/res24/lv.ico rename to srchybrid/flag/res24/lv.ico diff --git a/flag/res24/ly.ico b/srchybrid/flag/res24/ly.ico similarity index 100% rename from flag/res24/ly.ico rename to srchybrid/flag/res24/ly.ico diff --git a/flag/res24/ma.ico b/srchybrid/flag/res24/ma.ico similarity index 100% rename from flag/res24/ma.ico rename to srchybrid/flag/res24/ma.ico diff --git a/flag/res24/mc.ico b/srchybrid/flag/res24/mc.ico similarity index 100% rename from flag/res24/mc.ico rename to srchybrid/flag/res24/mc.ico diff --git a/flag/res24/md.ico b/srchybrid/flag/res24/md.ico similarity index 100% rename from flag/res24/md.ico rename to srchybrid/flag/res24/md.ico diff --git a/flag/res24/me.ico b/srchybrid/flag/res24/me.ico similarity index 100% rename from flag/res24/me.ico rename to srchybrid/flag/res24/me.ico diff --git a/flag/res24/mf.ico b/srchybrid/flag/res24/mf.ico similarity index 100% rename from flag/res24/mf.ico rename to srchybrid/flag/res24/mf.ico diff --git a/flag/res24/mg.ico b/srchybrid/flag/res24/mg.ico similarity index 100% rename from flag/res24/mg.ico rename to srchybrid/flag/res24/mg.ico diff --git a/flag/res24/mh.ico b/srchybrid/flag/res24/mh.ico similarity index 100% rename from flag/res24/mh.ico rename to srchybrid/flag/res24/mh.ico diff --git a/flag/res24/mk.ico b/srchybrid/flag/res24/mk.ico similarity index 100% rename from flag/res24/mk.ico rename to srchybrid/flag/res24/mk.ico diff --git a/flag/res24/ml.ico b/srchybrid/flag/res24/ml.ico similarity index 100% rename from flag/res24/ml.ico rename to srchybrid/flag/res24/ml.ico diff --git a/flag/res24/mm.ico b/srchybrid/flag/res24/mm.ico similarity index 100% rename from flag/res24/mm.ico rename to srchybrid/flag/res24/mm.ico diff --git a/flag/res24/mn.ico b/srchybrid/flag/res24/mn.ico similarity index 100% rename from flag/res24/mn.ico rename to srchybrid/flag/res24/mn.ico diff --git a/flag/res24/mo.ico b/srchybrid/flag/res24/mo.ico similarity index 100% rename from flag/res24/mo.ico rename to srchybrid/flag/res24/mo.ico diff --git a/flag/res24/mp.ico b/srchybrid/flag/res24/mp.ico similarity index 100% rename from flag/res24/mp.ico rename to srchybrid/flag/res24/mp.ico diff --git a/flag/res24/mq.ico b/srchybrid/flag/res24/mq.ico similarity index 100% rename from flag/res24/mq.ico rename to srchybrid/flag/res24/mq.ico diff --git a/flag/res24/mr.ico b/srchybrid/flag/res24/mr.ico similarity index 100% rename from flag/res24/mr.ico rename to srchybrid/flag/res24/mr.ico diff --git a/flag/res24/ms.ico b/srchybrid/flag/res24/ms.ico similarity index 100% rename from flag/res24/ms.ico rename to srchybrid/flag/res24/ms.ico diff --git a/flag/res24/mt.ico b/srchybrid/flag/res24/mt.ico similarity index 100% rename from flag/res24/mt.ico rename to srchybrid/flag/res24/mt.ico diff --git a/flag/res24/mu.ico b/srchybrid/flag/res24/mu.ico similarity index 100% rename from flag/res24/mu.ico rename to srchybrid/flag/res24/mu.ico diff --git a/flag/res24/mv.ico b/srchybrid/flag/res24/mv.ico similarity index 100% rename from flag/res24/mv.ico rename to srchybrid/flag/res24/mv.ico diff --git a/flag/res24/mw.ico b/srchybrid/flag/res24/mw.ico similarity index 100% rename from flag/res24/mw.ico rename to srchybrid/flag/res24/mw.ico diff --git a/flag/res24/mx.ico b/srchybrid/flag/res24/mx.ico similarity index 100% rename from flag/res24/mx.ico rename to srchybrid/flag/res24/mx.ico diff --git a/flag/res24/my.ico b/srchybrid/flag/res24/my.ico similarity index 100% rename from flag/res24/my.ico rename to srchybrid/flag/res24/my.ico diff --git a/flag/res24/mz.ico b/srchybrid/flag/res24/mz.ico similarity index 100% rename from flag/res24/mz.ico rename to srchybrid/flag/res24/mz.ico diff --git a/flag/res24/na.ico b/srchybrid/flag/res24/na.ico similarity index 100% rename from flag/res24/na.ico rename to srchybrid/flag/res24/na.ico diff --git a/flag/res24/nc.ico b/srchybrid/flag/res24/nc.ico similarity index 100% rename from flag/res24/nc.ico rename to srchybrid/flag/res24/nc.ico diff --git a/flag/res24/ne.ico b/srchybrid/flag/res24/ne.ico similarity index 100% rename from flag/res24/ne.ico rename to srchybrid/flag/res24/ne.ico diff --git a/flag/res24/nf.ico b/srchybrid/flag/res24/nf.ico similarity index 100% rename from flag/res24/nf.ico rename to srchybrid/flag/res24/nf.ico diff --git a/flag/res24/ng.ico b/srchybrid/flag/res24/ng.ico similarity index 100% rename from flag/res24/ng.ico rename to srchybrid/flag/res24/ng.ico diff --git a/flag/res24/ni.ico b/srchybrid/flag/res24/ni.ico similarity index 100% rename from flag/res24/ni.ico rename to srchybrid/flag/res24/ni.ico diff --git a/flag/res24/nir.ico b/srchybrid/flag/res24/nir.ico similarity index 100% rename from flag/res24/nir.ico rename to srchybrid/flag/res24/nir.ico diff --git a/flag/res24/nl.ico b/srchybrid/flag/res24/nl.ico similarity index 100% rename from flag/res24/nl.ico rename to srchybrid/flag/res24/nl.ico diff --git a/flag/res24/no.ico b/srchybrid/flag/res24/no.ico similarity index 100% rename from flag/res24/no.ico rename to srchybrid/flag/res24/no.ico diff --git a/flag/res24/not.ico b/srchybrid/flag/res24/not.ico similarity index 100% rename from flag/res24/not.ico rename to srchybrid/flag/res24/not.ico diff --git a/flag/res24/np.ico b/srchybrid/flag/res24/np.ico similarity index 100% rename from flag/res24/np.ico rename to srchybrid/flag/res24/np.ico diff --git a/flag/res24/nr.ico b/srchybrid/flag/res24/nr.ico similarity index 100% rename from flag/res24/nr.ico rename to srchybrid/flag/res24/nr.ico diff --git a/flag/res24/nu.ico b/srchybrid/flag/res24/nu.ico similarity index 100% rename from flag/res24/nu.ico rename to srchybrid/flag/res24/nu.ico diff --git a/flag/res24/nz.ico b/srchybrid/flag/res24/nz.ico similarity index 100% rename from flag/res24/nz.ico rename to srchybrid/flag/res24/nz.ico diff --git a/flag/res24/om.ico b/srchybrid/flag/res24/om.ico similarity index 100% rename from flag/res24/om.ico rename to srchybrid/flag/res24/om.ico diff --git a/flag/res24/pa.ico b/srchybrid/flag/res24/pa.ico similarity index 100% rename from flag/res24/pa.ico rename to srchybrid/flag/res24/pa.ico diff --git a/flag/res24/pc.ico b/srchybrid/flag/res24/pc.ico similarity index 100% rename from flag/res24/pc.ico rename to srchybrid/flag/res24/pc.ico diff --git a/flag/res24/pe.ico b/srchybrid/flag/res24/pe.ico similarity index 100% rename from flag/res24/pe.ico rename to srchybrid/flag/res24/pe.ico diff --git a/flag/res24/pf.ico b/srchybrid/flag/res24/pf.ico similarity index 100% rename from flag/res24/pf.ico rename to srchybrid/flag/res24/pf.ico diff --git a/flag/res24/pg.ico b/srchybrid/flag/res24/pg.ico similarity index 100% rename from flag/res24/pg.ico rename to srchybrid/flag/res24/pg.ico diff --git a/flag/res24/ph.ico b/srchybrid/flag/res24/ph.ico similarity index 100% rename from flag/res24/ph.ico rename to srchybrid/flag/res24/ph.ico diff --git a/flag/res24/pk.ico b/srchybrid/flag/res24/pk.ico similarity index 100% rename from flag/res24/pk.ico rename to srchybrid/flag/res24/pk.ico diff --git a/flag/res24/pl.ico b/srchybrid/flag/res24/pl.ico similarity index 100% rename from flag/res24/pl.ico rename to srchybrid/flag/res24/pl.ico diff --git a/flag/res24/pm.ico b/srchybrid/flag/res24/pm.ico similarity index 100% rename from flag/res24/pm.ico rename to srchybrid/flag/res24/pm.ico diff --git a/flag/res24/pn.ico b/srchybrid/flag/res24/pn.ico similarity index 100% rename from flag/res24/pn.ico rename to srchybrid/flag/res24/pn.ico diff --git a/flag/res24/pr.ico b/srchybrid/flag/res24/pr.ico similarity index 100% rename from flag/res24/pr.ico rename to srchybrid/flag/res24/pr.ico diff --git a/flag/res24/ps.ico b/srchybrid/flag/res24/ps.ico similarity index 100% rename from flag/res24/ps.ico rename to srchybrid/flag/res24/ps.ico diff --git a/flag/res24/pt.ico b/srchybrid/flag/res24/pt.ico similarity index 100% rename from flag/res24/pt.ico rename to srchybrid/flag/res24/pt.ico diff --git a/flag/res24/pw.ico b/srchybrid/flag/res24/pw.ico similarity index 100% rename from flag/res24/pw.ico rename to srchybrid/flag/res24/pw.ico diff --git a/flag/res24/py.ico b/srchybrid/flag/res24/py.ico similarity index 100% rename from flag/res24/py.ico rename to srchybrid/flag/res24/py.ico diff --git a/flag/res24/qa.ico b/srchybrid/flag/res24/qa.ico similarity index 100% rename from flag/res24/qa.ico rename to srchybrid/flag/res24/qa.ico diff --git a/flag/res24/re.ico b/srchybrid/flag/res24/re.ico similarity index 100% rename from flag/res24/re.ico rename to srchybrid/flag/res24/re.ico diff --git a/flag/res24/ro.ico b/srchybrid/flag/res24/ro.ico similarity index 100% rename from flag/res24/ro.ico rename to srchybrid/flag/res24/ro.ico diff --git a/flag/res24/rs.ico b/srchybrid/flag/res24/rs.ico similarity index 100% rename from flag/res24/rs.ico rename to srchybrid/flag/res24/rs.ico diff --git a/flag/res24/ru.ico b/srchybrid/flag/res24/ru.ico similarity index 100% rename from flag/res24/ru.ico rename to srchybrid/flag/res24/ru.ico diff --git a/flag/res24/rw.ico b/srchybrid/flag/res24/rw.ico similarity index 100% rename from flag/res24/rw.ico rename to srchybrid/flag/res24/rw.ico diff --git a/flag/res24/sa.ico b/srchybrid/flag/res24/sa.ico similarity index 100% rename from flag/res24/sa.ico rename to srchybrid/flag/res24/sa.ico diff --git a/flag/res24/sb.ico b/srchybrid/flag/res24/sb.ico similarity index 100% rename from flag/res24/sb.ico rename to srchybrid/flag/res24/sb.ico diff --git a/flag/res24/sc.ico b/srchybrid/flag/res24/sc.ico similarity index 100% rename from flag/res24/sc.ico rename to srchybrid/flag/res24/sc.ico diff --git a/flag/res24/sco.ico b/srchybrid/flag/res24/sco.ico similarity index 100% rename from flag/res24/sco.ico rename to srchybrid/flag/res24/sco.ico diff --git a/flag/res24/sd.ico b/srchybrid/flag/res24/sd.ico similarity index 100% rename from flag/res24/sd.ico rename to srchybrid/flag/res24/sd.ico diff --git a/flag/res24/se.ico b/srchybrid/flag/res24/se.ico similarity index 100% rename from flag/res24/se.ico rename to srchybrid/flag/res24/se.ico diff --git a/flag/res24/sg.ico b/srchybrid/flag/res24/sg.ico similarity index 100% rename from flag/res24/sg.ico rename to srchybrid/flag/res24/sg.ico diff --git a/flag/res24/sh.ico b/srchybrid/flag/res24/sh.ico similarity index 100% rename from flag/res24/sh.ico rename to srchybrid/flag/res24/sh.ico diff --git a/flag/res24/si.ico b/srchybrid/flag/res24/si.ico similarity index 100% rename from flag/res24/si.ico rename to srchybrid/flag/res24/si.ico diff --git a/flag/res24/sk.ico b/srchybrid/flag/res24/sk.ico similarity index 100% rename from flag/res24/sk.ico rename to srchybrid/flag/res24/sk.ico diff --git a/flag/res24/sl.ico b/srchybrid/flag/res24/sl.ico similarity index 100% rename from flag/res24/sl.ico rename to srchybrid/flag/res24/sl.ico diff --git a/flag/res24/sm.ico b/srchybrid/flag/res24/sm.ico similarity index 100% rename from flag/res24/sm.ico rename to srchybrid/flag/res24/sm.ico diff --git a/flag/res24/sn.ico b/srchybrid/flag/res24/sn.ico similarity index 100% rename from flag/res24/sn.ico rename to srchybrid/flag/res24/sn.ico diff --git a/flag/res24/so.ico b/srchybrid/flag/res24/so.ico similarity index 100% rename from flag/res24/so.ico rename to srchybrid/flag/res24/so.ico diff --git a/flag/res24/sr.ico b/srchybrid/flag/res24/sr.ico similarity index 100% rename from flag/res24/sr.ico rename to srchybrid/flag/res24/sr.ico diff --git a/flag/res24/st.ico b/srchybrid/flag/res24/st.ico similarity index 100% rename from flag/res24/st.ico rename to srchybrid/flag/res24/st.ico diff --git a/flag/res24/su.ico b/srchybrid/flag/res24/su.ico similarity index 100% rename from flag/res24/su.ico rename to srchybrid/flag/res24/su.ico diff --git a/flag/res24/sv.ico b/srchybrid/flag/res24/sv.ico similarity index 100% rename from flag/res24/sv.ico rename to srchybrid/flag/res24/sv.ico diff --git a/flag/res24/sy.ico b/srchybrid/flag/res24/sy.ico similarity index 100% rename from flag/res24/sy.ico rename to srchybrid/flag/res24/sy.ico diff --git a/flag/res24/sz.ico b/srchybrid/flag/res24/sz.ico similarity index 100% rename from flag/res24/sz.ico rename to srchybrid/flag/res24/sz.ico diff --git a/flag/res24/tc.ico b/srchybrid/flag/res24/tc.ico similarity index 100% rename from flag/res24/tc.ico rename to srchybrid/flag/res24/tc.ico diff --git a/flag/res24/td.ico b/srchybrid/flag/res24/td.ico similarity index 100% rename from flag/res24/td.ico rename to srchybrid/flag/res24/td.ico diff --git a/flag/res24/tf.ico b/srchybrid/flag/res24/tf.ico similarity index 100% rename from flag/res24/tf.ico rename to srchybrid/flag/res24/tf.ico diff --git a/flag/res24/tg.ico b/srchybrid/flag/res24/tg.ico similarity index 100% rename from flag/res24/tg.ico rename to srchybrid/flag/res24/tg.ico diff --git a/flag/res24/th.ico b/srchybrid/flag/res24/th.ico similarity index 100% rename from flag/res24/th.ico rename to srchybrid/flag/res24/th.ico diff --git a/flag/res24/tj.ico b/srchybrid/flag/res24/tj.ico similarity index 100% rename from flag/res24/tj.ico rename to srchybrid/flag/res24/tj.ico diff --git a/flag/res24/tk.ico b/srchybrid/flag/res24/tk.ico similarity index 100% rename from flag/res24/tk.ico rename to srchybrid/flag/res24/tk.ico diff --git a/flag/res24/tl.ico b/srchybrid/flag/res24/tl.ico similarity index 100% rename from flag/res24/tl.ico rename to srchybrid/flag/res24/tl.ico diff --git a/flag/res24/tm.ico b/srchybrid/flag/res24/tm.ico similarity index 100% rename from flag/res24/tm.ico rename to srchybrid/flag/res24/tm.ico diff --git a/flag/res24/tn.ico b/srchybrid/flag/res24/tn.ico similarity index 100% rename from flag/res24/tn.ico rename to srchybrid/flag/res24/tn.ico diff --git a/flag/res24/to.ico b/srchybrid/flag/res24/to.ico similarity index 100% rename from flag/res24/to.ico rename to srchybrid/flag/res24/to.ico diff --git a/flag/res24/tp.ico b/srchybrid/flag/res24/tp.ico similarity index 100% rename from flag/res24/tp.ico rename to srchybrid/flag/res24/tp.ico diff --git a/flag/res24/tr.ico b/srchybrid/flag/res24/tr.ico similarity index 100% rename from flag/res24/tr.ico rename to srchybrid/flag/res24/tr.ico diff --git a/flag/res24/tt.ico b/srchybrid/flag/res24/tt.ico similarity index 100% rename from flag/res24/tt.ico rename to srchybrid/flag/res24/tt.ico diff --git a/flag/res24/tv.ico b/srchybrid/flag/res24/tv.ico similarity index 100% rename from flag/res24/tv.ico rename to srchybrid/flag/res24/tv.ico diff --git a/flag/res24/tw.ico b/srchybrid/flag/res24/tw.ico similarity index 100% rename from flag/res24/tw.ico rename to srchybrid/flag/res24/tw.ico diff --git a/flag/res24/tz.ico b/srchybrid/flag/res24/tz.ico similarity index 100% rename from flag/res24/tz.ico rename to srchybrid/flag/res24/tz.ico diff --git a/flag/res24/ua.ico b/srchybrid/flag/res24/ua.ico similarity index 100% rename from flag/res24/ua.ico rename to srchybrid/flag/res24/ua.ico diff --git a/flag/res24/ug.ico b/srchybrid/flag/res24/ug.ico similarity index 100% rename from flag/res24/ug.ico rename to srchybrid/flag/res24/ug.ico diff --git a/flag/res24/uk.ico b/srchybrid/flag/res24/uk.ico similarity index 100% rename from flag/res24/uk.ico rename to srchybrid/flag/res24/uk.ico diff --git a/flag/res24/um.ico b/srchybrid/flag/res24/um.ico similarity index 100% rename from flag/res24/um.ico rename to srchybrid/flag/res24/um.ico diff --git a/flag/res24/us.ico b/srchybrid/flag/res24/us.ico similarity index 100% rename from flag/res24/us.ico rename to srchybrid/flag/res24/us.ico diff --git a/flag/res24/uy.ico b/srchybrid/flag/res24/uy.ico similarity index 100% rename from flag/res24/uy.ico rename to srchybrid/flag/res24/uy.ico diff --git a/flag/res24/uz.ico b/srchybrid/flag/res24/uz.ico similarity index 100% rename from flag/res24/uz.ico rename to srchybrid/flag/res24/uz.ico diff --git a/flag/res24/va.ico b/srchybrid/flag/res24/va.ico similarity index 100% rename from flag/res24/va.ico rename to srchybrid/flag/res24/va.ico diff --git a/flag/res24/vc.ico b/srchybrid/flag/res24/vc.ico similarity index 100% rename from flag/res24/vc.ico rename to srchybrid/flag/res24/vc.ico diff --git a/flag/res24/ve.ico b/srchybrid/flag/res24/ve.ico similarity index 100% rename from flag/res24/ve.ico rename to srchybrid/flag/res24/ve.ico diff --git a/flag/res24/vg.ico b/srchybrid/flag/res24/vg.ico similarity index 100% rename from flag/res24/vg.ico rename to srchybrid/flag/res24/vg.ico diff --git a/flag/res24/vi.ico b/srchybrid/flag/res24/vi.ico similarity index 100% rename from flag/res24/vi.ico rename to srchybrid/flag/res24/vi.ico diff --git a/flag/res24/vn.ico b/srchybrid/flag/res24/vn.ico similarity index 100% rename from flag/res24/vn.ico rename to srchybrid/flag/res24/vn.ico diff --git a/flag/res24/vu.ico b/srchybrid/flag/res24/vu.ico similarity index 100% rename from flag/res24/vu.ico rename to srchybrid/flag/res24/vu.ico diff --git a/flag/res24/wf.ico b/srchybrid/flag/res24/wf.ico similarity index 100% rename from flag/res24/wf.ico rename to srchybrid/flag/res24/wf.ico diff --git a/flag/res24/wls.ico b/srchybrid/flag/res24/wls.ico similarity index 100% rename from flag/res24/wls.ico rename to srchybrid/flag/res24/wls.ico diff --git a/flag/res24/ws.ico b/srchybrid/flag/res24/ws.ico similarity index 100% rename from flag/res24/ws.ico rename to srchybrid/flag/res24/ws.ico diff --git a/flag/res24/ye.ico b/srchybrid/flag/res24/ye.ico similarity index 100% rename from flag/res24/ye.ico rename to srchybrid/flag/res24/ye.ico diff --git a/flag/res24/yt.ico b/srchybrid/flag/res24/yt.ico similarity index 100% rename from flag/res24/yt.ico rename to srchybrid/flag/res24/yt.ico diff --git a/flag/res24/yu.ico b/srchybrid/flag/res24/yu.ico similarity index 100% rename from flag/res24/yu.ico rename to srchybrid/flag/res24/yu.ico diff --git a/flag/res24/za.ico b/srchybrid/flag/res24/za.ico similarity index 100% rename from flag/res24/za.ico rename to srchybrid/flag/res24/za.ico diff --git a/flag/res24/zm.ico b/srchybrid/flag/res24/zm.ico similarity index 100% rename from flag/res24/zm.ico rename to srchybrid/flag/res24/zm.ico diff --git a/flag/res24/zw.ico b/srchybrid/flag/res24/zw.ico similarity index 100% rename from flag/res24/zw.ico rename to srchybrid/flag/res24/zw.ico diff --git a/flag/res32/ad.ico b/srchybrid/flag/res32/ad.ico similarity index 100% rename from flag/res32/ad.ico rename to srchybrid/flag/res32/ad.ico diff --git a/flag/res32/ae.ico b/srchybrid/flag/res32/ae.ico similarity index 100% rename from flag/res32/ae.ico rename to srchybrid/flag/res32/ae.ico diff --git a/flag/res32/af.ico b/srchybrid/flag/res32/af.ico similarity index 100% rename from flag/res32/af.ico rename to srchybrid/flag/res32/af.ico diff --git a/flag/res32/ag.ico b/srchybrid/flag/res32/ag.ico similarity index 100% rename from flag/res32/ag.ico rename to srchybrid/flag/res32/ag.ico diff --git a/flag/res32/ai.ico b/srchybrid/flag/res32/ai.ico similarity index 100% rename from flag/res32/ai.ico rename to srchybrid/flag/res32/ai.ico diff --git a/flag/res32/al.ico b/srchybrid/flag/res32/al.ico similarity index 100% rename from flag/res32/al.ico rename to srchybrid/flag/res32/al.ico diff --git a/flag/res32/am.ico b/srchybrid/flag/res32/am.ico similarity index 100% rename from flag/res32/am.ico rename to srchybrid/flag/res32/am.ico diff --git a/flag/res32/an.ico b/srchybrid/flag/res32/an.ico similarity index 100% rename from flag/res32/an.ico rename to srchybrid/flag/res32/an.ico diff --git a/flag/res32/ao.ico b/srchybrid/flag/res32/ao.ico similarity index 100% rename from flag/res32/ao.ico rename to srchybrid/flag/res32/ao.ico diff --git a/flag/res32/ap.ico b/srchybrid/flag/res32/ap.ico similarity index 100% rename from flag/res32/ap.ico rename to srchybrid/flag/res32/ap.ico diff --git a/flag/res32/aq.ico b/srchybrid/flag/res32/aq.ico similarity index 100% rename from flag/res32/aq.ico rename to srchybrid/flag/res32/aq.ico diff --git a/flag/res32/ar.ico b/srchybrid/flag/res32/ar.ico similarity index 100% rename from flag/res32/ar.ico rename to srchybrid/flag/res32/ar.ico diff --git a/flag/res32/as.ico b/srchybrid/flag/res32/as.ico similarity index 100% rename from flag/res32/as.ico rename to srchybrid/flag/res32/as.ico diff --git a/flag/res32/at.ico b/srchybrid/flag/res32/at.ico similarity index 100% rename from flag/res32/at.ico rename to srchybrid/flag/res32/at.ico diff --git a/flag/res32/au.ico b/srchybrid/flag/res32/au.ico similarity index 100% rename from flag/res32/au.ico rename to srchybrid/flag/res32/au.ico diff --git a/flag/res32/aw.ico b/srchybrid/flag/res32/aw.ico similarity index 100% rename from flag/res32/aw.ico rename to srchybrid/flag/res32/aw.ico diff --git a/flag/res32/ax.ico b/srchybrid/flag/res32/ax.ico similarity index 100% rename from flag/res32/ax.ico rename to srchybrid/flag/res32/ax.ico diff --git a/flag/res32/az.ico b/srchybrid/flag/res32/az.ico similarity index 100% rename from flag/res32/az.ico rename to srchybrid/flag/res32/az.ico diff --git a/flag/res32/ba.ico b/srchybrid/flag/res32/ba.ico similarity index 100% rename from flag/res32/ba.ico rename to srchybrid/flag/res32/ba.ico diff --git a/flag/res32/bb.ico b/srchybrid/flag/res32/bb.ico similarity index 100% rename from flag/res32/bb.ico rename to srchybrid/flag/res32/bb.ico diff --git a/flag/res32/bd.ico b/srchybrid/flag/res32/bd.ico similarity index 100% rename from flag/res32/bd.ico rename to srchybrid/flag/res32/bd.ico diff --git a/flag/res32/be.ico b/srchybrid/flag/res32/be.ico similarity index 100% rename from flag/res32/be.ico rename to srchybrid/flag/res32/be.ico diff --git a/flag/res32/bf.ico b/srchybrid/flag/res32/bf.ico similarity index 100% rename from flag/res32/bf.ico rename to srchybrid/flag/res32/bf.ico diff --git a/flag/res32/bg.ico b/srchybrid/flag/res32/bg.ico similarity index 100% rename from flag/res32/bg.ico rename to srchybrid/flag/res32/bg.ico diff --git a/flag/res32/bh.ico b/srchybrid/flag/res32/bh.ico similarity index 100% rename from flag/res32/bh.ico rename to srchybrid/flag/res32/bh.ico diff --git a/flag/res32/bi.ico b/srchybrid/flag/res32/bi.ico similarity index 100% rename from flag/res32/bi.ico rename to srchybrid/flag/res32/bi.ico diff --git a/flag/res32/bj.ico b/srchybrid/flag/res32/bj.ico similarity index 100% rename from flag/res32/bj.ico rename to srchybrid/flag/res32/bj.ico diff --git a/flag/res32/bl.ico b/srchybrid/flag/res32/bl.ico similarity index 100% rename from flag/res32/bl.ico rename to srchybrid/flag/res32/bl.ico diff --git a/flag/res32/bm.ico b/srchybrid/flag/res32/bm.ico similarity index 100% rename from flag/res32/bm.ico rename to srchybrid/flag/res32/bm.ico diff --git a/flag/res32/bn.ico b/srchybrid/flag/res32/bn.ico similarity index 100% rename from flag/res32/bn.ico rename to srchybrid/flag/res32/bn.ico diff --git a/flag/res32/bo.ico b/srchybrid/flag/res32/bo.ico similarity index 100% rename from flag/res32/bo.ico rename to srchybrid/flag/res32/bo.ico diff --git a/flag/res32/br.ico b/srchybrid/flag/res32/br.ico similarity index 100% rename from flag/res32/br.ico rename to srchybrid/flag/res32/br.ico diff --git a/flag/res32/bs.ico b/srchybrid/flag/res32/bs.ico similarity index 100% rename from flag/res32/bs.ico rename to srchybrid/flag/res32/bs.ico diff --git a/flag/res32/bt.ico b/srchybrid/flag/res32/bt.ico similarity index 100% rename from flag/res32/bt.ico rename to srchybrid/flag/res32/bt.ico diff --git a/flag/res32/bv.ico b/srchybrid/flag/res32/bv.ico similarity index 100% rename from flag/res32/bv.ico rename to srchybrid/flag/res32/bv.ico diff --git a/flag/res32/bw.ico b/srchybrid/flag/res32/bw.ico similarity index 100% rename from flag/res32/bw.ico rename to srchybrid/flag/res32/bw.ico diff --git a/flag/res32/by.ico b/srchybrid/flag/res32/by.ico similarity index 100% rename from flag/res32/by.ico rename to srchybrid/flag/res32/by.ico diff --git a/flag/res32/bz.ico b/srchybrid/flag/res32/bz.ico similarity index 100% rename from flag/res32/bz.ico rename to srchybrid/flag/res32/bz.ico diff --git a/flag/res32/ca.ico b/srchybrid/flag/res32/ca.ico similarity index 100% rename from flag/res32/ca.ico rename to srchybrid/flag/res32/ca.ico diff --git a/flag/res32/cc.ico b/srchybrid/flag/res32/cc.ico similarity index 100% rename from flag/res32/cc.ico rename to srchybrid/flag/res32/cc.ico diff --git a/flag/res32/cd.ico b/srchybrid/flag/res32/cd.ico similarity index 100% rename from flag/res32/cd.ico rename to srchybrid/flag/res32/cd.ico diff --git a/flag/res32/cf.ico b/srchybrid/flag/res32/cf.ico similarity index 100% rename from flag/res32/cf.ico rename to srchybrid/flag/res32/cf.ico diff --git a/flag/res32/cg.ico b/srchybrid/flag/res32/cg.ico similarity index 100% rename from flag/res32/cg.ico rename to srchybrid/flag/res32/cg.ico diff --git a/flag/res32/ch.ico b/srchybrid/flag/res32/ch.ico similarity index 100% rename from flag/res32/ch.ico rename to srchybrid/flag/res32/ch.ico diff --git a/flag/res32/ci.ico b/srchybrid/flag/res32/ci.ico similarity index 100% rename from flag/res32/ci.ico rename to srchybrid/flag/res32/ci.ico diff --git a/flag/res32/ck.ico b/srchybrid/flag/res32/ck.ico similarity index 100% rename from flag/res32/ck.ico rename to srchybrid/flag/res32/ck.ico diff --git a/flag/res32/cl.ico b/srchybrid/flag/res32/cl.ico similarity index 100% rename from flag/res32/cl.ico rename to srchybrid/flag/res32/cl.ico diff --git a/flag/res32/cm.ico b/srchybrid/flag/res32/cm.ico similarity index 100% rename from flag/res32/cm.ico rename to srchybrid/flag/res32/cm.ico diff --git a/flag/res32/cn.ico b/srchybrid/flag/res32/cn.ico similarity index 100% rename from flag/res32/cn.ico rename to srchybrid/flag/res32/cn.ico diff --git a/flag/res32/co.ico b/srchybrid/flag/res32/co.ico similarity index 100% rename from flag/res32/co.ico rename to srchybrid/flag/res32/co.ico diff --git a/flag/res32/cr.ico b/srchybrid/flag/res32/cr.ico similarity index 100% rename from flag/res32/cr.ico rename to srchybrid/flag/res32/cr.ico diff --git a/flag/res32/cs.ico b/srchybrid/flag/res32/cs.ico similarity index 100% rename from flag/res32/cs.ico rename to srchybrid/flag/res32/cs.ico diff --git a/flag/res32/cu.ico b/srchybrid/flag/res32/cu.ico similarity index 100% rename from flag/res32/cu.ico rename to srchybrid/flag/res32/cu.ico diff --git a/flag/res32/cv.ico b/srchybrid/flag/res32/cv.ico similarity index 100% rename from flag/res32/cv.ico rename to srchybrid/flag/res32/cv.ico diff --git a/flag/res32/cx.ico b/srchybrid/flag/res32/cx.ico similarity index 100% rename from flag/res32/cx.ico rename to srchybrid/flag/res32/cx.ico diff --git a/flag/res32/cy.ico b/srchybrid/flag/res32/cy.ico similarity index 100% rename from flag/res32/cy.ico rename to srchybrid/flag/res32/cy.ico diff --git a/flag/res32/cz.ico b/srchybrid/flag/res32/cz.ico similarity index 100% rename from flag/res32/cz.ico rename to srchybrid/flag/res32/cz.ico diff --git a/flag/res32/de.ico b/srchybrid/flag/res32/de.ico similarity index 100% rename from flag/res32/de.ico rename to srchybrid/flag/res32/de.ico diff --git a/flag/res32/dj.ico b/srchybrid/flag/res32/dj.ico similarity index 100% rename from flag/res32/dj.ico rename to srchybrid/flag/res32/dj.ico diff --git a/flag/res32/dk.ico b/srchybrid/flag/res32/dk.ico similarity index 100% rename from flag/res32/dk.ico rename to srchybrid/flag/res32/dk.ico diff --git a/flag/res32/dm.ico b/srchybrid/flag/res32/dm.ico similarity index 100% rename from flag/res32/dm.ico rename to srchybrid/flag/res32/dm.ico diff --git a/flag/res32/do.ico b/srchybrid/flag/res32/do.ico similarity index 100% rename from flag/res32/do.ico rename to srchybrid/flag/res32/do.ico diff --git a/flag/res32/dz.ico b/srchybrid/flag/res32/dz.ico similarity index 100% rename from flag/res32/dz.ico rename to srchybrid/flag/res32/dz.ico diff --git a/flag/res32/ec.ico b/srchybrid/flag/res32/ec.ico similarity index 100% rename from flag/res32/ec.ico rename to srchybrid/flag/res32/ec.ico diff --git a/flag/res32/ee.ico b/srchybrid/flag/res32/ee.ico similarity index 100% rename from flag/res32/ee.ico rename to srchybrid/flag/res32/ee.ico diff --git a/flag/res32/eg.ico b/srchybrid/flag/res32/eg.ico similarity index 100% rename from flag/res32/eg.ico rename to srchybrid/flag/res32/eg.ico diff --git a/flag/res32/eh.ico b/srchybrid/flag/res32/eh.ico similarity index 100% rename from flag/res32/eh.ico rename to srchybrid/flag/res32/eh.ico diff --git a/flag/res32/eng.ico b/srchybrid/flag/res32/eng.ico similarity index 100% rename from flag/res32/eng.ico rename to srchybrid/flag/res32/eng.ico diff --git a/flag/res32/er.ico b/srchybrid/flag/res32/er.ico similarity index 100% rename from flag/res32/er.ico rename to srchybrid/flag/res32/er.ico diff --git a/flag/res32/es.ico b/srchybrid/flag/res32/es.ico similarity index 100% rename from flag/res32/es.ico rename to srchybrid/flag/res32/es.ico diff --git a/flag/res32/et.ico b/srchybrid/flag/res32/et.ico similarity index 100% rename from flag/res32/et.ico rename to srchybrid/flag/res32/et.ico diff --git a/flag/res32/eu.ico b/srchybrid/flag/res32/eu.ico similarity index 100% rename from flag/res32/eu.ico rename to srchybrid/flag/res32/eu.ico diff --git a/flag/res32/fi.ico b/srchybrid/flag/res32/fi.ico similarity index 100% rename from flag/res32/fi.ico rename to srchybrid/flag/res32/fi.ico diff --git a/flag/res32/fj.ico b/srchybrid/flag/res32/fj.ico similarity index 100% rename from flag/res32/fj.ico rename to srchybrid/flag/res32/fj.ico diff --git a/flag/res32/fk.ico b/srchybrid/flag/res32/fk.ico similarity index 100% rename from flag/res32/fk.ico rename to srchybrid/flag/res32/fk.ico diff --git a/flag/res32/fm.ico b/srchybrid/flag/res32/fm.ico similarity index 100% rename from flag/res32/fm.ico rename to srchybrid/flag/res32/fm.ico diff --git a/flag/res32/fo.ico b/srchybrid/flag/res32/fo.ico similarity index 100% rename from flag/res32/fo.ico rename to srchybrid/flag/res32/fo.ico diff --git a/flag/res32/fr.ico b/srchybrid/flag/res32/fr.ico similarity index 100% rename from flag/res32/fr.ico rename to srchybrid/flag/res32/fr.ico diff --git a/flag/res32/ga.ico b/srchybrid/flag/res32/ga.ico similarity index 100% rename from flag/res32/ga.ico rename to srchybrid/flag/res32/ga.ico diff --git a/flag/res32/gb.ico b/srchybrid/flag/res32/gb.ico similarity index 100% rename from flag/res32/gb.ico rename to srchybrid/flag/res32/gb.ico diff --git a/flag/res32/gd.ico b/srchybrid/flag/res32/gd.ico similarity index 100% rename from flag/res32/gd.ico rename to srchybrid/flag/res32/gd.ico diff --git a/flag/res32/ge.ico b/srchybrid/flag/res32/ge.ico similarity index 100% rename from flag/res32/ge.ico rename to srchybrid/flag/res32/ge.ico diff --git a/flag/res32/gf.ico b/srchybrid/flag/res32/gf.ico similarity index 100% rename from flag/res32/gf.ico rename to srchybrid/flag/res32/gf.ico diff --git a/flag/res32/gg.ico b/srchybrid/flag/res32/gg.ico similarity index 100% rename from flag/res32/gg.ico rename to srchybrid/flag/res32/gg.ico diff --git a/flag/res32/gh.ico b/srchybrid/flag/res32/gh.ico similarity index 100% rename from flag/res32/gh.ico rename to srchybrid/flag/res32/gh.ico diff --git a/flag/res32/gi.ico b/srchybrid/flag/res32/gi.ico similarity index 100% rename from flag/res32/gi.ico rename to srchybrid/flag/res32/gi.ico diff --git a/flag/res32/gk.ico b/srchybrid/flag/res32/gk.ico similarity index 100% rename from flag/res32/gk.ico rename to srchybrid/flag/res32/gk.ico diff --git a/flag/res32/gl.ico b/srchybrid/flag/res32/gl.ico similarity index 100% rename from flag/res32/gl.ico rename to srchybrid/flag/res32/gl.ico diff --git a/flag/res32/gm.ico b/srchybrid/flag/res32/gm.ico similarity index 100% rename from flag/res32/gm.ico rename to srchybrid/flag/res32/gm.ico diff --git a/flag/res32/gn.ico b/srchybrid/flag/res32/gn.ico similarity index 100% rename from flag/res32/gn.ico rename to srchybrid/flag/res32/gn.ico diff --git a/flag/res32/gp.ico b/srchybrid/flag/res32/gp.ico similarity index 100% rename from flag/res32/gp.ico rename to srchybrid/flag/res32/gp.ico diff --git a/flag/res32/gq.ico b/srchybrid/flag/res32/gq.ico similarity index 100% rename from flag/res32/gq.ico rename to srchybrid/flag/res32/gq.ico diff --git a/flag/res32/gr.ico b/srchybrid/flag/res32/gr.ico similarity index 100% rename from flag/res32/gr.ico rename to srchybrid/flag/res32/gr.ico diff --git a/flag/res32/gs.ico b/srchybrid/flag/res32/gs.ico similarity index 100% rename from flag/res32/gs.ico rename to srchybrid/flag/res32/gs.ico diff --git a/flag/res32/gt.ico b/srchybrid/flag/res32/gt.ico similarity index 100% rename from flag/res32/gt.ico rename to srchybrid/flag/res32/gt.ico diff --git a/flag/res32/gu.ico b/srchybrid/flag/res32/gu.ico similarity index 100% rename from flag/res32/gu.ico rename to srchybrid/flag/res32/gu.ico diff --git a/flag/res32/gw.ico b/srchybrid/flag/res32/gw.ico similarity index 100% rename from flag/res32/gw.ico rename to srchybrid/flag/res32/gw.ico diff --git a/flag/res32/gy.ico b/srchybrid/flag/res32/gy.ico similarity index 100% rename from flag/res32/gy.ico rename to srchybrid/flag/res32/gy.ico diff --git a/flag/res32/hk.ico b/srchybrid/flag/res32/hk.ico similarity index 100% rename from flag/res32/hk.ico rename to srchybrid/flag/res32/hk.ico diff --git a/flag/res32/hn.ico b/srchybrid/flag/res32/hn.ico similarity index 100% rename from flag/res32/hn.ico rename to srchybrid/flag/res32/hn.ico diff --git a/flag/res32/hr.ico b/srchybrid/flag/res32/hr.ico similarity index 100% rename from flag/res32/hr.ico rename to srchybrid/flag/res32/hr.ico diff --git a/flag/res32/ht.ico b/srchybrid/flag/res32/ht.ico similarity index 100% rename from flag/res32/ht.ico rename to srchybrid/flag/res32/ht.ico diff --git a/flag/res32/hu.ico b/srchybrid/flag/res32/hu.ico similarity index 100% rename from flag/res32/hu.ico rename to srchybrid/flag/res32/hu.ico diff --git a/flag/res32/id.ico b/srchybrid/flag/res32/id.ico similarity index 100% rename from flag/res32/id.ico rename to srchybrid/flag/res32/id.ico diff --git a/flag/res32/ie.ico b/srchybrid/flag/res32/ie.ico similarity index 100% rename from flag/res32/ie.ico rename to srchybrid/flag/res32/ie.ico diff --git a/flag/res32/il.ico b/srchybrid/flag/res32/il.ico similarity index 100% rename from flag/res32/il.ico rename to srchybrid/flag/res32/il.ico diff --git a/flag/res32/im.ico b/srchybrid/flag/res32/im.ico similarity index 100% rename from flag/res32/im.ico rename to srchybrid/flag/res32/im.ico diff --git a/flag/res32/in.ico b/srchybrid/flag/res32/in.ico similarity index 100% rename from flag/res32/in.ico rename to srchybrid/flag/res32/in.ico diff --git a/flag/res32/io.ico b/srchybrid/flag/res32/io.ico similarity index 100% rename from flag/res32/io.ico rename to srchybrid/flag/res32/io.ico diff --git a/flag/res32/iq.ico b/srchybrid/flag/res32/iq.ico similarity index 100% rename from flag/res32/iq.ico rename to srchybrid/flag/res32/iq.ico diff --git a/flag/res32/ir.ico b/srchybrid/flag/res32/ir.ico similarity index 100% rename from flag/res32/ir.ico rename to srchybrid/flag/res32/ir.ico diff --git a/flag/res32/is.ico b/srchybrid/flag/res32/is.ico similarity index 100% rename from flag/res32/is.ico rename to srchybrid/flag/res32/is.ico diff --git a/flag/res32/it.ico b/srchybrid/flag/res32/it.ico similarity index 100% rename from flag/res32/it.ico rename to srchybrid/flag/res32/it.ico diff --git a/flag/res32/je.ico b/srchybrid/flag/res32/je.ico similarity index 100% rename from flag/res32/je.ico rename to srchybrid/flag/res32/je.ico diff --git a/flag/res32/jm.ico b/srchybrid/flag/res32/jm.ico similarity index 100% rename from flag/res32/jm.ico rename to srchybrid/flag/res32/jm.ico diff --git a/flag/res32/jo.ico b/srchybrid/flag/res32/jo.ico similarity index 100% rename from flag/res32/jo.ico rename to srchybrid/flag/res32/jo.ico diff --git a/flag/res32/jp.ico b/srchybrid/flag/res32/jp.ico similarity index 100% rename from flag/res32/jp.ico rename to srchybrid/flag/res32/jp.ico diff --git a/flag/res32/ke.ico b/srchybrid/flag/res32/ke.ico similarity index 100% rename from flag/res32/ke.ico rename to srchybrid/flag/res32/ke.ico diff --git a/flag/res32/kg.ico b/srchybrid/flag/res32/kg.ico similarity index 100% rename from flag/res32/kg.ico rename to srchybrid/flag/res32/kg.ico diff --git a/flag/res32/kh.ico b/srchybrid/flag/res32/kh.ico similarity index 100% rename from flag/res32/kh.ico rename to srchybrid/flag/res32/kh.ico diff --git a/flag/res32/ki.ico b/srchybrid/flag/res32/ki.ico similarity index 100% rename from flag/res32/ki.ico rename to srchybrid/flag/res32/ki.ico diff --git a/flag/res32/km.ico b/srchybrid/flag/res32/km.ico similarity index 100% rename from flag/res32/km.ico rename to srchybrid/flag/res32/km.ico diff --git a/flag/res32/kn.ico b/srchybrid/flag/res32/kn.ico similarity index 100% rename from flag/res32/kn.ico rename to srchybrid/flag/res32/kn.ico diff --git a/flag/res32/kp.ico b/srchybrid/flag/res32/kp.ico similarity index 100% rename from flag/res32/kp.ico rename to srchybrid/flag/res32/kp.ico diff --git a/flag/res32/kr.ico b/srchybrid/flag/res32/kr.ico similarity index 100% rename from flag/res32/kr.ico rename to srchybrid/flag/res32/kr.ico diff --git a/flag/res32/kw.ico b/srchybrid/flag/res32/kw.ico similarity index 100% rename from flag/res32/kw.ico rename to srchybrid/flag/res32/kw.ico diff --git a/flag/res32/ky.ico b/srchybrid/flag/res32/ky.ico similarity index 100% rename from flag/res32/ky.ico rename to srchybrid/flag/res32/ky.ico diff --git a/flag/res32/kz.ico b/srchybrid/flag/res32/kz.ico similarity index 100% rename from flag/res32/kz.ico rename to srchybrid/flag/res32/kz.ico diff --git a/flag/res32/la.ico b/srchybrid/flag/res32/la.ico similarity index 100% rename from flag/res32/la.ico rename to srchybrid/flag/res32/la.ico diff --git a/flag/res32/lb.ico b/srchybrid/flag/res32/lb.ico similarity index 100% rename from flag/res32/lb.ico rename to srchybrid/flag/res32/lb.ico diff --git a/flag/res32/lc.ico b/srchybrid/flag/res32/lc.ico similarity index 100% rename from flag/res32/lc.ico rename to srchybrid/flag/res32/lc.ico diff --git a/flag/res32/li.ico b/srchybrid/flag/res32/li.ico similarity index 100% rename from flag/res32/li.ico rename to srchybrid/flag/res32/li.ico diff --git a/flag/res32/lk.ico b/srchybrid/flag/res32/lk.ico similarity index 100% rename from flag/res32/lk.ico rename to srchybrid/flag/res32/lk.ico diff --git a/flag/res32/lr.ico b/srchybrid/flag/res32/lr.ico similarity index 100% rename from flag/res32/lr.ico rename to srchybrid/flag/res32/lr.ico diff --git a/flag/res32/ls.ico b/srchybrid/flag/res32/ls.ico similarity index 100% rename from flag/res32/ls.ico rename to srchybrid/flag/res32/ls.ico diff --git a/flag/res32/lt.ico b/srchybrid/flag/res32/lt.ico similarity index 100% rename from flag/res32/lt.ico rename to srchybrid/flag/res32/lt.ico diff --git a/flag/res32/lu.ico b/srchybrid/flag/res32/lu.ico similarity index 100% rename from flag/res32/lu.ico rename to srchybrid/flag/res32/lu.ico diff --git a/flag/res32/lv.ico b/srchybrid/flag/res32/lv.ico similarity index 100% rename from flag/res32/lv.ico rename to srchybrid/flag/res32/lv.ico diff --git a/flag/res32/ly.ico b/srchybrid/flag/res32/ly.ico similarity index 100% rename from flag/res32/ly.ico rename to srchybrid/flag/res32/ly.ico diff --git a/flag/res32/ma.ico b/srchybrid/flag/res32/ma.ico similarity index 100% rename from flag/res32/ma.ico rename to srchybrid/flag/res32/ma.ico diff --git a/flag/res32/mc.ico b/srchybrid/flag/res32/mc.ico similarity index 100% rename from flag/res32/mc.ico rename to srchybrid/flag/res32/mc.ico diff --git a/flag/res32/md.ico b/srchybrid/flag/res32/md.ico similarity index 100% rename from flag/res32/md.ico rename to srchybrid/flag/res32/md.ico diff --git a/flag/res32/me.ico b/srchybrid/flag/res32/me.ico similarity index 100% rename from flag/res32/me.ico rename to srchybrid/flag/res32/me.ico diff --git a/flag/res32/mf.ico b/srchybrid/flag/res32/mf.ico similarity index 100% rename from flag/res32/mf.ico rename to srchybrid/flag/res32/mf.ico diff --git a/flag/res32/mg.ico b/srchybrid/flag/res32/mg.ico similarity index 100% rename from flag/res32/mg.ico rename to srchybrid/flag/res32/mg.ico diff --git a/flag/res32/mh.ico b/srchybrid/flag/res32/mh.ico similarity index 100% rename from flag/res32/mh.ico rename to srchybrid/flag/res32/mh.ico diff --git a/flag/res32/mk.ico b/srchybrid/flag/res32/mk.ico similarity index 100% rename from flag/res32/mk.ico rename to srchybrid/flag/res32/mk.ico diff --git a/flag/res32/ml.ico b/srchybrid/flag/res32/ml.ico similarity index 100% rename from flag/res32/ml.ico rename to srchybrid/flag/res32/ml.ico diff --git a/flag/res32/mm.ico b/srchybrid/flag/res32/mm.ico similarity index 100% rename from flag/res32/mm.ico rename to srchybrid/flag/res32/mm.ico diff --git a/flag/res32/mn.ico b/srchybrid/flag/res32/mn.ico similarity index 100% rename from flag/res32/mn.ico rename to srchybrid/flag/res32/mn.ico diff --git a/flag/res32/mo.ico b/srchybrid/flag/res32/mo.ico similarity index 100% rename from flag/res32/mo.ico rename to srchybrid/flag/res32/mo.ico diff --git a/flag/res32/mp.ico b/srchybrid/flag/res32/mp.ico similarity index 100% rename from flag/res32/mp.ico rename to srchybrid/flag/res32/mp.ico diff --git a/flag/res32/mq.ico b/srchybrid/flag/res32/mq.ico similarity index 100% rename from flag/res32/mq.ico rename to srchybrid/flag/res32/mq.ico diff --git a/flag/res32/mr.ico b/srchybrid/flag/res32/mr.ico similarity index 100% rename from flag/res32/mr.ico rename to srchybrid/flag/res32/mr.ico diff --git a/flag/res32/ms.ico b/srchybrid/flag/res32/ms.ico similarity index 100% rename from flag/res32/ms.ico rename to srchybrid/flag/res32/ms.ico diff --git a/flag/res32/mt.ico b/srchybrid/flag/res32/mt.ico similarity index 100% rename from flag/res32/mt.ico rename to srchybrid/flag/res32/mt.ico diff --git a/flag/res32/mu.ico b/srchybrid/flag/res32/mu.ico similarity index 100% rename from flag/res32/mu.ico rename to srchybrid/flag/res32/mu.ico diff --git a/flag/res32/mv.ico b/srchybrid/flag/res32/mv.ico similarity index 100% rename from flag/res32/mv.ico rename to srchybrid/flag/res32/mv.ico diff --git a/flag/res32/mw.ico b/srchybrid/flag/res32/mw.ico similarity index 100% rename from flag/res32/mw.ico rename to srchybrid/flag/res32/mw.ico diff --git a/flag/res32/mx.ico b/srchybrid/flag/res32/mx.ico similarity index 100% rename from flag/res32/mx.ico rename to srchybrid/flag/res32/mx.ico diff --git a/flag/res32/my.ico b/srchybrid/flag/res32/my.ico similarity index 100% rename from flag/res32/my.ico rename to srchybrid/flag/res32/my.ico diff --git a/flag/res32/mz.ico b/srchybrid/flag/res32/mz.ico similarity index 100% rename from flag/res32/mz.ico rename to srchybrid/flag/res32/mz.ico diff --git a/flag/res32/na.ico b/srchybrid/flag/res32/na.ico similarity index 100% rename from flag/res32/na.ico rename to srchybrid/flag/res32/na.ico diff --git a/flag/res32/nc.ico b/srchybrid/flag/res32/nc.ico similarity index 100% rename from flag/res32/nc.ico rename to srchybrid/flag/res32/nc.ico diff --git a/flag/res32/ne.ico b/srchybrid/flag/res32/ne.ico similarity index 100% rename from flag/res32/ne.ico rename to srchybrid/flag/res32/ne.ico diff --git a/flag/res32/nf.ico b/srchybrid/flag/res32/nf.ico similarity index 100% rename from flag/res32/nf.ico rename to srchybrid/flag/res32/nf.ico diff --git a/flag/res32/ng.ico b/srchybrid/flag/res32/ng.ico similarity index 100% rename from flag/res32/ng.ico rename to srchybrid/flag/res32/ng.ico diff --git a/flag/res32/ni.ico b/srchybrid/flag/res32/ni.ico similarity index 100% rename from flag/res32/ni.ico rename to srchybrid/flag/res32/ni.ico diff --git a/flag/res32/nir.ico b/srchybrid/flag/res32/nir.ico similarity index 100% rename from flag/res32/nir.ico rename to srchybrid/flag/res32/nir.ico diff --git a/flag/res32/nl.ico b/srchybrid/flag/res32/nl.ico similarity index 100% rename from flag/res32/nl.ico rename to srchybrid/flag/res32/nl.ico diff --git a/flag/res32/no.ico b/srchybrid/flag/res32/no.ico similarity index 100% rename from flag/res32/no.ico rename to srchybrid/flag/res32/no.ico diff --git a/flag/res32/not.ico b/srchybrid/flag/res32/not.ico similarity index 100% rename from flag/res32/not.ico rename to srchybrid/flag/res32/not.ico diff --git a/flag/res32/np.ico b/srchybrid/flag/res32/np.ico similarity index 100% rename from flag/res32/np.ico rename to srchybrid/flag/res32/np.ico diff --git a/flag/res32/nr.ico b/srchybrid/flag/res32/nr.ico similarity index 100% rename from flag/res32/nr.ico rename to srchybrid/flag/res32/nr.ico diff --git a/flag/res32/nu.ico b/srchybrid/flag/res32/nu.ico similarity index 100% rename from flag/res32/nu.ico rename to srchybrid/flag/res32/nu.ico diff --git a/flag/res32/nz.ico b/srchybrid/flag/res32/nz.ico similarity index 100% rename from flag/res32/nz.ico rename to srchybrid/flag/res32/nz.ico diff --git a/flag/res32/om.ico b/srchybrid/flag/res32/om.ico similarity index 100% rename from flag/res32/om.ico rename to srchybrid/flag/res32/om.ico diff --git a/flag/res32/pa.ico b/srchybrid/flag/res32/pa.ico similarity index 100% rename from flag/res32/pa.ico rename to srchybrid/flag/res32/pa.ico diff --git a/flag/res32/pc.ico b/srchybrid/flag/res32/pc.ico similarity index 100% rename from flag/res32/pc.ico rename to srchybrid/flag/res32/pc.ico diff --git a/flag/res32/pe.ico b/srchybrid/flag/res32/pe.ico similarity index 100% rename from flag/res32/pe.ico rename to srchybrid/flag/res32/pe.ico diff --git a/flag/res32/pf.ico b/srchybrid/flag/res32/pf.ico similarity index 100% rename from flag/res32/pf.ico rename to srchybrid/flag/res32/pf.ico diff --git a/flag/res32/pg.ico b/srchybrid/flag/res32/pg.ico similarity index 100% rename from flag/res32/pg.ico rename to srchybrid/flag/res32/pg.ico diff --git a/flag/res32/ph.ico b/srchybrid/flag/res32/ph.ico similarity index 100% rename from flag/res32/ph.ico rename to srchybrid/flag/res32/ph.ico diff --git a/flag/res32/pk.ico b/srchybrid/flag/res32/pk.ico similarity index 100% rename from flag/res32/pk.ico rename to srchybrid/flag/res32/pk.ico diff --git a/flag/res32/pl.ico b/srchybrid/flag/res32/pl.ico similarity index 100% rename from flag/res32/pl.ico rename to srchybrid/flag/res32/pl.ico diff --git a/flag/res32/pm.ico b/srchybrid/flag/res32/pm.ico similarity index 100% rename from flag/res32/pm.ico rename to srchybrid/flag/res32/pm.ico diff --git a/flag/res32/pn.ico b/srchybrid/flag/res32/pn.ico similarity index 100% rename from flag/res32/pn.ico rename to srchybrid/flag/res32/pn.ico diff --git a/flag/res32/pr.ico b/srchybrid/flag/res32/pr.ico similarity index 100% rename from flag/res32/pr.ico rename to srchybrid/flag/res32/pr.ico diff --git a/flag/res32/ps.ico b/srchybrid/flag/res32/ps.ico similarity index 100% rename from flag/res32/ps.ico rename to srchybrid/flag/res32/ps.ico diff --git a/flag/res32/pt.ico b/srchybrid/flag/res32/pt.ico similarity index 100% rename from flag/res32/pt.ico rename to srchybrid/flag/res32/pt.ico diff --git a/flag/res32/pw.ico b/srchybrid/flag/res32/pw.ico similarity index 100% rename from flag/res32/pw.ico rename to srchybrid/flag/res32/pw.ico diff --git a/flag/res32/py.ico b/srchybrid/flag/res32/py.ico similarity index 100% rename from flag/res32/py.ico rename to srchybrid/flag/res32/py.ico diff --git a/flag/res32/qa.ico b/srchybrid/flag/res32/qa.ico similarity index 100% rename from flag/res32/qa.ico rename to srchybrid/flag/res32/qa.ico diff --git a/flag/res32/re.ico b/srchybrid/flag/res32/re.ico similarity index 100% rename from flag/res32/re.ico rename to srchybrid/flag/res32/re.ico diff --git a/flag/res32/ro.ico b/srchybrid/flag/res32/ro.ico similarity index 100% rename from flag/res32/ro.ico rename to srchybrid/flag/res32/ro.ico diff --git a/flag/res32/rs.ico b/srchybrid/flag/res32/rs.ico similarity index 100% rename from flag/res32/rs.ico rename to srchybrid/flag/res32/rs.ico diff --git a/flag/res32/ru.ico b/srchybrid/flag/res32/ru.ico similarity index 100% rename from flag/res32/ru.ico rename to srchybrid/flag/res32/ru.ico diff --git a/flag/res32/rw.ico b/srchybrid/flag/res32/rw.ico similarity index 100% rename from flag/res32/rw.ico rename to srchybrid/flag/res32/rw.ico diff --git a/flag/res32/sa.ico b/srchybrid/flag/res32/sa.ico similarity index 100% rename from flag/res32/sa.ico rename to srchybrid/flag/res32/sa.ico diff --git a/flag/res32/sb.ico b/srchybrid/flag/res32/sb.ico similarity index 100% rename from flag/res32/sb.ico rename to srchybrid/flag/res32/sb.ico diff --git a/flag/res32/sc.ico b/srchybrid/flag/res32/sc.ico similarity index 100% rename from flag/res32/sc.ico rename to srchybrid/flag/res32/sc.ico diff --git a/flag/res32/sco.ico b/srchybrid/flag/res32/sco.ico similarity index 100% rename from flag/res32/sco.ico rename to srchybrid/flag/res32/sco.ico diff --git a/flag/res32/sd.ico b/srchybrid/flag/res32/sd.ico similarity index 100% rename from flag/res32/sd.ico rename to srchybrid/flag/res32/sd.ico diff --git a/flag/res32/se.ico b/srchybrid/flag/res32/se.ico similarity index 100% rename from flag/res32/se.ico rename to srchybrid/flag/res32/se.ico diff --git a/flag/res32/sg.ico b/srchybrid/flag/res32/sg.ico similarity index 100% rename from flag/res32/sg.ico rename to srchybrid/flag/res32/sg.ico diff --git a/flag/res32/sh.ico b/srchybrid/flag/res32/sh.ico similarity index 100% rename from flag/res32/sh.ico rename to srchybrid/flag/res32/sh.ico diff --git a/flag/res32/si.ico b/srchybrid/flag/res32/si.ico similarity index 100% rename from flag/res32/si.ico rename to srchybrid/flag/res32/si.ico diff --git a/flag/res32/sk.ico b/srchybrid/flag/res32/sk.ico similarity index 100% rename from flag/res32/sk.ico rename to srchybrid/flag/res32/sk.ico diff --git a/flag/res32/sl.ico b/srchybrid/flag/res32/sl.ico similarity index 100% rename from flag/res32/sl.ico rename to srchybrid/flag/res32/sl.ico diff --git a/flag/res32/sm.ico b/srchybrid/flag/res32/sm.ico similarity index 100% rename from flag/res32/sm.ico rename to srchybrid/flag/res32/sm.ico diff --git a/flag/res32/sn.ico b/srchybrid/flag/res32/sn.ico similarity index 100% rename from flag/res32/sn.ico rename to srchybrid/flag/res32/sn.ico diff --git a/flag/res32/so.ico b/srchybrid/flag/res32/so.ico similarity index 100% rename from flag/res32/so.ico rename to srchybrid/flag/res32/so.ico diff --git a/flag/res32/sr.ico b/srchybrid/flag/res32/sr.ico similarity index 100% rename from flag/res32/sr.ico rename to srchybrid/flag/res32/sr.ico diff --git a/flag/res32/st.ico b/srchybrid/flag/res32/st.ico similarity index 100% rename from flag/res32/st.ico rename to srchybrid/flag/res32/st.ico diff --git a/flag/res32/su.ico b/srchybrid/flag/res32/su.ico similarity index 100% rename from flag/res32/su.ico rename to srchybrid/flag/res32/su.ico diff --git a/flag/res32/sv.ico b/srchybrid/flag/res32/sv.ico similarity index 100% rename from flag/res32/sv.ico rename to srchybrid/flag/res32/sv.ico diff --git a/flag/res32/sy.ico b/srchybrid/flag/res32/sy.ico similarity index 100% rename from flag/res32/sy.ico rename to srchybrid/flag/res32/sy.ico diff --git a/flag/res32/sz.ico b/srchybrid/flag/res32/sz.ico similarity index 100% rename from flag/res32/sz.ico rename to srchybrid/flag/res32/sz.ico diff --git a/flag/res32/tc.ico b/srchybrid/flag/res32/tc.ico similarity index 100% rename from flag/res32/tc.ico rename to srchybrid/flag/res32/tc.ico diff --git a/flag/res32/td.ico b/srchybrid/flag/res32/td.ico similarity index 100% rename from flag/res32/td.ico rename to srchybrid/flag/res32/td.ico diff --git a/flag/res32/tf.ico b/srchybrid/flag/res32/tf.ico similarity index 100% rename from flag/res32/tf.ico rename to srchybrid/flag/res32/tf.ico diff --git a/flag/res32/tg.ico b/srchybrid/flag/res32/tg.ico similarity index 100% rename from flag/res32/tg.ico rename to srchybrid/flag/res32/tg.ico diff --git a/flag/res32/th.ico b/srchybrid/flag/res32/th.ico similarity index 100% rename from flag/res32/th.ico rename to srchybrid/flag/res32/th.ico diff --git a/flag/res32/tj.ico b/srchybrid/flag/res32/tj.ico similarity index 100% rename from flag/res32/tj.ico rename to srchybrid/flag/res32/tj.ico diff --git a/flag/res32/tk.ico b/srchybrid/flag/res32/tk.ico similarity index 100% rename from flag/res32/tk.ico rename to srchybrid/flag/res32/tk.ico diff --git a/flag/res32/tl.ico b/srchybrid/flag/res32/tl.ico similarity index 100% rename from flag/res32/tl.ico rename to srchybrid/flag/res32/tl.ico diff --git a/flag/res32/tm.ico b/srchybrid/flag/res32/tm.ico similarity index 100% rename from flag/res32/tm.ico rename to srchybrid/flag/res32/tm.ico diff --git a/flag/res32/tn.ico b/srchybrid/flag/res32/tn.ico similarity index 100% rename from flag/res32/tn.ico rename to srchybrid/flag/res32/tn.ico diff --git a/flag/res32/to.ico b/srchybrid/flag/res32/to.ico similarity index 100% rename from flag/res32/to.ico rename to srchybrid/flag/res32/to.ico diff --git a/flag/res32/tp.ico b/srchybrid/flag/res32/tp.ico similarity index 100% rename from flag/res32/tp.ico rename to srchybrid/flag/res32/tp.ico diff --git a/flag/res32/tr.ico b/srchybrid/flag/res32/tr.ico similarity index 100% rename from flag/res32/tr.ico rename to srchybrid/flag/res32/tr.ico diff --git a/flag/res32/tt.ico b/srchybrid/flag/res32/tt.ico similarity index 100% rename from flag/res32/tt.ico rename to srchybrid/flag/res32/tt.ico diff --git a/flag/res32/tv.ico b/srchybrid/flag/res32/tv.ico similarity index 100% rename from flag/res32/tv.ico rename to srchybrid/flag/res32/tv.ico diff --git a/flag/res32/tw.ico b/srchybrid/flag/res32/tw.ico similarity index 100% rename from flag/res32/tw.ico rename to srchybrid/flag/res32/tw.ico diff --git a/flag/res32/tz.ico b/srchybrid/flag/res32/tz.ico similarity index 100% rename from flag/res32/tz.ico rename to srchybrid/flag/res32/tz.ico diff --git a/flag/res32/ua.ico b/srchybrid/flag/res32/ua.ico similarity index 100% rename from flag/res32/ua.ico rename to srchybrid/flag/res32/ua.ico diff --git a/flag/res32/ug.ico b/srchybrid/flag/res32/ug.ico similarity index 100% rename from flag/res32/ug.ico rename to srchybrid/flag/res32/ug.ico diff --git a/flag/res32/uk.ico b/srchybrid/flag/res32/uk.ico similarity index 100% rename from flag/res32/uk.ico rename to srchybrid/flag/res32/uk.ico diff --git a/flag/res32/um.ico b/srchybrid/flag/res32/um.ico similarity index 100% rename from flag/res32/um.ico rename to srchybrid/flag/res32/um.ico diff --git a/flag/res32/unset.ico b/srchybrid/flag/res32/unset.ico similarity index 100% rename from flag/res32/unset.ico rename to srchybrid/flag/res32/unset.ico diff --git a/flag/res32/us.ico b/srchybrid/flag/res32/us.ico similarity index 100% rename from flag/res32/us.ico rename to srchybrid/flag/res32/us.ico diff --git a/flag/res32/uy.ico b/srchybrid/flag/res32/uy.ico similarity index 100% rename from flag/res32/uy.ico rename to srchybrid/flag/res32/uy.ico diff --git a/flag/res32/uz.ico b/srchybrid/flag/res32/uz.ico similarity index 100% rename from flag/res32/uz.ico rename to srchybrid/flag/res32/uz.ico diff --git a/flag/res32/va.ico b/srchybrid/flag/res32/va.ico similarity index 100% rename from flag/res32/va.ico rename to srchybrid/flag/res32/va.ico diff --git a/flag/res32/vc.ico b/srchybrid/flag/res32/vc.ico similarity index 100% rename from flag/res32/vc.ico rename to srchybrid/flag/res32/vc.ico diff --git a/flag/res32/ve.ico b/srchybrid/flag/res32/ve.ico similarity index 100% rename from flag/res32/ve.ico rename to srchybrid/flag/res32/ve.ico diff --git a/flag/res32/vg.ico b/srchybrid/flag/res32/vg.ico similarity index 100% rename from flag/res32/vg.ico rename to srchybrid/flag/res32/vg.ico diff --git a/flag/res32/vi.ico b/srchybrid/flag/res32/vi.ico similarity index 100% rename from flag/res32/vi.ico rename to srchybrid/flag/res32/vi.ico diff --git a/flag/res32/vn.ico b/srchybrid/flag/res32/vn.ico similarity index 100% rename from flag/res32/vn.ico rename to srchybrid/flag/res32/vn.ico diff --git a/flag/res32/vu.ico b/srchybrid/flag/res32/vu.ico similarity index 100% rename from flag/res32/vu.ico rename to srchybrid/flag/res32/vu.ico diff --git a/flag/res32/wf.ico b/srchybrid/flag/res32/wf.ico similarity index 100% rename from flag/res32/wf.ico rename to srchybrid/flag/res32/wf.ico diff --git a/flag/res32/wls.ico b/srchybrid/flag/res32/wls.ico similarity index 100% rename from flag/res32/wls.ico rename to srchybrid/flag/res32/wls.ico diff --git a/flag/res32/ws.ico b/srchybrid/flag/res32/ws.ico similarity index 100% rename from flag/res32/ws.ico rename to srchybrid/flag/res32/ws.ico diff --git a/flag/res32/ye.ico b/srchybrid/flag/res32/ye.ico similarity index 100% rename from flag/res32/ye.ico rename to srchybrid/flag/res32/ye.ico diff --git a/flag/res32/yt.ico b/srchybrid/flag/res32/yt.ico similarity index 100% rename from flag/res32/yt.ico rename to srchybrid/flag/res32/yt.ico diff --git a/flag/res32/yu.ico b/srchybrid/flag/res32/yu.ico similarity index 100% rename from flag/res32/yu.ico rename to srchybrid/flag/res32/yu.ico diff --git a/flag/res32/za.ico b/srchybrid/flag/res32/za.ico similarity index 100% rename from flag/res32/za.ico rename to srchybrid/flag/res32/za.ico diff --git a/flag/res32/zm.ico b/srchybrid/flag/res32/zm.ico similarity index 100% rename from flag/res32/zm.ico rename to srchybrid/flag/res32/zm.ico diff --git a/flag/res32/zw.ico b/srchybrid/flag/res32/zw.ico similarity index 100% rename from flag/res32/zw.ico rename to srchybrid/flag/res32/zw.ico diff --git a/flag/resource.h b/srchybrid/flag/resource.h similarity index 100% rename from flag/resource.h rename to srchybrid/flag/resource.h diff --git a/ini2.cpp b/srchybrid/ini2.cpp similarity index 100% rename from ini2.cpp rename to srchybrid/ini2.cpp diff --git a/ini2.h b/srchybrid/ini2.h similarity index 100% rename from ini2.h rename to srchybrid/ini2.h diff --git a/kademlia/io/BufferedFileIO.cpp b/srchybrid/kademlia/io/BufferedFileIO.cpp similarity index 100% rename from kademlia/io/BufferedFileIO.cpp rename to srchybrid/kademlia/io/BufferedFileIO.cpp diff --git a/kademlia/io/BufferedFileIO.h b/srchybrid/kademlia/io/BufferedFileIO.h similarity index 100% rename from kademlia/io/BufferedFileIO.h rename to srchybrid/kademlia/io/BufferedFileIO.h diff --git a/kademlia/io/ByteIO.cpp b/srchybrid/kademlia/io/ByteIO.cpp similarity index 100% rename from kademlia/io/ByteIO.cpp rename to srchybrid/kademlia/io/ByteIO.cpp diff --git a/kademlia/io/ByteIO.h b/srchybrid/kademlia/io/ByteIO.h similarity index 100% rename from kademlia/io/ByteIO.h rename to srchybrid/kademlia/io/ByteIO.h diff --git a/kademlia/io/DataIO.cpp b/srchybrid/kademlia/io/DataIO.cpp similarity index 100% rename from kademlia/io/DataIO.cpp rename to srchybrid/kademlia/io/DataIO.cpp diff --git a/kademlia/io/DataIO.h b/srchybrid/kademlia/io/DataIO.h similarity index 100% rename from kademlia/io/DataIO.h rename to srchybrid/kademlia/io/DataIO.h diff --git a/kademlia/io/FileIO.cpp b/srchybrid/kademlia/io/FileIO.cpp similarity index 100% rename from kademlia/io/FileIO.cpp rename to srchybrid/kademlia/io/FileIO.cpp diff --git a/kademlia/io/FileIO.h b/srchybrid/kademlia/io/FileIO.h similarity index 100% rename from kademlia/io/FileIO.h rename to srchybrid/kademlia/io/FileIO.h diff --git a/kademlia/io/IOException.cpp b/srchybrid/kademlia/io/IOException.cpp similarity index 100% rename from kademlia/io/IOException.cpp rename to srchybrid/kademlia/io/IOException.cpp diff --git a/kademlia/io/IOException.h b/srchybrid/kademlia/io/IOException.h similarity index 100% rename from kademlia/io/IOException.h rename to srchybrid/kademlia/io/IOException.h diff --git a/kademlia/kademlia/Defines.h b/srchybrid/kademlia/kademlia/Defines.h similarity index 100% rename from kademlia/kademlia/Defines.h rename to srchybrid/kademlia/kademlia/Defines.h diff --git a/kademlia/kademlia/Entry.cpp b/srchybrid/kademlia/kademlia/Entry.cpp similarity index 100% rename from kademlia/kademlia/Entry.cpp rename to srchybrid/kademlia/kademlia/Entry.cpp diff --git a/kademlia/kademlia/Entry.h b/srchybrid/kademlia/kademlia/Entry.h similarity index 100% rename from kademlia/kademlia/Entry.h rename to srchybrid/kademlia/kademlia/Entry.h diff --git a/kademlia/kademlia/Error.h b/srchybrid/kademlia/kademlia/Error.h similarity index 100% rename from kademlia/kademlia/Error.h rename to srchybrid/kademlia/kademlia/Error.h diff --git a/kademlia/kademlia/Indexed.cpp b/srchybrid/kademlia/kademlia/Indexed.cpp similarity index 100% rename from kademlia/kademlia/Indexed.cpp rename to srchybrid/kademlia/kademlia/Indexed.cpp diff --git a/kademlia/kademlia/Indexed.h b/srchybrid/kademlia/kademlia/Indexed.h similarity index 100% rename from kademlia/kademlia/Indexed.h rename to srchybrid/kademlia/kademlia/Indexed.h diff --git a/kademlia/kademlia/Kademlia.cpp b/srchybrid/kademlia/kademlia/Kademlia.cpp similarity index 100% rename from kademlia/kademlia/Kademlia.cpp rename to srchybrid/kademlia/kademlia/Kademlia.cpp diff --git a/kademlia/kademlia/Kademlia.h b/srchybrid/kademlia/kademlia/Kademlia.h similarity index 100% rename from kademlia/kademlia/Kademlia.h rename to srchybrid/kademlia/kademlia/Kademlia.h diff --git a/kademlia/kademlia/Prefs.cpp b/srchybrid/kademlia/kademlia/Prefs.cpp similarity index 100% rename from kademlia/kademlia/Prefs.cpp rename to srchybrid/kademlia/kademlia/Prefs.cpp diff --git a/kademlia/kademlia/Prefs.h b/srchybrid/kademlia/kademlia/Prefs.h similarity index 100% rename from kademlia/kademlia/Prefs.h rename to srchybrid/kademlia/kademlia/Prefs.h diff --git a/kademlia/kademlia/Search.cpp b/srchybrid/kademlia/kademlia/Search.cpp similarity index 100% rename from kademlia/kademlia/Search.cpp rename to srchybrid/kademlia/kademlia/Search.cpp diff --git a/kademlia/kademlia/Search.h b/srchybrid/kademlia/kademlia/Search.h similarity index 100% rename from kademlia/kademlia/Search.h rename to srchybrid/kademlia/kademlia/Search.h diff --git a/kademlia/kademlia/SearchManager.cpp b/srchybrid/kademlia/kademlia/SearchManager.cpp similarity index 100% rename from kademlia/kademlia/SearchManager.cpp rename to srchybrid/kademlia/kademlia/SearchManager.cpp diff --git a/kademlia/kademlia/SearchManager.h b/srchybrid/kademlia/kademlia/SearchManager.h similarity index 100% rename from kademlia/kademlia/SearchManager.h rename to srchybrid/kademlia/kademlia/SearchManager.h diff --git a/kademlia/kademlia/Tag.h b/srchybrid/kademlia/kademlia/Tag.h similarity index 100% rename from kademlia/kademlia/Tag.h rename to srchybrid/kademlia/kademlia/Tag.h diff --git a/kademlia/kademlia/UDPFirewallTester.cpp b/srchybrid/kademlia/kademlia/UDPFirewallTester.cpp similarity index 100% rename from kademlia/kademlia/UDPFirewallTester.cpp rename to srchybrid/kademlia/kademlia/UDPFirewallTester.cpp diff --git a/kademlia/kademlia/UDPFirewallTester.h b/srchybrid/kademlia/kademlia/UDPFirewallTester.h similarity index 100% rename from kademlia/kademlia/UDPFirewallTester.h rename to srchybrid/kademlia/kademlia/UDPFirewallTester.h diff --git a/kademlia/net/KademliaUDPListener.cpp b/srchybrid/kademlia/net/KademliaUDPListener.cpp similarity index 100% rename from kademlia/net/KademliaUDPListener.cpp rename to srchybrid/kademlia/net/KademliaUDPListener.cpp diff --git a/kademlia/net/KademliaUDPListener.h b/srchybrid/kademlia/net/KademliaUDPListener.h similarity index 100% rename from kademlia/net/KademliaUDPListener.h rename to srchybrid/kademlia/net/KademliaUDPListener.h diff --git a/kademlia/net/PacketTracking.cpp b/srchybrid/kademlia/net/PacketTracking.cpp similarity index 100% rename from kademlia/net/PacketTracking.cpp rename to srchybrid/kademlia/net/PacketTracking.cpp diff --git a/kademlia/net/PacketTracking.h b/srchybrid/kademlia/net/PacketTracking.h similarity index 100% rename from kademlia/net/PacketTracking.h rename to srchybrid/kademlia/net/PacketTracking.h diff --git a/kademlia/routing/Contact.cpp b/srchybrid/kademlia/routing/Contact.cpp similarity index 100% rename from kademlia/routing/Contact.cpp rename to srchybrid/kademlia/routing/Contact.cpp diff --git a/kademlia/routing/Contact.h b/srchybrid/kademlia/routing/Contact.h similarity index 100% rename from kademlia/routing/Contact.h rename to srchybrid/kademlia/routing/Contact.h diff --git a/kademlia/routing/Maps.h b/srchybrid/kademlia/routing/Maps.h similarity index 100% rename from kademlia/routing/Maps.h rename to srchybrid/kademlia/routing/Maps.h diff --git a/kademlia/routing/RoutingBin.cpp b/srchybrid/kademlia/routing/RoutingBin.cpp similarity index 100% rename from kademlia/routing/RoutingBin.cpp rename to srchybrid/kademlia/routing/RoutingBin.cpp diff --git a/kademlia/routing/RoutingBin.h b/srchybrid/kademlia/routing/RoutingBin.h similarity index 100% rename from kademlia/routing/RoutingBin.h rename to srchybrid/kademlia/routing/RoutingBin.h diff --git a/kademlia/routing/RoutingZone.cpp b/srchybrid/kademlia/routing/RoutingZone.cpp similarity index 100% rename from kademlia/routing/RoutingZone.cpp rename to srchybrid/kademlia/routing/RoutingZone.cpp diff --git a/kademlia/routing/RoutingZone.h b/srchybrid/kademlia/routing/RoutingZone.h similarity index 100% rename from kademlia/routing/RoutingZone.h rename to srchybrid/kademlia/routing/RoutingZone.h diff --git a/kademlia/utils/KadClientSearcher.h b/srchybrid/kademlia/utils/KadClientSearcher.h similarity index 100% rename from kademlia/utils/KadClientSearcher.h rename to srchybrid/kademlia/utils/KadClientSearcher.h diff --git a/kademlia/utils/KadUDPKey.h b/srchybrid/kademlia/utils/KadUDPKey.h similarity index 100% rename from kademlia/utils/KadUDPKey.h rename to srchybrid/kademlia/utils/KadUDPKey.h diff --git a/kademlia/utils/LittleEndian.cpp b/srchybrid/kademlia/utils/LittleEndian.cpp similarity index 100% rename from kademlia/utils/LittleEndian.cpp rename to srchybrid/kademlia/utils/LittleEndian.cpp diff --git a/kademlia/utils/LittleEndian.h b/srchybrid/kademlia/utils/LittleEndian.h similarity index 100% rename from kademlia/utils/LittleEndian.h rename to srchybrid/kademlia/utils/LittleEndian.h diff --git a/kademlia/utils/LookupHistory.cpp b/srchybrid/kademlia/utils/LookupHistory.cpp similarity index 100% rename from kademlia/utils/LookupHistory.cpp rename to srchybrid/kademlia/utils/LookupHistory.cpp diff --git a/kademlia/utils/LookupHistory.h b/srchybrid/kademlia/utils/LookupHistory.h similarity index 100% rename from kademlia/utils/LookupHistory.h rename to srchybrid/kademlia/utils/LookupHistory.h diff --git a/kademlia/utils/MiscUtils.cpp b/srchybrid/kademlia/utils/MiscUtils.cpp similarity index 100% rename from kademlia/utils/MiscUtils.cpp rename to srchybrid/kademlia/utils/MiscUtils.cpp diff --git a/kademlia/utils/MiscUtils.h b/srchybrid/kademlia/utils/MiscUtils.h similarity index 100% rename from kademlia/utils/MiscUtils.h rename to srchybrid/kademlia/utils/MiscUtils.h diff --git a/kademlia/utils/ThreadName.cpp b/srchybrid/kademlia/utils/ThreadName.cpp similarity index 100% rename from kademlia/utils/ThreadName.cpp rename to srchybrid/kademlia/utils/ThreadName.cpp diff --git a/kademlia/utils/ThreadName.h b/srchybrid/kademlia/utils/ThreadName.h similarity index 100% rename from kademlia/utils/ThreadName.h rename to srchybrid/kademlia/utils/ThreadName.h diff --git a/kademlia/utils/UInt128.cpp b/srchybrid/kademlia/utils/UInt128.cpp similarity index 100% rename from kademlia/utils/UInt128.cpp rename to srchybrid/kademlia/utils/UInt128.cpp diff --git a/kademlia/utils/UInt128.h b/srchybrid/kademlia/utils/UInt128.h similarity index 100% rename from kademlia/utils/UInt128.h rename to srchybrid/kademlia/utils/UInt128.h diff --git a/lang/cz_CZ.h b/srchybrid/lang/cz_CZ.h similarity index 100% rename from lang/cz_CZ.h rename to srchybrid/lang/cz_CZ.h diff --git a/lang/cz_CZ.rc b/srchybrid/lang/cz_CZ.rc similarity index 100% rename from lang/cz_CZ.rc rename to srchybrid/lang/cz_CZ.rc diff --git a/lang/cz_CZ_vc71.vcproj b/srchybrid/lang/cz_CZ_vc71.vcproj similarity index 100% rename from lang/cz_CZ_vc71.vcproj rename to srchybrid/lang/cz_CZ_vc71.vcproj diff --git a/lang/cz_CZ_vc90.vcproj b/srchybrid/lang/cz_CZ_vc90.vcproj similarity index 100% rename from lang/cz_CZ_vc90.vcproj rename to srchybrid/lang/cz_CZ_vc90.vcproj diff --git a/lang/de_DE.h b/srchybrid/lang/de_DE.h similarity index 100% rename from lang/de_DE.h rename to srchybrid/lang/de_DE.h diff --git a/lang/de_DE.rc b/srchybrid/lang/de_DE.rc similarity index 100% rename from lang/de_DE.rc rename to srchybrid/lang/de_DE.rc diff --git a/lang/de_DE_vc71.vcproj b/srchybrid/lang/de_DE_vc71.vcproj similarity index 100% rename from lang/de_DE_vc71.vcproj rename to srchybrid/lang/de_DE_vc71.vcproj diff --git a/lang/de_DE_vc90.vcproj b/srchybrid/lang/de_DE_vc90.vcproj similarity index 100% rename from lang/de_DE_vc90.vcproj rename to srchybrid/lang/de_DE_vc90.vcproj diff --git a/lang/es_ES_T.h b/srchybrid/lang/es_ES_T.h similarity index 100% rename from lang/es_ES_T.h rename to srchybrid/lang/es_ES_T.h diff --git a/lang/es_ES_T.rc b/srchybrid/lang/es_ES_T.rc similarity index 100% rename from lang/es_ES_T.rc rename to srchybrid/lang/es_ES_T.rc diff --git a/lang/es_ES_T_vc71.vcproj b/srchybrid/lang/es_ES_T_vc71.vcproj similarity index 100% rename from lang/es_ES_T_vc71.vcproj rename to srchybrid/lang/es_ES_T_vc71.vcproj diff --git a/lang/es_ES_T_vc90.vcproj b/srchybrid/lang/es_ES_T_vc90.vcproj similarity index 100% rename from lang/es_ES_T_vc90.vcproj rename to srchybrid/lang/es_ES_T_vc90.vcproj diff --git a/lang/fr_FR.h b/srchybrid/lang/fr_FR.h similarity index 100% rename from lang/fr_FR.h rename to srchybrid/lang/fr_FR.h diff --git a/lang/fr_FR.rc b/srchybrid/lang/fr_FR.rc similarity index 100% rename from lang/fr_FR.rc rename to srchybrid/lang/fr_FR.rc diff --git a/lang/fr_FR_vc71.vcproj b/srchybrid/lang/fr_FR_vc71.vcproj similarity index 100% rename from lang/fr_FR_vc71.vcproj rename to srchybrid/lang/fr_FR_vc71.vcproj diff --git a/lang/fr_FR_vc90.vcproj b/srchybrid/lang/fr_FR_vc90.vcproj similarity index 100% rename from lang/fr_FR_vc90.vcproj rename to srchybrid/lang/fr_FR_vc90.vcproj diff --git a/lang/it_IT.h b/srchybrid/lang/it_IT.h similarity index 100% rename from lang/it_IT.h rename to srchybrid/lang/it_IT.h diff --git a/lang/it_IT.rc b/srchybrid/lang/it_IT.rc similarity index 100% rename from lang/it_IT.rc rename to srchybrid/lang/it_IT.rc diff --git a/lang/it_IT_vc71.vcproj b/srchybrid/lang/it_IT_vc71.vcproj similarity index 100% rename from lang/it_IT_vc71.vcproj rename to srchybrid/lang/it_IT_vc71.vcproj diff --git a/lang/it_IT_vc90.vcproj b/srchybrid/lang/it_IT_vc90.vcproj similarity index 100% rename from lang/it_IT_vc90.vcproj rename to srchybrid/lang/it_IT_vc90.vcproj diff --git a/lang/lang.rc2 b/srchybrid/lang/lang.rc2 similarity index 100% rename from lang/lang.rc2 rename to srchybrid/lang/lang.rc2 diff --git a/lang/lang_vc71.sln b/srchybrid/lang/lang_vc71.sln similarity index 100% rename from lang/lang_vc71.sln rename to srchybrid/lang/lang_vc71.sln diff --git a/lang/lang_vc90.sln b/srchybrid/lang/lang_vc90.sln similarity index 100% rename from lang/lang_vc90.sln rename to srchybrid/lang/lang_vc90.sln diff --git a/lang/tr_TR.h b/srchybrid/lang/tr_TR.h similarity index 100% rename from lang/tr_TR.h rename to srchybrid/lang/tr_TR.h diff --git a/lang/tr_TR.rc b/srchybrid/lang/tr_TR.rc similarity index 100% rename from lang/tr_TR.rc rename to srchybrid/lang/tr_TR.rc diff --git a/lang/tr_TR_vc71.vcproj b/srchybrid/lang/tr_TR_vc71.vcproj similarity index 100% rename from lang/tr_TR_vc71.vcproj rename to srchybrid/lang/tr_TR_vc71.vcproj diff --git a/lang/tr_TR_vc90.vcproj b/srchybrid/lang/tr_TR_vc90.vcproj similarity index 100% rename from lang/tr_TR_vc90.vcproj rename to srchybrid/lang/tr_TR_vc90.vcproj diff --git a/lang/zh_CN.h b/srchybrid/lang/zh_CN.h similarity index 100% rename from lang/zh_CN.h rename to srchybrid/lang/zh_CN.h diff --git a/lang/zh_CN.rc b/srchybrid/lang/zh_CN.rc similarity index 100% rename from lang/zh_CN.rc rename to srchybrid/lang/zh_CN.rc diff --git a/lang/zh_CN_vc71.vcproj b/srchybrid/lang/zh_CN_vc71.vcproj similarity index 100% rename from lang/zh_CN_vc71.vcproj rename to srchybrid/lang/zh_CN_vc71.vcproj diff --git a/lang/zh_CN_vc90.vcproj b/srchybrid/lang/zh_CN_vc90.vcproj similarity index 100% rename from lang/zh_CN_vc90.vcproj rename to srchybrid/lang/zh_CN_vc90.vcproj diff --git a/lang/zh_TW.h b/srchybrid/lang/zh_TW.h similarity index 100% rename from lang/zh_TW.h rename to srchybrid/lang/zh_TW.h diff --git a/lang/zh_TW.rc b/srchybrid/lang/zh_TW.rc similarity index 100% rename from lang/zh_TW.rc rename to srchybrid/lang/zh_TW.rc diff --git a/lang/zh_TW_vc71.vcproj b/srchybrid/lang/zh_TW_vc71.vcproj similarity index 100% rename from lang/zh_TW_vc71.vcproj rename to srchybrid/lang/zh_TW_vc71.vcproj diff --git a/lang/zh_TW_vc90.vcproj b/srchybrid/lang/zh_TW_vc90.vcproj similarity index 100% rename from lang/zh_TW_vc90.vcproj rename to srchybrid/lang/zh_TW_vc90.vcproj diff --git a/langids.h b/srchybrid/langids.h similarity index 100% rename from langids.h rename to srchybrid/langids.h diff --git a/mdump.cpp b/srchybrid/mdump.cpp similarity index 100% rename from mdump.cpp rename to srchybrid/mdump.cpp diff --git a/mdump.h b/srchybrid/mdump.h similarity index 100% rename from mdump.h rename to srchybrid/mdump.h diff --git a/opcodes.h b/srchybrid/opcodes.h similarity index 100% rename from opcodes.h rename to srchybrid/opcodes.h diff --git a/otherfunctions.cpp b/srchybrid/otherfunctions.cpp similarity index 100% rename from otherfunctions.cpp rename to srchybrid/otherfunctions.cpp diff --git a/otherfunctions.h b/srchybrid/otherfunctions.h similarity index 100% rename from otherfunctions.h rename to srchybrid/otherfunctions.h diff --git a/packets.cpp b/srchybrid/packets.cpp similarity index 100% rename from packets.cpp rename to srchybrid/packets.cpp diff --git a/packets.h b/srchybrid/packets.h similarity index 100% rename from packets.h rename to srchybrid/packets.h diff --git a/parser.cpp b/srchybrid/parser.cpp similarity index 100% rename from parser.cpp rename to srchybrid/parser.cpp diff --git a/parser.hpp b/srchybrid/parser.hpp similarity index 100% rename from parser.hpp rename to srchybrid/parser.hpp diff --git a/parser.y b/srchybrid/parser.y similarity index 100% rename from parser.y rename to srchybrid/parser.y diff --git a/pthreads/pthreads/ANNOUNCE b/srchybrid/pthreads/pthreads/ANNOUNCE similarity index 100% rename from pthreads/pthreads/ANNOUNCE rename to srchybrid/pthreads/pthreads/ANNOUNCE diff --git a/pthreads/pthreads/BUGS b/srchybrid/pthreads/pthreads/BUGS similarity index 100% rename from pthreads/pthreads/BUGS rename to srchybrid/pthreads/pthreads/BUGS diff --git a/pthreads/pthreads/Bmakefile b/srchybrid/pthreads/pthreads/Bmakefile similarity index 100% rename from pthreads/pthreads/Bmakefile rename to srchybrid/pthreads/pthreads/Bmakefile diff --git a/pthreads/pthreads/CONTRIBUTORS b/srchybrid/pthreads/pthreads/CONTRIBUTORS similarity index 100% rename from pthreads/pthreads/CONTRIBUTORS rename to srchybrid/pthreads/pthreads/CONTRIBUTORS diff --git a/pthreads/pthreads/COPYING b/srchybrid/pthreads/pthreads/COPYING similarity index 100% rename from pthreads/pthreads/COPYING rename to srchybrid/pthreads/pthreads/COPYING diff --git a/pthreads/pthreads/ChangeLog b/srchybrid/pthreads/pthreads/ChangeLog similarity index 100% rename from pthreads/pthreads/ChangeLog rename to srchybrid/pthreads/pthreads/ChangeLog diff --git a/pthreads/pthreads/FAQ b/srchybrid/pthreads/pthreads/FAQ similarity index 100% rename from pthreads/pthreads/FAQ rename to srchybrid/pthreads/pthreads/FAQ diff --git a/pthreads/pthreads/GNUmakefile b/srchybrid/pthreads/pthreads/GNUmakefile similarity index 100% rename from pthreads/pthreads/GNUmakefile rename to srchybrid/pthreads/pthreads/GNUmakefile diff --git a/pthreads/pthreads/MAINTAINERS b/srchybrid/pthreads/pthreads/MAINTAINERS similarity index 100% rename from pthreads/pthreads/MAINTAINERS rename to srchybrid/pthreads/pthreads/MAINTAINERS diff --git a/pthreads/pthreads/Makefile b/srchybrid/pthreads/pthreads/Makefile similarity index 100% rename from pthreads/pthreads/Makefile rename to srchybrid/pthreads/pthreads/Makefile diff --git a/pthreads/pthreads/NEWS b/srchybrid/pthreads/pthreads/NEWS similarity index 100% rename from pthreads/pthreads/NEWS rename to srchybrid/pthreads/pthreads/NEWS diff --git a/pthreads/pthreads/Nmakefile b/srchybrid/pthreads/pthreads/Nmakefile similarity index 100% rename from pthreads/pthreads/Nmakefile rename to srchybrid/pthreads/pthreads/Nmakefile diff --git a/pthreads/pthreads/Nmakefile.tests b/srchybrid/pthreads/pthreads/Nmakefile.tests similarity index 100% rename from pthreads/pthreads/Nmakefile.tests rename to srchybrid/pthreads/pthreads/Nmakefile.tests diff --git a/pthreads/pthreads/PROGRESS b/srchybrid/pthreads/pthreads/PROGRESS similarity index 100% rename from pthreads/pthreads/PROGRESS rename to srchybrid/pthreads/pthreads/PROGRESS diff --git a/pthreads/pthreads/README b/srchybrid/pthreads/pthreads/README similarity index 100% rename from pthreads/pthreads/README rename to srchybrid/pthreads/pthreads/README diff --git a/pthreads/pthreads/README.Borland b/srchybrid/pthreads/pthreads/README.Borland similarity index 100% rename from pthreads/pthreads/README.Borland rename to srchybrid/pthreads/pthreads/README.Borland diff --git a/pthreads/pthreads/README.CV b/srchybrid/pthreads/pthreads/README.CV similarity index 100% rename from pthreads/pthreads/README.CV rename to srchybrid/pthreads/pthreads/README.CV diff --git a/pthreads/pthreads/README.NONPORTABLE b/srchybrid/pthreads/pthreads/README.NONPORTABLE similarity index 100% rename from pthreads/pthreads/README.NONPORTABLE rename to srchybrid/pthreads/pthreads/README.NONPORTABLE diff --git a/pthreads/pthreads/README.Watcom b/srchybrid/pthreads/pthreads/README.Watcom similarity index 100% rename from pthreads/pthreads/README.Watcom rename to srchybrid/pthreads/pthreads/README.Watcom diff --git a/pthreads/pthreads/README.WinCE b/srchybrid/pthreads/pthreads/README.WinCE similarity index 100% rename from pthreads/pthreads/README.WinCE rename to srchybrid/pthreads/pthreads/README.WinCE diff --git a/pthreads/pthreads/TODO b/srchybrid/pthreads/pthreads/TODO similarity index 100% rename from pthreads/pthreads/TODO rename to srchybrid/pthreads/pthreads/TODO diff --git a/pthreads/pthreads/WinCE-PORT b/srchybrid/pthreads/pthreads/WinCE-PORT similarity index 100% rename from pthreads/pthreads/WinCE-PORT rename to srchybrid/pthreads/pthreads/WinCE-PORT diff --git a/pthreads/pthreads/attr.c b/srchybrid/pthreads/pthreads/attr.c similarity index 100% rename from pthreads/pthreads/attr.c rename to srchybrid/pthreads/pthreads/attr.c diff --git a/pthreads/pthreads/barrier.c b/srchybrid/pthreads/pthreads/barrier.c similarity index 100% rename from pthreads/pthreads/barrier.c rename to srchybrid/pthreads/pthreads/barrier.c diff --git a/pthreads/pthreads/builddmc.bat b/srchybrid/pthreads/pthreads/builddmc.bat similarity index 100% rename from pthreads/pthreads/builddmc.bat rename to srchybrid/pthreads/pthreads/builddmc.bat diff --git a/pthreads/pthreads/cancel.c b/srchybrid/pthreads/pthreads/cancel.c similarity index 100% rename from pthreads/pthreads/cancel.c rename to srchybrid/pthreads/pthreads/cancel.c diff --git a/pthreads/pthreads/cleanup.c b/srchybrid/pthreads/pthreads/cleanup.c similarity index 100% rename from pthreads/pthreads/cleanup.c rename to srchybrid/pthreads/pthreads/cleanup.c diff --git a/pthreads/pthreads/condvar.c b/srchybrid/pthreads/pthreads/condvar.c similarity index 100% rename from pthreads/pthreads/condvar.c rename to srchybrid/pthreads/pthreads/condvar.c diff --git a/pthreads/pthreads/config.h b/srchybrid/pthreads/pthreads/config.h similarity index 100% rename from pthreads/pthreads/config.h rename to srchybrid/pthreads/pthreads/config.h diff --git a/pthreads/pthreads/create.c b/srchybrid/pthreads/pthreads/create.c similarity index 100% rename from pthreads/pthreads/create.c rename to srchybrid/pthreads/pthreads/create.c diff --git a/pthreads/pthreads/dll.c b/srchybrid/pthreads/pthreads/dll.c similarity index 100% rename from pthreads/pthreads/dll.c rename to srchybrid/pthreads/pthreads/dll.c diff --git a/pthreads/pthreads/errno.c b/srchybrid/pthreads/pthreads/errno.c similarity index 100% rename from pthreads/pthreads/errno.c rename to srchybrid/pthreads/pthreads/errno.c diff --git a/pthreads/pthreads/exit.c b/srchybrid/pthreads/pthreads/exit.c similarity index 100% rename from pthreads/pthreads/exit.c rename to srchybrid/pthreads/pthreads/exit.c diff --git a/pthreads/pthreads/fork.c b/srchybrid/pthreads/pthreads/fork.c similarity index 100% rename from pthreads/pthreads/fork.c rename to srchybrid/pthreads/pthreads/fork.c diff --git a/pthreads/pthreads/global.c b/srchybrid/pthreads/pthreads/global.c similarity index 100% rename from pthreads/pthreads/global.c rename to srchybrid/pthreads/pthreads/global.c diff --git a/pthreads/pthreads/implement.h b/srchybrid/pthreads/pthreads/implement.h similarity index 100% rename from pthreads/pthreads/implement.h rename to srchybrid/pthreads/pthreads/implement.h diff --git a/pthreads/pthreads/inc/pthread.h b/srchybrid/pthreads/pthreads/inc/pthread.h similarity index 100% rename from pthreads/pthreads/inc/pthread.h rename to srchybrid/pthreads/pthreads/inc/pthread.h diff --git a/pthreads/pthreads/inc/sched.h b/srchybrid/pthreads/pthreads/inc/sched.h similarity index 100% rename from pthreads/pthreads/inc/sched.h rename to srchybrid/pthreads/pthreads/inc/sched.h diff --git a/pthreads/pthreads/inc/semaphore.h b/srchybrid/pthreads/pthreads/inc/semaphore.h similarity index 100% rename from pthreads/pthreads/inc/semaphore.h rename to srchybrid/pthreads/pthreads/inc/semaphore.h diff --git a/pthreads/pthreads/misc.c b/srchybrid/pthreads/pthreads/misc.c similarity index 100% rename from pthreads/pthreads/misc.c rename to srchybrid/pthreads/pthreads/misc.c diff --git a/pthreads/pthreads/mutex.c b/srchybrid/pthreads/pthreads/mutex.c similarity index 100% rename from pthreads/pthreads/mutex.c rename to srchybrid/pthreads/pthreads/mutex.c diff --git a/pthreads/pthreads/need_errno.h b/srchybrid/pthreads/pthreads/need_errno.h similarity index 100% rename from pthreads/pthreads/need_errno.h rename to srchybrid/pthreads/pthreads/need_errno.h diff --git a/pthreads/pthreads/nonportable.c b/srchybrid/pthreads/pthreads/nonportable.c similarity index 100% rename from pthreads/pthreads/nonportable.c rename to srchybrid/pthreads/pthreads/nonportable.c diff --git a/pthreads/pthreads/private.c b/srchybrid/pthreads/pthreads/private.c similarity index 100% rename from pthreads/pthreads/private.c rename to srchybrid/pthreads/pthreads/private.c diff --git a/pthreads/pthreads/pthread.c b/srchybrid/pthreads/pthreads/pthread.c similarity index 100% rename from pthreads/pthreads/pthread.c rename to srchybrid/pthreads/pthreads/pthread.c diff --git a/pthreads/pthreads/pthread.dsp b/srchybrid/pthreads/pthreads/pthread.dsp similarity index 100% rename from pthreads/pthreads/pthread.dsp rename to srchybrid/pthreads/pthreads/pthread.dsp diff --git a/pthreads/pthreads/pthread.dsw b/srchybrid/pthreads/pthreads/pthread.dsw similarity index 100% rename from pthreads/pthreads/pthread.dsw rename to srchybrid/pthreads/pthreads/pthread.dsw diff --git a/pthreads/pthreads/pthread.h b/srchybrid/pthreads/pthreads/pthread.h similarity index 100% rename from pthreads/pthreads/pthread.h rename to srchybrid/pthreads/pthreads/pthread.h diff --git a/pthreads/pthreads/pthread.s b/srchybrid/pthreads/pthreads/pthread.s similarity index 100% rename from pthreads/pthreads/pthread.s rename to srchybrid/pthreads/pthreads/pthread.s diff --git a/pthreads/pthreads/pthread.sln b/srchybrid/pthreads/pthreads/pthread.sln similarity index 100% rename from pthreads/pthreads/pthread.sln rename to srchybrid/pthreads/pthreads/pthread.sln diff --git a/pthreads/pthreads/pthread.vcproj b/srchybrid/pthreads/pthreads/pthread.vcproj similarity index 100% rename from pthreads/pthreads/pthread.vcproj rename to srchybrid/pthreads/pthreads/pthread.vcproj diff --git a/pthreads/pthreads/pthread100.vcxproj b/srchybrid/pthreads/pthreads/pthread100.vcxproj similarity index 100% rename from pthreads/pthreads/pthread100.vcxproj rename to srchybrid/pthreads/pthreads/pthread100.vcxproj diff --git a/pthreads/pthreads/pthread100.vcxproj.filters b/srchybrid/pthreads/pthreads/pthread100.vcxproj.filters similarity index 100% rename from pthreads/pthreads/pthread100.vcxproj.filters rename to srchybrid/pthreads/pthreads/pthread100.vcxproj.filters diff --git a/pthreads/pthreads/pthread80.vcproj b/srchybrid/pthreads/pthreads/pthread80.vcproj similarity index 100% rename from pthreads/pthreads/pthread80.vcproj rename to srchybrid/pthreads/pthreads/pthread80.vcproj diff --git a/pthreads/pthreads/pthread90.vcproj b/srchybrid/pthreads/pthreads/pthread90.vcproj similarity index 100% rename from pthreads/pthreads/pthread90.vcproj rename to srchybrid/pthreads/pthreads/pthread90.vcproj diff --git a/pthreads/pthreads/pthread_attr_destroy.c b/srchybrid/pthreads/pthreads/pthread_attr_destroy.c similarity index 100% rename from pthreads/pthreads/pthread_attr_destroy.c rename to srchybrid/pthreads/pthreads/pthread_attr_destroy.c diff --git a/pthreads/pthreads/pthread_attr_getdetachstate.c b/srchybrid/pthreads/pthreads/pthread_attr_getdetachstate.c similarity index 100% rename from pthreads/pthreads/pthread_attr_getdetachstate.c rename to srchybrid/pthreads/pthreads/pthread_attr_getdetachstate.c diff --git a/pthreads/pthreads/pthread_attr_getinheritsched.c b/srchybrid/pthreads/pthreads/pthread_attr_getinheritsched.c similarity index 100% rename from pthreads/pthreads/pthread_attr_getinheritsched.c rename to srchybrid/pthreads/pthreads/pthread_attr_getinheritsched.c diff --git a/pthreads/pthreads/pthread_attr_getschedparam.c b/srchybrid/pthreads/pthreads/pthread_attr_getschedparam.c similarity index 100% rename from pthreads/pthreads/pthread_attr_getschedparam.c rename to srchybrid/pthreads/pthreads/pthread_attr_getschedparam.c diff --git a/pthreads/pthreads/pthread_attr_getschedpolicy.c b/srchybrid/pthreads/pthreads/pthread_attr_getschedpolicy.c similarity index 100% rename from pthreads/pthreads/pthread_attr_getschedpolicy.c rename to srchybrid/pthreads/pthreads/pthread_attr_getschedpolicy.c diff --git a/pthreads/pthreads/pthread_attr_getscope.c b/srchybrid/pthreads/pthreads/pthread_attr_getscope.c similarity index 100% rename from pthreads/pthreads/pthread_attr_getscope.c rename to srchybrid/pthreads/pthreads/pthread_attr_getscope.c diff --git a/pthreads/pthreads/pthread_attr_getstackaddr.c b/srchybrid/pthreads/pthreads/pthread_attr_getstackaddr.c similarity index 100% rename from pthreads/pthreads/pthread_attr_getstackaddr.c rename to srchybrid/pthreads/pthreads/pthread_attr_getstackaddr.c diff --git a/pthreads/pthreads/pthread_attr_getstacksize.c b/srchybrid/pthreads/pthreads/pthread_attr_getstacksize.c similarity index 100% rename from pthreads/pthreads/pthread_attr_getstacksize.c rename to srchybrid/pthreads/pthreads/pthread_attr_getstacksize.c diff --git a/pthreads/pthreads/pthread_attr_init.c b/srchybrid/pthreads/pthreads/pthread_attr_init.c similarity index 100% rename from pthreads/pthreads/pthread_attr_init.c rename to srchybrid/pthreads/pthreads/pthread_attr_init.c diff --git a/pthreads/pthreads/pthread_attr_setdetachstate.c b/srchybrid/pthreads/pthreads/pthread_attr_setdetachstate.c similarity index 100% rename from pthreads/pthreads/pthread_attr_setdetachstate.c rename to srchybrid/pthreads/pthreads/pthread_attr_setdetachstate.c diff --git a/pthreads/pthreads/pthread_attr_setinheritsched.c b/srchybrid/pthreads/pthreads/pthread_attr_setinheritsched.c similarity index 100% rename from pthreads/pthreads/pthread_attr_setinheritsched.c rename to srchybrid/pthreads/pthreads/pthread_attr_setinheritsched.c diff --git a/pthreads/pthreads/pthread_attr_setschedparam.c b/srchybrid/pthreads/pthreads/pthread_attr_setschedparam.c similarity index 100% rename from pthreads/pthreads/pthread_attr_setschedparam.c rename to srchybrid/pthreads/pthreads/pthread_attr_setschedparam.c diff --git a/pthreads/pthreads/pthread_attr_setschedpolicy.c b/srchybrid/pthreads/pthreads/pthread_attr_setschedpolicy.c similarity index 100% rename from pthreads/pthreads/pthread_attr_setschedpolicy.c rename to srchybrid/pthreads/pthreads/pthread_attr_setschedpolicy.c diff --git a/pthreads/pthreads/pthread_attr_setscope.c b/srchybrid/pthreads/pthreads/pthread_attr_setscope.c similarity index 100% rename from pthreads/pthreads/pthread_attr_setscope.c rename to srchybrid/pthreads/pthreads/pthread_attr_setscope.c diff --git a/pthreads/pthreads/pthread_attr_setstackaddr.c b/srchybrid/pthreads/pthreads/pthread_attr_setstackaddr.c similarity index 100% rename from pthreads/pthreads/pthread_attr_setstackaddr.c rename to srchybrid/pthreads/pthreads/pthread_attr_setstackaddr.c diff --git a/pthreads/pthreads/pthread_attr_setstacksize.c b/srchybrid/pthreads/pthreads/pthread_attr_setstacksize.c similarity index 100% rename from pthreads/pthreads/pthread_attr_setstacksize.c rename to srchybrid/pthreads/pthreads/pthread_attr_setstacksize.c diff --git a/pthreads/pthreads/pthread_barrier_destroy.c b/srchybrid/pthreads/pthreads/pthread_barrier_destroy.c similarity index 100% rename from pthreads/pthreads/pthread_barrier_destroy.c rename to srchybrid/pthreads/pthreads/pthread_barrier_destroy.c diff --git a/pthreads/pthreads/pthread_barrier_init.c b/srchybrid/pthreads/pthreads/pthread_barrier_init.c similarity index 100% rename from pthreads/pthreads/pthread_barrier_init.c rename to srchybrid/pthreads/pthreads/pthread_barrier_init.c diff --git a/pthreads/pthreads/pthread_barrier_wait.c b/srchybrid/pthreads/pthreads/pthread_barrier_wait.c similarity index 100% rename from pthreads/pthreads/pthread_barrier_wait.c rename to srchybrid/pthreads/pthreads/pthread_barrier_wait.c diff --git a/pthreads/pthreads/pthread_barrierattr_destroy.c b/srchybrid/pthreads/pthreads/pthread_barrierattr_destroy.c similarity index 100% rename from pthreads/pthreads/pthread_barrierattr_destroy.c rename to srchybrid/pthreads/pthreads/pthread_barrierattr_destroy.c diff --git a/pthreads/pthreads/pthread_barrierattr_getpshared.c b/srchybrid/pthreads/pthreads/pthread_barrierattr_getpshared.c similarity index 100% rename from pthreads/pthreads/pthread_barrierattr_getpshared.c rename to srchybrid/pthreads/pthreads/pthread_barrierattr_getpshared.c diff --git a/pthreads/pthreads/pthread_barrierattr_init.c b/srchybrid/pthreads/pthreads/pthread_barrierattr_init.c similarity index 100% rename from pthreads/pthreads/pthread_barrierattr_init.c rename to srchybrid/pthreads/pthreads/pthread_barrierattr_init.c diff --git a/pthreads/pthreads/pthread_barrierattr_setpshared.c b/srchybrid/pthreads/pthreads/pthread_barrierattr_setpshared.c similarity index 100% rename from pthreads/pthreads/pthread_barrierattr_setpshared.c rename to srchybrid/pthreads/pthreads/pthread_barrierattr_setpshared.c diff --git a/pthreads/pthreads/pthread_cancel.c b/srchybrid/pthreads/pthreads/pthread_cancel.c similarity index 100% rename from pthreads/pthreads/pthread_cancel.c rename to srchybrid/pthreads/pthreads/pthread_cancel.c diff --git a/pthreads/pthreads/pthread_cond_destroy.c b/srchybrid/pthreads/pthreads/pthread_cond_destroy.c similarity index 100% rename from pthreads/pthreads/pthread_cond_destroy.c rename to srchybrid/pthreads/pthreads/pthread_cond_destroy.c diff --git a/pthreads/pthreads/pthread_cond_init.c b/srchybrid/pthreads/pthreads/pthread_cond_init.c similarity index 100% rename from pthreads/pthreads/pthread_cond_init.c rename to srchybrid/pthreads/pthreads/pthread_cond_init.c diff --git a/pthreads/pthreads/pthread_cond_signal.c b/srchybrid/pthreads/pthreads/pthread_cond_signal.c similarity index 100% rename from pthreads/pthreads/pthread_cond_signal.c rename to srchybrid/pthreads/pthreads/pthread_cond_signal.c diff --git a/pthreads/pthreads/pthread_cond_wait.c b/srchybrid/pthreads/pthreads/pthread_cond_wait.c similarity index 100% rename from pthreads/pthreads/pthread_cond_wait.c rename to srchybrid/pthreads/pthreads/pthread_cond_wait.c diff --git a/pthreads/pthreads/pthread_condattr_destroy.c b/srchybrid/pthreads/pthreads/pthread_condattr_destroy.c similarity index 100% rename from pthreads/pthreads/pthread_condattr_destroy.c rename to srchybrid/pthreads/pthreads/pthread_condattr_destroy.c diff --git a/pthreads/pthreads/pthread_condattr_getpshared.c b/srchybrid/pthreads/pthreads/pthread_condattr_getpshared.c similarity index 100% rename from pthreads/pthreads/pthread_condattr_getpshared.c rename to srchybrid/pthreads/pthreads/pthread_condattr_getpshared.c diff --git a/pthreads/pthreads/pthread_condattr_init.c b/srchybrid/pthreads/pthreads/pthread_condattr_init.c similarity index 100% rename from pthreads/pthreads/pthread_condattr_init.c rename to srchybrid/pthreads/pthreads/pthread_condattr_init.c diff --git a/pthreads/pthreads/pthread_condattr_setpshared.c b/srchybrid/pthreads/pthreads/pthread_condattr_setpshared.c similarity index 100% rename from pthreads/pthreads/pthread_condattr_setpshared.c rename to srchybrid/pthreads/pthreads/pthread_condattr_setpshared.c diff --git a/pthreads/pthreads/pthread_delay_np.c b/srchybrid/pthreads/pthreads/pthread_delay_np.c similarity index 100% rename from pthreads/pthreads/pthread_delay_np.c rename to srchybrid/pthreads/pthreads/pthread_delay_np.c diff --git a/pthreads/pthreads/pthread_detach.c b/srchybrid/pthreads/pthreads/pthread_detach.c similarity index 100% rename from pthreads/pthreads/pthread_detach.c rename to srchybrid/pthreads/pthreads/pthread_detach.c diff --git a/pthreads/pthreads/pthread_equal.c b/srchybrid/pthreads/pthreads/pthread_equal.c similarity index 100% rename from pthreads/pthreads/pthread_equal.c rename to srchybrid/pthreads/pthreads/pthread_equal.c diff --git a/pthreads/pthreads/pthread_exit.c b/srchybrid/pthreads/pthreads/pthread_exit.c similarity index 100% rename from pthreads/pthreads/pthread_exit.c rename to srchybrid/pthreads/pthreads/pthread_exit.c diff --git a/pthreads/pthreads/pthread_getconcurrency.c b/srchybrid/pthreads/pthreads/pthread_getconcurrency.c similarity index 100% rename from pthreads/pthreads/pthread_getconcurrency.c rename to srchybrid/pthreads/pthreads/pthread_getconcurrency.c diff --git a/pthreads/pthreads/pthread_getschedparam.c b/srchybrid/pthreads/pthreads/pthread_getschedparam.c similarity index 100% rename from pthreads/pthreads/pthread_getschedparam.c rename to srchybrid/pthreads/pthreads/pthread_getschedparam.c diff --git a/pthreads/pthreads/pthread_getspecific.c b/srchybrid/pthreads/pthreads/pthread_getspecific.c similarity index 100% rename from pthreads/pthreads/pthread_getspecific.c rename to srchybrid/pthreads/pthreads/pthread_getspecific.c diff --git a/pthreads/pthreads/pthread_getw32threadhandle_np.c b/srchybrid/pthreads/pthreads/pthread_getw32threadhandle_np.c similarity index 100% rename from pthreads/pthreads/pthread_getw32threadhandle_np.c rename to srchybrid/pthreads/pthreads/pthread_getw32threadhandle_np.c diff --git a/pthreads/pthreads/pthread_join.c b/srchybrid/pthreads/pthreads/pthread_join.c similarity index 100% rename from pthreads/pthreads/pthread_join.c rename to srchybrid/pthreads/pthreads/pthread_join.c diff --git a/pthreads/pthreads/pthread_key_create.c b/srchybrid/pthreads/pthreads/pthread_key_create.c similarity index 100% rename from pthreads/pthreads/pthread_key_create.c rename to srchybrid/pthreads/pthreads/pthread_key_create.c diff --git a/pthreads/pthreads/pthread_key_delete.c b/srchybrid/pthreads/pthreads/pthread_key_delete.c similarity index 100% rename from pthreads/pthreads/pthread_key_delete.c rename to srchybrid/pthreads/pthreads/pthread_key_delete.c diff --git a/pthreads/pthreads/pthread_kill.c b/srchybrid/pthreads/pthreads/pthread_kill.c similarity index 100% rename from pthreads/pthreads/pthread_kill.c rename to srchybrid/pthreads/pthreads/pthread_kill.c diff --git a/pthreads/pthreads/pthread_mutex_destroy.c b/srchybrid/pthreads/pthreads/pthread_mutex_destroy.c similarity index 100% rename from pthreads/pthreads/pthread_mutex_destroy.c rename to srchybrid/pthreads/pthreads/pthread_mutex_destroy.c diff --git a/pthreads/pthreads/pthread_mutex_init.c b/srchybrid/pthreads/pthreads/pthread_mutex_init.c similarity index 100% rename from pthreads/pthreads/pthread_mutex_init.c rename to srchybrid/pthreads/pthreads/pthread_mutex_init.c diff --git a/pthreads/pthreads/pthread_mutex_lock.c b/srchybrid/pthreads/pthreads/pthread_mutex_lock.c similarity index 100% rename from pthreads/pthreads/pthread_mutex_lock.c rename to srchybrid/pthreads/pthreads/pthread_mutex_lock.c diff --git a/pthreads/pthreads/pthread_mutex_timedlock.c b/srchybrid/pthreads/pthreads/pthread_mutex_timedlock.c similarity index 100% rename from pthreads/pthreads/pthread_mutex_timedlock.c rename to srchybrid/pthreads/pthreads/pthread_mutex_timedlock.c diff --git a/pthreads/pthreads/pthread_mutex_trylock.c b/srchybrid/pthreads/pthreads/pthread_mutex_trylock.c similarity index 100% rename from pthreads/pthreads/pthread_mutex_trylock.c rename to srchybrid/pthreads/pthreads/pthread_mutex_trylock.c diff --git a/pthreads/pthreads/pthread_mutex_unlock.c b/srchybrid/pthreads/pthreads/pthread_mutex_unlock.c similarity index 100% rename from pthreads/pthreads/pthread_mutex_unlock.c rename to srchybrid/pthreads/pthreads/pthread_mutex_unlock.c diff --git a/pthreads/pthreads/pthread_mutexattr_destroy.c b/srchybrid/pthreads/pthreads/pthread_mutexattr_destroy.c similarity index 100% rename from pthreads/pthreads/pthread_mutexattr_destroy.c rename to srchybrid/pthreads/pthreads/pthread_mutexattr_destroy.c diff --git a/pthreads/pthreads/pthread_mutexattr_getkind_np.c b/srchybrid/pthreads/pthreads/pthread_mutexattr_getkind_np.c similarity index 100% rename from pthreads/pthreads/pthread_mutexattr_getkind_np.c rename to srchybrid/pthreads/pthreads/pthread_mutexattr_getkind_np.c diff --git a/pthreads/pthreads/pthread_mutexattr_getpshared.c b/srchybrid/pthreads/pthreads/pthread_mutexattr_getpshared.c similarity index 100% rename from pthreads/pthreads/pthread_mutexattr_getpshared.c rename to srchybrid/pthreads/pthreads/pthread_mutexattr_getpshared.c diff --git a/pthreads/pthreads/pthread_mutexattr_gettype.c b/srchybrid/pthreads/pthreads/pthread_mutexattr_gettype.c similarity index 100% rename from pthreads/pthreads/pthread_mutexattr_gettype.c rename to srchybrid/pthreads/pthreads/pthread_mutexattr_gettype.c diff --git a/pthreads/pthreads/pthread_mutexattr_init.c b/srchybrid/pthreads/pthreads/pthread_mutexattr_init.c similarity index 100% rename from pthreads/pthreads/pthread_mutexattr_init.c rename to srchybrid/pthreads/pthreads/pthread_mutexattr_init.c diff --git a/pthreads/pthreads/pthread_mutexattr_setkind_np.c b/srchybrid/pthreads/pthreads/pthread_mutexattr_setkind_np.c similarity index 100% rename from pthreads/pthreads/pthread_mutexattr_setkind_np.c rename to srchybrid/pthreads/pthreads/pthread_mutexattr_setkind_np.c diff --git a/pthreads/pthreads/pthread_mutexattr_setpshared.c b/srchybrid/pthreads/pthreads/pthread_mutexattr_setpshared.c similarity index 100% rename from pthreads/pthreads/pthread_mutexattr_setpshared.c rename to srchybrid/pthreads/pthreads/pthread_mutexattr_setpshared.c diff --git a/pthreads/pthreads/pthread_mutexattr_settype.c b/srchybrid/pthreads/pthreads/pthread_mutexattr_settype.c similarity index 100% rename from pthreads/pthreads/pthread_mutexattr_settype.c rename to srchybrid/pthreads/pthreads/pthread_mutexattr_settype.c diff --git a/pthreads/pthreads/pthread_num_processors_np.c b/srchybrid/pthreads/pthreads/pthread_num_processors_np.c similarity index 100% rename from pthreads/pthreads/pthread_num_processors_np.c rename to srchybrid/pthreads/pthreads/pthread_num_processors_np.c diff --git a/pthreads/pthreads/pthread_once.c b/srchybrid/pthreads/pthreads/pthread_once.c similarity index 100% rename from pthreads/pthreads/pthread_once.c rename to srchybrid/pthreads/pthreads/pthread_once.c diff --git a/pthreads/pthreads/pthread_once.x b/srchybrid/pthreads/pthreads/pthread_once.x similarity index 100% rename from pthreads/pthreads/pthread_once.x rename to srchybrid/pthreads/pthreads/pthread_once.x diff --git a/pthreads/pthreads/pthread_rwlock_destroy.c b/srchybrid/pthreads/pthreads/pthread_rwlock_destroy.c similarity index 100% rename from pthreads/pthreads/pthread_rwlock_destroy.c rename to srchybrid/pthreads/pthreads/pthread_rwlock_destroy.c diff --git a/pthreads/pthreads/pthread_rwlock_init.c b/srchybrid/pthreads/pthreads/pthread_rwlock_init.c similarity index 100% rename from pthreads/pthreads/pthread_rwlock_init.c rename to srchybrid/pthreads/pthreads/pthread_rwlock_init.c diff --git a/pthreads/pthreads/pthread_rwlock_rdlock.c b/srchybrid/pthreads/pthreads/pthread_rwlock_rdlock.c similarity index 100% rename from pthreads/pthreads/pthread_rwlock_rdlock.c rename to srchybrid/pthreads/pthreads/pthread_rwlock_rdlock.c diff --git a/pthreads/pthreads/pthread_rwlock_timedrdlock.c b/srchybrid/pthreads/pthreads/pthread_rwlock_timedrdlock.c similarity index 100% rename from pthreads/pthreads/pthread_rwlock_timedrdlock.c rename to srchybrid/pthreads/pthreads/pthread_rwlock_timedrdlock.c diff --git a/pthreads/pthreads/pthread_rwlock_timedwrlock.c b/srchybrid/pthreads/pthreads/pthread_rwlock_timedwrlock.c similarity index 100% rename from pthreads/pthreads/pthread_rwlock_timedwrlock.c rename to srchybrid/pthreads/pthreads/pthread_rwlock_timedwrlock.c diff --git a/pthreads/pthreads/pthread_rwlock_tryrdlock.c b/srchybrid/pthreads/pthreads/pthread_rwlock_tryrdlock.c similarity index 100% rename from pthreads/pthreads/pthread_rwlock_tryrdlock.c rename to srchybrid/pthreads/pthreads/pthread_rwlock_tryrdlock.c diff --git a/pthreads/pthreads/pthread_rwlock_trywrlock.c b/srchybrid/pthreads/pthreads/pthread_rwlock_trywrlock.c similarity index 100% rename from pthreads/pthreads/pthread_rwlock_trywrlock.c rename to srchybrid/pthreads/pthreads/pthread_rwlock_trywrlock.c diff --git a/pthreads/pthreads/pthread_rwlock_unlock.c b/srchybrid/pthreads/pthreads/pthread_rwlock_unlock.c similarity index 100% rename from pthreads/pthreads/pthread_rwlock_unlock.c rename to srchybrid/pthreads/pthreads/pthread_rwlock_unlock.c diff --git a/pthreads/pthreads/pthread_rwlock_wrlock.c b/srchybrid/pthreads/pthreads/pthread_rwlock_wrlock.c similarity index 100% rename from pthreads/pthreads/pthread_rwlock_wrlock.c rename to srchybrid/pthreads/pthreads/pthread_rwlock_wrlock.c diff --git a/pthreads/pthreads/pthread_rwlockattr_destroy.c b/srchybrid/pthreads/pthreads/pthread_rwlockattr_destroy.c similarity index 100% rename from pthreads/pthreads/pthread_rwlockattr_destroy.c rename to srchybrid/pthreads/pthreads/pthread_rwlockattr_destroy.c diff --git a/pthreads/pthreads/pthread_rwlockattr_getpshared.c b/srchybrid/pthreads/pthreads/pthread_rwlockattr_getpshared.c similarity index 100% rename from pthreads/pthreads/pthread_rwlockattr_getpshared.c rename to srchybrid/pthreads/pthreads/pthread_rwlockattr_getpshared.c diff --git a/pthreads/pthreads/pthread_rwlockattr_init.c b/srchybrid/pthreads/pthreads/pthread_rwlockattr_init.c similarity index 100% rename from pthreads/pthreads/pthread_rwlockattr_init.c rename to srchybrid/pthreads/pthreads/pthread_rwlockattr_init.c diff --git a/pthreads/pthreads/pthread_rwlockattr_setpshared.c b/srchybrid/pthreads/pthreads/pthread_rwlockattr_setpshared.c similarity index 100% rename from pthreads/pthreads/pthread_rwlockattr_setpshared.c rename to srchybrid/pthreads/pthreads/pthread_rwlockattr_setpshared.c diff --git a/pthreads/pthreads/pthread_self.c b/srchybrid/pthreads/pthreads/pthread_self.c similarity index 100% rename from pthreads/pthreads/pthread_self.c rename to srchybrid/pthreads/pthreads/pthread_self.c diff --git a/pthreads/pthreads/pthread_setcancelstate.c b/srchybrid/pthreads/pthreads/pthread_setcancelstate.c similarity index 100% rename from pthreads/pthreads/pthread_setcancelstate.c rename to srchybrid/pthreads/pthreads/pthread_setcancelstate.c diff --git a/pthreads/pthreads/pthread_setcanceltype.c b/srchybrid/pthreads/pthreads/pthread_setcanceltype.c similarity index 100% rename from pthreads/pthreads/pthread_setcanceltype.c rename to srchybrid/pthreads/pthreads/pthread_setcanceltype.c diff --git a/pthreads/pthreads/pthread_setconcurrency.c b/srchybrid/pthreads/pthreads/pthread_setconcurrency.c similarity index 100% rename from pthreads/pthreads/pthread_setconcurrency.c rename to srchybrid/pthreads/pthreads/pthread_setconcurrency.c diff --git a/pthreads/pthreads/pthread_setschedparam.c b/srchybrid/pthreads/pthreads/pthread_setschedparam.c similarity index 100% rename from pthreads/pthreads/pthread_setschedparam.c rename to srchybrid/pthreads/pthreads/pthread_setschedparam.c diff --git a/pthreads/pthreads/pthread_setspecific.c b/srchybrid/pthreads/pthreads/pthread_setspecific.c similarity index 100% rename from pthreads/pthreads/pthread_setspecific.c rename to srchybrid/pthreads/pthreads/pthread_setspecific.c diff --git a/pthreads/pthreads/pthread_spin_destroy.c b/srchybrid/pthreads/pthreads/pthread_spin_destroy.c similarity index 100% rename from pthreads/pthreads/pthread_spin_destroy.c rename to srchybrid/pthreads/pthreads/pthread_spin_destroy.c diff --git a/pthreads/pthreads/pthread_spin_init.c b/srchybrid/pthreads/pthreads/pthread_spin_init.c similarity index 100% rename from pthreads/pthreads/pthread_spin_init.c rename to srchybrid/pthreads/pthreads/pthread_spin_init.c diff --git a/pthreads/pthreads/pthread_spin_lock.c b/srchybrid/pthreads/pthreads/pthread_spin_lock.c similarity index 100% rename from pthreads/pthreads/pthread_spin_lock.c rename to srchybrid/pthreads/pthreads/pthread_spin_lock.c diff --git a/pthreads/pthreads/pthread_spin_trylock.c b/srchybrid/pthreads/pthreads/pthread_spin_trylock.c similarity index 100% rename from pthreads/pthreads/pthread_spin_trylock.c rename to srchybrid/pthreads/pthreads/pthread_spin_trylock.c diff --git a/pthreads/pthreads/pthread_spin_unlock.c b/srchybrid/pthreads/pthreads/pthread_spin_unlock.c similarity index 100% rename from pthreads/pthreads/pthread_spin_unlock.c rename to srchybrid/pthreads/pthreads/pthread_spin_unlock.c diff --git a/pthreads/pthreads/pthread_testcancel.c b/srchybrid/pthreads/pthreads/pthread_testcancel.c similarity index 100% rename from pthreads/pthreads/pthread_testcancel.c rename to srchybrid/pthreads/pthreads/pthread_testcancel.c diff --git a/pthreads/pthreads/pthread_timechange_handler_np.c b/srchybrid/pthreads/pthreads/pthread_timechange_handler_np.c similarity index 100% rename from pthreads/pthreads/pthread_timechange_handler_np.c rename to srchybrid/pthreads/pthreads/pthread_timechange_handler_np.c diff --git a/pthreads/pthreads/pthread_win32_attach_detach_np.c b/srchybrid/pthreads/pthreads/pthread_win32_attach_detach_np.c similarity index 100% rename from pthreads/pthreads/pthread_win32_attach_detach_np.c rename to srchybrid/pthreads/pthreads/pthread_win32_attach_detach_np.c diff --git a/pthreads/pthreads/ptw32_InterlockedCompareExchange.c b/srchybrid/pthreads/pthreads/ptw32_InterlockedCompareExchange.c similarity index 100% rename from pthreads/pthreads/ptw32_InterlockedCompareExchange.c rename to srchybrid/pthreads/pthreads/ptw32_InterlockedCompareExchange.c diff --git a/pthreads/pthreads/ptw32_MCS_lock.c b/srchybrid/pthreads/pthreads/ptw32_MCS_lock.c similarity index 100% rename from pthreads/pthreads/ptw32_MCS_lock.c rename to srchybrid/pthreads/pthreads/ptw32_MCS_lock.c diff --git a/pthreads/pthreads/ptw32_callUserDestroyRoutines.c b/srchybrid/pthreads/pthreads/ptw32_callUserDestroyRoutines.c similarity index 100% rename from pthreads/pthreads/ptw32_callUserDestroyRoutines.c rename to srchybrid/pthreads/pthreads/ptw32_callUserDestroyRoutines.c diff --git a/pthreads/pthreads/ptw32_calloc.c b/srchybrid/pthreads/pthreads/ptw32_calloc.c similarity index 100% rename from pthreads/pthreads/ptw32_calloc.c rename to srchybrid/pthreads/pthreads/ptw32_calloc.c diff --git a/pthreads/pthreads/ptw32_cond_check_need_init.c b/srchybrid/pthreads/pthreads/ptw32_cond_check_need_init.c similarity index 100% rename from pthreads/pthreads/ptw32_cond_check_need_init.c rename to srchybrid/pthreads/pthreads/ptw32_cond_check_need_init.c diff --git a/pthreads/pthreads/ptw32_getprocessors.c b/srchybrid/pthreads/pthreads/ptw32_getprocessors.c similarity index 100% rename from pthreads/pthreads/ptw32_getprocessors.c rename to srchybrid/pthreads/pthreads/ptw32_getprocessors.c diff --git a/pthreads/pthreads/ptw32_is_attr.c b/srchybrid/pthreads/pthreads/ptw32_is_attr.c similarity index 100% rename from pthreads/pthreads/ptw32_is_attr.c rename to srchybrid/pthreads/pthreads/ptw32_is_attr.c diff --git a/pthreads/pthreads/ptw32_mutex_check_need_init.c b/srchybrid/pthreads/pthreads/ptw32_mutex_check_need_init.c similarity index 100% rename from pthreads/pthreads/ptw32_mutex_check_need_init.c rename to srchybrid/pthreads/pthreads/ptw32_mutex_check_need_init.c diff --git a/pthreads/pthreads/ptw32_new.c b/srchybrid/pthreads/pthreads/ptw32_new.c similarity index 100% rename from pthreads/pthreads/ptw32_new.c rename to srchybrid/pthreads/pthreads/ptw32_new.c diff --git a/pthreads/pthreads/ptw32_processInitialize.c b/srchybrid/pthreads/pthreads/ptw32_processInitialize.c similarity index 100% rename from pthreads/pthreads/ptw32_processInitialize.c rename to srchybrid/pthreads/pthreads/ptw32_processInitialize.c diff --git a/pthreads/pthreads/ptw32_processTerminate.c b/srchybrid/pthreads/pthreads/ptw32_processTerminate.c similarity index 100% rename from pthreads/pthreads/ptw32_processTerminate.c rename to srchybrid/pthreads/pthreads/ptw32_processTerminate.c diff --git a/pthreads/pthreads/ptw32_relmillisecs.c b/srchybrid/pthreads/pthreads/ptw32_relmillisecs.c similarity index 100% rename from pthreads/pthreads/ptw32_relmillisecs.c rename to srchybrid/pthreads/pthreads/ptw32_relmillisecs.c diff --git a/pthreads/pthreads/ptw32_reuse.c b/srchybrid/pthreads/pthreads/ptw32_reuse.c similarity index 100% rename from pthreads/pthreads/ptw32_reuse.c rename to srchybrid/pthreads/pthreads/ptw32_reuse.c diff --git a/pthreads/pthreads/ptw32_rwlock_cancelwrwait.c b/srchybrid/pthreads/pthreads/ptw32_rwlock_cancelwrwait.c similarity index 100% rename from pthreads/pthreads/ptw32_rwlock_cancelwrwait.c rename to srchybrid/pthreads/pthreads/ptw32_rwlock_cancelwrwait.c diff --git a/pthreads/pthreads/ptw32_rwlock_check_need_init.c b/srchybrid/pthreads/pthreads/ptw32_rwlock_check_need_init.c similarity index 100% rename from pthreads/pthreads/ptw32_rwlock_check_need_init.c rename to srchybrid/pthreads/pthreads/ptw32_rwlock_check_need_init.c diff --git a/pthreads/pthreads/ptw32_semwait.c b/srchybrid/pthreads/pthreads/ptw32_semwait.c similarity index 100% rename from pthreads/pthreads/ptw32_semwait.c rename to srchybrid/pthreads/pthreads/ptw32_semwait.c diff --git a/pthreads/pthreads/ptw32_spinlock_check_need_init.c b/srchybrid/pthreads/pthreads/ptw32_spinlock_check_need_init.c similarity index 100% rename from pthreads/pthreads/ptw32_spinlock_check_need_init.c rename to srchybrid/pthreads/pthreads/ptw32_spinlock_check_need_init.c diff --git a/pthreads/pthreads/ptw32_threadDestroy.c b/srchybrid/pthreads/pthreads/ptw32_threadDestroy.c similarity index 100% rename from pthreads/pthreads/ptw32_threadDestroy.c rename to srchybrid/pthreads/pthreads/ptw32_threadDestroy.c diff --git a/pthreads/pthreads/ptw32_threadStart.c b/srchybrid/pthreads/pthreads/ptw32_threadStart.c similarity index 100% rename from pthreads/pthreads/ptw32_threadStart.c rename to srchybrid/pthreads/pthreads/ptw32_threadStart.c diff --git a/pthreads/pthreads/ptw32_throw.c b/srchybrid/pthreads/pthreads/ptw32_throw.c similarity index 100% rename from pthreads/pthreads/ptw32_throw.c rename to srchybrid/pthreads/pthreads/ptw32_throw.c diff --git a/pthreads/pthreads/ptw32_timespec.c b/srchybrid/pthreads/pthreads/ptw32_timespec.c similarity index 100% rename from pthreads/pthreads/ptw32_timespec.c rename to srchybrid/pthreads/pthreads/ptw32_timespec.c diff --git a/pthreads/pthreads/ptw32_tkAssocCreate.c b/srchybrid/pthreads/pthreads/ptw32_tkAssocCreate.c similarity index 100% rename from pthreads/pthreads/ptw32_tkAssocCreate.c rename to srchybrid/pthreads/pthreads/ptw32_tkAssocCreate.c diff --git a/pthreads/pthreads/ptw32_tkAssocDestroy.c b/srchybrid/pthreads/pthreads/ptw32_tkAssocDestroy.c similarity index 100% rename from pthreads/pthreads/ptw32_tkAssocDestroy.c rename to srchybrid/pthreads/pthreads/ptw32_tkAssocDestroy.c diff --git a/pthreads/pthreads/rwlock.c b/srchybrid/pthreads/pthreads/rwlock.c similarity index 100% rename from pthreads/pthreads/rwlock.c rename to srchybrid/pthreads/pthreads/rwlock.c diff --git a/pthreads/pthreads/sched.c b/srchybrid/pthreads/pthreads/sched.c similarity index 100% rename from pthreads/pthreads/sched.c rename to srchybrid/pthreads/pthreads/sched.c diff --git a/pthreads/pthreads/sched.h b/srchybrid/pthreads/pthreads/sched.h similarity index 100% rename from pthreads/pthreads/sched.h rename to srchybrid/pthreads/pthreads/sched.h diff --git a/pthreads/pthreads/sched_get_priority_max.c b/srchybrid/pthreads/pthreads/sched_get_priority_max.c similarity index 100% rename from pthreads/pthreads/sched_get_priority_max.c rename to srchybrid/pthreads/pthreads/sched_get_priority_max.c diff --git a/pthreads/pthreads/sched_get_priority_min.c b/srchybrid/pthreads/pthreads/sched_get_priority_min.c similarity index 100% rename from pthreads/pthreads/sched_get_priority_min.c rename to srchybrid/pthreads/pthreads/sched_get_priority_min.c diff --git a/pthreads/pthreads/sched_getscheduler.c b/srchybrid/pthreads/pthreads/sched_getscheduler.c similarity index 100% rename from pthreads/pthreads/sched_getscheduler.c rename to srchybrid/pthreads/pthreads/sched_getscheduler.c diff --git a/pthreads/pthreads/sched_setscheduler.c b/srchybrid/pthreads/pthreads/sched_setscheduler.c similarity index 100% rename from pthreads/pthreads/sched_setscheduler.c rename to srchybrid/pthreads/pthreads/sched_setscheduler.c diff --git a/pthreads/pthreads/sched_yield.c b/srchybrid/pthreads/pthreads/sched_yield.c similarity index 100% rename from pthreads/pthreads/sched_yield.c rename to srchybrid/pthreads/pthreads/sched_yield.c diff --git a/pthreads/pthreads/sem_close.c b/srchybrid/pthreads/pthreads/sem_close.c similarity index 100% rename from pthreads/pthreads/sem_close.c rename to srchybrid/pthreads/pthreads/sem_close.c diff --git a/pthreads/pthreads/sem_destroy.c b/srchybrid/pthreads/pthreads/sem_destroy.c similarity index 100% rename from pthreads/pthreads/sem_destroy.c rename to srchybrid/pthreads/pthreads/sem_destroy.c diff --git a/pthreads/pthreads/sem_getvalue.c b/srchybrid/pthreads/pthreads/sem_getvalue.c similarity index 100% rename from pthreads/pthreads/sem_getvalue.c rename to srchybrid/pthreads/pthreads/sem_getvalue.c diff --git a/pthreads/pthreads/sem_init.c b/srchybrid/pthreads/pthreads/sem_init.c similarity index 100% rename from pthreads/pthreads/sem_init.c rename to srchybrid/pthreads/pthreads/sem_init.c diff --git a/pthreads/pthreads/sem_open.c b/srchybrid/pthreads/pthreads/sem_open.c similarity index 100% rename from pthreads/pthreads/sem_open.c rename to srchybrid/pthreads/pthreads/sem_open.c diff --git a/pthreads/pthreads/sem_post.c b/srchybrid/pthreads/pthreads/sem_post.c similarity index 100% rename from pthreads/pthreads/sem_post.c rename to srchybrid/pthreads/pthreads/sem_post.c diff --git a/pthreads/pthreads/sem_post_multiple.c b/srchybrid/pthreads/pthreads/sem_post_multiple.c similarity index 100% rename from pthreads/pthreads/sem_post_multiple.c rename to srchybrid/pthreads/pthreads/sem_post_multiple.c diff --git a/pthreads/pthreads/sem_timedwait.c b/srchybrid/pthreads/pthreads/sem_timedwait.c similarity index 100% rename from pthreads/pthreads/sem_timedwait.c rename to srchybrid/pthreads/pthreads/sem_timedwait.c diff --git a/pthreads/pthreads/sem_trywait.c b/srchybrid/pthreads/pthreads/sem_trywait.c similarity index 100% rename from pthreads/pthreads/sem_trywait.c rename to srchybrid/pthreads/pthreads/sem_trywait.c diff --git a/pthreads/pthreads/sem_unlink.c b/srchybrid/pthreads/pthreads/sem_unlink.c similarity index 100% rename from pthreads/pthreads/sem_unlink.c rename to srchybrid/pthreads/pthreads/sem_unlink.c diff --git a/pthreads/pthreads/sem_wait.c b/srchybrid/pthreads/pthreads/sem_wait.c similarity index 100% rename from pthreads/pthreads/sem_wait.c rename to srchybrid/pthreads/pthreads/sem_wait.c diff --git a/pthreads/pthreads/semaphore.c b/srchybrid/pthreads/pthreads/semaphore.c similarity index 100% rename from pthreads/pthreads/semaphore.c rename to srchybrid/pthreads/pthreads/semaphore.c diff --git a/pthreads/pthreads/semaphore.h b/srchybrid/pthreads/pthreads/semaphore.h similarity index 100% rename from pthreads/pthreads/semaphore.h rename to srchybrid/pthreads/pthreads/semaphore.h diff --git a/pthreads/pthreads/signal.c b/srchybrid/pthreads/pthreads/signal.c similarity index 100% rename from pthreads/pthreads/signal.c rename to srchybrid/pthreads/pthreads/signal.c diff --git a/pthreads/pthreads/spin.c b/srchybrid/pthreads/pthreads/spin.c similarity index 100% rename from pthreads/pthreads/spin.c rename to srchybrid/pthreads/pthreads/spin.c diff --git a/pthreads/pthreads/sync.c b/srchybrid/pthreads/pthreads/sync.c similarity index 100% rename from pthreads/pthreads/sync.c rename to srchybrid/pthreads/pthreads/sync.c diff --git a/pthreads/pthreads/tsd.c b/srchybrid/pthreads/pthreads/tsd.c similarity index 100% rename from pthreads/pthreads/tsd.c rename to srchybrid/pthreads/pthreads/tsd.c diff --git a/pthreads/pthreads/version.rc b/srchybrid/pthreads/pthreads/version.rc similarity index 100% rename from pthreads/pthreads/version.rc rename to srchybrid/pthreads/pthreads/version.rc diff --git a/pthreads/pthreads/w32_CancelableWait.c b/srchybrid/pthreads/pthreads/w32_CancelableWait.c similarity index 100% rename from pthreads/pthreads/w32_CancelableWait.c rename to srchybrid/pthreads/pthreads/w32_CancelableWait.c diff --git a/rapidjson b/srchybrid/rapidjson similarity index 100% rename from rapidjson rename to srchybrid/rapidjson diff --git a/res/ArchivePreview.ico b/srchybrid/res/ArchivePreview.ico similarity index 100% rename from res/ArchivePreview.ico rename to srchybrid/res/ArchivePreview.ico diff --git a/res/Backup.ico b/srchybrid/res/Backup.ico similarity index 100% rename from res/Backup.ico rename to srchybrid/res/Backup.ico diff --git a/res/Browse8.ico b/srchybrid/res/Browse8.ico similarity index 100% rename from res/Browse8.ico rename to srchybrid/res/Browse8.ico diff --git a/res/Cancel.ico b/srchybrid/res/Cancel.ico similarity index 100% rename from res/Cancel.ico rename to srchybrid/res/Cancel.ico diff --git a/res/Category.ico b/srchybrid/res/Category.ico similarity index 100% rename from res/Category.ico rename to srchybrid/res/Category.ico diff --git a/res/Chat.ico b/srchybrid/res/Chat.ico similarity index 100% rename from res/Chat.ico rename to srchybrid/res/Chat.ico diff --git a/res/Client-Neo.ico b/srchybrid/res/Client-Neo.ico similarity index 100% rename from res/Client-Neo.ico rename to srchybrid/res/Client-Neo.ico diff --git a/res/Client0.ico b/srchybrid/res/Client0.ico similarity index 100% rename from res/Client0.ico rename to srchybrid/res/Client0.ico diff --git a/res/Client1.ico b/srchybrid/res/Client1.ico similarity index 100% rename from res/Client1.ico rename to srchybrid/res/Client1.ico diff --git a/res/Client2.ico b/srchybrid/res/Client2.ico similarity index 100% rename from res/Client2.ico rename to srchybrid/res/Client2.ico diff --git a/res/Client3.ico b/srchybrid/res/Client3.ico similarity index 100% rename from res/Client3.ico rename to srchybrid/res/Client3.ico diff --git a/res/Client4.ico b/srchybrid/res/Client4.ico similarity index 100% rename from res/Client4.ico rename to srchybrid/res/Client4.ico diff --git a/res/ClientCompatible.ico b/srchybrid/res/ClientCompatible.ico similarity index 100% rename from res/ClientCompatible.ico rename to srchybrid/res/ClientCompatible.ico diff --git a/res/ClientCompatiblePlus.ico b/srchybrid/res/ClientCompatiblePlus.ico similarity index 100% rename from res/ClientCompatiblePlus.ico rename to srchybrid/res/ClientCompatiblePlus.ico diff --git a/res/ClientDefault.ico b/srchybrid/res/ClientDefault.ico similarity index 100% rename from res/ClientDefault.ico rename to srchybrid/res/ClientDefault.ico diff --git a/res/ClientDefaultPlus.ico b/srchybrid/res/ClientDefaultPlus.ico similarity index 100% rename from res/ClientDefaultPlus.ico rename to srchybrid/res/ClientDefaultPlus.ico diff --git a/res/ClientFriend.ico b/srchybrid/res/ClientFriend.ico similarity index 100% rename from res/ClientFriend.ico rename to srchybrid/res/ClientFriend.ico diff --git a/res/ClientFriendPlus.ico b/srchybrid/res/ClientFriendPlus.ico similarity index 100% rename from res/ClientFriendPlus.ico rename to srchybrid/res/ClientFriendPlus.ico diff --git a/res/ClientMLDonkey.ico b/srchybrid/res/ClientMLDonkey.ico similarity index 100% rename from res/ClientMLDonkey.ico rename to srchybrid/res/ClientMLDonkey.ico diff --git a/res/ClientMLDonkeyPlus.ico b/srchybrid/res/ClientMLDonkeyPlus.ico similarity index 100% rename from res/ClientMLDonkeyPlus.ico rename to srchybrid/res/ClientMLDonkeyPlus.ico diff --git a/res/ClientSecureHashOvl.ico b/srchybrid/res/ClientSecureHashOvl.ico similarity index 100% rename from res/ClientSecureHashOvl.ico rename to srchybrid/res/ClientSecureHashOvl.ico diff --git a/res/ClientShareaza.ico b/srchybrid/res/ClientShareaza.ico similarity index 100% rename from res/ClientShareaza.ico rename to srchybrid/res/ClientShareaza.ico diff --git a/res/ClientShareazaPlus.ico b/srchybrid/res/ClientShareazaPlus.ico similarity index 100% rename from res/ClientShareazaPlus.ico rename to srchybrid/res/ClientShareazaPlus.ico diff --git a/res/ClientaMule.ico b/srchybrid/res/ClientaMule.ico similarity index 100% rename from res/ClientaMule.ico rename to srchybrid/res/ClientaMule.ico diff --git a/res/ClientaMulePlus.ico b/srchybrid/res/ClientaMulePlus.ico similarity index 100% rename from res/ClientaMulePlus.ico rename to srchybrid/res/ClientaMulePlus.ico diff --git a/res/ClienteDonkey.ico b/srchybrid/res/ClienteDonkey.ico similarity index 100% rename from res/ClienteDonkey.ico rename to srchybrid/res/ClienteDonkey.ico diff --git a/res/ClienteDonkeyHybrid.ico b/srchybrid/res/ClienteDonkeyHybrid.ico similarity index 100% rename from res/ClienteDonkeyHybrid.ico rename to srchybrid/res/ClienteDonkeyHybrid.ico diff --git a/res/ClienteDonkeyHybridPlus.ico b/srchybrid/res/ClienteDonkeyHybridPlus.ico similarity index 100% rename from res/ClienteDonkeyHybridPlus.ico rename to srchybrid/res/ClienteDonkeyHybridPlus.ico diff --git a/res/ClienteDonkeyPlus.ico b/srchybrid/res/ClienteDonkeyPlus.ico similarity index 100% rename from res/ClienteDonkeyPlus.ico rename to srchybrid/res/ClienteDonkeyPlus.ico diff --git a/res/ClientlPhant.ico b/srchybrid/res/ClientlPhant.ico similarity index 100% rename from res/ClientlPhant.ico rename to srchybrid/res/ClientlPhant.ico diff --git a/res/ClientlPhantPlus.ico b/srchybrid/res/ClientlPhantPlus.ico similarity index 100% rename from res/ClientlPhantPlus.ico rename to srchybrid/res/ClientlPhantPlus.ico diff --git a/res/Clientobfuovl.ICO b/srchybrid/res/Clientobfuovl.ICO similarity index 100% rename from res/Clientobfuovl.ICO rename to srchybrid/res/Clientobfuovl.ICO diff --git a/res/ClientsKnown.ico b/srchybrid/res/ClientsKnown.ico similarity index 100% rename from res/ClientsKnown.ico rename to srchybrid/res/ClientsKnown.ico diff --git a/res/ClientsOnQueue.ico b/srchybrid/res/ClientsOnQueue.ico similarity index 100% rename from res/ClientsOnQueue.ico rename to srchybrid/res/ClientsOnQueue.ico diff --git a/res/Clientsecurehasobfuhovl.ICO b/srchybrid/res/Clientsecurehasobfuhovl.ICO similarity index 100% rename from res/Clientsecurehasobfuhovl.ICO rename to srchybrid/res/Clientsecurehasobfuhovl.ICO diff --git a/res/CloseTab.ico b/srchybrid/res/CloseTab.ico similarity index 100% rename from res/CloseTab.ico rename to srchybrid/res/CloseTab.ico diff --git a/res/CloseTabSelected.ico b/srchybrid/res/CloseTabSelected.ico similarity index 100% rename from res/CloseTabSelected.ico rename to srchybrid/res/CloseTabSelected.ico diff --git a/res/Collapse.ico b/srchybrid/res/Collapse.ico similarity index 100% rename from res/Collapse.ico rename to srchybrid/res/Collapse.ico diff --git a/res/ConnectDo.ico b/srchybrid/res/ConnectDo.ico similarity index 100% rename from res/ConnectDo.ico rename to srchybrid/res/ConnectDo.ico diff --git a/res/ConnectDrop.ico b/srchybrid/res/ConnectDrop.ico similarity index 100% rename from res/ConnectDrop.ico rename to srchybrid/res/ConnectDrop.ico diff --git a/res/ConnectStop.ico b/srchybrid/res/ConnectStop.ico similarity index 100% rename from res/ConnectStop.ico rename to srchybrid/res/ConnectStop.ico diff --git a/res/Connected.gif b/srchybrid/res/Connected.gif similarity index 100% rename from res/Connected.gif rename to srchybrid/res/Connected.gif diff --git a/res/ConnectedHighHigh.gif b/srchybrid/res/ConnectedHighHigh.gif similarity index 100% rename from res/ConnectedHighHigh.gif rename to srchybrid/res/ConnectedHighHigh.gif diff --git a/res/ConnectedHighHigh.ico b/srchybrid/res/ConnectedHighHigh.ico similarity index 100% rename from res/ConnectedHighHigh.ico rename to srchybrid/res/ConnectedHighHigh.ico diff --git a/res/ConnectedHighLow.gif b/srchybrid/res/ConnectedHighLow.gif similarity index 100% rename from res/ConnectedHighLow.gif rename to srchybrid/res/ConnectedHighLow.gif diff --git a/res/ConnectedHighLow.ico b/srchybrid/res/ConnectedHighLow.ico similarity index 100% rename from res/ConnectedHighLow.ico rename to srchybrid/res/ConnectedHighLow.ico diff --git a/res/ConnectedHighNot.gif b/srchybrid/res/ConnectedHighNot.gif similarity index 100% rename from res/ConnectedHighNot.gif rename to srchybrid/res/ConnectedHighNot.gif diff --git a/res/ConnectedHighNot.ico b/srchybrid/res/ConnectedHighNot.ico similarity index 100% rename from res/ConnectedHighNot.ico rename to srchybrid/res/ConnectedHighNot.ico diff --git a/res/ConnectedLowHigh.gif b/srchybrid/res/ConnectedLowHigh.gif similarity index 100% rename from res/ConnectedLowHigh.gif rename to srchybrid/res/ConnectedLowHigh.gif diff --git a/res/ConnectedLowHigh.ico b/srchybrid/res/ConnectedLowHigh.ico similarity index 100% rename from res/ConnectedLowHigh.ico rename to srchybrid/res/ConnectedLowHigh.ico diff --git a/res/ConnectedLowLow.gif b/srchybrid/res/ConnectedLowLow.gif similarity index 100% rename from res/ConnectedLowLow.gif rename to srchybrid/res/ConnectedLowLow.gif diff --git a/res/ConnectedLowLow.ico b/srchybrid/res/ConnectedLowLow.ico similarity index 100% rename from res/ConnectedLowLow.ico rename to srchybrid/res/ConnectedLowLow.ico diff --git a/res/ConnectedLowNot.gif b/srchybrid/res/ConnectedLowNot.gif similarity index 100% rename from res/ConnectedLowNot.gif rename to srchybrid/res/ConnectedLowNot.gif diff --git a/res/ConnectedLowNot.ico b/srchybrid/res/ConnectedLowNot.ico similarity index 100% rename from res/ConnectedLowNot.ico rename to srchybrid/res/ConnectedLowNot.ico diff --git a/res/ConnectedNotHigh.gif b/srchybrid/res/ConnectedNotHigh.gif similarity index 100% rename from res/ConnectedNotHigh.gif rename to srchybrid/res/ConnectedNotHigh.gif diff --git a/res/ConnectedNotHigh.ico b/srchybrid/res/ConnectedNotHigh.ico similarity index 100% rename from res/ConnectedNotHigh.ico rename to srchybrid/res/ConnectedNotHigh.ico diff --git a/res/ConnectedNotLow.gif b/srchybrid/res/ConnectedNotLow.gif similarity index 100% rename from res/ConnectedNotLow.gif rename to srchybrid/res/ConnectedNotLow.gif diff --git a/res/ConnectedNotLow.ico b/srchybrid/res/ConnectedNotLow.ico similarity index 100% rename from res/ConnectedNotLow.ico rename to srchybrid/res/ConnectedNotLow.ico diff --git a/res/ConnectedNotNot.gif b/srchybrid/res/ConnectedNotNot.gif similarity index 100% rename from res/ConnectedNotNot.gif rename to srchybrid/res/ConnectedNotNot.gif diff --git a/res/ConnectedNotNot.ico b/srchybrid/res/ConnectedNotNot.ico similarity index 100% rename from res/ConnectedNotNot.ico rename to srchybrid/res/ConnectedNotNot.ico diff --git a/res/Connection.ico b/srchybrid/res/Connection.ico similarity index 100% rename from res/Connection.ico rename to srchybrid/res/Connection.ico diff --git a/res/Contact0.ico b/srchybrid/res/Contact0.ico similarity index 100% rename from res/Contact0.ico rename to srchybrid/res/Contact0.ico diff --git a/res/Contact1.ico b/srchybrid/res/Contact1.ico similarity index 100% rename from res/Contact1.ico rename to srchybrid/res/Contact1.ico diff --git a/res/Contact2.ico b/srchybrid/res/Contact2.ico similarity index 100% rename from res/Contact2.ico rename to srchybrid/res/Contact2.ico diff --git a/res/Contact3.ico b/srchybrid/res/Contact3.ico similarity index 100% rename from res/Contact3.ico rename to srchybrid/res/Contact3.ico diff --git a/res/Contact4.ico b/srchybrid/res/Contact4.ico similarity index 100% rename from res/Contact4.ico rename to srchybrid/res/Contact4.ico diff --git a/res/Convert.ico b/srchybrid/res/Convert.ico similarity index 100% rename from res/Convert.ico rename to srchybrid/res/Convert.ico diff --git a/res/Copy.ico b/srchybrid/res/Copy.ico similarity index 100% rename from res/Copy.ico rename to srchybrid/res/Copy.ico diff --git a/res/CopySelected.ico b/srchybrid/res/CopySelected.ico similarity index 100% rename from res/CopySelected.ico rename to srchybrid/res/CopySelected.ico diff --git a/res/CopyVisible.ico b/srchybrid/res/CopyVisible.ico similarity index 100% rename from res/CopyVisible.ico rename to srchybrid/res/CopyVisible.ico diff --git a/res/CreditOvl.ico b/srchybrid/res/CreditOvl.ico similarity index 100% rename from res/CreditOvl.ico rename to srchybrid/res/CreditOvl.ico diff --git a/res/CreditSecureOvl.ico b/srchybrid/res/CreditSecureOvl.ico similarity index 100% rename from res/CreditSecureOvl.ico rename to srchybrid/res/CreditSecureOvl.ico diff --git a/res/Cut.ico b/srchybrid/res/Cut.ico similarity index 100% rename from res/Cut.ico rename to srchybrid/res/Cut.ico diff --git a/res/DROPICON.ICO b/srchybrid/res/DROPICON.ICO similarity index 100% rename from res/DROPICON.ICO rename to srchybrid/res/DROPICON.ICO diff --git a/res/Delete.ico b/srchybrid/res/Delete.ico similarity index 100% rename from res/Delete.ico rename to srchybrid/res/Delete.ico diff --git a/res/DeleteAll.ico b/srchybrid/res/DeleteAll.ico similarity index 100% rename from res/DeleteAll.ico rename to srchybrid/res/DeleteAll.ico diff --git a/res/DeleteSelected.ico b/srchybrid/res/DeleteSelected.ico similarity index 100% rename from res/DeleteSelected.ico rename to srchybrid/res/DeleteSelected.ico diff --git a/res/DirectDownload.ico b/srchybrid/res/DirectDownload.ico similarity index 100% rename from res/DirectDownload.ico rename to srchybrid/res/DirectDownload.ico diff --git a/res/Display.ico b/srchybrid/res/Display.ico similarity index 100% rename from res/Display.ico rename to srchybrid/res/Display.ico diff --git a/res/DlMode.ico b/srchybrid/res/DlMode.ico similarity index 100% rename from res/DlMode.ico rename to srchybrid/res/DlMode.ico diff --git a/res/Download.gif b/srchybrid/res/Download.gif similarity index 100% rename from res/Download.gif rename to srchybrid/res/Download.gif diff --git a/res/Download.ico b/srchybrid/res/Download.ico similarity index 100% rename from res/Download.ico rename to srchybrid/res/Download.ico diff --git a/res/DownloadFiles.ico b/srchybrid/res/DownloadFiles.ico similarity index 100% rename from res/DownloadFiles.ico rename to srchybrid/res/DownloadFiles.ico diff --git a/res/DropDefaults.ico b/srchybrid/res/DropDefaults.ico similarity index 100% rename from res/DropDefaults.ico rename to srchybrid/res/DropDefaults.ico diff --git a/res/EastShare.ico b/srchybrid/res/EastShare.ico similarity index 100% rename from res/EastShare.ico rename to srchybrid/res/EastShare.ico diff --git a/res/Empty.ico b/srchybrid/res/Empty.ico similarity index 100% rename from res/Empty.ico rename to srchybrid/res/Empty.ico diff --git a/res/Emulator.ico b/srchybrid/res/Emulator.ico similarity index 100% rename from res/Emulator.ico rename to srchybrid/res/Emulator.ico diff --git a/res/Exit.ico b/srchybrid/res/Exit.ico similarity index 100% rename from res/Exit.ico rename to srchybrid/res/Exit.ico diff --git a/res/ExpandAll.ico b/srchybrid/res/ExpandAll.ico similarity index 100% rename from res/ExpandAll.ico rename to srchybrid/res/ExpandAll.ico diff --git a/res/ExpandAll2.ico b/srchybrid/res/ExpandAll2.ico similarity index 100% rename from res/ExpandAll2.ico rename to srchybrid/res/ExpandAll2.ico diff --git a/res/ExportAll.ico b/srchybrid/res/ExportAll.ico similarity index 100% rename from res/ExportAll.ico rename to srchybrid/res/ExportAll.ico diff --git a/res/FileAddSrc.ico b/srchybrid/res/FileAddSrc.ico similarity index 100% rename from res/FileAddSrc.ico rename to srchybrid/res/FileAddSrc.ico diff --git a/res/FileComments.ico b/srchybrid/res/FileComments.ico similarity index 100% rename from res/FileComments.ico rename to srchybrid/res/FileComments.ico diff --git a/res/FileCommentsOvl.ico b/srchybrid/res/FileCommentsOvl.ico similarity index 100% rename from res/FileCommentsOvl.ico rename to srchybrid/res/FileCommentsOvl.ico diff --git a/res/FileDonkey.ico b/srchybrid/res/FileDonkey.ico similarity index 100% rename from res/FileDonkey.ico rename to srchybrid/res/FileDonkey.ico diff --git a/res/FileDownload.ico b/srchybrid/res/FileDownload.ico similarity index 100% rename from res/FileDownload.ico rename to srchybrid/res/FileDownload.ico diff --git a/res/FileDownloadPaused.ico b/srchybrid/res/FileDownloadPaused.ico similarity index 100% rename from res/FileDownloadPaused.ico rename to srchybrid/res/FileDownloadPaused.ico diff --git a/res/FileDownloadPreviewFirst.ico b/srchybrid/res/FileDownloadPreviewFirst.ico similarity index 100% rename from res/FileDownloadPreviewFirst.ico rename to srchybrid/res/FileDownloadPreviewFirst.ico diff --git a/res/FileDownloadPreviewPause.ico b/srchybrid/res/FileDownloadPreviewPause.ico similarity index 100% rename from res/FileDownloadPreviewPause.ico rename to srchybrid/res/FileDownloadPreviewPause.ico diff --git a/res/FileHideOS.ico b/srchybrid/res/FileHideOS.ico similarity index 100% rename from res/FileHideOS.ico rename to srchybrid/res/FileHideOS.ico diff --git a/res/FileInfo.gif b/srchybrid/res/FileInfo.gif similarity index 100% rename from res/FileInfo.gif rename to srchybrid/res/FileInfo.gif diff --git a/res/FileInfo.ico b/srchybrid/res/FileInfo.ico similarity index 100% rename from res/FileInfo.ico rename to srchybrid/res/FileInfo.ico diff --git a/res/FileLinearPrio.ico b/srchybrid/res/FileLinearPrio.ico similarity index 100% rename from res/FileLinearPrio.ico rename to srchybrid/res/FileLinearPrio.ico diff --git a/res/FileMassRename.ico b/srchybrid/res/FileMassRename.ico similarity index 100% rename from res/FileMassRename.ico rename to srchybrid/res/FileMassRename.ico diff --git a/res/FileOpen.ico b/srchybrid/res/FileOpen.ico similarity index 100% rename from res/FileOpen.ico rename to srchybrid/res/FileOpen.ico diff --git a/res/FilePowerShare.ico b/srchybrid/res/FilePowerShare.ico similarity index 100% rename from res/FilePowerShare.ico rename to srchybrid/res/FilePowerShare.ico diff --git a/res/FilePriority.ico b/srchybrid/res/FilePriority.ico similarity index 100% rename from res/FilePriority.ico rename to srchybrid/res/FilePriority.ico diff --git a/res/FileRating0.ico b/srchybrid/res/FileRating0.ico similarity index 100% rename from res/FileRating0.ico rename to srchybrid/res/FileRating0.ico diff --git a/res/FileRating1.ico b/srchybrid/res/FileRating1.ico similarity index 100% rename from res/FileRating1.ico rename to srchybrid/res/FileRating1.ico diff --git a/res/FileRating2.ico b/srchybrid/res/FileRating2.ico similarity index 100% rename from res/FileRating2.ico rename to srchybrid/res/FileRating2.ico diff --git a/res/FileRating3.ico b/srchybrid/res/FileRating3.ico similarity index 100% rename from res/FileRating3.ico rename to srchybrid/res/FileRating3.ico diff --git a/res/FileRating4.ico b/srchybrid/res/FileRating4.ico similarity index 100% rename from res/FileRating4.ico rename to srchybrid/res/FileRating4.ico diff --git a/res/FileRating5.ico b/srchybrid/res/FileRating5.ico similarity index 100% rename from res/FileRating5.ico rename to srchybrid/res/FileRating5.ico diff --git a/res/FileRename.ico b/srchybrid/res/FileRename.ico similarity index 100% rename from res/FileRename.ico rename to srchybrid/res/FileRename.ico diff --git a/res/FileRequested.ico b/srchybrid/res/FileRequested.ico similarity index 100% rename from res/FileRequested.ico rename to srchybrid/res/FileRequested.ico diff --git a/res/FileShareONlyTheNeed.ico b/srchybrid/res/FileShareONlyTheNeed.ico similarity index 100% rename from res/FileShareONlyTheNeed.ico rename to srchybrid/res/FileShareONlyTheNeed.ico diff --git a/res/FileSharedKad.ico b/srchybrid/res/FileSharedKad.ico similarity index 100% rename from res/FileSharedKad.ico rename to srchybrid/res/FileSharedKad.ico diff --git a/res/FileSharedServer.ico b/srchybrid/res/FileSharedServer.ico similarity index 100% rename from res/FileSharedServer.ico rename to srchybrid/res/FileSharedServer.ico diff --git a/res/FileTypeAny.ico b/srchybrid/res/FileTypeAny.ico similarity index 100% rename from res/FileTypeAny.ico rename to srchybrid/res/FileTypeAny.ico diff --git a/res/FileTypeArchive.ico b/srchybrid/res/FileTypeArchive.ico similarity index 100% rename from res/FileTypeArchive.ico rename to srchybrid/res/FileTypeArchive.ico diff --git a/res/FileTypeAudio.ico b/srchybrid/res/FileTypeAudio.ico similarity index 100% rename from res/FileTypeAudio.ico rename to srchybrid/res/FileTypeAudio.ico diff --git a/res/FileTypeCDImage.ico b/srchybrid/res/FileTypeCDImage.ico similarity index 100% rename from res/FileTypeCDImage.ico rename to srchybrid/res/FileTypeCDImage.ico diff --git a/res/FileTypeDocument.ico b/srchybrid/res/FileTypeDocument.ico similarity index 100% rename from res/FileTypeDocument.ico rename to srchybrid/res/FileTypeDocument.ico diff --git a/res/FileTypePicture.ico b/srchybrid/res/FileTypePicture.ico similarity index 100% rename from res/FileTypePicture.ico rename to srchybrid/res/FileTypePicture.ico diff --git a/res/FileTypeProgram.ico b/srchybrid/res/FileTypeProgram.ico similarity index 100% rename from res/FileTypeProgram.ico rename to srchybrid/res/FileTypeProgram.ico diff --git a/res/FileTypeVideo.ico b/srchybrid/res/FileTypeVideo.ico similarity index 100% rename from res/FileTypeVideo.ico rename to srchybrid/res/FileTypeVideo.ico diff --git a/res/FolderOpen.ico b/srchybrid/res/FolderOpen.ico similarity index 100% rename from res/FolderOpen.ico rename to srchybrid/res/FolderOpen.ico diff --git a/res/Folders.ico b/srchybrid/res/Folders.ico similarity index 100% rename from res/Folders.ico rename to srchybrid/res/Folders.ico diff --git a/res/Friend.ico b/srchybrid/res/Friend.ico similarity index 100% rename from res/Friend.ico rename to srchybrid/res/Friend.ico diff --git a/res/FriendSlot.ico b/srchybrid/res/FriendSlot.ico similarity index 100% rename from res/FriendSlot.ico rename to srchybrid/res/FriendSlot.ico diff --git a/res/FriendSlotOvl.ico b/srchybrid/res/FriendSlotOvl.ico similarity index 100% rename from res/FriendSlotOvl.ico rename to srchybrid/res/FriendSlotOvl.ico diff --git a/res/Friends1.ico b/srchybrid/res/Friends1.ico similarity index 100% rename from res/Friends1.ico rename to srchybrid/res/Friends1.ico diff --git a/res/Friends2.ico b/srchybrid/res/Friends2.ico similarity index 100% rename from res/Friends2.ico rename to srchybrid/res/Friends2.ico diff --git a/res/Friends3.ico b/srchybrid/res/Friends3.ico similarity index 100% rename from res/Friends3.ico rename to srchybrid/res/Friends3.ico diff --git a/res/FunnyNick.ico b/srchybrid/res/FunnyNick.ico similarity index 100% rename from res/FunnyNick.ico rename to srchybrid/res/FunnyNick.ico diff --git a/res/Global.ico b/srchybrid/res/Global.ico similarity index 100% rename from res/Global.ico rename to srchybrid/res/Global.ico diff --git a/res/HardDisk.gif b/srchybrid/res/HardDisk.gif similarity index 100% rename from res/HardDisk.gif rename to srchybrid/res/HardDisk.gif diff --git a/res/HardDisk.ico b/srchybrid/res/HardDisk.ico similarity index 100% rename from res/HardDisk.ico rename to srchybrid/res/HardDisk.ico diff --git a/res/Help.ico b/srchybrid/res/Help.ico similarity index 100% rename from res/Help.ico rename to srchybrid/res/Help.ico diff --git a/res/IPFilter.ico b/srchybrid/res/IPFilter.ico similarity index 100% rename from res/IPFilter.ico rename to srchybrid/res/IPFilter.ico diff --git a/res/IRC.ico b/srchybrid/res/IRC.ico similarity index 100% rename from res/IRC.ico rename to srchybrid/res/IRC.ico diff --git a/res/IRCClipboard.ico b/srchybrid/res/IRCClipboard.ico similarity index 100% rename from res/IRCClipboard.ico rename to srchybrid/res/IRCClipboard.ico diff --git a/res/Import.ico b/srchybrid/res/Import.ico similarity index 100% rename from res/Import.ico rename to srchybrid/res/Import.ico diff --git a/res/Incoming.gif b/srchybrid/res/Incoming.gif similarity index 100% rename from res/Incoming.gif rename to srchybrid/res/Incoming.gif diff --git a/res/Incoming.ico b/srchybrid/res/Incoming.ico similarity index 100% rename from res/Incoming.ico rename to srchybrid/res/Incoming.ico diff --git a/res/InetDownload.avi b/srchybrid/res/InetDownload.avi similarity index 100% rename from res/InetDownload.avi rename to srchybrid/res/InetDownload.avi diff --git a/res/Info.ico b/srchybrid/res/Info.ico similarity index 100% rename from res/Info.ico rename to srchybrid/res/Info.ico diff --git a/res/InvMode.ico b/srchybrid/res/InvMode.ico similarity index 100% rename from res/InvMode.ico rename to srchybrid/res/InvMode.ico diff --git a/res/Kad.ico b/srchybrid/res/Kad.ico similarity index 100% rename from res/Kad.ico rename to srchybrid/res/Kad.ico diff --git a/res/KadBootstrap.ico b/srchybrid/res/KadBootstrap.ico similarity index 100% rename from res/KadBootstrap.ico rename to srchybrid/res/KadBootstrap.ico diff --git a/res/KadContactList.ico b/srchybrid/res/KadContactList.ico similarity index 100% rename from res/KadContactList.ico rename to srchybrid/res/KadContactList.ico diff --git a/res/KadCurrentSearches.ico b/srchybrid/res/KadCurrentSearches.ico similarity index 100% rename from res/KadCurrentSearches.ico rename to srchybrid/res/KadCurrentSearches.ico diff --git a/res/KadFileSearch.ico b/srchybrid/res/KadFileSearch.ico similarity index 100% rename from res/KadFileSearch.ico rename to srchybrid/res/KadFileSearch.ico diff --git a/res/KadNodeSearch.ico b/srchybrid/res/KadNodeSearch.ico similarity index 100% rename from res/KadNodeSearch.ico rename to srchybrid/res/KadNodeSearch.ico diff --git a/res/KadServer.ico b/srchybrid/res/KadServer.ico similarity index 100% rename from res/KadServer.ico rename to srchybrid/res/KadServer.ico diff --git a/res/KadStoreFile.ico b/srchybrid/res/KadStoreFile.ico similarity index 100% rename from res/KadStoreFile.ico rename to srchybrid/res/KadStoreFile.ico diff --git a/res/KadStoreWord.ico b/srchybrid/res/KadStoreWord.ico similarity index 100% rename from res/KadStoreWord.ico rename to srchybrid/res/KadStoreWord.ico diff --git a/res/KadWordSearch.ico b/srchybrid/res/KadWordSearch.ico similarity index 100% rename from res/KadWordSearch.ico rename to srchybrid/res/KadWordSearch.ico diff --git a/res/ListAdd.ico b/srchybrid/res/ListAdd.ico similarity index 100% rename from res/ListAdd.ico rename to srchybrid/res/ListAdd.ico diff --git a/res/ListRemove.ico b/srchybrid/res/ListRemove.ico similarity index 100% rename from res/ListRemove.ico rename to srchybrid/res/ListRemove.ico diff --git a/res/ListViewSortDown.bmp b/srchybrid/res/ListViewSortDown.bmp similarity index 100% rename from res/ListViewSortDown.bmp rename to srchybrid/res/ListViewSortDown.bmp diff --git a/res/ListViewSortDown2x.bmp b/srchybrid/res/ListViewSortDown2x.bmp similarity index 100% rename from res/ListViewSortDown2x.bmp rename to srchybrid/res/ListViewSortDown2x.bmp diff --git a/res/ListViewSortUp.bmp b/srchybrid/res/ListViewSortUp.bmp similarity index 100% rename from res/ListViewSortUp.bmp rename to srchybrid/res/ListViewSortUp.bmp diff --git a/res/ListViewSortUp2x.bmp b/srchybrid/res/ListViewSortUp2x.bmp similarity index 100% rename from res/ListViewSortUp2x.bmp rename to srchybrid/res/ListViewSortUp2x.bmp diff --git a/res/Log.ico b/srchybrid/res/Log.ico similarity index 100% rename from res/Log.ico rename to srchybrid/res/Log.ico diff --git a/res/Logo.jpg b/srchybrid/res/Logo.jpg similarity index 100% rename from res/Logo.jpg rename to srchybrid/res/Logo.jpg diff --git a/res/MM_ConCon.ico b/srchybrid/res/MM_ConCon.ico similarity index 100% rename from res/MM_ConCon.ico rename to srchybrid/res/MM_ConCon.ico diff --git a/res/MM_ConDis.ico b/srchybrid/res/MM_ConDis.ico similarity index 100% rename from res/MM_ConDis.ico rename to srchybrid/res/MM_ConDis.ico diff --git a/res/MM_ConLow.ico b/srchybrid/res/MM_ConLow.ico similarity index 100% rename from res/MM_ConLow.ico rename to srchybrid/res/MM_ConLow.ico diff --git a/res/MM_DisCon.ico b/srchybrid/res/MM_DisCon.ico similarity index 100% rename from res/MM_DisCon.ico rename to srchybrid/res/MM_DisCon.ico diff --git a/res/MM_DisDis.ico b/srchybrid/res/MM_DisDis.ico similarity index 100% rename from res/MM_DisDis.ico rename to srchybrid/res/MM_DisDis.ico diff --git a/res/MM_DisLow.ico b/srchybrid/res/MM_DisLow.ico similarity index 100% rename from res/MM_DisLow.ico rename to srchybrid/res/MM_DisLow.ico diff --git a/res/MM_LowCon.ico b/srchybrid/res/MM_LowCon.ico similarity index 100% rename from res/MM_LowCon.ico rename to srchybrid/res/MM_LowCon.ico diff --git a/res/MM_LowDis.ico b/srchybrid/res/MM_LowDis.ico similarity index 100% rename from res/MM_LowDis.ico rename to srchybrid/res/MM_LowDis.ico diff --git a/res/MM_LowLow.ico b/srchybrid/res/MM_LowLow.ico similarity index 100% rename from res/MM_LowLow.ico rename to srchybrid/res/MM_LowLow.ico diff --git a/res/MagicAngel.ico b/srchybrid/res/MagicAngel.ico similarity index 100% rename from res/MagicAngel.ico rename to srchybrid/res/MagicAngel.ico diff --git a/res/MediaInfo.ico b/srchybrid/res/MediaInfo.ico similarity index 100% rename from res/MediaInfo.ico rename to srchybrid/res/MediaInfo.ico diff --git a/res/Message.ico b/srchybrid/res/Message.ico similarity index 100% rename from res/Message.ico rename to srchybrid/res/Message.ico diff --git a/res/MessagePending.ico b/srchybrid/res/MessagePending.ico similarity index 100% rename from res/MessagePending.ico rename to srchybrid/res/MessagePending.ico diff --git a/res/Messages.ico b/srchybrid/res/Messages.ico similarity index 100% rename from res/Messages.ico rename to srchybrid/res/Messages.ico diff --git a/res/MetaData.ico b/srchybrid/res/MetaData.ico similarity index 100% rename from res/MetaData.ico rename to srchybrid/res/MetaData.ico diff --git a/res/MiniMule.ICO b/srchybrid/res/MiniMule.ICO similarity index 100% rename from res/MiniMule.ICO rename to srchybrid/res/MiniMule.ICO diff --git a/res/MiniMule.htm b/srchybrid/res/MiniMule.htm similarity index 100% rename from res/MiniMule.htm rename to srchybrid/res/MiniMule.htm diff --git a/res/MiniMuleBack.gif b/srchybrid/res/MiniMuleBack.gif similarity index 100% rename from res/MiniMuleBack.gif rename to srchybrid/res/MiniMuleBack.gif diff --git a/res/Morph.ico b/srchybrid/res/Morph.ico similarity index 100% rename from res/Morph.ico rename to srchybrid/res/Morph.ico diff --git a/res/Mule-old.ico b/srchybrid/res/Mule-old.ico similarity index 100% rename from res/Mule-old.ico rename to srchybrid/res/Mule-old.ico diff --git a/res/Mule.ico b/srchybrid/res/Mule.ico similarity index 100% rename from res/Mule.ico rename to srchybrid/res/Mule.ico diff --git a/res/Mule_Vista.ico b/srchybrid/res/Mule_Vista.ico similarity index 100% rename from res/Mule_Vista.ico rename to srchybrid/res/Mule_Vista.ico diff --git a/res/NavigateBack.ico b/srchybrid/res/NavigateBack.ico similarity index 100% rename from res/NavigateBack.ico rename to srchybrid/res/NavigateBack.ico diff --git a/res/NavigateForward.ico b/srchybrid/res/NavigateForward.ico similarity index 100% rename from res/NavigateForward.ico rename to srchybrid/res/NavigateForward.ico diff --git a/res/NoAccessFolderOvl.ico b/srchybrid/res/NoAccessFolderOvl.ico similarity index 100% rename from res/NoAccessFolderOvl.ico rename to srchybrid/res/NoAccessFolderOvl.ico diff --git a/res/NotShared.ico b/srchybrid/res/NotShared.ico similarity index 100% rename from res/NotShared.ico rename to srchybrid/res/NotShared.ico diff --git a/res/Notifications.ico b/srchybrid/res/Notifications.ico similarity index 100% rename from res/Notifications.ico rename to srchybrid/res/Notifications.ico diff --git a/res/Paste.ico b/srchybrid/res/Paste.ico similarity index 100% rename from res/Paste.ico rename to srchybrid/res/Paste.ico diff --git a/res/Pause.ico b/srchybrid/res/Pause.ico similarity index 100% rename from res/Pause.ico rename to srchybrid/res/Pause.ico diff --git a/res/Ports.ico b/srchybrid/res/Ports.ico similarity index 100% rename from res/Ports.ico rename to srchybrid/res/Ports.ico diff --git a/res/Preferences.gif b/srchybrid/res/Preferences.gif similarity index 100% rename from res/Preferences.gif rename to srchybrid/res/Preferences.gif diff --git a/res/Preferences.ico b/srchybrid/res/Preferences.ico similarity index 100% rename from res/Preferences.ico rename to srchybrid/res/Preferences.ico diff --git a/res/Preview.ico b/srchybrid/res/Preview.ico similarity index 100% rename from res/Preview.ico rename to srchybrid/res/Preview.ico diff --git a/res/Priority.ico b/srchybrid/res/Priority.ico similarity index 100% rename from res/Priority.ico rename to srchybrid/res/Priority.ico diff --git a/res/PriorityAuto.ico b/srchybrid/res/PriorityAuto.ico similarity index 100% rename from res/PriorityAuto.ico rename to srchybrid/res/PriorityAuto.ico diff --git a/res/PriorityHigh.ico b/srchybrid/res/PriorityHigh.ico similarity index 100% rename from res/PriorityHigh.ico rename to srchybrid/res/PriorityHigh.ico diff --git a/res/PriorityLow.ico b/srchybrid/res/PriorityLow.ico similarity index 100% rename from res/PriorityLow.ico rename to srchybrid/res/PriorityLow.ico diff --git a/res/PriorityNormal.ico b/srchybrid/res/PriorityNormal.ico similarity index 100% rename from res/PriorityNormal.ico rename to srchybrid/res/PriorityNormal.ico diff --git a/res/Proxy.ico b/srchybrid/res/Proxy.ico similarity index 100% rename from res/Proxy.ico rename to srchybrid/res/Proxy.ico diff --git a/res/Rating.ico b/srchybrid/res/Rating.ico similarity index 100% rename from res/Rating.ico rename to srchybrid/res/Rating.ico diff --git a/res/RatingBad.ico b/srchybrid/res/RatingBad.ico similarity index 100% rename from res/RatingBad.ico rename to srchybrid/res/RatingBad.ico diff --git a/res/Records.ico b/srchybrid/res/Records.ico similarity index 100% rename from res/Records.ico rename to srchybrid/res/Records.ico diff --git a/res/ReleaseBonus.ico b/srchybrid/res/ReleaseBonus.ico similarity index 100% rename from res/ReleaseBonus.ico rename to srchybrid/res/ReleaseBonus.ico diff --git a/res/Rename.ico b/srchybrid/res/Rename.ico similarity index 100% rename from res/Rename.ico rename to srchybrid/res/Rename.ico diff --git a/res/ResetSpreadBar.ico b/srchybrid/res/ResetSpreadBar.ico similarity index 100% rename from res/ResetSpreadBar.ico rename to srchybrid/res/ResetSpreadBar.ico diff --git a/res/Restore.ico b/srchybrid/res/Restore.ico similarity index 100% rename from res/Restore.ico rename to srchybrid/res/Restore.ico diff --git a/res/RestoreWindow.gif b/srchybrid/res/RestoreWindow.gif similarity index 100% rename from res/RestoreWindow.gif rename to srchybrid/res/RestoreWindow.gif diff --git a/res/RestoreWindow.ico b/srchybrid/res/RestoreWindow.ico similarity index 100% rename from res/RestoreWindow.ico rename to srchybrid/res/RestoreWindow.ico diff --git a/res/Save.ico b/srchybrid/res/Save.ico similarity index 100% rename from res/Save.ico rename to srchybrid/res/Save.ico diff --git a/res/ScarAngel.ico b/srchybrid/res/ScarAngel.ico similarity index 100% rename from res/ScarAngel.ico rename to srchybrid/res/ScarAngel.ico diff --git a/res/ScarClientsKnown.ico b/srchybrid/res/ScarClientsKnown.ico similarity index 100% rename from res/ScarClientsKnown.ico rename to srchybrid/res/ScarClientsKnown.ico diff --git a/res/ScarClientsOnQueue.ico b/srchybrid/res/ScarClientsOnQueue.ico similarity index 100% rename from res/ScarClientsOnQueue.ico rename to srchybrid/res/ScarClientsOnQueue.ico diff --git a/res/ScarConnectDo.ico b/srchybrid/res/ScarConnectDo.ico similarity index 100% rename from res/ScarConnectDo.ico rename to srchybrid/res/ScarConnectDo.ico diff --git a/res/ScarConnectDrop.ico b/srchybrid/res/ScarConnectDrop.ico similarity index 100% rename from res/ScarConnectDrop.ico rename to srchybrid/res/ScarConnectDrop.ico diff --git a/res/ScarConnectStop.ico b/srchybrid/res/ScarConnectStop.ico similarity index 100% rename from res/ScarConnectStop.ico rename to srchybrid/res/ScarConnectStop.ico diff --git a/res/ScarDownload.ico b/srchybrid/res/ScarDownload.ico similarity index 100% rename from res/ScarDownload.ico rename to srchybrid/res/ScarDownload.ico diff --git a/res/ScarDownloadFiles.ico b/srchybrid/res/ScarDownloadFiles.ico similarity index 100% rename from res/ScarDownloadFiles.ico rename to srchybrid/res/ScarDownloadFiles.ico diff --git a/res/ScarHelp.ico b/srchybrid/res/ScarHelp.ico similarity index 100% rename from res/ScarHelp.ico rename to srchybrid/res/ScarHelp.ico diff --git a/res/ScarIRC.ico b/srchybrid/res/ScarIRC.ico similarity index 100% rename from res/ScarIRC.ico rename to srchybrid/res/ScarIRC.ico diff --git a/res/ScarKad.ico b/srchybrid/res/ScarKad.ico similarity index 100% rename from res/ScarKad.ico rename to srchybrid/res/ScarKad.ico diff --git a/res/ScarMessages.ico b/srchybrid/res/ScarMessages.ico similarity index 100% rename from res/ScarMessages.ico rename to srchybrid/res/ScarMessages.ico diff --git a/res/ScarPreferences.ico b/srchybrid/res/ScarPreferences.ico similarity index 100% rename from res/ScarPreferences.ico rename to srchybrid/res/ScarPreferences.ico diff --git a/res/ScarSearch.ico b/srchybrid/res/ScarSearch.ico similarity index 100% rename from res/ScarSearch.ico rename to srchybrid/res/ScarSearch.ico diff --git a/res/ScarServer.ico b/srchybrid/res/ScarServer.ico similarity index 100% rename from res/ScarServer.ico rename to srchybrid/res/ScarServer.ico diff --git a/res/ScarSharedFiles.ico b/srchybrid/res/ScarSharedFiles.ico similarity index 100% rename from res/ScarSharedFiles.ico rename to srchybrid/res/ScarSharedFiles.ico diff --git a/res/ScarStatistics.ico b/srchybrid/res/ScarStatistics.ico similarity index 100% rename from res/ScarStatistics.ico rename to srchybrid/res/ScarStatistics.ico diff --git a/res/ScarTools.ico b/srchybrid/res/ScarTools.ico similarity index 100% rename from res/ScarTools.ico rename to srchybrid/res/ScarTools.ico diff --git a/res/ScarTransfer.ico b/srchybrid/res/ScarTransfer.ico similarity index 100% rename from res/ScarTransfer.ico rename to srchybrid/res/ScarTransfer.ico diff --git a/res/ScarTrayConnectedPlus.ico b/srchybrid/res/ScarTrayConnectedPlus.ico similarity index 100% rename from res/ScarTrayConnectedPlus.ico rename to srchybrid/res/ScarTrayConnectedPlus.ico diff --git a/res/ScarTrayDisconnectedPlus.ico b/srchybrid/res/ScarTrayDisconnectedPlus.ico similarity index 100% rename from res/ScarTrayDisconnectedPlus.ico rename to srchybrid/res/ScarTrayDisconnectedPlus.ico diff --git a/res/ScarTrayLowIDPlus.ico b/srchybrid/res/ScarTrayLowIDPlus.ico similarity index 100% rename from res/ScarTrayLowIDPlus.ico rename to srchybrid/res/ScarTrayLowIDPlus.ico diff --git a/res/ScarUpload.ico b/srchybrid/res/ScarUpload.ico similarity index 100% rename from res/ScarUpload.ico rename to srchybrid/res/ScarUpload.ico diff --git a/res/Scar_Vista.ico b/srchybrid/res/Scar_Vista.ico similarity index 100% rename from res/Scar_Vista.ico rename to srchybrid/res/Scar_Vista.ico diff --git a/res/Scheduler.ico b/srchybrid/res/Scheduler.ico similarity index 100% rename from res/Scheduler.ico rename to srchybrid/res/Scheduler.ico diff --git a/res/SchedulerAdd.ico b/srchybrid/res/SchedulerAdd.ico similarity index 100% rename from res/SchedulerAdd.ico rename to srchybrid/res/SchedulerAdd.ico diff --git a/res/SchedulerEdit.ico b/srchybrid/res/SchedulerEdit.ico similarity index 100% rename from res/SchedulerEdit.ico rename to srchybrid/res/SchedulerEdit.ico diff --git a/res/SchedulerRemove.ico b/srchybrid/res/SchedulerRemove.ico similarity index 100% rename from res/SchedulerRemove.ico rename to srchybrid/res/SchedulerRemove.ico diff --git a/res/Search.ico b/srchybrid/res/Search.ico similarity index 100% rename from res/Search.ico rename to srchybrid/res/Search.ico diff --git a/res/SearchEdit.ico b/srchybrid/res/SearchEdit.ico similarity index 100% rename from res/SearchEdit.ico rename to srchybrid/res/SearchEdit.ico diff --git a/res/SearchGlobalActive.ico b/srchybrid/res/SearchGlobalActive.ico similarity index 100% rename from res/SearchGlobalActive.ico rename to srchybrid/res/SearchGlobalActive.ico diff --git a/res/SearchKad.ico b/srchybrid/res/SearchKad.ico similarity index 100% rename from res/SearchKad.ico rename to srchybrid/res/SearchKad.ico diff --git a/res/SearchKadActive.ico b/srchybrid/res/SearchKadActive.ico similarity index 100% rename from res/SearchKadActive.ico rename to srchybrid/res/SearchKadActive.ico diff --git a/res/SearchParams.ico b/srchybrid/res/SearchParams.ico similarity index 100% rename from res/SearchParams.ico rename to srchybrid/res/SearchParams.ico diff --git a/res/SearchResults.ico b/srchybrid/res/SearchResults.ico similarity index 100% rename from res/SearchResults.ico rename to srchybrid/res/SearchResults.ico diff --git a/res/SearchServerActive.ico b/srchybrid/res/SearchServerActive.ico similarity index 100% rename from res/SearchServerActive.ico rename to srchybrid/res/SearchServerActive.ico diff --git a/res/Security.ico b/srchybrid/res/Security.ico similarity index 100% rename from res/Security.ico rename to srchybrid/res/Security.ico diff --git a/res/Server.ico b/srchybrid/res/Server.ico similarity index 100% rename from res/Server.ico rename to srchybrid/res/Server.ico diff --git a/res/ServerAdd.ico b/srchybrid/res/ServerAdd.ico similarity index 100% rename from res/ServerAdd.ico rename to srchybrid/res/ServerAdd.ico diff --git a/res/ServerInfo.ico b/srchybrid/res/ServerInfo.ico similarity index 100% rename from res/ServerInfo.ico rename to srchybrid/res/ServerInfo.ico diff --git a/res/ServerList.ico b/srchybrid/res/ServerList.ico similarity index 100% rename from res/ServerList.ico rename to srchybrid/res/ServerList.ico diff --git a/res/ServerSearch.ico b/srchybrid/res/ServerSearch.ico similarity index 100% rename from res/ServerSearch.ico rename to srchybrid/res/ServerSearch.ico diff --git a/res/ServersUpdate.ico b/srchybrid/res/ServersUpdate.ico similarity index 100% rename from res/ServersUpdate.ico rename to srchybrid/res/ServersUpdate.ico diff --git a/res/ShareDir.ico b/srchybrid/res/ShareDir.ico similarity index 100% rename from res/ShareDir.ico rename to srchybrid/res/ShareDir.ico diff --git a/res/SharedFiles.ico b/srchybrid/res/SharedFiles.ico similarity index 100% rename from res/SharedFiles.ico rename to srchybrid/res/SharedFiles.ico diff --git a/res/SharedFilesList.ico b/srchybrid/res/SharedFilesList.ico similarity index 100% rename from res/SharedFilesList.ico rename to srchybrid/res/SharedFilesList.ico diff --git a/res/SharedFilesManagement.ico b/srchybrid/res/SharedFilesManagement.ico similarity index 100% rename from res/SharedFilesManagement.ico rename to srchybrid/res/SharedFilesManagement.ico diff --git a/res/SharedFolderOvl.ico b/srchybrid/res/SharedFolderOvl.ico similarity index 100% rename from res/SharedFolderOvl.ico rename to srchybrid/res/SharedFolderOvl.ico diff --git a/res/Smiley_Cry.ico b/srchybrid/res/Smiley_Cry.ico similarity index 100% rename from res/Smiley_Cry.ico rename to srchybrid/res/Smiley_Cry.ico diff --git a/res/Smiley_Disgust.ico b/srchybrid/res/Smiley_Disgust.ico similarity index 100% rename from res/Smiley_Disgust.ico rename to srchybrid/res/Smiley_Disgust.ico diff --git a/res/Smiley_Happy.ico b/srchybrid/res/Smiley_Happy.ico similarity index 100% rename from res/Smiley_Happy.ico rename to srchybrid/res/Smiley_Happy.ico diff --git a/res/Smiley_Interest.ico b/srchybrid/res/Smiley_Interest.ico similarity index 100% rename from res/Smiley_Interest.ico rename to srchybrid/res/Smiley_Interest.ico diff --git a/res/Smiley_Laugh.ico b/srchybrid/res/Smiley_Laugh.ico similarity index 100% rename from res/Smiley_Laugh.ico rename to srchybrid/res/Smiley_Laugh.ico diff --git a/res/Smiley_Love.ico b/srchybrid/res/Smiley_Love.ico similarity index 100% rename from res/Smiley_Love.ico rename to srchybrid/res/Smiley_Love.ico diff --git a/res/Smiley_Ph34r.ico b/srchybrid/res/Smiley_Ph34r.ico similarity index 100% rename from res/Smiley_Ph34r.ico rename to srchybrid/res/Smiley_Ph34r.ico diff --git a/res/Smiley_Sad.ico b/srchybrid/res/Smiley_Sad.ico similarity index 100% rename from res/Smiley_Sad.ico rename to srchybrid/res/Smiley_Sad.ico diff --git a/res/Smiley_Sealed.ico b/srchybrid/res/Smiley_Sealed.ico similarity index 100% rename from res/Smiley_Sealed.ico rename to srchybrid/res/Smiley_Sealed.ico diff --git a/res/Smiley_Skeptic.ico b/srchybrid/res/Smiley_Skeptic.ico similarity index 100% rename from res/Smiley_Skeptic.ico rename to srchybrid/res/Smiley_Skeptic.ico diff --git a/res/Smiley_Smile.ico b/srchybrid/res/Smiley_Smile.ico similarity index 100% rename from res/Smiley_Smile.ico rename to srchybrid/res/Smiley_Smile.ico diff --git a/res/Smiley_Tongue.ico b/srchybrid/res/Smiley_Tongue.ico similarity index 100% rename from res/Smiley_Tongue.ico rename to srchybrid/res/Smiley_Tongue.ico diff --git a/res/Smiley_Wink.ico b/srchybrid/res/Smiley_Wink.ico similarity index 100% rename from res/Smiley_Wink.ico rename to srchybrid/res/Smiley_Wink.ico diff --git a/res/Smiley_lookside.ico b/srchybrid/res/Smiley_lookside.ico similarity index 100% rename from res/Smiley_lookside.ico rename to srchybrid/res/Smiley_lookside.ico diff --git a/res/Smiley_omg.ico b/srchybrid/res/Smiley_omg.ico similarity index 100% rename from res/Smiley_omg.ico rename to srchybrid/res/Smiley_omg.ico diff --git a/res/Smiley_sadq.ico b/srchybrid/res/Smiley_sadq.ico similarity index 100% rename from res/Smiley_sadq.ico rename to srchybrid/res/Smiley_sadq.ico diff --git a/res/Smiley_smileq.ico b/srchybrid/res/Smiley_smileq.ico similarity index 100% rename from res/Smiley_smileq.ico rename to srchybrid/res/Smiley_smileq.ico diff --git a/res/Spam.ico b/srchybrid/res/Spam.ico similarity index 100% rename from res/Spam.ico rename to srchybrid/res/Spam.ico diff --git a/res/Speed.ico b/srchybrid/res/Speed.ico similarity index 100% rename from res/Speed.ico rename to srchybrid/res/Speed.ico diff --git a/res/SpeedMax.ico b/srchybrid/res/SpeedMax.ico similarity index 100% rename from res/SpeedMax.ico rename to srchybrid/res/SpeedMax.ico diff --git a/res/SpeedMin.ico b/srchybrid/res/SpeedMin.ico similarity index 100% rename from res/SpeedMin.ico rename to srchybrid/res/SpeedMin.ico diff --git a/res/SplitWindow.ico b/srchybrid/res/SplitWindow.ico similarity index 100% rename from res/SplitWindow.ico rename to srchybrid/res/SplitWindow.ico diff --git a/res/SpreadCredits.ico b/srchybrid/res/SpreadCredits.ico similarity index 100% rename from res/SpreadCredits.ico rename to srchybrid/res/SpreadCredits.ico diff --git a/res/Start.ico b/srchybrid/res/Start.ico similarity index 100% rename from res/Start.ico rename to srchybrid/res/Start.ico diff --git a/res/Statistics.ico b/srchybrid/res/Statistics.ico similarity index 100% rename from res/Statistics.ico rename to srchybrid/res/Statistics.ico diff --git a/res/StatisticsDetail.ico b/srchybrid/res/StatisticsDetail.ico similarity index 100% rename from res/StatisticsDetail.ico rename to srchybrid/res/StatisticsDetail.ico diff --git a/res/StatsCumulative.ico b/srchybrid/res/StatsCumulative.ico similarity index 100% rename from res/StatsCumulative.ico rename to srchybrid/res/StatsCumulative.ico diff --git a/res/StatsDay.ico b/srchybrid/res/StatsDay.ico similarity index 100% rename from res/StatsDay.ico rename to srchybrid/res/StatsDay.ico diff --git a/res/StatsGeneric.ico b/srchybrid/res/StatsGeneric.ico similarity index 100% rename from res/StatsGeneric.ico rename to srchybrid/res/StatsGeneric.ico diff --git a/res/StatsMonth.ico b/srchybrid/res/StatsMonth.ico similarity index 100% rename from res/StatsMonth.ico rename to srchybrid/res/StatsMonth.ico diff --git a/res/StatsProjected.ico b/srchybrid/res/StatsProjected.ico similarity index 100% rename from res/StatsProjected.ico rename to srchybrid/res/StatsProjected.ico diff --git a/res/StatsTime.ico b/srchybrid/res/StatsTime.ico similarity index 100% rename from res/StatsTime.ico rename to srchybrid/res/StatsTime.ico diff --git a/res/StatsYear.ico b/srchybrid/res/StatsYear.ico similarity index 100% rename from res/StatsYear.ico rename to srchybrid/res/StatsYear.ico diff --git a/res/Stop.ico b/srchybrid/res/Stop.ico similarity index 100% rename from res/Stop.ico rename to srchybrid/res/Stop.ico diff --git a/res/Support.ico b/srchybrid/res/Support.ico similarity index 100% rename from res/Support.ico rename to srchybrid/res/Support.ico diff --git a/res/SysInfo.ico b/srchybrid/res/SysInfo.ico similarity index 100% rename from res/SysInfo.ico rename to srchybrid/res/SysInfo.ico diff --git a/res/TaskbarNotifier.gif b/srchybrid/res/TaskbarNotifier.gif similarity index 100% rename from res/TaskbarNotifier.gif rename to srchybrid/res/TaskbarNotifier.gif diff --git a/res/Tools.ico b/srchybrid/res/Tools.ico similarity index 100% rename from res/Tools.ico rename to srchybrid/res/Tools.ico diff --git a/res/Transfer.ico b/srchybrid/res/Transfer.ico similarity index 100% rename from res/Transfer.ico rename to srchybrid/res/Transfer.ico diff --git a/res/TransferUpDown.ico b/srchybrid/res/TransferUpDown.ico similarity index 100% rename from res/TransferUpDown.ico rename to srchybrid/res/TransferUpDown.ico diff --git a/res/TrayBtnBlue.bmp b/srchybrid/res/TrayBtnBlue.bmp similarity index 100% rename from res/TrayBtnBlue.bmp rename to srchybrid/res/TrayBtnBlue.bmp diff --git a/res/TrayBtnHomestead.bmp b/srchybrid/res/TrayBtnHomestead.bmp similarity index 100% rename from res/TrayBtnHomestead.bmp rename to srchybrid/res/TrayBtnHomestead.bmp diff --git a/res/TrayBtnMetallic.bmp b/srchybrid/res/TrayBtnMetallic.bmp similarity index 100% rename from res/TrayBtnMetallic.bmp rename to srchybrid/res/TrayBtnMetallic.bmp diff --git a/res/TrayConnected.ico b/srchybrid/res/TrayConnected.ico similarity index 100% rename from res/TrayConnected.ico rename to srchybrid/res/TrayConnected.ico diff --git a/res/TrayDisconnected.ico b/srchybrid/res/TrayDisconnected.ico similarity index 100% rename from res/TrayDisconnected.ico rename to srchybrid/res/TrayDisconnected.ico diff --git a/res/TrayLowID.ico b/srchybrid/res/TrayLowID.ico similarity index 100% rename from res/TrayLowID.ico rename to srchybrid/res/TrayLowID.ico diff --git a/res/Tweak.ico b/srchybrid/res/Tweak.ico similarity index 100% rename from res/Tweak.ico rename to srchybrid/res/Tweak.ico diff --git a/res/UPnP.ico b/srchybrid/res/UPnP.ico similarity index 100% rename from res/UPnP.ico rename to srchybrid/res/UPnP.ico diff --git a/res/Undo.ico b/srchybrid/res/Undo.ico similarity index 100% rename from res/Undo.ico rename to srchybrid/res/Undo.ico diff --git a/res/Up0down0.ico b/srchybrid/res/Up0down0.ico similarity index 100% rename from res/Up0down0.ico rename to srchybrid/res/Up0down0.ico diff --git a/res/Up0down1.ico b/srchybrid/res/Up0down1.ico similarity index 100% rename from res/Up0down1.ico rename to srchybrid/res/Up0down1.ico diff --git a/res/Up1down0.ico b/srchybrid/res/Up1down0.ico similarity index 100% rename from res/Up1down0.ico rename to srchybrid/res/Up1down0.ico diff --git a/res/Up1down1.ico b/srchybrid/res/Up1down1.ico similarity index 100% rename from res/Up1down1.ico rename to srchybrid/res/Up1down1.ico diff --git a/res/Update.ico b/srchybrid/res/Update.ico similarity index 100% rename from res/Update.ico rename to srchybrid/res/Update.ico diff --git a/res/Upload.gif b/srchybrid/res/Upload.gif similarity index 100% rename from res/Upload.gif rename to srchybrid/res/Upload.gif diff --git a/res/Upload.ico b/srchybrid/res/Upload.ico similarity index 100% rename from res/Upload.ico rename to srchybrid/res/Upload.ico diff --git a/res/User.ico b/srchybrid/res/User.ico similarity index 100% rename from res/User.ico rename to srchybrid/res/User.ico diff --git a/res/UserAdd.ico b/srchybrid/res/UserAdd.ico similarity index 100% rename from res/UserAdd.ico rename to srchybrid/res/UserAdd.ico diff --git a/res/UserDelete.ico b/srchybrid/res/UserDelete.ico similarity index 100% rename from res/UserDelete.ico rename to srchybrid/res/UserDelete.ico diff --git a/res/UserDetails.ico b/srchybrid/res/UserDetails.ico similarity index 100% rename from res/UserDetails.ico rename to srchybrid/res/UserDetails.ico diff --git a/res/UserFiles.ico b/srchybrid/res/UserFiles.ico similarity index 100% rename from res/UserFiles.ico rename to srchybrid/res/UserFiles.ico diff --git a/res/UserMessage.ico b/srchybrid/res/UserMessage.ico similarity index 100% rename from res/UserMessage.ico rename to srchybrid/res/UserMessage.ico diff --git a/res/Web.ico b/srchybrid/res/Web.ico similarity index 100% rename from res/Web.ico rename to srchybrid/res/Web.ico diff --git a/res/WideCharLowerMap.bin b/srchybrid/res/WideCharLowerMap.bin similarity index 100% rename from res/WideCharLowerMap.bin rename to srchybrid/res/WideCharLowerMap.bin diff --git a/res/Wizard.ico b/srchybrid/res/Wizard.ico similarity index 100% rename from res/Wizard.ico rename to srchybrid/res/Wizard.ico diff --git a/res/XP-Menu.JPG b/srchybrid/res/XP-Menu.JPG similarity index 100% rename from res/XP-Menu.JPG rename to srchybrid/res/XP-Menu.JPG diff --git a/res/Xray.ico b/srchybrid/res/Xray.ico similarity index 100% rename from res/Xray.ico rename to srchybrid/res/Xray.ico diff --git a/res/all.ico b/srchybrid/res/all.ico similarity index 100% rename from res/all.ico rename to srchybrid/res/all.ico diff --git a/res/banner_quer.jpg b/srchybrid/res/banner_quer.jpg similarity index 100% rename from res/banner_quer.jpg rename to srchybrid/res/banner_quer.jpg diff --git a/res/bold.ico b/srchybrid/res/bold.ico similarity index 100% rename from res/bold.ico rename to srchybrid/res/bold.ico diff --git a/res/boldFont.ico b/srchybrid/res/boldFont.ico similarity index 100% rename from res/boldFont.ico rename to srchybrid/res/boldFont.ico diff --git a/res/catPauseLast.ico b/srchybrid/res/catPauseLast.ico similarity index 100% rename from res/catPauseLast.ico rename to srchybrid/res/catPauseLast.ico diff --git a/res/catResumeNext.ico b/srchybrid/res/catResumeNext.ico similarity index 100% rename from res/catResumeNext.ico rename to srchybrid/res/catResumeNext.ico diff --git a/res/catStopLast.ico b/srchybrid/res/catStopLast.ico similarity index 100% rename from res/catStopLast.ico rename to srchybrid/res/catStopLast.ico diff --git a/res/catadd.ico b/srchybrid/res/catadd.ico similarity index 100% rename from res/catadd.ico rename to srchybrid/res/catadd.ico diff --git a/res/catedit.ico b/srchybrid/res/catedit.ico similarity index 100% rename from res/catedit.ico rename to srchybrid/res/catedit.ico diff --git a/res/catmerge.ico b/srchybrid/res/catmerge.ico similarity index 100% rename from res/catmerge.ico rename to srchybrid/res/catmerge.ico diff --git a/res/catremove.ico b/srchybrid/res/catremove.ico similarity index 100% rename from res/catremove.ico rename to srchybrid/res/catremove.ico diff --git a/res/clear1.ico b/srchybrid/res/clear1.ico similarity index 100% rename from res/clear1.ico rename to srchybrid/res/clear1.ico diff --git a/res/clear2.ico b/srchybrid/res/clear2.ico similarity index 100% rename from res/clear2.ico rename to srchybrid/res/clear2.ico diff --git a/res/clientml.ico b/srchybrid/res/clientml.ico similarity index 100% rename from res/clientml.ico rename to srchybrid/res/clientml.ico diff --git a/res/colour.ico b/srchybrid/res/colour.ico similarity index 100% rename from res/colour.ico rename to srchybrid/res/colour.ico diff --git a/res/eD2kLink.ico b/srchybrid/res/eD2kLink.ico similarity index 100% rename from res/eD2kLink.ico rename to srchybrid/res/eD2kLink.ico diff --git a/res/eD2kLinkPaste.ico b/srchybrid/res/eD2kLinkPaste.ico similarity index 100% rename from res/eD2kLinkPaste.ico rename to srchybrid/res/eD2kLinkPaste.ico diff --git a/res/emule.manifest b/srchybrid/res/emule.manifest similarity index 100% rename from res/emule.manifest rename to srchybrid/res/emule.manifest diff --git a/res/emule.rc2 b/srchybrid/res/emule.rc2 similarity index 100% rename from res/emule.rc2 rename to srchybrid/res/emule.rc2 diff --git a/res/emuleCollAdd.ico b/srchybrid/res/emuleCollAdd.ico similarity index 100% rename from res/emuleCollAdd.ico rename to srchybrid/res/emuleCollAdd.ico diff --git a/res/emuleCollEdit.ico b/srchybrid/res/emuleCollEdit.ico similarity index 100% rename from res/emuleCollEdit.ico rename to srchybrid/res/emuleCollEdit.ico diff --git a/res/emuleCollSearch.ico b/srchybrid/res/emuleCollSearch.ico similarity index 100% rename from res/emuleCollSearch.ico rename to srchybrid/res/emuleCollSearch.ico diff --git a/res/emuleCollView.ico b/srchybrid/res/emuleCollView.ico similarity index 100% rename from res/emuleCollView.ico rename to srchybrid/res/emuleCollView.ico diff --git a/res/emuleCollectionFileType.ico b/srchybrid/res/emuleCollectionFileType.ico similarity index 100% rename from res/emuleCollectionFileType.ico rename to srchybrid/res/emuleCollectionFileType.ico diff --git a/res/emulefuture.ico b/srchybrid/res/emulefuture.ico similarity index 100% rename from res/emulefuture.ico rename to srchybrid/res/emulefuture.ico diff --git a/res/fileimportparts.ico b/srchybrid/res/fileimportparts.ico similarity index 100% rename from res/fileimportparts.ico rename to srchybrid/res/fileimportparts.ico diff --git a/res/friends1slot.ICO b/srchybrid/res/friends1slot.ICO similarity index 100% rename from res/friends1slot.ICO rename to srchybrid/res/friends1slot.ICO diff --git a/res/friends2slot.ICO b/srchybrid/res/friends2slot.ICO similarity index 100% rename from res/friends2slot.ICO rename to srchybrid/res/friends2slot.ICO diff --git a/res/friends3slot.ICO b/srchybrid/res/friends3slot.ICO similarity index 100% rename from res/friends3slot.ICO rename to srchybrid/res/friends3slot.ICO diff --git a/res/iconstulle.ico b/srchybrid/res/iconstulle.ico similarity index 100% rename from res/iconstulle.ico rename to srchybrid/res/iconstulle.ico diff --git a/res/incomplete.ico b/srchybrid/res/incomplete.ico similarity index 100% rename from res/incomplete.ico rename to srchybrid/res/incomplete.ico diff --git a/res/italicFont.ico b/srchybrid/res/italicFont.ico similarity index 100% rename from res/italicFont.ico rename to srchybrid/res/italicFont.ico diff --git a/res/leecher.ICO b/srchybrid/res/leecher.ICO similarity index 100% rename from res/leecher.ICO rename to srchybrid/res/leecher.ICO diff --git a/res/mephisto.ico b/srchybrid/res/mephisto.ico similarity index 100% rename from res/mephisto.ico rename to srchybrid/res/mephisto.ico diff --git a/res/mule_wiz.gif b/srchybrid/res/mule_wiz.gif similarity index 100% rename from res/mule_wiz.gif rename to srchybrid/res/mule_wiz.gif diff --git a/res/mule_wiz_hdr.gif b/srchybrid/res/mule_wiz_hdr.gif similarity index 100% rename from res/mule_wiz_hdr.gif rename to srchybrid/res/mule_wiz_hdr.gif diff --git a/res/quickstart.ico b/srchybrid/res/quickstart.ico similarity index 100% rename from res/quickstart.ico rename to srchybrid/res/quickstart.ico diff --git a/res/resetformat.ico b/srchybrid/res/resetformat.ico similarity index 100% rename from res/resetformat.ico rename to srchybrid/res/resetformat.ico diff --git a/res/scar_inst_256.ico b/srchybrid/res/scar_inst_256.ico similarity index 100% rename from res/scar_inst_256.ico rename to srchybrid/res/scar_inst_256.ico diff --git a/res/sidebanner.jpg b/srchybrid/res/sidebanner.jpg similarity index 100% rename from res/sidebanner.jpg rename to srchybrid/res/sidebanner.jpg diff --git a/res/splash.bmp b/srchybrid/res/splash.bmp similarity index 100% rename from res/splash.bmp rename to srchybrid/res/splash.bmp diff --git a/res/startup.bmp b/srchybrid/res/startup.bmp similarity index 100% rename from res/startup.bmp rename to srchybrid/res/startup.bmp diff --git a/res/ulFont.ico b/srchybrid/res/ulFont.ico similarity index 100% rename from res/ulFont.ico rename to srchybrid/res/ulFont.ico diff --git a/res/underline.ico b/srchybrid/res/underline.ico similarity index 100% rename from res/underline.ico rename to srchybrid/res/underline.ico diff --git a/resource.h b/srchybrid/resource.h similarity index 100% rename from resource.h rename to srchybrid/resource.h diff --git a/sapi.h b/srchybrid/sapi.h similarity index 100% rename from sapi.h rename to srchybrid/sapi.h diff --git a/sapi.lib b/srchybrid/sapi.lib similarity index 100% rename from sapi.lib rename to srchybrid/sapi.lib diff --git a/server.cpp b/srchybrid/server.cpp similarity index 100% rename from server.cpp rename to srchybrid/server.cpp diff --git a/server.h b/srchybrid/server.h similarity index 100% rename from server.h rename to srchybrid/server.h diff --git a/sockets.cpp b/srchybrid/sockets.cpp similarity index 100% rename from sockets.cpp rename to srchybrid/sockets.cpp diff --git a/sockets.h b/srchybrid/sockets.h similarity index 100% rename from sockets.h rename to srchybrid/sockets.h diff --git a/stdafx.cpp b/srchybrid/stdafx.cpp similarity index 100% rename from stdafx.cpp rename to srchybrid/stdafx.cpp diff --git a/stdafx.h b/srchybrid/stdafx.h similarity index 98% rename from stdafx.h rename to srchybrid/stdafx.h index 77b4607..cf51dcf 100644 --- a/stdafx.h +++ b/srchybrid/stdafx.h @@ -292,6 +292,16 @@ #define _expand(p, s) _expand_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__) #define free(p) _free_dbg(p, _NORMAL_BLOCK) #define _msize(p) _msize_dbg(p, _NORMAL_BLOCK) +//stdĴdebugм +namespace std +{ + using ::_malloc_dbg; + using ::_calloc_dbg; + using ::_realloc_dbg; + using ::_expand_dbg; + using ::_free_dbg; + using ::_msize_dbg; +} #endif typedef CArray CStringAArray; diff --git a/tabctrl.cpp b/srchybrid/tabctrl.cpp similarity index 100% rename from tabctrl.cpp rename to srchybrid/tabctrl.cpp diff --git a/tabctrl.hpp b/srchybrid/tabctrl.hpp similarity index 100% rename from tabctrl.hpp rename to srchybrid/tabctrl.hpp diff --git a/types.h b/srchybrid/types.h similarity index 100% rename from types.h rename to srchybrid/types.h diff --git a/updownclient.h b/srchybrid/updownclient.h similarity index 100% rename from updownclient.h rename to srchybrid/updownclient.h diff --git a/upnplib/LICENSE b/srchybrid/upnplib/LICENSE similarity index 100% rename from upnplib/LICENSE rename to srchybrid/upnplib/LICENSE diff --git a/upnplib/README b/srchybrid/upnplib/README similarity index 100% rename from upnplib/README rename to srchybrid/upnplib/README diff --git a/upnplib/ixml/doc/docxx.sty b/srchybrid/upnplib/ixml/doc/docxx.sty similarity index 100% rename from upnplib/ixml/doc/docxx.sty rename to srchybrid/upnplib/ixml/doc/docxx.sty diff --git a/upnplib/ixml/doc/intro.dxx b/srchybrid/upnplib/ixml/doc/intro.dxx similarity index 100% rename from upnplib/ixml/doc/intro.dxx rename to srchybrid/upnplib/ixml/doc/intro.dxx diff --git a/upnplib/ixml/doc/ixml.dxx b/srchybrid/upnplib/ixml/doc/ixml.dxx similarity index 100% rename from upnplib/ixml/doc/ixml.dxx rename to srchybrid/upnplib/ixml/doc/ixml.dxx diff --git a/upnplib/ixml/doc/license.dxx b/srchybrid/upnplib/ixml/doc/license.dxx similarity index 100% rename from upnplib/ixml/doc/license.dxx rename to srchybrid/upnplib/ixml/doc/license.dxx diff --git a/upnplib/ixml/inc/ixml.h b/srchybrid/upnplib/ixml/inc/ixml.h similarity index 100% rename from upnplib/ixml/inc/ixml.h rename to srchybrid/upnplib/ixml/inc/ixml.h diff --git a/upnplib/ixml/src/attr.c b/srchybrid/upnplib/ixml/src/attr.c similarity index 100% rename from upnplib/ixml/src/attr.c rename to srchybrid/upnplib/ixml/src/attr.c diff --git a/upnplib/ixml/src/document.c b/srchybrid/upnplib/ixml/src/document.c similarity index 100% rename from upnplib/ixml/src/document.c rename to srchybrid/upnplib/ixml/src/document.c diff --git a/upnplib/ixml/src/element.c b/srchybrid/upnplib/ixml/src/element.c similarity index 100% rename from upnplib/ixml/src/element.c rename to srchybrid/upnplib/ixml/src/element.c diff --git a/upnplib/ixml/src/inc/ixmlmembuf.h b/srchybrid/upnplib/ixml/src/inc/ixmlmembuf.h similarity index 100% rename from upnplib/ixml/src/inc/ixmlmembuf.h rename to srchybrid/upnplib/ixml/src/inc/ixmlmembuf.h diff --git a/upnplib/ixml/src/inc/ixmlparser.h b/srchybrid/upnplib/ixml/src/inc/ixmlparser.h similarity index 100% rename from upnplib/ixml/src/inc/ixmlparser.h rename to srchybrid/upnplib/ixml/src/inc/ixmlparser.h diff --git a/upnplib/ixml/src/ixml.c b/srchybrid/upnplib/ixml/src/ixml.c similarity index 100% rename from upnplib/ixml/src/ixml.c rename to srchybrid/upnplib/ixml/src/ixml.c diff --git a/upnplib/ixml/src/ixmlmembuf.c b/srchybrid/upnplib/ixml/src/ixmlmembuf.c similarity index 100% rename from upnplib/ixml/src/ixmlmembuf.c rename to srchybrid/upnplib/ixml/src/ixmlmembuf.c diff --git a/upnplib/ixml/src/ixmlparser.c b/srchybrid/upnplib/ixml/src/ixmlparser.c similarity index 100% rename from upnplib/ixml/src/ixmlparser.c rename to srchybrid/upnplib/ixml/src/ixmlparser.c diff --git a/upnplib/ixml/src/namedNodeMap.c b/srchybrid/upnplib/ixml/src/namedNodeMap.c similarity index 100% rename from upnplib/ixml/src/namedNodeMap.c rename to srchybrid/upnplib/ixml/src/namedNodeMap.c diff --git a/upnplib/ixml/src/node.c b/srchybrid/upnplib/ixml/src/node.c similarity index 100% rename from upnplib/ixml/src/node.c rename to srchybrid/upnplib/ixml/src/node.c diff --git a/upnplib/ixml/src/nodeList.c b/srchybrid/upnplib/ixml/src/nodeList.c similarity index 100% rename from upnplib/ixml/src/nodeList.c rename to srchybrid/upnplib/ixml/src/nodeList.c diff --git a/upnplib/ixml/test/test_document.c b/srchybrid/upnplib/ixml/test/test_document.c similarity index 100% rename from upnplib/ixml/test/test_document.c rename to srchybrid/upnplib/ixml/test/test_document.c diff --git a/upnplib/ixml/test/test_document.sh b/srchybrid/upnplib/ixml/test/test_document.sh similarity index 100% rename from upnplib/ixml/test/test_document.sh rename to srchybrid/upnplib/ixml/test/test_document.sh diff --git a/upnplib/m4/acx_pthread.m4 b/srchybrid/upnplib/m4/acx_pthread.m4 similarity index 100% rename from upnplib/m4/acx_pthread.m4 rename to srchybrid/upnplib/m4/acx_pthread.m4 diff --git a/upnplib/m4/ax_cflags_gcc_option.m4 b/srchybrid/upnplib/m4/ax_cflags_gcc_option.m4 similarity index 100% rename from upnplib/m4/ax_cflags_gcc_option.m4 rename to srchybrid/upnplib/m4/ax_cflags_gcc_option.m4 diff --git a/upnplib/m4/ax_cflags_warn_all.m4 b/srchybrid/upnplib/m4/ax_cflags_warn_all.m4 similarity index 100% rename from upnplib/m4/ax_cflags_warn_all.m4 rename to srchybrid/upnplib/m4/ax_cflags_warn_all.m4 diff --git a/upnplib/m4/rt_bool_arg_enable.m4 b/srchybrid/upnplib/m4/rt_bool_arg_enable.m4 similarity index 100% rename from upnplib/m4/rt_bool_arg_enable.m4 rename to srchybrid/upnplib/m4/rt_bool_arg_enable.m4 diff --git a/upnplib/m4/type_socklen_t.m4 b/srchybrid/upnplib/m4/type_socklen_t.m4 similarity index 100% rename from upnplib/m4/type_socklen_t.m4 rename to srchybrid/upnplib/m4/type_socklen_t.m4 diff --git a/upnplib/threadutil/inc/FreeList.h b/srchybrid/upnplib/threadutil/inc/FreeList.h similarity index 100% rename from upnplib/threadutil/inc/FreeList.h rename to srchybrid/upnplib/threadutil/inc/FreeList.h diff --git a/upnplib/threadutil/inc/LinkedList.h b/srchybrid/upnplib/threadutil/inc/LinkedList.h similarity index 100% rename from upnplib/threadutil/inc/LinkedList.h rename to srchybrid/upnplib/threadutil/inc/LinkedList.h diff --git a/upnplib/threadutil/inc/ThreadPool.h b/srchybrid/upnplib/threadutil/inc/ThreadPool.h similarity index 100% rename from upnplib/threadutil/inc/ThreadPool.h rename to srchybrid/upnplib/threadutil/inc/ThreadPool.h diff --git a/upnplib/threadutil/inc/TimerThread.h b/srchybrid/upnplib/threadutil/inc/TimerThread.h similarity index 100% rename from upnplib/threadutil/inc/TimerThread.h rename to srchybrid/upnplib/threadutil/inc/TimerThread.h diff --git a/upnplib/threadutil/inc/iasnprintf.h b/srchybrid/upnplib/threadutil/inc/iasnprintf.h similarity index 100% rename from upnplib/threadutil/inc/iasnprintf.h rename to srchybrid/upnplib/threadutil/inc/iasnprintf.h diff --git a/upnplib/threadutil/inc/ithread.h b/srchybrid/upnplib/threadutil/inc/ithread.h similarity index 100% rename from upnplib/threadutil/inc/ithread.h rename to srchybrid/upnplib/threadutil/inc/ithread.h diff --git a/upnplib/threadutil/src/FreeList.c b/srchybrid/upnplib/threadutil/src/FreeList.c similarity index 100% rename from upnplib/threadutil/src/FreeList.c rename to srchybrid/upnplib/threadutil/src/FreeList.c diff --git a/upnplib/threadutil/src/LinkedList.c b/srchybrid/upnplib/threadutil/src/LinkedList.c similarity index 100% rename from upnplib/threadutil/src/LinkedList.c rename to srchybrid/upnplib/threadutil/src/LinkedList.c diff --git a/upnplib/threadutil/src/Makefile b/srchybrid/upnplib/threadutil/src/Makefile similarity index 100% rename from upnplib/threadutil/src/Makefile rename to srchybrid/upnplib/threadutil/src/Makefile diff --git a/upnplib/threadutil/src/ThreadPool.c b/srchybrid/upnplib/threadutil/src/ThreadPool.c similarity index 100% rename from upnplib/threadutil/src/ThreadPool.c rename to srchybrid/upnplib/threadutil/src/ThreadPool.c diff --git a/upnplib/threadutil/src/TimerThread.c b/srchybrid/upnplib/threadutil/src/TimerThread.c similarity index 100% rename from upnplib/threadutil/src/TimerThread.c rename to srchybrid/upnplib/threadutil/src/TimerThread.c diff --git a/upnplib/threadutil/src/iasnprintf.c b/srchybrid/upnplib/threadutil/src/iasnprintf.c similarity index 100% rename from upnplib/threadutil/src/iasnprintf.c rename to srchybrid/upnplib/threadutil/src/iasnprintf.c diff --git a/upnplib/upnp/LICENSE b/srchybrid/upnplib/upnp/LICENSE similarity index 100% rename from upnplib/upnp/LICENSE rename to srchybrid/upnplib/upnp/LICENSE diff --git a/upnplib/upnp/doc/UPnP_Programming_Guide.pdf b/srchybrid/upnplib/upnp/doc/UPnP_Programming_Guide.pdf similarity index 100% rename from upnplib/upnp/doc/UPnP_Programming_Guide.pdf rename to srchybrid/upnplib/upnp/doc/UPnP_Programming_Guide.pdf diff --git a/upnplib/upnp/doc/callback.dxx b/srchybrid/upnplib/upnp/doc/callback.dxx similarity index 100% rename from upnplib/upnp/doc/callback.dxx rename to srchybrid/upnplib/upnp/doc/callback.dxx diff --git a/upnplib/upnp/doc/docxx.sty b/srchybrid/upnplib/upnp/doc/docxx.sty similarity index 100% rename from upnplib/upnp/doc/docxx.sty rename to srchybrid/upnplib/upnp/doc/docxx.sty diff --git a/upnplib/upnp/doc/intro.dxx b/srchybrid/upnplib/upnp/doc/intro.dxx similarity index 100% rename from upnplib/upnp/doc/intro.dxx rename to srchybrid/upnplib/upnp/doc/intro.dxx diff --git a/upnplib/upnp/doc/license.dxx b/srchybrid/upnplib/upnp/doc/license.dxx similarity index 100% rename from upnplib/upnp/doc/license.dxx rename to srchybrid/upnplib/upnp/doc/license.dxx diff --git a/upnplib/upnp/doc/upnpsdk.dxx b/srchybrid/upnplib/upnp/doc/upnpsdk.dxx similarity index 100% rename from upnplib/upnp/doc/upnpsdk.dxx rename to srchybrid/upnplib/upnp/doc/upnpsdk.dxx diff --git a/upnplib/upnp/inc/config.h b/srchybrid/upnplib/upnp/inc/config.h similarity index 100% rename from upnplib/upnp/inc/config.h rename to srchybrid/upnplib/upnp/inc/config.h diff --git a/upnplib/upnp/inc/upnp.h b/srchybrid/upnplib/upnp/inc/upnp.h similarity index 100% rename from upnplib/upnp/inc/upnp.h rename to srchybrid/upnplib/upnp/inc/upnp.h diff --git a/upnplib/upnp/inc/upnpconfig.h.in b/srchybrid/upnplib/upnp/inc/upnpconfig.h.in similarity index 100% rename from upnplib/upnp/inc/upnpconfig.h.in rename to srchybrid/upnplib/upnp/inc/upnpconfig.h.in diff --git a/upnplib/upnp/inc/upnpdebug.h b/srchybrid/upnplib/upnp/inc/upnpdebug.h similarity index 100% rename from upnplib/upnp/inc/upnpdebug.h rename to srchybrid/upnplib/upnp/inc/upnpdebug.h diff --git a/upnplib/upnp/inc/upnptools.h b/srchybrid/upnplib/upnp/inc/upnptools.h similarity index 100% rename from upnplib/upnp/inc/upnptools.h rename to srchybrid/upnplib/upnp/inc/upnptools.h diff --git a/upnplib/upnp/src/api/config.c b/srchybrid/upnplib/upnp/src/api/config.c similarity index 100% rename from upnplib/upnp/src/api/config.c rename to srchybrid/upnplib/upnp/src/api/config.c diff --git a/upnplib/upnp/src/api/upnpapi.c b/srchybrid/upnplib/upnp/src/api/upnpapi.c similarity index 100% rename from upnplib/upnp/src/api/upnpapi.c rename to srchybrid/upnplib/upnp/src/api/upnpapi.c diff --git a/upnplib/upnp/src/api/upnpdebug.c b/srchybrid/upnplib/upnp/src/api/upnpdebug.c similarity index 100% rename from upnplib/upnp/src/api/upnpdebug.c rename to srchybrid/upnplib/upnp/src/api/upnpdebug.c diff --git a/upnplib/upnp/src/api/upnptools.c b/srchybrid/upnplib/upnp/src/api/upnptools.c similarity index 100% rename from upnplib/upnp/src/api/upnptools.c rename to srchybrid/upnplib/upnp/src/api/upnptools.c diff --git a/upnplib/upnp/src/gena/gena_callback2.c b/srchybrid/upnplib/upnp/src/gena/gena_callback2.c similarity index 100% rename from upnplib/upnp/src/gena/gena_callback2.c rename to srchybrid/upnplib/upnp/src/gena/gena_callback2.c diff --git a/upnplib/upnp/src/gena/gena_ctrlpt.c b/srchybrid/upnplib/upnp/src/gena/gena_ctrlpt.c similarity index 100% rename from upnplib/upnp/src/gena/gena_ctrlpt.c rename to srchybrid/upnplib/upnp/src/gena/gena_ctrlpt.c diff --git a/upnplib/upnp/src/gena/gena_device.c b/srchybrid/upnplib/upnp/src/gena/gena_device.c similarity index 100% rename from upnplib/upnp/src/gena/gena_device.c rename to srchybrid/upnplib/upnp/src/gena/gena_device.c diff --git a/upnplib/upnp/src/genlib/client_table/client_table.c b/srchybrid/upnplib/upnp/src/genlib/client_table/client_table.c similarity index 100% rename from upnplib/upnp/src/genlib/client_table/client_table.c rename to srchybrid/upnplib/upnp/src/genlib/client_table/client_table.c diff --git a/upnplib/upnp/src/genlib/miniserver/miniserver.c b/srchybrid/upnplib/upnp/src/genlib/miniserver/miniserver.c similarity index 100% rename from upnplib/upnp/src/genlib/miniserver/miniserver.c rename to srchybrid/upnplib/upnp/src/genlib/miniserver/miniserver.c diff --git a/upnplib/upnp/src/genlib/net/http/httpparser.c b/srchybrid/upnplib/upnp/src/genlib/net/http/httpparser.c similarity index 100% rename from upnplib/upnp/src/genlib/net/http/httpparser.c rename to srchybrid/upnplib/upnp/src/genlib/net/http/httpparser.c diff --git a/upnplib/upnp/src/genlib/net/http/httpreadwrite.c b/srchybrid/upnplib/upnp/src/genlib/net/http/httpreadwrite.c similarity index 100% rename from upnplib/upnp/src/genlib/net/http/httpreadwrite.c rename to srchybrid/upnplib/upnp/src/genlib/net/http/httpreadwrite.c diff --git a/upnplib/upnp/src/genlib/net/http/parsetools.c b/srchybrid/upnplib/upnp/src/genlib/net/http/parsetools.c similarity index 100% rename from upnplib/upnp/src/genlib/net/http/parsetools.c rename to srchybrid/upnplib/upnp/src/genlib/net/http/parsetools.c diff --git a/upnplib/upnp/src/genlib/net/http/statcodes.c b/srchybrid/upnplib/upnp/src/genlib/net/http/statcodes.c similarity index 100% rename from upnplib/upnp/src/genlib/net/http/statcodes.c rename to srchybrid/upnplib/upnp/src/genlib/net/http/statcodes.c diff --git a/upnplib/upnp/src/genlib/net/http/webserver.c b/srchybrid/upnplib/upnp/src/genlib/net/http/webserver.c similarity index 100% rename from upnplib/upnp/src/genlib/net/http/webserver.c rename to srchybrid/upnplib/upnp/src/genlib/net/http/webserver.c diff --git a/upnplib/upnp/src/genlib/net/sock.c b/srchybrid/upnplib/upnp/src/genlib/net/sock.c similarity index 100% rename from upnplib/upnp/src/genlib/net/sock.c rename to srchybrid/upnplib/upnp/src/genlib/net/sock.c diff --git a/upnplib/upnp/src/genlib/net/uri/uri.c b/srchybrid/upnplib/upnp/src/genlib/net/uri/uri.c similarity index 100% rename from upnplib/upnp/src/genlib/net/uri/uri.c rename to srchybrid/upnplib/upnp/src/genlib/net/uri/uri.c diff --git a/upnplib/upnp/src/genlib/service_table/service_table.c b/srchybrid/upnplib/upnp/src/genlib/service_table/service_table.c similarity index 100% rename from upnplib/upnp/src/genlib/service_table/service_table.c rename to srchybrid/upnplib/upnp/src/genlib/service_table/service_table.c diff --git a/upnplib/upnp/src/genlib/util/membuffer.c b/srchybrid/upnplib/upnp/src/genlib/util/membuffer.c similarity index 100% rename from upnplib/upnp/src/genlib/util/membuffer.c rename to srchybrid/upnplib/upnp/src/genlib/util/membuffer.c diff --git a/upnplib/upnp/src/genlib/util/strintmap.c b/srchybrid/upnplib/upnp/src/genlib/util/strintmap.c similarity index 100% rename from upnplib/upnp/src/genlib/util/strintmap.c rename to srchybrid/upnplib/upnp/src/genlib/util/strintmap.c diff --git a/upnplib/upnp/src/genlib/util/upnp_timeout.c b/srchybrid/upnplib/upnp/src/genlib/util/upnp_timeout.c similarity index 100% rename from upnplib/upnp/src/genlib/util/upnp_timeout.c rename to srchybrid/upnplib/upnp/src/genlib/util/upnp_timeout.c diff --git a/upnplib/upnp/src/genlib/util/util.c b/srchybrid/upnplib/upnp/src/genlib/util/util.c similarity index 100% rename from upnplib/upnp/src/genlib/util/util.c rename to srchybrid/upnplib/upnp/src/genlib/util/util.c diff --git a/upnplib/upnp/src/inc/client_table.h b/srchybrid/upnplib/upnp/src/inc/client_table.h similarity index 100% rename from upnplib/upnp/src/inc/client_table.h rename to srchybrid/upnplib/upnp/src/inc/client_table.h diff --git a/upnplib/upnp/src/inc/gena.h b/srchybrid/upnplib/upnp/src/inc/gena.h similarity index 100% rename from upnplib/upnp/src/inc/gena.h rename to srchybrid/upnplib/upnp/src/inc/gena.h diff --git a/upnplib/upnp/src/inc/gena_ctrlpt.h b/srchybrid/upnplib/upnp/src/inc/gena_ctrlpt.h similarity index 100% rename from upnplib/upnp/src/inc/gena_ctrlpt.h rename to srchybrid/upnplib/upnp/src/inc/gena_ctrlpt.h diff --git a/upnplib/upnp/src/inc/gena_device.h b/srchybrid/upnplib/upnp/src/inc/gena_device.h similarity index 100% rename from upnplib/upnp/src/inc/gena_device.h rename to srchybrid/upnplib/upnp/src/inc/gena_device.h diff --git a/upnplib/upnp/src/inc/global.h b/srchybrid/upnplib/upnp/src/inc/global.h similarity index 100% rename from upnplib/upnp/src/inc/global.h rename to srchybrid/upnplib/upnp/src/inc/global.h diff --git a/upnplib/upnp/src/inc/gmtdate.h b/srchybrid/upnplib/upnp/src/inc/gmtdate.h similarity index 100% rename from upnplib/upnp/src/inc/gmtdate.h rename to srchybrid/upnplib/upnp/src/inc/gmtdate.h diff --git a/upnplib/upnp/src/inc/http_client.h b/srchybrid/upnplib/upnp/src/inc/http_client.h similarity index 100% rename from upnplib/upnp/src/inc/http_client.h rename to srchybrid/upnplib/upnp/src/inc/http_client.h diff --git a/upnplib/upnp/src/inc/httpparser.h b/srchybrid/upnplib/upnp/src/inc/httpparser.h similarity index 100% rename from upnplib/upnp/src/inc/httpparser.h rename to srchybrid/upnplib/upnp/src/inc/httpparser.h diff --git a/upnplib/upnp/src/inc/httpreadwrite.h b/srchybrid/upnplib/upnp/src/inc/httpreadwrite.h similarity index 100% rename from upnplib/upnp/src/inc/httpreadwrite.h rename to srchybrid/upnplib/upnp/src/inc/httpreadwrite.h diff --git a/upnplib/upnp/src/inc/inet_pton.h b/srchybrid/upnplib/upnp/src/inc/inet_pton.h similarity index 100% rename from upnplib/upnp/src/inc/inet_pton.h rename to srchybrid/upnplib/upnp/src/inc/inet_pton.h diff --git a/upnplib/upnp/src/inc/md5.h b/srchybrid/upnplib/upnp/src/inc/md5.h similarity index 100% rename from upnplib/upnp/src/inc/md5.h rename to srchybrid/upnplib/upnp/src/inc/md5.h diff --git a/upnplib/upnp/src/inc/membuffer.h b/srchybrid/upnplib/upnp/src/inc/membuffer.h similarity index 100% rename from upnplib/upnp/src/inc/membuffer.h rename to srchybrid/upnplib/upnp/src/inc/membuffer.h diff --git a/upnplib/upnp/src/inc/miniserver.h b/srchybrid/upnplib/upnp/src/inc/miniserver.h similarity index 100% rename from upnplib/upnp/src/inc/miniserver.h rename to srchybrid/upnplib/upnp/src/inc/miniserver.h diff --git a/upnplib/upnp/src/inc/netall.h b/srchybrid/upnplib/upnp/src/inc/netall.h similarity index 100% rename from upnplib/upnp/src/inc/netall.h rename to srchybrid/upnplib/upnp/src/inc/netall.h diff --git a/upnplib/upnp/src/inc/parsetools.h b/srchybrid/upnplib/upnp/src/inc/parsetools.h similarity index 100% rename from upnplib/upnp/src/inc/parsetools.h rename to srchybrid/upnplib/upnp/src/inc/parsetools.h diff --git a/upnplib/upnp/src/inc/readwrite.h b/srchybrid/upnplib/upnp/src/inc/readwrite.h similarity index 100% rename from upnplib/upnp/src/inc/readwrite.h rename to srchybrid/upnplib/upnp/src/inc/readwrite.h diff --git a/upnplib/upnp/src/inc/server.h b/srchybrid/upnplib/upnp/src/inc/server.h similarity index 100% rename from upnplib/upnp/src/inc/server.h rename to srchybrid/upnplib/upnp/src/inc/server.h diff --git a/upnplib/upnp/src/inc/service_table.h b/srchybrid/upnplib/upnp/src/inc/service_table.h similarity index 100% rename from upnplib/upnp/src/inc/service_table.h rename to srchybrid/upnplib/upnp/src/inc/service_table.h diff --git a/upnplib/upnp/src/inc/soaplib.h b/srchybrid/upnplib/upnp/src/inc/soaplib.h similarity index 100% rename from upnplib/upnp/src/inc/soaplib.h rename to srchybrid/upnplib/upnp/src/inc/soaplib.h diff --git a/upnplib/upnp/src/inc/sock.h b/srchybrid/upnplib/upnp/src/inc/sock.h similarity index 100% rename from upnplib/upnp/src/inc/sock.h rename to srchybrid/upnplib/upnp/src/inc/sock.h diff --git a/upnplib/upnp/src/inc/ssdplib.h b/srchybrid/upnplib/upnp/src/inc/ssdplib.h similarity index 100% rename from upnplib/upnp/src/inc/ssdplib.h rename to srchybrid/upnplib/upnp/src/inc/ssdplib.h diff --git a/upnplib/upnp/src/inc/statcodes.h b/srchybrid/upnplib/upnp/src/inc/statcodes.h similarity index 100% rename from upnplib/upnp/src/inc/statcodes.h rename to srchybrid/upnplib/upnp/src/inc/statcodes.h diff --git a/upnplib/upnp/src/inc/statuscodes.h b/srchybrid/upnplib/upnp/src/inc/statuscodes.h similarity index 100% rename from upnplib/upnp/src/inc/statuscodes.h rename to srchybrid/upnplib/upnp/src/inc/statuscodes.h diff --git a/upnplib/upnp/src/inc/strintmap.h b/srchybrid/upnplib/upnp/src/inc/strintmap.h similarity index 100% rename from upnplib/upnp/src/inc/strintmap.h rename to srchybrid/upnplib/upnp/src/inc/strintmap.h diff --git a/upnplib/upnp/src/inc/sysdep.h b/srchybrid/upnplib/upnp/src/inc/sysdep.h similarity index 100% rename from upnplib/upnp/src/inc/sysdep.h rename to srchybrid/upnplib/upnp/src/inc/sysdep.h diff --git a/upnplib/upnp/src/inc/unixutil.h b/srchybrid/upnplib/upnp/src/inc/unixutil.h similarity index 100% rename from upnplib/upnp/src/inc/unixutil.h rename to srchybrid/upnplib/upnp/src/inc/unixutil.h diff --git a/upnplib/upnp/src/inc/upnp_timeout.h b/srchybrid/upnplib/upnp/src/inc/upnp_timeout.h similarity index 100% rename from upnplib/upnp/src/inc/upnp_timeout.h rename to srchybrid/upnplib/upnp/src/inc/upnp_timeout.h diff --git a/upnplib/upnp/src/inc/upnpapi.h b/srchybrid/upnplib/upnp/src/inc/upnpapi.h similarity index 100% rename from upnplib/upnp/src/inc/upnpapi.h rename to srchybrid/upnplib/upnp/src/inc/upnpapi.h diff --git a/upnplib/upnp/src/inc/upnpclosesocket.h b/srchybrid/upnplib/upnp/src/inc/upnpclosesocket.h similarity index 100% rename from upnplib/upnp/src/inc/upnpclosesocket.h rename to srchybrid/upnplib/upnp/src/inc/upnpclosesocket.h diff --git a/upnplib/upnp/src/inc/uri.h b/srchybrid/upnplib/upnp/src/inc/uri.h similarity index 100% rename from upnplib/upnp/src/inc/uri.h rename to srchybrid/upnplib/upnp/src/inc/uri.h diff --git a/upnplib/upnp/src/inc/urlconfig.h b/srchybrid/upnplib/upnp/src/inc/urlconfig.h similarity index 100% rename from upnplib/upnp/src/inc/urlconfig.h rename to srchybrid/upnplib/upnp/src/inc/urlconfig.h diff --git a/upnplib/upnp/src/inc/util.h b/srchybrid/upnplib/upnp/src/inc/util.h similarity index 100% rename from upnplib/upnp/src/inc/util.h rename to srchybrid/upnplib/upnp/src/inc/util.h diff --git a/upnplib/upnp/src/inc/utilall.h b/srchybrid/upnplib/upnp/src/inc/utilall.h similarity index 100% rename from upnplib/upnp/src/inc/utilall.h rename to srchybrid/upnplib/upnp/src/inc/utilall.h diff --git a/upnplib/upnp/src/inc/uuid.h b/srchybrid/upnplib/upnp/src/inc/uuid.h similarity index 100% rename from upnplib/upnp/src/inc/uuid.h rename to srchybrid/upnplib/upnp/src/inc/uuid.h diff --git a/upnplib/upnp/src/inc/webserver.h b/srchybrid/upnplib/upnp/src/inc/webserver.h similarity index 100% rename from upnplib/upnp/src/inc/webserver.h rename to srchybrid/upnplib/upnp/src/inc/webserver.h diff --git a/upnplib/upnp/src/inet_pton.c b/srchybrid/upnplib/upnp/src/inet_pton.c similarity index 100% rename from upnplib/upnp/src/inet_pton.c rename to srchybrid/upnplib/upnp/src/inet_pton.c diff --git a/upnplib/upnp/src/soap/soap_common.c b/srchybrid/upnplib/upnp/src/soap/soap_common.c similarity index 100% rename from upnplib/upnp/src/soap/soap_common.c rename to srchybrid/upnplib/upnp/src/soap/soap_common.c diff --git a/upnplib/upnp/src/soap/soap_ctrlpt.c b/srchybrid/upnplib/upnp/src/soap/soap_ctrlpt.c similarity index 100% rename from upnplib/upnp/src/soap/soap_ctrlpt.c rename to srchybrid/upnplib/upnp/src/soap/soap_ctrlpt.c diff --git a/upnplib/upnp/src/soap/soap_device.c b/srchybrid/upnplib/upnp/src/soap/soap_device.c similarity index 100% rename from upnplib/upnp/src/soap/soap_device.c rename to srchybrid/upnplib/upnp/src/soap/soap_device.c diff --git a/upnplib/upnp/src/soap/soaplib.h b/srchybrid/upnplib/upnp/src/soap/soaplib.h similarity index 100% rename from upnplib/upnp/src/soap/soaplib.h rename to srchybrid/upnplib/upnp/src/soap/soaplib.h diff --git a/upnplib/upnp/src/ssdp/ssdp_ctrlpt.c b/srchybrid/upnplib/upnp/src/ssdp/ssdp_ctrlpt.c similarity index 100% rename from upnplib/upnp/src/ssdp/ssdp_ctrlpt.c rename to srchybrid/upnplib/upnp/src/ssdp/ssdp_ctrlpt.c diff --git a/upnplib/upnp/src/ssdp/ssdp_device.c b/srchybrid/upnplib/upnp/src/ssdp/ssdp_device.c similarity index 100% rename from upnplib/upnp/src/ssdp/ssdp_device.c rename to srchybrid/upnplib/upnp/src/ssdp/ssdp_device.c diff --git a/upnplib/upnp/src/ssdp/ssdp_server.c b/srchybrid/upnplib/upnp/src/ssdp/ssdp_server.c similarity index 100% rename from upnplib/upnp/src/ssdp/ssdp_server.c rename to srchybrid/upnplib/upnp/src/ssdp/ssdp_server.c diff --git a/upnplib/upnp/src/urlconfig/urlconfig.c b/srchybrid/upnplib/upnp/src/urlconfig/urlconfig.c similarity index 100% rename from upnplib/upnp/src/urlconfig/urlconfig.c rename to srchybrid/upnplib/upnp/src/urlconfig/urlconfig.c diff --git a/upnplib/upnp/src/uuid/md5.c b/srchybrid/upnplib/upnp/src/uuid/md5.c similarity index 100% rename from upnplib/upnp/src/uuid/md5.c rename to srchybrid/upnplib/upnp/src/uuid/md5.c diff --git a/upnplib/upnp/src/uuid/sysdep.c b/srchybrid/upnplib/upnp/src/uuid/sysdep.c similarity index 100% rename from upnplib/upnp/src/uuid/sysdep.c rename to srchybrid/upnplib/upnp/src/uuid/sysdep.c diff --git a/upnplib/upnp/src/uuid/uuid.c b/srchybrid/upnplib/upnp/src/uuid/uuid.c similarity index 100% rename from upnplib/upnp/src/uuid/uuid.c rename to srchybrid/upnplib/upnp/src/uuid/uuid.c diff --git a/upnplib/upnp/src/win_dll.c b/srchybrid/upnplib/upnp/src/win_dll.c similarity index 100% rename from upnplib/upnp/src/win_dll.c rename to srchybrid/upnplib/upnp/src/win_dll.c diff --git a/upnplib/win32project/StdAfx.cpp b/srchybrid/upnplib/win32project/StdAfx.cpp similarity index 100% rename from upnplib/win32project/StdAfx.cpp rename to srchybrid/upnplib/win32project/StdAfx.cpp diff --git a/upnplib/win32project/StdAfx.h b/srchybrid/upnplib/win32project/StdAfx.h similarity index 100% rename from upnplib/win32project/StdAfx.h rename to srchybrid/upnplib/win32project/StdAfx.h diff --git a/upnplib/win32project/upnpLib.cpp b/srchybrid/upnplib/win32project/upnpLib.cpp similarity index 100% rename from upnplib/win32project/upnpLib.cpp rename to srchybrid/upnplib/win32project/upnpLib.cpp diff --git a/upnplib/win32project/upnpLib.dsp b/srchybrid/upnplib/win32project/upnpLib.dsp similarity index 100% rename from upnplib/win32project/upnpLib.dsp rename to srchybrid/upnplib/win32project/upnpLib.dsp diff --git a/upnplib/win32project/upnpLib.dsw b/srchybrid/upnplib/win32project/upnpLib.dsw similarity index 100% rename from upnplib/win32project/upnpLib.dsw rename to srchybrid/upnplib/win32project/upnpLib.dsw diff --git a/upnplib/win32project/upnpLib.sln b/srchybrid/upnplib/win32project/upnpLib.sln similarity index 100% rename from upnplib/win32project/upnpLib.sln rename to srchybrid/upnplib/win32project/upnpLib.sln diff --git a/upnplib/win32project/upnpLib.vcproj b/srchybrid/upnplib/win32project/upnpLib.vcproj similarity index 100% rename from upnplib/win32project/upnpLib.vcproj rename to srchybrid/upnplib/win32project/upnpLib.vcproj diff --git a/upnplib/win32project/upnpLib100.vcxproj b/srchybrid/upnplib/win32project/upnpLib100.vcxproj similarity index 100% rename from upnplib/win32project/upnpLib100.vcxproj rename to srchybrid/upnplib/win32project/upnpLib100.vcxproj diff --git a/upnplib/win32project/upnpLib100.vcxproj.filters b/srchybrid/upnplib/win32project/upnpLib100.vcxproj.filters similarity index 100% rename from upnplib/win32project/upnpLib100.vcxproj.filters rename to srchybrid/upnplib/win32project/upnpLib100.vcxproj.filters diff --git a/upnplib/win32project/upnpLib80.vcproj b/srchybrid/upnplib/win32project/upnpLib80.vcproj similarity index 100% rename from upnplib/win32project/upnpLib80.vcproj rename to srchybrid/upnplib/win32project/upnpLib80.vcproj diff --git a/upnplib/win32project/upnpLib90.vcproj b/srchybrid/upnplib/win32project/upnpLib90.vcproj similarity index 100% rename from upnplib/win32project/upnpLib90.vcproj rename to srchybrid/upnplib/win32project/upnpLib90.vcproj diff --git a/vld.cpp b/srchybrid/vld.cpp similarity index 100% rename from vld.cpp rename to srchybrid/vld.cpp diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt new file mode 100644 index 0000000..a64fe0b --- /dev/null +++ b/zlib/CMakeLists.txt @@ -0,0 +1,190 @@ +cmake_minimum_required(VERSION 2.4.4) +set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) + +project(zlib C) + +if(NOT DEFINED BUILD_SHARED_LIBS) + option(BUILD_SHARED_LIBS "Build a shared library form of zlib" ON) +endif() + +include(CheckTypeSize) +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckCSourceCompiles) +enable_testing() + +check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(stddef.h HAVE_STDDEF_H) + +# +# Check to see if we have large file support +# +set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) +# We add these other definitions here because CheckTypeSize.cmake +# in CMake 2.4.x does not automatically do so and we want +# compatibility with CMake 2.4.x. +if(HAVE_SYS_TYPES_H) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) +endif() +if(HAVE_STDINT_H) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) +endif() +if(HAVE_STDDEF_H) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) +endif() +check_type_size(off64_t OFF64_T) +if(HAVE_OFF64_T) + add_definitions(-D_LARGEFILE64_SOURCE=1) +endif() +set(CMAKE_REQUIRED_DEFINITIONS) # clear variable + +# +# Check for fseeko +# +check_function_exists(fseeko HAVE_FSEEKO) +if(NOT HAVE_FSEEKO) + add_definitions(-DNO_FSEEKO) +endif() + +# +# Check for unistd.h +# +check_include_file(unistd.h Z_HAVE_UNISTD_H) + +if(MSVC) + set(CMAKE_DEBUG_POSTFIX "d") + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) +endif() + +if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) + # If we're doing an out of source build and the user has a zconf.h + # in their source tree... + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) + message(FATAL_ERROR + "You must remove ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h " + "from the source tree. This file is included with zlib " + "but CMake generates this file for you automatically " + "in the build directory.") + endif() +endif() + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein + ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + + +#============================================================================ +# zlib +#============================================================================ + +set(ZLIB_PUBLIC_HDRS + ${CMAKE_CURRENT_BINARY_DIR}/zconf.h + zlib.h +) +set(ZLIB_PRIVATE_HDRS + crc32.h + deflate.h + gzguts.h + inffast.h + inffixed.h + inflate.h + inftrees.h + trees.h + zutil.h +) +set(ZLIB_SRCS + adler32.c + compress.c + crc32.c + deflate.c + gzclose.c + gzlib.c + gzread.c + gzwrite.c + inflate.c + infback.c + inftrees.c + inffast.c + trees.c + uncompr.c + zutil.c + win32/zlib1.rc +) + +# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) +string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9A-Za-z.]+)\".*" + "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) + +if(MINGW) + # This gets us DLL resource information when compiling on MinGW. + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj + COMMAND windres.exe + -D GCC_WINDRES + -I ${CMAKE_CURRENT_SOURCE_DIR} + -I ${CMAKE_CURRENT_BINARY_DIR} + -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj + -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) + set(ZLIB_SRCS ${ZLIB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) +endif(MINGW) + +add_library(zlib ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) + +set_target_properties(zlib PROPERTIES SOVERSION 1) + +if(NOT CYGWIN) + # This property causes shared libraries on Linux to have the full version + # encoded into their final filename. We disable this on Cygwin because + # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll + # seems to be the default. + # + # This has no effect with MSVC, on that platform the version info for + # the DLL comes from the resource file win32/zlib1.rc + set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) +endif() + +if(UNIX) + # On unix-like platforms the library is almost always called libz + set_target_properties(zlib PROPERTIES OUTPUT_NAME z) +elseif(BUILD_SHARED_LIBS AND WIN32) + # Creates zlib1.dll when building shared library version + set_target_properties(zlib PROPERTIES SUFFIX "1.dll") +endif() + +if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) + install(TARGETS zlib + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib ) +endif() +if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) + install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION include) +endif() +if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) + install(FILES zlib.3 DESTINATION share/man/man3) +endif() + +#============================================================================ +# Example binaries +#============================================================================ + +add_executable(example example.c) +target_link_libraries(example zlib) +add_test(example example) + +add_executable(minigzip minigzip.c) +target_link_libraries(minigzip zlib) + +if(HAVE_OFF64_T) + add_executable(example64 example.c) + target_link_libraries(example64 zlib) + set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + add_test(example64 example64) + + add_executable(minigzip64 minigzip.c) + target_link_libraries(minigzip64 zlib) + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") +endif() diff --git a/zlib/ChangeLog b/zlib/ChangeLog new file mode 100644 index 0000000..f310bb0 --- /dev/null +++ b/zlib/ChangeLog @@ -0,0 +1,1208 @@ + + ChangeLog file for zlib + +Changes in 1.2.5 (19 Apr 2010) +- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev] +- Default to libdir as sharedlibdir in configure [Nieder] +- Update copyright dates on modified source files +- Update trees.c to be able to generate modified trees.h +- Exit configure for MinGW, suggesting win32/Makefile.gcc + +Changes in 1.2.4.5 (18 Apr 2010) +- Set sharedlibdir in configure [Torok] +- Set LDFLAGS in Makefile.in [Bar-Lev] +- Avoid mkdir objs race condition in Makefile.in [Bowler] +- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays +- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C +- Don't use hidden attribute when it is a warning generator (e.g. Solaris) + +Changes in 1.2.4.4 (18 Apr 2010) +- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok] +- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty +- Try to use bash or ksh regardless of functionality of /bin/sh +- Fix configure incompatibility with NetBSD sh +- Remove attempt to run under bash or ksh since have better NetBSD fix +- Fix win32/Makefile.gcc for MinGW [Bar-Lev] +- Add diagnostic messages when using CROSS_PREFIX in configure +- Added --sharedlibdir option to configure [Weigelt] +- Use hidden visibility attribute when available [Frysinger] + +Changes in 1.2.4.3 (10 Apr 2010) +- Only use CROSS_PREFIX in configure for ar and ranlib if they exist +- Use CROSS_PREFIX for nm [Bar-Lev] +- Assume _LARGEFILE64_SOURCE defined is equivalent to true +- Avoid use of undefined symbols in #if with && and || +- Make *64 prototypes in gzguts.h consistent with functions +- Add -shared load option for MinGW in configure [Bowler] +- Move z_off64_t to public interface, use instead of off64_t +- Remove ! from shell test in configure (not portable to Solaris) +- Change +0 macro tests to -0 for possibly increased portability + +Changes in 1.2.4.2 (9 Apr 2010) +- Add consistent carriage returns to readme.txt's in masmx86 and masmx64 +- Really provide prototypes for *64 functions when building without LFS +- Only define unlink() in minigzip.c if unistd.h not included +- Update README to point to contrib/vstudio project files +- Move projects/vc6 to old/ and remove projects/ +- Include stdlib.h in minigzip.c for setmode() definition under WinCE +- Clean up assembler builds in win32/Makefile.msc [Rowe] +- Include sys/types.h for Microsoft for off_t definition +- Fix memory leak on error in gz_open() +- Symbolize nm as $NM in configure [Weigelt] +- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt] +- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined +- Fix bug in gzeof() to take into account unused input data +- Avoid initialization of structures with variables in puff.c +- Updated win32/README-WIN32.txt [Rowe] + +Changes in 1.2.4.1 (28 Mar 2010) +- Remove the use of [a-z] constructs for sed in configure [gentoo 310225] +- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech] +- Restore "for debugging" comment on sprintf() in gzlib.c +- Remove fdopen for MVS from gzguts.h +- Put new README-WIN32.txt in win32 [Rowe] +- Add check for shell to configure and invoke another shell if needed +- Fix big fat stinking bug in gzseek() on uncompressed files +- Remove vestigial F_OPEN64 define in zutil.h +- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE +- Avoid errors on non-LFS systems when applications define LFS macros +- Set EXE to ".exe" in configure for MINGW [Kahle] +- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill] +- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev] +- Add DLL install in win32/makefile.gcc [Bar-Lev] +- Allow Linux* or linux* from uname in configure [Bar-Lev] +- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev] +- Add cross-compilation prefixes to configure [Bar-Lev] +- Match type exactly in gz_load() invocation in gzread.c +- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func +- Provide prototypes for *64 functions when building zlib without LFS +- Don't use -lc when linking shared library on MinGW +- Remove errno.h check in configure and vestigial errno code in zutil.h + +Changes in 1.2.4 (14 Mar 2010) +- Fix VER3 extraction in configure for no fourth subversion +- Update zlib.3, add docs to Makefile.in to make .pdf out of it +- Add zlib.3.pdf to distribution +- Don't set error code in gzerror() if passed pointer is NULL +- Apply destination directory fixes to CMakeLists.txt [Lowman] +- Move #cmakedefine's to a new zconf.in.cmakein +- Restore zconf.h for builds that don't use configure or cmake +- Add distclean to dummy Makefile for convenience +- Update and improve INDEX, README, and FAQ +- Update CMakeLists.txt for the return of zconf.h [Lowman] +- Update contrib/vstudio/vc9 and vc10 [Vollant] +- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc +- Apply license and readme changes to contrib/asm686 [Raiter] +- Check file name lengths and add -c option in minigzip.c [Li] +- Update contrib/amd64 and contrib/masmx86/ [Vollant] +- Avoid use of "eof" parameter in trees.c to not shadow library variable +- Update make_vms.com for removal of zlibdefs.h [Zinser] +- Update assembler code and vstudio projects in contrib [Vollant] +- Remove outdated assembler code contrib/masm686 and contrib/asm586 +- Remove old vc7 and vc8 from contrib/vstudio +- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe] +- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open() +- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant] +- Remove *64 functions from win32/zlib.def (they're not 64-bit yet) +- Fix bug in void-returning vsprintf() case in gzwrite.c +- Fix name change from inflate.h in contrib/inflate86/inffas86.c +- Check if temporary file exists before removing in make_vms.com [Zinser] +- Fix make install and uninstall for --static option +- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta] +- Update readme.txt in contrib/masmx64 and masmx86 to assemble + +Changes in 1.2.3.9 (21 Feb 2010) +- Expunge gzio.c +- Move as400 build information to old +- Fix updates in contrib/minizip and contrib/vstudio +- Add const to vsnprintf test in configure to avoid warnings [Weigelt] +- Delete zconf.h (made by configure) [Weigelt] +- Change zconf.in.h to zconf.h.in per convention [Weigelt] +- Check for NULL buf in gzgets() +- Return empty string for gzgets() with len == 1 (like fgets()) +- Fix description of gzgets() in zlib.h for end-of-file, NULL return +- Update minizip to 1.1 [Vollant] +- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c +- Note in zlib.h that gzerror() should be used to distinguish from EOF +- Remove use of snprintf() from gzlib.c +- Fix bug in gzseek() +- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant] +- Fix zconf.h generation in CMakeLists.txt [Lowman] +- Improve comments in zconf.h where modified by configure + +Changes in 1.2.3.8 (13 Feb 2010) +- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer] +- Use z_off64_t in gz_zero() and gz_skip() to match state->skip +- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t) +- Revert to Makefile.in from 1.2.3.6 (live with the clutter) +- Fix missing error return in gzflush(), add zlib.h note +- Add *64 functions to zlib.map [Levin] +- Fix signed/unsigned comparison in gz_comp() +- Use SFLAGS when testing shared linking in configure +- Add --64 option to ./configure to use -m64 with gcc +- Fix ./configure --help to correctly name options +- Have make fail if a test fails [Levin] +- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson] +- Remove assembler object files from contrib + +Changes in 1.2.3.7 (24 Jan 2010) +- Always gzopen() with O_LARGEFILE if available +- Fix gzdirect() to work immediately after gzopen() or gzdopen() +- Make gzdirect() more precise when the state changes while reading +- Improve zlib.h documentation in many places +- Catch memory allocation failure in gz_open() +- Complete close operation if seek forward in gzclose_w() fails +- Return Z_ERRNO from gzclose_r() if close() fails +- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL +- Return zero for gzwrite() errors to match zlib.h description +- Return -1 on gzputs() error to match zlib.h description +- Add zconf.in.h to allow recovery from configure modification [Weigelt] +- Fix static library permissions in Makefile.in [Weigelt] +- Avoid warnings in configure tests that hide functionality [Weigelt] +- Add *BSD and DragonFly to Linux case in configure [gentoo 123571] +- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212] +- Avoid access of uninitialized data for first inflateReset2 call [Gomes] +- Keep object files in subdirectories to reduce the clutter somewhat +- Remove default Makefile and zlibdefs.h, add dummy Makefile +- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_ +- Remove zlibdefs.h completely -- modify zconf.h instead + +Changes in 1.2.3.6 (17 Jan 2010) +- Avoid void * arithmetic in gzread.c and gzwrite.c +- Make compilers happier with const char * for gz_error message +- Avoid unused parameter warning in inflate.c +- Avoid signed-unsigned comparison warning in inflate.c +- Indent #pragma's for traditional C +- Fix usage of strwinerror() in glib.c, change to gz_strwinerror() +- Correct email address in configure for system options +- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser] +- Update zlib.map [Brown] +- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok] +- Apply various fixes to CMakeLists.txt [Lowman] +- Add checks on len in gzread() and gzwrite() +- Add error message for no more room for gzungetc() +- Remove zlib version check in gzwrite() +- Defer compression of gzprintf() result until need to +- Use snprintf() in gzdopen() if available +- Remove USE_MMAP configuration determination (only used by minigzip) +- Remove examples/pigz.c (available separately) +- Update examples/gun.c to 1.6 + +Changes in 1.2.3.5 (8 Jan 2010) +- Add space after #if in zutil.h for some compilers +- Fix relatively harmless bug in deflate_fast() [Exarevsky] +- Fix same problem in deflate_slow() +- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown] +- Add deflate_rle() for faster Z_RLE strategy run-length encoding +- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding +- Change name of "write" variable in inffast.c to avoid library collisions +- Fix premature EOF from gzread() in gzio.c [Brown] +- Use zlib header window size if windowBits is 0 in inflateInit2() +- Remove compressBound() call in deflate.c to avoid linking compress.o +- Replace use of errno in gz* with functions, support WinCE [Alves] +- Provide alternative to perror() in minigzip.c for WinCE [Alves] +- Don't use _vsnprintf on later versions of MSVC [Lowman] +- Add CMake build script and input file [Lowman] +- Update contrib/minizip to 1.1 [Svensson, Vollant] +- Moved nintendods directory from contrib to . +- Replace gzio.c with a new set of routines with the same functionality +- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above +- Update contrib/minizip to 1.1b +- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h + +Changes in 1.2.3.4 (21 Dec 2009) +- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility +- Update comments in configure and Makefile.in for default --shared +- Fix test -z's in configure [Marquess] +- Build examplesh and minigzipsh when not testing +- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h +- Import LDFLAGS from the environment in configure +- Fix configure to populate SFLAGS with discovered CFLAGS options +- Adapt make_vms.com to the new Makefile.in [Zinser] +- Add zlib2ansi script for C++ compilation [Marquess] +- Add _FILE_OFFSET_BITS=64 test to make test (when applicable) +- Add AMD64 assembler code for longest match to contrib [Teterin] +- Include options from $SFLAGS when doing $LDSHARED +- Simplify 64-bit file support by introducing z_off64_t type +- Make shared object files in objs directory to work around old Sun cc +- Use only three-part version number for Darwin shared compiles +- Add rc option to ar in Makefile.in for when ./configure not run +- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4* +- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile +- Protect against _FILE_OFFSET_BITS being defined when compiling zlib +- Rename Makefile.in targets allstatic to static and allshared to shared +- Fix static and shared Makefile.in targets to be independent +- Correct error return bug in gz_open() by setting state [Brown] +- Put spaces before ;;'s in configure for better sh compatibility +- Add pigz.c (parallel implementation of gzip) to examples/ +- Correct constant in crc32.c to UL [Leventhal] +- Reject negative lengths in crc32_combine() +- Add inflateReset2() function to work like inflateEnd()/inflateInit2() +- Include sys/types.h for _LARGEFILE64_SOURCE [Brown] +- Correct typo in doc/algorithm.txt [Janik] +- Fix bug in adler32_combine() [Zhu] +- Catch missing-end-of-block-code error in all inflates and in puff + Assures that random input to inflate eventually results in an error +- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/ +- Update ENOUGH and its usage to reflect discovered bounds +- Fix gzerror() error report on empty input file [Brown] +- Add ush casts in trees.c to avoid pedantic runtime errors +- Fix typo in zlib.h uncompress() description [Reiss] +- Correct inflate() comments with regard to automatic header detection +- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays) +- Put new version of gzlog (2.0) in examples with interruption recovery +- Add puff compile option to permit invalid distance-too-far streams +- Add puff TEST command options, ability to read piped input +- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but + _LARGEFILE64_SOURCE not defined +- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart +- Fix deflateSetDictionary() to use all 32K for output consistency +- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h) +- Clear bytes after deflate lookahead to avoid use of uninitialized data +- Change a limit in inftrees.c to be more transparent to Coverity Prevent +- Update win32/zlib.def with exported symbols from zlib.h +- Correct spelling error in zlib.h [Willem] +- Allow Z_BLOCK for deflate() to force a new block +- Allow negative bits in inflatePrime() to delete existing bit buffer +- Add Z_TREES flush option to inflate() to return at end of trees +- Add inflateMark() to return current state information for random access +- Add Makefile for NintendoDS to contrib [Costa] +- Add -w in configure compile tests to avoid spurious warnings [Beucler] +- Fix typos in zlib.h comments for deflateSetDictionary() +- Fix EOF detection in transparent gzread() [Maier] + +Changes in 1.2.3.3 (2 October 2006) +- Make --shared the default for configure, add a --static option +- Add compile option to permit invalid distance-too-far streams +- Add inflateUndermine() function which is required to enable above +- Remove use of "this" variable name for C++ compatibility [Marquess] +- Add testing of shared library in make test, if shared library built +- Use ftello() and fseeko() if available instead of ftell() and fseek() +- Provide two versions of all functions that use the z_off_t type for + binary compatibility -- a normal version and a 64-bit offset version, + per the Large File Support Extension when _LARGEFILE64_SOURCE is + defined; use the 64-bit versions by default when _FILE_OFFSET_BITS + is defined to be 64 +- Add a --uname= option to configure to perhaps help with cross-compiling + +Changes in 1.2.3.2 (3 September 2006) +- Turn off silly Borland warnings [Hay] +- Use off64_t and define _LARGEFILE64_SOURCE when present +- Fix missing dependency on inffixed.h in Makefile.in +- Rig configure --shared to build both shared and static [Teredesai, Truta] +- Remove zconf.in.h and instead create a new zlibdefs.h file +- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant] +- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt] + +Changes in 1.2.3.1 (16 August 2006) +- Add watcom directory with OpenWatcom make files [Daniel] +- Remove #undef of FAR in zconf.in.h for MVS [Fedtke] +- Update make_vms.com [Zinser] +- Use -fPIC for shared build in configure [Teredesai, Nicholson] +- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen] +- Use fdopen() (not _fdopen()) for Interix in zutil.h [Bck] +- Add some FAQ entries about the contrib directory +- Update the MVS question in the FAQ +- Avoid extraneous reads after EOF in gzio.c [Brown] +- Correct spelling of "successfully" in gzio.c [Randers-Pehrson] +- Add comments to zlib.h about gzerror() usage [Brown] +- Set extra flags in gzip header in gzopen() like deflate() does +- Make configure options more compatible with double-dash conventions + [Weigelt] +- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen] +- Fix uninstall target in Makefile.in [Truta] +- Add pkgconfig support [Weigelt] +- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt] +- Replace set_data_type() with a more accurate detect_data_type() in + trees.c, according to the txtvsbin.txt document [Truta] +- Swap the order of #include and #include "zlib.h" in + gzio.c, example.c and minigzip.c [Truta] +- Shut up annoying VS2005 warnings about standard C deprecation [Rowe, + Truta] (where?) +- Fix target "clean" from win32/Makefile.bor [Truta] +- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe] +- Update zlib www home address in win32/DLL_FAQ.txt [Truta] +- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove] +- Enable browse info in the "Debug" and "ASM Debug" configurations in + the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta] +- Add pkgconfig support [Weigelt] +- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h, + for use in win32/zlib1.rc [Polushin, Rowe, Truta] +- Add a document that explains the new text detection scheme to + doc/txtvsbin.txt [Truta] +- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta] +- Move algorithm.txt into doc/ [Truta] +- Synchronize FAQ with website +- Fix compressBound(), was low for some pathological cases [Fearnley] +- Take into account wrapper variations in deflateBound() +- Set examples/zpipe.c input and output to binary mode for Windows +- Update examples/zlib_how.html with new zpipe.c (also web site) +- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems + that gcc became pickier in 4.0) +- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain + un-versioned, the patch adds versioning only for symbols introduced in + zlib-1.2.0 or later. It also declares as local those symbols which are + not designed to be exported." [Levin] +- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure +- Do not initialize global static by default in trees.c, add a response + NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess] +- Don't use strerror() in gzio.c under WinCE [Yakimov] +- Don't use errno.h in zutil.h under WinCE [Yakimov] +- Move arguments for AR to its usage to allow replacing ar [Marot] +- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson] +- Improve inflateInit() and inflateInit2() documentation +- Fix structure size comment in inflate.h +- Change configure help option from --h* to --help [Santos] + +Changes in 1.2.3 (18 July 2005) +- Apply security vulnerability fixes to contrib/infback9 as well +- Clean up some text files (carriage returns, trailing space) +- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] + +Changes in 1.2.2.4 (11 July 2005) +- Add inflatePrime() function for starting inflation at bit boundary +- Avoid some Visual C warnings in deflate.c +- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit + compile +- Fix some spelling errors in comments [Betts] +- Correct inflateInit2() error return documentation in zlib.h +- Add zran.c example of compressed data random access to examples + directory, shows use of inflatePrime() +- Fix cast for assignments to strm->state in inflate.c and infback.c +- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] +- Move declarations of gf2 functions to right place in crc32.c [Oberhumer] +- Add cast in trees.c t avoid a warning [Oberhumer] +- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] +- Update make_vms.com [Zinser] +- Initialize state->write in inflateReset() since copied in inflate_fast() +- Be more strict on incomplete code sets in inflate_table() and increase + ENOUGH and MAXD -- this repairs a possible security vulnerability for + invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for + discovering the vulnerability and providing test cases. +- Add ia64 support to configure for HP-UX [Smith] +- Add error return to gzread() for format or i/o error [Levin] +- Use malloc.h for OS/2 [Necasek] + +Changes in 1.2.2.3 (27 May 2005) +- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile +- Typecast fread() return values in gzio.c [Vollant] +- Remove trailing space in minigzip.c outmode (VC++ can't deal with it) +- Fix crc check bug in gzread() after gzungetc() [Heiner] +- Add the deflateTune() function to adjust internal compression parameters +- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) +- Remove an incorrect assertion in examples/zpipe.c +- Add C++ wrapper in infback9.h [Donais] +- Fix bug in inflateCopy() when decoding fixed codes +- Note in zlib.h how much deflateSetDictionary() actually uses +- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) +- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] +- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] +- Add gzdirect() function to indicate transparent reads +- Update contrib/minizip [Vollant] +- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] +- Add casts in crc32.c to avoid warnings [Oberhumer] +- Add contrib/masmx64 [Vollant] +- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] + +Changes in 1.2.2.2 (30 December 2004) +- Replace structure assignments in deflate.c and inflate.c with zmemcpy to + avoid implicit memcpy calls (portability for no-library compilation) +- Increase sprintf() buffer size in gzdopen() to allow for large numbers +- Add INFLATE_STRICT to check distances against zlib header +- Improve WinCE errno handling and comments [Chang] +- Remove comment about no gzip header processing in FAQ +- Add Z_FIXED strategy option to deflateInit2() to force fixed trees +- Add updated make_vms.com [Coghlan], update README +- Create a new "examples" directory, move gzappend.c there, add zpipe.c, + fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. +- Add FAQ entry and comments in deflate.c on uninitialized memory access +- Add Solaris 9 make options in configure [Gilbert] +- Allow strerror() usage in gzio.c for STDC +- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] +- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] +- Use z_off_t for adler32_combine() and crc32_combine() lengths +- Make adler32() much faster for small len +- Use OS_CODE in deflate() default gzip header + +Changes in 1.2.2.1 (31 October 2004) +- Allow inflateSetDictionary() call for raw inflate +- Fix inflate header crc check bug for file names and comments +- Add deflateSetHeader() and gz_header structure for custom gzip headers +- Add inflateGetheader() to retrieve gzip headers +- Add crc32_combine() and adler32_combine() functions +- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list +- Use zstreamp consistently in zlib.h (inflate_back functions) +- Remove GUNZIP condition from definition of inflate_mode in inflate.h + and in contrib/inflate86/inffast.S [Truta, Anderson] +- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] +- Update projects/README.projects and projects/visualc6 [Truta] +- Update win32/DLL_FAQ.txt [Truta] +- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] +- Deprecate Z_ASCII; use Z_TEXT instead [Truta] +- Use a new algorithm for setting strm->data_type in trees.c [Truta] +- Do not define an exit() prototype in zutil.c unless DEBUG defined +- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] +- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() +- Fix Darwin build version identification [Peterson] + +Changes in 1.2.2 (3 October 2004) +- Update zlib.h comments on gzip in-memory processing +- Set adler to 1 in inflateReset() to support Java test suite [Walles] +- Add contrib/dotzlib [Ravn] +- Update win32/DLL_FAQ.txt [Truta] +- Update contrib/minizip [Vollant] +- Move contrib/visual-basic.txt to old/ [Truta] +- Fix assembler builds in projects/visualc6/ [Truta] + +Changes in 1.2.1.2 (9 September 2004) +- Update INDEX file +- Fix trees.c to update strm->data_type (no one ever noticed!) +- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] +- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) +- Add limited multitasking protection to DYNAMIC_CRC_TABLE +- Add NO_vsnprintf for VMS in zutil.h [Mozilla] +- Don't declare strerror() under VMS [Mozilla] +- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize +- Update contrib/ada [Anisimkov] +- Update contrib/minizip [Vollant] +- Fix configure to not hardcode directories for Darwin [Peterson] +- Fix gzio.c to not return error on empty files [Brown] +- Fix indentation; update version in contrib/delphi/ZLib.pas and + contrib/pascal/zlibpas.pas [Truta] +- Update mkasm.bat in contrib/masmx86 [Truta] +- Update contrib/untgz [Truta] +- Add projects/README.projects [Truta] +- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] +- Update win32/DLL_FAQ.txt [Truta] +- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] +- Remove an unnecessary assignment to curr in inftrees.c [Truta] +- Add OS/2 to exe builds in configure [Poltorak] +- Remove err dummy parameter in zlib.h [Kientzle] + +Changes in 1.2.1.1 (9 January 2004) +- Update email address in README +- Several FAQ updates +- Fix a big fat bug in inftrees.c that prevented decoding valid + dynamic blocks with only literals and no distance codes -- + Thanks to "Hot Emu" for the bug report and sample file +- Add a note to puff.c on no distance codes case. + +Changes in 1.2.1 (17 November 2003) +- Remove a tab in contrib/gzappend/gzappend.c +- Update some interfaces in contrib for new zlib functions +- Update zlib version number in some contrib entries +- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] +- Support shared libraries on Hurd and KFreeBSD [Brown] +- Fix error in NO_DIVIDE option of adler32.c + +Changes in 1.2.0.8 (4 November 2003) +- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas +- Add experimental NO_DIVIDE #define in adler32.c + - Possibly faster on some processors (let me know if it is) +- Correct Z_BLOCK to not return on first inflate call if no wrap +- Fix strm->data_type on inflate() return to correctly indicate EOB +- Add deflatePrime() function for appending in the middle of a byte +- Add contrib/gzappend for an example of appending to a stream +- Update win32/DLL_FAQ.txt [Truta] +- Delete Turbo C comment in README [Truta] +- Improve some indentation in zconf.h [Truta] +- Fix infinite loop on bad input in configure script [Church] +- Fix gzeof() for concatenated gzip files [Johnson] +- Add example to contrib/visual-basic.txt [Michael B.] +- Add -p to mkdir's in Makefile.in [vda] +- Fix configure to properly detect presence or lack of printf functions +- Add AS400 support [Monnerat] +- Add a little Cygwin support [Wilson] + +Changes in 1.2.0.7 (21 September 2003) +- Correct some debug formats in contrib/infback9 +- Cast a type in a debug statement in trees.c +- Change search and replace delimiter in configure from % to # [Beebe] +- Update contrib/untgz to 0.2 with various fixes [Truta] +- Add build support for Amiga [Nikl] +- Remove some directories in old that have been updated to 1.2 +- Add dylib building for Mac OS X in configure and Makefile.in +- Remove old distribution stuff from Makefile +- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X +- Update links in README + +Changes in 1.2.0.6 (13 September 2003) +- Minor FAQ updates +- Update contrib/minizip to 1.00 [Vollant] +- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] +- Update POSTINC comment for 68060 [Nikl] +- Add contrib/infback9 with deflate64 decoding (unsupported) +- For MVS define NO_vsnprintf and undefine FAR [van Burik] +- Add pragma for fdopen on MVS [van Burik] + +Changes in 1.2.0.5 (8 September 2003) +- Add OF to inflateBackEnd() declaration in zlib.h +- Remember start when using gzdopen in the middle of a file +- Use internal off_t counters in gz* functions to properly handle seeks +- Perform more rigorous check for distance-too-far in inffast.c +- Add Z_BLOCK flush option to return from inflate at block boundary +- Set strm->data_type on return from inflate + - Indicate bits unused, if at block boundary, and if in last block +- Replace size_t with ptrdiff_t in crc32.c, and check for correct size +- Add condition so old NO_DEFLATE define still works for compatibility +- FAQ update regarding the Windows DLL [Truta] +- INDEX update: add qnx entry, remove aix entry [Truta] +- Install zlib.3 into mandir [Wilson] +- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] +- Adapt the zlib interface to the new DLL convention guidelines [Truta] +- Introduce ZLIB_WINAPI macro to allow the export of functions using + the WINAPI calling convention, for Visual Basic [Vollant, Truta] +- Update msdos and win32 scripts and makefiles [Truta] +- Export symbols by name, not by ordinal, in win32/zlib.def [Truta] +- Add contrib/ada [Anisimkov] +- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] +- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] +- Add contrib/masm686 [Truta] +- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm + [Truta, Vollant] +- Update contrib/delphi; rename to contrib/pascal; add example [Truta] +- Remove contrib/delphi2; add a new contrib/delphi [Truta] +- Avoid inclusion of the nonstandard in contrib/iostream, + and fix some method prototypes [Truta] +- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip + [Truta] +- Avoid the use of backslash (\) in contrib/minizip [Vollant] +- Fix file time handling in contrib/untgz; update makefiles [Truta] +- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines + [Vollant] +- Remove contrib/vstudio/vc15_16 [Vollant] +- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] +- Update README.contrib [Truta] +- Invert the assignment order of match_head and s->prev[...] in + INSERT_STRING [Truta] +- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings + [Truta] +- Compare function pointers with 0, not with NULL or Z_NULL [Truta] +- Fix prototype of syncsearch in inflate.c [Truta] +- Introduce ASMINF macro to be enabled when using an ASM implementation + of inflate_fast [Truta] +- Change NO_DEFLATE to NO_GZCOMPRESS [Truta] +- Modify test_gzio in example.c to take a single file name as a + parameter [Truta] +- Exit the example.c program if gzopen fails [Truta] +- Add type casts around strlen in example.c [Truta] +- Remove casting to sizeof in minigzip.c; give a proper type + to the variable compared with SUFFIX_LEN [Truta] +- Update definitions of STDC and STDC99 in zconf.h [Truta] +- Synchronize zconf.h with the new Windows DLL interface [Truta] +- Use SYS16BIT instead of __32BIT__ to distinguish between + 16- and 32-bit platforms [Truta] +- Use far memory allocators in small 16-bit memory models for + Turbo C [Truta] +- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in + zlibCompileFlags [Truta] +- Cygwin has vsnprintf [Wilson] +- In Windows16, OS_CODE is 0, as in MSDOS [Truta] +- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] + +Changes in 1.2.0.4 (10 August 2003) +- Minor FAQ updates +- Be more strict when checking inflateInit2's windowBits parameter +- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well +- Add gzip wrapper option to deflateInit2 using windowBits +- Add updated QNX rule in configure and qnx directory [Bonnefoy] +- Make inflate distance-too-far checks more rigorous +- Clean up FAR usage in inflate +- Add casting to sizeof() in gzio.c and minigzip.c + +Changes in 1.2.0.3 (19 July 2003) +- Fix silly error in gzungetc() implementation [Vollant] +- Update contrib/minizip and contrib/vstudio [Vollant] +- Fix printf format in example.c +- Correct cdecl support in zconf.in.h [Anisimkov] +- Minor FAQ updates + +Changes in 1.2.0.2 (13 July 2003) +- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons +- Attempt to avoid warnings in crc32.c for pointer-int conversion +- Add AIX to configure, remove aix directory [Bakker] +- Add some casts to minigzip.c +- Improve checking after insecure sprintf() or vsprintf() calls +- Remove #elif's from crc32.c +- Change leave label to inf_leave in inflate.c and infback.c to avoid + library conflicts +- Remove inflate gzip decoding by default--only enable gzip decoding by + special request for stricter backward compatibility +- Add zlibCompileFlags() function to return compilation information +- More typecasting in deflate.c to avoid warnings +- Remove leading underscore from _Capital #defines [Truta] +- Fix configure to link shared library when testing +- Add some Windows CE target adjustments [Mai] +- Remove #define ZLIB_DLL in zconf.h [Vollant] +- Add zlib.3 [Rodgers] +- Update RFC URL in deflate.c and algorithm.txt [Mai] +- Add zlib_dll_FAQ.txt to contrib [Truta] +- Add UL to some constants [Truta] +- Update minizip and vstudio [Vollant] +- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h +- Expand use of NO_DUMMY_DECL to avoid all dummy structures +- Added iostream3 to contrib [Schwardt] +- Replace rewind() with fseek() for WinCE [Truta] +- Improve setting of zlib format compression level flags + - Report 0 for huffman and rle strategies and for level == 0 or 1 + - Report 2 only for level == 6 +- Only deal with 64K limit when necessary at compile time [Truta] +- Allow TOO_FAR check to be turned off at compile time [Truta] +- Add gzclearerr() function [Souza] +- Add gzungetc() function + +Changes in 1.2.0.1 (17 March 2003) +- Add Z_RLE strategy for run-length encoding [Truta] + - When Z_RLE requested, restrict matches to distance one + - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE +- Correct FASTEST compilation to allow level == 0 +- Clean up what gets compiled for FASTEST +- Incorporate changes to zconf.in.h [Vollant] + - Refine detection of Turbo C need for dummy returns + - Refine ZLIB_DLL compilation + - Include additional header file on VMS for off_t typedef +- Try to use _vsnprintf where it supplants vsprintf [Vollant] +- Add some casts in inffast.c +- Enchance comments in zlib.h on what happens if gzprintf() tries to + write more than 4095 bytes before compression +- Remove unused state from inflateBackEnd() +- Remove exit(0) from minigzip.c, example.c +- Get rid of all those darn tabs +- Add "check" target to Makefile.in that does the same thing as "test" +- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in +- Update contrib/inflate86 [Anderson] +- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] +- Add msdos and win32 directories with makefiles [Truta] +- More additions and improvements to the FAQ + +Changes in 1.2.0 (9 March 2003) +- New and improved inflate code + - About 20% faster + - Does not allocate 32K window unless and until needed + - Automatically detects and decompresses gzip streams + - Raw inflate no longer needs an extra dummy byte at end + - Added inflateBack functions using a callback interface--even faster + than inflate, useful for file utilities (gzip, zip) + - Added inflateCopy() function to record state for random access on + externally generated deflate streams (e.g. in gzip files) + - More readable code (I hope) +- New and improved crc32() + - About 50% faster, thanks to suggestions from Rodney Brown +- Add deflateBound() and compressBound() functions +- Fix memory leak in deflateInit2() +- Permit setting dictionary for raw deflate (for parallel deflate) +- Fix const declaration for gzwrite() +- Check for some malloc() failures in gzio.c +- Fix bug in gzopen() on single-byte file 0x1f +- Fix bug in gzread() on concatenated file with 0x1f at end of buffer + and next buffer doesn't start with 0x8b +- Fix uncompress() to return Z_DATA_ERROR on truncated input +- Free memory at end of example.c +- Remove MAX #define in trees.c (conflicted with some libraries) +- Fix static const's in deflate.c, gzio.c, and zutil.[ch] +- Declare malloc() and free() in gzio.c if STDC not defined +- Use malloc() instead of calloc() in zutil.c if int big enough +- Define STDC for AIX +- Add aix/ with approach for compiling shared library on AIX +- Add HP-UX support for shared libraries in configure +- Add OpenUNIX support for shared libraries in configure +- Use $cc instead of gcc to build shared library +- Make prefix directory if needed when installing +- Correct Macintosh avoidance of typedef Byte in zconf.h +- Correct Turbo C memory allocation when under Linux +- Use libz.a instead of -lz in Makefile (assure use of compiled library) +- Update configure to check for snprintf or vsnprintf functions and their + return value, warn during make if using an insecure function +- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that + is lost when library is used--resolution is to build new zconf.h +- Documentation improvements (in zlib.h): + - Document raw deflate and inflate + - Update RFCs URL + - Point out that zlib and gzip formats are different + - Note that Z_BUF_ERROR is not fatal + - Document string limit for gzprintf() and possible buffer overflow + - Note requirement on avail_out when flushing + - Note permitted values of flush parameter of inflate() +- Add some FAQs (and even answers) to the FAQ +- Add contrib/inflate86/ for x86 faster inflate +- Add contrib/blast/ for PKWare Data Compression Library decompression +- Add contrib/puff/ simple inflate for deflate format description + +Changes in 1.1.4 (11 March 2002) +- ZFREE was repeated on same allocation on some error conditions. + This creates a security problem described in + http://www.zlib.org/advisory-2002-03-11.txt +- Returned incorrect error (Z_MEM_ERROR) on some invalid data +- Avoid accesses before window for invalid distances with inflate window + less than 32K. +- force windowBits > 8 to avoid a bug in the encoder for a window size + of 256 bytes. (A complete fix will be available in 1.1.5). + +Changes in 1.1.3 (9 July 1998) +- fix "an inflate input buffer bug that shows up on rare but persistent + occasions" (Mark) +- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) +- fix gzseek(..., SEEK_SET) in write mode +- fix crc check after a gzeek (Frank Faubert) +- fix miniunzip when the last entry in a zip file is itself a zip file + (J Lillge) +- add contrib/asm586 and contrib/asm686 (Brian Raiter) + See http://www.muppetlabs.com/~breadbox/software/assembly.html +- add support for Delphi 3 in contrib/delphi (Bob Dellaca) +- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) +- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) +- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) +- added a FAQ file + +- Support gzdopen on Mac with Metrowerks (Jason Linhart) +- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) +- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) +- avoid some warnings with Borland C (Tom Tanner) +- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) +- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) +- allow several arguments to configure (Tim Mooney, Frodo Looijaard) +- use libdir and includedir in Makefile.in (Tim Mooney) +- support shared libraries on OSF1 V4 (Tim Mooney) +- remove so_locations in "make clean" (Tim Mooney) +- fix maketree.c compilation error (Glenn, Mark) +- Python interface to zlib now in Python 1.5 (Jeremy Hylton) +- new Makefile.riscos (Rich Walker) +- initialize static descriptors in trees.c for embedded targets (Nick Smith) +- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) +- add the OS/2 files in Makefile.in too (Andrew Zabolotny) +- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) +- fix maketree.c to allow clean compilation of inffixed.h (Mark) +- fix parameter check in deflateCopy (Gunther Nikl) +- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) +- Many portability patches by Christian Spieler: + . zutil.c, zutil.h: added "const" for zmem* + . Make_vms.com: fixed some typos + . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists + . msdos/Makefile.msc: remove "default rtl link library" info from obj files + . msdos/Makefile.*: use model-dependent name for the built zlib library + . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: + new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) +- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) +- replace __far with _far for better portability (Christian Spieler, Tom Lane) +- fix test for errno.h in configure (Tim Newsham) + +Changes in 1.1.2 (19 March 98) +- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) + See http://www.winimage.com/zLibDll/unzip.html +- preinitialize the inflate tables for fixed codes, to make the code + completely thread safe (Mark) +- some simplifications and slight speed-up to the inflate code (Mark) +- fix gzeof on non-compressed files (Allan Schrum) +- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) +- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) +- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) +- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) +- do not wrap extern "C" around system includes (Tom Lane) +- mention zlib binding for TCL in README (Andreas Kupries) +- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) +- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) +- allow "configure --prefix $HOME" (Tim Mooney) +- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) +- move Makefile.sas to amiga/Makefile.sas + +Changes in 1.1.1 (27 Feb 98) +- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) +- remove block truncation heuristic which had very marginal effect for zlib + (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the + compression ratio on some files. This also allows inlining _tr_tally for + matches in deflate_slow. +- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) + +Changes in 1.1.0 (24 Feb 98) +- do not return STREAM_END prematurely in inflate (John Bowler) +- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) +- compile with -DFASTEST to get compression code optimized for speed only +- in minigzip, try mmap'ing the input file first (Miguel Albrecht) +- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain + on Sun but significant on HP) + +- add a pointer to experimental unzip library in README (Gilles Vollant) +- initialize variable gcc in configure (Chris Herborth) + +Changes in 1.0.9 (17 Feb 1998) +- added gzputs and gzgets functions +- do not clear eof flag in gzseek (Mark Diekhans) +- fix gzseek for files in transparent mode (Mark Diekhans) +- do not assume that vsprintf returns the number of bytes written (Jens Krinke) +- replace EXPORT with ZEXPORT to avoid conflict with other programs +- added compress2 in zconf.h, zlib.def, zlib.dnt +- new asm code from Gilles Vollant in contrib/asm386 +- simplify the inflate code (Mark): + . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() + . ZALLOC the length list in inflate_trees_fixed() instead of using stack + . ZALLOC the value area for huft_build() instead of using stack + . Simplify Z_FINISH check in inflate() + +- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 +- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) +- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with + the declaration of FAR (Gilles VOllant) +- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) +- read_buf buf parameter of type Bytef* instead of charf* +- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) +- do not redeclare unlink in minigzip.c for WIN32 (John Bowler) +- fix check for presence of directories in "make install" (Ian Willis) + +Changes in 1.0.8 (27 Jan 1998) +- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) +- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) +- added compress2() to allow setting the compression level +- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) +- use constant arrays for the static trees in trees.c instead of computing + them at run time (thanks to Ken Raeburn for this suggestion). To create + trees.h, compile with GEN_TREES_H and run "make test". +- check return code of example in "make test" and display result +- pass minigzip command line options to file_compress +- simplifying code of inflateSync to avoid gcc 2.8 bug + +- support CC="gcc -Wall" in configure -s (QingLong) +- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) +- fix test for shared library support to avoid compiler warnings +- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) +- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) +- do not use fdopen for Metrowerks on Mac (Brad Pettit)) +- add checks for gzputc and gzputc in example.c +- avoid warnings in gzio.c and deflate.c (Andreas Kleinert) +- use const for the CRC table (Ken Raeburn) +- fixed "make uninstall" for shared libraries +- use Tracev instead of Trace in infblock.c +- in example.c use correct compressed length for test_sync +- suppress +vnocompatwarnings in configure for HPUX (not always supported) + +Changes in 1.0.7 (20 Jan 1998) +- fix gzseek which was broken in write mode +- return error for gzseek to negative absolute position +- fix configure for Linux (Chun-Chung Chen) +- increase stack space for MSC (Tim Wegner) +- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) +- define EXPORTVA for gzprintf (Gilles Vollant) +- added man page zlib.3 (Rick Rodgers) +- for contrib/untgz, fix makedir() and improve Makefile + +- check gzseek in write mode in example.c +- allocate extra buffer for seeks only if gzseek is actually called +- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) +- add inflateSyncPoint in zconf.h +- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def + +Changes in 1.0.6 (19 Jan 1998) +- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and + gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) +- Fix a deflate bug occurring only with compression level 0 (thanks to + Andy Buckler for finding this one). +- In minigzip, pass transparently also the first byte for .Z files. +- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() +- check Z_FINISH in inflate (thanks to Marc Schluper) +- Implement deflateCopy (thanks to Adam Costello) +- make static libraries by default in configure, add --shared option. +- move MSDOS or Windows specific files to directory msdos +- suppress the notion of partial flush to simplify the interface + (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) +- suppress history buffer provided by application to simplify the interface + (this feature was not implemented anyway in 1.0.4) +- next_in and avail_in must be initialized before calling inflateInit or + inflateInit2 +- add EXPORT in all exported functions (for Windows DLL) +- added Makefile.nt (thanks to Stephen Williams) +- added the unsupported "contrib" directory: + contrib/asm386/ by Gilles Vollant + 386 asm code replacing longest_match(). + contrib/iostream/ by Kevin Ruland + A C++ I/O streams interface to the zlib gz* functions + contrib/iostream2/ by Tyge Lvset + Another C++ I/O streams interface + contrib/untgz/ by "Pedro A. Aranda Guti\irrez" + A very simple tar.gz file extractor using zlib + contrib/visual-basic.txt by Carlos Rios + How to use compress(), uncompress() and the gz* functions from VB. +- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression + level) in minigzip (thanks to Tom Lane) + +- use const for rommable constants in deflate +- added test for gzseek and gztell in example.c +- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) +- add undocumented function zError to convert error code to string + (for Tim Smithers) +- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. +- Use default memcpy for Symantec MSDOS compiler. +- Add EXPORT keyword for check_func (needed for Windows DLL) +- add current directory to LD_LIBRARY_PATH for "make test" +- create also a link for libz.so.1 +- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) +- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) +- added -soname for Linux in configure (Chun-Chung Chen, +- assign numbers to the exported functions in zlib.def (for Windows DLL) +- add advice in zlib.h for best usage of deflateSetDictionary +- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) +- allow compilation with ANSI keywords only enabled for TurboC in large model +- avoid "versionString"[0] (Borland bug) +- add NEED_DUMMY_RETURN for Borland +- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). +- allow compilation with CC +- defined STDC for OS/2 (David Charlap) +- limit external names to 8 chars for MVS (Thomas Lund) +- in minigzip.c, use static buffers only for 16-bit systems +- fix suffix check for "minigzip -d foo.gz" +- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) +- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) +- added makelcc.bat for lcc-win32 (Tom St Denis) +- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) +- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. +- check for unistd.h in configure (for off_t) +- remove useless check parameter in inflate_blocks_free +- avoid useless assignment of s->check to itself in inflate_blocks_new +- do not flush twice in gzclose (thanks to Ken Raeburn) +- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h +- use NO_ERRNO_H instead of enumeration of operating systems with errno.h +- work around buggy fclose on pipes for HP/UX +- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) +- fix configure if CC is already equal to gcc + +Changes in 1.0.5 (3 Jan 98) +- Fix inflate to terminate gracefully when fed corrupted or invalid data +- Use const for rommable constants in inflate +- Eliminate memory leaks on error conditions in inflate +- Removed some vestigial code in inflate +- Update web address in README + +Changes in 1.0.4 (24 Jul 96) +- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF + bit, so the decompressor could decompress all the correct data but went + on to attempt decompressing extra garbage data. This affected minigzip too. +- zlibVersion and gzerror return const char* (needed for DLL) +- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) +- use z_error only for DEBUG (avoid problem with DLLs) + +Changes in 1.0.3 (2 Jul 96) +- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS + small and medium models; this makes the library incompatible with previous + versions for these models. (No effect in large model or on other systems.) +- return OK instead of BUF_ERROR if previous deflate call returned with + avail_out as zero but there is nothing to do +- added memcmp for non STDC compilers +- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) +- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) +- better check for 16-bit mode MSC (avoids problem with Symantec) + +Changes in 1.0.2 (23 May 96) +- added Windows DLL support +- added a function zlibVersion (for the DLL support) +- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) +- Bytef is define's instead of typedef'd only for Borland C +- avoid reading uninitialized memory in example.c +- mention in README that the zlib format is now RFC1950 +- updated Makefile.dj2 +- added algorithm.doc + +Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] +- fix array overlay in deflate.c which sometimes caused bad compressed data +- fix inflate bug with empty stored block +- fix MSDOS medium model which was broken in 0.99 +- fix deflateParams() which could generated bad compressed data. +- Bytef is define'd instead of typedef'ed (work around Borland bug) +- added an INDEX file +- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), + Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) +- speed up adler32 for modern machines without auto-increment +- added -ansi for IRIX in configure +- static_init_done in trees.c is an int +- define unlink as delete for VMS +- fix configure for QNX +- add configure branch for SCO and HPUX +- avoid many warnings (unused variables, dead assignments, etc...) +- no fdopen for BeOS +- fix the Watcom fix for 32 bit mode (define FAR as empty) +- removed redefinition of Byte for MKWERKS +- work around an MWKERKS bug (incorrect merge of all .h files) + +Changes in 0.99 (27 Jan 96) +- allow preset dictionary shared between compressor and decompressor +- allow compression level 0 (no compression) +- add deflateParams in zlib.h: allow dynamic change of compression level + and compression strategy. +- test large buffers and deflateParams in example.c +- add optional "configure" to build zlib as a shared library +- suppress Makefile.qnx, use configure instead +- fixed deflate for 64-bit systems (detected on Cray) +- fixed inflate_blocks for 64-bit systems (detected on Alpha) +- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) +- always return Z_BUF_ERROR when deflate() has nothing to do +- deflateInit and inflateInit are now macros to allow version checking +- prefix all global functions and types with z_ with -DZ_PREFIX +- make falloc completely reentrant (inftrees.c) +- fixed very unlikely race condition in ct_static_init +- free in reverse order of allocation to help memory manager +- use zlib-1.0/* instead of zlib/* inside the tar.gz +- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith + -Wconversion -Wstrict-prototypes -Wmissing-prototypes" +- allow gzread on concatenated .gz files +- deflateEnd now returns Z_DATA_ERROR if it was premature +- deflate is finally (?) fully deterministic (no matches beyond end of input) +- Document Z_SYNC_FLUSH +- add uninstall in Makefile +- Check for __cpluplus in zlib.h +- Better test in ct_align for partial flush +- avoid harmless warnings for Borland C++ +- initialize hash_head in deflate.c +- avoid warning on fdopen (gzio.c) for HP cc -Aa +- include stdlib.h for STDC compilers +- include errno.h for Cray +- ignore error if ranlib doesn't exist +- call ranlib twice for NeXTSTEP +- use exec_prefix instead of prefix for libz.a +- renamed ct_* as _tr_* to avoid conflict with applications +- clear z->msg in inflateInit2 before any error return +- initialize opaque in example.c, gzio.c, deflate.c and inflate.c +- fixed typo in zconf.h (_GNUC__ => __GNUC__) +- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) +- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) +- in fcalloc, normalize pointer if size > 65520 bytes +- don't use special fcalloc for 32 bit Borland C++ +- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... +- use Z_BINARY instead of BINARY +- document that gzclose after gzdopen will close the file +- allow "a" as mode in gzopen. +- fix error checking in gzread +- allow skipping .gz extra-field on pipes +- added reference to Perl interface in README +- put the crc table in FAR data (I dislike more and more the medium model :) +- added get_crc_table +- added a dimension to all arrays (Borland C can't count). +- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast +- guard against multiple inclusion of *.h (for precompiled header on Mac) +- Watcom C pretends to be Microsoft C small model even in 32 bit mode. +- don't use unsized arrays to avoid silly warnings by Visual C++: + warning C4746: 'inflate_mask' : unsized array treated as '__far' + (what's wrong with far data in far model?). +- define enum out of inflate_blocks_state to allow compilation with C++ + +Changes in 0.95 (16 Aug 95) +- fix MSDOS small and medium model (now easier to adapt to any compiler) +- inlined send_bits +- fix the final (:-) bug for deflate with flush (output was correct but + not completely flushed in rare occasions). +- default window size is same for compression and decompression + (it's now sufficient to set MAX_WBITS in zconf.h). +- voidp -> voidpf and voidnp -> voidp (for consistency with other + typedefs and because voidnp was not near in large model). + +Changes in 0.94 (13 Aug 95) +- support MSDOS medium model +- fix deflate with flush (could sometimes generate bad output) +- fix deflateReset (zlib header was incorrectly suppressed) +- added support for VMS +- allow a compression level in gzopen() +- gzflush now calls fflush +- For deflate with flush, flush even if no more input is provided. +- rename libgz.a as libz.a +- avoid complex expression in infcodes.c triggering Turbo C bug +- work around a problem with gcc on Alpha (in INSERT_STRING) +- don't use inline functions (problem with some gcc versions) +- allow renaming of Byte, uInt, etc... with #define. +- avoid warning about (unused) pointer before start of array in deflate.c +- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c +- avoid reserved word 'new' in trees.c + +Changes in 0.93 (25 June 95) +- temporarily disable inline functions +- make deflate deterministic +- give enough lookahead for PARTIAL_FLUSH +- Set binary mode for stdin/stdout in minigzip.c for OS/2 +- don't even use signed char in inflate (not portable enough) +- fix inflate memory leak for segmented architectures + +Changes in 0.92 (3 May 95) +- don't assume that char is signed (problem on SGI) +- Clear bit buffer when starting a stored block +- no memcpy on Pyramid +- suppressed inftest.c +- optimized fill_window, put longest_match inline for gcc +- optimized inflate on stored blocks. +- untabify all sources to simplify patches + +Changes in 0.91 (2 May 95) +- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h +- Document the memory requirements in zconf.h +- added "make install" +- fix sync search logic in inflateSync +- deflate(Z_FULL_FLUSH) now works even if output buffer too short +- after inflateSync, don't scare people with just "lo world" +- added support for DJGPP + +Changes in 0.9 (1 May 95) +- don't assume that zalloc clears the allocated memory (the TurboC bug + was Mark's bug after all :) +- let again gzread copy uncompressed data unchanged (was working in 0.71) +- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented +- added a test of inflateSync in example.c +- moved MAX_WBITS to zconf.h because users might want to change that. +- document explicitly that zalloc(64K) on MSDOS must return a normalized + pointer (zero offset) +- added Makefiles for Microsoft C, Turbo C, Borland C++ +- faster crc32() + +Changes in 0.8 (29 April 95) +- added fast inflate (inffast.c) +- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this + is incompatible with previous versions of zlib which returned Z_OK. +- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) + (actually that was not a compiler bug, see 0.81 above) +- gzread no longer reads one extra byte in certain cases +- In gzio destroy(), don't reference a freed structure +- avoid many warnings for MSDOS +- avoid the ERROR symbol which is used by MS Windows + +Changes in 0.71 (14 April 95) +- Fixed more MSDOS compilation problems :( There is still a bug with + TurboC large model. + +Changes in 0.7 (14 April 95) +- Added full inflate support. +- Simplified the crc32() interface. The pre- and post-conditioning + (one's complement) is now done inside crc32(). WARNING: this is + incompatible with previous versions; see zlib.h for the new usage. + +Changes in 0.61 (12 April 95) +- workaround for a bug in TurboC. example and minigzip now work on MSDOS. + +Changes in 0.6 (11 April 95) +- added minigzip.c +- added gzdopen to reopen a file descriptor as gzFile +- added transparent reading of non-gziped files in gzread. +- fixed bug in gzread (don't read crc as data) +- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). +- don't allocate big arrays in the stack (for MSDOS) +- fix some MSDOS compilation problems + +Changes in 0.5: +- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but + not yet Z_FULL_FLUSH. +- support decompression but only in a single step (forced Z_FINISH) +- added opaque object for zalloc and zfree. +- added deflateReset and inflateReset +- added a variable zlib_version for consistency checking. +- renamed the 'filter' parameter of deflateInit2 as 'strategy'. + Added Z_FILTERED and Z_HUFFMAN_ONLY constants. + +Changes in 0.4: +- avoid "zip" everywhere, use zlib instead of ziplib. +- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush + if compression method == 8. +- added adler32 and crc32 +- renamed deflateOptions as deflateInit2, call one or the other but not both +- added the method parameter for deflateInit2. +- added inflateInit2 +- simplied considerably deflateInit and inflateInit by not supporting + user-provided history buffer. This is supported only in deflateInit2 + and inflateInit2. + +Changes in 0.3: +- prefix all macro names with Z_ +- use Z_FINISH instead of deflateEnd to finish compression. +- added Z_HUFFMAN_ONLY +- added gzerror() diff --git a/zlib/FAQ b/zlib/FAQ new file mode 100644 index 0000000..1a22750 --- /dev/null +++ b/zlib/FAQ @@ -0,0 +1,366 @@ + + Frequently Asked Questions about zlib + + +If your question is not there, please check the zlib home page +http://zlib.net/ which may have more recent information. +The lastest zlib FAQ is at http://zlib.net/zlib_faq.html + + + 1. Is zlib Y2K-compliant? + + Yes. zlib doesn't handle dates. + + 2. Where can I get a Windows DLL version? + + The zlib sources can be compiled without change to produce a DLL. See the + file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the + precompiled DLL are found in the zlib web site at http://zlib.net/ . + + 3. Where can I get a Visual Basic interface to zlib? + + See + * http://marknelson.us/1997/01/01/zlib-engine/ + * win32/DLL_FAQ.txt in the zlib distribution + + 4. compress() returns Z_BUF_ERROR. + + Make sure that before the call of compress(), the length of the compressed + buffer is equal to the available size of the compressed buffer and not + zero. For Visual Basic, check that this parameter is passed by reference + ("as any"), not by value ("as long"). + + 5. deflate() or inflate() returns Z_BUF_ERROR. + + Before making the call, make sure that avail_in and avail_out are not zero. + When setting the parameter flush equal to Z_FINISH, also make sure that + avail_out is big enough to allow processing all pending input. Note that a + Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be + made with more input or output space. A Z_BUF_ERROR may in fact be + unavoidable depending on how the functions are used, since it is not + possible to tell whether or not there is more output pending when + strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a + heavily annotated example. + + 6. Where's the zlib documentation (man pages, etc.)? + + It's in zlib.h . Examples of zlib usage are in the files example.c and + minigzip.c, with more in examples/ . + + 7. Why don't you use GNU autoconf or libtool or ...? + + Because we would like to keep zlib as a very small and simple package. + zlib is rather portable and doesn't need much configuration. + + 8. I found a bug in zlib. + + Most of the time, such problems are due to an incorrect usage of zlib. + Please try to reproduce the problem with a small program and send the + corresponding source to us at zlib@gzip.org . Do not send multi-megabyte + data files without prior agreement. + + 9. Why do I get "undefined reference to gzputc"? + + If "make test" produces something like + + example.o(.text+0x154): undefined reference to `gzputc' + + check that you don't have old files libz.* in /usr/lib, /usr/local/lib or + /usr/X11R6/lib. Remove any old versions, then do "make install". + +10. I need a Delphi interface to zlib. + + See the contrib/delphi directory in the zlib distribution. + +11. Can zlib handle .zip archives? + + Not by itself, no. See the directory contrib/minizip in the zlib + distribution. + +12. Can zlib handle .Z files? + + No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt + the code of uncompress on your own. + +13. How can I make a Unix shared library? + + make clean + ./configure -s + make + +14. How do I install a shared zlib library on Unix? + + After the above, then: + + make install + + However, many flavors of Unix come with a shared zlib already installed. + Before going to the trouble of compiling a shared version of zlib and + trying to install it, you may want to check if it's already there! If you + can #include , it's there. The -lz option will probably link to + it. You can check the version at the top of zlib.h or with the + ZLIB_VERSION symbol defined in zlib.h . + +15. I have a question about OttoPDF. + + We are not the authors of OttoPDF. The real author is on the OttoPDF web + site: Joel Hainley, jhainley@myndkryme.com. + +16. Can zlib decode Flate data in an Adobe PDF file? + + Yes. See http://www.pdflib.com/ . To modify PDF forms, see + http://sourceforge.net/projects/acroformtool/ . + +17. Why am I getting this "register_frame_info not found" error on Solaris? + + After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib + generates an error such as: + + ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so: + symbol __register_frame_info: referenced symbol not found + + The symbol __register_frame_info is not part of zlib, it is generated by + the C compiler (cc or gcc). You must recompile applications using zlib + which have this problem. This problem is specific to Solaris. See + http://www.sunfreeware.com for Solaris versions of zlib and applications + using zlib. + +18. Why does gzip give an error on a file I make with compress/deflate? + + The compress and deflate functions produce data in the zlib format, which + is different and incompatible with the gzip format. The gz* functions in + zlib on the other hand use the gzip format. Both the zlib and gzip formats + use the same compressed data format internally, but have different headers + and trailers around the compressed data. + +19. Ok, so why are there two different formats? + + The gzip format was designed to retain the directory information about a + single file, such as the name and last modification date. The zlib format + on the other hand was designed for in-memory and communication channel + applications, and has a much more compact header and trailer and uses a + faster integrity check than gzip. + +20. Well that's nice, but how do I make a gzip file in memory? + + You can request that deflate write the gzip format instead of the zlib + format using deflateInit2(). You can also request that inflate decode the + gzip format using inflateInit2(). Read zlib.h for more details. + +21. Is zlib thread-safe? + + Yes. However any library routines that zlib uses and any application- + provided memory allocation routines must also be thread-safe. zlib's gz* + functions use stdio library routines, and most of zlib's functions use the + library memory allocation routines by default. zlib's *Init* functions + allow for the application to provide custom memory allocation routines. + + Of course, you should only operate on any given zlib or gzip stream from a + single thread at a time. + +22. Can I use zlib in my commercial application? + + Yes. Please read the license in zlib.h. + +23. Is zlib under the GNU license? + + No. Please read the license in zlib.h. + +24. The license says that altered source versions must be "plainly marked". So + what exactly do I need to do to meet that requirement? + + You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In + particular, the final version number needs to be changed to "f", and an + identification string should be appended to ZLIB_VERSION. Version numbers + x.x.x.f are reserved for modifications to zlib by others than the zlib + maintainers. For example, if the version of the base zlib you are altering + is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and + ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also + update the version strings in deflate.c and inftrees.c. + + For altered source distributions, you should also note the origin and + nature of the changes in zlib.h, as well as in ChangeLog and README, along + with the dates of the alterations. The origin should include at least your + name (or your company's name), and an email address to contact for help or + issues with the library. + + Note that distributing a compiled zlib library along with zlib.h and + zconf.h is also a source distribution, and so you should change + ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes + in zlib.h as you would for a full source distribution. + +25. Will zlib work on a big-endian or little-endian architecture, and can I + exchange compressed data between them? + + Yes and yes. + +26. Will zlib work on a 64-bit machine? + + Yes. It has been tested on 64-bit machines, and has no dependence on any + data types being limited to 32-bits in length. If you have any + difficulties, please provide a complete problem report to zlib@gzip.org + +27. Will zlib decompress data from the PKWare Data Compression Library? + + No. The PKWare DCL uses a completely different compressed data format than + does PKZIP and zlib. However, you can look in zlib's contrib/blast + directory for a possible solution to your problem. + +28. Can I access data randomly in a compressed stream? + + No, not without some preparation. If when compressing you periodically use + Z_FULL_FLUSH, carefully write all the pending data at those points, and + keep an index of those locations, then you can start decompression at those + points. You have to be careful to not use Z_FULL_FLUSH too often, since it + can significantly degrade compression. Alternatively, you can scan a + deflate stream once to generate an index, and then use that index for + random access. See examples/zran.c . + +29. Does zlib work on MVS, OS/390, CICS, etc.? + + It has in the past, but we have not heard of any recent evidence. There + were working ports of zlib 1.1.4 to MVS, but those links no longer work. + If you know of recent, successful applications of zlib on these operating + systems, please let us know. Thanks. + +30. Is there some simpler, easier to read version of inflate I can look at to + understand the deflate format? + + First off, you should read RFC 1951. Second, yes. Look in zlib's + contrib/puff directory. + +31. Does zlib infringe on any patents? + + As far as we know, no. In fact, that was originally the whole point behind + zlib. Look here for some more information: + + http://www.gzip.org/#faq11 + +32. Can zlib work with greater than 4 GB of data? + + Yes. inflate() and deflate() will process any amount of data correctly. + Each call of inflate() or deflate() is limited to input and output chunks + of the maximum value that can be stored in the compiler's "unsigned int" + type, but there is no limit to the number of chunks. Note however that the + strm.total_in and strm_total_out counters may be limited to 4 GB. These + counters are provided as a convenience and are not used internally by + inflate() or deflate(). The application can easily set up its own counters + updated after each call of inflate() or deflate() to count beyond 4 GB. + compress() and uncompress() may be limited to 4 GB, since they operate in a + single call. gzseek() and gztell() may be limited to 4 GB depending on how + zlib is compiled. See the zlibCompileFlags() function in zlib.h. + + The word "may" appears several times above since there is a 4 GB limit only + if the compiler's "long" type is 32 bits. If the compiler's "long" type is + 64 bits, then the limit is 16 exabytes. + +33. Does zlib have any security vulnerabilities? + + The only one that we are aware of is potentially in gzprintf(). If zlib is + compiled to use sprintf() or vsprintf(), then there is no protection + against a buffer overflow of an 8K string space (or other value as set by + gzbuffer()), other than the caller of gzprintf() assuring that the output + will not exceed 8K. On the other hand, if zlib is compiled to use + snprintf() or vsnprintf(), which should normally be the case, then there is + no vulnerability. The ./configure script will display warnings if an + insecure variation of sprintf() will be used by gzprintf(). Also the + zlibCompileFlags() function will return information on what variant of + sprintf() is used by gzprintf(). + + If you don't have snprintf() or vsnprintf() and would like one, you can + find a portable implementation here: + + http://www.ijs.si/software/snprintf/ + + Note that you should be using the most recent version of zlib. Versions + 1.1.3 and before were subject to a double-free vulnerability, and versions + 1.2.1 and 1.2.2 were subject to an access exception when decompressing + invalid compressed data. + +34. Is there a Java version of zlib? + + Probably what you want is to use zlib in Java. zlib is already included + as part of the Java SDK in the java.util.zip package. If you really want + a version of zlib written in the Java language, look on the zlib home + page for links: http://zlib.net/ . + +35. I get this or that compiler or source-code scanner warning when I crank it + up to maximally-pedantic. Can't you guys write proper code? + + Many years ago, we gave up attempting to avoid warnings on every compiler + in the universe. It just got to be a waste of time, and some compilers + were downright silly as well as contradicted each other. So now, we simply + make sure that the code always works. + +36. Valgrind (or some similar memory access checker) says that deflate is + performing a conditional jump that depends on an uninitialized value. + Isn't that a bug? + + No. That is intentional for performance reasons, and the output of deflate + is not affected. This only started showing up recently since zlib 1.2.x + uses malloc() by default for allocations, whereas earlier versions used + calloc(), which zeros out the allocated memory. Even though the code was + correct, versions 1.2.4 and later was changed to not stimulate these + checkers. + +37. Will zlib read the (insert any ancient or arcane format here) compressed + data format? + + Probably not. Look in the comp.compression FAQ for pointers to various + formats and associated software. + +38. How can I encrypt/decrypt zip files with zlib? + + zlib doesn't support encryption. The original PKZIP encryption is very + weak and can be broken with freely available programs. To get strong + encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib + compression. For PKZIP compatible "encryption", look at + http://www.info-zip.org/ + +39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? + + "gzip" is the gzip format, and "deflate" is the zlib format. They should + probably have called the second one "zlib" instead to avoid confusion with + the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 + correctly points to the zlib specification in RFC 1950 for the "deflate" + transfer encoding, there have been reports of servers and browsers that + incorrectly produce or expect raw deflate data per the deflate + specficiation in RFC 1951, most notably Microsoft. So even though the + "deflate" transfer encoding using the zlib format would be the more + efficient approach (and in fact exactly what the zlib format was designed + for), using the "gzip" transfer encoding is probably more reliable due to + an unfortunate choice of name on the part of the HTTP 1.1 authors. + + Bottom line: use the gzip format for HTTP 1.1 encoding. + +40. Does zlib support the new "Deflate64" format introduced by PKWare? + + No. PKWare has apparently decided to keep that format proprietary, since + they have not documented it as they have previous compression formats. In + any case, the compression improvements are so modest compared to other more + modern approaches, that it's not worth the effort to implement. + +41. I'm having a problem with the zip functions in zlib, can you help? + + There are no zip functions in zlib. You are probably using minizip by + Giles Vollant, which is found in the contrib directory of zlib. It is not + part of zlib. In fact none of the stuff in contrib is part of zlib. The + files in there are not supported by the zlib authors. You need to contact + the authors of the respective contribution for help. + +42. The match.asm code in contrib is under the GNU General Public License. + Since it's part of zlib, doesn't that mean that all of zlib falls under the + GNU GPL? + + No. The files in contrib are not part of zlib. They were contributed by + other authors and are provided as a convenience to the user within the zlib + distribution. Each item in contrib has its own license. + +43. Is zlib subject to export controls? What is its ECCN? + + zlib is not subject to export controls, and so is classified as EAR99. + +44. Can you please sign these lengthy legal documents and fax them back to us + so that we can use your software in our product? + + No. Go away. Shoo. diff --git a/zlib/INDEX b/zlib/INDEX new file mode 100644 index 0000000..f6c51ca --- /dev/null +++ b/zlib/INDEX @@ -0,0 +1,65 @@ +CMakeLists.txt cmake build file +ChangeLog history of changes +FAQ Frequently Asked Questions about zlib +INDEX this file +Makefile dummy Makefile that tells you to ./configure +Makefile.in template for Unix Makefile +README guess what +configure configure script for Unix +make_vms.com makefile for VMS +treebuild.xml XML description of source file dependencies +zconf.h.cmakein zconf.h template for cmake +zconf.h.in zconf.h template for configure +zlib.3 Man page for zlib +zlib.3.pdf Man page in PDF format +zlib.map Linux symbol information +zlib.pc.in Template for pkg-config descriptor +zlib2ansi perl script to convert source files for C++ compilation + +amiga/ makefiles for Amiga SAS C +doc/ documentation for formats and algorithms +msdos/ makefiles for MSDOS +nintendods/ makefile for Nintendo DS +old/ makefiles for various architectures and zlib documentation + files that have not yet been updated for zlib 1.2.x +qnx/ makefiles for QNX +watcom/ makefiles for OpenWatcom +win32/ makefiles for Windows + + zlib public header files (required for library use): +zconf.h +zlib.h + + private source files used to build the zlib library: +adler32.c +compress.c +crc32.c +crc32.h +deflate.c +deflate.h +gzclose.c +gzguts.h +gzlib.c +gzread.c +gzwrite.c +infback.c +inffast.c +inffast.h +inffixed.h +inflate.c +inflate.h +inftrees.c +inftrees.h +trees.c +trees.h +uncompr.c +zutil.c +zutil.h + + source files for sample programs: +example.c +minigzip.c +See examples/README.examples for more + + unsupported contribution by third parties +See contrib/README.contrib diff --git a/zlib/Makefile b/zlib/Makefile new file mode 100644 index 0000000..6bba86c --- /dev/null +++ b/zlib/Makefile @@ -0,0 +1,5 @@ +all: + -@echo "Please use ./configure first. Thank you." + +distclean: + make -f Makefile.in distclean diff --git a/zlib/Makefile.in b/zlib/Makefile.in new file mode 100644 index 0000000..5b15bd0 --- /dev/null +++ b/zlib/Makefile.in @@ -0,0 +1,257 @@ +# Makefile for zlib +# Copyright (C) 1995-2010 Jean-loup Gailly. +# For conditions of distribution and use, see copyright notice in zlib.h + +# To compile and test, type: +# ./configure; make test +# Normally configure builds both a static and a shared library. +# If you want to build just a static library, use: ./configure --static + +# To use the asm code, type: +# cp contrib/asm?86/match.S ./match.S +# make LOC=-DASMV OBJA=match.o + +# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: +# make install +# To install in $HOME instead of /usr/local, use: +# make install prefix=$HOME + +CC=cc + +CFLAGS=-O +#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 +#CFLAGS=-g -DDEBUG +#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ +# -Wstrict-prototypes -Wmissing-prototypes + +SFLAGS=-O +LDFLAGS= +TEST_LDFLAGS=-L. libz.a +LDSHARED=$(CC) +CPP=$(CC) -E + +STATICLIB=libz.a +SHAREDLIB=libz.so +SHAREDLIBV=libz.so.1.2.5 +SHAREDLIBM=libz.so.1 +LIBS=$(STATICLIB) $(SHAREDLIBV) + +AR=ar rc +RANLIB=ranlib +LDCONFIG=ldconfig +LDSHAREDLIBC=-lc +TAR=tar +SHELL=/bin/sh +EXE= + +prefix = /usr/local +exec_prefix = ${prefix} +libdir = ${exec_prefix}/lib +sharedlibdir = ${libdir} +includedir = ${prefix}/include +mandir = ${prefix}/share/man +man3dir = ${mandir}/man3 +pkgconfigdir = ${libdir}/pkgconfig + +OBJC = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \ + gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o + +PIC_OBJC = adler32.lo compress.lo crc32.lo deflate.lo gzclose.lo gzlib.lo gzread.lo \ + gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo + +# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo +OBJA = +PIC_OBJA = + +OBJS = $(OBJC) $(OBJA) + +PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA) + +all: static shared + +static: example$(EXE) minigzip$(EXE) + +shared: examplesh$(EXE) minigzipsh$(EXE) + +all64: example64$(EXE) minigzip64$(EXE) + +check: test + +test: all teststatic testshared + +teststatic: static + @if echo hello world | ./minigzip | ./minigzip -d && ./example; then \ + echo ' *** zlib test OK ***'; \ + else \ + echo ' *** zlib test FAILED ***'; false; \ + fi + -@rm -f foo.gz + +testshared: shared + @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ + LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \ + DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ + SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ + if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh; then \ + echo ' *** zlib shared test OK ***'; \ + else \ + echo ' *** zlib shared test FAILED ***'; false; \ + fi + -@rm -f foo.gz + +test64: all64 + @if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64; then \ + echo ' *** zlib 64-bit test OK ***'; \ + else \ + echo ' *** zlib 64-bit test FAILED ***'; false; \ + fi + -@rm -f foo.gz + +libz.a: $(OBJS) + $(AR) $@ $(OBJS) + -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 + +match.o: match.S + $(CPP) match.S > _match.s + $(CC) -c _match.s + mv _match.o match.o + rm -f _match.s + +match.lo: match.S + $(CPP) match.S > _match.s + $(CC) -c -fPIC _match.s + mv _match.o match.lo + rm -f _match.s + +example64.o: example.c zlib.h zconf.h + $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ example.c + +minigzip64.o: minigzip.c zlib.h zconf.h + $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ minigzip.c + +.SUFFIXES: .lo + +.c.lo: + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $< + -@mv objs/$*.o $@ + +$(SHAREDLIBV): $(PIC_OBJS) + $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS) + rm -f $(SHAREDLIB) $(SHAREDLIBM) + ln -s $@ $(SHAREDLIB) + ln -s $@ $(SHAREDLIBM) + -@rmdir objs + +example$(EXE): example.o $(STATICLIB) + $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) + +minigzip$(EXE): minigzip.o $(STATICLIB) + $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) + +examplesh$(EXE): example.o $(SHAREDLIBV) + $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV) + +minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) + $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) + +example64$(EXE): example64.o $(STATICLIB) + $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) + +minigzip64$(EXE): minigzip64.o $(STATICLIB) + $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) + +install-libs: $(LIBS) + -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi + -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi + -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi + -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi + -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi + cp $(STATICLIB) $(DESTDIR)$(libdir) + cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir) + cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB) + -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 + -@cd $(DESTDIR)$(sharedlibdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \ + chmod 755 $(SHAREDLIBV); \ + rm -f $(SHAREDLIB) $(SHAREDLIBM); \ + ln -s $(SHAREDLIBV) $(SHAREDLIB); \ + ln -s $(SHAREDLIBV) $(SHAREDLIBM); \ + ($(LDCONFIG) || true) >/dev/null 2>&1; \ + fi + cp zlib.3 $(DESTDIR)$(man3dir) + chmod 644 $(DESTDIR)$(man3dir)/zlib.3 + cp zlib.pc $(DESTDIR)$(pkgconfigdir) + chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc +# The ranlib in install is needed on NeXTSTEP which checks file times +# ldconfig is for Linux + +install: install-libs + -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi + cp zlib.h zconf.h $(DESTDIR)$(includedir) + chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h + +uninstall: + cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h + cd $(DESTDIR)$(libdir); rm -f libz.a; \ + if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \ + rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ + fi + cd $(DESTDIR)$(man3dir); rm -f zlib.3 + cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc + +docs: zlib.3.pdf + +zlib.3.pdf: zlib.3 + groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf + +zconf.h.in: zconf.h.cmakein + sed "/^#cmakedefine/D" < zconf.h.cmakein > zconf.h.in + touch -r zconf.h.cmakein zconf.h.in + +zconf: zconf.h.in + cp -p zconf.h.in zconf.h + +mostlyclean: clean +clean: + rm -f *.o *.lo *~ \ + example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ + example64$(EXE) minigzip64$(EXE) \ + libz.* foo.gz so_locations \ + _match.s maketree contrib/infback9/*.o + rm -rf objs + +maintainer-clean: distclean +distclean: clean zconf docs + rm -f Makefile zlib.pc + -@rm -f .DS_Store + -@printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile + -@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile + -@touch -r Makefile.in Makefile + +tags: + etags *.[ch] + +depend: + makedepend -- $(CFLAGS) -- *.[ch] + +# DO NOT DELETE THIS LINE -- make depend depends on it. + +adler32.o zutil.o: zutil.h zlib.h zconf.h +gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h +compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h +crc32.o: zutil.h zlib.h zconf.h crc32.h +deflate.o: deflate.h zutil.h zlib.h zconf.h +infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h +inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h +inftrees.o: zutil.h zlib.h zconf.h inftrees.h +trees.o: deflate.h zutil.h zlib.h zconf.h trees.h + +adler32.lo zutil.lo: zutil.h zlib.h zconf.h +gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h +compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h +crc32.lo: zutil.h zlib.h zconf.h crc32.h +deflate.lo: deflate.h zutil.h zlib.h zconf.h +infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h +inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h +inftrees.lo: zutil.h zlib.h zconf.h inftrees.h +trees.lo: deflate.h zutil.h zlib.h zconf.h trees.h diff --git a/zlib/README b/zlib/README new file mode 100644 index 0000000..d4219bf --- /dev/null +++ b/zlib/README @@ -0,0 +1,115 @@ +ZLIB DATA COMPRESSION LIBRARY + +zlib 1.2.5 is a general purpose data compression library. All the code is +thread safe. The data format used by the zlib library is described by RFCs +(Request for Comments) 1950 to 1952 in the files +http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) +and rfc1952.txt (gzip format). + +All functions of the compression library are documented in the file zlib.h +(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example +of the library is given in the file example.c which also tests that the library +is working correctly. Another example is given in the file minigzip.c. The +compression library itself is composed of all source files except example.c and +minigzip.c. + +To compile all files and run the test program, follow the instructions given at +the top of Makefile.in. In short "./configure; make test", and if that goes +well, "make install" should work for most flavors of Unix. For Windows, use one +of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use +make_vms.com. + +Questions about zlib should be sent to , or to Gilles Vollant + for the Windows DLL version. The zlib home page is +http://zlib.net/ . Before reporting a problem, please check this site to +verify that you have the latest version of zlib; otherwise get the latest +version and check whether the problem still exists or not. + +PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. + +Mark Nelson wrote an article about zlib for the Jan. 1997 +issue of Dr. Dobb's Journal; a copy of the article is available at +http://marknelson.us/1997/01/01/zlib-engine/ . + +The changes made in version 1.2.5 are documented in the file ChangeLog. + +Unsupported third party contributions are provided in directory contrib/ . + +zlib is available in Java using the java.util.zip package, documented at +http://java.sun.com/developer/technicalArticles/Programming/compression/ . + +A Perl interface to zlib written by Paul Marquess is available +at CPAN (Comprehensive Perl Archive Network) sites, including +http://search.cpan.org/~pmqs/IO-Compress-Zlib/ . + +A Python interface to zlib written by A.M. Kuchling is +available in Python 1.5 and later versions, see +http://www.python.org/doc/lib/module-zlib.html . + +zlib is built into tcl: http://wiki.tcl.tk/4610 . + +An experimental package to read and write files in .zip format, written on top +of zlib by Gilles Vollant , is available in the +contrib/minizip directory of zlib. + + +Notes for some targets: + +- For Windows DLL versions, please see win32/DLL_FAQ.txt + +- For 64-bit Irix, deflate.c must be compiled without any optimization. With + -O, one libpng test fails. The test works in 32 bit mode (with the -n32 + compiler flag). The compiler bug has been reported to SGI. + +- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works + when compiled with cc. + +- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is + necessary to get gzprintf working correctly. This is done by configure. + +- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with + other compilers. Use "make test" to check your compiler. + +- gzdopen is not supported on RISCOS or BEOS. + +- For PalmOs, see http://palmzlib.sourceforge.net/ + + +Acknowledgments: + + The deflate format used by zlib was defined by Phil Katz. The deflate and + zlib specifications were written by L. Peter Deutsch. Thanks to all the + people who reported problems and suggested various improvements in zlib; they + are too numerous to cite here. + +Copyright notice: + + (C) 1995-2010 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving +lengthy legal documents to sign. The sources are provided for free but without +warranty of any kind. The library has been entirely written by Jean-loup +Gailly and Mark Adler; it does not include third-party code. + +If you redistribute modified sources, we would appreciate that you include in +the file ChangeLog history information documenting your changes. Please read +the FAQ for more information on the distribution of modified source versions. diff --git a/zlib/adler32.c b/zlib/adler32.c new file mode 100644 index 0000000..65ad6a5 --- /dev/null +++ b/zlib/adler32.c @@ -0,0 +1,169 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2007 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" + +#define local static + +local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2); + +#define BASE 65521UL /* largest prime smaller than 65536 */ +#define NMAX 5552 +/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ + +#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} +#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); +#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); +#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); +#define DO16(buf) DO8(buf,0); DO8(buf,8); + +/* use NO_DIVIDE if your processor does not do division in hardware */ +#ifdef NO_DIVIDE +# define MOD(a) \ + do { \ + if (a >= (BASE << 16)) a -= (BASE << 16); \ + if (a >= (BASE << 15)) a -= (BASE << 15); \ + if (a >= (BASE << 14)) a -= (BASE << 14); \ + if (a >= (BASE << 13)) a -= (BASE << 13); \ + if (a >= (BASE << 12)) a -= (BASE << 12); \ + if (a >= (BASE << 11)) a -= (BASE << 11); \ + if (a >= (BASE << 10)) a -= (BASE << 10); \ + if (a >= (BASE << 9)) a -= (BASE << 9); \ + if (a >= (BASE << 8)) a -= (BASE << 8); \ + if (a >= (BASE << 7)) a -= (BASE << 7); \ + if (a >= (BASE << 6)) a -= (BASE << 6); \ + if (a >= (BASE << 5)) a -= (BASE << 5); \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +# define MOD4(a) \ + do { \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +#else +# define MOD(a) a %= BASE +# define MOD4(a) a %= BASE +#endif + +/* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + unsigned long sum2; + unsigned n; + + /* split Adler-32 into component sums */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (len == 1) { + adler += buf[0]; + if (adler >= BASE) + adler -= BASE; + sum2 += adler; + if (sum2 >= BASE) + sum2 -= BASE; + return adler | (sum2 << 16); + } + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (buf == Z_NULL) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (len < 16) { + while (len--) { + adler += *buf++; + sum2 += adler; + } + if (adler >= BASE) + adler -= BASE; + MOD4(sum2); /* only added so many BASE's */ + return adler | (sum2 << 16); + } + + /* do length NMAX blocks -- requires just one modulo operation */ + while (len >= NMAX) { + len -= NMAX; + n = NMAX / 16; /* NMAX is divisible by 16 */ + do { + DO16(buf); /* 16 sums unrolled */ + buf += 16; + } while (--n); + MOD(adler); + MOD(sum2); + } + + /* do remaining bytes (less than NMAX, still just one modulo) */ + if (len) { /* avoid modulos if none remaining */ + while (len >= 16) { + len -= 16; + DO16(buf); + buf += 16; + } + while (len--) { + adler += *buf++; + sum2 += adler; + } + MOD(adler); + MOD(sum2); + } + + /* return recombined sums */ + return adler | (sum2 << 16); +} + +/* ========================================================================= */ +local uLong adler32_combine_(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off64_t len2; +{ + unsigned long sum1; + unsigned long sum2; + unsigned rem; + + /* the derivation of this formula is left as an exercise for the reader */ + rem = (unsigned)(len2 % BASE); + sum1 = adler1 & 0xffff; + sum2 = rem * sum1; + MOD(sum2); + sum1 += (adler2 & 0xffff) + BASE - 1; + sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; + if (sum1 >= BASE) sum1 -= BASE; + if (sum1 >= BASE) sum1 -= BASE; + if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); + if (sum2 >= BASE) sum2 -= BASE; + return sum1 | (sum2 << 16); +} + +/* ========================================================================= */ +uLong ZEXPORT adler32_combine(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off_t len2; +{ + return adler32_combine_(adler1, adler2, len2); +} + +uLong ZEXPORT adler32_combine64(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off64_t len2; +{ + return adler32_combine_(adler1, adler2, len2); +} diff --git a/zlib/compress.c b/zlib/compress.c new file mode 100644 index 0000000..ea4dfbe --- /dev/null +++ b/zlib/compress.c @@ -0,0 +1,80 @@ +/* compress.c -- compress a memory buffer + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ +int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; + int level; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; +#ifdef MAXSEG_64K + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; +#endif + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + stream.opaque = (voidpf)0; + + err = deflateInit(&stream, level); + if (err != Z_OK) return err; + + err = deflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + deflateEnd(&stream); + return err == Z_OK ? Z_BUF_ERROR : err; + } + *destLen = stream.total_out; + + err = deflateEnd(&stream); + return err; +} + +/* =========================================================================== + */ +int ZEXPORT compress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); +} + +/* =========================================================================== + If the default memLevel or windowBits for deflateInit() is changed, then + this function needs to be updated. + */ +uLong ZEXPORT compressBound (sourceLen) + uLong sourceLen; +{ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + + (sourceLen >> 25) + 13; +} diff --git a/zlib/configure b/zlib/configure new file mode 100644 index 0000000..bd9edd2 --- /dev/null +++ b/zlib/configure @@ -0,0 +1,596 @@ +#!/bin/sh +# configure script for zlib. +# +# Normally configure builds both a static and a shared library. +# If you want to build just a static library, use: ./configure --static +# +# To impose specific compiler or flags or install directory, use for example: +# prefix=$HOME CC=cc CFLAGS="-O4" ./configure +# or for csh/tcsh users: +# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure) + +# Incorrect settings of CC or CFLAGS may prevent creating a shared library. +# If you have problems, try without defining CC and CFLAGS before reporting +# an error. + +if [ -n "${CHOST}" ]; then + uname="$(echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/')" + CROSS_PREFIX="${CHOST}-" +fi + +STATICLIB=libz.a +LDFLAGS="${LDFLAGS} -L. ${STATICLIB}" +VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` +VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h` +VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h` +VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h` +if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then + AR=${AR-"${CROSS_PREFIX}ar"} + test -n "${CROSS_PREFIX}" && echo Using ${AR} +else + AR=${AR-"ar"} + test -n "${CROSS_PREFIX}" && echo Using ${AR} +fi +AR_RC="${AR} rc" +if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then + RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"} + test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} +else + RANLIB=${RANLIB-"ranlib"} +fi +if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then + NM=${NM-"${CROSS_PREFIX}nm"} + test -n "${CROSS_PREFIX}" && echo Using ${NM} +else + NM=${NM-"nm"} +fi +LDCONFIG=${LDCONFIG-"ldconfig"} +LDSHAREDLIBC="${LDSHAREDLIBC--lc}" +prefix=${prefix-/usr/local} +exec_prefix=${exec_prefix-'${prefix}'} +libdir=${libdir-'${exec_prefix}/lib'} +sharedlibdir=${sharedlibdir-'${libdir}'} +includedir=${includedir-'${prefix}/include'} +mandir=${mandir-'${prefix}/share/man'} +shared_ext='.so' +shared=1 +zprefix=0 +build64=0 +gcc=0 +old_cc="$CC" +old_cflags="$CFLAGS" + +while test $# -ge 1 +do +case "$1" in + -h* | --help) + echo 'usage:' + echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' + echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' + echo ' [--includedir=INCLUDEDIR]' + exit 0 ;; + -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; + -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; + -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;; + --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;; + -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;; + -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;; + -p* | --prefix) prefix="$2"; shift; shift ;; + -e* | --eprefix) exec_prefix="$2"; shift; shift ;; + -l* | --libdir) libdir="$2"; shift; shift ;; + -i* | --includedir) includedir="$2"; shift; shift ;; + -s* | --shared | --enable-shared) shared=1; shift ;; + -t | --static) shared=0; shift ;; + -z* | --zprefix) zprefix=1; shift ;; + -6* | --64) build64=1; shift ;; + --sysconfdir=*) echo "ignored option: --sysconfdir"; shift ;; + --localstatedir=*) echo "ignored option: --localstatedir"; shift ;; + *) echo "unknown option: $1"; echo "$0 --help for help"; exit 1 ;; + esac +done + +test=ztest$$ +cat > $test.c </dev/null; then + CC="$cc" + SFLAGS="${CFLAGS--O3} -fPIC" + CFLAGS="${CFLAGS--O3}" + if test $build64 -eq 1; then + CFLAGS="${CFLAGS} -m64" + SFLAGS="${SFLAGS} -m64" + fi + if test "${ZLIBGCCWARN}" = "YES"; then + CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" + fi + if test -z "$uname"; then + uname=`(uname -s || echo unknown) 2>/dev/null` + fi + case "$uname" in + Linux* | linux* | GNU | GNU/* | *BSD | DragonFly) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;; + CYGWIN* | Cygwin* | cygwin* | OS/2*) + EXE='.exe' ;; + MINGW*|mingw*) +# temporary bypass + rm -f $test.[co] $test $test$shared_ext + echo "Please use win32/Makefile.gcc instead." + exit 1 + LDSHARED=${LDSHARED-"$cc -shared"} + LDSHAREDLIBC="" + EXE='.exe' ;; + QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 + # (alain.bonnefoy@icbt.com) + LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; + HP-UX*) + LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} + case `(uname -m || echo unknown) 2>/dev/null` in + ia64) + shared_ext='.so' + SHAREDLIB='libz.so' ;; + *) + shared_ext='.sl' + SHAREDLIB='libz.sl' ;; + esac ;; + Darwin*) shared_ext='.dylib' + SHAREDLIB=libz$shared_ext + SHAREDLIBV=libz.$VER$shared_ext + SHAREDLIBM=libz.$VER1$shared_ext + LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} ;; + *) LDSHARED=${LDSHARED-"$cc -shared"} ;; + esac +else + # find system name and corresponding cc options + CC=${CC-cc} + gcc=0 + if test -z "$uname"; then + uname=`(uname -sr || echo unknown) 2>/dev/null` + fi + case "$uname" in + HP-UX*) SFLAGS=${CFLAGS-"-O +z"} + CFLAGS=${CFLAGS-"-O"} +# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} + LDSHARED=${LDSHARED-"ld -b"} + case `(uname -m || echo unknown) 2>/dev/null` in + ia64) + shared_ext='.so' + SHAREDLIB='libz.so' ;; + *) + shared_ext='.sl' + SHAREDLIB='libz.sl' ;; + esac ;; + IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} + CFLAGS=${CFLAGS-"-ansi -O2"} + LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; + OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"} + CFLAGS=${CFLAGS-"-O -std1"} + LDFLAGS="${LDFLAGS} -Wl,-rpath,." + LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;; + OSF1*) SFLAGS=${CFLAGS-"-O -std1"} + CFLAGS=${CFLAGS-"-O -std1"} + LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; + QNX*) SFLAGS=${CFLAGS-"-4 -O"} + CFLAGS=${CFLAGS-"-4 -O"} + LDSHARED=${LDSHARED-"cc"} + RANLIB=${RANLIB-"true"} + AR_RC="cc -A" ;; + SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "} + CFLAGS=${CFLAGS-"-O3"} + LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;; + SunOS\ 5*) LDSHARED=${LDSHARED-"cc -G"} + case `(uname -m || echo unknown) 2>/dev/null` in + i86*) + SFLAGS=${CFLAGS-"-xpentium -fast -KPIC -R."} + CFLAGS=${CFLAGS-"-xpentium -fast"} ;; + *) + SFLAGS=${CFLAGS-"-fast -xcg92 -KPIC -R."} + CFLAGS=${CFLAGS-"-fast -xcg92"} ;; + esac ;; + SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} + CFLAGS=${CFLAGS-"-O2"} + LDSHARED=${LDSHARED-"ld"} ;; + SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"} + CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"} + LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;; + UNIX_System_V\ 4.2.0) + SFLAGS=${CFLAGS-"-KPIC -O"} + CFLAGS=${CFLAGS-"-O"} + LDSHARED=${LDSHARED-"cc -G"} ;; + UNIX_SV\ 4.2MP) + SFLAGS=${CFLAGS-"-Kconform_pic -O"} + CFLAGS=${CFLAGS-"-O"} + LDSHARED=${LDSHARED-"cc -G"} ;; + OpenUNIX\ 5) + SFLAGS=${CFLAGS-"-KPIC -O"} + CFLAGS=${CFLAGS-"-O"} + LDSHARED=${LDSHARED-"cc -G"} ;; + AIX*) # Courtesy of dbakker@arrayasolutions.com + SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} + CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} + LDSHARED=${LDSHARED-"xlc -G"} ;; + # send working options for other systems to zlib@gzip.org + *) SFLAGS=${CFLAGS-"-O"} + CFLAGS=${CFLAGS-"-O"} + LDSHARED=${LDSHARED-"cc -shared"} ;; + esac +fi + +SHAREDLIB=${SHAREDLIB-"libz$shared_ext"} +SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} +SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} + +if test $shared -eq 1; then + echo Checking for shared library support... + # we must test in two steps (cc then ld), required at least on SunOS 4.x + if test "`($CC -w -c $SFLAGS $test.c) 2>&1`" = "" && + test "`($LDSHARED $SFLAGS -o $test$shared_ext $test.o) 2>&1`" = ""; then + echo Building shared library $SHAREDLIBV with $CC. + elif test -z "$old_cc" -a -z "$old_cflags"; then + echo No shared library support. + shared=0; + else + echo Tested $CC -w -c $SFLAGS $test.c + $CC -w -c $SFLAGS $test.c + echo Tested $LDSHARED $SFLAGS -o $test$shared_ext $test.o + $LDSHARED $SFLAGS -o $test$shared_ext $test.o + echo 'No shared library support; try without defining CC and CFLAGS' + shared=0; + fi +fi +if test $shared -eq 0; then + LDSHARED="$CC" + ALL="static" + TEST="all teststatic" + SHAREDLIB="" + SHAREDLIBV="" + SHAREDLIBM="" + echo Building static library $STATICLIB version $VER with $CC. +else + ALL="static shared" + TEST="all teststatic testshared" +fi + +cat > $test.c < +off64_t dummy = 0; +EOF +if test "`($CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c) 2>&1`" = ""; then + CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" + SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" + ALL="${ALL} all64" + TEST="${TEST} test64" + echo "Checking for off64_t... Yes." + echo "Checking for fseeko... Yes." +else + echo "Checking for off64_t... No." + cat > $test.c < +int main(void) { + fseeko(NULL, 0, 0); + return 0; +} +EOF + if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then + echo "Checking for fseeko... Yes." + else + CFLAGS="${CFLAGS} -DNO_FSEEKO" + SFLAGS="${SFLAGS} -DNO_FSEEKO" + echo "Checking for fseeko... No." + fi +fi + +cp -p zconf.h.in zconf.h + +cat > $test.c < +int main() { return 0; } +EOF +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h + mv zconf.temp.h zconf.h + echo "Checking for unistd.h... Yes." +else + echo "Checking for unistd.h... No." +fi + +if test $zprefix -eq 1; then + sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h + mv zconf.temp.h zconf.h + echo "Using z_ prefix on all symbols." +fi + +cat > $test.c < +#include +#include "zconf.h" + +int main() +{ +#ifndef STDC + choke me +#endif + + return 0; +} +EOF + +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." + + cat > $test.c < +#include + +int mytest(const char *fmt, ...) +{ + char buf[20]; + va_list ap; + + va_start(ap, fmt); + vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + return 0; +} + +int main() +{ + return (mytest("Hello%d\n", 1)); +} +EOF + + if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then + echo "Checking for vsnprintf() in stdio.h... Yes." + + cat >$test.c < +#include + +int mytest(const char *fmt, ...) +{ + int n; + char buf[20]; + va_list ap; + + va_start(ap, fmt); + n = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + return n; +} + +int main() +{ + return (mytest("Hello%d\n", 1)); +} +EOF + + if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + echo "Checking for return value of vsnprintf()... Yes." + else + CFLAGS="$CFLAGS -DHAS_vsnprintf_void" + SFLAGS="$SFLAGS -DHAS_vsnprintf_void" + echo "Checking for return value of vsnprintf()... No." + echo " WARNING: apparently vsnprintf() does not return a value. zlib" + echo " can build but will be open to possible string-format security" + echo " vulnerabilities." + fi + else + CFLAGS="$CFLAGS -DNO_vsnprintf" + SFLAGS="$SFLAGS -DNO_vsnprintf" + echo "Checking for vsnprintf() in stdio.h... No." + echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" + echo " can build but will be open to possible buffer-overflow security" + echo " vulnerabilities." + + cat >$test.c < +#include + +int mytest(const char *fmt, ...) +{ + int n; + char buf[20]; + va_list ap; + + va_start(ap, fmt); + n = vsprintf(buf, fmt, ap); + va_end(ap); + return n; +} + +int main() +{ + return (mytest("Hello%d\n", 1)); +} +EOF + + if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + echo "Checking for return value of vsprintf()... Yes." + else + CFLAGS="$CFLAGS -DHAS_vsprintf_void" + SFLAGS="$SFLAGS -DHAS_vsprintf_void" + echo "Checking for return value of vsprintf()... No." + echo " WARNING: apparently vsprintf() does not return a value. zlib" + echo " can build but will be open to possible string-format security" + echo " vulnerabilities." + fi + fi +else + echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." + + cat >$test.c < + +int mytest() +{ + char buf[20]; + + snprintf(buf, sizeof(buf), "%s", "foo"); + return 0; +} + +int main() +{ + return (mytest()); +} +EOF + + if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then + echo "Checking for snprintf() in stdio.h... Yes." + + cat >$test.c < + +int mytest() +{ + char buf[20]; + + return snprintf(buf, sizeof(buf), "%s", "foo"); +} + +int main() +{ + return (mytest()); +} +EOF + + if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + echo "Checking for return value of snprintf()... Yes." + else + CFLAGS="$CFLAGS -DHAS_snprintf_void" + SFLAGS="$SFLAGS -DHAS_snprintf_void" + echo "Checking for return value of snprintf()... No." + echo " WARNING: apparently snprintf() does not return a value. zlib" + echo " can build but will be open to possible string-format security" + echo " vulnerabilities." + fi + else + CFLAGS="$CFLAGS -DNO_snprintf" + SFLAGS="$SFLAGS -DNO_snprintf" + echo "Checking for snprintf() in stdio.h... No." + echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" + echo " can build but will be open to possible buffer-overflow security" + echo " vulnerabilities." + + cat >$test.c < + +int mytest() +{ + char buf[20]; + + return sprintf(buf, "%s", "foo"); +} + +int main() +{ + return (mytest()); +} +EOF + + if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + echo "Checking for return value of sprintf()... Yes." + else + CFLAGS="$CFLAGS -DHAS_sprintf_void" + SFLAGS="$SFLAGS -DHAS_sprintf_void" + echo "Checking for return value of sprintf()... No." + echo " WARNING: apparently sprintf() does not return a value. zlib" + echo " can build but will be open to possible string-format security" + echo " vulnerabilities." + fi + fi +fi + +if test "$gcc" -eq 1; then + cat > $test.c <= 33) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif +int ZLIB_INTERNAL foo; +int main() +{ + return 0; +} +EOF + if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then + echo "Checking for attribute(visibility) support... Yes." + else + CFLAGS="$CFLAGS -DNO_VIZ" + SFLAGS="$SFLAGS -DNO_VIZ" + echo "Checking for attribute(visibility) support... No." + fi +fi + +CPP=${CPP-"$CC -E"} +case $CFLAGS in + *ASMV*) + if test "`$NM $test.o | grep _hello`" = ""; then + CPP="$CPP -DNO_UNDERLINE" + echo Checking for underline in external names... No. + else + echo Checking for underline in external names... Yes. + fi ;; +esac + +rm -f $test.[co] $test $test$shared_ext + +# udpate Makefile +sed < Makefile.in " +/^CC *=/s#=.*#=$CC# +/^CFLAGS *=/s#=.*#=$CFLAGS# +/^SFLAGS *=/s#=.*#=$SFLAGS# +/^LDFLAGS *=/s#=.*#=$LDFLAGS# +/^LDSHARED *=/s#=.*#=$LDSHARED# +/^CPP *=/s#=.*#=$CPP# +/^STATICLIB *=/s#=.*#=$STATICLIB# +/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# +/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# +/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# +/^AR *=/s#=.*#=$AR_RC# +/^RANLIB *=/s#=.*#=$RANLIB# +/^LDCONFIG *=/s#=.*#=$LDCONFIG# +/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC# +/^EXE *=/s#=.*#=$EXE# +/^prefix *=/s#=.*#=$prefix# +/^exec_prefix *=/s#=.*#=$exec_prefix# +/^libdir *=/s#=.*#=$libdir# +/^sharedlibdir *=/s#=.*#=$sharedlibdir# +/^includedir *=/s#=.*#=$includedir# +/^mandir *=/s#=.*#=$mandir# +/^all: */s#:.*#: $ALL# +/^test: */s#:.*#: $TEST# +" > Makefile + +sed < zlib.pc.in " +/^CC *=/s#=.*#=$CC# +/^CFLAGS *=/s#=.*#=$CFLAGS# +/^CPP *=/s#=.*#=$CPP# +/^LDSHARED *=/s#=.*#=$LDSHARED# +/^STATICLIB *=/s#=.*#=$STATICLIB# +/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# +/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# +/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# +/^AR *=/s#=.*#=$AR_RC# +/^RANLIB *=/s#=.*#=$RANLIB# +/^EXE *=/s#=.*#=$EXE# +/^prefix *=/s#=.*#=$prefix# +/^exec_prefix *=/s#=.*#=$exec_prefix# +/^libdir *=/s#=.*#=$libdir# +/^sharedlibdir *=/s#=.*#=$sharedlibdir# +/^includedir *=/s#=.*#=$includedir# +/^mandir *=/s#=.*#=$mandir# +/^LDFLAGS *=/s#=.*#=$LDFLAGS# +" | sed -e " +s/\@VERSION\@/$VER/g; +" > zlib.pc diff --git a/zlib/contrib/README.contrib b/zlib/contrib/README.contrib new file mode 100644 index 0000000..dd2285d --- /dev/null +++ b/zlib/contrib/README.contrib @@ -0,0 +1,77 @@ +All files under this contrib directory are UNSUPPORTED. There were +provided by users of zlib and were not tested by the authors of zlib. +Use at your own risk. Please contact the authors of the contributions +for help about these, not the zlib authors. Thanks. + + +ada/ by Dmitriy Anisimkov + Support for Ada + See http://zlib-ada.sourceforge.net/ + +amd64/ by Mikhail Teterin + asm code for AMD64 + See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393 + +asm686/ by Brian Raiter + asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax + See http://www.muppetlabs.com/~breadbox/software/assembly.html + +blast/ by Mark Adler + Decompressor for output of PKWare Data Compression Library (DCL) + +delphi/ by Cosmin Truta + Support for Delphi and C++ Builder + +dotzlib/ by Henrik Ravn + Support for Microsoft .Net and Visual C++ .Net + +gcc_gvmat64/by Gilles Vollant + GCC Version of x86 64-bit (AMD64 and Intel EM64t) code for x64 + assembler to replace longest_match() and inflate_fast() + +infback9/ by Mark Adler + Unsupported diffs to infback to decode the deflate64 format + +inflate86/ by Chris Anderson + Tuned x86 gcc asm code to replace inflate_fast() + +iostream/ by Kevin Ruland + A C++ I/O streams interface to the zlib gz* functions + +iostream2/ by Tyge Lvset + Another C++ I/O streams interface + +iostream3/ by Ludwig Schwardt + and Kevin Ruland + Yet another C++ I/O streams interface + +masmx64/ by Gilles Vollant + x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to + replace longest_match() and inflate_fast(), also masm x86 + 64-bits translation of Chris Anderson inflate_fast() + +masmx86/ by Gilles Vollant + x86 asm code to replace longest_match() and inflate_fast(), + for Visual C++ and MASM (32 bits). + Based on Brian Raiter (asm686) and Chris Anderson (inflate86) + +minizip/ by Gilles Vollant + Mini zip and unzip based on zlib + Includes Zip64 support by Mathias Svensson + See http://www.winimage.com/zLibDll/unzip.html + +pascal/ by Bob Dellaca et al. + Support for Pascal + +puff/ by Mark Adler + Small, low memory usage inflate. Also serves to provide an + unambiguous description of the deflate format. + +testzlib/ by Gilles Vollant + Example of the use of zlib + +untgz/ by Pedro A. Aranda Gutierrez + A very simple tar.gz file extractor using zlib + +vstudio/ by Gilles Vollant + Building a minizip-enhanced zlib with Microsoft Visual Studio diff --git a/zlib/contrib/masmx86/bld_ml32.bat b/zlib/contrib/masmx86/bld_ml32.bat new file mode 100644 index 0000000..fcf5755 --- /dev/null +++ b/zlib/contrib/masmx86/bld_ml32.bat @@ -0,0 +1,2 @@ +ml /coff /Zi /c /Flmatch686.lst match686.asm +ml /coff /Zi /c /Flinffas32.lst inffas32.asm diff --git a/zlib/contrib/masmx86/inffas32.asm b/zlib/contrib/masmx86/inffas32.asm new file mode 100644 index 0000000..14f9d35 --- /dev/null +++ b/zlib/contrib/masmx86/inffas32.asm @@ -0,0 +1,1083 @@ +;/* inffas32.asm is a hand tuned assembler version of inffast.c -- fast decoding +; * +; * inffas32.asm is derivated from inffas86.c, with translation of assembly code +; * +; * Copyright (C) 1995-2003 Mark Adler +; * For conditions of distribution and use, see copyright notice in zlib.h +; * +; * Copyright (C) 2003 Chris Anderson +; * Please use the copyright conditions above. +; * +; * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from +; * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at +; * the moment. I have successfully compiled and tested this code with gcc2.96, +; * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S +; * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX +; * enabled. I will attempt to merge the MMX code into this version. Newer +; * versions of this and inffast.S can be found at +; * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/ +; * +; * 2005 : modification by Gilles Vollant +; */ +; For Visual C++ 4.x and higher and ML 6.x and higher +; ml.exe is in directory \MASM611C of Win95 DDK +; ml.exe is also distributed in http://www.masm32.com/masmdl.htm +; and in VC++2003 toolkit at http://msdn.microsoft.com/visualc/vctoolkit2003/ +; +; +; compile with command line option +; ml /coff /Zi /c /Flinffas32.lst inffas32.asm + +; if you define NO_GZIP (see inflate.h), compile with +; ml /coff /Zi /c /Flinffas32.lst /DNO_GUNZIP inffas32.asm + + +; zlib122sup is 0 fort zlib 1.2.2.1 and lower +; zlib122sup is 8 fort zlib 1.2.2.2 and more (with addition of dmax and head +; in inflate_state in inflate.h) +zlib1222sup equ 8 + + +IFDEF GUNZIP + INFLATE_MODE_TYPE equ 11 + INFLATE_MODE_BAD equ 26 +ELSE + IFNDEF NO_GUNZIP + INFLATE_MODE_TYPE equ 11 + INFLATE_MODE_BAD equ 26 + ELSE + INFLATE_MODE_TYPE equ 3 + INFLATE_MODE_BAD equ 17 + ENDIF +ENDIF + + +; 75 "inffast.S" +;FILE "inffast.S" + +;;;GLOBAL _inflate_fast + +;;;SECTION .text + + + + .586p + .mmx + + name inflate_fast_x86 + .MODEL FLAT + +_DATA segment +inflate_fast_use_mmx: + dd 1 + + +_TEXT segment +PUBLIC _inflate_fast + +ALIGN 4 +_inflate_fast: + jmp inflate_fast_entry + + + +ALIGN 4 + db 'Fast decoding Code from Chris Anderson' + db 0 + +ALIGN 4 +invalid_literal_length_code_msg: + db 'invalid literal/length code' + db 0 + +ALIGN 4 +invalid_distance_code_msg: + db 'invalid distance code' + db 0 + +ALIGN 4 +invalid_distance_too_far_msg: + db 'invalid distance too far back' + db 0 + + +ALIGN 4 +inflate_fast_mask: +dd 0 +dd 1 +dd 3 +dd 7 +dd 15 +dd 31 +dd 63 +dd 127 +dd 255 +dd 511 +dd 1023 +dd 2047 +dd 4095 +dd 8191 +dd 16383 +dd 32767 +dd 65535 +dd 131071 +dd 262143 +dd 524287 +dd 1048575 +dd 2097151 +dd 4194303 +dd 8388607 +dd 16777215 +dd 33554431 +dd 67108863 +dd 134217727 +dd 268435455 +dd 536870911 +dd 1073741823 +dd 2147483647 +dd 4294967295 + + +mode_state equ 0 ;/* state->mode */ +wsize_state equ (32+zlib1222sup) ;/* state->wsize */ +write_state equ (36+4+zlib1222sup) ;/* state->write */ +window_state equ (40+4+zlib1222sup) ;/* state->window */ +hold_state equ (44+4+zlib1222sup) ;/* state->hold */ +bits_state equ (48+4+zlib1222sup) ;/* state->bits */ +lencode_state equ (64+4+zlib1222sup) ;/* state->lencode */ +distcode_state equ (68+4+zlib1222sup) ;/* state->distcode */ +lenbits_state equ (72+4+zlib1222sup) ;/* state->lenbits */ +distbits_state equ (76+4+zlib1222sup) ;/* state->distbits */ + + +;;SECTION .text +; 205 "inffast.S" +;GLOBAL inflate_fast_use_mmx + +;SECTION .data + + +; GLOBAL inflate_fast_use_mmx:object +;.size inflate_fast_use_mmx, 4 +; 226 "inffast.S" +;SECTION .text + +ALIGN 4 +inflate_fast_entry: + push edi + push esi + push ebp + push ebx + pushfd + sub esp,64 + cld + + + + + mov esi, [esp+88] + mov edi, [esi+28] + + + + + + + + mov edx, [esi+4] + mov eax, [esi+0] + + add edx,eax + sub edx,11 + + mov [esp+44],eax + mov [esp+20],edx + + mov ebp, [esp+92] + mov ecx, [esi+16] + mov ebx, [esi+12] + + sub ebp,ecx + neg ebp + add ebp,ebx + + sub ecx,257 + add ecx,ebx + + mov [esp+60],ebx + mov [esp+40],ebp + mov [esp+16],ecx +; 285 "inffast.S" + mov eax, [edi+lencode_state] + mov ecx, [edi+distcode_state] + + mov [esp+8],eax + mov [esp+12],ecx + + mov eax,1 + mov ecx, [edi+lenbits_state] + shl eax,cl + dec eax + mov [esp+0],eax + + mov eax,1 + mov ecx, [edi+distbits_state] + shl eax,cl + dec eax + mov [esp+4],eax + + mov eax, [edi+wsize_state] + mov ecx, [edi+write_state] + mov edx, [edi+window_state] + + mov [esp+52],eax + mov [esp+48],ecx + mov [esp+56],edx + + mov ebp, [edi+hold_state] + mov ebx, [edi+bits_state] +; 321 "inffast.S" + mov esi, [esp+44] + mov ecx, [esp+20] + cmp ecx,esi + ja L_align_long + + add ecx,11 + sub ecx,esi + mov eax,12 + sub eax,ecx + lea edi, [esp+28] + rep movsb + mov ecx,eax + xor eax,eax + rep stosb + lea esi, [esp+28] + mov [esp+20],esi + jmp L_is_aligned + + +L_align_long: + test esi,3 + jz L_is_aligned + xor eax,eax + mov al, [esi] + inc esi + mov ecx,ebx + add ebx,8 + shl eax,cl + or ebp,eax + jmp L_align_long + +L_is_aligned: + mov edi, [esp+60] +; 366 "inffast.S" +L_check_mmx: + cmp dword ptr [inflate_fast_use_mmx],2 + je L_init_mmx + ja L_do_loop + + push eax + push ebx + push ecx + push edx + pushfd + mov eax, [esp] + xor dword ptr [esp],0200000h + + + + + popfd + pushfd + pop edx + xor edx,eax + jz L_dont_use_mmx + xor eax,eax + cpuid + cmp ebx,0756e6547h + jne L_dont_use_mmx + cmp ecx,06c65746eh + jne L_dont_use_mmx + cmp edx,049656e69h + jne L_dont_use_mmx + mov eax,1 + cpuid + shr eax,8 + and eax,15 + cmp eax,6 + jne L_dont_use_mmx + test edx,0800000h + jnz L_use_mmx + jmp L_dont_use_mmx +L_use_mmx: + mov dword ptr [inflate_fast_use_mmx],2 + jmp L_check_mmx_pop +L_dont_use_mmx: + mov dword ptr [inflate_fast_use_mmx],3 +L_check_mmx_pop: + pop edx + pop ecx + pop ebx + pop eax + jmp L_check_mmx +; 426 "inffast.S" +ALIGN 4 +L_do_loop: +; 437 "inffast.S" + cmp bl,15 + ja L_get_length_code + + xor eax,eax + lodsw + mov cl,bl + add bl,16 + shl eax,cl + or ebp,eax + +L_get_length_code: + mov edx, [esp+0] + mov ecx, [esp+8] + and edx,ebp + mov eax, [ecx+edx*4] + +L_dolen: + + + + + + + mov cl,ah + sub bl,ah + shr ebp,cl + + + + + + + test al,al + jnz L_test_for_length_base + + shr eax,16 + stosb + +L_while_test: + + + cmp [esp+16],edi + jbe L_break_loop + + cmp [esp+20],esi + ja L_do_loop + jmp L_break_loop + +L_test_for_length_base: +; 502 "inffast.S" + mov edx,eax + shr edx,16 + mov cl,al + + test al,16 + jz L_test_for_second_level_length + and cl,15 + jz L_save_len + cmp bl,cl + jae L_add_bits_to_len + + mov ch,cl + xor eax,eax + lodsw + mov cl,bl + add bl,16 + shl eax,cl + or ebp,eax + mov cl,ch + +L_add_bits_to_len: + mov eax,1 + shl eax,cl + dec eax + sub bl,cl + and eax,ebp + shr ebp,cl + add edx,eax + +L_save_len: + mov [esp+24],edx + + +L_decode_distance: +; 549 "inffast.S" + cmp bl,15 + ja L_get_distance_code + + xor eax,eax + lodsw + mov cl,bl + add bl,16 + shl eax,cl + or ebp,eax + +L_get_distance_code: + mov edx, [esp+4] + mov ecx, [esp+12] + and edx,ebp + mov eax, [ecx+edx*4] + + +L_dodist: + mov edx,eax + shr edx,16 + mov cl,ah + sub bl,ah + shr ebp,cl +; 584 "inffast.S" + mov cl,al + + test al,16 + jz L_test_for_second_level_dist + and cl,15 + jz L_check_dist_one + cmp bl,cl + jae L_add_bits_to_dist + + mov ch,cl + xor eax,eax + lodsw + mov cl,bl + add bl,16 + shl eax,cl + or ebp,eax + mov cl,ch + +L_add_bits_to_dist: + mov eax,1 + shl eax,cl + dec eax + sub bl,cl + and eax,ebp + shr ebp,cl + add edx,eax + jmp L_check_window + +L_check_window: +; 625 "inffast.S" + mov [esp+44],esi + mov eax,edi + sub eax, [esp+40] + + cmp eax,edx + jb L_clip_window + + mov ecx, [esp+24] + mov esi,edi + sub esi,edx + + sub ecx,3 + mov al, [esi] + mov [edi],al + mov al, [esi+1] + mov dl, [esi+2] + add esi,3 + mov [edi+1],al + mov [edi+2],dl + add edi,3 + rep movsb + + mov esi, [esp+44] + jmp L_while_test + +ALIGN 4 +L_check_dist_one: + cmp edx,1 + jne L_check_window + cmp [esp+40],edi + je L_check_window + + dec edi + mov ecx, [esp+24] + mov al, [edi] + sub ecx,3 + + mov [edi+1],al + mov [edi+2],al + mov [edi+3],al + add edi,4 + rep stosb + + jmp L_while_test + +ALIGN 4 +L_test_for_second_level_length: + + + + + test al,64 + jnz L_test_for_end_of_block + + mov eax,1 + shl eax,cl + dec eax + and eax,ebp + add eax,edx + mov edx, [esp+8] + mov eax, [edx+eax*4] + jmp L_dolen + +ALIGN 4 +L_test_for_second_level_dist: + + + + + test al,64 + jnz L_invalid_distance_code + + mov eax,1 + shl eax,cl + dec eax + and eax,ebp + add eax,edx + mov edx, [esp+12] + mov eax, [edx+eax*4] + jmp L_dodist + +ALIGN 4 +L_clip_window: +; 721 "inffast.S" + mov ecx,eax + mov eax, [esp+52] + neg ecx + mov esi, [esp+56] + + cmp eax,edx + jb L_invalid_distance_too_far + + add ecx,edx + cmp dword ptr [esp+48],0 + jne L_wrap_around_window + + sub eax,ecx + add esi,eax +; 749 "inffast.S" + mov eax, [esp+24] + cmp eax,ecx + jbe L_do_copy1 + + sub eax,ecx + rep movsb + mov esi,edi + sub esi,edx + jmp L_do_copy1 + + cmp eax,ecx + jbe L_do_copy1 + + sub eax,ecx + rep movsb + mov esi,edi + sub esi,edx + jmp L_do_copy1 + +L_wrap_around_window: +; 793 "inffast.S" + mov eax, [esp+48] + cmp ecx,eax + jbe L_contiguous_in_window + + add esi, [esp+52] + add esi,eax + sub esi,ecx + sub ecx,eax + + + mov eax, [esp+24] + cmp eax,ecx + jbe L_do_copy1 + + sub eax,ecx + rep movsb + mov esi, [esp+56] + mov ecx, [esp+48] + cmp eax,ecx + jbe L_do_copy1 + + sub eax,ecx + rep movsb + mov esi,edi + sub esi,edx + jmp L_do_copy1 + +L_contiguous_in_window: +; 836 "inffast.S" + add esi,eax + sub esi,ecx + + + mov eax, [esp+24] + cmp eax,ecx + jbe L_do_copy1 + + sub eax,ecx + rep movsb + mov esi,edi + sub esi,edx + +L_do_copy1: +; 862 "inffast.S" + mov ecx,eax + rep movsb + + mov esi, [esp+44] + jmp L_while_test +; 878 "inffast.S" +ALIGN 4 +L_init_mmx: + emms + + + + + + movd mm0,ebp + mov ebp,ebx +; 896 "inffast.S" + movd mm4,dword ptr [esp+0] + movq mm3,mm4 + movd mm5,dword ptr [esp+4] + movq mm2,mm5 + pxor mm1,mm1 + mov ebx, [esp+8] + jmp L_do_loop_mmx + +ALIGN 4 +L_do_loop_mmx: + psrlq mm0,mm1 + + cmp ebp,32 + ja L_get_length_code_mmx + + movd mm6,ebp + movd mm7,dword ptr [esi] + add esi,4 + psllq mm7,mm6 + add ebp,32 + por mm0,mm7 + +L_get_length_code_mmx: + pand mm4,mm0 + movd eax,mm4 + movq mm4,mm3 + mov eax, [ebx+eax*4] + +L_dolen_mmx: + movzx ecx,ah + movd mm1,ecx + sub ebp,ecx + + test al,al + jnz L_test_for_length_base_mmx + + shr eax,16 + stosb + +L_while_test_mmx: + + + cmp [esp+16],edi + jbe L_break_loop + + cmp [esp+20],esi + ja L_do_loop_mmx + jmp L_break_loop + +L_test_for_length_base_mmx: + + mov edx,eax + shr edx,16 + + test al,16 + jz L_test_for_second_level_length_mmx + and eax,15 + jz L_decode_distance_mmx + + psrlq mm0,mm1 + movd mm1,eax + movd ecx,mm0 + sub ebp,eax + and ecx, [inflate_fast_mask+eax*4] + add edx,ecx + +L_decode_distance_mmx: + psrlq mm0,mm1 + + cmp ebp,32 + ja L_get_dist_code_mmx + + movd mm6,ebp + movd mm7,dword ptr [esi] + add esi,4 + psllq mm7,mm6 + add ebp,32 + por mm0,mm7 + +L_get_dist_code_mmx: + mov ebx, [esp+12] + pand mm5,mm0 + movd eax,mm5 + movq mm5,mm2 + mov eax, [ebx+eax*4] + +L_dodist_mmx: + + movzx ecx,ah + mov ebx,eax + shr ebx,16 + sub ebp,ecx + movd mm1,ecx + + test al,16 + jz L_test_for_second_level_dist_mmx + and eax,15 + jz L_check_dist_one_mmx + +L_add_bits_to_dist_mmx: + psrlq mm0,mm1 + movd mm1,eax + movd ecx,mm0 + sub ebp,eax + and ecx, [inflate_fast_mask+eax*4] + add ebx,ecx + +L_check_window_mmx: + mov [esp+44],esi + mov eax,edi + sub eax, [esp+40] + + cmp eax,ebx + jb L_clip_window_mmx + + mov ecx,edx + mov esi,edi + sub esi,ebx + + sub ecx,3 + mov al, [esi] + mov [edi],al + mov al, [esi+1] + mov dl, [esi+2] + add esi,3 + mov [edi+1],al + mov [edi+2],dl + add edi,3 + rep movsb + + mov esi, [esp+44] + mov ebx, [esp+8] + jmp L_while_test_mmx + +ALIGN 4 +L_check_dist_one_mmx: + cmp ebx,1 + jne L_check_window_mmx + cmp [esp+40],edi + je L_check_window_mmx + + dec edi + mov ecx,edx + mov al, [edi] + sub ecx,3 + + mov [edi+1],al + mov [edi+2],al + mov [edi+3],al + add edi,4 + rep stosb + + mov ebx, [esp+8] + jmp L_while_test_mmx + +ALIGN 4 +L_test_for_second_level_length_mmx: + test al,64 + jnz L_test_for_end_of_block + + and eax,15 + psrlq mm0,mm1 + movd ecx,mm0 + and ecx, [inflate_fast_mask+eax*4] + add ecx,edx + mov eax, [ebx+ecx*4] + jmp L_dolen_mmx + +ALIGN 4 +L_test_for_second_level_dist_mmx: + test al,64 + jnz L_invalid_distance_code + + and eax,15 + psrlq mm0,mm1 + movd ecx,mm0 + and ecx, [inflate_fast_mask+eax*4] + mov eax, [esp+12] + add ecx,ebx + mov eax, [eax+ecx*4] + jmp L_dodist_mmx + +ALIGN 4 +L_clip_window_mmx: + + mov ecx,eax + mov eax, [esp+52] + neg ecx + mov esi, [esp+56] + + cmp eax,ebx + jb L_invalid_distance_too_far + + add ecx,ebx + cmp dword ptr [esp+48],0 + jne L_wrap_around_window_mmx + + sub eax,ecx + add esi,eax + + cmp edx,ecx + jbe L_do_copy1_mmx + + sub edx,ecx + rep movsb + mov esi,edi + sub esi,ebx + jmp L_do_copy1_mmx + + cmp edx,ecx + jbe L_do_copy1_mmx + + sub edx,ecx + rep movsb + mov esi,edi + sub esi,ebx + jmp L_do_copy1_mmx + +L_wrap_around_window_mmx: + + mov eax, [esp+48] + cmp ecx,eax + jbe L_contiguous_in_window_mmx + + add esi, [esp+52] + add esi,eax + sub esi,ecx + sub ecx,eax + + + cmp edx,ecx + jbe L_do_copy1_mmx + + sub edx,ecx + rep movsb + mov esi, [esp+56] + mov ecx, [esp+48] + cmp edx,ecx + jbe L_do_copy1_mmx + + sub edx,ecx + rep movsb + mov esi,edi + sub esi,ebx + jmp L_do_copy1_mmx + +L_contiguous_in_window_mmx: + + add esi,eax + sub esi,ecx + + + cmp edx,ecx + jbe L_do_copy1_mmx + + sub edx,ecx + rep movsb + mov esi,edi + sub esi,ebx + +L_do_copy1_mmx: + + + mov ecx,edx + rep movsb + + mov esi, [esp+44] + mov ebx, [esp+8] + jmp L_while_test_mmx +; 1174 "inffast.S" +L_invalid_distance_code: + + + + + + mov ecx, invalid_distance_code_msg + mov edx,INFLATE_MODE_BAD + jmp L_update_stream_state + +L_test_for_end_of_block: + + + + + + test al,32 + jz L_invalid_literal_length_code + + mov ecx,0 + mov edx,INFLATE_MODE_TYPE + jmp L_update_stream_state + +L_invalid_literal_length_code: + + + + + + mov ecx, invalid_literal_length_code_msg + mov edx,INFLATE_MODE_BAD + jmp L_update_stream_state + +L_invalid_distance_too_far: + + + + mov esi, [esp+44] + mov ecx, invalid_distance_too_far_msg + mov edx,INFLATE_MODE_BAD + jmp L_update_stream_state + +L_update_stream_state: + + mov eax, [esp+88] + test ecx,ecx + jz L_skip_msg + mov [eax+24],ecx +L_skip_msg: + mov eax, [eax+28] + mov [eax+mode_state],edx + jmp L_break_loop + +ALIGN 4 +L_break_loop: +; 1243 "inffast.S" + cmp dword ptr [inflate_fast_use_mmx],2 + jne L_update_next_in + + + + mov ebx,ebp + +L_update_next_in: +; 1266 "inffast.S" + mov eax, [esp+88] + mov ecx,ebx + mov edx, [eax+28] + shr ecx,3 + sub esi,ecx + shl ecx,3 + sub ebx,ecx + mov [eax+12],edi + mov [edx+bits_state],ebx + mov ecx,ebx + + lea ebx, [esp+28] + cmp [esp+20],ebx + jne L_buf_not_used + + sub esi,ebx + mov ebx, [eax+0] + mov [esp+20],ebx + add esi,ebx + mov ebx, [eax+4] + sub ebx,11 + add [esp+20],ebx + +L_buf_not_used: + mov [eax+0],esi + + mov ebx,1 + shl ebx,cl + dec ebx + + + + + + cmp dword ptr [inflate_fast_use_mmx],2 + jne L_update_hold + + + + psrlq mm0,mm1 + movd ebp,mm0 + + emms + +L_update_hold: + + + + and ebp,ebx + mov [edx+hold_state],ebp + + + + + mov ebx, [esp+20] + cmp ebx,esi + jbe L_last_is_smaller + + sub ebx,esi + add ebx,11 + mov [eax+4],ebx + jmp L_fixup_out +L_last_is_smaller: + sub esi,ebx + neg esi + add esi,11 + mov [eax+4],esi + + + + +L_fixup_out: + + mov ebx, [esp+16] + cmp ebx,edi + jbe L_end_is_smaller + + sub ebx,edi + add ebx,257 + mov [eax+16],ebx + jmp L_done +L_end_is_smaller: + sub edi,ebx + neg edi + add edi,257 + mov [eax+16],edi + + + + + +L_done: + add esp,64 + popfd + pop ebx + pop ebp + pop esi + pop edi + ret + +_TEXT ends +end diff --git a/zlib/contrib/masmx86/match686.asm b/zlib/contrib/masmx86/match686.asm new file mode 100644 index 0000000..21ae704 --- /dev/null +++ b/zlib/contrib/masmx86/match686.asm @@ -0,0 +1,478 @@ +; match686.asm -- Asm portion of the optimized longest_match for 32 bits x86 +; Copyright (C) 1995-1996 Jean-loup Gailly, Brian Raiter and Gilles Vollant. +; File written by Gilles Vollant, by converting match686.S from Brian Raiter +; for MASM. This is as assembly version of longest_match +; from Jean-loup Gailly in deflate.c +; +; http://www.zlib.net +; http://www.winimage.com/zLibDll +; http://www.muppetlabs.com/~breadbox/software/assembly.html +; +; For Visual C++ 4.x and higher and ML 6.x and higher +; ml.exe is distributed in +; http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64 +; +; this file contain two implementation of longest_match +; +; this longest_match was written by Brian raiter (1998), optimized for Pentium Pro +; (and the faster known version of match_init on modern Core 2 Duo and AMD Phenom) +; +; for using an assembly version of longest_match, you need define ASMV in project +; +; compile the asm file running +; ml /coff /Zi /c /Flmatch686.lst match686.asm +; and do not include match686.obj in your project +; +; note: contrib of zLib 1.2.3 and earlier contained both a deprecated version for +; Pentium (prior Pentium Pro) and this version for Pentium Pro and modern processor +; with autoselect (with cpu detection code) +; if you want support the old pentium optimization, you can still use these version +; +; this file is not optimized for old pentium, but it compatible with all x86 32 bits +; processor (starting 80386) +; +; +; see below : zlib1222add must be adjuster if you use a zlib version < 1.2.2.2 + +;uInt longest_match(s, cur_match) +; deflate_state *s; +; IPos cur_match; /* current match */ + + NbStack equ 76 + cur_match equ dword ptr[esp+NbStack-0] + str_s equ dword ptr[esp+NbStack-4] +; 5 dword on top (ret,ebp,esi,edi,ebx) + adrret equ dword ptr[esp+NbStack-8] + pushebp equ dword ptr[esp+NbStack-12] + pushedi equ dword ptr[esp+NbStack-16] + pushesi equ dword ptr[esp+NbStack-20] + pushebx equ dword ptr[esp+NbStack-24] + + chain_length equ dword ptr [esp+NbStack-28] + limit equ dword ptr [esp+NbStack-32] + best_len equ dword ptr [esp+NbStack-36] + window equ dword ptr [esp+NbStack-40] + prev equ dword ptr [esp+NbStack-44] + scan_start equ word ptr [esp+NbStack-48] + wmask equ dword ptr [esp+NbStack-52] + match_start_ptr equ dword ptr [esp+NbStack-56] + nice_match equ dword ptr [esp+NbStack-60] + scan equ dword ptr [esp+NbStack-64] + + windowlen equ dword ptr [esp+NbStack-68] + match_start equ dword ptr [esp+NbStack-72] + strend equ dword ptr [esp+NbStack-76] + NbStackAdd equ (NbStack-24) + + .386p + + name gvmatch + .MODEL FLAT + + + +; all the +zlib1222add offsets are due to the addition of fields +; in zlib in the deflate_state structure since the asm code was first written +; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). +; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). +; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). + + zlib1222add equ 8 + +; Note : these value are good with a 8 bytes boundary pack structure + dep_chain_length equ 74h+zlib1222add + dep_window equ 30h+zlib1222add + dep_strstart equ 64h+zlib1222add + dep_prev_length equ 70h+zlib1222add + dep_nice_match equ 88h+zlib1222add + dep_w_size equ 24h+zlib1222add + dep_prev equ 38h+zlib1222add + dep_w_mask equ 2ch+zlib1222add + dep_good_match equ 84h+zlib1222add + dep_match_start equ 68h+zlib1222add + dep_lookahead equ 6ch+zlib1222add + + +_TEXT segment + +IFDEF NOUNDERLINE + public longest_match + public match_init +ELSE + public _longest_match + public _match_init +ENDIF + + MAX_MATCH equ 258 + MIN_MATCH equ 3 + MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) + + + +MAX_MATCH equ 258 +MIN_MATCH equ 3 +MIN_LOOKAHEAD equ (MAX_MATCH + MIN_MATCH + 1) +MAX_MATCH_8_ equ ((MAX_MATCH + 7) AND 0FFF0h) + + +;;; stack frame offsets + +chainlenwmask equ esp + 0 ; high word: current chain len + ; low word: s->wmask +window equ esp + 4 ; local copy of s->window +windowbestlen equ esp + 8 ; s->window + bestlen +scanstart equ esp + 16 ; first two bytes of string +scanend equ esp + 12 ; last two bytes of string +scanalign equ esp + 20 ; dword-misalignment of string +nicematch equ esp + 24 ; a good enough match size +bestlen equ esp + 28 ; size of best match so far +scan equ esp + 32 ; ptr to string wanting match + +LocalVarsSize equ 36 +; saved ebx byte esp + 36 +; saved edi byte esp + 40 +; saved esi byte esp + 44 +; saved ebp byte esp + 48 +; return address byte esp + 52 +deflatestate equ esp + 56 ; the function arguments +curmatch equ esp + 60 + +;;; Offsets for fields in the deflate_state structure. These numbers +;;; are calculated from the definition of deflate_state, with the +;;; assumption that the compiler will dword-align the fields. (Thus, +;;; changing the definition of deflate_state could easily cause this +;;; program to crash horribly, without so much as a warning at +;;; compile time. Sigh.) + +dsWSize equ 36+zlib1222add +dsWMask equ 44+zlib1222add +dsWindow equ 48+zlib1222add +dsPrev equ 56+zlib1222add +dsMatchLen equ 88+zlib1222add +dsPrevMatch equ 92+zlib1222add +dsStrStart equ 100+zlib1222add +dsMatchStart equ 104+zlib1222add +dsLookahead equ 108+zlib1222add +dsPrevLen equ 112+zlib1222add +dsMaxChainLen equ 116+zlib1222add +dsGoodMatch equ 132+zlib1222add +dsNiceMatch equ 136+zlib1222add + + +;;; match686.asm -- Pentium-Pro-optimized version of longest_match() +;;; Written for zlib 1.1.2 +;;; Copyright (C) 1998 Brian Raiter +;;; You can look at http://www.muppetlabs.com/~breadbox/software/assembly.html +;;; +;; +;; This software is provided 'as-is', without any express or implied +;; warranty. In no event will the authors be held liable for any damages +;; arising from the use of this software. +;; +;; Permission is granted to anyone to use this software for any purpose, +;; including commercial applications, and to alter it and redistribute it +;; freely, subject to the following restrictions: +;; +;; 1. The origin of this software must not be misrepresented; you must not +;; claim that you wrote the original software. If you use this software +;; in a product, an acknowledgment in the product documentation would be +;; appreciated but is not required. +;; 2. Altered source versions must be plainly marked as such, and must not be +;; misrepresented as being the original software +;; 3. This notice may not be removed or altered from any source distribution. +;; + +;GLOBAL _longest_match, _match_init + + +;SECTION .text + +;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch) + +;_longest_match: + IFDEF NOUNDERLINE + longest_match proc near + ELSE + _longest_match proc near + ENDIF + +;;; Save registers that the compiler may be using, and adjust esp to +;;; make room for our stack frame. + + push ebp + push edi + push esi + push ebx + sub esp, LocalVarsSize + +;;; Retrieve the function arguments. ecx will hold cur_match +;;; throughout the entire function. edx will hold the pointer to the +;;; deflate_state structure during the function's setup (before +;;; entering the main loop. + + mov edx, [deflatestate] + mov ecx, [curmatch] + +;;; uInt wmask = s->w_mask; +;;; unsigned chain_length = s->max_chain_length; +;;; if (s->prev_length >= s->good_match) { +;;; chain_length >>= 2; +;;; } + + mov eax, [edx + dsPrevLen] + mov ebx, [edx + dsGoodMatch] + cmp eax, ebx + mov eax, [edx + dsWMask] + mov ebx, [edx + dsMaxChainLen] + jl LastMatchGood + shr ebx, 2 +LastMatchGood: + +;;; chainlen is decremented once beforehand so that the function can +;;; use the sign flag instead of the zero flag for the exit test. +;;; It is then shifted into the high word, to make room for the wmask +;;; value, which it will always accompany. + + dec ebx + shl ebx, 16 + or ebx, eax + mov [chainlenwmask], ebx + +;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; + + mov eax, [edx + dsNiceMatch] + mov ebx, [edx + dsLookahead] + cmp ebx, eax + jl LookaheadLess + mov ebx, eax +LookaheadLess: mov [nicematch], ebx + +;;; register Bytef *scan = s->window + s->strstart; + + mov esi, [edx + dsWindow] + mov [window], esi + mov ebp, [edx + dsStrStart] + lea edi, [esi + ebp] + mov [scan], edi + +;;; Determine how many bytes the scan ptr is off from being +;;; dword-aligned. + + mov eax, edi + neg eax + and eax, 3 + mov [scanalign], eax + +;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? +;;; s->strstart - (IPos)MAX_DIST(s) : NIL; + + mov eax, [edx + dsWSize] + sub eax, MIN_LOOKAHEAD + sub ebp, eax + jg LimitPositive + xor ebp, ebp +LimitPositive: + +;;; int best_len = s->prev_length; + + mov eax, [edx + dsPrevLen] + mov [bestlen], eax + +;;; Store the sum of s->window + best_len in esi locally, and in esi. + + add esi, eax + mov [windowbestlen], esi + +;;; register ush scan_start = *(ushf*)scan; +;;; register ush scan_end = *(ushf*)(scan+best_len-1); +;;; Posf *prev = s->prev; + + movzx ebx, word ptr [edi] + mov [scanstart], ebx + movzx ebx, word ptr [edi + eax - 1] + mov [scanend], ebx + mov edi, [edx + dsPrev] + +;;; Jump into the main loop. + + mov edx, [chainlenwmask] + jmp short LoopEntry + +align 4 + +;;; do { +;;; match = s->window + cur_match; +;;; if (*(ushf*)(match+best_len-1) != scan_end || +;;; *(ushf*)match != scan_start) continue; +;;; [...] +;;; } while ((cur_match = prev[cur_match & wmask]) > limit +;;; && --chain_length != 0); +;;; +;;; Here is the inner loop of the function. The function will spend the +;;; majority of its time in this loop, and majority of that time will +;;; be spent in the first ten instructions. +;;; +;;; Within this loop: +;;; ebx = scanend +;;; ecx = curmatch +;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) +;;; esi = windowbestlen - i.e., (window + bestlen) +;;; edi = prev +;;; ebp = limit + +LookupLoop: + and ecx, edx + movzx ecx, word ptr [edi + ecx*2] + cmp ecx, ebp + jbe LeaveNow + sub edx, 00010000h + js LeaveNow +LoopEntry: movzx eax, word ptr [esi + ecx - 1] + cmp eax, ebx + jnz LookupLoop + mov eax, [window] + movzx eax, word ptr [eax + ecx] + cmp eax, [scanstart] + jnz LookupLoop + +;;; Store the current value of chainlen. + + mov [chainlenwmask], edx + +;;; Point edi to the string under scrutiny, and esi to the string we +;;; are hoping to match it up with. In actuality, esi and edi are +;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is +;;; initialized to -(MAX_MATCH_8 - scanalign). + + mov esi, [window] + mov edi, [scan] + add esi, ecx + mov eax, [scanalign] + mov edx, 0fffffef8h; -(MAX_MATCH_8) + lea edi, [edi + eax + 0108h] ;MAX_MATCH_8] + lea esi, [esi + eax + 0108h] ;MAX_MATCH_8] + +;;; Test the strings for equality, 8 bytes at a time. At the end, +;;; adjust edx so that it is offset to the exact byte that mismatched. +;;; +;;; We already know at this point that the first three bytes of the +;;; strings match each other, and they can be safely passed over before +;;; starting the compare loop. So what this code does is skip over 0-3 +;;; bytes, as much as necessary in order to dword-align the edi +;;; pointer. (esi will still be misaligned three times out of four.) +;;; +;;; It should be confessed that this loop usually does not represent +;;; much of the total running time. Replacing it with a more +;;; straightforward "rep cmpsb" would not drastically degrade +;;; performance. + +LoopCmps: + mov eax, [esi + edx] + xor eax, [edi + edx] + jnz LeaveLoopCmps + mov eax, [esi + edx + 4] + xor eax, [edi + edx + 4] + jnz LeaveLoopCmps4 + add edx, 8 + jnz LoopCmps + jmp short LenMaximum +LeaveLoopCmps4: add edx, 4 +LeaveLoopCmps: test eax, 0000FFFFh + jnz LenLower + add edx, 2 + shr eax, 16 +LenLower: sub al, 1 + adc edx, 0 + +;;; Calculate the length of the match. If it is longer than MAX_MATCH, +;;; then automatically accept it as the best possible match and leave. + + lea eax, [edi + edx] + mov edi, [scan] + sub eax, edi + cmp eax, MAX_MATCH + jge LenMaximum + +;;; If the length of the match is not longer than the best match we +;;; have so far, then forget it and return to the lookup loop. + + mov edx, [deflatestate] + mov ebx, [bestlen] + cmp eax, ebx + jg LongerMatch + mov esi, [windowbestlen] + mov edi, [edx + dsPrev] + mov ebx, [scanend] + mov edx, [chainlenwmask] + jmp LookupLoop + +;;; s->match_start = cur_match; +;;; best_len = len; +;;; if (len >= nice_match) break; +;;; scan_end = *(ushf*)(scan+best_len-1); + +LongerMatch: mov ebx, [nicematch] + mov [bestlen], eax + mov [edx + dsMatchStart], ecx + cmp eax, ebx + jge LeaveNow + mov esi, [window] + add esi, eax + mov [windowbestlen], esi + movzx ebx, word ptr [edi + eax - 1] + mov edi, [edx + dsPrev] + mov [scanend], ebx + mov edx, [chainlenwmask] + jmp LookupLoop + +;;; Accept the current string, with the maximum possible length. + +LenMaximum: mov edx, [deflatestate] + mov dword ptr [bestlen], MAX_MATCH + mov [edx + dsMatchStart], ecx + +;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; +;;; return s->lookahead; + +LeaveNow: + mov edx, [deflatestate] + mov ebx, [bestlen] + mov eax, [edx + dsLookahead] + cmp ebx, eax + jg LookaheadRet + mov eax, ebx +LookaheadRet: + +;;; Restore the stack and return from whence we came. + + add esp, LocalVarsSize + pop ebx + pop esi + pop edi + pop ebp + + ret +; please don't remove this string ! +; Your can freely use match686 in any free or commercial app if you don't remove the string in the binary! + db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998",0dh,0ah + + + IFDEF NOUNDERLINE + longest_match endp + ELSE + _longest_match endp + ENDIF + + IFDEF NOUNDERLINE + match_init proc near + ret + match_init endp + ELSE + _match_init proc near + ret + _match_init endp + ENDIF + + +_TEXT ends +end diff --git a/zlib/contrib/masmx86/readme.txt b/zlib/contrib/masmx86/readme.txt new file mode 100644 index 0000000..3f88886 --- /dev/null +++ b/zlib/contrib/masmx86/readme.txt @@ -0,0 +1,27 @@ + +Summary +------- +This directory contains ASM implementations of the functions +longest_match() and inflate_fast(). + + +Use instructions +---------------- +Assemble using MASM, and copy the object files into the zlib source +directory, then run the appropriate makefile, as suggested below. You can +donwload MASM from here: + + http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64 + +You can also get objects files here: + + http://www.winimage.com/zLibDll/zlib124_masm_obj.zip + +Build instructions +------------------ +* With Microsoft C and MASM: +nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" + +* With Borland C and TASM: +make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj" + diff --git a/zlib/contrib/minizip/Makefile b/zlib/contrib/minizip/Makefile new file mode 100644 index 0000000..84eaad2 --- /dev/null +++ b/zlib/contrib/minizip/Makefile @@ -0,0 +1,25 @@ +CC=cc +CFLAGS=-O -I../.. + +UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a +ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a + +.c.o: + $(CC) -c $(CFLAGS) $*.c + +all: miniunz minizip + +miniunz: $(UNZ_OBJS) + $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) + +minizip: $(ZIP_OBJS) + $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) + +test: miniunz minizip + ./minizip test readme.txt + ./miniunz -l test.zip + mv readme.txt readme.old + ./miniunz test.zip + +clean: + /bin/rm -f *.o *~ minizip miniunz diff --git a/zlib/contrib/minizip/MiniZip64_Changes.txt b/zlib/contrib/minizip/MiniZip64_Changes.txt new file mode 100644 index 0000000..13a1bd9 --- /dev/null +++ b/zlib/contrib/minizip/MiniZip64_Changes.txt @@ -0,0 +1,6 @@ + +MiniZip 1.1 was derrived from MiniZip at version 1.01f + +Change in 1.0 (Okt 2009) + - **TODO - Add history** + diff --git a/zlib/contrib/minizip/MiniZip64_info.txt b/zlib/contrib/minizip/MiniZip64_info.txt new file mode 100644 index 0000000..57d7152 --- /dev/null +++ b/zlib/contrib/minizip/MiniZip64_info.txt @@ -0,0 +1,74 @@ +MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson + +Introduction +--------------------- +MiniZip 1.1 is built from MiniZip 1.0 by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html ) + +When adding ZIP64 support into minizip it would result into risk of breaking compatibility with minizip 1.0. +All possible work was done for compatibility. + + +Background +--------------------- +When adding ZIP64 support Mathias Svensson found that Even Rouault have added ZIP64 +support for unzip.c into minizip for a open source project called gdal ( http://www.gdal.org/ ) + +That was used as a starting point. And after that ZIP64 support was added to zip.c +some refactoring and code cleanup was also done. + + +Changed from MiniZip 1.0 to MiniZip 1.1 +--------------------------------------- +* Added ZIP64 support for unzip ( by Even Rouault ) +* Added ZIP64 support for zip ( by Mathias Svensson ) +* Reverted some changed that Even Rouault did. +* Bunch of patches received from Gulles Vollant that he received for MiniZip from various users. +* Added unzip patch for BZIP Compression method (patch create by Daniel Borca) +* Added BZIP Compress method for zip +* Did some refactoring and code cleanup + + +Credits + + Gilles Vollant - Original MiniZip author + Even Rouault - ZIP64 unzip Support + Daniel Borca - BZip Compression method support in unzip + Mathias Svensson - ZIP64 zip support + Mathias Svensson - BZip Compression method support in zip + + Resources + + ZipLayout http://result42.com/projects/ZipFileLayout + Command line tool for Windows that shows the layout and information of the headers in a zip archive. + Used when debugging and validating the creation of zip files using MiniZip64 + + + ZIP App Note http://www.pkware.com/documents/casestudies/APPNOTE.TXT + Zip File specification + + +Notes. + * To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined. + +License +---------------------------------------------------------- + Condition of use and distribution are the same than zlib : + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + +---------------------------------------------------------- + diff --git a/zlib/contrib/minizip/crypt.h b/zlib/contrib/minizip/crypt.h new file mode 100644 index 0000000..a01d08d --- /dev/null +++ b/zlib/contrib/minizip/crypt.h @@ -0,0 +1,131 @@ +/* crypt.h -- base code for crypt/uncrypt ZIPfile + + + Version 1.01e, February 12th, 2005 + + Copyright (C) 1998-2005 Gilles Vollant + + This code is a modified version of crypting code in Infozip distribution + + The encryption/decryption parts of this source code (as opposed to the + non-echoing password parts) were originally written in Europe. The + whole source package can be freely distributed, including from the USA. + (Prior to January 2000, re-export from the US was a violation of US law.) + + This encryption code is a direct transcription of the algorithm from + Roger Schlafly, described by Phil Katz in the file appnote.txt. This + file (appnote.txt) is distributed with the PKZIP program (even in the + version without encryption capabilities). + + If you don't need crypting in your application, just define symbols + NOCRYPT and NOUNCRYPT. + + This code support the "Traditional PKWARE Encryption". + + The new AES encryption added on Zip format by Winzip (see the page + http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong + Encryption is not supported. +*/ + +#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) + +/*********************************************************************** + * Return the next byte in the pseudo-random sequence + */ +static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) +{ + unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an + * unpredictable manner on 16-bit systems; not a problem + * with any known compiler so far, though */ + + temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; + return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); +} + +/*********************************************************************** + * Update the encryption keys with the next byte of plain text + */ +static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) +{ + (*(pkeys+0)) = CRC32((*(pkeys+0)), c); + (*(pkeys+1)) += (*(pkeys+0)) & 0xff; + (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; + { + register int keyshift = (int)((*(pkeys+1)) >> 24); + (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); + } + return c; +} + + +/*********************************************************************** + * Initialize the encryption keys and the random header according to + * the given password. + */ +static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) +{ + *(pkeys+0) = 305419896L; + *(pkeys+1) = 591751049L; + *(pkeys+2) = 878082192L; + while (*passwd != '\0') { + update_keys(pkeys,pcrc_32_tab,(int)*passwd); + passwd++; + } +} + +#define zdecode(pkeys,pcrc_32_tab,c) \ + (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) + +#define zencode(pkeys,pcrc_32_tab,c,t) \ + (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) + +#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED + +#define RAND_HEAD_LEN 12 + /* "last resort" source for second part of crypt seed pattern */ +# ifndef ZCR_SEED2 +# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ +# endif + +static int crypthead(const char* passwd, /* password string */ + unsigned char* buf, /* where to write header */ + int bufSize, + unsigned long* pkeys, + const unsigned long* pcrc_32_tab, + unsigned long crcForCrypting) +{ + int n; /* index in random header */ + int t; /* temporary */ + int c; /* random byte */ + unsigned char header[RAND_HEAD_LEN-2]; /* random header */ + static unsigned calls = 0; /* ensure different random header each time */ + + if (bufSize> 7) & 0xff; + header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); + } + /* Encrypt random header (last two bytes is high word of crc) */ + init_keys(passwd, pkeys, pcrc_32_tab); + for (n = 0; n < RAND_HEAD_LEN-2; n++) + { + buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); + } + buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); + buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); + return n; +} + +#endif diff --git a/zlib/contrib/minizip/ioapi.c b/zlib/contrib/minizip/ioapi.c new file mode 100644 index 0000000..49958f6 --- /dev/null +++ b/zlib/contrib/minizip/ioapi.c @@ -0,0 +1,235 @@ +/* ioapi.h -- IO base function header for compress/uncompress .zip + part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) + + Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + + For more info read MiniZip_info.txt + +*/ + +#if (defined(_WIN32)) + #define _CRT_SECURE_NO_WARNINGS +#endif + +#include "ioapi.h" + +voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) +{ + if (pfilefunc->zfile_func64.zopen64_file != NULL) + return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode); + else + { + return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode); + } +} + +long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) +{ + if (pfilefunc->zfile_func64.zseek64_file != NULL) + return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); + else + { + uLong offsetTruncated = (uLong)offset; + if (offsetTruncated != offset) + return -1; + else + return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin); + } +} + +ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream) +{ + if (pfilefunc->zfile_func64.zseek64_file != NULL) + return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); + else + { + uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); + if ((tell_uLong) == ((uLong)-1)) + return (ZPOS64_T)-1; + else + return tell_uLong; + } +} + +void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32) +{ + p_filefunc64_32->zfile_func64.zopen64_file = NULL; + p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; + p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; + p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file; + p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file; + p_filefunc64_32->zfile_func64.ztell64_file = NULL; + p_filefunc64_32->zfile_func64.zseek64_file = NULL; + p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file; + p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; + p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque; + p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file; + p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file; +} + + + +static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); +static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); +static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); +static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream)); +static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); +static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream)); +static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream)); + +static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode) +{ + FILE* file = NULL; + const char* mode_fopen = NULL; + if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) + mode_fopen = "rb"; + else + if (mode & ZLIB_FILEFUNC_MODE_EXISTING) + mode_fopen = "r+b"; + else + if (mode & ZLIB_FILEFUNC_MODE_CREATE) + mode_fopen = "wb"; + + if ((filename!=NULL) && (mode_fopen != NULL)) + file = fopen(filename, mode_fopen); + return file; +} + +static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode) +{ + FILE* file = NULL; + const char* mode_fopen = NULL; + if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) + mode_fopen = "rb"; + else + if (mode & ZLIB_FILEFUNC_MODE_EXISTING) + mode_fopen = "r+b"; + else + if (mode & ZLIB_FILEFUNC_MODE_CREATE) + mode_fopen = "wb"; + + if ((filename!=NULL) && (mode_fopen != NULL)) + file = fopen64((const char*)filename, mode_fopen); + return file; +} + + +static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) +{ + uLong ret; + ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); + return ret; +} + +static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size) +{ + uLong ret; + ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); + return ret; +} + +static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) +{ + long ret; + ret = ftell((FILE *)stream); + return ret; +} + + +static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) +{ + ZPOS64_T ret; + ret = ftello64((FILE *)stream); + return ret; +} + +static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin) +{ + int fseek_origin=0; + long ret; + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_CUR : + fseek_origin = SEEK_CUR; + break; + case ZLIB_FILEFUNC_SEEK_END : + fseek_origin = SEEK_END; + break; + case ZLIB_FILEFUNC_SEEK_SET : + fseek_origin = SEEK_SET; + break; + default: return -1; + } + ret = 0; + if (fseek((FILE *)stream, offset, fseek_origin) != 0) + ret = -1; + return ret; +} + +static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) +{ + int fseek_origin=0; + long ret; + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_CUR : + fseek_origin = SEEK_CUR; + break; + case ZLIB_FILEFUNC_SEEK_END : + fseek_origin = SEEK_END; + break; + case ZLIB_FILEFUNC_SEEK_SET : + fseek_origin = SEEK_SET; + break; + default: return -1; + } + ret = 0; + + if(fseeko64((FILE *)stream, offset, fseek_origin) != 0) + ret = -1; + + return ret; +} + + +static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) +{ + int ret; + ret = fclose((FILE *)stream); + return ret; +} + +static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream) +{ + int ret; + ret = ferror((FILE *)stream); + return ret; +} + +void fill_fopen_filefunc (pzlib_filefunc_def) + zlib_filefunc_def* pzlib_filefunc_def; +{ + pzlib_filefunc_def->zopen_file = fopen_file_func; + pzlib_filefunc_def->zread_file = fread_file_func; + pzlib_filefunc_def->zwrite_file = fwrite_file_func; + pzlib_filefunc_def->ztell_file = ftell_file_func; + pzlib_filefunc_def->zseek_file = fseek_file_func; + pzlib_filefunc_def->zclose_file = fclose_file_func; + pzlib_filefunc_def->zerror_file = ferror_file_func; + pzlib_filefunc_def->opaque = NULL; +} + +void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen64_file = fopen64_file_func; + pzlib_filefunc_def->zread_file = fread_file_func; + pzlib_filefunc_def->zwrite_file = fwrite_file_func; + pzlib_filefunc_def->ztell64_file = ftell64_file_func; + pzlib_filefunc_def->zseek64_file = fseek64_file_func; + pzlib_filefunc_def->zclose_file = fclose_file_func; + pzlib_filefunc_def->zerror_file = ferror_file_func; + pzlib_filefunc_def->opaque = NULL; +} diff --git a/zlib/contrib/minizip/ioapi.h b/zlib/contrib/minizip/ioapi.h new file mode 100644 index 0000000..8309c4c --- /dev/null +++ b/zlib/contrib/minizip/ioapi.h @@ -0,0 +1,200 @@ +/* ioapi.h -- IO base function header for compress/uncompress .zip + part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) + + Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + + For more info read MiniZip_info.txt + + Changes + + Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this) + Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux. + More if/def section may be needed to support other platforms + Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows. + (but you should use iowin32.c for windows instead) + +*/ + +#ifndef _ZLIBIOAPI64_H +#define _ZLIBIOAPI64_H + +#if (!defined(_WIN32)) && (!defined(WIN32)) + + // Linux needs this to support file operation on files larger then 4+GB + // But might need better if/def to select just the platforms that needs them. + + #ifndef __USE_FILE_OFFSET64 + #define __USE_FILE_OFFSET64 + #endif + #ifndef __USE_LARGEFILE64 + #define __USE_LARGEFILE64 + #endif + #ifndef _LARGEFILE64_SOURCE + #define _LARGEFILE64_SOURCE + #endif + #ifndef _FILE_OFFSET_BIT + #define _FILE_OFFSET_BIT 64 + #endif +#endif + +#include +#include +#include "zlib.h" + +#if defined(USE_FILE32API) +#define fopen64 fopen +#define ftello64 ftell +#define fseeko64 fseek +#else +#ifdef _MSC_VER + #define fopen64 fopen + #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC))) + #define ftello64 _ftelli64 + #define fseeko64 _fseeki64 + #else // old MSC + #define ftello64 ftell + #define fseeko64 fseek + #endif +#endif +#endif + +/* +#ifndef ZPOS64_T + #ifdef _WIN32 + #define ZPOS64_T fpos_t + #else + #include + #define ZPOS64_T uint64_t + #endif +#endif +*/ + +#ifdef HAVE_MINIZIP64_CONF_H +#include "mz64conf.h" +#endif + +/* a type choosen by DEFINE */ +#ifdef HAVE_64BIT_INT_CUSTOM +typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; +#else +#ifdef HAS_STDINT_H +#include "stdint.h" +typedef uint64_t ZPOS64_T; +#else + + +#if defined(_MSC_VER) || defined(__BORLANDC__) +typedef unsigned __int64 ZPOS64_T; +#else +typedef unsigned long long int ZPOS64_T; +#endif +#endif +#endif + + + +#ifdef __cplusplus +extern "C" { +#endif + + +#define ZLIB_FILEFUNC_SEEK_CUR (1) +#define ZLIB_FILEFUNC_SEEK_END (2) +#define ZLIB_FILEFUNC_SEEK_SET (0) + +#define ZLIB_FILEFUNC_MODE_READ (1) +#define ZLIB_FILEFUNC_MODE_WRITE (2) +#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) + +#define ZLIB_FILEFUNC_MODE_EXISTING (4) +#define ZLIB_FILEFUNC_MODE_CREATE (8) + + +#ifndef ZCALLBACK + #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) + #define ZCALLBACK CALLBACK + #else + #define ZCALLBACK + #endif +#endif + + + + +typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); +typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); +typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); +typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); +typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); + +typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); +typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); + + +/* here is the "old" 32 bits structure structure */ +typedef struct zlib_filefunc_def_s +{ + open_file_func zopen_file; + read_file_func zread_file; + write_file_func zwrite_file; + tell_file_func ztell_file; + seek_file_func zseek_file; + close_file_func zclose_file; + testerror_file_func zerror_file; + voidpf opaque; +} zlib_filefunc_def; + +typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream)); +typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); +typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode)); + +typedef struct zlib_filefunc64_def_s +{ + open64_file_func zopen64_file; + read_file_func zread_file; + write_file_func zwrite_file; + tell64_file_func ztell64_file; + seek64_file_func zseek64_file; + close_file_func zclose_file; + testerror_file_func zerror_file; + voidpf opaque; +} zlib_filefunc64_def; + +void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def)); +void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); + +/* now internal definition, only for zip.c and unzip.h */ +typedef struct zlib_filefunc64_32_def_s +{ + zlib_filefunc64_def zfile_func64; + open_file_func zopen32_file; + tell_file_func ztell32_file; + seek_file_func zseek32_file; +} zlib_filefunc64_32_def; + + +#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) +#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) +//#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) +//#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) +#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) +#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) + +voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)); +long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)); +ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)); + +void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32); + +#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) +#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) +#define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode))) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/zlib/contrib/minizip/iowin32.c b/zlib/contrib/minizip/iowin32.c new file mode 100644 index 0000000..6a2a883 --- /dev/null +++ b/zlib/contrib/minizip/iowin32.c @@ -0,0 +1,389 @@ +/* iowin32.c -- IO base function header for compress/uncompress .zip + Version 1.1, February 14h, 2010 + part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) + + Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + + For more info read MiniZip_info.txt + +*/ + +#include + +#include "zlib.h" +#include "ioapi.h" +#include "iowin32.h" + +#ifndef INVALID_HANDLE_VALUE +#define INVALID_HANDLE_VALUE (0xFFFFFFFF) +#endif + +#ifndef INVALID_SET_FILE_POINTER +#define INVALID_SET_FILE_POINTER ((DWORD)-1) +#endif + +voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode)); +uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); +uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); +ZPOS64_T ZCALLBACK win32_tell64_file_func OF((voidpf opaque, voidpf stream)); +long ZCALLBACK win32_seek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); +int ZCALLBACK win32_close_file_func OF((voidpf opaque, voidpf stream)); +int ZCALLBACK win32_error_file_func OF((voidpf opaque, voidpf stream)); + +typedef struct +{ + HANDLE hf; + int error; +} WIN32FILE_IOWIN; + + +static void win32_translate_open_mode(int mode, + DWORD* lpdwDesiredAccess, + DWORD* lpdwCreationDisposition, + DWORD* lpdwShareMode, + DWORD* lpdwFlagsAndAttributes) +{ + *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0; + + if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) + { + *lpdwDesiredAccess = GENERIC_READ; + *lpdwCreationDisposition = OPEN_EXISTING; + *lpdwShareMode = FILE_SHARE_READ; + } + else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) + { + *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ; + *lpdwCreationDisposition = OPEN_EXISTING; + } + else if (mode & ZLIB_FILEFUNC_MODE_CREATE) + { + *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ; + *lpdwCreationDisposition = CREATE_ALWAYS; + } +} + +static voidpf win32_build_iowin(HANDLE hFile) +{ + voidpf ret=NULL; + + if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE)) + { + WIN32FILE_IOWIN w32fiow; + w32fiow.hf = hFile; + w32fiow.error = 0; + ret = malloc(sizeof(WIN32FILE_IOWIN)); + + if (ret==NULL) + CloseHandle(hFile); + else + *((WIN32FILE_IOWIN*)ret) = w32fiow; + } + return ret; +} + +voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int mode) +{ + const char* mode_fopen = NULL; + DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; + HANDLE hFile = NULL; + + win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); + + if ((filename!=NULL) && (dwDesiredAccess != 0)) + hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); + + return win32_build_iowin(hFile); +} + + +voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int mode) +{ + const char* mode_fopen = NULL; + DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; + HANDLE hFile = NULL; + + win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); + + if ((filename!=NULL) && (dwDesiredAccess != 0)) + hFile = CreateFileA((LPCSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); + + return win32_build_iowin(hFile); +} + + +voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode) +{ + const char* mode_fopen = NULL; + DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; + HANDLE hFile = NULL; + + win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); + + if ((filename!=NULL) && (dwDesiredAccess != 0)) + hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); + + return win32_build_iowin(hFile); +} + + +voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mode) +{ + const char* mode_fopen = NULL; + DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; + HANDLE hFile = NULL; + + win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); + + if ((filename!=NULL) && (dwDesiredAccess != 0)) + hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); + + return win32_build_iowin(hFile); +} + + +uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uLong size) +{ + uLong ret=0; + HANDLE hFile = NULL; + if (stream!=NULL) + hFile = ((WIN32FILE_IOWIN*)stream) -> hf; + + if (hFile != NULL) + { + if (!ReadFile(hFile, buf, size, &ret, NULL)) + { + DWORD dwErr = GetLastError(); + if (dwErr == ERROR_HANDLE_EOF) + dwErr = 0; + ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; + } + } + + return ret; +} + + +uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size) +{ + uLong ret=0; + HANDLE hFile = NULL; + if (stream!=NULL) + hFile = ((WIN32FILE_IOWIN*)stream) -> hf; + + if (hFile != NULL) + { + if (!WriteFile(hFile, buf, size, &ret, NULL)) + { + DWORD dwErr = GetLastError(); + if (dwErr == ERROR_HANDLE_EOF) + dwErr = 0; + ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; + } + } + + return ret; +} + +long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream) +{ + long ret=-1; + HANDLE hFile = NULL; + if (stream!=NULL) + hFile = ((WIN32FILE_IOWIN*)stream) -> hf; + if (hFile != NULL) + { + DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT); + if (dwSet == INVALID_SET_FILE_POINTER) + { + DWORD dwErr = GetLastError(); + ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; + ret = -1; + } + else + ret=(long)dwSet; + } + return ret; +} + +ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream) +{ + ZPOS64_T ret= (ZPOS64_T)-1; + HANDLE hFile = NULL; + if (stream!=NULL) + hFile = ((WIN32FILE_IOWIN*)stream)->hf; + + if (hFile) + { + LARGE_INTEGER li; + li.QuadPart = 0; + li.u.LowPart = SetFilePointer(hFile, li.u.LowPart, &li.u.HighPart, FILE_CURRENT); + if ( (li.LowPart == 0xFFFFFFFF) && (GetLastError() != NO_ERROR)) + { + DWORD dwErr = GetLastError(); + ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; + ret = (ZPOS64_T)-1; + } + else + ret=li.QuadPart; + } + return ret; +} + + +long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin) +{ + DWORD dwMoveMethod=0xFFFFFFFF; + HANDLE hFile = NULL; + + long ret=-1; + if (stream!=NULL) + hFile = ((WIN32FILE_IOWIN*)stream) -> hf; + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_CUR : + dwMoveMethod = FILE_CURRENT; + break; + case ZLIB_FILEFUNC_SEEK_END : + dwMoveMethod = FILE_END; + break; + case ZLIB_FILEFUNC_SEEK_SET : + dwMoveMethod = FILE_BEGIN; + break; + default: return -1; + } + + if (hFile != NULL) + { + DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod); + if (dwSet == INVALID_SET_FILE_POINTER) + { + DWORD dwErr = GetLastError(); + ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; + ret = -1; + } + else + ret=0; + } + return ret; +} + +long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T offset,int origin) +{ + DWORD dwMoveMethod=0xFFFFFFFF; + HANDLE hFile = NULL; + long ret=-1; + + if (stream!=NULL) + hFile = ((WIN32FILE_IOWIN*)stream)->hf; + + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_CUR : + dwMoveMethod = FILE_CURRENT; + break; + case ZLIB_FILEFUNC_SEEK_END : + dwMoveMethod = FILE_END; + break; + case ZLIB_FILEFUNC_SEEK_SET : + dwMoveMethod = FILE_BEGIN; + break; + default: return -1; + } + + if (hFile) + { + LARGE_INTEGER* li = (LARGE_INTEGER*)&offset; + DWORD dwSet = SetFilePointer(hFile, li->u.LowPart, &li->u.HighPart, dwMoveMethod); + if (dwSet == INVALID_SET_FILE_POINTER) + { + DWORD dwErr = GetLastError(); + ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; + ret = -1; + } + else + ret=0; + } + return ret; +} + +int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream) +{ + int ret=-1; + + if (stream!=NULL) + { + HANDLE hFile; + hFile = ((WIN32FILE_IOWIN*)stream) -> hf; + if (hFile != NULL) + { + CloseHandle(hFile); + ret=0; + } + free(stream); + } + return ret; +} + +int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream) +{ + int ret=-1; + if (stream!=NULL) + { + ret = ((WIN32FILE_IOWIN*)stream) -> error; + } + return ret; +} + +void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen_file = win32_open_file_func; + pzlib_filefunc_def->zread_file = win32_read_file_func; + pzlib_filefunc_def->zwrite_file = win32_write_file_func; + pzlib_filefunc_def->ztell_file = win32_tell_file_func; + pzlib_filefunc_def->zseek_file = win32_seek_file_func; + pzlib_filefunc_def->zclose_file = win32_close_file_func; + pzlib_filefunc_def->zerror_file = win32_error_file_func; + pzlib_filefunc_def->opaque = NULL; +} + +void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen64_file = win32_open64_file_func; + pzlib_filefunc_def->zread_file = win32_read_file_func; + pzlib_filefunc_def->zwrite_file = win32_write_file_func; + pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; + pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; + pzlib_filefunc_def->zclose_file = win32_close_file_func; + pzlib_filefunc_def->zerror_file = win32_error_file_func; + pzlib_filefunc_def->opaque = NULL; +} + + +void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA; + pzlib_filefunc_def->zread_file = win32_read_file_func; + pzlib_filefunc_def->zwrite_file = win32_write_file_func; + pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; + pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; + pzlib_filefunc_def->zclose_file = win32_close_file_func; + pzlib_filefunc_def->zerror_file = win32_error_file_func; + pzlib_filefunc_def->opaque = NULL; +} + + +void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW; + pzlib_filefunc_def->zread_file = win32_read_file_func; + pzlib_filefunc_def->zwrite_file = win32_write_file_func; + pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; + pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; + pzlib_filefunc_def->zclose_file = win32_close_file_func; + pzlib_filefunc_def->zerror_file = win32_error_file_func; + pzlib_filefunc_def->opaque = NULL; +} diff --git a/zlib/contrib/minizip/iowin32.h b/zlib/contrib/minizip/iowin32.h new file mode 100644 index 0000000..0ca0969 --- /dev/null +++ b/zlib/contrib/minizip/iowin32.h @@ -0,0 +1,28 @@ +/* iowin32.h -- IO base function header for compress/uncompress .zip + Version 1.1, February 14h, 2010 + part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) + + Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + + For more info read MiniZip_info.txt + +*/ + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); +void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); +void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); +void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); + +#ifdef __cplusplus +} +#endif diff --git a/zlib/contrib/minizip/make_vms.com b/zlib/contrib/minizip/make_vms.com new file mode 100644 index 0000000..9ac13a9 --- /dev/null +++ b/zlib/contrib/minizip/make_vms.com @@ -0,0 +1,25 @@ +$ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig +$ open/write zdef vmsdefs.h +$ copy sys$input: zdef +$ deck +#define unix +#define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from +#define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator +#define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord +#define Write_EndOfCentralDirectoryRecord Write_EoDRecord +$ eod +$ close zdef +$ copy vmsdefs.h,ioapi.h_orig ioapi.h +$ cc/include=[--]/prefix=all ioapi.c +$ cc/include=[--]/prefix=all miniunz.c +$ cc/include=[--]/prefix=all unzip.c +$ cc/include=[--]/prefix=all minizip.c +$ cc/include=[--]/prefix=all zip.c +$ link miniunz,unzip,ioapi,[--]libz.olb/lib +$ link minizip,zip,ioapi,[--]libz.olb/lib +$ mcr []minizip test minizip_info.txt +$ mcr []miniunz -l test.zip +$ rename minizip_info.txt; minizip_info.txt_old +$ mcr []miniunz test.zip +$ delete test.zip;* +$exit diff --git a/zlib/contrib/minizip/miniunz.c b/zlib/contrib/minizip/miniunz.c new file mode 100644 index 0000000..9ed009f --- /dev/null +++ b/zlib/contrib/minizip/miniunz.c @@ -0,0 +1,648 @@ +/* + miniunz.c + Version 1.1, February 14h, 2010 + sample part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) + + Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + + Modifications of Unzip for Zip64 + Copyright (C) 2007-2008 Even Rouault + + Modifications for Zip64 support on both zip and unzip + Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) +*/ + +#ifndef _WIN32 + #ifndef __USE_FILE_OFFSET64 + #define __USE_FILE_OFFSET64 + #endif + #ifndef __USE_LARGEFILE64 + #define __USE_LARGEFILE64 + #endif + #ifndef _LARGEFILE64_SOURCE + #define _LARGEFILE64_SOURCE + #endif + #ifndef _FILE_OFFSET_BIT + #define _FILE_OFFSET_BIT 64 + #endif +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef unix +# include +# include +#else +# include +# include +#endif + +#include "unzip.h" + +#define CASESENSITIVITY (0) +#define WRITEBUFFERSIZE (8192) +#define MAXFILENAME (256) + +#ifdef _WIN32 +#define USEWIN32IOAPI +#include "iowin32.h" +#endif +/* + mini unzip, demo of unzip package + + usage : + Usage : miniunz [-exvlo] file.zip [file_to_extract] [-d extractdir] + + list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT + if it exists +*/ + + +/* change_file_date : change the date/time of a file + filename : the filename of the file where date/time must be modified + dosdate : the new date at the MSDos format (4 bytes) + tmu_date : the SAME new date at the tm_unz format */ +void change_file_date(filename,dosdate,tmu_date) + const char *filename; + uLong dosdate; + tm_unz tmu_date; +{ +#ifdef _WIN32 + HANDLE hFile; + FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; + + hFile = CreateFileA(filename,GENERIC_READ | GENERIC_WRITE, + 0,NULL,OPEN_EXISTING,0,NULL); + GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite); + DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal); + LocalFileTimeToFileTime(&ftLocal,&ftm); + SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); + CloseHandle(hFile); +#else +#ifdef unix + struct utimbuf ut; + struct tm newdate; + newdate.tm_sec = tmu_date.tm_sec; + newdate.tm_min=tmu_date.tm_min; + newdate.tm_hour=tmu_date.tm_hour; + newdate.tm_mday=tmu_date.tm_mday; + newdate.tm_mon=tmu_date.tm_mon; + if (tmu_date.tm_year > 1900) + newdate.tm_year=tmu_date.tm_year - 1900; + else + newdate.tm_year=tmu_date.tm_year ; + newdate.tm_isdst=-1; + + ut.actime=ut.modtime=mktime(&newdate); + utime(filename,&ut); +#endif +#endif +} + + +/* mymkdir and change_file_date are not 100 % portable + As I don't know well Unix, I wait feedback for the unix portion */ + +int mymkdir(dirname) + const char* dirname; +{ + int ret=0; +#ifdef _WIN32 + ret = _mkdir(dirname); +#else +#ifdef unix + ret = mkdir (dirname,0775); +#endif +#endif + return ret; +} + +int makedir (newdir) + char *newdir; +{ + char *buffer ; + char *p; + int len = (int)strlen(newdir); + + if (len <= 0) + return 0; + + buffer = (char*)malloc(len+1); + if (buffer==NULL) + { + printf("Error allocating memory\n"); + return UNZ_INTERNALERROR; + } + strcpy(buffer,newdir); + + if (buffer[len-1] == '/') { + buffer[len-1] = '\0'; + } + if (mymkdir(buffer) == 0) + { + free(buffer); + return 1; + } + + p = buffer+1; + while (1) + { + char hold; + + while(*p && *p != '\\' && *p != '/') + p++; + hold = *p; + *p = 0; + if ((mymkdir(buffer) == -1) && (errno == ENOENT)) + { + printf("couldn't create directory %s\n",buffer); + free(buffer); + return 0; + } + if (hold == 0) + break; + *p++ = hold; + } + free(buffer); + return 1; +} + +void do_banner() +{ + printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); + printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); +} + +void do_help() +{ + printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ + " -e Extract without pathname (junk paths)\n" \ + " -x Extract with pathname\n" \ + " -v list files\n" \ + " -l list files\n" \ + " -d directory to extract into\n" \ + " -o overwrite files without prompting\n" \ + " -p extract crypted file using password\n\n"); +} + +void Display64BitsSize(ZPOS64_T n, int size_char) +{ + /* to avoid compatibility problem , we do here the conversion */ + char number[21]; + int offset=19; + int pos_string = 19; + number[20]=0; + for (;;) { + number[offset]=(char)((n%10)+'0'); + if (number[offset] != '0') + pos_string=offset; + n/=10; + if (offset==0) + break; + offset--; + } + { + int size_display_string = 19-pos_string; + while (size_char > size_display_string) + { + size_char--; + printf(" "); + } + } + + printf("%s",&number[pos_string]); +} + +int do_list(uf) + unzFile uf; +{ + uLong i; + unz_global_info64 gi; + int err; + + err = unzGetGlobalInfo64(uf,&gi); + if (err!=UNZ_OK) + printf("error %d with zipfile in unzGetGlobalInfo \n",err); + printf(" Length Method Size Ratio Date Time CRC-32 Name\n"); + printf(" ------ ------ ---- ----- ---- ---- ------ ----\n"); + for (i=0;i0) + ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size); + + /* display a '*' if the file is crypted */ + if ((file_info.flag & 1) != 0) + charCrypt='*'; + + if (file_info.compression_method==0) + string_method="Stored"; + else + if (file_info.compression_method==Z_DEFLATED) + { + uInt iLevel=(uInt)((file_info.flag & 0x6)/2); + if (iLevel==0) + string_method="Defl:N"; + else if (iLevel==1) + string_method="Defl:X"; + else if ((iLevel==2) || (iLevel==3)) + string_method="Defl:F"; /* 2:fast , 3 : extra fast*/ + } + else + if (file_info.compression_method==Z_BZIP2ED) + { + string_method="BZip2 "; + } + else + string_method="Unkn. "; + + Display64BitsSize(file_info.uncompressed_size,7); + printf(" %6s%c",string_method,charCrypt); + Display64BitsSize(file_info.compressed_size,7); + printf(" %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n", + ratio, + (uLong)file_info.tmu_date.tm_mon + 1, + (uLong)file_info.tmu_date.tm_mday, + (uLong)file_info.tmu_date.tm_year % 100, + (uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min, + (uLong)file_info.crc,filename_inzip); + if ((i+1)='a') && (rep<='z')) + rep -= 0x20; + } + while ((rep!='Y') && (rep!='N') && (rep!='A')); + } + + if (rep == 'N') + skip = 1; + + if (rep == 'A') + *popt_overwrite=1; + } + + if ((skip==0) && (err==UNZ_OK)) + { + fout=fopen64(write_filename,"wb"); + + /* some zipfile don't contain directory alone before file */ + if ((fout==NULL) && ((*popt_extract_without_path)==0) && + (filename_withoutpath!=(char*)filename_inzip)) + { + char c=*(filename_withoutpath-1); + *(filename_withoutpath-1)='\0'; + makedir(write_filename); + *(filename_withoutpath-1)=c; + fout=fopen64(write_filename,"wb"); + } + + if (fout==NULL) + { + printf("error opening %s\n",write_filename); + } + } + + if (fout!=NULL) + { + printf(" extracting: %s\n",write_filename); + + do + { + err = unzReadCurrentFile(uf,buf,size_buf); + if (err<0) + { + printf("error %d with zipfile in unzReadCurrentFile\n",err); + break; + } + if (err>0) + if (fwrite(buf,err,1,fout)!=1) + { + printf("error in writing extracted file\n"); + err=UNZ_ERRNO; + break; + } + } + while (err>0); + if (fout) + fclose(fout); + + if (err==0) + change_file_date(write_filename,file_info.dosDate, + file_info.tmu_date); + } + + if (err==UNZ_OK) + { + err = unzCloseCurrentFile (uf); + if (err!=UNZ_OK) + { + printf("error %d with zipfile in unzCloseCurrentFile\n",err); + } + } + else + unzCloseCurrentFile(uf); /* don't lose the error */ + } + + free(buf); + return err; +} + + +int do_extract(uf,opt_extract_without_path,opt_overwrite,password) + unzFile uf; + int opt_extract_without_path; + int opt_overwrite; + const char* password; +{ + uLong i; + unz_global_info64 gi; + int err; + FILE* fout=NULL; + + err = unzGetGlobalInfo64(uf,&gi); + if (err!=UNZ_OK) + printf("error %d with zipfile in unzGetGlobalInfo \n",err); + + for (i=0;i +#include +#include +#include +#include +#include + +#ifdef unix +# include +# include +# include +# include +#else +# include +# include +#endif + +#include "zip.h" + +#ifdef _WIN32 + #define USEWIN32IOAPI + #include "iowin32.h" +#endif + + + +#define WRITEBUFFERSIZE (16384) +#define MAXFILENAME (256) + +#ifdef _WIN32 +uLong filetime(f, tmzip, dt) + char *f; /* name of file to get info on */ + tm_zip *tmzip; /* return value: access, modific. and creation times */ + uLong *dt; /* dostime */ +{ + int ret = 0; + { + FILETIME ftLocal; + HANDLE hFind; + WIN32_FIND_DATAA ff32; + + hFind = FindFirstFileA(f,&ff32); + if (hFind != INVALID_HANDLE_VALUE) + { + FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal); + FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0); + FindClose(hFind); + ret = 1; + } + } + return ret; +} +#else +#ifdef unix +uLong filetime(f, tmzip, dt) + char *f; /* name of file to get info on */ + tm_zip *tmzip; /* return value: access, modific. and creation times */ + uLong *dt; /* dostime */ +{ + int ret=0; + struct stat s; /* results of stat() */ + struct tm* filedate; + time_t tm_t=0; + + if (strcmp(f,"-")!=0) + { + char name[MAXFILENAME+1]; + int len = strlen(f); + if (len > MAXFILENAME) + len = MAXFILENAME; + + strncpy(name, f,MAXFILENAME-1); + /* strncpy doesnt append the trailing NULL, of the string is too long. */ + name[ MAXFILENAME ] = '\0'; + + if (name[len - 1] == '/') + name[len - 1] = '\0'; + /* not all systems allow stat'ing a file with / appended */ + if (stat(name,&s)==0) + { + tm_t = s.st_mtime; + ret = 1; + } + } + filedate = localtime(&tm_t); + + tmzip->tm_sec = filedate->tm_sec; + tmzip->tm_min = filedate->tm_min; + tmzip->tm_hour = filedate->tm_hour; + tmzip->tm_mday = filedate->tm_mday; + tmzip->tm_mon = filedate->tm_mon ; + tmzip->tm_year = filedate->tm_year; + + return ret; +} +#else +uLong filetime(f, tmzip, dt) + char *f; /* name of file to get info on */ + tm_zip *tmzip; /* return value: access, modific. and creation times */ + uLong *dt; /* dostime */ +{ + return 0; +} +#endif +#endif + + + + +int check_exist_file(filename) + const char* filename; +{ + FILE* ftestexist; + int ret = 1; + ftestexist = fopen64(filename,"rb"); + if (ftestexist==NULL) + ret = 0; + else + fclose(ftestexist); + return ret; +} + +void do_banner() +{ + printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n"); + printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n"); +} + +void do_help() +{ + printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ + " -o Overwrite existing file.zip\n" \ + " -a Append to existing file.zip\n" \ + " -0 Store only\n" \ + " -1 Compress faster\n" \ + " -9 Compress better\n\n" \ + " -j exclude path. store only the file name.\n\n"); +} + +/* calculate the CRC32 of a file, + because to encrypt a file, we need known the CRC32 of the file before */ +int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) +{ + unsigned long calculate_crc=0; + int err=ZIP_OK; + FILE * fin = fopen64(filenameinzip,"rb"); + unsigned long size_read = 0; + unsigned long total_read = 0; + if (fin==NULL) + { + err = ZIP_ERRNO; + } + + if (err == ZIP_OK) + do + { + err = ZIP_OK; + size_read = (int)fread(buf,1,size_buf,fin); + if (size_read < size_buf) + if (feof(fin)==0) + { + printf("error in reading %s\n",filenameinzip); + err = ZIP_ERRNO; + } + + if (size_read>0) + calculate_crc = crc32(calculate_crc,buf,size_read); + total_read += size_read; + + } while ((err == ZIP_OK) && (size_read>0)); + + if (fin) + fclose(fin); + + *result_crc=calculate_crc; + printf("file %s crc %lx\n", filenameinzip, calculate_crc); + return err; +} + +int isLargeFile(const char* filename) +{ + int largeFile = 0; + ZPOS64_T pos = 0; + FILE* pFile = fopen64(filename, "rb"); + + if(pFile != NULL) + { + int n = fseeko64(pFile, 0, SEEK_END); + + pos = ftello64(pFile); + + printf("File : %s is %lld bytes\n", filename, pos); + + if(pos >= 0xffffffff) + largeFile = 1; + + fclose(pFile); + } + + return largeFile; +} + +int main(argc,argv) + int argc; + char *argv[]; +{ + int i; + int opt_overwrite=0; + int opt_compress_level=Z_DEFAULT_COMPRESSION; + int opt_exclude_path=0; + int zipfilenamearg = 0; + char filename_try[MAXFILENAME+16]; + int zipok; + int err=0; + int size_buf=0; + void* buf=NULL; + const char* password=NULL; + + + do_banner(); + if (argc==1) + { + do_help(); + return 0; + } + else + { + for (i=1;i='0') && (c<='9')) + opt_compress_level = c-'0'; + if ((c=='j') || (c=='J')) + opt_exclude_path = 1; + + if (((c=='p') || (c=='P')) && (i+1='a') && (rep<='z')) + rep -= 0x20; + } + while ((rep!='Y') && (rep!='N') && (rep!='A')); + if (rep=='N') + zipok = 0; + if (rep=='A') + opt_overwrite = 2; + } + } + + if (zipok==1) + { + zipFile zf; + int errclose; +# ifdef USEWIN32IOAPI + zlib_filefunc64_def ffunc; + fill_win32_filefunc64A(&ffunc); + zf = zipOpen2_64(filename_try,(opt_overwrite==2) ? 2 : 0,NULL,&ffunc); +# else + zf = zipOpen64(filename_try,(opt_overwrite==2) ? 2 : 0); +# endif + + if (zf == NULL) + { + printf("error opening %s\n",filename_try); + err= ZIP_ERRNO; + } + else + printf("creating %s\n",filename_try); + + for (i=zipfilenamearg+1;(i='0') || (argv[i][1]<='9'))) && + (strlen(argv[i]) == 2))) + { + FILE * fin; + int size_read; + const char* filenameinzip = argv[i]; + const char *savefilenameinzip; + zip_fileinfo zi; + unsigned long crcFile=0; + int zip64 = 0; + + zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour = + zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0; + zi.dosDate = 0; + zi.internal_fa = 0; + zi.external_fa = 0; + filetime(filenameinzip,&zi.tmz_date,&zi.dosDate); + +/* + err = zipOpenNewFileInZip(zf,filenameinzip,&zi, + NULL,0,NULL,0,NULL / * comment * /, + (opt_compress_level != 0) ? Z_DEFLATED : 0, + opt_compress_level); +*/ + if ((password != NULL) && (err==ZIP_OK)) + err = getFileCrc(filenameinzip,buf,size_buf,&crcFile); + + zip64 = isLargeFile(filenameinzip); + + /* The path name saved, should not include a leading slash. */ + /*if it did, windows/xp and dynazip couldn't read the zip file. */ + savefilenameinzip = filenameinzip; + while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' ) + { + savefilenameinzip++; + } + + /*should the zip file contain any path at all?*/ + if( opt_exclude_path ) + { + const char *tmpptr; + const char *lastslash = 0; + for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++) + { + if( *tmpptr == '\\' || *tmpptr == '/') + { + lastslash = tmpptr; + } + } + if( lastslash != NULL ) + { + savefilenameinzip = lastslash+1; // base filename follows last slash. + } + } + + /**/ + err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi, + NULL,0,NULL,0,NULL /* comment*/, + (opt_compress_level != 0) ? Z_DEFLATED : 0, + opt_compress_level,0, + /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */ + -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, + password,crcFile, zip64); + + if (err != ZIP_OK) + printf("error in opening %s in zipfile\n",filenameinzip); + else + { + fin = fopen64(filenameinzip,"rb"); + if (fin==NULL) + { + err=ZIP_ERRNO; + printf("error in opening %s for reading\n",filenameinzip); + } + } + + if (err == ZIP_OK) + do + { + err = ZIP_OK; + size_read = (int)fread(buf,1,size_buf,fin); + if (size_read < size_buf) + if (feof(fin)==0) + { + printf("error in reading %s\n",filenameinzip); + err = ZIP_ERRNO; + } + + if (size_read>0) + { + err = zipWriteInFileInZip (zf,buf,size_read); + if (err<0) + { + printf("error in writing %s in the zipfile\n", + filenameinzip); + } + + } + } while ((err == ZIP_OK) && (size_read>0)); + + if (fin) + fclose(fin); + + if (err<0) + err=ZIP_ERRNO; + else + { + err = zipCloseFileInZip(zf); + if (err!=ZIP_OK) + printf("error in closing %s in the zipfile\n", + filenameinzip); + } + } + } + errclose = zipClose(zf,NULL); + if (errclose != ZIP_OK) + printf("error in closing %s\n",filename_try); + } + else + { + do_help(); + } + + free(buf); + return 0; +} diff --git a/zlib/contrib/minizip/mztools.c b/zlib/contrib/minizip/mztools.c new file mode 100644 index 0000000..f9092e6 --- /dev/null +++ b/zlib/contrib/minizip/mztools.c @@ -0,0 +1,281 @@ +/* + Additional tools for Minizip + Code: Xavier Roche '2004 + License: Same as ZLIB (www.gzip.org) +*/ + +/* Code */ +#include +#include +#include +#include "zlib.h" +#include "unzip.h" + +#define READ_8(adr) ((unsigned char)*(adr)) +#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) ) +#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) ) + +#define WRITE_8(buff, n) do { \ + *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \ +} while(0) +#define WRITE_16(buff, n) do { \ + WRITE_8((unsigned char*)(buff), n); \ + WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \ +} while(0) +#define WRITE_32(buff, n) do { \ + WRITE_16((unsigned char*)(buff), (n) & 0xffff); \ + WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ +} while(0) + +extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) +const char* file; +const char* fileOut; +const char* fileOutTmp; +uLong* nRecovered; +uLong* bytesRecovered; +{ + int err = Z_OK; + FILE* fpZip = fopen(file, "rb"); + FILE* fpOut = fopen(fileOut, "wb"); + FILE* fpOutCD = fopen(fileOutTmp, "wb"); + if (fpZip != NULL && fpOut != NULL) { + int entries = 0; + uLong totalBytes = 0; + char header[30]; + char filename[256]; + char extra[1024]; + int offset = 0; + int offsetCD = 0; + while ( fread(header, 1, 30, fpZip) == 30 ) { + int currentOffset = offset; + + /* File entry */ + if (READ_32(header) == 0x04034b50) { + unsigned int version = READ_16(header + 4); + unsigned int gpflag = READ_16(header + 6); + unsigned int method = READ_16(header + 8); + unsigned int filetime = READ_16(header + 10); + unsigned int filedate = READ_16(header + 12); + unsigned int crc = READ_32(header + 14); /* crc */ + unsigned int cpsize = READ_32(header + 18); /* compressed size */ + unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */ + unsigned int fnsize = READ_16(header + 26); /* file name length */ + unsigned int extsize = READ_16(header + 28); /* extra field length */ + filename[0] = extra[0] = '\0'; + + /* Header */ + if (fwrite(header, 1, 30, fpOut) == 30) { + offset += 30; + } else { + err = Z_ERRNO; + break; + } + + /* Filename */ + if (fnsize > 0) { + if (fread(filename, 1, fnsize, fpZip) == fnsize) { + if (fwrite(filename, 1, fnsize, fpOut) == fnsize) { + offset += fnsize; + } else { + err = Z_ERRNO; + break; + } + } else { + err = Z_ERRNO; + break; + } + } else { + err = Z_STREAM_ERROR; + break; + } + + /* Extra field */ + if (extsize > 0) { + if (fread(extra, 1, extsize, fpZip) == extsize) { + if (fwrite(extra, 1, extsize, fpOut) == extsize) { + offset += extsize; + } else { + err = Z_ERRNO; + break; + } + } else { + err = Z_ERRNO; + break; + } + } + + /* Data */ + { + int dataSize = cpsize; + if (dataSize == 0) { + dataSize = uncpsize; + } + if (dataSize > 0) { + char* data = malloc(dataSize); + if (data != NULL) { + if ((int)fread(data, 1, dataSize, fpZip) == dataSize) { + if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) { + offset += dataSize; + totalBytes += dataSize; + } else { + err = Z_ERRNO; + } + } else { + err = Z_ERRNO; + } + free(data); + if (err != Z_OK) { + break; + } + } else { + err = Z_MEM_ERROR; + break; + } + } + } + + /* Central directory entry */ + { + char header[46]; + char* comment = ""; + int comsize = (int) strlen(comment); + WRITE_32(header, 0x02014b50); + WRITE_16(header + 4, version); + WRITE_16(header + 6, version); + WRITE_16(header + 8, gpflag); + WRITE_16(header + 10, method); + WRITE_16(header + 12, filetime); + WRITE_16(header + 14, filedate); + WRITE_32(header + 16, crc); + WRITE_32(header + 20, cpsize); + WRITE_32(header + 24, uncpsize); + WRITE_16(header + 28, fnsize); + WRITE_16(header + 30, extsize); + WRITE_16(header + 32, comsize); + WRITE_16(header + 34, 0); /* disk # */ + WRITE_16(header + 36, 0); /* int attrb */ + WRITE_32(header + 38, 0); /* ext attrb */ + WRITE_32(header + 42, currentOffset); + /* Header */ + if (fwrite(header, 1, 46, fpOutCD) == 46) { + offsetCD += 46; + + /* Filename */ + if (fnsize > 0) { + if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) { + offsetCD += fnsize; + } else { + err = Z_ERRNO; + break; + } + } else { + err = Z_STREAM_ERROR; + break; + } + + /* Extra field */ + if (extsize > 0) { + if (fwrite(extra, 1, extsize, fpOutCD) == extsize) { + offsetCD += extsize; + } else { + err = Z_ERRNO; + break; + } + } + + /* Comment field */ + if (comsize > 0) { + if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { + offsetCD += comsize; + } else { + err = Z_ERRNO; + break; + } + } + + + } else { + err = Z_ERRNO; + break; + } + } + + /* Success */ + entries++; + + } else { + break; + } + } + + /* Final central directory */ + { + int entriesZip = entries; + char header[22]; + char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; + int comsize = (int) strlen(comment); + if (entriesZip > 0xffff) { + entriesZip = 0xffff; + } + WRITE_32(header, 0x06054b50); + WRITE_16(header + 4, 0); /* disk # */ + WRITE_16(header + 6, 0); /* disk # */ + WRITE_16(header + 8, entriesZip); /* hack */ + WRITE_16(header + 10, entriesZip); /* hack */ + WRITE_32(header + 12, offsetCD); /* size of CD */ + WRITE_32(header + 16, offset); /* offset to CD */ + WRITE_16(header + 20, comsize); /* comment */ + + /* Header */ + if (fwrite(header, 1, 22, fpOutCD) == 22) { + + /* Comment field */ + if (comsize > 0) { + if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { + err = Z_ERRNO; + } + } + + } else { + err = Z_ERRNO; + } + } + + /* Final merge (file + central directory) */ + fclose(fpOutCD); + if (err == Z_OK) { + fpOutCD = fopen(fileOutTmp, "rb"); + if (fpOutCD != NULL) { + int nRead; + char buffer[8192]; + while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) { + if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) { + err = Z_ERRNO; + break; + } + } + fclose(fpOutCD); + } + } + + /* Close */ + fclose(fpZip); + fclose(fpOut); + + /* Wipe temporary file */ + (void)remove(fileOutTmp); + + /* Number of recovered entries */ + if (err == Z_OK) { + if (nRecovered != NULL) { + *nRecovered = entries; + } + if (bytesRecovered != NULL) { + *bytesRecovered = totalBytes; + } + } + } else { + err = Z_STREAM_ERROR; + } + return err; +} diff --git a/zlib/contrib/minizip/mztools.h b/zlib/contrib/minizip/mztools.h new file mode 100644 index 0000000..88b3459 --- /dev/null +++ b/zlib/contrib/minizip/mztools.h @@ -0,0 +1,31 @@ +/* + Additional tools for Minizip + Code: Xavier Roche '2004 + License: Same as ZLIB (www.gzip.org) +*/ + +#ifndef _zip_tools_H +#define _zip_tools_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ZLIB_H +#include "zlib.h" +#endif + +#include "unzip.h" + +/* Repair a ZIP file (missing central directory) + file: file to recover + fileOut: output file after recovery + fileOutTmp: temporary file name used for recovery +*/ +extern int ZEXPORT unzRepair(const char* file, + const char* fileOut, + const char* fileOutTmp, + uLong* nRecovered, + uLong* bytesRecovered); + +#endif diff --git a/zlib/contrib/minizip/unzip.c b/zlib/contrib/minizip/unzip.c new file mode 100644 index 0000000..7617f41 --- /dev/null +++ b/zlib/contrib/minizip/unzip.c @@ -0,0 +1,2125 @@ +/* unzip.c -- IO for uncompress .zip files using zlib + Version 1.1, February 14h, 2010 + part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) + + Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + + Modifications of Unzip for Zip64 + Copyright (C) 2007-2008 Even Rouault + + Modifications for Zip64 support on both zip and unzip + Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + + For more info read MiniZip_info.txt + + + ------------------------------------------------------------------------------------ + Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of + compatibility with older software. The following is from the original crypt.c. + Code woven in by Terry Thorsen 1/2003. + + Copyright (c) 1990-2000 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2000-Apr-09 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, all these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html + + crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h] + + The encryption/decryption parts of this source code (as opposed to the + non-echoing password parts) were originally written in Europe. The + whole source package can be freely distributed, including from the USA. + (Prior to January 2000, re-export from the US was a violation of US law.) + + This encryption code is a direct transcription of the algorithm from + Roger Schlafly, described by Phil Katz in the file appnote.txt. This + file (appnote.txt) is distributed with the PKZIP program (even in the + version without encryption capabilities). + + ------------------------------------------------------------------------------------ + + Changes in unzip.c + + 2007-2008 - Even Rouault - Addition of cpl_unzGetCurrentFileZStreamPos + 2007-2008 - Even Rouault - Decoration of symbol names unz* -> cpl_unz* + 2007-2008 - Even Rouault - Remove old C style function prototypes + 2007-2008 - Even Rouault - Add unzip support for ZIP64 + + Copyright (C) 2007-2008 Even Rouault + + + Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again). + Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G + should only read the compressed/uncompressed size from the Zip64 format if + the size from normal header was 0xFFFFFFFF + Oct-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant + Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required) + Patch created by Daniel Borca + + Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer + + Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson + +*/ + + +#include +#include +#include + +#ifndef NOUNCRYPT + #define NOUNCRYPT +#endif + +#include "zlib.h" +#include "unzip.h" + +#ifdef STDC +# include +# include +# include +#endif +#ifdef NO_ERRNO_H + extern int errno; +#else +# include +#endif + + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + + +#ifndef CASESENSITIVITYDEFAULT_NO +# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) +# define CASESENSITIVITYDEFAULT_NO +# endif +#endif + + +#ifndef UNZ_BUFSIZE +#define UNZ_BUFSIZE (16384) +#endif + +#ifndef UNZ_MAXFILENAMEINZIP +#define UNZ_MAXFILENAMEINZIP (256) +#endif + +#ifndef ALLOC +# define ALLOC(size) (malloc(size)) +#endif +#ifndef TRYFREE +# define TRYFREE(p) {if (p) free(p);} +#endif + +#define SIZECENTRALDIRITEM (0x2e) +#define SIZEZIPLOCALHEADER (0x1e) + + +const char unz_copyright[] = + " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; + +/* unz_file_info_interntal contain internal info about a file in zipfile*/ +typedef struct unz_file_info64_internal_s +{ + ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ +} unz_file_info64_internal; + + +/* file_in_zip_read_info_s contain internal information about a file in zipfile, + when reading and decompress it */ +typedef struct +{ + char *read_buffer; /* internal buffer for compressed data */ + z_stream stream; /* zLib stream structure for inflate */ + +#ifdef HAVE_BZIP2 + bz_stream bstream; /* bzLib stream structure for bziped */ +#endif + + ZPOS64_T pos_in_zipfile; /* position in byte on the zipfile, for fseek*/ + uLong stream_initialised; /* flag set if stream structure is initialised*/ + + ZPOS64_T offset_local_extrafield;/* offset of the local extra field */ + uInt size_local_extrafield;/* size of the local extra field */ + ZPOS64_T pos_local_extrafield; /* position in the local extra field in read*/ + ZPOS64_T total_out_64; + + uLong crc32; /* crc32 of all data uncompressed */ + uLong crc32_wait; /* crc32 we must obtain after decompress all */ + ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */ + ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/ + zlib_filefunc64_32_def z_filefunc; + voidpf filestream; /* io structore of the zipfile */ + uLong compression_method; /* compression method (0==store) */ + ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ + int raw; +} file_in_zip64_read_info_s; + + +/* unz64_s contain internal information about the zipfile +*/ +typedef struct +{ + zlib_filefunc64_32_def z_filefunc; + int is64bitOpenFunction; + voidpf filestream; /* io structore of the zipfile */ + unz_global_info64 gi; /* public global information */ + ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ + ZPOS64_T num_file; /* number of the current file in the zipfile*/ + ZPOS64_T pos_in_central_dir; /* pos of the current file in the central dir*/ + ZPOS64_T current_file_ok; /* flag about the usability of the current file*/ + ZPOS64_T central_pos; /* position of the beginning of the central dir*/ + + ZPOS64_T size_central_dir; /* size of the central directory */ + ZPOS64_T offset_central_dir; /* offset of start of central directory with + respect to the starting disk number */ + + unz_file_info64 cur_file_info; /* public info about the current file in zip*/ + unz_file_info64_internal cur_file_info_internal; /* private info about it*/ + file_in_zip64_read_info_s* pfile_in_zip_read; /* structure about the current + file if we are decompressing it */ + int encrypted; + + int isZip64; + +# ifndef NOUNCRYPT + unsigned long keys[3]; /* keys defining the pseudo-random sequence */ + const unsigned long* pcrc_32_tab; +# endif +} unz64_s; + + +#ifndef NOUNCRYPT +#include "crypt.h" +#endif + +/* =========================================================================== + Read a byte from a gz_stream; update next_in and avail_in. Return EOF + for end of file. + IN assertion: the stream s has been sucessfully opened for reading. +*/ + + +local int unz64local_getByte OF(( + const zlib_filefunc64_32_def* pzlib_filefunc_def, + voidpf filestream, + int *pi)); + +local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi) +{ + unsigned char c; + int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); + if (err==1) + { + *pi = (int)c; + return UNZ_OK; + } + else + { + if (ZERROR64(*pzlib_filefunc_def,filestream)) + return UNZ_ERRNO; + else + return UNZ_EOF; + } +} + + +/* =========================================================================== + Reads a long in LSB order from the given gz_stream. Sets +*/ +local int unz64local_getShort OF(( + const zlib_filefunc64_32_def* pzlib_filefunc_def, + voidpf filestream, + uLong *pX)); + +local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, + voidpf filestream, + uLong *pX) +{ + uLong x ; + int i = 0; + int err; + + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x = (uLong)i; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x |= ((uLong)i)<<8; + + if (err==UNZ_OK) + *pX = x; + else + *pX = 0; + return err; +} + +local int unz64local_getLong OF(( + const zlib_filefunc64_32_def* pzlib_filefunc_def, + voidpf filestream, + uLong *pX)); + +local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, + voidpf filestream, + uLong *pX) +{ + uLong x ; + int i = 0; + int err; + + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x = (uLong)i; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x |= ((uLong)i)<<8; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x |= ((uLong)i)<<16; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((uLong)i)<<24; + + if (err==UNZ_OK) + *pX = x; + else + *pX = 0; + return err; +} + +local int unz64local_getLong64 OF(( + const zlib_filefunc64_32_def* pzlib_filefunc_def, + voidpf filestream, + ZPOS64_T *pX)); + + +local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, + voidpf filestream, + ZPOS64_T *pX) +{ + ZPOS64_T x ; + int i = 0; + int err; + + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x = (ZPOS64_T)i; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x |= ((ZPOS64_T)i)<<8; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x |= ((ZPOS64_T)i)<<16; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x |= ((ZPOS64_T)i)<<24; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x |= ((ZPOS64_T)i)<<32; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x |= ((ZPOS64_T)i)<<40; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x |= ((ZPOS64_T)i)<<48; + + if (err==UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); + x |= ((ZPOS64_T)i)<<56; + + if (err==UNZ_OK) + *pX = x; + else + *pX = 0; + return err; +} + +/* My own strcmpi / strcasecmp */ +local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2) +{ + for (;;) + { + char c1=*(fileName1++); + char c2=*(fileName2++); + if ((c1>='a') && (c1<='z')) + c1 -= 0x20; + if ((c2>='a') && (c2<='z')) + c2 -= 0x20; + if (c1=='\0') + return ((c2=='\0') ? 0 : -1); + if (c2=='\0') + return 1; + if (c1c2) + return 1; + } +} + + +#ifdef CASESENSITIVITYDEFAULT_NO +#define CASESENSITIVITYDEFAULTVALUE 2 +#else +#define CASESENSITIVITYDEFAULTVALUE 1 +#endif + +#ifndef STRCMPCASENOSENTIVEFUNCTION +#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal +#endif + +/* + Compare two filename (fileName1,fileName2). + If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) + If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi + or strcasecmp) + If iCaseSenisivity = 0, case sensitivity is defaut of your operating system + (like 1 on Unix, 2 on Windows) + +*/ +extern int ZEXPORT unzStringFileNameCompare (const char* fileName1, + const char* fileName2, + int iCaseSensitivity) + +{ + if (iCaseSensitivity==0) + iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; + + if (iCaseSensitivity==1) + return strcmp(fileName1,fileName2); + + return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); +} + +#ifndef BUFREADCOMMENT +#define BUFREADCOMMENT (0x400) +#endif + +/* + Locate the Central directory of a zipfile (at the end, just before + the global comment) +*/ +local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); +local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) +{ + unsigned char* buf; + ZPOS64_T uSizeFile; + ZPOS64_T uBackRead; + ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ + ZPOS64_T uPosFound=0; + + if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) + return 0; + + + uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); + + if (uMaxBack>uSizeFile) + uMaxBack = uSizeFile; + + buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); + if (buf==NULL) + return 0; + + uBackRead = 4; + while (uBackReaduMaxBack) + uBackRead = uMaxBack; + else + uBackRead+=BUFREADCOMMENT; + uReadPos = uSizeFile-uBackRead ; + + uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? + (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos); + if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) + break; + + if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) + break; + + for (i=(int)uReadSize-3; (i--)>0;) + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && + ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) + { + uPosFound = uReadPos+i; + break; + } + + if (uPosFound!=0) + break; + } + TRYFREE(buf); + return uPosFound; +} + + +/* + Locate the Central directory 64 of a zipfile (at the end, just before + the global comment) +*/ +local ZPOS64_T unz64local_SearchCentralDir64 OF(( + const zlib_filefunc64_32_def* pzlib_filefunc_def, + voidpf filestream)); + +local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, + voidpf filestream) +{ + unsigned char* buf; + ZPOS64_T uSizeFile; + ZPOS64_T uBackRead; + ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ + ZPOS64_T uPosFound=0; + uLong uL; + ZPOS64_T relativeOffset; + + if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) + return 0; + + + uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); + + if (uMaxBack>uSizeFile) + uMaxBack = uSizeFile; + + buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); + if (buf==NULL) + return 0; + + uBackRead = 4; + while (uBackReaduMaxBack) + uBackRead = uMaxBack; + else + uBackRead+=BUFREADCOMMENT; + uReadPos = uSizeFile-uBackRead ; + + uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? + (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos); + if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) + break; + + if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) + break; + + for (i=(int)uReadSize-3; (i--)>0;) + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && + ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07)) + { + uPosFound = uReadPos+i; + break; + } + + if (uPosFound!=0) + break; + } + TRYFREE(buf); + if (uPosFound == 0) + return 0; + + /* Zip64 end of central directory locator */ + if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0) + return 0; + + /* the signature, already checked */ + if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) + return 0; + + /* number of the disk with the start of the zip64 end of central directory */ + if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) + return 0; + if (uL != 0) + return 0; + + /* relative offset of the zip64 end of central directory record */ + if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK) + return 0; + + /* total number of disks */ + if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) + return 0; + if (uL != 1) + return 0; + + /* Goto end of central directory record */ + if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0) + return 0; + + /* the signature */ + if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) + return 0; + + if (uL != 0x06064b50) + return 0; + + return relativeOffset; +} + +/* + Open a Zip file. path contain the full pathname (by example, + on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer + "zlib/zlib114.zip". + If the zipfile cannot be opened (file doesn't exist or in not valid), the + return value is NULL. + Else, the return value is a unzFile Handle, usable with other function + of this unzip package. +*/ +local unzFile unzOpenInternal (const void *path, + zlib_filefunc64_32_def* pzlib_filefunc64_32_def, + int is64bitOpenFunction) +{ + unz64_s us; + unz64_s *s; + ZPOS64_T central_pos; + uLong uL; + + uLong number_disk; /* number of the current dist, used for + spaning ZIP, unsupported, always 0*/ + uLong number_disk_with_CD; /* number the the disk with central dir, used + for spaning ZIP, unsupported, always 0*/ + ZPOS64_T number_entry_CD; /* total number of entries in + the central dir + (same than number_entry on nospan) */ + + int err=UNZ_OK; + + if (unz_copyright[0]!=' ') + return NULL; + + us.z_filefunc.zseek32_file = NULL; + us.z_filefunc.ztell32_file = NULL; + if (pzlib_filefunc64_32_def==NULL) + fill_fopen64_filefunc(&us.z_filefunc.zfile_func64); + else + us.z_filefunc = *pzlib_filefunc64_32_def; + us.is64bitOpenFunction = is64bitOpenFunction; + + + + us.filestream = ZOPEN64(us.z_filefunc, + path, + ZLIB_FILEFUNC_MODE_READ | + ZLIB_FILEFUNC_MODE_EXISTING); + if (us.filestream==NULL) + return NULL; + + central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream); + if (central_pos) + { + uLong uS; + ZPOS64_T uL64; + + us.isZip64 = 1; + + if (ZSEEK64(us.z_filefunc, us.filestream, + central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) + err=UNZ_ERRNO; + + /* the signature, already checked */ + if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) + err=UNZ_ERRNO; + + /* size of zip64 end of central directory record */ + if (unz64local_getLong64(&us.z_filefunc, us.filestream,&uL64)!=UNZ_OK) + err=UNZ_ERRNO; + + /* version made by */ + if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK) + err=UNZ_ERRNO; + + /* version needed to extract */ + if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK) + err=UNZ_ERRNO; + + /* number of this disk */ + if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK) + err=UNZ_ERRNO; + + /* number of the disk with the start of the central directory */ + if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK) + err=UNZ_ERRNO; + + /* total number of entries in the central directory on this disk */ + if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK) + err=UNZ_ERRNO; + + /* total number of entries in the central directory */ + if (unz64local_getLong64(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK) + err=UNZ_ERRNO; + + if ((number_entry_CD!=us.gi.number_entry) || + (number_disk_with_CD!=0) || + (number_disk!=0)) + err=UNZ_BADZIPFILE; + + /* size of the central directory */ + if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK) + err=UNZ_ERRNO; + + /* offset of start of central directory with respect to the + starting disk number */ + if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK) + err=UNZ_ERRNO; + + us.gi.size_comment = 0; + } + else + { + central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream); + if (central_pos==0) + err=UNZ_ERRNO; + + us.isZip64 = 0; + + if (ZSEEK64(us.z_filefunc, us.filestream, + central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) + err=UNZ_ERRNO; + + /* the signature, already checked */ + if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) + err=UNZ_ERRNO; + + /* number of this disk */ + if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK) + err=UNZ_ERRNO; + + /* number of the disk with the start of the central directory */ + if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK) + err=UNZ_ERRNO; + + /* total number of entries in the central dir on this disk */ + if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) + err=UNZ_ERRNO; + us.gi.number_entry = uL; + + /* total number of entries in the central dir */ + if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) + err=UNZ_ERRNO; + number_entry_CD = uL; + + if ((number_entry_CD!=us.gi.number_entry) || + (number_disk_with_CD!=0) || + (number_disk!=0)) + err=UNZ_BADZIPFILE; + + /* size of the central directory */ + if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) + err=UNZ_ERRNO; + us.size_central_dir = uL; + + /* offset of start of central directory with respect to the + starting disk number */ + if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) + err=UNZ_ERRNO; + us.offset_central_dir = uL; + + /* zipfile comment length */ + if (unz64local_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK) + err=UNZ_ERRNO; + } + + if ((central_pospfile_in_zip_read!=NULL) + unzCloseCurrentFile(file); + + ZCLOSE64(s->z_filefunc, s->filestream); + TRYFREE(s); + return UNZ_OK; +} + + +/* + Write info about the ZipFile in the *pglobal_info structure. + No preparation of the structure is needed + return UNZ_OK if there is no problem. */ +extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info) +{ + unz64_s* s; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + *pglobal_info=s->gi; + return UNZ_OK; +} + +extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32) +{ + unz64_s* s; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + /* to do : check if number_entry is not truncated */ + pglobal_info32->number_entry = (uLong)s->gi.number_entry; + pglobal_info32->size_comment = s->gi.size_comment; + return UNZ_OK; +} +/* + Translate date/time from Dos format to tm_unz (readable more easilty) +*/ +local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) +{ + ZPOS64_T uDate; + uDate = (ZPOS64_T)(ulDosDate>>16); + ptm->tm_mday = (uInt)(uDate&0x1f) ; + ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; + ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; + + ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); + ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; + ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; +} + +/* + Get Info about the current file in the zipfile, with internal only info +*/ +local int unz64local_GetCurrentFileInfoInternal OF((unzFile file, + unz_file_info64 *pfile_info, + unz_file_info64_internal + *pfile_info_internal, + char *szFileName, + uLong fileNameBufferSize, + void *extraField, + uLong extraFieldBufferSize, + char *szComment, + uLong commentBufferSize)); + +local int unz64local_GetCurrentFileInfoInternal (unzFile file, + unz_file_info64 *pfile_info, + unz_file_info64_internal + *pfile_info_internal, + char *szFileName, + uLong fileNameBufferSize, + void *extraField, + uLong extraFieldBufferSize, + char *szComment, + uLong commentBufferSize) +{ + unz64_s* s; + unz_file_info64 file_info; + unz_file_info64_internal file_info_internal; + int err=UNZ_OK; + uLong uMagic; + long lSeek=0; + uLong uL; + + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + if (ZSEEK64(s->z_filefunc, s->filestream, + s->pos_in_central_dir+s->byte_before_the_zipfile, + ZLIB_FILEFUNC_SEEK_SET)!=0) + err=UNZ_ERRNO; + + + /* we check the magic */ + if (err==UNZ_OK) + { + if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) + err=UNZ_ERRNO; + else if (uMagic!=0x02014b50) + err=UNZ_BADZIPFILE; + } + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK) + err=UNZ_ERRNO; + + unz64local_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); + + if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) + err=UNZ_ERRNO; + file_info.compressed_size = uL; + + if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) + err=UNZ_ERRNO; + file_info.uncompressed_size = uL; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK) + err=UNZ_ERRNO; + + // relative offset of local header + if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) + err=UNZ_ERRNO; + file_info_internal.offset_curfile = uL; + + lSeek+=file_info.size_filename; + if ((err==UNZ_OK) && (szFileName!=NULL)) + { + uLong uSizeRead ; + if (file_info.size_filename0) && (fileNameBufferSize>0)) + if (ZREAD64(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead) + err=UNZ_ERRNO; + lSeek -= uSizeRead; + } + + // Read extrafield + if ((err==UNZ_OK) && (extraField!=NULL)) + { + ZPOS64_T uSizeRead ; + if (file_info.size_file_extraz_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) + lSeek=0; + else + err=UNZ_ERRNO; + } + + if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) + if (ZREAD64(s->z_filefunc, s->filestream,extraField,(uLong)uSizeRead)!=uSizeRead) + err=UNZ_ERRNO; + + lSeek += file_info.size_file_extra - (uLong)uSizeRead; + } + else + lSeek += file_info.size_file_extra; + + + if ((err==UNZ_OK) && (file_info.size_file_extra != 0)) + { + uLong acc = 0; + + // since lSeek now points to after the extra field we need to move back + lSeek -= file_info.size_file_extra; + + if (lSeek!=0) + { + if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) + lSeek=0; + else + err=UNZ_ERRNO; + } + + while(acc < file_info.size_file_extra) + { + uLong headerId; + uLong dataSize; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&dataSize) != UNZ_OK) + err=UNZ_ERRNO; + + /* ZIP64 extra fields */ + if (headerId == 0x0001) + { + uLong uL; + + if(file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1) + { + if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) + err=UNZ_ERRNO; + } + + if(file_info.compressed_size == (ZPOS64_T)(unsigned long)-1) + { + if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) + err=UNZ_ERRNO; + } + + if(file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1) + { + /* Relative Header offset */ + if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) + err=UNZ_ERRNO; + } + + if(file_info.disk_num_start == (unsigned long)-1) + { + /* Disk Start Number */ + if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) + err=UNZ_ERRNO; + } + + } + else + { + if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0) + err=UNZ_ERRNO; + } + + acc += 2 + 2 + dataSize; + } + } + + if ((err==UNZ_OK) && (szComment!=NULL)) + { + uLong uSizeRead ; + if (file_info.size_file_commentz_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) + lSeek=0; + else + err=UNZ_ERRNO; + } + + if ((file_info.size_file_comment>0) && (commentBufferSize>0)) + if (ZREAD64(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead) + err=UNZ_ERRNO; + lSeek+=file_info.size_file_comment - uSizeRead; + } + else + lSeek+=file_info.size_file_comment; + + + if ((err==UNZ_OK) && (pfile_info!=NULL)) + *pfile_info=file_info; + + if ((err==UNZ_OK) && (pfile_info_internal!=NULL)) + *pfile_info_internal=file_info_internal; + + return err; +} + + + +/* + Write info about the ZipFile in the *pglobal_info structure. + No preparation of the structure is needed + return UNZ_OK if there is no problem. +*/ +extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file, + unz_file_info64 * pfile_info, + char * szFileName, uLong fileNameBufferSize, + void *extraField, uLong extraFieldBufferSize, + char* szComment, uLong commentBufferSize) +{ + return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL, + szFileName,fileNameBufferSize, + extraField,extraFieldBufferSize, + szComment,commentBufferSize); +} + +extern int ZEXPORT unzGetCurrentFileInfo (unzFile file, + unz_file_info * pfile_info, + char * szFileName, uLong fileNameBufferSize, + void *extraField, uLong extraFieldBufferSize, + char* szComment, uLong commentBufferSize) +{ + int err; + unz_file_info64 file_info64; + err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL, + szFileName,fileNameBufferSize, + extraField,extraFieldBufferSize, + szComment,commentBufferSize); + if (err==UNZ_OK) + { + pfile_info->version = file_info64.version; + pfile_info->version_needed = file_info64.version_needed; + pfile_info->flag = file_info64.flag; + pfile_info->compression_method = file_info64.compression_method; + pfile_info->dosDate = file_info64.dosDate; + pfile_info->crc = file_info64.crc; + + pfile_info->size_filename = file_info64.size_filename; + pfile_info->size_file_extra = file_info64.size_file_extra; + pfile_info->size_file_comment = file_info64.size_file_comment; + + pfile_info->disk_num_start = file_info64.disk_num_start; + pfile_info->internal_fa = file_info64.internal_fa; + pfile_info->external_fa = file_info64.external_fa; + + pfile_info->tmu_date = file_info64.tmu_date, + + + pfile_info->compressed_size = (uLong)file_info64.compressed_size; + pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size; + + } + return err; +} +/* + Set the current file of the zipfile to the first file. + return UNZ_OK if there is no problem +*/ +extern int ZEXPORT unzGoToFirstFile (unzFile file) +{ + int err=UNZ_OK; + unz64_s* s; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + s->pos_in_central_dir=s->offset_central_dir; + s->num_file=0; + err=unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, + &s->cur_file_info_internal, + NULL,0,NULL,0,NULL,0); + s->current_file_ok = (err == UNZ_OK); + return err; +} + +/* + Set the current file of the zipfile to the next file. + return UNZ_OK if there is no problem + return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. +*/ +extern int ZEXPORT unzGoToNextFile (unzFile file) +{ + unz64_s* s; + int err; + + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + if (!s->current_file_ok) + return UNZ_END_OF_LIST_OF_FILE; + if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */ + if (s->num_file+1==s->gi.number_entry) + return UNZ_END_OF_LIST_OF_FILE; + + s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + + s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; + s->num_file++; + err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, + &s->cur_file_info_internal, + NULL,0,NULL,0,NULL,0); + s->current_file_ok = (err == UNZ_OK); + return err; +} + + +/* + Try locate the file szFileName in the zipfile. + For the iCaseSensitivity signification, see unzipStringFileNameCompare + + return value : + UNZ_OK if the file is found. It becomes the current file. + UNZ_END_OF_LIST_OF_FILE if the file is not found +*/ +extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity) +{ + unz64_s* s; + int err; + + /* We remember the 'current' position in the file so that we can jump + * back there if we fail. + */ + unz_file_info64 cur_file_infoSaved; + unz_file_info64_internal cur_file_info_internalSaved; + ZPOS64_T num_fileSaved; + ZPOS64_T pos_in_central_dirSaved; + + + if (file==NULL) + return UNZ_PARAMERROR; + + if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) + return UNZ_PARAMERROR; + + s=(unz64_s*)file; + if (!s->current_file_ok) + return UNZ_END_OF_LIST_OF_FILE; + + /* Save the current state */ + num_fileSaved = s->num_file; + pos_in_central_dirSaved = s->pos_in_central_dir; + cur_file_infoSaved = s->cur_file_info; + cur_file_info_internalSaved = s->cur_file_info_internal; + + err = unzGoToFirstFile(file); + + while (err == UNZ_OK) + { + char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; + err = unzGetCurrentFileInfo64(file,NULL, + szCurrentFileName,sizeof(szCurrentFileName)-1, + NULL,0,NULL,0); + if (err == UNZ_OK) + { + if (unzStringFileNameCompare(szCurrentFileName, + szFileName,iCaseSensitivity)==0) + return UNZ_OK; + err = unzGoToNextFile(file); + } + } + + /* We failed, so restore the state of the 'current file' to where we + * were. + */ + s->num_file = num_fileSaved ; + s->pos_in_central_dir = pos_in_central_dirSaved ; + s->cur_file_info = cur_file_infoSaved; + s->cur_file_info_internal = cur_file_info_internalSaved; + return err; +} + + +/* +/////////////////////////////////////////// +// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net) +// I need random access +// +// Further optimization could be realized by adding an ability +// to cache the directory in memory. The goal being a single +// comprehensive file read to put the file I need in a memory. +*/ + +/* +typedef struct unz_file_pos_s +{ + ZPOS64_T pos_in_zip_directory; // offset in file + ZPOS64_T num_of_file; // # of file +} unz_file_pos; +*/ + +extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) +{ + unz64_s* s; + + if (file==NULL || file_pos==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + if (!s->current_file_ok) + return UNZ_END_OF_LIST_OF_FILE; + + file_pos->pos_in_zip_directory = s->pos_in_central_dir; + file_pos->num_of_file = s->num_file; + + return UNZ_OK; +} + +extern int ZEXPORT unzGetFilePos( + unzFile file, + unz_file_pos* file_pos) +{ + unz64_file_pos file_pos64; + int err = unzGetFilePos64(file,&file_pos64); + if (err==UNZ_OK) + { + file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory; + file_pos->num_of_file = (uLong)file_pos64.num_of_file; + } + return err; +} + +extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) +{ + unz64_s* s; + int err; + + if (file==NULL || file_pos==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + + /* jump to the right spot */ + s->pos_in_central_dir = file_pos->pos_in_zip_directory; + s->num_file = file_pos->num_of_file; + + /* set the current file */ + err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, + &s->cur_file_info_internal, + NULL,0,NULL,0,NULL,0); + /* return results */ + s->current_file_ok = (err == UNZ_OK); + return err; +} + +extern int ZEXPORT unzGoToFilePos( + unzFile file, + unz_file_pos* file_pos) +{ + unz64_file_pos file_pos64; + if (file_pos == NULL) + return UNZ_PARAMERROR; + + file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory; + file_pos64.num_of_file = file_pos->num_of_file; + return unzGoToFilePos64(file,&file_pos64); +} + +/* +// Unzip Helper Functions - should be here? +/////////////////////////////////////////// +*/ + +/* + Read the local header of the current zipfile + Check the coherency of the local header and info in the end of central + directory about this file + store in *piSizeVar the size of extra info in local header + (filename and size of extra field data) +*/ +local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar, + ZPOS64_T * poffset_local_extrafield, + uInt * psize_local_extrafield) +{ + uLong uMagic,uData,uFlags; + uLong size_filename; + uLong size_extra_field; + int err=UNZ_OK; + + *piSizeVar = 0; + *poffset_local_extrafield = 0; + *psize_local_extrafield = 0; + + if (ZSEEK64(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile + + s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0) + return UNZ_ERRNO; + + + if (err==UNZ_OK) + { + if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) + err=UNZ_ERRNO; + else if (uMagic!=0x04034b50) + err=UNZ_BADZIPFILE; + } + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) + err=UNZ_ERRNO; +/* + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) + err=UNZ_BADZIPFILE; +*/ + if (unz64local_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK) + err=UNZ_ERRNO; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) + err=UNZ_BADZIPFILE; + + if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && +/* #ifdef HAVE_BZIP2 */ + (s->cur_file_info.compression_method!=Z_BZIP2ED) && +/* #endif */ + (s->cur_file_info.compression_method!=Z_DEFLATED)) + err=UNZ_BADZIPFILE; + + if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */ + err=UNZ_ERRNO; + + if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */ + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && ((uFlags & 8)==0)) + err=UNZ_BADZIPFILE; + + if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */ + err=UNZ_ERRNO; + else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && ((uFlags & 8)==0)) + err=UNZ_BADZIPFILE; + + if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */ + err=UNZ_ERRNO; + else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0)) + err=UNZ_BADZIPFILE; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK) + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename)) + err=UNZ_BADZIPFILE; + + *piSizeVar += (uInt)size_filename; + + if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK) + err=UNZ_ERRNO; + *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile + + SIZEZIPLOCALHEADER + size_filename; + *psize_local_extrafield = (uInt)size_extra_field; + + *piSizeVar += (uInt)size_extra_field; + + return err; +} + +/* + Open for reading data the current file in the zipfile. + If there is no error and the file is opened, the return value is UNZ_OK. +*/ +extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, + int* level, int raw, const char* password) +{ + int err=UNZ_OK; + uInt iSizeVar; + unz64_s* s; + file_in_zip64_read_info_s* pfile_in_zip_read_info; + ZPOS64_T offset_local_extrafield; /* offset of the local extra field */ + uInt size_local_extrafield; /* size of the local extra field */ +# ifndef NOUNCRYPT + char source[12]; +# else + if (password != NULL) + return UNZ_PARAMERROR; +# endif + + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + if (!s->current_file_ok) + return UNZ_PARAMERROR; + + if (s->pfile_in_zip_read != NULL) + unzCloseCurrentFile(file); + + if (unz64local_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) + return UNZ_BADZIPFILE; + + pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s)); + if (pfile_in_zip_read_info==NULL) + return UNZ_INTERNALERROR; + + pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE); + pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; + pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; + pfile_in_zip_read_info->pos_local_extrafield=0; + pfile_in_zip_read_info->raw=raw; + + if (pfile_in_zip_read_info->read_buffer==NULL) + { + TRYFREE(pfile_in_zip_read_info); + return UNZ_INTERNALERROR; + } + + pfile_in_zip_read_info->stream_initialised=0; + + if (method!=NULL) + *method = (int)s->cur_file_info.compression_method; + + if (level!=NULL) + { + *level = 6; + switch (s->cur_file_info.flag & 0x06) + { + case 6 : *level = 1; break; + case 4 : *level = 2; break; + case 2 : *level = 9; break; + } + } + + if ((s->cur_file_info.compression_method!=0) && +/* #ifdef HAVE_BZIP2 */ + (s->cur_file_info.compression_method!=Z_BZIP2ED) && +/* #endif */ + (s->cur_file_info.compression_method!=Z_DEFLATED)) + + err=UNZ_BADZIPFILE; + + pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; + pfile_in_zip_read_info->crc32=0; + pfile_in_zip_read_info->total_out_64=0; + pfile_in_zip_read_info->compression_method = s->cur_file_info.compression_method; + pfile_in_zip_read_info->filestream=s->filestream; + pfile_in_zip_read_info->z_filefunc=s->z_filefunc; + pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; + + pfile_in_zip_read_info->stream.total_out = 0; + + if ((s->cur_file_info.compression_method==Z_BZIP2ED) && (!raw)) + { +#ifdef HAVE_BZIP2 + pfile_in_zip_read_info->bstream.bzalloc = (void *(*) (void *, int, int))0; + pfile_in_zip_read_info->bstream.bzfree = (free_func)0; + pfile_in_zip_read_info->bstream.opaque = (voidpf)0; + pfile_in_zip_read_info->bstream.state = (voidpf)0; + + pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; + pfile_in_zip_read_info->stream.zfree = (free_func)0; + pfile_in_zip_read_info->stream.opaque = (voidpf)0; + pfile_in_zip_read_info->stream.next_in = (voidpf)0; + pfile_in_zip_read_info->stream.avail_in = 0; + + err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0); + if (err == Z_OK) + pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED; + else + { + TRYFREE(pfile_in_zip_read_info); + return err; + } +#else + pfile_in_zip_read_info->raw=1; +#endif + } + else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw)) + { + pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; + pfile_in_zip_read_info->stream.zfree = (free_func)0; + pfile_in_zip_read_info->stream.opaque = (voidpf)0; + pfile_in_zip_read_info->stream.next_in = 0; + pfile_in_zip_read_info->stream.avail_in = 0; + + err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); + if (err == Z_OK) + pfile_in_zip_read_info->stream_initialised=Z_DEFLATED; + else + { + TRYFREE(pfile_in_zip_read_info); + return err; + } + /* windowBits is passed < 0 to tell that there is no zlib header. + * Note that in this case inflate *requires* an extra "dummy" byte + * after the compressed stream in order to complete decompression and + * return Z_STREAM_END. + * In unzip, i don't wait absolutely Z_STREAM_END because I known the + * size of both compressed and uncompressed data + */ + } + pfile_in_zip_read_info->rest_read_compressed = + s->cur_file_info.compressed_size ; + pfile_in_zip_read_info->rest_read_uncompressed = + s->cur_file_info.uncompressed_size ; + + + pfile_in_zip_read_info->pos_in_zipfile = + s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + + iSizeVar; + + pfile_in_zip_read_info->stream.avail_in = (uInt)0; + + s->pfile_in_zip_read = pfile_in_zip_read_info; + s->encrypted = 0; + +# ifndef NOUNCRYPT + if (password != NULL) + { + int i; + s->pcrc_32_tab = get_crc_table(); + init_keys(password,s->keys,s->pcrc_32_tab); + if (ZSEEK64(s->z_filefunc, s->filestream, + s->pfile_in_zip_read->pos_in_zipfile + + s->pfile_in_zip_read->byte_before_the_zipfile, + SEEK_SET)!=0) + return UNZ_INTERNALERROR; + if(ZREAD64(s->z_filefunc, s->filestream,source, 12)<12) + return UNZ_INTERNALERROR; + + for (i = 0; i<12; i++) + zdecode(s->keys,s->pcrc_32_tab,source[i]); + + s->pfile_in_zip_read->pos_in_zipfile+=12; + s->encrypted=1; + } +# endif + + + return UNZ_OK; +} + +extern int ZEXPORT unzOpenCurrentFile (unzFile file) +{ + return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); +} + +extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password) +{ + return unzOpenCurrentFile3(file, NULL, NULL, 0, password); +} + +extern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw) +{ + return unzOpenCurrentFile3(file, method, level, raw, NULL); +} + +/** Addition for GDAL : START */ + +extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file) +{ + unz64_s* s; + file_in_zip64_read_info_s* pfile_in_zip_read_info; + s=(unz64_s*)file; + if (file==NULL) + return 0; //UNZ_PARAMERROR; + pfile_in_zip_read_info=s->pfile_in_zip_read; + if (pfile_in_zip_read_info==NULL) + return 0; //UNZ_PARAMERROR; + return pfile_in_zip_read_info->pos_in_zipfile + + pfile_in_zip_read_info->byte_before_the_zipfile; +} + +/** Addition for GDAL : END */ + +/* + Read bytes from the current file. + buf contain buffer where data must be copied + len the size of buf. + + return the number of byte copied if somes bytes are copied + return 0 if the end of file was reached + return <0 with error code if there is an error + (UNZ_ERRNO for IO error, or zLib error for uncompress error) +*/ +extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) +{ + int err=UNZ_OK; + uInt iRead = 0; + unz64_s* s; + file_in_zip64_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + + if ((pfile_in_zip_read_info->read_buffer == NULL)) + return UNZ_END_OF_LIST_OF_FILE; + if (len==0) + return 0; + + pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; + + pfile_in_zip_read_info->stream.avail_out = (uInt)len; + + if ((len>pfile_in_zip_read_info->rest_read_uncompressed) && + (!(pfile_in_zip_read_info->raw))) + pfile_in_zip_read_info->stream.avail_out = + (uInt)pfile_in_zip_read_info->rest_read_uncompressed; + + if ((len>pfile_in_zip_read_info->rest_read_compressed+ + pfile_in_zip_read_info->stream.avail_in) && + (pfile_in_zip_read_info->raw)) + pfile_in_zip_read_info->stream.avail_out = + (uInt)pfile_in_zip_read_info->rest_read_compressed+ + pfile_in_zip_read_info->stream.avail_in; + + while (pfile_in_zip_read_info->stream.avail_out>0) + { + if ((pfile_in_zip_read_info->stream.avail_in==0) && + (pfile_in_zip_read_info->rest_read_compressed>0)) + { + uInt uReadThis = UNZ_BUFSIZE; + if (pfile_in_zip_read_info->rest_read_compressedrest_read_compressed; + if (uReadThis == 0) + return UNZ_EOF; + if (ZSEEK64(pfile_in_zip_read_info->z_filefunc, + pfile_in_zip_read_info->filestream, + pfile_in_zip_read_info->pos_in_zipfile + + pfile_in_zip_read_info->byte_before_the_zipfile, + ZLIB_FILEFUNC_SEEK_SET)!=0) + return UNZ_ERRNO; + if (ZREAD64(pfile_in_zip_read_info->z_filefunc, + pfile_in_zip_read_info->filestream, + pfile_in_zip_read_info->read_buffer, + uReadThis)!=uReadThis) + return UNZ_ERRNO; + + +# ifndef NOUNCRYPT + if(s->encrypted) + { + uInt i; + for(i=0;iread_buffer[i] = + zdecode(s->keys,s->pcrc_32_tab, + pfile_in_zip_read_info->read_buffer[i]); + } +# endif + + + pfile_in_zip_read_info->pos_in_zipfile += uReadThis; + + pfile_in_zip_read_info->rest_read_compressed-=uReadThis; + + pfile_in_zip_read_info->stream.next_in = + (Bytef*)pfile_in_zip_read_info->read_buffer; + pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; + } + + if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) + { + uInt uDoCopy,i ; + + if ((pfile_in_zip_read_info->stream.avail_in == 0) && + (pfile_in_zip_read_info->rest_read_compressed == 0)) + return (iRead==0) ? UNZ_EOF : iRead; + + if (pfile_in_zip_read_info->stream.avail_out < + pfile_in_zip_read_info->stream.avail_in) + uDoCopy = pfile_in_zip_read_info->stream.avail_out ; + else + uDoCopy = pfile_in_zip_read_info->stream.avail_in ; + + for (i=0;istream.next_out+i) = + *(pfile_in_zip_read_info->stream.next_in+i); + + pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uDoCopy; + + pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, + pfile_in_zip_read_info->stream.next_out, + uDoCopy); + pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; + pfile_in_zip_read_info->stream.avail_in -= uDoCopy; + pfile_in_zip_read_info->stream.avail_out -= uDoCopy; + pfile_in_zip_read_info->stream.next_out += uDoCopy; + pfile_in_zip_read_info->stream.next_in += uDoCopy; + pfile_in_zip_read_info->stream.total_out += uDoCopy; + iRead += uDoCopy; + } + else if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED) + { +#ifdef HAVE_BZIP2 + uLong uTotalOutBefore,uTotalOutAfter; + const Bytef *bufBefore; + uLong uOutThis; + + pfile_in_zip_read_info->bstream.next_in = (char*)pfile_in_zip_read_info->stream.next_in; + pfile_in_zip_read_info->bstream.avail_in = pfile_in_zip_read_info->stream.avail_in; + pfile_in_zip_read_info->bstream.total_in_lo32 = pfile_in_zip_read_info->stream.total_in; + pfile_in_zip_read_info->bstream.total_in_hi32 = 0; + pfile_in_zip_read_info->bstream.next_out = (char*)pfile_in_zip_read_info->stream.next_out; + pfile_in_zip_read_info->bstream.avail_out = pfile_in_zip_read_info->stream.avail_out; + pfile_in_zip_read_info->bstream.total_out_lo32 = pfile_in_zip_read_info->stream.total_out; + pfile_in_zip_read_info->bstream.total_out_hi32 = 0; + + uTotalOutBefore = pfile_in_zip_read_info->bstream.total_out_lo32; + bufBefore = (const Bytef *)pfile_in_zip_read_info->bstream.next_out; + + err=BZ2_bzDecompress(&pfile_in_zip_read_info->bstream); + + uTotalOutAfter = pfile_in_zip_read_info->bstream.total_out_lo32; + uOutThis = uTotalOutAfter-uTotalOutBefore; + + pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis; + + pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis)); + pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis; + iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); + + pfile_in_zip_read_info->stream.next_in = (Bytef*)pfile_in_zip_read_info->bstream.next_in; + pfile_in_zip_read_info->stream.avail_in = pfile_in_zip_read_info->bstream.avail_in; + pfile_in_zip_read_info->stream.total_in = pfile_in_zip_read_info->bstream.total_in_lo32; + pfile_in_zip_read_info->stream.next_out = (Bytef*)pfile_in_zip_read_info->bstream.next_out; + pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->bstream.avail_out; + pfile_in_zip_read_info->stream.total_out = pfile_in_zip_read_info->bstream.total_out_lo32; + + if (err==BZ_STREAM_END) + return (iRead==0) ? UNZ_EOF : iRead; + if (err!=BZ_OK) + break; +#endif + } // end Z_BZIP2ED + else + { + ZPOS64_T uTotalOutBefore,uTotalOutAfter; + const Bytef *bufBefore; + ZPOS64_T uOutThis; + int flush=Z_SYNC_FLUSH; + + uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; + bufBefore = pfile_in_zip_read_info->stream.next_out; + + /* + if ((pfile_in_zip_read_info->rest_read_uncompressed == + pfile_in_zip_read_info->stream.avail_out) && + (pfile_in_zip_read_info->rest_read_compressed == 0)) + flush = Z_FINISH; + */ + err=inflate(&pfile_in_zip_read_info->stream,flush); + + if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL)) + err = Z_DATA_ERROR; + + uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; + uOutThis = uTotalOutAfter-uTotalOutBefore; + + pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis; + + pfile_in_zip_read_info->crc32 = + crc32(pfile_in_zip_read_info->crc32,bufBefore, + (uInt)(uOutThis)); + + pfile_in_zip_read_info->rest_read_uncompressed -= + uOutThis; + + iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); + + if (err==Z_STREAM_END) + return (iRead==0) ? UNZ_EOF : iRead; + if (err!=Z_OK) + break; + } + } + + if (err==Z_OK) + return iRead; + return err; +} + + +/* + Give the current position in uncompressed data +*/ +extern z_off_t ZEXPORT unztell (unzFile file) +{ + unz64_s* s; + file_in_zip64_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + return (z_off_t)pfile_in_zip_read_info->stream.total_out; +} + +extern ZPOS64_T ZEXPORT unztell64 (unzFile file) +{ + + unz64_s* s; + file_in_zip64_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return (ZPOS64_T)-1; + s=(unz64_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return (ZPOS64_T)-1; + + return pfile_in_zip_read_info->total_out_64; +} + + +/* + return 1 if the end of file was reached, 0 elsewhere +*/ +extern int ZEXPORT unzeof (unzFile file) +{ + unz64_s* s; + file_in_zip64_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + if (pfile_in_zip_read_info->rest_read_uncompressed == 0) + return 1; + else + return 0; +} + + + +/* +Read extra field from the current file (opened by unzOpenCurrentFile) +This is the local-header version of the extra field (sometimes, there is +more info in the local-header version than in the central-header) + + if buf==NULL, it return the size of the local extra field that can be read + + if buf!=NULL, len is the size of the buffer, the extra header is copied in + buf. + the return value is the number of bytes copied in buf, or (if <0) + the error code +*/ +extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len) +{ + unz64_s* s; + file_in_zip64_read_info_s* pfile_in_zip_read_info; + uInt read_now; + ZPOS64_T size_to_read; + + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + size_to_read = (pfile_in_zip_read_info->size_local_extrafield - + pfile_in_zip_read_info->pos_local_extrafield); + + if (buf==NULL) + return (int)size_to_read; + + if (len>size_to_read) + read_now = (uInt)size_to_read; + else + read_now = (uInt)len ; + + if (read_now==0) + return 0; + + if (ZSEEK64(pfile_in_zip_read_info->z_filefunc, + pfile_in_zip_read_info->filestream, + pfile_in_zip_read_info->offset_local_extrafield + + pfile_in_zip_read_info->pos_local_extrafield, + ZLIB_FILEFUNC_SEEK_SET)!=0) + return UNZ_ERRNO; + + if (ZREAD64(pfile_in_zip_read_info->z_filefunc, + pfile_in_zip_read_info->filestream, + buf,read_now)!=read_now) + return UNZ_ERRNO; + + return (int)read_now; +} + +/* + Close the file in zip opened with unzipOpenCurrentFile + Return UNZ_CRCERROR if all the file was read but the CRC is not good +*/ +extern int ZEXPORT unzCloseCurrentFile (unzFile file) +{ + int err=UNZ_OK; + + unz64_s* s; + file_in_zip64_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + + if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) && + (!pfile_in_zip_read_info->raw)) + { + if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) + err=UNZ_CRCERROR; + } + + + TRYFREE(pfile_in_zip_read_info->read_buffer); + pfile_in_zip_read_info->read_buffer = NULL; + if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) + inflateEnd(&pfile_in_zip_read_info->stream); +#ifdef HAVE_BZIP2 + else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED) + BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream); +#endif + + + pfile_in_zip_read_info->stream_initialised = 0; + TRYFREE(pfile_in_zip_read_info); + + s->pfile_in_zip_read=NULL; + + return err; +} + + +/* + Get the global comment string of the ZipFile, in the szComment buffer. + uSizeBuf is the size of the szComment buffer. + return the number of byte copied or an error code <0 +*/ +extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf) +{ + unz64_s* s; + uLong uReadThis ; + if (file==NULL) + return (int)UNZ_PARAMERROR; + s=(unz64_s*)file; + + uReadThis = uSizeBuf; + if (uReadThis>s->gi.size_comment) + uReadThis = s->gi.size_comment; + + if (ZSEEK64(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0) + return UNZ_ERRNO; + + if (uReadThis>0) + { + *szComment='\0'; + if (ZREAD64(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis) + return UNZ_ERRNO; + } + + if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) + *(szComment+s->gi.size_comment)='\0'; + return (int)uReadThis; +} + +/* Additions by RX '2004 */ +extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) +{ + unz64_s* s; + + if (file==NULL) + return 0; //UNZ_PARAMERROR; + s=(unz64_s*)file; + if (!s->current_file_ok) + return 0; + if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff) + if (s->num_file==s->gi.number_entry) + return 0; + return s->pos_in_central_dir; +} + +extern uLong ZEXPORT unzGetOffset (unzFile file) +{ + ZPOS64_T offset64; + + if (file==NULL) + return 0; //UNZ_PARAMERROR; + offset64 = unzGetOffset64(file); + return (uLong)offset64; +} + +extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) +{ + unz64_s* s; + int err; + + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz64_s*)file; + + s->pos_in_central_dir = pos; + s->num_file = s->gi.number_entry; /* hack */ + err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, + &s->cur_file_info_internal, + NULL,0,NULL,0,NULL,0); + s->current_file_ok = (err == UNZ_OK); + return err; +} + +extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) +{ + return unzSetOffset64(file,pos); +} diff --git a/zlib/contrib/minizip/unzip.h b/zlib/contrib/minizip/unzip.h new file mode 100644 index 0000000..3183968 --- /dev/null +++ b/zlib/contrib/minizip/unzip.h @@ -0,0 +1,437 @@ +/* unzip.h -- IO for uncompress .zip files using zlib + Version 1.1, February 14h, 2010 + part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) + + Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + + Modifications of Unzip for Zip64 + Copyright (C) 2007-2008 Even Rouault + + Modifications for Zip64 support on both zip and unzip + Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + + For more info read MiniZip_info.txt + + --------------------------------------------------------------------------------- + + Condition of use and distribution are the same than zlib : + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + --------------------------------------------------------------------------------- + + Changes + + See header of unzip64.c + +*/ + +#ifndef _unz64_H +#define _unz64_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ZLIB_H +#include "zlib.h" +#endif + +#ifndef _ZLIBIOAPI_H +#include "ioapi.h" +#endif + +#ifdef HAVE_BZIP2 +#include "bzlib.h" +#endif + +#define Z_BZIP2ED 12 + +#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) +/* like the STRICT of WIN32, we define a pointer that cannot be converted + from (void*) without cast */ +typedef struct TagunzFile__ { int unused; } unzFile__; +typedef unzFile__ *unzFile; +#else +typedef voidp unzFile; +#endif + + +#define UNZ_OK (0) +#define UNZ_END_OF_LIST_OF_FILE (-100) +#define UNZ_ERRNO (Z_ERRNO) +#define UNZ_EOF (0) +#define UNZ_PARAMERROR (-102) +#define UNZ_BADZIPFILE (-103) +#define UNZ_INTERNALERROR (-104) +#define UNZ_CRCERROR (-105) + +/* tm_unz contain date/time info */ +typedef struct tm_unz_s +{ + uInt tm_sec; /* seconds after the minute - [0,59] */ + uInt tm_min; /* minutes after the hour - [0,59] */ + uInt tm_hour; /* hours since midnight - [0,23] */ + uInt tm_mday; /* day of the month - [1,31] */ + uInt tm_mon; /* months since January - [0,11] */ + uInt tm_year; /* years - [1980..2044] */ +} tm_unz; + +/* unz_global_info structure contain global data about the ZIPfile + These data comes from the end of central dir */ +typedef struct unz_global_info64_s +{ + ZPOS64_T number_entry; /* total number of entries in + the central dir on this disk */ + uLong size_comment; /* size of the global comment of the zipfile */ +} unz_global_info64; + +typedef struct unz_global_info_s +{ + uLong number_entry; /* total number of entries in + the central dir on this disk */ + uLong size_comment; /* size of the global comment of the zipfile */ +} unz_global_info; + +/* unz_file_info contain information about a file in the zipfile */ +typedef struct unz_file_info64_s +{ + uLong version; /* version made by 2 bytes */ + uLong version_needed; /* version needed to extract 2 bytes */ + uLong flag; /* general purpose bit flag 2 bytes */ + uLong compression_method; /* compression method 2 bytes */ + uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ + uLong crc; /* crc-32 4 bytes */ + ZPOS64_T compressed_size; /* compressed size 8 bytes */ + ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */ + uLong size_filename; /* filename length 2 bytes */ + uLong size_file_extra; /* extra field length 2 bytes */ + uLong size_file_comment; /* file comment length 2 bytes */ + + uLong disk_num_start; /* disk number start 2 bytes */ + uLong internal_fa; /* internal file attributes 2 bytes */ + uLong external_fa; /* external file attributes 4 bytes */ + + tm_unz tmu_date; +} unz_file_info64; + +typedef struct unz_file_info_s +{ + uLong version; /* version made by 2 bytes */ + uLong version_needed; /* version needed to extract 2 bytes */ + uLong flag; /* general purpose bit flag 2 bytes */ + uLong compression_method; /* compression method 2 bytes */ + uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ + uLong crc; /* crc-32 4 bytes */ + uLong compressed_size; /* compressed size 4 bytes */ + uLong uncompressed_size; /* uncompressed size 4 bytes */ + uLong size_filename; /* filename length 2 bytes */ + uLong size_file_extra; /* extra field length 2 bytes */ + uLong size_file_comment; /* file comment length 2 bytes */ + + uLong disk_num_start; /* disk number start 2 bytes */ + uLong internal_fa; /* internal file attributes 2 bytes */ + uLong external_fa; /* external file attributes 4 bytes */ + + tm_unz tmu_date; +} unz_file_info; + +extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, + const char* fileName2, + int iCaseSensitivity)); +/* + Compare two filename (fileName1,fileName2). + If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) + If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi + or strcasecmp) + If iCaseSenisivity = 0, case sensitivity is defaut of your operating system + (like 1 on Unix, 2 on Windows) +*/ + + +extern unzFile ZEXPORT unzOpen OF((const char *path)); +extern unzFile ZEXPORT unzOpen64 OF((const void *path)); +/* + Open a Zip file. path contain the full pathname (by example, + on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer + "zlib/zlib113.zip". + If the zipfile cannot be opened (file don't exist or in not valid), the + return value is NULL. + Else, the return value is a unzFile Handle, usable with other function + of this unzip package. + the "64" function take a const void* pointer, because the path is just the + value passed to the open64_file_func callback. + Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path + is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char* + does not describe the reality +*/ + + +extern unzFile ZEXPORT unzOpen2 OF((const char *path, + zlib_filefunc_def* pzlib_filefunc_def)); +/* + Open a Zip file, like unzOpen, but provide a set of file low level API + for read/write the zip file (see ioapi.h) +*/ + +extern unzFile ZEXPORT unzOpen2_64 OF((const void *path, + zlib_filefunc64_def* pzlib_filefunc_def)); +/* + Open a Zip file, like unz64Open, but provide a set of file low level API + for read/write the zip file (see ioapi.h) +*/ + +extern int ZEXPORT unzClose OF((unzFile file)); +/* + Close a ZipFile opened with unzipOpen. + If there is files inside the .Zip opened with unzOpenCurrentFile (see later), + these files MUST be closed with unzipCloseCurrentFile before call unzipClose. + return UNZ_OK if there is no problem. */ + +extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, + unz_global_info *pglobal_info)); + +extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, + unz_global_info64 *pglobal_info)); +/* + Write info about the ZipFile in the *pglobal_info structure. + No preparation of the structure is needed + return UNZ_OK if there is no problem. */ + + +extern int ZEXPORT unzGetGlobalComment OF((unzFile file, + char *szComment, + uLong uSizeBuf)); +/* + Get the global comment string of the ZipFile, in the szComment buffer. + uSizeBuf is the size of the szComment buffer. + return the number of byte copied or an error code <0 +*/ + + +/***************************************************************************/ +/* Unzip package allow you browse the directory of the zipfile */ + +extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); +/* + Set the current file of the zipfile to the first file. + return UNZ_OK if there is no problem +*/ + +extern int ZEXPORT unzGoToNextFile OF((unzFile file)); +/* + Set the current file of the zipfile to the next file. + return UNZ_OK if there is no problem + return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. +*/ + +extern int ZEXPORT unzLocateFile OF((unzFile file, + const char *szFileName, + int iCaseSensitivity)); +/* + Try locate the file szFileName in the zipfile. + For the iCaseSensitivity signification, see unzStringFileNameCompare + + return value : + UNZ_OK if the file is found. It becomes the current file. + UNZ_END_OF_LIST_OF_FILE if the file is not found +*/ + + +/* ****************************************** */ +/* Ryan supplied functions */ +/* unz_file_info contain information about a file in the zipfile */ +typedef struct unz_file_pos_s +{ + uLong pos_in_zip_directory; /* offset in zip file directory */ + uLong num_of_file; /* # of file */ +} unz_file_pos; + +extern int ZEXPORT unzGetFilePos( + unzFile file, + unz_file_pos* file_pos); + +extern int ZEXPORT unzGoToFilePos( + unzFile file, + unz_file_pos* file_pos); + +typedef struct unz64_file_pos_s +{ + ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */ + ZPOS64_T num_of_file; /* # of file */ +} unz64_file_pos; + +extern int ZEXPORT unzGetFilePos64( + unzFile file, + unz64_file_pos* file_pos); + +extern int ZEXPORT unzGoToFilePos64( + unzFile file, + const unz64_file_pos* file_pos); + +/* ****************************************** */ + +extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file, + unz_file_info64 *pfile_info, + char *szFileName, + uLong fileNameBufferSize, + void *extraField, + uLong extraFieldBufferSize, + char *szComment, + uLong commentBufferSize)); + +extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, + unz_file_info *pfile_info, + char *szFileName, + uLong fileNameBufferSize, + void *extraField, + uLong extraFieldBufferSize, + char *szComment, + uLong commentBufferSize)); +/* + Get Info about the current file + if pfile_info!=NULL, the *pfile_info structure will contain somes info about + the current file + if szFileName!=NULL, the filemane string will be copied in szFileName + (fileNameBufferSize is the size of the buffer) + if extraField!=NULL, the extra field information will be copied in extraField + (extraFieldBufferSize is the size of the buffer). + This is the Central-header version of the extra field + if szComment!=NULL, the comment string of the file will be copied in szComment + (commentBufferSize is the size of the buffer) +*/ + + +/** Addition for GDAL : START */ + +extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); + +/** Addition for GDAL : END */ + + +/***************************************************************************/ +/* for reading the content of the current zipfile, you can open it, read data + from it, and close it (you can close it before reading all the file) + */ + +extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); +/* + Open for reading data the current file in the zipfile. + If there is no error, the return value is UNZ_OK. +*/ + +extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, + const char* password)); +/* + Open for reading data the current file in the zipfile. + password is a crypting password + If there is no error, the return value is UNZ_OK. +*/ + +extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, + int* method, + int* level, + int raw)); +/* + Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) + if raw==1 + *method will receive method of compression, *level will receive level of + compression + note : you can set level parameter as NULL (if you did not want known level, + but you CANNOT set method parameter as NULL +*/ + +extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, + int* method, + int* level, + int raw, + const char* password)); +/* + Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) + if raw==1 + *method will receive method of compression, *level will receive level of + compression + note : you can set level parameter as NULL (if you did not want known level, + but you CANNOT set method parameter as NULL +*/ + + +extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); +/* + Close the file in zip opened with unzOpenCurrentFile + Return UNZ_CRCERROR if all the file was read but the CRC is not good +*/ + +extern int ZEXPORT unzReadCurrentFile OF((unzFile file, + voidp buf, + unsigned len)); +/* + Read bytes from the current file (opened by unzOpenCurrentFile) + buf contain buffer where data must be copied + len the size of buf. + + return the number of byte copied if somes bytes are copied + return 0 if the end of file was reached + return <0 with error code if there is an error + (UNZ_ERRNO for IO error, or zLib error for uncompress error) +*/ + +extern z_off_t ZEXPORT unztell OF((unzFile file)); + +extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); +/* + Give the current position in uncompressed data +*/ + +extern int ZEXPORT unzeof OF((unzFile file)); +/* + return 1 if the end of file was reached, 0 elsewhere +*/ + +extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, + voidp buf, + unsigned len)); +/* + Read extra field from the current file (opened by unzOpenCurrentFile) + This is the local-header version of the extra field (sometimes, there is + more info in the local-header version than in the central-header) + + if buf==NULL, it return the size of the local extra field + + if buf!=NULL, len is the size of the buffer, the extra header is copied in + buf. + the return value is the number of bytes copied in buf, or (if <0) + the error code +*/ + +/***************************************************************************/ + +/* Get the current file offset */ +extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file); +extern uLong ZEXPORT unzGetOffset (unzFile file); + +/* Set the current file offset */ +extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos); +extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); + + + +#ifdef __cplusplus +} +#endif + +#endif /* _unz64_H */ diff --git a/zlib/contrib/minizip/zip.c b/zlib/contrib/minizip/zip.c new file mode 100644 index 0000000..3c34fc8 --- /dev/null +++ b/zlib/contrib/minizip/zip.c @@ -0,0 +1,2004 @@ +/* zip.c -- IO on .zip files using zlib + Version 1.1, February 14h, 2010 + part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) + + Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + + For more info read MiniZip_info.txt + + Changes + Oct-2009 - Mathias Svensson - Remove old C style function prototypes + Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives + Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions. + Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data + It is used when recreting zip archive with RAW when deleting items from a zip. + ZIP64 data is automaticly added to items that needs it, and existing ZIP64 data need to be removed. + Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required) + Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer + +*/ + + +#include +#include +#include +#include +#include "zlib.h" +#include "zip.h" + +#ifdef STDC +# include +# include +# include +#endif +#ifdef NO_ERRNO_H + extern int errno; +#else +# include +#endif + + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +#ifndef VERSIONMADEBY +# define VERSIONMADEBY (0x0) /* platform depedent */ +#endif + +#ifndef Z_BUFSIZE +#define Z_BUFSIZE (64*1024) //(16384) +#endif + +#ifndef Z_MAXFILENAMEINZIP +#define Z_MAXFILENAMEINZIP (256) +#endif + +#ifndef ALLOC +# define ALLOC(size) (malloc(size)) +#endif +#ifndef TRYFREE +# define TRYFREE(p) {if (p) free(p);} +#endif + +/* +#define SIZECENTRALDIRITEM (0x2e) +#define SIZEZIPLOCALHEADER (0x1e) +*/ + +/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ + + +// NOT sure that this work on ALL platform +#define MAKEULONG64(a, b) ((ZPOS64_T)(((unsigned long)(a)) | ((ZPOS64_T)((unsigned long)(b))) << 32)) + +#ifndef SEEK_CUR +#define SEEK_CUR 1 +#endif + +#ifndef SEEK_END +#define SEEK_END 2 +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +#ifndef DEF_MEM_LEVEL +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +#endif +const char zip_copyright[] =" zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; + + +#define SIZEDATA_INDATABLOCK (4096-(4*4)) + +#define LOCALHEADERMAGIC (0x04034b50) +#define CENTRALHEADERMAGIC (0x02014b50) +#define ENDHEADERMAGIC (0x06054b50) +#define ZIP64ENDHEADERMAGIC (0x6064b50) +#define ZIP64ENDLOCHEADERMAGIC (0x7064b50) + +#define FLAG_LOCALHEADER_OFFSET (0x06) +#define CRC_LOCALHEADER_OFFSET (0x0e) + +#define SIZECENTRALHEADER (0x2e) /* 46 */ + +typedef struct linkedlist_datablock_internal_s +{ + struct linkedlist_datablock_internal_s* next_datablock; + uLong avail_in_this_block; + uLong filled_in_this_block; + uLong unused; /* for future use and alignement */ + unsigned char data[SIZEDATA_INDATABLOCK]; +} linkedlist_datablock_internal; + +typedef struct linkedlist_data_s +{ + linkedlist_datablock_internal* first_block; + linkedlist_datablock_internal* last_block; +} linkedlist_data; + + +typedef struct +{ + z_stream stream; /* zLib stream structure for inflate */ +#ifdef HAVE_BZIP2 + bz_stream bstream; /* bzLib stream structure for bziped */ +#endif + + int stream_initialised; /* 1 is stream is initialised */ + uInt pos_in_buffered_data; /* last written byte in buffered_data */ + + ZPOS64_T pos_local_header; /* offset of the local header of the file + currenty writing */ + char* central_header; /* central header data for the current file */ + uLong size_centralExtra; + uLong size_centralheader; /* size of the central header for cur file */ + uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */ + uLong flag; /* flag of the file currently writing */ + + int method; /* compression method of file currenty wr.*/ + int raw; /* 1 for directly writing raw data */ + Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/ + uLong dosDate; + uLong crc32; + int encrypt; + int zip64; /* Add ZIP64 extened information in the extra field */ + ZPOS64_T pos_zip64extrainfo; + ZPOS64_T totalCompressedData; + ZPOS64_T totalUncompressedData; +#ifndef NOCRYPT + unsigned long keys[3]; /* keys defining the pseudo-random sequence */ + const unsigned long* pcrc_32_tab; + int crypt_header_size; +#endif +} curfile64_info; + +typedef struct +{ + zlib_filefunc64_32_def z_filefunc; + voidpf filestream; /* io structore of the zipfile */ + linkedlist_data central_dir;/* datablock with central dir in construction*/ + int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/ + curfile64_info ci; /* info on the file curretly writing */ + + ZPOS64_T begin_pos; /* position of the beginning of the zipfile */ + ZPOS64_T add_position_when_writting_offset; + ZPOS64_T number_entry; + +#ifndef NO_ADDFILEINEXISTINGZIP + char *globalcomment; +#endif + +} zip64_internal; + + +#ifndef NOCRYPT +#define INCLUDECRYPTINGCODE_IFCRYPTALLOWED +#include "crypt.h" +#endif + +local linkedlist_datablock_internal* allocate_new_datablock() +{ + linkedlist_datablock_internal* ldi; + ldi = (linkedlist_datablock_internal*) + ALLOC(sizeof(linkedlist_datablock_internal)); + if (ldi!=NULL) + { + ldi->next_datablock = NULL ; + ldi->filled_in_this_block = 0 ; + ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ; + } + return ldi; +} + +local void free_datablock(linkedlist_datablock_internal* ldi) +{ + while (ldi!=NULL) + { + linkedlist_datablock_internal* ldinext = ldi->next_datablock; + TRYFREE(ldi); + ldi = ldinext; + } +} + +local void init_linkedlist(linkedlist_data* ll) +{ + ll->first_block = ll->last_block = NULL; +} + +local void free_linkedlist(linkedlist_data* ll) +{ + free_datablock(ll->first_block); + ll->first_block = ll->last_block = NULL; +} + + +local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) +{ + linkedlist_datablock_internal* ldi; + const unsigned char* from_copy; + + if (ll==NULL) + return ZIP_INTERNALERROR; + + if (ll->last_block == NULL) + { + ll->first_block = ll->last_block = allocate_new_datablock(); + if (ll->first_block == NULL) + return ZIP_INTERNALERROR; + } + + ldi = ll->last_block; + from_copy = (unsigned char*)buf; + + while (len>0) + { + uInt copy_this; + uInt i; + unsigned char* to_copy; + + if (ldi->avail_in_this_block==0) + { + ldi->next_datablock = allocate_new_datablock(); + if (ldi->next_datablock == NULL) + return ZIP_INTERNALERROR; + ldi = ldi->next_datablock ; + ll->last_block = ldi; + } + + if (ldi->avail_in_this_block < len) + copy_this = (uInt)ldi->avail_in_this_block; + else + copy_this = (uInt)len; + + to_copy = &(ldi->data[ldi->filled_in_this_block]); + + for (i=0;ifilled_in_this_block += copy_this; + ldi->avail_in_this_block -= copy_this; + from_copy += copy_this ; + len -= copy_this; + } + return ZIP_OK; +} + + + +/****************************************************************************/ + +#ifndef NO_ADDFILEINEXISTINGZIP +/* =========================================================================== + Inputs a long in LSB order to the given file + nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T) +*/ + +local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)); +local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) +{ + unsigned char buf[8]; + int n; + for (n = 0; n < nbByte; n++) + { + buf[n] = (unsigned char)(x & 0xff); + x >>= 8; + } + if (x != 0) + { /* data overflow - hack for ZIP64 (X Roche) */ + for (n = 0; n < nbByte; n++) + { + buf[n] = 0xff; + } + } + + if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte) + return ZIP_ERRNO; + else + return ZIP_OK; +} + +local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte)); +local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) +{ + unsigned char* buf=(unsigned char*)dest; + int n; + for (n = 0; n < nbByte; n++) { + buf[n] = (unsigned char)(x & 0xff); + x >>= 8; + } + + if (x != 0) + { /* data overflow - hack for ZIP64 */ + for (n = 0; n < nbByte; n++) + { + buf[n] = 0xff; + } + } +} + +/****************************************************************************/ + + +local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) +{ + uLong year = (uLong)ptm->tm_year; + if (year>=1980) + year-=1980; + else if (year>=80) + year-=80; + return + (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) | + ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour)); +} + + +/****************************************************************************/ + +local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)); + +local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi) +{ + unsigned char c; + int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); + if (err==1) + { + *pi = (int)c; + return ZIP_OK; + } + else + { + if (ZERROR64(*pzlib_filefunc_def,filestream)) + return ZIP_ERRNO; + else + return ZIP_EOF; + } +} + + +/* =========================================================================== + Reads a long in LSB order from the given gz_stream. Sets +*/ +local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX)); + +local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) +{ + uLong x ; + int i = 0; + int err; + + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x = (uLong)i; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((uLong)i)<<8; + + if (err==ZIP_OK) + *pX = x; + else + *pX = 0; + return err; +} + +local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX)); + +local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) +{ + uLong x ; + int i = 0; + int err; + + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x = (uLong)i; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((uLong)i)<<8; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((uLong)i)<<16; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((uLong)i)<<24; + + if (err==ZIP_OK) + *pX = x; + else + *pX = 0; + return err; +} + +local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)); + + +local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) +{ + ZPOS64_T x; + int i = 0; + int err; + + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x = (ZPOS64_T)i; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((ZPOS64_T)i)<<8; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((ZPOS64_T)i)<<16; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((ZPOS64_T)i)<<24; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((ZPOS64_T)i)<<32; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((ZPOS64_T)i)<<40; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((ZPOS64_T)i)<<48; + + if (err==ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); + x += ((ZPOS64_T)i)<<56; + + if (err==ZIP_OK) + *pX = x; + else + *pX = 0; + + return err; +} + +#ifndef BUFREADCOMMENT +#define BUFREADCOMMENT (0x400) +#endif +/* + Locate the Central directory of a zipfile (at the end, just before + the global comment) +*/ +local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); + +local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) +{ + unsigned char* buf; + ZPOS64_T uSizeFile; + ZPOS64_T uBackRead; + ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ + ZPOS64_T uPosFound=0; + + if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) + return 0; + + + uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); + + if (uMaxBack>uSizeFile) + uMaxBack = uSizeFile; + + buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); + if (buf==NULL) + return 0; + + uBackRead = 4; + while (uBackReaduMaxBack) + uBackRead = uMaxBack; + else + uBackRead+=BUFREADCOMMENT; + uReadPos = uSizeFile-uBackRead ; + + uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? + (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos); + if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) + break; + + if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) + break; + + for (i=(int)uReadSize-3; (i--)>0;) + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && + ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) + { + uPosFound = uReadPos+i; + break; + } + + if (uPosFound!=0) + break; + } + TRYFREE(buf); + return uPosFound; +} + +/* +Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before +the global comment) +*/ +local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); + +local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) +{ + unsigned char* buf; + ZPOS64_T uSizeFile; + ZPOS64_T uBackRead; + ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ + ZPOS64_T uPosFound=0; + uLong uL; + ZPOS64_T relativeOffset; + + if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) + return 0; + + uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); + + if (uMaxBack>uSizeFile) + uMaxBack = uSizeFile; + + buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); + if (buf==NULL) + return 0; + + uBackRead = 4; + while (uBackReaduMaxBack) + uBackRead = uMaxBack; + else + uBackRead+=BUFREADCOMMENT; + uReadPos = uSizeFile-uBackRead ; + + uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? + (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos); + if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) + break; + + if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) + break; + + for (i=(int)uReadSize-3; (i--)>0;) + { + // Signature "0x07064b50" Zip64 end of central directory locater + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07)) + { + uPosFound = uReadPos+i; + break; + } + } + + if (uPosFound!=0) + break; + } + + TRYFREE(buf); + if (uPosFound == 0) + return 0; + + /* Zip64 end of central directory locator */ + if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0) + return 0; + + /* the signature, already checked */ + if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) + return 0; + + /* number of the disk with the start of the zip64 end of central directory */ + if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) + return 0; + if (uL != 0) + return 0; + + /* relative offset of the zip64 end of central directory record */ + if (zip64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=ZIP_OK) + return 0; + + /* total number of disks */ + if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) + return 0; + if (uL != 1) + return 0; + + /* Goto Zip64 end of central directory record */ + if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0) + return 0; + + /* the signature */ + if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) + return 0; + + if (uL != 0x06064b50) // signature of 'Zip64 end of central directory' + return 0; + + return relativeOffset; +} + +int LoadCentralDirectoryRecord(zip64_internal* pziinit) +{ + int err=ZIP_OK; + ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ + + ZPOS64_T size_central_dir; /* size of the central directory */ + ZPOS64_T offset_central_dir; /* offset of start of central directory */ + ZPOS64_T central_pos; + uLong uL; + + uLong number_disk; /* number of the current dist, used for + spaning ZIP, unsupported, always 0*/ + uLong number_disk_with_CD; /* number the the disk with central dir, used + for spaning ZIP, unsupported, always 0*/ + ZPOS64_T number_entry; + ZPOS64_T number_entry_CD; /* total number of entries in + the central dir + (same than number_entry on nospan) */ + uLong VersionMadeBy; + uLong VersionNeeded; + uLong size_comment; + + int hasZIP64Record = 0; + + // check first if we find a ZIP64 record + central_pos = zip64local_SearchCentralDir64(&pziinit->z_filefunc,pziinit->filestream); + if(central_pos > 0) + { + hasZIP64Record = 1; + } + else if(central_pos == 0) + { + central_pos = zip64local_SearchCentralDir(&pziinit->z_filefunc,pziinit->filestream); + } + +/* disable to allow appending to empty ZIP archive + if (central_pos==0) + err=ZIP_ERRNO; +*/ + + if(hasZIP64Record) + { + ZPOS64_T sizeEndOfCentralDirectory; + if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, central_pos, ZLIB_FILEFUNC_SEEK_SET) != 0) + err=ZIP_ERRNO; + + /* the signature, already checked */ + if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&uL)!=ZIP_OK) + err=ZIP_ERRNO; + + /* size of zip64 end of central directory record */ + if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream, &sizeEndOfCentralDirectory)!=ZIP_OK) + err=ZIP_ERRNO; + + /* version made by */ + if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &VersionMadeBy)!=ZIP_OK) + err=ZIP_ERRNO; + + /* version needed to extract */ + if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &VersionNeeded)!=ZIP_OK) + err=ZIP_ERRNO; + + /* number of this disk */ + if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&number_disk)!=ZIP_OK) + err=ZIP_ERRNO; + + /* number of the disk with the start of the central directory */ + if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&number_disk_with_CD)!=ZIP_OK) + err=ZIP_ERRNO; + + /* total number of entries in the central directory on this disk */ + if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream, &number_entry)!=ZIP_OK) + err=ZIP_ERRNO; + + /* total number of entries in the central directory */ + if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&number_entry_CD)!=ZIP_OK) + err=ZIP_ERRNO; + + if ((number_entry_CD!=number_entry) || (number_disk_with_CD!=0) || (number_disk!=0)) + err=ZIP_BADZIPFILE; + + /* size of the central directory */ + if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&size_central_dir)!=ZIP_OK) + err=ZIP_ERRNO; + + /* offset of start of central directory with respect to the + starting disk number */ + if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&offset_central_dir)!=ZIP_OK) + err=ZIP_ERRNO; + + // TODO.. + // read the comment from the standard central header. + size_comment = 0; + } + else + { + // Read End of central Directory info + if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) + err=ZIP_ERRNO; + + /* the signature, already checked */ + if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&uL)!=ZIP_OK) + err=ZIP_ERRNO; + + /* number of this disk */ + if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream,&number_disk)!=ZIP_OK) + err=ZIP_ERRNO; + + /* number of the disk with the start of the central directory */ + if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream,&number_disk_with_CD)!=ZIP_OK) + err=ZIP_ERRNO; + + /* total number of entries in the central dir on this disk */ + number_entry = 0; + if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK) + err=ZIP_ERRNO; + else + number_entry = uL; + + /* total number of entries in the central dir */ + number_entry_CD = 0; + if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK) + err=ZIP_ERRNO; + else + number_entry_CD = uL; + + if ((number_entry_CD!=number_entry) || (number_disk_with_CD!=0) || (number_disk!=0)) + err=ZIP_BADZIPFILE; + + /* size of the central directory */ + size_central_dir = 0; + if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK) + err=ZIP_ERRNO; + else + size_central_dir = uL; + + /* offset of start of central directory with respect to the starting disk number */ + offset_central_dir = 0; + if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK) + err=ZIP_ERRNO; + else + offset_central_dir = uL; + + + /* zipfile global comment length */ + if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &size_comment)!=ZIP_OK) + err=ZIP_ERRNO; + } + + if ((central_posz_filefunc, pziinit->filestream); + return ZIP_ERRNO; + } + + if (size_comment>0) + { + pziinit->globalcomment = (char*)ALLOC(size_comment+1); + if (pziinit->globalcomment) + { + size_comment = ZREAD64(pziinit->z_filefunc, pziinit->filestream, pziinit->globalcomment,size_comment); + pziinit->globalcomment[size_comment]=0; + } + } + + byte_before_the_zipfile = central_pos - (offset_central_dir+size_central_dir); + pziinit->add_position_when_writting_offset = byte_before_the_zipfile; + + { + ZPOS64_T size_central_dir_to_read = size_central_dir; + size_t buf_size = SIZEDATA_INDATABLOCK; + void* buf_read = (void*)ALLOC(buf_size); + if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir + byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0) + err=ZIP_ERRNO; + + while ((size_central_dir_to_read>0) && (err==ZIP_OK)) + { + ZPOS64_T read_this = SIZEDATA_INDATABLOCK; + if (read_this > size_central_dir_to_read) + read_this = size_central_dir_to_read; + + if (ZREAD64(pziinit->z_filefunc, pziinit->filestream,buf_read,(uLong)read_this) != read_this) + err=ZIP_ERRNO; + + if (err==ZIP_OK) + err = add_data_in_datablock(&pziinit->central_dir,buf_read, (uLong)read_this); + + size_central_dir_to_read-=read_this; + } + TRYFREE(buf_read); + } + pziinit->begin_pos = byte_before_the_zipfile; + pziinit->number_entry = number_entry_CD; + + if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET) != 0) + err=ZIP_ERRNO; + + return err; +} + + +#endif /* !NO_ADDFILEINEXISTINGZIP*/ + + +/************************************************************/ +extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) +{ + zip64_internal ziinit; + zip64_internal* zi; + int err=ZIP_OK; + + ziinit.z_filefunc.zseek32_file = NULL; + ziinit.z_filefunc.ztell32_file = NULL; + if (pzlib_filefunc64_32_def==NULL) + fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); + else + ziinit.z_filefunc = *pzlib_filefunc64_32_def; + + ziinit.filestream = ZOPEN64(ziinit.z_filefunc, + pathname, + (append == APPEND_STATUS_CREATE) ? + (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) : + (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING)); + + if (ziinit.filestream == NULL) + return NULL; + + if (append == APPEND_STATUS_CREATEAFTER) + ZSEEK64(ziinit.z_filefunc,ziinit.filestream,0,SEEK_END); + + ziinit.begin_pos = ZTELL64(ziinit.z_filefunc,ziinit.filestream); + ziinit.in_opened_file_inzip = 0; + ziinit.ci.stream_initialised = 0; + ziinit.number_entry = 0; + ziinit.add_position_when_writting_offset = 0; + init_linkedlist(&(ziinit.central_dir)); + + + + zi = (zip64_internal*)ALLOC(sizeof(zip64_internal)); + if (zi==NULL) + { + ZCLOSE64(ziinit.z_filefunc,ziinit.filestream); + return NULL; + } + + /* now we add file in a zipfile */ +# ifndef NO_ADDFILEINEXISTINGZIP + ziinit.globalcomment = NULL; + if (append == APPEND_STATUS_ADDINZIP) + { + // Read and Cache Central Directory Records + err = LoadCentralDirectoryRecord(&ziinit); + } + + if (globalcomment) + { + *globalcomment = ziinit.globalcomment; + } +# endif /* !NO_ADDFILEINEXISTINGZIP*/ + + if (err != ZIP_OK) + { +# ifndef NO_ADDFILEINEXISTINGZIP + TRYFREE(ziinit.globalcomment); +# endif /* !NO_ADDFILEINEXISTINGZIP*/ + TRYFREE(zi); + return NULL; + } + else + { + *zi = ziinit; + return (zipFile)zi; + } +} + +extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) +{ + if (pzlib_filefunc32_def != NULL) + { + zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; + fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); + return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill); + } + else + return zipOpen3(pathname, append, globalcomment, NULL); +} + +extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) +{ + if (pzlib_filefunc_def != NULL) + { + zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; + zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def; + zlib_filefunc64_32_def_fill.ztell32_file = NULL; + zlib_filefunc64_32_def_fill.zseek32_file = NULL; + return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill); + } + else + return zipOpen3(pathname, append, globalcomment, NULL); +} + + + +extern zipFile ZEXPORT zipOpen (const char* pathname, int append) +{ + return zipOpen3((const void*)pathname,append,NULL,NULL); +} + +extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append) +{ + return zipOpen3(pathname,append,NULL,NULL); +} + +int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) +{ + /* write the local header */ + int err; + uInt size_filename = (uInt)strlen(filename); + uInt size_extrafield = size_extrafield_local; + + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)LOCALHEADERMAGIC, 4); + + if (err==ZIP_OK) + { + if(zi->ci.zip64) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)45,2);/* version needed to extract */ + else + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)20,2);/* version needed to extract */ + } + + if (err==ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.flag,2); + + if (err==ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.method,2); + + if (err==ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.dosDate,4); + + // CRC / Compressed size / Uncompressed size will be filled in later and rewritten later + if (err==ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* crc 32, unknown */ + if (err==ZIP_OK) + { + if(zi->ci.zip64) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xFFFFFFFF,4); /* compressed size, unknown */ + else + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* compressed size, unknown */ + } + if (err==ZIP_OK) + { + if(zi->ci.zip64) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xFFFFFFFF,4); /* uncompressed size, unknown */ + else + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* uncompressed size, unknown */ + } + + if (err==ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_filename,2); + + if(zi->ci.zip64) + { + size_extrafield += 20; + } + + if (err==ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_extrafield,2); + + if ((err==ZIP_OK) && (size_filename > 0)) + { + if (ZWRITE64(zi->z_filefunc,zi->filestream,filename,size_filename)!=size_filename) + err = ZIP_ERRNO; + } + + if ((err==ZIP_OK) && (size_extrafield_local > 0)) + { + if (ZWRITE64(zi->z_filefunc, zi->filestream, extrafield_local, size_extrafield_local) != size_extrafield_local) + err = ZIP_ERRNO; + } + + + if ((err==ZIP_OK) && (zi->ci.zip64)) + { + // write the Zip64 extended info + short HeaderID = 1; + short DataSize = 16; + ZPOS64_T CompressedSize = 0; + ZPOS64_T UncompressedSize = 0; + + // Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file) + zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream); + + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2); + + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8); + } + + return err; +} + +/* + NOTE. + When writing RAW the ZIP64 extended information in extrafield_local and extrafield_global needs to be stripped + before calling this function it can be done with zipRemoveExtraInfoBlock + + It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize + unnecessary allocations. + */ +extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, + const void* extrafield_global, uInt size_extrafield_global, + const char* comment, int method, int level, int raw, + int windowBits,int memLevel, int strategy, + const char* password, uLong crcForCrypting, + uLong versionMadeBy, uLong flagBase, int zip64) +{ + zip64_internal* zi; + uInt size_filename; + uInt size_comment; + uInt i; + int err = ZIP_OK; + +# ifdef NOCRYPT + if (password != NULL) + return ZIP_PARAMERROR; +# endif + + if (file == NULL) + return ZIP_PARAMERROR; + +#ifdef HAVE_BZIP2 + if ((method!=0) && (method!=Z_DEFLATED) && (method!=Z_BZIP2ED)) + return ZIP_PARAMERROR; +#else + if ((method!=0) && (method!=Z_DEFLATED)) + return ZIP_PARAMERROR; +#endif + + zi = (zip64_internal*)file; + + if (zi->in_opened_file_inzip == 1) + { + err = zipCloseFileInZip (file); + if (err != ZIP_OK) + return err; + } + + if (filename==NULL) + filename="-"; + + if (comment==NULL) + size_comment = 0; + else + size_comment = (uInt)strlen(comment); + + size_filename = (uInt)strlen(filename); + + if (zipfi == NULL) + zi->ci.dosDate = 0; + else + { + if (zipfi->dosDate != 0) + zi->ci.dosDate = zipfi->dosDate; + else + zi->ci.dosDate = zip64local_TmzDateToDosDate(&zipfi->tmz_date); + } + + zi->ci.flag = flagBase; + if ((level==8) || (level==9)) + zi->ci.flag |= 2; + if ((level==2)) + zi->ci.flag |= 4; + if ((level==1)) + zi->ci.flag |= 6; + if (password != NULL) + zi->ci.flag |= 1; + + zi->ci.crc32 = 0; + zi->ci.method = method; + zi->ci.encrypt = 0; + zi->ci.stream_initialised = 0; + zi->ci.pos_in_buffered_data = 0; + zi->ci.raw = raw; + zi->ci.pos_local_header = ZTELL64(zi->z_filefunc,zi->filestream); + + zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + size_extrafield_global + size_comment; + zi->ci.size_centralExtraFree = 32; // Extra space we have reserved in case we need to add ZIP64 extra info data + + zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader + zi->ci.size_centralExtraFree); + + zi->ci.size_centralExtra = size_extrafield_global; + zip64local_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4); + /* version info */ + zip64local_putValue_inmemory(zi->ci.central_header+4,(uLong)versionMadeBy,2); + zip64local_putValue_inmemory(zi->ci.central_header+6,(uLong)20,2); + zip64local_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2); + zip64local_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2); + zip64local_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4); + zip64local_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/ + zip64local_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/ + zip64local_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/ + zip64local_putValue_inmemory(zi->ci.central_header+28,(uLong)size_filename,2); + zip64local_putValue_inmemory(zi->ci.central_header+30,(uLong)size_extrafield_global,2); + zip64local_putValue_inmemory(zi->ci.central_header+32,(uLong)size_comment,2); + zip64local_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/ + + if (zipfi==NULL) + zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2); + else + zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2); + + if (zipfi==NULL) + zip64local_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4); + else + zip64local_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4); + + if(zi->ci.pos_local_header >= 0xffffffff) + zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)0xffffffff,4); + else + zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->add_position_when_writting_offset,4); + + for (i=0;ici.central_header+SIZECENTRALHEADER+i) = *(filename+i); + + for (i=0;ici.central_header+SIZECENTRALHEADER+size_filename+i) = + *(((const char*)extrafield_global)+i); + + for (i=0;ici.central_header+SIZECENTRALHEADER+size_filename+ + size_extrafield_global+i) = *(comment+i); + if (zi->ci.central_header == NULL) + return ZIP_INTERNALERROR; + + zi->ci.zip64 = zip64; + zi->ci.totalCompressedData = 0; + zi->ci.totalUncompressedData = 0; + zi->ci.pos_zip64extrainfo = 0; + + err = Write_LocalFileHeader(zi, filename, size_extrafield_local, extrafield_local); + +#ifdef HAVE_BZIP2 + zi->ci.bstream.avail_in = (uInt)0; + zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.bstream.next_out = (char*)zi->ci.buffered_data; + zi->ci.bstream.total_in_hi32 = 0; + zi->ci.bstream.total_in_lo32 = 0; + zi->ci.bstream.total_out_hi32 = 0; + zi->ci.bstream.total_out_lo32 = 0; +#endif + + zi->ci.stream.avail_in = (uInt)0; + zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.stream.next_out = zi->ci.buffered_data; + zi->ci.stream.total_in = 0; + zi->ci.stream.total_out = 0; + zi->ci.stream.data_type = Z_BINARY; + +#ifdef HAVE_BZIP2 + if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED || zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) +#else + if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) +#endif + { + if(zi->ci.method == Z_DEFLATED) + { + zi->ci.stream.zalloc = (alloc_func)0; + zi->ci.stream.zfree = (free_func)0; + zi->ci.stream.opaque = (voidpf)0; + + if (windowBits>0) + windowBits = -windowBits; + + err = deflateInit2(&zi->ci.stream, level, Z_DEFLATED, windowBits, memLevel, strategy); + + if (err==Z_OK) + zi->ci.stream_initialised = Z_DEFLATED; + } + else if(zi->ci.method == Z_BZIP2ED) + { +#ifdef HAVE_BZIP2 + // Init BZip stuff here + zi->ci.bstream.bzalloc = 0; + zi->ci.bstream.bzfree = 0; + zi->ci.bstream.opaque = (voidpf)0; + + err = BZ2_bzCompressInit(&zi->ci.bstream, level, 0,35); + if(err == BZ_OK) + zi->ci.stream_initialised = Z_BZIP2ED; +#endif + } + + } + +# ifndef NOCRYPT + zi->ci.crypt_header_size = 0; + if ((err==Z_OK) && (password != NULL)) + { + unsigned char bufHead[RAND_HEAD_LEN]; + unsigned int sizeHead; + zi->ci.encrypt = 1; + zi->ci.pcrc_32_tab = get_crc_table(); + /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/ + + sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting); + zi->ci.crypt_header_size = sizeHead; + + if (ZWRITE64(zi->z_filefunc,zi->filestream,bufHead,sizeHead) != sizeHead) + err = ZIP_ERRNO; + } +# endif + + if (err==Z_OK) + zi->in_opened_file_inzip = 1; + return err; +} + +extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, + const void* extrafield_global, uInt size_extrafield_global, + const char* comment, int method, int level, int raw, + int windowBits,int memLevel, int strategy, + const char* password, uLong crcForCrypting, + uLong versionMadeBy, uLong flagBase) +{ + return zipOpenNewFileInZip4_64 (file, filename, zipfi, + extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, + comment, method, level, raw, + windowBits, memLevel, strategy, + password, crcForCrypting, versionMadeBy, flagBase, 0); +} + +extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, + const void* extrafield_global, uInt size_extrafield_global, + const char* comment, int method, int level, int raw, + int windowBits,int memLevel, int strategy, + const char* password, uLong crcForCrypting) +{ + return zipOpenNewFileInZip4_64 (file, filename, zipfi, + extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, + comment, method, level, raw, + windowBits, memLevel, strategy, + password, crcForCrypting, VERSIONMADEBY, 0, 0); +} + +extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, + const void* extrafield_global, uInt size_extrafield_global, + const char* comment, int method, int level, int raw, + int windowBits,int memLevel, int strategy, + const char* password, uLong crcForCrypting, int zip64) +{ + return zipOpenNewFileInZip4_64 (file, filename, zipfi, + extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, + comment, method, level, raw, + windowBits, memLevel, strategy, + password, crcForCrypting, VERSIONMADEBY, 0, zip64); +} + +extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, + const void* extrafield_global, uInt size_extrafield_global, + const char* comment, int method, int level, int raw) +{ + return zipOpenNewFileInZip4_64 (file, filename, zipfi, + extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, + comment, method, level, raw, + -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, + NULL, 0, VERSIONMADEBY, 0, 0); +} + +extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, + const void* extrafield_global, uInt size_extrafield_global, + const char* comment, int method, int level, int raw, int zip64) +{ + return zipOpenNewFileInZip4_64 (file, filename, zipfi, + extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, + comment, method, level, raw, + -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, + NULL, 0, VERSIONMADEBY, 0, zip64); +} + +extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, + const void*extrafield_global, uInt size_extrafield_global, + const char* comment, int method, int level, int zip64) +{ + return zipOpenNewFileInZip4_64 (file, filename, zipfi, + extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, + comment, method, level, 0, + -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, + NULL, 0, VERSIONMADEBY, 0, zip64); +} + +extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, + const void*extrafield_global, uInt size_extrafield_global, + const char* comment, int method, int level) +{ + return zipOpenNewFileInZip4_64 (file, filename, zipfi, + extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, + comment, method, level, 0, + -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, + NULL, 0, VERSIONMADEBY, 0, 0); +} + +local int zip64FlushWriteBuffer(zip64_internal* zi) +{ + int err=ZIP_OK; + + if (zi->ci.encrypt != 0) + { +#ifndef NOCRYPT + uInt i; + int t; + for (i=0;ici.pos_in_buffered_data;i++) + zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab, zi->ci.buffered_data[i],t); +#endif + } + + if (ZWRITE64(zi->z_filefunc,zi->filestream,zi->ci.buffered_data,zi->ci.pos_in_buffered_data) != zi->ci.pos_in_buffered_data) + err = ZIP_ERRNO; + + zi->ci.totalCompressedData += zi->ci.pos_in_buffered_data; + +#ifdef HAVE_BZIP2 + if(zi->ci.method == Z_BZIP2ED) + { + zi->ci.totalUncompressedData += zi->ci.bstream.total_in_lo32; + zi->ci.bstream.total_in_lo32 = 0; + zi->ci.bstream.total_in_hi32 = 0; + } + else +#endif + { + zi->ci.totalUncompressedData += zi->ci.stream.total_in; + zi->ci.stream.total_in = 0; + } + + + zi->ci.pos_in_buffered_data = 0; + + return err; +} + +extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned int len) +{ + zip64_internal* zi; + int err=ZIP_OK; + + if (file == NULL) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; + + if (zi->in_opened_file_inzip == 0) + return ZIP_PARAMERROR; + + zi->ci.crc32 = crc32(zi->ci.crc32,buf,(uInt)len); + +#ifdef HAVE_BZIP2 + if(zi->ci.method == Z_BZIP2ED && (!zi->ci.raw)) + { + zi->ci.bstream.next_in = (void*)buf; + zi->ci.bstream.avail_in = len; + err = BZ_RUN_OK; + + while ((err==BZ_RUN_OK) && (zi->ci.bstream.avail_in>0)) + { + if (zi->ci.bstream.avail_out == 0) + { + if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) + err = ZIP_ERRNO; + zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.bstream.next_out = (char*)zi->ci.buffered_data; + } + + + if(err != BZ_RUN_OK) + break; + + if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) + { + uLong uTotalOutBefore_lo = zi->ci.bstream.total_out_lo32; +// uLong uTotalOutBefore_hi = zi->ci.bstream.total_out_hi32; + err=BZ2_bzCompress(&zi->ci.bstream, BZ_RUN); + + zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore_lo) ; + } + } + + if(err == BZ_RUN_OK) + err = ZIP_OK; + } + else +#endif + { + zi->ci.stream.next_in = (Bytef*)buf; + zi->ci.stream.avail_in = len; + + while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) + { + if (zi->ci.stream.avail_out == 0) + { + if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) + err = ZIP_ERRNO; + zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.stream.next_out = zi->ci.buffered_data; + } + + + if(err != ZIP_OK) + break; + + if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) + { + uLong uTotalOutBefore = zi->ci.stream.total_out; + err=deflate(&zi->ci.stream, Z_NO_FLUSH); + if(uTotalOutBefore > zi->ci.stream.total_out) + { + int bBreak = 0; + bBreak++; + } + + zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; + } + else + { + uInt copy_this,i; + if (zi->ci.stream.avail_in < zi->ci.stream.avail_out) + copy_this = zi->ci.stream.avail_in; + else + copy_this = zi->ci.stream.avail_out; + + for (i = 0; i < copy_this; i++) + *(((char*)zi->ci.stream.next_out)+i) = + *(((const char*)zi->ci.stream.next_in)+i); + { + zi->ci.stream.avail_in -= copy_this; + zi->ci.stream.avail_out-= copy_this; + zi->ci.stream.next_in+= copy_this; + zi->ci.stream.next_out+= copy_this; + zi->ci.stream.total_in+= copy_this; + zi->ci.stream.total_out+= copy_this; + zi->ci.pos_in_buffered_data += copy_this; + } + } + }// while(...) + } + + return err; +} + +extern int ZEXPORT zipCloseFileInZipRaw (zipFile file, uLong uncompressed_size, uLong crc32) +{ + return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32); +} + +extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32) +{ + zip64_internal* zi; + ZPOS64_T compressed_size; + uLong invalidValue = 0xffffffff; + short datasize = 0; + int err=ZIP_OK; + + if (file == NULL) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; + + if (zi->in_opened_file_inzip == 0) + return ZIP_PARAMERROR; + zi->ci.stream.avail_in = 0; + + if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) + { + while (err==ZIP_OK) + { + uLong uTotalOutBefore; + if (zi->ci.stream.avail_out == 0) + { + if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) + err = ZIP_ERRNO; + zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.stream.next_out = zi->ci.buffered_data; + } + uTotalOutBefore = zi->ci.stream.total_out; + err=deflate(&zi->ci.stream, Z_FINISH); + zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; + } + } + else if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) + { +#ifdef HAVE_BZIP2 + err = BZ_FINISH_OK; + while (err==BZ_FINISH_OK) + { + uLong uTotalOutBefore; + if (zi->ci.bstream.avail_out == 0) + { + if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) + err = ZIP_ERRNO; + zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.bstream.next_out = (char*)zi->ci.buffered_data; + } + uTotalOutBefore = zi->ci.bstream.total_out_lo32; + err=BZ2_bzCompress(&zi->ci.bstream, BZ_FINISH); + if(err == BZ_STREAM_END) + err = Z_STREAM_END; + + zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore); + } + + if(err == BZ_FINISH_OK) + err = ZIP_OK; +#endif + } + + if (err==Z_STREAM_END) + err=ZIP_OK; /* this is normal */ + + if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK)) + { + if (zip64FlushWriteBuffer(zi)==ZIP_ERRNO) + err = ZIP_ERRNO; + } + + if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) + { + int tmp_err = deflateEnd(&zi->ci.stream); + if (err == ZIP_OK) + err = tmp_err; + zi->ci.stream_initialised = 0; + } +#ifdef HAVE_BZIP2 + else if((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) + { + int tmperr = BZ2_bzCompressEnd(&zi->ci.bstream); + if (err==ZIP_OK) + err = tmperr; + zi->ci.stream_initialised = 0; + } +#endif + + if (!zi->ci.raw) + { + crc32 = (uLong)zi->ci.crc32; + uncompressed_size = zi->ci.totalUncompressedData; + } + compressed_size = zi->ci.totalCompressedData; + +# ifndef NOCRYPT + compressed_size += zi->ci.crypt_header_size; +# endif + + // update Current Item crc and sizes, + if(compressed_size >= 0xffffffff || uncompressed_size >= 0xffffffff || zi->ci.pos_local_header >= 0xffffffff) + { + /*version Made by*/ + zip64local_putValue_inmemory(zi->ci.central_header+4,(uLong)45,2); + /*version needed*/ + zip64local_putValue_inmemory(zi->ci.central_header+6,(uLong)45,2); + + } + + zip64local_putValue_inmemory(zi->ci.central_header+16,crc32,4); /*crc*/ + + + if(compressed_size >= 0xffffffff) + zip64local_putValue_inmemory(zi->ci.central_header+20, invalidValue,4); /*compr size*/ + else + zip64local_putValue_inmemory(zi->ci.central_header+20, compressed_size,4); /*compr size*/ + + /// set internal file attributes field + if (zi->ci.stream.data_type == Z_ASCII) + zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)Z_ASCII,2); + + if(uncompressed_size >= 0xffffffff) + zip64local_putValue_inmemory(zi->ci.central_header+24, invalidValue,4); /*uncompr size*/ + else + zip64local_putValue_inmemory(zi->ci.central_header+24, uncompressed_size,4); /*uncompr size*/ + + // Add ZIP64 extra info field for uncompressed size + if(uncompressed_size >= 0xffffffff) + datasize += 8; + + // Add ZIP64 extra info field for compressed size + if(compressed_size >= 0xffffffff) + datasize += 8; + + // Add ZIP64 extra info field for relative offset to local file header of current file + if(zi->ci.pos_local_header >= 0xffffffff) + datasize += 8; + + if(datasize > 0) + { + char* p = NULL; + + if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) + { + // we can not write more data to the buffer that we have room for. + return ZIP_BADZIPFILE; + } + + p = zi->ci.central_header + zi->ci.size_centralheader; + + // Add Extra Information Header for 'ZIP64 information' + zip64local_putValue_inmemory(p, 0x0001, 2); // HeaderID + p += 2; + zip64local_putValue_inmemory(p, datasize, 2); // DataSize + p += 2; + + if(uncompressed_size >= 0xffffffff) + { + zip64local_putValue_inmemory(p, uncompressed_size, 8); + p += 8; + } + + if(compressed_size >= 0xffffffff) + { + zip64local_putValue_inmemory(p, compressed_size, 8); + p += 8; + } + + if(zi->ci.pos_local_header >= 0xffffffff) + { + zip64local_putValue_inmemory(p, zi->ci.pos_local_header, 8); + p += 8; + } + + // Update how much extra free space we got in the memory buffer + // and increase the centralheader size so the new ZIP64 fields are included + // ( 4 below is the size of HeaderID and DataSize field ) + zi->ci.size_centralExtraFree -= datasize + 4; + zi->ci.size_centralheader += datasize + 4; + + // Update the extra info size field + zi->ci.size_centralExtra += datasize + 4; + zip64local_putValue_inmemory(zi->ci.central_header+30,(uLong)zi->ci.size_centralExtra,2); + } + + if (err==ZIP_OK) + err = add_data_in_datablock(&zi->central_dir, zi->ci.central_header, (uLong)zi->ci.size_centralheader); + + free(zi->ci.central_header); + + if (err==ZIP_OK) + { + // Update the LocalFileHeader with the new values. + + ZPOS64_T cur_pos_inzip = ZTELL64(zi->z_filefunc,zi->filestream); + + if (ZSEEK64(zi->z_filefunc,zi->filestream, zi->ci.pos_local_header + 14,ZLIB_FILEFUNC_SEEK_SET)!=0) + err = ZIP_ERRNO; + + if (err==ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,crc32,4); /* crc 32, unknown */ + + if(uncompressed_size >= 0xffffffff) + { + if(zi->ci.pos_zip64extrainfo > 0) + { + // Update the size in the ZIP64 extended field. + if (ZSEEK64(zi->z_filefunc,zi->filestream, zi->ci.pos_zip64extrainfo + 4,ZLIB_FILEFUNC_SEEK_SET)!=0) + err = ZIP_ERRNO; + + if (err==ZIP_OK) /* compressed size, unknown */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, uncompressed_size, 8); + + if (err==ZIP_OK) /* uncompressed size, unknown */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, compressed_size, 8); + } + } + else + { + if (err==ZIP_OK) /* compressed size, unknown */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,compressed_size,4); + + if (err==ZIP_OK) /* uncompressed size, unknown */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,uncompressed_size,4); + } + + if (ZSEEK64(zi->z_filefunc,zi->filestream, cur_pos_inzip,ZLIB_FILEFUNC_SEEK_SET)!=0) + err = ZIP_ERRNO; + } + + zi->number_entry ++; + zi->in_opened_file_inzip = 0; + + return err; +} + +extern int ZEXPORT zipCloseFileInZip (zipFile file) +{ + return zipCloseFileInZipRaw (file,0,0); +} + +int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) +{ + int err = ZIP_OK; + ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset; + + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4); + + /*num disks*/ + if (err==ZIP_OK) /* number of the disk with the start of the central directory */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); + + /*relative offset*/ + if (err==ZIP_OK) /* Relative offset to the Zip64EndOfCentralDirectory */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream, pos,8); + + /*total disks*/ /* Do not support spawning of disk so always say 1 here*/ + if (err==ZIP_OK) /* number of the disk with the start of the central directory */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)1,4); + + return err; +} + +int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) +{ + int err = ZIP_OK; + + uLong Zip64DataSize = 44; + + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDHEADERMAGIC,4); + + if (err==ZIP_OK) /* size of this 'zip64 end of central directory' */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(ZPOS64_T)Zip64DataSize,8); // why ZPOS64_T of this ? + + if (err==ZIP_OK) /* version made by */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)45,2); + + if (err==ZIP_OK) /* version needed */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)45,2); + + if (err==ZIP_OK) /* number of this disk */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); + + if (err==ZIP_OK) /* number of the disk with the start of the central directory */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); + + if (err==ZIP_OK) /* total number of entries in the central dir on this disk */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, zi->number_entry, 8); + + if (err==ZIP_OK) /* total number of entries in the central dir */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, zi->number_entry, 8); + + if (err==ZIP_OK) /* size of the central directory */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(ZPOS64_T)size_centraldir,8); + + if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */ + { + ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; + err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8); + } + return err; +} +int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) +{ + int err = ZIP_OK; + + /*signature*/ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4); + + if (err==ZIP_OK) /* number of this disk */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2); + + if (err==ZIP_OK) /* number of the disk with the start of the central directory */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2); + + if (err==ZIP_OK) /* total number of entries in the central dir on this disk */ + { + { + if(zi->number_entry >= 0xFFFF) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xffff,2); // use value in ZIP64 record + else + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2); + } + } + + if (err==ZIP_OK) /* total number of entries in the central dir */ + { + if(zi->number_entry >= 0xFFFF) + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xffff,2); // use value in ZIP64 record + else + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2); + } + + if (err==ZIP_OK) /* size of the central directory */ + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_centraldir,4); + + if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */ + { + ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; + if(pos >= 0xffffffff) + { + err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4); + } + else + err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4); + } + + return err; +} + +int Write_GlobalComment(zip64_internal* zi, const char* global_comment) +{ + int err = ZIP_OK; + uInt size_global_comment = 0; + + if(global_comment != NULL) + size_global_comment = (uInt)strlen(global_comment); + + err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_global_comment,2); + + if (err == ZIP_OK && size_global_comment > 0) + { + if (ZWRITE64(zi->z_filefunc,zi->filestream, global_comment, size_global_comment) != size_global_comment) + err = ZIP_ERRNO; + } + return err; +} + +extern int ZEXPORT zipClose (zipFile file, const char* global_comment) +{ + zip64_internal* zi; + int err = 0; + uLong size_centraldir = 0; + ZPOS64_T centraldir_pos_inzip; + ZPOS64_T pos; + + if (file == NULL) + return ZIP_PARAMERROR; + + zi = (zip64_internal*)file; + + if (zi->in_opened_file_inzip == 1) + { + err = zipCloseFileInZip (file); + } + +#ifndef NO_ADDFILEINEXISTINGZIP + if (global_comment==NULL) + global_comment = zi->globalcomment; +#endif + + centraldir_pos_inzip = ZTELL64(zi->z_filefunc,zi->filestream); + + if (err==ZIP_OK) + { + linkedlist_datablock_internal* ldi = zi->central_dir.first_block; + while (ldi!=NULL) + { + if ((err==ZIP_OK) && (ldi->filled_in_this_block>0)) + { + if (ZWRITE64(zi->z_filefunc,zi->filestream, ldi->data, ldi->filled_in_this_block) != ldi->filled_in_this_block) + err = ZIP_ERRNO; + } + + size_centraldir += ldi->filled_in_this_block; + ldi = ldi->next_datablock; + } + } + free_linkedlist(&(zi->central_dir)); + + pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; + if(pos >= 0xffffffff) + { + ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); + Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); + + Write_Zip64EndOfCentralDirectoryLocator(zi, Zip64EOCDpos); + } + + if (err==ZIP_OK) + err = Write_EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); + + if(err == ZIP_OK) + err = Write_GlobalComment(zi, global_comment); + + if (ZCLOSE64(zi->z_filefunc,zi->filestream) != 0) + if (err == ZIP_OK) + err = ZIP_ERRNO; + +#ifndef NO_ADDFILEINEXISTINGZIP + TRYFREE(zi->globalcomment); +#endif + TRYFREE(zi); + + return err; +} + +extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader) +{ + char* p = pData; + int size = 0; + char* pNewHeader; + char* pTmp; + short header; + short dataSize; + + int retVal = ZIP_OK; + + if(pData == NULL || *dataLen < 4) + return ZIP_PARAMERROR; + + pNewHeader = (char*)ALLOC(*dataLen); + pTmp = pNewHeader; + + while(p < (pData + *dataLen)) + { + header = *(short*)p; + dataSize = *(((short*)p)+1); + + if( header == sHeader ) // Header found. + { + p += dataSize + 4; // skip it. do not copy to temp buffer + } + else + { + // Extra Info block should not be removed, So copy it to the temp buffer. + memcpy(pTmp, p, dataSize + 4); + p += dataSize + 4; + size += dataSize + 4; + } + + } + + if(size < *dataLen) + { + // clean old extra info block. + memset(pData,0, *dataLen); + + // copy the new extra info block over the old + if(size > 0) + memcpy(pData, pNewHeader, size); + + // set the new extra info size + *dataLen = size; + + retVal = ZIP_OK; + } + else + retVal = ZIP_ERRNO; + + TRYFREE(pNewHeader); + + return retVal; +} diff --git a/zlib/contrib/minizip/zip.h b/zlib/contrib/minizip/zip.h new file mode 100644 index 0000000..8aaebb6 --- /dev/null +++ b/zlib/contrib/minizip/zip.h @@ -0,0 +1,362 @@ +/* zip.h -- IO on .zip files using zlib + Version 1.1, February 14h, 2010 + part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) + + Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + + For more info read MiniZip_info.txt + + --------------------------------------------------------------------------- + + Condition of use and distribution are the same than zlib : + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + --------------------------------------------------------------------------- + + Changes + + See header of zip.h + +*/ + +#ifndef _zip12_H +#define _zip12_H + +#ifdef __cplusplus +extern "C" { +#endif + +//#define HAVE_BZIP2 + +#ifndef _ZLIB_H +#include "zlib.h" +#endif + +#ifndef _ZLIBIOAPI_H +#include "ioapi.h" +#endif + +#ifdef HAVE_BZIP2 +#include "bzlib.h" +#endif + +#define Z_BZIP2ED 12 + +#if defined(STRICTZIP) || defined(STRICTZIPUNZIP) +/* like the STRICT of WIN32, we define a pointer that cannot be converted + from (void*) without cast */ +typedef struct TagzipFile__ { int unused; } zipFile__; +typedef zipFile__ *zipFile; +#else +typedef voidp zipFile; +#endif + +#define ZIP_OK (0) +#define ZIP_EOF (0) +#define ZIP_ERRNO (Z_ERRNO) +#define ZIP_PARAMERROR (-102) +#define ZIP_BADZIPFILE (-103) +#define ZIP_INTERNALERROR (-104) + +#ifndef DEF_MEM_LEVEL +# if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +# else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +# endif +#endif +/* default memLevel */ + +/* tm_zip contain date/time info */ +typedef struct tm_zip_s +{ + uInt tm_sec; /* seconds after the minute - [0,59] */ + uInt tm_min; /* minutes after the hour - [0,59] */ + uInt tm_hour; /* hours since midnight - [0,23] */ + uInt tm_mday; /* day of the month - [1,31] */ + uInt tm_mon; /* months since January - [0,11] */ + uInt tm_year; /* years - [1980..2044] */ +} tm_zip; + +typedef struct +{ + tm_zip tmz_date; /* date in understandable format */ + uLong dosDate; /* if dos_date == 0, tmu_date is used */ +/* uLong flag; */ /* general purpose bit flag 2 bytes */ + + uLong internal_fa; /* internal file attributes 2 bytes */ + uLong external_fa; /* external file attributes 4 bytes */ +} zip_fileinfo; + +typedef const char* zipcharpc; + + +#define APPEND_STATUS_CREATE (0) +#define APPEND_STATUS_CREATEAFTER (1) +#define APPEND_STATUS_ADDINZIP (2) + +extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); +extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append)); +/* + Create a zipfile. + pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on + an Unix computer "zlib/zlib113.zip". + if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip + will be created at the end of the file. + (useful if the file contain a self extractor code) + if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will + add files in existing zip (be sure you don't add file that doesn't exist) + If the zipfile cannot be opened, the return value is NULL. + Else, the return value is a zipFile Handle, usable with other function + of this zip package. +*/ + +/* Note : there is no delete function into a zipfile. + If you want delete file into a zipfile, you must open a zipfile, and create another + Of couse, you can use RAW reading and writing to copy the file you did not want delte +*/ + +extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, + int append, + zipcharpc* globalcomment, + zlib_filefunc_def* pzlib_filefunc_def)); + +extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, + int append, + zipcharpc* globalcomment, + zlib_filefunc64_def* pzlib_filefunc_def)); + +extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, + const char* filename, + const zip_fileinfo* zipfi, + const void* extrafield_local, + uInt size_extrafield_local, + const void* extrafield_global, + uInt size_extrafield_global, + const char* comment, + int method, + int level)); + +extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, + const char* filename, + const zip_fileinfo* zipfi, + const void* extrafield_local, + uInt size_extrafield_local, + const void* extrafield_global, + uInt size_extrafield_global, + const char* comment, + int method, + int level, + int zip64)); + +/* + Open a file in the ZIP for writing. + filename : the filename in zip (if NULL, '-' without quote will be used + *zipfi contain supplemental information + if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local + contains the extrafield data the the local header + if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global + contains the extrafield data the the local header + if comment != NULL, comment contain the comment string + method contain the compression method (0 for store, Z_DEFLATED for deflate) + level contain the level of compression (can be Z_DEFAULT_COMPRESSION) + zip64 is set to 1 if a zip64 extended information block should be added to the local file header. + this MUST be '1' if the uncompressed size is >= 0xffffffff. + +*/ + + +extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, + const char* filename, + const zip_fileinfo* zipfi, + const void* extrafield_local, + uInt size_extrafield_local, + const void* extrafield_global, + uInt size_extrafield_global, + const char* comment, + int method, + int level, + int raw)); + + +extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file, + const char* filename, + const zip_fileinfo* zipfi, + const void* extrafield_local, + uInt size_extrafield_local, + const void* extrafield_global, + uInt size_extrafield_global, + const char* comment, + int method, + int level, + int raw, + int zip64)); +/* + Same than zipOpenNewFileInZip, except if raw=1, we write raw file + */ + +extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, + const char* filename, + const zip_fileinfo* zipfi, + const void* extrafield_local, + uInt size_extrafield_local, + const void* extrafield_global, + uInt size_extrafield_global, + const char* comment, + int method, + int level, + int raw, + int windowBits, + int memLevel, + int strategy, + const char* password, + uLong crcForCrypting)); + +extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, + const char* filename, + const zip_fileinfo* zipfi, + const void* extrafield_local, + uInt size_extrafield_local, + const void* extrafield_global, + uInt size_extrafield_global, + const char* comment, + int method, + int level, + int raw, + int windowBits, + int memLevel, + int strategy, + const char* password, + uLong crcForCrypting, + int zip64 + )); + +/* + Same than zipOpenNewFileInZip2, except + windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 + password : crypting password (NULL for no crypting) + crcForCrypting : crc of file to compress (needed for crypting) + */ + +extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file, + const char* filename, + const zip_fileinfo* zipfi, + const void* extrafield_local, + uInt size_extrafield_local, + const void* extrafield_global, + uInt size_extrafield_global, + const char* comment, + int method, + int level, + int raw, + int windowBits, + int memLevel, + int strategy, + const char* password, + uLong crcForCrypting, + uLong versionMadeBy, + uLong flagBase + )); + + +extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, + const char* filename, + const zip_fileinfo* zipfi, + const void* extrafield_local, + uInt size_extrafield_local, + const void* extrafield_global, + uInt size_extrafield_global, + const char* comment, + int method, + int level, + int raw, + int windowBits, + int memLevel, + int strategy, + const char* password, + uLong crcForCrypting, + uLong versionMadeBy, + uLong flagBase, + int zip64 + )); +/* + Same than zipOpenNewFileInZip4, except + versionMadeBy : value for Version made by field + flag : value for flag field (compression level info will be added) + */ + + +extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, + const void* buf, + unsigned len)); +/* + Write data in the zipfile +*/ + +extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); +/* + Close the current file in the zipfile +*/ + +extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, + uLong uncompressed_size, + uLong crc32)); + +extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, + ZPOS64_T uncompressed_size, + uLong crc32)); + +/* + Close the current file in the zipfile, for file opened with + parameter raw=1 in zipOpenNewFileInZip2 + uncompressed_size and crc32 are value for the uncompressed size +*/ + +extern int ZEXPORT zipClose OF((zipFile file, + const char* global_comment)); +/* + Close the zipfile +*/ + + +extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader)); +/* + zipRemoveExtraInfoBlock - Added by Mathias Svensson + + Remove extra information block from a extra information data for the local file header or central directory header + + It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode. + + 0x0001 is the signature header for the ZIP64 extra information blocks + + usage. + Remove ZIP64 Extra information from a central director extra field data + zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001); + + Remove ZIP64 Extra information from a Local File Header extra field data + zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001); +*/ + +#ifdef __cplusplus +} +#endif + +#endif /* _zip64_H */ diff --git a/zlib/contrib/vstudio/vc7/zlib.rc b/zlib/contrib/vstudio/vc7/zlib.rc new file mode 100644 index 0000000..58f7567 --- /dev/null +++ b/zlib/contrib/vstudio/vc7/zlib.rc @@ -0,0 +1,32 @@ +#include + +#define IDR_VERSION1 1 +IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE + FILEVERSION 1,2,3,0 + PRODUCTVERSION 1,2,3,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + + BEGIN + VALUE "FileDescription", "zlib data compression library\0" + VALUE "FileVersion", "1.2.3.0\0" + VALUE "InternalName", "zlib\0" + VALUE "OriginalFilename", "zlib.dll\0" + VALUE "ProductName", "ZLib.DLL\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" + VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END diff --git a/zlib/contrib/vstudio/vc7/zlibstat.sln b/zlib/contrib/vstudio/vc7/zlibstat.sln new file mode 100644 index 0000000..71304bb --- /dev/null +++ b/zlib/contrib/vstudio/vc7/zlibstat.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcproj", "{76047B4C-9603-4706-8342-80B1365ED9D5}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + ReleaseAxp = ReleaseAxp + ReleaseWithoutAsm = ReleaseWithoutAsm + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {76047B4C-9603-4706-8342-80B1365ED9D5}.Debug.ActiveCfg = Debug|Win32 + {76047B4C-9603-4706-8342-80B1365ED9D5}.Debug.Build.0 = Debug|Win32 + {76047B4C-9603-4706-8342-80B1365ED9D5}.Release.ActiveCfg = Release|Win32 + {76047B4C-9603-4706-8342-80B1365ED9D5}.Release.Build.0 = Release|Win32 + {76047B4C-9603-4706-8342-80B1365ED9D5}.ReleaseAxp.ActiveCfg = ReleaseAxp|Win32 + {76047B4C-9603-4706-8342-80B1365ED9D5}.ReleaseAxp.Build.0 = ReleaseAxp|Win32 + {76047B4C-9603-4706-8342-80B1365ED9D5}.ReleaseWithoutAsm.ActiveCfg = ReleaseWithoutAsm|Win32 + {76047B4C-9603-4706-8342-80B1365ED9D5}.ReleaseWithoutAsm.Build.0 = ReleaseWithoutAsm|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/zlib/contrib/vstudio/vc7/zlibstat.vcproj b/zlib/contrib/vstudio/vc7/zlibstat.vcproj new file mode 100644 index 0000000..43652e1 --- /dev/null +++ b/zlib/contrib/vstudio/vc7/zlibstat.vcproj @@ -0,0 +1,269 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/contrib/vstudio/vc8/miniunz.vcproj b/zlib/contrib/vstudio/vc8/miniunz.vcproj new file mode 100644 index 0000000..8f3d47b --- /dev/null +++ b/zlib/contrib/vstudio/vc8/miniunz.vcproj @@ -0,0 +1,566 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/contrib/vstudio/vc8/minizip.vcproj b/zlib/contrib/vstudio/vc8/minizip.vcproj new file mode 100644 index 0000000..184e0ec --- /dev/null +++ b/zlib/contrib/vstudio/vc8/minizip.vcproj @@ -0,0 +1,563 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/contrib/vstudio/vc8/testzlib.vcproj b/zlib/contrib/vstudio/vc8/testzlib.vcproj new file mode 100644 index 0000000..e3cc971 --- /dev/null +++ b/zlib/contrib/vstudio/vc8/testzlib.vcproj @@ -0,0 +1,948 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/contrib/vstudio/vc8/testzlibdll.vcproj b/zlib/contrib/vstudio/vc8/testzlibdll.vcproj new file mode 100644 index 0000000..b1a8d48 --- /dev/null +++ b/zlib/contrib/vstudio/vc8/testzlibdll.vcproj @@ -0,0 +1,567 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/contrib/vstudio/vc8/zlib.rc b/zlib/contrib/vstudio/vc8/zlib.rc new file mode 100644 index 0000000..58f7567 --- /dev/null +++ b/zlib/contrib/vstudio/vc8/zlib.rc @@ -0,0 +1,32 @@ +#include + +#define IDR_VERSION1 1 +IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE + FILEVERSION 1,2,3,0 + PRODUCTVERSION 1,2,3,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + + BEGIN + VALUE "FileDescription", "zlib data compression library\0" + VALUE "FileVersion", "1.2.3.0\0" + VALUE "InternalName", "zlib\0" + VALUE "OriginalFilename", "zlib.dll\0" + VALUE "ProductName", "ZLib.DLL\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" + VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END diff --git a/zlib/contrib/vstudio/vc8/zlibstat.vcproj b/zlib/contrib/vstudio/vc8/zlibstat.vcproj new file mode 100644 index 0000000..3c7d1bd --- /dev/null +++ b/zlib/contrib/vstudio/vc8/zlibstat.vcproj @@ -0,0 +1,870 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/contrib/vstudio/vc8/zlibvc.def b/zlib/contrib/vstudio/vc8/zlibvc.def new file mode 100644 index 0000000..74dfdb8 --- /dev/null +++ b/zlib/contrib/vstudio/vc8/zlibvc.def @@ -0,0 +1,92 @@ + +VERSION 1.23 + +HEAPSIZE 1048576,8192 + +EXPORTS + adler32 @1 + compress @2 + crc32 @3 + deflate @4 + deflateCopy @5 + deflateEnd @6 + deflateInit2_ @7 + deflateInit_ @8 + deflateParams @9 + deflateReset @10 + deflateSetDictionary @11 + gzclose @12 + gzdopen @13 + gzerror @14 + gzflush @15 + gzopen @16 + gzread @17 + gzwrite @18 + inflate @19 + inflateEnd @20 + inflateInit2_ @21 + inflateInit_ @22 + inflateReset @23 + inflateSetDictionary @24 + inflateSync @25 + uncompress @26 + zlibVersion @27 + gzprintf @28 + gzputc @29 + gzgetc @30 + gzseek @31 + gzrewind @32 + gztell @33 + gzeof @34 + gzsetparams @35 + zError @36 + inflateSyncPoint @37 + get_crc_table @38 + compress2 @39 + gzputs @40 + gzgets @41 + inflateCopy @42 + inflateBackInit_ @43 + inflateBack @44 + inflateBackEnd @45 + compressBound @46 + deflateBound @47 + gzclearerr @48 + gzungetc @49 + zlibCompileFlags @50 + deflatePrime @51 + + unzOpen @61 + unzClose @62 + unzGetGlobalInfo @63 + unzGetCurrentFileInfo @64 + unzGoToFirstFile @65 + unzGoToNextFile @66 + unzOpenCurrentFile @67 + unzReadCurrentFile @68 + unzOpenCurrentFile3 @69 + unztell @70 + unzeof @71 + unzCloseCurrentFile @72 + unzGetGlobalComment @73 + unzStringFileNameCompare @74 + unzLocateFile @75 + unzGetLocalExtrafield @76 + unzOpen2 @77 + unzOpenCurrentFile2 @78 + unzOpenCurrentFilePassword @79 + + zipOpen @80 + zipOpenNewFileInZip @81 + zipWriteInFileInZip @82 + zipCloseFileInZip @83 + zipClose @84 + zipOpenNewFileInZip2 @86 + zipCloseFileInZipRaw @87 + zipOpen2 @88 + zipOpenNewFileInZip3 @89 + + unzGetFilePos @100 + unzGoToFilePos @101 + + fill_win32_filefunc @110 diff --git a/zlib/contrib/vstudio/vc8/zlibvc.sln b/zlib/contrib/vstudio/vc8/zlibvc.sln new file mode 100644 index 0000000..b405a21 --- /dev/null +++ b/zlib/contrib/vstudio/vc8/zlibvc.sln @@ -0,0 +1,144 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestZlibDll", "testzlibdll.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" + ProjectSection(ProjectDependencies) = postProject + {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" + ProjectSection(ProjectDependencies) = postProject + {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" + ProjectSection(ProjectDependencies) = postProject + {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Itanium = Debug|Itanium + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Itanium = Release|Itanium + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium + ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 + ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Itanium + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.Build.0 = Debug|Itanium + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Itanium + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.Build.0 = Release|Itanium + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = ReleaseWithoutAsm|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Itanium + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.Build.0 = Debug|Itanium + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Itanium + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.Build.0 = Release|Itanium + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.Build.0 = Debug|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.Build.0 = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.Build.0 = Debug|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.Build.0 = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/zlib/contrib/vstudio/vc8/zlibvc.vcproj b/zlib/contrib/vstudio/vc8/zlibvc.vcproj new file mode 100644 index 0000000..bd4b7a1 --- /dev/null +++ b/zlib/contrib/vstudio/vc8/zlibvc.vcproj @@ -0,0 +1,1219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/crc32.c b/zlib/crc32.c new file mode 100644 index 0000000..91be372 --- /dev/null +++ b/zlib/crc32.c @@ -0,0 +1,442 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2006, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Thanks to Rodney Brown for his contribution of faster + * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing + * tables for updating the shift register in one step with three exclusive-ors + * instead of four steps with four exclusive-ors. This results in about a + * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + */ + +/* @(#) $Id$ */ + +/* + Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore + protection on the static variables used to control the first-use generation + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + first call get_crc_table() to initialize the tables before allowing more than + one thread to use crc32(). + */ + +#ifdef MAKECRCH +# include +# ifndef DYNAMIC_CRC_TABLE +# define DYNAMIC_CRC_TABLE +# endif /* !DYNAMIC_CRC_TABLE */ +#endif /* MAKECRCH */ + +#include "zutil.h" /* for STDC and FAR definitions */ + +#define local static + +/* Find a four-byte integer type for crc32_little() and crc32_big(). */ +#ifndef NOBYFOUR +# ifdef STDC /* need ANSI C limits.h to determine sizes */ +# include +# define BYFOUR +# if (UINT_MAX == 0xffffffffUL) + typedef unsigned int u4; +# else +# if (ULONG_MAX == 0xffffffffUL) + typedef unsigned long u4; +# else +# if (USHRT_MAX == 0xffffffffUL) + typedef unsigned short u4; +# else +# undef BYFOUR /* can't find a four-byte integer type! */ +# endif +# endif +# endif +# endif /* STDC */ +#endif /* !NOBYFOUR */ + +/* Definitions for doing the crc four data bytes at a time. */ +#ifdef BYFOUR +# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \ + (((w)&0xff00)<<8)+(((w)&0xff)<<24)) + local unsigned long crc32_little OF((unsigned long, + const unsigned char FAR *, unsigned)); + local unsigned long crc32_big OF((unsigned long, + const unsigned char FAR *, unsigned)); +# define TBLS 8 +#else +# define TBLS 1 +#endif /* BYFOUR */ + +/* Local functions for crc concatenation */ +local unsigned long gf2_matrix_times OF((unsigned long *mat, + unsigned long vec)); +local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); +local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2); + + +#ifdef DYNAMIC_CRC_TABLE + +local volatile int crc_table_empty = 1; +local unsigned long FAR crc_table[TBLS][256]; +local void make_crc_table OF((void)); +#ifdef MAKECRCH + local void write_table OF((FILE *, const unsigned long FAR *)); +#endif /* MAKECRCH */ +/* + Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The first table is simply the CRC of all possible eight bit values. This is + all the information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. The remaining tables + allow for word-at-a-time CRC calculation for both big-endian and little- + endian machines, where a word is four bytes. +*/ +local void make_crc_table() +{ + unsigned long c; + int n, k; + unsigned long poly; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static volatile int first = 1; /* flag to limit concurrent making */ + static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* See if another task is already doing this (not thread-safe, but better + than nothing -- significantly reduces duration of vulnerability in + case the advice about DYNAMIC_CRC_TABLE is ignored) */ + if (first) { + first = 0; + + /* make exclusive-or pattern from polynomial (0xedb88320UL) */ + poly = 0UL; + for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) + poly |= 1UL << (31 - p[n]); + + /* generate a crc for every 8-bit value */ + for (n = 0; n < 256; n++) { + c = (unsigned long)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[0][n] = c; + } + +#ifdef BYFOUR + /* generate crc for each value followed by one, two, and three zeros, + and then the byte reversal of those as well as the first table */ + for (n = 0; n < 256; n++) { + c = crc_table[0][n]; + crc_table[4][n] = REV(c); + for (k = 1; k < 4; k++) { + c = crc_table[0][c & 0xff] ^ (c >> 8); + crc_table[k][n] = c; + crc_table[k + 4][n] = REV(c); + } + } +#endif /* BYFOUR */ + + crc_table_empty = 0; + } + else { /* not first */ + /* wait for the other guy to finish (not efficient, but rare) */ + while (crc_table_empty) + ; + } + +#ifdef MAKECRCH + /* write out CRC tables to crc32.h */ + { + FILE *out; + + out = fopen("crc32.h", "w"); + if (out == NULL) return; + fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); + fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); + fprintf(out, "local const unsigned long FAR "); + fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); + write_table(out, crc_table[0]); +# ifdef BYFOUR + fprintf(out, "#ifdef BYFOUR\n"); + for (k = 1; k < 8; k++) { + fprintf(out, " },\n {\n"); + write_table(out, crc_table[k]); + } + fprintf(out, "#endif\n"); +# endif /* BYFOUR */ + fprintf(out, " }\n};\n"); + fclose(out); + } +#endif /* MAKECRCH */ +} + +#ifdef MAKECRCH +local void write_table(out, table) + FILE *out; + const unsigned long FAR *table; +{ + int n; + + for (n = 0; n < 256; n++) + fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], + n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); +} +#endif /* MAKECRCH */ + +#else /* !DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Tables of CRC-32s of all single-byte values, made by make_crc_table(). + */ +#include "crc32.h" +#endif /* DYNAMIC_CRC_TABLE */ + +/* ========================================================================= + * This function can be used by asm versions of crc32() + */ +const unsigned long FAR * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + return (const unsigned long FAR *)crc_table; +} + +/* ========================================================================= */ +#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 + +/* ========================================================================= */ +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + uInt len; +{ + if (buf == Z_NULL) return 0UL; + +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + +#ifdef BYFOUR + if (sizeof(void *) == sizeof(ptrdiff_t)) { + u4 endian; + + endian = 1; + if (*((unsigned char *)(&endian))) + return crc32_little(crc, buf, len); + else + return crc32_big(crc, buf, len); + } +#endif /* BYFOUR */ + crc = crc ^ 0xffffffffUL; + while (len >= 8) { + DO8; + len -= 8; + } + if (len) do { + DO1; + } while (--len); + return crc ^ 0xffffffffUL; +} + +#ifdef BYFOUR + +/* ========================================================================= */ +#define DOLIT4 c ^= *buf4++; \ + c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ + crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] +#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 + +/* ========================================================================= */ +local unsigned long crc32_little(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = (u4)crc; + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + while (len >= 32) { + DOLIT32; + len -= 32; + } + while (len >= 4) { + DOLIT4; + len -= 4; + } + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + } while (--len); + c = ~c; + return (unsigned long)c; +} + +/* ========================================================================= */ +#define DOBIG4 c ^= *++buf4; \ + c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ + crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] +#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 + +/* ========================================================================= */ +local unsigned long crc32_big(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = REV((u4)crc); + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4--; + while (len >= 32) { + DOBIG32; + len -= 32; + } + while (len >= 4) { + DOBIG4; + len -= 4; + } + buf4++; + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + } while (--len); + c = ~c; + return (unsigned long)(REV(c)); +} + +#endif /* BYFOUR */ + +#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ + +/* ========================================================================= */ +local unsigned long gf2_matrix_times(mat, vec) + unsigned long *mat; + unsigned long vec; +{ + unsigned long sum; + + sum = 0; + while (vec) { + if (vec & 1) + sum ^= *mat; + vec >>= 1; + mat++; + } + return sum; +} + +/* ========================================================================= */ +local void gf2_matrix_square(square, mat) + unsigned long *square; + unsigned long *mat; +{ + int n; + + for (n = 0; n < GF2_DIM; n++) + square[n] = gf2_matrix_times(mat, mat[n]); +} + +/* ========================================================================= */ +local uLong crc32_combine_(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ + int n; + unsigned long row; + unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ + unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ + + /* degenerate case (also disallow negative lengths) */ + if (len2 <= 0) + return crc1; + + /* put operator for one zero bit in odd */ + odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ + row = 1; + for (n = 1; n < GF2_DIM; n++) { + odd[n] = row; + row <<= 1; + } + + /* put operator for two zero bits in even */ + gf2_matrix_square(even, odd); + + /* put operator for four zero bits in odd */ + gf2_matrix_square(odd, even); + + /* apply len2 zeros to crc1 (first square will put the operator for one + zero byte, eight zero bits, in even) */ + do { + /* apply zeros operator for this bit of len2 */ + gf2_matrix_square(even, odd); + if (len2 & 1) + crc1 = gf2_matrix_times(even, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + if (len2 == 0) + break; + + /* another iteration of the loop with odd and even swapped */ + gf2_matrix_square(odd, even); + if (len2 & 1) + crc1 = gf2_matrix_times(odd, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + } while (len2 != 0); + + /* return combined crc */ + crc1 ^= crc2; + return crc1; +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off_t len2; +{ + return crc32_combine_(crc1, crc2, len2); +} + +uLong ZEXPORT crc32_combine64(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ + return crc32_combine_(crc1, crc2, len2); +} diff --git a/zlib/crc32.h b/zlib/crc32.h new file mode 100644 index 0000000..8053b61 --- /dev/null +++ b/zlib/crc32.h @@ -0,0 +1,441 @@ +/* crc32.h -- tables for rapid CRC calculation + * Generated automatically by crc32.c + */ + +local const unsigned long FAR crc_table[TBLS][256] = +{ + { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +#ifdef BYFOUR + }, + { + 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, + 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, + 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, + 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, + 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, + 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, + 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, + 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, + 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, + 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, + 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, + 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, + 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, + 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, + 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, + 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, + 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, + 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, + 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, + 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, + 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, + 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, + 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, + 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, + 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, + 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, + 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, + 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, + 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, + 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, + 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, + 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, + 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, + 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, + 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, + 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, + 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, + 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, + 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, + 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, + 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, + 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, + 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, + 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, + 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, + 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, + 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, + 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, + 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, + 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, + 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, + 0x9324fd72UL + }, + { + 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, + 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, + 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, + 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, + 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, + 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, + 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, + 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, + 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, + 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, + 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, + 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, + 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, + 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, + 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, + 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, + 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, + 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, + 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, + 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, + 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, + 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, + 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, + 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, + 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, + 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, + 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, + 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, + 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, + 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, + 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, + 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, + 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, + 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, + 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, + 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, + 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, + 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, + 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, + 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, + 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, + 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, + 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, + 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, + 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, + 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, + 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, + 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, + 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, + 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, + 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, + 0xbe9834edUL + }, + { + 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, + 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, + 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, + 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, + 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, + 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, + 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, + 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, + 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, + 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, + 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, + 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, + 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, + 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, + 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, + 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, + 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, + 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, + 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, + 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, + 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, + 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, + 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, + 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, + 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, + 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, + 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, + 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, + 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, + 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, + 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, + 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, + 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, + 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, + 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, + 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, + 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, + 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, + 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, + 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, + 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, + 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, + 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, + 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, + 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, + 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, + 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, + 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, + 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, + 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, + 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, + 0xde0506f1UL + }, + { + 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, + 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, + 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, + 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, + 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, + 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, + 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, + 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, + 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, + 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, + 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, + 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, + 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, + 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, + 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, + 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, + 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, + 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, + 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, + 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, + 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, + 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, + 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, + 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, + 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, + 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, + 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, + 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, + 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, + 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, + 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, + 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, + 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, + 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, + 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, + 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, + 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, + 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, + 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, + 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, + 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, + 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, + 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, + 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, + 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, + 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, + 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, + 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, + 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, + 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, + 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, + 0x8def022dUL + }, + { + 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, + 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, + 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, + 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, + 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, + 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, + 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, + 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, + 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, + 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, + 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, + 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, + 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, + 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, + 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, + 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, + 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, + 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, + 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, + 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, + 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, + 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, + 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, + 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, + 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, + 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, + 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, + 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, + 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, + 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, + 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, + 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, + 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, + 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, + 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, + 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, + 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, + 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, + 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, + 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, + 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, + 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, + 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, + 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, + 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, + 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, + 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, + 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, + 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, + 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, + 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, + 0x72fd2493UL + }, + { + 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, + 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, + 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, + 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, + 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, + 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, + 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, + 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, + 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, + 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, + 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, + 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, + 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, + 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, + 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, + 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, + 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, + 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, + 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, + 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, + 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, + 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, + 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, + 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, + 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, + 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, + 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, + 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, + 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, + 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, + 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, + 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, + 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, + 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, + 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, + 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, + 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, + 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, + 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, + 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, + 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, + 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, + 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, + 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, + 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, + 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, + 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, + 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, + 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, + 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, + 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, + 0xed3498beUL + }, + { + 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, + 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, + 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, + 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, + 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, + 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, + 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, + 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, + 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, + 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, + 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, + 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, + 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, + 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, + 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, + 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, + 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, + 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, + 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, + 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, + 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, + 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, + 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, + 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, + 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, + 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, + 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, + 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, + 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, + 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, + 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, + 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, + 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, + 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, + 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, + 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, + 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, + 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, + 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, + 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, + 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, + 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, + 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, + 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, + 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, + 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, + 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, + 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, + 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, + 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, + 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, + 0xf10605deUL +#endif + } +}; diff --git a/zlib/deflate.c b/zlib/deflate.c new file mode 100644 index 0000000..5c4022f --- /dev/null +++ b/zlib/deflate.c @@ -0,0 +1,1834 @@ +/* deflate.c -- compress data using the deflation algorithm + * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process depends on being able to identify portions + * of the input text which are identical to earlier input (within a + * sliding window trailing behind the input currently being processed). + * + * The most straightforward technique turns out to be the fastest for + * most input files: try all possible matches and select the longest. + * The key feature of this algorithm is that insertions into the string + * dictionary are very simple and thus fast, and deletions are avoided + * completely. Insertions are performed at each input character, whereas + * string matches are performed only when the previous match ends. So it + * is preferable to spend more time in matches to allow very fast string + * insertions and avoid deletions. The matching algorithm for small + * strings is inspired from that of Rabin & Karp. A brute force approach + * is used to find longer strings when a small match has been found. + * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze + * (by Leonid Broukhis). + * A previous version of this file used a more sophisticated algorithm + * (by Fiala and Greene) which is guaranteed to run in linear amortized + * time, but has a larger average cost, uses more memory and is patented. + * However the F&G algorithm may be faster for some highly redundant + * files if the parameter max_chain_length (described below) is too large. + * + * ACKNOWLEDGEMENTS + * + * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and + * I found it in 'freeze' written by Leonid Broukhis. + * Thanks to many people for bug reports and testing. + * + * REFERENCES + * + * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". + * Available in http://www.ietf.org/rfc/rfc1951.txt + * + * A description of the Rabin and Karp algorithm is given in the book + * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. + * + * Fiala,E.R., and Greene,D.H. + * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 + * + */ + +/* @(#) $Id$ */ + +#include "deflate.h" + +const char deflate_copyright[] = + " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* =========================================================================== + * Function prototypes. + */ +typedef enum { + need_more, /* block not completed, need more input or more output */ + block_done, /* block flush performed */ + finish_started, /* finish started, need only more output at next deflate */ + finish_done /* finish done, accept no more input or output */ +} block_state; + +typedef block_state (*compress_func) OF((deflate_state *s, int flush)); +/* Compression function. Returns the block state after the call. */ + +local void fill_window OF((deflate_state *s)); +local block_state deflate_stored OF((deflate_state *s, int flush)); +local block_state deflate_fast OF((deflate_state *s, int flush)); +#ifndef FASTEST +local block_state deflate_slow OF((deflate_state *s, int flush)); +#endif +local block_state deflate_rle OF((deflate_state *s, int flush)); +local block_state deflate_huff OF((deflate_state *s, int flush)); +local void lm_init OF((deflate_state *s)); +local void putShortMSB OF((deflate_state *s, uInt b)); +local void flush_pending OF((z_streamp strm)); +local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +#ifdef ASMV + void match_init OF((void)); /* asm code initialization */ + uInt longest_match OF((deflate_state *s, IPos cur_match)); +#else +local uInt longest_match OF((deflate_state *s, IPos cur_match)); +#endif + +#ifdef DEBUG +local void check_match OF((deflate_state *s, IPos start, IPos match, + int length)); +#endif + +/* =========================================================================== + * Local data + */ + +#define NIL 0 +/* Tail of hash chains */ + +#ifndef TOO_FAR +# define TOO_FAR 4096 +#endif +/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +typedef struct config_s { + ush good_length; /* reduce lazy search above this match length */ + ush max_lazy; /* do not perform lazy search above this match length */ + ush nice_length; /* quit search above this match length */ + ush max_chain; + compress_func func; +} config; + +#ifdef FASTEST +local const config configuration_table[2] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ +#else +local const config configuration_table[10] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ +/* 2 */ {4, 5, 16, 8, deflate_fast}, +/* 3 */ {4, 6, 32, 32, deflate_fast}, + +/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ +/* 5 */ {8, 16, 32, 32, deflate_slow}, +/* 6 */ {8, 16, 128, 128, deflate_slow}, +/* 7 */ {8, 32, 128, 256, deflate_slow}, +/* 8 */ {32, 128, 258, 1024, deflate_slow}, +/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ +#endif + +/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 + * For deflate_fast() (levels <= 3) good is ignored and lazy has a different + * meaning. + */ + +#define EQUAL 0 +/* result of memcmp for equal strings */ + +#ifndef NO_DUMMY_DECL +struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ +#endif + +/* =========================================================================== + * Update a hash value with the given input byte + * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * input characters, so that a running hash key can be computed from the + * previous key instead of complete recalculation each time. + */ +#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) + + +/* =========================================================================== + * Insert string str in the dictionary and set match_head to the previous head + * of the hash chain (the most recent string with same hash key). Return + * the previous length of the hash chain. + * If this file is compiled with -DFASTEST, the compression level is forced + * to 1, and no hash chains are maintained. + * IN assertion: all calls to to INSERT_STRING are made with consecutive + * input characters and the first MIN_MATCH bytes of str are valid + * (except for the last MIN_MATCH-1 bytes of the input file). + */ +#ifdef FASTEST +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#else +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#endif + +/* =========================================================================== + * Initialize the hash table (avoiding 64K overflow for 16 bit systems). + * prev[] will be initialized on the fly. + */ +#define CLEAR_HASH(s) \ + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + +/* ========================================================================= */ +int ZEXPORT deflateInit_(strm, level, version, stream_size) + z_streamp strm; + int level; + const char *version; + int stream_size; +{ + return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, version, stream_size); + /* To do: ignore strm->next_in if we use it as window */ +} + +/* ========================================================================= */ +int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + version, stream_size) + z_streamp strm; + int level; + int method; + int windowBits; + int memLevel; + int strategy; + const char *version; + int stream_size; +{ + deflate_state *s; + int wrap = 1; + static const char my_version[] = ZLIB_VERSION; + + ushf *overlay; + /* We overlay pending_buf and d_buf+l_buf. This works since the average + * output size for (length,distance) codes is <= 24 bits. + */ + + if (version == Z_NULL || version[0] != my_version[0] || + stream_size != sizeof(z_stream)) { + return Z_VERSION_ERROR; + } + if (strm == Z_NULL) return Z_STREAM_ERROR; + + strm->msg = Z_NULL; + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } +#ifdef GZIP + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } +#endif + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ + s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); + if (s == Z_NULL) return Z_MEM_ERROR; + strm->state = (struct internal_state FAR *)s; + s->strm = strm; + + s->wrap = wrap; + s->gzhead = Z_NULL; + s->w_bits = windowBits; + s->w_size = 1 << s->w_bits; + s->w_mask = s->w_size - 1; + + s->hash_bits = memLevel + 7; + s->hash_size = 1 << s->hash_bits; + s->hash_mask = s->hash_size - 1; + s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + + s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); + s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); + + s->high_water = 0; /* nothing written to s->window yet */ + + s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + s->pending_buf = (uchf *) overlay; + s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + + if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || + s->pending_buf == Z_NULL) { + s->status = FINISH_STATE; + strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + deflateEnd (strm); + return Z_MEM_ERROR; + } + s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + + s->level = level; + s->strategy = strategy; + s->method = (Byte)method; + + return deflateReset(strm); +} + +/* ========================================================================= */ +int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) + z_streamp strm; + const Bytef *dictionary; + uInt dictLength; +{ + deflate_state *s; + uInt length = dictLength; + uInt n; + IPos hash_head = 0; + + if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || + strm->state->wrap == 2 || + (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) + return Z_STREAM_ERROR; + + s = strm->state; + if (s->wrap) + strm->adler = adler32(strm->adler, dictionary, dictLength); + + if (length < MIN_MATCH) return Z_OK; + if (length > s->w_size) { + length = s->w_size; + dictionary += dictLength - length; /* use the tail of the dictionary */ + } + zmemcpy(s->window, dictionary, length); + s->strstart = length; + s->block_start = (long)length; + + /* Insert all strings in the hash table (except for the last two bytes). + * s->lookahead stays null, so s->ins_h will be recomputed at the next + * call of fill_window. + */ + s->ins_h = s->window[0]; + UPDATE_HASH(s, s->ins_h, s->window[1]); + for (n = 0; n <= length - MIN_MATCH; n++) { + INSERT_STRING(s, n, hash_head); + } + if (hash_head) hash_head = 0; /* to make compiler happy */ + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateReset (strm) + z_streamp strm; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { + return Z_STREAM_ERROR; + } + + strm->total_in = strm->total_out = 0; + strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ + strm->data_type = Z_UNKNOWN; + + s = (deflate_state *)strm->state; + s->pending = 0; + s->pending_out = s->pending_buf; + + if (s->wrap < 0) { + s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ + } + s->status = s->wrap ? INIT_STATE : BUSY_STATE; + strm->adler = +#ifdef GZIP + s->wrap == 2 ? crc32(0L, Z_NULL, 0) : +#endif + adler32(0L, Z_NULL, 0); + s->last_flush = Z_NO_FLUSH; + + _tr_init(s); + lm_init(s); + + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateSetHeader (strm, head) + z_streamp strm; + gz_headerp head; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (strm->state->wrap != 2) return Z_STREAM_ERROR; + strm->state->gzhead = head; + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflatePrime (strm, bits, value) + z_streamp strm; + int bits; + int value; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + strm->state->bi_valid = bits; + strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateParams(strm, level, strategy) + z_streamp strm; + int level; + int strategy; +{ + deflate_state *s; + compress_func func; + int err = Z_OK; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + func = configuration_table[s->level].func; + + if ((strategy != s->strategy || func != configuration_table[level].func) && + strm->total_in != 0) { + /* Flush the last buffer: */ + err = deflate(strm, Z_BLOCK); + } + if (s->level != level) { + s->level = level; + s->max_lazy_match = configuration_table[level].max_lazy; + s->good_match = configuration_table[level].good_length; + s->nice_match = configuration_table[level].nice_length; + s->max_chain_length = configuration_table[level].max_chain; + } + s->strategy = strategy; + return err; +} + +/* ========================================================================= */ +int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) + z_streamp strm; + int good_length; + int max_lazy; + int nice_length; + int max_chain; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + s->good_match = good_length; + s->max_lazy_match = max_lazy; + s->nice_match = nice_length; + s->max_chain_length = max_chain; + return Z_OK; +} + +/* ========================================================================= + * For the default windowBits of 15 and memLevel of 8, this function returns + * a close to exact, as well as small, upper bound on the compressed size. + * They are coded as constants here for a reason--if the #define's are + * changed, then this function needs to be changed as well. The return + * value for 15 and 8 only works for those exact settings. + * + * For any setting other than those defaults for windowBits and memLevel, + * the value returned is a conservative worst case for the maximum expansion + * resulting from using fixed blocks instead of stored blocks, which deflate + * can emit on compressed data for some combinations of the parameters. + * + * This function could be more sophisticated to provide closer upper bounds for + * every combination of windowBits and memLevel. But even the conservative + * upper bound of about 14% expansion does not seem onerous for output buffer + * allocation. + */ +uLong ZEXPORT deflateBound(strm, sourceLen) + z_streamp strm; + uLong sourceLen; +{ + deflate_state *s; + uLong complen, wraplen; + Bytef *str; + + /* conservative upper bound for compressed data */ + complen = sourceLen + + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + + /* if can't get parameters, return conservative bound plus zlib wrapper */ + if (strm == Z_NULL || strm->state == Z_NULL) + return complen + 6; + + /* compute wrapper length */ + s = strm->state; + switch (s->wrap) { + case 0: /* raw deflate */ + wraplen = 0; + break; + case 1: /* zlib wrapper */ + wraplen = 6 + (s->strstart ? 4 : 0); + break; + case 2: /* gzip wrapper */ + wraplen = 18; + if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ + if (s->gzhead->extra != Z_NULL) + wraplen += 2 + s->gzhead->extra_len; + str = s->gzhead->name; + if (str != Z_NULL) + do { + wraplen++; + } while (*str++); + str = s->gzhead->comment; + if (str != Z_NULL) + do { + wraplen++; + } while (*str++); + if (s->gzhead->hcrc) + wraplen += 2; + } + break; + default: /* for compiler happiness */ + wraplen = 6; + } + + /* if not default parameters, return conservative bound */ + if (s->w_bits != 15 || s->hash_bits != 8 + 7) + return complen + wraplen; + + /* default settings: return tight bound for that case */ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + + (sourceLen >> 25) + 13 - 6 + wraplen; +} + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +local void putShortMSB (s, b) + deflate_state *s; + uInt b; +{ + put_byte(s, (Byte)(b >> 8)); + put_byte(s, (Byte)(b & 0xff)); +} + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->next_out buffer and copying into it. + * (See also read_buf()). + */ +local void flush_pending(strm) + z_streamp strm; +{ + unsigned len = strm->state->pending; + + if (len > strm->avail_out) len = strm->avail_out; + if (len == 0) return; + + zmemcpy(strm->next_out, strm->state->pending_out, len); + strm->next_out += len; + strm->state->pending_out += len; + strm->total_out += len; + strm->avail_out -= len; + strm->state->pending -= len; + if (strm->state->pending == 0) { + strm->state->pending_out = strm->state->pending_buf; + } +} + +/* ========================================================================= */ +int ZEXPORT deflate (strm, flush) + z_streamp strm; + int flush; +{ + int old_flush; /* value of flush param for previous deflate call */ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + flush > Z_BLOCK || flush < 0) { + return Z_STREAM_ERROR; + } + s = strm->state; + + if (strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0) || + (s->status == FINISH_STATE && flush != Z_FINISH)) { + ERR_RETURN(strm, Z_STREAM_ERROR); + } + if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); + + s->strm = strm; /* just in case */ + old_flush = s->last_flush; + s->last_flush = flush; + + /* Write the header */ + if (s->status == INIT_STATE) { +#ifdef GZIP + if (s->wrap == 2) { + strm->adler = crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (s->gzhead == Z_NULL) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s->status = BUSY_STATE; + } + else { + put_byte(s, (s->gzhead->text ? 1 : 0) + + (s->gzhead->hcrc ? 2 : 0) + + (s->gzhead->extra == Z_NULL ? 0 : 4) + + (s->gzhead->name == Z_NULL ? 0 : 8) + + (s->gzhead->comment == Z_NULL ? 0 : 16) + ); + put_byte(s, (Byte)(s->gzhead->time & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, s->gzhead->os & 0xff); + if (s->gzhead->extra != Z_NULL) { + put_byte(s, s->gzhead->extra_len & 0xff); + put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); + } + if (s->gzhead->hcrc) + strm->adler = crc32(strm->adler, s->pending_buf, + s->pending); + s->gzindex = 0; + s->status = EXTRA_STATE; + } + } + else +#endif + { + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags; + + if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) + level_flags = 0; + else if (s->level < 6) + level_flags = 1; + else if (s->level == 6) + level_flags = 2; + else + level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + s->status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = adler32(0L, Z_NULL, 0); + } + } +#ifdef GZIP + if (s->status == EXTRA_STATE) { + if (s->gzhead->extra != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + + while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) + break; + } + put_byte(s, s->gzhead->extra[s->gzindex]); + s->gzindex++; + } + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (s->gzindex == s->gzhead->extra_len) { + s->gzindex = 0; + s->status = NAME_STATE; + } + } + else + s->status = NAME_STATE; + } + if (s->status == NAME_STATE) { + if (s->gzhead->name != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->name[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) { + s->gzindex = 0; + s->status = COMMENT_STATE; + } + } + else + s->status = COMMENT_STATE; + } + if (s->status == COMMENT_STATE) { + if (s->gzhead->comment != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->comment[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) + s->status = HCRC_STATE; + } + else + s->status = HCRC_STATE; + } + if (s->status == HCRC_STATE) { + if (s->gzhead->hcrc) { + if (s->pending + 2 > s->pending_buf_size) + flush_pending(strm); + if (s->pending + 2 <= s->pending_buf_size) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + strm->adler = crc32(0L, Z_NULL, 0); + s->status = BUSY_STATE; + } + } + else + s->status = BUSY_STATE; + } +#endif + + /* Flush as much pending output as possible */ + if (s->pending != 0) { + flush_pending(strm); + if (strm->avail_out == 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s->last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm->avail_in == 0 && flush <= old_flush && + flush != Z_FINISH) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s->status == FINISH_STATE && strm->avail_in != 0) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm->avail_in != 0 || s->lookahead != 0 || + (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { + block_state bstate; + + bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : + (s->strategy == Z_RLE ? deflate_rle(s, flush) : + (*(configuration_table[s->level].func))(s, flush)); + + if (bstate == finish_started || bstate == finish_done) { + s->status = FINISH_STATE; + } + if (bstate == need_more || bstate == finish_started) { + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate == block_done) { + if (flush == Z_PARTIAL_FLUSH) { + _tr_align(s); + } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + _tr_stored_block(s, (char*)0, 0L, 0); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush == Z_FULL_FLUSH) { + CLEAR_HASH(s); /* forget history */ + if (s->lookahead == 0) { + s->strstart = 0; + s->block_start = 0L; + } + } + } + flush_pending(strm); + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + Assert(strm->avail_out > 0, "bug2"); + + if (flush != Z_FINISH) return Z_OK; + if (s->wrap <= 0) return Z_STREAM_END; + + /* Write the trailer */ +#ifdef GZIP + if (s->wrap == 2) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); + put_byte(s, (Byte)(strm->total_in & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); + } + else +#endif + { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ + return s->pending != 0 ? Z_OK : Z_STREAM_END; +} + +/* ========================================================================= */ +int ZEXPORT deflateEnd (strm) + z_streamp strm; +{ + int status; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + + status = strm->state->status; + if (status != INIT_STATE && + status != EXTRA_STATE && + status != NAME_STATE && + status != COMMENT_STATE && + status != HCRC_STATE && + status != BUSY_STATE && + status != FINISH_STATE) { + return Z_STREAM_ERROR; + } + + /* Deallocate in reverse order of allocations: */ + TRY_FREE(strm, strm->state->pending_buf); + TRY_FREE(strm, strm->state->head); + TRY_FREE(strm, strm->state->prev); + TRY_FREE(strm, strm->state->window); + + ZFREE(strm, strm->state); + strm->state = Z_NULL; + + return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; +} + +/* ========================================================================= + * Copy the source state to the destination state. + * To simplify the source, this is not supported for 16-bit MSDOS (which + * doesn't have enough memory anyway to duplicate compression states). + */ +int ZEXPORT deflateCopy (dest, source) + z_streamp dest; + z_streamp source; +{ +#ifdef MAXSEG_64K + return Z_STREAM_ERROR; +#else + deflate_state *ds; + deflate_state *ss; + ushf *overlay; + + + if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { + return Z_STREAM_ERROR; + } + + ss = source->state; + + zmemcpy(dest, source, sizeof(z_stream)); + + ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); + if (ds == Z_NULL) return Z_MEM_ERROR; + dest->state = (struct internal_state FAR *) ds; + zmemcpy(ds, ss, sizeof(deflate_state)); + ds->strm = dest; + + ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); + ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); + ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); + overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); + ds->pending_buf = (uchf *) overlay; + + if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || + ds->pending_buf == Z_NULL) { + deflateEnd (dest); + return Z_MEM_ERROR; + } + /* following zmemcpy do not work for 16-bit MSDOS */ + zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); + zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); + zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); + zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + + ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); + ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); + ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + + ds->l_desc.dyn_tree = ds->dyn_ltree; + ds->d_desc.dyn_tree = ds->dyn_dtree; + ds->bl_desc.dyn_tree = ds->bl_tree; + + return Z_OK; +#endif /* MAXSEG_64K */ +} + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->next_in buffer and copying from it. + * (See also flush_pending()). + */ +local int read_buf(strm, buf, size) + z_streamp strm; + Bytef *buf; + unsigned size; +{ + unsigned len = strm->avail_in; + + if (len > size) len = size; + if (len == 0) return 0; + + strm->avail_in -= len; + + if (strm->state->wrap == 1) { + strm->adler = adler32(strm->adler, strm->next_in, len); + } +#ifdef GZIP + else if (strm->state->wrap == 2) { + strm->adler = crc32(strm->adler, strm->next_in, len); + } +#endif + zmemcpy(buf, strm->next_in, len); + strm->next_in += len; + strm->total_in += len; + + return (int)len; +} + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +local void lm_init (s) + deflate_state *s; +{ + s->window_size = (ulg)2L*s->w_size; + + CLEAR_HASH(s); + + /* Set the default configuration parameters: + */ + s->max_lazy_match = configuration_table[s->level].max_lazy; + s->good_match = configuration_table[s->level].good_length; + s->nice_match = configuration_table[s->level].nice_length; + s->max_chain_length = configuration_table[s->level].max_chain; + + s->strstart = 0; + s->block_start = 0L; + s->lookahead = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + s->ins_h = 0; +#ifndef FASTEST +#ifdef ASMV + match_init(); /* initialize the asm code */ +#endif +#endif +} + +#ifndef FASTEST +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +#ifndef ASMV +/* For 80x86 and 680x0, an optimized version will be provided in match.asm or + * match.S. The code will be functionally equivalent. + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + unsigned chain_length = s->max_chain_length;/* max hash chain length */ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + int best_len = s->prev_length; /* best match length so far */ + int nice_match = s->nice_match; /* stop if match long enough */ + IPos limit = s->strstart > (IPos)MAX_DIST(s) ? + s->strstart - (IPos)MAX_DIST(s) : NIL; + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + Posf *prev = s->prev; + uInt wmask = s->w_mask; + +#ifdef UNALIGNED_OK + /* Compare two bytes at a time. Note: this is not always beneficial. + * Try with and without -DUNALIGNED_OK to check. + */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; + register ush scan_start = *(ushf*)scan; + register ush scan_end = *(ushf*)(scan+best_len-1); +#else + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end = scan[best_len]; +#endif + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s->prev_length >= s->good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + Assert(cur_match < s->strstart, "no future"); + match = s->window + cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ +#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) + /* This code assumes sizeof(unsigned short) == 2. Do not use + * UNALIGNED_OK if your compiler uses a different size. + */ + if (*(ushf*)(match+best_len-1) != scan_end || + *(ushf*)match != scan_start) continue; + + /* It is not necessary to compare scan[2] and match[2] since they are + * always equal when the other bytes match, given that the hash keys + * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at + * strstart+3, +5, ... up to strstart+257. We check for insufficient + * lookahead only every 4th comparison; the 128th check will be made + * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * necessary to put more guard bytes at the end of the window, or + * to check more often for insufficient lookahead. + */ + Assert(scan[2] == match[2], "scan[2]?"); + scan++, match++; + do { + } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + scan < strend); + /* The funny "do {}" generates better code on most compilers */ + + /* Here, scan <= window+strstart+257 */ + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + if (*scan == *match) scan++; + + len = (MAX_MATCH - 1) - (int)(strend-scan); + scan = strend - (MAX_MATCH-1); + +#else /* UNALIGNED_OK */ + + if (match[best_len] != scan_end || + match[best_len-1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match++; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + scan = strend - MAX_MATCH; + +#endif /* UNALIGNED_OK */ + + if (len > best_len) { + s->match_start = cur_match; + best_len = len; + if (len >= nice_match) break; +#ifdef UNALIGNED_OK + scan_end = *(ushf*)(scan+best_len-1); +#else + scan_end1 = scan[best_len-1]; + scan_end = scan[best_len]; +#endif + } + } while ((cur_match = prev[cur_match & wmask]) > limit + && --chain_length != 0); + + if ((uInt)best_len <= s->lookahead) return (uInt)best_len; + return s->lookahead; +} +#endif /* ASMV */ + +#else /* FASTEST */ + +/* --------------------------------------------------------------------------- + * Optimized version for FASTEST only + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + Assert(cur_match < s->strstart, "no future"); + + match = s->window + cur_match; + + /* Return failure if the match length is less than 2: + */ + if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match += 2; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + + if (len < MIN_MATCH) return MIN_MATCH - 1; + + s->match_start = cur_match; + return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; +} + +#endif /* FASTEST */ + +#ifdef DEBUG +/* =========================================================================== + * Check that the match at match_start is indeed a match. + */ +local void check_match(s, start, match, length) + deflate_state *s; + IPos start, match; + int length; +{ + /* check that the match is indeed a match */ + if (zmemcmp(s->window + match, + s->window + start, length) != EQUAL) { + fprintf(stderr, " start %u, match %u, length %d\n", + start, match, length); + do { + fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); + } while (--length != 0); + z_error("invalid match"); + } + if (z_verbose > 1) { + fprintf(stderr,"\\[%d,%d]", start-match, length); + do { putc(s->window[start++], stderr); } while (--length != 0); + } +} +#else +# define check_match(s, start, match, length) +#endif /* DEBUG */ + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +local void fill_window(s) + deflate_state *s; +{ + register unsigned n, m; + register Posf *p; + unsigned more; /* Amount of free space at the end of the window. */ + uInt wsize = s->w_size; + + do { + more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); + + /* Deal with !@#$% 64K limit: */ + if (sizeof(int) <= 2) { + if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + more = wsize; + + } else if (more == (unsigned)(-1)) { + /* Very unlikely, but possible on 16 bit machine if + * strstart == 0 && lookahead == 1 (input done a byte at time) + */ + more--; + } + } + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s->strstart >= wsize+MAX_DIST(s)) { + + zmemcpy(s->window, s->window+wsize, (unsigned)wsize); + s->match_start -= wsize; + s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ + s->block_start -= (long) wsize; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + } while (--n); + + n = wsize; +#ifndef FASTEST + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); +#endif + more += wsize; + } + if (s->strm->avail_in == 0) return; + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + Assert(more >= 2, "more < 2"); + + n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); + s->lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s->lookahead >= MIN_MATCH) { + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ + if (s->high_water < s->window_size) { + ulg curr = s->strstart + (ulg)(s->lookahead); + ulg init; + + if (s->high_water < curr) { + /* Previous high water mark below current data -- zero WIN_INIT + * bytes or up to end of window, whichever is less. + */ + init = s->window_size - curr; + if (init > WIN_INIT) + init = WIN_INIT; + zmemzero(s->window + curr, (unsigned)init); + s->high_water = curr + init; + } + else if (s->high_water < (ulg)curr + WIN_INIT) { + /* High water mark at or above current data, but below current data + * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up + * to end of window, whichever is less. + */ + init = (ulg)curr + WIN_INIT - s->high_water; + if (init > s->window_size - s->high_water) + init = s->window_size - s->high_water; + zmemzero(s->window + s->high_water, (unsigned)init); + s->high_water += init; + } + } +} + +/* =========================================================================== + * Flush the current block, with given end-of-file flag. + * IN assertion: strstart is set to the end of the current match. + */ +#define FLUSH_BLOCK_ONLY(s, last) { \ + _tr_flush_block(s, (s->block_start >= 0L ? \ + (charf *)&s->window[(unsigned)s->block_start] : \ + (charf *)Z_NULL), \ + (ulg)((long)s->strstart - s->block_start), \ + (last)); \ + s->block_start = s->strstart; \ + flush_pending(s->strm); \ + Tracev((stderr,"[FLUSH]")); \ +} + +/* Same but force premature exit if necessary. */ +#define FLUSH_BLOCK(s, last) { \ + FLUSH_BLOCK_ONLY(s, last); \ + if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +local block_state deflate_stored(s, flush) + deflate_state *s; + int flush; +{ + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + ulg max_block_size = 0xffff; + ulg max_start; + + if (max_block_size > s->pending_buf_size - 5) { + max_block_size = s->pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s->lookahead <= 1) { + + Assert(s->strstart < s->w_size+MAX_DIST(s) || + s->block_start >= (long)s->w_size, "slide too late"); + + fill_window(s); + if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; + + if (s->lookahead == 0) break; /* flush the current block */ + } + Assert(s->block_start >= 0L, "block gone"); + + s->strstart += s->lookahead; + s->lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + max_start = s->block_start + max_block_size; + if (s->strstart == 0 || (ulg)s->strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s->lookahead = (uInt)(s->strstart - max_start); + s->strstart = (uInt)max_start; + FLUSH_BLOCK(s, 0); + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { + FLUSH_BLOCK(s, 0); + } + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +local block_state deflate_fast(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head; /* head of the hash chain */ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = NIL; + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s->match_length = longest_match (s, hash_head); + /* longest_match() sets match_start */ + } + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->match_start, s->match_length); + + _tr_tally_dist(s, s->strstart - s->match_start, + s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ +#ifndef FASTEST + if (s->match_length <= s->max_insert_length && + s->lookahead >= MIN_MATCH) { + s->match_length--; /* string at strstart already in table */ + do { + s->strstart++; + INSERT_STRING(s, s->strstart, hash_head); + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s->match_length != 0); + s->strstart++; + } else +#endif + { + s->strstart += s->match_length; + s->match_length = 0; + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +#ifndef FASTEST +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +local block_state deflate_slow(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head; /* head of hash chain */ + int bflush; /* set if current block must be flushed */ + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = NIL; + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + */ + s->prev_length = s->match_length, s->prev_match = s->match_start; + s->match_length = MIN_MATCH-1; + + if (hash_head != NIL && s->prev_length < s->max_lazy_match && + s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s->match_length = longest_match (s, hash_head); + /* longest_match() sets match_start */ + + if (s->match_length <= 5 && (s->strategy == Z_FILTERED +#if TOO_FAR <= 32767 + || (s->match_length == MIN_MATCH && + s->strstart - s->match_start > TOO_FAR) +#endif + )) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s->match_length = MIN_MATCH-1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { + uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + check_match(s, s->strstart-1, s->prev_match, s->prev_length); + + _tr_tally_dist(s, s->strstart -1 - s->prev_match, + s->prev_length - MIN_MATCH, bflush); + + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s->lookahead -= s->prev_length-1; + s->prev_length -= 2; + do { + if (++s->strstart <= max_insert) { + INSERT_STRING(s, s->strstart, hash_head); + } + } while (--s->prev_length != 0); + s->match_available = 0; + s->match_length = MIN_MATCH-1; + s->strstart++; + + if (bflush) FLUSH_BLOCK(s, 0); + + } else if (s->match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + if (bflush) { + FLUSH_BLOCK_ONLY(s, 0); + } + s->strstart++; + s->lookahead--; + if (s->strm->avail_out == 0) return need_more; + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s->match_available = 1; + s->strstart++; + s->lookahead--; + } + } + Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s->match_available) { + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + s->match_available = 0; + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} +#endif /* FASTEST */ + +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +local block_state deflate_rle(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + uInt prev; /* byte at distance one to match */ + Bytef *scan, *strend; /* scan goes up to strend for length of run */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest encodable run. + */ + if (s->lookahead < MAX_MATCH) { + fill_window(s); + if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s->match_length = 0; + if (s->lookahead >= MIN_MATCH && s->strstart > 0) { + scan = s->window + s->strstart - 1; + prev = *scan; + if (prev == *++scan && prev == *++scan && prev == *++scan) { + strend = s->window + s->strstart + MAX_MATCH; + do { + } while (prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + scan < strend); + s->match_length = MAX_MATCH - (int)(strend - scan); + if (s->match_length > s->lookahead) + s->match_length = s->lookahead; + } + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->strstart - 1, s->match_length); + + _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + s->strstart += s->match_length; + s->match_length = 0; + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ +local block_state deflate_huff(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s->lookahead == 0) { + fill_window(s); + if (s->lookahead == 0) { + if (flush == Z_NO_FLUSH) + return need_more; + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s->match_length = 0; + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} diff --git a/zlib/deflate.h b/zlib/deflate.h new file mode 100644 index 0000000..cbf0d1e --- /dev/null +++ b/zlib/deflate.h @@ -0,0 +1,342 @@ +/* deflate.h -- internal compression state + * Copyright (C) 1995-2010 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef DEFLATE_H +#define DEFLATE_H + +#include "zutil.h" + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer creation by deflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip encoding + should be left enabled. */ +#ifndef NO_GZIP +# define GZIP +#endif + +/* =========================================================================== + * Internal compression state. + */ + +#define LENGTH_CODES 29 +/* number of length codes, not counting the special END_BLOCK code */ + +#define LITERALS 256 +/* number of literal bytes 0..255 */ + +#define L_CODES (LITERALS+1+LENGTH_CODES) +/* number of Literal or Length codes, including the END_BLOCK code */ + +#define D_CODES 30 +/* number of distance codes */ + +#define BL_CODES 19 +/* number of codes used to transfer the bit lengths */ + +#define HEAP_SIZE (2*L_CODES+1) +/* maximum heap size */ + +#define MAX_BITS 15 +/* All codes must not exceed MAX_BITS bits */ + +#define INIT_STATE 42 +#define EXTRA_STATE 69 +#define NAME_STATE 73 +#define COMMENT_STATE 91 +#define HCRC_STATE 103 +#define BUSY_STATE 113 +#define FINISH_STATE 666 +/* Stream status */ + + +/* Data structure describing a single value and its code string. */ +typedef struct ct_data_s { + union { + ush freq; /* frequency count */ + ush code; /* bit string */ + } fc; + union { + ush dad; /* father node in Huffman tree */ + ush len; /* length of bit string */ + } dl; +} FAR ct_data; + +#define Freq fc.freq +#define Code fc.code +#define Dad dl.dad +#define Len dl.len + +typedef struct static_tree_desc_s static_tree_desc; + +typedef struct tree_desc_s { + ct_data *dyn_tree; /* the dynamic tree */ + int max_code; /* largest code with non zero frequency */ + static_tree_desc *stat_desc; /* the corresponding static tree */ +} FAR tree_desc; + +typedef ush Pos; +typedef Pos FAR Posf; +typedef unsigned IPos; + +/* A Pos is an index in the character window. We use short instead of int to + * save space in the various tables. IPos is used only for parameter passing. + */ + +typedef struct internal_state { + z_streamp strm; /* pointer back to this zlib stream */ + int status; /* as the name implies */ + Bytef *pending_buf; /* output still pending */ + ulg pending_buf_size; /* size of pending_buf */ + Bytef *pending_out; /* next pending byte to output to the stream */ + uInt pending; /* nb of bytes in the pending buffer */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + gz_headerp gzhead; /* gzip header information to write */ + uInt gzindex; /* where in extra, name, or comment */ + Byte method; /* STORED (for zip only) or DEFLATED */ + int last_flush; /* value of flush param for previous deflate call */ + + /* used by deflate.c: */ + + uInt w_size; /* LZ77 window size (32K by default) */ + uInt w_bits; /* log2(w_size) (8..16) */ + uInt w_mask; /* w_size - 1 */ + + Bytef *window; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. Also, it limits + * the window size to 64K, which is quite useful on MSDOS. + * To do: use the user input buffer as sliding window. + */ + + ulg window_size; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + Posf *prev; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + Posf *head; /* Heads of the hash chains or NIL. */ + + uInt ins_h; /* hash index of string to be inserted */ + uInt hash_size; /* number of elements in hash table */ + uInt hash_bits; /* log2(hash_size) */ + uInt hash_mask; /* hash_size-1 */ + + uInt hash_shift; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + long block_start; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + uInt match_length; /* length of best match */ + IPos prev_match; /* previous match */ + int match_available; /* set if previous match exists */ + uInt strstart; /* start of string to insert */ + uInt match_start; /* start of matching string */ + uInt lookahead; /* number of valid bytes ahead in window */ + + uInt prev_length; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + uInt max_chain_length; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + uInt max_lazy_match; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ +# define max_insert_length max_lazy_match + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + int level; /* compression level (1..9) */ + int strategy; /* favor or force Huffman coding*/ + + uInt good_match; + /* Use a faster search when the previous match is longer than this */ + + int nice_match; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + /* Didn't use ct_data typedef below to supress compiler warning */ + struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + struct tree_desc_s l_desc; /* desc. for literal tree */ + struct tree_desc_s d_desc; /* desc. for distance tree */ + struct tree_desc_s bl_desc; /* desc. for bit length tree */ + + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + int heap_len; /* number of elements in the heap */ + int heap_max; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + uch depth[2*L_CODES+1]; + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + uchf *l_buf; /* buffer for literals or lengths */ + + uInt lit_bufsize; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + uInt last_lit; /* running index in l_buf */ + + ushf *d_buf; + /* Buffer for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + ulg opt_len; /* bit length of current block with optimal trees */ + ulg static_len; /* bit length of current block with static trees */ + uInt matches; /* number of string matches in current block */ + int last_eob_len; /* bit length of EOB code for last block */ + +#ifdef DEBUG + ulg compressed_len; /* total bit length of compressed file mod 2^32 */ + ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ +#endif + + ush bi_buf; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + int bi_valid; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + ulg high_water; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ + +} FAR deflate_state; + +/* Output a byte on the stream. + * IN assertion: there is enough room in pending_buf. + */ +#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} + + +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) +/* Minimum amount of lookahead, except at the end of the input file. + * See deflate.c for comments about the MIN_MATCH+1. + */ + +#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) +/* In order to simplify the code, particularly on 16 bit machines, match + * distances are limited to MAX_DIST instead of WSIZE. + */ + +#define WIN_INIT MAX_MATCH +/* Number of bytes after end of data in window to initialize in order to avoid + memory checker errors from longest match routines */ + + /* in trees.c */ +void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); +int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); +void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, + ulg stored_len, int last)); +void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); +void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, + ulg stored_len, int last)); + +#define d_code(dist) \ + ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) +/* Mapping from a distance to a distance code. dist is the distance - 1 and + * must not have side effects. _dist_code[256] and _dist_code[257] are never + * used. + */ + +#ifndef DEBUG +/* Inline versions of _tr_tally for speed: */ + +#if defined(GEN_TREES_H) || !defined(STDC) + extern uch ZLIB_INTERNAL _length_code[]; + extern uch ZLIB_INTERNAL _dist_code[]; +#else + extern const uch ZLIB_INTERNAL _length_code[]; + extern const uch ZLIB_INTERNAL _dist_code[]; +#endif + +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->last_lit] = 0; \ + s->l_buf[s->last_lit++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (length); \ + ush dist = (distance); \ + s->d_buf[s->last_lit] = dist; \ + s->l_buf[s->last_lit++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +#else +# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) +# define _tr_tally_dist(s, distance, length, flush) \ + flush = _tr_tally(s, distance, length) +#endif + +#endif /* DEFLATE_H */ diff --git a/zlib/example.c b/zlib/example.c new file mode 100644 index 0000000..604736f --- /dev/null +++ b/zlib/example.c @@ -0,0 +1,565 @@ +/* example.c -- usage example of the zlib compression library + * Copyright (C) 1995-2006 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zlib.h" +#include + +#ifdef STDC +# include +# include +#endif + +#if defined(VMS) || defined(RISCOS) +# define TESTFILE "foo-gz" +#else +# define TESTFILE "foo.gz" +#endif + +#define CHECK_ERR(err, msg) { \ + if (err != Z_OK) { \ + fprintf(stderr, "%s error: %d\n", msg, err); \ + exit(1); \ + } \ +} + +const char hello[] = "hello, hello!"; +/* "hello world" would be more standard, but the repeated "hello" + * stresses the compression code better, sorry... + */ + +const char dictionary[] = "hello"; +uLong dictId; /* Adler32 value of the dictionary */ + +void test_compress OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_gzio OF((const char *fname, + Byte *uncompr, uLong uncomprLen)); +void test_deflate OF((Byte *compr, uLong comprLen)); +void test_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_large_deflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_large_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_flush OF((Byte *compr, uLong *comprLen)); +void test_sync OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_dict_deflate OF((Byte *compr, uLong comprLen)); +void test_dict_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +int main OF((int argc, char *argv[])); + +/* =========================================================================== + * Test compress() and uncompress() + */ +void test_compress(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + uLong len = (uLong)strlen(hello)+1; + + err = compress(compr, &comprLen, (const Bytef*)hello, len); + CHECK_ERR(err, "compress"); + + strcpy((char*)uncompr, "garbage"); + + err = uncompress(uncompr, &uncomprLen, compr, comprLen); + CHECK_ERR(err, "uncompress"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad uncompress\n"); + exit(1); + } else { + printf("uncompress(): %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Test read/write of .gz files + */ +void test_gzio(fname, uncompr, uncomprLen) + const char *fname; /* compressed file name */ + Byte *uncompr; + uLong uncomprLen; +{ +#ifdef NO_GZCOMPRESS + fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); +#else + int err; + int len = (int)strlen(hello)+1; + gzFile file; + z_off_t pos; + + file = gzopen(fname, "wb"); + if (file == NULL) { + fprintf(stderr, "gzopen error\n"); + exit(1); + } + gzputc(file, 'h'); + if (gzputs(file, "ello") != 4) { + fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); + exit(1); + } + if (gzprintf(file, ", %s!", "hello") != 8) { + fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); + exit(1); + } + gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ + gzclose(file); + + file = gzopen(fname, "rb"); + if (file == NULL) { + fprintf(stderr, "gzopen error\n"); + exit(1); + } + strcpy((char*)uncompr, "garbage"); + + if (gzread(file, uncompr, (unsigned)uncomprLen) != len) { + fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); + exit(1); + } + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); + exit(1); + } else { + printf("gzread(): %s\n", (char*)uncompr); + } + + pos = gzseek(file, -8L, SEEK_CUR); + if (pos != 6 || gztell(file) != pos) { + fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", + (long)pos, (long)gztell(file)); + exit(1); + } + + if (gzgetc(file) != ' ') { + fprintf(stderr, "gzgetc error\n"); + exit(1); + } + + if (gzungetc(' ', file) != ' ') { + fprintf(stderr, "gzungetc error\n"); + exit(1); + } + + gzgets(file, (char*)uncompr, (int)uncomprLen); + if (strlen((char*)uncompr) != 7) { /* " hello!" */ + fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); + exit(1); + } + if (strcmp((char*)uncompr, hello + 6)) { + fprintf(stderr, "bad gzgets after gzseek\n"); + exit(1); + } else { + printf("gzgets() after gzseek: %s\n", (char*)uncompr); + } + + gzclose(file); +#endif +} + +/* =========================================================================== + * Test deflate() with small buffers + */ +void test_deflate(compr, comprLen) + Byte *compr; + uLong comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + uLong len = (uLong)strlen(hello)+1; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_in = (Bytef*)hello; + c_stream.next_out = compr; + + while (c_stream.total_in != len && c_stream.total_out < comprLen) { + c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + } + /* Finish the stream, still forcing small buffers: */ + for (;;) { + c_stream.avail_out = 1; + err = deflate(&c_stream, Z_FINISH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "deflate"); + } + + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with small buffers + */ +void test_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = 0; + d_stream.next_out = uncompr; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { + d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "inflate"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad inflate\n"); + exit(1); + } else { + printf("inflate(): %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Test deflate() with large buffers and dynamic change of compression level + */ +void test_large_deflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_BEST_SPEED); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_out = compr; + c_stream.avail_out = (uInt)comprLen; + + /* At this point, uncompr is still mostly zeroes, so it should compress + * very well: + */ + c_stream.next_in = uncompr; + c_stream.avail_in = (uInt)uncomprLen; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + if (c_stream.avail_in != 0) { + fprintf(stderr, "deflate not greedy\n"); + exit(1); + } + + /* Feed in already compressed data and switch to no compression: */ + deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); + c_stream.next_in = compr; + c_stream.avail_in = (uInt)comprLen/2; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + + /* Switch back to compressing mode: */ + deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); + c_stream.next_in = uncompr; + c_stream.avail_in = (uInt)uncomprLen; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, "deflate should report Z_STREAM_END\n"); + exit(1); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with large buffers + */ +void test_large_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = (uInt)comprLen; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + for (;;) { + d_stream.next_out = uncompr; /* discard the output */ + d_stream.avail_out = (uInt)uncomprLen; + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "large inflate"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (d_stream.total_out != 2*uncomprLen + comprLen/2) { + fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); + exit(1); + } else { + printf("large_inflate(): OK\n"); + } +} + +/* =========================================================================== + * Test deflate() with full flush + */ +void test_flush(compr, comprLen) + Byte *compr; + uLong *comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + uInt len = (uInt)strlen(hello)+1; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_in = (Bytef*)hello; + c_stream.next_out = compr; + c_stream.avail_in = 3; + c_stream.avail_out = (uInt)*comprLen; + err = deflate(&c_stream, Z_FULL_FLUSH); + CHECK_ERR(err, "deflate"); + + compr[3]++; /* force an error in first compressed block */ + c_stream.avail_in = len - 3; + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + CHECK_ERR(err, "deflate"); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); + + *comprLen = c_stream.total_out; +} + +/* =========================================================================== + * Test inflateSync() + */ +void test_sync(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = 2; /* just read the zlib header */ + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + d_stream.next_out = uncompr; + d_stream.avail_out = (uInt)uncomprLen; + + inflate(&d_stream, Z_NO_FLUSH); + CHECK_ERR(err, "inflate"); + + d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ + err = inflateSync(&d_stream); /* but skip the damaged part */ + CHECK_ERR(err, "inflateSync"); + + err = inflate(&d_stream, Z_FINISH); + if (err != Z_DATA_ERROR) { + fprintf(stderr, "inflate should report DATA_ERROR\n"); + /* Because of incorrect adler32 */ + exit(1); + } + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + printf("after inflateSync(): hel%s\n", (char *)uncompr); +} + +/* =========================================================================== + * Test deflate() with preset dictionary + */ +void test_dict_deflate(compr, comprLen) + Byte *compr; + uLong comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_BEST_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + err = deflateSetDictionary(&c_stream, + (const Bytef*)dictionary, sizeof(dictionary)); + CHECK_ERR(err, "deflateSetDictionary"); + + dictId = c_stream.adler; + c_stream.next_out = compr; + c_stream.avail_out = (uInt)comprLen; + + c_stream.next_in = (Bytef*)hello; + c_stream.avail_in = (uInt)strlen(hello)+1; + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, "deflate should report Z_STREAM_END\n"); + exit(1); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with a preset dictionary + */ +void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = (uInt)comprLen; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + d_stream.next_out = uncompr; + d_stream.avail_out = (uInt)uncomprLen; + + for (;;) { + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + if (err == Z_NEED_DICT) { + if (d_stream.adler != dictId) { + fprintf(stderr, "unexpected dictionary"); + exit(1); + } + err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, + sizeof(dictionary)); + } + CHECK_ERR(err, "inflate with dict"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad inflate with dict\n"); + exit(1); + } else { + printf("inflate with dictionary: %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Usage: example [output.gz [input.gz]] + */ + +int main(argc, argv) + int argc; + char *argv[]; +{ + Byte *compr, *uncompr; + uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ + uLong uncomprLen = comprLen; + static const char* myVersion = ZLIB_VERSION; + + if (zlibVersion()[0] != myVersion[0]) { + fprintf(stderr, "incompatible zlib version\n"); + exit(1); + + } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { + fprintf(stderr, "warning: different zlib version\n"); + } + + printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", + ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); + + compr = (Byte*)calloc((uInt)comprLen, 1); + uncompr = (Byte*)calloc((uInt)uncomprLen, 1); + /* compr and uncompr are cleared to avoid reading uninitialized + * data and to ensure that uncompr compresses well. + */ + if (compr == Z_NULL || uncompr == Z_NULL) { + printf("out of memory\n"); + exit(1); + } + test_compress(compr, comprLen, uncompr, uncomprLen); + + test_gzio((argc > 1 ? argv[1] : TESTFILE), + uncompr, uncomprLen); + + test_deflate(compr, comprLen); + test_inflate(compr, comprLen, uncompr, uncomprLen); + + test_large_deflate(compr, comprLen, uncompr, uncomprLen); + test_large_inflate(compr, comprLen, uncompr, uncomprLen); + + test_flush(compr, &comprLen); + test_sync(compr, comprLen, uncompr, uncomprLen); + comprLen = uncomprLen; + + test_dict_deflate(compr, comprLen); + test_dict_inflate(compr, comprLen, uncompr, uncomprLen); + + free(compr); + free(uncompr); + + return 0; +} diff --git a/zlib/gzclose.c b/zlib/gzclose.c new file mode 100644 index 0000000..caeb99a --- /dev/null +++ b/zlib/gzclose.c @@ -0,0 +1,25 @@ +/* gzclose.c -- zlib gzclose() function + * Copyright (C) 2004, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* gzclose() is in a separate file so that it is linked in only if it is used. + That way the other gzclose functions can be used instead to avoid linking in + unneeded compression or decompression routines. */ +int ZEXPORT gzclose(file) + gzFile file; +{ +#ifndef NO_GZCOMPRESS + gz_statep state; + + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); +#else + return gzclose_r(file); +#endif +} diff --git a/zlib/gzguts.h b/zlib/gzguts.h new file mode 100644 index 0000000..0f8fb79 --- /dev/null +++ b/zlib/gzguts.h @@ -0,0 +1,132 @@ +/* gzguts.h -- zlib internal header definitions for gz* operations + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef _LARGEFILE64_SOURCE +# ifndef _LARGEFILE_SOURCE +# define _LARGEFILE_SOURCE 1 +# endif +# ifdef _FILE_OFFSET_BITS +# undef _FILE_OFFSET_BITS +# endif +#endif + +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include +#include "zlib.h" +#ifdef STDC +# include +# include +# include +#endif +#include + +#ifdef NO_DEFLATE /* for compatibility with old definition */ +# define NO_GZCOMPRESS +#endif + +#ifdef _MSC_VER +# include +# define vsnprintf _vsnprintf +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +/* gz* functions always use library allocation functions */ +#ifndef STDC + extern voidp malloc OF((uInt size)); + extern void free OF((voidpf ptr)); +#endif + +/* get errno and strerror definition */ +#if defined UNDER_CE +# include +# define zstrerror() gz_strwinerror((DWORD)GetLastError()) +#else +# ifdef STDC +# include +# define zstrerror() strerror(errno) +# else +# define zstrerror() "stdio error (consult errno)" +# endif +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); +#endif + +/* default i/o buffer size -- double this for output when reading */ +#define GZBUFSIZE 8192 + +/* gzip modes, also provide a little integrity check on the passed structure */ +#define GZ_NONE 0 +#define GZ_READ 7247 +#define GZ_WRITE 31153 +#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ + +/* values for gz_state how */ +#define LOOK 0 /* look for a gzip header */ +#define COPY 1 /* copy input directly */ +#define GZIP 2 /* decompress a gzip stream */ + +/* internal gzip file state data structure */ +typedef struct { + /* used for both reading and writing */ + int mode; /* see gzip modes above */ + int fd; /* file descriptor */ + char *path; /* path or fd for error messages */ + z_off64_t pos; /* current position in uncompressed data */ + unsigned size; /* buffer size, zero if not allocated yet */ + unsigned want; /* requested buffer size, default is GZBUFSIZE */ + unsigned char *in; /* input buffer */ + unsigned char *out; /* output buffer (double-sized when reading) */ + unsigned char *next; /* next output data to deliver or write */ + /* just for reading */ + unsigned have; /* amount of output data unused at next */ + int eof; /* true if end of input file reached */ + z_off64_t start; /* where the gzip data started, for rewinding */ + z_off64_t raw; /* where the raw data started, for seeking */ + int how; /* 0: get header, 1: copy, 2: decompress */ + int direct; /* true if last read direct, false if gzip */ + /* just for writing */ + int level; /* compression level */ + int strategy; /* compression strategy */ + /* seek request */ + z_off64_t skip; /* amount to skip (already rewound if backwards) */ + int seek; /* true if seek request pending */ + /* error information */ + int err; /* error code */ + char *msg; /* error message */ + /* zlib inflate or deflate stream */ + z_stream strm; /* stream structure in-place (not a pointer) */ +} gz_state; +typedef gz_state FAR *gz_statep; + +/* shared functions */ +void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); +#if defined UNDER_CE +char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); +#endif + +/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t + value -- needed when comparing unsigned to z_off64_t, which is signed + (possible z_off64_t types off_t, off64_t, and long are all signed) */ +#ifdef INT_MAX +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) +#else +unsigned ZLIB_INTERNAL gz_intmax OF((void)); +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) +#endif diff --git a/zlib/gzlib.c b/zlib/gzlib.c new file mode 100644 index 0000000..603e60e --- /dev/null +++ b/zlib/gzlib.c @@ -0,0 +1,537 @@ +/* gzlib.c -- zlib functions common to reading and writing gzip files + * Copyright (C) 2004, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define LSEEK lseek64 +#else +# define LSEEK lseek +#endif + +/* Local functions */ +local void gz_reset OF((gz_statep)); +local gzFile gz_open OF((const char *, int, const char *)); + +#if defined UNDER_CE + +/* Map the Windows error number in ERROR to a locale-dependent error message + string and return a pointer to it. Typically, the values for ERROR come + from GetLastError. + + The string pointed to shall not be modified by the application, but may be + overwritten by a subsequent call to gz_strwinerror + + The gz_strwinerror function does not change the current setting of + GetLastError. */ +char ZLIB_INTERNAL *gz_strwinerror (error) + DWORD error; +{ + static char buf[1024]; + + wchar_t *msgbuf; + DWORD lasterr = GetLastError(); + DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, + error, + 0, /* Default language */ + (LPVOID)&msgbuf, + 0, + NULL); + if (chars != 0) { + /* If there is an \r\n appended, zap it. */ + if (chars >= 2 + && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { + chars -= 2; + msgbuf[chars] = 0; + } + + if (chars > sizeof (buf) - 1) { + chars = sizeof (buf) - 1; + msgbuf[chars] = 0; + } + + wcstombs(buf, msgbuf, chars + 1); + LocalFree(msgbuf); + } + else { + sprintf(buf, "unknown win32 error (%ld)", error); + } + + SetLastError(lasterr); + return buf; +} + +#endif /* UNDER_CE */ + +/* Reset gzip file state */ +local void gz_reset(state) + gz_statep state; +{ + if (state->mode == GZ_READ) { /* for reading ... */ + state->have = 0; /* no output data available */ + state->eof = 0; /* not at end of file */ + state->how = LOOK; /* look for gzip header */ + state->direct = 1; /* default for empty file */ + } + state->seek = 0; /* no seek request pending */ + gz_error(state, Z_OK, NULL); /* clear error */ + state->pos = 0; /* no uncompressed data yet */ + state->strm.avail_in = 0; /* no input data yet */ +} + +/* Open a gzip file either by name or file descriptor. */ +local gzFile gz_open(path, fd, mode) + const char *path; + int fd; + const char *mode; +{ + gz_statep state; + + /* allocate gzFile structure to return */ + state = malloc(sizeof(gz_state)); + if (state == NULL) + return NULL; + state->size = 0; /* no buffers allocated yet */ + state->want = GZBUFSIZE; /* requested buffer size */ + state->msg = NULL; /* no error message yet */ + + /* interpret mode */ + state->mode = GZ_NONE; + state->level = Z_DEFAULT_COMPRESSION; + state->strategy = Z_DEFAULT_STRATEGY; + while (*mode) { + if (*mode >= '0' && *mode <= '9') + state->level = *mode - '0'; + else + switch (*mode) { + case 'r': + state->mode = GZ_READ; + break; +#ifndef NO_GZCOMPRESS + case 'w': + state->mode = GZ_WRITE; + break; + case 'a': + state->mode = GZ_APPEND; + break; +#endif + case '+': /* can't read and write at the same time */ + free(state); + return NULL; + case 'b': /* ignore -- will request binary anyway */ + break; + case 'f': + state->strategy = Z_FILTERED; + break; + case 'h': + state->strategy = Z_HUFFMAN_ONLY; + break; + case 'R': + state->strategy = Z_RLE; + break; + case 'F': + state->strategy = Z_FIXED; + default: /* could consider as an error, but just ignore */ + ; + } + mode++; + } + + /* must provide an "r", "w", or "a" */ + if (state->mode == GZ_NONE) { + free(state); + return NULL; + } + + /* save the path name for error messages */ + state->path = malloc(strlen(path) + 1); + if (state->path == NULL) { + free(state); + return NULL; + } + strcpy(state->path, path); + + /* open the file with the appropriate mode (or just use fd) */ + state->fd = fd != -1 ? fd : + open(path, +#ifdef O_LARGEFILE + O_LARGEFILE | +#endif +#ifdef O_BINARY + O_BINARY | +#endif + (state->mode == GZ_READ ? + O_RDONLY : + (O_WRONLY | O_CREAT | ( + state->mode == GZ_WRITE ? + O_TRUNC : + O_APPEND))), + 0666); + if (state->fd == -1) { + free(state->path); + free(state); + return NULL; + } + if (state->mode == GZ_APPEND) + state->mode = GZ_WRITE; /* simplify later checks */ + + /* save the current position for rewinding (only if reading) */ + if (state->mode == GZ_READ) { + state->start = LSEEK(state->fd, 0, SEEK_CUR); + if (state->start == -1) state->start = 0; + } + + /* initialize stream */ + gz_reset(state); + + /* return stream */ + return (gzFile)state; +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzopen(path, mode) + const char *path; + const char *mode; +{ + return gz_open(path, -1, mode); +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzopen64(path, mode) + const char *path; + const char *mode; +{ + return gz_open(path, -1, mode); +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzdopen(fd, mode) + int fd; + const char *mode; +{ + char *path; /* identifier for error messages */ + gzFile gz; + + if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) + return NULL; + sprintf(path, "", fd); /* for debugging */ + gz = gz_open(path, fd, mode); + free(path); + return gz; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzbuffer(file, size) + gzFile file; + unsigned size; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* make sure we haven't already allocated memory */ + if (state->size != 0) + return -1; + + /* check and set requested size */ + if (size == 0) + return -1; + state->want = size; + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzrewind(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* back up and start over */ + if (LSEEK(state->fd, state->start, SEEK_SET) == -1) + return -1; + gz_reset(state); + return 0; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gzseek64(file, offset, whence) + gzFile file; + z_off64_t offset; + int whence; +{ + unsigned n; + z_off64_t ret; + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* check that there's no error */ + if (state->err != Z_OK) + return -1; + + /* can only seek from start or relative to current position */ + if (whence != SEEK_SET && whence != SEEK_CUR) + return -1; + + /* normalize offset to a SEEK_CUR specification */ + if (whence == SEEK_SET) + offset -= state->pos; + else if (state->seek) + offset += state->skip; + state->seek = 0; + + /* if within raw area while reading, just go there */ + if (state->mode == GZ_READ && state->how == COPY && + state->pos + offset >= state->raw) { + ret = LSEEK(state->fd, offset - state->have, SEEK_CUR); + if (ret == -1) + return -1; + state->have = 0; + state->eof = 0; + state->seek = 0; + gz_error(state, Z_OK, NULL); + state->strm.avail_in = 0; + state->pos += offset; + return state->pos; + } + + /* calculate skip amount, rewinding if needed for back seek when reading */ + if (offset < 0) { + if (state->mode != GZ_READ) /* writing -- can't go backwards */ + return -1; + offset += state->pos; + if (offset < 0) /* before start of file! */ + return -1; + if (gzrewind(file) == -1) /* rewind, then skip to offset */ + return -1; + } + + /* if reading, skip what's in output buffer (one less gzgetc() check) */ + if (state->mode == GZ_READ) { + n = GT_OFF(state->have) || (z_off64_t)state->have > offset ? + (unsigned)offset : state->have; + state->have -= n; + state->next += n; + state->pos += n; + offset -= n; + } + + /* request skip (if not zero) */ + if (offset) { + state->seek = 1; + state->skip = offset; + } + return state->pos + offset; +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gzseek(file, offset, whence) + gzFile file; + z_off_t offset; + int whence; +{ + z_off64_t ret; + + ret = gzseek64(file, (z_off64_t)offset, whence); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gztell64(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* return position */ + return state->pos + (state->seek ? state->skip : 0); +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gztell(file) + gzFile file; +{ + z_off64_t ret; + + ret = gztell64(file); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gzoffset64(file) + gzFile file; +{ + z_off64_t offset; + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* compute and return effective offset in file */ + offset = LSEEK(state->fd, 0, SEEK_CUR); + if (offset == -1) + return -1; + if (state->mode == GZ_READ) /* reading */ + offset -= state->strm.avail_in; /* don't count buffered input */ + return offset; +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gzoffset(file) + gzFile file; +{ + z_off64_t ret; + + ret = gzoffset64(file); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzeof(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return 0; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return 0; + + /* return end-of-file state */ + return state->mode == GZ_READ ? + (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0; +} + +/* -- see zlib.h -- */ +const char * ZEXPORT gzerror(file, errnum) + gzFile file; + int *errnum; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return NULL; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return NULL; + + /* return error information */ + if (errnum != NULL) + *errnum = state->err; + return state->msg == NULL ? "" : state->msg; +} + +/* -- see zlib.h -- */ +void ZEXPORT gzclearerr(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return; + + /* clear error and end-of-file */ + if (state->mode == GZ_READ) + state->eof = 0; + gz_error(state, Z_OK, NULL); +} + +/* Create an error message in allocated memory and set state->err and + state->msg accordingly. Free any previous error message already there. Do + not try to free or allocate space if the error is Z_MEM_ERROR (out of + memory). Simply save the error message as a static string. If there is an + allocation failure constructing the error message, then convert the error to + out of memory. */ +void ZLIB_INTERNAL gz_error(state, err, msg) + gz_statep state; + int err; + const char *msg; +{ + /* free previously allocated message and clear */ + if (state->msg != NULL) { + if (state->err != Z_MEM_ERROR) + free(state->msg); + state->msg = NULL; + } + + /* set error code, and if no message, then done */ + state->err = err; + if (msg == NULL) + return; + + /* for an out of memory error, save as static string */ + if (err == Z_MEM_ERROR) { + state->msg = (char *)msg; + return; + } + + /* construct error message with path */ + if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) { + state->err = Z_MEM_ERROR; + state->msg = (char *)"out of memory"; + return; + } + strcpy(state->msg, state->path); + strcat(state->msg, ": "); + strcat(state->msg, msg); + return; +} + +#ifndef INT_MAX +/* portably return maximum value for an int (when limits.h presumed not + available) -- we need to do this to cover cases where 2's complement not + used, since C standard permits 1's complement and sign-bit representations, + otherwise we could just use ((unsigned)-1) >> 1 */ +unsigned ZLIB_INTERNAL gz_intmax() +{ + unsigned p, q; + + p = 1; + do { + q = p; + p <<= 1; + p++; + } while (p > q); + return q >> 1; +} +#endif diff --git a/zlib/gzread.c b/zlib/gzread.c new file mode 100644 index 0000000..548201a --- /dev/null +++ b/zlib/gzread.c @@ -0,0 +1,653 @@ +/* gzread.c -- zlib functions for reading gzip files + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* Local functions */ +local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); +local int gz_avail OF((gz_statep)); +local int gz_next4 OF((gz_statep, unsigned long *)); +local int gz_head OF((gz_statep)); +local int gz_decomp OF((gz_statep)); +local int gz_make OF((gz_statep)); +local int gz_skip OF((gz_statep, z_off64_t)); + +/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from + state->fd, and update state->eof, state->err, and state->msg as appropriate. + This function needs to loop on read(), since read() is not guaranteed to + read the number of bytes requested, depending on the type of descriptor. */ +local int gz_load(state, buf, len, have) + gz_statep state; + unsigned char *buf; + unsigned len; + unsigned *have; +{ + int ret; + + *have = 0; + do { + ret = read(state->fd, buf + *have, len - *have); + if (ret <= 0) + break; + *have += ret; + } while (*have < len); + if (ret < 0) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + if (ret == 0) + state->eof = 1; + return 0; +} + +/* Load up input buffer and set eof flag if last data loaded -- return -1 on + error, 0 otherwise. Note that the eof flag is set when the end of the input + file is reached, even though there may be unused data in the buffer. Once + that data has been used, no more attempts will be made to read the file. + gz_avail() assumes that strm->avail_in == 0. */ +local int gz_avail(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + + if (state->err != Z_OK) + return -1; + if (state->eof == 0) { + if (gz_load(state, state->in, state->size, + (unsigned *)&(strm->avail_in)) == -1) + return -1; + strm->next_in = state->in; + } + return 0; +} + +/* Get next byte from input, or -1 if end or error. */ +#define NEXT() ((strm->avail_in == 0 && gz_avail(state) == -1) ? -1 : \ + (strm->avail_in == 0 ? -1 : \ + (strm->avail_in--, *(strm->next_in)++))) + +/* Get a four-byte little-endian integer and return 0 on success and the value + in *ret. Otherwise -1 is returned and *ret is not modified. */ +local int gz_next4(state, ret) + gz_statep state; + unsigned long *ret; +{ + int ch; + unsigned long val; + z_streamp strm = &(state->strm); + + val = NEXT(); + val += (unsigned)NEXT() << 8; + val += (unsigned long)NEXT() << 16; + ch = NEXT(); + if (ch == -1) + return -1; + val += (unsigned long)ch << 24; + *ret = val; + return 0; +} + +/* Look for gzip header, set up for inflate or copy. state->have must be zero. + If this is the first time in, allocate required memory. state->how will be + left unchanged if there is no more input data available, will be set to COPY + if there is no gzip header and direct copying will be performed, or it will + be set to GZIP for decompression, and the gzip header will be skipped so + that the next available input data is the raw deflate stream. If direct + copying, then leftover input data from the input buffer will be copied to + the output buffer. In that case, all further file reads will be directly to + either the output buffer or a user buffer. If decompressing, the inflate + state and the check value will be initialized. gz_head() will return 0 on + success or -1 on failure. Failures may include read errors or gzip header + errors. */ +local int gz_head(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + int flags; + unsigned len; + + /* allocate read buffers and inflate memory */ + if (state->size == 0) { + /* allocate buffers */ + state->in = malloc(state->want); + state->out = malloc(state->want << 1); + if (state->in == NULL || state->out == NULL) { + if (state->out != NULL) + free(state->out); + if (state->in != NULL) + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + state->size = state->want; + + /* allocate inflate memory */ + state->strm.zalloc = Z_NULL; + state->strm.zfree = Z_NULL; + state->strm.opaque = Z_NULL; + state->strm.avail_in = 0; + state->strm.next_in = Z_NULL; + if (inflateInit2(&(state->strm), -15) != Z_OK) { /* raw inflate */ + free(state->out); + free(state->in); + state->size = 0; + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + } + + /* get some data in the input buffer */ + if (strm->avail_in == 0) { + if (gz_avail(state) == -1) + return -1; + if (strm->avail_in == 0) + return 0; + } + + /* look for the gzip magic header bytes 31 and 139 */ + if (strm->next_in[0] == 31) { + strm->avail_in--; + strm->next_in++; + if (strm->avail_in == 0 && gz_avail(state) == -1) + return -1; + if (strm->avail_in && strm->next_in[0] == 139) { + /* we have a gzip header, woo hoo! */ + strm->avail_in--; + strm->next_in++; + + /* skip rest of header */ + if (NEXT() != 8) { /* compression method */ + gz_error(state, Z_DATA_ERROR, "unknown compression method"); + return -1; + } + flags = NEXT(); + if (flags & 0xe0) { /* reserved flag bits */ + gz_error(state, Z_DATA_ERROR, "unknown header flags set"); + return -1; + } + NEXT(); /* modification time */ + NEXT(); + NEXT(); + NEXT(); + NEXT(); /* extra flags */ + NEXT(); /* operating system */ + if (flags & 4) { /* extra field */ + len = (unsigned)NEXT(); + len += (unsigned)NEXT() << 8; + while (len--) + if (NEXT() < 0) + break; + } + if (flags & 8) /* file name */ + while (NEXT() > 0) + ; + if (flags & 16) /* comment */ + while (NEXT() > 0) + ; + if (flags & 2) { /* header crc */ + NEXT(); + NEXT(); + } + /* an unexpected end of file is not checked for here -- it will be + noticed on the first request for uncompressed data */ + + /* set up for decompression */ + inflateReset(strm); + strm->adler = crc32(0L, Z_NULL, 0); + state->how = GZIP; + state->direct = 0; + return 0; + } + else { + /* not a gzip file -- save first byte (31) and fall to raw i/o */ + state->out[0] = 31; + state->have = 1; + } + } + + /* doing raw i/o, save start of raw data for seeking, copy any leftover + input to output -- this assumes that the output buffer is larger than + the input buffer, which also assures space for gzungetc() */ + state->raw = state->pos; + state->next = state->out; + if (strm->avail_in) { + memcpy(state->next + state->have, strm->next_in, strm->avail_in); + state->have += strm->avail_in; + strm->avail_in = 0; + } + state->how = COPY; + state->direct = 1; + return 0; +} + +/* Decompress from input to the provided next_out and avail_out in the state. + If the end of the compressed data is reached, then verify the gzip trailer + check value and length (modulo 2^32). state->have and state->next are set + to point to the just decompressed data, and the crc is updated. If the + trailer is verified, state->how is reset to LOOK to look for the next gzip + stream or raw data, once state->have is depleted. Returns 0 on success, -1 + on failure. Failures may include invalid compressed data or a failed gzip + trailer verification. */ +local int gz_decomp(state) + gz_statep state; +{ + int ret; + unsigned had; + unsigned long crc, len; + z_streamp strm = &(state->strm); + + /* fill output buffer up to end of deflate stream */ + had = strm->avail_out; + do { + /* get more input for inflate() */ + if (strm->avail_in == 0 && gz_avail(state) == -1) + return -1; + if (strm->avail_in == 0) { + gz_error(state, Z_DATA_ERROR, "unexpected end of file"); + return -1; + } + + /* decompress and handle errors */ + ret = inflate(strm, Z_NO_FLUSH); + if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) { + gz_error(state, Z_STREAM_ERROR, + "internal error: inflate stream corrupt"); + return -1; + } + if (ret == Z_MEM_ERROR) { + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + if (ret == Z_DATA_ERROR) { /* deflate stream invalid */ + gz_error(state, Z_DATA_ERROR, + strm->msg == NULL ? "compressed data error" : strm->msg); + return -1; + } + } while (strm->avail_out && ret != Z_STREAM_END); + + /* update available output and crc check value */ + state->have = had - strm->avail_out; + state->next = strm->next_out - state->have; + strm->adler = crc32(strm->adler, state->next, state->have); + + /* check gzip trailer if at end of deflate stream */ + if (ret == Z_STREAM_END) { + if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) { + gz_error(state, Z_DATA_ERROR, "unexpected end of file"); + return -1; + } + if (crc != strm->adler) { + gz_error(state, Z_DATA_ERROR, "incorrect data check"); + return -1; + } + if (len != (strm->total_out & 0xffffffffL)) { + gz_error(state, Z_DATA_ERROR, "incorrect length check"); + return -1; + } + state->how = LOOK; /* ready for next stream, once have is 0 (leave + state->direct unchanged to remember how) */ + } + + /* good decompression */ + return 0; +} + +/* Make data and put in the output buffer. Assumes that state->have == 0. + Data is either copied from the input file or decompressed from the input + file depending on state->how. If state->how is LOOK, then a gzip header is + looked for (and skipped if found) to determine wither to copy or decompress. + Returns -1 on error, otherwise 0. gz_make() will leave state->have as COPY + or GZIP unless the end of the input file has been reached and all data has + been processed. */ +local int gz_make(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + + if (state->how == LOOK) { /* look for gzip header */ + if (gz_head(state) == -1) + return -1; + if (state->have) /* got some data from gz_head() */ + return 0; + } + if (state->how == COPY) { /* straight copy */ + if (gz_load(state, state->out, state->size << 1, &(state->have)) == -1) + return -1; + state->next = state->out; + } + else if (state->how == GZIP) { /* decompress */ + strm->avail_out = state->size << 1; + strm->next_out = state->out; + if (gz_decomp(state) == -1) + return -1; + } + return 0; +} + +/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ +local int gz_skip(state, len) + gz_statep state; + z_off64_t len; +{ + unsigned n; + + /* skip over len bytes or reach end-of-file, whichever comes first */ + while (len) + /* skip over whatever is in output buffer */ + if (state->have) { + n = GT_OFF(state->have) || (z_off64_t)state->have > len ? + (unsigned)len : state->have; + state->have -= n; + state->next += n; + state->pos += n; + len -= n; + } + + /* output buffer empty -- return if we're at the end of the input */ + else if (state->eof && state->strm.avail_in == 0) + break; + + /* need more data to skip -- load up output buffer */ + else { + /* get more output, looking for header if required */ + if (gz_make(state) == -1) + return -1; + } + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzread(file, buf, len) + gzFile file; + voidp buf; + unsigned len; +{ + unsigned got, n; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* since an int is returned, make sure len fits in one, otherwise return + with an error (this avoids the flaw in the interface) */ + if ((int)len < 0) { + gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); + return -1; + } + + /* if len is zero, avoid unnecessary operations */ + if (len == 0) + return 0; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return -1; + } + + /* get len bytes to buf, or less than len if at the end */ + got = 0; + do { + /* first just try copying data from the output buffer */ + if (state->have) { + n = state->have > len ? len : state->have; + memcpy(buf, state->next, n); + state->next += n; + state->have -= n; + } + + /* output buffer empty -- return if we're at the end of the input */ + else if (state->eof && strm->avail_in == 0) + break; + + /* need output data -- for small len or new stream load up our output + buffer */ + else if (state->how == LOOK || len < (state->size << 1)) { + /* get more output, looking for header if required */ + if (gz_make(state) == -1) + return -1; + continue; /* no progress yet -- go back to memcpy() above */ + /* the copy above assures that we will leave with space in the + output buffer, allowing at least one gzungetc() to succeed */ + } + + /* large len -- read directly into user buffer */ + else if (state->how == COPY) { /* read directly */ + if (gz_load(state, buf, len, &n) == -1) + return -1; + } + + /* large len -- decompress directly into user buffer */ + else { /* state->how == GZIP */ + strm->avail_out = len; + strm->next_out = buf; + if (gz_decomp(state) == -1) + return -1; + n = state->have; + state->have = 0; + } + + /* update progress */ + len -= n; + buf = (char *)buf + n; + got += n; + state->pos += n; + } while (len); + + /* return number of bytes read into user buffer (will fit in int) */ + return (int)got; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzgetc(file) + gzFile file; +{ + int ret; + unsigned char buf[1]; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* try output buffer (no need to check for skip request) */ + if (state->have) { + state->have--; + state->pos++; + return *(state->next)++; + } + + /* nothing there -- try gzread() */ + ret = gzread(file, buf, 1); + return ret < 1 ? -1 : buf[0]; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzungetc(c, file) + int c; + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return -1; + } + + /* can't push EOF */ + if (c < 0) + return -1; + + /* if output buffer empty, put byte at end (allows more pushing) */ + if (state->have == 0) { + state->have = 1; + state->next = state->out + (state->size << 1) - 1; + state->next[0] = c; + state->pos--; + return c; + } + + /* if no room, give up (must have already done a gzungetc()) */ + if (state->have == (state->size << 1)) { + gz_error(state, Z_BUF_ERROR, "out of room to push characters"); + return -1; + } + + /* slide output data if needed and insert byte before existing data */ + if (state->next == state->out) { + unsigned char *src = state->out + state->have; + unsigned char *dest = state->out + (state->size << 1); + while (src > state->out) + *--dest = *--src; + state->next = dest; + } + state->have++; + state->next--; + state->next[0] = c; + state->pos--; + return c; +} + +/* -- see zlib.h -- */ +char * ZEXPORT gzgets(file, buf, len) + gzFile file; + char *buf; + int len; +{ + unsigned left, n; + char *str; + unsigned char *eol; + gz_statep state; + + /* check parameters and get internal structure */ + if (file == NULL || buf == NULL || len < 1) + return NULL; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return NULL; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return NULL; + } + + /* copy output bytes up to new line or len - 1, whichever comes first -- + append a terminating zero to the string (we don't check for a zero in + the contents, let the user worry about that) */ + str = buf; + left = (unsigned)len - 1; + if (left) do { + /* assure that something is in the output buffer */ + if (state->have == 0) { + if (gz_make(state) == -1) + return NULL; /* error */ + if (state->have == 0) { /* end of file */ + if (buf == str) /* got bupkus */ + return NULL; + break; /* got something -- return it */ + } + } + + /* look for end-of-line in current output buffer */ + n = state->have > left ? left : state->have; + eol = memchr(state->next, '\n', n); + if (eol != NULL) + n = (unsigned)(eol - state->next) + 1; + + /* copy through end-of-line, or remainder if not found */ + memcpy(buf, state->next, n); + state->have -= n; + state->next += n; + state->pos += n; + left -= n; + buf += n; + } while (left && eol == NULL); + + /* found end-of-line or out of space -- terminate string and return it */ + buf[0] = 0; + return str; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzdirect(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + + /* check that we're reading */ + if (state->mode != GZ_READ) + return 0; + + /* if the state is not known, but we can find out, then do so (this is + mainly for right after a gzopen() or gzdopen()) */ + if (state->how == LOOK && state->have == 0) + (void)gz_head(state); + + /* return 1 if reading direct, 0 if decompressing a gzip stream */ + return state->direct; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzclose_r(file) + gzFile file; +{ + int ret; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + /* check that we're reading */ + if (state->mode != GZ_READ) + return Z_STREAM_ERROR; + + /* free memory and close file */ + if (state->size) { + inflateEnd(&(state->strm)); + free(state->out); + free(state->in); + } + gz_error(state, Z_OK, NULL); + free(state->path); + ret = close(state->fd); + free(state); + return ret ? Z_ERRNO : Z_OK; +} diff --git a/zlib/gzwrite.c b/zlib/gzwrite.c new file mode 100644 index 0000000..e8defc6 --- /dev/null +++ b/zlib/gzwrite.c @@ -0,0 +1,531 @@ +/* gzwrite.c -- zlib functions for writing gzip files + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* Local functions */ +local int gz_init OF((gz_statep)); +local int gz_comp OF((gz_statep, int)); +local int gz_zero OF((gz_statep, z_off64_t)); + +/* Initialize state for writing a gzip file. Mark initialization by setting + state->size to non-zero. Return -1 on failure or 0 on success. */ +local int gz_init(state) + gz_statep state; +{ + int ret; + z_streamp strm = &(state->strm); + + /* allocate input and output buffers */ + state->in = malloc(state->want); + state->out = malloc(state->want); + if (state->in == NULL || state->out == NULL) { + if (state->out != NULL) + free(state->out); + if (state->in != NULL) + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + + /* allocate deflate memory, set up for gzip compression */ + strm->zalloc = Z_NULL; + strm->zfree = Z_NULL; + strm->opaque = Z_NULL; + ret = deflateInit2(strm, state->level, Z_DEFLATED, + 15 + 16, 8, state->strategy); + if (ret != Z_OK) { + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + + /* mark state as initialized */ + state->size = state->want; + + /* initialize write buffer */ + strm->avail_out = state->size; + strm->next_out = state->out; + state->next = strm->next_out; + return 0; +} + +/* Compress whatever is at avail_in and next_in and write to the output file. + Return -1 if there is an error writing to the output file, otherwise 0. + flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH, + then the deflate() state is reset to start a new gzip stream. */ +local int gz_comp(state, flush) + gz_statep state; + int flush; +{ + int ret, got; + unsigned have; + z_streamp strm = &(state->strm); + + /* allocate memory if this is the first time through */ + if (state->size == 0 && gz_init(state) == -1) + return -1; + + /* run deflate() on provided input until it produces no more output */ + ret = Z_OK; + do { + /* write out current buffer contents if full, or if flushing, but if + doing Z_FINISH then don't write until we get to Z_STREAM_END */ + if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && + (flush != Z_FINISH || ret == Z_STREAM_END))) { + have = (unsigned)(strm->next_out - state->next); + if (have && ((got = write(state->fd, state->next, have)) < 0 || + (unsigned)got != have)) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + if (strm->avail_out == 0) { + strm->avail_out = state->size; + strm->next_out = state->out; + } + state->next = strm->next_out; + } + + /* compress */ + have = strm->avail_out; + ret = deflate(strm, flush); + if (ret == Z_STREAM_ERROR) { + gz_error(state, Z_STREAM_ERROR, + "internal error: deflate stream corrupt"); + return -1; + } + have -= strm->avail_out; + } while (have); + + /* if that completed a deflate stream, allow another to start */ + if (flush == Z_FINISH) + deflateReset(strm); + + /* all done, no errors */ + return 0; +} + +/* Compress len zeros to output. Return -1 on error, 0 on success. */ +local int gz_zero(state, len) + gz_statep state; + z_off64_t len; +{ + int first; + unsigned n; + z_streamp strm = &(state->strm); + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return -1; + + /* compress len zeros (len guaranteed > 0) */ + first = 1; + while (len) { + n = GT_OFF(state->size) || (z_off64_t)state->size > len ? + (unsigned)len : state->size; + if (first) { + memset(state->in, 0, n); + first = 0; + } + strm->avail_in = n; + strm->next_in = state->in; + state->pos += n; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return -1; + len -= n; + } + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzwrite(file, buf, len) + gzFile file; + voidpc buf; + unsigned len; +{ + unsigned put = len; + unsigned n; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* since an int is returned, make sure len fits in one, otherwise return + with an error (this avoids the flaw in the interface) */ + if ((int)len < 0) { + gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); + return 0; + } + + /* if len is zero, avoid unnecessary operations */ + if (len == 0) + return 0; + + /* allocate memory if this is the first time through */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* for small len, copy to input buffer, otherwise compress directly */ + if (len < state->size) { + /* copy to input buffer, compress when full */ + do { + if (strm->avail_in == 0) + strm->next_in = state->in; + n = state->size - strm->avail_in; + if (n > len) + n = len; + memcpy(strm->next_in + strm->avail_in, buf, n); + strm->avail_in += n; + state->pos += n; + buf = (char *)buf + n; + len -= n; + if (len && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + } while (len); + } + else { + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* directly compress user buffer to file */ + strm->avail_in = len; + strm->next_in = (voidp)buf; + state->pos += len; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + } + + /* input was all buffered or compressed (put will fit in int) */ + return (int)put; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzputc(file, c) + gzFile file; + int c; +{ + unsigned char buf[1]; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return -1; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* try writing to input buffer for speed (state->size == 0 if buffer not + initialized) */ + if (strm->avail_in < state->size) { + if (strm->avail_in == 0) + strm->next_in = state->in; + strm->next_in[strm->avail_in++] = c; + state->pos++; + return c; + } + + /* no room in buffer or not initialized, use gz_write() */ + buf[0] = c; + if (gzwrite(file, buf, 1) != 1) + return -1; + return c; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzputs(file, str) + gzFile file; + const char *str; +{ + int ret; + unsigned len; + + /* write string */ + len = (unsigned)strlen(str); + ret = gzwrite(file, str, len); + return ret == 0 && len != 0 ? -1 : ret; +} + +#ifdef STDC +#include + +/* -- see zlib.h -- */ +int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) +{ + int size, len; + gz_statep state; + z_streamp strm; + va_list va; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* make sure we have some buffer space */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* do the printf() into the input buffer, put length in len */ + size = (int)(state->size); + state->in[size - 1] = 0; + va_start(va, format); +#ifdef NO_vsnprintf +# ifdef HAS_vsprintf_void + (void)vsprintf(state->in, format, va); + va_end(va); + for (len = 0; len < size; len++) + if (state->in[len] == 0) break; +# else + len = vsprintf(state->in, format, va); + va_end(va); +# endif +#else +# ifdef HAS_vsnprintf_void + (void)vsnprintf(state->in, size, format, va); + va_end(va); + len = strlen(state->in); +# else + len = vsnprintf((char *)(state->in), size, format, va); + va_end(va); +# endif +#endif + + /* check that printf() results fit in buffer */ + if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) + return 0; + + /* update buffer and position, defer compression until needed */ + strm->avail_in = (unsigned)len; + strm->next_in = state->in; + state->pos += len; + return len; +} + +#else /* !STDC */ + +/* -- see zlib.h -- */ +int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) + gzFile file; + const char *format; + int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; +{ + int size, len; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* make sure we have some buffer space */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* do the printf() into the input buffer, put length in len */ + size = (int)(state->size); + state->in[size - 1] = 0; +#ifdef NO_snprintf +# ifdef HAS_sprintf_void + sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + for (len = 0; len < size; len++) + if (state->in[len] == 0) break; +# else + len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#else +# ifdef HAS_snprintf_void + snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = strlen(state->in); +# else + len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#endif + + /* check that printf() results fit in buffer */ + if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) + return 0; + + /* update buffer and position, defer compression until needed */ + strm->avail_in = (unsigned)len; + strm->next_in = state->in; + state->pos += len; + return len; +} + +#endif + +/* -- see zlib.h -- */ +int ZEXPORT gzflush(file, flush) + gzFile file; + int flush; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return Z_STREAM_ERROR; + + /* check flush parameter */ + if (flush < 0 || flush > Z_FINISH) + return Z_STREAM_ERROR; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* compress remaining data with requested flush */ + gz_comp(state, flush); + return state->err; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzsetparams(file, level, strategy) + gzFile file; + int level; + int strategy; +{ + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return Z_STREAM_ERROR; + + /* if no change is requested, then do nothing */ + if (level == state->level && strategy == state->strategy) + return Z_OK; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* change compression parameters for subsequent input */ + if (state->size) { + /* flush previous input with previous parameters before changing */ + if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1) + return state->err; + deflateParams(strm, level, strategy); + } + state->level = level; + state->strategy = strategy; + return Z_OK; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzclose_w(file) + gzFile file; +{ + int ret = 0; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + /* check that we're writing */ + if (state->mode != GZ_WRITE) + return Z_STREAM_ERROR; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + ret += gz_zero(state, state->skip); + } + + /* flush, free memory, and close file */ + ret += gz_comp(state, Z_FINISH); + (void)deflateEnd(&(state->strm)); + free(state->out); + free(state->in); + gz_error(state, Z_OK, NULL); + free(state->path); + ret += close(state->fd); + free(state); + return ret ? Z_ERRNO : Z_OK; +} diff --git a/zlib/infback.c b/zlib/infback.c new file mode 100644 index 0000000..af3a8c9 --- /dev/null +++ b/zlib/infback.c @@ -0,0 +1,632 @@ +/* infback.c -- inflate using a call-back interface + * Copyright (C) 1995-2009 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + This code is largely copied from inflate.c. Normally either infback.o or + inflate.o would be linked into an application--not both. The interface + with inffast.c is retained so that optimized assembler-coded versions of + inflate_fast() can be used with either inflate.c or infback.c. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); + +/* + strm provides memory allocation functions in zalloc and zfree, or + Z_NULL to use the library memory allocation functions. + + windowBits is in the range 8..15, and window is a user-supplied + window and output buffer that is 2**windowBits bytes. + */ +int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) +z_streamp strm; +int windowBits; +unsigned char FAR *window; +const char *version; +int stream_size; +{ + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL || window == Z_NULL || + windowBits < 8 || windowBits > 15) + return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *)ZALLOC(strm, 1, + sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->dmax = 32768U; + state->wbits = windowBits; + state->wsize = 1U << windowBits; + state->window = window; + state->wnext = 0; + state->whave = 0; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +/* Macros for inflateBack(): */ + +/* Load returned state from inflate_fast() */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Set state from registers for inflate_fast() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Assure that some input is available. If input is requested, but denied, + then return a Z_BUF_ERROR from inflateBack(). */ +#define PULL() \ + do { \ + if (have == 0) { \ + have = in(in_desc, &next); \ + if (have == 0) { \ + next = Z_NULL; \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflateBack() + with an error if there is no input available. */ +#define PULLBYTE() \ + do { \ + PULL(); \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflateBack() with + an error. */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Assure that some output space is available, by writing out the window + if it's full. If the write fails, return from inflateBack() with a + Z_BUF_ERROR. */ +#define ROOM() \ + do { \ + if (left == 0) { \ + put = state->window; \ + left = state->wsize; \ + state->whave = left; \ + if (out(out_desc, put, left)) { \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* + strm provides the memory allocation functions and window buffer on input, + and provides information on the unused input on return. For Z_DATA_ERROR + returns, strm will also provide an error message. + + in() and out() are the call-back input and output functions. When + inflateBack() needs more input, it calls in(). When inflateBack() has + filled the window with output, or when it completes with data in the + window, it calls out() to write out the data. The application must not + change the provided input until in() is called again or inflateBack() + returns. The application must not change the window/output buffer until + inflateBack() returns. + + in() and out() are called with a descriptor parameter provided in the + inflateBack() call. This parameter can be a structure that provides the + information required to do the read or write, as well as accumulated + information on the input and output such as totals and check values. + + in() should return zero on failure. out() should return non-zero on + failure. If either in() or out() fails, than inflateBack() returns a + Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it + was in() or out() that caused in the error. Otherwise, inflateBack() + returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format + error, or Z_MEM_ERROR if it could not allocate memory for the state. + inflateBack() can also return Z_STREAM_ERROR if the input parameters + are not correct, i.e. strm is Z_NULL or the state was not initialized. + */ +int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) +z_streamp strm; +in_func in; +void FAR *in_desc; +out_func out; +void FAR *out_desc; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code here; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + /* Check that the strm exists and that the state was initialized */ + if (strm == Z_NULL || strm->state == Z_NULL) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* Reset the state */ + strm->msg = Z_NULL; + state->mode = TYPE; + state->last = 0; + state->whave = 0; + next = strm->next_in; + have = next != Z_NULL ? strm->avail_in : 0; + hold = 0; + bits = 0; + put = state->window; + left = state->wsize; + + /* Inflate until end of block marked as last */ + for (;;) + switch (state->mode) { + case TYPE: + /* determine and dispatch block type */ + if (state->last) { + BYTEBITS(); + state->mode = DONE; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN; /* decode codes */ + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + + case STORED: + /* get and verify stored block length */ + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + + /* copy stored block from input to output */ + while (state->length != 0) { + copy = state->length; + PULL(); + ROOM(); + if (copy > have) copy = have; + if (copy > left) copy = left; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + + case TABLE: + /* get dynamic table entries descriptor */ + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + + /* get code length code lengths (not a typo) */ + state->have = 0; + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + + /* get length and distance code code lengths */ + state->have = 0; + while (state->have < state->nlen + state->ndist) { + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.val < 16) { + NEEDBITS(here.bits); + DROPBITS(here.bits); + state->lens[state->have++] = here.val; + } + else { + if (here.val == 16) { + NEEDBITS(here.bits + 2); + DROPBITS(here.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = (unsigned)(state->lens[state->have - 1]); + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (here.val == 17) { + NEEDBITS(here.bits + 3); + DROPBITS(here.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(here.bits + 7); + DROPBITS(here.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* check for end-of-block code (better have one) */ + if (state->lens[256] == 0) { + strm->msg = (char *)"invalid code -- missing end-of-block"; + state->mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; + + case LEN: + /* use inflate_fast() if we have enough input and output */ + if (have >= 6 && left >= 258) { + RESTORE(); + if (state->whave < state->wsize) + state->whave = state->wsize - left; + inflate_fast(strm, state->wsize); + LOAD(); + break; + } + + /* get a literal, length, or end-of-block code */ + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.op && (here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(here.bits); + state->length = (unsigned)here.val; + + /* process literal */ + if (here.op == 0) { + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + ROOM(); + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + } + + /* process end of block */ + if (here.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + + /* invalid code */ + if (here.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + + /* length code -- get extra bits, if any */ + state->extra = (unsigned)(here.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + + /* get distance code */ + for (;;) { + here = state->distcode[BITS(state->distbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if ((here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(here.bits); + if (here.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)here.val; + + /* get distance extra bits, if any */ + state->extra = (unsigned)(here.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + } + if (state->offset > state->wsize - (state->whave < state->wsize ? + left : 0)) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + + /* copy match from window to output */ + do { + ROOM(); + copy = state->wsize - state->offset; + if (copy < left) { + from = put + copy; + copy = left - copy; + } + else { + from = put - state->offset; + copy = left; + } + if (copy > state->length) copy = state->length; + state->length -= copy; + left -= copy; + do { + *put++ = *from++; + } while (--copy); + } while (state->length != 0); + break; + + case DONE: + /* inflate stream terminated properly -- write leftover output */ + ret = Z_STREAM_END; + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left)) + ret = Z_BUF_ERROR; + } + goto inf_leave; + + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + + default: /* can't happen, but makes compilers happy */ + ret = Z_STREAM_ERROR; + goto inf_leave; + } + + /* Return unused input */ + inf_leave: + strm->next_in = next; + strm->avail_in = have; + return ret; +} + +int ZEXPORT inflateBackEnd(strm) +z_streamp strm; +{ + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} diff --git a/zlib/inffast.c b/zlib/inffast.c new file mode 100644 index 0000000..2f1d60b --- /dev/null +++ b/zlib/inffast.c @@ -0,0 +1,340 @@ +/* inffast.c -- fast decoding + * Copyright (C) 1995-2008, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifndef ASMINF + +/* Allow machine dependent optimization for post-increment or pre-increment. + Based on testing to date, + Pre-increment preferred for: + - PowerPC G3 (Adler) + - MIPS R5000 (Randers-Pehrson) + Post-increment preferred for: + - none + No measurable difference: + - Pentium III (Anderson) + - M68060 (Nikl) + */ +#ifdef POSTINC +# define OFF 0 +# define PUP(a) *(a)++ +#else +# define OFF 1 +# define PUP(a) *++(a) +#endif + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state->mode == LEN + strm->avail_in >= 6 + strm->avail_out >= 258 + start >= strm->avail_out + state->bits < 8 + + On return, state->mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm->avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm->avail_out >= 258 for each loop to avoid checking for + output space. + */ +void ZLIB_INTERNAL inflate_fast(strm, start) +z_streamp strm; +unsigned start; /* inflate()'s starting value for strm->avail_out */ +{ + struct inflate_state FAR *state; + unsigned char FAR *in; /* local strm->next_in */ + unsigned char FAR *last; /* while in < last, enough input available */ + unsigned char FAR *out; /* local strm->next_out */ + unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ + unsigned char FAR *end; /* while out < end, enough space available */ +#ifdef INFLATE_STRICT + unsigned dmax; /* maximum distance from zlib header */ +#endif + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned wnext; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ + unsigned long hold; /* local strm->hold */ + unsigned bits; /* local strm->bits */ + code const FAR *lcode; /* local strm->lencode */ + code const FAR *dcode; /* local strm->distcode */ + unsigned lmask; /* mask for first level of length codes */ + unsigned dmask; /* mask for first level of distance codes */ + code here; /* retrieved table entry */ + unsigned op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + unsigned len; /* match length, unused bytes */ + unsigned dist; /* match distance */ + unsigned char FAR *from; /* where to copy match from */ + + /* copy state to local variables */ + state = (struct inflate_state FAR *)strm->state; + in = strm->next_in - OFF; + last = in + (strm->avail_in - 5); + out = strm->next_out - OFF; + beg = out - (start - strm->avail_out); + end = out + (strm->avail_out - 257); +#ifdef INFLATE_STRICT + dmax = state->dmax; +#endif + wsize = state->wsize; + whave = state->whave; + wnext = state->wnext; + window = state->window; + hold = state->hold; + bits = state->bits; + lcode = state->lencode; + dcode = state->distcode; + lmask = (1U << state->lenbits) - 1; + dmask = (1U << state->distbits) - 1; + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + do { + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + here = lcode[hold & lmask]; + dolen: + op = (unsigned)(here.bits); + hold >>= op; + bits -= op; + op = (unsigned)(here.op); + if (op == 0) { /* literal */ + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + PUP(out) = (unsigned char)(here.val); + } + else if (op & 16) { /* length base */ + len = (unsigned)(here.val); + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + len += (unsigned)hold & ((1U << op) - 1); + hold >>= op; + bits -= op; + } + Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + here = dcode[hold & dmask]; + dodist: + op = (unsigned)(here.bits); + hold >>= op; + bits -= op; + op = (unsigned)(here.op); + if (op & 16) { /* distance base */ + dist = (unsigned)(here.val); + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + } + dist += (unsigned)hold & ((1U << op) - 1); +#ifdef INFLATE_STRICT + if (dist > dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + hold >>= op; + bits -= op; + Tracevv((stderr, "inflate: distance %u\n", dist)); + op = (unsigned)(out - beg); /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state->sane) { + strm->msg = + (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + if (len <= op - whave) { + do { + PUP(out) = 0; + } while (--len); + continue; + } + len -= op - whave; + do { + PUP(out) = 0; + } while (--op > whave); + if (op == 0) { + from = out - dist; + do { + PUP(out) = PUP(from); + } while (--len); + continue; + } +#endif + } + from = window - OFF; + if (wnext == 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = window - OFF; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + while (len > 2) { + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + else { + from = out - dist; /* copy direct from output */ + do { /* minimum length is three */ + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } while (len > 2); + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + } + else if ((op & 64) == 0) { /* 2nd level distance code */ + here = dcode[here.val + (hold & ((1U << op) - 1))]; + goto dodist; + } + else { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + } + else if ((op & 64) == 0) { /* 2nd level length code */ + here = lcode[here.val + (hold & ((1U << op) - 1))]; + goto dolen; + } + else if (op & 32) { /* end-of-block */ + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + else { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + } while (in < last && out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + in -= len; + bits -= len << 3; + hold &= (1U << bits) - 1; + + /* update state and return */ + strm->next_in = in + OFF; + strm->next_out = out + OFF; + strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); + strm->avail_out = (unsigned)(out < end ? + 257 + (end - out) : 257 - (out - end)); + state->hold = hold; + state->bits = bits; + return; +} + +/* + inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): + - Using bit fields for code structure + - Different op definition to avoid & for extra bits (do & for table bits) + - Three separate decoding do-loops for direct, window, and wnext == 0 + - Special case for distance > 1 copies to do overlapped load and store copy + - Explicit branch predictions (based on measured branch probabilities) + - Deferring match copy and interspersed it with decoding subsequent codes + - Swapping literal/length else + - Swapping window/direct else + - Larger unrolled copy loops (three is about right) + - Moving len -= 3 statement into middle of loop + */ + +#endif /* !ASMINF */ diff --git a/zlib/inffast.h b/zlib/inffast.h new file mode 100644 index 0000000..e5c1aa4 --- /dev/null +++ b/zlib/inffast.h @@ -0,0 +1,11 @@ +/* inffast.h -- header to use inffast.c + * Copyright (C) 1995-2003, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/zlib/inffixed.h b/zlib/inffixed.h new file mode 100644 index 0000000..75ed4b5 --- /dev/null +++ b/zlib/inffixed.h @@ -0,0 +1,94 @@ + /* inffixed.h -- table for decoding fixed codes + * Generated automatically by makefixed(). + */ + + /* WARNING: this file should *not* be used by applications. It + is part of the implementation of the compression library and + is subject to change. Applications should only use zlib.h. + */ + + static const code lenfix[512] = { + {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, + {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, + {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, + {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, + {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, + {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, + {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, + {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, + {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, + {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, + {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, + {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, + {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, + {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, + {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, + {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, + {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, + {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, + {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, + {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, + {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, + {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, + {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, + {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, + {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, + {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, + {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, + {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, + {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, + {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, + {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, + {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, + {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, + {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, + {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, + {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, + {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, + {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, + {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, + {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, + {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, + {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, + {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, + {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, + {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, + {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, + {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, + {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, + {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, + {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, + {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, + {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, + {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, + {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, + {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, + {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, + {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, + {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, + {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, + {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, + {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, + {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, + {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, + {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, + {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, + {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, + {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, + {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, + {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, + {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, + {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, + {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, + {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, + {0,9,255} + }; + + static const code distfix[32] = { + {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, + {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, + {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, + {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, + {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, + {22,5,193},{64,5,0} + }; diff --git a/zlib/inflate.c b/zlib/inflate.c new file mode 100644 index 0000000..a8431ab --- /dev/null +++ b/zlib/inflate.c @@ -0,0 +1,1480 @@ +/* inflate.c -- zlib decompression + * Copyright (C) 1995-2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * Change history: + * + * 1.2.beta0 24 Nov 2002 + * - First version -- complete rewrite of inflate to simplify code, avoid + * creation of window when not needed, minimize use of window when it is + * needed, make inffast.c even faster, implement gzip decoding, and to + * improve code readability and style over the previous zlib inflate code + * + * 1.2.beta1 25 Nov 2002 + * - Use pointers for available input and output checking in inffast.c + * - Remove input and output counters in inffast.c + * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 + * - Remove unnecessary second byte pull from length extra in inffast.c + * - Unroll direct copy to three copies per loop in inffast.c + * + * 1.2.beta2 4 Dec 2002 + * - Change external routine names to reduce potential conflicts + * - Correct filename to inffixed.h for fixed tables in inflate.c + * - Make hbuf[] unsigned char to match parameter type in inflate.c + * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) + * to avoid negation problem on Alphas (64 bit) in inflate.c + * + * 1.2.beta3 22 Dec 2002 + * - Add comments on state->bits assertion in inffast.c + * - Add comments on op field in inftrees.h + * - Fix bug in reuse of allocated window after inflateReset() + * - Remove bit fields--back to byte structure for speed + * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths + * - Change post-increments to pre-increments in inflate_fast(), PPC biased? + * - Add compile time option, POSTINC, to use post-increments instead (Intel?) + * - Make MATCH copy in inflate() much faster for when inflate_fast() not used + * - Use local copies of stream next and avail values, as well as local bit + * buffer and bit count in inflate()--for speed when inflate_fast() not used + * + * 1.2.beta4 1 Jan 2003 + * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings + * - Move a comment on output buffer sizes from inffast.c to inflate.c + * - Add comments in inffast.c to introduce the inflate_fast() routine + * - Rearrange window copies in inflate_fast() for speed and simplification + * - Unroll last copy for window match in inflate_fast() + * - Use local copies of window variables in inflate_fast() for speed + * - Pull out common wnext == 0 case for speed in inflate_fast() + * - Make op and len in inflate_fast() unsigned for consistency + * - Add FAR to lcode and dcode declarations in inflate_fast() + * - Simplified bad distance check in inflate_fast() + * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new + * source file infback.c to provide a call-back interface to inflate for + * programs like gzip and unzip -- uses window as output buffer to avoid + * window copying + * + * 1.2.beta5 1 Jan 2003 + * - Improved inflateBack() interface to allow the caller to provide initial + * input in strm. + * - Fixed stored blocks bug in inflateBack() + * + * 1.2.beta6 4 Jan 2003 + * - Added comments in inffast.c on effectiveness of POSTINC + * - Typecasting all around to reduce compiler warnings + * - Changed loops from while (1) or do {} while (1) to for (;;), again to + * make compilers happy + * - Changed type of window in inflateBackInit() to unsigned char * + * + * 1.2.beta7 27 Jan 2003 + * - Changed many types to unsigned or unsigned short to avoid warnings + * - Added inflateCopy() function + * + * 1.2.0 9 Mar 2003 + * - Changed inflateBack() interface to provide separate opaque descriptors + * for the in() and out() functions + * - Changed inflateBack() argument and in_func typedef to swap the length + * and buffer address return values for the input function + * - Check next_in and next_out for Z_NULL on entry to inflate() + * + * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifdef MAKEFIXED +# ifndef BUILDFIXED +# define BUILDFIXED +# endif +#endif + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); +local int updatewindow OF((z_streamp strm, unsigned out)); +#ifdef BUILDFIXED + void makefixed OF((void)); +#endif +local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, + unsigned len)); + +int ZEXPORT inflateReset(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + strm->total_in = strm->total_out = state->total = 0; + strm->msg = Z_NULL; + strm->adler = 1; /* to support ill-conceived Java test suite */ + state->mode = HEAD; + state->last = 0; + state->havedict = 0; + state->dmax = 32768U; + state->head = Z_NULL; + state->wsize = 0; + state->whave = 0; + state->wnext = 0; + state->hold = 0; + state->bits = 0; + state->lencode = state->distcode = state->next = state->codes; + state->sane = 1; + state->back = -1; + Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +int ZEXPORT inflateReset2(strm, windowBits) +z_streamp strm; +int windowBits; +{ + int wrap; + struct inflate_state FAR *state; + + /* get the state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; +#ifdef GUNZIP + if (windowBits < 48) + windowBits &= 15; +#endif + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) + return Z_STREAM_ERROR; + if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { + ZFREE(strm, state->window); + state->window = Z_NULL; + } + + /* update state and reset the rest of it */ + state->wrap = wrap; + state->wbits = (unsigned)windowBits; + return inflateReset(strm); +} + +int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) +z_streamp strm; +int windowBits; +const char *version; +int stream_size; +{ + int ret; + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL) return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *) + ZALLOC(strm, 1, sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->window = Z_NULL; + ret = inflateReset2(strm, windowBits); + if (ret != Z_OK) { + ZFREE(strm, state); + strm->state = Z_NULL; + } + return ret; +} + +int ZEXPORT inflateInit_(strm, version, stream_size) +z_streamp strm; +const char *version; +int stream_size; +{ + return inflateInit2_(strm, DEF_WBITS, version, stream_size); +} + +int ZEXPORT inflatePrime(strm, bits, value) +z_streamp strm; +int bits; +int value; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (bits < 0) { + state->hold = 0; + state->bits = 0; + return Z_OK; + } + if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; + value &= (1L << bits) - 1; + state->hold += value << state->bits; + state->bits += bits; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +#ifdef MAKEFIXED +#include + +/* + Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also + defines BUILDFIXED, so the tables are built on the fly. makefixed() writes + those tables to stdout, which would be piped to inffixed.h. A small program + can simply call makefixed to do this: + + void makefixed(void); + + int main(void) + { + makefixed(); + return 0; + } + + Then that can be linked with zlib built with MAKEFIXED defined and run: + + a.out > inffixed.h + */ +void makefixed() +{ + unsigned low, size; + struct inflate_state state; + + fixedtables(&state); + puts(" /* inffixed.h -- table for decoding fixed codes"); + puts(" * Generated automatically by makefixed()."); + puts(" */"); + puts(""); + puts(" /* WARNING: this file should *not* be used by applications."); + puts(" It is part of the implementation of this library and is"); + puts(" subject to change. Applications should only use zlib.h."); + puts(" */"); + puts(""); + size = 1U << 9; + printf(" static const code lenfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 7) == 0) printf("\n "); + printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, + state.lencode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); + size = 1U << 5; + printf("\n static const code distfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 6) == 0) printf("\n "); + printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, + state.distcode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); +} +#endif /* MAKEFIXED */ + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +local int updatewindow(strm, out) +z_streamp strm; +unsigned out; +{ + struct inflate_state FAR *state; + unsigned copy, dist; + + state = (struct inflate_state FAR *)strm->state; + + /* if it hasn't been done already, allocate space for the window */ + if (state->window == Z_NULL) { + state->window = (unsigned char FAR *) + ZALLOC(strm, 1U << state->wbits, + sizeof(unsigned char)); + if (state->window == Z_NULL) return 1; + } + + /* if window not in use yet, initialize */ + if (state->wsize == 0) { + state->wsize = 1U << state->wbits; + state->wnext = 0; + state->whave = 0; + } + + /* copy state->wsize or less output bytes into the circular window */ + copy = out - strm->avail_out; + if (copy >= state->wsize) { + zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); + state->wnext = 0; + state->whave = state->wsize; + } + else { + dist = state->wsize - state->wnext; + if (dist > copy) dist = copy; + zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); + copy -= dist; + if (copy) { + zmemcpy(state->window, strm->next_out - copy, copy); + state->wnext = copy; + state->whave = state->wsize; + } + else { + state->wnext += dist; + if (state->wnext == state->wsize) state->wnext = 0; + if (state->whave < state->wsize) state->whave += dist; + } + } + return 0; +} + +/* Macros for inflate(): */ + +/* check function to use adler32() for zlib or crc32() for gzip */ +#ifdef GUNZIP +# define UPDATE(check, buf, len) \ + (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) +#else +# define UPDATE(check, buf, len) adler32(check, buf, len) +#endif + +/* check macros for header crc */ +#ifdef GUNZIP +# define CRC2(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + check = crc32(check, hbuf, 2); \ + } while (0) + +# define CRC4(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + hbuf[2] = (unsigned char)((word) >> 16); \ + hbuf[3] = (unsigned char)((word) >> 24); \ + check = crc32(check, hbuf, 4); \ + } while (0) +#endif + +/* Load registers with state in inflate() for speed */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Restore state from registers in inflate() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflate() + if there is no input available. */ +#define PULLBYTE() \ + do { \ + if (have == 0) goto inf_leave; \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflate(). */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Reverse the bytes in a 32-bit value */ +#define REVERSE(q) \ + ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + +/* + inflate() uses a state machine to process as much input data and generate as + much output data as possible before returning. The state machine is + structured roughly as follows: + + for (;;) switch (state) { + ... + case STATEn: + if (not enough input data or output space to make progress) + return; + ... make progress ... + state = STATEm; + break; + ... + } + + so when inflate() is called again, the same case is attempted again, and + if the appropriate resources are provided, the machine proceeds to the + next state. The NEEDBITS() macro is usually the way the state evaluates + whether it can proceed or should return. NEEDBITS() does the return if + the requested bits are not available. The typical use of the BITS macros + is: + + NEEDBITS(n); + ... do something with BITS(n) ... + DROPBITS(n); + + where NEEDBITS(n) either returns from inflate() if there isn't enough + input left to load n bits into the accumulator, or it continues. BITS(n) + gives the low n bits in the accumulator. When done, DROPBITS(n) drops + the low n bits off the accumulator. INITBITS() clears the accumulator + and sets the number of available bits to zero. BYTEBITS() discards just + enough bits to put the accumulator on a byte boundary. After BYTEBITS() + and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. + + NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return + if there is no input available. The decoding of variable length codes uses + PULLBYTE() directly in order to pull just enough bytes to decode the next + code, and no more. + + Some states loop until they get enough input, making sure that enough + state information is maintained to continue the loop where it left off + if NEEDBITS() returns in the loop. For example, want, need, and keep + would all have to actually be part of the saved state in case NEEDBITS() + returns: + + case STATEw: + while (want < need) { + NEEDBITS(n); + keep[want++] = BITS(n); + DROPBITS(n); + } + state = STATEx; + case STATEx: + + As shown above, if the next state is also the next case, then the break + is omitted. + + A state may also return if there is not enough output space available to + complete that state. Those states are copying stored data, writing a + literal byte, and copying a matching string. + + When returning, a "goto inf_leave" is used to update the total counters, + update the check value, and determine whether any progress has been made + during that inflate() call in order to return the proper return code. + Progress is defined as a change in either strm->avail_in or strm->avail_out. + When there is a window, goto inf_leave will update the window with the last + output written. If a goto inf_leave occurs in the middle of decompression + and there is no window currently, goto inf_leave will create one and copy + output to the window for the next call of inflate(). + + In this implementation, the flush parameter of inflate() only affects the + return code (per zlib.h). inflate() always writes as much as possible to + strm->next_out, given the space available and the provided input--the effect + documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers + the allocation of and copying into a sliding window until necessary, which + provides the effect documented in zlib.h for Z_FINISH when the entire input + stream available. So the only thing the flush parameter actually does is: + when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it + will return Z_BUF_ERROR if it has not reached the end of the stream. + */ + +int ZEXPORT inflate(strm, flush) +z_streamp strm; +int flush; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned in, out; /* save starting available input and output */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code here; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ +#ifdef GUNZIP + unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ +#endif + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0)) + return Z_STREAM_ERROR; + + state = (struct inflate_state FAR *)strm->state; + if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ + LOAD(); + in = have; + out = left; + ret = Z_OK; + for (;;) + switch (state->mode) { + case HEAD: + if (state->wrap == 0) { + state->mode = TYPEDO; + break; + } + NEEDBITS(16); +#ifdef GUNZIP + if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ + state->check = crc32(0L, Z_NULL, 0); + CRC2(state->check, hold); + INITBITS(); + state->mode = FLAGS; + break; + } + state->flags = 0; /* expect zlib header */ + if (state->head != Z_NULL) + state->head->done = -1; + if (!(state->wrap & 1) || /* check if zlib header allowed */ +#else + if ( +#endif + ((BITS(8) << 8) + (hold >> 8)) % 31) { + strm->msg = (char *)"incorrect header check"; + state->mode = BAD; + break; + } + if (BITS(4) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + DROPBITS(4); + len = BITS(4) + 8; + if (state->wbits == 0) + state->wbits = len; + else if (len > state->wbits) { + strm->msg = (char *)"invalid window size"; + state->mode = BAD; + break; + } + state->dmax = 1U << len; + Tracev((stderr, "inflate: zlib header ok\n")); + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = hold & 0x200 ? DICTID : TYPE; + INITBITS(); + break; +#ifdef GUNZIP + case FLAGS: + NEEDBITS(16); + state->flags = (int)(hold); + if ((state->flags & 0xff) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + if (state->flags & 0xe000) { + strm->msg = (char *)"unknown header flags set"; + state->mode = BAD; + break; + } + if (state->head != Z_NULL) + state->head->text = (int)((hold >> 8) & 1); + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = TIME; + case TIME: + NEEDBITS(32); + if (state->head != Z_NULL) + state->head->time = hold; + if (state->flags & 0x0200) CRC4(state->check, hold); + INITBITS(); + state->mode = OS; + case OS: + NEEDBITS(16); + if (state->head != Z_NULL) { + state->head->xflags = (int)(hold & 0xff); + state->head->os = (int)(hold >> 8); + } + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = EXLEN; + case EXLEN: + if (state->flags & 0x0400) { + NEEDBITS(16); + state->length = (unsigned)(hold); + if (state->head != Z_NULL) + state->head->extra_len = (unsigned)hold; + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + } + else if (state->head != Z_NULL) + state->head->extra = Z_NULL; + state->mode = EXTRA; + case EXTRA: + if (state->flags & 0x0400) { + copy = state->length; + if (copy > have) copy = have; + if (copy) { + if (state->head != Z_NULL && + state->head->extra != Z_NULL) { + len = state->head->extra_len - state->length; + zmemcpy(state->head->extra + len, next, + len + copy > state->head->extra_max ? + state->head->extra_max - len : copy); + } + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + state->length -= copy; + } + if (state->length) goto inf_leave; + } + state->length = 0; + state->mode = NAME; + case NAME: + if (state->flags & 0x0800) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->name != Z_NULL && + state->length < state->head->name_max) + state->head->name[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->name = Z_NULL; + state->length = 0; + state->mode = COMMENT; + case COMMENT: + if (state->flags & 0x1000) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->comment != Z_NULL && + state->length < state->head->comm_max) + state->head->comment[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->comment = Z_NULL; + state->mode = HCRC; + case HCRC: + if (state->flags & 0x0200) { + NEEDBITS(16); + if (hold != (state->check & 0xffff)) { + strm->msg = (char *)"header crc mismatch"; + state->mode = BAD; + break; + } + INITBITS(); + } + if (state->head != Z_NULL) { + state->head->hcrc = (int)((state->flags >> 9) & 1); + state->head->done = 1; + } + strm->adler = state->check = crc32(0L, Z_NULL, 0); + state->mode = TYPE; + break; +#endif + case DICTID: + NEEDBITS(32); + strm->adler = state->check = REVERSE(hold); + INITBITS(); + state->mode = DICT; + case DICT: + if (state->havedict == 0) { + RESTORE(); + return Z_NEED_DICT; + } + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = TYPE; + case TYPE: + if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; + case TYPEDO: + if (state->last) { + BYTEBITS(); + state->mode = CHECK; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN_; /* decode codes */ + if (flush == Z_TREES) { + DROPBITS(2); + goto inf_leave; + } + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + case STORED: + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + state->mode = COPY_; + if (flush == Z_TREES) goto inf_leave; + case COPY_: + state->mode = COPY; + case COPY: + copy = state->length; + if (copy) { + if (copy > have) copy = have; + if (copy > left) copy = left; + if (copy == 0) goto inf_leave; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + break; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + case TABLE: + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + state->have = 0; + state->mode = LENLENS; + case LENLENS: + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + state->have = 0; + state->mode = CODELENS; + case CODELENS: + while (state->have < state->nlen + state->ndist) { + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.val < 16) { + NEEDBITS(here.bits); + DROPBITS(here.bits); + state->lens[state->have++] = here.val; + } + else { + if (here.val == 16) { + NEEDBITS(here.bits + 2); + DROPBITS(here.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = state->lens[state->have - 1]; + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (here.val == 17) { + NEEDBITS(here.bits + 3); + DROPBITS(here.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(here.bits + 7); + DROPBITS(here.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* check for end-of-block code (better have one) */ + if (state->lens[256] == 0) { + strm->msg = (char *)"invalid code -- missing end-of-block"; + state->mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN_; + if (flush == Z_TREES) goto inf_leave; + case LEN_: + state->mode = LEN; + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); + inflate_fast(strm, out); + LOAD(); + if (state->mode == TYPE) + state->back = -1; + break; + } + state->back = 0; + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.op && (here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + state->back += last.bits; + } + DROPBITS(here.bits); + state->back += here.bits; + state->length = (unsigned)here.val; + if ((int)(here.op) == 0) { + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + state->mode = LIT; + break; + } + if (here.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->back = -1; + state->mode = TYPE; + break; + } + if (here.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + state->extra = (unsigned)(here.op) & 15; + state->mode = LENEXT; + case LENEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + state->back += state->extra; + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + state->was = state->length; + state->mode = DIST; + case DIST: + for (;;) { + here = state->distcode[BITS(state->distbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if ((here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + state->back += last.bits; + } + DROPBITS(here.bits); + state->back += here.bits; + if (here.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)here.val; + state->extra = (unsigned)(here.op) & 15; + state->mode = DISTEXT; + case DISTEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + state->back += state->extra; + } +#ifdef INFLATE_STRICT + if (state->offset > state->dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + state->mode = MATCH; + case MATCH: + if (left == 0) goto inf_leave; + copy = out - left; + if (state->offset > copy) { /* copy from window */ + copy = state->offset - copy; + if (copy > state->whave) { + if (state->sane) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + Trace((stderr, "inflate.c too far\n")); + copy -= state->whave; + if (copy > state->length) copy = state->length; + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = 0; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; +#endif + } + if (copy > state->wnext) { + copy -= state->wnext; + from = state->window + (state->wsize - copy); + } + else + from = state->window + (state->wnext - copy); + if (copy > state->length) copy = state->length; + } + else { /* copy from output */ + from = put - state->offset; + copy = state->length; + } + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = *from++; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; + case LIT: + if (left == 0) goto inf_leave; + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + case CHECK: + if (state->wrap) { + NEEDBITS(32); + out -= left; + strm->total_out += out; + state->total += out; + if (out) + strm->adler = state->check = + UPDATE(state->check, put - out, out); + out = left; + if (( +#ifdef GUNZIP + state->flags ? hold : +#endif + REVERSE(hold)) != state->check) { + strm->msg = (char *)"incorrect data check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: check matches trailer\n")); + } +#ifdef GUNZIP + state->mode = LENGTH; + case LENGTH: + if (state->wrap && state->flags) { + NEEDBITS(32); + if (hold != (state->total & 0xffffffffUL)) { + strm->msg = (char *)"incorrect length check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: length matches trailer\n")); + } +#endif + state->mode = DONE; + case DONE: + ret = Z_STREAM_END; + goto inf_leave; + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + default: + return Z_STREAM_ERROR; + } + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + inf_leave: + RESTORE(); + if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) + if (updatewindow(strm, out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + in -= strm->avail_in; + out -= strm->avail_out; + strm->total_in += in; + strm->total_out += out; + state->total += out; + if (state->wrap && out) + strm->adler = state->check = + UPDATE(state->check, strm->next_out - out, out); + strm->data_type = state->bits + (state->last ? 64 : 0) + + (state->mode == TYPE ? 128 : 0) + + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); + if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) + ret = Z_BUF_ERROR; + return ret; +} + +int ZEXPORT inflateEnd(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->window != Z_NULL) ZFREE(strm, state->window); + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} + +int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) +z_streamp strm; +const Bytef *dictionary; +uInt dictLength; +{ + struct inflate_state FAR *state; + unsigned long id; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->wrap != 0 && state->mode != DICT) + return Z_STREAM_ERROR; + + /* check for correct dictionary id */ + if (state->mode == DICT) { + id = adler32(0L, Z_NULL, 0); + id = adler32(id, dictionary, dictLength); + if (id != state->check) + return Z_DATA_ERROR; + } + + /* copy dictionary to window */ + if (updatewindow(strm, strm->avail_out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + if (dictLength > state->wsize) { + zmemcpy(state->window, dictionary + dictLength - state->wsize, + state->wsize); + state->whave = state->wsize; + } + else { + zmemcpy(state->window + state->wsize - dictLength, dictionary, + dictLength); + state->whave = dictLength; + } + state->havedict = 1; + Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +int ZEXPORT inflateGetHeader(strm, head) +z_streamp strm; +gz_headerp head; +{ + struct inflate_state FAR *state; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; + + /* save header structure */ + state->head = head; + head->done = 0; + return Z_OK; +} + +/* + Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found + or when out of input. When called, *have is the number of pattern bytes + found in order so far, in 0..3. On return *have is updated to the new + state. If on return *have equals four, then the pattern was found and the + return value is how many bytes were read including the last byte of the + pattern. If *have is less than four, then the pattern has not been found + yet and the return value is len. In the latter case, syncsearch() can be + called again with more data and the *have state. *have is initialized to + zero for the first call. + */ +local unsigned syncsearch(have, buf, len) +unsigned FAR *have; +unsigned char FAR *buf; +unsigned len; +{ + unsigned got; + unsigned next; + + got = *have; + next = 0; + while (next < len && got < 4) { + if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) + got++; + else if (buf[next]) + got = 0; + else + got = 4 - got; + next++; + } + *have = got; + return next; +} + +int ZEXPORT inflateSync(strm) +z_streamp strm; +{ + unsigned len; /* number of bytes to look at or looked at */ + unsigned long in, out; /* temporary to save total_in and total_out */ + unsigned char buf[4]; /* to restore bit buffer to byte string */ + struct inflate_state FAR *state; + + /* check parameters */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; + + /* if first time, start search in bit buffer */ + if (state->mode != SYNC) { + state->mode = SYNC; + state->hold <<= state->bits & 7; + state->bits -= state->bits & 7; + len = 0; + while (state->bits >= 8) { + buf[len++] = (unsigned char)(state->hold); + state->hold >>= 8; + state->bits -= 8; + } + state->have = 0; + syncsearch(&(state->have), buf, len); + } + + /* search available input */ + len = syncsearch(&(state->have), strm->next_in, strm->avail_in); + strm->avail_in -= len; + strm->next_in += len; + strm->total_in += len; + + /* return no joy or set up to restart inflate() on a new block */ + if (state->have != 4) return Z_DATA_ERROR; + in = strm->total_in; out = strm->total_out; + inflateReset(strm); + strm->total_in = in; strm->total_out = out; + state->mode = TYPE; + return Z_OK; +} + +/* + Returns true if inflate is currently at the end of a block generated by + Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP + implementation to provide an additional safety check. PPP uses + Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored + block. When decompressing, PPP checks that at the end of input packet, + inflate is waiting for these length bytes. + */ +int ZEXPORT inflateSyncPoint(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + return state->mode == STORED && state->bits == 0; +} + +int ZEXPORT inflateCopy(dest, source) +z_streamp dest; +z_streamp source; +{ + struct inflate_state FAR *state; + struct inflate_state FAR *copy; + unsigned char FAR *window; + unsigned wsize; + + /* check input */ + if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || + source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)source->state; + + /* allocate space */ + copy = (struct inflate_state FAR *) + ZALLOC(source, 1, sizeof(struct inflate_state)); + if (copy == Z_NULL) return Z_MEM_ERROR; + window = Z_NULL; + if (state->window != Z_NULL) { + window = (unsigned char FAR *) + ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); + if (window == Z_NULL) { + ZFREE(source, copy); + return Z_MEM_ERROR; + } + } + + /* copy state */ + zmemcpy(dest, source, sizeof(z_stream)); + zmemcpy(copy, state, sizeof(struct inflate_state)); + if (state->lencode >= state->codes && + state->lencode <= state->codes + ENOUGH - 1) { + copy->lencode = copy->codes + (state->lencode - state->codes); + copy->distcode = copy->codes + (state->distcode - state->codes); + } + copy->next = copy->codes + (state->next - state->codes); + if (window != Z_NULL) { + wsize = 1U << state->wbits; + zmemcpy(window, state->window, wsize); + } + copy->window = window; + dest->state = (struct internal_state FAR *)copy; + return Z_OK; +} + +int ZEXPORT inflateUndermine(strm, subvert) +z_streamp strm; +int subvert; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + state->sane = !subvert; +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + return Z_OK; +#else + state->sane = 1; + return Z_DATA_ERROR; +#endif +} + +long ZEXPORT inflateMark(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; + state = (struct inflate_state FAR *)strm->state; + return ((long)(state->back) << 16) + + (state->mode == COPY ? state->length : + (state->mode == MATCH ? state->was - state->length : 0)); +} diff --git a/zlib/inflate.h b/zlib/inflate.h new file mode 100644 index 0000000..95f4986 --- /dev/null +++ b/zlib/inflate.h @@ -0,0 +1,122 @@ +/* inflate.h -- internal inflate state definition + * Copyright (C) 1995-2009 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer decoding by inflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip decoding + should be left enabled. */ +#ifndef NO_GZIP +# define GUNZIP +#endif + +/* Possible inflate modes between inflate() calls */ +typedef enum { + HEAD, /* i: waiting for magic header */ + FLAGS, /* i: waiting for method and flags (gzip) */ + TIME, /* i: waiting for modification time (gzip) */ + OS, /* i: waiting for extra flags and operating system (gzip) */ + EXLEN, /* i: waiting for extra length (gzip) */ + EXTRA, /* i: waiting for extra bytes (gzip) */ + NAME, /* i: waiting for end of file name (gzip) */ + COMMENT, /* i: waiting for end of comment (gzip) */ + HCRC, /* i: waiting for header crc (gzip) */ + DICTID, /* i: waiting for dictionary check value */ + DICT, /* waiting for inflateSetDictionary() call */ + TYPE, /* i: waiting for type bits, including last-flag bit */ + TYPEDO, /* i: same, but skip check to exit inflate on new block */ + STORED, /* i: waiting for stored size (length and complement) */ + COPY_, /* i/o: same as COPY below, but only first time in */ + COPY, /* i/o: waiting for input or output to copy stored block */ + TABLE, /* i: waiting for dynamic block table lengths */ + LENLENS, /* i: waiting for code length code lengths */ + CODELENS, /* i: waiting for length/lit and distance code lengths */ + LEN_, /* i: same as LEN below, but only first time in */ + LEN, /* i: waiting for length/lit/eob code */ + LENEXT, /* i: waiting for length extra bits */ + DIST, /* i: waiting for distance code */ + DISTEXT, /* i: waiting for distance extra bits */ + MATCH, /* o: waiting for output space to copy string */ + LIT, /* o: waiting for output space to write literal */ + CHECK, /* i: waiting for 32-bit check value */ + LENGTH, /* i: waiting for 32-bit length (gzip) */ + DONE, /* finished check, done -- remain here until reset */ + BAD, /* got a data error -- remain here until reset */ + MEM, /* got an inflate() memory error -- remain here until reset */ + SYNC /* looking for synchronization bytes to restart inflate() */ +} inflate_mode; + +/* + State transitions between above modes - + + (most modes can go to BAD or MEM on error -- not shown for clarity) + + Process header: + HEAD -> (gzip) or (zlib) or (raw) + (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> + HCRC -> TYPE + (zlib) -> DICTID or TYPE + DICTID -> DICT -> TYPE + (raw) -> TYPEDO + Read deflate blocks: + TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK + STORED -> COPY_ -> COPY -> TYPE + TABLE -> LENLENS -> CODELENS -> LEN_ + LEN_ -> LEN + Read deflate codes in fixed or dynamic block: + LEN -> LENEXT or LIT or TYPE + LENEXT -> DIST -> DISTEXT -> MATCH -> LEN + LIT -> LEN + Process trailer: + CHECK -> LENGTH -> DONE + */ + +/* state maintained between inflate() calls. Approximately 10K bytes. */ +struct inflate_state { + inflate_mode mode; /* current inflate mode */ + int last; /* true if processing last block */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + int havedict; /* true if dictionary provided */ + int flags; /* gzip header method and flags (0 if zlib) */ + unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ + unsigned long check; /* protected copy of check value */ + unsigned long total; /* protected copy of output count */ + gz_headerp head; /* where to save gzip header information */ + /* sliding window */ + unsigned wbits; /* log base 2 of requested window size */ + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned wnext; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if needed */ + /* bit accumulator */ + unsigned long hold; /* input bit accumulator */ + unsigned bits; /* number of bits in "in" */ + /* for string and stored block copying */ + unsigned length; /* literal or length of data to copy */ + unsigned offset; /* distance back to copy string from */ + /* for table and code decoding */ + unsigned extra; /* extra bits needed */ + /* fixed and dynamic code tables */ + code const FAR *lencode; /* starting table for length/literal codes */ + code const FAR *distcode; /* starting table for distance codes */ + unsigned lenbits; /* index bits for lencode */ + unsigned distbits; /* index bits for distcode */ + /* dynamic table building */ + unsigned ncode; /* number of code length code lengths */ + unsigned nlen; /* number of length code lengths */ + unsigned ndist; /* number of distance code lengths */ + unsigned have; /* number of code lengths in lens[] */ + code FAR *next; /* next available space in codes[] */ + unsigned short lens[320]; /* temporary storage for code lengths */ + unsigned short work[288]; /* work area for code table building */ + code codes[ENOUGH]; /* space for code tables */ + int sane; /* if false, allow invalid distance too far */ + int back; /* bits back of last unprocessed length/lit */ + unsigned was; /* initial length of match */ +}; diff --git a/zlib/inftrees.c b/zlib/inftrees.c new file mode 100644 index 0000000..11e9c52 --- /dev/null +++ b/zlib/inftrees.c @@ -0,0 +1,330 @@ +/* inftrees.c -- generate Huffman trees for efficient decoding + * Copyright (C) 1995-2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" + +#define MAXBITS 15 + +const char inflate_copyright[] = + " inflate 1.2.5 Copyright 1995-2010 Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* + Build a set of tables to decode the provided canonical Huffman code. + The code lengths are lens[0..codes-1]. The result starts at *table, + whose indices are 0..2^bits-1. work is a writable array of at least + lens shorts, which is used as a work area. type is the type of code + to be generated, CODES, LENS, or DISTS. On return, zero is success, + -1 is an invalid code, and +1 means that ENOUGH isn't enough. table + on return points to the next available entry's address. bits is the + requested root table index bits, and on return it is the actual root + table index bits. It will differ if the request is greater than the + longest code or if it is less than the shortest code. + */ +int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) +codetype type; +unsigned short FAR *lens; +unsigned codes; +code FAR * FAR *table; +unsigned FAR *bits; +unsigned short FAR *work; +{ + unsigned len; /* a code's length in bits */ + unsigned sym; /* index of code symbols */ + unsigned min, max; /* minimum and maximum code lengths */ + unsigned root; /* number of index bits for root table */ + unsigned curr; /* number of index bits for current table */ + unsigned drop; /* code bits to drop for sub-table */ + int left; /* number of prefix codes available */ + unsigned used; /* code entries in table used */ + unsigned huff; /* Huffman code */ + unsigned incr; /* for incrementing code, index */ + unsigned fill; /* index for replicating entries */ + unsigned low; /* low bits for current root entry */ + unsigned mask; /* mask for low root bits */ + code here; /* table entry for duplication */ + code FAR *next; /* next available space in table */ + const unsigned short FAR *base; /* base value table to use */ + const unsigned short FAR *extra; /* extra bits table to use */ + int end; /* use base and extra for symbol > end */ + unsigned short count[MAXBITS+1]; /* number of codes of each length */ + unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ + static const unsigned short lbase[31] = { /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + static const unsigned short lext[31] = { /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195}; + static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0}; + static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64}; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) + count[len] = 0; + for (sym = 0; sym < codes; sym++) + count[lens[sym]]++; + + /* bound code lengths, force root to be within code lengths */ + root = *bits; + for (max = MAXBITS; max >= 1; max--) + if (count[max] != 0) break; + if (root > max) root = max; + if (max == 0) { /* no symbols to code at all */ + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)1; + here.val = (unsigned short)0; + *(*table)++ = here; /* make a table to force an error */ + *(*table)++ = here; + *bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) + if (count[min] != 0) break; + if (root < min) root = min; + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) return -1; /* over-subscribed */ + } + if (left > 0 && (type == CODES || max != 1)) + return -1; /* incomplete set */ + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) + offs[len + 1] = offs[len] + count[len]; + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) + if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + switch (type) { + case CODES: + base = extra = work; /* dummy value--not used */ + end = 19; + break; + case LENS: + base = lbase; + base -= 257; + extra = lext; + extra -= 257; + end = 256; + break; + default: /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize state for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = *table; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = (unsigned)(-1); /* trigger new sub-table when len > root */ + used = 1U << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type == LENS && used >= ENOUGH_LENS) || + (type == DISTS && used >= ENOUGH_DISTS)) + return 1; + + /* process all codes and make table entries */ + for (;;) { + /* create table entry */ + here.bits = (unsigned char)(len - drop); + if ((int)(work[sym]) < end) { + here.op = (unsigned char)0; + here.val = work[sym]; + } + else if ((int)(work[sym]) > end) { + here.op = (unsigned char)(extra[work[sym]]); + here.val = base[work[sym]]; + } + else { + here.op = (unsigned char)(32 + 64); /* end of block */ + here.val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1U << (len - drop); + fill = 1U << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + next[(huff >> drop) + fill] = here; + } while (fill != 0); + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + + /* go to next symbol, update count, len */ + sym++; + if (--(count[len]) == 0) { + if (len == max) break; + len = lens[work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) != low) { + /* if first time, transition to sub-tables */ + if (drop == 0) + drop = root; + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = (int)(1 << curr); + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) break; + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1U << curr; + if ((type == LENS && used >= ENOUGH_LENS) || + (type == DISTS && used >= ENOUGH_DISTS)) + return 1; + + /* point entry in root table to sub-table */ + low = huff & mask; + (*table)[low].op = (unsigned char)curr; + (*table)[low].bits = (unsigned char)root; + (*table)[low].val = (unsigned short)(next - *table); + } + } + + /* + Fill in rest of table for incomplete codes. This loop is similar to the + loop above in incrementing huff for table indices. It is assumed that + len is equal to curr + drop, so there is no loop needed to increment + through high index bits. When the current sub-table is filled, the loop + drops back to the root table to fill in any remaining entries there. + */ + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)(len - drop); + here.val = (unsigned short)0; + while (huff != 0) { + /* when done with sub-table, drop back to root table */ + if (drop != 0 && (huff & mask) != low) { + drop = 0; + len = root; + next = *table; + here.bits = (unsigned char)len; + } + + /* put invalid code marker in table */ + next[huff >> drop] = here; + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + } + + /* set return parameters */ + *table += used; + *bits = root; + return 0; +} diff --git a/zlib/inftrees.h b/zlib/inftrees.h new file mode 100644 index 0000000..baa53a0 --- /dev/null +++ b/zlib/inftrees.h @@ -0,0 +1,62 @@ +/* inftrees.h -- header to use inftrees.c + * Copyright (C) 1995-2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* Structure for decoding tables. Each entry provides either the + information needed to do the operation requested by the code that + indexed that table entry, or it provides a pointer to another + table that indexes more bits of the code. op indicates whether + the entry is a pointer to another table, a literal, a length or + distance, an end-of-block, or an invalid code. For a table + pointer, the low four bits of op is the number of index bits of + that table. For a length or distance, the low four bits of op + is the number of extra bits to get after the code. bits is + the number of bits in this code or part of the code to drop off + of the bit buffer. val is the actual byte to output in the case + of a literal, the base length or distance, or the offset from + the current table to the next table. Each entry is four bytes. */ +typedef struct { + unsigned char op; /* operation, extra bits, table bits */ + unsigned char bits; /* bits in this part of the code */ + unsigned short val; /* offset in table or code value */ +} code; + +/* op values as set by inflate_table(): + 00000000 - literal + 0000tttt - table link, tttt != 0 is the number of table index bits + 0001eeee - length or distance, eeee is the number of extra bits + 01100000 - end of block + 01000000 - invalid code + */ + +/* Maximum size of the dynamic table. The maximum number of code structures is + 1444, which is the sum of 852 for literal/length codes and 592 for distance + codes. These values were found by exhaustive searches using the program + examples/enough.c found in the zlib distribtution. The arguments to that + program are the number of symbols, the initial root table size, and the + maximum bit length of a code. "enough 286 9 15" for literal/length codes + returns returns 852, and "enough 30 6 15" for distance codes returns 592. + The initial root table size (9 or 6) is found in the fifth argument of the + inflate_table() calls in inflate.c and infback.c. If the root table size is + changed, then these maximum sizes would be need to be recalculated and + updated. */ +#define ENOUGH_LENS 852 +#define ENOUGH_DISTS 592 +#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) + +/* Type of code to build for inflate_table() */ +typedef enum { + CODES, + LENS, + DISTS +} codetype; + +int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work)); diff --git a/zlib/make_vms.com b/zlib/make_vms.com new file mode 100644 index 0000000..6576490 --- /dev/null +++ b/zlib/make_vms.com @@ -0,0 +1,804 @@ +$! make libz under VMS written by +$! Martin P.J. Zinser +$! +$! In case of problems with the install you might contact me at +$! zinser@zinser.no-ip.info(preferred) or +$! zinser@sysdev.deutsche-boerse.com (work) +$! +$! Make procedure history for Zlib +$! +$!------------------------------------------------------------------------------ +$! Version history +$! 0.01 20060120 First version to receive a number +$! 0.02 20061008 Adapt to new Makefile.in +$! 0.03 20091224 Add support for large file check +$! 0.04 20100110 Add new gzclose, gzlib, gzread, gzwrite +$! 0.05 20100221 Exchange zlibdefs.h by zconf.h.in +$! +$ on error then goto err_exit +$ set proc/parse=ext +$! +$ true = 1 +$ false = 0 +$ tmpnam = "temp_" + f$getjpi("","pid") +$ tt = tmpnam + ".txt" +$ tc = tmpnam + ".c" +$ th = tmpnam + ".h" +$ define/nolog tconfig 'th' +$ its_decc = false +$ its_vaxc = false +$ its_gnuc = false +$ s_case = False +$! +$! Setup variables holding "config" information +$! +$ Make = "" +$ name = "Zlib" +$ version = "?.?.?" +$ v_string = "ZLIB_VERSION" +$ v_file = "zlib.h" +$ ccopt = "" +$ lopts = "" +$ dnsrl = "" +$ aconf_in_file = "zconf.h.in#zconf.h_in" +$ conf_check_string = "" +$ linkonly = false +$ optfile = name + ".opt" +$ libdefs = "" +$ axp = f$getsyi("HW_MODEL").ge.1024 .and. f$getsyi("HW_MODEL").lt.4096 +$! +$ whoami = f$parse(f$enviornment("Procedure"),,,,"NO_CONCEAL") +$ mydef = F$parse(whoami,,,"DEVICE") +$ mydir = f$parse(whoami,,,"DIRECTORY") - "][" +$ myproc = f$parse(whoami,,,"Name") + f$parse(whoami,,,"type") +$! +$! Check for MMK/MMS +$! +$ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS" +$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK" +$! +$! +$ gosub find_version +$! +$ open/write topt tmp.opt +$ open/write optf 'optfile' +$! +$ gosub check_opts +$! +$! Look for the compiler used +$! +$ gosub check_compiler +$ close topt +$! +$ if its_decc +$ then +$ ccopt = "/prefix=all" + ccopt +$ if f$trnlnm("SYS") .eqs. "" +$ then +$ if axp +$ then +$ define sys sys$library: +$ else +$ ccopt = "/decc" + ccopt +$ define sys decc$library_include: +$ endif +$ endif +$ endif +$ if its_vaxc .or. its_gnuc +$ then +$ if f$trnlnm("SYS").eqs."" then define sys sys$library: +$ endif +$! +$! Build a fake configure input header +$! +$ open/write conf_hin config.hin +$ write conf_hin "#undef _LARGEFILE64_SOURCE" +$ close conf_hin +$! +$! +$ i = 0 +$FIND_ACONF: +$ fname = f$element(i,"#",aconf_in_file) +$ if fname .eqs. "#" then goto AMISS_ERR +$ if f$search(fname) .eqs. "" +$ then +$ i = i + 1 +$ goto find_aconf +$ endif +$ open/read/err=aconf_err aconf_in 'fname' +$ open/write aconf zconf.h +$ACONF_LOOP: +$ read/end_of_file=aconf_exit aconf_in line +$ work = f$edit(line, "compress,trim") +$ if f$extract(0,6,work) .nes. "#undef" +$ then +$ if f$extract(0,12,work) .nes. "#cmakedefine" +$ then +$ write aconf line +$ endif +$ else +$ cdef = f$element(1," ",work) +$ gosub check_config +$ endif +$ goto aconf_loop +$ACONF_EXIT: +$ write aconf "#define VMS 1" +$ write aconf "#include " +$ write aconf "#include " +$ write aconf "#ifdef _LARGEFILE" +$ write aconf "#define off64_t __off64_t" +$ write aconf "#define fopen64 fopen" +$ write aconf "#define fseeko64 fseeko" +$ write aconf "#define lseek64 lseek" +$ write aconf "#define ftello64 ftell" +$ write aconf "#endif" +$ close aconf_in +$ close aconf +$ if f$search("''th'") .nes. "" then delete 'th';* +$! Build the thing plain or with mms +$! +$ write sys$output "Compiling Zlib sources ..." +$ if make.eqs."" +$ then +$ dele example.obj;*,minigzip.obj;* +$ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" - + adler32.c zlib.h zconf.h +$ CALL MAKE compress.OBJ "CC ''CCOPT' compress" - + compress.c zlib.h zconf.h +$ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" - + crc32.c zlib.h zconf.h +$ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" - + deflate.c deflate.h zutil.h zlib.h zconf.h +$ CALL MAKE gzclose.OBJ "CC ''CCOPT' gzclose" - + gzclose.c zutil.h zlib.h zconf.h +$ CALL MAKE gzlib.OBJ "CC ''CCOPT' gzlib" - + gzlib.c zutil.h zlib.h zconf.h +$ CALL MAKE gzread.OBJ "CC ''CCOPT' gzread" - + gzread.c zutil.h zlib.h zconf.h +$ CALL MAKE gzwrite.OBJ "CC ''CCOPT' gzwrite" - + gzwrite.c zutil.h zlib.h zconf.h +$ CALL MAKE infback.OBJ "CC ''CCOPT' infback" - + infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h +$ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" - + inffast.c zutil.h zlib.h zconf.h inffast.h +$ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" - + inflate.c zutil.h zlib.h zconf.h infblock.h +$ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" - + inftrees.c zutil.h zlib.h zconf.h inftrees.h +$ CALL MAKE trees.OBJ "CC ''CCOPT' trees" - + trees.c deflate.h zutil.h zlib.h zconf.h +$ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" - + uncompr.c zlib.h zconf.h +$ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" - + zutil.c zutil.h zlib.h zconf.h +$ write sys$output "Building Zlib ..." +$ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ +$ write sys$output "Building example..." +$ CALL MAKE example.OBJ "CC ''CCOPT' example" - + example.c zlib.h zconf.h +$ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb +$ if f$search("x11vms:xvmsutils.olb") .nes. "" +$ then +$ write sys$output "Building minigzip..." +$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" - + minigzip.c zlib.h zconf.h +$ call make minigzip.exe - + "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" - + minigzip.obj libz.olb +$ endif +$ else +$ gosub crea_mms +$ write sys$output "Make ''name' ''version' with ''Make' " +$ 'make' +$ endif +$! +$! Alpha gets a shareable image +$! +$ If axp +$ Then +$ gosub crea_olist +$ write sys$output "Creating libzshr.exe" +$ call anal_obj_axp modules.opt _link.opt +$ if s_case +$ then +$ open/append optf modules.opt +$ write optf "case_sensitive=YES" +$ close optf +$ endif +$ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,_link.opt/opt +$ endif +$ write sys$output "Zlib build completed" +$ exit +$CC_ERR: +$ write sys$output "C compiler required to build ''name'" +$ goto err_exit +$ERR_EXIT: +$ set message/facil/ident/sever/text +$ close/nolog optf +$ close/nolog topt +$ close/nolog conf_hin +$ close/nolog aconf_in +$ close/nolog aconf +$ close/nolog out +$ close/nolog min +$ close/nolog mod +$ close/nolog h_in +$ write sys$output "Exiting..." +$ exit 2 +$! +$! +$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES +$ V = 'F$Verify(0) +$! P1 = What we are trying to make +$! P2 = Command to make it +$! P3 - P8 What it depends on +$ +$ If F$Search(P1) .Eqs. "" Then Goto Makeit +$ Time = F$CvTime(F$File(P1,"RDT")) +$arg=3 +$Loop: +$ Argument = P'arg +$ If Argument .Eqs. "" Then Goto Exit +$ El=0 +$Loop2: +$ File = F$Element(El," ",Argument) +$ If File .Eqs. " " Then Goto Endl +$ AFile = "" +$Loop3: +$ OFile = AFile +$ AFile = F$Search(File) +$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl +$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit +$ Goto Loop3 +$NextEL: +$ El = El + 1 +$ Goto Loop2 +$EndL: +$ arg=arg+1 +$ If arg .Le. 8 Then Goto Loop +$ Goto Exit +$ +$Makeit: +$ VV=F$VERIFY(0) +$ write sys$output P2 +$ 'P2 +$ VV='F$Verify(VV) +$Exit: +$ If V Then Set Verify +$ENDSUBROUTINE +$!------------------------------------------------------------------------------ +$! +$! Check command line options and set symbols accordingly +$! +$!------------------------------------------------------------------------------ +$! Version history +$! 0.01 20041206 First version to receive a number +$! 0.02 20060126 Add new "HELP" target +$ CHECK_OPTS: +$ i = 1 +$ OPT_LOOP: +$ if i .lt. 9 +$ then +$ cparm = f$edit(p'i',"upcase") +$! +$! Check if parameter actually contains something +$! +$ if f$edit(cparm,"trim") .nes. "" +$ then +$ if cparm .eqs. "DEBUG" +$ then +$ ccopt = ccopt + "/noopt/deb" +$ lopts = lopts + "/deb" +$ endif +$ if f$locate("CCOPT=",cparm) .lt. f$length(cparm) +$ then +$ start = f$locate("=",cparm) + 1 +$ len = f$length(cparm) - start +$ ccopt = ccopt + f$extract(start,len,cparm) +$ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) - + then s_case = true +$ endif +$ if cparm .eqs. "LINK" then linkonly = true +$ if f$locate("LOPTS=",cparm) .lt. f$length(cparm) +$ then +$ start = f$locate("=",cparm) + 1 +$ len = f$length(cparm) - start +$ lopts = lopts + f$extract(start,len,cparm) +$ endif +$ if f$locate("CC=",cparm) .lt. f$length(cparm) +$ then +$ start = f$locate("=",cparm) + 1 +$ len = f$length(cparm) - start +$ cc_com = f$extract(start,len,cparm) + if (cc_com .nes. "DECC") .and. - + (cc_com .nes. "VAXC") .and. - + (cc_com .nes. "GNUC") +$ then +$ write sys$output "Unsupported compiler choice ''cc_com' ignored" +$ write sys$output "Use DECC, VAXC, or GNUC instead" +$ else +$ if cc_com .eqs. "DECC" then its_decc = true +$ if cc_com .eqs. "VAXC" then its_vaxc = true +$ if cc_com .eqs. "GNUC" then its_gnuc = true +$ endif +$ endif +$ if f$locate("MAKE=",cparm) .lt. f$length(cparm) +$ then +$ start = f$locate("=",cparm) + 1 +$ len = f$length(cparm) - start +$ mmks = f$extract(start,len,cparm) +$ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS") +$ then +$ make = mmks +$ else +$ write sys$output "Unsupported make choice ''mmks' ignored" +$ write sys$output "Use MMK or MMS instead" +$ endif +$ endif +$ if cparm .eqs. "HELP" then gosub bhelp +$ endif +$ i = i + 1 +$ goto opt_loop +$ endif +$ return +$!------------------------------------------------------------------------------ +$! +$! Look for the compiler used +$! +$! Version history +$! 0.01 20040223 First version to receive a number +$! 0.02 20040229 Save/set value of decc$no_rooted_search_lists +$! 0.03 20060202 Extend handling of GNU C +$! 0.04 20090402 Compaq -> hp +$CHECK_COMPILER: +$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) +$ then +$ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "") +$ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "") +$ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "") +$ endif +$! +$! Exit if no compiler available +$! +$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) +$ then goto CC_ERR +$ else +$ if its_decc +$ then +$ write sys$output "CC compiler check ... hp C" +$ if f$trnlnm("decc$no_rooted_search_lists") .nes. "" +$ then +$ dnrsl = f$trnlnm("decc$no_rooted_search_lists") +$ endif +$ define/nolog decc$no_rooted_search_lists 1 +$ else +$ if its_vaxc then write sys$output "CC compiler check ... VAX C" +$ if its_gnuc +$ then +$ write sys$output "CC compiler check ... GNU C" +$ if f$trnlnm(topt) then write topt "gnu_cc:[000000]gcclib.olb/lib" +$ if f$trnlnm(optf) then write optf "gnu_cc:[000000]gcclib.olb/lib" +$ cc = "gcc" +$ endif +$ if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share" +$ if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share" +$ endif +$ endif +$ return +$!------------------------------------------------------------------------------ +$! +$! If MMS/MMK are available dump out the descrip.mms if required +$! +$CREA_MMS: +$ write sys$output "Creating descrip.mms..." +$ create descrip.mms +$ open/append out descrip.mms +$ copy sys$input: out +$ deck +# descrip.mms: MMS description file for building zlib on VMS +# written by Martin P.J. Zinser +# + +OBJS = adler32.obj, compress.obj, crc32.obj, gzclose.obj, gzlib.obj\ + gzread.obj, gzwrite.obj, uncompr.obj, infback.obj\ + deflate.obj, trees.obj, zutil.obj, inflate.obj, \ + inftrees.obj, inffast.obj + +$ eod +$ write out "CFLAGS=", ccopt +$ write out "LOPTS=", lopts +$ copy sys$input: out +$ deck + +all : example.exe minigzip.exe libz.olb + @ write sys$output " Example applications available" + +libz.olb : libz.olb($(OBJS)) + @ write sys$output " libz available" + +example.exe : example.obj libz.olb + link $(LOPTS) example,libz.olb/lib + +minigzip.exe : minigzip.obj libz.olb + link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib + +clean : + delete *.obj;*,libz.olb;*,*.opt;*,*.exe;* + + +# Other dependencies. +adler32.obj : adler32.c zutil.h zlib.h zconf.h +compress.obj : compress.c zlib.h zconf.h +crc32.obj : crc32.c zutil.h zlib.h zconf.h +deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h +example.obj : example.c zlib.h zconf.h +gzclose.obj : gzclose.c zutil.h zlib.h zconf.h +gzlib.obj : gzlib.c zutil.h zlib.h zconf.h +gzread.obj : gzread.c zutil.h zlib.h zconf.h +gzwrite.obj : gzwrite.c zutil.h zlib.h zconf.h +inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h +inflate.obj : inflate.c zutil.h zlib.h zconf.h +inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h +minigzip.obj : minigzip.c zlib.h zconf.h +trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h +uncompr.obj : uncompr.c zlib.h zconf.h +zutil.obj : zutil.c zutil.h zlib.h zconf.h +infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h +$ eod +$ close out +$ return +$!------------------------------------------------------------------------------ +$! +$! Read list of core library sources from makefile.in and create options +$! needed to build shareable image +$! +$CREA_OLIST: +$ open/read min makefile.in +$ open/write mod modules.opt +$ src_check = "OBJC =" +$MRLOOP: +$ read/end=mrdone min rec +$ if (f$extract(0,6,rec) .nes. src_check) then goto mrloop +$ rec = rec - src_check +$ gosub extra_filnam +$ if (f$element(1,"\",rec) .eqs. "\") then goto mrdone +$MRSLOOP: +$ read/end=mrdone min rec +$ gosub extra_filnam +$ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop +$MRDONE: +$ close min +$ close mod +$ return +$!------------------------------------------------------------------------------ +$! +$! Take record extracted in crea_olist and split it into single filenames +$! +$EXTRA_FILNAM: +$ myrec = f$edit(rec - "\", "trim,compress") +$ i = 0 +$FELOOP: +$ srcfil = f$element(i," ", myrec) +$ if (srcfil .nes. " ") +$ then +$ write mod f$parse(srcfil,,,"NAME"), ".obj" +$ i = i + 1 +$ goto feloop +$ endif +$ return +$!------------------------------------------------------------------------------ +$! +$! Find current Zlib version number +$! +$FIND_VERSION: +$ open/read h_in 'v_file' +$hloop: +$ read/end=hdone h_in rec +$ rec = f$edit(rec,"TRIM") +$ if (f$extract(0,1,rec) .nes. "#") then goto hloop +$ rec = f$edit(rec - "#", "TRIM") +$ if f$element(0," ",rec) .nes. "define" then goto hloop +$ if f$element(1," ",rec) .eqs. v_string +$ then +$ version = 'f$element(2," ",rec)' +$ goto hdone +$ endif +$ goto hloop +$hdone: +$ close h_in +$ return +$!------------------------------------------------------------------------------ +$! +$CHECK_CONFIG: +$! +$ in_ldef = f$locate(cdef,libdefs) +$ if (in_ldef .lt. f$length(libdefs)) +$ then +$ write aconf "#define ''cdef' 1" +$ libdefs = f$extract(0,in_ldef,libdefs) + - + f$extract(in_ldef + f$length(cdef) + 1, - + f$length(libdefs) - in_ldef - f$length(cdef) - 1, - + libdefs) +$ else +$ if (f$type('cdef') .eqs. "INTEGER") +$ then +$ write aconf "#define ''cdef' ", 'cdef' +$ else +$ if (f$type('cdef') .eqs. "STRING") +$ then +$ write aconf "#define ''cdef' ", """", '''cdef'', """" +$ else +$ gosub check_cc_def +$ endif +$ endif +$ endif +$ return +$!------------------------------------------------------------------------------ +$! +$! Check if this is a define relating to the properties of the C/C++ +$! compiler +$! +$ CHECK_CC_DEF: +$ if (cdef .eqs. "_LARGEFILE64_SOURCE") +$ then +$ copy sys$input: 'tc' +$ deck +#include "tconfig" +#define _LARGEFILE +#include + +int main(){ +FILE *fp; + fp = fopen("temp.txt","r"); + fseeko(fp,1,SEEK_SET); + fclose(fp); +} + +$ eod +$ test_inv = false +$ comm_h = false +$ gosub cc_prop_check +$ return +$ endif +$ write aconf "/* ", line, " */" +$ return +$!------------------------------------------------------------------------------ +$! +$! Check for properties of C/C++ compiler +$! +$! Version history +$! 0.01 20031020 First version to receive a number +$! 0.02 20031022 Added logic for defines with value +$! 0.03 20040309 Make sure local config file gets not deleted +$! 0.04 20041230 Also write include for configure run +$! 0.05 20050103 Add processing of "comment defines" +$CC_PROP_CHECK: +$ cc_prop = true +$ is_need = false +$ is_need = (f$extract(0,4,cdef) .eqs. "NEED") .or. (test_inv .eq. true) +$ if f$search(th) .eqs. "" then create 'th' +$ set message/nofac/noident/nosever/notext +$ on error then continue +$ cc 'tmpnam' +$ if .not. ($status) then cc_prop = false +$ on error then continue +$! The headers might lie about the capabilities of the RTL +$ link 'tmpnam',tmp.opt/opt +$ if .not. ($status) then cc_prop = false +$ set message/fac/ident/sever/text +$ on error then goto err_exit +$ delete/nolog 'tmpnam'.*;*/exclude='th' +$ if (cc_prop .and. .not. is_need) .or. - + (.not. cc_prop .and. is_need) +$ then +$ write sys$output "Checking for ''cdef'... yes" +$ if f$type('cdef_val'_yes) .nes. "" +$ then +$ if f$type('cdef_val'_yes) .eqs. "INTEGER" - + then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_yes) +$ if f$type('cdef_val'_yes) .eqs. "STRING" - + then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_yes) +$ else +$ call write_config f$fao("#define !AS 1",cdef) +$ endif +$ if (cdef .eqs. "HAVE_FSEEKO") .or. (cdef .eqs. "_LARGE_FILES") .or. - + (cdef .eqs. "_LARGEFILE64_SOURCE") then - + call write_config f$string("#define _LARGEFILE 1") +$ else +$ write sys$output "Checking for ''cdef'... no" +$ if (comm_h) +$ then + call write_config f$fao("/* !AS */",line) +$ else +$ if f$type('cdef_val'_no) .nes. "" +$ then +$ if f$type('cdef_val'_no) .eqs. "INTEGER" - + then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_no) +$ if f$type('cdef_val'_no) .eqs. "STRING" - + then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_no) +$ else +$ call write_config f$fao("#undef !AS",cdef) +$ endif +$ endif +$ endif +$ return +$!------------------------------------------------------------------------------ +$! +$! Check for properties of C/C++ compiler with multiple result values +$! +$! Version history +$! 0.01 20040127 First version +$! 0.02 20050103 Reconcile changes from cc_prop up to version 0.05 +$CC_MPROP_CHECK: +$ cc_prop = true +$ i = 1 +$ idel = 1 +$ MT_LOOP: +$ if f$type(result_'i') .eqs. "STRING" +$ then +$ set message/nofac/noident/nosever/notext +$ on error then continue +$ cc 'tmpnam'_'i' +$ if .not. ($status) then cc_prop = false +$ on error then continue +$! The headers might lie about the capabilities of the RTL +$ link 'tmpnam'_'i',tmp.opt/opt +$ if .not. ($status) then cc_prop = false +$ set message/fac/ident/sever/text +$ on error then goto err_exit +$ delete/nolog 'tmpnam'_'i'.*;* +$ if (cc_prop) +$ then +$ write sys$output "Checking for ''cdef'... ", mdef_'i' +$ if f$type(mdef_'i') .eqs. "INTEGER" - + then call write_config f$fao("#define !AS !UL",cdef,mdef_'i') +$ if f$type('cdef_val'_yes) .eqs. "STRING" - + then call write_config f$fao("#define !AS !AS",cdef,mdef_'i') +$ goto msym_clean +$ else +$ i = i + 1 +$ goto mt_loop +$ endif +$ endif +$ write sys$output "Checking for ''cdef'... no" +$ call write_config f$fao("#undef !AS",cdef) +$ MSYM_CLEAN: +$ if (idel .le. msym_max) +$ then +$ delete/sym mdef_'idel' +$ idel = idel + 1 +$ goto msym_clean +$ endif +$ return +$!------------------------------------------------------------------------------ +$! +$! Analyze Object files for OpenVMS AXP to extract Procedure and Data +$! information to build a symbol vector for a shareable image +$! All the "brains" of this logic was suggested by Hartmut Becker +$! (Hartmut.Becker@compaq.com). All the bugs were introduced by me +$! (zinser@zinser.no-ip.info), so if you do have problem reports please do not +$! bother Hartmut/HP, but get in touch with me +$! +$! Version history +$! 0.01 20040406 Skip over shareable images in option file +$! 0.02 20041109 Fix option file for shareable images with case_sensitive=YES +$! 0.03 20050107 Skip over Identification labels in option file +$! 0.04 20060117 Add uppercase alias to code compiled with /name=as_is +$! +$ ANAL_OBJ_AXP: Subroutine +$ V = 'F$Verify(0) +$ SAY := "WRITE_ SYS$OUTPUT" +$ +$ IF F$SEARCH("''P1'") .EQS. "" +$ THEN +$ SAY "ANAL_OBJ_AXP-E-NOSUCHFILE: Error, inputfile ''p1' not available" +$ goto exit_aa +$ ENDIF +$ IF "''P2'" .EQS. "" +$ THEN +$ SAY "ANAL_OBJ_AXP: Error, no output file provided" +$ goto exit_aa +$ ENDIF +$ +$ open/read in 'p1 +$ create a.tmp +$ open/append atmp a.tmp +$ loop: +$ read/end=end_loop in line +$ if f$locate("/SHARE",f$edit(line,"upcase")) .lt. f$length(line) +$ then +$ write sys$output "ANAL_SKP_SHR-i-skipshare, ''line'" +$ goto loop +$ endif +$ if f$locate("IDENTIFICATION=",f$edit(line,"upcase")) .lt. f$length(line) +$ then +$ write sys$output "ANAL_OBJ_AXP-i-ident: Identification ", - + f$element(1,"=",line) +$ goto loop +$ endif +$ f= f$search(line) +$ if f .eqs. "" +$ then +$ write sys$output "ANAL_OBJ_AXP-w-nosuchfile, ''line'" +$ goto loop +$ endif +$ define/user sys$output nl: +$ define/user sys$error nl: +$ anal/obj/gsd 'f /out=x.tmp +$ open/read xtmp x.tmp +$ XLOOP: +$ read/end=end_xloop xtmp xline +$ xline = f$edit(xline,"compress") +$ write atmp xline +$ goto xloop +$ END_XLOOP: +$ close xtmp +$ goto loop +$ end_loop: +$ close in +$ close atmp +$ if f$search("a.tmp") .eqs. "" - + then $ exit +$ ! all global definitions +$ search a.tmp "symbol:","EGSY$V_DEF 1","EGSY$V_NORM 1"/out=b.tmp +$ ! all procedures +$ search b.tmp "EGSY$V_NORM 1"/wind=(0,1) /out=c.tmp +$ search c.tmp "symbol:"/out=d.tmp +$ define/user sys$output nl: +$ edito/edt/command=sys$input d.tmp +sub/symbol: "/symbol_vector=(/whole +sub/"/=PROCEDURE)/whole +exit +$ ! all data +$ search b.tmp "EGSY$V_DEF 1"/wind=(0,1) /out=e.tmp +$ search e.tmp "symbol:"/out=f.tmp +$ define/user sys$output nl: +$ edito/edt/command=sys$input f.tmp +sub/symbol: "/symbol_vector=(/whole +sub/"/=DATA)/whole +exit +$ sort/nodupl d.tmp,f.tmp g.tmp +$ open/read raw_vector g.tmp +$ open/write case_vector 'p2' +$ RAWLOOP: +$ read/end=end_rawloop raw_vector raw_element +$ write case_vector raw_element +$ if f$locate("=PROCEDURE)",raw_element) .lt. f$length(raw_element) +$ then +$ name = f$element(1,"=",raw_element) - "(" +$ if f$edit(name,"UPCASE") .nes. name then - + write case_vector f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)", - + f$edit(name,"UPCASE"), name) +$ endif +$ if f$locate("=DATA)",raw_element) .lt. f$length(raw_element) +$ then +$ name = f$element(1,"=",raw_element) - "(" +$ if f$edit(name,"UPCASE") .nes. name then - + write case_vector f$fao(" symbol_vector=(!AS/!AS=DATA)", - + f$edit(name,"UPCASE"), name) +$ endif +$ goto rawloop +$ END_RAWLOOP: +$ close raw_vector +$ close case_vector +$ delete a.tmp;*,b.tmp;*,c.tmp;*,d.tmp;*,e.tmp;*,f.tmp;*,g.tmp;* +$ if f$search("x.tmp") .nes. "" - + then $ delete x.tmp;* +$! +$ EXIT_AA: +$ if V then set verify +$ endsubroutine +$!------------------------------------------------------------------------------ +$! +$! Write configuration to both permanent and temporary config file +$! +$! Version history +$! 0.01 20031029 First version to receive a number +$! +$WRITE_CONFIG: SUBROUTINE +$ write aconf 'p1' +$ open/append confh 'th' +$ write confh 'p1' +$ close confh +$ENDSUBROUTINE +$!------------------------------------------------------------------------------ diff --git a/zlib/minigzip.c b/zlib/minigzip.c new file mode 100644 index 0000000..9825ccc --- /dev/null +++ b/zlib/minigzip.c @@ -0,0 +1,440 @@ +/* minigzip.c -- simulate gzip using the zlib compression library + * Copyright (C) 1995-2006, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * minigzip is a minimal implementation of the gzip utility. This is + * only an example of using zlib and isn't meant to replace the + * full-featured gzip. No attempt is made to deal with file systems + * limiting names to 14 or 8+3 characters, etc... Error checking is + * very limited. So use minigzip only for testing; use gzip for the + * real thing. On MSDOS, use only on file names without extension + * or in pipe mode. + */ + +/* @(#) $Id$ */ + +#include "zlib.h" +#include + +#ifdef STDC +# include +# include +#endif + +#ifdef USE_MMAP +# include +# include +# include +#endif + +#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) +# include +# include +# ifdef UNDER_CE +# include +# endif +# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) +#else +# define SET_BINARY_MODE(file) +#endif + +#ifdef VMS +# define unlink delete +# define GZ_SUFFIX "-gz" +#endif +#ifdef RISCOS +# define unlink remove +# define GZ_SUFFIX "-gz" +# define fileno(file) file->__file +#endif +#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fileno */ +#endif + +#if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE) +#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ + extern int unlink OF((const char *)); +#endif +#endif + +#if defined(UNDER_CE) +# include +# define perror(s) pwinerror(s) + +/* Map the Windows error number in ERROR to a locale-dependent error + message string and return a pointer to it. Typically, the values + for ERROR come from GetLastError. + + The string pointed to shall not be modified by the application, + but may be overwritten by a subsequent call to strwinerror + + The strwinerror function does not change the current setting + of GetLastError. */ + +static char *strwinerror (error) + DWORD error; +{ + static char buf[1024]; + + wchar_t *msgbuf; + DWORD lasterr = GetLastError(); + DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, + error, + 0, /* Default language */ + (LPVOID)&msgbuf, + 0, + NULL); + if (chars != 0) { + /* If there is an \r\n appended, zap it. */ + if (chars >= 2 + && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { + chars -= 2; + msgbuf[chars] = 0; + } + + if (chars > sizeof (buf) - 1) { + chars = sizeof (buf) - 1; + msgbuf[chars] = 0; + } + + wcstombs(buf, msgbuf, chars + 1); + LocalFree(msgbuf); + } + else { + sprintf(buf, "unknown win32 error (%ld)", error); + } + + SetLastError(lasterr); + return buf; +} + +static void pwinerror (s) + const char *s; +{ + if (s && *s) + fprintf(stderr, "%s: %s\n", s, strwinerror(GetLastError ())); + else + fprintf(stderr, "%s\n", strwinerror(GetLastError ())); +} + +#endif /* UNDER_CE */ + +#ifndef GZ_SUFFIX +# define GZ_SUFFIX ".gz" +#endif +#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) + +#define BUFLEN 16384 +#define MAX_NAME_LEN 1024 + +#ifdef MAXSEG_64K +# define local static + /* Needed for systems with limitation on stack size. */ +#else +# define local +#endif + +char *prog; + +void error OF((const char *msg)); +void gz_compress OF((FILE *in, gzFile out)); +#ifdef USE_MMAP +int gz_compress_mmap OF((FILE *in, gzFile out)); +#endif +void gz_uncompress OF((gzFile in, FILE *out)); +void file_compress OF((char *file, char *mode)); +void file_uncompress OF((char *file)); +int main OF((int argc, char *argv[])); + +/* =========================================================================== + * Display error message and exit + */ +void error(msg) + const char *msg; +{ + fprintf(stderr, "%s: %s\n", prog, msg); + exit(1); +} + +/* =========================================================================== + * Compress input to output then close both files. + */ + +void gz_compress(in, out) + FILE *in; + gzFile out; +{ + local char buf[BUFLEN]; + int len; + int err; + +#ifdef USE_MMAP + /* Try first compressing with mmap. If mmap fails (minigzip used in a + * pipe), use the normal fread loop. + */ + if (gz_compress_mmap(in, out) == Z_OK) return; +#endif + for (;;) { + len = (int)fread(buf, 1, sizeof(buf), in); + if (ferror(in)) { + perror("fread"); + exit(1); + } + if (len == 0) break; + + if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); + } + fclose(in); + if (gzclose(out) != Z_OK) error("failed gzclose"); +} + +#ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ + +/* Try compressing the input file at once using mmap. Return Z_OK if + * if success, Z_ERRNO otherwise. + */ +int gz_compress_mmap(in, out) + FILE *in; + gzFile out; +{ + int len; + int err; + int ifd = fileno(in); + caddr_t buf; /* mmap'ed buffer for the entire input file */ + off_t buf_len; /* length of the input file */ + struct stat sb; + + /* Determine the size of the file, needed for mmap: */ + if (fstat(ifd, &sb) < 0) return Z_ERRNO; + buf_len = sb.st_size; + if (buf_len <= 0) return Z_ERRNO; + + /* Now do the actual mmap: */ + buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); + if (buf == (caddr_t)(-1)) return Z_ERRNO; + + /* Compress the whole file at once: */ + len = gzwrite(out, (char *)buf, (unsigned)buf_len); + + if (len != (int)buf_len) error(gzerror(out, &err)); + + munmap(buf, buf_len); + fclose(in); + if (gzclose(out) != Z_OK) error("failed gzclose"); + return Z_OK; +} +#endif /* USE_MMAP */ + +/* =========================================================================== + * Uncompress input to output then close both files. + */ +void gz_uncompress(in, out) + gzFile in; + FILE *out; +{ + local char buf[BUFLEN]; + int len; + int err; + + for (;;) { + len = gzread(in, buf, sizeof(buf)); + if (len < 0) error (gzerror(in, &err)); + if (len == 0) break; + + if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { + error("failed fwrite"); + } + } + if (fclose(out)) error("failed fclose"); + + if (gzclose(in) != Z_OK) error("failed gzclose"); +} + + +/* =========================================================================== + * Compress the given file: create a corresponding .gz file and remove the + * original. + */ +void file_compress(file, mode) + char *file; + char *mode; +{ + local char outfile[MAX_NAME_LEN]; + FILE *in; + gzFile out; + + if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) { + fprintf(stderr, "%s: filename too long\n", prog); + exit(1); + } + + strcpy(outfile, file); + strcat(outfile, GZ_SUFFIX); + + in = fopen(file, "rb"); + if (in == NULL) { + perror(file); + exit(1); + } + out = gzopen(outfile, mode); + if (out == NULL) { + fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); + exit(1); + } + gz_compress(in, out); + + unlink(file); +} + + +/* =========================================================================== + * Uncompress the given file and remove the original. + */ +void file_uncompress(file) + char *file; +{ + local char buf[MAX_NAME_LEN]; + char *infile, *outfile; + FILE *out; + gzFile in; + size_t len = strlen(file); + + if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { + fprintf(stderr, "%s: filename too long\n", prog); + exit(1); + } + + strcpy(buf, file); + + if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { + infile = file; + outfile = buf; + outfile[len-3] = '\0'; + } else { + outfile = file; + infile = buf; + strcat(infile, GZ_SUFFIX); + } + in = gzopen(infile, "rb"); + if (in == NULL) { + fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); + exit(1); + } + out = fopen(outfile, "wb"); + if (out == NULL) { + perror(file); + exit(1); + } + + gz_uncompress(in, out); + + unlink(infile); +} + + +/* =========================================================================== + * Usage: minigzip [-c] [-d] [-f] [-h] [-r] [-1 to -9] [files...] + * -c : write to standard output + * -d : decompress + * -f : compress with Z_FILTERED + * -h : compress with Z_HUFFMAN_ONLY + * -r : compress with Z_RLE + * -1 to -9 : compression level + */ + +int main(argc, argv) + int argc; + char *argv[]; +{ + int copyout = 0; + int uncompr = 0; + gzFile file; + char *bname, outmode[20]; + + strcpy(outmode, "wb6 "); + + prog = argv[0]; + bname = strrchr(argv[0], '/'); + if (bname) + bname++; + else + bname = argv[0]; + argc--, argv++; + + if (!strcmp(bname, "gunzip")) + uncompr = 1; + else if (!strcmp(bname, "zcat")) + copyout = uncompr = 1; + + while (argc > 0) { + if (strcmp(*argv, "-c") == 0) + copyout = 1; + else if (strcmp(*argv, "-d") == 0) + uncompr = 1; + else if (strcmp(*argv, "-f") == 0) + outmode[3] = 'f'; + else if (strcmp(*argv, "-h") == 0) + outmode[3] = 'h'; + else if (strcmp(*argv, "-r") == 0) + outmode[3] = 'R'; + else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && + (*argv)[2] == 0) + outmode[2] = (*argv)[1]; + else + break; + argc--, argv++; + } + if (outmode[3] == ' ') + outmode[3] = 0; + if (argc == 0) { + SET_BINARY_MODE(stdin); + SET_BINARY_MODE(stdout); + if (uncompr) { + file = gzdopen(fileno(stdin), "rb"); + if (file == NULL) error("can't gzdopen stdin"); + gz_uncompress(file, stdout); + } else { + file = gzdopen(fileno(stdout), outmode); + if (file == NULL) error("can't gzdopen stdout"); + gz_compress(stdin, file); + } + } else { + if (copyout) { + SET_BINARY_MODE(stdout); + } + do { + if (uncompr) { + if (copyout) { + file = gzopen(*argv, "rb"); + if (file == NULL) + fprintf(stderr, "%s: can't gzopen %s\n", prog, *argv); + else + gz_uncompress(file, stdout); + } else { + file_uncompress(*argv); + } + } else { + if (copyout) { + FILE * in = fopen(*argv, "rb"); + + if (in == NULL) { + perror(*argv); + } else { + file = gzdopen(fileno(stdout), outmode); + if (file == NULL) error("can't gzdopen stdout"); + + gz_compress(in, file); + } + + } else { + file_compress(*argv, outmode); + } + } + } while (argv++, --argc); + } + return 0; +} diff --git a/zlib/treebuild.xml b/zlib/treebuild.xml new file mode 100644 index 0000000..6b8f542 --- /dev/null +++ b/zlib/treebuild.xml @@ -0,0 +1,116 @@ + + + + zip compression library + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/trees.c b/zlib/trees.c new file mode 100644 index 0000000..56e9bb1 --- /dev/null +++ b/zlib/trees.c @@ -0,0 +1,1244 @@ +/* trees.c -- output deflated data using Huffman coding + * Copyright (C) 1995-2010 Jean-loup Gailly + * detect_data_type() function provided freely by Cosmin Truta, 2006 + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process uses several Huffman trees. The more + * common source values are represented by shorter bit sequences. + * + * Each code tree is stored in a compressed form which is itself + * a Huffman encoding of the lengths of all the code strings (in + * ascending order by source values). The actual code strings are + * reconstructed from the lengths in the inflate process, as described + * in the deflate specification. + * + * REFERENCES + * + * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". + * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc + * + * Storer, James A. + * Data Compression: Methods and Theory, pp. 49-50. + * Computer Science Press, 1988. ISBN 0-7167-8156-5. + * + * Sedgewick, R. + * Algorithms, p290. + * Addison-Wesley, 1983. ISBN 0-201-06672-6. + */ + +/* @(#) $Id$ */ + +/* #define GEN_TREES_H */ + +#include "deflate.h" + +#ifdef DEBUG +# include +#endif + +/* =========================================================================== + * Constants + */ + +#define MAX_BL_BITS 7 +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +#define END_BLOCK 256 +/* end of block literal code */ + +#define REP_3_6 16 +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +#define REPZ_3_10 17 +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +#define REPZ_11_138 18 +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ + = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; + +local const int extra_dbits[D_CODES] /* extra bits for each distance code */ + = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ + = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; + +local const uch bl_order[BL_CODES] + = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +#define Buf_size (8 * 2*sizeof(char)) +/* Number of bits used within bi_buf. (bi_buf might be implemented on + * more than 16 bits on some systems.) + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ + +#if defined(GEN_TREES_H) || !defined(STDC) +/* non ANSI compilers may not accept trees.h */ + +local ct_data static_ltree[L_CODES+2]; +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +local ct_data static_dtree[D_CODES]; +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +uch _dist_code[DIST_CODE_LEN]; +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +uch _length_code[MAX_MATCH-MIN_MATCH+1]; +/* length code for each normalized match length (0 == MIN_MATCH) */ + +local int base_length[LENGTH_CODES]; +/* First normalized length for each code (0 = MIN_MATCH) */ + +local int base_dist[D_CODES]; +/* First normalized distance for each code (0 = distance of 1) */ + +#else +# include "trees.h" +#endif /* GEN_TREES_H */ + +struct static_tree_desc_s { + const ct_data *static_tree; /* static tree or NULL */ + const intf *extra_bits; /* extra bits for each code or NULL */ + int extra_base; /* base index for extra_bits */ + int elems; /* max number of elements in the tree */ + int max_length; /* max bit length for the codes */ +}; + +local static_tree_desc static_l_desc = +{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; + +local static_tree_desc static_d_desc = +{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; + +local static_tree_desc static_bl_desc = +{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; + +/* =========================================================================== + * Local (static) routines in this file. + */ + +local void tr_static_init OF((void)); +local void init_block OF((deflate_state *s)); +local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); +local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); +local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); +local void build_tree OF((deflate_state *s, tree_desc *desc)); +local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local int build_bl_tree OF((deflate_state *s)); +local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, + int blcodes)); +local void compress_block OF((deflate_state *s, ct_data *ltree, + ct_data *dtree)); +local int detect_data_type OF((deflate_state *s)); +local unsigned bi_reverse OF((unsigned value, int length)); +local void bi_windup OF((deflate_state *s)); +local void bi_flush OF((deflate_state *s)); +local void copy_block OF((deflate_state *s, charf *buf, unsigned len, + int header)); + +#ifdef GEN_TREES_H +local void gen_trees_header OF((void)); +#endif + +#ifndef DEBUG +# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) + /* Send a code of the given tree. c and tree must not have side effects */ + +#else /* DEBUG */ +# define send_code(s, c, tree) \ + { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ + send_bits(s, tree[c].Code, tree[c].Len); } +#endif + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +#ifdef DEBUG +local void send_bits OF((deflate_state *s, int value, int length)); + +local void send_bits(s, value, length) + deflate_state *s; + int value; /* value to send */ + int length; /* number of bits */ +{ + Tracevv((stderr," l %2d v %4x ", length, value)); + Assert(length > 0 && length <= 15, "invalid length"); + s->bits_sent += (ulg)length; + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * unused bits in value. + */ + if (s->bi_valid > (int)Buf_size - length) { + s->bi_buf |= (ush)value << s->bi_valid; + put_short(s, s->bi_buf); + s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); + s->bi_valid += length - Buf_size; + } else { + s->bi_buf |= (ush)value << s->bi_valid; + s->bi_valid += length; + } +} +#else /* !DEBUG */ + +#define send_bits(s, value, length) \ +{ int len = length;\ + if (s->bi_valid > (int)Buf_size - len) {\ + int val = value;\ + s->bi_buf |= (ush)val << s->bi_valid;\ + put_short(s, s->bi_buf);\ + s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ + s->bi_valid += len - Buf_size;\ + } else {\ + s->bi_buf |= (ush)(value) << s->bi_valid;\ + s->bi_valid += len;\ + }\ +} +#endif /* DEBUG */ + + +/* the arguments must not have side effects */ + +/* =========================================================================== + * Initialize the various 'constant' tables. + */ +local void tr_static_init() +{ +#if defined(GEN_TREES_H) || !defined(STDC) + static int static_init_done = 0; + int n; /* iterates over tree elements */ + int bits; /* bit counter */ + int length; /* length value */ + int code; /* code value */ + int dist; /* distance index */ + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + if (static_init_done) return; + + /* For some embedded targets, global variables are not initialized: */ +#ifdef NO_INIT_GLOBAL_POINTERS + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; +#endif + + /* Initialize the mapping length (0..255) -> length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1< dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + _dist_code[256 + dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; + n = 0; + while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; + while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; + while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; + while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n].Len = 5; + static_dtree[n].Code = bi_reverse((unsigned)n, 5); + } + static_init_done = 1; + +# ifdef GEN_TREES_H + gen_trees_header(); +# endif +#endif /* defined(GEN_TREES_H) || !defined(STDC) */ +} + +/* =========================================================================== + * Genererate the file trees.h describing the static trees. + */ +#ifdef GEN_TREES_H +# ifndef DEBUG +# include +# endif + +# define SEPARATOR(i, last, width) \ + ((i) == (last)? "\n};\n\n" : \ + ((i) % (width) == (width)-1 ? ",\n" : ", ")) + +void gen_trees_header() +{ + FILE *header = fopen("trees.h", "w"); + int i; + + Assert (header != NULL, "Can't open trees.h"); + fprintf(header, + "/* header created automatically with -DGEN_TREES_H */\n\n"); + + fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); + for (i = 0; i < L_CODES+2; i++) { + fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, + static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); + } + + fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, + static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); + } + + fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); + for (i = 0; i < DIST_CODE_LEN; i++) { + fprintf(header, "%2u%s", _dist_code[i], + SEPARATOR(i, DIST_CODE_LEN-1, 20)); + } + + fprintf(header, + "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); + for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { + fprintf(header, "%2u%s", _length_code[i], + SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); + } + + fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); + for (i = 0; i < LENGTH_CODES; i++) { + fprintf(header, "%1u%s", base_length[i], + SEPARATOR(i, LENGTH_CODES-1, 20)); + } + + fprintf(header, "local const int base_dist[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "%5u%s", base_dist[i], + SEPARATOR(i, D_CODES-1, 10)); + } + + fclose(header); +} +#endif /* GEN_TREES_H */ + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +void ZLIB_INTERNAL _tr_init(s) + deflate_state *s; +{ + tr_static_init(); + + s->l_desc.dyn_tree = s->dyn_ltree; + s->l_desc.stat_desc = &static_l_desc; + + s->d_desc.dyn_tree = s->dyn_dtree; + s->d_desc.stat_desc = &static_d_desc; + + s->bl_desc.dyn_tree = s->bl_tree; + s->bl_desc.stat_desc = &static_bl_desc; + + s->bi_buf = 0; + s->bi_valid = 0; + s->last_eob_len = 8; /* enough lookahead for inflate */ +#ifdef DEBUG + s->compressed_len = 0L; + s->bits_sent = 0L; +#endif + + /* Initialize the first block of the first file: */ + init_block(s); +} + +/* =========================================================================== + * Initialize a new block. + */ +local void init_block(s) + deflate_state *s; +{ + int n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; + for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; + for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; + s->last_lit = s->matches = 0; +} + +#define SMALLEST 1 +/* Index within the heap array of least frequent node in the Huffman tree */ + + +/* =========================================================================== + * Remove the smallest element from the heap and recreate the heap with + * one less element. Updates heap and heap_len. + */ +#define pqremove(s, tree, top) \ +{\ + top = s->heap[SMALLEST]; \ + s->heap[SMALLEST] = s->heap[s->heap_len--]; \ + pqdownheap(s, tree, SMALLEST); \ +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +#define smaller(tree, n, m, depth) \ + (tree[n].Freq < tree[m].Freq || \ + (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +local void pqdownheap(s, tree, k) + deflate_state *s; + ct_data *tree; /* the tree to restore */ + int k; /* node to move down */ +{ + int v = s->heap[k]; + int j = k << 1; /* left son of k */ + while (j <= s->heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s->heap_len && + smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s->heap[j], s->depth)) break; + + /* Exchange v with the smallest son */ + s->heap[k] = s->heap[j]; k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s->heap[k] = v; +} + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +local void gen_bitlen(s, desc) + deflate_state *s; + tree_desc *desc; /* the tree descriptor */ +{ + ct_data *tree = desc->dyn_tree; + int max_code = desc->max_code; + const ct_data *stree = desc->stat_desc->static_tree; + const intf *extra = desc->stat_desc->extra_bits; + int base = desc->stat_desc->extra_base; + int max_length = desc->stat_desc->max_length; + int h; /* heap index */ + int n, m; /* iterate over the tree elements */ + int bits; /* bit length */ + int xbits; /* extra bits */ + ush f; /* frequency */ + int overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ + + for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + n = s->heap[h]; + bits = tree[tree[n].Dad].Len + 1; + if (bits > max_length) bits = max_length, overflow++; + tree[n].Len = (ush)bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) continue; /* not a leaf node */ + + s->bl_count[bits]++; + xbits = 0; + if (n >= base) xbits = extra[n-base]; + f = tree[n].Freq; + s->opt_len += (ulg)f * (bits + xbits); + if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); + } + if (overflow == 0) return; + + Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length-1; + while (s->bl_count[bits] == 0) bits--; + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits != 0; bits--) { + n = s->bl_count[bits]; + while (n != 0) { + m = s->heap[--h]; + if (m > max_code) continue; + if ((unsigned) tree[m].Len != (unsigned) bits) { + Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s->opt_len += ((long)bits - (long)tree[m].Len) + *(long)tree[m].Freq; + tree[m].Len = (ush)bits; + } + n--; + } + } +} + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +local void gen_codes (tree, max_code, bl_count) + ct_data *tree; /* the tree to decorate */ + int max_code; /* largest code with non zero frequency */ + ushf *bl_count; /* number of codes at each bit length */ +{ + ush next_code[MAX_BITS+1]; /* next code value for each bit length */ + ush code = 0; /* running code value */ + int bits; /* bit index */ + int n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits-1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; + const ct_data *stree = desc->stat_desc->static_tree; + int elems = desc->stat_desc->elems; + int n, m; /* iterate over heap elements */ + int max_code = -1; /* largest code with non zero frequency */ + int node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s->heap_len = 0, s->heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n].Freq != 0) { + s->heap[++(s->heap_len)] = max_code = n; + s->depth[n] = 0; + } else { + tree[n].Len = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s->heap_len < 2) { + node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); + tree[node].Freq = 1; + s->depth[node] = 0; + s->opt_len--; if (stree) s->static_len -= stree[node].Len; + /* node is 0 or 1 so it does not have extra bits */ + } + desc->max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + pqremove(s, tree, n); /* n = node of least frequency */ + m = s->heap[SMALLEST]; /* m = node of next least frequency */ + + s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ + s->heap[--(s->heap_max)] = m; + + /* Create a new node father of n and m */ + tree[node].Freq = tree[n].Freq + tree[m].Freq; + s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? + s->depth[n] : s->depth[m]) + 1); + tree[n].Dad = tree[m].Dad = (ush)node; +#ifdef DUMP_BL_TREE + if (tree == s->bl_tree) { + fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", + node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); + } +#endif + /* and insert the new node in the heap */ + s->heap[SMALLEST] = node++; + pqdownheap(s, tree, SMALLEST); + + } while (s->heap_len >= 2); + + s->heap[--(s->heap_max)] = s->heap[SMALLEST]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, (tree_desc *)desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes ((ct_data *)tree, max_code, s->bl_count); +} + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +local void scan_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + if (nextlen == 0) max_count = 138, min_count = 3; + tree[max_code+1].Len = (ush)0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + s->bl_tree[curlen].Freq += count; + } else if (curlen != 0) { + if (curlen != prevlen) s->bl_tree[curlen].Freq++; + s->bl_tree[REP_3_6].Freq++; + } else if (count <= 10) { + s->bl_tree[REPZ_3_10].Freq++; + } else { + s->bl_tree[REPZ_11_138].Freq++; + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +local void send_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen == 0) max_count = 138, min_count = 3; + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + do { send_code(s, curlen, s->bl_tree); } while (--count != 0); + + } else if (curlen != 0) { + if (curlen != prevlen) { + send_code(s, curlen, s->bl_tree); count--; + } + Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + + } else { + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +local int build_bl_tree(s) + deflate_state *s; +{ + int max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); + scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, (tree_desc *)(&(s->bl_desc))); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; + } + /* Update opt_len to include the bit length tree and counts */ + s->opt_len += 3*(max_blindex+1) + 5+5+4; + Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + s->opt_len, s->static_len)); + + return max_blindex; +} + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +local void send_all_trees(s, lcodes, dcodes, blcodes) + deflate_state *s; + int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + int rank; /* index in bl_order */ + + Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + "too many codes"); + Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes-1, 5); + send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); + } + Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + +/* =========================================================================== + * Send a stored block + */ +void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) + deflate_state *s; + charf *buf; /* input block */ + ulg stored_len; /* length of input block */ + int last; /* one if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ +#ifdef DEBUG + s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; + s->compressed_len += (stored_len + 4) << 3; +#endif + copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ +} + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + * The current inflate code requires 9 bits of lookahead. If the + * last two codes for the previous block (real code plus EOB) were coded + * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode + * the last real code. In this case we send two empty static blocks instead + * of one. (There are no problems if the previous block is stored or fixed.) + * To simplify the code, we assume the worst case of last real code encoded + * on one bit only. + */ +void ZLIB_INTERNAL _tr_align(s) + deflate_state *s; +{ + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ +#endif + bi_flush(s); + /* Of the 10 bits for the empty block, we have already sent + * (10 - bi_valid) bits. The lookahead for the last real code (before + * the EOB of the previous block) was thus at least one plus the length + * of the EOB plus what we have just sent of the empty static block. + */ + if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; +#endif + bi_flush(s); + } + s->last_eob_len = 7; +} + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) + deflate_state *s; + charf *buf; /* input block, or NULL if too old */ + ulg stored_len; /* length of input block */ + int last; /* one if this is the last block for a file */ +{ + ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + int max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s->level > 0) { + + /* Check if the file is binary or text */ + if (s->strm->data_type == Z_UNKNOWN) + s->strm->data_type = detect_data_type(s); + + /* Construct the literal and distance trees */ + build_tree(s, (tree_desc *)(&(s->l_desc))); + Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + + build_tree(s, (tree_desc *)(&(s->d_desc))); + Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s->opt_len+3+7)>>3; + static_lenb = (s->static_len+3+7)>>3; + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + s->last_lit)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + + } else { + Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + +#ifdef FORCE_STORED + if (buf != (char*)0) { /* force stored block */ +#else + if (stored_len+4 <= opt_lenb && buf != (char*)0) { + /* 4: two words for the lengths */ +#endif + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + +#ifdef FORCE_STATIC + } else if (static_lenb >= 0) { /* force static trees */ +#else + } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { +#endif + send_bits(s, (STATIC_TREES<<1)+last, 3); + compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->static_len; +#endif + } else { + send_bits(s, (DYN_TREES<<1)+last, 3); + send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, + max_blindex+1); + compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->opt_len; +#endif + } + Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); +#ifdef DEBUG + s->compressed_len += 7; /* align on byte boundary */ +#endif + } + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + s->compressed_len-7*last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +int ZLIB_INTERNAL _tr_tally (s, dist, lc) + deflate_state *s; + unsigned dist; /* distance of matched string */ + unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + s->d_buf[s->last_lit] = (ush)dist; + s->l_buf[s->last_lit++] = (uch)lc; + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; + } else { + s->matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + Assert((ush)dist < (ush)MAX_DIST(s) && + (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } + +#ifdef TRUNCATE_BLOCK + /* Try to guess if it is profitable to stop the current block here */ + if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { + /* Compute an upper bound for the compressed length */ + ulg out_length = (ulg)s->last_lit*8L; + ulg in_length = (ulg)((long)s->strstart - s->block_start); + int dcode; + for (dcode = 0; dcode < D_CODES; dcode++) { + out_length += (ulg)s->dyn_dtree[dcode].Freq * + (5L+extra_dbits[dcode]); + } + out_length >>= 3; + Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", + s->last_lit, in_length, out_length, + 100L - out_length*100L/in_length)); + if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; + } +#endif + return (s->last_lit == s->lit_bufsize-1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +local void compress_block(s, ltree, dtree) + deflate_state *s; + ct_data *ltree; /* literal tree */ + ct_data *dtree; /* distance tree */ +{ + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ + unsigned lx = 0; /* running index in l_buf */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + + if (s->last_lit != 0) do { + dist = s->d_buf[lx]; + lc = s->l_buf[lx++]; + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code+LITERALS+1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra != 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra != 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + "pendingBuf overflow"); + + } while (lx < s->last_lit); + + send_code(s, END_BLOCK, ltree); + s->last_eob_len = ltree[END_BLOCK].Len; +} + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +local int detect_data_type(s) + deflate_state *s; +{ + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + unsigned long black_mask = 0xf3ffc07fUL; + int n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>= 1) + if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) + return Z_BINARY; + + /* Check for textual ("white-listed") bytes. */ + if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 + || s->dyn_ltree[13].Freq != 0) + return Z_TEXT; + for (n = 32; n < LITERALS; n++) + if (s->dyn_ltree[n].Freq != 0) + return Z_TEXT; + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +local unsigned bi_reverse(code, len) + unsigned code; /* the value to invert */ + int len; /* its bit length */ +{ + register unsigned res = 0; + do { + res |= code & 1; + code >>= 1, res <<= 1; + } while (--len > 0); + return res >> 1; +} + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +local void bi_flush(s) + deflate_state *s; +{ + if (s->bi_valid == 16) { + put_short(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } else if (s->bi_valid >= 8) { + put_byte(s, (Byte)s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } +} + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +local void bi_windup(s) + deflate_state *s; +{ + if (s->bi_valid > 8) { + put_short(s, s->bi_buf); + } else if (s->bi_valid > 0) { + put_byte(s, (Byte)s->bi_buf); + } + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef DEBUG + s->bits_sent = (s->bits_sent+7) & ~7; +#endif +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +local void copy_block(s, buf, len, header) + deflate_state *s; + charf *buf; /* the input data */ + unsigned len; /* its length */ + int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + s->last_eob_len = 8; /* enough lookahead for inflate */ + + if (header) { + put_short(s, (ush)len); + put_short(s, (ush)~len); +#ifdef DEBUG + s->bits_sent += 2*16; +#endif + } +#ifdef DEBUG + s->bits_sent += (ulg)len<<3; +#endif + while (len--) { + put_byte(s, *buf++); + } +} diff --git a/zlib/trees.h b/zlib/trees.h new file mode 100644 index 0000000..d35639d --- /dev/null +++ b/zlib/trees.h @@ -0,0 +1,128 @@ +/* header created automatically with -DGEN_TREES_H */ + +local const ct_data static_ltree[L_CODES+2] = { +{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, +{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, +{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, +{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, +{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, +{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, +{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, +{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, +{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, +{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, +{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, +{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, +{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, +{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, +{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, +{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, +{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, +{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, +{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, +{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, +{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, +{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, +{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, +{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, +{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, +{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, +{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, +{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, +{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, +{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, +{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, +{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, +{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, +{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, +{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, +{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, +{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, +{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, +{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, +{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, +{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, +{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, +{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, +{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, +{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, +{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, +{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, +{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, +{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, +{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, +{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, +{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, +{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, +{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, +{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, +{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, +{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, +{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} +}; + +local const ct_data static_dtree[D_CODES] = { +{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, +{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, +{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, +{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, +{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, +{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} +}; + +const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, +18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 +}; + +const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, +13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, +17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, +19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 +}; + +local const int base_length[LENGTH_CODES] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, +64, 80, 96, 112, 128, 160, 192, 224, 0 +}; + +local const int base_dist[D_CODES] = { + 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, + 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, + 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 +}; + diff --git a/zlib/uncompr.c b/zlib/uncompr.c new file mode 100644 index 0000000..ad98be3 --- /dev/null +++ b/zlib/uncompr.c @@ -0,0 +1,59 @@ +/* uncompr.c -- decompress a memory buffer + * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted. +*/ +int ZEXPORT uncompress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; + + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + + err = inflateInit(&stream); + if (err != Z_OK) return err; + + err = inflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + inflateEnd(&stream); + if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) + return Z_DATA_ERROR; + return err; + } + *destLen = stream.total_out; + + err = inflateEnd(&stream); + return err; +} diff --git a/zlib/zconf.h b/zlib/zconf.h new file mode 100644 index 0000000..02ce56c --- /dev/null +++ b/zlib/zconf.h @@ -0,0 +1,428 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ + +/* all linked symbols */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzgetc z_gzgetc +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzwrite z_gzwrite +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetHeader z_inflateGetHeader +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# define uncompress z_uncompress +# define zError z_zError +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# define gzFile z_gzFile +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#ifdef STDC +# include /* for off_t */ +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define z_off64_t off64_t +#else +# define z_off64_t z_off_t +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/zlib/zconf.h.cmakein b/zlib/zconf.h.cmakein new file mode 100644 index 0000000..a2f71b1 --- /dev/null +++ b/zlib/zconf.h.cmakein @@ -0,0 +1,430 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H +#cmakedefine Z_PREFIX +#cmakedefine Z_HAVE_UNISTD_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ + +/* all linked symbols */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzgetc z_gzgetc +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzwrite z_gzwrite +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetHeader z_inflateGetHeader +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# define uncompress z_uncompress +# define zError z_zError +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# define gzFile z_gzFile +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#ifdef STDC +# include /* for off_t */ +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define z_off64_t off64_t +#else +# define z_off64_t z_off_t +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/zlib/zconf.h.in b/zlib/zconf.h.in new file mode 100644 index 0000000..02ce56c --- /dev/null +++ b/zlib/zconf.h.in @@ -0,0 +1,428 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ + +/* all linked symbols */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzgetc z_gzgetc +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzwrite z_gzwrite +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetHeader z_inflateGetHeader +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# define uncompress z_uncompress +# define zError z_zError +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# define gzFile z_gzFile +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#ifdef STDC +# include /* for off_t */ +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define z_off64_t off64_t +#else +# define z_off64_t z_off_t +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/zlib/zlib.3 b/zlib/zlib.3 new file mode 100644 index 0000000..27adc4c --- /dev/null +++ b/zlib/zlib.3 @@ -0,0 +1,151 @@ +.TH ZLIB 3 "19 Apr 2010" +.SH NAME +zlib \- compression/decompression library +.SH SYNOPSIS +[see +.I zlib.h +for full description] +.SH DESCRIPTION +The +.I zlib +library is a general purpose data compression library. +The code is thread safe, assuming that the standard library functions +used are thread safe, such as memory allocation routines. +It provides in-memory compression and decompression functions, +including integrity checks of the uncompressed data. +This version of the library supports only one compression method (deflation) +but other algorithms may be added later +with the same stream interface. +.LP +Compression can be done in a single step if the buffers are large enough +or can be done by repeated calls of the compression function. +In the latter case, +the application must provide more input and/or consume the output +(providing more output space) before each call. +.LP +The library also supports reading and writing files in +.IR gzip (1) +(.gz) format +with an interface similar to that of stdio. +.LP +The library does not install any signal handler. +The decoder checks the consistency of the compressed data, +so the library should never crash even in the case of corrupted input. +.LP +All functions of the compression library are documented in the file +.IR zlib.h . +The distribution source includes examples of use of the library +in the files +.I example.c +and +.IR minigzip.c, +as well as other examples in the +.IR examples/ +directory. +.LP +Changes to this version are documented in the file +.I ChangeLog +that accompanies the source. +.LP +.I zlib +is available in Java using the java.util.zip package: +.IP +http://java.sun.com/developer/technicalArticles/Programming/compression/ +.LP +A Perl interface to +.IR zlib , +written by Paul Marquess (pmqs@cpan.org), +is available at CPAN (Comprehensive Perl Archive Network) sites, +including: +.IP +http://search.cpan.org/~pmqs/IO-Compress-Zlib/ +.LP +A Python interface to +.IR zlib , +written by A.M. Kuchling (amk@magnet.com), +is available in Python 1.5 and later versions: +.IP +http://www.python.org/doc/lib/module-zlib.html +.LP +.I zlib +is built into +.IR tcl: +.IP +http://wiki.tcl.tk/4610 +.LP +An experimental package to read and write files in .zip format, +written on top of +.I zlib +by Gilles Vollant (info@winimage.com), +is available at: +.IP +http://www.winimage.com/zLibDll/minizip.html +and also in the +.I contrib/minizip +directory of the main +.I zlib +source distribution. +.SH "SEE ALSO" +The +.I zlib +web site can be found at: +.IP +http://zlib.net/ +.LP +The data format used by the zlib library is described by RFC +(Request for Comments) 1950 to 1952 in the files: +.IP +http://www.ietf.org/rfc/rfc1950.txt (for the zlib header and trailer format) +.br +http://www.ietf.org/rfc/rfc1951.txt (for the deflate compressed data format) +.br +http://www.ietf.org/rfc/rfc1952.txt (for the gzip header and trailer format) +.LP +Mark Nelson wrote an article about +.I zlib +for the Jan. 1997 issue of Dr. Dobb's Journal; +a copy of the article is available at: +.IP +http://marknelson.us/1997/01/01/zlib-engine/ +.SH "REPORTING PROBLEMS" +Before reporting a problem, +please check the +.I zlib +web site to verify that you have the latest version of +.IR zlib ; +otherwise, +obtain the latest version and see if the problem still exists. +Please read the +.I zlib +FAQ at: +.IP +http://zlib.net/zlib_faq.html +.LP +before asking for help. +Send questions and/or comments to zlib@gzip.org, +or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). +.SH AUTHORS +Version 1.2.5 +Copyright (C) 1995-2010 Jean-loup Gailly (jloup@gzip.org) +and Mark Adler (madler@alumni.caltech.edu). +.LP +This software is provided "as-is," +without any express or implied warranty. +In no event will the authors be held liable for any damages +arising from the use of this software. +See the distribution directory with respect to requirements +governing redistribution. +The deflate format used by +.I zlib +was defined by Phil Katz. +The deflate and +.I zlib +specifications were written by L. Peter Deutsch. +Thanks to all the people who reported problems and suggested various +improvements in +.IR zlib ; +who are too numerous to cite here. +.LP +UNIX manual page by R. P. C. Rodgers, +U.S. National Library of Medicine (rodgers@nlm.nih.gov). +.\" end of man page diff --git a/zlib/zlib.3.pdf b/zlib/zlib.3.pdf new file mode 100644 index 0000000..9f8a2c3 Binary files /dev/null and b/zlib/zlib.3.pdf differ diff --git a/zlib/zlib.h b/zlib/zlib.h new file mode 100644 index 0000000..bfbba83 --- /dev/null +++ b/zlib/zlib.h @@ -0,0 +1,1613 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.5, April 19th, 2010 + + Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.5" +#define ZLIB_VERNUM 0x1250 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 5 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use in the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). Some + output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed code + block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the stream + are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least the + value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect the + compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the + exact value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit() does not process any header information -- that is deferred + until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing will + resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all the uncompressed data. (The size + of the uncompressed data may have been saved by the compressor for this + purpose.) The next operation on this stream must be inflateEnd to deallocate + the decompression state. The use of Z_FINISH is never required, but can be + used to inform inflate that a faster approach may be used for the single + inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK or Z_TREES is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained, so applications that need that information should + instead use raw inflate, see inflateInit2() below, or inflateBack() and + perform their own processing of the gzip header and trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as + fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The + strategy parameter only affects the compression ratio but not the + correctness of the compressed output even if it is not set appropriately. + Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler + decoder for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any call + of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. The + stream will keep the same compression level and any other attributes that + may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression level is changed, the input available so far is + compressed with the old level (and may be flushed); the new level will take + effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to be + compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if + strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been + found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the + success case, the application may save the current current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, + int windowBits)); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above or -1 << 16 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When any + of extra, name, or comment are not Z_NULL and the respective field is not + present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the normal + behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, destLen + is the actual size of the uncompressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef voidp gzFile; /* opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); + + Opens a gzip (.gz) file for reading or writing. The mode parameter is as + in fopen ("rb" or "wb") but can also include a compression level ("wb9") or + a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only + compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' + for fixed code compression as in "wb9F". (See the description of + deflateInit2 for more information about the strategy parameter.) Also "a" + can be used instead of "w" to request that the gzip stream that will be + written be appended to the file. "+" will result in an error, since reading + and writing to the same gzip file is not supported. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen associates a gzFile with the file descriptor fd. File descriptors + are obtained from calls like open, dup, creat, pipe or fileno (if the file + has been previously opened with fopen). The mode parameter is as in gzopen. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +/* + Set the internal buffer size used by this library's functions. The + default buffer size is 8192 bytes. This function must be called after + gzopen() or gzdopen(), and before any other calls that read or write the + file. The buffer memory allocation is always deferred to the first read or + write. Two buffers are allocated, either both of the specified size when + writing, or one of the specified size and the other twice that size when + reading. A larger buffer size of, for example, 64K or 128K bytes will + noticeably increase the speed of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. If + the input file was not in gzip format, gzread copies the given number of + bytes into the buffer. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream, or failing that, reading the rest + of the input file directly without decompression. The entire input file + will be read if gzread is called until it returns less than the requested + len. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. +*/ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes written or 0 in case of + error. +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the arguments to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or 0 in case of error. The number of + uncompressed bytes written is limited to 8191, or one less than the buffer + size given to gzbuffer(). The caller should assure that this limit is not + exceeded. If it is exceeded, then gzprintf() will return an error (0) with + nothing written. In this case, there may also be a buffer overflow with + unpredictable consequences, which is possible only if zlib was compiled with + the insecure functions sprintf() or vsprintf() because the secure snprintf() + or vsnprintf() functions were not available. This can be determined using + zlibCompileFlags(). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or a + newline character is read and transferred to buf, or an end-of-file + condition is encountered. If any characters are read or if len == 1, the + string is terminated with a null character. If no characters are read due + to an end-of-file or len < 1, then the buffer is left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If there was an error, the contents at + buf are indeterminate. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte or -1 + in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read as the first character + on the next read. At least one character of push-back is allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter flush + is as in the deflate() function. The return value is the zlib error number + (see function gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatented gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); + + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); + + Returns the starting position for the next gzread or gzwrite on the given + compressed file. This position represents a number of bytes in the + uncompressed data stream, and is zero when starting, even if appending or + reading a gzip stream from the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); + + Returns the current offset in the file being read or written. This offset + includes the count of bytes that precede the gzip stream, for example when + appending or when using gzdopen() for reading. When reading, the offset + does not include as yet unused buffered input. This information can be used + for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns true (1) if the end-of-file indicator has been set while reading, + false (0) otherwise. Note that the end-of-file indicator is set only if the + read tried to go past the end of the input, but came up short. Therefore, + just like feof(), gzeof() may return false even if there is no more data to + read, in the event that the last read request was for the exact number of + bytes remaining in the input file. This will happen if the input file size + is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. This state can change from + false to true while reading the input file if the end of a gzip stream is + reached, but is followed by data that is not another gzip stream. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file and + deallocates the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the given + compressed file. errnum is set to zlib error number. If an error occurred + in the file system and not in the compression library, errnum is set to + Z_ERRNO and the application may consult errno to get the exact error code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is Z_NULL, this function returns the + required initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is Z_NULL, this function returns the required + initial value for the for the crc. Pre- and post-conditioning (one's + complement) is performed within this function so it shouldn't be done by the + application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# ifdef _LARGEFILE64_SOURCE + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +/* hack for buggy compilers */ +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; +#endif + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); +ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/zlib/zlib.map b/zlib/zlib.map new file mode 100644 index 0000000..f282d36 --- /dev/null +++ b/zlib/zlib.map @@ -0,0 +1,68 @@ +ZLIB_1.2.0 { + global: + compressBound; + deflateBound; + inflateBack; + inflateBackEnd; + inflateBackInit_; + inflateCopy; + local: + deflate_copyright; + inflate_copyright; + inflate_fast; + inflate_table; + zcalloc; + zcfree; + z_errmsg; + gz_error; + gz_intmax; + _*; +}; + +ZLIB_1.2.0.2 { + gzclearerr; + gzungetc; + zlibCompileFlags; +} ZLIB_1.2.0; + +ZLIB_1.2.0.8 { + deflatePrime; +} ZLIB_1.2.0.2; + +ZLIB_1.2.2 { + adler32_combine; + crc32_combine; + deflateSetHeader; + inflateGetHeader; +} ZLIB_1.2.0.8; + +ZLIB_1.2.2.3 { + deflateTune; + gzdirect; +} ZLIB_1.2.2; + +ZLIB_1.2.2.4 { + inflatePrime; +} ZLIB_1.2.2.3; + +ZLIB_1.2.3.3 { + adler32_combine64; + crc32_combine64; + gzopen64; + gzseek64; + gztell64; + inflateUndermine; +} ZLIB_1.2.2.4; + +ZLIB_1.2.3.4 { + inflateReset2; + inflateMark; +} ZLIB_1.2.3.3; + +ZLIB_1.2.3.5 { + gzbuffer; + gzoffset; + gzoffset64; + gzclose_r; + gzclose_w; +} ZLIB_1.2.3.4; diff --git a/zlib/zlib.pc.in b/zlib/zlib.pc.in new file mode 100644 index 0000000..7e5acf9 --- /dev/null +++ b/zlib/zlib.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +sharedlibdir=@sharedlibdir@ +includedir=@includedir@ + +Name: zlib +Description: zlib compression library +Version: @VERSION@ + +Requires: +Libs: -L${libdir} -L${sharedlibdir} -lz +Cflags: -I${includedir} diff --git a/zlib/zlib100.vcxproj b/zlib/zlib100.vcxproj new file mode 100644 index 0000000..e7e12b8 --- /dev/null +++ b/zlib/zlib100.vcxproj @@ -0,0 +1,252 @@ + + + + + debug100 + Win32 + + + Debug + Win32 + + + Release + Win32 + + + + {5C2D7860-D1EE-4D75-B42B-EE548AD6E9F9} + zlib + zlib100 + + + + StaticLibrary + false + v140_xp + + + StaticLibrary + false + true + v140_xp + + + StaticLibrary + false + v140_xp + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)\build\$(Configuration)\ + $(SolutionDir)\build\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\build\$(Configuration)\ + $(SolutionDir)\build\$(Configuration)\$(ProjectName)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + false + WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebug + Level3 + false + true + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + + + true + .\Win32_LIB_Debug/zlib.bsc + + + + + MaxSpeed + AnySuitable + true + false + false + _ALLOW_KEYWORD_MACROS;WIN32;NDEBUG;%(PreprocessorDefinitions) + true + Async + MultiThreaded + true + true + NotSet + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + + + true + .\Win32_LIB_Release/zlib.bsc + + + + + Disabled + false + WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + Async + EnableFastChecks + MultiThreadedDebug + Level3 + false + true + EditAndContinue + true + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + + + true + .\Win32_LIB_Debug/zlib.bsc + true + + + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + + + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + + + true + true + true + + + Document + true + true + true + + + Document + true + true + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zlib/zlib100.vcxproj.filters b/zlib/zlib100.vcxproj.filters new file mode 100644 index 0000000..f8e2a0c --- /dev/null +++ b/zlib/zlib100.vcxproj.filters @@ -0,0 +1,107 @@ + + + + + {0d756b03-d890-4cc4-a98d-fb37c7f5d5eb} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {b6fe41dc-04d3-49bb-a407-e51e595d4b53} + h;hpp;hxx;hm;inl + + + {f76411d7-5e44-4aa6-908a-8c18b65d3f27} + asm;obj;c;cpp;cxx;h;hpp;hxx + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Assembler Files %28Unsupported%29 + + + \ No newline at end of file diff --git a/zlib/zlib2ansi b/zlib/zlib2ansi new file mode 100644 index 0000000..15e3e16 --- /dev/null +++ b/zlib/zlib2ansi @@ -0,0 +1,152 @@ +#!/usr/bin/perl + +# Transform K&R C function definitions into ANSI equivalent. +# +# Author: Paul Marquess +# Version: 1.0 +# Date: 3 October 2006 + +# TODO +# +# Asumes no function pointer parameters. unless they are typedefed. +# Assumes no literal strings that look like function definitions +# Assumes functions start at the beginning of a line + +use strict; +use warnings; + +local $/; +$_ = <>; + +my $sp = qr{ \s* (?: /\* .*? \*/ )? \s* }x; # assume no nested comments + +my $d1 = qr{ $sp (?: [\w\*\s]+ $sp)* $sp \w+ $sp [\[\]\s]* $sp }x ; +my $decl = qr{ $sp (?: \w+ $sp )+ $d1 }xo ; +my $dList = qr{ $sp $decl (?: $sp , $d1 )* $sp ; $sp }xo ; + + +while (s/^ + ( # Start $1 + ( # Start $2 + .*? # Minimal eat content + ( ^ \w [\w\s\*]+ ) # $3 -- function name + \s* # optional whitespace + ) # $2 - Matched up to before parameter list + + \( \s* # Literal "(" + optional whitespace + ( [^\)]+ ) # $4 - one or more anythings except ")" + \s* \) # optional whitespace surrounding a Literal ")" + + ( (?: $dList )+ ) # $5 + + $sp ^ { # literal "{" at start of line + ) # Remember to $1 + //xsom + ) +{ + my $all = $1 ; + my $prefix = $2; + my $param_list = $4 ; + my $params = $5; + + StripComments($params); + StripComments($param_list); + $param_list =~ s/^\s+//; + $param_list =~ s/\s+$//; + + my $i = 0 ; + my %pList = map { $_ => $i++ } + split /\s*,\s*/, $param_list; + my $pMatch = '(\b' . join('|', keys %pList) . '\b)\W*$' ; + + my @params = split /\s*;\s*/, $params; + my @outParams = (); + foreach my $p (@params) + { + if ($p =~ /,/) + { + my @bits = split /\s*,\s*/, $p; + my $first = shift @bits; + $first =~ s/^\s*//; + push @outParams, $first; + $first =~ /^(\w+\s*)/; + my $type = $1 ; + push @outParams, map { $type . $_ } @bits; + } + else + { + $p =~ s/^\s+//; + push @outParams, $p; + } + } + + + my %tmp = map { /$pMatch/; $_ => $pList{$1} } + @outParams ; + + @outParams = map { " $_" } + sort { $tmp{$a} <=> $tmp{$b} } + @outParams ; + + print $prefix ; + print "(\n" . join(",\n", @outParams) . ")\n"; + print "{" ; + +} + +# Output any trailing code. +print ; +exit 0; + + +sub StripComments +{ + + no warnings; + + # Strip C & C++ coments + # From the perlfaq + $_[0] =~ + + s{ + /\* ## Start of /* ... */ comment + [^*]*\*+ ## Non-* followed by 1-or-more *'s + ( + [^/*][^*]*\*+ + )* ## 0-or-more things which don't start with / + ## but do end with '*' + / ## End of /* ... */ comment + + | ## OR C++ Comment + // ## Start of C++ comment // + [^\n]* ## followed by 0-or-more non end of line characters + + | ## OR various things which aren't comments: + + ( + " ## Start of " ... " string + ( + \\. ## Escaped char + | ## OR + [^"\\] ## Non "\ + )* + " ## End of " ... " string + + | ## OR + + ' ## Start of ' ... ' string + ( + \\. ## Escaped char + | ## OR + [^'\\] ## Non '\ + )* + ' ## End of ' ... ' string + + | ## OR + + . ## Anything other char + [^/"'\\]* ## Chars which doesn't start a comment, string or escape + ) + }{$2}gxs; + +} diff --git a/zlib/zlib80.vcproj b/zlib/zlib80.vcproj new file mode 100644 index 0000000..58ae842 --- /dev/null +++ b/zlib/zlib80.vcproj @@ -0,0 +1,747 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/zlib90.vcproj b/zlib/zlib90.vcproj new file mode 100644 index 0000000..01fbc81 --- /dev/null +++ b/zlib/zlib90.vcproj @@ -0,0 +1,748 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/zutil.c b/zlib/zutil.c new file mode 100644 index 0000000..898ed34 --- /dev/null +++ b/zlib/zutil.c @@ -0,0 +1,318 @@ +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-2005, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" + +#ifndef NO_DUMMY_DECL +struct internal_state {int dummy;}; /* for buggy compilers */ +#endif + +const char * const z_errmsg[10] = { +"need dictionary", /* Z_NEED_DICT 2 */ +"stream end", /* Z_STREAM_END 1 */ +"", /* Z_OK 0 */ +"file error", /* Z_ERRNO (-1) */ +"stream error", /* Z_STREAM_ERROR (-2) */ +"data error", /* Z_DATA_ERROR (-3) */ +"insufficient memory", /* Z_MEM_ERROR (-4) */ +"buffer error", /* Z_BUF_ERROR (-5) */ +"incompatible version",/* Z_VERSION_ERROR (-6) */ +""}; + + +const char * ZEXPORT zlibVersion() +{ + return ZLIB_VERSION; +} + +uLong ZEXPORT zlibCompileFlags() +{ + uLong flags; + + flags = 0; + switch ((int)(sizeof(uInt))) { + case 2: break; + case 4: flags += 1; break; + case 8: flags += 2; break; + default: flags += 3; + } + switch ((int)(sizeof(uLong))) { + case 2: break; + case 4: flags += 1 << 2; break; + case 8: flags += 2 << 2; break; + default: flags += 3 << 2; + } + switch ((int)(sizeof(voidpf))) { + case 2: break; + case 4: flags += 1 << 4; break; + case 8: flags += 2 << 4; break; + default: flags += 3 << 4; + } + switch ((int)(sizeof(z_off_t))) { + case 2: break; + case 4: flags += 1 << 6; break; + case 8: flags += 2 << 6; break; + default: flags += 3 << 6; + } +#ifdef DEBUG + flags += 1 << 8; +#endif +#if defined(ASMV) || defined(ASMINF) + flags += 1 << 9; +#endif +#ifdef ZLIB_WINAPI + flags += 1 << 10; +#endif +#ifdef BUILDFIXED + flags += 1 << 12; +#endif +#ifdef DYNAMIC_CRC_TABLE + flags += 1 << 13; +#endif +#ifdef NO_GZCOMPRESS + flags += 1L << 16; +#endif +#ifdef NO_GZIP + flags += 1L << 17; +#endif +#ifdef PKZIP_BUG_WORKAROUND + flags += 1L << 20; +#endif +#ifdef FASTEST + flags += 1L << 21; +#endif +#ifdef STDC +# ifdef NO_vsnprintf + flags += 1L << 25; +# ifdef HAS_vsprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_vsnprintf_void + flags += 1L << 26; +# endif +# endif +#else + flags += 1L << 24; +# ifdef NO_snprintf + flags += 1L << 25; +# ifdef HAS_sprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_snprintf_void + flags += 1L << 26; +# endif +# endif +#endif + return flags; +} + +#ifdef DEBUG + +# ifndef verbose +# define verbose 0 +# endif +int ZLIB_INTERNAL z_verbose = verbose; + +void ZLIB_INTERNAL z_error (m) + char *m; +{ + fprintf(stderr, "%s\n", m); + exit(1); +} +#endif + +/* exported to allow conversion of error code to string for compress() and + * uncompress() + */ +const char * ZEXPORT zError(err) + int err; +{ + return ERR_MSG(err); +} + +#if defined(_WIN32_WCE) + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. + */ + int errno = 0; +#endif + +#ifndef HAVE_MEMCPY + +void ZLIB_INTERNAL zmemcpy(dest, source, len) + Bytef* dest; + const Bytef* source; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = *source++; /* ??? to be unrolled */ + } while (--len != 0); +} + +int ZLIB_INTERNAL zmemcmp(s1, s2, len) + const Bytef* s1; + const Bytef* s2; + uInt len; +{ + uInt j; + + for (j = 0; j < len; j++) { + if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; + } + return 0; +} + +void ZLIB_INTERNAL zmemzero(dest, len) + Bytef* dest; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = 0; /* ??? to be unrolled */ + } while (--len != 0); +} +#endif + + +#ifdef SYS16BIT + +#ifdef __TURBOC__ +/* Turbo C in 16-bit mode */ + +# define MY_ZCALLOC + +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes + * and farmalloc(64K) returns a pointer with an offset of 8, so we + * must fix the pointer. Warning: the pointer must be put back to its + * original form in order to free it, use zcfree(). + */ + +#define MAX_PTR 10 +/* 10*64K = 640K */ + +local int next_ptr = 0; + +typedef struct ptr_table_s { + voidpf org_ptr; + voidpf new_ptr; +} ptr_table; + +local ptr_table table[MAX_PTR]; +/* This table is used to remember the original form of pointers + * to large buffers (64K). Such pointers are normalized with a zero offset. + * Since MSDOS is not a preemptive multitasking OS, this table is not + * protected from concurrent access. This hack doesn't work anyway on + * a protected system like OS/2. Use Microsoft C instead. + */ + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + voidpf buf = opaque; /* just to make some compilers happy */ + ulg bsize = (ulg)items*size; + + /* If we allocate less than 65520 bytes, we assume that farmalloc + * will return a usable pointer which doesn't have to be normalized. + */ + if (bsize < 65520L) { + buf = farmalloc(bsize); + if (*(ush*)&buf != 0) return buf; + } else { + buf = farmalloc(bsize + 16L); + } + if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + table[next_ptr].org_ptr = buf; + + /* Normalize the pointer to seg:0 */ + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; + *(ush*)&buf = 0; + table[next_ptr++].new_ptr = buf; + return buf; +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + int n; + if (*(ush*)&ptr != 0) { /* object < 64K */ + farfree(ptr); + return; + } + /* Find the original pointer */ + for (n = 0; n < next_ptr; n++) { + if (ptr != table[n].new_ptr) continue; + + farfree(table[n].org_ptr); + while (++n < next_ptr) { + table[n-1] = table[n]; + } + next_ptr--; + return; + } + ptr = opaque; /* just to make some compilers happy */ + Assert(0, "zcfree: ptr not found"); +} + +#endif /* __TURBOC__ */ + + +#ifdef M_I86 +/* Microsoft C in 16-bit mode */ + +# define MY_ZCALLOC + +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) +# define _halloc halloc +# define _hfree hfree +#endif + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + return _halloc((long)items, size); +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + _hfree(ptr); +} + +#endif /* M_I86 */ + +#endif /* SYS16BIT */ + + +#ifndef MY_ZCALLOC /* Any system without a special alloc function */ + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern voidp calloc OF((uInt items, uInt size)); +extern void free OF((voidpf ptr)); +#endif + +voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + if (opaque) items += size - size; /* make compiler happy */ + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); +} + +void ZLIB_INTERNAL zcfree (opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + free(ptr); + if (opaque) return; /* make compiler happy */ +} + +#endif /* MY_ZCALLOC */ diff --git a/zlib/zutil.h b/zlib/zutil.h new file mode 100644 index 0000000..258fa88 --- /dev/null +++ b/zlib/zutil.h @@ -0,0 +1,274 @@ +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef ZUTIL_H +#define ZUTIL_H + +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include "zlib.h" + +#ifdef STDC +# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) +# include +# endif +# include +# include +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +/* (size given to avoid silly warnings with Visual C++) */ + +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = (char*)ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ + +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +# define OS_CODE 0x00 +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include +# endif +# else /* MSC or DJGPP */ +# include +# endif +#endif + +#ifdef AMIGA +# define OS_CODE 0x01 +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 0x02 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 0x05 +#endif + +#ifdef OS2 +# define OS_CODE 0x06 +# ifdef M_I86 +# include +# endif +#endif + +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 0x07 +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif +# endif +#endif + +#ifdef TOPS20 +# define OS_CODE 0x0a +#endif + +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + +#if defined(_BEOS_) || defined(RISCOS) +# define fdopen(fd,mode) NULL /* No fdopen() */ +#endif + +#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif +#endif + +#if defined(__BORLANDC__) + #pragma warn -8004 + #pragma warn -8008 + #pragma warn -8066 +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +#endif + + /* common defaults */ + +#ifndef OS_CODE +# define OS_CODE 0x03 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS + /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 + /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) +# define vsnprintf _vsnprintf +# endif +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +#endif +#ifdef VMS +# define NO_vsnprintf +#endif + +#if defined(pyr) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); +#endif + +/* Diagnostic functions */ +#ifdef DEBUG +# include + extern int ZLIB_INTERNAL z_verbose; + extern void ZLIB_INTERNAL z_error OF((char *m)); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + + +voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, + unsigned size)); +void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +#endif /* ZUTIL_H */